@bastani/atomic 0.9.11-alpha.3 → 0.9.11-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +7 -0
- package/dist/builtin/subagents/README.md +10 -1
- package/dist/builtin/subagents/agents/debugger.md +12 -10
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +6 -6
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +4 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +29 -0
- package/dist/builtin/workflows/README.md +3 -3
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +1 -1
- package/dist/builtin/workflows/builtin/goal-models.ts +33 -29
- package/dist/builtin/workflows/builtin/goal-orchestrator-prompts.ts +133 -0
- package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -58
- package/dist/builtin/workflows/builtin/goal-reducer.ts +1 -1
- package/dist/builtin/workflows/builtin/goal-runner.ts +40 -52
- package/dist/builtin/workflows/builtin/goal.ts +10 -10
- package/dist/builtin/workflows/builtin/ralph-forked-prompts.ts +1 -1
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +13 -8
- package/dist/builtin/workflows/builtin/ralph-runner.ts +2 -0
- package/dist/builtin/workflows/builtin/ralph.ts +4 -4
- package/dist/builtin/workflows/builtin/shared-prompts.ts +37 -7
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring/workflow.ts +1 -0
- package/dist/builtin/workflows/src/durable/dbos-lifecycle.ts +27 -1
- package/dist/builtin/workflows/src/durable/factory.ts +29 -3
- package/dist/builtin/workflows/src/durable/index.ts +2 -0
- package/dist/builtin/workflows/src/engine/run-durable-admission.ts +50 -0
- package/dist/builtin/workflows/src/engine/run.ts +12 -17
- package/dist/builtin/workflows/src/extension/extension-factory.ts +16 -1
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +16 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +71826 -0
- package/dist/builtin/workflows/src/extension/runtime.ts +5 -3
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +4 -1
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +14 -5
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +1 -0
- package/dist/builtin/workflows/src/shared/types.ts +7 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +1 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +6 -8
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +2 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +4 -0
- package/dist/cli/args.d.ts +8 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +16 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/core/atomic-guide-command.js +3 -3
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +11 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +5 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +12 -6
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive-engine/engine-monitor.d.ts +8 -1
- package/dist/modes/interactive-engine/engine-monitor.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-monitor.js +13 -15
- package/dist/modes/interactive-engine/engine-monitor.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +3 -0
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts +3 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +7 -2
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +66 -43
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/rpc-entry.js +6 -2
- package/dist/rpc-entry.js.map +1 -1
- package/dist/utils/compile-cache.d.ts +8 -0
- package/dist/utils/compile-cache.d.ts.map +1 -0
- package/dist/utils/compile-cache.js +31 -0
- package/dist/utils/compile-cache.js.map +1 -0
- package/docs/quickstart.md +3 -3
- package/docs/subagents.md +10 -2
- package/docs/tui.md +2 -0
- package/docs/usage.md +16 -0
- package/docs/workflows.md +96 -45
- package/npm-shrinkwrap.json +23 -23
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atomic-guide-command.js","sourceRoot":"","sources":["../../src/core/atomic-guide-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAClD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,kCAAkC,CAAC;AAErC,MAAM,QAAQ,GAAG;;;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M,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAW;IAC5C,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;SAC5C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnB,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,sSAAsS,CAAC;IAChT,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,IAAI,aAAa,CAAC;IACxE,OAAO,mBAAmB,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,YAAY,yLAAyL,CAAC;AAC9Q,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAAqB,EACrB,GAAW;IAEX,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,sBAAsB,EAAE,CAAC;IACrD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAA6B;IAE7B,OAAO,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,MAAM,CAAC;AAC1D,CAAC","sourcesContent":["import * as path from \"node:path\";\nimport type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { getChangelogPath, parseChangelog } from \"../utils/changelog.ts\";\n\nexport const ATOMIC_GUIDE_COMMAND_NAME = \"atomic\";\nexport const ATOMIC_GUIDE_COMMAND_DESCRIPTION =\n \"Atomic onboarding and help guide\";\n\nconst OVERVIEW = `# Atomic overview\n\nAtomic turns non-trivial work into executable, inspectable workflows. Default to a workflow for implementation, build, debugging, bug fixes, migrations, features, scoped multi-file changes, and validated docs/code work, or whenever a request has dependencies, handoffs, uncertainty, review gates, measurable done criteria, or evidence requirements. Use direct chat for tiny deterministic low-risk answers or edits. Loop-shaped prompts such as \\`do X until Y\\`, \\`review/fix until passing\\`, or \\`run checks and fix until green\\` are especially strong workflow signals. Workflow-first is not builtin-only or monolithic: use named workflows, direct modes, author a custom TypeScript \\`workflow({...})\\` inline, or import reusable project/package and builtin definitions from \\`@bastani/workflows/builtin\\` and nest them with \\`ctx.workflow(...)\\`. Nested children may compose further children within \\`maxDepth\\`, enabling powerful research → implementation → verification → approval graphs from reusable parts. Start Atomic in a project with \\`atomic\\`, then talk to it normally. Use \\`@file\\` to attach files, \\`!command\\` to run shell output through the model, and \\`!!command\\` to run shell output without adding it to context.\n\n## Core session commands\n\n| Command | Use |\n|---|---|\n| \\`/login\\` | configure auth |\n| \\`/model\\` | switch model |\n| \\`/settings\\` | thinking level, theme, message delivery, transport |\n| \\`/new\\`, \\`/resume\\` | start or resume sessions |\n| \\`/tree\\`, \\`/fork\\`, \\`/clone\\` | branch or navigate session history |\n| \\`/compact\\` | delete safe older context verbatim |\n| \\`/hotkeys\\`, \\`/changelog\\` | local help and release notes |\n\n## Examples of using Atomic\n\n| Goal | How to use |\n|---|---|\n| On-call / broken behavior | Use a focused workflow to reproduce, diagnose, repair, and validate; direct debugger/subagent calls remain useful as stages or for tiny deterministic diagnosis |\n| Research → spec → implementation | Chain \\`/skill:research-codebase\\` → \\`/skill:create-spec\\` → a named or custom implementation workflow with explicit validation and review |\n| Testing / regression hardening | Use a workflow for test/fix loops so retries, evidence, and the passing stop condition are tracked |\n| Large repo discovery | Run \\`/parallel codebase-locator \"map the area\" -> codebase-analyzer \"trace the current flow\" -> codebase-pattern-finder \"find patterns\" --bg\\`, or \\`/workflow deep-research-codebase\\` for whole-repo synthesis |\n| UI / product polish | Run \\`/skill:impeccable\\` for interface critique and refinement, or \\`/workflow open-claude-design\\` for generation + refinement loops |\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | autonomous work that benefits from a durable goal ledger, bounded worker turns, named validation, and reviewer-gated completion; add \\`create_pr=true\\` only for final PR handoff after approval | \\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior\"\\` |\n| \\`ralph\\` | autonomous work that benefits from a durable research-first pipeline, delegated implementation, and iterative review | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | UI and design-system work that benefits from generation and refinement loops | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow list\\` to see what is available and \\`/workflow inputs <name>\\` to inspect inputs in your environment.\n\n## Top skills\n\n| Skill | When to use | How to run |\n|---|---|---|\n| \\`research-codebase\\` | write a grounded research artifact for one subsystem or question | \\`/skill:research-codebase how the rate limiter works in src/middleware/\\` |\n| \\`create-spec\\` | turn research into an implementation-ready plan | \\`/skill:create-spec from research/docs/<date>-<topic>.md\\` |\n| \\`tdd\\` | do test-first feature or bug work | \\`/skill:tdd\\` |\n| \\`prompt-engineer\\` | tighten a vague prompt before a long run | \\`/skill:prompt-engineer Draft a sharper implementation prompt for ...\\` |\n| \\`subagent\\` | learn delegation patterns and exact \\`/run\\`, \\`/parallel\\`, and \\`/chain\\` usage | \\`/skill:subagent\\` |\n| \\`impeccable\\` | critique or refine frontend and product UI | \\`/skill:impeccable\\` |\n\n## Subagents\n\nSubagents are focused child Atomic sessions you can point at one job inside the repo.\n\n| Built-in subagent | Use |\n|---|---|\n| \\`codebase-locator\\` | find relevant files, tests, entrypoints, and configs |\n| \\`codebase-analyzer\\` | explain current behavior with file:line refs |\n| \\`codebase-pattern-finder\\` | find existing code to model after |\n| \\`debugger\\` | reproduce, diagnose, and fix broken behavior |\n\nHow the direct commands map to repo work:\n- \\`/run\\` = one specialist on one job, for example \\`/run codebase-locator \"Map the webhook retry flow\"\\`\n- \\`/parallel\\` = several independent specialists at once, for example \\`/parallel codebase-locator \"map retry files\" -> codebase-pattern-finder \"find existing retry/backoff patterns\" -> codebase-online-researcher \"research current retry guidance\" --bg\\`\n- \\`/chain\\` = ordered handoffs, for example \\`/chain codebase-locator \"find the auth files\" -> codebase-analyzer \"trace the auth flow\" -> debugger \"patch the failing auth edge case\"\\`\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see the pieces used on a code task\n\\`/atomic workflows\\` — learn when to use workflows`;\n\nconst EXAMPLE = `# Practical example\n\nThis example shows a spec-driven development process whose clearly delegated autonomous implementation benefits from durable workflow execution. For interactive or conversation-led work, stay inline or use bounded subagents while the parent remains in control. Type the examples below into the Atomic TUI chat after starting \\`atomic\\` in your project.\n\n## 1. Research what exists\n\nUse \\`/skill:research-codebase\\` for a scoped area, subsystem, or directory:\n\n\\`/skill:research-codebase how the rate limiter works in src/middleware/\\`\n\nUse \\`deep-research-codebase\\` when the answer spans the whole repo or a cross-cutting implementation path:\n\n\\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\`\n\nIf the research prompt is vague, tighten it first with \\`/skill:prompt-engineer\\`:\n\n\\`/skill:prompt-engineer Draft a sharper repo-research prompt for understanding payment retries end to end, including retries, queues, and failure handling.\\`\n\n## 2. Create a spec when requirements are fuzzy\n\nSkip this if the implementation request is already precise.\n\n\\`/skill:create-spec from research/docs/<date>-<topic>.md\\`\n\n## 3. Implement with review built in\n\nDefault to a workflow for non-trivial implementation and review. Use direct chat only for tiny deterministic low-risk edits; use focused subagents inside workflow stages or for bounded specialist passes. Choose an installed workflow when it fits, or author a custom TypeScript workflow inline from the starter patterns when the task needs a richer graph.\n\nFor work that fits a durable goal ledger, bounded worker turns, and reviewer-gated completion, use \\`goal\\`:\n\n\\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and finish when the documented behavior is validated\"\\`\n\nLoop or stop-condition phrasing is a key workflow signal. When the user delegates a loop such as \\`do X until Y\\`, \\`repeat until\\`, \\`iterate until\\`, \\`review/fix until passing\\`, \\`run checks and fix until green\\`, or \\`keep going until done\\`, make the stop condition explicit in the Goal objective:\n\n\\`/workflow goal objective=\"Fix the flaky checkout test, adjust the smallest necessary code, and finish when the focused test passes three times\"\\`\n\nWhen a clearly delegated autonomous job benefits from a durable research-first pipeline with orchestration and iterative review, use \\`ralph\\`:\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\"\\`\n\nAdd \\`create_pr=true\\` only when you want the final pull-request stage and report after the review gate approves.\n\n## 4. Decide and land\n\nIf you used \\`goal\\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \\`complete\\`, \\`blocked\\`, or \\`needs_human\\` — plus the remaining-work report to decide whether to ship, unblock, or clarify. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you used \\`ralph\\`, the workflow transformed the prompt into a research question, researched the codebase, delegated implementation through sub-agents, reviewed, and iterated. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you implemented directly instead of using a workflow, you can still run:\n\n\\`/parallel-review current diff\\`\n\nAtomic will synthesize reviewer feedback and ask before applying fixes.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic workflows\\` — learn when to use workflows\n\\`/atomic overview\\` — quick refresh`;\n\nconst WORKFLOWS = `# Workflows primer\n\nA workflow is a TypeScript-defined pipeline exported from \\`workflow({...})\\`. It can run tasks, chains, parallel fan-out, human-in-the-loop prompts, background status, and model fallback chains.\n\nDefault to workflows for non-trivial work and requests with inherent structure plus a verifiable objective. Implementation, debugging, migrations, multi-file changes, validation, review, evidence requirements, and explicit stop conditions are workflow-shaped; use direct chat only for tiny deterministic low-risk answers or edits.\n\nWorkflow-first is not builtin-only or monolithic. Atomic can author custom TypeScript \\`workflow({...})\\` definitions inline, and workflows can import reusable project/package definitions or builtins from \\`@bastani/workflows/builtin\\`, then nest them with \\`ctx.workflow(...)\\`. Imported children can nest further children within \\`maxDepth\\`, so compose proven research, implementation, design, verification, and approval workflows instead of copying their stages. Use the documented starter patterns for classify-and-act routing, dynamic fan-out and synthesis, adversarial verification, candidate selection, and bounded convergence. Atomic writes the parent definition, reloads it, and runs the composed graph.\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | autonomous work that benefits from a durable goal ledger, bounded worker turns, named validation, and reviewer-gated completion; add \\`create_pr=true\\` only for final PR handoff after approval | \\`/workflow goal objective=\"Update the CLI docs, include one usage example, and verify the docs build passes\"\\` |\n| \\`ralph\\` | autonomous work that benefits from a durable research-first pipeline, delegated implementation, and iterative review | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | frontend and product design work | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow inputs <name>\\` to inspect the exact inputs in your environment.\n\nUse \\`/skill:research-codebase ...\\` when you want research on one subsystem, directory, or focused question. Use \\`/workflow deep-research-codebase ...\\` when the answer needs end-to-end tracing across many parts of the repo.\n\nIf you are drafting research, reviewer, or synthesis prompts for a workflow, use \\`/skill:prompt-engineer\\` first. It is a good fit when a stage prompt feels vague, overloaded, or underspecified.\n\n## What good workflow authoring looks like\n\nA good workflow request is explicit about stage purpose, model choice, handoff, and the decision each step must return.\n\nFor workflow-owned side effects such as filesystem writes, network mutations, and external API actions, prefer \\`ctx.tool(name, args, fn)\\`: completed calls are durably cached, so resume returns the saved result without rerunning \\`fn\\`. Keep pure computation as ordinary TypeScript, and do not wrap agent-stage internals or every function call indiscriminately.\n\nExample: ask Atomic in chat with something like this:\n\n~~~text\nCreate a reusable workflow called review-changes.\n\nIt should accept one required text input called target for a diff, PR summary, or review target.\n\nRun two independent review stages in parallel with fresh context:\n- one reviewer focused on correctness, regressions, and missing tests using openai-codex/gpt-5.5 at xhigh thinking\n- one reviewer focused on edge cases, maintainability, and hidden risks using anthropic/claude-opus-4-8 at xhigh thinking\n\nThen add an aggregate stage that consolidates both reviews, deduplicates overlap, keeps only evidence-backed issues, and separates blockers from optional suggestions using openai/gpt-5.5 at high thinking.\n\nFinally add an adjudicate stage using anthropic/claude-sonnet-4 at high thinking that decides what to fix now, what to defer, and what to reject. Return a short action list with rationale.\n\nThe workflow should return structured output with consolidated_review and decision fields.\n~~~\n\nWhy this is good:\n- it names the workflow and required input\n- it specifies which stages are parallel vs sequential\n- each stage has one job\n- it defines the handoff and final outputs\n- it calls out model choice and thinking level where that matters\n\n## Run and inspect\n\n\\`/workflow list\\`\n\n\\`/workflow inputs goal\\`\n\n\\`/workflow goal objective=\"Fix the settings form validation bug, add the focused test, and finish when invalid emails show the inline error without submitting\"\\`\n\n\\`/workflow inputs ralph\\`\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\`\n\n\\`/workflow status\\`\n\n\\`/workflow connect <run-id>\\`\n\n\\`/workflow interrupt <run-id>\\`\n\n\\`/workflow quit <run-id>\\`\n\n\\`/workflow resume <run-id>\\`\n\nWorkflows run as background tasks. Use F2 or \\`/workflow connect <run-id>\\` for the graph viewer. Human-in-the-loop prompts appear there, not as chat modals, and awaiting-input states do not wake the main chat agent. Completion and failure notices are steered back into the main chat; answers submitted in the workflow UI interrupt stale main-chat questions so the model does not ask again.\n\n## Author your own\n\nDescribe your workflow in plain chat — say what you want the workflow to accomplish, what inputs it should accept, what stages should run, and what final output or decision it should return. Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\`, ask clarifying questions when stage purpose, models, or handoffs are ambiguous, and run \\`/workflow reload\\` so you can launch it immediately.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see workflows in a normal task flow\n\\`/atomic overview\\` — quick refresh`;\n\nconst GUIDE_SECTIONS = [\n {\n name: \"overview\",\n aliases: [],\n label: \"overview\",\n description: \"30-second overview\",\n render: () => OVERVIEW,\n },\n {\n name: \"workflows\",\n aliases: [\"workflow\"],\n label: \"workflows\",\n description: \"Workflow primer\",\n render: () => WORKFLOWS,\n },\n {\n name: \"example\",\n aliases: [\"examples\"],\n label: \"example\",\n description: \"Practical first workflow\",\n render: () => EXAMPLE,\n },\n {\n name: \"whats-new\",\n aliases: [\"what's new\", \"whats new\", \"news\", \"updates\", \"changelog\"],\n label: \"what's new\",\n description: \"Recent release notes\",\n render: readLatestStableChangelog,\n },\n] as const satisfies readonly {\n readonly name: string;\n readonly aliases: readonly string[];\n readonly label: string;\n readonly description: string;\n readonly render: (cwd: string) => string;\n}[];\n\ntype AtomicGuideSection = (typeof GUIDE_SECTIONS)[number];\ntype AtomicGuideSectionName = AtomicGuideSection[\"name\"];\n\nexport type AtomicGuideHelpChoice = AtomicGuideSection[\"label\"];\n\nexport type AtomicGuideMode = \"help\" | AtomicGuideSectionName;\n\nexport const ATOMIC_GUIDE_HELP_CHOICES: readonly AtomicGuideHelpChoice[] =\n GUIDE_SECTIONS.map((section) => section.label);\n\nconst GUIDE_SECTIONS_BY_NAME = new Map<\n AtomicGuideSectionName,\n AtomicGuideSection\n>(GUIDE_SECTIONS.map((section) => [section.name, section]));\nconst GUIDE_SECTIONS_BY_LABEL = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.map((section) => [section.label, section]),\n);\nconst GUIDE_SECTIONS_BY_INPUT = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.flatMap((section) =>\n [section.name, section.label, ...section.aliases].map(\n (input) => [input, section] as const,\n ),\n ),\n);\n\nexport function isAtomicGuideHelpChoice(\n choice: string,\n): choice is AtomicGuideHelpChoice {\n return GUIDE_SECTIONS_BY_LABEL.has(choice);\n}\n\nconst ATOMIC_GUIDE_TRAILING_PUNCTUATION = \"?!.,;:\";\n\nfunction stripTrailingAtomicGuidePunctuation(value: string): string {\n let end = value.length;\n while (\n end > 0 &&\n ATOMIC_GUIDE_TRAILING_PUNCTUATION.includes(value.charAt(end - 1))\n ) {\n end--;\n }\n return value.slice(0, end);\n}\n\nfunction getGuideSectionForChoice(\n choice: string,\n): AtomicGuideSection | undefined {\n return GUIDE_SECTIONS_BY_LABEL.get(choice);\n}\n\nfunction getGuideSectionForMode(\n mode: AtomicGuideSectionName,\n): AtomicGuideSection {\n const section = GUIDE_SECTIONS_BY_NAME.get(mode);\n if (!section) throw new Error(`Unknown Atomic guide section: ${mode}`);\n return section;\n}\n\nfunction getAtomicGuideHelpMenu(): string {\n const sectionHelp = GUIDE_SECTIONS.map(\n (section) => `- \\`${section.label}\\` — run \\`/atomic ${section.label}\\``,\n ).join(\"\\n\");\n return `# Atomic\\n\\nSelect where to start:\\n\\n${sectionHelp}`;\n}\n\nexport function normalizeAtomicGuideMode(args: string): AtomicGuideMode {\n const normalized = stripTrailingAtomicGuidePunctuation(\n args.trim().toLowerCase(),\n );\n if (!normalized) return \"help\";\n\n return GUIDE_SECTIONS_BY_INPUT.get(normalized)?.name ?? \"help\";\n}\n\nexport function getAtomicGuideArgumentCompletions(\n prefix: string,\n): AutocompleteItem[] | null {\n const query = prefix.trim().toLowerCase();\n const items = GUIDE_SECTIONS.map((section) => ({\n value: section.label,\n label: section.label,\n description: section.description,\n }));\n const filtered = query\n ? items.filter(\n (item) => item.value.startsWith(query) || item.label.startsWith(query),\n )\n : items;\n return filtered.length > 0 ? filtered : null;\n}\n\nfunction readLatestStableChangelog(cwd: string): string {\n const changelogPath = getChangelogPath();\n const stableSections = parseChangelog(changelogPath)\n .filter((entry) => entry.prerelease === null)\n .slice(0, 3)\n .map((entry) => entry.content.trim())\n .filter(Boolean);\n\n if (stableSections.length === 0) {\n return `# What's new\\n\\nNo stable release sections were found. Try \\`/changelog\\` for the interactive changelog viewer.\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n }\n\n const relativePath = path.relative(cwd, changelogPath) || changelogPath;\n return `# What's new\\n\\n${stableSections.join(\"\\n\\n\")}\\n\\nSource: \\`${relativePath}\\`\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n}\n\nexport function getAtomicGuideMessage(\n mode: AtomicGuideMode,\n cwd: string,\n): string {\n if (mode === \"help\") return getAtomicGuideHelpMenu();\n return getGuideSectionForMode(mode).render(cwd);\n}\n\nexport function atomicGuideModeForChoice(\n choice: AtomicGuideHelpChoice,\n): AtomicGuideMode {\n return getGuideSectionForChoice(choice)?.name ?? \"help\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"atomic-guide-command.js","sourceRoot":"","sources":["../../src/core/atomic-guide-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEzE,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAAC;AAClD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,kCAAkC,CAAC;AAErC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAqEmC,CAAC;AAErD,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;SACjD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;SAC5C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnB,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,sSAAsS,CAAC;IAChT,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC,IAAI,aAAa,CAAC;IACxE,OAAO,mBAAmB,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,YAAY,yLAAyL,CAAC;AAC9Q,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAAqB,EACrB,GAAW;IAEX,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,sBAAsB,EAAE,CAAC;IACrD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAA6B;IAE7B,OAAO,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,MAAM,CAAC;AAC1D,CAAC","sourcesContent":["import * as path from \"node:path\";\nimport type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { getChangelogPath, parseChangelog } from \"../utils/changelog.ts\";\n\nexport const ATOMIC_GUIDE_COMMAND_NAME = \"atomic\";\nexport const ATOMIC_GUIDE_COMMAND_DESCRIPTION =\n \"Atomic onboarding and help guide\";\n\nconst OVERVIEW = `# Atomic overview\n\nAtomic turns non-trivial work into executable, inspectable workflows. Default to a workflow for implementation, build, debugging, bug fixes, migrations, features, scoped multi-file changes, and validated docs/code work, or whenever a request has dependencies, handoffs, uncertainty, review gates, measurable done criteria, or evidence requirements. Use direct chat for tiny deterministic low-risk answers or edits. Loop-shaped prompts such as \\`do X until Y\\`, \\`review/fix until passing\\`, or \\`run checks and fix until green\\` are especially strong workflow signals. Workflow-first is not builtin-only or monolithic: use named workflows, direct modes, author a custom TypeScript \\`workflow({...})\\` inline, or import reusable project/package and builtin definitions from \\`@bastani/workflows/builtin\\` and nest them with \\`ctx.workflow(...)\\`. Nested children may compose further children within \\`maxDepth\\`, enabling powerful research → implementation → verification → approval graphs from reusable parts. Start Atomic in a project with \\`atomic\\`, then talk to it normally. Use \\`@file\\` to attach files, \\`!command\\` to run shell output through the model, and \\`!!command\\` to run shell output without adding it to context.\n\n## Core session commands\n\n| Command | Use |\n|---|---|\n| \\`/login\\` | configure auth |\n| \\`/model\\` | switch model |\n| \\`/settings\\` | thinking level, theme, message delivery, transport |\n| \\`/new\\`, \\`/resume\\` | start or resume sessions |\n| \\`/tree\\`, \\`/fork\\`, \\`/clone\\` | branch or navigate session history |\n| \\`/compact\\` | delete safe older context verbatim |\n| \\`/hotkeys\\`, \\`/changelog\\` | local help and release notes |\n\n## Examples of using Atomic\n\n| Goal | How to use |\n|---|---|\n| On-call / broken behavior | Use a focused workflow to reproduce, diagnose, repair, and validate; direct debugger/subagent calls remain useful as stages or for tiny deterministic diagnosis |\n| Research → spec → implementation | Chain \\`/skill:research-codebase\\` → \\`/skill:create-spec\\` → a named or custom implementation workflow with explicit validation and review |\n| Testing / regression hardening | Use a workflow for test/fix loops so retries, evidence, and the passing stop condition are tracked |\n| Large repo discovery | Run \\`/parallel codebase-locator \"map the area\" -> codebase-analyzer \"trace the current flow\" -> codebase-pattern-finder \"find patterns\" --bg\\`, or \\`/workflow deep-research-codebase\\` for whole-repo synthesis |\n| UI / product polish | Run \\`/skill:impeccable\\` for interface critique and refinement, or \\`/workflow open-claude-design\\` for generation + refinement loops |\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | autonomous work that benefits from a durable goal ledger, bounded sub-agent orchestration turns, named validation, and reviewer-gated completion; add \\`create_pr=true\\` only for final PR handoff after approval | \\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior\"\\` |\n| \\`ralph\\` | autonomous work that benefits from a durable research-first pipeline, delegated implementation, and iterative review | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | UI and design-system work that benefits from generation and refinement loops | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow list\\` to see what is available and \\`/workflow inputs <name>\\` to inspect inputs in your environment.\n\n## Top skills\n\n| Skill | When to use | How to run |\n|---|---|---|\n| \\`research-codebase\\` | write a grounded research artifact for one subsystem or question | \\`/skill:research-codebase how the rate limiter works in src/middleware/\\` |\n| \\`create-spec\\` | turn research into an implementation-ready plan | \\`/skill:create-spec from research/docs/<date>-<topic>.md\\` |\n| \\`tdd\\` | do test-first feature or bug work | \\`/skill:tdd\\` |\n| \\`prompt-engineer\\` | tighten a vague prompt before a long run | \\`/skill:prompt-engineer Draft a sharper implementation prompt for ...\\` |\n| \\`subagent\\` | learn delegation patterns and exact \\`/run\\`, \\`/parallel\\`, and \\`/chain\\` usage | \\`/skill:subagent\\` |\n| \\`impeccable\\` | critique or refine frontend and product UI | \\`/skill:impeccable\\` |\n\n## Subagents\n\nSubagents are focused child Atomic sessions you can point at one job inside the repo.\n\n| Built-in subagent | Use |\n|---|---|\n| \\`codebase-locator\\` | find relevant files, tests, entrypoints, and configs |\n| \\`codebase-analyzer\\` | explain current behavior with file:line refs |\n| \\`codebase-pattern-finder\\` | find existing code to model after |\n| \\`debugger\\` | reproduce, diagnose, and fix broken behavior |\n\nHow the direct commands map to repo work:\n- \\`/run\\` = one specialist on one job, for example \\`/run codebase-locator \"Map the webhook retry flow\"\\`\n- \\`/parallel\\` = several independent specialists at once, for example \\`/parallel codebase-locator \"map retry files\" -> codebase-pattern-finder \"find existing retry/backoff patterns\" -> codebase-online-researcher \"research current retry guidance\" --bg\\`\n- \\`/chain\\` = ordered handoffs, for example \\`/chain codebase-locator \"find the auth files\" -> codebase-analyzer \"trace the auth flow\" -> debugger \"patch the failing auth edge case\"\\`\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see the pieces used on a code task\n\\`/atomic workflows\\` — learn when to use workflows`;\n\nconst EXAMPLE = `# Practical example\n\nThis example shows a spec-driven development process whose clearly delegated autonomous implementation benefits from durable workflow execution. For interactive or conversation-led work, stay inline or use bounded subagents while the parent remains in control. Type the examples below into the Atomic TUI chat after starting \\`atomic\\` in your project.\n\n## 1. Research what exists\n\nUse \\`/skill:research-codebase\\` for a scoped area, subsystem, or directory:\n\n\\`/skill:research-codebase how the rate limiter works in src/middleware/\\`\n\nUse \\`deep-research-codebase\\` when the answer spans the whole repo or a cross-cutting implementation path:\n\n\\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\`\n\nIf the research prompt is vague, tighten it first with \\`/skill:prompt-engineer\\`:\n\n\\`/skill:prompt-engineer Draft a sharper repo-research prompt for understanding payment retries end to end, including retries, queues, and failure handling.\\`\n\n## 2. Create a spec when requirements are fuzzy\n\nSkip this if the implementation request is already precise.\n\n\\`/skill:create-spec from research/docs/<date>-<topic>.md\\`\n\n## 3. Implement with review built in\n\nDefault to a workflow for non-trivial implementation and review. Use direct chat only for tiny deterministic low-risk edits; use focused subagents inside workflow stages or for bounded specialist passes. Choose an installed workflow when it fits, or author a custom TypeScript workflow inline from the starter patterns when the task needs a richer graph.\n\nFor work that fits a durable goal ledger, bounded sub-agent orchestration turns, and reviewer-gated completion, use \\`goal\\`:\n\n\\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and finish when the documented behavior is validated\"\\`\n\nLoop or stop-condition phrasing is a key workflow signal. When the user delegates a loop such as \\`do X until Y\\`, \\`repeat until\\`, \\`iterate until\\`, \\`review/fix until passing\\`, \\`run checks and fix until green\\`, or \\`keep going until done\\`, make the stop condition explicit in the Goal objective:\n\n\\`/workflow goal objective=\"Fix the flaky checkout test, adjust the smallest necessary code, and finish when the focused test passes three times\"\\`\n\nWhen a clearly delegated autonomous job benefits from a durable research-first pipeline with orchestration and iterative review, use \\`ralph\\`:\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\"\\`\n\nAdd \\`create_pr=true\\` only when you want the final pull-request stage and report after the review gate approves.\n\n## 4. Decide and land\n\nIf you used \\`goal\\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \\`complete\\`, \\`blocked\\`, or \\`needs_human\\` — plus the remaining-work report to decide whether to ship, unblock, or clarify. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you used \\`ralph\\`, the workflow transformed the prompt into a research question, researched the codebase, delegated implementation through sub-agents, reviewed, and iterated. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you implemented directly instead of using a workflow, you can still run:\n\n\\`/parallel-review current diff\\`\n\nAtomic will synthesize reviewer feedback and ask before applying fixes.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic workflows\\` — learn when to use workflows\n\\`/atomic overview\\` — quick refresh`;\n\nconst WORKFLOWS = `# Workflows primer\n\nA workflow is a TypeScript-defined pipeline exported from \\`workflow({...})\\`. It can run tasks, chains, parallel fan-out, human-in-the-loop prompts, background status, and model fallback chains.\n\nDefault to workflows for non-trivial work and requests with inherent structure plus a verifiable objective. Implementation, debugging, migrations, multi-file changes, validation, review, evidence requirements, and explicit stop conditions are workflow-shaped; use direct chat only for tiny deterministic low-risk answers or edits.\n\nWorkflow-first is not builtin-only or monolithic. Atomic can author custom TypeScript \\`workflow({...})\\` definitions inline, and workflows can import reusable project/package definitions or builtins from \\`@bastani/workflows/builtin\\`, then nest them with \\`ctx.workflow(...)\\`. Imported children can nest further children within \\`maxDepth\\`, so compose proven research, implementation, design, verification, and approval workflows instead of copying their stages. Use the documented starter patterns for classify-and-act routing, dynamic fan-out and synthesis, adversarial verification, candidate selection, and bounded convergence. Atomic writes the parent definition, reloads it, and runs the composed graph.\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | autonomous work that benefits from a durable goal ledger, bounded sub-agent orchestration turns, named validation, and reviewer-gated completion; add \\`create_pr=true\\` only for final PR handoff after approval | \\`/workflow goal objective=\"Update the CLI docs, include one usage example, and verify the docs build passes\"\\` |\n| \\`ralph\\` | autonomous work that benefits from a durable research-first pipeline, delegated implementation, and iterative review | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | frontend and product design work | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow inputs <name>\\` to inspect the exact inputs in your environment.\n\nUse \\`/skill:research-codebase ...\\` when you want research on one subsystem, directory, or focused question. Use \\`/workflow deep-research-codebase ...\\` when the answer needs end-to-end tracing across many parts of the repo.\n\nIf you are drafting research, reviewer, or synthesis prompts for a workflow, use \\`/skill:prompt-engineer\\` first. It is a good fit when a stage prompt feels vague, overloaded, or underspecified.\n\n## What good workflow authoring looks like\n\nA good workflow request is explicit about stage purpose, model choice, handoff, and the decision each step must return.\n\nFor workflow-owned side effects such as filesystem writes, network mutations, and external API actions, prefer \\`ctx.tool(name, args, fn)\\`: completed calls are durably cached, so resume returns the saved result without rerunning \\`fn\\`. Keep pure computation as ordinary TypeScript, and do not wrap agent-stage internals or every function call indiscriminately.\n\nExample: ask Atomic in chat with something like this:\n\n~~~text\nCreate a reusable workflow called review-changes.\n\nIt should accept one required text input called target for a diff, PR summary, or review target.\n\nRun two independent review stages in parallel with fresh context:\n- one reviewer focused on correctness, regressions, and missing tests using openai-codex/gpt-5.5 at xhigh thinking\n- one reviewer focused on edge cases, maintainability, and hidden risks using anthropic/claude-opus-4-8 at xhigh thinking\n\nThen add an aggregate stage that consolidates both reviews, deduplicates overlap, keeps only evidence-backed issues, and separates blockers from optional suggestions using openai/gpt-5.5 at high thinking.\n\nFinally add an adjudicate stage using anthropic/claude-sonnet-4 at high thinking that decides what to fix now, what to defer, and what to reject. Return a short action list with rationale.\n\nThe workflow should return structured output with consolidated_review and decision fields.\n~~~\n\nWhy this is good:\n- it names the workflow and required input\n- it specifies which stages are parallel vs sequential\n- each stage has one job\n- it defines the handoff and final outputs\n- it calls out model choice and thinking level where that matters\n\n## Run and inspect\n\n\\`/workflow list\\`\n\n\\`/workflow inputs goal\\`\n\n\\`/workflow goal objective=\"Fix the settings form validation bug, add the focused test, and finish when invalid emails show the inline error without submitting\"\\`\n\n\\`/workflow inputs ralph\\`\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\`\n\n\\`/workflow status\\`\n\n\\`/workflow connect <run-id>\\`\n\n\\`/workflow interrupt <run-id>\\`\n\n\\`/workflow quit <run-id>\\`\n\n\\`/workflow resume <run-id>\\`\n\nWorkflows run as background tasks. Use F2 or \\`/workflow connect <run-id>\\` for the graph viewer. Human-in-the-loop prompts appear there, not as chat modals, and awaiting-input states do not wake the main chat agent. Completion and failure notices are steered back into the main chat; answers submitted in the workflow UI interrupt stale main-chat questions so the model does not ask again.\n\n## Author your own\n\nDescribe your workflow in plain chat — say what you want the workflow to accomplish, what inputs it should accept, what stages should run, and what final output or decision it should return. Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\`, ask clarifying questions when stage purpose, models, or handoffs are ambiguous, and run \\`/workflow reload\\` so you can launch it immediately.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see workflows in a normal task flow\n\\`/atomic overview\\` — quick refresh`;\n\nconst GUIDE_SECTIONS = [\n {\n name: \"overview\",\n aliases: [],\n label: \"overview\",\n description: \"30-second overview\",\n render: () => OVERVIEW,\n },\n {\n name: \"workflows\",\n aliases: [\"workflow\"],\n label: \"workflows\",\n description: \"Workflow primer\",\n render: () => WORKFLOWS,\n },\n {\n name: \"example\",\n aliases: [\"examples\"],\n label: \"example\",\n description: \"Practical first workflow\",\n render: () => EXAMPLE,\n },\n {\n name: \"whats-new\",\n aliases: [\"what's new\", \"whats new\", \"news\", \"updates\", \"changelog\"],\n label: \"what's new\",\n description: \"Recent release notes\",\n render: readLatestStableChangelog,\n },\n] as const satisfies readonly {\n readonly name: string;\n readonly aliases: readonly string[];\n readonly label: string;\n readonly description: string;\n readonly render: (cwd: string) => string;\n}[];\n\ntype AtomicGuideSection = (typeof GUIDE_SECTIONS)[number];\ntype AtomicGuideSectionName = AtomicGuideSection[\"name\"];\n\nexport type AtomicGuideHelpChoice = AtomicGuideSection[\"label\"];\n\nexport type AtomicGuideMode = \"help\" | AtomicGuideSectionName;\n\nexport const ATOMIC_GUIDE_HELP_CHOICES: readonly AtomicGuideHelpChoice[] =\n GUIDE_SECTIONS.map((section) => section.label);\n\nconst GUIDE_SECTIONS_BY_NAME = new Map<\n AtomicGuideSectionName,\n AtomicGuideSection\n>(GUIDE_SECTIONS.map((section) => [section.name, section]));\nconst GUIDE_SECTIONS_BY_LABEL = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.map((section) => [section.label, section]),\n);\nconst GUIDE_SECTIONS_BY_INPUT = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.flatMap((section) =>\n [section.name, section.label, ...section.aliases].map(\n (input) => [input, section] as const,\n ),\n ),\n);\n\nexport function isAtomicGuideHelpChoice(\n choice: string,\n): choice is AtomicGuideHelpChoice {\n return GUIDE_SECTIONS_BY_LABEL.has(choice);\n}\n\nconst ATOMIC_GUIDE_TRAILING_PUNCTUATION = \"?!.,;:\";\n\nfunction stripTrailingAtomicGuidePunctuation(value: string): string {\n let end = value.length;\n while (\n end > 0 &&\n ATOMIC_GUIDE_TRAILING_PUNCTUATION.includes(value.charAt(end - 1))\n ) {\n end--;\n }\n return value.slice(0, end);\n}\n\nfunction getGuideSectionForChoice(\n choice: string,\n): AtomicGuideSection | undefined {\n return GUIDE_SECTIONS_BY_LABEL.get(choice);\n}\n\nfunction getGuideSectionForMode(\n mode: AtomicGuideSectionName,\n): AtomicGuideSection {\n const section = GUIDE_SECTIONS_BY_NAME.get(mode);\n if (!section) throw new Error(`Unknown Atomic guide section: ${mode}`);\n return section;\n}\n\nfunction getAtomicGuideHelpMenu(): string {\n const sectionHelp = GUIDE_SECTIONS.map(\n (section) => `- \\`${section.label}\\` — run \\`/atomic ${section.label}\\``,\n ).join(\"\\n\");\n return `# Atomic\\n\\nSelect where to start:\\n\\n${sectionHelp}`;\n}\n\nexport function normalizeAtomicGuideMode(args: string): AtomicGuideMode {\n const normalized = stripTrailingAtomicGuidePunctuation(\n args.trim().toLowerCase(),\n );\n if (!normalized) return \"help\";\n\n return GUIDE_SECTIONS_BY_INPUT.get(normalized)?.name ?? \"help\";\n}\n\nexport function getAtomicGuideArgumentCompletions(\n prefix: string,\n): AutocompleteItem[] | null {\n const query = prefix.trim().toLowerCase();\n const items = GUIDE_SECTIONS.map((section) => ({\n value: section.label,\n label: section.label,\n description: section.description,\n }));\n const filtered = query\n ? items.filter(\n (item) => item.value.startsWith(query) || item.label.startsWith(query),\n )\n : items;\n return filtered.length > 0 ? filtered : null;\n}\n\nfunction readLatestStableChangelog(cwd: string): string {\n const changelogPath = getChangelogPath();\n const stableSections = parseChangelog(changelogPath)\n .filter((entry) => entry.prerelease === null)\n .slice(0, 3)\n .map((entry) => entry.content.trim())\n .filter(Boolean);\n\n if (stableSections.length === 0) {\n return `# What's new\\n\\nNo stable release sections were found. Try \\`/changelog\\` for the interactive changelog viewer.\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n }\n\n const relativePath = path.relative(cwd, changelogPath) || changelogPath;\n return `# What's new\\n\\n${stableSections.join(\"\\n\\n\")}\\n\\nSource: \\`${relativePath}\\`\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n}\n\nexport function getAtomicGuideMessage(\n mode: AtomicGuideMode,\n cwd: string,\n): string {\n if (mode === \"help\") return getAtomicGuideHelpMenu();\n return getGuideSectionForMode(mode).render(cwd);\n}\n\nexport function atomicGuideModeForChoice(\n choice: AtomicGuideHelpChoice,\n): AtomicGuideMode {\n return getGuideSectionForChoice(choice)?.name ?? \"help\";\n}\n"]}
|
|
@@ -24,11 +24,11 @@ const BUNDLED_WORKFLOW_COMPLETION_METADATA = [
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: "goal",
|
|
27
|
-
description: "Goal Runner workflow with bounded
|
|
27
|
+
description: "Goal Runner workflow with bounded sub-agent orchestration turns, acceptance criteria, ledger artifacts, reviewers, and reducer-gated completion.",
|
|
28
28
|
inputs: {
|
|
29
29
|
objective: { description: "The objective or delta for this Goal Runner workflow run.", kind: "string" },
|
|
30
30
|
acceptance_criteria: { description: "Original immutable task contract this run must remain consistent with.", kind: "string" },
|
|
31
|
-
max_turns: { description: "Maximum
|
|
31
|
+
max_turns: { description: "Maximum orchestrator/review turns before Goal Runner stops as needs_human.", kind: "number" },
|
|
32
32
|
base_branch: { description: "Optional branch reviewers compare the current code delta against.", kind: "string" },
|
|
33
33
|
git_worktree_dir: { description: "Optional Git worktree path.", kind: "string" },
|
|
34
34
|
create_pr: { description: "Whether to run the final pull-request creation stage after approval.", kind: "boolean" },
|
|
@@ -1 +1 @@
|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AAC,MAAM,gCAAgC,GAAuC;IACnF;QACC,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,iKAAiK;QAC9K,sBAAsB,EAAE,qCAAqC;KAC7D;IACD,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,yEAAyE,EAAE;IACvG,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,sEAAsE,EAAE;IACtG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,iEAAiE,EAAE;IACrG,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,iFAAiF,EAAE;IACpH,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,2BAA2B,EAAE;IACtE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE;IACtD,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,yCAAyC,EAAE;IAC5E,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,iDAAiD,EAAE;IACnF,EAAE,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,+CAA+C,EAAE;IACxF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE;IACnE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,yBAAyB,EAAE;IAC7D,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,+BAA+B,EAAE;CAClE,CAAC","sourcesContent":["import type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { APP_NAME } from \"../config.ts\";\nimport {\n\tATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\tATOMIC_GUIDE_COMMAND_NAME,\n\tgetAtomicGuideArgumentCompletions,\n} from \"./atomic-guide-command.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n\targumentHint?: string;\n\tgetArgumentCompletions?: (\n\t\targumentPrefix: string,\n\t) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;\n}\n\ntype WorkflowInputCompletionMetadata = {\n\tdescription: string;\n\tkind?: \"boolean\" | \"number\" | \"string\";\n};\n\ntype WorkflowCompletionMetadata = {\n\tname: string;\n\tdescription: string;\n\tinputs: Record<string, WorkflowInputCompletionMetadata>;\n};\n\nconst WORKFLOW_ADMIN_COMPLETIONS: AutocompleteItem[] = [\n\t{ value: \"connect \", label: \"connect\", description: \"Attach to a run (picker if no id)\" },\n\t{ value: \"attach \", label: \"attach\", description: \"Open the in-place attach pane on a node\" },\n\t{ value: \"list \", label: \"list\", description: \"List registered workflows\" },\n\t{ value: \"status \", label: \"status\", description: \"List current-session active and retained terminal runs\" },\n\t{ value: \"interrupt \", label: \"interrupt\", description: \"Interrupt a run\" },\n\t{ value: \"quit \", label: \"quit\", description: \"Quit a run and keep it resumable\" },\n\t{ value: \"pause \", label: \"pause\", description: \"Pause a run or stage\" },\n\t{ value: \"resume \", label: \"resume\", description: \"Re-open overlay for a run\" },\n\t{ value: \"inputs \", label: \"inputs\", description: \"Show a workflow's input schema\" },\n\t{ value: \"reload \", label: \"reload\", description: \"Reload workflow resources\" },\n];\n\nconst BUNDLED_WORKFLOW_COMPLETION_METADATA: WorkflowCompletionMetadata[] = [\n\t{\n\t\tname: \"deep-research-codebase\",\n\t\tdescription: \"Heavy research for tasks requiring comprehensive, whole-repository context.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"Research question or investigation focus for the codebase.\", kind: \"string\" },\n\t\t\tmax_partitions: { description: \"Maximum number of codebase partitions to explore in parallel.\", kind: \"number\" },\n\t\t\tmax_concurrency: { description: \"Maximum number of workflow stages to run concurrently during deep research.\", kind: \"number\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"goal\",\n\t\tdescription: \"Goal Runner workflow with bounded LM turns, acceptance criteria, ledger artifacts, reviewers, and reducer-gated completion.\",\n\t\tinputs: {\n\t\t\tobjective: { description: \"The objective or delta for this Goal Runner workflow run.\", kind: \"string\" },\n\t\t\tacceptance_criteria: { description: \"Original immutable task contract this run must remain consistent with.\", kind: \"string\" },\n\t\t\tmax_turns: { description: \"Maximum worker/review turns before Goal Runner stops as needs_human.\", kind: \"number\" },\n\t\t\tbase_branch: { description: \"Optional branch reviewers compare the current code delta against.\", kind: \"string\" },\n\t\t\tgit_worktree_dir: { description: \"Optional Git worktree path.\", kind: \"string\" },\n\t\t\tcreate_pr: { description: \"Whether to run the final pull-request creation stage after approval.\", kind: \"boolean\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"open-claude-design\",\n\t\tdescription: \"AI-powered design workflow: discovery, reference research, HTML generation, refinement, and handoff.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"What to design, such as a dashboard, page, component, or prototype.\", kind: \"string\" },\n\t\t\tdiscover_references: { description: \"Discover current reference designs and feed them to generation.\", kind: \"boolean\" },\n\t\t\tmax_refinements: { description: \"Maximum generate/user-feedback loop iterations.\", kind: \"number\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"ralph\",\n\t\tdescription: \"Raw prompt → research → orchestrate → multi-model parallel review loop with bounded iteration.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"The task or goal to research, execute, and refine.\", kind: \"string\" },\n\t\t\tacceptance_criteria: { description: \"Original immutable task contract this run must remain consistent with.\", kind: \"string\" },\n\t\t\tmax_loops: { description: \"Maximum research/orchestrate/review iterations.\", kind: \"number\" },\n\t\t\tbase_branch: { description: \"Branch reviewers compare the current code delta against.\", kind: \"string\" },\n\t\t\tgit_worktree_dir: { description: \"Optional Git worktree path.\", kind: \"string\" },\n\t\t\tcreate_pr: { description: \"Whether to run the final pull-request creation stage.\", kind: \"boolean\" },\n\t\t},\n\t},\n];\n\nfunction completeWorkflowToken(argumentText: string, candidates: AutocompleteItem[]): AutocompleteItem[] | null {\n\tconst tokenStart = /\\s$/.test(argumentText)\n\t\t? argumentText.length\n\t\t: Math.max(argumentText.lastIndexOf(\" \"), argumentText.lastIndexOf(\"\\t\")) + 1;\n\tconst head = argumentText.slice(0, tokenStart);\n\tconst token = argumentText.slice(tokenStart);\n\tconst normalizedToken = token.trimEnd();\n\tconst filtered = candidates\n\t\t.filter((candidate) => candidate.value.startsWith(token) && candidate.value.trimEnd() !== normalizedToken)\n\t\t.map((candidate) => ({ ...candidate, value: `${head}${candidate.value}` }));\n\treturn filtered.length > 0 ? filtered : null;\n}\n\nfunction bundledWorkflowNameItems(): AutocompleteItem[] {\n\treturn BUNDLED_WORKFLOW_COMPLETION_METADATA.map((workflow) => ({\n\t\tvalue: `${workflow.name} `,\n\t\tlabel: workflow.name,\n\t\tdescription: `Run workflow: ${workflow.name}`,\n\t}));\n}\n\nexport function getBundledWorkflowArgumentCompletions(argumentPrefix: string): AutocompleteItem[] | null {\n\tconst parts = argumentPrefix.trim().split(/\\s+/).filter(Boolean);\n\tconst subcommand = parts[0] ?? \"\";\n\tconst workflowItems = bundledWorkflowNameItems();\n\tif (!argumentPrefix.includes(\" \")) {\n\t\treturn completeWorkflowToken(argumentPrefix, [...WORKFLOW_ADMIN_COMPLETIONS, ...workflowItems]);\n\t}\n\tif (subcommand === \"inputs\") return completeWorkflowToken(argumentPrefix, workflowItems);\n\tif (subcommand === \"interrupt\") {\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: \"--all \", label: \"--all\", description: \"Interrupt all in-flight runs\" },\n\t\t\t{ value: \"--yes \", label: \"--yes\", description: \"Skip confirmation\" },\n\t\t\t{ value: \"-y \", label: \"-y\", description: \"Skip confirmation\" },\n\t\t]);\n\t}\n\tif (subcommand === \"quit\") {\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: \"--all \", label: \"--all\", description: \"Quit and keep all in-flight runs resumable\" },\n\t\t]);\n\t}\n\tif (!subcommand) return completeWorkflowToken(argumentPrefix, [...WORKFLOW_ADMIN_COMPLETIONS, ...workflowItems]);\n\n\tconst workflow = BUNDLED_WORKFLOW_COMPLETION_METADATA.find((candidate) => candidate.name === subcommand);\n\tif (!workflow) return null;\n\tconst tokenStart = /\\s$/.test(argumentPrefix)\n\t\t? argumentPrefix.length\n\t\t: Math.max(argumentPrefix.lastIndexOf(\" \"), argumentPrefix.lastIndexOf(\"\\t\")) + 1;\n\tconst token = argumentPrefix.slice(tokenStart);\n\tconst equalsIndex = token.indexOf(\"=\");\n\tif (equalsIndex > 0) {\n\t\tconst inputName = token.slice(0, equalsIndex);\n\t\tconst input = workflow.inputs[inputName];\n\t\tif (input?.kind !== \"boolean\") return null;\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: `${inputName}=true `, label: \"true\", description: inputName },\n\t\t\t{ value: `${inputName}=false `, label: \"false\", description: inputName },\n\t\t]);\n\t}\n\n\treturn completeWorkflowToken(argumentPrefix, [\n\t\t{ value: \"--no-picker \", label: \"--no-picker\", description: \"Skip interactive input picker\" },\n\t\t{ value: \"--help \", label: \"--help\", description: \"Show this workflow's input schema\" },\n\t\t...Object.entries(workflow.inputs).map(([name, input]) => ({\n\t\t\tvalue: `${name}=`,\n\t\t\tlabel: name,\n\t\t\tdescription: input.description,\n\t\t})),\n\t]);\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for ctrl+p cycling\" },\n\t{ name: \"fast\", description: \"Configure Codex fast mode for chat and workflows\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{\n\t\tname: ATOMIC_GUIDE_COMMAND_NAME,\n\t\tdescription: ATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\t\tgetArgumentCompletions: getAtomicGuideArgumentCompletions,\n\t},\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"trust\", description: \"Save project trust decision for future sessions\" },\n\t{ name: \"login\", description: \"Configure provider authentication\", argumentHint: \"<provider>\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Compact older context with verbatim line ranges\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"exit\", description: `Exit ${APP_NAME}` },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n\nexport const BUNDLED_EXTENSION_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{\n\t\tname: \"workflow\",\n\t\tdescription: \"Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|interrupt|quit|pause|resume|inputs|reload] [args]\",\n\t\tgetArgumentCompletions: getBundledWorkflowArgumentCompletions,\n\t},\n\t{ name: \"run\", description: \"Run a subagent directly: /run agent[output=file] [task] [--bg] [--fork]\" },\n\t{ name: \"chain\", description: \"Run agents in sequence: /chain scout task -> planner [--bg] [--fork]\" },\n\t{ name: \"run-chain\", description: \"Run a saved chain: /run-chain chainName -- task [--bg] [--fork]\" },\n\t{ name: \"parallel\", description: \"Run agents in parallel: /parallel scout task1 -> reviewer task2 [--bg] [--fork]\" },\n\t{ name: \"subagents-doctor\", description: \"Show subagent diagnostics\" },\n\t{ name: \"mcp\", description: \"Show MCP server status\" },\n\t{ name: \"mcp-auth\", description: \"Authenticate with an MCP server (OAuth)\" },\n\t{ name: \"curator\", description: \"Toggle or configure the search curator workflow\" },\n\t{ name: \"google-account\", description: \"Show the active Google account for Gemini Web\" },\n\t{ name: \"search\", description: \"Browse stored web search results\" },\n\t{ name: \"websearch\", description: \"Open web search curator\" },\n\t{ name: \"intercom\", description: \"Open session intercom overlay\" },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACN,gCAAgC,EAChC,yBAAyB,EACzB,iCAAiC,GACjC,MAAM,2BAA2B,CAAC;AAgCnC,MAAM,0BAA0B,GAAuB;IACtD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,mCAAmC,EAAE;IACzF,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;IAC7F,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,2BAA2B,EAAE;IAC3E,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,wDAAwD,EAAE;IAC5G,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE;IAC3E,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kCAAkC,EAAE;IAClF,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE;IACxE,EAAE,KAAK,EAAE,SAAS,EAAE,K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esContent":["import type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { APP_NAME } from \"../config.ts\";\nimport {\n\tATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\tATOMIC_GUIDE_COMMAND_NAME,\n\tgetAtomicGuideArgumentCompletions,\n} from \"./atomic-guide-command.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\nexport type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tsourceInfo: SourceInfo;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n\targumentHint?: string;\n\tgetArgumentCompletions?: (\n\t\targumentPrefix: string,\n\t) => AutocompleteItem[] | null | Promise<AutocompleteItem[] | null>;\n}\n\ntype WorkflowInputCompletionMetadata = {\n\tdescription: string;\n\tkind?: \"boolean\" | \"number\" | \"string\";\n};\n\ntype WorkflowCompletionMetadata = {\n\tname: string;\n\tdescription: string;\n\tinputs: Record<string, WorkflowInputCompletionMetadata>;\n};\n\nconst WORKFLOW_ADMIN_COMPLETIONS: AutocompleteItem[] = [\n\t{ value: \"connect \", label: \"connect\", description: \"Attach to a run (picker if no id)\" },\n\t{ value: \"attach \", label: \"attach\", description: \"Open the in-place attach pane on a node\" },\n\t{ value: \"list \", label: \"list\", description: \"List registered workflows\" },\n\t{ value: \"status \", label: \"status\", description: \"List current-session active and retained terminal runs\" },\n\t{ value: \"interrupt \", label: \"interrupt\", description: \"Interrupt a run\" },\n\t{ value: \"quit \", label: \"quit\", description: \"Quit a run and keep it resumable\" },\n\t{ value: \"pause \", label: \"pause\", description: \"Pause a run or stage\" },\n\t{ value: \"resume \", label: \"resume\", description: \"Re-open overlay for a run\" },\n\t{ value: \"inputs \", label: \"inputs\", description: \"Show a workflow's input schema\" },\n\t{ value: \"reload \", label: \"reload\", description: \"Reload workflow resources\" },\n];\n\nconst BUNDLED_WORKFLOW_COMPLETION_METADATA: WorkflowCompletionMetadata[] = [\n\t{\n\t\tname: \"deep-research-codebase\",\n\t\tdescription: \"Heavy research for tasks requiring comprehensive, whole-repository context.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"Research question or investigation focus for the codebase.\", kind: \"string\" },\n\t\t\tmax_partitions: { description: \"Maximum number of codebase partitions to explore in parallel.\", kind: \"number\" },\n\t\t\tmax_concurrency: { description: \"Maximum number of workflow stages to run concurrently during deep research.\", kind: \"number\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"goal\",\n\t\tdescription: \"Goal Runner workflow with bounded sub-agent orchestration turns, acceptance criteria, ledger artifacts, reviewers, and reducer-gated completion.\",\n\t\tinputs: {\n\t\t\tobjective: { description: \"The objective or delta for this Goal Runner workflow run.\", kind: \"string\" },\n\t\t\tacceptance_criteria: { description: \"Original immutable task contract this run must remain consistent with.\", kind: \"string\" },\n\t\t\tmax_turns: { description: \"Maximum orchestrator/review turns before Goal Runner stops as needs_human.\", kind: \"number\" },\n\t\t\tbase_branch: { description: \"Optional branch reviewers compare the current code delta against.\", kind: \"string\" },\n\t\t\tgit_worktree_dir: { description: \"Optional Git worktree path.\", kind: \"string\" },\n\t\t\tcreate_pr: { description: \"Whether to run the final pull-request creation stage after approval.\", kind: \"boolean\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"open-claude-design\",\n\t\tdescription: \"AI-powered design workflow: discovery, reference research, HTML generation, refinement, and handoff.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"What to design, such as a dashboard, page, component, or prototype.\", kind: \"string\" },\n\t\t\tdiscover_references: { description: \"Discover current reference designs and feed them to generation.\", kind: \"boolean\" },\n\t\t\tmax_refinements: { description: \"Maximum generate/user-feedback loop iterations.\", kind: \"number\" },\n\t\t},\n\t},\n\t{\n\t\tname: \"ralph\",\n\t\tdescription: \"Raw prompt → research → orchestrate → multi-model parallel review loop with bounded iteration.\",\n\t\tinputs: {\n\t\t\tprompt: { description: \"The task or goal to research, execute, and refine.\", kind: \"string\" },\n\t\t\tacceptance_criteria: { description: \"Original immutable task contract this run must remain consistent with.\", kind: \"string\" },\n\t\t\tmax_loops: { description: \"Maximum research/orchestrate/review iterations.\", kind: \"number\" },\n\t\t\tbase_branch: { description: \"Branch reviewers compare the current code delta against.\", kind: \"string\" },\n\t\t\tgit_worktree_dir: { description: \"Optional Git worktree path.\", kind: \"string\" },\n\t\t\tcreate_pr: { description: \"Whether to run the final pull-request creation stage.\", kind: \"boolean\" },\n\t\t},\n\t},\n];\n\nfunction completeWorkflowToken(argumentText: string, candidates: AutocompleteItem[]): AutocompleteItem[] | null {\n\tconst tokenStart = /\\s$/.test(argumentText)\n\t\t? argumentText.length\n\t\t: Math.max(argumentText.lastIndexOf(\" \"), argumentText.lastIndexOf(\"\\t\")) + 1;\n\tconst head = argumentText.slice(0, tokenStart);\n\tconst token = argumentText.slice(tokenStart);\n\tconst normalizedToken = token.trimEnd();\n\tconst filtered = candidates\n\t\t.filter((candidate) => candidate.value.startsWith(token) && candidate.value.trimEnd() !== normalizedToken)\n\t\t.map((candidate) => ({ ...candidate, value: `${head}${candidate.value}` }));\n\treturn filtered.length > 0 ? filtered : null;\n}\n\nfunction bundledWorkflowNameItems(): AutocompleteItem[] {\n\treturn BUNDLED_WORKFLOW_COMPLETION_METADATA.map((workflow) => ({\n\t\tvalue: `${workflow.name} `,\n\t\tlabel: workflow.name,\n\t\tdescription: `Run workflow: ${workflow.name}`,\n\t}));\n}\n\nexport function getBundledWorkflowArgumentCompletions(argumentPrefix: string): AutocompleteItem[] | null {\n\tconst parts = argumentPrefix.trim().split(/\\s+/).filter(Boolean);\n\tconst subcommand = parts[0] ?? \"\";\n\tconst workflowItems = bundledWorkflowNameItems();\n\tif (!argumentPrefix.includes(\" \")) {\n\t\treturn completeWorkflowToken(argumentPrefix, [...WORKFLOW_ADMIN_COMPLETIONS, ...workflowItems]);\n\t}\n\tif (subcommand === \"inputs\") return completeWorkflowToken(argumentPrefix, workflowItems);\n\tif (subcommand === \"interrupt\") {\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: \"--all \", label: \"--all\", description: \"Interrupt all in-flight runs\" },\n\t\t\t{ value: \"--yes \", label: \"--yes\", description: \"Skip confirmation\" },\n\t\t\t{ value: \"-y \", label: \"-y\", description: \"Skip confirmation\" },\n\t\t]);\n\t}\n\tif (subcommand === \"quit\") {\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: \"--all \", label: \"--all\", description: \"Quit and keep all in-flight runs resumable\" },\n\t\t]);\n\t}\n\tif (!subcommand) return completeWorkflowToken(argumentPrefix, [...WORKFLOW_ADMIN_COMPLETIONS, ...workflowItems]);\n\n\tconst workflow = BUNDLED_WORKFLOW_COMPLETION_METADATA.find((candidate) => candidate.name === subcommand);\n\tif (!workflow) return null;\n\tconst tokenStart = /\\s$/.test(argumentPrefix)\n\t\t? argumentPrefix.length\n\t\t: Math.max(argumentPrefix.lastIndexOf(\" \"), argumentPrefix.lastIndexOf(\"\\t\")) + 1;\n\tconst token = argumentPrefix.slice(tokenStart);\n\tconst equalsIndex = token.indexOf(\"=\");\n\tif (equalsIndex > 0) {\n\t\tconst inputName = token.slice(0, equalsIndex);\n\t\tconst input = workflow.inputs[inputName];\n\t\tif (input?.kind !== \"boolean\") return null;\n\t\treturn completeWorkflowToken(argumentPrefix, [\n\t\t\t{ value: `${inputName}=true `, label: \"true\", description: inputName },\n\t\t\t{ value: `${inputName}=false `, label: \"false\", description: inputName },\n\t\t]);\n\t}\n\n\treturn completeWorkflowToken(argumentPrefix, [\n\t\t{ value: \"--no-picker \", label: \"--no-picker\", description: \"Skip interactive input picker\" },\n\t\t{ value: \"--help \", label: \"--help\", description: \"Show this workflow's input schema\" },\n\t\t...Object.entries(workflow.inputs).map(([name, input]) => ({\n\t\t\tvalue: `${name}=`,\n\t\t\tlabel: name,\n\t\t\tdescription: input.description,\n\t\t})),\n\t]);\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{ name: \"model\", description: \"Select model (opens selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for ctrl+p cycling\" },\n\t{ name: \"fast\", description: \"Configure Codex fast mode for chat and workflows\" },\n\t{ name: \"export\", description: \"Export session (HTML default, or specify path: .html/.jsonl)\" },\n\t{ name: \"import\", description: \"Import and resume a session from a JSONL file\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{\n\t\tname: ATOMIC_GUIDE_COMMAND_NAME,\n\t\tdescription: ATOMIC_GUIDE_COMMAND_DESCRIPTION,\n\t\tgetArgumentCompletions: getAtomicGuideArgumentCompletions,\n\t},\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous user message\" },\n\t{ name: \"clone\", description: \"Duplicate the current session at the current position\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"trust\", description: \"Save project trust decision for future sessions\" },\n\t{ name: \"login\", description: \"Configure provider authentication\", argumentHint: \"<provider>\" },\n\t{ name: \"logout\", description: \"Remove provider authentication\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"compact\", description: \"Compact older context with verbatim line ranges\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload keybindings, extensions, skills, prompts, and themes\" },\n\t{ name: \"exit\", description: `Exit ${APP_NAME}` },\n\t{ name: \"quit\", description: `Quit ${APP_NAME}` },\n];\n\nexport const BUNDLED_EXTENSION_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{\n\t\tname: \"workflow\",\n\t\tdescription: \"Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|interrupt|quit|pause|resume|inputs|reload] [args]\",\n\t\tgetArgumentCompletions: getBundledWorkflowArgumentCompletions,\n\t},\n\t{ name: \"run\", description: \"Run a subagent directly: /run agent[output=file] [task] [--bg] [--fork]\" },\n\t{ name: \"chain\", description: \"Run agents in sequence: /chain scout task -> planner [--bg] [--fork]\" },\n\t{ name: \"run-chain\", description: \"Run a saved chain: /run-chain chainName -- task [--bg] [--fork]\" },\n\t{ name: \"parallel\", description: \"Run agents in parallel: /parallel scout task1 -> reviewer task2 [--bg] [--fork]\" },\n\t{ name: \"subagents-doctor\", description: \"Show subagent diagnostics\" },\n\t{ name: \"mcp\", description: \"Show MCP server status\" },\n\t{ name: \"mcp-auth\", description: \"Authenticate with an MCP server (OAuth)\" },\n\t{ name: \"curator\", description: \"Toggle or configure the search curator workflow\" },\n\t{ name: \"google-account\", description: \"Show the active Google account for Gemini Web\" },\n\t{ name: \"search\", description: \"Browse stored web search results\" },\n\t{ name: \"websearch\", description: \"Open web search curator\" },\n\t{ name: \"intercom\", description: \"Open session intercom overlay\" },\n];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAsBhE,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4GAA4G;IAC5G,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,+DAA+D;IAC/D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gCAAgC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,yBAAyB;IACzB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;CAClB;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CA6K3E"}
|
|
@@ -13,6 +13,14 @@ const DEFAULT_PROMPT_TOOLS = [
|
|
|
13
13
|
"ask_user_question",
|
|
14
14
|
"todo",
|
|
15
15
|
];
|
|
16
|
+
const DEFAULT_COMMUNICATION_GUIDELINES = [
|
|
17
|
+
"Never use a familiar printed metaphor, simile, or figure of speech.",
|
|
18
|
+
"Never use a long word where a short one will do.",
|
|
19
|
+
"Cut every word that can be cut.",
|
|
20
|
+
"Use active rather than passive voice where possible.",
|
|
21
|
+
"Prefer everyday English to foreign phrases, scientific terms, and jargon.",
|
|
22
|
+
"Break any rule rather than say anything outright barbarous.",
|
|
23
|
+
];
|
|
16
24
|
/** Build the system prompt with tools, guidelines, and context */
|
|
17
25
|
export function buildSystemPrompt(options) {
|
|
18
26
|
const { customPrompt, selectedTools, excludedTools, toolSnippets, promptGuidelines, appendSystemPrompt, cwd, selectedModel, selectedThinkingLevel, contextFiles: providedContextFiles, skills: providedSkills, } = options;
|
|
@@ -100,6 +108,9 @@ export function buildSystemPrompt(options) {
|
|
|
100
108
|
}
|
|
101
109
|
}
|
|
102
110
|
// Always include these
|
|
111
|
+
for (const guideline of DEFAULT_COMMUNICATION_GUIDELINES) {
|
|
112
|
+
addGuideline(guideline);
|
|
113
|
+
}
|
|
103
114
|
addGuideline("Be concise in your responses");
|
|
104
115
|
addGuideline("Show file paths clearly when working with files");
|
|
105
116
|
const guidelines = guidelinesList.map((g) => `- ${g}`).join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAc,MAAM,aAAa,CAAC;AAEhE,MAAM,oBAAoB,GAAG;IAC3B,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,mBAAmB;IACnB,MAAM;CACE,CAAC;AAoCX,kEAAkE;AAClE,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,MAAM,EACJ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,GAAG,EACH,aAAa,EACb,qBAAqB,EACrB,YAAY,EAAE,oBAAoB,EAClC,MAAM,EAAE,cAAc,GACvB,GAAG,OAAO,CAAC;IACZ,MAAM,WAAW,GAAG,GAAG,CAAC;IACxB,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAElD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MA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AAC","sourcesContent":["/**\n * System prompt construction and project context loading\n */\n\nimport { getDocsPath, getExamplesPath, getReadmePath } from \"../config.ts\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.ts\";\n\nconst DEFAULT_PROMPT_TOOLS = [\n \"read\",\n \"bash\",\n \"edit\",\n \"write\",\n \"find\",\n \"search\",\n \"ask_user_question\",\n \"todo\",\n] as const;\n\nexport interface SystemPromptModel {\n /** Provider identifier for the selected model. */\n provider: string;\n /** Stable provider-specific model identifier. */\n id: string;\n /** Human-readable model name, when available. */\n name?: string;\n}\n\nexport interface BuildSystemPromptOptions {\n /** Custom system prompt (replaces default). */\n customPrompt?: string;\n /** Tools to include in prompt. Default: [read, bash, edit, write, find, search, ask_user_question, todo] */\n selectedTools?: string[];\n /** Tool names explicitly excluded by the caller and omitted from generated guidance. */\n excludedTools?: string[];\n /** Optional one-line tool snippets keyed by tool name. */\n toolSnippets?: Record<string, string>;\n /** Additional guideline bullets appended to the default system prompt guidelines. */\n promptGuidelines?: string[];\n /** Text to append to system prompt. */\n appendSystemPrompt?: string;\n /** Working directory. */\n cwd: string;\n /** Currently selected model, used for model-aware prompt metadata. */\n selectedModel?: SystemPromptModel;\n /** Current reasoning/thinking level for the selected model. */\n selectedThinkingLevel?: string;\n /** Pre-loaded context files. */\n contextFiles?: Array<{ path: string; content: string }>;\n /** Pre-loaded skills. */\n skills?: Skill[];\n}\n\n/** Build the system prompt with tools, guidelines, and context */\nexport function buildSystemPrompt(options: BuildSystemPromptOptions): string {\n const {\n customPrompt,\n selectedTools,\n excludedTools,\n toolSnippets,\n promptGuidelines,\n appendSystemPrompt,\n cwd,\n selectedModel,\n selectedThinkingLevel,\n contextFiles: providedContextFiles,\n skills: providedSkills,\n } = options;\n const resolvedCwd = cwd;\n const promptCwd = resolvedCwd.replace(/\\\\/g, \"/\");\n\n const now = new Date();\n const year = now.getFullYear();\n const month = String(now.getMonth() + 1).padStart(2, \"0\");\n const day = String(now.getDate()).padStart(2, \"0\");\n const date = `${year}-${month}-${day}`;\n\n const appendSection = appendSystemPrompt ? `\\n\\n${appendSystemPrompt}` : \"\";\n const modelName =\n selectedModel?.name?.trim() || selectedModel?.id || \"unknown\";\n const modelReasoningLevel = selectedThinkingLevel?.trim() || \"off\";\n\n const contextFiles = providedContextFiles ?? [];\n const skills = providedSkills ?? [];\n const explicitlyExcludedTools = new Set(excludedTools ?? []);\n const isPromptToolAvailable = (name: string): boolean =>\n (!selectedTools || selectedTools.includes(name)) &&\n !explicitlyExcludedTools.has(name);\n\n if (customPrompt) {\n let prompt = customPrompt;\n\n if (appendSection) {\n prompt += appendSection;\n }\n\n // Append project context files\n if (contextFiles.length > 0) {\n prompt += \"\\n\\n# Project Context\\n\\n\";\n prompt += \"Project-specific instructions and guidelines:\\n\\n\";\n for (const { path: filePath, content } of contextFiles) {\n prompt += `<context_file path=\\\"${filePath}\\\">\\n${content}\\n</context_file>\\n\\n`;\n }\n }\n\n // Append skills section (only if read tool is available)\n if (isPromptToolAvailable(\"read\") && skills.length > 0) {\n prompt += formatSkillsForPrompt(skills);\n }\n\n // Add model metadata, date, and working directory last\n prompt += `\\nModel name (used for commit attribution): ${modelName}`;\n prompt += `\\nModel reasoning level: ${modelReasoningLevel}`;\n prompt += `\\nCurrent date: ${date}`;\n prompt += `\\nCurrent working directory: ${promptCwd}`;\n\n return prompt;\n }\n\n // Get absolute paths to documentation and examples\n const readmePath = getReadmePath();\n const docsPath = getDocsPath();\n const examplesPath = getExamplesPath();\n\n // Build tools list based on selected tools.\n // A tool appears in Available tools only when the caller provides a one-line snippet.\n const tools = (selectedTools ?? DEFAULT_PROMPT_TOOLS).filter(\n (name) => !explicitlyExcludedTools.has(name),\n );\n const visibleTools = tools.filter((name) => !!toolSnippets?.[name]);\n const toolsList =\n visibleTools.length > 0\n ? visibleTools\n .map((name) => `- ${name}: ${toolSnippets![name]}`)\n .join(\"\\n\")\n : \"(none)\";\n\n // Build guidelines based on which tools are actually available\n const guidelinesList: string[] = [];\n const guidelinesSet = new Set<string>();\n const addGuideline = (guideline: string): void => {\n if (guidelinesSet.has(guideline)) {\n return;\n }\n guidelinesSet.add(guideline);\n guidelinesList.push(guideline);\n };\n\n const hasBash = tools.includes(\"bash\");\n const hasFind = tools.includes(\"find\");\n const hasLs = tools.includes(\"ls\");\n const hasRead = tools.includes(\"read\");\n const shouldIncludeAskUserFallbackGuidance =\n selectedTools !== undefined &&\n tools.length > 0 &&\n !tools.includes(\"ask_user_question\") &&\n !explicitlyExcludedTools.has(\"ask_user_question\");\n\n // File exploration guidelines\n if (hasBash && !hasFind && !hasLs) {\n addGuideline(\"Use bash for file operations like ls, rg, find\");\n }\n if (shouldIncludeAskUserFallbackGuidance) {\n addGuideline(\"Clarify ambiguous requirements using the ask_user_question tool if available.\");\n }\n\n for (const guideline of promptGuidelines ?? []) {\n const normalized = guideline.trim();\n if (normalized.length > 0) {\n addGuideline(normalized);\n }\n }\n\n // Always include these\n addGuideline(\"Be concise in your responses\");\n addGuideline(\"Show file paths clearly when working with files\");\n\n const guidelines = guidelinesList.map((g) => `- ${g}`).join(\"\\n\");\n\n let prompt = `You are an expert coding assistant operating named Atomic, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.\n\nAvailable tools:\n${toolsList}\n\nIn addition to the tools above, you may have access to other custom tools depending on the project.\n\nGuidelines:\n${guidelines}\n\nAtomic documentation (read only when the user asks about customizing Atomic itself, its SDK, creating workflows, packages, extensions, themes, skills, or TUI):\n- Main documentation: ${readmePath}\n- Additional docs: ${docsPath}\n- Examples: ${examplesPath} (extensions, custom tools, SDK)\n- Docs/examples references above must be resolved against these absolute roots; e.g. docs/foo.md means ${docsPath}/foo.md and examples/bar means ${examplesPath}/bar.\n- When asked about: atomic workflows (docs/workflows.md), extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), atomic packages (docs/packages.md)\n- When working on Atomic topics, read the docs and examples, and follow .md cross-references before implementing\n- Always read Atomic .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;\n\n if (appendSection) {\n prompt += appendSection;\n }\n\n // Append project context files\n if (contextFiles.length > 0) {\n prompt += \"\\n\\n# Project Context\\n\\n\";\n prompt += \"Project-specific instructions and guidelines:\\n\\n\";\n for (const { path: filePath, content } of contextFiles) {\n prompt += `<context_file path=\\\"${filePath}\\\">\\n${content}\\n</context_file>\\n\\n`;\n }\n }\n\n // Append skills section (only if read tool is available)\n if (hasRead && skills.length > 0) {\n prompt += formatSkillsForPrompt(skills);\n }\n\n // Add model metadata, date, and working directory last\n prompt += `\\nModel name (used for commit attribution): ${modelName}`;\n prompt += `\\nModel reasoning level: ${modelReasoningLevel}`;\n prompt += `\\nCurrent date: ${date}`;\n prompt += `\\nCurrent working directory: ${promptCwd}`;\n\n return prompt;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAc,MAAM,aAAa,CAAC;AAEhE,MAAM,oBAAoB,GAAG;IAC3B,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,mBAAmB;IACnB,MAAM;CACE,CAAC;AAEX,MAAM,gCAAgC,GAAG;IACvC,qEAAqE;IACrE,kDAAkD;IAClD,iCAAiC;IACjC,sDAAsD;IACtD,2EAA2E;IAC3E,6DAA6D;CACrD,CAAC;AAoCX,kEAAkE;AAClE,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,MAAM,EACJ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,GAAG,EACH,aAAa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;IACzD,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,uDAAuD;IACvD,MAAM,IAAI,+CAA+C,SAAS,EAAE,CAAC;IACrE,MAAM,IAAI,4BAA4B,mBAAmB,EAAE,CAAC;IAC5D,MAAM,IAAI,mBAAmB,IAAI,EAAE,CAAC;IACpC,MAAM,IAAI,gCAAgC,SAAS,EAAE,CAAC;IAEtD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * System prompt construction and project context loading\n */\n\nimport { getDocsPath, getExamplesPath, getReadmePath } from \"../config.ts\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.ts\";\n\nconst DEFAULT_PROMPT_TOOLS = [\n \"read\",\n \"bash\",\n \"edit\",\n \"write\",\n \"find\",\n \"search\",\n \"ask_user_question\",\n \"todo\",\n] as const;\n\nconst DEFAULT_COMMUNICATION_GUIDELINES = [\n \"Never use a familiar printed metaphor, simile, or figure of speech.\",\n \"Never use a long word where a short one will do.\",\n \"Cut every word that can be cut.\",\n \"Use active rather than passive voice where possible.\",\n \"Prefer everyday English to foreign phrases, scientific terms, and jargon.\",\n \"Break any rule rather than say anything outright barbarous.\",\n] as const;\n\nexport interface SystemPromptModel {\n /** Provider identifier for the selected model. */\n provider: string;\n /** Stable provider-specific model identifier. */\n id: string;\n /** Human-readable model name, when available. */\n name?: string;\n}\n\nexport interface BuildSystemPromptOptions {\n /** Custom system prompt (replaces default). */\n customPrompt?: string;\n /** Tools to include in prompt. Default: [read, bash, edit, write, find, search, ask_user_question, todo] */\n selectedTools?: string[];\n /** Tool names explicitly excluded by the caller and omitted from generated guidance. */\n excludedTools?: string[];\n /** Optional one-line tool snippets keyed by tool name. */\n toolSnippets?: Record<string, string>;\n /** Additional guideline bullets appended to the default system prompt guidelines. */\n promptGuidelines?: string[];\n /** Text to append to system prompt. */\n appendSystemPrompt?: string;\n /** Working directory. */\n cwd: string;\n /** Currently selected model, used for model-aware prompt metadata. */\n selectedModel?: SystemPromptModel;\n /** Current reasoning/thinking level for the selected model. */\n selectedThinkingLevel?: string;\n /** Pre-loaded context files. */\n contextFiles?: Array<{ path: string; content: string }>;\n /** Pre-loaded skills. */\n skills?: Skill[];\n}\n\n/** Build the system prompt with tools, guidelines, and context */\nexport function buildSystemPrompt(options: BuildSystemPromptOptions): string {\n const {\n customPrompt,\n selectedTools,\n excludedTools,\n toolSnippets,\n promptGuidelines,\n appendSystemPrompt,\n cwd,\n selectedModel,\n selectedThinkingLevel,\n contextFiles: providedContextFiles,\n skills: providedSkills,\n } = options;\n const resolvedCwd = cwd;\n const promptCwd = resolvedCwd.replace(/\\\\/g, \"/\");\n\n const now = new Date();\n const year = now.getFullYear();\n const month = String(now.getMonth() + 1).padStart(2, \"0\");\n const day = String(now.getDate()).padStart(2, \"0\");\n const date = `${year}-${month}-${day}`;\n\n const appendSection = appendSystemPrompt ? `\\n\\n${appendSystemPrompt}` : \"\";\n const modelName =\n selectedModel?.name?.trim() || selectedModel?.id || \"unknown\";\n const modelReasoningLevel = selectedThinkingLevel?.trim() || \"off\";\n\n const contextFiles = providedContextFiles ?? [];\n const skills = providedSkills ?? [];\n const explicitlyExcludedTools = new Set(excludedTools ?? []);\n const isPromptToolAvailable = (name: string): boolean =>\n (!selectedTools || selectedTools.includes(name)) &&\n !explicitlyExcludedTools.has(name);\n\n if (customPrompt) {\n let prompt = customPrompt;\n\n if (appendSection) {\n prompt += appendSection;\n }\n\n // Append project context files\n if (contextFiles.length > 0) {\n prompt += \"\\n\\n# Project Context\\n\\n\";\n prompt += \"Project-specific instructions and guidelines:\\n\\n\";\n for (const { path: filePath, content } of contextFiles) {\n prompt += `<context_file path=\\\"${filePath}\\\">\\n${content}\\n</context_file>\\n\\n`;\n }\n }\n\n // Append skills section (only if read tool is available)\n if (isPromptToolAvailable(\"read\") && skills.length > 0) {\n prompt += formatSkillsForPrompt(skills);\n }\n\n // Add model metadata, date, and working directory last\n prompt += `\\nModel name (used for commit attribution): ${modelName}`;\n prompt += `\\nModel reasoning level: ${modelReasoningLevel}`;\n prompt += `\\nCurrent date: ${date}`;\n prompt += `\\nCurrent working directory: ${promptCwd}`;\n\n return prompt;\n }\n\n // Get absolute paths to documentation and examples\n const readmePath = getReadmePath();\n const docsPath = getDocsPath();\n const examplesPath = getExamplesPath();\n\n // Build tools list based on selected tools.\n // A tool appears in Available tools only when the caller provides a one-line snippet.\n const tools = (selectedTools ?? DEFAULT_PROMPT_TOOLS).filter(\n (name) => !explicitlyExcludedTools.has(name),\n );\n const visibleTools = tools.filter((name) => !!toolSnippets?.[name]);\n const toolsList =\n visibleTools.length > 0\n ? visibleTools\n .map((name) => `- ${name}: ${toolSnippets![name]}`)\n .join(\"\\n\")\n : \"(none)\";\n\n // Build guidelines based on which tools are actually available\n const guidelinesList: string[] = [];\n const guidelinesSet = new Set<string>();\n const addGuideline = (guideline: string): void => {\n if (guidelinesSet.has(guideline)) {\n return;\n }\n guidelinesSet.add(guideline);\n guidelinesList.push(guideline);\n };\n\n const hasBash = tools.includes(\"bash\");\n const hasFind = tools.includes(\"find\");\n const hasLs = tools.includes(\"ls\");\n const hasRead = tools.includes(\"read\");\n const shouldIncludeAskUserFallbackGuidance =\n selectedTools !== undefined &&\n tools.length > 0 &&\n !tools.includes(\"ask_user_question\") &&\n !explicitlyExcludedTools.has(\"ask_user_question\");\n\n // File exploration guidelines\n if (hasBash && !hasFind && !hasLs) {\n addGuideline(\"Use bash for file operations like ls, rg, find\");\n }\n if (shouldIncludeAskUserFallbackGuidance) {\n addGuideline(\"Clarify ambiguous requirements using the ask_user_question tool if available.\");\n }\n\n for (const guideline of promptGuidelines ?? []) {\n const normalized = guideline.trim();\n if (normalized.length > 0) {\n addGuideline(normalized);\n }\n }\n\n // Always include these\n for (const guideline of DEFAULT_COMMUNICATION_GUIDELINES) {\n addGuideline(guideline);\n }\n\n addGuideline(\"Be concise in your responses\");\n addGuideline(\"Show file paths clearly when working with files\");\n\n const guidelines = guidelinesList.map((g) => `- ${g}`).join(\"\\n\");\n\n let prompt = `You are an expert coding assistant operating named Atomic, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.\n\nAvailable tools:\n${toolsList}\n\nIn addition to the tools above, you may have access to other custom tools depending on the project.\n\nGuidelines:\n${guidelines}\n\nAtomic documentation (read only when the user asks about customizing Atomic itself, its SDK, creating workflows, packages, extensions, themes, skills, or TUI):\n- Main documentation: ${readmePath}\n- Additional docs: ${docsPath}\n- Examples: ${examplesPath} (extensions, custom tools, SDK)\n- Docs/examples references above must be resolved against these absolute roots; e.g. docs/foo.md means ${docsPath}/foo.md and examples/bar means ${examplesPath}/bar.\n- When asked about: atomic workflows (docs/workflows.md), extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), atomic packages (docs/packages.md)\n- When working on Atomic topics, read the docs and examples, and follow .md cross-references before implementing\n- Always read Atomic .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;\n\n if (appendSection) {\n prompt += appendSection;\n }\n\n // Append project context files\n if (contextFiles.length > 0) {\n prompt += \"\\n\\n# Project Context\\n\\n\";\n prompt += \"Project-specific instructions and guidelines:\\n\\n\";\n for (const { path: filePath, content } of contextFiles) {\n prompt += `<context_file path=\\\"${filePath}\\\">\\n${content}\\n</context_file>\\n\\n`;\n }\n }\n\n // Append skills section (only if read tool is available)\n if (hasRead && skills.length > 0) {\n prompt += formatSkillsForPrompt(skills);\n }\n\n // Add model metadata, date, and working directory last\n prompt += `\\nModel name (used for commit attribution): ${modelName}`;\n prompt += `\\nModel reasoning level: ${modelReasoningLevel}`;\n prompt += `\\nCurrent date: ${date}`;\n prompt += `\\nCurrent working directory: ${promptCwd}`;\n\n return prompt;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-session-host-rendering.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,wBAAwB,CAAC;AAOhC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAgBzE,wBAAgB,qBAAqB,CACnC,WAAW,SAAS,uBAAuB,EAE3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,EAAE,CAaV;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,SAAS,uBAAuB,EAC3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBnE;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,SAAS,uBAAuB,EAC3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAWnE;AAED,wBAAgB,sBAAsB,CAAC,WAAW,SAAS,uBAAuB,EAChF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,CAIV;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,uBAAuB,EACjF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,MAAM,EAAE,CAwBV;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,uBAAuB,EACjF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"chat-session-host-rendering.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,wBAAwB,CAAC;AAOhC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAgBzE,wBAAgB,qBAAqB,CACnC,WAAW,SAAS,uBAAuB,EAE3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,EAAE,CAaV;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,SAAS,uBAAuB,EAC3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBnE;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,SAAS,uBAAuB,EAC3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAWnE;AAED,wBAAgB,sBAAsB,CAAC,WAAW,SAAS,uBAAuB,EAChF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,CAIV;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,uBAAuB,EACjF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,MAAM,EAAE,CAwBV;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,uBAAuB,EACjF,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,CAUV;AAED,wBAAgB,sBAAsB,CACpC,WAAW,SAAS,uBAAuB,EAE3C,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,GACvC,SAAS,CAcX;AAED,wBAAgB,kBAAkB,CAAC,WAAW,SAAS,uBAAuB,EAC5E,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,EACxC,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR"}
|
|
@@ -87,7 +87,11 @@ export function renderChatSessionEditor(state, width, focused) {
|
|
|
87
87
|
export function renderChatSessionFooter(state, width) {
|
|
88
88
|
const agentSession = state.getAgentSession?.();
|
|
89
89
|
if (agentSession && state.footerData) {
|
|
90
|
-
return new FooterComponent(agentSession, state.footerData
|
|
90
|
+
return new FooterComponent(agentSession, state.footerData, {
|
|
91
|
+
dim: (text) => state.style.dim(text),
|
|
92
|
+
muted: (text) => state.style.textMuted(text),
|
|
93
|
+
warning: (text) => state.style.accent(text),
|
|
94
|
+
}).render(width);
|
|
91
95
|
}
|
|
92
96
|
return [];
|
|
93
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-session-host-rendering.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EACL,sBAAsB,GAGvB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE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AAC,CAAC;AACpB,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAwC,EACxC,KAAa,EACb,KAA0C,EAC1C,OAAe;IAEf,MAAM,IAAI,GAAG,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC;IACpC,OAAO,IAAI,IAAI,CACb,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAC9D,CAAC,EACD,CAAC,CACF,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import {\n type Component,\n type TUI,\n Spacer,\n Text,\n truncateToWidth,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { UsageMeterComponent, FooterComponent } from \"./footer.ts\";\nimport {\n renderChatMessageEntry,\n type ChatMessageEntry,\n type ChatMessageRenderOptions,\n} from \"./chat-message-renderer.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport type { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type { ChatSessionHostEntry } from \"./chat-session-host-types.ts\";\nimport {\n setEditorBorderColor,\n setEditorFocused,\n setEditorPlaceholder,\n} from \"./chat-session-host-editor.ts\";\nimport { isChatSessionStreaming } from \"./chat-session-host-runtime.ts\";\nimport {\n cacheKey,\n isChatMessageEntry,\n spinnerFrame,\n stripAnsi,\n tailStreamingText,\n} from \"./chat-session-host-utils.ts\";\nimport { WorkingStatusComponent } from \"./working-status.ts\";\n\nexport function renderChatSessionBody<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n budget: number,\n): string[] {\n const components: Component[] = [];\n state.transcriptRenderSettingsKey = chatRenderSettingsCacheKey(state);\n if (state.transcript.length > 0) {\n components.push(state.transcriptComponent);\n }\n if (state.statusMessage && !state.compacting) {\n components.push(new Spacer(1));\n components.push(new Text(state.style.dim(state.statusMessage), 2, 0));\n }\n state.bodyViewport.setVisibleRows(budget);\n state.bodyViewport.setComponents(components);\n return state.bodyViewport.render(width);\n}\n\nexport function renderChatSessionPendingMessages<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(state: ChatSessionHostState<TExtraEntry>, width: number): string[] {\n if (\n state.pendingSteeringMessages.length === 0 &&\n state.pendingFollowUpMessages.length === 0 &&\n state.compactionQueuedMessages.length === 0\n ) {\n return [];\n }\n const lines = [state.style.blank(width)];\n for (const message of state.pendingSteeringMessages) {\n lines.push(...pendingMessageLine(state, width, \"Steering\", message));\n }\n for (const message of state.pendingFollowUpMessages) {\n lines.push(...pendingMessageLine(state, width, \"Follow-up\", message));\n }\n for (const message of state.compactionQueuedMessages) {\n lines.push(...pendingMessageLine(state, width, \"Queued\", message));\n }\n const hint = state.getActionKeyDisplay?.(\"app.message.dequeue\") ?? \"alt+up\";\n lines.push(...new Text(state.style.dim(`↳ ${hint} to edit all queued messages`), 1, 0).render(width));\n return lines;\n}\n\nexport function renderChatSessionWorkingStatus<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(state: ChatSessionHostState<TExtraEntry>, width: number): string[] {\n if (!isChatSessionStreaming(state)) return [];\n const message = state.compacting\n ? state.statusMessage || \"Compacting context...\"\n : state.workingMessage ?? \"Working...\";\n return new WorkingStatusComponent({\n spinner: spinnerFrame(),\n message,\n spinnerColor: (text) => state.style.accentBold(text),\n messageColor: (text) => state.style.textMuted(text),\n }).render(width);\n}\n\nexport function renderChatSessionUsage<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n): string[] {\n const agentSession = state.getAgentSession?.();\n if (!agentSession) return [];\n return new UsageMeterComponent(agentSession).render(width);\n}\n\nexport function renderChatSessionEditor<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n focused: boolean,\n): string[] {\n const disabled = state.isDisabled?.() === true;\n const agentSession = state.getAgentSession?.();\n const ruleHex = state.style.editorRuleColor(disabled, agentSession, {\n isBashMode: state.isBashMode,\n });\n if (!disabled && state.editor) {\n setEditorFocused(state.editor, focused);\n setEditorPlaceholder(state.editor, undefined);\n setEditorBorderColor(state.editor, (text) => state.style.rule(ruleHex, text));\n return state.editor.render(width);\n }\n if (state.editor) setEditorFocused(state.editor, false);\n const rule = state.style.rule(ruleHex, \"─\".repeat(width));\n const available = Math.max(1, width - 3);\n const value = state.inputBuffer\n ? state.style.text(truncateToWidth(state.inputBuffer, available)) + state.style.cursor()\n : disabled\n ? \"\"\n : state.style.cursor();\n const left = state.style.accentBold(\"❯\") + \" \" + value;\n const gap = Math.max(0, width - visibleWidth(stripAnsi(left)));\n const body = left + \" \".repeat(gap);\n return [rule, body, rule];\n}\n\nexport function renderChatSessionFooter<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n): string[] {\n const agentSession = state.getAgentSession?.();\n if (agentSession && state.footerData) {\n return new FooterComponent(agentSession, state.footerData).render(width);\n }\n return [];\n}\n\nexport function renderChatSessionEntry<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n): Component {\n if (state.extraEntries.includes(entry as TExtraEntry)) {\n return state.renderExtraEntry?.(entry as TExtraEntry) ?? new Text(\"\", 0, 0);\n }\n if (isChatMessageEntry(entry)) {\n return renderChatMessageEntry(\n streamingWindowedEntry(state, entry),\n chatMessageRenderOptions(state),\n );\n }\n if (!state.renderExtraEntry) {\n return new Text(\"\", 0, 0);\n }\n return state.renderExtraEntry(entry);\n}\n\nexport function transcriptCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n index: number,\n): string {\n return cacheKey([\n state.transcriptRenderSettingsKey,\n index,\n entry.role,\n renderIdentityKey(state, entry),\n entryContentCacheKey(state, entry),\n ]);\n}\n\nfunction streamingWindowedEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatMessageEntry,\n): ChatMessageEntry {\n if (!isChatSessionStreaming(state) || state.bodyViewport.getScrollFromBottom() !== 0) {\n return entry;\n }\n if (entry.kind !== \"assistant\") return entry;\n const content = entry.message.content.map((item) => {\n if (item.type === \"text\") return { ...item, text: tailStreamingText(item.text) };\n if (item.type === \"thinking\") return { ...item, thinking: tailStreamingText(item.thinking) };\n return item;\n });\n return { ...entry, message: { ...entry.message, content } };\n}\n\nfunction chatMessageRenderOptions<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): ChatMessageRenderOptions {\n const inherited = state.getChatRenderSettings?.();\n return {\n ...inherited,\n ui: toolTui(state),\n cwd: state.getCwd?.() ?? state.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n markdownTheme: inherited?.markdownTheme ?? state.getMarkdownTheme?.(),\n showImages: inherited?.showImages ?? true,\n };\n}\n\nfunction toolTui<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): Pick<TUI, \"requestRender\"> {\n return { requestRender: () => state.requestRender?.() };\n}\n\nfunction chatRenderSettingsCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): string {\n const inherited = state.getChatRenderSettings?.();\n return cacheKey([\n \"settings\",\n inherited?.hideThinkingBlock === true,\n inherited?.hiddenThinkingLabel ?? \"\",\n inherited?.toolOutputExpanded === true,\n inherited?.showImages !== false,\n inherited?.imageWidthCells ?? null,\n inherited?.outputPad ?? null,\n state.getCwd?.() ?? state.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n state.bodyViewport.getScrollFromBottom() === 0,\n isChatSessionStreaming(state),\n ]);\n}\n\nfunction entryContentCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n): string {\n if (!isChatMessageEntry(entry)) return cacheKey([\"extra\"]);\n switch (entry.kind) {\n case \"assistant\":\n return cacheKey([\"assistant\", renderIdentityKey(state, entry.message)]);\n case \"tool\":\n return cacheKey([\"tool\", entry.toolCallId, entry.toolName, entry.isPartial === true, entry.result === undefined ? null : renderIdentityKey(state, entry.result)]);\n case \"bashExecution\":\n return cacheKey([\"bashExecution\", entry.isPartial === true, entry.message.command, entry.message.output, entry.message.exitCode ?? null, entry.message.cancelled, entry.message.truncated, entry.message.fullOutputPath ?? null]);\n case \"user\":\n return cacheKey([\"user\", entry.text]);\n case \"custom\":\n return cacheKey([\"custom\", renderIdentityKey(state, entry.message)]);\n case \"branchSummary\":\n return cacheKey([\"branchSummary\", renderIdentityKey(state, entry.message)]);\n case \"system\":\n return cacheKey([\"system\", entry.text]);\n }\n}\n\nfunction renderIdentityKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n value: object,\n): string {\n const existing = state.renderIdentityIds.get(value);\n if (existing !== undefined) return String(existing);\n const id = state.nextRenderIdentityId;\n state.nextRenderIdentityId += 1;\n state.renderIdentityIds.set(value, id);\n return String(id);\n}\n\nfunction pendingMessageLine<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n label: \"Steering\" | \"Follow-up\" | \"Queued\",\n message: string,\n): string[] {\n const text = `${label}: ${message}`;\n return new Text(\n state.style.dim(truncateToWidth(text, Math.max(1, width - 2))),\n 1,\n 0,\n ).render(width);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-session-host-rendering.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,eA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9E,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,KAAwC,EACxC,KAAa;IAEb,MAAM,QAAQ,GAAG,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,KAAK,CAAC,oBAAoB,CAAC;IACtC,KAAK,CAAC,oBAAoB,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAwC,EACxC,KAAa,EACb,KAA0C,EAC1C,OAAe;IAEf,MAAM,IAAI,GAAG,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC;IACpC,OAAO,IAAI,IAAI,CACb,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAC9D,CAAC,EACD,CAAC,CACF,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import {\n type Component,\n type TUI,\n Spacer,\n Text,\n truncateToWidth,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { UsageMeterComponent, FooterComponent } from \"./footer.ts\";\nimport {\n renderChatMessageEntry,\n type ChatMessageEntry,\n type ChatMessageRenderOptions,\n} from \"./chat-message-renderer.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport type { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type { ChatSessionHostEntry } from \"./chat-session-host-types.ts\";\nimport {\n setEditorBorderColor,\n setEditorFocused,\n setEditorPlaceholder,\n} from \"./chat-session-host-editor.ts\";\nimport { isChatSessionStreaming } from \"./chat-session-host-runtime.ts\";\nimport {\n cacheKey,\n isChatMessageEntry,\n spinnerFrame,\n stripAnsi,\n tailStreamingText,\n} from \"./chat-session-host-utils.ts\";\nimport { WorkingStatusComponent } from \"./working-status.ts\";\n\nexport function renderChatSessionBody<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n budget: number,\n): string[] {\n const components: Component[] = [];\n state.transcriptRenderSettingsKey = chatRenderSettingsCacheKey(state);\n if (state.transcript.length > 0) {\n components.push(state.transcriptComponent);\n }\n if (state.statusMessage && !state.compacting) {\n components.push(new Spacer(1));\n components.push(new Text(state.style.dim(state.statusMessage), 2, 0));\n }\n state.bodyViewport.setVisibleRows(budget);\n state.bodyViewport.setComponents(components);\n return state.bodyViewport.render(width);\n}\n\nexport function renderChatSessionPendingMessages<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(state: ChatSessionHostState<TExtraEntry>, width: number): string[] {\n if (\n state.pendingSteeringMessages.length === 0 &&\n state.pendingFollowUpMessages.length === 0 &&\n state.compactionQueuedMessages.length === 0\n ) {\n return [];\n }\n const lines = [state.style.blank(width)];\n for (const message of state.pendingSteeringMessages) {\n lines.push(...pendingMessageLine(state, width, \"Steering\", message));\n }\n for (const message of state.pendingFollowUpMessages) {\n lines.push(...pendingMessageLine(state, width, \"Follow-up\", message));\n }\n for (const message of state.compactionQueuedMessages) {\n lines.push(...pendingMessageLine(state, width, \"Queued\", message));\n }\n const hint = state.getActionKeyDisplay?.(\"app.message.dequeue\") ?? \"alt+up\";\n lines.push(...new Text(state.style.dim(`↳ ${hint} to edit all queued messages`), 1, 0).render(width));\n return lines;\n}\n\nexport function renderChatSessionWorkingStatus<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(state: ChatSessionHostState<TExtraEntry>, width: number): string[] {\n if (!isChatSessionStreaming(state)) return [];\n const message = state.compacting\n ? state.statusMessage || \"Compacting context...\"\n : state.workingMessage ?? \"Working...\";\n return new WorkingStatusComponent({\n spinner: spinnerFrame(),\n message,\n spinnerColor: (text) => state.style.accentBold(text),\n messageColor: (text) => state.style.textMuted(text),\n }).render(width);\n}\n\nexport function renderChatSessionUsage<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n): string[] {\n const agentSession = state.getAgentSession?.();\n if (!agentSession) return [];\n return new UsageMeterComponent(agentSession).render(width);\n}\n\nexport function renderChatSessionEditor<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n focused: boolean,\n): string[] {\n const disabled = state.isDisabled?.() === true;\n const agentSession = state.getAgentSession?.();\n const ruleHex = state.style.editorRuleColor(disabled, agentSession, {\n isBashMode: state.isBashMode,\n });\n if (!disabled && state.editor) {\n setEditorFocused(state.editor, focused);\n setEditorPlaceholder(state.editor, undefined);\n setEditorBorderColor(state.editor, (text) => state.style.rule(ruleHex, text));\n return state.editor.render(width);\n }\n if (state.editor) setEditorFocused(state.editor, false);\n const rule = state.style.rule(ruleHex, \"─\".repeat(width));\n const available = Math.max(1, width - 3);\n const value = state.inputBuffer\n ? state.style.text(truncateToWidth(state.inputBuffer, available)) + state.style.cursor()\n : disabled\n ? \"\"\n : state.style.cursor();\n const left = state.style.accentBold(\"❯\") + \" \" + value;\n const gap = Math.max(0, width - visibleWidth(stripAnsi(left)));\n const body = left + \" \".repeat(gap);\n return [rule, body, rule];\n}\n\nexport function renderChatSessionFooter<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n): string[] {\n const agentSession = state.getAgentSession?.();\n if (agentSession && state.footerData) {\n return new FooterComponent(agentSession, state.footerData, {\n dim: (text) => state.style.dim(text),\n muted: (text) => state.style.textMuted(text),\n warning: (text) => state.style.accent(text),\n }).render(width);\n }\n return [];\n}\n\nexport function renderChatSessionEntry<\n TExtraEntry extends ChatTranscriptEntryLike,\n>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n): Component {\n if (state.extraEntries.includes(entry as TExtraEntry)) {\n return state.renderExtraEntry?.(entry as TExtraEntry) ?? new Text(\"\", 0, 0);\n }\n if (isChatMessageEntry(entry)) {\n return renderChatMessageEntry(\n streamingWindowedEntry(state, entry),\n chatMessageRenderOptions(state),\n );\n }\n if (!state.renderExtraEntry) {\n return new Text(\"\", 0, 0);\n }\n return state.renderExtraEntry(entry);\n}\n\nexport function transcriptCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n index: number,\n): string {\n return cacheKey([\n state.transcriptRenderSettingsKey,\n index,\n entry.role,\n renderIdentityKey(state, entry),\n entryContentCacheKey(state, entry),\n ]);\n}\n\nfunction streamingWindowedEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatMessageEntry,\n): ChatMessageEntry {\n if (!isChatSessionStreaming(state) || state.bodyViewport.getScrollFromBottom() !== 0) {\n return entry;\n }\n if (entry.kind !== \"assistant\") return entry;\n const content = entry.message.content.map((item) => {\n if (item.type === \"text\") return { ...item, text: tailStreamingText(item.text) };\n if (item.type === \"thinking\") return { ...item, thinking: tailStreamingText(item.thinking) };\n return item;\n });\n return { ...entry, message: { ...entry.message, content } };\n}\n\nfunction chatMessageRenderOptions<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): ChatMessageRenderOptions {\n const inherited = state.getChatRenderSettings?.();\n return {\n ...inherited,\n ui: toolTui(state),\n cwd: state.getCwd?.() ?? state.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n markdownTheme: inherited?.markdownTheme ?? state.getMarkdownTheme?.(),\n showImages: inherited?.showImages ?? true,\n };\n}\n\nfunction toolTui<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): Pick<TUI, \"requestRender\"> {\n return { requestRender: () => state.requestRender?.() };\n}\n\nfunction chatRenderSettingsCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n): string {\n const inherited = state.getChatRenderSettings?.();\n return cacheKey([\n \"settings\",\n inherited?.hideThinkingBlock === true,\n inherited?.hiddenThinkingLabel ?? \"\",\n inherited?.toolOutputExpanded === true,\n inherited?.showImages !== false,\n inherited?.imageWidthCells ?? null,\n inherited?.outputPad ?? null,\n state.getCwd?.() ?? state.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n state.bodyViewport.getScrollFromBottom() === 0,\n isChatSessionStreaming(state),\n ]);\n}\n\nfunction entryContentCacheKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n entry: ChatSessionHostEntry<TExtraEntry>,\n): string {\n if (!isChatMessageEntry(entry)) return cacheKey([\"extra\"]);\n switch (entry.kind) {\n case \"assistant\":\n return cacheKey([\"assistant\", renderIdentityKey(state, entry.message)]);\n case \"tool\":\n return cacheKey([\"tool\", entry.toolCallId, entry.toolName, entry.isPartial === true, entry.result === undefined ? null : renderIdentityKey(state, entry.result)]);\n case \"bashExecution\":\n return cacheKey([\"bashExecution\", entry.isPartial === true, entry.message.command, entry.message.output, entry.message.exitCode ?? null, entry.message.cancelled, entry.message.truncated, entry.message.fullOutputPath ?? null]);\n case \"user\":\n return cacheKey([\"user\", entry.text]);\n case \"custom\":\n return cacheKey([\"custom\", renderIdentityKey(state, entry.message)]);\n case \"branchSummary\":\n return cacheKey([\"branchSummary\", renderIdentityKey(state, entry.message)]);\n case \"system\":\n return cacheKey([\"system\", entry.text]);\n }\n}\n\nfunction renderIdentityKey<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n value: object,\n): string {\n const existing = state.renderIdentityIds.get(value);\n if (existing !== undefined) return String(existing);\n const id = state.nextRenderIdentityId;\n state.nextRenderIdentityId += 1;\n state.renderIdentityIds.set(value, id);\n return String(id);\n}\n\nfunction pendingMessageLine<TExtraEntry extends ChatTranscriptEntryLike>(\n state: ChatSessionHostState<TExtraEntry>,\n width: number,\n label: \"Steering\" | \"Follow-up\" | \"Queued\",\n message: string,\n): string[] {\n const text = `${label}: ${message}`;\n return new Text(\n state.style.dim(truncateToWidth(text, Math.max(1, width - 2))),\n 1,\n 0,\n ).render(width);\n}\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type Component } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { AgentSession } from "../../../core/agent-session.ts";
|
|
3
3
|
import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
|
|
4
|
+
export interface FooterRenderStyle {
|
|
5
|
+
dim(text: string): string;
|
|
6
|
+
muted(text: string): string;
|
|
7
|
+
warning(text: string): string;
|
|
8
|
+
}
|
|
4
9
|
export declare function formatCwdForFooter(cwd: string, home: string | undefined): string;
|
|
5
10
|
/**
|
|
6
11
|
* Right-aligned usage meter that sits above the composer, matching the approved
|
|
@@ -22,7 +27,8 @@ export declare class UsageMeterComponent implements Component {
|
|
|
22
27
|
export declare class FooterComponent implements Component {
|
|
23
28
|
private session;
|
|
24
29
|
private footerData;
|
|
25
|
-
|
|
30
|
+
private readonly renderStyle;
|
|
31
|
+
constructor(session: AgentSession, footerData: ReadonlyFooterDataProvider, renderStyle?: FooterRenderStyle);
|
|
26
32
|
setSession(session: AgentSession): void;
|
|
27
33
|
setAutoCompactEnabled(_enabled: boolean): void;
|
|
28
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,wBAAwB,CA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,iBAA4C,EAK3D;IAEA,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE7C;IAED;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA0C9B;CACF"}
|
|
@@ -4,6 +4,11 @@ import { formatCodexFastModeModelLabel, shouldApplyCodexFastMode, } from "../../
|
|
|
4
4
|
import { areExperimentalFeaturesEnabled } from "../../../core/experimental.js";
|
|
5
5
|
import { addUsageToTotals, createUsageTotals } from "../../../core/usage-totals.js";
|
|
6
6
|
import { theme } from "../theme/theme.js";
|
|
7
|
+
const defaultFooterRenderStyle = {
|
|
8
|
+
dim: (text) => theme.fg("dim", text),
|
|
9
|
+
muted: (text) => theme.fg("muted", text),
|
|
10
|
+
warning: (text) => theme.fg("warning", text),
|
|
11
|
+
};
|
|
7
12
|
function sanitizeStatusText(text) {
|
|
8
13
|
// Replace newlines, tabs, carriage returns with space, then collapse
|
|
9
14
|
// multiple spaces (pi parity). ANSI/SGR sequences must survive intact:
|
|
@@ -139,9 +144,10 @@ export class UsageMeterComponent {
|
|
|
139
144
|
* when idle, or one semantic dot with short recovery copy while work is live.
|
|
140
145
|
*/
|
|
141
146
|
export class FooterComponent {
|
|
142
|
-
constructor(session, footerData) {
|
|
147
|
+
constructor(session, footerData, renderStyle = defaultFooterRenderStyle) {
|
|
143
148
|
this.session = session;
|
|
144
149
|
this.footerData = footerData;
|
|
150
|
+
this.renderStyle = renderStyle;
|
|
145
151
|
}
|
|
146
152
|
setSession(session) {
|
|
147
153
|
this.session = session;
|
|
@@ -190,16 +196,16 @@ export class FooterComponent {
|
|
|
190
196
|
modelLabel = `(${state.model.provider}) ${modelLabel}`;
|
|
191
197
|
}
|
|
192
198
|
const liveState = this.session.isStreaming
|
|
193
|
-
?
|
|
199
|
+
? this.renderStyle.muted("esc to interrupt")
|
|
194
200
|
: undefined;
|
|
195
201
|
let statusText = liveState ??
|
|
196
|
-
`${
|
|
202
|
+
`${this.renderStyle.dim(modelLabel)} ${this.renderStyle.dim("•")} ${this.renderStyle.muted(pwd)}`;
|
|
197
203
|
if (areExperimentalFeaturesEnabled())
|
|
198
|
-
statusText += ` ${
|
|
199
|
-
const lines = [truncateToWidth(statusText, width,
|
|
204
|
+
statusText += ` ${this.renderStyle.warning("xp")}`;
|
|
205
|
+
const lines = [truncateToWidth(statusText, width, this.renderStyle.dim("..."))];
|
|
200
206
|
const statuses = [...this.footerData.getExtensionStatuses()].sort(([a], [b]) => a.localeCompare(b));
|
|
201
207
|
if (statuses.length > 0) {
|
|
202
|
-
lines.push(truncateToWidth(statuses.map(([, text]) => sanitizeStatusText(text)).join(" "), width,
|
|
208
|
+
lines.push(truncateToWidth(statuses.map(([, text]) => sanitizeStatusText(text)).join(" "), width, this.renderStyle.dim("...")));
|
|
203
209
|
}
|
|
204
210
|
return lines;
|
|
205
211
|
}
|