@indigoai-us/hq-cli 5.133.0 → 5.135.0
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 +30 -0
- package/dist/command-catalog.generated.d.ts +40 -0
- package/dist/command-catalog.generated.js +52 -0
- package/dist/commands/agent-kit.d.ts +2 -0
- package/dist/commands/agent-kit.js +4 -1
- package/dist/commands/lanes.d.ts +4 -2
- package/dist/commands/lanes.js +150 -2
- package/dist/lib/agent-kit/run/heartbeat.d.ts +14 -2
- package/dist/lib/agent-kit/run/heartbeat.js +38 -6
- package/dist/lib/bot/api.d.ts +3 -1
- package/dist/lib/bot/api.js +7 -2
- package/dist/lib/bot/run.d.ts +4 -0
- package/dist/lib/bot/run.js +30 -1
- package/dist/lib/bot/status.d.ts +4 -0
- package/dist/lib/doctor/checks/bots.js +4 -1
- package/dist/lib/heartbeat-identity.d.ts +29 -0
- package/dist/lib/heartbeat-identity.js +71 -0
- package/dist/lib/lanes/config.d.ts +7 -0
- package/dist/lib/lanes/config.js +28 -1
- package/dist/lib/lanes/index.d.ts +5 -1
- package/dist/lib/lanes/index.js +3 -1
- package/dist/lib/lanes/monitor.d.ts +48 -0
- package/dist/lib/lanes/monitor.js +409 -0
- package/dist/lib/lanes/spawn.d.ts +10 -1
- package/dist/lib/lanes/spawn.js +60 -5
- package/dist/lib/lanes/types.d.ts +6 -0
- package/dist/lib/lanes/types.js +1 -1
- package/dist/lib/lanes/watch.d.ts +22 -0
- package/dist/lib/lanes/watch.js +122 -0
- package/package.json +1 -1
|
@@ -76,11 +76,14 @@ function runChecks(deps) {
|
|
|
76
76
|
const status = readBotStatus(dir);
|
|
77
77
|
const alive = !!status && status.state === "running" && isPidAlive(status.pid);
|
|
78
78
|
if (alive && status.lastHeartbeatOk === false) {
|
|
79
|
+
const heartbeatMessage = status.lastHeartbeatReason === "identity_mismatch"
|
|
80
|
+
? `${name} heartbeat stopped: identity mismatch (configured agent ${status.lastHeartbeatConfiguredAgentUid ?? config.agentUid}; token agent ${status.lastHeartbeatTokenAgentUid ?? "unknown"}).`
|
|
81
|
+
: `${name} is running but cannot heartbeat to HQ${status.lastHeartbeatError ? ` (${status.lastHeartbeatError})` : ""}.`;
|
|
79
82
|
results.push({
|
|
80
83
|
status: "FAIL",
|
|
81
84
|
checkId: `bots.${name}.heartbeat`,
|
|
82
85
|
target: dir,
|
|
83
|
-
message:
|
|
86
|
+
message: heartbeatMessage,
|
|
84
87
|
remediation: `hq bot logs ${name}`,
|
|
85
88
|
});
|
|
86
89
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CaptureContext } from "@sentry/node";
|
|
2
|
+
export declare const HEARTBEAT_IDENTITY_MISMATCH_CODE = "AGENT_IDENTITY_MISMATCH";
|
|
3
|
+
export type HeartbeatRunner = "agent-kit" | "bot";
|
|
4
|
+
export type HeartbeatAgentUidSource = "config_file" | "env" | "flag";
|
|
5
|
+
export type HeartbeatCredsSource = "explicit" | "default";
|
|
6
|
+
export interface HeartbeatFailure {
|
|
7
|
+
status: number;
|
|
8
|
+
code?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HeartbeatIdentityMismatchContext {
|
|
12
|
+
runner: HeartbeatRunner;
|
|
13
|
+
configuredAgentUid: string;
|
|
14
|
+
tokenAgentUid?: string;
|
|
15
|
+
agentUidSource: HeartbeatAgentUidSource;
|
|
16
|
+
credsSource: HeartbeatCredsSource;
|
|
17
|
+
}
|
|
18
|
+
export type HeartbeatIdentityMismatchReporter = (context: HeartbeatIdentityMismatchContext) => void;
|
|
19
|
+
/** Parse only the bounded fields the heartbeat route uses for classification. */
|
|
20
|
+
export declare function parseHeartbeatFailureBody(bodyText: string | undefined): {
|
|
21
|
+
code?: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Match the server's registered code/name, never an arbitrary 403. */
|
|
25
|
+
export declare function isHeartbeatIdentityMismatch(failure: HeartbeatFailure): boolean;
|
|
26
|
+
/** Read the agent uid claim for diagnostics only; this never authorizes a call. */
|
|
27
|
+
export declare function tokenAgentUid(token: string): string | undefined;
|
|
28
|
+
export declare function captureHeartbeatIdentityMismatch(context: HeartbeatIdentityMismatchContext, captureMessage?: (message: string, context: CaptureContext) => string): void;
|
|
29
|
+
//# sourceMappingURL=heartbeat-identity.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CLI_VERSION } from "../cli-version.js";
|
|
2
|
+
import { Sentry } from "../sentry.js";
|
|
3
|
+
import { peekIdToken } from "../utils/id-token.js";
|
|
4
|
+
export const HEARTBEAT_IDENTITY_MISMATCH_CODE = "AGENT_IDENTITY_MISMATCH";
|
|
5
|
+
const AGENT_UID_RE = /^agt_[A-Za-z0-9_-]{1,100}$/;
|
|
6
|
+
function normalize(value) {
|
|
7
|
+
return (value ?? "").replace(/[^A-Za-z0-9]/g, "").toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
function safeAgentUid(value) {
|
|
10
|
+
return typeof value === "string" && AGENT_UID_RE.test(value) ? value : undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Parse only the bounded fields the heartbeat route uses for classification. */
|
|
13
|
+
export function parseHeartbeatFailureBody(bodyText) {
|
|
14
|
+
if (!bodyText)
|
|
15
|
+
return {};
|
|
16
|
+
try {
|
|
17
|
+
const body = JSON.parse(bodyText);
|
|
18
|
+
const code = typeof body.code === "string" ? body.code.slice(0, 120) : undefined;
|
|
19
|
+
const message = typeof body.error === "string"
|
|
20
|
+
? body.error.slice(0, 300)
|
|
21
|
+
: typeof body.message === "string"
|
|
22
|
+
? body.message.slice(0, 300)
|
|
23
|
+
: undefined;
|
|
24
|
+
return { ...(code ? { code } : {}), ...(message ? { message } : {}) };
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Match the server's registered code/name, never an arbitrary 403. */
|
|
31
|
+
export function isHeartbeatIdentityMismatch(failure) {
|
|
32
|
+
if (failure.status !== 403)
|
|
33
|
+
return false;
|
|
34
|
+
const code = normalize(failure.code);
|
|
35
|
+
if (code === normalize(HEARTBEAT_IDENTITY_MISMATCH_CODE) || code === "agentidentitymismatcherror")
|
|
36
|
+
return true;
|
|
37
|
+
const message = normalize(failure.message);
|
|
38
|
+
return (message.includes("heartbeatmustbereportedbytheagentsownmachineidentity") ||
|
|
39
|
+
message.includes("agentidentitymismatcherror"));
|
|
40
|
+
}
|
|
41
|
+
/** Read the agent uid claim for diagnostics only; this never authorizes a call. */
|
|
42
|
+
export function tokenAgentUid(token) {
|
|
43
|
+
const claims = peekIdToken(token);
|
|
44
|
+
return (safeAgentUid(claims["custom:entityUid"]) ??
|
|
45
|
+
safeAgentUid(claims.entityUid) ??
|
|
46
|
+
safeAgentUid(claims.sub));
|
|
47
|
+
}
|
|
48
|
+
function diagnosticUid(value) {
|
|
49
|
+
return safeAgentUid(value) ?? "unknown";
|
|
50
|
+
}
|
|
51
|
+
function captureHeartbeatIdentityMismatchMessage(message, context) {
|
|
52
|
+
return Sentry.captureMessage(message, context);
|
|
53
|
+
}
|
|
54
|
+
export function captureHeartbeatIdentityMismatch(context, captureMessage = captureHeartbeatIdentityMismatchMessage) {
|
|
55
|
+
const options = {
|
|
56
|
+
level: "warning",
|
|
57
|
+
fingerprint: ["heartbeat-identity-mismatch"],
|
|
58
|
+
tags: {
|
|
59
|
+
agent_uid_source: context.agentUidSource,
|
|
60
|
+
creds_source: context.credsSource,
|
|
61
|
+
runner: context.runner,
|
|
62
|
+
hq_cli_version: CLI_VERSION,
|
|
63
|
+
},
|
|
64
|
+
extra: {
|
|
65
|
+
configured_agent_uid: diagnosticUid(context.configuredAgentUid),
|
|
66
|
+
...(context.tokenAgentUid ? { token_agent_uid: diagnosticUid(context.tokenAgentUid) } : {}),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
captureMessage("heartbeat identity mismatch", options);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=heartbeat-identity.js.map
|
|
@@ -18,6 +18,11 @@ export declare const DEFAULT_MIN_AVAILABLE_MEM_MB = 1024;
|
|
|
18
18
|
* run compact". Override per provider with `compact_after_ms`.
|
|
19
19
|
*/
|
|
20
20
|
export declare const DEFAULT_COMPACT_AFTER_MS: number;
|
|
21
|
+
/**
|
|
22
|
+
* Claude Code's auto-compaction window, in tokens. Override with
|
|
23
|
+
* `providers.claude.auto_compact_tokens`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEFAULT_AUTO_COMPACT_TOKENS = 200000;
|
|
21
26
|
/**
|
|
22
27
|
* Watcher `lane_progress` throttle: at most one thread event per five minutes
|
|
23
28
|
* per lane, and only when the tick saw new activity. Override per provider
|
|
@@ -66,6 +71,8 @@ export interface ConfigWriteDeps {
|
|
|
66
71
|
export declare function writeLanesConfig(hqRoot: string, config: LanesConfig, deps?: ConfigWriteDeps): void;
|
|
67
72
|
/** Resume-time compaction threshold for a provider, defaulting to one hour. */
|
|
68
73
|
export declare function providerCompactAfterMs(provider: ProviderConfig): number;
|
|
74
|
+
/** Claude Code auto-compaction threshold, defaulting to 200,000 tokens. */
|
|
75
|
+
export declare function providerAutoCompactTokens(provider: ProviderConfig): number;
|
|
69
76
|
/** Minimum gap between two `lane_progress` events, defaulting to five minutes. */
|
|
70
77
|
export declare function providerProgressEventMinIntervalMs(provider: ProviderConfig): number;
|
|
71
78
|
/** Hold for a reset-less 429 on this provider's accounts. */
|
package/dist/lib/lanes/config.js
CHANGED
|
@@ -22,6 +22,11 @@ export const DEFAULT_MIN_AVAILABLE_MEM_MB = 1024;
|
|
|
22
22
|
* run compact". Override per provider with `compact_after_ms`.
|
|
23
23
|
*/
|
|
24
24
|
export const DEFAULT_COMPACT_AFTER_MS = 60 * 60 * 1000;
|
|
25
|
+
/**
|
|
26
|
+
* Claude Code's auto-compaction window, in tokens. Override with
|
|
27
|
+
* `providers.claude.auto_compact_tokens`.
|
|
28
|
+
*/
|
|
29
|
+
export const DEFAULT_AUTO_COMPACT_TOKENS = 200_000;
|
|
25
30
|
/**
|
|
26
31
|
* Watcher `lane_progress` throttle: at most one thread event per five minutes
|
|
27
32
|
* per lane, and only when the tick saw new activity. Override per provider
|
|
@@ -159,6 +164,15 @@ function nonEmptyModel(value, field) {
|
|
|
159
164
|
}
|
|
160
165
|
return value.trim();
|
|
161
166
|
}
|
|
167
|
+
function parseFastModeModels(value, field) {
|
|
168
|
+
if (value === undefined)
|
|
169
|
+
return [];
|
|
170
|
+
if (!Array.isArray(value) ||
|
|
171
|
+
value.some((model) => typeof model !== "string" || model.trim().length === 0)) {
|
|
172
|
+
throw new LanesConfigError("invalid_fast_mode_models", `${field} must be an array of non-empty strings`, { field, value });
|
|
173
|
+
}
|
|
174
|
+
return value.map((model) => model.trim());
|
|
175
|
+
}
|
|
162
176
|
function rejectDuplicateHomes(provider, accounts) {
|
|
163
177
|
const seen = new Map();
|
|
164
178
|
for (const [id, account] of Object.entries(accounts)) {
|
|
@@ -219,6 +233,9 @@ function parseProvider(provider, raw, deps) {
|
|
|
219
233
|
max_queued: positiveInt(raw.max_queued, `providers.${provider}.max_queued`, DEFAULT_MAX_QUEUED),
|
|
220
234
|
accounts,
|
|
221
235
|
};
|
|
236
|
+
if (provider === "codex") {
|
|
237
|
+
parsed.fast_mode_models = parseFastModeModels(raw.fast_mode_models, `providers.${provider}.fast_mode_models`);
|
|
238
|
+
}
|
|
222
239
|
if (defaultAccount !== undefined)
|
|
223
240
|
parsed.default_account = defaultAccount;
|
|
224
241
|
if (raw.model !== undefined) {
|
|
@@ -230,6 +247,9 @@ function parseProvider(provider, raw, deps) {
|
|
|
230
247
|
if (raw.compact_after_ms !== undefined) {
|
|
231
248
|
parsed.compact_after_ms = positiveInt(raw.compact_after_ms, `providers.${provider}.compact_after_ms`);
|
|
232
249
|
}
|
|
250
|
+
if (raw.auto_compact_tokens !== undefined) {
|
|
251
|
+
parsed.auto_compact_tokens = positiveInt(raw.auto_compact_tokens, `providers.${provider}.auto_compact_tokens`);
|
|
252
|
+
}
|
|
233
253
|
if (raw.progress_event_min_interval_ms !== undefined) {
|
|
234
254
|
parsed.progress_event_min_interval_ms = positiveInt(raw.progress_event_min_interval_ms, `providers.${provider}.progress_event_min_interval_ms`);
|
|
235
255
|
}
|
|
@@ -277,11 +297,14 @@ function parseLiveness(raw) {
|
|
|
277
297
|
export function documentedDefaultConfig(deps = defaultDeps()) {
|
|
278
298
|
const providers = {};
|
|
279
299
|
for (const provider of LANE_PROVIDERS) {
|
|
280
|
-
|
|
300
|
+
const providerConfig = {
|
|
281
301
|
max_running: DEFAULT_PROVIDER_MAX_RUNNING[provider],
|
|
282
302
|
max_queued: DEFAULT_MAX_QUEUED,
|
|
283
303
|
accounts: defaultAccountMap(provider, deps),
|
|
284
304
|
};
|
|
305
|
+
if (provider === "codex")
|
|
306
|
+
providerConfig.fast_mode_models = [];
|
|
307
|
+
providers[provider] = providerConfig;
|
|
285
308
|
}
|
|
286
309
|
return {
|
|
287
310
|
schema_version: CONFIG_SCHEMA_VERSION,
|
|
@@ -399,6 +422,10 @@ export function writeLanesConfig(hqRoot, config, deps = defaultWriteDeps()) {
|
|
|
399
422
|
export function providerCompactAfterMs(provider) {
|
|
400
423
|
return provider.compact_after_ms ?? DEFAULT_COMPACT_AFTER_MS;
|
|
401
424
|
}
|
|
425
|
+
/** Claude Code auto-compaction threshold, defaulting to 200,000 tokens. */
|
|
426
|
+
export function providerAutoCompactTokens(provider) {
|
|
427
|
+
return provider.auto_compact_tokens ?? DEFAULT_AUTO_COMPACT_TOKENS;
|
|
428
|
+
}
|
|
402
429
|
/** Minimum gap between two `lane_progress` events, defaulting to five minutes. */
|
|
403
430
|
export function providerProgressEventMinIntervalMs(provider) {
|
|
404
431
|
return provider.progress_event_min_interval_ms ?? DEFAULT_PROGRESS_EVENT_MIN_INTERVAL_MS;
|
|
@@ -5,7 +5,7 @@ export { AccountResolutionError, LaneNotFoundError, LaneSchemaError, LaneVersion
|
|
|
5
5
|
export { MAX_LANE_DEPTH } from "./constants.js";
|
|
6
6
|
export { CONFIG_SCHEMA_VERSION, ENVELOPE_DECISIONS, ENVELOPE_SCHEMA_VERSION, HISTORY_CAP, HOST_KINDS, LANE_PROVIDERS, LANE_SCHEMA_VERSION, LANE_STATES, LIVENESS_STATES, QUESTION_BODY_STORES, QUESTION_SCHEMA_VERSION, QUESTION_STATUSES, QUEUED_REASONS, RAISED_VIA, ROUTING_REASONS, SENIOR_KINDS, STORY_STATUSES, TERMINAL_LANE_STATES, isEnvelopeDecision, isHostKind, isLaneProvider, isLaneState, isLivenessState, isQuestionStatus, isSeniorKind, isTerminalLaneState, parseLaneEnvelope, parseLaneProvider, parseLaneState, parseLivenessState, parseMajorSchema, parseQuestionStatus, parseSeniorKind, } from "./types.js";
|
|
7
7
|
export type { AccountConfig, AttributionHistoryEntry, EnvelopeDecision, EnvelopeQuestion, HostKind, LaneCompanyRef, LaneEnvelope, LaneHost, LaneProvider, LaneRecord, PendingResume, AccountHistoryEntry, LaneState, LanesConfig, LastEnvelopeRef, LivenessState, LivenessWindows, ProviderConfig, QuestionAnswer, QuestionBodyRef, QuestionRecord, QuestionStatus, QueuedReason, RaisedVia, RoutingHistoryEntry, RoutingReason, SeniorHistoryEntry, SeniorKind, SeniorRef, StoryStatus, TerminalLaneState, ThrottleConfig, } from "./types.js";
|
|
8
|
-
export { DEFAULT_ACCOUNT_HOMES, DEFAULT_COMPACT_AFTER_MS, DEFAULT_CPU_BUSY_PAUSE, DEFAULT_CPU_BUSY_RESUME, DEFAULT_LIVE_WITHIN_MS, DEFAULT_LIVENESS_WINDOWS, DEFAULT_MAX_QUEUED, DEFAULT_MIN_AVAILABLE_MEM_MB, DEFAULT_PROVIDER_MAX_RUNNING, DEFAULT_SILENT_LOST_MS, DEFAULT_TURN_START_LOST_MS, LANES_CONFIG_REL, accountMaxRunning, canonicalizeHome, documentedDefaultConfig, expandHome, lanesConfigPath, loadLanesConfig, parseLanesConfig, providerCompactAfterMs, providerQuotaDefaultHoldMs, DEFAULT_QUOTA_HOLD_MS, writeLanesConfig, } from "./config.js";
|
|
8
|
+
export { DEFAULT_ACCOUNT_HOMES, DEFAULT_AUTO_COMPACT_TOKENS, DEFAULT_COMPACT_AFTER_MS, DEFAULT_CPU_BUSY_PAUSE, DEFAULT_CPU_BUSY_RESUME, DEFAULT_LIVE_WITHIN_MS, DEFAULT_LIVENESS_WINDOWS, DEFAULT_MAX_QUEUED, DEFAULT_MIN_AVAILABLE_MEM_MB, DEFAULT_PROVIDER_MAX_RUNNING, DEFAULT_SILENT_LOST_MS, DEFAULT_TURN_START_LOST_MS, LANES_CONFIG_REL, accountMaxRunning, canonicalizeHome, documentedDefaultConfig, expandHome, lanesConfigPath, loadLanesConfig, parseLanesConfig, providerCompactAfterMs, providerAutoCompactTokens, providerQuotaDefaultHoldMs, DEFAULT_QUOTA_HOLD_MS, writeLanesConfig, } from "./config.js";
|
|
9
9
|
export type { ConfigLoadDeps, ConfigWriteDeps } from "./config.js";
|
|
10
10
|
export { resolveLanesHqRoot } from "./hq-root.js";
|
|
11
11
|
export type { LanesHqRootOpts } from "./hq-root.js";
|
|
@@ -13,6 +13,10 @@ export { buildOutpostPickupCommand, parseOutpostPickupPayload, } from "./outpost
|
|
|
13
13
|
export type { OutpostDispatchResult, OutpostPickupPayload, } from "./outpost-dispatch.js";
|
|
14
14
|
export { LANES_STORE_REL, LANE_RECORDS_DIR, PENDING_INDEX_DIR, QUESTION_RECORDS_DIR, appendCappedHistory, appendLaneAttribution, appendLaneSeniorHistory, appendQuestionRouting, createLane, createQuestion, isConflictSidecarName, laneRecordPath, lanesStoreRoot, listLaneIds, listQuestionIds, mergeLaneRecords, mergeQuestionRecords, mintLaneId, mintQuestionId, parseLaneRecord, parseQuestionRecord, pendingMarkerPath, questionRecordPath, readLane, readQuestion, resolveStoreHqRoot, sanitizeHostComponent, tryReadLane, tryReadQuestion, retryUpdateLane, retryUpdateQuestion, updateLane, updateQuestion, } from "./store.js";
|
|
15
15
|
export type { StoreDeps } from "./store.js";
|
|
16
|
+
export { DEFAULT_LANE_WATCH_INTERVAL_MS, MAX_LANE_WATCH_INTERVAL_MS, MAX_WATCHED_LANES, MAX_WATCH_OUTPUT_LINES, runLaneWatch, } from "./watch.js";
|
|
17
|
+
export type { LaneWatchDeps, LaneWatchResult } from "./watch.js";
|
|
18
|
+
export { MONITOR_ERROR_EXIT_CODE, MONITOR_ENGINES, MONITOR_MAX_TIMEOUT_MS, MONITOR_TASK_OUTPUT_MAX_BYTES, MONITOR_TRANSCRIPT_MAX_BYTES, MONITOR_UNCOVERED_EXIT_CODE, coveredLaneIds, isMonitorTaskLive, monitorReminderText, parseCanonicalWatchCommand, parseMonitorTranscript, readLiveMonitorEvidence, } from "./monitor.js";
|
|
19
|
+
export type { LiveMonitorEvidenceOptions, MonitorEngine, MonitorEvidence, MonitorEvidenceReader, MonitorTaskEvidence, } from "./monitor.js";
|
|
16
20
|
export { IMDS_HOST, IMDS_INSTANCE_ID_URL, IMDS_TIMEOUT_MS, IMDS_TOKEN_URL, defaultReadImdsInstanceId, resolveMachineIdentity, } from "./machine-identity.js";
|
|
17
21
|
export type { MachineIdentity, MachineIdentityDeps } from "./machine-identity.js";
|
|
18
22
|
export { LANES_RUNS_REL as SPAWN_LANES_RUNS_REL, PID_LIVENESS_DECISIONS, PROVIDER_COMMAND, PROVIDER_MODEL_FLAG, SPAWN_TERMINAL_REASONS, ANSWERED_QUESTIONS_FILE, appendModelFlag, armLaneWatcher, buildProviderCommand, parseCliModel, resolveLaneModel, defaultProveDetached, isPidRecordAlive, laneRunDir, missingPidProbe, nextEnvelopePath, markSpawnFailure, parsePidRecord, parseProcStat, parseSpawnTerminalReason, probePidRecord, readPidRecord, readProcStarttime, readProcStarttimeDetailed, readSpawnManifest, resumePrompt, envelopeInstruction, spawnLaneWorker, stopLaneProcesses, watcherMainPath, workerEnv, } from "./spawn.js";
|
package/dist/lib/lanes/index.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
export { AccountResolutionError, LaneNotFoundError, LaneSchemaError, LaneVersionConflict, LanesConfigError, LanesError, WorkerResolutionError, isLaneVersionConflict, isLanesError, } from "./errors.js";
|
|
5
5
|
export { MAX_LANE_DEPTH } from "./constants.js";
|
|
6
6
|
export { CONFIG_SCHEMA_VERSION, ENVELOPE_DECISIONS, ENVELOPE_SCHEMA_VERSION, HISTORY_CAP, HOST_KINDS, LANE_PROVIDERS, LANE_SCHEMA_VERSION, LANE_STATES, LIVENESS_STATES, QUESTION_BODY_STORES, QUESTION_SCHEMA_VERSION, QUESTION_STATUSES, QUEUED_REASONS, RAISED_VIA, ROUTING_REASONS, SENIOR_KINDS, STORY_STATUSES, TERMINAL_LANE_STATES, isEnvelopeDecision, isHostKind, isLaneProvider, isLaneState, isLivenessState, isQuestionStatus, isSeniorKind, isTerminalLaneState, parseLaneEnvelope, parseLaneProvider, parseLaneState, parseLivenessState, parseMajorSchema, parseQuestionStatus, parseSeniorKind, } from "./types.js";
|
|
7
|
-
export { DEFAULT_ACCOUNT_HOMES, DEFAULT_COMPACT_AFTER_MS, DEFAULT_CPU_BUSY_PAUSE, DEFAULT_CPU_BUSY_RESUME, DEFAULT_LIVE_WITHIN_MS, DEFAULT_LIVENESS_WINDOWS, DEFAULT_MAX_QUEUED, DEFAULT_MIN_AVAILABLE_MEM_MB, DEFAULT_PROVIDER_MAX_RUNNING, DEFAULT_SILENT_LOST_MS, DEFAULT_TURN_START_LOST_MS, LANES_CONFIG_REL, accountMaxRunning, canonicalizeHome, documentedDefaultConfig, expandHome, lanesConfigPath, loadLanesConfig, parseLanesConfig, providerCompactAfterMs, providerQuotaDefaultHoldMs, DEFAULT_QUOTA_HOLD_MS, writeLanesConfig, } from "./config.js";
|
|
7
|
+
export { DEFAULT_ACCOUNT_HOMES, DEFAULT_AUTO_COMPACT_TOKENS, DEFAULT_COMPACT_AFTER_MS, DEFAULT_CPU_BUSY_PAUSE, DEFAULT_CPU_BUSY_RESUME, DEFAULT_LIVE_WITHIN_MS, DEFAULT_LIVENESS_WINDOWS, DEFAULT_MAX_QUEUED, DEFAULT_MIN_AVAILABLE_MEM_MB, DEFAULT_PROVIDER_MAX_RUNNING, DEFAULT_SILENT_LOST_MS, DEFAULT_TURN_START_LOST_MS, LANES_CONFIG_REL, accountMaxRunning, canonicalizeHome, documentedDefaultConfig, expandHome, lanesConfigPath, loadLanesConfig, parseLanesConfig, providerCompactAfterMs, providerAutoCompactTokens, providerQuotaDefaultHoldMs, DEFAULT_QUOTA_HOLD_MS, writeLanesConfig, } from "./config.js";
|
|
8
8
|
export { resolveLanesHqRoot } from "./hq-root.js";
|
|
9
9
|
export { buildOutpostPickupCommand, parseOutpostPickupPayload, } from "./outpost-dispatch.js";
|
|
10
10
|
export { LANES_STORE_REL, LANE_RECORDS_DIR, PENDING_INDEX_DIR, QUESTION_RECORDS_DIR, appendCappedHistory, appendLaneAttribution, appendLaneSeniorHistory, appendQuestionRouting, createLane, createQuestion, isConflictSidecarName, laneRecordPath, lanesStoreRoot, listLaneIds, listQuestionIds, mergeLaneRecords, mergeQuestionRecords, mintLaneId, mintQuestionId, parseLaneRecord, parseQuestionRecord, pendingMarkerPath, questionRecordPath, readLane, readQuestion, resolveStoreHqRoot, sanitizeHostComponent, tryReadLane, tryReadQuestion, retryUpdateLane, retryUpdateQuestion, updateLane, updateQuestion, } from "./store.js";
|
|
11
|
+
export { DEFAULT_LANE_WATCH_INTERVAL_MS, MAX_LANE_WATCH_INTERVAL_MS, MAX_WATCHED_LANES, MAX_WATCH_OUTPUT_LINES, runLaneWatch, } from "./watch.js";
|
|
12
|
+
export { MONITOR_ERROR_EXIT_CODE, MONITOR_ENGINES, MONITOR_MAX_TIMEOUT_MS, MONITOR_TASK_OUTPUT_MAX_BYTES, MONITOR_TRANSCRIPT_MAX_BYTES, MONITOR_UNCOVERED_EXIT_CODE, coveredLaneIds, isMonitorTaskLive, monitorReminderText, parseCanonicalWatchCommand, parseMonitorTranscript, readLiveMonitorEvidence, } from "./monitor.js";
|
|
11
13
|
export { IMDS_HOST, IMDS_INSTANCE_ID_URL, IMDS_TIMEOUT_MS, IMDS_TOKEN_URL, defaultReadImdsInstanceId, resolveMachineIdentity, } from "./machine-identity.js";
|
|
12
14
|
export { LANES_RUNS_REL as SPAWN_LANES_RUNS_REL, PID_LIVENESS_DECISIONS, PROVIDER_COMMAND, PROVIDER_MODEL_FLAG, SPAWN_TERMINAL_REASONS, ANSWERED_QUESTIONS_FILE, appendModelFlag, armLaneWatcher, buildProviderCommand, parseCliModel, resolveLaneModel, defaultProveDetached, isPidRecordAlive, laneRunDir, missingPidProbe, nextEnvelopePath, markSpawnFailure, parsePidRecord, parseProcStat, parseSpawnTerminalReason, probePidRecord, readPidRecord, readProcStarttime, readProcStarttimeDetailed, readSpawnManifest, resumePrompt, envelopeInstruction, spawnLaneWorker, stopLaneProcesses, watcherMainPath, workerEnv, } from "./spawn.js";
|
|
13
15
|
export { SILENCE_MS, WATCHER_DECISION_EVENTS, WATCHER_OUT_MAX_BYTES, WATCHER_POLL_MS, WATCHER_SIGNAL_KINDS, appendCappedLog, appendWatcherSignal, applyTerminalToLane, classifyLaneExit, clearLaneStalled, isPidAlive, laneIdentityFromRecord, markLaneStalled, notifySlotFreed, parseWatcherSignalKind, readLatestEnvelope, runWatcherLoop, stalledReason, tickWatcher, watcherEventsPath, watcherLastSignalPath, watcherOutLogPath, writeWatcherDecision, } from "./watcher.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const MONITOR_MAX_TIMEOUT_MS = 1800000;
|
|
2
|
+
export declare const MONITOR_UNCOVERED_EXIT_CODE = 2;
|
|
3
|
+
export declare const MONITOR_ERROR_EXIT_CODE = 3;
|
|
4
|
+
export declare const MONITOR_TRANSCRIPT_MAX_BYTES: number;
|
|
5
|
+
export declare const MONITOR_TASK_OUTPUT_MAX_BYTES: number;
|
|
6
|
+
export type MonitorEngine = "claude" | "codex" | "grok";
|
|
7
|
+
export declare const MONITOR_ENGINES: readonly MonitorEngine[];
|
|
8
|
+
export interface MonitorTaskEvidence {
|
|
9
|
+
taskId: string;
|
|
10
|
+
command: string;
|
|
11
|
+
startedAt: string;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
persistent?: boolean;
|
|
14
|
+
stopped?: boolean;
|
|
15
|
+
outputPresent: boolean;
|
|
16
|
+
outputText?: string;
|
|
17
|
+
processAlive?: boolean;
|
|
18
|
+
outputPath?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MonitorEvidence {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
tasks: readonly MonitorTaskEvidence[];
|
|
23
|
+
transcriptPaths?: readonly string[];
|
|
24
|
+
taskOutputPaths?: readonly string[];
|
|
25
|
+
processCommands?: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export interface LiveMonitorEvidenceOptions {
|
|
28
|
+
homedir?: () => string;
|
|
29
|
+
env?: NodeJS.ProcessEnv;
|
|
30
|
+
now?: () => Date;
|
|
31
|
+
transcriptMaxBytes?: number;
|
|
32
|
+
taskOutputMaxBytes?: number;
|
|
33
|
+
readProcessCommands?: () => readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse only the JSONL shape emitted by Claude Code's Monitor tool. The
|
|
37
|
+
* caller supplies a bounded tail; malformed or partial lines are ignored so a
|
|
38
|
+
* torn final write cannot turn into positive liveness evidence.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseMonitorTranscript(text: string): MonitorTaskEvidence[];
|
|
41
|
+
/** Return argv only for the exact command form the gate arms. */
|
|
42
|
+
export declare function parseCanonicalWatchCommand(command: string): string[] | null;
|
|
43
|
+
export declare function isMonitorTaskLive(task: MonitorTaskEvidence, now: Date): boolean;
|
|
44
|
+
export declare function coveredLaneIds(evidence: MonitorEvidence, now: Date): Set<string>;
|
|
45
|
+
export declare function readLiveMonitorEvidence(sessionId: string, options?: LiveMonitorEvidenceOptions): MonitorEvidence;
|
|
46
|
+
export type MonitorEvidenceReader = (sessionId: string) => MonitorEvidence | Promise<MonitorEvidence>;
|
|
47
|
+
export declare function monitorReminderText(): string;
|
|
48
|
+
//# sourceMappingURL=monitor.d.ts.map
|