@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,242 @@
1
+ "use strict";
2
+ exports.ids = [
3
+ "521"
4
+ ];
5
+ exports.modules = {
6
+ "../tools/src/adapters.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ Kv: ()=>toOpenAIAgentsTool,
9
+ dF: ()=>toClaudeAgentSdkTool,
10
+ iE: ()=>toOpenAISdkTool
11
+ });
12
+ var zod__rspack_import_1 = __webpack_require__("../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js");
13
+ var _model_output_js__rspack_import_0 = __webpack_require__("../tools/src/model-output.ts");
14
+ function toClaudeAgentSdkTool(source) {
15
+ return {
16
+ ...toClaudeMcpTool(source),
17
+ execute: source.definition.execute
18
+ };
19
+ }
20
+ function toOpenAISdkTool(source) {
21
+ return {
22
+ type: "function",
23
+ function: {
24
+ name: source.definition.name,
25
+ description: source.definition.description,
26
+ parameters: source.definition.inputSchema
27
+ },
28
+ execute: source.definition.execute,
29
+ toModelMessages: _model_output_js__rspack_import_0.LW
30
+ };
31
+ }
32
+ function toOpenAIAgentsTool(source) {
33
+ const execute = (input, options)=>source.definition.execute(stripNullishObject(input), options);
34
+ return {
35
+ type: "function",
36
+ name: source.definition.name,
37
+ description: source.definition.description,
38
+ strict: true,
39
+ parameters: toOpenAIStrictSchema(source.definition.inputSchema),
40
+ execute,
41
+ invoke: async (contextOrInput, input, details)=>{
42
+ const result = await execute(parseToolInput(void 0 === input ? contextOrInput : input), {
43
+ abortSignal: details?.signal
44
+ });
45
+ if (!(0, _model_output_js__rspack_import_0.eA)(result)) return result;
46
+ const { base64Image, mimeType, base64ImageLength } = result.data;
47
+ return [
48
+ {
49
+ type: "text",
50
+ text: JSON.stringify({
51
+ status: "success",
52
+ data: {
53
+ mimeType,
54
+ base64ImageLength
55
+ }
56
+ })
57
+ },
58
+ {
59
+ type: "image",
60
+ image: `data:${mimeType};base64,${base64Image}`
61
+ }
62
+ ];
63
+ },
64
+ needsApproval: async ()=>false,
65
+ isEnabled: async ()=>true
66
+ };
67
+ }
68
+ function toClaudeMcpTool(source, options) {
69
+ const tool = {
70
+ name: source.definition.name,
71
+ description: source.definition.description,
72
+ inputSchema: toClaudeInputShape(source.definition.inputSchema),
73
+ async handler (input, extra) {
74
+ const signal = extra && "object" == typeof extra && "signal" in extra ? extra.signal : void 0;
75
+ const result = await source.definition.execute(input, {
76
+ abortSignal: signal instanceof AbortSignal ? signal : void 0
77
+ });
78
+ if ("error" === result.status) return {
79
+ content: [
80
+ {
81
+ type: "text",
82
+ text: stringify(result)
83
+ }
84
+ ],
85
+ isError: true
86
+ };
87
+ if ((0, _model_output_js__rspack_import_0.eA)(result)) {
88
+ const { base64Image, mimeType, base64ImageLength } = result.data;
89
+ return {
90
+ content: [
91
+ {
92
+ type: "text",
93
+ text: JSON.stringify({
94
+ status: "success",
95
+ data: {
96
+ mimeType,
97
+ base64ImageLength
98
+ }
99
+ })
100
+ },
101
+ {
102
+ type: "image",
103
+ data: base64Image,
104
+ mimeType
105
+ }
106
+ ]
107
+ };
108
+ }
109
+ return {
110
+ content: [
111
+ {
112
+ type: "text",
113
+ text: stringify(result)
114
+ }
115
+ ]
116
+ };
117
+ }
118
+ };
119
+ if (options?.alwaysLoad ?? true) return {
120
+ ...tool,
121
+ _meta: {
122
+ "anthropic/alwaysLoad": true
123
+ }
124
+ };
125
+ return tool;
126
+ }
127
+ function toOpenAIStrictSchema(schema) {
128
+ const required = new Set(schema.required ?? []);
129
+ return {
130
+ type: "object",
131
+ properties: Object.fromEntries(Object.entries(schema.properties).map(([name, property])=>[
132
+ name,
133
+ {
134
+ ...required.has(name) ? toOpenAIPropertySchema(property) : {
135
+ anyOf: [
136
+ toOpenAIPropertySchema(property),
137
+ {
138
+ type: "null"
139
+ }
140
+ ]
141
+ },
142
+ ...propertyDescription(property)
143
+ }
144
+ ])),
145
+ required: Object.keys(schema.properties),
146
+ additionalProperties: false
147
+ };
148
+ }
149
+ function toOpenAIPropertySchema(property) {
150
+ const schema = property;
151
+ if (Array.isArray(schema.enum) && schema.enum.every((value)=>"string" == typeof value)) return {
152
+ type: "string",
153
+ enum: schema.enum
154
+ };
155
+ switch(schema.type){
156
+ case "number":
157
+ case "integer":
158
+ return {
159
+ type: "number",
160
+ ..."number" == typeof schema.minimum ? {
161
+ minimum: schema.minimum
162
+ } : {}
163
+ };
164
+ case "boolean":
165
+ return {
166
+ type: "boolean"
167
+ };
168
+ case "object":
169
+ return {
170
+ type: "object",
171
+ additionalProperties: {}
172
+ };
173
+ case "array":
174
+ return {
175
+ type: "array",
176
+ items: {}
177
+ };
178
+ default:
179
+ return {
180
+ type: "string"
181
+ };
182
+ }
183
+ }
184
+ function toClaudeInputShape(schema) {
185
+ const required = new Set(schema.required ?? []);
186
+ return Object.fromEntries(Object.entries(schema.properties).map(([name, property])=>{
187
+ const base = toZodSchema(property);
188
+ const field = required.has(name) ? base : base.optional();
189
+ const { description } = propertyDescription(property);
190
+ return [
191
+ name,
192
+ void 0 === description ? field : field.describe(description)
193
+ ];
194
+ }));
195
+ }
196
+ function propertyDescription(property) {
197
+ const { description } = property;
198
+ return "string" == typeof description ? {
199
+ description
200
+ } : {};
201
+ }
202
+ function toZodSchema(property) {
203
+ const schema = property;
204
+ if (Array.isArray(schema.enum) && schema.enum.every((value)=>"string" == typeof value)) return zod__rspack_import_1.k5(schema.enum);
205
+ switch(schema.type){
206
+ case "number":
207
+ {
208
+ const numberSchema = zod__rspack_import_1.ai();
209
+ return "number" == typeof schema.minimum ? numberSchema.min(schema.minimum) : numberSchema;
210
+ }
211
+ case "integer":
212
+ {
213
+ const numberSchema = zod__rspack_import_1.ai().int();
214
+ return "number" == typeof schema.minimum ? numberSchema.min(schema.minimum) : numberSchema;
215
+ }
216
+ case "boolean":
217
+ return zod__rspack_import_1.zM();
218
+ case "array":
219
+ return zod__rspack_import_1.YO(zod__rspack_import_1.L5());
220
+ case "object":
221
+ return zod__rspack_import_1.g1(zod__rspack_import_1.L5());
222
+ default:
223
+ return zod__rspack_import_1.Yj();
224
+ }
225
+ }
226
+ function parseToolInput(input) {
227
+ if ("string" == typeof input) try {
228
+ return stripNullishObject(JSON.parse(input));
229
+ } catch {
230
+ return {};
231
+ }
232
+ return stripNullishObject(input);
233
+ }
234
+ function stripNullishObject(input) {
235
+ if (null === input || "object" != typeof input || Array.isArray(input)) return {};
236
+ return Object.fromEntries(Object.entries(input).filter(([, value])=>null != value));
237
+ }
238
+ function stringify(result) {
239
+ return JSON.stringify(result);
240
+ }
241
+ }
242
+ };
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ exports.ids = [
3
+ "594"
4
+ ];
5
+ exports.modules = {
6
+ "../tools/src/model-output.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ LW: ()=>toOpenAIModelMessages,
9
+ LY: ()=>toImageUrlContent,
10
+ eA: ()=>isScreenshotResult
11
+ });
12
+ function isScreenshotResult(result) {
13
+ if ("error" === result.status || !result.data || "object" != typeof result.data) return false;
14
+ const data = result.data;
15
+ return "string" == typeof data.base64Image && data.base64Image.length > 0 && "string" == typeof data.mimeType && /^image\/(png|jpeg|webp|gif)$/.test(data.mimeType) && "number" == typeof data.base64ImageLength;
16
+ }
17
+ function toImageUrlContent(result) {
18
+ if (!isScreenshotResult(result)) return [
19
+ {
20
+ type: "text",
21
+ text: JSON.stringify(result)
22
+ }
23
+ ];
24
+ const { base64Image, mimeType, base64ImageLength } = result.data;
25
+ return [
26
+ {
27
+ type: "text",
28
+ text: JSON.stringify({
29
+ status: "success",
30
+ data: {
31
+ mimeType,
32
+ base64ImageLength
33
+ }
34
+ })
35
+ },
36
+ {
37
+ type: "image_url",
38
+ image_url: {
39
+ url: `data:${mimeType};base64,${base64Image}`
40
+ }
41
+ }
42
+ ];
43
+ }
44
+ function toOpenAIModelMessages(result, toolCallId) {
45
+ if (!isScreenshotResult(result)) return [
46
+ {
47
+ role: "tool",
48
+ tool_call_id: toolCallId,
49
+ content: JSON.stringify(result)
50
+ }
51
+ ];
52
+ const content = toImageUrlContent(result);
53
+ return [
54
+ {
55
+ role: "tool",
56
+ tool_call_id: toolCallId,
57
+ content: JSON.stringify({
58
+ status: "success",
59
+ data: {
60
+ mimeType: result.data.mimeType,
61
+ base64ImageLength: result.data.base64ImageLength
62
+ },
63
+ message: "Screenshot is attached in a following user image message."
64
+ })
65
+ },
66
+ {
67
+ role: "user",
68
+ content: [
69
+ {
70
+ type: "text",
71
+ text: `Screenshot from tool call ${toolCallId}.`
72
+ },
73
+ ...content.filter((part)=>"image_url" === part.type)
74
+ ]
75
+ }
76
+ ];
77
+ }
78
+ }
79
+ };