@fungi.computer/computer 0.18.9 → 0.18.11

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.
@@ -24,5 +24,8 @@ export declare function applyWorkspacePatch(workspace: Pick<Workspace, "runtime"
24
24
  }[];
25
25
  error: {
26
26
  kind: "mismatch";
27
+ } | {
28
+ kind: "engine_missing";
29
+ reason: string;
27
30
  };
28
31
  }>;
@@ -60,7 +60,14 @@ const nativePatch = {
60
60
  timeoutMs: 30_000,
61
61
  mismatchExitCode: 23,
62
62
  formatExitCode: 24,
63
+ /** The shell's "command not found" status. */
64
+ missingExitCode: 127,
65
+ /** The shell's "found but not executable" status. */
66
+ notExecutableExitCode: 126,
63
67
  };
68
+ /** Shown to the Agent when the Computer image lacks the engine; the patch was never judged. */
69
+ const engineMissingReason = "The Computer is missing its file-patch engine (a platform problem, not the patch). Retrying will not help.";
70
+ const engineNotExecutableReason = "The Computer's file-patch engine is not executable (a platform problem, not the patch). Retrying will not help.";
64
71
  /**
65
72
  * A patch the engine rejects as malformed (its format exit code) is often cut
66
73
  * short or wrapped. Quote the received last line so the Agent can fix the patch
@@ -79,14 +86,44 @@ export async function applyWorkspacePatch(workspace, backend, input) {
79
86
  const env_1 = { stack: [], error: void 0, hasError: false };
80
87
  try {
81
88
  const { patch } = patchInputSchema.parse(input);
82
- const run = __addDisposableResource(env_1, await workspace.runtime.exec(nativePatch.executable, {
89
+ const failure = (cause, reason, exitCode) => {
90
+ console.error("Computer file-patch engine is unavailable", {
91
+ executable: nativePatch.executable,
92
+ cause,
93
+ });
94
+ return patchOutputSchema.parse({
95
+ status: "failed",
96
+ exitCode,
97
+ stdout: "",
98
+ stderr: reason,
99
+ truncated: false,
100
+ error: { kind: "engine_missing", reason },
101
+ });
102
+ };
103
+ const started = await workspace.runtime
104
+ .exec(nativePatch.executable, {
83
105
  backend,
84
106
  cwd: nativePatch.cwd,
85
107
  encoding: "utf8",
86
108
  stdin: patch,
87
109
  timeoutMs: nativePatch.timeoutMs,
88
- }), false);
110
+ })
111
+ .then((value) => ({ value }), (cause) => {
112
+ if (cause instanceof Error &&
113
+ "code" in cause &&
114
+ cause.code === "ENOENT")
115
+ return null;
116
+ throw cause;
117
+ });
118
+ if (started === null)
119
+ return failure("spawn ENOENT", engineMissingReason, nativePatch.missingExitCode);
120
+ const run = __addDisposableResource(env_1, started.value, false);
89
121
  const result = await run.result();
122
+ // The engine is the executed command, so its shell "not found" status means it is absent.
123
+ if (result.exitCode === nativePatch.missingExitCode)
124
+ return failure(result.stderr, engineMissingReason, nativePatch.missingExitCode);
125
+ if (result.exitCode === nativePatch.notExecutableExitCode)
126
+ return failure(result.stderr, engineNotExecutableReason, nativePatch.notExecutableExitCode);
90
127
  const synchronizationFailure = result.sync.status === "pending" ? result.sync.error : null;
91
128
  const stdout = boundExecStream(result.stdout, "stdout");
92
129
  const stderr = boundExecStream(synchronizationFailure !== null
package/dist/index.d.ts CHANGED
@@ -305,6 +305,9 @@ export declare class ComputerDO extends ContainerComputer implements ComputerFil
305
305
  }[];
306
306
  error: {
307
307
  kind: "mismatch";
308
+ } | {
309
+ kind: "engine_missing";
310
+ reason: string;
308
311
  };
309
312
  }>;
310
313
  /** Write bounded UTF-8 text after the resource host accepts local authority. */
@@ -21523,7 +21523,7 @@ function isIdempotencyKey(input) {
21523
21523
  return /^idem_[a-z0-9](?:[a-z0-9_-]{0,126}[a-z0-9])?$/u.test(input);
21524
21524
  }
