@pulse-compute/cli 0.0.0 → 1.0.0-beta.2

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 (191) hide show
  1. package/API.md +572 -0
  2. package/CHANGELOG.md +71 -0
  3. package/README.md +71 -1
  4. package/bin/pulse.js +15 -0
  5. package/bin/pulsewasm-extract.js +22 -0
  6. package/cli-spec.json +575 -0
  7. package/completions/_pulse +106 -0
  8. package/completions/pulse.bash +31 -0
  9. package/completions/pulse.fish +76 -0
  10. package/docs/README.md +77 -0
  11. package/docs/architecture/current-contracts.md +470 -0
  12. package/docs/architecture/overview.md +93 -0
  13. package/docs/architecture/vision.md +515 -0
  14. package/docs/concepts/bodies.md +186 -0
  15. package/docs/concepts/compilation-and-lowering.md +496 -0
  16. package/docs/concepts/contracts-and-providers.md +158 -0
  17. package/docs/concepts/effects-and-continuations.md +300 -0
  18. package/docs/concepts/entities-and-adapters.md +71 -0
  19. package/docs/concepts/package-owned-lowering.md +175 -0
  20. package/docs/concepts/targets-and-hosts.md +70 -0
  21. package/docs/contributing/README.md +38 -0
  22. package/docs/contributing/adding-core-provider.md +315 -0
  23. package/docs/contributing/adding-first-party-lowerer.md +327 -0
  24. package/docs/contributing/entities-lowering.md +91 -0
  25. package/docs/contributing/package-lowerer-contract.md +383 -0
  26. package/docs/contributing/pulse-aware-packages.md +149 -0
  27. package/docs/examples.md +112 -0
  28. package/docs/fixtures/inspect-fetch-composition.selected.json +181 -0
  29. package/docs/getting-started.md +128 -0
  30. package/docs/guides/compatibility-imports.md +60 -0
  31. package/docs/guides/deploying-fastly.md +188 -0
  32. package/docs/guides/deploying-node.md +143 -0
  33. package/docs/guides/events.md +233 -0
  34. package/docs/guides/fastly-capabilities.md +153 -0
  35. package/docs/guides/fetching-and-composition.md +101 -0
  36. package/docs/guides/grip.md +94 -0
  37. package/docs/guides/json-schemas.md +233 -0
  38. package/docs/guides/migrating-from-express.md +192 -0
  39. package/docs/guides/project-lifecycle.md +143 -0
  40. package/docs/guides/routing.md +202 -0
  41. package/docs/guides/troubleshooting.md +47 -0
  42. package/docs/maintainers/README.md +60 -0
  43. package/docs/maintainers/codex-maintainer.md +71 -0
  44. package/docs/maintainers/documentation-deployment.md +147 -0
  45. package/docs/maintainers/documentation-system.md +58 -0
  46. package/docs/maintainers/documentation-versioning.md +65 -0
  47. package/docs/maintainers/maintainer-charter.md +100 -0
  48. package/docs/maintainers/maintenance-policy.json +809 -0
  49. package/docs/maintainers/maintenance-policy.md +124 -0
  50. package/docs/maintainers/npm-publishing.md +154 -0
  51. package/docs/maintainers/plugin-readiness.json +19 -0
  52. package/docs/maintainers/plugin-readiness.md +31 -0
  53. package/docs/maintainers/public-site.md +158 -0
  54. package/docs/maintainers/release-acceptance.md +293 -0
  55. package/docs/maintainers/release-manifest.md +89 -0
  56. package/docs/maintainers/repository-setup.md +145 -0
  57. package/docs/maintainers/scope-policy.md +105 -0
  58. package/docs/maintainers/support-and-triage.md +74 -0
  59. package/docs/maintainers/testing.md +334 -0
  60. package/docs/packages/README.md +60 -0
  61. package/docs/packages/assets.md +85 -0
  62. package/docs/packages/cli.md +190 -0
  63. package/docs/packages/crypto.md +78 -0
  64. package/docs/packages/entities.md +129 -0
  65. package/docs/packages/grip.md +82 -0
  66. package/docs/packages/implementation-packages.md +122 -0
  67. package/docs/packages/jwt.md +55 -0
  68. package/docs/packages/provider-fastly.md +243 -0
  69. package/docs/packages/pulse.md +159 -0
  70. package/docs/packages/runtime.md +265 -0
  71. package/docs/packages/s3.md +101 -0
  72. package/docs/preview-scope.md +142 -0
  73. package/docs/reference/README.md +33 -0
  74. package/docs/reference/cli-spec.json +575 -0
  75. package/docs/reference/cli.md +457 -0
  76. package/docs/reference/compatibility-matrix.md +169 -0
  77. package/docs/reference/diagnostics.md +1872 -0
  78. package/docs/reference/documentation-versions.json +22 -0
  79. package/docs/reference/environment.md +347 -0
  80. package/docs/reference/handler-authoring.md +264 -0
  81. package/docs/reference/project-config.md +582 -0
  82. package/docs/reference/project-config.schema.json +981 -0
  83. package/docs/reference/release-manifest.json +441 -0
  84. package/docs/reference/shell-completion.md +23 -0
  85. package/documentation-site.json +668 -0
  86. package/documentation-versions.json +22 -0
  87. package/examples/01-hello-json/.pulse/.gitignore +3 -0
  88. package/examples/01-hello-json/.pulse/config.ts +16 -0
  89. package/examples/01-hello-json/README.md +119 -0
  90. package/examples/01-hello-json/package.json +20 -0
  91. package/examples/01-hello-json/src/index.ts +9 -0
  92. package/examples/01-hello-json/tests/pulse.harness.ts +22 -0
  93. package/examples/01-hello-json/tsconfig.json +14 -0
  94. package/examples/02-request-schema/.pulse/.gitignore +3 -0
  95. package/examples/02-request-schema/.pulse/config.ts +17 -0
  96. package/examples/02-request-schema/README.md +145 -0
  97. package/examples/02-request-schema/package.json +20 -0
  98. package/examples/02-request-schema/src/index.ts +18 -0
  99. package/examples/02-request-schema/src/schemas.ts +20 -0
  100. package/examples/02-request-schema/tests/pulse.harness.ts +37 -0
  101. package/examples/02-request-schema/tsconfig.json +14 -0
  102. package/examples/03-fetch-composition/.pulse/.gitignore +3 -0
  103. package/examples/03-fetch-composition/.pulse/config.ts +31 -0
  104. package/examples/03-fetch-composition/README.md +210 -0
  105. package/examples/03-fetch-composition/package.json +20 -0
  106. package/examples/03-fetch-composition/src/index.ts +60 -0
  107. package/examples/03-fetch-composition/tests/pulse.harness.ts +47 -0
  108. package/examples/03-fetch-composition/tsconfig.json +14 -0
  109. package/examples/05-fastly-capabilities/.pulse/.gitignore +3 -0
  110. package/examples/05-fastly-capabilities/.pulse/config.ts +57 -0
  111. package/examples/05-fastly-capabilities/README.md +257 -0
  112. package/examples/05-fastly-capabilities/package.json +22 -0
  113. package/examples/05-fastly-capabilities/src/index.ts +55 -0
  114. package/examples/05-fastly-capabilities/tests/pulse.harness.ts +66 -0
  115. package/examples/05-fastly-capabilities/tsconfig.json +14 -0
  116. package/examples/07-opaque-proxy/.pulse/.gitignore +3 -0
  117. package/examples/07-opaque-proxy/.pulse/config.ts +38 -0
  118. package/examples/07-opaque-proxy/README.md +150 -0
  119. package/examples/07-opaque-proxy/package.json +21 -0
  120. package/examples/07-opaque-proxy/src/index.ts +9 -0
  121. package/examples/07-opaque-proxy/tests/pulse.harness.ts +25 -0
  122. package/examples/07-opaque-proxy/tsconfig.json +14 -0
  123. package/examples/09-router-lowering/.pulse/.gitignore +3 -0
  124. package/examples/09-router-lowering/.pulse/config.ts +22 -0
  125. package/examples/09-router-lowering/README.md +287 -0
  126. package/examples/09-router-lowering/package.json +22 -0
  127. package/examples/09-router-lowering/src/index.ts +65 -0
  128. package/examples/09-router-lowering/tests/pulse.harness.ts +91 -0
  129. package/examples/09-router-lowering/tsconfig.json +14 -0
  130. package/examples/10-entities-tools/.pulse/.gitignore +4 -0
  131. package/examples/10-entities-tools/.pulse/config.ts +23 -0
  132. package/examples/10-entities-tools/README.md +165 -0
  133. package/examples/10-entities-tools/package.json +21 -0
  134. package/examples/10-entities-tools/src/handlers.ts +15 -0
  135. package/examples/10-entities-tools/src/index.ts +31 -0
  136. package/examples/10-entities-tools/src/schemas.ts +18 -0
  137. package/examples/10-entities-tools/tests/pulse.harness.ts +40 -0
  138. package/examples/10-entities-tools/tools-facade.cjs +158 -0
  139. package/examples/10-entities-tools/tsconfig.json +14 -0
  140. package/examples/11-events/.pulse/.gitignore +4 -0
  141. package/examples/11-events/.pulse/config.ts +24 -0
  142. package/examples/11-events/README.md +194 -0
  143. package/examples/11-events/package.json +20 -0
  144. package/examples/11-events/src/index.ts +27 -0
  145. package/examples/11-events/src/schemas.ts +19 -0
  146. package/examples/11-events/tests/pulse.harness.ts +34 -0
  147. package/examples/11-events/tsconfig.json +15 -0
  148. package/examples/12-mcp-proxy/.pulse/.gitignore +3 -0
  149. package/examples/12-mcp-proxy/.pulse/config.ts +25 -0
  150. package/examples/12-mcp-proxy/README.md +149 -0
  151. package/examples/12-mcp-proxy/package.json +20 -0
  152. package/examples/12-mcp-proxy/src/index.ts +17 -0
  153. package/examples/12-mcp-proxy/tests/pulse.harness.ts +29 -0
  154. package/examples/12-mcp-proxy/tsconfig.json +14 -0
  155. package/examples/13-jwt-es256/.pulse/config.ts +19 -0
  156. package/examples/13-jwt-es256/README.md +195 -0
  157. package/examples/13-jwt-es256/package.json +21 -0
  158. package/examples/13-jwt-es256/src/index.ts +21 -0
  159. package/examples/13-jwt-es256/tests/pulse.harness.ts +54 -0
  160. package/examples/13-jwt-es256/tsconfig.json +14 -0
  161. package/examples/README.md +36 -0
  162. package/package.json +66 -6
  163. package/project-config.schema.json +981 -0
  164. package/release-manifest.json +441 -0
  165. package/src/command-spec.js +279 -0
  166. package/src/completion.js +113 -0
  167. package/src/diagnostics.js +350 -0
  168. package/src/documentation.js +45 -0
  169. package/src/index.d.ts +133 -0
  170. package/src/index.js +15 -0
  171. package/src/internal/command-executor.d.ts +29 -0
  172. package/src/internal/command-executor.js +143 -0
  173. package/src/internal/command-plan.d.ts +9 -0
  174. package/src/internal/command-plan.js +73 -0
  175. package/src/internal/command-reporter.d.ts +15 -0
  176. package/src/internal/command-reporter.js +133 -0
  177. package/src/internal/command-request.d.ts +35 -0
  178. package/src/internal/command-request.js +154 -0
  179. package/src/internal/node-http.js +54 -0
  180. package/src/internal/project-context.d.ts +66 -0
  181. package/src/internal/project-context.js +175 -0
  182. package/src/project-config-reference.js +4 -0
  183. package/src/project-config-schema.d.ts +23 -0
  184. package/src/project-config-schema.js +271 -0
  185. package/src/project-config.js +724 -0
  186. package/src/project-execution.js +2946 -0
  187. package/src/provider-drivers.js +3 -0
  188. package/src/target-support.js +3 -0
  189. package/src/typescript-module-loader.js +269 -0
  190. package/src/workflow.js +78 -0
  191. package/src/workspace.js +82 -0
