@cotal-ai/runtime 0.90.1 → 0.92.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/engine-host.d.ts +2 -1
- package/dist/engine-host.d.ts.map +1 -1
- package/dist/engine-host.js +5 -1
- package/dist/engine-host.js.map +1 -1
- package/dist/index.js +27 -6
- package/dist/index.js.map +1 -1
- package/dist/mesh-handler.d.ts +1 -0
- package/dist/mesh-handler.d.ts.map +1 -1
- package/dist/mesh-handler.js +3 -0
- package/dist/mesh-handler.js.map +1 -1
- package/dist/offline-command.d.ts +8 -0
- package/dist/offline-command.d.ts.map +1 -0
- package/dist/offline-command.js +111 -0
- package/dist/offline-command.js.map +1 -0
- package/dist/run-command.d.ts +44 -0
- package/dist/run-command.d.ts.map +1 -1
- package/dist/run-command.js +148 -155
- package/dist/run-command.js.map +1 -1
- package/dist/run-driver.d.ts +5 -1
- package/dist/run-driver.d.ts.map +1 -1
- package/dist/run-driver.js +5 -2
- package/dist/run-driver.js.map +1 -1
- package/dist/run-effect-host.d.ts +1 -1
- package/dist/run-effect-host.d.ts.map +1 -1
- package/dist/run-effect-host.js +3 -3
- package/dist/run-effect-host.js.map +1 -1
- package/dist/run-host.d.ts.map +1 -1
- package/dist/run-host.js +21 -3
- package/dist/run-host.js.map +1 -1
- package/dist/run-wait-host.d.ts +1 -1
- package/dist/run-wait-host.d.ts.map +1 -1
- package/dist/run-wait-host.js +9 -2
- package/dist/run-wait-host.js.map +1 -1
- package/dist/seat-turn-command.d.ts +11 -0
- package/dist/seat-turn-command.d.ts.map +1 -0
- package/dist/seat-turn-command.js +68 -0
- package/dist/seat-turn-command.js.map +1 -0
- package/dist/workflow-views.d.ts +11 -0
- package/dist/workflow-views.d.ts.map +1 -0
- package/dist/workflow-views.js +45 -0
- package/dist/workflow-views.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-command.js","sourceRoot":"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,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,qHAAqH,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE;SACzrB,EAAE,CAAC,CAAC,CAAC;AACR,CAAC"}
|
package/dist/run-command.d.ts
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import { EpEnvelopeError, type ParsedArgs } from "@cotal-ai/core";
|
|
2
|
+
interface RunValues {
|
|
3
|
+
space?: string;
|
|
4
|
+
server?: string;
|
|
5
|
+
creds?: string;
|
|
6
|
+
file?: string;
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
on?: string;
|
|
9
|
+
timeout?: string;
|
|
10
|
+
by?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
artifact?: string;
|
|
13
|
+
local?: boolean;
|
|
14
|
+
/** `--local start` only: the channel ceiling the operator admits the run under (SPEC 14.8),
|
|
15
|
+
* comma-separated channel patterns; `none` is deny-all. Both are REQUIRED for a local start:
|
|
16
|
+
* a local run never defaults to the host's own scope. */
|
|
17
|
+
"admit-read"?: string;
|
|
18
|
+
"admit-publish"?: string;
|
|
19
|
+
/** `revoke --local` only: why the run's admission is being revoked, recorded on the marker. */
|
|
20
|
+
reason?: string;
|
|
21
|
+
/** `migrate` only: commit-side overrides, parsed so the verb can REFUSE them by name rather than
|
|
22
|
+
* let the dispatcher reject them as unknown flags. Each decides what a commit does with an
|
|
23
|
+
* orphan; this verb only checks, so none is taken. */
|
|
24
|
+
adopt?: string;
|
|
25
|
+
release?: string;
|
|
26
|
+
"discard-approvals"?: boolean;
|
|
27
|
+
/** `ps` and `journal` only: one JSON object per row per line on stdout. */
|
|
28
|
+
json?: boolean;
|
|
29
|
+
page?: boolean;
|
|
30
|
+
limit?: string;
|
|
31
|
+
cursor?: string;
|
|
32
|
+
plain?: boolean;
|
|
33
|
+
handler?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
to?: string;
|
|
36
|
+
note?: string;
|
|
37
|
+
}
|
|
2
38
|
/**
|
|
3
39
|
* What a hosted `run` verb prints when its manager describe drew no answer, SCOPED TO THE RAIL the
|
|
4
40
|
* describe rode ({@link unansweredRail}, SPEC 13.15).
|
|
@@ -23,4 +59,12 @@ export declare function unansweredManagerRefusal(e: EpEnvelopeError): string;
|
|
|
23
59
|
/** `cotal run <start|resume|ps|journal|answer|amend>` — dispatch. The manager hosts by default;
|
|
24
60
|
* `--local` drives in this process over one connection per invocation. */
|
|
25
61
|
export declare function runWorkflow(args: ParsedArgs): Promise<void>;
|
|
62
|
+
/** Public workflow grammar, before catalog preparation or native requests. */
|
|
63
|
+
export declare function workflowArguments(args: ParsedArgs): {
|
|
64
|
+
values: RunValues;
|
|
65
|
+
verb: string;
|
|
66
|
+
a?: string;
|
|
67
|
+
b?: string;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
26
70
|
//# sourceMappingURL=run-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../src/run-command.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,eAAe,EA8Bf,KAAK,UAAU,EAOhB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../src/run-command.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,eAAe,EA8Bf,KAAK,UAAU,EAOhB,MAAM,gBAAgB,CAAC;AAiBxB,UAAU,SAAS;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;8DAE0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;2DAEuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAqdD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAMnE;AAiKD;2EAC2E;AAC3E,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCjE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAgE/G"}
|
package/dist/run-command.js
CHANGED
|
@@ -22,7 +22,10 @@ import { jetstream, jetstreamManager } from "@nats-io/jetstream";
|
|
|
22
22
|
import { Kvm } from "@nats-io/kv";
|
|
23
23
|
import { BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, assertLifecycleToken, LANG_PROBLEM_DETAIL_KIND, dialerFor, invokeRepairingSplit, newTakeoverId, newIdentity, mintCreds, issuedUserCaller, openRecordsBucket, admissionBucket, createRunAdmission, readRunAdmission, revokeRunAdmission, chatSubject, DEV_OWNER, readRunProgram, readRunRecord, renderLifecycleBlocked, replayRunJournal, resolveService, runDriverCaller, RUN_LAUNCH_DEADLINE_MS, standaloneConnectOpts, unansweredRail, unansweredRequest, } from "@cotal-ai/core";
|
|
24
24
|
import { RunHeld } from "@cotal-ai/lang";
|
|
25
|
-
import { connectOrExit, controlCaller, endpointAuth, resolveControlTarget, resolveSeatControlTarget } from "@cotal-ai/workspace";
|
|
25
|
+
import { CommandFailure, presentationOf, recordOperationSpace, connectOrExit, controlCaller, endpointAuth, resolveControlTarget, resolveSeatControlTarget } from "@cotal-ai/workspace";
|
|
26
|
+
import { offlineWorkflow } from "./offline-command.js";
|
|
27
|
+
import { seatTurnCommand } from "./seat-turn-command.js";
|
|
28
|
+
import { printRunDetail, printRunList, runReceipt } from "./workflow-views.js";
|
|
26
29
|
import { startRun, driveRun } from "./run-driver.js";
|
|
27
30
|
import { migrateRun } from "./migrate.js";
|
|
28
31
|
import { cotalLangRunHost as runHost, journalRows } from "./run-host.js";
|
|
@@ -65,7 +68,9 @@ async function openPlanes(values, role, mint) {
|
|
|
65
68
|
* file can supply neither, and is refused by name before any other local check. */
|
|
66
69
|
function refuseSingleCredential(conn) {
|
|
67
70
|
if (conn.creds !== undefined && conn.auth === undefined)
|
|
68
|
-
throw new
|
|
71
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "run --local needs the space signer to mint a separate mediator; a single --creds file cannot supply both roles", {
|
|
72
|
+
remedy: "From the project with the recorded static-auth mesh and signer, omit --creds and run cotal run start --local --space <space> --file <program>. If you only have caller credentials, ask the mesh operator to host the run.",
|
|
73
|
+
});
|
|
69
74
|
}
|
|
70
75
|
/** Mint from the same resolved target as the driver, preserving its broker and TLS intent. */
|
|
71
76
|
async function openMediator(driver, pin) {
|
|
@@ -319,7 +324,7 @@ async function ps(values, planes) {
|
|
|
319
324
|
// the record's state beside its revocation marker (SPEC 14.8), so `--local` and hosted agree
|
|
320
325
|
// row for row, `--json` included.
|
|
321
326
|
const rows = await runHost.list(planes, values.endpoint !== undefined ? { endpoint: values.endpoint } : {});
|
|
322
|
-
|
|
327
|
+
printRunList(planes.space, rows, values);
|
|
323
328
|
}
|
|
324
329
|
async function journal(values, planes, endpoint, runId, takeoverId) {
|
|
325
330
|
if (runId === undefined) {
|
|
@@ -327,8 +332,10 @@ async function journal(values, planes, endpoint, runId, takeoverId) {
|
|
|
327
332
|
process.exit(1);
|
|
328
333
|
}
|
|
329
334
|
// The replay durable is named by the takeover id this call's credential was minted for.
|
|
330
|
-
const
|
|
331
|
-
|
|
335
|
+
const view = await runHost.status(planes, { endpoint, runId, takeoverId });
|
|
336
|
+
if (!view)
|
|
337
|
+
throw new CommandFailure("refused", "TARGET_NOT_FOUND", "no workflow record was returned for this run", { target: { space: planes.space, endpoint, run: runId } });
|
|
338
|
+
printRunDetail(planes.space, view, values);
|
|
332
339
|
}
|
|
333
340
|
/** `answer --local`: the pause is found under the READ credential this call was opened on, then
|
|
334
341
|
* the answer rides a second, one-shot credential pinned to that pause's token. */
|
|
@@ -493,8 +500,9 @@ export function unansweredManagerRefusal(e) {
|
|
|
493
500
|
* fetch, digest-verified recompile), then the invoke, re-issued after a bind split
|
|
494
501
|
* ({@link invokeRepairingSplit}). The reply's data on success; on a refusal the manager's own
|
|
495
502
|
* sentence, printed, and a non-zero exit. */
|
|
496
|
-
async function askHost(values, command, args) {
|
|
503
|
+
async function askHost(values, command, args, resolved) {
|
|
497
504
|
const t = await resolveRunControlTarget(values);
|
|
505
|
+
resolved?.(t.space);
|
|
498
506
|
const who = controlCaller(t.auth);
|
|
499
507
|
if ("refusal" in who) {
|
|
500
508
|
console.error(who.refusal);
|
|
@@ -549,120 +557,24 @@ async function askHost(values, command, args) {
|
|
|
549
557
|
* target resolution unchanged. `--on` reaches the mint on every path and becomes the instance the
|
|
550
558
|
* call addresses; a user-mode view already carries the instance its issuer bound. */
|
|
551
559
|
async function resolveRunControlTarget(values) {
|
|
552
|
-
const on =
|
|
560
|
+
const on = values.on;
|
|
553
561
|
const seat = values.creds === undefined ? await resolveSeatControlTarget(values, on) : undefined;
|
|
554
|
-
const
|
|
562
|
+
const target = seat?.mode === "auth" ? seat : await resolveControlTarget(values, "control-caller-privileged", on);
|
|
563
|
+
recordOperationSpace(target.space);
|
|
555
564
|
if (on === undefined)
|
|
556
|
-
return
|
|
557
|
-
if (
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
return { ...t, auth: { ...t.auth, managerInstanceId: on } };
|
|
562
|
-
}
|
|
563
|
-
/** `--on <instance>`, checked as the CLI's other pinning commands check it: an empty value (an unset
|
|
564
|
-
* shell variable) is refused rather than read as absent, and the id must be a lifecycle token. */
|
|
565
|
-
function onInstanceOrExit(on) {
|
|
566
|
-
if (on === undefined)
|
|
567
|
-
return undefined;
|
|
568
|
-
try {
|
|
569
|
-
return assertLifecycleToken(on, "instanceId");
|
|
570
|
-
}
|
|
571
|
-
catch (e) {
|
|
572
|
-
console.error(`run: ${e.message}. --on wants the whole manager instance id as \`cotal ps\` prints it`);
|
|
573
|
-
process.exit(1);
|
|
574
|
-
}
|
|
565
|
+
return target;
|
|
566
|
+
if (target.auth.managerInstanceId !== undefined && target.auth.managerInstanceId !== on)
|
|
567
|
+
throw new CommandFailure("refused", "CONFLICT", "the requested manager instance differs from this credential's instance authority; no other manager was selected");
|
|
568
|
+
return { ...target, auth: { ...target.auth, managerInstanceId: on } };
|
|
575
569
|
}
|
|
576
570
|
function renderLangProblem(d) {
|
|
577
571
|
const where = d.where;
|
|
578
572
|
const at = where ? `${where.file ?? "<program>"}:${where.line ?? "?"}:${where.column ?? "?"}` : "<program>";
|
|
579
573
|
return ` ${String(d.code ?? "L????")} ${String(d.title ?? "")} (${at})\n ${String(d.cause ?? "")}\n fix: ${String(d.fix ?? "")}`;
|
|
580
574
|
}
|
|
581
|
-
/** `--json` prints each row unchanged as one JSON object per line, as `cotal ps --json` does for
|
|
582
|
-
* seats: stdout carries rows only, so an empty journal prints nothing there. */
|
|
583
|
-
function printJournal(runId, rows, json) {
|
|
584
|
-
if (json) {
|
|
585
|
-
for (const r of rows)
|
|
586
|
-
console.log(JSON.stringify(r));
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
if (rows.length === 0) {
|
|
590
|
-
console.log(`run ${runId}: no journal records (never started, or retired)`);
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
for (const r of rows) {
|
|
594
|
-
if (r.kind === "activation") {
|
|
595
|
-
console.log(`#${r.n} activation holder=${r.holder} epoch=${r.epoch} replayedTo=${r.replayedTo}`);
|
|
596
|
-
continue;
|
|
597
|
-
}
|
|
598
|
-
console.log(`#${r.n} step ${r.step} ${r.outcome}`);
|
|
599
|
-
if (r.asks !== undefined)
|
|
600
|
-
console.log(` asks ${r.asks}${r.addressee !== undefined ? ` (escalates to ${r.addressee})` : ""}`);
|
|
601
|
-
if (r.answer !== undefined) {
|
|
602
|
-
const facts = [
|
|
603
|
-
...(Object.hasOwn(r.answer, "value") ? [`value=${JSON.stringify(r.answer.value)}`] : []),
|
|
604
|
-
...(r.answer.by !== undefined ? [`by=${JSON.stringify(r.answer.by)}`] : []),
|
|
605
|
-
...(r.answer.artifact !== undefined ? [`artifact=${JSON.stringify(r.answer.artifact)}`] : []),
|
|
606
|
-
...(r.answer.at !== undefined ? [`at=${JSON.stringify(r.answer.at)}`] : []),
|
|
607
|
-
`answerId=${JSON.stringify(r.answer.answerId)}`,
|
|
608
|
-
];
|
|
609
|
-
console.log(` answered ${facts.join(" ")}`);
|
|
610
|
-
}
|
|
611
|
-
for (const m of r.amendments ?? []) {
|
|
612
|
-
const facts = [
|
|
613
|
-
...(Object.hasOwn(m, "value") ? [`value=${JSON.stringify(m.value)}`] : []),
|
|
614
|
-
`by=${JSON.stringify(m.by)}`,
|
|
615
|
-
...(m.artifact !== undefined ? [`artifact=${JSON.stringify(m.artifact)}`] : []),
|
|
616
|
-
`at=${JSON.stringify(m.at)}`,
|
|
617
|
-
`supersedes=${JSON.stringify(m.supersedes)}`,
|
|
618
|
-
`answerId=${JSON.stringify(m.answerId)}`,
|
|
619
|
-
];
|
|
620
|
-
console.log(` amended ${facts.join(" ")}`);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function printRuns(space, rows, json) {
|
|
625
|
-
// A marker the host could not read fails the listing after every row is printed, under `--json`
|
|
626
|
-
// as in the table: its reason and the record's word on stderr, and exit 1.
|
|
627
|
-
const unchecked = rows.filter((r) => r.revocationUnreadable !== undefined);
|
|
628
|
-
const reportUnchecked = () => {
|
|
629
|
-
for (const r of unchecked)
|
|
630
|
-
console.error(`${r.endpoint}/${r.runId}: revocation marker could not be read (${r.revocationUnreadable}); its record reads ${r.state ?? "(no status)"}`);
|
|
631
|
-
if (unchecked.length > 0)
|
|
632
|
-
process.exitCode = 1;
|
|
633
|
-
};
|
|
634
|
-
if (json) {
|
|
635
|
-
for (const r of rows)
|
|
636
|
-
console.log(JSON.stringify(r));
|
|
637
|
-
reportUnchecked();
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
if (rows.length === 0) {
|
|
641
|
-
console.log(`no workflow runs recorded in space ${space}`);
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
|
-
// The same reading as `run ps --local`: a marker wins over the record's state, and a marker the
|
|
645
|
-
// host could not read prints `unchecked` with the record's word on stderr and exit 1.
|
|
646
|
-
const table = rows.map((r) => [
|
|
647
|
-
r.runId,
|
|
648
|
-
r.endpoint,
|
|
649
|
-
r.revoked !== undefined ? "revoked" : r.revocationUnreadable !== undefined ? "unchecked" : r.state ?? "(no status)",
|
|
650
|
-
r.holder ?? "-",
|
|
651
|
-
r.journalHigh === undefined ? "-" : String(r.journalHigh),
|
|
652
|
-
r.forkedFrom === undefined ? "-" : `${r.forkedFrom.run}@${r.forkedFrom.step}`,
|
|
653
|
-
]);
|
|
654
|
-
const header = ["RUN", "ENDPOINT", "STATE", "HOLDER", "JOURNAL", "FORKED-FROM"];
|
|
655
|
-
const widths = header.map((h, i) => Math.max(h.length, ...table.map((r) => r[i].length)));
|
|
656
|
-
const line = (r) => r.map((cell, i) => cell.padEnd(widths[i])).join(" ");
|
|
657
|
-
console.log(line(header));
|
|
658
|
-
for (const r of table)
|
|
659
|
-
console.log(line(r));
|
|
660
|
-
for (const r of rows)
|
|
661
|
-
if (r.revoked !== undefined)
|
|
662
|
-
console.log(`${r.endpoint}/${r.runId}: revoked by ${r.revoked.by} (${r.revoked.reason}); the status record is left as its driver last wrote it`);
|
|
663
|
-
reportUnchecked();
|
|
664
|
-
}
|
|
665
575
|
async function hosted(values, verb, a, b) {
|
|
576
|
+
let space;
|
|
577
|
+
const ask = (command, args) => askHost(values, command, args, (resolved) => { space = resolved; });
|
|
666
578
|
const endpoint = values.endpoint !== undefined ? { endpoint: values.endpoint } : {};
|
|
667
579
|
// A hosted drive is recorded under the manager's own endpoint; a caller cannot choose another,
|
|
668
580
|
// so an `--endpoint` here is refused rather than dropped.
|
|
@@ -682,13 +594,12 @@ async function hosted(values, verb, a, b) {
|
|
|
682
594
|
}
|
|
683
595
|
if (verb === "start") {
|
|
684
596
|
const source = readProgram(values);
|
|
685
|
-
const started = await
|
|
597
|
+
const started = await ask("run-start", {
|
|
686
598
|
source,
|
|
687
599
|
file: values.file,
|
|
688
600
|
...(values.timeout !== undefined ? { timeout: values.timeout } : {}),
|
|
689
601
|
});
|
|
690
|
-
|
|
691
|
-
console.log(` cotal run journal ${started.runId} # follow its steps`);
|
|
602
|
+
runReceipt("start", space, started, values);
|
|
692
603
|
return;
|
|
693
604
|
}
|
|
694
605
|
if (verb === "resume") {
|
|
@@ -700,13 +611,13 @@ async function hosted(values, verb, a, b) {
|
|
|
700
611
|
console.error(`run resume: the manager resumes a run from its recorded program, so --file is not taken; a run with no recorded program is resumed with \`cotal run resume ${a} --local --file <program>\``);
|
|
701
612
|
process.exit(1);
|
|
702
613
|
}
|
|
703
|
-
const resumed = await
|
|
704
|
-
|
|
614
|
+
const resumed = await ask("run-resume", { runId: a, ...(values.timeout !== undefined ? { timeout: values.timeout } : {}) });
|
|
615
|
+
runReceipt("resume", space, resumed, values);
|
|
705
616
|
return;
|
|
706
617
|
}
|
|
707
618
|
if (verb === "ps") {
|
|
708
619
|
if (values.page === true) {
|
|
709
|
-
const page = await
|
|
620
|
+
const page = await ask("run-ps", { ...endpoint, page: {
|
|
710
621
|
...(values.limit !== undefined ? { limit: Number(values.limit) } : {}),
|
|
711
622
|
...(values.cursor !== undefined ? { cursor: values.cursor } : {}),
|
|
712
623
|
} });
|
|
@@ -719,9 +630,8 @@ async function hosted(values, verb, a, b) {
|
|
|
719
630
|
}
|
|
720
631
|
return;
|
|
721
632
|
}
|
|
722
|
-
const rows = await
|
|
723
|
-
|
|
724
|
-
printRuns(t, rows, values.json === true);
|
|
633
|
+
const rows = await ask("run-ps", Object.keys(endpoint).length ? endpoint : undefined);
|
|
634
|
+
printRunList(space, rows, values);
|
|
725
635
|
return;
|
|
726
636
|
}
|
|
727
637
|
if (verb === "journal") {
|
|
@@ -729,11 +639,10 @@ async function hosted(values, verb, a, b) {
|
|
|
729
639
|
console.error(USAGE);
|
|
730
640
|
process.exit(1);
|
|
731
641
|
}
|
|
732
|
-
const view = await
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
(
|
|
736
|
-
printJournal(view.runId, view.journal, values.json === true);
|
|
642
|
+
const view = await ask("run-status", { runId: a, ...endpoint });
|
|
643
|
+
if (space === undefined)
|
|
644
|
+
throw new Error("the native run target was not reported");
|
|
645
|
+
printRunDetail(space, view, values);
|
|
737
646
|
return;
|
|
738
647
|
}
|
|
739
648
|
// answer and amend: the manager records the caller as the answerer (SPEC 14.5), so no `--by`
|
|
@@ -744,7 +653,7 @@ async function hosted(values, verb, a, b) {
|
|
|
744
653
|
process.exit(1);
|
|
745
654
|
}
|
|
746
655
|
const value = parseAnswerValue(values);
|
|
747
|
-
const result = await
|
|
656
|
+
const result = await ask("run-answer", {
|
|
748
657
|
runId: a,
|
|
749
658
|
stepKey: b,
|
|
750
659
|
...endpoint,
|
|
@@ -752,39 +661,16 @@ async function hosted(values, verb, a, b) {
|
|
|
752
661
|
...(values.artifact !== undefined ? { artifact: values.artifact } : {}),
|
|
753
662
|
...(verb === "amend" ? { amend: true } : {}),
|
|
754
663
|
});
|
|
755
|
-
|
|
664
|
+
runReceipt(verb, space, result, values);
|
|
756
665
|
}
|
|
757
666
|
/** `cotal run <start|resume|ps|journal|answer|amend>` — dispatch. The manager hosts by default;
|
|
758
667
|
* `--local` drives in this process over one connection per invocation. */
|
|
759
668
|
export async function runWorkflow(args) {
|
|
760
|
-
const values = args
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
if (values.page !== undefined || values.limit !== undefined || values.cursor !== undefined) {
|
|
767
|
-
if (verb !== "ps" || values.local === true || values.page !== true || values.on === undefined) {
|
|
768
|
-
console.error("diagnostic paging requires run ps --page --on <instance> without --local");
|
|
769
|
-
process.exit(1);
|
|
770
|
-
}
|
|
771
|
-
if (values.limit !== undefined && (!/^[1-9][0-9]*$/.test(values.limit) || Number(values.limit) > 16)) {
|
|
772
|
-
console.error("run ps --page: --limit must be between 1 and 16");
|
|
773
|
-
process.exit(1);
|
|
774
|
-
}
|
|
775
|
-
if (values.cursor !== undefined && (values.cursor.length > 3072 || !/^[A-Za-z0-9_-]+$/.test(values.cursor))) {
|
|
776
|
-
console.error("run ps --page: invalid cursor encoding");
|
|
777
|
-
process.exit(1);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
if (values.json === true && verb !== "ps" && verb !== "journal") {
|
|
781
|
-
console.error(`run ${verb}: --json is taken by \`ps\` and \`journal\` only`);
|
|
782
|
-
process.exit(1);
|
|
783
|
-
}
|
|
784
|
-
if (values.on !== undefined && values.local === true) {
|
|
785
|
-
console.error(`run ${verb}: --on pins a hosted verb to one manager instance and --local drives in this process, so pass one of them`);
|
|
786
|
-
process.exit(1);
|
|
787
|
-
}
|
|
669
|
+
const { values, verb, a, b } = workflowArguments(args);
|
|
670
|
+
if (verb === "validate" || verb === "plan" || verb === "simulate")
|
|
671
|
+
return offlineWorkflow(verb, a, values);
|
|
672
|
+
if (verb === "turns" || verb === "yield")
|
|
673
|
+
return seatTurnCommand(verb, a, values);
|
|
788
674
|
if (verb === "revoke") {
|
|
789
675
|
// Revocation is an operator act on the admission store, never a served command: the marker is
|
|
790
676
|
// written from the folder's trust material, so it is `--local` only.
|
|
@@ -826,4 +712,111 @@ export async function runWorkflow(args) {
|
|
|
826
712
|
await planes.close();
|
|
827
713
|
}
|
|
828
714
|
}
|
|
715
|
+
/** Public workflow grammar, before catalog preparation or native requests. */
|
|
716
|
+
export function workflowArguments(args) {
|
|
717
|
+
const values = { ...args.values };
|
|
718
|
+
presentationOf(values);
|
|
719
|
+
const [raw = "list", first, second, ...extra] = args.positionals;
|
|
720
|
+
const verb = { list: "ps", show: "journal", check: "migrate" }[raw] ?? raw;
|
|
721
|
+
const usage = (message) => { throw new CommandFailure("refused", "USAGE_INVALID", message); };
|
|
722
|
+
if (extra.length || !["start", "resume", "ps", "journal", "answer", "amend", "revoke", "migrate", "validate", "plan", "simulate", "turns", "yield"].includes(verb))
|
|
723
|
+
usage("choose a declared run command; run it bare to list workflows");
|
|
724
|
+
let a = first;
|
|
725
|
+
let b = second;
|
|
726
|
+
if (verb === "start") {
|
|
727
|
+
if (second !== undefined || (first !== undefined && values.file !== undefined))
|
|
728
|
+
usage("run start takes one source file");
|
|
729
|
+
values.file = first ?? values.file;
|
|
730
|
+
if (!values.file?.trim())
|
|
731
|
+
usage("run start requires a workflow source file");
|
|
732
|
+
a = undefined;
|
|
733
|
+
}
|
|
734
|
+
else if (verb === "migrate") {
|
|
735
|
+
if (!first || (second !== undefined && values.file !== undefined))
|
|
736
|
+
usage("run check takes a run id and one edited source file");
|
|
737
|
+
values.file = second ?? values.file;
|
|
738
|
+
if (!values.file?.trim())
|
|
739
|
+
usage("run check requires the edited source file");
|
|
740
|
+
values.local = true;
|
|
741
|
+
b = undefined;
|
|
742
|
+
}
|
|
743
|
+
else if (["validate", "plan", "simulate"].includes(verb)) {
|
|
744
|
+
if (!first || second !== undefined || values.file !== undefined)
|
|
745
|
+
usage(`run ${verb} takes one positional source file`);
|
|
746
|
+
if (values.space !== undefined || values.server !== undefined || values.creds !== undefined || values.endpoint !== undefined || values.local !== undefined)
|
|
747
|
+
usage(`run ${verb} is offline and takes no mesh or caller selection`);
|
|
748
|
+
}
|
|
749
|
+
else if (verb === "ps" || verb === "turns") {
|
|
750
|
+
if (first !== undefined)
|
|
751
|
+
usage(`run ${raw} takes no positional argument`);
|
|
752
|
+
}
|
|
753
|
+
else if (verb === "answer" || verb === "amend") {
|
|
754
|
+
if (!first || !second)
|
|
755
|
+
usage(`run ${verb} requires a run id and step key`);
|
|
756
|
+
}
|
|
757
|
+
else if (!first || second !== undefined)
|
|
758
|
+
usage(`run ${raw} takes one identifier`);
|
|
759
|
+
const scopes = {
|
|
760
|
+
timeout: ["start", "resume"], by: ["answer", "amend", "revoke"], reason: ["revoke"], value: ["answer", "amend"], artifact: ["answer", "amend"],
|
|
761
|
+
"admit-read": ["start"], "admit-publish": ["start"], adopt: ["migrate"], release: ["migrate"], "discard-approvals": ["migrate"],
|
|
762
|
+
};
|
|
763
|
+
for (const [flag, modes] of Object.entries(scopes))
|
|
764
|
+
if (args.values[flag] !== undefined && !modes.includes(verb))
|
|
765
|
+
usage(`--${flag} is not taken by this run command`);
|
|
766
|
+
if (values.page !== undefined || values.limit !== undefined || values.cursor !== undefined) {
|
|
767
|
+
if (verb !== "ps" || values.local === true || values.page !== true || values.on === undefined)
|
|
768
|
+
usage("diagnostic paging requires run --page --on <instance> without --local");
|
|
769
|
+
if (values.limit !== undefined && (!/^[1-9][0-9]*$/.test(values.limit) || Number(values.limit) > 16))
|
|
770
|
+
usage("run --page: --limit must be between 1 and 16");
|
|
771
|
+
if (values.cursor !== undefined && (values.cursor.length > 3072 || !/^[A-Za-z0-9_-]+$/.test(values.cursor)))
|
|
772
|
+
usage("run --page: invalid cursor encoding");
|
|
773
|
+
if (values.plain)
|
|
774
|
+
usage("diagnostic pages produce bounded JSON and take no --plain");
|
|
775
|
+
}
|
|
776
|
+
if ((values["admit-read"] !== undefined || values["admit-publish"] !== undefined) && values.local !== true)
|
|
777
|
+
usage("admission ceilings belong to the explicit local start");
|
|
778
|
+
if (values.by !== undefined && values.local !== true)
|
|
779
|
+
usage("the hosted manager records the authenticated caller; --by is only for the local path");
|
|
780
|
+
if ((verb === "start" || verb === "resume") && values.endpoint !== undefined && values.local !== true)
|
|
781
|
+
usage("a hosted run uses the manager's endpoint; --endpoint is only for the local path");
|
|
782
|
+
if (verb === "revoke" && (values.local !== true || !values.by?.trim() || !values.reason?.trim()))
|
|
783
|
+
usage("run revoke requires --local --by <actor> --reason <text> under the existing trust checks");
|
|
784
|
+
if (values.value !== undefined) {
|
|
785
|
+
try {
|
|
786
|
+
JSON.parse(values.value);
|
|
787
|
+
}
|
|
788
|
+
catch {
|
|
789
|
+
usage("--value must be valid JSON");
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
if (values.handler !== undefined && verb !== "simulate")
|
|
793
|
+
usage("--handler belongs to run simulate");
|
|
794
|
+
if ((values.status !== undefined || values.to !== undefined || values.note !== undefined) && verb !== "yield")
|
|
795
|
+
usage("--status, --to and --note belong to run yield");
|
|
796
|
+
if (verb === "yield") {
|
|
797
|
+
if (!["done", "blocked", "handoff"].includes(values.status ?? ""))
|
|
798
|
+
usage("run yield requires --status done, blocked or handoff");
|
|
799
|
+
if (values.status === "handoff" ? !values.to?.trim() : values.to !== undefined)
|
|
800
|
+
usage("--to is required only for a handoff yield");
|
|
801
|
+
}
|
|
802
|
+
if (verb === "turns" || verb === "yield") {
|
|
803
|
+
if (values.creds !== undefined || values.endpoint !== undefined || values.local !== undefined || values.by !== undefined)
|
|
804
|
+
usage("run turns/yield use the managed seat's own identity, not an operator override");
|
|
805
|
+
}
|
|
806
|
+
if (values.file !== undefined && !["start", "resume", "migrate"].includes(verb))
|
|
807
|
+
usage("this run command takes no --file");
|
|
808
|
+
if (values.on !== undefined) {
|
|
809
|
+
if (values.local === true || ["validate", "plan", "simulate", "turns", "yield", "revoke"].includes(verb))
|
|
810
|
+
usage("--on pins a hosted run command; local and offline commands take no manager instance");
|
|
811
|
+
try {
|
|
812
|
+
assertLifecycleToken(values.on, "instanceId");
|
|
813
|
+
}
|
|
814
|
+
catch {
|
|
815
|
+
usage("--on requires the full manager instance id as cotal ps prints it");
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if ((values.json || values.plain) && values.local && !["ps", "journal"].includes(verb))
|
|
819
|
+
usage("the local drive does not implement structured or plain receipts; use the hosted form");
|
|
820
|
+
return { values, verb, ...(a === undefined ? {} : { a }), ...(b === undefined ? {} : { b }) };
|
|
821
|
+
}
|
|
829
822
|
//# sourceMappingURL=run-command.js.map
|