@vinhnt-sdk/core 0.9.4 → 0.9.5
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/kernel/state-machine.d.ts +1 -1
- package/dist/system-context/sources/tool-context-source.d.ts +11 -8
- package/dist/system-context/sources/tool-context-source.d.ts.map +1 -1
- package/dist/system-context/sources/tool-context-source.js +15 -10
- package/dist/system-context/sources/tool-context-source.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RunStatus } from "@vinhnt-sdk/schema";
|
|
2
2
|
/** Run statuses that terminate a run: `succeeded`, `failed`, `cancelled`. */
|
|
3
|
-
export declare const terminalRunStatuses: Set<"
|
|
3
|
+
export declare const terminalRunStatuses: Set<"succeeded" | "failed" | "cancelled" | "running" | "paused" | "queued" | "awaiting_approval">;
|
|
4
4
|
/** Whether a run may transition directly from `from` to `to`. */
|
|
5
5
|
export declare function canTransitionRun(from: RunStatus, to: RunStatus): boolean;
|
|
6
6
|
//# sourceMappingURL=state-machine.d.ts.map
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import type { ContextSourceValue } from "../types.js";
|
|
2
2
|
export interface ToolContextInfo {
|
|
3
3
|
tools: Array<{
|
|
4
|
-
name
|
|
5
|
-
|
|
4
|
+
name?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
description?: string;
|
|
6
7
|
risk?: string;
|
|
7
8
|
}>;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
* Creates a context source that renders registered tool
|
|
11
|
-
*
|
|
11
|
+
* Creates a context source that renders registered tool names as a lightweight
|
|
12
|
+
* index in the system prompt.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Descriptions and JSON Schemas are NOT duplicated here — they ride the native
|
|
15
|
+
* `tools[]` API param (industry pattern: OpenAI/Anthropic/ADK/Mastra).
|
|
16
|
+
* This block is name+risk only so the model sees a compact capability map.
|
|
15
17
|
*/
|
|
16
18
|
export declare function createToolContextSource(getTools: () => Array<{
|
|
17
|
-
name
|
|
18
|
-
|
|
19
|
+
name?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
description?: string;
|
|
19
22
|
risk?: string;
|
|
20
23
|
}>): ContextSourceValue<ToolContextInfo>;
|
|
21
24
|
//# sourceMappingURL=tool-context-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-context-source.d.ts","sourceRoot":"","sources":["../../../src/system-context/sources/tool-context-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-context-source.d.ts","sourceRoot":"","sources":["../../../src/system-context/sources/tool-context-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,GACD,kBAAkB,CAAC,eAAe,CAAC,CA+CrC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Creates a context source that renders registered tool
|
|
3
|
-
*
|
|
2
|
+
* Creates a context source that renders registered tool names as a lightweight
|
|
3
|
+
* index in the system prompt.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Descriptions and JSON Schemas are NOT duplicated here — they ride the native
|
|
6
|
+
* `tools[]` API param (industry pattern: OpenAI/Anthropic/ADK/Mastra).
|
|
7
|
+
* This block is name+risk only so the model sees a compact capability map.
|
|
7
8
|
*/
|
|
8
9
|
export function createToolContextSource(getTools) {
|
|
9
10
|
return {
|
|
@@ -18,28 +19,32 @@ export function createToolContextSource(getTools) {
|
|
|
18
19
|
const lines = [
|
|
19
20
|
"# Available Tools",
|
|
20
21
|
"",
|
|
21
|
-
"
|
|
22
|
+
"Prefer using tools over manual work. Tool descriptions and parameter schemas are provided via the tools API.",
|
|
22
23
|
"",
|
|
23
24
|
];
|
|
24
25
|
for (const tool of value.tools) {
|
|
26
|
+
const name = tool.name ?? tool.id;
|
|
27
|
+
if (!name)
|
|
28
|
+
continue;
|
|
25
29
|
const risk = tool.risk ? ` [${tool.risk}]` : "";
|
|
26
|
-
lines.push(`- \`${
|
|
30
|
+
lines.push(`- \`${name}\`${risk}`);
|
|
27
31
|
}
|
|
28
32
|
return lines.join("\n");
|
|
29
33
|
},
|
|
30
34
|
renderUpdate(value, previous) {
|
|
35
|
+
const keyOf = (t) => t.name ?? t.id ?? "";
|
|
31
36
|
if (value.tools.length === previous.tools.length)
|
|
32
37
|
return null;
|
|
33
|
-
const added = value.tools.filter((t) => !previous.tools.some((p) => p
|
|
34
|
-
const removed = previous.tools.filter((t) => !value.tools.some((p) => p
|
|
38
|
+
const added = value.tools.filter((t) => !previous.tools.some((p) => keyOf(p) === keyOf(t)));
|
|
39
|
+
const removed = previous.tools.filter((t) => !value.tools.some((p) => keyOf(p) === keyOf(t)));
|
|
35
40
|
if (added.length === 0 && removed.length === 0)
|
|
36
41
|
return null;
|
|
37
42
|
const lines = ["[Context update — tools changed]"];
|
|
38
43
|
if (added.length > 0) {
|
|
39
|
-
lines.push(`New tools: ${added.map((t) => t
|
|
44
|
+
lines.push(`New tools: ${added.map((t) => keyOf(t)).join(", ")}`);
|
|
40
45
|
}
|
|
41
46
|
if (removed.length > 0) {
|
|
42
|
-
lines.push(`Removed tools: ${removed.map((t) => t
|
|
47
|
+
lines.push(`Removed tools: ${removed.map((t) => keyOf(t)).join(", ")}`);
|
|
43
48
|
}
|
|
44
49
|
return lines.join("\n");
|
|
45
50
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-context-source.js","sourceRoot":"","sources":["../../../src/system-context/sources/tool-context-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-context-source.js","sourceRoot":"","sources":["../../../src/system-context/sources/tool-context-source.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAKE;IAEF,OAAO;QACL,GAAG,EAAE,YAAgC;QACrC,QAAQ,EAAE,CAAC;QACX,KAAK,CAAC,IAAI;YACR,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC/B,CAAC;QACD,cAAc,CAAC,KAAK;YAClB,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YACxC,MAAM,KAAK,GAAa;gBACtB,mBAAmB;gBACnB,EAAE;gBACF,8GAA8G;gBAC9G,EAAE;aACH,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,IAAI;oBAAE,SAAS;gBACpB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChD,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,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YACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1E,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,aAAa;YACX,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinhnt-sdk/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Core agent engine for VNT Agent - kernel, tools, sessions, plugins, permissions, and knowledge",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@vinhnt-sdk/event": "0.4.2",
|
|
49
49
|
"@vinhnt-sdk/guard": "0.4.3",
|
|
50
50
|
"@vinhnt-sdk/guardrails": "0.4.2",
|
|
51
|
-
"@vinhnt-sdk/knowledge": "0.4.
|
|
52
|
-
"@vinhnt-sdk/llm": "0.5.
|
|
51
|
+
"@vinhnt-sdk/knowledge": "0.4.3",
|
|
52
|
+
"@vinhnt-sdk/llm": "0.5.4",
|
|
53
53
|
"@vinhnt-sdk/permission": "0.4.2",
|
|
54
54
|
"@vinhnt-sdk/sandbox": "0.4.2",
|
|
55
|
-
"@vinhnt-sdk/schema": "
|
|
55
|
+
"@vinhnt-sdk/schema": "0.5.7",
|
|
56
56
|
"@vinhnt-sdk/session": "0.4.2",
|
|
57
57
|
"@vinhnt-sdk/step-executor": "0.4.7",
|
|
58
|
-
"@vinhnt-sdk/tools": "0.4.
|
|
58
|
+
"@vinhnt-sdk/tools": "0.4.6",
|
|
59
59
|
"@vinhnt-sdk/workflow": "0.4.2",
|
|
60
60
|
"zod": "^4.4.3"
|
|
61
61
|
},
|