@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 CHANGED
@@ -286,7 +286,7 @@ Tests use the official ACP SDK over real WebSockets, cover session lifecycle and
286
286
 
287
287
  `GET /agents` returns `{ "agents": [...] }`, a fresh local filesystem inventory shared by DSH and 1agents_app. Each entry includes the canonical ACP registry `id`, display `label`, native CLI `installed`, and `chat_ready`. Legacy app fields (`type`, capabilities, cc-connect transport, integration status and install guidance) remain available; `claude` uses the legacy app type `claudecode`.
288
288
 
289
- Discovery checks PATH, `~/.local/bin`, `~/.grok/bin`, and installed adapter package launch files. A registered native ACP command is ready when its executable exists. Adapter-backed harnesses are ready when the adapter is installed, or when their native CLI and `npx` are installed; the latter uses the runtime's existing adapter download behavior when a session launches. Having `npx` or `uvx` alone does not expose uninstalled harnesses. Scanning neither executes agents nor downloads packages, and readiness does not verify credentials or model access. Detection-only frameworks remain in the inventory with `chat_ready: false`.
289
+ Discovery checks PATH, `~/.local/bin`, `~/.grok/bin`, and installed adapter package launch files. A registered native ACP command is ready when its executable exists. Adapter-backed harnesses are ready when the adapter is installed, or when their native CLI and `npx` are installed; the latter uses the runtime's existing adapter download behavior when a session launches. Having `npx` or `uvx` alone does not expose uninstalled harnesses. Scanning neither executes agents nor downloads packages, and readiness does not verify credentials or model access. Detection-only frameworks remain in the inventory with `chat_ready: false`. Antigravity is ready only when its official ACP runtime is installed (`agy_acp_server.par`, or `agy_acp_server.exe` on Windows), not when the separate `agy` CLI is present. Keep `localharness_external` from the same release beside that runtime, or set `ANTIGRAVITY_HARNESS_PATH` to the helper. Antigravity's fixed-choice questions are still cancelled by the runtime and have to be answered in an interactive client.
290
290
 
291
291
  The service launcher uses the same local command resolution, including absolute paths to user-local binaries. The catalog originates from 1agents_app's former Go detector; consumers no longer probe their own host or maintain separate detection tables. `discoverAgents()` is also exported for embedded service consumers and includes local executable paths; the HTTP response omits these paths.
292
292
 
