@phnx-labs/agents-cli 1.23.10 → 1.23.12
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 +22 -0
- package/dist/commands/permissions.js +36 -6
- package/dist/lib/agent-spec/agents.js +15 -9
- package/dist/lib/daemon/supervisor.d.ts +2 -0
- package/dist/lib/daemon/supervisor.js +74 -40
- package/dist/lib/installations/active-check.d.ts +1 -0
- package/dist/lib/installations/active-check.js +37 -4
- package/dist/lib/installations/versions.js +1 -2
- package/dist/lib/permissions-registry.d.ts +4 -0
- package/dist/lib/permissions-registry.js +70 -18
- package/dist/lib/permissions.d.ts +25 -5
- package/dist/lib/permissions.js +239 -53
- package/dist/lib/recordings/ledger.d.ts +3 -2
- package/dist/lib/recordings/ledger.js +16 -2
- package/dist/lib/recordings/model.d.ts +6 -0
- package/dist/lib/recordings/pipeline.d.ts +11 -3
- package/dist/lib/recordings/pipeline.js +27 -5
- package/dist/lib/recordings/process.d.ts +1 -0
- package/dist/lib/recordings/process.js +2 -0
- package/dist/lib/recordings/service.js +3 -1
- package/dist/lib/recordings/transcode.d.ts +6 -0
- package/dist/lib/recordings/transcode.js +41 -3
- package/dist/lib/staleness/detectors/permissions.js +16 -8
- package/dist/lib/staleness/writers/permissions.js +6 -1
- package/dist/lib/types.d.ts +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.12
|
|
4
|
+
|
|
5
|
+
- **`agents add` works in containers without `ps` (PHNX-4227).** Before replacing an install, the CLI checks whether any process runs from it. On Linux it listed processes with `ps`, which `node:*-slim` images (every Rush pod) lack, and a failed scan counts as "in use", so `agents add` refused with "account home main is in use" on an idle install. On Linux it now reads `/proc/<pid>/cmdline`; macOS keeps `ps`, Windows keeps its CIM query, and an unreadable process table still refuses. Source: `cli/src/lib/installations/active-check.ts`.
|
|
6
|
+
|
|
7
|
+
- **A permission preset that names a missing group fails, and `ask:` rules sync into harnesses that can prompt on a rule (PHNX-4227).** `buildPermissionsFromGroups` used to skip a group whose file was not there, and preset sync dropped missing includes before that function ran, so a dangling name such as `16-mcp` disappeared. A named group with no `permissions/groups/<name>.yaml` now throws, and the error names the active preset and the group. `00-local` stays the one optional per-machine group and is skipped when its file is absent. An `ask:` section is kept beside allow and deny. It is written to the native prompt list where one exists: Claude `permissions.ask`, OpenCode `permission.bash` value `ask`, Codex `agents-ask.rules` (`decision = "prompt"`), Grok `action = "ask"`, Kimi `decision = "ask"`, Droid `permissionRules` decision `ask` (not `commandDenylist`), and Antigravity `permissions.ask`. Cursor, Copilot, OpenClaw, and Hermes have no per-rule ask list. Allow and deny still sync, and the ask rules are skipped with the reason recorded on `PERMISSION_TARGETS`. Source: `cli/src/lib/permissions.ts`, `cli/src/lib/permissions-registry.ts`, `cli/src/lib/installations/versions.ts`.
|
|
8
|
+
|
|
9
|
+
## 1.23.11
|
|
10
|
+
|
|
11
|
+
- **The daemon no longer restarts when a service tick runs slow (PHNX-4225).** A
|
|
12
|
+
tick past its deadline is now aborted, logged as `tick.breach`, and skipped until
|
|
13
|
+
it settles; the daemon exits for a supervised restart only when a tick is still
|
|
14
|
+
unsettled at 10 times its deadline. On a loaded laptop the old exit-on-overrun
|
|
15
|
+
policy restarted the daemon about 200 times a day. Source:
|
|
16
|
+
`cli/src/lib/daemon/supervisor.ts`.
|
|
17
|
+
- **Recordings encode one video at a time and stop encodes a dead daemon left
|
|
18
|
+
running (PHNX-4225).** Each daemon exit used to leave its `ffmpeg` running and
|
|
19
|
+
the next start re-encoded every queued recording at once, so encodes of the same
|
|
20
|
+
file piled up. The ledger now records each encode's process and work directory,
|
|
21
|
+
a restarted daemon stops a leftover encode and deletes its directory before
|
|
22
|
+
requeueing, and only one recording is processed at a time. Source:
|
|
23
|
+
`cli/src/lib/recordings/pipeline.ts`.
|
|
24
|
+
|
|
3
25
|
## 1.23.10
|
|
4
26
|
|
|
5
27
|
- **A desktop tab showing a session that runs on another machine is listed once, as that session.** An ssh tab opened by `agents sessions resume` (AGI EXT opens remote sessions this way) used to appear in `agents feed watch` and `agents ps` as a second session on the desktop with status `unknown` and nothing to read, beside the real one on the worker. The resume hop now records the owner machine for its tab, and the stream projection folds a tab with no transcript of its own into the device that reports the session's transcript, so the tab shows up in that session's `observerTerminals`. Tabs opened before this release fold in the same way. Source: `cli/src/commands/resume.ts`, `cli/src/lib/session/active.ts`, `cli/src/lib/session/projection.ts`.
|
|
@@ -65,6 +65,13 @@ When to use:
|
|
|
65
65
|
console.log(` ${chalk.yellow(p)}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
const claudeAsk = claudePerms.permissions.ask ?? [];
|
|
69
|
+
if (claudeAsk.length > 0) {
|
|
70
|
+
console.log(chalk.yellow(' Ask:'));
|
|
71
|
+
for (const p of claudeAsk) {
|
|
72
|
+
console.log(` ${chalk.yellow(p)}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
68
75
|
}
|
|
69
76
|
else if (agentId === 'opencode') {
|
|
70
77
|
const ocPerms = perms;
|
|
@@ -107,6 +114,11 @@ When to use:
|
|
|
107
114
|
for (const p of set.deny)
|
|
108
115
|
console.log(` ${chalk.yellow(p)}`);
|
|
109
116
|
}
|
|
117
|
+
if (set.ask?.length) {
|
|
118
|
+
console.log(chalk.yellow(' Ask:'));
|
|
119
|
+
for (const p of set.ask)
|
|
120
|
+
console.log(` ${chalk.yellow(p)}`);
|
|
121
|
+
}
|
|
110
122
|
}
|
|
111
123
|
console.log();
|
|
112
124
|
};
|
|
@@ -196,7 +208,7 @@ When to use:
|
|
|
196
208
|
? ` - ${chalk.gray(truncateToWidth(perm.set.description, budget))}`
|
|
197
209
|
: '';
|
|
198
210
|
console.log(`${prefix}${desc}`);
|
|
199
|
-
console.log(` ${chalk.gray(`${perm.set.allow.length} allow, ${perm.set.deny?.length || 0} deny rules`)}`);
|
|
211
|
+
console.log(` ${chalk.gray(`${perm.set.allow.length} allow, ${perm.set.deny?.length || 0} deny${perm.set.ask?.length ? `, ${perm.set.ask.length} ask` : ''} rules`)}`);
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
});
|
|
@@ -261,7 +273,7 @@ Examples:
|
|
|
261
273
|
value: installed.name,
|
|
262
274
|
name: installed.set.description
|
|
263
275
|
? `${installed.name} ${chalk.gray(installed.set.description.slice(0, 40))}`
|
|
264
|
-
: `${installed.name} ${chalk.gray(`${installed.set.allow.length} allow, ${installed.set.deny?.length || 0} deny`)}`,
|
|
276
|
+
: `${installed.name} ${chalk.gray(`${installed.set.allow.length} allow, ${installed.set.deny?.length || 0} deny${installed.set.ask?.length ? `, ${installed.set.ask.length} ask` : ''}`)}`,
|
|
265
277
|
}));
|
|
266
278
|
const selected = await checkbox({
|
|
267
279
|
message: 'Select permission sets to apply',
|
|
@@ -322,6 +334,8 @@ Examples:
|
|
|
322
334
|
const applyResult = applyPermissionsToVersion(agentId, installed.set, versionHome, !options.replace);
|
|
323
335
|
if (applyResult.success) {
|
|
324
336
|
console.log(chalk.green(` Applied ${setName} to ${agentLabel(agentId)}@${version}`));
|
|
337
|
+
for (const line of applyResult.skipped ?? [])
|
|
338
|
+
console.log(chalk.yellow(` ${line}`));
|
|
325
339
|
recordVersionResources(agentId, version, 'permissions', [setName]);
|
|
326
340
|
applied++;
|
|
327
341
|
}
|
|
@@ -357,14 +371,14 @@ Examples:
|
|
|
357
371
|
const isAgentConfig = detectPermissionAgentFromPath(localPath) !== null;
|
|
358
372
|
if (isAgentConfig) {
|
|
359
373
|
const incoming = exportPermissionsFromPath(localPath);
|
|
360
|
-
if (!incoming || (incoming.allow.length === 0 && (!incoming.deny || incoming.deny.length === 0))) {
|
|
374
|
+
if (!incoming || (incoming.allow.length === 0 && (!incoming.deny || incoming.deny.length === 0) && (!incoming.ask || incoming.ask.length === 0))) {
|
|
361
375
|
console.log(chalk.yellow(`\nNo permissions found in ${localPath}`));
|
|
362
376
|
return;
|
|
363
377
|
}
|
|
364
378
|
const existing = getDefaultPermissionSet();
|
|
365
379
|
const diff = computePermissionsDiff(existing, incoming);
|
|
366
|
-
const totalNew = diff.allow.added.length + diff.deny.added.length;
|
|
367
|
-
const totalExisting = diff.allow.existing.length + diff.deny.existing.length;
|
|
380
|
+
const totalNew = diff.allow.added.length + diff.deny.added.length + diff.ask.added.length;
|
|
381
|
+
const totalExisting = diff.allow.existing.length + diff.deny.existing.length + diff.ask.existing.length;
|
|
368
382
|
if (totalNew === 0) {
|
|
369
383
|
console.log(chalk.gray('\nAll permissions already exist in central storage.'));
|
|
370
384
|
return;
|
|
@@ -385,6 +399,12 @@ Examples:
|
|
|
385
399
|
console.log(chalk.red(` + ${rule}`));
|
|
386
400
|
}
|
|
387
401
|
}
|
|
402
|
+
if (diff.ask.added.length > 0) {
|
|
403
|
+
console.log(chalk.yellow('\n New ask rules:'));
|
|
404
|
+
for (const rule of diff.ask.added) {
|
|
405
|
+
console.log(chalk.yellow(` + ${rule}`));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
388
408
|
if (totalExisting > 0) {
|
|
389
409
|
console.log(chalk.gray(`\n (${totalExisting} rules already exist, will be skipped)`));
|
|
390
410
|
}
|
|
@@ -457,6 +477,8 @@ Examples:
|
|
|
457
477
|
const applyResult = applyPermissionsToVersion(agentId, merged, versionHome, !options.replace);
|
|
458
478
|
if (applyResult.success) {
|
|
459
479
|
console.log(chalk.green(` Applied to ${agentLabel(agentId)}@${version}`));
|
|
480
|
+
for (const line of applyResult.skipped ?? [])
|
|
481
|
+
console.log(chalk.yellow(` ${line}`));
|
|
460
482
|
recordVersionResources(agentId, version, 'permissions', [merged.name || 'default']);
|
|
461
483
|
applied++;
|
|
462
484
|
}
|
|
@@ -492,7 +514,7 @@ Examples:
|
|
|
492
514
|
for (const perm of permissions) {
|
|
493
515
|
const desc = perm.set.description ? ` - ${perm.set.description}` : '';
|
|
494
516
|
console.log(` ${chalk.cyan(perm.name)}${desc}`);
|
|
495
|
-
console.log(` ${chalk.gray(`${perm.set.allow.length} allow, ${perm.set.deny?.length || 0} deny rules`)}`);
|
|
517
|
+
console.log(` ${chalk.gray(`${perm.set.allow.length} allow, ${perm.set.deny?.length || 0} deny${perm.set.ask?.length ? `, ${perm.set.ask.length} ask` : ''} rules`)}`);
|
|
496
518
|
}
|
|
497
519
|
const broadGrants = permissions
|
|
498
520
|
.map((perm) => ({ name: perm.name, grants: containsBroadGrants(perm.set) }))
|
|
@@ -585,6 +607,8 @@ Examples:
|
|
|
585
607
|
const applyResult = applyPermissionsToVersion(agentId, perm.set, versionHome, !options.replace);
|
|
586
608
|
if (applyResult.success) {
|
|
587
609
|
console.log(chalk.green(` Applied ${perm.name} to ${agentLabel(agentId)}@${version}`));
|
|
610
|
+
for (const line of applyResult.skipped ?? [])
|
|
611
|
+
console.log(chalk.yellow(` ${line}`));
|
|
588
612
|
recordVersionResources(agentId, version, 'permissions', [perm.name]);
|
|
589
613
|
applied++;
|
|
590
614
|
}
|
|
@@ -733,6 +757,12 @@ Examples:
|
|
|
733
757
|
lines.push(` ${chalk.yellow(rule)}`);
|
|
734
758
|
}
|
|
735
759
|
}
|
|
760
|
+
if (perm.set.ask && perm.set.ask.length > 0) {
|
|
761
|
+
lines.push(chalk.yellow('\n Ask rules:'));
|
|
762
|
+
for (const rule of perm.set.ask) {
|
|
763
|
+
lines.push(` ${chalk.yellow(rule)}`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
736
766
|
lines.push('');
|
|
737
767
|
const output = lines.join('\n');
|
|
738
768
|
printWithPager(output, lines.length);
|
|
@@ -231,7 +231,7 @@ export const AGENTS = {
|
|
|
231
231
|
// Harness-owned skill directories survive orphan cleanup.
|
|
232
232
|
ownedSkillDirs: ['synced'],
|
|
233
233
|
cloudProvider: 'rush',
|
|
234
|
-
capabilities: { hooks: true, mcp: true, mcpHttp: true, mcpHeaders: true, allowlist: true, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'CLAUDE.md' }, workflows: true, memory: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true, interactiveRepl: true },
|
|
234
|
+
capabilities: { hooks: true, mcp: true, mcpHttp: true, mcpHeaders: true, allowlist: true, ask: true, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'CLAUDE.md' }, workflows: true, memory: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true, interactiveRepl: true },
|
|
235
235
|
},
|
|
236
236
|
codex: {
|
|
237
237
|
id: 'codex',
|
|
@@ -258,7 +258,7 @@ export const AGENTS = {
|
|
|
258
258
|
variableSyntax: '$ARGUMENTS',
|
|
259
259
|
supportsHooks: true,
|
|
260
260
|
cloudProvider: 'codex',
|
|
261
|
-
capabilities: { hooks: { since: '0.116.0' }, mcp: true, mcpHttp: true, mcpHeaders: false, allowlist: { since: '0.138.0' }, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, subagents: { since: '0.117.0' }, rules: { file: 'AGENTS.md' }, workflows: false, memory: true, modes: ['plan', 'edit', 'auto', 'skip'], interactiveRepl: true },
|
|
261
|
+
capabilities: { hooks: { since: '0.116.0' }, mcp: true, mcpHttp: true, mcpHeaders: false, allowlist: { since: '0.138.0' }, ask: { since: '0.138.0' }, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, subagents: { since: '0.117.0' }, rules: { file: 'AGENTS.md' }, workflows: false, memory: true, modes: ['plan', 'edit', 'auto', 'skip'], interactiveRepl: true },
|
|
262
262
|
},
|
|
263
263
|
cursor: {
|
|
264
264
|
id: 'cursor',
|
|
@@ -286,7 +286,7 @@ export const AGENTS = {
|
|
|
286
286
|
format: 'markdown',
|
|
287
287
|
variableSyntax: '$ARGUMENTS',
|
|
288
288
|
supportsHooks: true,
|
|
289
|
-
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, skills: true, commands: true, plugins: true, subagents: { since: '2026.1.22' }, rules: { file: '.cursorrules' }, workflows: false, memory: false, modes: ['plan', 'edit', 'skip'], interactiveRepl: true },
|
|
289
|
+
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, ask: false, skills: true, commands: true, plugins: true, subagents: { since: '2026.1.22' }, rules: { file: '.cursorrules' }, workflows: false, memory: false, modes: ['plan', 'edit', 'skip'], interactiveRepl: true },
|
|
290
290
|
},
|
|
291
291
|
opencode: {
|
|
292
292
|
id: 'opencode',
|
|
@@ -311,7 +311,7 @@ export const AGENTS = {
|
|
|
311
311
|
format: 'markdown',
|
|
312
312
|
variableSyntax: '$ARGUMENTS',
|
|
313
313
|
supportsHooks: true,
|
|
314
|
-
capabilities: { hooks: { since: '0.3.130' }, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: { since: '1.1.1' }, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit'], interactiveRepl: true },
|
|
314
|
+
capabilities: { hooks: { since: '0.3.130' }, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: { since: '1.1.1' }, ask: { since: '1.1.1' }, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit'], interactiveRepl: true },
|
|
315
315
|
},
|
|
316
316
|
openclaw: {
|
|
317
317
|
id: 'openclaw',
|
|
@@ -337,7 +337,7 @@ export const AGENTS = {
|
|
|
337
337
|
format: 'markdown',
|
|
338
338
|
variableSyntax: '{{ARGUMENTS}}',
|
|
339
339
|
supportsHooks: false,
|
|
340
|
-
capabilities: { hooks: false, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, skills: true, commands: false, plugins: true, subagents: true, rules: { file: 'workspace/AGENTS.md' }, workflows: true, memory: true, modes: ['plan', 'edit', 'skip'], interactiveRepl: true },
|
|
340
|
+
capabilities: { hooks: false, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, ask: false, skills: true, commands: false, plugins: true, subagents: true, rules: { file: 'workspace/AGENTS.md' }, workflows: true, memory: true, modes: ['plan', 'edit', 'skip'], interactiveRepl: true },
|
|
341
341
|
},
|
|
342
342
|
copilot: {
|
|
343
343
|
id: 'copilot',
|
|
@@ -363,7 +363,7 @@ export const AGENTS = {
|
|
|
363
363
|
format: 'markdown',
|
|
364
364
|
variableSyntax: '$ARGUMENTS',
|
|
365
365
|
supportsHooks: true,
|
|
366
|
-
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, skills: true, commands: true, plugins: true, subagents: { since: '0.0.353' }, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit', 'auto', 'skip'], interactiveRepl: false },
|
|
366
|
+
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, ask: false, skills: true, commands: true, plugins: true, subagents: { since: '0.0.353' }, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit', 'auto', 'skip'], interactiveRepl: false },
|
|
367
367
|
},
|
|
368
368
|
amp: {
|
|
369
369
|
id: 'amp',
|
|
@@ -388,7 +388,7 @@ export const AGENTS = {
|
|
|
388
388
|
format: 'markdown',
|
|
389
389
|
variableSyntax: '$ARGUMENTS',
|
|
390
390
|
supportsHooks: false,
|
|
391
|
-
capabilities: { hooks: false, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit'], interactiveRepl: false },
|
|
391
|
+
capabilities: { hooks: false, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: false, ask: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, memory: false, modes: ['plan', 'edit'], interactiveRepl: false },
|
|
392
392
|
},
|
|
393
393
|
goose: {
|
|
394
394
|
id: 'goose',
|
|
@@ -415,7 +415,7 @@ export const AGENTS = {
|
|
|
415
415
|
format: 'markdown',
|
|
416
416
|
variableSyntax: '$ARGUMENTS',
|
|
417
417
|
supportsHooks: true,
|
|
418
|
-
capabilities: { hooks: { since: '1.34.0' }, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: false, skills: { since: '1.25.0' }, commands: true, plugins: true, subagents: true, rules: { file: 'AGENTS.md' }, workflows: true, memory: false, modes: ['edit'], interactiveRepl: true },
|
|
418
|
+
capabilities: { hooks: { since: '1.34.0' }, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: false, ask: false, skills: { since: '1.25.0' }, commands: true, plugins: true, subagents: true, rules: { file: 'AGENTS.md' }, workflows: true, memory: false, modes: ['edit'], interactiveRepl: true },
|
|
419
419
|
},
|
|
420
420
|
antigravity: {
|
|
421
421
|
id: 'antigravity',
|
|
@@ -443,7 +443,7 @@ export const AGENTS = {
|
|
|
443
443
|
variableSyntax: '{{args}}',
|
|
444
444
|
supportsHooks: true,
|
|
445
445
|
cloudProvider: 'antigravity',
|
|
446
|
-
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, skills: true, commands: true, plugins: true, subagents: { since: '1.0.16' }, rules: { file: 'AGENTS.md' }, workflows: { since: '1.0.6' }, memory: false, modes: ['edit', 'skip'], rulesImports: false, interactiveRepl: true },
|
|
446
|
+
capabilities: { hooks: true, mcp: true, mcpHttp: false, mcpHeaders: false, allowlist: true, ask: true, skills: true, commands: true, plugins: true, subagents: { since: '1.0.16' }, rules: { file: 'AGENTS.md' }, workflows: { since: '1.0.6' }, memory: false, modes: ['edit', 'skip'], rulesImports: false, interactiveRepl: true },
|
|
447
447
|
},
|
|
448
448
|
grok: {
|
|
449
449
|
id: 'grok',
|
|
@@ -475,6 +475,7 @@ export const AGENTS = {
|
|
|
475
475
|
mcpHttp: false,
|
|
476
476
|
mcpHeaders: false,
|
|
477
477
|
allowlist: true,
|
|
478
|
+
ask: true,
|
|
478
479
|
skills: true,
|
|
479
480
|
commands: true,
|
|
480
481
|
plugins: true,
|
|
@@ -519,6 +520,7 @@ export const AGENTS = {
|
|
|
519
520
|
mcpHttp: false,
|
|
520
521
|
mcpHeaders: false,
|
|
521
522
|
allowlist: true,
|
|
523
|
+
ask: true,
|
|
522
524
|
skills: true,
|
|
523
525
|
commands: false,
|
|
524
526
|
plugins: true,
|
|
@@ -565,6 +567,7 @@ export const AGENTS = {
|
|
|
565
567
|
mcpHttp: false,
|
|
566
568
|
mcpHeaders: false,
|
|
567
569
|
allowlist: { since: '0.57.5' },
|
|
570
|
+
ask: { since: '0.57.5' },
|
|
568
571
|
skills: { since: '0.26.0' },
|
|
569
572
|
commands: true,
|
|
570
573
|
plugins: true,
|
|
@@ -607,6 +610,7 @@ export const AGENTS = {
|
|
|
607
610
|
mcpHttp: true,
|
|
608
611
|
mcpHeaders: false,
|
|
609
612
|
allowlist: true,
|
|
613
|
+
ask: false,
|
|
610
614
|
skills: true,
|
|
611
615
|
commands: false,
|
|
612
616
|
plugins: true,
|
|
@@ -651,6 +655,7 @@ export const AGENTS = {
|
|
|
651
655
|
mcpHttp: true,
|
|
652
656
|
mcpHeaders: true,
|
|
653
657
|
allowlist: false,
|
|
658
|
+
ask: false,
|
|
654
659
|
skills: true,
|
|
655
660
|
commands: false,
|
|
656
661
|
plugins: true,
|
|
@@ -693,6 +698,7 @@ export const AGENTS = {
|
|
|
693
698
|
mcpHttp: true,
|
|
694
699
|
mcpHeaders: true,
|
|
695
700
|
allowlist: false,
|
|
701
|
+
ask: false,
|
|
696
702
|
skills: true,
|
|
697
703
|
commands: false,
|
|
698
704
|
plugins: false,
|
|
@@ -3,6 +3,7 @@ import { isPeriodicService } from './service.js';
|
|
|
3
3
|
import { syncSpansBetween } from './diagnostics.js';
|
|
4
4
|
import { performance } from 'perf_hooks';
|
|
5
5
|
const DEADLINE_EXIT_CODE = 70;
|
|
6
|
+
const HANG_DEADLINES = 10;
|
|
6
7
|
const DEFAULT_LIFECYCLE_DEADLINE_MS = 30_000;
|
|
7
8
|
export class ServiceSupervisor {
|
|
8
9
|
registry = new Map();
|
|
@@ -47,6 +48,7 @@ export class ServiceSupervisor {
|
|
|
47
48
|
inFlight: false,
|
|
48
49
|
everStarted: false,
|
|
49
50
|
idleWaiters: [],
|
|
51
|
+
skippedTicks: 0,
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
// Resolve idle waiters in the same step that clears inFlight, so reload cannot race the active tick.
|
|
@@ -115,7 +117,7 @@ export class ServiceSupervisor {
|
|
|
115
117
|
runNow(id) {
|
|
116
118
|
if (!this.registry.has(id))
|
|
117
119
|
throw new Error(`service '${id}' is not registered`);
|
|
118
|
-
void this.runTick(id);
|
|
120
|
+
void this.runTick(id, false);
|
|
119
121
|
}
|
|
120
122
|
health() {
|
|
121
123
|
const out = {};
|
|
@@ -179,10 +181,7 @@ export class ServiceSupervisor {
|
|
|
179
181
|
clearTimeout(entry.startupTimer);
|
|
180
182
|
entry.startupTimer = undefined;
|
|
181
183
|
}
|
|
182
|
-
|
|
183
|
-
clearTimeout(entry.deadlineTimer);
|
|
184
|
-
entry.deadlineTimer = undefined;
|
|
185
|
-
}
|
|
184
|
+
this.clearTickTimers(entry);
|
|
186
185
|
entry.state = 'stopped';
|
|
187
186
|
recordSubsystemState(id, 'stopped');
|
|
188
187
|
entry.activeController?.abort();
|
|
@@ -208,66 +207,101 @@ export class ServiceSupervisor {
|
|
|
208
207
|
return;
|
|
209
208
|
entry.timer = setInterval(() => { void this.runTick(id); }, entry.service.intervalMs);
|
|
210
209
|
}
|
|
211
|
-
//
|
|
212
|
-
async runTick(id) {
|
|
210
|
+
// Throws retry; an overrun is aborted and skipped until it settles; only a hang (HANG_DEADLINES) exits 70.
|
|
211
|
+
async runTick(id, scheduled = true) {
|
|
213
212
|
const entry = this.registry.get(id);
|
|
214
213
|
const ctx = this.ctx;
|
|
215
|
-
if (!entry || !ctx || entry.state !== 'running'
|
|
214
|
+
if (!entry || !ctx || entry.state !== 'running')
|
|
216
215
|
return;
|
|
217
216
|
if (!isPeriodicService(entry.service))
|
|
218
217
|
return;
|
|
218
|
+
if (entry.inFlight) {
|
|
219
|
+
if (scheduled)
|
|
220
|
+
entry.skippedTicks += 1;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
219
223
|
const periodicService = entry.service;
|
|
224
|
+
const deadlineMs = periodicService.deadlineMs;
|
|
220
225
|
entry.inFlight = true;
|
|
226
|
+
entry.skippedTicks = 0;
|
|
221
227
|
const startedAt = performance.now();
|
|
222
228
|
entry.tickStartedAt = startedAt;
|
|
223
229
|
const controller = new AbortController();
|
|
224
230
|
entry.activeController = controller;
|
|
225
|
-
let
|
|
231
|
+
let overran = false;
|
|
226
232
|
ctx.log('DEBUG', `service '${id}' tick start`, { event: 'tick.start', service: id });
|
|
227
|
-
|
|
228
|
-
|
|
233
|
+
entry.deadlineTimer = setTimeout(() => {
|
|
234
|
+
entry.deadlineTimer = undefined;
|
|
235
|
+
overran = true;
|
|
236
|
+
this.recordOverrun(entry, id, deadlineMs, startedAt);
|
|
237
|
+
controller.abort();
|
|
238
|
+
entry.hangTimer = setTimeout(() => {
|
|
239
|
+
entry.hangTimer = undefined;
|
|
240
|
+
this.exitForRestart(id, new Error(`tick did not settle within ${deadlineMs * HANG_DEADLINES}ms (${HANG_DEADLINES}x its ${deadlineMs}ms deadline)`), startedAt);
|
|
241
|
+
}, deadlineMs * (HANG_DEADLINES - 1));
|
|
242
|
+
}, deadlineMs);
|
|
229
243
|
try {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
reject(new Error(`tick exceeded deadline of ${periodicService.deadlineMs}ms`));
|
|
234
|
-
}, periodicService.deadlineMs);
|
|
235
|
-
});
|
|
236
|
-
await Promise.race([tickPromise, deadline]);
|
|
244
|
+
const tickPromise = periodicService.tick(ctx, controller.signal);
|
|
245
|
+
entry.activeTick = tickPromise;
|
|
246
|
+
await tickPromise;
|
|
237
247
|
const durMs = Math.round(performance.now() - startedAt);
|
|
238
|
-
const tickFields = { service: id, durMs, deadlineMs
|
|
239
|
-
if (
|
|
240
|
-
ctx.log('WARN', `service '${id}' tick
|
|
248
|
+
const tickFields = { service: id, durMs, deadlineMs };
|
|
249
|
+
if (overran) {
|
|
250
|
+
ctx.log('WARN', `service '${id}' overrun tick settled after ${durMs}ms; ${entry.skippedTicks} tick(s) skipped`, { event: 'tick.settled', ...tickFields, skippedTicks: entry.skippedTicks });
|
|
251
|
+
}
|
|
252
|
+
else if (durMs * 2 > deadlineMs) {
|
|
253
|
+
ctx.log('WARN', `service '${id}' tick took ${durMs}ms, over half its ${deadlineMs}ms deadline`, { event: 'tick.slow', ...tickFields, inFlight: this.inFlightTicks() });
|
|
241
254
|
}
|
|
242
255
|
else {
|
|
243
256
|
ctx.log('DEBUG', `service '${id}' tick ok in ${durMs}ms`, { event: 'tick.ok', ...tickFields });
|
|
244
257
|
}
|
|
245
|
-
entry.consecutiveFailures = 0;
|
|
246
|
-
entry.lastError = undefined;
|
|
247
258
|
entry.lastRunMs = Date.now();
|
|
248
|
-
|
|
259
|
+
if (!overran) {
|
|
260
|
+
entry.consecutiveFailures = 0;
|
|
261
|
+
entry.lastError = undefined;
|
|
262
|
+
recordSubsystemOk(id);
|
|
263
|
+
}
|
|
249
264
|
}
|
|
250
265
|
catch (err) {
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
const durMs = Math.round(performance.now() - startedAt);
|
|
267
|
+
if (overran) {
|
|
268
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
269
|
+
ctx.log('WARN', `service '${id}' overrun tick settled after ${durMs}ms by throwing: ${message}; ${entry.skippedTicks} tick(s) skipped`, {
|
|
270
|
+
event: 'tick.settled', service: id, durMs, deadlineMs, skippedTicks: entry.skippedTicks, error: message,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this.recordFailure(entry, id, err, durMs);
|
|
256
275
|
}
|
|
257
|
-
if (!timedOut)
|
|
258
|
-
this.recordFailure(entry, id, err, Math.round(performance.now() - startedAt));
|
|
259
276
|
}
|
|
260
277
|
finally {
|
|
261
|
-
|
|
262
|
-
clearTimeout(entry.deadlineTimer);
|
|
263
|
-
entry.deadlineTimer = undefined;
|
|
264
|
-
}
|
|
278
|
+
this.clearTickTimers(entry);
|
|
265
279
|
entry.activeTick = undefined;
|
|
266
280
|
entry.activeController = undefined;
|
|
267
281
|
entry.tickStartedAt = undefined;
|
|
268
282
|
this.clearInFlight(entry);
|
|
269
283
|
}
|
|
270
284
|
}
|
|
285
|
+
recordOverrun(entry, id, deadlineMs, startedAt) {
|
|
286
|
+
const cause = `tick exceeded deadline of ${deadlineMs}ms`;
|
|
287
|
+
entry.consecutiveFailures += 1;
|
|
288
|
+
entry.lastError = cause;
|
|
289
|
+
recordSubsystemError(id, cause);
|
|
290
|
+
this.ctx?.log('ERROR', `service '${id}' breached its deadline (${cause}); aborted it and skipping ticks until it settles`, {
|
|
291
|
+
...this.breachSnapshot(id, startedAt),
|
|
292
|
+
consecutiveFailures: entry.consecutiveFailures,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
clearTickTimers(entry) {
|
|
296
|
+
if (entry.deadlineTimer) {
|
|
297
|
+
clearTimeout(entry.deadlineTimer);
|
|
298
|
+
entry.deadlineTimer = undefined;
|
|
299
|
+
}
|
|
300
|
+
if (entry.hangTimer) {
|
|
301
|
+
clearTimeout(entry.hangTimer);
|
|
302
|
+
entry.hangTimer = undefined;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
271
305
|
recordFailure(entry, id, err, durMs) {
|
|
272
306
|
const message = err instanceof Error ? err.message : String(err);
|
|
273
307
|
entry.consecutiveFailures += 1;
|
|
@@ -301,7 +335,10 @@ export class ServiceSupervisor {
|
|
|
301
335
|
}
|
|
302
336
|
recordSubsystemError(id, cause);
|
|
303
337
|
recordDaemonRestart(id, cause);
|
|
304
|
-
this.ctx?.log('ERROR', `service '${id}'
|
|
338
|
+
this.ctx?.log('ERROR', `service '${id}' hung (${cause}); exiting (code ${DEADLINE_EXIT_CODE}) for a supervised restart`, {
|
|
339
|
+
...this.breachSnapshot(id, startedAt),
|
|
340
|
+
event: 'tick.hang',
|
|
341
|
+
});
|
|
305
342
|
this.freezeTimers();
|
|
306
343
|
this.exit(DEADLINE_EXIT_CODE);
|
|
307
344
|
}
|
|
@@ -315,10 +352,7 @@ export class ServiceSupervisor {
|
|
|
315
352
|
clearTimeout(entry.startupTimer);
|
|
316
353
|
entry.startupTimer = undefined;
|
|
317
354
|
}
|
|
318
|
-
|
|
319
|
-
clearTimeout(entry.deadlineTimer);
|
|
320
|
-
entry.deadlineTimer = undefined;
|
|
321
|
-
}
|
|
355
|
+
this.clearTickTimers(entry);
|
|
322
356
|
}
|
|
323
357
|
}
|
|
324
358
|
}
|
|
@@ -9,6 +9,7 @@ export interface ProcessRow {
|
|
|
9
9
|
tty?: string;
|
|
10
10
|
args: string;
|
|
11
11
|
}
|
|
12
|
+
export declare function listProcessRowsFromProc(procRoot?: string): ProcessRow[];
|
|
12
13
|
export declare const realProcessSnapshot: ProcessSnapshot;
|
|
13
14
|
export declare function installationLooksActive(installation: Pick<Installation, 'agent' | 'label'>, commandLines: string[]): boolean;
|
|
14
15
|
export declare function isInstallationLikelyActive(installation: Pick<Installation, 'agent' | 'label'>, snapshot?: ProcessSnapshot): Promise<boolean>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execFile } from 'child_process';
|
|
2
|
+
import * as fs from 'fs';
|
|
2
3
|
import { promisify } from 'util';
|
|
3
4
|
import { getVersionDir } from './store.js';
|
|
4
5
|
import { hasLiveLaunchLease } from './shims.js';
|
|
@@ -25,6 +26,28 @@ async function listCommandLinesPosix() {
|
|
|
25
26
|
throw new Error('could not read the process table (ps failed)');
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
export function listProcessRowsFromProc(procRoot = '/proc') {
|
|
30
|
+
let entries;
|
|
31
|
+
try {
|
|
32
|
+
entries = fs.readdirSync(procRoot);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw new Error(`could not read the process table (${procRoot}: ${err.message})`);
|
|
36
|
+
}
|
|
37
|
+
return entries.flatMap((name) => {
|
|
38
|
+
if (!/^\d+$/.test(name))
|
|
39
|
+
return [];
|
|
40
|
+
let raw;
|
|
41
|
+
try {
|
|
42
|
+
raw = fs.readFileSync(`${procRoot}/${name}/cmdline`, 'utf8');
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
const args = raw.replace(/\0+$/, '').split('\0').join(' ');
|
|
48
|
+
return args ? [{ pid: Number(name), args }] : [];
|
|
49
|
+
});
|
|
50
|
+
}
|
|
28
51
|
async function listCommandLinesWindows() {
|
|
29
52
|
try {
|
|
30
53
|
const { stdout } = await execFileAsync('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command',
|
|
@@ -36,10 +59,20 @@ async function listCommandLinesWindows() {
|
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
61
|
export const realProcessSnapshot = {
|
|
39
|
-
listCommandLines: () =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
listCommandLines: async () => {
|
|
63
|
+
if (process.platform === 'win32')
|
|
64
|
+
return listCommandLinesWindows();
|
|
65
|
+
if (process.platform === 'linux')
|
|
66
|
+
return listProcessRowsFromProc().map((row) => row.args);
|
|
67
|
+
return listCommandLinesPosix();
|
|
68
|
+
},
|
|
69
|
+
listProcessRows: async () => {
|
|
70
|
+
if (process.platform === 'win32')
|
|
71
|
+
return (await listCommandLinesWindows()).map((args) => ({ args }));
|
|
72
|
+
if (process.platform === 'linux')
|
|
73
|
+
return listProcessRowsFromProc();
|
|
74
|
+
return listProcessRowsPosix();
|
|
75
|
+
},
|
|
43
76
|
};
|
|
44
77
|
export function installationLooksActive(installation, commandLines) {
|
|
45
78
|
const versionDir = getVersionDir(installation.agent, installation.label);
|
|
@@ -1917,8 +1917,7 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
|
|
|
1917
1917
|
if (activePresetName) {
|
|
1918
1918
|
const recipe = readPermissionPresetRecipe(activePresetName);
|
|
1919
1919
|
if (recipe) {
|
|
1920
|
-
|
|
1921
|
-
presetFilteredGroups = recipe.includes.filter(g => available.has(g));
|
|
1920
|
+
presetFilteredGroups = recipe.includes;
|
|
1922
1921
|
}
|
|
1923
1922
|
else {
|
|
1924
1923
|
console.warn(`${PERMISSION_PRESET_ENV_VAR}=${activePresetName} but no recipe at ~/.agents/permissions/presets/${activePresetName}.yaml — falling back to all groups`);
|
|
@@ -3,6 +3,7 @@ export declare const GROK_TOOL_BY_CANONICAL: Record<string, string | undefined>;
|
|
|
3
3
|
export declare const CANONICAL_TO_OPENCLAW_TOOL: Record<string, string>;
|
|
4
4
|
export declare const ANTIGRAVITY_ACTION_BY_TOOL: Record<string, string | undefined>;
|
|
5
5
|
export declare const CODEX_RULES_FILENAME = "agents-deny.rules";
|
|
6
|
+
export declare const CODEX_ASK_RULES_FILENAME = "agents-ask.rules";
|
|
6
7
|
export declare function stripJsonComments(content: string): string;
|
|
7
8
|
interface PermissionTarget {
|
|
8
9
|
home(home: string): string;
|
|
@@ -10,6 +11,9 @@ interface PermissionTarget {
|
|
|
10
11
|
toCanonical(configPath: string): PermissionSet | null;
|
|
11
12
|
lossyBecause: string;
|
|
12
13
|
altSuffixes?: string[];
|
|
14
|
+
ask: true | {
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
13
17
|
}
|
|
14
18
|
export declare const PERMISSION_TARGETS: Partial<Record<AgentId, PermissionTarget>>;
|
|
15
19
|
export declare function readCanonicalPermissions(agent: AgentId, scope?: 'user' | 'project', cwd?: string, home?: string): PermissionSet | null;
|