@livx.cc/agentx 0.99.121 → 0.99.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.d.ts +29 -2
- package/dist/cli.js +664 -240
- package/dist/cli.js.map +1 -1
- package/dist/directives.d.ts +15 -1
- package/dist/directives.js +47 -2
- package/dist/directives.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +337 -144
- package/dist/index.js.map +1 -1
- package/dist/{secondChannel-D33Wvruo.d.ts → secondChannel-BddfVzTp.d.ts} +101 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ Beyond file tools, the runtime ships the higher-altitude pieces too — each an
|
|
|
87
87
|
- **Skills + memory** — VFS-backed (`skillsDir`/`memoryDir`); persistence is just the backend choice.
|
|
88
88
|
- **Subagents** (`subagents`; **typed agents** via `agentsDir` — `<dir>/<name>.md` defines a persona + model + scoped tools, selected with the `Task` `agentType`), **hooks** (`hooks`: preToolUse/postToolUse/onStop — block or audit any tool call), **slash-commands** (`commandsDir`), **TodoWrite**, **MCP** (`mcpToolsToAgentTools`).
|
|
89
89
|
- **A delegated child is a full agent**: it inherits the parent's **tools** (incl. host-injected/MCP ones), **system prompt**, and **providerOptions** (only when it stays on the same provider — cursor's `cwd`/`cursorSession` never leak onto an anthropic child; override with `providerOptionsFor(model)`). `Task({ model })` (and a `TaskBatch` task's `model`) runs one sub-task on another model — alias or full id, precedence **explicit `model` > `agentType` def's `model` > parent's**. A def's frontmatter `tools:` allowlist narrows the inherited set and may name a host-injected tool by name; its body still overrides the persona. The host's `preToolUse` gate is inherited too, so delegation is not a way around it (the observer/lifecycle hooks stay parent-only). Inherited tools that escape the VFS are re-bound per child (`AgentTool.withCwd`): a `isolation:"worktree"` child's real `Shell` runs in the WORKTREE, keeping any host rename (`Shell` -> `Bash`) (background shell jobs are off there, and the parent-bound `ShellOutput`/`ShellStatus`/`ShellKill` are dropped rather than pointed at the parent's jobs); an overlay child's shell writes straight to the working tree — an overlay isolates the VFS, not a process.
|
|
90
|
+
- **Two-model modes** (`src/modes.ts`) — **delegate** (`delegate: { worker }`): the agent's model PLANS and may not write (Write/Edit/MultiEdit/ApplyEdits/bash/Shell are refused at execution, keyed on `ToolContext.model`), `Task`/`TaskBatch` go on (depth 1, children default to the worker, and get the host's `postToolUse` so their writes are observed). **advisor** (`advisor: { model, limit?, snapshot? }`): the agent's model does the work and an `Advise` tool asks the stronger model (≤3 calls; it sees only the request, the host's optional `snapshot()` and the question); the first write waits for one consult. Both are off when the models are equal or either is `cursor/*`; the second model's usage comes back as `RunResult.workerUsage` / `workerModel` (not in `usage`). Prompt directives switch them: `[opus->haiku] task` (delegate), `[haiku<-opus] task` (advisor), `[off]`; keyed forms `delegate:x`, `advisor:x`, `mode:off`. A host passing its own `keys` to `parseDirectives` must list `delegate` / `advisor` / `mode`.
|
|
90
91
|
- **Streaming** (`stream: true` → `text_delta` via `HostBridge.notify`) and **context compaction** (`compaction: { maxMessages }` → edge-safe summarize-and-boundary). Defaults preserve the original non-stream, drop-oldest behavior.
|
|
91
92
|
- **Multi-turn + project context** — `Agent.send()` continues a conversation across turns (vs `run()`, which starts fresh); **project instructions** (`instructionFiles`: `AGENTS.md`/`CLAUDE.md` at the FS root) inject into the system prompt.
|
|
92
93
|
- **DuplexAgent** (`src/duplex.ts`) — voice-optimized three-tier engine (reflex/act/think): a fast reflex agent streams instant replies and self-selects escalation — `Act` for standard tool work (Sonnet-class), `Think` for deep reasoning (Opus-class, configurable, default on). Results are pushed back and re-voiced by the reflex (turn mutex, coalesced completions, `TaskStatus`/`CancelTask`). See [`mind/10`](./mind/10-duplex.md).
|
|
@@ -107,6 +108,7 @@ agentx --resume <id> "…" # resume a specific session
|
|
|
107
108
|
|
|
108
109
|
- **Filesystem + Shell** — by default the CLI has **full real-filesystem access like Claude Code** (root `/` is the machine root, the launch dir is the working dir, absolute host paths and above-cwd reach both work) with a **real `/bin/sh`** (`Shell` tool) so the agent can run git, bun, node, curl, and any installed binary. Secrets (`.env`, `.ssh`, keys, `.git`) stay hidden by the jail; env secrets are scrubbed from the child shell. `--sandbox` instead operates over an in-memory copy of the working dir with a VFS-only `bash` — the real disk is never touched. `--boddb <dir>` runs over a **persistent database workspace** (a bod-db store at `<dir>` — `meta.db` tree + `files/` bytes) that survives across runs while the real disk stays untouched; DB-native by default, or add `--seed` to hydrate it from cwd on the first run. `--no-shell` forces the VFS bash in disk mode. `--harden` OS-sandboxes the real shell (macOS `sandbox-exec` / Linux `bwrap`): writes confined to cwd+tmp, outbound network blocked (`--harden-net` keeps network); commands fail closed when no wrapper exists. (`/sandbox` shows the active mode.)
|
|
109
110
|
- **Sessions** — every conversation persists to `./.agent/sessions/<id>.json`, flushed at **every tool step** (a crash, hang, or Ctrl-C mid-turn loses at most the in-flight step, never the transcript); `--continue`/`--resume` (and `/sessions`, `/resume`) pick it back up, *with memory across turns* — a REPL turn sees the previous one. A global symlink index at `~/.agent/sessions/` enables cross-project lookup: `--resume 090715-myproject` resolves from any directory, and `/sessions all` lists every project's sessions in one picker.
|
|
111
|
+
- **Delegate / advisor modes** — `[opus->haiku] build x` (opus plans, haiku writes) or `[haiku<-opus] build x` (haiku builds, opus advises), `[off]` to clear; flags `--delegate <worker>` / `--advisor <model>`. **Sticky** by default: the mode is stored on the session, so later turns and `-r` resumes keep it until `[off]` or another mode; `--mode-scope message` applies a prefix to that turn only. `--output-format json` reports `workerModel`/`workerUsage`, and the turn's cost includes it.
|
|
110
112
|
- **Diffs** — every `Edit`/`Write`/`MultiEdit` renders a colorized `+/-` diff (TTY-gated; plain when piped).
|
|
111
113
|
- **Slash commands** — `/help /tools /model /compact /copy /diff /memory /clear /sessions /resume /commands /init`; `/compact <focus>` preserves matching lines from the folded span; `/copy [code]` puts the last reply (or its last code block) on the OS clipboard; `/diff` shows everything the session changed (oldest checkpoint → now); `/memory` opens the memory index in `$EDITOR`; user-defined `./.agent/commands/<name>.md` are invokable directly as `/<name>` (the same registry the model's `SlashCommand` tool uses). Skills/commands created **mid-session** are picked up automatically each turn (delivered as a cache-friendly `<system-reminder>` delta, like Claude Code) and the `Skill`/`SlashCommand` tools rescan on a name miss; `/reload` forces a full catalog + system-prompt rebuild.
|
|
112
114
|
- **Live chrome** — the thinking spinner shows elapsed seconds + `esc to interrupt`; the terminal tab title tracks the session topic; a bell rings when a long (>10s) turn finishes in a backgrounded tab; the footer warns at 80%/90% context pressure and auto-trims announce themselves.
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
2
|
+
import { u as RouterState, H as Hooks, c as AgentOptions, v as RunResult, e as ChatUsage, R as ReasoningEffort, C as ChannelMode, b as Agent } from './secondChannel-BddfVzTp.js';
|
|
3
3
|
import { IFilesystem } from '@livx.cc/wcli/core';
|
|
4
4
|
import { M as Message, U as UserQuestion, H as HostBridge, c as ContentPart, o as MessageContent } from './tools-DZHZIyxh.js';
|
|
5
5
|
|
|
@@ -34,6 +34,15 @@ interface SessionMeta {
|
|
|
34
34
|
n: number;
|
|
35
35
|
model: string;
|
|
36
36
|
};
|
|
37
|
+
/** Sticky delegate/advisor mode set by a `[a->b]` / `[a<-b]` directive (`{}` = cleared by `[off]`) — outlives
|
|
38
|
+
* the process, so a resumed `-r` turn without a prefix keeps it. Absent = never set (the flags apply). */
|
|
39
|
+
mode?: TurnMode;
|
|
40
|
+
}
|
|
41
|
+
/** A delegate (`[model->delegate]`) or advisor (`[model<-advisor]`) mode; `model` = the left side, if one was named. */
|
|
42
|
+
interface TurnMode {
|
|
43
|
+
model?: string;
|
|
44
|
+
delegate?: string;
|
|
45
|
+
advisor?: string;
|
|
37
46
|
}
|
|
38
47
|
/** One turn's diagnostics, captured for offline forensics (mirrors what the footer prints, but persisted). */
|
|
39
48
|
interface TurnEvent {
|
|
@@ -133,6 +142,9 @@ interface Args {
|
|
|
133
142
|
boddb?: string;
|
|
134
143
|
seed: boolean;
|
|
135
144
|
subagents: boolean;
|
|
145
|
+
delegate?: string;
|
|
146
|
+
advisor?: string;
|
|
147
|
+
modeScope?: 'sticky' | 'message';
|
|
136
148
|
maxSteps?: number;
|
|
137
149
|
maxTokens?: number;
|
|
138
150
|
timeoutMs?: number;
|
|
@@ -333,6 +345,19 @@ declare function expandMentions(fs: IFilesystem, line: string): Promise<{
|
|
|
333
345
|
loaded: string[];
|
|
334
346
|
missing: string[];
|
|
335
347
|
}>;
|
|
348
|
+
/** Delegate/advisor mode for one turn. A leading `[a->b]` / `[a<-b]` / `[off]` directive is stripped and applied —
|
|
349
|
+
* sticky (default: stored on the session, so it holds for later turns and `-r` resumes until `[off]` or another mode)
|
|
350
|
+
* or for this message only (`--mode-scope message`). With no directive: the session's sticky mode, else the
|
|
351
|
+
* `--delegate`/`--advisor` flags. Other directive groups (`[opus]`) are left as prompt text, as before.
|
|
352
|
+
* Returns the task to send, or `null` when a named model does not resolve (the turn must not run on a guess). */
|
|
353
|
+
declare function applyTurnMode(agent: {
|
|
354
|
+
options: AgentOptions;
|
|
355
|
+
reprepare(): void;
|
|
356
|
+
}, session: SessionData, task: string, flags?: {
|
|
357
|
+
delegate?: string;
|
|
358
|
+
advisor?: string;
|
|
359
|
+
modeScope?: "sticky" | "message";
|
|
360
|
+
}, onModel?: (model: string) => void): string | null;
|
|
336
361
|
/** The headless `--output-format json` result object for a turn. */
|
|
337
362
|
declare function jsonResult(res: RunResult, session: SessionData): {
|
|
338
363
|
error?: any;
|
|
@@ -340,6 +365,8 @@ declare function jsonResult(res: RunResult, session: SessionData): {
|
|
|
340
365
|
sessionId: string;
|
|
341
366
|
costUsd?: number | undefined;
|
|
342
367
|
routing?: Record<string, unknown> | undefined;
|
|
368
|
+
workerModel?: string | undefined;
|
|
369
|
+
workerUsage?: ChatUsage | undefined;
|
|
343
370
|
budget?: {
|
|
344
371
|
spent: number;
|
|
345
372
|
limit: number;
|
|
@@ -382,4 +409,4 @@ declare function duplexError(e: unknown, reflexModel: string): string;
|
|
|
382
409
|
* the next turn (a re-final's fuller text) runs warm, as if that one was never sent. Returns the messages dropped. */
|
|
383
410
|
declare function rollbackTurn(agent: Agent, store: Pick<SessionStore, 'save'>, session: SessionData, start: number): Promise<number>;
|
|
384
411
|
|
|
385
|
-
export { type PermMode, abortActiveTurn, apiKeysFromEnv, appendMemoryNote, cacheMultipliers, condenseReplay, costOf, duplexError, duplexModels, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, loadBodifySecrets, loadInstallEnv, makeHost, mcpMentionResolver, mentionRefs, modelUsable, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, rollbackTurn, runShellLine, runTurn, setMcpMentionResolver, summarizeResult, turnCost };
|
|
412
|
+
export { type PermMode, abortActiveTurn, apiKeysFromEnv, appendMemoryNote, applyTurnMode, cacheMultipliers, condenseReplay, costOf, duplexError, duplexModels, estimateTranscriptTokens, expandMentions, exportMarkdown, fmtUsd, formatHistory, formatStatus, formatTranscriptFull, jsonResult, loadBodifySecrets, loadInstallEnv, makeHost, mcpMentionResolver, mentionRefs, modelUsable, parseArgs, pastePathClassifier, readImageParts, readMultiline, resolvePermMode, rollbackTurn, runShellLine, runTurn, setMcpMentionResolver, summarizeResult, turnCost };
|