@buildaharness/aielia 0.3.4 → 0.3.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.
Files changed (97) hide show
  1. package/README.md +63 -20
  2. package/dist/PlanGraphPane.d.ts +19 -0
  3. package/dist/_memory-core-generated.d.ts +1764 -0
  4. package/dist/agent-loop.d.ts +23 -8
  5. package/dist/ambiguity-guard-flag.d.ts +12 -0
  6. package/dist/ambiguity-guard.d.ts +20 -0
  7. package/dist/answer-claim.d.ts +13 -1
  8. package/dist/ask-clarification-service.d.ts +12 -1
  9. package/dist/ask-response-format.d.ts +6 -0
  10. package/dist/assistant-session.d.ts +12 -1
  11. package/dist/assistant-source.d.ts +7 -0
  12. package/dist/assistant-types.d.ts +17 -1
  13. package/dist/assistant.d.ts +128 -6
  14. package/dist/benchmark-injected-failure.d.ts +6 -0
  15. package/dist/bin-CjKpxDxl.js +4836 -0
  16. package/dist/bin-CjKpxDxl.js.map +1 -0
  17. package/dist/cli-session.d.ts +14 -1
  18. package/dist/cli.d.ts +17 -2
  19. package/dist/cli.js +1 -1
  20. package/dist/code-plan-templates.d.ts +21 -0
  21. package/dist/config.d.ts +29 -0
  22. package/dist/constraint-check.d.ts +35 -0
  23. package/dist/contradiction-checker.d.ts +7 -0
  24. package/dist/decomposed-answer.d.ts +13 -0
  25. package/dist/decomposition-classifier.d.ts +2 -0
  26. package/dist/doctor-checks.d.ts +3 -0
  27. package/dist/episodic-digest.d.ts +89 -0
  28. package/dist/fact-extraction.d.ts +39 -0
  29. package/dist/file-tools-mcp-server.mjs +138 -12
  30. package/dist/file-tools.d.ts +4 -0
  31. package/dist/first-run.d.ts +0 -2
  32. package/dist/goal-graph-store.d.ts +18 -18
  33. package/dist/grounding-check.d.ts +33 -0
  34. package/dist/harness-bridge.d.ts +75 -2
  35. package/dist/harness-token-budget.d.ts +9 -0
  36. package/dist/index.d.ts +20 -1
  37. package/dist/index.js +165 -94
  38. package/dist/index.js.map +1 -1
  39. package/dist/layer-policy-flag.d.ts +13 -0
  40. package/dist/layer-policy-wiring.d.ts +77 -0
  41. package/dist/layer-settings.d.ts +49 -0
  42. package/dist/layer-telemetry.d.ts +2 -0
  43. package/dist/lexical/lexical-mode.d.ts +29 -0
  44. package/dist/memory-consolidation.d.ts +80 -0
  45. package/dist/memory-governance.d.ts +30 -0
  46. package/dist/memory-reviewer.d.ts +114 -0
  47. package/dist/memory-service.d.ts +348 -9
  48. package/dist/model-json.d.ts +17 -0
  49. package/dist/next-step-context.d.ts +51 -0
  50. package/dist/next-step-proposer.d.ts +3 -2
  51. package/dist/plan-graph-flag.d.ts +20 -0
  52. package/dist/plan-question.d.ts +60 -0
  53. package/dist/plan-service.d.ts +6 -2
  54. package/dist/plan-step-prompt.d.ts +15 -0
  55. package/dist/plan-store.d.ts +7 -1
  56. package/dist/plan-viz/normalize.d.ts +14 -0
  57. package/dist/plan-viz/plan-detail-lines.d.ts +3 -0
  58. package/dist/plan-viz/plan-layout.d.ts +48 -0
  59. package/dist/plan-viz/plan-nav.d.ts +29 -0
  60. package/dist/plan-viz/plan-raster.d.ts +36 -0
  61. package/dist/plan-viz/plan-routes.d.ts +6 -0
  62. package/dist/plan-viz/plan-snapshot.d.ts +73 -0
  63. package/dist/plan-viz/plan-viewport.d.ts +29 -0
  64. package/dist/plan-viz/plan-width.d.ts +15 -0
  65. package/dist/plan-viz/testkit/display-width.d.ts +12 -0
  66. package/dist/plan-viz/testkit/generators.d.ts +61 -0
  67. package/dist/plan-viz/testkit/grid-oracles.d.ts +38 -0
  68. package/dist/plan-viz/testkit/nav-oracles.d.ts +79 -0
  69. package/dist/plan-viz/testkit/types.d.ts +8 -0
  70. package/dist/plan-viz/types.d.ts +34 -0
  71. package/dist/{provider-setup-CPbB5y_V.js → provider-setup-LFsaTkpf.js} +9308 -5510
  72. package/dist/provider-setup-LFsaTkpf.js.map +1 -0
  73. package/dist/recall-tool.d.ts +43 -0
  74. package/dist/recovery-note.d.ts +22 -0
  75. package/dist/response-service.d.ts +11 -1
  76. package/dist/review-checker.d.ts +10 -4
  77. package/dist/reviewer-revision.d.ts +23 -0
  78. package/dist/risk-classifier.d.ts +7 -0
  79. package/dist/scripted-llm-client.d.ts +26 -1
  80. package/dist/semantic-compaction.d.ts +15 -0
  81. package/dist/semantic-hypotheses.d.ts +40 -0
  82. package/dist/source-reliability.d.ts +71 -0
  83. package/dist/task-completion-check.d.ts +24 -0
  84. package/dist/tool-control-plane.d.ts +33 -1
  85. package/dist/tool-effect-class.d.ts +9 -0
  86. package/dist/transcript-compaction.d.ts +9 -0
  87. package/dist/{tui-app-DeyZ4Pr9.js → tui-app-BLR-PRFp.js} +321 -7
  88. package/dist/tui-app-BLR-PRFp.js.map +1 -0
  89. package/dist/tui-app.d.ts +38 -0
  90. package/dist/turn-intent-classifier.d.ts +75 -16
  91. package/dist/turn-interpreter.d.ts +25 -3
  92. package/dist/version.d.ts +1 -1
  93. package/package.json +6 -6
  94. package/dist/bin-CdVTAe7j.js +0 -2209
  95. package/dist/bin-CdVTAe7j.js.map +0 -1
  96. package/dist/provider-setup-CPbB5y_V.js.map +0 -1
  97. package/dist/tui-app-DeyZ4Pr9.js.map +0 -1
