@cotal-ai/core 0.16.0 → 0.18.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/acls.d.ts +21 -0
- package/dist/acls.d.ts.map +1 -1
- package/dist/acls.js +44 -1
- package/dist/acls.js.map +1 -1
- package/dist/artifact.d.ts +45 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +82 -0
- package/dist/artifact.js.map +1 -0
- package/dist/backup-config.d.ts +9 -2
- package/dist/backup-config.d.ts.map +1 -1
- package/dist/backup-config.js +6 -2
- package/dist/backup-config.js.map +1 -1
- package/dist/broker-tls.d.ts +70 -0
- package/dist/broker-tls.d.ts.map +1 -0
- package/dist/broker-tls.js +195 -0
- package/dist/broker-tls.js.map +1 -0
- package/dist/canonical.d.ts +14 -1
- package/dist/canonical.d.ts.map +1 -1
- package/dist/canonical.js +21 -1
- package/dist/canonical.js.map +1 -1
- package/dist/channels.js +4 -4
- package/dist/channels.js.map +1 -1
- package/dist/endpoint-action.d.ts +108 -3
- package/dist/endpoint-action.d.ts.map +1 -1
- package/dist/endpoint-action.js +209 -20
- package/dist/endpoint-action.js.map +1 -1
- package/dist/endpoint-binding.d.ts +138 -8
- package/dist/endpoint-binding.d.ts.map +1 -1
- package/dist/endpoint-binding.js +233 -26
- package/dist/endpoint-binding.js.map +1 -1
- package/dist/endpoint-contract-store.d.ts +30 -1
- package/dist/endpoint-contract-store.d.ts.map +1 -1
- package/dist/endpoint-contract-store.js +100 -29
- package/dist/endpoint-contract-store.js.map +1 -1
- package/dist/endpoint-envelope.d.ts +15 -37
- package/dist/endpoint-envelope.d.ts.map +1 -1
- package/dist/endpoint-envelope.js +93 -44
- package/dist/endpoint-envelope.js.map +1 -1
- package/dist/endpoint-error.d.ts +33 -0
- package/dist/endpoint-error.d.ts.map +1 -0
- package/dist/endpoint-error.js +34 -0
- package/dist/endpoint-error.js.map +1 -0
- package/dist/endpoint-grants.d.ts +63 -7
- package/dist/endpoint-grants.d.ts.map +1 -1
- package/dist/endpoint-grants.js +118 -9
- package/dist/endpoint-grants.js.map +1 -1
- package/dist/endpoint-invoke.d.ts +138 -0
- package/dist/endpoint-invoke.d.ts.map +1 -0
- package/dist/endpoint-invoke.js +393 -0
- package/dist/endpoint-invoke.js.map +1 -0
- package/dist/endpoint-records.d.ts.map +1 -1
- package/dist/endpoint-records.js +17 -0
- package/dist/endpoint-records.js.map +1 -1
- package/dist/endpoint-serve-kv.d.ts +97 -0
- package/dist/endpoint-serve-kv.d.ts.map +1 -0
- package/dist/endpoint-serve-kv.js +336 -0
- package/dist/endpoint-serve-kv.js.map +1 -0
- package/dist/endpoint-serve.d.ts.map +1 -1
- package/dist/endpoint-serve.js +21 -1
- package/dist/endpoint-serve.js.map +1 -1
- package/dist/endpoint-service.d.ts +1 -1
- package/dist/endpoint-service.d.ts.map +1 -1
- package/dist/endpoint-service.js +34 -10
- package/dist/endpoint-service.js.map +1 -1
- package/dist/endpoint-session-rail.d.ts +127 -0
- package/dist/endpoint-session-rail.d.ts.map +1 -0
- package/dist/endpoint-session-rail.js +325 -0
- package/dist/endpoint-session-rail.js.map +1 -0
- package/dist/endpoint-session.d.ts +1 -115
- package/dist/endpoint-session.d.ts.map +1 -1
- package/dist/endpoint-session.js +4 -316
- package/dist/endpoint-session.js.map +1 -1
- package/dist/endpoint-subjects.d.ts +20 -1
- package/dist/endpoint-subjects.d.ts.map +1 -1
- package/dist/endpoint-subjects.js +20 -1
- package/dist/endpoint-subjects.js.map +1 -1
- package/dist/endpoint-verbs.d.ts +1 -2
- package/dist/endpoint-verbs.d.ts.map +1 -1
- package/dist/endpoint-verbs.js +6 -6
- package/dist/endpoint-verbs.js.map +1 -1
- package/dist/endpoint.d.ts +157 -11
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +471 -47
- package/dist/endpoint.js.map +1 -1
- package/dist/evict.d.ts +47 -0
- package/dist/evict.d.ts.map +1 -1
- package/dist/evict.js +191 -59
- package/dist/evict.js.map +1 -1
- package/dist/identity.d.ts +34 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +46 -0
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/kv-scan.d.ts +8 -0
- package/dist/kv-scan.d.ts.map +1 -1
- package/dist/kv-scan.js +8 -0
- package/dist/kv-scan.js.map +1 -1
- package/dist/lease.d.ts +12 -5
- package/dist/lease.d.ts.map +1 -1
- package/dist/lease.js.map +1 -1
- package/dist/lifecycle-saga.d.ts +174 -0
- package/dist/lifecycle-saga.d.ts.map +1 -0
- package/dist/lifecycle-saga.js +418 -0
- package/dist/lifecycle-saga.js.map +1 -0
- package/dist/lifecycle-state.d.ts +202 -0
- package/dist/lifecycle-state.d.ts.map +1 -0
- package/dist/lifecycle-state.js +347 -0
- package/dist/lifecycle-state.js.map +1 -0
- package/dist/parts.d.ts +13 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +17 -0
- package/dist/parts.js.map +1 -0
- package/dist/provision.d.ts +124 -15
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +578 -121
- package/dist/provision.js.map +1 -1
- package/dist/schema-profile.d.ts +3 -2
- package/dist/schema-profile.d.ts.map +1 -1
- package/dist/schema-profile.js +242 -18
- package/dist/schema-profile.js.map +1 -1
- package/dist/session-browser.d.ts +15 -0
- package/dist/session-browser.d.ts.map +1 -0
- package/dist/session-browser.js +14 -0
- package/dist/session-browser.js.map +1 -0
- package/dist/session-terminal-frames.d.ts +36 -0
- package/dist/session-terminal-frames.d.ts.map +1 -0
- package/dist/session-terminal-frames.js +149 -0
- package/dist/session-terminal-frames.js.map +1 -0
- package/dist/spaces.d.ts.map +1 -1
- package/dist/spaces.js +6 -1
- package/dist/spaces.js.map +1 -1
- package/dist/streams.d.ts +168 -1
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +299 -21
- package/dist/streams.js.map +1 -1
- package/dist/subjects.d.ts +34 -36
- package/dist/subjects.d.ts.map +1 -1
- package/dist/subjects.js +46 -35
- package/dist/subjects.js.map +1 -1
- package/dist/types.d.ts +27 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-grants.js","sourceRoot":"","sources":["../src/endpoint-grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAE3E,mBAAmB,EAAE,uBAAuB,EAAE,iBAAiB,GAChE,MAAM,wBAAwB,CAAC;AAoBhC;;;;;;mFAMmF;AACnF,SAAS,iBAAiB,CAAC,MAAgB,EAAE,MAAgB;IAC3D,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;QAC1B,OAAO,CAAC,QAAQ,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACpL,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;QACnD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IACxG,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK;QAChC,MAAM,IAAI,KAAK,CA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AAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,uCAAuC;IAC7H,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;IACrJ,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { NatsConnection } from "@nats-io/transport-node";
|
|
2
|
+
import { type CompiledContract } from "./schema-profile.js";
|
|
3
|
+
import { type EpCaller } from "./endpoint-subjects.js";
|
|
4
|
+
import type { EpVerbTarget, EpAttributedReply, EpScatterResult } from "./endpoint-verbs.js";
|
|
5
|
+
/** A resolved command contract: the compiled input/output validators (recompiled from the store,
|
|
6
|
+
* digest-verified against the registered declaration) plus the command's §13.2 admission facts. */
|
|
7
|
+
export interface ResolvedCommand {
|
|
8
|
+
command: string;
|
|
9
|
+
contract: {
|
|
10
|
+
input: CompiledContract;
|
|
11
|
+
output: CompiledContract;
|
|
12
|
+
};
|
|
13
|
+
class: string;
|
|
14
|
+
targeted: boolean;
|
|
15
|
+
modes: readonly string[];
|
|
16
|
+
capability: string;
|
|
17
|
+
}
|
|
18
|
+
/** An endpoint's resolved invocation surface: every command the caller may see, with recompiled
|
|
19
|
+
* digest-verified contracts. Built from a fresh `describe` + store fetch. Carries the `caller`
|
|
20
|
+
* triple the describe ran as, so {@link invokeCommand} reuses the same authenticated identity,
|
|
21
|
+
* and the ANSWERING incarnation's identity off the describe reply SUBJECT (broker-authenticated:
|
|
22
|
+
* the §13.9 serve publish row pins `instanceId`+`epoch`, a responder cannot stamp another's) -
|
|
23
|
+
* {@link invokeCommand}'s default currency check binds the invoke to this incarnation. */
|
|
24
|
+
export interface ResolvedService {
|
|
25
|
+
endpoint: string;
|
|
26
|
+
owner: string;
|
|
27
|
+
caller: EpCaller;
|
|
28
|
+
responder: {
|
|
29
|
+
instanceId: string;
|
|
30
|
+
epoch: number;
|
|
31
|
+
};
|
|
32
|
+
commands: Map<string, ResolvedCommand>;
|
|
33
|
+
/** Set when the service was resolved PINNED to one instance's `inst` route (P2 item 3 `--on`):
|
|
34
|
+
* {@link invokeCommand} then routes commands to that exact instance, never the class `one` queue,
|
|
35
|
+
* so a multi-manager space can be addressed per-instance. Absent ⇒ class anycast (the default). */
|
|
36
|
+
pinnedInstanceId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The reserved `describe` command as a raw request/reply (§13.7: describe pins NO contract, so it
|
|
40
|
+
* carries no `op` digests — {@link epCall} always stamps digests and the serve boundary rejects a
|
|
41
|
+
* digest-bearing describe as `contract-mismatch`, so this is a purpose-built raw path). It
|
|
42
|
+
* REQUEST-BINDS its reply exactly as {@link epCall}'s `parseAttributedReply` does (§13.2): the
|
|
43
|
+
* responder grant `epResponderReplyPattern` spans EVERY caller suffix, so any live responder can
|
|
44
|
+
* publish on the caller's rail at any nonce — acceptance therefore checks the reply SUBJECT's
|
|
45
|
+
* endpoint + nonce AND the body's echoed request id, not just "first `{ok:true}` on the rail".
|
|
46
|
+
* A reply that fails any of these is IGNORED (not rejected: an attacker racing a wrong-nonce reply
|
|
47
|
+
* must not be able to fail an honest describe), and the wait continues to the deadline.
|
|
48
|
+
*/
|
|
49
|
+
export declare function describeEndpoint(nc: NatsConnection, space: string, endpoint: string, caller: EpCaller, opts?: {
|
|
50
|
+
deadlineMs?: number;
|
|
51
|
+
instanceId?: string;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
answer: DescribeAnswer;
|
|
54
|
+
responder: {
|
|
55
|
+
instanceId: string;
|
|
56
|
+
epoch: number;
|
|
57
|
+
};
|
|
58
|
+
}>;
|
|
59
|
+
/** The describe answer shape a caller reads (a subset — the fields the resolver needs). */
|
|
60
|
+
interface DescribeAnswer {
|
|
61
|
+
public: boolean;
|
|
62
|
+
descriptor: {
|
|
63
|
+
endpoint: string;
|
|
64
|
+
owner: string;
|
|
65
|
+
clusters: {
|
|
66
|
+
digest: string;
|
|
67
|
+
commands: string[];
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* DESCRIBE an endpoint and resolve its full invocation surface: send the reserved `describe`
|
|
73
|
+
* command (untargeted, void args), then for every VISIBLE cluster fetch + verify its document
|
|
74
|
+
* from the store and recompile each command's input/output contracts. The result lets a caller
|
|
75
|
+
* invoke any visible command by name with no compile-time knowledge of the endpoint's schemas.
|
|
76
|
+
*
|
|
77
|
+
* `describe` itself pins no contract (§13.7), so it is issued as a raw void-arg request
|
|
78
|
+
* ({@link describeEndpoint}), never through the digest-stamping {@link epCall}.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveService(nc: NatsConnection, space: string, endpoint: string, caller: EpCaller, opts?: {
|
|
81
|
+
deadlineMs?: number;
|
|
82
|
+
instanceId?: string;
|
|
83
|
+
}): Promise<ResolvedService>;
|
|
84
|
+
/**
|
|
85
|
+
* INVOKE one named command on a resolved service: validate nothing here (the compiled input
|
|
86
|
+
* contract in {@link epCall}'s request builder gates args before publish, and the responder's
|
|
87
|
+
* digest-bound boundary re-validates), route on the `one` rail, return the attributed reply. A
|
|
88
|
+
* command absent from the resolved surface is `not-found` (the caller cannot see it, or it does
|
|
89
|
+
* not exist); a targeted command needs its `target`.
|
|
90
|
+
*
|
|
91
|
+
* Currency: `opts.currentEpoch` (e.g. the registry-read `serviceEpochReader`) when supplied;
|
|
92
|
+
* otherwise the DESCRIBE-BOUND default - accept exactly the incarnation that answered this
|
|
93
|
+
* service's resolve (its broker-authenticated `instanceId`+`epoch` off the describe reply
|
|
94
|
+
* subject) and refuse `failed-precondition` when a DIFFERENT instance wins the `one` queue
|
|
95
|
+
* (a superseded-or-split responder; re-resolve to adopt a legitimate successor). The bind needs
|
|
96
|
+
* no registry read grant, and it is strictly stronger than no check: two live instances of a
|
|
97
|
+
* single-instance endpoint can never both pass one resolved handle.
|
|
98
|
+
*/
|
|
99
|
+
export declare function invokeCommand(nc: NatsConnection, space: string, service: ResolvedService, command: string, args: Record<string, unknown> | undefined, opts: {
|
|
100
|
+
target?: EpVerbTarget;
|
|
101
|
+
deadlineMs?: number;
|
|
102
|
+
currentEpoch?: (instanceId: string) => Promise<number> | number;
|
|
103
|
+
}): Promise<EpAttributedReply>;
|
|
104
|
+
/** Submit an ACTION command and FOLLOW its goal to the terminal (P2 item 2, 2b): since 2a a
|
|
105
|
+
* spawn/launch reply is the ACCEPTANCE (returned before the agent is live), so a consumer that
|
|
106
|
+
* wants the old block-until-outcome behaviour follows the caller-scoped progress subtree to the
|
|
107
|
+
* terminal here. The subscription opens BEFORE `submit` runs (a fast join could terminalize within
|
|
108
|
+
* milliseconds of the acceptance), buffering terminals by goalId. The reply is then RESOLVED from
|
|
109
|
+
* the terminal: `succeeded` → the terminal's data (today's live reply — name/id/role/agent/mode/
|
|
110
|
+
* lifecycleUid), `failed`/`uncertain`/`cancelled` → a non-ok reply carrying the cause. A reply with
|
|
111
|
+
* NO goalId (a refuse-at-accept, or a non-action command) passes through unchanged. UX is preserved:
|
|
112
|
+
* the call still returns on the real outcome. The caller needs the per-goal progress read row
|
|
113
|
+
* ({@link epGoalProgressGrantRow}) — minted with any goal-bearing capability. */
|
|
114
|
+
export declare function submitAndFollowGoal(nc: NatsConnection, space: string, endpoint: string, caller: EpCaller, deadlineMs: number, submit: () => Promise<EpAttributedReply>): Promise<EpAttributedReply>;
|
|
115
|
+
/**
|
|
116
|
+
* SCATTER one untargeted command to the LIVE class (§13.5): resolve the command's contract off the
|
|
117
|
+
* same digest-verified surface {@link invokeCommand} uses, then run the registry-wired scatter —
|
|
118
|
+
* freeze the expected set from the records registry, publish ONCE on the `all` rail, gather one
|
|
119
|
+
* attributed reply per instance, and reconcile registration currency post-classification. The
|
|
120
|
+
* returned `replies` map is keyed by instanceId (per-instance attribution, SPEC §13.5); a frozen
|
|
121
|
+
* instance that produced no on-time reply is a `missing` slot — reported UNREACHABLE, never silently
|
|
122
|
+
* omitted. The caller's connection carries the §13.9 records-read grant the freeze/reconcile ride (a
|
|
123
|
+
* scoped read of the endpoint's `svc` registry); `jsm`/`kv` are opened over it here.
|
|
124
|
+
*
|
|
125
|
+
* A scatter addresses EVERY instance, so a targeted command is refused (a per-instance target is
|
|
126
|
+
* incoherent with the `all` rail) and a handle PINNED to one instance is refused (a pin is the
|
|
127
|
+
* anti-scatter — use {@link invokeCommand} for `--on`). "No args" marshals to the contract's
|
|
128
|
+
* canonical empty form exactly as {@link invokeCommand}.
|
|
129
|
+
*/
|
|
130
|
+
export declare function scatterCommand(nc: NatsConnection, space: string, service: ResolvedService, command: string, args: Record<string, unknown> | undefined, opts: {
|
|
131
|
+
deadlineMs: number;
|
|
132
|
+
reconcileDeadlineMs?: number;
|
|
133
|
+
lateDrainMs?: number;
|
|
134
|
+
}): Promise<EpScatterResult>;
|
|
135
|
+
/** A digest reference's bare hex, exported so a CLI can print the resolved surface's digests. */
|
|
136
|
+
export declare function contractDigestHexOf(value: unknown): string;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=endpoint-invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-invoke.d.ts","sourceRoot":"","sources":["../src/endpoint-invoke.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,yBAAyB,CAAC;AAG5E,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ7E,OAAO,EAAyD,KAAK,QAAQ,EAAgB,MAAM,wBAAwB,CAAC;AAE5H,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK5F;oGACoG;AACpG,MAAM,WAAW,eAAe;IAC9B,O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E,UAAU,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/E,OAAO,CAAC,eAAe,CAAC,CAuB1B;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GENERIC caller path (control-surface P2 item 1, item 5): describe an endpoint, fetch its
|
|
3
|
+
* registered contracts from the §13.7 content store, recompile the digest-matching validators,
|
|
4
|
+
* and invoke a named command — WITHOUT the caller compiling the endpoint's schemas ahead of time.
|
|
5
|
+
* This is what a `cotal describe`/`cotal invoke` CLI and every migrated control consumer ride, so
|
|
6
|
+
* a consumer no longer hand-imports the manager's contract module.
|
|
7
|
+
*
|
|
8
|
+
* The trust chain is the §13.7 one, end to end:
|
|
9
|
+
* - `describe` (the reserved, authorization-scoped command every endpoint serves) answers the
|
|
10
|
+
* caller's VISIBLE command set + the registered CLUSTER closure digests;
|
|
11
|
+
* - each cluster document is fetched from the store at its closure digest and VERIFIED
|
|
12
|
+
* (two-stage manifest→root, content-addressed) — the command's input/output CLOSURE digests
|
|
13
|
+
* come from those verified bytes, never a caller assertion;
|
|
14
|
+
* - each schema closure is fetched + PROFILE-recompiled; the recompiled contract's closureDigest
|
|
15
|
+
* MUST equal the registered digest (a store that served the wrong bytes fails here);
|
|
16
|
+
* - the invoke pins those digests, so the responder's digest-bound serve boundary honors exactly
|
|
17
|
+
* the schema the caller validated against.
|
|
18
|
+
*/
|
|
19
|
+
import { randomBytes } from "node:crypto";
|
|
20
|
+
import { jetstreamManager } from "@nats-io/jetstream";
|
|
21
|
+
import { EpEnvelopeError } from "./endpoint-envelope.js";
|
|
22
|
+
import { compileContract } from "./schema-profile.js";
|
|
23
|
+
import { contractStoreContext, fetchContractClosure, contractRefToHex, contractArtifactDigestHex, } from "./endpoint-contract-store.js";
|
|
24
|
+
import { parseClusterDocument } from "./endpoint-cluster.js";
|
|
25
|
+
import { epCall, epScatterService } from "./endpoint-verbs.js";
|
|
26
|
+
import { epGoalProgressGrantRow } from "./endpoint-grants.js";
|
|
27
|
+
import { epRequestSubject, epCallerReplyFilter, parseEpSubject } from "./endpoint-subjects.js";
|
|
28
|
+
import { parseEndpointReply } from "./endpoint-envelope.js";
|
|
29
|
+
const dec = new TextDecoder(), enc = new TextEncoder();
|
|
30
|
+
const nonce = () => randomBytes(24).toString("base64url");
|
|
31
|
+
/**
|
|
32
|
+
* The reserved `describe` command as a raw request/reply (§13.7: describe pins NO contract, so it
|
|
33
|
+
* carries no `op` digests — {@link epCall} always stamps digests and the serve boundary rejects a
|
|
34
|
+
* digest-bearing describe as `contract-mismatch`, so this is a purpose-built raw path). It
|
|
35
|
+
* REQUEST-BINDS its reply exactly as {@link epCall}'s `parseAttributedReply` does (§13.2): the
|
|
36
|
+
* responder grant `epResponderReplyPattern` spans EVERY caller suffix, so any live responder can
|
|
37
|
+
* publish on the caller's rail at any nonce — acceptance therefore checks the reply SUBJECT's
|
|
38
|
+
* endpoint + nonce AND the body's echoed request id, not just "first `{ok:true}` on the rail".
|
|
39
|
+
* A reply that fails any of these is IGNORED (not rejected: an attacker racing a wrong-nonce reply
|
|
40
|
+
* must not be able to fail an honest describe), and the wait continues to the deadline.
|
|
41
|
+
*/
|
|
42
|
+
export async function describeEndpoint(nc, space, endpoint, caller, opts = {}) {
|
|
43
|
+
const deadlineMs = opts.deadlineMs ?? 10_000;
|
|
44
|
+
const n = nonce();
|
|
45
|
+
const requestId = nonce();
|
|
46
|
+
// P2 item 3 `--on <instance>`: PIN the describe to one instance's `inst` route so a multi-manager
|
|
47
|
+
// space resolves the exact instance addressed, not whichever wins the class `one` queue. Default =
|
|
48
|
+
// class anycast (mode "one"), unchanged for every existing caller.
|
|
49
|
+
const route = opts.instanceId !== undefined ? { mode: "inst", instanceId: opts.instanceId } : { mode: "one" };
|
|
50
|
+
const subject = epRequestSubject(space, { route, endpoint, command: "describe", caller, nonce: n });
|
|
51
|
+
const env = {
|
|
52
|
+
v: 1, id: requestId, op: { endpoint, command: "describe" }, class: "ephemeral",
|
|
53
|
+
replyExpected: true, deadlineMs, from: { id: `${caller.owner}.${caller.actor}`, name: caller.actor },
|
|
54
|
+
};
|
|
55
|
+
let sub;
|
|
56
|
+
let timer;
|
|
57
|
+
try {
|
|
58
|
+
const got = new Promise((resolve, reject) => {
|
|
59
|
+
sub = nc.subscribe(epCallerReplyFilter(space, caller), {
|
|
60
|
+
callback: (err, msg) => {
|
|
61
|
+
if (err) {
|
|
62
|
+
reject(new EpEnvelopeError("unavailable", `describe reply subscription failed: ${err.message}`));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// REQUEST-BIND off the reply SUBJECT first (§13.2): the responder triple + nonce are
|
|
66
|
+
// broker-pinned by the serve publish grant. A reply for a DIFFERENT endpoint, or on a
|
|
67
|
+
// nonce that is not the one we published (the rail is shared across our concurrent
|
|
68
|
+
// requests, and a hostile responder can publish at any nonce), is NOT ours — ignore it
|
|
69
|
+
// and keep waiting, never fail the honest describe on an injected reply.
|
|
70
|
+
const parsed = parseEpSubject(msg.subject);
|
|
71
|
+
if (!parsed || parsed.plane !== "reply" || parsed.endpoint !== endpoint || parsed.nonce !== n)
|
|
72
|
+
return;
|
|
73
|
+
// Then the body: it must parse as an EndpointReply and ECHO our request id on this
|
|
74
|
+
// nonce-scoped rail (§13.3) — the second half of the confused-deputy binding.
|
|
75
|
+
let reply;
|
|
76
|
+
try {
|
|
77
|
+
reply = parseEndpointReply(JSON.parse(dec.decode(msg.data)));
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return;
|
|
81
|
+
} // a malformed body on our nonce is not a usable answer; wait for a valid one
|
|
82
|
+
if (reply.id !== requestId)
|
|
83
|
+
return;
|
|
84
|
+
resolve({ body: reply, responder: { instanceId: parsed.instanceId, epoch: parsed.epoch } });
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
nc.publish(subject, enc.encode(JSON.stringify(env)));
|
|
88
|
+
});
|
|
89
|
+
const timeout = new Promise((_, reject) => { timer = setTimeout(() => reject(new EpEnvelopeError("deadline-exceeded", `no describe reply from ${endpoint} within ${deadlineMs}ms`)), deadlineMs); });
|
|
90
|
+
const { body: reply, responder } = await Promise.race([got, timeout]);
|
|
91
|
+
if (reply.ok !== true) {
|
|
92
|
+
const e = reply.error;
|
|
93
|
+
throw new EpEnvelopeError(e?.code ?? "unavailable", `describe(${endpoint}) failed: ${e?.message ?? "unknown"}`);
|
|
94
|
+
}
|
|
95
|
+
return { answer: reply.data, responder };
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
sub?.unsubscribe();
|
|
99
|
+
if (timer !== undefined)
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** Fetch + verify ONE cluster document from the store at its closure digest (two-stage §13.7:
|
|
104
|
+
* the manifest at the closure digest, whose `root` names the document artifact). A cluster
|
|
105
|
+
* document declares no by-digest child references, so its closure is {root}. */
|
|
106
|
+
async function fetchClusterDocument(store, closureDigest, artifactMemo) {
|
|
107
|
+
const { manifest, artifacts } = await fetchContractClosure(store, closureDigest, () => [], { ...(artifactMemo ? { artifactMemo } : {}) });
|
|
108
|
+
const rootBytes = artifacts.get(contractRefToHex(manifest.root));
|
|
109
|
+
if (rootBytes === undefined)
|
|
110
|
+
throw new EpEnvelopeError("failed-precondition", `the cluster manifest ${closureDigest} names root ${manifest.root} but the root artifact is absent from the fetched closure (SPEC 13.7)`);
|
|
111
|
+
return parseClusterDocument(JSON.parse(dec.decode(rootBytes)));
|
|
112
|
+
}
|
|
113
|
+
/** Fetch a schema CLOSURE from the store and PROFILE-recompile it, binding every by-digest member.
|
|
114
|
+
* The recompiled contract's closureDigest MUST equal the digest we fetched at — a store that
|
|
115
|
+
* served bytes hashing to a different closure is a tamper/bug and fails loud (§13.7). */
|
|
116
|
+
async function recompileClosure(store, closureDigest, artifactMemo) {
|
|
117
|
+
// Walk the schema closure, resolving `cotal:sha256:<hex>` refs a document makes (the profile's
|
|
118
|
+
// reference form) so a multi-document schema bundle rebuilds. A recompiled contract carries the
|
|
119
|
+
// registered digest, so an equality check below is the tamper boundary.
|
|
120
|
+
const { manifest, artifacts } = await fetchContractClosure(store, closureDigest, (bytes) => extractSchemaRefs(bytes), { ...(artifactMemo ? { artifactMemo } : {}) });
|
|
121
|
+
const members = {};
|
|
122
|
+
for (const [hex, bytes] of artifacts)
|
|
123
|
+
members[`sha256:${hex}`] = JSON.parse(dec.decode(bytes));
|
|
124
|
+
const rootRef = manifest.root;
|
|
125
|
+
const root = members[rootRef];
|
|
126
|
+
if (root === undefined)
|
|
127
|
+
throw new EpEnvelopeError("failed-precondition", `schema closure ${closureDigest} is missing its root ${rootRef} (SPEC 13.7)`);
|
|
128
|
+
// The bundle members are the NON-root artifacts, keyed by their `sha256:` ref (the profile's
|
|
129
|
+
// resolution form); the root is passed separately.
|
|
130
|
+
const bundleMembers = {};
|
|
131
|
+
for (const [ref, value] of Object.entries(members))
|
|
132
|
+
if (ref !== rootRef)
|
|
133
|
+
bundleMembers[ref] = value;
|
|
134
|
+
const compiled = compileContract({ root, members: bundleMembers });
|
|
135
|
+
if (compiled.closureDigest !== closureDigest)
|
|
136
|
+
throw new EpEnvelopeError("internal", `the recompiled schema closure hashes to ${compiled.closureDigest}, not the fetched ${closureDigest}; a store that served the wrong bytes never authorizes (SPEC 13.7)`);
|
|
137
|
+
return compiled;
|
|
138
|
+
}
|
|
139
|
+
/** The by-digest references a stored schema artifact makes: every string value anywhere in the
|
|
140
|
+
* document of the profile's `cotal:sha256:<hex>` `$ref` form, returned as bare `sha256:<hex>`
|
|
141
|
+
* refs for the closure walk. A schema with no refs (the common case) returns none. */
|
|
142
|
+
function extractSchemaRefs(bytes) {
|
|
143
|
+
const refs = [];
|
|
144
|
+
const walk = (v) => {
|
|
145
|
+
if (typeof v === "string") {
|
|
146
|
+
const m = /^cotal:(sha256:[0-9a-f]{64})$/.exec(v);
|
|
147
|
+
if (m)
|
|
148
|
+
refs.push(m[1]);
|
|
149
|
+
}
|
|
150
|
+
else if (Array.isArray(v)) {
|
|
151
|
+
for (const c of v)
|
|
152
|
+
walk(c);
|
|
153
|
+
}
|
|
154
|
+
else if (v !== null && typeof v === "object") {
|
|
155
|
+
for (const c of Object.values(v))
|
|
156
|
+
walk(c);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
walk(JSON.parse(dec.decode(bytes)));
|
|
160
|
+
return refs;
|
|
161
|
+
}
|
|
162
|
+
/** The most store reads one {@link resolveService} keeps in flight at once. The fan-out width is
|
|
163
|
+
* the RESPONDER's command count (it comes off the describe answer), so leaving it unbounded would
|
|
164
|
+
* let a describing endpoint decide how many concurrent requests its caller opens — a caller-side
|
|
165
|
+
* amplification the rest of §13.7 is careful to bound. Every other limit on this path is explicit;
|
|
166
|
+
* so is this one. High enough that real surfaces overlap freely, low enough to stay a bound. */
|
|
167
|
+
const RESOLVE_MAX_INFLIGHT_READS = 32;
|
|
168
|
+
/** Run `work` over `items` with at most `limit` in flight, preserving RESULT ORDER (the resolved
|
|
169
|
+
* surface must not depend on read timing). Rejects like `Promise.all`: the first failure wins. */
|
|
170
|
+
async function pooled(items, limit, work) {
|
|
171
|
+
const out = new Array(items.length);
|
|
172
|
+
let next = 0;
|
|
173
|
+
const worker = async () => {
|
|
174
|
+
for (;;) {
|
|
175
|
+
const i = next++;
|
|
176
|
+
if (i >= items.length)
|
|
177
|
+
return;
|
|
178
|
+
out[i] = await work(items[i]);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* DESCRIBE an endpoint and resolve its full invocation surface: send the reserved `describe`
|
|
186
|
+
* command (untargeted, void args), then for every VISIBLE cluster fetch + verify its document
|
|
187
|
+
* from the store and recompile each command's input/output contracts. The result lets a caller
|
|
188
|
+
* invoke any visible command by name with no compile-time knowledge of the endpoint's schemas.
|
|
189
|
+
*
|
|
190
|
+
* `describe` itself pins no contract (§13.7), so it is issued as a raw void-arg request
|
|
191
|
+
* ({@link describeEndpoint}), never through the digest-stamping {@link epCall}.
|
|
192
|
+
*/
|
|
193
|
+
export async function resolveService(nc, space, endpoint, caller, opts = {}) {
|
|
194
|
+
const { answer, responder } = await describeEndpoint(nc, space, endpoint, caller, opts);
|
|
195
|
+
const store = await contractStoreContext(nc, space);
|
|
196
|
+
const visible = new Set(answer.descriptor.clusters.flatMap((cl) => cl.commands));
|
|
197
|
+
// The store reads dominate a resolve's wall time and are all caller->broker round-trips, so they
|
|
198
|
+
// are issued CONCURRENTLY and deduped through one memo rather than queued one behind another (a
|
|
199
|
+
// 17-command surface measured 70 strictly sequential reads, 22 of them re-reads; at a WAN RTT
|
|
200
|
+
// that is the whole latency). Each closure walk is still internally sequential and its §13.7
|
|
201
|
+
// bounds are still counted per walk — the concurrency is BETWEEN walks, so no limit is widened.
|
|
202
|
+
const artifactMemo = new Map();
|
|
203
|
+
const docs = await pooled(answer.descriptor.clusters, RESOLVE_MAX_INFLIGHT_READS, (cl) => fetchClusterDocument(store, cl.digest, artifactMemo));
|
|
204
|
+
// Flattened in DOCUMENT ORDER first, then resolved concurrently and inserted in that same order:
|
|
205
|
+
// when two clusters declare one command name, last-in-document-order still wins, exactly as the
|
|
206
|
+
// sequential form did. Concurrency must not make the resolved surface depend on read timing.
|
|
207
|
+
const declared = docs.flatMap((doc) => doc.commands).filter((cmd) => visible.has(cmd.name)); // a describe VIEW may narrow a cluster's commands
|
|
208
|
+
// Each command needs two closures, so the pool runs at half the read bound to keep the in-flight
|
|
209
|
+
// read count under it.
|
|
210
|
+
const resolved = await pooled(declared, Math.max(1, RESOLVE_MAX_INFLIGHT_READS >> 1), async (cmd) => {
|
|
211
|
+
// Each command recompiles its OWN validators (cheap, CPU-only) even when two commands share a
|
|
212
|
+
// closure digest: a compiled contract is not shared, only the artifact bytes behind it are.
|
|
213
|
+
const [input, output] = await Promise.all([
|
|
214
|
+
recompileClosure(store, cmd.inputDigest, artifactMemo),
|
|
215
|
+
recompileClosure(store, cmd.outputDigest, artifactMemo),
|
|
216
|
+
]);
|
|
217
|
+
return {
|
|
218
|
+
command: cmd.name,
|
|
219
|
+
contract: { input, output },
|
|
220
|
+
class: cmd.class,
|
|
221
|
+
targeted: cmd.targeted,
|
|
222
|
+
modes: cmd.modes ?? [],
|
|
223
|
+
capability: cmd.capability,
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
const commands = new Map();
|
|
227
|
+
for (const rc of resolved)
|
|
228
|
+
commands.set(rc.command, rc);
|
|
229
|
+
return { endpoint: answer.descriptor.endpoint, owner: answer.descriptor.owner, caller, responder, commands, ...(opts.instanceId !== undefined ? { pinnedInstanceId: opts.instanceId } : {}) };
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* INVOKE one named command on a resolved service: validate nothing here (the compiled input
|
|
233
|
+
* contract in {@link epCall}'s request builder gates args before publish, and the responder's
|
|
234
|
+
* digest-bound boundary re-validates), route on the `one` rail, return the attributed reply. A
|
|
235
|
+
* command absent from the resolved surface is `not-found` (the caller cannot see it, or it does
|
|
236
|
+
* not exist); a targeted command needs its `target`.
|
|
237
|
+
*
|
|
238
|
+
* Currency: `opts.currentEpoch` (e.g. the registry-read `serviceEpochReader`) when supplied;
|
|
239
|
+
* otherwise the DESCRIBE-BOUND default - accept exactly the incarnation that answered this
|
|
240
|
+
* service's resolve (its broker-authenticated `instanceId`+`epoch` off the describe reply
|
|
241
|
+
* subject) and refuse `failed-precondition` when a DIFFERENT instance wins the `one` queue
|
|
242
|
+
* (a superseded-or-split responder; re-resolve to adopt a legitimate successor). The bind needs
|
|
243
|
+
* no registry read grant, and it is strictly stronger than no check: two live instances of a
|
|
244
|
+
* single-instance endpoint can never both pass one resolved handle.
|
|
245
|
+
*/
|
|
246
|
+
export async function invokeCommand(nc, space, service, command, args, opts) {
|
|
247
|
+
const resolved = service.commands.get(command);
|
|
248
|
+
if (resolved === undefined)
|
|
249
|
+
throw new EpEnvelopeError("not-found", `command "${command}" is not in ${service.endpoint}'s visible surface; describe lists ${[...service.commands.keys()].sort().join(", ") || "(none)"}`);
|
|
250
|
+
if (resolved.targeted && opts.target === undefined)
|
|
251
|
+
throw new EpEnvelopeError("bad-request", `command "${command}" is targeted (modes: ${resolved.modes.join(", ")}); an invoke needs its target`);
|
|
252
|
+
if (!resolved.targeted && opts.target !== undefined)
|
|
253
|
+
throw new EpEnvelopeError("bad-request", `command "${command}" is untargeted; an invoke must not carry a target`);
|
|
254
|
+
const caller = service.caller;
|
|
255
|
+
// "No args" marshals to the CONTRACT's canonical empty form: absent args ride as null on the
|
|
256
|
+
// wire, so when this command's input rejects null but accepts the empty object (e.g. an
|
|
257
|
+
// all-optional `{type:"object"}` input like despawn's), send `{}` — that IS the caller's
|
|
258
|
+
// intent in that contract's vocabulary (a targeted CLI stop has nothing left after the alias
|
|
259
|
+
// becomes the target block). Contract-derived, never a guess: an input that requires fields
|
|
260
|
+
// accepts neither form and still refuses loud at the pre-publish validation below.
|
|
261
|
+
let sendArgs = args;
|
|
262
|
+
if (sendArgs === undefined && !resolved.contract.input.validate(null) && resolved.contract.input.validate({}))
|
|
263
|
+
sendArgs = {};
|
|
264
|
+
const describeBound = (instanceId) => {
|
|
265
|
+
if (instanceId !== service.responder.instanceId) {
|
|
266
|
+
// The refusal is unchanged; what it SAYS is not. One message used to cover two situations
|
|
267
|
+
// that call for opposite responses, and it described only the rarer one.
|
|
268
|
+
//
|
|
269
|
+
// PINNED: the caller named an instance and a different one answered. Genuinely wrong.
|
|
270
|
+
//
|
|
271
|
+
// UNPINNED: the caller addressed the CLASS. The describe and the invoke are two independent
|
|
272
|
+
// trips through the same anycast queue, so in a multi-instance space they routinely land on
|
|
273
|
+
// different instances and this fires on an ordinary, correct request - not on a supersession.
|
|
274
|
+
// Calling that "superseded-or-split" sends the reader hunting a restart that never happened.
|
|
275
|
+
// The old text's remedy is also not executable by the surfaces that print it most (`stop`,
|
|
276
|
+
// `despawn` and `attach` have no adopt path and no pin), so it advised an action the caller
|
|
277
|
+
// could not take. Say which case this is, and stop asserting a cause that is usually wrong.
|
|
278
|
+
throw new EpEnvelopeError("failed-precondition", service.pinnedInstanceId !== undefined
|
|
279
|
+
? `the ${service.endpoint} instance ${instanceId} answered but this handle is PINNED to ${service.pinnedInstanceId}; a pinned call names its instance and never accepts another (SPEC 13.2)`
|
|
280
|
+
: `the ${service.endpoint} instance ${instanceId} won the class queue but this UNPINNED handle resolved against ${service.responder.instanceId}; the describe and the invoke are separate trips through the same queue, so in a multi-instance space this is an ordinary split and not necessarily a supersession - the handle cannot currently adopt a different winner (SPEC 13.2)`);
|
|
281
|
+
}
|
|
282
|
+
return service.responder.epoch;
|
|
283
|
+
};
|
|
284
|
+
// P2 item 3 `--on`: a PINNED service routes to its exact instance's `inst` rail (the same instance the
|
|
285
|
+
// describe resolved to, at its resolved epoch), never the class `one` queue — so the command reaches
|
|
286
|
+
// the addressed manager in a multi-manager space. Unpinned ⇒ class anycast `one` (unchanged). The
|
|
287
|
+
// describeBound currency check still holds: an inst-routed reply carries that instance's id.
|
|
288
|
+
const route = service.pinnedInstanceId !== undefined
|
|
289
|
+
? { mode: "inst", instanceId: service.pinnedInstanceId, epoch: service.responder.epoch }
|
|
290
|
+
: { mode: "one" };
|
|
291
|
+
return epCall(nc, space, route, {
|
|
292
|
+
endpoint: service.endpoint, command, contract: resolved.contract, caller,
|
|
293
|
+
...(sendArgs !== undefined ? { args: sendArgs } : {}),
|
|
294
|
+
...(opts.target ? { target: opts.target } : {}),
|
|
295
|
+
}, { deadlineMs: opts.deadlineMs ?? 10_000, currentEpoch: opts.currentEpoch ?? describeBound });
|
|
296
|
+
}
|
|
297
|
+
/** Submit an ACTION command and FOLLOW its goal to the terminal (P2 item 2, 2b): since 2a a
|
|
298
|
+
* spawn/launch reply is the ACCEPTANCE (returned before the agent is live), so a consumer that
|
|
299
|
+
* wants the old block-until-outcome behaviour follows the caller-scoped progress subtree to the
|
|
300
|
+
* terminal here. The subscription opens BEFORE `submit` runs (a fast join could terminalize within
|
|
301
|
+
* milliseconds of the acceptance), buffering terminals by goalId. The reply is then RESOLVED from
|
|
302
|
+
* the terminal: `succeeded` → the terminal's data (today's live reply — name/id/role/agent/mode/
|
|
303
|
+
* lifecycleUid), `failed`/`uncertain`/`cancelled` → a non-ok reply carrying the cause. A reply with
|
|
304
|
+
* NO goalId (a refuse-at-accept, or a non-action command) passes through unchanged. UX is preserved:
|
|
305
|
+
* the call still returns on the real outcome. The caller needs the per-goal progress read row
|
|
306
|
+
* ({@link epGoalProgressGrantRow}) — minted with any goal-bearing capability. */
|
|
307
|
+
export async function submitAndFollowGoal(nc, space, endpoint, caller, deadlineMs, submit) {
|
|
308
|
+
const terminals = new Map();
|
|
309
|
+
const waiters = new Map();
|
|
310
|
+
const sub = nc.subscribe(epGoalProgressGrantRow(space, endpoint, caller), {
|
|
311
|
+
callback: (err, m) => {
|
|
312
|
+
if (err)
|
|
313
|
+
return;
|
|
314
|
+
let ev;
|
|
315
|
+
try {
|
|
316
|
+
ev = JSON.parse(dec.decode(m.data));
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (ev && ev.phase === "terminal" && typeof ev.goalId === "string") {
|
|
322
|
+
terminals.set(ev.goalId, { state: String(ev.state), data: ev.data });
|
|
323
|
+
waiters.get(ev.goalId)?.();
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
try {
|
|
328
|
+
const attributed = await submit();
|
|
329
|
+
if (attributed.reply.ok !== true)
|
|
330
|
+
return attributed; // refuse at accept — surface as-is
|
|
331
|
+
const goalId = attributed.reply.data?.goalId;
|
|
332
|
+
if (typeof goalId !== "string")
|
|
333
|
+
return attributed; // not an action reply — pass through
|
|
334
|
+
const terminal = terminals.get(goalId) ?? await new Promise((resolve) => {
|
|
335
|
+
const t = setTimeout(() => resolve(terminals.get(goalId)), deadlineMs);
|
|
336
|
+
waiters.set(goalId, () => { clearTimeout(t); resolve(terminals.get(goalId)); });
|
|
337
|
+
});
|
|
338
|
+
if (terminal === undefined)
|
|
339
|
+
return { ...attributed, reply: { ...attributed.reply, ok: false, data: undefined, error: { code: "deadline-exceeded", message: `the goal "${goalId}" produced no terminal within ${deadlineMs}ms; read its outcome with 'ps'/'inspect' (SPEC 13.6)` } } };
|
|
340
|
+
if (terminal.state === "succeeded")
|
|
341
|
+
return { ...attributed, reply: { ...attributed.reply, ok: true, ...(terminal.data !== undefined ? { data: terminal.data } : { data: undefined }), error: undefined } };
|
|
342
|
+
const d = (terminal.data ?? {});
|
|
343
|
+
const message = typeof d.error === "string" ? d.error : typeof d.reason === "string" ? d.reason : `the goal settled ${terminal.state}`;
|
|
344
|
+
return { ...attributed, reply: { ...attributed.reply, ok: false, data: undefined, error: { code: terminal.state, message } } };
|
|
345
|
+
}
|
|
346
|
+
finally {
|
|
347
|
+
sub.unsubscribe();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* SCATTER one untargeted command to the LIVE class (§13.5): resolve the command's contract off the
|
|
352
|
+
* same digest-verified surface {@link invokeCommand} uses, then run the registry-wired scatter —
|
|
353
|
+
* freeze the expected set from the records registry, publish ONCE on the `all` rail, gather one
|
|
354
|
+
* attributed reply per instance, and reconcile registration currency post-classification. The
|
|
355
|
+
* returned `replies` map is keyed by instanceId (per-instance attribution, SPEC §13.5); a frozen
|
|
356
|
+
* instance that produced no on-time reply is a `missing` slot — reported UNREACHABLE, never silently
|
|
357
|
+
* omitted. The caller's connection carries the §13.9 records-read grant the freeze/reconcile ride (a
|
|
358
|
+
* scoped read of the endpoint's `svc` registry); `jsm`/`kv` are opened over it here.
|
|
359
|
+
*
|
|
360
|
+
* A scatter addresses EVERY instance, so a targeted command is refused (a per-instance target is
|
|
361
|
+
* incoherent with the `all` rail) and a handle PINNED to one instance is refused (a pin is the
|
|
362
|
+
* anti-scatter — use {@link invokeCommand} for `--on`). "No args" marshals to the contract's
|
|
363
|
+
* canonical empty form exactly as {@link invokeCommand}.
|
|
364
|
+
*/
|
|
365
|
+
export async function scatterCommand(nc, space, service, command, args, opts) {
|
|
366
|
+
const resolved = service.commands.get(command);
|
|
367
|
+
if (resolved === undefined)
|
|
368
|
+
throw new EpEnvelopeError("not-found", `command "${command}" is not in ${service.endpoint}'s visible surface; describe lists ${[...service.commands.keys()].sort().join(", ") || "(none)"}`);
|
|
369
|
+
if (resolved.targeted)
|
|
370
|
+
throw new EpEnvelopeError("bad-request", `command "${command}" is targeted; a class scatter addresses every instance and cannot carry a per-instance target (SPEC 13.5)`);
|
|
371
|
+
if (service.pinnedInstanceId !== undefined)
|
|
372
|
+
throw new EpEnvelopeError("bad-request", `a class scatter cannot run on a handle pinned to instance ${service.pinnedInstanceId}; resolve the service unpinned (a pin is the anti-scatter, SPEC 13.5)`);
|
|
373
|
+
const caller = service.caller;
|
|
374
|
+
// Same contract-canonical empty-args marshaling as invokeCommand: absent args ride as {} when the
|
|
375
|
+
// command's input rejects null but accepts the empty object (e.g. an all-optional object input).
|
|
376
|
+
let sendArgs = args;
|
|
377
|
+
if (sendArgs === undefined && !resolved.contract.input.validate(null) && resolved.contract.input.validate({}))
|
|
378
|
+
sendArgs = {};
|
|
379
|
+
// `checkAPI: false` so the caller needs NO account `$JS.API.INFO` grant: the freeze's reads are
|
|
380
|
+
// the scoped records-registry rows (`STREAM.INFO` + leader `STREAM.MSG.GET`), never an account
|
|
381
|
+
// probe. The scatter's grant stays exactly the §13.9 records read. No KV handle is opened — the
|
|
382
|
+
// freeze derives the bucket name and reads via jsm only.
|
|
383
|
+
const jsm = await jetstreamManager(nc, { checkAPI: false });
|
|
384
|
+
return epScatterService(nc, jsm, space, {
|
|
385
|
+
endpoint: service.endpoint, command, contract: resolved.contract, caller,
|
|
386
|
+
...(sendArgs !== undefined ? { args: sendArgs } : {}),
|
|
387
|
+
}, opts);
|
|
388
|
+
}
|
|
389
|
+
/** A digest reference's bare hex, exported so a CLI can print the resolved surface's digests. */
|
|
390
|
+
export function contractDigestHexOf(value) {
|
|
391
|
+
return contractArtifactDigestHex(new TextEncoder().encode(JSON.stringify(value)));
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=endpoint-invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-invoke.js","sourceRoot":"","sources":["../src/endpoint-invoke.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,yBAAyB,GAExF,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAwB,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAA+B,MAAM,wBAAwB,CAAC;AAC5H,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,EAAE,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AACvD,MAAM,KAAK,GAAG,GAAW,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CA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