({
event,
command,
subcommand,
userInput,
locale,
now,
cwd,
inventory,
}: {
event: InboundTextEvent;
command: 'search' | 'threads';
subcommand: ThreadCommandSkillSubcommand | null;
userInput: string;
locale: string | null;
now: number;
cwd: string | null;
inventory: ThreadCommandInventoryItem[];
})
| 12639 | } |
| 12640 | |
| 12641 | function buildThreadCommandSkillPrompt({ |
| 12642 | event, |
| 12643 | command, |
| 12644 | subcommand, |
| 12645 | userInput, |
| 12646 | locale, |
| 12647 | now, |
| 12648 | cwd, |
| 12649 | inventory, |
| 12650 | }: { |
| 12651 | event: InboundTextEvent; |
| 12652 | command: 'search' | 'threads'; |
| 12653 | subcommand: ThreadCommandSkillSubcommand | null; |
| 12654 | userInput: string; |
| 12655 | locale: string | null; |
| 12656 | now: number; |
| 12657 | cwd: string | null; |
| 12658 | inventory: ThreadCommandInventoryItem[]; |
| 12659 | }): string { |
| 12660 | const payload = { |
| 12661 | command, |
| 12662 | subcommand: subcommand ?? 'search', |
| 12663 | rawText: String(event.text ?? ''), |
| 12664 | userInput, |
| 12665 | now: new Date(now).toISOString(), |
| 12666 | locale: normalizeLocale(locale) ?? 'zh-CN', |
| 12667 | scope: { |
| 12668 | platform: event.platform, |
| 12669 | externalScopeId: event.externalScopeId, |
| 12670 | }, |
| 12671 | cwd, |
| 12672 | threads: inventory.map((item, index) => ({ |
| 12673 | index: index + 1, |
| 12674 | threadId: item.threadId, |
| 12675 | title: item.title, |
| 12676 | alias: item.alias, |
| 12677 | preview: item.preview, |
| 12678 | updatedAt: typeof item.updatedAt === 'number' ? new Date(item.updatedAt).toISOString() : null, |
| 12679 | archived: typeof item.archivedAt === 'number', |
| 12680 | pinned: typeof item.pinnedAt === 'number', |
| 12681 | isCurrent: item.isCurrent, |
| 12682 | })), |
| 12683 | capabilities: { |
| 12684 | supportedActions: [...THREAD_COMMAND_SKILL_ACTIONS], |
| 12685 | maxResults: THREAD_COMMAND_SKILL_RESULT_LIMIT, |
| 12686 | supportedManagementOperations: ['archive', 'restore', 'pin', 'unpin'], |
| 12687 | }, |
| 12688 | skillPath: THREAD_COMMAND_SKILL_PATH, |
| 12689 | }; |
| 12690 | return [ |
| 12691 | 'CodexBridge command skill invocation.', |
| 12692 | '', |
| 12693 | `Please read and follow this command skill file: ${THREAD_COMMAND_SKILL_PATH}`, |
| 12694 | `Use it to interpret the /${command} thread command request below.`, |
| 12695 | 'Return exactly one JSON object that matches the skill contract.', |
| 12696 | 'Do not use Markdown. Do not explain. Do not open, rename, archive, restore, pin, unpin, or persist anything yourself.', |
| 12697 | '', |
| 12698 | 'Invocation payload:', |
no test coverage detected