feat: implement provider-side prompt caching and workflow scaffolding
ci / check (macos-latest) (push) Canceled after 0s
ci / check (ubuntu-latest) (push) Canceled after 0s
ci / check (windows-latest) (push) Canceled after 0s

- Added support for caching the stable prefix of the system prompt for Anthropic models.
- Introduced a new option `cacheSystemPrefix` in SessionOptions to enable caching.
- Implemented a nudge escalation system that reminds users to update the TODO.md file, capped at three nudges.
- Created a new `scaffoldWorkflowFiles` function to generate TODO.md, ROADMAP.md, and docs/ directory when they are missing.
- Updated the App component to scaffold workflow files during initialization.
- Added hooks functionality to allow external scripts to modify tool input and manage approvals.
- Implemented tests for the new hooks functionality, ensuring proper approval and execution flow.
This commit is contained in:
asepharyana
2026-09-09 20:11:23 +07:00
parent 4aeb0d2455
commit 7a1e415fea
12 changed files with 884 additions and 32 deletions
+6 -1
View File
@@ -91,6 +91,8 @@ export type AppHooks = {
};
/** Prompt to hand the model for /init. */
initPrompt: string;
/** Directly scaffold TODO.md / ROADMAP.md / docs/ when they are missing; returns what was written. */
scaffoldWorkflow: () => string[];
history: string[];
recordPrompt: (text: string) => void;
};
@@ -657,10 +659,13 @@ export function App({
setWorking(false);
return;
}
case 'init':
case 'init': {
push({ kind: 'user', text: chosen.trim() });
const written = hooks.scaffoldWorkflow();
if (written.length > 0) push({ kind: 'info', text: `scaffolded ${written.join(', ')}` });
await runTurn(hooks.initPrompt);
return;
}
case 'model':
push({ kind: 'user', text: chosen.trim() });
try {