@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
@@ -1,44 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { ForkResult, ManualSeedHint, SeedOptions } from "../adapter.js";
3
- import type { BundleSession, BundleSessionOpenOptions } from "../bundle.js";
4
- export declare function createGeminiAdapter(opts?: {
5
- geminiDir?: string;
6
- claudeDir?: string;
7
- codexDir?: string;
8
- codeDir?: string;
9
- }): GeminiAdapter;
10
- declare class GeminiAdapter extends BaseProviderAdapter {
11
- private readonly geminiDir?;
12
- constructor(opts?: {
13
- geminiDir?: string;
14
- claudeDir?: string;
15
- codexDir?: string;
16
- codeDir?: string;
17
- });
18
- /** Bundle support (batch redesign item 2): one ACP process, many turns. */
19
- openSession(opts: BundleSessionOpenOptions): Promise<BundleSession>;
20
- forkHint(_sessionId: string): string;
21
- protected seedArgsFor(opts?: SeedOptions): string[];
22
- /**
23
- * Manual-seed hint with `--skip-trust` baked in. Without it, an
24
- * interactive `gemini` launched in an untrusted folder hits the
25
- * same workspace-trust gate that derailed auto-seed in the first
26
- * place — the user would see "Approval mode overridden to
27
- * 'default'" and the manual recovery would loop right back to
28
- * the failure mode. The flag is a no-op in already-trusted
29
- * folders, so always-on is safe.
30
- */
31
- manualSeedHint(sessiondir: string): ManualSeedHint;
32
- /**
33
- * Fork a Gemini session by copying its session file with a new
34
- * session ID. Format-preserving: a `.json` source produces a
35
- * `.json` fork; a `.jsonl` source produces a `.jsonl` fork.
36
- *
37
- * Gemini stores sessions in `~/.gemini/tmp/<project>/chats/`.
38
- * Copying the file and changing the sessionId creates an
39
- * independent branch — the conversation history is identical up
40
- * to the fork point and diverges from there.
41
- */
42
- fork(sessionId: string, tag: string): Promise<ForkResult>;
43
- }
44
- export {};
@@ -1,71 +0,0 @@
1
- /**
2
- * Hermes Agent ("hermes") provider adapter.
3
- *
4
- * Hermes is an ACP agent (`hermes acp`, protocolVersion 1, advertised
5
- * `loadSession: true`), so turns reuse lmctl's generic ACP transport —
6
- * one argv row in `transports/acp.ts`'s `ACP_TOOLS` table plus the
7
- * per-turn protocol gates documented there.
8
- *
9
- * Two things are genuinely Hermes-specific:
10
- *
11
- * 1. Seed is ACP, not a one-shot argv. Hermes has no headless print
12
- * mode that writes a session this reader can find; `session/new`
13
- * returns the id directly, and Hermes only persists a conversation
14
- * once it has history (`acp_adapter/session.py` `_persist`).
15
- * `seed()` therefore creates the session over ACP, sends the real
16
- * seed prompt through the same turn path, and returns that exact id
17
- * instead of diffing `discoverSessions()` around a subprocess.
18
- *
19
- * 2. `HERMES_HOME` is resolved ONCE here and travels on the spawned
20
- * process's env as well as into the reader. Hermes reads that
21
- * variable itself, so without it a caller that points the adapter at
22
- * a home other than the ambient one gets a reader on one store and a
23
- * child writing to another. A profile is a different home, not a
24
- * subdirectory, so nothing else needs a profile knob.
25
- *
26
- * Plan mode: lmctl's `--permission-mode plan` is refused, not downgraded.
27
- * Hermes's ACP mode ladder (`default` / `accept_edits` / `dont_ask`)
28
- * governs its EDIT gate only and has no plan-equivalent, so sending its
29
- * most permissive edit policy for a plan request would escalate beyond
30
- * what was asked.
31
- *
32
- * Interactive resume, daemon sessions, fork and native deletion are outside v1.
33
- */
34
- import { BaseProviderAdapter } from "../base-adapter.js";
35
- import type { SeedOptions, SeedResult } from "../adapter.js";
36
- import type { AcpMode } from "../transports/acp.js";
37
- import type { BundleSession, BundleSessionOpenOptions } from "../bundle.js";
38
- export declare function isHermesSessionId(sessionId: string): boolean;
39
- export declare function hermesAcpModeForPermissionMode(permissionMode: "plan" | "yolo" | undefined): AcpMode;
40
- export declare function createHermesAdapter(opts?: {
41
- hermesHome?: string;
42
- }): HermesAdapter;
43
- declare class HermesAdapter extends BaseProviderAdapter {
44
- private readonly hermesProvider;
45
- /** The one home this adapter reads from AND spawns against. */
46
- private readonly hermesHome;
47
- constructor(opts?: {
48
- hermesHome?: string;
49
- });
50
- /**
51
- * Bundle support (batch redesign item 2): one ACP process, many turns.
52
- * Carries the same Hermes-specific wiring as the per-turn transport —
53
- * HERMES_HOME on the spawn env and the permission-mode → ACP mode
54
- * mapping (plan is refused by the mapper). `async` so the plan refusal
55
- * rejects the returned promise instead of throwing past the caller.
56
- */
57
- openSession(opts: BundleSessionOpenOptions): Promise<BundleSession>;
58
- /** Resolved store path — surfaced for tests and diagnostics. */
59
- get stateDbPath(): string;
60
- /**
61
- * Create the session over ACP, send the real seed prompt so Hermes
62
- * persists it, and return the exact session id `session/new` reported.
63
- *
64
- * `opts.model` is applied by the transport through Hermes's
65
- * `session/set_model` (see `transports/acp.ts`). `opts.effort` is not
66
- * wired: Hermes exposes reasoning effort via config/`--reasoning`, not
67
- * through its ACP surface.
68
- */
69
- seed(cwd: string, opts?: SeedOptions): Promise<SeedResult>;
70
- }
71
- export {};
@@ -1,35 +0,0 @@
1
- /**
2
- * Provider adapter factory.
3
- *
4
- * Session-managing providers: claude, codex, gemini, copilot,
5
- * opencode, kimi, lmplayer, qwen, agy, dsh, and hermes. (R5 restored copilot/opencode/qwen after A0.2's
6
- * Phase-A narrowing to 3.)
7
- */
8
- export { createClaudeAdapter } from "./claude-adapter.js";
9
- export { createCodexAdapter } from "./codex-adapter.js";
10
- export { createGeminiAdapter } from "./gemini-adapter.js";
11
- export { createCopilotAdapter } from "./copilot-adapter.js";
12
- export { createOpenCodeAdapter } from "./opencode-adapter.js";
13
- export { createKimiAdapter } from "./kimi-adapter.js";
14
- export { createLmplayerAdapter } from "./lmplayer-adapter.js";
15
- export { createQwenAdapter } from "./qwen-adapter.js";
16
- export { createAgyAdapter } from "./agy-adapter.js";
17
- export { createDshAdapter } from "./dsh-adapter.js";
18
- export { createHermesAdapter } from "./hermes-adapter.js";
19
- export { createPiAdapter } from "./pi-adapter.js";
20
- export { createClaudeMockAdapter } from "../claude-mock.js";
21
- import type { ProviderAdapter } from "../adapter.js";
22
- export interface AdapterRegistryOpts {
23
- claudeDir?: string;
24
- codexDir?: string;
25
- codeDir?: string;
26
- geminiDir?: string;
27
- copilotDir?: string;
28
- agyDir?: string;
29
- lmplayerDbPath?: string;
30
- kimiHome?: string;
31
- dshHome?: string;
32
- hermesHome?: string;
33
- piDir?: string;
34
- }
35
- export declare function createAllAdapters(opts?: AdapterRegistryOpts): ProviderAdapter[];
@@ -1,16 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { SeedOptions } from "../adapter.js";
3
- import type { BundleSession, BundleSessionOpenOptions } from "../bundle.js";
4
- export declare function createKimiAdapter(opts?: {
5
- kimiHome?: string;
6
- }): KimiAdapter;
7
- declare class KimiAdapter extends BaseProviderAdapter {
8
- private readonly kimiHome?;
9
- constructor(opts?: {
10
- kimiHome?: string;
11
- });
12
- /** Bundle support (batch redesign item 2): one ACP process, many turns. */
13
- openSession(opts: BundleSessionOpenOptions): Promise<BundleSession>;
14
- protected seedArgsFor(opts?: SeedOptions): string[];
15
- }
16
- export {};
@@ -1,14 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { SeedOptions, SeedResult, ManualSeedHint } from "../adapter.js";
3
- export declare function createLmplayerAdapter(opts?: {
4
- lmplayerDbPath?: string;
5
- }): LmplayerAdapter;
6
- declare class LmplayerAdapter extends BaseProviderAdapter {
7
- constructor(opts?: {
8
- lmplayerDbPath?: string;
9
- });
10
- protected seedArgsFor(opts?: SeedOptions): string[];
11
- seed(cwd: string, opts?: SeedOptions): Promise<SeedResult>;
12
- manualSeedHint(sessiondir: string): ManualSeedHint;
13
- }
14
- export {};
@@ -1,11 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { SeedOptions } from "../adapter.js";
3
- import type { BundleSession, BundleSessionOpenOptions } from "../bundle.js";
4
- export declare function createOpenCodeAdapter(): OpenCodeAdapter;
5
- declare class OpenCodeAdapter extends BaseProviderAdapter {
6
- constructor();
7
- /** Bundle support (batch redesign item 2): one ACP process, many turns. */
8
- openSession(opts: BundleSessionOpenOptions): Promise<BundleSession>;
9
- protected seedArgsFor(opts?: SeedOptions): string[];
10
- }
11
- export {};
@@ -1,17 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { SeedOptions } from "../adapter.js";
3
- export declare function createPiAdapter(opts?: {
4
- piDir?: string;
5
- }): PiAdapter;
6
- declare class PiAdapter extends BaseProviderAdapter {
7
- constructor(opts?: {
8
- piDir?: string;
9
- });
10
- protected seedArgsFor(opts?: SeedOptions): string[];
11
- manualSeedHint(sessiondir: string): {
12
- launchCommand: string;
13
- postLaunchNote: string;
14
- lsCommand: string;
15
- };
16
- }
17
- export {};
@@ -1,29 +0,0 @@
1
- /**
2
- * One-shot print transport — shared by providers whose CLI answers a prompt
3
- * in a single non-streaming invocation (`<binary> -p "<prompt>"` printing the
4
- * reply to stdout, e.g. agy, pi).
5
- *
6
- * Extracted from agy-adapter.ts so each provider only supplies its argv
7
- * shape; progress events, env wiring, abort handling, and error text stay
8
- * identical across providers.
9
- */
10
- import type { TurnOptions, TurnResult } from "../adapter.js";
11
- export interface PrintTurnConfig {
12
- /** Provider label used in progress summaries and error messages. */
13
- label: string;
14
- /** Build the full argv (without the binary) for one turn. */
15
- buildArgs: (prompt: string, opts: TurnOptions) => string[];
16
- /** Optional argv assertion hook (e.g. the yolo contract for agy). */
17
- assertArgs?: (args: string[], opts: TurnOptions) => void;
18
- }
19
- export declare function makePrintTurn(config: PrintTurnConfig): (prompt: string, opts: TurnOptions & {
20
- binary: string;
21
- }) => Promise<TurnResult>;
22
- export declare function spawnCollect(label: string, command: string, args: string[], opts: {
23
- cwd: string;
24
- env?: NodeJS.ProcessEnv;
25
- signal?: AbortSignal;
26
- }): Promise<{
27
- stdout: string;
28
- stderr: string;
29
- }>;
@@ -1,11 +0,0 @@
1
- import { BaseProviderAdapter } from "../base-adapter.js";
2
- import type { SeedOptions } from "../adapter.js";
3
- import type { BundleSession, BundleSessionOpenOptions } from "../bundle.js";
4
- export declare function createQwenAdapter(): QwenAdapter;
5
- declare class QwenAdapter extends BaseProviderAdapter {
6
- constructor();
7
- /** Bundle support (batch redesign item 2): one stream-json process, many turns. */
8
- openSession(opts: BundleSessionOpenOptions): Promise<BundleSession>;
9
- protected seedArgsFor(opts?: SeedOptions): string[];
10
- }
11
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * Antigravity CLI (`agy`) session provider.
3
- *
4
- * Antigravity stores local state under ~/.gemini/antigravity-cli but it is
5
- * not Gemini CLI: there is no ACP transport and transcripts have their own
6
- * JSONL event shape. Keep it as a distinct provider.
7
- */
8
- import type { SessionDetail, SessionProvider, SessionSummary } from "./types.js";
9
- interface AgyProviderOptions {
10
- agyDir?: string;
11
- }
12
- export declare class AgyProvider implements SessionProvider {
13
- name: "agy";
14
- private baseDir;
15
- constructor(opts?: AgyProviderOptions);
16
- getWatchPaths(): {
17
- directory: string;
18
- filePattern: RegExp;
19
- }[];
20
- discoverSessions(): Promise<SessionSummary[]>;
21
- private conversationPath;
22
- private transcriptPath;
23
- private existingTranscriptPath;
24
- private extractSummary;
25
- loadSession(sessionId: string): Promise<SessionDetail | null>;
26
- resolveSessionPath(sessionId: string): Promise<string | null>;
27
- deleteSession(sessionId: string): Promise<boolean>;
28
- private resolveCwd;
29
- private cwdFromLastConversationCache;
30
- private readTaskLog;
31
- }
32
- export {};
@@ -1,110 +0,0 @@
1
- /**
2
- * Base adapter — wraps an existing SessionProvider with default implementations
3
- * for seed, resume, start, and sendTurn. Provider-specific adapters override
4
- * what they need.
5
- */
6
- import type { SessionProvider, SessionSummary, SessionDetail, WatchPathInfo, ProviderName } from "./types.js";
7
- import type { ProviderAdapter, ProviderCapabilities, InjectionInfo, TurnOptions, TurnResult, SeedResult, SeedOptions, ManualSeedHint } from "./adapter.js";
8
- /**
9
- * Why a turn aborted before completing normally.
10
- *
11
- * - `external` — lmctl received SIGINT/SIGTERM and forwarded the abort
12
- * - `provider` — the upstream provider explicitly cancelled the turn
13
- * without completing normally
14
- */
15
- export type CancelReason = "external" | "provider";
16
- /**
17
- * Thrown when a turn is aborted (not completed normally). The
18
- * `cancelReason` field tells the catch site which path triggered it,
19
- * so the chat command can emit a tagged summary line + JSON record
20
- * instead of dropping the call's terminator entirely on every
21
- * cancellation.
22
- *
23
- * Task 65 finding 2 — every `lmctl chat` call must emit a
24
- * `[provider] N.Ns (cancelled: <reason>)` summary, regardless of
25
- * whether the call completed or aborted.
26
- */
27
- export declare class TurnAbortError extends Error {
28
- readonly cancelReason: CancelReason;
29
- constructor(message: string, cancelReason: CancelReason);
30
- }
31
- export interface BaseAdapterConfig {
32
- provider: SessionProvider;
33
- capabilities: ProviderCapabilities;
34
- injection: InjectionInfo;
35
- /** Binary name to invoke for this provider. */
36
- binary: string;
37
- /** Args for seeding a new session with the explicit seed instruction. */
38
- seedArgs: string[];
39
- /** Process timeout for the one-shot seed command. */
40
- seedTimeoutMs?: number;
41
- /** If seed input should be sent via stdin instead of args. */
42
- seedStdin?: string;
43
- /** Default resume command template. {{session_id}} is replaced. */
44
- resumeTemplate: string;
45
- /** Default start command. */
46
- startTemplate: string;
47
- /** Transport implementation for sendTurn. */
48
- transport: (prompt: string, opts: TurnOptions & {
49
- binary: string;
50
- }) => Promise<TurnResult>;
51
- }
52
- export declare class BaseProviderAdapter implements ProviderAdapter {
53
- readonly name: ProviderName;
54
- readonly capabilities: ProviderCapabilities;
55
- readonly injection: InjectionInfo;
56
- protected provider: SessionProvider;
57
- protected binary: string;
58
- protected seedArgs: string[];
59
- protected seedTimeoutMs: number;
60
- protected seedStdin?: string;
61
- protected resumeTemplate: string;
62
- protected startTemplate: string;
63
- protected transportFn: (prompt: string, opts: TurnOptions & {
64
- binary: string;
65
- }) => Promise<TurnResult>;
66
- constructor(config: BaseAdapterConfig);
67
- discover(): Promise<SessionSummary[]>;
68
- load(sessionId: string): Promise<SessionDetail | null>;
69
- resolvePath(sessionId: string): Promise<string | null>;
70
- delete(sessionId: string): Promise<boolean>;
71
- getWatchPaths(): WatchPathInfo[];
72
- protected seedArgsFor(opts?: SeedOptions): string[];
73
- /** Per-provider hook to fill in a default `model` (or any other option)
74
- * when a member declares none. Identity by default -- override where a
75
- * provider's own CLI-level default isn't the right one for lmctl-driven
76
- * automation (see CodexAdapter). */
77
- protected turnOptsFor(opts: TurnOptions): TurnOptions;
78
- seed(cwd: string, opts?: SeedOptions): Promise<SeedResult>;
79
- resumeCommand(sessionId: string, profile?: string): string;
80
- startCommand(_profile?: string): string;
81
- /**
82
- * Default manual-seed hint: launch the provider's binary in the
83
- * member's sessiondir, send lmctl's explicit seed instruction to
84
- * commit a waiting session file, then `lmctl ls` to find the new
85
- * sessionid. Adapters with provider-specific quirks (e.g.
86
- * gemini's `--skip-trust` for the workspace-trust gate) override
87
- * this to inject the right flags.
88
- */
89
- manualSeedHint(sessiondir: string): ManualSeedHint;
90
- /** Default idle timeout: 8 hours without any provider activity. */
91
- static readonly DEFAULT_IDLE_TIMEOUT_MS: number;
92
- sendTurn(prompt: string, rawOpts: TurnOptions): Promise<TurnResult>;
93
- /**
94
- * Run transport with idle timeout + signal forwarding.
95
- *
96
- * Idle timer resets on **any** ProgressEvent from the transport (text,
97
- * tool_use, tool_result, thinking, system). It only fires if the provider
98
- * goes completely silent for idleTimeoutMs.
99
- *
100
- * When the idle timer fires, the turn **resolves** with
101
- * `{ status: "stalled", stalledAfterMs }` — it does NOT kill the
102
- * child process. The child continues running; it's the caller's
103
- * responsibility to decide what to do. (Timeout redesign Phase 2.)
104
- */
105
- private withTimeouts;
106
- /**
107
- * Run a user-defined one-shot agent command (from user-config `agent = ...`).
108
- */
109
- private runOneShotAgent;
110
- }
@@ -1,12 +0,0 @@
1
- export declare const HOME_DIR: string;
2
- export declare function readJsonl<T = unknown>(filePath: string): AsyncGenerator<T>;
3
- export declare function readFirstJsonlLines<T = unknown>(filePath: string, maxLines: number): Promise<T[]>;
4
- export declare function getFileTimes(filePath: string): Promise<{
5
- createdAt: Date;
6
- modifiedAt: Date;
7
- }>;
8
- export declare function unescapeContent(text: string): string;
9
- export declare function escapeContent(text: string): string;
10
- export declare function truncate(text: string, maxLen: number): string;
11
- export declare function structuredToolInput(value: unknown): Record<string, unknown> | undefined;
12
- export declare function formatTimestamp(date: Date): string;
@@ -1,102 +0,0 @@
1
- /**
2
- * Provider-binary-on-PATH + runtime pre-flight check.
3
- *
4
- * Used by `lmctl lint` (warn the user about missing / broken CLI
5
- * installs at config-validation time) and `lmctl autocode` (HARD
6
- * GATE — refuse to spawn `lmctl seed` / `lmctl chat` if any
7
- * declared provider's CLI is missing or fails to execute, so we
8
- * never half-create a team).
9
- *
10
- * Implementation: `<binary> --version`. Cross-platform (no `which`
11
- * / `where` branching) and verifies strictly more than existence —
12
- * the binary must actually run to a clean exit. Catches:
13
- * - not installed → spawn returns ENOENT
14
- * - installed but broken → non-zero exit (missing deps, bad libs,
15
- * permission denied, etc.)
16
- * - installed and OK → exit 0 with a version string on stdout
17
- *
18
- * All supported providers (claude/codex/copilot/gemini/opencode/lmplayer/qwen/agy)
19
- * accept `--version` and early-exit before any auth/config check, so
20
- * the pre-flight is cheap and safe to run on every lint/autocode.
21
- */
22
- /**
23
- * Map from our `ProviderName` → expected CLI binary on PATH.
24
- *
25
- * All entries are standalone binaries — `gh copilot` is intentionally
26
- * NOT here. lmctl's copilot transport spawns the standalone `copilot`
27
- * binary (see `src/cli/transports/acp.ts:58`), not the `gh` extension.
28
- *
29
- * Public-readable so test fixtures and audit/cache surfaces can read
30
- * the same canonical mapping. Mutating it at runtime is unsupported.
31
- */
32
- export declare const PROVIDER_BINARIES: Record<string, string>;
33
- export interface ProviderBinaryCheck {
34
- /** Provider name as declared on a `_MEMBER_` line. */
35
- provider: string;
36
- /** Expected binary on PATH; `"<unknown>"` for unrecognized providers. */
37
- binary: string;
38
- /** True iff `<binary> --version` spawned and exited 0. */
39
- found: boolean;
40
- /** First line of stdout from `<binary> --version` on success, trimmed. */
41
- version?: string;
42
- /**
43
- * When `!found`, an optional hint about what went wrong: `"not installed"`
44
- * (spawn ENOENT) vs `"runs but failed"` (non-zero exit, dependency issue).
45
- * `formatMissingBinaryError` uses this to emit a more actionable message.
46
- */
47
- failureMode?: "not installed" | "runs but failed";
48
- }
49
- /**
50
- * Per-provider one-line install hint shown in error messages from
51
- * `lint` and `autocode`. Kept terse — the goal is "what URL do I
52
- * paste into a browser," not a full installer guide.
53
- */
54
- export declare const PROVIDER_INSTALL_HINTS: Record<string, string>;
55
- /**
56
- * Injection seam — tests stub via `mock.module("node:child_process",
57
- * { spawnSync })`. The seam exists so the suite can simulate missing
58
- * binaries without depending on the runner's actual PATH (e.g. a CI
59
- * image with no provider CLIs installed would otherwise hard-fail
60
- * unrelated happy-path tests).
61
- *
62
- * The signature matches `childProcess.spawnSync`'s subset we care
63
- * about: status (null iff the spawn itself failed — ENOENT), plus
64
- * stdout + an error field we inspect for the `code` property.
65
- */
66
- export type SpawnSyncFn = (cmd: string, args: string[], options?: {
67
- encoding?: string;
68
- timeout?: number;
69
- }) => {
70
- status: number | null;
71
- stdout?: string | Buffer;
72
- error?: {
73
- code?: string;
74
- } | Error;
75
- };
76
- export interface CheckOptions {
77
- /** Test seam — defaults to `node:child_process.spawnSync`. */
78
- spawnSync?: SpawnSyncFn;
79
- /** Test seam — defaults to `process.platform`. Kept for API
80
- * back-compat; the new `<binary> --version` implementation is
81
- * cross-platform and no longer branches on it. */
82
- platform?: NodeJS.Platform;
83
- }
84
- /**
85
- * Check each DISTINCT provider in `providers` against PATH. Order of
86
- * the returned array matches first-occurrence order in the input.
87
- * Duplicates collapse to one result. Unknown providers (not in
88
- * `PROVIDER_BINARIES`) yield `binary: "<unknown>", found: false`
89
- * rather than throwing — the caller formats the user-facing error.
90
- *
91
- * When `LMCTL_SKIP_BINARY_CHECK=1` is set in the environment, every
92
- * KNOWN provider is reported as found with `version: "(skipped)"`
93
- * and unknown providers are STILL surfaced as errors (a typo in a
94
- * teamfile shouldn't be hidden by a CI flag).
95
- */
96
- export declare function checkProviderBinaries(providers: Iterable<string>, options?: CheckOptions): ProviderBinaryCheck[];
97
- /**
98
- * Format a missing-binary error line for stderr/lint output. Keeps
99
- * the wording consistent across `lint` and `autocode` so users can
100
- * grep for `provider "<name>" binary` in CI.
101
- */
102
- export declare function formatMissingBinaryError(check: ProviderBinaryCheck): string;
@@ -1,124 +0,0 @@
1
- /**
2
- * Bundle sessions (batch redesign, item 2 — Landing C1).
3
- *
4
- * A bundle session is ONE provider process serving many chat turns, built
5
- * for batch bundle mode (the default for multi-prompt runs): instead of
6
- * opens the session once, drives every prompt through it, and closes it
7
- * in a `finally`. This module holds the transport-agnostic contract; the
8
- * per-transport implementations live behind the adapters'
9
- * `ProviderAdapter.openSession` (ACP via transports/acp.ts, stream-json
10
- * via transports/stream-json.ts, codex via transports/codex-app-server.ts,
11
- * dsh via adapters/dsh-adapter.ts).
12
- *
13
- * ## Per-transport lifecycle contract (binding, from the v2 review)
14
- *
15
- * Every bundle transport MUST honor all of these; the ACP implementation
16
- * pins them in tests/providers/acp-bundle.test.ts:
17
- *
18
- * 1. **Per-turn completion boundary.** A turn ends at the transport's
19
- * own result frame (ACP: the `session/prompt` response). Anything the
20
- * provider emits after that boundary belongs to no turn and must
21
- * never leak into a later turn's result.
22
- * 2. **Parser/state reset between turns.** The stateful output
23
- * processor is retained across turns (provider-specific isolation,
24
- * e.g. gemini's replay handling, keeps working) but reset per turn:
25
- * no reply duplication, no stale deltas, no stale timers.
26
- * 3. **Cancellation.** Aborting a turn rejects THAT turn's promise and
27
- * asks the provider to cancel (ACP: `session/cancel`); the session
28
- * stays open and usable. Aborting is per turn — there is no
29
- * bundle-level abort; use `close()`.
30
- * 4. **Hold-open policy.** The process is NOT closed between turns —
31
- * the persistence IS the hold. `close()` runs the caller's
32
- * `holdOpen` outstanding-work check ONCE before ending stdin, so the
33
- * final turn's background dispatches get the same protection a
34
- * one-shot turn would get.
35
- * 5. **Unexpected exit.** A mid-bundle process exit rejects the
36
- * in-flight turn and every subsequent turn with an error naming the
37
- * number of completed prompts, so the batch abort message carries
38
- * the count.
39
- * 6. **Idempotent, bounded close.** `close()` may be called any number
40
- * of times, including during an in-flight turn (which it cancels via
41
- * process shutdown). It ends stdin, waits a bounded time for a
42
- * natural exit, then escalates to SIGTERM/SIGKILL — it never hangs
43
- * and never throws.
44
- * 7. **Identity.** Opening against an existing session id must verify
45
- * the provider loaded THAT EXACT id before the first prompt is sent
46
- * (no fallback to the requested id, no silent new session). Between
47
- * turns the caller re-checks identity cheaply — for batch, the
48
- * per-turn `expectedSession` check in chat-exec catches an external
49
- * re-seed and aborts the bundle.
50
- */
51
- import type { PermissionMode } from "./yolo-contract.js";
52
- import type { HoldOpenOptions } from "./transports/hold-open.js";
53
- /** Per-turn options: streaming callbacks and this turn's abort signal. */
54
- export interface BundleTurnOptions {
55
- /** Called for each text delta belonging to THIS turn. */
56
- onDelta?: (text: string) => void;
57
- /** Called for each raw transport event during THIS turn (progress classification). */
58
- onEvent?: (event: Record<string, unknown>) => void;
59
- /** Abort THIS turn (contract item 3); the session stays open. */
60
- signal?: AbortSignal;
61
- }
62
- export interface BundleTurnResult {
63
- text: string;
64
- sessionId: string;
65
- durationMs: number;
66
- stopReason?: string;
67
- /**
68
- * Open-time provider configuration warnings (task #232 model/effort
69
- * drops) are reported on the FIRST turn's result: in bundle mode the
70
- * provider configuration is applied once at open, not per spawn.
71
- */
72
- warnings?: string[];
73
- /**
74
- * ACP bundle sessions only (see AcpOutputProcessorResult.sawActivity) --
75
- * whether this turn saw any real agent activity, as opposed to a clean
76
- * but empty completion. Omitted for non-ACP bundle implementations.
77
- */
78
- sawActivity?: boolean;
79
- }
80
- export interface BundleSession {
81
- /** Provider key this session serves (e.g. "opencode"). */
82
- readonly provider: string;
83
- /** The verified session id (exact match to the requested id). */
84
- readonly sessionId: string;
85
- /** Successfully completed turns — the count bundle errors report. */
86
- readonly completedTurns: number;
87
- sendTurn(prompt: string, opts?: BundleTurnOptions): Promise<BundleTurnResult>;
88
- /** Idempotent, bounded shutdown (contract item 6). Never throws. */
89
- close(): Promise<void>;
90
- }
91
- /** Options for opening a bundle session (provider comes from the adapter). */
92
- export interface BundleSessionOpenOptions {
93
- /** Native session id to resume — verified exactly (contract item 7). */
94
- sessionId: string;
95
- cwd: string;
96
- env?: NodeJS.ProcessEnv;
97
- model?: string;
98
- effort?: string;
99
- alias?: string;
100
- /** Role-based Lead signal (codex injects its MCP tool flags at spawn). */
101
- isLead?: boolean;
102
- permissionMode?: PermissionMode;
103
- /** Override the spawned binary path (troubleshooting dev builds). */
104
- progPath?: string;
105
- /** Outstanding-work check run ONCE at close() before stdin ends. */
106
- holdOpen?: HoldOpenOptions;
107
- /** Shutdown cap for close() (tests / operator-driven shutdowns). */
108
- closeTimeoutMs?: number;
109
- /**
110
- * stream-json only: override the session-file roots used by the bundle
111
- * identity check (custom provider homes / tests). The claude adapter
112
- * defaults it to its own provider home's projects dir.
113
- */
114
- sessionFileRoots?: string[];
115
- }
116
- /**
117
- * Providers bundle-capable BY DESIGN (item 2's verified support matrix):
118
- * persistent-process transports with a multi-turn protocol. All nine are
119
- * implemented (Landings C1+C2). agy/pi/lmplayer are one-shot print
120
- * transports and can NEVER bundle.
121
- */
122
- export declare const BUNDLE_CAPABLE_PROVIDERS: readonly string[];
123
- /** One-shot print transports — never bundle-capable; batch silently runs them per-turn. */
124
- export declare const BUNDLE_NEVER_CAPABLE_PROVIDERS: readonly string[];