@openhex-ai/agent-sdk 0.0.1 → 0.1.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/dist/index.d.ts CHANGED
@@ -1,1070 +1,9 @@
1
- import { T as ToolName, S as SdkMcpServer } from './index-DOE19uln.js';
2
- export { A as AnySdkToolDefinition, B as BuiltinToolName, a as SdkToolDefinition, b as ToolResult, c as createSdkMcpServer, t as tool } from './index-DOE19uln.js';
1
+ import { C as ChatStreamRecord, H as HookCallback, a as HookMatcher, A as AgentOptions, S as SDKMessage } from './client-1lMkhPMb.js';
2
+ export { b as API_PREFIX, c as AgentChatClient, d as AgentDefinition, e as AgentDispatchResult, f as AgentRegistry, g as AgentTurn, h as CanUseTool, i as ChatRawEvent, j as ContentBlock, k as Conversation, G as GrantCreditsRequest, l as GrantCreditsResponse, m as HistoryPage, n as HookEvent, o as HookInput, p as HookOutput, q as HookRegistry, r as HttpClient, s as HttpClientConfig, t as HttpMcpServerConfig, I as InterruptResult, M as McpServerConfig, u as McpServerRegistry, v as MembersListResponse, w as MintSessionRequest, O as OpenhexClient, x as OpenhexClientConfig, y as OpenhexConnection, P as PermissionMode, z as PermissionResult, B as ProvisionMemberRequest, D as ProvisionMemberResponse, Q as Query, E as QueryParams, R as RequestOptions, F as SDKAssistantMessage, J as SDKPartialAssistantMessage, K as SDKResultMessage, L as SDKSystemMessage, N as SDKUserMessage, T as SendRequest, U as SendResult, V as SessionInfo, W as SessionTokenResponse, X as SettingSource, Y as SmsSendRequest, Z as SmsVerifyRequest, _ as StdioMcpServerConfig, $ as StreamOptions, a0 as TrainingChat, a1 as TrainingSendResult, a2 as TurnOptions, a3 as UsageInfo, a4 as Workspace, a5 as WorkspaceClient, a6 as WorkspaceMember, a7 as WorkspaceRequestOptions, a8 as WorkspaceWhoami, a9 as query } from './client-1lMkhPMb.js';
3
+ export { createSdkMcpServer, tool } from './tools/index.js';
4
+ export { A as AnySdkToolDefinition, B as BuiltinToolName, S as SdkMcpServer, a as SdkToolDefinition, T as ToolName, b as ToolResult } from './tools-DWFaPtFE.js';
3
5
  import 'zod';
4
6
 
