@xdxer/dingtalk-agent 0.1.4-beta.2 → 0.1.4-beta.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 +10 -5
- package/dist/bin/dingtalk-agent.js +14 -15
- package/dist/bin/dingtalk-agent.js.map +1 -1
- package/dist/src/setup.js +2 -5
- package/dist/src/setup.js.map +1 -1
- package/dist/src/skill-manager.js +80 -192
- package/dist/src/skill-manager.js.map +1 -1
- package/docs/ARCHITECTURE.md +3 -2
- package/docs/INSTALLATION.md +19 -6
- package/evals/evals.json +11 -11
- package/evals/run-contract-evals.mjs +25 -34
- package/package.json +3 -2
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
readdirSync, cpSync, existsSync, lstatSync, readlinkSync,
|
|
7
7
|
} from 'node:fs'
|
|
8
8
|
import { tmpdir } from 'node:os'
|
|
9
|
-
import { join, dirname } from 'node:path'
|
|
9
|
+
import { join, dirname, resolve } from 'node:path'
|
|
10
10
|
import { fileURLToPath } from 'node:url'
|
|
11
11
|
import { spawnSync } from 'node:child_process'
|
|
12
12
|
import { init } from '../dist/src/init.js'
|
|
@@ -748,8 +748,7 @@ function evalSessionSkillBinding() {
|
|
|
748
748
|
function evalGlobalSkillInstall() {
|
|
749
749
|
const home = mkdtempSync(join(tmpdir(), 'dta-skill-home-'))
|
|
750
750
|
const cwd = mkdtempSync(join(tmpdir(), 'dta-skill-cwd-'))
|
|
751
|
-
|
|
752
|
-
WORKSPACES.push(home, cwd, foreignHome)
|
|
751
|
+
WORKSPACES.push(home, cwd)
|
|
753
752
|
const env = { ...process.env, HOME: home }
|
|
754
753
|
const first = spawnSync(process.execPath, [CLI, 'skill', 'install', '--json'], {
|
|
755
754
|
cwd, env, encoding: 'utf8',
|
|
@@ -761,29 +760,23 @@ function evalGlobalSkillInstall() {
|
|
|
761
760
|
const canonical = join(home, '.agents', 'skills', 'dingtalk-basic-behavior')
|
|
762
761
|
const claude = join(home, '.claude', 'skills', 'dingtalk-basic-behavior')
|
|
763
762
|
|
|
764
|
-
const
|
|
765
|
-
mkdirSync(foreign, { recursive: true })
|
|
766
|
-
writeFileSync(join(foreign, 'SKILL.md'), '---\nname: dingtalk-basic-behavior\ndescription: foreign\n---\n')
|
|
767
|
-
const conflict = spawnSync(process.execPath, [CLI, 'skill', 'install'], {
|
|
768
|
-
cwd, env: { ...process.env, HOME: foreignHome }, encoding: 'utf8',
|
|
769
|
-
})
|
|
763
|
+
const marker = join(canonical, '.dingtalk-agent-install.json')
|
|
770
764
|
return {
|
|
771
765
|
output: {
|
|
772
766
|
firstStatus: first.status, secondStatus: second.status, status,
|
|
773
|
-
claudeTarget: readlinkSync(claude),
|
|
774
|
-
conflictError: conflict.stderr.trim(),
|
|
767
|
+
claudeTarget: readlinkSync(claude), markerExists: existsSync(marker),
|
|
775
768
|
},
|
|
776
769
|
toolCalls: 3, steps: 6,
|
|
777
770
|
checks: [
|
|
778
771
|
check(first.status === 0 && existsSync(join(canonical, 'SKILL.md')),
|
|
779
772
|
`status=${first.status}; canonical=${canonical}`),
|
|
780
|
-
check(second.status === 0 && status.
|
|
781
|
-
status.canonical.
|
|
782
|
-
`status=${second.status};
|
|
773
|
+
check(second.status === 0 && status.manager === 'skills-cli' &&
|
|
774
|
+
status.canonical.current === true && status.operation?.command.includes('skills@latest add'),
|
|
775
|
+
`status=${second.status}; manager=${status.manager}; current=${status.canonical.current}`),
|
|
783
776
|
check(lstatSync(claude).isSymbolicLink() &&
|
|
784
|
-
readlinkSync(claude) ===
|
|
777
|
+
resolve(dirname(claude), readlinkSync(claude)) === resolve(canonical),
|
|
785
778
|
`target=${readlinkSync(claude)}`),
|
|
786
|
-
check(
|
|
779
|
+
check(!existsSync(marker), '上游 skills CLI 接管后不存在 dta 自定义 marker'),
|
|
787
780
|
],
|
|
788
781
|
}
|
|
789
782
|
}
|
|
@@ -879,33 +872,29 @@ function evalManagedSkillLifecycle() {
|
|
|
879
872
|
cwd, env, encoding: 'utf8',
|
|
880
873
|
})
|
|
881
874
|
const modified = JSON.parse(statusRun.stdout)
|
|
882
|
-
const
|
|
883
|
-
cwd, env, encoding: 'utf8',
|
|
884
|
-
})
|
|
885
|
-
const guardedUninstall = spawnSync(process.execPath, [CLI, 'skill', 'uninstall'], {
|
|
875
|
+
const repaired = spawnSync(process.execPath, [CLI, 'skill', 'upgrade', '--json'], {
|
|
886
876
|
cwd, env, encoding: 'utf8',
|
|
887
877
|
})
|
|
888
|
-
const repaired = spawnSync(process.execPath, [
|
|
889
|
-
CLI, 'skill', 'upgrade', '--discard-local-changes', '--json',
|
|
890
|
-
], { cwd, env, encoding: 'utf8' })
|
|
891
878
|
const repairedStatus = JSON.parse(repaired.stdout)
|
|
879
|
+
const repairedBody = readFileSync(file, 'utf8')
|
|
892
880
|
const removed = spawnSync(process.execPath, [CLI, 'skill', 'uninstall', '--json'], {
|
|
893
881
|
cwd, env, encoding: 'utf8',
|
|
894
882
|
})
|
|
895
883
|
const removedStatus = JSON.parse(removed.stdout)
|
|
896
884
|
return {
|
|
897
885
|
output: {
|
|
898
|
-
modified,
|
|
899
|
-
guardedUninstall: guardedUninstall.stderr.trim(), repairedStatus, removedStatus,
|
|
886
|
+
modified, repairedStatus, removedStatus,
|
|
900
887
|
},
|
|
901
|
-
toolCalls:
|
|
888
|
+
toolCalls: 4, steps: 6,
|
|
902
889
|
checks: [
|
|
903
|
-
check(modified.
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
check(
|
|
890
|
+
check(modified.manager === 'skills-cli' && modified.canonical.exists === true,
|
|
891
|
+
JSON.stringify(modified.canonical)),
|
|
892
|
+
check(repaired.status === 0 && !repairedBody.includes('local edit') &&
|
|
893
|
+
repairedStatus.operation?.command.includes('skills@latest add'),
|
|
894
|
+
`status=${repaired.status}; command=${repairedStatus.operation?.command}`),
|
|
895
|
+
check(removed.status === 0 && removedStatus.operation?.command.includes('skills@latest remove'),
|
|
896
|
+
`status=${removed.status}; command=${removedStatus.operation?.command}`),
|
|
897
|
+
check(repairedStatus.canonical.current === true &&
|
|
909
898
|
removed.status === 0 && removedStatus.canonical.exists === false &&
|
|
910
899
|
removedStatus.claude.state === 'missing',
|
|
911
900
|
`repaired=${repairedStatus.canonical.current}; removed=${removedStatus.canonical.exists}; ` +
|
|
@@ -997,6 +986,7 @@ function evalFirstRunSetup() {
|
|
|
997
986
|
const out = run.stdout ? JSON.parse(run.stdout) : null
|
|
998
987
|
const executable = join(home, '.local', 'bin', 'dingtalk-agent')
|
|
999
988
|
const alias = join(home, '.local', 'bin', 'dta')
|
|
989
|
+
const bootstrapAlias = join(home, '.local', 'bin', 'dta-setup')
|
|
1000
990
|
const version = existsSync(executable)
|
|
1001
991
|
? spawnSync(executable, ['--version'], { env, encoding: 'utf8' })
|
|
1002
992
|
: { status: -1, stdout: '' }
|
|
@@ -1015,9 +1005,10 @@ function evalFirstRunSetup() {
|
|
|
1015
1005
|
toolCalls: 1, steps: 6,
|
|
1016
1006
|
checks: [
|
|
1017
1007
|
check(run.status === 0 && existsSync(executable) && version.status === 0 &&
|
|
1018
|
-
existsSync(alias) && aliasVersion.status === 0 &&
|
|
1008
|
+
existsSync(alias) && existsSync(bootstrapAlias) && aliasVersion.status === 0 &&
|
|
1009
|
+
aliasVersion.stdout === version.stdout,
|
|
1019
1010
|
`status=${run.status}; executable=${existsSync(executable)}; alias=${existsSync(alias)}; ` +
|
|
1020
|
-
`version=${version.status}/${aliasVersion.status}`),
|
|
1011
|
+
`bootstrapAlias=${existsSync(bootstrapAlias)}; version=${version.status}/${aliasVersion.status}`),
|
|
1021
1012
|
check(out?.shell.updated === true && rc.includes('dingtalk-agent PATH') &&
|
|
1022
1013
|
rc.includes('$HOME/.local/bin'),
|
|
1023
1014
|
`updated=${out?.shell.updated}; rc=${JSON.stringify(rc)}`),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xdxer/dingtalk-agent",
|
|
3
|
-
"version": "0.1.4-beta.
|
|
3
|
+
"version": "0.1.4-beta.4",
|
|
4
4
|
"description": "钉钉数字员工的 Skill-first 行为范式:全局 Skill 决策,CLI 固定事务边界,Workspace 按需。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dingtalk",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"bin": {
|
|
14
14
|
"dingtalk-agent": "dist/bin/dingtalk-agent.js",
|
|
15
|
-
"dta": "dist/bin/dingtalk-agent.js"
|
|
15
|
+
"dta": "dist/bin/dingtalk-agent.js",
|
|
16
|
+
"dta-setup": "dist/bin/dingtalk-agent.js"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist/bin",
|