@openacp/cli 2026.403.7 → 2026.404.1

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, C as ConfigOption, k as AgentSwitchEntry, l as AgentCommand, T as TurnContext, 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-CmTWKnpK.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-CmTWKnpK.js';
3
3
  import pino from 'pino';
4
4
  import * as zod from 'zod';
5
5
  import { ZodSchema, z } from 'zod';
@@ -1428,7 +1428,9 @@ interface SessionEvents {
1428
1428
  declare class Session extends TypedEmitter<SessionEvents> {
1429
1429
  id: string;
1430
1430
  channelId: string;
1431
- threadId: string;
1431
+ /** @deprecated Use threadIds map directly. Getter returns primary adapter's threadId. */
1432
+ get threadId(): string;
1433
+ set threadId(value: string);
1432
1434
  agentName: string;
1433
1435
  workingDirectory: string;
1434
1436
  agentInstance: AgentInstance;
@@ -1451,6 +1453,12 @@ declare class Session extends TypedEmitter<SessionEvents> {
1451
1453
  middlewareChain?: MiddlewareChain;
1452
1454
  /** Latest commands emitted by the agent — buffered before bridge connects so they're not lost */
1453
1455
  latestCommands: AgentCommand[] | null;
1456
+ /** Adapters currently attached to this session (including primary) */
1457
+ attachedAdapters: string[];
1458
+ /** Per-adapter thread IDs: adapterId → threadId */
1459
+ threadIds: Map<string, string>;
1460
+ /** Active turn context — sealed on prompt dequeue, cleared on turn end */
1461
+ activeTurnContext: TurnContext | null;
1454
1462
  readonly permissionGate: PermissionGate;
1455
1463
  private readonly queue;
1456
1464
  private speechService?;
@@ -1464,6 +1472,10 @@ declare class Session extends TypedEmitter<SessionEvents> {
1464
1472
  speechService?: SpeechService;
1465
1473
  isAssistant?: boolean;
1466
1474
  });
1475
+ /** Wire a listener on the current agentInstance to buffer commands_update events.
1476
+ * Must be called after every agentInstance replacement (constructor + switchAgent). */
1477
+ private commandsBufferCleanup?;
1478
+ private wireCommandsBuffer;
1467
1479
  get status(): SessionStatus;
1468
1480
  /** Transition to active — from initializing, error, or cancelled */
1469
1481
  activate(): void;
@@ -1479,13 +1491,22 @@ declare class Session extends TypedEmitter<SessionEvents> {
1479
1491
  get promptRunning(): boolean;
1480
1492
  setContext(markdown: string): void;
1481
1493
  setVoiceMode(mode: "off" | "next" | "on"): void;
1482
- enqueuePrompt(text: string, attachments?: Attachment[]): Promise<void>;
1494
+ enqueuePrompt(text: string, attachments?: Attachment[], routing?: TurnRouting): Promise<void>;
1483
1495
  private processPrompt;
1484
1496
  private maybeTranscribeAudio;
1485
1497
  private processTTSResponse;
1486
1498
  private autoName;
1487
1499
  setInitialConfigOptions(options: ConfigOption[]): void;
1488
1500
  setAgentCapabilities(caps: AgentCapabilities | undefined): void;
1501
+ /**
1502
+ * Hydrate configOptions and agentCapabilities from a spawn response.
1503
+ * Handles both the native configOptions format and legacy modes/models fields.
1504
+ */
1505
+ applySpawnResponse(resp: {
1506
+ modes?: unknown;
1507
+ configOptions?: unknown;
1508
+ models?: unknown;
1509
+ } | undefined, caps: AgentCapabilities | undefined): void;
1489
1510
  getConfigOption(id: string): ConfigOption | undefined;
1490
1511
  getConfigByCategory(category: string): ConfigOption | undefined;
1491
1512
  getConfigValue(id: string): string | undefined;
@@ -1516,8 +1537,8 @@ declare class PromptQueue {
1516
1537
  private queue;
1517
1538
  private processing;
1518
1539
  private abortController;
1519
- constructor(processor: (text: string, attachments?: Attachment[]) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
1520
- enqueue(text: string, attachments?: Attachment[]): Promise<void>;
1540
+ constructor(processor: (text: string, attachments?: Attachment[], routing?: TurnRouting) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
1541
+ enqueue(text: string, attachments?: Attachment[], routing?: TurnRouting): Promise<void>;
1521
1542
  private process;
1522
1543
  private drainNext;
1523
1544
  clear(): void;
@@ -1581,6 +1602,8 @@ interface EventBusEvents {
1581
1602
  sessionId: string;
1582
1603
  requestId: string;
1583
1604
  decision: string;
1605
+ optionId?: string;
1606
+ resolvedBy?: string;
1584
1607
  }) => void;
1585
1608
  "kernel:booted": () => void;
1586
1609
  "system:ready": () => void;
@@ -1640,6 +1663,22 @@ interface EventBusEvents {
1640
1663
  declare class EventBus extends TypedEmitter<EventBusEvents> {
1641
1664
  }
1642
1665
 
1666
+ interface SessionSummary {
1667
+ id: string;
1668
+ agent: string;
1669
+ status: SessionStatus;
1670
+ name: string | null;
1671
+ workspace: string;
1672
+ channelId: string;
1673
+ createdAt: string;
1674
+ lastActiveAt: string | null;
1675
+ dangerousMode: boolean;
1676
+ queueDepth: number;
1677
+ promptRunning: boolean;
1678
+ configOptions?: ConfigOption[];
1679
+ capabilities: AgentCapabilities | null;
1680
+ isLive: boolean;
1681
+ }
1643
1682
  declare class SessionManager {
1644
1683
  private sessions;
1645
1684
  private store;
@@ -1660,6 +1699,7 @@ declare class SessionManager {
1660
1699
  getSessionRecord(sessionId: string): SessionRecord | undefined;
1661
1700
  cancelSession(sessionId: string): Promise<void>;
1662
1701
  listSessions(channelId?: string): Session[];
1702
+ listAllSessions(channelId?: string): SessionSummary[];
1663
1703
  listRecords(filter?: {
1664
1704
  statuses?: string[];
1665
1705
  }): SessionRecord[];
@@ -1672,6 +1712,8 @@ declare class SessionManager {
1672
1712
  /**
1673
1713
  * Forcefully destroy all sessions (kill agent subprocesses).
1674
1714
  * Use only when sessions must be fully torn down (e.g. archive).
1715
+ * Unlike shutdownAll(), this does NOT snapshot live session state (acpState, etc.)
1716
+ * because destroyed sessions are terminal and will not be resumed.
1675
1717
  */
1676
1718
  destroyAll(): Promise<void>;
1677
1719
  }
@@ -1697,12 +1739,15 @@ declare class SessionBridge {
1697
1739
  private deps;
1698
1740
  private connected;
1699
1741
  private cleanupFns;
1700
- constructor(session: Session, adapter: IChannelAdapter, deps: BridgeDeps);
1742
+ readonly adapterId: string;
1743
+ constructor(session: Session, adapter: IChannelAdapter, deps: BridgeDeps, adapterId?: string);
1701
1744
  private get tracer();
1702
1745
  /** Register a listener and track it for cleanup */
1703
1746
  private listen;
1704
1747
  /** Send message to adapter, optionally running through message:outgoing middleware */
1705
1748
  private sendMessage;
1749
+ /** Determine if this bridge should forward the given event based on turn routing. */
1750
+ shouldForward(event: AgentEvent): boolean;
1706
1751
  connect(): void;
1707
1752
  disconnect(): void;
1708
1753
  /** Dispatch an agent event through middleware and to the adapter */
@@ -2005,6 +2050,7 @@ declare class SessionFactory {
2005
2050
  * Used by adapter command handlers and handleMessage().
2006
2051
  */
2007
2052
  getOrResume(channelId: string, threadId: string): Promise<Session | null>;
2053
+ getOrResumeById(sessionId: string): Promise<Session | null>;
2008
2054
  private lazyResume;
2009
2055
  handleNewSession(channelId: string, agentName?: string, workspacePath?: string, options?: {
2010
2056
  createThread?: boolean;
@@ -2215,7 +2261,7 @@ declare class OpenACPCore {
2215
2261
  sessionManager: SessionManager;
2216
2262
  messageTransformer: MessageTransformer;
2217
2263
  adapters: Map<string, IChannelAdapter>;
2218
- /** sessionId → SessionBridge — tracks active bridges for disconnect/reconnect during agent switch */
2264
+ /** "adapterId:sessionId" → SessionBridge — tracks active bridges for disconnect/reconnect */
2219
2265
  private bridges;
2220
2266
  /** Set by main.ts — triggers graceful shutdown with restart exit code */
2221
2267
  requestRestart: (() => Promise<void>) | null;
@@ -2290,11 +2336,21 @@ declare class OpenACPCore {
2290
2336
  resumed: boolean;
2291
2337
  }>;
2292
2338
  getOrResumeSession(channelId: string, threadId: string): Promise<Session | null>;
2339
+ getOrResumeSessionById(sessionId: string): Promise<Session | null>;
2340
+ attachAdapter(sessionId: string, adapterId: string): Promise<{
2341
+ threadId: string;
2342
+ }>;
2343
+ detachAdapter(sessionId: string, adapterId: string): Promise<void>;
2344
+ private buildPlatformsFromSession;
2345
+ /** Composite bridge key: "adapterId:sessionId" */
2346
+ private bridgeKey;
2347
+ /** Get all bridge keys for a session (regardless of adapter) */
2348
+ private getSessionBridgeKeys;
2293
2349
  /** Connect a session bridge for the given session (used by AssistantManager) */
2294
2350
  connectSessionBridge(session: Session): void;
2295
2351
  /** Create a SessionBridge for the given session and adapter.
2296
- * Disconnects any existing bridge for the same session first. */
2297
- createBridge(session: Session, adapter: IChannelAdapter): SessionBridge;
2352
+ * Disconnects any existing bridge for the same adapter+session first. */
2353
+ createBridge(session: Session, adapter: IChannelAdapter, adapterId?: string): SessionBridge;
2298
2354
  }
2299
2355
 
2300
2356
  interface RegisteredCommand extends CommandDef {
@@ -3132,4 +3188,4 @@ declare class TelegramAdapter extends MessagingAdapter {
3132
3188
  archiveSessionTopic(sessionId: string): Promise<void>;
3133
3189
  }
3134
3190
 
3135
- 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 };
3191
+ 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 };