@buildaharness/aielia 0.3.7 → 0.3.9
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 +6 -3
- package/dist/action-approval-service.d.ts +2 -0
- package/dist/ask-draft.d.ts +22 -0
- package/dist/assistant-options.d.ts +35 -0
- package/dist/assistant-session.d.ts +1 -1
- package/dist/{bin-C_hgDdSf.js → bin-CCwDFxDe.js} +145 -258
- package/dist/bin-CCwDFxDe.js.map +1 -0
- package/dist/cli-config.d.ts +2 -2
- package/dist/cli-session.d.ts +2 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1 -1
- package/dist/commands.d.ts +32 -0
- package/dist/config-keys.d.ts +43 -0
- package/dist/doctor-checks.d.ts +1 -2
- package/dist/fact-extraction.d.ts +4 -0
- package/dist/goal-graph-store.d.ts +6 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +199 -148
- package/dist/index.js.map +1 -1
- package/dist/llm-client-factory.d.ts +13 -0
- package/dist/memory-service.d.ts +2 -0
- package/dist/model-pricing.d.ts +12 -9
- package/dist/node-display-names.d.ts +1 -1
- package/dist/project-command.d.ts +16 -0
- package/dist/{provider-setup-wX2IBw2X.js → provider-setup-Cy9dwqrd.js} +13504 -13034
- package/dist/provider-setup-Cy9dwqrd.js.map +1 -0
- package/dist/proxy-health.d.ts +8 -0
- package/dist/redact-url.d.ts +2 -0
- package/dist/reply-audit.d.ts +2 -0
- package/dist/response-service.d.ts +10 -0
- package/dist/run-explain.d.ts +58 -0
- package/dist/{tui-app-C0J6HRzv.js → tui-app-Dt72u8vZ.js} +11 -3
- package/dist/{tui-app-C0J6HRzv.js.map → tui-app-Dt72u8vZ.js.map} +1 -1
- package/dist/turn-cost.d.ts +12 -0
- package/dist/turn-presentation.d.ts +86 -0
- package/dist/undo-action-command.d.ts +12 -0
- package/dist/undo-plan.d.ts +13 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/bin-C_hgDdSf.js.map +0 -1
- package/dist/provider-setup-wX2IBw2X.js.map +0 -1
package/dist/cli-config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssistantConfig, CONFIG_KEYS } from './config.js';
|
|
2
|
+
import { redactUrlCredentials } from './redact-url.js';
|
|
2
3
|
/**
|
|
3
4
|
* Pure logic backing cli.ts's /config command family — split out so it's unit-testable in
|
|
4
5
|
* isolation, the same way error-classifier.ts and node-display-names.ts are split out of
|
|
@@ -24,7 +25,6 @@ export declare class ConfigValueParseError extends Error {
|
|
|
24
25
|
}
|
|
25
26
|
/** Parses a raw `/config set <key> <value>` string into the type AssistantConfig[key] expects. */
|
|
26
27
|
export declare function parseConfigValue(key: keyof AssistantConfig, raw: string): unknown;
|
|
27
|
-
/** A URL with any user:password, and every query-string value, masked, so a credential embedded in proxyUrl is never printed. Text that is not a URL is returned unchanged. */
|
|
28
|
-
export declare function redactUrlCredentials(text: string): string;
|
|
29
28
|
/** Renders /config's full listing as a single multi-line string — cli.ts just console.logs the result. */
|
|
30
29
|
export declare function formatConfigListing(config: AssistantConfig, overriddenKeys: ReadonlySet<keyof AssistantConfig>): string;
|
|
30
|
+
export { redactUrlCredentials };
|
package/dist/cli-session.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface CliCommandHelp {
|
|
|
19
19
|
}
|
|
20
20
|
/** A bare `exit` / `quit` (with or without a leading slash, any case) ends the session; anything longer is an ordinary message. An exact command match, not a reading of the message. */
|
|
21
21
|
export declare function isQuitCommand(message: string): boolean;
|
|
22
|
+
/** Projected from COMMAND_REGISTRY (commands.ts), in registry order — add a command there, not here. */
|
|
22
23
|
export declare const CLI_COMMANDS_HELP: CliCommandHelp[];
|
|
23
24
|
export declare function formatHelp(): string;
|
|
24
25
|
export interface StatusInfo {
|
|
@@ -77,7 +78,7 @@ export interface CostSummaryInfo {
|
|
|
77
78
|
/** 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). */
|
|
78
79
|
spendCapLine?: string;
|
|
79
80
|
}
|
|
80
|
-
/** 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
|
|
81
|
+
/** 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) and openrouter's is as reported by OpenRouter; every other backend's cost, when shown, is a static-table estimate (see turn-cost.ts's withCostEstimate), never real billing data — see model-pricing.ts. */
|
|
81
82
|
export declare function formatCostSummary(info: CostSummaryInfo): string;
|
|
82
83
|
export interface DoctorCheck {
|
|
83
84
|
label: string;
|
package/dist/cli.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface RunCliOptions {
|
|
|
65
65
|
export interface CliInstance {
|
|
66
66
|
/** 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. */
|
|
67
67
|
dispatchLine(line: string): Promise<void>;
|
|
68
|
+
/** Keys of the slash-command dispatch table; the parity test compares them with COMMAND_REGISTRY. */
|
|
69
|
+
commandNames: string[];
|
|
68
70
|
close(): void;
|
|
69
71
|
/**
|
|
70
72
|
* Additive, read-only accessor for the pinned-input TUI shell's status line
|
package/dist/cli.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one list of slash commands, and which surface handles each. The CLI's /help is projected from it
|
|
3
|
+
* (cli-session.ts), and two parity tests fail when a surface and this list disagree: cli.test.ts
|
|
4
|
+
* (the dispatch table) and chat-ui's composer-commands.test.ts (the commands the composer intercepts).
|
|
5
|
+
* Pure data: no node:* and no DOM imports, so the browser build can read it.
|
|
6
|
+
*/
|
|
7
|
+
export type CommandSurfaces = 'both' | 'cli-only' | 'gui-only';
|
|
8
|
+
export interface CommandSpec {
|
|
9
|
+
/** The command and any fixed subcommand words, no arguments: '/memory export'. The first word is the dispatch key. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** What /help prints for it, arguments included. */
|
|
12
|
+
usage: string;
|
|
13
|
+
description: string;
|
|
14
|
+
surfaces: CommandSurfaces;
|
|
15
|
+
/** Required unless surfaces is 'both': why the other surface does not have it. 'planned: <phase>' marks a gap the surface-unification plan closes. */
|
|
16
|
+
reason?: string;
|
|
17
|
+
/** Other dispatch keys that run the same command ('/new' for '/clear'). */
|
|
18
|
+
aliases?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare const COMMAND_REGISTRY: CommandSpec[];
|
|
21
|
+
/**
|
|
22
|
+
* Capabilities that are CLI-only on purpose and are not slash commands, so they have no registry entry above.
|
|
23
|
+
* Each is a decision of the owner (D5) and carries the reason.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CLI_ONLY_FEATURES: {
|
|
26
|
+
name: string;
|
|
27
|
+
reason: string;
|
|
28
|
+
}[];
|
|
29
|
+
/** First word of a command name: the key the CLI dispatch table and the composer match on. */
|
|
30
|
+
export declare function commandKey(name: string): string;
|
|
31
|
+
/** Every dispatch key a surface must handle: the command keys plus their aliases, for the commands that include that surface. */
|
|
32
|
+
export declare function dispatchKeysFor(surface: 'cli' | 'gui'): string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AssistantConfig } from './config.js';
|
|
2
|
+
/**
|
|
3
|
+
* One table of the settings that can be pinned by an environment variable: which variable names it on each
|
|
4
|
+
* surface and how a raw value becomes the config value. The CLI reads `process.env` (ASSISTANT_*), the web and
|
|
5
|
+
* desktop builds read Vite's `import.meta.env` (VITE_ASSISTANT_*); both iterate this table, so a new key is one
|
|
6
|
+
* entry and the two surfaces cannot disagree on how a value is read. Pure: no node:* and no DOM imports.
|
|
7
|
+
*/
|
|
8
|
+
export type EnvSurface = 'cli' | 'vite';
|
|
9
|
+
export interface EnvKeySpec {
|
|
10
|
+
key: keyof AssistantConfig;
|
|
11
|
+
/** The variable the CLI reads. Absent when the key has no CLI env var. */
|
|
12
|
+
cli?: string;
|
|
13
|
+
/** The build-time variable the web and desktop builds read. Absent when the key cannot be pinned there. */
|
|
14
|
+
vite?: string;
|
|
15
|
+
/** `vite` names a runtime variable that is not in `import.meta.env` (the desktop reads ASSISTANT_LLM_BACKEND through a Tauri command): shown next to a read-only field, never read from the build. */
|
|
16
|
+
viteDisplayOnly?: boolean;
|
|
17
|
+
/** Turns the raw string into the config value, or undefined to leave the key unset (after warning). `envName` is the variable's name on this surface, for warnings. */
|
|
18
|
+
fromEnv(raw: string, envName: string, surface: EnvSurface): unknown;
|
|
19
|
+
}
|
|
20
|
+
/** An unrecognised value (a typo included) falls back to 'proxy', never to some other valid-looking backend. */
|
|
21
|
+
export declare function normalizeLlmBackend(raw: string): NonNullable<AssistantConfig['llmBackend']>;
|
|
22
|
+
/** Comma-separated hostname list, trimmed, empties dropped (shellNetworkAllowlist). */
|
|
23
|
+
export declare function parseShellNetworkAllowlist(raw: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Boolean variables, the same on both surfaces (decision D6): "1" or "true" is on, "0" or "false" is off, and anything
|
|
26
|
+
* else (yes, True, a typo) is off with a warning. Fail-closed on purpose: a value that is not clearly "on" must never
|
|
27
|
+
* switch on shell, email or the approval bypass.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseEnvBoolean(raw: string, envName: string): boolean;
|
|
30
|
+
export declare const ENV_KEYS: readonly EnvKeySpec[];
|
|
31
|
+
/** The variable that can pin `key` on `surface`, for showing next to a value or a read-only field. */
|
|
32
|
+
export declare function envVarFor(surface: EnvSurface): Partial<Record<keyof AssistantConfig, string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Builds the `overrides` argument for resolveConfig() from one surface's environment, only including a key whose
|
|
35
|
+
* variable is actually set, so an absent variable never shadows a persisted value. "Set" differs by surface on
|
|
36
|
+
* purpose: the CLI treats any defined value (even empty) as set; a Vite build defines every VITE_ var as an empty
|
|
37
|
+
* string when it is unset, so there an empty value means unset.
|
|
38
|
+
*/
|
|
39
|
+
export declare function envOverridesFrom(env: Readonly<Record<string, string | undefined>>, surface: EnvSurface): Partial<AssistantConfig>;
|
|
40
|
+
/** Keys whose values are a fixed set of words, for the strict /config set parser (and any picker). */
|
|
41
|
+
export declare const ENUM_CHOICES: Partial<Record<keyof AssistantConfig, readonly string[]>>;
|
|
42
|
+
/** `"a" or "b"`, or `"a", "b" or "c"`. */
|
|
43
|
+
export declare function formatChoices(choices: readonly string[]): string;
|
package/dist/doctor-checks.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FsBackend } from '@buildaharness/runtime';
|
|
2
2
|
import { DoctorCheck } from './cli-session.js';
|
|
3
3
|
import { MemoryStatus } from './memory-service.js';
|
|
4
|
-
|
|
5
|
-
export declare function checkProxyHealth(proxyUrl: string): Promise<DoctorCheck>;
|
|
4
|
+
export { checkProxyHealth } from './proxy-health.js';
|
|
6
5
|
/** Spawns `<claudePath> --version`, same path resolution ClaudeCliLLMClient uses — hard-timed so a hung/missing binary can't hang /doctor. */
|
|
7
6
|
export declare function checkClaudeCli(claudePath: string): Promise<DoctorCheck>;
|
|
8
7
|
/** M6: memory store size vs budget, pending count, last consolidation, audit-log size. The rendering is the shared pure `memoryStatusChecks` (chat-ui calls it too). */
|
|
@@ -104,6 +104,10 @@ export interface CandidateJudgement {
|
|
|
104
104
|
}
|
|
105
105
|
/** Every fact has a certainty for `/memory` display purposes, even one with no `confidence` gradient (user_asserted/observed/externally_verified) — those are exactly as certain as a stated fact gets, so they display as 'high' rather than blank. Never used for promotion/tier logic, which still reads `fact.confidence` directly and treats undefined as "no LLM confidence signal" (see that field's own doc comment) — this is purely a rendering convenience. */
|
|
106
106
|
export declare function certaintyLabel(fact: UserFact): FactConfidence;
|
|
107
|
+
/** What to say next to a remembered fact that is not stored: held for confirmation in Pending, or kept for this conversation only. A stored (durable) fact needs no note, so this returns undefined. One rule for the CLI's /memory and the apps' Memory panel, so "Facts I know" never reads as stored when the assistant has said it was not. */
|
|
108
|
+
export declare function factStatusLabel(fact: Pick<UserFact, 'text' | 'durable'>, pending?: readonly {
|
|
109
|
+
text: string;
|
|
110
|
+
}[]): string | undefined;
|
|
107
111
|
export declare function migrateFact(fact: UserFact): UserFact;
|
|
108
112
|
/**
|
|
109
113
|
* The six-tier taxonomy (Phase E of the harness consolidation plan, criticism001 #8 /
|
|
@@ -462,6 +462,12 @@ export declare function mintConcurrentReadyThread(record: GoalGraphRecord, descr
|
|
|
462
462
|
/** R4's CANCEL_CURRENT branch — marks a thread ABANDONED. Kept for audit trail, never removed from `threads`. */
|
|
463
463
|
export declare function abandonThread(record: GoalGraphRecord, threadId: string): GoalGraphRecord;
|
|
464
464
|
export declare function saveGoalGraphRecord(memory: MemoryAdapter, sessionId: string, record: GoalGraphRecord, fsPersistence?: GoalGraphFsPersistence): Promise<void>;
|
|
465
|
+
/**
|
|
466
|
+
* Removes `sessionId`'s goal graph from memory and, when configured, its JSON file (the file wins over the memory record on load, so
|
|
467
|
+
* deleting only the record would bring the old goals straight back). Used when a conversation ends: a fresh conversation must not keep
|
|
468
|
+
* the old one's goals or the next steps saved on them. Never throws.
|
|
469
|
+
*/
|
|
470
|
+
export declare function deleteGoalGraphRecord(memory: MemoryAdapter, sessionId: string, fsPersistence?: GoalGraphFsPersistence): Promise<void>;
|
|
465
471
|
/**
|
|
466
472
|
* Loads `sessionId`'s goal graph, migrating a pre-existing `PlanRecord` in place the first time
|
|
467
473
|
* this is called for a session that predates this mechanism (P5-equivalent non-destructive
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,21 @@ export type { LexicalFamily, LexicalMode } from './lexical/lexical-mode.js';
|
|
|
14
14
|
export type { RiskClassification } from './risk-classifier.js';
|
|
15
15
|
export { classifyTurnIntent } from './turn-intent-classifier.js';
|
|
16
16
|
export type { TurnIntentClassification, TurnIntentContext, RiskLevel } from './turn-intent-classifier.js';
|
|
17
|
+
export { emptyDraft, orderedOptions, draftToAnswer, type QuestionDraft } from './ask-draft.js';
|
|
18
|
+
export { withCostEstimate } from './turn-cost.js';
|
|
19
|
+
export { planUndo, type UndoPlan } from './undo-plan.js';
|
|
20
|
+
export { ENV_KEYS, ENUM_CHOICES, envOverridesFrom, envVarFor, normalizeLlmBackend, parseShellNetworkAllowlist, formatChoices, type EnvKeySpec, type EnvSurface } from './config-keys.js';
|
|
21
|
+
export { presentTurnResult, approvalLabels, NO_TRACE, DEFAULT_APPROVAL_REASON, DEFAULT_ESCALATION_REASON, DEFAULT_CLARIFICATION_REASON, MISSING_PLAN_APPROVAL_ID_REASON, type TurnPresentation, type TurnHints } from './turn-presentation.js';
|
|
22
|
+
export { parseUndoActionCommand, type UndoActionCommand } from './undo-action-command.js';
|
|
23
|
+
export { factStatusLabel } from './fact-extraction.js';
|
|
24
|
+
export { parseProjectCommand, type ProjectCommand } from './project-command.js';
|
|
25
|
+
export { formatSpendCapStatus } from './spend-cap.js';
|
|
26
|
+
export { buildAssistantOptions, CLI_FEATURES, DESKTOP_FEATURES, WEB_FEATURES, type AssistantPlatform, type AssistantFeatures } from './assistant-options.js';
|
|
27
|
+
export { checkProxyHealth } from './proxy-health.js';
|
|
28
|
+
export { redactUrlCredentials } from './redact-url.js';
|
|
29
|
+
export { createLlmClient, type LlmClientFactoryOptions } from './llm-client-factory.js';
|
|
30
|
+
export { COMMAND_REGISTRY, CLI_ONLY_FEATURES, commandKey, dispatchKeysFor, type CommandSpec, type CommandSurfaces } from './commands.js';
|
|
31
|
+
export { explainWhy, explainLayers, explainSources, explainSteps, explainPlan, explainCommand, verificationHealthLabel, answerClaimLabel, batchBudgetSummaryLine, EXPLAIN_COMMANDS, NO_PLAN_TEXT, NO_DRAFTED_PLAN_BUT_GOAL_TASKS_TEXT, type TurnExplainInput, type ExplainCommand } from './run-explain.js';
|
|
17
32
|
export { nodeDisplayName, nodeToLayer, buildWhyChain, LAYER_ORDER, LAYER_DISPLAY_NAME, LAYER_SHORT_CODE } from './node-display-names.js';
|
|
18
33
|
export type { LayerSlug, WhyChainItem } from './node-display-names.js';
|
|
19
34
|
export { classifyError } from './error-classifier.js';
|
|
@@ -32,7 +47,7 @@ export { WEB_TOOLS, WEB_SEARCH_TOOL, FETCH_URL_TOOL, executeWebTool, assertPubli
|
|
|
32
47
|
export type { WebToolsContext, WebToolResult, WebSearchResult, DnsResolver } from './web-tools.js';
|
|
33
48
|
export { braveSearch } from './web-search-provider.js';
|
|
34
49
|
export type { BraveSearchOptions } from './web-search-provider.js';
|
|
35
|
-
export { buildClaudePrompt, parseClaudeCliOutput, ALREADY_STAGED_ACTION_TOOL, stagedActionInput } from './claude-cli-prompt.js';
|
|
50
|
+
export { buildClaudePrompt, stripJsonCodeFence, parseClaudeCliOutput, ALREADY_STAGED_ACTION_TOOL, stagedActionInput } from './claude-cli-prompt.js';
|
|
36
51
|
export type { ParsedClaudeCliOutput } from './claude-cli-prompt.js';
|
|
37
52
|
export { stripMcpToolPrefix, summarizeToolStep, summarizeSettledToolStep } from './tool-step.js';
|
|
38
53
|
export type { AssistantToolStep } from './tool-step.js';
|
|
@@ -80,7 +95,7 @@ export { validateAskResponse, MAX_QUESTIONS_PER_BATCH, MIN_OPTIONS_PER_QUESTION,
|
|
|
80
95
|
export type { AskQuestion, AskQuestionOption, AskAnswer, AskResponse } from '@buildaharness/harness';
|
|
81
96
|
export { createScriptedLLMClient } from './scripted-llm-client.js';
|
|
82
97
|
export type { ScriptedLLMClientScript } from './scripted-llm-client.js';
|
|
83
|
-
export { formatMemorySummary, formatMemoryHistory, formatMemoryArchive, formatMemoryInjection, formatMemoryStatus, memoryStatusChecks, formatSearchResults, formatGoalGraphState, formatCostSummary, formatDoctorReport, formatTranscriptMarkdown, defaultExportFilename } from './cli-session.js';
|
|
98
|
+
export { formatUndoLogListing, formatMemoryExport, defaultMemoryExportFilename, formatMemorySummary, formatMemoryHistory, formatMemoryArchive, formatMemoryInjection, formatMemoryStatus, memoryStatusChecks, formatSearchResults, formatGoalGraphState, formatCostSummary, formatDoctorReport, formatTranscriptMarkdown, defaultExportFilename } from './cli-session.js';
|
|
84
99
|
export type { CostSummaryInfo, DoctorCheck } from './cli-session.js';
|
|
85
100
|
export { estimateCostUsd } from './model-pricing.js';
|
|
86
101
|
export { PROVIDER_SETUP, getProviderSetup, cleanApiKey, checkApiKeyFormat, testApiKey } from './provider-setup.js';
|
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 {
|
|
5
|
-
import { A, a, b, C, c,
|
|
4
|
+
import { bV as parseModelJson, al as classifyRiskLexical } from "./provider-setup-Cy9dwqrd.js";
|
|
5
|
+
import { A, a, b, C, c, d, e, f, D, h, i, j, k, l, m, n, o, p, q, r, s, u, E, w, y, z, F, B, I, L, G, H, J, K, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aX, aY, a_, a$, b0, b1, b3, b4, b5, b6, b7, b9, ba, bc, bd, be, bg, bh, bi, bj, bk, bl, bn, bo, bp, bq, br, bs, bu, bv, bw, bx, by, bz, bA, bB, bC, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bS, bT, bW, bX, bY, bZ, b_, b$, c0, c1, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cm, cn, co, cp, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA } from "./provider-setup-Cy9dwqrd.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",
|
|
@@ -23,7 +23,7 @@ const PLAN_SCHEMA = {
|
|
|
23
23
|
required: ["tasks"]
|
|
24
24
|
};
|
|
25
25
|
function buildSystemPrompt(template) {
|
|
26
|
-
const skeleton = template.tasks.map((
|
|
26
|
+
const skeleton = template.tasks.map((t) => `- id: ${t.id}; title: ${t.title}; depends_on: [${t.depends_on.join(", ")}]`).join("\n");
|
|
27
27
|
return `You are adapting a "${template.name}" plan template to a specific user request. Here is the template's task skeleton — keep the exact same ids and depends_on structure, one output task per skeleton task, but personalize each description to the actual request:
|
|
28
28
|
${skeleton}
|
|
29
29
|
|
|
@@ -33,8 +33,8 @@ Phrase each \`description\` starting with the concrete subject or object it acts
|
|
|
33
33
|
}
|
|
34
34
|
function isRawPlanTask(value) {
|
|
35
35
|
if (typeof value !== "object" || value === null) return false;
|
|
36
|
-
const
|
|
37
|
-
return typeof
|
|
36
|
+
const v = value;
|
|
37
|
+
return typeof v.id === "string" && typeof v.description === "string" && Array.isArray(v.depends_on) && v.depends_on.every((d2) => typeof d2 === "string");
|
|
38
38
|
}
|
|
39
39
|
async function buildPlanFromTemplate(llmClient, message, template, model, onUsage) {
|
|
40
40
|
try {
|
|
@@ -50,8 +50,8 @@ async function buildPlanFromTemplate(llmClient, message, template, model, onUsag
|
|
|
50
50
|
if (!Array.isArray(parsed.tasks)) return null;
|
|
51
51
|
const rawTasks = parsed.tasks.filter(isRawPlanTask);
|
|
52
52
|
if (rawTasks.length <= 1) return null;
|
|
53
|
-
const riskByTemplateId = new Map(template.tasks.map((
|
|
54
|
-
const tasks = rawTasks.map((
|
|
53
|
+
const riskByTemplateId = new Map(template.tasks.map((t) => [t.id, t.risk_level]));
|
|
54
|
+
const tasks = rawTasks.map((t) => ({ ...t, riskLevel: riskByTemplateId.get(t.id) ?? "LOW" }));
|
|
55
55
|
return { templateName: template.name, successCriteria: template.success_criteria, tasks };
|
|
56
56
|
} catch {
|
|
57
57
|
return null;
|
|
@@ -63,6 +63,7 @@ const SIDE_CALL_MARKERS = [
|
|
|
63
63
|
["You are a security classifier analyzing untrusted external content", '{"flagged":false}'],
|
|
64
64
|
["You check whether an assistant's reply is faithful to the raw results", '{"verdict":"grounded"}'],
|
|
65
65
|
["You judge whether an assistant actually accomplished a task", '{"done":true}'],
|
|
66
|
+
["You decide whether a user's request to an assistant with file and shell tools fully determines the", '{"ambiguous":false,"question":""}'],
|
|
66
67
|
["You condense the earlier part of a conversation", '{"summary":""}'],
|
|
67
68
|
["You judge whether an assistant's reply violates constraints", '{"violations":[]}'],
|
|
68
69
|
["You weigh the reliability of the sources an assistant read", '{"assessments":[],"weighed":true}'],
|
|
@@ -143,157 +144,207 @@ export {
|
|
|
143
144
|
A as ACTION_TOOLS,
|
|
144
145
|
a as ALREADY_STAGED_ACTION_TOOL,
|
|
145
146
|
b as AskClarificationService,
|
|
146
|
-
C as
|
|
147
|
-
c as
|
|
147
|
+
C as CLI_FEATURES,
|
|
148
|
+
c as CLI_ONLY_FEATURES,
|
|
149
|
+
d as COMMAND_REGISTRY,
|
|
150
|
+
e as CONFIG_KEYS,
|
|
151
|
+
f as ConfigValidationError,
|
|
148
152
|
D as DEFAULT_AMBIGUITY_GUARD_MODE,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
h as DEFAULT_APPROVAL_REASON,
|
|
154
|
+
i as DEFAULT_ASK_MODE,
|
|
155
|
+
j as DEFAULT_CLARIFICATION_REASON,
|
|
156
|
+
k as DEFAULT_CONFIG,
|
|
157
|
+
l as DEFAULT_ESCALATION_REASON,
|
|
158
|
+
m as DEFAULT_GOAL_GRAPH_MODE,
|
|
159
|
+
n as DEFAULT_GOAL_GRAPH_SUGGEST_MODE,
|
|
153
160
|
DEFAULT_LAYER_POLICY_MODE,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
o as DEFAULT_LEXICAL_MODE,
|
|
162
|
+
p as DEFAULT_MEMORY_WRITE_MODE,
|
|
163
|
+
q as DEFAULT_ONE_LOOP_MODE,
|
|
164
|
+
r as DEFAULT_PLAN_GRAPH_MODE,
|
|
165
|
+
s as DEFAULT_PLAN_MODE,
|
|
166
|
+
u as DESKTOP_FEATURES,
|
|
167
|
+
E as ENUM_CHOICES,
|
|
168
|
+
w as ENV_KEYS,
|
|
169
|
+
y as EXPLAIN_COMMANDS,
|
|
170
|
+
z as EmailDeliveryError,
|
|
160
171
|
F as FETCH_URL_TOOL,
|
|
161
|
-
|
|
172
|
+
B as FILE_TOOLS,
|
|
162
173
|
I as InvalidEmailArgsError,
|
|
163
174
|
L as LAYER_DISPLAY_NAME,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
G as LAYER_ORDER,
|
|
176
|
+
H as LAYER_SETTINGS,
|
|
177
|
+
J as LAYER_SHORT_CODE,
|
|
178
|
+
K as LEXICAL_CHECK_FAMILIES,
|
|
179
|
+
M as LEXICAL_FAMILIES,
|
|
180
|
+
N as LIST_DIRECTORY_TOOL,
|
|
181
|
+
O as LayerSettingError,
|
|
182
|
+
P as LiveSteeringChannel,
|
|
172
183
|
MAX_OPTIONS_PER_QUESTION,
|
|
173
184
|
MAX_QUESTIONS_PER_BATCH,
|
|
174
|
-
|
|
185
|
+
Q as MEMORY_WRITE_MODES,
|
|
175
186
|
MIN_OPTIONS_PER_QUESTION,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
R as MISSING_PLAN_APPROVAL_ID_REASON,
|
|
188
|
+
S as NO_DRAFTED_PLAN_BUT_GOAL_TASKS_TEXT,
|
|
189
|
+
T as NO_PLAN_TEXT,
|
|
190
|
+
U as NO_TRACE,
|
|
191
|
+
V as PROVIDER_SETUP,
|
|
192
|
+
W as PathOutsideWorkspaceError,
|
|
193
|
+
X as PersonalAssistant,
|
|
194
|
+
Y as PrivateNetworkTargetError,
|
|
195
|
+
Z as READ_FILE_TOOL,
|
|
196
|
+
_ as RUN_SHELL_COMMAND_TOOL,
|
|
197
|
+
$ as SEMANTIC_ESCALATIONS,
|
|
198
|
+
a0 as SEND_EMAIL_TOOL,
|
|
199
|
+
a1 as SHELL_TOOLS,
|
|
200
|
+
a2 as WEB_FEATURES,
|
|
201
|
+
a3 as WEB_SEARCH_TOOL,
|
|
202
|
+
a4 as WEB_TOOLS,
|
|
203
|
+
a5 as WRITE_FILE_TOOL,
|
|
204
|
+
a6 as abandonPlan,
|
|
205
|
+
a7 as answerClaimLabel,
|
|
206
|
+
a8 as applyLayerSettings,
|
|
207
|
+
a9 as applyPendingAction,
|
|
208
|
+
aa as approvalLabels,
|
|
209
|
+
ab as assertPublicHttpUrl,
|
|
210
|
+
ac as batchBudgetSummaryLine,
|
|
211
|
+
ad as braveSearch,
|
|
212
|
+
ae as buildAssistantOptions,
|
|
213
|
+
af as buildClaudePrompt,
|
|
194
214
|
buildPlanFromTemplate,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
ag as buildWhyChain,
|
|
216
|
+
ah as checkApiKeyFormat,
|
|
217
|
+
ai as checkProxyHealth,
|
|
218
|
+
aj as classifyError,
|
|
219
|
+
ak as classifyRisk,
|
|
220
|
+
am as classifyToolYield,
|
|
221
|
+
an as classifyTurnIntent,
|
|
222
|
+
ao as cleanApiKey,
|
|
223
|
+
ap as commandKey,
|
|
224
|
+
aq as computePlanPosition,
|
|
225
|
+
ar as createLlmClient,
|
|
226
|
+
as as createPlanRecord,
|
|
227
|
+
at as createResendSender,
|
|
205
228
|
createScriptedLLMClient,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
229
|
+
au as createSmtpSender,
|
|
230
|
+
av as decisionNote,
|
|
231
|
+
aw as decompositionReframeEnabled,
|
|
232
|
+
ax as defaultExportFilename,
|
|
233
|
+
ay as defaultMemoryExportFilename,
|
|
234
|
+
az as detectHomogeneousBatchList,
|
|
235
|
+
aA as discardPendingAction,
|
|
236
|
+
aB as dispatchKeysFor,
|
|
237
|
+
aC as draftToAnswer,
|
|
238
|
+
aD as effectiveState,
|
|
239
|
+
aE as emptyDraft,
|
|
240
|
+
aF as envOverridesFrom,
|
|
241
|
+
aH as envVarFor,
|
|
242
|
+
aI as escalationEnabled,
|
|
243
|
+
aJ as estimateCostUsd,
|
|
244
|
+
aK as executeActionTool,
|
|
245
|
+
aL as executeFileTool,
|
|
246
|
+
aM as executeShellTool,
|
|
247
|
+
aN as executeWebTool,
|
|
248
|
+
aO as explainCommand,
|
|
249
|
+
aP as explainLayers,
|
|
250
|
+
aQ as explainPlan,
|
|
251
|
+
aR as explainSources,
|
|
252
|
+
aS as explainSteps,
|
|
253
|
+
aT as explainWhy,
|
|
254
|
+
aU as explicitEnvOverride,
|
|
255
|
+
aV as factStatusLabel,
|
|
256
|
+
aX as findLayer,
|
|
257
|
+
aY as formatChoices,
|
|
258
|
+
a_ as formatCostSummary,
|
|
259
|
+
a$ as formatDoctorReport,
|
|
260
|
+
b0 as formatEmailApprovalReason,
|
|
261
|
+
b1 as formatGoalGraphState,
|
|
262
|
+
b3 as formatLayerListing,
|
|
263
|
+
b4 as formatMemoryArchive,
|
|
264
|
+
b5 as formatMemoryExport,
|
|
265
|
+
b6 as formatMemoryHistory,
|
|
266
|
+
b7 as formatMemoryInjection,
|
|
267
|
+
b9 as formatMemoryStatus,
|
|
268
|
+
ba as formatMemorySummary,
|
|
269
|
+
bc as formatPlanProgress,
|
|
270
|
+
bd as formatSearchResults,
|
|
271
|
+
be as formatSpendCapStatus,
|
|
272
|
+
bg as formatTranscriptMarkdown,
|
|
273
|
+
bh as formatUndoLogListing,
|
|
274
|
+
bi as getProviderSetup,
|
|
275
|
+
bj as harnessGatePolicy,
|
|
276
|
+
bk as injectionDetectionEnabled,
|
|
277
|
+
bl as isAdaptivePolicyEnabled,
|
|
278
|
+
bn as isGoalGraphEnabled,
|
|
279
|
+
bo as isGoalGraphSuggestEnabled,
|
|
280
|
+
bp as isLayerPolicyMode,
|
|
281
|
+
bq as isLikelyEmailAddress,
|
|
282
|
+
br as isPlanGraphEnabled,
|
|
283
|
+
bs as isPolicyRecordingEnabled,
|
|
284
|
+
bu as isToggleable,
|
|
285
|
+
bv as lexicalActive,
|
|
286
|
+
bw as lexicalOffEnvValue,
|
|
287
|
+
bx as listTemplateNames,
|
|
288
|
+
by as loadActivePlan,
|
|
289
|
+
bz as loadPendingAction,
|
|
290
|
+
bA as loadTemplate,
|
|
291
|
+
bB as lowerConfidenceSourceLines,
|
|
292
|
+
bC as matchTemplateIfConfident,
|
|
293
|
+
bE as memoryStatusChecks,
|
|
294
|
+
bF as nextPendingTask,
|
|
295
|
+
bG as nodeDisplayName,
|
|
296
|
+
bH as nodeToLayer,
|
|
297
|
+
bI as normalizeAmbiguityGuardMode,
|
|
298
|
+
bJ as normalizeAskMode,
|
|
299
|
+
bK as normalizeGoalGraphMode,
|
|
300
|
+
bL as normalizeGoalGraphSuggestMode,
|
|
301
|
+
bM as normalizeLayerPolicyMode,
|
|
302
|
+
bN as normalizeLlmBackend,
|
|
303
|
+
bO as normalizeOneLoopMode,
|
|
304
|
+
bP as normalizePlanGraphMode,
|
|
305
|
+
bQ as normalizePlanMode,
|
|
306
|
+
bS as orderedOptions,
|
|
307
|
+
bT as parseClaudeCliOutput,
|
|
308
|
+
bW as parseProjectCommand,
|
|
309
|
+
bX as parseShellNetworkAllowlist,
|
|
310
|
+
bY as parseUndoActionCommand,
|
|
311
|
+
bZ as pickTemplateForTask,
|
|
312
|
+
b_ as planCompletionPct,
|
|
313
|
+
b$ as planToSnapshot,
|
|
314
|
+
c0 as planUndo,
|
|
315
|
+
c1 as presentTurnResult,
|
|
316
|
+
c3 as redactUrlCredentials,
|
|
317
|
+
c4 as resolveAmbiguityGuardMode,
|
|
318
|
+
c5 as resolveAskMode,
|
|
319
|
+
c6 as resolveConfig,
|
|
320
|
+
c7 as resolveEscalationPlan,
|
|
321
|
+
c8 as resolveGoalGraphMode,
|
|
322
|
+
c9 as resolveGoalGraphSuggestMode,
|
|
323
|
+
ca as resolveInWorkspace,
|
|
324
|
+
cb as resolveLayerPolicyMode,
|
|
325
|
+
cc as resolveLayerPolicyModeFromConfig,
|
|
326
|
+
cd as resolveLexicalMode,
|
|
327
|
+
ce as resolveLexicalOff,
|
|
328
|
+
cf as resolveMemoryWriteMode,
|
|
329
|
+
cg as resolveOneLoopMode,
|
|
330
|
+
ch as resolvePlanGraphMode,
|
|
331
|
+
ci as resolvePlanMode,
|
|
332
|
+
cj as sanitizeLayerChoices,
|
|
333
|
+
ck as savePlan,
|
|
334
|
+
cm as stagePendingAction,
|
|
335
|
+
cn as stagedActionInput,
|
|
336
|
+
co as stripJsonCodeFence,
|
|
337
|
+
cp as stripMcpToolPrefix,
|
|
338
|
+
cr as summarizeSettledToolStep,
|
|
339
|
+
cs as summarizeToolStep,
|
|
340
|
+
ct as syncHarnessLexicalEnv,
|
|
341
|
+
cu as testApiKey,
|
|
342
|
+
cv as turnPolicyBudget,
|
|
343
|
+
cw as updatePlanFromRun,
|
|
295
344
|
validateAskResponse,
|
|
296
|
-
|
|
297
|
-
|
|
345
|
+
cx as validateConfig,
|
|
346
|
+
cy as verificationHealthLabel,
|
|
347
|
+
cz as withCostEstimate,
|
|
348
|
+
cA as withLayerChoice
|
|
298
349
|
};
|
|
299
350
|
//# sourceMappingURL=index.js.map
|