openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
47 lines (46 loc) • 2.7 kB
JavaScript
import { r as isIncognitoSessionKey } from "./session-key-DW1jcHbM.mjs";
import { w as parseCronRunScopeSuffix } from "./session-key-CqAyZeVk.mjs";
import { t as createSubsystemLogger } from "./subsystem-BHJiy01V.mjs";
import { c as isMainGitContributorScope } from "./session-entry-provenance-01l9mXT0.mjs";
import { n as resolveGitCoauthorAttribution } from "./git-coauthor-attribution-Bbw_RiRN.mjs";
//#region src/agents/git-coauthor-prompt.ts
const log = createSubsystemLogger("agents/system-prompt");
/** Request credit belongs in per-turn context, never main's retained instructions. */
async function resolveRequestGitCoauthorPrompt(e) {
if (!e.sessionKey || !isMainGitContributorScope({
...e,
sessionKey: e.sessionKey
})) return;
try {
const t = await resolveGitCoauthorAttribution(e);
return t?.trailers.length ? ["Git co-author credit for this request: preserve these verified requester trailers in commits and delegation. Do not substitute the main session's roster. Retain other legitimate task co-authors.", ...t.trailers].join("\n") : "Git co-author credit for this request: no host-verified requester trailer is available. Do not infer credit from this main session's roster, earlier tasks, display names, or the publishing account. Preserve any separately verified task contributor credit.";
} catch (e) {
log.warn("failed to resolve request Git co-authors", { error: e });
return;
}
}
async function resolveSessionGitCoauthorPrompt(e) {
if (!e.config || !e.agentId || !e.sessionKey) return;
if (parseCronRunScopeSuffix(e.sessionKey).runId !== void 0) return;
if (isIncognitoSessionKey(e.sessionKey)) return;
if (isMainGitContributorScope({
config: e.config,
agentId: e.agentId,
sessionKey: e.sessionKey
})) return "Git co-authors: this main session routes unrelated conversations. Its participant roster is not a task's contributor list. Use only the current request's verified Git co-author trailers when supplied; never copy credit from another conversation or an earlier task. Preserve legitimate task co-authors, and do not replace the requester's credit with session participants.";
try {
const t = (await resolveGitCoauthorAttribution({
config: e.config,
agentId: e.agentId,
sessionKey: e.sessionKey,
...e.sessionId ? { sessionId: e.sessionId } : {},
storePath: e.storePath
}))?.trailers;
return t?.length ? ["Git co-authors: add these exact trailers to every commit you make from this session.", ...t].join("\n") : void 0;
} catch (e) {
log.warn("failed to resolve session Git co-authors", { error: e });
return;
}
}
//#endregion
export { resolveSessionGitCoauthorPrompt as n, resolveRequestGitCoauthorPrompt as t };