openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
5 lines • 2.4 kB
JavaScript
import{r as isIncognitoSessionKey}from"./session-key-DYtwLLn1.mjs";import{T as parseCronRunScopeSuffix}from"./session-key-BPgKfU2m.mjs";import{t as createSubsystemLogger}from"./subsystem-DLCDFvCH.mjs";import{c as isMainGitContributorScope}from"./session-entry-provenance-DZd--atF.mjs";import{n as resolveGitCoauthorAttribution}from"./git-coauthor-attribution-CtKYSw8o.mjs";
//!src/agents/git-coauthor-prompt.ts
const log=createSubsystemLogger(`agents/system-prompt`);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 consented requester trailers in commits and delegation. Do not substitute the main session's roster. Retain other legitimate task co-authors.`,...t.trailers].join(`
`):`Git co-author credit for this request: no host-supplied 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 consented 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 host-supplied 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(`
`):void 0}catch(e){log.warn(`failed to resolve session Git co-authors`,{error:e});return}}export{resolveSessionGitCoauthorPrompt as n,resolveRequestGitCoauthorPrompt as t};