@phnx-labs/agents-cli 1.22.121 → 1.22.123
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 +316 -0
- package/README.md +53 -53
- package/dist/bootstrap.js +22 -17
- package/dist/cli/command-registry.d.ts +0 -1
- package/dist/cli/command-registry.js +2 -12
- package/dist/commands/auth.js +13 -4
- package/dist/commands/browser.js +3 -4
- package/dist/commands/cloud-transcripts.d.ts +7 -0
- package/dist/commands/cloud-transcripts.js +100 -0
- package/dist/commands/cloud.js +5 -0
- package/dist/commands/computer.d.ts +0 -12
- package/dist/commands/computer.js +14 -124
- package/dist/commands/config.js +5 -4
- package/dist/commands/daemon-index.d.ts +2 -0
- package/dist/commands/daemon-index.js +44 -0
- package/dist/commands/daemon.js +13 -8
- package/dist/commands/doctor.js +3 -4
- package/dist/commands/exec.d.ts +5 -0
- package/dist/commands/exec.js +35 -7
- package/dist/commands/feed-watch.js +12 -0
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +7 -4
- package/dist/commands/insights.js +3 -1
- package/dist/commands/inspect.js +1 -1
- package/dist/commands/logs.js +2 -1
- package/dist/commands/mailboxes.js +1 -1
- package/dist/commands/models.js +1 -1
- package/dist/commands/projects.js +3 -3
- package/dist/commands/prune.js +6 -28
- package/dist/commands/ps-roster.d.ts +0 -1
- package/dist/commands/ps-roster.js +2 -21
- package/dist/commands/ps.js +13 -1
- package/dist/commands/recordings.d.ts +2 -0
- package/dist/commands/recordings.js +117 -0
- package/dist/commands/routines.js +1 -1
- package/dist/commands/secrets-passthrough.js +3 -3
- package/dist/commands/send.js +33 -20
- package/dist/commands/sessions-backfill.d.ts +1 -0
- package/dist/commands/sessions-backfill.js +48 -13
- package/dist/commands/sessions-migrate.d.ts +1 -1
- package/dist/commands/sessions-migrate.js +11 -10
- package/dist/commands/sessions-optimize.d.ts +1 -0
- package/dist/commands/sessions-optimize.js +7 -4
- package/dist/commands/sessions-resume.js +8 -1
- package/dist/commands/sessions-stats.d.ts +2 -0
- package/dist/commands/sessions-stats.js +24 -7
- package/dist/commands/sessions.d.ts +5 -11
- package/dist/commands/sessions.js +8 -236
- package/dist/commands/setup-computer.js +1 -2
- package/dist/commands/setup-mine.js +0 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/sync.js +101 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/testdata/feed-hub.js +11 -0
- package/dist/commands/trash.d.ts +0 -1
- package/dist/commands/trash.js +74 -10
- package/dist/lib/accounting/usage-sync.js +7 -0
- package/dist/lib/agent-modes.d.ts +1 -1
- package/dist/lib/agent-modes.js +11 -5
- package/dist/lib/auth-mint.d.ts +4 -0
- package/dist/lib/auth-mint.js +6 -4
- package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
- package/dist/lib/browser/native-history.test-fixture.js +43 -0
- package/dist/lib/browser/paths.d.ts +5 -0
- package/dist/lib/browser/paths.js +7 -1
- package/dist/lib/browser/sessions-list.d.ts +28 -1
- package/dist/lib/browser/sessions-list.js +137 -25
- package/dist/lib/channels/providers/rush.d.ts +2 -1
- package/dist/lib/channels/providers/rush.js +2 -2
- package/dist/lib/channels/providers/session.d.ts +1 -0
- package/dist/lib/channels/providers/session.js +23 -12
- package/dist/lib/channels/registry.d.ts +9 -2
- package/dist/lib/channels/send.d.ts +5 -10
- package/dist/lib/channels/send.js +88 -50
- package/dist/lib/cloud/rush.d.ts +6 -0
- package/dist/lib/cloud/rush.js +18 -3
- package/dist/lib/computer-client.d.ts +19 -0
- package/dist/lib/computer-client.js +104 -0
- package/dist/lib/config-keys.d.ts +5 -1
- package/dist/lib/config-keys.js +14 -11
- package/dist/lib/daemon/auth-sync-service.js +13 -0
- package/dist/lib/daemon/daemon.js +20 -23
- package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
- package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
- package/dist/lib/daemon-services.d.ts +2 -1
- package/dist/lib/daemon-services.js +17 -10
- package/dist/lib/daemon-webhooks.d.ts +1 -1
- package/dist/lib/daemon-webhooks.js +1 -1
- package/dist/lib/device-config.d.ts +4 -1
- package/dist/lib/device-config.js +58 -8
- package/dist/lib/devices/doctor-findings.d.ts +2 -3
- package/dist/lib/devices/doctor-findings.js +10 -19
- package/dist/lib/event-provenance.d.ts +1 -0
- package/dist/lib/event-provenance.js +2 -0
- package/dist/lib/exec.d.ts +1 -0
- package/dist/lib/exec.js +20 -15
- package/dist/lib/feed/pr-status.d.ts +5 -1
- package/dist/lib/feed/pr-status.js +44 -3
- package/dist/lib/feed/tool-activity.js +9 -6
- package/dist/lib/feed/tools.d.ts +4 -1
- package/dist/lib/feed/tools.js +8 -11
- package/dist/lib/feed-broadcast.d.ts +5 -3
- package/dist/lib/feed-broadcast.js +47 -36
- package/dist/lib/fleet-shared-state.d.ts +5 -0
- package/dist/lib/fleet-shared-state.js +8 -0
- package/dist/lib/github/project-prs.d.ts +4 -1
- package/dist/lib/github/project-prs.js +20 -7
- package/dist/lib/help.d.ts +1 -0
- package/dist/lib/help.js +8 -0
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/passthrough.js +5 -9
- package/dist/lib/hosts/remote-cmd.d.ts +2 -7
- package/dist/lib/hosts/remote-cmd.js +14 -22
- package/dist/lib/hosts/routing-flag.d.ts +22 -0
- package/dist/lib/hosts/routing-flag.js +127 -14
- package/dist/lib/identity/index.d.ts +22 -0
- package/dist/lib/identity/index.js +3 -0
- package/dist/lib/installations/migrate.d.ts +7 -0
- package/dist/lib/installations/migrate.js +99 -88
- package/dist/lib/installations/versions.js +2 -2
- package/dist/lib/launch-identity.d.ts +6 -1
- package/dist/lib/launch-identity.js +12 -2
- package/dist/lib/menubar/install-menubar.d.ts +1 -0
- package/dist/lib/menubar/install-menubar.js +8 -5
- package/dist/lib/menubar/snapshot.js +2 -3
- package/dist/lib/notify.d.ts +7 -14
- package/dist/lib/notify.js +29 -75
- package/dist/lib/owner-message.d.ts +4 -6
- package/dist/lib/owner-message.js +12 -11
- package/dist/lib/owner-notify-tokens.d.ts +49 -0
- package/dist/lib/owner-notify-tokens.js +214 -0
- package/dist/lib/owner-notify.d.ts +75 -0
- package/dist/lib/owner-notify.js +144 -0
- package/dist/lib/plugins/plugins.d.ts +7 -1
- package/dist/lib/plugins/plugins.js +26 -5
- package/dist/lib/pr-land-detach.js +2 -2
- package/dist/lib/recordings/config.d.ts +11 -0
- package/dist/lib/recordings/config.js +54 -0
- package/dist/lib/recordings/identity.d.ts +12 -0
- package/dist/lib/recordings/identity.js +57 -0
- package/dist/lib/recordings/ledger.d.ts +16 -0
- package/dist/lib/recordings/ledger.js +141 -0
- package/dist/lib/recordings/model.d.ts +29 -0
- package/dist/lib/recordings/model.js +28 -0
- package/dist/lib/recordings/pipeline.d.ts +44 -0
- package/dist/lib/recordings/pipeline.js +272 -0
- package/dist/lib/recordings/process.d.ts +17 -0
- package/dist/lib/recordings/process.js +94 -0
- package/dist/lib/recordings/service.d.ts +15 -0
- package/dist/lib/recordings/service.js +45 -0
- package/dist/lib/recordings/settle.d.ts +21 -0
- package/dist/lib/recordings/settle.js +92 -0
- package/dist/lib/recordings/transcode.d.ts +13 -0
- package/dist/lib/recordings/transcode.js +44 -0
- package/dist/lib/refresh.js +4 -1
- package/dist/lib/reminders.d.ts +0 -1
- package/dist/lib/reminders.js +1 -1
- package/dist/lib/reserved-stores.d.ts +3 -0
- package/dist/lib/reserved-stores.js +13 -0
- package/dist/lib/routine-notify-owner.d.ts +3 -23
- package/dist/lib/routine-notify-owner.js +26 -107
- package/dist/lib/rush-api.d.ts +1 -0
- package/dist/lib/rush-api.js +1 -0
- package/dist/lib/scheduling/routines.d.ts +1 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/session/active.d.ts +18 -2
- package/dist/lib/session/active.js +47 -37
- package/dist/lib/session/cloud.js +18 -45
- package/dist/lib/session/db.d.ts +3 -1
- package/dist/lib/session/db.js +64 -32
- package/dist/lib/session/glance-files.d.ts +4 -3
- package/dist/lib/session/glance-files.js +31 -0
- package/dist/lib/session/inject-target.js +12 -2
- package/dist/lib/session/pid-registry.d.ts +2 -0
- package/dist/lib/session/pid-registry.js +6 -2
- package/dist/lib/session/presentation.d.ts +21 -0
- package/dist/lib/session/presentation.js +198 -0
- package/dist/lib/session/projection.js +9 -2
- package/dist/lib/sqlite.d.ts +3 -1
- package/dist/lib/sqlite.js +7 -3
- package/dist/lib/staleness/index.js +12 -0
- package/dist/lib/staleness/types.d.ts +5 -0
- package/dist/lib/standalone-tools.js +1 -1
- package/dist/lib/startup/command-registry.js +10 -5
- package/dist/lib/state.d.ts +2 -5
- package/dist/lib/state.js +3 -11
- package/dist/lib/sync-delete.d.ts +21 -0
- package/dist/lib/sync-delete.js +113 -0
- package/dist/lib/terminal/inject.js +1 -1
- package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
- package/dist/lib/testdata/owner-notify-api.js +102 -0
- package/dist/lib/trash.d.ts +14 -0
- package/dist/lib/trash.js +75 -0
- package/dist/lib/types.d.ts +0 -34
- package/package.json +1 -3
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -68
- package/dist/commands/humans.d.ts +0 -2
- package/dist/commands/humans.js +0 -83
- package/dist/commands/modes.d.ts +0 -2
- package/dist/commands/modes.js +0 -134
- package/dist/commands/monitors.d.ts +0 -2
- package/dist/commands/monitors.js +0 -1070
- package/dist/commands/reminders.d.ts +0 -2
- package/dist/commands/reminders.js +0 -49
- package/dist/lib/channels/owner-forward.d.ts +0 -25
- package/dist/lib/channels/owner-forward.js +0 -78
- package/dist/lib/channels/owner-sink.d.ts +0 -10
- package/dist/lib/channels/owner-sink.js +0 -26
- package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
- package/dist/lib/daemon/monitor-engine-service.js +0 -25
- package/dist/lib/humans.d.ts +0 -12
- package/dist/lib/humans.js +0 -64
- package/dist/lib/monitors/config.d.ts +0 -77
- package/dist/lib/monitors/config.js +0 -405
- package/dist/lib/monitors/dispatch.d.ts +0 -10
- package/dist/lib/monitors/dispatch.js +0 -72
- package/dist/lib/monitors/engine.d.ts +0 -45
- package/dist/lib/monitors/engine.js +0 -243
- package/dist/lib/monitors/fingerprint.d.ts +0 -3
- package/dist/lib/monitors/fingerprint.js +0 -43
- package/dist/lib/monitors/pid-watch.d.ts +0 -4
- package/dist/lib/monitors/pid-watch.js +0 -14
- package/dist/lib/monitors/remote.d.ts +0 -31
- package/dist/lib/monitors/remote.js +0 -63
- package/dist/lib/monitors/sources/command.d.ts +0 -4
- package/dist/lib/monitors/sources/command.js +0 -20
- package/dist/lib/monitors/sources/device.d.ts +0 -3
- package/dist/lib/monitors/sources/device.js +0 -31
- package/dist/lib/monitors/sources/failure.d.ts +0 -5
- package/dist/lib/monitors/sources/failure.js +0 -25
- package/dist/lib/monitors/sources/file.d.ts +0 -4
- package/dist/lib/monitors/sources/file.js +0 -46
- package/dist/lib/monitors/sources/http.d.ts +0 -3
- package/dist/lib/monitors/sources/http.js +0 -25
- package/dist/lib/monitors/sources/index.d.ts +0 -5
- package/dist/lib/monitors/sources/index.js +0 -22
- package/dist/lib/monitors/sources/poll.d.ts +0 -1
- package/dist/lib/monitors/sources/poll.js +0 -1
- package/dist/lib/monitors/sources/types.d.ts +0 -9
- package/dist/lib/monitors/sources/webhook.d.ts +0 -3
- package/dist/lib/monitors/sources/webhook.js +0 -3
- package/dist/lib/monitors/sources/ws.d.ts +0 -4
- package/dist/lib/monitors/sources/ws.js +0 -35
- package/dist/lib/monitors/state.d.ts +0 -51
- package/dist/lib/monitors/state.js +0 -221
- /package/dist/{lib/monitors/sources/types.js → commands/testdata/feed-hub.d.ts} +0 -0
|
@@ -50,10 +50,23 @@ export function reservedStoreName(harness) {
|
|
|
50
50
|
throw new Error(`No reserved store for '${harness}'.`);
|
|
51
51
|
return name;
|
|
52
52
|
}
|
|
53
|
+
const OWNER_NOTIFY_STORE_PREFIX = '__notify-';
|
|
54
|
+
const OWNER_NOTIFY_STORE_PATTERN = /^__notify-[a-z0-9._-]{1,37}__$/;
|
|
55
|
+
export const OWNER_NOTIFY_TOKEN_KEY = 'PHOENIX_DEVICE_TOKEN';
|
|
56
|
+
export function canHoldOwnerNotifyToken(device) {
|
|
57
|
+
return OWNER_NOTIFY_STORE_PATTERN.test(`${OWNER_NOTIFY_STORE_PREFIX}${device.trim().toLowerCase()}__`);
|
|
58
|
+
}
|
|
59
|
+
export function ownerNotifyStoreName(device) {
|
|
60
|
+
if (!canHoldOwnerNotifyToken(device))
|
|
61
|
+
throw new Error(`Device name '${device}' is too long or malformed to key an owner-notify token store (37 characters max).`);
|
|
62
|
+
return `${OWNER_NOTIFY_STORE_PREFIX}${device.trim().toLowerCase()}__`;
|
|
63
|
+
}
|
|
53
64
|
export function isReservedStoreName(name) {
|
|
54
65
|
const n = name.trim().toLowerCase();
|
|
55
66
|
if (n === AUTH_STORE_ALIAS)
|
|
56
67
|
return true;
|
|
68
|
+
if (OWNER_NOTIFY_STORE_PATTERN.test(n))
|
|
69
|
+
return true;
|
|
57
70
|
return AGENT_IDS.some((id) => RESERVED_STORES[id].toLowerCase() === n);
|
|
58
71
|
}
|
|
59
72
|
// Only durable setup tokens/API keys are portable; rotating OAuth and session credentials stay device-local.
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import type { Meta } from './types.js';
|
|
2
1
|
import type { JobConfig, RunMeta } from './scheduling/routines.js';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
channel: string;
|
|
7
|
-
to: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function ownerFailureDeliveryPlan(meta: Meta): OwnerDest[];
|
|
10
|
-
interface OwnerDeliveryAttempt {
|
|
11
|
-
channel: string;
|
|
12
|
-
ok: boolean;
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
interface OwnerDeliveryResult {
|
|
16
|
-
delivered: boolean;
|
|
17
|
-
channel?: string;
|
|
18
|
-
attempts: OwnerDeliveryAttempt[];
|
|
19
|
-
}
|
|
20
|
-
export declare function deliverOwnerFailure(text: string, meta: Meta): Promise<OwnerDeliveryResult>;
|
|
21
|
-
export declare function __resetOwnerFailureDedup(): void;
|
|
22
|
-
export declare function notifyOwnerRoutineFinish(meta: RunMeta): Promise<OwnerDeliveryResult>;
|
|
23
|
-
export declare function notifyOwnerRoutineStartFailed(config: JobConfig, error: string): Promise<OwnerDeliveryResult>;
|
|
24
|
-
export {};
|
|
2
|
+
import { type OwnerNotifyResult } from './owner-notify.js';
|
|
3
|
+
export declare function notifyOwnerRoutineFinish(meta: RunMeta): Promise<OwnerNotifyResult | null>;
|
|
4
|
+
export declare function notifyOwnerRoutineStartFailed(config: JobConfig, error: string, scheduledFor?: Date): Promise<OwnerNotifyResult>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as os from 'os';
|
|
2
2
|
import { routineKind } from './routine-notify.js';
|
|
3
|
-
import {
|
|
4
|
-
import { getOwnerFromHumans } from './humans.js';
|
|
5
|
-
import { readOwnerDest } from './channels/send.js';
|
|
6
|
-
import { registerBuiltinProviders } from './channels/providers/index.js';
|
|
7
|
-
import { lookupTransport } from './channels/resolve.js';
|
|
8
|
-
const TELEGRAM_TRANSPORTS = new Set(['telegram', 'openclaw-telegram']);
|
|
3
|
+
import { postOwnerNotification } from './owner-notify.js';
|
|
9
4
|
function routineLabel(r) {
|
|
10
5
|
const kind = routineKind(r);
|
|
11
6
|
if (kind === 'command')
|
|
@@ -21,110 +16,34 @@ function failureReason(meta) {
|
|
|
21
16
|
return meta.errorMessage;
|
|
22
17
|
return `Exited with code ${meta.exitCode ?? '?'}`;
|
|
23
18
|
}
|
|
24
|
-
|
|
19
|
+
function routineFinishOwnerText(meta, host) {
|
|
25
20
|
if (meta.status !== 'failed' && meta.status !== 'timeout')
|
|
26
21
|
return null;
|
|
27
|
-
return
|
|
22
|
+
return `${failureReason(meta)}\n${routineLabel(meta)} · ${host}`;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
return
|
|
24
|
+
function routineStartFailedOwnerText(config, error, host) {
|
|
25
|
+
return `${error}\n${routineLabel(config)} · ${host}`;
|
|
31
26
|
}
|
|
32
|
-
function isTelegramChannel(channelId, meta, humansTransport) {
|
|
33
|
-
if (channelId.trim().toLowerCase() === 'telegram')
|
|
34
|
-
return true;
|
|
35
|
-
if (humansTransport && TELEGRAM_TRANSPORTS.has(humansTransport.trim().toLowerCase())) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
const transport = meta.notify?.transports?.[channelId] ?? channelId;
|
|
39
|
-
return TELEGRAM_TRANSPORTS.has(transport.trim().toLowerCase());
|
|
40
|
-
}
|
|
41
|
-
export function ownerFailureDeliveryPlan(meta) {
|
|
42
|
-
const plan = [];
|
|
43
|
-
const seen = new Set();
|
|
44
|
-
const ownerChannels = getOwnerFromHumans()?.channels ?? [];
|
|
45
|
-
const byId = new Map(ownerChannels.map((ch) => [ch.id, ch]));
|
|
46
|
-
const push = (channel, to) => {
|
|
47
|
-
const c = channel?.trim();
|
|
48
|
-
const t = to?.trim();
|
|
49
|
-
if (!c || !t)
|
|
50
|
-
return;
|
|
51
|
-
const entry = byId.get(c);
|
|
52
|
-
if (entry?.intrusive)
|
|
53
|
-
return;
|
|
54
|
-
if (isTelegramChannel(c, meta, entry?.transport))
|
|
55
|
-
return;
|
|
56
|
-
const key = `${c} ${t}`;
|
|
57
|
-
if (seen.has(key))
|
|
58
|
-
return;
|
|
59
|
-
seen.add(key);
|
|
60
|
-
plan.push({ channel: c, to: t });
|
|
61
|
-
};
|
|
62
|
-
const primary = readOwnerDest(meta);
|
|
63
|
-
if (primary)
|
|
64
|
-
push(primary.channel, primary.to);
|
|
65
|
-
for (const ch of ownerChannels) {
|
|
66
|
-
push(ch.id, ch.to);
|
|
67
|
-
}
|
|
68
|
-
return plan;
|
|
69
|
-
}
|
|
70
|
-
export async function deliverOwnerFailure(text, meta) {
|
|
71
|
-
const plan = ownerFailureDeliveryPlan(meta);
|
|
72
|
-
const attempts = [];
|
|
73
|
-
if (plan.length === 0)
|
|
74
|
-
return { delivered: false, attempts };
|
|
75
|
-
registerBuiltinProviders();
|
|
76
|
-
for (const dest of plan) {
|
|
77
|
-
const { provider, error } = lookupTransport(dest.channel, meta);
|
|
78
|
-
if (!provider) {
|
|
79
|
-
attempts.push({ channel: dest.channel, ok: false, error });
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
try {
|
|
83
|
-
const result = await provider.send(text, {
|
|
84
|
-
target: dest.to,
|
|
85
|
-
from: 'routines',
|
|
86
|
-
ownerScoped: true,
|
|
87
|
-
});
|
|
88
|
-
attempts.push({ channel: dest.channel, ok: result.ok, error: result.error });
|
|
89
|
-
if (result.ok)
|
|
90
|
-
return { delivered: true, channel: dest.channel, attempts };
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
attempts.push({ channel: dest.channel, ok: false, error: err.message });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return { delivered: false, attempts };
|
|
97
|
-
}
|
|
98
|
-
const notifiedFailures = new Set();
|
|
99
|
-
const MAX_DEDUP_KEYS = 1000;
|
|
100
|
-
function claimFailureKey(key) {
|
|
101
|
-
if (notifiedFailures.has(key))
|
|
102
|
-
return false;
|
|
103
|
-
if (notifiedFailures.size >= MAX_DEDUP_KEYS)
|
|
104
|
-
notifiedFailures.clear();
|
|
105
|
-
notifiedFailures.add(key);
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
function releaseFailureKey(key) {
|
|
109
|
-
notifiedFailures.delete(key);
|
|
110
|
-
}
|
|
111
|
-
export function __resetOwnerFailureDedup() {
|
|
112
|
-
notifiedFailures.clear();
|
|
113
|
-
}
|
|
114
|
-
const NO_DELIVERY = { delivered: false, attempts: [] };
|
|
115
27
|
export async function notifyOwnerRoutineFinish(meta) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
28
|
+
const host = os.hostname();
|
|
29
|
+
const body = routineFinishOwnerText(meta, host);
|
|
30
|
+
if (!body)
|
|
31
|
+
return null;
|
|
32
|
+
return postOwnerNotification({
|
|
33
|
+
event: 'failed',
|
|
34
|
+
title: `Routine failed: ${meta.jobName}`,
|
|
35
|
+
body,
|
|
36
|
+
dedupKey: `routine:${meta.jobName}:${meta.runId}`,
|
|
37
|
+
source: { device: host, agent: 'routines' },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export async function notifyOwnerRoutineStartFailed(config, error, scheduledFor = new Date()) {
|
|
41
|
+
const host = os.hostname();
|
|
42
|
+
return postOwnerNotification({
|
|
43
|
+
event: 'failed',
|
|
44
|
+
title: `Routine failed to start: ${config.name}`,
|
|
45
|
+
body: routineStartFailedOwnerText(config, error, host),
|
|
46
|
+
dedupKey: `routine-start:${config.name}:${scheduledFor.toISOString()}`,
|
|
47
|
+
source: { device: host, agent: 'routines' },
|
|
48
|
+
});
|
|
130
49
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RUSH_API_BASE: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RUSH_API_BASE = process.env.RUSH_PROXY_BASE ?? 'https://api.prix.dev';
|
|
@@ -103,7 +103,7 @@ export interface JobConfig {
|
|
|
103
103
|
loop?: LoopConfig;
|
|
104
104
|
actor?: string;
|
|
105
105
|
projects?: string[];
|
|
106
|
-
dispatchedBy?: '
|
|
106
|
+
dispatchedBy?: 'webhook';
|
|
107
107
|
}
|
|
108
108
|
export declare function normalizeProjects(projects: string[] | undefined): string[] | undefined;
|
|
109
109
|
type ProjectGroup = {
|
|
@@ -496,7 +496,7 @@ export function readJobFileResult(filePath) {
|
|
|
496
496
|
return { config: null, problem: '`devices:` must be a list — routine is inert' };
|
|
497
497
|
}
|
|
498
498
|
if (Object.prototype.hasOwnProperty.call(parsed, 'dispatchedBy')) {
|
|
499
|
-
return { config: null, problem: '`dispatchedBy:` is a runtime-only
|
|
499
|
+
return { config: null, problem: '`dispatchedBy:` is a runtime-only webhook marker, not a routine field — routine is inert' };
|
|
500
500
|
}
|
|
501
501
|
return {
|
|
502
502
|
config: {
|
|
@@ -41,6 +41,20 @@ export interface SessionImportantMessage {
|
|
|
41
41
|
text: string;
|
|
42
42
|
kind: ImportantMessageKind;
|
|
43
43
|
}
|
|
44
|
+
export interface PrCheckItem {
|
|
45
|
+
name: string;
|
|
46
|
+
state: 'passed' | 'failed' | 'running' | 'skipped';
|
|
47
|
+
url?: string;
|
|
48
|
+
}
|
|
49
|
+
export type SessionPr = DetectedPr & {
|
|
50
|
+
headSha?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
checkItems?: PrCheckItem[];
|
|
53
|
+
};
|
|
54
|
+
export type WatchSubagent = import('@phnx-labs/sessions-cli/reader').SessionSubagent & {
|
|
55
|
+
model?: string;
|
|
56
|
+
prompt?: string;
|
|
57
|
+
};
|
|
44
58
|
export interface ActiveSession {
|
|
45
59
|
context: ActiveContext;
|
|
46
60
|
kind: string;
|
|
@@ -68,14 +82,14 @@ export interface ActiveSession {
|
|
|
68
82
|
failures?: import('@phnx-labs/sessions-cli/reader').SessionFailure[];
|
|
69
83
|
activityHistogram?: import('@phnx-labs/sessions-cli/reader').SessionActivityHistogram;
|
|
70
84
|
userTurns?: import('@phnx-labs/sessions-cli/reader').SessionUserTurn[];
|
|
71
|
-
subagents?:
|
|
85
|
+
subagents?: WatchSubagent[];
|
|
72
86
|
tokPerSec?: number;
|
|
73
87
|
awaitingReason?: AwaitingReason;
|
|
74
88
|
question?: StructuredQuestion;
|
|
75
89
|
plan?: string;
|
|
76
90
|
todos?: TodoProgress;
|
|
77
91
|
tail?: string[];
|
|
78
|
-
pr?:
|
|
92
|
+
pr?: SessionPr;
|
|
79
93
|
worktree?: DetectedWorktree;
|
|
80
94
|
ticket?: DetectedTicket;
|
|
81
95
|
rateLimited?: boolean;
|
|
@@ -128,6 +142,7 @@ export interface ActiveSession {
|
|
|
128
142
|
tab?: number;
|
|
129
143
|
};
|
|
130
144
|
terminalId?: string;
|
|
145
|
+
originTerminal?: import('../launch-identity.js').LaunchOrigin;
|
|
131
146
|
tabIndex?: number;
|
|
132
147
|
launchId?: string;
|
|
133
148
|
paneId?: string;
|
|
@@ -165,6 +180,7 @@ export declare function sessionFileTimes(sessionFile: string | undefined): {
|
|
|
165
180
|
export declare function lifecycleStatus(pidAlive: boolean, mtimeMs: number | undefined, nowMs?: number): ActiveStatus | undefined;
|
|
166
181
|
export declare function resolveFallbackStatus(sessionFile: string | undefined, pidAlive: boolean, nowMs?: number): ActiveStatus;
|
|
167
182
|
export declare function findSessionFileForKind(kind: string, cwd?: string, sessionId?: string): string | undefined;
|
|
183
|
+
export declare function sessionIdFromFile(kind: string, file?: string): string | undefined;
|
|
168
184
|
interface LiveSignals {
|
|
169
185
|
state?: SessionState;
|
|
170
186
|
tokPerSec?: number;
|
|
@@ -14,7 +14,7 @@ import { readSessionActorRecord, writeSessionAliasRecord } from './actor-sidecar
|
|
|
14
14
|
import { loadHookSessionIndex, resolveHookSessionRecord, readStateSessionRecord } from './hook-sessions.js';
|
|
15
15
|
import { buildClaudeLabelMap, getAgentSessionDirs } from './discover.js';
|
|
16
16
|
import { buildRunNameMap } from './run-names.js';
|
|
17
|
-
import { latestSessionFileForCwd, findSessionsByShortIds, findSessionMachinesByIds, getSessionById } from './db.js';
|
|
17
|
+
import { latestSessionFileForCwd, indexedSessionIdForFile, findSessionsByShortIds, findSessionMachinesByIds, getSessionById } from './db.js';
|
|
18
18
|
import { extractSessionTopic, classifyUserPrompt, tidyRequest } from '@phnx-labs/sessions-cli/reader';
|
|
19
19
|
import { readSessionTailWithRaw } from '@phnx-labs/sessions-cli/reader';
|
|
20
20
|
import { parseSession } from '@phnx-labs/sessions-cli/reader';
|
|
@@ -344,16 +344,17 @@ function readLiveTerminals() {
|
|
|
344
344
|
const windowHeartbeatMs = Number.isFinite(at) ? at : undefined;
|
|
345
345
|
const windowGone = windowHeartbeatMs !== undefined && now - windowHeartbeatMs >= HOST_HEARTBEAT_STALE_MS;
|
|
346
346
|
for (const e of (slice?.entries ?? [])) {
|
|
347
|
-
|
|
347
|
+
const key = e?.sessionId || (e?.terminalId ? `terminal\0${e.terminalId}` : undefined);
|
|
348
|
+
if (!key)
|
|
348
349
|
continue;
|
|
349
350
|
const alive = isPidAlive(e.pid, e.startedAtMs);
|
|
350
351
|
if (!alive && !windowGone)
|
|
351
352
|
continue;
|
|
352
|
-
const entry = { ...e, windowId, windowHeartbeatMs, pidDead: !alive };
|
|
353
|
-
const prev = merged.get(
|
|
353
|
+
const entry = { ...e, sessionId: e.sessionId || undefined, windowId, windowHeartbeatMs, pidDead: !alive };
|
|
354
|
+
const prev = merged.get(key);
|
|
354
355
|
if (prev && !prev.pidDead && !alive)
|
|
355
356
|
continue;
|
|
356
|
-
merged.set(
|
|
357
|
+
merged.set(key, entry);
|
|
357
358
|
}
|
|
358
359
|
}
|
|
359
360
|
return Array.from(merged.values());
|
|
@@ -465,10 +466,12 @@ function indexedSessionFileForId(kind, sessionId) {
|
|
|
465
466
|
return row.filePath || undefined;
|
|
466
467
|
}
|
|
467
468
|
const UUID_RE = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
468
|
-
function sessionIdFromFile(file) {
|
|
469
|
+
export function sessionIdFromFile(kind, file) {
|
|
469
470
|
if (!file)
|
|
470
471
|
return undefined;
|
|
471
|
-
|
|
472
|
+
if (kind === 'claude')
|
|
473
|
+
return path.basename(file).match(UUID_RE)?.[0];
|
|
474
|
+
return indexedSessionIdForFile(kind, file);
|
|
472
475
|
}
|
|
473
476
|
const LIVE_STATE_MAX_EVENTS = 80;
|
|
474
477
|
function parseTailEventsForKind(agent, sessionFile) {
|
|
@@ -639,7 +642,7 @@ export async function listTeamsActive(opts = {}) {
|
|
|
639
642
|
const topic = sessionFile ? quickExtractTopic(sessionFile) : undefined;
|
|
640
643
|
const pidAlive = a.pid ? isPidAlive(a.pid) : true;
|
|
641
644
|
const { state, tokPerSec } = computeLiveSignals(a.agentType, sessionFile, a.cwd ?? undefined, pidAlive);
|
|
642
|
-
const resolvedId = ownSessionId ?? sessionIdFromFile(sessionFile);
|
|
645
|
+
const resolvedId = ownSessionId ?? sessionIdFromFile(a.agentType, sessionFile);
|
|
643
646
|
const execHost = a.hostName ? normalizeHost(a.hostName) : undefined;
|
|
644
647
|
const offloaded = execHost !== undefined && execHost !== self;
|
|
645
648
|
return applyState({
|
|
@@ -675,7 +678,7 @@ export async function listTerminalsActive() {
|
|
|
675
678
|
const children = childrenByParent(new Map([...procByPid.values()].map(r => [r.pid, r.ppid])));
|
|
676
679
|
const labelMap = buildClaudeLabelMap();
|
|
677
680
|
const runNameMap = buildRunNameMap();
|
|
678
|
-
return entries.
|
|
681
|
+
return entries.flatMap((t) => {
|
|
679
682
|
const directEntry = readPidSessionEntry(t.pid, procByPid.get(t.pid)?.startTime);
|
|
680
683
|
const candidate = directEntry?.sessionId ? directEntry
|
|
681
684
|
: (!t.pidDead ? terminalDescendantEntry(t.pid, procByPid, children) : undefined) ?? directEntry;
|
|
@@ -683,35 +686,38 @@ export async function listTerminalsActive() {
|
|
|
683
686
|
const resolvedId = pidEntry?.sessionId ?? t.sessionId;
|
|
684
687
|
const cwd = pidEntry?.cwd ?? t.cwd ?? undefined;
|
|
685
688
|
const sessionKind = pidEntry?.agent ?? t.kind;
|
|
686
|
-
|
|
689
|
+
if (!resolvedId && !isSessionTrackedAgent(sessionKind))
|
|
690
|
+
return [];
|
|
691
|
+
const sessionFile = resolvedId ? findSessionFileForKind(sessionKind, cwd, resolvedId) : undefined;
|
|
687
692
|
const label = t.label ?? (resolvedId ? labelMap.get(resolvedId) : undefined) ?? undefined;
|
|
688
693
|
const name = resolvedId ? runNameMap.get(resolvedId) ?? undefined : undefined;
|
|
689
694
|
const topic = sessionFile ? quickExtractTopic(sessionFile) : undefined;
|
|
690
695
|
const pidAlive = isPidAlive(t.pid, t.startedAtMs);
|
|
691
696
|
const { state, tokPerSec } = computeLiveSignals(sessionKind, sessionFile, cwd, pidAlive);
|
|
692
|
-
return applyState({
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
697
|
+
return [applyState({
|
|
698
|
+
context: 'terminal',
|
|
699
|
+
kind: sessionKind,
|
|
700
|
+
harness: pidEntry?.harness,
|
|
701
|
+
host: detectHost(t.pid, procByPid),
|
|
702
|
+
tty: procByPid.get(t.pid)?.tty,
|
|
703
|
+
pid: t.pid,
|
|
704
|
+
sessionId: resolvedId ?? sessionIdFromFile(sessionKind, sessionFile),
|
|
705
|
+
launchId: pidEntry?.launchId,
|
|
706
|
+
terminalId: pidEntry?.terminalId ?? t.terminalId,
|
|
707
|
+
originTerminal: pidEntry?.originTerminal,
|
|
708
|
+
tabIndex: t.tabIndex,
|
|
709
|
+
cwd,
|
|
710
|
+
label,
|
|
711
|
+
name,
|
|
712
|
+
topic,
|
|
713
|
+
tokPerSec,
|
|
714
|
+
sessionFile,
|
|
715
|
+
startedAtMs: pidEntry?.startedAtMs ?? t.startedAtMs,
|
|
716
|
+
lastActivityMs: sessionFileTimes(sessionFile).mtimeMs,
|
|
717
|
+
windowId: t.windowId,
|
|
718
|
+
windowHeartbeatMs: t.windowHeartbeatMs,
|
|
719
|
+
owner: resolveOwner(pidEntry?.actor, resolvedId),
|
|
720
|
+
}, state, sessionFile, pidAlive)];
|
|
715
721
|
});
|
|
716
722
|
}
|
|
717
723
|
function listCloudActive() {
|
|
@@ -871,6 +877,8 @@ export function resolveCwds(pids, probe = getCwdForPid) {
|
|
|
871
877
|
async function getCwdForPid(pid) {
|
|
872
878
|
if (process.platform === 'win32')
|
|
873
879
|
return undefined;
|
|
880
|
+
if (process.platform === 'linux')
|
|
881
|
+
return fs.promises.readlink(`/proc/${pid}/cwd`).catch(() => undefined);
|
|
874
882
|
let out;
|
|
875
883
|
try {
|
|
876
884
|
const res = await execFileAsync('lsof', ['-a', '-p', String(pid), '-d', 'cwd', '-Fn'], {
|
|
@@ -1052,7 +1060,7 @@ async function listUnattributedActiveLive(attributed) {
|
|
|
1052
1060
|
const context = host && UI_HOSTS.has(host) ? 'terminal' : 'headless';
|
|
1053
1061
|
const { state, tokPerSec } = computeLiveSignals(kind, sessionFile, cwd, true);
|
|
1054
1062
|
const { birthtimeMs, mtimeMs } = sessionFileTimes(sessionFile);
|
|
1055
|
-
const resolvedId = exactId ?? sessionIdFromFile(sessionFile);
|
|
1063
|
+
const resolvedId = exactId ?? sessionIdFromFile(kind, sessionFile);
|
|
1056
1064
|
const name = resolvedId ? runNameMap.get(resolvedId) ?? undefined : undefined;
|
|
1057
1065
|
const label = name;
|
|
1058
1066
|
out.push(applyState({
|
|
@@ -1075,6 +1083,7 @@ async function listUnattributedActiveLive(attributed) {
|
|
|
1075
1083
|
owner: resolveOwner(entry?.actor, resolvedId),
|
|
1076
1084
|
launchId: entry?.launchId ?? hookRec?.launch_id,
|
|
1077
1085
|
terminalId: entry?.terminalId ?? hookRec?.terminal_id,
|
|
1086
|
+
originTerminal: entry?.originTerminal,
|
|
1078
1087
|
}, state, sessionFile, true));
|
|
1079
1088
|
}
|
|
1080
1089
|
prunePidSessionRegistry(isPidAlive);
|
|
@@ -1187,7 +1196,7 @@ export async function listTmuxAgentSessions() {
|
|
|
1187
1196
|
harness: id.harness,
|
|
1188
1197
|
host: 'tmux',
|
|
1189
1198
|
pid,
|
|
1190
|
-
sessionId: id.sessionId ?? sessionIdFromFile(sessionFile),
|
|
1199
|
+
sessionId: id.sessionId ?? sessionIdFromFile(id.agent, sessionFile),
|
|
1191
1200
|
cwd,
|
|
1192
1201
|
topic,
|
|
1193
1202
|
tokPerSec,
|
|
@@ -1195,10 +1204,11 @@ export async function listTmuxAgentSessions() {
|
|
|
1195
1204
|
startedAtMs: liveEntry?.startedAtMs ?? birthtimeMs,
|
|
1196
1205
|
lastActivityMs: mtimeMs,
|
|
1197
1206
|
provenance,
|
|
1198
|
-
owner: resolveOwner(liveEntry?.actor, id.sessionId ?? sessionIdFromFile(sessionFile)),
|
|
1207
|
+
owner: resolveOwner(liveEntry?.actor, id.sessionId ?? sessionIdFromFile(id.agent, sessionFile)),
|
|
1199
1208
|
launchId: liveEntry?.launchId,
|
|
1200
1209
|
terminalId: liveEntry?.terminalId,
|
|
1201
|
-
|
|
1210
|
+
originTerminal: liveEntry?.originTerminal,
|
|
1211
|
+
paneId: id.sessionId ?? sessionIdFromFile(id.agent, sessionFile) ? undefined : pane,
|
|
1202
1212
|
tmuxName: sessName,
|
|
1203
1213
|
}, state, sessionFile, pidAlive));
|
|
1204
1214
|
}
|
|
@@ -1,48 +1,19 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import * as yaml from 'yaml';
|
|
5
3
|
import { deriveShortId } from '../text/short-id.js';
|
|
6
4
|
import { getCacheDir } from '../state.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const USER_YAML = path.join(os.homedir(), '.rush', 'user.yaml');
|
|
5
|
+
import { readToken, rushOrgHandle } from '../cloud/rush.js';
|
|
6
|
+
import { RUSH_API_BASE } from '../rush-api.js';
|
|
10
7
|
const CLOUD_CACHE_DIR = path.join(getCacheDir(), 'cloud-runs');
|
|
11
8
|
const CLOUD_EXECUTION_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
const raw = fs.readFileSync(USER_YAML, 'utf-8');
|
|
17
|
-
const data = yaml.parse(raw);
|
|
18
|
-
const token = data?.session?.access_token;
|
|
19
|
-
if (!token) {
|
|
20
|
-
throw new Error('No session token in ~/.rush/user.yaml. Run `rush login` first.');
|
|
21
|
-
}
|
|
22
|
-
const expiresAt = data.session?.expires_at;
|
|
23
|
-
if (isRushSessionExpired(expiresAt)) {
|
|
24
|
-
const expiredAt = new Date(expiresAt).toISOString();
|
|
25
|
-
throw new Error(`Rush session expired at ${expiredAt}. Run \`rush login\` to refresh.`);
|
|
26
|
-
}
|
|
27
|
-
return token;
|
|
28
|
-
}
|
|
29
|
-
async function api(method, endpoint, token) {
|
|
30
|
-
return fetch(`${PROXY_BASE}${endpoint}`, {
|
|
31
|
-
method,
|
|
32
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
9
|
+
async function api(endpoint, token, accept) {
|
|
10
|
+
return fetch(`${RUSH_API_BASE}${endpoint}`, {
|
|
11
|
+
headers: { Authorization: `Bearer ${token}`, ...(accept ? { Accept: accept } : {}) },
|
|
33
12
|
});
|
|
34
13
|
}
|
|
35
|
-
function
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
38
|
-
if (agent === 'codex')
|
|
39
|
-
return 'codex';
|
|
40
|
-
if (agent === 'rush')
|
|
41
|
-
return 'rush';
|
|
42
|
-
if (agent === 'droid')
|
|
43
|
-
return 'droid';
|
|
44
|
-
if (agent === 'opencode')
|
|
45
|
-
return 'opencode';
|
|
14
|
+
function harnessToFormat(harness) {
|
|
15
|
+
if (harness === 'claude' || harness === 'codex' || harness === 'opencode')
|
|
16
|
+
return harness;
|
|
46
17
|
return null;
|
|
47
18
|
}
|
|
48
19
|
function assertContained(candidate, rootDir) {
|
|
@@ -65,21 +36,22 @@ function cachePathForExecution(executionId, agent) {
|
|
|
65
36
|
}
|
|
66
37
|
export async function discoverCloudSessions(options) {
|
|
67
38
|
const token = readToken();
|
|
39
|
+
const org = await rushOrgHandle(token);
|
|
68
40
|
const limit = options?.limit ?? 50;
|
|
69
|
-
const res = await api(
|
|
41
|
+
const res = await api(`/o/${encodeURIComponent(org)}/sessions?limit=${limit}`, token);
|
|
70
42
|
if (!res.ok) {
|
|
71
|
-
throw new Error(`cloud
|
|
43
|
+
throw new Error(`cloud sessions list failed (${res.status})`);
|
|
72
44
|
}
|
|
73
45
|
const data = (await res.json());
|
|
74
|
-
const rows = data.
|
|
46
|
+
const rows = data.sessions ?? [];
|
|
75
47
|
const out = [];
|
|
76
48
|
for (const row of rows) {
|
|
77
|
-
const agent =
|
|
49
|
+
const agent = harnessToFormat(row.harness);
|
|
78
50
|
if (!agent)
|
|
79
51
|
continue;
|
|
80
|
-
const id = validateCloudExecutionId(row.
|
|
52
|
+
const id = validateCloudExecutionId(row.id);
|
|
81
53
|
const timestamp = row.updated_at || row.created_at || new Date().toISOString();
|
|
82
|
-
const project = row.
|
|
54
|
+
const project = row.project ?? undefined;
|
|
83
55
|
const filePath = cachePathForExecution(id, agent);
|
|
84
56
|
out.push({
|
|
85
57
|
id,
|
|
@@ -88,7 +60,7 @@ export async function discoverCloudSessions(options) {
|
|
|
88
60
|
timestamp,
|
|
89
61
|
project,
|
|
90
62
|
filePath,
|
|
91
|
-
topic: row.prompt?.split('\n')[0]?.slice(0, 120),
|
|
63
|
+
topic: (row.title || row.prompt)?.split('\n')[0]?.slice(0, 120),
|
|
92
64
|
label: `[cloud/${row.status}]${row.branch ? ` ${row.branch}` : ''}`,
|
|
93
65
|
});
|
|
94
66
|
}
|
|
@@ -99,7 +71,8 @@ export async function ensureCloudSessionCached(executionId, destPath) {
|
|
|
99
71
|
const id = validateCloudExecutionId(executionId);
|
|
100
72
|
const callerPath = destPath ? assertContained(destPath, CLOUD_CACHE_DIR) : undefined;
|
|
101
73
|
const token = readToken();
|
|
102
|
-
const
|
|
74
|
+
const org = await rushOrgHandle(token);
|
|
75
|
+
const res = await api(`/o/${encodeURIComponent(org)}/p/_/sessions/${encodeURIComponent(id)}/trajectory`, token, 'application/x-ndjson');
|
|
103
76
|
if (!res.ok) {
|
|
104
77
|
const body = await res.text().catch(() => '');
|
|
105
78
|
throw new Error(`session.jsonl fetch ${res.status}: ${body.slice(0, 200)}`);
|
package/dist/lib/session/db.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { SessionAgentId, SessionCheckpoint, SessionChecklistItem, SessionEv
|
|
|
3
3
|
import { type IndexedToolCall } from '@phnx-labs/sessions-cli/reader';
|
|
4
4
|
import { type ToolScanResumePoint } from './tool-store.js';
|
|
5
5
|
import { type TimelineState } from '@phnx-labs/sessions-cli/reader';
|
|
6
|
-
export declare const SCHEMA_VERSION =
|
|
6
|
+
export declare const SCHEMA_VERSION = 52;
|
|
7
7
|
export declare const CONTENT_INDEX_VERSION = 6;
|
|
8
8
|
export declare const INSIGHTS_EXTRACTOR_VERSION = 7;
|
|
9
9
|
export declare const SESSION_TOPIC_EXTRACTOR_VERSION = 2;
|
|
@@ -105,6 +105,7 @@ export declare function latestSessionFileForCwd(agent: SessionAgentId, cwd: stri
|
|
|
105
105
|
maxAgeMs?: number;
|
|
106
106
|
nowMs?: number;
|
|
107
107
|
}): string | undefined;
|
|
108
|
+
export declare function indexedSessionIdForFile(agent: string, filePath: string): string | undefined;
|
|
108
109
|
export declare function getSessionExistenceCacheStats(): {
|
|
109
110
|
sweeps: number;
|
|
110
111
|
};
|
|
@@ -400,6 +401,7 @@ interface StoredBrowserSession extends Required<Pick<BrowserSessionRecord, 'task
|
|
|
400
401
|
}
|
|
401
402
|
export declare function listBrowserSessionRecords(profile?: string, opts?: {
|
|
402
403
|
limit?: number;
|
|
404
|
+
deviceKeys?: boolean;
|
|
403
405
|
}): StoredBrowserSession[];
|
|
404
406
|
export declare function getBrowserSessionRecord(profile: string, task: string): StoredBrowserSession | null;
|
|
405
407
|
interface StoredComputerSession {
|