@cotal-ai/auth 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.
Files changed (120) hide show
  1. package/dist/authority-client.d.ts +70 -3
  2. package/dist/authority-client.d.ts.map +1 -1
  3. package/dist/authority-client.js +113 -9
  4. package/dist/authority-client.js.map +1 -1
  5. package/dist/chat-parent-pin.d.ts +43 -0
  6. package/dist/chat-parent-pin.d.ts.map +1 -0
  7. package/dist/chat-parent-pin.js +115 -0
  8. package/dist/chat-parent-pin.js.map +1 -0
  9. package/dist/chat-session-authority.d.ts +120 -0
  10. package/dist/chat-session-authority.d.ts.map +1 -0
  11. package/dist/chat-session-authority.js +924 -0
  12. package/dist/chat-session-authority.js.map +1 -0
  13. package/dist/chat-session-row.d.ts +117 -0
  14. package/dist/chat-session-row.d.ts.map +1 -0
  15. package/dist/chat-session-row.js +358 -0
  16. package/dist/chat-session-row.js.map +1 -0
  17. package/dist/chat-session-store.d.ts +126 -0
  18. package/dist/chat-session-store.d.ts.map +1 -0
  19. package/dist/chat-session-store.js +392 -0
  20. package/dist/chat-session-store.js.map +1 -0
  21. package/dist/commands.d.ts +3 -1
  22. package/dist/commands.d.ts.map +1 -1
  23. package/dist/commands.js +527 -125
  24. package/dist/commands.js.map +1 -1
  25. package/dist/continuity.js +1 -1
  26. package/dist/continuity.js.map +1 -1
  27. package/dist/daemon-flags.d.ts +42 -0
  28. package/dist/daemon-flags.d.ts.map +1 -0
  29. package/dist/daemon-flags.js +12 -0
  30. package/dist/daemon-flags.js.map +1 -0
  31. package/dist/handle-inspect.d.ts +101 -0
  32. package/dist/handle-inspect.d.ts.map +1 -0
  33. package/dist/handle-inspect.js +50 -0
  34. package/dist/handle-inspect.js.map +1 -0
  35. package/dist/handle-verification.d.ts +75 -0
  36. package/dist/handle-verification.d.ts.map +1 -0
  37. package/dist/handle-verification.js +135 -0
  38. package/dist/handle-verification.js.map +1 -0
  39. package/dist/idp.d.ts +23 -1
  40. package/dist/idp.d.ts.map +1 -1
  41. package/dist/idp.js +54 -8
  42. package/dist/idp.js.map +1 -1
  43. package/dist/index.d.ts +3 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +3 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/ledger.d.ts +58 -5
  48. package/dist/ledger.d.ts.map +1 -1
  49. package/dist/ledger.js +126 -6
  50. package/dist/ledger.js.map +1 -1
  51. package/dist/lifecycle-registry.d.ts +1 -70
  52. package/dist/lifecycle-registry.d.ts.map +1 -1
  53. package/dist/lifecycle-registry.js +4 -35
  54. package/dist/lifecycle-registry.js.map +1 -1
  55. package/dist/login.d.ts +9 -0
  56. package/dist/login.d.ts.map +1 -1
  57. package/dist/login.js +53 -8
  58. package/dist/login.js.map +1 -1
  59. package/dist/manager-authority.d.ts +59 -3
  60. package/dist/manager-authority.d.ts.map +1 -1
  61. package/dist/manager-authority.js +185 -4
  62. package/dist/manager-authority.js.map +1 -1
  63. package/dist/native-service-gate.d.ts +14 -3
  64. package/dist/native-service-gate.d.ts.map +1 -1
  65. package/dist/native-service-gate.js +34 -20
  66. package/dist/native-service-gate.js.map +1 -1
  67. package/dist/native-service-name.d.ts +7 -0
  68. package/dist/native-service-name.d.ts.map +1 -1
  69. package/dist/native-service-name.js +15 -6
  70. package/dist/native-service-name.js.map +1 -1
  71. package/dist/permissions.js +4 -0
  72. package/dist/permissions.js.map +1 -1
  73. package/dist/platform-control.d.ts.map +1 -1
  74. package/dist/platform-control.js +1 -0
  75. package/dist/platform-control.js.map +1 -1
  76. package/dist/provider.d.ts +23 -0
  77. package/dist/provider.d.ts.map +1 -1
  78. package/dist/provider.js +252 -44
  79. package/dist/provider.js.map +1 -1
  80. package/dist/run-cancel-observation.d.ts +50 -0
  81. package/dist/run-cancel-observation.d.ts.map +1 -0
  82. package/dist/run-cancel-observation.js +146 -0
  83. package/dist/run-cancel-observation.js.map +1 -0
  84. package/dist/service-adapter.d.ts +6 -0
  85. package/dist/service-adapter.d.ts.map +1 -0
  86. package/dist/service-adapter.js +120 -0
  87. package/dist/service-adapter.js.map +1 -0
  88. package/dist/service-custody.d.ts +29 -20
  89. package/dist/service-custody.d.ts.map +1 -1
  90. package/dist/service-custody.js +37 -167
  91. package/dist/service-custody.js.map +1 -1
  92. package/dist/service-endpoint-authority.d.ts +70 -0
  93. package/dist/service-endpoint-authority.d.ts.map +1 -0
  94. package/dist/service-endpoint-authority.js +257 -0
  95. package/dist/service-endpoint-authority.js.map +1 -0
  96. package/dist/service-host-contract.d.ts +158 -16
  97. package/dist/service-host-contract.d.ts.map +1 -1
  98. package/dist/service-host-contract.js +330 -1
  99. package/dist/service-host-contract.js.map +1 -1
  100. package/dist/service-host-ops.d.ts +550 -0
  101. package/dist/service-host-ops.d.ts.map +1 -0
  102. package/dist/service-host-ops.js +2180 -0
  103. package/dist/service-host-ops.js.map +1 -0
  104. package/dist/service-write.d.ts +141 -0
  105. package/dist/service-write.d.ts.map +1 -0
  106. package/dist/service-write.js +179 -0
  107. package/dist/service-write.js.map +1 -0
  108. package/dist/service.d.ts +115 -3
  109. package/dist/service.d.ts.map +1 -1
  110. package/dist/service.js +697 -92
  111. package/dist/service.js.map +1 -1
  112. package/dist/store.d.ts +10 -0
  113. package/dist/store.d.ts.map +1 -1
  114. package/dist/store.js +25 -8
  115. package/dist/store.js.map +1 -1
  116. package/dist/token.d.ts +1 -1
  117. package/dist/token.d.ts.map +1 -1
  118. package/dist/token.js +4 -1
  119. package/dist/token.js.map +1 -1
  120. package/package.json +16 -7
