@agentteams/runner 0.0.84-dev.204 → 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.
Files changed (123) hide show
  1. package/dist/api-client.d.ts +2 -2
  2. package/dist/api-client.js +66 -66
  3. package/dist/api-client.js.map +1 -1
  4. package/dist/api-client.test.js +63 -54
  5. package/dist/api-client.test.js.map +1 -1
  6. package/dist/autostart.js +81 -81
  7. package/dist/autostart.js.map +1 -1
  8. package/dist/autostart.test.js +35 -35
  9. package/dist/autostart.test.js.map +1 -1
  10. package/dist/commands/cleanup.js +4 -4
  11. package/dist/commands/init.js +14 -14
  12. package/dist/commands/restart.js +3 -3
  13. package/dist/commands/start.js +10 -10
  14. package/dist/commands/start.js.map +1 -1
  15. package/dist/commands/status.js +7 -7
  16. package/dist/commands/stop.js +7 -7
  17. package/dist/commands/uninstall.js +6 -6
  18. package/dist/commands/update.d.ts +4 -4
  19. package/dist/commands/update.js +20 -22
  20. package/dist/commands/update.js.map +1 -1
  21. package/dist/commands/update.test.js +38 -42
  22. package/dist/commands/update.test.js.map +1 -1
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.js +12 -12
  25. package/dist/config.test.js +61 -61
  26. package/dist/config.test.js.map +1 -1
  27. package/dist/daemon-control.d.ts +5 -5
  28. package/dist/daemon-control.js +21 -22
  29. package/dist/daemon-control.js.map +1 -1
  30. package/dist/daemon-control.test.js +29 -29
  31. package/dist/executable.d.ts +3 -3
  32. package/dist/executable.js +46 -49
  33. package/dist/executable.js.map +1 -1
  34. package/dist/executable.test.js +62 -62
  35. package/dist/executable.test.js.map +1 -1
  36. package/dist/handlers/trigger-handler.d.ts +6 -6
  37. package/dist/handlers/trigger-handler.js +118 -124
  38. package/dist/handlers/trigger-handler.js.map +1 -1
  39. package/dist/handlers/trigger-handler.test.js +373 -365
  40. package/dist/handlers/trigger-handler.test.js.map +1 -1
  41. package/dist/index.js +25 -25
  42. package/dist/logger.js +1 -1
  43. package/dist/pid.js +6 -6
  44. package/dist/poller.d.ts +7 -7
  45. package/dist/poller.js +54 -53
  46. package/dist/poller.js.map +1 -1
  47. package/dist/poller.test.js +209 -181
  48. package/dist/poller.test.js.map +1 -1
  49. package/dist/runners/amp.d.ts +1 -1
  50. package/dist/runners/amp.js +74 -81
  51. package/dist/runners/amp.js.map +1 -1
  52. package/dist/runners/antigravity.d.ts +3 -3
  53. package/dist/runners/antigravity.js +116 -127
  54. package/dist/runners/antigravity.js.map +1 -1
  55. package/dist/runners/antigravity.replay.test.js +25 -25
  56. package/dist/runners/antigravity.replay.test.js.map +1 -1
  57. package/dist/runners/antigravity.test.js +98 -98
  58. package/dist/runners/antigravity.test.js.map +1 -1
  59. package/dist/runners/claude-code.d.ts +1 -1
  60. package/dist/runners/claude-code.js +85 -84
  61. package/dist/runners/claude-code.js.map +1 -1
  62. package/dist/runners/claude-code.test.js +37 -40
  63. package/dist/runners/claude-code.test.js.map +1 -1
  64. package/dist/runners/codex.d.ts +1 -1
  65. package/dist/runners/codex.js +87 -96
  66. package/dist/runners/codex.js.map +1 -1
  67. package/dist/runners/codex.test.js +68 -68
  68. package/dist/runners/codex.test.js.map +1 -1
  69. package/dist/runners/index.d.ts +1 -1
  70. package/dist/runners/index.js +10 -10
  71. package/dist/runners/index.test.js +16 -16
  72. package/dist/runners/log-reporter.d.ts +2 -2
  73. package/dist/runners/log-reporter.js +12 -10
  74. package/dist/runners/log-reporter.js.map +1 -1
  75. package/dist/runners/log-reporter.test.js +70 -70
  76. package/dist/runners/log-reporter.test.js.map +1 -1
  77. package/dist/runners/opencode.d.ts +1 -1
  78. package/dist/runners/opencode.js +68 -75
  79. package/dist/runners/opencode.js.map +1 -1
  80. package/dist/runners/process-control.d.ts +1 -1
  81. package/dist/runners/process-control.js +13 -11
  82. package/dist/runners/process-control.js.map +1 -1
  83. package/dist/runners/stream-json-parser.d.ts +1 -1
  84. package/dist/runners/stream-json-parser.js +70 -67
  85. package/dist/runners/stream-json-parser.js.map +1 -1
  86. package/dist/runners/stream-json-parser.replay.test.js +17 -17
  87. package/dist/runners/stream-json-parser.replay.test.js.map +1 -1
  88. package/dist/runners/stream-json-parser.test.js +76 -78
  89. package/dist/runners/stream-json-parser.test.js.map +1 -1
  90. package/dist/types.d.ts +4 -4
  91. package/dist/utils/auth-path-store.js +7 -7
  92. package/dist/utils/auth-path-store.test.js +24 -29
  93. package/dist/utils/auth-path-store.test.js.map +1 -1
  94. package/dist/utils/auto-update.d.ts +4 -4
  95. package/dist/utils/auto-update.js +30 -28
  96. package/dist/utils/auto-update.js.map +1 -1
  97. package/dist/utils/auto-update.test.js +30 -30
  98. package/dist/utils/convention-evaluator.d.ts +1 -1
  99. package/dist/utils/convention-evaluator.js +22 -21
  100. package/dist/utils/convention-evaluator.js.map +1 -1
  101. package/dist/utils/convention-evaluator.test.js +120 -110
  102. package/dist/utils/convention-evaluator.test.js.map +1 -1
  103. package/dist/utils/convention-sync.d.ts +3 -3
  104. package/dist/utils/convention-sync.js +10 -10
  105. package/dist/utils/convention-sync.test.js +43 -25
  106. package/dist/utils/convention-sync.test.js.map +1 -1
  107. package/dist/utils/git-worktree.js +20 -18
  108. package/dist/utils/git-worktree.js.map +1 -1
  109. package/dist/utils/git-worktree.test.js +98 -98
  110. package/dist/utils/git-worktree.test.js.map +1 -1
  111. package/dist/utils/origin-issue-safeguard.js +35 -30
  112. package/dist/utils/origin-issue-safeguard.js.map +1 -1
  113. package/dist/utils/power-save-blocker.d.ts +4 -4
  114. package/dist/utils/power-save-blocker.js +33 -33
  115. package/dist/utils/power-save-blocker.test.js +37 -37
  116. package/dist/utils/power-save-blocker.test.js.map +1 -1
  117. package/dist/utils/runner-cleanup.d.ts +3 -3
  118. package/dist/utils/runner-cleanup.js +13 -13
  119. package/dist/utils/runner-cleanup.test.js +35 -35
  120. package/dist/utils/runner-history.js +3 -3
  121. package/dist/utils/runner-history.test.js +17 -17
  122. package/package.json +9 -2
  123. package/readme.md +10 -10
