@goah/cli 0.11.5 → 0.13.1
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-BXA47DTF.js +548 -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-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-PFEV3HWI.js +1178 -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-VWEV4LTH.js +25 -0
- package/dist/chunk-X7UWW2PN.js +883 -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 +13148 -506
- package/dist/console/assets/index-3sYrDMmt.css +1 -0
- package/dist/console/assets/index-B1vGMXKr.js +52 -0
- package/dist/console/assets/index-B1vGMXKr.js.map +1 -0
- package/dist/console/index.html +2 -2
- 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 +855 -44
- package/dist/index.js +84 -257
- 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-M776E3SE.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 -0
- package/dist/transcript.js +25 -0
- package/dist/verification-worker.js +72 -0
- package/package.json +3 -28
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/console/assets/index-BJTGvlCH.js +0 -52
- package/dist/console/assets/index-BJTGvlCH.js.map +0 -1
- package/dist/console/assets/index-msBn41Cl.css +0 -1
- package/dist/control.d.ts +0 -106
- package/dist/control.d.ts.map +0 -1
- package/dist/control.js +0 -215
- 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/inspect.d.ts +0 -61
- package/dist/inspect.d.ts.map +0 -1
- package/dist/inspect.js +0 -110
- package/dist/inspect.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/metrics.d.ts +0 -2
- package/dist/metrics.d.ts.map +0 -1
- package/dist/metrics.js +0 -2
- package/dist/metrics.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 -30
- 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/session.d.ts +0 -2
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -2
- package/dist/session.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -11
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -130
- 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/tui-theme.d.ts +0 -16
- package/dist/tui-theme.d.ts.map +0 -1
- package/dist/tui-theme.js +0 -18
- package/dist/tui-theme.js.map +0 -1
- package/dist/tui.d.ts +0 -18
- package/dist/tui.d.ts.map +0 -1
- package/dist/tui.js +0 -583
- package/dist/tui.js.map +0 -1
- package/dist/update.d.ts +0 -15
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -59
- 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 -252
- 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 -81
- package/dist/welcome.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/execution.d.ts +0 -402
- package/node_modules/goah-ledger-contract/dist/execution.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/execution.js +0 -40
- package/node_modules/goah-ledger-contract/dist/execution.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/index.d.ts +0 -5
- package/node_modules/goah-ledger-contract/dist/index.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/index.js +0 -5
- 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/metrics.d.ts +0 -40
- package/node_modules/goah-ledger-contract/dist/metrics.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/metrics.js +0 -25
- package/node_modules/goah-ledger-contract/dist/metrics.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/session.d.ts +0 -63
- package/node_modules/goah-ledger-contract/dist/session.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/session.js +0 -115
- package/node_modules/goah-ledger-contract/dist/session.js.map +0 -1
- package/node_modules/goah-ledger-contract/package.json +0 -29
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts +0 -77
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts.map +0 -1
- package/node_modules/goah-ledger-sqlite/dist/index.js +0 -884
- 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 -267
- package/node_modules/goah-runner-pi/dist/configurator.js.map +0 -1
- package/node_modules/goah-runner-pi/dist/credential-store.d.ts +0 -12
- 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 -69
- 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 -64
- package/node_modules/goah-runner-pi/dist/index.d.ts.map +0 -1
- package/node_modules/goah-runner-pi/dist/index.js +0 -241
- 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 -29
- 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 -428
- package/node_modules/goah-runner-pi/dist/pi-worker.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 -11
- 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 -48
- 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 -31
- package/node_modules/goah-supervisor/dist/context-view.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/context-view.js +0 -71
- package/node_modules/goah-supervisor/dist/context-view.js.map +0 -1
- package/node_modules/goah-supervisor/dist/index.d.ts +0 -94
- package/node_modules/goah-supervisor/dist/index.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/index.js +0 -888
- package/node_modules/goah-supervisor/dist/index.js.map +0 -1
- package/node_modules/goah-supervisor/dist/roles.d.ts +0 -3
- package/node_modules/goah-supervisor/dist/roles.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/roles.js +0 -14
- package/node_modules/goah-supervisor/dist/roles.js.map +0 -1
- package/node_modules/goah-supervisor/dist/verification.d.ts +0 -82
- package/node_modules/goah-supervisor/dist/verification.d.ts.map +0 -1
- package/node_modules/goah-supervisor/dist/verification.js +0 -110
- 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 -75
- package/node_modules/goah-testkit/dist/faux-runner-worker.js.map +0 -1
- package/node_modules/goah-testkit/dist/index.d.ts +0 -52
- package/node_modules/goah-testkit/dist/index.d.ts.map +0 -1
- package/node_modules/goah-testkit/dist/index.js +0 -113
- package/node_modules/goah-testkit/dist/index.js.map +0 -1
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts +0 -2
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts.map +0 -1
- package/node_modules/goah-testkit/dist/mock-connector-worker.js +0 -29
- package/node_modules/goah-testkit/dist/mock-connector-worker.js.map +0 -1
- package/node_modules/goah-testkit/package.json +0 -29
package/dist/index.js
CHANGED
|
@@ -1,257 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
acquire() {
|
|
86
|
-
mkdirSync(dirname(this.path), { recursive: true });
|
|
87
|
-
if (existsSync(this.path)) {
|
|
88
|
-
const pid = Number(readFileSync(this.path, "utf8"));
|
|
89
|
-
if (Number.isInteger(pid) && alive(pid))
|
|
90
|
-
throw new Error(`supervisor already running with pid ${pid}`);
|
|
91
|
-
rmSync(this.path);
|
|
92
|
-
}
|
|
93
|
-
const fd = openSync(this.path, "wx");
|
|
94
|
-
writeFileSync(fd, String(process.pid));
|
|
95
|
-
closeSync(fd);
|
|
96
|
-
this.#owned = true;
|
|
97
|
-
}
|
|
98
|
-
release() { if (this.#owned) {
|
|
99
|
-
rmSync(this.path, { force: true });
|
|
100
|
-
this.#owned = false;
|
|
101
|
-
} }
|
|
102
|
-
}
|
|
103
|
-
export function writeDefaultConfig(path = "goah.config.json", options = {}, overwrite = false) {
|
|
104
|
-
const absolute = resolve(path);
|
|
105
|
-
if (existsSync(absolute) && !overwrite)
|
|
106
|
-
throw new Error(`${absolute} already exists`);
|
|
107
|
-
writeFileSync(absolute, `${JSON.stringify(defaultConfig(dirname(absolute), options), null, 2)}\n`);
|
|
108
|
-
}
|
|
109
|
-
export function profilePath() { return join(process.env.GOAH_STATE_HOME ?? join(homedir(), ".goah"), "profile.json"); }
|
|
110
|
-
export function readDefaultRunnerProfile() {
|
|
111
|
-
try {
|
|
112
|
-
const raw = JSON.parse(readFileSync(profilePath(), "utf8"));
|
|
113
|
-
if (typeof raw.id === "string" && typeof raw.runner === "string" && raw.config && typeof raw.config === "object")
|
|
114
|
-
return raw;
|
|
115
|
-
if (typeof raw.provider === "string" && typeof raw.model === "string") {
|
|
116
|
-
const { provider, model, apiKeyEnv, baseUrl, contextWindowTokens, maxOutputTokensPerTurn } = raw;
|
|
117
|
-
return { id: "default", runner: "pi", config: { provider, model, ...(typeof apiKeyEnv === "string" ? { apiKeyEnv } : {}), ...(typeof baseUrl === "string" ? { baseUrl } : {}), ...(typeof contextWindowTokens === "number" ? { contextWindowTokens } : {}), ...(typeof maxOutputTokensPerTurn === "number" ? { maxOutputTokens: maxOutputTokensPerTurn } : {}) } };
|
|
118
|
-
}
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
export function writeDefaultRunnerProfile(profile) {
|
|
126
|
-
mkdirSync(dirname(profilePath()), { recursive: true });
|
|
127
|
-
const temporary = `${profilePath()}.${process.pid}.tmp`;
|
|
128
|
-
writeFileSync(temporary, `${JSON.stringify(profile, null, 2)}\n`, { mode: 0o600 });
|
|
129
|
-
renameSync(temporary, profilePath());
|
|
130
|
-
chmodSync(profilePath(), 0o600);
|
|
131
|
-
}
|
|
132
|
-
export function updateWorkspaceRunnerProfile(path, profile) {
|
|
133
|
-
const absolute = resolve(path);
|
|
134
|
-
const current = existsSync(absolute) ? JSON.parse(readFileSync(absolute, "utf8")) : defaultConfig(dirname(absolute));
|
|
135
|
-
current.runnerProfiles = [...(current.runnerProfiles ?? []).filter((item) => item.id !== profile.id), profile];
|
|
136
|
-
current.profiles = (current.profiles ?? [{ agent: "ceo", role: "ceo" }, { agent: "worker", role: "child" }]).map((agent) => ({ ...agent, runnerProfile: agent.runnerProfile ?? profile.id }));
|
|
137
|
-
const temporary = `${absolute}.${process.pid}.tmp`;
|
|
138
|
-
writeFileSync(temporary, `${JSON.stringify(current, null, 2)}\n`);
|
|
139
|
-
renameSync(temporary, absolute);
|
|
140
|
-
}
|
|
141
|
-
export function diagnoseConfig(config) {
|
|
142
|
-
const checks = [];
|
|
143
|
-
const check = (name, fn) => {
|
|
144
|
-
try {
|
|
145
|
-
checks.push({ name, ok: true, detail: fn() });
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
checks.push({ name, ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
check("node", () => {
|
|
152
|
-
if (Number(process.versions.node.split(".")[0]) < 24)
|
|
153
|
-
throw new Error(`Node ${process.versions.node} is unsupported; require >=24`);
|
|
154
|
-
return process.versions.node;
|
|
155
|
-
});
|
|
156
|
-
check("root", () => {
|
|
157
|
-
const root = configRoot(config);
|
|
158
|
-
accessSync(root, constants.R_OK | constants.W_OK);
|
|
159
|
-
return `${root} (runner-owned local execution)`;
|
|
160
|
-
});
|
|
161
|
-
check("state", () => {
|
|
162
|
-
const existing = nearestExisting(config.stateDir);
|
|
163
|
-
accessSync(existing, constants.W_OK);
|
|
164
|
-
const database = join(config.stateDir, "ledger.sqlite");
|
|
165
|
-
if (!existsSync(database))
|
|
166
|
-
return `${config.stateDir} (will create)`;
|
|
167
|
-
const db = new DatabaseSync(database, { readOnly: true });
|
|
168
|
-
try {
|
|
169
|
-
const version = db.prepare("PRAGMA user_version").get().user_version;
|
|
170
|
-
if (version > SQLITE_SCHEMA_VERSION)
|
|
171
|
-
throw new Error(`ledger schema ${version} is newer than supported schema ${SQLITE_SCHEMA_VERSION}`);
|
|
172
|
-
return `${database} (schema ${version}${version < SQLITE_SCHEMA_VERSION ? `, migrates to ${SQLITE_SCHEMA_VERSION}` : ""})`;
|
|
173
|
-
}
|
|
174
|
-
finally {
|
|
175
|
-
db.close();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
check("runner", () => {
|
|
179
|
-
if (config.runnerProfiles?.length) {
|
|
180
|
-
for (const profile of config.runnerProfiles)
|
|
181
|
-
runnerPlugin(profile.runner);
|
|
182
|
-
return config.runnerProfiles.map((profile) => `${profile.id}:${profile.runner}`).join(", ");
|
|
183
|
-
}
|
|
184
|
-
if (!config.runner)
|
|
185
|
-
throw new Error("no runner is configured");
|
|
186
|
-
accessSync(config.runner.command, constants.X_OK);
|
|
187
|
-
const workerArg = config.runner.args[0];
|
|
188
|
-
if (workerArg && isAbsolute(workerArg))
|
|
189
|
-
accessSync(workerArg, constants.R_OK);
|
|
190
|
-
const env = resolveEnvSpec(config.runner.env, { root: configRoot(config) });
|
|
191
|
-
const provider = requiredEnv(env, "GOAH_PI_PROVIDER");
|
|
192
|
-
const modelId = requiredEnv(env, "GOAH_PI_MODEL");
|
|
193
|
-
const model = createPiModel(provider, modelId, env).model;
|
|
194
|
-
return `${provider}/${modelId} context=${model.contextWindow} output=${model.maxTokens}; auth is checked when the wake starts`;
|
|
195
|
-
});
|
|
196
|
-
return { ok: checks.every((item) => item.ok), checks };
|
|
197
|
-
}
|
|
198
|
-
export function statusSnapshot(ledger) {
|
|
199
|
-
const events = ledger.events();
|
|
200
|
-
const wakes = ledger.wakes().map((wake) => {
|
|
201
|
-
const wakeEvents = events.filter((event) => event.streamId === wakeStream(wake.id));
|
|
202
|
-
const abnormal = [...wakeEvents].reverse().find((event) => event.type === "wake.abnormal_reason");
|
|
203
|
-
const tokensUsed = wakeEvents.reduce((total, event) => total + assistantTokens(event.data), 0);
|
|
204
|
-
return { ...wake, tokensUsed, abnormalReason: abnormal ? field(abnormal.data, "reason") : null };
|
|
205
|
-
});
|
|
206
|
-
const goals = ledger.goals().map((goal) => ({ ...goal, evaluation: [...events].reverse().find((event) => event.streamId === `metric:${goal.id}` && event.type === "metric.evaluated")?.data ?? null }));
|
|
207
|
-
const handoffs = events.filter((event) => event.type === "handoff.recorded").slice(-20).map((event) => ({ seq: event.seq, ts: event.ts, agent: event.actor, streamId: event.streamId, handoff: event.data }));
|
|
208
|
-
const modelCapabilities = [...events].reverse().find((event) => event.type === "session.started")?.data ?? null;
|
|
209
|
-
return { seq: events.at(-1)?.seq ?? 0, goals, wakes, actions: ledger.actions(), modelCapabilities, recentHandoffs: handoffs };
|
|
210
|
-
}
|
|
211
|
-
function defaultModel(provider) {
|
|
212
|
-
if (provider === "faux")
|
|
213
|
-
return "faux-goah";
|
|
214
|
-
throw new Error(`--model is required for ${provider}; interactive setup discovers models through the selected Runner.`);
|
|
215
|
-
}
|
|
216
|
-
function legacyRunner(config) {
|
|
217
|
-
if (!config.runner)
|
|
218
|
-
throw new Error("no runner profiles are configured");
|
|
219
|
-
const { env, ...spec } = config.runner;
|
|
220
|
-
return new ProcessRunner({ ...spec, envSpec: env, cwd: configRoot(config) });
|
|
221
|
-
}
|
|
222
|
-
function requiredEnv(env, name) { const value = env[name]; if (!value)
|
|
223
|
-
throw new Error(`${name} is missing`); return value; }
|
|
224
|
-
function nearestExisting(path) { let current = resolve(path); while (!existsSync(current)) {
|
|
225
|
-
const parent = dirname(current);
|
|
226
|
-
if (parent === current)
|
|
227
|
-
break;
|
|
228
|
-
current = parent;
|
|
229
|
-
} return current; }
|
|
230
|
-
function defaultStateDir(directory) {
|
|
231
|
-
const id = createHash("sha256").update(resolve(directory)).digest("hex").slice(0, 16);
|
|
232
|
-
return join(process.env.GOAH_STATE_HOME ?? join(homedir(), ".goah", "state"), id);
|
|
233
|
-
}
|
|
234
|
-
function field(value, key) { return typeof value === "object" && value !== null && !Array.isArray(value) ? value[key] : undefined; }
|
|
235
|
-
function assistantTokens(value) {
|
|
236
|
-
const message = field(value, "message");
|
|
237
|
-
if (field(message, "role") !== "assistant")
|
|
238
|
-
return 0;
|
|
239
|
-
const usage = field(message, "usage");
|
|
240
|
-
const total = field(usage, "totalTokens");
|
|
241
|
-
return typeof total === "number" ? total : 0;
|
|
242
|
-
}
|
|
243
|
-
function resolveCommand(command) { return command === "$NODE" ? process.execPath : command; }
|
|
244
|
-
function absolutePath(base, value) { return isAbsolute(value) ? value : resolve(base, value); }
|
|
245
|
-
function alive(pid) { try {
|
|
246
|
-
process.kill(pid, 0);
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
catch {
|
|
250
|
-
return false;
|
|
251
|
-
} }
|
|
252
|
-
export function configRoot(config) { return configRoots.get(config) ?? process.cwd(); }
|
|
253
|
-
export { exportSession, listSessions, redactValue, replayWakeSession, showSession, showSessionContext, streamEvents } from "./inspect.js";
|
|
254
|
-
export { controlAvailable, controlEndpoint, requestControl, runControlServer, streamControl } from "./control.js";
|
|
255
|
-
export { consoleMetadataPath, consoleSnapshot, organizationTrajectory, readConsoleMetadata, runWebConsole } from "./web-console.js";
|
|
256
|
-
export { CONTRACT_VERSION };
|
|
257
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { createRequire as __goahCreateRequire } from "node:module";
|
|
2
|
+
const require = __goahCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SupervisorLock,
|
|
5
|
+
configRoot,
|
|
6
|
+
consoleMetadataPath,
|
|
7
|
+
consoleSnapshot,
|
|
8
|
+
controlAvailable,
|
|
9
|
+
controlEndpoint,
|
|
10
|
+
createRuntime,
|
|
11
|
+
defaultConfig,
|
|
12
|
+
diagnoseConfig,
|
|
13
|
+
exportThread,
|
|
14
|
+
listThreads,
|
|
15
|
+
loadConfig,
|
|
16
|
+
organizationTrajectory,
|
|
17
|
+
persistRunnerProfile,
|
|
18
|
+
profilePath,
|
|
19
|
+
readConsoleMetadata,
|
|
20
|
+
readDefaultRunnerProfile,
|
|
21
|
+
redactValue,
|
|
22
|
+
replayThread,
|
|
23
|
+
requestControl,
|
|
24
|
+
runControlServer,
|
|
25
|
+
runWebConsole,
|
|
26
|
+
showThread,
|
|
27
|
+
showTurnContext,
|
|
28
|
+
statusSnapshot,
|
|
29
|
+
streamControl,
|
|
30
|
+
streamEvents,
|
|
31
|
+
updateWorkspaceRunnerProfile,
|
|
32
|
+
writeDefaultConfig,
|
|
33
|
+
writeDefaultRunnerProfile
|
|
34
|
+
} from "./chunk-PFEV3HWI.js";
|
|
35
|
+
import "./chunk-VWEV4LTH.js";
|
|
36
|
+
import "./chunk-YH6YJ2IB.js";
|
|
37
|
+
import "./chunk-QBD6EJ2Z.js";
|
|
38
|
+
import "./chunk-X7UWW2PN.js";
|
|
39
|
+
import "./chunk-6M3OOCKO.js";
|
|
40
|
+
import "./chunk-K26BVR6O.js";
|
|
41
|
+
import "./chunk-IIJQ3DW4.js";
|
|
42
|
+
import "./chunk-2ZP2NBW3.js";
|
|
43
|
+
import "./chunk-MPXK7QBL.js";
|
|
44
|
+
import "./chunk-2QBQZGXF.js";
|
|
45
|
+
import "./chunk-4KA63VNZ.js";
|
|
46
|
+
import {
|
|
47
|
+
CONTRACT_VERSION
|
|
48
|
+
} from "./chunk-KAO7WIXG.js";
|
|
49
|
+
import "./chunk-R6I3VKME.js";
|
|
50
|
+
import "./chunk-TJON22J4.js";
|
|
51
|
+
import "./chunk-XPQKM3L7.js";
|
|
52
|
+
export {
|
|
53
|
+
CONTRACT_VERSION,
|
|
54
|
+
SupervisorLock,
|
|
55
|
+
configRoot,
|
|
56
|
+
consoleMetadataPath,
|
|
57
|
+
consoleSnapshot,
|
|
58
|
+
controlAvailable,
|
|
59
|
+
controlEndpoint,
|
|
60
|
+
createRuntime,
|
|
61
|
+
defaultConfig,
|
|
62
|
+
diagnoseConfig,
|
|
63
|
+
exportThread,
|
|
64
|
+
listThreads,
|
|
65
|
+
loadConfig,
|
|
66
|
+
organizationTrajectory,
|
|
67
|
+
persistRunnerProfile,
|
|
68
|
+
profilePath,
|
|
69
|
+
readConsoleMetadata,
|
|
70
|
+
readDefaultRunnerProfile,
|
|
71
|
+
redactValue,
|
|
72
|
+
replayThread,
|
|
73
|
+
requestControl,
|
|
74
|
+
runControlServer,
|
|
75
|
+
runWebConsole,
|
|
76
|
+
showThread,
|
|
77
|
+
showTurnContext,
|
|
78
|
+
statusSnapshot,
|
|
79
|
+
streamControl,
|
|
80
|
+
streamEvents,
|
|
81
|
+
updateWorkspaceRunnerProfile,
|
|
82
|
+
writeDefaultConfig,
|
|
83
|
+
writeDefaultRunnerProfile
|
|
84
|
+
};
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,2 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const CONTRACT_VERSION: "0.13.0";
|
|
2
|
+
declare const CONTRACT_STABILITY: "experimental";
|
|
3
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
4
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
/** One append request. Sequence numbers are assigned by the ledger. */
|
|
8
|
+
interface EventInput {
|
|
9
|
+
streamId: string;
|
|
10
|
+
ts: string;
|
|
11
|
+
actor: string;
|
|
12
|
+
type: string;
|
|
13
|
+
data: JsonValue;
|
|
14
|
+
/** An unfamiliar reader may skip this event without changing replay semantics. */
|
|
15
|
+
ignorable?: true;
|
|
16
|
+
}
|
|
17
|
+
/** One immutable fact in the global ledger and in one logical stream. */
|
|
18
|
+
interface EventRecord extends EventInput {
|
|
19
|
+
seq: number;
|
|
20
|
+
streamSeq: number;
|
|
21
|
+
}
|
|
22
|
+
interface EventStore {
|
|
23
|
+
appendEvent(input: EventInput): EventRecord;
|
|
24
|
+
appendEvents(inputs: EventInput[]): EventRecord[];
|
|
25
|
+
readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
26
|
+
eventsSince(seq: number, types?: string[]): EventRecord[];
|
|
27
|
+
events(): EventRecord[];
|
|
28
|
+
}
|
|
29
|
+
interface Clock {
|
|
30
|
+
now(): Date;
|
|
31
|
+
}
|
|
32
|
+
declare function wakeStream(wakeId: string): string;
|
|
33
|
+
declare function controlStream(actor?: string): string;
|
|
34
|
+
declare function goalStream(goalId: string): string;
|
|
35
|
+
declare function workRecordStream(goalId: string): string;
|
|
36
|
+
declare function memoryStream(agent: string): string;
|
|
37
|
+
|
|
38
|
+
export { CONTRACT_STABILITY, CONTRACT_VERSION, controlStream, goalStream, memoryStream, wakeStream, workRecordStream };
|
|
39
|
+
export type { Clock, EventInput, EventRecord, EventStore, JsonPrimitive, JsonValue };
|
package/dist/kernel.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createRequire as __goahCreateRequire } from "node:module";
|
|
2
|
+
const require = __goahCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CONTRACT_STABILITY,
|
|
5
|
+
CONTRACT_VERSION,
|
|
6
|
+
controlStream,
|
|
7
|
+
goalStream,
|
|
8
|
+
memoryStream,
|
|
9
|
+
wakeStream,
|
|
10
|
+
workRecordStream
|
|
11
|
+
} from "./chunk-KAO7WIXG.js";
|
|
12
|
+
import "./chunk-XPQKM3L7.js";
|
|
13
|
+
export {
|
|
14
|
+
CONTRACT_STABILITY,
|
|
15
|
+
CONTRACT_VERSION,
|
|
16
|
+
controlStream,
|
|
17
|
+
goalStream,
|
|
18
|
+
memoryStream,
|
|
19
|
+
wakeStream,
|
|
20
|
+
workRecordStream
|
|
21
|
+
};
|