@mica-js/simulator 1.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox.js","names":["deviceGuestScript"],"sources":["../src/host/sandbox-host.ts","../src/sandbox.ts"],"sourcesContent":["import { createRpc } from '@mica-js/core/rpc';\nimport { loggerService } from '@mica-js/core/logging';\nimport { toDisposable } from '@mica-js/core/lifecycle';\nimport type { CanvasBindingTarget } from '@mica-js/core/canvas';\nimport type { SandboxWorker } from '@mica-js/sandbox';\nimport { deviceSimulationHostFileSystemService, deviceSimulationHostGuestService } from './rpc';\nimport type { DeviceSimulationHost, DeviceSimTickReport, DeviceTopic } from './types';\n\n/**\n * Read-only byte access the device host needs for schematics.\n *\n * Structurally equal to RFC 0019's `HostFs`, so one object can serve `WidgetHost` and the device\n * host without a second adapter.\n */\nexport interface DeviceSimulationHostFileSystem {\n read(uri: string): Promise<Uint8Array>;\n}\n\n/**\n * The running sandbox the host adapter drives: the full public surface of `SandboxWorker`, kept\n * structural so tests can inject an in-process RPC peer.\n */\nexport interface SandboxDeviceSimulationHostOptions {\n /**\n * The running sandbox to drive. The caller creates it — for example with the Vite-generated\n * `DeviceSimulationHostGuestSandbox` — and this factory never constructs one.\n */\n readonly sandbox: SandboxWorker;\n /** Host capability: source of schematic bytes; the guest never reads the host file system. */\n readonly fs: DeviceSimulationHostFileSystem;\n /** Extra ports transferred after the RPC port in the guest's first startup message. */\n readonly ports?: readonly MessagePort[];\n}\n\n/**\n * Builds a `DeviceSimulationHost` that runs the unified-IR circuit inside a `@mica-js/sandbox` guest.\n *\n * The caller creates the sandbox and passes it in with the other initialization options, so the\n * same host adapter works with the Vite-generated guest class and with in-process RPC peers. The\n * sandbox receives only a `MessagePort`; every call below travels over the typed `guest` RPC service\n * and schematic bytes arrive through the typed `host-capabilities` service. `Circuit` stays entirely\n * inside the guest.\n */\nexport async function createDeviceSimulationHostFromSandbox({\n sandbox,\n fs,\n ports = [],\n}: SandboxDeviceSimulationHostOptions): Promise<DeviceSimulationHost> {\n let channel: MessageChannel | undefined;\n let rpc: ReturnType<typeof createRpc> | undefined;\n let logRegistration: { dispose(): void } | undefined;\n try {\n await sandbox.ready;\n channel = new MessageChannel();\n const endpoint = createRpc(channel.port1);\n rpc = endpoint;\n logRegistration = endpoint.register(loggerService, {\n write(record) {\n const method = console[record.level] ?? console.log;\n method.call(console, `[${record.scope}]`, record.message, ...record.data);\n },\n });\n sandbox.postMessage(null, [channel.port2, ...ports]);\n } catch (error) {\n logRegistration?.dispose();\n rpc?.dispose();\n channel?.port1.close();\n channel?.port2.close();\n await sandbox.terminate('device simulation host failed to start').catch(() => undefined);\n throw error;\n }\n\n const endpoint = rpc;\n if (endpoint === undefined) {\n throw new Error('Device simulation RPC endpoint was not created.');\n }\n endpoint.register(\n deviceSimulationHostFileSystemService,\n {\n read: (uri: string) => fs.read(uri),\n },\n {\n transfer: (member, value) =>\n member === 'read' && value instanceof Uint8Array ? [value.buffer] : [],\n },\n );\n const guest = endpoint.getProxy(deviceSimulationHostGuestService);\n let disposed = false;\n\n return {\n loadSchematic: (uri: string | undefined) => guest.loadSchematic(uri),\n reset: () => guest.reset(),\n tick: (dt: number): Promise<DeviceSimTickReport> => guest.tick(dt),\n deliver: (target: CanvasBindingTarget, payload: unknown, simTime?: number) =>\n guest.deliver(target, payload, simTime),\n onDidPublish: (listener) => toDisposable(guest.onDidPublish(listener)),\n getTopics: (): Promise<readonly DeviceTopic[]> => guest.getTopics(),\n getSimTime: () => guest.getSimTime(),\n getSchematic: () => guest.getSchematic(),\n async dispose(): Promise<void> {\n if (disposed) return;\n disposed = true;\n try {\n await guest.dispose();\n } finally {\n logRegistration?.dispose();\n endpoint.dispose();\n await sandbox.terminate('disposed');\n }\n },\n };\n}\n","/**\n * Browser entry of `@mica-js/simulator`.\n *\n * The sandbox adapter pulls in `@mica-js/sandbox` and embeds the packaged guest script, so it stays\n * out of the main entry: DOM-free consumers import `@mica-js/simulator`, browser assembly imports\n * `@mica-js/simulator/sandbox`.\n */\n// The ambient module is declared in `virtual-runtime.d.ts`.\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./virtual-runtime.d.ts\" />\nimport { SandboxWorker } from '@mica-js/sandbox';\nimport type { SandboxWorkerOptions } from '@mica-js/sandbox';\nimport deviceGuestScript from './guest/device-simulation-host.ts?sandbox-worker-code';\nimport { createDeviceSimulationHostFromSandbox } from './host/sandbox-host';\n\n/**\n * The default device simulation guest script, bundled and minified into this module while the\n * package is built.\n *\n * It is a classic script: every dependency is inlined, so the sandbox runs it without a module\n * loader. It resolves no devices — a package that owns devices passes its own guest script to the\n * sandbox instead.\n */\nexport const deviceSimulationHostGuestScript: string = deviceGuestScript;\n\n/**\n * Creates the default device simulation guest worker.\n *\n * Pass the worker to `createDeviceSimulationHostFromSandbox` — or let\n * `@mica-js/canvas-editor`'s `SandboxHostProvider` start it, which is what it does by default.\n */\nexport function createDeviceSimulationHostGuestSandbox(\n options: SandboxWorkerOptions = {},\n): SandboxWorker {\n return new SandboxWorker(deviceSimulationHostGuestScript, { name: 'device', ...options });\n}\n\n/**\n * The packaged guest as a worker class, kept for callers that construct it with `new`.\n *\n * @deprecated Prefer {@link createDeviceSimulationHostGuestSandbox}.\n */\nexport const DeviceSimulationHostGuestSandbox: new (\n options?: SandboxWorkerOptions,\n) => SandboxWorker = class GeneratedDeviceSimulationHostSandbox extends SandboxWorker {\n constructor(options: SandboxWorkerOptions = {}) {\n super(deviceSimulationHostGuestScript, { name: 'device', ...options });\n }\n};\n\nexport { createDeviceSimulationHostFromSandbox };\nexport type {\n DeviceSimulationHostFileSystem,\n SandboxDeviceSimulationHostOptions,\n} from './host/sandbox-host';\nexport type {\n DeviceSimulationHost,\n DeviceSimTickReport,\n DeviceTopic,\n SimulationPublish,\n} from './host/types';\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,eAAsB,sCAAsC,EAC1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I,UAAU;GACd,WAAW;GACX,IAAI;IACF,MAAM,MAAM,QAAQ;GACtB,UAAU;IACR,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,MAAM,QAAQ,UAAU,UAAU;GACpC;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;ACxFA,IAAa,kCAA0CA;;;;;;;AAQvD,SAAgB,uCACd,UAAgC,CAAC,GAClB;CACf,OAAO,IAAI,cAAc,iCAAiC;EAAE,MAAM;EAAU,GAAG;CAAQ,CAAC;AAC1F;;;;;;AAOA,IAAa,mCAEQ,MAAM,6CAA6C,cAAc;CACpF,YAAY,UAAgC,CAAC,GAAG;EAC9C,MAAM,iCAAiC;GAAE,MAAM;GAAU,GAAG;EAAQ,CAAC;CACvE;AACF"}
1
+ {"version":3,"file":"sandbox.js","names":["simulationRuntimeGuestScript"],"sources":["../src/simulation-runtime/adapter.ts","../src/sandbox.ts"],"sourcesContent":["import { toDisposable } from '@mica-js/core/lifecycle';\nimport { createRpc } from '@mica-js/core/rpc';\nimport type { RpcEndpoint } from '@mica-js/core/rpc';\nimport type { SandboxWorker } from '@mica-js/sandbox';\nimport { copyBytePayload } from './payload';\nimport { simulationRuntimeCallTransfer, simulationRuntimeService } from './rpc';\nimport type { IPreparedSimulation, ISimulationMessage, ISimulationRuntime } from './types';\n\n/** Startup options of the worker-backed runtime adapter. */\nexport interface ISimulationRuntimeWorkerOptions {\n /**\n * Extra port transferred after the RPC port.\n *\n * The guest registers the `simulation-runtime` data plane on it; the caller keeps the other end\n * so a widget guest can deliver and subscribe without the host relaying.\n */\n readonly topicPort?: MessagePort;\n}\n\n/**\n * Builds an `ISimulationRuntime` that runs inside one sandbox worker.\n *\n * The adapter owns the worker: it starts the RPC channel, forwards the optional topic port, and\n * terminates the worker on `dispose`. The worker receives only `MessagePort`s, so device modules\n * are imported and executed inside the guest, never on the editor thread.\n */\nexport async function createSimulationRuntimeFromWorker(\n worker: SandboxWorker,\n options: ISimulationRuntimeWorkerOptions = {},\n): Promise<ISimulationRuntime> {\n let channel: MessageChannel | undefined;\n let endpoint: RpcEndpoint | undefined;\n let posted = false;\n const topicPort = options.topicPort;\n try {\n await worker.ready;\n channel = new MessageChannel();\n endpoint = createRpc(channel.port1);\n const ports: MessagePort[] = [channel.port2];\n if (topicPort !== undefined) ports.push(topicPort);\n worker.postMessage(null, ports);\n posted = true;\n } catch (error) {\n endpoint?.dispose();\n if (!posted) {\n closePort(channel?.port1);\n closePort(channel?.port2);\n closePort(topicPort);\n }\n await worker.terminate('simulation runtime failed to start').catch(() => undefined);\n throw error;\n }\n if (endpoint === undefined || channel === undefined) {\n await worker.terminate('simulation runtime failed to start').catch(() => undefined);\n throw new Error('Simulation runtime RPC endpoint was not created.');\n }\n\n const rpc = endpoint;\n const guest = rpc.getProxy(simulationRuntimeService, {\n transfer: simulationRuntimeCallTransfer,\n });\n let disposed = false;\n\n return {\n load: (input: IPreparedSimulation) => guest.load(copyPreparedSimulation(input)),\n reset: () => guest.reset(),\n tick: (dt) => guest.tick(dt),\n deliver: (message: ISimulationMessage) => guest.deliver(copyMessage(message)),\n onDidPublish: (listener) => toDisposable(guest.onDidPublish(listener)),\n onDidDiagnostic: (listener) => toDisposable(guest.onDidDiagnostic(listener)),\n async dispose(): Promise<void> {\n if (disposed) return;\n disposed = true;\n try {\n await guest.dispose();\n } catch {\n // The worker may already be gone; teardown below still has to run.\n } finally {\n rpc.dispose();\n closePort(channel.port1);\n if (!posted) {\n closePort(channel.port2);\n closePort(topicPort);\n }\n await worker.terminate('disposed').catch(() => undefined);\n }\n },\n };\n}\n\nfunction copyPreparedSimulation(input: IPreparedSimulation): IPreparedSimulation {\n if (input.assets === undefined) return input;\n const assets: Record<string, Record<string, Uint8Array>> = {};\n for (const [symbolId, entries] of Object.entries(input.assets)) {\n const copies: Record<string, Uint8Array> = {};\n for (const [src, bytes] of Object.entries(entries)) copies[src] = new Uint8Array(bytes);\n assets[symbolId] = copies;\n }\n return { ...input, assets };\n}\n\nfunction copyMessage(message: ISimulationMessage): ISimulationMessage {\n const payload = copyBytePayload(message.payload);\n return payload === message.payload ? message : { ...message, payload };\n}\n\nfunction closePort(port: MessagePort | undefined): void {\n try {\n port?.close();\n } catch {\n // Already detached by a transfer; the receiving side owns it now.\n }\n}\n","import { SandboxWorker } from '@mica-js/sandbox';\nimport type { SandboxWorkerOptions } from '@mica-js/sandbox';\nimport simulationRuntimeGuestScript from './guest/simulation-runtime.ts?sandbox-worker-code';\n\nexport { simulationRuntimeGuestScript };\nexport { createSimulationRuntimeFromWorker } from './simulation-runtime/adapter';\nexport type { ISimulationRuntimeWorkerOptions } from './simulation-runtime/adapter';\n\n/** Creates the optional browser worker; the runtime adapter takes ownership of it. */\nexport function createSimulationRuntimeGuestSandbox(\n options: SandboxWorkerOptions = {},\n): SandboxWorker {\n return new SandboxWorker(simulationRuntimeGuestScript, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,eAAsB,kCACpB,QACA,UAA2C,CAAC,GACf;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI,SAAS;CACb,MAAM,YAAY,QAAQ;CAC1B,IAAI;EACF,MAAM,OAAO;EACb,UAAU,IAAI,eAAe;EAC7B,WAAW,UAAU,QAAQ,KAAK;EAClC,MAAM,QAAuB,CAAC,QAAQ,KAAK;EAC3C,IAAI,cAAc,KAAA,GAAW,MAAM,KAAK,SAAS;EACjD,OAAO,YAAY,MAAM,KAAK;EAC9B,SAAS;CACX,SAAS,OAAO;EACd,UAAU,QAAQ;EAClB,IAAI,CAAC,QAAQ;GACX,UAAU,SAAS,KAAK;GACxB,UAAU,SAAS,KAAK;GACxB,UAAU,SAAS;EACrB;EACA,MAAM,OAAO,UAAU,oCAAoC,CAAC,CAAC,YAAY,KAAA,CAAS;EAClF,MAAM;CACR;CACA,IAAI,aAAa,KAAA,KAAa,YAAY,KAAA,GAAW;EACnD,MAAM,OAAO,UAAU,oCAAoC,CAAC,CAAC,YAAY,KAAA,CAAS;EAClF,MAAM,IAAI,M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,MAAM,MAAM;CACd,QAAQ,CAER;AACF;;;;ACvGA,SAAgB,oCACd,UAAgC,CAAC,GAClB;CACf,OAAO,IAAI,cAAcA,4BAA8B,OAAO;AAChE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mica-js/simulator",
3
- "version": "1.0.0",
4
- "description": "Mica simulator: runs the device instances of a schematic on one virtual clock",
3
+ "version": "2.1.0",
4
+ "description": "Synchronous compiled device simulation runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,6 +15,18 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "import": "./dist/index.js"
17
17
  },
18
+ "./device": {
19
+ "types": "./dist/device.d.ts",
20
+ "import": "./dist/device.js"
21
+ },
22
+ "./model": {
23
+ "types": "./dist/model.d.ts",
24
+ "import": "./dist/model.js"
25
+ },
26
+ "./ddl": {
27
+ "types": "./dist/ddl.d.ts",
28
+ "import": "./dist/ddl.js"
29
+ },
18
30
  "./sandbox": {
19
31
  "types": "./dist/sandbox.d.ts",
20
32
  "import": "./dist/sandbox.js"
@@ -27,9 +39,12 @@
27
39
  "access": "public"
28
40
  },
29
41
  "dependencies": {
30
- "@mica-js/core": "0.5.0",
31
- "@mica-js/ir": "0.4.0",
32
- "@mica-js/sandbox": "0.3.0"
42
+ "@mica-js/compiler": "0.2.0",
43
+ "@mica-js/device-model": "0.5.0",
44
+ "@mica-js/ddl": "0.2.0",
45
+ "@mica-js/core": "0.6.0",
46
+ "@mica-js/document": "0.1.0",
47
+ "@mica-js/sandbox": "0.4.0"
33
48
  },
34
49
  "devDependencies": {
35
50
  "typescript": "^6.0.3",
@@ -38,12 +53,15 @@
38
53
  "vitest": "^5.0.5"
39
54
  },
40
55
  "scripts": {
41
- "bench": "vitest bench --run",
42
- "bench:unified": "vitest bench --run bench/unified-simple.bench.ts",
43
- "bench:resistive": "vitest run --config bench/resistive-number.config.ts",
44
56
  "build": "vite build",
45
- "test": "vitest run",
46
- "test:watch": "vitest",
47
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.bench.json"
57
+ "typecheck": "tsc --noEmit",
58
+ "test": "node --test bench/*.test.mjs",
59
+ "test:runtime": "vitest run",
60
+ "bench": "node bench/runtime.mjs",
61
+ "bench:electrical": "node bench/electrical.mjs",
62
+ "bench:workloads": "node bench/workloads.mjs",
63
+ "bench:propagation": "node bench/propagation.mjs",
64
+ "bench:mcu": "node bench/mcu.mjs",
65
+ "bench:mcu:typical": "node bench/typical-mcu.mjs"
48
66
  }
49
67
  }