@@ -0,0 +1,50 @@
1
+ export interface RunCancelObservation {
2
+ readonly subject: string;
3
+ readonly id: string;
4
+ readonly runId: string;
5
+ readonly reason: string;
6
+ readonly class: string;
7
+ readonly inputDigest: string;
8
+ readonly outputDigest: string;
9
+ readonly instanceId: string;
10
+ readonly processEpoch: number;
11
+ readonly requestEndsAt: number;
12
+ }
13
+ export interface RunCancelLimits {
14
+ caller: number;
15
+ owner: number;
16
+ total: number;
17
+ }
18
+ export interface RunCancelClaim {
19
+ readonly observation: RunCancelObservation;
20
+ /** Validate custody without making a dispatch claim, including when a marker already exists. */
21
+ assertCurrent(): void;
22
+ /** Last synchronous guard, invoked at the actual marker writer's dispatch boundary. */
23
+ dispatch(): void;
24
+ /** Consume a claim that refused or completed. A conflicting redelivery stays poisoned. */
25
+ finish(): void;
26
+ }
27
+ /** Process-lifetime observation custody, not cross-restart deduplication. Tombstones count against
28
+ * finite caller/owner/global quotas and are never evicted or made available again. */
29
+ export declare class RunCancelObservations {
30
+ private readonly space;
31
+ private readonly now;
32
+ private readonly entries;
33
+ private readonly callers;
34
+ private readonly owners;
35
+ private readonly limits;
36
+ private readonly warnedBudgets;
37
+ constructor(space: string, limits?: RunCancelLimits, now?: () => number);
38
+ private coordinates;
39
+ /** Decode the same JSON/string shape as the serving seam. Invalid input grants no observation. */
40
+ observe(subject: string, data: Uint8Array): void;
41
+ private full;
42
+ private expire;
43
+ refusal(subject: string): {
44
+ kind: "refused-before-dispatch" | "outcome-unknown";
45
+ code: "permission-denied" | "resource-exhausted" | "failed-precondition" | "deadline-exceeded";
46
+ };
47
+ inspect(subject: string): RunCancelObservation;
48
+ claim(subject: string): RunCancelClaim;
49
+ }
50
+ //# sourceMappingURL=run-cancel-observation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-cancel-observation.d.ts","sourceRoot":"","sources":["../src/run-cancel-observation.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAA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AC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAQ9C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc;CA+BvC"}
@@ -0,0 +1,146 @@
1
+ import { createHash } from "node:crypto";
2
+ import { EpEnvelopeError, canonicalJson, parseEpSubject, parseEndpointRequest, checkRequestSubjectAgreement, isIssuedCaller, readRunCancelInput, RUN_CANCEL_MAX_DEADLINE_MS, } from "@cotal-ai/core";
3
+ /** Process-lifetime observation custody, not cross-restart deduplication. Tombstones count against
4
+ * finite caller/owner/global quotas and are never evicted or made available again. */
5
+ export class RunCancelObservations {
6
+ space;
7
+ now;
8
+ entries = new Map();
9
+ callers = new Map();
10
+ owners = new Map();
11
+ limits;
12
+ warnedBudgets = new Set();
13
+ constructor(space, limits = { caller: 64, owner: 256, total: 10_000 }, now = () => performance.now()) {
14
+ this.space = space;
15
+ this.now = now;
16
+ if (![limits.caller, limits.owner, limits.total].every(n => Number.isSafeInteger(n) && n > 0)
17
+ || limits.caller > limits.owner || limits.owner >= limits.total)
18
+ throw new Error("run-cancel custody limits require 0 < caller <= owner < total");
19
+ this.limits = Object.freeze({ ...limits });
20
+ }
21
+ coordinates(subject) {
22
+ const parsed = parseEpSubject(subject);
23
+ if (!subject.startsWith(`cotal.${this.space}.`) || !parsed || parsed.plane !== "request" || parsed.rail !== "v1"
24
+ || parsed.route !== "inst" || parsed.endpoint !== "manager" || parsed.command !== "run-cancel"
25
+ || parsed.target !== null || !isIssuedCaller(parsed.caller))
26
+ return undefined;
27
+ return { caller: canonicalJson([parsed.caller.owner, parsed.caller.actor, parsed.caller.uid]), owner: parsed.caller.owner, instanceId: parsed.instanceId };
28
+ }
29
+ /** Decode the same JSON/string shape as the serving seam. Invalid input grants no observation. */
30
+ observe(subject, data) {
31
+ const coordinates = this.coordinates(subject);
32
+ if (!coordinates)
33
+ return;
34
+ let observation;
35
+ let fingerprint;
36
+ try {
37
+ const parsed = parseEpSubject(subject);
38
+ if (parsed.plane !== "request")
39
+ return;
40
+ const envelope = parseEndpointRequest(JSON.parse(new TextDecoder().decode(data)));
41
+ checkRequestSubjectAgreement(envelope, parsed);
42
+ const input = readRunCancelInput(envelope.args);
43
+ if (!Number.isSafeInteger(envelope.deadlineMs) || envelope.deadlineMs <= 0 || envelope.deadlineMs > RUN_CANCEL_MAX_DEADLINE_MS
44
+ || !envelope.bind || envelope.bind.instanceId !== coordinates.instanceId
45
+ || envelope.class !== "ephemeral" || typeof envelope.op.inputDigest !== "string" || typeof envelope.op.outputDigest !== "string")
46
+ return;
47
+ fingerprint = createHash("sha256").update(canonicalJson({ id: envelope.id, args: input, class: envelope.class,
48
+ op: envelope.op, bind: envelope.bind, deadlineMs: envelope.deadlineMs })).digest("hex");
49
+ observation = Object.freeze({ subject, id: envelope.id, ...input, class: envelope.class,
50
+ inputDigest: envelope.op.inputDigest, outputDigest: envelope.op.outputDigest,
51
+ instanceId: envelope.bind.instanceId, processEpoch: envelope.bind.epoch,
52
+ requestEndsAt: this.now() + envelope.deadlineMs });
53
+ }
54
+ catch {
55
+ return;
56
+ }
57
+ const prior = this.entries.get(subject);
58
+ if (prior) {
59
+ if (prior.fingerprint !== fingerprint) {
60
+ prior.state = "conflicted";
61
+ delete prior.observation;
62
+ }
63
+ else
64
+ this.expire(prior);
65
+ return;
66
+ }
67
+ const budget = this.full(coordinates);
68
+ if (budget) {
69
+ if (!this.warnedBudgets.has(budget)) {
70
+ this.warnedBudgets.add(budget);
71
+ console.warn(`run-cancel custody: ${budget} lifetime budget exhausted; new observations refused`);
72
+ }
73
+ return;
74
+ }
75
+ this.entries.set(subject, { fingerprint, requestEndsAt: observation.requestEndsAt, state: "available", observation, mayHaveDispatched: false });
76
+ this.callers.set(coordinates.caller, (this.callers.get(coordinates.caller) ?? 0) + 1);
77
+ this.owners.set(coordinates.owner, (this.owners.get(coordinates.owner) ?? 0) + 1);
78
+ }
79
+ full(coordinates) {
80
+ if (this.entries.size >= this.limits.total)
81
+ return "total";
82
+ if ((this.callers.get(coordinates.caller) ?? 0) >= this.limits.caller)
83
+ return "caller";
84
+ if ((this.owners.get(coordinates.owner) ?? 0) >= this.limits.owner)
85
+ return "owner";
86
+ return undefined;
87
+ }
88
+ expire(entry) {
89
+ if (entry.state === "available" && this.now() >= entry.requestEndsAt) {
90
+ entry.state = "expired";
91
+ delete entry.observation;
92
+ }
93
+ }
94
+ refusal(subject) {
95
+ const entry = this.entries.get(subject);
96
+ if (entry) {
97
+ this.expire(entry);
98
+ return { kind: entry.mayHaveDispatched || entry.state === "claimed" || entry.claim !== undefined ? "outcome-unknown" : "refused-before-dispatch",
99
+ code: entry.state === "expired" ? "deadline-exceeded" : "failed-precondition" };
100
+ }
101
+ const coordinates = this.coordinates(subject);
102
+ return { kind: "refused-before-dispatch", code: coordinates && this.full(coordinates) ? "resource-exhausted" : "permission-denied" };
103
+ }
104
+ inspect(subject) {
105
+ const entry = this.entries.get(subject);
106
+ if (entry)
107
+ this.expire(entry);
108
+ if (!entry || entry.state !== "available" || !entry.observation)
109
+ throw new EpEnvelopeError(this.refusal(subject).code, "run-cancel observation is not available");
110
+ return entry.observation;
111
+ }
112
+ claim(subject) {
113
+ const observation = this.inspect(subject);
114
+ const entry = this.entries.get(subject);
115
+ const token = Symbol();
116
+ entry.state = "claimed";
117
+ entry.claim = token;
118
+ const assertCurrent = () => {
119
+ if (entry.state !== "claimed" || entry.claim !== token)
120
+ throw new EpEnvelopeError("failed-precondition", "run-cancel observation was consumed or conflicted");
121
+ if (this.now() >= entry.requestEndsAt) {
122
+ entry.state = "expired";
123
+ throw new EpEnvelopeError("deadline-exceeded", "run-cancel original observation deadline expired");
124
+ }
125
+ };
126
+ return {
127
+ observation,
128
+ assertCurrent,
129
+ dispatch: () => {
130
+ assertCurrent();
131
+ entry.state = "consumed";
132
+ entry.mayHaveDispatched = true;
133
+ delete entry.observation;
134
+ },
135
+ finish: () => {
136
+ if (entry.claim !== token)
137
+ return;
138
+ delete entry.claim;
139
+ if (entry.state === "claimed")
140
+ entry.state = "consumed";
141
+ delete entry.observation;
142
+ },
143
+ };
144
+ }
145
+ }
146
+ //# sourceMappingURL=run-cancel-observation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-cancel-observation.js","sourceRoot":"","sources":["../src/run-cancel-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,4BAA4B,EAClG,cAAc,EAAE,kBAAkB,EAAE,0BAA0B,GAC/D,MAAM,gBAAgB,CAAC;AAkCxB;uFACuF;AACvF,MAAM,OAAO,qBAAqB;IAOH;IAAqG;IANjH,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnC,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IACpC,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnC,MAAM,CAA4B;IAClC,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IAElE,YAA6B,KAAa,EAAE,SAA0B,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAmB,MAAM,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAAlI,UAAK,GAAL,KAAK,CAAQ;QAAwF,QAAG,GAAH,GAAG,CAA0B;QAC7J,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;eACxF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK;YAC/D,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,G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AAmD,CAAC,CAAC;YACxG,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;gBACtC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;gBACxB,MAAM,IAAI,eAAe,CAAC,mBAAmB,EAAE,kDAAkD,CAAC,CAAC;YACrG,CAAC;QACH,CAAC,CAAC;QACF,OAAO;YACL,WAAW;YACX,aAAa;YACb,QAAQ,EAAE,GAAG,EAAE;gBACb,aAAa,EAAE,CAAC;gBAChB,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;gBACzB,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAC/B,OAAO,KAAK,CAAC,WAAW,CAAC;YAC3B,CAAC;YACD,MAAM,EAAE,GAAG,EAAE;gBACX,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK;oBAAE,OAAO;gBAClC,OAAO,KAAK,CAAC,KAAK,CAAC;gBACnB,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;oBAAE,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;gBACxD,OAAO,KAAK,CAAC,WAAW,CAAC;YAC3B,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { type Command } from "@cotal-ai/core";
2
+ import { type LocalProcess, type ServicePreset } from "@cotal-ai/workspace";
3
+ export declare const authServicePreset: ServicePreset;
4
+ export declare const authServiceProcess: LocalProcess;
5
+ export declare const nativeAuthServiceCommand: Command;
6
+ //# sourceMappingURL=service-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-adapter.d.ts","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,OAAO,EAAmB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAIuB,KAAK,YAAY,EAAE,KAAK,aAAa,EAClE,MAAM,qBAAqB,CAAC;AAmC7B,eAAO,MAAM,iBAAiB,EAAE,aAG/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,YAyBhC,CAAC;AAQF,eAAO,MAAM,wBAAwB,EAAE,OAsBtC,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { isAbsolute, join } from "node:path";
2
+ import { registry } from "@cotal-ai/core";
3
+ import { AUTH_PIDFILE, CommandFailure, claimServicePid, colorEnabled, hasUserAuthState, localProcessPath, observeServiceStartup, protectedLocalDirectory, publishServiceStartup, readPidfile, resolveNativeServiceTarget, serviceOperationId, serviceStartupPath, validateServiceStartupPath, } from "@cotal-ai/workspace";
4
+ import { authServiceFlags } from "./daemon-flags.js";
5
+ import { authServiceConfiguration, runAuthService } from "./service.js";
6
+ const daemonOptions = authServiceFlags.filter((flag) => flag.name !== "space");
7
+ const portOptions = new Set(["port", "exchange-public-port"]);
8
+ function targetFor(root, space, server) {
9
+ const target = resolveNativeServiceTarget(root, space, server);
10
+ if (target.mode !== "user" || !hasUserAuthState(target.root, space, { readOnly: true }))
11
+ throw new CommandFailure("refused", "UNSUPPORTED", "the auth-service preset requires this root's prepared hosting user-auth state; no issuer or account was generated");
12
+ const url = new URL(target.server.includes("://") ? target.server : `nats://${target.server}`);
13
+ if (target.tlsRequired || url.protocol !== "nats:" || !["127.0.0.1", "[::1]", "::1", "localhost"].includes(url.hostname))
14
+ throw new CommandFailure("refused", "UNSUPPORTED", "this native auth-service transport currently supports only its registered plain loopback broker; a TLS requirement or remote broker was not weakened");
15
+ protectedLocalDirectory(join(target.root, ".cotal"));
16
+ return target;
17
+ }
18
+ function nativeValues(space, server, options) {
19
+ const values = { space, server };
20
+ for (const flag of daemonOptions) {
21
+ if (flag.name === "server")
22
+ continue;
23
+ const value = options[flag.name];
24
+ if (value === undefined || value === false)
25
+ continue;
26
+ values[flag.name] = value === true ? true : String(value);
27
+ if (typeof value === "string" && /[\u0000-\u001f\u007f]/u.test(value))
28
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "native auth-service option values cannot contain terminal controls");
29
+ if (flag.name.endsWith("url") || flag.name === "advertised-server") {
30
+ let url;
31
+ try {
32
+ url = new URL(String(value));
33
+ }
34
+ catch {
35
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "a native auth-service advertised address must be a URL without credential values");
36
+ }
37
+ if (url.username || url.password || url.search || url.hash)
38
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "native auth-service advertised addresses cannot carry credentials, query parameters or fragments on argv");
39
+ }
40
+ }
41
+ try {
42
+ authServiceConfiguration({ values, positionals: [], raw: [] });
43
+ }
44
+ catch {
45
+ throw new CommandFailure("refused", "SCHEMA_INVALID", "native auth-service options do not form one valid daemon configuration; no authority plane was opened");
46
+ }
47
+ return values;
48
+ }
49
+ export const authServicePreset = {
50
+ kind: "service-preset", name: "auth-service", adapter: "auth-service", timeoutMs: 60000,
51
+ summary: "prepared native user-auth authority and exchange on its registered loopback broker",
52
+ };
53
+ export const authServiceProcess = {
54
+ kind: "local-process", name: "auth-service", label: "auth service", order: 30,
55
+ controllerOnly: true, pidFile: AUTH_PIDFILE,
56
+ service: {
57
+ abiVersion: 1, requiresCli: true, readiness: "process",
58
+ capabilities: { multiInstance: false, foreground: true, logs: true }, paths: { root: "directory" },
59
+ optionsSchema: { type: "object", additionalProperties: false, required: ["root"], properties: {
60
+ root: { type: "string", minLength: 1, maxLength: 4096, description: "registered hosting root with its existing native auth key projection" },
61
+ ...Object.fromEntries(daemonOptions.map((flag) => [flag.name, {
62
+ ...(portOptions.has(flag.name) ? { type: "integer", minimum: 0, maximum: 65535 } : flag.type === "boolean" ? { type: "boolean" } : { type: "string", minLength: 1, maxLength: 4096 }), description: flag.description,
63
+ }])),
64
+ } },
65
+ },
66
+ buildServiceLaunch(context) {
67
+ if (!context.cliInvocation?.length)
68
+ throw new CommandFailure("refused", "UNSUPPORTED", "the native auth service requires the verified cotal invocation; no PATH binary was selected");
69
+ if (context.credentialRef)
70
+ throw new CommandFailure("refused", "UNSUPPORTED", "the auth service loads its prepared native key projection; a generic caller credential was not substituted");
71
+ const target = targetFor(String(context.options.root), context.space, context.options.server);
72
+ const values = nativeValues(context.space, target.server, context.options);
73
+ if (readPidfile(localProcessPath(AUTH_PIDFILE, { root: target.root, space: context.space })) !== undefined)
74
+ throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "an existing auth-service custody record is retained; no daemon or legacy slot was adopted or reclaimed");
75
+ const [executable, ...self] = context.cliInvocation;
76
+ const args = [...self, ...(colorEnabled() ? [] : ["--no-color"]), "__service-auth", "--root", target.root, "--service-instance", context.instanceId, "--launch-request", context.launchRequestId, "--ready-file", serviceStartupPath(context)];
77
+ for (const [key, value] of Object.entries(values))
78
+ if (value !== undefined)
79
+ args.push(`--${key}`, ...(value === true ? [] : [String(value)]));
80
+ return { executable: executable, args, cwd: target.root };
81
+ },
82
+ async checkServiceReadiness(context) { return observeServiceStartup(context, "auth-planes-ready"); },
83
+ };
84
+ function validateChild(args) {
85
+ if (args.positionals.length || ["root", "space", "server", "service-instance", "launch-request", "ready-file"].some((key) => typeof args.values[key] !== "string" || !args.values[key]))
86
+ throw new CommandFailure("refused", "USAGE_INVALID", "the native auth-service child requires one complete explicit controller launch");
87
+ for (const key of ["root", "ready-file"])
88
+ if (!isAbsolute(String(args.values[key])) || /[\u0000-\u001f\u007f]/u.test(String(args.values[key])))
89
+ throw new CommandFailure("refused", "USAGE_INVALID", "native auth-service paths must be absolute and contain no terminal controls");
90
+ serviceOperationId(args.values["service-instance"]);
91
+ serviceOperationId(args.values["launch-request"]);
92
+ }
93
+ export const nativeAuthServiceCommand = {
94
+ kind: "command", name: "__service-auth", hidden: true, prepareMeshTarget: false,
95
+ summary: "native auth-service child with exclusive process custody and a private startup receipt",
96
+ flags: [...authServiceFlags,
97
+ { name: "root", type: "string" }, { name: "service-instance", type: "string" },
98
+ { name: "launch-request", type: "string" }, { name: "ready-file", type: "string" },
99
+ ], validate: validateChild,
100
+ async run(args) {
101
+ validateChild(args);
102
+ const target = targetFor(String(args.values.root), String(args.values.space), String(args.values.server));
103
+ const values = nativeValues(target.space, target.server, args.values);
104
+ const instanceId = serviceOperationId(args.values["service-instance"]), launchRequestId = serviceOperationId(args.values["launch-request"]), path = String(args.values["ready-file"]);
105
+ validateServiceStartupPath(path, instanceId, launchRequestId);
106
+ const release = claimServicePid({ root: target.root, space: target.space }, AUTH_PIDFILE);
107
+ try {
108
+ await runAuthService({ ...args, values }, undefined, {
109
+ root: target.root, quiet: true,
110
+ onReady: () => publishServiceStartup(path, { phase: "auth-planes-ready", space: target.space, instanceId, launchRequestId }),
111
+ onClosed: release,
112
+ });
113
+ }
114
+ catch {
115
+ throw new CommandFailure("unknown", "OPERATION_UNKNOWN", "the native auth-service initialization or startup receipt was not confirmed; original custody was retained and no new launch was retried");
116
+ }
117
+ },
118
+ };
119
+ registry.register(authServiceProcess, authServicePreset, nativeAuthServiceCommand);
120
+ //# sourceMappingURL=service-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-adapter.js","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAiC,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAC7E,gBAAgB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EACvF,WAAW,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,kBAAkB,EAC/E,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExE,MAAM,aAAa,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC/E,MAAM,WAAW,GAAG,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,CAAC,EAAE,eAAe,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACtL,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,YAAY,CAAC,CAAC;QAC1F,IAAI,CAAC;YACH,MAAM,cAAc,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE;gBACnD,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI;gBAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;gBAC5H,QAAQ,EAAE,OAAO;aAClB,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YAAC,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,mBAAmB,EAAE,0IAA0I,CAAC,CAAC;QAAC,CAAC;IACnN,CAAC;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,wBAAwB,CAAC,CAAC"}
@@ -1,18 +1,20 @@
1
+ /** Package-internal DORMANT writer for canonical R9 service native custody: bootstrap from an
2
+ * exact reservation to an active stamped root, and endpoint-first cancellation. Nothing in the
3
+ * product calls it and the index does not export it. It grants no approval, serving, terminal
4
+ * retirement, alias release or rotation.
5
+ *
6
+ * Readiness here is local control: a genuine plane-claim hold re-read before and after every
7
+ * write, plus a synchronous fatal latch. It is not broker writer exclusion. A paused writer can
8
+ * still land a write after its last check; safety comes from per-key zero-history create and
9
+ * revision CAS, which make every late write either a loss or unreleased residue. */
1
10
  import { type ServiceUidCustodyV1 } from "@cotal-ai/core";
