tomo-ai 0.8.1 → 0.8.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +18 -1
  3. package/defaults/skills/system/CONFIG.md +9 -1
  4. package/defaults/skills/system/SKILL.md +3 -0
  5. package/dist/agent/live-session.d.ts +72 -1
  6. package/dist/agent/live-session.d.ts.map +1 -1
  7. package/dist/agent/live-session.js +282 -50
  8. package/dist/agent/live-session.js.map +1 -1
  9. package/dist/agent/sdk-options.d.ts +6 -0
  10. package/dist/agent/sdk-options.d.ts.map +1 -1
  11. package/dist/agent/sdk-options.js +8 -1
  12. package/dist/agent/sdk-options.js.map +1 -1
  13. package/dist/agent.d.ts +15 -11
  14. package/dist/agent.d.ts.map +1 -1
  15. package/dist/agent.js +194 -148
  16. package/dist/agent.js.map +1 -1
  17. package/dist/channels/attachments.d.ts +8 -0
  18. package/dist/channels/attachments.d.ts.map +1 -0
  19. package/dist/channels/attachments.js +46 -0
  20. package/dist/channels/attachments.js.map +1 -0
  21. package/dist/channels/imessage.d.ts +0 -1
  22. package/dist/channels/imessage.d.ts.map +1 -1
  23. package/dist/channels/imessage.js +48 -81
  24. package/dist/channels/imessage.js.map +1 -1
  25. package/dist/channels/telegram.d.ts.map +1 -1
  26. package/dist/channels/telegram.js +106 -76
  27. package/dist/channels/telegram.js.map +1 -1
  28. package/dist/channels/text-utils.d.ts +7 -0
  29. package/dist/channels/text-utils.d.ts.map +1 -0
  30. package/dist/channels/text-utils.js +27 -0
  31. package/dist/channels/text-utils.js.map +1 -0
  32. package/dist/cli/backup.js +24 -9
  33. package/dist/cli/backup.js.map +1 -1
  34. package/dist/cli/config/shared.d.ts.map +1 -1
  35. package/dist/cli/config/shared.js +4 -5
  36. package/dist/cli/config/shared.js.map +1 -1
  37. package/dist/cli/init.d.ts.map +1 -1
  38. package/dist/cli/init.js +4 -4
  39. package/dist/cli/init.js.map +1 -1
  40. package/dist/cli/start.js +21 -2
  41. package/dist/cli/start.js.map +1 -1
  42. package/dist/config.d.ts +18 -0
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/config.js +42 -5
  45. package/dist/config.js.map +1 -1
  46. package/dist/continuity-script.d.ts +9 -0
  47. package/dist/continuity-script.d.ts.map +1 -0
  48. package/dist/continuity-script.js +179 -0
  49. package/dist/continuity-script.js.map +1 -0
  50. package/dist/continuity.d.ts +8 -1
  51. package/dist/continuity.d.ts.map +1 -1
  52. package/dist/continuity.js +21 -8
  53. package/dist/continuity.js.map +1 -1
  54. package/dist/cron/scheduler.d.ts +1 -0
  55. package/dist/cron/scheduler.d.ts.map +1 -1
  56. package/dist/cron/scheduler.js +22 -5
  57. package/dist/cron/scheduler.js.map +1 -1
  58. package/dist/cron/store.d.ts.map +1 -1
  59. package/dist/cron/store.js +8 -2
  60. package/dist/cron/store.js.map +1 -1
  61. package/dist/fs-utils.d.ts +6 -0
  62. package/dist/fs-utils.d.ts.map +1 -0
  63. package/dist/fs-utils.js +43 -0
  64. package/dist/fs-utils.js.map +1 -0
  65. package/dist/jsonl.d.ts +3 -0
  66. package/dist/jsonl.d.ts.map +1 -0
  67. package/dist/jsonl.js +21 -0
  68. package/dist/jsonl.js.map +1 -0
  69. package/dist/lcm/blocks.d.ts +36 -7
  70. package/dist/lcm/blocks.d.ts.map +1 -1
  71. package/dist/lcm/blocks.js +187 -33
  72. package/dist/lcm/blocks.js.map +1 -1
  73. package/dist/lcm/compact.d.ts +35 -0
  74. package/dist/lcm/compact.d.ts.map +1 -1
  75. package/dist/lcm/compact.js +14 -26
  76. package/dist/lcm/compact.js.map +1 -1
  77. package/dist/lcm/prune-tools.d.ts +5 -0
  78. package/dist/lcm/prune-tools.d.ts.map +1 -1
  79. package/dist/lcm/prune-tools.js +100 -32
  80. package/dist/lcm/prune-tools.js.map +1 -1
  81. package/dist/lcm/runner.d.ts.map +1 -1
  82. package/dist/lcm/runner.js +2 -1
  83. package/dist/lcm/runner.js.map +1 -1
  84. package/dist/lcm/stats.d.ts.map +1 -1
  85. package/dist/lcm/stats.js +6 -23
  86. package/dist/lcm/stats.js.map +1 -1
  87. package/dist/mcp/oauth.d.ts.map +1 -1
  88. package/dist/mcp/oauth.js +7 -3
  89. package/dist/mcp/oauth.js.map +1 -1
  90. package/dist/mcp/pet-store.d.ts.map +1 -1
  91. package/dist/mcp/pet-store.js +5 -1
  92. package/dist/mcp/pet-store.js.map +1 -1
  93. package/dist/sessions/keys.d.ts +20 -0
  94. package/dist/sessions/keys.d.ts.map +1 -0
  95. package/dist/sessions/keys.js +45 -0
  96. package/dist/sessions/keys.js.map +1 -0
  97. package/dist/sessions/repair.d.ts.map +1 -1
  98. package/dist/sessions/repair.js +3 -2
  99. package/dist/sessions/repair.js.map +1 -1
  100. package/dist/sessions/store.d.ts +1 -1
  101. package/dist/sessions/store.d.ts.map +1 -1
  102. package/dist/sessions/store.js +29 -26
  103. package/dist/sessions/store.js.map +1 -1
  104. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.3 (2026-06-11)
