@byteplus-iga-pages/agent 0.0.0-stage → 1.0.3

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.
Files changed (105) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +84 -2
  3. package/dist/cjs/261.js +77 -0
  4. package/dist/cjs/341.js +43 -0
  5. package/dist/cjs/401.js +3632 -0
  6. package/dist/cjs/419.js +854 -0
  7. package/dist/cjs/504.js +760 -0
  8. package/dist/cjs/521.js +242 -0
  9. package/dist/cjs/594.js +79 -0
  10. package/dist/cjs/647.js +1367 -0
  11. package/dist/cjs/808.js +322 -0
  12. package/dist/cjs/82.js +10089 -0
  13. package/dist/cjs/893.js +17720 -0
  14. package/dist/cjs/893.js.LICENSE.txt +13 -0
  15. package/dist/cjs/951.js +59 -0
  16. package/dist/cjs/package.json +3 -0
  17. package/dist/cjs/runtime.js +79 -0
  18. package/dist/cjs/sandbox/host.js +125 -0
  19. package/dist/cjs/sandbox/index.js +286 -0
  20. package/dist/cjs/store/claude.js +209 -0
  21. package/dist/cjs/store/host.js +92 -0
  22. package/dist/cjs/store/index.js +43 -0
  23. package/dist/cjs/store/langgraph.js +581 -0
  24. package/dist/cjs/store/openai.js +118 -0
  25. package/dist/cjs/tools/claude.js +59 -0
  26. package/dist/cjs/tools/index.js +37 -0
  27. package/dist/cjs/tools/langchain.js +52 -0
  28. package/dist/cjs/tools/openai-agents.js +43 -0
  29. package/dist/cjs/tools/openai.js +43 -0
  30. package/dist/esm/128.js +10381 -0
  31. package/dist/esm/261.js +67 -0
  32. package/dist/esm/341.js +30 -0
  33. package/dist/esm/392.js +4453 -0
  34. package/dist/esm/417.js +704 -0
  35. package/dist/esm/521.js +230 -0
  36. package/dist/esm/594.js +67 -0
  37. package/dist/esm/613.js +19042 -0
  38. package/dist/esm/613.js.LICENSE.txt +13 -0
  39. package/dist/esm/951.js +44 -0
  40. package/dist/esm/package.json +3 -0
  41. package/dist/esm/runtime.js +39 -0
  42. package/dist/esm/sandbox/host.js +1 -0
  43. package/dist/esm/sandbox/index.js +183 -0
  44. package/dist/esm/store/claude.js +172 -0
  45. package/dist/esm/store/host.js +46 -0
  46. package/dist/esm/store/index.js +2 -0
  47. package/dist/esm/store/langgraph.js +542 -0
  48. package/dist/esm/store/openai.js +81 -0
  49. package/dist/esm/tools/claude.js +22 -0
  50. package/dist/esm/tools/index.js +1 -0
  51. package/dist/esm/tools/langchain.js +16 -0
  52. package/dist/esm/tools/openai-agents.js +6 -0
  53. package/dist/esm/tools/openai.js +6 -0
  54. package/dist/types/_internal/data-plane/control-plane-request.d.ts +12 -0
  55. package/dist/types/_internal/data-plane/control-plane.d.ts +3 -0
  56. package/dist/types/_internal/data-plane/credential-provider.d.ts +25 -0
  57. package/dist/types/_internal/data-plane/errors.d.ts +19 -0
  58. package/dist/types/_internal/data-plane/index.d.ts +11 -0
  59. package/dist/types/_internal/data-plane/supabase-client.d.ts +12 -0
  60. package/dist/types/_internal/data-plane/token-client.d.ts +23 -0
  61. package/dist/types/sandbox/api-client.d.ts +37 -0
  62. package/dist/types/sandbox/api-types.d.ts +81 -0
  63. package/dist/types/sandbox/binding-repository.d.ts +62 -0
  64. package/dist/types/sandbox/error.d.ts +22 -0
  65. package/dist/types/sandbox/expiry.d.ts +11 -0
  66. package/dist/types/sandbox/host.d.ts +6 -0
  67. package/dist/types/sandbox/iga-sandbox.d.ts +208 -0
  68. package/dist/types/sandbox/index.d.ts +8 -0
  69. package/dist/types/sandbox/public-surface.d.ts +19 -0
  70. package/dist/types/sandbox/runtime-sandbox.d.ts +32 -0
  71. package/dist/types/sandbox/types.d.ts +238 -0
  72. package/dist/types/store/append.d.ts +41 -0
  73. package/dist/types/store/claude-repository.d.ts +36 -0
  74. package/dist/types/store/claude.d.ts +3 -0
  75. package/dist/types/store/control-plane-request.d.ts +2 -0
  76. package/dist/types/store/credential-error.d.ts +2 -0
  77. package/dist/types/store/credential-provider.d.ts +29 -0
  78. package/dist/types/store/errors.d.ts +29 -0
  79. package/dist/types/store/factory.d.ts +31 -0
  80. package/dist/types/store/host.d.ts +5 -0
  81. package/dist/types/store/index.d.ts +6 -0
  82. package/dist/types/store/json.d.ts +7 -0
  83. package/dist/types/store/langgraph-repository.d.ts +98 -0
  84. package/dist/types/store/langgraph.d.ts +43 -0
  85. package/dist/types/store/openai.d.ts +12 -0
  86. package/dist/types/store/pagination.d.ts +27 -0
  87. package/dist/types/store/runtime-data-plane.d.ts +8 -0
  88. package/dist/types/store/runtime-provider.d.ts +1 -0
  89. package/dist/types/store/runtime-store.d.ts +20 -0
  90. package/dist/types/store/store.d.ts +240 -0
  91. package/dist/types/store/supabase-transport.d.ts +43 -0
  92. package/dist/types/store/token-client.d.ts +7 -0
  93. package/dist/types/tools/adapters.d.ts +5 -0
  94. package/dist/types/tools/claude.d.ts +4 -0
  95. package/dist/types/tools/index.d.ts +2 -0
  96. package/dist/types/tools/langchain.d.ts +16 -0
  97. package/dist/types/tools/model-output.d.ts +8 -0
  98. package/dist/types/tools/openai-agents.d.ts +4 -0
  99. package/dist/types/tools/openai.d.ts +5 -0
  100. package/dist/types/tools/registry.d.ts +16 -0
  101. package/dist/types/tools/result.d.ts +17 -0
  102. package/dist/types/tools/sandbox-result-mappers.d.ts +10 -0
  103. package/dist/types/tools/sandbox-tools.d.ts +17 -0
  104. package/dist/types/tools/types.d.ts +307 -0
  105. package/package.json +136 -4
