@phnx-labs/agents-cli 1.22.46 → 1.22.49
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 +663 -0
- package/LICENSE +102 -182
- package/README.md +96 -49
- package/dist/bootstrap.js +4 -2
- package/dist/cli/command-registry.d.ts +2 -1
- package/dist/cli/command-registry.js +6 -2
- package/dist/commands/accounts.d.ts +58 -0
- package/dist/commands/accounts.js +243 -25
- package/dist/commands/artifacts.js +7 -6
- package/dist/commands/attach.js +1 -1
- package/dist/commands/auth.js +7 -5
- package/dist/commands/browser-sessions-picker.js +9 -7
- package/dist/commands/browser.js +711 -62
- package/dist/commands/config.d.ts +0 -1
- package/dist/commands/config.js +26 -24
- package/dist/commands/cost.d.ts +1 -1
- package/dist/commands/daemon.d.ts +21 -0
- package/dist/commands/daemon.js +147 -12
- package/dist/commands/detach.d.ts +13 -0
- package/dist/commands/detach.js +11 -8
- package/dist/commands/exec.js +107 -53
- package/dist/commands/feed-watch.d.ts +2 -0
- package/dist/commands/feed-watch.js +28 -0
- package/dist/commands/feed.js +27 -0
- package/dist/commands/feedback.js +3 -19
- package/dist/commands/focus.d.ts +14 -0
- package/dist/commands/focus.js +48 -5
- package/dist/commands/go.d.ts +3 -0
- package/dist/commands/go.js +16 -3
- package/dist/commands/insights.d.ts +1 -1
- package/dist/commands/insights.js +2 -2
- package/dist/commands/inspect.js +2 -2
- package/dist/commands/lease.d.ts +1 -1
- package/dist/commands/lease.js +7 -6
- package/dist/commands/mailboxes.js +4 -3
- package/dist/commands/menubar.js +11 -4
- package/dist/commands/projects.d.ts +16 -1
- package/dist/commands/projects.js +58 -64
- package/dist/commands/resume.js +1 -1
- package/dist/commands/route.js +4 -4
- package/dist/commands/routines.js +4 -3
- package/dist/commands/run-broadcast.d.ts +1 -1
- package/dist/commands/run-broadcast.js +1 -1
- package/dist/commands/sessions-picker-factory.d.ts +2 -1
- package/dist/commands/sessions-picker-factory.js +1 -1
- package/dist/commands/sessions-picker.d.ts +22 -0
- package/dist/commands/sessions-picker.js +48 -9
- package/dist/commands/sessions-stop.d.ts +24 -0
- package/dist/commands/sessions-stop.js +66 -0
- package/dist/commands/sessions-trace.d.ts +82 -0
- package/dist/commands/sessions-trace.js +387 -0
- package/dist/commands/sessions.js +5 -0
- package/dist/commands/setup-secrets.js +23 -0
- package/dist/commands/share.d.ts +20 -5
- package/dist/commands/share.js +152 -52
- package/dist/commands/ssh.d.ts +15 -0
- package/dist/commands/ssh.js +243 -18
- package/dist/commands/teams.js +34 -2
- package/dist/commands/traces.d.ts +2 -0
- package/dist/commands/traces.js +184 -0
- package/dist/commands/view.d.ts +2 -0
- package/dist/commands/view.js +32 -62
- package/dist/commands/watchdog.js +9 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/lib/account-capabilities.d.ts +4 -0
- package/dist/lib/account-capabilities.js +13 -9
- package/dist/lib/account-registry.d.ts +2 -0
- package/dist/lib/account-registry.js +30 -2
- package/dist/lib/accounting/rotate.d.ts +9 -0
- package/dist/lib/accounting/rotate.js +12 -2
- package/dist/lib/accounting/usage.d.ts +84 -6
- package/dist/lib/accounting/usage.js +293 -75
- package/dist/lib/agent-modes.js +29 -1
- package/dist/lib/agent-spec/agents.d.ts +4 -3
- package/dist/lib/agent-spec/agents.js +25 -15
- package/dist/lib/analytics/mix-commands.d.ts +1 -1
- package/dist/lib/analytics/mix-commands.js +2 -2
- package/dist/lib/auth-health.d.ts +13 -3
- package/dist/lib/auth-health.js +50 -8
- package/dist/lib/browser/devices.d.ts +19 -0
- package/dist/lib/browser/devices.js +23 -0
- package/dist/lib/browser/drivers/ssh.d.ts +16 -2
- package/dist/lib/browser/drivers/ssh.js +36 -9
- package/dist/lib/browser/ipc.d.ts +1 -1
- package/dist/lib/browser/ipc.js +40 -9
- package/dist/lib/browser/profiles.d.ts +104 -65
- package/dist/lib/browser/profiles.js +277 -165
- package/dist/lib/browser/registry.d.ts +39 -0
- package/dist/lib/browser/registry.js +149 -0
- package/dist/lib/browser/remote-control.d.ts +28 -2
- package/dist/lib/browser/remote-control.js +35 -3
- package/dist/lib/browser/resolve-target.d.ts +68 -0
- package/dist/lib/browser/resolve-target.js +250 -0
- package/dist/lib/browser/runtime-state.d.ts +44 -11
- package/dist/lib/browser/runtime-state.js +98 -15
- package/dist/lib/browser/service.d.ts +65 -9
- package/dist/lib/browser/service.js +196 -61
- package/dist/lib/browser/sessions-list.d.ts +1 -3
- package/dist/lib/browser/sessions-list.js +3 -16
- package/dist/lib/browser/task-index.d.ts +70 -0
- package/dist/lib/browser/task-index.js +180 -0
- package/dist/lib/browser/types.d.ts +12 -1
- package/dist/lib/byok-usage.js +2 -2
- package/dist/lib/claude-statusline.d.ts +29 -0
- package/dist/lib/claude-statusline.js +139 -0
- package/dist/lib/cloud/host.d.ts +1 -1
- package/dist/lib/cloud/host.js +1 -1
- package/dist/lib/cloud/rush.js +1 -1
- package/dist/lib/codex-policy.d.ts +11 -1
- package/dist/lib/codex-policy.js +20 -5
- package/dist/lib/computer/computer-rpc.js +2 -2
- package/dist/lib/computer/download.d.ts +15 -15
- package/dist/lib/computer/download.js +35 -98
- package/dist/lib/computer/ssh-tunnel.d.ts +0 -3
- package/dist/lib/computer/ssh-tunnel.js +12 -22
- package/dist/lib/config-keys.d.ts +6 -11
- package/dist/lib/config-keys.js +18 -19
- package/dist/lib/crabbox/cli.d.ts +1 -1
- package/dist/lib/crabbox/cli.js +2 -2
- package/dist/lib/crabbox/lease.d.ts +9 -0
- package/dist/lib/crabbox/lease.js +70 -15
- package/dist/lib/crabbox/runtimes.js +1 -1
- package/dist/lib/daemon/account-state-daemon-service.d.ts +16 -0
- package/dist/lib/daemon/account-state-daemon-service.js +26 -0
- package/dist/lib/daemon/browser-ipc-service.d.ts +20 -0
- package/dist/lib/daemon/browser-ipc-service.js +46 -0
- package/dist/lib/daemon/daemon.d.ts +3 -0
- package/dist/lib/daemon/daemon.js +212 -444
- package/dist/lib/daemon/device-probe-service.d.ts +26 -0
- package/dist/lib/daemon/device-probe-service.js +47 -0
- package/dist/lib/daemon/keychain-reap-service.d.ts +17 -0
- package/dist/lib/daemon/keychain-reap-service.js +32 -0
- package/dist/lib/daemon/monitor-engine-service.d.ts +22 -0
- package/dist/lib/daemon/monitor-engine-service.js +29 -0
- package/dist/lib/daemon/runner.js +15 -2
- package/dist/lib/daemon/secrets-broker-service.d.ts +20 -0
- package/dist/lib/daemon/secrets-broker-service.js +66 -0
- package/dist/lib/daemon/self-heal-service.d.ts +27 -0
- package/dist/lib/daemon/self-heal-service.js +48 -0
- package/dist/lib/daemon/service.d.ts +102 -0
- package/dist/lib/daemon/service.js +98 -0
- package/dist/lib/daemon/session-index-service.d.ts +22 -0
- package/dist/lib/daemon/session-index-service.js +40 -0
- package/dist/lib/daemon/state-dir-check-service.d.ts +43 -0
- package/dist/lib/daemon/state-dir-check-service.js +63 -0
- package/dist/lib/daemon/supervisor.d.ts +87 -0
- package/dist/lib/daemon/supervisor.js +298 -0
- package/dist/lib/daemon/watchdog-service.d.ts +19 -0
- package/dist/lib/daemon/watchdog-service.js +40 -0
- package/dist/lib/daemon-health.d.ts +15 -0
- package/dist/lib/daemon-health.js +29 -5
- package/dist/lib/daemon-services.d.ts +8 -1
- package/dist/lib/daemon-services.js +55 -0
- package/dist/lib/daemon-ticks.d.ts +13 -2
- package/dist/lib/daemon-ticks.js +22 -20
- package/dist/lib/device-config.d.ts +25 -10
- package/dist/lib/device-config.js +90 -39
- package/dist/lib/devices/config-migration.d.ts +7 -0
- package/dist/lib/devices/config-migration.js +67 -3
- package/dist/lib/devices/health.d.ts +27 -2
- package/dist/lib/devices/health.js +39 -9
- package/dist/lib/devices/interactive-host.d.ts +15 -0
- package/dist/lib/devices/interactive-host.js +53 -0
- package/dist/lib/devices/registry.d.ts +61 -4
- package/dist/lib/devices/registry.js +94 -38
- package/dist/lib/devices/stats-cache.d.ts +26 -0
- package/dist/lib/devices/stats-cache.js +59 -7
- package/dist/lib/devices/worker-pick.d.ts +48 -0
- package/dist/lib/devices/worker-pick.js +113 -0
- package/dist/lib/exec.d.ts +70 -14
- package/dist/lib/exec.js +110 -38
- package/dist/lib/feed/answer.d.ts +29 -0
- package/dist/lib/feed/answer.js +145 -0
- package/dist/lib/feed/attention.d.ts +83 -0
- package/dist/lib/feed/attention.js +0 -0
- package/dist/lib/feed/feed.d.ts +109 -0
- package/dist/lib/feed/feed.js +154 -3
- package/dist/lib/feed/pr-status.d.ts +14 -0
- package/dist/lib/feed/pr-status.js +47 -0
- package/dist/lib/feed/watch.d.ts +59 -0
- package/dist/lib/feed/watch.js +180 -0
- package/dist/lib/fleet/capture.js +6 -0
- package/dist/lib/fleet/remote-login.js +8 -3
- package/dist/lib/fleet/types.d.ts +17 -0
- package/dist/lib/harness/adapter.d.ts +11 -0
- package/dist/lib/harness/adapters/claude.js +38 -24
- package/dist/lib/harness/adapters/codex.js +2 -4
- package/dist/lib/harness/adapters/cursor.js +8 -11
- package/dist/lib/helper-download.d.ts +108 -0
- package/dist/lib/helper-download.js +194 -0
- package/dist/lib/helper-versions.d.ts +52 -0
- package/dist/lib/helper-versions.js +58 -0
- package/dist/lib/hooks/cache.js +19 -0
- package/dist/lib/hooks/install.js +2 -2
- package/dist/lib/hooks/match.d.ts +3 -0
- package/dist/lib/hooks/match.js +25 -0
- package/dist/lib/hosts/credentials.d.ts +1 -1
- package/dist/lib/hosts/credentials.js +1 -1
- package/dist/lib/hosts/dispatch.d.ts +7 -1
- package/dist/lib/hosts/dispatch.js +24 -5
- package/dist/lib/hosts/passthrough.d.ts +8 -15
- package/dist/lib/hosts/passthrough.js +35 -16
- package/dist/lib/hosts/providers/devices.d.ts +1 -1
- package/dist/lib/hosts/providers/devices.js +1 -1
- package/dist/lib/hosts/reconnect.d.ts +179 -21
- package/dist/lib/hosts/reconnect.js +266 -45
- package/dist/lib/hosts/registry.js +7 -0
- package/dist/lib/installations/migrate.d.ts +4 -5
- package/dist/lib/installations/migrate.js +6 -7
- package/dist/lib/installations/shims.d.ts +1 -1
- package/dist/lib/installations/shims.js +23 -13
- package/dist/lib/installations/versions.js +25 -2
- package/dist/lib/linear-autoclose.d.ts +1 -1
- package/dist/lib/linear-autoclose.js +1 -1
- package/dist/lib/loop.d.ts +2 -2
- package/dist/lib/loop.js +1 -1
- package/dist/lib/menubar/download-menubar.d.ts +47 -0
- package/dist/lib/menubar/download-menubar.js +60 -0
- package/dist/lib/menubar/install-menubar.d.ts +44 -7
- package/dist/lib/menubar/install-menubar.js +105 -23
- package/dist/lib/menubar/notify-desktop.d.ts +3 -3
- package/dist/lib/menubar/notify-desktop.js +6 -6
- package/dist/lib/model-tiers.d.ts +1 -1
- package/dist/lib/open-url.d.ts +60 -2
- package/dist/lib/open-url.js +167 -12
- package/dist/lib/project-probe.d.ts +1 -1
- package/dist/lib/project-probe.js +1 -1
- package/dist/lib/project-pull.d.ts +1 -1
- package/dist/lib/project-pull.js +2 -2
- package/dist/lib/projects.d.ts +1 -1
- package/dist/lib/projects.js +1 -1
- package/dist/lib/refresh-coordinator.d.ts +1 -1
- package/dist/lib/refresh-coordinator.js +1 -1
- package/dist/lib/sandbox.js +6 -7
- package/dist/lib/secrets/download-keychain.d.ts +47 -0
- package/dist/lib/secrets/download-keychain.js +70 -0
- package/dist/lib/secrets/install-helper.d.ts +20 -1
- package/dist/lib/secrets/install-helper.js +44 -3
- package/dist/lib/session/active.d.ts +67 -0
- package/dist/lib/session/active.js +86 -2
- package/dist/lib/session/db.d.ts +11 -1
- package/dist/lib/session/db.js +142 -8
- package/dist/lib/session/discover.d.ts +23 -1
- package/dist/lib/session/discover.js +44 -10
- package/dist/lib/session/highlights.d.ts +49 -1
- package/dist/lib/session/highlights.js +95 -0
- package/dist/lib/session/host-link.d.ts +16 -2
- package/dist/lib/session/host-link.js +7 -1
- package/dist/lib/session/parse.js +33 -1
- package/dist/lib/session/prompt.d.ts +35 -0
- package/dist/lib/session/prompt.js +56 -0
- package/dist/lib/session/remote/remote-list.d.ts +9 -0
- package/dist/lib/session/remote/remote-list.js +19 -2
- package/dist/lib/session/remote/watch.d.ts +1 -1
- package/dist/lib/session/remote/watch.js +17 -3
- package/dist/lib/session/render.js +7 -3
- package/dist/lib/session/session-cache.d.ts +53 -0
- package/dist/lib/session/session-cache.js +93 -1
- package/dist/lib/session/state.js +1 -1
- package/dist/lib/session/tool-calls.d.ts +2 -0
- package/dist/lib/session/tool-calls.js +1 -1
- package/dist/lib/session/trajectory-compare.d.ts +47 -0
- package/dist/lib/session/trajectory-compare.js +116 -0
- package/dist/lib/session/trajectory-html.d.ts +19 -0
- package/dist/lib/session/trajectory-html.js +770 -0
- package/dist/lib/session/trajectory-lineage.d.ts +92 -0
- package/dist/lib/session/trajectory-lineage.js +195 -0
- package/dist/lib/session/trajectory-text.d.ts +37 -0
- package/dist/lib/session/trajectory-text.js +284 -0
- package/dist/lib/session/trajectory.d.ts +102 -0
- package/dist/lib/session/trajectory.js +384 -0
- package/dist/lib/session/types.d.ts +15 -0
- package/dist/lib/sha256-asset.d.ts +26 -0
- package/dist/lib/sha256-asset.js +41 -0
- package/dist/lib/share/backend.d.ts +95 -0
- package/dist/lib/share/backend.js +139 -0
- package/dist/lib/share/delete.d.ts +6 -2
- package/dist/lib/share/delete.js +8 -9
- package/dist/lib/share/html.d.ts +22 -0
- package/dist/lib/share/html.js +88 -0
- package/dist/lib/share/provision.d.ts +18 -4
- package/dist/lib/share/provision.js +38 -4
- package/dist/lib/share/publish.d.ts +39 -15
- package/dist/lib/share/publish.js +55 -26
- package/dist/lib/share/worker-template.js +171 -11
- package/dist/lib/sqlite.js +16 -3
- package/dist/lib/ssh-exec.d.ts +65 -0
- package/dist/lib/ssh-exec.js +120 -4
- package/dist/lib/startup/command-registry.d.ts +3 -1
- package/dist/lib/startup/command-registry.js +6 -3
- package/dist/lib/startup/dev-build.js +3 -3
- package/dist/lib/state.d.ts +2 -2
- package/dist/lib/state.js +11 -5
- package/dist/lib/subagents-registry.js +1 -1
- package/dist/lib/teams/agents.js +9 -0
- package/dist/lib/terminal/index.d.ts +1 -1
- package/dist/lib/terminal/inject.d.ts +19 -0
- package/dist/lib/terminal/inject.js +19 -9
- package/dist/lib/terminal/types.d.ts +1 -1
- package/dist/lib/terminal/types.js +1 -1
- package/dist/lib/tmux/orphan-reap.js +1 -1
- package/dist/lib/tmux/session.d.ts +46 -13
- package/dist/lib/tmux/session.js +204 -27
- package/dist/lib/traces/backend.d.ts +29 -0
- package/dist/lib/traces/backend.js +46 -0
- package/dist/lib/traces/classify.d.ts +52 -0
- package/dist/lib/traces/classify.js +72 -0
- package/dist/lib/traces/config.d.ts +10 -0
- package/dist/lib/traces/config.js +2 -0
- package/dist/lib/traces/provision.d.ts +19 -0
- package/dist/lib/traces/provision.js +30 -0
- package/dist/lib/traces/sync.d.ts +150 -0
- package/dist/lib/traces/sync.js +447 -0
- package/dist/lib/traces/worker-template.d.ts +4 -0
- package/dist/lib/traces/worker-template.js +159 -0
- package/dist/lib/types.d.ts +34 -19
- package/dist/lib/types.js +14 -0
- package/dist/lib/usage-backoff.d.ts +2 -1
- package/dist/lib/usage-backoff.js +60 -19
- package/dist/lib/usage-refresh.d.ts +18 -4
- package/dist/lib/usage-refresh.js +68 -19
- package/dist/lib/watchdog/log.d.ts +1 -1
- package/dist/lib/watchdog/log.js +1 -1
- package/dist/lib/watchdog/runner.d.ts +36 -45
- package/dist/lib/watchdog/runner.js +150 -119
- package/dist/lib/watchdog/service.d.ts +0 -1
- package/dist/lib/watchdog/service.js +0 -1
- package/dist/lib/watchdog/watchdog-agent.d.ts +38 -0
- package/dist/lib/watchdog/watchdog-agent.js +59 -0
- package/dist/lib/watchdog/watchdog.d.ts +11 -2
- package/dist/lib/watchdog/watchdog.js +37 -104
- package/dist/lib/workflows.d.ts +1 -1
- package/package.json +5 -7
- package/dist/commands/usage.d.ts +0 -27
- package/dist/commands/usage.js +0 -96
- package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/Info.plist +0 -24
- package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/Resources/AppIcon.icns +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/_CodeSignature/CodeResources +0 -128
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +0 -24
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +0 -123
- package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/usage-fleet.d.ts +0 -32
- package/dist/lib/usage-fleet.js +0 -125
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>files</key>
|
|
6
|
-
<dict/>
|
|
7
|
-
<key>files2</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>embedded.provisionprofile</key>
|
|
10
|
-
<dict>
|
|
11
|
-
<key>hash2</key>
|
|
12
|
-
<data>
|
|
13
|
-
2vfA/eR3dTYgNc/fXhdADUPkp5tRIepPzE3FCLfDx4w=
|
|
14
|
-
</data>
|
|
15
|
-
</dict>
|
|
16
|
-
</dict>
|
|
17
|
-
<key>rules</key>
|
|
18
|
-
<dict>
|
|
19
|
-
<key>^Resources/</key>
|
|
20
|
-
<true/>
|
|
21
|
-
<key>^Resources/.*\.lproj/</key>
|
|
22
|
-
<dict>
|
|
23
|
-
<key>optional</key>
|
|
24
|
-
<true/>
|
|
25
|
-
<key>weight</key>
|
|
26
|
-
<real>1000</real>
|
|
27
|
-
</dict>
|
|
28
|
-
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
|
29
|
-
<dict>
|
|
30
|
-
<key>omit</key>
|
|
31
|
-
<true/>
|
|
32
|
-
<key>weight</key>
|
|
33
|
-
<real>1100</real>
|
|
34
|
-
</dict>
|
|
35
|
-
<key>^Resources/Base\.lproj/</key>
|
|
36
|
-
<dict>
|
|
37
|
-
<key>weight</key>
|
|
38
|
-
<real>1010</real>
|
|
39
|
-
</dict>
|
|
40
|
-
<key>^version.plist$</key>
|
|
41
|
-
<true/>
|
|
42
|
-
</dict>
|
|
43
|
-
<key>rules2</key>
|
|
44
|
-
<dict>
|
|
45
|
-
<key>.*\.dSYM($|/)</key>
|
|
46
|
-
<dict>
|
|
47
|
-
<key>weight</key>
|
|
48
|
-
<real>11</real>
|
|
49
|
-
</dict>
|
|
50
|
-
<key>^(.*/)?\.DS_Store$</key>
|
|
51
|
-
<dict>
|
|
52
|
-
<key>omit</key>
|
|
53
|
-
<true/>
|
|
54
|
-
<key>weight</key>
|
|
55
|
-
<real>2000</real>
|
|
56
|
-
</dict>
|
|
57
|
-
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
|
58
|
-
<dict>
|
|
59
|
-
<key>nested</key>
|
|
60
|
-
<true/>
|
|
61
|
-
<key>weight</key>
|
|
62
|
-
<real>10</real>
|
|
63
|
-
</dict>
|
|
64
|
-
<key>^.*</key>
|
|
65
|
-
<true/>
|
|
66
|
-
<key>^Info\.plist$</key>
|
|
67
|
-
<dict>
|
|
68
|
-
<key>omit</key>
|
|
69
|
-
<true/>
|
|
70
|
-
<key>weight</key>
|
|
71
|
-
<real>20</real>
|
|
72
|
-
</dict>
|
|
73
|
-
<key>^PkgInfo$</key>
|
|
74
|
-
<dict>
|
|
75
|
-
<key>omit</key>
|
|
76
|
-
<true/>
|
|
77
|
-
<key>weight</key>
|
|
78
|
-
<real>20</real>
|
|
79
|
-
</dict>
|
|
80
|
-
<key>^Resources/</key>
|
|
81
|
-
<dict>
|
|
82
|
-
<key>weight</key>
|
|
83
|
-
<real>20</real>
|
|
84
|
-
</dict>
|
|
85
|
-
<key>^Resources/.*\.lproj/</key>
|
|
86
|
-
<dict>
|
|
87
|
-
<key>optional</key>
|
|
88
|
-
<true/>
|
|
89
|
-
<key>weight</key>
|
|
90
|
-
<real>1000</real>
|
|
91
|
-
</dict>
|
|
92
|
-
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
|
93
|
-
<dict>
|
|
94
|
-
<key>omit</key>
|
|
95
|
-
<true/>
|
|
96
|
-
<key>weight</key>
|
|
97
|
-
<real>1100</real>
|
|
98
|
-
</dict>
|
|
99
|
-
<key>^Resources/Base\.lproj/</key>
|
|
100
|
-
<dict>
|
|
101
|
-
<key>weight</key>
|
|
102
|
-
<real>1010</real>
|
|
103
|
-
</dict>
|
|
104
|
-
<key>^[^/]+$</key>
|
|
105
|
-
<dict>
|
|
106
|
-
<key>nested</key>
|
|
107
|
-
<true/>
|
|
108
|
-
<key>weight</key>
|
|
109
|
-
<real>10</real>
|
|
110
|
-
</dict>
|
|
111
|
-
<key>^embedded\.provisionprofile$</key>
|
|
112
|
-
<dict>
|
|
113
|
-
<key>weight</key>
|
|
114
|
-
<real>20</real>
|
|
115
|
-
</dict>
|
|
116
|
-
<key>^version\.plist$</key>
|
|
117
|
-
<dict>
|
|
118
|
-
<key>weight</key>
|
|
119
|
-
<real>20</real>
|
|
120
|
-
</dict>
|
|
121
|
-
</dict>
|
|
122
|
-
</dict>
|
|
123
|
-
</plist>
|
|
Binary file
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type HeadroomEntry } from './usage-refresh.js';
|
|
2
|
-
import { type UsageWindow } from './accounting/usage.js';
|
|
3
|
-
export declare const USAGE_FLEET_VERSION = 1;
|
|
4
|
-
export declare const USAGE_FLEET_FILE = ".usage-fleet.json";
|
|
5
|
-
export interface UsageFleetWindow {
|
|
6
|
-
key: UsageWindow['key'];
|
|
7
|
-
label: string;
|
|
8
|
-
shortLabel: string;
|
|
9
|
-
usedPercent: number;
|
|
10
|
-
resetsAt: string | null;
|
|
11
|
-
windowMinutes: number | null;
|
|
12
|
-
}
|
|
13
|
-
export interface UsageFleetSnapshot {
|
|
14
|
-
capturedAt: string | null;
|
|
15
|
-
plan: string | null;
|
|
16
|
-
windows: UsageFleetWindow[];
|
|
17
|
-
}
|
|
18
|
-
export interface UsageFleetExport {
|
|
19
|
-
version: 1;
|
|
20
|
-
publishedAt: number;
|
|
21
|
-
usage: Record<string, UsageFleetSnapshot>;
|
|
22
|
-
headroom: Record<string, HeadroomEntry>;
|
|
23
|
-
}
|
|
24
|
-
/** Publisher/subscriber role selection, kept pure for the daemon gate test. */
|
|
25
|
-
export declare function usageRefreshRole(primaryHost: string | undefined, self: string): 'publisher' | 'subscriber';
|
|
26
|
-
export declare function setUsageFleetExportPathForTest(value: string | null): string | null;
|
|
27
|
-
/** Build and persist the primary's safe cache envelope. */
|
|
28
|
-
export declare function exportUsageFleet(now?: number): UsageFleetExport;
|
|
29
|
-
/** Merge a primary-host envelope into the subscriber's existing caches. */
|
|
30
|
-
export declare function importUsageFleet(value: unknown): UsageFleetExport;
|
|
31
|
-
/** Fetch the primary's published envelope over the registered device SSH path. */
|
|
32
|
-
export declare function importUsageFleetFromHost(host: string): Promise<UsageFleetExport>;
|
package/dist/lib/usage-fleet.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token-free usage replication from the configured primary host.
|
|
3
|
-
*
|
|
4
|
-
* The publisher writes only the already-derived usage windows and routing
|
|
5
|
-
* headroom. Credentials, OAuth material, and provider responses never enter
|
|
6
|
-
* this envelope. Subscribers fetch that file over the existing SSH trust path
|
|
7
|
-
* and merge it into their local caches.
|
|
8
|
-
*/
|
|
9
|
-
import { spawn } from 'node:child_process';
|
|
10
|
-
import * as path from 'node:path';
|
|
11
|
-
import { buildSshInvocation, writeAskpassShim } from './devices/connect.js';
|
|
12
|
-
import { loadDevices } from './devices/registry.js';
|
|
13
|
-
import { atomicWriteFileSync } from './fs-atomic.js';
|
|
14
|
-
import { getCacheDir } from './state.js';
|
|
15
|
-
import { readHeadroomCache, writeHeadroomEntries, } from './usage-refresh.js';
|
|
16
|
-
import { readClaudeUsageCache, writeClaudeUsageCache, } from './accounting/usage.js';
|
|
17
|
-
export const USAGE_FLEET_VERSION = 1;
|
|
18
|
-
export const USAGE_FLEET_FILE = '.usage-fleet.json';
|
|
19
|
-
/** Publisher/subscriber role selection, kept pure for the daemon gate test. */
|
|
20
|
-
export function usageRefreshRole(primaryHost, self) {
|
|
21
|
-
return primaryHost && primaryHost !== self ? 'subscriber' : 'publisher';
|
|
22
|
-
}
|
|
23
|
-
let exportPathOverride = null;
|
|
24
|
-
export function setUsageFleetExportPathForTest(value) {
|
|
25
|
-
const previous = exportPathOverride;
|
|
26
|
-
exportPathOverride = value;
|
|
27
|
-
return previous;
|
|
28
|
-
}
|
|
29
|
-
function exportPath() {
|
|
30
|
-
return exportPathOverride ?? path.join(getCacheDir(), USAGE_FLEET_FILE);
|
|
31
|
-
}
|
|
32
|
-
function safeSnapshot(snapshot) {
|
|
33
|
-
return {
|
|
34
|
-
capturedAt: snapshot.capturedAt?.toISOString() ?? null,
|
|
35
|
-
plan: snapshot.plan ?? null,
|
|
36
|
-
windows: snapshot.windows.map((window) => ({
|
|
37
|
-
key: window.key,
|
|
38
|
-
label: window.label,
|
|
39
|
-
shortLabel: window.shortLabel,
|
|
40
|
-
usedPercent: window.usedPercent,
|
|
41
|
-
resetsAt: window.resetsAt?.toISOString() ?? null,
|
|
42
|
-
windowMinutes: window.windowMinutes,
|
|
43
|
-
})),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function liveSnapshot(snapshot) {
|
|
47
|
-
return {
|
|
48
|
-
source: 'last_seen',
|
|
49
|
-
sourceLabel: 'primary host cache',
|
|
50
|
-
capturedAt: snapshot.capturedAt ? new Date(snapshot.capturedAt) : null,
|
|
51
|
-
plan: snapshot.plan,
|
|
52
|
-
windows: snapshot.windows.map((window) => ({
|
|
53
|
-
...window,
|
|
54
|
-
resetsAt: window.resetsAt ? new Date(window.resetsAt) : null,
|
|
55
|
-
})),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/** Build and persist the primary's safe cache envelope. */
|
|
59
|
-
export function exportUsageFleet(now = Date.now()) {
|
|
60
|
-
const headroom = readHeadroomCache();
|
|
61
|
-
const usage = {};
|
|
62
|
-
for (const usageKey of Object.keys(headroom)) {
|
|
63
|
-
const snapshot = readClaudeUsageCache(usageKey);
|
|
64
|
-
if (snapshot)
|
|
65
|
-
usage[usageKey] = safeSnapshot(snapshot);
|
|
66
|
-
}
|
|
67
|
-
const payload = {
|
|
68
|
-
version: USAGE_FLEET_VERSION,
|
|
69
|
-
publishedAt: now,
|
|
70
|
-
usage,
|
|
71
|
-
headroom,
|
|
72
|
-
};
|
|
73
|
-
atomicWriteFileSync(exportPath(), JSON.stringify(payload, null, 2), 'utf-8');
|
|
74
|
-
return payload;
|
|
75
|
-
}
|
|
76
|
-
function isUsageFleetExport(value) {
|
|
77
|
-
if (!value || typeof value !== 'object')
|
|
78
|
-
return false;
|
|
79
|
-
const payload = value;
|
|
80
|
-
return payload.version === USAGE_FLEET_VERSION
|
|
81
|
-
&& typeof payload.publishedAt === 'number'
|
|
82
|
-
&& !!payload.usage && typeof payload.usage === 'object'
|
|
83
|
-
&& !!payload.headroom && typeof payload.headroom === 'object';
|
|
84
|
-
}
|
|
85
|
-
/** Merge a primary-host envelope into the subscriber's existing caches. */
|
|
86
|
-
export function importUsageFleet(value) {
|
|
87
|
-
if (!isUsageFleetExport(value))
|
|
88
|
-
throw new Error('usage fleet export has an unsupported shape');
|
|
89
|
-
for (const [usageKey, snapshot] of Object.entries(value.usage)) {
|
|
90
|
-
writeClaudeUsageCache(usageKey, liveSnapshot(snapshot));
|
|
91
|
-
}
|
|
92
|
-
writeHeadroomEntries(value.headroom);
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
|
-
/** Fetch the primary's published envelope over the registered device SSH path. */
|
|
96
|
-
export async function importUsageFleetFromHost(host) {
|
|
97
|
-
const device = (await loadDevices())[host];
|
|
98
|
-
if (!device)
|
|
99
|
-
throw new Error(`usage primary host '${host}' is not a registered device`);
|
|
100
|
-
const remoteRead = device.shell === 'powershell'
|
|
101
|
-
? ['Get-Content', '-Raw', '(Join-Path $HOME \'.agents/.cache/.usage-fleet.json\')']
|
|
102
|
-
: ['cat', '"$HOME/.agents/.cache/.usage-fleet.json"'];
|
|
103
|
-
const { args, env } = buildSshInvocation(device, remoteRead, writeAskpassShim(), {}, { agentOnly: true });
|
|
104
|
-
const raw = await new Promise((resolve, reject) => {
|
|
105
|
-
const child = spawn('ssh', args, {
|
|
106
|
-
env: { ...process.env, ...env },
|
|
107
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
108
|
-
windowsHide: true,
|
|
109
|
-
});
|
|
110
|
-
let stdout = '';
|
|
111
|
-
let stderr = '';
|
|
112
|
-
child.stdout.setEncoding('utf-8');
|
|
113
|
-
child.stderr.setEncoding('utf-8');
|
|
114
|
-
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
115
|
-
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
116
|
-
child.on('error', reject);
|
|
117
|
-
child.on('close', (code) => {
|
|
118
|
-
if (code === 0)
|
|
119
|
-
resolve(stdout);
|
|
120
|
-
else
|
|
121
|
-
reject(new Error(`usage primary host '${host}' export failed: ${stderr.trim() || `ssh exited ${code}`}`));
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
return importUsageFleet(JSON.parse(raw));
|
|
125
|
-
}
|