@chroxy/server 0.11.10 → 0.11.11
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/CONFIG.md +4 -2
- package/package.json +3 -3
- package/src/acp-session.js +5 -1
- package/src/agent-connections.js +12 -1
- package/src/agent-control/client.js +29 -0
- package/src/agent-control/events.js +8 -4
- package/src/agent-control/local-connection.js +34 -16
- package/src/agent-control/mcp-server.js +2 -0
- package/src/anthropic-compatible-config.js +1 -0
- package/src/anthropic-gemini-shim.js +444 -0
- package/src/anthropic-gemini-translate.js +1030 -0
- package/src/base-session.js +319 -2
- package/src/bound-client-policy.js +12 -0
- package/src/byok-mcp-config.js +9 -5
- package/src/byok-mcp-trust.js +34 -20
- package/src/byok-session.js +62 -9
- package/src/byok-tool-executor.js +81 -1
- package/src/claude-setting-sources.js +74 -0
- package/src/claude-tui/pty-driver.js +5 -1
- package/src/claude-tui/usage-limit.js +2 -2
- package/src/claude-tui-session.js +57 -4
- package/src/cli/agent-cmd.js +236 -0
- package/src/cli/connection-state.js +54 -0
- package/src/cli/freshness-cmd.js +53 -0
- package/src/cli/pages-cmd.js +6 -4
- package/src/cli/pair-code-cmd.js +7 -6
- package/src/cli/pair-discord-cmd.js +7 -6
- package/src/cli/schedule-cmd.js +25 -3
- package/src/cli/server-cmd.js +6 -0
- package/src/cli/shell-cmd.js +7 -4
- package/src/cli/status-cmd.js +19 -5
- package/src/cli-session.js +190 -11
- package/src/cli.js +4 -0
- package/src/codex-app-server-session.js +78 -17
- package/src/codex-error-text.js +114 -0
- package/src/config-dir-migration.js +11 -6
- package/src/config.js +23 -3
- package/src/connection-info.js +73 -14
- package/src/continuations.js +153 -40
- package/src/conversation-scanner.js +2 -21
- package/src/conversation-search.js +4 -17
- package/src/dev-preview.js +2 -1
- package/src/docker-session.js +10 -1
- package/src/doctor.js +14 -3
- package/src/durable-write.js +35 -0
- package/src/environments/authority.js +7 -1
- package/src/event-normalizer.js +35 -2
- package/src/folder-trust-wire.js +137 -0
- package/src/folder-trust-worker.js +17 -0
- package/src/folder-trust.js +1572 -0
- package/src/freshness/activity-meter.js +101 -0
- package/src/freshness/adapter.js +199 -0
- package/src/freshness/checks.js +239 -0
- package/src/freshness/config.js +98 -0
- package/src/freshness/core.js +185 -0
- package/src/freshness/derive.js +680 -0
- package/src/freshness/exchange.js +305 -0
- package/src/freshness/file-ledger.js +400 -0
- package/src/freshness/grade.js +81 -0
- package/src/freshness/hash.js +45 -0
- package/src/freshness/inbox.js +163 -0
- package/src/freshness/index.js +20 -0
- package/src/freshness/investigation.js +474 -0
- package/src/freshness/keys.js +177 -0
- package/src/freshness/ledger.js +122 -0
- package/src/freshness/outbox.js +131 -0
- package/src/freshness/policy.js +599 -0
- package/src/freshness/queue.js +843 -0
- package/src/freshness/read-errors.js +23 -0
- package/src/freshness/render.js +153 -0
- package/src/freshness/runtime.js +113 -0
- package/src/freshness/session-registry-adapter.js +161 -0
- package/src/freshness/state-file-adapter.js +167 -0
- package/src/freshness-runner/build-info.js +139 -0
- package/src/freshness-runner/cli.js +105 -0
- package/src/freshness-runner/run-tick.js +109 -0
- package/src/freshness-runner/stamp.js +57 -0
- package/src/freshness-sources/claude-transcript-adapter.js +211 -0
- package/src/freshness-sources/codex-transcript-adapter.js +33 -0
- package/src/freshness-sources/index.js +8 -0
- package/src/gemini-byok-session.js +292 -0
- package/src/gemini-credentials.js +67 -0
- package/src/gemini-key-safety.js +246 -0
- package/src/gemini-models.js +386 -0
- package/src/handler-utils.js +6 -13
- package/src/handlers/checkpoint-handlers.js +8 -0
- package/src/handlers/folder-trust-handlers.js +90 -0
- package/src/handlers/input-handlers.js +40 -11
- package/src/handlers/principal-admin-handlers.js +229 -0
- package/src/handlers/principal-handlers.js +262 -0
- package/src/handlers/scheduler-handlers.js +4 -4
- package/src/handlers/session-handlers.js +10 -1
- package/src/handlers/settings-handlers.js +42 -8
- package/src/handlers/skills-handlers.js +7 -0
- package/src/history-page.js +8 -0
- package/src/jsonl-reader.js +90 -10
- package/src/jsonl-subprocess-session.js +4 -1
- package/src/logger.js +105 -15
- package/src/mailbox-route.js +102 -0
- package/src/notification-prefs.js +15 -0
- package/src/orchestration/orchestration-manager.js +38 -9
- package/src/orchestration/permission-gate.js +4 -1
- package/src/orchestration/run-record.js +11 -0
- package/src/orchestration/turn-driver.js +151 -33
- package/src/orphan-reaper.js +77 -20
- package/src/outgoing-policy.js +10 -4
- package/src/permission-floor.js +54 -2
- package/src/permission-manager.js +32 -13
- package/src/permission-resolved-by.js +89 -0
- package/src/permission-resolver.js +7 -3
- package/src/platform.js +156 -4
- package/src/principal-audit.js +189 -0
- package/src/principal-binding.js +25 -0
- package/src/principal-brakes.js +21 -0
- package/src/principal-effect.js +101 -0
- package/src/principal-journal.js +905 -0
- package/src/principal-kill-switch.js +183 -0
- package/src/principal-label.js +5 -0
- package/src/principal-pending-permissions.js +177 -0
- package/src/principal-policy.js +1094 -0
- package/src/principal-sessions-snapshot.js +208 -0
- package/src/principal-store.js +488 -0
- package/src/principal-subscriptions.js +283 -0
- package/src/providers.js +2 -0
- package/src/redaction.js +181 -22
- package/src/scheduled-task-store.js +12 -0
- package/src/scheduler.js +304 -17
- package/src/sdk-session.js +60 -7
- package/src/server-cli/push-notification-handler.js +6 -1
- package/src/server-cli.js +30 -1
- package/src/session-ci-watcher.js +210 -37
- package/src/session-manager.js +590 -19
- package/src/session-message-history.js +121 -2
- package/src/session-name-allocator.js +685 -0
- package/src/statusline.js +78 -19
- package/src/summarize-session.js +2 -0
- package/src/turn-outcome.js +5 -2
- package/src/utils/argv-safety.js +29 -0
- package/src/utils/binary-package-manifest.js +57 -15
- package/src/utils/bounded-regex-worker.js +4 -0
- package/src/utils/bounded-regex.js +16 -7
- package/src/utils/pid-liveness.js +47 -0
- package/src/web-task-manager.js +45 -4
- package/src/worktree-gc.js +195 -4
- package/src/ws-auth.js +103 -19
- package/src/ws-broadcaster.js +39 -7
- package/src/ws-client-manager.js +8 -0
- package/src/ws-file-ops/browser.js +35 -3
- package/src/ws-forwarding.js +23 -3
- package/src/ws-handler-context.js +18 -0
- package/src/ws-history.js +79 -12
- package/src/ws-message-handlers.js +10 -2
- package/src/ws-server.js +253 -13
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chroxy agent — manage agent principals (agent-principals.md section 3).
|
|
3
|
+
*
|
|
4
|
+
* chroxy agent grant --label <label> --scope <tier> (--session <id> | --cwd <root>) [--ttl <dur>]
|
|
5
|
+
* chroxy agent list
|
|
6
|
+
* chroxy agent revoke <label-or-principalId>
|
|
7
|
+
* chroxy agent disable --all | --label <label>
|
|
8
|
+
* chroxy agent enable --all | --label <label>
|
|
9
|
+
*
|
|
10
|
+
* `list`, `revoke`, `disable` and `enable` ASK THE RUNNING DAEMON over the strict-primary, loopback-only
|
|
11
|
+
* `principal_admin_*` WebSocket types, with the primary token from connection.json,
|
|
12
|
+
* exactly as `chroxy agent-control` reaches it. The CLI never reads or writes the
|
|
13
|
+
* principal store: the daemon process is the only writer, so daemon and CLI cannot race.
|
|
14
|
+
*
|
|
15
|
+
* `grant` REFUSES until the audit writer and kill switch land (contract section 12
|
|
16
|
+
* landing order): it prints "agent principals not yet enabled" and exits non-zero without
|
|
17
|
+
* contacting the daemon, and no token is generated anywhere.
|
|
18
|
+
*/
|
|
19
|
+
import { PRINCIPALS_NOT_ENABLED_MESSAGE } from '../principal-store.js'
|
|
20
|
+
import { LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
21
|
+
|
|
22
|
+
const out = (s) => process.stdout.write(`${s}\n`)
|
|
23
|
+
const err = (s) => process.stderr.write(`${s}\n`)
|
|
24
|
+
|
|
25
|
+
/** Connect to the local daemon as the primary client; resolves a `{ request, close }` pair. */
|
|
26
|
+
async function connectToLocalDaemon(deps = {}) {
|
|
27
|
+
const resolveLocalConnection = deps.resolveLocalConnection || (await import('../agent-control/local-connection.js')).resolveLocalConnection
|
|
28
|
+
const conn = resolveLocalConnection()
|
|
29
|
+
// #9074/#9229: report the resolver's reason as it is. Every refusal happens before a
|
|
30
|
+
// credential-bearing connection is returned, so no token is used on any of them.
|
|
31
|
+
if (!conn.ok) return { ok: false, reason: conn.reason }
|
|
32
|
+
if (!conn.token) return { ok: false, reason: 'no_token' }
|
|
33
|
+
const { AgentControlClient } = deps.AgentControlClient ? { AgentControlClient: deps.AgentControlClient } : await import('../agent-control/client.js')
|
|
34
|
+
const client = new AgentControlClient({ url: conn.url, token: conn.token, silent: true, deviceName: 'chroxy-agent-cli' })
|
|
35
|
+
try {
|
|
36
|
+
await client.connect()
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return { ok: false, reason: 'unavailable', message: e?.message || 'connect failed' }
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
request: (type, fields) => client.request(type, fields, { replyType: 'principal_admin_result' }),
|
|
43
|
+
close: () => client.close(),
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function reportConnectFailure(result) {
|
|
48
|
+
switch (result.reason) {
|
|
49
|
+
case 'not_running': err('Chroxy server is not running. Start it with `chroxy start`.'); break
|
|
50
|
+
case 'liveness_unverified': err(LIVENESS_UNVERIFIED_MESSAGE); break
|
|
51
|
+
case 'no_token': err('Server is running without an auth token: agent management is unavailable.'); break
|
|
52
|
+
default: err(`Could not reach the daemon: ${result.message || result.reason}`)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function ask(type, fields, deps) {
|
|
57
|
+
const conn = await (deps.connect || connectToLocalDaemon)(deps)
|
|
58
|
+
if (!conn.ok) return { ok: false, transport: true, ...conn }
|
|
59
|
+
try {
|
|
60
|
+
return { ok: true, reply: await conn.request(type, fields) }
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return { ok: false, transport: true, reason: 'unavailable', message: e?.message || 'request failed' }
|
|
63
|
+
} finally {
|
|
64
|
+
try { await conn.close() } catch { /* already closed */ }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function formatWhen(ms) {
|
|
69
|
+
return typeof ms === 'number' && Number.isFinite(ms) ? new Date(ms).toISOString() : '-'
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `chroxy agent grant`. REFUSES, and does not even contact the daemon: until the audit
|
|
74
|
+
* writer and kill switch land there is nothing to ask for, and no token is generated in
|
|
75
|
+
* this process or any other. Always a failure.
|
|
76
|
+
*/
|
|
77
|
+
export async function runAgentGrant(_options = {}, deps = {}) {
|
|
78
|
+
const e = deps.err || err
|
|
79
|
+
e(PRINCIPALS_NOT_ENABLED_MESSAGE)
|
|
80
|
+
return { ok: false, refused: true, reason: 'not_enabled' }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function runAgentList(options = {}, deps = {}) {
|
|
84
|
+
const w = deps.out || out
|
|
85
|
+
const e = deps.err || err
|
|
86
|
+
const result = await ask('principal_admin_list', {}, deps)
|
|
87
|
+
if (!result.ok) { reportConnectFailure(result); return result }
|
|
88
|
+
const reply = result.reply
|
|
89
|
+
if (reply.ok !== true) { e(`Request refused: ${reply.message || reply.code}`); return { ok: false, reply } }
|
|
90
|
+
if (options.json) { w(JSON.stringify(reply.principals, null, 2)); return { ok: true, reply } }
|
|
91
|
+
if (reply.health && reply.health.ok !== true) {
|
|
92
|
+
e(`Principal store is not trusted, every principal is refused: ${reply.health.reason}`)
|
|
93
|
+
return { ok: false, reply, reason: 'store_invalid' }
|
|
94
|
+
}
|
|
95
|
+
if (reply.principals.length === 0) { w('No agent principals.'); return { ok: true, reply } }
|
|
96
|
+
w(`${reply.principals.length} agent principal(s):`)
|
|
97
|
+
for (const p of reply.principals) {
|
|
98
|
+
w(` ${p.label} id=${p.principalId} scope=${p.scope} state=${p.state} expires=${formatWhen(p.expiresAt)}`)
|
|
99
|
+
}
|
|
100
|
+
return { ok: true, reply }
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export async function runAgentRevoke(target, _options = {}, deps = {}) {
|
|
104
|
+
const w = deps.out || out
|
|
105
|
+
const e = deps.err || err
|
|
106
|
+
if (typeof target !== 'string' || target.length === 0) {
|
|
107
|
+
e('Name the principal to revoke: a label or a principal id (see: chroxy agent list).')
|
|
108
|
+
return { ok: false, reason: 'bad_args' }
|
|
109
|
+
}
|
|
110
|
+
// A label never contains an uppercase letter or a dot, and an id may; the daemon
|
|
111
|
+
// resolves a label among live grants and an id exactly, so ask with both selectors
|
|
112
|
+
// off one word: id first, then label.
|
|
113
|
+
let result = await ask('principal_admin_revoke', { principalId: target }, deps)
|
|
114
|
+
if (result.ok && result.reply?.code === 'NOT_FOUND') result = await ask('principal_admin_revoke', { label: target }, deps)
|
|
115
|
+
if (!result.ok) { reportConnectFailure(result); return result }
|
|
116
|
+
const reply = result.reply
|
|
117
|
+
if (reply.ok !== true) { e(`Revoke refused: ${reply.message || reply.code}`); return { ok: false, reply } }
|
|
118
|
+
if (reply.durable === false) {
|
|
119
|
+
e(`${reply.message || 'Revoked, but NOT durable: revoke again once the principal store is writable.'}`)
|
|
120
|
+
return { ok: false, reply, reason: 'not_durable' }
|
|
121
|
+
}
|
|
122
|
+
w(`Revoked ${reply.principalId}${reply.alreadyRevoked ? ' (it was already revoked)' : ''}. Its connections are closed.`)
|
|
123
|
+
return { ok: true, reply }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** `--all` xor `--label <label>`. Returns the request fields or null. */
|
|
127
|
+
function switchFields(options) {
|
|
128
|
+
const hasAll = options?.all === true
|
|
129
|
+
const hasLabel = typeof options?.label === 'string' && options.label.length > 0
|
|
130
|
+
if (hasAll === hasLabel) return null
|
|
131
|
+
return hasAll ? { all: true } : { label: options.label }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function describeSwitch(fields) {
|
|
135
|
+
return fields.all === true ? 'every agent principal' : `agent principals labelled ${fields.label}`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* `chroxy agent disable --all | --label <label>`: the persistent kill switch. The daemon
|
|
140
|
+
* flips it in memory, persists it, then acknowledges; the exit status is non-zero when the
|
|
141
|
+
* switch could not be confirmed durable (it is still ON in the running daemon).
|
|
142
|
+
*/
|
|
143
|
+
export async function runAgentDisable(options = {}, deps = {}) {
|
|
144
|
+
const w = deps.out || out
|
|
145
|
+
const e = deps.err || err
|
|
146
|
+
const fields = switchFields(options)
|
|
147
|
+
if (fields === null) {
|
|
148
|
+
e('Name what to disable: --all, or --label <label> (not both).')
|
|
149
|
+
return { ok: false, reason: 'bad_args' }
|
|
150
|
+
}
|
|
151
|
+
const result = await ask('principal_admin_disable', fields, deps)
|
|
152
|
+
if (!result.ok) { reportConnectFailure(result); return result }
|
|
153
|
+
const reply = result.reply
|
|
154
|
+
if (reply.ok !== true) { e(`Disable refused: ${reply.message || reply.code}`); return { ok: false, reply } }
|
|
155
|
+
if (reply.durable === false) {
|
|
156
|
+
e(`${reply.message || 'Disabled, but NOT durable: disable again once the config directory is writable.'}`)
|
|
157
|
+
return { ok: false, reply, reason: 'not_durable' }
|
|
158
|
+
}
|
|
159
|
+
w(`Disabled ${describeSwitch(fields)} (durable). Their connections are closed; re-enable with: chroxy agent enable ${fields.all ? '--all' : `--label ${fields.label}`}`)
|
|
160
|
+
return { ok: true, reply }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** `chroxy agent enable --all | --label <label>`: explicit re-enable; never automatic. */
|
|
164
|
+
export async function runAgentEnable(options = {}, deps = {}) {
|
|
165
|
+
const w = deps.out || out
|
|
166
|
+
const e = deps.err || err
|
|
167
|
+
const fields = switchFields(options)
|
|
168
|
+
if (fields === null) {
|
|
169
|
+
e('Name what to enable: --all, or --label <label> (not both).')
|
|
170
|
+
return { ok: false, reason: 'bad_args' }
|
|
171
|
+
}
|
|
172
|
+
const result = await ask('principal_admin_enable', fields, deps)
|
|
173
|
+
if (!result.ok) { reportConnectFailure(result); return result }
|
|
174
|
+
const reply = result.reply
|
|
175
|
+
if (reply.ok !== true) { e(`Enable refused: ${reply.message || reply.code}`); return { ok: false, reply } }
|
|
176
|
+
if (reply.durable === false) {
|
|
177
|
+
e(`${reply.message || 'Enabled, but NOT durable.'}`)
|
|
178
|
+
return { ok: false, reply, reason: 'not_durable' }
|
|
179
|
+
}
|
|
180
|
+
w(`Enabled ${describeSwitch(fields)} (durable).`)
|
|
181
|
+
return { ok: true, reply }
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function registerAgentCommand(program) {
|
|
185
|
+
const agent = program.command('agent').description('Manage agent principals: scoped, revocable credentials for a supervisor agent (agent-principals.md)')
|
|
186
|
+
|
|
187
|
+
agent
|
|
188
|
+
.command('grant')
|
|
189
|
+
.description('Grant a principal (refuses until agent principals are enabled)')
|
|
190
|
+
.option('--label <label>', 'Operator label, ^[a-z0-9_-]{1,32}$')
|
|
191
|
+
.option('--scope <tier>', 'observe | steer | drive | answer')
|
|
192
|
+
.option('--session <id>', 'Limit the grant to one session id')
|
|
193
|
+
.option('--cwd <root>', 'Limit the grant to sessions under a working-directory root')
|
|
194
|
+
.option('--ttl <dur>', 'Lifetime, at most 7 days (default 24h)')
|
|
195
|
+
.action(async (options) => {
|
|
196
|
+
await runAgentGrant(options)
|
|
197
|
+
process.exitCode = 1
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
agent
|
|
201
|
+
.command('list')
|
|
202
|
+
.description('List agent principals and their state')
|
|
203
|
+
.option('--json', 'Output machine-readable JSON')
|
|
204
|
+
.action(async (options) => {
|
|
205
|
+
const r = await runAgentList(options)
|
|
206
|
+
if (!r.ok) process.exitCode = 1
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
agent
|
|
210
|
+
.command('revoke <principal>')
|
|
211
|
+
.description('Revoke a principal by label or principal id, and close its connections')
|
|
212
|
+
.action(async (principal, options) => {
|
|
213
|
+
const r = await runAgentRevoke(principal, options)
|
|
214
|
+
if (!r.ok) process.exitCode = 1
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
agent
|
|
218
|
+
.command('disable')
|
|
219
|
+
.description('Kill switch: disable every agent principal (--all) or one label (--label), persistently, and close their connections')
|
|
220
|
+
.option('--all', 'Disable every agent principal')
|
|
221
|
+
.option('--label <label>', 'Disable the principals carrying this label')
|
|
222
|
+
.action(async (options) => {
|
|
223
|
+
const r = await runAgentDisable(options)
|
|
224
|
+
if (!r.ok) process.exitCode = 1
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
agent
|
|
228
|
+
.command('enable')
|
|
229
|
+
.description('Re-enable disabled agent principals (--all or --label); never automatic')
|
|
230
|
+
.option('--all', 'Re-enable every agent principal')
|
|
231
|
+
.option('--label <label>', 'Re-enable the principals carrying this label')
|
|
232
|
+
.action(async (options) => {
|
|
233
|
+
const r = await runAgentEnable(options)
|
|
234
|
+
if (!r.ok) process.exitCode = 1
|
|
235
|
+
})
|
|
236
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared by the CLIs that read connection.json (#9229). Gives each one the reason a
|
|
3
|
+
* record was withheld, without changing what is allowed: `info` is non-null only for a
|
|
4
|
+
* verified-alive pid, exactly as `readConnectionInfo()` (see ../connection-info.js).
|
|
5
|
+
*/
|
|
6
|
+
import { CONNECTION_ALIVE, CONNECTION_NO_RECORD, CONNECTION_DEAD, CONNECTION_LIVENESS_UNVERIFIED } from '../connection-info.js'
|
|
7
|
+
|
|
8
|
+
export const LIVENESS_UNVERIFIED_REASON = CONNECTION_LIVENESS_UNVERIFIED
|
|
9
|
+
|
|
10
|
+
export const LIVENESS_UNVERIFIED_MESSAGE =
|
|
11
|
+
'Could not verify that the Chroxy daemon in connection.json is running: the record has no valid pid, '
|
|
12
|
+
+ 'or that pid could not be inspected from here (for example inside a sandbox). '
|
|
13
|
+
+ 'Its token was not used, and the record was left in place.'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Injected readers (`deps.readConnectionState`, `deps.readConnectionInfo`) are TEST
|
|
17
|
+
* seams and are trusted as given; production always uses the verifying reader, and no
|
|
18
|
+
* production caller injects one.
|
|
19
|
+
*
|
|
20
|
+
* Test seams, in priority order: `deps.readConnectionState` (returns `{ info, reason }`),
|
|
21
|
+
* then the legacy `deps.readConnectionInfo` (null reads as `no_record`; it cannot say
|
|
22
|
+
* "unverified"). Production uses the real `readConnectionState`.
|
|
23
|
+
*
|
|
24
|
+
* @returns {Promise<{ info: object|null, reason: string }>}
|
|
25
|
+
*/
|
|
26
|
+
export async function readCliConnectionState(deps = {}) {
|
|
27
|
+
if (typeof deps.readConnectionState === 'function') {
|
|
28
|
+
const state = await deps.readConnectionState()
|
|
29
|
+
// Fail closed: a record only counts when the state says it was verified alive.
|
|
30
|
+
return state && state.reason === CONNECTION_ALIVE && state.info
|
|
31
|
+
? state
|
|
32
|
+
: { info: null, reason: state?.reason ?? null }
|
|
33
|
+
}
|
|
34
|
+
if (typeof deps.readConnectionInfo === 'function') {
|
|
35
|
+
const info = deps.readConnectionInfo()
|
|
36
|
+
return info ? { info, reason: CONNECTION_ALIVE } : { info: null, reason: CONNECTION_NO_RECORD }
|
|
37
|
+
}
|
|
38
|
+
return (await import('../connection-info.js')).readConnectionState()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `not_running` or `liveness_unverified`, for a state whose `info` is null. Fail-safe:
|
|
43
|
+
* only a known "no daemon" reason (`no_record`, `dead`) reads as `not_running`; a
|
|
44
|
+
* missing, unknown or future reason reads as "could not verify".
|
|
45
|
+
*/
|
|
46
|
+
export function withheldReason(state) {
|
|
47
|
+
const reason = state?.reason
|
|
48
|
+
return reason === CONNECTION_NO_RECORD || reason === CONNECTION_DEAD ? 'not_running' : 'liveness_unverified'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A failed CLI result for a withheld record; `connectionReason` is the raw reader reason (for --json). */
|
|
52
|
+
export function withheldResult(state) {
|
|
53
|
+
return { ok: false, reason: withheldReason(state), connectionReason: state?.reason ?? null }
|
|
54
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chroxy freshness` — the session freshness reconciler's runner (#9282).
|
|
3
|
+
*
|
|
4
|
+
* `tick` runs one read-only tick over the daemon's state file, the Claude
|
|
5
|
+
* Code session registry and the Claude transcripts, then exits. `stamp`
|
|
6
|
+
* records the commit of a pinned install. Both delegate to the runner, which
|
|
7
|
+
* a timer can also start directly without this CLI (docs/guides/freshness-runner.md).
|
|
8
|
+
*/
|
|
9
|
+
/* Usage errors are the runner's to report (exit 2), so the options here are not
|
|
10
|
+
* required and unknown ones are passed through to its strict parser. */
|
|
11
|
+
export function registerFreshnessCommand(program) {
|
|
12
|
+
const freshness = program.command('freshness').description('Session freshness reconciler: run one read-only tick, or stamp a pinned install')
|
|
13
|
+
freshness
|
|
14
|
+
.command('tick')
|
|
15
|
+
.description('Run one read-only tick and exit')
|
|
16
|
+
.option('--ledger-dir <dir>', 'ledger directory; must be outside the daemon state directory (required)')
|
|
17
|
+
.option('--state-file <file>', "the daemon's session-state file (default: <config dir>/session-state.json)")
|
|
18
|
+
.option('--registry-dir <dir>', 'Claude Code session registry (default: <claude config dir>/sessions)')
|
|
19
|
+
.option('--projects-dir <dir>', 'Claude transcripts root (default: <claude config dir>/projects)')
|
|
20
|
+
.option('--cadence-minutes <n>', 'tick cadence; the timer period should match')
|
|
21
|
+
.option('--lease-minutes <n>', 'writer lease; must exceed the cadence')
|
|
22
|
+
.option('--ledger-id <id>', 'ledger identity')
|
|
23
|
+
.option('--mode <mode>', 'read-only is the only mode')
|
|
24
|
+
.option('--allow-dev-checkout', 'run from a development checkout (not for a timer)')
|
|
25
|
+
.allowUnknownOption()
|
|
26
|
+
.allowExcessArguments()
|
|
27
|
+
.action(async (options, cmd) => {
|
|
28
|
+
const { main } = await import('../freshness-runner/cli.js')
|
|
29
|
+
process.exitCode = main(['tick', ...toArgs(options), ...cmd.args])
|
|
30
|
+
})
|
|
31
|
+
freshness
|
|
32
|
+
.command('stamp')
|
|
33
|
+
.description('Record the commit of a pinned install in its package directory')
|
|
34
|
+
.option('--commit <sha>', 'full 40-character commit id the install was built from (required)')
|
|
35
|
+
.option('--package-dir <dir>', 'installed daemon package directory (default: this package)')
|
|
36
|
+
.option('--force', 'replace a different existing stamp')
|
|
37
|
+
.allowUnknownOption()
|
|
38
|
+
.allowExcessArguments()
|
|
39
|
+
.action(async (options, cmd) => {
|
|
40
|
+
const { main } = await import('../freshness-runner/cli.js')
|
|
41
|
+
process.exitCode = main(['stamp', ...toArgs(options), ...cmd.args])
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function toArgs(options) {
|
|
46
|
+
const args = []
|
|
47
|
+
for (const [key, value] of Object.entries(options)) {
|
|
48
|
+
if (value === undefined || value === false) continue
|
|
49
|
+
const flag = '--' + key.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase())
|
|
50
|
+
args.push(value === true ? flag : `${flag}=${value}`)
|
|
51
|
+
}
|
|
52
|
+
return args
|
|
53
|
+
}
|
package/src/cli/pages-cmd.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* daemon's public `httpUrl` (the tunnel/LAN base) so it opens on any device.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { readCliConnectionState, withheldResult, LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
16
|
+
|
|
15
17
|
import { basename } from 'path'
|
|
16
18
|
|
|
17
19
|
function portFromUrl(url) {
|
|
@@ -26,13 +28,11 @@ function trimSlash(s) {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async function daemonRequest(method, path, deps, { body } = {}) {
|
|
29
|
-
const readConnectionInfo =
|
|
30
|
-
deps.readConnectionInfo || (await import('../connection-info.js')).readConnectionInfo
|
|
31
31
|
const fetchFn = deps.fetchFn || globalThis.fetch
|
|
32
32
|
const defaultPort = deps.defaultPort || 8765
|
|
33
33
|
|
|
34
|
-
const info =
|
|
35
|
-
if (!info) return
|
|
34
|
+
const { info, ...state } = await readCliConnectionState(deps)
|
|
35
|
+
if (!info) return withheldResult(state)
|
|
36
36
|
if (!info.apiToken) return { ok: false, reason: 'no_token' }
|
|
37
37
|
// Prefer the explicit local `port` (#5683) — in tunnel mode httpUrl/wsUrl are
|
|
38
38
|
// public URLs with no :port to parse, so without this the loopback request
|
|
@@ -64,6 +64,8 @@ async function daemonRequest(method, path, deps, { body } = {}) {
|
|
|
64
64
|
function reportFailure(result, writeErr) {
|
|
65
65
|
if (result.reason === 'not_running') {
|
|
66
66
|
writeErr('Chroxy server is not running. Start it with `chroxy start`.')
|
|
67
|
+
} else if (result.reason === 'liveness_unverified') {
|
|
68
|
+
writeErr(LIVENESS_UNVERIFIED_MESSAGE)
|
|
67
69
|
} else if (result.reason === 'no_token') {
|
|
68
70
|
writeErr('Server is running without an auth token — publishing is unavailable.')
|
|
69
71
|
} else {
|
package/src/cli/pair-code-cmd.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* (possibly extended) remaining window.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { readCliConnectionState, withheldResult, LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
18
|
+
|
|
17
19
|
function portFromUrl(url) {
|
|
18
20
|
if (typeof url !== 'string') return null
|
|
19
21
|
const m = url.match(/:(\d+)(?:\/|$)/)
|
|
@@ -27,17 +29,14 @@ function portFromUrl(url) {
|
|
|
27
29
|
* @param {function} [deps.fetchFn]
|
|
28
30
|
* @param {number} [deps.defaultPort]
|
|
29
31
|
* @returns {Promise<{ ok: true, code: string, url: string|null, expiresInSeconds: number, wsUrl: string|null }
|
|
30
|
-
* | { ok: false, reason: 'not_running'|'no_token'|'unavailable', message?: string }>}
|
|
32
|
+
* | { ok: false, reason: 'not_running'|'liveness_unverified'|'no_token'|'unavailable', message?: string }>}
|
|
31
33
|
*/
|
|
32
34
|
export async function fetchPairingCode(deps = {}) {
|
|
33
|
-
const readConnectionInfo =
|
|
34
|
-
deps.readConnectionInfo ||
|
|
35
|
-
(await import('../connection-info.js')).readConnectionInfo
|
|
36
35
|
const fetchFn = deps.fetchFn || globalThis.fetch
|
|
37
36
|
const defaultPort = deps.defaultPort || 8765
|
|
38
37
|
|
|
39
|
-
const info =
|
|
40
|
-
if (!info) return
|
|
38
|
+
const { info, ...state } = await readCliConnectionState(deps)
|
|
39
|
+
if (!info) return withheldResult(state)
|
|
41
40
|
if (!info.apiToken) return { ok: false, reason: 'no_token' }
|
|
42
41
|
|
|
43
42
|
const port = portFromUrl(info.httpUrl) || portFromUrl(info.wsUrl) || defaultPort
|
|
@@ -85,6 +84,8 @@ export async function runPairCodeCmd(options = {}, deps = {}) {
|
|
|
85
84
|
if (!result.ok) {
|
|
86
85
|
if (result.reason === 'not_running') {
|
|
87
86
|
writeErr('Chroxy server is not running. Start it with `chroxy start`.')
|
|
87
|
+
} else if (result.reason === 'liveness_unverified') {
|
|
88
|
+
writeErr(LIVENESS_UNVERIFIED_MESSAGE)
|
|
88
89
|
} else if (result.reason === 'no_token') {
|
|
89
90
|
writeErr('Server is running without an auth token — pairing codes are unavailable.')
|
|
90
91
|
} else {
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* webhook not configured, post failed) with a legible reason.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import { readCliConnectionState, withheldResult, LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
17
|
+
|
|
16
18
|
function portFromUrl(url) {
|
|
17
19
|
if (typeof url !== 'string') return null
|
|
18
20
|
const m = url.match(/:(\d+)(?:\/|$)/)
|
|
@@ -26,17 +28,14 @@ function portFromUrl(url) {
|
|
|
26
28
|
* @param {function} [deps.fetchFn]
|
|
27
29
|
* @param {number} [deps.defaultPort]
|
|
28
30
|
* @returns {Promise<{ ok: true, expiresInSeconds: number }
|
|
29
|
-
* | { ok: false, reason: 'not_running'|'no_token'|'not_configured'|'post_failed'|'unavailable', message?: string }>}
|
|
31
|
+
* | { ok: false, reason: 'not_running'|'liveness_unverified'|'no_token'|'not_configured'|'post_failed'|'unavailable', message?: string }>}
|
|
30
32
|
*/
|
|
31
33
|
export async function postPairDiscord(deps = {}) {
|
|
32
|
-
const readConnectionInfo =
|
|
33
|
-
deps.readConnectionInfo ||
|
|
34
|
-
(await import('../connection-info.js')).readConnectionInfo
|
|
35
34
|
const fetchFn = deps.fetchFn || globalThis.fetch
|
|
36
35
|
const defaultPort = deps.defaultPort || 8765
|
|
37
36
|
|
|
38
|
-
const info =
|
|
39
|
-
if (!info) return
|
|
37
|
+
const { info, ...state } = await readCliConnectionState(deps)
|
|
38
|
+
if (!info) return withheldResult(state)
|
|
40
39
|
if (!info.apiToken) return { ok: false, reason: 'no_token' }
|
|
41
40
|
|
|
42
41
|
const port = portFromUrl(info.httpUrl) || portFromUrl(info.wsUrl) || defaultPort
|
|
@@ -77,6 +76,8 @@ export async function runPairDiscordCmd(_options = {}, deps = {}) {
|
|
|
77
76
|
}
|
|
78
77
|
if (result.reason === 'not_running') {
|
|
79
78
|
writeErr('Chroxy server is not running. Start it with `chroxy start`.')
|
|
79
|
+
} else if (result.reason === 'liveness_unverified') {
|
|
80
|
+
writeErr(LIVENESS_UNVERIFIED_MESSAGE)
|
|
80
81
|
} else if (result.reason === 'no_token') {
|
|
81
82
|
writeErr('Server is running without an auth token — pairing is unavailable.')
|
|
82
83
|
} else if (result.reason === 'not_configured') {
|
package/src/cli/schedule-cmd.js
CHANGED
|
@@ -109,6 +109,10 @@ function getDefaultStore() {
|
|
|
109
109
|
return store
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/** Honest wording for a refusal on the CLI-resolved default (#9178). */
|
|
113
|
+
const CONFIGURED_DEFAULT_CLAUSE = (name) =>
|
|
114
|
+
`'${name}' is the configured default (config/env), which a task with no target.provider falls back to; a daemon started with --provider or a different CHROXY_PROVIDER may use another default.`
|
|
115
|
+
|
|
112
116
|
/**
|
|
113
117
|
* Build the dependency bag every exported command function runs against.
|
|
114
118
|
* Every dependency is overridable so tests never touch the real
|
|
@@ -117,6 +121,16 @@ function getDefaultStore() {
|
|
|
117
121
|
*/
|
|
118
122
|
function buildDeps(overrides = {}) {
|
|
119
123
|
const config = readConfigSoft(configFile())
|
|
124
|
+
// #9178: resolved from the config/env tiers only. `chroxy schedule`
|
|
125
|
+
// deliberately stays offline (it operates on the store and needs no running
|
|
126
|
+
// daemon), so it reports the CONFIGURED default and never claims to know the
|
|
127
|
+
// daemon's. A daemon started with `--provider X`, or with a different
|
|
128
|
+
// `CHROXY_PROVIDER` in its own environment, can default elsewhere. The
|
|
129
|
+
// running daemon does expose its default over the authenticated WebSocket
|
|
130
|
+
// path (`auth_bootstrap.defaultProvider`, `list_providers`); reading it from
|
|
131
|
+
// here is tracked as a follow-up (#9201).
|
|
132
|
+
const defaultProviderName = overrides.defaultProviderName
|
|
133
|
+
|| resolveDaemonDefaultProvider(mergeConfig({ fileConfig: config }))
|
|
120
134
|
return {
|
|
121
135
|
store: overrides.store || getDefaultStore(),
|
|
122
136
|
write: overrides.write || console.log,
|
|
@@ -135,9 +149,17 @@ function buildDeps(overrides = {}) {
|
|
|
135
149
|
// here is fed in as the FILE tier only; there is no CLI tier for this
|
|
136
150
|
// value (an explicit `overrides.defaultProviderName`, when present, wins
|
|
137
151
|
// outright and never reaches mergeConfig at all).
|
|
138
|
-
defaultProviderName
|
|
139
|
-
|
|
140
|
-
|
|
152
|
+
defaultProviderName,
|
|
153
|
+
checkProviderRefusal: overrides.checkProviderRefusal
|
|
154
|
+
|| ((name) => {
|
|
155
|
+
// `null`, not the configured default: the scheduler's own clause says
|
|
156
|
+
// "the daemon DEFAULT", which only the daemon can know (#9178).
|
|
157
|
+
const reason = scheduledProviderRefusalReason(name, undefined, null)
|
|
158
|
+
if (reason && typeof defaultProviderName === 'string' && name === defaultProviderName) {
|
|
159
|
+
return `${reason} ${CONFIGURED_DEFAULT_CLAUSE(name)}`
|
|
160
|
+
}
|
|
161
|
+
return reason
|
|
162
|
+
}),
|
|
141
163
|
resolvePermissionMode: overrides.resolvePermissionMode || resolveScheduledPermissionMode,
|
|
142
164
|
checkSchedulerEnabled: overrides.checkSchedulerEnabled || (() => isSchedulerEnabled(config)),
|
|
143
165
|
}
|
package/src/cli/server-cmd.js
CHANGED
|
@@ -35,6 +35,7 @@ export function registerServerCommands(program) {
|
|
|
35
35
|
// 30s for the tunnel timeout. Skip when tunnel is disabled
|
|
36
36
|
// (--no-auth, externalUrl) since cloudflared isn't needed.
|
|
37
37
|
const needsTunnel = !!parsedTunnel && !config.noAuth && !config.externalUrl
|
|
38
|
+
let warningCount = 0
|
|
38
39
|
if (!options.skipChecks) {
|
|
39
40
|
const port = config.port || 8765
|
|
40
41
|
// #8074 review C1: resolve the binary-provenance gate from the SAME
|
|
@@ -98,6 +99,7 @@ export function registerServerCommands(program) {
|
|
|
98
99
|
process.exitCode = 1
|
|
99
100
|
return
|
|
100
101
|
}
|
|
102
|
+
warningCount = checks.filter((c) => c.status === 'warn').length
|
|
101
103
|
}
|
|
102
104
|
// #7162: bound the service-manager capture files exactly once per
|
|
103
105
|
// service boot — here, in the process the service manager spawned,
|
|
@@ -114,6 +116,10 @@ export function registerServerCommands(program) {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
if (warningCount > 0) {
|
|
120
|
+
console.warn(`${warningCount} preflight warning${warningCount === 1 ? '' : 's'} — run \`chroxy doctor\` for details.`)
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
const useSupervisor = !!parsedTunnel
|
|
118
124
|
&& !config.noAuth
|
|
119
125
|
&& !config.externalUrl
|
package/src/cli/shell-cmd.js
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
* approval can only ever originate from the host machine, never over the tunnel.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { readCliConnectionState, withheldResult, LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
15
|
+
|
|
14
16
|
async function approvalRequest(method, path, deps = {}) {
|
|
15
|
-
const readConnectionInfo =
|
|
16
|
-
deps.readConnectionInfo || (await import('../connection-info.js')).readConnectionInfo
|
|
17
17
|
const readShellApprovalInfo =
|
|
18
18
|
deps.readShellApprovalInfo || (await import('../shell-approval-info.js')).readShellApprovalInfo
|
|
19
19
|
const fetchFn = deps.fetchFn || globalThis.fetch
|
|
20
20
|
|
|
21
|
-
const conn =
|
|
22
|
-
if (!conn) return
|
|
21
|
+
const { info: conn, ...state } = await readCliConnectionState(deps)
|
|
22
|
+
if (!conn) return withheldResult(state)
|
|
23
23
|
if (!conn.apiToken) return { ok: false, reason: 'no_token' }
|
|
24
24
|
const approval = readShellApprovalInfo()
|
|
25
25
|
if (!approval || !Number.isInteger(approval.port)) return { ok: false, reason: 'approval_disabled' }
|
|
@@ -47,6 +47,9 @@ function reportFailure(result, writeErr) {
|
|
|
47
47
|
case 'not_running':
|
|
48
48
|
writeErr('Chroxy server is not running. Start it with `chroxy start`.')
|
|
49
49
|
break
|
|
50
|
+
case 'liveness_unverified':
|
|
51
|
+
writeErr(LIVENESS_UNVERIFIED_MESSAGE)
|
|
52
|
+
break
|
|
50
53
|
case 'no_token':
|
|
51
54
|
writeErr('Server is running without an auth token — shell approval is unavailable.')
|
|
52
55
|
break
|
package/src/cli/status-cmd.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* is stale-checked via PID, then pings the local HTTP health endpoint.
|
|
7
7
|
*/
|
|
8
8
|
import { createRequire } from 'module'
|
|
9
|
+
import { readCliConnectionState, withheldReason, LIVENESS_UNVERIFIED_MESSAGE } from './connection-state.js'
|
|
9
10
|
|
|
10
11
|
const require = createRequire(import.meta.url)
|
|
11
12
|
const { version: CLI_VERSION } = require('../../package.json')
|
|
@@ -43,19 +44,22 @@ function portFromUrl(url) {
|
|
|
43
44
|
* Collect status information. Exposed for testing.
|
|
44
45
|
* @param {object} [deps]
|
|
45
46
|
* @param {function} [deps.readConnectionInfo]
|
|
47
|
+
* @param {function} [deps.readConnectionState] - `{ info, reason }`; preferred over readConnectionInfo
|
|
46
48
|
* @param {function} [deps.fetchFn]
|
|
47
49
|
* @param {number} [deps.defaultPort]
|
|
48
50
|
*/
|
|
49
51
|
export async function collectStatus(deps = {}) {
|
|
50
|
-
const readConnectionInfo =
|
|
51
|
-
deps.readConnectionInfo ||
|
|
52
|
-
(await import('../connection-info.js')).readConnectionInfo
|
|
53
52
|
const fetchFn = deps.fetchFn || globalThis.fetch
|
|
54
53
|
const defaultPort = deps.defaultPort || 8765
|
|
55
54
|
|
|
56
55
|
const out = {
|
|
57
56
|
version: CLI_VERSION,
|
|
58
57
|
running: false,
|
|
58
|
+
// #9229: true when connection.json exists but its pid could not be verified. The
|
|
59
|
+
// record's token is NOT used in that case; `running` is then decided by the
|
|
60
|
+
// unauthenticated health ping alone.
|
|
61
|
+
livenessUnverified: false,
|
|
62
|
+
connectionReason: null, // raw reader reason (alive|no_record|dead|liveness_unverified|...)
|
|
59
63
|
pid: null,
|
|
60
64
|
port: null,
|
|
61
65
|
tunnel: null,
|
|
@@ -65,7 +69,9 @@ export async function collectStatus(deps = {}) {
|
|
|
65
69
|
counters: null, // populated by --verbose via /metrics
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
const info =
|
|
72
|
+
const { info, reason } = await readCliConnectionState(deps)
|
|
73
|
+
out.connectionReason = reason ?? null
|
|
74
|
+
out.livenessUnverified = !info && withheldReason({ reason }) === 'liveness_unverified'
|
|
69
75
|
if (info) {
|
|
70
76
|
out.pid = info.pid ?? null
|
|
71
77
|
out.port =
|
|
@@ -145,13 +151,21 @@ function printHuman(status) {
|
|
|
145
151
|
lines.push(`Chroxy v${status.version}`)
|
|
146
152
|
lines.push('')
|
|
147
153
|
if (!status.running) {
|
|
148
|
-
|
|
154
|
+
if (status.livenessUnverified) {
|
|
155
|
+
lines.push('Status: Could not verify')
|
|
156
|
+
lines.push(LIVENESS_UNVERIFIED_MESSAGE)
|
|
157
|
+
} else {
|
|
158
|
+
lines.push('Status: Not running')
|
|
159
|
+
}
|
|
149
160
|
lines.push('')
|
|
150
161
|
return lines.join('\n')
|
|
151
162
|
}
|
|
152
163
|
lines.push(
|
|
153
164
|
`Status: Running${status.pid ? ` (pid ${status.pid})` : ''}`
|
|
154
165
|
)
|
|
166
|
+
if (status.livenessUnverified) {
|
|
167
|
+
lines.push(' The connection record could not be verified; its token was not used, so metrics are unavailable.')
|
|
168
|
+
}
|
|
155
169
|
if (status.port != null) lines.push(`Port: ${status.port}`)
|
|
156
170
|
if (status.tunnel?.url) {
|
|
157
171
|
lines.push(`Tunnel: ${status.tunnel.url} (${status.tunnel.type})`)
|