@openacp/cli 2026.403.8 → 2026.404.2

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Attachment, O as OutgoingMessage, I as IChannelAdapter, N as NotificationMessage, a as AgentEvent, S as StopReason, P as PermissionRequest, U as UsageRecord, b as AgentCapabilities, c as AgentDefinition, M as McpServerConfig, d as SetConfigOptionValue, e as InstalledAgent, R as RegistryAgent, f as AgentListItem, g as AvailabilityResult, h as InstallProgress, i as InstallResult, j as SessionStatus, C as ConfigOption, k as AgentSwitchEntry, l as AgentCommand, m as SessionRecord, n as UsageRecordEvent, o as IncomingMessage, D as DisplayVerbosity, p as ChannelConfig, q as AdapterCapabilities, T as ToolCallMeta, V as ViewerLinks, r as OutputMode, s as PlanEntry } from './channel-BL33p1ZP.js';
2
- export { t as AgentDistribution, u as AuthMethod, v as AuthenticateRequest, w as ChannelAdapter, x as ConfigSelectChoice, y as ConfigSelectGroup, z as ContentBlock, K as KIND_ICONS, B as ModelInfo, E as NewSessionResponse, F as PermissionOption, G as PromptResponse, H as RegistryBinaryTarget, J as RegistryDistribution, L as STATUS_ICONS, Q as SessionListItem, W as SessionListResponse, X as SessionMode, Y as SessionModeState, Z as SessionModelState, _ as TelegramPlatformData, $ as ToolUpdateMeta } from './channel-BL33p1ZP.js';
1
+ import { A as Attachment, O as OutgoingMessage, I as IChannelAdapter, N as NotificationMessage, a as AgentEvent, S as StopReason, P as PermissionRequest, U as UsageRecord, b as AgentCapabilities, c as AgentDefinition, M as McpServerConfig, d as SetConfigOptionValue, e as InstalledAgent, R as RegistryAgent, f as AgentListItem, g as AvailabilityResult, h as InstallProgress, i as InstallResult, j as SessionStatus, T as TurnContext, C as ConfigOption, k as AgentSwitchEntry, l as AgentCommand, m as TurnRouting, n as SessionRecord, o as UsageRecordEvent, p as IncomingMessage, D as DisplayVerbosity, q as ChannelConfig, r as AdapterCapabilities, s as ToolCallMeta, V as ViewerLinks, t as OutputMode, u as PlanEntry } from './channel-DQWwxUKX.js';
2
+ export { v as AgentDistribution, w as AuthMethod, x as AuthenticateRequest, y as ChannelAdapter, z as ConfigSelectChoice, B as ConfigSelectGroup, E as ContentBlock, K as KIND_ICONS, F as ModelInfo, G as NewSessionResponse, H as PermissionOption, J as PromptResponse, L as RegistryBinaryTarget, Q as RegistryDistribution, W as STATUS_ICONS, X as SessionListItem, Y as SessionListResponse, Z as SessionMode, _ as SessionModeState, $ as SessionModelState, a0 as TelegramPlatformData, a1 as ToolUpdateMeta, a2 as createTurnContext, a3 as getEffectiveTarget, a4 as isSystemEvent } from './channel-DQWwxUKX.js';
3
3
  import pino from 'pino';
4
4
  import * as zod from 'zod';
5
5
  import { ZodSchema, z } from 'zod';
@@ -1424,11 +1424,14 @@ interface SessionEvents {
1424
1424
  named: (name: string) => void;
1425
1425
  error: (error: Error) => void;
1426
1426
  prompt_count_changed: (count: number) => void;
1427
+ turn_started: (ctx: TurnContext) => void;
1427
1428
  }
