@buildaharness/aielia 0.3.0

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.
Files changed (127) hide show
  1. package/README.md +832 -0
  2. package/dist/action-approval-service.d.ts +52 -0
  3. package/dist/action-snapshot.d.ts +173 -0
  4. package/dist/action-tools.d.ts +38 -0
  5. package/dist/agent-loop.d.ts +372 -0
  6. package/dist/answer-claim.d.ts +51 -0
  7. package/dist/ask-clarification-service.d.ts +70 -0
  8. package/dist/ask-mode-flag.d.ts +25 -0
  9. package/dist/ask-response-format.d.ts +8 -0
  10. package/dist/assistant-session.d.ts +267 -0
  11. package/dist/assistant-source.d.ts +14 -0
  12. package/dist/assistant-types.d.ts +158 -0
  13. package/dist/assistant.d.ts +419 -0
  14. package/dist/batch-list-detector.d.ts +15 -0
  15. package/dist/batch-research-fixtures.d.ts +50 -0
  16. package/dist/benchmark-injected-failure.d.ts +27 -0
  17. package/dist/claude-cli-llm-client.d.ts +139 -0
  18. package/dist/claude-cli-prompt.d.ts +86 -0
  19. package/dist/cli-config.d.ts +27 -0
  20. package/dist/cli-session-D0uLdT2A.js +7863 -0
  21. package/dist/cli-session-D0uLdT2A.js.map +1 -0
  22. package/dist/cli-session.d.ts +63 -0
  23. package/dist/cli.d.ts +65 -0
  24. package/dist/cli.js +1693 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/config.d.ts +175 -0
  27. package/dist/contradiction-checker.d.ts +27 -0
  28. package/dist/debug-log.d.ts +16 -0
  29. package/dist/decomposition-classifier.d.ts +38 -0
  30. package/dist/doctor-checks.d.ts +8 -0
  31. package/dist/email-smtp.d.ts +19 -0
  32. package/dist/email.d.ts +60 -0
  33. package/dist/error-classifier.d.ts +13 -0
  34. package/dist/execution-mode.d.ts +85 -0
  35. package/dist/fact-extraction.d.ts +143 -0
  36. package/dist/failure-mode-matcher.d.ts +32 -0
  37. package/dist/file-tools-mcp-server.mjs +1027 -0
  38. package/dist/file-tools.d.ts +179 -0
  39. package/dist/first-run.d.ts +22 -0
  40. package/dist/harness-bridge.d.ts +103 -0
  41. package/dist/index.d.ts +58 -0
  42. package/dist/index.js +212 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/ink-test-render.d.ts +24 -0
  45. package/dist/lexical/patterns/batch-list-markers.json +8 -0
  46. package/dist/lexical/patterns/batch-list-markers.json.d.ts +11 -0
  47. package/dist/lexical/patterns/coding-fact-markers.json +8 -0
  48. package/dist/lexical/patterns/coding-fact-markers.json.d.ts +11 -0
  49. package/dist/lexical/patterns/enumeration-markers.json +20 -0
  50. package/dist/lexical/patterns/enumeration-markers.json.d.ts +23 -0
  51. package/dist/lexical/patterns/fact-markers.json +16 -0
  52. package/dist/lexical/patterns/fact-markers.json.d.ts +19 -0
  53. package/dist/lexical/patterns/injection-patterns.json +20 -0
  54. package/dist/lexical/patterns/injection-patterns.json.d.ts +23 -0
  55. package/dist/lexical/patterns/plan-mode-markers.json +10 -0
  56. package/dist/lexical/patterns/plan-mode-markers.json.d.ts +13 -0
  57. package/dist/lexical/patterns/risk-patterns.json +122 -0
  58. package/dist/lexical/patterns/risk-patterns.json.d.ts +125 -0
  59. package/dist/lexical/patterns/task-cancel-markers.json +22 -0
  60. package/dist/lexical/patterns/task-cancel-markers.json.d.ts +25 -0
  61. package/dist/lexical/patterns/template-keywords.json +20 -0
  62. package/dist/lexical/patterns/template-keywords.json.d.ts +23 -0
  63. package/dist/lexical/patterns/tool-yield-markers.json +22 -0
  64. package/dist/lexical/patterns/tool-yield-markers.json.d.ts +25 -0
  65. package/dist/lexical/patterns.d.ts +64 -0
  66. package/dist/memory-service.d.ts +219 -0
  67. package/dist/model-pricing.d.ts +19 -0
  68. package/dist/network-containment.d.ts +21 -0
  69. package/dist/node-config-store.d.ts +29 -0
  70. package/dist/node-display-names.d.ts +26 -0
  71. package/dist/node-fs-backend.d.ts +8 -0
  72. package/dist/non-interactive-mode.d.ts +22 -0
  73. package/dist/one-loop-flag.d.ts +38 -0
  74. package/dist/plan-approval-service.d.ts +62 -0
  75. package/dist/plan-builder.d.ts +32 -0
  76. package/dist/plan-drafting-service.d.ts +87 -0
  77. package/dist/plan-drafting.d.ts +58 -0
  78. package/dist/plan-mode-flag.d.ts +34 -0
  79. package/dist/plan-service.d.ts +61 -0
  80. package/dist/plan-sketch-service.d.ts +24 -0
  81. package/dist/plan-sketch.d.ts +20 -0
  82. package/dist/plan-store.d.ts +232 -0
  83. package/dist/plan-templates/data/content_creation.json.d.ts +75 -0
  84. package/dist/plan-templates/data/decision_making.json.d.ts +66 -0
  85. package/dist/plan-templates/data/problem_solving.json.d.ts +75 -0
  86. package/dist/plan-templates/data/process_improvement.json.d.ts +57 -0
  87. package/dist/plan-templates/data/project_planning.json.d.ts +66 -0
  88. package/dist/plan-templates/data/research_analysis.json.d.ts +66 -0
  89. package/dist/plan-templates/data/trip_planning.json.d.ts +66 -0
  90. package/dist/plan-templates/index.d.ts +33 -0
  91. package/dist/plan-verification.d.ts +31 -0
  92. package/dist/reminder-tools.d.ts +13 -0
  93. package/dist/response-service.d.ts +73 -0
  94. package/dist/review-checker.d.ts +22 -0
  95. package/dist/risk-classifier.d.ts +7 -0
  96. package/dist/scripted-llm-client.d.ts +37 -0
  97. package/dist/semantic-criterion-coverage.d.ts +30 -0
  98. package/dist/shell-executor.d.ts +14 -0
  99. package/dist/shell-tools.d.ts +84 -0
  100. package/dist/spend-cap.d.ts +41 -0
  101. package/dist/spike.d.ts +1 -0
  102. package/dist/spike.js +18 -0
  103. package/dist/spike.js.map +1 -0
  104. package/dist/supervisor-decider.d.ts +3 -0
  105. package/dist/system-prompt.d.ts +8 -0
  106. package/dist/task-mapping.d.ts +42 -0
  107. package/dist/tool-control-plane.d.ts +67 -0
  108. package/dist/tool-policy.d.ts +45 -0
  109. package/dist/tool-step.d.ts +23 -0
  110. package/dist/tool-yield-classifier.d.ts +7 -0
  111. package/dist/trace-events.d.ts +126 -0
  112. package/dist/transcript-compaction.d.ts +13 -0
  113. package/dist/trust-tagging.d.ts +38 -0
  114. package/dist/tui-app-DxLPSGh2.js +481 -0
  115. package/dist/tui-app-DxLPSGh2.js.map +1 -0
  116. package/dist/tui-app.d.ts +125 -0
  117. package/dist/tui-input.d.ts +51 -0
  118. package/dist/tui-mode-flag.d.ts +36 -0
  119. package/dist/tui-output-capture.d.ts +30 -0
  120. package/dist/tui-spike.d.ts +1 -0
  121. package/dist/turn-intent-classifier.d.ts +96 -0
  122. package/dist/turn-interpreter.d.ts +71 -0
  123. package/dist/turn-policy.d.ts +45 -0
  124. package/dist/web-fetch-core.d.ts +65 -0
  125. package/dist/web-search-provider.d.ts +12 -0
  126. package/dist/web-tools.d.ts +26 -0
  127. package/package.json +69 -0
