@fungi.computer/oyster 0.11.0 → 0.12.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 +70 -10
- package/dist/app-builds.d.ts +2 -0
- package/dist/app-builds.js +17 -6
- package/dist/authorization.d.ts +1 -1
- package/dist/build/artifact-writer.d.ts +11 -2
- package/dist/build/artifact-writer.js +42 -24
- package/dist/build/candidate-cli.mjs +33 -19
- package/dist/build/content-objects.d.ts +29 -14
- package/dist/build/content-objects.js +57 -19
- package/dist/build/local-build.js +7 -1
- package/dist/build/submission-contract.d.ts +1 -1
- package/dist/build/submission-contract.js +5 -5
- package/dist/build-egress.d.ts +8 -7
- package/dist/build-egress.js +4 -3
- package/dist/build.d.ts +1 -1
- package/dist/hello-app-script.d.ts +2 -0
- package/dist/hello-app-script.js +1 -0
- package/dist/install-release-cli.d.ts +2 -1
- package/dist/install-release-cli.js +18 -10
- package/dist/installation-client.d.ts +1 -0
- package/dist/installation-operations.d.ts +2 -0
- package/dist/installation-operations.js +1 -0
- package/dist/pack.d.ts +5 -2
- package/dist/pack.js +3 -1
- package/dist/standalone/agents.d.ts +6 -2
- package/dist/standalone/agents.js +21 -4
- package/dist/standalone/computer-egress.d.ts +5 -3
- package/dist/standalone/computer-egress.js +1 -1
- package/dist/standalone/hello-app.d.ts +10 -0
- package/dist/standalone/hello-app.js +81 -0
- package/dist/standalone/install-apps-cli.d.ts +2 -1
- package/dist/standalone/install-apps-cli.js +36 -14
- package/dist/standalone/instance.js +2 -2
- package/dist/standalone/local-desktop.d.ts +11 -0
- package/dist/standalone/local-desktop.js +75 -0
- package/dist/standalone/registry.d.ts +2 -0
- package/dist/standalone/sign-in-link.d.ts +9 -0
- package/dist/standalone/sign-in-link.js +49 -0
- package/dist/standalone/try-cli.d.ts +52 -0
- package/dist/standalone/try-cli.js +427 -0
- package/dist/standalone/worker.js +1 -1
- package/dist/webhook-abuse.d.ts +7 -1
- package/dist/webhook-abuse.js +8 -2
- package/dist/workers.d.ts +7 -2
- package/dist/workers.js +1 -1
- package/docs/api/authorization.md +56 -11
- package/docs/api/build-contract.md +52 -10
- package/docs/api/build.md +16 -2
- package/docs/api/host.md +1 -0
- package/docs/api/pack.md +179 -3
- package/docs/site/agent-quickstart.mdx +8 -0
- package/package.json +13 -8
|
@@ -10,6 +10,7 @@ function logEvent(operation, cause) {
|
|
|
10
10
|
import { frozenSnapshotInstallArguments, packageScriptArguments, } from "./snapshot-package-store.js";
|
|
11
11
|
import { isInsideSnapshot } from "./snapshot-programs/snapshot-path.js";
|
|
12
12
|
import { writeImmutableArtifact, } from "./artifact-writer.js";
|
|
13
|
+
import { contentObjectOwner } from "./content-objects.js";
|
|
13
14
|
import { assetPathSchema, } from "@fungi.computer/puffball/assets";
|
|
14
15
|
import { appBuildRecipe, readBuildManifest, resolveWorkspaceBuild, workspaceProjectsArguments, } from "./workspace-build.js";
|
|
15
16
|
import { readBundledHtml } from "./bundled-html.js";
|
|
@@ -171,7 +172,10 @@ async function captureCommit(workdir, repositoryPath, sourceRevision, signal) {
|
|
|
171
172
|
}
|
|
172
173
|
function scopedSourceCapture(capture, failureMessage) {
|
|
173
174
|
return {
|
|
174
|
-
capture: () => Effect.acquireRelease(Effect.sync(() =>
|
|
175
|
+
capture: () => Effect.acquireRelease(Effect.sync(() =>
|
|
176
|
+
// Canonical, so every path derived from the scratch matches the
|
|
177
|
+
// realpaths pnpm reports (macOS tmpdir is a symlink).
|
|
178
|
+
realpathSync(mkdtempSync(join(tmpdir(), "app-publisher-")))), (workdir) => Effect.tryPromise({
|
|
175
179
|
try: () => rm(workdir, { recursive: true, force: true }),
|
|
176
180
|
catch: () => new Error("Local source cleanup failed"),
|
|
177
181
|
}).pipe(Effect.catch((cause) => {
|
|
@@ -1109,6 +1113,8 @@ async function writeArtifact(output, artifactRoot, signal, assetPolicy) {
|
|
|
1109
1113
|
signal.throwIfAborted();
|
|
1110
1114
|
await mkdir(artifactRoot, { recursive: true });
|
|
1111
1115
|
return writeImmutableArtifact(output, directoryArtifactObjects(artifactRoot, signal), {
|
|
1116
|
+
// A local pack is one owner's private directory.
|
|
1117
|
+
owner: contentObjectOwner("local"),
|
|
1112
1118
|
rootArtifactRef: parseArtifactRef(`artifact:${Buffer.from(randomBytes(16)).toString("hex")}`),
|
|
1113
1119
|
assetPolicy,
|
|
1114
1120
|
});
|
|
@@ -814,7 +814,7 @@ export declare function candidateObjectMediaType(value: string | null): Candidat
|
|
|
814
814
|
export type CandidateUpload = CandidateObject & Readonly<{
|
|
815
815
|
mediaType: CandidateObjectMediaType;
|
|
816
816
|
}>;
|
|
817
|
-
/** Every distinct object a manifest names, each once, in manifest order. */
|
|
817
|
+
/** Every distinct object (digest and stored type) a manifest names, each once, in manifest order. */
|
|
818
818
|
export declare function candidateManifestObjects(output: CandidateOutputManifest): readonly CandidateUpload[];
|
|
819
819
|
/** Decode a stored backend descriptor; a manifest's backend must be one. */
|
|
820
820
|
export declare function decodeCandidateBackend(bytes: Uint8Array): {
|
|
@@ -148,19 +148,19 @@ export const candidateObjectMediaTypes = [
|
|
|
148
148
|
export function candidateObjectMediaType(value) {
|
|
149
149
|
return candidateObjectMediaTypes.find((type) => type === value) ?? null;
|
|
150
150
|
}
|
|
151
|
-
/** Every distinct object a manifest names, each once, in manifest order. */
|
|
151
|
+
/** Every distinct object (digest and stored type) a manifest names, each once, in manifest order. */
|
|
152
152
|
export function candidateManifestObjects(output) {
|
|
153
153
|
const objects = [];
|
|
154
154
|
const add = (object, mediaType) => {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
155
|
+
const named = objects.filter(({ digest }) => digest === object.digest);
|
|
156
|
+
if (named.some(({ byteLength }) => byteLength !== object.byteLength))
|
|
157
|
+
throw new Error("One object digest names two sizes");
|
|
158
|
+
if (!named.some((seen) => seen.mediaType === mediaType))
|
|
157
159
|
objects.push({
|
|
158
160
|
digest: object.digest,
|
|
159
161
|
byteLength: object.byteLength,
|
|
160
162
|
mediaType,
|
|
161
163
|
});
|
|
162
|
-
else if (seen.byteLength !== object.byteLength)
|
|
163
|
-
throw new Error("One object digest names two sizes");
|
|
164
164
|
};
|
|
165
165
|
if (output.kind !== "backend") {
|
|
166
166
|
const { content } = output.ui;
|
package/dist/build-egress.d.ts
CHANGED
|
@@ -39,21 +39,22 @@ export declare function isBuildGitPrincipal<P extends Readonly<{
|
|
|
39
39
|
* The build-report handler for `/jobs/:id/(candidate|artifact|status)` and
|
|
40
40
|
* `PUT /jobs/:id/objects/sha256-<hex>`. `admitBuild` is the host's own
|
|
41
41
|
* live-job lookup; `admitObject` admits one object upload for a live job's
|
|
42
|
-
* grant and answers its size bound
|
|
43
|
-
*
|
|
42
|
+
* grant and answers its size bound (and whatever else the host's store needs,
|
|
43
|
+
* such as the owner namespace); `storeObject` streams an admitted object into
|
|
44
|
+
* the host's content-addressed store, which verifies its digest;
|
|
44
45
|
* `submitCandidate` hands an admitted manifest to the host's Publisher
|
|
45
46
|
* custody; `record` delivers a reported fact to the host's own projection.
|
|
46
47
|
* `report` observes a body or JSON decode failure without changing its 400
|
|
47
48
|
* outcome; a host may wire its own structured logger or omit it.
|
|
48
49
|
*/
|
|
49
|
-
export declare function createBuildEgress
|
|
50
|
+
export declare function createBuildEgress<Admission extends Readonly<{
|
|
51
|
+
maxObjectBytes: number;
|
|
52
|
+
}>>(options: Readonly<{
|
|
50
53
|
admitBuild: (jobId: string) => Promise<Readonly<{
|
|
51
54
|
credentialId: string;
|
|
52
55
|
}> | null>;
|
|
53
|
-
admitObject: (jobId: string, grant: string) => Promise<
|
|
54
|
-
|
|
55
|
-
}> | null>;
|
|
56
|
-
storeObject: (object: CandidateObject, body: ReadableStream<Uint8Array> | null, mediaType: CandidateObjectMediaType) => Promise<"stored" | "refused">;
|
|
56
|
+
admitObject: (jobId: string, grant: string) => Promise<Admission | null>;
|
|
57
|
+
storeObject: (object: CandidateObject, body: ReadableStream<Uint8Array> | null, mediaType: CandidateObjectMediaType, admitted: Admission) => Promise<"stored" | "refused">;
|
|
57
58
|
submitCandidate: (jobId: string, manifest: TeamAppCandidateManifest, grant: string, credentialId: string) => Promise<Response>;
|
|
58
59
|
record: (event: BuildGitEvent) => Promise<void>;
|
|
59
60
|
report?: (operation: string, cause: unknown) => void;
|
package/dist/build-egress.js
CHANGED
|
@@ -34,8 +34,9 @@ export function isBuildGitPrincipal(principal) {
|
|
|
34
34
|
* The build-report handler for `/jobs/:id/(candidate|artifact|status)` and
|
|
35
35
|
* `PUT /jobs/:id/objects/sha256-<hex>`. `admitBuild` is the host's own
|
|
36
36
|
* live-job lookup; `admitObject` admits one object upload for a live job's
|
|
37
|
-
* grant and answers its size bound
|
|
38
|
-
*
|
|
37
|
+
* grant and answers its size bound (and whatever else the host's store needs,
|
|
38
|
+
* such as the owner namespace); `storeObject` streams an admitted object into
|
|
39
|
+
* the host's content-addressed store, which verifies its digest;
|
|
39
40
|
* `submitCandidate` hands an admitted manifest to the host's Publisher
|
|
40
41
|
* custody; `record` delivers a reported fact to the host's own projection.
|
|
41
42
|
* `report` observes a body or JSON decode failure without changing its 400
|
|
@@ -67,7 +68,7 @@ export function createBuildEgress(options) {
|
|
|
67
68
|
const stored = await options.storeObject(Schema.decodeUnknownSync(candidateObjectSchema)({
|
|
68
69
|
digest: `sha256:${hex}`,
|
|
69
70
|
byteLength,
|
|
70
|
-
}), request.body, mediaType);
|
|
71
|
+
}), request.body, mediaType, admitted);
|
|
71
72
|
return new Response(null, { status: stored === "stored" ? 204 : 400 });
|
|
72
73
|
};
|
|
73
74
|
return Object.freeze({
|
package/dist/build.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export { frozenSnapshotInstallArguments } from "./build/snapshot-package-store.j
|
|
|
9
9
|
export { repositoryEnvironment, artifactsGitEnvironment, hostedArtifactsGitRemote, } from "./build/git-environment.js";
|
|
10
10
|
/** Captured-dependency build program with guarded filesystem access. */
|
|
11
11
|
export declare const dependencyBuildProgram: string;
|
|
12
|
-
export { stageBuildOutput, writeArtifactRoot, type ImmutableArtifactObjects, type StagedArtifactObject, type StagedBuildOutput, } from "./build/artifact-writer.js";
|
|
12
|
+
export { stageBuildOutput, writeArtifactRoot, type ImmutableArtifactObjects, type StagedArtifactObject, type StagedCandidateObject, type StagedBuildOutput, } from "./build/artifact-writer.js";
|