@buildaharness/aielia 0.3.5 → 0.3.7

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 (47) hide show
  1. package/README.md +97 -19
  2. package/dist/action-approval-service.d.ts +34 -2
  3. package/dist/action-record.d.ts +13 -0
  4. package/dist/activity-log.d.ts +4 -0
  5. package/dist/agent-loop.d.ts +83 -1
  6. package/dist/assistant-session.d.ts +20 -1
  7. package/dist/assistant-types.d.ts +3 -1
  8. package/dist/assistant.d.ts +32 -0
  9. package/dist/{bin-CjKpxDxl.js → bin-C_hgDdSf.js} +369 -219
  10. package/dist/bin-C_hgDdSf.js.map +1 -0
  11. package/dist/cli-config.d.ts +3 -0
  12. package/dist/cli-session.d.ts +5 -4
  13. package/dist/cli.d.ts +9 -0
  14. package/dist/cli.js +1 -1
  15. package/dist/config.d.ts +3 -1
  16. package/dist/debug-log.d.ts +10 -1
  17. package/dist/email.d.ts +5 -3
  18. package/dist/file-tools-mcp-server.mjs +155 -30
  19. package/dist/file-tools.d.ts +2 -0
  20. package/dist/git-exclude.d.ts +9 -0
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +127 -126
  23. package/dist/ink-select-prompt.d.ts +2 -0
  24. package/dist/ink-test-render.d.ts +2 -0
  25. package/dist/memory-service.d.ts +8 -0
  26. package/dist/next-step-proposer.d.ts +7 -0
  27. package/dist/plan-drafting-service.d.ts +3 -0
  28. package/dist/plan-store.d.ts +5 -0
  29. package/dist/{provider-setup-LFsaTkpf.js → provider-setup-wX2IBw2X.js} +2183 -919
  30. package/dist/provider-setup-wX2IBw2X.js.map +1 -0
  31. package/dist/reply-audit.d.ts +67 -0
  32. package/dist/side-call-policy.d.ts +30 -0
  33. package/dist/tool-step.d.ts +6 -0
  34. package/dist/trace-events.d.ts +1 -1
  35. package/dist/trust-tagging.d.ts +2 -0
  36. package/dist/{tui-app-BLR-PRFp.js → tui-app-C0J6HRzv.js} +127 -26
  37. package/dist/tui-app-C0J6HRzv.js.map +1 -0
  38. package/dist/tui-app.d.ts +35 -0
  39. package/dist/tui-mode-flag.d.ts +1 -1
  40. package/dist/turn-abort.d.ts +18 -0
  41. package/dist/turn-intent-classifier.d.ts +8 -0
  42. package/dist/turn-interpreter.d.ts +2 -0
  43. package/dist/version.d.ts +1 -1
  44. package/package.json +3 -3
  45. package/dist/bin-CjKpxDxl.js.map +0 -1
  46. package/dist/provider-setup-LFsaTkpf.js.map +0 -1
  47. package/dist/tui-app-BLR-PRFp.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { bi as parseModelJson, a0 as classifyRiskLexical } from "./provider-setup-LFsaTkpf.js";