@@ -1,12 +0,0 @@
1
- import { defineRpcService } from "@mica-js/core/rpc";
2
- //#region src/host/rpc.ts
3
- /**
4
- * Wire names both sides of the sandbox agree on: the worker script registers the device simulation
5
- * contract as `guest`, and calls the host back through `host-capabilities` to read schematic bytes.
6
- */
7
- var deviceSimulationHostGuestService = defineRpcService("guest");
8
- var deviceSimulationHostFileSystemService = defineRpcService("host-capabilities");
9
- //#endregion
10
- export { deviceSimulationHostGuestService as n, deviceSimulationHostFileSystemService as t };
11
-
12
- //# sourceMappingURL=rpc-BIxQr_wd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-BIxQr_wd.js","names":[],"sources":["../src/host/rpc.ts"],"sourcesContent":["import { defineRpcService } from '@mica-js/core/rpc';\nimport type { CanvasBindingTarget } from '@mica-js/core/canvas';\nimport type { SchematicDocument } from '@mica-js/core/schematic';\nimport type { DeviceSimTickReport, DeviceTopic, SimulationPublish } from './types';\n\n/** Host file system the sandbox guest reads schematics through. */\nexport interface DeviceSimulationHostFileSystemRpc {\n read(uri: string): Promise<Uint8Array>;\n}\n\n/** Methods the device simulation guest exposes over the sandbox RPC channel. */\nexport interface DeviceSimulationHostRpc {\n loadSchematic(uri: string | undefined): Promise<void>;\n reset(): Promise<void>;\n tick(dt: number): Promise<DeviceSimTickReport>;\n /**\n * `payload` is the one intentionally arbitrary value: widget/device payloads are plugin-defined\n * and validated against the target topic. Every other argument and result is a precise DTO.\n */\n deliver(target: CanvasBindingTarget, payload: unknown, simTime?: number): Promise<void>;\n onDidPublish(listener: (publish: SimulationPublish) => void): () => void;\n getTopics(): Promise<readonly DeviceTopic[]>;\n getSimTime(): Promise<number>;\n getSchematic(): Promise<SchematicDocument | undefined>;\n dispose(): Promise<void>;\n}\n\n/**\n * Wire names both sides of the sandbox agree on: the worker script registers the device simulation\n * contract as `guest`, and calls the host back through `host-capabilities` to read schematic bytes.\n */\nexport const deviceSimulationHostGuestService = defineRpcService<DeviceSimulationHostRpc>('guest');\nexport const deviceSimulationHostFileSystemService =\n defineRpcService<DeviceSimulationHostFileSystemRpc>('host-capabilities');\n"],"mappings":";;;;;;AA+BA,IAAa,mCAAmC,iBAA0C,OAAO;AACjG,IAAa,wCACX,iBAAoD,mBAAmB"}