4
+
5
+ ### Features
6
+
7
+ - **Experimental message steering** (#142). New `steering` config (`TOMO_STEERING=true`, default off) lets user messages that arrive during an in-flight tool-using turn bypass the per-session queue and inject at the next tool-call boundary. If the current turn has no boundary left, the message runs as the next follow-up turn. Cron, continuity, and other system-originated turns continue to queue normally.
8
+
9
+ ### Bug fixes
10
+
11
+ - **Six high-severity fixes from a codebase review** (#140):
12
+ - Fresh installs no longer crash on every CLI command (including `tomo init` and `--help`) when no channel is configured — channel validation moved from config load to daemon startup, and `tomo start` now validates before spawning the background child instead of printing "started" while the daemon silently dies.
13
+ - The iMessage webhook server binds `127.0.0.1` instead of all interfaces and caps request bodies at 1 MB; the webhook is also registered as the literal `127.0.0.1` (BlueBubbles could resolve `localhost` to `::1` and get connection refused), with stale `localhost`-form registrations from earlier versions cleaned up on upgrade.
14
+ - The cron scheduler no longer re-fires a due job on every 30s poll while a long agent run is still in flight (re-entrancy guard on `tick()`), and tick errors are caught instead of becoming unhandled rejections.
15
+ - Telegram streaming no longer silently drops content when a send/edit fails: progress is only advanced on success, the final flush retries with backoff, blocks over 4096 chars roll over into a new message, and `send()` chunks long text like iMessage does.
16
+ - `tomo backup restore` no longer deletes the preserved `.claude` directory along with the workspace tree; the backup's custom skills are merged in without overwriting live ones.
17
+ - The LCM compact nudge goes through the per-session queue instead of a fire-and-forget run that could overlap the next user message.
18
+ - **Multi-process race and atomic-write fixes** (#141). The daemon and CLI commands (`tomo cron add`, `tomo sessions clear`, `tomo config`, `tomo lcm prune-tools`) mutate the same files and could clobber each other:
19
+ - `SessionStore` registry mutators and list APIs reload from disk before acting, so CLI-side changes are no longer reverted by the daemon's next stale save.
20
+ - `CronStore.markRun`/`remove` reload before saving, so a job added while the daemon executes another job is no longer silently deleted.
21
+ - The MCP OAuth token store, pet store, and SDK session repair now write atomically (temp + rename) — a crash mid-write previously left truncated JSON that could permanently discard every MCP server's refresh token.
22
+ - `tomo lcm prune-tools` rewrites the live SDK JSONL with the same concurrent-append-safe machinery as compaction, instead of a plain read/write that could truncate events the SDK was appending mid-prune.
23
+
24
+ ### Other
25
+
26
+ - Raise minimum Node version to 22.12 (#139).
27
+ - Internal cleanup: extracted shared `fs-utils`, `jsonl`, and session-key helpers (#138).
28
+ - Bump `commander` 14.0.3 → 15.0.0 (#123).
29
+
30
+ ## 0.8.2 (2026-06-08)
31
+
32
+ ### Features
33
+
34
+ - **Continuity script hook.** `~/.tomo/config.json` can now include an optional `continuityScript` path or object. On each scheduled heartbeat or manual `tomo continuity` trigger, Tomo runs the script once, captures bounded stdout/stderr or failure status, and appends that result to the normal continuity prompt before sending it to the agent.
35
+ - **LCM global fresh tail (cross-day warm context)** (#131). New `config.lcm.globalFreshTail` (default `false` — today-only behavior unchanged when unset) makes the LCM fresh tail a session-global boundary instead of a per-day one. With it on, the newest N conversational turns stay warm across day boundaries, so a new day starts with warm raw context instead of cold-starting from summaries. Implemented without a `compactSession` API change: daily rollups simply stop their range before the warm suffix, and `findDuePromotions` defers promotion of raw inside the window (serving as both the no-re-nudge guard and the GC trigger). A new `isWarmTailCandidate` classifier counts real user/assistant turns while ignoring cron/heartbeat injections and tool machinery; retention is positional so interleaved events and the `parentUuid` chain are preserved.
36
+
3
37
  ## 0.8.1 (2026-06-07)
4
38
 
5
39
  ### Bug fixes
package/README.md CHANGED
@@ -31,7 +31,7 @@ That's it. Open Telegram and message your bot.
31
31
 
32
32
  ## Requirements
33
33
 
34
- - Node.js 22+
34
+ - Node.js 22.12+
35
35
  - [Claude Code](https://claude.com/claude-code) installed. Authenticate Claude Code for direct Claude models, or configure a LiteLLM gateway for non-Claude backends.
36
36
  - At least one channel:
37
37
  - **Telegram** — bot token from [@BotFather](https://t.me/BotFather)
@@ -225,6 +225,13 @@ Run `tomo config` for interactive setup, or edit `~/.tomo/config.json` directly:
225
225
  },
226
226
  "maxTurns": 50,
227
227
  "saveInboundImages": true,
228
+ "steering": false,
229
+ "continuity": true,
230
+ "continuityScript": {
231
+ "path": "~/bin/tomo-continuity.sh",
232
+ "timeoutMs": 30000,
233
+ "maxOutputChars": 8000
234
+ },
228
235
  "groupSecret": "tomo-xxxxxxxx",
229
236
  "lcm": {
230
237
  "nudgeAtPct": 70,
@@ -246,8 +253,18 @@ Environment variables override config file values:
246
253
  | `TOMO_LITELLM_MODE` | Optional LiteLLM mode: `anthropic-compatible` or `chatgpt-subscription` |
247
254
  | `TOMO_WORKSPACE` | Override workspace directory |
248
255
  | `TOMO_MAX_TURNS` | Override per-turn tool-use ceiling (default: `50`) |
256
+ | `TOMO_STEERING` | Set `true` to steer mid-turn messages into the in-flight turn (experimental, default: `false`) |
257
+ | `TOMO_CONTINUITY_SCRIPT` | Override the optional continuity script path |
258
+ | `TOMO_CONTINUITY_SCRIPT_TIMEOUT_MS` | Override continuity script timeout (default: `30000`) |
259
+ | `TOMO_CONTINUITY_SCRIPT_MAX_OUTPUT_CHARS` | Override continuity script stdout/stderr cap (default: `8000`) |
249
260
  | `LOG_LEVEL` | Log level (default: `debug`) |
250
261
 
262
+ `continuityScript` can also be a simple path string, e.g. `"continuityScript": "~/bin/tomo-continuity.sh"`. Relative paths resolve under `~/.tomo`; the script runs once per scheduled heartbeat and manual `tomo continuity` trigger, and its stdout/stderr or failure status is appended to the normal continuity prompt.
263
+
264
+ ### Steering (experimental)
265
+
266
+ By default, a message you send while Tomo is mid-task waits in a queue until the current turn finishes. With `"steering": true`, messages sent during a long tool-using turn are injected into it at the next tool-call boundary — so "stop", "wait", or extra context reaches the model immediately instead of after the task completes. If the turn has no tool calls left, the message runs as its own follow-up turn right after. iMessage fragment settling still applies before injection; system-originated turns (cron, continuity) keep their normal queued behavior. This relies on the Claude Agent SDK's mid-turn message queue and is off by default.
267
+
251
268
  ### LiteLLM / ChatGPT Subscription Models
252
269
 
253
270
  Tomo still runs through Claude Agent SDK, but you can point the SDK at a local LiteLLM proxy and select a LiteLLM model name such as `chatgpt/gpt-5.5`. This keeps Tomo's Claude SDK sessions, memory, workspace, MCP tools, and LCM behavior while LiteLLM translates Anthropic `/v1/messages` streaming calls to the ChatGPT subscription backend.
@@ -11,6 +11,11 @@ Before direct edits, copy `~/.tomo/config.json` to `~/.tomo/config.json.bak`. Ch
11
11
  "model": "claude-sonnet-4-6[1m]",
12
12
  "city": "Seattle",
13
13
  "continuity": false,
14
+ "continuityScript": {
15
+ "path": "~/bin/tomo-continuity.sh",
16
+ "timeoutMs": 30000,
17
+ "maxOutputChars": 8000
18
+ },
14
19
  "groupSecret": "tomo-a1b2c3d4",
15
20
  "channels": {
16
21
  "telegram": {
@@ -44,6 +49,7 @@ Before direct edits, copy `~/.tomo/config.json` to `~/.tomo/config.json.bak`. Ch
44
49
  "apiKey": "sk-tomo-local"
45
50
  },
46
51
  "maxTurns": 50,
52
+ "steering": false,
47
53
  "mcpServers": {
48
54
  "github-copilot": {
49
55
  "type": "http",
@@ -74,6 +80,7 @@ Before direct edits, copy `~/.tomo/config.json` to `~/.tomo/config.json.bak`. Ch
74
80
  | `model` | string | Claude model IDs/aliases, or a LiteLLM `provider/model` name such as `chatgpt/gpt-5.5`. Default model for every session. |
75
81
  | `city` | string \| null | Any city name (e.g. `"Seattle"`). Used for weather in continuity pings. `null` or missing = no weather. |
76
82
  | `continuity` | boolean | `true` / `false`. Enables periodic proactive heartbeats. Off by default. |
83
+ | `continuityScript` | string \| object \| null | Optional script run once per scheduled continuity heartbeat and manual `tomo continuity` trigger before the prompt is sent to Tomo. Use a string path (`"~/bin/tomo-continuity.sh"`) or `{ "path": "...", "timeoutMs": 30000, "maxOutputChars": 8000 }`. Relative paths resolve under `~/.tomo`; `~`, `$VAR`, and `${VAR}` expand. The script runs as the Tomo OS user with `TOMO_CONTINUITY=true`; stdout/stderr are appended to the heartbeat prompt and capped separately by `maxOutputChars`. Non-zero exits, missing files, and timeouts are passed to Tomo as script status instead of aborting the heartbeat. |
77
84
  | `groupSecret` | string \| null | Passphrase users send in a group chat to activate Tomo there. `null` disables group chats entirely. |
78
85
  | `channels.telegram.token` | string | BotFather token (`123456:...`). Required to enable the Telegram channel. |
79
86
  | `channels.telegram.allowlist` | string[] | Telegram user IDs (as strings) permitted to DM the bot. Identity-bound chatIds are auto-allowed even if missing here. |
@@ -90,6 +97,7 @@ Before direct edits, copy `~/.tomo/config.json` to `~/.tomo/config.json.bak`. Ch
90
97
  | `litellm.baseUrl` | string | Optional LiteLLM proxy base URL, e.g. `http://localhost:4000`. When set, Tomo still uses Claude Agent SDK but sends SDK model calls to the proxy via `ANTHROPIC_BASE_URL`. |
91
98
  | `litellm.apiKey` | string | LiteLLM proxy key sent as `ANTHROPIC_API_KEY`. This is the proxy key, not an Anthropic key. For ChatGPT subscription models, LiteLLM owns the OAuth device flow and token storage. |
92
99
  | `maxTurns` | number | Max agent turns per single user message (one turn ≈ one tool-use round). Default `50`. Raise if you see "max turns exceeded" on long tool chains. |
100
+ | `steering` | boolean | Experimental. Default `false`. When `true`, user messages that arrive while a turn is in flight bypass the per-session queue and are injected at the next tool-call boundary. If the current turn has no boundary left, the message runs as a follow-up turn. Cron, continuity, and other system-originated turns still queue normally. Also settable with `TOMO_STEERING=true`. |
93
101
  | `mcpServers` | object | External MCP servers keyed by server name. Supports stdio (`command`, `args`, `env`), HTTP (`type: "http"`, `url`, `headers`), and SSE (`type: "sse"`, `url`, `headers`). Environment variables like `${HOME}` expand in `url`, `headers`, `env`, and `args`. |
94
102
  | `mcpServers.<name>.oauth` | object | Optional harness-managed OAuth for HTTP/SSE MCP servers. Supports `authorizationServer` (optional; omitted = discover from the MCP server), `clientId` (optional if dynamic registration is available), `scopes`, `tokenStoreKey`, `redirectUri`, and `clientName`. Tokens are stored outside agent context in `workspace/secrets/mcp-oauth.json` (`0600`). |
95
103
  | `mcpAllowedTools` | string[] | Auto-allowed external MCP tools. If omitted, Tomo defaults to `mcp__<server>__*` for every configured external server. Set this to narrow tool access, e.g. `["mcp__github__list_issues"]`. |
@@ -126,5 +134,5 @@ Start it with `litellm --config ~/litellm-chatgpt.yaml`, then set Tomo's model t
126
134
  ## Requirements and overrides
127
135
 
128
136
  - **At least one channel must be configured** — either `channels.telegram.token` or `channels.imessage.url`. Startup fails otherwise.
129
- - **Env vars override file values** where they exist: `TELEGRAM_BOT_TOKEN`, `IMESSAGE_URL`, `IMESSAGE_PASSWORD`, `IMESSAGE_WEBHOOK_PORT`, `CLAUDE_MODEL`, `TOMO_LITELLM_BASE_URL`, `TOMO_LITELLM_API_KEY`, `TOMO_LITELLM_MODE`, `TOMO_CITY`, `TOMO_CONTINUITY`, `TOMO_WORKSPACE`, `SESSIONS_DIR`, `HISTORY_LIMIT`, `TOMO_MAX_TURNS`.
137
+ - **Env vars override file values** where they exist: `TELEGRAM_BOT_TOKEN`, `IMESSAGE_URL`, `IMESSAGE_PASSWORD`, `IMESSAGE_WEBHOOK_PORT`, `CLAUDE_MODEL`, `TOMO_LITELLM_BASE_URL`, `TOMO_LITELLM_API_KEY`, `TOMO_LITELLM_MODE`, `TOMO_CITY`, `TOMO_CONTINUITY`, `TOMO_WORKSPACE`, `SESSIONS_DIR`, `HISTORY_LIMIT`, `TOMO_MAX_TURNS`, `TOMO_STEERING`.
130
138
  - `workspaceDir`, `sessionsDir`, `historyLimit` are env-only — they're not read from the JSON file.
@@ -72,6 +72,9 @@ Before changing `~/.tomo/config.json` directly, copy the current file to `~/.tom
72
72
  ### Streaming
73
73
  Responses stream to Telegram in real-time — messages update every 1.5s as tokens arrive.
74
74
 
75
+ ### Message steering
76
+ If `steering: true` is set in `~/.tomo/config.json`, user messages that arrive during a long tool-using turn are injected into the in-flight turn at the next tool-call boundary instead of waiting behind it. Use this to treat mid-task corrections like "stop", "wait", or added context as immediately relevant. If there is no remaining tool boundary, the message runs as the next follow-up turn. Cron, continuity, and other system-originated turns still queue normally.
77
+
75
78
  ### MEDIA: tag
76
79
  To send an image/file to the user, include `MEDIA:/path/to/file.png` in your response. The harness strips it from text and sends the file. Text before/after becomes the caption.
77
80
 
@@ -15,6 +15,15 @@ export interface MessageRequest {
15
15
  resolve: (response: string) => void;
16
16
  reject: (err: Error) => void;
17
17
  }
18
+ /**
19
+ * Sentinel resolution for a steered message that merged into the in-flight
20
+ * turn: that turn's owner request receives (and delivers) the combined
21
+ * response, so the steered caller gets this empty marker instead. The empty
22
+ * string is safe as a sentinel only because send()/steer() can never
23
+ * legitimately resolve with "" — empty turns fall back to "I'm not sure how
24
+ * to respond to that." in the result handler.
25
+ */
26
+ export declare const STEER_MERGED = "";
18
27
  export interface QueryResult {
19
28
  costUsd: number;
20
29
  inputTokens: number;
@@ -30,8 +39,13 @@ export interface QueryResult {
30
39
  }
31
40
  export declare class LiveSession {
32
41
  private q;
33
- private pendingMessage;
42
+ private inputQueue;
43
+ private inputWaiter;
34
44
  private currentRequest;
45
+ private mergedRequests;
46
+ private pendingSteers;
47
+ private promotedSteerText;
48
+ private idleWaiters;
35
49
  private parts;
36
50
  private streamingText;
37
51
  private sessionId;
@@ -45,8 +59,41 @@ export declare class LiveSession {
45
59
  private activeStreamBlockTypes;
46
60
  constructor(options: ReturnType<typeof sdkOptions>, sessionKey?: string, turnBudget?: TurnBudget);
47
61
  private messageGenerator;
62
+ private pushInput;
48
63
  private consumeEvents;
64
+ /**
65
+ * Reject the in-flight turn's owner plus any merged/pending steered
66
+ * requests, clear turn state, and wake idle waiters. No-op when idle.
67
+ */
68
+ private failTurn;
69
+ /** Resolves when no turn is in flight (or the session dies). */
70
+ waitForIdle(): Promise<void>;
71
+ private notifyIdle;
72
+ /**
73
+ * True while a turn is in flight — including steered messages the CLI may
74
+ * still run as a follow-up turn after the current one resolves.
75
+ */
76
+ isBusy(): boolean;
49
77
  private handleEvent;
78
+ /**
79
+ * Observability-only path for subagent events (parent_tool_use_id set):
80
+ * log tool activity so subagent work shows up in the logs, but never touch
81
+ * turn state (parts/streamingText) or channel-facing callbacks.
82
+ */
83
+ private logSubagentEvent;
84
+ private logToolResults;
85
+ /**
86
+ * Steered-message bookkeeping from the CLI's replay events (requires the
87
+ * --replay-user-messages flag, passed via extraArgs when config.steering
88
+ * is on; non-replay user events never carry steered text verbatim, so
89
+ * matching is restricted to isReplay events to avoid false positives).
90
+ * Two shapes appear:
91
+ * - A pending steer's text echoed mid-turn → the CLI injected it into
92
+ * the in-flight turn at a tool boundary; fold it into this turn.
93
+ * - The promoted steer's own text echoed at its turn's start → the CLI
94
+ * batched the remaining queued steers into that promoted turn.
95
+ */
96
+ private matchSteerEchoes;
50
97
  private logContextUsage;
51
98
  send(text: string, onText?: (text: string) => void, images?: Array<{
52
99
  data: string;
@@ -56,6 +103,30 @@ export declare class LiveSession {
56
103
  mediaType: string;
57
104
  filename?: string;
58
105
  }>): Promise<string>;
106
+ /**
107
+ * Inject a message into the in-flight turn instead of waiting behind it
108
+ * (config `steering`). The CLI delivers it at the next tool-call boundary;
109
+ * if the turn has no boundary left, the CLI queues it and runs it as the
110
+ * next turn. Resolution:
111
+ * - merged into the in-flight turn → resolves with STEER_MERGED; the
112
+ * turn's owner request streams and resolves the combined response.
113
+ * - ran as its own follow-up turn → resolves with that turn's response,
114
+ * streamed through the callbacks passed here.
115
+ * Falls back to a plain send() when no turn is in flight.
116
+ */
117
+ steer(text: string, onText?: (text: string) => void, images?: Array<{
118
+ data: string;
119
+ mediaType: string;
120
+ }>, onBlockComplete?: (text: string) => void | Promise<void>, documents?: Array<{
121
+ data: string;
122
+ mediaType: string;
123
+ filename?: string;
124
+ }>): Promise<string>;
125
+ /**
126
+ * Timeout path for a steered request: detach it from whichever slot it
127
+ * occupies; if it owns the in-flight turn, fail the whole turn.
128
+ */
129
+ private dropRequest;
59
130
  getSessionId(): string | null;
60
131
  isAlive(): boolean;
61
132
  close(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"live-session.d.ts","sourceRoot":"","sources":["../../src/agent/live-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAmB,MAAM,gCAAgC,CAAC;AAEzG,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAErF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,cAAc,CAAC;IACxB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,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