@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,90 +0,0 @@
1
- import type { ConversationMessage, SessionDetail, SessionProvider, SessionSummary, WatchPathInfo } from "./types.js";
2
- import type { ForkResult, InjectionInfo, ManualSeedHint, ProviderAdapter, ProviderCapabilities, SeedOptions, SeedResult, TurnOptions, TurnResult } from "./adapter.js";
3
- interface MockSession {
4
- sessionId: string;
5
- cwd: string;
6
- filePath: string;
7
- createdAt: Date;
8
- modifiedAt: Date;
9
- messages: ConversationMessage[];
10
- totalInputTokens: number;
11
- totalOutputTokens: number;
12
- }
13
- interface StoredConversationMessage extends Omit<ConversationMessage, "timestamp"> {
14
- timestamp: string;
15
- }
16
- interface StoredMockSession extends Omit<MockSession, "createdAt" | "modifiedAt" | "messages"> {
17
- createdAt: string;
18
- modifiedAt: string;
19
- messages: StoredConversationMessage[];
20
- }
21
- type ScriptedResponse = string | {
22
- text: string;
23
- error?: never;
24
- delayMs?: number;
25
- } | {
26
- error: string;
27
- text?: never;
28
- delayMs?: number;
29
- };
30
- interface ClaudeMockStore {
31
- schemaVersion: 1;
32
- defaultDelayMs?: number;
33
- script?: Record<string, ScriptedResponse>;
34
- /**
35
- * Substring-match scripting, checked LAST (after exact + first-line miss).
36
- * A key matches when it is a substring of the prompt, so a prompt with
37
- * dynamic content before AND after a stable anchor phrase can be scripted
38
- * deterministically. Kept as its own field (not a prefixed key inside
39
- * `script`) so the two lookup modes stay independently typed and a literal
40
- * prompt can never be mistaken for a substring pattern.
41
- */
42
- scriptContains?: Record<string, ScriptedResponse>;
43
- sessions: Record<string, StoredMockSession>;
44
- }
45
- declare function mockStorePath(cwd?: string): string;
46
- declare function readStore(path: string): ClaudeMockStore;
47
- declare function acquireStoreLock(path: string): string;
48
- declare function releaseStoreLock(lockDir: string): void;
49
- declare function withStoreLock<T>(path: string, fn: () => T): T;
50
- declare function savePersistentSession(session: MockSession): void;
51
- declare function deletePersistentSession(sessionId: string, cwd?: string): boolean;
52
- export declare function _resetClaudeMockSessionsForTests(): void;
53
- export declare const _claudeMockStoreInternals: {
54
- savePersistentSession: typeof savePersistentSession;
55
- deletePersistentSession: typeof deletePersistentSession;
56
- acquireStoreLock: typeof acquireStoreLock;
57
- releaseStoreLock: typeof releaseStoreLock;
58
- withStoreLock: typeof withStoreLock;
59
- readStore: typeof readStore;
60
- mockStorePath: typeof mockStorePath;
61
- STORE_LOCK_STALE_MS: number;
62
- STORE_LOCK_MAX_WAIT_MS: number;
63
- };
64
- export declare class ClaudeMockProvider implements SessionProvider {
65
- name: "ClaudeMock";
66
- discoverSessions(): Promise<SessionSummary[]>;
67
- loadSession(sessionId: string): Promise<SessionDetail | null>;
68
- resolveSessionPath(sessionId: string): Promise<string | null>;
69
- deleteSession(sessionId: string): Promise<boolean>;
70
- }
71
- export declare class ClaudeMockAdapter implements ProviderAdapter {
72
- readonly name: "ClaudeMock";
73
- readonly capabilities: ProviderCapabilities;
74
- readonly injection: InjectionInfo;
75
- private readonly provider;
76
- discover(): Promise<SessionSummary[]>;
77
- load(sessionId: string): Promise<SessionDetail | null>;
78
- resolvePath(sessionId: string): Promise<string | null>;
79
- delete(sessionId: string): Promise<boolean>;
80
- getWatchPaths(): WatchPathInfo[];
81
- seed(cwd: string, opts?: SeedOptions): Promise<SeedResult>;
82
- resumeCommand(sessionId: string): string;
83
- startCommand(): string;
84
- manualSeedHint(sessiondir: string): ManualSeedHint;
85
- forkHint(_sessionId: string): string;
86
- fork(_sessionId: string, _tag: string): Promise<ForkResult>;
87
- sendTurn(prompt: string, opts: TurnOptions): Promise<TurnResult>;
88
- }
89
- export declare function createClaudeMockAdapter(): ClaudeMockAdapter;
90
- export {};
@@ -1,21 +0,0 @@
1
- import type { SessionProvider, SessionSummary, SessionDetail } from "./types.js";
2
- interface ClaudeProviderOptions {
3
- claudeDir?: string;
4
- }
5
- export declare class ClaudeProvider implements SessionProvider {
6
- name: "claude";
7
- private claudeDir;
8
- private projectsDir;
9
- constructor(options?: ClaudeProviderOptions);
10
- getWatchPaths(): {
11
- directory: string;
12
- filePattern: RegExp;
13
- }[];
14
- discoverSessions(): Promise<SessionSummary[]>;
15
- private extractSummary;
16
- loadSession(sessionId: string): Promise<SessionDetail | null>;
17
- resolveSessionPath(sessionId: string): Promise<string | null>;
18
- deleteSession(sessionId: string): Promise<boolean>;
19
- private resolveSessionFile;
20
- }
21
- export {};
@@ -1,15 +0,0 @@
1
- /** Compatibility no-op for retired Codex lmctl-MCP injection. */
2
- import type { McpExecutableWarningOptions } from "../mcp/path-warning.js";
3
- /**
4
- * Per-server tool request timeout. Codex's MCP config uses seconds
5
- * (`tool_timeout_sec`); keep the ms constant for parity with
6
- * opencode's config and derive seconds for the TOML override.
7
- */
8
- export declare const CODEX_LMCTL_MCP_TIMEOUT_MS = 86400000;
9
- export declare const CODEX_LMCTL_MCP_TIMEOUT_SEC: number;
10
- /**
11
- * The lmctl MCP server remains in-tree, but provider MCP injection is
12
- * retired. Keep the helper as a compatibility no-op for callers that
13
- * still append its result into codex argv.
14
- */
15
- export declare function buildCodexMcpFlags(_options?: McpExecutableWarningOptions): string[];
@@ -1,25 +0,0 @@
1
- import type { SessionProvider, SessionSummary, SessionDetail } from "./types.js";
2
- interface CodexProviderOptions {
3
- codexDirs?: string[];
4
- codexDir?: string;
5
- codeDir?: string;
6
- }
7
- export declare class CodexProvider implements SessionProvider {
8
- name: "codex";
9
- private codexDirs;
10
- constructor(options?: CodexProviderOptions);
11
- getWatchPaths(): {
12
- directory: string;
13
- filePattern: RegExp;
14
- }[];
15
- private getSessionsDirs;
16
- discoverSessions(): Promise<SessionSummary[]>;
17
- private findSessionFiles;
18
- private extractSessionIdFromFilename;
19
- private extractSummary;
20
- loadSession(sessionId: string): Promise<SessionDetail | null>;
21
- resolveSessionPath(sessionId: string): Promise<string | null>;
22
- deleteSession(sessionId: string): Promise<boolean>;
23
- private resolveSessionFile;
24
- }
25
- export {};
@@ -1,59 +0,0 @@
1
- export { loadInitFile, parseInitDocument, resolveInitFilePath, InitFileError } from './init-file.js';
2
- export interface InitProviderSlot {
3
- provider: string;
4
- model1: string;
5
- model2: string;
6
- model3: string;
7
- }
8
- export interface InitConfig {
9
- provider1: InitProviderSlot;
10
- provider2: InitProviderSlot;
11
- provider3: InitProviderSlot;
12
- }
13
- /**
14
- * The four providers lmctl actively ships defaults for, each with three
15
- * model tiers (top / mid / lighter). These are real, currently-declared
16
- * models observed on a live fleet (2026-09-29) -- a useful starting point,
17
- * not a claim of permanent correctness; lint warns (never errors) if one
18
- * goes stale, and the whole point of `lmctl init`'s output is that it is
19
- * meant to be edited.
20
- */
21
- export declare const PROVIDER_MODEL_DEFAULTS: Record<string, readonly [string, string, string]>;
22
- /** Providers lmctl init knows how to fill in, in fixed preference order
23
- * (used only to pick 3 of 4 when every provider is present; presence
24
- * detection itself never ranks). */
25
- export declare const SUPPORTED_INIT_PROVIDERS: readonly ["claude", "codex", "agy", "kimi"];
26
- export declare function getDefaultInitConfigPath(): string;
27
- /** Fill rule (operator, 2026-09-29): 3 detected -> use all 3; 2 -> Provider3 = Provider1;
28
- * 1 (or 0, using a placeholder) -> Provider2 and Provider3 = Provider1. */
29
- export declare function buildInitConfig(detectedProviders: string[]): InitConfig;
30
- /** Returns the subset of SUPPORTED_INIT_PROVIDERS present on this machine,
31
- * in SUPPORTED_INIT_PROVIDERS order (not a usage ranking -- presence is a
32
- * yes/no question, order here is just deterministic output, not a claim
33
- * about which is "best"). */
34
- export declare function detectPresentProviders(): string[];
35
- export declare function renderInitConfig(config: InitConfig): string;
36
- export declare function parseInitConfigText(raw: string): InitConfig | null;
37
- export declare function readInitConfig(filePath?: string): InitConfig | null;
38
- export declare function writeInitConfig(config: InitConfig, filePath?: string): void;
39
- export interface InitMergeChange {
40
- section: string;
41
- key: string;
42
- oldValue: string;
43
- newValue: string;
44
- line: number;
45
- }
46
- export type InitMergeResult = {
47
- ok: true;
48
- text: string;
49
- changes: InitMergeChange[];
50
- } | {
51
- ok: false;
52
- error: string;
53
- line?: number;
54
- };
55
- export declare function mergeInitConfigText(raw: string, config: InitConfig): InitMergeResult;
56
- /** Substitutes ${Provider1..3} and ${Model1..3} in template text from a
57
- * resolved InitConfig. Unknown placeholders are left untouched (quickrun
58
- * surfaces them separately so a lint failure names the real cause). */
59
- export declare function substituteInitPlaceholders(text: string, config: InitConfig): string;
@@ -1,3 +0,0 @@
1
- import type { InitConfig, InitMergeResult } from './init-config.js';
2
- export declare function encodeInitString(value: string): string;
3
- export declare function mergeValidatedInitText(raw: string, config: InitConfig): InitMergeResult;
@@ -1,20 +0,0 @@
1
- import { type TomlTable } from 'smol-toml';
2
- import type { InitConfig } from './init-config.js';
3
- export declare const INIT_SECTIONS: readonly ["Provider1", "Provider2", "Provider3"];
4
- export declare const INIT_KEYS: readonly ["provider", "model1", "model2", "model3"];
5
- export interface InitSnapshot {
6
- raw: string;
7
- document: TomlTable;
8
- config: InitConfig;
9
- path: string;
10
- }
11
- export declare function resolveInitFilePath(env?: NodeJS.ProcessEnv, explicit?: string): string;
12
- export declare class InitFileError extends Error {
13
- readonly path: string;
14
- readonly kind: 'missing' | 'read' | 'syntax' | 'schema';
15
- readonly line: number;
16
- readonly column: number;
17
- constructor(path: string, kind: 'missing' | 'read' | 'syntax' | 'schema', problem: string, line?: number, column?: number);
18
- }
19
- export declare function parseInitDocument(raw: string, path?: string): InitSnapshot;
20
- export declare function loadInitFile(path?: string): InitSnapshot;
@@ -1,2 +0,0 @@
1
- /** Same-directory replace; validate first, retain original backup, refuse stale snapshots. */
2
- export declare function replaceInitFile(path: string, text: string, original: string | null): void;
@@ -1,70 +0,0 @@
1
- import { type CatalogSnapshot } from "../pricing.js";
2
- import type { MemberConfig, TeamValidationError } from "./team-config.js";
3
- /**
4
- * dsh's real model catalog — the static DEFAULT_MODELS list baked into the
5
- * shipped `@deepseek-ai/dsh-llm-deepseek` package (verified against dsh
6
- * 0.1.1-rc.2; see backlog/DESIGN-add-dsh-provider.md). Hardcoded by
7
- * deliberate choice: dsh has no kimi-style user-editable model config file
8
- * to read live, and shelling out to `dsh --dump-config` would add a process
9
- * spawn to every lint run only to report these same baked-in defaults. The
10
- * catalog is patchable via dsh profile overlays, so a user-extended model
11
- * will warn here even though it may resolve — the warning text says so.
12
- */
13
- export declare const DSH_MODELS: string[];
14
- /**
15
- * Server-side resolving aliases: DeepSeek resolves these to whatever its
16
- * CURRENT flash/pro model is (operator, 2026-09-16: "dsh have the default
17
- * that I set as deepseek-flash, which deepseek link to the latest deepseek
18
- * version: deepseek-4.1-flash. (server side resolve, not client side
19
- * resolve)"). NOT pinned versions -- do not fold into DSH_MODELS above or
20
- * present alongside it as an equivalent "valid model," because pinning to
21
- * e.g. `deepseek-v4-flash` instead is an ACTIVE DOWNGRADE once DeepSeek
22
- * moves the alias forward, not a safer choice. Real incident: this lint's
23
- * old "Valid models: <pinned list>" wording steered an operator into doing
24
- * exactly that once already, before being corrected. Six teams (math,
25
- * memperf, backup, dsh_creator, localwebqa, and growing -- dsh is now a
26
- * primary execution provider fleet-wide) use `deepseek-flash` deliberately.
27
- */
28
- export declare const DSH_SERVER_RESOLVED_ALIASES: string[];
29
- export interface AgyModelsRunResult {
30
- status: number | null;
31
- stdout: string;
32
- error?: Error;
33
- }
34
- export declare function loadAgyModels(runner?: () => AgyModelsRunResult): OpenCodeModelResult;
35
- export interface CodexModelsRunResult {
36
- status: number | null;
37
- stdout: string;
38
- error?: Error;
39
- }
40
- export declare function loadCodexModels(runner?: () => CodexModelsRunResult): OpenCodeModelResult;
41
- export interface OpencodeModelsRunResult {
42
- status: number | null;
43
- stdout: string;
44
- error?: Error;
45
- }
46
- export declare function loadOpencodeLiveModels(provider: string, runner?: (provider: string) => OpencodeModelsRunResult): OpenCodeModelResult;
47
- export declare function modelSelectionWarnings(members: MemberConfig[], opts?: {
48
- opencodeConfigPath?: string;
49
- kimiConfigPath?: string;
50
- agyModelsRunner?: () => AgyModelsRunResult;
51
- opencodeModelsRunner?: (provider: string) => OpencodeModelsRunResult;
52
- codexModelsRunner?: () => CodexModelsRunResult;
53
- }): string[];
54
- /** Warnings only -- see resolveCatalogFindings for the full three-outcome contract. */
55
- export declare function catalogModelWarnings(members: MemberConfig[], opts?: {
56
- snapshot?: CatalogSnapshot;
57
- }): Promise<string[]>;
58
- /** Errors only (a confirmed "this provider cannot run it" -- see
59
- * resolveCatalogFindings). Shaped as TeamValidationError so callers can
60
- * merge it directly into validateTeamConfig's own error array. */
61
- export declare function catalogModelErrors(members: MemberConfig[], opts?: {
62
- snapshot?: CatalogSnapshot;
63
- }): Promise<TeamValidationError[]>;
64
- interface OpenCodeModelResult {
65
- available: boolean;
66
- models: string[];
67
- reason?: string;
68
- }
69
- export declare function loadKimiModels(configPath?: string): OpenCodeModelResult;
70
- export {};
@@ -1,184 +0,0 @@
1
- /**
2
- * Team config — one <team>.lmctl file per team.
3
- *
4
- * Free-form markdown with embedded `_MEMBER_` lines for the team's
5
- * sessions:
6
- *
7
- * # Frontend Team
8
- *
9
- * _MEMBER_ alias=Lead provider=claude sessionid=abc-123
10
- * _MEMBER_ alias=Coder provider=claude sessionid=def-456
11
- * _MEMBER_ alias=Reviewer provider=codex sessionid=ghi-789
12
- *
13
- * `sessiondir=` is optional; when omitted, the teamfile's own directory is
14
- * used at resolution time. Keep explicit sessiondir only for members that run
15
- * in a different repository.
16
- *
17
- * Everything outside `_MEMBER_` lines is natural language (policy,
18
- * notes, context). Legacy frontmatter is parsed when present, but it
19
- * is optional. When the team declares a Lead, the full document is
20
- * injected into that Lead's context as-is.
21
- *
22
- * Wire format renames (one cutover at this commit):
23
- * - `_SESSION_` → `_MEMBER_` (matches the codebase's `MemberEntry`
24
- * type)
25
- * - `id=` → `sessionid=` (matches `mcp__lmctl__lmctl_chat`'s
26
- * `sessionid` parameter; an LLM can copy the identity quadruple
27
- * from a member line straight to a tool call without renaming
28
- * fields)
29
- *
30
- * Legacy `_SESSION_` is rejected with a clear migration error.
31
- *
32
- * alias=Lead has special bootstrap/default-routing behavior when
33
- * present (at most one per team), but a Lead is not required.
34
- */
35
- import { type Frontmatter } from "../frontmatter.js";
36
- export interface MemberConfig {
37
- alias: string;
38
- provider: string;
39
- session?: string;
40
- sessiondir?: string;
41
- /** Provider-specific model name (e.g. "claude-sonnet-4-6"). Optional.
42
- * The transport maps this through each provider's supported model
43
- * selection surface; unsupported providers ignore with provider-
44
- * specific diagnostics. */
45
- model?: string;
46
- /** Provider-specific effort / variant selection. Currently used by
47
- * OpenCode ACP as the provider's effort config option. Kimi has no
48
- * genuine per-turn effort override (its `thinking` option is on/off
49
- * only, resolved per-model) so lint warns and ignores this for kimi. */
50
- effort?: string;
51
- /** Path to a sub-team's .lmctl file. When set, this member is a
52
- * team reference — provider/id/sessiondir come from the
53
- * referenced teamfile's lead session at resolution time. */
54
- teamfile?: string;
55
- /** Extra key=value pairs from the session line */
56
- extra: Record<string, string>;
57
- }
58
- export interface TeamConfig {
59
- /** Team name (from filename without .lmctl extension). */
60
- name: string;
61
- /** All members parsed from session lines. */
62
- members: MemberConfig[];
63
- /** The full raw document text (for leader injection). */
64
- rawText: string;
65
- /** Errors from malformed session lines, invalid legacy frontmatter,
66
- * legacy `_SESSION_` prefix, etc. `validateTeamConfig` upgrades
67
- * these to validation errors so CLI commands surface them. */
68
- parseErrors: string[];
69
- /** Parsed legacy frontmatter, or `null` if the file lacks it / had
70
- * a malformed block. Frontmatter is optional for current teamfiles. */
71
- frontmatter: Frontmatter | null;
72
- }
73
- export interface TeamValidationError {
74
- field: string;
75
- message: string;
76
- }
77
- /** The conventional alias that triggers Lead bootstrap/default routing. */
78
- export declare const LEADER_ALIAS = "Lead";
79
- export declare function isTeamfilePath(filePath: string): boolean;
80
- export declare function teamNameFromPath(filePath: string): string;
81
- export declare function readTeamConfig(filePath: string): TeamConfig;
82
- export interface ParseTeamConfigOptions {
83
- baseDir?: string;
84
- sourcePath?: string;
85
- }
86
- export declare function parseTeamConfigText(raw: string, name: string, options?: ParseTeamConfigOptions): TeamConfig;
87
- /**
88
- * Diff frontmatter `members:` against the aliases on `_MEMBER_` lines.
89
- * Returns null if they agree (sorted-set equal); else returns a
90
- * human-readable warning string. Caller decides how to surface it.
91
- */
92
- export declare function checkMemberDrift(config: TeamConfig): string | null;
93
- export declare function serializeTeamConfig(config: TeamConfig): string;
94
- export declare function writeTeamConfig(filePath: string, config: TeamConfig): void;
95
- export declare function validateTeamConfig(config: TeamConfig, parentDir?: string): TeamValidationError[];
96
- export declare function getLeader(config: TeamConfig): MemberConfig | undefined;
97
- /**
98
- * Resolved details from a team reference — the sub-team's lead
99
- * session's provider, id, sessiondir, and model override.
100
- */
101
- export interface ResolvedTeamMember {
102
- provider: string;
103
- session: string;
104
- sessiondir: string;
105
- alias: string;
106
- resolvedFrom: string;
107
- /** Model override from the sub-team's lead (Task A). Undefined if unset. */
108
- model?: string;
109
- /** Effort override from the sub-team's lead. Undefined if unset. */
110
- effort?: string;
111
- }
112
- export interface ResolveTeamReferenceOptions {
113
- requireSession?: boolean;
114
- }
115
- /**
116
- * Resolve a `teamfile=` reference to the sub-team's lead session.
117
- *
118
- * @param member The member with `teamfile` set.
119
- * @param parentDir Directory of the PARENT teamfile (for resolving
120
- * relative paths in `teamfile=`).
121
- * @param visited Circular-reference guard. Callers should NOT pass
122
- * this — it's used internally for recursion.
123
- *
124
- * Throws on: missing teamfile, no lead, no session ID, circular ref.
125
- */
126
- export declare function resolveTeamReference(member: MemberConfig, parentDir: string, visited?: Set<string>, options?: ResolveTeamReferenceOptions): ResolvedTeamMember;
127
- export declare function getMemberByAlias(config: TeamConfig, alias: string): MemberConfig | undefined;
128
- /** Reserved aliases for the mechanical review loop. */
129
- export declare const CODER_ALIAS = "Coder";
130
- export declare const REVIEWER_ALIAS = "Reviewer";
131
- /**
132
- * Check whether a team is a leadless Coder+Reviewer team, which
133
- * triggers the mechanical review loop (Task 77).
134
- */
135
- export declare function isLeadlessReviewTeam(config: TeamConfig): boolean;
136
- /**
137
- * Resolve the target alias for a team given the routing rules:
138
- * 1. --alias specified → that alias (direct addressing)
139
- * 2. Exactly 1 member → that member (regardless of alias; solo-worker
140
- * teams are a first-class shape)
141
- * 3. No Lead + Coder + Reviewer → "__review__" (mechanical review)
142
- * 4. Has Lead → Lead's alias (case-insensitive via getLeader)
143
- * 5. >1 members with no Lead → error listing available aliases
144
- */
145
- export declare function resolveTeamTarget(config: TeamConfig, targetAlias?: string): {
146
- kind: "direct";
147
- alias: string;
148
- } | {
149
- kind: "review";
150
- } | {
151
- kind: "error";
152
- message: string;
153
- };
154
- /** A node in the team tree (or DAG if diamonds exist). */
155
- export interface TeamTreeNode {
156
- /** Absolute path to this node's .lmctl file. */
157
- filePath: string;
158
- /** Parsed team config. */
159
- config: TeamConfig;
160
- /** Children: member alias → child node (only for teamfile= members). */
161
- children: Map<string, TeamTreeNode>;
162
- }
163
- /**
164
- * Build a team tree (DAG) by recursively resolving all `teamfile=`
165
- * references starting from `rootPath`.
166
- *
167
- * Uses two data structures for correctness:
168
- * - `chain` (Set): tracks the current ancestor path from root to
169
- * detect cycles. Added on entry, deleted on backtrack. A path
170
- * appearing twice in the chain IS a cycle.
171
- * - `visited` (Map): deduplicates diamonds. If a file was already
172
- * built by a sibling branch, returns the existing node instead of
173
- * re-reading. A path appearing in visited but not in chain is a
174
- * diamond (safe), not a cycle.
175
- *
176
- * Throws on: cycles, missing files, parse errors.
177
- */
178
- export declare function buildTeamTree(rootPath: string, chain?: Set<string>, visited?: Map<string, TeamTreeNode>): TeamTreeNode;
179
- /**
180
- * Collect all unique nodes in the tree in post-order (children before
181
- * parent). Used by `create` for depth-first seeding and by `lint`
182
- * for per-node reporting.
183
- */
184
- export declare function postOrderNodes(root: TeamTreeNode): TeamTreeNode[];
@@ -1,146 +0,0 @@
1
- import type { ProviderName } from "../types.js";
2
- export type { ProviderName };
3
- /** Valid member roles. */
4
- export type MemberRole = "coder" | "reviewer" | "leader";
5
- /** A team member — corresponds to [team.member] section. */
6
- export interface MemberEntry {
7
- /** Team name (from section name, before the dot). */
8
- team: string;
9
- /** Member alias (from section name, after the dot). */
10
- alias: string;
11
- /** Provider name = tool identity. */
12
- provider: ProviderName;
13
- /** Native session ID. Absent for pending slots. */
14
- session?: string;
15
- /** Role within the team. */
16
- role: MemberRole;
17
- /** Absolute runtime sessiondir for this session. */
18
- sessiondir?: string;
19
- /** Optional profile name. */
20
- profile?: string;
21
- /** Optional description. */
22
- description?: string;
23
- }
24
- /** An orphaned session — corresponds to [orphaned.name] section. */
25
- export interface OrphanedEntry {
26
- /** Alias (from section name, after "orphaned."). */
27
- alias: string;
28
- /** Provider name = tool identity. */
29
- provider: ProviderName;
30
- /** Native session ID. */
31
- session?: string;
32
- /** Absolute path to session working directory. */
33
- sessiondir: string;
34
- /** Optional description. */
35
- description?: string;
36
- /** Optional profile name. */
37
- profile?: string;
38
- }
39
- /** A team — corresponds to [team] section. */
40
- export interface TeamEntry {
41
- /** Team name (from section header). */
42
- name: string;
43
- /** Team description. */
44
- description?: string;
45
- /** Absolute path to the actual code/project directory for this team. */
46
- workdir?: string;
47
- }
48
- /** Full parsed representation of an lmctl.config file. */
49
- export interface WorkspaceConfig {
50
- /** Workspace name (bare key at top of file). */
51
- name: string;
52
- /** Teams indexed by name. */
53
- teams: Record<string, TeamEntry>;
54
- /** All team members. */
55
- members: MemberEntry[];
56
- /** Standalone sessions not in any team. */
57
- orphaned: OrphanedEntry[];
58
- /** PM session pointer (top-level, optional). */
59
- pmProvider?: ProviderName;
60
- pmSession?: string;
61
- /** Absolute runtime sessiondir for the PM session. */
62
- pmSessiondir?: string;
63
- }
64
- /** A validation error found by validateConfig. */
65
- export interface ValidationError {
66
- field: string;
67
- message: string;
68
- }
69
- /** Result of a find operation (append-only discovery). */
70
- export interface FindResult {
71
- added: number;
72
- errors: string[];
73
- }
74
- /** Provider names that cannot be used as member aliases. */
75
- export declare const RESERVED_NAMES: ReadonlySet<string>;
76
- /** All valid provider names. */
77
- export declare const VALID_PROVIDERS: ReadonlySet<string>;
78
- /** Providers allowed for orchestrator roles (leader).
79
- * All providers allowed. Codex leaders use exec_command with yield-based
80
- * polling for shell commands. Long lmctl chat turns may need multiple
81
- * polls (yield_time_ms up to 30s, then re-poll). The Codex model
82
- * sometimes gives up too early — a behavioral issue, not a platform limit. */
83
- export declare const VALID_ORCHESTRATOR_PROVIDERS: ReadonlySet<string>;
84
- /** All valid member roles. */
85
- export declare const VALID_ROLES: ReadonlySet<string>;
86
- /** User-scoped tool configuration from ~/.lmctl/config.toml. */
87
- export interface ToolProfileConfig {
88
- description?: string;
89
- flags?: string;
90
- }
91
- export interface ToolConfig {
92
- start?: string;
93
- resume?: string;
94
- /** Optional override for the non-interactive one-shot command. */
95
- agent?: string;
96
- profiles?: Record<string, ToolProfileConfig>;
97
- /** Legacy fallback for older configs written before named profiles existed. */
98
- profile_flag?: string;
99
- }
100
- /** Per-provider compact threshold overrides. Either or both may be present. */
101
- export interface CompactProviderConfig {
102
- /** Minimum context tokens before `lmctl compact` will even prompt. */
103
- min?: number;
104
- /** Context tokens at or above which `lmctl compact` auto-runs without prompting. */
105
- max?: number;
106
- }
107
- /** Compaction-gate configuration parsed from the [compact] / [compact.<provider>]
108
- * sections of ~/.lmctl/config.toml. The resolver
109
- * (`resolveCompactThresholds`) applies precedence: provider override beats
110
- * global beats built-in defaults. */
111
- export interface CompactConfig {
112
- /** Global defaults for any provider that has no override. */
113
- global?: CompactProviderConfig;
114
- /** Per-provider overrides keyed by provider name (claude, codex, ...). */
115
- providers?: Record<string, CompactProviderConfig>;
116
- }
117
- /** Full parsed representation of ~/.lmctl/config.toml. */
118
- export interface UserConfig {
119
- tools: Record<string, ToolConfig>;
120
- /** Optional compaction gating thresholds. Absent ⇒ all defaults. */
121
- compact?: CompactConfig;
122
- /** Optional operator-chosen name for this environment/computer (flat
123
- * top-level `site_name = "..."` key). Purely informational today; the
124
- * forward motivation is cross-site agent identification, but nothing
125
- * requires it — readers must treat absence as normal. */
126
- site_name?: string;
127
- }
128
- /** Get the leader of a team (if any). */
129
- export declare function getTeamLeader(config: WorkspaceConfig, teamName: string): MemberEntry | undefined;
130
- /** Get all members of a team. */
131
- export declare function getTeamMembers(config: WorkspaceConfig, teamName: string): MemberEntry[];
132
- /** Check if a team is managed (has a leader). */
133
- export declare function isTeamManaged(config: WorkspaceConfig, teamName: string): boolean;
134
- /** Check whether a provider can be used for orchestrator roles (PM, leader). */
135
- export declare function isValidOrchestratorProvider(provider: string): boolean;
136
- /**
137
- * Find any member or orphaned entry by native session ID.
138
- * Returns the entry and whether it's a member or orphaned.
139
- */
140
- export declare function findBySessionId(config: WorkspaceConfig, sessionId: string): {
141
- type: "member";
142
- entry: MemberEntry;
143
- } | {
144
- type: "orphaned";
145
- entry: OrphanedEntry;
146
- } | null;