@spzhongwin/skill-logger-plugin 1.0.11 → 1.0.13
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/active-skills.js +67 -0
- package/dist/active-skills.test.js +29 -0
- package/dist/config-sync.js +439 -0
- package/dist/config-sync.test.js +145 -0
- package/dist/hooks.js +337 -0
- package/dist/hooks.test.js +123 -0
- package/dist/http.js +54 -0
- package/dist/identity.js +56 -0
- package/dist/index.js +240 -78
- package/dist/index.test.js +39 -0
- package/dist/integration.test.js +102 -0
- package/dist/matcher.js +362 -0
- package/dist/matcher.test.js +139 -0
- package/dist/paths.js +62 -0
- package/dist/paths.test.js +49 -0
- package/dist/reporter.js +267 -0
- package/dist/reporter.test.js +128 -0
- package/dist/semver.js +64 -0
- package/dist/semver.test.js +21 -0
- package/dist/skill-version.js +23 -0
- package/dist/types.js +9 -0
- package/dist/updater.js +352 -0
- package/dist/updater.test.js +212 -0
- package/dist/ws-client.js +484 -0
- package/openclaw.plugin.json +50 -50
- package/package.json +37 -37
- package/src/active-skills.test.ts +32 -32
- package/src/active-skills.ts +77 -77
- package/src/config-sync.test.ts +165 -165
- package/src/config-sync.ts +544 -544
- package/src/hooks.test.ts +251 -251
- package/src/hooks.ts +517 -517
- package/src/http.ts +61 -61
- package/src/identity.ts +64 -64
- package/src/index.test.ts +53 -53
- package/src/index.ts +226 -226
- package/src/integration.test.ts +119 -119
- package/src/matcher.test.ts +170 -170
- package/src/matcher.ts +393 -393
- package/src/paths.test.ts +57 -57
- package/src/paths.ts +84 -84
- package/src/reporter.test.ts +139 -139
- package/src/reporter.ts +298 -298
- package/src/sample-config.json +72 -72
- package/src/semver.test.ts +23 -23
- package/src/semver.ts +60 -60
- package/src/skill-version.ts +53 -53
- package/src/types.ts +198 -198
- package/src/updater.test.ts +325 -237
- package/src/updater.ts +549 -433
- package/src/ws-client.test.ts +48 -37
- package/src/ws-client.ts +717 -642
- package/test-ws.ts +17 -17
- package/tsconfig.json +14 -14
package/src/ws-client.test.ts
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import {
|
|
4
|
-
normalizeAssistantUserId,
|
|
5
|
-
parseAssistantWorkspaceAgentId,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
assert.equal(
|
|
12
|
-
|
|
13
|
-
"assistant-12342325232333223223"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-
|
|
21
|
-
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-
|
|
22
|
-
assert.equal(parseAssistantWorkspaceAgentId("workspace-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
assert.equal(normalizeAssistantUserId("
|
|
28
|
-
assert.equal(normalizeAssistantUserId("assistant-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
assert.equal(normalizeAssistantUserId("
|
|
34
|
-
assert.equal(normalizeAssistantUserId("assistant-
|
|
35
|
-
assert.equal(normalizeAssistantUserId("
|
|
36
|
-
|
|
37
|
-
});
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import {
|
|
4
|
+
normalizeAssistantUserId,
|
|
5
|
+
parseAssistantWorkspaceAgentId,
|
|
6
|
+
shouldSyncBuiltInTemplate,
|
|
7
|
+
} from "./ws-client.ts";
|
|
8
|
+
|
|
9
|
+
describe("assistant workspace naming", () => {
|
|
10
|
+
it("accepts workspace-assistant-* only when suffix is at least 5 digits", () => {
|
|
11
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-12345"), "assistant-12345");
|
|
12
|
+
assert.equal(
|
|
13
|
+
parseAssistantWorkspaceAgentId("workspace-assistant-12342325232333223223"),
|
|
14
|
+
"assistant-12342325232333223223"
|
|
15
|
+
);
|
|
16
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-000001"), "assistant-000001");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("rejects short, non-numeric, and malformed workspace names", () => {
|
|
20
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-1234"), undefined);
|
|
21
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-1234a"), undefined);
|
|
22
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-assistant-abcde"), undefined);
|
|
23
|
+
assert.equal(parseAssistantWorkspaceAgentId("workspace-coder-12345"), undefined);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("normalizes command userId using the same numeric suffix rule", () => {
|
|
27
|
+
assert.equal(normalizeAssistantUserId("12345"), "12345");
|
|
28
|
+
assert.equal(normalizeAssistantUserId("assistant-12345"), "12345");
|
|
29
|
+
assert.equal(normalizeAssistantUserId("assistant-000001"), "000001");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("rejects unsafe or non-conforming command userId values", () => {
|
|
33
|
+
assert.equal(normalizeAssistantUserId("1234"), undefined);
|
|
34
|
+
assert.equal(normalizeAssistantUserId("assistant-1234"), undefined);
|
|
35
|
+
assert.equal(normalizeAssistantUserId("assistant-1234a"), undefined);
|
|
36
|
+
assert.equal(normalizeAssistantUserId("../assistant-12345"), undefined);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe("built-in template update boundary", () => {
|
|
41
|
+
it("only syncs the template for an explicit built-in UPDATE_SKILL command", () => {
|
|
42
|
+
assert.equal(shouldSyncBuiltInTemplate("UPDATE_SKILL", true), true);
|
|
43
|
+
assert.equal(shouldSyncBuiltInTemplate("UPDATE_SKILL", false), false);
|
|
44
|
+
assert.equal(shouldSyncBuiltInTemplate("UPDATE_SKILL", undefined), false);
|
|
45
|
+
assert.equal(shouldSyncBuiltInTemplate("INSTALL_SKILL", true), false);
|
|
46
|
+
assert.equal(shouldSyncBuiltInTemplate("UNINSTALL_SKILL", true), false);
|
|
47
|
+
});
|
|
48
|
+
});
|