@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* mime-db
|
|
3
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
+
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* mime-types
|
|
10
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
11
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
12
|
+
* MIT Licensed
|
|
13
|
+
*/
|
package/dist/cjs/951.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.ids = [
|
|
3
|
+
"951"
|
|
4
|
+
];
|
|
5
|
+
exports.modules = {
|
|
6
|
+
"../store/src/runtime-data-plane.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
G: ()=>executeRuntimeStoreOperation,
|
|
9
|
+
y: ()=>resolveRuntimeStore
|
|
10
|
+
});
|
|
11
|
+
var _iga_pages_data_plane__rspack_import_0 = __webpack_require__("../data-plane/dist/esm/index.js");
|
|
12
|
+
var _credential_provider_js__rspack_import_2 = __webpack_require__("../store/src/credential-provider.ts");
|
|
13
|
+
var _errors_js__rspack_import_1 = __webpack_require__("../store/src/errors.ts");
|
|
14
|
+
var _store_js__rspack_import_5 = __webpack_require__("../store/src/store.ts");
|
|
15
|
+
var _supabase_transport_js__rspack_import_4 = __webpack_require__("../store/src/supabase-transport.ts");
|
|
16
|
+
var _token_client_js__rspack_import_3 = __webpack_require__("../store/src/token-client.ts");
|
|
17
|
+
let runtimeDataPlane;
|
|
18
|
+
function requireRuntimeEnv(name) {
|
|
19
|
+
const value = "u" < typeof process ? void 0 : process.env[name]?.trim();
|
|
20
|
+
if (!value) throw new _errors_js__rspack_import_1.A("ServiceUnavailable", "Store is only available in the IGA Pages server runtime.");
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function resolveRuntimeDataPlane() {
|
|
24
|
+
if (runtimeDataPlane) return runtimeDataPlane;
|
|
25
|
+
const token = requireRuntimeEnv("IGA_AUTH_KEY");
|
|
26
|
+
const provider = new _credential_provider_js__rspack_import_2.q1({
|
|
27
|
+
fetchCredentials: ()=>(0, _token_client_js__rspack_import_3.o)({
|
|
28
|
+
endpoint: _iga_pages_data_plane__rspack_import_0.KK,
|
|
29
|
+
token,
|
|
30
|
+
isAllowedTokenEndpoint: (url)=>{
|
|
31
|
+
const allowed = new URL(_iga_pages_data_plane__rspack_import_0.KK);
|
|
32
|
+
return url.origin === allowed.origin && url.pathname === allowed.pathname;
|
|
33
|
+
},
|
|
34
|
+
isAllowedHostname: (hostname)=>hostname.endsWith(_iga_pages_data_plane__rspack_import_0.I7)
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
const transport = new _supabase_transport_js__rspack_import_4.H({
|
|
38
|
+
credentialProvider: provider
|
|
39
|
+
});
|
|
40
|
+
runtimeDataPlane = {
|
|
41
|
+
provider,
|
|
42
|
+
transport
|
|
43
|
+
};
|
|
44
|
+
return runtimeDataPlane;
|
|
45
|
+
}
|
|
46
|
+
async function resolveRuntimeStore() {
|
|
47
|
+
const runtime = resolveRuntimeDataPlane();
|
|
48
|
+
if (runtime.store) return runtime.store;
|
|
49
|
+
const projectId = await runtime.provider.getProjectId();
|
|
50
|
+
return runtime.store ??= (0, _store_js__rspack_import_5.y$)({
|
|
51
|
+
projectId,
|
|
52
|
+
transport: runtime.transport
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function executeRuntimeStoreOperation(options) {
|
|
56
|
+
return resolveRuntimeDataPlane().transport.execute(options);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {};
|
|
3
|
+
var __webpack_module_cache__ = {};
|
|
4
|
+
function __webpack_require__(moduleId) {
|
|
5
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
+
var module1 = __webpack_module_cache__[moduleId] = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
__webpack_modules__[moduleId].call(module1.exports, module1, module1.exports, __webpack_require__);
|
|
11
|
+
return module1.exports;
|
|
12
|
+
}
|
|
13
|
+
__webpack_require__.m = __webpack_modules__;
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.n = (module1)=>{
|
|
16
|
+
var getter = module1 && module1.__esModule ? ()=>module1['default'] : ()=>module1;
|
|
17
|
+
__webpack_require__.d(getter, {
|
|
18
|
+
a: getter
|
|
19
|
+
});
|
|
20
|
+
return getter;
|
|
21
|
+
};
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
25
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: definition[key]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
31
|
+
(()=>{
|
|
32
|
+
__webpack_require__.f = {};
|
|
33
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
34
|
+
__webpack_require__.f[key](chunkId, promises);
|
|
35
|
+
return promises;
|
|
36
|
+
}, []));
|
|
37
|
+
})();
|
|
38
|
+
(()=>{
|
|
39
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
40
|
+
})();
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
43
|
+
})();
|
|
44
|
+
(()=>{
|
|
45
|
+
__webpack_require__.r = (exports)=>{
|
|
46
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
47
|
+
value: 'Module'
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, '__esModule', {
|
|
50
|
+
value: true
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
(()=>{
|
|
55
|
+
__webpack_require__.X = (result, chunkIds, fn)=>{
|
|
56
|
+
var moduleId = chunkIds;
|
|
57
|
+
if (!fn) chunkIds = result, fn = ()=>__webpack_require__(__webpack_require__.s = moduleId);
|
|
58
|
+
chunkIds.map(__webpack_require__.e, __webpack_require__);
|
|
59
|
+
var r = fn();
|
|
60
|
+
return void 0 === r ? result : r;
|
|
61
|
+
};
|
|
62
|
+
})();
|
|
63
|
+
(()=>{
|
|
64
|
+
var installedChunks = {
|
|
65
|
+
146: 1
|
|
66
|
+
};
|
|
67
|
+
var installChunk = (chunk)=>{
|
|
68
|
+
var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;
|
|
69
|
+
for(var moduleId in moreModules)if (__webpack_require__.o(moreModules, moduleId)) __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
70
|
+
if (runtime) runtime(__webpack_require__);
|
|
71
|
+
for(var i = 0; i < chunkIds.length; i++)installedChunks[chunkIds[i]] = 1;
|
|
72
|
+
};
|
|
73
|
+
__webpack_require__.f.require = (chunkId, promises)=>{
|
|
74
|
+
if (!installedChunks[chunkId]) if (146 != chunkId) installChunk(require("./" + __webpack_require__.u(chunkId)));
|
|
75
|
+
else installedChunks[chunkId] = 1;
|
|
76
|
+
};
|
|
77
|
+
module.exports = __webpack_require__;
|
|
78
|
+
__webpack_require__.C = installChunk;
|
|
79
|
+
})();
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function() {
|
|
3
|
+
exports.ids = [
|
|
4
|
+
"802"
|
|
5
|
+
];
|
|
6
|
+
exports.modules = {
|
|
7
|
+
"../sandbox/src/host.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
IgaSandbox: ()=>_iga_sandbox_js__rspack_import_0.RN,
|
|
11
|
+
SandboxApi: ()=>_api_client_js__rspack_import_1.K,
|
|
12
|
+
SupabaseSandboxBindingRepository: ()=>_binding_repository_js__rspack_import_2.t,
|
|
13
|
+
__clearSandboxCacheForTests: ()=>_iga_sandbox_js__rspack_import_0.rG,
|
|
14
|
+
__getEntryForTests: ()=>_iga_sandbox_js__rspack_import_0.pf,
|
|
15
|
+
attachSandbox: ()=>_iga_sandbox_js__rspack_import_0.R9,
|
|
16
|
+
createDetachedSandbox: ()=>_iga_sandbox_js__rspack_import_0.CT,
|
|
17
|
+
createRuntimeSandboxBindingRepository: ()=>_binding_repository_js__rspack_import_2.P,
|
|
18
|
+
createSandbox: ()=>_iga_sandbox_js__rspack_import_0._i,
|
|
19
|
+
createSandboxApi: ()=>_api_client_js__rspack_import_1.SW,
|
|
20
|
+
isInstanceGoneResponse: ()=>_iga_sandbox_js__rspack_import_0.gk
|
|
21
|
+
});
|
|
22
|
+
var _iga_sandbox_js__rspack_import_0 = __webpack_require__("../sandbox/src/iga-sandbox.ts");
|
|
23
|
+
var _api_client_js__rspack_import_1 = __webpack_require__("../sandbox/src/api-client.ts");
|
|
24
|
+
var _binding_repository_js__rspack_import_2 = __webpack_require__("../sandbox/src/binding-repository.ts");
|
|
25
|
+
},
|
|
26
|
+
assert (module) {
|
|
27
|
+
module.exports = require("assert");
|
|
28
|
+
},
|
|
29
|
+
crypto (module) {
|
|
30
|
+
module.exports = require("crypto");
|
|
31
|
+
},
|
|
32
|
+
events (module) {
|
|
33
|
+
module.exports = require("events");
|
|
34
|
+
},
|
|
35
|
+
fs (module) {
|
|
36
|
+
module.exports = require("fs");
|
|
37
|
+
},
|
|
38
|
+
http (module) {
|
|
39
|
+
module.exports = require("http");
|
|
40
|
+
},
|
|
41
|
+
http2 (module) {
|
|
42
|
+
module.exports = require("http2");
|
|
43
|
+
},
|
|
44
|
+
https (module) {
|
|
45
|
+
module.exports = require("https");
|
|
46
|
+
},
|
|
47
|
+
net (module) {
|
|
48
|
+
module.exports = require("net");
|
|
49
|
+
},
|
|
50
|
+
"node:crypto" (module) {
|
|
51
|
+
module.exports = require("node:crypto");
|
|
52
|
+
},
|
|
53
|
+
"node:http" (module) {
|
|
54
|
+
module.exports = require("node:http");
|
|
55
|
+
},
|
|
56
|
+
"node:https" (module) {
|
|
57
|
+
module.exports = require("node:https");
|
|
58
|
+
},
|
|
59
|
+
os (module) {
|
|
60
|
+
module.exports = require("os");
|
|
61
|
+
},
|
|
62
|
+
path (module) {
|
|
63
|
+
module.exports = require("path");
|
|
64
|
+
},
|
|
65
|
+
stream (module) {
|
|
66
|
+
module.exports = require("stream");
|
|
67
|
+
},
|
|
68
|
+
tls (module) {
|
|
69
|
+
module.exports = require("tls");
|
|
70
|
+
},
|
|
71
|
+
tty (module) {
|
|
72
|
+
module.exports = require("tty");
|
|
73
|
+
},
|
|
74
|
+
url (module) {
|
|
75
|
+
module.exports = require("url");
|
|
76
|
+
},
|
|
77
|
+
util (module) {
|
|
78
|
+
module.exports = require("util");
|
|
79
|
+
},
|
|
80
|
+
zlib (module) {
|
|
81
|
+
module.exports = require("zlib");
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var __webpack_require__ = require("../runtime.js");
|
|
85
|
+
__webpack_require__.C(exports);
|
|
86
|
+
var __webpack_exec__ = function(moduleId) {
|
|
87
|
+
return __webpack_require__(__webpack_require__.s = moduleId);
|
|
88
|
+
};
|
|
89
|
+
var __webpack_exports__ = __webpack_require__.X(0, [
|
|
90
|
+
"341",
|
|
91
|
+
"647",
|
|
92
|
+
"808",
|
|
93
|
+
"82",
|
|
94
|
+
"893"
|
|
95
|
+
], function() {
|
|
96
|
+
return __webpack_exec__("../sandbox/src/host.ts");
|
|
97
|
+
});
|
|
98
|
+
exports.IgaSandbox = __webpack_exports__.IgaSandbox;
|
|
99
|
+
exports.SandboxApi = __webpack_exports__.SandboxApi;
|
|
100
|
+
exports.SupabaseSandboxBindingRepository = __webpack_exports__.SupabaseSandboxBindingRepository;
|
|
101
|
+
exports.__clearSandboxCacheForTests = __webpack_exports__.__clearSandboxCacheForTests;
|
|
102
|
+
exports.__getEntryForTests = __webpack_exports__.__getEntryForTests;
|
|
103
|
+
exports.attachSandbox = __webpack_exports__.attachSandbox;
|
|
104
|
+
exports.createDetachedSandbox = __webpack_exports__.createDetachedSandbox;
|
|
105
|
+
exports.createRuntimeSandboxBindingRepository = __webpack_exports__.createRuntimeSandboxBindingRepository;
|
|
106
|
+
exports.createSandbox = __webpack_exports__.createSandbox;
|
|
107
|
+
exports.createSandboxApi = __webpack_exports__.createSandboxApi;
|
|
108
|
+
exports.isInstanceGoneResponse = __webpack_exports__.isInstanceGoneResponse;
|
|
109
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
110
|
+
"IgaSandbox",
|
|
111
|
+
"SandboxApi",
|
|
112
|
+
"SupabaseSandboxBindingRepository",
|
|
113
|
+
"__clearSandboxCacheForTests",
|
|
114
|
+
"__getEntryForTests",
|
|
115
|
+
"attachSandbox",
|
|
116
|
+
"createDetachedSandbox",
|
|
117
|
+
"createRuntimeSandboxBindingRepository",
|
|
118
|
+
"createSandbox",
|
|
119
|
+
"createSandboxApi",
|
|
120
|
+
"isInstanceGoneResponse"
|
|
121
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
122
|
+
Object.defineProperty(exports, '__esModule', {
|
|
123
|
+
value: true
|
|
124
|
+
});
|
|
125
|
+
})();
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function() {
|
|
3
|
+
exports.ids = [
|
|
4
|
+
"14"
|
|
5
|
+
];
|
|
6
|
+
exports.modules = {
|
|
7
|
+
"../sandbox/src/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
connectSandbox: ()=>connectSandbox,
|
|
11
|
+
createSandbox: ()=>createSandbox,
|
|
12
|
+
SandboxError: ()=>src_error.ES,
|
|
13
|
+
getConversationSandbox: ()=>getConversationSandbox,
|
|
14
|
+
isAbortError: ()=>src_error.zf
|
|
15
|
+
});
|
|
16
|
+
var esm = __webpack_require__("../data-plane/dist/esm/index.js");
|
|
17
|
+
var src_error = __webpack_require__("../sandbox/src/error.ts");
|
|
18
|
+
var binding_repository = __webpack_require__("../sandbox/src/binding-repository.ts");
|
|
19
|
+
var iga_sandbox = __webpack_require__("../sandbox/src/iga-sandbox.ts");
|
|
20
|
+
const PUBLIC_SANDBOX_METHODS = {
|
|
21
|
+
code: [
|
|
22
|
+
"executeCode"
|
|
23
|
+
],
|
|
24
|
+
shell: [
|
|
25
|
+
"execCommand",
|
|
26
|
+
"view",
|
|
27
|
+
"waitForProcess",
|
|
28
|
+
"killProcess"
|
|
29
|
+
],
|
|
30
|
+
file: [
|
|
31
|
+
"readFile",
|
|
32
|
+
"writeFile",
|
|
33
|
+
"replaceInFile",
|
|
34
|
+
"searchInFile",
|
|
35
|
+
"findFiles",
|
|
36
|
+
"grepFiles",
|
|
37
|
+
"listPath"
|
|
38
|
+
],
|
|
39
|
+
browserPage: [
|
|
40
|
+
"navigate",
|
|
41
|
+
"back",
|
|
42
|
+
"forward",
|
|
43
|
+
"reload",
|
|
44
|
+
"click",
|
|
45
|
+
"fill",
|
|
46
|
+
"typeText",
|
|
47
|
+
"pressKey",
|
|
48
|
+
"hotKey",
|
|
49
|
+
"hover",
|
|
50
|
+
"selectOption",
|
|
51
|
+
"check",
|
|
52
|
+
"uncheck",
|
|
53
|
+
"uploadFile",
|
|
54
|
+
"scroll",
|
|
55
|
+
"scrollTo",
|
|
56
|
+
"scrollToElement",
|
|
57
|
+
"screenshot",
|
|
58
|
+
"getHtml",
|
|
59
|
+
"getText",
|
|
60
|
+
"wait"
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
const PUBLIC_SANDBOX_MODULES = Object.keys(PUBLIC_SANDBOX_METHODS);
|
|
64
|
+
function createPublicModules(invoke) {
|
|
65
|
+
const modules = Object.create(null);
|
|
66
|
+
for (const name of PUBLIC_SANDBOX_MODULES){
|
|
67
|
+
const methods = Object.create(null);
|
|
68
|
+
for (const method of PUBLIC_SANDBOX_METHODS[name])methods[method] = (...args)=>invoke(name, method, args);
|
|
69
|
+
modules[name] = Object.freeze(methods);
|
|
70
|
+
}
|
|
71
|
+
return Object.freeze(modules);
|
|
72
|
+
}
|
|
73
|
+
const PUBLIC_METHODS = new Set([
|
|
74
|
+
"getInfo",
|
|
75
|
+
"extendTimeout",
|
|
76
|
+
"destroy"
|
|
77
|
+
]);
|
|
78
|
+
let runtimeConfig;
|
|
79
|
+
function getConversationSandbox(conversationId) {
|
|
80
|
+
if ("string" != typeof conversationId || 0 === conversationId.length) throw new src_error.ES("conversationId must be a non-empty string.");
|
|
81
|
+
if (Buffer.byteLength(conversationId, "utf8") > 256) throw new src_error.ES("conversationId must not exceed 256 UTF-8 bytes");
|
|
82
|
+
const config = resolveRuntimeConfig();
|
|
83
|
+
return createDeferredSandbox(config, {
|
|
84
|
+
conversationId
|
|
85
|
+
}, (projectId)=>(0, iga_sandbox._i)({
|
|
86
|
+
projectId,
|
|
87
|
+
conversationId,
|
|
88
|
+
apiBaseUrl: esm.$Y,
|
|
89
|
+
apiToken: config.token,
|
|
90
|
+
bindingRepository: config.bindingRepository
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
async function createSandbox() {
|
|
94
|
+
const config = resolveRuntimeConfig();
|
|
95
|
+
const instance = (0, iga_sandbox.CT)({
|
|
96
|
+
projectId: await resolveProjectId(config),
|
|
97
|
+
apiBaseUrl: esm.$Y,
|
|
98
|
+
apiToken: config.token
|
|
99
|
+
});
|
|
100
|
+
await instance.ensureReady();
|
|
101
|
+
return createPublicSandbox(instance);
|
|
102
|
+
}
|
|
103
|
+
function connectSandbox(sandboxId) {
|
|
104
|
+
if (!sandboxId || "string" != typeof sandboxId) throw new src_error.ES("sandboxId is required.");
|
|
105
|
+
const config = resolveRuntimeConfig();
|
|
106
|
+
return createDeferredSandbox(config, {
|
|
107
|
+
sandboxId
|
|
108
|
+
}, (projectId)=>(0, iga_sandbox.R9)({
|
|
109
|
+
projectId,
|
|
110
|
+
sandboxId,
|
|
111
|
+
apiBaseUrl: esm.$Y,
|
|
112
|
+
apiToken: config.token
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
function requireRuntimeEnv(name) {
|
|
116
|
+
const value = "u" < typeof process ? void 0 : process.env[name]?.trim();
|
|
117
|
+
if (!value) throw new src_error.ES("Sandbox is only available in the IGA Pages server runtime.");
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
function resolveRuntimeConfig() {
|
|
121
|
+
if (runtimeConfig) return runtimeConfig;
|
|
122
|
+
const token = requireRuntimeEnv("IGA_AUTH_KEY");
|
|
123
|
+
const provider = new esm.ZQ({
|
|
124
|
+
fetchCredentials: ()=>(0, esm.FM)({
|
|
125
|
+
token
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
runtimeConfig = {
|
|
129
|
+
provider,
|
|
130
|
+
token,
|
|
131
|
+
bindingRepository: new binding_repository.t({
|
|
132
|
+
credentialProvider: provider
|
|
133
|
+
})
|
|
134
|
+
};
|
|
135
|
+
return runtimeConfig;
|
|
136
|
+
}
|
|
137
|
+
async function resolveProjectId(config, signal) {
|
|
138
|
+
try {
|
|
139
|
+
return await config.provider.getProjectId(signal);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (!(error instanceof esm.d)) throw error;
|
|
142
|
+
const ErrorClass = "aborted" === error.code ? src_error.sX : src_error.ES;
|
|
143
|
+
throw new ErrorClass(error.message, {
|
|
144
|
+
status: error.status
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function requestSignal(args) {
|
|
149
|
+
const last = args[args.length - 1];
|
|
150
|
+
if (!last || "object" != typeof last || !("abortSignal" in last)) return;
|
|
151
|
+
const signal = last.abortSignal;
|
|
152
|
+
return signal && "boolean" == typeof signal.aborted && "function" == typeof signal.addEventListener && "function" == typeof signal.removeEventListener ? signal : void 0;
|
|
153
|
+
}
|
|
154
|
+
function createDeferredSandbox(config, ids, create) {
|
|
155
|
+
let instance;
|
|
156
|
+
const resolve = async (args)=>{
|
|
157
|
+
const signal = requestSignal(args);
|
|
158
|
+
if (instance) return instance;
|
|
159
|
+
const projectId = await resolveProjectId(config, signal);
|
|
160
|
+
if (signal?.aborted) throw new src_error.sX("Sandbox request was cancelled.");
|
|
161
|
+
return instance ??= create(projectId);
|
|
162
|
+
};
|
|
163
|
+
const target = Object.create(null);
|
|
164
|
+
for (const property of [
|
|
165
|
+
"conversationId",
|
|
166
|
+
"sandboxId"
|
|
167
|
+
])Object.defineProperty(target, property, {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
get: ()=>instance?.[property] ?? ids[property]
|
|
170
|
+
});
|
|
171
|
+
for (const method of PUBLIC_METHODS)target[method] = async (...args)=>{
|
|
172
|
+
const current = await resolve(args);
|
|
173
|
+
return Reflect.apply(Reflect.get(current, method), current, args);
|
|
174
|
+
};
|
|
175
|
+
Object.assign(target, createPublicModules(async (name, method, args)=>{
|
|
176
|
+
const current = await resolve(args);
|
|
177
|
+
const module = current[name];
|
|
178
|
+
return Reflect.apply(Reflect.get(module, method), module, args);
|
|
179
|
+
}));
|
|
180
|
+
return Object.freeze(target);
|
|
181
|
+
}
|
|
182
|
+
function createPublicSandbox(instance) {
|
|
183
|
+
const target = Object.create(null);
|
|
184
|
+
for (const property of [
|
|
185
|
+
"conversationId",
|
|
186
|
+
"sandboxId"
|
|
187
|
+
])Object.defineProperty(target, property, {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: ()=>instance[property]
|
|
190
|
+
});
|
|
191
|
+
for (const method of PUBLIC_METHODS)target[method] = (...args)=>Reflect.apply(Reflect.get(instance, method), instance, args);
|
|
192
|
+
Object.assign(target, createPublicModules((name, method, args)=>{
|
|
193
|
+
const module = instance[name];
|
|
194
|
+
return Reflect.apply(Reflect.get(module, method), module, args);
|
|
195
|
+
}));
|
|
196
|
+
return Object.freeze(target);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
assert (module) {
|
|
200
|
+
module.exports = require("assert");
|
|
201
|
+
},
|
|
202
|
+
crypto (module) {
|
|
203
|
+
module.exports = require("crypto");
|
|
204
|
+
},
|
|
205
|
+
events (module) {
|
|
206
|
+
module.exports = require("events");
|
|
207
|
+
},
|
|
208
|
+
fs (module) {
|
|
209
|
+
module.exports = require("fs");
|
|
210
|
+
},
|
|
211
|
+
http (module) {
|
|
212
|
+
module.exports = require("http");
|
|
213
|
+
},
|
|
214
|
+
http2 (module) {
|
|
215
|
+
module.exports = require("http2");
|
|
216
|
+
},
|
|
217
|
+
https (module) {
|
|
218
|
+
module.exports = require("https");
|
|
219
|
+
},
|
|
220
|
+
net (module) {
|
|
221
|
+
module.exports = require("net");
|
|
222
|
+
},
|
|
223
|
+
"node:crypto" (module) {
|
|
224
|
+
module.exports = require("node:crypto");
|
|
225
|
+
},
|
|
226
|
+
"node:http" (module) {
|
|
227
|
+
module.exports = require("node:http");
|
|
228
|
+
},
|
|
229
|
+
"node:https" (module) {
|
|
230
|
+
module.exports = require("node:https");
|
|
231
|
+
},
|
|
232
|
+
os (module) {
|
|
233
|
+
module.exports = require("os");
|
|
234
|
+
},
|
|
235
|
+
path (module) {
|
|
236
|
+
module.exports = require("path");
|
|
237
|
+
},
|
|
238
|
+
stream (module) {
|
|
239
|
+
module.exports = require("stream");
|
|
240
|
+
},
|
|
241
|
+
tls (module) {
|
|
242
|
+
module.exports = require("tls");
|
|
243
|
+
},
|
|
244
|
+
tty (module) {
|
|
245
|
+
module.exports = require("tty");
|
|
246
|
+
},
|
|
247
|
+
url (module) {
|
|
248
|
+
module.exports = require("url");
|
|
249
|
+
},
|
|
250
|
+
util (module) {
|
|
251
|
+
module.exports = require("util");
|
|
252
|
+
},
|
|
253
|
+
zlib (module) {
|
|
254
|
+
module.exports = require("zlib");
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var __webpack_require__ = require("../runtime.js");
|
|
258
|
+
__webpack_require__.C(exports);
|
|
259
|
+
var __webpack_exec__ = function(moduleId) {
|
|
260
|
+
return __webpack_require__(__webpack_require__.s = moduleId);
|
|
261
|
+
};
|
|
262
|
+
var __webpack_exports__ = __webpack_require__.X(0, [
|
|
263
|
+
"341",
|
|
264
|
+
"647",
|
|
265
|
+
"808",
|
|
266
|
+
"82",
|
|
267
|
+
"893"
|
|
268
|
+
], function() {
|
|
269
|
+
return __webpack_exec__("../sandbox/src/index.ts");
|
|
270
|
+
});
|
|
271
|
+
exports.SandboxError = __webpack_exports__.SandboxError;
|
|
272
|
+
exports.connectSandbox = __webpack_exports__.connectSandbox;
|
|
273
|
+
exports.createSandbox = __webpack_exports__.createSandbox;
|
|
274
|
+
exports.getConversationSandbox = __webpack_exports__.getConversationSandbox;
|
|
275
|
+
exports.isAbortError = __webpack_exports__.isAbortError;
|
|
276
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
277
|
+
"SandboxError",
|
|
278
|
+
"connectSandbox",
|
|
279
|
+
"createSandbox",
|
|
280
|
+
"getConversationSandbox",
|
|
281
|
+
"isAbortError"
|
|
282
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
283
|
+
Object.defineProperty(exports, '__esModule', {
|
|
284
|
+
value: true
|
|
285
|
+
});
|
|
286
|
+
})();
|