@hasna/infinity 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 (112) hide show
  1. package/LICENSE +3 -0
  2. package/README.md +331 -0
  3. package/dist/cli.js +2965 -0
  4. package/dist/http-api.js +6448 -0
  5. package/dist/index.js +28536 -0
  6. package/dist/migrate.js +346 -0
  7. package/dist/self-hosted-migrate.js +2064 -0
  8. package/dist/self-hosted.js +13180 -0
  9. package/dist/types/authcapsules/codewith-local.d.ts +109 -0
  10. package/dist/types/authcapsules/infinity-agent-policy.d.ts +57 -0
  11. package/dist/types/authcapsules/os-isolated-runner.d.ts +87 -0
  12. package/dist/types/authority/authority.d.ts +342 -0
  13. package/dist/types/authority/effect-journal.d.ts +205 -0
  14. package/dist/types/authority/mutation-journal.d.ts +163 -0
  15. package/dist/types/authority/mutation-tuple.d.ts +26 -0
  16. package/dist/types/authority/state.d.ts +75 -0
  17. package/dist/types/authority/store.d.ts +15 -0
  18. package/dist/types/brokers/checkpoint/archive.d.ts +21 -0
  19. package/dist/types/brokers/checkpoint/bundle.d.ts +22 -0
  20. package/dist/types/brokers/checkpoint/bytes.d.ts +4 -0
  21. package/dist/types/brokers/checkpoint/clean-verifier-finalization.d.ts +62 -0
  22. package/dist/types/brokers/checkpoint/clean-verifier.d.ts +145 -0
  23. package/dist/types/brokers/checkpoint/final-trust-authority.d.ts +55 -0
  24. package/dist/types/brokers/checkpoint/idempotency.d.ts +25 -0
  25. package/dist/types/brokers/checkpoint/journaled-store.d.ts +9 -0
  26. package/dist/types/brokers/checkpoint/manifest-signature.d.ts +135 -0
  27. package/dist/types/brokers/checkpoint/manifest.d.ts +57 -0
  28. package/dist/types/brokers/checkpoint/s3-store.d.ts +215 -0
  29. package/dist/types/brokers/checkpoint/seal-authority.d.ts +86 -0
  30. package/dist/types/brokers/checkpoint/service.d.ts +198 -0
  31. package/dist/types/brokers/checkpoint/signing-message.d.ts +22 -0
  32. package/dist/types/brokers/checkpoint/store.d.ts +76 -0
  33. package/dist/types/brokers/checkpoint/verifier-cleanup-authority.d.ts +108 -0
  34. package/dist/types/brokers/checkpoint/verifier-cleanup.d.ts +391 -0
  35. package/dist/types/brokers/checkpoint/verifier.d.ts +225 -0
  36. package/dist/types/brokers/composition.d.ts +86 -0
  37. package/dist/types/brokers/git/github-app.d.ts +216 -0
  38. package/dist/types/brokers/git/promotion.d.ts +418 -0
  39. package/dist/types/brokers/persistence/contracts.d.ts +77 -0
  40. package/dist/types/brokers/persistence/memory.d.ts +5 -0
  41. package/dist/types/brokers/persistence/migration.d.ts +6 -0
  42. package/dist/types/brokers/persistence/postgres.d.ts +74 -0
  43. package/dist/types/cli/main.d.ts +2 -0
  44. package/dist/types/cli/operation-journal.d.ts +47 -0
  45. package/dist/types/cli/run.d.ts +15 -0
  46. package/dist/types/client/operator-client.d.ts +100 -0
  47. package/dist/types/contracts/dtos.d.ts +198 -0
  48. package/dist/types/contracts/events.d.ts +45 -0
  49. package/dist/types/contracts/fence.d.ts +39 -0
  50. package/dist/types/contracts/operations.d.ts +91 -0
  51. package/dist/types/contracts/runspec.d.ts +75 -0
  52. package/dist/types/contracts/validators.d.ts +8 -0
  53. package/dist/types/core/clock.d.ts +12 -0
  54. package/dist/types/core/errors.d.ts +18 -0
  55. package/dist/types/core/ids.d.ts +10 -0
  56. package/dist/types/core/int64.d.ts +7 -0
  57. package/dist/types/core/strict-json.d.ts +8 -0
  58. package/dist/types/core/validation.d.ts +25 -0
  59. package/dist/types/golden/disposable-task.d.ts +108 -0
  60. package/dist/types/golden/source-pins.d.ts +77 -0
  61. package/dist/types/http/api.d.ts +52 -0
  62. package/dist/types/http/bearer-auth.d.ts +8 -0
  63. package/dist/types/http/main.d.ts +3 -0
  64. package/dist/types/http/self-hosted-main.d.ts +17 -0
  65. package/dist/types/index.d.ts +65 -0
  66. package/dist/types/mcp/schema.d.ts +7 -0
  67. package/dist/types/node-agent/agent.d.ts +174 -0
  68. package/dist/types/node-agent/contracts.d.ts +119 -0
  69. package/dist/types/node-agent/macos-service.d.ts +33 -0
  70. package/dist/types/node-agent/service-cli.d.ts +26 -0
  71. package/dist/types/persistence/composition.d.ts +49 -0
  72. package/dist/types/persistence/migrate-main.d.ts +2 -0
  73. package/dist/types/persistence/migrations.d.ts +30 -0
  74. package/dist/types/persistence/postgres-accounts-operation.d.ts +26 -0
  75. package/dist/types/persistence/postgres-authority.d.ts +69 -0
  76. package/dist/types/persistence/postgres-external-mutation-journal.d.ts +22 -0
  77. package/dist/types/persistence/postgres-json.d.ts +1 -0
  78. package/dist/types/persistence/postgres-mutation-journal.d.ts +31 -0
  79. package/dist/types/persistence/postgres-reconciler.d.ts +34 -0
  80. package/dist/types/persistence/postgres-sandbox-dispatch-authority.d.ts +9 -0
  81. package/dist/types/persistence/self-hosted-migrate-main.d.ts +2 -0
  82. package/dist/types/ports/accounts-operation.d.ts +336 -0
  83. package/dist/types/ports/accounts.d.ts +293 -0
  84. package/dist/types/ports/sandbox-dispatch-authority.d.ts +154 -0
  85. package/dist/types/ports/sandboxes.d.ts +40 -0
  86. package/dist/types/providers/sandbox-dispatch.d.ts +143 -0
  87. package/dist/types/runtime/config.d.ts +61 -0
  88. package/dist/types/runtime/postgres.d.ts +18 -0
  89. package/dist/types/runtime/provider-activation.d.ts +45 -0
  90. package/dist/types/runtime/server.d.ts +68 -0
  91. package/dist/types/testing/accounts-fake.d.ts +31 -0
  92. package/dist/types/testing/fakes.d.ts +2 -0
  93. package/dist/types/testing/node-control-plane-fake.d.ts +20 -0
  94. package/dist/types/testing/reference.d.ts +27 -0
  95. package/dist/types/testing/sandboxes-fake.d.ts +22 -0
  96. package/evidence/provider-live-daytona-v3.json +1 -0
  97. package/evidence/provider-live-e2b-v3.json +1 -0
  98. package/evidence/provider-production-route-daytona-v1.json +1 -0
  99. package/evidence/provider-production-route-e2b-v1.json +1 -0
  100. package/migrations/0001_authority.sql +689 -0
  101. package/migrations/0002_effect_step_global_owner.sql +2 -0
  102. package/migrations/0003_effect_journal_observed_head.sql +34 -0
  103. package/migrations/0004_authority_mutation_journal_binding.sql +15 -0
  104. package/migrations/20260710_checkpoint_broker_v1.sql +163 -0
  105. package/migrations/20260711_accounts_operation_v1.sql +137 -0
  106. package/migrations/20260711_checkpoint_trust_v2.sql +17 -0
  107. package/migrations/20260711_verifier_cleanup_v2.sql +169 -0
  108. package/migrations/20260711_z_accounts_claim_authority_v2.sql +172 -0
  109. package/migrations/20260711_zz_sandbox_dispatch_authority_v1.sql +143 -0
  110. package/migrations/20260712_sandbox_dispatch_authority_v2.sql +58 -0
  111. package/migrations/external-journal/0001_external_authority_mutation_journal.sql +175 -0
  112. package/package.json +47 -0
