@xdxer/dingtalk-agent 0.1.4-beta.9 → 0.1.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/CHANGELOG.md +198 -0
- package/README.en.md +98 -326
- package/README.md +95 -673
- package/dist/bin/dingtalk-agent.js +200 -18
- package/dist/bin/dingtalk-agent.js.map +1 -1
- package/dist/src/agent-audit.js +1014 -89
- package/dist/src/agent-audit.js.map +1 -1
- package/dist/src/agent-enhance.js +41 -8
- package/dist/src/agent-enhance.js.map +1 -1
- package/dist/src/agent-platform.js +299 -0
- package/dist/src/agent-platform.js.map +1 -0
- package/dist/src/config.js +1 -7
- package/dist/src/config.js.map +1 -1
- package/dist/src/development-workspace.js +31 -5
- package/dist/src/development-workspace.js.map +1 -1
- package/dist/src/doctor.js +74 -15
- package/dist/src/doctor.js.map +1 -1
- package/dist/src/host-detect.js +146 -0
- package/dist/src/host-detect.js.map +1 -0
- package/dist/src/instruction-path.js +270 -0
- package/dist/src/instruction-path.js.map +1 -0
- package/dist/src/map.js +157 -0
- package/dist/src/map.js.map +1 -0
- package/dist/src/multica-deploy.js +78 -20
- package/dist/src/multica-deploy.js.map +1 -1
- package/dist/src/multica-provider.js +1 -1
- package/dist/src/multica-provider.js.map +1 -1
- package/dist/src/opencode-evals.js +710 -225
- package/dist/src/opencode-evals.js.map +1 -1
- package/dist/src/opencode-isolation.js +124 -0
- package/dist/src/opencode-isolation.js.map +1 -0
- package/dist/src/opencode-provider.js +1 -0
- package/dist/src/opencode-provider.js.map +1 -1
- package/dist/src/opencode-workspace.js +21 -10
- package/dist/src/opencode-workspace.js.map +1 -1
- package/dist/src/remote-state-evals.js +2 -1
- package/dist/src/remote-state-evals.js.map +1 -1
- package/dist/src/robot-evals.js +2 -1
- package/dist/src/robot-evals.js.map +1 -1
- package/dist/src/setup.js +6 -5
- package/dist/src/setup.js.map +1 -1
- package/dist/src/skill-manager.js +141 -12
- package/dist/src/skill-manager.js.map +1 -1
- package/dist/src/skills.js +2 -1
- package/dist/src/skills.js.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/upgrade.js +23 -27
- package/dist/src/upgrade.js.map +1 -1
- package/dist/src/version.js +73 -0
- package/dist/src/version.js.map +1 -0
- package/docs/INSTALLATION.md +3 -3
- package/docs/assets/agent-delivery-lifecycle.svg +103 -0
- package/docs/schemas/agent-platform.schema.json +13 -0
- package/docs/schemas/project.schema.json +3 -0
- package/docs/schemas/release-readiness.schema.json +2 -1
- package/evals/README.md +17 -0
- package/lab/README.md +3 -3
- package/lab/agent-eval/catalog.json +5 -5
- package/lab/agent-eval/classic-failures.json +9 -9
- package/lab/agent-eval/completion-gate-regression.json +6 -6
- package/lab/agent-eval/remote-state-workspace/opencode.json +1 -1
- package/lab/agent-eval/workspace/AGENTS.md +1 -1
- package/lab/project-workspace/fake-multica-provider.mjs +17 -6
- package/lab/project-workspace/opencode-provider-suite.json +1 -1
- package/lab/robot-eval/suite.json +1 -1
- package/lab/robot-eval/workspace/AGENTS.md +1 -1
- package/lab/schemas/agent-eval-catalog.schema.json +1 -1
- package/package.json +13 -12
- package/skills/README.md +23 -0
- package/skills/core/dingtalk-agent-compose/SKILL.md +151 -0
- package/skills/core/dingtalk-agent-compose/assets/AGENTS.template.md +35 -0
- package/skills/core/dingtalk-agent-compose/assets/role-skill.template.md +32 -0
- package/skills/core/dingtalk-agent-compose/evals/evals.json +129 -0
- package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/references/agent-definition-contract.md +3 -3
- package/skills/core/dingtalk-agent-compose/references/host-loading-contract.md +58 -0
- package/skills/core/dingtalk-agent-compose/references/hosts/claude-code.md +48 -0
- package/skills/core/dingtalk-agent-compose/references/hosts/opencode.md +77 -0
- package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/SKILL.md +31 -7
- package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/assets/eval-catalog.template.json +1 -1
- package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/evals/evals.json +22 -0
- package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/eval-topology.md +14 -0
- package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/evidence-contract.md +21 -0
- package/skills/core/dingtalk-agent-eval/references/failure-to-case.md +35 -0
- package/skills/core/dingtalk-agent-eval/references/interactive-debug-channels.md +93 -0
- package/skills/core/dingtalk-agent-eval/references/local-connector-smoke.md +75 -0
- package/skills/core/dingtalk-basic-behavior/SKILL.md +87 -0
- package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/memory-and-evolution.md +12 -0
- package/skills/core/dingtalk-basic-behavior/references/risk-authority-and-privacy.md +62 -0
- package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/task-lifecycle.md +15 -3
- package/skills/core/dingtalk-basic-behavior/references/truth-and-recovery.md +65 -0
- package/skills/platforms/deap/PLATFORM.md +3 -0
- package/skills/platforms/deap/README.md +3 -0
- package/skills/platforms/multica-dingtalk/PLATFORM.md +40 -0
- package/skills/{dingtalk-agent-boot-multica → platforms/multica-dingtalk/dingtalk-agent-boot-multica}/SKILL.md +4 -4
- package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/SKILL.md +1 -1
- package/skills/platforms/multica-dingtalk/multica-external/SKILL.md +282 -0
- package/skills/platforms/multica-dingtalk/multica-external/scripts/bootstrap.sh +78 -0
- package/skills/platforms/multica-dingtalk/multica-external/scripts/multica_ext.py +1180 -0
- package/skills/dingtalk-agent-compose/SKILL.md +0 -110
- package/skills/dingtalk-agent-compose/assets/AGENTS.template.md +0 -26
- package/skills/dingtalk-agent-compose/assets/role-skill.template.md +0 -24
- package/skills/dingtalk-agent-compose/evals/evals.json +0 -94
- package/skills/dingtalk-agent-compose/references/opencode-host-contract.md +0 -65
- package/skills/dingtalk-basic-behavior/SKILL.md +0 -146
- /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/assets/agent.bindings.dingtalk-doc.template.json +0 -0
- /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/assets/agent.bindings.local.template.json +0 -0
- /package/skills/{dingtalk-agent-compose/assets → core/dingtalk-agent-compose/assets/hosts/opencode}/opencode.template.json +0 -0
- /package/skills/{dingtalk-agent-compose → core/dingtalk-agent-compose}/references/storage-routing.md +0 -0
- /package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/scenario-taxonomy.md +0 -0
- /package/skills/{dingtalk-agent-eval → core/dingtalk-agent-eval}/references/storage-modes.md +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/assets/memory-candidate-proposal.json +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/assets/task-checkpoint.json +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/action-contract.md +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/event-to-behavior.md +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/perception-and-gates.md +0 -0
- /package/skills/{dingtalk-basic-behavior → core/dingtalk-basic-behavior}/references/runtime-modes.md +0 -0
- /package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/references/multica-deployment-contract.md +0 -0
- /package/skills/{dingtalk-agent-deploy → platforms/multica-dingtalk/dingtalk-agent-deploy-multica}/references/promotion-observation-contract.md +0 -0
package/dist/src/map.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Managed Agents Platform(MAP)注册表与工作区归属解析。
|
|
2
|
+
//
|
|
3
|
+
// 一个 Agent 工作区归属于至多一个托管平台;归属解析顺序固定:
|
|
4
|
+
// DTA_MAP 环境变量 > dingtalk-agent.json#map > .dingtalk-agent/map.json > 按 Provider 声明推断。
|
|
5
|
+
// 平台相关的方法学不写进 CLI——它们随对应平台的 Skill 包分发,只在用户选择该平台时安装。
|
|
6
|
+
// 平台命令(如 deploy/promote/observe)必须先通过归属门禁;coming-soon 平台一律 fail-closed。
|
|
7
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { dirname, join, parse, resolve } from 'node:path';
|
|
9
|
+
import { findAgentProjectRoot } from './development-workspace.js';
|
|
10
|
+
import { installGlobalSkill } from './skill-manager.js';
|
|
11
|
+
export const MANAGED_AGENT_PLATFORMS = [
|
|
12
|
+
{
|
|
13
|
+
name: 'multica-dingtalk',
|
|
14
|
+
label: 'Multica (DingTalk)',
|
|
15
|
+
status: 'supported',
|
|
16
|
+
description: '钉钉 Multica 托管平台:受控部署、晋级与观测回流。',
|
|
17
|
+
skills: ['dingtalk-agent-deploy', 'dingtalk-agent-boot-multica'],
|
|
18
|
+
commands: ['deploy', 'promote', 'observe'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'deap',
|
|
22
|
+
label: 'DEAP',
|
|
23
|
+
status: 'coming-soon',
|
|
24
|
+
description: '敬请期待。',
|
|
25
|
+
skills: [],
|
|
26
|
+
commands: [],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
export const MAP_FILE = '.dingtalk-agent/map.json';
|
|
30
|
+
const PROJECT_FILE = 'dingtalk-agent.json';
|
|
31
|
+
export function mapDefinition(name) {
|
|
32
|
+
return MANAGED_AGENT_PLATFORMS.find((item) => item.name === name) || null;
|
|
33
|
+
}
|
|
34
|
+
export function resolveMap(start = process.cwd(), env = process.env) {
|
|
35
|
+
const fromEnv = String(env.DTA_MAP || '').trim();
|
|
36
|
+
if (fromEnv)
|
|
37
|
+
return resolution(fromEnv, 'env', '');
|
|
38
|
+
const projectRoot = findAgentProjectRoot(start);
|
|
39
|
+
if (projectRoot) {
|
|
40
|
+
const manifestPath = join(projectRoot, PROJECT_FILE);
|
|
41
|
+
if (existsSync(manifestPath) && !lstatSync(manifestPath).isSymbolicLink()) {
|
|
42
|
+
const manifest = readJsonOrNull(manifestPath);
|
|
43
|
+
const declared = typeof manifest?.map === 'string' ? manifest.map.trim() : '';
|
|
44
|
+
if (declared)
|
|
45
|
+
return resolution(declared, 'project-manifest', manifestPath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const mapPath = findUp(start, MAP_FILE);
|
|
49
|
+
if (mapPath) {
|
|
50
|
+
const stored = readJsonOrNull(mapPath);
|
|
51
|
+
const declared = typeof stored?.map === 'string' ? stored.map.trim() : '';
|
|
52
|
+
if (declared)
|
|
53
|
+
return resolution(declared, 'map-file', mapPath);
|
|
54
|
+
}
|
|
55
|
+
if (projectRoot) {
|
|
56
|
+
const manifest = readJsonOrNull(join(projectRoot, PROJECT_FILE));
|
|
57
|
+
const providers = Object.values(manifest?.workspaces || {})
|
|
58
|
+
.map((workspace) => workspace?.provider?.kind);
|
|
59
|
+
if (providers.includes('multica')) {
|
|
60
|
+
return resolution('multica-dingtalk', 'inferred', join(projectRoot, PROJECT_FILE));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return resolution(null, 'none', '');
|
|
64
|
+
}
|
|
65
|
+
export function useMap(start, name, options) {
|
|
66
|
+
const definition = mapDefinition(name);
|
|
67
|
+
if (!definition) {
|
|
68
|
+
throw new Error(`未知 managed agents platform: ${name}\n` +
|
|
69
|
+
`可用: ${MANAGED_AGENT_PLATFORMS.map((item) => `${item.name}(${statusLabel(item.status)})`).join('、')}`);
|
|
70
|
+
}
|
|
71
|
+
if (definition.status !== 'supported') {
|
|
72
|
+
throw new Error(`${definition.label} 敬请期待——当前版本尚未开放该平台。`);
|
|
73
|
+
}
|
|
74
|
+
const projectRoot = findAgentProjectRoot(start);
|
|
75
|
+
let written;
|
|
76
|
+
if (projectRoot && existsSync(join(projectRoot, PROJECT_FILE))) {
|
|
77
|
+
const manifestPath = join(projectRoot, PROJECT_FILE);
|
|
78
|
+
if (lstatSync(manifestPath).isSymbolicLink()) {
|
|
79
|
+
throw new Error(`${PROJECT_FILE} 不能是符号链接`);
|
|
80
|
+
}
|
|
81
|
+
const manifest = readJsonOrNull(manifestPath);
|
|
82
|
+
if (!manifest || typeof manifest !== 'object') {
|
|
83
|
+
throw new Error(`${PROJECT_FILE} 不是合法 JSON,无法写入 map 归属`);
|
|
84
|
+
}
|
|
85
|
+
manifest.map = definition.name;
|
|
86
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
|
87
|
+
written = manifestPath;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const target = join(resolve(start), MAP_FILE);
|
|
91
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
92
|
+
writeFileSync(target, JSON.stringify({ $schema: 'dingtalk-agent/map@1', map: definition.name }, null, 2) + '\n');
|
|
93
|
+
written = target;
|
|
94
|
+
}
|
|
95
|
+
const skillInstalls = [];
|
|
96
|
+
if (options.installSkills !== false) {
|
|
97
|
+
for (const skill of definition.skills) {
|
|
98
|
+
skillInstalls.push(installGlobalSkill(options.packageRoot, {
|
|
99
|
+
name: skill, home: options.home, env: options.env,
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { ...resolveMap(start, options.env || process.env), written, skillInstalls };
|
|
104
|
+
}
|
|
105
|
+
/** deploy/promote/observe 等平台命令的归属门禁:未归属、未知或 coming-soon 一律 fail-closed。 */
|
|
106
|
+
export function requireSupportedMap(command, start = process.cwd(), env = process.env) {
|
|
107
|
+
const resolved = resolveMap(start, env);
|
|
108
|
+
if (!resolved.map) {
|
|
109
|
+
throw new Error(`当前工作区未声明 managed agents platform,无法执行 \`${command}\`。\n` +
|
|
110
|
+
'先运行 `dta map use multica-dingtalk`,或设置 DTA_MAP 环境变量。');
|
|
111
|
+
}
|
|
112
|
+
if (!resolved.definition) {
|
|
113
|
+
throw new Error(`工作区声明了未知 platform: ${resolved.map}(来源 ${resolved.source})。\n` +
|
|
114
|
+
`可用: ${MANAGED_AGENT_PLATFORMS.map((item) => item.name).join('、')}`);
|
|
115
|
+
}
|
|
116
|
+
if (resolved.definition.status !== 'supported') {
|
|
117
|
+
throw new Error(`${resolved.definition.label} 敬请期待——\`${command}\` 尚未在该平台开放。`);
|
|
118
|
+
}
|
|
119
|
+
if (!resolved.definition.commands.includes(command)) {
|
|
120
|
+
throw new Error(`${resolved.definition.label} 不承接命令 \`${command}\`。`);
|
|
121
|
+
}
|
|
122
|
+
return resolved;
|
|
123
|
+
}
|
|
124
|
+
export function statusLabel(status) {
|
|
125
|
+
return status === 'supported' ? '已支持' : '敬请期待';
|
|
126
|
+
}
|
|
127
|
+
function resolution(name, source, file) {
|
|
128
|
+
return {
|
|
129
|
+
$schema: 'dingtalk-agent/map-resolution@1',
|
|
130
|
+
map: name,
|
|
131
|
+
source,
|
|
132
|
+
file,
|
|
133
|
+
definition: name ? mapDefinition(name) : null,
|
|
134
|
+
platforms: MANAGED_AGENT_PLATFORMS,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function readJsonOrNull(path) {
|
|
138
|
+
try {
|
|
139
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function findUp(start, relativePath) {
|
|
146
|
+
let dir = resolve(start);
|
|
147
|
+
while (true) {
|
|
148
|
+
const candidate = join(dir, relativePath);
|
|
149
|
+
if (existsSync(candidate) && !lstatSync(candidate).isSymbolicLink())
|
|
150
|
+
return candidate;
|
|
151
|
+
const parent = dirname(dir);
|
|
152
|
+
if (parent === dir || dir === parse(dir).root)
|
|
153
|
+
return null;
|
|
154
|
+
dir = parent;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/map.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,oCAAoC;AACpC,yFAAyF;AACzF,o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K,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAA;AAChD,CAAC;AAED,SAAS,UAAU,CAAC,IAAmB,EAAE,MAAiB,EAAE,IAAY;IACtE,OAAO;QACL,OAAO,EAAE,iCAAiC;QAC1C,GAAG,EAAE,IAAI;QACT,MAAM;QACN,IAAI;QACJ,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QAC7C,SAAS,EAAE,uBAAuB;KACnC,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,IAAI,CAAC;QAAC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAA;IAAC,CAAC;AAC7E,CAAC;AAED,SAAS,MAAM,CAAC,KAAa,EAAE,YAAoB;IACjD,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IACxB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QACzC,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE;YAAE,OAAO,SAAS,CAAA;QACrF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA;QAC1D,GAAG,GAAG,MAAM,CAAA;IACd,CAAC;AACH,CAAC","sourcesContent":["// Managed Agents Platform(MAP)注册表与工作区归属解析。\n//\n// 一个 Agent 工作区归属于至多一个托管平台;归属解析顺序固定:\n// DTA_MAP 环境变量 > dingtalk-agent.json#map > .dingtalk-agent/map.json > 按 Provider 声明推断。\n// 平台相关的方法学不写进 CLI——它们随对应平台的 Skill 包分发,只在用户选择该平台时安装。\n// 平台命令(如 deploy/promote/observe)必须先通过归属门禁;coming-soon 平台一律 fail-closed。\n\nimport { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, join, parse, resolve } from 'node:path'\n\nimport { findAgentProjectRoot } from './development-workspace.js'\nimport { installGlobalSkill, type GlobalSkillStatus } from './skill-manager.js'\n\nexport type MapStatus = 'supported' | 'coming-soon'\n\nexport interface MapDefinition {\n name: string\n label: string\n status: MapStatus\n description: string\n skills: string[]\n commands: string[]\n}\n\nexport const MANAGED_AGENT_PLATFORMS: MapDefinition[] = [\n {\n name: 'multica-dingtalk',\n label: 'Multica (DingTalk)',\n status: 'supported',\n description: '钉钉 Multica 托管平台:受控部署、晋级与观测回流。',\n skills: ['dingtalk-agent-deploy', 'dingtalk-agent-boot-multica'],\n commands: ['deploy', 'promote', 'observe'],\n },\n {\n name: 'deap',\n label: 'DEAP',\n status: 'coming-soon',\n description: '敬请期待。',\n skills: [],\n commands: [],\n },\n]\n\nexport const MAP_FILE = '.dingtalk-agent/map.json'\nconst PROJECT_FILE = 'dingtalk-agent.json'\n\nexport type MapSource = 'env' | 'project-manifest' | 'map-file' | 'inferred' | 'none'\n\nexport interface MapResolution {\n $schema: 'dingtalk-agent/map-resolution@1'\n map: string | null\n source: MapSource\n file: string\n definition: MapDefinition | null\n platforms: MapDefinition[]\n}\n\nexport interface MapUseResult extends MapResolution {\n written: string\n skillInstalls: GlobalSkillStatus[]\n}\n\nexport function mapDefinition(name: string): MapDefinition | null {\n return MANAGED_AGENT_PLATFORMS.find((item) => item.name === name) || null\n}\n\nexport function resolveMap(start = process.cwd(), env: NodeJS.ProcessEnv = process.env): MapResolution {\n const fromEnv = String(env.DTA_MAP || '').trim()\n if (fromEnv) return resolution(fromEnv, 'env', '')\n\n const projectRoot = findAgentProjectRoot(start)\n if (projectRoot) {\n const manifestPath = join(projectRoot, PROJECT_FILE)\n if (existsSync(manifestPath) && !lstatSync(manifestPath).isSymbolicLink()) {\n const manifest = readJsonOrNull(manifestPath)\n const declared = typeof manifest?.map === 'string' ? manifest.map.trim() : ''\n if (declared) return resolution(declared, 'project-manifest', manifestPath)\n }\n }\n\n const mapPath = findUp(start, MAP_FILE)\n if (mapPath) {\n const stored = readJsonOrNull(mapPath)\n const declared = typeof stored?.map === 'string' ? stored.map.trim() : ''\n if (declared) return resolution(declared, 'map-file', mapPath)\n }\n\n if (projectRoot) {\n const manifest = readJsonOrNull(join(projectRoot, PROJECT_FILE))\n const providers = Object.values(manifest?.workspaces || {})\n .map((workspace: any) => workspace?.provider?.kind)\n if (providers.includes('multica')) {\n return resolution('multica-dingtalk', 'inferred', join(projectRoot, PROJECT_FILE))\n }\n }\n\n return resolution(null, 'none', '')\n}\n\nexport interface MapUseOptions {\n packageRoot: string\n home?: string\n env?: NodeJS.ProcessEnv\n installSkills?: boolean\n}\n\nexport function useMap(start: string, name: string, options: MapUseOptions): MapUseResult {\n const definition = mapDefinition(name)\n if (!definition) {\n throw new Error(\n `未知 managed agents platform: ${name}\\n` +\n `可用: ${MANAGED_AGENT_PLATFORMS.map((item) => `${item.name}(${statusLabel(item.status)})`).join('、')}`,\n )\n }\n if (definition.status !== 'supported') {\n throw new Error(`${definition.label} 敬请期待——当前版本尚未开放该平台。`)\n }\n\n const projectRoot = findAgentProjectRoot(start)\n let written: string\n if (projectRoot && existsSync(join(projectRoot, PROJECT_FILE))) {\n const manifestPath = join(projectRoot, PROJECT_FILE)\n if (lstatSync(manifestPath).isSymbolicLink()) {\n throw new Error(`${PROJECT_FILE} 不能是符号链接`)\n }\n const manifest = readJsonOrNull(manifestPath)\n if (!manifest || typeof manifest !== 'object') {\n throw new Error(`${PROJECT_FILE} 不是合法 JSON,无法写入 map 归属`)\n }\n manifest.map = definition.name\n writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\\n')\n written = manifestPath\n } else {\n const target = join(resolve(start), MAP_FILE)\n mkdirSync(dirname(target), { recursive: true })\n writeFileSync(target, JSON.stringify(\n { $schema: 'dingtalk-agent/map@1', map: definition.name }, null, 2,\n ) + '\\n')\n written = target\n }\n\n const skillInstalls: GlobalSkillStatus[] = []\n if (options.installSkills !== false) {\n for (const skill of definition.skills) {\n skillInstalls.push(installGlobalSkill(options.packageRoot, {\n name: skill, home: options.home, env: options.env,\n }))\n }\n }\n\n return { ...resolveMap(start, options.env || process.env), written, skillInstalls }\n}\n\n/** deploy/promote/observe 等平台命令的归属门禁:未归属、未知或 coming-soon 一律 fail-closed。 */\nexport function requireSupportedMap(\n command: string, start = process.cwd(), env: NodeJS.ProcessEnv = process.env,\n): MapResolution {\n const resolved = resolveMap(start, env)\n if (!resolved.map) {\n throw new Error(\n `当前工作区未声明 managed agents platform,无法执行 \\`${command}\\`。\\n` +\n '先运行 `dta map use multica-dingtalk`,或设置 DTA_MAP 环境变量。',\n )\n }\n if (!resolved.definition) {\n throw new Error(\n `工作区声明了未知 platform: ${resolved.map}(来源 ${resolved.source})。\\n` +\n `可用: ${MANAGED_AGENT_PLATFORMS.map((item) => item.name).join('、')}`,\n )\n }\n if (resolved.definition.status !== 'supported') {\n throw new Error(`${resolved.definition.label} 敬请期待——\\`${command}\\` 尚未在该平台开放。`)\n }\n if (!resolved.definition.commands.includes(command)) {\n throw new Error(`${resolved.definition.label} 不承接命令 \\`${command}\\`。`)\n }\n return resolved\n}\n\nexport function statusLabel(status: MapStatus): string {\n return status === 'supported' ? '已支持' : '敬请期待'\n}\n\nfunction resolution(name: string | null, source: MapSource, file: string): MapResolution {\n return {\n $schema: 'dingtalk-agent/map-resolution@1',\n map: name,\n source,\n file,\n definition: name ? mapDefinition(name) : null,\n platforms: MANAGED_AGENT_PLATFORMS,\n }\n}\n\nfunction readJsonOrNull(path: string): any {\n try { return JSON.parse(readFileSync(path, 'utf8')) } catch { return null }\n}\n\nfunction findUp(start: string, relativePath: string): string | null {\n let dir = resolve(start)\n while (true) {\n const candidate = join(dir, relativePath)\n if (existsSync(candidate) && !lstatSync(candidate).isSymbolicLink()) return candidate\n const parent = dirname(dir)\n if (parent === dir || dir === parse(dir).root) return null\n dir = parent\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { WORKSPACE_STATE_ROOT, inspectAgentProject, showDevelopmentWorkspace, }
|
|
|
7
7
|
import { digest, stableStringify } from './events.js';
|
|
8
8
|
import { MULTICA_BOOT_SKILL, MULTICA_EVIDENCE_ROOT, inspectMulticaWorkspace, planMulticaWorkspace, statusMulticaWorkspace, } from './multica-provider.js';
|
|
9
9
|
import { resolvePackageRoot } from './package-root.js';
|
|
10
|
+
import { bundledSkillPath } from './skill-manager.js';
|
|
10
11
|
export const MULTICA_DEPLOYMENT_SCHEMA = 'dingtalk-agent/multica-deployment-receipt@1';
|
|
11
12
|
const MAX_DEPLOY_SKILLS = 32;
|
|
12
13
|
const MAX_SKILL_SUPPORTING_FILES = 128;
|
|
@@ -80,7 +81,7 @@ export function planMulticaDeployment(start, name, options = {}) {
|
|
|
80
81
|
workspaceId: readPlan.expected.workspaceId,
|
|
81
82
|
runtimeId: readPlan.expected.runtimeId,
|
|
82
83
|
agentId: readPlan.expected.agentId,
|
|
83
|
-
agentName: info.project.
|
|
84
|
+
agentName: info.project.displayName,
|
|
84
85
|
skills: expectedSkills,
|
|
85
86
|
definitionHash: source.definitionHash,
|
|
86
87
|
instructionsHash: source.instructionsHash,
|
|
@@ -350,7 +351,7 @@ function loadDeploymentSource(root) {
|
|
|
350
351
|
const packageRoot = resolvePackageRoot(import.meta.url);
|
|
351
352
|
skillRoots.push({
|
|
352
353
|
name: MULTICA_BOOT_SKILL,
|
|
353
|
-
root: safeExternalSkillRoot(
|
|
354
|
+
root: safeExternalSkillRoot(bundledSkillPath(packageRoot, MULTICA_BOOT_SKILL)),
|
|
354
355
|
});
|
|
355
356
|
if (skillRoots.length > MAX_DEPLOY_SKILLS) {
|
|
356
357
|
throw new Error(`Multica deploy 最多支持 ${MAX_DEPLOY_SKILLS} 个受管 Skills`);
|
|
@@ -598,24 +599,20 @@ function readSmoke(root, plan, marker, issueId, agentId, requiredSkills, command
|
|
|
598
599
|
'issue', 'run-messages', taskId, '--issue', issueId, '--output', 'json',
|
|
599
600
|
]), 'smoke.issue.messages', 'read', root, env, timeoutMs, calls).stdout, 'smoke messages');
|
|
600
601
|
const toolUses = messages.filter((item) => optionalString(item.type) === 'tool_use');
|
|
601
|
-
const
|
|
602
|
-
const
|
|
602
|
+
const skillToolUses = toolUses.filter((item) => optionalString(item.tool) === 'skill');
|
|
603
|
+
const skillNames = skillToolUses.map((item) => smokeToolInput(item).name)
|
|
604
|
+
.filter((item) => typeof item === 'string' && Boolean(item)).sort();
|
|
605
|
+
const loadedSkills = requiredSkills.filter((name) => skillNames.includes(name)).sort();
|
|
603
606
|
const texts = messages.filter((item) => optionalString(item.type) === 'text')
|
|
604
607
|
.map((item) => optionalString(item.content)).filter(Boolean);
|
|
605
608
|
const finalText = texts.at(-1) || '';
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
}
|
|
614
|
-
catch {
|
|
615
|
-
responsePassed = false;
|
|
616
|
-
}
|
|
617
|
-
const toolTracePassed = nonSkillTools.length === 0 &&
|
|
618
|
-
stableStringify(loadedSkills) === stableStringify(requiredSkills);
|
|
609
|
+
const matchesResponse = (value) => smokeResponseMatches(value, marker, requiredSkills);
|
|
610
|
+
const replyWrites = toolUses.filter((item) => optionalString(item.tool) === 'write')
|
|
611
|
+
.map((item) => smokeToolInput(item)).filter((input) => optionalString(input.filePath).endsWith('/reply.md'))
|
|
612
|
+
.map((input) => optionalString(input.content)).filter(Boolean);
|
|
613
|
+
const responseEvidence = [...texts, ...replyWrites].find(matchesResponse) || '';
|
|
614
|
+
const responsePassed = Boolean(responseEvidence);
|
|
615
|
+
const toolTracePassed = toolUses.every((item) => allowedSmokeToolUse(item, issueId, marker, requiredSkills)) && stableStringify(skillNames) === stableStringify(requiredSkills);
|
|
619
616
|
const failures = [];
|
|
620
617
|
if (taskStatus !== 'completed')
|
|
621
618
|
failures.push(`smoke.task.${taskStatus || 'unknown'}`);
|
|
@@ -626,9 +623,70 @@ function readSmoke(root, plan, marker, issueId, agentId, requiredSkills, command
|
|
|
626
623
|
return {
|
|
627
624
|
status: failures.length ? 'failed' : 'passed',
|
|
628
625
|
marker, markerHash: sha256(marker), issueId, taskId, taskStatus, requiredSkills, loadedSkills,
|
|
629
|
-
toolTracePassed, responsePassed, responseHash: sha256(finalText), failures,
|
|
626
|
+
toolTracePassed, responsePassed, responseHash: sha256(responseEvidence || finalText), failures,
|
|
630
627
|
};
|
|
631
628
|
}
|
|
629
|
+
function smokeToolInput(item) {
|
|
630
|
+
return item.input && typeof item.input === 'object' && !Array.isArray(item.input)
|
|
631
|
+
? item.input : {};
|
|
632
|
+
}
|
|
633
|
+
function smokeResponseMatches(value, marker, requiredSkills) {
|
|
634
|
+
try {
|
|
635
|
+
const parsed = JSON.parse(value);
|
|
636
|
+
return parsed?.schema === 'dta-multica-load-smoke@1' && parsed?.marker === marker &&
|
|
637
|
+
stableStringify(Array.isArray(parsed?.loaded) ? [...parsed.loaded].sort() : []) ===
|
|
638
|
+
stableStringify(requiredSkills);
|
|
639
|
+
}
|
|
640
|
+
catch {
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
function allowedSmokeToolUse(item, issueId, marker, requiredSkills) {
|
|
645
|
+
const tool = optionalString(item.tool);
|
|
646
|
+
if (tool === 'skill')
|
|
647
|
+
return true;
|
|
648
|
+
const input = smokeToolInput(item);
|
|
649
|
+
if (tool === 'write') {
|
|
650
|
+
return safeSmokeReplyPath(optionalString(input.filePath)) &&
|
|
651
|
+
smokeResponseMatches(optionalString(input.content), marker, requiredSkills);
|
|
652
|
+
}
|
|
653
|
+
if (tool !== 'bash')
|
|
654
|
+
return false;
|
|
655
|
+
const command = optionalString(input.command);
|
|
656
|
+
if (new Set([
|
|
657
|
+
`multica issue get ${issueId} --output json`,
|
|
658
|
+
`multica issue metadata list ${issueId} --output json`,
|
|
659
|
+
`multica issue comment list ${issueId} --recent 10 --output json`,
|
|
660
|
+
`multica issue status ${issueId} in_progress`,
|
|
661
|
+
`multica issue status ${issueId} in_review`,
|
|
662
|
+
]).has(command))
|
|
663
|
+
return true;
|
|
664
|
+
const commentPrefix = `multica issue comment add ${issueId} --content-file `;
|
|
665
|
+
if (command.startsWith(commentPrefix)) {
|
|
666
|
+
return safeSmokeReplyPath(command.slice(commentPrefix.length));
|
|
667
|
+
}
|
|
668
|
+
const cleanupFirstPrefix = 'rm ';
|
|
669
|
+
const cleanupFirstSuffix = ` && multica issue status ${issueId} in_review`;
|
|
670
|
+
if (command.startsWith(cleanupFirstPrefix) && command.endsWith(cleanupFirstSuffix)) {
|
|
671
|
+
return safeSmokeReplyPath(command.slice(cleanupFirstPrefix.length, command.length - cleanupFirstSuffix.length));
|
|
672
|
+
}
|
|
673
|
+
const statusFirstPrefix = `multica issue status ${issueId} in_review && rm `;
|
|
674
|
+
if (command.startsWith(statusFirstPrefix)) {
|
|
675
|
+
return safeSmokeReplyPath(command.slice(statusFirstPrefix.length));
|
|
676
|
+
}
|
|
677
|
+
if (command.startsWith(cleanupFirstPrefix)) {
|
|
678
|
+
return safeSmokeReplyPath(command.slice(cleanupFirstPrefix.length));
|
|
679
|
+
}
|
|
680
|
+
return false;
|
|
681
|
+
}
|
|
682
|
+
function safeSmokeReplyPath(value) {
|
|
683
|
+
if (value === './reply.md')
|
|
684
|
+
return true;
|
|
685
|
+
if (!value.startsWith('/') || !value.endsWith('/reply.md'))
|
|
686
|
+
return false;
|
|
687
|
+
return value.split('/').every((part) => !part ||
|
|
688
|
+
(part !== '.' && part !== '..' && /^[A-Za-z0-9._-]+$/.test(part)));
|
|
689
|
+
}
|
|
632
690
|
function rollbackConfirmed(root, plan, command, env, timeoutMs, calls, rollback, temp) {
|
|
633
691
|
const report = emptyRollback(true);
|
|
634
692
|
const attempt = (id, argv) => {
|
|
@@ -833,7 +891,7 @@ export function statusMulticaDeployment(start, name, options = {}) {
|
|
|
833
891
|
const matched = Boolean(snapshot && remoteMatchesDesired(snapshot, source, operation.runtimeId));
|
|
834
892
|
const safelyBound = Boolean(snapshot?.agent && inspection.passed &&
|
|
835
893
|
snapshot.agent.id === operation.agentId &&
|
|
836
|
-
snapshot.agent.name === info.project.
|
|
894
|
+
snapshot.agent.name === info.project.displayName &&
|
|
837
895
|
snapshot.agent.runtimeId === operation.runtimeId &&
|
|
838
896
|
snapshot.agent.instructions === source.instructions && !snapshot.agent.archived);
|
|
839
897
|
receipt = { ...receipt,
|
|
@@ -934,7 +992,7 @@ function reconcileRemoteTarget(root, name, operation, source, command, env, time
|
|
|
934
992
|
if (candidates.length > 10) {
|
|
935
993
|
return { inspection: discovery, snapshot: null, failures: ['reconcile.agent-candidate-budget'] };
|
|
936
994
|
}
|
|
937
|
-
const projectName = inspectAgentProject(root).project.
|
|
995
|
+
const projectName = inspectAgentProject(root).project.displayName;
|
|
938
996
|
const matches = [];
|
|
939
997
|
for (const [index, candidate] of candidates.entries()) {
|
|
940
998
|
const inspection = inspectMulticaWorkspace(root, name, {
|