@@ -0,0 +1,63 @@
1
+ import { ChatMessage, TokenUsage } from '@buildaharness/runtime';
2
+ import { AssistantConfig } from './config.js';
3
+ import { MemorySummary, MemoryExport, TranscriptSearchHit, MemoryPendingOutcome } from './assistant.js';
4
+ import { UndoLogEntry } from './action-snapshot.js';
5
+ /**
6
+ * Pure formatting/logic backing cli.ts's session-level commands (/help, /status, /export,
7
+ * /memory, /cost, /doctor) — split out so it's unit-testable without a real readline loop,
8
+ * the same way cli-config.ts already is for the /config family. cli.ts stays thin glue
9
+ * (reading live state, calling these, doing actual file I/O) on top of these functions.
10
+ */
11
+ export interface CliCommandHelp {
12
+ command: string;
13
+ description: string;
14
+ }
15
+ /** Kept as a hand-maintained list rather than derived from cli.ts's dispatch table — see /help's task note on why this can drift and needs manual upkeep when a command is added. */
16
+ export declare const CLI_COMMANDS_HELP: CliCommandHelp[];
17
+ export declare function formatHelp(): string;
18
+ export interface StatusInfo {
19
+ config: AssistantConfig;
20
+ overriddenKeys: ReadonlySet<keyof AssistantConfig>;
21
+ transcriptLength: number;
22
+ planActive: boolean;
23
+ /** Real filesystem effects still on record as revertible (see action-snapshot.ts) — omitted entirely when no workspace is configured (fileTools/shellTools both absent), same "don't imply a capability that isn't there" rule the banner's capability list already follows. */
24
+ undoLogEntries?: UndoLogEntry[];
25
+ /** Pre-formatted by spend-cap.ts's formatSpendCapStatus — undefined when no ceiling is configured, in which case the line is omitted entirely. */
26
+ spendCapLine?: string;
27
+ }
28
+ /** Reuses formatConfigListing for the config half rather than re-formatting the same fields a second way. */
29
+ export declare function formatStatus(info: StatusInfo): string;
30
+ /** Renders the result of `/memory confirm`/`/memory reject` — cli.ts's handleMemoryConfirm/handleMemoryReject print this directly. */
31
+ export declare function formatMemoryPendingOutcome(action: 'confirmed' | 'rejected' | 'forgotten', outcome: MemoryPendingOutcome): string;
32
+ export declare function formatMemorySummary(summary: MemorySummary): string;
33
+ /** Renders `/memory export`'s full, unbounded contents as pretty-printed JSON — a plain formatting function so it's unit-testable the same way as every other cli-session.ts formatter; cli.ts does the actual file write. */
34
+ export declare function formatMemoryExport(data: MemoryExport): string;
35
+ /** Renders `/search <query>`'s results — each hit is one message (session id short form, timestamp, role, snippet), ranked by relevance, never the whole session it came from. An empty list is an explicit "no results" line, never a silent blank output. */
36
+ export declare function formatSearchResults(hits: TranscriptSearchHit[], query: string): string;
37
+ /** Renders /undo-action's no-argument listing — newest first (see action-snapshot.ts's listUndoLogEntries), with each entry's undoable status so the user doesn't have to stage a revert just to find out it's unavailable. */
38
+ export declare function formatUndoLogListing(entries: UndoLogEntry[]): string;
39
+ /** Renders a transcript as markdown for /export — "You:"/"Assistant:" turns, oldest first. */
40
+ export declare function formatTranscriptMarkdown(transcript: ChatMessage[]): string;
41
+ /** Default /export filename when none is given — mirrors Claude Code's own /export default-name convention. Colons/dots are filesystem-unsafe on some platforms, so the ISO timestamp is sanitized. */
42
+ export declare function defaultExportFilename(now?: Date): string;
43
+ /** Default /memory export filename when none is given — same sanitized-ISO-timestamp convention as defaultExportFilename, JSON instead of markdown. */
44
+ export declare function defaultMemoryExportFilename(now?: Date): string;
45
+ export interface CostSummaryInfo {
46
+ /** Usage for the turn just completed — absent when the last turn reported no usage at all, or no turn has completed yet. */
47
+ lastTurn?: TokenUsage;
48
+ /** Running total across the session — {inputTokens: 0, outputTokens: 0} before any usage has ever been reported. */
49
+ session: TokenUsage;
50
+ backend: 'proxy' | 'claude-cli' | 'anthropic' | 'openai' | 'openrouter';
51
+ /** Pre-formatted by spend-cap.ts's formatSpendCapStatus — undefined when no ceiling is configured, in which case the line is omitted entirely (same convention as StatusInfo.spendCapLine). */
52
+ spendCapLine?: string;
53
+ }
54
+ /** Renders /cost's output. The backend-specific footnote matters: claude-cli's cost is real (but may read $0 on a Pro/Max subscription, not API billing); every other backend's cost, when shown, is a static-table estimate (see cli.ts's withCostEstimate), never real billing data — see model-pricing.ts. */
55
+ export declare function formatCostSummary(info: CostSummaryInfo): string;
56
+ export interface DoctorCheck {
57
+ label: string;
58
+ ok: boolean;
59
+ /** Failure reason ("timed out", "not found", an HTTP status, etc.) — omitted entirely on a passing check. */
60
+ detail?: string;
61
+ }
62
+ /** Renders /doctor's ✓/✗ list — the actual checks (network fetch, subprocess spawn, filesystem stat) run in cli.ts, which has the I/O; this just formats the results. */
63
+ export declare function formatDoctorReport(checks: DoctorCheck[]): string;
package/dist/cli.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ import { FsBackend } from '@buildaharness/runtime';
2
+ import { PersonalAssistant } from './assistant.js';
3
+ import { AssistantConfig, ConfigStore } from './config.js';
4
+ import { NonInteractiveApprovalMode } from './non-interactive-mode.js';
5
+ export interface RunCliOptions {
6
+ dataDir?: string;
7
+ configStore?: ConfigStore;
8
+ backend?: FsBackend;
9
+ remindersFile?: string;
10
+ envOverrides?: Partial<AssistantConfig>;
11
+ nonInteractiveApprovalMode?: NonInteractiveApprovalMode;
12
+ input?: NodeJS.ReadableStream;
13
+ output?: NodeJS.WritableStream;
14
+ /**
15
+ * Bypasses buildAssistant()'s config-driven backend selection entirely — the seam tests use
16
+ * to hand runCli a PersonalAssistant wired to a scripted ILLMClient (same pattern as
17
+ * assistant.test.ts) for deterministic command-dispatch/approval-flow coverage. When set, a
18
+ * /config change that would otherwise rebuild the assistant leaves this instance in place.
19
+ */
20
+ assistant?: PersonalAssistant;
21
+ /** Overrides the rl.question-based approval prompt — lets tests script approve/decline answers without faking stdin/a real TTY. */
22
+ askYesNo?: (question: string) => Promise<boolean>;
23
+ /** Overrides the rl.question-based free-text prompt the clarification sub-loop uses for option numbers, edit notes, and "Other" free text — lets tests script a multi-step answer without faking stdin/a real TTY. */
24
+ askLine?: (question: string) => Promise<string>;
25
+ /** Test seam: skip the interactive first-run setup regardless of TTY state (also implied when `assistant` is passed). */
26
+ skipFirstRunSetup?: boolean;
27
+ /** Test seam: stub `claude` binary detection for the first-run setup. */
28
+ detectClaudeCli?: () => Promise<boolean>;
29
+ /** Test seam: script the first-run setup's line reads. */
30
+ firstRunAsk?: (question: string) => Promise<string>;
31
+ }
32
+ export interface CliInstance {
33
+ /** Parses and dispatches one line of input exactly as the REPL's 'line' handler does (same dispatchQueue serialization) — the seam cli.test.ts drives command dispatch through without a live TTY. */
34
+ dispatchLine(line: string): Promise<void>;
35
+ close(): void;
36
+ /**
37
+ * Additive, read-only accessor for the pinned-input TUI shell's status line
38
+ * (plans/personal_assistant_cli_pinned_input_plan.html Phase 3) — the same two signals
39
+ * printStatus() already renders as part of `/status` (lastPlanStatus !== undefined,
40
+ * spendCapStatusLine()), just exposed here instead of only printed. Returns short indicator
41
+ * strings in priority order; empty when there's nothing to report. Not used by the ordinary
42
+ * readline REPL or by non-interactive/piped mode — only the TUI shell polls this.
43
+ */
44
+ getStatusIndicators(): Promise<string[]>;
45
+ }
46
+ /**
47
+ * The CLI's REPL, parameterized so cli.test.ts can import and drive it directly instead of only
48
+ * through a live process (see non-interactive-mode.ts's doc comment for why that mattered before
49
+ * this export existed — this is T1's answer to it). `main()` below calls this with no options,
50
+ * getting exactly today's behavior; every option here has a real-filesystem/real-stdio default.
51
+ */
52
+ export declare function runCli(options?: RunCliOptions): Promise<CliInstance>;
53
+ /**
54
+ * True when `entryArg` (a `process.argv[1]` value) refers to the same file as
55
+ * `moduleHref` (an `import.meta.url`).
56
+ *
57
+ * The naive check — `moduleHref === pathToFileURL(entryArg).href` — breaks
58
+ * whenever the script is launched through the npm bin: `npx
59
+ * @buildaharness/aielia`, a global install, or any
60
+ * `node_modules/.bin` shim all pass a **symlink** to this file as
61
+ * `process.argv[1]`, while Node reports `import.meta.url` as the resolved real
62
+ * path. So resolve `entryArg` to its real path before comparing. `resolveReal`
63
+ * is injected for tests; it defaults to `fs.realpathSync`.
64
+ */
65
+ export declare function entryArgMatchesModule(entryArg: string | undefined, moduleHref: string, resolveReal?: (p: string) => string): boolean;