5
- import { A, a, b, C, c, D, e, f, g, h, i, j, k, l, m, o, F, p, I, L, q, r, s, t, u, v, w, x, M, P, y, z, B, R, G, S, H, J, W, K, N, O, Q, T, U, V, X, Y, Z, _, $, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ac, ad, ae, ag, ah, ai, aj, ak, al, am, an, ap, aq, ar, as, au, av, ax, ay, aA, aB, aD, aE, aH, aJ, aK, aL, aM, aO, aP, aQ, aR, aS, aT, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bg, bj, bk, bl, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bF, bG, bI, bJ, bK, bL, bM, bN, bO, bP } from "./provider-setup-LFsaTkpf.js";
4
+ import { bk as parseModelJson, a1 as classifyRiskLexical } from "./provider-setup-wX2IBw2X.js";
5
+ import { A, a, b, C, c, D, e, f, g, h, i, j, k, l, m, p, F, q, I, L, r, s, t, u, v, w, x, y, M, P, z, B, G, R, H, S, J, K, W, N, O, Q, T, U, V, X, Y, Z, _, $, a0, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ad, ae, af, ah, ai, aj, ak, al, am, an, ap, ar, as, at, au, aw, ax, az, aA, aC, aD, aF, aG, aJ, aL, aM, aN, aO, aQ, aR, aS, aT, aU, aV, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bi, bl, bm, bn, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bI, bJ, bL, bN, bO, bP, bQ, bR, bS, bT, bU } from "./provider-setup-wX2IBw2X.js";
6
6
  import { DEFAULT_LAYER_POLICY_MODE, MAX_OPTIONS_PER_QUESTION, MAX_QUESTIONS_PER_BATCH, MIN_OPTIONS_PER_QUESTION, validateAskResponse } from "@buildaharness/harness";
