This mixed Node project keeps HTTP and event entries in separate planes. Two
schema-bound Pulse.on registrations accept canonical event frames and use the
one-way ctx.emit effect. The harness proves exact outbound acceptance; it
does not claim delivery or invoke a matching local handler.
Application
Section titled “Application”import { Pulse } from '@pulse-compute/pulse'
type DeviceReading = Readonly<{ deviceId: string temperatureC: number}>
const app = new Pulse({ auto: true })
app.get('/health', async (ctx) => ctx.text('ok'))
app.on<DeviceReading>('device.reading', { schema: 'events.DeviceReading' }, async (ctx) => { const reading = ctx.event.payload ctx.log.info('device reading accepted') await ctx.emit('device.reading.accepted', { schema: 'events.DeviceReadingAccepted', payload: { deviceId: reading.deviceId, accepted: true }, })})
app.on('system.tick', { schema: null }, async (ctx) => { ctx.log.info('system tick accepted') await ctx.emit('system.heartbeat', { schema: null })})
export default appProject config
Section titled “Project config”import { defineConfig } from '@pulse-compute/pulse'
export default defineConfig((_scope) => ({ pulse: { entry: 'src/index.ts', schema: 'src/schemas.ts', tests: 'tests/pulse.harness.ts', defaultProfile: 'node-native', strict: true, }, 'node-native': { host: 'node', target: 'native', outDir: 'dist-node-native', dev: { host: '127.0.0.1', port: 8787, networkFetch: false }, }, 'node-javascript': { host: 'node', target: 'javascript', outDir: 'dist-node-javascript', dev: { host: '127.0.0.1', port: 8787, networkFetch: false }, },}))Schemas
Section titled “Schemas”import { defineSchemaRegistry, schema } from '@pulse-compute/pulse/schema'
export interface DeviceReading { deviceId: string temperatureC: number}
export interface DeviceReadingAccepted { deviceId: string accepted: boolean}
export default defineSchemaRegistry({ schemas: { 'events.DeviceReading': schema<DeviceReading>(), 'events.DeviceReadingAccepted': schema<DeviceReadingAccepted>(), },})Request and response
Section titled “Request and response”Generated from the executable test harness below; these are tested requests or event frames, not an exhaustive application specification. Expected errors and emitted events are included; fixtures and provider setup remain in the harness.
| Request | Expected response |
|---|---|
http health remains separateGET /health | {"status":200,"text":"ok"} |
| schema event emits an accepted frame Event: {"version":"pulse.event-frame.v1","type":"device.reading","schemaId":"events.DeviceReading","payload":{"deviceId":"sensor-7","temperatureC":21}} | {"status":"completed","emitted":[{"version":"pulse.event-frame.v1","type":"device.reading.accepted","schemaId":"events.DeviceReadingAccepted","payload":{"accepted":true,"deviceId":"sensor-7"}}]} |
| no-payload event emits a no-payload frame Event: {"version":"pulse.event-frame.v1","type":"system.tick","schemaId":null} | {"status":"completed","emitted":[{"version":"pulse.event-frame.v1","type":"system.heartbeat","schemaId":null}]} |
Inspect
Section titled “Inspect”The selected profile is node-native; this checked excerpt identifies its target, provider and recognized capabilities. Paths, hashes and additional inspection fields are omitted.
npm run inspect -- --json{ "status": "ok", "project": { "target": "native" }, "provider": { "id": "node" }, "compiler": { "capabilities": [ "event.emit", "logging", "response.text" ] }}Doctor
Section titled “Doctor”Check this project and its local toolchain before execution. This selected result is verified by the documentation gate; another machine may report different prerequisite checks.
npm run doctor -- --json{ "status": "passed", "summary": { "warnings": 0, "failed": 0 }}Report
Section titled “Report”Build once into a separate directory, then replay the retained artifact without running or rebuilding the application. This checked excerpt accounts for registered handlers in the build evidence; it is not runtime request coverage.
npm run build -- --out .pulse-docs-buildnpm exec -- pulse report --artifact .pulse-docs-build/pulse-build.json --json{ "kind": "pulse.application-report", "reportVersion": 1, "analytics": { "coverage": { "handlers": { "expected": 3, "observed": 3, "reason": null, "status": "complete" } } }}Optional offline HTML uses the same retained evidence:
npm exec -- pulse report --artifact .pulse-docs-build/pulse-build.json --htmlReview reports before sharing. Missing, stale or incompatible evidence is an error; timings, paths and hashes are not presented as stable output.
Interactive report captured from this example at source e69e4b6f1381. Build evidence describes this captured build, not a runtime guarantee.
Workflow
Section titled “Workflow”pulse doctorpulse inspectpulse testpulse devpulse buildpulse test executes both HTTP and event cases on the selected Node target.
pulse dev serves only the HTTP portion; Pulse does not expose a public event
listener or injection command.
The documented result below is executed by the documentation gate.
Test result
Section titled “Test result”pulse test --json{ "status": "passed", "provider": "node", "summary": { "total": 3, "passed": 3, "failed": 0 }, "cases": [ { "name": "http health remains separate", "status": "passed", "response": { "status": 200 } }, { "name": "schema event emits an accepted frame", "status": "passed", "kind": "event", "emittedFrameCount": 1 } ]}Test harness
Section titled “Test harness”export default { cases: [ { name: 'http health remains separate', request: { method: 'GET', path: '/health' }, expect: { status: 200, text: 'ok' }, }, { name: 'schema event emits an accepted frame', kind: 'event', event: { type: 'device.reading', schema: 'events.DeviceReading', payload: { deviceId: 'sensor-7', temperatureC: 21 }, }, expect: { status: 'completed', emitted: [{ type: 'device.reading.accepted', schema: 'events.DeviceReadingAccepted', payload: { deviceId: 'sensor-7', accepted: true }, }], }, }, { name: 'no-payload event emits a no-payload frame', kind: 'event', event: { type: 'system.tick', schema: null }, expect: { status: 'completed', emitted: [{ type: 'system.heartbeat', schema: null }], }, },] }See Static events and outbound emission for the frame, queue, target, diagnostic, and Native-extension contracts.
Wasm size
Section titled “Wasm size”For build settings, see Native build optimization.
| Artifact | Default build |
|---|---|
Portable guest canonical-native.wasm | 31.7 KiB (32,458 bytes) |
The executable documentation gate rebuilds and measures the default artifact. Measured with Node 24.18.0 and lockfile-pinned AssemblyScript 0.28.18. These are uncompressed on-disk sizes, not transfer sizes or platform limits.