opencode-supertask 0.1.33 → 0.1.35
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/CHANGELOG.md +59 -0
- package/README.md +66 -13
- package/dist/cli/index.js +853 -152
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +449 -32
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +166 -4
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.d.ts +12 -1
- package/dist/web/index.js +459 -63
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.d.ts +3 -1
- package/dist/worker/index.js +19 -4
- package/dist/worker/index.js.map +1 -1
- package/package.json +2 -1
package/dist/worker/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface InterruptedTaskRun {
|
|
|
8
8
|
taskId: number;
|
|
9
9
|
runId: number;
|
|
10
10
|
}
|
|
11
|
+
declare function runCommandContext(executable: string, args: string[], cwd: string): string;
|
|
11
12
|
declare function assertWorkerProcessIsolationSupported(platform?: NodeJS.Platform): void;
|
|
12
13
|
declare class WorkerEngine {
|
|
13
14
|
private activeBatchIds;
|
|
@@ -42,9 +43,10 @@ declare class WorkerEngine {
|
|
|
42
43
|
private killEntry;
|
|
43
44
|
private signalEntry;
|
|
44
45
|
private releaseBatch;
|
|
46
|
+
private outputWithCommand;
|
|
45
47
|
private resolveModel;
|
|
46
48
|
private runDetached;
|
|
47
49
|
private logError;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export { type InterruptedTaskRun, WorkerEngine, assertWorkerProcessIsolationSupported };
|
|
52
|
+
export { type InterruptedTaskRun, WorkerEngine, assertWorkerProcessIsolationSupported, runCommandContext };
|
package/dist/worker/index.js
CHANGED
|
@@ -6652,6 +6652,14 @@ import { dirname as dirname3, join as join2 } from "path";
|
|
|
6652
6652
|
import { randomUUID } from "crypto";
|
|
6653
6653
|
var DEFAULT_MAX_OUTPUT_CHARS = 64 * 1024;
|
|
6654
6654
|
var FORBIDDEN_AGENT = "supertask-runner";
|
|
6655
|
+
function runCommandContext(executable, args, cwd) {
|
|
6656
|
+
return JSON.stringify({
|
|
6657
|
+
type: "supertask_command",
|
|
6658
|
+
executable,
|
|
6659
|
+
args,
|
|
6660
|
+
cwd
|
|
6661
|
+
});
|
|
6662
|
+
}
|
|
6655
6663
|
function assertWorkerProcessIsolationSupported(platform = process.platform) {
|
|
6656
6664
|
if (platform === "win32") {
|
|
6657
6665
|
throw new Error(
|
|
@@ -6860,6 +6868,7 @@ var WorkerEngine = class {
|
|
|
6860
6868
|
runId,
|
|
6861
6869
|
launchIdentity,
|
|
6862
6870
|
child,
|
|
6871
|
+
commandContext: runCommandContext(this.opencodeBin, args, task.cwd || process.cwd()),
|
|
6863
6872
|
output: "",
|
|
6864
6873
|
sessionId: null,
|
|
6865
6874
|
timeoutTimer: null,
|
|
@@ -6994,7 +7003,7 @@ var WorkerEngine = class {
|
|
|
6994
7003
|
);
|
|
6995
7004
|
return;
|
|
6996
7005
|
}
|
|
6997
|
-
const failure = code === 0 ? void 0 : `${spawnError ? "\u65E0\u6CD5\u542F\u52A8 opencode" : "opencode \u9000\u51FA\u7801"} ${spawnError?.message ?? code ?? "null"}${signal ? `\uFF0C\u4FE1\u53F7 ${signal}` : ""}`;
|
|
7006
|
+
const failure = code === 0 ? void 0 : `${spawnError ? "\u65E0\u6CD5\u542F\u52A8 opencode" : "opencode \u9000\u51FA\u7801"} ${spawnError?.message ?? code ?? "null"}${signal ? `\uFF0C\u4FE1\u53F7 ${signal}` : ""}\uFF08agent=${entry.task.agent}\uFF0Cmodel=${this.resolveModel(entry.task.model) ?? "Agent/\u9ED8\u8BA4\u914D\u7F6E"}\uFF0Ccwd=${entry.task.cwd ?? process.cwd()}\uFF09`;
|
|
6998
7007
|
this.runDetached(
|
|
6999
7008
|
this.settleEntry(entry, code, failure),
|
|
7000
7009
|
"task settlement failed",
|
|
@@ -7024,7 +7033,7 @@ var WorkerEngine = class {
|
|
|
7024
7033
|
const termination = entry.termination;
|
|
7025
7034
|
if (termination?.kind === "shutdown") return;
|
|
7026
7035
|
if (termination?.kind === "cancel") {
|
|
7027
|
-
const output2 =
|
|
7036
|
+
const output2 = this.outputWithCommand(entry);
|
|
7028
7037
|
const log2 = `${termination.message}${output2 ? `
|
|
7029
7038
|
${output2}` : ""}`;
|
|
7030
7039
|
await TaskRunService.fail(entry.runId, log2);
|
|
@@ -7038,7 +7047,7 @@ ${output2}` : ""}`;
|
|
|
7038
7047
|
}
|
|
7039
7048
|
const currentRun = await TaskRunService.getById(entry.runId);
|
|
7040
7049
|
if (!currentRun || currentRun.status !== "running") return;
|
|
7041
|
-
const output =
|
|
7050
|
+
const output = this.outputWithCommand(entry);
|
|
7042
7051
|
const log = failure ? `${failure}${output ? `
|
|
7043
7052
|
${output}` : ""}` : output;
|
|
7044
7053
|
if (code === 0 && !failure) {
|
|
@@ -7174,6 +7183,11 @@ ${output}` : ""}` : output;
|
|
|
7174
7183
|
const batchId = normalizeTaskBatchId(task.batchId);
|
|
7175
7184
|
if (batchId) this.activeBatchIds.delete(batchId);
|
|
7176
7185
|
}
|
|
7186
|
+
outputWithCommand(entry) {
|
|
7187
|
+
const output = entry.output.trim();
|
|
7188
|
+
return `${entry.commandContext}${output ? `
|
|
7189
|
+
${output}` : ""}`;
|
|
7190
|
+
}
|
|
7177
7191
|
resolveModel(taskModel) {
|
|
7178
7192
|
if (!taskModel || taskModel === "default") return null;
|
|
7179
7193
|
return taskModel;
|
|
@@ -7196,6 +7210,7 @@ ${output}` : ""}` : output;
|
|
|
7196
7210
|
};
|
|
7197
7211
|
export {
|
|
7198
7212
|
WorkerEngine,
|
|
7199
|
-
assertWorkerProcessIsolationSupported
|
|
7213
|
+
assertWorkerProcessIsolationSupported,
|
|
7214
|
+
runCommandContext
|
|
7200
7215
|
};
|
|
7201
7216
|
//# sourceMappingURL=index.js.map
|