@enactprotocol/shared 2.2.4 → 2.3.4
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 +1 -18
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -6
- package/dist/config.js.map +1 -1
- package/dist/execution/action-command.d.ts +131 -0
- package/dist/execution/action-command.d.ts.map +1 -0
- package/dist/execution/action-command.js +300 -0
- package/dist/execution/action-command.js.map +1 -0
- package/dist/execution/command.d.ts +8 -8
- package/dist/execution/command.js +6 -6
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +2 -0
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/types.d.ts +5 -2
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/execution/types.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/manifest/actions-loader.d.ts +29 -0
- package/dist/manifest/actions-loader.d.ts.map +1 -0
- package/dist/manifest/actions-loader.js +34 -0
- package/dist/manifest/actions-loader.js.map +1 -0
- package/dist/manifest/actions-parser.d.ts +69 -0
- package/dist/manifest/actions-parser.d.ts.map +1 -0
- package/dist/manifest/actions-parser.js +265 -0
- package/dist/manifest/actions-parser.js.map +1 -0
- package/dist/manifest/index.d.ts +2 -0
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +4 -0
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/loader.d.ts +7 -2
- package/dist/manifest/loader.d.ts.map +1 -1
- package/dist/manifest/loader.js +71 -4
- package/dist/manifest/loader.js.map +1 -1
- package/dist/manifest/parser.d.ts +1 -0
- package/dist/manifest/parser.d.ts.map +1 -1
- package/dist/manifest/parser.js +1 -0
- package/dist/manifest/parser.js.map +1 -1
- package/dist/manifest/scripts.d.ts +19 -0
- package/dist/manifest/scripts.d.ts.map +1 -0
- package/dist/manifest/scripts.js +102 -0
- package/dist/manifest/scripts.js.map +1 -0
- package/dist/manifest/validator.d.ts +1 -8
- package/dist/manifest/validator.d.ts.map +1 -1
- package/dist/manifest/validator.js +14 -13
- package/dist/manifest/validator.js.map +1 -1
- package/dist/mcp-registry.js +5 -5
- package/dist/mcp-registry.js.map +1 -1
- package/dist/paths.d.ts +9 -2
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +12 -3
- package/dist/paths.js.map +1 -1
- package/dist/registry.d.ts +3 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +5 -5
- package/dist/registry.js.map +1 -1
- package/dist/resolver.d.ts +55 -4
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +133 -75
- package/dist/resolver.js.map +1 -1
- package/dist/types/actions.d.ts +194 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +32 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/manifest.d.ts +50 -5
- package/dist/types/manifest.d.ts.map +1 -1
- package/dist/types/manifest.js +10 -2
- package/dist/types/manifest.js.map +1 -1
- package/package.json +2 -2
- package/src/config.ts +48 -6
- package/src/execution/action-command.ts +417 -0
- package/src/execution/command.ts +8 -8
- package/src/execution/index.ts +17 -0
- package/src/execution/types.ts +13 -2
- package/src/index.ts +37 -0
- package/src/manifest/actions-loader.ts +49 -0
- package/src/manifest/index.ts +12 -0
- package/src/manifest/loader.ts +77 -4
- package/src/manifest/parser.ts +1 -0
- package/src/manifest/scripts.ts +116 -0
- package/src/manifest/validator.ts +15 -14
- package/src/mcp-registry.ts +5 -5
- package/src/paths.ts +13 -3
- package/src/registry.ts +5 -5
- package/src/resolver.ts +172 -77
- package/src/types/actions.ts +223 -0
- package/src/types/index.ts +11 -0
- package/src/types/manifest.ts +67 -6
- package/tests/action-command.test.ts +249 -0
- package/tests/config-normalization.test.ts +279 -0
- package/tests/config.test.ts +4 -1
- package/tests/effective-input-schema.test.ts +86 -0
- package/tests/fixtures/valid-tool.md +5 -12
- package/tests/fixtures/valid-tool.yaml +3 -10
- package/tests/hooks.test.ts +177 -0
- package/tests/manifest/loader.test.ts +34 -20
- package/tests/manifest/parser.test.ts +11 -15
- package/tests/manifest/validator.test.ts +7 -17
- package/tests/manifest-types.test.ts +9 -11
- package/tests/paths.test.ts +11 -4
- package/tests/registry.test.ts +12 -11
- package/tests/resolver.test.ts +11 -7
- package/tsconfig.tsbuildinfo +1 -1
package/tests/paths.test.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getGlobalEnvPath,
|
|
10
10
|
getProjectEnactDir,
|
|
11
11
|
getProjectEnvPath,
|
|
12
|
+
getSkillsDir,
|
|
12
13
|
getToolsDir,
|
|
13
14
|
} from "../src/paths";
|
|
14
15
|
|
|
@@ -106,14 +107,20 @@ describe("path utilities", () => {
|
|
|
106
107
|
});
|
|
107
108
|
});
|
|
108
109
|
|
|
109
|
-
describe("
|
|
110
|
-
test("returns ~/.
|
|
111
|
-
const result =
|
|
112
|
-
const expected = join(homedir(), ".
|
|
110
|
+
describe("getSkillsDir", () => {
|
|
111
|
+
test("returns ~/.agent/skills/ path", () => {
|
|
112
|
+
const result = getSkillsDir();
|
|
113
|
+
const expected = join(homedir(), ".agent", "skills");
|
|
113
114
|
expect(result).toBe(expected);
|
|
114
115
|
});
|
|
115
116
|
});
|
|
116
117
|
|
|
118
|
+
describe("getCacheDir (deprecated)", () => {
|
|
119
|
+
test("returns same path as getSkillsDir", () => {
|
|
120
|
+
expect(getCacheDir()).toBe(getSkillsDir());
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
117
124
|
describe("getConfigPath", () => {
|
|
118
125
|
test("returns ~/.enact/config.yaml path", () => {
|
|
119
126
|
const result = getConfigPath();
|
package/tests/registry.test.ts
CHANGED
|
@@ -199,18 +199,19 @@ describe("registry", () => {
|
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
describe("getToolCachePath", () => {
|
|
202
|
-
test("returns
|
|
202
|
+
test("returns skill path under ~/.agent/skills/", () => {
|
|
203
203
|
const path = getToolCachePath("org/tool", "1.0.0");
|
|
204
|
-
expect(path).toContain(".
|
|
205
|
-
expect(path).toContain("
|
|
204
|
+
expect(path).toContain(".agent");
|
|
205
|
+
expect(path).toContain("skills");
|
|
206
206
|
expect(path).toContain("org/tool");
|
|
207
|
-
|
|
207
|
+
// No version subdirectory in new layout
|
|
208
|
+
expect(path).not.toContain("v1.0.0");
|
|
208
209
|
});
|
|
209
210
|
|
|
210
|
-
test("
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
expect(
|
|
211
|
+
test("returns same path regardless of version", () => {
|
|
212
|
+
const path1 = getToolCachePath("org/tool", "1.0.0");
|
|
213
|
+
const path2 = getToolCachePath("org/tool", "2.0.0");
|
|
214
|
+
expect(path1).toBe(path2);
|
|
214
215
|
});
|
|
215
216
|
});
|
|
216
217
|
|
|
@@ -296,11 +297,11 @@ describe("registry", () => {
|
|
|
296
297
|
|
|
297
298
|
describe("resolveAlias", () => {
|
|
298
299
|
test("resolves existing alias to tool name", () => {
|
|
299
|
-
addToolToRegistry("org/
|
|
300
|
-
addAlias("short", "org/
|
|
300
|
+
addToolToRegistry("org/full-name", "1.0.0", "project", PROJECT_DIR);
|
|
301
|
+
addAlias("short", "org/full-name", "project", PROJECT_DIR);
|
|
301
302
|
|
|
302
303
|
const resolved = resolveAlias("short", "project", PROJECT_DIR);
|
|
303
|
-
expect(resolved).toBe("org/
|
|
304
|
+
expect(resolved).toBe("org/full-name");
|
|
304
305
|
|
|
305
306
|
// Clean up
|
|
306
307
|
rmSync(join(PROJECT_ENACT_DIR, "tools.json"));
|
package/tests/resolver.test.ts
CHANGED
|
@@ -25,7 +25,7 @@ describe("tool resolver", () => {
|
|
|
25
25
|
|
|
26
26
|
// Create a project-level tool
|
|
27
27
|
writeFileSync(
|
|
28
|
-
join(PROJECT_ENACT_DIR, "tools", "test", "project-tool", "
|
|
28
|
+
join(PROJECT_ENACT_DIR, "tools", "test", "project-tool", "skill.yaml"),
|
|
29
29
|
`
|
|
30
30
|
name: test/project-tool
|
|
31
31
|
description: A project-level test tool
|
|
@@ -37,7 +37,7 @@ version: "1.0.0"
|
|
|
37
37
|
// Create a direct tool directory for path-based resolution
|
|
38
38
|
mkdirSync(join(TEST_DIR, "direct-tool"), { recursive: true });
|
|
39
39
|
writeFileSync(
|
|
40
|
-
join(TEST_DIR, "direct-tool", "
|
|
40
|
+
join(TEST_DIR, "direct-tool", "skill.yaml"),
|
|
41
41
|
`
|
|
42
42
|
name: test/direct-tool
|
|
43
43
|
description: A directly referenced tool
|
|
@@ -74,11 +74,11 @@ Documentation here.
|
|
|
74
74
|
describe("utility functions", () => {
|
|
75
75
|
describe("normalizeToolName", () => {
|
|
76
76
|
test("lowercases name", () => {
|
|
77
|
-
expect(normalizeToolName("Acme/
|
|
77
|
+
expect(normalizeToolName("Acme/Greeter")).toBe("acme/greeter");
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
test("converts backslashes to forward slashes", () => {
|
|
81
|
-
expect(normalizeToolName("acme\\
|
|
81
|
+
expect(normalizeToolName("acme\\greeter")).toBe("acme/greeter");
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
test("trims whitespace", () => {
|
|
@@ -88,7 +88,11 @@ Documentation here.
|
|
|
88
88
|
|
|
89
89
|
describe("toolNameToPath", () => {
|
|
90
90
|
test("returns path-like string", () => {
|
|
91
|
-
expect(toolNameToPath("acme/
|
|
91
|
+
expect(toolNameToPath("acme/greeter")).toBe("acme/greeter");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("strips @ prefix for disk paths", () => {
|
|
95
|
+
expect(toolNameToPath("@acme/greeter")).toBe("acme/greeter");
|
|
92
96
|
});
|
|
93
97
|
|
|
94
98
|
test("normalizes backslashes", () => {
|
|
@@ -142,7 +146,7 @@ Documentation here.
|
|
|
142
146
|
});
|
|
143
147
|
|
|
144
148
|
test("resolves tool from manifest file directly", () => {
|
|
145
|
-
const manifestPath = join(TEST_DIR, "direct-tool", "
|
|
149
|
+
const manifestPath = join(TEST_DIR, "direct-tool", "skill.yaml");
|
|
146
150
|
const result = resolveToolFromPath(manifestPath);
|
|
147
151
|
|
|
148
152
|
expect(result.manifest.name).toBe("test/direct-tool");
|
|
@@ -314,7 +318,7 @@ Documentation here.
|
|
|
314
318
|
test("full tool names bypass alias resolution", () => {
|
|
315
319
|
addToolToRegistry("test/project-tool", "1.0.0", "project", PROJECT_DIR);
|
|
316
320
|
// Create an alias that would conflict if checked
|
|
317
|
-
addAlias("test/project-tool", "some/other
|
|
321
|
+
addAlias("test/project-tool", "some/other-tool", "project", PROJECT_DIR);
|
|
318
322
|
|
|
319
323
|
try {
|
|
320
324
|
// Full name with slashes should resolve directly, not via alias
|