@fungi.computer/computer 0.18.3 → 0.18.4
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/dist/command-failure.js +43 -1
- package/dist/fleet/wire.d.ts +2 -2
- package/package.json +4 -4
package/dist/command-failure.js
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
/** Longest cause text reported to a caller. */
|
|
2
3
|
const maximumCauseCharacters = 400;
|
|
4
|
+
const transportStageSchema = z.looseObject({
|
|
5
|
+
stage: z.enum(["start", "egress", "health", "restart"]),
|
|
6
|
+
});
|
|
7
|
+
/** Most causes followed when collecting connect stages. */
|
|
8
|
+
const maximumCauseHops = 8;
|
|
9
|
+
const transportNames = new Set([
|
|
10
|
+
"WorkspaceTransportError",
|
|
11
|
+
"WorkspacePreDispatchTransportError",
|
|
12
|
+
]);
|
|
13
|
+
/** The Workspace's own transport failure, recognised by its tagged name. */
|
|
14
|
+
function isTransportError(cause) {
|
|
15
|
+
return cause instanceof Error && transportNames.has(cause.name);
|
|
16
|
+
}
|
|
17
|
+
/** The typed connect stage a transport failure carries, when it has one. */
|
|
18
|
+
function transportStage(error) {
|
|
19
|
+
if (!isTransportError(error))
|
|
20
|
+
return undefined;
|
|
21
|
+
const parsed = transportStageSchema.safeParse(error);
|
|
22
|
+
return parsed.success ? parsed.data.stage : undefined;
|
|
23
|
+
}
|
|
3
24
|
function causeText(cause) {
|
|
4
25
|
return cause instanceof Error
|
|
5
26
|
? `${cause.name}: ${cause.message}`
|
|
@@ -23,13 +44,34 @@ function redact(text, secrets) {
|
|
|
23
44
|
* handed to the command; they never appear in the reported text.
|
|
24
45
|
*/
|
|
25
46
|
export function describeCommandFailure(input) {
|
|
26
|
-
if (input.hosted && input.stage === "dispatched")
|
|
47
|
+
if (input.hosted && input.stage === "dispatched") {
|
|
48
|
+
if (isTransportError(input.cause)) {
|
|
49
|
+
// Our own transport type carries no carriage content; only its typed
|
|
50
|
+
// connect stages are repeated, never its free text.
|
|
51
|
+
const stages = new Set();
|
|
52
|
+
const seen = new Set();
|
|
53
|
+
for (let error = input.cause; error instanceof Error &&
|
|
54
|
+
!seen.has(error) &&
|
|
55
|
+
seen.size < maximumCauseHops; error = error.cause) {
|
|
56
|
+
seen.add(error);
|
|
57
|
+
const stage = transportStage(error);
|
|
58
|
+
if (stage !== undefined)
|
|
59
|
+
stages.add(`stage=${stage}`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: "unknown",
|
|
63
|
+
cause: stages.size > 0
|
|
64
|
+
? `the Computer did not wake (connect failed at ${[...stages].join(", ")})`
|
|
65
|
+
: "the Computer's runtime connection failed (WorkspaceTransportError)",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
27
68
|
return {
|
|
28
69
|
kind: "unknown",
|
|
29
70
|
cause: input.cause instanceof Error
|
|
30
71
|
? `the native runtime failed (${input.cause.name})`
|
|
31
72
|
: "the native runtime failed",
|
|
32
73
|
};
|
|
74
|
+
}
|
|
33
75
|
const cause = redact(causeText(input.cause), input.secrets);
|
|
34
76
|
if (input.stage === "dispatched")
|
|
35
77
|
return { kind: "unknown", cause };
|
package/dist/fleet/wire.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
import { hostedBackingSchema, type AttachedBackend } from "../computer-backends.js";
|
|
3
3
|
/** Operations the host may admit on one Computer. */
|
|
4
4
|
export declare const computerActionSchema: z.ZodEnum<{
|
|
5
|
-
exec: "exec";
|
|
6
5
|
start: "start";
|
|
6
|
+
exec: "exec";
|
|
7
7
|
delete: "delete";
|
|
8
8
|
mkdir: "mkdir";
|
|
9
9
|
backing: "backing";
|
|
@@ -48,8 +48,8 @@ export type ComputerProvenance = z.output<typeof computerProvenanceSchema>;
|
|
|
48
48
|
export declare const computerGrantSchema: z.ZodObject<{
|
|
49
49
|
computerId: z.ZodString;
|
|
50
50
|
actions: z.ZodReadonly<z.ZodSet<z.ZodEnum<{
|
|
51
|
-
exec: "exec";
|
|
52
51
|
start: "start";
|
|
52
|
+
exec: "exec";
|
|
53
53
|
delete: "delete";
|
|
54
54
|
mkdir: "mkdir";
|
|
55
55
|
backing: "backing";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/computer",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Cloudflare Computer host for one durable Fungi Computer",
|
|
6
6
|
"type": "module",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@fungi.computer/cairn": "0.1.0",
|
|
72
72
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
73
|
-
"@fungi.computer/cloudflare-computer": "0.2.1-fungi.
|
|
73
|
+
"@fungi.computer/cloudflare-computer": "0.2.1-fungi.4",
|
|
74
74
|
"@fungi.computer/cordyceps": "0.4.3",
|
|
75
|
-
"@fungi.computer/knapsack": "0.4.
|
|
75
|
+
"@fungi.computer/knapsack": "0.4.27",
|
|
76
76
|
"@fungi.computer/seam": "0.2.7",
|
|
77
77
|
"@fungi.computer/watchdog": "0.1.5",
|
|
78
|
-
"@fungi.computer/computer-contract": "0.6.
|
|
78
|
+
"@fungi.computer/computer-contract": "0.6.4",
|
|
79
79
|
"effect": "4.0.2",
|
|
80
80
|
"just-bash": "3.4.2",
|
|
81
81
|
"zod": "4.4.3",
|