@fungi.computer/computer 0.12.1 → 0.13.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.
- package/dist/fleet/wire.d.ts +2 -0
- package/dist/index.js +28 -1
- package/dist/team-candidate-builder.mjs +1823 -1833
- package/package.json +3 -3
package/dist/fleet/wire.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const computerActionSchema: z.ZodEnum<{
|
|
|
18
18
|
"files.edit": "files.edit";
|
|
19
19
|
"files.patch": "files.patch";
|
|
20
20
|
"files.move": "files.move";
|
|
21
|
+
"files.remove": "files.remove";
|
|
21
22
|
terminal: "terminal";
|
|
22
23
|
stop: "stop";
|
|
23
24
|
processStart: "processStart";
|
|
@@ -56,6 +57,7 @@ export declare const computerGrantSchema: z.ZodObject<{
|
|
|
56
57
|
"files.edit": "files.edit";
|
|
57
58
|
"files.patch": "files.patch";
|
|
58
59
|
"files.move": "files.move";
|
|
60
|
+
"files.remove": "files.remove";
|
|
59
61
|
terminal: "terminal";
|
|
60
62
|
stop: "stop";
|
|
61
63
|
processStart: "processStart";
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ import { z } from "zod";
|
|
|
68
68
|
import { SystemTrustContainerBackend } from "./container-system-trust.js";
|
|
69
69
|
import { computerTransportBackend } from "./transport-backend.js";
|
|
70
70
|
import { PullPendingTracker } from "./pull-pending.js";
|
|
71
|
-
import { ComputerFileConflict, ComputerFileRangeError, ComputerFileTooLargeError, capabilityNameSchema, computerValueSchema, computerCapabilities, computerPortInputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, computerPortsOutputSchema, computerPortSchema, ComputerPortLimitError, ComputerPortReservedError, computerTerminalPort, isComputerReservedPort, maximumExposedPorts, maximumProcessRecords, execInputSchema, execOutputSchema, computerToolResult, computerExecutionRequestSchema, genericComputerExecutionBudget, mintComputerRequestId, listInputSchema, listOutputSchema, maximumFileBytes, mkdirInputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, ComputerFileMoveError, readInputSchema, readBytesInputSchema, readOutputSchema, replaceInputSchema, writeInputSchema, writeOutputSchema, processIdInputSchema, processKillOutputSchema, processListOutputSchema, processLogsInputSchema, processLogsOutputSchema, processWaitInputSchema, processWaitOutputSchema, maximumProcessLogLines, processStartInputSchema, processStartToolInputSchema, ComputerProcessNotFoundError, } from "@fungi.computer/computer-contract";
|
|
71
|
+
import { ComputerFileConflict, ComputerFileRangeError, ComputerFileTooLargeError, capabilityNameSchema, computerValueSchema, computerCapabilities, computerPortInputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, computerPortsOutputSchema, computerPortSchema, ComputerPortLimitError, ComputerPortReservedError, computerTerminalPort, isComputerReservedPort, maximumExposedPorts, maximumProcessRecords, execInputSchema, execOutputSchema, computerToolResult, computerExecutionRequestSchema, genericComputerExecutionBudget, mintComputerRequestId, listInputSchema, listOutputSchema, maximumFileBytes, mkdirInputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, ComputerFileMoveError, ComputerFileRemoveError, removeInputSchema, removeOutputSchema, readInputSchema, readBytesInputSchema, readOutputSchema, replaceInputSchema, writeInputSchema, writeOutputSchema, processIdInputSchema, processKillOutputSchema, processListOutputSchema, processLogsInputSchema, processLogsOutputSchema, processWaitInputSchema, processWaitOutputSchema, maximumProcessLogLines, processStartInputSchema, processStartToolInputSchema, ComputerProcessNotFoundError, } from "@fungi.computer/computer-contract";
|
|
72
72
|
import { createWorkspaceFilesPort, readBoundedWorkspaceText, workspaceFileExists, listWorkspaceFiles, } from "./files.js";
|
|
73
73
|
import { computerExecutionResult } from "./execution-result.js";
|
|
74
74
|
import { ComputerOperationRecord } from "./operation-record.js";
|
|
@@ -172,6 +172,27 @@ function move(workspace, input) {
|
|
|
172
172
|
}
|
|
173
173
|
return moveOutputSchema.parse({ from, to });
|
|
174
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Delete one file through the Workspace provider's `unlink`. A directory and
|
|
177
|
+
* a missing path are refused; call inside one storage transaction.
|
|
178
|
+
*/
|
|
179
|
+
function remove(workspace, input) {
|
|
180
|
+
const { path } = removeInputSchema.parse(input);
|
|
181
|
+
const provider = new SQLiteWorkspaceProvider(workspace.fs.db);
|
|
182
|
+
let stat;
|
|
183
|
+
try {
|
|
184
|
+
stat = provider.lstatSync(path);
|
|
185
|
+
}
|
|
186
|
+
catch (cause) {
|
|
187
|
+
if (isMissing.safeParse(cause).success)
|
|
188
|
+
throw new ComputerFileRemoveError("missing", `no such file: ${path}`);
|
|
189
|
+
throw cause;
|
|
190
|
+
}
|
|
191
|
+
if (stat.isDirectory())
|
|
192
|
+
throw new ComputerFileRemoveError("invalid", `a directory is not deleted: ${path}`);
|
|
193
|
+
provider.unlinkSync(path);
|
|
194
|
+
return removeOutputSchema.parse({ path });
|
|
195
|
+
}
|
|
175
196
|
async function write(workspace, input) {
|
|
176
197
|
const { path, content } = writeInputSchema.parse(input);
|
|
177
198
|
await workspace.fs.writeFile(path, content);
|
|
@@ -1107,6 +1128,12 @@ export class ComputerDO extends ContainerComputer {
|
|
|
1107
1128
|
await this.#syncRunningHosted("push");
|
|
1108
1129
|
return result;
|
|
1109
1130
|
}
|
|
1131
|
+
case "remove": {
|
|
1132
|
+
await this.#syncRunningHosted("pull");
|
|
1133
|
+
const result = this.state.storage.transactionSync(() => remove(workspace, input));
|
|
1134
|
+
await this.#syncRunningHosted("push");
|
|
1135
|
+
return result;
|
|
1136
|
+
}
|
|
1110
1137
|
default:
|
|
1111
1138
|
throw new Error(`Computer capability is unavailable: ${selected}`);
|
|
1112
1139
|
}
|