@lmctl-ai/lmctl 0.2.37 → 0.2.39
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/README.md +16 -0
- package/THIRD_PARTY_NOTICES.md +35 -0
- package/bin/lmbee +2 -0
- package/bin/lmscript +3 -0
- package/build-info.json +1 -0
- package/dist/cli/index.js +569 -494
- package/dist/cli/schema.sql +0 -169
- package/dist/cli/script.js +273 -266
- package/dist/lmbee.js +960 -0
- package/dist/lmscript.js +388 -0
- package/dist/public/app.js +379 -0
- package/dist/public/index.html +78 -0
- package/dist/public/styles.css +160 -0
- package/dist/schema.sql +455 -0
- package/dist/vendor-webui/index.html +18 -0
- package/dist/vendor-webui/local.js +231 -0
- package/dist/vendor-webui/styles.css +1852 -0
- package/package.json +12 -7
- package/dist/cli/batch.d.ts +0 -2
- package/dist/cli/busy-evidence.d.ts +0 -27
- package/dist/cli/chat-cycle.d.ts +0 -59
- package/dist/cli/chat-exec.d.ts +0 -91
- package/dist/cli/chat-policy.d.ts +0 -22
- package/dist/cli/chat.d.ts +0 -14
- package/dist/cli/code-resolver.d.ts +0 -8
- package/dist/cli/common.d.ts +0 -57
- package/dist/cli/context.d.ts +0 -12
- package/dist/cli/cost.d.ts +0 -2
- package/dist/cli/export.d.ts +0 -2
- package/dist/cli/hello.d.ts +0 -10
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/infra.d.ts +0 -78
- package/dist/cli/init.d.ts +0 -21
- package/dist/cli/intent-input.d.ts +0 -16
- package/dist/cli/intent-match.d.ts +0 -30
- package/dist/cli/intent-sessions.d.ts +0 -24
- package/dist/cli/intent-team.d.ts +0 -25
- package/dist/cli/intent.d.ts +0 -22
- package/dist/cli/ls.d.ts +0 -2
- package/dist/cli/mailbox-cli.d.ts +0 -6
- package/dist/cli/managed.d.ts +0 -62
- package/dist/cli/mcp-install.d.ts +0 -23
- package/dist/cli/mcp.d.ts +0 -2
- package/dist/cli/model.d.ts +0 -21
- package/dist/cli/paths.d.ts +0 -50
- package/dist/cli/plan-wizard.d.ts +0 -42
- package/dist/cli/plan.d.ts +0 -20
- package/dist/cli/queue-delivery.d.ts +0 -122
- package/dist/cli/quickrun.d.ts +0 -14
- package/dist/cli/ratelimit.d.ts +0 -2
- package/dist/cli/remote-fetch.d.ts +0 -7
- package/dist/cli/run-queries.d.ts +0 -82
- package/dist/cli/running.d.ts +0 -5
- package/dist/cli/save-script.d.ts +0 -41
- package/dist/cli/script.d.ts +0 -6
- package/dist/cli/seed-flight.d.ts +0 -2
- package/dist/cli/self-identity.d.ts +0 -25
- package/dist/cli/session-idle.d.ts +0 -118
- package/dist/cli/status.d.ts +0 -22
- package/dist/cli/tail.d.ts +0 -18
- package/dist/cli/target-resolver.d.ts +0 -139
- package/dist/cli/team-status.d.ts +0 -91
- package/dist/cli/teamfile-compat.d.ts +0 -116
- package/dist/cli/teamfile-store.d.ts +0 -18
- package/dist/cli/teamfile-template.d.ts +0 -47
- package/dist/cli/template-env.d.ts +0 -25
- package/dist/cli/terminal-lock.d.ts +0 -25
- package/dist/cli/terminal.d.ts +0 -23
- package/dist/cli/time-filter.d.ts +0 -10
- package/dist/cli/update-notifier.d.ts +0 -11
- package/dist/cli/version-util.d.ts +0 -23
- package/dist/config/seed_templates.d.ts +0 -1
- package/dist/db/backfill-event-log.d.ts +0 -26
- package/dist/db/delegation.d.ts +0 -37
- package/dist/db/escalation_vocab.d.ts +0 -45
- package/dist/db/event-log.d.ts +0 -40
- package/dist/db/index.d.ts +0 -1213
- package/dist/db/inflight-acquire.d.ts +0 -70
- package/dist/db/invocation-event-projections.d.ts +0 -65
- package/dist/db/ledger-identity.test.d.ts +0 -1
- package/dist/db/live-event-projections.d.ts +0 -92
- package/dist/db/migrate.d.ts +0 -51
- package/dist/db/open-readonly.d.ts +0 -2
- package/dist/db/process-liveness.d.ts +0 -37
- package/dist/db/sqlite.d.ts +0 -53
- package/dist/db/sqlite.test.d.ts +0 -1
- package/dist/db/terminal-lock.d.ts +0 -14
- package/dist/db/tracked-invocation-reconcile.d.ts +0 -52
- package/dist/db/tracked-invocation.d.ts +0 -116
- package/dist/mcp/dispatch.d.ts +0 -45
- package/dist/mcp/mediation.d.ts +0 -128
- package/dist/mcp/path-warning.d.ts +0 -7
- package/dist/mcp/server.d.ts +0 -63
- package/dist/mcp/tools.d.ts +0 -24
- package/dist/providers/adapter.d.ts +0 -271
- package/dist/providers/adapters/agy-adapter.d.ts +0 -18
- package/dist/providers/adapters/claude-adapter.d.ts +0 -20
- package/dist/providers/adapters/codex-adapter.d.ts +0 -22
- package/dist/providers/adapters/copilot-adapter.d.ts +0 -16
- package/dist/providers/adapters/dsh-adapter.d.ts +0 -89
- package/dist/providers/adapters/gemini-adapter.d.ts +0 -44
- package/dist/providers/adapters/hermes-adapter.d.ts +0 -71
- package/dist/providers/adapters/index.d.ts +0 -35
- package/dist/providers/adapters/kimi-adapter.d.ts +0 -16
- package/dist/providers/adapters/lmplayer-adapter.d.ts +0 -14
- package/dist/providers/adapters/opencode-adapter.d.ts +0 -11
- package/dist/providers/adapters/pi-adapter.d.ts +0 -17
- package/dist/providers/adapters/print-turn.d.ts +0 -29
- package/dist/providers/adapters/qwen-adapter.d.ts +0 -11
- package/dist/providers/agy.d.ts +0 -32
- package/dist/providers/base-adapter.d.ts +0 -110
- package/dist/providers/base.d.ts +0 -12
- package/dist/providers/binary-check.d.ts +0 -102
- package/dist/providers/bundle.d.ts +0 -124
- package/dist/providers/claude-mock.d.ts +0 -90
- package/dist/providers/claude.d.ts +0 -21
- package/dist/providers/codex-config.d.ts +0 -15
- package/dist/providers/codex.d.ts +0 -25
- package/dist/providers/config/init-config.d.ts +0 -43
- package/dist/providers/config/model-selection-lint.d.ts +0 -70
- package/dist/providers/config/team-config.d.ts +0 -184
- package/dist/providers/config/types.d.ts +0 -146
- package/dist/providers/config/user-config.d.ts +0 -88
- package/dist/providers/copilot.d.ts +0 -21
- package/dist/providers/debug.d.ts +0 -128
- package/dist/providers/dsh-sidecar.d.ts +0 -65
- package/dist/providers/dsh-zstd.d.ts +0 -27
- package/dist/providers/dsh.d.ts +0 -37
- package/dist/providers/frontmatter.d.ts +0 -46
- package/dist/providers/gemini-session-reader.d.ts +0 -151
- package/dist/providers/gemini.d.ts +0 -39
- package/dist/providers/hermes.d.ts +0 -90
- package/dist/providers/index.d.ts +0 -423
- package/dist/providers/kimi.d.ts +0 -37
- package/dist/providers/model-catalog.d.ts +0 -145
- package/dist/providers/model-suggestions.d.ts +0 -4
- package/dist/providers/one-shot-timeout.d.ts +0 -1
- package/dist/providers/opencode-config.d.ts +0 -62
- package/dist/providers/opencode.d.ts +0 -40
- package/dist/providers/parsers/acp.d.ts +0 -71
- package/dist/providers/parsers/codex-app-server.d.ts +0 -60
- package/dist/providers/parsers/stream-json.d.ts +0 -57
- package/dist/providers/passive-readers/agy.d.ts +0 -155
- package/dist/providers/passive-readers/copilot.d.ts +0 -173
- package/dist/providers/passive-readers/dsh.d.ts +0 -34
- package/dist/providers/passive-readers/kimi.d.ts +0 -44
- package/dist/providers/passive-readers/opencode.d.ts +0 -89
- package/dist/providers/passive-readers/qwen.d.ts +0 -151
- package/dist/providers/passive-readers/shared.d.ts +0 -138
- package/dist/providers/passive-session-reader.d.ts +0 -188
- package/dist/providers/path-utils.d.ts +0 -1
- package/dist/providers/pi.d.ts +0 -32
- package/dist/providers/pricing.d.ts +0 -107
- package/dist/providers/qwen.d.ts +0 -22
- package/dist/providers/ratelimit/agy.d.ts +0 -22
- package/dist/providers/ratelimit/claude-auth.d.ts +0 -13
- package/dist/providers/ratelimit/claude.d.ts +0 -6
- package/dist/providers/ratelimit/codex.d.ts +0 -7
- package/dist/providers/ratelimit/kimi-auth.d.ts +0 -15
- package/dist/providers/ratelimit/kimi.d.ts +0 -6
- package/dist/providers/ratelimit/schema.d.ts +0 -28
- package/dist/providers/ratelimit-readings.d.ts +0 -19
- package/dist/providers/registry.d.ts +0 -31
- package/dist/providers/resume.d.ts +0 -43
- package/dist/providers/seed-instruction.d.ts +0 -3
- package/dist/providers/self-session-env.d.ts +0 -21
- package/dist/providers/session-limit.d.ts +0 -9
- package/dist/providers/strip-ansi.d.ts +0 -5
- package/dist/providers/transport-errors.d.ts +0 -94
- package/dist/providers/transport-lifecycle.d.ts +0 -63
- package/dist/providers/transport-wrappers.d.ts +0 -110
- package/dist/providers/transports/acp-profiles/config-option-step.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/copilot.d.ts +0 -12
- package/dist/providers/transports/acp-profiles/gemini.d.ts +0 -22
- package/dist/providers/transports/acp-profiles/hermes.d.ts +0 -27
- package/dist/providers/transports/acp-profiles/index.d.ts +0 -19
- package/dist/providers/transports/acp-profiles/kimi.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/opencode.d.ts +0 -26
- package/dist/providers/transports/acp-profiles/types.d.ts +0 -258
- package/dist/providers/transports/acp-rpc.d.ts +0 -18
- package/dist/providers/transports/acp.d.ts +0 -217
- package/dist/providers/transports/codex-app-server.d.ts +0 -190
- package/dist/providers/transports/hold-open.d.ts +0 -120
- package/dist/providers/transports/manager.d.ts +0 -21
- package/dist/providers/transports/stream-json.d.ts +0 -162
- package/dist/providers/transports/types.d.ts +0 -56
- package/dist/providers/types.d.ts +0 -154
- package/dist/providers/yolo-contract.d.ts +0 -131
- package/dist/script/adapter.d.ts +0 -104
- package/dist/script/batch-script.d.ts +0 -7
- package/dist/script/index.d.ts +0 -3
- package/dist/script/lmbee-module.d.ts +0 -2
- package/dist/script/lmscript.d.ts +0 -616
- package/dist/shared/policy.d.ts +0 -74
- package/dist/shared-lib/db.d.ts +0 -25
- package/dist/shared-lib/passive-session-reader.d.ts +0 -2
- package/dist/shared-lib/provider-parse.d.ts +0 -6
- package/dist/templates/basedir.d.ts +0 -52
- package/dist/uri/lmctl_uri.d.ts +0 -38
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { AgentInflightInput, AgentInflightRow, Dal } from './index.js';
|
|
2
|
-
import type { TrackedInvocationRow } from './tracked-invocation.js';
|
|
3
|
-
import type { TerminalLockRecord } from './terminal-lock.js';
|
|
4
|
-
export type InflightReclaimReason = 'force' | 'stale' | 'dead-pid' | 'session-idle';
|
|
5
|
-
export type SharedInflightAcquireResult = {
|
|
6
|
-
acquired: true;
|
|
7
|
-
lease: AgentInflightInput;
|
|
8
|
-
leaseId: string;
|
|
9
|
-
previous: AgentInflightRow | null;
|
|
10
|
-
reclaimReason: InflightReclaimReason | null;
|
|
11
|
-
} | {
|
|
12
|
-
acquired: false;
|
|
13
|
-
current: AgentInflightRow;
|
|
14
|
-
};
|
|
15
|
-
export interface SharedInflightAcquireInput {
|
|
16
|
-
receiver_teamfile: string;
|
|
17
|
-
receiver_alias: string;
|
|
18
|
-
sender_teamfile: string;
|
|
19
|
-
sender_alias: string;
|
|
20
|
-
force?: boolean;
|
|
21
|
-
reclaimReason?: InflightReclaimReason;
|
|
22
|
-
ttlMs: number;
|
|
23
|
-
}
|
|
24
|
-
export declare function inflightHeartbeatMsFromEnv(env?: NodeJS.ProcessEnv): number;
|
|
25
|
-
export declare function startAgentInflightHeartbeat(touch: (heartbeatAt: string) => boolean | Promise<boolean>, options?: {
|
|
26
|
-
intervalMs?: number;
|
|
27
|
-
onError?: (error: unknown) => void;
|
|
28
|
-
}): NodeJS.Timeout;
|
|
29
|
-
export type ReceiverBusyState = {
|
|
30
|
-
busy: false;
|
|
31
|
-
reclaimable?: ReceiverReclaimableHolder;
|
|
32
|
-
} | {
|
|
33
|
-
busy: true;
|
|
34
|
-
reason: 'terminal-held';
|
|
35
|
-
source: 'terminal-lock';
|
|
36
|
-
terminalLock: TerminalLockRecord;
|
|
37
|
-
} | {
|
|
38
|
-
busy: true;
|
|
39
|
-
reason: 'terminal-held';
|
|
40
|
-
source: 'terminal-invocation';
|
|
41
|
-
terminalInvocation: ReceiverTerminalInvocation;
|
|
42
|
-
} | {
|
|
43
|
-
busy: true;
|
|
44
|
-
reason: 'in-flight';
|
|
45
|
-
inFlight: AgentInflightRow;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* A holder row exists but is NOT live, so the receiver is correctly reported
|
|
49
|
-
* idle (the lock is reclaimable) — yet the orphaned row lingers until the next
|
|
50
|
-
* acquire lazily reclaims it. Surfaced (proposal 4, session-liveness
|
|
51
|
-
* observability) so `lmctl status` can show "held by pid N, appears
|
|
52
|
-
* dead" instead of an "idle" indistinguishable from "no lock at all". This does
|
|
53
|
-
* NOT change the busy verdict: a dead holder is, and stays, not-busy.
|
|
54
|
-
*/
|
|
55
|
-
export interface ReceiverReclaimableHolder {
|
|
56
|
-
source: 'terminal-lock' | 'terminal-invocation' | 'in-flight';
|
|
57
|
-
holder_pid: number | null;
|
|
58
|
-
holder_host: string | null;
|
|
59
|
-
/** `dead-pid`: a local pid that is not alive. `stale`: a null pid or a
|
|
60
|
-
* remote/heartbeat-expired holder past its freshness window. */
|
|
61
|
-
reason: 'dead-pid' | 'stale';
|
|
62
|
-
}
|
|
63
|
-
export type ReceiverTerminalInvocation = Pick<TrackedInvocationRow, 'id' | 'started_at' | 'last_heartbeat_at' | 'holder_pid' | 'holder_host'>;
|
|
64
|
-
export type TrackedInvocationHolderLiveness = 'live' | 'dead' | 'unknown' | null;
|
|
65
|
-
export declare function acquireSharedInflight(dal: Pick<Dal, 'getAgentInflight' | 'tryAcquireAgentInflight'>, input: SharedInflightAcquireInput): SharedInflightAcquireResult;
|
|
66
|
-
export declare function isReceiverBusy(dal: Pick<Dal, 'getAgentInflight' | 'getTerminalLock' | 'query'>, receiverTeamfile: string, receiverAlias: string): boolean;
|
|
67
|
-
export declare function getTrackedInvocationHolderLiveness(row: Pick<TrackedInvocationRow, 'status' | 'holder_pid' | 'holder_host'>): TrackedInvocationHolderLiveness;
|
|
68
|
-
export declare function getReceiverBusyState(dal: Pick<Dal, 'getAgentInflight' | 'getTerminalLock' | 'query'>, receiverTeamfile: string, receiverAlias: string): ReceiverBusyState;
|
|
69
|
-
export declare function isReclaimableInflightHolder(row: AgentInflightRow, staleBefore: string): boolean;
|
|
70
|
-
export declare function inflightTtlMsFromEnv(env?: NodeJS.ProcessEnv): number;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase C dual-write for the INVOCATION lifecycle (Coder1's ownership).
|
|
3
|
-
*
|
|
4
|
-
* Mirror of Coder2's `live-event-projections.ts` for the mailbox/mutex side:
|
|
5
|
-
* each function appends the matching `message_event` row AND updates the
|
|
6
|
-
* `invocation_state` projection in the SAME transaction, routed through
|
|
7
|
-
* Architect's `appendEventWithProjection`. The caller (the DAL's
|
|
8
|
-
* tracked_invocation methods) wraps the legacy-table write and these appends in
|
|
9
|
-
* one `db.transaction`, so the old table and the new log/projection never land
|
|
10
|
-
* apart.
|
|
11
|
-
*
|
|
12
|
-
* TERMINAL TIER-2. A terminal-launched invocation additionally marks its target
|
|
13
|
-
* busy in `agent_state`. That table is Coder2's write-path end to end, so the
|
|
14
|
-
* terminal slice CALLS Coder2's `projectTerminalInvocation{Start,Finish}` —
|
|
15
|
-
* this module never writes `agent_state` fields directly. Receiver identity is
|
|
16
|
-
* `target_teamfile` + `target_alias` (never `from_identity`), per Coder2's
|
|
17
|
-
* busy-check contract.
|
|
18
|
-
*
|
|
19
|
-
* ROLLOUT SEAM — why FINISH/NOTIFY skip when the projection row is absent.
|
|
20
|
-
* Dual-write turns on at a deploy. Chat and terminal invocations start AND
|
|
21
|
-
* finish inside one same-binary process, so if the START was dual-written the
|
|
22
|
-
* FINISH will be too (row present) and vice versa — no seam. The one crossing
|
|
23
|
-
* case is the DAEMON reclaiming a stale invocation it did not start: that
|
|
24
|
-
* invocation may predate dual-write and have no `invocation_state` row. Coder2's
|
|
25
|
-
* `projectTerminalInvocationFinish` throws on a missing row, and a live DAL
|
|
26
|
-
* method must never throw on the seam. So FINISH/NOTIFY dual-write ONLY when the
|
|
27
|
-
* projection row exists (i.e. this invocation's START was dual-written); the
|
|
28
|
-
* pre-dual-write seam is reconciled by Phase D's cutover backfill, by design.
|
|
29
|
-
*/
|
|
30
|
-
import type Database from './sqlite.js';
|
|
31
|
-
import type { TrackedInvocationRow } from './tracked-invocation.js';
|
|
32
|
-
/**
|
|
33
|
-
* INVOCATION_START — append the event and insert the `invocation_state` row.
|
|
34
|
-
* For a terminal-launched invocation with a target, also marks the target busy
|
|
35
|
-
* via Coder2's `agent_state` entry point. `row` is the freshly-inserted
|
|
36
|
-
* tracked_invocation row (so `id` and every field are populated).
|
|
37
|
-
*/
|
|
38
|
-
export declare function appendInvocationStart(db: Database, row: TrackedInvocationRow): void;
|
|
39
|
-
/**
|
|
40
|
-
* INVOCATION_FINISH — append the event and move `invocation_state` to terminal.
|
|
41
|
-
* `row` is the tracked_invocation row AFTER the finish update. No-ops (returns
|
|
42
|
-
* false) when no projection row exists — the deploy-seam case reconciled by
|
|
43
|
-
* Phase D backfill (see module header).
|
|
44
|
-
*/
|
|
45
|
-
export declare function appendInvocationFinish(db: Database, row: TrackedInvocationRow): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* INVOCATION_NOTIFY_CLAIM — append the event and stamp the notifier onto
|
|
48
|
-
* `invocation_state`. No-ops on the deploy seam (no projection row).
|
|
49
|
-
*/
|
|
50
|
-
export declare function appendInvocationNotifyClaim(db: Database, row: TrackedInvocationRow, notifiedBy: string, notifiedAt: string): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Heartbeat — a mutable projection touch, NOT a log event (design §3: heartbeats
|
|
53
|
-
* stay projection-only to avoid log bloat, and do not advance last_seq).
|
|
54
|
-
* Updates `invocation_state.last_heartbeat_at`, and for a terminal invocation
|
|
55
|
-
* the mirrored `agent_state.terminal_invocation_heartbeat_at` via Coder2's fn.
|
|
56
|
-
*/
|
|
57
|
-
export declare function projectInvocationHeartbeat(db: Database, row: TrackedInvocationRow, heartbeatAt: string): void;
|
|
58
|
-
/** Mutable projection touch for a corrected request payload (no event; the
|
|
59
|
-
* verbatim-prompt correlation is Phase E's concern). */
|
|
60
|
-
export declare function projectInvocationRequestPayload(db: Database, invocationId: number, requestPayload: string): void;
|
|
61
|
-
/** Mutable projection touch persisting the CREATE-time request message linkage
|
|
62
|
-
* (`msg_tcl_<id>`) onto the running invocation, so the dead-holder reconciler can
|
|
63
|
-
* find and terminalize the exact message. No event: linkage metadata, like the
|
|
64
|
-
* request-payload touch above. */
|
|
65
|
-
export declare function projectInvocationRequestMessageId(db: Database, invocationId: number, requestMessageId: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type Database from './sqlite.js';
|
|
2
|
-
import type { AgentInflightRow } from './delegation.js';
|
|
3
|
-
import type { TerminalLockRecord } from './terminal-lock.js';
|
|
4
|
-
export type InflightReclaimReason = 'force' | 'stale' | 'dead-pid' | 'session-idle';
|
|
5
|
-
export declare const CURRENT_HANDLING_TTL_MS: number;
|
|
6
|
-
export interface ReceiverEventAttribution {
|
|
7
|
-
provider?: string | null;
|
|
8
|
-
sessionId?: string | null;
|
|
9
|
-
}
|
|
10
|
-
export declare function teamChatEventStreamId(teamChatLogId: number): string;
|
|
11
|
-
export declare function invocationEventStreamId(invocationId: number): string;
|
|
12
|
-
/** Mutable per-turn pointer. Like last_heartbeat_at, it is deliberately not
|
|
13
|
-
* backed by its own message_event. */
|
|
14
|
-
export declare function projectCurrentlyHandlingMessage(db: Database, teamfile: string, alias: string, messageId: string, handlingSince?: string): void;
|
|
15
|
-
export declare function clearCurrentlyHandlingMessage(db: Database, teamfile: string, alias: string, expectedMessageId: string): boolean;
|
|
16
|
-
export interface SynchronousChatEventInput {
|
|
17
|
-
root_teamfile: string;
|
|
18
|
-
sender_teamfile: string | null;
|
|
19
|
-
sender_alias: string | null;
|
|
20
|
-
receiver_teamfile: string;
|
|
21
|
-
receiver_alias: string;
|
|
22
|
-
receiver_provider?: string | null;
|
|
23
|
-
receiver_session_id?: string | null;
|
|
24
|
-
provider_prompt?: string | null;
|
|
25
|
-
message: string;
|
|
26
|
-
response: string | null;
|
|
27
|
-
origin: string;
|
|
28
|
-
status: string;
|
|
29
|
-
error_detail: string | null;
|
|
30
|
-
truncated: number;
|
|
31
|
-
created_at: string;
|
|
32
|
-
}
|
|
33
|
-
/** Commit the live message identity before entering the provider turn. */
|
|
34
|
-
export declare function appendSynchronousChatCreated(db: Database, legacyChatLogId: number, input: SynchronousChatEventInput): string;
|
|
35
|
-
/** Append the terminal outcome and release only this turn's causal pointer. */
|
|
36
|
-
export declare function appendSynchronousChatHandled(db: Database, legacyChatLogId: number, input: SynchronousChatEventInput): string;
|
|
37
|
-
export declare function appendInflightAcquired(db: Database, current: AgentInflightRow, previous: AgentInflightRow | null, reclaimReason: InflightReclaimReason | null, callerStaleBefore?: string | null, force?: boolean): string;
|
|
38
|
-
/** Mutable in-flight heartbeat projection; deliberately no message_event row. */
|
|
39
|
-
export declare function projectInflightHeartbeat(db: Database, current: AgentInflightRow, leaseId: string, heartbeatAt: string): boolean;
|
|
40
|
-
export declare function appendInflightReleased(db: Database, current: AgentInflightRow, eventType: 'INFLIGHT_RELEASE' | 'INFLIGHT_RECLAIM', reason?: InflightReclaimReason): void;
|
|
41
|
-
export declare function appendTerminalLockTaken(db: Database, lock: TerminalLockRecord): void;
|
|
42
|
-
export declare function appendTerminalLockReleased(db: Database, lock: TerminalLockRecord, expired?: boolean): void;
|
|
43
|
-
export interface TerminalInvocationProjectionInput {
|
|
44
|
-
invocationId: string;
|
|
45
|
-
targetTeamfile: string;
|
|
46
|
-
targetAlias: string;
|
|
47
|
-
holderPid: number | null;
|
|
48
|
-
holderHost: string | null;
|
|
49
|
-
heartbeatAt: string;
|
|
50
|
-
}
|
|
51
|
-
/** Called from the INVOCATION_START append callback owned by the invocation path. */
|
|
52
|
-
export declare function projectTerminalInvocationStart(db: Database, eventSeq: number, input: TerminalInvocationProjectionInput): void;
|
|
53
|
-
/** Mutable heartbeat projection; deliberately no message_event heartbeat row. */
|
|
54
|
-
export declare function projectTerminalInvocationHeartbeat(db: Database, invocationId: string, heartbeatAt: string): boolean;
|
|
55
|
-
/** Called from the INVOCATION_FINISH append callback owned by the invocation path. */
|
|
56
|
-
export declare function projectTerminalInvocationFinish(db: Database, eventSeq: number, invocationId: string): void;
|
|
57
|
-
export interface MessageHandlingStartedResult {
|
|
58
|
-
appended: boolean;
|
|
59
|
-
seq: number;
|
|
60
|
-
handling_at: string;
|
|
61
|
-
}
|
|
62
|
-
export declare function appendMessageHandlingStarted(db: Database, opts: {
|
|
63
|
-
messageId: string;
|
|
64
|
-
handlingBy: string;
|
|
65
|
-
handlingTeamfile: string;
|
|
66
|
-
handlingAlias: string;
|
|
67
|
-
ts?: string;
|
|
68
|
-
}): MessageHandlingStartedResult;
|
|
69
|
-
export interface MessageAcknowledgedResult {
|
|
70
|
-
/** False when this actor already acked at the same stream state (retry). */
|
|
71
|
-
appended: boolean;
|
|
72
|
-
seq: number;
|
|
73
|
-
/** 'record-only' = terminalize was not requested; the receipt is recorded
|
|
74
|
-
* and normal delivery still happens later. 'removed' = this ack
|
|
75
|
-
* terminalized the queued pending row; 'claimed' = a delivery (daemon or
|
|
76
|
-
* sender-flush) already holds the message, removal no-oped and delivery
|
|
77
|
-
* proceeds; 'not-pending' = message already terminal. */
|
|
78
|
-
pending_outcome: 'record-only' | 'removed' | 'claimed' | 'not-pending';
|
|
79
|
-
}
|
|
80
|
-
export declare function appendMessageAcknowledged(db: Database, opts: {
|
|
81
|
-
messageId: string;
|
|
82
|
-
ackedBy: string;
|
|
83
|
-
note?: string;
|
|
84
|
-
ts?: string;
|
|
85
|
-
holderPid?: number;
|
|
86
|
-
holderHost?: string;
|
|
87
|
-
/** Opt-in (design.lmctl review): "an actor read this" and "the delivery
|
|
88
|
-
* obligation to the addressed receiver is fulfilled" are different facts.
|
|
89
|
-
* Default false = record-only; the relay script passes true explicitly
|
|
90
|
-
* because its read+ack composition IS the delivery-equivalent handling. */
|
|
91
|
-
terminalizePending?: boolean;
|
|
92
|
-
}): MessageAcknowledgedResult;
|
package/dist/db/migrate.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import Database from './sqlite.js';
|
|
2
|
-
export declare const CURRENT_USER_VERSION = 62;
|
|
3
|
-
export interface MigrateOptions {
|
|
4
|
-
dbPath: string;
|
|
5
|
-
/**
|
|
6
|
-
* Opt-in override for a db newer than this build understands (task #110
|
|
7
|
-
* ruling, 2026-09-18). Default `false`: refuse rather than silently
|
|
8
|
-
* degrade. lmctl's own house pattern is refuse-with-named-flag (9
|
|
9
|
-
* occurrences, e.g. `plan.ts`'s `--force`), not a blocking
|
|
10
|
-
* prompt — this codebase has NO user-stdin-prompt infrastructure at all
|
|
11
|
-
* (`isTTY` appears twice, both cosmetic), and the previous design's
|
|
12
|
-
* "no TTY -> proceed best-effort" escape hatch silently handed every
|
|
13
|
-
* headless agent the exact silent-degradation behavior this policy exists
|
|
14
|
-
* to abolish, on lmctl's majority (non-interactive) path.
|
|
15
|
-
*/
|
|
16
|
-
allowSchemaSkew?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Test-only seam: pretend this build's schema ceiling is this version
|
|
19
|
-
* instead of CURRENT_USER_VERSION, so the min_reader_version skew boundary
|
|
20
|
-
* can be exercised against a db this same code migrated forward. Only
|
|
21
|
-
* affects the skew comparison and its error/warning text; the fresh-create
|
|
22
|
-
* and migration paths always target CURRENT_USER_VERSION.
|
|
23
|
-
*/
|
|
24
|
-
buildVersionForTests?: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A db schema newer than this build understands, encountered with
|
|
28
|
-
* `allowSchemaSkew` NOT set. Deliberately NOT a subtype of "this db file is
|
|
29
|
-
* broken" -- `createDal`'s recovery ladder (salvage + rebuild fresh) must
|
|
30
|
-
* never treat this as corruption; a live, valid, newer peer's real data
|
|
31
|
-
* would be destroyed. Callers that catch this must re-throw or handle it
|
|
32
|
-
* explicitly, never fall through to generic recovery.
|
|
33
|
-
*/
|
|
34
|
-
export declare class SchemaSkewError extends Error {
|
|
35
|
-
readonly dbPath: string;
|
|
36
|
-
readonly dbVersion: number;
|
|
37
|
-
readonly buildVersion: number;
|
|
38
|
-
constructor(dbPath: string, dbVersion: number, buildVersion?: number);
|
|
39
|
-
}
|
|
40
|
-
export declare function migrate(opts: MigrateOptions): Database;
|
|
41
|
-
/** Test-only: clear the once-per-process warning latch between test cases. */
|
|
42
|
-
export declare function _resetNewerSchemaWarningForTests(): void;
|
|
43
|
-
export interface SchemaSkewInfo {
|
|
44
|
-
dbVersion: number;
|
|
45
|
-
buildVersion: number;
|
|
46
|
-
}
|
|
47
|
-
/** The current process's db-schema-skew state, if any was encountered by
|
|
48
|
-
* `migrate()` (proceed-allowed or refused) since the last reset. Read by
|
|
49
|
-
* the CLI's top-level error formatter to fold `schema_skew` into a
|
|
50
|
-
* `--json` refusal response. */
|
|
51
|
-
export declare function currentSchemaSkew(): SchemaSkewInfo | null;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare function isProcessAlive(pid: number | null | undefined): boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Process identity for records that outlive the process — the guard that keeps
|
|
4
|
-
* `serve stop` from SIGTERMing a bystander.
|
|
5
|
-
*
|
|
6
|
-
* TOKEN = `<boot_id>:<starttime>`.
|
|
7
|
-
*
|
|
8
|
-
* `/proc/<pid>/stat` field 22 (starttime) is ticks SINCE BOOT, so it only
|
|
9
|
-
* disambiguates reuse WITHIN one boot: after a reboot a fresh process can hold
|
|
10
|
-
* the same pid at the same tick and match a stale record exactly. Pairing it
|
|
11
|
-
* with `/proc/sys/kernel/random/boot_id` — regenerated every boot — closes
|
|
12
|
-
* that. Neither half is sufficient alone.
|
|
13
|
-
*
|
|
14
|
-
* Returns null when either half is unreadable (non-Linux, permissions, process
|
|
15
|
-
* gone). Null means UNVERIFIED, never "same".
|
|
16
|
-
*
|
|
17
|
-
* comm (field 2) is parenthesised and may contain spaces/parens, so fields are
|
|
18
|
-
* counted after the LAST ')'.
|
|
19
|
-
*/
|
|
20
|
-
export declare function processStartToken(pid: number | null | undefined): string | null;
|
|
21
|
-
/** A token is only usable if it has the exact recorded shape. */
|
|
22
|
-
export declare function isWellFormedStartToken(token: unknown): token is string;
|
|
23
|
-
/**
|
|
24
|
-
* Tri-state identity verdict. Deliberately NOT a boolean: "we could not check"
|
|
25
|
-
* is a distinct outcome from "it is a different process", and collapsing them
|
|
26
|
-
* is what makes a signalling path unsafe.
|
|
27
|
-
*
|
|
28
|
-
* 'same' — alive AND identity confirmed.
|
|
29
|
-
* 'different' — alive but the pid was REUSED. Never signal.
|
|
30
|
-
* 'gone' — not alive.
|
|
31
|
-
* 'unverified' — alive, but identity could not be established (record
|
|
32
|
-
* predates tokens, malformed token, /proc unreadable,
|
|
33
|
-
* non-Linux). Callers that SIGNAL must refuse; callers that
|
|
34
|
-
* only report may say so.
|
|
35
|
-
*/
|
|
36
|
-
export type ProcessIdentity = 'same' | 'different' | 'gone' | 'unverified';
|
|
37
|
-
export declare function verifyProcessIdentity(pid: number | null | undefined, expected: string | null | undefined): ProcessIdentity;
|
package/dist/db/sqlite.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
interface StatementSyncHandle {
|
|
2
|
-
all(...params: unknown[]): unknown[];
|
|
3
|
-
get(...params: unknown[]): unknown;
|
|
4
|
-
run(...params: unknown[]): {
|
|
5
|
-
changes: number | bigint;
|
|
6
|
-
lastInsertRowid: number | bigint;
|
|
7
|
-
};
|
|
8
|
-
setAllowBareNamedParameters(allowBareNamedParameters: boolean): void;
|
|
9
|
-
}
|
|
10
|
-
export interface DatabaseOptions {
|
|
11
|
-
readonly?: boolean;
|
|
12
|
-
fileMustExist?: boolean;
|
|
13
|
-
/** Defaults to OFF. Pass true to enable foreign-key enforcement. */
|
|
14
|
-
foreignKeys?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface RunResult {
|
|
17
|
-
changes: number;
|
|
18
|
-
lastInsertRowid: number;
|
|
19
|
-
}
|
|
20
|
-
/** A transaction function returned by `Database.transaction()`. Call it directly for
|
|
21
|
-
* `BEGIN DEFERRED`, or call `.immediate()` for `BEGIN IMMEDIATE`. */
|
|
22
|
-
type TransactionFunction<Args extends unknown[], Return> = ((...args: Args) => Return) & {
|
|
23
|
-
immediate: (...args: Args) => Return;
|
|
24
|
-
};
|
|
25
|
-
declare class Database {
|
|
26
|
-
readonly name: string;
|
|
27
|
-
private readonly handle;
|
|
28
|
-
private savepointId;
|
|
29
|
-
constructor(path: string, opts?: DatabaseOptions);
|
|
30
|
-
prepare(sql: string): Statement;
|
|
31
|
-
exec(sql: string): void;
|
|
32
|
-
pragma(str: string, opts?: {
|
|
33
|
-
simple?: boolean;
|
|
34
|
-
}): unknown;
|
|
35
|
-
transaction<Args extends unknown[], Return>(fn: (...args: Args) => Return): TransactionFunction<Args, Return>;
|
|
36
|
-
get inTransaction(): boolean;
|
|
37
|
-
close(): void;
|
|
38
|
-
private runTransaction;
|
|
39
|
-
}
|
|
40
|
-
export declare namespace Database {
|
|
41
|
-
type Database = InstanceType<typeof Database>;
|
|
42
|
-
}
|
|
43
|
-
export default Database;
|
|
44
|
-
export declare class Statement {
|
|
45
|
-
private readonly handle;
|
|
46
|
-
private rawMode;
|
|
47
|
-
constructor(handle: StatementSyncHandle);
|
|
48
|
-
get(...params: unknown[]): unknown;
|
|
49
|
-
all(...params: unknown[]): unknown[];
|
|
50
|
-
run(...params: unknown[]): RunResult;
|
|
51
|
-
raw(): this;
|
|
52
|
-
private normalizeRow;
|
|
53
|
-
}
|
package/dist/db/sqlite.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const TERMINAL_LOCK_SCOPE = "terminal_lock";
|
|
2
|
-
export declare const TERMINAL_LOCK_KIND = "member";
|
|
3
|
-
export interface TerminalLockRecord {
|
|
4
|
-
lock_id: string;
|
|
5
|
-
teamfile: string;
|
|
6
|
-
alias: string;
|
|
7
|
-
holder_pid: number;
|
|
8
|
-
holder_host: string;
|
|
9
|
-
holder_ips: string[];
|
|
10
|
-
started_at: string;
|
|
11
|
-
last_heartbeat: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function terminalLockKey(teamfile: string, alias: string): string;
|
|
14
|
-
export declare function parseTerminalLock(data: string): TerminalLockRecord | null;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Dal } from './index.js';
|
|
2
|
-
import type { TrackedInvocationRow } from './tracked-invocation.js';
|
|
3
|
-
export type TrackedInvocationReconcileRow = Pick<TrackedInvocationRow, 'id' | 'status' | 'holder_pid' | 'holder_host' | 'started_at' | 'last_heartbeat_at'>;
|
|
4
|
-
/**
|
|
5
|
-
* Shared trigger core (used by BOTH the on-touch and startup paths): if this
|
|
6
|
-
* running row's holder process is VERIFIED dead — same host as us AND its pid
|
|
7
|
-
* confirmed gone, i.e. `getTrackedInvocationHolderLiveness(row) === 'dead'` —
|
|
8
|
-
* transition it to the 'aborted' terminal state AND terminalize the linked chat
|
|
9
|
-
* message, atomically, via the guarded abort CAS.
|
|
10
|
-
*
|
|
11
|
-
* Returns the aborted row, or null when the holder is live, is a cross-host
|
|
12
|
-
* `'unknown'` (a verdict lmctl cannot actually prove — left untouched on
|
|
13
|
-
* purpose, matching the accepted PID-reuse-after-reboot boundary), is not
|
|
14
|
-
* running, or the compare-and-set lost a race. It NEVER aborts on anything
|
|
15
|
-
* short of a proven-dead local holder. The abort CAS is the single gate, so
|
|
16
|
-
* repeated sweeps and a late normal finalizer all no-op after the first winner
|
|
17
|
-
* (exactly one terminal message event).
|
|
18
|
-
*/
|
|
19
|
-
export declare function abortTrackedInvocationIfHolderDead(dal: Pick<Dal, 'abortTrackedInvocationAndTerminalizeMessage'>, row: TrackedInvocationReconcileRow): TrackedInvocationRow | null;
|
|
20
|
-
/**
|
|
21
|
-
* Trigger 2 — daemon-startup sweep, for the OS-reboot case. Runs the SAME
|
|
22
|
-
* per-row liveness check as the on-touch trigger across every status='running'
|
|
23
|
-
* row exactly once at startup, aborting only the rows it verifies dead.
|
|
24
|
-
*
|
|
25
|
-
* This is deliberately NOT "the daemon just started, so presume everything is
|
|
26
|
-
* dead": `holder_pid` is the dispatching/holding CLI process's own pid
|
|
27
|
-
* (chat-exec.ts), wholly independent of the daemon's lifecycle, so a routine
|
|
28
|
-
* supervised daemon restart (ops/systemd `Restart=always`) MUST leave live
|
|
29
|
-
* holders alone. It is literally "run trigger 1's check, in bulk, once."
|
|
30
|
-
* Returns the number of rows aborted.
|
|
31
|
-
*/
|
|
32
|
-
export declare function sweepDeadTrackedInvocations(dal: Pick<Dal, 'listAllRunningTrackedInvocations' | 'abortTrackedInvocationAndTerminalizeMessage'>): number;
|
|
33
|
-
/**
|
|
34
|
-
* Trigger 1 — opportunistic, on next access. Mirrors agent_inflight's
|
|
35
|
-
* reclaim-on-touch (`INFLIGHT_RECLAIM`): when a dispatch or the relay evaluates
|
|
36
|
-
* whether a receiver is busy, reconcile any running tracked_invocation rows
|
|
37
|
-
* targeting that receiver whose holder is verified dead, so a phantom 'running'
|
|
38
|
-
* does not linger until the next daemon restart. Same per-row check as the
|
|
39
|
-
* startup sweep. Returns the number of rows aborted.
|
|
40
|
-
*/
|
|
41
|
-
export declare function reconcileDeadTrackedInvocationsForReceiver(dal: Pick<Dal, 'query' | 'abortTrackedInvocationAndTerminalizeMessage'>, receiverTeamfile: string, receiverAlias: string): number;
|
|
42
|
-
/**
|
|
43
|
-
* Trigger 3 (periodic daemon tick) -- claim every un-notified terminal
|
|
44
|
-
* tracked_invocation via the pre-existing `notified_by` CAS (orphaned since
|
|
45
|
-
* `lmctl wait`, its original consumer, was removed in the synchronous-
|
|
46
|
-
* delivery rework) and notify the ones that need it. The claim itself is the
|
|
47
|
-
* single "already handled" gate, so a concurrent or repeated sweep can never
|
|
48
|
-
* double-notify the same row. Returns the number of synthetic notifications
|
|
49
|
-
* created (not the number of rows claimed -- most claims are silent backlog
|
|
50
|
-
* drain of non-'aborted' terminal rows, see `notifyTrackedInvocationFailure`).
|
|
51
|
-
*/
|
|
52
|
-
export declare function notifyTerminalTrackedInvocations(dal: Pick<Dal, 'listClaimableTerminalTrackedInvocations' | 'claimTrackedInvocationNotification' | 'insertTeamChatLog'>, notifiedBy: string, limit?: number): number;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type Database from './sqlite.js';
|
|
2
|
-
export type TrackedInvocationKind = 'chat' | 'exec';
|
|
3
|
-
export type TrackedInvocationOrigin = 'agent' | 'operator' | 'mcp' | 'unknown';
|
|
4
|
-
export type TrackedInvocationLaunchSource = 'chat' | 'exec' | 'terminal' | 'unknown';
|
|
5
|
-
export type TrackedInvocationStatus = 'running' | 'done' | 'error' | 'busy' | 'cancelled' | 'aborted';
|
|
6
|
-
export interface TrackedInvocationRow {
|
|
7
|
-
id: number;
|
|
8
|
-
kind: TrackedInvocationKind;
|
|
9
|
-
origin: TrackedInvocationOrigin;
|
|
10
|
-
scope_teamfile: string | null;
|
|
11
|
-
from_identity: string;
|
|
12
|
-
target_teamfile: string | null;
|
|
13
|
-
target_alias: string | null;
|
|
14
|
-
root_teamfile: string | null;
|
|
15
|
-
cwd: string | null;
|
|
16
|
-
command: string | null;
|
|
17
|
-
status: TrackedInvocationStatus;
|
|
18
|
-
started_at: string;
|
|
19
|
-
ended_at: string | null;
|
|
20
|
-
holder_pid: number | null;
|
|
21
|
-
holder_host: string | null;
|
|
22
|
-
last_heartbeat_at: string | null;
|
|
23
|
-
exit_code: number | null;
|
|
24
|
-
signal: string | null;
|
|
25
|
-
result_summary: string | null;
|
|
26
|
-
error: string | null;
|
|
27
|
-
team_chat_log_id: number | null;
|
|
28
|
-
meta: string | null;
|
|
29
|
-
notified_by: string | null;
|
|
30
|
-
notified_at: string | null;
|
|
31
|
-
launch_source: TrackedInvocationLaunchSource | null;
|
|
32
|
-
request_payload: string | null;
|
|
33
|
-
/**
|
|
34
|
-
* The id of the tracked_invocation whose turn SENT the message that
|
|
35
|
-
* triggered this one -- the dispatch-lineage edge `lmctl running --tree`
|
|
36
|
-
* walks. Null for a root (a session not itself triggered by another
|
|
37
|
-
* tracked turn, e.g. the operator's own direct dispatch). Threaded via the
|
|
38
|
-
* LMCTL_INVOCATION_ID env var (set on the spawned provider process, read
|
|
39
|
-
* back by a NESTED dispatch it makes) -- not backfillable for rows
|
|
40
|
-
* created before this column existed.
|
|
41
|
-
*/
|
|
42
|
-
parent_invocation_id: number | null;
|
|
43
|
-
/**
|
|
44
|
-
* JSON array of human-readable strings when this turn's provider silently
|
|
45
|
-
* dropped a declared model=/effort= (task #232) -- e.g.
|
|
46
|
-
* `["copilot terminal ignored model=X: <reason>"]`. Null when the
|
|
47
|
-
* provider honored its declared config; absence IS the signal, not a
|
|
48
|
-
* placeholder empty array.
|
|
49
|
-
*/
|
|
50
|
-
config_warnings: string | null;
|
|
51
|
-
}
|
|
52
|
-
export interface TrackedInvocationInput {
|
|
53
|
-
kind: TrackedInvocationKind;
|
|
54
|
-
origin: TrackedInvocationOrigin;
|
|
55
|
-
/**
|
|
56
|
-
* Teamfile fields must already be canonical keys produced by the same
|
|
57
|
-
* resolver used for agent_inflight and team_chat_log. The DAL stores them
|
|
58
|
-
* verbatim so wait scopes cannot silently diverge from chat scopes.
|
|
59
|
-
*/
|
|
60
|
-
scope_teamfile?: string | null;
|
|
61
|
-
from_identity: string;
|
|
62
|
-
target_teamfile?: string | null;
|
|
63
|
-
target_alias?: string | null;
|
|
64
|
-
root_teamfile?: string | null;
|
|
65
|
-
cwd?: string | null;
|
|
66
|
-
command?: string | null;
|
|
67
|
-
started_at?: string;
|
|
68
|
-
holder_pid?: number | null;
|
|
69
|
-
holder_host?: string | null;
|
|
70
|
-
last_heartbeat_at?: string | null;
|
|
71
|
-
meta?: string | null;
|
|
72
|
-
launch_source?: TrackedInvocationLaunchSource | null;
|
|
73
|
-
request_payload?: string | null;
|
|
74
|
-
parent_invocation_id?: number | null;
|
|
75
|
-
}
|
|
76
|
-
export interface TrackedInvocationFinishPatch {
|
|
77
|
-
status: Exclude<TrackedInvocationStatus, 'running'>;
|
|
78
|
-
ended_at?: string;
|
|
79
|
-
exit_code?: number | null;
|
|
80
|
-
signal?: string | null;
|
|
81
|
-
result_summary?: string | null;
|
|
82
|
-
error?: string | null;
|
|
83
|
-
team_chat_log_id?: number | null;
|
|
84
|
-
meta?: string | null;
|
|
85
|
-
/** JSON-encoded array of config-drop warning strings (task #232). Omit or
|
|
86
|
-
* pass null to leave any already-set value untouched (COALESCE, same
|
|
87
|
-
* convention as `meta`). */
|
|
88
|
-
config_warnings?: string | null;
|
|
89
|
-
}
|
|
90
|
-
export interface TrackedInvocationListFilter {
|
|
91
|
-
from?: string;
|
|
92
|
-
scope_teamfile?: string;
|
|
93
|
-
status?: TrackedInvocationStatus;
|
|
94
|
-
kind?: TrackedInvocationKind;
|
|
95
|
-
origin?: TrackedInvocationOrigin;
|
|
96
|
-
limit?: number;
|
|
97
|
-
}
|
|
98
|
-
export interface TrackedInvocationTerminalClaimFilter {
|
|
99
|
-
from?: string;
|
|
100
|
-
scope_teamfile?: string;
|
|
101
|
-
limit?: number;
|
|
102
|
-
}
|
|
103
|
-
export declare function prepareTrackedInvocationStatements(db: Database): {
|
|
104
|
-
insertTrackedInvocation: import("./sqlite.js").Statement;
|
|
105
|
-
getTrackedInvocation: import("./sqlite.js").Statement;
|
|
106
|
-
listAllRunningTrackedInvocations: import("./sqlite.js").Statement;
|
|
107
|
-
listRecentlyFinishedTrackedInvocations: import("./sqlite.js").Statement;
|
|
108
|
-
finishTrackedInvocation: import("./sqlite.js").Statement;
|
|
109
|
-
reclaimTrackedInvocationIfUnchanged: import("./sqlite.js").Statement;
|
|
110
|
-
heartbeatTrackedInvocation: import("./sqlite.js").Statement;
|
|
111
|
-
claimTrackedInvocationNotification: import("./sqlite.js").Statement;
|
|
112
|
-
updateTrackedInvocationRequestPayload: import("./sqlite.js").Statement;
|
|
113
|
-
linkTrackedInvocationChatLog: import("./sqlite.js").Statement;
|
|
114
|
-
abortTrackedInvocationIfUnchanged: import("./sqlite.js").Statement;
|
|
115
|
-
};
|
|
116
|
-
export declare function truncateTrackedInvocationField(value: string | null | undefined): string | null;
|
package/dist/mcp/dispatch.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface BridgeConfig {
|
|
2
|
-
baseUrl: string;
|
|
3
|
-
token: string | null;
|
|
4
|
-
}
|
|
5
|
-
export interface BridgeOkResponse {
|
|
6
|
-
status: 'ok';
|
|
7
|
-
data: unknown;
|
|
8
|
-
}
|
|
9
|
-
export interface BridgeErrorResponse {
|
|
10
|
-
status: 'error';
|
|
11
|
-
code: number;
|
|
12
|
-
message: string;
|
|
13
|
-
body?: unknown;
|
|
14
|
-
}
|
|
15
|
-
export type BridgeResponse = BridgeOkResponse | BridgeErrorResponse;
|
|
16
|
-
/**
|
|
17
|
-
* Minimal fetch-shape injection point for tests. The default uses
|
|
18
|
-
* `globalThis.fetch` (Node 22 native).
|
|
19
|
-
*/
|
|
20
|
-
export type FetchFn = (input: string, init: RequestInit) => Promise<Response>;
|
|
21
|
-
export interface DispatchDeps {
|
|
22
|
-
config: BridgeConfig;
|
|
23
|
-
fetchFn?: FetchFn;
|
|
24
|
-
dal?: unknown;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Validate tool name + input shape against the registered schema, dispatch,
|
|
28
|
-
* then wrap the response.
|
|
29
|
-
*
|
|
30
|
-
* Schema validation here is intentionally shallow (required-field +
|
|
31
|
-
* type-tag checks) — full JSON Schema validation would pull a dependency
|
|
32
|
-
* we don't need for Phase 1 and the apicli HTTP routes already validate
|
|
33
|
-
* payloads themselves.
|
|
34
|
-
*/
|
|
35
|
-
export declare function dispatchTool(toolName: string, args: unknown, _deps: DispatchDeps): Promise<BridgeResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Read api.url + api.token from the canonical SQLite config table
|
|
38
|
-
* (DB > env > default for api.url; LMCTL_API_TOKEN > DB for api.token).
|
|
39
|
-
* The `lmctl api config` surface that used to write these was removed with
|
|
40
|
-
* the daemon surface (moved to lmbee) — operators set them via env vars or
|
|
41
|
-
* lmbee-side tooling.
|
|
42
|
-
*/
|
|
43
|
-
export declare function readBridgeConfig(dal: {
|
|
44
|
-
getConfig(key: string): string | null;
|
|
45
|
-
}, env?: NodeJS.ProcessEnv): BridgeConfig;
|