@fungi.computer/oyster 0.47.4 → 0.48.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.
Files changed (41) hide show
  1. package/README.md +8 -0
  2. package/dist/apps/index.d.ts +1 -0
  3. package/dist/apps/index.js +1 -0
  4. package/dist/apps/install-confirmation.d.ts +26 -0
  5. package/dist/apps/install-confirmation.js +28 -0
  6. package/dist/apps/installation.d.ts +6 -0
  7. package/dist/apps/installation.js +12 -7
  8. package/dist/boot-host-script.js +1 -1
  9. package/dist/build/job-log.d.ts +2 -0
  10. package/dist/build/job-log.js +16 -1
  11. package/dist/cloudflare.d.ts +11 -1
  12. package/dist/cloudflare.js +5 -4
  13. package/dist/embed-metafiles.js +2 -2
  14. package/dist/embed-scripts.js +1 -1
  15. package/dist/frame-failure.d.ts +47 -0
  16. package/dist/frame-failure.js +75 -0
  17. package/dist/hello-app-script.js +1 -1
  18. package/dist/host.d.ts +5 -1
  19. package/dist/host.js +61 -15
  20. package/dist/install-release-cli.d.ts +1 -1
  21. package/dist/install-release-cli.js +73 -24
  22. package/dist/pack.d.ts +52 -1
  23. package/dist/pack.js +54 -11
  24. package/dist/page/app-permissions.js +2 -5
  25. package/dist/page/mount.js +2 -5
  26. package/dist/page-script.js +2 -2
  27. package/dist/standalone/agents.d.ts +1 -1
  28. package/dist/standalone/agents.js +1 -4
  29. package/dist/standalone/computer.d.ts +10 -0
  30. package/dist/standalone/computer.js +43 -1
  31. package/dist/starter-agent.d.ts +1 -3
  32. package/dist/starter-agent.js +4 -8
  33. package/dist/workers.d.ts +4 -0
  34. package/dist/workers.js +28 -1
  35. package/docs/api/apps.md +53 -0
  36. package/docs/api/cloudflare.md +151 -4
  37. package/docs/api/host.md +2 -0
  38. package/docs/api/pack.md +131 -3
  39. package/docs/api/workers-git.md +1 -1
  40. package/docs/api/workers.md +13 -0
  41. package/package.json +12 -12
@@ -15,6 +15,8 @@ export type BuildJobLog = Schema.Schema.Type<typeof buildJobLogSchema>;
15
15
  export declare const isBuildJobLogRef: (ref: string) => boolean;
16
16
  /** What a host writes where it cannot redact: the ADR's form, never raw output. */
17
17
  export declare const redactionWithheld = "[output withheld: redaction unavailable]";
18
+ /** The log's last line when a private key opens and the output ends before it closes. */
19
+ export declare const keyWithheld = "[output withheld until the key ends]";
18
20
  /**
19
21
  * One bounded sink for a build's combined output. Veil's pattern redactor
20
22
  * (S3's gitleaks rules) runs before a byte is retained, so the stored log and
@@ -105,6 +105,9 @@ const maxPendingText = 1024 * 1024;
105
105
  const secretsOf = (matches) => matches.map(({ secret }) => secret);
106
106
  /** What a host writes where it cannot redact: the ADR's form, never raw output. */
107
107
  export const redactionWithheld = "[output withheld: redaction unavailable]";
108
+ /** The log's last line when a private key opens and the output ends before it closes. */
109
+ export const keyWithheld = "[output withheld until the key ends]";
110
+ const privateKeyRule = "private-key";
108
111
  /**
109
112
  * The redactor, or undefined when its rules cannot load: callers then write
110
113
  * {@link redactionWithheld} and never the unredacted text.
@@ -131,6 +134,10 @@ export async function createBuildJobLog(loadRedactor = loadPatternRedactor) {
131
134
  let pending = "";
132
135
  let scannedLength = 0;
133
136
  let masking;
137
+ let maskingKey = false;
138
+ const appendKeyNote = () => {
139
+ ring.append(textToBytes(`\n${keyWithheld}\n`));
140
+ };
134
141
  const scan = (final) => {
135
142
  if (redactor === undefined) {
136
143
  pending = "";
@@ -168,8 +175,12 @@ export async function createBuildJobLog(loadRedactor = loadPatternRedactor) {
168
175
  { start: open.opener.start, end: pending.length },
169
176
  ])));
170
177
  // The rest of the block, through its end, is masked as it arrives.
171
- if (!final)
178
+ if (!final) {
172
179
  masking = open.follow();
180
+ maskingKey = open.ruleId === privateKeyRule;
181
+ }
182
+ else if (open.ruleId === privateKeyRule)
183
+ appendKeyNote();
173
184
  pending = "";
174
185
  scannedLength = 0;
175
186
  return;
@@ -213,6 +224,7 @@ export async function createBuildJobLog(loadRedactor = loadPatternRedactor) {
213
224
  if (end === undefined)
214
225
  return;
215
226
  masking = undefined;
227
+ maskingKey = false;
216
228
  text = text.slice(end);
217
229
  }
218
230
  pending += text;
@@ -223,6 +235,9 @@ export async function createBuildJobLog(loadRedactor = loadPatternRedactor) {
223
235
  },
224
236
  finish() {
225
237
  scan(true);
238
+ // A key masked past the ceiling that never closed ends the log with the note.
239
+ if (masking !== undefined && maskingKey)
240
+ appendKeyNote();
226
241
  return ring.finish();
227
242
  },
228
243
  };
@@ -40,14 +40,24 @@ export type FrameBindingProps = Readonly<{
40
40
  export type FrameBindingMethod<Result> = Readonly<{
41
41
  /** Decode the guest's positional arguments with the maintained method grammar. */