package/README.md CHANGED
@@ -142,7 +142,7 @@ contradiction detection considers it:
142
142
 
143
143
  | Tier | Answers | Allowed `FactSource` | Retention | Contradiction-checked | Where it lives |
144
144
  |---|---|---|---|---|---|
145
- | **Episodic** | "What was said or mused, unconfirmed?" | any | session | no | `facts:<sessionId>` — also every `model_inferred`/`observed` `UserFact` lands here regardless of its `durable` bit; an unconfirmed model guess is never Knowledge |
145
+ | **Episodic** | "What was said or mused, unconfirmed?" | any | session | no | `facts:<sessionId>`, plus `episodic:<sessionId>` session digests when `AUDIT_EPISODIC_DIGEST` is on (see below) — also every `model_inferred`/`observed` `UserFact` lands here regardless of its `durable` bit; an unconfirmed model guess is never Knowledge |
146
146
  | **Semantic** | "What's currently stated as true?" | `user_asserted`, `externally_verified` | durable (by tier policy) | yes | `facts:<sessionId>` or `facts:durable`, depending on the existing promotion policy (`durable` bit) — the tier a fact belongs to and whether it's actually promoted are tracked separately today |
147
147
  | **Identity** | "Who is this?" (name, "call me X") | `user_asserted` | durable | yes | `facts:durable` |