5
- /**
6
- * Permission model for the Openhex Agent SDK.
7
- *
8
- * Controls which tools an agent may invoke and how approvals are
9
- * resolved. Mirrors the Claude Agent SDK permission surface so existing
10
- * mental models transfer directly.
11
- *
12
- * NOTE: scaffold only — types are stable, runtime enforcement is wired
13
- * up in a follow-up MR.
14
- */
15
- /**
16
- * How the agent loop treats tool calls that are not pre-approved.
17
- *
18
- * - `default` — prompt (via {@link CanUseTool}) for anything not allowlisted.
19
- * - `acceptEdits` — auto-approve file-editing tools (Write/Edit), prompt for the rest.
20
- * - `bypassPermissions` — run every tool without prompting. Use only in trusted automation.
21
- * - `plan` — read-only: the agent may plan but not mutate anything.
22
- */
23
- type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
24
- /** The result of a permission decision for a single tool call. */
25
- type PermissionResult = {
26
- behavior: 'allow';
27
- /** Optionally override the arguments the tool is invoked with. */
28
- updatedInput?: Record<string, unknown>;
29
- } | {
30
- behavior: 'deny';
31
- /** Human-readable reason surfaced back to the agent. */
32
- message?: string;
33
- };
34
- /**
35
- * Callback invoked when a tool call needs an approval decision.
36
- * Return an allow/deny result. When omitted, {@link PermissionMode}
37
- * governs the outcome.
38
- */
39
- type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
40
- signal?: AbortSignal;
41
- }) => Promise<PermissionResult> | PermissionResult;
42
-
43
- /**
44
- * Lifecycle hooks for the Openhex Agent SDK.
45
- *
46
- * Hooks run custom code at key points in the agent loop to validate,
47
- * log, block, or transform behavior. Mirrors the Claude Agent SDK hook
48
- * surface (PreToolUse, PostToolUse, Stop, ...).
49
- *
50
- * NOTE: scaffold only — hook dispatch is wired up in a follow-up MR.
51
- */
52
- /** The lifecycle events a hook can subscribe to. */
53
- type HookEvent = 'PreToolUse' | 'PostToolUse' | 'UserPromptSubmit' | 'Stop' | 'SubagentStop' | 'SessionStart' | 'SessionEnd';
54
- /** Input payload passed to a hook callback. Shape varies by event. */
55
- interface HookInput {
56
- event: HookEvent;
57
- sessionId: string;
58
- /** Present for tool-related events. */
59
- toolName?: string;
60
- toolInput?: Record<string, unknown>;
61
- toolResponse?: unknown;
62
- [key: string]: unknown;
63
- }
64
- /**
65
- * Value a hook may return to influence the loop.
66
- * An empty object is a no-op. `decision: 'block'` stops the pending
67
- * action and surfaces `reason` back to the agent.
68
- */
69
- interface HookOutput {
70
- decision?: 'block';
71
- reason?: string;
72
- /** Optionally rewrite the tool input before it executes (PreToolUse). */
73
- updatedInput?: Record<string, unknown>;
74
- }
75
- /** A single hook callback. */
76
- type HookCallback = (input: HookInput, toolUseId: string | undefined, context: {
77
- signal?: AbortSignal;
78
- }) => Promise<HookOutput> | HookOutput;
79
- /**
80
- * Binds one or more callbacks to a tool-name matcher (a regex string,
81
- * e.g. `"Edit|Write"`). Omit `matcher` to match every tool.
82
- */
83
- interface HookMatcher {
84
- matcher?: string;
85
- hooks: HookCallback[];
86
- }
87
- /** Map of event → matchers. Passed via {@link AgentOptions.hooks}. */
88
- type HookRegistry = Partial<Record<HookEvent, HookMatcher[]>>;
89
-
90
- /**
91
- * Subagent definitions.
92
- *
93
- * A subagent is a specialized agent the main agent can delegate focused
94
- * subtasks to (invoked via the built-in `Agent` tool). Mirrors the
95
- * Claude Agent SDK `AgentDefinition`.
96
- *
97
- * NOTE: scaffold only.
98
- */
99
-
100
- interface AgentDefinition {
101
- /** When the main agent should reach for this subagent. */
102
- description: string;
103
- /** System prompt that specializes the subagent. */
104
- prompt: string;
105
- /** Tools this subagent may use. Defaults to the parent's allowlist. */
106
- tools?: ToolName[];
107
- /** Optional per-subagent model override (e.g. a cheaper/faster model). */
108
- model?: string;
109
- }
110
- /** Map of subagent name → definition. Passed via {@link AgentOptions.agents}. */
111
- type AgentRegistry = Record<string, AgentDefinition>;
112
-
113
- /**
114
- * MCP (Model Context Protocol) server configuration.
115
- *
116
- * Connect agents to external systems — databases, browsers, APIs — over
117
- * MCP. Three transports are supported, mirroring the Claude Agent SDK:
118
- * - `stdio` : spawn a local process and talk over stdio
119
- * - `http` : a remote streamable-HTTP MCP server
120
- * - `sdk` : an in-process server defined with {@link createSdkMcpServer}
121
- *
122
- * NOTE: scaffold only — connection management lands in a follow-up MR.
123
- */
124
-
125
- interface StdioMcpServerConfig {
126
- type?: 'stdio';
127
- command: string;
128
- args?: string[];
129
- env?: Record<string, string>;
130
- }
131
- interface HttpMcpServerConfig {
132
- type: 'http';
133
- url: string;
134
- headers?: Record<string, string>;
135
- }
136
- /** Any MCP server config accepted by {@link AgentOptions.mcpServers}. */
137
- type McpServerConfig = StdioMcpServerConfig | HttpMcpServerConfig | SdkMcpServer;
138
- /** Map of server name → config. */
139
- type McpServerRegistry = Record<string, McpServerConfig>;
140
-
141
- /**
142
- * The options object accepted by {@link query} and {@link OpenhexClient}.
143
- *
144
- * Mirrors the Claude Agent SDK `ClaudeAgentOptions` so the surface is
145
- * familiar, with Openhex-specific connection fields added on top.
146
- *
147
- * NOTE: scaffold only — every field is typed; runtime wiring follows.
148
- */
149
-
150
- /** Where filesystem-based config (skills, commands, CLAUDE.md) is loaded from. */
151
- type SettingSource = 'user' | 'project' | 'local';
152
- /** Connection details for reaching the Openhex platform. */
153
- interface OpenhexConnection {
154
- /**
155
- * API key for the Openhex platform. Falls back to the
156
- * `OPENHEX_API_KEY` environment variable when omitted.
157
- */
158
- apiKey?: string;
159
- /**
160
- * Base URL of the Openhex API. Defaults to the production endpoint;
161
- * override for self-hosted or staging.
162
- */
163
- baseUrl?: string;
164
- /**
165
- * ID of a published platform agent to run against. When set, the
166
- * agent's persona, skills, and knowledge base are used as the base.
167
- */
168
- agentId?: string;
169
- }
170
- interface AgentOptions extends OpenhexConnection {
171
- /** Model id to run with (e.g. a platform model alias). */
172
- model?: string;
173
- /** System prompt — a string, or a preset reference with an append. */
174
- systemPrompt?: string | {
175
- preset: string;
176
- append?: string;
177
- };
178
- /** Tools the agent is allowed to use without prompting. */
179
- allowedTools?: ToolName[];
180
- /** Tools the agent may never use, even if otherwise allowed. */
181
- disallowedTools?: ToolName[];
182
- /** How unapproved tool calls are handled. @see PermissionMode */
183
- permissionMode?: PermissionMode;
184
- /** Programmatic per-call approval callback. */
185
- canUseTool?: CanUseTool;
186
- /** Lifecycle hooks. @see HookRegistry */
187
- hooks?: HookRegistry;
188
- /** Named subagents the main agent can delegate to. @see AgentRegistry */
189
- agents?: AgentRegistry;
190
- /** External + in-process MCP servers. @see McpServerRegistry */
191
- mcpServers?: McpServerRegistry;
192
- /** Working directory the agent operates in. Defaults to `process.cwd()`. */
193
- cwd?: string;
194
- /** Hard cap on agent loop turns before forcing a result. */
195
- maxTurns?: number;
196
- /** Resume a prior run by session id (continues with full context). */
197
- resume?: string;
198
- /** Fork from a prior session instead of mutating it. */
199
- forkSession?: boolean;
200
- /**
201
- * Which on-disk config sources to load. Defaults to none (no implicit
202
- * filesystem reads) — opt in explicitly for skills/commands/memory.
203
- */
204
- settingSources?: SettingSource[];
205
- /** Stream incremental assistant deltas as `stream_event` messages. */
206
- includePartialMessages?: boolean;
207
- /** Abort the run cooperatively. */
208
- signal?: AbortSignal;
209
- }
210
-
211
- /**
212
- * Session types.
213
- *
214
- * Sessions carry context across exchanges (files read, prior turns).
215
- * They can be resumed or forked via {@link AgentOptions.resume} /
216
- * {@link AgentOptions.forkSession}.
217
- *
218
- * NOTE: scaffold only — persistence backend wired up in a follow-up MR.
219
- */
220
- interface SessionInfo {
221
- sessionId: string;
222
- /** ISO-8601 creation timestamp. */
223
- createdAt: string;
224
- /** ISO-8601 timestamp of the last turn. */
225
- updatedAt: string;
226
- /** Number of turns recorded so far. */
227
- numTurns: number;
228
- /** The model the session is bound to. */
229
- model: string;
230
- }
231
-
232
- /**
233
- * Message types streamed out of an agent run.
234
- *
235
- * The {@link query} async iterator yields a stream of {@link SDKMessage}
236
- * values. Consumers narrow on the `type` discriminant. Mirrors the
237
- * Claude Agent SDK message surface.
238
- *
239
- * NOTE: scaffold only — shapes are intentionally close to the platform
240
- * wire format but may gain fields as the runtime is wired up.
241
- */
242
- /** A single block of assistant or user content. */
243
- type ContentBlock = {
244
- type: 'text';
245
- text: string;
246
- } | {
247
- type: 'tool_use';
248
- id: string;
249
- name: string;
250
- input: Record<string, unknown>;
251
- } | {
252
- type: 'tool_result';
253
- tool_use_id: string;
254
- content: unknown;
255
- is_error?: boolean;
256
- } | {
257
- type: 'image';
258
- source: {
259
- url: string;
260
- } | {
261
- data: string;
262
- media_type: string;
263
- };
264
- };
265
- /** Roll-up of tokens / cost for a run. */
266
- interface UsageInfo {
267
- inputTokens: number;
268
- outputTokens: number;
269
- cacheReadTokens?: number;
270
- cacheCreationTokens?: number;
271
- /** Total cost in USD, when the platform reports it. */
272
- totalCostUsd?: number;
273
- }
274
- /** Emitted once at the start of a run with the resolved session/config. */
275
- interface SDKSystemMessage {
276
- type: 'system';
277
- subtype: 'init';
278
- sessionId: string;
279
- model: string;
280
- tools: string[];
281
- permissionMode: string;
282
- }
283
- /** A full assistant turn (may contain text and/or tool_use blocks). */
284
- interface SDKAssistantMessage {
285
- type: 'assistant';
286
- sessionId: string;
287
- /** Set when this message originates inside a subagent's context. */
288
- parentToolUseId?: string;
289
- content: ContentBlock[];
290
- }
291
- /** A user turn — usually a tool_result fed back into the loop. */
292
- interface SDKUserMessage {
293
- type: 'user';
294
- sessionId: string;
295
- parentToolUseId?: string;
296
- content: ContentBlock[];
297
- }
298
- /** Incremental streaming delta of an in-flight assistant turn. */
299
- interface SDKPartialAssistantMessage {
300
- type: 'stream_event';
301
- sessionId: string;
302
- parentToolUseId?: string;
303
- /** Raw streaming delta (text chunk or tool-input delta). */
304
- delta: {
305
- type: 'text_delta';
306
- text: string;
307
- } | {
308
- type: 'input_json_delta';
309
- partialJson: string;
310
- };
311
- }
312
- /** Terminal message of a run — success or error, with final result text. */
313
- interface SDKResultMessage {
314
- type: 'result';
315
- subtype: 'success' | 'error_max_turns' | 'error_during_execution';
316
- sessionId: string;
317
- /** Final assistant text, present on success. */
318
- result?: string;
319
- isError: boolean;
320
- numTurns: number;
321
- durationMs: number;
322
- usage?: UsageInfo;
323
- }
324
- /** Discriminated union of everything the agent run can emit. */
325
- type SDKMessage = SDKSystemMessage | SDKAssistantMessage | SDKUserMessage | SDKPartialAssistantMessage | SDKResultMessage;
326
-
327
- /**
328
- * Wire + high-level types for chatting with a platform agent.
329
- *
330
- * These mirror the exact protocol the user-side apps use (the platform's
331
- * `conversationRoutes`: `POST /conversations/send` +
332
- * `GET /conversations/:id/stream`), so an SDK conversation is
333
- * indistinguishable from one started in the app.
334
- *
335
- * A conversation is a 12-char chat group. Sending without a
336
- * `conversationId` creates one and routes the message to the agent(s) in
337
- * `targetAgentIds`; sending with a `conversationId` continues it.
338
- */
339
-
340
- /** Body for `POST /conversations/send`. */
341
- interface SendRequest {
342
- /** The message text. (The platform send endpoint is text-only.) */
343
- message: string;
344
- /** Continue an existing conversation. Omit to create a new one. */
345
- conversationId?: string;
346
- /**
347
- * Agents for a NEW conversation:
348
- * - 1 id → route directly to that agent (no coordinator)
349
- * - 2+ → provision a coordinator + the selected agents
350
- * - omitted → coordinator handles agent discovery
351
- */
352
- targetAgentIds?: string[];
353
- /** Display name to label the user in the conversation log. */
354
- senderName?: string;
355
- /** Per-message avatar URL stored alongside the message. */
356
- senderAvatar?: string;
357
- /** Free-form metadata forwarded to the agent (e.g. card answers). */
358
- metadata?: Record<string, unknown>;
359
- /**
360
- * Tool-action message from a UI card (confirm/cancel). Routed to the
361
- * agent but not recorded in the event stream.
362
- */
363
- toolAction?: boolean;
364
- /** Where the conversation was started (set on creation, immutable). */
365
- source?: string;
366
- /** Profile id for service-account connectors (new conversations). */
367
- profileId?: string;
368
- }
369
- /** Per-agent dispatch outcome inside a {@link SendResult}. */
370
- interface AgentDispatchResult {
371
- agentId: string;
372
- /** Correlation id of the published command (not a stream cursor). */
373
- msgId: string;
374
- /** Command-stream id for the dispatch. */
375
- streamId: string;
376
- }
377
- /** Response from `POST /conversations/send`. */
378
- interface SendResult {
379
- /** The conversation id (created if the request omitted one). */
380
- conversationId: string;
381
- /** Echo of the user message text. */
382
- userMessage?: string;
383
- /**
384
- * Event-stream id of the recorded user message. This is the cursor to
385
- * resume `stream()` from to capture exactly the agent's reply to it.
386
- */
387
- userEventId?: string;
388
- /** One entry per agent the message was dispatched to. */
389
- results: AgentDispatchResult[];
390
- }
391
- /** Response from `POST /conversations/:id/interrupt`. */
392
- interface InterruptResult {
393
- ok: boolean;
394
- interrupted?: boolean;
395
- reason?: string;
396
- }
397
- /**
398
- * The inner agent-runtime event carried inside a stream record's `raw`.
399
- * The platform forwards the agent SDK's own message shapes here; the
400
- * common discriminants are modeled, with an index signature for the rest.
401
- */
402
- type ChatRawEvent = {
403
- type: 'user';
404
- message: string | {
405
- content: ContentBlock[];
406
- };
407
- [k: string]: unknown;
408
- } | {
409
- type: 'assistant';
410
- message: {
411
- content: ContentBlock[];
412
- };
413
- [k: string]: unknown;
414
- } | {
415
- type: 'thinking';
416
- [k: string]: unknown;
417
- } | {
418
- type: 'result';
419
- subtype?: string;
420
- [k: string]: unknown;
421
- } | {
422
- type: 'system';
423
- subtype?: string;
424
- [k: string]: unknown;
425
- } | {
426
- type: 'ask_user_question_resolution';
427
- toolUseId: string;
428
- answers: Record<string, string>;
429
- } | {
430
- type: string;
431
- [k: string]: unknown;
432
- };
433
- /**
434
- * One SSE record from the conversation stream. `data:` payload from the
435
- * wire, with `id` populated from the SSE `id:` line (the resumable cursor).
436
- */
437
- interface ChatStreamRecord {
438
- /** SSE cursor (event-stream id) — pass back as `lastEventId` to resume. */
439
- id?: string;
440
- seq: number;
441
- /** `agent` is used for multi-agent conversations; `assistant` for 1:1. */
442
- sender: 'user' | 'assistant' | 'agent' | 'system';
443
- senderId?: string;
444
- senderType?: 'user' | 'agent' | 'system';
445
- /** Event channel, e.g. `message` | `attachment` | `ack` | `onboarding_welcome`. */
446
- event: string;
447
- timestamp: number;
448
- sessionId: string | null;
449
- raw: ChatRawEvent;
450
- }
451
- /** Options for opening a raw conversation stream. */
452
- interface StreamOptions {
453
- /** Resume strictly after this event-stream cursor (from a record `id`). */
454
- lastEventId?: string;
455
- /** Initial-load turn count (ignored when `lastEventId` is set). Default 10. */
456
- turns?: number;
457
- /** Hard cap on entries per page. */
458
- maxEntries?: number;
459
- /** Auto-reconnect with backoff on drop (default true). The generator
460
- * still ends when the consumer breaks/returns or `signal` aborts. */
461
- reconnect?: boolean;
462
- /** Abort the stream. */
463
- signal?: AbortSignal;
464
- }
465
- /** Options for a single high-level turn. */
466
- interface TurnOptions {
467
- signal?: AbortSignal;
468
- /** Continue this conversation instead of creating a new one. */
469
- conversationId?: string;
470
- /** Agents to route a NEW conversation to (defaults to the client's agent). */
471
- targetAgentIds?: string[];
472
- /** Abort the turn if no event arrives for this long (ms). Default 180_000
473
- * — generous to cover cold-start pod provisioning on the first message. */
474
- idleTimeoutMs?: number;
475
- }
476
- /** Aggregated result of a completed turn. */
477
- interface AgentTurn {
478
- /** The conversation this turn belongs to (reuse it to continue). */
479
- conversationId: string;
480
- /** Concatenated assistant text across the turn. */
481
- text: string;
482
- /** Tool calls the agent made during the turn. */
483
- toolCalls: Array<{
484
- id?: string;
485
- name: string;
486
- input: Record<string, unknown>;
487
- }>;
488
- /** Every record observed for the turn (assistant + tool results + system). */
489
- records: ChatStreamRecord[];
490
- /** The terminal `result` event, if one was seen. */
491
- result?: ChatRawEvent;
492
- /** Session id reported by the stream, if any. */
493
- sessionId: string | null;
494
- /** Last SSE cursor seen — pass as `lastEventId` to the next turn. */
495
- lastEventId?: string;
496
- }
497
- /** A page of historical records from `GET /conversations/:id/history`. */
498
- interface HistoryPage {
499
- entries: Array<{
500
- id: string;
501
- data: ChatStreamRecord;
502
- }>;
503
- hasMore: boolean;
504
- }
505
-
506
- /**
507
- * The primary entry point: `query`.
508
- *
509
- * Runs an agent against the Openhex platform and streams back the
510
- * resulting messages. Mirrors the Claude Agent SDK's `query` so the
511
- * ergonomics are familiar:
512
- *
513
- * @example
514
- * import { query } from '@openhex-ai/agent-sdk';
515
- *
516
- * for await (const message of query({
517
- * prompt: 'Summarize the latest support tickets',
518
- * options: { allowedTools: ['WebSearch', 'Read'] },
519
- * })) {
520
- * if (message.type === 'result') console.log(message.result);
521
- * }
522
- *
523
- * NOTE: scaffold only — resolves config and constructs the transport,
524
- * then defers to it. The transport itself is not implemented yet.
525
- */
526
-
527
- interface QueryParams {
528
- /**
529
- * The instruction for the agent. A string for a one-shot run, or an
530
- * async iterable of strings for an interactive/streaming-input session.
531
- */
532
- prompt: string | AsyncIterable<string>;
533
- options?: AgentOptions;
534
- }
535
- /**
536
- * The handle returned by {@link query}: an async iterable of
537
- * {@link SDKMessage}s plus control methods for an in-flight run.
538
- */
539
- interface Query extends AsyncGenerator<SDKMessage, void, void> {
540
- /** Cooperatively abort the run. */
541
- interrupt(): Promise<void>;
542
- }
543
- /**
544
- * Start an agent run. Returns a {@link Query} you iterate to consume the
545
- * message stream.
546
- */
547
- declare function query(params: QueryParams): Query;
548
-
549
- /** API version prefix every platform route lives under. */
550
- declare const API_PREFIX = "/api/v2";
551
- interface HttpClientConfig {
552
- /** API key or JWT. Falls back to `OPENHEX_API_KEY` when omitted. */
553
- apiKey?: string;
554
- /** Base URL of the platform API. Defaults to {@link DEFAULT_BASE_URL}. */
555
- baseUrl?: string;
556
- /**
557
- * Login type stamped as `X-Login-Type` (matches the web/app clients).
558
- * Only relevant for JWT auth; harmless to omit for API-key auth.
559
- */
560
- loginType?: string;
561
- /**
562
- * Service-account id to impersonate via `X-Act-As`. The caller must own
563
- * the service account (enforced server-side).
564
- */
565
- actAs?: string;
566
- /** Extra headers merged into every request. */
567
- headers?: Record<string, string>;
568
- /** Per-request timeout for non-streaming calls (ms). Default 30_000. */
569
- timeoutMs?: number;
570
- /** Override the global fetch (testing / custom agents). */
571
- fetch?: typeof fetch;
572
- }
573
- interface RequestOptions {
574
- method?: string;
575
- /** JSON-serializable request body. */
576
- body?: unknown;
577
- /** Extra/override headers for this request. */
578
- headers?: Record<string, string>;
579
- /** Caller-supplied abort signal (merged with the timeout signal). */
580
- signal?: AbortSignal;
581
- /** Override the default timeout for this request (ms). 0 disables it. */
582
- timeoutMs?: number;
583
- }
584
- declare class HttpClient {
585
- private readonly apiKey;
586
- readonly baseUrl: string;
587
- private readonly loginType?;
588
- private readonly actAs?;
589
- private readonly extraHeaders;
590
- private readonly timeoutMs;
591
- private readonly fetchImpl;
592
- constructor(config?: HttpClientConfig);
593
- /** Build the full URL for an API path (prefixing `/api/v2` if needed). */
594
- url(path: string): string;
595
- /** Headers common to every request. `accept` differs for SSE vs JSON. */
596
- buildHeaders(accept: string, extra?: Record<string, string>): Record<string, string>;
597
- /** Map a non-2xx response to an {@link ApiError}, extracting `detail`. */
598
- private toError;
599
- /** Perform a JSON request and parse the response body. */
600
- requestJson<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
601
- /** Perform a request and return the raw {@link Response} (used for SSE). */
602
- requestRaw(path: string, options?: RequestOptions, accept?: string): Promise<Response>;
603
- }
604
-
605
- /**
606
- * AgentChatClient — chat with a platform agent over the exact protocol
607
- * the user-side apps use (`conversationRoutes`).
608
- *
609
- * Endpoints (all under `/api/v2`):
610
- * POST /conversations/send — create/continue a conversation, route a message
611
- * GET /conversations/:id/stream — SSE record stream (resumable)
612
- * GET /conversations/:id/messages — full history (JSON)
613
- * GET /conversations/:id/history — paginated older history (JSON)
614
- * POST /conversations/:id/interrupt — interrupt the running turn
615
- *
616
- * Low-level methods (`send`, `stream`, `messages`, `history`, `interrupt`)
617
- * map 1:1 to the wire. High-level helpers (`runTurn`, `sendMessage`) add
618
- * turn isolation (resume the stream from the user message's event id),
619
- * reconnection, and an idle-timeout for cold-start pod provisioning.
620
- */
621
-
622
- declare class AgentChatClient {
623
- private readonly http;
624
- constructor(http: HttpClient);
625
- /**
626
- * Create or continue a conversation and route a message to its agent(s).
627
- * Returns immediately (non-blocking); consume {@link stream} for the reply.
628
- */
629
- send(req: SendRequest, opts?: {
630
- signal?: AbortSignal;
631
- }): Promise<SendResult>;
632
- /** Interrupt the conversation's currently-running turn. */
633
- interrupt(conversationId: string, opts?: {
634
- signal?: AbortSignal;
635
- }): Promise<InterruptResult>;
636
- /** Full conversation history (all messages as JSON). */
637
- messages(conversationId: string, opts?: {
638
- signal?: AbortSignal;
639
- }): Promise<{
640
- entries: Array<{
641
- id: string;
642
- data: ChatStreamRecord;
643
- }>;
644
- }>;
645
- /** A page of older history, before a cursor. */
646
- history(conversationId: string, params: {
647
- before: string;
648
- turns?: number;
649
- maxEntries?: number;
650
- }, opts?: {
651
- signal?: AbortSignal;
652
- }): Promise<HistoryPage>;
653
- /**
654
- * Open the conversation's SSE record stream. Yields every record
655
- * (replayed history then live tail), auto-reconnecting with capped
656
- * backoff on drop. The generator ends when the consumer breaks/returns
657
- * or `signal` aborts.
658
- */
659
- stream(conversationId: string, opts?: StreamOptions): AsyncGenerator<ChatStreamRecord, void, void>;
660
- /**
661
- * Stream a single turn over an existing conversation: resume the event
662
- * stream strictly after `opts.lastEventId` (the user message's event id)
663
- * and stop at the agent's terminal `result`. Reconnects on drop; an
664
- * `idleTimeoutMs` gap with no events aborts (covers cold-start pod
665
- * provisioning). Use when you sent the message yourself via {@link send}.
666
- */
667
- resumeTurn(conversationId: string, opts?: TurnOptions & {
668
- lastEventId?: string;
669
- }): AsyncGenerator<ChatStreamRecord, void, void>;
670
- /**
671
- * Send a message and stream just this turn's records, ending when the
672
- * agent's `result` event arrives.
673
- *
674
- * The message is sent first; the stream then resumes precisely from the
675
- * user message's event id, so only the agent's reply is surfaced — no
676
- * history, no heuristics. To learn the (possibly new) conversation id
677
- * while streaming, use {@link sendMessage} or the stateful
678
- * {@link Conversation}.
679
- *
680
- * The first message in a new conversation auto-provisions the agent's
681
- * pod, so the first turn can take tens of seconds before any record
682
- * arrives; `idleTimeoutMs` (default 180s) bounds the wait.
683
- */
684
- runTurn(req: SendRequest, opts?: TurnOptions): AsyncGenerator<ChatStreamRecord, void, void>;
685
- /**
686
- * Send a message and resolve with the aggregated turn (assistant text,
687
- * tool calls, all records, conversation id, and a resume cursor).
688
- */
689
- sendMessage(req: SendRequest, opts?: TurnOptions): Promise<AgentTurn>;
690
- /**
691
- * Start a stateful conversation handle that remembers its id across
692
- * turns. The first {@link Conversation.send} creates the conversation
693
- * (routed to `targetAgentIds`); subsequent sends continue it.
694
- */
695
- conversation(opts?: {
696
- conversationId?: string;
697
- targetAgentIds?: string[];
698
- }): Conversation;
699
- }
700
- /**
701
- * A stateful 1:1 (or multi-agent) conversation. Tracks the conversation
702
- * id so you can `send` repeated turns without re-passing it, and continues
703
- * the same chat-group context each time.
704
- */
705
- declare class Conversation {
706
- private readonly client;
707
- private conversationId;
708
- private readonly targetAgentIds;
709
- constructor(client: AgentChatClient, conversationId: string | undefined, targetAgentIds: string[] | undefined);
710
- /** The conversation id, once the first message has been sent. */
711
- get id(): string | undefined;
712
- /** Build the send request for the next turn (create vs continue). */
713
- private buildRequest;
714
- /** Send a turn and resolve with the aggregated result. */
715
- send(message: string, opts?: TurnOptions & Partial<SendRequest>): Promise<AgentTurn>;
716
- /** Send a turn and stream its records as they arrive. */
717
- stream(message: string, opts?: TurnOptions & Partial<SendRequest>): AsyncGenerator<ChatStreamRecord, void, void>;
718
- /** Interrupt the running turn in this conversation. */
719
- interrupt(): Promise<InterruptResult>;
720
- }
721
-
722
- /**
723
- * Training-mode chat — talk to an agent AS ITS OWNER over the dev/train
724
- * protocol (the agent runs in CREATION/TRAINING mode, so it can learn:
725
- * edit skills/knowledge/persona, accept feedback, etc.). This is distinct
726
- * from {@link AgentChatClient}, which is the user-side conversations
727
- * protocol.
728
- *
729
- * Wire (all under /api/v2, owner/collaborator auth):
730
- * POST /agents/:id/dev/send — send a training message → { ok, msgId }
731
- * GET /agents/:id/messages/stream — SSE record stream (seq-keyed, resumable
732
- * via lastEventId; `turns=1` = latest turn)
733
- * GET /agents/:id/messages/history — JSON history
734
- * POST /agents/:id/dev/interrupt — interrupt the running turn
735
- *
736
- * The training thread is agent-scoped (one per owner), so there's no
737
- * conversationId — the agent id IS the thread.
738
- */
739
-
740
- interface TrainingSendResult {
741
- ok: boolean;
742
- msgId?: string;
743
- }
744
- interface TrainingStreamOptions extends TurnOptions {
745
- /** Resume strictly after this record seq (stringified). */
746
- lastEventId?: string;
747
- /** Return only the latest N turns (server-side turn paging). */
748
- turns?: number;
749
- reconnect?: boolean;
750
- }
751
- /** A training (owner-mode) chat bound to one agent. */
752
- declare class TrainingChat {
753
- private readonly http;
754
- private readonly agentId;
755
- constructor(http: HttpClient, agentId: string);
756
- /** Send a training message; the reply streams asynchronously (see {@link stream}). */
757
- send(message: string, opts?: {
758
- signal?: AbortSignal;
759
- }): Promise<TrainingSendResult>;
760
- /** Interrupt the running training turn. */
761
- interrupt(opts?: {
762
- signal?: AbortSignal;
763
- }): Promise<{
764
- ok: boolean;
765
- }>;
766
- /**
767
- * Training transcript (JSON), paginated backward from `before` (a Redis
768
- * stream id). The endpoint REQUIRES `before`, so we default to a
769
- * far-future sentinel to fetch the latest turns; pass a real id to page
770
- * older history.
771
- */
772
- messages(opts?: {
773
- before?: string;
774
- signal?: AbortSignal;
775
- }): Promise<{
776
- entries: Array<{
777
- data?: ChatStreamRecord;
778
- }>;
779
- hasMore?: boolean;
780
- }>;
781
- /** Raw SSE record stream of the training thread (replayed + live tail). */
782
- stream(opts?: TrainingStreamOptions): AsyncGenerator<ChatStreamRecord, void, void>;
783
- /**
784
- * Send a training message and stream just that turn's records, ending at
785
- * the agent's terminal `result`. Streams the latest turn (`turns=1`) after
786
- * the send; an `idleTimeoutMs` gap (default 180s) bounds cold-start waits.
787
- */
788
- runTurn(message: string, opts?: TurnOptions): AsyncGenerator<ChatStreamRecord, void, void>;
789
- }
790
-
791
- /**
792
- * Wire types for the Workspace API (`/api/v2/workspaces/*`).
793
- *
794
- * These mirror the platform's published OpenAPI surface 1:1 — the same
795
- * contract documented at `/api/v2/workspaces/openapi.json`. A workspace
796
- * is a billing + membership boundary an SP (service provider / partner)
797
- * owns; the API lets a partner backend provision members, mint member
798
- * sessions, grant credits, and read reporting.
799
- *
800
- * Auth is a `Bearer` token in every case (see {@link WorkspaceClient}):
801
- * - a workspace API key (`sk_ws_…`) for partner-backend operations,
802
- * - or no token for the public SMS-signup endpoints.
803
- *
804
- * The owner-JWT admin surface (workspace ledger, insights, API-key
805
- * management) is deliberately NOT mirrored in the SDK — those routes
806
- * power the SP admin UI and aren't in the published partner spec.
807
- *
808
- * Date fields cross the wire as ISO-8601 strings (the server serializes
809
- * its `Date`s to JSON), so they're typed as `string` here.
810
- */
811
- /** Identity of the workspace a key/JWT is acting on. */
812
- interface WorkspaceWhoami {
813
- workspace_id: string;
814
- slug: string;
815
- display_name: string;
816
- status: string;
817
- /** The API key id the request authenticated with. */
818
- api_key_id: string;
819
- }
820
- /** One member row from {@link WorkspaceClient.listMembers}. */
821
- interface WorkspaceMember {
822
- user_id: string;
823
- billing_account_id: string;
824
- /** The SP's own reference for this user (may be null for legacy rows). */
825
- sp_user_ref: string | null;
826
- status: string;
827
- /** ISO-8601 timestamp. */
828
- joined_at: string;
829
- /** Current credit balance on the member's billing account. */
830
- balance: number;
831
- }
832
- interface MembersListResponse {
833
- members: WorkspaceMember[];
834
- }
835
- /** Body for {@link WorkspaceClient.provisionMember}. */
836
- interface ProvisionMemberRequest {
837
- /** The SP's stable reference for this user. Idempotency key for the member. */
838
- sp_user_ref: string;
839
- /** Optional display name to label the member. */
840
- display_name?: string;
841
- }
842
- interface ProvisionMemberResponse {
843
- member_id: string;
844
- billing_account_id: string;
845
- /** `true` if this call created the member; `false` if it already existed. */
846
- created: boolean;
847
- }
848
- /** Body for {@link WorkspaceClient.grantCredits}. */
849
- interface GrantCreditsRequest {
850
- /** Positive credit amount to grant (max 1e9). */
851
- amount: number;
852
- /** Caller-supplied idempotency key; replays return the original purchase. */
853
- idempotency_key: string;
854
- }
855
- interface GrantCreditsResponse {
856
- /** Member's balance after the grant. */
857
- balance: number;
858
- purchase_id: string;
859
- /** `true` when this was a replay of a prior identical grant. */
860
- idempotent: boolean;
861
- }
862
- /** Body for {@link WorkspaceClient.mintSession}. */
863
- interface MintSessionRequest {
864
- /** The already-provisioned member's SP reference. */
865
- sp_user_ref: string;
866
- /** Token lifetime in seconds (max 86_400). Server picks a default if omitted. */
867
- ttl_seconds?: number;
868
- }
869
- /** A minted member session — returned by mintSession + SMS verify. */
870
- interface SessionTokenResponse {
871
- /** JWT the member's client presents to the platform. */
872
- token: string;
873
- user_id: string;
874
- /** ISO-8601 expiry timestamp. */
875
- expires_at: string;
876
- }
877
- /** Body for {@link WorkspaceClient.sendSmsCode}. */
878
- interface SmsSendRequest {
879
- phone: string;
880
- }
881
- /** Body for {@link WorkspaceClient.verifySmsCode}. */
882
- interface SmsVerifyRequest {
883
- phone: string;
884
- code: string;
885
- }
886
- /** Options accepted by every workspace request. */
887
- interface WorkspaceRequestOptions {
888
- /** Abort the request. */
889
- signal?: AbortSignal;
890
- }
891
-
892
- /**
893
- * WorkspaceClient — manage a platform workspace over the partner-facing
894
- * subset of `/api/v2/workspaces/*` (the same surface the published
895
- * OpenAPI spec exposes).
896
- *
897
- * Endpoints (all under `/api/v2`):
898
- *
899
- * Workspace API key (`sk_ws_…`) — partner backend:
900
- * GET /workspaces/whoami
901
- * POST /workspaces/:slug/members
902
- * DELETE /workspaces/:slug/members/:memberId
903
- * POST /workspaces/:slug/sessions
904
- *
905
- * Either auth (owner JWT or workspace API key):
906
- * GET /workspaces/:slug/members
907
- * POST /workspaces/:slug/members/:memberId/credits
908
- *
909
- * Public (no auth):
910
- * POST /workspaces/:slug/sms/send
911
- * POST /workspaces/:slug/sms/verify
912
- *
913
- * Deliberately omitted: the 6 owner-JWT admin routes (workspace ledger,
914
- * insights, per-member ledger, API-key CRUD). They power the SP admin
915
- * UI in `webapp/src/app/[locale]/(app)/settings/*` and don't appear in
916
- * the published partner OpenAPI spec (hidden in
917
- * `mysta-server/src/routes/workspacesOwnerRoutes.ts`). Wrapping them in
918
- * the SDK would invite partners to call routes the docs say don't exist;
919
- * with a workspace API key they'd just 401.
920
- *
921
- * Auth is the `Bearer` token carried by the underlying {@link HttpClient}.
922
- * Configure the client with the token the operation needs: a workspace
923
- * API key for partner calls, or skip the header entirely for the public
924
- * SMS endpoints.
925
- *
926
- * Use {@link WorkspaceClient.workspace} for a slug-bound handle so you
927
- * don't repeat the slug on every call.
928
- */
929
-
930
- declare class WorkspaceClient {
931
- private readonly http;
932
- constructor(http: HttpClient);
933
- /**
934
- * Identify the workspace the configured API key belongs to. Solves the
935
- * bootstrap problem for a new partner who holds only the `sk_ws_…` token
936
- * but every slug-keyed route needs a slug.
937
- */
938
- whoami(opts?: WorkspaceRequestOptions): Promise<WorkspaceWhoami>;
939
- /**
940
- * Provision (or look up) a workspace member by SP user reference.
941
- * Idempotent on `(workspace, sp_user_ref)` — the first call creates the
942
- * member, later calls return the existing ids (`created: false`).
943
- */
944
- provisionMember(slug: string, body: ProvisionMemberRequest, opts?: WorkspaceRequestOptions): Promise<ProvisionMemberResponse>;
945
- /** Suspend a member (soft — sets status to `suspended`). */
946
- suspendMember(slug: string, memberId: string, opts?: WorkspaceRequestOptions): Promise<void>;
947
- /**
948
- * Mint a session JWT for an already-provisioned member. The partner
949
- * authenticates the human on their side, then calls this with the same
950
- * `sp_user_ref` to get a token the member's client presents to the platform.
951
- */
952
- mintSession(slug: string, body: MintSessionRequest, opts?: WorkspaceRequestOptions): Promise<SessionTokenResponse>;
953
- /** List workspace members with current balances (capped at 500). */
954
- listMembers(slug: string, opts?: WorkspaceRequestOptions): Promise<MembersListResponse>;
955
- /**
956
- * Grant credits to a member from the workspace pool. Idempotent on
957
- * `body.idempotency_key` — replays return the original purchase.
958
- */
959
- grantCredits(slug: string, memberId: string, body: GrantCreditsRequest, opts?: WorkspaceRequestOptions): Promise<GrantCreditsResponse>;
960
- /**
961
- * Send a one-time SMS verification code for public signup. Requires the
962
- * workspace to have `public_sms_signup_enabled`.
963
- */
964
- sendSmsCode(slug: string, body: SmsSendRequest, opts?: WorkspaceRequestOptions): Promise<void>;
965
- /** Verify an SMS code and mint a member session JWT in one shot. */
966
- verifySmsCode(slug: string, body: SmsVerifyRequest, opts?: WorkspaceRequestOptions): Promise<SessionTokenResponse>;
967
- /**
968
- * A slug-bound handle so you don't repeat the slug on every call.
969
- * `client.workspaces.workspace('acme').listMembers()`.
970
- */
971
- workspace(slug: string): Workspace;
972
- }
973
- /**
974
- * A workspace pinned to one slug. Thin sugar over {@link WorkspaceClient}
975
- * that drops the leading `slug` argument from every method. `whoami` stays
976
- * on the parent client (it's key-bound, not slug-bound).
977
- */
978
- declare class Workspace {
979
- private readonly client;
980
- readonly slug: string;
981
- constructor(client: WorkspaceClient, slug: string);
982
- listMembers(opts?: WorkspaceRequestOptions): Promise<MembersListResponse>;
983
- provisionMember(body: ProvisionMemberRequest, opts?: WorkspaceRequestOptions): Promise<ProvisionMemberResponse>;
984
- suspendMember(memberId: string, opts?: WorkspaceRequestOptions): Promise<void>;
985
- grantCredits(memberId: string, body: GrantCreditsRequest, opts?: WorkspaceRequestOptions): Promise<GrantCreditsResponse>;
986
- mintSession(body: MintSessionRequest, opts?: WorkspaceRequestOptions): Promise<SessionTokenResponse>;
987
- sendSmsCode(body: SmsSendRequest, opts?: WorkspaceRequestOptions): Promise<void>;
988
- verifySmsCode(body: SmsVerifyRequest, opts?: WorkspaceRequestOptions): Promise<SessionTokenResponse>;
989
- }
990
-
991
- /**
992
- * `OpenhexClient` — a stateful, higher-level wrapper over the SDK.
993
- *
994
- * Pin connection + agent config once, then chat with an agent (`chat`,
995
- * `sendMessage`, `conversation`), run local-style queries (`query`,
996
- * scaffold), or manage sessions.
997
- */
998
-
999
- interface OpenhexClientConfig extends OpenhexConnection {
1000
- /** `X-Login-Type` header (matches the web/app clients). JWT auth only. */
1001
- loginType?: string;
1002
- /** Service-account id to impersonate via `X-Act-As` (caller must own it). */
1003
- actAs?: string;
1004
- /** Per-request timeout for non-streaming calls (ms). Default 30_000. */
1005
- timeoutMs?: number;
1006
- /** Override the global fetch (testing / custom runtimes). */
1007
- fetch?: typeof fetch;
1008
- /** Default options merged into every {@link OpenhexClient.query} call. */
1009
- defaultOptions?: Omit<AgentOptions, keyof OpenhexConnection>;
1010
- }
1011
- declare class OpenhexClient {
1012
- private readonly config;
1013
- /** Low- and high-level chat API (conversations protocol). */
1014
- readonly chat: AgentChatClient;
1015
- /**
1016
- * Workspace API (`/api/v2/workspaces/*`) — provision members, mint
1017
- * member sessions, grant credits, read reporting. Auth is whatever
1018
- * token the client is configured with (a `sk_ws_…` workspace API key
1019
- * for partner calls, or the owner's JWT for SP-admin calls).
1020
- */
1021
- readonly workspaces: WorkspaceClient;
1022
- private readonly http;
1023
- constructor(config?: OpenhexClientConfig);
1024
- /**
1025
- * A slug-bound workspace handle so you don't repeat the slug on every
1026
- * call. Equivalent to `client.workspaces.workspace(slug)`.
1027
- */
1028
- workspace(slug: string): Workspace;
1029
- /**
1030
- * Training-mode chat with an agent AS ITS OWNER (the dev/train protocol —
1031
- * the agent runs in CREATION/TRAINING mode and can learn from feedback).
1032
- * Defaults to the client's configured `agentId`; pass one to override.
1033
- */
1034
- training(agentId?: string): TrainingChat;
1035
- /** Default target agents for new conversations (from `config.agentId`). */
1036
- private defaultTargets;
1037
- /** Build a {@link SendRequest} from a message + turn options. */
1038
- private buildRequest;
1039
- /**
1040
- * Send a message and resolve with the aggregated turn. Creates a new
1041
- * conversation routed to the configured agent unless `opts.conversationId`
1042
- * is given. The returned turn carries `conversationId` to continue.
1043
- */
1044
- sendMessage(message: string, opts?: TurnOptions): Promise<AgentTurn>;
1045
- /** Stream a single turn's records (see {@link sendMessage}). */
1046
- runTurn(message: string, opts?: TurnOptions): AsyncGenerator<ChatStreamRecord, void, void>;
1047
- /**
1048
- * Start a stateful conversation that remembers its id across turns,
1049
- * defaulting its target agents to the configured agent.
1050
- */
1051
- conversation(opts?: {
1052
- conversationId?: string;
1053
- targetAgentIds?: string[];
1054
- }): Conversation;
1055
- /**
1056
- * Run an agent query using this client's connection + default options.
1057
- * Per-call `options` are shallow-merged over the client defaults.
1058
- */
1059
- query(params: QueryParams): Query;
1060
- /** List recent sessions for the configured agent. */
1061
- listSessions(): Promise<SessionInfo[]>;
1062
- /** Fetch metadata for a single session. */
1063
- getSession(_sessionId: string): Promise<SessionInfo>;
1064
- /** Delete a session and its stored context. */
1065
- deleteSession(_sessionId: string): Promise<void>;
1066
- }
1067
-
1068
7
  /** True when a record is from the agent (1:1 `assistant` or multi-agent `agent`). */