42
42
  decodeArgs: (raw: readonly unknown[]) => readonly unknown[];
43
+ /** Decode the host's reply; the frame owner calls it once, where the reply first arrives. */
43
44
  decodeResult: z.ZodType<Result>["parse"];
44
45
  /** Determine the declared operations needed for these decoded arguments. */
45
46
  requiredOperations: (args: readonly unknown[]) => readonly string[];
46
47
  /** Select a concrete host resource after decoding, before provider dispatch. */
47
48
  requestedResource?: (args: readonly unknown[]) => ResourceRef;
48
49
  }>;
50
+ export { createFrameFailureSlot, decodeBindingReply, rejectedFieldPath, type FrameFailure, type FrameFailureSlot, } from "./frame-failure.js";
49
51
  /** Method descriptors for the closed App binding vocabulary. */
50
52
  export type FrameBindingMethods<Result> = Readonly<Partial<Record<AppBackendBindingName, Readonly<Record<string, FrameBindingMethod<Result>>>>>>;
53
+ /**
54
+ * What the binding entrypoint needs of a method: its argument grammar and
55
+ * operation policy. It never decodes a reply; the frame owner does, with the
56
+ * full {@link FrameBindingMethod}.
57
+ */
58
+ export type FrameBindingEntrypointMethod = Omit<FrameBindingMethod<unknown>, "decodeResult">;
59
+ /** The entrypoint's view of {@link FrameBindingMethods}: no reply decoders. */
60
+ export type FrameBindingEntrypointMethods = Readonly<Partial<Record<AppBackendBindingName, Readonly<Record<string, FrameBindingEntrypointMethod>>>>>;
51
61
  /** Shared replay-only port codecs. Origin input is verified by the host and fails with a typed refusal. */
52
62
  export declare const backgroundFrameMethods: {
53
63
  BACKGROUND: {
@@ -75,7 +85,7 @@ export declare const frameBindingPropsSchema: Schema.Struct<{
75
85
  /** Decode a host routing packet or refuse it before any Instance lookup. */
76
86
  export declare function decodeFrameBindingProps(raw: unknown): FrameBindingProps;
77
87
  /** One native binding factory for both Hub and standalone, preserving RPC values. */
78
- export declare function frameBindingEntrypoint<Env, Result>(methods: FrameBindingMethods<Result>, dispatch: (env: Env, props: FrameBindingProps, method: string, args: readonly unknown[]) => Promise<FrameBindingReply<unknown>>): typeof WorkerEntrypoint<Env, FrameBindingProps>;
88
+ export declare function frameBindingEntrypoint<Env, Result>(methods: FrameBindingEntrypointMethods, dispatch: (env: Env, props: FrameBindingProps, method: string, args: readonly unknown[]) => Promise<FrameBindingReply<Result>>): typeof WorkerEntrypoint<Env, FrameBindingProps>;
79
89
  /** Native facet handle; method RPCs are decoded at the invocation boundary. */
80
90
  export type AppFacetStub = Readonly<{
81
91
  /** Issue an HTTP request through the native facet handle. */
@@ -251,6 +251,7 @@ async function readHttpBody(body, ceiling) {
251
251
  }
252
252
  return bytes;
253
253
  }
254
+ export { createFrameFailureSlot, decodeBindingReply, rejectedFieldPath, } from "./frame-failure.js";
254
255
  /** Shared replay-only port codecs. Origin input is verified by the host and fails with a typed refusal. */
255
256
  export const backgroundFrameMethods = {
256
257
  BACKGROUND: {
@@ -322,10 +323,10 @@ export function frameBindingEntrypoint(methods, dispatch) {
322
323
  return decoded;
323
324
  if (descriptor === undefined)
324
325
  throw new AppInstanceError("invalid_invocation_facts");
325
- return {
326
- kind: "result",
327
- value: descriptor.decodeResult(decoded.value),
328
- };
326
+ // The frame owner already decoded this reply with the method's
327
+ // `decodeResult`; decoding it again here would hide a bad reply from
328
+ // the frame it belongs to.
329
+ return reply;
329
330
  },
330
331
  });
331
332
  }