@1agents/acp-service 0.8.2 → 0.9.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.
- package/README.md +6 -0
- package/dist/bin/a2a.js +10 -2
- package/dist/bin/acp-service.js +6 -0
- package/dist/bin/roles.d.ts +1 -0
- package/dist/bin/roles.js +24 -0
- package/dist/src/a2a/executor.d.ts +16 -1
- package/dist/src/a2a/executor.js +205 -19
- package/dist/src/a2a/gateway.d.ts +77 -0
- package/dist/src/a2a/gateway.js +349 -27
- package/dist/src/a2a/index.d.ts +7 -1
- package/dist/src/a2a/index.js +4 -0
- package/dist/src/a2a/result-metadata.d.ts +3 -0
- package/dist/src/a2a/result-metadata.js +2 -1
- package/dist/src/a2a/server.js +2 -1
- package/dist/src/a2a/store.js +7 -1
- package/dist/src/a2a/types.d.ts +32 -1
- package/dist/src/a2a/types.js +11 -1
- package/dist/src/acp-connection.js +93 -12
- package/dist/src/bridge.js +127 -4
- package/dist/src/capacity-lifecycle.d.ts +5 -0
- package/dist/src/capacity-lifecycle.js +57 -0
- package/dist/src/capacity-queue.d.ts +23 -0
- package/dist/src/capacity-queue.js +251 -0
- package/dist/src/capacity.d.ts +76 -0
- package/dist/src/capacity.js +377 -0
- package/dist/src/execution/human-review.d.ts +103 -0
- package/dist/src/execution/human-review.js +87 -0
- package/dist/src/execution/ledger.d.ts +5 -0
- package/dist/src/execution/ledger.js +39 -8
- package/dist/src/execution/ppt-delivery.d.ts +36 -3
- package/dist/src/execution/ppt-delivery.js +243 -53
- package/dist/src/execution/project-discovery.d.ts +56 -0
- package/dist/src/execution/project-discovery.js +429 -0
- package/dist/src/execution/report-review.d.ts +60 -0
- package/dist/src/execution/report-review.js +173 -0
- package/dist/src/execution/targets.d.ts +5 -0
- package/dist/src/execution/targets.js +1 -0
- package/dist/src/execution/workbench.d.ts +131 -0
- package/dist/src/execution/workbench.js +265 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +3 -0
- package/dist/src/roles/index.d.ts +1 -0
- package/dist/src/roles/index.js +1 -0
- package/dist/src/roles/skills.d.ts +71 -0
- package/dist/src/roles/skills.js +427 -0
- package/package.json +5 -1
- package/skills/acp-service/SKILL.md +21 -7
- package/skills/acp-service/references/a2a.md +9 -5
- package/skills/acp-service/references/async-caller.md +48 -0
- package/skills/acp-service/references/roles-and-tasks.md +120 -0
- package/skills/acp-service/scripts/a2a-caller.py +242 -0
- package/vendor/dsh/README.md +2 -0
- package/vendor/dsh/a2a-executor.d.ts +4 -1
- package/vendor/dsh/a2a-executor.js +46 -2
- package/vendor/dsh/adapter.d.ts +10 -0
- package/vendor/dsh/adapter.js +67 -3
- package/vendor/dsh/client.js +84 -24
- package/vendor/dsh/index.js +2 -1
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js → cli-DXmYwv3U.js} +4 -4
- package/vendor/runtime/dist/{cli-DeOpE2Xz.js.map → cli-DXmYwv3U.js.map} +1 -1
- package/vendor/runtime/dist/cli.js +7 -7
- package/vendor/runtime/dist/client-VQsqcIOJ.d.ts.map +1 -1
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +1 -0
- package/vendor/runtime/dist/{flows-oaBGn31w.js → flows-DJ17ajbw.js} +3 -3
- package/vendor/runtime/dist/{flows-oaBGn31w.js.map → flows-DJ17ajbw.js.map} +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js → invocation-options-PBfCgrdi.js} +3 -3
- package/vendor/runtime/dist/{invocation-options-CUDEE8vW.js.map → invocation-options-PBfCgrdi.js.map} +1 -1
- package/vendor/runtime/dist/{output-CFv3jcOQ.js → output-B3MDn7kv.js} +2 -2
- package/vendor/runtime/dist/{output-CFv3jcOQ.js.map → output-B3MDn7kv.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DvMJiGbP.js → queue-owner-runtime-DXCVngwU.js} +15 -8
- package/vendor/runtime/dist/queue-owner-runtime-DXCVngwU.js.map +1 -0
- package/vendor/runtime/dist/runtime.js +1 -1
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js → session-watch-DURyCw31.js} +2 -2
- package/vendor/runtime/dist/{session-watch-Di-wIdCH.js.map → session-watch-DURyCw31.js.map} +1 -1
- package/vendor/runtime/dist/queue-owner-runtime-DvMJiGbP.js.map +0 -1
|
@@ -4,6 +4,8 @@ const terminal = new Set(['completed', 'failed', 'canceled', 'rejected']);
|
|
|
4
4
|
const statuses = new Set(['not_started', 'submitted', 'working', 'input_required', 'auth_required', 'completed', 'failed', 'canceled', 'rejected', 'unknown']);
|
|
5
5
|
const clone = (value) => structuredClone(value);
|
|
6
6
|
const now = () => new Date().toISOString();
|
|
7
|
+
const resultContent = (result) => canonical({ resultSummary: result.resultSummary,
|
|
8
|
+
structuredResultRef: result.structuredResultRef, artifactLinks: result.artifactLinks, resultArtifacts: result.resultArtifacts ?? [] });
|
|
7
9
|
function nonempty(value, name) {
|
|
8
10
|
if (typeof value !== 'string' || !value.trim())
|
|
9
11
|
throw new Error(`${name} must be a nonempty string`);
|
|
@@ -254,7 +256,7 @@ export class JobLedger {
|
|
|
254
256
|
});
|
|
255
257
|
}
|
|
256
258
|
applyObservation(attempt, input) {
|
|
257
|
-
const timestamp = input.checkedAt ?? now();
|
|
259
|
+
const timestamp = input.checkedAt ?? now(), completedBefore = attempt.executionStatus === 'completed';
|
|
258
260
|
let conflict = false;
|
|
259
261
|
if (input.executionStatus !== undefined) {
|
|
260
262
|
if (!statuses.has(input.executionStatus))
|
|
@@ -278,14 +280,41 @@ export class JobLedger {
|
|
|
278
280
|
attempt.checkedAt = timestamp;
|
|
279
281
|
attempt.updatedAt = timestamp;
|
|
280
282
|
if (!conflict && (input.resultSummary !== undefined || input.structuredResultRef !== undefined || input.resultDigest !== undefined
|
|
281
|
-
|| input.artifactLinks !== undefined || input.resultAvailable !== undefined || input.resultRevision !== undefined)) {
|
|
283
|
+
|| input.artifactLinks !== undefined || input.resultArtifacts !== undefined || input.resultAvailable !== undefined || input.resultRevision !== undefined)) {
|
|
282
284
|
const previous = attempt.result;
|
|
283
|
-
|
|
285
|
+
const result = { ...previous, attemptId: attempt.attemptId, artifactLinks: clone(input.artifactLinks ?? previous?.artifactLinks ?? []),
|
|
284
286
|
resultAvailable: input.resultAvailable ?? previous?.resultAvailable ?? true, observedAt: timestamp,
|
|
285
287
|
...(input.resultSummary !== undefined ? { resultSummary: input.resultSummary } : {}),
|
|
286
288
|
...(input.structuredResultRef !== undefined ? { structuredResultRef: clone(input.structuredResultRef) } : {}),
|
|
289
|
+
...(input.resultArtifacts !== undefined ? { resultArtifacts: clone(input.resultArtifacts) } : {}),
|
|
287
290
|
...(input.resultDigest !== undefined ? { resultDigest: input.resultDigest } : {}),
|
|
288
291
|
...(input.resultRevision !== undefined ? { resultRevision: input.resultRevision } : {}) };
|
|
292
|
+
if (attempt.executionStatus === 'completed' && result.resultAvailable) {
|
|
293
|
+
if (input.resultRevision !== undefined)
|
|
294
|
+
nonempty(input.resultRevision, 'resultRevision');
|
|
295
|
+
const content = resultContent(result), unchanged = previous && resultContent(previous) === content;
|
|
296
|
+
result.resultDigest = input.resultDigest ?? (unchanged ? previous.resultDigest : undefined)
|
|
297
|
+
?? createHash('sha256').update(content).digest('hex');
|
|
298
|
+
nonempty(result.resultDigest, 'resultDigest');
|
|
299
|
+
const history = attempt.resultHistory ??= [];
|
|
300
|
+
if (!history.length && completedBefore && previous?.resultRevision && previous.resultDigest)
|
|
301
|
+
history.push(clone(previous));
|
|
302
|
+
result.resultRevision = input.resultRevision ?? (unchanged && previous.resultDigest === result.resultDigest ? previous.resultRevision : undefined);
|
|
303
|
+
if (!result.resultRevision) {
|
|
304
|
+
let sequence = history.length + 1;
|
|
305
|
+
while (history.some(item => item.resultRevision === `result-${sequence}`))
|
|
306
|
+
sequence++;
|
|
307
|
+
result.resultRevision = `result-${sequence}`;
|
|
308
|
+
}
|
|
309
|
+
nonempty(result.resultRevision, 'resultRevision');
|
|
310
|
+
const existing = history.find(item => item.resultRevision === result.resultRevision);
|
|
311
|
+
if (existing && (existing.resultDigest !== result.resultDigest || resultContent(existing) !== content
|
|
312
|
+
|| previous?.resultRevision !== result.resultRevision))
|
|
313
|
+
throw new Error('A result revision cannot be overwritten or reused after supersession');
|
|
314
|
+
if (!existing)
|
|
315
|
+
history.push(clone(result));
|
|
316
|
+
}
|
|
317
|
+
attempt.result = result;
|
|
289
318
|
}
|
|
290
319
|
return conflict;
|
|
291
320
|
}
|
|
@@ -299,7 +328,8 @@ export class JobLedger {
|
|
|
299
328
|
const relevant = (item) => ({ status: item.executionStatus, providerState: item.providerState, phase: item.phase, stale: item.stale,
|
|
300
329
|
diagnostic: item.diagnostic, result: item.result ? { ...item.result, observedAt: undefined } : undefined });
|
|
301
330
|
if (canonical(relevant(previous)) !== canonical(relevant(attempt)))
|
|
302
|
-
this.event(state, state.jobs[attempt.jobId], attemptId, conflict ? 'attempt.observation_conflict' : previous.executionStatus !== attempt.executionStatus ? 'attempt.state_changed' : 'attempt.result_updated'
|
|
331
|
+
this.event(state, state.jobs[attempt.jobId], attemptId, conflict ? 'attempt.observation_conflict' : previous.executionStatus !== attempt.executionStatus ? 'attempt.state_changed' : 'attempt.result_updated', attempt.result?.resultRevision && previous.result?.resultRevision !== attempt.result.resultRevision
|
|
332
|
+
? { resultRevision: attempt.result.resultRevision, resultDigest: attempt.result.resultDigest, previousResultRevision: previous.result?.resultRevision } : undefined);
|
|
303
333
|
return attempt;
|
|
304
334
|
});
|
|
305
335
|
}
|
|
@@ -318,11 +348,12 @@ export class JobLedger {
|
|
|
318
348
|
get(originSessionId, jobId) {
|
|
319
349
|
const job = this.job(this.state, originSessionId, jobId), current = this.state.attempts[job.currentAttemptId];
|
|
320
350
|
const history = this.state.acceptances[jobId] ?? [];
|
|
321
|
-
const acceptance = [...history].reverse().find(item => item.attemptId === current.attemptId
|
|
351
|
+
const acceptance = current.executionStatus === 'completed' && current.result?.resultAvailable && [...history].reverse().find(item => item.attemptId === current.attemptId
|
|
322
352
|
&& item.resultRevision === current.result?.resultRevision && item.resultDigest === current.result?.resultDigest);
|
|
323
353
|
return clone({ ...job, attempts: Object.values(this.state.attempts).filter(item => item.jobId === jobId),
|
|
324
354
|
children: Object.values(this.state.jobs).filter(item => item.parentJobRef?.sourceId === this.sourceId && item.parentJobRef.jobId === jobId),
|
|
325
|
-
...(current.result ? { result: current.result } : {}),
|
|
355
|
+
...(current.result ? { result: current.result } : {}), resultHistory: current.resultHistory ?? [],
|
|
356
|
+
...(acceptance ? { businessAcceptance: acceptance } : {}), acceptanceHistory: history });
|
|
326
357
|
}
|
|
327
358
|
list(originSessionId) {
|
|
328
359
|
return Object.values(this.state.jobs).filter(job => job.originSessionId === originSessionId).map(job => this.get(originSessionId, job.jobId));
|
|
@@ -343,8 +374,8 @@ export class JobLedger {
|
|
|
343
374
|
acceptance(originSessionId, jobId, input) {
|
|
344
375
|
return this.mutate(state => {
|
|
345
376
|
const job = this.job(state, originSessionId, jobId), attempt = this.attempt(state, input.attemptId);
|
|
346
|
-
if (attempt.jobId !== jobId || attempt.executionStatus !== 'completed')
|
|
347
|
-
throw new Error('Acceptance must reference
|
|
377
|
+
if (attempt.jobId !== jobId || attempt.attemptId !== job.currentAttemptId || attempt.executionStatus !== 'completed' || !attempt.result?.resultAvailable)
|
|
378
|
+
throw new Error('Acceptance must reference the current completed attempt with an available result');
|
|
348
379
|
nonempty(input.resultRevision, 'resultRevision');
|
|
349
380
|
nonempty(input.resultDigest, 'resultDigest');
|
|
350
381
|
if (attempt.result?.resultRevision !== input.resultRevision || attempt.result?.resultDigest !== input.resultDigest)
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type HumanReviewRequest } from './human-review.js';
|
|
2
3
|
export declare const pptDeliveryInputSchema: z.ZodObject<{
|
|
3
4
|
projectDirectory: z.ZodString;
|
|
4
5
|
projectName: z.ZodString;
|
|
5
6
|
instructions: z.ZodOptional<z.ZodString>;
|
|
6
|
-
slideCount: z.
|
|
7
|
+
slideCount: z.ZodOptional<z.ZodNumber>;
|
|
7
8
|
revisionRequest: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, z.core.$strict>;
|
|
9
10
|
export type PptDeliveryInput = z.infer<typeof pptDeliveryInputSchema>;
|
|
11
|
+
export declare const pptDeliveryRecoveryInputSchema: z.ZodObject<{
|
|
12
|
+
recoveryMode: z.ZodLiteral<"review_only">;
|
|
13
|
+
reviewTargetId: z.ZodString;
|
|
14
|
+
sourceSnapshotDirectory: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type PptDeliveryRecoveryInput = z.infer<typeof pptDeliveryRecoveryInputSchema>;
|
|
10
17
|
export declare const pptDeliveryPolicySchema: z.ZodObject<{
|
|
11
18
|
version: z.ZodDefault<z.ZodString>;
|
|
12
19
|
workspaceRoot: z.ZodString;
|
|
@@ -26,11 +33,17 @@ export declare const pptDeliveryPolicySchema: z.ZodObject<{
|
|
|
26
33
|
runtimeDocument: z.ZodString;
|
|
27
34
|
designSkill: z.ZodString;
|
|
28
35
|
pythonExecutable: z.ZodString;
|
|
36
|
+
roleSkills: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
profilePath: z.ZodString;
|
|
38
|
+
cacheRoot: z.ZodString;
|
|
39
|
+
}, z.core.$strict>>;
|
|
29
40
|
nodeExecutable: z.ZodOptional<z.ZodString>;
|
|
30
41
|
nodeModuleRoot: z.ZodOptional<z.ZodString>;
|
|
31
42
|
maxRevisionRounds: z.ZodDefault<z.ZodNumber>;
|
|
32
43
|
maxExecutionRetries: z.ZodDefault<z.ZodNumber>;
|
|
33
44
|
maxDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
45
|
+
requireHumanReview: z.ZodDefault<z.ZodBoolean>;
|
|
46
|
+
humanReviewerId: z.ZodDefault<z.ZodString>;
|
|
34
47
|
httpTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
35
48
|
}, z.core.$strict>;
|
|
36
49
|
export type PptDeliveryPolicy = z.infer<typeof pptDeliveryPolicySchema>;
|
|
@@ -169,6 +182,8 @@ export interface PptDeliveryRun {
|
|
|
169
182
|
};
|
|
170
183
|
resultSummary?: string;
|
|
171
184
|
deliveryReceipt?: Record<string, unknown>;
|
|
185
|
+
/** One parent-task skill lock shared by production, review, retries and recovery. */
|
|
186
|
+
roleSkillLockPath?: string;
|
|
172
187
|
parentUpdatePending?: PptDeliveryParentUpdate;
|
|
173
188
|
projectSnapshot?: {
|
|
174
189
|
gitHead: string;
|
|
@@ -177,6 +192,17 @@ export interface PptDeliveryRun {
|
|
|
177
192
|
};
|
|
178
193
|
scriptDigest?: string;
|
|
179
194
|
sourceManifestDigest?: string;
|
|
195
|
+
scriptRevision?: number;
|
|
196
|
+
humanReviews?: HumanReviewRequest[];
|
|
197
|
+
humanWaitStartedAt?: string;
|
|
198
|
+
humanWaitingMs?: number;
|
|
199
|
+
humanRevisionRounds?: number;
|
|
200
|
+
summaryRevisionPending?: {
|
|
201
|
+
reviewId: string;
|
|
202
|
+
authorJobId: string;
|
|
203
|
+
authorAttemptId: string;
|
|
204
|
+
reasons: string[];
|
|
205
|
+
};
|
|
180
206
|
publicationCheckedAt?: string;
|
|
181
207
|
recovery?: {
|
|
182
208
|
fromAttemptId: string;
|
|
@@ -187,6 +213,11 @@ export interface PptDeliveryRun {
|
|
|
187
213
|
attemptId: string;
|
|
188
214
|
}[];
|
|
189
215
|
validationCheckedAt?: string;
|
|
216
|
+
mode?: 'review_only';
|
|
217
|
+
artifactDigest?: string;
|
|
218
|
+
reviewTargetId?: string;
|
|
219
|
+
sourceSnapshotDirectory?: string;
|
|
220
|
+
previousElapsedMs?: number;
|
|
190
221
|
};
|
|
191
222
|
}
|
|
192
223
|
export interface PptDeliveryParentUpdate {
|
|
@@ -211,9 +242,11 @@ export interface PptDeliveryAdapter {
|
|
|
211
242
|
preflightPublication?(run: PptDeliveryRun): Promise<void>;
|
|
212
243
|
now?(): number;
|
|
213
244
|
}
|
|
214
|
-
export declare
|
|
245
|
+
export declare const scriptRevisionName: (run: PptDeliveryRun) => string;
|
|
246
|
+
export declare const scriptDirectory: (run: PptDeliveryRun) => string;
|
|
247
|
+
export declare function assertPptDeliveryRecoverable(previous: PptDeliveryRun, input?: PptDeliveryRecoveryInput): void;
|
|
215
248
|
/** Explicit new parent execution round at a verified review checkpoint; old rounds remain immutable. */
|
|
216
|
-
export declare function recoverPptDeliveryRun(previous: PptDeliveryRun, attemptId: string): Promise<PptDeliveryRun>;
|
|
249
|
+
export declare function recoverPptDeliveryRun(previous: PptDeliveryRun, attemptId: string, input?: PptDeliveryRecoveryInput): Promise<PptDeliveryRun>;
|
|
217
250
|
export declare function createPptDeliveryRun(input: {
|
|
218
251
|
sourceId: string;
|
|
219
252
|
jobId: string;
|