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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/API.md +539 -0
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +70 -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 +381 -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 +243 -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 +62 -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 +184 -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 +84 -0
  48. package/docs/maintainers/maintenance-policy.json +778 -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 +250 -0
  55. package/docs/maintainers/release-manifest.md +88 -0
  56. package/docs/maintainers/repository-setup.md +145 -0
  57. package/docs/maintainers/scope-policy.md +93 -0
  58. package/docs/maintainers/support-and-triage.md +74 -0
  59. package/docs/maintainers/testing.md +288 -0
  60. package/docs/packages/README.md +59 -0
  61. package/docs/packages/assets.md +85 -0
  62. package/docs/packages/cli.md +190 -0
  63. package/docs/packages/crypto.md +71 -0
  64. package/docs/packages/entities.md +129 -0
  65. package/docs/packages/grip.md +82 -0
  66. package/docs/packages/implementation-packages.md +113 -0
  67. package/docs/packages/jwt.md +55 -0
  68. package/docs/packages/provider-fastly.md +217 -0
  69. package/docs/packages/pulse.md +159 -0
  70. package/docs/packages/runtime.md +256 -0
  71. package/docs/preview-scope.md +142 -0
  72. package/docs/reference/README.md +33 -0
  73. package/docs/reference/cli-spec.json +575 -0
  74. package/docs/reference/cli.md +457 -0
  75. package/docs/reference/compatibility-matrix.md +169 -0
  76. package/docs/reference/diagnostics.md +1872 -0
  77. package/docs/reference/documentation-versions.json +14 -0
  78. package/docs/reference/environment.md +347 -0
  79. package/docs/reference/handler-authoring.md +264 -0
  80. package/docs/reference/project-config.md +554 -0
  81. package/docs/reference/project-config.schema.json +918 -0
  82. package/docs/reference/release-manifest.json +427 -0
  83. package/docs/reference/shell-completion.md +23 -0
  84. package/documentation-site.json +661 -0
  85. package/documentation-versions.json +14 -0
  86. package/examples/01-hello-json/.pulse/.gitignore +3 -0
  87. package/examples/01-hello-json/.pulse/config.ts +16 -0
  88. package/examples/01-hello-json/README.md +119 -0
  89. package/examples/01-hello-json/package.json +20 -0
  90. package/examples/01-hello-json/src/index.ts +9 -0
  91. package/examples/01-hello-json/tests/pulse.harness.ts +22 -0
  92. package/examples/01-hello-json/tsconfig.json +14 -0
  93. package/examples/02-request-schema/.pulse/.gitignore +3 -0
  94. package/examples/02-request-schema/.pulse/config.ts +17 -0
  95. package/examples/02-request-schema/README.md +145 -0
  96. package/examples/02-request-schema/package.json +20 -0
  97. package/examples/02-request-schema/src/index.ts +18 -0
  98. package/examples/02-request-schema/src/schemas.ts +20 -0
  99. package/examples/02-request-schema/tests/pulse.harness.ts +37 -0
  100. package/examples/02-request-schema/tsconfig.json +14 -0
  101. package/examples/03-fetch-composition/.pulse/.gitignore +3 -0
  102. package/examples/03-fetch-composition/.pulse/config.ts +31 -0
  103. package/examples/03-fetch-composition/README.md +210 -0
  104. package/examples/03-fetch-composition/package.json +20 -0
  105. package/examples/03-fetch-composition/src/index.ts +60 -0
  106. package/examples/03-fetch-composition/tests/pulse.harness.ts +47 -0
  107. package/examples/03-fetch-composition/tsconfig.json +14 -0
  108. package/examples/05-fastly-capabilities/.pulse/.gitignore +3 -0
  109. package/examples/05-fastly-capabilities/.pulse/config.ts +57 -0
  110. package/examples/05-fastly-capabilities/README.md +257 -0
  111. package/examples/05-fastly-capabilities/package.json +22 -0
  112. package/examples/05-fastly-capabilities/src/index.ts +55 -0
  113. package/examples/05-fastly-capabilities/tests/pulse.harness.ts +66 -0
  114. package/examples/05-fastly-capabilities/tsconfig.json +14 -0
  115. package/examples/07-opaque-proxy/.pulse/.gitignore +3 -0
  116. package/examples/07-opaque-proxy/.pulse/config.ts +38 -0
  117. package/examples/07-opaque-proxy/README.md +150 -0
  118. package/examples/07-opaque-proxy/package.json +21 -0
  119. package/examples/07-opaque-proxy/src/index.ts +9 -0
  120. package/examples/07-opaque-proxy/tests/pulse.harness.ts +25 -0
  121. package/examples/07-opaque-proxy/tsconfig.json +14 -0
  122. package/examples/09-router-lowering/.pulse/.gitignore +3 -0
  123. package/examples/09-router-lowering/.pulse/config.ts +22 -0
  124. package/examples/09-router-lowering/README.md +287 -0
  125. package/examples/09-router-lowering/package.json +22 -0
  126. package/examples/09-router-lowering/src/index.ts +65 -0
  127. package/examples/09-router-lowering/tests/pulse.harness.ts +91 -0
  128. package/examples/09-router-lowering/tsconfig.json +14 -0
  129. package/examples/10-entities-tools/.pulse/.gitignore +4 -0
  130. package/examples/10-entities-tools/.pulse/config.ts +23 -0
  131. package/examples/10-entities-tools/README.md +165 -0
  132. package/examples/10-entities-tools/package.json +21 -0
  133. package/examples/10-entities-tools/src/handlers.ts +15 -0
  134. package/examples/10-entities-tools/src/index.ts +31 -0
  135. package/examples/10-entities-tools/src/schemas.ts +18 -0
  136. package/examples/10-entities-tools/tests/pulse.harness.ts +40 -0
  137. package/examples/10-entities-tools/tools-facade.cjs +158 -0
  138. package/examples/10-entities-tools/tsconfig.json +14 -0
  139. package/examples/11-events/.pulse/.gitignore +4 -0
  140. package/examples/11-events/.pulse/config.ts +24 -0
  141. package/examples/11-events/README.md +194 -0
  142. package/examples/11-events/package.json +20 -0
  143. package/examples/11-events/src/index.ts +27 -0
  144. package/examples/11-events/src/schemas.ts +19 -0
  145. package/examples/11-events/tests/pulse.harness.ts +34 -0
  146. package/examples/11-events/tsconfig.json +15 -0
  147. package/examples/12-mcp-proxy/.pulse/.gitignore +3 -0
  148. package/examples/12-mcp-proxy/.pulse/config.ts +25 -0
  149. package/examples/12-mcp-proxy/README.md +149 -0
  150. package/examples/12-mcp-proxy/package.json +20 -0
  151. package/examples/12-mcp-proxy/src/index.ts +17 -0
  152. package/examples/12-mcp-proxy/tests/pulse.harness.ts +29 -0
  153. package/examples/12-mcp-proxy/tsconfig.json +14 -0
  154. package/examples/13-jwt-es256/.pulse/config.ts +19 -0
  155. package/examples/13-jwt-es256/README.md +195 -0
  156. package/examples/13-jwt-es256/package.json +21 -0
  157. package/examples/13-jwt-es256/src/index.ts +21 -0
  158. package/examples/13-jwt-es256/tests/pulse.harness.ts +54 -0
  159. package/examples/13-jwt-es256/tsconfig.json +14 -0
  160. package/examples/README.md +36 -0
  161. package/package.json +66 -6
  162. package/project-config.schema.json +918 -0
  163. package/release-manifest.json +427 -0
  164. package/src/command-spec.js +279 -0
  165. package/src/completion.js +113 -0
  166. package/src/diagnostics.js +350 -0
  167. package/src/documentation.js +45 -0
  168. package/src/index.d.ts +133 -0
  169. package/src/index.js +15 -0
  170. package/src/internal/command-executor.d.ts +29 -0
  171. package/src/internal/command-executor.js +143 -0
  172. package/src/internal/command-plan.d.ts +9 -0
  173. package/src/internal/command-plan.js +73 -0
  174. package/src/internal/command-reporter.d.ts +15 -0
  175. package/src/internal/command-reporter.js +133 -0
  176. package/src/internal/command-request.d.ts +35 -0
  177. package/src/internal/command-request.js +154 -0
  178. package/src/internal/node-http.js +54 -0
  179. package/src/internal/project-context.d.ts +66 -0
  180. package/src/internal/project-context.js +175 -0
  181. package/src/project-config-reference.js +4 -0
  182. package/src/project-config-schema.d.ts +23 -0
  183. package/src/project-config-schema.js +271 -0
  184. package/src/project-config.js +724 -0
  185. package/src/project-execution.js +2930 -0
  186. package/src/provider-drivers.js +3 -0
  187. package/src/target-support.js +3 -0
  188. package/src/typescript-module-loader.js +269 -0
  189. package/src/workflow.js +78 -0
  190. package/src/workspace.js +82 -0