package/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2026 Hasna. All rights reserved.
2
+
3
+ Private and confidential. Unauthorized use or distribution is prohibited.
package/README.md ADDED
@@ -0,0 +1,331 @@
1
+ # Infinity V1 reference authority
2
+
3
+ `infinity` is a private Bun/TypeScript reference implementation of the frozen
4
+ Infinity V1 Run Authority contract. It deliberately contains no repository
5
+ checkout, task execution, subprocess, Git, provider SDK, credential resolver,
6
+ or arbitrary host-path capability in the authority/API dependency graph.
7
+
8
+ This bootstrap slice provides:
9
+
10
+ - closed RunSpec, semantically checked Run/Attempt/operation/event/outbox DTOs,
11
+ and the versioned full broker-fence wire tuple;
12
+ - a deterministic in-memory authority with permanent admission keys,
13
+ idempotent mutations, queue fairness, immutable attempt/lease history,
14
+ cancellation, retry, exact human discard, approval, and held transactional
15
+ outbox behavior;
16
+ - a deterministic append-only effect journal with stable semantic step IDs,
17
+ immutable execution-record identities, typed outcomes, Ed25519-signed
18
+ contiguous anchors, independently authorized receipts, and stored-member
19
+ `reconciliation_blocked` to `quarantined` mapping;
20
+ - a frozen-shaped Accounts eligibility envelope (including issuer/audience,
21
+ evidence windows, access-target union, request digest, generations, and
22
+ policy evidence) and exact-resource Sandboxes lifecycle ports with
23
+ fail-closed, idempotent deterministic fakes;
24
+ - a versioned PostgreSQL migration, normalized authority tables and constraints,
25
+ separated migration/runtime/reconciler roles, a transactional PostgreSQL
26
+ authority adapter, and restart-safe outbox/effect reconciliation;
27
+ - the fixed-loopback `infinity` CLI, owner-only SQLite pre-dispatch operation
28
+ journal, truthful capability discovery, bounded Run wait/event cursors, and a
29
+ separate local `infinity-api` artifact;
30
+ - a durable Postgres checkpoint/Git broker composition with exact-fence
31
+ idempotency, externally anchored provider effects, signed provenance and
32
+ result-authority boundaries, version-pinned provenance evidence, domain-
33
+ separated prehashed manifest signatures with authority-signed, fresh,
34
+ non-replayable trust observations, append-only revocation history, a
35
+ transaction-locked final trust-head CAS, sealed pre/post/final trust
36
+ witnesses, atomically current-trust-authorized passing receipts, clean
37
+ verification, and currentness-rechecked expected-base GitHub App promotion;
38
+ - a schema-only reviewed MCP tool registry. It has no MCP transport or hidden
39
+ generic mutation route.
40
+
41
+ ## Verify
42
+
43
+ ```sh
44
+ bun install --frozen-lockfile
45
+ bun test
46
+ bun run typecheck
47
+ bun run build
48
+ bun run audit
49
+ ```
50
+
51
+ The PostgreSQL tests are opt-in so the ordinary unit suite remains hermetic.
52
+ Point them at a disposable migrated database to run the live role, constraint,
53
+ API restart, outbox recovery, and signed-frontier cases:
54
+
55
+ ```sh
56
+ INFINITY_TEST_POSTGRES_URL='postgresql://USER@127.0.0.1:5432/DISPOSABLE_DB' bun test tests/postgres-persistence.test.ts
57
+ ```
58
+
59
+ Schema changes use a migration-only connection. The command never prints the
60
+ connection string:
61
+
62
+ ```sh
63
+ INFINITY_MIGRATOR_DATABASE_URL='postgresql://MIGRATOR@DB/INFINITY' bun run migrate
64
+ ```
65
+
66
+ The local API binds only `127.0.0.1` and uses a fixed injected principal. It is
67
+ a development reference, not production authentication or persistence:
68
+
69
+ ```sh
70
+ bun run dist/http-api.js --port 18787
71
+ bun run dist/cli.js --output json doctor
72
+ ```
73
+
74
+ ## Self-hosted runtime
75
+
76
+ `infinity-self-hosted` is the network-bindable control-plane artifact for the
77
+ internal AWS self-hosted deployment. It composes the existing PostgreSQL Run
78
+ Authority with distinct runtime, reconciler, journal-acker, and external
79
+ mutation-journal sessions. It does not execute tasks, spawn subprocesses, load
80
+ plugins, or directly hold provider credentials. The default executable has no
81
+ provider adapter and its provider authorization route fails closed with
82
+ production admission reported as `false`. An embedding executable may call
83
+ `startSelfHostedServer` with explicit E2B/Daytona production-dispatch ports; no
84
+ runtime path or dynamic module is loaded from configuration. These are distinct
85
+ from the authorization-only Sandboxes ports, whose production admission remains
86
+ permanently `false`.
87
+
88
+ The no-contact authorization surface remains
89
+ `POST /v1/sandbox-dispatch-authorizations`. Effectful adapters are reachable
90
+ only through the distinct `POST /v1/production-sandbox-dispatches` surface;
91
+ the default executable configures neither production adapter nor production
92
+ route handler. A configured service allowlists one operator principal, enforces
93
+ that principal before parsing or adapter entry, and advertises
94
+ `sandbox.dispatch.production` only to that principal while the exact activation
95
+ and verified service remain present.
96
+
97
+ The Infinity core remains restricted to a disabled, empty provider-effect
98
+ frontier. Startup rejects any nonzero core frontier, and its signed in-memory
99
+ zero head is only a disabled-state guard. An injected trusted production
100
+ adapter owns provider contact and its separate durable provider-effect journal;
101
+ those effects are not Infinity-core effects.
102
+
103
+ Provider activation is controlled by the closed
104
+ `infinity.provider-production-activation/v1` manifest referenced through
105
+ `INFINITY_PROVIDER_ACTIVATION_MANIFEST_FILE`. Absence means both providers are
106
+ disabled. Each provider has an independent activation request and must match
107
+ the exact Infinity commit, Sandboxes commit, and evidence-manifest SHA-256
108
+ compiled into the artifact. The packaged E2B and Daytona manifests record the
109
+ reviewed receipt-bound live allocation, command, checkpoint-restart, and exact
110
+ cleanup proofs. Both providers still default to disabled; an explicit manifest
111
+ can make only the provider carrying its exact reviewed digest eligible. Stale
112
+ Infinity or Sandboxes pins and arbitrary well-shaped hashes are rejected. This
113
+ eligibility alone does not change production admission. Admission becomes true
114
+ only when the matching verified manifest and an injected production adapter
115
+ both exist. The production gate binds the authenticated principal, dispatch
116
+ request, embedded runtime revision, tested source pins, and adapter artifact
117
+ digest before entering only the selected adapter once. A successful adapter
118
+ result must attest `provider_contacted: true`, preserve every prepared binding,
119
+ and return a provider-effect-journal receipt digest bound to the exact
120
+ admission. Infinity format-checks and binds that digest attestation; the trusted
121
+ adapter owns and verifies the receipt preimage. Authorization-only results
122
+ cannot be relabeled as production dispatches.
123
+
124
+ Startup is deliberately verify-only. Apply the packaged primary and external
125
+ journal migrations with dedicated migration identities before starting the
126
+ service. The service compares the complete primary migration ledger with its
127
+ compiled checksum manifest and refuses traffic on any missing, unknown, or
128
+ changed migration. Runtime identities receive no migration authority on the
129
+ Infinity schemas; broader database hardening remains part of the deployment
130
+ bootstrap and is not claimed by this package.
131
+
132
+ The one-shot `infinity-self-hosted-migrate` artifact applies both immutable
133
+ migration manifests, configures all four NOLOGIN least-privilege role groups,
134
+ and initializes or verifies the external journal's immutable protection tuple.
135
+ It accepts `INFINITY_MIGRATOR_DATABASE_URL_FILE` and
136
+ `INFINITY_EXTERNAL_JOURNAL_MIGRATOR_DATABASE_URL_FILE`; direct migrator URLs are
137
+ rejected. The signing-key file and public journal identity variables are the
138
+ same ones used by the runtime. Close the migration task before starting API
139
+ tasks so its database-owner connections and key material are not resident in
140
+ the serving process.
141
+
142
+ The repository Dockerfile produces only a `linux/arm64` runtime from a
143
+ digest-pinned Bun image. It embeds the exact source revision in both the
144
+ compiled runtime report and the OCI revision label, runs as numeric uid/gid
145
+ `10001`, and is compatible with a read-only root filesystem:
146
+
147
+ ```sh
148
+ docker buildx build --platform linux/arm64 \
149
+ --build-arg INFINITY_BUILD_REVISION="$(git rev-parse HEAD)" \
150
+ -t infinity:self-hosted .
151
+ ```
152
+
153
+ The build accepts no credentials. Runtime secret files must be mounted only
154
+ when the serving or one-shot migration container is started. Override the
155
+ default command with `bun /app/dist/self-hosted-migrate.js` for that migration
156
+ task; do not grant migration identities to the long-running serving task.
157
+
158
+ For the final station01 release check, run the repository-only proof harness:
159
+
160
+ ```sh
161
+ bun scripts/station01-final-proof.ts
162
+ ```
163
+
164
+ The default proof is provider- and model-free. It builds the exact checked-out
165
+ revision, creates distinct disposable primary and external-journal PostgreSQL
166
+ clusters, migrates through owner-only files, starts the self-hosted service on
167
+ a loopback test port with the production activation gate configured, proves
168
+ liveness/readiness/authentication/revision binding, and registers an outbound
169
+ node agent against the in-process control plane. It then stops the service and
170
+ both clusters and removes the private temporary root.
171
+
172
+ `bun scripts/station01-final-proof.ts --describe-hooks` prints the closed hook
173
+ contract for the API, E2B, Daytona, and subscription proof lanes. Hooks remain
174
+ disabled unless both `--run-hooks` and a repository-contained absolute
175
+ `--hook-<lane>=...` executable are supplied. A hook receives one owner-only
176
+ context-file path and must return the closed evidence-manifest result; the
177
+ harness never prints the context, bearer token, database URLs, or hook output.
178
+
179
+ Non-loopback binding requires all of the following non-secret configuration:
180
+
181
+ ```text
182
+ INFINITY_DEPLOYMENT_MODE=self-hosted
183
+ INFINITY_HOST=0.0.0.0
184
+ INFINITY_PORT=8080
185
+ INFINITY_NON_LOOPBACK_ACTIVATION=self-hosted-v1
186
+ INFINITY_STARTUP_MIGRATION_POLICY=verify-only
187
+ INFINITY_BUILD_REVISION=<full 40-character lowercase Git revision>
188
+ ```
189
+
190
+ Database URLs, the operator bearer token, and Ed25519 PKCS8 signing keys are
191
+ accepted only through absolute owner-only regular-file references. Values are
192
+ never emitted in startup errors, the immutable `/v1/runtime` report, request
193
+ audit records, or lifecycle logs:
194
+
195
+ ```text
196
+ INFINITY_RUNTIME_DATABASE_URL_FILE=/run/secrets/infinity-runtime-db-url
197
+ INFINITY_RECONCILER_DATABASE_URL_FILE=/run/secrets/infinity-reconciler-db-url
198
+ INFINITY_JOURNAL_ACKER_DATABASE_URL_FILE=/run/secrets/infinity-journal-acker-db-url
199
+ INFINITY_EXTERNAL_JOURNAL_DATABASE_URL_FILE=/run/secrets/infinity-external-journal-db-url
200
+ INFINITY_OPERATOR_TOKEN_FILE=/run/secrets/infinity-operator-token
201
+ INFINITY_MUTATION_SIGNING_KEY_FILE=/run/secrets/infinity-mutation-signing-key.pem
202
+ INFINITY_EFFECT_SIGNING_KEY_FILE=/run/secrets/infinity-effect-signing-key.pem
203
+ ```
204
+
205
+ Every non-loopback PostgreSQL URL must set `sslmode=verify-full`. The HTTP
206
+ listener expects TLS termination at the internal ALB and an ALB-only task
207
+ security-group ingress rule; it is not safe to expose the task ENI directly.
208
+ Audit records use server-generated request IDs and route templates, never raw
209
+ caller IDs or path parameters.
210
+
211
+ The remaining required values are public stable identities:
212
+
213
+ ```text
214
+ INFINITY_OPERATOR_PRINCIPAL=service:self-hosted-operator
215
+ INFINITY_AUTHORITY_RESTORE_DOMAIN_ID=restore-domain:authority:production
216
+ INFINITY_EXTERNAL_JOURNAL_ID=journal:authority:production
217
+ INFINITY_EXTERNAL_JOURNAL_RESTORE_DOMAIN_ID=restore-domain:journal:production
218
+ INFINITY_EFFECT_JOURNAL_RESTORE_DOMAIN_ID=restore-domain:effect:production
219
+ INFINITY_MUTATION_SIGNER_PRINCIPAL=service:authority-journal
220
+ INFINITY_MUTATION_SIGNING_KEY_ID=authority-journal-key-v1
221
+ INFINITY_EFFECT_SIGNER_PRINCIPAL=service:effect-journal
222
+ INFINITY_EFFECT_SIGNING_KEY_ID=effect-journal-key-v1
223
+ ```
224
+
225
+ `GET /health/live` and `GET /health/ready` are the only unauthenticated routes.
226
+ Readiness stays closed until composition recovery completes, and then probes
227
+ all four database sessions, the immutable migration ledger, pending mutation
228
+ journal protection/head state, and the signed disabled-effect head. All `/v1/*`
229
+ routes, including `/v1/runtime`, require `Authorization: Bearer …`. SIGTERM
230
+ immediately removes readiness, stops accepting new requests, drains the Bun
231
+ server, and closes every PostgreSQL pool.
232
+
233
+ The CLI endpoint is fixed to `http://127.0.0.1:18787`; argv cannot override it.
234
+ Structured RunSpecs use `--spec -` (stdin) only. Before network dispatch, every
235
+ mutation is durably bound to its complete local tuple under
236
+ `~/.local/state/infinity/operator-journal.sqlite` with owner-only permissions.
237
+
238
+ Machine commands emit one `infinity.operator/v1` JSON or JSONL envelope. Mutations
239
+ require explicit caller-observed authority epoch, revision/Attempt fencing as
240
+ applicable, and an idempotency key. Never-leased Attempts omit the lease tuple;
241
+ leased and post-lease Attempts carry an exact positive tuple and never use
242
+ zero/null sentinels. The trusted CLI edge creates the opaque operation ID;
243
+ `operation resolve` accepts only that ID.
244
+
245
+ ## Trusted-local subscription AuthCapsules
246
+
247
+ The AuthCapsule surface keeps an owner's existing Codewith authentication
248
+ profile on its attested subscription host. Infinity stores only a closed
249
+ owner/node/generation descriptor; it never stores or transfers the profile,
250
+ token, cookie, key, auth file, or credential path. API-key and workload-identity
251
+ lanes remain sandbox-native and cannot be converted into AuthCapsules.
252
+
253
+ For an admitted native-session lane, the launcher verifies the actual Codewith
254
+ binary, runtime profile, and canonical measured `infinity-agent` policy, uses
255
+ an empty workspace, passes the task prompt on stdin, and pins the named auth
256
+ profile without changing the active login. It requires Codewith's closed native
257
+ AuthCapsule capability attestation before it opens the bridge or starts a model
258
+ turn; older builds with local shell/filesystem tools fail closed. A required online-authority port
259
+ rechecks Accounts denial/generations and the full run/attempt/lease/resource
260
+ fence before a protected bridge is opened. The bridge is bound to the exact
261
+ Sandboxes dispatch, canonical intent, prepare anchor, authority envelope,
262
+ effect claim, provider, input/source manifests, and checkpoint policy.
263
+ Repository files, edits, and commands remain remote sandbox operations exposed
264
+ only by that narrow bridge.
265
+
266
+ For reusable subscription credentials without modifying Codewith, run the
267
+ launcher inside an isolated capsule. `LinuxBubblewrapCapsuleProvider` supplies
268
+ an executable user/mount/PID/network-namespace implementation: it mounts no
269
+ host repository, persists only the capsule root, and mounts the measured
270
+ managed requirements at `/etc/codewith/requirements.toml`. Those requirements
271
+ must deny model tools read access to `/capsule/codewith/auth_profiles`.
272
+ `MacOsVmSubscriptionCapsuleProvider` defines the corresponding closed adapter
273
+ contract for Tart, Lume, or a direct Virtualization.framework service. The VM
274
+ image owns the persistent login and preprovisioned protected broker route; each
275
+ task sends only the prompt. Attestation is bound to the Accounts capsule digest,
276
+ capsule/node/placement/auth generations, and Codewith binary measurement.
277
+
278
+ This package supplies the descriptor, validation, launch contracts, public API,
279
+ and `infinity auth-capsule descriptor|binding --spec -` validation commands.
280
+ Production admission additionally requires the capsule's measured
281
+ `infinity-agent` policy, managed deny-read requirements, and protected bridge;
282
+ ordinary Codewith local tools or the `full` policy are prohibited on a
283
+ credential-bearing host or VM.
284
+
285
+ ## Outbound subscription-host node agent
286
+
287
+ `NodeAgentDaemon` is the V1 trusted node-side protocol boundary. A Mac opens an
288
+ outbound connection through the injected mTLS transport, pins the control-plane
289
+ SPKI and Ed25519 command key, registers measured capsule capabilities and
290
+ generations, and sends heartbeats. It accepts only closed signed launch/revoke
291
+ commands bound to the exact owner, node, capsule, placement/auth generations,
292
+ lease epoch, and live broker fence. Commands explicitly carry neither a
293
+ credential nor a repository; `IsolatedRunnerNodeCapsuleRuntime` forwards the
294
+ closed launch tuple to the existing OS-isolated AuthCapsule runner without a
295
+ caller-selected path, mount, argv, environment, endpoint, or credential.
296
+
297
+ `DurableNodeAgentJournal` atomically persists a command claim before capsule
298
+ effects, maintains monotonic replay and revocation fences, and requires runtime
299
+ reconciliation for an incomplete claim after restart. Receipts and structured
300
+ audit events contain only identifiers, digests, generations, outcomes, and exit
301
+ status—not prompts or process output. `MacOsLaunchdService` renders and manages
302
+ both per-user LaunchAgent and system LaunchDaemon artifacts through an injected
303
+ host port; tests use the in-process control plane and fake launchd host and do
304
+ not mutate a fleet.
305
+
306
+ Embedding executables use the closed `runNodeAgentServiceCli` surface with four
307
+ short commands: `run`, `install --scope user|system ...`,
308
+ `status --scope user|system`, and `uninstall --scope user|system`.
309
+ `ComposedNodeAgentServiceCliRuntime` wires those commands only to an already
310
+ constructed daemon and launchd host, so the CLI cannot dynamically load code or
311
+ turn a config file into a new trust boundary.
312
+
313
+ ## Deliberate limits
314
+
315
+ The local API executable still uses the deterministic authority and fixed test
316
+ principal. The separate self-hosted artifact composes `PostgresRunAuthority`,
317
+ `PostgresReconciler`, and authenticated transport through
318
+ `createPostgresAuthorityComposition`. External authority
319
+ epoch, mutation-journal, and effect-journal services are mandatory composition
320
+ dependencies. PostgreSQL composition rejects transient mutation journals and
321
+ pins the durable journal identity and restore domain in the authority database;
322
+ every restart must reopen that same independently durable journal. The effect
323
+ journal must expose an encrypted, restore-domain-separated
324
+ source with fresh challenge-signed head/range receipts; startup imports only its
325
+ verified missing suffix before admitting API traffic. Real authentication/WebAuthn, production
326
+ attestation trust roots and online deny checks, brokers, checkpoint storage,
327
+ clean verification, Git promotion, managed provider adapters, production AWS
328
+ and GitHub clients, node transport, and MCP transport remain injected,
329
+ separately reviewed boundaries. The package does not read ambient provider
330
+ credentials or perform a live deployment by itself. No legacy implementation
331
+ or history is included.