148
148
  | **Preference** | "What does the user want?" (stated preference) | `user_asserted` | durable | yes | `facts:durable`; a *configured* preference (backend, model, `enableShell`) is separately `AssistantConfig` (`config.ts`), not a `UserFact` at all |
@@ -158,6 +158,40 @@ the other half is that `isKnowledgeTier()` only returns true for `semantic`,
158
158
  `identity`, and `preference` — episodic entries, procedural weights, and
159
159
  commitments never enter contradiction detection as if they were beliefs.
160
160
 
161
+ **Episodic memory now has a store and a writer, behind a flag.** With
162
+ `AUDIT_EPISODIC_DIGEST` on (off by default; the cross-session scenario improved on 2 of 2 seeds, one scenario only), the assistant
163
+ writes one short handoff digest per session (objective, what was done,
164
+ decisions, open items, next step) at the session edge (`/new`, exit), never
165
+ inside a turn, to `episodic:<sessionId>`. A second use of the same writer runs
166
+ just before transcript compaction drops old messages, so facts in those
167
+ messages are queued for confirmation instead of being lost. Digests are kept
168
+ apart from durable facts and are never injected into the prompt: they reach the
169
+ model only through the read-only `recall_memory` tool (`AUDIT_RECALL_TOOL`, off
170
+ by default), which returns an index of recent digests and then one digest by id,
171
+ wrapped as untrusted context. The model picks which digest to open; there is no
172
+ keyword search. Digest text passes the same secret judgement as any other
173
+ memory write, and a digest can never populate a Knowledge tier (the extended
174
+ INV-16: a non-user origin is episodic only). Digests are kept for a retention
175
+ window (default 90 days, `AUDIT_EPISODIC_RETENTION_DAYS`) and are covered by
176
+ `/memory forget` and `/memory export`. This changes what `/new` keeps: durable
177
+ facts as before, plus digests when the flag is on. Evidence is one scenario and two seeds; it also adds one model call per session edge.
178
+
179
+ Related write-path controls: `AUDIT_MEMORY_BUDGETED_RENDER` is **on by default**
180
+ (character-budgeted, priority-ordered facts block with keyed supersession, so a
181
+ corrected fact replaces the old one; `=0` restores the old 20-fact slice; budget
182
+ `memoryBudgetChars`, default 4000). In a six-week corrections scenario it fixed a
183
+ stale-fact failure on 3 of 3 seeds. Off by default: `AUDIT_MEMORY_WRITE_GATE`
184
+ (semantic secret redaction and instruction-shaped-text flagging before a fact is
185
+ promoted; a missing judgement means the fact is not promoted; no outcome
186
+ difference was seen because the base model already resisted the planted secret),
187
+ `AUDIT_MEMORY_AUDIT_LOG` (`/memory history`, `/memory undo <seq>`),
188
+ `AUDIT_MEMORY_REVIEWER` (post-turn reviewer; its writes are staged for
189
+ `/memory confirm` unless `memoryWriteMode` is `auto`) and
190
+ `AUDIT_MEMORY_CONSOLIDATION` (staged merge and archive proposals; not measured as
191
+ an outcome). Known gaps: the model sometimes keys the same attribute two ways, so
192
+ a correction can miss the old fact, and a natural-language "forget that" request
193
+ is staged for approval rather than applied.
194
+
161
195
  The conversation transcript itself (`transcript:<sessionId>`, "what was
162
196
  said" verbatim) and a single turn's `AnswerClaim` (evidence vs. claim for one
163
197
  reply, see below) sit outside this tier system — they're the raw material a
@@ -448,6 +482,9 @@ without ever exposing the filesystem or shell.
448
482
 
449
483
  ## Batch research budget
450
484
 
