@akagilnc/pi-workflow-roles 0.1.4956 → 0.1.4980
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/README.zh-CN.md +4 -4
- package/dist/acp-host/production-host.js +157 -266
- package/dist/audit-escalation.js +19 -3
- package/dist/compliance-transport.js +6 -11
- package/dist/doctor-contracts.js +0 -2
- package/dist/gatekeeper-role.js +5 -3
- package/dist/headless-host/production-host.js +157 -266
- package/dist/migrate-book-topology.js +1 -16
- package/dist/packaged-role-registry.js +0 -24
- package/dist/public-cli/main.js +16 -28
- package/dist/public-cli/settlement.js +8 -1
- package/dist/public-cli/terminal.js +2 -2
- package/dist/secretariat-contracts.js +1 -3
- package/dist/submission-ledger.js +11 -0
- package/package.json +1 -1
- package/src/audit-escalation.ts +26 -5
- package/src/collector-role.ts +1 -5
- package/src/compliance-transport.ts +10 -12
- package/src/doctor-auditor.ts +2 -0
- package/src/doctor-contracts.ts +0 -1
- package/src/doctor-role.ts +4 -4
- package/src/gatekeeper-pass-envelope.ts +7 -10
- package/src/gatekeeper-role.ts +5 -3
- package/src/judge-role.ts +45 -31
- package/src/merger-role.ts +1 -2
- package/src/notary-role.ts +1 -2
- package/src/packaged-role-registry.ts +0 -25
- package/src/public-cli/settlement.ts +10 -1
- package/src/public-cli/terminal.ts +2 -2
- package/src/reviewer-role.ts +1 -2
- package/src/role-runtime.ts +59 -156
- package/src/secretariat-contracts.ts +0 -2
- package/src/secretariat-role.ts +3 -162
- package/src/submission-ledger.ts +18 -0
- package/src/worker-role.ts +42 -24
package/src/worker-role.ts
CHANGED
|
@@ -8,7 +8,9 @@ import type {
|
|
|
8
8
|
AnyCanonicalSkillBinding,
|
|
9
9
|
CanonicalSkillBinding,
|
|
10
10
|
} from "./canonical-skill-binding.ts";
|
|
11
|
-
import {
|
|
11
|
+
import { readableGateItem } from "./readable-gate-item.ts";
|
|
12
|
+
import { projectGatekeeperEscalation } from "./audit-escalation.ts";
|
|
13
|
+
import { GatekeeperDecisionError } from "./submission-errors.ts";
|
|
12
14
|
import {
|
|
13
15
|
CODER_OUTPUT_TOOL_NAME,
|
|
14
16
|
FIXER_OUTPUT_TOOL_NAME,
|
|
@@ -282,20 +284,28 @@ export function createFixerRoleRuntime(
|
|
|
282
284
|
ctx,
|
|
283
285
|
toolCallId,
|
|
284
286
|
);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
287
|
+
let pass;
|
|
288
|
+
try {
|
|
289
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output))
|
|
290
|
+
? await pi.requireGatekeeperPass!({
|
|
291
|
+
context: ctx,
|
|
292
|
+
subject: { kind: "worker_completion" },
|
|
293
|
+
...(_signal === undefined ? {} : { signal: _signal }),
|
|
294
|
+
hostActions,
|
|
295
|
+
toolCallId,
|
|
296
|
+
// #879: this-turn typed payload — identity-bound at submit site.
|
|
297
|
+
submission: output,
|
|
298
|
+
})
|
|
299
|
+
: undefined;
|
|
300
|
+
} catch (error) {
|
|
301
|
+
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
302
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
303
|
+
}
|
|
304
|
+
throw error;
|
|
295
305
|
}
|
|
296
306
|
const acceptedDetails = output;
|
|
297
307
|
return {
|
|
298
|
-
content: [{ type: "text" as const, text:
|
|
308
|
+
content: pass === undefined ? [] : [{ type: "text" as const, text: readableGateItem(pass.receipt) }],
|
|
299
309
|
details: acceptedDetails,
|
|
300
310
|
terminate: true as const,
|
|
301
311
|
};
|
|
@@ -407,7 +417,7 @@ export function createCoderRoleRuntime(
|
|
|
407
417
|
description: "提交将作监终局回执;本工具无 escalate 通道。",
|
|
408
418
|
promptSnippet: "提交将作监终局回执",
|
|
409
419
|
parameters: coderOutputSchema,
|
|
410
|
-
async execute(toolCallId: string, parameters: unknown, _signal: AbortSignal | undefined, _onUpdate: unknown, ctx: HostContext) {
|
|
420
|
+
async execute(toolCallId: string, parameters: unknown, _signal: AbortSignal | undefined, _onUpdate: unknown, ctx: HostContext): Promise<HostToolResult<unknown>> {
|
|
411
421
|
if (task === undefined || phase === undefined) {
|
|
412
422
|
throw new Error("将作监任务与阶段未装载");
|
|
413
423
|
}
|
|
@@ -422,20 +432,28 @@ export function createCoderRoleRuntime(
|
|
|
422
432
|
ctx,
|
|
423
433
|
toolCallId,
|
|
424
434
|
);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
+
let pass;
|
|
436
|
+
try {
|
|
437
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output))
|
|
438
|
+
? await pi.requireGatekeeperPass!({
|
|
439
|
+
context: ctx,
|
|
440
|
+
subject: { kind: "worker_completion" },
|
|
441
|
+
...(_signal === undefined ? {} : { signal: _signal }),
|
|
442
|
+
hostActions,
|
|
443
|
+
toolCallId,
|
|
444
|
+
// #879: this-turn typed payload — identity-bound at submit site.
|
|
445
|
+
submission: output,
|
|
446
|
+
})
|
|
447
|
+
: undefined;
|
|
448
|
+
} catch (error) {
|
|
449
|
+
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
450
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
451
|
+
}
|
|
452
|
+
throw error;
|
|
435
453
|
}
|
|
436
454
|
const acceptedDetails = output;
|
|
437
455
|
return {
|
|
438
|
-
content: [{ type: "text" as const, text:
|
|
456
|
+
content: pass === undefined ? [] : [{ type: "text" as const, text: readableGateItem(pass.receipt) }],
|
|
439
457
|
details: acceptedDetails,
|
|
440
458
|
terminate: true as const,
|
|
441
459
|
};
|