@@ -0,0 +1,381 @@
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
+ The compiler also recognizes root-only `Pulse.on(type, { schema }, handler)`
56
+ declarations as a separate static event topology. Event types and schema IDs
57
+ must be literal, schema IDs must resolve through the project registry, each
58
+ type has one owner, and event handlers receive the same checkout-independent
59
+ canonical handler identity used by HTTP handlers. The resulting event catalog
60
+ is inspectable and enters a plane-neutral application-entry table without
61
+ becoming a Router route. Event handlers use exact event selection,
62
+ schema-validated `ctx.event.payload`, shared non-HTTP context operations, void
63
+ completion, and execution-owned failure.
64
+
65
+ The transport-free JavaScript runtime host can directly execute one canonical
66
+ event frame against a live Pulse application. Provider-neutral Native plans can
67
+ lower the same eligible event handlers through the conditional
68
+ `pulse.native-event-abi.v1` extension. Event-only artifacts expose the event
69
+ entry; mixed artifacts retain the separate HTTP and event entries; HTTP-only
70
+ artifacts add no event imports, exports, code, catalog data, or byte changes.
71
+ The Native host validates and detaches the frame and schema payload before
72
+ entering the module, passes an artifact-local event runtime ID plus a host-owned
73
+ payload handle, and drives the existing effect/continuation state machine to
74
+ void completion or bounded failure. Event input never masquerades as an HTTP
75
+ request, no Promise or Asyncify runtime is linked, and no target probing or
76
+ fallback occurs. Node now supplies a bounded invocation-scoped reference
77
+ adapter around this entry for direct JavaScript/Native parity. It is not a
78
+ public listener, process-global bus, or production transport; Fastly, browser,
79
+ and ESP32 event realizations remain unclaimed.
80
+
81
+ Each JavaScript or Native event invocation owns its state, effects,
82
+ cancellation, redaction, logging, completion, and disposal. HTTP and event
83
+ handlers may await the shared one-way `ctx.emit(type, { schema, payload? })`
84
+ effect in JavaScript and Native runtimes. Compilation requires literal event and
85
+ schema identities, validates schemas against the project registry, records
86
+ deterministic callsite/capability requirements, and accepts emission inside an
87
+ awaited `ctx.parallel` group. Runtime dispatch validates and detaches the frame
88
+ before a trusted adapter sees it; public observations redact the payload. The
89
+ bounded Node reference adapter owns a FIFO ingress queue and an independent
90
+ exact-frame outbound acceptance ledger. It serializes instance entry,
91
+ propagates cancellation/failure categories, and never invokes a matching local
92
+ handler. Native `event.emit` lowers through the canonical effect and
93
+ continuation protocol with zero JavaScript/Asyncify imports. None of this
94
+ implies delivery, a receipt, persistence, retry, a public provider listener, or
95
+ automatic target fallback. Router lifecycle `on`, channel, and
96
+ connect/disconnect semantics remain retired.
97
+
98
+ The event contract reserves no `call` surface: there is no `ctx.call`,
99
+ application call method, generic call effect, adapter operation, compiler
100
+ opcode, or runtime capability. `ctx.emit` is strictly one-way and cannot enter
101
+ local dispatch. Any request/reply or reflexive routing mechanism must arrive as
102
+ a separately reviewed host, lifecycle, recursion, and failure contract rather
103
+ than an interpretation of the current event plane. See [Static events and
104
+ outbound emission](../guides/events.md).
105
+
106
+ Project discovery is graph-based rather than substring-based. Module identity is
107
+ path-independent and deterministic, resolver inputs are fixed, and only
108
+ reachable project modules and package roots participate in compilation,
109
+ eligibility, and packaging. Static ESM links supported project modules; Pulse
110
+ does not become a general TypeScript bundler or execute arbitrary application
111
+ JavaScript during Native compilation.
112
+
113
+ See [Compilation and lowering](../concepts/compilation-and-lowering.md) and the
114
+ [architecture overview](./overview.md).
115
+
116
+ ## Execution ownership
117
+
118
+ Host authority is explicit. Fetch, config, secrets, KV, GRIP, assets, and future
119
+ host operations enter the program as canonical capabilities or package
120
+ operations. Provider SDK objects, ambient process state, and hidden host
121
+ namespaces do not enter handler scope.
122
+
123
+ Native execution erases managed async notation into explicit effects and
124
+ single-use continuations. JavaScript targets execute the same application
125
+ contract through an execution-owned effect adapter. An HTTP request and each
126
+ direct JavaScript or provider-neutral Native event invocation create one
127
+ isolated execution.
128
+ Cancellation, grouped settlement, deterministic failure selection,
129
+ continuation expiry, duplicate resume or completion rejection, secret
130
+ redaction, and completion are contained by that owner. Event contexts reuse the
131
+ shared state, logging, fetch, parallel, config, secret, KV, and outbound event
132
+ authority but do
133
+ not expose a Request, Response, route parameters, Router transfer, middleware,
134
+ or response builders.
135
+
136
+ `ctx.parallel({ ... })` is the explicit cross-target concurrency form. Router
137
+ `next()` and `next(error)` are terminal cursor transfers, not onion-style calls:
138
+ no application code resumes after the transfer. Normal exhaustion produces
139
+ 404, error exhaustion produces 500, and effects keep the identity of the route
140
+ or middleware entry that owns them.
141
+
142
+ Structured JSON and text bodies become bounded values. Binary and streaming
143
+ bodies remain opaque host-owned handles. An opaque body can be passed through or
144
+ returned by a supported operation, but it cannot be decoded, duplicated, or
145
+ independently consumed by application or package code.
146
+
147
+ See [Effects and continuations](../concepts/effects-and-continuations.md),
148
+ [routing](../guides/routing.md), and
149
+ [structured and opaque bodies](../concepts/bodies.md).
150
+
151
+ ## Providers, targets, and eligibility
152
+
153
+ Target selection is explicit and never falls back automatically. Target support
154
+ and project eligibility answer different questions:
155
+
156
+ - target support records whether a provider/target lane satisfies its declared
157
+ runtime, capability, packaging, tooling, and conformance gates;
158
+ - project eligibility records whether the reachable program can use that lane.
159
+
160
+ A generally available target can reject an ineligible project. A passing local
161
+ runtime does not claim that an external deployment, binding, service, or
162
+ provider control plane is healthy.
163
+
164
+ Provider packages own descriptors, configuration normalization, local
165
+ execution, target generation, source packaging, deployment bindings, and target
166
+ support policy. The compiler owns the neutral bootstrap, contract validation,
167
+ the compile-only `none` driver, and shared evidence composition. The CLI carries
168
+ provider identity as data and does not import or branch on concrete provider
169
+ implementations.
170
+
171
+ Provider bootstrap is exact and fail-closed:
172
+
173
+ - bare host ID `x` resolves by convention to `@pulse-compute/provider-x`;
174
+ - an exact scoped package name resolves from the project;
175
+ - `none` selects the internal compile-only driver;
176
+ - every package provider must export the versioned `./toolchain` contract.
177
+
178
+ Pulse does not scan dependencies, inspect keywords, run self-registration hooks,
179
+ try alternate package names, or substitute another provider or target. A
180
+ selected provider toolchain is trusted build code running in the Pulse process;
181
+ do not run it from an untrusted project tree.
182
+
183
+ The compiler-to-provider seam is exact. A selected package exports one
184
+ versioned toolchain whose zero-argument `createDriver()` returns a versioned
185
+ driver. Shared contracts validate the complete callable surface and normalize
186
+ every selected target descriptor before configuration, compilation, or
187
+ packaging uses it. A supported Native target must carry its final-Wasm policy;
188
+ an absent method, unknown field/version, provider/target identity mismatch, or
189
+ automatic-fallback claim fails during bootstrap.
190
+
191
+ Provider planning receives a versioned projection of canonical capabilities and
192
+ operations, never compiler metadata or lowerer output. Target realization then
193
+ receives one immutable invocation containing the canonical Native or JavaScript
194
+ application plan, canonical provider plan, selected target, normalized provider
195
+ configuration, explicit capability/binding/package requirements, explicit
196
+ project/package facts, and—when Native—the copied final Wasm whose hash and
197
+ guest-link packaging authorization have already been checked. It does not
198
+ contain a TypeScript AST/service, compiler cache, builder, mutable manifest,
199
+ compiled-program object, raw target option bag, or alternate target.
200
+
201
+ Native realization and JavaScript source packaging are normalized into
202
+ versioned, data-only results before the CLI consumes them. Provider packaging
203
+ must report the same artifact identity authorized by the final guest audit.
204
+ Provider-specific legacy proof builders are confined to an explicit
205
+ CLI/testing composition root and are not reachable from compiler internals or
206
+ the provider target invocation.
207
+
208
+ See [Contracts and providers](../concepts/contracts-and-providers.md) and
209
+ [Add a core provider](../contributing/adding-core-provider.md).
210
+
211
+ ## Package-owned capabilities
212
+
213
+ Normal package roots are canonical for application authors. JavaScript targets
214
+ execute the package implementation; supported Native targets recognize the
215
+ same root symbols and lower the accepted subset into canonical package
216
+ operations. Compatibility subpaths do not define the recommended surface.
217
+
218
+ Product metadata, application exports, executable compiler authority, and
219
+ provider realization are separate owners:
220
+
221
+ - `pulse.package.json` describes product, target, ownership, and conformance
222
+ metadata and cannot execute compiler code;
223
+ - a trusted compiler manifest and builder own static recognition, diagnostics,
224
+ payloads, and optional sidecar ABI;
225
+ - shared contracts own versioned operation and result semantics;
226
+ - providers own host realization.
227
+
228
+ The feature-to-compiler seam is exact. The library kit constructs a versioned,
229
+ immutable builder invocation from documented source-recognition inputs; it
230
+ does not forward caller option bags. The builder's package-owned artifact and
231
+ contributions are normalized into a versioned result envelope before compiler
232
+ orchestration. Shared package contracts reject unknown fields, owner/version
233
+ mismatches, nondeterministic order, and mutable canonical operations.
234
+
235
+ Package builders emit provider-neutral capability and crypto requirements.
236
+ They do not receive provider drivers, target descriptors, runtime objects,
237
+ resolved secrets, raw CLI configuration, compiler caches, or arbitrary
238
+ TypeScript programs/services. Target eligibility begins after canonical
239
+ requirements exist.
240
+
241
+ Package effects require an explicit `PulseContext` and use the same
242
+ request-owned bridge as core effects. There is no ambient current request,
243
+ mutable global registration, or package-specific scheduler.
244
+
245
+ The Beta executes lowerers only from synchronized first-party
246
+ packages. Explicit provider toolchains are the narrow exception that may load a
247
+ selected project package; they do not enable dependency scanning or plugin
248
+ self-registration and do not widen lowerer trust. A general plugin API remains
249
+ unavailable until the machine-readable readiness gates for provenance,
250
+ discovery, negotiation, security, compatibility, and isolated loading are
251
+ implemented and release gated.
252
+
253
+ See [Package-owned lowering](../concepts/package-owned-lowering.md), the
254
+ [package lowerer contract](../contributing/package-lowerer-contract.md), and
255
+ [plugin readiness](../maintainers/plugin-readiness.md).
256
+
257
+ ## Internal prebuilt guest units
258
+
259
+ Native compilation may select a synchronized first-party prebuilt core-Wasm
260
+ guest unit contributed by a trusted package lowerer. The compiler resolves the
261
+ selection and target policy, then delegates validation, content-addressed
262
+ materialization, static composition, post-link optimization, final binary
263
+ audit, provenance, and normalized diagnostics to
264
+ `@pulse-compute/wasm-guest-link`.
265
+
266
+ The guest-link stage owns its versioned invocation and result identities. Its
267
+ input contains one exact normalized guest contribution, a separately projected
268
+ package root, primary Wasm bytes, synchronized package versions, and explicit
269
+ profile, optimization, and final-Wasm policy facts. It does not receive a
270
+ compiler realization, target descriptor, option bag, provider object, AST, or
271
+ compiler service. Its result contains exact final Wasm/text bytes, normalized
272
+ plan/report/audit records, artifact identity, packaging authorization, and an
273
+ explicit no-fallback disposition. The compiler integration module only
274
+ projects and rejoins those exact values.
275
+
276
+ Guest linking runs after the primary AssemblyScript module is compiled and
277
+ before the exact audited artifact enters provider packaging. The initial
278
+ contract is deliberately closed: one package-prebuilt unit, one fixed
279
+ link-stage-owned memory, borrowed bounded input, MVP features, no start
280
+ function, no allocation or pointer retention, no undeclared imports, and no
281
+ fallback. `.pulse/guests/` is generated, content-addressed,
282
+ non-authoritative, and reproducible after deletion.
283
+
284
+ Only synchronized first-party package identity is trusted. Manifests contain
285
+ normalized metadata and hashes, never executable commands. A failed selected
286
+ unit stops compilation before provider packaging; it cannot choose a different
287
+ realization or substitute the primary or a JavaScript output. Source builds,
288
+ local guest overrides, dynamic loading,
289
+ self-registration, arbitrary guest imports, and public third-party guest APIs
290
+ do not exist.
291
+
292
+ This is an implementation seam rather than an application-author API. A future
293
+ component-model composition engine may replace the current core-Wasm linker
294
+ without moving package semantics into the compiler or widening the trust model.
295
+
296
+ ## JWT verification
297
+
298
+ The synchronized `1.0.0-beta.1` JWT/crypto packages compose
299
+ `@pulse-compute/jwt` over the lower-level, provider-neutral verification
300
+ contract owned by `@pulse-compute/crypto`. The executable algorithm set is
301
+ HS256 and ES256. Crypto verifies a MAC or signature over caller-supplied bytes
302
+ and returns a closed status category; JWT owns compact-JWS structure, strict
303
+ protected-header and public-key rules, configured registered claims, optional
304
+ schema validation, and the detached immutable application result. Neither
305
+ layer exposes backend objects, raw error text, key material, messages,
306
+ authenticators, or unauthenticated claims.
307
+
308
+ Reachable package requirements are checked against the active profile's
309
+ `pulse.crypto` declaration and the selected target's exact realization.
310
+ Profile declarations replace the global declaration as a whole; arrays and
311
+ objects do not merge. An empty declaration enables no algorithms. An unknown,
312
+ missing, unavailable, or failed realization stops with a normalized diagnostic
313
+ and never authorizes fallback.
314
+
315
+ JavaScript targets select `runtime-builtin` and use Web Crypto with explicit
316
+ HMAC/SHA-256 or ECDSA/P-256/SHA-256 parameters. The crypto boundary receives a
317
+ normalized 64-byte P-256 point; its JavaScript adapter validates that point and
318
+ constructs the runtime-private JWK used for import. Native HS256 selects
319
+ `guest-source:pulse-hmac-as`, compiling first-party AssemblyScript into the
320
+ primary module, while Native ES256 selects the audited
321
+ `guest-linked:pulse-es256-rustcrypto-p256` unit. Neither algorithm retries a
322
+ different realization.
323
+
324
+ All four target classes—Node JavaScript, Fastly JavaScript, Node Native, and
325
+ Fastly Native—execute the same HS256 semantics. ES256 adds exact default and
326
+ size-oriented Native artifact cells, producing a six-cell 38-case matrix:
327
+ Node JavaScript, Fastly JavaScript under Viceroy, two Node Native artifacts,
328
+ and two Fastly Native artifacts. Authenticity completes before clock capture,
329
+ registered claims run before schema validation, and failure never selects a
330
+ different algorithm, realization, target, or provider.
331
+
332
+ The observed proof is sealed by
333
+ `wasm/.test-results/jwt-d4/jwt-phase-d-seal.json` and
334
+ `wasm/.test-results/jwt-e4/jwt-phase-e-seal.json`; the aligned ES256 target
335
+ matrix is recorded in
336
+ `wasm/.test-results/boundary-h4/es256-six-cell-matrix.json`. The package
337
+ relationship is recorded in
338
+ `wasm/test/jwt/contracts/jwt-crypto-working-candidate.json`. Providers and the
339
+ runtime remain explicit integration inputs. Validation does not itself
340
+ publish, promote, deploy, or activate the release.
341
+
342
+ ## Support, release, and authority
343
+
344
+ Pulse `1.0.0-beta.1` is a Beta intended for the `beta` channel.
345
+ Documented, evidence-backed behavior is intentional, but public surfaces may
346
+ change deliberately before a compatibility-bearing release. Unsupported
347
+ behavior fails explicitly, historical and implementation subpaths gain no
348
+ accidental guarantee, and released package names, versions, and artifacts are
349
+ immutable.
350
+
351
+ Package support comes from `release/pulse-release-manifest.json`; provider
352
+ support and project eligibility come from their versioned evidence. Local
353
+ validation prepares evidence but does not authorize merge, tagging, npm
354
+ publication, documentation promotion, provider deployment, or service
355
+ activation.
356
+
357
+ Publication uses sealed package candidates, protected human-approved
358
+ environments, npm trusted publishing, immutable exact-version documentation,
359
+ and resumable promotion without bucket-wide deletion. Human CODEOWNERS retain
360
+ architecture, merge, repository-setting, and release authority. Codex may
361
+ analyze, review, reproduce, and prepare bounded patches; deterministic checks
362
+ remain authoritative even when Codex is unavailable.
363
+
364
+ See the [maintainer charter](../maintainers/maintainer-charter.md),
365
+ [release acceptance](../maintainers/release-acceptance.md),
366
+ [npm publishing](../maintainers/npm-publishing.md), and
367
+ [documentation deployment](../maintainers/documentation-deployment.md).
368
+
369
+ ## Changing a contract
370
+
371
+ A material change to a protected boundary requires explicit human direction and
372
+ must update the current contract at its canonical owner. The same change must
373
+ update affected machine-readable catalogs, diagnostics, generated references,
374
+ tests, conformance evidence, and release acceptance. Do not add a chronological
375
+ decision file as a substitute for updating current truth.
376
+
377
+ The maintenance classifier reports whether a current contract update is
378
+ required for the inferred boundaries. The pull request must name those
379
+ boundaries, expose the human decision, and explain the resulting contract change
380
+ where reviewers can evaluate it. Git history and sealed checkpoints retain the
381
+ 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.