framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
58 lines • 3.61 kB
JavaScript
import { FakeDriver } from './driver/index.js';
/**
* The deterministic fake scenario: a small Vike + Prisma orders app.
* It wires a {@link FakeDriver} whose scripted turns walk the exact prompt order
* the flow issues — one build turn (#1372: with no preset and no serve config
* nothing reviews the build, so the build is the whole loop) — so the flow runs
* offline with no CLI and no model, driven entirely *through* the driver seam.
*/
/** The default intent the fake demo builds. */
export const FAKE_INTENT = 'A paginated orders page backed by an orders table, with sign-in.';
// A small, plausible per-turn usage so the demo shows spend accumulating (#322).
const FAKE_USAGE = { costUsd: 0.02, inputTokens: 1800, outputTokens: 600, cacheReadTokens: 12000, cacheCreationTokens: 800 };
const BUILD_TURN = {
text: 'Built the orders app: an orders schema and migration, a paginated /orders page, and a sign-in stub.',
actions: ['Write', 'Write', 'Bash'],
usage: FAKE_USAGE,
};
const TURNS = [BUILD_TURN];
// Demo variants that make the build stop to ask, so the turn-boundary gates (#337
// single-select / #339 multi-select checklist) can be seen offline. The build turn ends
// with an await block; the framework shows the gate, waits, then re-prompts (RESUME_TURN),
// and the agent continues as usual. Needs the dashboard on (so requestChoice is
// wired); selected via FRAMEWORK_FAKE_AWAIT=choices|multiselect|confirmation.
const AWAIT_CHOICES_TURN = {
text: 'I need one decision before wiring auth.\n```await-choices\n' +
'{ "title": "Which auth approach for the orders page?", "options": [{ "label": "Session cookies", "detail": "simple, server-side" }, { "label": "JWT", "detail": "stateless, more moving parts" }], "recommended": "Session cookies" }\n```',
actions: ['Read'],
usage: FAKE_USAGE,
};
const AWAIT_MULTISELECT_TURN = {
text: 'Rated the problems by how clear the optimal solution is.\n```await-choices\n' +
'{ "title": "Which problems should I deep-dive for alternatives?", "multi": true, "options": [{ "label": "auth model", "detail": "rated 3/10", "default": true }, { "label": "pagination", "detail": "rated 7/10" }, { "label": "orders schema", "detail": "rated 2/10", "default": true }] }\n```',
actions: ['Read', 'Grep'],
usage: FAKE_USAGE,
};
const AWAIT_CONFIRMATION_TURN = {
text: 'The scope is large, so I wrote a plan first.\n```await-choices\n' +
'{ "title": "Approve the plan for the orders app?", "file": "PLAN_fake-orders-app.agent.md", "options": [{ "label": "Approve" }, { "label": "Decline", "stop": true }], "recommended": "Approve" }\n```',
actions: ['Write'],
usage: FAKE_USAGE,
};
const RESUME_TURN = { text: 'Applied your answer and finished building the orders app.', actions: ['Write', 'Bash'], usage: FAKE_USAGE };
/** Scripted turns for the demo, optionally routed through a turn-boundary gate. */
export function demoTurns(awaitMode) {
const askTurn = awaitMode === 'choices' ? AWAIT_CHOICES_TURN
: awaitMode === 'multiselect' ? AWAIT_MULTISELECT_TURN
: awaitMode === 'confirmation' ? AWAIT_CONFIRMATION_TURN
: undefined;
if (!askTurn)
return TURNS;
// The build asks (askTurn), the gate resolves, the framework re-prompts (RESUME_TURN).
return [askTurn, RESUME_TURN];
}
/** Build the scripted {@link FakeDriver} for the demo. */
export function fakeDriver() {
return new FakeDriver({ turns: demoTurns(process.env.FRAMEWORK_FAKE_AWAIT), sessionId: 'fake-orders-app' });
}
//# sourceMappingURL=fake-script.js.map