@@ -0,0 +1,240 @@
1
+ import { type AppendMessageItemInput } from "./append.js";
2
+ import { type JsonObject, type JsonValue } from "./json.js";
3
+ import { SupabaseStoreTransport } from "./supabase-transport.js";
4
+ /** 会话信息;消息列表需通过 `store.listMessages()` 单独读取。 */
5
+ export interface Conversation {
6
+ /** 会话的 ID,用于后续消息读写和会话操作;不是访问凭证。 */
7
+ conversationId: string;
8
+ /** 应用自定义的会话元数据,例如 `{ title: "新对话" }`;未设置时为 `{}`。 */
9
+ metadata: JsonObject;
10
+ /** 服务端创建时间字符串,可用 `new Date(createdAt)` 转换。 */
11
+ createdAt: string;
12
+ /** 服务端最近更新时间字符串,可用 `new Date(updatedAt)` 转换。 */
13
+ updatedAt: string;
14
+ }
15
+ /** 已保存的消息;ID、序号和时间由追加结果返回。 */
16
+ export interface Message {
17
+ /** 当前项目内唯一的消息 ID,不限定为 UUID。 */
18
+ messageId: string;
19
+ /** 消息所属会话的 ID。 */
20
+ conversationId: string;
21
+ /**
22
+ * 会话内递增序号,以十进制字符串返回,避免大整数精度丢失。
23
+ * 删除后可能存在空缺;需要比较时使用 `BigInt(seq)`,不要按字符串排序。
24
+ */
25
+ seq: string;
26
+ /** 消息角色,如 user、assistant、system、tool 或自定义字符串;未设置时为 null。 */
27
+ role: string | null;
28
+ /** 应用自定义的消息类型;未设置时为 null。 */
29
+ type: string | null;
30
+ /** 原样保存的 JSON 消息内容;结构由应用定义,不要求包含 content、text 或 type。 */
31
+ payload: JsonValue;
32
+ /** 消息的附加信息,与会话 metadata 独立;未设置时为 `{}`。 */
33
+ metadata: JsonObject;
34
+ /** 服务端创建时间字符串,可用 `new Date(createdAt)` 转换。 */
35
+ createdAt: string;
36
+ /** 服务端最近更新时间字符串,可用 `new Date(updatedAt)` 转换。 */
37
+ updatedAt: string;
38
+ }
39
+ /** 一页查询结果;不是完整列表。 */
40
+ export interface Page<T> {
41
+ /** 当前页的数据,顺序由对应列表方法决定;没有结果时为空数组。 */
42
+ items: T[];
43
+ /** 下一页游标;原样传给同一列表方法的 cursor。为 null 时没有下一页。 */
44
+ nextCursor: string | null;
45
+ }
46
+ /** 创建空会话的参数。 */
47
+ export interface CreateConversationInput {
48
+ /** 会话 ID(非空字符串,UTF-8 最多 256 字节);省略时由 SDK 生成。指定已存在的 ID 会产生 conflict。 */
49
+ conversationId?: string;
50
+ /**
51
+ * 初始会话元数据,必须是 JSON 对象,不能是数组或 null;对象中的 null 会作为值保存。
52
+ * 不支持 undefined、BigInt、函数、非有限数字、循环引用或类实例。
53
+ * @default {}
54
+ */
55
+ metadata?: JsonObject;
56
+ }
57
+ export interface ConversationRef {
58
+ /** 目标会话的 ID;可使用 createConversation() 返回的 conversationId。 */
59
+ conversationId: string;
60
+ }
61
+ /** 当前项目的会话分页参数;不支持用户归属或 metadata 筛选。 */
62
+ export interface ListConversationsInput {
63
+ /** 上一页的 nextCursor;第一页不传,不要解析、构造或混用其他列表的游标。 */
64
+ cursor?: string;
65
+ /**
66
+ * 每页条数,必须是 1~100 的整数。
67
+ * @default 50
68
+ */
69
+ limit?: number;
70
+ }
71
+ /** 局部更新会话元数据;不修改会话中的消息。 */
72
+ export interface UpdateConversationInput {
73
+ /** 待更新会话的 ID;会话不存在时产生 not_found。 */
74
+ conversationId: string;
75
+ /**
76
+ * 原子合并顶层字段,未传字段保留;顶层 null 删除对应键,例如 `{ title: null }`。
77
+ * 嵌套对象和数组整值替换,其中的 null 保留;不能用此方法将顶层键设为 null 值。
78
+ * `{}` 不修改数据或更新时间,但仍检查会话存在性;不接受 null 或非法 JSON 值。
79
+ */
80
+ metadata: JsonObject;
81
+ }
82
+ /** 向指定会话追加一条消息,内容字段继承自 AppendMessageItemInput。 */
83
+ export interface AppendMessageInput extends AppendMessageItemInput {
84
+ /** 目标会话的 ID,必须显式提供;会话不存在时会随消息原子创建。 */
85
+ conversationId: string;
86
+ }
87
+ /** 向同一会话原子追加一批消息。 */
88
+ export interface AppendMessagesInput {
89
+ /** 整批消息所属会话的 ID;会话不存在时会随消息原子创建。 */
90
+ conversationId: string;
91
+ /**
92
+ * 包含 1~100 条消息,批内 messageId 不能重复;结果按输入顺序返回。
93
+ * 整批 ID 均为新 ID 时追加;均已存在且内容和会话匹配时返回已有消息。
94
+ * 混合已有 ID 和新 ID,或已有消息内容不匹配时产生 conflict,整批不写入。
95
+ * 业务重试应显式提供并复用全部消息 ID 和内容;超过 100 条需拆成多个批次。
96
+ */
97
+ messages: AppendMessageItemInput[];
98
+ }
99
+ export interface MessageRef {
100
+ /** 当前项目内的非空消息 ID;使用追加结果的 messageId,无需同时提供会话 ID。 */
101
+ messageId: string;
102
+ }
103
+ /** 指定会话的消息分页参数。 */
104
+ export interface ListMessagesInput {
105
+ /** 会话 ID(非空字符串,UTF-8 最多 256 字节);会话不存在时返回空页。 */
106
+ conversationId: string;
107
+ /**
108
+ * 上一页的 nextCursor;第一页不传,后续页需保持相同的 conversationId 和 order。
109
+ * 游标固定本轮最大消息序号,新追加的消息需不带 cursor 重新查询。
110
+ */
111
+ cursor?: string;
112
+ /**
113
+ * 每页消息数量,必须是 1~100 的整数。
114
+ * @default 50
115
+ */
116
+ limit?: number;
117
+ /**
118
+ * 按消息序号排序:asc 最早在前,desc 最新在前。读取最近消息时使用 desc。
119
+ * @default "asc"
120
+ */
121
+ order?: "asc" | "desc";
122
+ }
123
+ /**
124
+ * 更新消息的可变字段;role、type、payload、metadata 至少提供一个。
125
+ * 无需修改的字段应省略,不要显式传 undefined;ID、会话、序号和时间不能修改。
126
+ */
127
+ export interface UpdateMessageInput extends MessageRef {
128
+ /** 替换角色,接受自定义字符串;null 清空角色,省略则保留。 */
129
+ role?: string | null;
130
+ /** 替换消息类型;null 清空,省略则保留,不修改 payload.type。 */
131
+ type?: string | null;
132
+ /** 替换完整 JSON 内容,不合并对象;允许 null,省略则保留。 */
133
+ payload?: JsonValue;
134
+ /** 替换整个 JSON 元数据对象,不合并字段;`{}` 清空,省略则保留,不接受 null。 */
135
+ metadata?: JsonObject;
136
+ }
137
+ /**
138
+ * BytePlus IGA Pages 服务端的通用会话存储,通过 `@byteplus-iga-pages/agent/store` 导入 store 使用。
139
+ * 数据按当前运行时项目隔离;应用负责校验终端用户的会话访问权限。
140
+ * 初始化和异步调用的错误都应在 `try { await ... } catch { ... }` 中处理。
141
+ */
142
+ export interface Store {
143
+ /**
144
+ * 创建空会话;省略整个参数或 conversationId 时由 SDK 生成 UUID。
145
+ * 已有同 ID 会话时产生 conflict,不会读取或更新它;不自动重试网络错误。
146
+ */
147
+ createConversation(input?: CreateConversationInput): Promise<Conversation>;
148
+ /** 读取指定 ID 的会话信息,不包含消息列表;不存在时返回 null。 */
149
+ getConversation(input: ConversationRef): Promise<Conversation | null>;
150
+ /**
151
+ * 分页查询当前项目的会话,默认每页 50 条。
152
+ * 按 updatedAt 降序,同时间按 conversationId 降序;不支持改排序或按用户筛选。
153
+ * 更新时间可能在分页期间变化,此列表不提供固定快照;无结果时返回空页。
154
+ */
155
+ listConversations(input?: ListConversationsInput): Promise<Page<Conversation>>;
156
+ /**
157
+ * 原子合并会话 metadata 的顶层字段,顶层 null 删除键;空对象不修改会话。
158
+ * 不存在时产生 not_found,不隐式创建;不自动重试网络错误。
159
+ */
160
+ updateConversation(input: UpdateConversationInput): Promise<Conversation>;
161
+ /**
162
+ * 物理删除会话及其全部通用消息;不存在或重复删除均成功。
163
+ * 不保留删除墓碑,旧追加请求重放可能重建会话;应等待删除结束后再复用 ID。
164
+ * 重建后需重新开始分页。
165
+ */
166
+ deleteConversation(input: ConversationRef): Promise<void>;
167
+ /**
168
+ * 追加一条消息;指定 ID 的会话不存在时原子创建空 metadata 的会话。
169
+ * 相同 messageId、会话及内容重复追加会返回仍存在的消息;内容不匹配时产生 conflict。
170
+ * SDK 内部重试复用消息 ID;业务重新调用时需显式提供原 ID,否则会生成新 ID。
171
+ */
172
+ appendMessage(input: AppendMessageInput): Promise<Message>;
173
+ /**
174
+ * 原子追加 1~100 条消息,必要时创建会话;返回结果与输入一一对应且顺序相同。
175
+ * 校验或冲突失败时整批不写入;混合已有 ID 和新 ID 会产生 conflict。
176
+ * 业务重试需显式复用整批消息 ID 和内容;原子性仅覆盖单次调用。
177
+ */
178
+ appendMessages(input: AppendMessagesInput): Promise<Message[]>;
179
+ /** 按当前项目内唯一的非空 messageId 读取消息;不存在时返回 null。 */
180
+ getMessage(input: MessageRef): Promise<Message | null>;
181
+ /**
182
+ * 分页读取会话消息,默认返回最早的 50 条;读取最近消息时传 order: "desc"。
183
+ * nextCursor 为 null 时没有下一页;会话不存在或没有消息时返回空页。
184
+ * 第一页固定最大消息序号,后续追加不混入本轮分页;内容更新和删除仍会影响结果。
185
+ */
186
+ listMessages(input: ListMessagesInput): Promise<Page<Message>>;
187
+ /**
188
+ * 替换传入的消息字段,未传字段保留;payload 和 metadata 均整体替换,不合并对象。
189
+ * 不存在时产生 not_found,没有可更新字段时产生 invalid_argument;不自动重试网络错误。
190
+ */
191
+ updateMessage(input: UpdateMessageInput): Promise<Message>;
192
+ /**
193
+ * 物理删除一条消息,保留会话,不回退计数或重排现存序号;不存在或重复删除均成功。
194
+ * 删除后不保留该消息的去重记录;等待删除完成后再复用 ID,追加时会分配新序号。
195
+ */
196
+ deleteMessage(input: MessageRef): Promise<void>;
197
+ /**
198
+ * 原子清空会话的全部通用消息,保留会话、metadata、创建时间和序号计数。
199
+ * 实际删除消息才更新会话的 updatedAt;空会话或不存在时成功,不创建会话。
200
+ * 网络重试会再次清空届时的消息,应等待清空结束再追加,并重新开始分页。
201
+ * 不清理框架专用存储。
202
+ */
203
+ clearMessages(input: ConversationRef): Promise<void>;
204
+ }
205
+ export interface StoreRpcNames {
206
+ appendMessages: string;
207
+ updateConversation: string;
208
+ deleteConversation: string;
209
+ deleteMessage: string;
210
+ clearMessages: string;
211
+ }
212
+ export declare const DEFAULT_STORE_RPC_NAMES: Readonly<StoreRpcNames>;
213
+ export interface CreateStoreOptions {
214
+ projectId: string;
215
+ transport: SupabaseStoreTransport;
216
+ generateUuid?: () => string;
217
+ rpcNames?: Partial<StoreRpcNames>;
218
+ }
219
+ export declare class SupabaseStore implements Store {
220
+ private readonly projectId;
221
+ private readonly transport;
222
+ private readonly generateUuid;
223
+ private readonly rpcNames;
224
+ constructor(options: CreateStoreOptions);
225
+ createConversation(input?: CreateConversationInput): Promise<Conversation>;
226
+ getConversation(input: ConversationRef): Promise<Conversation | null>;
227
+ listConversations(input?: ListConversationsInput): Promise<Page<Conversation>>;
228
+ updateConversation(input: UpdateConversationInput): Promise<Conversation>;
229
+ deleteConversation(input: ConversationRef): Promise<void>;
230
+ appendMessage(input: AppendMessageInput): Promise<Message>;
231
+ appendMessages(input: AppendMessagesInput): Promise<Message[]>;
232
+ getMessage(input: MessageRef): Promise<Message | null>;
233
+ listMessages(input: ListMessagesInput): Promise<Page<Message>>;
234
+ updateMessage(input: UpdateMessageInput): Promise<Message>;
235
+ deleteMessage(input: MessageRef): Promise<void>;
236
+ clearMessages(input: ConversationRef): Promise<void>;
237
+ private readSnapshotSeq;
238
+ private execute;
239
+ }
240
+ export declare function createStore(options: CreateStoreOptions): Store;
@@ -0,0 +1,43 @@
1
+ import { type PostgrestSingleResponse, type SupabaseClient } from "@supabase/supabase-js";
2
+ import { type CreateAuthenticatedSupabaseClientOptions } from "../_internal/data-plane/index.js";
3
+ import { StoreCredentialProvider, type StoreCredentialProviderOptions } from "./credential-provider.js";
4
+ /**
5
+ * Store 数据面请求经过当前锁定版本 supabase-js 包装后的完整响应。
6
+ *
7
+ * 成功:`{ success: true, data: T, error: null, count, status, statusText }`。
8
+ * 失败:`{ success: false, data: null, error: PostgrestError, count: null, status, statusText }`。
9
+ *
10
+ * 这是 SDK 内部 transport 合同,不是 PostgREST 服务的原始 HTTP body。
11
+ */
12
+ export type SupabaseStoreOperationResult<T> = PostgrestSingleResponse<T>;
13
+ export interface SupabaseStoreResult<T> {
14
+ data: T;
15
+ count: number | null;
16
+ }
17
+ export interface ExecuteSupabaseStoreOperationOptions<T> {
18
+ /** Stable public operation name used in structured errors. */
19
+ operationName: string;
20
+ /**
21
+ * 只为读取操作或有幂等保证的操作启用。
22
+ * transport 不会猜测重放写操作是否安全。
23
+ */
24
+ retryOnUnauthorized: boolean;
25
+ /** 只有调用方生成的所有幂等键都已固定后才能启用。 */
26
+ retryOnNetworkError?: boolean;
27
+ operation(client: SupabaseClient): PromiseLike<SupabaseStoreOperationResult<T>>;
28
+ }
29
+ export interface SupabaseStoreTransportOptions {
30
+ credentialProvider: StoreCredentialProvider;
31
+ fetch?: typeof globalThis.fetch;
32
+ createClient?: CreateAuthenticatedSupabaseClientOptions["createClient"];
33
+ }
34
+ export interface CreateSupabaseStoreTransportOptions extends Omit<SupabaseStoreTransportOptions, "credentialProvider">, StoreCredentialProviderOptions {
35
+ }
36
+ export declare class SupabaseStoreTransport {
37
+ private readonly credentialProvider;
38
+ private readonly fetch;
39
+ private readonly createClient;
40
+ constructor(options: SupabaseStoreTransportOptions);
41
+ execute<T>(options: ExecuteSupabaseStoreOperationOptions<T>): Promise<SupabaseStoreResult<T>>;
42
+ }
43
+ export declare function createSupabaseStoreTransport(options: CreateSupabaseStoreTransportOptions): SupabaseStoreTransport;
@@ -0,0 +1,7 @@
1
+ import { type DataPlaneCredentials, type FetchDataPlaneCredentialsOptions } from "../_internal/data-plane/index.js";
2
+ export interface StoreCredentials extends DataPlaneCredentials {
3
+ }
4
+ export interface FetchStoreCredentialsOptions extends FetchDataPlaneCredentialsOptions {
5
+ }
6
+ export declare function validateStoreRootUrl(value: string, isAllowedHostname: (hostname: string) => boolean): string;
7
+ export declare function fetchStoreCredentials(options: FetchStoreCredentialsOptions): Promise<StoreCredentials>;
@@ -0,0 +1,5 @@
1
+ import type { BoundTool } from "./sandbox-tools.js";
2
+ import type { ClaudeAgentSdkTool, OpenAIAgentsTool, OpenAISdkTool } from "./types.js";
3
+ export declare function toClaudeAgentSdkTool(source: BoundTool): ClaudeAgentSdkTool;
4
+ export declare function toOpenAISdkTool(source: BoundTool): OpenAISdkTool;
5
+ export declare function toOpenAIAgentsTool(source: BoundTool): OpenAIAgentsTool;
@@ -0,0 +1,4 @@
1
+ import type { Sandbox } from "../sandbox/index.js";
2
+ import type { ClaudeAgentTools } from "./types.js";
3
+ export type { ClaudeAgentTools, ClaudeAgentSdkTool, ClaudeMcpConfig, ClaudeMcpTool, ClaudeMcpToolResult, ClaudeMcpConfigOptions } from "./types.js";
4
+ export declare function getTools(sandbox: Sandbox): ClaudeAgentTools;
@@ -0,0 +1,2 @@
1
+ export { getTools } from "./registry.js";
2
+ export type { BrowserFetchInput, BrowserScreenshotInput, CodeRunInput, FilesFindInput, FilesListInput, FilesReadInput, FilesSearchInput, FilesWriteInput, ShellExecInput, ToolInputMap, ToolOutputMap, ShellConsoleEntry, ShellExecOutput, FilesReadOutput, FilesWriteOutput, FileListEntry, FilesListOutput, FileSearchMatch, FilesSearchOutput, FilesFindOutput, CodeRunOutput, BrowserFetchOutput, BrowserScreenshotOutput, JsonSchema, OpenAIToolDeclaration, ClaudeMcpConfig, ClaudeMcpConfigOptions, ClaudeMcpTool, ClaudeMcpToolResult, PortableTools, SandboxToolName, ToolDefinition, ToolDomain, ToolError, ToolExecuteOptions, ToolResult, ToolContent, Tools, } from "./types.js";
@@ -0,0 +1,16 @@
1
+ import type { StructuredToolInterface as CommonJsStructuredTool } from "@langchain/core/tools" with { "resolution-mode": "require" };
2
+ import type { StructuredToolInterface as EsmStructuredTool } from "@langchain/core/tools" with { "resolution-mode": "import" };
3
+ import type { Sandbox } from "../sandbox/index.js";
4
+ import type { PortableTools, SandboxToolName } from "./types.js";
5
+ /** Native tools compatible with both ESM and CommonJS framework consumers. */
6
+ export type LangChainTool = CommonJsStructuredTool & EsmStructuredTool;
7
+ export interface LangChainTools extends Omit<PortableTools, SandboxToolName | "all" | "get" | "files" | "shell" | "code" | "browser">, Record<SandboxToolName, LangChainTool> {
8
+ all(): LangChainTool[];
9
+ get(name: string): LangChainTool;
10
+ files(): LangChainTool[];
11
+ shell(): LangChainTool[];
12
+ code(): LangChainTool[];
13
+ browser(): LangChainTool[];
14
+ }
15
+ /** Shared by LangChain, LangGraph and DeepAgents. Requires @langchain/core. */
16
+ export declare function getTools(sandbox: Sandbox): LangChainTools;
@@ -0,0 +1,8 @@
1
+ import type { BrowserScreenshotOutput, LangChainImageContent, OpenAIModelMessage, ToolResult } from "./types.js";
2
+ export declare function isScreenshotResult(result: ToolResult): result is {
3
+ status: "success";
4
+ data: BrowserScreenshotOutput;
5
+ };
6
+ export declare function toImageUrlContent(result: ToolResult): LangChainImageContent[];
7
+ /** Chat Completions tool messages are text-only; images go in a subsequent user message. */
8
+ export declare function toOpenAIModelMessages(result: ToolResult, toolCallId: string): OpenAIModelMessage[];
@@ -0,0 +1,4 @@
1
+ import type { Sandbox } from "../sandbox/index.js";
2
+ import type { OpenAIAgentsTools } from "./types.js";
3
+ export type { OpenAIAgentsTools, OpenAIAgentsTool } from "./types.js";
4
+ export declare function getTools(sandbox: Sandbox): OpenAIAgentsTools;
@@ -0,0 +1,5 @@
1
+ import type { Sandbox } from "../sandbox/index.js";
2
+ import type { OpenAISdkTools } from "./types.js";
3
+ export type { OpenAISdkTools, OpenAISdkTool, OpenAIToolDeclaration } from "./types.js";
4
+ export type { OpenAIModelMessage } from "./types.js";
5
+ export declare function getTools(sandbox: Sandbox): OpenAISdkTools;
@@ -0,0 +1,16 @@
1
+ import { type BoundTool } from "./sandbox-tools.js";
2
+ import type { PortableTools, ToolDefinition } from "./types.js";
3
+ import type { Sandbox } from "../sandbox/index.js";
4
+ /** Framework-independent tools. Choose a subpath for a framework adapter. */
5
+ export declare function getTools(sandbox: Sandbox): PortableTools;
6
+ /** Shared collection implementation; the public subpath supplies its own adapter. */
7
+ export declare function createToolRegistry<T, Extensions extends object = Record<never, never>>(sandbox: Sandbox, adapt: (sources: readonly BoundTool[]) => T[], extend?: (sources: readonly BoundTool[], adapted: readonly T[]) => Extensions): {
8
+ all: () => T[];
9
+ get: (name: string) => NonNullable<T>;
10
+ files: () => T[];
11
+ shell: () => T[];
12
+ code: () => T[];
13
+ browser: () => T[];
14
+ definitions: (names?: readonly string[]) => ToolDefinition<unknown, unknown>[];
15
+ };
16
+ export declare function selectSources(sources: readonly BoundTool[], names?: readonly string[]): BoundTool[];
@@ -0,0 +1,17 @@
1
+ import type { ToolError, ToolResult } from "./types.js";
2
+ export declare function success(data: unknown, preserveScreenshot?: boolean): ToolResult;
3
+ export declare function failure(tool: string, error: unknown): ToolResult;
4
+ export declare function normalizeError(tool: string, error: unknown): ToolError;
5
+ /** Convert an official Sandbox SDK APIResponse failure into the public contract. */
6
+ export declare function sandboxResponseError(error: unknown): ToolExecutionError;
7
+ declare class ToolExecutionError extends Error {
8
+ readonly info: Omit<ToolError, "tool">;
9
+ constructor(info: Omit<ToolError, "tool">);
10
+ }
11
+ /** Interpret only the documented result fields of the invoked Sandbox operation. */
12
+ export declare function checkSandboxBusinessResult(body: unknown, operation: string, status?: number): void;
13
+ export declare function sanitize(value: unknown, preserveScreenshot?: boolean): unknown;
14
+ export declare function sanitizeMessage(message: string): string;
15
+ /** Error details keep their original structure and full text, with credentials redacted. */
16
+ export declare function redactErrorDetails(value: unknown, ancestors?: WeakSet<object>): unknown;
17
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { BrowserFetchOutput, BrowserScreenshotOutput, CodeRunOutput, FilesFindOutput, FilesListOutput, FilesReadOutput, FilesSearchOutput, FilesWriteOutput, ShellExecOutput } from "./types.js";
2
+ export declare function mapShellExecOutput(value: unknown): ShellExecOutput;
3
+ export declare function mapFilesReadOutput(value: unknown): FilesReadOutput;
4
+ export declare function mapFilesWriteOutput(value: unknown): FilesWriteOutput;
5
+ export declare function mapFilesListOutput(value: unknown): FilesListOutput;
6
+ export declare function mapFilesSearchOutput(value: unknown): FilesSearchOutput;
7
+ export declare function mapFilesFindOutput(value: unknown): FilesFindOutput;
8
+ export declare function mapCodeRunOutput(value: unknown): CodeRunOutput;
9
+ export declare function mapBrowserFetchOutput(navigation: unknown, content: unknown): BrowserFetchOutput;
10
+ export declare function mapBrowserScreenshotOutput(body: unknown): Promise<BrowserScreenshotOutput>;
@@ -0,0 +1,17 @@
1
+ import type { Sandbox } from "../sandbox/index.js";
2
+ import { z, type ZodType } from "zod";
3
+ import type { JsonSchema, ToolDefinition, ToolDomain, ToolExecuteOptions } from "./types.js";
4
+ export interface SandboxToolSpec {
5
+ readonly name: string;
6
+ readonly domain: ToolDomain;
7
+ readonly description: string;
8
+ readonly inputSchema: JsonSchema;
9
+ readonly validate: z.AnyZodObject;
10
+ readonly execute: (input: Record<string, unknown>, options?: ToolExecuteOptions) => Promise<unknown>;
11
+ }
12
+ export interface BoundTool {
13
+ readonly definition: ToolDefinition;
14
+ readonly schema: ZodType<unknown>;
15
+ }
16
+ export declare function createSandboxTools(sandbox: Sandbox): SandboxToolSpec[];
17
+ export declare function bindSandboxTool(spec: SandboxToolSpec): BoundTool;