@zpi-dev/agent-sdk 0.0.0-stage → 0.1.60
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/NOTICE +1206 -0
- package/README.md +54 -2
- package/dist/chunk-4WFFCN2C.js +29607 -0
- package/dist/chunk-4WFFCN2C.js.map +1 -0
- package/dist/chunk-AR5RMMMN.js +24353 -0
- package/dist/chunk-AR5RMMMN.js.map +1 -0
- package/dist/chunk-RAZL7ZAW.js +13451 -0
- package/dist/chunk-RAZL7ZAW.js.map +1 -0
- package/dist/chunk-TUOZKHGN.js +21 -0
- package/dist/chunk-TUOZKHGN.js.map +1 -0
- package/dist/chunk-YBW5XDR7.js +48 -0
- package/dist/chunk-YBW5XDR7.js.map +1 -0
- package/dist/host.d.ts +1 -0
- package/dist/host.js +34 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/node-WXHENNL2.js +21 -0
- package/dist/node-WXHENNL2.js.map +1 -0
- package/dist/node-XSTAMDFW.js +2225 -0
- package/dist/node-XSTAMDFW.js.map +1 -0
- package/dist/src-7WDJXP5P.js +128 -0
- package/dist/src-7WDJXP5P.js.map +1 -0
- package/dist/types/agent/src/agent-loop.d.ts +3 -0
- package/dist/types/agent/src/agent.d.ts +21 -0
- package/dist/types/agent/src/index.d.ts +3 -0
- package/dist/types/agent/src/streaming-tool-coordinator.d.ts +10 -0
- package/dist/types/agent/src/tool-execution.d.ts +9 -0
- package/dist/types/agent/src/types.d.ts +144 -0
- package/dist/types/agent-sdk/src/hooks.d.ts +12 -0
- package/dist/types/agent-sdk/src/host.d.ts +4 -0
- package/dist/types/agent-sdk/src/index.d.ts +4 -0
- package/dist/types/agent-sdk/src/messages.d.ts +12 -0
- package/dist/types/agent-sdk/src/permissions.d.ts +10 -0
- package/dist/types/agent-sdk/src/query-result.d.ts +7 -0
- package/dist/types/agent-sdk/src/query.d.ts +6 -0
- package/dist/types/agent-sdk/src/resources.d.ts +16 -0
- package/dist/types/agent-sdk/src/runtime.d.ts +7 -0
- package/dist/types/agent-sdk/src/sessions.d.ts +48 -0
- package/dist/types/agent-sdk/src/tasks.d.ts +8 -0
- package/dist/types/agent-sdk/src/tools.d.ts +5 -0
- package/dist/types/agent-sdk/src/types.d.ts +428 -0
- package/dist/types/ai/src/api/anthropic-messages.d.ts +70 -0
- package/dist/types/ai/src/api/constrained-sampling.d.ts +5 -0
- package/dist/types/ai/src/api/github-copilot-headers.d.ts +7 -0
- package/dist/types/ai/src/api/openai-completions.d.ts +10 -0
- package/dist/types/ai/src/api/openai-responses.d.ts +5 -0
- package/dist/types/ai/src/api/responses-cache.d.ts +6 -0
- package/dist/types/ai/src/api/responses-events.d.ts +3 -0
- package/dist/types/ai/src/api/responses-session.d.ts +56 -0
- package/dist/types/ai/src/api/simple-options.d.ts +14 -0
- package/dist/types/ai/src/api/transform-messages.d.ts +3 -0
- package/dist/types/ai/src/auth/openai-chatgpt.d.ts +32 -0
- package/dist/types/ai/src/index.d.ts +20 -0
- package/dist/types/ai/src/providers/discovery.d.ts +14 -0
- package/dist/types/ai/src/providers/registry.d.ts +155 -0
- package/dist/types/ai/src/stream.d.ts +5 -0
- package/dist/types/ai/src/types.d.ts +394 -0
- package/dist/types/ai/src/utils/abort.d.ts +2 -0
- package/dist/types/ai/src/utils/context-breakdown.d.ts +3 -0
- package/dist/types/ai/src/utils/cost.d.ts +2 -0
- package/dist/types/ai/src/utils/diagnostics.d.ts +16 -0
- package/dist/types/ai/src/utils/error-body.d.ts +24 -0
- package/dist/types/ai/src/utils/estimate.d.ts +16 -0
- package/dist/types/ai/src/utils/event-stream.d.ts +15 -0
- package/dist/types/ai/src/utils/guard-model-stream.d.ts +3 -0
- package/dist/types/ai/src/utils/headers.d.ts +1 -0
- package/dist/types/ai/src/utils/json-parse.d.ts +7 -0
- package/dist/types/ai/src/utils/media-policy.d.ts +68 -0
- package/dist/types/ai/src/utils/model-performance.d.ts +23 -0
- package/dist/types/ai/src/utils/model-retry.d.ts +3 -0
- package/dist/types/ai/src/utils/option-map/compiler.d.ts +2 -0
- package/dist/types/ai/src/utils/option-map/evaluator.d.ts +3 -0
- package/dist/types/ai/src/utils/option-map/parser.d.ts +40 -0
- package/dist/types/ai/src/utils/option-map/tokenizer.d.ts +8 -0
- package/dist/types/ai/src/utils/option-map/types.d.ts +15 -0
- package/dist/types/ai/src/utils/overflow.d.ts +68 -0
- package/dist/types/ai/src/utils/provider-cache.d.ts +11 -0
- package/dist/types/ai/src/utils/provider-env.d.ts +2 -0
- package/dist/types/ai/src/utils/provider-retry.d.ts +17 -0
- package/dist/types/ai/src/utils/reasoning.d.ts +14 -0
- package/dist/types/ai/src/utils/redact-error.d.ts +2 -0
- package/dist/types/ai/src/utils/retry.d.ts +62 -0
- package/dist/types/ai/src/utils/sanitize-unicode.d.ts +21 -0
- package/dist/types/ai/src/utils/stream-idle-timeout.d.ts +36 -0
- package/dist/types/ai/src/utils/text.d.ts +9 -0
- package/dist/types/ai/src/utils/transcript.d.ts +41 -0
- package/dist/types/coding-agent/src/core/agent-session.d.ts +174 -0
- package/dist/types/coding-agent/src/core/commands.d.ts +19 -0
- package/dist/types/coding-agent/src/core/compaction-utils.d.ts +37 -0
- package/dist/types/coding-agent/src/core/compaction.d.ts +139 -0
- package/dist/types/coding-agent/src/core/file-rewind.d.ts +24 -0
- package/dist/types/coding-agent/src/core/fs.d.ts +1 -0
- package/dist/types/coding-agent/src/core/http-idle-timeout.d.ts +2 -0
- package/dist/types/coding-agent/src/core/image-limits.d.ts +19 -0
- package/dist/types/coding-agent/src/core/images.d.ts +18 -0
- package/dist/types/coding-agent/src/core/input.d.ts +3 -0
- package/dist/types/coding-agent/src/core/markdown-code.d.ts +7 -0
- package/dist/types/coding-agent/src/core/markdown.d.ts +13 -0
- package/dist/types/coding-agent/src/core/mentions.d.ts +12 -0
- package/dist/types/coding-agent/src/core/microcompact.d.ts +40 -0
- package/dist/types/coding-agent/src/core/model-performance.d.ts +57 -0
- package/dist/types/coding-agent/src/core/model-runtime.d.ts +51 -0
- package/dist/types/coding-agent/src/core/read-file-bounded.d.ts +2 -0
- package/dist/types/coding-agent/src/core/record-validation.d.ts +6 -0
- package/dist/types/coding-agent/src/core/resources.d.ts +51 -0
- package/dist/types/coding-agent/src/core/sdk.d.ts +50 -0
- package/dist/types/coding-agent/src/core/session-manager.d.ts +137 -0
- package/dist/types/coding-agent/src/core/session-state.d.ts +14 -0
- package/dist/types/coding-agent/src/core/settings-manager.d.ts +41 -0
- package/dist/types/coding-agent/src/core/streaming-tool-journal.d.ts +17 -0
- package/dist/types/coding-agent/src/core/system-prompt.d.ts +25 -0
- package/dist/types/coding-agent/src/core/tools/file-change.d.ts +21 -0
- package/dist/types/coding-agent/src/core/tools/index.d.ts +20 -0
- package/dist/types/coding-agent/src/core/tools/pi/bash.d.ts +185 -0
- package/dist/types/coding-agent/src/core/tools/pi/edit-diff.d.ts +84 -0
- package/dist/types/coding-agent/src/core/tools/pi/edit.d.ts +69 -0
- package/dist/types/coding-agent/src/core/tools/pi/file-mutation-queue.d.ts +5 -0
- package/dist/types/coding-agent/src/core/tools/pi/file-read-state.d.ts +12 -0
- package/dist/types/coding-agent/src/core/tools/pi/output-accumulator.d.ts +68 -0
- package/dist/types/coding-agent/src/core/tools/pi/path-utils.d.ts +7 -0
- package/dist/types/coding-agent/src/core/tools/pi/read.d.ts +63 -0
- package/dist/types/coding-agent/src/core/tools/pi/text-range-reader.d.ts +22 -0
- package/dist/types/coding-agent/src/core/tools/pi/tool-definition-wrapper.d.ts +4 -0
- package/dist/types/coding-agent/src/core/tools/pi/truncate.d.ts +60 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/bmp-source.d.ts +2 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/child-process.d.ts +13 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-budget.d.ts +16 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-process.d.ts +18 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-resize-core.d.ts +26 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-resize.d.ts +3 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/image-source.d.ts +11 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/mime.d.ts +3 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/paths.d.ts +16 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/read-file.d.ts +2 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/shell.d.ts +18 -0
- package/dist/types/coding-agent/src/core/tools/pi/utils/text.d.ts +5 -0
- package/dist/types/coding-agent/src/core/tools/pi/write.d.ts +44 -0
- package/dist/types/coding-agent/src/core/transcript-store.d.ts +71 -0
- package/dist/types/coding-agent/src/core/types.d.ts +60 -0
- package/dist/types/coding-agent/src/index.d.ts +42 -0
- package/dist/types/coding-agent/src/plugins/assembly.d.ts +37 -0
- package/dist/types/coding-agent/src/plugins/hooks.d.ts +82 -0
- package/dist/types/coding-agent/src/plugins/resources.d.ts +4 -0
- package/dist/types/coding-agent/src/plugins/session-hooks.d.ts +26 -0
- package/dist/types/coding-agent/src/plugins/types.d.ts +40 -0
- package/dist/types/plugin-compat/src/command-hooks.d.ts +184 -0
- package/dist/types/plugin-compat/src/index.d.ts +11 -0
- package/package.json +53 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// node_modules/@anthropic-ai/sdk/internal/node.mjs
|
|
4
|
+
import * as child_process from "child_process";
|
|
5
|
+
import * as crypto from "crypto";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import * as os from "os";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import * as stream from "stream";
|
|
10
|
+
import * as util from "util";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
child_process,
|
|
14
|
+
crypto,
|
|
15
|
+
fs,
|
|
16
|
+
os,
|
|
17
|
+
path,
|
|
18
|
+
stream,
|
|
19
|
+
util
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-TUOZKHGN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@anthropic-ai/sdk/src/internal/node.ts"],"sourcesContent":["/**\n * The one module under `src/` that may import Node built-ins (eslint enforces this).\n * The package.json `browser` field swaps it for `./node.browser`, so only touch its\n * exports on code paths that run on Node-compatible runtimes.\n */\nimport * as child_process from 'node:child_process';\nimport * as crypto from 'node:crypto';\nimport * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport * as stream from 'node:stream';\nimport * as util from 'node:util';\n\nexport { child_process, crypto, fs, os, path, stream, util };\n"],"mappings":";;;AAKA,YAAY,mBAAmB;AAC/B,YAAY,YAAY;AACxB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,YAAY,YAAY;AACxB,YAAY,UAAU;","names":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
try {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw mod = 0, e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
__require,
|
|
44
|
+
__commonJS,
|
|
45
|
+
__export,
|
|
46
|
+
__toESM
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=chunk-YBW5XDR7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/agent-sdk/src/host.js";
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SessionManager,
|
|
4
|
+
SettingsManager,
|
|
5
|
+
createAgentSession,
|
|
6
|
+
query
|
|
7
|
+
} from "./chunk-4WFFCN2C.js";
|
|
8
|
+
import "./chunk-AR5RMMMN.js";
|
|
9
|
+
import "./chunk-RAZL7ZAW.js";
|
|
10
|
+
import "./chunk-YBW5XDR7.js";
|
|
11
|
+
|
|
12
|
+
// packages/agent-sdk/src/query-result.ts
|
|
13
|
+
async function queryResult(params, observe) {
|
|
14
|
+
let result;
|
|
15
|
+
for await (const message of query(params)) {
|
|
16
|
+
observe?.(message);
|
|
17
|
+
if (message.type === "result") result = message;
|
|
18
|
+
}
|
|
19
|
+
if (!result) throw new Error("Agent SDK returned no result");
|
|
20
|
+
if (result.subtype !== "success")
|
|
21
|
+
throw Object.assign(new Error(result.errors.join("\n")), { sdkResult: result });
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function nativeStopReason(reason) {
|
|
25
|
+
return reason === "end_turn" ? "stop" : reason === "tool_use" ? "toolUse" : reason === "max_tokens" ? "length" : reason ?? "error";
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
SessionManager,
|
|
29
|
+
SettingsManager,
|
|
30
|
+
createAgentSession,
|
|
31
|
+
nativeStopReason,
|
|
32
|
+
queryResult
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/query-result.ts"],"sourcesContent":["import { type QueryParams, query } from \"./query.ts\";\nimport type { SDKMessage, SDKResultMessage } from \"./types.ts\";\n\n/** Consume a query and return its successful terminal result. */\nexport async function queryResult(\n params: QueryParams,\n observe?: (message: SDKMessage) => void,\n): Promise<Extract<SDKResultMessage, { subtype: \"success\" }>> {\n let result: SDKResultMessage | undefined;\n for await (const message of query(params)) {\n observe?.(message);\n if (message.type === \"result\") result = message;\n }\n if (!result) throw new Error(\"Agent SDK returned no result\");\n if (result.subtype !== \"success\")\n throw Object.assign(new Error(result.errors.join(\"\\n\")), { sdkResult: result });\n return result;\n}\n\nexport function nativeStopReason(reason: string | null): string {\n return reason === \"end_turn\"\n ? \"stop\"\n : reason === \"tool_use\"\n ? \"toolUse\"\n : reason === \"max_tokens\"\n ? \"length\"\n : (reason ?? \"error\");\n}\n"],"mappings":";;;;;;;;;;;;AAIA,eAAsB,YACpB,QACA,SAC4D;AAC5D,MAAI;AACJ,mBAAiB,WAAW,MAAM,MAAM,GAAG;AACzC,cAAU,OAAO;AACjB,QAAI,QAAQ,SAAS,SAAU,UAAS;AAAA,EAC1C;AACA,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,8BAA8B;AAC3D,MAAI,OAAO,YAAY;AACrB,UAAM,OAAO,OAAO,IAAI,MAAM,OAAO,OAAO,KAAK,IAAI,CAAC,GAAG,EAAE,WAAW,OAAO,CAAC;AAChF,SAAO;AACT;AAEO,SAAS,iBAAiB,QAA+B;AAC9D,SAAO,WAAW,aACd,SACA,WAAW,aACT,YACA,WAAW,eACT,WACC,UAAU;AACrB;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/agent-sdk/src/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ModelRuntime,
|
|
4
|
+
forkSession,
|
|
5
|
+
getSessionInfo,
|
|
6
|
+
getSessionMessages,
|
|
7
|
+
listSessions,
|
|
8
|
+
query,
|
|
9
|
+
renameSession,
|
|
10
|
+
tagSession
|
|
11
|
+
} from "./chunk-4WFFCN2C.js";
|
|
12
|
+
import "./chunk-AR5RMMMN.js";
|
|
13
|
+
import "./chunk-RAZL7ZAW.js";
|
|
14
|
+
import "./chunk-YBW5XDR7.js";
|
|
15
|
+
export {
|
|
16
|
+
ModelRuntime,
|
|
17
|
+
forkSession,
|
|
18
|
+
getSessionInfo,
|
|
19
|
+
getSessionMessages,
|
|
20
|
+
listSessions,
|
|
21
|
+
query,
|
|
22
|
+
renameSession,
|
|
23
|
+
tagSession
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
child_process,
|
|
4
|
+
crypto,
|
|
5
|
+
fs,
|
|
6
|
+
os,
|
|
7
|
+
path,
|
|
8
|
+
stream,
|
|
9
|
+
util
|
|
10
|
+
} from "./chunk-TUOZKHGN.js";
|
|
11
|
+
import "./chunk-YBW5XDR7.js";
|
|
12
|
+
export {
|
|
13
|
+
child_process,
|
|
14
|
+
crypto,
|
|
15
|
+
fs,
|
|
16
|
+
os,
|
|
17
|
+
path,
|
|
18
|
+
stream,
|
|
19
|
+
util
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=node-WXHENNL2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|