@agentteams/runner 0.0.46
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/api-client.d.ts +22 -0
- package/dist/api-client.js +201 -0
- package/dist/api-client.js.map +1 -0
- package/dist/api-client.test.d.ts +1 -0
- package/dist/api-client.test.js +118 -0
- package/dist/api-client.test.js.map +1 -0
- package/dist/autostart.d.ts +19 -0
- package/dist/autostart.js +359 -0
- package/dist/autostart.js.map +1 -0
- package/dist/autostart.test.d.ts +1 -0
- package/dist/autostart.test.js +42 -0
- package/dist/autostart.test.js.map +1 -0
- package/dist/commands/cleanup.d.ts +1 -0
- package/dist/commands/cleanup.js +12 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +57 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/restart.d.ts +1 -0
- package/dist/commands/restart.js +7 -0
- package/dist/commands/restart.js.map +1 -0
- package/dist/commands/start.d.ts +1 -0
- package/dist/commands/start.js +34 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +20 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +1 -0
- package/dist/commands/stop.js +21 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/uninstall.d.ts +1 -0
- package/dist/commands/uninstall.js +21 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.js +58 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/update.test.d.ts +1 -0
- package/dist/commands/update.test.js +104 -0
- package/dist/commands/update.test.js.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +69 -0
- package/dist/config.js.map +1 -0
- package/dist/config.test.d.ts +1 -0
- package/dist/config.test.js +133 -0
- package/dist/config.test.js.map +1 -0
- package/dist/daemon-control.d.ts +21 -0
- package/dist/daemon-control.js +58 -0
- package/dist/daemon-control.js.map +1 -0
- package/dist/daemon-control.test.d.ts +1 -0
- package/dist/daemon-control.test.js +48 -0
- package/dist/daemon-control.test.js.map +1 -0
- package/dist/executable.d.ts +25 -0
- package/dist/executable.js +141 -0
- package/dist/executable.js.map +1 -0
- package/dist/executable.test.d.ts +1 -0
- package/dist/executable.test.js +57 -0
- package/dist/executable.test.js.map +1 -0
- package/dist/handlers/trigger-handler.d.ts +25 -0
- package/dist/handlers/trigger-handler.js +308 -0
- package/dist/handlers/trigger-handler.js.map +1 -0
- package/dist/handlers/trigger-handler.test.d.ts +1 -0
- package/dist/handlers/trigger-handler.test.js +496 -0
- package/dist/handlers/trigger-handler.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.js +25 -0
- package/dist/logger.js.map +1 -0
- package/dist/pid.d.ts +8 -0
- package/dist/pid.js +49 -0
- package/dist/pid.js.map +1 -0
- package/dist/poller.d.ts +20 -0
- package/dist/poller.js +214 -0
- package/dist/poller.js.map +1 -0
- package/dist/poller.test.d.ts +1 -0
- package/dist/poller.test.js +382 -0
- package/dist/poller.test.js.map +1 -0
- package/dist/runners/amp.d.ts +5 -0
- package/dist/runners/amp.js +316 -0
- package/dist/runners/amp.js.map +1 -0
- package/dist/runners/claude-code.d.ts +6 -0
- package/dist/runners/claude-code.js +340 -0
- package/dist/runners/claude-code.js.map +1 -0
- package/dist/runners/claude-code.test.d.ts +1 -0
- package/dist/runners/claude-code.test.js +39 -0
- package/dist/runners/claude-code.test.js.map +1 -0
- package/dist/runners/codex.d.ts +6 -0
- package/dist/runners/codex.js +324 -0
- package/dist/runners/codex.js.map +1 -0
- package/dist/runners/codex.test.d.ts +1 -0
- package/dist/runners/codex.test.js +66 -0
- package/dist/runners/codex.test.js.map +1 -0
- package/dist/runners/gemini.d.ts +5 -0
- package/dist/runners/gemini.js +304 -0
- package/dist/runners/gemini.js.map +1 -0
- package/dist/runners/gemini.test.d.ts +1 -0
- package/dist/runners/gemini.test.js +16 -0
- package/dist/runners/gemini.test.js.map +1 -0
- package/dist/runners/index.d.ts +2 -0
- package/dist/runners/index.js +27 -0
- package/dist/runners/index.js.map +1 -0
- package/dist/runners/index.test.d.ts +1 -0
- package/dist/runners/index.test.js +19 -0
- package/dist/runners/index.test.js.map +1 -0
- package/dist/runners/log-reporter.d.ts +18 -0
- package/dist/runners/log-reporter.js +127 -0
- package/dist/runners/log-reporter.js.map +1 -0
- package/dist/runners/log-reporter.test.d.ts +1 -0
- package/dist/runners/log-reporter.test.js +152 -0
- package/dist/runners/log-reporter.test.js.map +1 -0
- package/dist/runners/opencode.d.ts +6 -0
- package/dist/runners/opencode.js +304 -0
- package/dist/runners/opencode.js.map +1 -0
- package/dist/runners/stream-json-parser.d.ts +17 -0
- package/dist/runners/stream-json-parser.js +116 -0
- package/dist/runners/stream-json-parser.js.map +1 -0
- package/dist/runners/types.d.ts +26 -0
- package/dist/runners/types.js +2 -0
- package/dist/runners/types.js.map +1 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/auth-path-store.d.ts +3 -0
- package/dist/utils/auth-path-store.js +37 -0
- package/dist/utils/auth-path-store.js.map +1 -0
- package/dist/utils/auth-path-store.test.d.ts +1 -0
- package/dist/utils/auth-path-store.test.js +70 -0
- package/dist/utils/auth-path-store.test.js.map +1 -0
- package/dist/utils/convention-sync.d.ts +8 -0
- package/dist/utils/convention-sync.js +41 -0
- package/dist/utils/convention-sync.js.map +1 -0
- package/dist/utils/convention-sync.test.d.ts +1 -0
- package/dist/utils/convention-sync.test.js +75 -0
- package/dist/utils/convention-sync.test.js.map +1 -0
- package/dist/utils/git-worktree.d.ts +9 -0
- package/dist/utils/git-worktree.js +150 -0
- package/dist/utils/git-worktree.js.map +1 -0
- package/dist/utils/git-worktree.test.d.ts +1 -0
- package/dist/utils/git-worktree.test.js +294 -0
- package/dist/utils/git-worktree.test.js.map +1 -0
- package/dist/utils/origin-issue-safeguard.d.ts +16 -0
- package/dist/utils/origin-issue-safeguard.js +198 -0
- package/dist/utils/origin-issue-safeguard.js.map +1 -0
- package/dist/utils/runner-cleanup.d.ts +10 -0
- package/dist/utils/runner-cleanup.js +59 -0
- package/dist/utils/runner-cleanup.js.map +1 -0
- package/dist/utils/runner-cleanup.test.d.ts +1 -0
- package/dist/utils/runner-cleanup.test.js +93 -0
- package/dist/utils/runner-cleanup.test.js.map +1 -0
- package/dist/utils/runner-history.d.ts +6 -0
- package/dist/utils/runner-history.js +13 -0
- package/dist/utils/runner-history.js.map +1 -0
- package/dist/utils/runner-history.test.d.ts +1 -0
- package/dist/utils/runner-history.test.js +25 -0
- package/dist/utils/runner-history.test.js.map +1 -0
- package/package.json +50 -0
- package/readme.md +188 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { platform as getPlatform } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
const DEFAULT_WINDOWS_EXTENSIONS = [".com", ".exe", ".bat", ".cmd"];
|
|
6
|
+
const getFirstOutputLine = (output) => {
|
|
7
|
+
const firstLine = output
|
|
8
|
+
.split(/\r?\n/u)
|
|
9
|
+
.map((line) => line.trim())
|
|
10
|
+
.find((line) => line.length > 0);
|
|
11
|
+
return firstLine ?? null;
|
|
12
|
+
};
|
|
13
|
+
const getWindowsExecutableNames = (name, env) => {
|
|
14
|
+
if (/\.[^./\\]+$/u.test(name)) {
|
|
15
|
+
return [name];
|
|
16
|
+
}
|
|
17
|
+
const pathExt = env.PATHEXT
|
|
18
|
+
?.split(";")
|
|
19
|
+
.map((entry) => entry.trim().toLowerCase())
|
|
20
|
+
.filter((entry) => entry.length > 0);
|
|
21
|
+
const extensions = pathExt && pathExt.length > 0 ? pathExt : DEFAULT_WINDOWS_EXTENSIONS;
|
|
22
|
+
return [name, ...extensions.map((extension) => `${name}${extension}`)];
|
|
23
|
+
};
|
|
24
|
+
const getNpmGlobalBinPath = (deps) => {
|
|
25
|
+
const run = deps.execFileSync ?? execFileSync;
|
|
26
|
+
try {
|
|
27
|
+
const output = run("npm", ["prefix", "-g"], { encoding: "utf8" }).trim();
|
|
28
|
+
return output.length > 0 ? output : null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const resolveFromPathLookup = (name, deps) => {
|
|
35
|
+
const os = (deps.platform ?? getPlatform)();
|
|
36
|
+
const run = deps.execFileSync ?? execFileSync;
|
|
37
|
+
const lookupCommand = os === "win32" ? "where" : "which";
|
|
38
|
+
try {
|
|
39
|
+
const output = run(lookupCommand, [name], { encoding: "utf8" });
|
|
40
|
+
return getFirstOutputLine(output);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const resolveFromNpmGlobalBin = (name, deps) => {
|
|
47
|
+
const os = (deps.platform ?? getPlatform)();
|
|
48
|
+
const fileExists = deps.existsSync ?? existsSync;
|
|
49
|
+
const npmGlobalBinPath = getNpmGlobalBinPath(deps);
|
|
50
|
+
if (!npmGlobalBinPath) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const candidateNames = os === "win32" ? getWindowsExecutableNames(name, deps.env ?? process.env) : [name];
|
|
54
|
+
for (const candidateName of candidateNames) {
|
|
55
|
+
const candidatePath = join(npmGlobalBinPath, candidateName);
|
|
56
|
+
if (fileExists(candidatePath)) {
|
|
57
|
+
return candidatePath;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
};
|
|
62
|
+
const escapeForPowerShell = (value) => `'${value.replaceAll("'", "''")}'`;
|
|
63
|
+
export const buildPowerShellCommand = (executablePath, args) => {
|
|
64
|
+
const serializedArgs = [escapeForPowerShell(executablePath), ...args.map(escapeForPowerShell)];
|
|
65
|
+
return `& ${serializedArgs.join(" ")}`;
|
|
66
|
+
};
|
|
67
|
+
export const resolveExecutablePath = (name, deps = {}) => {
|
|
68
|
+
const os = (deps.platform ?? getPlatform)();
|
|
69
|
+
const resolvedPath = resolveFromPathLookup(name, deps) ?? resolveFromNpmGlobalBin(name, deps);
|
|
70
|
+
if (resolvedPath) {
|
|
71
|
+
return resolvedPath;
|
|
72
|
+
}
|
|
73
|
+
const checkedLocations = os === "win32" ? "PATH and npm global bin" : "PATH";
|
|
74
|
+
throw new Error(`Cannot find '${name}' executable. Checked ${checkedLocations}. Ensure it is installed and available globally.`);
|
|
75
|
+
};
|
|
76
|
+
export const resolveExecutablePathWithPreference = (name, preferredNames, deps = {}) => {
|
|
77
|
+
for (const preferredName of preferredNames) {
|
|
78
|
+
const resolvedPath = resolveFromPathLookup(preferredName, deps) ?? resolveFromNpmGlobalBin(preferredName, deps);
|
|
79
|
+
if (resolvedPath) {
|
|
80
|
+
return resolvedPath;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return resolveExecutablePath(name, deps);
|
|
84
|
+
};
|
|
85
|
+
export const describeExecutableResolution = (name, deps = {}) => {
|
|
86
|
+
const os = (deps.platform ?? getPlatform)();
|
|
87
|
+
return {
|
|
88
|
+
requestedCommand: name,
|
|
89
|
+
resolvedExecutablePath: resolveExecutablePath(name, deps),
|
|
90
|
+
platform: os,
|
|
91
|
+
shell: false
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export const spawnExecutable = (name, args, options) => {
|
|
95
|
+
const os = (options.platform ?? getPlatform)();
|
|
96
|
+
const executablePath = resolveExecutablePath(name, options);
|
|
97
|
+
if (os === "win32") {
|
|
98
|
+
return spawn("powershell.exe", [
|
|
99
|
+
"-NoLogo",
|
|
100
|
+
"-NonInteractive",
|
|
101
|
+
"-ExecutionPolicy",
|
|
102
|
+
"Bypass",
|
|
103
|
+
"-Command",
|
|
104
|
+
buildPowerShellCommand(executablePath, args)
|
|
105
|
+
], {
|
|
106
|
+
...options,
|
|
107
|
+
shell: false,
|
|
108
|
+
windowsHide: options.windowsHide ?? true
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return spawn(executablePath, args, {
|
|
112
|
+
...options,
|
|
113
|
+
shell: false
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
export const runExecutableSync = (name, args, options = {}) => {
|
|
117
|
+
const os = (options.platform ?? getPlatform)();
|
|
118
|
+
const run = options.execFileSync ?? execFileSync;
|
|
119
|
+
const executablePath = resolveExecutablePath(name, options);
|
|
120
|
+
if (os === "win32") {
|
|
121
|
+
return String(run("powershell.exe", [
|
|
122
|
+
"-NoLogo",
|
|
123
|
+
"-NonInteractive",
|
|
124
|
+
"-ExecutionPolicy",
|
|
125
|
+
"Bypass",
|
|
126
|
+
"-Command",
|
|
127
|
+
buildPowerShellCommand(executablePath, args)
|
|
128
|
+
], {
|
|
129
|
+
cwd: options.cwd,
|
|
130
|
+
env: options.env,
|
|
131
|
+
encoding: "utf8",
|
|
132
|
+
windowsHide: true
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
return String(run(executablePath, args, {
|
|
136
|
+
cwd: options.cwd,
|
|
137
|
+
env: options.env,
|
|
138
|
+
encoding: "utf8"
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=executable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.js","sourceRoot":"","sources":["../src/executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAwC,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,0BAA0B,GAAG,CAAC,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
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { buildPowerShellCommand, resolveExecutablePath, resolveExecutablePathWithPreference } from "./executable.js";
|
|
4
|
+
test("resolveExecutablePath falls back to npm global bin on Windows", () => {
|
|
5
|
+
const resolved = resolveExecutablePath("opencode", {
|
|
6
|
+
env: {
|
|
7
|
+
PATHEXT: ".COM;.EXE;.BAT;.CMD"
|
|
8
|
+
},
|
|
9
|
+
platform: () => "win32",
|
|
10
|
+
execFileSync: ((command, args) => {
|
|
11
|
+
if (command === "where") {
|
|
12
|
+
throw new Error("not found");
|
|
13
|
+
}
|
|
14
|
+
if (command === "npm" && args[0] === "prefix") {
|
|
15
|
+
return "C:\\Users\\rlaru\\AppData\\Roaming\\npm\n";
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`unexpected command: ${command}`);
|
|
18
|
+
}),
|
|
19
|
+
existsSync: ((path) => /AppData[\\/]+Roaming[\\/]+npm[\\/]+opencode\.cmd$/u.test(path))
|
|
20
|
+
});
|
|
21
|
+
assert.match(resolved, /C:\\Users\\rlaru\\AppData\\Roaming\\npm[\\/]opencode\.cmd$/u);
|
|
22
|
+
});
|
|
23
|
+
test("resolveExecutablePath prefers PATH lookup results", () => {
|
|
24
|
+
const resolved = resolveExecutablePath("codex", {
|
|
25
|
+
platform: () => "linux",
|
|
26
|
+
execFileSync: ((command) => {
|
|
27
|
+
if (command === "which") {
|
|
28
|
+
return "/usr/local/bin/codex\n";
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`unexpected command: ${command}`);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
assert.equal(resolved, "/usr/local/bin/codex");
|
|
34
|
+
});
|
|
35
|
+
test("resolveExecutablePathWithPreference prefers opencode.cmd on Windows", () => {
|
|
36
|
+
const resolved = resolveExecutablePathWithPreference("opencode", ["opencode.cmd", "opencode"], {
|
|
37
|
+
platform: () => "win32",
|
|
38
|
+
execFileSync: ((command, args) => {
|
|
39
|
+
if (command === "where" && args[0] === "opencode.cmd") {
|
|
40
|
+
return "C:\\Users\\rlaru\\AppData\\Roaming\\npm\\opencode.cmd\n";
|
|
41
|
+
}
|
|
42
|
+
if (command === "where" && args[0] === "opencode") {
|
|
43
|
+
return "C:\\Users\\rlaru\\AppData\\Roaming\\npm\\opencode\n";
|
|
44
|
+
}
|
|
45
|
+
throw new Error(`unexpected command: ${command} ${args.join(" ")}`);
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
assert.equal(resolved, "C:\\Users\\rlaru\\AppData\\Roaming\\npm\\opencode.cmd");
|
|
49
|
+
});
|
|
50
|
+
test("buildPowerShellCommand preserves multiline arguments and escapes single quotes", () => {
|
|
51
|
+
const command = buildPowerShellCommand("C:\\Users\\rlaru\\AppData\\Roaming\\npm\\opencode.cmd", [
|
|
52
|
+
"run",
|
|
53
|
+
"line 1\nline '2'"
|
|
54
|
+
]);
|
|
55
|
+
assert.equal(command, "& 'C:\\Users\\rlaru\\AppData\\Roaming\\npm\\opencode.cmd' 'run' 'line 1\nline ''2'''");
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=executable.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.test.js","sourceRoot":"","sources":["../src/executable.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,mCAAmC,EACpC,MAAM,iBAAiB,CAAC;AAEzB,IAAI,CAAC,+DAA+D,EAAE,GAAG,EAAE;IACzE,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,EAAE;QACjD,GAAG,EAAE;YACH,OAAO,EAAE,qBAAqB;SAC/B;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO;QACvB,YAAY,EAAE,CAAC,CAAC,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AAE,EAAE;YACjD,IAAI,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE,CAAC;gBACtD,OAAO,yDAAyD,CAAC;YACnE,CAAC;YAED,IAAI,OAAO,KAAK,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;gBAClD,OAAO,qDAAqD,CAAC;YAC/D,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC,CAAqD;KACvD,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gFAAgF,EAAE,GAAG,EAAE;IAC1F,MAAM,OAAO,GAAG,sBAAsB,CAAC,uDAAuD,EAAE;QAC9F,KAAK;QACL,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CACV,OAAO,EACP,sFAAsF,CACvF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DaemonTrigger, RuntimeConfig } from "../types.js";
|
|
2
|
+
import { DaemonApiClient } from "../api-client.js";
|
|
3
|
+
import { createRunnerFactory } from "../runners/index.js";
|
|
4
|
+
import { TriggerLogReporter } from "../runners/log-reporter.js";
|
|
5
|
+
import { resolveRunnerHistoryPaths } from "../utils/runner-history.js";
|
|
6
|
+
type TriggerHandlerOptions = {
|
|
7
|
+
config: RuntimeConfig;
|
|
8
|
+
client: DaemonApiClient;
|
|
9
|
+
onAuthPathDiscovered?: (authPath: string) => void;
|
|
10
|
+
};
|
|
11
|
+
type ReporterLike = Pick<TriggerLogReporter, "start" | "append" | "stop">;
|
|
12
|
+
type ReadHistoryFile = (path: string, encoding: BufferEncoding) => Promise<string>;
|
|
13
|
+
type WriteHistoryFile = (path: string, content: string) => Promise<void>;
|
|
14
|
+
type TriggerHandlerDependencies = {
|
|
15
|
+
createRunnerFactory?: typeof createRunnerFactory;
|
|
16
|
+
createLogReporter?: (client: DaemonApiClient, triggerId: string) => ReporterLike;
|
|
17
|
+
readHistoryFile?: ReadHistoryFile;
|
|
18
|
+
writeHistoryFile?: WriteHistoryFile;
|
|
19
|
+
resolveRunnerHistoryPaths?: typeof resolveRunnerHistoryPaths;
|
|
20
|
+
setIntervalFn?: typeof global.setInterval;
|
|
21
|
+
clearIntervalFn?: typeof global.clearInterval;
|
|
22
|
+
cancelPollIntervalMs?: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const createTriggerHandler: (options: TriggerHandlerOptions, dependencies?: TriggerHandlerDependencies) => (trigger: DaemonTrigger) => Promise<void>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { createRunnerFactory } from "../runners/index.js";
|
|
2
|
+
import { TriggerLogReporter } from "../runners/log-reporter.js";
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
|
+
import { dirname } from "node:path";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { resolveRunnerHistoryPaths } from "../utils/runner-history.js";
|
|
8
|
+
import { isGitRepo, createWorktree } from "../utils/git-worktree.js";
|
|
9
|
+
import { extractResultTextFromStreamJson } from "../runners/claude-code.js";
|
|
10
|
+
import { runOriginIssueSafeguard } from "../utils/origin-issue-safeguard.js";
|
|
11
|
+
function sanitizeErrorMessage(msg) {
|
|
12
|
+
return msg.replaceAll(homedir(), '~');
|
|
13
|
+
}
|
|
14
|
+
export const createTriggerHandler = (options, dependencies = {}) => {
|
|
15
|
+
const { config, client, onAuthPathDiscovered } = options;
|
|
16
|
+
const createRunner = (dependencies.createRunnerFactory ?? createRunnerFactory)(config.runnerCmd);
|
|
17
|
+
const createLogReporter = dependencies.createLogReporter ?? ((apiClient, triggerId) => (new TriggerLogReporter(apiClient, triggerId)));
|
|
18
|
+
const readHistoryFile = dependencies.readHistoryFile ?? ((path, encoding) => readFile(path, encoding));
|
|
19
|
+
const writeHistoryFile = dependencies.writeHistoryFile ?? (async (path, content) => {
|
|
20
|
+
await mkdir(dirname(path), { recursive: true });
|
|
21
|
+
await writeFile(path, content, "utf8");
|
|
22
|
+
});
|
|
23
|
+
const resolveHistoryPaths = dependencies.resolveRunnerHistoryPaths ?? resolveRunnerHistoryPaths;
|
|
24
|
+
const maxHistoryLength = 200000;
|
|
25
|
+
const setIntervalFn = dependencies.setIntervalFn ?? global.setInterval;
|
|
26
|
+
const clearIntervalFn = dependencies.clearIntervalFn ?? global.clearInterval;
|
|
27
|
+
const cancelPollIntervalMs = dependencies.cancelPollIntervalMs ?? 2000;
|
|
28
|
+
const stripUtf8Bom = (content) => content.replace(/^\uFEFF/, "");
|
|
29
|
+
const reportHistoryToDatabase = async (triggerId, historyPath) => {
|
|
30
|
+
if (!historyPath) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const content = await readHistoryFile(historyPath, "utf8");
|
|
35
|
+
const markdown = stripUtf8Bom(content).trim();
|
|
36
|
+
if (markdown.length === 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
await client.updateTriggerHistory(triggerId, markdown.slice(0, maxHistoryLength));
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.warn("Failed to load or update runner history", {
|
|
44
|
+
triggerId,
|
|
45
|
+
historyPath,
|
|
46
|
+
error: error instanceof Error ? error.message : String(error)
|
|
47
|
+
});
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const buildFallbackHistory = (outputText, errorMessage) => {
|
|
52
|
+
const output = outputText.trim().slice(0, maxHistoryLength);
|
|
53
|
+
const summaryLine = errorMessage
|
|
54
|
+
? `- Runner terminated with error: ${errorMessage}`
|
|
55
|
+
: "- Runner completed successfully but did not write the requested history file.";
|
|
56
|
+
return [
|
|
57
|
+
"### Summary",
|
|
58
|
+
summaryLine,
|
|
59
|
+
"- Stored captured stdout as fallback history for this run.",
|
|
60
|
+
"",
|
|
61
|
+
"### Output",
|
|
62
|
+
output
|
|
63
|
+
].join("\n");
|
|
64
|
+
};
|
|
65
|
+
const restoreParentHistoryFromServer = async (parentHistoryPath, parentHistoryMarkdown) => {
|
|
66
|
+
const normalizedMarkdown = stripUtf8Bom(parentHistoryMarkdown ?? "").trim();
|
|
67
|
+
if (!parentHistoryPath || normalizedMarkdown.length === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
await writeHistoryFile(parentHistoryPath, normalizedMarkdown.slice(0, maxHistoryLength));
|
|
71
|
+
};
|
|
72
|
+
const toPromptString = (prompt) => {
|
|
73
|
+
if (typeof prompt === "string") {
|
|
74
|
+
return prompt;
|
|
75
|
+
}
|
|
76
|
+
return JSON.stringify(prompt);
|
|
77
|
+
};
|
|
78
|
+
const buildRunnerPrompt = (trigger, currentHistoryPath, parentHistoryPath, useWorktree, baseBranch) => {
|
|
79
|
+
const basePrompt = toPromptString(trigger.prompt);
|
|
80
|
+
const isContinuation = Boolean(trigger.parentTriggerId);
|
|
81
|
+
const conventionLines = [
|
|
82
|
+
"**[IMPORTANT — Convention Reference (MUST READ)]**",
|
|
83
|
+
"You MUST read `.agentteams/convention.md` before starting any work.",
|
|
84
|
+
"This file defines mandatory project rules, coding conventions, and workflow guidelines.",
|
|
85
|
+
"Skipping this step will result in non-compliant output.",
|
|
86
|
+
"",
|
|
87
|
+
];
|
|
88
|
+
if (useWorktree) {
|
|
89
|
+
conventionLines.push("**[Branch Rule]**", "Do not use the worktree branch name directly.", "The runner creates worktrees on branches like `worktree/{id}`.", "When you need to push or create a PR, always create a new branch with a descriptive name (e.g., `feat/add-login-api`, `fix/null-pointer-dashboard`).", "The `worktree/…` branch is a system-managed throwaway — pushing or opening a PR from it pollutes the branch list.", "", "**[Worktree Checkout Rule]**", "Do NOT checkout other branches in the worktree. Stay on the current branch at all times.", `To sync with the latest changes, use: git fetch origin && git merge origin/${baseBranch ?? "main"}`, "");
|
|
90
|
+
}
|
|
91
|
+
const conventionPrefix = conventionLines.join("\n");
|
|
92
|
+
const planModePrefix = trigger.planMode
|
|
93
|
+
? [
|
|
94
|
+
"**[PLAN MODE - NO CODE MODIFICATIONS]**",
|
|
95
|
+
"You are in Plan Mode. You MUST NOT modify, create, or delete any code files.",
|
|
96
|
+
"Do NOT implement any code changes.",
|
|
97
|
+
"Do NOT use `agentteams plan quick`. Quick plans are not allowed in Plan Mode.",
|
|
98
|
+
"",
|
|
99
|
+
].join("\n")
|
|
100
|
+
: "";
|
|
101
|
+
const historyLines = [
|
|
102
|
+
"",
|
|
103
|
+
"----",
|
|
104
|
+
isContinuation ? "Continuation context (required):" : "History context (required):",
|
|
105
|
+
...(isContinuation
|
|
106
|
+
? [
|
|
107
|
+
`- parentTriggerId: ${trigger.parentTriggerId}`,
|
|
108
|
+
`- Previous history path: ${parentHistoryPath ?? "(unavailable: authPath not configured)"}`,
|
|
109
|
+
"- Read the previous history file first and continue without repeating completed work.",
|
|
110
|
+
"- If the previous history has a Suggestions for User section, consider those suggestions in the context of the user's current prompt and proceed accordingly.",
|
|
111
|
+
]
|
|
112
|
+
: []),
|
|
113
|
+
`- History path: ${currentHistoryPath ?? "(unavailable: authPath not configured)"}`,
|
|
114
|
+
"- Save history as a Markdown file (.md) at the history path.",
|
|
115
|
+
"- Overwrite the markdown file with the latest full summary for this run.",
|
|
116
|
+
"- Format rules:",
|
|
117
|
+
" - Do not add a top-level title (e.g., # Runner History).",
|
|
118
|
+
" - Use ### (h3) headings to organize sections.",
|
|
119
|
+
" - Add whatever sections best describe the work (e.g., ### Changes, ### Verification, ### Next Steps).",
|
|
120
|
+
" - Required section: ### Summary — 3-5 bullet points of what was done. This is used for handoff to the next session. If any CLI command output includes a `webUrl` field during this run, include it as a clickable markdown link in the relevant summary bullet.",
|
|
121
|
+
" - Required section: ### Questions for User — include only blocking or decision-required questions (up to 3). Write 'None' if there are no questions.",
|
|
122
|
+
"----"
|
|
123
|
+
];
|
|
124
|
+
return `${conventionPrefix}${planModePrefix}${basePrompt}\n${historyLines.join("\n")}`;
|
|
125
|
+
};
|
|
126
|
+
return async (trigger) => {
|
|
127
|
+
let logReporter = null;
|
|
128
|
+
let currentHistoryPath = null;
|
|
129
|
+
let cancelInterval = null;
|
|
130
|
+
try {
|
|
131
|
+
if (trigger.parentTriggerId && /[\/\\]|\.\./.test(trigger.parentTriggerId)) {
|
|
132
|
+
throw new Error('Invalid parentTriggerId: path traversal characters detected');
|
|
133
|
+
}
|
|
134
|
+
logger.info("Trigger execution started", {
|
|
135
|
+
triggerId: trigger.id,
|
|
136
|
+
runnerType: trigger.runnerType
|
|
137
|
+
});
|
|
138
|
+
const runtime = await client.fetchTriggerRuntime(trigger.id);
|
|
139
|
+
logReporter = createLogReporter(client, trigger.id);
|
|
140
|
+
const activeLogReporter = logReporter;
|
|
141
|
+
activeLogReporter.start();
|
|
142
|
+
activeLogReporter.append("INFO", `Trigger started with runner ${trigger.runnerType}.`);
|
|
143
|
+
if (runtime.authPath && onAuthPathDiscovered) {
|
|
144
|
+
onAuthPathDiscovered(runtime.authPath);
|
|
145
|
+
}
|
|
146
|
+
logger.info("Trigger runtime fetched", {
|
|
147
|
+
triggerId: trigger.id,
|
|
148
|
+
agentConfigId: runtime.agentConfigId,
|
|
149
|
+
hasAuthPath: Boolean(runtime.authPath)
|
|
150
|
+
});
|
|
151
|
+
activeLogReporter.append("INFO", `Runtime fetched (agentConfigId=${runtime.agentConfigId}).`);
|
|
152
|
+
let effectiveAuthPath = runtime.authPath;
|
|
153
|
+
if (runtime.useWorktree && runtime.authPath) {
|
|
154
|
+
try {
|
|
155
|
+
if (isGitRepo(runtime.authPath)) {
|
|
156
|
+
const worktreePath = createWorktree(runtime.authPath, {
|
|
157
|
+
worktreeId: runtime.worktreeId ?? trigger.id,
|
|
158
|
+
baseBranch: runtime.baseBranch
|
|
159
|
+
});
|
|
160
|
+
effectiveAuthPath = worktreePath;
|
|
161
|
+
await client.reportWorktreeStatus(trigger.id, "ACTIVE");
|
|
162
|
+
activeLogReporter.append("INFO", `Worktree created at ${worktreePath}.`);
|
|
163
|
+
logger.info("Worktree created for trigger", {
|
|
164
|
+
triggerId: trigger.id,
|
|
165
|
+
worktreePath
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
logger.warn("Worktree requested but authPath is not a git repo, falling back to authPath", {
|
|
170
|
+
triggerId: trigger.id,
|
|
171
|
+
authPath: runtime.authPath
|
|
172
|
+
});
|
|
173
|
+
activeLogReporter.append("WARN", "Worktree requested but authPath is not a git repo. Falling back to authPath.");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
logger.warn("Failed to create worktree, falling back to authPath", {
|
|
178
|
+
triggerId: trigger.id,
|
|
179
|
+
error: err instanceof Error ? err.message : String(err)
|
|
180
|
+
});
|
|
181
|
+
activeLogReporter.append("WARN", `Worktree creation failed: ${err instanceof Error ? err.message : String(err)}. Falling back to authPath.`);
|
|
182
|
+
try {
|
|
183
|
+
await client.reportWorktreeStatus(trigger.id, "FAILED");
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Ignore status report failure
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const historyPaths = resolveHistoryPaths(effectiveAuthPath, trigger.id, trigger.parentTriggerId);
|
|
191
|
+
currentHistoryPath = historyPaths.currentHistoryPath;
|
|
192
|
+
await restoreParentHistoryFromServer(historyPaths.parentHistoryPath, runtime.parentHistoryMarkdown);
|
|
193
|
+
const runnerPrompt = buildRunnerPrompt(trigger, historyPaths.currentHistoryPath, historyPaths.parentHistoryPath, runtime.useWorktree, runtime.baseBranch);
|
|
194
|
+
const runner = createRunner(trigger.runnerType);
|
|
195
|
+
const cancelController = new AbortController();
|
|
196
|
+
let cancelRequested = false;
|
|
197
|
+
let cancelCheckInFlight = false;
|
|
198
|
+
const checkCancelRequested = async () => {
|
|
199
|
+
if (cancelRequested || cancelCheckInFlight) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
cancelCheckInFlight = true;
|
|
203
|
+
try {
|
|
204
|
+
const requested = await client.isTriggerCancelRequested(trigger.id);
|
|
205
|
+
if (requested) {
|
|
206
|
+
cancelRequested = true;
|
|
207
|
+
activeLogReporter.append("WARN", "Cancellation requested by user. Stopping runner.");
|
|
208
|
+
cancelController.abort();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
logger.warn("Failed to fetch trigger cancel status", {
|
|
213
|
+
triggerId: trigger.id,
|
|
214
|
+
error: error instanceof Error ? error.message : String(error)
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
cancelCheckInFlight = false;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
await checkCancelRequested();
|
|
222
|
+
cancelInterval = setIntervalFn(() => {
|
|
223
|
+
void checkCancelRequested();
|
|
224
|
+
}, cancelPollIntervalMs);
|
|
225
|
+
const runResult = await runner.run({
|
|
226
|
+
triggerId: trigger.id,
|
|
227
|
+
prompt: runnerPrompt,
|
|
228
|
+
authPath: effectiveAuthPath,
|
|
229
|
+
apiKey: runtime.apiKey,
|
|
230
|
+
apiUrl: config.apiUrl,
|
|
231
|
+
teamId: runtime.teamId,
|
|
232
|
+
projectId: runtime.projectId,
|
|
233
|
+
timeoutMs: config.timeoutMs,
|
|
234
|
+
idleTimeoutMs: config.idleTimeoutMs,
|
|
235
|
+
agentConfigId: runtime.agentConfigId,
|
|
236
|
+
model: trigger.model,
|
|
237
|
+
signal: cancelController.signal,
|
|
238
|
+
onStdoutChunk: (chunk) => {
|
|
239
|
+
activeLogReporter.append("INFO", chunk);
|
|
240
|
+
},
|
|
241
|
+
onStderrChunk: (chunk) => {
|
|
242
|
+
activeLogReporter.append("WARN", chunk);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
clearIntervalFn(cancelInterval);
|
|
246
|
+
cancelInterval = null;
|
|
247
|
+
logger.info("Trigger runner finished", {
|
|
248
|
+
triggerId: trigger.id,
|
|
249
|
+
exitCode: runResult.exitCode
|
|
250
|
+
});
|
|
251
|
+
logReporter.append("INFO", `Runner finished with exitCode=${runResult.exitCode}.`);
|
|
252
|
+
const historyReported = await reportHistoryToDatabase(trigger.id, currentHistoryPath);
|
|
253
|
+
if (!historyReported && runResult.outputText) {
|
|
254
|
+
const parsedOutput = extractResultTextFromStreamJson(runResult.outputText);
|
|
255
|
+
const fallbackHistory = buildFallbackHistory(parsedOutput, runResult.exitCode === 0 ? undefined : runResult.errorMessage);
|
|
256
|
+
if (currentHistoryPath) {
|
|
257
|
+
await writeHistoryFile(currentHistoryPath, fallbackHistory);
|
|
258
|
+
}
|
|
259
|
+
await client.updateTriggerHistory(trigger.id, fallbackHistory);
|
|
260
|
+
logReporter.append("WARN", "Runner did not write a history file. Captured stdout was stored as fallback history.");
|
|
261
|
+
}
|
|
262
|
+
await logReporter.stop();
|
|
263
|
+
// 3차 방어: origin issue 자동 연결 안전장치 (fire-and-forget)
|
|
264
|
+
void runOriginIssueSafeguard(trigger.prompt, currentHistoryPath, effectiveAuthPath).catch(() => {
|
|
265
|
+
// Safeguard failure should never block trigger completion
|
|
266
|
+
});
|
|
267
|
+
const status = runResult.cancelled
|
|
268
|
+
? "CANCELLED"
|
|
269
|
+
: runResult.exitCode === 0 ? "DONE" : "FAILED";
|
|
270
|
+
const errorMessage = status === "FAILED"
|
|
271
|
+
? (runResult.errorMessage || runResult.lastOutput || `Runner exited with code ${runResult.exitCode}`)
|
|
272
|
+
: status === "CANCELLED"
|
|
273
|
+
? (runResult.errorMessage || "Runner cancelled by user")
|
|
274
|
+
: undefined;
|
|
275
|
+
await client.updateTriggerStatus(trigger.id, status, errorMessage ? sanitizeErrorMessage(errorMessage) : undefined);
|
|
276
|
+
logger.info("Trigger completed", {
|
|
277
|
+
triggerId: trigger.id,
|
|
278
|
+
status
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
if (cancelInterval) {
|
|
283
|
+
clearIntervalFn(cancelInterval);
|
|
284
|
+
cancelInterval = null;
|
|
285
|
+
}
|
|
286
|
+
logger.error("Trigger handling failed", {
|
|
287
|
+
triggerId: trigger.id,
|
|
288
|
+
error: error instanceof Error ? error.message : String(error)
|
|
289
|
+
});
|
|
290
|
+
try {
|
|
291
|
+
logReporter?.append("ERROR", error instanceof Error ? error.message : String(error));
|
|
292
|
+
await reportHistoryToDatabase(trigger.id, currentHistoryPath);
|
|
293
|
+
if (logReporter) {
|
|
294
|
+
await logReporter.stop();
|
|
295
|
+
}
|
|
296
|
+
const rawErrorMsg = error instanceof Error ? error.message : String(error);
|
|
297
|
+
await client.updateTriggerStatus(trigger.id, "FAILED", sanitizeErrorMessage(rawErrorMsg));
|
|
298
|
+
}
|
|
299
|
+
catch (statusError) {
|
|
300
|
+
logger.error("Failed to report trigger as FAILED", {
|
|
301
|
+
triggerId: trigger.id,
|
|
302
|
+
error: statusError instanceof Error ? statusError.message : String(statusError)
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
//# sourceMappingURL=trigger-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-handler.js","sourceRoot":"","sources":["../../src/handlers/trigger-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC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