@lamplitisles/dsh-nanocodex 0.1.0-beta.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/LICENSE +65 -0
- package/NOTICE +2 -0
- package/README.md +182 -0
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/cordis.patch.yml +52 -0
- package/dist/index.d.ts +435 -0
- package/dist/index.js +3405 -0
- package/dist/standard-preset.d.ts +7 -0
- package/dist/standard-preset.js +25 -0
- package/engine-release.json +14 -0
- package/package.json +119 -0
- package/presets/standard/agent.cordis.yml +6 -0
- package/presets/standard/preset.yml +2 -0
- package/vendor/nanocodex/README.md +1344 -0
- package/vendor/nanocodex/actions/events.d.mts +10 -0
- package/vendor/nanocodex/actions/events.mjs +163 -0
- package/vendor/nanocodex/actions/index.d.mts +13 -0
- package/vendor/nanocodex/actions/index.mjs +35 -0
- package/vendor/nanocodex/actions/session.d.mts +66 -0
- package/vendor/nanocodex/actions/session.mjs +59 -0
- package/vendor/nanocodex/actions/turn.d.mts +59 -0
- package/vendor/nanocodex/actions/turn.mjs +37 -0
- package/vendor/nanocodex/actions/voice.d.mts +22 -0
- package/vendor/nanocodex/actions/voice.mjs +50 -0
- package/vendor/nanocodex/browser/Agent.d.mts +55 -0
- package/vendor/nanocodex/browser/Agent.mjs +11 -0
- package/vendor/nanocodex/browser/ChatGptSubscription.d.mts +7 -0
- package/vendor/nanocodex/browser/ChatGptSubscription.mjs +19 -0
- package/vendor/nanocodex/browser/InlineAgent.mjs +266 -0
- package/vendor/nanocodex/browser/Transport.d.mts +74 -0
- package/vendor/nanocodex/browser/Transport.mjs +61 -0
- package/vendor/nanocodex/browser/Voice.d.mts +71 -0
- package/vendor/nanocodex/browser/Voice.mjs +291 -0
- package/vendor/nanocodex/browser/VoiceSession.mjs +688 -0
- package/vendor/nanocodex/browser/WorkerAgent.d.mts +65 -0
- package/vendor/nanocodex/browser/WorkerAgent.mjs +1472 -0
- package/vendor/nanocodex/browser/agent.worker.mjs +3 -0
- package/vendor/nanocodex/browser/config.d.mts +36 -0
- package/vendor/nanocodex/browser/config.mjs +439 -0
- package/vendor/nanocodex/browser/engine.mjs +13 -0
- package/vendor/nanocodex/browser/harness.mjs +55 -0
- package/vendor/nanocodex/browser/host.d.mts +83 -0
- package/vendor/nanocodex/browser/host.mjs +555 -0
- package/vendor/nanocodex/browser/hostManagedWebSocket.d.mts +14 -0
- package/vendor/nanocodex/browser/hostManagedWebSocket.mjs +110 -0
- package/vendor/nanocodex/browser/index.d.mts +92 -0
- package/vendor/nanocodex/browser/index.mjs +23 -0
- package/vendor/nanocodex/browser/indexeddb-durability-store.mjs +197 -0
- package/vendor/nanocodex/browser/workspace.d.mts +16 -0
- package/vendor/nanocodex/browser/workspace.mjs +107 -0
- package/vendor/nanocodex/cloud/Client.d.mts +83 -0
- package/vendor/nanocodex/cloud/Client.mjs +231 -0
- package/vendor/nanocodex/cloud/Decorator.d.mts +31 -0
- package/vendor/nanocodex/cloud/Decorator.mjs +37 -0
- package/vendor/nanocodex/cloud/Dialog.d.mts +113 -0
- package/vendor/nanocodex/cloud/Dialog.mjs +366 -0
- package/vendor/nanocodex/cloud/Errors.d.mts +22 -0
- package/vendor/nanocodex/cloud/Errors.mjs +39 -0
- package/vendor/nanocodex/cloud/Principal.d.mts +26 -0
- package/vendor/nanocodex/cloud/Principal.mjs +88 -0
- package/vendor/nanocodex/cloud/RemoteProvider.mjs +88 -0
- package/vendor/nanocodex/cloud/Transport.d.mts +47 -0
- package/vendor/nanocodex/cloud/Transport.mjs +454 -0
- package/vendor/nanocodex/cloud/actions/account.d.mts +9 -0
- package/vendor/nanocodex/cloud/actions/account.mjs +19 -0
- package/vendor/nanocodex/cloud/actions/agent.d.mts +18 -0
- package/vendor/nanocodex/cloud/actions/agent.mjs +428 -0
- package/vendor/nanocodex/cloud/actions/connection.d.mts +133 -0
- package/vendor/nanocodex/cloud/actions/connection.mjs +580 -0
- package/vendor/nanocodex/cloud/actions/grant.d.mts +10 -0
- package/vendor/nanocodex/cloud/actions/grant.mjs +12 -0
- package/vendor/nanocodex/cloud/actions/index.d.mts +7 -0
- package/vendor/nanocodex/cloud/actions/index.mjs +7 -0
- package/vendor/nanocodex/cloud/actions/machineUsd.d.mts +23 -0
- package/vendor/nanocodex/cloud/actions/machineUsd.mjs +37 -0
- package/vendor/nanocodex/cloud/actions/model.d.mts +12 -0
- package/vendor/nanocodex/cloud/actions/model.mjs +50 -0
- package/vendor/nanocodex/cloud/actions/mpp.d.mts +28 -0
- package/vendor/nanocodex/cloud/actions/mpp.mjs +39 -0
- package/vendor/nanocodex/cloud/index.d.mts +30 -0
- package/vendor/nanocodex/cloud/index.mjs +9 -0
- package/vendor/nanocodex/cloud/internal.mjs +533 -0
- package/vendor/nanocodex/cloud/mercator.mjs +108 -0
- package/vendor/nanocodex/cloud/server/HostPrincipal.d.mts +34 -0
- package/vendor/nanocodex/cloud/server/HostPrincipal.mjs +202 -0
- package/vendor/nanocodex/cloud/server/index.d.mts +1 -0
- package/vendor/nanocodex/cloud/server/index.mjs +1 -0
- package/vendor/nanocodex/cloud/types.d.mts +211 -0
- package/vendor/nanocodex/cloudflare/Agent.d.mts +133 -0
- package/vendor/nanocodex/cloudflare/Agent.mjs +811 -0
- package/vendor/nanocodex/cloudflare/egress-subject.mjs +19 -0
- package/vendor/nanocodex/cloudflare/egress.d.mts +41 -0
- package/vendor/nanocodex/cloudflare/egress.mjs +119 -0
- package/vendor/nanocodex/cloudflare/event-socket.mjs +316 -0
- package/vendor/nanocodex/cloudflare/index.d.mts +7 -0
- package/vendor/nanocodex/cloudflare/index.mjs +6 -0
- package/vendor/nanocodex/host/Agent.d.mts +55 -0
- package/vendor/nanocodex/host/Agent.mjs +1 -0
- package/vendor/nanocodex/host/index.d.mts +82 -0
- package/vendor/nanocodex/host/index.mjs +10 -0
- package/vendor/nanocodex/index.d.mts +81 -0
- package/vendor/nanocodex/index.mjs +12 -0
- package/vendor/nanocodex/internal.mjs +1275 -0
- package/vendor/nanocodex/managed/Agent.d.mts +380 -0
- package/vendor/nanocodex/managed/Agent.mjs +1694 -0
- package/vendor/nanocodex/managed/ManagedError.d.mts +9 -0
- package/vendor/nanocodex/managed/ManagedError.mjs +8 -0
- package/vendor/nanocodex/managed/README.md +241 -0
- package/vendor/nanocodex/managed/Voice.mjs +202 -0
- package/vendor/nanocodex/managed/index.d.mts +20 -0
- package/vendor/nanocodex/managed/index.mjs +2 -0
- package/vendor/nanocodex/managed/internal.mjs +119 -0
- package/vendor/nanocodex/node/Agent.d.mts +50 -0
- package/vendor/nanocodex/node/Agent.mjs +203 -0
- package/vendor/nanocodex/node/ChatGptSubscription.d.mts +9 -0
- package/vendor/nanocodex/node/ChatGptSubscription.mjs +17 -0
- package/vendor/nanocodex/node/Transport.d.mts +44 -0
- package/vendor/nanocodex/node/Transport.mjs +46 -0
- package/vendor/nanocodex/node/host.mjs +731 -0
- package/vendor/nanocodex/node/index.d.mts +73 -0
- package/vendor/nanocodex/node/index.mjs +17 -0
- package/vendor/nanocodex/node/workspace.d.mts +10 -0
- package/vendor/nanocodex/node/workspace.mjs +198 -0
- package/vendor/nanocodex/package.json +200 -0
- package/vendor/nanocodex/pkg-node/nanocodex.d.ts +675 -0
- package/vendor/nanocodex/pkg-node/nanocodex.js +2628 -0
- package/vendor/nanocodex/pkg-node/nanocodex_bg.wasm.d.ts +105 -0
- package/vendor/nanocodex/pkg-node/package.json +1 -0
- package/vendor/nanocodex/pkg-web/.nanocodex-bindgen-stamp +6 -0
- package/vendor/nanocodex/pkg-web/nanocodex-build.json +1 -0
- package/vendor/nanocodex/pkg-web/nanocodex.d.ts +805 -0
- package/vendor/nanocodex/pkg-web/nanocodex.js +2714 -0
- package/vendor/nanocodex/pkg-web/nanocodex_bg.js +2615 -0
- package/vendor/nanocodex/pkg-web/nanocodex_bg.wasm +0 -0
- package/vendor/nanocodex/pkg-web/nanocodex_bg.wasm.d.ts +105 -0
- package/vendor/nanocodex/pkg-web/nanocodex_worker.js +9 -0
- package/vendor/nanocodex/pkg-web/package.json +1 -0
- package/vendor/nanocodex/runtime/chatgpt-subscription.mjs +212 -0
- package/vendor/nanocodex/runtime/cloudflare-durability-store.d.mts +26 -0
- package/vendor/nanocodex/runtime/cloudflare-durability-store.mjs +168 -0
- package/vendor/nanocodex/runtime/code-evaluator.worker.mjs +137 -0
- package/vendor/nanocodex/runtime/code-runtime.mjs +1 -0
- package/vendor/nanocodex/runtime/durability-store.d.mts +85 -0
- package/vendor/nanocodex/runtime/durability-store.mjs +631 -0
- package/vendor/nanocodex/runtime/durability.mjs +153 -0
- package/vendor/nanocodex/runtime/managed-transport.mjs +460 -0
- package/vendor/nanocodex/runtime/mcp-runtime.mjs +534 -0
- package/vendor/nanocodex/runtime/postgres-durability-store.d.mts +64 -0
- package/vendor/nanocodex/runtime/postgres-durability-store.mjs +532 -0
- package/vendor/nanocodex/runtime/quickjs-evaluator.d.mts +17 -0
- package/vendor/nanocodex/runtime/quickjs-evaluator.mjs +236 -0
- package/vendor/nanocodex/runtime/responses-transport.mjs +22 -0
- package/vendor/nanocodex/runtime/subagents.d.mts +107 -0
- package/vendor/nanocodex/runtime/subagents.mjs +54 -0
- package/vendor/nanocodex/runtime/subscription-store.d.mts +8 -0
- package/vendor/nanocodex/runtime/subscription-store.mjs +42 -0
- package/vendor/nanocodex/runtime/tempo-provider.d.mts +125 -0
- package/vendor/nanocodex/runtime/tempo-provider.mjs +264 -0
- package/vendor/nanocodex/runtime/tool-configuration.mjs +1 -0
- package/vendor/nanocodex/runtime/tool-router.mjs +1 -0
- package/vendor/nanocodex/runtime/utf8.mjs +1 -0
- package/vendor/nanocodex/runtime/worker-evaluator.mjs +162 -0
- package/vendor/nanocodex/runtime/workspace.d.mts +1 -0
- package/vendor/nanocodex/runtime/workspace.mjs +1 -0
- package/vendor/nanocodex/tools/Tools.d.mts +56 -0
- package/vendor/nanocodex/tools/Tools.mjs +136 -0
- package/vendor/nanocodex/tools/artifact.d.mts +1 -0
- package/vendor/nanocodex/tools/artifact.mjs +1 -0
- package/vendor/nanocodex/tools/attachment.mjs +1 -0
- package/vendor/nanocodex/tools/bash.d.mts +1 -0
- package/vendor/nanocodex/tools/bash.mjs +1 -0
- package/vendor/nanocodex/tools/browser/accountInfo.mjs +795 -0
- package/vendor/nanocodex/tools/browser/browserBuffer.mjs +18 -0
- package/vendor/nanocodex/tools/browser/browserCompiler.mjs +155 -0
- package/vendor/nanocodex/tools/browser/browserEgress.mjs +161 -0
- package/vendor/nanocodex/tools/browser/browserPython.mjs +133 -0
- package/vendor/nanocodex/tools/browser/browserShell.mjs +1075 -0
- package/vendor/nanocodex/tools/browser/browserSprintf.mjs +4 -0
- package/vendor/nanocodex/tools/browser/browserSsh.mjs +201 -0
- package/vendor/nanocodex/tools/browser/browserZlib.mjs +136 -0
- package/vendor/nanocodex/tools/browser/compiler.worker.mjs +160 -0
- package/vendor/nanocodex/tools/browser/devTunnelsSshBrowser.mjs +13 -0
- package/vendor/nanocodex/tools/browser/index.d.mts +209 -0
- package/vendor/nanocodex/tools/browser/index.mjs +174 -0
- package/vendor/nanocodex/tools/browser/opfsGit.mjs +248 -0
- package/vendor/nanocodex/tools/browser/python.worker.mjs +114 -0
- package/vendor/nanocodex/tools/browser/threadGit.mjs +197 -0
- package/vendor/nanocodex/tools/browser/unsupportedNodeRsa.mjs +5 -0
- package/vendor/nanocodex/tools/browser/workspace.mjs +83 -0
- package/vendor/nanocodex/tools/dataset.d.mts +1 -0
- package/vendor/nanocodex/tools/dataset.mjs +1 -0
- package/vendor/nanocodex/tools/datasetContract.mjs +1 -0
- package/vendor/nanocodex/tools/datasetEngine.mjs +1 -0
- package/vendor/nanocodex/tools/hostedCatalog.d.mts +1 -0
- package/vendor/nanocodex/tools/hostedCatalog.mjs +1 -0
- package/vendor/nanocodex/tools/index.d.mts +49 -0
- package/vendor/nanocodex/tools/index.mjs +19 -0
- package/vendor/nanocodex/tools/namedTool.mjs +1 -0
- package/vendor/nanocodex/tools/repository-workspace.d.mts +1 -0
- package/vendor/nanocodex/tools/repository-workspace.mjs +1 -0
- package/vendor/nanocodex/tools/ssh.d.mts +1 -0
- package/vendor/nanocodex/tools/ssh.mjs +1 -0
- package/vendor/nanocodex/tools/standard.mjs +1 -0
- package/vendor/nanocodex/tools/standardDescriptions.mjs +1 -0
- package/vendor/nanocodex/types.d.mts +663 -0
- package/vendor/nanocodex/wasm.d.mts +4 -0
- package/vendor/nanocodex/worker/ChatGptSubscription.d.mts +9 -0
- package/vendor/nanocodex/worker/ChatGptSubscription.mjs +29 -0
- package/vendor/nanocodex/worker/index.d.mts +18 -0
- package/vendor/nanocodex/worker/index.mjs +5 -0
- package/vendor/nanocodex-tools/README.md +65 -0
- package/vendor/nanocodex-tools/dist/hosted/app-tool-catalog.d.ts +7 -0
- package/vendor/nanocodex-tools/dist/hosted/app-tool-catalog.js +14 -0
- package/vendor/nanocodex-tools/dist/hosted/broker-core.d.ts +172 -0
- package/vendor/nanocodex-tools/dist/hosted/broker-core.js +1278 -0
- package/vendor/nanocodex-tools/dist/hosted/index.d.ts +3 -0
- package/vendor/nanocodex-tools/dist/hosted/index.js +3 -0
- package/vendor/nanocodex-tools/dist/hosted/protocol.d.ts +120 -0
- package/vendor/nanocodex-tools/dist/hosted/protocol.js +415 -0
- package/vendor/nanocodex-tools/dist/index.d.ts +19 -0
- package/vendor/nanocodex-tools/dist/index.js +14 -0
- package/vendor/nanocodex-tools/dist/memory.d.ts +204 -0
- package/vendor/nanocodex-tools/dist/memory.js +411 -0
- package/vendor/nanocodex-tools/dist/namespace.d.ts +87 -0
- package/vendor/nanocodex-tools/dist/namespace.js +338 -0
- package/vendor/nanocodex-tools/dist/repository-archive.d.ts +4 -0
- package/vendor/nanocodex-tools/dist/repository-archive.js +104 -0
- package/vendor/nanocodex-tools/dist/runtime.d.ts +30 -0
- package/vendor/nanocodex-tools/dist/runtime.js +37 -0
- package/vendor/nanocodex-tools/dist/session.d.ts +167 -0
- package/vendor/nanocodex-tools/dist/session.js +286 -0
- package/vendor/nanocodex-tools/dist/shell.d.ts +51 -0
- package/vendor/nanocodex-tools/dist/shell.js +553 -0
- package/vendor/nanocodex-tools/dist/ssh.d.ts +29 -0
- package/vendor/nanocodex-tools/dist/ssh.js +66 -0
- package/vendor/nanocodex-tools/dist/workspace.d.ts +45 -0
- package/vendor/nanocodex-tools/dist/workspace.js +237 -0
- package/vendor/nanocodex-tools/package.json +122 -0
- package/vendor/nanocodex-tools/runtime/code-runtime.mjs +817 -0
- package/vendor/nanocodex-tools/runtime/tool-configuration.mjs +50 -0
- package/vendor/nanocodex-tools/runtime/tool-router.mjs +730 -0
- package/vendor/nanocodex-tools/runtime/utf8.d.mts +2 -0
- package/vendor/nanocodex-tools/runtime/utf8.mjs +25 -0
- package/vendor/nanocodex-tools/tools/artifact.d.mts +69 -0
- package/vendor/nanocodex-tools/tools/artifact.mjs +270 -0
- package/vendor/nanocodex-tools/tools/attachment.mjs +603 -0
- package/vendor/nanocodex-tools/tools/bash.d.mts +90 -0
- package/vendor/nanocodex-tools/tools/bash.mjs +742 -0
- package/vendor/nanocodex-tools/tools/dataset.d.mts +9 -0
- package/vendor/nanocodex-tools/tools/dataset.mjs +47 -0
- package/vendor/nanocodex-tools/tools/datasetContract.mjs +54 -0
- package/vendor/nanocodex-tools/tools/datasetEngine.mjs +1167 -0
- package/vendor/nanocodex-tools/tools/execution-contract.d.mts +5 -0
- package/vendor/nanocodex-tools/tools/execution-contract.mjs +63 -0
- package/vendor/nanocodex-tools/tools/hostedCatalog.d.mts +20 -0
- package/vendor/nanocodex-tools/tools/hostedCatalog.mjs +67 -0
- package/vendor/nanocodex-tools/tools/hostedMachine.d.mts +10 -0
- package/vendor/nanocodex-tools/tools/hostedMachine.mjs +56 -0
- package/vendor/nanocodex-tools/tools/just-bash-browser.d.mts +1 -0
- package/vendor/nanocodex-tools/tools/just-bash-browser.mjs +1 -0
- package/vendor/nanocodex-tools/tools/namedTool.d.mts +3 -0
- package/vendor/nanocodex-tools/tools/namedTool.mjs +3 -0
- package/vendor/nanocodex-tools/tools/nodeProcess.d.mts +10 -0
- package/vendor/nanocodex-tools/tools/nodeProcess.mjs +314 -0
- package/vendor/nanocodex-tools/tools/processOutput.mjs +56 -0
- package/vendor/nanocodex-tools/tools/repository-workspace.d.mts +55 -0
- package/vendor/nanocodex-tools/tools/repository-workspace.mjs +397 -0
- package/vendor/nanocodex-tools/tools/ssh.d.mts +56 -0
- package/vendor/nanocodex-tools/tools/ssh.mjs +503 -0
- package/vendor/nanocodex-tools/tools/standard.mjs +458 -0
- package/vendor/nanocodex-tools/tools/standardDescriptions.mjs +3 -0
- package/vendor/nanocodex-tools/tools/types.d.mts +83 -0
- package/vendor/nanocodex-tools/tools/workspace.d.mts +25 -0
- package/vendor/nanocodex-tools/tools/workspace.mjs +282 -0
- package/vendor/nanocodex-tools/tools/x.d.mts +30 -0
- package/vendor/nanocodex-tools/tools/x.mjs +91 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { HttpError, InvalidResponseError } from "./Errors.mjs";
|
|
2
|
+
import { Hex, PersonalMessage } from "ox";
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_API_URL = "https://api.nanocodex.xyz";
|
|
5
|
+
export const MOCK_ACCOUNT_ADDRESS = "0x8ba1f109551bd432803012645ac136ddd64dba72";
|
|
6
|
+
export const MOCK_MACHINE_USD_ADDRESS = "0x20c0000000000000000000000000000000000001";
|
|
7
|
+
|
|
8
|
+
export function from(parameters) {
|
|
9
|
+
if (!parameters || typeof parameters !== "object") {
|
|
10
|
+
throw new TypeError("Transport.from requires parameters");
|
|
11
|
+
}
|
|
12
|
+
if (typeof parameters.setup !== "function") {
|
|
13
|
+
throw new TypeError("Transport.from requires setup");
|
|
14
|
+
}
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
key: requiredString(parameters.key, "transport key"),
|
|
17
|
+
name: requiredString(parameters.name, "transport name"),
|
|
18
|
+
type: requiredString(parameters.type, "transport type"),
|
|
19
|
+
setup: parameters.setup,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function http(url = DEFAULT_API_URL, options = {}) {
|
|
24
|
+
const baseUrl = new URL(url).toString();
|
|
25
|
+
const fetchFn = options.fetch ?? globalThis.fetch;
|
|
26
|
+
const credentials = options.credentials ?? "include";
|
|
27
|
+
if (typeof fetchFn !== "function") throw new TypeError("http transport requires fetch");
|
|
28
|
+
return from({
|
|
29
|
+
key: options.key ?? "http",
|
|
30
|
+
name: options.name ?? "Nanocodex HTTP",
|
|
31
|
+
type: "http",
|
|
32
|
+
setup({ appId }) {
|
|
33
|
+
return {
|
|
34
|
+
baseUrl,
|
|
35
|
+
fetch(input, init) {
|
|
36
|
+
const headers = new Headers(
|
|
37
|
+
init?.headers ?? (input instanceof Request ? input.headers : undefined),
|
|
38
|
+
);
|
|
39
|
+
headers.set("x-nanocodex-app-id", appId);
|
|
40
|
+
return fetchFn(input, {
|
|
41
|
+
...init,
|
|
42
|
+
headers,
|
|
43
|
+
credentials: init?.credentials ?? credentials,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
async request(request) {
|
|
47
|
+
const headers = new Headers(request.headers);
|
|
48
|
+
headers.set("accept", "application/json");
|
|
49
|
+
headers.set("x-nanocodex-app-id", appId);
|
|
50
|
+
if (request.body !== undefined) headers.set("content-type", "application/json");
|
|
51
|
+
const response = await fetchFn(new URL(request.path, baseUrl), {
|
|
52
|
+
method: request.method ?? "GET",
|
|
53
|
+
headers,
|
|
54
|
+
credentials,
|
|
55
|
+
body: request.body === undefined ? undefined : JSON.stringify(request.body),
|
|
56
|
+
signal: request.signal,
|
|
57
|
+
});
|
|
58
|
+
const body = response.status === 204 ? undefined : await response.json().catch(() => undefined);
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new HttpError(
|
|
61
|
+
response.status,
|
|
62
|
+
body?.error?.message ?? `Nanocodex request failed with ${response.status}`,
|
|
63
|
+
{ code: body?.error?.code },
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return body;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function mock(options = {}) {
|
|
74
|
+
const accountAddress = options.accountAddress ?? MOCK_ACCOUNT_ADDRESS;
|
|
75
|
+
const machineUsdAddress = options.machineUsdAddress ?? MOCK_MACHINE_USD_ADDRESS;
|
|
76
|
+
const appName = options.appName ?? "Acme Workspace";
|
|
77
|
+
const grants = new Map();
|
|
78
|
+
let sequence = 0;
|
|
79
|
+
|
|
80
|
+
return from({
|
|
81
|
+
key: options.key ?? "mock",
|
|
82
|
+
name: options.name ?? "Nanocodex mock",
|
|
83
|
+
type: "mock",
|
|
84
|
+
setup({ appId }) {
|
|
85
|
+
return {
|
|
86
|
+
baseUrl: "memory://nanocodex",
|
|
87
|
+
async request(request) {
|
|
88
|
+
if (request.method === "POST" && request.path === "/v1/connections") {
|
|
89
|
+
const authorization = request.body?.key_authorization;
|
|
90
|
+
const keyId = authorization?.keyId ?? authorization?.address;
|
|
91
|
+
if (typeof keyId !== "string") throw new InvalidResponseError("key authorization is missing keyId");
|
|
92
|
+
const expiry = authorization.expiry ?? Math.floor(Date.now() / 1000) + 30 * 86_400;
|
|
93
|
+
const connectors = requestedConnectors(request.body?.requested_connectors);
|
|
94
|
+
const mcpConnections = requestedMcpConnections(request.body?.requested_mcp_connections);
|
|
95
|
+
const grantId = mockHex(`${appId}:${accountAddress}:${keyId}`, 32);
|
|
96
|
+
const connectorConnections = mockConnectorConnections(connectors, grantId);
|
|
97
|
+
const wire = {
|
|
98
|
+
grant_token: `mock-grant-${grantId.slice(2)}`,
|
|
99
|
+
account_address: accountAddress,
|
|
100
|
+
agent_id: `agent_${grantId.slice(2, 14)}`,
|
|
101
|
+
grant: {
|
|
102
|
+
id: grantId,
|
|
103
|
+
permission: request.body?.permission ?? "agent.run",
|
|
104
|
+
status: "active",
|
|
105
|
+
expires_at: expiry,
|
|
106
|
+
capabilities: [
|
|
107
|
+
"nanocodex.agent",
|
|
108
|
+
"mercator.boost",
|
|
109
|
+
"mpp.mach",
|
|
110
|
+
...connectors,
|
|
111
|
+
...mcpConnections.map(({ id }) => `mcp:${id}`),
|
|
112
|
+
],
|
|
113
|
+
connector_connections: connectorConnections,
|
|
114
|
+
mcp_connections: mcpConnections,
|
|
115
|
+
},
|
|
116
|
+
access_key: {
|
|
117
|
+
address: keyId,
|
|
118
|
+
chain_id: String(authorization.chainId ?? 4217),
|
|
119
|
+
key_id: keyId,
|
|
120
|
+
key_type: authorization.keyType ?? "p256",
|
|
121
|
+
limits: authorization.limits ?? [{ token: machineUsdAddress, limit: "10000000", period: 86_400 }],
|
|
122
|
+
scopes: authorization.scopes ?? [],
|
|
123
|
+
witness: authorization.witness ?? mockHex(`${grantId}:witness`, 32),
|
|
124
|
+
expiry,
|
|
125
|
+
authorization: request.body?.signed_key_authorization ?? "0x01",
|
|
126
|
+
},
|
|
127
|
+
mpp: {
|
|
128
|
+
token: machineUsdAddress,
|
|
129
|
+
symbol: "MACH",
|
|
130
|
+
balance_status: "ready",
|
|
131
|
+
settlement_token: "0x20C000000000000000000000b9537d11c60E8b50",
|
|
132
|
+
settlement_symbol: "USDC.e",
|
|
133
|
+
settlement_balance_atomics: "0",
|
|
134
|
+
limit_atomics: "10000000",
|
|
135
|
+
max_per_request_atomics: "250000",
|
|
136
|
+
period: 86_400,
|
|
137
|
+
balance_atomics: "0",
|
|
138
|
+
spent_atomics: "0",
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
grants.set(grantId, wire);
|
|
142
|
+
return wire;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (request.method === "GET" && request.path.match(/^\/v1\/grants\/0x[0-9a-f]+$/)) {
|
|
146
|
+
return requiredGrant(grants, request.path.split("/")[3]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (request.method === "POST" && request.path === "/v1/connections/prepare") {
|
|
150
|
+
const permission = request.body?.permission;
|
|
151
|
+
if (typeof permission !== "string" || permission.length === 0) {
|
|
152
|
+
throw new TypeError("connection permission must be a non-empty string");
|
|
153
|
+
}
|
|
154
|
+
const resources = request.body?.resources ?? [];
|
|
155
|
+
if (!Array.isArray(resources) || resources.some((resource) => typeof resource !== "string" || resource.length === 0)) {
|
|
156
|
+
throw new TypeError("connection resources must be non-empty strings");
|
|
157
|
+
}
|
|
158
|
+
const connectors = connectorResources(resources);
|
|
159
|
+
const id = `req_${++sequence}`;
|
|
160
|
+
const accessPolicy = request.body?.authorize_access_key;
|
|
161
|
+
const keyId = accessPolicy?.address ?? mockHex(`${appId}:${accountAddress}:${permission}:key`, 20);
|
|
162
|
+
const tokenLimit = accessPolicy?.limits?.find((limit) => limit.token === machineUsdAddress);
|
|
163
|
+
const expiry = accessPolicy?.expiry ?? Math.floor(Date.now() / 1000) + 30 * 86_400;
|
|
164
|
+
const dailyLimit = tokenLimit?.limit ?? "10000000";
|
|
165
|
+
const period = tokenLimit?.period ?? 86_400;
|
|
166
|
+
const appOrigin = options.appOrigin ?? "https://app.example";
|
|
167
|
+
const appUrl = new URL(appOrigin);
|
|
168
|
+
const nonce = mockHex(`${id}:siwe-nonce`, 8).slice(2);
|
|
169
|
+
const issuedAt = new Date().toISOString();
|
|
170
|
+
const authMessage = [
|
|
171
|
+
`${appUrl.host} wants you to sign in with your Ethereum account:`,
|
|
172
|
+
"0x0000000000000000000000000000000000000000",
|
|
173
|
+
"",
|
|
174
|
+
`${appName} wants to connect your Nanocodex agent.`,
|
|
175
|
+
"",
|
|
176
|
+
`URI: ${appUrl.origin}`,
|
|
177
|
+
"Version: 1",
|
|
178
|
+
"Chain ID: 4217",
|
|
179
|
+
`Nonce: ${nonce}`,
|
|
180
|
+
`Issued At: ${issuedAt}`,
|
|
181
|
+
...(resources.length > 0
|
|
182
|
+
? ["Resources:", ...resources.map((resource) => `- ${resource}`)]
|
|
183
|
+
: []),
|
|
184
|
+
].join("\n");
|
|
185
|
+
return {
|
|
186
|
+
request_id: id,
|
|
187
|
+
app: { id: appId, name: appName, origin: appOrigin },
|
|
188
|
+
account_address: accountAddress,
|
|
189
|
+
auth: {
|
|
190
|
+
message: authMessage,
|
|
191
|
+
resources,
|
|
192
|
+
},
|
|
193
|
+
permission: {
|
|
194
|
+
id: permission,
|
|
195
|
+
title: "Use your Nanocodex agent",
|
|
196
|
+
description: "Run an app-owned Nanocodex agent with your approved capabilities.",
|
|
197
|
+
connectors: [
|
|
198
|
+
{ id: "agent", name: "Nanocodex", detail: "Instantiate the real Nanocodex runtime in this app" },
|
|
199
|
+
{ id: "mercator", name: "BOOST with Mercator", detail: "Find and compose the right tools, paying per call through MPP" },
|
|
200
|
+
...connectors.map((provider) => ({
|
|
201
|
+
id: provider,
|
|
202
|
+
name: connectorName(provider),
|
|
203
|
+
detail: `Use the connected ${connectorName(provider)} account through the grant`,
|
|
204
|
+
})),
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
access_key: {
|
|
208
|
+
address: keyId,
|
|
209
|
+
chain_id: accessPolicy?.chainId ?? "4217",
|
|
210
|
+
key_id: keyId,
|
|
211
|
+
public_key: accessPolicy?.publicKey ?? mockHex(`${id}:public`, 65),
|
|
212
|
+
key_type: accessPolicy?.keyType ?? "p256",
|
|
213
|
+
limits: accessPolicy?.limits ?? [{ token: machineUsdAddress, limit: dailyLimit, period }],
|
|
214
|
+
scopes: accessPolicy?.scopes ?? [],
|
|
215
|
+
witness: PersonalMessage.getSignPayload(Hex.fromString(authMessage)),
|
|
216
|
+
expiry,
|
|
217
|
+
},
|
|
218
|
+
mpp: {
|
|
219
|
+
token: machineUsdAddress,
|
|
220
|
+
symbol: "MACH",
|
|
221
|
+
settlement_token: "0x20C000000000000000000000b9537d11c60E8b50",
|
|
222
|
+
settlement_symbol: "USDC.e",
|
|
223
|
+
settlement_balance_atomics: "0",
|
|
224
|
+
limit_atomics: dailyLimit,
|
|
225
|
+
period,
|
|
226
|
+
max_per_request_atomics: "250000",
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (request.method === "POST" && request.path === "/v1/connections/complete") {
|
|
232
|
+
const prepared = request.body?.prepared;
|
|
233
|
+
const approval = request.body?.approval;
|
|
234
|
+
if (!prepared || !approval || approval.approved !== true) {
|
|
235
|
+
throw new InvalidResponseError("connection approval is malformed");
|
|
236
|
+
}
|
|
237
|
+
const approvedCapabilities = approval.capabilities;
|
|
238
|
+
if (
|
|
239
|
+
approvedCapabilities?.keyAuthorization?.witness !== prepared.access_key.witness
|
|
240
|
+
|| approvedCapabilities?.personalSign?.message !== prepared.auth.message
|
|
241
|
+
|| typeof approvedCapabilities?.personalSign?.keyAuthorization !== "string"
|
|
242
|
+
|| typeof approvedCapabilities?.signature !== "string"
|
|
243
|
+
) {
|
|
244
|
+
throw new InvalidResponseError("connection approval is not bound to the SIWE challenge and key authorization");
|
|
245
|
+
}
|
|
246
|
+
const grantId = mockHex(`${prepared.app.id}:${prepared.account_address}:${prepared.access_key.key_id}`, 32);
|
|
247
|
+
const wire = {
|
|
248
|
+
grant_token: `mock-grant-${grantId.slice(2)}`,
|
|
249
|
+
account_address: prepared.account_address,
|
|
250
|
+
agent_id: `agent_${grantId.slice(2, 14)}`,
|
|
251
|
+
grant: {
|
|
252
|
+
id: grantId,
|
|
253
|
+
permission: prepared.permission.id,
|
|
254
|
+
status: "active",
|
|
255
|
+
expires_at: prepared.access_key.expiry,
|
|
256
|
+
capabilities: prepared.permission.connectors.map(({ id }) => id),
|
|
257
|
+
},
|
|
258
|
+
access_key: prepared.access_key,
|
|
259
|
+
mpp: {
|
|
260
|
+
...prepared.mpp,
|
|
261
|
+
balance_atomics: "0",
|
|
262
|
+
balance_status: "ready",
|
|
263
|
+
spent_atomics: "0",
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
grants.set(grantId, wire);
|
|
267
|
+
return wire;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (request.method === "POST" && request.path === "/v1/connections/disconnect") {
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (request.method === "GET" && request.path.match(/^\/v1\/grants\/0x[0-9a-f]+\/mpp\/balance$/)) {
|
|
275
|
+
const wire = requiredGrant(grants, request.path.split("/")[3]);
|
|
276
|
+
wire.mpp = { ...wire.mpp, balance_status: "ready" };
|
|
277
|
+
return wire;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (request.method === "POST" && request.path.match(/^\/v1\/grants\/0x[0-9a-f]+\/revoke$/)) {
|
|
281
|
+
const grantId = request.path.split("/")[3];
|
|
282
|
+
const wire = requiredGrant(grants, grantId);
|
|
283
|
+
wire.grant = { ...wire.grant, status: "revoked" };
|
|
284
|
+
return wire.grant;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (request.method === "GET" && request.path === "/v1/machine-usd/config") {
|
|
288
|
+
return {
|
|
289
|
+
chain_id: 4217,
|
|
290
|
+
min_usd_amount_cents: 500,
|
|
291
|
+
max_usd_amount_cents: 10_000,
|
|
292
|
+
stripe_publishable_key: "pk_test_nanocodex",
|
|
293
|
+
token_address: machineUsdAddress,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (request.method === "POST" && request.path.match(/^\/v1\/grants\/0x[0-9a-f]+\/fund$/)) {
|
|
298
|
+
const grantId = request.path.split("/")[3];
|
|
299
|
+
const wire = requiredActiveGrant(grants, grantId);
|
|
300
|
+
const usdAmountCents = request.body?.usd_amount_cents;
|
|
301
|
+
if (!Number.isSafeInteger(usdAmountCents) || usdAmountCents < 500 || usdAmountCents > 10_000) {
|
|
302
|
+
throw new TypeError("MACH amount must be from 500 through 10000 cents");
|
|
303
|
+
}
|
|
304
|
+
const amount = BigInt(usdAmountCents) * 10_000n;
|
|
305
|
+
wire.mpp = {
|
|
306
|
+
...wire.mpp,
|
|
307
|
+
balance_atomics: String(BigInt(wire.mpp.balance_atomics) + amount),
|
|
308
|
+
};
|
|
309
|
+
return {
|
|
310
|
+
order: {
|
|
311
|
+
id: `ord_${++sequence}`,
|
|
312
|
+
status: "complete",
|
|
313
|
+
usd_amount_cents: usdAmountCents,
|
|
314
|
+
machine_usd_amount_atomics: String(amount),
|
|
315
|
+
issuance_transaction_hash: mockHex(`fund:${sequence}`, 32),
|
|
316
|
+
},
|
|
317
|
+
connection: wire,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (request.method === "POST" && request.path.match(/^\/v1\/grants\/0x[0-9a-f]+\/mpp\/charge$/)) {
|
|
322
|
+
const grantId = request.path.split("/")[3];
|
|
323
|
+
const wire = requiredActiveGrant(grants, grantId);
|
|
324
|
+
const amount = BigInt(request.body?.amount_atomics ?? "-1");
|
|
325
|
+
const max = BigInt(wire.mpp.max_per_request_atomics);
|
|
326
|
+
const spent = BigInt(wire.mpp.spent_atomics);
|
|
327
|
+
const limit = BigInt(wire.mpp.limit_atomics);
|
|
328
|
+
const balance = BigInt(wire.mpp.balance_atomics);
|
|
329
|
+
if (amount <= 0n) throw new TypeError("MPP amount must be positive");
|
|
330
|
+
if (amount > max) throw new HttpError(403, "This payment exceeds the per-request permission.", { code: "mpp_request_limit_exceeded" });
|
|
331
|
+
if (spent + amount > limit) throw new HttpError(403, "This payment exceeds the daily MPP permission.", { code: "mpp_period_limit_exceeded" });
|
|
332
|
+
if (amount > balance) throw new HttpError(402, "Add MACH before paying for this capability.", { code: "machine_usd_required" });
|
|
333
|
+
wire.mpp = {
|
|
334
|
+
...wire.mpp,
|
|
335
|
+
balance_atomics: String(balance - amount),
|
|
336
|
+
spent_atomics: String(spent + amount),
|
|
337
|
+
};
|
|
338
|
+
return {
|
|
339
|
+
receipt: {
|
|
340
|
+
id: `mpp_${++sequence}`,
|
|
341
|
+
amount_atomics: String(amount),
|
|
342
|
+
origin: request.body?.origin,
|
|
343
|
+
transaction_hash: mockHex(`mpp:${sequence}`, 32),
|
|
344
|
+
},
|
|
345
|
+
connection: wire,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
throw new HttpError(404, `No mock route for ${request.method ?? "GET"} ${request.path}`, {
|
|
350
|
+
code: "mock_route_not_found",
|
|
351
|
+
});
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function requiredGrant(grants, grantId) {
|
|
359
|
+
const grant = grants.get(grantId);
|
|
360
|
+
if (!grant) throw new HttpError(404, "Nanocodex grant not found", { code: "grant_not_found" });
|
|
361
|
+
return grant;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function requestedConnectors(value) {
|
|
365
|
+
if (value === undefined) return [];
|
|
366
|
+
if (!Array.isArray(value)) throw new TypeError("requested_connectors must be an array");
|
|
367
|
+
const supported = [
|
|
368
|
+
"github",
|
|
369
|
+
"gmail",
|
|
370
|
+
"gdrive",
|
|
371
|
+
"gcalendar",
|
|
372
|
+
"gtasks",
|
|
373
|
+
"gdocs",
|
|
374
|
+
"gsheets",
|
|
375
|
+
"gslides",
|
|
376
|
+
"gcontacts",
|
|
377
|
+
"slack",
|
|
378
|
+
"x",
|
|
379
|
+
"chatgpt",
|
|
380
|
+
];
|
|
381
|
+
if (value.some((provider) => !supported.includes(provider))) {
|
|
382
|
+
throw new TypeError("requested_connectors contains an unsupported provider");
|
|
383
|
+
}
|
|
384
|
+
return supported.filter((provider) => value.includes(provider));
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function requestedMcpConnections(value) {
|
|
388
|
+
if (value === undefined) return [];
|
|
389
|
+
if (!Array.isArray(value) || value.length > 16
|
|
390
|
+
|| value.some((id) => typeof id !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(id))
|
|
391
|
+
|| new Set(value).size !== value.length) {
|
|
392
|
+
throw new TypeError("requested_mcp_connections must contain exact hosted connection IDs");
|
|
393
|
+
}
|
|
394
|
+
return value.map((id) => ({ id, name: "MCP connection" }));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function connectorResources(resources) {
|
|
398
|
+
return requestedConnectors(resources
|
|
399
|
+
.filter((resource) => resource.startsWith("urn:nanocodex:connector:"))
|
|
400
|
+
.map((resource) => resource.slice("urn:nanocodex:connector:".length)));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function connectorName(provider) {
|
|
404
|
+
return ({
|
|
405
|
+
github: "GitHub",
|
|
406
|
+
gmail: "Gmail",
|
|
407
|
+
gdrive: "Google Drive",
|
|
408
|
+
gcalendar: "Google Calendar",
|
|
409
|
+
gtasks: "Google Tasks",
|
|
410
|
+
gdocs: "Google Docs",
|
|
411
|
+
gsheets: "Google Sheets",
|
|
412
|
+
gslides: "Google Slides",
|
|
413
|
+
gcontacts: "Google Contacts",
|
|
414
|
+
slack: "Slack",
|
|
415
|
+
x: "X",
|
|
416
|
+
chatgpt: "ChatGPT",
|
|
417
|
+
})[provider];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function mockConnectorConnections(connectors, grantId) {
|
|
421
|
+
return Object.fromEntries(connectors
|
|
422
|
+
.filter((connector) => connector !== "chatgpt")
|
|
423
|
+
.map((connector) => [
|
|
424
|
+
connector,
|
|
425
|
+
[mockHex(`${grantId}:${connector}:connection`, 32).slice(2, 45)],
|
|
426
|
+
]));
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function requiredActiveGrant(grants, grantId) {
|
|
430
|
+
const grant = requiredGrant(grants, grantId);
|
|
431
|
+
if (grant.grant.status !== "active") {
|
|
432
|
+
throw new HttpError(403, "This Nanocodex grant has been revoked.", { code: "grant_revoked" });
|
|
433
|
+
}
|
|
434
|
+
return grant;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function mockHex(seed, bytes) {
|
|
438
|
+
let state = 2166136261;
|
|
439
|
+
let output = "";
|
|
440
|
+
for (let index = 0; output.length < bytes * 2; index += 1) {
|
|
441
|
+
const code = seed.charCodeAt(index % seed.length) + index;
|
|
442
|
+
state ^= code;
|
|
443
|
+
state = Math.imul(state, 16777619) >>> 0;
|
|
444
|
+
output += state.toString(16).padStart(8, "0");
|
|
445
|
+
}
|
|
446
|
+
return `0x${output.slice(0, bytes * 2)}`;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function requiredString(value, label) {
|
|
450
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
451
|
+
throw new TypeError(`${label} must be a non-empty string`);
|
|
452
|
+
}
|
|
453
|
+
return value;
|
|
454
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Client } from "../Client.mjs";
|
|
2
|
+
|
|
3
|
+
export declare namespace logout {
|
|
4
|
+
type ReturnType = Promise<void>;
|
|
5
|
+
type ErrorType = Error;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Signs out the Nanocodex account without revoking its app grant or access key. */
|
|
9
|
+
export function logout(client: Client): logout.ReturnType;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Signs out the Nanocodex account without revoking its app grant or access key. */
|
|
2
|
+
export async function logout(client) {
|
|
3
|
+
client._clearSession();
|
|
4
|
+
let failure;
|
|
5
|
+
if (!client.principal) {
|
|
6
|
+
try {
|
|
7
|
+
await client.provider.request({ method: "wallet_disconnect" });
|
|
8
|
+
} catch (error) {
|
|
9
|
+
failure = error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const cleanup = await Promise.allSettled([
|
|
13
|
+
client.provider.reset?.(),
|
|
14
|
+
client.dialog.resetWallet?.(),
|
|
15
|
+
]);
|
|
16
|
+
if (failure) throw failure;
|
|
17
|
+
const cleanupFailure = cleanup.find((result) => result.status === "rejected");
|
|
18
|
+
if (cleanupFailure?.status === "rejected") throw cleanupFailure.reason;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NamedTool, ToolMap, TurnUsage } from "../../types.mjs";
|
|
2
|
+
import type { Base } from "../Client.mjs";
|
|
3
|
+
import type { Connection, ConnectAgent, HostConnection } from "../types.mjs";
|
|
4
|
+
|
|
5
|
+
export function create(
|
|
6
|
+
client: Base,
|
|
7
|
+
options: create.Options,
|
|
8
|
+
): Promise<ConnectAgent>;
|
|
9
|
+
|
|
10
|
+
export declare namespace create {
|
|
11
|
+
type Options = Readonly<{
|
|
12
|
+
connection: Connection | HostConnection;
|
|
13
|
+
signal?: AbortSignal | undefined;
|
|
14
|
+
tools?: ToolMap | readonly NamedTool[] | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
type ReturnType = ConnectAgent;
|
|
17
|
+
type TurnUsageResult = TurnUsage;
|
|
18
|
+
}
|