@cotal-ai/runtime 0.0.1 → 0.24.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/fork.d.ts +144 -0
- package/dist/fork.d.ts.map +1 -0
- package/dist/fork.js +310 -0
- package/dist/fork.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/journal-store.d.ts +54 -0
- package/dist/journal-store.d.ts.map +1 -0
- package/dist/journal-store.js +60 -0
- package/dist/journal-store.js.map +1 -0
- package/dist/mesh-handler.d.ts +310 -0
- package/dist/mesh-handler.d.ts.map +1 -0
- package/dist/mesh-handler.js +731 -0
- package/dist/mesh-handler.js.map +1 -0
- package/dist/migrate.d.ts +147 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +256 -0
- package/dist/migrate.js.map +1 -0
- package/dist/resolve-checkpoint.d.ts +75 -0
- package/dist/resolve-checkpoint.d.ts.map +1 -0
- package/dist/resolve-checkpoint.js +108 -0
- package/dist/resolve-checkpoint.js.map +1 -0
- package/dist/run-context.d.ts +42 -0
- package/dist/run-context.d.ts.map +1 -0
- package/dist/run-context.js +55 -0
- package/dist/run-context.js.map +1 -0
- package/dist/run-driver.d.ts +124 -0
- package/dist/run-driver.d.ts.map +1 -0
- package/dist/run-driver.js +228 -0
- package/dist/run-driver.js.map +1 -0
- package/package.json +31 -16
- package/README.md +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-handler.js","sourceRoot":"","sources":["../src/mesh-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,2BA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;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migrate a run onto edited source: the migrate check, and why the check is the whole decision.
|
|
3
|
+
*
|
|
4
|
+
* Nothing here rewrites a journal and nothing here performs an effect. A migration is decided by a
|
|
5
|
+
* DRY walk of the new program over the recorded journal, and the walk answers two questions with
|
|
6
|
+
* two different inputs — which is the distinction that decided it. Whether a RECORD is still valid
|
|
7
|
+
* is a question about the record and is answered on the raw fact; which records the program still
|
|
8
|
+
* REACHES is a question about the program and is answered through its own view, with checkpoint
|
|
9
|
+
* policy applied. Both live in the language: the hash comparison in `Journal.lookup`, the policy
|
|
10
|
+
* sandwich at the interpreter's `checkpoint` call site. This file supplies the walk's mode, reads
|
|
11
|
+
* what it left behind, and applies the orphan table.
|
|
12
|
+
*
|
|
13
|
+
* **The orphan table is by effect kind because our removed steps have consequences.** "Removed
|
|
14
|
+
* steps' data is ignored" is right for a step that outlives nothing. It is wrong for an agent that
|
|
15
|
+
* is still running, a conclave whose membership is still open, a decision a person actually made,
|
|
16
|
+
* and a notice an agent has not yet been told. Each of those is a REFUSAL with a code, and the
|
|
17
|
+
* refusal is the product: a migration that quietly dropped one would be an evidence-carrying system
|
|
18
|
+
* discarding evidence.
|
|
19
|
+
*
|
|
20
|
+
* **The commit files its own record kind, and that was a scope decision rather than a preference.**
|
|
21
|
+
* The obvious home for a `migrated` fact is the run record itself; a records-KV record has a
|
|
22
|
+
* create-only half for what a thing IS and a last-value-wins half for what it is DOING, and a
|
|
23
|
+
* migration is neither — it is append-only history with an actor, and a run can migrate more than
|
|
24
|
+
* once. So there is a `migration` kind (SPEC amendment A10), keyed by a content-derived id, whose
|
|
25
|
+
* spec is the report and whose status is the application.
|
|
26
|
+
*
|
|
27
|
+
* **What the commit still does NOT do**: advance the run's pinned program hash, because
|
|
28
|
+
* `RunSpecValue` carries none to advance — a program-hash pin is declared and unbuilt, and this
|
|
29
|
+
* branch deliberately did not invent it. The migration is durable and readable; the run record does
|
|
30
|
+
* not yet name its source.
|
|
31
|
+
*/
|
|
32
|
+
import type { KV } from "@nats-io/kv";
|
|
33
|
+
import { type JournalEntry, type RunPins } from "@cotal-ai/lang";
|
|
34
|
+
/** What the caller decided to override, and therefore what the record has to say they decided. */
|
|
35
|
+
export interface MigrateOverrides {
|
|
36
|
+
/**
|
|
37
|
+
* Discard human decisions the edit made unreachable. Recorded WITH the actor: the one
|
|
38
|
+
* absolute is that a recorded human decision is never discarded quietly.
|
|
39
|
+
*/
|
|
40
|
+
readonly discardApprovals?: boolean;
|
|
41
|
+
/** `--adopt <handle>` / `--release` for an orphaned spawn. Lane-A-gated by their subject. */
|
|
42
|
+
readonly adopt?: readonly string[];
|
|
43
|
+
readonly release?: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
export type OrphanVerdict = "ignored" | "kept" | "rejected";
|
|
46
|
+
/** One journal entry the new source no longer reaches, and what the table says about it. */
|
|
47
|
+
export interface MigrateOrphan {
|
|
48
|
+
readonly step: string;
|
|
49
|
+
readonly kind: string;
|
|
50
|
+
readonly verdict: OrphanVerdict;
|
|
51
|
+
/** The error catalog code, on a rejection only. */
|
|
52
|
+
readonly code?: string;
|
|
53
|
+
readonly why: string;
|
|
54
|
+
}
|
|
55
|
+
export interface MigrateDivergence {
|
|
56
|
+
readonly step: string;
|
|
57
|
+
readonly recordedHash: string;
|
|
58
|
+
readonly programHash: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The answer a migration attempt produces.
|
|
62
|
+
*
|
|
63
|
+
* `admissible` is the commit condition — no divergence and the orphan table satisfied — and
|
|
64
|
+
* NOT a statement that anything was written. Nothing is: see {@link commitMigration}.
|
|
65
|
+
*/
|
|
66
|
+
export interface MigrateReport {
|
|
67
|
+
readonly run: string;
|
|
68
|
+
readonly at: number;
|
|
69
|
+
readonly actor: string;
|
|
70
|
+
readonly admissible: boolean;
|
|
71
|
+
/** How many recorded entries the walk accounted for. */
|
|
72
|
+
readonly consumedThrough: number;
|
|
73
|
+
readonly orphans: readonly MigrateOrphan[];
|
|
74
|
+
readonly divergence?: MigrateDivergence;
|
|
75
|
+
/** A scope the walk could not enter, which is a refusal rather than a silent consume. */
|
|
76
|
+
readonly unwalkable?: {
|
|
77
|
+
readonly step: string;
|
|
78
|
+
readonly why: string;
|
|
79
|
+
};
|
|
80
|
+
/** The overrides the caller passed, as recorded strings, for the fact the commit will file. */
|
|
81
|
+
readonly overrides: readonly string[];
|
|
82
|
+
/** The hash of the source this run would move TO. Computed from that source, so not a claim. */
|
|
83
|
+
readonly toHash: string;
|
|
84
|
+
readonly fromHash?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface MigrateRequest {
|
|
87
|
+
/** The endpoint hosting the driver — the notices are keyed under it. */
|
|
88
|
+
readonly endpoint: string;
|
|
89
|
+
readonly runId: string;
|
|
90
|
+
/** The NEW program. */
|
|
91
|
+
readonly source: string;
|
|
92
|
+
/** The recorded journal, as the barrier replayed it. */
|
|
93
|
+
readonly entries: readonly JournalEntry[];
|
|
94
|
+
/** Read back from the run record, never re-derived: a migration does not re-pin a run. */
|
|
95
|
+
readonly pins: RunPins;
|
|
96
|
+
readonly kv: KV;
|
|
97
|
+
/** Who asked. Recorded on any override, because an override is a person's decision. */
|
|
98
|
+
readonly actor: string;
|
|
99
|
+
readonly now: () => number;
|
|
100
|
+
readonly overrides?: MigrateOverrides;
|
|
101
|
+
readonly file?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The program hash the run was on, as the CALLER states it.
|
|
104
|
+
*
|
|
105
|
+
* Not verifiable here and deliberately not invented: a program-hash pin on the run record is
|
|
106
|
+
* declared and unbuilt, and `RunSpecValue` does not carry one yet, so a hash computed from a
|
|
107
|
+
* source this function was never given would be a guess wearing a fact's name. Absent when the
|
|
108
|
+
* caller does not know it, and the record says absent rather than approximate.
|
|
109
|
+
*/
|
|
110
|
+
readonly fromHash?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Run the migrate check. Reads; never writes.
|
|
114
|
+
*
|
|
115
|
+
* The report is the product whether or not the migration is admissible — a rejected migration owes
|
|
116
|
+
* the caller the per-step reason, which is the only thing that makes repair possible (the `L`
|
|
117
|
+
* catalogue).
|
|
118
|
+
*/
|
|
119
|
+
export declare function migrateRun(req: MigrateRequest): Promise<MigrateReport>;
|
|
120
|
+
/**
|
|
121
|
+
* File the migration, and record that this driver applied it.
|
|
122
|
+
*
|
|
123
|
+
* TWO WRITES AND THEY ARE DIFFERENT ACTS. The report is filed create-only under an id derived from
|
|
124
|
+
* its own content, so the retry a crash forces lands on its own record rather than filing a second
|
|
125
|
+
* migration for one decision. The application is a separate, create-only status: two drivers racing
|
|
126
|
+
* to advance one run both find no status and both write, and the store decides. A driver that lost
|
|
127
|
+
* that race hears about it instead of believing it moved a run somebody else moved.
|
|
128
|
+
*
|
|
129
|
+
* REFUSED FOR AN INADMISSIBLE REPORT, before anything is written. A migration the check rejected is
|
|
130
|
+
* not a migration with a caveat — filing it would put a decision nobody may act on into the same
|
|
131
|
+
* history a reader trusts, and the refusal is the product the check exists to produce.
|
|
132
|
+
*
|
|
133
|
+
* What is still NOT here, stated rather than implied: the run's pinned program hash does not
|
|
134
|
+
* advance, because `RunSpecValue` carries no program hash to advance — that pin is declared and
|
|
135
|
+
* unbuilt, and this branch does not invent it. The migration is durable and readable; the run
|
|
136
|
+
* record does not yet name which source it is on.
|
|
137
|
+
*/
|
|
138
|
+
export declare function commitMigration(kv: KV, endpoint: string, report: MigrateReport, driver: string): Promise<{
|
|
139
|
+
migrationId: string;
|
|
140
|
+
created: boolean;
|
|
141
|
+
}>;
|
|
142
|
+
/** A migration the check refused, offered for commit anyway. The report says which rows refused. */
|
|
143
|
+
export declare class MigrationNotAdmissible extends Error {
|
|
144
|
+
readonly report: MigrateReport;
|
|
145
|
+
constructor(report: MigrateReport);
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,CAmE5E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CACnC,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAuBpD;AAED,oGAAoG;AACpG,qBAAa,sBAAuB,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAE,aAAa;gBAArB,MAAM,EAAE,aAAa;CAa3C"}
|
package/dist/migrate.js
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { listRunNoticesForRun, runMigrationId, writeRunMigration, markRunMigrationApplied, } from "@cotal-ai/core";
|
|
2
|
+
import { Journal, JournalReadOnlyError, journalEntryKeyString, programHashOf, run as runProgram, RunDivergence, UnwalkableScope, ScopeBranchMissing, } from "@cotal-ai/lang";
|
|
3
|
+
/** The walk reached work the recorded run never did. Not an error: it is where a walk STOPS. */
|
|
4
|
+
class Frontier extends Error {
|
|
5
|
+
step;
|
|
6
|
+
constructor(step) {
|
|
7
|
+
super(`the dry walk reached the frontier at ${step}`);
|
|
8
|
+
this.step = step;
|
|
9
|
+
this.name = "Frontier";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A handler that performs NOTHING and says so by stopping.
|
|
14
|
+
*
|
|
15
|
+
* The migrate walk "stops at the frontier", and the frontier is exactly the first effect with no
|
|
16
|
+
* record behind it. A handler that returned a plausible value instead would carry the walk past it
|
|
17
|
+
* into a region where every subsequent step is a `miss`, and the orphan set — the entire output —
|
|
18
|
+
* would be computed against a history the run does not have.
|
|
19
|
+
*
|
|
20
|
+
* IT IS THE SECOND STOP, NOT THE FIRST, and that is worth knowing rather than discovering. The walk
|
|
21
|
+
* reads a READ-ONLY journal, so a missing step is refused at `begin` before any handler is reached:
|
|
22
|
+
* the check's inability to write is what actually terminates it. This handler catches the case the
|
|
23
|
+
* journal cannot — an entry left PENDING by a crash, which is looked up rather than begun — and is
|
|
24
|
+
* the belt for any later path that reaches a handler without appending first.
|
|
25
|
+
*/
|
|
26
|
+
function dryHandler(now) {
|
|
27
|
+
const stop = (_req, ctx) => {
|
|
28
|
+
throw new Frontier(`${ctx.key.kind}:${ctx.key.name}#${ctx.key.occurrence}`);
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
now,
|
|
32
|
+
spawn: stop, turn: stop, ask: stop, checkpoint: stop, sleep: stop,
|
|
33
|
+
wait: stop, notify: stop, monitor: stop, openConclave: stop, closeConclave: stop,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run the migrate check. Reads; never writes.
|
|
38
|
+
*
|
|
39
|
+
* The report is the product whether or not the migration is admissible — a rejected migration owes
|
|
40
|
+
* the caller the per-step reason, which is the only thing that makes repair possible (the `L`
|
|
41
|
+
* catalogue).
|
|
42
|
+
*/
|
|
43
|
+
export async function migrateRun(req) {
|
|
44
|
+
const journal = new Journal({ run: req.runId, entries: req.entries, readOnly: true });
|
|
45
|
+
let divergence;
|
|
46
|
+
let unwalkable;
|
|
47
|
+
try {
|
|
48
|
+
await runProgram(req.source, {
|
|
49
|
+
runId: req.runId,
|
|
50
|
+
handler: dryHandler(req.now),
|
|
51
|
+
journal,
|
|
52
|
+
migration: true,
|
|
53
|
+
pins: req.pins,
|
|
54
|
+
...(req.file !== undefined ? { file: req.file } : {}),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
if (e instanceof RunDivergence) {
|
|
59
|
+
divergence = {
|
|
60
|
+
step: e.stepKey,
|
|
61
|
+
recordedHash: e.recordedHash,
|
|
62
|
+
programHash: e.programHash,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
else if (e instanceof UnwalkableScope || e instanceof ScopeBranchMissing) {
|
|
66
|
+
// Both are "the walk could not enter this scope", which is what `unwalkable` is for and what
|
|
67
|
+
// blocks `admissible` below. They are separate classes because the REPAIRS differ — a
|
|
68
|
+
// conclave needs a fork, a missing branch needs the arm's name back — and `why` carries the
|
|
69
|
+
// whole refusal, which for L5022 names the recorded arms, the source's arms, and the gap.
|
|
70
|
+
unwalkable = { step: e.scopeKey, why: e.message };
|
|
71
|
+
}
|
|
72
|
+
else if (!(e instanceof Frontier) && !(e instanceof JournalReadOnlyError)) {
|
|
73
|
+
// A program fault under an edited source is the migration's answer too — L4007 from an edited
|
|
74
|
+
// `onExpiry: fail` is exactly the case the walk is specified to handle — but it is not a
|
|
75
|
+
// divergence, and it is not this function's to swallow. The steps after it were simply not
|
|
76
|
+
// reached, which is already visible in the orphan set below.
|
|
77
|
+
if (!isProgramFault(e))
|
|
78
|
+
throw e;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const orphans = journal.orphans();
|
|
82
|
+
const notices = orphans.some((o) => o.kind === "notify")
|
|
83
|
+
? await listRunNoticesForRun(req.kv, req.endpoint, req.runId)
|
|
84
|
+
: [];
|
|
85
|
+
const consumedBy = new Map();
|
|
86
|
+
for (const n of notices) {
|
|
87
|
+
const key = n.spec.step;
|
|
88
|
+
consumedBy.set(key, (consumedBy.get(key) ?? true) && n.consumed !== undefined);
|
|
89
|
+
}
|
|
90
|
+
const overrides = recordedOverrides(req.overrides);
|
|
91
|
+
const table = orphans.map((e) => classify(e, req.overrides, consumedBy));
|
|
92
|
+
const admissible = divergence === undefined &&
|
|
93
|
+
unwalkable === undefined &&
|
|
94
|
+
!table.some((o) => o.verdict === "rejected");
|
|
95
|
+
return {
|
|
96
|
+
run: req.runId,
|
|
97
|
+
at: req.now(),
|
|
98
|
+
actor: req.actor,
|
|
99
|
+
toHash: programHashOf(req.source),
|
|
100
|
+
...(req.fromHash !== undefined ? { fromHash: req.fromHash } : {}),
|
|
101
|
+
admissible,
|
|
102
|
+
consumedThrough: req.entries.length - orphans.length,
|
|
103
|
+
orphans: table,
|
|
104
|
+
...(divergence !== undefined ? { divergence } : {}),
|
|
105
|
+
...(unwalkable !== undefined ? { unwalkable } : {}),
|
|
106
|
+
overrides,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* File the migration, and record that this driver applied it.
|
|
111
|
+
*
|
|
112
|
+
* TWO WRITES AND THEY ARE DIFFERENT ACTS. The report is filed create-only under an id derived from
|
|
113
|
+
* its own content, so the retry a crash forces lands on its own record rather than filing a second
|
|
114
|
+
* migration for one decision. The application is a separate, create-only status: two drivers racing
|
|
115
|
+
* to advance one run both find no status and both write, and the store decides. A driver that lost
|
|
116
|
+
* that race hears about it instead of believing it moved a run somebody else moved.
|
|
117
|
+
*
|
|
118
|
+
* REFUSED FOR AN INADMISSIBLE REPORT, before anything is written. A migration the check rejected is
|
|
119
|
+
* not a migration with a caveat — filing it would put a decision nobody may act on into the same
|
|
120
|
+
* history a reader trusts, and the refusal is the product the check exists to produce.
|
|
121
|
+
*
|
|
122
|
+
* What is still NOT here, stated rather than implied: the run's pinned program hash does not
|
|
123
|
+
* advance, because `RunSpecValue` carries no program hash to advance — that pin is declared and
|
|
124
|
+
* unbuilt, and this branch does not invent it. The migration is durable and readable; the run
|
|
125
|
+
* record does not yet name which source it is on.
|
|
126
|
+
*/
|
|
127
|
+
export async function commitMigration(kv, endpoint, report, driver) {
|
|
128
|
+
if (!report.admissible) {
|
|
129
|
+
throw new MigrationNotAdmissible(report);
|
|
130
|
+
}
|
|
131
|
+
const content = {
|
|
132
|
+
v: 1,
|
|
133
|
+
run: report.run,
|
|
134
|
+
...(report.fromHash !== undefined ? { fromHash: report.fromHash } : {}),
|
|
135
|
+
toHash: report.toHash,
|
|
136
|
+
consumedThrough: report.consumedThrough,
|
|
137
|
+
orphans: report.orphans.map((o) => ({
|
|
138
|
+
step: o.step,
|
|
139
|
+
kind: o.kind,
|
|
140
|
+
verdict: o.verdict,
|
|
141
|
+
...(o.code !== undefined ? { code: o.code } : {}),
|
|
142
|
+
})),
|
|
143
|
+
overrides: report.overrides,
|
|
144
|
+
actor: report.actor,
|
|
145
|
+
};
|
|
146
|
+
const migrationId = runMigrationId(content);
|
|
147
|
+
const { created } = await writeRunMigration(kv, endpoint, migrationId, { ...content, at: report.at });
|
|
148
|
+
await markRunMigrationApplied(kv, endpoint, report.run, migrationId, driver, report.at);
|
|
149
|
+
return { migrationId, created };
|
|
150
|
+
}
|
|
151
|
+
/** A migration the check refused, offered for commit anyway. The report says which rows refused. */
|
|
152
|
+
export class MigrationNotAdmissible extends Error {
|
|
153
|
+
report;
|
|
154
|
+
constructor(report) {
|
|
155
|
+
const refused = report.orphans.filter((o) => o.verdict === "rejected");
|
|
156
|
+
super(`run ${report.run} cannot migrate: ` +
|
|
157
|
+
(report.divergence !== undefined
|
|
158
|
+
? `${report.divergence.step} diverged`
|
|
159
|
+
: report.unwalkable !== undefined
|
|
160
|
+
? `the walk could not enter ${report.unwalkable.step}`
|
|
161
|
+
: refused.map((o) => `${o.code} at ${o.step}`).join(", ")) +
|
|
162
|
+
`. The report carries the per-step reason; nothing was written.`);
|
|
163
|
+
this.report = report;
|
|
164
|
+
this.name = "MigrationNotAdmissible";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** A fault the PROGRAM raised under the new source. Named by code, not by class: the language's
|
|
168
|
+
* faults cross the package boundary as values and a structural check is what survives that. */
|
|
169
|
+
function isProgramFault(e) {
|
|
170
|
+
return typeof e?.code === "string";
|
|
171
|
+
}
|
|
172
|
+
function recordedOverrides(o) {
|
|
173
|
+
if (o === undefined)
|
|
174
|
+
return [];
|
|
175
|
+
const out = [];
|
|
176
|
+
if (o.discardApprovals === true)
|
|
177
|
+
out.push("--discard-approvals");
|
|
178
|
+
for (const h of o.adopt ?? [])
|
|
179
|
+
out.push(`--adopt ${h}`);
|
|
180
|
+
for (const h of o.release ?? [])
|
|
181
|
+
out.push(`--release ${h}`);
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* The orphan table, one entry at a time.
|
|
186
|
+
*
|
|
187
|
+
* `kept` rather than `ignored` for a turn, because the two are different promises. An ignored sleep
|
|
188
|
+
* leaves nothing behind. An ignored TURN would be a claim that an agent did not speak, and it did:
|
|
189
|
+
* the entry stays in the journal and the migration says so, so no reader is ever told the work did
|
|
190
|
+
* not happen.
|
|
191
|
+
*/
|
|
192
|
+
function classify(e, o, noticeConsumed) {
|
|
193
|
+
const step = journalEntryKeyString(e);
|
|
194
|
+
const ignore = (why) => ({ step, kind: e.kind, verdict: "ignored", why });
|
|
195
|
+
const reject = (code, why) => ({ step, kind: e.kind, verdict: "rejected", code, why });
|
|
196
|
+
switch (e.kind) {
|
|
197
|
+
case "sleep":
|
|
198
|
+
case "wait":
|
|
199
|
+
case "monitor":
|
|
200
|
+
case "ask":
|
|
201
|
+
return ignore("nothing outlives it");
|
|
202
|
+
case "turn":
|
|
203
|
+
return {
|
|
204
|
+
step,
|
|
205
|
+
kind: e.kind,
|
|
206
|
+
verdict: "kept",
|
|
207
|
+
why: "the agent already took this turn and spoke in its channels; the entry stays and the migration records that the current source no longer accounts for it",
|
|
208
|
+
};
|
|
209
|
+
case "notify": {
|
|
210
|
+
const consumed = noticeConsumed.get(step);
|
|
211
|
+
if (consumed === true)
|
|
212
|
+
return ignore("its notice was already carried by the addressee's next turn");
|
|
213
|
+
if (consumed === undefined)
|
|
214
|
+
return reject("L5013", "no notice is filed for this step, so whether it was delivered cannot be established; a migration does not guess about a decision already sent");
|
|
215
|
+
return reject("L5013", "the notice has not been carried by its addressee's next turn, and migrating would deliver a decision the new program no longer makes");
|
|
216
|
+
}
|
|
217
|
+
case "conclave":
|
|
218
|
+
return e.closed === true
|
|
219
|
+
? ignore("the scope closed, so no membership outlives it")
|
|
220
|
+
: reject("L5014", "an open conclave is live membership the new program cannot close");
|
|
221
|
+
case "spawn":
|
|
222
|
+
// The specified repair for this row is `--adopt <handle>` or `--release`. NEITHER IS HONOURED
|
|
223
|
+
// HERE, and that is the seam rather than an omission: both name a durable agent this host
|
|
224
|
+
// cannot address, because `spawn` itself rides durable-action machinery that is not in this
|
|
225
|
+
// tree yet. An override that read as accepted would be the fake success — a migration
|
|
226
|
+
// recorded as having released an agent nothing ever released.
|
|
227
|
+
return (o?.adopt?.length ?? 0) + (o?.release?.length ?? 0) > 0
|
|
228
|
+
? reject("L5003", "--adopt and --release name a durable agent handle, and spawn is not durable on this host yet: it rides the durable-action machinery, which has not landed. The override is refused rather than recorded as honoured.")
|
|
229
|
+
: reject("L5003", "the edit dropped a step that spawned a live agent; pass --adopt <handle> to reassign it or --release to tear it down");
|
|
230
|
+
case "checkpoint": {
|
|
231
|
+
const raw = e.result;
|
|
232
|
+
if (raw?.outcome !== "resolved")
|
|
233
|
+
return ignore("no human decision was recorded against it");
|
|
234
|
+
if (o?.discardApprovals === true)
|
|
235
|
+
return {
|
|
236
|
+
step,
|
|
237
|
+
kind: e.kind,
|
|
238
|
+
verdict: "kept",
|
|
239
|
+
why: `a recorded decision${raw.by !== undefined ? ` by ${raw.by}` : ""} is discarded under --discard-approvals, and the override is recorded with the actor who passed it`,
|
|
240
|
+
};
|
|
241
|
+
return reject("L5004", `the edit would discard a decision${raw.by !== undefined ? ` ${raw.by} actually made` : " a person actually made"}; pass --discard-approvals if that is intended`);
|
|
242
|
+
}
|
|
243
|
+
case "parallel":
|
|
244
|
+
case "race":
|
|
245
|
+
case "fanOut":
|
|
246
|
+
// A scope is not an effect and outlives nothing by itself; every consequence it had belongs
|
|
247
|
+
// to an entry underneath it, and those get their own rows. `conclave` is the exception and is
|
|
248
|
+
// above, which is exactly why the orphan table lists it and not these three.
|
|
249
|
+
return ignore("a scope outlives nothing of its own; what ran under it has its own rows");
|
|
250
|
+
default:
|
|
251
|
+
// Anything a later version journals. A kind this table does not know is not a kind it may wave
|
|
252
|
+
// through: the table is the safety property, and an unlisted kind means it has a hole.
|
|
253
|
+
return reject("L5015", `no orphan policy is defined for a ${e.kind} entry, and a migration does not invent one`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAgCA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,GAExB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,GAAG,IAAI,UAAU,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,GAKnB,MAAM,gBAAgB,CAAC;AAmFxB,gGAAgG;AAChG,MAAM,QAAS,SAAQ,KAAK;IACL;IAArB,YAAqB,IAAY;QAC/B,KAAK,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;QADnC,SAAI,GAAJ,IAAI,CAAQ;QAE/B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,UAAU,CAAC,GAAiB;IACnC,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,GAAkB,EAAS,EAAE;QACxD,MAAM,IAAI,QAAQ,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9E,CAAC,CAAC;IACF,OAAO;QACL,GAAG;QACH,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;QACjE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI;KACrD,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,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,OAAO,EACP,sNAAsN,CACvN;gBACH,CAAC,CAAC,MAAM,CACJ,OAAO,EACP,sHAAsH,CACvH,CAAC;QAER,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,MAAM,GAAG,GAAG,CAAC,CAAC,MAAuD,CAAC;YACtE,IAAI,GAAG,EAAE,OAAO,KAAK,UAAU;gBAAE,OAAO,MAAM,CAAC,2CAA2C,CAAC,CAAC;YAC5F,IAAI,CAAC,EAAE,gBAAgB,KAAK,IAAI;gBAC9B,OAAO;oBACL,IAAI;oBACJ,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,OAAO,EAAE,MAAM;oBACf,GAAG,EAAE,sBAAsB,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,oGAAoG;iBAC3K,CAAC;YACJ,OAAO,MAAM,CACX,OAAO,EACP,oCAAoC,GAAG,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,yBAAyB,gDAAgD,CAClK,CAAC;QACJ,CAAC;QAED,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ;YACX,4FAA4F;YAC5F,8FAA8F;YAC9F,6EAA6E;YAC7E,OAAO,MAAM,CAAC,yEAAyE,CAAC,CAAC;QAE3F;YACE,+FAA+F;YAC/F,uFAAuF;YACvF,OAAO,MAAM,CACX,OAAO,EACP,qCAAqC,CAAC,CAAC,IAAI,6CAA6C,CACzF,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `resolveCheckpoint` — the run-driver command through which a checkpoint is answered.
|
|
3
|
+
*
|
|
4
|
+
* **Nothing outside presents the token.** A checkpoint's resume is holder-bound (SPEC §13.10), and
|
|
5
|
+
* a workflow checkpoint's holder is the run driver: it is the one principal guaranteed to exist for
|
|
6
|
+
* the pause's whole life. So an observer UI, a notification action, or another agent does not talk
|
|
7
|
+
* to `endpoint-checkpoint` at all — each calls this, which authorizes the caller under the run's
|
|
8
|
+
* own ACL, files their answer, and then presents the token as the driver. "Resolvable from
|
|
9
|
+
* anywhere" is true at the product level while resume stays holder-bound at the protocol level, and
|
|
10
|
+
* §13.10 is not weakened by a millimetre. The cost is that the driver must be reachable to answer a
|
|
11
|
+
* checkpoint, which is the same condition under which the run advances at all.
|
|
12
|
+
*
|
|
13
|
+
* **The answer is written BEFORE the token is presented,** and the two are separate facts on
|
|
14
|
+
* purpose. The record is the payload; the settle is the one-use arbiter that releases the run. In
|
|
15
|
+
* that order a crash in between leaves an answer nobody accepted — orphaned, read by nothing, and
|
|
16
|
+
* harmless. In the other order it would leave a run released with its answer nowhere.
|
|
17
|
+
*
|
|
18
|
+
* **The step is addressed by its KEY, not by its token.** A token is `ctx.requestId`, derived from
|
|
19
|
+
* the run, the step key, the input hash and the attempt, and a resolver has none of those: it knows
|
|
20
|
+
* "the checkpoint named `approve` in this run". The journal is what maps one to the other, and it is
|
|
21
|
+
* also what says whether that step is still open — which is the question a resolver most needs
|
|
22
|
+
* answered before it collects a human's decision.
|
|
23
|
+
*/
|
|
24
|
+
import { type CheckpointSettleFact } from "@cotal-ai/core";
|
|
25
|
+
import type { JetStreamClient, JetStreamManager } from "@nats-io/jetstream";
|
|
26
|
+
import type { KV } from "@nats-io/kv";
|
|
27
|
+
import { type JournalEntry } from "@cotal-ai/lang";
|
|
28
|
+
/** No open checkpoint answers to this address in this run. */
|
|
29
|
+
export declare class CheckpointNotOpen extends Error {
|
|
30
|
+
readonly runId: string;
|
|
31
|
+
readonly stepKey: string;
|
|
32
|
+
readonly why: "unknown" | "settled" | "not-a-checkpoint" | "no-identity";
|
|
33
|
+
constructor(runId: string, stepKey: string, why: "unknown" | "settled" | "not-a-checkpoint" | "no-identity");
|
|
34
|
+
}
|
|
35
|
+
export interface ResolveCheckpointRequest {
|
|
36
|
+
readonly runId: string;
|
|
37
|
+
/** The step's canonical key string, e.g. `/checkpoint:approve#0` (`stepKeyString`). */
|
|
38
|
+
readonly stepKey: string;
|
|
39
|
+
/** WHO answered, as the run's ACL knows them. Recorded; never the presenting principal. */
|
|
40
|
+
readonly by: string;
|
|
41
|
+
readonly value?: unknown;
|
|
42
|
+
/** The digest of what the answerer actually saw — an approval as evidence, not as a claim. */
|
|
43
|
+
readonly artifact?: string;
|
|
44
|
+
readonly now: number;
|
|
45
|
+
}
|
|
46
|
+
export interface ResolveCheckpointResult {
|
|
47
|
+
readonly token: string;
|
|
48
|
+
readonly answerId: string;
|
|
49
|
+
readonly settle: CheckpointSettleFact;
|
|
50
|
+
}
|
|
51
|
+
export interface ResolveCheckpointDeps {
|
|
52
|
+
readonly kv: KV;
|
|
53
|
+
readonly js: JetStreamClient;
|
|
54
|
+
readonly jsm: JetStreamManager;
|
|
55
|
+
readonly space: string;
|
|
56
|
+
/** The endpoint hosting the driver, and the holder it presents as. */
|
|
57
|
+
readonly endpoint: string;
|
|
58
|
+
readonly holder: {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly lifecycleUid: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Answer a run's open checkpoint.
|
|
65
|
+
*
|
|
66
|
+
* Refusals are the plane's own and are not softened here: a checkpoint already resumed is a
|
|
67
|
+
* `conflict` (resume authorization is one-use) and one already expired is a `failed-precondition`
|
|
68
|
+
* (expiry fails closed). Both mean the answer arrived too late, and both leave this resolver's
|
|
69
|
+
* record filed and unaccepted — which is what the caller needs to be told rather than a success
|
|
70
|
+
* that names a settlement somebody else won.
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolveCheckpoint(deps: ResolveCheckpointDeps, req: ResolveCheckpointRequest): Promise<ResolveCheckpointResult>;
|
|
73
|
+
/** The token of the open checkpoint at this address, or a loud refusal naming which it is not. */
|
|
74
|
+
export declare function openCheckpointToken(entries: readonly JournalEntry[], runId: string, stepKey: string): string;
|
|
75
|
+
//# sourceMappingURL=resolve-checkpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-checkpoint.d.ts","sourceRoot":"","sources":["../src/resolve-checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE1E,8DAA8D;AAC9D,qBAAa,iBAAkB,SAAQ,KAAK;IAExC,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,GAAG,aAAa;gBAF/D,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,GAAG,aAAa;CAc3E;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC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