@band-ai/sdk 0.3.3 → 0.4.0
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/README.md +54 -1
- package/dist/{ClaudeSDKAdapter-CXud2DBE.d.ts → CopilotACPAdapter-BCpbHFB0.d.ts} +240 -19
- package/dist/{ClaudeSDKAdapter-Cx6zhSaG.d.cts → CopilotACPAdapter-D4VWg8lJ.d.cts} +240 -19
- package/dist/{opencode-2YdscIc1.d.cts → acp-client-D-I_5lK-.d.cts} +23 -4
- package/dist/{opencode-Bld62x5t.d.ts → acp-client-DUXyczlF.d.ts} +23 -4
- package/dist/acp-server-BlcYMxKt.d.ts +17 -0
- package/dist/acp-server-CJhclo6P.d.cts +17 -0
- package/dist/adapters.cjs +2217 -973
- package/dist/adapters.d.cts +21 -132
- package/dist/adapters.d.ts +21 -132
- package/dist/adapters.js +26 -1914
- package/dist/{backends-D-dBdDm-.d.ts → backends-CgsPQa9B.d.ts} +2 -2
- package/dist/{backends-ZLxmQrTZ.d.cts → backends-Dh2WXcHQ.d.cts} +2 -2
- package/dist/{chunk-JY75VSQK.js → chunk-4OVNFDD7.js} +14 -1
- package/dist/chunk-6BE2EG5P.js +128 -0
- package/dist/{chunk-U6AFCLYZ.js → chunk-6TGXV5TE.js} +1824 -514
- package/dist/{chunk-OH6VVVKT.js → chunk-CBCHTTUY.js} +10 -0
- package/dist/{chunk-K5KAEYPF.js → chunk-HNWZZXAE.js} +288 -120
- package/dist/chunk-I34SXMTJ.js +6 -0
- package/dist/{chunk-XWHWJP4I.js → chunk-JDW5WSGF.js} +2 -2
- package/dist/{chunk-KXJ74J73.js → chunk-JIZE4EC6.js} +4 -10
- package/dist/chunk-OGOXY43L.js +119 -0
- package/dist/{chunk-W5IAI6Z4.js → chunk-OVXVZUPO.js} +5 -5
- package/dist/{chunk-YJ42AZO4.js → chunk-RJNJUISR.js} +5 -2
- package/dist/{chunk-MQY74R7D.js → chunk-SHZBLLDQ.js} +21 -9
- package/dist/{chunk-JADCAMZY.js → chunk-TGDDFBYS.js} +45 -0
- package/dist/{chunk-US226AS4.js → chunk-UENIC5FJ.js} +14 -11
- package/dist/{chunk-WA7CHXUS.js → chunk-UL3Y5C4J.js} +2 -2
- package/dist/{chunk-WL2HNJZ6.js → chunk-VOMJRQOM.js} +3 -3
- package/dist/{chunk-MQBBWYRP.js → chunk-YF7K4UB3.js} +3352 -572
- package/dist/{chunk-OD2G5LFQ.js → chunk-ZYOXI4JL.js} +41 -2
- package/dist/config.cjs +2 -12
- package/dist/config.js +2 -2
- package/dist/converters.cjs +36 -11
- package/dist/converters.d.cts +7 -5
- package/dist/converters.d.ts +7 -5
- package/dist/converters.js +11 -13
- package/dist/core.cjs +239 -5
- package/dist/core.d.cts +71 -6
- package/dist/core.d.ts +71 -6
- package/dist/core.js +31 -6
- package/dist/{customTools-BzF0IISO.d.cts → customTools-Bfecd0mJ.d.cts} +1 -1
- package/dist/{customTools-BzF0IISO.d.ts → customTools-Bfecd0mJ.d.ts} +1 -1
- package/dist/{disconnectReason-IuADl6TH.d.ts → disconnectReason-Cctmg1SN.d.cts} +1 -1
- package/dist/{disconnectReason-IuADl6TH.d.cts → disconnectReason-Cctmg1SN.d.ts} +1 -1
- package/dist/{dtos-B8KU_q4d.d.ts → dtos-CjQsN1_h.d.cts} +5 -12
- package/dist/{dtos-B8KU_q4d.d.cts → dtos-CjQsN1_h.d.ts} +5 -12
- package/dist/index.cjs +5237 -1474
- package/dist/index.d.cts +61 -22
- package/dist/index.d.ts +61 -22
- package/dist/index.js +151 -43
- package/dist/linear.cjs +45 -7
- package/dist/linear.d.cts +4 -3
- package/dist/linear.d.ts +4 -3
- package/dist/linear.js +10 -10
- package/dist/mcp-claude.cjs +11 -6
- package/dist/mcp-claude.d.cts +4 -3
- package/dist/mcp-claude.d.ts +4 -3
- package/dist/mcp-claude.js +4 -5
- package/dist/mcp.cjs +13 -7
- package/dist/mcp.d.cts +6 -5
- package/dist/mcp.d.ts +6 -5
- package/dist/mcp.js +5 -6
- package/dist/{pagination-DqdkQArT.d.cts → pagination-BZDhB_nO.d.cts} +2 -2
- package/dist/{pagination-BgEx-HeL.d.ts → pagination-CPz0J_vQ.d.ts} +2 -2
- package/dist/{protocols-Bz1rxcUg.d.cts → protocols-CabgO52c.d.cts} +38 -3
- package/dist/{protocols-Bwwcql0h.d.ts → protocols-Dpci6uae.d.ts} +38 -3
- package/dist/rest.cjs +43 -1
- package/dist/rest.d.cts +6 -5
- package/dist/rest.d.ts +6 -5
- package/dist/rest.js +6 -5
- package/dist/runtime.cjs +2113 -597
- package/dist/runtime.d.cts +44 -25
- package/dist/runtime.d.ts +44 -25
- package/dist/runtime.js +11 -11
- package/dist/{schemas-BgJhlqqO.d.cts → schemas-BKnh4fKR.d.cts} +209 -24
- package/dist/{schemas-C4mK1WSs.d.ts → schemas-CDa3V_I5.d.ts} +209 -24
- package/dist/{sdk-BTciSLRQ.d.cts → sdk-CXNqzoY1.d.cts} +1 -1
- package/dist/{sdk-qKJtMma_.d.ts → sdk-Cin80BTC.d.ts} +1 -1
- package/dist/{simpleAdapter-BpT4XbZC.d.cts → simpleAdapter-D75rcz9n.d.cts} +3 -1
- package/dist/{simpleAdapter--wznuoOw.d.ts → simpleAdapter-eLvsAQNo.d.ts} +3 -1
- package/dist/testing.cjs +25 -7
- package/dist/testing.d.cts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/testing.js +9 -6
- package/dist/{types-BivGO7I9.d.ts → types-42-HWeX8.d.cts} +10 -4
- package/dist/types-CKU1N0SK.d.ts +137 -0
- package/dist/{types-BgYFd_Yw.d.cts → types-CjxZekMH.d.ts} +10 -4
- package/dist/types-DtcOLALn.d.cts +137 -0
- package/package.json +25 -26
- package/dist/acp-server-CiUqN3G3.d.ts +0 -24
- package/dist/acp-server-Dlj7D563.d.cts +0 -24
- package/dist/chunk-AVVDPXP4.js +0 -39
- package/dist/chunk-F63TPOI3.js +0 -29
- package/dist/chunk-V5TSWS7P.js +0 -62
- package/dist/types-BNNtOXu3.d.cts +0 -446
- package/dist/types-DFUtpxah.d.ts +0 -446
|
@@ -1,22 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, g as MessageEvent,
|
|
3
|
-
import { M as MetadataMap,
|
|
1
|
+
import { j as AgentToolsCapabilities, P as PlatformMessageLike, A as AdapterToolsProtocol, h as Preprocessor, F as FrameworkAdapter, q as PreprocessorContext } from './protocols-CabgO52c.cjs';
|
|
2
|
+
import { f as PlatformEvent, P as PlatformMessage, e as ConversationContext, S as SessionConfig, c as ContactEventConfig, A as AgentConfig, g as MessageEvent, l as ParticipantAddedEvent, m as ParticipantRemovedEvent, R as ReconnectedEvent, C as ContactEvent, a as AgentInput } from './types-DtcOLALn.cjs';
|
|
3
|
+
import { M as MetadataMap, g as ParticipantRecord } from './dtos-CjQsN1_h.cjs';
|
|
4
4
|
import { L as Logger } from './logger-CABQOnlR.cjs';
|
|
5
|
-
import { B as BandLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-
|
|
6
|
-
import { P as PaginationOptions } from './pagination-
|
|
7
|
-
import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-
|
|
5
|
+
import { B as BandLinkRestApi, b as RestRequestOptions, P as PaginatedResponse, e as AgentToolsRestApi } from './types-42-HWeX8.cjs';
|
|
6
|
+
import { P as PaginationOptions } from './pagination-BZDhB_nO.cjs';
|
|
7
|
+
import { W as WebSocketConflictPolicy, b as WebSocketDisconnectReason } from './disconnectReason-Cctmg1SN.cjs';
|
|
8
|
+
import * as _band_ai_band_sdk_core from '@band-ai/band-sdk-core';
|
|
8
9
|
import { RetryTracker, RoomRoster } from '@band-ai/band-sdk-core';
|
|
9
10
|
|
|
10
11
|
interface TopicHandlers {
|
|
11
12
|
[event: string]: (payload: Record<string, unknown>) => Promise<void> | void;
|
|
12
13
|
}
|
|
14
|
+
interface JoinOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Exempts this topic's event delivery from any reconnect-buffering window
|
|
17
|
+
* a transport may hold events behind. Only a channel whose events must
|
|
18
|
+
* never wait on reconciliation (e.g. a control channel carrying session
|
|
19
|
+
* supersede notices) should set this.
|
|
20
|
+
*/
|
|
21
|
+
exemptFromBuffering?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One settled outcome of an automatic transport-level reconnect: every topic
|
|
25
|
+
* the transport owned when the socket reopened has since either rejoined or
|
|
26
|
+
* failed to. `attemptedTopics` fixes that generation's membership boundary;
|
|
27
|
+
* `joinedTopics` is its successful subset. Carries no transport-specific
|
|
28
|
+
* objects so every transport implementation can produce one.
|
|
29
|
+
*/
|
|
30
|
+
interface ReconnectSnapshot {
|
|
31
|
+
generation: number;
|
|
32
|
+
attemptedTopics: ReadonlySet<string>;
|
|
33
|
+
joinedTopics: ReadonlySet<string>;
|
|
34
|
+
}
|
|
35
|
+
type ReconnectObserver = (snapshot: ReconnectSnapshot) => Promise<void> | void;
|
|
13
36
|
interface StreamingTransport {
|
|
14
37
|
connect(): Promise<void>;
|
|
15
38
|
disconnect(): Promise<void>;
|
|
16
|
-
join(topic: string, handlers: TopicHandlers): Promise<void>;
|
|
39
|
+
join(topic: string, handlers: TopicHandlers, options?: JoinOptions): Promise<void>;
|
|
17
40
|
leave(topic: string): Promise<void>;
|
|
18
41
|
runForever(signal: AbortSignal): Promise<void>;
|
|
19
42
|
isConnected(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional: a transport that can observe its own automatic reconnects
|
|
45
|
+
* registers here. Omitted by transports (and test doubles) with no
|
|
46
|
+
* reconnect story of their own, so existing injected transports stay
|
|
47
|
+
* source-compatible. Returns an unsubscribe function.
|
|
48
|
+
*/
|
|
49
|
+
onReconnected?(observer: ReconnectObserver): () => void;
|
|
20
50
|
}
|
|
21
51
|
|
|
22
52
|
interface BandLinkOptions {
|
|
@@ -43,17 +73,22 @@ declare class BandLink implements AsyncIterable<PlatformEvent> {
|
|
|
43
73
|
readonly capabilities: AgentToolsCapabilities;
|
|
44
74
|
private readonly logger;
|
|
45
75
|
private readonly transport;
|
|
46
|
-
private readonly
|
|
76
|
+
private readonly subscriptionManager;
|
|
47
77
|
private readonly eventQueue;
|
|
48
78
|
private readonly waiters;
|
|
49
79
|
private connected;
|
|
50
80
|
private lastDisconnectReason;
|
|
51
81
|
private terminalDisconnectError;
|
|
82
|
+
private readonly connectFlight;
|
|
83
|
+
private readonly disconnectFlight;
|
|
84
|
+
private readonly session;
|
|
52
85
|
constructor(options: BandLinkOptions);
|
|
53
86
|
isConnected(): boolean;
|
|
54
87
|
getDisconnectReason(): WebSocketDisconnectReason | null;
|
|
55
88
|
connect(): Promise<void>;
|
|
89
|
+
private connectSession;
|
|
56
90
|
disconnect(): Promise<void>;
|
|
91
|
+
private disconnectSession;
|
|
57
92
|
runForever(signal: AbortSignal): Promise<void>;
|
|
58
93
|
private recordDisconnectReason;
|
|
59
94
|
private recordDisconnectError;
|
|
@@ -61,7 +96,6 @@ declare class BandLink implements AsyncIterable<PlatformEvent> {
|
|
|
61
96
|
subscribeAgentRooms(): Promise<void>;
|
|
62
97
|
subscribeRoom(roomId: string): Promise<void>;
|
|
63
98
|
unsubscribeRoom(roomId: string): Promise<void>;
|
|
64
|
-
private joinRoomTopics;
|
|
65
99
|
subscribeAgentContacts(): Promise<void>;
|
|
66
100
|
unsubscribeAgentContacts(): Promise<void>;
|
|
67
101
|
nextEvent(signal?: AbortSignal): Promise<PlatformEvent | null>;
|
|
@@ -80,6 +114,13 @@ declare class BandLink implements AsyncIterable<PlatformEvent> {
|
|
|
80
114
|
private emit;
|
|
81
115
|
}
|
|
82
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Per-turn activity indicator for a room's context.
|
|
119
|
+
*
|
|
120
|
+
* Not a lifecycle — see `ExecutionLifecycleState` in `runtime/lifecycle.ts` for
|
|
121
|
+
* whether the room's `Execution` is alive. The two vocabularies deliberately do
|
|
122
|
+
* not overlap.
|
|
123
|
+
*/
|
|
83
124
|
type ExecutionState = "starting" | "idle" | "processing";
|
|
84
125
|
interface ExecutionContextLink {
|
|
85
126
|
rest: AgentToolsRestApi;
|
|
@@ -117,6 +158,17 @@ declare class ExecutionContext {
|
|
|
117
158
|
private _llmInitialized;
|
|
118
159
|
private readonly _pendingSystemMessages;
|
|
119
160
|
constructor(options: ExecutionContextOptions);
|
|
161
|
+
/**
|
|
162
|
+
* What this room's turn handler is currently doing.
|
|
163
|
+
*
|
|
164
|
+
* This is the *per-turn activity* axis, not a lifecycle: it flips to
|
|
165
|
+
* `"processing"` while the adapter handles an event and back to `"idle"`
|
|
166
|
+
* afterwards. To ask whether the room's `Execution` is still alive at all,
|
|
167
|
+
* read `Execution.state` instead, which reports
|
|
168
|
+
* `"running" | "stopping" | "stopped" | "failed"`.
|
|
169
|
+
*
|
|
170
|
+
* @see Execution.state
|
|
171
|
+
*/
|
|
120
172
|
get state(): ExecutionState;
|
|
121
173
|
setState(state: ExecutionState): void;
|
|
122
174
|
getRetryTracker(): RetryTracker;
|
|
@@ -147,6 +199,66 @@ declare class ExecutionContext {
|
|
|
147
199
|
private trackDedup;
|
|
148
200
|
}
|
|
149
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Lifecycle of a startable/stoppable runtime owner.
|
|
204
|
+
*
|
|
205
|
+
* Shared by {@link Agent}, {@link PlatformRuntime} and {@link AgentRuntime}: the
|
|
206
|
+
* three components that expose an explicit `start()`/`stop()` pair.
|
|
207
|
+
*
|
|
208
|
+
* This describes whether the component is *alive*, not what it is currently
|
|
209
|
+
* doing for a single turn — see `ExecutionState` in `ExecutionContext.ts` for
|
|
210
|
+
* that other axis.
|
|
211
|
+
*
|
|
212
|
+
* Legal transitions:
|
|
213
|
+
*
|
|
214
|
+
* ```text
|
|
215
|
+
* not_started ─▶ starting ─▶ running ─▶ stopping ─▶ stopped ─┐
|
|
216
|
+
* │ │ │ │
|
|
217
|
+
* └───────────┴──────────┴──▶ failed ─────┤
|
|
218
|
+
* │
|
|
219
|
+
* starting ◀──────────────────────────────┘
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* `stopped` and `failed` are re-startable: a subsequent `start()` moves back to
|
|
223
|
+
* `starting`, which is what makes a previously failed teardown recoverable.
|
|
224
|
+
*/
|
|
225
|
+
type RuntimeLifecycleState = {
|
|
226
|
+
readonly status: "not_started";
|
|
227
|
+
} | {
|
|
228
|
+
readonly status: "starting";
|
|
229
|
+
} | {
|
|
230
|
+
readonly status: "running";
|
|
231
|
+
} | {
|
|
232
|
+
readonly status: "stopping";
|
|
233
|
+
} | {
|
|
234
|
+
readonly status: "stopped";
|
|
235
|
+
} | {
|
|
236
|
+
readonly status: "failed";
|
|
237
|
+
readonly error: Error;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Lifecycle of a single room's {@link Execution}.
|
|
241
|
+
*
|
|
242
|
+
* Narrower than {@link RuntimeLifecycleState} on purpose: an `Execution` starts
|
|
243
|
+
* processing in its constructor, so it can never occupy a `not_started` or
|
|
244
|
+
* `starting` state, and it is never restarted. Its state names deliberately do
|
|
245
|
+
* not overlap with `ExecutionState` (`"starting" | "idle" | "processing"`) so a
|
|
246
|
+
* bare status string is always attributable to one axis or the other.
|
|
247
|
+
*/
|
|
248
|
+
type ExecutionLifecycleState = {
|
|
249
|
+
readonly status: "running";
|
|
250
|
+
} | {
|
|
251
|
+
readonly status: "stopping";
|
|
252
|
+
}
|
|
253
|
+
/** `graceful` is `false` when `stop(timeoutMs)` timed out and detached the process loop. */
|
|
254
|
+
| {
|
|
255
|
+
readonly status: "stopped";
|
|
256
|
+
readonly graceful: boolean;
|
|
257
|
+
} | {
|
|
258
|
+
readonly status: "failed";
|
|
259
|
+
readonly error: Error;
|
|
260
|
+
};
|
|
261
|
+
|
|
150
262
|
interface PlatformRuntimeOptions {
|
|
151
263
|
agentId: string;
|
|
152
264
|
apiKey: string;
|
|
@@ -184,27 +296,60 @@ declare class PlatformRuntime implements AsyncDisposable {
|
|
|
184
296
|
private readonly _onParticipantRemoved?;
|
|
185
297
|
private readonly _roomFilter?;
|
|
186
298
|
private readonly _contextFactory?;
|
|
299
|
+
private readonly lifecycle;
|
|
187
300
|
private linkInstance?;
|
|
188
301
|
private initPromise;
|
|
189
302
|
private runtime?;
|
|
190
303
|
private contactHandler?;
|
|
191
304
|
private activeAdapter?;
|
|
192
|
-
private
|
|
305
|
+
private readonly startGate;
|
|
306
|
+
private readonly stopGate;
|
|
193
307
|
private _agentName;
|
|
194
308
|
private _agentDescription;
|
|
195
309
|
private contactsSubscribed;
|
|
196
310
|
constructor(options: PlatformRuntimeOptions);
|
|
311
|
+
/** Current lifecycle state of this runtime. */
|
|
312
|
+
get state(): RuntimeLifecycleState;
|
|
197
313
|
get link(): BandLink;
|
|
198
314
|
get name(): string;
|
|
199
315
|
get agentId(): string;
|
|
200
316
|
get description(): string;
|
|
201
317
|
get contactConfiguration(): ContactEventConfig | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Whether the contacts channel subscription is currently held.
|
|
320
|
+
*
|
|
321
|
+
* @deprecated Read {@link PlatformRuntime.state} for lifecycle questions: this
|
|
322
|
+
* flag is only ever `true` while the runtime is running and is cleared on
|
|
323
|
+
* teardown, so it conflates "contacts are subscribed" with "the runtime is
|
|
324
|
+
* alive".
|
|
325
|
+
*/
|
|
202
326
|
get isContactsSubscribed(): boolean;
|
|
203
327
|
initialize(): Promise<void>;
|
|
204
328
|
private doInitialize;
|
|
329
|
+
/**
|
|
330
|
+
* Connect the adapter to the platform.
|
|
331
|
+
*
|
|
332
|
+
* Repeated or concurrent calls join the in-flight start. Calling `start()`
|
|
333
|
+
* while a `stop()` is still in flight rejects with a {@link RuntimeStateError}.
|
|
334
|
+
* A successful start also re-arms teardown, so a runtime whose previous
|
|
335
|
+
* `stop()` failed can be shut down properly on the next attempt.
|
|
336
|
+
*/
|
|
205
337
|
start(adapter: FrameworkAdapter): Promise<void>;
|
|
338
|
+
private runStart;
|
|
339
|
+
private doStart;
|
|
340
|
+
/**
|
|
341
|
+
* Tear the runtime down and release the platform connection.
|
|
342
|
+
*
|
|
343
|
+
* A concurrent second call joins the in-flight teardown and mirrors its
|
|
344
|
+
* outcome — including rejecting with the *same* `Error` instance — rather than
|
|
345
|
+
* reporting a graceful shutdown it did not perform. A failed teardown does not
|
|
346
|
+
* disable future ones: a subsequent `start()` re-arms `stop()`.
|
|
347
|
+
*/
|
|
206
348
|
stop(timeoutMs?: number): Promise<boolean>;
|
|
349
|
+
private beginStop;
|
|
350
|
+
private runStop;
|
|
207
351
|
[Symbol.asyncDispose](): Promise<void>;
|
|
352
|
+
private recordStopFailure;
|
|
208
353
|
runForever(): Promise<void>;
|
|
209
354
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
210
355
|
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
@@ -220,7 +365,7 @@ interface RoomPresenceOptions {
|
|
|
220
365
|
}
|
|
221
366
|
type RoomPresenceJoinHandler = (roomId: string, payload: MetadataMap) => Promise<void>;
|
|
222
367
|
type RoomPresenceLeaveHandler = (roomId: string) => Promise<void>;
|
|
223
|
-
type RoomPresenceEventHandler = (roomId: string, event: MessageEvent | ParticipantAddedEvent | ParticipantRemovedEvent) => Promise<void>;
|
|
368
|
+
type RoomPresenceEventHandler = (roomId: string, event: MessageEvent | ParticipantAddedEvent | ParticipantRemovedEvent | ReconnectedEvent) => Promise<void>;
|
|
224
369
|
type RoomPresenceContactHandler = (event: ContactEvent) => Promise<void>;
|
|
225
370
|
declare class RoomPresence implements AsyncDisposable {
|
|
226
371
|
readonly roster: RoomRoster;
|
|
@@ -235,7 +380,7 @@ declare class RoomPresence implements AsyncDisposable {
|
|
|
235
380
|
private eventController;
|
|
236
381
|
private eventTask;
|
|
237
382
|
private contactsSubscribed;
|
|
238
|
-
private lifecycle;
|
|
383
|
+
private readonly lifecycle;
|
|
239
384
|
private readonly admissionInFlight;
|
|
240
385
|
private readonly lastSubscribeError;
|
|
241
386
|
constructor(options: RoomPresenceOptions);
|
|
@@ -250,13 +395,24 @@ declare class RoomPresence implements AsyncDisposable {
|
|
|
250
395
|
private awaitInFlightAdmission;
|
|
251
396
|
private performAdmission;
|
|
252
397
|
private completeAdmission;
|
|
253
|
-
private serialize;
|
|
254
398
|
private startBody;
|
|
399
|
+
private contextualWarnMessage;
|
|
400
|
+
private subscribeAgentRoomsChannel;
|
|
255
401
|
private subscribeContacts;
|
|
256
402
|
private stopBody;
|
|
257
403
|
private consumeEvents;
|
|
258
404
|
private handleRoomAdded;
|
|
259
405
|
private handleRoomRemoved;
|
|
406
|
+
/** Unsubscribes the transport topic and clears any remembered subscribe failure for `roomId`. */
|
|
407
|
+
private leaveRoomTracking;
|
|
408
|
+
/**
|
|
409
|
+
* A REST fetch failure here must not blank the roster — it forwards the
|
|
410
|
+
* reconnect to every currently tracked room regardless, so each room's
|
|
411
|
+
* `Execution` can still re-run its `/next` synchronization even when
|
|
412
|
+
* membership reconciliation itself has to wait for the next reconnect.
|
|
413
|
+
*/
|
|
414
|
+
private handleReconnected;
|
|
415
|
+
private reconcileRoomsWithSnapshot;
|
|
260
416
|
private unsubscribeRoom;
|
|
261
417
|
private subscribeExistingRooms;
|
|
262
418
|
}
|
|
@@ -296,15 +452,44 @@ declare class AgentRuntime {
|
|
|
296
452
|
private readonly executions;
|
|
297
453
|
private readonly executionWatchers;
|
|
298
454
|
private readonly logger;
|
|
299
|
-
private
|
|
300
|
-
private
|
|
301
|
-
private
|
|
455
|
+
private readonly stoppedSignal;
|
|
456
|
+
private readonly lifecycle;
|
|
457
|
+
private readonly startGate;
|
|
458
|
+
private readonly stopGate;
|
|
302
459
|
constructor(options: AgentRuntimeOptions);
|
|
460
|
+
/** Current lifecycle state of this runtime. */
|
|
461
|
+
get state(): RuntimeLifecycleState;
|
|
462
|
+
/**
|
|
463
|
+
* Connect, subscribe, and begin consuming platform events.
|
|
464
|
+
*
|
|
465
|
+
* Repeated or concurrent calls join the in-flight start instead of starting a
|
|
466
|
+
* second consume loop. Calling `start()` while a `stop()` is still in flight
|
|
467
|
+
* rejects with a `RuntimeStateError`.
|
|
468
|
+
*/
|
|
303
469
|
start(): Promise<void>;
|
|
470
|
+
private runStart;
|
|
471
|
+
private finishFailedStart;
|
|
304
472
|
private handleStartFailure;
|
|
473
|
+
/**
|
|
474
|
+
* Tear the runtime down.
|
|
475
|
+
*
|
|
476
|
+
* A concurrent second call joins the in-flight teardown and mirrors its
|
|
477
|
+
* outcome — including rejecting with the *same* `Error` instance — instead of
|
|
478
|
+
* reporting a shutdown it did not perform.
|
|
479
|
+
*/
|
|
305
480
|
stop(timeoutMs?: number): Promise<boolean>;
|
|
481
|
+
private runStop;
|
|
482
|
+
private performStop;
|
|
306
483
|
getContext(roomId: string): ExecutionContext | undefined;
|
|
484
|
+
/**
|
|
485
|
+
* Resolve once the runtime has actually stopped, or reject with the fatal
|
|
486
|
+
* error that ended it.
|
|
487
|
+
*
|
|
488
|
+
* A runtime that was never started stays pending until it stops or fails;
|
|
489
|
+
* starting it does not resolve a pending wait.
|
|
490
|
+
*/
|
|
307
491
|
waitUntilStopped(): Promise<void>;
|
|
492
|
+
private markFailed;
|
|
308
493
|
getContexts(): ExecutionContext[];
|
|
309
494
|
enqueueEvent(roomId: string, event: PlatformEvent): Promise<void>;
|
|
310
495
|
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
@@ -508,12 +693,12 @@ declare const TOOL_MODELS: {
|
|
|
508
693
|
};
|
|
509
694
|
readonly scope: {
|
|
510
695
|
readonly type: "string";
|
|
511
|
-
readonly enum: readonly ["subject", "organization", "all"];
|
|
512
|
-
readonly description:
|
|
696
|
+
readonly enum: readonly ["agent", "subject", "organization", "all"];
|
|
697
|
+
readonly description: string;
|
|
513
698
|
};
|
|
514
699
|
readonly system: {
|
|
515
700
|
readonly type: "string";
|
|
516
|
-
readonly enum: readonly
|
|
701
|
+
readonly enum: readonly _band_ai_band_sdk_core.MemorySystem[];
|
|
517
702
|
readonly description: "Filter by memory system.";
|
|
518
703
|
};
|
|
519
704
|
readonly type: {
|
|
@@ -553,7 +738,7 @@ declare const TOOL_MODELS: {
|
|
|
553
738
|
};
|
|
554
739
|
readonly system: {
|
|
555
740
|
readonly type: "string";
|
|
556
|
-
readonly enum: readonly
|
|
741
|
+
readonly enum: readonly _band_ai_band_sdk_core.MemorySystem[];
|
|
557
742
|
readonly description: "Memory system tier.";
|
|
558
743
|
};
|
|
559
744
|
readonly type: {
|
|
@@ -572,12 +757,12 @@ declare const TOOL_MODELS: {
|
|
|
572
757
|
};
|
|
573
758
|
readonly scope: {
|
|
574
759
|
readonly type: "string";
|
|
575
|
-
readonly enum: readonly ["subject", "organization"];
|
|
576
|
-
readonly description:
|
|
760
|
+
readonly enum: readonly ["agent", "subject", "organization"];
|
|
761
|
+
readonly description: string;
|
|
577
762
|
};
|
|
578
763
|
readonly subject_id: {
|
|
579
764
|
readonly type: "string";
|
|
580
|
-
readonly description: "UUID of the subject this memory is about (required for subject scope).";
|
|
765
|
+
readonly description: "UUID of the subject this memory is about (required for subject scope; omit for agent scope).";
|
|
581
766
|
};
|
|
582
767
|
readonly metadata: {
|
|
583
768
|
readonly type: "object";
|
|
@@ -628,4 +813,4 @@ declare const MCP_SERVER_NAME = "band";
|
|
|
628
813
|
declare function mcpToolNames(names: Set<string>): string[];
|
|
629
814
|
declare function getToolDescription(name: string): string;
|
|
630
815
|
|
|
631
|
-
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P,
|
|
816
|
+
export { AgentRuntime as A, BandLink as B, CHAT_TOOL_NAMES as C, DefaultPreprocessor as D, type ExecutionContextOptions as E, MCP_SERVER_NAME as M, PlatformRuntime as P, type RuntimeLifecycleState as R, TOOL_MODELS as T, type PlatformRuntimeOptions as a, type ExecutionLifecycleState as b, MCP_TOOL_PREFIX as c, deriveDefaultRestUrl as d, ExecutionContext as e, ALL_TOOL_NAMES as f, BASE_TOOL_NAMES as g, CONTACT_TOOL_NAMES as h, type ExecutionState as i, MEMORY_TOOL_NAMES as j, RoomPresence as k, getToolDescription as l, mcpToolNames as m };
|