7
7
  const PLAN_SCHEMA = {
8
8
  type: "object",
@@ -156,143 +156,144 @@ export {
156
156
  k as DEFAULT_ONE_LOOP_MODE,
157
157
  l as DEFAULT_PLAN_GRAPH_MODE,
158
158
  m as DEFAULT_PLAN_MODE,
159
- o as EmailDeliveryError,
159
+ p as EmailDeliveryError,
160
160
  F as FETCH_URL_TOOL,
161
- p as FILE_TOOLS,
161
+ q as FILE_TOOLS,
162
162
  I as InvalidEmailArgsError,
163
163
  L as LAYER_DISPLAY_NAME,
164
- q as LAYER_ORDER,
165
- r as LAYER_SETTINGS,
166
- s as LAYER_SHORT_CODE,
167
- t as LEXICAL_CHECK_FAMILIES,
168
- u as LEXICAL_FAMILIES,
169
- v as LIST_DIRECTORY_TOOL,
170
- w as LayerSettingError,
171
- x as LiveSteeringChannel,
164
+ r as LAYER_ORDER,
165
+ s as LAYER_SETTINGS,
166
+ t as LAYER_SHORT_CODE,
167
+ u as LEXICAL_CHECK_FAMILIES,
168
+ v as LEXICAL_FAMILIES,
169
+ w as LIST_DIRECTORY_TOOL,
170
+ x as LayerSettingError,
171
+ y as LiveSteeringChannel,
172
172
  MAX_OPTIONS_PER_QUESTION,
173
173
  MAX_QUESTIONS_PER_BATCH,
174
174
  M as MEMORY_WRITE_MODES,
175
175
  MIN_OPTIONS_PER_QUESTION,
176
176
  P as PROVIDER_SETUP,
177
- y as PathOutsideWorkspaceError,
178
- z as PersonalAssistant,
179
- B as PrivateNetworkTargetError,
177
+ z as PathOutsideWorkspaceError,
178
+ B as PersonalAssistant,
179
+ G as PrivateNetworkTargetError,
180
180
  R as READ_FILE_TOOL,
181
- G as RUN_SHELL_COMMAND_TOOL,
181
+ H as RUN_SHELL_COMMAND_TOOL,
182
182
  S as SEMANTIC_ESCALATIONS,
183
- H as SEND_EMAIL_TOOL,
184
- J as SHELL_TOOLS,
183
+ J as SEND_EMAIL_TOOL,
184
+ K as SHELL_TOOLS,
185
185
  W as WEB_SEARCH_TOOL,
186
- K as WEB_TOOLS,
187
- N as WRITE_FILE_TOOL,
188
- O as abandonPlan,
189
- Q as applyLayerSettings,
190
- T as applyPendingAction,
191
- U as assertPublicHttpUrl,
192
- V as braveSearch,
193
- X as buildClaudePrompt,
186
+ N as WEB_TOOLS,
187
+ O as WRITE_FILE_TOOL,
188
+ Q as abandonPlan,
189
+ T as applyLayerSettings,
190
+ U as applyPendingAction,
191
+ V as assertPublicHttpUrl,
192
+ X as braveSearch,
193
+ Y as buildClaudePrompt,
194
194
  buildPlanFromTemplate,
195
- Y as buildWhyChain,
196
- Z as checkApiKeyFormat,
197
- _ as classifyError,
198
- $ as classifyRisk,
199
- a1 as classifyToolYield,
200
- a2 as classifyTurnIntent,
201
- a3 as cleanApiKey,
202
- a4 as computePlanPosition,
203
- a5 as createPlanRecord,
204
- a6 as createResendSender,
195
+ Z as buildWhyChain,
196
+ _ as checkApiKeyFormat,
197
+ $ as classifyError,
198
+ a0 as classifyRisk,
199
+ a2 as classifyToolYield,
200
+ a3 as classifyTurnIntent,
201
+ a4 as cleanApiKey,
202
+ a5 as computePlanPosition,
203
+ a6 as createPlanRecord,
204
+ a7 as createResendSender,
205
205
  createScriptedLLMClient,
206
- a7 as createSmtpSender,
207
- a8 as decisionNote,
208
- a9 as decompositionReframeEnabled,
209
- aa as defaultExportFilename,
210
- ac as detectHomogeneousBatchList,
211
- ad as discardPendingAction,
212
- ae as effectiveState,
213
- ag as escalationEnabled,
214
- ah as estimateCostUsd,
215
- ai as executeActionTool,
216
- aj as executeFileTool,
217
- ak as executeShellTool,
218
- al as executeWebTool,
219
- am as explicitEnvOverride,
220
- an as findLayer,
221
- ap as formatCostSummary,
222
- aq as formatDoctorReport,
223
- ar as formatEmailApprovalReason,
224
- as as formatGoalGraphState,
225
- au as formatLayerListing,
226
- av as formatMemoryArchive,
227
- ax as formatMemoryHistory,
228
- ay as formatMemoryInjection,
229
- aA as formatMemoryStatus,
230
- aB as formatMemorySummary,
231
- aD as formatPlanProgress,
232
- aE as formatSearchResults,
233
- aH as formatTranscriptMarkdown,
234
- aJ as getProviderSetup,
235
- aK as harnessGatePolicy,
236
- aL as injectionDetectionEnabled,
237
- aM as isAdaptivePolicyEnabled,
238
- aO as isGoalGraphEnabled,
239
- aP as isGoalGraphSuggestEnabled,
240
- aQ as isLayerPolicyMode,
241
- aR as isLikelyEmailAddress,
242
- aS as isPlanGraphEnabled,
243
- aT as isPolicyRecordingEnabled,
244
- aV as isToggleable,
245
- aW as lexicalActive,
246
- aX as lexicalOffEnvValue,
247
- aY as listTemplateNames,
248
- aZ as loadActivePlan,
249
- a_ as loadPendingAction,
250
- a$ as loadTemplate,
251
- b0 as lowerConfidenceSourceLines,
252
- b1 as matchTemplateIfConfident,
253
- b3 as memoryStatusChecks,
254
- b4 as nextPendingTask,
255
- b5 as nodeDisplayName,
256
- b6 as nodeToLayer,
257
- b7 as normalizeAmbiguityGuardMode,
258
- b8 as normalizeAskMode,
259
- b9 as normalizeGoalGraphMode,
260
- ba as normalizeGoalGraphSuggestMode,
261
- bb as normalizeLayerPolicyMode,
262
- bc as normalizeOneLoopMode,
263
- bd as normalizePlanGraphMode,
264
- be as normalizePlanMode,
265
- bg as parseClaudeCliOutput,
266
- bj as pickTemplateForTask,
267
- bk as planCompletionPct,
268
- bl as planToSnapshot,
269
- bn as resolveAmbiguityGuardMode,
270
- bo as resolveAskMode,
271
- bp as resolveConfig,
272
- bq as resolveEscalationPlan,
273
- br as resolveGoalGraphMode,
274
- bs as resolveGoalGraphSuggestMode,
275
- bt as resolveInWorkspace,
276
- bu as resolveLayerPolicyMode,
277
- bv as resolveLayerPolicyModeFromConfig,
278
- bw as resolveLexicalMode,
279
- bx as resolveLexicalOff,
280
- by as resolveMemoryWriteMode,
281
- bz as resolveOneLoopMode,
282
- bA as resolvePlanGraphMode,
283
- bB as resolvePlanMode,
284
- bC as sanitizeLayerChoices,
285
- bD as savePlan,
286
- bF as stagePendingAction,
287
- bG as stagedActionInput,
288
- bI as stripMcpToolPrefix,
289
- bJ as summarizeToolStep,
290
- bK as syncHarnessLexicalEnv,
291
- bL as testApiKey,
292
- bM as turnPolicyBudget,
293
- bN as updatePlanFromRun,
206
+ a8 as createSmtpSender,
207
+ a9 as decisionNote,
208
+ aa as decompositionReframeEnabled,
209
+ ab as defaultExportFilename,
210
+ ad as detectHomogeneousBatchList,
211
+ ae as discardPendingAction,
212
+ af as effectiveState,
213
+ ah as escalationEnabled,
214
+ ai as estimateCostUsd,
215
+ aj as executeActionTool,
216
+ ak as executeFileTool,
217
+ al as executeShellTool,
218
+ am as executeWebTool,
219
+ an as explicitEnvOverride,
220
+ ap as findLayer,
221
+ ar as formatCostSummary,
222
+ as as formatDoctorReport,
223
+ at as formatEmailApprovalReason,
224
+ au as formatGoalGraphState,
225
+ aw as formatLayerListing,
226
+ ax as formatMemoryArchive,
227
+ az as formatMemoryHistory,
228
+ aA as formatMemoryInjection,
229
+ aC as formatMemoryStatus,
230
+ aD as formatMemorySummary,
231
+ aF as formatPlanProgress,
232
+ aG as formatSearchResults,
233
+ aJ as formatTranscriptMarkdown,
234
+ aL as getProviderSetup,
235
+ aM as harnessGatePolicy,
236
+ aN as injectionDetectionEnabled,
237
+ aO as isAdaptivePolicyEnabled,
238
+ aQ as isGoalGraphEnabled,
239
+ aR as isGoalGraphSuggestEnabled,
240
+ aS as isLayerPolicyMode,
241
+ aT as isLikelyEmailAddress,
242
+ aU as isPlanGraphEnabled,
243
+ aV as isPolicyRecordingEnabled,
244
+ aX as isToggleable,
245
+ aY as lexicalActive,
246
+ aZ as lexicalOffEnvValue,
247
+ a_ as listTemplateNames,
248
+ a$ as loadActivePlan,
249
+ b0 as loadPendingAction,
250
+ b1 as loadTemplate,
251
+ b2 as lowerConfidenceSourceLines,
252
+ b3 as matchTemplateIfConfident,
253
+ b5 as memoryStatusChecks,
254
+ b6 as nextPendingTask,
255
+ b7 as nodeDisplayName,
256
+ b8 as nodeToLayer,
257
+ b9 as normalizeAmbiguityGuardMode,
258
+ ba as normalizeAskMode,
259
+ bb as normalizeGoalGraphMode,
260
+ bc as normalizeGoalGraphSuggestMode,
261
+ bd as normalizeLayerPolicyMode,
262
+ be as normalizeOneLoopMode,
263
+ bf as normalizePlanGraphMode,
264
+ bg as normalizePlanMode,
265
+ bi as parseClaudeCliOutput,
266
+ bl as pickTemplateForTask,
267
+ bm as planCompletionPct,
268
+ bn as planToSnapshot,
269
+ bq as resolveAmbiguityGuardMode,
270
+ br as resolveAskMode,
271
+ bs as resolveConfig,
272
+ bt as resolveEscalationPlan,
273
+ bu as resolveGoalGraphMode,
274
+ bv as resolveGoalGraphSuggestMode,
275
+ bw as resolveInWorkspace,
276
+ bx as resolveLayerPolicyMode,
277
+ by as resolveLayerPolicyModeFromConfig,
278
+ bz as resolveLexicalMode,
279
+ bA as resolveLexicalOff,
280
+ bB as resolveMemoryWriteMode,
281
+ bC as resolveOneLoopMode,
282
+ bD as resolvePlanGraphMode,
283
+ bE as resolvePlanMode,
284
+ bF as sanitizeLayerChoices,
285
+ bG as savePlan,
286
+ bI as stagePendingAction,
287
+ bJ as stagedActionInput,
288
+ bL as stripMcpToolPrefix,
289
+ bN as summarizeSettledToolStep,
290
+ bO as summarizeToolStep,
291
+ bP as syncHarnessLexicalEnv,
292
+ bQ as testApiKey,
293
+ bR as turnPolicyBudget,
294
+ bS as updatePlanFromRun,
294
295
  validateAskResponse,
295
- bO as validateConfig,
296
- bP as withLayerChoice
296
+ bT as validateConfig,
297
+ bU as withLayerChoice
297
298
  };
298
299
  //# sourceMappingURL=index.js.map
@@ -7,6 +7,8 @@ export interface SelectPromptProps {
7
7
  /** Called once, with the chosen option's `key` — either Enter on the highlighted row, or a direct keystroke matching an option's `key`. */
8
8
  onSubmit: (key: string) => void;
9
9
  isActive?: boolean;
10
+ /** Keys arriving within this many ms of the prompt appearing are ignored: a key typed ahead for the previous turn (an Enter, a 'y') must not answer a question the user has not seen yet. Default 0 (no guard). */
11
+ armDelayMs?: number;
10
12
  }
11
13
  /**
12
14
  * Phase 7 of the internal plan: an arrow-key + numbered/shortcut-key
@@ -17,6 +17,8 @@ export interface TestInkInstance {
17
17
  lastFrame: () => string | undefined;
18
18
  /** See `TestStdout.fullOutput`'s doc comment — needed to assert on `<Static>` content. */
19
19
  fullOutput: () => string;
20
+ /** How many writes (frames and control sequences) the render has produced so far — constant while the UI is idle. */
21
+ writeCount: () => number;
20
22
  rerender: (tree: ReactElement) => void;
21
23
  unmount: () => void;
22
24
  }