@@ -1,12 +1,12 @@
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";
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(), "runner-cleanup-test-"));
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("runCleanup ignores missing log and history directories", async () => {
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("runCleanup deletes only files older than each directory TTL", async () => {
27
+ test('runCleanup deletes only files older than each directory TTL', async () => {
28
28
  const authPath = await makeAuthDir();
29
- const logDir = join(authPath, ".agentteams", "runner", "log");
30
- const historyDir = join(authPath, ".agentteams", "runner", "history");
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, "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");
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("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 }) => {
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("runCleanup logs a warning and continues when an expired file cannot be deleted", async () => {
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, ".agentteams", "runner", "log");
61
- const historyDir = join(authPath, ".agentteams", "runner", "history");
60
+ const logDir = join(authPath, '.agentteams', 'runner', 'log');
61
+ const historyDir = join(authPath, '.agentteams', 'runner', 'history');
62
62
  const warnings = [];
63
- mock.method(logger, "warn", (message, meta) => {
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, "locked.log");
70
- const historyFile = join(historyDir, "history.md");
71
- await writeFile(lockedFile, "locked");
72
- await writeFile(historyFile, "history");
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("file is locked");
78
+ throw new Error('file is locked');
79
79
  }
80
- await import("node:fs/promises").then(async ({ unlink }) => unlink(filePath));
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("node:fs/promises").then(async ({ stat }) => {
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 "node:path";
2
- const historyDirectory = (authPath) => join(authPath, ".agentteams", "runner", "history");
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 "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"), {
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("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")
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("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
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.204",
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",
@@ -16,6 +16,9 @@
16
16
  "typecheck": "tsc --noEmit",
17
17
  "dev": "tsx watch src/index.ts",
18
18
  "test": "tsx --test \"src/**/*.test.ts\"",
19
+ "lint": "eslint 'src/**/*.ts'",
20
+ "format": "prettier --write .",
21
+ "format:check": "prettier --check .",
19
22
  "start": "node dist/index.js",
20
23
  "init": "node dist/index.js init",
21
24
  "prepublishOnly": "npm run build"
@@ -43,8 +46,12 @@
43
46
  "license": "Apache-2.0",
44
47
  "dependencies": {},
45
48
  "devDependencies": {
49
+ "@eslint/js": "^9.39.4",
46
50
  "@types/node": "^25.9.1",
51
+ "eslint": "^9.39.4",
52
+ "prettier": "^3.8.4",
47
53
  "tsx": "^4.22.3",
48
- "typescript": "^6.0.3"
54
+ "typescript": "^6.0.3",
55
+ "typescript-eslint": "^8.61.0"
49
56
  }
50
57
  }
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 | 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` |
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