@ngockhoale/ckit 0.0.0-stage → 0.1.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 (244) hide show
  1. package/.env.example +42 -0
  2. package/README.md +116 -2
  3. package/dist/src/adapters/agent/claude/errors.d.ts +13 -0
  4. package/dist/src/adapters/agent/claude/errors.js +16 -0
  5. package/dist/src/adapters/agent/claude/normalize.d.ts +11 -0
  6. package/dist/src/adapters/agent/claude/normalize.js +83 -0
  7. package/dist/src/adapters/agent/errors.d.ts +13 -0
  8. package/dist/src/adapters/agent/errors.js +19 -0
  9. package/dist/src/adapters/agent/fixtures/claude-transcript.d.ts +70 -0
  10. package/dist/src/adapters/agent/fixtures/claude-transcript.js +15 -0
  11. package/dist/src/adapters/agent/fixtures/omp-transcript.d.ts +60 -0
  12. package/dist/src/adapters/agent/fixtures/omp-transcript.js +14 -0
  13. package/dist/src/adapters/agent/normalize.d.ts +18 -0
  14. package/dist/src/adapters/agent/normalize.js +77 -0
  15. package/dist/src/adapters/agent/transport.d.ts +35 -0
  16. package/dist/src/adapters/agent/transport.js +39 -0
  17. package/dist/src/adapters/agent/worker-service.d.ts +49 -0
  18. package/dist/src/adapters/agent/worker-service.js +77 -0
  19. package/dist/src/adapters/fake/fake-advisor.d.ts +15 -0
  20. package/dist/src/adapters/fake/fake-advisor.js +29 -0
  21. package/dist/src/adapters/fake/fake-agent.d.ts +12 -0
  22. package/dist/src/adapters/fake/fake-agent.js +21 -0
  23. package/dist/src/adapters/fake/fake-store.d.ts +13 -0
  24. package/dist/src/adapters/fake/fake-store.js +23 -0
  25. package/dist/src/adapters/fake/fake-web.d.ts +12 -0
  26. package/dist/src/adapters/fake/fake-web.js +21 -0
  27. package/dist/src/adapters/fake/fault-injector.d.ts +18 -0
  28. package/dist/src/adapters/fake/fault-injector.js +64 -0
  29. package/dist/src/adapters/fake/virtual-clock.d.ts +12 -0
  30. package/dist/src/adapters/fake/virtual-clock.js +35 -0
  31. package/dist/src/adapters/launch/discover.d.ts +18 -0
  32. package/dist/src/adapters/launch/discover.js +55 -0
  33. package/dist/src/adapters/launch/executor.d.ts +117 -0
  34. package/dist/src/adapters/launch/executor.js +383 -0
  35. package/dist/src/adapters/launch/profile.d.ts +35 -0
  36. package/dist/src/adapters/launch/profile.js +73 -0
  37. package/dist/src/adapters/launch/spawn.d.ts +29 -0
  38. package/dist/src/adapters/launch/spawn.js +18 -0
  39. package/dist/src/adapters/openai/openai-advisor.d.ts +56 -0
  40. package/dist/src/adapters/openai/openai-advisor.js +146 -0
  41. package/dist/src/cli/ckit.d.ts +5 -0
  42. package/dist/src/cli/ckit.js +472 -0
  43. package/dist/src/cli/demo.d.ts +1 -0
  44. package/dist/src/cli/demo.js +30 -0
  45. package/dist/src/cli/sessions.d.ts +10 -0
  46. package/dist/src/cli/sessions.js +381 -0
  47. package/dist/src/cli/setup.d.ts +11 -0
  48. package/dist/src/cli/setup.js +115 -0
  49. package/dist/src/committee/decision.d.ts +84 -0
  50. package/dist/src/committee/decision.js +167 -0
  51. package/dist/src/committee/handover.d.ts +115 -0
  52. package/dist/src/committee/handover.js +191 -0
  53. package/dist/src/committee/no-progress.d.ts +44 -0
  54. package/dist/src/committee/no-progress.js +64 -0
  55. package/dist/src/committee/primary-registry.d.ts +15 -0
  56. package/dist/src/committee/primary-registry.js +60 -0
  57. package/dist/src/committee/reply-parser.d.ts +28 -0
  58. package/dist/src/committee/reply-parser.js +53 -0
  59. package/dist/src/committee/reviewer-scheduler.d.ts +101 -0
  60. package/dist/src/committee/reviewer-scheduler.js +163 -0
  61. package/dist/src/committee/role-epoch.d.ts +91 -0
  62. package/dist/src/committee/role-epoch.js +154 -0
  63. package/dist/src/core/control.d.ts +18 -0
  64. package/dist/src/core/control.js +29 -0
  65. package/dist/src/core/entities.d.ts +166 -0
  66. package/dist/src/core/entities.js +119 -0
  67. package/dist/src/core/errors.d.ts +9 -0
  68. package/dist/src/core/errors.js +17 -0
  69. package/dist/src/core/events.d.ts +72 -0
  70. package/dist/src/core/events.js +125 -0
  71. package/dist/src/core/ids.d.ts +47 -0
  72. package/dist/src/core/ids.js +32 -0
  73. package/dist/src/core/machine.d.ts +55 -0
  74. package/dist/src/core/machine.js +110 -0
  75. package/dist/src/core/policy.d.ts +34 -0
  76. package/dist/src/core/policy.js +59 -0
  77. package/dist/src/core/provenance.d.ts +20 -0
  78. package/dist/src/core/provenance.js +21 -0
  79. package/dist/src/core/record.d.ts +35 -0
  80. package/dist/src/core/record.js +67 -0
  81. package/dist/src/core/replay.d.ts +10 -0
  82. package/dist/src/core/replay.js +36 -0
  83. package/dist/src/core/run-task.d.ts +20 -0
  84. package/dist/src/core/run-task.js +48 -0
  85. package/dist/src/diagnostics/doctor.d.ts +78 -0
  86. package/dist/src/diagnostics/doctor.js +365 -0
  87. package/dist/src/diagnostics/journal-lock.d.ts +38 -0
  88. package/dist/src/diagnostics/journal-lock.js +181 -0
  89. package/dist/src/evidence/linker.d.ts +44 -0
  90. package/dist/src/evidence/linker.js +75 -0
  91. package/dist/src/evidence/report-parser.d.ts +27 -0
  92. package/dist/src/evidence/report-parser.js +17 -0
  93. package/dist/src/evidence/store.d.ts +36 -0
  94. package/dist/src/evidence/store.js +57 -0
  95. package/dist/src/gui/server.d.ts +27 -0
  96. package/dist/src/gui/server.js +497 -0
  97. package/dist/src/host/checkpoint.d.ts +22 -0
  98. package/dist/src/host/checkpoint.js +74 -0
  99. package/dist/src/host/export.d.ts +52 -0
  100. package/dist/src/host/export.js +45 -0
  101. package/dist/src/host/ipc.d.ts +57 -0
  102. package/dist/src/host/ipc.js +124 -0
  103. package/dist/src/host/leases.d.ts +27 -0
  104. package/dist/src/host/leases.js +40 -0
  105. package/dist/src/host/retention.d.ts +47 -0
  106. package/dist/src/host/retention.js +130 -0
  107. package/dist/src/host/supervisor.d.ts +59 -0
  108. package/dist/src/host/supervisor.js +64 -0
  109. package/dist/src/intake/owner-intake.d.ts +31 -0
  110. package/dist/src/intake/owner-intake.js +97 -0
  111. package/dist/src/intake/types.d.ts +46 -0
  112. package/dist/src/intake/types.js +2 -0
  113. package/dist/src/intent/context-packet.d.ts +68 -0
  114. package/dist/src/intent/context-packet.js +76 -0
  115. package/dist/src/intent/idea-ledger.d.ts +50 -0
  116. package/dist/src/intent/idea-ledger.js +136 -0
  117. package/dist/src/intent/ledger.d.ts +35 -0
  118. package/dist/src/intent/ledger.js +40 -0
  119. package/dist/src/intent/registry.d.ts +51 -0
  120. package/dist/src/intent/registry.js +44 -0
  121. package/dist/src/intent/revision.d.ts +37 -0
  122. package/dist/src/intent/revision.js +48 -0
  123. package/dist/src/orchestration/dispatcher.d.ts +32 -0
  124. package/dist/src/orchestration/dispatcher.js +136 -0
  125. package/dist/src/orchestration/milestone-loop.d.ts +149 -0
  126. package/dist/src/orchestration/milestone-loop.js +132 -0
  127. package/dist/src/orchestration/recovery-coordinator.d.ts +74 -0
  128. package/dist/src/orchestration/recovery-coordinator.js +180 -0
  129. package/dist/src/orchestration/work-order-contract.d.ts +44 -0
  130. package/dist/src/orchestration/work-order-contract.js +85 -0
  131. package/dist/src/orchestration/work-queue.d.ts +56 -0
  132. package/dist/src/orchestration/work-queue.js +95 -0
  133. package/dist/src/ports/advisor.d.ts +33 -0
  134. package/dist/src/ports/advisor.js +2 -0
  135. package/dist/src/ports/agent.d.ts +31 -0
  136. package/dist/src/ports/agent.js +2 -0
  137. package/dist/src/ports/capabilities.d.ts +3 -0
  138. package/dist/src/ports/capabilities.js +5 -0
  139. package/dist/src/ports/clock.d.ts +5 -0
  140. package/dist/src/ports/clock.js +5 -0
  141. package/dist/src/ports/store.d.ts +13 -0
  142. package/dist/src/ports/store.js +2 -0
  143. package/dist/src/ports/web.d.ts +29 -0
  144. package/dist/src/ports/web.js +2 -0
  145. package/dist/src/run/api-run.d.ts +49 -0
  146. package/dist/src/run/api-run.js +173 -0
  147. package/dist/src/run/plan-run.d.ts +22 -0
  148. package/dist/src/run/plan-run.js +233 -0
  149. package/dist/src/run/plan.d.ts +36 -0
  150. package/dist/src/run/plan.js +119 -0
  151. package/dist/src/run/verify.d.ts +25 -0
  152. package/dist/src/run/verify.js +81 -0
  153. package/dist/src/security/redact.d.ts +7 -0
  154. package/dist/src/security/redact.js +21 -0
  155. package/dist/src/settings/env-config.d.ts +64 -0
  156. package/dist/src/settings/env-config.js +232 -0
  157. package/dist/src/storage/artifacts.d.ts +30 -0
  158. package/dist/src/storage/artifacts.js +105 -0
  159. package/dist/src/storage/audit.d.ts +6 -0
  160. package/dist/src/storage/audit.js +6 -0
  161. package/dist/src/storage/db.d.ts +9 -0
  162. package/dist/src/storage/db.js +43 -0
  163. package/dist/src/storage/events.d.ts +20 -0
  164. package/dist/src/storage/events.js +69 -0
  165. package/dist/src/storage/migrations.d.ts +8 -0
  166. package/dist/src/storage/migrations.js +48 -0
  167. package/dist/src/storage/outbox.d.ts +25 -0
  168. package/dist/src/storage/outbox.js +40 -0
  169. package/dist/src/storage/projections.d.ts +18 -0
  170. package/dist/src/storage/projections.js +40 -0
  171. package/dist/src/storage/reconcile.d.ts +14 -0
  172. package/dist/src/storage/reconcile.js +93 -0
  173. package/dist/src/storage/reservations.d.ts +12 -0
  174. package/dist/src/storage/reservations.js +80 -0
  175. package/dist/src/storage/store.d.ts +34 -0
  176. package/dist/src/storage/store.js +105 -0
  177. package/dist/src/team/attachments.d.ts +22 -0
  178. package/dist/src/team/attachments.js +211 -0
  179. package/dist/src/team/cli-models.d.ts +24 -0
  180. package/dist/src/team/cli-models.js +72 -0
  181. package/dist/src/team/config.d.ts +20 -0
  182. package/dist/src/team/config.js +111 -0
  183. package/dist/src/team/engine.d.ts +28 -0
  184. package/dist/src/team/engine.js +443 -0
  185. package/dist/src/team/journal.d.ts +30 -0
  186. package/dist/src/team/journal.js +70 -0
  187. package/dist/src/team/runners.d.ts +79 -0
  188. package/dist/src/team/runners.js +436 -0
  189. package/dist/src/team/secrets.d.ts +10 -0
  190. package/dist/src/team/secrets.js +68 -0
  191. package/dist/src/team/types.d.ts +155 -0
  192. package/dist/src/team/types.js +5 -0
  193. package/dist/src/tui/app.d.ts +29 -0
  194. package/dist/src/tui/app.js +96 -0
  195. package/dist/src/tui/control-model.d.ts +101 -0
  196. package/dist/src/tui/control-model.js +109 -0
  197. package/dist/src/tui/control-screens.d.ts +27 -0
  198. package/dist/src/tui/control-screens.js +85 -0
  199. package/dist/src/tui/graph-model.d.ts +34 -0
  200. package/dist/src/tui/graph-model.js +29 -0
  201. package/dist/src/tui/graph-screens.d.ts +13 -0
  202. package/dist/src/tui/graph-screens.js +4 -0
  203. package/dist/src/tui/inspector-model.d.ts +150 -0
  204. package/dist/src/tui/inspector-model.js +15 -0
  205. package/dist/src/tui/inspector-screens.d.ts +14 -0
  206. package/dist/src/tui/inspector-screens.js +61 -0
  207. package/dist/src/tui/live.d.ts +16 -0
  208. package/dist/src/tui/live.js +39 -0
  209. package/dist/src/tui/mission-action-screens.d.ts +15 -0
  210. package/dist/src/tui/mission-action-screens.js +105 -0
  211. package/dist/src/tui/mission-actions.d.ts +46 -0
  212. package/dist/src/tui/mission-actions.js +53 -0
  213. package/dist/src/tui/mission-model.d.ts +120 -0
  214. package/dist/src/tui/mission-model.js +164 -0
  215. package/dist/src/tui/mission-nav.d.ts +82 -0
  216. package/dist/src/tui/mission-nav.js +131 -0
  217. package/dist/src/tui/mission-plan-screens.d.ts +11 -0
  218. package/dist/src/tui/mission-plan-screens.js +40 -0
  219. package/dist/src/tui/mission-plan.d.ts +45 -0
  220. package/dist/src/tui/mission-plan.js +166 -0
  221. package/dist/src/tui/mission-screens.d.ts +7 -0
  222. package/dist/src/tui/mission-screens.js +263 -0
  223. package/dist/src/tui/provenance-label.d.ts +11 -0
  224. package/dist/src/tui/provenance-label.js +16 -0
  225. package/dist/src/tui/screens.d.ts +10 -0
  226. package/dist/src/tui/screens.js +34 -0
  227. package/dist/src/tui/session-outcome.d.ts +14 -0
  228. package/dist/src/tui/session-outcome.js +57 -0
  229. package/dist/src/tui/setup-model.d.ts +159 -0
  230. package/dist/src/tui/setup-model.js +234 -0
  231. package/dist/src/tui/setup-screens.d.ts +66 -0
  232. package/dist/src/tui/setup-screens.js +72 -0
  233. package/dist/src/tui/team/app.d.ts +24 -0
  234. package/dist/src/tui/team/app.js +228 -0
  235. package/dist/src/tui/team/demo-handle.d.ts +22 -0
  236. package/dist/src/tui/team/demo-handle.js +42 -0
  237. package/dist/src/tui/team/model.d.ts +81 -0
  238. package/dist/src/tui/team/model.js +133 -0
  239. package/gui/app.css +177 -0
  240. package/gui/app.js +675 -0
  241. package/gui/index.html +51 -0
  242. package/gui/network.js +413 -0
  243. package/package.json +45 -4
  244. package/src/storage/schema.sql +42 -0
