@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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createRequire as __goahCreateRequire } from "node:module";
|
|
2
|
+
const require = __goahCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/goah-ledger-contract/dist/transcript.js
|
|
5
|
+
var TRANSCRIPT_FORMAT_VERSION = 1;
|
|
6
|
+
var TRANSCRIPT_MIN_READABLE_VERSION = 0;
|
|
7
|
+
var TRANSCRIPT_TYPES = /* @__PURE__ */ new Set(["transcript.started", "request.prepared", "turn.started", "message.user", "message.assistant.delta", "message.assistant.completed", "tool.called", "tool.completed", "context.compacted", "turn.completed", "transcript.completed", "transcript.interrupted"]);
|
|
8
|
+
function isTranscriptEvent(event) {
|
|
9
|
+
return TRANSCRIPT_TYPES.has(event.type);
|
|
10
|
+
}
|
|
11
|
+
var TranscriptFormatUnsupportedError = class extends Error {
|
|
12
|
+
foundVersion;
|
|
13
|
+
supportedVersion;
|
|
14
|
+
constructor(foundVersion, supportedVersion = TRANSCRIPT_FORMAT_VERSION) {
|
|
15
|
+
super(`transcript format ${foundVersion} is unsupported by this harness (supports ${supportedVersion}); upgrade the harness`);
|
|
16
|
+
this.foundVersion = foundVersion;
|
|
17
|
+
this.supportedVersion = supportedVersion;
|
|
18
|
+
this.name = "TranscriptFormatUnsupportedError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var TranscriptEventUnsupportedError = class extends Error {
|
|
22
|
+
eventType;
|
|
23
|
+
constructor(eventType) {
|
|
24
|
+
super(`required transcript event is unknown to this harness: ${eventType}`);
|
|
25
|
+
this.eventType = eventType;
|
|
26
|
+
this.name = "TranscriptEventUnsupportedError";
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var TranscriptCorruptionError = class extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "TranscriptCorruptionError";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function upgradeTranscriptEvents(source) {
|
|
36
|
+
assertContiguous(source);
|
|
37
|
+
const starts = source.filter((event) => event.type === "transcript.started");
|
|
38
|
+
if (starts.length === 0) {
|
|
39
|
+
if (source.some((event) => isTranscriptNamespace(event.type)))
|
|
40
|
+
throw new TranscriptCorruptionError("transcript events exist without transcript.started");
|
|
41
|
+
return [...source];
|
|
42
|
+
}
|
|
43
|
+
if (starts.length !== 1)
|
|
44
|
+
throw new TranscriptCorruptionError("turn transcript stream contains multiple transcript.started events");
|
|
45
|
+
const rawVersion = field(starts[0].data, "formatVersion");
|
|
46
|
+
let version = rawVersion === void 0 ? 0 : Number(rawVersion);
|
|
47
|
+
if (!Number.isSafeInteger(version) || version < TRANSCRIPT_MIN_READABLE_VERSION)
|
|
48
|
+
throw new TranscriptCorruptionError(`invalid transcript format version: ${String(rawVersion)}`);
|
|
49
|
+
if (version > TRANSCRIPT_FORMAT_VERSION)
|
|
50
|
+
throw new TranscriptFormatUnsupportedError(version);
|
|
51
|
+
let events = [...source];
|
|
52
|
+
while (version < TRANSCRIPT_FORMAT_VERSION) {
|
|
53
|
+
if (version === 0) {
|
|
54
|
+
events = events.map((event) => event.type === "transcript.started" ? { ...event, data: { ...event.data, formatVersion: 1 } } : event);
|
|
55
|
+
version = 1;
|
|
56
|
+
} else
|
|
57
|
+
throw new TranscriptFormatUnsupportedError(version);
|
|
58
|
+
}
|
|
59
|
+
for (const event of events) {
|
|
60
|
+
if (!isTranscriptEvent(event) && isTranscriptNamespace(event.type) && event.ignorable !== true)
|
|
61
|
+
throw new TranscriptEventUnsupportedError(event.type);
|
|
62
|
+
}
|
|
63
|
+
return events;
|
|
64
|
+
}
|
|
65
|
+
function replayTranscript(events) {
|
|
66
|
+
const upgraded = upgradeTranscriptEvents(events);
|
|
67
|
+
const messages = [];
|
|
68
|
+
const calls = /* @__PURE__ */ new Map();
|
|
69
|
+
let status = "running";
|
|
70
|
+
let lastRequest = null;
|
|
71
|
+
for (const event of upgraded) {
|
|
72
|
+
if (!isTranscriptEvent(event))
|
|
73
|
+
continue;
|
|
74
|
+
const data = event.data;
|
|
75
|
+
if (event.type === "message.user" || event.type === "message.assistant.completed")
|
|
76
|
+
messages.push(data.message);
|
|
77
|
+
else if (event.type === "tool.called") {
|
|
78
|
+
const call = { callId: String(data.callId), name: String(data.name), arguments: data.arguments ?? null };
|
|
79
|
+
calls.set(call.callId, call);
|
|
80
|
+
} else if (event.type === "tool.completed") {
|
|
81
|
+
const callId = String(data.callId);
|
|
82
|
+
calls.delete(callId);
|
|
83
|
+
messages.push({ id: String(data.messageId ?? `tool:${callId}`), role: "tool", toolCallId: callId, content: data.result ?? null });
|
|
84
|
+
} else if (event.type === "context.compacted") {
|
|
85
|
+
const replaced = new Set(Array.isArray(data.replacedMessageIds) ? data.replacedMessageIds.map(String) : []);
|
|
86
|
+
const kept = messages.filter((message) => !replaced.has(message.id));
|
|
87
|
+
messages.splice(0, messages.length, ...kept);
|
|
88
|
+
messages.unshift({ id: String(data.summaryMessageId), role: "user", content: String(data.summary) });
|
|
89
|
+
} else if (event.type === "request.prepared")
|
|
90
|
+
lastRequest = event.data;
|
|
91
|
+
else if (event.type === "transcript.completed")
|
|
92
|
+
status = "completed";
|
|
93
|
+
else if (event.type === "transcript.interrupted")
|
|
94
|
+
status = "interrupted";
|
|
95
|
+
}
|
|
96
|
+
return { messages, status, openToolCalls: [...calls.values()], lastRequest };
|
|
97
|
+
}
|
|
98
|
+
function interruptedTranscriptEvents(events, ts, actor) {
|
|
99
|
+
const replayed = replayTranscript(events);
|
|
100
|
+
if (replayed.status !== "running" || !events.some((event) => event.type === "transcript.started"))
|
|
101
|
+
return [];
|
|
102
|
+
const streamId = events[0].streamId;
|
|
103
|
+
const repairs = replayed.openToolCalls.map((call) => ({ streamId, ts, actor, type: "tool.completed", data: { callId: call.callId, messageId: `repair:${call.callId}`, result: { outcome: "unknown", synthetic: true, reason: "runner interrupted before a durable result" } } }));
|
|
104
|
+
repairs.push({ streamId, ts, actor, type: "transcript.interrupted", data: { reason: "runner interrupted" } });
|
|
105
|
+
return repairs;
|
|
106
|
+
}
|
|
107
|
+
function assertContiguous(events) {
|
|
108
|
+
let expected = events[0]?.streamSeq ?? 1;
|
|
109
|
+
for (const event of events) {
|
|
110
|
+
if (event.streamSeq !== expected)
|
|
111
|
+
throw new TranscriptCorruptionError(`turn transcript stream gap: expected ${expected}, got ${event.streamSeq}`);
|
|
112
|
+
expected += 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function isTranscriptNamespace(type) {
|
|
116
|
+
return ["transcript.", "request.", "turn.", "message.", "tool.", "context."].some((prefix) => type.startsWith(prefix));
|
|
117
|
+
}
|
|
118
|
+
function field(value, key) {
|
|
119
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value[key] : void 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
TRANSCRIPT_FORMAT_VERSION,
|
|
124
|
+
TRANSCRIPT_MIN_READABLE_VERSION,
|
|
125
|
+
isTranscriptEvent,
|
|
126
|
+
TranscriptFormatUnsupportedError,
|
|
127
|
+
TranscriptEventUnsupportedError,
|
|
128
|
+
TranscriptCorruptionError,
|
|
129
|
+
upgradeTranscriptEvents,
|
|
130
|
+
replayTranscript,
|
|
131
|
+
interruptedTranscriptEvents
|
|
132
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createRequire as __goahCreateRequire } from "node:module";
|
|
2
|
+
const require = __goahCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/goah-ledger-contract/dist/execution.js
|
|
5
|
+
function goalAutomaticTarget(agent, goalId) {
|
|
6
|
+
return { targetKind: "goal", agent, goalId, specialistRole: null };
|
|
7
|
+
}
|
|
8
|
+
function specialistAutomaticTarget(agent, role) {
|
|
9
|
+
return { targetKind: "specialist", agent, goalId: null, specialistRole: role };
|
|
10
|
+
}
|
|
11
|
+
function goalRoute(goalId) {
|
|
12
|
+
return { routeKind: "goal", goalId, specialistRole: null };
|
|
13
|
+
}
|
|
14
|
+
function humanInboxRoute() {
|
|
15
|
+
return { routeKind: "human_inbox", goalId: null, specialistRole: null };
|
|
16
|
+
}
|
|
17
|
+
function humanRequestRoute() {
|
|
18
|
+
return { routeKind: "human_request", goalId: null, specialistRole: null };
|
|
19
|
+
}
|
|
20
|
+
function specialistInboxRoute(role) {
|
|
21
|
+
return { routeKind: "specialist_inbox", goalId: null, specialistRole: role };
|
|
22
|
+
}
|
|
23
|
+
function noGoalCommitment() {
|
|
24
|
+
return { goalId: null, goalRevision: null };
|
|
25
|
+
}
|
|
26
|
+
function goalCommitment(goalId, goalRevision) {
|
|
27
|
+
return { goalId, goalRevision };
|
|
28
|
+
}
|
|
29
|
+
function normalizeAssistantText(text) {
|
|
30
|
+
return text.replace(/\r\n?/g, "\n").trim();
|
|
31
|
+
}
|
|
32
|
+
var wakeTransitions = { queued: ["claimed", "cancelled"], claimed: ["queued", "consumed", "cancelled"], consumed: [], cancelled: [] };
|
|
33
|
+
var goalTransitions = { active: ["paused", "blocked", "complete"], paused: ["active", "complete"], blocked: ["active", "complete"], complete: [] };
|
|
34
|
+
function assertWakeTransition(from, to) {
|
|
35
|
+
if (!wakeTransitions[from].includes(to))
|
|
36
|
+
throw new Error(`invalid wake transition: ${from} -> ${to}`);
|
|
37
|
+
}
|
|
38
|
+
function assertGoalTransition(from, to) {
|
|
39
|
+
if (from !== to && !goalTransitions[from].includes(to))
|
|
40
|
+
throw new Error(`invalid goal transition: ${from} -> ${to}`);
|
|
41
|
+
}
|
|
42
|
+
function assertHandoff(value) {
|
|
43
|
+
assertAgentHandoff(value);
|
|
44
|
+
if (!value.goalId.trim() || !Number.isInteger(value.goalRevision) || value.goalRevision < 0 || !Number.isInteger(value.recordRevision) || value.recordRevision < 1)
|
|
45
|
+
throw new Error("invalid Goal handoff");
|
|
46
|
+
}
|
|
47
|
+
function assertAgentHandoff(value) {
|
|
48
|
+
if (!["progress", "waiting", "blocked", "completion_proposed"].includes(value.outcome) || !Array.isArray(value.evidence) || value.evidence.length === 0)
|
|
49
|
+
throw new Error("invalid Agent handoff");
|
|
50
|
+
}
|
|
51
|
+
function assertTurnOutput(value) {
|
|
52
|
+
if (!Number.isInteger(value.validationAttemptId) || value.validationAttemptId <= 0 || typeof value.validationToken !== "string" || !value.validationToken.trim())
|
|
53
|
+
throw new Error("committed Turn requires an accepted Handoff validation attempt and token");
|
|
54
|
+
assertAgentHandoff(value.handoff);
|
|
55
|
+
}
|
|
56
|
+
function assertGoalSnapshot(value) {
|
|
57
|
+
if (!value.objective.trim() || !value.owner.trim())
|
|
58
|
+
throw new Error("goal objective and owner are required");
|
|
59
|
+
if (value.observationMethod !== null && !value.observationMethod.trim())
|
|
60
|
+
throw new Error("goal observation method cannot be blank");
|
|
61
|
+
if (value.verificationMethod !== null && !value.verificationMethod.trim())
|
|
62
|
+
throw new Error("goal verification method cannot be blank");
|
|
63
|
+
if (value.parentId !== null && value.observationMethod === null)
|
|
64
|
+
throw new Error("child goal observation method is required");
|
|
65
|
+
if (value.parentId !== null && value.verificationMethod === null)
|
|
66
|
+
throw new Error("child goal verification method is required");
|
|
67
|
+
if (!["active", "paused", "blocked", "complete"].includes(value.phase))
|
|
68
|
+
throw new Error(`invalid goal phase: ${value.phase}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
goalAutomaticTarget,
|
|
73
|
+
specialistAutomaticTarget,
|
|
74
|
+
goalRoute,
|
|
75
|
+
humanInboxRoute,
|
|
76
|
+
humanRequestRoute,
|
|
77
|
+
specialistInboxRoute,
|
|
78
|
+
noGoalCommitment,
|
|
79
|
+
goalCommitment,
|
|
80
|
+
normalizeAssistantText,
|
|
81
|
+
assertWakeTransition,
|
|
82
|
+
assertGoalTransition,
|
|
83
|
+
assertHandoff,
|
|
84
|
+
assertAgentHandoff,
|
|
85
|
+
assertTurnOutput,
|
|
86
|
+
assertGoalSnapshot
|
|
87
|
+
};
|