@buildaharness/aielia 0.3.4 → 0.3.6
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/README.md +156 -35
- package/dist/PlanGraphPane.d.ts +19 -0
- package/dist/_memory-core-generated.d.ts +1764 -0
- package/dist/action-approval-service.d.ts +34 -2
- package/dist/action-record.d.ts +13 -0
- package/dist/activity-log.d.ts +4 -0
- package/dist/agent-loop.d.ts +106 -9
- package/dist/ambiguity-guard-flag.d.ts +12 -0
- package/dist/ambiguity-guard.d.ts +20 -0
- package/dist/answer-claim.d.ts +13 -1
- package/dist/ask-clarification-service.d.ts +12 -1
- package/dist/ask-response-format.d.ts +6 -0
- package/dist/assistant-session.d.ts +32 -2
- package/dist/assistant-source.d.ts +7 -0
- package/dist/assistant-types.d.ts +20 -2
- package/dist/assistant.d.ts +160 -6
- package/dist/benchmark-injected-failure.d.ts +6 -0
- package/dist/bin-BYRl4xXM.js +4985 -0
- package/dist/bin-BYRl4xXM.js.map +1 -0
- package/dist/cli-config.d.ts +3 -0
- package/dist/cli-session.d.ts +19 -5
- package/dist/cli.d.ts +26 -2
- package/dist/cli.js +1 -1
- package/dist/code-plan-templates.d.ts +21 -0
- package/dist/config.d.ts +31 -0
- package/dist/constraint-check.d.ts +35 -0
- package/dist/contradiction-checker.d.ts +7 -0
- package/dist/debug-log.d.ts +10 -1
- package/dist/decomposed-answer.d.ts +13 -0
- package/dist/decomposition-classifier.d.ts +2 -0
- package/dist/doctor-checks.d.ts +3 -0
- package/dist/email.d.ts +5 -3
- package/dist/episodic-digest.d.ts +89 -0
- package/dist/fact-extraction.d.ts +39 -0
- package/dist/file-tools-mcp-server.mjs +288 -37
- package/dist/file-tools.d.ts +6 -0
- package/dist/first-run.d.ts +0 -2
- package/dist/git-exclude.d.ts +9 -0
- package/dist/goal-graph-store.d.ts +18 -18
- package/dist/grounding-check.d.ts +33 -0
- package/dist/harness-bridge.d.ts +75 -2
- package/dist/harness-token-budget.d.ts +9 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +166 -94
- package/dist/index.js.map +1 -1
- package/dist/ink-select-prompt.d.ts +2 -0
- package/dist/ink-test-render.d.ts +2 -0
- package/dist/layer-policy-flag.d.ts +13 -0
- package/dist/layer-policy-wiring.d.ts +77 -0
- package/dist/layer-settings.d.ts +49 -0
- package/dist/layer-telemetry.d.ts +2 -0
- package/dist/lexical/lexical-mode.d.ts +29 -0
- package/dist/memory-consolidation.d.ts +80 -0
- package/dist/memory-governance.d.ts +30 -0
- package/dist/memory-reviewer.d.ts +114 -0
- package/dist/memory-service.d.ts +356 -9
- package/dist/model-json.d.ts +17 -0
- package/dist/next-step-context.d.ts +51 -0
- package/dist/next-step-proposer.d.ts +10 -2
- package/dist/plan-drafting-service.d.ts +3 -0
- package/dist/plan-graph-flag.d.ts +20 -0
- package/dist/plan-question.d.ts +60 -0
- package/dist/plan-service.d.ts +6 -2
- package/dist/plan-step-prompt.d.ts +15 -0
- package/dist/plan-store.d.ts +12 -1
- package/dist/plan-viz/normalize.d.ts +14 -0
- package/dist/plan-viz/plan-detail-lines.d.ts +3 -0
- package/dist/plan-viz/plan-layout.d.ts +48 -0
- package/dist/plan-viz/plan-nav.d.ts +29 -0
- package/dist/plan-viz/plan-raster.d.ts +36 -0
- package/dist/plan-viz/plan-routes.d.ts +6 -0
- package/dist/plan-viz/plan-snapshot.d.ts +73 -0
- package/dist/plan-viz/plan-viewport.d.ts +29 -0
- package/dist/plan-viz/plan-width.d.ts +15 -0
- package/dist/plan-viz/testkit/display-width.d.ts +12 -0
- package/dist/plan-viz/testkit/generators.d.ts +61 -0
- package/dist/plan-viz/testkit/grid-oracles.d.ts +38 -0
- package/dist/plan-viz/testkit/nav-oracles.d.ts +79 -0
- package/dist/plan-viz/testkit/types.d.ts +8 -0
- package/dist/plan-viz/types.d.ts +34 -0
- package/dist/{provider-setup-CPbB5y_V.js → provider-setup-CV3S_TAS.js} +10792 -5731
- package/dist/provider-setup-CV3S_TAS.js.map +1 -0
- package/dist/recall-tool.d.ts +43 -0
- package/dist/recovery-note.d.ts +22 -0
- package/dist/reply-audit.d.ts +67 -0
- package/dist/response-service.d.ts +11 -1
- package/dist/review-checker.d.ts +10 -4
- package/dist/reviewer-revision.d.ts +23 -0
- package/dist/risk-classifier.d.ts +7 -0
- package/dist/scripted-llm-client.d.ts +26 -1
- package/dist/semantic-compaction.d.ts +15 -0
- package/dist/semantic-hypotheses.d.ts +40 -0
- package/dist/side-call-policy.d.ts +30 -0
- package/dist/source-reliability.d.ts +71 -0
- package/dist/task-completion-check.d.ts +24 -0
- package/dist/tool-control-plane.d.ts +33 -1
- package/dist/tool-effect-class.d.ts +9 -0
- package/dist/tool-step.d.ts +6 -0
- package/dist/trace-events.d.ts +1 -1
- package/dist/transcript-compaction.d.ts +9 -0
- package/dist/trust-tagging.d.ts +2 -0
- package/dist/{tui-app-DeyZ4Pr9.js → tui-app-CJq6YaiP.js} +436 -21
- package/dist/tui-app-CJq6YaiP.js.map +1 -0
- package/dist/tui-app.d.ts +73 -0
- package/dist/turn-abort.d.ts +18 -0
- package/dist/turn-intent-classifier.d.ts +81 -14
- package/dist/turn-interpreter.d.ts +27 -3
- package/dist/version.d.ts +1 -1
- package/package.json +6 -6
- package/dist/bin-CdVTAe7j.js +0 -2209
- package/dist/bin-CdVTAe7j.js.map +0 -1
- package/dist/provider-setup-CPbB5y_V.js.map +0 -1
- package/dist/tui-app-DeyZ4Pr9.js.map +0 -1
|
@@ -53,15 +53,15 @@ export declare const ThreadSuggestionSchema: z.ZodObject<{
|
|
|
53
53
|
id: string;
|
|
54
54
|
confidence: "high" | "medium" | "low";
|
|
55
55
|
description: string;
|
|
56
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
57
56
|
createdAt: string;
|
|
57
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
58
58
|
}, {
|
|
59
59
|
rationale: string;
|
|
60
60
|
id: string;
|
|
61
61
|
confidence: "high" | "medium" | "low";
|
|
62
62
|
description: string;
|
|
63
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
64
63
|
createdAt: string;
|
|
64
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
65
65
|
}>;
|
|
66
66
|
export type ThreadSuggestion = z.infer<typeof ThreadSuggestionSchema>;
|
|
67
67
|
/**
|
|
@@ -121,15 +121,15 @@ export declare const GoalThreadSchema: z.ZodObject<{
|
|
|
121
121
|
id: string;
|
|
122
122
|
confidence: "high" | "medium" | "low";
|
|
123
123
|
description: string;
|
|
124
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
125
124
|
createdAt: string;
|
|
125
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
126
126
|
}, {
|
|
127
127
|
rationale: string;
|
|
128
128
|
id: string;
|
|
129
129
|
confidence: "high" | "medium" | "low";
|
|
130
130
|
description: string;
|
|
131
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
132
131
|
createdAt: string;
|
|
132
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
133
133
|
}>, "many">>;
|
|
134
134
|
trustApprovedSteps: z.ZodOptional<z.ZodBoolean>;
|
|
135
135
|
planApprovalId: z.ZodOptional<z.ZodString>;
|
|
@@ -148,9 +148,9 @@ export declare const GoalThreadSchema: z.ZodObject<{
|
|
|
148
148
|
cancelled?: boolean | undefined;
|
|
149
149
|
}[];
|
|
150
150
|
successCriteria: string;
|
|
151
|
-
templateName: string | null;
|
|
152
151
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
153
152
|
createdAt: string;
|
|
153
|
+
templateName: string | null;
|
|
154
154
|
executingOnPlan: boolean;
|
|
155
155
|
updatedAt: string;
|
|
156
156
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -162,8 +162,8 @@ export declare const GoalThreadSchema: z.ZodObject<{
|
|
|
162
162
|
id: string;
|
|
163
163
|
confidence: "high" | "medium" | "low";
|
|
164
164
|
description: string;
|
|
165
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
166
165
|
createdAt: string;
|
|
166
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
167
167
|
}[] | undefined;
|
|
168
168
|
trustApprovedSteps?: boolean | undefined;
|
|
169
169
|
planApprovalId?: string | undefined;
|
|
@@ -180,9 +180,9 @@ export declare const GoalThreadSchema: z.ZodObject<{
|
|
|
180
180
|
cancelled?: boolean | undefined;
|
|
181
181
|
}[];
|
|
182
182
|
successCriteria: string;
|
|
183
|
-
templateName: string | null;
|
|
184
183
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
185
184
|
createdAt: string;
|
|
185
|
+
templateName: string | null;
|
|
186
186
|
executingOnPlan: boolean;
|
|
187
187
|
updatedAt: string;
|
|
188
188
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -194,8 +194,8 @@ export declare const GoalThreadSchema: z.ZodObject<{
|
|
|
194
194
|
id: string;
|
|
195
195
|
confidence: "high" | "medium" | "low";
|
|
196
196
|
description: string;
|
|
197
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
198
197
|
createdAt: string;
|
|
198
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
199
199
|
}[] | undefined;
|
|
200
200
|
trustApprovedSteps?: boolean | undefined;
|
|
201
201
|
planApprovalId?: string | undefined;
|
|
@@ -259,15 +259,15 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
259
259
|
id: string;
|
|
260
260
|
confidence: "high" | "medium" | "low";
|
|
261
261
|
description: string;
|
|
262
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
263
262
|
createdAt: string;
|
|
263
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
264
264
|
}, {
|
|
265
265
|
rationale: string;
|
|
266
266
|
id: string;
|
|
267
267
|
confidence: "high" | "medium" | "low";
|
|
268
268
|
description: string;
|
|
269
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
270
269
|
createdAt: string;
|
|
270
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
271
271
|
}>, "many">>;
|
|
272
272
|
trustApprovedSteps: z.ZodOptional<z.ZodBoolean>;
|
|
273
273
|
planApprovalId: z.ZodOptional<z.ZodString>;
|
|
@@ -286,9 +286,9 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
286
286
|
cancelled?: boolean | undefined;
|
|
287
287
|
}[];
|
|
288
288
|
successCriteria: string;
|
|
289
|
-
templateName: string | null;
|
|
290
289
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
291
290
|
createdAt: string;
|
|
291
|
+
templateName: string | null;
|
|
292
292
|
executingOnPlan: boolean;
|
|
293
293
|
updatedAt: string;
|
|
294
294
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -300,8 +300,8 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
300
300
|
id: string;
|
|
301
301
|
confidence: "high" | "medium" | "low";
|
|
302
302
|
description: string;
|
|
303
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
304
303
|
createdAt: string;
|
|
304
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
305
305
|
}[] | undefined;
|
|
306
306
|
trustApprovedSteps?: boolean | undefined;
|
|
307
307
|
planApprovalId?: string | undefined;
|
|
@@ -318,9 +318,9 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
318
318
|
cancelled?: boolean | undefined;
|
|
319
319
|
}[];
|
|
320
320
|
successCriteria: string;
|
|
321
|
-
templateName: string | null;
|
|
322
321
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
323
322
|
createdAt: string;
|
|
323
|
+
templateName: string | null;
|
|
324
324
|
executingOnPlan: boolean;
|
|
325
325
|
updatedAt: string;
|
|
326
326
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -332,8 +332,8 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
332
332
|
id: string;
|
|
333
333
|
confidence: "high" | "medium" | "low";
|
|
334
334
|
description: string;
|
|
335
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
336
335
|
createdAt: string;
|
|
336
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
337
337
|
}[] | undefined;
|
|
338
338
|
trustApprovedSteps?: boolean | undefined;
|
|
339
339
|
planApprovalId?: string | undefined;
|
|
@@ -357,9 +357,9 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
357
357
|
cancelled?: boolean | undefined;
|
|
358
358
|
}[];
|
|
359
359
|
successCriteria: string;
|
|
360
|
-
templateName: string | null;
|
|
361
360
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
362
361
|
createdAt: string;
|
|
362
|
+
templateName: string | null;
|
|
363
363
|
executingOnPlan: boolean;
|
|
364
364
|
updatedAt: string;
|
|
365
365
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -371,8 +371,8 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
371
371
|
id: string;
|
|
372
372
|
confidence: "high" | "medium" | "low";
|
|
373
373
|
description: string;
|
|
374
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
375
374
|
createdAt: string;
|
|
375
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
376
376
|
}[] | undefined;
|
|
377
377
|
trustApprovedSteps?: boolean | undefined;
|
|
378
378
|
planApprovalId?: string | undefined;
|
|
@@ -394,9 +394,9 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
394
394
|
cancelled?: boolean | undefined;
|
|
395
395
|
}[];
|
|
396
396
|
successCriteria: string;
|
|
397
|
-
templateName: string | null;
|
|
398
397
|
mode: "active" | "done" | "drafting" | "awaiting_approval" | "abandoned";
|
|
399
398
|
createdAt: string;
|
|
399
|
+
templateName: string | null;
|
|
400
400
|
executingOnPlan: boolean;
|
|
401
401
|
updatedAt: string;
|
|
402
402
|
relationToSiblings?: "alternative" | "concurrent" | undefined;
|
|
@@ -408,8 +408,8 @@ export declare const GoalGraphRecordSchema: z.ZodObject<{
|
|
|
408
408
|
id: string;
|
|
409
409
|
confidence: "high" | "medium" | "low";
|
|
410
410
|
description: string;
|
|
411
|
-
promotion: "auto" | "pending_confirm" | "session_only";
|
|
412
411
|
createdAt: string;
|
|
412
|
+
promotion: "auto" | "pending_confirm" | "session_only";
|
|
413
413
|
}[] | undefined;
|
|
414
414
|
trustApprovedSteps?: boolean | undefined;
|
|
415
415
|
planApprovalId?: string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ILLMClient, TokenUsage } from '@buildaharness/runtime';
|
|
2
|
+
import { AssistantSource } from './assistant-source.js';
|
|
3
|
+
/**
|
|
4
|
+
* - 'grounded': every specific claim in the reply that rests on the tool results matches them.
|
|
5
|
+
* - 'ungrounded': at least one specific claim or figure conflicts with, or isn't supported by,
|
|
6
|
+
* what the tools actually returned (`discrepancy` says which).
|
|
7
|
+
* - 'not_checked': nothing was compared — no raw tool text was visible (claude-cli runs its tool
|
|
8
|
+
* loop in a subprocess), or the check errored / returned something unparseable.
|
|
9
|
+
*/
|
|
10
|
+
export type GroundingVerdict = 'grounded' | 'ungrounded' | 'not_checked';
|
|
11
|
+
export interface GroundingResult {
|
|
12
|
+
verdict: GroundingVerdict;
|
|
13
|
+
discrepancy?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `AUDIT_SEMANTIC_GROUNDING` gate. Default **ON**: an unset / empty / truthy value runs the grounding
|
|
17
|
+
* check, so `answerClaim.verification_status` can only say `verified` for a reply that was compared
|
|
18
|
+
* against the raw tool results. A falsy value (`0` / `false` / `off` / `no` / `disabled`) skips the
|
|
19
|
+
* LLM call and restores the previous, mechanical-only derivation of `verified`. Same shape as
|
|
20
|
+
* `semanticFailureMatchEnabled()`; read at exactly one site, assistant.ts's ResponseService wiring.
|
|
21
|
+
*/
|
|
22
|
+
export declare function semanticGroundingEnabled(env?: Record<string, string | undefined>): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* One bounded LLM call comparing a finished reply to the raw text its tools returned — the content
|
|
25
|
+
* check `verify()` (mechanical/environmental tiers only) has no way to make. Returns `not_checked`
|
|
26
|
+
* when there is nothing to compare or on any error, never a guessed `grounded`: a check that
|
|
27
|
+
* couldn't run must not upgrade a reply to `verified`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkReplyGrounding(input: {
|
|
30
|
+
question: string;
|
|
31
|
+
reply: string;
|
|
32
|
+
sources: readonly AssistantSource[] | undefined;
|
|
33
|
+
}, llmClient: ILLMClient, model?: string, onUsage?: (usage: TokenUsage) => void): Promise<GroundingResult>;
|
package/dist/harness-bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExperienceStore, Task, CheckpointStore, LayerActivityEvent, HarnessCheckpoint, VerificationResult, HarnessRunResult, ToolExecutorContext, InvestigationRequestData, InvestigationFinding, UpdateChannel } from '@buildaharness/harness';
|
|
1
|
+
import { ExperienceStore, Task, CheckpointStore, LayerActivityEvent, HarnessCheckpoint, VerificationResult, HarnessRunResult, ToolExecutorContext, InvestigationRequestData, InvestigationFinding, UpdateChannel, SemanticHypothesisEvent, SemanticHypothesisProposal, LayerPolicyMode } from '@buildaharness/harness';
|
|
2
2
|
import { ILLMClient, MemoryAdapter, TokenUsage } from '@buildaharness/runtime';
|
|
3
3
|
import { OneLoopMode } from './one-loop-flag.js';
|
|
4
4
|
import { UserFact } from './fact-extraction.js';
|
|
@@ -9,6 +9,7 @@ import { TurnIntentClassification } from './turn-intent-classifier.js';
|
|
|
9
9
|
import { AssistantSource } from './assistant-source.js';
|
|
10
10
|
import { AssistantProgress } from './assistant-types.js';
|
|
11
11
|
import { TraceEvent } from './trace-events.js';
|
|
12
|
+
import { EscalationPlan } from './layer-policy-wiring.js';
|
|
12
13
|
/**
|
|
13
14
|
* `AUDIT_VERIFICATION` gate — feature-value audit (Phase C5 of the internal plan). EVAL-ONLY:
|
|
14
15
|
* default **ON** (an unset / empty / truthy value keeps today's always-on verification). Only the
|
|
@@ -17,6 +18,29 @@ import { TraceEvent } from './trace-events.js';
|
|
|
17
18
|
* one call site (below); no product path sets it. Same shape as `semanticContradictionEnabled()`.
|
|
18
19
|
*/
|
|
19
20
|
export declare function verificationEnabled(env?: Record<string, string | undefined>): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* `AUDIT_EXPERIENCE_LEARNING` gate. Default **OFF**: the harness never writes its journal or updates the experience store, so
|
|
23
|
+
* `warmStart` / the recovery ladder keep reading an empty store, exactly as before. A truthy value (`1` / `true` / `on` / `yes` /
|
|
24
|
+
* `enabled`) makes HarnessBridge.run pass `experienceLearning: true` — see packages/harness/src/experience-learning.ts. It changes
|
|
25
|
+
* how a LATER run orders its recovery strategies, so it ships off until a benchmark shows it helps. Read at one site (below).
|
|
26
|
+
*/
|
|
27
|
+
export declare function experienceLearningEnabled(env?: Record<string, string | undefined>): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* `AUDIT_RETRY_FAILED_TASK` gate. Default **OFF**. On (`1`/`true`/`on`/`yes`/`enabled`) makes HarnessBridge.run pass
|
|
30
|
+
* `retryFailedTask: true`: after the recovery ladder switches strategy for a failed task, the failed task is re-queued so the
|
|
31
|
+
* new strategy actually gets an attempt (HarnessRunOptions.retryFailedTask). Off, a failed single task — or a multi-task turn
|
|
32
|
+
* whose tasks fail together — ends with nothing to run and the turn answers "could not complete". Read fresh each run.
|
|
33
|
+
*/
|
|
34
|
+
export declare function retryFailedTaskEnabled(env?: Record<string, string | undefined>): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* `AUDIT_RETRY_SYSTEM_ERRORS` gate. Default **ON** (`0`/`false`/`off`/`no`/`disabled` restores the old behaviour). Makes
|
|
37
|
+
* HarnessBridge.run pass `retryFailedSystemErrors: true`: after the recovery ladder switches strategy for a task whose failure
|
|
38
|
+
* was a SYSTEM error (the model or a tool call threw), the task is re-queued so the new strategy gets an attempt, instead of
|
|
39
|
+
* the turn giving up with "I couldn't complete this" after one transient error. An exhausted tool-loop budget, a rejected
|
|
40
|
+
* completion check and a failed verification are NOT retried (the wider `AUDIT_RETRY_FAILED_TASK` retries those too and stays
|
|
41
|
+
* off). Bounded by the ladder's MAX_SWITCHES and the stall rule. Read fresh each run.
|
|
42
|
+
*/
|
|
43
|
+
export declare function retrySystemErrorsEnabled(env?: Record<string, string | undefined>): boolean;
|
|
20
44
|
/**
|
|
21
45
|
* `AUDIT_REVIEWER_PASS` gate — feature-value audit (Phase C6 of the internal plan). EVAL-ONLY:
|
|
22
46
|
* default **ON** (an unset / empty / truthy value keeps today's always-on 3-lens reviewer pass).
|
|
@@ -31,11 +55,13 @@ export type HarnessOutcome = {
|
|
|
31
55
|
checkpoint: HarnessCheckpoint;
|
|
32
56
|
lastVerification: VerificationResult | null;
|
|
33
57
|
layerActivity: LayerActivityEvent[];
|
|
58
|
+
taskNotes: Record<string, string>;
|
|
34
59
|
} | {
|
|
35
60
|
status: 'completed';
|
|
36
61
|
result: HarnessRunResult;
|
|
37
62
|
lastVerification: VerificationResult | null;
|
|
38
63
|
layerActivity: LayerActivityEvent[];
|
|
64
|
+
taskNotes: Record<string, string>;
|
|
39
65
|
};
|
|
40
66
|
export interface HarnessRunParams {
|
|
41
67
|
sessionId: string;
|
|
@@ -69,6 +95,41 @@ export interface HarnessRunParams {
|
|
|
69
95
|
* flag is on is R3's scope.
|
|
70
96
|
*/
|
|
71
97
|
oneLoopProposer?: (toolCtx: ToolExecutorContext) => unknown | Promise<unknown>;
|
|
98
|
+
/** Semantic change reviewer found a conflict — advisory (see HarnessRunOptions.onReviewConflict). The caller decides how to surface it. */
|
|
99
|
+
onReviewConflict?: (event: {
|
|
100
|
+
taskId: string;
|
|
101
|
+
reason: string;
|
|
102
|
+
}) => void;
|
|
103
|
+
/** Competing explanations were generated for an underdetermined request, or one was eliminated by evidence (AUDIT_SEMANTIC_HYPOTHESES). The caller decides how to surface it. */
|
|
104
|
+
onSemanticHypothesis?: (event: SemanticHypothesisEvent) => void;
|
|
105
|
+
/** The competing explanations were already asked for (a tool-less turn drafts its reply first): the harness registers this answer instead of making a second call. `null` = asked, none. `undefined` = not asked. */
|
|
106
|
+
precomputedHypotheses?: SemanticHypothesisProposal[] | null;
|
|
107
|
+
/** The opt-in layers' plan for this turn (adaptive mode only); see resolveOptInPlan. Absent: each layer's own flag decides. */
|
|
108
|
+
optInPlan?: EscalationPlan;
|
|
109
|
+
/** The reviewer pass's verdict sent the last answer back for one revision (AUDIT_REVIEWER_REVISION): the note to put in front of the proposer. */
|
|
110
|
+
onReviewerRevision?: (event: {
|
|
111
|
+
taskId: string;
|
|
112
|
+
note: string;
|
|
113
|
+
}) => void;
|
|
114
|
+
/** A constraint the user stated this turn was violated by the finished answer: the note to hand the proposer for its one second answer. */
|
|
115
|
+
onConstraintRevision?: (event: {
|
|
116
|
+
taskId: string;
|
|
117
|
+
note: string;
|
|
118
|
+
}) => void;
|
|
119
|
+
/** Tokens this turn's model calls have used so far (input + output) — what AUDIT_HARNESS_TOKEN_BUDGET reports to the harness. */
|
|
120
|
+
tokensUsed?: () => number;
|
|
121
|
+
/** A confident failure-mode match picked the recovery strategy — advisory (see HarnessRunOptions.onFailureModeSwitch). The caller decides how to surface it. */
|
|
122
|
+
onFailureModeSwitch?: (event: {
|
|
123
|
+
taskId: string;
|
|
124
|
+
failure_class: string;
|
|
125
|
+
strategy: string;
|
|
126
|
+
}) => void;
|
|
127
|
+
/** With AUDIT_EXPERIENCE_LEARNING on, a ranking learned from earlier runs picked the recovery strategy — advisory (see HarnessRunOptions.onLearnedStrategySwitch). */
|
|
128
|
+
onLearnedStrategySwitch?: (event: {
|
|
129
|
+
taskId: string;
|
|
130
|
+
failure_class: string;
|
|
131
|
+
strategy: string;
|
|
132
|
+
}) => void;
|
|
72
133
|
/**
|
|
73
134
|
* Trajectory Supervisor GATHER_EVIDENCE host (S5 of
|
|
74
135
|
* the internal plan) — AgentLoop.runSupervisorInvestigation bound
|
|
@@ -115,6 +176,18 @@ export declare class HarnessBridge {
|
|
|
115
176
|
private readonly assistantSession;
|
|
116
177
|
private readonly onTrace;
|
|
117
178
|
private readonly oneLoopMode;
|
|
118
|
-
|
|
179
|
+
private readonly layerPolicyMode;
|
|
180
|
+
constructor(memory: MemoryAdapter, experienceStore: ExperienceStore, checkpointStore: CheckpointStore, llmClient: ILLMClient, model: () => string | undefined, maxSteps: number, planService: PlanService, assistantSession: AssistantSession, onTrace: ((event: TraceEvent) => void) | undefined, oneLoopMode?: OneLoopMode, layerPolicyMode?: LayerPolicyMode);
|
|
181
|
+
/** AL9b: runId of the previous turn's outcome row, so this turn's `pushbackOnPriorTurn` can be recorded against it. */
|
|
182
|
+
private lastOutcomeRunId;
|
|
183
|
+
private outcomeSeq;
|
|
184
|
+
/** AL9b: persist the per-layer outcome row (and, under shadow, the shadow-vs-executed row). Never throws, never affects the turn. */
|
|
185
|
+
private recordTurnTelemetry;
|
|
186
|
+
/**
|
|
187
|
+
* Drops the paused harness run a `needs_clarification` left behind (its checkpoint and its resume-attempt counter),
|
|
188
|
+
* so the next ordinary run for this session starts fresh instead of resuming it. Used when a clarification answer
|
|
189
|
+
* is handed to the ordinary turn pipeline rather than fed back into the paused run.
|
|
190
|
+
*/
|
|
191
|
+
discardPausedRun(sessionId: string): Promise<void>;
|
|
119
192
|
run(params: HarnessRunParams): Promise<HarnessOutcome>;
|
|
120
193
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `AUDIT_HARNESS_TOKEN_BUDGET` gate. Default **OFF**: the harness's memory layer keeps its `token_budget` at 0 used of 200,000,
|
|
3
|
+
* so its context-compression pressure test (90%) can never trip, exactly as before. A positive integer turns it on and IS the
|
|
4
|
+
* budget (`AUDIT_HARNESS_TOKEN_BUDGET=30000`): the turn's real model usage (input + output tokens, every call the turn made) is
|
|
5
|
+
* reported to the harness each iteration, and compression runs once usage passes 90% of the total. What it trims is the harness's
|
|
6
|
+
* own bookkeeping (compressed-structure and pruned-region records), never the model's conversation context — that is
|
|
7
|
+
* `semantic-compaction.ts`. Read at one site: harness-bridge.ts.
|
|
8
|
+
*/
|
|
9
|
+
export declare function harnessTokenBudgetTotal(env?: Record<string, string | undefined>): number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
export { PersonalAssistant } from './assistant.js';
|
|
2
2
|
export type { AssistantTurnResult, ProposerKind, PersonalAssistantOptions, AssistantProgress, AssistantTrace, AssistantSource, MemorySummary, TranscriptSearchHit, DebugLogEntry } from './assistant.js';
|
|
3
|
+
export type { MemoryStatus, MemoryInjection, AuditEntry, ConsolidationOutcome } from './memory-service.js';
|
|
4
|
+
export type { ConsolidationProposal } from './memory-consolidation.js';
|
|
5
|
+
export type { SessionDigest } from './episodic-digest.js';
|
|
6
|
+
export type { MemoryWriteMode } from './memory-governance.js';
|
|
7
|
+
export { MEMORY_WRITE_MODES, DEFAULT_MEMORY_WRITE_MODE, resolveMemoryWriteMode } from './memory-governance.js';
|
|
3
8
|
export type { GoalGraphState, GoalThreadView, GoalThreadVisibility, GoalTaskSummary } from './goal-graph-service.js';
|
|
4
9
|
export type { AnswerClaim, AnswerClaimSourceType, AnswerClaimVerificationStatus } from './answer-claim.js';
|
|
10
|
+
export { lowerConfidenceSourceLines } from './source-reliability.js';
|
|
5
11
|
export { classifyRisk } from './risk-classifier.js';
|
|
12
|
+
export { LEXICAL_FAMILIES, LEXICAL_CHECK_FAMILIES, DEFAULT_LEXICAL_MODE, lexicalActive, resolveLexicalMode, resolveLexicalOff, lexicalOffEnvValue, syncHarnessLexicalEnv } from './lexical/lexical-mode.js';
|
|
13
|
+
export type { LexicalFamily, LexicalMode } from './lexical/lexical-mode.js';
|
|
6
14
|
export type { RiskClassification } from './risk-classifier.js';
|
|
7
15
|
export { classifyTurnIntent } from './turn-intent-classifier.js';
|
|
8
16
|
export type { TurnIntentClassification, TurnIntentContext, RiskLevel } from './turn-intent-classifier.js';
|
|
@@ -26,7 +34,7 @@ export { braveSearch } from './web-search-provider.js';
|
|
|
26
34
|
export type { BraveSearchOptions } from './web-search-provider.js';
|
|
27
35
|
export { buildClaudePrompt, parseClaudeCliOutput, ALREADY_STAGED_ACTION_TOOL, stagedActionInput } from './claude-cli-prompt.js';
|
|
28
36
|
export type { ParsedClaudeCliOutput } from './claude-cli-prompt.js';
|
|
29
|
-
export { stripMcpToolPrefix, summarizeToolStep } from './tool-step.js';
|
|
37
|
+
export { stripMcpToolPrefix, summarizeToolStep, summarizeSettledToolStep } from './tool-step.js';
|
|
30
38
|
export type { AssistantToolStep } from './tool-step.js';
|
|
31
39
|
export type { DecomposedTaskSpec } from './decomposition-classifier.js';
|
|
32
40
|
export { detectHomogeneousBatchList } from './batch-list-detector.js';
|
|
@@ -42,17 +50,28 @@ export type { PlanRecord, PlanTaskRecord, PlanPosition, PlanMode } from './plan-
|
|
|
42
50
|
export type { PlanDecision, PlanApprovalEdits } from './plan-approval-service.js';
|
|
43
51
|
export { resolveConfig, validateConfig, ConfigValidationError, DEFAULT_CONFIG, CONFIG_KEYS } from './config.js';
|
|
44
52
|
export type { AssistantConfig, ConfigStore, ResolvedConfig } from './config.js';
|
|
53
|
+
export { LAYER_SETTINGS, applyLayerSettings, effectiveState, withLayerChoice, sanitizeLayerChoices, formatLayerListing, findLayer, isToggleable, LayerSettingError } from './layer-settings.js';
|
|
54
|
+
export type { LayerSetting, LayerGroup, LayerChoices, AppliedLayers } from './layer-settings.js';
|
|
45
55
|
export { resolveOneLoopMode, normalizeOneLoopMode, DEFAULT_ONE_LOOP_MODE } from './one-loop-flag.js';
|
|
46
56
|
export type { OneLoopMode } from './one-loop-flag.js';
|
|
47
57
|
export { resolveAskMode, normalizeAskMode, DEFAULT_ASK_MODE } from './ask-mode-flag.js';
|
|
48
58
|
export type { AskMode } from './ask-mode-flag.js';
|
|
59
|
+
export { resolveAmbiguityGuardMode, normalizeAmbiguityGuardMode, DEFAULT_AMBIGUITY_GUARD_MODE } from './ambiguity-guard-flag.js';
|
|
60
|
+
export type { AmbiguityGuardMode } from './ambiguity-guard-flag.js';
|
|
49
61
|
export { resolvePlanMode, normalizePlanMode, DEFAULT_PLAN_MODE } from './plan-mode-flag.js';
|
|
50
62
|
export type { PlanRolloutMode } from './plan-mode-flag.js';
|
|
51
63
|
export { resolveGoalGraphMode, normalizeGoalGraphMode, isGoalGraphEnabled, DEFAULT_GOAL_GRAPH_MODE } from './goal-graph-flag.js';
|
|
52
64
|
export type { GoalGraphMode } from './goal-graph-flag.js';
|
|
65
|
+
export { resolvePlanGraphMode, normalizePlanGraphMode, isPlanGraphEnabled, DEFAULT_PLAN_GRAPH_MODE } from './plan-graph-flag.js';
|
|
66
|
+
export type { PlanGraphMode } from './plan-graph-flag.js';
|
|
67
|
+
export { planToSnapshot } from './plan-viz/plan-snapshot.js';
|
|
68
|
+
export type { PlanSnapshot, PlanSnapshotResult } from './plan-viz/plan-snapshot.js';
|
|
53
69
|
export type { NextStepSuggestion } from './next-step-proposer.js';
|
|
54
70
|
export { resolveGoalGraphSuggestMode, normalizeGoalGraphSuggestMode, isGoalGraphSuggestEnabled, DEFAULT_GOAL_GRAPH_SUGGEST_MODE } from './goal-graph-suggest-flag.js';
|
|
55
71
|
export type { GoalGraphSuggestMode } from './goal-graph-suggest-flag.js';
|
|
72
|
+
export { resolveLayerPolicyMode, normalizeLayerPolicyMode, isAdaptivePolicyEnabled, isPolicyRecordingEnabled, isLayerPolicyMode, resolveLayerPolicyModeFromConfig, DEFAULT_LAYER_POLICY_MODE } from './layer-policy-flag.js';
|
|
73
|
+
export type { LayerPolicyMode } from './layer-policy-flag.js';
|
|
74
|
+
export { resolveEscalationPlan, turnPolicyBudget, escalationEnabled, explicitEnvOverride, SEMANTIC_ESCALATIONS, harnessGatePolicy, decompositionReframeEnabled, injectionDetectionEnabled, decisionNote } from './layer-policy-wiring.js';
|
|
56
75
|
export { LiveSteeringChannel } from './live-steering-channel.js';
|
|
57
76
|
export type { SteeringEvent } from './live-steering-channel.js';
|
|
58
77
|
export { AskClarificationService } from './ask-clarification-service.js';
|
|
@@ -61,7 +80,7 @@ export { validateAskResponse, MAX_QUESTIONS_PER_BATCH, MIN_OPTIONS_PER_QUESTION,
|
|
|
61
80
|
export type { AskQuestion, AskQuestionOption, AskAnswer, AskResponse } from '@buildaharness/harness';
|
|
62
81
|
export { createScriptedLLMClient } from './scripted-llm-client.js';
|
|
63
82
|
export type { ScriptedLLMClientScript } from './scripted-llm-client.js';
|
|
64
|
-
export { formatMemorySummary, formatSearchResults, formatGoalGraphState, formatCostSummary, formatDoctorReport, formatTranscriptMarkdown, defaultExportFilename } from './cli-session.js';
|
|
83
|
+
export { formatMemorySummary, formatMemoryHistory, formatMemoryArchive, formatMemoryInjection, formatMemoryStatus, memoryStatusChecks, formatSearchResults, formatGoalGraphState, formatCostSummary, formatDoctorReport, formatTranscriptMarkdown, defaultExportFilename } from './cli-session.js';
|
|
65
84
|
export type { CostSummaryInfo, DoctorCheck } from './cli-session.js';
|
|
66
85
|
export { estimateCostUsd } from './model-pricing.js';
|
|
67
86
|
export { PROVIDER_SETUP, getProviderSetup, cleanApiKey, checkApiKeyFormat, testApiKey } from './provider-setup.js';
|