@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.
- package/LICENSE +20 -0
- package/README.md +84 -2
- package/dist/cjs/261.js +77 -0
- package/dist/cjs/341.js +43 -0
- package/dist/cjs/401.js +3632 -0
- package/dist/cjs/419.js +854 -0
- package/dist/cjs/504.js +760 -0
- package/dist/cjs/521.js +242 -0
- package/dist/cjs/594.js +79 -0
- package/dist/cjs/647.js +1367 -0
- package/dist/cjs/808.js +322 -0
- package/dist/cjs/82.js +10089 -0
- package/dist/cjs/893.js +17720 -0
- package/dist/cjs/893.js.LICENSE.txt +13 -0
- package/dist/cjs/951.js +59 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/runtime.js +79 -0
- package/dist/cjs/sandbox/host.js +125 -0
- package/dist/cjs/sandbox/index.js +286 -0
- package/dist/cjs/store/claude.js +209 -0
- package/dist/cjs/store/host.js +92 -0
- package/dist/cjs/store/index.js +43 -0
- package/dist/cjs/store/langgraph.js +581 -0
- package/dist/cjs/store/openai.js +118 -0
- package/dist/cjs/tools/claude.js +59 -0
- package/dist/cjs/tools/index.js +37 -0
- package/dist/cjs/tools/langchain.js +52 -0
- package/dist/cjs/tools/openai-agents.js +43 -0
- package/dist/cjs/tools/openai.js +43 -0
- package/dist/esm/128.js +10381 -0
- package/dist/esm/261.js +67 -0
- package/dist/esm/341.js +30 -0
- package/dist/esm/392.js +4453 -0
- package/dist/esm/417.js +704 -0
- package/dist/esm/521.js +230 -0
- package/dist/esm/594.js +67 -0
- package/dist/esm/613.js +19042 -0
- package/dist/esm/613.js.LICENSE.txt +13 -0
- package/dist/esm/951.js +44 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/runtime.js +39 -0
- package/dist/esm/sandbox/host.js +1 -0
- package/dist/esm/sandbox/index.js +183 -0
- package/dist/esm/store/claude.js +172 -0
- package/dist/esm/store/host.js +46 -0
- package/dist/esm/store/index.js +2 -0
- package/dist/esm/store/langgraph.js +542 -0
- package/dist/esm/store/openai.js +81 -0
- package/dist/esm/tools/claude.js +22 -0
- package/dist/esm/tools/index.js +1 -0
- package/dist/esm/tools/langchain.js +16 -0
- package/dist/esm/tools/openai-agents.js +6 -0
- package/dist/esm/tools/openai.js +6 -0
- package/dist/types/_internal/data-plane/control-plane-request.d.ts +12 -0
- package/dist/types/_internal/data-plane/control-plane.d.ts +3 -0
- package/dist/types/_internal/data-plane/credential-provider.d.ts +25 -0
- package/dist/types/_internal/data-plane/errors.d.ts +19 -0
- package/dist/types/_internal/data-plane/index.d.ts +11 -0
- package/dist/types/_internal/data-plane/supabase-client.d.ts +12 -0
- package/dist/types/_internal/data-plane/token-client.d.ts +23 -0
- package/dist/types/sandbox/api-client.d.ts +37 -0
- package/dist/types/sandbox/api-types.d.ts +81 -0
- package/dist/types/sandbox/binding-repository.d.ts +62 -0
- package/dist/types/sandbox/error.d.ts +22 -0
- package/dist/types/sandbox/expiry.d.ts +11 -0
- package/dist/types/sandbox/host.d.ts +6 -0
- package/dist/types/sandbox/iga-sandbox.d.ts +208 -0
- package/dist/types/sandbox/index.d.ts +8 -0
- package/dist/types/sandbox/public-surface.d.ts +19 -0
- package/dist/types/sandbox/runtime-sandbox.d.ts +32 -0
- package/dist/types/sandbox/types.d.ts +238 -0
- package/dist/types/store/append.d.ts +41 -0
- package/dist/types/store/claude-repository.d.ts +36 -0
- package/dist/types/store/claude.d.ts +3 -0
- package/dist/types/store/control-plane-request.d.ts +2 -0
- package/dist/types/store/credential-error.d.ts +2 -0
- package/dist/types/store/credential-provider.d.ts +29 -0
- package/dist/types/store/errors.d.ts +29 -0
- package/dist/types/store/factory.d.ts +31 -0
- package/dist/types/store/host.d.ts +5 -0
- package/dist/types/store/index.d.ts +6 -0
- package/dist/types/store/json.d.ts +7 -0
- package/dist/types/store/langgraph-repository.d.ts +98 -0
- package/dist/types/store/langgraph.d.ts +43 -0
- package/dist/types/store/openai.d.ts +12 -0
- package/dist/types/store/pagination.d.ts +27 -0
- package/dist/types/store/runtime-data-plane.d.ts +8 -0
- package/dist/types/store/runtime-provider.d.ts +1 -0
- package/dist/types/store/runtime-store.d.ts +20 -0
- package/dist/types/store/store.d.ts +240 -0
- package/dist/types/store/supabase-transport.d.ts +43 -0
- package/dist/types/store/token-client.d.ts +7 -0
- package/dist/types/tools/adapters.d.ts +5 -0
- package/dist/types/tools/claude.d.ts +4 -0
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/langchain.d.ts +16 -0
- package/dist/types/tools/model-output.d.ts +8 -0
- package/dist/types/tools/openai-agents.d.ts +4 -0
- package/dist/types/tools/openai.d.ts +5 -0
- package/dist/types/tools/registry.d.ts +16 -0
- package/dist/types/tools/result.d.ts +17 -0
- package/dist/types/tools/sandbox-result-mappers.d.ts +10 -0
- package/dist/types/tools/sandbox-tools.d.ts +17 -0
- package/dist/types/tools/types.d.ts +307 -0
- package/package.json +136 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2026 BytePlus Pte. Ltd. All Rights Reserved.
|
|
2
|
+
|
|
3
|
+
@byteplus-iga-pages/agent is developed by BytePlus Pte. Ltd. (hereinafter "BytePlus").
|
|
4
|
+
Any copyright or patent right is owned by BytePlus or its affiliates.
|
|
5
|
+
|
|
6
|
+
@byteplus-iga-pages/agent is available under a commercial license. Customers can contact
|
|
7
|
+
BytePlus through https://www.byteplus.com for commercial licensing options.
|
|
8
|
+
|
|
9
|
+
Access to or use of this software is subject to the BytePlus Software License
|
|
10
|
+
and Services Agreement, which you agree to and accept by downloading or
|
|
11
|
+
installing this software, available at:
|
|
12
|
+
https://docs.byteplus.com/en/legal/docs/byteplus-software-license-and-services-agreement
|
|
13
|
+
|
|
14
|
+
Without BytePlus's prior written permission, any use of @byteplus-iga-pages/agent,
|
|
15
|
+
in particular any use for commercial purposes, is prohibited. This includes,
|
|
16
|
+
without limitation, incorporation in a commercial product, use in a commercial
|
|
17
|
+
service, or production of other artefacts for commercial purposes.
|
|
18
|
+
|
|
19
|
+
Without BytePlus's prior written permission, @byteplus-iga-pages/agent may not be
|
|
20
|
+
reproduced, modified or made available in any form to any third party.
|
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @byteplus-iga-pages/agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server-side SDK for BytePlus IGA Pages agents: persist conversations, run Sandbox tools, and connect to agent frameworks.
|
|
4
|
+
|
|
5
|
+
[Official BytePlus IGA Pages documentation](https://docs.byteplus.com/en/docs/iga)
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Requires Node.js 20+ and an BytePlus IGA Pages server runtime.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @byteplus-iga-pages/agent
|
|
13
|
+
npm install -g @byteplus-iga-pages/cli
|
|
14
|
+
bp-iga login
|
|
15
|
+
bp-iga pages link
|
|
16
|
+
bp-iga pages dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Pages supplies the project identity locally and after deployment. No IGA endpoint or credential is needed in application code.
|
|
20
|
+
|
|
21
|
+
## Store
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { store } from "@byteplus-iga-pages/agent/store";
|
|
25
|
+
|
|
26
|
+
const { conversationId } = await store.createConversation({
|
|
27
|
+
metadata: { title: "New conversation" },
|
|
28
|
+
});
|
|
29
|
+
await store.appendMessage({
|
|
30
|
+
conversationId,
|
|
31
|
+
role: "user",
|
|
32
|
+
payload: { text: "Hello" },
|
|
33
|
+
});
|
|
34
|
+
const page = await store.listMessages({ conversationId, limit: 20 });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Store preserves your JSON payload. `page.nextCursor` continues pagination. Your application must authorize access to each conversation ID.
|
|
38
|
+
|
|
39
|
+
## Tools and Sandbox
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { getConversationSandbox } from "@byteplus-iga-pages/agent/sandbox";
|
|
43
|
+
import { getTools } from "@byteplus-iga-pages/agent/tools";
|
|
44
|
+
|
|
45
|
+
const sandbox = getConversationSandbox(conversationId);
|
|
46
|
+
const result = await getTools(sandbox).code_run.execute({
|
|
47
|
+
language: "python",
|
|
48
|
+
code: "print(1 + 1)",
|
|
49
|
+
});
|
|
50
|
+
if (result.status === "error") throw new Error(result.error.message);
|
|
51
|
+
|
|
52
|
+
// Direct Sandbox API, when you need more control:
|
|
53
|
+
await sandbox.code.executeCode({ language: "python", code: "print(1 + 1)" });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`getTools(sandbox)` provides nine tools: `files_read`, `files_write`, `files_list`, `files_search`, `files_find`, `shell_exec`, `code_run`, `browser_fetch`, and `browser_screenshot`. Calls return `{ status: "success", data }` or `{ status: "error", error }`.
|
|
57
|
+
|
|
58
|
+
The direct `Sandbox` API exposes:
|
|
59
|
+
|
|
60
|
+
| Module | Methods |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `sandbox.code` | `executeCode` |
|
|
63
|
+
| `sandbox.shell` | `execCommand`, `view`, `waitForProcess`, `killProcess` |
|
|
64
|
+
| `sandbox.file` | `readFile`, `writeFile`, `replaceInFile`, `searchInFile`, `findFiles`, `grepFiles`, `listPath` |
|
|
65
|
+
| `sandbox.browserPage` | Navigation, interaction, screenshots, and page content; see the exported `Sandbox` type for all methods |
|
|
66
|
+
|
|
67
|
+
Use `getConversationSandbox(conversationId)` for a conversation-bound instance. For a standalone instance, use `const sandbox = await createSandbox()`, save `sandbox.sandboxId`, and reconnect with `connectSandbox(sandboxId)`. Instances also support `getInfo()`, `extendTimeout(minutes)`, and `destroy()`.
|
|
68
|
+
|
|
69
|
+
## Imports
|
|
70
|
+
|
|
71
|
+
There is no package-root import. Use these subpaths:
|
|
72
|
+
|
|
73
|
+
| Path after `@byteplus-iga-pages/agent/` | API |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `store` | `store`, `StoreError` |
|
|
76
|
+
| `store/openai`, `store/langgraph`, `store/claude` | `createSession`, `createCheckpointer`, `createSessionStore` |
|
|
77
|
+
| `tools` | Portable `getTools` |
|
|
78
|
+
| `tools/openai`, `tools/openai-agents`, `tools/claude`, `tools/langchain` | Framework-specific `getTools` |
|
|
79
|
+
| `sandbox` | `getConversationSandbox`, `createSandbox`, `connectSandbox` |
|
|
80
|
+
|
|
81
|
+
Install the corresponding framework SDK when using an adapter. See [package.json](./package.json) for optional peer dependencies.
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
See [LICENSE](./LICENSE) for terms of use.
|
package/dist/cjs/261.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.ids = [
|
|
3
|
+
"261"
|
|
4
|
+
];
|
|
5
|
+
exports.modules = {
|
|
6
|
+
"../store/src/runtime-store.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
M: ()=>store
|
|
9
|
+
});
|
|
10
|
+
var _errors_js__rspack_import_1 = __webpack_require__("../store/src/errors.ts");
|
|
11
|
+
var _runtime_data_plane_js__rspack_import_0 = __webpack_require__("../store/src/runtime-data-plane.ts");
|
|
12
|
+
const PUBLIC_STORE_METHODS = [
|
|
13
|
+
"createConversation",
|
|
14
|
+
"getConversation",
|
|
15
|
+
"listConversations",
|
|
16
|
+
"updateConversation",
|
|
17
|
+
"deleteConversation",
|
|
18
|
+
"appendMessage",
|
|
19
|
+
"appendMessages",
|
|
20
|
+
"getMessage",
|
|
21
|
+
"listMessages",
|
|
22
|
+
"updateMessage",
|
|
23
|
+
"deleteMessage",
|
|
24
|
+
"clearMessages"
|
|
25
|
+
];
|
|
26
|
+
const store = createPublicStore();
|
|
27
|
+
function createPublicStore() {
|
|
28
|
+
const methods = new Set(PUBLIC_STORE_METHODS);
|
|
29
|
+
const bound = new Map();
|
|
30
|
+
const getMethod = (method)=>{
|
|
31
|
+
if (bound.has(method)) return bound.get(method);
|
|
32
|
+
const value = async (...args)=>{
|
|
33
|
+
const instance = await (0, _runtime_data_plane_js__rspack_import_0.y)();
|
|
34
|
+
const implementation = instance[method];
|
|
35
|
+
if ("function" != typeof implementation) throw new _errors_js__rspack_import_1.A("UnknownError", "Store runtime is invalid");
|
|
36
|
+
return Reflect.apply(implementation, instance, args);
|
|
37
|
+
};
|
|
38
|
+
bound.set(method, value);
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
return new Proxy(Object.create(null), {
|
|
42
|
+
get (_target, property) {
|
|
43
|
+
return methods.has(property) ? getMethod(property) : void 0;
|
|
44
|
+
},
|
|
45
|
+
has (_target, property) {
|
|
46
|
+
return methods.has(property);
|
|
47
|
+
},
|
|
48
|
+
ownKeys () {
|
|
49
|
+
return [
|
|
50
|
+
...PUBLIC_STORE_METHODS
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
getOwnPropertyDescriptor (_target, property) {
|
|
54
|
+
if (!methods.has(property)) return;
|
|
55
|
+
return {
|
|
56
|
+
configurable: true,
|
|
57
|
+
enumerable: false,
|
|
58
|
+
writable: false,
|
|
59
|
+
value: getMethod(property)
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
getPrototypeOf () {
|
|
63
|
+
return null;
|
|
64
|
+
},
|
|
65
|
+
set () {
|
|
66
|
+
return false;
|
|
67
|
+
},
|
|
68
|
+
defineProperty () {
|
|
69
|
+
return false;
|
|
70
|
+
},
|
|
71
|
+
deleteProperty () {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
package/dist/cjs/341.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.ids = [
|
|
3
|
+
"341"
|
|
4
|
+
];
|
|
5
|
+
exports.modules = {
|
|
6
|
+
"../sandbox/src/error.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
ES: ()=>SandboxError,
|
|
9
|
+
YA: ()=>SandboxInstanceGoneError,
|
|
10
|
+
sX: ()=>SandboxAbortError,
|
|
11
|
+
zf: ()=>isAbortError
|
|
12
|
+
});
|
|
13
|
+
var node_http__rspack_import_0 = __webpack_require__("node:http");
|
|
14
|
+
class SandboxError extends Error {
|
|
15
|
+
toJSON() {
|
|
16
|
+
return {
|
|
17
|
+
code: this.code,
|
|
18
|
+
...void 0 !== this.status ? {
|
|
19
|
+
status: this.status
|
|
20
|
+
} : {},
|
|
21
|
+
message: this.message
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
constructor(message, options = {}){
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "SandboxError";
|
|
27
|
+
if (Number.isInteger(options.status) && options.status >= 100 && options.status <= 599) this.status = options.status;
|
|
28
|
+
const statusName = void 0 !== this.status && this.status >= 400 ? node_http__rspack_import_0.STATUS_CODES[this.status] : void 0;
|
|
29
|
+
this.code = statusName?.replace(/[^A-Za-z0-9]/g, "") || "SandboxError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class SandboxAbortError extends SandboxError {
|
|
33
|
+
}
|
|
34
|
+
class SandboxInstanceGoneError extends SandboxError {
|
|
35
|
+
}
|
|
36
|
+
function isAbortError(error) {
|
|
37
|
+
if (error instanceof SandboxAbortError) return true;
|
|
38
|
+
if (error instanceof Error && "AbortError" === error.name) return true;
|
|
39
|
+
const value = error;
|
|
40
|
+
return value?.name === "AbortError" || value?.code === "ABORT_ERR";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|