@buildaharness/aielia 0.3.3 → 0.3.4
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/dist/agent-loop.d.ts +9 -1
- package/dist/assistant-session.d.ts +4 -4
- package/dist/assistant-types.d.ts +8 -0
- package/dist/assistant.d.ts +39 -0
- package/dist/{bin-Btzhiyzi.js → bin-CdVTAe7j.js} +135 -34
- package/dist/bin-CdVTAe7j.js.map +1 -0
- package/dist/cli-session.d.ts +12 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +22 -0
- package/dist/first-run.d.ts +3 -0
- package/dist/goal-graph-flag.d.ts +44 -0
- package/dist/goal-graph-reconcile.d.ts +55 -0
- package/dist/goal-graph-service.d.ts +48 -0
- package/dist/goal-graph-store.d.ts +485 -0
- package/dist/goal-graph-suggest-flag.d.ts +34 -0
- package/dist/goal-identity-matcher.d.ts +21 -0
- package/dist/goal-thread-identity.d.ts +32 -0
- package/dist/goal-thread-scheduler.d.ts +78 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +86 -71
- package/dist/live-steering-channel.d.ts +31 -0
- package/dist/next-step-proposer.d.ts +52 -0
- package/dist/plan-approval-service.d.ts +1 -1
- package/dist/plan-drafting-service.d.ts +1 -1
- package/dist/{cli-session-DnSc6Hhx.js → provider-setup-CPbB5y_V.js} +4788 -323
- package/dist/provider-setup-CPbB5y_V.js.map +1 -0
- package/dist/provider-setup.d.ts +51 -0
- package/dist/response-service.d.ts +18 -2
- package/dist/scope-urgency-classifier.d.ts +29 -0
- package/dist/supervisor-flag.d.ts +20 -0
- package/dist/{tui-app-CFfOP2DC.js → tui-app-DeyZ4Pr9.js} +3 -3
- package/dist/{tui-app-CFfOP2DC.js.map → tui-app-DeyZ4Pr9.js.map} +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/dist/bin-Btzhiyzi.js.map +0 -1
- package/dist/cli-session-DnSc6Hhx.js.map +0 -1
package/dist/cli-session.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { NextStepSuggestion } from './next-step-proposer.js';
|
|
1
2
|
import { ChatMessage, TokenUsage } from '@buildaharness/runtime';
|
|
2
3
|
import { AssistantConfig } from './config.js';
|
|
3
4
|
import { MemorySummary, MemoryExport, TranscriptSearchHit, MemoryPendingOutcome } from './assistant.js';
|
|
5
|
+
import { GoalGraphState } from './goal-graph-service.js';
|
|
4
6
|
import { UndoLogEntry } from './action-snapshot.js';
|
|
5
7
|
/**
|
|
6
8
|
* Pure formatting/logic backing cli.ts's session-level commands (/help, /status, /export,
|
|
@@ -34,6 +36,16 @@ export declare function formatMemorySummary(summary: MemorySummary): string;
|
|
|
34
36
|
export declare function formatMemoryExport(data: MemoryExport): string;
|
|
35
37
|
/** Renders `/search <query>`'s results — each hit is one message (session id short form, timestamp, role, snippet), ranked by relevance, never the whole session it came from. An empty list is an explicit "no results" line, never a silent blank output. */
|
|
36
38
|
export declare function formatSearchResults(hits: TranscriptSearchHit[], query: string): string;
|
|
39
|
+
/** Renders the turn-end next-step options shown under a full turn's reply — numbered so the CLI can accept a bare `1`/`2`/`3` as "run that one" (see cli.ts's dispatchOne). Only the description is shown; the rationale and confidence stay in the structured result for richer front ends. */
|
|
40
|
+
export declare function formatNextSteps(steps: NextStepSuggestion[]): string;
|
|
41
|
+
/**
|
|
42
|
+
* Renders `/goals`' review surface (R5, "Visibility") — every known GoalThread this session, each
|
|
43
|
+
* tagged with which of R5's four visibility buckets it falls in
|
|
44
|
+
* (freshly-computed/carried-over/done/suggested-but-not-committed), so a user can tell live state
|
|
45
|
+
* apart from stale carryover without re-deriving it from raw JSON. An empty graph is an explicit
|
|
46
|
+
* line, same convention `formatSearchResults` follows for zero hits.
|
|
47
|
+
*/
|
|
48
|
+
export declare function formatGoalGraphState(state: GoalGraphState): string;
|
|
37
49
|
/** Renders /undo-action's no-argument listing — newest first (see action-snapshot.ts's listUndoLogEntries), with each entry's undoable status so the user doesn't have to stage a revert just to find out it's unavailable. */
|
|
38
50
|
export declare function formatUndoLogListing(entries: UndoLogEntry[]): string;
|
|
39
51
|
/** Renders a transcript as markdown for /export — "You:"/"Assistant:" turns, oldest first. */
|
package/dist/cli.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { FsBackend } from '@buildaharness/runtime';
|
|
|
2
2
|
import { PersonalAssistant } from './assistant.js';
|
|
3
3
|
import { AssistantConfig, ConfigStore } from './config.js';
|
|
4
4
|
import { NonInteractiveApprovalMode } from './non-interactive-mode.js';
|
|
5
|
+
import { KeyedBackend, KeyTestResult } from './provider-setup.js';
|
|
5
6
|
/**
|
|
6
7
|
* One choice in a structured multi-option prompt (Phase 7 of the internal plan
|
|
7
8
|
* — the numbered/arrow-key approval selector). `key` is both the single-character shortcut shown
|
|
@@ -42,6 +43,8 @@ export interface RunCliOptions {
|
|
|
42
43
|
detectClaudeCli?: () => Promise<boolean>;
|
|
43
44
|
/** Test seam: script the first-run setup's line reads. */
|
|
44
45
|
firstRunAsk?: (question: string) => Promise<string>;
|
|
46
|
+
/** Test seam: stub the live API-key check in the first-run setup (defaults to a real call to the provider). */
|
|
47
|
+
firstRunTestKey?: (backend: KeyedBackend, key: string) => Promise<KeyTestResult>;
|
|
45
48
|
}
|
|
46
49
|
export interface CliInstance {
|
|
47
50
|
/** 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. */
|
package/dist/cli.js
CHANGED
package/dist/config.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { AskMode } from './ask-mode-flag.js';
|
|
|
3
3
|
import { PlanRolloutMode } from './plan-mode-flag.js';
|
|
4
4
|
import { TuiMode } from './tui-mode-flag.js';
|
|
5
5
|
import { UpdateCheckMode } from './update-check-flag.js';
|
|
6
|
+
import { GoalGraphMode } from './goal-graph-flag.js';
|
|
7
|
+
import { GoalGraphSuggestMode } from './goal-graph-suggest-flag.js';
|
|
6
8
|
export interface AssistantConfig {
|
|
7
9
|
llmBackend: 'proxy' | 'claude-cli' | 'anthropic' | 'openai' | 'openrouter';
|
|
8
10
|
proxyUrl: string;
|
|
@@ -155,6 +157,26 @@ export interface AssistantConfig {
|
|
|
155
157
|
* `/config reset activeProject`, mirroring `/model`'s relationship to `/config set model`.
|
|
156
158
|
*/
|
|
157
159
|
activeProject?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Phase 8 of plans/hierarchical_goal_tree_and_steering_plan.html — the shared config seam for
|
|
162
|
+
* the hierarchical goal-tree mechanism's Tier 0/1 gate (R1's mid-task steering, R4's scope×
|
|
163
|
+
* urgency classifier). Undefined (the default, for the whole rollout window) means every
|
|
164
|
+
* surface falls back to `DEFAULT_GOAL_GRAPH_MODE` ('disabled') — today's behavior, byte-for-byte
|
|
165
|
+
* (INV-43). Mirrors `oneLoopMode`/`askMode`/`planMode`'s exact chain: env override
|
|
166
|
+
* (`ASSISTANT_GOAL_GRAPH`, cli-config.ts), build-time override (`VITE_ASSISTANT_GOAL_GRAPH`,
|
|
167
|
+
* chat-ui's browser-config.ts), and a package-owned default kept out of DEFAULT_CONFIG so an
|
|
168
|
+
* unset value stays undefined. Before this phase, cli.ts/App.tsx read this straight off
|
|
169
|
+
* process.env/import.meta.env instead of through this field — see goal-graph-flag.ts's doc
|
|
170
|
+
* comment for why that was deliberate up to now.
|
|
171
|
+
*/
|
|
172
|
+
goalGraphMode?: GoalGraphMode;
|
|
173
|
+
/**
|
|
174
|
+
* Phase 8 — the same shared config seam as `goalGraphMode` above, for the next-step proposer's
|
|
175
|
+
* (Tier 1.5) independent gate (Q8: a regression there shouldn't block Tier 0/1). Undefined
|
|
176
|
+
* falls back to `DEFAULT_GOAL_GRAPH_SUGGEST_MODE` ('disabled'). Same env/build-time/`/config
|
|
177
|
+
* set` chain, via `ASSISTANT_GOAL_GRAPH_SUGGEST`/`VITE_ASSISTANT_GOAL_GRAPH_SUGGEST`.
|
|
178
|
+
*/
|
|
179
|
+
goalGraphSuggestMode?: GoalGraphSuggestMode;
|
|
158
180
|
}
|
|
159
181
|
/** Every AssistantConfig key, in the order every surface's settings UI/listing renders them. */
|
|
160
182
|
export declare const CONFIG_KEYS: readonly (keyof AssistantConfig)[];
|
package/dist/first-run.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssistantConfig, ConfigStore } from './config.js';
|
|
2
|
+
import { KeyTestResult, KeyedBackend } from './provider-setup.js';
|
|
2
3
|
export interface FirstRunDeps {
|
|
3
4
|
configStore: ConfigStore;
|
|
4
5
|
/** Result of `configStore.load()` — the setup is skipped entirely if this already names a backend/key. */
|
|
@@ -13,6 +14,8 @@ export interface FirstRunDeps {
|
|
|
13
14
|
detectClaudeCli: () => Promise<boolean>;
|
|
14
15
|
/** Where to print prompts/status (defaults to process.stdout in cli.ts). */
|
|
15
16
|
log: (line: string) => void;
|
|
17
|
+
/** Live-checks a key against the provider. Optional so unit tests can skip the network; cli.ts passes the real testApiKey. */
|
|
18
|
+
testKey?: (backend: KeyedBackend, key: string) => Promise<KeyTestResult>;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* Runs the first-run pass if needed. Returns the persisted config to use from
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure logic backing the hierarchical-goal-tree mechanism's Tier 0/1 gate — the
|
|
3
|
+
* `LiveSteeringChannel` producer/routing split (Phase 3), the Scope×Urgency classifier and
|
|
4
|
+
* `GoalGraphRecord` status writes (Phase 4) — see
|
|
5
|
+
* plans/hierarchical_goal_tree_and_steering_plan.html. Split out so it's unit-testable in
|
|
6
|
+
* isolation, the same pattern as one-loop-flag.ts/ask-mode-flag.ts/plan-mode-flag.ts.
|
|
7
|
+
*
|
|
8
|
+
* As of Phase 8, threaded through `AssistantConfig` exactly like those three: `goalGraphMode` is a
|
|
9
|
+
* real config field with `/config set` support, a `VITE_ASSISTANT_GOAL_GRAPH` build-time line in
|
|
10
|
+
* chat-ui's browser-config.ts, and flag-chain resolution tests (cli-config.test.ts,
|
|
11
|
+
* browser-config.test.ts). Before Phase 8 this mirrored the Trajectory Supervisor's own S0
|
|
12
|
+
* discipline ("flag defined, default OFF, read nowhere yet except a single guard stub"): cli.ts
|
|
13
|
+
* read it directly from `process.env.ASSISTANT_GOAL_GRAPH` via a `RunCliOptions.goalGraphMode`
|
|
14
|
+
* field (not `AssistantConfig`) and chat-ui's App.tsx read it directly from a module-level
|
|
15
|
+
* `import.meta.env.VITE_ASSISTANT_GOAL_GRAPH` constant — both now resolve through
|
|
16
|
+
* `config.goalGraphMode` instead, via `cli-config.ts`'s `envOverridesFromProcessEnv` /
|
|
17
|
+
* `browser-config.ts`'s `envOverridesFromImportMetaEnv`, both still ultimately calling
|
|
18
|
+
* `normalizeGoalGraphMode` below.
|
|
19
|
+
*
|
|
20
|
+
* Default ON ('enabled') as of 2026-09-23 (before that OFF; the 3-seed benchmark vs the queue-behind-the-turn baseline was neutral on success at lower cost). 'disabled' is the escape hatch: the CLI's `dispatchQueue` and chat-ui's busy-disables-composer
|
|
21
|
+
* behavior stay byte-identical to today (INV-43) — a message sent while a turn is running keeps
|
|
22
|
+
* waiting on `dispatchQueue` / the disabled composer, exactly as before. 'enabled' routes an
|
|
23
|
+
* in-flight message into a `LiveSteeringChannel` instead. This flag alone still has no consumer
|
|
24
|
+
* for it inside the harness's iteration loop (Phase 4 wires that in via the scope×urgency
|
|
25
|
+
* classifier) — see that phase's own notes for the actual reconciliation behavior.
|
|
26
|
+
*/
|
|
27
|
+
export type GoalGraphMode = 'enabled' | 'disabled';
|
|
28
|
+
export declare const DEFAULT_GOAL_GRAPH_MODE: GoalGraphMode;
|
|
29
|
+
/**
|
|
30
|
+
* The single place a resolved `config.goalGraphMode` becomes a boolean. `AssistantConfig.goalGraphMode`
|
|
31
|
+
* stays out of DEFAULT_CONFIG (undefined = "the package owns the default"), so every consumer must
|
|
32
|
+
* fall back to DEFAULT_GOAL_GRAPH_MODE rather than compare `=== 'enabled'` against a possibly-undefined value.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isGoalGraphEnabled(mode: GoalGraphMode | undefined): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Shared by cli.ts (reads `process.env.ASSISTANT_GOAL_GRAPH`) and chat-ui's App.tsx (reads Vite's
|
|
37
|
+
* `import.meta.env.VITE_ASSISTANT_GOAL_GRAPH`, which has no `process` to hand a
|
|
38
|
+
* `NodeJS.ProcessEnv` to). An unset or empty value falls back to the default silently; an
|
|
39
|
+
* unrecognized non-empty value falls back with a startup warning naming `varName`, the same
|
|
40
|
+
* typo-tolerance-with-a-warning convention normalizeOneLoopMode/normalizeAskMode/normalizePlanMode
|
|
41
|
+
* use.
|
|
42
|
+
*/
|
|
43
|
+
export declare function normalizeGoalGraphMode(raw: string | undefined, varName?: string): GoalGraphMode;
|
|
44
|
+
export declare function resolveGoalGraphMode(env: NodeJS.ProcessEnv): GoalGraphMode;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ILLMClient, MemoryAdapter, TokenUsage } from '@buildaharness/runtime';
|
|
2
|
+
import { UpdateChannel } from '@buildaharness/harness';
|
|
3
|
+
import { LiveSteeringChannel, SteeringEvent } from './live-steering-channel.js';
|
|
4
|
+
import { GoalGraphFsPersistence } from './goal-graph-store.js';
|
|
5
|
+
/**
|
|
6
|
+
* Phase 4 of plans/hierarchical_goal_tree_and_steering_plan.html — the Tier-1 reconcile pass that
|
|
7
|
+
* turns a drained LiveSteeringChannel (Phase 3) into a handled ask via the scope×urgency
|
|
8
|
+
* classifier. One message is classified per poll() — checkCallerUpdates polls once per harness
|
|
9
|
+
* iteration, so a backlog of several queued messages drains one per iteration rather than all at
|
|
10
|
+
* once.
|
|
11
|
+
*
|
|
12
|
+
* Every classified message ends in exactly one of two places — never dropped (R4):
|
|
13
|
+
*
|
|
14
|
+
* - **Applied in place** — a *steering note* the running turn's proposer reads before its next
|
|
15
|
+
* LLM call (`takeNotes()`): SAME_TASK always, SAME_GOAL_NEW_TASK when IMMEDIATE. The model
|
|
16
|
+
* itself interprets the note. Earlier revisions instead pushed the raw message text into the
|
|
17
|
+
* harness's `add_constraint` / `add_success_criteria`, which are enforced *lexically*
|
|
18
|
+
* (output-validation.ts's negation-word rule, criterionCovered's token overlap): a correction
|
|
19
|
+
* like "use the audited figure, not the draft one" then made the reply's own words a
|
|
20
|
+
* "violation" and threw the whole turn, and a criterion no proposer ever read was never acted
|
|
21
|
+
* on. Neither field is read by the one-loop proposer's LLM call, so neither can carry a
|
|
22
|
+
* natural-language ask.
|
|
23
|
+
* - **Deferred to a follow-up turn** — everything else (NEW_GOAL, SAME_GOAL_NEW_TASK×DEFERRED,
|
|
24
|
+
* CANCEL_CURRENT's replacement ask) plus any note the proposer never got to read (classified
|
|
25
|
+
* after its last LLM call). `drainUnconsumed()` returns these so the caller re-enqueues them on
|
|
26
|
+
* the LiveSteeringChannel, where the caller's post-turn drain (cli.ts / App.tsx) runs each as
|
|
27
|
+
* an ordinary turn, in arrival order.
|
|
28
|
+
*
|
|
29
|
+
* Goal-graph bookkeeping (NEW_GOAL mints a thread, CANCEL_CURRENT abandons the active one and
|
|
30
|
+
* blocks the task graph via `cancel_current`) is unchanged — INV-39: never writes the ACTIVE
|
|
31
|
+
* pointer except through the Scheduler's own forceActivateThread.
|
|
32
|
+
*/
|
|
33
|
+
export interface SteeringReconcileChannel {
|
|
34
|
+
channel: UpdateChannel;
|
|
35
|
+
/**
|
|
36
|
+
* Steering notes classified since the last call, for the proposer to fold into its next LLM
|
|
37
|
+
* call. Each is returned once and counted as applied — call it only when about to make that call.
|
|
38
|
+
*/
|
|
39
|
+
takeNotes(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Everything that must still be run as a follow-up turn: deferred asks, notes the proposer never
|
|
42
|
+
* took, and messages never classified at all (the harness run ended before its next poll). The
|
|
43
|
+
* caller re-enqueues these onto the original LiveSteeringChannel (R4).
|
|
44
|
+
*/
|
|
45
|
+
drainUnconsumed(): SteeringEvent[];
|
|
46
|
+
}
|
|
47
|
+
export declare function createSteeringReconcileChannel(params: {
|
|
48
|
+
steeringChannel: LiveSteeringChannel;
|
|
49
|
+
sessionId: string;
|
|
50
|
+
memory: MemoryAdapter;
|
|
51
|
+
llmClient: ILLMClient;
|
|
52
|
+
model?: string;
|
|
53
|
+
onUsage?: (usage: TokenUsage) => void;
|
|
54
|
+
fsPersistence?: GoalGraphFsPersistence;
|
|
55
|
+
}): SteeringReconcileChannel;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MemoryAdapter } from '@buildaharness/runtime';
|
|
2
|
+
import { GoalGraphFsPersistence, GoalThread, GoalThreadStatus, SiblingRelation } from './goal-graph-store.js';
|
|
3
|
+
/**
|
|
4
|
+
* R5's four visibility buckets, derived from fields Phases 1/4/5 already persist rather than any
|
|
5
|
+
* new schema or wiring: `mode: 'drafting'` is a thread proposed but not yet approved/committed to
|
|
6
|
+
* (Q1's absorbed PlanRecord semantics) — "suggested-but-not-committed"; `status: 'DONE'` is done;
|
|
7
|
+
* everything else is "freshly (re)computed this turn" when it has never been touched since
|
|
8
|
+
* creation (`createdAt === updatedAt`), else "carried over" from a prior turn.
|
|
9
|
+
*/
|
|
10
|
+
export type GoalThreadVisibility = 'suggested_not_committed' | 'done' | 'freshly_computed' | 'carried_over';
|
|
11
|
+
export declare function classifyThreadVisibility(thread: GoalThread): GoalThreadVisibility;
|
|
12
|
+
export interface GoalTaskSummary {
|
|
13
|
+
total: number;
|
|
14
|
+
complete: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
pending: number;
|
|
17
|
+
}
|
|
18
|
+
/** One thread as rendered by a review surface — a read-only projection, never the raw persisted `GoalThread` (callers have no business mutating it). */
|
|
19
|
+
export interface GoalThreadView {
|
|
20
|
+
id: string;
|
|
21
|
+
status: GoalThreadStatus;
|
|
22
|
+
visibility: GoalThreadVisibility;
|
|
23
|
+
successCriteria: string;
|
|
24
|
+
tasks: GoalTaskSummary;
|
|
25
|
+
relationToSiblings?: SiblingRelation;
|
|
26
|
+
siblingIds?: string[];
|
|
27
|
+
isActive: boolean;
|
|
28
|
+
/** Advisory next steps proposed when the thread reached DONE (high/medium confidence only — low is never persisted). Absent when there are none. */
|
|
29
|
+
suggestions?: {
|
|
30
|
+
description: string;
|
|
31
|
+
rationale: string;
|
|
32
|
+
confidence: 'high' | 'medium' | 'low';
|
|
33
|
+
}[];
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GoalGraphState {
|
|
38
|
+
activeThreadId: string | null;
|
|
39
|
+
threads: GoalThreadView[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* R5's review-surface entry point: every known GoalThread for `sessionId`, each tagged with its
|
|
43
|
+
* visibility bucket, plus the current focus pointer. Returns the empty state (never throws, never
|
|
44
|
+
* mints a record) when no goal graph exists yet for this session — same "nothing to show" shape as
|
|
45
|
+
* `getPlanState`'s `null`, just pre-shaped into an empty list instead, since a review surface wants
|
|
46
|
+
* something iterable, not a null check.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getGoalGraphState(memory: MemoryAdapter, sessionId: string, fsPersistence?: GoalGraphFsPersistence): Promise<GoalGraphState>;
|