@evilstar9527/tool-bridge 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/README.md +288 -0
- package/dist/sdk/admin.js +157 -0
- package/dist/sdk/chunks/client-BWz3o-l-.js +36 -0
- package/dist/sdk/chunks/errors-DJj3RaDk.js +54 -0
- package/dist/sdk/host.js +98 -0
- package/dist/sdk/index.js +6 -0
- package/dist/sdk/tb.js +0 -0
- package/dist/sdk/transport.js +14 -0
- package/dist/sdk/tunnel-agent.js +43 -0
- package/dist/sdk/worker.js +2940 -0
- package/dist/types/sdk/admin/index.d.ts +237 -0
- package/dist/types/sdk/client.d.ts +17 -0
- package/dist/types/sdk/host/index.d.ts +65 -0
- package/dist/types/sdk/index.d.ts +5 -0
- package/dist/types/sdk/transport.d.ts +8 -0
- package/dist/types/sdk/tunnel-agent/index.d.ts +29 -0
- package/dist/types/worker/index.d.ts +19 -0
- package/dist/types/worker/tb/adapters/builtin.d.ts +4 -0
- package/dist/types/worker/tb/adapters/directory.d.ts +6 -0
- package/dist/types/worker/tb/adapters/http.d.ts +2 -0
- package/dist/types/worker/tb/adapters/index.d.ts +2 -0
- package/dist/types/worker/tb/adapters/mcp.d.ts +2 -0
- package/dist/types/worker/tb/adapters/mount.d.ts +2 -0
- package/dist/types/worker/tb/adapters/remote.d.ts +2 -0
- package/dist/types/worker/tb/audit.d.ts +56 -0
- package/dist/types/worker/tb/crawl.d.ts +11 -0
- package/dist/types/worker/tb/device.d.ts +80 -0
- package/dist/types/worker/tb/dynamic-servers.d.ts +12 -0
- package/dist/types/worker/tb/entities.d.ts +74 -0
- package/dist/types/worker/tb/errors.d.ts +34 -0
- package/dist/types/worker/tb/help.d.ts +2 -0
- package/dist/types/worker/tb/host-api.d.ts +12 -0
- package/dist/types/worker/tb/materialize.d.ts +4 -0
- package/dist/types/worker/tb/mcp-client.d.ts +17 -0
- package/dist/types/worker/tb/provider-api.d.ts +11 -0
- package/dist/types/worker/tb/registry.d.ts +11 -0
- package/dist/types/worker/tb/remote-client.d.ts +3 -0
- package/dist/types/worker/tb/resolve.d.ts +8 -0
- package/dist/types/worker/tb/storage-r2.d.ts +2 -0
- package/dist/types/worker/tb/tenant.d.ts +28 -0
- package/dist/types/worker/tb/testing/fake-kv.d.ts +20 -0
- package/dist/types/worker/tb/types.d.ts +155 -0
- package/dist/types/worker/tb/util.d.ts +18 -0
- package/dist/types/worker/tb/virtualize.d.ts +7 -0
- package/docs/sdk.md +149 -0
- package/package.json +79 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { i as e } from "./chunks/client-BWz3o-l-.js";
|
|
2
|
+
//#region src/sdk/tunnel-agent/index.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
let r;
|
|
5
|
+
return {
|
|
6
|
+
async connect() {
|
|
7
|
+
let n = await e(t.transport, t.credential, "/tunnel/connect", {
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: { endpointId: t.endpointId }
|
|
10
|
+
});
|
|
11
|
+
return r = n.sessionId, n;
|
|
12
|
+
},
|
|
13
|
+
async heartbeat() {
|
|
14
|
+
return e(t.transport, t.credential, "/tunnel/heartbeat", {
|
|
15
|
+
method: "POST",
|
|
16
|
+
body: n(t.endpointId, r)
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
async reportCapabilities(i) {
|
|
20
|
+
return e(t.transport, t.credential, "/tunnel/capabilities", {
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: {
|
|
23
|
+
...n(t.endpointId, r),
|
|
24
|
+
capabilities: i
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
async dispatch(e) {
|
|
29
|
+
if (e.endpointId !== t.endpointId) throw Error(`Dispatch target '${e.endpointId}' does not match endpoint '${t.endpointId}'.`);
|
|
30
|
+
return t.dispatch(e);
|
|
31
|
+
},
|
|
32
|
+
async cancel(e) {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function n(e, t) {
|
|
36
|
+
if (!t) throw Error("Tunnel agent is not connected.");
|
|
37
|
+
return {
|
|
38
|
+
endpointId: e,
|
|
39
|
+
sessionId: t
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { t as createTunnelAgent };
|