@openacp/cli 2026.401.7 → 2026.402.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 AgentEvent, a as AgentCapabilities, P as PermissionRequest, b as AgentDefinition, M as McpServerConfig, S as SetConfigOptionValue, c as Attachment, I as InstalledAgent, R as RegistryAgent, d as AgentListItem, e as AvailabilityResult, f as InstallProgress, g as InstallResult, h as SessionStatus, C as ConfigOption, i as AgentSwitchEntry, j as SessionRecord, O as OutgoingMessage, k as IChannelAdapter, N as NotificationMessage, l as StopReason, U as UsageRecord, m as UsageRecordEvent, n as IncomingMessage, D as DisplayVerbosity, o as ChannelConfig, p as AdapterCapabilities, T as ToolCallMeta, V as ViewerLinks, q as OutputMode, r as PlanEntry, s as AgentCommand } from './channel-BOcUuhjt.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-BOcUuhjt.js';
1
+ import { A as AgentEvent, a as AgentCapabilities, P as PermissionRequest, b as AgentDefinition, M as McpServerConfig, S as SetConfigOptionValue, c as Attachment, I as InstalledAgent, R as RegistryAgent, d as AgentListItem, e as AvailabilityResult, f as InstallProgress, g as InstallResult, h as SessionStatus, C as ConfigOption, i as AgentSwitchEntry, j as AgentCommand, k as SessionRecord, O as OutgoingMessage, l as IChannelAdapter, N as NotificationMessage, m as StopReason, U as UsageRecord, 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-DzDoNxa7.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-DzDoNxa7.js';
3
3
  import pino from 'pino';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodSchema } from 'zod';
@@ -46,8 +46,8 @@ declare const TunnelSchema: z.ZodDefault<z.ZodObject<{
46
46
  token?: string | undefined;
47
47
  }>>;
