({
event,
subcommand,
userInput,
locale,
now,
timezone,
pendingDraft,
jobs,
repoContext,
}: {
event: InboundTextEvent;
subcommand: 'add' | 'edit' | 'natural';
userInput: string;
locale: string | null;
now: number;
timezone: string | null;
pendingDraft: PendingAgentDraft | null;
jobs: AgentJob[];
repoContext: AgentRepoContext;
})
| 15518 | } |
| 15519 | |
| 15520 | function buildAgentCommandSkillPrompt({ |
| 15521 | event, |
| 15522 | subcommand, |
| 15523 | userInput, |
| 15524 | locale, |
| 15525 | now, |
| 15526 | timezone, |
| 15527 | pendingDraft, |
| 15528 | jobs, |
| 15529 | repoContext, |
| 15530 | }: { |
| 15531 | event: InboundTextEvent; |
| 15532 | subcommand: 'add' | 'edit' | 'natural'; |
| 15533 | userInput: string; |
| 15534 | locale: string | null; |
| 15535 | now: number; |
| 15536 | timezone: string | null; |
| 15537 | pendingDraft: PendingAgentDraft | null; |
| 15538 | jobs: AgentJob[]; |
| 15539 | repoContext: AgentRepoContext; |
| 15540 | }): string { |
| 15541 | const normalizedTimezone = normalizeAssistantPromptTimezone(timezone); |
| 15542 | const payload = { |
| 15543 | command: 'agent', |
| 15544 | subcommand, |
| 15545 | rawText: String(event.text ?? ''), |
| 15546 | userInput, |
| 15547 | now: new Date(now).toISOString(), |
| 15548 | locale: normalizeLocale(locale) ?? 'zh-CN', |
| 15549 | timezone: normalizedTimezone, |
| 15550 | localTime: formatAssistantPromptLocalDateTime(now, normalizedTimezone), |
| 15551 | scope: { |
| 15552 | platform: event.platform, |
| 15553 | externalScopeId: event.externalScopeId, |
| 15554 | }, |
| 15555 | pendingDraft: pendingDraft ? agentDraftToCommandSkillJson(pendingDraft) : null, |
| 15556 | jobs: jobs.map((job, index) => agentJobToCommandSkillJson(job, index + 1)), |
| 15557 | repoContext: { |
| 15558 | cwd: repoContext.cwd, |
| 15559 | repoRoot: repoContext.repoRoot, |
| 15560 | repoName: repoContext.repoName, |
| 15561 | branch: repoContext.branch, |
| 15562 | packageManager: repoContext.packageManager, |
| 15563 | packageScripts: repoContext.packageScripts, |
| 15564 | topLevelEntries: repoContext.topLevelEntries, |
| 15565 | }, |
| 15566 | skillPath: AGENT_COMMAND_SKILL_PATH, |
| 15567 | }; |
| 15568 | return [ |
| 15569 | 'CodexBridge command skill invocation.', |
| 15570 | '', |
| 15571 | `Please read and follow this command skill file: ${AGENT_COMMAND_SKILL_PATH}`, |
| 15572 | 'Use it to interpret the /agent command request below.', |
| 15573 | 'This is a collaborative agent router. The skill owns task typing, scope narrowing, and draft-shape decisions; Bridge will only relay the skill response and will not reinterpret it with extra host-side heuristics.', |
| 15574 | 'Generate plan[] as the formal checklist from the user goal and repoContext. Never leave plan[] empty; if you cannot derive at least 3 concrete checklist items, return clarify instead of create_draft.', |
| 15575 | 'Return exactly one JSON object that matches the skill contract.', |
| 15576 | 'Do not use Markdown. Do not explain. Do not create, run, stop, retry, delete, or persist Agent jobs yourself.', |
| 15577 | '', |
no test coverage detected