@@ -53,7 +53,7 @@ function printUnifiedHelp(binName) {
53
53
  .replace(/^Usage:\s+acpx/m, `Usage: ${binName}`)
54
54
  .replace(/Headless CLI client for the Agent Client Protocol/, 'Headless CLI client & DreamMate Network runtime service for the Agent Client Protocol (ACP)');
55
55
  const serverCommands = `Commands:
56
- roles sync --profile <file> Resolve current network skills into a versioned task lock
56
+ roles sync|check --profile <file> --cwd <dir> [--source <dir>] Copy role skills into <dir>/.agents/skills, link .claude/skills
57
57
  a2a gateway --config <file> Start persistent remote-agent tools and completion inbox
58
58
  a2a invoke <method> Invoke local remote-agent tools (JSON params on stdin)
59
59
  rsi run --role <dir> --case <id> ... Run a role case: executor, program checks, send failures back
package/dist/bin/roles.js CHANGED
@@ -1,24 +1,27 @@
1
- /** Explicit cache administration; task execution uses the same resolver in its host. */
2
- import { randomUUID } from 'node:crypto';
3
- import { join, resolve } from 'node:path';
1
+ /** Explicit role administration: copy a role's skills into a working directory, or check what is there. No model is invoked. */
2
+ import { resolve } from 'node:path';
4
3
  import { parseArgs } from 'node:util';
5
- import { resolveRoleSkills } from '../src/roles/index.js';
4
+ import { loadRoleSkills, syncRoleSkills } from '../src/roles/index.js';
6
5
  export async function runRolesCli(argv) {
7
6
  if (!argv.length || argv.includes('--help') || argv.includes('-h')) {
8
- console.log('Usage: acp-service roles sync --profile FILE [--cache-root DIRECTORY] [--lock FILE]\n\nDefault cache: CWD/.1agents/cache/roles. A new lock resolves current revisions; an existing lock is verified and reused offline. No model is invoked.');
7
+ console.log(`Usage: acp-service roles sync --profile FILE --cwd DIRECTORY --source DIRECTORY
8
+ acp-service roles check --profile FILE --cwd DIRECTORY
9
+
10
+ sync copies the skills the profile names from SOURCE/<name> into DIRECTORY/.agents/skills (assets included), then links
11
+ DIRECTORY/.claude/skills to it for Claude Code. check only verifies and links. DSH and Codex read .agents/skills and Claude Code
12
+ reads .claude/skills when a session starts; nothing is downloaded or pinned.`);
9
13
  return;
10
14
  }
11
- if (argv[0] !== 'sync')
12
- throw new Error('Unknown roles command; use roles sync --help');
13
- const { values } = parseArgs({ args: argv.slice(1), options: {
14
- profile: { type: 'string' }, 'cache-root': { type: 'string' }, lock: { type: 'string' },
15
- }, strict: true });
16
- if (!values.profile)
17
- throw new Error('--profile is required');
18
- const cacheRoot = resolve(values['cache-root'] ?? '.1agents/cache/roles');
19
- const lockPath = resolve(values.lock ?? join(cacheRoot, 'locks', `manual-${randomUUID()}.json`));
20
- const lock = await resolveRoleSkills({ profilePath: resolve(values.profile), cacheRoot, lockPath });
21
- console.log(JSON.stringify({ roleId: lock.roleId, roleVersion: lock.roleVersion, lockPath,
22
- roleDirectory: lock.roleDirectory, entryGuidePath: lock.entryGuidePath,
23
- skills: lock.skills.map(({ key, skillId, sourceId, revision, directory }) => ({ key, skillId, sourceId, revision, directory })) }, null, 2));
15
+ const command = argv[0];
16
+ if (command !== 'sync' && command !== 'check')
17
+ throw new Error('Unknown roles command; use roles --help');
18
+ const { values } = parseArgs({ args: argv.slice(1), options: { profile: { type: 'string' }, cwd: { type: 'string' }, source: { type: 'string' } }, strict: true });
19
+ if (!values.profile || !values.cwd)
20
+ throw new Error('--profile and --cwd are required');
21
+ if (command === 'sync' && !values.source)
22
+ throw new Error('--source is required');
23
+ const profilePath = resolve(values.profile), cwd = resolve(values.cwd);
24
+ const loaded = command === 'sync' ? await syncRoleSkills({ profilePath, cwd, source: resolve(values.source) }) : await loadRoleSkills({ profilePath, cwd });
25
+ console.log(JSON.stringify({ roleId: loaded.roleId, roleVersion: loaded.roleVersion, cwd, entryGuidePath: loaded.entryGuidePath,
26
+ skills: loaded.skills.map(({ key, name, directory }) => ({ key, name, directory })) }, null, 2));
24
27
  }
@@ -10,9 +10,8 @@ export interface A2AExecutionOptions {
10
10
  defaultCwd?: string;
11
11
  defaultAgentPreset?: string;
12
12
  workspaces?: Record<string, string>;
13
- /** Profiles and the writable cache root are controlled by the execution host. */
13
+ /** Role profiles are controlled by the execution host; the skills themselves are read from the session's `.agents/skills`. */
14
14
  roleSkills?: {
15
- cacheRoot: string;
16
15
  profiles: Record<string, string>;
17
16
  /** Optional compatibility binding for fresh fixed-preset contexts only. */
18
17
  presetRoles?: Record<string, string>;
@@ -1,14 +1,12 @@
1
1
  /** Official A2A executor with durable DSH context bindings and independent turns. */
2
- import { createHash, randomUUID } from 'node:crypto';
3
- import { lstat, mkdir, readFile, realpath } from 'node:fs/promises';
4
- import { isAbsolute, join, relative, sep } from 'node:path';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { isAbsolute } from 'node:path';
5
4
  import { Role, Task, TaskState, Message } from '@a2a-js/sdk';
6
5
  import { ContentTypeNotSupportedError, RequestMalformedError, UnsupportedOperationError } from '@a2a-js/sdk/errors';
7
6
  import { AgentEvent, resolveUserScope } from '@a2a-js/sdk/server';
8
7
  import { a2aRequestId } from './request-id.js';
9
8
  import { toSafeError } from '@1agents/acp-service/runtime';
10
- import { a2aRoleSkillsSchema } from './types.js';
11
- import { resolveRoleSkills } from '../roles/index.js';
9
+ import { loadRoleSkills } from '../roles/index.js';
12
10
  import { agentPromptPrefix, readAgentFile } from '../execution/agent-files.js';
13
11
  import { A2APreflightError, a2aPreflightRequirementsSchema } from './preflight.js';
14
12
  import { a2aResultContractSchema, A2AResultValidationError, createA2AResultMetadata, saveA2AResultMetadata } from './result-metadata.js';
@@ -30,11 +28,10 @@ export function validateA2AExecutionOptions(options) {
30
28
  const roles = options.roleSkills;
31
29
  if (roles === undefined)
32
30
  return;
33
- if (!roles || typeof roles !== 'object' || typeof roles.cacheRoot !== 'string' || !isAbsolute(roles.cacheRoot) || roles.cacheRoot.includes('\0')
34
- || !roles.profiles || typeof roles.profiles !== 'object' || Array.isArray(roles.profiles)
31
+ if (!roles || typeof roles !== 'object' || !roles.profiles || typeof roles.profiles !== 'object' || Array.isArray(roles.profiles)
35
32
  || Object.entries(roles.profiles).some(([id, path]) => !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(id)
36
33
  || typeof path !== 'string' || !isAbsolute(path) || path.includes('\0')))
37
- throw new Error('Role skills require host-owned absolute cache and profile paths');
34
+ throw new Error('Role skills require host-owned absolute profile paths');
38
35
  if (roles.presetRoles !== undefined && (!roles.presetRoles || typeof roles.presetRoles !== 'object' || Array.isArray(roles.presetRoles)
39
36
  || Object.entries(roles.presetRoles).some(([preset, roleId]) => !preset.trim() || preset.length > 256 || preset.includes('\0')
40
37
  || typeof roleId !== 'string' || !Object.hasOwn(roles.profiles, roleId))))
@@ -94,9 +91,9 @@ export function parseA2AInput(request, options) {
94
91
  throw new RequestMalformedError('metadata.1agents must be an object');
95
92
  const value = (metadata ?? {});
96
93
  for (const key of Object.keys(value))
97
- if (!['cwd', 'agentPreset', 'workspace', 'preflight', 'resultContract', 'roleId', 'roleLockPath', 'agentFile', 'provider', 'model', 'execution'].includes(key))
94
+ if (!['cwd', 'agentPreset', 'workspace', 'preflight', 'resultContract', 'roleId', 'agentFile', 'provider', 'model', 'execution'].includes(key))
98
95
  throw new RequestMalformedError(`Unknown metadata.1agents field: ${key}`);
99
- for (const key of ['cwd', 'agentPreset', 'workspace', 'roleId', 'roleLockPath', 'agentFile', 'provider', 'model']) {
96
+ for (const key of ['cwd', 'agentPreset', 'workspace', 'roleId', 'agentFile', 'provider', 'model']) {
100
97
  if (value[key] !== undefined && (typeof value[key] !== 'string' || !value[key].trim()))
101
98
  throw new RequestMalformedError(`${key} must be a nonempty string`);
102
99
  }
@@ -105,12 +102,8 @@ export function parseA2AInput(request, options) {
105
102
  if (value.roleId !== undefined && (!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/.test(value.roleId)
106
103
  || !options.roleSkills || !Object.hasOwn(options.roleSkills.profiles, value.roleId)))
107
104
  throw new RequestMalformedError('Unknown host role');
108
- if (value.roleLockPath !== undefined && (!options.roleSkills || !isAbsolute(value.roleLockPath)
109
- || value.roleLockPath.includes('\0')))
110
- throw new RequestMalformedError('Invalid role lock path');
111
- if (value.agentFile !== undefined && (!isAbsolute(value.agentFile) || value.agentFile.includes('\0')
112
- || value.roleId !== undefined || value.roleLockPath !== undefined))
113
- throw new RequestMalformedError('agentFile must be an absolute path and cannot be combined with a host role');
105
+ if (value.agentFile !== undefined && (!isAbsolute(value.agentFile) || value.agentFile.includes('\0')))
106
+ throw new RequestMalformedError('agentFile must be an absolute path');
114
107
  if (value.cwd && value.workspace)
115
108
  throw new RequestMalformedError('Use cwd or workspace, not both');
116
109
  let cwd = value.cwd;
@@ -129,7 +122,6 @@ export function parseA2AInput(request, options) {
129
122
  return { prompt, input: { cwd, agentPreset: value.agentPreset,
130
123
  ...(preflight?.success ? { preflight: preflight.data } : {}),
131
124
  ...(value.roleId ? { roleId: value.roleId } : {}),
132
- ...(value.roleLockPath ? { roleLockPath: value.roleLockPath } : {}),
133
125
  ...(value.agentFile ? { agentFile: value.agentFile } : {}),
134
126
  ...(value.provider ? { provider: value.provider, model: value.model } : {}) },
135
127
  ...(resultContract?.success ? { resultContract: resultContract.data } : {}),
@@ -178,50 +170,27 @@ export class A2ASessionExecutor {
178
170
  const preset = input.agentPreset ?? this.options.defaultAgentPreset, bindings = this.options.roleSkills?.presetRoles;
179
171
  return preset && bindings && Object.hasOwn(bindings, preset) ? bindings[preset] : undefined;
180
172
  }
181
- async roleFor(input, saved, contextKey, signal) {
173
+ async roleFor(input, saved) {
182
174
  const roleId = this.roleIdFor(input, saved);
183
- if (!roleId) {
184
- if (input.roleLockPath)
185
- throw new Error('A role lock requires a role identity');
175
+ if (!roleId)
186
176
  return undefined;
187
- }
188
177
  if (saved && (!saved.roleSkills || saved.roleId !== roleId))
189
178
  throw new Error('An existing context cannot change its role');
190
179
  const configuration = this.options.roleSkills;
191
180
  if (!configuration || !Object.hasOwn(configuration.profiles, roleId))
192
181
  throw new Error('The saved role is no longer configured on this host');
193
- await mkdir(join(configuration.cacheRoot, 'locks'), { recursive: true, mode: 0o700 });
194
- const lockRootInfo = await lstat(join(configuration.cacheRoot, 'locks'));
195
- if (!lockRootInfo.isDirectory() || lockRootInfo.isSymbolicLink())
196
- throw new Error('The host role locks directory must be a real directory');
197
- const lockRoot = await realpath(join(configuration.cacheRoot, 'locks'));
198
- const existingPath = saved?.roleSkills?.lockPath ?? input.roleLockPath;
199
- let lockPath;
200
- if (existingPath) {
201
- const info = await lstat(existingPath);
202
- const actual = await realpath(existingPath), tail = relative(lockRoot, actual);
203
- if (!info.isFile() || info.isSymbolicLink() || tail === '' || tail === '..' || tail.startsWith(`..${sep}`) || isAbsolute(tail))
204
- throw new Error('Role lock must be an existing regular file inside the host locks directory');
205
- // Preserve a saved summary byte-for-byte when a migrated cache retains
206
- // the old root as a compatible alias. Fresh contexts use canonical paths.
207
- lockPath = saved?.roleSkills?.lockPath ?? actual;
208
- if (saved?.roleSkills && input.roleLockPath && await realpath(input.roleLockPath) !== actual)
209
- throw new Error('An existing context cannot change its role lock');
210
- }
211
- else {
212
- lockPath = join(lockRoot, `a2a-${createHash('sha256').update(contextKey).digest('hex')}.json`);
213
- }
214
- const lock = await resolveRoleSkills({ profilePath: configuration.profiles[roleId], cacheRoot: configuration.cacheRoot, lockPath, signal });
215
- const summary = a2aRoleSkillsSchema.parse({ roleId: lock.roleId, roleVersion: lock.roleVersion, lockPath,
216
- roleDirectory: lock.roleDirectory, ...(lock.entryGuidePath ? { entryGuidePath: lock.entryGuidePath } : {}),
217
- skills: lock.skills.map(({ key, skillId, sourceId, name, revision, directory, guidePath }) => ({ key, skillId, sourceId, name, revision, directory, guidePath })) });
218
- if (saved?.roleSkills && JSON.stringify(saved.roleSkills) !== JSON.stringify(summary))
219
- throw new Error('Saved role skill identity differs from its verified lock');
220
- const instructions = lock.instructionsPath ? await readFile(lock.instructionsPath, 'utf8') : '';
221
- if (Buffer.byteLength(instructions) > 65536)
182
+ const cwd = input.cwd ?? saved?.cwd ?? this.options.defaultCwd;
183
+ if (!cwd)
184
+ throw new Error('A role needs a working directory that holds its skills');
185
+ // Skills are read from the working directory as they are; a continuation sees the current files, not a pinned copy.
186
+ const loaded = await loadRoleSkills({ profilePath: configuration.profiles[roleId], cwd });
187
+ const summary = { roleId: loaded.roleId, roleVersion: loaded.roleVersion, roleDirectory: loaded.roleDirectory,
188
+ ...(loaded.entryGuidePath ? { entryGuidePath: loaded.entryGuidePath } : {}),
189
+ skills: loaded.skills.map(({ key, name, directory, guidePath }) => ({ key, name, directory, guidePath })) };
190
+ if (Buffer.byteLength(loaded.instructions) > 65536)
222
191
  throw new Error('Role instructions exceed the host prompt budget');
223
- const guides = summary.skills.map(skill => `- ${skill.key}: ${skill.guidePath} (revision=${skill.revision})`).join('\n');
224
- return { roleId, summary, promptPrefix: `宿主已加载角色 ${roleId},本任务技能锁:${lockPath}。仅使用此锁及下列缓存技能,不重新检索或切换版本;续派和恢复沿用同一锁。先读取适用指南及其配套资源。\n${guides}\n${instructions}\n\n上游任务:\n` };
192
+ const guides = summary.skills.map(skill => `- ${skill.key}: ${skill.guidePath}`).join('\n');
193
+ return { roleId, summary, promptPrefix: `宿主已加载角色 ${roleId}。本会话工作目录 ${cwd} 的 .agents/skills 提供下列技能,先读取适用指南及其配套资源;不要重新检索或安装技能。\n${guides}\n${loaded.instructions}\n\n上游任务:\n` };
225
194
  }
226
195
  isRunning(taskId) { return this.active.has(taskId); }
227
196
  /** A person took the session over: the pending question is no longer answered through A2A. */
@@ -332,7 +301,7 @@ export class A2ASessionExecutor {
332
301
  submitted();
333
302
  let role;
334
303
  try {
335
- role = await this.roleFor(input, saved, key, controller.signal);
304
+ role = await this.roleFor(input, saved);
336
305
  }
337
306
  catch (error) {
338
307
  throw new RoleSkillLoadingError(error);
@@ -367,8 +336,6 @@ export class A2ASessionExecutor {
367
336
  }
368
337
  // A path agent's role is read on this host, inside the session's real cwd. A continuation already carries it in its history.
369
338
  if (input.agentFile && !saved?.sessionId) {
370
- if (role)
371
- throw Object.assign(new Error('A path agent cannot also take a host role bound to its preset'), { code: 'AGENT_FILE_INVALID' });
372
339
  let agent;
373
340
  try {
374
341
  agent = await readAgentFile(input.agentFile, target.cwd ?? '');
@@ -376,7 +343,7 @@ export class A2ASessionExecutor {
376
343
  catch (error) {
377
344
  throw Object.assign(new Error(`Cannot load path agent: ${error instanceof Error ? error.message : String(error)}`), { code: 'AGENT_FILE_INVALID' });
378
345
  }
379
- promptPrefix = agentPromptPrefix(agent);
346
+ promptPrefix += agentPromptPrefix(agent);
380
347
  }
381
348
  this.store.saveTarget(context.contextId, target, context.context);
382
349
  }
@@ -79,10 +79,6 @@ declare const configSchema: z.ZodObject<{
79
79
  runtimeDocument: z.ZodString;
80
80
  designSkill: z.ZodString;
81
81
  pythonExecutable: z.ZodString;
82
- roleSkills: z.ZodOptional<z.ZodObject<{
83
- profilePath: z.ZodString;
84
- cacheRoot: z.ZodString;
85
- }, z.core.$strict>>;
86
82
  nodeExecutable: z.ZodOptional<z.ZodString>;
87
83
  nodeModuleRoot: z.ZodOptional<z.ZodString>;
88
84
  maxRevisionRounds: z.ZodDefault<z.ZodNumber>;
@@ -148,7 +144,6 @@ export declare const REMOTE_AGENT_METHODS: {
148
144
  notificationTarget: z.ZodOptional<z.ZodString>;
149
145
  title: z.ZodOptional<z.ZodString>;
150
146
  roleId: z.ZodOptional<z.ZodString>;
151
- roleLockPath: z.ZodOptional<z.ZodString>;
152
147
  preflight: z.ZodOptional<z.ZodObject<{
153
148
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
149
  jobDirectory: z.ZodOptional<z.ZodString>;
@@ -225,7 +220,6 @@ export declare const REMOTE_AGENT_METHODS: {
225
220
  }, z.core.$strict>>;
226
221
  clientRequestId: z.ZodOptional<z.ZodString>;
227
222
  roleId: z.ZodOptional<z.ZodString>;
228
- roleLockPath: z.ZodOptional<z.ZodString>;
229
223
  preflight: z.ZodOptional<z.ZodObject<{
230
224
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
231
225
  jobDirectory: z.ZodOptional<z.ZodString>;
@@ -784,7 +778,7 @@ export declare const REMOTE_AGENT_METHODS: {
784
778
  agentPreset: z.ZodOptional<z.ZodString>;
785
779
  roleId: z.ZodOptional<z.ZodString>;
786
780
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
787
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
781
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
788
782
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
789
783
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
790
784
  flowId: z.ZodOptional<z.ZodString>;
@@ -825,7 +819,7 @@ export declare const REMOTE_AGENT_METHODS: {
825
819
  agentPreset: z.ZodOptional<z.ZodString>;
826
820
  roleId: z.ZodOptional<z.ZodString>;
827
821
  skillRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
828
- skillPolicy: z.ZodOptional<z.ZodLiteral<"network_pinned">>;
822
+ loadRole: z.ZodOptional<z.ZodLiteral<true>>;
829
823
  allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
830
824
  allowedPresets: z.ZodOptional<z.ZodArray<z.ZodString>>;
831
825
  flowId: z.ZodOptional<z.ZodString>;
@@ -845,6 +839,48 @@ export declare const REMOTE_AGENT_METHODS: {
845
839
  expectedConfigVersion: z.ZodOptional<z.ZodNumber>;
846
840
  }, z.core.$strict>>;
847
841
  };
842
+ execution_target_fork: {
843
+ description: string;
844
+ parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
845
+ targetId: z.ZodString;
846
+ newTargetId: z.ZodString;
847
+ patch: z.ZodOptional<z.ZodObject<{
848
+ kind: z.ZodOptional<z.ZodEnum<{
849
+ agent_host: "agent_host";
850
+ resident_agent: "resident_agent";
851
+ workflow: "workflow";
852
+ }>>;
853
+ name: z.ZodOptional<z.ZodString>;
854
+ description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
855
+ connectionId: z.ZodOptional<z.ZodString>;
856
+ inputSchema: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
857
+ outputSchema: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
858
+ capabilities: z.ZodOptional<z.ZodOptional<z.ZodObject<{
859
+ query: z.ZodDefault<z.ZodBoolean>;
860
+ cancel: z.ZodDefault<z.ZodBoolean>;
861
+ continue: z.ZodDefault<z.ZodBoolean>;
862
+ reconcile: z.ZodDefault<z.ZodBoolean>;
863
+ }, z.core.$strict>>>;
864
+ enabled: z.ZodOptional<z.ZodBoolean>;
865
+ binding: z.ZodOptional<z.ZodObject<{
866
+ remote: z.ZodOptional<z.ZodOptional<z.ZodString>>;
867
+ cwd: z.ZodOptional<z.ZodOptional<z.ZodString>>;
868
+ agentPreset: z.ZodOptional<z.ZodOptional<z.ZodString>>;
869
+ roleId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
870
+ skillRefs: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
871
+ loadRole: z.ZodOptional<z.ZodOptional<z.ZodLiteral<true>>>;
872
+ allowedDirectories: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
873
+ allowedPresets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
874
+ flowId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
875
+ flowVersion: z.ZodOptional<z.ZodOptional<z.ZodString>>;
876
+ driver: z.ZodOptional<z.ZodOptional<z.ZodLiteral<"ppt_delivery">>>;
877
+ agentFile: z.ZodOptional<z.ZodOptional<z.ZodString>>;
878
+ provider: z.ZodOptional<z.ZodOptional<z.ZodString>>;
879
+ model: z.ZodOptional<z.ZodOptional<z.ZodString>>;
880
+ }, z.core.$strict>>;
881
+ }, z.core.$strict>>;
882
+ }, z.core.$strict>>;
883
+ };
848
884
  execution_target_probe: {
849
885
  description: string;
850
886
  parameters: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
@@ -91,14 +91,14 @@ const prompt = z.string().min(1).max(256 * 1024).refine(value => Boolean(value.t
91
91
  const spawnSchema = z.object({ ...originFields, remote: string, prompt,
92
92
  cwd: string.refine(value => path.posix.isAbsolute(value), 'cwd must be an absolute remote path'),
93
93
  agentPreset: string.optional(), notificationTarget: string.optional(), title: string.optional(),
94
- roleId: string.optional(), roleLockPath: string.refine(path.isAbsolute).optional(),
94
+ roleId: string.optional(),
95
95
  preflight: a2aPreflightRequirementsSchema.optional(), resultContract: a2aResultContractSchema.optional(),
96
96
  clientRequestId: string.optional(), lifecycle: sessionLifecycleSchema.optional(),
97
97
  provider: string.optional(), model: string.optional(), initiatedBy: actorSchema.optional(),
98
98
  }).strict();
99
99
  const preflightSchema = a2aPreflightInputSchema.extend({ ...originFields, remote: string }).strict();
100
100
  const taskSchema = z.object(taskFields).strict();
101
- const messageSchema = z.object({ ...taskFields, prompt, initiatedBy: actorSchema.optional(), clientRequestId: string.optional(), roleId: string.optional(), roleLockPath: string.refine(path.isAbsolute).optional(), preflight: a2aPreflightRequirementsSchema.optional(), resultContract: a2aResultContractSchema.optional(), lifecycle: sessionLifecycleSchema.optional(), autoResume: z.boolean().optional(), provider: string.optional(), model: string.optional() }).strict();
101
+ const messageSchema = z.object({ ...taskFields, prompt, initiatedBy: actorSchema.optional(), clientRequestId: string.optional(), roleId: string.optional(), preflight: a2aPreflightRequirementsSchema.optional(), resultContract: a2aResultContractSchema.optional(), lifecycle: sessionLifecycleSchema.optional(), autoResume: z.boolean().optional(), provider: string.optional(), model: string.optional() }).strict();
102
102
  const closeSchema = z.object({ ...originFields, remote: string, taskId: string.optional(), contextId: string.optional(), sessionId: string.optional(), mode: z.enum(['close', 'delete']).optional(), force: z.boolean().optional(), clientRequestId: string.optional() }).strict();
103
103
  const sessionsSchema = z.object({}).strict();
104
104
  const inboxSchema = z.object(originFields).strict();
@@ -436,12 +436,8 @@ export class RemoteAgentGateway {
436
436
  const withArtifacts = (declared, add) => artifacts ? add(artifacts) : declared;
437
437
  let requirements = withArtifacts(declaredRequirements, found => ({ ...declaredRequirements, jobDirectory: found.directory }));
438
438
  let resultContract = withArtifacts(declaredResult, found => ({ ...(declaredResult ?? { jobId: job.jobId }), artifactManifestPath: found.manifest }));
439
- const networkRole = resolved.target.binding.skillPolicy === 'network_pinned' ? resolved.target.binding.roleId : undefined;
440
- if (resolved.target.binding.skillPolicy && !networkRole)
441
- throw new Error('Network skill policy requires a fixed roleId');
439
+ const boundRole = resolved.target.binding.loadRole ? resolved.target.binding.roleId : undefined;
442
440
  const explicitRole = resolved.target.kind === 'agent_host' && fields.roleId !== undefined ? string.parse(fields.roleId) : undefined;
443
- const roleLockPath = fields.roleLockPath === undefined ? undefined
444
- : z.string().min(1).refine(path.isAbsolute, 'Expected an absolute role lock path').parse(fields.roleLockPath);
445
441
  try {
446
442
  await this.checkDispatch(resolved.remote, resolved.cwd, requirements, resolved.endpoint);
447
443
  }
@@ -468,7 +464,7 @@ export class RemoteAgentGateway {
468
464
  ...(options.previous ? { contextId: options.previous.contextId } : {}), parts: [{ text: prompt.parse(fields.prompt) + (artifacts ? artifactInstructions(artifacts.directory, artifacts.manifest) : '') }] },
469
465
  metadata: { '1agents': { ...(!options.previous ? { cwd: resolved.cwd, ...(resolved.agentPreset ? { agentPreset: resolved.agentPreset } : {}),
470
466
  ...(resolved.target.binding.agentFile ? { agentFile: resolved.target.binding.agentFile } : {}) } : {}),
471
- ...(explicitRole ? { roleId: explicitRole } : !options.previous && networkRole ? { roleId: networkRole } : {}), ...(roleLockPath ? { roleLockPath } : {}),
467
+ ...(explicitRole ? { roleId: explicitRole } : !options.previous && boundRole ? { roleId: boundRole } : {}),
472
468
  ...(requirements ? { preflight: requirements } : {}), ...(resultContract ? { resultContract } : {}), ...(provider ? { provider, model } : {}),
473
469
  execution: { jobId: job.jobId, attemptId: attempt.attemptId } } },
474
470
  configuration: { returnImmediately: true, ...(this.config.callback ? { taskPushNotificationConfig: { url: this.config.callback.url,
@@ -1434,7 +1430,7 @@ export class RemoteAgentGateway {
1434
1430
  clientRequestId: input.clientRequestId, title: previous.title, initiatedBy: input.initiatedBy,
1435
1431
  input: { ...(target.kind === 'agent_host' ? { cwd: previous.cwd, ...(previous.agentPreset ? { agentPreset: previous.agentPreset } : {}) } : {}), prompt: input.prompt,
1436
1432
  ...(input.preflight ? { preflight: input.preflight } : {}), ...(input.resultContract ? { resultContract: input.resultContract } : {}),
1437
- ...(input.roleId ? { roleId: input.roleId } : {}), ...(input.roleLockPath ? { roleLockPath: input.roleLockPath } : {}),
1433
+ ...(input.roleId ? { roleId: input.roleId } : {}),
1438
1434
  ...(input.lifecycle ? { lifecycle: input.lifecycle } : previous.lifecycle ? { lifecycle: previous.lifecycle } : {}),
1439
1435
  ...(input.provider !== undefined ? { provider: input.provider } : {}), ...(input.model !== undefined ? { model: input.model } : {}),
1440
1436
  ...(previous.notificationTarget ? { notificationTarget: previous.notificationTarget } : {}) } }, { jobId: previous.ledgerJobId, previous });
@@ -115,7 +115,11 @@ export async function createA2AResultMetadata(input) {
115
115
  const root = target?.preflight?.ok && target.preflight.jobDirectory;
116
116
  // A manifest the gateway announced by default is optional: no admitted directory or manifest means no artifacts,
117
117
  // and a bad one is reported in `validation` without failing a task that otherwise completed.
118
- const implicit = Boolean(target?.cwd) && isDefaultJobDirectory(target.cwd, dirname(contract.artifactManifestPath));
118
+ // The gateway may name cwd through a symlink while the host stores the resolved path, so compare both spellings.
119
+ const real = async (path) => realpath(path).catch(() => path);
120
+ const manifestDirectory = dirname(contract.artifactManifestPath);
121
+ const implicit = Boolean(target?.cwd) && (isDefaultJobDirectory(target.cwd, manifestDirectory)
122
+ || isDefaultJobDirectory(await real(target.cwd), await real(manifestDirectory)));
119
123
  if (!root) {
120
124
  if (implicit)
121
125
  return metadata;
@@ -2,19 +2,15 @@
2
2
  import type { SafeError } from '@1agents/acp-service/runtime';
3
3
  import { z } from 'zod';
4
4
  import type { A2AExecutionRef } from './execution-binding.js';
5
- /** Host-authored summary of a verified, immutable role/skill lock. */
5
+ /** Host-authored summary of the role skills a session was given: each one sits in the session's `.agents/skills`. */
6
6
  export declare const a2aRoleSkillsSchema: z.ZodObject<{
7
7
  roleId: z.ZodString;
8
8
  roleVersion: z.ZodString;
9
- lockPath: z.ZodString;
10
9
  roleDirectory: z.ZodString;
11
10
  entryGuidePath: z.ZodOptional<z.ZodString>;
12
11
  skills: z.ZodArray<z.ZodObject<{
13
12
  key: z.ZodString;
14
- skillId: z.ZodString;
15
- sourceId: z.ZodString;
16
13
  name: z.ZodString;
17
- revision: z.ZodString;
18
14
  directory: z.ZodString;
19
15
  guidePath: z.ZodString;
20
16
  }, z.core.$strict>>;
@@ -91,7 +87,6 @@ export interface A2APrepareInput {
91
87
  /** Only selects a host-configured profile; clients cannot supply profile or cache configuration. */
92
88
  roleId?: string;
93
89
  /** Optional existing parent lock under the host cache's locks directory. */
94
- roleLockPath?: string;
95
90
  /** A path agent's agents/*.md inside cwd; its body prefixes the first message of a new session. Not combined with roleId. */
96
91
  agentFile?: string;
97
92
  /** Standard presets only, passed together. Omitted keeps the session's current or host-default model. */
@@ -1,11 +1,9 @@
1
1
  import { isAbsolute } from 'node:path';
2
2
  import { z } from 'zod';
3
3
  const roleText = z.string().min(1).max(4096).refine(value => !value.includes('\0'));
4
- const rolePath = roleText.refine(isAbsolute, 'Expected an absolute role cache path');
5
- /** Host-authored summary of a verified, immutable role/skill lock. */
4
+ const rolePath = roleText.refine(isAbsolute, 'Expected an absolute role path');
5
+ /** Host-authored summary of the role skills a session was given: each one sits in the session's `.agents/skills`. */
6
6
  export const a2aRoleSkillsSchema = z.object({
7
- roleId: roleText, roleVersion: roleText, lockPath: rolePath, roleDirectory: rolePath,
8
- entryGuidePath: rolePath.optional(),
9
- skills: z.array(z.object({ key: roleText, skillId: roleText, sourceId: roleText, name: roleText,
10
- revision: z.string().regex(/^[a-f0-9]{64}$/), directory: rolePath, guidePath: rolePath }).strict()).min(1).max(100),
7
+ roleId: roleText, roleVersion: roleText, roleDirectory: rolePath, entryGuidePath: rolePath.optional(),
8
+ skills: z.array(z.object({ key: roleText, name: roleText, directory: rolePath, guidePath: rolePath }).strict()).min(1).max(100),
11
9
  }).strict();
@@ -113,12 +113,12 @@ export const catalogDescriptors = [
113
113
  {
114
114
  "type": "antigravity",
115
115
  "label": "Antigravity",
116
- "binary": "agy",
117
- "acp_capable": false,
116
+ "binary": "agy_acp_server.par",
117
+ "acp_capable": true,
118
118
  "cli_capable": true,
119
- "cc_transport": "",
120
- "integrated": false,
121
- "install_command": "curl -fsSL https://antigravity.google/cli/install.sh | bash"
119
+ "cc_transport": "acp",
120
+ "integrated": true,
121
+ "install_command": "Install agy_acp_server and localharness_external from the same antigravity-acp release (https://github.com/agentclientprotocol/registry/blob/main/antigravity-acp/agent.json) onto PATH, and point ANTIGRAVITY_HARNESS_PATH at that helper"
122
122
  },
123
123
  {
124
124
  "type": "openhands",
@@ -108,14 +108,21 @@ function localLaunch(id, options) {
108
108
  const binary = findAgentBinary(argv[0], options);
109
109
  return binary ? [binary, ...argv.slice(1)] : undefined;
110
110
  }
111
+ /** Antigravity's ACP runtime is a separate download from the `agy` CLI. */
112
+ function discoveryBinary(id, descriptor, argv, platform) {
113
+ if (id === 'antigravity')
114
+ return platform === 'win32' ? 'agy_acp_server.exe' : 'agy_acp_server.par';
115
+ return descriptor?.binary ?? (Array.isArray(argv) && !['npx', 'uvx'].includes(argv[0]) ? argv[0] : id);
116
+ }
111
117
  /** Fresh filesystem snapshot. An installed CLI may use the runtime's adapter download fallback on launch; scanning never downloads or authenticates. */
112
118
  export function discoverAgents(options = {}) {
113
119
  const descriptors = new Map(catalogDescriptors.map(d => [d.type === 'claudecode' ? 'claude' : d.type, d]));
114
120
  const supportedAgents = new Set(registry.list());
121
+ const platform = options.platform ?? process.platform;
115
122
  return [...new Set([...supportedAgents, ...descriptors.keys()])].map(id => {
116
123
  const descriptor = descriptors.get(id);
117
124
  const argv = registry.resolve(id);
118
- const binary = descriptor?.binary ?? (Array.isArray(argv) && !['npx', 'uvx'].includes(argv[0]) ? argv[0] : id);
125
+ const binary = discoveryBinary(id, descriptor, argv, platform);
119
126
  const path = findAgentBinary(binary, options);
120
127
  const supported = supportedAgents.has(id);
121
128
  return {
@@ -33,10 +33,6 @@ export declare const pptDeliveryPolicySchema: z.ZodObject<{
33
33
  runtimeDocument: z.ZodString;
34
34
  designSkill: z.ZodString;
35
35
  pythonExecutable: z.ZodString;
36
- roleSkills: z.ZodOptional<z.ZodObject<{
37
- profilePath: z.ZodString;
38
- cacheRoot: z.ZodString;
39
- }, z.core.$strict>>;
40
36
  nodeExecutable: z.ZodOptional<z.ZodString>;
41
37
  nodeModuleRoot: z.ZodOptional<z.ZodString>;
42
38
  maxRevisionRounds: z.ZodDefault<z.ZodNumber>;
@@ -183,7 +179,6 @@ export interface PptDeliveryRun {
183
179
  resultSummary?: string;
184
180
  deliveryReceipt?: Record<string, unknown>;
185
181
  /** One parent-task skill lock shared by production, review, retries and recovery. */
186
- roleSkillLockPath?: string;
187
182
  parentUpdatePending?: PptDeliveryParentUpdate;
188
183
  projectSnapshot?: {
189
184
  gitHead: string;
@@ -6,7 +6,6 @@ import { basename, isAbsolute, join, relative, sep } from 'node:path';
6
6
  import { promisify } from 'node:util';
7
7
  import { z } from 'zod';
8
8
  import { deliveryException } from './delivery-progress.js';
9
- import { resolveRoleSkills } from '../roles/index.js';
10
9
  import { createHumanReview, humanReviewPreviewSchema, markHumanReviewApplied, supersedeHumanReview } from './human-review.js';
11
10
  const execute = promisify(execFile);
12
11
  const absolute = z.string().min(1).refine(isAbsolute, 'Expected an absolute path');
@@ -30,7 +29,6 @@ export const pptDeliveryPolicySchema = z.object({
30
29
  backupTargets: z.object({ project_script: identifier.optional(), ppt_production: identifier.optional(), independent_review: identifier.optional() }).strict().optional(),
31
30
  maxTargetSwitches: z.number().int().min(0).max(3).default(1),
32
31
  runtimeDocument: absolute, designSkill: absolute, pythonExecutable: absolute,
33
- roleSkills: z.object({ profilePath: absolute, cacheRoot: absolute }).strict().optional(),
34
32
  nodeExecutable: absolute.optional(), nodeModuleRoot: absolute.optional(),
35
33
  maxRevisionRounds: z.number().int().min(0).max(3).default(1),
36
34
  maxExecutionRetries: z.number().int().min(0).max(2).default(1),
@@ -118,16 +116,11 @@ export async function createPptDeliveryRun(input) {
118
116
  const jobDirectory = join(policy.workspaceRoot, input.jobId, input.attemptId);
119
117
  await mkdir(join(jobDirectory, 'coordinator'), { recursive: true });
120
118
  await mkdir(join(policy.publicDirectory, input.jobId), { recursive: true });
121
- let roleSkillLockPath;
122
- if (policy.roleSkills) {
123
- roleSkillLockPath = join(policy.roleSkills.cacheRoot, 'locks', `ppt-${digest(JSON.stringify([input.sourceId, input.jobId]))}.json`);
124
- }
125
119
  const now = new Date().toISOString();
126
120
  const run = { version: 1, ...input, input: task, policy, jobDirectory,
127
121
  contractPath: join(jobDirectory, 'contract.json'), createdAt: now, updatedAt: now,
128
122
  executionStatus: 'working', stage: 'summary', phase: 'preparing', revision: 1, scriptRevision: 1,
129
123
  humanReviews: [], humanWaitingMs: 0, humanRevisionRounds: 0,
130
- ...(roleSkillLockPath ? { roleSkillLockPath } : {}),
131
124
  revisionReasons: [], executionRetries: {}, children: [], activeTargets: {}, targetSwitches: [], diagnostics: [], transitions: [],
132
125
  metrics: { submitCalls: 0, continueCalls: 0, queryCalls: 0, ackCalls: 0, machineChecks: 0,
133
126
  reviewRounds: 0, qualityRevisions: 0, acceptanceExerciseRevisions: 0, elapsedMs: 0,
@@ -135,7 +128,6 @@ export async function createPptDeliveryRun(input) {
135
128
  run.projectSnapshot = await projectSnapshot(project);
136
129
  await jsonFile(run.contractPath, { schema: 'ppt-delivery-contract-v1', sourceId: run.sourceId, jobId: run.jobId,
137
130
  attemptId: run.attemptId, input: task, policy, jobDirectory, projectSnapshot: run.projectSnapshot,
138
- ...(roleSkillLockPath ? { roleSkillLockPath } : {}),
139
131
  completion: 'Final bytes pass deterministic validation and independent fact/visual review; notification ack and human acceptance are separate' });
140
132
  return run;
141
133
  }
@@ -215,7 +207,6 @@ async function buildRequest(run, retry) {
215
207
  ? [run.contractPath, revisionContract, join(summary, 'slide-script.json'), run.policy.runtimeDocument, run.policy.designSkill]
216
208
  : [run.contractPath, join(revision, 'machine-validation.json'), join(revision, 'preview.png')];
217
209
  return { targetId, input: { title: `${run.input.projectName}:${purpose} ${revisionName(run)}`, prompt,
218
- ...(run.stage !== 'summary' && run.roleSkillLockPath ? { roleLockPath: run.roleSkillLockPath } : {}),
219
210
  ...(run.stage === 'summary' ? { agentPreset: run.policy.summaryAgentPreset } : {}),
220
211
  ...(cwd ? { cwd } : {}), preflight: { jobDirectory: run.jobDirectory, requiredFiles,
221
212
  ...(run.stage === 'make' ? { python: { executable: run.policy.pythonExecutable, modules: ['defusedxml'] },
@@ -399,18 +390,6 @@ async function stop(run, adapter, status, error) {
399
390
  async function startChild(run, adapter, previous, replacesJobRef) {
400
391
  if (run.cancellationRequestedAt)
401
392
  return;
402
- if (run.roleSkillLockPath && run.policy.roleSkills) {
403
- try {
404
- const lock = await resolveRoleSkills({ ...run.policy.roleSkills, lockPath: run.roleSkillLockPath });
405
- if (!lock.entryGuidePath)
406
- throw new Error('PPT role profile requires an entrySkill');
407
- run.policy.designSkill = lock.entryGuidePath;
408
- await adapter.persist(run);
409
- }
410
- catch (error) {
411
- return stop(run, adapter, 'input_required', `任务锁定的技能缓存不可用:${String(error)}`);
412
- }
413
- }
414
393
  const key = run.stage, retry = run.executionRetries[key] ?? 0;
415
394
  if (!run.pending)
416
395
  run.pending = { kind: previous ? 'continue' : 'submit', request: { ...await buildRequest(run, retry),
@@ -603,8 +582,6 @@ export async function advancePptDelivery(run, adapter) {
603
582
  if (run.recovery && !run.recovery.validationCheckedAt) {
604
583
  try {
605
584
  await validateSummary(run);
606
- if (run.roleSkillLockPath && run.policy.roleSkills)
607
- await resolveRoleSkills({ ...run.policy.roleSkills, lockPath: run.roleSkillLockPath });
608
585
  const checked = await (adapter.validateCandidate ?? validatePptDeliveryCandidate)(run);
609
586
  run.metrics.machineChecks++;
610
587
  if (checked.artifactDigest !== (run.recovery.mode === 'review_only' ? run.recovery.artifactDigest : run.review.artifactDigest))
@@ -768,8 +745,6 @@ export async function advancePptDelivery(run, adapter) {
768
745
  rechecked = await (adapter.validateCandidate ?? validatePptDeliveryCandidate)(run);
769
746
  run.metrics.machineChecks++;
770
747
  await validateSummary(run);
771
- if (run.roleSkillLockPath && run.policy.roleSkills)
772
- await resolveRoleSkills({ ...run.policy.roleSkills, lockPath: run.roleSkillLockPath });
773
748
  }
774
749
  catch (error) {
775
750
  if (run.recovery?.mode === 'review_only')
@@ -793,7 +768,6 @@ export async function advancePptDelivery(run, adapter) {
793
768
  ...(run.humanReviews?.length ? { approvedScript: run.humanReviews.find(item => item.status === 'approved' && item.digest === run.scriptDigest),
794
769
  scriptRevision: scriptRevisionName(run), scriptDigest: run.scriptDigest, humanRevisionRounds: run.humanRevisionRounds, humanWaitingMs: run.humanWaitingMs } : {}),
795
770
  targetSwitches: run.targetSwitches,
796
- ...(run.roleSkillLockPath ? { roleSkillLockPath: run.roleSkillLockPath } : {}),
797
771
  ...(run.recovery ? { recovery: run.recovery } : {}),
798
772
  productionAttemptCount: makerAttempts.length };
799
773
  const ppt = rechecked.artifacts.find(item => item.path.endsWith('.pptx')), preview = rechecked.artifacts.find(item => item.path.endsWith('/preview.png'));