@1agents/acp-service 0.9.1 → 0.10.1
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 -1
- package/dist/bin/acp-service.js +1 -1
- package/dist/bin/roles.js +21 -18
- package/dist/src/a2a/executor.d.ts +1 -2
- package/dist/src/a2a/executor.js +24 -57
- package/dist/src/a2a/gateway.d.ts +44 -8
- package/dist/src/a2a/gateway.js +5 -9
- package/dist/src/a2a/result-metadata.js +5 -1
- package/dist/src/a2a/types.d.ts +1 -6
- package/dist/src/a2a/types.js +4 -6
- package/dist/src/catalog-descriptors.js +5 -5
- package/dist/src/catalog.js +8 -1
- package/dist/src/execution/ppt-delivery.d.ts +0 -5
- package/dist/src/execution/ppt-delivery.js +0 -26
- package/dist/src/execution/targets.d.ts +49 -5
- package/dist/src/execution/targets.js +39 -7
- package/dist/src/roles/index.d.ts +1 -1
- package/dist/src/roles/index.js +1 -1
- package/dist/src/roles/skills.d.ts +27 -58
- package/dist/src/roles/skills.js +89 -404
- package/package.json +1 -1
- package/skills/acp-service/SKILL.md +1 -1
- package/skills/acp-service/references/a2a.md +3 -3
- package/skills/acp-service/references/roles-and-tasks.md +9 -9
package/dist/src/roles/skills.js
CHANGED
|
@@ -1,427 +1,112 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Role skills for a working directory. Skills live in `<cwd>/.agents/skills/<name>/` (read by DSH and Codex when a
|
|
3
|
+
* session starts) and are exposed to Claude Code through `<cwd>/.claude/skills`. Nothing here talks to a network
|
|
4
|
+
* catalogue or pins revisions: the directory is used as it is, and acceptance checks are what guard drift.
|
|
5
|
+
* `syncRoleSkills` copies skills, assets included, from a distribution directory when a role is set up.
|
|
6
|
+
*/
|
|
7
|
+
import { cp, lstat, mkdir, readFile, realpath, rename, rm, stat, symlink } from 'node:fs/promises';
|
|
8
|
+
import { randomUUID } from 'node:crypto';
|
|
9
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
5
10
|
import { z } from 'zod';
|
|
6
|
-
const hash = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
7
11
|
const identifier = z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/);
|
|
8
|
-
const
|
|
9
|
-
const absolute = z.string().refine(isAbsolute, 'Expected an absolute path');
|
|
10
|
-
const endpoint = z.string().url().refine(value => {
|
|
11
|
-
const url = new URL(value);
|
|
12
|
-
return ['http:', 'https:'].includes(url.protocol) && !url.username && !url.password && !url.search && !url.hash;
|
|
13
|
-
}, 'Expected an HTTP(S) URL without credentials, query or fragment');
|
|
14
|
-
const resourcePath = z.string().min(1).max(4096).refine(value => !value.includes('\\') && !value.includes('\0')
|
|
15
|
-
&& !value.startsWith('/') && value.split('/').every(segment => segment !== '' && segment !== '.' && segment !== '..'), 'Invalid relative resource path');
|
|
16
|
-
const requirement = z.object({ key: identifier, name: z.string().min(1), nodeUrl: endpoint.optional(),
|
|
17
|
-
skillId: z.string().min(1).optional(), sourceId: z.string().min(1).optional(), assetsManifest: resourcePath.optional() }).strict();
|
|
12
|
+
const requirement = z.object({ key: identifier, name: z.string().min(1) }).strict();
|
|
18
13
|
export const roleSkillProfileSchema = z.object({ id: identifier, version: z.string().min(1), instructionsPath: z.string().min(1).optional(),
|
|
19
|
-
network: z.object({ agentUrl: endpoint, timeoutMs: z.number().int().min(100).max(120000).default(30000) }).strict(),
|
|
20
14
|
skills: z.array(requirement).min(1).max(100), entrySkill: identifier.optional() }).strict().superRefine((value, ctx) => {
|
|
21
15
|
if (new Set(value.skills.map(skill => skill.key)).size !== value.skills.length)
|
|
22
16
|
ctx.addIssue({ code: 'custom', message: 'Duplicate skill key' });
|
|
23
17
|
if (value.entrySkill && !value.skills.some(skill => skill.key === value.entrySkill))
|
|
24
18
|
ctx.addIssue({ code: 'custom', message: 'Unknown entrySkill' });
|
|
25
19
|
});
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
revision: sha, cacheDirectory: absolute, directory: absolute, guidePath: absolute, guideResource: resourcePath,
|
|
30
|
-
files: z.array(inventoryEntry).min(1).max(2000), assets: z.array(assetEntry).max(2000) }).strict();
|
|
31
|
-
export const roleSkillLockSchema = z.object({ schemaVersion: z.literal(1), roleId: identifier, roleVersion: z.string().min(1),
|
|
32
|
-
profilePath: absolute, profileSha256: sha, cacheRoot: absolute, roleDirectory: absolute, createdAt: z.string(),
|
|
33
|
-
instructionsPath: absolute.optional(), instructionsSha256: sha.optional(), instructionsBytes: z.number().int().nonnegative().optional(),
|
|
34
|
-
entrySkill: identifier.optional(), entryGuidePath: absolute.optional(), skills: z.array(lockedSkill).min(1).max(100) }).strict();
|
|
35
|
-
const catalogueEntry = z.object({ id: z.string().min(1), source_id: z.string().min(1), name: z.string().min(1), revision: sha }).passthrough();
|
|
36
|
-
const readResult = z.object({ id: z.string().min(1), source_id: z.string().min(1), name: z.string().min(1), revision: sha,
|
|
37
|
-
resource: resourcePath, content: z.string(), encoding: z.enum(['utf8', 'base64']),
|
|
38
|
-
resources: z.array(z.object({ path: resourcePath, bytes: z.number().int().nonnegative().max(8 * 1024 * 1024) }).passthrough()).max(2000).optional() }).passthrough();
|
|
39
|
-
const receiptSchema = z.object({ schemaVersion: z.literal(1), nodeUrl: endpoint, skillId: z.string().min(1), sourceId: z.string().min(1),
|
|
40
|
-
name: z.string().min(1), revision: sha, guideResource: resourcePath, files: z.array(inventoryEntry).min(1).max(2000) }).strict();
|
|
41
|
-
/** Same content revision as Skill Manager: paths sorted by UTF-8 bytes, then path\0length\0 + file bytes. */
|
|
42
|
-
export function skillContentRevision(files) {
|
|
43
|
-
const result = createHash('sha256');
|
|
44
|
-
for (const file of [...files].sort((a, b) => Buffer.compare(Buffer.from(a.path), Buffer.from(b.path)))) {
|
|
45
|
-
result.update(`${file.path}\0${file.bytes.length}\0`).update(file.bytes);
|
|
46
|
-
}
|
|
47
|
-
return result.digest('hex');
|
|
48
|
-
}
|
|
49
|
-
const inside = (root, path) => { const rel = relative(root, path); return rel === '' || (rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel)); };
|
|
50
|
-
function identity(skill) { return hash(JSON.stringify([skill.nodeUrl, skill.skillId])); }
|
|
51
|
-
function snapshotId(lock) {
|
|
52
|
-
return hash(JSON.stringify({ profile: lock.profileSha256, instructions: lock.instructionsSha256,
|
|
53
|
-
skills: lock.skills.map(skill => [skill.key, skill.nodeUrl, skill.skillId, skill.revision, skill.assets]) }));
|
|
54
|
-
}
|
|
55
|
-
async function exists(path) {
|
|
20
|
+
export const SKILLS_DIRECTORY = '.agents/skills';
|
|
21
|
+
export const CLAUDE_SKILLS_DIRECTORY = '.claude/skills';
|
|
22
|
+
async function lstatOrUndefined(path) {
|
|
56
23
|
try {
|
|
57
|
-
await lstat(path);
|
|
58
|
-
return true;
|
|
24
|
+
return await lstat(path);
|
|
59
25
|
}
|
|
60
26
|
catch (error) {
|
|
61
27
|
if (error.code === 'ENOENT')
|
|
62
|
-
return
|
|
28
|
+
return undefined;
|
|
63
29
|
throw error;
|
|
64
30
|
}
|
|
65
31
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
await
|
|
83
|
-
const info = await
|
|
84
|
-
if (!info
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (const name of
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
async function verifyReceipt(root, directory, expected) {
|
|
109
|
-
const receipt = receiptSchema.parse(JSON.parse((await regularBytes(root, join(directory, 'receipt.json'))).toString('utf8')));
|
|
110
|
-
if (expected && JSON.stringify(receipt) !== JSON.stringify(expected))
|
|
111
|
-
throw new Error('Cached skill receipt differs from locked identity');
|
|
112
|
-
const files = join(directory, 'files');
|
|
113
|
-
await checkParents(root, files);
|
|
114
|
-
const inventory = await listFiles(files);
|
|
115
|
-
if (new Set(receipt.files.map(file => file.path)).size !== receipt.files.length || JSON.stringify(inventory) !== JSON.stringify(receipt.files.map(file => file.path).sort()))
|
|
116
|
-
throw new Error('Cached skill inventory mismatch');
|
|
117
|
-
const content = [];
|
|
118
|
-
for (const file of receipt.files) {
|
|
119
|
-
const bytes = await regularBytes(root, join(files, file.path));
|
|
120
|
-
if (bytes.length !== file.bytes || hash(bytes) !== file.sha256)
|
|
121
|
-
throw new Error('Cached skill byte/hash mismatch');
|
|
122
|
-
content.push({ path: file.path, bytes });
|
|
123
|
-
}
|
|
124
|
-
if (skillContentRevision(content) !== receipt.revision)
|
|
125
|
-
throw new Error('Cached skill content revision mismatch');
|
|
126
|
-
return receipt;
|
|
127
|
-
}
|
|
128
|
-
async function bounded(response, limit) {
|
|
129
|
-
if (!response.ok) {
|
|
130
|
-
await response.body?.cancel();
|
|
131
|
-
throw new Error(`Skill network request failed (HTTP ${response.status})`);
|
|
132
|
-
}
|
|
133
|
-
if (Number(response.headers.get('content-length') ?? 0) > limit) {
|
|
134
|
-
await response.body?.cancel();
|
|
135
|
-
throw new Error('Skill network response exceeds byte limit');
|
|
136
|
-
}
|
|
137
|
-
if (!response.body)
|
|
138
|
-
return Buffer.alloc(0);
|
|
139
|
-
const reader = response.body.getReader(), chunks = [];
|
|
140
|
-
let total = 0;
|
|
141
|
-
try {
|
|
142
|
-
while (true) {
|
|
143
|
-
const chunk = await reader.read();
|
|
144
|
-
if (chunk.done)
|
|
145
|
-
break;
|
|
146
|
-
total += chunk.value.length;
|
|
147
|
-
if (total > limit)
|
|
148
|
-
throw new Error('Skill network response exceeds byte limit');
|
|
149
|
-
chunks.push(chunk.value);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
finally {
|
|
153
|
-
await reader.cancel().catch(() => { });
|
|
154
|
-
}
|
|
155
|
-
return Buffer.concat(chunks);
|
|
156
|
-
}
|
|
157
|
-
function networkUrl(base, suffix, params = {}) {
|
|
158
|
-
const url = new URL(base);
|
|
159
|
-
url.pathname = url.pathname.replace(/\/$/, '') + suffix;
|
|
160
|
-
for (const [key, value] of Object.entries(params))
|
|
161
|
-
url.searchParams.set(key, value);
|
|
162
|
-
return url;
|
|
163
|
-
}
|
|
164
|
-
async function networkJson(url, timeout, signal) {
|
|
165
|
-
const response = await fetch(url, { redirect: 'error', signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeout)]) : AbortSignal.timeout(timeout) });
|
|
166
|
-
return JSON.parse((await bounded(response, 24 * 1024 * 1024)).toString('utf8'));
|
|
167
|
-
}
|
|
168
|
-
async function selectSkill(base, wanted, timeout, signal) {
|
|
169
|
-
let offset = 0;
|
|
170
|
-
const matches = [];
|
|
171
|
-
for (let page = 0; page < 50; page++) {
|
|
172
|
-
const result = z.object({ skills: z.array(catalogueEntry).max(200), has_more: z.boolean().optional(), next_offset: z.number().int().nonnegative().nullable().optional() }).passthrough()
|
|
173
|
-
.parse(await networkJson(networkUrl(base, '/skills', { limit: '200', offset: String(offset) }), timeout, signal));
|
|
174
|
-
for (const skill of result.skills)
|
|
175
|
-
if (skill.name === wanted.name && (!wanted.skillId || wanted.skillId === skill.id) && (!wanted.sourceId || wanted.sourceId === skill.source_id))
|
|
176
|
-
matches.push(skill);
|
|
177
|
-
if (!result.has_more) {
|
|
178
|
-
if (matches.length !== 1)
|
|
179
|
-
throw new Error(matches.length ? `Ambiguous skill: ${wanted.name}; pin sourceId/skillId` : `Required skill unavailable: ${wanted.name}`);
|
|
180
|
-
return matches[0];
|
|
181
|
-
}
|
|
182
|
-
if (result.next_offset == null || result.next_offset <= offset)
|
|
183
|
-
throw new Error('Invalid skill catalogue pagination');
|
|
184
|
-
offset = result.next_offset;
|
|
185
|
-
}
|
|
186
|
-
throw new Error('Skill catalogue exceeds bounded page limit');
|
|
187
|
-
}
|
|
188
|
-
function decoded(result, expectedBytes) {
|
|
189
|
-
if (result.encoding === 'utf8') {
|
|
190
|
-
const bytes = Buffer.from(result.content, 'utf8');
|
|
191
|
-
// Manager's TextDecoder strips one leading UTF-8 BOM. Restore it only when
|
|
192
|
-
// the byte inventory requires exactly those three bytes; the package hash
|
|
193
|
-
// below still has to match the provider's original revision.
|
|
194
|
-
return bytes.length + 3 === expectedBytes ? Buffer.concat([Buffer.from([239, 187, 191]), bytes]) : bytes;
|
|
195
|
-
}
|
|
196
|
-
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(result.content))
|
|
197
|
-
throw new Error('Invalid base64 skill resource');
|
|
198
|
-
return Buffer.from(result.content, 'base64');
|
|
199
|
-
}
|
|
200
|
-
async function installDirectory(temporary, target) {
|
|
201
|
-
try {
|
|
202
|
-
await rename(temporary, target);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
if (!['EEXIST', 'ENOTEMPTY'].includes(error.code ?? ''))
|
|
206
|
-
throw error;
|
|
207
|
-
await rm(temporary, { recursive: true, force: true });
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
async function loadSkill(root, base, wanted, timeout, signal) {
|
|
211
|
-
const chosen = await selectSkill(base, wanted, timeout, signal);
|
|
212
|
-
const parent = join(root, 'skills', identity({ nodeUrl: base, skillId: chosen.id }));
|
|
213
|
-
await checkParents(root, parent, true);
|
|
214
|
-
const directory = join(parent, chosen.revision);
|
|
215
|
-
if (await exists(directory)) {
|
|
216
|
-
const receipt = await verifyReceipt(root, directory);
|
|
217
|
-
if (receipt.nodeUrl !== base || receipt.skillId !== chosen.id || receipt.sourceId !== chosen.source_id || receipt.name !== chosen.name || receipt.revision !== chosen.revision)
|
|
218
|
-
throw new Error('Cached skill catalogue identity mismatch');
|
|
219
|
-
return { directory, receipt };
|
|
220
|
-
}
|
|
221
|
-
const read = async (resource) => {
|
|
222
|
-
const result = readResult.parse(await networkJson(networkUrl(base, `/skills/${encodeURIComponent(chosen.id)}`, { revision: chosen.revision, ...(resource ? { resource } : {}) }), timeout, signal));
|
|
223
|
-
if (result.id !== chosen.id || result.source_id !== chosen.source_id || result.name !== chosen.name || result.revision !== chosen.revision || (resource && result.resource !== resource))
|
|
224
|
-
throw new Error('Skill resource identity/revision mismatch');
|
|
225
|
-
return result;
|
|
226
|
-
};
|
|
227
|
-
const main = await read();
|
|
228
|
-
const resources = main.resources;
|
|
229
|
-
if (!resources?.length || new Set(resources.map(file => file.path)).size !== resources.length || !resources.some(file => file.path === main.resource))
|
|
230
|
-
throw new Error('Invalid skill resource inventory');
|
|
231
|
-
if (resources.reduce((total, file) => total + file.bytes, 0) > 32 * 1024 * 1024)
|
|
232
|
-
throw new Error('Skill package exceeds size limit');
|
|
233
|
-
const temporary = join(parent, `.download-${randomUUID()}`);
|
|
234
|
-
await mkdir(temporary, { mode: 0o700 });
|
|
235
|
-
await mkdir(join(temporary, 'files'));
|
|
236
|
-
try {
|
|
237
|
-
const files = [], contents = [];
|
|
238
|
-
for (const file of resources) {
|
|
239
|
-
const result = file.path === main.resource ? main : await read(file.path);
|
|
240
|
-
const bytes = decoded(result, file.bytes);
|
|
241
|
-
if (bytes.length !== file.bytes)
|
|
242
|
-
throw new Error(`Skill resource size differs from inventory: ${chosen.name}/${file.path}; expected ${file.bytes}, received ${bytes.length}`);
|
|
243
|
-
const path = join(temporary, 'files', file.path);
|
|
244
|
-
await checkParents(root, dirname(path), true);
|
|
245
|
-
await writeFile(path, bytes, { flag: 'wx', mode: 0o600 });
|
|
246
|
-
files.push({ path: file.path, bytes: bytes.length, sha256: hash(bytes) });
|
|
247
|
-
contents.push({ path: file.path, bytes });
|
|
248
|
-
}
|
|
249
|
-
if (skillContentRevision(contents) !== chosen.revision)
|
|
250
|
-
throw new Error('Downloaded skill package revision mismatch');
|
|
251
|
-
const receipt = { schemaVersion: 1, nodeUrl: base, skillId: chosen.id, sourceId: chosen.source_id, name: chosen.name, revision: chosen.revision, guideResource: main.resource, files };
|
|
252
|
-
await writeFile(join(temporary, 'receipt.json'), JSON.stringify(receipt), { mode: 0o600, flag: 'wx' });
|
|
253
|
-
await installDirectory(temporary, directory);
|
|
254
|
-
return { directory, receipt: await verifyReceipt(root, directory, receipt) };
|
|
255
|
-
}
|
|
256
|
-
finally {
|
|
257
|
-
await rm(temporary, { recursive: true, force: true });
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
async function loadAssets(root, directory, wanted, timeout, signal) {
|
|
261
|
-
if (!wanted.assetsManifest)
|
|
262
|
-
return [];
|
|
263
|
-
const manifest = z.object({ assets: z.array(assetEntry).max(2000) }).strict().parse(JSON.parse((await regularBytes(root, join(directory, 'files', wanted.assetsManifest))).toString('utf8')));
|
|
264
|
-
if (new Set(manifest.assets.map(asset => asset.path)).size !== manifest.assets.length)
|
|
265
|
-
throw new Error('Duplicate skill asset path');
|
|
266
|
-
if (manifest.assets.reduce((total, asset) => total + asset.bytes, 0) > 1024 * 1024 * 1024)
|
|
267
|
-
throw new Error('Skill assets exceed size budget');
|
|
268
|
-
for (const asset of manifest.assets) {
|
|
269
|
-
if (await exists(join(directory, 'files', asset.path)))
|
|
270
|
-
throw new Error('Asset path collides with skill resource');
|
|
271
|
-
const parent = join(root, 'assets', asset.sha256);
|
|
272
|
-
await checkParents(root, parent, true);
|
|
273
|
-
const blob = join(parent, 'blob');
|
|
274
|
-
if (!(await exists(blob))) {
|
|
275
|
-
const response = await fetch(asset.url, { redirect: 'error', signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeout)]) : AbortSignal.timeout(timeout) });
|
|
276
|
-
const bytes = await bounded(response, Math.min(asset.bytes + 1, 128 * 1024 * 1024));
|
|
277
|
-
if (bytes.length !== asset.bytes || hash(bytes) !== asset.sha256)
|
|
278
|
-
throw new Error('Downloaded asset byte/hash mismatch');
|
|
279
|
-
const temporary = join(parent, `.download-${randomUUID()}`);
|
|
280
|
-
await writeFile(temporary, bytes, { flag: 'wx', mode: 0o600 });
|
|
281
|
-
try {
|
|
282
|
-
await link(temporary, blob);
|
|
283
|
-
}
|
|
284
|
-
catch (error) {
|
|
285
|
-
if (error.code !== 'EEXIST')
|
|
286
|
-
throw error;
|
|
287
|
-
}
|
|
288
|
-
finally {
|
|
289
|
-
await rm(temporary, { force: true });
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
await verifyFile(root, blob, asset);
|
|
293
|
-
}
|
|
294
|
-
return manifest.assets;
|
|
295
|
-
}
|
|
296
|
-
async function validateLock(trustedRoot, lock) {
|
|
297
|
-
// A migration may preserve the lock's original paths through a root alias.
|
|
298
|
-
// Only that root alias may differ: every descendant keeps the same exact
|
|
299
|
-
// binding and the existing directory/file symlink checks below still apply.
|
|
300
|
-
const root = lock.cacheRoot;
|
|
301
|
-
if (root !== trustedRoot && await realpath(root) !== trustedRoot)
|
|
302
|
-
throw new Error('Role lock cache binding mismatch');
|
|
303
|
-
const roleDirectory = join(root, 'roles', lock.roleId, snapshotId(lock));
|
|
304
|
-
if (lock.roleDirectory !== roleDirectory || new Set(lock.skills.map(skill => skill.key)).size !== lock.skills.length)
|
|
305
|
-
throw new Error('Role lock cache binding mismatch');
|
|
306
|
-
const profileBytes = await regularBytes(root, join(roleDirectory, 'profile.json'));
|
|
307
|
-
if (hash(profileBytes) !== lock.profileSha256)
|
|
308
|
-
throw new Error('Cached role profile byte/hash mismatch');
|
|
309
|
-
const profile = roleSkillProfileSchema.parse(JSON.parse(profileBytes.toString('utf8')));
|
|
310
|
-
if (profile.id !== lock.roleId || profile.version !== lock.roleVersion || profile.entrySkill !== lock.entrySkill
|
|
311
|
-
|| Boolean(profile.instructionsPath) !== Boolean(lock.instructionsPath) || profile.skills.length !== lock.skills.length)
|
|
312
|
-
throw new Error('Role lock profile binding mismatch');
|
|
313
|
-
for (const skill of lock.skills) {
|
|
314
|
-
const wanted = profile.skills.find(wanted => wanted.key === skill.key);
|
|
315
|
-
if (!wanted || wanted.name !== skill.name || (wanted.skillId && wanted.skillId !== skill.skillId)
|
|
316
|
-
|| (wanted.sourceId && wanted.sourceId !== skill.sourceId) || (wanted.nodeUrl ?? profile.network.agentUrl) !== skill.nodeUrl)
|
|
317
|
-
throw new Error('Role lock skill requirement mismatch');
|
|
318
|
-
const directory = join(root, 'skills', identity(skill), skill.revision), materialized = join(roleDirectory, 'skills', skill.key);
|
|
319
|
-
if (skill.cacheDirectory !== directory || skill.directory !== materialized || skill.guidePath !== join(materialized, skill.guideResource))
|
|
320
|
-
throw new Error('Role lock skill path mismatch');
|
|
321
|
-
const receipt = { schemaVersion: 1, nodeUrl: skill.nodeUrl, skillId: skill.skillId, sourceId: skill.sourceId, name: skill.name, revision: skill.revision, guideResource: skill.guideResource, files: skill.files };
|
|
322
|
-
await verifyReceipt(root, directory, receipt);
|
|
323
|
-
if (JSON.stringify((await listFiles(materialized)).sort()) !== JSON.stringify([...skill.files, ...skill.assets].map(file => file.path).sort()))
|
|
324
|
-
throw new Error('Materialized skill inventory mismatch');
|
|
325
|
-
for (const file of skill.files)
|
|
326
|
-
await verifyFile(root, join(materialized, file.path), file);
|
|
327
|
-
for (const asset of skill.assets) {
|
|
328
|
-
await verifyFile(root, join(root, 'assets', asset.sha256, 'blob'), asset);
|
|
329
|
-
await verifyFile(root, join(materialized, asset.path), asset);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
if (lock.instructionsPath) {
|
|
333
|
-
if (lock.instructionsPath !== join(roleDirectory, 'ROLE.md') || !lock.instructionsSha256 || lock.instructionsBytes === undefined)
|
|
334
|
-
throw new Error('Role instruction binding mismatch');
|
|
335
|
-
await verifyFile(root, lock.instructionsPath, { bytes: lock.instructionsBytes, sha256: lock.instructionsSha256 });
|
|
336
|
-
}
|
|
337
|
-
if (lock.entrySkill && lock.entryGuidePath !== lock.skills.find(skill => skill.key === lock.entrySkill)?.guidePath)
|
|
338
|
-
throw new Error('Role entry skill binding mismatch');
|
|
339
|
-
const snapshotFiles = lock.skills.flatMap(skill => [...skill.files, ...skill.assets].map(file => `skills/${skill.key}/${file.path}`))
|
|
340
|
-
.concat('profile.json', ...(lock.instructionsPath ? ['ROLE.md'] : [])).sort();
|
|
341
|
-
if (JSON.stringify(await listFiles(roleDirectory)) !== JSON.stringify(snapshotFiles))
|
|
342
|
-
throw new Error('Role snapshot inventory mismatch');
|
|
343
|
-
return lock;
|
|
344
|
-
}
|
|
345
|
-
/** New lock => latest catalogue revisions; existing lock => checked, fully offline reuse even if the source/profile changed. */
|
|
346
|
-
export async function resolveRoleSkills(options) {
|
|
347
|
-
const cache = resolve(options.cacheRoot);
|
|
348
|
-
await mkdir(cache, { recursive: true, mode: 0o700 });
|
|
349
|
-
const root = await realpath(cache);
|
|
350
|
-
const lockPath = resolve(options.lockPath), profilePath = resolve(options.profilePath);
|
|
351
|
-
if (await exists(lockPath)) {
|
|
352
|
-
const info = await lstat(lockPath);
|
|
353
|
-
if (!info.isFile() || info.isSymbolicLink())
|
|
354
|
-
throw new Error('Role lock is not a regular file');
|
|
355
|
-
const lock = roleSkillLockSchema.parse(JSON.parse(await readFile(lockPath, 'utf8')));
|
|
356
|
-
if (lock.profilePath !== profilePath && await realpath(lock.profilePath) !== await realpath(profilePath))
|
|
357
|
-
throw new Error('Role lock belongs to another profile');
|
|
358
|
-
return validateLock(root, lock);
|
|
359
|
-
}
|
|
360
|
-
options.signal?.throwIfAborted();
|
|
361
|
-
const bytes = await readFile(profilePath), profile = roleSkillProfileSchema.parse(JSON.parse(bytes.toString('utf8')));
|
|
362
|
-
const instructions = profile.instructionsPath ? await readFile(resolve(dirname(profilePath), profile.instructionsPath)) : undefined;
|
|
363
|
-
const lock = { schemaVersion: 1, roleId: profile.id, roleVersion: profile.version, profilePath,
|
|
364
|
-
profileSha256: hash(bytes), cacheRoot: root, roleDirectory: root, createdAt: new Date().toISOString(),
|
|
365
|
-
...(instructions ? { instructionsSha256: hash(instructions), instructionsBytes: instructions.length } : {}),
|
|
366
|
-
...(profile.entrySkill ? { entrySkill: profile.entrySkill } : {}), skills: [] };
|
|
32
|
+
/** A skill name becomes a directory name under `.agents/skills`, so it must not be able to leave it. */
|
|
33
|
+
async function readProfile(profilePath) {
|
|
34
|
+
const profile = roleSkillProfileSchema.parse(JSON.parse(await readFile(profilePath, 'utf8')));
|
|
35
|
+
for (const skill of profile.skills)
|
|
36
|
+
if (!identifier.safeParse(skill.name).success)
|
|
37
|
+
throw new Error(`Unsafe skill name: ${skill.name.slice(0, 64)}`);
|
|
38
|
+
return profile;
|
|
39
|
+
}
|
|
40
|
+
function frontMatterName(text) {
|
|
41
|
+
const block = /^?---\r?\n([\s\S]*?)\r?\n---/.exec(text)?.[1];
|
|
42
|
+
const line = block?.split(/\r?\n/).find(item => /^name\s*:/.test(item));
|
|
43
|
+
return line?.replace(/^name\s*:\s*/, '').trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
44
|
+
}
|
|
45
|
+
/** Make `.claude/skills` reach `.agents/skills`. An existing real `.claude/skills` directory only gains links for the named skills. */
|
|
46
|
+
export async function linkClaudeSkills(cwd, names) {
|
|
47
|
+
const source = join(cwd, SKILLS_DIRECTORY), link = join(cwd, CLAUDE_SKILLS_DIRECTORY);
|
|
48
|
+
await mkdir(dirname(link), { recursive: true });
|
|
49
|
+
const info = await lstatOrUndefined(link);
|
|
50
|
+
if (!info) {
|
|
51
|
+
await symlink(relative(dirname(link), source), link, 'dir');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (info.isSymbolicLink()) {
|
|
55
|
+
if (await realpath(link).catch(() => undefined) !== await realpath(source))
|
|
56
|
+
throw new Error(`${CLAUDE_SKILLS_DIRECTORY} is a link to somewhere other than ${SKILLS_DIRECTORY}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!info.isDirectory())
|
|
60
|
+
throw new Error(`${CLAUDE_SKILLS_DIRECTORY} is not a directory`);
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
const entry = join(link, name);
|
|
63
|
+
if (await lstatOrUndefined(entry))
|
|
64
|
+
continue;
|
|
65
|
+
await symlink(relative(link, join(source, name)), entry, 'dir');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Check that every skill the profile names is present under `<cwd>/.agents/skills`, link it for Claude Code and return what the prompt needs. */
|
|
69
|
+
export async function loadRoleSkills(options) {
|
|
70
|
+
const profilePath = resolve(options.profilePath), cwd = resolve(options.cwd), profile = await readProfile(profilePath);
|
|
71
|
+
const instructions = profile.instructionsPath ? await readFile(resolve(dirname(profilePath), profile.instructionsPath), 'utf8') : '';
|
|
72
|
+
const skills = [];
|
|
367
73
|
for (const wanted of profile.skills) {
|
|
368
|
-
const
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
await
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
74
|
+
const directory = join(cwd, SKILLS_DIRECTORY, wanted.name), guidePath = join(directory, 'SKILL.md');
|
|
75
|
+
const info = await stat(guidePath).catch(() => undefined);
|
|
76
|
+
if (!info?.isFile())
|
|
77
|
+
throw new Error(`Required skill unavailable in ${cwd}: ${wanted.name}`);
|
|
78
|
+
const declared = frontMatterName(await readFile(guidePath, 'utf8'));
|
|
79
|
+
if (declared !== undefined && declared !== wanted.name)
|
|
80
|
+
throw new Error(`Skill directory ${wanted.name} declares name ${declared}`);
|
|
81
|
+
skills.push({ key: wanted.key, name: wanted.name, directory, guidePath });
|
|
82
|
+
}
|
|
83
|
+
await linkClaudeSkills(cwd, skills.map(skill => skill.name));
|
|
84
|
+
const entry = profile.entrySkill ? skills.find(skill => skill.key === profile.entrySkill) : undefined;
|
|
85
|
+
return { roleId: profile.id, roleVersion: profile.version, roleDirectory: dirname(profilePath), instructions,
|
|
86
|
+
...(entry ? { entryGuidePath: entry.guidePath } : {}), skills };
|
|
87
|
+
}
|
|
88
|
+
/** Copy the profile's skills from a distribution directory into `<cwd>/.agents/skills`, then verify and link them. No network, no model. */
|
|
89
|
+
export async function syncRoleSkills(options) {
|
|
90
|
+
const profile = await readProfile(resolve(options.profilePath)), cwd = resolve(options.cwd), source = resolve(options.source);
|
|
91
|
+
const target = join(cwd, SKILLS_DIRECTORY);
|
|
92
|
+
await mkdir(target, { recursive: true });
|
|
93
|
+
for (const wanted of profile.skills) {
|
|
94
|
+
const from = join(source, wanted.name);
|
|
95
|
+
if (!(await stat(join(from, 'SKILL.md')).catch(() => undefined))?.isFile())
|
|
96
|
+
throw new Error(`Skill not found in source: ${wanted.name}`);
|
|
97
|
+
const destination = join(target, wanted.name);
|
|
98
|
+
// Skip a skill that is already this very directory (for instance when source and target are the same place).
|
|
99
|
+
if (await realpath(destination).catch(() => undefined) === await realpath(from))
|
|
100
|
+
continue;
|
|
101
|
+
const staging = join(target, `.sync-${randomUUID()}`);
|
|
388
102
|
try {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
await checkParents(root, dirname(path), true);
|
|
393
|
-
const source = skill.files.includes(file) ? join(skill.cacheDirectory, 'files', file.path) : join(root, 'assets', file.sha256, 'blob');
|
|
394
|
-
await copyFile(source, path);
|
|
395
|
-
}
|
|
396
|
-
await writeFile(join(temporary, 'profile.json'), bytes, { mode: 0o600 });
|
|
397
|
-
if (instructions)
|
|
398
|
-
await writeFile(join(temporary, 'ROLE.md'), instructions, { mode: 0o600 });
|
|
399
|
-
await installDirectory(temporary, lock.roleDirectory);
|
|
103
|
+
await cp(from, staging, { recursive: true, dereference: true });
|
|
104
|
+
await rm(destination, { recursive: true, force: true });
|
|
105
|
+
await rename(staging, destination);
|
|
400
106
|
}
|
|
401
107
|
finally {
|
|
402
|
-
await rm(
|
|
108
|
+
await rm(staging, { recursive: true, force: true });
|
|
403
109
|
}
|
|
404
110
|
}
|
|
405
|
-
|
|
406
|
-
options.signal?.throwIfAborted();
|
|
407
|
-
await mkdir(dirname(lockPath), { recursive: true, mode: 0o700 });
|
|
408
|
-
const temporary = join(dirname(lockPath), `.role-lock-${randomUUID()}`);
|
|
409
|
-
await writeFile(temporary, JSON.stringify(lock, null, 2) + '\n', { flag: 'wx', mode: 0o600 });
|
|
410
|
-
try {
|
|
411
|
-
await link(temporary, lockPath);
|
|
412
|
-
}
|
|
413
|
-
catch (error) {
|
|
414
|
-
if (error.code !== 'EEXIST')
|
|
415
|
-
throw error;
|
|
416
|
-
}
|
|
417
|
-
finally {
|
|
418
|
-
await rm(temporary, { force: true });
|
|
419
|
-
}
|
|
420
|
-
const storedInfo = await lstat(lockPath);
|
|
421
|
-
if (!storedInfo.isFile() || storedInfo.isSymbolicLink())
|
|
422
|
-
throw new Error('Role lock is not a regular file');
|
|
423
|
-
const stored = roleSkillLockSchema.parse(JSON.parse(await readFile(lockPath, 'utf8')));
|
|
424
|
-
if (stored.profilePath !== profilePath)
|
|
425
|
-
throw new Error('Concurrent role lock belongs to another profile');
|
|
426
|
-
return validateLock(root, stored);
|
|
111
|
+
return loadRoleSkills({ profilePath: options.profilePath, cwd });
|
|
427
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agents/acp-service",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "agent-workflow ACP runtime, CLI, HTTP/WebSocket service and DeepSeek Harness ACP/A2A plugins in one package. Part of 一芥天地 (DreamMate World).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dreammate",
|
|
@@ -55,7 +55,7 @@ acp-service --skill install acp-service --agent codex --scope repo
|
|
|
55
55
|
|
|
56
56
|
## 异步调用纪律
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
常驻角色的技能放在其工作目录的 `.agents/skills/`(Claude Code 经 `.claude/skills` 软链读取),由 DSH、Codex 或 Claude Code 在会话开始时自行加载;宿主只在第一条消息前加角色说明和技能指南路径。不再有技能锁,续派读目录当前内容。技能的复制与更新在派单前的独立阶段用 `acp-service roles sync` 完成,详见项目 `.1agents/README.md`。
|
|
59
59
|
|
|
60
60
|
开发、部署与回归先独立完成。所有任务提交并保存回执后必须立即结束本轮;只有实际通知唤醒后才单次读取回执、记录结论、ack 并答复。禁止主会话主动轮询 get/list/inbox、sleep/wait 等完成、读取子会话日志/进程,或重复文件/hash/图像/事实验收。用户明确要求单次查询/取消时只执行该动作;受理未知不自动重派。此纪律限定主会话调用,不关闭后台网关的状态核对能力。
|
|
61
61
|
|
|
@@ -85,9 +85,9 @@ DreamMate 调用参数为 `service_id: "a2a-gateway"`、`method: 方法名`、`p
|
|
|
85
85
|
| 方法 | 参数与用途 |
|
|
86
86
|
| --- | --- |
|
|
87
87
|
| `remote_agent_preflight` | `remote, originSessionId, cwd`;可选任务目录、必需输入和运行时依赖,仅检查、不创建会话 |
|
|
88
|
-
| `remote_agent_spawn` | 必填 `remote, originSessionId, cwd, prompt`;可选 `agentPreset, title, notificationTarget, preflight, resultContract, clientRequestId, roleId,
|
|
88
|
+
| `remote_agent_spawn` | 必填 `remote, originSessionId, cwd, prompt`;可选 `agentPreset, title, notificationTarget, preflight, resultContract, clientRequestId, roleId, lifecycle, provider, model`;新建远端任务/上下文/DSH 会话。省略 `lifecycle` 为 one-shot(2026-10-31 起)。`provider`、`model` 见下文「standard 选模型」 |
|
|
89
89
|
| `remote_agent_get` | `remote, originSessionId, taskId`;当前状态、结果;离线返回缓存与 stale。进程名额排队时仍是 submitted,并带 `capacity`、`taskSlot` 和 `processSlot`。指定过模型的 `standard` 任务带实际使用的 `provider`、`model` |
|
|
90
|
-
| `remote_agent_message` | 上述任务定位字段加 `prompt`;可选 `clientRequestId, preflight, resultContract, roleId,
|
|
90
|
+
| `remote_agent_message` | 上述任务定位字段加 `prompt`;可选 `clientRequestId, preflight, resultContract, roleId, autoResume, lifecycle, provider, model`;复用远端会话,创建新 taskId;已有角色不能更换。已关闭会话默认接回,get 返回 `resumed: true`。`historyReplayed` 只说明宿主有没有把历史重新推给它的客户端(`session/load` 推,导入会话的 `session/resume` 不推),两者都是同一种接回。`autoResume: false` 不向远端发送,返回 `SESSION_CLOSED` |
|
|
91
91
|
| `remote_agent_cancel` | 任务定位字段;只取消这项任务自己的执行,不能释放已经完成的会话进程 |
|
|
92
92
|
| `remote_agent_close` | `remote, originSessionId`,以及 `taskId`、`contextId`、`sessionId` 三选一;可选 `force`。普通关闭 ACP 进程,保留会话记录和绑定,不删除。进行中返回 `SESSION_BUSY`;`force: true` 先取消再关闭。宿主没有关闭能力时返回 `UNSUPPORTED`,且不把任务记成已关闭。`standard` 不发送 `session/close`。可选 `mode: "delete"` 还删除 ACP 会话记录,之后 message 返回 `SESSION_DELETED`;仅在网关 `sessionLifecycle.allowDelete: true` 时接受,否则返回 `DELETE_DISABLED`。不删 DSH 会话历史 |
|
|
93
93
|
| `remote_agent_sessions` | 无业务参数。按 `prewarm`、`job`、`user-opened` 和未标注列进程租约,并给出两本账。只读,不关闭,也不给已经在跑且没有来源的进程补标签 |
|
|
@@ -195,7 +195,7 @@ notice 继续保留在 inbox;主 Agent 真正处理结果后才调用 `remote_
|
|
|
195
195
|
|
|
196
196
|
响应在 `result.task`,包含 `id`、`contextId` 和已有的 `metadata.1agents.sessionId/cwd/agentPreset`。`returnImmediately: true` 返回受理任务;配置网络角色的冷下载和会话准备可在受理后进行,首回执可能尚无 sessionId。普通无角色任务保持会话准备后返回的时序;省略则默认等待终态或需要输入状态。
|
|
197
197
|
|
|
198
|
-
`metadata.1agents` 的调用输入支持 `cwd/workspace/agentPreset/preflight/resultContract/roleId
|
|
198
|
+
`metadata.1agents` 的调用输入支持 `cwd/workspace/agentPreset/preflight/resultContract/roleId`。cwd 和 workspace 不可同时传,cwd 为远端现有绝对目录,workspace 为配置别名;省略位置与预设按远端默认值处理。roleId 必须在宿主可信映射中,角色技能从会话 cwd 的 `.agents/skills` 读取。
|
|
199
199
|
|
|
200
200
|
同一会话的新任务在 `message.contextId` 传已保存 context ID;保存的 cwd/preset 不能改变。已完成 task 不可重新打开。原 task 为 input-required 时可传 `message.taskId`,配合新的 `messageId` 继续;活跃 task 上的 follow-up 被拒绝。
|
|
201
201
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# 角色管理、固定角色调用与临时任务
|
|
2
2
|
|
|
3
|
-
这是统一 API 技能的任务路由。`resident-agent`
|
|
3
|
+
这是统一 API 技能的任务路由。`resident-agent` 若已安装,用于创建和维护专职角色;本技能负责实际接口调用。领域方法仍由角色引用的技能负责。创建角色是管理阶段,日常调用不重复创建或部署角色。
|
|
4
4
|
|
|
5
5
|
## 三种工作
|
|
6
6
|
|
|
7
7
|
| 请求 | 操作 | 所需信息 |
|
|
8
8
|
| --- | --- | --- |
|
|
9
|
-
| 创建固定角色 | 配置角色与宿主,再登记 resident_agent 目标 |
|
|
9
|
+
| 创建固定角色 | 配置角色与宿主,再登记 resident_agent 目标 | 职责、技能分发目录、预设、工作根目录及交付约定 |
|
|
10
10
|
| 调用固定角色 | `execution_submit` 到已有 resident_agent target | targetId、完整任务要求;cwd/preset/role 由目标固定 |
|
|
11
11
|
| 一次性临时任务 | `execution_submit` 到已有 agent_host target | targetId、执行端 cwd、preset、完整任务要求;无需创建角色 |
|
|
12
12
|
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
## 创建与更新角色(管理阶段)
|
|
33
33
|
|
|
34
|
-
1.
|
|
35
|
-
2. 创建薄 `ROLE.md`
|
|
36
|
-
3. 在执行宿主 `a2a.roleSkills` 配置可信的 `
|
|
34
|
+
1. 复用当前网关、宿主及认证配置,明确职责、工具权限、读写目录、输入和交付。技能名即工作目录 `.agents/skills/<name>` 的目录名;能力网络或分发目录只是来源,发现结果不等于已放进工作目录。
|
|
35
|
+
2. 创建薄 `ROLE.md` 与角色 profile。profile 字段为 `id/version/instructionsPath/skills/entrySkill`;skills 每项包含 `key/name`,`name` 即 `.agents/skills/<name>` 目录名,profile 不允许其他字段。不要把登记清单误当原生 profile,也不要把领域脚本和模板写入 persona。源码示例见工程 `.1agents/roles/ppt-beautifier`;项目运行数据统一放在 `./.1agents/`。
|
|
36
|
+
3. 在执行宿主 `a2a.roleSkills` 配置可信的 `profiles: {逻辑roleId:绝对profile路径}`;可选 `presetRoles` 仅为专用 preset 自动绑定。通用 preset 不隐式改成某领域角色。DSH/Codex 共用宿主加载入口;运行依赖和工具仍由宿主管理。
|
|
37
37
|
4. 有专用预设时安装/更新该预设;也可使用已可用的通用预设配合目标绑定的 roleId。凭据只在受保护宿主/网关配置。需要重载共享宿主时先确认没有运行中会话。
|
|
38
38
|
5. 复用已登记 connection,通过可信本机管理入口登记或更新 resident_agent target。最小登记参数如下,值均需替换为真实部署值:
|
|
39
39
|
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"cwd": "/absolute/existing/role-workspace",
|
|
48
48
|
"agentPreset": "installed-preset",
|
|
49
49
|
"roleId": "host-configured-role-id",
|
|
50
|
-
"
|
|
50
|
+
"loadRole": true
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
`execution_target_update` 参数是 `targetId/expectedConfigVersion?/patch`;`patch.binding` 按整体替换,保留未改的 cwd/preset/role/目录限制。目标管理方法只开放可信本机管理入口,不能当远端公开任务 API。
|
|
56
56
|
|
|
57
|
-
6.
|
|
57
|
+
6. 在管理阶段用 `acp-service roles sync` 把技能(含资源)放进工作目录,或用 `roles check` 核验,并核验宿主配置;只有用户授权实际试单时才测试模型执行和通知闭环。HTTP 200、目标已登记或 preset 可见仅证明对应管理步骤。
|
|
58
58
|
|
|
59
|
-
目录约定:角色定义为 `.1agents/roles/<role
|
|
59
|
+
目录约定:角色定义为 `.1agents/roles/<role>`,角色技能在其工作目录的 `.agents/skills`(`.claude/skills` 软链过去),角色 bundle/工作目录/产物/状态为 `.1agents/runtime/<role>`,项目网关账本与通知为 `.1agents/state/a2a-gateway`;私密配置在 `.1agents/config`,不提交 Git。
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
技能放进角色的工作目录:`acp-service roles sync --profile PROFILE --cwd 工作目录 --source 分发目录` 把 profile 点名的技能(含大文件资源)从分发目录复制到 `工作目录/.agents/skills/`,并把 `工作目录/.claude/skills` 软链到它;`roles check` 只核验与补链。DSH、Codex 在会话开始时读 `.agents/skills`,Claude Code 读 `.claude/skills`。技能不再经能力网络下载、不再锁定版本,新旧任务和续派都读目录当前内容;漂移由验收规则兜底。Skill Manager 只作分发源数据。
|
|
62
62
|
|
|
63
63
|
## 调用固定角色
|
|
64
64
|
|