@@ -0,0 +1,470 @@
1
+ # Current architecture contracts
2
+
3
+ This page is the present-tense map of Pulse's architectural commitments. It
4
+ defines ownership and invariants; the linked concept, contributor, governance,
5
+ and release pages define the detailed behavior and evidence.
6
+
7
+ The current source, machine-readable catalogs, and executable acceptance suites
8
+ are authoritative together. Git and sealed release checkpoints preserve why the
9
+ contracts changed; numbered decision records are not part of the active
10
+ documentation system.
11
+
12
+ ## Contract precedence
13
+
14
+ When two surfaces appear to disagree, use this order:
15
+
16
+ 1. the public release manifest and its generated package/support policy define
17
+ what is shipped and supported;
18
+ 2. canonical runtime, compiler, package, and provider contracts define behavior;
19
+ 3. executable conformance and release gates prove that behavior;
20
+ 4. current public and contributor documentation explains the supported contract;
21
+ 5. examples demonstrate the contract but do not widen it.
22
+
23
+ Generated references and installed CLI documentation must be regenerated from
24
+ their canonical owners. An internal module, resolvable export, retained fixture,
25
+ or historical implementation does not become a public compatibility promise.
26
+
27
+ ## One application contract and one compiler spine
28
+
29
+ `@pulse-compute/runtime` owns the low-level portable handler, context, effect,
30
+ body, and static `Router` contract. `@pulse-compute/pulse` owns the conventional
31
+ `Pulse` application root, project configuration helpers, schema declarations,
32
+ and runtime type re-exports. Applications import normal package roots and do not
33
+ select providers through application-package export conditions.
34
+
35
+ Plain handlers, the `Pulse` application root, and static Router authoring are
36
+ frontends to one deterministic whole-project compiler:
37
+
38
+ ```text
39
+ root extraction
40
+ → reachable-module graph
41
+ → authoring and Router topology normalization
42
+ → semantic classification and contract validation
43
+ → canonical Handler IR
44
+ → effects, continuations, schemas, and package operations
45
+ → provider-neutral Native plan
46
+ → selected provider realization
47
+ ```
48
+
49
+ The compiler has one internal, fixed phase order. It does not expose a mutable
50
+ visitor framework or accept runtime rule registration. Frontends may retain
51
+ their own topology while normalizing handler bodies into the same canonical IR.
52
+ Provider realization begins only after the complete reachable program and its
53
+ capability requirements are known.
54
+
55
+ HTTP Router authoring supports static `get`, `head`, `post`, `put`, `patch`,
56
+ and `delete` registrations, inherited by `Pulse`. The owned Router API registry
57
+ defines compiler admission; topology and lifecycle method catalogs derive from
58
+ that registry. Each verb uses the existing route entry, exact-method dispatch,
59
+ terminal transfer and 404/500 exhaustion contracts. This expands ingress
60
+ registration without changing outgoing fetch methods or the effect/continuation
61
+ ABI.
62
+
63
+ The compiler also recognizes root-only `Pulse.on(type, { schema }, handler)`
64
+ declarations as a separate static event topology. Event types and schema IDs
65
+ must be literal, schema IDs must resolve through the project registry, each
66
+ type has one owner, and event handlers receive the same checkout-independent
67
+ canonical handler identity used by HTTP handlers. The resulting event catalog
68
+ is inspectable and enters a plane-neutral application-entry table without
69
+ becoming a Router route. Event handlers use exact event selection,
70
+ schema-validated `ctx.event.payload`, shared non-HTTP context operations, void
71
+ completion, and execution-owned failure.
72
+
73
+ The transport-free JavaScript runtime host can directly execute one canonical
74
+ event frame against a live Pulse application. Provider-neutral Native plans can
75
+ lower the same eligible event handlers through the conditional
76
+ `pulse.native-event-abi.v1` extension. Event-only artifacts expose the event
77
+ entry; mixed artifacts retain the separate HTTP and event entries; HTTP-only
78
+ artifacts add no event imports, exports, code, catalog data, or byte changes.
79
+ The Native host validates and detaches the frame and schema payload before
80
+ entering the module, passes an artifact-local event runtime ID plus a host-owned
81
+ payload handle, and drives the existing effect/continuation state machine to
82
+ void completion or bounded failure. Event input never masquerades as an HTTP
83
+ request, no Promise or Asyncify runtime is linked, and no target probing or
84
+ fallback occurs. Node now supplies a bounded invocation-scoped reference
85
+ adapter around this entry for direct JavaScript/Native parity. It is not a
86
+ public listener, process-global bus, or production transport; Fastly, browser,
87
+ and ESP32 event realizations remain unclaimed.
88
+
89
+ Each JavaScript or Native event invocation owns its state, effects,
90
+ cancellation, redaction, logging, completion, and disposal. HTTP and event
91
+ handlers may await the shared one-way `ctx.emit(type, { schema, payload? })`
92
+ effect in JavaScript and Native runtimes. Compilation requires literal event and
93
+ schema identities, validates schemas against the project registry, records
94
+ deterministic callsite/capability requirements, and accepts emission inside an
95
+ awaited `ctx.parallel` group. Runtime dispatch validates and detaches the frame
96
+ before a trusted adapter sees it; public observations redact the payload. The
97
+ bounded Node reference adapter owns a FIFO ingress queue and an independent
98
+ exact-frame outbound acceptance ledger. It serializes instance entry,
99
+ propagates cancellation/failure categories, and never invokes a matching local
100
+ handler. Native `event.emit` lowers through the canonical effect and
101
+ continuation protocol with zero JavaScript/Asyncify imports. None of this
102
+ implies delivery, a receipt, persistence, retry, a public provider listener, or
103
+ automatic target fallback. Router lifecycle `on`, channel, and
104
+ connect/disconnect semantics remain retired.
105
+
106
+ The event contract reserves no `call` surface: there is no `ctx.call`,
107
+ application call method, generic call effect, adapter operation, compiler
108
+ opcode, or runtime capability. `ctx.emit` is strictly one-way and cannot enter
109
+ local dispatch. Any request/reply or reflexive routing mechanism must arrive as
110
+ a separately reviewed host, lifecycle, recursion, and failure contract rather
111
+ than an interpretation of the current event plane. See [Static events and
112
+ outbound emission](../guides/events.md).
113
+
114
+ Project discovery is graph-based rather than substring-based. Module identity is
115
+ path-independent and deterministic, resolver inputs are fixed, and only
116
+ reachable project modules and package roots participate in compilation,
117
+ eligibility, and packaging. Static ESM links supported project modules; Pulse
118
+ does not become a general TypeScript bundler or execute arbitrary application
119
+ JavaScript during Native compilation.
120
+
121
+ See [Compilation and lowering](../concepts/compilation-and-lowering.md) and the
122
+ [architecture overview](./overview.md).
123
+
124
+ ## Execution ownership
125
+
126
+ Pulse-provided host authority is explicit. Fetch, config, secrets, KV, GRIP,
127
+ assets, and future host operations enter the program as canonical capabilities
128
+ or package operations. Pulse does not expose provider SDK objects, ambient
129
+ process state, or hidden host namespaces through the handler context.
130
+
131
+ Native execution erases managed async notation into explicit effects and
132
+ single-use continuations. JavaScript targets execute the same application
133
+ contract through an execution-owned effect adapter. An HTTP request and each
134
+ direct JavaScript or provider-neutral Native event invocation create one
135
+ isolated execution.
136
+ Cancellation, grouped settlement, deterministic failure selection,
137
+ continuation expiry, duplicate resume or completion rejection, secret
138
+ redaction, and completion are contained by that owner. Event contexts reuse the
139
+ shared state, logging, fetch, parallel, config, secret, KV, and outbound event
140
+ authority but do
141
+ not expose a Request, Response, route parameters, Router transfer, middleware,
142
+ or response builders.
143
+
144
+ Conditional KV is owned by the portable runtime authoring/host contract.
145
+ `kv.getVersioned`, `kv.insertIfAbsent`, and `kv.compareAndSwap` lower through the
146
+ ordinary effect and continuation machinery, including Native value handles.
147
+ The Node reference supplies one explicit local key authority; provider
148
+ preparation and the send boundary remain distinct so unconfirmed writes preserve
149
+ `unknown`. The Native host imports the existing workspace runtime owner rather
150
+ than duplicating its validation, snapshots, limits, or outcome normalization.
151
+ The Fastly Native provider realizes conditional KV directly through its host ABI,
152
+ with lossless generations, conditional options, bounded metadata/body reads and
153
+ readiness deadlines. Its AssemblyScript limits come from the runtime owner; the
154
+ shared corpus checks its wire and outcome semantics. Fastly JavaScript remains
155
+ incomplete capability mapping. Deployed acceptance remains a separate gate. See [conditional KV](../concepts/effects-and-continuations.md#conditional-kv).
156
+
157
+ `ctx.parallel({ ... })` is the explicit cross-target concurrency form. Router
158
+ `next()` and `next(error)` are terminal cursor transfers, not onion-style calls:
159
+ no application code resumes after the transfer. Normal exhaustion produces
160
+ 404, error exhaustion produces 500, and effects keep the identity of the route
161
+ or middleware entry that owns them.
162
+
163
+ Structured JSON and text bodies become bounded values. Binary and streaming
164
+ bodies remain opaque host-owned handles. An opaque body can be passed through or
165
+ returned by a supported operation, but it cannot be decoded, duplicated, or
166
+ independently consumed by application or package code.
167
+
168
+ See [Effects and continuations](../concepts/effects-and-continuations.md),
169
+ [routing](../guides/routing.md), and
170
+ [structured and opaque bodies](../concepts/bodies.md).
171
+
172
+ ## Providers, targets, and eligibility
173
+
174
+ Target selection is explicit and never falls back automatically. Target support
175
+ and project eligibility answer different questions:
176
+
177
+ - target support records whether a provider/target lane satisfies its declared
178
+ runtime, capability, packaging, tooling, and conformance gates;
179
+ - project eligibility records whether the reachable program can use that lane.
180
+
181
+ A generally available target can reject an ineligible project. A passing local
182
+ runtime does not claim that an external deployment, binding, service, or
183
+ provider control plane is healthy.
184
+
185
+ The selected target reaches project linking and handler validation explicitly.
186
+ For `javascript`, resolved static package imports and project-relative helper
187
+ imports remain source-runtime boundaries; they do not acquire Native lowerer
188
+ authority. Canonical application topology, schemas, effect-await rules, graph
189
+ containment and entry lifecycle checks still apply. An ordinary imported async
190
+ call may be awaited in a JavaScript handler. Native compilation continues to
191
+ reject unsupported imports and awaits, including when graph eligibility is
192
+ requested in record-only mode.
193
+
194
+ JavaScript compilation returns canonical inspection metadata without an
195
+ executable normalized generator. The provider's graph-backed loader and source
196
+ packager execute the original module closure with its JavaScript async semantics.
197
+ Inspection describes recognized Pulse effects; it does not infer effects inside
198
+ ordinary dependency implementations or certify their isolation. An ordinary
199
+ JavaScript import gains no compiler/lowerer authority or Native guest sandbox
200
+ guarantee. Native inspection compiles the source
201
+ independently under Native rules. Its failure is advisory for a selected
202
+ JavaScript target; `pulse compile` still requires a real Native compilation.
203
+
204
+ Provider packages own descriptors, configuration normalization, local
205
+ execution, target generation, source packaging, deployment bindings, and target
206
+ support policy. The compiler owns the neutral bootstrap, contract validation,
207
+ the compile-only `none` driver, and shared evidence composition. The CLI carries
208
+ provider identity as data and does not import or branch on concrete provider
209
+ implementations.
210
+
211
+ Provider bootstrap is exact and fail-closed:
212
+
213
+ - bare host ID `x` resolves by convention to `@pulse-compute/provider-x`;
214
+ - an exact scoped package name resolves from the project;
215
+ - `none` selects the internal compile-only driver;
216
+ - every package provider must export the versioned `./toolchain` contract.
217
+
218
+ Pulse does not scan dependencies, inspect keywords, run self-registration hooks,
219
+ try alternate package names, or substitute another provider or target. A
220
+ selected provider toolchain is trusted build code running in the Pulse process;
221
+ do not run it from an untrusted project tree.
222
+
223
+ The compiler-to-provider seam is exact. A selected package exports one
224
+ versioned toolchain whose zero-argument `createDriver()` returns a versioned
225
+ driver. Shared contracts validate the complete callable surface and normalize
226
+ every selected target descriptor before configuration, compilation, or
227
+ packaging uses it. A supported Native target must carry its final-Wasm policy;
228
+ an absent method, unknown field/version, provider/target identity mismatch, or
229
+ automatic-fallback claim fails during bootstrap.
230
+
231
+ Provider planning receives a versioned projection of canonical capabilities and
232
+ operations, never compiler metadata or lowerer output. Target realization then
233
+ receives one immutable invocation containing the canonical Native or JavaScript
234
+ application plan, canonical provider plan, selected target, normalized provider
235
+ configuration, explicit capability/binding/package requirements, explicit
236
+ project/package facts, and—when Native—the copied final Wasm whose hash and
237
+ guest-link packaging authorization have already been checked. It does not
238
+ contain a TypeScript AST/service, compiler cache, builder, mutable manifest,
239
+ compiled-program object, raw target option bag, or alternate target.
240
+
241
+ Native realization and JavaScript source packaging are normalized into
242
+ versioned, data-only results before the CLI consumes them. Provider packaging
243
+ must report the same artifact identity authorized by the final guest audit.
244
+ Provider-specific legacy proof builders are confined to an explicit
245
+ CLI/testing composition root and are not reachable from compiler internals or
246
+ the provider target invocation.
247
+
248
+ See [Contracts and providers](../concepts/contracts-and-providers.md) and
249
+ [Add a core provider](../contributing/adding-core-provider.md).
250
+
251
+ ## Package-owned capabilities
252
+
253
+ Normal package roots are canonical for application authors. JavaScript targets
254
+ execute the package implementation; supported Native targets recognize the
255
+ same root symbols and lower the accepted subset into canonical package
256
+ operations. Compatibility subpaths do not define the recommended surface.
257
+
258
+ Product metadata, application exports, executable compiler authority, and
259
+ provider realization are separate owners:
260
+
261
+ - `pulse.package.json` describes product, target, ownership, and conformance
262
+ metadata and cannot execute compiler code;
263
+ - a trusted compiler manifest and builder own static recognition, diagnostics,
264
+ payloads, and optional sidecar ABI;
265
+ - shared contracts own versioned operation and result semantics;
266
+ - providers own host realization.
267
+
268
+ The feature-to-compiler seam is exact. The library kit constructs a versioned,
269
+ immutable builder invocation from documented source-recognition inputs; it
270
+ does not forward caller option bags. The builder's package-owned artifact and
271
+ contributions are normalized into a versioned result envelope before compiler
272
+ orchestration. Shared package contracts reject unknown fields, owner/version
273
+ mismatches, nondeterministic order, and mutable canonical operations.
274
+
275
+ Package builders emit provider-neutral capability and crypto requirements.
276
+ They do not receive provider drivers, target descriptors, runtime objects,
277
+ resolved secrets, raw CLI configuration, compiler caches, or arbitrary
278
+ TypeScript programs/services. Target eligibility begins after canonical
279
+ requirements exist.
280
+
281
+ Package effects require an explicit `PulseContext` and use the same
282
+ request-owned bridge as core effects. There is no ambient current request,
283
+ mutable global registration, or package-specific scheduler.
284
+
285
+ The Beta executes lowerers only from synchronized first-party
286
+ packages. Explicit provider toolchains are the narrow exception that may load a
287
+ selected project package; they do not enable dependency scanning or plugin
288
+ self-registration and do not widen lowerer trust. A general plugin API remains
289
+ unavailable until the machine-readable readiness gates for provenance,
290
+ discovery, negotiation, security, compatibility, and isolated loading are
291
+ implemented and release gated.
292
+
293
+ See [Package-owned lowering](../concepts/package-owned-lowering.md), the
294
+ [package lowerer contract](../contributing/package-lowerer-contract.md), and
295
+ [plugin readiness](../maintainers/plugin-readiness.md).
296
+
297
+ ## Internal prebuilt guest units
298
+
299
+ Native compilation may select a synchronized first-party prebuilt core-Wasm
300
+ guest unit contributed by a trusted package lowerer. The compiler resolves the
301
+ selection and target policy, then delegates validation, content-addressed
302
+ materialization, static composition, post-link optimization, final binary
303
+ audit, provenance, and normalized diagnostics to
304
+ `@pulse-compute/wasm-guest-link`.
305
+
306
+ The guest-link stage owns its versioned invocation and result identities. Its
307
+ input contains one exact normalized guest contribution, a separately projected
308
+ package root, primary Wasm bytes, synchronized package versions, and explicit
309
+ profile, optimization, and final-Wasm policy facts. It does not receive a
310
+ compiler realization, target descriptor, option bag, provider object, AST, or
311
+ compiler service. Its result contains exact final Wasm/text bytes, normalized
312
+ plan/report/audit records, artifact identity, packaging authorization, and an
313
+ explicit no-fallback disposition. The compiler integration module only
314
+ projects and rejoins those exact values.
315
+
316
+ Guest linking runs after the primary AssemblyScript module is compiled and
317
+ before the exact audited artifact enters provider packaging. The initial
318
+ contract is deliberately closed: one package-prebuilt unit, one fixed
319
+ link-stage-owned memory, borrowed bounded input, MVP features, no start
320
+ function, no allocation or pointer retention, no undeclared imports, and no
321
+ fallback. `.pulse/guests/` is generated, content-addressed,
322
+ non-authoritative, and reproducible after deletion.
323
+
324
+ Only synchronized first-party package identity is trusted. Manifests contain
325
+ normalized metadata and hashes, never executable commands. A failed selected
326
+ unit stops compilation before provider packaging; it cannot choose a different
327
+ realization or substitute the primary or a JavaScript output. Source builds,
328
+ local guest overrides, dynamic loading,
329
+ self-registration, arbitrary guest imports, and public third-party guest APIs
330
+ do not exist.
331
+
332
+ This is an implementation seam rather than an application-author API. A future
333
+ component-model composition engine may replace the current core-Wasm linker
334
+ without moving package semantics into the compiler or widening the trust model.
335
+
336
+ ## JWT verification
337
+
338
+ The synchronized `1.0.0-beta.2` JWT/crypto packages compose
339
+ `@pulse-compute/jwt` over the lower-level, provider-neutral verification
340
+ contract owned by `@pulse-compute/crypto`. The executable algorithm set is
341
+ HS256 and ES256. Crypto verifies a MAC or signature over caller-supplied bytes
342
+ and returns a closed status category; JWT owns compact-JWS structure, strict
343
+ protected-header and public-key rules, configured registered claims, optional
344
+ schema validation, and the detached immutable application result. Neither
345
+ layer exposes backend objects, raw error text, key material, messages,
346
+ authenticators, or unauthenticated claims.
347
+
348
+ Reachable package requirements are checked against the active profile's
349
+ `pulse.crypto` declaration and the selected target's exact realization.
350
+ Profile declarations replace the global declaration as a whole; arrays and
351
+ objects do not merge. An empty declaration enables no algorithms. An unknown,
352
+ missing, unavailable, or failed realization stops with a normalized diagnostic
353
+ and never authorizes fallback.
354
+
355
+ For JWT verification, JavaScript targets select `runtime-builtin` and use Web Crypto with explicit
356
+ HMAC/SHA-256 or ECDSA/P-256/SHA-256 parameters. The crypto boundary receives a
357
+ normalized 64-byte P-256 point; its JavaScript adapter validates that point and
358
+ constructs the runtime-private JWK used for import. Native HS256 selects
359
+ `guest-source:pulse-hmac-as`, compiling first-party AssemblyScript into the
360
+ primary module, while Native ES256 selects the audited
361
+ `guest-linked:pulse-es256-rustcrypto-p256` unit. Neither algorithm retries a
362
+ different realization.
363
+
364
+ S3 operations require exact `SHA-256` and `HMAC-SHA256` selection. Native
365
+ composes the same Crypto-owned source once; Node JavaScript explicitly selects
366
+ Crypto's `runtime-builtin` Web Crypto byte realization through the trusted
367
+ `@pulse-compute/crypto/provider` export. Both return 32-byte results, cap data
368
+ at 32 KiB and HMAC keys at 8 KiB, and snapshot and wipe staging inputs. Native
369
+ also checks guest memory ranges. JWT verification retains its separate limits.
370
+ No target probes or falls back to a different realization.
371
+
372
+ The supported-extension `@pulse-compute/s3` package owns `head`, `getText` and `putText`,
373
+ literal binding/options authority, runtime key/text lowering, SigV4 composition
374
+ and bounded results. Node and Fastly own fixed endpoint/bucket/region mappings,
375
+ credential lookup, deadlines and transport. Fastly requires a static backend.
376
+ Reads and writes bypass cache, disable decompression and redirects, preserve
377
+ exact bytes and do not retry. PUT distinguishes pre-dispatch failure and
378
+ complete rejection (`not-stored`) from unconfirmed dispatched writes (`unknown`).
379
+ Only a complete 200 acknowledgement with a bounded empty body yields `stored`;
380
+ its digest describes sent bytes, not durability. Request cancellation retains
381
+ existing lifecycle behavior and does not fabricate a typed S3 outcome. Fastly
382
+ pending requests lack a cancel ABI; invocation termination owns their release.
383
+
384
+ One canonical consumer exercises Node Native, Node JavaScript and Fastly Native
385
+ PUT/HEAD/GET, integrity, bounded acknowledgements and cancellation. Fastly Native
386
+ runs compiled Wasm against a host ABI fixture. This is local evidence, not live
387
+ Object Storage proof. Fastly JavaScript remains ineligible: its SDK projects raw
388
+ response headers, losing multiplicity and aggregate-size evidence required by
389
+ O1. The provider-specific limitation is documented in `wasm/test/s3/O3.md` and
390
+ does not gate supported targets. O4 adds S3 to the synchronized release package
391
+ set and repeats the three-target read/write corpus against isolated exact
392
+ tarballs, including package-owned lowering. These are local candidate checks;
393
+ live origin acceptance follows T2. Assets alignment remains separate.
394
+
395
+ Package redaction declarations survive Handler IR projection into the Native
396
+ plan. Native host effect traces omit declared private payloads and results;
397
+ applications still control their own response and logging use of returned data.
398
+
399
+ All four target classes—Node JavaScript, Fastly JavaScript, Node Native, and
400
+ Fastly Native—execute the same HS256 semantics. ES256 adds exact default and
401
+ size-oriented Native artifact cells, producing a six-cell 38-case matrix:
402
+ Node JavaScript, Fastly JavaScript under Viceroy, two Node Native artifacts,
403
+ and two Fastly Native artifacts. Authenticity completes before clock capture,
404
+ registered claims run before schema validation, and failure never selects a
405
+ different algorithm, realization, target, or provider.
406
+
407
+ The observed proof is sealed by
408
+ `wasm/.test-results/jwt-d4/jwt-phase-d-seal.json` and
409
+ `wasm/.test-results/jwt-e4/jwt-phase-e-seal.json`; the aligned ES256 target
410
+ matrix is recorded in
411
+ `wasm/.test-results/boundary-h4/es256-six-cell-matrix.json`. The package
412
+ relationship is recorded in
413
+ `wasm/test/jwt/contracts/jwt-crypto-working-candidate.json`. Providers and the
414
+ runtime remain explicit integration inputs. Validation does not itself
415
+ publish, promote, deploy, or activate the release.
416
+
417
+ ## Support, release, and authority
418
+
419
+ Pulse `1.0.0-beta.2` is a Beta intended for the `beta` channel.
420
+ Documented, evidence-backed behavior is intentional, but public surfaces may
421
+ change deliberately before a compatibility-bearing release. Unsupported
422
+ behavior fails explicitly, historical and implementation subpaths gain no
423
+ accidental guarantee, and released package names, versions, and artifacts are
424
+ immutable.
425
+
426
+ Package support comes from `release/pulse-release-manifest.json`; provider
427
+ support and project eligibility come from their versioned evidence. Local
428
+ validation prepares evidence but does not authorize merge, tagging, npm
429
+ publication, documentation promotion, provider deployment, or service
430
+ activation.
431
+
432
+ Publication uses sealed package candidates, protected human-approved
433
+ environments, npm trusted publishing, immutable exact-version documentation,
434
+ and resumable promotion without bucket-wide deletion. Human CODEOWNERS retain
435
+ architecture, merge, repository-setting, and release authority. Codex may
436
+ analyze, review, reproduce, and prepare bounded patches; deterministic checks
437
+ remain authoritative even when Codex is unavailable.
438
+
439
+ A protected-path match requires a boundary declaration and review; it does not
440
+ establish that the patch changes that boundary's semantics. Human direction
441
+ already supplied for a bounded task covers its necessary implementation, tests,
442
+ canonical documentation, regeneration and PR preparation. The PR records that
443
+ direction and any remaining decision. A new semantic or authority change beyond
444
+ the authorized scope requires new direction. Implementation approval does not
445
+ transfer merge, publication, deployment or self-approval authority.
446
+
447
+ Validation claims distinguish injected hosts, local Compute engines, standalone
448
+ live probes and deployed Pulse artifacts. SDK capability mappings and observed
449
+ provider discrepancies do not redefine Pulse's contract. Required acceptance
450
+ gates remain separate from the aggregate release command; their status and any
451
+ human-directed policy changes must be explicit before claiming release readiness.
452
+
453
+ See the [maintainer charter](../maintainers/maintainer-charter.md),
454
+ [release acceptance](../maintainers/release-acceptance.md),
455
+ [npm publishing](../maintainers/npm-publishing.md), and
456
+ [documentation deployment](../maintainers/documentation-deployment.md).
457
+
458
+ ## Changing a contract
459
+
460
+ A material change to a protected boundary requires explicit human direction and
461
+ must update the current contract at its canonical owner. The same change must
462
+ update affected machine-readable catalogs, diagnostics, generated references,
463
+ tests, conformance evidence, and release acceptance. Do not add a chronological
464
+ decision file as a substitute for updating current truth.
465
+
466
+ The maintenance classifier reports whether a current contract update is
467
+ required for the inferred boundaries. The pull request must name those
468
+ boundaries, expose the human decision, and explain the resulting contract change
469
+ where reviewers can evaluate it. Git history and sealed checkpoints retain the
470
+ superseded state.
@@ -0,0 +1,93 @@
1
+ # Architecture overview
2
+
3
+ Pulse keeps the user model small by separating semantics from realization.
4
+ The [current architecture contracts](./current-contracts.md) are the
5
+ authoritative present-tense map of the ownership and invariants summarized
6
+ below.
7
+
8
+ ```text
9
+ handler source
10
+ → canonical compiler analysis
11
+ → schema and trusted package lowering
12
+ → explicit effect and continuation program
13
+ → provider capability contract and lowering plan
14
+ → provider runtime or target
15
+ ```
16
+
17
+ ## Canonical API
18
+
19
+ `@pulse-compute/runtime` contains the provider-neutral application contract, plain handler types, and the static `Router` authoring marker. `ctx` is the sole user authority. Start with the [runtime package guide](../packages/runtime.md).
20
+
21
+ ## Whole-project compiler
22
+
23
+ The project compiler analyzes the handler, compiles explicitly declared JSON schemas, invokes trusted first-party package-owned lowerers such as GRIP and assets, links literal references, and emits one canonical program. It does not run arbitrary user JavaScript. See [Compilation and lowering](../concepts/compilation-and-lowering.md).
24
+
25
+ ## Lifecycle
26
+
27
+ Host operations become explicit effects. The runtime owns continuation creation,
28
+ grouped joins, resume, failure, expiry, and completion. Handlers are
29
+ async-shaped across targets: Native lowering erases managed wrappers and lowers
30
+ trusted awaits into effects and continuations, while JavaScript targets execute
31
+ the same contract through an execution-owned runtime that isolates each HTTP
32
+ request or direct event invocation. Eligible event handlers also lower into a
33
+ provider-neutral Native application entry with exact event selection, a
34
+ schema-validated host-owned payload handle, void completion, and the same
35
+ effect/continuation state machine. The conditional event ABI appears only in
36
+ event-reachable artifacts and remains separate from the HTTP entry.
37
+
38
+ The runtime treats `ctx.emit` as a schema-bound, one-way acceptance effect: it
39
+ is execution-owned, parallel-eligible, and never loops back into local event
40
+ dispatch. Native uses the same effect/continuation protocol without JavaScript
41
+ or Asyncify imports. Node declares explicit event ingress/emit capabilities and
42
+ owns a bounded FIFO reference adapter for direct JavaScript/Native parity; this
43
+ is not a public event bus or production transport. Other provider realization
44
+ and ordinary workflow eligibility remain separate work. The event plane
45
+ reserves no call/request-reply operation and cannot route an emitted frame back
46
+ into local handlers. See [Static events and outbound
47
+ emission](../guides/events.md) and [Effects and
48
+ continuations](../concepts/effects-and-continuations.md).
49
+
50
+ ## Bodies
51
+
52
+ Structured text/JSON bodies become bounded values. Binary and streaming bodies remain opaque host-owned handles and may only be routed or returned through supported operations. See [Structured and opaque bodies](../concepts/bodies.md).
53
+
54
+ ## Providers
55
+
56
+ Providers validate and realize canonical operations. They do not add SDK objects or provider namespaces to user scope.
57
+
58
+ - Node provides explicit Native and JavaScript execution, build, local lifecycle
59
+ evidence, and an invocation-scoped reference event ingress/acceptance adapter.
60
+ - Fastly provides explicit Native and JavaScript packaging and execution
61
+ candidates, plus a mandatory external `fastly compute serve` reality gate for
62
+ the final release candidate.
63
+ - `none` is compile-only and cannot execute handlers.
64
+
65
+ A descriptor, local runtime, target build, external reality gate, and remote
66
+ deployment are different proof levels. Target selection is explicit and never
67
+ falls back automatically. See
68
+ [Contracts and providers](../concepts/contracts-and-providers.md).
69
+
70
+ ## Package extensions
71
+
72
+ Domain packages own their narrow package-root facade-to-contract mapping and
73
+ compiler builder. Shared contracts own payload/status semantics. Compiler core
74
+ owns trusted discovery and orchestration; providers own realization.
75
+
76
+ The current release accepts only first-party builders and does not expose an
77
+ external plugin API. Older `/pulsewasm` imports are isolated in the
78
+ [compatibility migration guide](../guides/compatibility-imports.md). See
79
+ [First-party package-owned lowerer workflow](../contributing/adding-first-party-lowerer.md).
80
+
81
+
82
+ ## Maintenance authority
83
+
84
+ `release/maintenance-policy.json` classifies change intent, protected boundaries, validation, and resident-maintainer authority. Deterministic checks remain authoritative; Codex can analyze, review, and prepare bounded patches, while human CODEOWNERS retain architecture, merge, repository-setting, and release authority. See [Maintainer governance](../maintainers/README.md).
85
+
86
+ ## Current architecture and extension readiness
87
+
88
+ The current compilation, effect, provider, and trusted-lowerer boundaries are
89
+ documented in the [current architecture contracts](./current-contracts.md) and
90
+ the linked concept pages. The generated [public plugin API readiness
91
+ record](../maintainers/plugin-readiness.md) keeps third-party plugin design deferred until
92
+ trust, discovery, negotiation, security, compatibility, and isolated loading
93
+ are implemented and release-gated.