48
48
  }, "strip", z.ZodTypeAny, {
49
- enabled: boolean;
50
49
  options: Record<string, unknown>;
50
+ enabled: boolean;
51
51
  port: number;
52
52
  provider: "cloudflare" | "ngrok" | "bore" | "tailscale";
53
53
  maxUserTunnels: number;
@@ -57,8 +57,8 @@ declare const TunnelSchema: z.ZodDefault<z.ZodObject<{
57
57
  token?: string | undefined;
58
58
  };
59
59
  }, {
60
- enabled?: boolean | undefined;
61
60
  options?: Record<string, unknown> | undefined;
61
+ enabled?: boolean | undefined;
62
62
  port?: number | undefined;
63
63
  provider?: "cloudflare" | "ngrok" | "bore" | "tailscale" | undefined;
64
64
  maxUserTunnels?: number | undefined;
@@ -91,7 +91,7 @@ declare const UsageSchema: z.ZodDefault<z.ZodObject<{
91
91
  type UsageConfig = z.infer<typeof UsageSchema>;
92
92
  declare const ConfigSchema: z.ZodObject<{
93
93
  instanceName: z.ZodOptional<z.ZodString>;
94
- channels: z.ZodObject<{}, "strip", z.ZodObject<{
94
+ channels: z.ZodDefault<z.ZodObject<{}, "strip", z.ZodObject<{
95
95
  enabled: z.ZodDefault<z.ZodBoolean>;
96
96
  adapter: z.ZodOptional<z.ZodString>;
97
97
  displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
@@ -136,7 +136,7 @@ declare const ConfigSchema: z.ZodObject<{
136
136
  adapter: z.ZodOptional<z.ZodString>;
137
137
  displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
138
138
  outputMode: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
139
- }, z.ZodTypeAny, "passthrough">>, "strip">>;
139
+ }, z.ZodTypeAny, "passthrough">>, "strip">>>;
140
140
  agents: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
141
141
  command: z.ZodString;
142
142
  args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -230,8 +230,8 @@ declare const ConfigSchema: z.ZodObject<{
230
230
  token?: string | undefined;
231
231
  }>>;
232
232
  }, "strip", z.ZodTypeAny, {
233
- enabled: boolean;
234
233
  options: Record<string, unknown>;
234
+ enabled: boolean;
235
235
  port: number;
236
236
  provider: "cloudflare" | "ngrok" | "bore" | "tailscale";
237
237
  maxUserTunnels: number;
@@ -241,8 +241,8 @@ declare const ConfigSchema: z.ZodObject<{
241
241
  token?: string | undefined;
242
242
  };
243
243
  }, {
244
- enabled?: boolean | undefined;
245
244
  options?: Record<string, unknown> | undefined;
245
+ enabled?: boolean | undefined;
246
246
  port?: number | undefined;
247
247
  provider?: "cloudflare" | "ngrok" | "bore" | "tailscale" | undefined;
248
248
  maxUserTunnels?: number | undefined;
@@ -383,8 +383,8 @@ declare const ConfigSchema: z.ZodObject<{
383
383
  workingDirectory?: string | undefined;
384
384
  }>;
385
385
  tunnel: {
386
- enabled: boolean;
387
386
  options: Record<string, unknown>;
387
+ enabled: boolean;
388
388
  port: number;
389
389
  provider: "cloudflare" | "ngrok" | "bore" | "tailscale";
390
390
  maxUserTunnels: number;
@@ -394,13 +394,6 @@ declare const ConfigSchema: z.ZodObject<{
394
394
  token?: string | undefined;
395
395
  };
396
396
  };
397
- usage: {
398
- enabled: boolean;
399
- warningThreshold: number;
400
- currency: string;
401
- retentionDays: number;
402
- monthlyBudget?: number | undefined;
403
- };
404
397
  channels: {} & {
405
398
  [k: string]: z.objectOutputType<{
406
399
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -430,6 +423,13 @@ declare const ConfigSchema: z.ZodObject<{
430
423
  sessionStore: {
431
424
  ttlDays: number;
432
425
  };
426
+ usage: {
427
+ enabled: boolean;
428
+ warningThreshold: number;
429
+ currency: string;
430
+ retentionDays: number;
431
+ monthlyBudget?: number | undefined;
432
+ };
433
433
  integrations: Record<string, {
434
434
  installed: boolean;
435
435
  installedAt?: string | undefined;
@@ -456,14 +456,6 @@ declare const ConfigSchema: z.ZodObject<{
456
456
  instanceName?: string | undefined;
457
457
  outputMode?: "low" | "medium" | "high" | undefined;
458
458
  }, {
459
- channels: {} & {
460
- [k: string]: z.objectInputType<{
461
- enabled: z.ZodDefault<z.ZodBoolean>;
462
- adapter: z.ZodOptional<z.ZodString>;
463
- displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
464
- outputMode: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
465
- }, z.ZodTypeAny, "passthrough">;
466
- };
467
459
  defaultAgent: string;
468
460
  api?: {
469
461
  port?: number | undefined;
@@ -476,8 +468,8 @@ declare const ConfigSchema: z.ZodObject<{
476
468
  workingDirectory?: string | undefined;
477
469
  }> | undefined;
478
470
  tunnel?: {
479
- enabled?: boolean | undefined;
480
471
  options?: Record<string, unknown> | undefined;
472
+ enabled?: boolean | undefined;
481
473
  port?: number | undefined;
482
474
  provider?: "cloudflare" | "ngrok" | "bore" | "tailscale" | undefined;
483
475
  maxUserTunnels?: number | undefined;
@@ -487,14 +479,23 @@ declare const ConfigSchema: z.ZodObject<{
487
479
  token?: string | undefined;
488
480
  } | undefined;
489
481
  } | undefined;
490
- usage?: {
491
- enabled?: boolean | undefined;
492
- monthlyBudget?: number | undefined;
493
- warningThreshold?: number | undefined;
494
- currency?: string | undefined;
495
- retentionDays?: number | undefined;
496
- } | undefined;
497
482
  instanceName?: string | undefined;
483
+ channels?: z.objectInputType<{}, z.ZodObject<{
484
+ enabled: z.ZodDefault<z.ZodBoolean>;
485
+ adapter: z.ZodOptional<z.ZodString>;
486
+ displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
487
+ outputMode: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
488
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
489
+ enabled: z.ZodDefault<z.ZodBoolean>;
490
+ adapter: z.ZodOptional<z.ZodString>;
491
+ displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
492
+ outputMode: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
493
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
494
+ enabled: z.ZodDefault<z.ZodBoolean>;
495
+ adapter: z.ZodOptional<z.ZodString>;
496
+ displayVerbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
497
+ outputMode: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
498
+ }, z.ZodTypeAny, "passthrough">>, "strip"> | undefined;
498
499
  outputMode?: "low" | "medium" | "high" | undefined;
499
500
  workspace?: {
500
501
  baseDir?: string | undefined;
@@ -516,6 +517,13 @@ declare const ConfigSchema: z.ZodObject<{
516
517
  sessionStore?: {
517
518
  ttlDays?: number | undefined;
518
519
  } | undefined;
520
+ usage?: {
521
+ enabled?: boolean | undefined;
522
+ monthlyBudget?: number | undefined;
523
+ warningThreshold?: number | undefined;
524
+ currency?: string | undefined;
525
+ retentionDays?: number | undefined;
526
+ } | undefined;
519
527
  integrations?: Record<string, {
520
528
  installed: boolean;
521
529
  installedAt?: string | undefined;
@@ -549,6 +557,12 @@ declare class ConfigManager$1 extends EventEmitter {
549
557
  load(): Promise<void>;
550
558
  get(): Config;
551
559
  save(updates: Record<string, unknown>, changePath?: string): Promise<void>;
560
+ /**
561
+ * Set a single config value by dot-path (e.g. "security.maxConcurrentSessions").
562
+ * Builds the nested update object, validates, and saves.
563
+ * Throws if the path contains blocked keys or the value fails Zod validation.
564
+ */
565
+ setPath(dotPath: string, value: unknown): Promise<void>;
552
566
  resolveWorkspace(input?: string): string;
553
567
  exists(): Promise<boolean>;
554
568
  getConfigPath(): string;
@@ -899,8 +913,11 @@ declare class Session extends TypedEmitter<SessionEvents> {
899
913
  promptCount: number;
900
914
  firstAgent: string;
901
915
  agentSwitchHistory: AgentSwitchEntry[];
916
+ isAssistant: boolean;
902
917
  log: Logger$1;
903
918
  middlewareChain?: MiddlewareChain;
919
+ /** Latest commands emitted by the agent — buffered before bridge connects so they're not lost */
920
+ latestCommands: AgentCommand[] | null;
904
921
  readonly permissionGate: PermissionGate;
905
922
  private readonly queue;
906
923
  private speechService?;
@@ -912,6 +929,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
912
929
  workingDirectory: string;
913
930
  agentInstance: AgentInstance;
914
931
  speechService?: SpeechService;
932
+ isAssistant?: boolean;
915
933
  });
916
934
  get status(): SessionStatus;
917
935
  /** Transition to active — from initializing, error, or cancelled */
@@ -940,6 +958,8 @@ declare class Session extends TypedEmitter<SessionEvents> {
940
958
  getConfigValue(id: string): string | undefined;
941
959
  /** Set session name explicitly and emit 'named' event */
942
960
  setName(name: string): void;
961
+ /** Send a config option change to the agent and update local state from the response. */
962
+ setConfigOption(configId: string, value: SetConfigOptionValue): Promise<void>;
943
963
  updateConfigOptions(options: ConfigOption[]): Promise<void>;
944
964
  /** Snapshot of current ACP state for persistence */
945
965
  toAcpStateSnapshot(): NonNullable<SessionRecord["acpState"]>;
@@ -972,6 +992,27 @@ declare class PromptQueue {
972
992
  get isProcessing(): boolean;
973
993
  }
974
994
 
995
+ interface AssistantCommand {
996
+ command: string;
997
+ description: string;
998
+ }
999
+ interface AssistantSection {
1000
+ id: string;
1001
+ title: string;
1002
+ priority: number;
1003
+ buildContext: () => string | null;
1004
+ commands?: AssistantCommand[];
1005
+ }
1006
+ declare class AssistantRegistry {
1007
+ private sections;
1008
+ private _instanceRoot;
1009
+ /** Set the instance root path used in assistant guidelines */
1010
+ setInstanceRoot(root: string): void;
1011
+ register(section: AssistantSection): void;
1012
+ unregister(id: string): void;
1013
+ buildSystemPrompt(channelId?: string): string;
1014
+ }
1015
+
975
1016
  type PluginPermission = 'events:read' | 'events:emit' | 'services:register' | 'services:use' | 'middleware:register' | 'commands:register' | 'storage:read' | 'storage:write' | 'kernel:access';
976
1017
  interface OpenACPPlugin {
977
1018
  /** Unique identifier, e.g., '@openacp/security' */
@@ -1102,7 +1143,26 @@ type CommandResponse = {
1102
1143
  message: string;
1103
1144
  } | {
1104
1145
  type: 'silent';
1146
+ } | {
1147
+ type: 'delegated';
1105
1148
  };
1149
+ interface MenuItem {
1150
+ id: string;
1151
+ label: string;
1152
+ priority: number;
1153
+ group?: string;
1154
+ action: {
1155
+ type: 'command';
1156
+ command: string;
1157
+ } | {
1158
+ type: 'delegate';
1159
+ prompt: string;
1160
+ } | {
1161
+ type: 'callback';
1162
+ callbackData: string;
1163
+ };
1164
+ visible?: () => boolean;
1165
+ }
1106
1166
  interface MenuOption {
1107
1167
  label: string;
1108
1168
  command: string;
@@ -1186,6 +1246,14 @@ interface PluginContext {
1186
1246
  getService<T>(name: string): T | undefined;
1187
1247
  /** Register slash command. Requires 'commands:register'. */
1188
1248
  registerCommand(def: CommandDef): void;
1249
+ /** Register a menu item. Requires 'commands:register'. */
1250
+ registerMenuItem(item: MenuItem): void;
1251
+ /** Unregister a menu item by id. Requires 'commands:register'. */
1252
+ unregisterMenuItem(id: string): void;
1253
+ /** Register an assistant section. Requires 'commands:register'. */
1254
+ registerAssistantSection(section: AssistantSection): void;
1255
+ /** Unregister an assistant section by id. Requires 'commands:register'. */
1256
+ unregisterAssistantSection(id: string): void;
1189
1257
  /** Plugin-scoped storage. Requires 'storage:read' and/or 'storage:write'. */
1190
1258
  storage: PluginStorage;
1191
1259
  /** Plugin-scoped logger. Always available (no permission needed). */
@@ -1397,7 +1465,7 @@ interface ViewerStoreInterface {
1397
1465
  }
1398
1466
  interface TunnelServiceInterface {
1399
1467
  getPublicUrl(): string;
1400
- start(): Promise<string>;
1468
+ start(apiPort: number): Promise<string>;
1401
1469
  stop(): Promise<void>;
1402
1470
  getStore(): ViewerStoreInterface;
1403
1471
  fileUrl(entryId: string): string;
@@ -1423,6 +1491,8 @@ declare class MessageTransformer {
1423
1491
 
1424
1492
  interface SessionStore {
1425
1493
  save(record: SessionRecord): Promise<void>;
1494
+ /** Immediately flush pending writes to disk (no debounce). */
1495
+ flush(): void;
1426
1496
  get(sessionId: string): SessionRecord | undefined;
1427
1497
  findByPlatform(channelId: string, predicate: (platform: Record<string, unknown>) => boolean): SessionRecord | undefined;
1428
1498
  findByAgentSessionId(agentSessionId: string): SessionRecord | undefined;
@@ -1498,6 +1568,11 @@ interface EventBusEvents {
1498
1568
  attachments?: unknown[];
1499
1569
  }) => void;
1500
1570
  "usage:recorded": (data: UsageRecordEvent) => void;
1571
+ "session:threadReady": (data: {
1572
+ sessionId: string;
1573
+ channelId: string;
1574
+ threadId: string;
1575
+ }) => void;
1501
1576
  "session:configChanged": (data: {
1502
1577
  sessionId: string;
1503
1578
  }) => void;
@@ -1527,7 +1602,9 @@ declare class SessionManager {
1527
1602
  getRecordByAgentSessionId(agentSessionId: string): SessionRecord | undefined;
1528
1603
  getRecordByThread(channelId: string, threadId: string): SessionRecord | undefined;
1529
1604
  registerSession(session: Session): void;
1530
- patchRecord(sessionId: string, patch: Partial<SessionRecord>): Promise<void>;
1605
+ patchRecord(sessionId: string, patch: Partial<SessionRecord>, options?: {
1606
+ immediate?: boolean;
1607
+ }): Promise<void>;
1531
1608
  getSessionRecord(sessionId: string): SessionRecord | undefined;
1532
1609
  cancelSession(sessionId: string): Promise<void>;
1533
1610
  listSessions(channelId?: string): Session[];
@@ -1567,24 +1644,26 @@ declare class SessionBridge {
1567
1644
  private adapter;
1568
1645
  private deps;
1569
1646
  private connected;
1570
- private agentEventHandler?;
1571
- private sessionEventHandler?;
1572
- private statusChangeHandler?;
1573
- private namedHandler?;
1574
- private promptCountHandler?;
1647
+ private cleanupFns;
1575
1648
  constructor(session: Session, adapter: IChannelAdapter, deps: BridgeDeps);
1576
1649
  private get tracer();
1650
+ /** Register a listener and track it for cleanup */
1651
+ private listen;
1577
1652
  /** Send message to adapter, optionally running through message:outgoing middleware */
1578
1653
  private sendMessage;
1579
1654
  connect(): void;
1580
1655
  disconnect(): void;
1581
- private wireAgentToSession;
1582
- private wireSessionToAdapter;
1656
+ /** Dispatch an agent event through middleware and to the adapter */
1657
+ private dispatchAgentEvent;
1583
1658
  private handleAgentEvent;
1584
1659
  /** Persist current ACP state (configOptions, agentCapabilities) to session store as cache */
1585
1660
  private persistAcpState;
1586
- private wirePermissions;
1587
- private wireLifecycle;
1661
+ /** Resolve a permission request through the full pipeline: middleware -> auto-approve -> ask user */
1662
+ private resolvePermission;
1663
+ /** Check if a permission request should be auto-approved (openacp commands or bypass mode) */
1664
+ private checkAutoApprove;
1665
+ /** Emit permission:afterResolve middleware hook (fire-and-forget) */
1666
+ private emitAfterResolve;
1588
1667
  }
1589
1668
 
1590
1669
  interface TunnelEntry {
@@ -1629,12 +1708,11 @@ declare class ViewerStore {
1629
1708
  declare class TunnelService {
1630
1709
  private registry;
1631
1710
  private store;
1632
- private server;
1633
1711
  private config;
1634
- private systemPort;
1712
+ private apiPort;
1635
1713
  private startError;
1636
1714
  constructor(config: TunnelConfig, registryPath?: string, binDir?: string);
1637
- start(): Promise<string>;
1715
+ start(apiPort: number): Promise<string>;
1638
1716
  stop(): Promise<void>;
1639
1717
  addTunnel(port: number, opts?: {
1640
1718
  label?: string;
@@ -1700,10 +1778,127 @@ interface ContextResult {
1700
1778
  };
1701
1779
  }
1702
1780
 
1781
+ interface SessionHistory {
1782
+ version: 1;
1783
+ sessionId: string;
1784
+ turns: Turn[];
1785
+ }
1786
+ interface Turn {
1787
+ index: number;
1788
+ role: "user" | "assistant";
1789
+ timestamp: string;
1790
+ content?: string;
1791
+ attachments?: HistoryAttachment[];
1792
+ steps?: Step[];
1793
+ usage?: HistoryUsage;
1794
+ stopReason?: string;
1795
+ }
1796
+ interface HistoryAttachment {
1797
+ type: "image" | "audio" | "file";
1798
+ fileName: string;
1799
+ mimeType: string;
1800
+ size: number;
1801
+ }
1802
+ interface HistoryUsage {
1803
+ tokensUsed?: number;
1804
+ contextSize?: number;
1805
+ cost?: {
1806
+ amount: number;
1807
+ currency: string;
1808
+ };
1809
+ }
1810
+ type Step = ThinkingStep | TextStep | ToolCallStep | PlanStep | ImageStep | AudioStep | ResourceStep | ResourceLinkStep | ModeChangeStep | ConfigChangeStep;
1811
+ interface ThinkingStep {
1812
+ type: "thinking";
1813
+ content: string;
1814
+ }
1815
+ interface TextStep {
1816
+ type: "text";
1817
+ content: string;
1818
+ }
1819
+ interface ToolCallStep {
1820
+ type: "tool_call";
1821
+ id: string;
1822
+ name: string;
1823
+ kind?: string;
1824
+ status: string;
1825
+ input?: unknown;
1826
+ output?: unknown;
1827
+ diff?: {
1828
+ path: string;
1829
+ oldText?: string;
1830
+ newText: string;
1831
+ } | null;
1832
+ locations?: {
1833
+ path: string;
1834
+ line?: number;
1835
+ }[];
1836
+ permission?: {
1837
+ requested: boolean;
1838
+ outcome: string;
1839
+ } | null;
1840
+ }
1841
+ interface PlanStep {
1842
+ type: "plan";
1843
+ entries: {
1844
+ content: string;
1845
+ priority: string;
1846
+ status: string;
1847
+ }[];
1848
+ }
1849
+ interface ImageStep {
1850
+ type: "image";
1851
+ mimeType: string;
1852
+ filePath: string;
1853
+ size?: number;
1854
+ }
1855
+ interface AudioStep {
1856
+ type: "audio";
1857
+ mimeType: string;
1858
+ filePath: string;
1859
+ size?: number;
1860
+ }
1861
+ interface ResourceStep {
1862
+ type: "resource";
1863
+ uri: string;
1864
+ name: string;
1865
+ text?: string;
1866
+ }
1867
+ interface ResourceLinkStep {
1868
+ type: "resource_link";
1869
+ uri: string;
1870
+ name: string;
1871
+ title?: string;
1872
+ description?: string;
1873
+ }
1874
+ interface ModeChangeStep {
1875
+ type: "mode_change";
1876
+ modeId: string;
1877
+ }
1878
+ interface ConfigChangeStep {
1879
+ type: "config_change";
1880
+ configId: string;
1881
+ value: string;
1882
+ }
1883
+
1884
+ declare class HistoryStore {
1885
+ private readonly dir;
1886
+ constructor(dir: string);
1887
+ write(history: SessionHistory): Promise<void>;
1888
+ read(sessionId: string): Promise<SessionHistory | null>;
1889
+ exists(sessionId: string): Promise<boolean>;
1890
+ list(): Promise<string[]>;
1891
+ delete(sessionId: string): Promise<void>;
1892
+ private filePath;
1893
+ }
1894
+
1703
1895
  declare class ContextManager {
1704
1896
  private providers;
1705
1897
  private cache;
1898
+ private historyStore?;
1706
1899
  constructor(cachePath?: string);
1900
+ setHistoryStore(store: HistoryStore): void;
1901
+ getHistory(sessionId: string): Promise<SessionHistory | null>;
1707
1902
  register(provider: ContextProvider): void;
1708
1903
  getProvider(repoPath: string): Promise<ContextProvider | null>;
1709
1904
  listSessions(query: ContextQuery): Promise<SessionListResult | null>;
@@ -1889,6 +2084,49 @@ declare class LifecycleManager {
1889
2084
  shutdown(): Promise<void>;
1890
2085
  }
1891
2086
 
2087
+ declare class MenuRegistry {
2088
+ private items;
2089
+ register(item: MenuItem): void;
2090
+ unregister(id: string): void;
2091
+ getItem(id: string): MenuItem | undefined;
2092
+ /** Get all visible items sorted by priority */
2093
+ getItems(): MenuItem[];
2094
+ }
2095
+
2096
+ interface AssistantManagerCore {
2097
+ createSession(params: {
2098
+ channelId: string;
2099
+ agentName: string;
2100
+ workingDirectory: string;
2101
+ initialName?: string;
2102
+ isAssistant?: boolean;
2103
+ }): Promise<Session>;
2104
+ connectSessionBridge(session: Session): void;
2105
+ configManager: {
2106
+ get(): {
2107
+ defaultAgent: string;
2108
+ };
2109
+ resolveWorkspace(): string;
2110
+ };
2111
+ }
2112
+ declare class AssistantManager {
2113
+ private core;
2114
+ private registry;
2115
+ private sessions;
2116
+ private respawning;
2117
+ private pendingSystemPrompts;
2118
+ constructor(core: AssistantManagerCore, registry: AssistantRegistry);
2119
+ spawn(channelId: string, threadId: string): Promise<Session>;
2120
+ get(channelId: string): Session | null;
2121
+ /**
2122
+ * Consume and return any pending system prompt for a channel.
2123
+ * Should be prepended to the first real user message.
2124
+ */
2125
+ consumePendingSystemPrompt(channelId: string): string | undefined;
2126
+ isAssistant(sessionId: string): boolean;
2127
+ respawn(channelId: string, threadId: string): Promise<Session>;
2128
+ }
2129
+
1892
2130
  interface InstanceContext {
1893
2131
  id: string;
1894
2132
  root: string;
@@ -1931,6 +2169,9 @@ declare class OpenACPCore {
1931
2169
  readonly lifecycleManager: LifecycleManager;
1932
2170
  private agentSwitchHandler;
1933
2171
  readonly instanceContext?: InstanceContext;
2172
+ readonly menuRegistry: MenuRegistry;
2173
+ readonly assistantRegistry: AssistantRegistry;
2174
+ assistantManager: AssistantManager;
1934
2175
  private getService;
1935
2176
  get securityGuard(): SecurityGuard;
1936
2177
  get notificationManager(): NotificationManager;
@@ -1989,7 +2230,10 @@ declare class OpenACPCore {
1989
2230
  resumed: boolean;
1990
2231
  }>;
1991
2232
  getOrResumeSession(channelId: string, threadId: string): Promise<Session | null>;
1992
- /** Create a SessionBridge for the given session and adapter */
2233
+ /** Connect a session bridge for the given session (used by AssistantManager) */
2234
+ connectSessionBridge(session: Session): void;
2235
+ /** Create a SessionBridge for the given session and adapter.
2236
+ * Disconnects any existing bridge for the same session first. */
1993
2237
  createBridge(session: Session, adapter: IChannelAdapter): SessionBridge;
1994
2238
  }
1995
2239
 
@@ -2178,10 +2422,28 @@ interface CreateTokenOpts {
2178
2422
  expire: string;
2179
2423
  scopes?: string[];
2180
2424
  }
2425
+ interface StoredCode {
2426
+ code: string;
2427
+ role: string;
2428
+ scopes?: string[];
2429
+ name: string;
2430
+ expire: string;
2431
+ createdAt: string;
2432
+ expiresAt: string;
2433
+ used: boolean;
2434
+ }
2435
+ interface CreateCodeOpts {
2436
+ role: string;
2437
+ name: string;
2438
+ expire: string;
2439
+ scopes?: string[];
2440
+ codeTtlMs?: number;
2441
+ }
2181
2442
 
2182
2443
  declare class TokenStore {
2183
2444
  private filePath;
2184
2445
  private tokens;
2446
+ private codes;
2185
2447
  private savePromise;
2186
2448
  private savePending;
2187
2449
  constructor(filePath: string);
@@ -2194,9 +2456,14 @@ declare class TokenStore {
2194
2456
  list(): StoredToken[];
2195
2457
  private lastUsedSaveTimer;
2196
2458
  updateLastUsed(id: string): void;
2197
- /** Wait for any in-flight save to complete */
2459
+ /** Wait for any in-flight and pending saves to complete */
2198
2460
  flush(): Promise<void>;
2199
2461
  destroy(): void;
2462
+ createCode(opts: CreateCodeOpts): StoredCode;
2463
+ getCode(code: string): StoredCode | undefined;
2464
+ exchangeCode(code: string): StoredCode | undefined;
2465
+ listCodes(): StoredCode[];
2466
+ revokeCode(code: string): void;
2200
2467
  cleanup(): void;
2201
2468
  }
2202
2469
 
@@ -2713,8 +2980,6 @@ declare class TelegramAdapter extends MessagingAdapter {
2713
2980
  private telegramConfig;
2714
2981
  private saveTopicIds?;
2715
2982
  private permissionHandler;
2716
- private assistantSession;
2717
- private assistantInitializing;
2718
2983
  private notificationTopicId;
2719
2984
  private assistantTopicId;
2720
2985
  private sendQueue;
@@ -2800,4 +3065,4 @@ declare class TelegramAdapter extends MessagingAdapter {
2800
3065
  archiveSessionTopic(sessionId: string): Promise<void>;
2801
3066
  }
2802
3067
 
2803
- export { ActivityTracker, AdapterCapabilities, AgentCapabilities, AgentCatalog, AgentCommand, AgentDefinition, AgentEvent, AgentInstance, AgentListItem, AgentManager, AgentStore, AgentSwitchEntry, type ApiConfig, type ApiServerInstance, type ApiServerOptions, type ApiServerService, Attachment, AvailabilityResult, BaseRenderer, type BridgeDeps, CONFIG_REGISTRY, ChannelConfig, type CleanupResult, type CommandArgs, type CommandDef, CommandRegistry, type CommandResponse, type Config, type ConfigFieldDef, ConfigManager$1 as 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$1 as Logger, type LoggingConfig, McpServerConfig, type MenuOption, 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$1 as 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$1 as 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 };
3068
+ 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$1 as 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$1 as 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$1 as 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$1 as 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 };