21525
21525
  function isSourceRevision(input) {
21526
- return /^git:[0-9a-f]{40}$/u.test(input);
21526
+ return /^(?:git:[0-9a-f]{40}|bundle:sha256:[0-9a-f]{64})$/u.test(input);
21527
21527
  }
21528
21528
  function isSha256Digest(input) {
21529
21529
  return /^sha256:[0-9a-f]{64}$/u.test(input);
@@ -21535,6 +21535,8 @@ var appReleaseIdFamily = defineIdFamily({
21535
21535
  family: "app-release",
21536
21536
  version: 1,
21537
21537
  kinds: {
21538
+ app: { prefix: "app" },
21539
+ release: { prefix: "rel" },
21538
21540
  transition: { prefix: "app_transition" },
21539
21541
  surface: { prefix: "ps" },
21540
21542
  erasure: { prefix: "app_erasure" }
@@ -21542,6 +21544,8 @@ var appReleaseIdFamily = defineIdFamily({
21542
21544
  });
21543
21545
  var appTransitionIdCodec = appReleaseIdFamily.transition;
21544
21546
  var appSurfaceIdCodec = appReleaseIdFamily.surface;
21547
+ var appIdentityCodec = appReleaseIdFamily.app;
21548
+ var appReleaseIdentityCodec = appReleaseIdFamily.release;
21545
21549
  var appErasureIdCodec = appReleaseIdFamily.erasure;
21546
21550
  var appIdSchema = String4.pipe(refine(isAppId));
21547
21551
  var releaseIdSchema = String4.pipe(refine(isReleaseId));
@@ -21574,7 +21578,10 @@ var releaseSchema = Struct({
21574
21578
  var publicSurfaceSchema = Struct({
21575
21579
  publicSurfaceId: publicSurfaceIdSchema,
21576
21580
  appId: appIdSchema,
21577
- stableRoute: stableRouteSchema
21581
+ stableRoute: stableRouteSchema,
21582
+ site: optionalKey2(Struct({
21583
+ name: String4.check(isPattern2(/^[A-Za-z0-9._-]{1,128}$/u))
21584
+ }))
21578
21585
  });
21579
21586
  var publicationIdentitySchema = String4.pipe(check(isMinLength(1)), check(isMaxLength(256)));
21580
21587
  var publicSurfaceDefinitionSchema = Struct({
@@ -21876,6 +21883,17 @@ var durableBackendSchema = Struct({
21876
21883
  code: String4.pipe(check(isMinLength(1)))
21877
21884
  });
21878
21885
  var backendJsonSchema = fromJsonString2(durableBackendSchema);
21886
+ var siteHttpRequestSchema = Struct({
21887
+ url: String4,
21888
+ method: NonEmptyString,
21889
+ contentType: NullOr(String4),
21890
+ bodyBase64: String4
21891
+ });
21892
+ var siteHttpReplySchema = Struct({
21893
+ status: Number5.check(isInt(), isBetween({ minimum: 200, maximum: 599 })),
21894
+ headers: ArraySchema(Tuple([String4, String4])),
21895
+ bodyBase64: String4
21896
+ });
21879
21897
 
21880
21898
  // ../puffball/dist/internal/verified-artifact-snapshot.js
21881
21899
  var DEFAULT_ARTIFACT_SNAPSHOT_POLICY = Object.freeze({ maxBytes: 65536 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.18.9",
3
+ "version": "0.18.11",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Cloudflare Computer host for one durable Fungi Computer",
6
6
  "type": "module",
@@ -72,10 +72,10 @@
72
72
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
73
73
  "@fungi.computer/cloudflare-computer": "0.2.1-fungi.4",
74
74
  "@fungi.computer/cordyceps": "0.4.3",
75
- "@fungi.computer/knapsack": "0.4.31",
75
+ "@fungi.computer/knapsack": "0.4.33",
76
76
  "@fungi.computer/seam": "0.2.9",
77
77
  "@fungi.computer/watchdog": "0.1.7",
78
- "@fungi.computer/computer-contract": "0.6.8",
78
+ "@fungi.computer/computer-contract": "0.6.10",
79
79
  "effect": "4.0.2",
80
80
  "just-bash": "3.4.2",
81
81
  "zod": "4.4.3",