@fungi.computer/oyster 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +1082 -2
- package/dist/agents.d.ts +114 -0
- package/dist/agents.js +322 -0
- package/dist/app-builds.d.ts +151 -0
- package/dist/app-builds.js +355 -0
- package/dist/app-sandbox.d.ts +2 -0
- package/dist/app-sandbox.js +2 -0
- package/dist/app-sources.d.ts +46 -0
- package/dist/app-sources.js +335 -0
- package/dist/app-storage.d.ts +141 -0
- package/dist/app-storage.js +281 -0
- package/dist/apps/gate.d.ts +105 -0
- package/dist/apps/gate.js +273 -0
- package/dist/apps/index.d.ts +5 -0
- package/dist/apps/index.js +5 -0
- package/dist/apps/installation.d.ts +248 -0
- package/dist/apps/installation.js +307 -0
- package/dist/apps/operations.d.ts +8 -0
- package/dist/apps/operations.js +98 -0
- package/dist/apps/tools.d.ts +33 -0
- package/dist/apps/tools.js +17 -0
- package/dist/auth.d.ts +11 -0
- package/dist/auth.js +93 -0
- package/dist/backend-request.d.ts +3 -0
- package/dist/backend-request.js +53 -0
- package/dist/build/build-jobs.d.ts +128 -0
- package/dist/build/build-jobs.js +197 -0
- package/dist/build/build-step.d.ts +26 -0
- package/dist/build/build-step.js +20 -0
- package/dist/build/bundled-html.d.ts +7 -0
- package/dist/build/bundled-html.js +64 -0
- package/dist/build/definition-emission.d.ts +34 -0
- package/dist/build/definition-emission.js +201 -0
- package/dist/build/effect.d.ts +231 -0
- package/dist/build/effect.js +396 -0
- package/dist/build/git-environment.d.ts +6 -0
- package/dist/build/git-environment.js +48 -0
- package/dist/build/html-recipe.d.ts +20 -0
- package/dist/build/html-recipe.js +51 -0
- package/dist/build/local-build.d.ts +57 -0
- package/dist/build/local-build.js +1078 -0
- package/dist/build/r2-artifact-writer.d.ts +31 -0
- package/dist/build/r2-artifact-writer.js +179 -0
- package/dist/build/snapshot-package-store.d.ts +2 -0
- package/dist/build/snapshot-package-store.js +21 -0
- package/dist/build/snapshot-program-scripts.d.ts +6 -0
- package/dist/build/snapshot-program-scripts.js +2 -0
- package/dist/build/submission-contract.d.ts +384 -0
- package/dist/build/submission-contract.js +70 -0
- package/dist/build/workspace-build.d.ts +50 -0
- package/dist/build/workspace-build.js +156 -0
- package/dist/build-contract.d.ts +4 -0
- package/dist/build-contract.js +4 -0
- package/dist/build-jobs.d.ts +2 -0
- package/dist/build-jobs.js +2 -0
- package/dist/build.d.ts +11 -0
- package/dist/build.js +13 -0
- package/dist/capability-descriptor.d.ts +46 -0
- package/dist/capability-descriptor.js +51 -0
- package/dist/catalog-frame.d.ts +39 -0
- package/dist/catalog-frame.js +72 -0
- package/dist/cause-class.d.ts +19 -0
- package/dist/cause-class.js +54 -0
- package/dist/cloudflare.d.ts +123 -0
- package/dist/cloudflare.js +391 -0
- package/dist/computer-terminal.d.ts +38 -0
- package/dist/computer-terminal.js +410 -0
- package/dist/computer.d.ts +60 -0
- package/dist/computer.js +33 -0
- package/dist/event-recipients.d.ts +57 -0
- package/dist/event-recipients.js +144 -0
- package/dist/facet-invocation.d.ts +4 -0
- package/dist/facet-invocation.js +45 -0
- package/dist/files.d.ts +42 -0
- package/dist/files.js +123 -0
- package/dist/frame-binding-wire-script.d.ts +2 -0
- package/dist/frame-binding-wire-script.js +1 -0
- package/dist/frame-binding-wire.d.ts +28 -0
- package/dist/frame-binding-wire.js +54 -0
- package/dist/git-admission.d.ts +52 -0
- package/dist/git-admission.js +188 -0
- package/dist/git-auth.d.ts +11 -0
- package/dist/git-auth.js +27 -0
- package/dist/git-door.d.ts +35 -0
- package/dist/git-door.js +108 -0
- package/dist/git-journal.d.ts +31 -0
- package/dist/git-journal.js +188 -0
- package/dist/git.d.ts +31 -0
- package/dist/git.js +64 -0
- package/dist/guest-policy.d.ts +9 -0
- package/dist/guest-policy.js +13 -0
- package/dist/host.d.ts +244 -0
- package/dist/host.js +1043 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +320 -0
- package/dist/installation-consent.d.ts +79 -0
- package/dist/installation-consent.js +82 -0
- package/dist/internal/background-origins.d.ts +3 -0
- package/dist/internal/background-origins.js +8 -0
- package/dist/internal/delivery.d.ts +12 -0
- package/dist/internal/delivery.js +167 -0
- package/dist/internal/host-gate.d.ts +14 -0
- package/dist/internal/host-gate.js +62 -0
- package/dist/internal/registry-installations.d.ts +6 -0
- package/dist/internal/registry-installations.js +12 -0
- package/dist/invocation.d.ts +251 -0
- package/dist/invocation.js +377 -0
- package/dist/keys.d.ts +48 -0
- package/dist/keys.js +52 -0
- package/dist/mcp-owner.d.ts +27 -0
- package/dist/mcp-owner.js +143 -0
- package/dist/mcp.d.ts +89 -0
- package/dist/mcp.js +429 -0
- package/dist/media.d.ts +23 -0
- package/dist/media.js +12 -0
- package/dist/pack.d.ts +76 -0
- package/dist/pack.js +134 -0
- package/dist/page/capabilities.d.ts +23 -0
- package/dist/page/capabilities.js +256 -0
- package/dist/page/computer-handles.d.ts +79 -0
- package/dist/page/computer-handles.js +44 -0
- package/dist/page/lifetime.d.ts +6 -0
- package/dist/page/lifetime.js +19 -0
- package/dist/page/mount.d.ts +163 -0
- package/dist/page/mount.js +390 -0
- package/dist/page/storage.d.ts +3 -0
- package/dist/page/storage.js +82 -0
- package/dist/page/terminal.d.ts +5 -0
- package/dist/page/terminal.js +7 -0
- package/dist/page-script.d.ts +14 -0
- package/dist/page-script.js +5 -0
- package/dist/r2-files.d.ts +3 -0
- package/dist/r2-files.js +79 -0
- package/dist/release.d.ts +72 -0
- package/dist/release.js +164 -0
- package/dist/root-data.d.ts +86 -0
- package/dist/root-data.js +69 -0
- package/dist/shell/app-directory.d.ts +537 -0
- package/dist/shell/app-directory.js +195 -0
- package/dist/shell/browser-actions.d.ts +7 -0
- package/dist/shell/browser-actions.js +56 -0
- package/dist/shell/command-host.d.ts +112 -0
- package/dist/shell/command-host.js +502 -0
- package/dist/shell/commands.d.ts +25 -0
- package/dist/shell/commands.js +78 -0
- package/dist/shell/index.d.ts +8 -0
- package/dist/shell/index.js +8 -0
- package/dist/shell/keys.d.ts +41 -0
- package/dist/shell/keys.js +134 -0
- package/dist/shell/shell-module.d.ts +31 -0
- package/dist/shell/shell-module.js +37 -0
- package/dist/shell/window-manager.d.ts +124 -0
- package/dist/shell/window-manager.js +711 -0
- package/dist/shell/workbench-contract.d.ts +68 -0
- package/dist/shell/workbench-contract.js +1 -0
- package/dist/shell/workbench-host-types.d.ts +96 -0
- package/dist/shell/workbench-host-types.js +1 -0
- package/dist/shell/workbench-host.d.ts +34 -0
- package/dist/shell/workbench-host.js +347 -0
- package/dist/shell/workbench-model.d.ts +192 -0
- package/dist/shell/workbench-model.js +53 -0
- package/dist/shell/workbench.d.ts +4 -0
- package/dist/shell/workbench.js +2 -0
- package/dist/source/fork.d.ts +27 -0
- package/dist/source/fork.js +46 -0
- package/dist/source/index.d.ts +11 -0
- package/dist/source/index.js +11 -0
- package/dist/source/seed-receipt.d.ts +53 -0
- package/dist/source/seed-receipt.js +18 -0
- package/dist/source/team-source.d.ts +32 -0
- package/dist/source/team-source.js +42 -0
- package/dist/source/template-repository.d.ts +2 -0
- package/dist/source/template-repository.js +8 -0
- package/dist/source/template-write.d.ts +69 -0
- package/dist/source/template-write.js +344 -0
- package/dist/storage-frame.d.ts +64 -0
- package/dist/storage-frame.js +28 -0
- package/dist/tenant.d.ts +81 -0
- package/dist/tenant.js +71 -0
- package/dist/testing/capabilities.d.ts +29 -0
- package/dist/testing/capabilities.js +130 -0
- package/dist/testing/catalog.d.ts +3 -0
- package/dist/testing/catalog.js +53 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.js +10 -0
- package/dist/testing/installation.d.ts +11 -0
- package/dist/testing/installation.js +25 -0
- package/dist/testing/native-worker.d.ts +21 -0
- package/dist/testing/native-worker.js +106 -0
- package/dist/testing/worker.d.ts +18 -0
- package/dist/testing/worker.js +67 -0
- package/dist/testing/workers-runtime.d.ts +24 -0
- package/dist/testing/workers-runtime.js +33 -0
- package/dist/webhook-delivery.d.ts +14 -0
- package/dist/webhook-delivery.js +17 -0
- package/dist/workers-git.d.ts +285 -0
- package/dist/workers-git.js +1174 -0
- package/dist/workers.d.ts +352 -0
- package/dist/workers.js +866 -0
- package/docs/api/README.md +82 -0
- package/docs/api/agents.md +332 -0
- package/docs/api/app-storage.md +209 -0
- package/docs/api/apps.md +1375 -0
- package/docs/api/auth.md +63 -0
- package/docs/api/build-contract.md +507 -0
- package/docs/api/build.md +1476 -0
- package/docs/api/cloudflare.md +421 -0
- package/docs/api/computer.md +203 -0
- package/docs/api/files.md +117 -0
- package/docs/api/git.md +470 -0
- package/docs/api/host.md +1328 -0
- package/docs/api/index.md +430 -0
- package/docs/api/invocation.md +738 -0
- package/docs/api/keys.md +175 -0
- package/docs/api/mcp.md +301 -0
- package/docs/api/media.md +40 -0
- package/docs/api/modules.md +42 -0
- package/docs/api/pack.md +138 -0
- package/docs/api/page/mount.md +298 -0
- package/docs/api/root-data.md +111 -0
- package/docs/api/shell/app-directory.md +332 -0
- package/docs/api/shell/command-host.md +224 -0
- package/docs/api/shell/commands.md +197 -0
- package/docs/api/shell/keys.md +183 -0
- package/docs/api/shell/shell-module.md +143 -0
- package/docs/api/shell/window-manager.md +267 -0
- package/docs/api/shell/workbench.md +186 -0
- package/docs/api/shell.md +1788 -0
- package/docs/api/tenant.md +194 -0
- package/docs/api/workers-git.md +1527 -0
- package/docs/api/workers.md +1678 -0
- package/docs/media/architecture.mmd +32 -0
- package/docs/media/architecture.png +0 -0
- package/docs/media/bonsai-network.png +0 -0
- package/docs/media/bonsai-repository.png +0 -0
- package/docs/site/agent-quickstart.mdx +349 -0
- package/examples/git/worker.ts +39 -0
- package/examples/git/wrangler.jsonc +32 -0
- package/examples/standalone/worker.ts +14 -0
- package/examples/standalone/wrangler.jsonc +21 -0
- package/package.json +249 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type AssetBuildPolicy } from "@fungi.computer/puffball/assets";
|
|
2
|
+
import { type AssetR2Object, type AssetR2Bucket } from "@fungi.computer/puffball/cloudflare-assets";
|
|
3
|
+
import { type ArtifactRef, type AppReleaseCatalogOptions } from "@fungi.computer/puffball";
|
|
4
|
+
import { type AppReleaseR2Bucket } from "@fungi.computer/puffball/cloudflare";
|
|
5
|
+
import type { ArtifactWriter } from "./effect.js";
|
|
6
|
+
/**
|
|
7
|
+
* The native R2 writer for a built App: immutable, digest-addressed objects
|
|
8
|
+
* keyed by artifact reference, read back and verified before the root is
|
|
9
|
+
* returned. Hub's Publisher and Oyster's Computer builds both write Releases
|
|
10
|
+
* through it.
|
|
11
|
+
*/
|
|
12
|
+
export type ArtifactPolicy = NonNullable<AppReleaseCatalogOptions["artifactPolicy"]>;
|
|
13
|
+
/** Native binding subset; conditional put never replaces a retained artifact. */
|
|
14
|
+
export type PublisherR2Bucket = AppReleaseR2Bucket & AssetR2Bucket & {
|
|
15
|
+
put(key: string, value: Uint8Array, options: {
|
|
16
|
+
onlyIf: {
|
|
17
|
+
etagDoesNotMatch: string;
|
|
18
|
+
};
|
|
19
|
+
sha256: string;
|
|
20
|
+
httpMetadata: {
|
|
21
|
+
contentType: string;
|
|
22
|
+
};
|
|
23
|
+
}): Promise<AssetR2Object | null>;
|
|
24
|
+
};
|
|
25
|
+
/** Private host pins a retry-stable reference; the actual build supplies its digest. */
|
|
26
|
+
export declare function createR2ArtifactWriter(options: {
|
|
27
|
+
bucket: PublisherR2Bucket;
|
|
28
|
+
artifactRef: ArtifactRef;
|
|
29
|
+
policy: ArtifactPolicy;
|
|
30
|
+
assets?: AssetBuildPolicy;
|
|
31
|
+
}): ArtifactWriter;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { buildAssetManifest } from "@fungi.computer/cloudflare-worker-bundler/assets";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import { assetBuildMediaType, assetBuildJsonSchema, assetBuildPolicySchema, assetBaseSchema, decodeAssetBuild, assetPathSchema, } from "@fungi.computer/puffball/assets";
|
|
6
|
+
import { appBuildJsonSchema, appMediaType, createAppBuild, } from "@fungi.computer/puffball/app";
|
|
7
|
+
import { matchesAssetObject, } from "@fungi.computer/puffball/cloudflare-assets";
|
|
8
|
+
import { parseSha256Digest, parseArtifactRef, } from "@fungi.computer/puffball";
|
|
9
|
+
import { createR2ArtifactReader, } from "@fungi.computer/puffball/cloudflare";
|
|
10
|
+
/** Private host pins a retry-stable reference; the actual build supplies its digest. */
|
|
11
|
+
export function createR2ArtifactWriter(options) {
|
|
12
|
+
const artifactRef = options.artifactRef;
|
|
13
|
+
const assets = options.assets
|
|
14
|
+
? {
|
|
15
|
+
bucket: options.bucket,
|
|
16
|
+
policy: Object.freeze(Schema.decodeUnknownSync(assetBuildPolicySchema)({
|
|
17
|
+
...options.assets,
|
|
18
|
+
})),
|
|
19
|
+
}
|
|
20
|
+
: undefined;
|
|
21
|
+
const policy = { ...options.policy };
|
|
22
|
+
const reader = createR2ArtifactReader(options.bucket, policy, assets);
|
|
23
|
+
const writeImmutable = async (input) => {
|
|
24
|
+
if (input.limit === undefined || input.bytes.byteLength > input.limit)
|
|
25
|
+
throw new Error("Publisher artifact exceeds configured policy");
|
|
26
|
+
const digest = createHash("sha256").update(input.bytes).digest("hex");
|
|
27
|
+
const artifactDigest = parseSha256Digest(`sha256:${digest}`);
|
|
28
|
+
const readStored = () => reader.read({
|
|
29
|
+
artifactRef: input.artifactRef,
|
|
30
|
+
expectedDigest: artifactDigest,
|
|
31
|
+
verification: "publication",
|
|
32
|
+
});
|
|
33
|
+
let stored = await readStored();
|
|
34
|
+
if (stored.kind === "missing") {
|
|
35
|
+
await options.bucket.put(input.artifactRef, input.bytes, {
|
|
36
|
+
onlyIf: { etagDoesNotMatch: "*" },
|
|
37
|
+
sha256: digest,
|
|
38
|
+
httpMetadata: { contentType: input.mediaType },
|
|
39
|
+
});
|
|
40
|
+
stored = await readStored();
|
|
41
|
+
}
|
|
42
|
+
const object = await options.bucket.head(input.artifactRef);
|
|
43
|
+
if (stored.kind !== "verified" ||
|
|
44
|
+
stored.mediaType !== input.mediaType ||
|
|
45
|
+
object?.size !== input.bytes.byteLength)
|
|
46
|
+
throw new Error("Publisher artifact readback failed");
|
|
47
|
+
return {
|
|
48
|
+
artifactRef: input.artifactRef,
|
|
49
|
+
artifactDigest,
|
|
50
|
+
version: object.version,
|
|
51
|
+
byteLength: input.bytes.byteLength,
|
|
52
|
+
mediaType: input.mediaType,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const childArtifactRef = (digest) => parseArtifactRef(`artifact:sha256-${digest.slice("sha256:".length)}`);
|
|
56
|
+
return {
|
|
57
|
+
write: (output) => Effect.tryPromise(async () => {
|
|
58
|
+
const uiOutput = output.kind === "backend" ? null : output.ui;
|
|
59
|
+
const backendBytes = output.kind === "ui" ? null : output.backend;
|
|
60
|
+
const uiBytes = uiOutput === null
|
|
61
|
+
? null
|
|
62
|
+
: uiOutput.content.kind === "html"
|
|
63
|
+
? uiOutput.content.bytes.slice()
|
|
64
|
+
: await storeAssetObjects(uiOutput.content.assets, uiOutput.content.base, options.bucket, assets?.policy);
|
|
65
|
+
const uiMediaType = uiOutput?.mediaType ?? null;
|
|
66
|
+
const ui = uiBytes === null || uiMediaType === null
|
|
67
|
+
? null
|
|
68
|
+
: await writeImmutable({
|
|
69
|
+
artifactRef: childArtifactRef(`sha256:${createHash("sha256")
|
|
70
|
+
.update(uiBytes)
|
|
71
|
+
.digest("hex")}`),
|
|
72
|
+
bytes: uiBytes,
|
|
73
|
+
mediaType: uiMediaType,
|
|
74
|
+
limit: uiMediaType === assetBuildMediaType
|
|
75
|
+
? policy.maxManifestBytes
|
|
76
|
+
: policy.maxBytes,
|
|
77
|
+
});
|
|
78
|
+
const backend = backendBytes === null
|
|
79
|
+
? null
|
|
80
|
+
: await writeImmutable({
|
|
81
|
+
artifactRef: childArtifactRef(`sha256:${createHash("sha256")
|
|
82
|
+
.update(backendBytes)
|
|
83
|
+
.digest("hex")}`),
|
|
84
|
+
bytes: backendBytes,
|
|
85
|
+
mediaType: "application/vnd.fungi.app-backend+json",
|
|
86
|
+
limit: policy.maxBytes,
|
|
87
|
+
});
|
|
88
|
+
const rootInput = createAppBuild(ui === null || uiMediaType === null
|
|
89
|
+
? null
|
|
90
|
+
: {
|
|
91
|
+
artifactRef: ui.artifactRef,
|
|
92
|
+
digest: ui.artifactDigest,
|
|
93
|
+
version: ui.version,
|
|
94
|
+
byteLength: ui.byteLength,
|
|
95
|
+
mediaType: uiMediaType,
|
|
96
|
+
}, backend === null
|
|
97
|
+
? null
|
|
98
|
+
: {
|
|
99
|
+
artifactRef: backend.artifactRef,
|
|
100
|
+
digest: backend.artifactDigest,
|
|
101
|
+
version: backend.version,
|
|
102
|
+
byteLength: backend.byteLength,
|
|
103
|
+
mediaType: "application/vnd.fungi.app-backend+json",
|
|
104
|
+
}, output.declaration);
|
|
105
|
+
const root = Schema.encodeUnknownSync(appBuildJsonSchema)(rootInput);
|
|
106
|
+
const rootBytes = new TextEncoder().encode(root);
|
|
107
|
+
const stored = await writeImmutable({
|
|
108
|
+
artifactRef,
|
|
109
|
+
bytes: rootBytes,
|
|
110
|
+
mediaType: appMediaType,
|
|
111
|
+
limit: policy.maxManifestBytes,
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
artifactRef: stored.artifactRef,
|
|
115
|
+
artifactDigest: stored.artifactDigest,
|
|
116
|
+
};
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async function storeAssetObjects(outputs, suppliedBase, bucket, policy) {
|
|
121
|
+
const base = Schema.decodeUnknownSync(assetBaseSchema)(suppliedBase);
|
|
122
|
+
if (!policy)
|
|
123
|
+
throw new Error("Asset writer requires explicit policy and native metadata binding");
|
|
124
|
+
if (outputs.length === 0 || outputs.length > policy.maxObjects)
|
|
125
|
+
throw new Error("Asset count exceeds policy");
|
|
126
|
+
const content = {};
|
|
127
|
+
let total = 0;
|
|
128
|
+
for (const output of outputs) {
|
|
129
|
+
const path = Schema.decodeUnknownSync(assetPathSchema)(output.path);
|
|
130
|
+
if (Object.hasOwn(content, path))
|
|
131
|
+
throw new Error("Duplicate build path");
|
|
132
|
+
total += output.bytes.byteLength;
|
|
133
|
+
if (output.bytes.byteLength > policy.maxObjectBytes ||
|
|
134
|
+
!Number.isSafeInteger(total) ||
|
|
135
|
+
total > policy.maxTotalBytes)
|
|
136
|
+
throw new Error("Asset bytes exceed policy");
|
|
137
|
+
content[path] = new Uint8Array(output.bytes).buffer;
|
|
138
|
+
}
|
|
139
|
+
const metadata = await buildAssetManifest(content);
|
|
140
|
+
const assets = await Effect.runPromise(Effect.forEach(Object.keys(content).sort(), (path) => Effect.tryPromise(async () => {
|
|
141
|
+
const bytes = content[path];
|
|
142
|
+
const type = metadata.get(path)?.contentType;
|
|
143
|
+
if (!bytes || !type)
|
|
144
|
+
throw new Error("Build asset has no maintained content type");
|
|
145
|
+
const hash = createHash("sha256")
|
|
146
|
+
.update(new Uint8Array(bytes))
|
|
147
|
+
.digest("hex");
|
|
148
|
+
const artifactRef = parseArtifactRef(`artifact:sha256-${hash}`);
|
|
149
|
+
let object = await bucket.head(artifactRef);
|
|
150
|
+
if (object === null) {
|
|
151
|
+
object = await bucket.put(artifactRef, new Uint8Array(bytes), {
|
|
152
|
+
onlyIf: { etagDoesNotMatch: "*" },
|
|
153
|
+
sha256: hash,
|
|
154
|
+
httpMetadata: { contentType: type },
|
|
155
|
+
});
|
|
156
|
+
object ??= await bucket.head(artifactRef);
|
|
157
|
+
}
|
|
158
|
+
if (!object)
|
|
159
|
+
throw new Error("Asset readback missing");
|
|
160
|
+
const asset = {
|
|
161
|
+
path,
|
|
162
|
+
artifactRef,
|
|
163
|
+
digest: parseSha256Digest(`sha256:${hash}`),
|
|
164
|
+
version: object.version,
|
|
165
|
+
byteLength: bytes.byteLength,
|
|
166
|
+
contentType: type,
|
|
167
|
+
};
|
|
168
|
+
if (!matchesAssetObject(asset, object))
|
|
169
|
+
throw new Error("Immutable asset collision");
|
|
170
|
+
return asset;
|
|
171
|
+
}), { concurrency: 4 }));
|
|
172
|
+
const root = new TextEncoder().encode(Schema.encodeUnknownSync(assetBuildJsonSchema)({
|
|
173
|
+
format: "fungi-assets-v1",
|
|
174
|
+
base,
|
|
175
|
+
assets,
|
|
176
|
+
}));
|
|
177
|
+
decodeAssetBuild(root, policy);
|
|
178
|
+
return root;
|
|
179
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
2
|
+
/** Frozen hydration policy. Cached bytes are verified and copied into each snapshot. */
|
|
3
|
+
export function frozenSnapshotInstallArguments(packageStoreDirectory) {
|
|
4
|
+
if (packageStoreDirectory !== undefined && !isAbsolute(packageStoreDirectory))
|
|
5
|
+
throw new Error("Publisher package store must be an absolute host path");
|
|
6
|
+
return [
|
|
7
|
+
"install",
|
|
8
|
+
"--prod=false",
|
|
9
|
+
"--frozen-lockfile",
|
|
10
|
+
"--ignore-scripts",
|
|
11
|
+
"--ignore-pnpmfile",
|
|
12
|
+
packageStoreDirectory === undefined
|
|
13
|
+
? "--package-import-method=auto"
|
|
14
|
+
: "--package-import-method=copy",
|
|
15
|
+
"--virtual-store-dir=node_modules/.pnpm",
|
|
16
|
+
`--store-dir=${packageStoreDirectory ?? ".publisher-store"}`,
|
|
17
|
+
"--verify-store-integrity=true",
|
|
18
|
+
"--config.enable-global-virtual-store=false",
|
|
19
|
+
"--reporter=append-only",
|
|
20
|
+
];
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Generated by scripts/build-page.mjs from ./snapshot-programs/*.ts.
|
|
2
|
+
|
|
3
|
+
/** Captured-dependency build program with guarded filesystem access. */
|
|
4
|
+
export declare const dependencyBuildProgram: string;
|
|
5
|
+
/** Fixed Vite build program run beside the selected App's captured dependencies. */
|
|
6
|
+
export declare const htmlBuildProgram: string;
|