@band-ai/sdk 0.1.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/CodexAdapter-A1k_LMdZ.d.ts +1278 -0
- package/dist/CodexAdapter-BbZD-nBd.d.cts +1278 -0
- package/dist/adapters.cjs +10643 -0
- package/dist/adapters.d.cts +217 -0
- package/dist/adapters.d.ts +217 -0
- package/dist/adapters.js +92 -0
- package/dist/backends-BnOLsG7w.d.cts +20 -0
- package/dist/backends-C4n6cKOf.d.ts +20 -0
- package/dist/chunk-3BKAC4OZ.js +44 -0
- package/dist/chunk-5CXIMAH2.js +52 -0
- package/dist/chunk-6AJA2OPC.js +3682 -0
- package/dist/chunk-A3TDK6GP.js +6674 -0
- package/dist/chunk-AVVDPXP4.js +39 -0
- package/dist/chunk-EDPKUUJL.js +177 -0
- package/dist/chunk-FUODYQRE.js +2562 -0
- package/dist/chunk-GVEQ3RAH.js +373 -0
- package/dist/chunk-INA6YZTZ.js +88 -0
- package/dist/chunk-IZPV6QS6.js +115 -0
- package/dist/chunk-LY55KYVI.js +0 -0
- package/dist/chunk-NIAQBANR.js +577 -0
- package/dist/chunk-OD2G5LFQ.js +78 -0
- package/dist/chunk-SFVKOEQH.js +103 -0
- package/dist/chunk-SG4WLD2H.js +1093 -0
- package/dist/chunk-YR3BOQNW.js +39 -0
- package/dist/chunk-ZZJRRBPQ.js +82 -0
- package/dist/claude-CcnQ5OUC.d.ts +53 -0
- package/dist/claude-CwTAxhwI.d.cts +53 -0
- package/dist/config.cjs +164 -0
- package/dist/config.d.cts +19 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +9 -0
- package/dist/converters.cjs +1086 -0
- package/dist/converters.d.cts +143 -0
- package/dist/converters.d.ts +143 -0
- package/dist/converters.js +468 -0
- package/dist/core.cjs +185 -0
- package/dist/core.d.cts +22 -0
- package/dist/core.d.ts +22 -0
- package/dist/core.js +24 -0
- package/dist/customTools-BzF0IISO.d.cts +10 -0
- package/dist/customTools-BzF0IISO.d.ts +10 -0
- package/dist/dtos-DUpbIu8k.d.cts +163 -0
- package/dist/dtos-DUpbIu8k.d.ts +163 -0
- package/dist/history-ByessXNq.d.ts +24 -0
- package/dist/history-i6yN7neC.d.cts +24 -0
- package/dist/index.cjs +13914 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +198 -0
- package/dist/linear.cjs +2207 -0
- package/dist/linear.d.cts +167 -0
- package/dist/linear.d.ts +167 -0
- package/dist/linear.js +2139 -0
- package/dist/logger-CABQOnlR.d.cts +21 -0
- package/dist/logger-CABQOnlR.d.ts +21 -0
- package/dist/mcp-claude.cjs +584 -0
- package/dist/mcp-claude.d.cts +4 -0
- package/dist/mcp-claude.d.ts +4 -0
- package/dist/mcp-claude.js +11 -0
- package/dist/mcp.cjs +1247 -0
- package/dist/mcp.d.cts +97 -0
- package/dist/mcp.d.ts +97 -0
- package/dist/mcp.js +27 -0
- package/dist/opencode-BBcDchcN.d.cts +159 -0
- package/dist/opencode-DthQQUsZ.d.ts +159 -0
- package/dist/pagination-BPiys10t.d.cts +25 -0
- package/dist/pagination-CcDkVFxK.d.ts +25 -0
- package/dist/protocols-CInhtFpA.d.cts +116 -0
- package/dist/protocols-DrhzOH6K.d.ts +116 -0
- package/dist/rest.cjs +1159 -0
- package/dist/rest.d.cts +144 -0
- package/dist/rest.d.ts +144 -0
- package/dist/rest.js +18 -0
- package/dist/runtime.cjs +5353 -0
- package/dist/runtime.d.cts +276 -0
- package/dist/runtime.d.ts +276 -0
- package/dist/runtime.js +274 -0
- package/dist/schemas-BpEBkq5V.d.cts +592 -0
- package/dist/schemas-vos1AaBc.d.ts +592 -0
- package/dist/sdk-HJUVSSWA.js +10 -0
- package/dist/simpleAdapter-9OE_p6QW.d.ts +29 -0
- package/dist/simpleAdapter-DqhvjsGr.d.cts +29 -0
- package/dist/testing.cjs +217 -0
- package/dist/testing.d.cts +126 -0
- package/dist/testing.d.ts +126 -0
- package/dist/testing.js +186 -0
- package/dist/types-7jVzOeOP.d.ts +446 -0
- package/dist/types-CSHFipIc.d.cts +331 -0
- package/dist/types-CovcHpYf.d.cts +446 -0
- package/dist/types-CxII3XkA.d.ts +331 -0
- package/package.json +189 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { F as FrameworkAdapter } from './protocols-CInhtFpA.cjs';
|
|
2
|
+
export { A as AdapterToolsProtocol, a as AgentToolsProtocol, C as ContactTools, b as FrameworkAdapterInput, H as HistoryConverter, M as MemoryTools, c as MessagingTools, P as ParticipantTools, d as PeerLookupTools, e as Preprocessor, R as RoomParticipantTools, T as ToolExecutor, f as ToolSchemaProvider } from './protocols-CInhtFpA.cjs';
|
|
3
|
+
import { AgentCredentials } from './config.cjs';
|
|
4
|
+
export { AgentConfigResult, LoadAgentConfigFromEnvOptions, loadAgentConfig, loadAgentConfigFromEnv } from './config.cjs';
|
|
5
|
+
import { P as PlatformRuntime, a as PlatformRuntimeOptions } from './schemas-BpEBkq5V.cjs';
|
|
6
|
+
export { A as AgentRuntime, D as DefaultPreprocessor, E as ExecutionContextOptions, M as MCP_TOOL_PREFIX, T as TOOL_MODELS, b as ThenvoiLink } from './schemas-BpEBkq5V.cjs';
|
|
7
|
+
import { P as PlatformMessage } from './types-CovcHpYf.cjs';
|
|
8
|
+
export { A as AgentConfig, a as AgentInput, C as ContactEvent, b as ContactEventCallback, c as ContactEventConfig, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, f as PlatformEvent, S as SessionConfig } from './types-CovcHpYf.cjs';
|
|
9
|
+
export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as AnthropicAdapter, d as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, e as CODEX_REASONING_SUMMARIES, f as CODEX_WEB_SEARCH_MODES, g as ClaudePermissionMode, h as ClaudeSDKAdapter, i as ClaudeSDKAdapterOptions, j as CodexAdapter, k as CodexAdapterConfig, l as CodexApprovalPolicy, m as CodexReasoningEffort, n as CodexReasoningSummary, o as CodexSandboxMode, p as CodexWebSearchMode, G as GeminiAdapter, q as GeminiAdapterOptions, r as GenericAdapter, s as GenericAdapterHandler, t as GoogleADKAdapter, u as GoogleADKAdapterOptions, L as LangGraphAdapter, v as LangGraphAdapterOptions, w as LangGraphGraph, x as LettaAdapter, y as LettaAdapterOptions, O as OpenAIAdapter, z as OpenAIAdapterOptions, B as OpencodeAdapter, D as OpencodeAdapterConfig, E as OpencodeApprovalMode, F as OpencodeApprovalReply, H as OpencodeQuestionMode, P as ParlantAdapter, I as ParlantAdapterOptions, T as ToolCallingModel, V as VercelAISDKAdapter, J as VercelAISDKAdapterOptions } from './CodexAdapter-BbZD-nBd.cjs';
|
|
10
|
+
export { S as SimpleAdapter } from './simpleAdapter-DqhvjsGr.cjs';
|
|
11
|
+
export { A as A2AAuth, a as A2AGatewayAdapterOptions } from './opencode-BBcDchcN.cjs';
|
|
12
|
+
import './dtos-DUpbIu8k.cjs';
|
|
13
|
+
import './logger-CABQOnlR.cjs';
|
|
14
|
+
import './types-CSHFipIc.cjs';
|
|
15
|
+
import './pagination-BPiys10t.cjs';
|
|
16
|
+
import 'zod';
|
|
17
|
+
import './customTools-BzF0IISO.cjs';
|
|
18
|
+
import './backends-BnOLsG7w.cjs';
|
|
19
|
+
import './claude-CwTAxhwI.cjs';
|
|
20
|
+
import '@anthropic-ai/claude-agent-sdk';
|
|
21
|
+
|
|
22
|
+
interface AgentCreateOptions extends Omit<PlatformRuntimeOptions, "agentId" | "apiKey" | "wsUrl" | "restUrl"> {
|
|
23
|
+
adapter: FrameworkAdapter;
|
|
24
|
+
config?: AgentCredentials;
|
|
25
|
+
agentId?: string;
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
wsUrl?: string;
|
|
28
|
+
restUrl?: string;
|
|
29
|
+
shutdownTimeoutMs?: number | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Top-level handle for a Thenvoi agent.
|
|
33
|
+
*
|
|
34
|
+
* Use {@link Agent.create} to build an instance from config + adapter,
|
|
35
|
+
* then call {@link Agent.run} to connect to the platform and handle messages.
|
|
36
|
+
*/
|
|
37
|
+
declare class Agent {
|
|
38
|
+
private readonly platformRuntime;
|
|
39
|
+
private readonly adapter;
|
|
40
|
+
private started;
|
|
41
|
+
private startPromise;
|
|
42
|
+
private shutdownTimeoutMs;
|
|
43
|
+
constructor(runtime: PlatformRuntime, adapter: FrameworkAdapter);
|
|
44
|
+
/** Build an Agent from credentials and a framework adapter. */
|
|
45
|
+
static create(options: AgentCreateOptions): Agent;
|
|
46
|
+
get isRunning(): boolean;
|
|
47
|
+
get runtime(): PlatformRuntime;
|
|
48
|
+
start(): Promise<void>;
|
|
49
|
+
stop(timeoutMs?: number | null): Promise<boolean>;
|
|
50
|
+
runForever(): Promise<void>;
|
|
51
|
+
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
52
|
+
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
53
|
+
/** Start the agent, listen for messages, and block until shutdown. Registers SIGINT/SIGTERM handlers by default. */
|
|
54
|
+
run(options?: {
|
|
55
|
+
shutdownTimeoutMs?: number | null;
|
|
56
|
+
signals?: boolean;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
withLifecycle<T>(handler: (agent: Agent) => Promise<T>): Promise<T>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare function isDirectExecution(importMetaUrl: string): boolean;
|
|
62
|
+
|
|
63
|
+
export { Agent, type AgentCreateOptions, AgentCredentials, FrameworkAdapter, PlatformMessage, PlatformRuntime, PlatformRuntimeOptions, isDirectExecution };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { F as FrameworkAdapter } from './protocols-DrhzOH6K.js';
|
|
2
|
+
export { A as AdapterToolsProtocol, a as AgentToolsProtocol, C as ContactTools, b as FrameworkAdapterInput, H as HistoryConverter, M as MemoryTools, c as MessagingTools, P as ParticipantTools, d as PeerLookupTools, e as Preprocessor, R as RoomParticipantTools, T as ToolExecutor, f as ToolSchemaProvider } from './protocols-DrhzOH6K.js';
|
|
3
|
+
import { AgentCredentials } from './config.js';
|
|
4
|
+
export { AgentConfigResult, LoadAgentConfigFromEnvOptions, loadAgentConfig, loadAgentConfigFromEnv } from './config.js';
|
|
5
|
+
import { P as PlatformRuntime, a as PlatformRuntimeOptions } from './schemas-vos1AaBc.js';
|
|
6
|
+
export { A as AgentRuntime, D as DefaultPreprocessor, E as ExecutionContextOptions, M as MCP_TOOL_PREFIX, T as TOOL_MODELS, b as ThenvoiLink } from './schemas-vos1AaBc.js';
|
|
7
|
+
import { P as PlatformMessage } from './types-7jVzOeOP.js';
|
|
8
|
+
export { A as AgentConfig, a as AgentInput, C as ContactEvent, b as ContactEventCallback, c as ContactEventConfig, d as ContactEventStrategy, e as ConversationContext, H as HistoryProvider, M as MessageHandler, f as PlatformEvent, S as SessionConfig } from './types-7jVzOeOP.js';
|
|
9
|
+
export { A as A2AAdapter, a as A2AAdapterOptions, b as A2AGatewayAdapter, c as AnthropicAdapter, d as AnthropicAdapterOptions, C as CODEX_REASONING_EFFORTS, e as CODEX_REASONING_SUMMARIES, f as CODEX_WEB_SEARCH_MODES, g as ClaudePermissionMode, h as ClaudeSDKAdapter, i as ClaudeSDKAdapterOptions, j as CodexAdapter, k as CodexAdapterConfig, l as CodexApprovalPolicy, m as CodexReasoningEffort, n as CodexReasoningSummary, o as CodexSandboxMode, p as CodexWebSearchMode, G as GeminiAdapter, q as GeminiAdapterOptions, r as GenericAdapter, s as GenericAdapterHandler, t as GoogleADKAdapter, u as GoogleADKAdapterOptions, L as LangGraphAdapter, v as LangGraphAdapterOptions, w as LangGraphGraph, x as LettaAdapter, y as LettaAdapterOptions, O as OpenAIAdapter, z as OpenAIAdapterOptions, B as OpencodeAdapter, D as OpencodeAdapterConfig, E as OpencodeApprovalMode, F as OpencodeApprovalReply, H as OpencodeQuestionMode, P as ParlantAdapter, I as ParlantAdapterOptions, T as ToolCallingModel, V as VercelAISDKAdapter, J as VercelAISDKAdapterOptions } from './CodexAdapter-A1k_LMdZ.js';
|
|
10
|
+
export { S as SimpleAdapter } from './simpleAdapter-9OE_p6QW.js';
|
|
11
|
+
export { A as A2AAuth, a as A2AGatewayAdapterOptions } from './opencode-DthQQUsZ.js';
|
|
12
|
+
import './dtos-DUpbIu8k.js';
|
|
13
|
+
import './logger-CABQOnlR.js';
|
|
14
|
+
import './types-CxII3XkA.js';
|
|
15
|
+
import './pagination-CcDkVFxK.js';
|
|
16
|
+
import 'zod';
|
|
17
|
+
import './customTools-BzF0IISO.js';
|
|
18
|
+
import './backends-C4n6cKOf.js';
|
|
19
|
+
import './claude-CcnQ5OUC.js';
|
|
20
|
+
import '@anthropic-ai/claude-agent-sdk';
|
|
21
|
+
|
|
22
|
+
interface AgentCreateOptions extends Omit<PlatformRuntimeOptions, "agentId" | "apiKey" | "wsUrl" | "restUrl"> {
|
|
23
|
+
adapter: FrameworkAdapter;
|
|
24
|
+
config?: AgentCredentials;
|
|
25
|
+
agentId?: string;
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
wsUrl?: string;
|
|
28
|
+
restUrl?: string;
|
|
29
|
+
shutdownTimeoutMs?: number | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Top-level handle for a Thenvoi agent.
|
|
33
|
+
*
|
|
34
|
+
* Use {@link Agent.create} to build an instance from config + adapter,
|
|
35
|
+
* then call {@link Agent.run} to connect to the platform and handle messages.
|
|
36
|
+
*/
|
|
37
|
+
declare class Agent {
|
|
38
|
+
private readonly platformRuntime;
|
|
39
|
+
private readonly adapter;
|
|
40
|
+
private started;
|
|
41
|
+
private startPromise;
|
|
42
|
+
private shutdownTimeoutMs;
|
|
43
|
+
constructor(runtime: PlatformRuntime, adapter: FrameworkAdapter);
|
|
44
|
+
/** Build an Agent from credentials and a framework adapter. */
|
|
45
|
+
static create(options: AgentCreateOptions): Agent;
|
|
46
|
+
get isRunning(): boolean;
|
|
47
|
+
get runtime(): PlatformRuntime;
|
|
48
|
+
start(): Promise<void>;
|
|
49
|
+
stop(timeoutMs?: number | null): Promise<boolean>;
|
|
50
|
+
runForever(): Promise<void>;
|
|
51
|
+
bootstrapRoomMessage(roomId: string, message: PlatformMessage): Promise<void>;
|
|
52
|
+
resetRoomSession(roomId: string, timeoutMs?: number): Promise<boolean>;
|
|
53
|
+
/** Start the agent, listen for messages, and block until shutdown. Registers SIGINT/SIGTERM handlers by default. */
|
|
54
|
+
run(options?: {
|
|
55
|
+
shutdownTimeoutMs?: number | null;
|
|
56
|
+
signals?: boolean;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
withLifecycle<T>(handler: (agent: Agent) => Promise<T>): Promise<T>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare function isDirectExecution(importMetaUrl: string): boolean;
|
|
62
|
+
|
|
63
|
+
export { Agent, type AgentCreateOptions, AgentCredentials, FrameworkAdapter, PlatformMessage, PlatformRuntime, PlatformRuntimeOptions, isDirectExecution };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnthropicAdapter,
|
|
3
|
+
CODEX_REASONING_EFFORTS,
|
|
4
|
+
CODEX_REASONING_SUMMARIES,
|
|
5
|
+
CODEX_WEB_SEARCH_MODES,
|
|
6
|
+
ClaudeSDKAdapter,
|
|
7
|
+
CodexAdapter,
|
|
8
|
+
GeminiAdapter,
|
|
9
|
+
GenericAdapter,
|
|
10
|
+
GoogleADKAdapter,
|
|
11
|
+
LangGraphAdapter,
|
|
12
|
+
LettaAdapter,
|
|
13
|
+
OpenAIAdapter,
|
|
14
|
+
OpencodeAdapter,
|
|
15
|
+
VercelAISDKAdapter
|
|
16
|
+
} from "./chunk-A3TDK6GP.js";
|
|
17
|
+
import "./chunk-NIAQBANR.js";
|
|
18
|
+
import "./chunk-LY55KYVI.js";
|
|
19
|
+
import "./chunk-5CXIMAH2.js";
|
|
20
|
+
import "./chunk-EDPKUUJL.js";
|
|
21
|
+
import {
|
|
22
|
+
loadAgentConfig,
|
|
23
|
+
loadAgentConfigFromEnv
|
|
24
|
+
} from "./chunk-IZPV6QS6.js";
|
|
25
|
+
import {
|
|
26
|
+
A2AAdapter,
|
|
27
|
+
A2AGatewayAdapter,
|
|
28
|
+
ParlantAdapter
|
|
29
|
+
} from "./chunk-FUODYQRE.js";
|
|
30
|
+
import {
|
|
31
|
+
SimpleAdapter
|
|
32
|
+
} from "./chunk-AVVDPXP4.js";
|
|
33
|
+
import {
|
|
34
|
+
AgentRuntime,
|
|
35
|
+
DefaultPreprocessor,
|
|
36
|
+
PlatformRuntime,
|
|
37
|
+
ThenvoiLink,
|
|
38
|
+
runWithGracefulShutdown
|
|
39
|
+
} from "./chunk-6AJA2OPC.js";
|
|
40
|
+
import "./chunk-INA6YZTZ.js";
|
|
41
|
+
import {
|
|
42
|
+
MCP_TOOL_PREFIX,
|
|
43
|
+
TOOL_MODELS
|
|
44
|
+
} from "./chunk-GVEQ3RAH.js";
|
|
45
|
+
import "./chunk-SFVKOEQH.js";
|
|
46
|
+
import "./chunk-SG4WLD2H.js";
|
|
47
|
+
import "./chunk-ZZJRRBPQ.js";
|
|
48
|
+
import "./chunk-3BKAC4OZ.js";
|
|
49
|
+
import "./chunk-OD2G5LFQ.js";
|
|
50
|
+
import "./chunk-YR3BOQNW.js";
|
|
51
|
+
|
|
52
|
+
// src/agent/Agent.ts
|
|
53
|
+
var Agent = class _Agent {
|
|
54
|
+
platformRuntime;
|
|
55
|
+
adapter;
|
|
56
|
+
started = false;
|
|
57
|
+
startPromise = null;
|
|
58
|
+
shutdownTimeoutMs = 3e4;
|
|
59
|
+
constructor(runtime, adapter) {
|
|
60
|
+
this.platformRuntime = runtime;
|
|
61
|
+
this.adapter = adapter;
|
|
62
|
+
}
|
|
63
|
+
/** Build an Agent from credentials and a framework adapter. */
|
|
64
|
+
static create(options) {
|
|
65
|
+
const {
|
|
66
|
+
adapter,
|
|
67
|
+
config,
|
|
68
|
+
agentId,
|
|
69
|
+
apiKey,
|
|
70
|
+
wsUrl,
|
|
71
|
+
restUrl,
|
|
72
|
+
shutdownTimeoutMs,
|
|
73
|
+
...runtimeOptions
|
|
74
|
+
} = options;
|
|
75
|
+
const runtime = new PlatformRuntime({
|
|
76
|
+
...runtimeOptions,
|
|
77
|
+
agentId: agentId ?? config?.agentId ?? "",
|
|
78
|
+
apiKey: apiKey ?? config?.apiKey ?? "",
|
|
79
|
+
...wsUrl !== void 0 || config?.wsUrl !== void 0 ? { wsUrl: wsUrl ?? config?.wsUrl } : {},
|
|
80
|
+
...restUrl !== void 0 || config?.restUrl !== void 0 ? { restUrl: restUrl ?? config?.restUrl } : {}
|
|
81
|
+
});
|
|
82
|
+
const agent = new _Agent(runtime, adapter);
|
|
83
|
+
agent.shutdownTimeoutMs = shutdownTimeoutMs === void 0 ? 3e4 : shutdownTimeoutMs;
|
|
84
|
+
return agent;
|
|
85
|
+
}
|
|
86
|
+
get isRunning() {
|
|
87
|
+
return this.started;
|
|
88
|
+
}
|
|
89
|
+
get runtime() {
|
|
90
|
+
return this.platformRuntime;
|
|
91
|
+
}
|
|
92
|
+
async start() {
|
|
93
|
+
if (this.startPromise) {
|
|
94
|
+
return this.startPromise;
|
|
95
|
+
}
|
|
96
|
+
this.startPromise = this.platformRuntime.start(this.adapter).then(() => {
|
|
97
|
+
this.started = true;
|
|
98
|
+
}).catch((error) => {
|
|
99
|
+
this.startPromise = null;
|
|
100
|
+
throw error;
|
|
101
|
+
});
|
|
102
|
+
return this.startPromise;
|
|
103
|
+
}
|
|
104
|
+
async stop(timeoutMs) {
|
|
105
|
+
if (!this.started && !this.startPromise) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (!this.started && this.startPromise) {
|
|
109
|
+
try {
|
|
110
|
+
await this.startPromise;
|
|
111
|
+
} catch {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
return await this.platformRuntime.stop(timeoutMs ?? void 0);
|
|
117
|
+
} finally {
|
|
118
|
+
this.started = false;
|
|
119
|
+
this.startPromise = null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async runForever() {
|
|
123
|
+
await this.platformRuntime.runForever();
|
|
124
|
+
}
|
|
125
|
+
async bootstrapRoomMessage(roomId, message) {
|
|
126
|
+
await this.platformRuntime.bootstrapRoomMessage(roomId, message);
|
|
127
|
+
}
|
|
128
|
+
async resetRoomSession(roomId, timeoutMs) {
|
|
129
|
+
return await this.platformRuntime.resetRoomSession(roomId, timeoutMs);
|
|
130
|
+
}
|
|
131
|
+
/** Start the agent, listen for messages, and block until shutdown. Registers SIGINT/SIGTERM handlers by default. */
|
|
132
|
+
async run(options) {
|
|
133
|
+
if (options?.shutdownTimeoutMs !== void 0) {
|
|
134
|
+
this.shutdownTimeoutMs = options.shutdownTimeoutMs;
|
|
135
|
+
}
|
|
136
|
+
const useSignals = options?.signals ?? true;
|
|
137
|
+
if (useSignals) {
|
|
138
|
+
await runWithGracefulShutdown(this, {
|
|
139
|
+
timeoutMs: this.shutdownTimeoutMs
|
|
140
|
+
});
|
|
141
|
+
} else {
|
|
142
|
+
await this.start();
|
|
143
|
+
try {
|
|
144
|
+
await this.platformRuntime.runForever();
|
|
145
|
+
} finally {
|
|
146
|
+
await this.stop(this.shutdownTimeoutMs);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async withLifecycle(handler) {
|
|
151
|
+
await this.start();
|
|
152
|
+
try {
|
|
153
|
+
return await handler(this);
|
|
154
|
+
} finally {
|
|
155
|
+
await this.stop(this.shutdownTimeoutMs);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/core/isDirectExecution.ts
|
|
161
|
+
import { pathToFileURL } from "url";
|
|
162
|
+
function isDirectExecution(importMetaUrl) {
|
|
163
|
+
const entry = process.argv[1];
|
|
164
|
+
if (!entry) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return importMetaUrl === pathToFileURL(entry).href;
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
A2AAdapter,
|
|
171
|
+
A2AGatewayAdapter,
|
|
172
|
+
Agent,
|
|
173
|
+
AgentRuntime,
|
|
174
|
+
AnthropicAdapter,
|
|
175
|
+
CODEX_REASONING_EFFORTS,
|
|
176
|
+
CODEX_REASONING_SUMMARIES,
|
|
177
|
+
CODEX_WEB_SEARCH_MODES,
|
|
178
|
+
ClaudeSDKAdapter,
|
|
179
|
+
CodexAdapter,
|
|
180
|
+
DefaultPreprocessor,
|
|
181
|
+
GeminiAdapter,
|
|
182
|
+
GenericAdapter,
|
|
183
|
+
GoogleADKAdapter,
|
|
184
|
+
LangGraphAdapter,
|
|
185
|
+
LettaAdapter,
|
|
186
|
+
MCP_TOOL_PREFIX,
|
|
187
|
+
OpenAIAdapter,
|
|
188
|
+
OpencodeAdapter,
|
|
189
|
+
ParlantAdapter,
|
|
190
|
+
PlatformRuntime,
|
|
191
|
+
SimpleAdapter,
|
|
192
|
+
TOOL_MODELS,
|
|
193
|
+
ThenvoiLink,
|
|
194
|
+
VercelAISDKAdapter,
|
|
195
|
+
isDirectExecution,
|
|
196
|
+
loadAgentConfig,
|
|
197
|
+
loadAgentConfigFromEnv
|
|
198
|
+
};
|