@lmctl-ai/lmctl 0.2.38 → 0.2.40

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.
Files changed (202) hide show
  1. package/README.md +16 -0
  2. package/bin/lmbee +2 -0
  3. package/bin/lmscript +3 -0
  4. package/build-info.json +1 -0
  5. package/dist/cli/index.js +485 -460
  6. package/dist/cli/schema.sql +0 -169
  7. package/dist/cli/script.js +246 -246
  8. package/dist/lmbee.js +960 -0
  9. package/dist/lmscript.js +388 -0
  10. package/dist/public/app.js +379 -0
  11. package/dist/public/index.html +78 -0
  12. package/dist/public/styles.css +160 -0
  13. package/dist/schema.sql +455 -0
  14. package/dist/vendor-webui/index.html +18 -0
  15. package/dist/vendor-webui/local.js +231 -0
  16. package/dist/vendor-webui/styles.css +1852 -0
  17. package/package.json +11 -7
  18. package/dist/cli/batch.d.ts +0 -2
  19. package/dist/cli/busy-evidence.d.ts +0 -27
  20. package/dist/cli/chat-cycle.d.ts +0 -59
  21. package/dist/cli/chat-exec.d.ts +0 -91
  22. package/dist/cli/chat-policy.d.ts +0 -22
  23. package/dist/cli/chat.d.ts +0 -14
  24. package/dist/cli/code-resolver.d.ts +0 -8
  25. package/dist/cli/common.d.ts +0 -57
  26. package/dist/cli/context.d.ts +0 -12
  27. package/dist/cli/cost.d.ts +0 -2
  28. package/dist/cli/export.d.ts +0 -2
  29. package/dist/cli/hello.d.ts +0 -10
  30. package/dist/cli/index.d.ts +0 -3
  31. package/dist/cli/infra.d.ts +0 -78
  32. package/dist/cli/init.d.ts +0 -8
  33. package/dist/cli/intent-input.d.ts +0 -16
  34. package/dist/cli/intent-match.d.ts +0 -30
  35. package/dist/cli/intent-sessions.d.ts +0 -24
  36. package/dist/cli/intent-team.d.ts +0 -25
  37. package/dist/cli/intent.d.ts +0 -22
  38. package/dist/cli/ls.d.ts +0 -2
  39. package/dist/cli/mailbox-cli.d.ts +0 -6
  40. package/dist/cli/managed.d.ts +0 -62
  41. package/dist/cli/mcp-install.d.ts +0 -23
  42. package/dist/cli/mcp.d.ts +0 -2
  43. package/dist/cli/model.d.ts +0 -21
  44. package/dist/cli/paths.d.ts +0 -50
  45. package/dist/cli/plan-wizard.d.ts +0 -42
  46. package/dist/cli/plan.d.ts +0 -20
  47. package/dist/cli/queue-delivery.d.ts +0 -122
  48. package/dist/cli/quickrun.d.ts +0 -14
  49. package/dist/cli/ratelimit.d.ts +0 -2
  50. package/dist/cli/remote-fetch.d.ts +0 -7
  51. package/dist/cli/run-queries.d.ts +0 -82
  52. package/dist/cli/running.d.ts +0 -5
  53. package/dist/cli/save-script.d.ts +0 -41
  54. package/dist/cli/script.d.ts +0 -6
  55. package/dist/cli/seed-flight.d.ts +0 -2
  56. package/dist/cli/self-identity.d.ts +0 -25
  57. package/dist/cli/session-idle.d.ts +0 -118
  58. package/dist/cli/status.d.ts +0 -22
  59. package/dist/cli/tail.d.ts +0 -18
  60. package/dist/cli/target-resolver.d.ts +0 -139
  61. package/dist/cli/team-status.d.ts +0 -91
  62. package/dist/cli/teamfile-compat.d.ts +0 -116
  63. package/dist/cli/teamfile-store.d.ts +0 -18
  64. package/dist/cli/teamfile-template.d.ts +0 -47
  65. package/dist/cli/template-env.d.ts +0 -25
  66. package/dist/cli/terminal-lock.d.ts +0 -25
  67. package/dist/cli/terminal.d.ts +0 -23
  68. package/dist/cli/time-filter.d.ts +0 -10
  69. package/dist/cli/update-notifier.d.ts +0 -11
  70. package/dist/cli/version-util.d.ts +0 -23
  71. package/dist/config/seed_templates.d.ts +0 -1
  72. package/dist/db/backfill-event-log.d.ts +0 -26
  73. package/dist/db/delegation.d.ts +0 -37
  74. package/dist/db/escalation_vocab.d.ts +0 -45
  75. package/dist/db/event-log.d.ts +0 -40
  76. package/dist/db/index.d.ts +0 -1213
  77. package/dist/db/inflight-acquire.d.ts +0 -70
  78. package/dist/db/invocation-event-projections.d.ts +0 -65
  79. package/dist/db/ledger-identity.test.d.ts +0 -1
  80. package/dist/db/live-event-projections.d.ts +0 -92
  81. package/dist/db/migrate.d.ts +0 -51
  82. package/dist/db/open-readonly.d.ts +0 -2
  83. package/dist/db/process-liveness.d.ts +0 -37
  84. package/dist/db/sqlite.d.ts +0 -53
  85. package/dist/db/sqlite.test.d.ts +0 -1
  86. package/dist/db/terminal-lock.d.ts +0 -14
  87. package/dist/db/tracked-invocation-reconcile.d.ts +0 -52
  88. package/dist/db/tracked-invocation.d.ts +0 -116
  89. package/dist/mcp/dispatch.d.ts +0 -45
  90. package/dist/mcp/mediation.d.ts +0 -128
  91. package/dist/mcp/path-warning.d.ts +0 -7
  92. package/dist/mcp/server.d.ts +0 -63
  93. package/dist/mcp/tools.d.ts +0 -24
  94. package/dist/providers/adapter.d.ts +0 -271
  95. package/dist/providers/adapters/agy-adapter.d.ts +0 -18
  96. package/dist/providers/adapters/claude-adapter.d.ts +0 -20
  97. package/dist/providers/adapters/codex-adapter.d.ts +0 -22
  98. package/dist/providers/adapters/copilot-adapter.d.ts +0 -16
  99. package/dist/providers/adapters/dsh-adapter.d.ts +0 -89
  100. package/dist/providers/adapters/gemini-adapter.d.ts +0 -44
  101. package/dist/providers/adapters/hermes-adapter.d.ts +0 -71
  102. package/dist/providers/adapters/index.d.ts +0 -35
  103. package/dist/providers/adapters/kimi-adapter.d.ts +0 -16
  104. package/dist/providers/adapters/lmplayer-adapter.d.ts +0 -14
  105. package/dist/providers/adapters/opencode-adapter.d.ts +0 -11
  106. package/dist/providers/adapters/pi-adapter.d.ts +0 -17
  107. package/dist/providers/adapters/print-turn.d.ts +0 -29
  108. package/dist/providers/adapters/qwen-adapter.d.ts +0 -11
  109. package/dist/providers/agy.d.ts +0 -32
  110. package/dist/providers/base-adapter.d.ts +0 -110
  111. package/dist/providers/base.d.ts +0 -12
  112. package/dist/providers/binary-check.d.ts +0 -102
  113. package/dist/providers/bundle.d.ts +0 -124
  114. package/dist/providers/claude-mock.d.ts +0 -90
  115. package/dist/providers/claude.d.ts +0 -21
  116. package/dist/providers/codex-config.d.ts +0 -15
  117. package/dist/providers/codex.d.ts +0 -25
  118. package/dist/providers/config/init-config.d.ts +0 -59
  119. package/dist/providers/config/init-edit.d.ts +0 -3
  120. package/dist/providers/config/init-file.d.ts +0 -20
  121. package/dist/providers/config/init-write.d.ts +0 -2
  122. package/dist/providers/config/model-selection-lint.d.ts +0 -70
  123. package/dist/providers/config/team-config.d.ts +0 -184
  124. package/dist/providers/config/types.d.ts +0 -146
  125. package/dist/providers/config/user-config.d.ts +0 -88
  126. package/dist/providers/copilot.d.ts +0 -21
  127. package/dist/providers/debug.d.ts +0 -128
  128. package/dist/providers/dsh-sidecar.d.ts +0 -65
  129. package/dist/providers/dsh-zstd.d.ts +0 -27
  130. package/dist/providers/dsh.d.ts +0 -37
  131. package/dist/providers/frontmatter.d.ts +0 -46
  132. package/dist/providers/gemini-session-reader.d.ts +0 -151
  133. package/dist/providers/gemini.d.ts +0 -39
  134. package/dist/providers/hermes.d.ts +0 -90
  135. package/dist/providers/index.d.ts +0 -423
  136. package/dist/providers/kimi.d.ts +0 -37
  137. package/dist/providers/model-catalog.d.ts +0 -145
  138. package/dist/providers/model-suggestions.d.ts +0 -4
  139. package/dist/providers/one-shot-timeout.d.ts +0 -1
  140. package/dist/providers/opencode-config.d.ts +0 -62
  141. package/dist/providers/opencode.d.ts +0 -40
  142. package/dist/providers/parsers/acp.d.ts +0 -71
  143. package/dist/providers/parsers/codex-app-server.d.ts +0 -60
  144. package/dist/providers/parsers/stream-json.d.ts +0 -57
  145. package/dist/providers/passive-readers/agy.d.ts +0 -155
  146. package/dist/providers/passive-readers/copilot.d.ts +0 -173
  147. package/dist/providers/passive-readers/dsh.d.ts +0 -34
  148. package/dist/providers/passive-readers/kimi.d.ts +0 -44
  149. package/dist/providers/passive-readers/opencode.d.ts +0 -89
  150. package/dist/providers/passive-readers/qwen.d.ts +0 -151
  151. package/dist/providers/passive-readers/shared.d.ts +0 -138
  152. package/dist/providers/passive-session-reader.d.ts +0 -188
  153. package/dist/providers/path-utils.d.ts +0 -1
  154. package/dist/providers/pi.d.ts +0 -32
  155. package/dist/providers/pricing.d.ts +0 -107
  156. package/dist/providers/qwen.d.ts +0 -22
  157. package/dist/providers/ratelimit/agy.d.ts +0 -22
  158. package/dist/providers/ratelimit/claude-auth.d.ts +0 -13
  159. package/dist/providers/ratelimit/claude.d.ts +0 -6
  160. package/dist/providers/ratelimit/codex.d.ts +0 -7
  161. package/dist/providers/ratelimit/kimi-auth.d.ts +0 -15
  162. package/dist/providers/ratelimit/kimi.d.ts +0 -6
  163. package/dist/providers/ratelimit/schema.d.ts +0 -28
  164. package/dist/providers/ratelimit-readings.d.ts +0 -19
  165. package/dist/providers/registry.d.ts +0 -31
  166. package/dist/providers/resume.d.ts +0 -43
  167. package/dist/providers/seed-instruction.d.ts +0 -3
  168. package/dist/providers/self-session-env.d.ts +0 -21
  169. package/dist/providers/session-limit.d.ts +0 -9
  170. package/dist/providers/strip-ansi.d.ts +0 -5
  171. package/dist/providers/transport-errors.d.ts +0 -94
  172. package/dist/providers/transport-lifecycle.d.ts +0 -63
  173. package/dist/providers/transport-wrappers.d.ts +0 -110
  174. package/dist/providers/transports/acp-profiles/config-option-step.d.ts +0 -24
  175. package/dist/providers/transports/acp-profiles/copilot.d.ts +0 -12
  176. package/dist/providers/transports/acp-profiles/gemini.d.ts +0 -22
  177. package/dist/providers/transports/acp-profiles/hermes.d.ts +0 -27
  178. package/dist/providers/transports/acp-profiles/index.d.ts +0 -19
  179. package/dist/providers/transports/acp-profiles/kimi.d.ts +0 -24
  180. package/dist/providers/transports/acp-profiles/opencode.d.ts +0 -26
  181. package/dist/providers/transports/acp-profiles/types.d.ts +0 -258
  182. package/dist/providers/transports/acp-rpc.d.ts +0 -18
  183. package/dist/providers/transports/acp.d.ts +0 -217
  184. package/dist/providers/transports/codex-app-server.d.ts +0 -190
  185. package/dist/providers/transports/hold-open.d.ts +0 -120
  186. package/dist/providers/transports/manager.d.ts +0 -21
  187. package/dist/providers/transports/stream-json.d.ts +0 -162
  188. package/dist/providers/transports/types.d.ts +0 -56
  189. package/dist/providers/types.d.ts +0 -154
  190. package/dist/providers/yolo-contract.d.ts +0 -131
  191. package/dist/script/adapter.d.ts +0 -107
  192. package/dist/script/batch-script.d.ts +0 -7
  193. package/dist/script/index.d.ts +0 -3
  194. package/dist/script/init-environment.d.ts +0 -8
  195. package/dist/script/lmbee-module.d.ts +0 -2
  196. package/dist/script/lmscript.d.ts +0 -647
  197. package/dist/shared/policy.d.ts +0 -74
  198. package/dist/shared-lib/db.d.ts +0 -25
  199. package/dist/shared-lib/passive-session-reader.d.ts +0 -2
  200. package/dist/shared-lib/provider-parse.d.ts +0 -6
  201. package/dist/templates/basedir.d.ts +0 -52
  202. package/dist/uri/lmctl_uri.d.ts +0 -38
