@openacp/cli 2026.410.3 → 2026.414.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/{channel-CFMUPzvH.d.ts → channel-bWC2vDOv.d.ts} +49 -6
- package/dist/cli.js +1410 -139
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +294 -25
- package/dist/index.js +448 -73
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Attachment, O as OutgoingMessage, I as IChannelAdapter,
|
|
2
|
-
export {
|
|
1
|
+
import { A as Attachment, O as OutgoingMessage, I as IChannelAdapter, T as TurnMeta, a as AgentEvent, S as StopReason, P as PermissionRequest, N as NotificationMessage, b as SessionStatus, U as UsageRecord, c as AgentCapabilities, d as AgentDefinition, M as McpServerConfig, e as SetConfigOptionValue, f as InstalledAgent, R as RegistryAgent, g as AgentListItem, h as AvailabilityResult, i as InstallProgress, j as InstallResult, k as TurnContext, C as ConfigOption, l as AgentSwitchEntry, m as AgentCommand, n as TurnRouting, o as SessionRecord, p as UsageRecordEvent, q as TurnSender, r as IncomingMessage, D as DisplayVerbosity, s as ChannelConfig, t as AdapterCapabilities, u as ToolCallMeta, V as ViewerLinks, v as OutputMode, w as PlanEntry } from './channel-bWC2vDOv.js';
|
|
2
|
+
export { x as AgentDistribution, y as AuthMethod, z as AuthenticateRequest, B as ChannelAdapter, E as ConfigSelectChoice, F as ConfigSelectGroup, G as ContentBlock, K as KIND_ICONS, H as ModelInfo, J as NewSessionResponse, L as PermissionOption, Q as PromptResponse, W as RegistryBinaryTarget, X as RegistryDistribution, Y as STATUS_ICONS, Z as SessionListItem, _ as SessionListResponse, $ as SessionMode, a0 as SessionModeState, a1 as SessionModelState, a2 as TelegramPlatformData, a3 as ToolUpdateMeta, a4 as createTurnContext, a5 as getEffectiveTarget, a6 as isSystemEvent } from './channel-bWC2vDOv.js';
|
|
3
3
|
import pino from 'pino';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import { ZodSchema, z } from 'zod';
|
|
@@ -82,7 +82,17 @@ type PluginPermission =
|
|
|
82
82
|
/** Write to plugin-scoped storage */
|
|
83
83
|
| 'storage:write'
|
|
84
84
|
/** Direct access to OpenACPCore internals (sessions, config, eventBus) */
|
|
85
|
-
| 'kernel:access'
|
|
85
|
+
| 'kernel:access'
|
|
86
|
+
/** Read-only session metadata without kernel:access */
|
|
87
|
+
| 'sessions:read'
|
|
88
|
+
/** Read identity data (users, identities, search) */
|
|
89
|
+
| 'identity:read'
|
|
90
|
+
/** Write identity data (create, update, link, unlink, roles) */
|
|
91
|
+
| 'identity:write'
|
|
92
|
+
/** Register an identity source (adapters register their platform name) */
|
|
93
|
+
| 'identity:register-source'
|
|
94
|
+
/** Send push notifications to users */
|
|
95
|
+
| 'notifications:send';
|
|
86
96
|
/**
|
|
87
97
|
* The runtime plugin instance — the object a plugin module default-exports.
|
|
88
98
|
*
|
|
@@ -141,8 +151,14 @@ interface PluginStorage {
|
|
|
141
151
|
set<T>(key: string, value: T): Promise<void>;
|
|
142
152
|
delete(key: string): Promise<void>;
|
|
143
153
|
list(): Promise<string[]>;
|
|
154
|
+
/** Returns keys matching the given prefix, or all keys if prefix is omitted. */
|
|
155
|
+
keys(prefix?: string): Promise<string[]>;
|
|
156
|
+
/** Deletes all keys in this storage scope. */
|
|
157
|
+
clear(): Promise<void>;
|
|
144
158
|
/** Returns the plugin's dedicated data directory, creating it if needed */
|
|
145
159
|
getDataDir(): string;
|
|
160
|
+
/** Returns a storage instance scoped to the given session. Auto-isolated from global storage. */
|
|
161
|
+
forSession(sessionId: string): PluginStorage;
|
|
146
162
|
}
|
|
147
163
|
/**
|
|
148
164
|
* Typed API for reading and writing a plugin's settings.json file.
|
|
@@ -253,6 +269,22 @@ interface MigrateContext {
|
|
|
253
269
|
type CommandResponse = {
|
|
254
270
|
type: 'text';
|
|
255
271
|
text: string;
|
|
272
|
+
} | {
|
|
273
|
+
/**
|
|
274
|
+
* Adapter-aware response: each adapter reads its own key from `variants`.
|
|
275
|
+
* Adapters without a matching variant render `fallback` as plain text.
|
|
276
|
+
*
|
|
277
|
+
* Variant shapes by adapter ID:
|
|
278
|
+
* telegram: { text: string; parse_mode?: 'HTML' | 'Markdown' | 'MarkdownV2' }
|
|
279
|
+
* discord: { content?: string; embeds?: unknown[] }
|
|
280
|
+
* slack: { text: string; blocks?: unknown[] }
|
|
281
|
+
* sse: { text: string; format?: 'plain' | 'markdown' | 'html' }
|
|
282
|
+
*/
|
|
283
|
+
type: 'adaptive';
|
|
284
|
+
/** Plain text rendered by adapters without a matching variant */
|
|
285
|
+
fallback: string;
|
|
286
|
+
/** Per-adapter payloads, keyed by adapter ID */
|
|
287
|
+
variants?: Record<string, unknown>;
|
|
256
288
|
} | {
|
|
257
289
|
type: 'menu';
|
|
258
290
|
title: string;
|
|
@@ -423,6 +455,51 @@ interface PluginContext {
|
|
|
423
455
|
* → [HOOK: message:outgoing] → adapter.sendMessage()
|
|
424
456
|
*/
|
|
425
457
|
sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
|
|
458
|
+
/**
|
|
459
|
+
* Send a user-targeted notification. Fire-and-forget, best-effort.
|
|
460
|
+
* Resolves target via identity system — one call delivers across all linked platforms.
|
|
461
|
+
* Requires 'notifications:send' permission.
|
|
462
|
+
*/
|
|
463
|
+
notify(target: {
|
|
464
|
+
identityId: string;
|
|
465
|
+
} | {
|
|
466
|
+
userId: string;
|
|
467
|
+
} | {
|
|
468
|
+
channelId: string;
|
|
469
|
+
platformId: string;
|
|
470
|
+
}, message: {
|
|
471
|
+
type: 'text';
|
|
472
|
+
text: string;
|
|
473
|
+
}, options?: {
|
|
474
|
+
via?: 'dm' | 'thread' | 'topic';
|
|
475
|
+
topicId?: string;
|
|
476
|
+
sessionId?: string;
|
|
477
|
+
onlyPlatforms?: string[];
|
|
478
|
+
excludePlatforms?: string[];
|
|
479
|
+
}): void;
|
|
480
|
+
/**
|
|
481
|
+
* Define a custom hook that other plugins can register middleware on.
|
|
482
|
+
* The hook name is automatically prefixed with `plugin:{pluginName}:`.
|
|
483
|
+
*/
|
|
484
|
+
defineHook(name: string): void;
|
|
485
|
+
/**
|
|
486
|
+
* Fire a custom hook through the middleware chain.
|
|
487
|
+
* Name is auto-prefixed: `emitHook('foo', p)` fires `plugin:{pluginName}:foo`.
|
|
488
|
+
* Returns the final payload (possibly modified by middleware), or null if blocked.
|
|
489
|
+
*/
|
|
490
|
+
emitHook<T extends Record<string, unknown>>(name: string, payload: T): Promise<T | null>;
|
|
491
|
+
/**
|
|
492
|
+
* Read-only session metadata. Requires `sessions:read` permission.
|
|
493
|
+
* Returns undefined if the session does not exist.
|
|
494
|
+
*/
|
|
495
|
+
getSessionInfo(sessionId: string): Promise<{
|
|
496
|
+
id: string;
|
|
497
|
+
status: SessionStatus;
|
|
498
|
+
name?: string;
|
|
499
|
+
promptCount: number;
|
|
500
|
+
channelId: string;
|
|
501
|
+
agentName: string;
|
|
502
|
+
} | undefined>;
|
|
426
503
|
/** Direct access to SessionManager. Requires 'kernel:access'. */
|
|
427
504
|
sessions: SessionManager$1;
|
|
428
505
|
/** Direct access to ConfigManager. Requires 'kernel:access'. */
|
|
@@ -452,6 +529,8 @@ interface MiddlewarePayloadMap {
|
|
|
452
529
|
userId: string;
|
|
453
530
|
text: string;
|
|
454
531
|
attachments?: Attachment[];
|
|
532
|
+
/** Per-turn context bag. Undefined for messages that bypass the normal handleMessage flow. */
|
|
533
|
+
meta?: TurnMeta;
|
|
455
534
|
};
|
|
456
535
|
'message:outgoing': {
|
|
457
536
|
sessionId: string;
|
|
@@ -462,6 +541,8 @@ interface MiddlewarePayloadMap {
|
|
|
462
541
|
text: string;
|
|
463
542
|
attachments?: Attachment[];
|
|
464
543
|
sourceAdapterId?: string;
|
|
544
|
+
/** Per-turn context bag carried from message:incoming. */
|
|
545
|
+
meta?: TurnMeta;
|
|
465
546
|
};
|
|
466
547
|
'agent:beforeEvent': {
|
|
467
548
|
sessionId: string;
|
|
@@ -476,11 +557,27 @@ interface MiddlewarePayloadMap {
|
|
|
476
557
|
sessionId: string;
|
|
477
558
|
promptText: string;
|
|
478
559
|
promptNumber: number;
|
|
560
|
+
turnId: string;
|
|
561
|
+
meta?: TurnMeta;
|
|
562
|
+
userPrompt?: string;
|
|
563
|
+
sourceAdapterId?: string;
|
|
564
|
+
responseAdapterId?: string | null;
|
|
479
565
|
};
|
|
480
566
|
'turn:end': {
|
|
481
567
|
sessionId: string;
|
|
482
568
|
stopReason: StopReason;
|
|
483
569
|
durationMs: number;
|
|
570
|
+
turnId: string;
|
|
571
|
+
meta?: TurnMeta;
|
|
572
|
+
};
|
|
573
|
+
/** Fires after the full turn response is assembled. Read-only, fire-and-forget. */
|
|
574
|
+
'agent:afterTurn': {
|
|
575
|
+
sessionId: string;
|
|
576
|
+
turnId: string;
|
|
577
|
+
/** Complete response text — all text chunks concatenated. Empty if agent produced no text. */
|
|
578
|
+
fullText: string;
|
|
579
|
+
stopReason: StopReason;
|
|
580
|
+
meta?: TurnMeta;
|
|
484
581
|
};
|
|
485
582
|
'fs:beforeRead': {
|
|
486
583
|
sessionId: string;
|
|
@@ -590,9 +687,27 @@ interface FileServiceInterface {
|
|
|
590
687
|
extensionFromMime(mimeType: string): string;
|
|
591
688
|
convertOggToWav(oggData: Buffer): Promise<Buffer>;
|
|
592
689
|
}
|
|
593
|
-
interface NotificationService {
|
|
690
|
+
interface NotificationService$1 {
|
|
594
691
|
notify(channelId: string, notification: NotificationMessage): Promise<void>;
|
|
595
692
|
notifyAll(notification: NotificationMessage): Promise<void>;
|
|
693
|
+
/** Send a notification to a user across all their linked platforms. Fire-and-forget. */
|
|
694
|
+
notifyUser?(target: {
|
|
695
|
+
identityId: string;
|
|
696
|
+
} | {
|
|
697
|
+
userId: string;
|
|
698
|
+
} | {
|
|
699
|
+
channelId: string;
|
|
700
|
+
platformId: string;
|
|
701
|
+
}, message: {
|
|
702
|
+
type: 'text';
|
|
703
|
+
text: string;
|
|
704
|
+
}, options?: {
|
|
705
|
+
via?: 'dm' | 'thread' | 'topic';
|
|
706
|
+
topicId?: string;
|
|
707
|
+
sessionId?: string;
|
|
708
|
+
onlyPlatforms?: string[];
|
|
709
|
+
excludePlatforms?: string[];
|
|
710
|
+
}): Promise<void>;
|
|
596
711
|
}
|
|
597
712
|
interface UsageService {
|
|
598
713
|
trackUsage(record: UsageRecord): Promise<void>;
|
|
@@ -1756,6 +1871,11 @@ declare class Session extends TypedEmitter<SessionEvents> {
|
|
|
1756
1871
|
get queueDepth(): number;
|
|
1757
1872
|
/** Whether a prompt is currently being processed by the agent */
|
|
1758
1873
|
get promptRunning(): boolean;
|
|
1874
|
+
/** Snapshot of queued (not yet processing) items — for inspection by API consumers. */
|
|
1875
|
+
get queueItems(): {
|
|
1876
|
+
userPrompt: string;
|
|
1877
|
+
turnId?: string;
|
|
1878
|
+
}[];
|
|
1759
1879
|
/** Store context markdown to be prepended to the next prompt (used for session resume with history). */
|
|
1760
1880
|
setContext(markdown: string): void;
|
|
1761
1881
|
/** Set TTS mode: "off" = disabled, "next" = one-shot (auto-resets after prompt), "on" = persistent. */
|
|
@@ -1767,7 +1887,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
|
|
|
1767
1887
|
* then adds it to the PromptQueue. Returns a turnId that callers can use to correlate
|
|
1768
1888
|
* queued/processing events before the prompt actually runs.
|
|
1769
1889
|
*/
|
|
1770
|
-
enqueuePrompt(text: string, attachments?: Attachment[], routing?: TurnRouting, externalTurnId?: string): Promise<string>;
|
|
1890
|
+
enqueuePrompt(text: string, attachments?: Attachment[], routing?: TurnRouting, externalTurnId?: string, meta?: TurnMeta): Promise<string>;
|
|
1771
1891
|
private processPrompt;
|
|
1772
1892
|
/**
|
|
1773
1893
|
* Transcribe audio attachments to text if the agent doesn't support audio natively.
|
|
@@ -1826,13 +1946,13 @@ declare class PromptQueue {
|
|
|
1826
1946
|
private abortController;
|
|
1827
1947
|
/** Set when abort is triggered; drainNext waits for the current processor to settle before starting the next item. */
|
|
1828
1948
|
private processorSettled;
|
|
1829
|
-
constructor(processor: (text: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
|
|
1949
|
+
constructor(processor: (text: string, userPrompt: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string, meta?: TurnMeta) => Promise<void>, onError?: ((err: unknown) => void) | undefined);
|
|
1830
1950
|
/**
|
|
1831
1951
|
* Add a prompt to the queue. If no prompt is currently processing, it runs
|
|
1832
1952
|
* immediately. Otherwise, it's buffered and the returned promise resolves
|
|
1833
1953
|
* only after the prompt finishes processing.
|
|
1834
1954
|
*/
|
|
1835
|
-
enqueue(text: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string): Promise<void>;
|
|
1955
|
+
enqueue(text: string, userPrompt: string, attachments?: Attachment[], routing?: TurnRouting, turnId?: string, meta?: TurnMeta): Promise<void>;
|
|
1836
1956
|
/** Run a single prompt through the processor, then drain the next queued item. */
|
|
1837
1957
|
private process;
|
|
1838
1958
|
/** Dequeue and process the next pending prompt, if any. Called after each prompt completes. */
|
|
@@ -1844,6 +1964,11 @@ declare class PromptQueue {
|
|
|
1844
1964
|
clear(): void;
|
|
1845
1965
|
get pending(): number;
|
|
1846
1966
|
get isProcessing(): boolean;
|
|
1967
|
+
/** Snapshot of queued (not yet processing) items — used for queue inspection by callers. */
|
|
1968
|
+
get pendingItems(): Array<{
|
|
1969
|
+
userPrompt: string;
|
|
1970
|
+
turnId?: string;
|
|
1971
|
+
}>;
|
|
1847
1972
|
}
|
|
1848
1973
|
|
|
1849
1974
|
/**
|
|
@@ -1909,6 +2034,7 @@ interface EventBusEvents {
|
|
|
1909
2034
|
sessionId: string;
|
|
1910
2035
|
agent: string;
|
|
1911
2036
|
status: SessionStatus;
|
|
2037
|
+
userId?: string;
|
|
1912
2038
|
}) => void;
|
|
1913
2039
|
"session:updated": (data: {
|
|
1914
2040
|
sessionId: string;
|
|
@@ -1923,6 +2049,7 @@ interface EventBusEvents {
|
|
|
1923
2049
|
}) => void;
|
|
1924
2050
|
"agent:event": (data: {
|
|
1925
2051
|
sessionId: string;
|
|
2052
|
+
turnId: string;
|
|
1926
2053
|
event: AgentEvent;
|
|
1927
2054
|
}) => void;
|
|
1928
2055
|
"permission:request": (data: {
|
|
@@ -1943,6 +2070,8 @@ interface EventBusEvents {
|
|
|
1943
2070
|
commands: Array<{
|
|
1944
2071
|
name: string;
|
|
1945
2072
|
description: string;
|
|
2073
|
+
category?: string;
|
|
2074
|
+
usage?: string;
|
|
1946
2075
|
}>;
|
|
1947
2076
|
}) => void;
|
|
1948
2077
|
"plugin:loaded": (data: {
|
|
@@ -1990,13 +2119,24 @@ interface EventBusEvents {
|
|
|
1990
2119
|
attachments?: unknown[];
|
|
1991
2120
|
timestamp: string;
|
|
1992
2121
|
queueDepth: number;
|
|
2122
|
+
sender?: TurnSender | null;
|
|
1993
2123
|
}) => void;
|
|
1994
2124
|
"message:processing": (data: {
|
|
1995
2125
|
sessionId: string;
|
|
1996
2126
|
turnId: string;
|
|
1997
2127
|
sourceAdapterId: string;
|
|
2128
|
+
userPrompt: string;
|
|
2129
|
+
finalPrompt: string;
|
|
2130
|
+
attachments?: unknown[];
|
|
2131
|
+
sender?: TurnSender | null;
|
|
1998
2132
|
timestamp: string;
|
|
1999
2133
|
}) => void;
|
|
2134
|
+
/** Fired when a queued message is rejected before processing (e.g. blocked by middleware). */
|
|
2135
|
+
"message:failed": (data: {
|
|
2136
|
+
sessionId: string;
|
|
2137
|
+
turnId: string;
|
|
2138
|
+
reason: string;
|
|
2139
|
+
}) => void;
|
|
2000
2140
|
"session:agentSwitch": (data: {
|
|
2001
2141
|
sessionId: string;
|
|
2002
2142
|
fromAgent: string;
|
|
@@ -2005,6 +2145,42 @@ interface EventBusEvents {
|
|
|
2005
2145
|
resumed?: boolean;
|
|
2006
2146
|
error?: string;
|
|
2007
2147
|
}) => void;
|
|
2148
|
+
"identity:created": (data: {
|
|
2149
|
+
userId: string;
|
|
2150
|
+
identityId: string;
|
|
2151
|
+
source: string;
|
|
2152
|
+
displayName: string;
|
|
2153
|
+
}) => void;
|
|
2154
|
+
"identity:updated": (data: {
|
|
2155
|
+
userId: string;
|
|
2156
|
+
changes: string[];
|
|
2157
|
+
}) => void;
|
|
2158
|
+
"identity:linked": (data: {
|
|
2159
|
+
userId: string;
|
|
2160
|
+
identityId: string;
|
|
2161
|
+
linkedFrom?: string;
|
|
2162
|
+
}) => void;
|
|
2163
|
+
"identity:unlinked": (data: {
|
|
2164
|
+
userId: string;
|
|
2165
|
+
identityId: string;
|
|
2166
|
+
newUserId: string;
|
|
2167
|
+
}) => void;
|
|
2168
|
+
"identity:userMerged": (data: {
|
|
2169
|
+
keptUserId: string;
|
|
2170
|
+
mergedUserId: string;
|
|
2171
|
+
movedIdentities: string[];
|
|
2172
|
+
}) => void;
|
|
2173
|
+
"identity:roleChanged": (data: {
|
|
2174
|
+
userId: string;
|
|
2175
|
+
oldRole: string;
|
|
2176
|
+
newRole: string;
|
|
2177
|
+
changedBy?: string;
|
|
2178
|
+
}) => void;
|
|
2179
|
+
"identity:seen": (data: {
|
|
2180
|
+
userId: string;
|
|
2181
|
+
identityId: string;
|
|
2182
|
+
sessionId: string;
|
|
2183
|
+
}) => void;
|
|
2008
2184
|
}
|
|
2009
2185
|
/**
|
|
2010
2186
|
* Global event bus for cross-cutting communication.
|
|
@@ -2106,21 +2282,62 @@ declare class SessionManager {
|
|
|
2106
2282
|
destroyAll(): Promise<void>;
|
|
2107
2283
|
}
|
|
2108
2284
|
|
|
2285
|
+
/** Target for user-directed notifications. */
|
|
2286
|
+
type NotificationTarget = {
|
|
2287
|
+
identityId: string;
|
|
2288
|
+
} | {
|
|
2289
|
+
userId: string;
|
|
2290
|
+
} | {
|
|
2291
|
+
channelId: string;
|
|
2292
|
+
platformId: string;
|
|
2293
|
+
};
|
|
2294
|
+
interface NotificationOptions {
|
|
2295
|
+
via?: 'dm' | 'thread' | 'topic';
|
|
2296
|
+
topicId?: string;
|
|
2297
|
+
sessionId?: string;
|
|
2298
|
+
onlyPlatforms?: string[];
|
|
2299
|
+
excludePlatforms?: string[];
|
|
2300
|
+
}
|
|
2301
|
+
/** User-facing notification content — distinct from system NotificationMessage. */
|
|
2302
|
+
interface UserNotificationContent {
|
|
2303
|
+
type: 'text';
|
|
2304
|
+
text: string;
|
|
2305
|
+
}
|
|
2109
2306
|
/**
|
|
2110
|
-
*
|
|
2111
|
-
*
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2307
|
+
* Minimal identity service interface — avoids hard dependency on identity plugin types.
|
|
2308
|
+
* NotificationService only needs resolution capabilities, not full CRUD.
|
|
2309
|
+
*/
|
|
2310
|
+
interface IdentityResolver {
|
|
2311
|
+
getIdentity(identityId: string): Promise<{
|
|
2312
|
+
userId: string;
|
|
2313
|
+
source: string;
|
|
2314
|
+
platformId: string;
|
|
2315
|
+
platformUsername?: string;
|
|
2316
|
+
} | undefined>;
|
|
2317
|
+
getUser(userId: string): Promise<{
|
|
2318
|
+
userId: string;
|
|
2319
|
+
identities: string[];
|
|
2320
|
+
} | undefined>;
|
|
2321
|
+
getIdentitiesFor(userId: string): Promise<Array<{
|
|
2322
|
+
identityId: string;
|
|
2323
|
+
source: string;
|
|
2324
|
+
platformId: string;
|
|
2325
|
+
platformUsername?: string;
|
|
2326
|
+
}>>;
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Routes notifications to channel adapters. Extends the legacy NotificationManager
|
|
2330
|
+
* with user-targeted delivery via the identity system.
|
|
2116
2331
|
*
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2119
|
-
* after this service is created are still reachable.
|
|
2332
|
+
* Legacy API (notify/notifyAll) is preserved — existing callers in SessionBridge
|
|
2333
|
+
* continue to work without changes.
|
|
2120
2334
|
*/
|
|
2121
|
-
declare class
|
|
2335
|
+
declare class NotificationService {
|
|
2122
2336
|
private adapters;
|
|
2337
|
+
private identityResolver?;
|
|
2123
2338
|
constructor(adapters: Map<string, IChannelAdapter>);
|
|
2339
|
+
/** Inject identity resolver for user-targeted notifications. */
|
|
2340
|
+
setIdentityResolver(resolver: IdentityResolver): void;
|
|
2124
2341
|
/**
|
|
2125
2342
|
* Send a notification to a specific channel adapter.
|
|
2126
2343
|
*
|
|
@@ -2135,12 +2352,18 @@ declare class NotificationManager {
|
|
|
2135
2352
|
* failure is isolated so one broken adapter cannot block the rest.
|
|
2136
2353
|
*/
|
|
2137
2354
|
notifyAll(notification: NotificationMessage): Promise<void>;
|
|
2355
|
+
/**
|
|
2356
|
+
* Send a notification to a user across all their linked platforms.
|
|
2357
|
+
* Fire-and-forget — never throws, swallows all errors.
|
|
2358
|
+
*/
|
|
2359
|
+
notifyUser(target: NotificationTarget, message: UserNotificationContent, options?: NotificationOptions): Promise<void>;
|
|
2360
|
+
private _resolveAndDeliver;
|
|
2138
2361
|
}
|
|
2139
2362
|
|
|
2140
2363
|
/** Services required by SessionBridge for message transformation, persistence, and middleware. */
|
|
2141
2364
|
interface BridgeDeps {
|
|
2142
2365
|
messageTransformer: MessageTransformer;
|
|
2143
|
-
notificationManager:
|
|
2366
|
+
notificationManager: NotificationService;
|
|
2144
2367
|
sessionManager: SessionManager;
|
|
2145
2368
|
eventBus?: EventBus;
|
|
2146
2369
|
fileService?: FileServiceInterface;
|
|
@@ -2410,6 +2633,12 @@ interface Turn {
|
|
|
2410
2633
|
content?: string;
|
|
2411
2634
|
attachments?: HistoryAttachment[];
|
|
2412
2635
|
sourceAdapterId?: string;
|
|
2636
|
+
/**
|
|
2637
|
+
* TurnMeta bag as it existed when agent:beforePrompt fired — includes anything
|
|
2638
|
+
* plugins attached during message:incoming (e.g. workspace.sender, channelUser).
|
|
2639
|
+
* Persisted so history consumers can reconstruct who sent what without a live registry.
|
|
2640
|
+
*/
|
|
2641
|
+
meta?: Record<string, unknown>;
|
|
2413
2642
|
steps?: Step[];
|
|
2414
2643
|
usage?: HistoryUsage;
|
|
2415
2644
|
stopReason?: string;
|
|
@@ -2599,10 +2828,12 @@ interface SessionCreateParams {
|
|
|
2599
2828
|
existingSessionId?: string;
|
|
2600
2829
|
initialName?: string;
|
|
2601
2830
|
isAssistant?: boolean;
|
|
2831
|
+
/** User ID from identity system — who is creating this session. */
|
|
2832
|
+
userId?: string;
|
|
2602
2833
|
}
|
|
2603
2834
|
interface SideEffectDeps {
|
|
2604
2835
|
eventBus: EventBus;
|
|
2605
|
-
notificationManager:
|
|
2836
|
+
notificationManager: NotificationService;
|
|
2606
2837
|
tunnelService?: TunnelService;
|
|
2607
2838
|
}
|
|
2608
2839
|
/**
|
|
@@ -3054,7 +3285,7 @@ declare class OpenACPCore {
|
|
|
3054
3285
|
/** Access control and rate-limiting guard (provided by security plugin). */
|
|
3055
3286
|
get securityGuard(): SecurityGuard;
|
|
3056
3287
|
/** Cross-session notification delivery (provided by notifications plugin). */
|
|
3057
|
-
get notificationManager():
|
|
3288
|
+
get notificationManager(): NotificationService;
|
|
3058
3289
|
/** File I/O service for agent attachment storage (provided by file-service plugin). */
|
|
3059
3290
|
get fileService(): FileServiceInterface;
|
|
3060
3291
|
/** Text-to-speech / speech-to-text engine (provided by speech plugin). */
|
|
@@ -3120,7 +3351,38 @@ declare class OpenACPCore {
|
|
|
3120
3351
|
*
|
|
3121
3352
|
* If no session is found, the user is told to start one with /new.
|
|
3122
3353
|
*/
|
|
3123
|
-
handleMessage(message: IncomingMessage): Promise<void>;
|
|
3354
|
+
handleMessage(message: IncomingMessage, initialMeta?: Record<string, unknown>): Promise<void>;
|
|
3355
|
+
/**
|
|
3356
|
+
* Shared dispatch path for sending a prompt to a session.
|
|
3357
|
+
* Called by both handleMessage (Telegram) and handleMessageInSession (SSE/API)
|
|
3358
|
+
* after their respective middleware/enrichment steps.
|
|
3359
|
+
*/
|
|
3360
|
+
private _dispatchToSession;
|
|
3361
|
+
/**
|
|
3362
|
+
* Send a message to a known session, running the full message:incoming → agent:beforePrompt
|
|
3363
|
+
* middleware chain (same as handleMessage) but without the threadId-based session lookup.
|
|
3364
|
+
*
|
|
3365
|
+
* Used by channels that already hold a direct session reference (e.g. SSE adapter, api-server),
|
|
3366
|
+
* where looking up by channelId+threadId is unreliable (API sessions may have no threadId).
|
|
3367
|
+
*
|
|
3368
|
+
* @param session The target session — caller is responsible for validating its status.
|
|
3369
|
+
* @param message Sender context and message content.
|
|
3370
|
+
* @param initialMeta Optional adapter-specific context to seed the TurnMeta bag
|
|
3371
|
+
* (e.g. channelUser with display name/username).
|
|
3372
|
+
* @param options Optional turnId override and response routing.
|
|
3373
|
+
*/
|
|
3374
|
+
handleMessageInSession(session: Session, message: {
|
|
3375
|
+
channelId: string;
|
|
3376
|
+
userId: string;
|
|
3377
|
+
text: string;
|
|
3378
|
+
attachments?: Attachment[];
|
|
3379
|
+
}, initialMeta?: Record<string, unknown>, options?: {
|
|
3380
|
+
externalTurnId?: string;
|
|
3381
|
+
responseAdapterId?: string | null;
|
|
3382
|
+
}): Promise<{
|
|
3383
|
+
turnId: string;
|
|
3384
|
+
queueDepth: number;
|
|
3385
|
+
}>;
|
|
3124
3386
|
/**
|
|
3125
3387
|
* Create (or resume) a session with full wiring: agent, adapter thread, bridge, persistence.
|
|
3126
3388
|
*
|
|
@@ -3556,6 +3818,8 @@ interface StoredToken {
|
|
|
3556
3818
|
refreshDeadline: string;
|
|
3557
3819
|
lastUsedAt?: string;
|
|
3558
3820
|
revoked: boolean;
|
|
3821
|
+
/** User ID from identity system. Null until user completes /identity/setup. */
|
|
3822
|
+
userId?: string;
|
|
3559
3823
|
}
|
|
3560
3824
|
interface CreateTokenOpts {
|
|
3561
3825
|
role: string;
|
|
@@ -3632,6 +3896,10 @@ declare class TokenStore {
|
|
|
3632
3896
|
/** Wait for any in-flight and pending saves to complete */
|
|
3633
3897
|
flush(): Promise<void>;
|
|
3634
3898
|
destroy(): void;
|
|
3899
|
+
/** Associate a user ID with a token. Called by identity plugin after /identity/setup. */
|
|
3900
|
+
setUserId(tokenId: string, userId: string): void;
|
|
3901
|
+
/** Get the user ID associated with a token. */
|
|
3902
|
+
getUserId(tokenId: string): string | undefined;
|
|
3635
3903
|
/**
|
|
3636
3904
|
* Generates a one-time authorization code that can be exchanged for a JWT.
|
|
3637
3905
|
*
|
|
@@ -4703,10 +4971,11 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
4703
4971
|
*/
|
|
4704
4972
|
private retryWithBackoff;
|
|
4705
4973
|
/**
|
|
4706
|
-
*
|
|
4707
|
-
*
|
|
4974
|
+
* Sync Telegram autocomplete commands after all plugins are ready.
|
|
4975
|
+
* Merges STATIC_COMMANDS (hardcoded system commands) with plugin commands
|
|
4976
|
+
* from the registry, deduplicating by command name. Non-critical.
|
|
4708
4977
|
*/
|
|
4709
|
-
private
|
|
4978
|
+
private syncCommandsWithRetry;
|
|
4710
4979
|
private initTopicDependentFeatures;
|
|
4711
4980
|
private startPrerequisiteWatcher;
|
|
4712
4981
|
/**
|
|
@@ -4828,4 +5097,4 @@ declare class TelegramAdapter extends MessagingAdapter {
|
|
|
4828
5097
|
archiveSessionTopic(sessionId: string): Promise<void>;
|
|
4829
5098
|
}
|
|
4830
5099
|
|
|
4831
|
-
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, type FieldDef, 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, 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 };
|
|
5100
|
+
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, type FieldDef, 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 MiddlewareHook, type MiddlewarePayloadMap, type MigrateContext, NotificationService as NotificationManager, NotificationMessage, type NotificationService$1 as 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, TurnMeta, TurnRouting, TypedEmitter, 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 };
|