@1agents/acp-service 0.9.1 → 0.10.0

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.
@@ -38,7 +38,7 @@ export declare const executionTargetBindingSchema: z.ZodObject<{
38
38
  agentPreset: z.ZodOptional<z.ZodString>;
39
39
  roleId: z.ZodOptional<z.ZodString>;
40
40
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
41
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
42
42
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
43
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
44
  flowId: z.ZodOptional<z.ZodString>;
@@ -73,7 +73,7 @@ export declare const executionTargetConfigSchema: z.ZodObject<{
73
73
  agentPreset: z.ZodOptional<z.ZodString>;
74
74
  roleId: z.ZodOptional<z.ZodString>;
75
75
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
76
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
77
77
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
78
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
79
  flowId: z.ZodOptional<z.ZodString>;
@@ -109,7 +109,7 @@ export declare const executionTargetSchema: z.ZodObject<{
109
109
  agentPreset: z.ZodOptional<z.ZodString>;
110
110
  roleId: z.ZodOptional<z.ZodString>;
111
111
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
112
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
113
113
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
114
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
115
  flowId: z.ZodOptional<z.ZodString>;
@@ -156,6 +156,8 @@ export declare const targetHealthSchema: z.ZodObject<{
156
156
  }>>;
157
157
  }, z.core.$strict>;
158
158
  export type TargetHealth = z.output<typeof targetHealthSchema>;
159
+ /** The preset a fixed role runs on when its binding names none. */
160
+ export declare const DEFAULT_RESIDENT_PRESET = "standard";
159
161
  export declare const TARGET_METHODS: {
160
162
  execution_connection_list: {
161
163
  description: string;
@@ -248,7 +250,7 @@ export declare const TARGET_METHODS: {
248
250
  agentPreset: z.ZodOptional<z.ZodString>;
249
251
  roleId: z.ZodOptional<z.ZodString>;
250
252
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
251
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
253
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
252
254
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
253
255
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
256
  flowId: z.ZodOptional<z.ZodString>;
@@ -289,7 +291,7 @@ export declare const TARGET_METHODS: {
289
291
  agentPreset: z.ZodOptional<z.ZodString>;
290
292
  roleId: z.ZodOptional<z.ZodString>;
291
293
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
292
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
294
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
293
295
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
294
296
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
295
297
  flowId: z.ZodOptional<z.ZodString>;
@@ -309,6 +311,48 @@ export declare const TARGET_METHODS: {
309
311
  expectedConfigVersion: z.ZodOptional<z.ZodNumber>;
310
312
  }, z.core.$strict>>;
311
313
  };
314
+ execution_target_fork: {
315
+ description: string;
316
+ parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
317
+ targetId: z.ZodString;
318
+ newTargetId: z.ZodString;
319
+ patch: z.ZodOptional<z.ZodObject<{
320
+ kind: z.ZodOptional<z.ZodEnum<{
321
+ agent_host: "agent_host";
322
+ resident_agent: "resident_agent";
323
+ workflow: "workflow";
324
+ }>>;
325
+ name: z.ZodOptional<z.ZodString>;
326
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
327
+ connectionId: z.ZodOptional<z.ZodString>;
328
+ inputSchema: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
329
+ outputSchema: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
330
+ capabilities: z.ZodOptional<z.ZodOptional<z.ZodObject<{
331
+ query: z.ZodDefault<z.ZodBoolean>;
332
+ cancel: z.ZodDefault<z.ZodBoolean>;
333
+ continue: z.ZodDefault<z.ZodBoolean>;
334
+ reconcile: z.ZodDefault<z.ZodBoolean>;
335
+ }, z.core.$strict>>>;
336
+ enabled: z.ZodOptional<z.ZodBoolean>;
337
+ binding: z.ZodOptional<z.ZodObject<{
338
+ remote: z.ZodOptional<z.ZodOptional<z.ZodString>>;
339
+ cwd: z.ZodOptional<z.ZodOptional<z.ZodString>>;
340
+ agentPreset: z.ZodOptional<z.ZodOptional<z.ZodString>>;
341
+ roleId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
342
+ skillRefs: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
343
+ loadRole: z.ZodOptional<z.ZodOptional<z.ZodLiteral<true>>>;
344
+ allowedDirectories: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
345
+ allowedPresets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
346
+ flowId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
347
+ flowVersion: z.ZodOptional<z.ZodOptional<z.ZodString>>;
348
+ driver: z.ZodOptional<z.ZodOptional<z.ZodLiteral<"ppt_delivery">>>;
349
+ agentFile: z.ZodOptional<z.ZodOptional<z.ZodString>>;
350
+ provider: z.ZodOptional<z.ZodOptional<z.ZodString>>;
351
+ model: z.ZodOptional<z.ZodOptional<z.ZodString>>;
352
+ }, z.core.$strict>>;
353
+ }, z.core.$strict>>;
354
+ }, z.core.$strict>>;
355
+ };
312
356
  execution_target_probe: {
313
357
  description: string;
314
358
  parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
@@ -26,7 +26,8 @@ export const executionConnectionSchema = executionConnectionConfigSchema.extend(
26
26
  export const executionTargetBindingSchema = z.object({
27
27
  remote: id.optional(), cwd: absolutePath.optional(), agentPreset: id.optional(),
28
28
  roleId: id.optional(), skillRefs: z.array(text).max(100).optional(),
29
- skillPolicy: z.literal('network_pinned').optional(),
29
+ // Forward roleId to the host so it loads that role and the skills in cwd/.agents/skills. Without it roleId is only a label.
30
+ loadRole: z.literal(true).optional(),
30
31
  allowedDirectories: z.array(absolutePath).min(1).max(100).optional(),
31
32
  allowedPresets: z.array(id).min(1).max(100).optional(),
32
33
  flowId: id.optional(), flowVersion: text.optional(), driver: z.literal('ppt_delivery').optional(),
@@ -72,6 +73,15 @@ const connectionUpdate = z.object({ connectionId: id, expectedConnectionVersion:
72
73
  provider: z.enum(['a2a', 'activepieces']).optional(), enabled: z.boolean().optional(),
73
74
  }).strict() }).strict();
74
75
  const targetDelete = targetRef.extend({ expectedConfigVersion: version.optional() });
76
+ /** Copy a target under a new ID. `patch.binding` is merged into the copied binding, so only the fields being changed are given. */
77
+ const targetFork = z.object({ targetId: id, newTargetId: id,
78
+ patch: targetUpdate.shape.patch.extend({ binding: executionTargetBindingSchema.partial().optional() }).strict().optional() }).strict();
79
+ /** The preset a fixed role runs on when its binding names none. */
80
+ export const DEFAULT_RESIDENT_PRESET = 'standard';
81
+ function withDefaults(target) {
82
+ return target.kind === 'resident_agent' && !target.binding.agentPreset
83
+ ? { ...target, binding: { ...target.binding, agentPreset: DEFAULT_RESIDENT_PRESET } } : target;
84
+ }
75
85
  const connectionDelete = connectionRef.extend({ expectedConnectionVersion: version.optional() });
76
86
  export const TARGET_METHODS = {
77
87
  execution_connection_list: { description: '列出人工登记的执行连接及派生端点,不返回凭据。', parameters: z.toJSONSchema(empty) },
@@ -84,6 +94,7 @@ export const TARGET_METHODS = {
84
94
  execution_target_create: { description: '登记通用宿主、固定角色或工作流,不部署或运行能力。仅可信本机管理入口可调用。', parameters: z.toJSONSchema(executionTargetConfigSchema) },
85
95
  execution_target_update: { description: '修改或启停执行目标并递增配置版本。仅可信本机管理入口可调用。', parameters: z.toJSONSchema(targetUpdate) },
86
96
  execution_target_delete: { description: '删除目标且不取消历史任务,编号永久保留。仅可信本机管理入口可调用。', parameters: z.toJSONSchema(targetDelete) },
97
+ execution_target_fork: { description: '把已有目标复制成新编号的副本,可同时修改名称、默认预设或默认模型等;patch.binding 只写要改的字段。原目标不变。仅可信本机管理入口可调用。', parameters: z.toJSONSchema(targetFork) },
87
98
  execution_target_probe: { description: '读取只读探测要求和当前健康视图;调用方适配器可执行 agent-card/preflight 检查,目录自身不调用模型。', parameters: z.toJSONSchema(targetRef) },
88
99
  };
89
100
  const stateSchema = z.object({ version: z.literal(1), connections: z.array(executionConnectionSchema),
@@ -249,7 +260,7 @@ export class TargetDirectory {
249
260
  if (binding.flowId || binding.flowVersion)
250
261
  throw new Error('Agent targets cannot bind a workflow');
251
262
  if (target.kind === 'resident_agent' && (!binding.cwd || !binding.agentPreset || !binding.roleId))
252
- throw new Error('resident_agent requires fixed cwd, agentPreset and roleId');
263
+ throw new Error('resident_agent requires fixed cwd and roleId');
253
264
  if (binding.agentFile) {
254
265
  if (target.kind !== 'agent_host' || !binding.cwd || !binding.agentPreset || binding.roleId || binding.driver)
255
266
  throw new Error('A path agent is an agent_host with fixed cwd and agentPreset and no roleId or driver');
@@ -261,8 +272,15 @@ export class TargetDirectory {
261
272
  if (binding.provider && binding.agentPreset.startsWith('oneagents-acp-'))
262
273
  throw new Error('provider and model apply only to DSH-native presets');
263
274
  }
264
- else if (binding.provider || binding.model)
265
- throw new Error('Only a path agent can fix provider and model');
275
+ else if (binding.provider || binding.model) {
276
+ // A fixed role may name a default model; each task can still pass its own provider and model.
277
+ if (target.kind !== 'resident_agent')
278
+ throw new Error('Only a path agent or a fixed role can set provider and model');
279
+ if ((binding.provider === undefined) !== (binding.model === undefined))
280
+ throw new Error('provider and model must be set together');
281
+ if (binding.agentPreset.startsWith('oneagents-acp-'))
282
+ throw new Error('provider and model apply only to DSH-native presets');
283
+ }
266
284
  else if (target.kind === 'agent_host' && (binding.cwd || binding.agentPreset || binding.roleId || binding.driver))
267
285
  throw new Error('agent_host takes cwd and preset per task, not a fixed role binding');
268
286
  if (binding.cwd && binding.allowedDirectories)
@@ -300,7 +318,8 @@ export class TargetDirectory {
300
318
  // Even an identical value is not an allowed caller override; the binding is authoritative.
301
319
  if (resolvedInput.cwd !== undefined || resolvedInput.agentPreset !== undefined || resolvedInput.roleId !== undefined || resolvedInput.driver !== undefined)
302
320
  throw new Error(`${target.binding.agentFile ? 'A path agent' : 'resident_agent'} input cannot override its fixed cwd, preset, role or driver`);
303
- if (target.binding.provider && (resolvedInput.provider !== undefined || resolvedInput.model !== undefined))
321
+ // A path agent's model is part of the agent; a fixed role's model is only a default that a task may replace.
322
+ if (target.binding.agentFile && target.binding.provider && (resolvedInput.provider !== undefined || resolvedInput.model !== undefined))
304
323
  throw new Error('A path agent input cannot override its fixed provider and model');
305
324
  cwd = target.binding.cwd;
306
325
  agentPreset = target.binding.agentPreset;
@@ -405,7 +424,7 @@ export class TargetDirectory {
405
424
  return { deleted: true, connectionId };
406
425
  }
407
426
  if (method === 'execution_target_create') {
408
- const config = executionTargetConfigSchema.parse(params);
427
+ const config = withDefaults(executionTargetConfigSchema.parse(params));
409
428
  if (next.usedTargetIds.includes(config.targetId))
410
429
  throw new Error('Target ID already used; deleted IDs cannot be reused');
411
430
  const target = { ...config, configVersion: 1, createdAt: now, updatedAt: now };
@@ -419,7 +438,7 @@ export class TargetDirectory {
419
438
  const { targetId, patch, expectedConfigVersion } = targetUpdate.parse(params), previous = this.getTarget(targetId);
420
439
  if (expectedConfigVersion !== undefined && previous.configVersion !== expectedConfigVersion)
421
440
  throw new Error('Target version conflict');
422
- const candidate = executionTargetSchema.parse({ ...previous, ...patch, configVersion: previous.configVersion + 1, updatedAt: now });
441
+ const candidate = withDefaults(executionTargetSchema.parse({ ...previous, ...patch, configVersion: previous.configVersion + 1, updatedAt: now }));
423
442
  this.validateTarget(candidate, this.getConnection(candidate.connectionId));
424
443
  if (Object.entries(patch).every(([key, value]) => JSON.stringify(previous[key]) === JSON.stringify(value)))
425
444
  return previous;
@@ -427,6 +446,19 @@ export class TargetDirectory {
427
446
  this.commit(next);
428
447
  return clone(candidate);
429
448
  }
449
+ if (method === 'execution_target_fork') {
450
+ const { targetId, newTargetId, patch = {} } = targetFork.parse(params), previous = this.getTarget(targetId);
451
+ if (next.usedTargetIds.includes(newTargetId))
452
+ throw new Error('Target ID already used; deleted IDs cannot be reused');
453
+ const { configVersion: _version, createdAt: _created, updatedAt: _updated, ...config } = previous;
454
+ const target = withDefaults(executionTargetSchema.parse({ ...config, ...patch, targetId: newTargetId,
455
+ binding: { ...previous.binding, ...patch.binding }, configVersion: 1, createdAt: now, updatedAt: now }));
456
+ this.validateTarget(target, this.getConnection(target.connectionId));
457
+ next.targets.push(target);
458
+ next.usedTargetIds.push(target.targetId);
459
+ this.commit(next);
460
+ return clone(target);
461
+ }
430
462
  if (method === 'execution_target_delete') {
431
463
  const { targetId, expectedConfigVersion } = targetDelete.parse(params), previous = this.getTarget(targetId);
432
464
  if (expectedConfigVersion !== undefined && previous.configVersion !== expectedConfigVersion)
@@ -1 +1 @@
1
- export { resolveRoleSkills, roleSkillProfileSchema, roleSkillLockSchema, skillContentRevision, type RoleSkillProfile, type RoleSkillLock } from './skills.js';
1
+ export { loadRoleSkills, syncRoleSkills, linkClaudeSkills, roleSkillProfileSchema, SKILLS_DIRECTORY, CLAUDE_SKILLS_DIRECTORY, type RoleSkillProfile, type RoleSkillsLoad } from './skills.js';
@@ -1 +1 @@
1
- export { resolveRoleSkills, roleSkillProfileSchema, roleSkillLockSchema, skillContentRevision } from './skills.js';
1
+ export { loadRoleSkills, syncRoleSkills, linkClaudeSkills, roleSkillProfileSchema, SKILLS_DIRECTORY, CLAUDE_SKILLS_DIRECTORY } from './skills.js';
@@ -3,69 +3,38 @@ export declare const roleSkillProfileSchema: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  version: z.ZodString;
5
5
  instructionsPath: z.ZodOptional<z.ZodString>;
6
- network: z.ZodObject<{
7
- agentUrl: z.ZodString;
8
- timeoutMs: z.ZodDefault<z.ZodNumber>;
9
- }, z.core.$strict>;
10
6
  skills: z.ZodArray<z.ZodObject<{
11
7
  key: z.ZodString;
12
8
  name: z.ZodString;
13
- nodeUrl: z.ZodOptional<z.ZodString>;
14
- skillId: z.ZodOptional<z.ZodString>;
15
- sourceId: z.ZodOptional<z.ZodString>;
16
- assetsManifest: z.ZodOptional<z.ZodString>;
17
9
  }, z.core.$strict>>;
18
10
  entrySkill: z.ZodOptional<z.ZodString>;
19
11
  }, z.core.$strict>;
20
12
  export type RoleSkillProfile = z.infer<typeof roleSkillProfileSchema>;
21
- export declare const roleSkillLockSchema: z.ZodObject<{
22
- schemaVersion: z.ZodLiteral<1>;
23
- roleId: z.ZodString;
24
- roleVersion: z.ZodString;
25
- profilePath: z.ZodString;
26
- profileSha256: z.ZodString;
27
- cacheRoot: z.ZodString;
28
- roleDirectory: z.ZodString;
29
- createdAt: z.ZodString;
30
- instructionsPath: z.ZodOptional<z.ZodString>;
31
- instructionsSha256: z.ZodOptional<z.ZodString>;
32
- instructionsBytes: z.ZodOptional<z.ZodNumber>;
33
- entrySkill: z.ZodOptional<z.ZodString>;
34
- entryGuidePath: z.ZodOptional<z.ZodString>;
35
- skills: z.ZodArray<z.ZodObject<{
36
- key: z.ZodString;
37
- nodeUrl: z.ZodString;
38
- skillId: z.ZodString;
39
- sourceId: z.ZodString;
40
- name: z.ZodString;
41
- revision: z.ZodString;
42
- cacheDirectory: z.ZodString;
43
- directory: z.ZodString;
44
- guidePath: z.ZodString;
45
- guideResource: z.ZodString;
46
- files: z.ZodArray<z.ZodObject<{
47
- path: z.ZodString;
48
- bytes: z.ZodNumber;
49
- sha256: z.ZodString;
50
- }, z.core.$strict>>;
51
- assets: z.ZodArray<z.ZodObject<{
52
- path: z.ZodString;
53
- bytes: z.ZodNumber;
54
- sha256: z.ZodString;
55
- url: z.ZodString;
56
- }, z.core.$strict>>;
57
- }, z.core.$strict>>;
58
- }, z.core.$strict>;
59
- export type RoleSkillLock = z.infer<typeof roleSkillLockSchema>;
60
- /** Same content revision as Skill Manager: paths sorted by UTF-8 bytes, then path\0length\0 + file bytes. */
61
- export declare function skillContentRevision(files: {
62
- path: string;
63
- bytes: Uint8Array;
64
- }[]): string;
65
- /** New lock => latest catalogue revisions; existing lock => checked, fully offline reuse even if the source/profile changed. */
66
- export declare function resolveRoleSkills(options: {
13
+ export declare const SKILLS_DIRECTORY = ".agents/skills";
14
+ export declare const CLAUDE_SKILLS_DIRECTORY = ".claude/skills";
15
+ export interface RoleSkillsLoad {
16
+ roleId: string;
17
+ roleVersion: string;
18
+ roleDirectory: string;
19
+ instructions: string;
20
+ entryGuidePath?: string;
21
+ skills: {
22
+ key: string;
23
+ name: string;
24
+ directory: string;
25
+ guidePath: string;
26
+ }[];
27
+ }
28
+ /** Make `.claude/skills` reach `.agents/skills`. An existing real `.claude/skills` directory only gains links for the named skills. */
29
+ export declare function linkClaudeSkills(cwd: string, names: string[]): Promise<void>;
30
+ /** Check that every skill the profile names is present under `<cwd>/.agents/skills`, link it for Claude Code and return what the prompt needs. */
31
+ export declare function loadRoleSkills(options: {
32
+ profilePath: string;
33
+ cwd: string;
34
+ }): Promise<RoleSkillsLoad>;
35
+ /** Copy the profile's skills from a distribution directory into `<cwd>/.agents/skills`, then verify and link them. No network, no model. */
36
+ export declare function syncRoleSkills(options: {
67
37
  profilePath: string;
68
- cacheRoot: string;
69
- lockPath: string;
70
- signal?: AbortSignal;
71
- }): Promise<RoleSkillLock>;
38
+ source: string;
39
+ cwd: string;
40
+ }): Promise<RoleSkillsLoad>;