2
- import { type LifecycleRegistry } from "./lifecycle-registry.js";
3
- import { type PlaneClaimHold } from "./plane-claim.js";
4
- /** One broker request, clipped to the remaining original deadline. */
5
- export declare const S1_REQUEST_TIMEOUT_MS = 5000;
11
+ import { type ServiceAssignmentBinding, type ServiceGateRows } from "./native-service-gate.js";
12
+ import { type ServiceCustodyHost, type ServiceWriteScope } from "./service-write.js";
13
+ export { S1_MAX_UNKNOWN_ROUNDS, S1_REQUEST_TIMEOUT_MS, openServiceCustodyHost, type ServiceCustodyHost } from "./service-write.js";
6
14
  /** Re-reads after a CAS loss before a step holds. */
7
15
  export declare const S1_MAX_CAS_REDECIDE = 4;
8
16
  /** Re-pins of a byte-identical open native gate after a sibling's touch. */
9
17
  export declare const S1_MAX_GATE_REPIN = 8;
10
- /** Classify-then-retry rounds for a write whose outcome is unknown. */
11
- export declare const S1_MAX_UNKNOWN_ROUNDS = 3;
12
- export interface ServiceCustodyHost {
13
- readonly space: string;
14
- readonly accountPublicKey: string;
15
- }
16
18
  export interface ServiceBootstrapIntent {
17
19
  readonly lifecycleUid: string;
18
20
  readonly notAfterMs: number;
@@ -62,16 +64,23 @@ export type ServiceCancelResult = {
62
64
  kind: "foreign-operation";
63
65
  opId: string;
64
66
  } | ServiceCustodyHeld;
65
- /** The one trusted composition: a genuine registry, a genuine hold for the same space, the
66
- * configured account, and a fatal latch only the returned `trip` sets. The held check is the
67
- * closure captured when the hold was acquired, never the hold's mutable `guard` field. */
68
- export declare function openServiceCustodyHost(opts: {
69
- registry: LifecycleRegistry;
70
- hold: PlaneClaimHold;
71
- accountPublicKey: string;
72
- }): {
73
- host: ServiceCustodyHost;
74
- trip(reason: string): void;
67
+ /** Package-internal: every key one custody run for this identity can write. Only bootstrap creates
68
+ * the UID reservation, and its root credential id is minted during the run, so roots are a family. */
69
+ export declare function serviceCustodyKeys(id: {
70
+ owner: string;
71
+ actor: string;
72
+ endpoint: string;
73
+ instanceId: string;
74
+ lifecycleUid: string;
75
+ }, run: "bootstrap" | "cancel"): ServiceWriteScope;
76
+ /** Package-internal: the custody keys of one exact reservation, through the same validation every
77
+ * custody intent uses. */
78
+ export declare function serviceReservationKeys(host: ServiceCustodyHost, reservation: ServiceUidCustodyV1, run: "bootstrap" | "cancel"): ServiceWriteScope;
79
+ /** Package-internal: the binding and endpoint-gate rows of one exact reservation, through the
80
+ * same validation every custody intent uses. Grants nothing; host operations read the gate with it. */
81
+ export declare function serviceAssignmentGate(host: ServiceCustodyHost, reservation: ServiceUidCustodyV1): {
82
+ binding: ServiceAssignmentBinding;
83
+ epgate: ServiceGateRows;
75
84
  };
76
85
  /** Seal the original admitted bootstrap material once. `notAfterMs` is the creation authority's
77
86
  * fixed deadline; the writer never defaults, extends or resets it. */
@@ -1 +1 @@
1
- {"version":3,"file":"service-custody.d.ts","sourceRoot":"","sources":["../src/service-custody.ts"],"names":[],"mappings":"AAWA,OAAO,EAEwF,KAAK,mBAAmB,EACtH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjF,OAAO,EAAoB,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AAQzF,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,OAAQ,CAAC;AAC3C,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE;AACjG,MAAM,WAAW,sBAAsB;IAAG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAA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