@cuylabs/agent-core 0.8.0 → 0.10.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 +33 -17
- package/dist/chunk-2O4MCSQS.js +780 -0
- package/dist/chunk-2TTOLHBT.js +198 -0
- package/dist/chunk-5FMSGQVX.js +281 -0
- package/dist/chunk-5NVVNXPQ.js +288 -0
- package/dist/{chunk-CAA7FHIH.js → chunk-6HZBHFOL.js} +3 -103
- package/dist/chunk-CJI7PVS2.js +58 -0
- package/dist/{chunk-N6HWIEEA.js → chunk-CMYN2RCB.js} +278 -61
- package/dist/chunk-FII65CN7.js +117 -0
- package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
- package/dist/chunk-I6PKJ7XQ.js +292 -0
- package/dist/{chunk-BDBZ3SLK.js → chunk-ICZ66572.js} +48 -4
- package/dist/chunk-KYLPMBHD.js +316 -0
- package/dist/chunk-MXAP4UG6.js +2956 -0
- package/dist/{chunk-RZITT45F.js → chunk-N3VX7FEE.js} +39 -6
- package/dist/{chunk-YSLSEQ6B.js → chunk-NDZWXCBZ.js} +218 -95
- package/dist/{chunk-P6YF7USR.js → chunk-Q742PSH3.js} +23 -38
- package/dist/chunk-QAL3OMI3.js +943 -0
- package/dist/{chunk-RFEKJKTO.js → chunk-RN6WZEUF.js} +330 -280
- package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
- package/dist/chunk-SPBFQXOT.js +0 -0
- package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
- package/dist/chunk-SSFBF3US.js +602 -0
- package/dist/chunk-SZ2XBPTW.js +8 -0
- package/dist/chunk-T4UIX5D7.js +115 -0
- package/dist/chunk-TIHPYVAJ.js +102 -0
- package/dist/{chunk-YUUJK53A.js → chunk-TOTDGK3P.js} +1 -1
- package/dist/chunk-V4RFNEET.js +563 -0
- package/dist/chunk-VOUEJSW6.js +0 -0
- package/dist/{chunk-4BDA7DQY.js → chunk-WBPOZ7CL.js} +673 -273
- package/dist/chunk-X4VN4GIJ.js +185 -0
- package/dist/dispatch/index.d.ts +93 -0
- package/dist/dispatch/index.js +37 -0
- package/dist/events/index.d.ts +93 -0
- package/dist/events/index.js +6 -0
- package/dist/{runtime → execution}/index.d.ts +120 -34
- package/dist/{runtime → execution}/index.js +18 -13
- package/dist/index-BCqEGzBj.d.ts +251 -0
- package/dist/index.d.ts +490 -122
- package/dist/index.js +2104 -615
- package/dist/{errors → inference/errors}/index.d.ts +2 -2
- package/dist/{errors → inference/errors}/index.js +1 -1
- package/dist/inference/index.d.ts +16 -23
- package/dist/inference/index.js +45 -16
- package/dist/instance-BqV2D5pc.d.ts +5723 -0
- package/dist/logger/index.d.ts +50 -0
- package/dist/logger/index.js +11 -0
- package/dist/mcp/index.d.ts +5 -9
- package/dist/mcp/index.js +2 -3
- package/dist/middleware/index.d.ts +10 -149
- package/dist/middleware/index.js +11 -3
- package/dist/model-messages-B4nK9D1-.d.ts +13 -0
- package/dist/models/index.d.ts +23 -18
- package/dist/models/index.js +48 -11
- package/dist/models/reasoning/index.d.ts +4 -0
- package/dist/{reasoning → models/reasoning}/index.js +3 -3
- package/dist/plugin/index.d.ts +458 -0
- package/dist/plugin/index.js +32 -0
- package/dist/profiles/index.d.ts +55 -0
- package/dist/profiles/index.js +30 -0
- package/dist/prompt/index.d.ts +8 -12
- package/dist/prompt/index.js +3 -2
- package/dist/safety/index.d.ts +109 -14
- package/dist/safety/index.js +59 -3
- package/dist/sandbox/index.d.ts +81 -0
- package/dist/sandbox/index.js +1 -0
- package/dist/skill/index.d.ts +10 -8
- package/dist/skill/index.js +3 -3
- package/dist/storage/index.d.ts +12 -4
- package/dist/storage/index.js +1 -1
- package/dist/subagents/index.d.ts +177 -0
- package/dist/subagents/index.js +78 -0
- package/dist/team/index.d.ts +544 -0
- package/dist/team/index.js +41 -0
- package/dist/tool/host/index.d.ts +41 -0
- package/dist/tool/host/index.js +10 -0
- package/dist/tool/index.d.ts +125 -21
- package/dist/tool/index.js +20 -13
- package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
- package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
- package/dist/types-RSCv7nQ4.d.ts +59 -0
- package/package.json +58 -53
- package/dist/builder-UpOWQMW3.d.ts +0 -34
- package/dist/chunk-7MUFEN4K.js +0 -559
- package/dist/chunk-7VKQ4WPB.js +0 -73
- package/dist/chunk-BFM2YHNM.js +0 -222
- package/dist/chunk-DWYX7ASF.js +0 -26
- package/dist/chunk-KUVSERLJ.js +0 -50
- package/dist/chunk-N7P4PN3O.js +0 -84
- package/dist/chunk-SDSBEQXG.js +0 -157
- package/dist/chunk-SQU2AJHO.js +0 -305
- package/dist/chunk-VBWWUHWI.js +0 -724
- package/dist/chunk-VEKUXUVF.js +0 -41
- package/dist/chunk-VNQBHPCT.js +0 -398
- package/dist/chunk-WWYYNWEW.js +0 -259
- package/dist/context/index.d.ts +0 -259
- package/dist/context/index.js +0 -26
- package/dist/events-CE72w8W4.d.ts +0 -149
- package/dist/host/index.d.ts +0 -45
- package/dist/host/index.js +0 -8
- package/dist/index-CWSchSql.d.ts +0 -1058
- package/dist/messages-BYWGn8TY.d.ts +0 -110
- package/dist/presets/index.d.ts +0 -53
- package/dist/presets/index.js +0 -28
- package/dist/reasoning/index.d.ts +0 -116
- package/dist/registry-DwYqsQkX.d.ts +0 -164
- package/dist/runner-e2YRcUoX.d.ts +0 -786
- package/dist/scope/index.d.ts +0 -10
- package/dist/scope/index.js +0 -14
- package/dist/session-manager-B_CWGTsl.d.ts +0 -274
- package/dist/signal/index.d.ts +0 -28
- package/dist/signal/index.js +0 -6
- package/dist/sub-agent/index.d.ts +0 -23
- package/dist/sub-agent/index.js +0 -15
- package/dist/tool-BHbyUAy3.d.ts +0 -150
- package/dist/tool-DLXAR9Ce.d.ts +0 -145
- package/dist/tracker-DClqYqTj.d.ts +0 -96
- package/dist/tracking/index.d.ts +0 -111
- package/dist/tracking/index.js +0 -20
- package/dist/types-BfNpU8NS.d.ts +0 -270
- package/dist/types-BnpEOYV-.d.ts +0 -50
- package/dist/types-CQL-SvTn.d.ts +0 -29
- package/dist/types-CWm-7rvB.d.ts +0 -55
- package/dist/types-KKDrdU9Y.d.ts +0 -325
- package/dist/types-QA4WhEfz.d.ts +0 -138
- package/dist/types-QKHHQLLq.d.ts +0 -336
- package/dist/types-YuWV4ag7.d.ts +0 -72
|
@@ -34,7 +34,7 @@ function normalizeToolReplayPolicy(policy, fileOps) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// src/tool/truncation.ts
|
|
37
|
-
import * as
|
|
37
|
+
import * as fsSync from "fs";
|
|
38
38
|
import * as path from "path";
|
|
39
39
|
import * as os from "os";
|
|
40
40
|
import * as crypto from "crypto";
|
|
@@ -55,8 +55,11 @@ function truncateOutput(output, options = {}) {
|
|
|
55
55
|
}
|
|
56
56
|
const hash = crypto.createHash("sha256").update(output).digest("hex").slice(0, 16);
|
|
57
57
|
const outputPath = path.join(TRUNCATE_DIR, `output-${hash}.txt`);
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
try {
|
|
59
|
+
fsSync.mkdirSync(TRUNCATE_DIR, { recursive: true });
|
|
60
|
+
fsSync.writeFileSync(outputPath, output, "utf-8");
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
60
63
|
let truncated;
|
|
61
64
|
if (lines.length > maxLines) {
|
|
62
65
|
const keepLines = Math.floor(maxLines / 2);
|
|
@@ -71,9 +74,10 @@ function truncateOutput(output, options = {}) {
|
|
|
71
74
|
...lastPart
|
|
72
75
|
].join("\n");
|
|
73
76
|
} else {
|
|
77
|
+
const buf = Buffer.from(output, "utf-8");
|
|
74
78
|
const keepBytes = Math.floor(maxBytes / 2);
|
|
75
|
-
const start =
|
|
76
|
-
const end =
|
|
79
|
+
const start = buf.subarray(0, keepBytes).toString("utf-8");
|
|
80
|
+
const end = buf.subarray(buf.length - keepBytes).toString("utf-8");
|
|
77
81
|
const omittedBytes = bytes - keepBytes * 2;
|
|
78
82
|
truncated = `${start}
|
|
79
83
|
... (${omittedBytes} bytes omitted, full output saved to ${outputPath}) ...
|
|
@@ -85,11 +89,6 @@ ${end}`;
|
|
|
85
89
|
outputPath
|
|
86
90
|
};
|
|
87
91
|
}
|
|
88
|
-
function formatSize(bytes) {
|
|
89
|
-
if (bytes < 1024) return `${bytes} B`;
|
|
90
|
-
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
91
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
92
|
-
}
|
|
93
92
|
|
|
94
93
|
// src/tool/tool.ts
|
|
95
94
|
import { z } from "zod";
|
|
@@ -102,17 +101,22 @@ var Tool;
|
|
|
102
101
|
);
|
|
103
102
|
return {
|
|
104
103
|
id,
|
|
104
|
+
capabilitiesHint: options.capabilitiesHint,
|
|
105
105
|
replayPolicy: staticReplayPolicy,
|
|
106
|
+
deferred: options.deferred,
|
|
107
|
+
searchKeywords: options.searchKeywords,
|
|
106
108
|
init: async (initCtx) => {
|
|
107
109
|
const toolInfo = typeof init === "function" ? await init(initCtx) : init;
|
|
108
110
|
const replayPolicy = normalizeToolReplayPolicy(
|
|
109
111
|
toolInfo.replayPolicy ?? staticReplayPolicy,
|
|
110
112
|
toolInfo.fileOps
|
|
111
113
|
);
|
|
114
|
+
const perToolMaxBytes = toolInfo.capabilities?.maxOutputChars;
|
|
112
115
|
const originalExecute = toolInfo.execute;
|
|
113
116
|
const execute = async (params, ctx) => {
|
|
117
|
+
let validated;
|
|
114
118
|
try {
|
|
115
|
-
toolInfo.parameters.parse(params);
|
|
119
|
+
validated = toolInfo.parameters.parse(params);
|
|
116
120
|
} catch (error) {
|
|
117
121
|
if (error instanceof z.ZodError && toolInfo.formatValidationError) {
|
|
118
122
|
throw new Error(toolInfo.formatValidationError(error), {
|
|
@@ -125,16 +129,19 @@ Please rewrite the input so it satisfies the expected schema.`,
|
|
|
125
129
|
{ cause: error }
|
|
126
130
|
);
|
|
127
131
|
}
|
|
128
|
-
const result = await originalExecute(
|
|
129
|
-
|
|
132
|
+
const result = await originalExecute(validated, ctx);
|
|
133
|
+
const meta = result.metadata ?? {};
|
|
134
|
+
if (meta.truncated !== void 0) {
|
|
130
135
|
return result;
|
|
131
136
|
}
|
|
132
|
-
const truncated = truncateOutput(result.output
|
|
137
|
+
const truncated = truncateOutput(result.output, {
|
|
138
|
+
...perToolMaxBytes !== void 0 ? { maxBytes: perToolMaxBytes } : {}
|
|
139
|
+
});
|
|
133
140
|
return {
|
|
134
141
|
...result,
|
|
135
142
|
output: truncated.content,
|
|
136
143
|
metadata: {
|
|
137
|
-
...
|
|
144
|
+
...meta,
|
|
138
145
|
truncated: truncated.truncated,
|
|
139
146
|
...truncated.truncated && { outputPath: truncated.outputPath }
|
|
140
147
|
}
|
|
@@ -149,34 +156,12 @@ Please rewrite the input so it satisfies the expected schema.`,
|
|
|
149
156
|
};
|
|
150
157
|
}
|
|
151
158
|
Tool2.define = define;
|
|
152
|
-
function defineSimple(id, config) {
|
|
153
|
-
return define(id, config);
|
|
154
|
-
}
|
|
155
|
-
Tool2.defineSimple = defineSimple;
|
|
156
159
|
})(Tool || (Tool = {}));
|
|
157
|
-
function defineTool(definition) {
|
|
158
|
-
return Tool.define(definition.id, {
|
|
159
|
-
description: definition.description,
|
|
160
|
-
parameters: definition.parameters,
|
|
161
|
-
execute: async (params, ctx) => {
|
|
162
|
-
const result = await definition.execute(params, ctx);
|
|
163
|
-
return {
|
|
164
|
-
title: result.title,
|
|
165
|
-
output: result.output,
|
|
166
|
-
metadata: result.metadata ?? {}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
160
|
|
|
172
161
|
export {
|
|
173
162
|
normalizeToolReplayPolicy,
|
|
174
163
|
MAX_LINES,
|
|
175
164
|
MAX_BYTES,
|
|
176
|
-
TRUNCATE_DIR,
|
|
177
|
-
TRUNCATE_GLOB,
|
|
178
165
|
truncateOutput,
|
|
179
|
-
|
|
180
|
-
Tool,
|
|
181
|
-
defineTool
|
|
166
|
+
Tool
|
|
182
167
|
};
|