@@ -0,0 +1,45 @@
1
+ import { redactLaunchMetadata, secretKeyPattern } from '../adapters/launch/profile.js';
2
+ import { credentialKeyPattern, redactSecretText } from '../security/redact.js';
3
+ /** Portable, redacted snapshot. Import is data-only: it never dispatches queued work. */
4
+ export class ExportService {
5
+ export(input) {
6
+ if (!input.sessionId || !input.cwd || !input.profile)
7
+ throw new TypeError('export binding is incomplete');
8
+ const environment = input.environment ?? {};
9
+ const secretValues = Object.entries(environment).filter(([key]) => credentialKeyPattern.test(key)).map(([, value]) => value).filter(Boolean);
10
+ const redactedLaunch = redactLaunchMetadata(input.args ?? [], environment);
11
+ const launch = Object.freeze({ args: Object.freeze(redactedLaunch.args.map(arg => String(redactValue(arg, '', secretValues)))), environment: Object.freeze(Object.fromEntries(Object.entries(redactedLaunch.environment).map(([name, item]) => [name, String(redactValue(item, name, secretValues))]))) });
12
+ const safeState = redactValue(input.state ?? null, '', secretValues), safeDiagnostics = redactValue(input.diagnostics ?? null, '', secretValues);
13
+ return Object.freeze({ schemaVersion: 1, sessionId: input.sessionId, state: safeState, pendingOrders: redactValue(structuredClone(input.pendingOrders), '', secretValues), diagnostics: safeDiagnostics, rebindRequired: true, sourceBinding: Object.freeze({ cwd: '[REDACTED]', profile: '[REDACTED]' }), launch, sensitiveRefs: Object.freeze((input.sensitiveRefs ?? []).map(ref => Object.freeze({ ref: '[REDACTED]', label: 'sensitive' }))) });
14
+ }
15
+ import(bundle, options) {
16
+ if (bundle.schemaVersion !== 1)
17
+ throw new Error('unsupported export schema');
18
+ if (!options.cwd || !options.profile)
19
+ throw new TypeError('target cwd and profile required');
20
+ if (options.rebind !== true)
21
+ throw new Error('rebind required before import');
22
+ if (bundle.rebindRequired !== true)
23
+ throw new Error('bundle rebind required');
24
+ return Object.freeze({ sessionId: bundle.sessionId, state: structuredClone(bundle.state), pendingOrders: structuredClone(bundle.pendingOrders), binding: Object.freeze({ cwd: options.cwd, profile: options.profile }), dispatchRequired: true });
25
+ }
26
+ }
27
+ const secretName = /(?:token|secret|password|cookie|credential|profile|environment|env|api.?key|authorization|home|cwd|path)/i;
28
+ function redactValue(value, key = '', secretValues = []) {
29
+ if (secretName.test(key) || secretKeyPattern.test(key))
30
+ return '[REDACTED]';
31
+ if (Array.isArray(value))
32
+ return value.map(item => redactValue(item, '', secretValues));
33
+ if (value !== null && typeof value === 'object') {
34
+ const out = {};
35
+ for (const [name, item] of Object.entries(value))
36
+ out[name] = redactValue(item, name, secretValues);
37
+ return out;
38
+ }
39
+ if (typeof value === 'string') { // Query-string `key=value` form (e.g. `?apikey=…&pat=…`) is wider than the shared helper; `\bpat\b` keeps `path=` intact.
40
+ let safe = value.replace(/((?:token|secret|pass|key|\bpat\b|passphrase)[\w.-]*)=([^\s&]+)/gi, '$1=[REDACTED]');
41
+ return redactSecretText(safe, secretValues);
42
+ }
43
+ return value;
44
+ }
45
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1,57 @@
1
+ import type { SessionSupervisor } from './supervisor.js';
2
+ export type IpcRequest = {
3
+ readonly type: 'health';
4
+ readonly now?: number;
5
+ } | {
6
+ readonly type: 'attach';
7
+ readonly clientId: string;
8
+ } | {
9
+ readonly type: 'detach';
10
+ readonly clientId: string;
11
+ };
12
+ export type IpcReply = {
13
+ readonly ok: true;
14
+ readonly health: ReturnType<SessionSupervisor['health']>;
15
+ } | {
16
+ readonly ok: true;
17
+ readonly client: ReturnType<SessionSupervisor['attach']>;
18
+ } | {
19
+ readonly ok: true;
20
+ } | {
21
+ readonly ok: false;
22
+ readonly error: string;
23
+ };
24
+ export interface IpcTransport {
25
+ listen(handler: (request: IpcRequest) => Promise<IpcReply> | IpcReply): void;
26
+ close(): Promise<void>;
27
+ ready?(): Promise<void>;
28
+ }
29
+ export declare class InProcessTransport implements IpcTransport {
30
+ private handler;
31
+ listen(handler: (request: IpcRequest) => Promise<IpcReply> | IpcReply): void;
32
+ request(request: IpcRequest): Promise<IpcReply>;
33
+ close(): Promise<void>;
34
+ }
35
+ export interface LocalSocketOptions {
36
+ readonly requestTimeoutMs?: number;
37
+ }
38
+ export declare class LocalSocketTransport implements IpcTransport {
39
+ private readonly socketPath;
40
+ private server;
41
+ private bound;
42
+ private readyPromise;
43
+ private readonly requestTimeoutMs;
44
+ constructor(socketPath: string, options?: LocalSocketOptions);
45
+ listen(handler: (request: IpcRequest) => Promise<IpcReply> | IpcReply): void;
46
+ ready(): Promise<void>;
47
+ request(request: IpcRequest): Promise<IpcReply>;
48
+ close(): Promise<void>;
49
+ }
50
+ export declare class LocalIpcServer {
51
+ private readonly host;
52
+ private readonly transport;
53
+ constructor(host: SessionSupervisor, transport: IpcTransport);
54
+ start(): void;
55
+ ready(): Promise<void>;
56
+ close(): Promise<void>;
57
+ }
@@ -0,0 +1,124 @@
1
+ import { createServer, connect } from 'node:net';
2
+ import { chmod, lstat, unlink } from 'node:fs/promises';
3
+ import { isAbsolute } from 'node:path';
4
+ export class InProcessTransport {
5
+ handler = null;
6
+ listen(handler) { this.handler = handler; }
7
+ async request(request) { if (!this.handler)
8
+ throw new Error('transport not listening'); return this.handler(request); }
9
+ async close() { this.handler = null; }
10
+ }
11
+ export class LocalSocketTransport {
12
+ socketPath;
13
+ server = null;
14
+ bound = false;
15
+ readyPromise = Promise.resolve();
16
+ requestTimeoutMs;
17
+ constructor(socketPath, options = {}) {
18
+ this.socketPath = socketPath;
19
+ if (!isAbsolute(this.socketPath))
20
+ throw new TypeError('IPC socket path must be absolute');
21
+ const timeout = options.requestTimeoutMs ?? 5000;
22
+ if (!Number.isSafeInteger(timeout) || timeout <= 0)
23
+ throw new TypeError('requestTimeoutMs must be a positive safe integer');
24
+ this.requestTimeoutMs = timeout;
25
+ }
26
+ listen(handler) {
27
+ this.server = createServer(socket => { let buffer = ''; socket.on('error', () => socket.destroy()); socket.on('data', chunk => { buffer += chunk.toString('utf8'); if (buffer.length > 1_048_576) {
28
+ socket.destroy();
29
+ return;
30
+ } const newline = buffer.indexOf('\n'); if (newline < 0)
31
+ return; const line = buffer.slice(0, newline); void Promise.resolve().then(() => handler(JSON.parse(line))).then(reply => socket.end(`${JSON.stringify(reply)}\n`), error => socket.end(`${JSON.stringify({ ok: false, error: error instanceof Error ? error.message : 'request failed' })}\n`)); }); });
32
+ const server = this.server;
33
+ this.bound = false;
34
+ const bind = () => new Promise((resolve, reject) => {
35
+ const onError = (error) => reject(error);
36
+ server.once('error', onError);
37
+ // process.umask is process-wide: assumes no worker thread creates files during this synchronous bind window.
38
+ const previousUmask = process.umask(0o177);
39
+ try {
40
+ server.listen(this.socketPath, () => { server.off('error', onError); void chmod(this.socketPath, 0o600).catch(() => undefined); resolve(); });
41
+ }
42
+ catch (error) {
43
+ server.off('error', onError);
44
+ reject(error);
45
+ }
46
+ finally {
47
+ process.umask(previousUmask);
48
+ }
49
+ });
50
+ this.readyPromise = bind().catch(async (error) => {
51
+ if (error.code !== 'EADDRINUSE')
52
+ throw error;
53
+ const info = await lstat(this.socketPath).catch(() => null);
54
+ if (info && !info.isSocket())
55
+ throw new Error(`IPC socket path exists and is not a socket: ${this.socketPath}`);
56
+ if (info) {
57
+ // Probe timeout counts as live: never unlink a socket we could not prove dead.
58
+ const live = await new Promise((resolve, reject) => { const probe = connect(this.socketPath); probe.setTimeout(1000, () => { probe.destroy(); resolve(true); }); probe.once('connect', () => { probe.destroy(); resolve(true); }); probe.once('error', e => { const code = e.code; if (code === 'ECONNREFUSED' || code === 'ENOENT')
59
+ resolve(false);
60
+ else
61
+ reject(e); }); });
62
+ if (live)
63
+ throw new Error(`IPC socket already served by a live host: ${this.socketPath}`);
64
+ await unlink(this.socketPath).catch(e => { if (e.code !== 'ENOENT')
65
+ throw e; });
66
+ }
67
+ await bind();
68
+ }).then(() => { this.bound = true; server.on('error', () => undefined); }, error => { this.server = null; throw error; });
69
+ this.readyPromise.catch(() => undefined);
70
+ }
71
+ ready() { return this.readyPromise; }
72
+ async request(request) { return new Promise((resolve, reject) => { const socket = connect(this.socketPath); let data = ''; let settled = false; const finish = (action) => { if (settled)
73
+ return; settled = true; clearTimeout(timer); action(); }; const timer = setTimeout(() => finish(() => { socket.destroy(); reject(new Error(`IPC request timed out after ${this.requestTimeoutMs}ms`)); }), this.requestTimeoutMs); socket.on('connect', () => socket.write(`${JSON.stringify(request)}\n`)); socket.on('data', chunk => { data += chunk.toString('utf8'); const end = data.indexOf('\n'); if (end >= 0) {
74
+ finish(() => { try {
75
+ resolve(JSON.parse(data.slice(0, end)));
76
+ }
77
+ catch (error) {
78
+ reject(error);
79
+ } socket.end(); });
80
+ } }); socket.on('error', error => finish(() => reject(error))); }); }
81
+ async close() {
82
+ await this.readyPromise.catch(() => undefined);
83
+ if (!this.bound) {
84
+ this.server = null;
85
+ return;
86
+ }
87
+ this.bound = false;
88
+ if (this.server) {
89
+ await new Promise((resolve, reject) => this.server?.close(error => error ? reject(error) : resolve()));
90
+ this.server = null;
91
+ } // Known residual: two hosts recovering the same stale path concurrently can both bind; libuv's close unlinks the path, so this needs a lockfile, not an inode check.
92
+ try {
93
+ await unlink(this.socketPath);
94
+ }
95
+ catch (error) {
96
+ if (error.code !== 'ENOENT')
97
+ throw error;
98
+ }
99
+ }
100
+ }
101
+ export class LocalIpcServer {
102
+ host;
103
+ transport;
104
+ constructor(host, transport) {
105
+ this.host = host;
106
+ this.transport = transport;
107
+ }
108
+ start() { this.transport.listen(request => { try {
109
+ if (request.type === 'health')
110
+ return { ok: true, health: this.host.health(request.now) };
111
+ if (request.type === 'attach')
112
+ return { ok: true, client: this.host.attach(request.clientId) };
113
+ if (request.type !== 'detach' || typeof request.clientId !== 'string' || request.clientId.length === 0)
114
+ return { ok: false, error: 'unsupported request type' };
115
+ this.host.detach(request.clientId);
116
+ return { ok: true };
117
+ }
118
+ catch (error) {
119
+ return { ok: false, error: error instanceof Error ? error.message : 'request failed' };
120
+ } }); }
121
+ ready() { return this.transport.ready ? this.transport.ready() : Promise.resolve(); }
122
+ close() { return this.transport.close(); }
123
+ }
124
+ //# sourceMappingURL=ipc.js.map
@@ -0,0 +1,27 @@
1
+ import type { StorageDatabase } from '../storage/db.js';
2
+ export interface Lease {
3
+ readonly resource: string;
4
+ readonly owner: string;
5
+ readonly fence: number;
6
+ readonly expiresAt: number;
7
+ }
8
+ export type LeaseInspection = {
9
+ readonly status: 'missing';
10
+ } | {
11
+ readonly status: 'active' | 'expired';
12
+ readonly lease: Lease;
13
+ };
14
+ export declare class FencedLeaseError extends Error {
15
+ constructor();
16
+ }
17
+ /** T02-01's leases table is already durable; the DB wrapper intentionally exposes no migration extension seam. */
18
+ export declare class LeaseManager {
19
+ private readonly db;
20
+ constructor(db: StorageDatabase);
21
+ acquire(resource: string, owner: string, ttlMs: number, now?: number): Lease | null;
22
+ renew(lease: Lease, ttlMs: number, now?: number): Lease | null;
23
+ release(lease: Lease, now?: number): boolean;
24
+ inspect(resource: string, now?: number): LeaseInspection;
25
+ isCurrent(lease: Lease, now?: number): boolean;
26
+ mutate<T>(lease: Lease, write: () => T, now?: number): T;
27
+ }
@@ -0,0 +1,40 @@
1
+ export class FencedLeaseError extends Error {
2
+ constructor() { super('lease fencing token is stale or expired'); this.name = 'FencedLeaseError'; }
3
+ }
4
+ /** T02-01's leases table is already durable; the DB wrapper intentionally exposes no migration extension seam. */
5
+ export class LeaseManager {
6
+ db;
7
+ constructor(db) {
8
+ this.db = db;
9
+ }
10
+ acquire(resource, owner, ttlMs, now = Date.now()) {
11
+ validate(resource, owner, ttlMs, now);
12
+ return this.db.transaction(() => {
13
+ const row = this.db.raw.prepare('SELECT owner,fence,expires_at FROM leases WHERE resource=?').get(resource);
14
+ if (row !== undefined && Number(row['expires_at']) > now)
15
+ return null;
16
+ const fence = Number(row?.['fence'] ?? 0) + 1;
17
+ if (!Number.isSafeInteger(fence))
18
+ throw new RangeError('lease fencing token exhausted');
19
+ this.db.raw.prepare('INSERT INTO leases(resource,owner,fence,expires_at) VALUES(?,?,?,?) ON CONFLICT(resource) DO UPDATE SET owner=excluded.owner,fence=excluded.fence,expires_at=excluded.expires_at').run(resource, owner, fence, now + ttlMs);
20
+ return freezeLease(resource, owner, fence, now + ttlMs);
21
+ });
22
+ }
23
+ renew(lease, ttlMs, now = Date.now()) {
24
+ validate(lease.resource, lease.owner, ttlMs, now);
25
+ return this.db.transaction(() => { if (!this.isCurrent(lease, now))
26
+ return null; this.db.raw.prepare('UPDATE leases SET expires_at=? WHERE resource=? AND owner=? AND fence=?').run(now + ttlMs, lease.resource, lease.owner, lease.fence); return freezeLease(lease.resource, lease.owner, lease.fence, now + ttlMs); });
27
+ }
28
+ release(lease, now = Date.now()) { return this.db.transaction(() => { if (!this.isCurrent(lease, now))
29
+ return false; this.db.raw.prepare('UPDATE leases SET expires_at=? WHERE resource=? AND owner=? AND fence=?').run(now, lease.resource, lease.owner, lease.fence); return true; }); }
30
+ inspect(resource, now = Date.now()) { const row = this.db.raw.prepare('SELECT owner,fence,expires_at FROM leases WHERE resource=?').get(resource); if (!row)
31
+ return { status: 'missing' }; const lease = freezeLease(resource, String(row['owner']), Number(row['fence']), Number(row['expires_at'])); return lease.expiresAt > now ? { status: 'active', lease } : { status: 'expired', lease }; }
32
+ isCurrent(lease, now = Date.now()) { const current = this.inspect(lease.resource, now); return current.status === 'active' && current.lease.owner === lease.owner && current.lease.fence === lease.fence; }
33
+ mutate(lease, write, now = Date.now()) { return this.db.transaction(() => { if (!this.isCurrent(lease, now))
34
+ throw new FencedLeaseError(); const result = write(); if (!this.isCurrent(lease, now))
35
+ throw new FencedLeaseError(); return result; }); }
36
+ }
37
+ function validate(resource, owner, ttl, now) { if (!resource || !owner || !Number.isSafeInteger(ttl) || ttl <= 0 || !Number.isSafeInteger(now) || !Number.isSafeInteger(now + ttl))
38
+ throw new TypeError('invalid lease parameters'); }
39
+ function freezeLease(resource, owner, fence, expiresAt) { return Object.freeze({ resource, owner, fence, expiresAt }); }
40
+ //# sourceMappingURL=leases.js.map
@@ -0,0 +1,47 @@
1
+ export interface BackpressureSignal {
2
+ append(value: unknown): unknown;
3
+ }
4
+ export interface RetentionOptions {
5
+ readonly maxLogBytes?: number;
6
+ }
7
+ export interface ArtifactWriteOptions {
8
+ readonly beforeComplete?: () => void | Promise<void>;
9
+ readonly activeTaskId?: string;
10
+ }
11
+ export interface DeleteResult {
12
+ readonly deleted: readonly string[];
13
+ readonly retained: readonly string[];
14
+ }
15
+ /** Bounded local logs and crash-visible atomic artifact publication. */
16
+ export declare class RetentionManager {
17
+ readonly root: string;
18
+ private readonly metadata;
19
+ private readonly activeEvidence;
20
+ private readonly pausedEvidence;
21
+ private signal;
22
+ private paused;
23
+ private readonly maxLogBytes;
24
+ constructor(root: string, options?: RetentionOptions);
25
+ writeLog(name: string, data: string | Uint8Array): Promise<void>;
26
+ writeArtifact(name: string, data: string | Uint8Array, options?: ArtifactWriteOptions): Promise<{
27
+ readonly ref: string;
28
+ readonly hash: string;
29
+ readonly sizeBytes: number;
30
+ }>;
31
+ listRawPartials(): Promise<readonly string[]>;
32
+ completedArtifacts(): Promise<readonly string[]>;
33
+ connectBackpressure(signal: BackpressureSignal): void;
34
+ authorizeDispatch<T>(dispatch: () => T): T;
35
+ retainEvidence(id: string, data: Uint8Array): void;
36
+ readEvidence(id: string): Promise<Buffer>;
37
+ isDispatchPaused(): boolean;
38
+ readArtifact(rawRef: string): Promise<Buffer>;
39
+ rotateLogs(options?: {
40
+ readonly activeTaskIds?: readonly string[];
41
+ }): Promise<readonly string[]>;
42
+ reachableActiveEvidence(taskId: string): Promise<readonly string[]>;
43
+ ownerDelete(input: {
44
+ readonly artifactRefs: readonly string[];
45
+ readonly activeTaskIds?: readonly string[];
46
+ }): Promise<DeleteResult>;
47
+ }
@@ -0,0 +1,130 @@
1
+ import { mkdir, open, readdir, readFile, rename, rm, stat } from 'node:fs/promises';
2
+ import { join, basename } from 'node:path';
3
+ import { createHash } from 'node:crypto';
4
+ /** Bounded local logs and crash-visible atomic artifact publication. */
5
+ export class RetentionManager {
6
+ root;
7
+ metadata = new Map();
8
+ activeEvidence = new Map();
9
+ pausedEvidence = new Map();
10
+ signal = null;
11
+ paused = false;
12
+ maxLogBytes;
13
+ constructor(root, options = {}) {
14
+ this.root = root;
15
+ this.maxLogBytes = options.maxLogBytes ?? 5 * 1024 * 1024;
16
+ if (!Number.isSafeInteger(this.maxLogBytes) || this.maxLogBytes < 0)
17
+ throw new TypeError('invalid maxLogBytes');
18
+ }
19
+ async writeLog(name, data) { const safe = safeName(name); await mkdir(this.root, { recursive: true }); await writeAtomic(join(this.root, safe), Buffer.from(data)); }
20
+ async writeArtifact(name, data, options = {}) {
21
+ const safe = safeName(name), bytes = Buffer.from(data);
22
+ await mkdir(this.root, { recursive: true });
23
+ const target = join(this.root, safe), partial = join(this.root, `.${safe}.${process.pid}.${Date.now()}.partial`), handle = await open(partial, 'wx', 0o600);
24
+ try {
25
+ await handle.writeFile(bytes);
26
+ await handle.sync();
27
+ await handle.close();
28
+ await options.beforeComplete?.();
29
+ await rename(partial, target);
30
+ const dir = await open(this.root, 'r');
31
+ try {
32
+ await dir.sync();
33
+ }
34
+ finally {
35
+ await dir.close();
36
+ }
37
+ }
38
+ catch (error) {
39
+ try {
40
+ await handle.close();
41
+ }
42
+ catch { }
43
+ throw error;
44
+ }
45
+ const hash = createHash('sha256').update(bytes).digest('hex'), meta = options.activeTaskId === undefined ? { hash, size: bytes.byteLength } : { hash, size: bytes.byteLength, activeTaskId: options.activeTaskId };
46
+ this.metadata.set(safe, meta);
47
+ if (options.activeTaskId) {
48
+ const refs = this.activeEvidence.get(options.activeTaskId) ?? new Set();
49
+ refs.add(safe);
50
+ this.activeEvidence.set(options.activeTaskId, refs);
51
+ }
52
+ return Object.freeze({ ref: safe, hash, sizeBytes: bytes.byteLength });
53
+ }
54
+ async listRawPartials() { try {
55
+ return Object.freeze((await readdir(this.root)).filter(n => n.endsWith('.partial') || n.endsWith('.tmp')).sort());
56
+ }
57
+ catch (e) {
58
+ if (e.code === 'ENOENT')
59
+ return Object.freeze([]);
60
+ throw e;
61
+ } }
62
+ async completedArtifacts() { return Object.freeze([...this.metadata.keys()].sort()); }
63
+ connectBackpressure(signal) { this.signal = signal; }
64
+ authorizeDispatch(dispatch) { if (this.paused)
65
+ throw new Error('STORAGE_BACKPRESSURE: dispatch paused; evidence retained'); if (!this.signal) {
66
+ return dispatch();
67
+ } try {
68
+ this.signal.append({ type: 'dispatch-authorized' });
69
+ return dispatch();
70
+ }
71
+ catch (error) {
72
+ if (isBackpressure(error)) {
73
+ this.paused = true;
74
+ throw new Error('STORAGE_BACKPRESSURE: critical storage write failed; dispatch paused and evidence retained', { cause: error });
75
+ }
76
+ throw error;
77
+ } }
78
+ retainEvidence(id, data) { if (!id)
79
+ throw new TypeError('evidence ID required'); this.pausedEvidence.set(id, Buffer.from(data)); }
80
+ async readEvidence(id) { const pending = this.pausedEvidence.get(id); if (pending)
81
+ return Buffer.from(pending); return this.readArtifact(id); }
82
+ isDispatchPaused() { return this.paused; }
83
+ async readArtifact(rawRef) { const ref = safeName(rawRef), bytes = await readFile(join(this.root, ref)), meta = this.metadata.get(ref); if (!meta || bytes.byteLength !== meta.size || createHash('sha256').update(bytes).digest('hex') !== meta.hash)
84
+ throw new Error(`artifact integrity unavailable: ${ref}`); return bytes; }
85
+ async rotateLogs(options = {}) { await mkdir(this.root, { recursive: true }); const active = new Set(options.activeTaskIds ?? []), names = await readdir(this.root); const logs = await Promise.all(names.filter(n => n.endsWith('.log')).map(async (name) => ({ name, size: (await stat(join(this.root, name))).size }))); logs.sort((a, b) => a.name.localeCompare(b.name)); let total = logs.reduce((n, x) => n + x.size, 0); const removed = []; for (const entry of logs) {
86
+ if (total <= this.maxLogBytes)
87
+ break;
88
+ if (this.metadata.get(entry.name)?.activeTaskId && active.has(this.metadata.get(entry.name).activeTaskId))
89
+ continue;
90
+ await rm(join(this.root, entry.name), { force: true });
91
+ total -= entry.size;
92
+ removed.push(entry.name);
93
+ } return Object.freeze(removed); }
94
+ async reachableActiveEvidence(taskId) { const refs = [...(this.activeEvidence.get(taskId) ?? [])]; return Object.freeze((await Promise.all(refs.map(async (ref) => { try {
95
+ await this.readArtifact(ref);
96
+ return ref;
97
+ }
98
+ catch {
99
+ return null;
100
+ } }))).filter((ref) => ref !== null).sort()); }
101
+ async ownerDelete(input) { const activeTasks = new Set(input.activeTaskIds ?? []), deleted = [], retained = []; for (const raw of input.artifactRefs) {
102
+ const ref = safeName(raw), meta = this.metadata.get(ref);
103
+ if (meta?.activeTaskId && activeTasks.has(meta.activeTaskId)) {
104
+ retained.push(ref);
105
+ continue;
106
+ }
107
+ await rm(join(this.root, ref), { force: true });
108
+ this.metadata.delete(ref);
109
+ for (const refs of this.activeEvidence.values())
110
+ refs.delete(ref);
111
+ deleted.push(ref);
112
+ } return Object.freeze({ deleted: Object.freeze(deleted), retained: Object.freeze(retained) }); }
113
+ }
114
+ async function writeAtomic(path, bytes) { const temp = `${path}.${process.pid}.${Date.now()}.tmp`, handle = await open(temp, 'wx', 0o600); try {
115
+ await handle.writeFile(bytes);
116
+ await handle.sync();
117
+ await handle.close();
118
+ await rename(temp, path);
119
+ }
120
+ catch (error) {
121
+ try {
122
+ await handle.close();
123
+ }
124
+ catch { }
125
+ throw error;
126
+ } }
127
+ function safeName(raw) { const name = basename(raw); if (!raw || name !== raw || name === '.' || name === '..' || name.includes('\0'))
128
+ throw new TypeError('invalid local data reference'); return name; }
129
+ function isBackpressure(error) { return typeof error === 'object' && error !== null && 'code' in error && error.code === 'STORAGE_BACKPRESSURE'; }
130
+ //# sourceMappingURL=retention.js.map
@@ -0,0 +1,59 @@
1
+ import type { StorageDatabase } from '../storage/db.js';
2
+ export type ClientRole = 'controller' | 'follower' | 'refused';
3
+ export interface AttachedClient {
4
+ readonly clientId: string;
5
+ readonly role: ClientRole;
6
+ }
7
+ export interface HostHealth {
8
+ readonly running: boolean;
9
+ readonly leaseHolder: string | null;
10
+ readonly fencingEpoch: number | null;
11
+ readonly attachedClients: readonly AttachedClient[];
12
+ readonly clients: readonly AttachedClient[];
13
+ readonly leaseStatus: 'missing' | 'active' | 'expired';
14
+ }
15
+ export interface SupervisorOptions {
16
+ readonly db: StorageDatabase;
17
+ readonly cwd: string;
18
+ readonly ownerId: string;
19
+ readonly sessionId?: string;
20
+ readonly leaseTtlMs: number;
21
+ readonly now?: () => number;
22
+ readonly stateFile?: string;
23
+ }
24
+ export declare class SessionSupervisor {
25
+ private readonly options;
26
+ private readonly leases;
27
+ private lease;
28
+ private running;
29
+ private readonly clients;
30
+ private controllerClient;
31
+ private readonly canonicalCwd;
32
+ private readonly id;
33
+ private readonly resource;
34
+ private readonly statePath;
35
+ private state;
36
+ private readonly clock;
37
+ constructor(options: SupervisorOptions);
38
+ start(now?: number): {
39
+ readonly role: ClientRole;
40
+ readonly fence: number | null;
41
+ };
42
+ attach(clientId: string): {
43
+ readonly clientId: string;
44
+ readonly role: ClientRole;
45
+ readonly state: unknown;
46
+ };
47
+ detach(clientId: string): void;
48
+ shutdown(now?: number): void;
49
+ isRetired(now?: number): boolean;
50
+ isRunning(): boolean;
51
+ authorizeDispatch(now?: number): boolean;
52
+ health(now?: number): HostHealth;
53
+ setSessionState(state: unknown, now?: number): void;
54
+ sessionState(): unknown;
55
+ resourceKey(): string;
56
+ sessionId(): string;
57
+ private current;
58
+ private load;
59
+ }
@@ -0,0 +1,64 @@
1
+ import { realpathSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { createHash } from 'node:crypto';
3
+ import { join } from 'node:path';
4
+ import { LeaseManager } from './leases.js';
5
+ export class SessionSupervisor {
6
+ options;
7
+ leases;
8
+ lease = null;
9
+ running = false;
10
+ clients = new Map();
11
+ controllerClient = null;
12
+ canonicalCwd;
13
+ id;
14
+ resource;
15
+ statePath;
16
+ state = {};
17
+ clock;
18
+ constructor(options) {
19
+ this.options = options;
20
+ this.leases = new LeaseManager(options.db);
21
+ this.canonicalCwd = realpathSync(options.cwd);
22
+ this.id = options.sessionId ?? createHash('sha256').update(this.canonicalCwd).digest('hex').slice(0, 24);
23
+ this.resource = `session:${this.id}`;
24
+ this.statePath = options.stateFile ?? join(this.canonicalCwd, `.ckit-session-${this.id}.json`);
25
+ this.clock = options.now ?? Date.now;
26
+ this.load();
27
+ }
28
+ start(now = this.clock()) { const lease = this.leases.acquire(this.resource, this.options.ownerId, this.options.leaseTtlMs, now); if (!lease) {
29
+ this.running = false;
30
+ return { role: 'follower', fence: null };
31
+ } this.lease = lease; this.running = true; return { role: 'controller', fence: lease.fence }; }
32
+ attach(clientId) { if (!clientId)
33
+ throw new TypeError('clientId required'); const current = this.current(); let role; if (!current)
34
+ role = this.running ? 'follower' : 'refused';
35
+ else if (this.controllerClient === null || this.controllerClient === clientId) {
36
+ this.controllerClient = clientId;
37
+ role = 'controller';
38
+ }
39
+ else
40
+ role = 'follower'; this.clients.set(clientId, role); return Object.freeze({ clientId, role, state: this.sessionState() }); }
41
+ detach(clientId) { this.clients.delete(clientId); }
42
+ shutdown(now = this.clock()) { if (this.lease)
43
+ this.leases.release(this.lease, now); this.lease = null; this.running = false; this.clients.clear(); this.controllerClient = null; }
44
+ isRetired(now = this.clock()) { return !this.lease || !this.leases.isCurrent(this.lease, now); }
45
+ isRunning() { return this.running; }
46
+ authorizeDispatch(now = this.clock()) { return this.running && this.lease !== null && this.leases.isCurrent(this.lease, now); }
47
+ health(now = this.clock()) { const inspection = this.leases.inspect(this.resource, now); const attachedClients = Object.freeze([...this.clients].map(([clientId, role]) => Object.freeze({ clientId, role }))); return Object.freeze({ running: this.authorizeDispatch(now), leaseHolder: inspection.status === 'missing' ? null : inspection.lease.owner, fencingEpoch: inspection.status === 'missing' ? null : inspection.lease.fence, leaseStatus: inspection.status, attachedClients, clients: attachedClients }); }
48
+ setSessionState(state, now = this.clock()) { if (!this.lease)
49
+ throw new Error('host has no controller lease'); const copy = structuredClone(state); const persisted = { sessionId: this.id, state: copy }; this.leases.mutate(this.lease, () => { writeFileSync(this.statePath, JSON.stringify(persisted), 'utf8'); }, now); this.state = copy; }
50
+ sessionState() { return structuredClone(this.state); }
51
+ resourceKey() { return this.resource; }
52
+ sessionId() { return this.id; }
53
+ current() { return this.running && this.lease !== null && this.leases.isCurrent(this.lease, this.clock()); }
54
+ load() { try {
55
+ const saved = JSON.parse(readFileSync(this.statePath, 'utf8'));
56
+ if (saved.sessionId === this.id)
57
+ this.state = saved.state;
58
+ }
59
+ catch (error) {
60
+ if (error.code !== 'ENOENT')
61
+ throw error;
62
+ } }
63
+ }
64
+ //# sourceMappingURL=supervisor.js.map
@@ -0,0 +1,31 @@
1
+ import { type IncomingSourceMessage } from '../core/provenance.js';
2
+ import { RequirementRegistry, type AuthorizationScope } from '../intent/registry.js';
3
+ import type { IntentLedger } from '../intent/ledger.js';
4
+ import type { IdeaLedger } from '../intent/idea-ledger.js';
5
+ import { DurableOutbox } from '../storage/outbox.js';
6
+ import type { ConfirmedConstraint, EchoClassification, IntakeResult, LocalControl, LocalControlResult, OwnerIntakeInput } from './types.js';
7
+ export interface OwnerIntakeDependencies {
8
+ readonly outbox: DurableOutbox;
9
+ readonly intentLedger: IntentLedger;
10
+ readonly ideaLedger: IdeaLedger;
11
+ readonly sessionId: string;
12
+ readonly requirementRegistry?: RequirementRegistry;
13
+ readonly now?: () => Date;
14
+ }
15
+ /** Local, offline intake composition only. This service never dispatches work. */
16
+ export declare class OwnerIntakeService {
17
+ private readonly dependencies;
18
+ private readonly constraints;
19
+ private readonly messages;
20
+ private readonly requirements;
21
+ private readonly now;
22
+ constructor(dependencies: OwnerIntakeDependencies);
23
+ submit(input: OwnerIntakeInput): IntakeResult;
24
+ confirmConstraint(messageId: string, input: {
25
+ readonly id: string;
26
+ readonly scope: AuthorizationScope;
27
+ }): ConfirmedConstraint;
28
+ confirmedConstraints(): readonly ConfirmedConstraint[];
29
+ local(control: LocalControl): LocalControlResult;
30
+ markEcho(message: IncomingSourceMessage, controllerRequestIds: readonly string[]): EchoClassification;
31
+ }