@cotal-ai/core 0.165.4 → 0.166.1

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.
Files changed (49) hide show
  1. package/dist/anycast-requests.d.ts.map +1 -1
  2. package/dist/anycast-requests.js +4 -0
  3. package/dist/anycast-requests.js.map +1 -1
  4. package/dist/backup-config.d.ts.map +1 -1
  5. package/dist/backup-config.js +1 -2
  6. package/dist/backup-config.js.map +1 -1
  7. package/dist/connector.d.ts +0 -3
  8. package/dist/connector.d.ts.map +1 -1
  9. package/dist/connector.js.map +1 -1
  10. package/dist/endpoint-goal-follow.d.ts +3 -1
  11. package/dist/endpoint-goal-follow.d.ts.map +1 -1
  12. package/dist/endpoint-goal-follow.js +24 -5
  13. package/dist/endpoint-goal-follow.js.map +1 -1
  14. package/dist/endpoint.d.ts +9 -59
  15. package/dist/endpoint.d.ts.map +1 -1
  16. package/dist/endpoint.js +42 -338
  17. package/dist/endpoint.js.map +1 -1
  18. package/dist/index.d.ts +0 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +0 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/provision.d.ts +0 -4
  23. package/dist/provision.d.ts.map +1 -1
  24. package/dist/provision.js +3 -36
  25. package/dist/provision.js.map +1 -1
  26. package/dist/space-deletion-targets.js +2 -2
  27. package/dist/space-deletion-targets.js.map +1 -1
  28. package/dist/space-resource-definitions.d.ts.map +1 -1
  29. package/dist/space-resource-definitions.js +1 -2
  30. package/dist/space-resource-definitions.js.map +1 -1
  31. package/dist/streams.d.ts +0 -61
  32. package/dist/streams.d.ts.map +1 -1
  33. package/dist/streams.js +3 -68
  34. package/dist/streams.js.map +1 -1
  35. package/dist/subjects.d.ts +5 -31
  36. package/dist/subjects.d.ts.map +1 -1
  37. package/dist/subjects.js +6 -51
  38. package/dist/subjects.js.map +1 -1
  39. package/dist/types.d.ts +0 -3
  40. package/dist/types.d.ts.map +1 -1
  41. package/package.json +1 -5
  42. package/dist/permission-view.d.ts +0 -102
  43. package/dist/permission-view.d.ts.map +0 -1
  44. package/dist/permission-view.js +0 -77
  45. package/dist/permission-view.js.map +0 -1
  46. package/dist/permissions.d.ts +0 -291
  47. package/dist/permissions.d.ts.map +0 -1
  48. package/dist/permissions.js +0 -258
  49. package/dist/permissions.js.map +0 -1