package/package.json CHANGED
@@ -1,26 +1,30 @@
1
1
  {
2
2
  "name": "@lmctl-ai/lmctl",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "description": "A provider-agnostic control plane for teams of AI coding agents — across providers, with independent review and durable memory.",
5
5
  "type": "module",
6
6
  "homepage": "https://lmctl.com",
7
7
  "author": "Lattice Systems LLC",
8
8
  "bin": {
9
- "lmctl": "bin/lmctl"
9
+ "lmctl": "bin/lmctl",
10
+ "lmscript": "bin/lmscript",
11
+ "lmbee": "bin/lmbee"
10
12
  },
13
+ "repository": "git+https://github.com/lmctlhq/lmctl-mono.git",
11
14
  "exports": {
12
- "./script": {
13
- "types": "./dist/script/index.d.ts",
14
- "default": "./dist/cli/script.js"
15
- },
16
15
  "./package.json": "./package.json"
17
16
  },
18
17
  "files": [
19
18
  "dist/cli/index.js",
20
19
  "dist/cli/script.js",
21
- "dist/**/*.d.ts",
22
20
  "dist/cli/schema.sql",
21
+ "dist/schema.sql",
22
+ "dist/lmscript.js",
23
+ "dist/lmbee.js",
23
24
  "dist/config/",
25
+ "dist/public/",
26
+ "dist/vendor-webui/",
27
+ "build-info.json",
24
28
  "data/price-data.json",
25
29
  "data/price-aliases.json",
26
30
  "workflows/",
@@ -1,2 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare function runBatch(args: string[], io?: CliIo): Promise<number>;
@@ -1,27 +0,0 @@
1
- /**
2
- * Shared "who holds this, and are they alive / how long" evidence for busy/held
3
- * errors — the same instinct as the #80 terminal busy/held-evidence, factored
4
- * out so the chat busy-now path and terminal.ts do not each re-derive the
5
- * live/dead verdict.
6
- */
7
- export type HolderLiveness = 'live' | 'dead' | null;
8
- export interface BusyHolderEvidence {
9
- holder_pid: number | null;
10
- holder_liveness: HolderLiveness;
11
- /** ISO timestamp the current turn/hold started. */
12
- since: string;
13
- /** Wall-clock ms since `since` (time the target has been active) — the
14
- * "time-since-last-activity" evidence; null when `since` is unparseable. */
15
- idle_ms: number | null;
16
- }
17
- /** live/dead/null verdict for a holder pid — null means "no pid recorded". */
18
- export declare function holderLiveness(holderPid: number | null): HolderLiveness;
19
- export declare function busyHolderEvidence(input: {
20
- holderPid: number | null;
21
- since: string;
22
- nowMs?: number;
23
- }): BusyHolderEvidence;
24
- /** Human duration via lmformat, e.g. "0s", "45s", "3m 12s", "2h 5m". */
25
- export declare function formatElapsed(ms: number): string;
26
- /** Parenthesised evidence suffix: `(active 3m 12s; holder_pid=123, live)`. */
27
- export declare function formatBusyEvidence(ev: BusyHolderEvidence): string;
@@ -1,59 +0,0 @@
1
- import type { Dal } from '../db/index.js';
2
- export declare const CYCLE_FRESH_WINDOW_MS = 60000;
3
- /**
4
- * How many cross-team hops must be SIMULTANEOUSLY IN FLIGHT before a revisit is
5
- * treated as a runaway loop rather than a normal exchange.
6
- *
7
- * WHY THIS IS A HOP COUNT AND NOT A COUNT OF REVISITS. The obvious reading of
8
- * the name is "how many times has this target already appeared in the chain",
9
- * but that number can never exceed 1: `ancestorChain` walks parent pointers and
10
- * breaks on the first node it has already seen, so the chain it returns is
11
- * DEDUPLICATED. Gating on `priorTargetEntries.length >= 2` would therefore be
12
- * dead code that disables cycle detection entirely.
13
- *
14
- * Counting repeats over time does not work either: `releaseAgentInflight`
15
- * deletes the row when an exchange completes, so a finished hop leaves no trace
16
- * here, and the lease forbids two concurrent holds of the same lane. The live
17
- * table only ever shows what is in flight RIGHT NOW.
18
- *
19
- * What that table can tell us is how deep the live cross-team call stack is,
20
- * and that is the signal that actually separates the two cases:
21
- *
22
- * 1 hop — A is holding B, and B messages A back. One outstanding call: a
23
- * reply, an acknowledgement, a bounded handshake. NOT a loop. This
24
- * is the case that was being blocked (`lmmol → diagramkit → lmmol`,
25
- * a 3-node chain), stalling a real cross-team review.
26
- * 2 hops — A is holding B AND B is holding A, and another cross-team call is
27
- * being opened on top. Both parties are now blocked inside each
28
- * other; nothing can unwind. That is a live deadlock, and it is what
29
- * this mechanism exists to stop.
30
- *
31
- * So: one outstanding hop is allowed, two or more is refused. Raising this
32
- * further would let genuinely stuck stacks keep growing, which is the failure
33
- * mode the whole check is here to prevent.
34
- */
35
- export declare const CYCLE_MAX_REVISITS = 2;
36
- export interface ChatCycleNode {
37
- teamfile: string;
38
- alias: string;
39
- }
40
- export interface DetectCrossTeamCycleInput {
41
- root: string;
42
- sender: ChatCycleNode;
43
- receiverTeamfile: string;
44
- receiverAlias: string;
45
- now: Date;
46
- }
47
- export interface DetectCrossTeamCycleResult {
48
- stop: boolean;
49
- chain: string;
50
- }
51
- type ChatCycleDal = Pick<Dal, 'listAgentInflight' | 'clearAgentInflightOlderThan'>;
52
- export declare function detectCrossTeamCycle(dal: ChatCycleDal, input: DetectCrossTeamCycleInput): DetectCrossTeamCycleResult;
53
- export declare function deriveRootFromLiveInflight(dal: ChatCycleDal, input: {
54
- sender: ChatCycleNode;
55
- now: Date;
56
- }): string | null;
57
- export declare function agentInflightTtlMsFromEnv(env?: NodeJS.ProcessEnv): number;
58
- export declare function crossTeamCycleMessage(chain: string): string;
59
- export {};
@@ -1,91 +0,0 @@
1
- import type { ProgressEvent } from '../providers/index.js';
2
- import type { BundleSession } from '../providers/bundle.js';
3
- import type { PermissionMode } from '../providers/yolo-contract.js';
4
- import type { AgentInflightInput } from '../db/index.js';
5
- import { type CliIo } from './common.js';
6
- export type AiTeamChatEvent = {
7
- kind: 'delta';
8
- chunk: string;
9
- } | {
10
- kind: 'progress';
11
- alias: string;
12
- event: ProgressEvent;
13
- } | {
14
- kind: 'warning';
15
- message: string;
16
- };
17
- export type AiTeamChatResult = {
18
- status: 'ok';
19
- replyText: string;
20
- wroteDelta: boolean;
21
- teamChatLogId: number | null;
22
- messageId: string | null;
23
- durationMs?: number;
24
- } | {
25
- status: 'stalled';
26
- replyText: string;
27
- wroteDelta: boolean;
28
- teamChatLogId: number | null;
29
- messageId: string | null;
30
- durationMs?: number;
31
- } | {
32
- /** See queue-delivery.ts's DeliverLaneResult 'empty' variant. */
33
- status: 'empty';
34
- replyText: string;
35
- wroteDelta: boolean;
36
- teamChatLogId: number | null;
37
- messageId: string | null;
38
- durationMs?: number;
39
- } | {
40
- status: 'busy';
41
- message: string;
42
- teamChatLogId: number | null;
43
- } | {
44
- status: 'error';
45
- errorKind: 'cycle' | 'provider' | 'target';
46
- message: string;
47
- teamChatLogId: number | null;
48
- messageId: string | null;
49
- };
50
- export interface ExecuteAiTeamChatTurnInput {
51
- teamfile: string;
52
- alias: string;
53
- prompt: string;
54
- /** Refuse to dispatch if a multi-turn caller's target session changed. */
55
- expectedSession?: {
56
- provider: string;
57
- sessionid: string;
58
- };
59
- permissionMode: PermissionMode;
60
- idleTimeoutMs?: number;
61
- rootFlag?: string;
62
- env?: NodeJS.ProcessEnv;
63
- /** v61: per-message framing for the team_chat_log row — 'batch' when this
64
- * turn is one prompt of a `lmctl batch` run; omitted (NULL) otherwise. */
65
- messageType?: 'batch';
66
- /**
67
- * Caller-held in-flight lease (batch bundle mode): the caller
68
- * acquired the `agent_inflight` lease once for the whole bundle, so this
69
- * turn skips the receiver busy check AND the acquire/release/heartbeat —
70
- * they all moved to bundle scope. Instead the turn VERIFIES per prompt
71
- * that the caller still holds the lease, matched by lease identity AND
72
- * holder pid (the heartbeat call doubles as a lease-CAS touch); a lost
73
- * lease fails the turn, aborting the bundle instead of dispatching
74
- * unsynchronized. The per-turn chat pointer, tracked_invocation, and
75
- * team_chat_log row are unaffected.
76
- */
77
- heldLease?: {
78
- row: AgentInflightInput;
79
- leaseId: string;
80
- };
81
- /**
82
- * Caller-held bundle provider session (batch bundle mode): the turn
83
- * goes through the already-open provider process. See
84
- * src/providers/bundle.ts for the lifecycle contract.
85
- */
86
- bundleSession?: BundleSession;
87
- io: CliIo;
88
- onEvent?: (event: AiTeamChatEvent) => void;
89
- onAccepted?: (messageId: string) => void;
90
- }
91
- export declare function executeAiTeamChatTurn(input: ExecuteAiTeamChatTurnInput): Promise<AiTeamChatResult>;
@@ -1,22 +0,0 @@
1
- export interface ChatPolicyTeam {
2
- teamfile: string;
3
- aliases: readonly string[];
4
- leadAlias: string | null;
5
- }
6
- export interface ChatPolicyRegistry {
7
- teams: readonly ChatPolicyTeam[];
8
- }
9
- export interface CanSendInput {
10
- rootTeamfile: string;
11
- fromTeamfile: string;
12
- fromAlias: string;
13
- toTeamfile: string;
14
- toAlias: string;
15
- registry: ChatPolicyRegistry;
16
- }
17
- export interface CanSendResult {
18
- allowed: boolean;
19
- reason: string;
20
- outOfPolicy: boolean;
21
- }
22
- export declare function canSend(input: CanSendInput): CanSendResult;
@@ -1,14 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare function runChat(args: string[], io?: CliIo): Promise<number>;
3
- /**
4
- * Resolve `--prompt-file` to the prompt text. Reads the file (or stdin for
5
- * `-`) as UTF-8 and returns it byte-for-byte EXCEPT for exactly one trailing
6
- * newline, which is stripped so `--prompt-file f` matches what the author sees
7
- * in the editor (files conventionally end with a newline). A CRLF terminator
8
- * counts as that one newline.
9
- *
10
- * No shell is involved at any point, which is the entire purpose.
11
- */
12
- export declare function resolvePromptInput(promptFile: string, io: CliIo, stdin?: NodeJS.ReadableStream): Promise<string | {
13
- error: string;
14
- }>;
@@ -1,8 +0,0 @@
1
- import type { Dal, ProjectRow, TeamMemberRow, TeamRow } from '../db/index.js';
2
- import { type CliIo } from './common.js';
3
- export interface ProjectResolvingIo extends CliIo {
4
- cwd?: string;
5
- }
6
- export declare function resolveProject(io: ProjectResolvingIo, dal: Dal, override?: string): ProjectRow | number;
7
- export declare function resolveTeam(io: ProjectResolvingIo, dal: Dal, project: ProjectRow, override?: string): TeamRow | number;
8
- export declare function resolveAlias(io: ProjectResolvingIo, dal: Dal, team: TeamRow, override?: string): TeamMemberRow | number;
@@ -1,57 +0,0 @@
1
- import { type Dal } from '../db/index.js';
2
- export interface CliWriter {
3
- write(chunk: string): unknown;
4
- }
5
- export interface CliReader {
6
- isTTY?: boolean;
7
- setEncoding?(encoding: BufferEncoding): unknown;
8
- resume?(): unknown;
9
- pause?(): unknown;
10
- once(event: 'data', listener: (chunk: string | Buffer) => void): unknown;
11
- }
12
- export interface CliIo {
13
- stdout: CliWriter;
14
- stderr: CliWriter;
15
- stdin?: CliReader;
16
- dal?: Dal;
17
- cwd?: string;
18
- env?: NodeJS.ProcessEnv;
19
- }
20
- /** Scoped to this invocation and inherited by child lmctl calls. */
21
- export declare function isNonInteractive(io: CliIo): boolean;
22
- export declare function nonInteractiveIo(io: CliIo): CliIo;
23
- export interface ParsedFlags {
24
- positionals: string[];
25
- flags: Record<string, string | boolean>;
26
- error?: string;
27
- }
28
- export declare function withDal<T>(io: CliIo, fn: (dal: Dal) => Promise<T> | T): Promise<T>;
29
- export declare function parseFlags(args: string[], valueFlags: string[], boolFlags?: string[]): ParsedFlags;
30
- export declare function flagString(parsed: ParsedFlags, name: string): string | undefined;
31
- export declare function flagBool(parsed: ParsedFlags, name: string): boolean;
32
- export declare function writeJson(io: CliIo, value: unknown): void;
33
- export declare function userError(io: CliIo, message: string): number;
34
- /** Local wall-clock `HH:MM:SS` for progress-narration lines (batch, and any
35
- * command whose stderr narration benefits from a when-did-this-happen marker
36
- * without a full date). */
37
- export declare function hhmmss(): string;
38
- /** Silence-aware heartbeat for waits that can run long (provider seed spawn,
39
- * a multi-minute chat turn, a batch prompt). Writes `renderLine(elapsedSeconds)`
40
- * to stderr every `intervalMs`, but SKIPS the tick when `poke()` was called
41
- * within the last interval -- streaming events already tell the user work is
42
- * happening, so only true silence earns a "still running" line. The timer is
43
- * unref'd; callers must `stop()` in a finally. */
44
- export declare function startSilenceHeartbeat(io: CliIo, renderLine: (elapsedSeconds: number) => string, intervalMs?: number): {
45
- poke: () => void;
46
- stop: () => void;
47
- };
48
- export declare function internalError(io: CliIo, error: unknown): number;
49
- /** Reads the LMCTL_INVOCATION_ID env var a parent turn's own dispatch set on
50
- * this process -- the dispatch-lineage edge `lmctl running --tree` walks.
51
- * Malformed/absent -> null (this dispatch is a root, e.g. a human's direct
52
- * `lmctl prompt`/`lmctl terminal`). Shared by chat-exec.ts and terminal.ts,
53
- * the two places a tracked_invocation row gets created. */
54
- export declare function parseInvocationIdEnv(value: string | undefined): number | null;
55
- export declare function installStdoutEpipeGuard(io: CliIo): void;
56
- /** Test-only: reset the once-flag so install behaviour can be asserted. */
57
- export declare function _resetStdoutEpipeGuardForTests(): void;
@@ -1,12 +0,0 @@
1
- import type { Dal, ProjectRow } from '../db/index.js';
2
- /**
3
- * Walk from `cwd` (and each ancestor up to the filesystem root) looking
4
- * for a project whose `local_path` is that exact path. Returns the first
5
- * hit, or `null` when none match.
6
- *
7
- * Path comparison is exact-string after `resolve()` normalization on
8
- * both the query path and the DB value. On Linux + WSL2 (per § 12 of the
9
- * design decisions) we don't normalize case or separators beyond what
10
- * `node:path` provides.
11
- */
12
- export declare function resolveActiveProject(cwd: string, dal: Dal): ProjectRow | null;
@@ -1,2 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare function runCost(args: string[], io?: CliIo): Promise<number>;
@@ -1,2 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare function runExport(args: string[], io?: CliIo): Promise<number>;
@@ -1,10 +0,0 @@
1
- import type { CliIo } from './common.js';
2
- import { runChat } from './chat.js';
3
- export interface HelloDeps {
4
- fetchFn?: typeof fetch;
5
- ask?: (question: string) => Promise<string | null>;
6
- cwd?: string;
7
- /** Test seam: defaults to the real runChat (a live provider dispatch). */
8
- sendPrompt?: typeof runChat;
9
- }
10
- export declare function runHello(args: string[], io?: CliIo, deps?: HelloDeps): Promise<number>;
@@ -1,3 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare const COMMANDS: Set<string>;
3
- export declare function runCli(args: string[], io?: CliIo): Promise<number>;
@@ -1,78 +0,0 @@
1
- /**
2
- * Thin adapter mounting lmt + lmauto as `lmctl` subcommands, gated behind
3
- * `LMCTL_INFRA_CLI`. Off by default — see
4
- * ~/repos/infraqa/lmctl-thin-merge-design.md (§2.2 "the seam") for the
5
- * original design; this was P2 of that design's phasing.
6
- *
7
- * STATUS (2026-09-10, lmauto.lmctl): `lmt` (the target this adapter was built
8
- * against) is now RETIRED — see ~/repos/tools/lmt/RETIRED.md. Its command
9
- * surface was absorbed natively into `@lmctl-ai/lmbee` (the renamed
10
- * `lmauto`), but lmbee does NOT export the `InfraLmtModule` contract this
11
- * file expects (`INFRA_CLI_CONTRACT`/`createRuntime`/a raw-exit-code
12
- * `dispatch(argv, runtime)`) — lmbee's own `dispatch(context, argv)` has a
13
- * different signature and return shape (`Promise<{output, exitCode}>`,
14
- * requires a `CliContext` built via `buildContext()`, not a bare
15
- * `runtime`), and it has no concept of a frozen `INFRA_CLI_CONTRACT` version
16
- * number at all (that was an lmt-specific, this-adapter-specific concept).
17
- * Blindly swapping the import target from `@lmctl-ai/lmt` to
18
- * `@lmctl-ai/lmbee` would NOT make this adapter work — it would still throw,
19
- * just for a different reason (shape mismatch, not MODULE_NOT_FOUND), while
20
- * looking superficially "fixed." `defaultLoadInfraModule` below has been
21
- * changed to throw directly instead of importing a package that no longer
22
- * has any plausible target, so the previously-accurate-but-now-stale
23
- * "private repo, no CI credential" reasoning doesn't linger as a misleading
24
- * TODO. Reviving `LMCTL_INFRA_CLI` needs a real design pass against lmbee's
25
- * actual `dispatch()`/`buildContext()` shape (coordinate with lmauto.lmctl,
26
- * lmbee's owner) — not a mechanical rename, and out of scope for this
27
- * cleanup. Still safely inert either way: `runInfraCommand`'s catch below
28
- * already handles the throw as the correct "not available" remediation
29
- * case, and the feature stays off by default.
30
- *
31
- * lmauto's own P1 landed first (lmauto-cli-v0.2.21, verified against
32
- * ~/repos/lmauto/src/cli/dispatch.ts): its `dispatch()` never throws for
33
- * ordinary usage/validation misuse (every malformed argv returns
34
- * `{output, exitCode: 1}`; only a genuine internal failure — DB/fs error —
35
- * still propagates), and it now exports `COMMANDS` (its 16 routable verbs,
36
- * as of the lmbee migration's Stage 2) + `PROCESS_ONLY_COMMANDS`
37
- * (`whoami`/`migrate-home`/`serve`/`peers`/`tell`/`sites`/`exec`/`fleet`/the
38
- * 6 cloud-service adapters, reachable only through lmbee's own bin, never
39
- * through `dispatch()`). Neither changes anything HERE: `InfraLmtModule.
40
- * dispatch`'s return shape below was lmt's own contract, one layer above
41
- * lmauto's/lmbee's own — with lmt retired, that specific contract has no
42
- * living implementation to target at all anymore, lmbee's own `dispatch()`
43
- * shape included. Also confirmed with lmauto/lmbee directly: its DB
44
- * resolution (`buildContext()`/`resolveLmautoDbPath()`) has no concept of
45
- * lmctl's `--db` anywhere in the chain, so the `--db` firewall correctly
46
- * lives only in `src/cli/index.ts` (already shipped), not here.
47
- */
48
- import type { CliIo } from './common.js';
49
- /** Design §2.2: lmt's embedding contract version this lmctl build expects. */
50
- export declare const INFRA_CLI_CONTRACT_EXPECTED = 1;
51
- /**
52
- * Flat command names + the `auto` namespace, per the design's §2.1
53
- * command-surface mapping. This list is pinned by the design doc itself,
54
- * not derived from lmt's export — so it can be wired into `COMMANDS` and
55
- * collision-checked before lmt exports anything.
56
- */
57
- export declare const INFRA_FLAT_COMMANDS: readonly ["lmchat", "lmmail", "lmnote", "lmsheet", "lmtext", "lmsound", "login", "whoami", "exec", "tell", "peers", "site"];
58
- export declare const INFRA_NAMESPACE_COMMAND = "auto";
59
- export declare function infraCliEnabled(env?: NodeJS.ProcessEnv): boolean;
60
- export declare function isInfraCommand(command: string): boolean;
61
- interface InfraLmtModule {
62
- INFRA_CLI_CONTRACT: number;
63
- createRuntime: (...args: unknown[]) => unknown;
64
- dispatch: (argv: string[], runtime: unknown) => Promise<number> | number;
65
- }
66
- /** Test seam — production always uses {@link defaultLoadInfraModule}. */
67
- export type InfraModuleLoader = () => Promise<InfraLmtModule>;
68
- /**
69
- * Design §2.6 acceptance criteria, implemented ahead of the real module:
70
- * - optional-absent → exit 1 + the exact remediation string (never throws
71
- * up through the CLI dispatcher).
72
- * - contract-version skew → refuse rather than dispatch into a mismatched
73
- * manifest.
74
- * - pass-through parity → argv forwarded verbatim (minus the `auto`
75
- * prefix), no re-parsing here.
76
- */
77
- export declare function runInfraCommand(command: string, args: string[], io: CliIo, loadModule?: InfraModuleLoader): Promise<number>;
78
- export {};
@@ -1,8 +0,0 @@
1
- import type { CliIo } from './common.js';
2
- export interface InitDeps {
3
- /** Test seam: defaults to ~/.lmctl/init.toml (getDefaultInitConfigPath()). */
4
- configPath?: string;
5
- /** Test seam: defaults to real filesystem presence detection. */
6
- detectProviders?: () => string[];
7
- }
8
- export declare function runInit(args: string[], io?: CliIo, deps?: InitDeps): Promise<number>;
@@ -1,16 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- /** Lazy readline setup: complete inputs never open/consume stdin. */
3
- export declare class IntentInput {
4
- private io;
5
- private override?;
6
- private rl?;
7
- private queue;
8
- private waiters;
9
- private ended;
10
- constructor(io: CliIo, override?: ((question: string) => Promise<string | null>) | undefined);
11
- get interactive(): boolean;
12
- ask(question: string): Promise<string>;
13
- confirm(question: string): Promise<boolean>;
14
- choose(question: string, options: string[], requireChoice?: boolean): Promise<string>;
15
- close(): void;
16
- }
@@ -1,30 +0,0 @@
1
- export declare function isSentence(value: string): boolean;
2
- export type InputShape = {
3
- kind: 'team';
4
- file: string;
5
- alias?: string;
6
- prompt?: string;
7
- pendingPrompt?: string;
8
- } | {
9
- kind: 'script';
10
- file: string;
11
- rest: string[];
12
- } | {
13
- kind: 'batch';
14
- file: string;
15
- rest: string[];
16
- } | {
17
- kind: 'session';
18
- id: string;
19
- prompt?: string;
20
- pendingPrompt?: string;
21
- } | {
22
- kind: 'models';
23
- query: string;
24
- prompt?: string;
25
- pendingPrompt?: string;
26
- };
27
- /** Arguments after the target are data. No spelling distance or AI guessing. */
28
- export declare function classifyPartialInput(args: string[]): InputShape | null;
29
- /** Exact spelling (case-insensitive) wins over deterministic prefixes. */
30
- export declare function matchNames(query: string, names: string[]): string[];
@@ -1,24 +0,0 @@
1
- import { type MemberConfig } from '../providers/config/team-config.js';
2
- import { type CliIo } from './common.js';
3
- export interface SessionRef {
4
- file: string;
5
- member: MemberConfig;
6
- }
7
- export interface SessionRow {
8
- file?: string;
9
- alias?: string;
10
- sessiondir?: string;
11
- sessionid: string | null;
12
- provider: string;
13
- model: string | null;
14
- running: string;
15
- ageMs: number | null;
16
- context: number | null;
17
- }
18
- export declare function registeredSessions(id: string, io: CliIo): Promise<SessionRef[]>;
19
- export declare function summarizeSession(provider: string, id: string): Promise<SessionRow>;
20
- export declare function teamSessionRows(file: string, io: CliIo, alias?: string): Promise<SessionRow[]>;
21
- export declare function printSessionRows(rows: SessionRow[], io: CliIo): void;
22
- export declare function refreshCandidate(row: SessionRow): boolean;
23
- /** Called only after interactive confirmation. The normal lease excludes prompts. */
24
- export declare function replaceSession(file: string, alias: string, sessionid: string, io: CliIo): Promise<number>;
@@ -1,25 +0,0 @@
1
- import { knownModelNames } from './model.js';
2
- import { runLint, runSeed } from './teamfile-compat.js';
3
- import { type CliIo } from './common.js';
4
- import { IntentInput } from './intent-input.js';
5
- export declare const PROVIDER_NAMES: string[];
6
- export declare function field(line: string, key: string): string | undefined;
7
- export declare function setField(line: string, key: string, value: string): string;
8
- export interface TeamIntentDeps {
9
- models?: typeof knownModelNames;
10
- lint?: typeof runLint;
11
- seed?: typeof runSeed;
12
- }
13
- export declare function completeTeamfile(file: string, input: IntentInput, io: CliIo, deps?: TeamIntentDeps, initialAlias?: string): Promise<void>;
14
- export declare function prepareTeam(file: string, input: IntentInput, io: CliIo, deps?: TeamIntentDeps, initialAlias?: string): Promise<number>;
15
- export declare function chooseTeamfile(input: IntentInput, cwd: string): Promise<string>;
16
- export declare function chooseMember(file: string, requested: string | undefined, input: IntentInput): Promise<string>;
17
- /** A new model prompt needs an auditable member before it can dispatch. */
18
- export declare function createPromptTeam(provider: string, model: string, cwd: string, input: IntentInput): Promise<{
19
- file: string;
20
- alias: string;
21
- }>;
22
- export declare function adoptSession(id: string, provider: string, model: string | null, cwd: string, input: IntentInput, io: CliIo, sessiondir?: string): Promise<{
23
- file: string;
24
- alias: string;
25
- } | null>;
@@ -1,22 +0,0 @@
1
- import type { CliIo } from './common.js';
2
- import { runModel } from './model.js';
3
- import { runChat } from './chat.js';
4
- import { runBatch } from './batch.js';
5
- import { findSessionProviders } from '../providers/resume.js';
6
- import { type TeamIntentDeps } from './intent-team.js';
7
- import { registeredSessions, teamSessionRows, summarizeSession, replaceSession } from './intent-sessions.js';
8
- export interface IntentDeps extends TeamIntentDeps {
9
- ask?: (question: string) => Promise<string | null>;
10
- chat?: typeof runChat;
11
- batch?: typeof runBatch;
12
- model?: typeof runModel;
13
- registrations?: typeof registeredSessions;
14
- findProviders?: typeof findSessionProviders;
15
- rows?: typeof teamSessionRows;
16
- summary?: typeof summarizeSession;
17
- refresh?: typeof replaceSession;
18
- }
19
- export declare function sendInferredPrompt(target: string[], prompt: string, io: CliIo, deps?: IntentDeps): Promise<number>;
20
- export declare function runInferredBatch(file: string, rest: string[], io: CliIo, deps?: IntentDeps): Promise<number>;
21
- /** null leaves an unrecognized word to the original unknown-command diagnostic. */
22
- export declare function runInferred(args: string[], io: CliIo, deps?: IntentDeps): Promise<number | null>;
package/dist/cli/ls.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { type CliIo } from './common.js';
2
- export declare function runLs(args: string[], io?: CliIo): Promise<number>;
@@ -1,6 +0,0 @@
1
- export interface AgentIdentity {
2
- teamfile: string;
3
- alias: string;
4
- value: string;
5
- }
6
- export declare function splitCanonicalIdentity(identity: string): AgentIdentity;
@@ -1,62 +0,0 @@
1
- /**
2
- * P3 (briefs/lmctl0-verbs-native-port-design.md §2.4 / §2.5) — managed
3
- * mode shared helpers. Consumed by terminal/chat/tail/info/ls when the
4
- * P0 classifier returns `{mode:'managed'}`. The §2.4 precedence is
5
- * kind-keyed (verbatim from the design):
6
- *
7
- * • workflow_escalation → attention payload is context-only; resolve
8
- * the agent via the latest `agent_call`
9
- * session_event for the RUN (never via
10
- * interactive_session; never via a
11
- * payload.step_id == session_event.step_id
12
- * join — see Dal.latestAgentCall doc-comment).
13
- * • interactive_waiting_op → interactive_session is authoritative for
14
- * the paused step + resumeInteractive.
15
- * Agent identity still via latestAgentCall.
16
- * • running (no attention) → latestAgentCall only.
17
- * • none resolves → clear error (no DAL write).
18
- *
19
- * All helpers are read-only; spawn nothing. They take `Dal` so callers
20
- * can inject a memory DAL in tests.
21
- */
22
- import type { Dal } from '../db/index.js';
23
- export interface ManagedAgent {
24
- /** Resolved provider for the agent session. */
25
- provider: string;
26
- /** Native session id (the provider's id). */
27
- sessionid: string;
28
- /** Working directory for the provider TUI. */
29
- sessiondir: string;
30
- /** Team-member alias the run's latest agent_call drove. */
31
- alias: string;
32
- /** Optional model override. */
33
- model?: string;
34
- }
35
- /**
36
- * Resolve a run-id to its agent provider session (§2.4 precedence). Uses
37
- * `Dal.latestAgentCall` — RUN-keyed, ORDER BY id DESC — and falls back to
38
- * the single-member team rule (§2.5) when no agent_call has been written
39
- * yet. NEVER joins `session_event` by `payload.step_id`, NEVER consults
40
- * `interactive_session`.
41
- *
42
- * `aliasOverride` (optional) — if provided, looks up that specific member
43
- * (skipping latestAgentCall). Used by callers that surface `--alias A`
44
- * alongside `--run <id>` per the §3 grammar / §2.5 disambiguation.
45
- *
46
- * Returns `{ok:<ManagedAgent>}` on success or `{err:<message>}` on any
47
- * resolution failure (caller surfaces as a clear user-error).
48
- */
49
- export declare function resolveManagedAgent(dal: Dal, run_id: number, aliasOverride?: string): {
50
- ok: ManagedAgent;
51
- } | {
52
- err: string;
53
- };
54
- /**
55
- * Find the run's pending operator-answerable attention (if any).
56
- * Returns the unacked `requires_user=1` attention row's `{kind, attention_id}`
57
- * or null. Read-only.
58
- */
59
- export declare function pendingOperatorAttention(dal: Dal, run_id: number): {
60
- kind: string;
61
- attention_id: number;
62
- } | null;