@agentskit/cli 0.13.46 → 0.13.48
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/dist/bin.cjs +35 -15
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-M3DE267Q.js → chunk-QOF6GNDX.js} +37 -17
- package/dist/chunk-QOF6GNDX.js.map +1 -0
- package/dist/index.cjs +35 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +286 -0
- package/dist/index.d.ts +286 -0
- package/dist/index.js +1 -1
- package/package.json +18 -18
- package/dist/chunk-M3DE267Q.js.map +0 -1
package/dist/bin.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var kleur = require('kleur');
|
|
|
25
25
|
var child_process = require('child_process');
|
|
26
26
|
var module$1 = require('module');
|
|
27
27
|
var chokidar = require('chokidar');
|
|
28
|
+
var net = require('@agentskit/net');
|
|
28
29
|
var rag = require('@agentskit/rag');
|
|
29
30
|
var agentSchema = require('@agentskit/core/agent-schema');
|
|
30
31
|
var yaml = require('yaml');
|
|
@@ -41,7 +42,7 @@ var chokidar__default = /*#__PURE__*/_interopDefault(chokidar);
|
|
|
41
42
|
|
|
42
43
|
// package.json
|
|
43
44
|
var package_default = {
|
|
44
|
-
version: "0.13.
|
|
45
|
+
version: "0.13.48"};
|
|
45
46
|
async function loadJsonConfig(path6) {
|
|
46
47
|
try {
|
|
47
48
|
const raw = await promises.readFile(path6, "utf8");
|
|
@@ -4190,8 +4191,8 @@ function registerTunnelCommand(program) {
|
|
|
4190
4191
|
}
|
|
4191
4192
|
});
|
|
4192
4193
|
}
|
|
4193
|
-
|
|
4194
|
-
|
|
4194
|
+
var MAX_EMBEDDER_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
4195
|
+
var MAX_EMBEDDER_ERROR_BYTES = 1024 * 1024;
|
|
4195
4196
|
function createOpenAiEmbedder(config) {
|
|
4196
4197
|
const model = config.model ?? "text-embedding-3-small";
|
|
4197
4198
|
const baseUrl = (config.baseUrl ?? "https://api.openai.com").replace(/\/$/, "");
|
|
@@ -4205,10 +4206,24 @@ function createOpenAiEmbedder(config) {
|
|
|
4205
4206
|
body: JSON.stringify({ model, input: text })
|
|
4206
4207
|
});
|
|
4207
4208
|
if (!res.ok) {
|
|
4208
|
-
|
|
4209
|
-
|
|
4209
|
+
let body = "";
|
|
4210
|
+
let cause;
|
|
4211
|
+
try {
|
|
4212
|
+
body = await net.readText(res, { maxBytes: MAX_EMBEDDER_ERROR_BYTES });
|
|
4213
|
+
} catch (error2) {
|
|
4214
|
+
if (error2 instanceof net.NetError) cause = error2;
|
|
4215
|
+
}
|
|
4216
|
+
const error = new Error(`embedder ${model} HTTP ${res.status}: ${body}`);
|
|
4217
|
+
if (cause) Object.assign(error, { cause });
|
|
4218
|
+
throw error;
|
|
4219
|
+
}
|
|
4220
|
+
let json;
|
|
4221
|
+
try {
|
|
4222
|
+
json = await net.readJson(res, { maxBytes: MAX_EMBEDDER_RESPONSE_BYTES });
|
|
4223
|
+
} catch (error) {
|
|
4224
|
+
if (error instanceof net.NetError) throw Object.assign(new Error(error.message), { cause: error });
|
|
4225
|
+
throw error;
|
|
4210
4226
|
}
|
|
4211
|
-
const json = await res.json();
|
|
4212
4227
|
const first = json.data?.[0]?.embedding;
|
|
4213
4228
|
if (!first) throw new Error(`embedder ${model}: response missing data[0].embedding`);
|
|
4214
4229
|
return first;
|
|
@@ -5074,22 +5089,27 @@ async function fetchWithLimits(url, fetchImpl) {
|
|
|
5074
5089
|
try {
|
|
5075
5090
|
const response = await fetchImpl(url, { signal: controller.signal });
|
|
5076
5091
|
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5092
|
+
let body;
|
|
5093
|
+
try {
|
|
5094
|
+
body = await net.readBody(response, { maxBytes: MAX_RESPONSE_BYTES });
|
|
5095
|
+
} catch (error) {
|
|
5096
|
+
if (error instanceof net.NetError && error.code === net.NetErrorCodes.AK_NET_BODY_TOO_LARGE) {
|
|
5097
|
+
throw Object.assign(new Error(`Registry response exceeded ${MAX_RESPONSE_BYTES} bytes`), { cause: error });
|
|
5098
|
+
}
|
|
5099
|
+
throw error;
|
|
5080
5100
|
}
|
|
5081
|
-
return new Response(body, { status: response.status, headers: response.headers });
|
|
5101
|
+
return new Response(Uint8Array.from(body), { status: response.status, headers: response.headers });
|
|
5082
5102
|
} finally {
|
|
5083
5103
|
clearTimeout(timer);
|
|
5084
5104
|
}
|
|
5085
5105
|
}
|
|
5086
5106
|
async function getJson(url, fetchImpl) {
|
|
5087
5107
|
const res = await fetchWithLimits(url, fetchImpl);
|
|
5088
|
-
return
|
|
5108
|
+
return net.readJson(res, { maxBytes: MAX_RESPONSE_BYTES });
|
|
5089
5109
|
}
|
|
5090
5110
|
async function getText(url, fetchImpl) {
|
|
5091
5111
|
const res = await fetchWithLimits(url, fetchImpl);
|
|
5092
|
-
return
|
|
5112
|
+
return net.readText(res, { maxBytes: MAX_RESPONSE_BYTES });
|
|
5093
5113
|
}
|
|
5094
5114
|
async function fetchAgent(id, options = {}) {
|
|
5095
5115
|
assertSafeId(id);
|
|
@@ -5227,7 +5247,7 @@ function allDeps(pkg) {
|
|
|
5227
5247
|
if (!pkg) return {};
|
|
5228
5248
|
return { ...pkg.peerDependencies, ...pkg.devDependencies, ...pkg.dependencies };
|
|
5229
5249
|
}
|
|
5230
|
-
function
|
|
5250
|
+
function readJson3(fs, path6) {
|
|
5231
5251
|
const raw = fs.readFile(path6);
|
|
5232
5252
|
if (raw == null) return null;
|
|
5233
5253
|
try {
|
|
@@ -5276,7 +5296,7 @@ function detectMetaFramework(fs, root, deps, uiBinding) {
|
|
|
5276
5296
|
return "none";
|
|
5277
5297
|
}
|
|
5278
5298
|
function detectImportAlias(fs, root) {
|
|
5279
|
-
const tsconfig =
|
|
5299
|
+
const tsconfig = readJson3(
|
|
5280
5300
|
fs,
|
|
5281
5301
|
path.join(root, "tsconfig.json")
|
|
5282
5302
|
);
|
|
@@ -5315,7 +5335,7 @@ function detectMonorepo(fs, root) {
|
|
|
5315
5335
|
return null;
|
|
5316
5336
|
}
|
|
5317
5337
|
function scanProject(fs, root = ".") {
|
|
5318
|
-
const pkg =
|
|
5338
|
+
const pkg = readJson3(fs, path.join(root, "package.json"));
|
|
5319
5339
|
const deps = allDeps(pkg);
|
|
5320
5340
|
const uiBinding = detectUiBinding(deps);
|
|
5321
5341
|
const metaFramework = detectMetaFramework(fs, root, deps, uiBinding);
|