@goah/cli 0.13.0 → 0.13.2
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/LICENSE +201 -0
- package/dist/THIRD-PARTY-NOTICES.md +2319 -0
- package/dist/anthropic-messages-WBFOHES5.js +7214 -0
- package/dist/azure-openai-responses-NZFH3PO6.js +253 -0
- package/dist/chunk-25XSBFX6.js +639 -0
- package/dist/chunk-2QBQZGXF.js +110 -0
- package/dist/chunk-2ZP2NBW3.js +345 -0
- package/dist/chunk-4KA63VNZ.js +2 -0
- package/dist/chunk-4M6TXTT5.js +86 -0
- package/dist/chunk-4US7ZHT3.js +20 -0
- package/dist/chunk-6M3OOCKO.js +11809 -0
- package/dist/chunk-7AXAFDPG.js +17 -0
- package/dist/chunk-7E7V6OIU.js +920 -0
- package/dist/chunk-BXA47DTF.js +548 -0
- package/dist/chunk-D2DVAH37.js +25 -0
- package/dist/chunk-FSBUS2BI.js +26 -0
- package/dist/chunk-GKDRAHLI.js +4787 -0
- package/dist/chunk-H462EFJP.js +89 -0
- package/dist/chunk-IIJQ3DW4.js +35 -0
- package/dist/chunk-JQD5EWJY.js +34 -0
- package/dist/chunk-K26BVR6O.js +61 -0
- package/dist/chunk-KAO7WIXG.js +31 -0
- package/dist/chunk-KJ4HJCTK.js +1178 -0
- package/dist/chunk-LBKI23CC.js +9810 -0
- package/dist/chunk-LKBKZEHT.js +41 -0
- package/dist/chunk-MD7TLTXZ.js +18 -0
- package/dist/chunk-MPXK7QBL.js +868 -0
- package/dist/chunk-NRLGWZJC.js +11 -0
- package/dist/chunk-QBD6EJ2Z.js +1746 -0
- package/dist/chunk-R6I3VKME.js +132 -0
- package/dist/chunk-TJON22J4.js +87 -0
- package/dist/chunk-ULY36ME4.js +33097 -0
- package/dist/chunk-XALZLRYK.js +9221 -0
- package/dist/chunk-XPQKM3L7.js +57 -0
- package/dist/chunk-YH6YJ2IB.js +1773 -0
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +13716 -580
- package/dist/console/assets/{index-Rtc_B7cs.js → index-B1vGMXKr.js} +11 -11
- package/dist/console/assets/{index-Rtc_B7cs.js.map → index-B1vGMXKr.js.map} +1 -1
- package/dist/console/index.html +1 -1
- package/dist/dist-65MDQA4Q.js +1126 -0
- package/dist/dist-KNR2XL6J.js +39 -0
- package/dist/execution.d.ts +557 -2
- package/dist/execution.js +37 -2
- package/dist/faux-runner-worker.js +128 -0
- package/dist/google-generative-ai-YMHXZSFE.js +422 -0
- package/dist/google-vertex-X6DB3ZQ6.js +471 -0
- package/dist/index.d.ts +853 -25
- package/dist/index.js +84 -385
- package/dist/kernel.d.ts +39 -2
- package/dist/kernel.js +21 -2
- package/dist/mistral-conversations-TY3MMD6G.js +718 -0
- package/dist/multipart-parser-F6M4NJZU.js +373 -0
- package/dist/openai-codex-responses-BRDUMLN5.js +1374 -0
- package/dist/openai-completions-CX634XN3.js +1139 -0
- package/dist/openai-responses-HMCXJIHT.js +300 -0
- package/dist/openrouter-images-KTWET2H2.js +148 -0
- package/dist/pi-messages-XL5OEC4K.js +307 -0
- package/dist/pi-worker.js +671 -0
- package/dist/runner-pi.d.ts +342 -2
- package/dist/runner-pi.js +46 -2
- package/dist/runner-registry-GD4BYCQC.js +22 -0
- package/dist/sqlite.d.ts +446 -2
- package/dist/sqlite.js +15 -2
- package/dist/src-F2KBSV4T.js +1398 -0
- package/dist/supervisor.d.ts +625 -2
- package/dist/supervisor.js +39 -2
- package/dist/testkit.d.ts +564 -2
- package/dist/testkit.js +127 -2
- package/dist/transcript.d.ts +84 -2
- package/dist/transcript.js +25 -2
- package/dist/verification-worker.js +72 -0
- package/package.json +2 -26
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/control.d.ts +0 -106
- package/dist/control.d.ts.map +0 -1
- package/dist/control.js +0 -242
- package/dist/control.js.map +0 -1
- package/dist/execution.d.ts.map +0 -1
- package/dist/execution.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kernel.d.ts.map +0 -1
- package/dist/kernel.js.map +0 -1
- package/dist/live-config.d.ts +0 -10
- package/dist/live-config.d.ts.map +0 -1
- package/dist/live-config.js +0 -44
- package/dist/live-config.js.map +0 -1
- package/dist/prompt-queue.d.ts +0 -13
- package/dist/prompt-queue.d.ts.map +0 -1
- package/dist/prompt-queue.js +0 -35
- package/dist/prompt-queue.js.map +0 -1
- package/dist/runner-pi.d.ts.map +0 -1
- package/dist/runner-pi.js.map +0 -1
- package/dist/runner-registry.d.ts +0 -8
- package/dist/runner-registry.d.ts.map +0 -1
- package/dist/runner-registry.js +0 -12
- package/dist/runner-registry.js.map +0 -1
- package/dist/searchable-select.d.ts +0 -24
- package/dist/searchable-select.d.ts.map +0 -1
- package/dist/searchable-select.js +0 -61
- package/dist/searchable-select.js.map +0 -1
- package/dist/secret-input.d.ts +0 -8
- package/dist/secret-input.d.ts.map +0 -1
- package/dist/secret-input.js +0 -14
- package/dist/secret-input.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -22
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -154
- package/dist/setup-wizard.js.map +0 -1
- package/dist/sqlite.d.ts.map +0 -1
- package/dist/sqlite.js.map +0 -1
- package/dist/supervisor.d.ts.map +0 -1
- package/dist/supervisor.js.map +0 -1
- package/dist/testkit.d.ts.map +0 -1
- package/dist/testkit.js.map +0 -1
- package/dist/thread-inspect.d.ts +0 -47
- package/dist/thread-inspect.d.ts.map +0 -1
- package/dist/thread-inspect.js +0 -78
- package/dist/thread-inspect.js.map +0 -1
- package/dist/transcript.d.ts.map +0 -1
- package/dist/transcript.js.map +0 -1
- package/dist/tui-theme.d.ts +0 -17
- package/dist/tui-theme.d.ts.map +0 -1
- package/dist/tui-theme.js +0 -19
- package/dist/tui-theme.js.map +0 -1
- package/dist/tui.d.ts +0 -24
- package/dist/tui.d.ts.map +0 -1
- package/dist/tui.js +0 -784
- package/dist/tui.js.map +0 -1
- package/dist/update.d.ts +0 -16
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -67
- package/dist/update.js.map +0 -1
- package/dist/web-console.d.ts +0 -33
- package/dist/web-console.d.ts.map +0 -1
- package/dist/web-console.js +0 -242
- package/dist/web-console.js.map +0 -1
- package/dist/welcome.d.ts +0 -30
- package/dist/welcome.d.ts.map +0 -1
- package/dist/welcome.js +0 -69
- package/dist/welcome.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/execution.d.ts +0 -544
- package/node_modules/goah-ledger-contract/dist/execution.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/execution.js +0 -52
- package/node_modules/goah-ledger-contract/dist/execution.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/index.d.ts +0 -4
- package/node_modules/goah-ledger-contract/dist/index.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/index.js +0 -4
- package/node_modules/goah-ledger-contract/dist/index.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts +0 -37
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/kernel.js +0 -8
- package/node_modules/goah-ledger-contract/dist/kernel.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/transcript.d.ts +0 -63
- package/node_modules/goah-ledger-contract/dist/transcript.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/transcript.js +0 -115
- package/node_modules/goah-ledger-contract/dist/transcript.js.map +0 -1
- package/node_modules/goah-ledger-contract/package.json +0 -28
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts +0 -86
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts.map +0 -1
- package/node_modules/goah-ledger-sqlite/dist/index.js +0 -1254
- package/node_modules/goah-ledger-sqlite/dist/index.js.map +0 -1
- package/node_modules/goah-ledger-sqlite/package.json +0 -26
- package/node_modules/goah-runner-pi/dist/configurator.d.ts +0 -20
- package/node_modules/goah-runner-pi/dist/configurator.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/configurator.js +0 -423
- package/node_modules/goah-runner-pi/dist/configurator.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/credential-store.d.ts +0 -14
- package/node_modules/goah-runner-pi/dist/credential-store.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/credential-store.js +0 -163
- package/node_modules/goah-runner-pi/dist/credential-store.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/env-spec.d.ts +0 -17
- package/node_modules/goah-runner-pi/dist/env-spec.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/env-spec.js +0 -95
- package/node_modules/goah-runner-pi/dist/env-spec.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/index.d.ts +0 -76
- package/node_modules/goah-runner-pi/dist/index.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/index.js +0 -326
- package/node_modules/goah-runner-pi/dist/index.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/model-provider.d.ts +0 -30
- package/node_modules/goah-runner-pi/dist/model-provider.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/model-provider.js +0 -96
- package/node_modules/goah-runner-pi/dist/model-provider.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts +0 -31
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/pi-worker.js +0 -579
- package/node_modules/goah-runner-pi/dist/pi-worker.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts +0 -2
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js +0 -3
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts +0 -2
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js +0 -5
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts +0 -2
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js +0 -5
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/test-helpers.d.ts +0 -4
- package/node_modules/goah-runner-pi/dist/test-helpers.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/test-helpers.js +0 -13
- package/node_modules/goah-runner-pi/dist/test-helpers.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/verification-worker.d.ts +0 -2
- package/node_modules/goah-runner-pi/dist/verification-worker.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/verification-worker.js +0 -46
- package/node_modules/goah-runner-pi/dist/verification-worker.js.map +0 -1
- package/node_modules/goah-runner-pi/package.json +0 -28
- package/node_modules/goah-supervisor/dist/context-view.d.ts +0 -30
- package/node_modules/goah-supervisor/dist/context-view.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/context-view.js +0 -58
- package/node_modules/goah-supervisor/dist/context-view.js.map +0 -1
- package/node_modules/goah-supervisor/dist/index.d.ts +0 -96
- package/node_modules/goah-supervisor/dist/index.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/index.js +0 -1075
- package/node_modules/goah-supervisor/dist/index.js.map +0 -1
- package/node_modules/goah-supervisor/dist/roles.d.ts +0 -4
- package/node_modules/goah-supervisor/dist/roles.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/roles.js +0 -29
- package/node_modules/goah-supervisor/dist/roles.js.map +0 -1
- package/node_modules/goah-supervisor/dist/verification.d.ts +0 -61
- package/node_modules/goah-supervisor/dist/verification.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/verification.js +0 -135
- package/node_modules/goah-supervisor/dist/verification.js.map +0 -1
- package/node_modules/goah-supervisor/package.json +0 -26
- package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts +0 -2
- package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts.map +0 -1
- package/node_modules/goah-testkit/dist/faux-runner-worker.js +0 -82
- package/node_modules/goah-testkit/dist/faux-runner-worker.js.map +0 -1
- package/node_modules/goah-testkit/dist/index.d.ts +0 -49
- package/node_modules/goah-testkit/dist/index.d.ts.map +0 -1
- package/node_modules/goah-testkit/dist/index.js +0 -96
- package/node_modules/goah-testkit/dist/index.js.map +0 -1
- package/node_modules/goah-testkit/package.json +0 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,838 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
|
|
3
|
+
declare const CONTRACT_VERSION: "0.13.0";
|
|
4
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
5
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
6
|
+
[key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
/** One append request. Sequence numbers are assigned by the ledger. */
|
|
9
|
+
interface EventInput {
|
|
10
|
+
streamId: string;
|
|
11
|
+
ts: string;
|
|
12
|
+
actor: string;
|
|
13
|
+
type: string;
|
|
14
|
+
data: JsonValue;
|
|
15
|
+
/** An unfamiliar reader may skip this event without changing replay semantics. */
|
|
16
|
+
ignorable?: true;
|
|
17
|
+
}
|
|
18
|
+
/** One immutable fact in the global ledger and in one logical stream. */
|
|
19
|
+
interface EventRecord extends EventInput {
|
|
20
|
+
seq: number;
|
|
21
|
+
streamSeq: number;
|
|
22
|
+
}
|
|
23
|
+
interface EventStore {
|
|
24
|
+
appendEvent(input: EventInput): EventRecord;
|
|
25
|
+
appendEvents(inputs: EventInput[]): EventRecord[];
|
|
26
|
+
readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
27
|
+
eventsSince(seq: number, types?: string[]): EventRecord[];
|
|
28
|
+
events(): EventRecord[];
|
|
29
|
+
}
|
|
30
|
+
interface Clock {
|
|
31
|
+
now(): Date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TranscriptMessage {
|
|
35
|
+
id: string;
|
|
36
|
+
role: "user" | "assistant" | "tool";
|
|
37
|
+
content: JsonValue;
|
|
38
|
+
toolCallId?: string;
|
|
39
|
+
usage?: JsonValue;
|
|
40
|
+
stopReason?: string;
|
|
41
|
+
errorMessage?: string;
|
|
42
|
+
}
|
|
43
|
+
interface RequestSnapshot {
|
|
44
|
+
provider: string;
|
|
45
|
+
model: string;
|
|
46
|
+
systemPrompt: string;
|
|
47
|
+
activeContext: string;
|
|
48
|
+
messages: JsonValue[];
|
|
49
|
+
tools: JsonValue[];
|
|
50
|
+
modelConfig: JsonValue;
|
|
51
|
+
sourceSeqs: number[];
|
|
52
|
+
}
|
|
53
|
+
interface ReplayedTranscript {
|
|
54
|
+
messages: TranscriptMessage[];
|
|
55
|
+
status: "running" | "completed" | "interrupted";
|
|
56
|
+
openToolCalls: Array<{
|
|
57
|
+
callId: string;
|
|
58
|
+
name: string;
|
|
59
|
+
arguments: JsonValue;
|
|
60
|
+
}>;
|
|
61
|
+
lastRequest: RequestSnapshot | null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type WakeStatus = "queued" | "claimed" | "consumed" | "cancelled";
|
|
65
|
+
type WakeTriggerStatus = "pending" | "resolved";
|
|
66
|
+
type ScheduleStatus = "pending" | "consumed" | "cancelled" | "superseded";
|
|
67
|
+
type GoalPhase = "active" | "paused" | "blocked" | "complete";
|
|
68
|
+
type TurnStatus = "in_progress" | "completed" | "failed" | "interrupted";
|
|
69
|
+
type TurnTriggerKind = "user_message" | "wake";
|
|
70
|
+
type SpecialistRole = "verifier" | "audit";
|
|
71
|
+
type AgentRole = "child" | "ceo" | "verifier" | "audit";
|
|
72
|
+
type AutomaticTarget = {
|
|
73
|
+
targetKind: "goal";
|
|
74
|
+
agent: string;
|
|
75
|
+
goalId: string;
|
|
76
|
+
specialistRole: null;
|
|
77
|
+
} | {
|
|
78
|
+
targetKind: "specialist";
|
|
79
|
+
agent: string;
|
|
80
|
+
goalId: null;
|
|
81
|
+
specialistRole: SpecialistRole;
|
|
82
|
+
};
|
|
83
|
+
type MailRoute = {
|
|
84
|
+
routeKind: "goal";
|
|
85
|
+
goalId: string;
|
|
86
|
+
specialistRole: null;
|
|
87
|
+
} | {
|
|
88
|
+
routeKind: "human_inbox";
|
|
89
|
+
goalId: null;
|
|
90
|
+
specialistRole: null;
|
|
91
|
+
} | {
|
|
92
|
+
routeKind: "human_request";
|
|
93
|
+
goalId: null;
|
|
94
|
+
specialistRole: null;
|
|
95
|
+
} | {
|
|
96
|
+
routeKind: "specialist_inbox";
|
|
97
|
+
goalId: null;
|
|
98
|
+
specialistRole: SpecialistRole;
|
|
99
|
+
};
|
|
100
|
+
type TurnItemType = "user_message" | "assistant_message" | "reasoning" | "tool_call" | "tool_result" | "plan" | "handoff";
|
|
101
|
+
type TurnItemStatus = "in_progress" | "completed" | "failed";
|
|
102
|
+
interface ThreadSnapshot {
|
|
103
|
+
id: string;
|
|
104
|
+
agent: string;
|
|
105
|
+
role: AgentRole;
|
|
106
|
+
parentThreadId: string | null;
|
|
107
|
+
createdAt: string;
|
|
108
|
+
updatedAt: string;
|
|
109
|
+
}
|
|
110
|
+
interface GoalCommitment {
|
|
111
|
+
goalId: string;
|
|
112
|
+
goalRevision: number;
|
|
113
|
+
}
|
|
114
|
+
type TurnSnapshot = {
|
|
115
|
+
id: string;
|
|
116
|
+
threadId: string;
|
|
117
|
+
triggerKind: TurnTriggerKind;
|
|
118
|
+
goalId: string | null;
|
|
119
|
+
goalRevision: number | null;
|
|
120
|
+
status: TurnStatus;
|
|
121
|
+
attempt: number;
|
|
122
|
+
error: JsonValue | null;
|
|
123
|
+
startedAt: string;
|
|
124
|
+
endedAt: string | null;
|
|
125
|
+
leaseUntil: string | null;
|
|
126
|
+
leaseToken: string | null;
|
|
127
|
+
runnerPid: number | null;
|
|
128
|
+
runnerProfileId?: string;
|
|
129
|
+
};
|
|
130
|
+
interface TurnItemSnapshot {
|
|
131
|
+
id: string;
|
|
132
|
+
turnId: string;
|
|
133
|
+
ordinal: number;
|
|
134
|
+
type: TurnItemType;
|
|
135
|
+
status: TurnItemStatus;
|
|
136
|
+
data: JsonValue;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
completedAt: string | null;
|
|
139
|
+
}
|
|
140
|
+
interface GoalSnapshot {
|
|
141
|
+
id: string;
|
|
142
|
+
parentId: string | null;
|
|
143
|
+
objective: string;
|
|
144
|
+
observationMethod: string | null;
|
|
145
|
+
verificationMethod: string | null;
|
|
146
|
+
owner: string;
|
|
147
|
+
phase: GoalPhase;
|
|
148
|
+
revision: number;
|
|
149
|
+
}
|
|
150
|
+
type GoalChangeOperation = "create" | "revise" | "pause" | "resume" | "block" | "complete" | "reassign";
|
|
151
|
+
type GoalChangeAuthority = {
|
|
152
|
+
kind: "human";
|
|
153
|
+
} | {
|
|
154
|
+
kind: "parent_goal";
|
|
155
|
+
goalId: string;
|
|
156
|
+
goalRevision: number;
|
|
157
|
+
} | {
|
|
158
|
+
kind: "system";
|
|
159
|
+
reason: string;
|
|
160
|
+
};
|
|
161
|
+
interface GoalChangeMetadata {
|
|
162
|
+
operation: GoalChangeOperation;
|
|
163
|
+
reason: string;
|
|
164
|
+
evidence: number[];
|
|
165
|
+
authority?: GoalChangeAuthority;
|
|
166
|
+
sourceTurnId?: string;
|
|
167
|
+
sourceWakeId?: string;
|
|
168
|
+
idempotencyKey?: string;
|
|
169
|
+
}
|
|
170
|
+
interface WorkRecordSnapshot {
|
|
171
|
+
goalId: string;
|
|
172
|
+
recordRevision: number;
|
|
173
|
+
goalRevision: number;
|
|
174
|
+
content: string;
|
|
175
|
+
updatedBy: string;
|
|
176
|
+
updatedInTurn: string;
|
|
177
|
+
sourceWakeId: string | null;
|
|
178
|
+
updatedAt: string;
|
|
179
|
+
reason: string;
|
|
180
|
+
evidence: number[];
|
|
181
|
+
lastEventSeq: number;
|
|
182
|
+
}
|
|
183
|
+
interface WorkRecordUpdateRequest {
|
|
184
|
+
goalId: string;
|
|
185
|
+
expectedRevision: number;
|
|
186
|
+
goalRevision: number;
|
|
187
|
+
content: string;
|
|
188
|
+
reason: string;
|
|
189
|
+
evidence: number[];
|
|
190
|
+
turnId: string;
|
|
191
|
+
sourceWakeId?: string;
|
|
192
|
+
}
|
|
193
|
+
interface WorkRecordDiff {
|
|
194
|
+
goalId: string;
|
|
195
|
+
fromRevision: number;
|
|
196
|
+
toRevision: number;
|
|
197
|
+
text: string;
|
|
198
|
+
}
|
|
199
|
+
type ScheduleSnapshot = AutomaticTarget & {
|
|
200
|
+
id: string;
|
|
201
|
+
nextWakeAt: string;
|
|
202
|
+
reason: string;
|
|
203
|
+
setBy: string;
|
|
204
|
+
status: ScheduleStatus;
|
|
205
|
+
resolvedAt: string | null;
|
|
206
|
+
};
|
|
207
|
+
type WakeSnapshot = AutomaticTarget & {
|
|
208
|
+
id: string;
|
|
209
|
+
/** Initial trigger retained for display and provenance. Runtime decisions use WakeTriggerSnapshot. */
|
|
210
|
+
triggerRef: string;
|
|
211
|
+
status: WakeStatus;
|
|
212
|
+
attempt: number;
|
|
213
|
+
enqueuedSeq: number;
|
|
214
|
+
claimedAt: string | null;
|
|
215
|
+
consumedAt: string | null;
|
|
216
|
+
turnId: string | null;
|
|
217
|
+
};
|
|
218
|
+
interface WakeTriggerSnapshot {
|
|
219
|
+
wakeId: string;
|
|
220
|
+
agent: string;
|
|
221
|
+
triggerRef: string;
|
|
222
|
+
source: "goal" | "system";
|
|
223
|
+
status: WakeTriggerStatus;
|
|
224
|
+
addedAt: string;
|
|
225
|
+
resolvedAt: string | null;
|
|
226
|
+
}
|
|
227
|
+
type MailLevel = "fyi" | "decision" | "emergency";
|
|
228
|
+
type MailSnapshot = MailRoute & {
|
|
229
|
+
id: string;
|
|
230
|
+
to: string;
|
|
231
|
+
from: string;
|
|
232
|
+
level: MailLevel;
|
|
233
|
+
body: JsonValue;
|
|
234
|
+
readAt: string | null;
|
|
235
|
+
};
|
|
236
|
+
interface DelegationRequest {
|
|
237
|
+
id: string;
|
|
238
|
+
parentGoalId: string;
|
|
239
|
+
expectedParentRevision: number;
|
|
240
|
+
childGoal: {
|
|
241
|
+
id: string;
|
|
242
|
+
objective: string;
|
|
243
|
+
observationMethod: string;
|
|
244
|
+
verificationMethod: string;
|
|
245
|
+
owner: string;
|
|
246
|
+
};
|
|
247
|
+
brief: JsonValue;
|
|
248
|
+
reason: string;
|
|
249
|
+
evidence: number[];
|
|
250
|
+
sourceTurnId?: string;
|
|
251
|
+
}
|
|
252
|
+
interface DelegationResult {
|
|
253
|
+
delegationId: string;
|
|
254
|
+
goal: GoalSnapshot;
|
|
255
|
+
mail: MailSnapshot;
|
|
256
|
+
wake: WakeSnapshot;
|
|
257
|
+
}
|
|
258
|
+
interface ReassignmentRequest {
|
|
259
|
+
id: string;
|
|
260
|
+
goalId: string;
|
|
261
|
+
expectedGoalRevision: number;
|
|
262
|
+
newOwner: string;
|
|
263
|
+
brief: JsonValue;
|
|
264
|
+
reason: string;
|
|
265
|
+
evidence: number[];
|
|
266
|
+
sourceTurnId?: string;
|
|
267
|
+
}
|
|
268
|
+
interface ReassignmentResult {
|
|
269
|
+
reassignmentId: string;
|
|
270
|
+
goal: GoalSnapshot;
|
|
271
|
+
mail: MailSnapshot[];
|
|
272
|
+
wake: WakeSnapshot | null;
|
|
273
|
+
}
|
|
274
|
+
interface GoalCompletionRequest {
|
|
275
|
+
goalId: string;
|
|
276
|
+
revision: number;
|
|
277
|
+
reason: string;
|
|
278
|
+
evidence: number[];
|
|
279
|
+
sourceTurnId?: string;
|
|
280
|
+
}
|
|
281
|
+
type TeamMemberMotion = "running" | "queued" | "scheduled" | "idle" | "retired";
|
|
282
|
+
interface TeamMemberView {
|
|
283
|
+
agent: string;
|
|
284
|
+
goalIds: string[];
|
|
285
|
+
motion: TeamMemberMotion;
|
|
286
|
+
lastOutcome: GoalOutcome | null;
|
|
287
|
+
lastHandoffSeq: number | null;
|
|
288
|
+
lastWakeStatus: WakeStatus | null;
|
|
289
|
+
nextWakeAt: string | null;
|
|
290
|
+
}
|
|
291
|
+
type GoalOutcome = "progress" | "waiting" | "blocked" | "completion_proposed";
|
|
292
|
+
interface AgentHandoff {
|
|
293
|
+
outcome: GoalOutcome;
|
|
294
|
+
evidence: number[];
|
|
295
|
+
}
|
|
296
|
+
interface GoalHandoff extends AgentHandoff {
|
|
297
|
+
goalId: string;
|
|
298
|
+
goalRevision: number;
|
|
299
|
+
recordRevision: number;
|
|
300
|
+
}
|
|
301
|
+
interface TurnOutput {
|
|
302
|
+
validationAttemptId: number;
|
|
303
|
+
validationToken: string;
|
|
304
|
+
handoff: AgentHandoff;
|
|
305
|
+
}
|
|
306
|
+
interface CommittedTurnOutput {
|
|
307
|
+
handoff: GoalHandoff;
|
|
308
|
+
}
|
|
309
|
+
interface RunnerTraceEvent {
|
|
310
|
+
type: string;
|
|
311
|
+
data: JsonValue;
|
|
312
|
+
}
|
|
313
|
+
type AgentCapability = "ledger.search" | "mail.send" | "schedule.set" | "goal.put" | "team.list" | "goal.get" | "goal.create" | "goal.work" | "goal.delegate" | "goal.reassign" | "goal.revise" | "goal.pause" | "goal.resume" | "goal.complete" | "human.request" | "work_record.list" | "work_record.read" | "work_record.history" | "work_record.diff" | "work_record.search" | "work_record.update" | "memory.append";
|
|
314
|
+
type RunnerControlMethod = "goal.handoff.validate";
|
|
315
|
+
type RunnerRpcMethod = AgentCapability | RunnerControlMethod;
|
|
316
|
+
interface RunnerProfile {
|
|
317
|
+
id: string;
|
|
318
|
+
runner: string;
|
|
319
|
+
config: JsonValue;
|
|
320
|
+
credentialRefs?: string[];
|
|
321
|
+
}
|
|
322
|
+
interface AgentProfile {
|
|
323
|
+
agent: string;
|
|
324
|
+
role: AgentRole;
|
|
325
|
+
capabilities?: AgentCapability[];
|
|
326
|
+
systemPrompt?: string;
|
|
327
|
+
runnerProfile?: string;
|
|
328
|
+
}
|
|
329
|
+
type TurnTrigger = {
|
|
330
|
+
kind: "user_message";
|
|
331
|
+
} | {
|
|
332
|
+
kind: "wake";
|
|
333
|
+
reasons: string[];
|
|
334
|
+
};
|
|
335
|
+
interface TurnContext {
|
|
336
|
+
trigger: TurnTrigger;
|
|
337
|
+
activeGoal: GoalSnapshot | null;
|
|
338
|
+
goalCommitment: GoalCommitment | null;
|
|
339
|
+
}
|
|
340
|
+
interface AssistantResponse {
|
|
341
|
+
content: string;
|
|
342
|
+
}
|
|
343
|
+
interface RunRequest {
|
|
344
|
+
agent: string;
|
|
345
|
+
execution: TurnSnapshot;
|
|
346
|
+
sourceWake?: WakeSnapshot;
|
|
347
|
+
sourceWakeTriggers?: WakeTriggerSnapshot[];
|
|
348
|
+
turn: TurnContext;
|
|
349
|
+
context: JsonValue;
|
|
350
|
+
now(): string;
|
|
351
|
+
emit(event: RunnerTraceEvent): void;
|
|
352
|
+
rpc?(method: RunnerRpcMethod, params: JsonValue): Promise<JsonValue>;
|
|
353
|
+
}
|
|
354
|
+
type RunnerCandidateResult = {
|
|
355
|
+
outcome: "completed";
|
|
356
|
+
response: AssistantResponse;
|
|
357
|
+
handoff?: TurnOutput;
|
|
358
|
+
} | {
|
|
359
|
+
outcome: "abnormal";
|
|
360
|
+
reason: string;
|
|
361
|
+
};
|
|
362
|
+
interface RunnerHandle {
|
|
363
|
+
pid: number | null;
|
|
364
|
+
begin(): void;
|
|
365
|
+
result: Promise<RunnerCandidateResult>;
|
|
366
|
+
steer?(message: string): Promise<void>;
|
|
367
|
+
terminate(): Promise<void>;
|
|
368
|
+
}
|
|
369
|
+
interface Runner {
|
|
370
|
+
readonly isolation: "process";
|
|
371
|
+
prepare(request: RunRequest): RunnerHandle;
|
|
372
|
+
terminateProcess(pid: number, runnerProfileId?: string): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
interface HandoffCommit {
|
|
375
|
+
agent: string;
|
|
376
|
+
turnId: string;
|
|
377
|
+
sourceWakeId: string | null;
|
|
378
|
+
mailIds: string[];
|
|
379
|
+
ts: string;
|
|
380
|
+
output: CommittedTurnOutput;
|
|
381
|
+
responseItemId: string;
|
|
382
|
+
item: TurnItemSnapshot;
|
|
383
|
+
}
|
|
384
|
+
interface HumanTurnAdmissionRequest {
|
|
385
|
+
thread: ThreadSnapshot;
|
|
386
|
+
turn: TurnSnapshot;
|
|
387
|
+
messageItem: TurnItemSnapshot;
|
|
388
|
+
replaceTurnId: string | null;
|
|
389
|
+
rootGoal?: GoalSnapshot;
|
|
390
|
+
}
|
|
391
|
+
interface HumanTurnAdmissionResult {
|
|
392
|
+
turn: TurnSnapshot;
|
|
393
|
+
replacedTurn: TurnSnapshot | null;
|
|
394
|
+
goal: GoalSnapshot | null;
|
|
395
|
+
}
|
|
396
|
+
/** Standard execution modules composed on top of the generic event store. */
|
|
397
|
+
interface Ledger extends EventStore {
|
|
398
|
+
putThread(thread: ThreadSnapshot, actor: string): EventRecord;
|
|
399
|
+
putTurn(turn: TurnSnapshot, actor: string): EventRecord;
|
|
400
|
+
admitHumanTurn(request: HumanTurnAdmissionRequest): HumanTurnAdmissionResult;
|
|
401
|
+
commitTurnToGoal(turnId: string, goal: GoalCommitment, actor: string): TurnSnapshot;
|
|
402
|
+
putTurnItem(item: TurnItemSnapshot, actor: string): EventRecord;
|
|
403
|
+
thread(id: string): ThreadSnapshot | null;
|
|
404
|
+
threads(): ThreadSnapshot[];
|
|
405
|
+
turn(id: string): TurnSnapshot | null;
|
|
406
|
+
turns(threadId?: string): TurnSnapshot[];
|
|
407
|
+
turnItems(turnId: string): TurnItemSnapshot[];
|
|
408
|
+
activeTurn(threadId: string): TurnSnapshot | null;
|
|
409
|
+
putGoal(goal: GoalSnapshot, actor: string, wakeId?: string, change?: GoalChangeMetadata): EventRecord;
|
|
410
|
+
updateWorkRecord(request: WorkRecordUpdateRequest, actor: string): WorkRecordSnapshot;
|
|
411
|
+
commitDelegation(request: DelegationRequest, actor: string, wakeId?: string): DelegationResult;
|
|
412
|
+
commitReassignment(request: ReassignmentRequest, actor: string, wakeId?: string): ReassignmentResult;
|
|
413
|
+
completeGoal(request: GoalCompletionRequest, actor: string, wakeId?: string): GoalSnapshot;
|
|
414
|
+
putSchedule(schedule: ScheduleSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
415
|
+
consumeSchedule(id: string, wake: WakeSnapshot, now: string): {
|
|
416
|
+
schedule: ScheduleSnapshot;
|
|
417
|
+
wake: WakeSnapshot;
|
|
418
|
+
};
|
|
419
|
+
cancelSchedule(id: string, now: string): ScheduleSnapshot;
|
|
420
|
+
supersedeSchedule(id: string, now: string): ScheduleSnapshot;
|
|
421
|
+
enqueueWake(wake: WakeSnapshot, actor: string): {
|
|
422
|
+
event: EventRecord;
|
|
423
|
+
created: boolean;
|
|
424
|
+
};
|
|
425
|
+
addWakeTrigger(wakeId: string, triggerRef: string, actor: string): WakeTriggerSnapshot;
|
|
426
|
+
claimNextWake(now: string): WakeSnapshot | null;
|
|
427
|
+
startTurnFromWake(id: string, turn: TurnSnapshot, now: string): WakeSnapshot;
|
|
428
|
+
releaseWake(id: string, now: string): WakeSnapshot;
|
|
429
|
+
cancelWake(id: string, now: string): WakeSnapshot;
|
|
430
|
+
attachTurnProcess(id: string, leaseToken: string, pid: number): TurnSnapshot;
|
|
431
|
+
renewTurnLease(id: string, leaseToken: string, leaseUntil: string, now: string): TurnSnapshot;
|
|
432
|
+
appendTurnEvent(input: EventInput, leaseToken: string): EventRecord;
|
|
433
|
+
repairTurnAttempt(id: string, reason: string, now: string, actor: string): TurnItemSnapshot[];
|
|
434
|
+
finishTurn(id: string, status: "completed" | "failed" | "interrupted", error: JsonValue | null, now: string, actor: string, mailIds?: string[]): TurnSnapshot;
|
|
435
|
+
releaseTurnProcess(id: string, actor: string): TurnSnapshot;
|
|
436
|
+
putMail(mail: MailSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
437
|
+
putMails(mail: MailSnapshot[], actor: string, wakeId?: string): EventRecord[];
|
|
438
|
+
commitHandoff(commit: HandoffCommit): EventRecord;
|
|
439
|
+
dueSchedules(now: string): ScheduleSnapshot[];
|
|
440
|
+
unreadMail(agent: string): MailSnapshot[];
|
|
441
|
+
lastEvent(actor: string, type: string): EventRecord | null;
|
|
442
|
+
lastGoalHandoff(goalId: string): EventRecord | null;
|
|
443
|
+
latestEvent(): EventRecord | null;
|
|
444
|
+
eventsForWake(wakeId: string): EventRecord[];
|
|
445
|
+
wake(id: string): WakeSnapshot | null;
|
|
446
|
+
wakeByTrigger(agent: string, triggerRef: string): WakeSnapshot | null;
|
|
447
|
+
wakeTriggers(wakeId: string): WakeTriggerSnapshot[];
|
|
448
|
+
wakeTriggersForAgent(agent: string): WakeTriggerSnapshot[];
|
|
449
|
+
queuedWakeForAgent(agent: string): WakeSnapshot | null;
|
|
450
|
+
goalsForOwner(owner: string): GoalSnapshot[];
|
|
451
|
+
goal(id: string): GoalSnapshot | null;
|
|
452
|
+
workRecord(goalId: string): WorkRecordSnapshot | null;
|
|
453
|
+
workRecordHistory(goalId: string): WorkRecordSnapshot[];
|
|
454
|
+
workRecordDiff(goalId: string, fromRevision: number, toRevision: number): WorkRecordDiff;
|
|
455
|
+
searchWorkRecords(query: string, limit?: number): WorkRecordSnapshot[];
|
|
456
|
+
triggeringMail(): MailSnapshot[];
|
|
457
|
+
searchEvents(query: string, limit?: number): EventRecord[];
|
|
458
|
+
goals(): GoalSnapshot[];
|
|
459
|
+
workRecords(): WorkRecordSnapshot[];
|
|
460
|
+
schedules(): ScheduleSnapshot[];
|
|
461
|
+
wakes(): WakeSnapshot[];
|
|
462
|
+
mailbox(): MailSnapshot[];
|
|
463
|
+
rebuildProjections(): void;
|
|
464
|
+
close(): void;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
type FaultPoint = "after_event_before_projection" | "after_delegation_event" | "after_reassignment_event" | "after_human_goal_before_turn" | "after_human_replacement_before_turn";
|
|
468
|
+
type FaultInjector = (point: FaultPoint) => void;
|
|
469
|
+
interface SqliteLedgerOptions {
|
|
470
|
+
faultInjector?: FaultInjector;
|
|
471
|
+
clock?: Clock;
|
|
472
|
+
busyTimeoutMs?: number;
|
|
473
|
+
}
|
|
474
|
+
declare class SqliteLedger implements Ledger {
|
|
475
|
+
#private;
|
|
476
|
+
readonly db: DatabaseSync;
|
|
477
|
+
constructor(path?: string, options?: SqliteLedgerOptions);
|
|
478
|
+
close(): void;
|
|
479
|
+
appendEvent(input: EventInput): EventRecord;
|
|
480
|
+
appendEvents(inputs: EventInput[]): EventRecord[];
|
|
481
|
+
readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
482
|
+
putThread(thread: ThreadSnapshot, actor: string): EventRecord;
|
|
483
|
+
putTurn(turn: TurnSnapshot, actor: string): EventRecord;
|
|
484
|
+
admitHumanTurn(request: HumanTurnAdmissionRequest): HumanTurnAdmissionResult;
|
|
485
|
+
commitTurnToGoal(turnId: string, binding: {
|
|
486
|
+
goalId: string;
|
|
487
|
+
goalRevision: number;
|
|
488
|
+
}, actor: string): TurnSnapshot;
|
|
489
|
+
putTurnItem(item: TurnItemSnapshot, actor: string): EventRecord;
|
|
490
|
+
thread(id: string): ThreadSnapshot | null;
|
|
491
|
+
threads(): ThreadSnapshot[];
|
|
492
|
+
turn(id: string): TurnSnapshot | null;
|
|
493
|
+
turns(threadId?: string): TurnSnapshot[];
|
|
494
|
+
turnItems(turnId: string): TurnItemSnapshot[];
|
|
495
|
+
activeTurn(threadId: string): TurnSnapshot | null;
|
|
496
|
+
putGoal(goal: GoalSnapshot, actor: string, wakeId?: string, change?: GoalChangeMetadata): EventRecord;
|
|
497
|
+
updateWorkRecord(request: WorkRecordUpdateRequest, actor: string): WorkRecordSnapshot;
|
|
498
|
+
commitDelegation(request: DelegationRequest, actor: string, wakeId?: string): DelegationResult;
|
|
499
|
+
commitReassignment(request: ReassignmentRequest, actor: string, wakeId?: string): ReassignmentResult;
|
|
500
|
+
completeGoal(request: GoalCompletionRequest, actor: string, wakeId?: string): GoalSnapshot;
|
|
501
|
+
putSchedule(value: ScheduleSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
502
|
+
consumeSchedule(id: string, wake: WakeSnapshot, now: string): {
|
|
503
|
+
schedule: ScheduleSnapshot;
|
|
504
|
+
wake: WakeSnapshot;
|
|
505
|
+
};
|
|
506
|
+
cancelSchedule(id: string, now: string): ScheduleSnapshot;
|
|
507
|
+
supersedeSchedule(id: string, now: string): ScheduleSnapshot;
|
|
508
|
+
enqueueWake(input: WakeSnapshot, actor: string): {
|
|
509
|
+
event: EventRecord;
|
|
510
|
+
created: boolean;
|
|
511
|
+
};
|
|
512
|
+
addWakeTrigger(wakeId: string, triggerRef: string, actor: string): WakeTriggerSnapshot;
|
|
513
|
+
claimNextWake(now: string): WakeSnapshot | null;
|
|
514
|
+
startTurnFromWake(id: string, turn: TurnSnapshot, now: string): WakeSnapshot;
|
|
515
|
+
releaseWake(id: string, now: string): WakeSnapshot;
|
|
516
|
+
cancelWake(id: string, now: string): WakeSnapshot;
|
|
517
|
+
attachTurnProcess(id: string, leaseToken: string, pid: number): TurnSnapshot;
|
|
518
|
+
renewTurnLease(id: string, leaseToken: string, leaseUntil: string, now: string): TurnSnapshot;
|
|
519
|
+
appendTurnEvent(input: EventInput, leaseToken: string): EventRecord;
|
|
520
|
+
repairTurnAttempt(id: string, reason: string, now: string, actor: string): TurnItemSnapshot[];
|
|
521
|
+
finishTurn(id: string, status: "completed" | "failed" | "interrupted", error: JsonValue | null, now: string, actor: string, mailIds?: string[]): TurnSnapshot;
|
|
522
|
+
releaseTurnProcess(id: string, actor: string): TurnSnapshot;
|
|
523
|
+
putMail(mail: MailSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
524
|
+
putMails(mails: MailSnapshot[], actor: string, wakeId?: string): EventRecord[];
|
|
525
|
+
commitHandoff(commit: HandoffCommit): EventRecord;
|
|
526
|
+
dueSchedules(now: string): ScheduleSnapshot[];
|
|
527
|
+
unreadMail(agent: string): MailSnapshot[];
|
|
528
|
+
lastEvent(actor: string, type: string): EventRecord | null;
|
|
529
|
+
lastGoalHandoff(goalId: string): EventRecord | null;
|
|
530
|
+
latestEvent(): EventRecord | null;
|
|
531
|
+
eventsForWake(wakeId: string): EventRecord[];
|
|
532
|
+
wake(id: string): WakeSnapshot | null;
|
|
533
|
+
wakeByTrigger(agent: string, triggerRef: string): WakeSnapshot | null;
|
|
534
|
+
wakeTriggers(wakeId: string): WakeTriggerSnapshot[];
|
|
535
|
+
wakeTriggersForAgent(agent: string): WakeTriggerSnapshot[];
|
|
536
|
+
queuedWakeForAgent(agent: string): WakeSnapshot | null;
|
|
537
|
+
goalsForOwner(owner: string): GoalSnapshot[];
|
|
538
|
+
goal(id: string): GoalSnapshot | null;
|
|
539
|
+
workRecord(goalId: string): WorkRecordSnapshot | null;
|
|
540
|
+
workRecordHistory(goalId: string): WorkRecordSnapshot[];
|
|
541
|
+
workRecordDiff(goalId: string, fromRevision: number, toRevision: number): WorkRecordDiff;
|
|
542
|
+
searchWorkRecords(query: string, limit?: number): WorkRecordSnapshot[];
|
|
543
|
+
triggeringMail(): MailSnapshot[];
|
|
544
|
+
eventsSince(seq: number, types?: string[]): EventRecord[];
|
|
545
|
+
searchEvents(query: string, limit?: number): EventRecord[];
|
|
546
|
+
events(): EventRecord[];
|
|
547
|
+
goals(): GoalSnapshot[];
|
|
548
|
+
workRecords(): WorkRecordSnapshot[];
|
|
549
|
+
schedules(): ScheduleSnapshot[];
|
|
550
|
+
wakes(): WakeSnapshot[];
|
|
551
|
+
mailbox(): MailSnapshot[];
|
|
552
|
+
rebuildProjections(): void;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
interface SupervisorOptions {
|
|
556
|
+
leaseMs?: number;
|
|
557
|
+
memoryTailChars?: number;
|
|
558
|
+
retryPolicy?: {
|
|
559
|
+
maxAttempts: number;
|
|
560
|
+
baseDelayMs: number;
|
|
561
|
+
};
|
|
562
|
+
turnRetryPolicy?: {
|
|
563
|
+
maxAttempts: number;
|
|
564
|
+
baseDelayMs: number;
|
|
565
|
+
};
|
|
566
|
+
profiles?: AgentProfile[];
|
|
567
|
+
runnerProfiles?: RunnerProfile[];
|
|
568
|
+
}
|
|
569
|
+
declare class Supervisor {
|
|
570
|
+
#private;
|
|
571
|
+
readonly ledger: Ledger;
|
|
572
|
+
readonly clock: Clock;
|
|
573
|
+
constructor(ledger: Ledger, runner: Runner, clock: Clock, options?: SupervisorOptions);
|
|
574
|
+
/**
|
|
575
|
+
* Hot-swap the runner after a config reload. Refused while a Turn is active:
|
|
576
|
+
* a live child must never observe its runner vanish mid-flight.
|
|
577
|
+
* The next Turn uses the new runner, and spawn-time env
|
|
578
|
+
* resolution applies the new credentials to the next spawn.
|
|
579
|
+
*/
|
|
580
|
+
swapRunner(runner: Runner, profiles?: RunnerProfile[]): void;
|
|
581
|
+
get runner(): Runner;
|
|
582
|
+
createGoal(goal: GoalSnapshot, actor?: string): void;
|
|
583
|
+
createRootGoal(objective: string, id?: string, sourceTurnId?: string): GoalSnapshot;
|
|
584
|
+
startGoal(objective: string, id?: string): {
|
|
585
|
+
goal: GoalSnapshot;
|
|
586
|
+
wake: WakeSnapshot;
|
|
587
|
+
};
|
|
588
|
+
threadFor(agent?: string): ThreadSnapshot;
|
|
589
|
+
startHumanTurn(message: string): Promise<{
|
|
590
|
+
threadId: string;
|
|
591
|
+
turnId: string;
|
|
592
|
+
steered: boolean;
|
|
593
|
+
}>;
|
|
594
|
+
startHumanGoalTurn(objective: string, id?: string): Promise<{
|
|
595
|
+
threadId: string;
|
|
596
|
+
turnId: string;
|
|
597
|
+
steered: false;
|
|
598
|
+
goal: GoalSnapshot;
|
|
599
|
+
}>;
|
|
600
|
+
interruptTurn(turnId: string): Promise<TurnSnapshot>;
|
|
601
|
+
sendToCeo(body: JsonValue): Promise<{
|
|
602
|
+
threadId: string;
|
|
603
|
+
turnId: string;
|
|
604
|
+
steered: boolean;
|
|
605
|
+
}>;
|
|
606
|
+
waitForTurn(turnId: string): Promise<void>;
|
|
607
|
+
delegate(request: DelegationRequest, actor?: string, wakeId?: string): DelegationResult;
|
|
608
|
+
reassignGoal(request: ReassignmentRequest, actor?: string, wakeId?: string): Promise<ReassignmentResult>;
|
|
609
|
+
teamList(now?: string): TeamMemberView[];
|
|
610
|
+
currentRoot(): GoalSnapshot | null;
|
|
611
|
+
agentRole(agent: string): AgentRole;
|
|
612
|
+
updateGoal(id: string, patch: Partial<Pick<GoalSnapshot, "objective" | "observationMethod" | "verificationMethod">>, actor?: string, change?: {
|
|
613
|
+
reason: string;
|
|
614
|
+
evidence: number[];
|
|
615
|
+
sourceTurnId?: string;
|
|
616
|
+
sourceWakeId?: string;
|
|
617
|
+
}): GoalSnapshot;
|
|
618
|
+
confirmObservationMethod(id: string, observationMethod: string): GoalSnapshot;
|
|
619
|
+
reviseChildGoal(id: string, objective: string, observationMethod: string, verificationMethod: string, actor: string, reason: string, evidence: number[], wakeId?: string, sourceTurnId?: string): GoalSnapshot;
|
|
620
|
+
completeGoal(request: GoalCompletionRequest, actor?: string, wakeId?: string): GoalSnapshot;
|
|
621
|
+
transitionGoal(id: string, phase: GoalPhase, actor?: string, scheduleMotion?: boolean, sourceTurnId?: string): GoalSnapshot;
|
|
622
|
+
planWake(agent: string, at: string, reason: string, setBy?: string, target?: {
|
|
623
|
+
goalId: string;
|
|
624
|
+
}): WakeSnapshot | null;
|
|
625
|
+
stopAgentWake(agent: string, goalId?: string): Promise<WakeSnapshot | null>;
|
|
626
|
+
recover(): Promise<void>;
|
|
627
|
+
tick(): Promise<WakeSnapshot | null>;
|
|
628
|
+
runAvailable(concurrency?: number, maxWakes?: number): Promise<WakeSnapshot[]>;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
interface ThreadListItem {
|
|
632
|
+
threadId: string;
|
|
633
|
+
agent: string;
|
|
634
|
+
status: "idle" | "in_progress";
|
|
635
|
+
turnCount: number;
|
|
636
|
+
itemCount: number;
|
|
637
|
+
toolCalls: number;
|
|
638
|
+
updatedAt: string;
|
|
639
|
+
}
|
|
640
|
+
interface ThreadDetail {
|
|
641
|
+
thread: ThreadListItem;
|
|
642
|
+
turns: Array<TurnSnapshot & {
|
|
643
|
+
items: TurnItemSnapshot[];
|
|
644
|
+
transcript: ReplayedTranscript | null;
|
|
645
|
+
}>;
|
|
646
|
+
}
|
|
647
|
+
interface TurnContextSnapshot {
|
|
648
|
+
eventSeq: number;
|
|
649
|
+
provider: string;
|
|
650
|
+
model: string;
|
|
651
|
+
systemPrompt: string;
|
|
652
|
+
text: string;
|
|
653
|
+
sourceSeqs: number[];
|
|
654
|
+
toolCount: number;
|
|
655
|
+
messageCount: number;
|
|
656
|
+
modelConfig: JsonValue;
|
|
657
|
+
}
|
|
658
|
+
interface ThreadExport {
|
|
659
|
+
format: "goah.thread-export.v1";
|
|
660
|
+
exportedAt: string;
|
|
661
|
+
redacted: boolean;
|
|
662
|
+
thread: ThreadListItem;
|
|
663
|
+
events: EventRecord[];
|
|
664
|
+
}
|
|
665
|
+
declare function listThreads(ledger: SqliteLedger): ThreadListItem[];
|
|
666
|
+
declare function showThread(ledger: SqliteLedger, threadId: string): ThreadDetail;
|
|
667
|
+
declare function replayThread(ledger: SqliteLedger, threadId: string): ThreadDetail;
|
|
668
|
+
declare function showTurnContext(ledger: SqliteLedger, turnId: string): TurnContextSnapshot | null;
|
|
669
|
+
declare function streamEvents(ledger: SqliteLedger, streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
670
|
+
declare function exportThread(ledger: SqliteLedger, threadId: string, options?: {
|
|
671
|
+
raw?: boolean;
|
|
672
|
+
now?: string;
|
|
673
|
+
}): ThreadExport;
|
|
674
|
+
declare function redactValue(value: unknown, key?: string): unknown;
|
|
675
|
+
|
|
676
|
+
interface ProcessRunnerOptions {
|
|
677
|
+
command: string;
|
|
678
|
+
args?: string[];
|
|
679
|
+
cwd?: string;
|
|
680
|
+
env?: Record<string, string>;
|
|
681
|
+
/** Unresolved env spec (may contain `env:NAME` references); resolved at every spawn. */
|
|
682
|
+
envSpec?: Record<string, string> | undefined;
|
|
683
|
+
inheritEnv?: string[];
|
|
684
|
+
/** Worker implements the live steering control message. */
|
|
685
|
+
steering?: boolean;
|
|
686
|
+
steerAckTimeoutMs?: number;
|
|
687
|
+
killGraceMs?: number;
|
|
688
|
+
timeoutMs?: number;
|
|
689
|
+
/** Resolve private per-wake runtime material (for example scoped model auth) before the worker starts. Never enters RunRequest context or Ledger events. */
|
|
690
|
+
prepareRuntime?: (request: RunRequest) => Promise<JsonValue | undefined>;
|
|
691
|
+
}
|
|
692
|
+
/** Real process boundary. The child stays idle until begin() sends its request. */
|
|
693
|
+
declare class ProcessRunner implements Runner {
|
|
694
|
+
readonly options: ProcessRunnerOptions;
|
|
695
|
+
readonly isolation: "process";
|
|
696
|
+
constructor(options: ProcessRunnerOptions);
|
|
697
|
+
prepare(request: RunRequest): RunnerHandle;
|
|
698
|
+
terminateProcess(pid: number): Promise<void>;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
type ControlRequest = {
|
|
702
|
+
op: "ping";
|
|
703
|
+
} | {
|
|
704
|
+
op: "status";
|
|
705
|
+
} | {
|
|
706
|
+
op: "interact";
|
|
707
|
+
message: string;
|
|
708
|
+
} | {
|
|
709
|
+
op: "turn.attach";
|
|
710
|
+
turnId: string;
|
|
711
|
+
} | {
|
|
712
|
+
op: "turn.steer";
|
|
713
|
+
message: string;
|
|
714
|
+
} | {
|
|
715
|
+
op: "turn.interrupt";
|
|
716
|
+
turnId: string;
|
|
717
|
+
} | {
|
|
718
|
+
op: "goal.start";
|
|
719
|
+
objective: string;
|
|
720
|
+
id?: string;
|
|
721
|
+
} | {
|
|
722
|
+
op: "goal.interact";
|
|
723
|
+
objective: string;
|
|
724
|
+
id?: string;
|
|
725
|
+
} | {
|
|
726
|
+
op: "goal.update";
|
|
727
|
+
id: string;
|
|
728
|
+
objective?: string;
|
|
729
|
+
observationMethod?: string | null;
|
|
730
|
+
verificationMethod?: string | null;
|
|
731
|
+
} | {
|
|
732
|
+
op: "goal.observe";
|
|
733
|
+
id: string;
|
|
734
|
+
observationMethod: string;
|
|
735
|
+
} | {
|
|
736
|
+
op: "goal.transition";
|
|
737
|
+
id: string;
|
|
738
|
+
phase: "paused" | "active";
|
|
739
|
+
} | {
|
|
740
|
+
op: "goal.complete";
|
|
741
|
+
id: string;
|
|
742
|
+
reason: string;
|
|
743
|
+
evidence: number[];
|
|
744
|
+
} | {
|
|
745
|
+
op: "ceo.send";
|
|
746
|
+
message: string;
|
|
747
|
+
} | {
|
|
748
|
+
op: "ceo.status";
|
|
749
|
+
} | {
|
|
750
|
+
op: "ceo.inbox";
|
|
751
|
+
} | {
|
|
752
|
+
op: "work.records";
|
|
753
|
+
} | {
|
|
754
|
+
op: "work.record";
|
|
755
|
+
goalId: string;
|
|
756
|
+
} | {
|
|
757
|
+
op: "work.history";
|
|
758
|
+
goalId: string;
|
|
759
|
+
} | {
|
|
760
|
+
op: "work.diff";
|
|
761
|
+
goalId: string;
|
|
762
|
+
fromRevision: number;
|
|
763
|
+
toRevision: number;
|
|
764
|
+
} | {
|
|
765
|
+
op: "wake.stop";
|
|
766
|
+
agent: string;
|
|
767
|
+
goalId?: string;
|
|
768
|
+
} | {
|
|
769
|
+
op: "daemon.stop";
|
|
770
|
+
} | {
|
|
771
|
+
op: "daemon.version";
|
|
772
|
+
} | {
|
|
773
|
+
op: "config.reload";
|
|
774
|
+
configPath: string;
|
|
775
|
+
};
|
|
776
|
+
type ControlFrame = {
|
|
777
|
+
type: "result";
|
|
778
|
+
value: JsonValue;
|
|
779
|
+
} | {
|
|
780
|
+
type: "accepted";
|
|
781
|
+
turnId: string;
|
|
782
|
+
value: JsonValue;
|
|
783
|
+
} | {
|
|
784
|
+
type: "event";
|
|
785
|
+
event: JsonValue;
|
|
786
|
+
} | {
|
|
787
|
+
type: "error";
|
|
788
|
+
error: string;
|
|
789
|
+
};
|
|
790
|
+
declare function controlEndpoint(stateDir: string): string;
|
|
791
|
+
declare function runControlServer(supervisor: Supervisor, ledger: Ledger, stateDir: string, signal: AbortSignal, options?: {
|
|
792
|
+
reloadRuntime?: (configPath: string) => Promise<RuntimeSwap | undefined>;
|
|
793
|
+
stop?: () => void;
|
|
794
|
+
}): Promise<void>;
|
|
795
|
+
declare function requestControl(stateDir: string, request: ControlRequest): Promise<JsonValue>;
|
|
796
|
+
declare function streamControl(stateDir: string, request: ControlRequest, onFrame: (frame: ControlFrame) => void, signal?: AbortSignal): Promise<void>;
|
|
797
|
+
declare function controlAvailable(stateDir: string): Promise<boolean>;
|
|
798
|
+
interface RuntimeSwap {
|
|
799
|
+
runner: ProcessRunner | Runner;
|
|
800
|
+
ledger?: SqliteLedger;
|
|
801
|
+
profiles?: RunnerProfile[];
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
interface ConsoleMetadata {
|
|
805
|
+
url: string;
|
|
806
|
+
host: string;
|
|
807
|
+
port: number;
|
|
808
|
+
pid: number;
|
|
809
|
+
token: string;
|
|
810
|
+
}
|
|
811
|
+
interface TrajectoryItem {
|
|
812
|
+
event: JsonValue;
|
|
813
|
+
agent: string;
|
|
814
|
+
wakeId: string | null;
|
|
815
|
+
}
|
|
816
|
+
interface TrajectoryPage {
|
|
817
|
+
items: TrajectoryItem[];
|
|
818
|
+
nextBeforeSeq: number | null;
|
|
819
|
+
}
|
|
820
|
+
declare function consoleMetadataPath(stateDir: string): string;
|
|
821
|
+
declare function readConsoleMetadata(stateDir: string): ConsoleMetadata | null;
|
|
822
|
+
declare function consoleSnapshot(ledger: Ledger, supervisor: Supervisor, now?: string): JsonValue;
|
|
823
|
+
declare function organizationTrajectory(ledger: Ledger, options?: {
|
|
824
|
+
beforeSeq?: number;
|
|
825
|
+
limit?: number;
|
|
826
|
+
agent?: string;
|
|
827
|
+
type?: string;
|
|
828
|
+
}): TrajectoryPage;
|
|
829
|
+
declare function runWebConsole(supervisor: Supervisor, ledger: Ledger, stateDir: string, signal: AbortSignal, options?: {
|
|
830
|
+
host?: string;
|
|
831
|
+
port?: number;
|
|
832
|
+
onListening?: (metadata: ConsoleMetadata) => void;
|
|
833
|
+
}): Promise<void>;
|
|
834
|
+
|
|
835
|
+
interface GoahConfig {
|
|
5
836
|
version: 1 | 2;
|
|
6
837
|
stateDir: string;
|
|
7
838
|
runner?: {
|
|
@@ -17,7 +848,7 @@ export interface GoahConfig {
|
|
|
17
848
|
baseDelayMs: number;
|
|
18
849
|
};
|
|
19
850
|
}
|
|
20
|
-
|
|
851
|
+
interface InitOptions {
|
|
21
852
|
provider?: string;
|
|
22
853
|
model?: string;
|
|
23
854
|
apiKeyEnv?: string;
|
|
@@ -26,41 +857,38 @@ export interface InitOptions {
|
|
|
26
857
|
maxOutputTokensPerTurn?: number;
|
|
27
858
|
baseUrl?: string;
|
|
28
859
|
}
|
|
29
|
-
|
|
860
|
+
interface DoctorCheck {
|
|
30
861
|
name: string;
|
|
31
862
|
ok: boolean;
|
|
32
863
|
detail: string;
|
|
33
864
|
severity?: "warning" | "error";
|
|
34
865
|
}
|
|
35
|
-
|
|
36
|
-
|
|
866
|
+
declare function loadConfig(path?: string): GoahConfig;
|
|
867
|
+
declare function createRuntime(config: GoahConfig): {
|
|
37
868
|
ledger: SqliteLedger;
|
|
38
869
|
supervisor: Supervisor;
|
|
39
870
|
};
|
|
40
|
-
|
|
41
|
-
|
|
871
|
+
declare function defaultConfig(directory: string, options?: InitOptions): GoahConfig;
|
|
872
|
+
declare class SupervisorLock {
|
|
42
873
|
#private;
|
|
43
874
|
readonly path: string;
|
|
44
875
|
constructor(stateDir: string);
|
|
45
876
|
acquire(): void;
|
|
46
877
|
release(): void;
|
|
47
878
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
879
|
+
declare function writeDefaultConfig(path?: string, options?: InitOptions, overwrite?: boolean): void;
|
|
880
|
+
declare function profilePath(): string;
|
|
881
|
+
declare function readDefaultRunnerProfile(): RunnerProfile | null;
|
|
882
|
+
declare function writeDefaultRunnerProfile(profile: RunnerProfile): void;
|
|
883
|
+
declare function updateWorkspaceRunnerProfile(path: string, profile: RunnerProfile): void;
|
|
53
884
|
/** Persist default + workspace profile with a crash-recoverable rollback journal. */
|
|
54
|
-
|
|
55
|
-
|
|
885
|
+
declare function persistRunnerProfile(profile: RunnerProfile, workspacePath: string | null): void;
|
|
886
|
+
declare function diagnoseConfig(config: GoahConfig): {
|
|
56
887
|
ok: boolean;
|
|
57
888
|
checks: DoctorCheck[];
|
|
58
889
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export { controlAvailable, controlEndpoint, requestControl, runControlServer, streamControl,
|
|
63
|
-
export {
|
|
64
|
-
export type { TurnContextSnapshot, ThreadDetail, ThreadExport, ThreadListItem } from "./thread-inspect.js";
|
|
65
|
-
export { CONTRACT_VERSION };
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
|
890
|
+
declare function statusSnapshot(ledger: SqliteLedger): object;
|
|
891
|
+
declare function configRoot(config: GoahConfig): string;
|
|
892
|
+
|
|
893
|
+
export { CONTRACT_VERSION, SupervisorLock, configRoot, consoleMetadataPath, consoleSnapshot, controlAvailable, controlEndpoint, createRuntime, defaultConfig, diagnoseConfig, exportThread, listThreads, loadConfig, organizationTrajectory, persistRunnerProfile, profilePath, readConsoleMetadata, readDefaultRunnerProfile, redactValue, replayThread, requestControl, runControlServer, runWebConsole, showThread, showTurnContext, statusSnapshot, streamControl, streamEvents, updateWorkspaceRunnerProfile, writeDefaultConfig, writeDefaultRunnerProfile };
|
|
894
|
+
export type { ConsoleMetadata, ControlFrame, ControlRequest, DoctorCheck, GoahConfig, InitOptions, ThreadDetail, ThreadExport, ThreadListItem, TrajectoryItem, TrajectoryPage, TurnContextSnapshot };
|