@fungi.computer/computer 0.18.10 → 0.18.12
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/files-patch.d.ts +3 -0
- package/dist/files-patch.js +39 -2
- package/dist/index.d.ts +3 -0
- package/package.json +3 -3
package/dist/files-patch.d.ts
CHANGED
package/dist/files-patch.js
CHANGED
|
@@ -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
|
|
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
|
-
})
|
|
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. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/computer",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.12",
|
|
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.
|
|
75
|
+
"@fungi.computer/knapsack": "0.4.34",
|
|
76
76
|
"@fungi.computer/seam": "0.2.9",
|
|
77
77
|
"@fungi.computer/watchdog": "0.1.7",
|
|
78
|
-
"@fungi.computer/computer-contract": "0.6.
|
|
78
|
+
"@fungi.computer/computer-contract": "0.6.11",
|
|
79
79
|
"effect": "4.0.2",
|
|
80
80
|
"just-bash": "3.4.2",
|
|
81
81
|
"zod": "4.4.3",
|