@inkeep/agents-sdk 0.63.0 → 0.63.2
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/project.js +11 -21
- package/dist/skill-loader.js +16 -9
- package/dist/types.d.ts +2 -8
- package/package.json +2 -3
package/dist/project.js
CHANGED
|
@@ -323,8 +323,10 @@ var Project = class {
|
|
|
323
323
|
const artifactComponentsObject = {};
|
|
324
324
|
const credentialReferencesObject = {};
|
|
325
325
|
const externalAgentsObject = {};
|
|
326
|
-
const skillsObject = {
|
|
327
|
-
|
|
326
|
+
const skillsObject = Object.fromEntries(this.skills.map((skill) => {
|
|
327
|
+
if (!skill.id) throw new Error("Invalid skill: missing required \"id\" field.");
|
|
328
|
+
return [skill.id, { files: skill.files }];
|
|
329
|
+
}));
|
|
328
330
|
const credentialUsageMap = {};
|
|
329
331
|
for (const agent of this.agents) {
|
|
330
332
|
logger.info({ agentId: agent.getId() }, "Agent id");
|
|
@@ -556,18 +558,6 @@ var Project = class {
|
|
|
556
558
|
}
|
|
557
559
|
}
|
|
558
560
|
logger.info({ externalAgentsObject }, "External agents object");
|
|
559
|
-
for (const skill of this.skills) {
|
|
560
|
-
if (!skill.id) continue;
|
|
561
|
-
skillsObject[skill.id] = {
|
|
562
|
-
id: skill.id,
|
|
563
|
-
name: skill.name,
|
|
564
|
-
description: skill.description,
|
|
565
|
-
content: skill.content,
|
|
566
|
-
metadata: skill.metadata ?? null,
|
|
567
|
-
createdAt: skill.createdAt ?? skillTimestamp,
|
|
568
|
-
updatedAt: skill.updatedAt ?? skillTimestamp
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
561
|
for (const tool of this.projectTools) {
|
|
572
562
|
const toolId = tool.getId();
|
|
573
563
|
if (!toolsObject[toolId]) {
|
|
@@ -633,13 +623,13 @@ var Project = class {
|
|
|
633
623
|
stopWhen: this.stopWhen,
|
|
634
624
|
agents: agentsObject,
|
|
635
625
|
tools: toolsObject,
|
|
636
|
-
functionTools: Object.keys(functionToolsObject).length
|
|
637
|
-
functions: Object.keys(functionsObject).length
|
|
638
|
-
dataComponents: Object.keys(dataComponentsObject).length
|
|
639
|
-
artifactComponents: Object.keys(artifactComponentsObject).length
|
|
640
|
-
externalAgents: Object.keys(externalAgentsObject).length
|
|
641
|
-
credentialReferences: Object.keys(credentialReferencesObject).length
|
|
642
|
-
skills: Object.keys(skillsObject).length
|
|
626
|
+
functionTools: Object.keys(functionToolsObject).length ? functionToolsObject : void 0,
|
|
627
|
+
functions: Object.keys(functionsObject).length ? functionsObject : void 0,
|
|
628
|
+
dataComponents: Object.keys(dataComponentsObject).length ? dataComponentsObject : void 0,
|
|
629
|
+
artifactComponents: Object.keys(artifactComponentsObject).length ? artifactComponentsObject : void 0,
|
|
630
|
+
externalAgents: Object.keys(externalAgentsObject).length ? externalAgentsObject : void 0,
|
|
631
|
+
credentialReferences: Object.keys(credentialReferencesObject).length ? credentialReferencesObject : void 0,
|
|
632
|
+
skills: Object.keys(skillsObject).length ? skillsObject : void 0,
|
|
643
633
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
644
634
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
645
635
|
};
|
package/dist/skill-loader.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
+
import { SkillApiInsertSchema } from "@inkeep/agents-core";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import { simplematter } from "simplematter";
|
|
4
|
+
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region src/skill-loader.ts
|
|
7
7
|
function getParentDirName(filePath) {
|
|
8
8
|
return path.basename(path.dirname(filePath));
|
|
9
9
|
}
|
|
10
|
+
function toPosixPath(filePath) {
|
|
11
|
+
return filePath.split(path.sep).join("/");
|
|
12
|
+
}
|
|
13
|
+
function loadSkillFiles(skillDir) {
|
|
14
|
+
return fs.globSync("**/*", { cwd: skillDir }).filter((filePath) => fs.statSync(path.join(skillDir, filePath)).isFile()).map((filePath) => ({
|
|
15
|
+
filePath: toPosixPath(filePath),
|
|
16
|
+
content: fs.readFileSync(path.join(skillDir, filePath), "utf8")
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
10
19
|
function loadSkills(directoryPath) {
|
|
11
20
|
return fs.globSync("*/SKILL.md", { cwd: directoryPath }).map((filePath) => {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
21
|
+
const skillDir = path.join(directoryPath, path.dirname(filePath));
|
|
22
|
+
const result = SkillApiInsertSchema.safeParse({ files: loadSkillFiles(skillDir) });
|
|
23
|
+
if (!result.success) throw new Error(z.prettifyError(result.error));
|
|
24
|
+
const { name, files } = result.data;
|
|
15
25
|
const id = getParentDirName(filePath);
|
|
16
26
|
if (name !== id) throw new Error(`Skill name "${name}" does not match directory "${id}"`);
|
|
17
27
|
return {
|
|
18
28
|
id,
|
|
19
|
-
|
|
20
|
-
description,
|
|
21
|
-
metadata,
|
|
22
|
-
content: document.trim()
|
|
29
|
+
files
|
|
23
30
|
};
|
|
24
31
|
});
|
|
25
32
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AgentMcpConfig } from "./builders.js";
|
|
|
5
5
|
import { DataComponentInterface } from "./data-component.js";
|
|
6
6
|
import { ExternalAgentConfig } from "./external-agent.js";
|
|
7
7
|
import { FunctionTool } from "./function-tool.js";
|
|
8
|
-
import { AgentConversationHistoryConfig, AgentStopWhen, ArtifactComponentApiInsert, CredentialReferenceApiInsert, DataComponentApiInsert, FullAgentDefinition, FunctionToolConfig, McpTransportConfig, ModelSettings, StatusUpdateSettings, SubAgentApiInsert, ToolInsert, ToolPolicy } from "@inkeep/agents-core";
|
|
8
|
+
import { AgentConversationHistoryConfig, AgentStopWhen, ArtifactComponentApiInsert, CredentialReferenceApiInsert, DataComponentApiInsert, FullAgentDefinition, FunctionToolConfig, McpTransportConfig, ModelSettings, SkillApiInsertSchema, StatusUpdateSettings, SubAgentApiInsert, ToolInsert, ToolPolicy } from "@inkeep/agents-core";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
11
11
|
//#region src/types.d.ts
|
|
@@ -55,14 +55,8 @@ interface ToolResult {
|
|
|
55
55
|
result: any;
|
|
56
56
|
error?: string;
|
|
57
57
|
}
|
|
58
|
-
interface SkillDefinition {
|
|
58
|
+
interface SkillDefinition extends z.input<typeof SkillApiInsertSchema> {
|
|
59
59
|
id: string;
|
|
60
|
-
name: string;
|
|
61
|
-
description: string;
|
|
62
|
-
content: string;
|
|
63
|
-
metadata: Record<string, string> | null;
|
|
64
|
-
createdAt?: string;
|
|
65
|
-
updatedAt?: string;
|
|
66
60
|
}
|
|
67
61
|
type SkillReference = string | {
|
|
68
62
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.63.
|
|
3
|
+
"version": "0.63.2",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
16
|
-
"simplematter": "^1.0.0",
|
|
17
16
|
"js-yaml": "^4.1.0",
|
|
18
17
|
"typescript": "^6.0.2",
|
|
19
18
|
"zod": "^4.3.6",
|
|
20
|
-
"@inkeep/agents-core": "^0.63.
|
|
19
|
+
"@inkeep/agents-core": "^0.63.2"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
22
|
"@types/js-yaml": "^4.0.9",
|