1428
1429
  declare class Session extends TypedEmitter<SessionEvents> {
1429
1430
  id: string;
1430
1431
  channelId: string;
1431
- threadId: string;
1432
+ /** @deprecated Use threadIds map directly. Getter returns primary adapter's threadId. */
1433
+ get threadId(): string;
1434
+ set threadId(value: string);
1432
1435
  agentName: string;
1433
1436
  workingDirectory: string;
1434
1437
  agentInstance: AgentInstance;
@@ -1451,6 +1454,12 @@ declare class Session extends TypedEmitter<SessionEvents> {
1451
1454
  middlewareChain?: MiddlewareChain;
1452
1455
  /** Latest commands emitted by the agent — buffered before bridge connects so they're not lost */
1453
1456
  latestCommands: AgentCommand[] | null;
1457
+ /** Adapters currently attached to this session (including primary) */
1458
+ attachedAdapters: string[];
1459
+ /** Per-adapter thread IDs: adapterId → threadId */
1460
+ threadIds: Map<string, string>;
1461
+ /** Active turn context — sealed on prompt dequeue, cleared on turn end */
1462
+ activeTurnContext: TurnContext | null;
1454
1463
  readonly permissionGate: PermissionGate;
1455
1464
  private readonly queue;
1456
1465
  private speechService?;
@@ -1464,6 +1473,10 @@ declare class Session extends TypedEmitter<SessionEvents> {
1464
1473
  speechService?: SpeechService;
1465
1474
  isAssistant?: boolean;
1466
1475
  });
1476
+ /** Wire a listener on the current agentInstance to buffer commands_update events.
1477
+ * Must be called after every agentInstance replacement (constructor + switchAgent). */
1478
+ private commandsBufferCleanup?;
1479
+ private wireCommandsBuffer;
1467
1480
  get status(): SessionStatus;
1468
1481
  /** Transition to active — from initializing, error, or cancelled */
1469
1482
  activate(): void;
@@ -1479,7 +1492,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
1479
1492
  get promptRunning(): boolean;
1480
1493
  setContext(markdown: string): void;
1481
1494
  setVoiceMode(mode: "off" | "next" | "on"): void;
1482
- enqueuePrompt(text: string, attachments?: Attachment[]): Promise<void>;
1495
+ enqueuePrompt(text: string, attachments?: Attachment[], routing?: TurnRouting, externalTurnId?: string): Promise<string>;
1483
1496
  private processPrompt;
1484
1497
  private maybeTranscribeAudio;
1485
1498
  private processTTSResponse;
@@ -1525,8 +1538,8 @@ declare class PromptQueue {
1525
1538
  private queue;
1526
1539
  private processing;
1527
1540
  private abortController;
1528
- constructor(processor: (text: string, attachments?: Attachment[]) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
1529
- enqueue(text: string, attachments?: Attachment[]): Promise<void>;
1541
+ constructor(processor: (text: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
1542
+ enqueue(text: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string): Promise<void>;
1530
1543
  private process;
1531
1544
  private drainNext;
1532
1545
  clear(): void;
@@ -1590,6 +1603,8 @@ interface EventBusEvents {
1590
1603
  sessionId: string;
1591
1604
  requestId: string;
1592
1605
  decision: string;
1606
+ optionId?: string;
1607
+ resolvedBy?: string;
1593
1608
  }) => void;
1594
1609
  "kernel:booted": () => void;
1595
1610
  "system:ready": () => void;
@@ -1637,6 +1652,21 @@ interface EventBusEvents {
1637
1652
  "session:configChanged": (data: {
1638
1653
  sessionId: string;
1639
1654
  }) => void;
1655
+ "message:queued": (data: {
1656
+ sessionId: string;
1657
+ turnId: string;
1658
+ text: string;
1659
+ sourceAdapterId: string;
1660
+ attachments?: unknown[];
1661
+ timestamp: string;
1662
+ queueDepth: number;
1663
+ }) => void;
1664
+ "message:processing": (data: {
1665
+ sessionId: string;
1666
+ turnId: string;
1667
+ sourceAdapterId: string;
1668
+ timestamp: string;
1669
+ }) => void;
1640
1670
  "session:agentSwitch": (data: {
1641
1671
  sessionId: string;
1642
1672
  fromAgent: string;
@@ -1649,6 +1679,22 @@ interface EventBusEvents {
1649
1679
  declare class EventBus extends TypedEmitter<EventBusEvents> {
1650
1680
  }
1651
1681
 
1682
+ interface SessionSummary {
1683
+ id: string;
1684
+ agent: string;
1685
+ status: SessionStatus;
1686
+ name: string | null;
1687
+ workspace: string;
1688
+ channelId: string;
1689
+ createdAt: string;
1690
+ lastActiveAt: string | null;
1691
+ dangerousMode: boolean;
1692
+ queueDepth: number;
1693
+ promptRunning: boolean;
1694
+ configOptions?: ConfigOption[];
1695
+ capabilities: AgentCapabilities | null;
1696
+ isLive: boolean;
1697
+ }
1652
1698
  declare class SessionManager {
1653
1699
  private sessions;
1654
1700
  private store;
@@ -1669,6 +1715,7 @@ declare class SessionManager {
1669
1715
  getSessionRecord(sessionId: string): SessionRecord | undefined;
1670
1716
  cancelSession(sessionId: string): Promise<void>;
1671
1717
  listSessions(channelId?: string): Session[];
1718
+ listAllSessions(channelId?: string): SessionSummary[];
1672
1719
  listRecords(filter?: {
1673
1720
  statuses?: string[];
1674
1721
  }): SessionRecord[];
@@ -1681,6 +1728,8 @@ declare class SessionManager {
1681
1728
  /**
1682
1729
  * Forcefully destroy all sessions (kill agent subprocesses).
1683
1730
  * Use only when sessions must be fully torn down (e.g. archive).
1731
+ * Unlike shutdownAll(), this does NOT snapshot live session state (acpState, etc.)
1732
+ * because destroyed sessions are terminal and will not be resumed.
1684
1733
  */
1685
1734
  destroyAll(): Promise<void>;
1686
1735
  }
@@ -1706,12 +1755,15 @@ declare class SessionBridge {
1706
1755
  private deps;
1707
1756
  private connected;
1708
1757
  private cleanupFns;
1709
- constructor(session: Session, adapter: IChannelAdapter, deps: BridgeDeps);
1758
+ readonly adapterId: string;
1759
+ constructor(session: Session, adapter: IChannelAdapter, deps: BridgeDeps, adapterId?: string);
1710
1760
  private get tracer();
1711
1761
  /** Register a listener and track it for cleanup */
1712
1762
  private listen;
1713
1763
  /** Send message to adapter, optionally running through message:outgoing middleware */
1714
1764
  private sendMessage;
1765
+ /** Determine if this bridge should forward the given event based on turn routing. */
1766
+ shouldForward(event: AgentEvent): boolean;
1715
1767
  connect(): void;
1716
1768
  disconnect(): void;
1717
1769
  /** Dispatch an agent event through middleware and to the adapter */
@@ -2014,6 +2066,7 @@ declare class SessionFactory {
2014
2066
  * Used by adapter command handlers and handleMessage().
2015
2067
  */
2016
2068
  getOrResume(channelId: string, threadId: string): Promise<Session | null>;
2069
+ getOrResumeById(sessionId: string): Promise<Session | null>;
2017
2070
  private lazyResume;
2018
2071
  handleNewSession(channelId: string, agentName?: string, workspacePath?: string, options?: {
2019
2072
  createThread?: boolean;
@@ -2224,7 +2277,7 @@ declare class OpenACPCore {
2224
2277
  sessionManager: SessionManager;
2225
2278
  messageTransformer: MessageTransformer;
2226
2279
  adapters: Map<string, IChannelAdapter>;
2227
- /** sessionId → SessionBridge — tracks active bridges for disconnect/reconnect during agent switch */
2280
+ /** "adapterId:sessionId" → SessionBridge — tracks active bridges for disconnect/reconnect */
2228
2281
  private bridges;
2229
2282
  /** Set by main.ts — triggers graceful shutdown with restart exit code */
2230
2283
  requestRestart: (() => Promise<void>) | null;
@@ -2299,11 +2352,21 @@ declare class OpenACPCore {
2299
2352
  resumed: boolean;
2300
2353
  }>;
2301
2354
  getOrResumeSession(channelId: string, threadId: string): Promise<Session | null>;
2355
+ getOrResumeSessionById(sessionId: string): Promise<Session | null>;
2356
+ attachAdapter(sessionId: string, adapterId: string): Promise<{
2357
+ threadId: string;
2358
+ }>;
2359
+ detachAdapter(sessionId: string, adapterId: string): Promise<void>;
2360
+ private buildPlatformsFromSession;
2361
+ /** Composite bridge key: "adapterId:sessionId" */
2362
+ private bridgeKey;
2363
+ /** Get all bridge keys for a session (regardless of adapter) */
2364
+ private getSessionBridgeKeys;
2302
2365
  /** Connect a session bridge for the given session (used by AssistantManager) */
2303
2366
  connectSessionBridge(session: Session): void;
2304
2367
  /** Create a SessionBridge for the given session and adapter.
2305
- * Disconnects any existing bridge for the same session first. */
2306
- createBridge(session: Session, adapter: IChannelAdapter): SessionBridge;
2368
+ * Disconnects any existing bridge for the same adapter+session first. */
2369
+ createBridge(session: Session, adapter: IChannelAdapter, adapterId?: string): SessionBridge;
2307
2370
  }
2308
2371
 
2309
2372
  interface RegisteredCommand extends CommandDef {
@@ -3141,4 +3204,4 @@ declare class TelegramAdapter extends MessagingAdapter {
3141
3204
  archiveSessionTopic(sessionId: string): Promise<void>;
3142
3205
  }
3143
3206
 
3144
- export { ActivityTracker, AdapterCapabilities, AgentCapabilities, AgentCatalog, AgentCommand, AgentDefinition, AgentEvent, AgentInstance, AgentListItem, AgentManager, AgentStore, AgentSwitchEntry, type ApiConfig, type ApiServerInstance, type ApiServerOptions, type ApiServerService, type AssistantCommand, AssistantManager, AssistantRegistry, type AssistantSection, Attachment, AvailabilityResult, BaseRenderer, type BridgeDeps, CONFIG_REGISTRY, ChannelConfig, type CleanupResult, type CommandArgs, type CommandDef, CommandRegistry, type CommandResponse, type Config, type ConfigFieldDef, ConfigManager, ConfigOption, ContextManager, type ContextOptions, type ContextProvider, type ContextQuery, type ContextResult, type ContextService, type SessionInfo as ContextSessionInfo, type DeleteTopicResult, DisplaySpecBuilder, DisplayVerbosity, DoctorEngine, type DoctorReport, DraftManager, EntireProvider, EventBus, type EventBusEvents, FileService, type FileServiceInterface, GroqSTT, IChannelAdapter, type IRenderer, IncomingMessage, type InstallContext, InstallProgress, InstallResult, InstalledAgent, type ListItem, type Logger, type LoggingConfig, McpServerConfig, type MenuItem, type MenuOption, MenuRegistry, MessageTransformer, MessagingAdapter, type MessagingAdapterConfig, type MigrateContext, NotificationManager, NotificationMessage, type NotificationService, OpenACPCore, type OpenACPPlugin, OutgoingMessage, OutputMode, OutputModeResolver, PRODUCT_GUIDE, type PendingFix, PermissionGate, PermissionRequest, PlanEntry, type PluginContext, type PluginPermission, type PluginStorage, PromptQueue, RegistryAgent, type RenderedMessage, SSEManager, type STTOptions, type STTProvider, type STTResult, SecurityGuard, type SecurityService, SendQueue, Session, SessionBridge, type SessionCreateParams, type SessionEvents, SessionFactory, type SessionListResult, SessionManager, SessionRecord, SessionStatus, SetConfigOptionValue, type SettingsAPI, type SideEffectDeps, type SpeechProviderConfig, SpeechService, type SpeechServiceConfig, type SpeechServiceInterface, StaticServer, StderrCapture, StopReason, StreamAdapter, type TTSOptions, type TTSProvider, type TTSResult, TelegramAdapter, type TerminalIO, ThoughtBuffer, type ThoughtDisplaySpec, ToolCallMeta, ToolCallTracker, type ToolCardSnapshot, ToolCardState, type ToolCardStateConfig, type ToolDisplaySpec, type ToolEntry, ToolStateMap, type TopicInfo, TopicManager, type TunnelServiceInterface, TypedEmitter, type UsageConfig, UsageRecord, UsageRecordEvent, type UsageService, ViewerLinks, cleanupOldSessionLogs, createApiServer, createApiServerService, createChildLogger, createSessionLogger, expandHome, extractContentText, formatTokens, formatToolSummary, formatToolTitle, getConfigValue, getFieldDef, getPidPath, getSafeFields, getStatus, initLogger, installAutoStart, isAutoStartInstalled, isAutoStartSupported, isHotReloadable, log, nodeToWebReadable, nodeToWebWritable, progressBar, resolveOptions, resolveToolIcon, runConfigEditor, setLogLevel, shutdownLogger, splitMessage, startDaemon, stopDaemon, stripCodeFences, truncateContent, uninstallAutoStart };
3207
+ export { ActivityTracker, AdapterCapabilities, AgentCapabilities, AgentCatalog, AgentCommand, AgentDefinition, AgentEvent, AgentInstance, AgentListItem, AgentManager, AgentStore, AgentSwitchEntry, type ApiConfig, type ApiServerInstance, type ApiServerOptions, type ApiServerService, type AssistantCommand, AssistantManager, AssistantRegistry, type AssistantSection, Attachment, AvailabilityResult, BaseRenderer, type BridgeDeps, CONFIG_REGISTRY, ChannelConfig, type CleanupResult, type CommandArgs, type CommandDef, CommandRegistry, type CommandResponse, type Config, type ConfigFieldDef, ConfigManager, ConfigOption, ContextManager, type ContextOptions, type ContextProvider, type ContextQuery, type ContextResult, type ContextService, type SessionInfo as ContextSessionInfo, type DeleteTopicResult, DisplaySpecBuilder, DisplayVerbosity, DoctorEngine, type DoctorReport, DraftManager, EntireProvider, EventBus, type EventBusEvents, FileService, type FileServiceInterface, GroqSTT, IChannelAdapter, type IRenderer, IncomingMessage, type InstallContext, InstallProgress, InstallResult, InstalledAgent, type ListItem, type Logger, type LoggingConfig, McpServerConfig, type MenuItem, type MenuOption, MenuRegistry, MessageTransformer, MessagingAdapter, type MessagingAdapterConfig, type MigrateContext, NotificationManager, NotificationMessage, type NotificationService, OpenACPCore, type OpenACPPlugin, OutgoingMessage, OutputMode, OutputModeResolver, PRODUCT_GUIDE, type PendingFix, PermissionGate, PermissionRequest, PlanEntry, type PluginContext, type PluginPermission, type PluginStorage, PromptQueue, RegistryAgent, type RenderedMessage, SSEManager, type STTOptions, type STTProvider, type STTResult, SecurityGuard, type SecurityService, SendQueue, Session, SessionBridge, type SessionCreateParams, type SessionEvents, SessionFactory, type SessionListResult, SessionManager, SessionRecord, SessionStatus, type SessionSummary, SetConfigOptionValue, type SettingsAPI, type SideEffectDeps, type SpeechProviderConfig, SpeechService, type SpeechServiceConfig, type SpeechServiceInterface, StaticServer, StderrCapture, StopReason, StreamAdapter, type TTSOptions, type TTSProvider, type TTSResult, TelegramAdapter, type TerminalIO, ThoughtBuffer, type ThoughtDisplaySpec, ToolCallMeta, ToolCallTracker, type ToolCardSnapshot, ToolCardState, type ToolCardStateConfig, type ToolDisplaySpec, type ToolEntry, ToolStateMap, type TopicInfo, TopicManager, type TunnelServiceInterface, TurnContext, TurnRouting, TypedEmitter, type UsageConfig, UsageRecord, UsageRecordEvent, type UsageService, ViewerLinks, cleanupOldSessionLogs, createApiServer, createApiServerService, createChildLogger, createSessionLogger, expandHome, extractContentText, formatTokens, formatToolSummary, formatToolTitle, getConfigValue, getFieldDef, getPidPath, getSafeFields, getStatus, initLogger, installAutoStart, isAutoStartInstalled, isAutoStartSupported, isHotReloadable, log, nodeToWebReadable, nodeToWebWritable, progressBar, resolveOptions, resolveToolIcon, runConfigEditor, setLogLevel, shutdownLogger, splitMessage, startDaemon, stopDaemon, stripCodeFences, truncateContent, uninstallAutoStart };