485
+ > The list detector below is a lexical check (the `batch-list` family), **off by default**: set
486
+ > `ASSISTANT_LEXICAL_ON=batch-list` (or `ASSISTANT_LEXICAL_MODE=enabled`) to use batch research.
487
+
451
488
  The flat `maxSteps` cap that governs an ordinary chat turn (see below) doesn't
452
489
  know the difference between a one-question turn and a turn asking for the same
453
490
  lookup across many items — a 7-item batch and a 1-item question get the same
@@ -705,17 +742,7 @@ non-functional `web_search`. The active state is shown in the startup banner
705
742
  running session with `/config set` instead of an env var — see
706
743
  "Configuration" below.
707
744
 
708
- Set `ASSISTANT_LLM_BACKEND=claude-cli` to skip the proxy entirely and run turns
709
- through a local `claude -p` subprocess instead, using your already-authenticated
710
- Claude Code CLI session rather than an API key (`CLAUDE_PATH` overrides the
711
- `claude` binary path if it's not on `PATH`):
712
-
713
- ```bash
714
- ASSISTANT_LLM_BACKEND=claude-cli npm run cli --workspace=packages/aielia
715
- ```
716
-
717
- Or skip both the proxy and claude-cli and call a provider directly with your
718
- own API key — `ASSISTANT_LLM_BACKEND=anthropic|openai|openrouter` plus
745
+ Skip the proxy and call a provider directly with your own API key — `ASSISTANT_LLM_BACKEND=anthropic|openai|openrouter` plus
719
746
  `ASSISTANT_API_KEY`:
720
747
 
721
748
  ```bash
@@ -803,6 +830,27 @@ package's persistence, it's a real file, not encrypted, so `authToken` and
803
830
  `braveApiKey` are stored in plaintext there. This is the same trust boundary
804
831
  the repo's root `.env` already has, not a new one.
805
832
 
833
+ ### Lexical checks (off by default)
834
+
835
+ Every lexical pass in this package (regex / keyword / phrase-list checks over natural-language text) sits
836
+ behind one switch, `lexicalMode`, and **every one is off by default** in the CLI, the browser tab and the
837
+ desktop app — the LLM-based checks do the work instead. The ten families (`fact-markers`, `coding-fact`,
838
+ `injection`, `enumeration`, `risk`, `task-cancel`, `plan-mode`, `batch-list`, `tool-yield`,
839
+ `template-keywords`) and what "off" means for each are listed in `src/lexical/lexical-mode.ts`.
840
+
841
+ - `ASSISTANT_LEXICAL_MODE=enabled` turns every family back on (the pre-2026-09-28 behaviour).
842
+ - `ASSISTANT_LEXICAL_ON=batch-list,task-cancel` turns only those families back on (`all` for every one).
843
+ - `ASSISTANT_LEXICAL_OFF=<families>` turns families off even under `enabled`; it wins over ON.
844
+
845
+ The mode is handed to `@buildaharness/harness`'s own lexical switch at the start of every run, so
846
+ `enabled` turns the harness's checks back on too (see that package's README).
847
+
848
+ Some families have no LLM replacement, so with them off the feature they drive does not run: batch
849
+ research (`batch-list`), matching "skip that step" to one step of an active plan (`task-cancel`), leaving
850
+ plan drafting by phrase (`plan-mode`; `/plan` still works), and the batch sub-loop's lexical dead-end
851
+ detection (`tool-yield`; the web tool's own "No results found." still counts). With `risk` off, a durable
852
+ plan step saved without its own risk level is treated as HIGH.
853
+
806
854
  ## REPL commands
807
855
 
808
856
  Type `/help` inside a running CLI session for this list. All of them read or
@@ -820,10 +868,11 @@ change local session/config state — none of them make an LLM call themselves.
820
868
  | `/search <query>` | Ranked search over past messages, across every session in this install — a hit is the one message that matched, not the whole session transcript around it. Read-only: never an LLM call or network request. Scoring is tokenized/graduated, not exact-substring-only (see "Conversation history" above), and a query matching nothing returns an explicit "no results" line |
821
869
  | `/model [name]` | Show the active model, or switch it — a thin alias over `/config set model <name>` (see "Configuration" above); rejected the same way if `model` is pinned by `ASSISTANT_MODEL` |
822
870
  | `/cost` | Show token usage for the last turn and the running session total |
823
- | `/doctor` | Check proxy reachability (proxy backend) or the `claude` binary (claude-cli backend), plus workspace root and data dir health — no dedicated check yet for the anthropic/openai/openrouter backends, only the backend-agnostic checks run for those |
871
+ | `/doctor` | Check proxy reachability (proxy backend), plus workspace root and data dir health — no dedicated check yet for the anthropic/openai/openrouter backends, only the backend-agnostic checks run for those |
824
872
  | `/why` | Explain the harness path the last turn took (verification confidence + node sequence) |
825
873
  | `/sources` | List files/URLs the last turn actually consulted |
826
874
  | `/plan` | Show the active structured plan's task status |
875
+ | `/plan graph [thread-id]` | Draw the active plan as a read-only dependency graph (needs `planGraphMode` enabled; full-screen pane in the terminal UI with arrows/Tab/Enter/q, one static render in the plain REPL). Glyphs, mapping and keys: `docs/plan-visualization.md` |
827
876
  | `/checkpoint [clear]` | Inspect a stuck in-progress harness checkpoint (step, node, failed-resume count so far), or `/checkpoint clear` to discard it — see "Recovering a stuck checkpoint" above. Scoped to just the checkpoint: unlike `/clear`, transcript/facts/plan are untouched |
828
877
 
829
878
  ### `/cost` and real vs. estimated dollar figures
@@ -831,13 +880,7 @@ change local session/config state — none of them make an LLM call themselves.
831
880
  Token counts are always real, on every backend. The dollar figure attached to
832
881
  them is not always the same kind of number:
833
882
 
834
- - **claude-cli backend**: `costUsd` comes straight from `claude
835
- --output-format json`'s own `total_cost_usd` field — real Anthropic
836
- accounting. It may read `$0` if the underlying `claude` session is
837
- authenticated against a Pro/Max subscription rather than API billing, in
838
- which case `$0` does *not* mean "this turn was free" — `/cost`'s output
839
- says so explicitly.
840
- - **every other backend** (`proxy`, `anthropic`, `openai`, `openrouter`):
883
+ - **every backend** (`proxy`, `anthropic`, `openai`, `openrouter`):
841
884
  none of these compute a dollar cost themselves — only the raw token counts
842
885
  each provider's response already includes (`@buildaharness/proxy` is a thin
843
886
  pass-through, see `packages/proxy/src/forward.ts`; the three direct clients
@@ -0,0 +1,19 @@
1
+ import { VizNode } from './plan-viz/types.js';
2
+ /** Width at which the detail drawer docks to the right instead of being toggled. */
3
+ export declare const DRAWER_DOCK_COLUMNS = 120;
4
+ export interface PlanGraphPaneProps {
5
+ nodes: readonly VizNode[];
6
+ columns: number;
7
+ rows: number;
8
+ /** False while an approval prompt owns the keyboard: the pane stays drawn but ignores keys. */
9
+ active?: boolean;
10
+ color?: boolean;
11
+ ascii?: boolean;
12
+ onClose: () => void;
13
+ }
14
+ /**
15
+ * Read-only plan graph pane (plans/plan_visualization_plan.html, R2). Keys: arrows (or [ ]) move along edges and ranks, j/k and PgUp/PgDn scroll the detail drawer,
16
+ * Tab/Shift+Tab walk task order, Enter or d toggles the detail drawer below 120 columns, q or Esc closes.
17
+ * No key edits anything: the plan changes only through the approval gate.
18
+ */
19
+ export declare function PlanGraphPane({ nodes, columns, rows, active, color, ascii, onClose }: PlanGraphPaneProps): React.JSX.Element;