@lmctl-ai/lmctl 0.1.342 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -0
- package/README.md +11 -51
- package/data/price-aliases.json +1 -0
- package/data/price-data.json +1 -1
- package/dist/cli/batch.d.ts +2 -0
- package/dist/cli/busy-evidence.d.ts +27 -0
- package/dist/cli/chat-cycle.d.ts +59 -0
- package/dist/cli/chat-exec.d.ts +83 -0
- package/dist/cli/chat-policy.d.ts +22 -0
- package/dist/cli/chat.d.ts +23 -0
- package/dist/cli/code-resolver.d.ts +8 -0
- package/dist/cli/common.d.ts +54 -0
- package/dist/cli/context.d.ts +12 -0
- package/dist/cli/cost.d.ts +2 -0
- package/dist/cli/export.d.ts +2 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +1062 -1400
- package/dist/cli/infra.d.ts +78 -0
- package/dist/cli/ls.d.ts +2 -0
- package/dist/cli/mailbox-cli.d.ts +6 -0
- package/dist/cli/managed.d.ts +62 -0
- package/dist/cli/mcp-install.d.ts +23 -0
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/paths.d.ts +50 -0
- package/dist/cli/plan-wizard.d.ts +42 -0
- package/dist/cli/plan.d.ts +20 -0
- package/dist/cli/queue-delivery.d.ts +107 -0
- package/dist/cli/ratelimit.d.ts +3 -0
- package/dist/cli/remote-fetch.d.ts +7 -0
- package/dist/cli/run-queries.d.ts +82 -0
- package/dist/cli/running.d.ts +5 -0
- package/dist/cli/schema.sql +20 -1
- package/dist/cli/script.d.ts +6 -0
- package/dist/cli/script.js +2097 -0
- package/dist/cli/self-identity.d.ts +25 -0
- package/dist/cli/session-idle.d.ts +118 -0
- package/dist/cli/status.d.ts +22 -0
- package/dist/cli/tail.d.ts +18 -0
- package/dist/cli/target-resolver.d.ts +139 -0
- package/dist/cli/team-status.d.ts +91 -0
- package/dist/cli/teamfile-compat.d.ts +71 -0
- package/dist/cli/teamfile-store.d.ts +18 -0
- package/dist/cli/teamfile-template.d.ts +40 -0
- package/dist/cli/template-env.d.ts +25 -0
- package/dist/cli/terminal-lock.d.ts +25 -0
- package/dist/cli/terminal.d.ts +23 -0
- package/dist/cli/time-filter.d.ts +10 -0
- package/dist/cli/update-notifier.d.ts +11 -0
- package/dist/cli/version-util.d.ts +2 -0
- package/dist/config/seed_templates.d.ts +1 -0
- package/dist/db/backfill-event-log.d.ts +26 -0
- package/dist/db/delegation.d.ts +37 -0
- package/dist/db/escalation_vocab.d.ts +45 -0
- package/dist/db/event-log.d.ts +40 -0
- package/dist/db/index.d.ts +1213 -0
- package/dist/db/inflight-acquire.d.ts +70 -0
- package/dist/db/invocation-event-projections.d.ts +65 -0
- package/dist/db/ledger-identity.test.d.ts +1 -0
- package/dist/db/live-event-projections.d.ts +92 -0
- package/dist/db/migrate.d.ts +51 -0
- package/dist/db/open-readonly.d.ts +2 -0
- package/dist/db/process-liveness.d.ts +37 -0
- package/dist/db/sqlite.d.ts +47 -0
- package/dist/db/sqlite.test.d.ts +1 -0
- package/dist/db/terminal-lock.d.ts +14 -0
- package/dist/db/tracked-invocation-reconcile.d.ts +52 -0
- package/dist/db/tracked-invocation.d.ts +116 -0
- package/dist/mcp/dispatch.d.ts +45 -0
- package/dist/mcp/mediation.d.ts +128 -0
- package/dist/mcp/path-warning.d.ts +7 -0
- package/dist/mcp/server.d.ts +63 -0
- package/dist/mcp/tools.d.ts +24 -0
- package/dist/providers/adapter.d.ts +265 -0
- package/dist/providers/adapters/agy-adapter.d.ts +17 -0
- package/dist/providers/adapters/claude-adapter.d.ts +20 -0
- package/dist/providers/adapters/codex-adapter.d.ts +22 -0
- package/dist/providers/adapters/copilot-adapter.d.ts +16 -0
- package/dist/providers/adapters/dsh-adapter.d.ts +89 -0
- package/dist/providers/adapters/gemini-adapter.d.ts +44 -0
- package/dist/providers/adapters/hermes-adapter.d.ts +71 -0
- package/dist/providers/adapters/index.d.ts +35 -0
- package/dist/providers/adapters/kimi-adapter.d.ts +16 -0
- package/dist/providers/adapters/lmplayer-adapter.d.ts +14 -0
- package/dist/providers/adapters/opencode-adapter.d.ts +11 -0
- package/dist/providers/adapters/pi-adapter.d.ts +17 -0
- package/dist/providers/adapters/print-turn.d.ts +29 -0
- package/dist/providers/adapters/qwen-adapter.d.ts +11 -0
- package/dist/providers/agy.d.ts +32 -0
- package/dist/providers/base-adapter.d.ts +107 -0
- package/dist/providers/base.d.ts +12 -0
- package/dist/providers/binary-check.d.ts +102 -0
- package/dist/providers/bundle.d.ts +118 -0
- package/dist/providers/claude-mock.d.ts +90 -0
- package/dist/providers/claude.d.ts +21 -0
- package/dist/providers/codex-config.d.ts +15 -0
- package/dist/providers/codex.d.ts +25 -0
- package/dist/providers/config/model-selection-lint.d.ts +45 -0
- package/dist/providers/config/team-config.d.ts +183 -0
- package/dist/providers/config/types.d.ts +146 -0
- package/dist/providers/config/user-config.d.ts +88 -0
- package/dist/providers/copilot.d.ts +21 -0
- package/dist/providers/debug.d.ts +128 -0
- package/dist/providers/dsh-sidecar.d.ts +65 -0
- package/dist/providers/dsh-zstd.d.ts +27 -0
- package/dist/providers/dsh.d.ts +37 -0
- package/dist/providers/frontmatter.d.ts +46 -0
- package/dist/providers/gemini-session-reader.d.ts +151 -0
- package/dist/providers/gemini.d.ts +39 -0
- package/dist/providers/hermes.d.ts +90 -0
- package/dist/providers/index.d.ts +421 -0
- package/dist/providers/kimi.d.ts +37 -0
- package/dist/providers/model-catalog.d.ts +141 -0
- package/dist/providers/one-shot-timeout.d.ts +1 -0
- package/dist/providers/opencode-config.d.ts +62 -0
- package/dist/providers/opencode.d.ts +40 -0
- package/dist/providers/parsers/acp.d.ts +47 -0
- package/dist/providers/parsers/codex-app-server.d.ts +60 -0
- package/dist/providers/parsers/stream-json.d.ts +57 -0
- package/dist/providers/passive-readers/agy.d.ts +155 -0
- package/dist/providers/passive-readers/copilot.d.ts +173 -0
- package/dist/providers/passive-readers/dsh.d.ts +34 -0
- package/dist/providers/passive-readers/kimi.d.ts +44 -0
- package/dist/providers/passive-readers/opencode.d.ts +89 -0
- package/dist/providers/passive-readers/qwen.d.ts +151 -0
- package/dist/providers/passive-readers/shared.d.ts +138 -0
- package/dist/providers/passive-session-reader.d.ts +188 -0
- package/dist/providers/path-utils.d.ts +1 -0
- package/dist/providers/pi.d.ts +32 -0
- package/dist/providers/pricing.d.ts +107 -0
- package/dist/providers/qwen.d.ts +22 -0
- package/dist/providers/ratelimit-readings.d.ts +32 -0
- package/dist/providers/registry.d.ts +31 -0
- package/dist/providers/resume.d.ts +43 -0
- package/dist/providers/seed-instruction.d.ts +3 -0
- package/dist/providers/self-session-env.d.ts +21 -0
- package/dist/providers/session-limit.d.ts +9 -0
- package/dist/providers/strip-ansi.d.ts +5 -0
- package/dist/providers/transport-errors.d.ts +94 -0
- package/dist/providers/transport-lifecycle.d.ts +63 -0
- package/dist/providers/transport-wrappers.d.ts +110 -0
- package/dist/providers/transports/acp-profiles/config-option-step.d.ts +24 -0
- package/dist/providers/transports/acp-profiles/copilot.d.ts +12 -0
- package/dist/providers/transports/acp-profiles/gemini.d.ts +22 -0
- package/dist/providers/transports/acp-profiles/hermes.d.ts +27 -0
- package/dist/providers/transports/acp-profiles/index.d.ts +19 -0
- package/dist/providers/transports/acp-profiles/kimi.d.ts +24 -0
- package/dist/providers/transports/acp-profiles/opencode.d.ts +26 -0
- package/dist/providers/transports/acp-profiles/types.d.ts +258 -0
- package/dist/providers/transports/acp-rpc.d.ts +18 -0
- package/dist/providers/transports/acp.d.ts +215 -0
- package/dist/providers/transports/codex-app-server.d.ts +190 -0
- package/dist/providers/transports/hold-open.d.ts +120 -0
- package/dist/providers/transports/manager.d.ts +21 -0
- package/dist/providers/transports/stream-json.d.ts +162 -0
- package/dist/providers/transports/types.d.ts +56 -0
- package/dist/providers/types.d.ts +154 -0
- package/dist/providers/yolo-contract.d.ts +131 -0
- package/dist/script/adapter.d.ts +101 -0
- package/dist/script/batch-script.d.ts +7 -0
- package/dist/script/index.d.ts +3 -0
- package/dist/script/lmscript.d.ts +550 -0
- package/dist/shared/policy.d.ts +74 -0
- package/dist/shared-lib/db.d.ts +25 -0
- package/dist/shared-lib/passive-session-reader.d.ts +2 -0
- package/dist/shared-lib/provider-parse.d.ts +6 -0
- package/dist/templates/basedir.d.ts +52 -0
- package/dist/uri/lmctl_uri.d.ts +38 -0
- package/durable-memory/model_selection.md +122 -25
- package/examples/README.md +103 -0
- package/examples/anonymous-panel.lms +3 -0
- package/examples/batch-prompts.txt +9 -0
- package/examples/batchscript.lms +67 -0
- package/examples/n8n/agent-lib.lms +56 -0
- package/examples/n8n/git-lib.lms +93 -0
- package/examples/n8n/mock-support.db +0 -0
- package/examples/n8n/multi-agent-review.lms +107 -0
- package/examples/n8n/news-digest.lms +159 -0
- package/examples/n8n/rag-search.lms +163 -0
- package/examples/n8n/support-agent.lms +88 -0
- package/examples/n8n/ticket-triage.lms +156 -0
- package/package.json +13 -17
- package/dist/cli/side_effect_classifier.json +0 -19
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type Database from './sqlite.js';
|
|
2
|
+
export interface BackfillResult {
|
|
3
|
+
/** Events newly appended this run (0 on a clean re-run). */
|
|
4
|
+
appended: number;
|
|
5
|
+
/** Events skipped because their deterministic event_id already existed. */
|
|
6
|
+
skipped: number;
|
|
7
|
+
/** Per-source-table appended+skipped totals, for parity assertions. */
|
|
8
|
+
bySource: Record<'team_chat_log' | 'agent_mailbox' | 'tracked_invocation' | 'agent_inflight', number>;
|
|
9
|
+
/** Projection row counts after rebuild. */
|
|
10
|
+
projections: {
|
|
11
|
+
agent_state: number;
|
|
12
|
+
message_pending: number;
|
|
13
|
+
invocation_state: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function backfillEventLog(db: Database): BackfillResult;
|
|
17
|
+
/**
|
|
18
|
+
* Rebuild `agent_state` (lease slice) / `message_pending` / `invocation_state`
|
|
19
|
+
* from `message_event`, in `seq` order. Truncates the three projections first,
|
|
20
|
+
* so the result is a pure function of the log — this is the reusable
|
|
21
|
+
* "rebuild a projection by replaying the log" capability. Idempotent.
|
|
22
|
+
*
|
|
23
|
+
* Not wrapped in its own transaction: `backfillEventLog` already calls it
|
|
24
|
+
* inside the outer transaction. A standalone caller should wrap it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rebuildProjections(db: Database): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type Database from './sqlite.js';
|
|
2
|
+
/** v32 - per-receiver in-flight marker for single-sender serialization. */
|
|
3
|
+
export interface AgentInflightRow {
|
|
4
|
+
receiver_teamfile: string;
|
|
5
|
+
receiver_alias: string;
|
|
6
|
+
sender_teamfile: string;
|
|
7
|
+
sender_alias: string;
|
|
8
|
+
started_at: string;
|
|
9
|
+
active_count: number;
|
|
10
|
+
holder_pid: number | null;
|
|
11
|
+
}
|
|
12
|
+
export type AgentInflightInput = Omit<AgentInflightRow, 'active_count' | 'holder_pid'>;
|
|
13
|
+
export type AgentInflightObservedHolder = Pick<AgentInflightRow, 'sender_teamfile' | 'sender_alias' | 'started_at' | 'holder_pid'>;
|
|
14
|
+
export interface AgentInflightAcquireOptions {
|
|
15
|
+
stale_before?: string | null;
|
|
16
|
+
force?: boolean;
|
|
17
|
+
reclaim_reason?: 'force' | 'stale' | 'dead-pid' | 'session-idle';
|
|
18
|
+
reclaim_observed?: AgentInflightObservedHolder;
|
|
19
|
+
}
|
|
20
|
+
export type AgentInflightAcquireResult = {
|
|
21
|
+
acquired: true;
|
|
22
|
+
current: AgentInflightRow;
|
|
23
|
+
lease_id: string;
|
|
24
|
+
} | {
|
|
25
|
+
acquired: false;
|
|
26
|
+
current: AgentInflightRow;
|
|
27
|
+
};
|
|
28
|
+
export declare function prepareDelegationStatements(db: Database): {
|
|
29
|
+
getAgentInflight: import("./sqlite.js").Statement;
|
|
30
|
+
listAgentInflight: import("./sqlite.js").Statement;
|
|
31
|
+
acquireAgentInflight: import("./sqlite.js").Statement;
|
|
32
|
+
clearAgentInflight: import("./sqlite.js").Statement;
|
|
33
|
+
clearAgentInflightIfSender: import("./sqlite.js").Statement;
|
|
34
|
+
clearObservedTerminalAgentInflight: import("./sqlite.js").Statement;
|
|
35
|
+
decrementAgentInflight: import("./sqlite.js").Statement;
|
|
36
|
+
clearAgentInflightOlderThan: import("./sqlite.js").Statement;
|
|
37
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEF-1 (escalation-engine, briefs/def1-escalation-engine-design.md §3/§4;
|
|
3
|
+
* canonical model durable-memory/escalation-and-progressive-automation.md).
|
|
4
|
+
*
|
|
5
|
+
* The SINGLE engine-owned generic-escalation vocabulary + the
|
|
6
|
+
* prompt-convention snippet. Specialized-first / minimal: `other`
|
|
7
|
+
* (umbrella + free-text reason) + 3 named kinds. The author NEVER
|
|
8
|
+
* declares these — the *prompt* makes the agent produce them, and the
|
|
9
|
+
* engine RESERVES them (matched before declared semantic edges; a
|
|
10
|
+
* declared edge using a reserved name is ignored — §2 reserved-word
|
|
11
|
+
* guarantee). One-line extendable; grow empirically via the authoring
|
|
12
|
+
* loop, do NOT pre-specify a large taxonomy.
|
|
13
|
+
*/
|
|
14
|
+
/** Umbrella escalation token; carries a short free-text reason after a
|
|
15
|
+
* colon: `STANCE: other: <why no declared outcome fits>`. */
|
|
16
|
+
export declare const ESCALATION_OTHER = "other";
|
|
17
|
+
/** First-class named escalation reason kinds. */
|
|
18
|
+
export declare const ESCALATION_KINDS: readonly ["not_enough_information", "dont_know", "other_work"];
|
|
19
|
+
/** The full reserved generic-escalation vocabulary. */
|
|
20
|
+
export declare const ESCALATION_VOCAB: ReadonlySet<string>;
|
|
21
|
+
/** Engine-reserved operator decision: end the run as a human-decided
|
|
22
|
+
* abort (NOT a synthesized generic failure terminal). */
|
|
23
|
+
export declare const ESCALATION_ABORT_DECISION = "@abort";
|
|
24
|
+
/** Fail-closed result reason when an operator escalation-resume decision is
|
|
25
|
+
* neither the reserved `@abort` nor one of the escalated step's declared
|
|
26
|
+
* outcomes (DEF-1 §"bounded"). Enforced in `resumeEscalationTxn` BEFORE any
|
|
27
|
+
* state mutation; surfaced uniformly via the `{resumed:false}` channel. */
|
|
28
|
+
export declare const ESCALATION_INVALID_DECISION: "invalid_decision";
|
|
29
|
+
/** The terminal_state a `@abort` escalation decision finishes the run
|
|
30
|
+
* with — a real, human-decided terminal. */
|
|
31
|
+
export declare const ESCALATION_ABORTED_TERMINAL = "escalation_aborted";
|
|
32
|
+
/** Attention `kind` for an engine-raised workflow escalation (sibling of
|
|
33
|
+
* `interactive_waiting_operator`). */
|
|
34
|
+
export declare const WORKFLOW_ESCALATION_KIND = "workflow_escalation";
|
|
35
|
+
/** True iff `t` is a reserved generic-escalation token. `other` may be
|
|
36
|
+
* carried as a bare `other` or `other: <reason>` (the parser yields the
|
|
37
|
+
* bare token; the free text rides the stance evidence channel). */
|
|
38
|
+
export declare function isEscalationToken(t: unknown): t is string;
|
|
39
|
+
/**
|
|
40
|
+
* The engine-owned prompt-convention snippet. Injected into every
|
|
41
|
+
* review/consolidate/interactive agent turn (NOT authored). Interpolates
|
|
42
|
+
* the step's declared semantic outcomes so the agent is told the exact
|
|
43
|
+
* choices it may pick, plus the escalation contract for "none fit".
|
|
44
|
+
*/
|
|
45
|
+
export declare function renderEscalationPromptSnippet(declaredOutcomes: readonly string[]): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type Database from './sqlite.js';
|
|
2
|
+
export interface EventAppendInput {
|
|
3
|
+
stream_id: string;
|
|
4
|
+
event_type: string;
|
|
5
|
+
/** JSON-serializable event payload. Stored via JSON.stringify; the schema
|
|
6
|
+
* enforces json_valid(). */
|
|
7
|
+
payload: unknown;
|
|
8
|
+
/** The projection's last_seq observed by the caller immediately before this
|
|
9
|
+
* attempt (e.g. agent_state.last_seq for an INFLIGHT_TAKE). Use 0 when the
|
|
10
|
+
* projection row does not exist yet (first event of a stream). */
|
|
11
|
+
observedLastSeq: number;
|
|
12
|
+
/** ISO-8601 UTC timestamp; display/audit only (seq is the ordering
|
|
13
|
+
* authority). Defaults to now. */
|
|
14
|
+
ts?: string;
|
|
15
|
+
/** Overrides the event_type component of the deterministic event_id intent
|
|
16
|
+
* tuple. Standing rule: an event type that is (a) NOT backed by a CAS
|
|
17
|
+
* projection and (b) appendable by multiple distinct actors on one stream
|
|
18
|
+
* MUST fold actor identity into its intent (e.g.
|
|
19
|
+
* 'MESSAGE_ACKNOWLEDGED:<actor>') or concurrent distinct-actor appends
|
|
20
|
+
* collide and silently dedupe. The stored event_type stays clean. */
|
|
21
|
+
intentKey?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface EventAppendResult {
|
|
24
|
+
/** False when the deterministic event_id already existed (retried attempt);
|
|
25
|
+
* the projection update was skipped because the original commit applied it. */
|
|
26
|
+
appended: boolean;
|
|
27
|
+
/** The event's seq — freshly assigned, or the existing row's on a dedupe. */
|
|
28
|
+
seq: number;
|
|
29
|
+
event_id: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function deterministicEventId(streamId: string, eventType: string, observedLastSeq: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Append an event and apply its projection update atomically.
|
|
34
|
+
*
|
|
35
|
+
* `updateProjection` runs INSIDE the same transaction, after the event row is
|
|
36
|
+
* inserted, and receives the new event's seq (projections store it as
|
|
37
|
+
* `last_seq`). If it throws, the event row is rolled back with it — neither
|
|
38
|
+
* half ever lands alone.
|
|
39
|
+
*/
|
|
40
|
+
export declare function appendEventWithProjection(db: Database, input: EventAppendInput, updateProjection: (eventSeq: number) => void): EventAppendResult;
|