@pulse-compute/wasm-library-kit 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.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
1
  # @pulse-compute/wasm-library-kit
2
2
 
3
- This is an inert namespace-bootstrap package. It contains no executable code.
3
+ <!-- pulse-package-status:start -->
4
+ > **Support tier:** Implementation/transitive surface<br>
5
+ > **Audience:** Pulse package-lowering and compiler maintainers.<br>
6
+ > **Install directly:** No for application projects; it is installed transitively.<br>
7
+ > **Supported entry points:** `None for application authors.`<br>
8
+ > **Stability:** Internal package-lowering interface synchronized with this release set.<br>
9
+ > **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.1/packages/implementation-packages/)
10
+ >
11
+ > This release-status block is generated from the synchronized `Pulse 1.0.0-beta.1` package policy.
12
+ <!-- pulse-package-status:end -->
13
+
14
+ PulseWasm package-owned library contract, sidecar, and host capability builders.
15
+
16
+ ## Current split status
17
+
18
+ This package now owns the library-kit builder surface that was previously exposed through compiler codegen wrappers. The compiler still orchestrates extraction, but it imports these library builders from this package.
19
+
20
+ ## Exposed modules
21
+
22
+ - `@pulse-compute/wasm-library-kit` — compatibility root exposing the package-owned builder groups
23
+ - `@pulse-compute/wasm-library-kit/compiler` — build-time compiler integration helpers
24
+ - `@pulse-compute/wasm-library-kit/compiler/handler-library-contracts`
25
+ - `@pulse-compute/wasm-library-kit/compiler/library-sidecars`
26
+ - `@pulse-compute/wasm-library-kit/compiler/host-capabilities`
27
+
28
+ The compiler subpath exposes:
29
+
30
+ - `handlerLibraryContracts`
31
+ - `librarySidecars`
32
+ - `hostCapabilities`
33
+ - `buildHandlerLibraryContracts`
34
+ - `buildLibrarySidecarConsumption`
35
+ - `buildHostCapabilities`
36
+
37
+ ## Notes
38
+
39
+ - Owns declared-library sidecar consumption and ctx-extension validation builder behavior.
40
+ - Owns the host capability artifact builder because it aggregates library capability requirements.
41
+ - Consumes stable contract surfaces from `@pulse-compute/wasm-contracts`.
42
+ - Consumes shared build helpers from `@pulse-compute/wasm-build-support`.
43
+ - Does not depend on `@pulse-compute/wasm-compiler`.
44
+ - Examples under compiler/examples/libraries remain canonical fixtures for now.
package/package.json CHANGED
@@ -1,15 +1,43 @@
1
1
  {
2
2
  "name": "@pulse-compute/wasm-library-kit",
3
- "version": "0.0.0",
4
- "description": "Inert namespace bootstrap for Pulse.",
3
+ "version": "1.0.0-beta.1",
5
4
  "license": "Apache-2.0",
5
+ "engines": {
6
+ "node": "^22.14.0 || ^24.0.0"
7
+ },
8
+ "description": "PulseWasm package-owned library contract, sidecar, and host capability builders.",
9
+ "type": "commonjs",
10
+ "main": "./src/index.js",
11
+ "exports": {
12
+ ".": "./src/index.js",
13
+ "./compiler": "./src/compiler/index.js",
14
+ "./compiler/handler-library-contracts": "./src/compiler/handler-library-contracts.js",
15
+ "./compiler/library-sidecars": "./src/compiler/library-sidecars.js",
16
+ "./compiler/host-capabilities": "./src/compiler/host-capabilities.js",
17
+ "./compiler/assets-lowering": "./src/compiler/assets-lowering.js",
18
+ "./compiler/package-lowering": "./src/compiler/package-lowering.js",
19
+ "./compiler/package-contracts": "./src/compiler/package-contracts.js"
20
+ },
21
+ "dependencies": {
22
+ "@pulse-compute/wasm-build-support": "1.0.0-beta.1",
23
+ "@pulse-compute/wasm-contracts": "1.0.0-beta.1"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
6
28
  "files": [
29
+ "src",
7
30
  "README.md",
8
31
  "LICENSE",
9
32
  "NOTICE"
10
33
  ],
11
- "publishConfig": {
12
- "access": "public",
13
- "tag": "bootstrap"
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/pulse-compute/pulse.git",
37
+ "directory": "wasm/packages/library-kit"
38
+ },
39
+ "homepage": "https://pulsecompute.io/v1.0.0-beta.1/packages/implementation-packages/",
40
+ "bugs": {
41
+ "url": "https://github.com/pulse-compute/pulse/issues"
14
42
  }
15
- }
43
+ }
@@ -0,0 +1,160 @@
1
+ 'use strict';
2
+
3
+ const {
4
+ discoverLowerableLibraryManifests,
5
+ loadLowerableCompilerBuilder,
6
+ resolveDefaultLibraryContracts
7
+ } = require('./handler-library-contracts.js');
8
+
9
+ function loadAssetsContracts() {
10
+ try {
11
+ return require('@pulse-compute/wasm-contracts/assets/contracts');
12
+ } catch (error) {
13
+ if (error && error.code === 'MODULE_NOT_FOUND' && String(error.message).includes('@pulse-compute/wasm-contracts')) {
14
+ return require('../../../contracts/src/assets/contracts.js');
15
+ }
16
+ throw error;
17
+ }
18
+ }
19
+
20
+ const assetsContracts = loadAssetsContracts();
21
+ const phaseName = 'assets-lowering-plan';
22
+
23
+ function findAssetsManifestRecord(inputs = {}) {
24
+ const manifestRecords = Array.isArray(inputs.manifestRecords) && inputs.manifestRecords.length > 0
25
+ ? inputs.manifestRecords
26
+ : discoverLowerableLibraryManifests({ cwd: inputs.cwd || process.cwd(), workspaceRoot: inputs.workspaceRoot });
27
+
28
+ const explicitManifest = inputs.assetsManifest || inputs.manifest;
29
+ if (explicitManifest) {
30
+ const record = manifestRecords.find((entry) => entry.manifest === explicitManifest || (
31
+ entry.manifest &&
32
+ entry.manifest.contractId === explicitManifest.contractId &&
33
+ entry.manifest.npmPackage === explicitManifest.npmPackage
34
+ ));
35
+ if (record) return { record, manifestRecords };
36
+ return {
37
+ record: {
38
+ packageDir: inputs.packageDir || process.cwd(),
39
+ packageName: explicitManifest.npmPackage,
40
+ manifestFile: inputs.manifestFile,
41
+ manifest: explicitManifest,
42
+ validation: { status: 'ok', diagnostics: [] }
43
+ },
44
+ manifestRecords
45
+ };
46
+ }
47
+
48
+ return {
49
+ record: manifestRecords.find((entry) => entry.manifest && entry.manifest.contractId === assetsContracts.ASSETS_CONTRACT_ID),
50
+ manifestRecords
51
+ };
52
+ }
53
+
54
+ function buildAssetsLoweringPlan(inputs = {}) {
55
+ const cwd = inputs.cwd || process.cwd();
56
+ const { record, manifestRecords } = findAssetsManifestRecord(inputs);
57
+ const libraryContracts = Array.isArray(inputs.libraryContracts) && inputs.libraryContracts.length > 0
58
+ ? inputs.libraryContracts
59
+ : resolveDefaultLibraryContracts({ cwd, workspaceRoot: inputs.workspaceRoot });
60
+
61
+ if (!record) {
62
+ // Delegate the precise missing-manifest diagnostic to the package builder when possible;
63
+ // otherwise keep the historical surface by throwing through an empty package-owned input.
64
+ const error = new Error('Could not discover the package-owned @pulse-compute/assets PulseWasm manifest.');
65
+ error.diagnostics = [];
66
+ throw error;
67
+ }
68
+
69
+ const loaded = loadLowerableCompilerBuilder(record);
70
+ return loaded.builder({
71
+ ...inputs,
72
+ cwd,
73
+ manifest: record.manifest,
74
+ assetsManifest: record.manifest,
75
+ manifestRecord: record,
76
+ manifestRecords,
77
+ libraryContracts,
78
+ packageCompilerBuilder: {
79
+ owner: record.manifest && record.manifest.compiler ? record.manifest.compiler.builderOwner : record.packageName,
80
+ entry: loaded.entry,
81
+ export: loaded.exportName,
82
+ trust: loaded.compiler && loaded.compiler.trust
83
+ }
84
+ });
85
+ }
86
+
87
+
88
+ function buildAssetsCompiledWasmSidecarPlan(inputs = {}) {
89
+ const cwd = inputs.cwd || process.cwd();
90
+ const { record, manifestRecords } = findAssetsManifestRecord(inputs);
91
+ if (!record) {
92
+ const error = new Error('Could not discover the package-owned @pulse-compute/assets PulseWasm manifest for sidecar planning.');
93
+ error.diagnostics = [];
94
+ throw error;
95
+ }
96
+ const loaded = loadLowerableCompilerBuilder(record);
97
+ const builder = loaded.module && loaded.module.buildAssetsCompiledWasmSidecarPlan;
98
+ if (typeof builder !== 'function') {
99
+ const error = new Error('Package-owned assets compiler builder does not export buildAssetsCompiledWasmSidecarPlan.');
100
+ error.diagnostics = [];
101
+ throw error;
102
+ }
103
+ return builder({
104
+ ...inputs,
105
+ cwd,
106
+ manifest: record.manifest,
107
+ assetsManifest: record.manifest,
108
+ manifestRecord: record,
109
+ manifestRecords,
110
+ packageDir: record.packageDir,
111
+ packageCompilerBuilder: {
112
+ owner: record.manifest && record.manifest.compiler ? record.manifest.compiler.builderOwner : record.packageName,
113
+ entry: loaded.entry,
114
+ export: 'buildAssetsCompiledWasmSidecarPlan',
115
+ trust: loaded.compiler && loaded.compiler.trust
116
+ }
117
+ });
118
+ }
119
+
120
+
121
+
122
+ function buildAssetsSidecarCompileLinkProof(inputs = {}) {
123
+ const cwd = inputs.cwd || process.cwd();
124
+ const { record, manifestRecords } = findAssetsManifestRecord(inputs);
125
+ if (!record) {
126
+ const error = new Error('Could not discover the package-owned @pulse-compute/assets PulseWasm manifest for sidecar compile/link proof.');
127
+ error.diagnostics = [];
128
+ throw error;
129
+ }
130
+ const loaded = loadLowerableCompilerBuilder(record);
131
+ const builder = loaded.module && loaded.module.buildAssetsSidecarCompileLinkProof;
132
+ if (typeof builder !== 'function') {
133
+ const error = new Error('Package-owned assets compiler builder does not export buildAssetsSidecarCompileLinkProof.');
134
+ error.diagnostics = [];
135
+ throw error;
136
+ }
137
+ return builder({
138
+ ...inputs,
139
+ cwd,
140
+ manifest: record.manifest,
141
+ assetsManifest: record.manifest,
142
+ manifestRecord: record,
143
+ manifestRecords,
144
+ packageDir: record.packageDir,
145
+ packageCompilerBuilder: {
146
+ owner: record.manifest && record.manifest.compiler ? record.manifest.compiler.builderOwner : record.packageName,
147
+ entry: loaded.entry,
148
+ export: 'buildAssetsSidecarCompileLinkProof',
149
+ trust: loaded.compiler && loaded.compiler.trust
150
+ }
151
+ });
152
+ }
153
+
154
+ module.exports = {
155
+ buildAssetsLoweringPlan,
156
+ buildAssetsCompiledWasmSidecarPlan,
157
+ buildAssetsSidecarCompileLinkProof,
158
+ findAssetsManifestRecord,
159
+ phaseName
160
+ };