1069
8
  declare function isAgentRecord(record: ChatStreamRecord): boolean;
1070
9
  /** True when a record marks the end of an agent turn. */
@@ -1215,4 +154,4 @@ declare class NotImplementedError extends OpenhexSdkError {
1215
154
  constructor(what: string);
1216
155
  }
1217
156
 
1218
- export { API_PREFIX, AbortError, AgentChatClient, type AgentDefinition, type AgentDispatchResult, type AgentOptions, type AgentRegistry, type AgentTurn, ApiError, AuthenticationError, Backoff, type CanUseTool, type ChatRawEvent, type ChatStreamRecord, type ContentBlock, Conversation, DEFAULT_BASE_URL, type GrantCreditsRequest, type GrantCreditsResponse, type HistoryPage, type HookCallback, type HookEvent, type HookInput, type HookMatcher, type HookOutput, type HookRegistry, HttpClient, type HttpClientConfig, type HttpMcpServerConfig, HttpTransport, type InterruptResult, type McpServerConfig, type McpServerRegistry, type MembersListResponse, type MintSessionRequest, NotImplementedError, OpenhexClient, type OpenhexClientConfig, type OpenhexConnection, OpenhexSdkError, type PermissionMode, type PermissionResult, type ProvisionMemberRequest, type ProvisionMemberResponse, type Query, type QueryParams, type RequestOptions, type RunRequest, type SDKAssistantMessage, type SDKMessage, type SDKPartialAssistantMessage, type SDKResultMessage, type SDKSystemMessage, type SDKUserMessage, type SSEMessage, SdkMcpServer, type SendRequest, type SendResult, type SessionInfo, type SessionTokenResponse, type SettingSource, type SmsSendRequest, type SmsVerifyRequest, type StdioMcpServerConfig, type StreamOptions, ToolName, TrainingChat, type TrainingSendResult, type Transport, type TurnOptions, type UsageInfo, Workspace, WorkspaceClient, type WorkspaceMember, type WorkspaceRequestOptions, type WorkspaceWhoami, delay, extractText, extractToolCalls, hookMatcher, isAgentRecord, isInterrupt, isTurnComplete, parseSSEStream, query };
157
+ export { AbortError, AgentOptions, ApiError, AuthenticationError, Backoff, ChatStreamRecord, DEFAULT_BASE_URL, HookCallback, HookMatcher, HttpTransport, NotImplementedError, OpenhexSdkError, type RunRequest, SDKMessage, type SSEMessage, type Transport, delay, extractText, extractToolCalls, hookMatcher, isAgentRecord, isInterrupt, isTurnComplete, parseSSEStream };