@phnx-labs/agents-cli 1.23.20 → 1.23.22
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 +126 -0
- package/README.md +17 -0
- package/dist/bootstrap.js +5 -4
- package/dist/cli/command-registry.js +2 -0
- package/dist/commands/config.js +16 -0
- package/dist/commands/daemon.js +3 -3
- package/dist/commands/doctor.js +10 -19
- package/dist/commands/events.js +1 -14
- package/dist/commands/feed-watch.js +5 -2
- package/dist/commands/go.js +2 -2
- package/dist/commands/lead.d.ts +3 -0
- package/dist/commands/lead.js +280 -0
- package/dist/commands/projects.js +3 -2
- package/dist/commands/ps-roster.d.ts +2 -12
- package/dist/commands/ps-roster.js +5 -87
- package/dist/commands/ps.js +3 -1
- package/dist/commands/repo.js +12 -12
- package/dist/commands/resource-view.js +5 -5
- package/dist/commands/sessions-browser.js +2 -2
- package/dist/commands/sessions-watch.js +5 -2
- package/dist/commands/setup-secrets.d.ts +3 -4
- package/dist/commands/setup-secrets.js +15 -46
- package/dist/commands/setup-session-backup.js +1 -1
- package/dist/commands/ssh.d.ts +0 -4
- package/dist/commands/ssh.js +14 -81
- package/dist/commands/teams-picker.js +1 -12
- package/dist/commands/teams.js +1 -13
- package/dist/commands/view.d.ts +1 -40
- package/dist/commands/view.js +9 -330
- package/dist/commands/watchdog.js +4 -4
- package/dist/index.js +4 -0
- package/dist/lib/accounting/usage.d.ts +0 -1
- package/dist/lib/accounting/usage.js +1 -112
- package/dist/lib/accounts/add.js +1 -1
- package/dist/lib/accounts/migrate.js +1 -1
- package/dist/lib/auto-pull-worker.js +2 -16
- package/dist/lib/auto-pull.d.ts +1 -0
- package/dist/lib/auto-pull.js +27 -0
- package/dist/lib/browser-client.js +2 -11
- package/dist/lib/cloud/codex.js +3 -0
- package/dist/lib/commands.d.ts +0 -6
- package/dist/lib/commands.js +3 -116
- package/dist/lib/comms-render.d.ts +1 -7
- package/dist/lib/comms-render.js +0 -19
- package/dist/lib/computer-client.js +2 -11
- package/dist/lib/config-keys.d.ts +7 -3
- package/dist/lib/config-keys.js +15 -2
- package/dist/lib/crabbox/runtimes.d.ts +0 -14
- package/dist/lib/crabbox/runtimes.js +0 -80
- package/dist/lib/daemon/attention-notify-service.d.ts +51 -28
- package/dist/lib/daemon/attention-notify-service.js +219 -53
- package/dist/lib/daemon/daemon.js +1 -2
- package/dist/lib/daemon/feed-stream-service.js +2 -4
- package/dist/lib/device-config.d.ts +0 -5
- package/dist/lib/device-config.js +20 -27
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +12 -1
- package/dist/lib/devices/fleet.d.ts +6 -0
- package/dist/lib/devices/fleet.js +15 -0
- package/dist/lib/devices/harness-inventory.d.ts +9 -0
- package/dist/lib/devices/harness-inventory.js +66 -0
- package/dist/lib/exec.js +1 -3
- package/dist/lib/feed/attention.d.ts +16 -1
- package/dist/lib/feed/attention.js +63 -1
- package/dist/lib/feed/feed.d.ts +1 -1
- package/dist/lib/feed/feed.js +12 -2
- package/dist/lib/feed/hub.d.ts +9 -0
- package/dist/lib/feed/hub.js +27 -1
- package/dist/lib/feed/notify-schedule.d.ts +16 -0
- package/dist/lib/feed/notify-schedule.js +62 -0
- package/dist/lib/feed/ticket-priority.d.ts +4 -0
- package/dist/lib/feed/ticket-priority.js +30 -0
- package/dist/lib/feed/watch.d.ts +1 -0
- package/dist/lib/feed/watch.js +27 -3
- package/dist/lib/feed-ranking.d.ts +1 -0
- package/dist/lib/feed-ranking.js +3 -1
- package/dist/lib/format.d.ts +0 -2
- package/dist/lib/format.js +0 -8
- package/dist/lib/github/open-prs.d.ts +0 -2
- package/dist/lib/github/open-prs.js +17 -35
- package/dist/lib/github/project-prs.d.ts +5 -0
- package/dist/lib/github/project-prs.js +73 -32
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hooks/cache.d.ts +1 -0
- package/dist/lib/hooks/cache.js +12 -1
- package/dist/lib/installations/duplicate-prune.d.ts +37 -0
- package/dist/lib/installations/duplicate-prune.js +85 -0
- package/dist/lib/installations/inventory-json.d.ts +20 -0
- package/dist/lib/installations/inventory-json.js +252 -0
- package/dist/lib/installations/shims.d.ts +0 -18
- package/dist/lib/installations/shims.js +1 -257
- package/dist/lib/lead/brief.d.ts +49 -0
- package/dist/lib/lead/brief.js +173 -0
- package/dist/lib/lead/client.d.ts +21 -0
- package/dist/lib/lead/client.js +167 -0
- package/dist/lib/lead/confirm.d.ts +22 -0
- package/dist/lib/lead/confirm.js +73 -0
- package/dist/lib/lead/events.d.ts +106 -0
- package/dist/lib/lead/events.js +188 -0
- package/dist/lib/lead/harness.d.ts +29 -0
- package/dist/lib/lead/harness.js +107 -0
- package/dist/lib/lead/host.d.ts +132 -0
- package/dist/lib/lead/host.js +675 -0
- package/dist/lib/lead/paths.d.ts +22 -0
- package/dist/lib/lead/paths.js +69 -0
- package/dist/lib/lead/refs.d.ts +17 -0
- package/dist/lib/lead/refs.js +75 -0
- package/dist/lib/lead/roster.d.ts +26 -0
- package/dist/lib/lead/roster.js +121 -0
- package/dist/lib/lead/shapes.d.ts +23 -0
- package/dist/lib/lead/shapes.js +95 -0
- package/dist/lib/lead/store.d.ts +46 -0
- package/dist/lib/lead/store.js +77 -0
- package/dist/lib/lead/tools.d.ts +18 -0
- package/dist/lib/lead/tools.js +106 -0
- package/dist/lib/lead/visibility.d.ts +16 -0
- package/dist/lib/lead/visibility.js +77 -0
- package/dist/lib/mailbox.d.ts +0 -18
- package/dist/lib/mailbox.js +0 -170
- package/dist/lib/menubar/notify-desktop.d.ts +5 -0
- package/dist/lib/menubar/notify-desktop.js +24 -0
- package/dist/lib/models.js +1 -19
- package/dist/lib/permissions.d.ts +0 -6
- package/dist/lib/permissions.js +0 -140
- package/dist/lib/platform/process.d.ts +1 -0
- package/dist/lib/platform/process.js +5 -0
- package/dist/lib/probe.js +13 -1
- package/dist/lib/project-status.js +4 -3
- package/dist/lib/projects.d.ts +9 -0
- package/dist/lib/projects.js +61 -3
- package/dist/lib/scheduling/routines.d.ts +1 -13
- package/dist/lib/scheduling/routines.js +1 -37
- package/dist/lib/secrets-cli.d.ts +3 -3
- package/dist/lib/secrets-cli.js +1 -1
- package/dist/lib/secrets-client.d.ts +4 -37
- package/dist/lib/secrets-client.js +19 -265
- package/dist/lib/session/active.d.ts +18 -8
- package/dist/lib/session/active.js +94 -18
- package/dist/lib/session/db.d.ts +0 -16
- package/dist/lib/session/db.js +1 -134
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -18
- package/dist/lib/session/pending-work.d.ts +21 -0
- package/dist/lib/session/pending-work.js +284 -0
- package/dist/lib/session/remote/remote-list.d.ts +0 -3
- package/dist/lib/session/remote/remote-list.js +1 -23
- package/dist/lib/session/remote/watch.d.ts +5 -0
- package/dist/lib/session/remote/watch.js +19 -2
- package/dist/lib/session/session-cache.d.ts +1 -1
- package/dist/lib/session/session-cache.js +12 -5
- package/dist/lib/session/sync/provision.js +1 -2
- package/dist/lib/smart-launch.js +7 -2
- package/dist/lib/snapshot.js +3 -4
- package/dist/lib/ssh-exec.d.ts +0 -40
- package/dist/lib/ssh-exec.js +0 -108
- package/dist/lib/ssh-tunnel.d.ts +0 -6
- package/dist/lib/ssh-tunnel.js +0 -42
- package/dist/lib/standalone-tools.js +12 -1
- package/dist/lib/startup/command-registry.js +1 -1
- package/dist/lib/startup/spellcheck.d.ts +0 -1
- package/dist/lib/startup/spellcheck.js +1 -20
- package/dist/lib/state.d.ts +0 -6
- package/dist/lib/state.js +1 -14
- package/dist/lib/teams/delivery.d.ts +1 -0
- package/dist/lib/teams/delivery.js +13 -0
- package/dist/lib/types.d.ts +0 -37
- package/dist/lib/types.js +0 -9
- package/dist/lib/watchdog/log.d.ts +1 -1
- package/dist/lib/watchdog/log.js +6 -4
- package/package.json +2 -1
- package/dist/lib/artifact-actions.d.ts +0 -7
- package/dist/lib/artifact-actions.js +0 -39
- package/dist/lib/session/sync/managed-config.d.ts +0 -3
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.d.ts +0 -1
- package/dist/lib/session/sync/worker-template.js +0 -807
- package/dist/lib/storage/selection.d.ts +0 -8
- package/dist/lib/storage/selection.js +0 -10
- package/dist/lib/watchdog/index.d.ts +0 -3
- package/dist/lib/watchdog/index.js +0 -3
package/dist/lib/projects.js
CHANGED
|
@@ -43,6 +43,13 @@ export function validateProjectDef(raw, sourceName) {
|
|
|
43
43
|
throw new Error(`Project ${sourceName}: "name" (${JSON.stringify(name)}) must match the filename — the filename is the stable id`);
|
|
44
44
|
}
|
|
45
45
|
const def = { name };
|
|
46
|
+
if (o.aliases !== undefined && o.aliases !== null) {
|
|
47
|
+
if (!Array.isArray(o.aliases) || o.aliases.some((a) => typeof a !== 'string' || !isSafeProjectName(a) || a.toLowerCase() === name.toLowerCase())) {
|
|
48
|
+
throw new Error(`Project ${name}: "aliases" must be a list of former project names, other than the project's own name (got ${JSON.stringify(o.aliases)})`);
|
|
49
|
+
}
|
|
50
|
+
if (o.aliases.length > 0)
|
|
51
|
+
def.aliases = [...new Set(o.aliases)];
|
|
52
|
+
}
|
|
46
53
|
if (typeof o.description === 'string')
|
|
47
54
|
def.description = o.description;
|
|
48
55
|
if (typeof o.root === 'string')
|
|
@@ -147,6 +154,15 @@ export function loadProjectDef(name) {
|
|
|
147
154
|
}
|
|
148
155
|
return validateProjectDef(yaml.parse(raw), name);
|
|
149
156
|
}
|
|
157
|
+
const warnedAliases = new Set();
|
|
158
|
+
function warnIgnoredAliases(lines) {
|
|
159
|
+
for (const line of lines) {
|
|
160
|
+
if (warnedAliases.has(line))
|
|
161
|
+
continue;
|
|
162
|
+
warnedAliases.add(line);
|
|
163
|
+
process.stderr.write(`agents: warning: ${line}\n`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
150
166
|
export function listProjectDefs() {
|
|
151
167
|
let files;
|
|
152
168
|
try {
|
|
@@ -164,7 +180,9 @@ export function listProjectDefs() {
|
|
|
164
180
|
if (def)
|
|
165
181
|
out.push(def);
|
|
166
182
|
}
|
|
167
|
-
|
|
183
|
+
out.sort((a, b) => a.name.localeCompare(b.name));
|
|
184
|
+
warnIgnoredAliases(resolveProjectAliases(out).ignored);
|
|
185
|
+
return out;
|
|
168
186
|
}
|
|
169
187
|
export function writeProjectDef(def) {
|
|
170
188
|
const validated = validateProjectDef(def, def.name);
|
|
@@ -363,15 +381,55 @@ export function listProjectDefsCached() {
|
|
|
363
381
|
export function resetProjectDefsCache() {
|
|
364
382
|
projectDefsMemo = null;
|
|
365
383
|
}
|
|
384
|
+
const aliasMemo = new WeakMap();
|
|
385
|
+
export function resolveProjectAliases(defs) {
|
|
386
|
+
const memo = aliasMemo.get(defs);
|
|
387
|
+
if (memo)
|
|
388
|
+
return memo;
|
|
389
|
+
const live = new Map(defs.map((def) => [def.name.toLowerCase(), def]));
|
|
390
|
+
const claims = new Map();
|
|
391
|
+
const ignored = [];
|
|
392
|
+
for (const def of defs) {
|
|
393
|
+
for (const alias of new Set((def.aliases ?? []).map((a) => a.toLowerCase()))) {
|
|
394
|
+
const other = live.get(alias);
|
|
395
|
+
if (other) {
|
|
396
|
+
const back = (other.aliases ?? []).some((a) => a.toLowerCase() === def.name.toLowerCase());
|
|
397
|
+
ignored.push(back
|
|
398
|
+
? `project aliases "${def.name}" -> "${other.name}" -> "${def.name}" form a cycle; ignoring "${alias}" on "${def.name}"`
|
|
399
|
+
: `project alias "${alias}" on "${def.name}" is the name of the live project "${other.name}"; ignoring it`);
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
claims.set(alias, [...(claims.get(alias) ?? []), def.name]);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const table = new Map();
|
|
406
|
+
for (const [alias, owners] of claims) {
|
|
407
|
+
if (owners.length === 1)
|
|
408
|
+
table.set(alias, owners[0]);
|
|
409
|
+
else
|
|
410
|
+
ignored.push(`project alias "${alias}" is claimed by ${owners.map((o) => `"${o}"`).join(' and ')}; ignoring it until one definition drops it`);
|
|
411
|
+
}
|
|
412
|
+
const resolution = { table, ignored };
|
|
413
|
+
aliasMemo.set(defs, resolution);
|
|
414
|
+
return resolution;
|
|
415
|
+
}
|
|
416
|
+
export function projectAliasTable(defs) {
|
|
417
|
+
return resolveProjectAliases(defs).table;
|
|
418
|
+
}
|
|
419
|
+
export function canonicalProjectName(name, defs = listProjectDefsCached()) {
|
|
420
|
+
return projectAliasTable(defs).get(name.toLowerCase()) ?? name;
|
|
421
|
+
}
|
|
366
422
|
export function confirmedProjectForCwd(cwd, defs = listProjectDefsCached()) {
|
|
367
423
|
if (!cwd)
|
|
368
424
|
return undefined;
|
|
369
|
-
|
|
425
|
+
const name = projectNameForCwd(cwd, defs);
|
|
426
|
+
return name === undefined ? undefined : canonicalProjectName(name, defs);
|
|
370
427
|
}
|
|
371
428
|
export function resolveProjectNameForCwd(cwd, defs) {
|
|
372
429
|
if (!cwd)
|
|
373
430
|
return undefined;
|
|
374
|
-
|
|
431
|
+
const name = projectNameForCwd(cwd, defs);
|
|
432
|
+
return name === undefined ? resolveProjectKey(cwd) : canonicalProjectName(name, defs);
|
|
375
433
|
}
|
|
376
434
|
export function resolveDefinedProjectPath(def, worktree, forRemote) {
|
|
377
435
|
if (worktree) {
|
|
@@ -218,19 +218,7 @@ export declare function oneShotScheduleFireDate(schedule: string | undefined | n
|
|
|
218
218
|
export declare function isPastOneShotRoutine(config: Pick<JobConfig, 'schedule' | 'runOnce' | 'timezone'>, now?: Date): boolean;
|
|
219
219
|
export declare function hasCompletedOneShotRun(config: Pick<JobConfig, 'name' | 'schedule' | 'runOnce' | 'timezone'>, now?: Date): boolean;
|
|
220
220
|
export declare function shouldPurgeCompletedOneShotRoutine(config: Pick<JobConfig, 'name' | 'schedule' | 'runOnce' | 'timezone'>, now?: Date): boolean;
|
|
221
|
-
export
|
|
222
|
-
source: string;
|
|
223
|
-
event: string;
|
|
224
|
-
action?: string;
|
|
225
|
-
issue?: unknown;
|
|
226
|
-
updatedFrom?: unknown;
|
|
227
|
-
pull_request?: unknown;
|
|
228
|
-
repository?: unknown;
|
|
229
|
-
}
|
|
230
|
-
export declare function substituteWebhookPrompt(prompt: string, context: WebhookContext): string;
|
|
231
|
-
export declare function substituteWebhookCommand(command: string, context: WebhookContext): string;
|
|
232
|
-
export declare function assertShellSubstitutionSupported(command: string, platform?: NodeJS.Platform): void;
|
|
233
|
-
export declare function resolveJobPrompt(config: JobConfig, context?: WebhookContext): string;
|
|
221
|
+
export declare function resolveJobPrompt(config: JobConfig): string;
|
|
234
222
|
export declare function parseTimeout(timeout: string): number | null;
|
|
235
223
|
export declare function listRuns(jobName: string): RunMeta[];
|
|
236
224
|
export declare function getLatestRun(jobName: string): RunMeta | null;
|
|
@@ -989,40 +989,7 @@ export function hasCompletedOneShotRun(config, now = new Date()) {
|
|
|
989
989
|
export function shouldPurgeCompletedOneShotRoutine(config, now = new Date()) {
|
|
990
990
|
return hasCompletedOneShotRun(config, now);
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
const parts = path.split('.');
|
|
994
|
-
let current = obj;
|
|
995
|
-
for (const part of parts) {
|
|
996
|
-
if (current === null || current === undefined)
|
|
997
|
-
return undefined;
|
|
998
|
-
current = current[part];
|
|
999
|
-
}
|
|
1000
|
-
return current;
|
|
1001
|
-
}
|
|
1002
|
-
export function substituteWebhookPrompt(prompt, context) {
|
|
1003
|
-
return prompt.replace(/\{\{([^{}]+)\}\}/g, (_, rawPath) => {
|
|
1004
|
-
const value = getPath(context, rawPath.trim());
|
|
1005
|
-
if (value === undefined || value === null)
|
|
1006
|
-
return '';
|
|
1007
|
-
return String(value);
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
export function substituteWebhookCommand(command, context) {
|
|
1011
|
-
return command.replace(/\{\{([^{}]+)\}\}/g, (_, rawPath) => {
|
|
1012
|
-
const value = getPath(context, rawPath.trim());
|
|
1013
|
-
if (value === undefined || value === null)
|
|
1014
|
-
return "''";
|
|
1015
|
-
return `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
export function assertShellSubstitutionSupported(command, platform = process.platform) {
|
|
1019
|
-
if (platform === 'win32' && /\{\{[^{}]+\}\}/.test(command)) {
|
|
1020
|
-
throw new Error('run.command with {{…}} placeholders is not supported on Windows: the values come from an ' +
|
|
1021
|
-
'untrusted webhook payload and cmd.exe cannot be quoted safely. Use run.prompt, or a ' +
|
|
1022
|
-
'command with no placeholders.');
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
export function resolveJobPrompt(config, context) {
|
|
992
|
+
export function resolveJobPrompt(config) {
|
|
1026
993
|
const now = new Date();
|
|
1027
994
|
const tz = config.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1028
995
|
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
@@ -1040,9 +1007,6 @@ export function resolveJobPrompt(config, context) {
|
|
|
1040
1007
|
prompt = prompt.replace(new RegExp(`\\{${key}\\}`, 'g'), value);
|
|
1041
1008
|
}
|
|
1042
1009
|
}
|
|
1043
|
-
if (context) {
|
|
1044
|
-
prompt = substituteWebhookPrompt(prompt, context);
|
|
1045
|
-
}
|
|
1046
1010
|
const latestRun = getLatestCompletedRun(config.name);
|
|
1047
1011
|
if (latestRun) {
|
|
1048
1012
|
const reportPath = path.join(getJobRunsDir(config.name), latestRun.runId, 'report.md');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const SECRETS_CLI_NAME = "secrets";
|
|
2
2
|
export declare const SECRETS_CLI_PACKAGE = "@phnx-labs/secrets-cli";
|
|
3
|
-
export declare const SECRETS_CLI_VERSION = "0.
|
|
4
|
-
export declare const SECRETS_CLI_SPEC = "@phnx-labs/secrets-cli@0.
|
|
5
|
-
export declare const SECRETS_CLI_INSTALL_HINT = "npm i -g @phnx-labs/secrets-cli@0.
|
|
3
|
+
export declare const SECRETS_CLI_VERSION = "0.4.0";
|
|
4
|
+
export declare const SECRETS_CLI_SPEC = "@phnx-labs/secrets-cli@0.4.0";
|
|
5
|
+
export declare const SECRETS_CLI_INSTALL_HINT = "npm i -g @phnx-labs/secrets-cli@0.4.0";
|
|
6
6
|
export declare function isSecretsPresent(): boolean;
|
package/dist/lib/secrets-cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findInPath } from './agent-spec/agents.js';
|
|
2
2
|
export const SECRETS_CLI_NAME = 'secrets';
|
|
3
3
|
export const SECRETS_CLI_PACKAGE = '@phnx-labs/secrets-cli';
|
|
4
|
-
export const SECRETS_CLI_VERSION = '0.
|
|
4
|
+
export const SECRETS_CLI_VERSION = '0.4.0';
|
|
5
5
|
export const SECRETS_CLI_SPEC = `${SECRETS_CLI_PACKAGE}@${SECRETS_CLI_VERSION}`;
|
|
6
6
|
export const SECRETS_CLI_INSTALL_HINT = `npm i -g ${SECRETS_CLI_SPEC}`;
|
|
7
7
|
export function isSecretsPresent() {
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
allowedBundles?: string[];
|
|
6
|
-
scope?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class SecretsClientError extends Error {
|
|
9
|
-
readonly code: string;
|
|
10
|
-
constructor(code: string, message: string);
|
|
11
|
-
toJSON(): {
|
|
12
|
-
code: string;
|
|
13
|
-
message: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export declare function isSecretsClientError(error: unknown, code?: string): error is SecretsClientError;
|
|
17
|
-
export declare function isSecretsTransportError(error: unknown): error is SecretsClientError;
|
|
1
|
+
import { type SecretsContext } from '@phnx-labs/secrets-cli/client';
|
|
2
|
+
import type { SecretsBundle, SecretsBackend, WriteBundleOptions, BundleEntryInfo, RenameOptions, RotateOptions, BundleValue, KeychainReadContext, SecretRef, AgentStatusEntry, PushBundleOptions, PushBundleResult, RemoteBundleSummary, PullOptions, RcSecretFinding } from './secrets-types.js';
|
|
3
|
+
export { PROTOCOL_VERSION, SYNC_SERVE_TIMEOUT_MS, SecretsClientError, isSecretsClientError, isSecretsTransportError, resolveSecretsBin, invocation, buildServeEnv, secretsRequest, secretsRequestSync, readAndResolveBundleEnv, readAndResolveBundleEnvSync, _setSyncServeTimeoutForTest, type SecretsContext, } from '@phnx-labs/secrets-cli/client';
|
|
4
|
+
export declare function _resetSecretsClientForTest(): void;
|
|
18
5
|
export declare function secretsKeychainItem(bundle: string, key: string): string;
|
|
19
6
|
export declare function profileKeychainItem(provider: string): string;
|
|
20
7
|
export declare function keychainRef(key: string): string;
|
|
@@ -24,24 +11,6 @@ export declare function parseBundleValue(raw: BundleValue): {
|
|
|
24
11
|
} | {
|
|
25
12
|
ref: SecretRef;
|
|
26
13
|
};
|
|
27
|
-
export declare function resolveSecretsBin(): string;
|
|
28
|
-
export declare function invocation(bin: string): {
|
|
29
|
-
command: string;
|
|
30
|
-
prefix: string[];
|
|
31
|
-
};
|
|
32
|
-
export declare function buildServeEnv(base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
33
|
-
export declare function secretsRequest<T = unknown>(op: string, args?: unknown[], context?: SecretsContext): Promise<T>;
|
|
34
|
-
export declare function secretsRequestSync<T = unknown>(op: string, args?: unknown[], context?: SecretsContext): T;
|
|
35
|
-
export declare function _resetSecretsClientForTest(): void;
|
|
36
|
-
export declare function _setSyncServeTimeoutForTest(ms: number): void;
|
|
37
|
-
export declare function readAndResolveBundleEnv(name: string, opts?: ResolveBundleOptions, context?: SecretsContext): Promise<{
|
|
38
|
-
bundle: SecretsBundle;
|
|
39
|
-
env: Record<string, string>;
|
|
40
|
-
}>;
|
|
41
|
-
export declare function readAndResolveBundleEnvSync(name: string, opts?: ResolveBundleOptions, context?: SecretsContext): {
|
|
42
|
-
bundle: SecretsBundle;
|
|
43
|
-
env: Record<string, string>;
|
|
44
|
-
};
|
|
45
14
|
export declare function listBundles(context?: SecretsContext): Promise<SecretsBundle[]>;
|
|
46
15
|
export declare function listBundlesSync(context?: SecretsContext): SecretsBundle[];
|
|
47
16
|
export declare function describeBundle(bundle: SecretsBundle, context?: SecretsContext): Promise<BundleEntryInfo[]>;
|
|
@@ -85,8 +54,6 @@ export declare function storeSetSync(backend: SecretsBackend, item: string, valu
|
|
|
85
54
|
export declare function remoteResolveEnv(target: string, bundle: string, opts?: {
|
|
86
55
|
osLookupName?: string;
|
|
87
56
|
}): Promise<Record<string, string>>;
|
|
88
|
-
export declare const REMOTE_USER_AGENTS_DIR = "~/.agents";
|
|
89
|
-
export declare function withRemoteStateRoot(opts: PushBundleOptions): PushBundleOptions;
|
|
90
57
|
export declare function pushBundleToHost(bundle: string, host: string, opts: PushBundleOptions): Promise<PushBundleResult>;
|
|
91
58
|
export declare function pushBundleToHostAsync(bundle: string, host: string, opts: PushBundleOptions): Promise<PushBundleResult>;
|
|
92
59
|
export declare function listRemoteBundles(context?: SecretsContext): Promise<RemoteBundleSummary[]>;
|
|
@@ -1,67 +1,24 @@
|
|
|
1
|
-
import { spawn, spawnSync } from 'node:child_process';
|
|
2
1
|
import * as fs from 'node:fs';
|
|
3
2
|
import * as path from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function encodeWire(value) {
|
|
13
|
-
if (value instanceof Map) {
|
|
14
|
-
return { $map: [...value.entries()].map(([key, item]) => [key, encodeWire(item)]) };
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(value))
|
|
17
|
-
return value.map(encodeWire);
|
|
18
|
-
if (value !== null && typeof value === 'object') {
|
|
19
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, encodeWire(item)]));
|
|
20
|
-
}
|
|
21
|
-
return value === undefined ? null : value;
|
|
22
|
-
}
|
|
23
|
-
function decodeWire(value) {
|
|
24
|
-
if (Array.isArray(value))
|
|
25
|
-
return value.map(decodeWire);
|
|
26
|
-
if (value !== null && typeof value === 'object') {
|
|
27
|
-
const object = value;
|
|
28
|
-
if (Object.keys(object).length === 1 && Array.isArray(object.$map)) {
|
|
29
|
-
if (object.$map.some((entry) => !Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== 'string')) {
|
|
30
|
-
throw new SecretsClientError('INVALID_RESPONSE', 'Invalid map encoding in secrets response');
|
|
31
|
-
}
|
|
32
|
-
return new Map(object.$map.map(([key, item]) => [key, decodeWire(item)]));
|
|
33
|
-
}
|
|
34
|
-
return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, decodeWire(item)]));
|
|
35
|
-
}
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
export class SecretsClientError extends Error {
|
|
39
|
-
code;
|
|
40
|
-
constructor(code, message) {
|
|
41
|
-
super(message);
|
|
42
|
-
this.code = code;
|
|
43
|
-
this.name = 'SecretsClientError';
|
|
3
|
+
import { configureSecretsClient, secretsRequest, secretsRequestSync, _resetSecretsClientForTest as resetPublishedClient, } from '@phnx-labs/secrets-cli/client';
|
|
4
|
+
import { getLogsDir } from './state.js';
|
|
5
|
+
export { PROTOCOL_VERSION, SYNC_SERVE_TIMEOUT_MS, SecretsClientError, isSecretsClientError, isSecretsTransportError, resolveSecretsBin, invocation, buildServeEnv, secretsRequest, secretsRequestSync, readAndResolveBundleEnv, readAndResolveBundleEnvSync, _setSyncServeTimeoutForTest, } from '@phnx-labs/secrets-cli/client';
|
|
6
|
+
function routeEngineStderr() {
|
|
7
|
+
const log = path.resolve(getLogsDir(), 'secrets-serve.log');
|
|
8
|
+
try {
|
|
9
|
+
fs.mkdirSync(path.dirname(log), { recursive: true, mode: 0o700 });
|
|
10
|
+
fs.closeSync(fs.openSync(log, 'a', 0o600));
|
|
44
11
|
}
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
catch {
|
|
13
|
+
configureSecretsClient({ stderr: 'ignore' });
|
|
14
|
+
return;
|
|
47
15
|
}
|
|
16
|
+
configureSecretsClient({ stderr: log });
|
|
48
17
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
'SECRETS_BIN_MISSING',
|
|
54
|
-
'TIMEOUT',
|
|
55
|
-
'SPAWN_FAILED',
|
|
56
|
-
'SYNC_UNSUPPORTED',
|
|
57
|
-
'PROTOCOL_UNSUPPORTED',
|
|
58
|
-
'INVALID_RESPONSE',
|
|
59
|
-
'RESPONSE_TOO_LARGE',
|
|
60
|
-
'IO_ERROR',
|
|
61
|
-
]);
|
|
62
|
-
// Only transport failures may degrade to unavailable; policy and data errors remain authoritative.
|
|
63
|
-
export function isSecretsTransportError(error) {
|
|
64
|
-
return error instanceof SecretsClientError && SECRETS_TRANSPORT_CODES.has(error.code);
|
|
18
|
+
routeEngineStderr();
|
|
19
|
+
export function _resetSecretsClientForTest() {
|
|
20
|
+
resetPublishedClient();
|
|
21
|
+
routeEngineStderr();
|
|
65
22
|
}
|
|
66
23
|
const SERVICE_PREFIX = 'agents-cli';
|
|
67
24
|
const SECRETS_ITEM_PREFIX = `${SERVICE_PREFIX}.secrets.`;
|
|
@@ -87,206 +44,6 @@ export function parseBundleValue(raw) {
|
|
|
87
44
|
return { literal: raw };
|
|
88
45
|
return { ref: { provider: match[1], value: match[2] } };
|
|
89
46
|
}
|
|
90
|
-
let cachedBin;
|
|
91
|
-
// Resolution skips the legacy agents shim to avoid recursive secrets passthrough.
|
|
92
|
-
export function resolveSecretsBin() {
|
|
93
|
-
if (cachedBin)
|
|
94
|
-
return cachedBin;
|
|
95
|
-
const explicit = process.env.SECRETS_BIN?.trim();
|
|
96
|
-
const resolved = explicit && explicit.length > 0 ? explicit : findInPath('secrets');
|
|
97
|
-
if (!resolved) {
|
|
98
|
-
throw new SecretsClientError('SECRETS_BIN_MISSING', 'The standalone `secrets` CLI was not found. Install it with:\n' +
|
|
99
|
-
` ${SECRETS_CLI_INSTALL_HINT}\n` +
|
|
100
|
-
'or run `agents setup secrets`.');
|
|
101
|
-
}
|
|
102
|
-
cachedBin = resolved;
|
|
103
|
-
return resolved;
|
|
104
|
-
}
|
|
105
|
-
export function invocation(bin) {
|
|
106
|
-
if (/\.[mc]?js$/.test(bin))
|
|
107
|
-
return { command: process.execPath, prefix: [bin] };
|
|
108
|
-
return { command: bin, prefix: [] };
|
|
109
|
-
}
|
|
110
|
-
export function buildServeEnv(base = process.env) {
|
|
111
|
-
const env = {
|
|
112
|
-
...base,
|
|
113
|
-
SECRETS_HOME: base.SECRETS_HOME ?? getUserAgentsDir(),
|
|
114
|
-
};
|
|
115
|
-
if (!env.SECRETS_PASSPHRASE && base.AGENTS_SECRETS_PASSPHRASE) {
|
|
116
|
-
env.SECRETS_PASSPHRASE = base.AGENTS_SECRETS_PASSPHRASE;
|
|
117
|
-
}
|
|
118
|
-
return env;
|
|
119
|
-
}
|
|
120
|
-
let requestCounter = 0;
|
|
121
|
-
function buildRequest(op, args, context) {
|
|
122
|
-
requestCounter += 1;
|
|
123
|
-
const request = {
|
|
124
|
-
v: PROTOCOL_VERSION,
|
|
125
|
-
id: `${process.pid}-${requestCounter}`,
|
|
126
|
-
op,
|
|
127
|
-
args: encodeWire(args),
|
|
128
|
-
};
|
|
129
|
-
if (context)
|
|
130
|
-
request.context = context;
|
|
131
|
-
return request;
|
|
132
|
-
}
|
|
133
|
-
function describeNonJson(text) {
|
|
134
|
-
const trimmed = text.trim();
|
|
135
|
-
if (!trimmed)
|
|
136
|
-
return ' (the standalone wrote nothing to fd 4)';
|
|
137
|
-
const preview = trimmed.slice(0, 200).replace(/[\u0000-\u001f\u007f]/g, '?');
|
|
138
|
-
return ` (first 200 bytes on fd 4: ${JSON.stringify(preview)})`;
|
|
139
|
-
}
|
|
140
|
-
function parseResponse(raw) {
|
|
141
|
-
const text = raw.toString('utf8');
|
|
142
|
-
let parsed;
|
|
143
|
-
try {
|
|
144
|
-
parsed = JSON.parse(text);
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
throw new SecretsClientError('INVALID_RESPONSE', `secrets returned a non-JSON response${describeNonJson(text)}`);
|
|
148
|
-
}
|
|
149
|
-
if (!parsed || typeof parsed !== 'object') {
|
|
150
|
-
throw new SecretsClientError('INVALID_RESPONSE', 'secrets returned a malformed response envelope');
|
|
151
|
-
}
|
|
152
|
-
if (typeof parsed.v === 'number' && parsed.v !== PROTOCOL_VERSION) {
|
|
153
|
-
throw new SecretsClientError('PROTOCOL_UNSUPPORTED', `secrets speaks protocol ${String(parsed.v)}; this agents-cli needs ${PROTOCOL_VERSION}. ` +
|
|
154
|
-
'Update the standalone CLI (npm i -g @phnx-labs/secrets-cli).');
|
|
155
|
-
}
|
|
156
|
-
if (parsed.v !== PROTOCOL_VERSION || typeof parsed.id !== 'string') {
|
|
157
|
-
throw new SecretsClientError('INVALID_RESPONSE', 'secrets returned a malformed response envelope');
|
|
158
|
-
}
|
|
159
|
-
if (parsed.ok)
|
|
160
|
-
return decodeWire(parsed.result);
|
|
161
|
-
throw new SecretsClientError(parsed.error.code, parsed.error.message);
|
|
162
|
-
}
|
|
163
|
-
function logServeStderr(chunk) {
|
|
164
|
-
if (!chunk || chunk.length === 0)
|
|
165
|
-
return;
|
|
166
|
-
try {
|
|
167
|
-
const file = path.join(getLogsDir(), 'secrets-serve.log');
|
|
168
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
169
|
-
fs.appendFileSync(file, chunk);
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// Anonymous fd3/fd4 pipes keep secret bytes off disk; success waits for both response EOF and child exit.
|
|
175
|
-
function serveOnce(op, args, context) {
|
|
176
|
-
const { command, prefix } = invocation(resolveSecretsBin());
|
|
177
|
-
const request = Buffer.from(JSON.stringify(buildRequest(op, args, context)));
|
|
178
|
-
return new Promise((resolve, reject) => {
|
|
179
|
-
const child = spawn(command, [...prefix, '__serve'], {
|
|
180
|
-
stdio: ['ignore', 'ignore', 'pipe', 'pipe', 'pipe'],
|
|
181
|
-
env: buildServeEnv(),
|
|
182
|
-
});
|
|
183
|
-
child.stderr.on('data', logServeStderr);
|
|
184
|
-
let settled = false;
|
|
185
|
-
const fail = (error) => {
|
|
186
|
-
if (settled)
|
|
187
|
-
return;
|
|
188
|
-
settled = true;
|
|
189
|
-
clearTimeout(timer);
|
|
190
|
-
child.kill('SIGKILL');
|
|
191
|
-
reject(error);
|
|
192
|
-
};
|
|
193
|
-
const timer = setTimeout(() => fail(new SecretsClientError('TIMEOUT', 'secrets request timed out')), SERVE_TIMEOUT_MS);
|
|
194
|
-
child.on('error', (error) => fail(new SecretsClientError('SPAWN_FAILED', `Failed to spawn secrets: ${error.message}`)));
|
|
195
|
-
const input = child.stdio[3];
|
|
196
|
-
input.on('error', () => { });
|
|
197
|
-
input.end(request);
|
|
198
|
-
const out = child.stdio[4];
|
|
199
|
-
const chunks = [];
|
|
200
|
-
let size = 0;
|
|
201
|
-
let response = null;
|
|
202
|
-
let exited = false;
|
|
203
|
-
const settleWhenReady = () => {
|
|
204
|
-
if (settled || response === null || !exited)
|
|
205
|
-
return;
|
|
206
|
-
settled = true;
|
|
207
|
-
clearTimeout(timer);
|
|
208
|
-
try {
|
|
209
|
-
resolve(parseResponse(response));
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
reject(error);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
out.on('data', (chunk) => {
|
|
216
|
-
size += chunk.length;
|
|
217
|
-
if (size > MAX_PROTOCOL_BYTES) {
|
|
218
|
-
fail(new SecretsClientError('RESPONSE_TOO_LARGE', 'secrets response exceeds the protocol limit'));
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
chunks.push(chunk);
|
|
222
|
-
});
|
|
223
|
-
out.on('error', (error) => fail(new SecretsClientError('IO_ERROR', error.message)));
|
|
224
|
-
out.on('end', () => {
|
|
225
|
-
response = Buffer.concat(chunks);
|
|
226
|
-
settleWhenReady();
|
|
227
|
-
});
|
|
228
|
-
child.on('exit', () => {
|
|
229
|
-
exited = true;
|
|
230
|
-
settleWhenReady();
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function shQuote(token) {
|
|
235
|
-
return `'${token.replace(/'/g, `'\\''`)}'`;
|
|
236
|
-
}
|
|
237
|
-
function serveOnceSync(op, args, context) {
|
|
238
|
-
if (process.platform === 'win32') {
|
|
239
|
-
throw new SecretsClientError('SYNC_UNSUPPORTED', 'The synchronous secrets path needs a POSIX shell; use secretsRequest (async) on Windows.');
|
|
240
|
-
}
|
|
241
|
-
const { command, prefix } = invocation(resolveSecretsBin());
|
|
242
|
-
const request = Buffer.from(JSON.stringify(buildRequest(op, args, context)));
|
|
243
|
-
const serve = [command, ...prefix, '__serve'].map(shQuote).join(' ');
|
|
244
|
-
const script = `exec ${serve} 3<&0 4>&1 1>/dev/null`;
|
|
245
|
-
const result = spawnSync('sh', ['-c', script], {
|
|
246
|
-
input: request,
|
|
247
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
248
|
-
env: buildServeEnv(),
|
|
249
|
-
timeout: syncServeTimeoutMs,
|
|
250
|
-
maxBuffer: MAX_PROTOCOL_BYTES + 4096,
|
|
251
|
-
});
|
|
252
|
-
logServeStderr(result.stderr);
|
|
253
|
-
if (result.error) {
|
|
254
|
-
const err = result.error;
|
|
255
|
-
if (err.code === 'ETIMEDOUT') {
|
|
256
|
-
throw new SecretsClientError('TIMEOUT', `the standalone \`secrets\` CLI did not answer within ${Math.round(syncServeTimeoutMs / 1000)}s ` +
|
|
257
|
-
`(${[command, ...prefix, '__serve'].join(' ')}). The machine may be too loaded to boot it in time, or the install is broken: ` +
|
|
258
|
-
'check with `secrets --version`.');
|
|
259
|
-
}
|
|
260
|
-
if (err.code !== 'EPIPE') {
|
|
261
|
-
throw new SecretsClientError('SPAWN_FAILED', `secrets request failed: ${err.message}`);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
const raw = result.stdout ?? Buffer.alloc(0);
|
|
265
|
-
if (raw.length > MAX_PROTOCOL_BYTES) {
|
|
266
|
-
throw new SecretsClientError('RESPONSE_TOO_LARGE', 'secrets response exceeds the protocol limit');
|
|
267
|
-
}
|
|
268
|
-
return parseResponse(raw);
|
|
269
|
-
}
|
|
270
|
-
export async function secretsRequest(op, args = [], context) {
|
|
271
|
-
return (await serveOnce(op, args, context));
|
|
272
|
-
}
|
|
273
|
-
export function secretsRequestSync(op, args = [], context) {
|
|
274
|
-
return serveOnceSync(op, args, context);
|
|
275
|
-
}
|
|
276
|
-
export function _resetSecretsClientForTest() {
|
|
277
|
-
cachedBin = undefined;
|
|
278
|
-
requestCounter = 0;
|
|
279
|
-
syncServeTimeoutMs = SYNC_SERVE_TIMEOUT_MS;
|
|
280
|
-
}
|
|
281
|
-
export function _setSyncServeTimeoutForTest(ms) {
|
|
282
|
-
syncServeTimeoutMs = ms;
|
|
283
|
-
}
|
|
284
|
-
export function readAndResolveBundleEnv(name, opts, context) {
|
|
285
|
-
return secretsRequest('bundles.readAndResolveBundleEnv', [name, opts ?? {}], context);
|
|
286
|
-
}
|
|
287
|
-
export function readAndResolveBundleEnvSync(name, opts, context) {
|
|
288
|
-
return secretsRequestSync('bundles.readAndResolveBundleEnv', [name, opts ?? {}], context);
|
|
289
|
-
}
|
|
290
47
|
export function listBundles(context) {
|
|
291
48
|
return secretsRequest('bundles.listBundles', [], context);
|
|
292
49
|
}
|
|
@@ -389,15 +146,12 @@ export function storeSetSync(backend, item, value) {
|
|
|
389
146
|
export function remoteResolveEnv(target, bundle, opts) {
|
|
390
147
|
return secretsRequest('remote.remoteResolveEnv', [target, bundle, opts ?? {}]);
|
|
391
148
|
}
|
|
392
|
-
|
|
393
|
-
export function withRemoteStateRoot(opts) {
|
|
394
|
-
return { ...opts, remoteSecretsHome: opts.remoteSecretsHome ?? REMOTE_USER_AGENTS_DIR };
|
|
395
|
-
}
|
|
149
|
+
// An unset remoteSecretsHome stays unset so the receiver uses its own default root.
|
|
396
150
|
export function pushBundleToHost(bundle, host, opts) {
|
|
397
|
-
return secretsRequest('push.pushBundleToHost', [bundle, host,
|
|
151
|
+
return secretsRequest('push.pushBundleToHost', [bundle, host, opts]);
|
|
398
152
|
}
|
|
399
153
|
export function pushBundleToHostAsync(bundle, host, opts) {
|
|
400
|
-
return secretsRequest('push.pushBundleToHostAsync', [bundle, host,
|
|
154
|
+
return secretsRequest('push.pushBundleToHostAsync', [bundle, host, opts]);
|
|
401
155
|
}
|
|
402
156
|
export function listRemoteBundles(context) {
|
|
403
157
|
return secretsRequest('sync.listRemoteBundles', [], context);
|
|
@@ -4,6 +4,7 @@ import { type HookSessionIndex } from './hook-sessions.js';
|
|
|
4
4
|
import { type UserPromptKind } from '@phnx-labs/sessions-cli/reader';
|
|
5
5
|
import { type SessionState, type SessionActivity, type AwaitingReason, type StructuredQuestion, type TodoProgress, type DetectedPr, type DetectedWorktree, type DetectedTicket } from '@phnx-labs/sessions-cli/reader';
|
|
6
6
|
import { type SessionAgentId, type SessionAttachment, type SessionFiles, type SessionMeta, type SessionRequest, type SessionTimeline } from '@phnx-labs/sessions-cli/reader';
|
|
7
|
+
import { type ProjectDef } from '../projects.js';
|
|
7
8
|
import { type SessionProvenance } from './provenance.js';
|
|
8
9
|
import { type DeviceRegistry } from '../devices/registry.js';
|
|
9
10
|
import { type Presence } from './detached.js';
|
|
@@ -24,7 +25,7 @@ export declare function backfillActiveRowsFromMeta(sessions: ActiveSession[], me
|
|
|
24
25
|
export declare function sessionAccountLabel(kind: string, session: Pick<SessionMeta, 'accountId' | 'accountKey' | 'account'>, accounts?: import("../account-registry.js").NativeAccount[]): string | undefined;
|
|
25
26
|
export declare function backfillActiveRowsFromIndex(sessions: ActiveSession[]): void;
|
|
26
27
|
export declare function isRunningLiveSession(s: ActiveSession): boolean;
|
|
27
|
-
export declare function activeSessionProjectKey(s: Pick<ActiveSession, 'cwd' | 'context'
|
|
28
|
+
export declare function activeSessionProjectKey(s: Pick<ActiveSession, 'cwd' | 'context'>, defs?: ProjectDef[]): string;
|
|
28
29
|
export type ArtifactKind = 'image' | 'video' | 'html' | 'markdown' | 'pdf' | 'other';
|
|
29
30
|
export type SessionArtifactRow = import('@phnx-labs/sessions-cli/reader').ProducedArtifact & {
|
|
30
31
|
kind?: ArtifactKind;
|
|
@@ -69,6 +70,7 @@ export interface ActiveSession {
|
|
|
69
70
|
sessionId?: string;
|
|
70
71
|
cwd?: string;
|
|
71
72
|
project?: string | null;
|
|
73
|
+
lead?: boolean;
|
|
72
74
|
label?: string;
|
|
73
75
|
name?: string;
|
|
74
76
|
topic?: string;
|
|
@@ -107,6 +109,9 @@ export interface ActiveSession {
|
|
|
107
109
|
tokenCount?: number;
|
|
108
110
|
durationMs?: number;
|
|
109
111
|
subAgentCount?: number;
|
|
112
|
+
pending?: import('./pending-work.js').SessionPendingWork;
|
|
113
|
+
effort?: import('./pending-work.js').SessionEffort;
|
|
114
|
+
fast?: boolean;
|
|
110
115
|
artifacts?: SessionArtifactRow[];
|
|
111
116
|
planFile?: string;
|
|
112
117
|
sessionFile?: string;
|
|
@@ -244,13 +249,6 @@ interface ActiveDiscoveryHealth {
|
|
|
244
249
|
degradedSources: string[];
|
|
245
250
|
}
|
|
246
251
|
export declare function describeActiveDiscoveryHealth(): Promise<ActiveDiscoveryHealth>;
|
|
247
|
-
export declare function isSessionIdLiveOnProcessTable(sessionId: string, deps?: {
|
|
248
|
-
readTable?: () => Promise<Array<{
|
|
249
|
-
pid: number;
|
|
250
|
-
kind?: string;
|
|
251
|
-
}>>;
|
|
252
|
-
sessionIdOf?: (pid: number) => string | undefined;
|
|
253
|
-
}): Promise<boolean>;
|
|
254
252
|
export declare function foldTmuxClients(rows: ActiveSession[]): Promise<void>;
|
|
255
253
|
export declare function foldExecutionMachine(rows: ActiveSession[], machineOf: (sessionId: string) => string | undefined, self: string): void;
|
|
256
254
|
export declare function sessionProcessIsLocal(s: Pick<ActiveSession, 'machine' | 'offloadedFrom'>, self: string): boolean;
|
|
@@ -276,4 +274,16 @@ export declare function matchOriginDevice(clientIp: string, reg: DeviceRegistry)
|
|
|
276
274
|
user?: string;
|
|
277
275
|
} | undefined;
|
|
278
276
|
export declare function dedupeBySession(sessions: ActiveSession[]): ActiveSession[];
|
|
277
|
+
export declare function dedupeByMachineSession(sessions: ActiveSession[], answered: readonly string[]): ActiveSession[];
|
|
278
|
+
export declare function filterActiveSessionsByHostScope(sessions: ActiveSession[], hosts: string[] | undefined, self: string): ActiveSession[];
|
|
279
|
+
export declare function gatherActiveSessions(opts?: {
|
|
280
|
+
local?: boolean;
|
|
281
|
+
hosts?: string[];
|
|
282
|
+
forceRefresh?: boolean;
|
|
283
|
+
}): Promise<{
|
|
284
|
+
sessions: ActiveSession[];
|
|
285
|
+
remoteDeviceCount: number;
|
|
286
|
+
remoteSkipped?: string[];
|
|
287
|
+
remoteDiscoveryFailed?: boolean;
|
|
288
|
+
}>;
|
|
279
289
|
export {};
|