@goah/cli 0.2.0 → 0.3.0
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/cli.js +1 -2
- package/dist/cli.js.map +1 -1
- package/dist/execution.d.ts +2 -0
- package/dist/execution.d.ts.map +1 -0
- package/dist/execution.js +2 -0
- package/dist/execution.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/kernel.d.ts +2 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +2 -0
- package/dist/kernel.js.map +1 -0
- package/dist/metrics.d.ts +2 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +2 -0
- package/dist/metrics.js.map +1 -0
- package/dist/runner-pi.d.ts +2 -0
- package/dist/runner-pi.d.ts.map +1 -0
- package/dist/runner-pi.js +2 -0
- package/dist/runner-pi.js.map +1 -0
- package/dist/session.d.ts +2 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +2 -0
- package/dist/session.js.map +1 -0
- package/dist/sqlite.d.ts +2 -0
- package/dist/sqlite.d.ts.map +1 -0
- package/dist/sqlite.js +2 -0
- package/dist/sqlite.js.map +1 -0
- package/dist/supervisor.d.ts +2 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +2 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/testkit.d.ts +2 -0
- package/dist/testkit.d.ts.map +1 -0
- package/dist/testkit.js +2 -0
- package/dist/testkit.js.map +1 -0
- package/node_modules/goah-ledger-contract/dist/execution.d.ts +205 -0
- package/node_modules/goah-ledger-contract/dist/execution.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/execution.js +18 -0
- package/node_modules/goah-ledger-contract/dist/execution.js.map +1 -0
- package/node_modules/goah-ledger-contract/dist/index.d.ts +5 -0
- package/node_modules/goah-ledger-contract/dist/index.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/index.js +5 -0
- package/node_modules/goah-ledger-contract/dist/index.js.map +1 -0
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts +33 -0
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/kernel.js +6 -0
- package/node_modules/goah-ledger-contract/dist/kernel.js.map +1 -0
- package/node_modules/goah-ledger-contract/dist/metrics.d.ts +40 -0
- package/node_modules/goah-ledger-contract/dist/metrics.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/metrics.js +25 -0
- package/node_modules/goah-ledger-contract/dist/metrics.js.map +1 -0
- package/node_modules/goah-ledger-contract/dist/session.d.ts +37 -0
- package/node_modules/goah-ledger-contract/dist/session.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/session.js +53 -0
- package/node_modules/goah-ledger-contract/dist/session.js.map +1 -0
- package/node_modules/goah-ledger-contract/package.json +29 -0
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts +66 -0
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts.map +1 -0
- package/node_modules/goah-ledger-sqlite/dist/index.js +537 -0
- package/node_modules/goah-ledger-sqlite/dist/index.js.map +1 -0
- package/node_modules/goah-ledger-sqlite/package.json +26 -0
- package/node_modules/goah-runner-pi/dist/index.d.ts +53 -0
- package/node_modules/goah-runner-pi/dist/index.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/index.js +229 -0
- package/node_modules/goah-runner-pi/dist/index.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/model-provider.d.ts +13 -0
- package/node_modules/goah-runner-pi/dist/model-provider.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/model-provider.js +75 -0
- package/node_modules/goah-runner-pi/dist/model-provider.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts +11 -0
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/pi-worker.js +263 -0
- package/node_modules/goah-runner-pi/dist/pi-worker.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/verification-worker.d.ts +2 -0
- package/node_modules/goah-runner-pi/dist/verification-worker.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/verification-worker.js +48 -0
- package/node_modules/goah-runner-pi/dist/verification-worker.js.map +1 -0
- package/node_modules/goah-runner-pi/package.json +28 -0
- package/node_modules/goah-supervisor/dist/context-view.d.ts +21 -0
- package/node_modules/goah-supervisor/dist/context-view.d.ts.map +1 -0
- package/node_modules/goah-supervisor/dist/context-view.js +33 -0
- package/node_modules/goah-supervisor/dist/context-view.js.map +1 -0
- package/node_modules/goah-supervisor/dist/index.d.ts +54 -0
- package/node_modules/goah-supervisor/dist/index.d.ts.map +1 -0
- package/node_modules/goah-supervisor/dist/index.js +436 -0
- package/node_modules/goah-supervisor/dist/index.js.map +1 -0
- package/node_modules/goah-supervisor/dist/roles.d.ts +3 -0
- package/node_modules/goah-supervisor/dist/roles.d.ts.map +1 -0
- package/node_modules/goah-supervisor/dist/roles.js +8 -0
- package/node_modules/goah-supervisor/dist/roles.js.map +1 -0
- package/node_modules/goah-supervisor/dist/verification.d.ts +82 -0
- package/node_modules/goah-supervisor/dist/verification.d.ts.map +1 -0
- package/node_modules/goah-supervisor/dist/verification.js +110 -0
- package/node_modules/goah-supervisor/dist/verification.js.map +1 -0
- package/node_modules/goah-supervisor/package.json +26 -0
- package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts +2 -0
- package/node_modules/goah-testkit/dist/faux-runner-worker.d.ts.map +1 -0
- package/node_modules/goah-testkit/dist/faux-runner-worker.js +29 -0
- package/node_modules/goah-testkit/dist/faux-runner-worker.js.map +1 -0
- package/node_modules/goah-testkit/dist/index.d.ts +51 -0
- package/node_modules/goah-testkit/dist/index.d.ts.map +1 -0
- package/node_modules/goah-testkit/dist/index.js +96 -0
- package/node_modules/goah-testkit/dist/index.js.map +1 -0
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts +2 -0
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts.map +1 -0
- package/node_modules/goah-testkit/dist/mock-connector-worker.js +29 -0
- package/node_modules/goah-testkit/dist/mock-connector-worker.js.map +1 -0
- package/node_modules/goah-testkit/package.json +29 -0
- package/package.json +27 -8
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const CONTRACT_VERSION: "0.3.0";
|
|
2
|
+
export declare const CONTRACT_STABILITY: "experimental";
|
|
3
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
4
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
5
|
+
[key: string]: JsonValue;
|
|
6
|
+
};
|
|
7
|
+
/** One append request. Sequence numbers are assigned by the ledger. */
|
|
8
|
+
export interface EventInput {
|
|
9
|
+
streamId: string;
|
|
10
|
+
ts: string;
|
|
11
|
+
actor: string;
|
|
12
|
+
type: string;
|
|
13
|
+
data: JsonValue;
|
|
14
|
+
}
|
|
15
|
+
/** One immutable fact in the global ledger and in one logical stream. */
|
|
16
|
+
export interface EventRecord extends EventInput {
|
|
17
|
+
seq: number;
|
|
18
|
+
streamSeq: number;
|
|
19
|
+
}
|
|
20
|
+
export interface EventStore {
|
|
21
|
+
appendEvent(input: EventInput): EventRecord;
|
|
22
|
+
appendEvents(inputs: EventInput[]): EventRecord[];
|
|
23
|
+
readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
24
|
+
eventsSince(seq: number, types?: string[]): EventRecord[];
|
|
25
|
+
events(): EventRecord[];
|
|
26
|
+
}
|
|
27
|
+
export interface Clock {
|
|
28
|
+
now(): Date;
|
|
29
|
+
}
|
|
30
|
+
export declare function wakeStream(wakeId: string): string;
|
|
31
|
+
export declare function controlStream(actor?: string): string;
|
|
32
|
+
export declare function goalStream(goalId: string): string;
|
|
33
|
+
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":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AE,MAAM,GAAG,MAAM,CAA6B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const CONTRACT_VERSION = "0.3.0";
|
|
2
|
+
export const CONTRACT_STABILITY = "experimental";
|
|
3
|
+
export function wakeStream(wakeId) { return `wake:${wakeId}`; }
|
|
4
|
+
export function controlStream(actor = "supervisor") { return `control:${actor}`; }
|
|
5
|
+
export function goalStream(goalId) { return `goal:${goalId}`; }
|
|
6
|
+
//# sourceMappingURL=kernel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAgB,CAAC;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAuB,CAAC;AA8B1D,MAAM,UAAU,UAAU,CAAC,MAAc,IAAY,OAAO,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/E,MAAM,UAAU,aAAa,CAAC,KAAK,GAAG,YAAY,IAAY,OAAO,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC;AAC1F,MAAM,UAAU,UAAU,CAAC,MAAc,IAAY,OAAO,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { JsonValue } from "./kernel.js";
|
|
2
|
+
/** Optional goal-measurement policy. It is not part of the Goal contract. */
|
|
3
|
+
export interface MetricContract {
|
|
4
|
+
source: string;
|
|
5
|
+
window: string;
|
|
6
|
+
direction: "increase" | "decrease" | "at_least" | "at_most";
|
|
7
|
+
target: number;
|
|
8
|
+
freshnessMs: number;
|
|
9
|
+
onMissing: "abnormal" | "wake_owner";
|
|
10
|
+
onStale: "abnormal" | "wake_owner";
|
|
11
|
+
sustainForMs?: number;
|
|
12
|
+
guardrails?: Array<{
|
|
13
|
+
metric: string;
|
|
14
|
+
direction: "at_least" | "at_most";
|
|
15
|
+
target: number;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface MetricSample {
|
|
19
|
+
goalId: string;
|
|
20
|
+
source: string;
|
|
21
|
+
observedAt: string;
|
|
22
|
+
value: number | null;
|
|
23
|
+
guardrails?: Record<string, number>;
|
|
24
|
+
}
|
|
25
|
+
export interface MetricEvaluation {
|
|
26
|
+
goalId: string;
|
|
27
|
+
status: "met" | "missed" | "missing" | "stale" | "guardrail_breached";
|
|
28
|
+
shouldWakeOwner: boolean;
|
|
29
|
+
evaluatedAt: string;
|
|
30
|
+
value: number | null;
|
|
31
|
+
}
|
|
32
|
+
export interface MetricProcessSpec {
|
|
33
|
+
command: string;
|
|
34
|
+
args: string[];
|
|
35
|
+
env?: Record<string, string>;
|
|
36
|
+
timeoutMs?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function evaluateMetric(metric: MetricContract, samples: MetricSample[], now: string): MetricEvaluation;
|
|
39
|
+
export declare function metricEventData(value: MetricSample | MetricEvaluation): JsonValue;
|
|
40
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,UAAU,GAAG,YAAY,CAAC;IACrC,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,YAAY;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;AAC/I,MAAM,WAAW,gBAAgB;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,oBAAoB,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAChM,MAAM,WAAW,iBAAiB;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAExH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAmB7G;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,gBAAgB,GAAG,SAAS,CAA0C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function evaluateMetric(metric, samples, now) {
|
|
2
|
+
const latest = samples.filter((sample) => sample.source === metric.source).sort((a, b) => b.observedAt.localeCompare(a.observedAt))[0];
|
|
3
|
+
if (!latest || latest.value === null)
|
|
4
|
+
return { goalId: latest?.goalId ?? "unknown", status: "missing", shouldWakeOwner: metric.onMissing === "wake_owner", evaluatedAt: now, value: null };
|
|
5
|
+
if (Date.parse(now) - Date.parse(latest.observedAt) > metric.freshnessMs)
|
|
6
|
+
return { goalId: latest.goalId, status: "stale", shouldWakeOwner: metric.onStale === "wake_owner", evaluatedAt: now, value: latest.value };
|
|
7
|
+
const guardrailBreached = (metric.guardrails ?? []).some((guardrail) => {
|
|
8
|
+
const value = latest.guardrails?.[guardrail.metric];
|
|
9
|
+
return value === undefined || (guardrail.direction === "at_least" ? value < guardrail.target : value > guardrail.target);
|
|
10
|
+
});
|
|
11
|
+
if (guardrailBreached)
|
|
12
|
+
return { goalId: latest.goalId, status: "guardrail_breached", shouldWakeOwner: true, evaluatedAt: now, value: latest.value };
|
|
13
|
+
const meets = (value) => metric.direction === "increase" || metric.direction === "at_least" ? value >= metric.target : value <= metric.target;
|
|
14
|
+
let met = meets(latest.value);
|
|
15
|
+
if (met && metric.sustainForMs) {
|
|
16
|
+
const cutoff = Date.parse(now) - metric.sustainForMs;
|
|
17
|
+
const ordered = samples.filter((sample) => sample.source === metric.source && sample.value !== null && Date.parse(sample.observedAt) <= Date.parse(now)).sort((a, b) => a.observedAt.localeCompare(b.observedAt));
|
|
18
|
+
const baseline = ordered.findLast((sample) => Date.parse(sample.observedAt) <= cutoff);
|
|
19
|
+
const sustained = ordered.filter((sample) => Date.parse(sample.observedAt) >= cutoff);
|
|
20
|
+
met = Boolean(baseline && meets(baseline.value) && sustained.every((sample) => meets(sample.value)));
|
|
21
|
+
}
|
|
22
|
+
return { goalId: latest.goalId, status: met ? "met" : "missed", shouldWakeOwner: !met, evaluatedAt: now, value: latest.value };
|
|
23
|
+
}
|
|
24
|
+
export function metricEventData(value) { return value; }
|
|
25
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,cAAc,CAAC,MAAsB,EAAE,OAAuB,EAAE,GAAW;IACzF,MAAM,MAAM,GAAG,OAA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E,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,CAAC;QACtF,GAAG,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAM,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACjI,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAsC,IAAe,OAAO,KAA6B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EventInput, EventRecord, JsonValue } from "./kernel.js";
|
|
2
|
+
export type SessionEventType = "session.started" | "request.prepared" | "turn.started" | "message.user" | "message.assistant.delta" | "message.assistant.completed" | "tool.called" | "tool.completed" | "context.compacted" | "turn.completed" | "session.completed" | "session.interrupted";
|
|
3
|
+
export interface SessionMessage {
|
|
4
|
+
id: string;
|
|
5
|
+
role: "user" | "assistant" | "tool";
|
|
6
|
+
content: JsonValue;
|
|
7
|
+
toolCallId?: string;
|
|
8
|
+
usage?: JsonValue;
|
|
9
|
+
}
|
|
10
|
+
export interface RequestSnapshot {
|
|
11
|
+
provider: string;
|
|
12
|
+
model: string;
|
|
13
|
+
systemPrompt: string;
|
|
14
|
+
activeContext: string;
|
|
15
|
+
messages: JsonValue[];
|
|
16
|
+
tools: JsonValue[];
|
|
17
|
+
modelConfig: JsonValue;
|
|
18
|
+
sourceSeqs: number[];
|
|
19
|
+
}
|
|
20
|
+
export interface ReplayedSession {
|
|
21
|
+
messages: SessionMessage[];
|
|
22
|
+
status: "running" | "completed" | "interrupted";
|
|
23
|
+
openToolCalls: Array<{
|
|
24
|
+
callId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
arguments: JsonValue;
|
|
27
|
+
}>;
|
|
28
|
+
lastRequest: RequestSnapshot | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function isSessionEvent(event: Pick<EventRecord, "type">): event is EventRecord & {
|
|
31
|
+
type: SessionEventType;
|
|
32
|
+
};
|
|
33
|
+
/** Rebuild the model-visible transcript from canonical, normalized session events. */
|
|
34
|
+
export declare function replaySession(events: readonly EventRecord[]): ReplayedSession;
|
|
35
|
+
/** Synthetic facts that close an interrupted session without hiding unknown tool outcomes. */
|
|
36
|
+
export declare function interruptedSessionEvents(events: readonly EventRecord[], ts: string, actor: string): EventInput[];
|
|
37
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,cAAc,GAAG,cAAc,GAAG,yBAAyB,GAAG,6BAA6B,GAAG,aAAa,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAC9R,MAAM,WAAW,cAAc;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE;AAC/I,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;IAAC,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,WAAW,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE;AAC1M,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,cAAc,EAAE,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;IAAC,aAAa,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAAC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAA;CAAE;AAGnO,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,KAAK,IAAI,WAAW,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAA8D;AAEjL,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,eAAe,CA6B7E;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAOhH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const SESSION_TYPES = new Set(["session.started", "request.prepared", "turn.started", "message.user", "message.assistant.delta", "message.assistant.completed", "tool.called", "tool.completed", "context.compacted", "turn.completed", "session.completed", "session.interrupted"]);
|
|
2
|
+
export function isSessionEvent(event) { return SESSION_TYPES.has(event.type); }
|
|
3
|
+
/** Rebuild the model-visible transcript from canonical, normalized session events. */
|
|
4
|
+
export function replaySession(events) {
|
|
5
|
+
let expected = events[0]?.streamSeq ?? 1;
|
|
6
|
+
const messages = [];
|
|
7
|
+
const calls = new Map();
|
|
8
|
+
let status = "running";
|
|
9
|
+
let lastRequest = null;
|
|
10
|
+
for (const event of events) {
|
|
11
|
+
if (event.streamSeq !== expected)
|
|
12
|
+
throw new Error(`session stream gap: expected ${expected}, got ${event.streamSeq}`);
|
|
13
|
+
expected += 1;
|
|
14
|
+
if (!isSessionEvent(event))
|
|
15
|
+
continue;
|
|
16
|
+
const data = event.data;
|
|
17
|
+
if (event.type === "message.user" || event.type === "message.assistant.completed")
|
|
18
|
+
messages.push(data.message);
|
|
19
|
+
else if (event.type === "tool.called") {
|
|
20
|
+
const call = { callId: String(data.callId), name: String(data.name), arguments: (data.arguments ?? null) };
|
|
21
|
+
calls.set(call.callId, call);
|
|
22
|
+
}
|
|
23
|
+
else if (event.type === "tool.completed") {
|
|
24
|
+
const callId = String(data.callId);
|
|
25
|
+
calls.delete(callId);
|
|
26
|
+
messages.push({ id: String(data.messageId ?? `tool:${callId}`), role: "tool", toolCallId: callId, content: (data.result ?? null) });
|
|
27
|
+
}
|
|
28
|
+
else if (event.type === "context.compacted") {
|
|
29
|
+
const replaced = new Set(Array.isArray(data.replacedMessageIds) ? data.replacedMessageIds.map(String) : []);
|
|
30
|
+
const kept = messages.filter((message) => !replaced.has(message.id));
|
|
31
|
+
messages.splice(0, messages.length, ...kept);
|
|
32
|
+
messages.unshift({ id: String(data.summaryMessageId), role: "user", content: String(data.summary) });
|
|
33
|
+
}
|
|
34
|
+
else if (event.type === "request.prepared")
|
|
35
|
+
lastRequest = event.data;
|
|
36
|
+
else if (event.type === "session.completed")
|
|
37
|
+
status = "completed";
|
|
38
|
+
else if (event.type === "session.interrupted")
|
|
39
|
+
status = "interrupted";
|
|
40
|
+
}
|
|
41
|
+
return { messages, status, openToolCalls: [...calls.values()], lastRequest };
|
|
42
|
+
}
|
|
43
|
+
/** Synthetic facts that close an interrupted session without hiding unknown tool outcomes. */
|
|
44
|
+
export function interruptedSessionEvents(events, ts, actor) {
|
|
45
|
+
const replayed = replaySession(events);
|
|
46
|
+
if (replayed.status !== "running" || !events.some((event) => event.type === "session.started"))
|
|
47
|
+
return [];
|
|
48
|
+
const streamId = events[0].streamId;
|
|
49
|
+
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" } } }));
|
|
50
|
+
repairs.push({ streamId, ts, actor, type: "session.interrupted", data: { reason: "runner interrupted" } });
|
|
51
|
+
return repairs;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAOA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAmB,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACvS,MAAM,UAAU,cAAc,CAAC,KAAgC,IAAuD,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAwB,CAAC,CAAC,CAAC,CAAC;AAEjL,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,MAA8B;IAC1D,IAAI,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkE,CAAC;IACxF,IAAI,MAAM,GAA8B,SAAS,CAAC;IAClD,IAAI,WAAW,GAA2B,IAAI,CAAC;IAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ;YAAE,MA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AAK,iBAAiB,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1G,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC;IACrC,MAAM,OAAO,GAAiB,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,4CAA4C,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAChS,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC3G,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "goah-ledger-contract",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/billc8128/goah.git",
|
|
9
|
+
"directory": "packages/ledger-contract"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=24.0.0"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"!dist/**/*.test.*",
|
|
17
|
+
"!dist/.tsbuildinfo"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./dist/index.js",
|
|
24
|
+
"./kernel": "./dist/kernel.js",
|
|
25
|
+
"./session": "./dist/session.js",
|
|
26
|
+
"./execution": "./dist/execution.js",
|
|
27
|
+
"./metrics": "./dist/metrics.js"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { type ActionSnapshot, type ActionStatus, type AuditAdvice, type Clock, type EventInput, type EventRecord, type GoalSnapshot, type HandoffCommit, type Ledger, type MailSnapshot, type MetricSample, type ScheduleSnapshot, type WakeSnapshot } from "goah-ledger-contract";
|
|
3
|
+
type FaultPoint = "after_event_before_projection";
|
|
4
|
+
type FaultInjector = (point: FaultPoint) => void;
|
|
5
|
+
export declare const SQLITE_SCHEMA_VERSION = 6;
|
|
6
|
+
export interface SqliteLedgerOptions {
|
|
7
|
+
faultInjector?: FaultInjector;
|
|
8
|
+
clock?: Clock;
|
|
9
|
+
busyTimeoutMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class SqliteLedger implements Ledger {
|
|
12
|
+
#private;
|
|
13
|
+
readonly db: DatabaseSync;
|
|
14
|
+
constructor(path?: string, options?: SqliteLedgerOptions);
|
|
15
|
+
close(): void;
|
|
16
|
+
appendEvent(input: EventInput): EventRecord;
|
|
17
|
+
appendEvents(inputs: EventInput[]): EventRecord[];
|
|
18
|
+
readStream(streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
19
|
+
putGoal(goal: GoalSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
20
|
+
putSchedule(value: ScheduleSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
21
|
+
enqueueWake(input: WakeSnapshot, actor: string): {
|
|
22
|
+
event: EventRecord;
|
|
23
|
+
created: boolean;
|
|
24
|
+
};
|
|
25
|
+
claimNextWake(now: string, leaseUntil: string, leaseToken: string): WakeSnapshot | null;
|
|
26
|
+
markWakeRunning(id: string, now: string, leaseToken: string): WakeSnapshot;
|
|
27
|
+
attachWakeProcess(id: string, leaseToken: string, pid: number, now: string): WakeSnapshot;
|
|
28
|
+
renewWakeLease(id: string, leaseToken: string, leaseUntil: string, now: string): WakeSnapshot;
|
|
29
|
+
finishWake(id: string, status: "done" | "abnormal" | "merge_blocked", now: string): WakeSnapshot;
|
|
30
|
+
expiredWakes(now: string): WakeSnapshot[];
|
|
31
|
+
recoverExpiredWake(id: string, now: string): WakeSnapshot;
|
|
32
|
+
appendRunnerEvent(input: EventInput, leaseToken: string): EventRecord;
|
|
33
|
+
requestAction(action: ActionSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
34
|
+
approveAction(id: string, approver: string, reason: string, evidence: number[]): ActionSnapshot;
|
|
35
|
+
rejectAction(id: string, approver: string, reason: string, evidence: number[]): ActionSnapshot;
|
|
36
|
+
transitionAction(id: string, status: ActionStatus, patch?: Partial<Pick<ActionSnapshot, "externalRef" | "reconciledAt">>): ActionSnapshot;
|
|
37
|
+
recoverDispatchingActions(): ActionSnapshot[];
|
|
38
|
+
putAuditAdvice(id: string, input: Omit<AuditAdvice, "at">, wakeId?: string): ActionSnapshot;
|
|
39
|
+
ackAuditAdvice(id: string, agent: string): ActionSnapshot;
|
|
40
|
+
putMail(mail: MailSnapshot, actor: string, wakeId?: string): EventRecord;
|
|
41
|
+
commitHandoff(commit: HandoffCommit): EventRecord;
|
|
42
|
+
dueSchedules(now: string): ScheduleSnapshot[];
|
|
43
|
+
unreadMail(agent: string): MailSnapshot[];
|
|
44
|
+
unackedAuditAdvice(agent: string): ActionSnapshot[];
|
|
45
|
+
lastEvent(actor: string, type: string): EventRecord | null;
|
|
46
|
+
eventsForWake(wakeId: string): EventRecord[];
|
|
47
|
+
wake(id: string): WakeSnapshot | null;
|
|
48
|
+
wakeByTrigger(agent: string, triggerRef: string): WakeSnapshot | null;
|
|
49
|
+
queuedWakeForAgent(agent: string): WakeSnapshot | null;
|
|
50
|
+
action(id: string): ActionSnapshot | null;
|
|
51
|
+
goalsForOwner(owner: string): GoalSnapshot[];
|
|
52
|
+
goal(id: string): GoalSnapshot | null;
|
|
53
|
+
triggeringMail(): MailSnapshot[];
|
|
54
|
+
eventsSince(seq: number, types?: string[]): EventRecord[];
|
|
55
|
+
searchEvents(query: string, limit?: number): EventRecord[];
|
|
56
|
+
metricSamples(goalId: string): MetricSample[];
|
|
57
|
+
events(): EventRecord[];
|
|
58
|
+
goals(): GoalSnapshot[];
|
|
59
|
+
schedules(): ScheduleSnapshot[];
|
|
60
|
+
wakes(): WakeSnapshot[];
|
|
61
|
+
actions(): ActionSnapshot[];
|
|
62
|
+
mailbox(): MailSnapshot[];
|
|
63
|
+
rebuildProjections(): void;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,KAAK,EAEV,KAAK,UAAU,EACf,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,UAAU,GAAG,+BAA+B,CAAC;AAClD,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAIjD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAiHvC,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa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