@cuylabs/agent-core 0.4.0 → 0.5.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 +57 -8
- package/dist/builder-RcTZuYnO.d.ts +34 -0
- package/dist/capabilities/index.d.ts +97 -0
- package/dist/capabilities/index.js +46 -0
- package/dist/chunk-6TDTQJ4P.js +116 -0
- package/dist/chunk-7MUFEN4K.js +559 -0
- package/dist/chunk-BDBZ3SLK.js +745 -0
- package/dist/chunk-DWYX7ASF.js +26 -0
- package/dist/chunk-FG4MD5MU.js +54 -0
- package/dist/chunk-IMGQOTU2.js +2019 -0
- package/dist/chunk-IVUJDISU.js +556 -0
- package/dist/chunk-LRHOS4ZN.js +584 -0
- package/dist/chunk-OTUGSCED.js +691 -0
- package/dist/chunk-P6YF7USR.js +182 -0
- package/dist/chunk-QAQADS4X.js +258 -0
- package/dist/chunk-QWFMX226.js +879 -0
- package/dist/{chunk-6VKLWNRE.js → chunk-SDSBEQXG.js} +1 -132
- package/dist/chunk-VBWWUHWI.js +724 -0
- package/dist/chunk-VEKUXUVF.js +41 -0
- package/dist/chunk-X635CM2F.js +305 -0
- package/dist/chunk-YUUJK53A.js +91 -0
- package/dist/chunk-ZXAKHMWH.js +283 -0
- package/dist/config-D2xeGEHK.d.ts +52 -0
- package/dist/context/index.d.ts +259 -0
- package/dist/context/index.js +26 -0
- package/dist/identifiers-BLUxFqV_.d.ts +12 -0
- package/dist/index-p0kOsVsE.d.ts +1067 -0
- package/dist/index-tmhaADz5.d.ts +198 -0
- package/dist/index.d.ts +210 -5736
- package/dist/index.js +2126 -7766
- package/dist/mcp/index.d.ts +26 -0
- package/dist/mcp/index.js +14 -0
- package/dist/messages-BYWGn8TY.d.ts +110 -0
- package/dist/middleware/index.d.ts +7 -0
- package/dist/middleware/index.js +12 -0
- package/dist/models/index.d.ts +33 -0
- package/dist/models/index.js +12 -0
- package/dist/network-D76DS5ot.d.ts +5 -0
- package/dist/prompt/index.d.ts +224 -0
- package/dist/prompt/index.js +45 -0
- package/dist/reasoning/index.d.ts +71 -0
- package/dist/reasoning/index.js +47 -0
- package/dist/registry-CuRWWtcT.d.ts +164 -0
- package/dist/resolver-DOfZ-xuk.d.ts +254 -0
- package/dist/runner-C7aMP_x3.d.ts +596 -0
- package/dist/runtime/index.d.ts +357 -0
- package/dist/runtime/index.js +64 -0
- package/dist/session-manager-Uawm2Le7.d.ts +274 -0
- package/dist/skill/index.d.ts +103 -0
- package/dist/skill/index.js +39 -0
- package/dist/storage/index.d.ts +167 -0
- package/dist/storage/index.js +50 -0
- package/dist/sub-agent/index.d.ts +14 -0
- package/dist/sub-agent/index.js +15 -0
- package/dist/tool/index.d.ts +173 -1
- package/dist/tool/index.js +12 -3
- package/dist/tool-DYp6-cC3.d.ts +239 -0
- package/dist/tool-pFAnJc5Y.d.ts +419 -0
- package/dist/tracker-DClqYqTj.d.ts +96 -0
- package/dist/tracking/index.d.ts +109 -0
- package/dist/tracking/index.js +20 -0
- package/dist/types-CQaXbRsS.d.ts +47 -0
- package/dist/types-MM1JoX5T.d.ts +810 -0
- package/dist/types-VQgymC1N.d.ts +156 -0
- package/package.json +89 -5
- package/dist/index-BlSTfS-W.d.ts +0 -470
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/models/identifiers.ts
|
|
2
|
+
function getModelId(model) {
|
|
3
|
+
if (typeof model === "string") return model;
|
|
4
|
+
if (typeof model === "object" && model !== null && "modelId" in model) {
|
|
5
|
+
return String(model.modelId);
|
|
6
|
+
}
|
|
7
|
+
return String(model);
|
|
8
|
+
}
|
|
9
|
+
function getProviderId(model) {
|
|
10
|
+
if (typeof model === "string") {
|
|
11
|
+
if (model.includes("/")) {
|
|
12
|
+
return model.split("/")[0];
|
|
13
|
+
}
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
if (typeof model === "object" && model !== null && "provider" in model) {
|
|
17
|
+
const provider = String(model.provider);
|
|
18
|
+
return provider.split(".")[0];
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
getModelId,
|
|
25
|
+
getProviderId
|
|
26
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractFilePathsFromArgs,
|
|
3
|
+
shouldCaptureBaseline
|
|
4
|
+
} from "./chunk-VEKUXUVF.js";
|
|
5
|
+
|
|
6
|
+
// src/tool/executor.ts
|
|
7
|
+
async function executeAgentToolCall(options) {
|
|
8
|
+
const initialized = await options.tool.init({ cwd: options.cwd });
|
|
9
|
+
const ctx = {
|
|
10
|
+
cwd: options.cwd,
|
|
11
|
+
abort: options.abort,
|
|
12
|
+
sessionID: options.sessionID,
|
|
13
|
+
messageID: options.messageID,
|
|
14
|
+
agent: options.agent ?? "default",
|
|
15
|
+
...options.host ? { host: options.host } : {},
|
|
16
|
+
...options.turnTracker ? { turnTracker: options.turnTracker } : {}
|
|
17
|
+
};
|
|
18
|
+
if (options.middleware?.hasMiddleware) {
|
|
19
|
+
const decision = await options.middleware.runBeforeToolCall(
|
|
20
|
+
options.toolName,
|
|
21
|
+
options.params,
|
|
22
|
+
ctx
|
|
23
|
+
);
|
|
24
|
+
if (decision.action === "deny") {
|
|
25
|
+
return {
|
|
26
|
+
output: decision.reason ?? `Tool call denied: ${options.toolName}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (options.turnTracker && initialized.fileOps && shouldCaptureBaseline(initialized.fileOps)) {
|
|
31
|
+
const paths = extractFilePathsFromArgs(
|
|
32
|
+
options.params,
|
|
33
|
+
initialized.fileOps
|
|
34
|
+
);
|
|
35
|
+
for (const path of paths) {
|
|
36
|
+
await options.turnTracker.beforeWrite(path);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const result = await initialized.execute(options.params, ctx);
|
|
40
|
+
if (options.middleware?.hasMiddleware) {
|
|
41
|
+
const transformed = await options.middleware.runAfterToolCall(
|
|
42
|
+
options.toolName,
|
|
43
|
+
options.params,
|
|
44
|
+
result,
|
|
45
|
+
ctx
|
|
46
|
+
);
|
|
47
|
+
return { output: transformed.output };
|
|
48
|
+
}
|
|
49
|
+
return { output: result.output };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
executeAgentToolCall
|
|
54
|
+
};
|