@@ -350,7 +350,13 @@ export declare class MemoryService {
350
350
  * (memory-write-gate.test.ts) asserts this is the only call in the file that writes the durable key.
351
351
  */
352
352
  private commitDurable;
353
+ /** Tail of the in-process chain serialising the audit log's read-modify-write (concurrent appends lost entries and reused seq numbers). */
354
+ private auditChain;
355
+ /** Same for the usage flush's read-modify-write of the fact stores. */
356
+ private flushChain;
357
+ private serialized;
353
358
  private appendAudit;
359
+ private appendAuditNow;
354
360
  /** `/memory history` — newest last; the last `limit` entries. */
355
361
  getAuditLog(limit?: number): Promise<AuditEntry[]>;
356
362
  /**
@@ -487,6 +493,7 @@ export declare class MemoryService {
487
493
  restoreArchivedFact(listIndex: number, sessionId?: string): Promise<UserFact | undefined>;
488
494
  /** Writes the batched `injectedCount`/`lastInjectedAt` updates collected by budgeted renders, to whichever store(s) hold each fact. A no-op (no writes) when nothing was rendered. */
489
495
  private flushInjectionUsage;
496
+ private flushInjectionUsageNow;
490
497
  /**
491
498
  * `/memory confirm <n>` — promotes the nth (1-based in `/memory`'s display, 0-based here) entry
492
499
  * in PENDING_CONFIRMATION_KEY to DURABLE_FACTS_KEY. Runs the same promotion-time check as
@@ -535,6 +542,7 @@ export declare class MemoryService {
535
542
  forgetArchived(index: number): Promise<UserFact | undefined>;
536
543
  /** Strips one fact's pre/post-images from the audit log (entries stay, marked `erased`, and can no longer be undone) and unlinks `supersedes` references to it. */
537
544
  private eraseFromAuditLog;
545
+ private eraseFromAuditLogNow;
538
546
  /** Read-only health snapshot (`/doctor`, memory panel). Never touches usage counters or the last-injection record. */
539
547
  getMemoryStatus(sessionId: string): Promise<MemoryStatus>;
540
548
  /** M3 (D4): `/memory forget digest <id>` or, with no id, every digest. Returns how many were removed. */
@@ -27,6 +27,13 @@ export interface SuggestedNextStepNode {
27
27
  promotion: SuggestionPromotion;
28
28
  createdAt: string;
29
29
  }
30
+ /**
31
+ * Names the language the suggestions must be written in. The model drifted into Chinese, Spanish or French
32
+ * on English conversations when it was only told to "match the user's language", so English is named
33
+ * outright when the user's own text clearly is English (two distinct common English words); anything else
34
+ * keeps the generic instruction.
35
+ */
36
+ export declare function suggestionLanguage(userTexts: string[]): string;
30
37
  /** Q10's three-way policy shape, applied to this mechanism's own confidence rubric — see this module's doc comment on why the bands aren't reused from `shouldAutoPromote()`. */
31
38
  export declare function classifySuggestionPromotion(confidence: SuggestionConfidence): SuggestionPromotion;
32
39
  /**
@@ -68,6 +68,9 @@ export declare class PlanDraftingService {
68
68
  private readonly memory?;
69
69
  constructor(planService: PlanService, session: AssistantSession, llmClient: ILLMClient, model: () => string | undefined, planApproval: PlanApprovalService, onTrace: ((event: TraceEvent) => void) | undefined, agentLoop?: Pick<AgentLoop, "runSupervisorInvestigation"> | undefined, memory?: MemoryAdapter | undefined);
70
70
  private planAskPendingKey;
71
+ /** Points at the one nested question a session's draft currently has staged, so cancelling the draft (or staging a newer question) can drop it. */
72
+ private planAskSessionKey;
73
+ private dropStagedAsk;
71
74
  /** Peeked by `assistant.ts`'s runTurn before it decides whether a `pendingClarificationId` belongs to this nested-ask side channel (P8) or AskClarificationService's harness-resume path (Q2) — the two staging stores are otherwise independent, so an opaque ID has no other way to say which one it came from. */
72
75
  isPendingAsk(id: string): Promise<boolean>;
73
76
  /**
@@ -102,6 +102,11 @@ export interface PlanFsPersistence {
102
102
  backend: FsBackend;
103
103
  workspaceRoot: string;
104
104
  }
105
+ /**
106
+ * Removes the session's mirrored plan files. `loadPlanRecord` prefers the file over the memory record,
107
+ * so deleting only the memory record (`/new`) let the old plan come straight back. Never throws.
108
+ */
109
+ export declare function deletePlanFiles(fsPersistence: PlanFsPersistence, sessionId: string): Promise<void>;
105
110
  /**
106
111
  * Reads `sessionId`'s stored plan record regardless of `mode` — unlike `loadActivePlan`, which
107
112
  * filters to `mode === 'active'` only. Plan mode's P1 drafting path needs to resume a