@agentteams/runner 0.0.84-dev.206 → 0.0.84-dev.208
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 +2 -2
- package/dist/api-client.js +66 -66
- package/dist/api-client.js.map +1 -1
- package/dist/api-client.test.js +63 -54
- package/dist/api-client.test.js.map +1 -1
- package/dist/autostart.js +81 -81
- package/dist/autostart.js.map +1 -1
- package/dist/autostart.test.js +35 -35
- package/dist/autostart.test.js.map +1 -1
- package/dist/commands/cleanup.js +4 -4
- package/dist/commands/init.js +14 -14
- package/dist/commands/restart.js +3 -3
- package/dist/commands/start.js +10 -10
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.js +7 -7
- package/dist/commands/stop.js +7 -7
- package/dist/commands/uninstall.js +6 -6
- package/dist/commands/update.d.ts +4 -4
- package/dist/commands/update.js +20 -22
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/update.test.js +38 -42
- package/dist/commands/update.test.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +12 -12
- package/dist/config.test.js +61 -61
- package/dist/config.test.js.map +1 -1
- package/dist/daemon-control.d.ts +5 -5
- package/dist/daemon-control.js +21 -22
- package/dist/daemon-control.js.map +1 -1
- package/dist/daemon-control.test.js +29 -29
- package/dist/executable.d.ts +3 -3
- package/dist/executable.js +46 -49
- package/dist/executable.js.map +1 -1
- package/dist/executable.test.js +62 -62
- package/dist/executable.test.js.map +1 -1
- package/dist/handlers/trigger-handler.d.ts +6 -6
- package/dist/handlers/trigger-handler.js +118 -124
- package/dist/handlers/trigger-handler.js.map +1 -1
- package/dist/handlers/trigger-handler.test.js +373 -365
- package/dist/handlers/trigger-handler.test.js.map +1 -1
- package/dist/index.js +25 -25
- package/dist/logger.js +1 -1
- package/dist/pid.js +6 -6
- package/dist/poller.d.ts +7 -7
- package/dist/poller.js +54 -53
- package/dist/poller.js.map +1 -1
- package/dist/poller.test.js +209 -181
- package/dist/poller.test.js.map +1 -1
- package/dist/runners/amp.d.ts +1 -1
- package/dist/runners/amp.js +74 -81
- package/dist/runners/amp.js.map +1 -1
- package/dist/runners/antigravity.d.ts +3 -3
- package/dist/runners/antigravity.js +116 -127
- package/dist/runners/antigravity.js.map +1 -1
- package/dist/runners/antigravity.replay.test.js +25 -25
- package/dist/runners/antigravity.replay.test.js.map +1 -1
- package/dist/runners/antigravity.test.js +98 -98
- package/dist/runners/antigravity.test.js.map +1 -1
- package/dist/runners/claude-code.d.ts +1 -1
- package/dist/runners/claude-code.js +85 -84
- package/dist/runners/claude-code.js.map +1 -1
- package/dist/runners/claude-code.test.js +37 -40
- package/dist/runners/claude-code.test.js.map +1 -1
- package/dist/runners/codex.d.ts +1 -1
- package/dist/runners/codex.js +87 -96
- package/dist/runners/codex.js.map +1 -1
- package/dist/runners/codex.test.js +68 -68
- package/dist/runners/codex.test.js.map +1 -1
- package/dist/runners/index.d.ts +1 -1
- package/dist/runners/index.js +10 -10
- package/dist/runners/index.test.js +16 -16
- package/dist/runners/log-reporter.d.ts +2 -2
- package/dist/runners/log-reporter.js +10 -10
- package/dist/runners/log-reporter.test.js +70 -70
- package/dist/runners/log-reporter.test.js.map +1 -1
- package/dist/runners/opencode.d.ts +1 -1
- package/dist/runners/opencode.js +68 -75
- package/dist/runners/opencode.js.map +1 -1
- package/dist/runners/process-control.d.ts +1 -1
- package/dist/runners/process-control.js +13 -11
- package/dist/runners/process-control.js.map +1 -1
- package/dist/runners/stream-json-parser.d.ts +1 -1
- package/dist/runners/stream-json-parser.js +70 -67
- package/dist/runners/stream-json-parser.js.map +1 -1
- package/dist/runners/stream-json-parser.replay.test.js +17 -17
- package/dist/runners/stream-json-parser.replay.test.js.map +1 -1
- package/dist/runners/stream-json-parser.test.js +76 -78
- package/dist/runners/stream-json-parser.test.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/utils/auth-path-store.js +7 -7
- package/dist/utils/auth-path-store.test.js +24 -29
- package/dist/utils/auth-path-store.test.js.map +1 -1
- package/dist/utils/auto-update.d.ts +4 -4
- package/dist/utils/auto-update.js +30 -28
- package/dist/utils/auto-update.js.map +1 -1
- package/dist/utils/auto-update.test.js +30 -30
- package/dist/utils/convention-evaluator.d.ts +1 -1
- package/dist/utils/convention-evaluator.js +22 -21
- package/dist/utils/convention-evaluator.js.map +1 -1
- package/dist/utils/convention-evaluator.test.js +120 -110
- package/dist/utils/convention-evaluator.test.js.map +1 -1
- package/dist/utils/convention-sync.d.ts +3 -3
- package/dist/utils/convention-sync.js +10 -10
- package/dist/utils/convention-sync.test.js +39 -25
- package/dist/utils/convention-sync.test.js.map +1 -1
- package/dist/utils/git-worktree.js +20 -18
- package/dist/utils/git-worktree.js.map +1 -1
- package/dist/utils/git-worktree.test.js +98 -98
- package/dist/utils/git-worktree.test.js.map +1 -1
- package/dist/utils/origin-issue-safeguard.js +35 -30
- package/dist/utils/origin-issue-safeguard.js.map +1 -1
- package/dist/utils/power-save-blocker.d.ts +4 -4
- package/dist/utils/power-save-blocker.js +33 -33
- package/dist/utils/power-save-blocker.test.js +37 -37
- package/dist/utils/power-save-blocker.test.js.map +1 -1
- package/dist/utils/runner-cleanup.d.ts +3 -3
- package/dist/utils/runner-cleanup.js +13 -13
- package/dist/utils/runner-cleanup.test.js +35 -35
- package/dist/utils/runner-history.js +3 -3
- package/dist/utils/runner-history.test.js +17 -17
- package/package.json +4 -1
- package/readme.md +10 -10
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { mkdir, mkdtemp, rm, utimes, writeFile } from
|
|
3
|
-
import { tmpdir } from
|
|
4
|
-
import { join } from
|
|
5
|
-
import test, { mock } from
|
|
6
|
-
import { logger } from
|
|
7
|
-
import { runCleanup } from
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { mkdir, mkdtemp, rm, utimes, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import test, { mock } from 'node:test';
|
|
6
|
+
import { logger } from '../logger.js';
|
|
7
|
+
import { runCleanup } from './runner-cleanup.js';
|
|
8
8
|
const makeAuthDir = async () => {
|
|
9
|
-
return await mkdtemp(join(tmpdir(),
|
|
9
|
+
return await mkdtemp(join(tmpdir(), 'runner-cleanup-test-'));
|
|
10
10
|
};
|
|
11
11
|
const touchAge = async (filePath, ageMs) => {
|
|
12
12
|
const target = new Date(Date.now() - ageMs);
|
|
@@ -15,7 +15,7 @@ const touchAge = async (filePath, ageMs) => {
|
|
|
15
15
|
test.afterEach(() => {
|
|
16
16
|
mock.restoreAll();
|
|
17
17
|
});
|
|
18
|
-
test(
|
|
18
|
+
test('runCleanup ignores missing log and history directories', async () => {
|
|
19
19
|
const authPath = await makeAuthDir();
|
|
20
20
|
try {
|
|
21
21
|
await runCleanup(authPath);
|
|
@@ -24,29 +24,29 @@ test("runCleanup ignores missing log and history directories", async () => {
|
|
|
24
24
|
await rm(authPath, { recursive: true, force: true });
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
test(
|
|
27
|
+
test('runCleanup deletes only files older than each directory TTL', async () => {
|
|
28
28
|
const authPath = await makeAuthDir();
|
|
29
|
-
const logDir = join(authPath,
|
|
30
|
-
const historyDir = join(authPath,
|
|
29
|
+
const logDir = join(authPath, '.agentteams', 'runner', 'log');
|
|
30
|
+
const historyDir = join(authPath, '.agentteams', 'runner', 'history');
|
|
31
31
|
try {
|
|
32
32
|
await mkdir(logDir, { recursive: true });
|
|
33
33
|
await mkdir(historyDir, { recursive: true });
|
|
34
|
-
const oldLog = join(logDir,
|
|
35
|
-
const freshLog = join(logDir,
|
|
36
|
-
const oldHistory = join(historyDir,
|
|
37
|
-
const freshHistory = join(historyDir,
|
|
38
|
-
await writeFile(oldLog,
|
|
39
|
-
await writeFile(freshLog,
|
|
40
|
-
await writeFile(oldHistory,
|
|
41
|
-
await writeFile(freshHistory,
|
|
34
|
+
const oldLog = join(logDir, 'old.log');
|
|
35
|
+
const freshLog = join(logDir, 'fresh.log');
|
|
36
|
+
const oldHistory = join(historyDir, 'old.md');
|
|
37
|
+
const freshHistory = join(historyDir, 'fresh.md');
|
|
38
|
+
await writeFile(oldLog, 'old');
|
|
39
|
+
await writeFile(freshLog, 'fresh');
|
|
40
|
+
await writeFile(oldHistory, 'old');
|
|
41
|
+
await writeFile(freshHistory, 'fresh');
|
|
42
42
|
await touchAge(oldLog, 2 * 24 * 60 * 60 * 1000);
|
|
43
43
|
await touchAge(freshLog, 3 * 60 * 60 * 1000);
|
|
44
44
|
await touchAge(oldHistory, 4 * 24 * 60 * 60 * 1000);
|
|
45
45
|
await touchAge(freshHistory, 2 * 24 * 60 * 60 * 1000);
|
|
46
46
|
await runCleanup(authPath);
|
|
47
|
-
await assert.rejects(() => import(
|
|
48
|
-
await assert.rejects(() => import(
|
|
49
|
-
await import(
|
|
47
|
+
await assert.rejects(() => import('node:fs/promises').then(({ stat }) => stat(oldLog)));
|
|
48
|
+
await assert.rejects(() => import('node:fs/promises').then(({ stat }) => stat(oldHistory)));
|
|
49
|
+
await import('node:fs/promises').then(async ({ stat }) => {
|
|
50
50
|
await stat(freshLog);
|
|
51
51
|
await stat(freshHistory);
|
|
52
52
|
});
|
|
@@ -55,33 +55,33 @@ test("runCleanup deletes only files older than each directory TTL", async () =>
|
|
|
55
55
|
await rm(authPath, { recursive: true, force: true });
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
test(
|
|
58
|
+
test('runCleanup logs a warning and continues when an expired file cannot be deleted', async () => {
|
|
59
59
|
const authPath = await makeAuthDir();
|
|
60
|
-
const logDir = join(authPath,
|
|
61
|
-
const historyDir = join(authPath,
|
|
60
|
+
const logDir = join(authPath, '.agentteams', 'runner', 'log');
|
|
61
|
+
const historyDir = join(authPath, '.agentteams', 'runner', 'history');
|
|
62
62
|
const warnings = [];
|
|
63
|
-
mock.method(logger,
|
|
63
|
+
mock.method(logger, 'warn', (message, meta) => {
|
|
64
64
|
warnings.push({ message, meta });
|
|
65
65
|
});
|
|
66
66
|
try {
|
|
67
67
|
await mkdir(logDir, { recursive: true });
|
|
68
68
|
await mkdir(historyDir, { recursive: true });
|
|
69
|
-
const lockedFile = join(logDir,
|
|
70
|
-
const historyFile = join(historyDir,
|
|
71
|
-
await writeFile(lockedFile,
|
|
72
|
-
await writeFile(historyFile,
|
|
69
|
+
const lockedFile = join(logDir, 'locked.log');
|
|
70
|
+
const historyFile = join(historyDir, 'history.md');
|
|
71
|
+
await writeFile(lockedFile, 'locked');
|
|
72
|
+
await writeFile(historyFile, 'history');
|
|
73
73
|
await touchAge(lockedFile, 2 * 24 * 60 * 60 * 1000);
|
|
74
74
|
await touchAge(historyFile, 4 * 24 * 60 * 60 * 1000);
|
|
75
75
|
await runCleanup(authPath, {
|
|
76
76
|
unlink: async (filePath) => {
|
|
77
77
|
if (filePath === lockedFile) {
|
|
78
|
-
throw new Error(
|
|
78
|
+
throw new Error('file is locked');
|
|
79
79
|
}
|
|
80
|
-
await import(
|
|
81
|
-
}
|
|
80
|
+
await import('node:fs/promises').then(async ({ unlink }) => unlink(filePath));
|
|
81
|
+
},
|
|
82
82
|
});
|
|
83
83
|
assert.equal(warnings.length >= 1, true);
|
|
84
|
-
await import(
|
|
84
|
+
await import('node:fs/promises').then(async ({ stat }) => {
|
|
85
85
|
await stat(lockedFile);
|
|
86
86
|
await assert.rejects(() => stat(historyFile));
|
|
87
87
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { join } from
|
|
2
|
-
const historyDirectory = (authPath) => join(authPath,
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
const historyDirectory = (authPath) => join(authPath, '.agentteams', 'runner', 'history');
|
|
3
3
|
const historyFilePath = (authPath, triggerId) => join(historyDirectory(authPath), `${triggerId}.md`);
|
|
4
4
|
export const resolveRunnerHistoryPaths = (authPath, triggerId, parentTriggerId) => {
|
|
5
5
|
if (!authPath) {
|
|
@@ -7,7 +7,7 @@ export const resolveRunnerHistoryPaths = (authPath, triggerId, parentTriggerId)
|
|
|
7
7
|
}
|
|
8
8
|
return {
|
|
9
9
|
currentHistoryPath: historyFilePath(authPath, triggerId),
|
|
10
|
-
parentHistoryPath: parentTriggerId ? historyFilePath(authPath, parentTriggerId) : null
|
|
10
|
+
parentHistoryPath: parentTriggerId ? historyFilePath(authPath, parentTriggerId) : null,
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=runner-history.js.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { join } from
|
|
3
|
-
import test from
|
|
4
|
-
import { resolveRunnerHistoryPaths } from
|
|
5
|
-
test(
|
|
6
|
-
assert.deepEqual(resolveRunnerHistoryPaths(null,
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import test from 'node:test';
|
|
4
|
+
import { resolveRunnerHistoryPaths } from './runner-history.js';
|
|
5
|
+
test('resolveRunnerHistoryPaths returns null paths when authPath is missing', () => {
|
|
6
|
+
assert.deepEqual(resolveRunnerHistoryPaths(null, 'trigger-1', 'parent-1'), {
|
|
7
7
|
currentHistoryPath: null,
|
|
8
|
-
parentHistoryPath: null
|
|
8
|
+
parentHistoryPath: null,
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
|
-
test(
|
|
12
|
-
const authPath = join(
|
|
13
|
-
assert.deepEqual(resolveRunnerHistoryPaths(authPath,
|
|
14
|
-
currentHistoryPath: join(authPath,
|
|
15
|
-
parentHistoryPath: join(authPath,
|
|
11
|
+
test('resolveRunnerHistoryPaths returns current and parent history paths', () => {
|
|
12
|
+
const authPath = join('workspace', 'auth');
|
|
13
|
+
assert.deepEqual(resolveRunnerHistoryPaths(authPath, 'trigger-1', 'parent-1'), {
|
|
14
|
+
currentHistoryPath: join(authPath, '.agentteams', 'runner', 'history', 'trigger-1.md'),
|
|
15
|
+
parentHistoryPath: join(authPath, '.agentteams', 'runner', 'history', 'parent-1.md'),
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
|
-
test(
|
|
19
|
-
const authPath = join(
|
|
20
|
-
assert.deepEqual(resolveRunnerHistoryPaths(authPath,
|
|
21
|
-
currentHistoryPath: join(authPath,
|
|
22
|
-
parentHistoryPath: null
|
|
18
|
+
test('resolveRunnerHistoryPaths omits parent path when parent trigger is absent', () => {
|
|
19
|
+
const authPath = join('workspace', 'auth');
|
|
20
|
+
assert.deepEqual(resolveRunnerHistoryPaths(authPath, 'trigger-1', null), {
|
|
21
|
+
currentHistoryPath: join(authPath, '.agentteams', 'runner', 'history', 'trigger-1.md'),
|
|
22
|
+
parentHistoryPath: null,
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=runner-history.test.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentteams/runner",
|
|
3
|
-
"version": "0.0.84-dev.
|
|
3
|
+
"version": "0.0.84-dev.208",
|
|
4
4
|
"description": "AgentRunner - Background runner that polls and executes AI agent tasks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"dev": "tsx watch src/index.ts",
|
|
18
18
|
"test": "tsx --test \"src/**/*.test.ts\"",
|
|
19
19
|
"lint": "eslint 'src/**/*.ts'",
|
|
20
|
+
"format": "prettier --write .",
|
|
21
|
+
"format:check": "prettier --check .",
|
|
20
22
|
"start": "node dist/index.js",
|
|
21
23
|
"init": "node dist/index.js init",
|
|
22
24
|
"prepublishOnly": "npm run build"
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"@eslint/js": "^9.39.4",
|
|
48
50
|
"@types/node": "^25.9.1",
|
|
49
51
|
"eslint": "^9.39.4",
|
|
52
|
+
"prettier": "^3.8.4",
|
|
50
53
|
"tsx": "^4.22.3",
|
|
51
54
|
"typescript": "^6.0.3",
|
|
52
55
|
"typescript-eslint": "^8.61.0"
|
package/readme.md
CHANGED
|
@@ -138,16 +138,16 @@ Settings are resolved in the following priority order at runtime.
|
|
|
138
138
|
|
|
139
139
|
### Environment Variables
|
|
140
140
|
|
|
141
|
-
| Variable
|
|
142
|
-
|
|
143
|
-
| `POLLING_INTERVAL_MS`
|
|
144
|
-
| `IDLE_TIMEOUT_MS`
|
|
145
|
-
| `TIMEOUT_MS`
|
|
146
|
-
| `RUNNER_CMD`
|
|
147
|
-
| `CODEX_SANDBOX_LEVEL`
|
|
148
|
-
| `LOG_LEVEL`
|
|
149
|
-
| `DAEMON_VERBOSE_RUNNER_LOGS` | `true`
|
|
150
|
-
| `DAEMON_PROMPT_LOG_MODE`
|
|
141
|
+
| Variable | Default | Description |
|
|
142
|
+
| ---------------------------- | ----------------- | ------------------------------------------------------------------------------------------------ |
|
|
143
|
+
| `POLLING_INTERVAL_MS` | `30000` (30s) | Polling interval for pending triggers |
|
|
144
|
+
| `IDLE_TIMEOUT_MS` | `600000` (10min) | Primary timeout. Stops a runner when it produces no stdout/stderr for the configured idle window |
|
|
145
|
+
| `TIMEOUT_MS` | `86400000` (24h) | Fail-safe timeout. Stops a runner only if it stays alive for the full wall-clock limit |
|
|
146
|
+
| `RUNNER_CMD` | `opencode` | Command used to execute agent tasks |
|
|
147
|
+
| `CODEX_SANDBOX_LEVEL` | `workspace-write` | Codex runner sandbox level. Allowed values: `workspace-write`, `off` |
|
|
148
|
+
| `LOG_LEVEL` | `info` | Log level: `debug`, `info`, `warn`, `error` |
|
|
149
|
+
| `DAEMON_VERBOSE_RUNNER_LOGS` | `true` | When `false`, reduces runner stdout/stderr to start/stop/error only |
|
|
150
|
+
| `DAEMON_PROMPT_LOG_MODE` | `preview` | Prompt logging: `off`, `length`, `preview`, `full` |
|
|
151
151
|
|
|
152
152
|
AgentRunner defaults to an idle-timeout-first policy. In normal operation, `IDLE_TIMEOUT_MS` is the control that ends stalled runs, while `TIMEOUT_MS` remains a 24-hour fail-safe for runaway processes.
|
|
153
153
|
|