@@ -1,291 +0,0 @@
1
- import type { JsonValue } from "./types.js";
2
- declare const principalIdBrand: unique symbol;
3
- declare const requestIdBrand: unique symbol;
4
- /** A principal's dot form `<owner>.<actor>`, both valid owner and actor tokens. */
5
- export type PrincipalId = string & {
6
- readonly [principalIdBrand]: true;
7
- };
8
- /** One prompt's id: 26 lowercase base32 characters. */
9
- export type PermissionRequestId = string & {
10
- readonly [requestIdBrand]: true;
11
- };
12
- /** The principal `<owner>.<actor>`. Throws on a token that is not a single NATS-safe token. */
13
- export declare function principalId(owner: string, actor: string): PrincipalId;
14
- export declare const PERMISSION_RECORD_VERSION = 1;
15
- /** The largest serialized record, the bucket's per-message limit. A larger input is withheld. */
16
- export declare const PERMISSION_RECORD_MAX_BYTES = 262144;
17
- /** How long a record is kept: the bucket's max age. */
18
- export declare const PERMISSION_RETENTION_MS: number;
19
- /** The longest note a denial carries. */
20
- export declare const PERMISSION_NOTE_MAX_CHARS = 2000;
21
- /** How long a holder waits for its harness to confirm a verdict before it records the answer as
22
- * undelivered and replies `answered`. */
23
- export declare const PERMISSION_HANDOFF_BOUND_MS = 10000;
24
- /** How long an answerer waits for the holder's reply. It outlasts {@link PERMISSION_HANDOFF_BOUND_MS},
25
- * plus a write and the round trip, so an undelivered verdict reaches the answerer as `answered`. */
26
- export declare const PERMISSION_ANSWER_TIMEOUT_MS: number;
27
- /** The process holding the prompt: the `lifecycleUid` and `runtime.id` its presence row carries. The
28
- * runtime id is one subject token, because an answer is addressed to it. */
29
- export interface PermissionHolder {
30
- readonly lifecycleUid: string;
31
- readonly runtimeId: string;
32
- }
33
- /** The tool input as the harness passed it, or only its size when it is too large to store. */
34
- export type PermissionInput = {
35
- readonly kind: "shown";
36
- readonly value: JsonValue;
37
- } | {
38
- readonly kind: "withheld";
39
- readonly bytes: number;
40
- };
41
- /** A stored state. `gone` is not one: {@link holderLiveness} derives it. */
42
- export type PermissionState = {
43
- readonly kind: "pending";
44
- } | {
45
- readonly kind: "approved";
46
- readonly by: PrincipalId;
47
- readonly at: number;
48
- } | {
49
- readonly kind: "denied";
50
- readonly by: PrincipalId;
51
- readonly at: number;
52
- readonly note?: string;
53
- } | {
54
- readonly kind: "answered-on-machine";
55
- readonly at: number;
56
- readonly outcome: "allowed" | "withdrawn";
57
- } | {
58
- readonly kind: "expired";
59
- readonly at: number;
60
- };
61
- /** One prompt. `agent` and `id` are the key it is stored under, and only `agent` writes it. The top
62
- * level never carries `from`, `parts` or `space`, so stored bytes never read as a message. */
63
- export interface PermissionRecord {
64
- readonly v: typeof PERMISSION_RECORD_VERSION;
65
- readonly id: PermissionRequestId;
66
- readonly agent: PrincipalId;
67
- readonly holder: PermissionHolder;
68
- readonly tool: string;
69
- readonly input: PermissionInput;
70
- readonly cwd?: string;
71
- readonly askedAt: number;
72
- /** Epoch ms. Absent means the prompt never expires. */
73
- readonly deadline?: number;
74
- readonly state: PermissionState;
75
- }
76
- /** An answer to a prompt. Only a denial carries a note, which the model reads as the reason. */
77
- export type PermissionAnswer = {
78
- readonly decision: "approve";
79
- } | {
80
- readonly decision: "deny";
81
- readonly note?: string;
82
- };
83
- /**
84
- * What the holder observes about one prompt.
85
- * - `answer`: from the answer rail. `by` is the request subject's sender, which the broker
86
- * forge-locks, never a payload claim.
87
- * - `tool-ran`: the harness ran the tool while the hook was still held.
88
- * - `withdrawn`: the harness killed the hook (a native No or an interrupt).
89
- * - `deadline`: the record's deadline passed.
90
- * - `undelivered`: a decided verdict never reached the hook, so the harness answered first.
91
- */
92
- export type PermissionEvent = ({
93
- readonly kind: "answer";
94
- readonly by: PrincipalId;
95
- readonly at: number;
96
- } & PermissionAnswer) | {
97
- readonly kind: "tool-ran";
98
- readonly at: number;
99
- } | {
100
- readonly kind: "withdrawn";
101
- readonly at: number;
102
- } | {
103
- readonly kind: "deadline";
104
- readonly at: number;
105
- } | {
106
- readonly kind: "undelivered";
107
- readonly at: number;
108
- };
109
- export type PermissionRefusal = "answered" | "expired";
110
- /** `repeat` is the same answerer sending the same answer again: report it accepted, write nothing. */
111
- export type PermissionStep = {
112
- readonly kind: "move";
113
- readonly next: PermissionState;
114
- } | {
115
- readonly kind: "repeat";
116
- } | {
117
- readonly kind: "ignore";
118
- } | {
119
- readonly kind: "refuse";
120
- readonly code: PermissionRefusal;
121
- };
122
- /** The whole state machine: one pure cell per state and event. Only the holder runs it. */
123
- export declare function stepPermission(state: PermissionState, event: PermissionEvent): PermissionStep;
124
- /** The KV key of one record: `<owner>.<actor>.<id>`. */
125
- export declare function permissionKey(agent: PrincipalId, id: PermissionRequestId): string;
126
- /**
127
- * Parse one stored value read under `key`, or `undefined` for anything that is not a version 1
128
- * record whose `agent` and `id` are that key. The schema is closed at every level and nothing is
129
- * coerced, so a stored value that also carries a message envelope is refused.
130
- */
131
- export declare function parsePermissionRecord(value: unknown, key: string): PermissionRecord | undefined;
132
- export type PermissionHolderLiveness = "live" | "gone" | "unknown";
133
- /** A reader's view of the asking agent's presence row. `online` is the reader's own verdict: a fresh
134
- * heartbeat and a status other than offline. `runtimeId` is absent when the row reports no runtime. */
135
- export interface HolderObservation {
136
- readonly online: boolean;
137
- readonly lifecycleUid?: string;
138
- readonly runtimeId?: string;
139
- }
140
- /** The one `gone` rule, for every reader. A restarted connector publishes a new runtime id, so the
141
- * records its predecessor held read `gone` with nothing left to sweep them. */
142
- export declare function holderLiveness(holder: PermissionHolder, seen: HolderObservation | undefined | "unavailable"): PermissionHolderLiveness;
143
- /** A fresh prompt id: 128 random bits as 26 lowercase base32 characters. */
144
- export declare function mintPermissionRequestId(): PermissionRequestId;
145
- /** The input a new record stores: `shown` while the whole record still fits the bucket with room for
146
- * any later state, else `withheld` with the input's UTF-8 size. A withheld input is never approved
147
- * remotely, because its owner cannot read what they would approve. */
148
- export declare function permissionInput(record: Omit<PermissionRecord, "input">, value: JsonValue): PermissionInput;
149
- /** An answer as the answer rail carries it. */
150
- export interface PermissionAnswerBody {
151
- readonly v: 1;
152
- readonly id: PermissionRequestId;
153
- readonly decision: PermissionAnswer["decision"];
154
- readonly note?: string;
155
- }
156
- /** The answer a request body asks for, or `undefined` for any body outside the closed schema: a note
157
- * only beside a denial, and never past {@link PERMISSION_NOTE_MAX_CHARS}. */
158
- export declare function parsePermissionAnswerBody(raw: unknown): {
159
- readonly id: PermissionRequestId;
160
- readonly answer: PermissionAnswer;
161
- } | undefined;
162
- /**
163
- * The holder's reply. It names the state, never the record, so the input is not echoed. A holder that
164
- * does not hold the prompt sends no reply at all.
165
- * - `answered`, `expired`: the prompt was already settled; `state` says how.
166
- * - `unknown`: the holder closed while it applied the answer, and gave the prompt back to the harness.
167
- * - `busy`: the record write did not land and nothing changed; asking again is safe.
168
- * - `conflict`: something else wrote the record, so the holder gave the prompt back to the terminal.
169
- * - `withheld`: an approval of an input too large to store, which its owner could not read.
170
- * - `bad-request`: the body is outside the closed schema.
171
- */
172
- export type PermissionAnswerReply = {
173
- readonly v: 1;
174
- readonly ok: true;
175
- readonly state: PermissionState;
176
- } | {
177
- readonly v: 1;
178
- readonly ok: false;
179
- readonly code: PermissionRefusal;
180
- readonly state: PermissionState;
181
- } | {
182
- readonly v: 1;
183
- readonly ok: false;
184
- readonly code: "unknown" | "busy" | "conflict" | "withheld" | "bad-request";
185
- };
186
- /** The holder's reply, or `undefined` for anything outside {@link PermissionAnswerReply}. */
187
- export declare function parsePermissionAnswerReply(raw: unknown): PermissionAnswerReply | undefined;
188
- /** What an answer achieved, as its sender reads it.
189
- * - `accepted`: the holder applied it and the harness received the verdict.
190
- * - `answered`: someone or something settled the prompt first; `state` names how.
191
- * - `gone`: nothing can apply an answer to this prompt now: no process holds it, its holder closed,
192
- * or something else wrote its record.
193
- * - `refused`: the broker refused the request, because the sender is not an interactive principal
194
- * of the agent's owner, or the holder refused to approve an input it withheld.
195
- * - `unknown`: the effect is unknown. Read the record before asking again; the same answer from the
196
- * same sender repeats safely. */
197
- export type PermissionAnswerOutcome = {
198
- readonly kind: "accepted";
199
- readonly state: PermissionState;
200
- } | {
201
- readonly kind: "answered";
202
- readonly state: PermissionState;
203
- } | {
204
- readonly kind: "gone";
205
- } | {
206
- readonly kind: "refused";
207
- readonly reason: "not-permitted" | "input-withheld";
208
- } | {
209
- readonly kind: "unknown";
210
- readonly reason: "timeout" | "transport" | "malformed" | "busy";
211
- };
212
- /** The outcome a holder's reply means for the sender. */
213
- export declare function permissionAnswerOutcome(reply: PermissionAnswerReply): PermissionAnswerOutcome;
214
- /** One answer as the holder receives it. `by` is the request subject's sender, which the broker
215
- * forge-locks; the body never claims it. */
216
- export interface IncomingPermissionAnswer {
217
- readonly id: PermissionRequestId;
218
- readonly by: PrincipalId;
219
- readonly answer: PermissionAnswer;
220
- }
221
- /** How one write of a record ended. `conflict`: the key's last revision was not the one expected.
222
- * `unavailable`: nothing is known to have landed, and the same write may be retried. `refused`: the
223
- * broker will not take it (no store, no grant, or too large), so retrying cannot help. */
224
- export type PermissionWrite = {
225
- readonly kind: "written";
226
- readonly revision: number;
227
- } | {
228
- readonly kind: "conflict";
229
- } | {
230
- readonly kind: "unavailable";
231
- } | {
232
- readonly kind: "refused";
233
- readonly reason: string;
234
- };
235
- /** The holder's side of the answer rail. */
236
- export interface PermissionHolderPort {
237
- /** The agent whose prompts these are. */
238
- readonly agent: PrincipalId;
239
- /** This process, as the records it writes name it. */
240
- readonly holder: PermissionHolder;
241
- /**
242
- * Write one of this agent's records by compare-and-set: `expected` is the revision this holder
243
- * last wrote, or `"absent"` for a create. `step` numbers the write within the record and makes its
244
- * `Nats-Msg-Id` `<id>.<step>`. After an `unavailable` write, ask again with `"retry"`: the broker
245
- * then returns the revision of a step that already landed. A retry is not compare-and-set, and
246
- * the only other writer of these keys is the agent's own credential.
247
- */
248
- write(record: PermissionRecord, step: number, expected: number | "absent" | "retry"): Promise<PermissionWrite>;
249
- /** Stop serving answers. The records stay as they are. */
250
- close(): void;
251
- }
252
- /** What an answer is addressed to: the prompt, and the process its record names as holder. */
253
- export type PermissionTarget = Pick<PermissionRecord, "agent" | "id" | "holder">;
254
- /** One interactive lifecycle's permission reader (SPEC §8.2). The watch fills it from its own
255
- * endpoint's identity, so a host cannot open one principal's reader for another's watch. */
256
- export interface PermissionReaderRef {
257
- readonly owner: string;
258
- readonly actor: string;
259
- readonly lifecycleUid: string;
260
- }
261
- /** The trusted side's open: delete whatever consumer holds the reader's name, then create it fresh.
262
- * `CotalEndpoint.openPermissionReader` on a provisioner endpoint does this. The watch calls it
263
- * before every bind. */
264
- export type PermissionReaderOpener = (reader: PermissionReaderRef) => Promise<void>;
265
- /** Why a watch stopped. `refused`: the broker refused the bind, so this principal is not an
266
- * interactive row of that lifecycle. `open-failed`: the opener threw. `contended`: the reader went
267
- * busy or missing again before a fresh pass completed, as when two watchers share one lifecycle. */
268
- export type PermissionWatchFailure = {
269
- readonly kind: "stopped";
270
- } | {
271
- readonly kind: "refused";
272
- readonly reason: string;
273
- } | {
274
- readonly kind: "open-failed";
275
- readonly reason: string;
276
- } | {
277
- readonly kind: "contended";
278
- };
279
- /** One running watch of an owner's permission records. It owns the view. */
280
- export interface PermissionWatch {
281
- /** Settles once the first full pass is in. A watch that fails first leaves it pending. */
282
- readonly ready: Promise<void>;
283
- /** Every record of the owner's agents, oldest `askedAt` first: the last complete pass and every
284
- * change since. A fresh pass never shows half a view. */
285
- records(): readonly PermissionRecord[];
286
- /** Settles when the watch stops, with why. */
287
- readonly failed: Promise<PermissionWatchFailure>;
288
- stop(): Promise<void>;
289
- }
290
- export {};
291
- //# sourceMappingURL=permissions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAA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C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;yBAEyB;AACzB,MAAM,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpF;;qGAEqG;AACrG,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B;8DAC0D;IAC1D,OAAO,IAAI,SAAS,gBAAgB,EAAE,CAAC;IACvC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
@@ -1,258 +0,0 @@
1
- /**
2
- * Harness permission prompts, relayed to the agent's owner.
3
- *
4
- * The connector that holds a harness's permission hook writes one record per prompt under
5
- * `<owner>.<actor>.<id>` and is that record's only writer. Its owner's interactive principals read the
6
- * records and answer; the holder applies each event through {@link stepPermission}. `gone` is never
7
- * stored, because nothing is left to write it when an agent dies: every reader derives it from
8
- * presence with {@link holderLiveness}.
9
- *
10
- * Browser-safe, so a dashboard parses records with the code stock readers use.
11
- */
12
- import { assertLifecycleToken, assertRuntimeToken, parsePrincipalKey, principalKey } from "./subjects.js";
13
- const principalIdBrand = Symbol("PrincipalId");
14
- const requestIdBrand = Symbol("PermissionRequestId");
15
- /** The principal `<owner>.<actor>`. Throws on a token that is not a single NATS-safe token. */
16
- export function principalId(owner, actor) {
17
- return principalKey(owner, actor).key;
18
- }
19
- export const PERMISSION_RECORD_VERSION = 1;
20
- /** The largest serialized record, the bucket's per-message limit. A larger input is withheld. */
21
- export const PERMISSION_RECORD_MAX_BYTES = 262_144;
22
- /** How long a record is kept: the bucket's max age. */
23
- export const PERMISSION_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
24
- /** The longest note a denial carries. */
25
- export const PERMISSION_NOTE_MAX_CHARS = 2_000;
26
- /** How long a holder waits for its harness to confirm a verdict before it records the answer as
27
- * undelivered and replies `answered`. */
28
- export const PERMISSION_HANDOFF_BOUND_MS = 10_000;
29
- /** How long an answerer waits for the holder's reply. It outlasts {@link PERMISSION_HANDOFF_BOUND_MS},
30
- * plus a write and the round trip, so an undelivered verdict reaches the answerer as `answered`. */
31
- export const PERMISSION_ANSWER_TIMEOUT_MS = PERMISSION_HANDOFF_BOUND_MS + 5_000;
32
- /** Room a record keeps below {@link PERMISSION_RECORD_MAX_BYTES} for the write's headers, which the
33
- * bucket's limit counts, and for the largest state an answer can store: a denial whose note is all
34
- * control characters serializes at six bytes a character. */
35
- const PERMISSION_RECORD_RESERVE_BYTES = 16 * 1024;
36
- const IGNORE = Object.freeze({ kind: "ignore" });
37
- const REPEAT = Object.freeze({ kind: "repeat" });
38
- const ignore = () => IGNORE;
39
- const refuse = (code) => ({ kind: "refuse", code });
40
- const move = (next) => ({ kind: "move", next });
41
- const withdrawnOnMachine = (_, event) => move({ kind: "answered-on-machine", at: event.at, outcome: "withdrawn" });
42
- const TABLE = {
43
- pending: {
44
- answer: (_, e) => move(e.decision === "approve"
45
- ? { kind: "approved", by: e.by, at: e.at }
46
- : { kind: "denied", by: e.by, at: e.at, ...(e.note === undefined ? {} : { note: e.note }) }),
47
- "tool-ran": (_, e) => move({ kind: "answered-on-machine", at: e.at, outcome: "allowed" }),
48
- withdrawn: withdrawnOnMachine,
49
- deadline: (_, e) => move({ kind: "expired", at: e.at }),
50
- undelivered: ignore,
51
- },
52
- approved: {
53
- answer: (s, e) => (e.decision === "approve" && e.by === s.by ? REPEAT : refuse("answered")),
54
- "tool-ran": ignore, withdrawn: ignore, deadline: ignore,
55
- undelivered: withdrawnOnMachine,
56
- },
57
- denied: {
58
- answer: (s, e) => (e.decision === "deny" && e.by === s.by && e.note === s.note ? REPEAT : refuse("answered")),
59
- "tool-ran": ignore, withdrawn: ignore, deadline: ignore,
60
- undelivered: withdrawnOnMachine,
61
- },
62
- "answered-on-machine": { answer: () => refuse("answered"), "tool-ran": ignore, withdrawn: ignore, deadline: ignore, undelivered: ignore },
63
- expired: { answer: () => refuse("expired"), "tool-ran": ignore, withdrawn: ignore, deadline: ignore, undelivered: ignore },
64
- };
65
- /** The whole state machine: one pure cell per state and event. Only the holder runs it. */
66
- export function stepPermission(state, event) {
67
- const cell = TABLE[state.kind][event.kind];
68
- return cell(state, event);
69
- }
70
- /** The KV key of one record: `<owner>.<actor>.<id>`. */
71
- export function permissionKey(agent, id) {
72
- return `${agent}.${id}`;
73
- }
74
- /** `value` as an object with every `required` key and no key outside `required` and `optional`. */
75
- function closed(value, required, optional = []) {
76
- if (value === null || typeof value !== "object" || Array.isArray(value))
77
- return undefined;
78
- const keys = Object.keys(value);
79
- if (!required.every((k) => keys.includes(k)) || !keys.every((k) => required.includes(k) || optional.includes(k)))
80
- return undefined;
81
- return value;
82
- }
83
- const text = (v) => typeof v === "string" && v.length > 0;
84
- /** A non-negative safe integer: an epoch-ms time or a byte count. */
85
- const whole = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
86
- function principal(v) {
87
- return typeof v === "string" && parsePrincipalKey(v) !== null ? v : undefined;
88
- }
89
- function requestId(v) {
90
- return typeof v === "string" && /^[a-z2-7]{26}$/.test(v) ? v : undefined;
91
- }
92
- // The typeof check comes first: a token check is a RegExp test, which would coerce a JSON array.
93
- function token(v, assert) {
94
- if (typeof v !== "string")
95
- return false;
96
- try {
97
- assert(v);
98
- return true;
99
- }
100
- catch {
101
- return false;
102
- }
103
- }
104
- function holder(v) {
105
- const h = closed(v, ["lifecycleUid", "runtimeId"]);
106
- return h && token(h.lifecycleUid, assertLifecycleToken) && token(h.runtimeId, assertRuntimeToken)
107
- ? { lifecycleUid: h.lifecycleUid, runtimeId: h.runtimeId } : undefined;
108
- }
109
- function input(v) {
110
- const shown = closed(v, ["kind", "value"]);
111
- if (shown?.kind === "shown")
112
- return { kind: "shown", value: shown.value };
113
- const withheld = closed(v, ["kind", "bytes"]);
114
- return withheld?.kind === "withheld" && whole(withheld.bytes) ? { kind: "withheld", bytes: withheld.bytes } : undefined;
115
- }
116
- function state(v) {
117
- switch (closed(v, ["kind"], ["by", "at", "note", "outcome"])?.kind) {
118
- case "pending":
119
- return closed(v, ["kind"]) ? { kind: "pending" } : undefined;
120
- case "approved": {
121
- const s = closed(v, ["kind", "by", "at"]), by = principal(s?.by);
122
- return s && by && whole(s.at) ? { kind: "approved", by, at: s.at } : undefined;
123
- }
124
- case "denied": {
125
- const s = closed(v, ["kind", "by", "at"], ["note"]), by = principal(s?.by);
126
- if (!s || !by || !whole(s.at))
127
- return undefined;
128
- if (!Object.hasOwn(s, "note"))
129
- return { kind: "denied", by, at: s.at };
130
- return typeof s.note === "string" ? { kind: "denied", by, at: s.at, note: s.note } : undefined;
131
- }
132
- case "answered-on-machine": {
133
- const s = closed(v, ["kind", "at", "outcome"]);
134
- return s && whole(s.at) && (s.outcome === "allowed" || s.outcome === "withdrawn")
135
- ? { kind: "answered-on-machine", at: s.at, outcome: s.outcome } : undefined;
136
- }
137
- case "expired": {
138
- const s = closed(v, ["kind", "at"]);
139
- return s && whole(s.at) ? { kind: "expired", at: s.at } : undefined;
140
- }
141
- default:
142
- return undefined;
143
- }
144
- }
145
- /**
146
- * Parse one stored value read under `key`, or `undefined` for anything that is not a version 1
147
- * record whose `agent` and `id` are that key. The schema is closed at every level and nothing is
148
- * coerced, so a stored value that also carries a message envelope is refused.
149
- */
150
- export function parsePermissionRecord(value, key) {
151
- const r = closed(value, ["v", "id", "agent", "holder", "tool", "input", "askedAt", "state"], ["cwd", "deadline"]);
152
- if (!r || r.v !== PERMISSION_RECORD_VERSION)
153
- return undefined;
154
- const id = requestId(r.id), agent = principal(r.agent);
155
- if (!id || !agent || key !== permissionKey(agent, id))
156
- return undefined;
157
- const h = holder(r.holder), i = input(r.input), s = state(r.state);
158
- if (!h || !i || !s || !text(r.tool) || !whole(r.askedAt))
159
- return undefined;
160
- const cwd = Object.hasOwn(r, "cwd") ? r.cwd : undefined, deadline = Object.hasOwn(r, "deadline") ? r.deadline : undefined;
161
- if ((Object.hasOwn(r, "cwd") && !text(cwd)) || (Object.hasOwn(r, "deadline") && !whole(deadline)))
162
- return undefined;
163
- return {
164
- v: PERMISSION_RECORD_VERSION, id, agent, holder: h, tool: r.tool, input: i,
165
- ...(text(cwd) ? { cwd } : {}),
166
- askedAt: r.askedAt,
167
- ...(whole(deadline) ? { deadline } : {}),
168
- state: s,
169
- };
170
- }
171
- /** The one `gone` rule, for every reader. A restarted connector publishes a new runtime id, so the
172
- * records its predecessor held read `gone` with nothing left to sweep them. */
173
- export function holderLiveness(holder, seen) {
174
- if (seen === "unavailable")
175
- return "unknown";
176
- if (seen === undefined || !seen.online || seen.lifecycleUid !== holder.lifecycleUid)
177
- return "gone";
178
- if (seen.runtimeId === undefined)
179
- return "unknown";
180
- return seen.runtimeId === holder.runtimeId ? "live" : "gone";
181
- }
182
- const BASE32 = "abcdefghijklmnopqrstuvwxyz234567";
183
- /** A fresh prompt id: 128 random bits as 26 lowercase base32 characters. */
184
- export function mintPermissionRequestId() {
185
- const bytes = crypto.getRandomValues(new Uint8Array(16));
186
- let bits = 0, value = 0, id = "";
187
- for (const byte of bytes) {
188
- value = (value << 8) | byte;
189
- bits += 8;
190
- while (bits >= 5)
191
- id += BASE32[(value >>> (bits -= 5)) & 31];
192
- }
193
- return (id + BASE32[(value << (5 - bits)) & 31]);
194
- }
195
- /** The input a new record stores: `shown` while the whole record still fits the bucket with room for
196
- * any later state, else `withheld` with the input's UTF-8 size. A withheld input is never approved
197
- * remotely, because its owner cannot read what they would approve. */
198
- export function permissionInput(record, value) {
199
- const shown = { kind: "shown", value };
200
- const size = new TextEncoder().encode(JSON.stringify({ ...record, input: shown })).length;
201
- return size <= PERMISSION_RECORD_MAX_BYTES - PERMISSION_RECORD_RESERVE_BYTES
202
- ? shown
203
- : { kind: "withheld", bytes: new TextEncoder().encode(JSON.stringify(value)).length };
204
- }
205
- /** The answer a request body asks for, or `undefined` for any body outside the closed schema: a note
206
- * only beside a denial, and never past {@link PERMISSION_NOTE_MAX_CHARS}. */
207
- export function parsePermissionAnswerBody(raw) {
208
- const b = closed(raw, ["v", "id", "decision"], ["note"]);
209
- const id = requestId(b?.id);
210
- if (!b || b.v !== 1 || !id)
211
- return undefined;
212
- if (b.decision === "approve")
213
- return Object.hasOwn(b, "note") ? undefined : { id, answer: { decision: "approve" } };
214
- if (b.decision !== "deny")
215
- return undefined;
216
- if (!Object.hasOwn(b, "note"))
217
- return { id, answer: { decision: "deny" } };
218
- return typeof b.note === "string" && b.note.length <= PERMISSION_NOTE_MAX_CHARS ? { id, answer: { decision: "deny", note: b.note } } : undefined;
219
- }
220
- const REPLY_CODES = ["unknown", "busy", "conflict", "withheld", "bad-request"];
221
- /** The holder's reply, or `undefined` for anything outside {@link PermissionAnswerReply}. */
222
- export function parsePermissionAnswerReply(raw) {
223
- const r = closed(raw, ["v", "ok"], ["state", "code"]);
224
- if (!r || r.v !== 1)
225
- return undefined;
226
- if (r.ok === true) {
227
- const s = closed(raw, ["v", "ok", "state"]) && state(r.state);
228
- return s ? { v: 1, ok: true, state: s } : undefined;
229
- }
230
- if (r.ok !== false)
231
- return undefined;
232
- if (r.code === "answered" || r.code === "expired") {
233
- const s = closed(raw, ["v", "ok", "code", "state"]) && state(r.state);
234
- return s ? { v: 1, ok: false, code: r.code, state: s } : undefined;
235
- }
236
- const code = REPLY_CODES.find((c) => c === r.code);
237
- return code && closed(raw, ["v", "ok", "code"]) ? { v: 1, ok: false, code } : undefined;
238
- }
239
- /** The outcome a holder's reply means for the sender. */
240
- export function permissionAnswerOutcome(reply) {
241
- if (reply.ok)
242
- return { kind: "accepted", state: reply.state };
243
- switch (reply.code) {
244
- case "answered":
245
- case "expired":
246
- return { kind: "answered", state: reply.state };
247
- case "unknown":
248
- case "conflict":
249
- return { kind: "gone" };
250
- case "withheld":
251
- return { kind: "refused", reason: "input-withheld" };
252
- case "busy":
253
- return { kind: "unknown", reason: "busy" };
254
- case "bad-request":
255
- return { kind: "unknown", reason: "malformed" };
256
- }
257
- }
258
- //# sourceMappingURL=permissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG1G,MAAM,gBAAgB,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAC9D,MAAM,cAAc,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAOpE,+FAA+F;AAC/F,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,KAAa;IACtD,OAAO,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAkB,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,iGAAiG;AACjG,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AACnD,uDAAuD;AACvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACh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