@akagilnc/pi-workflow-roles 0.1.3749 → 0.1.3771

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.
Files changed (49) hide show
  1. package/CLAUDE.md +4 -0
  2. package/README.md +3 -2
  3. package/README.zh-CN.md +3 -2
  4. package/dist/acp-host/production-host.js +1389 -751
  5. package/dist/collector-config.js +0 -1
  6. package/dist/collector-github.js +199 -2
  7. package/dist/collector-identity.js +128 -41
  8. package/dist/collector-ledger.js +38 -9
  9. package/dist/collector-receipt.js +19 -7
  10. package/dist/collector-role.js +330 -369
  11. package/dist/collector-target.js +169 -0
  12. package/dist/collector-tool-schemas.js +51 -14
  13. package/dist/package-contracts/collector-output.js +32 -0
  14. package/dist/package-contracts/terminating-infrastructure.js +13 -12
  15. package/dist/pi/role-turn-host.js +1 -2
  16. package/dist/public-cli/github-remote.js +45 -0
  17. package/dist/public-cli/invocation.js +53 -54
  18. package/dist/public-cli/main.js +615 -148
  19. package/dist/public-cli/option-definitions.js +6 -4
  20. package/dist/public-cli/run-lifecycle.js +3 -3
  21. package/dist/public-cli/settlement.js +83 -6
  22. package/dist/role-runtime.js +137 -7
  23. package/dist/submission-correctable-error.js +24 -0
  24. package/extensions/role-runtime.ts +0 -1
  25. package/package.json +1 -1
  26. package/souls/coder.md +11 -6
  27. package/souls/fixer.md +10 -9
  28. package/src/acp-host/role-envelope.ts +8 -22
  29. package/src/collector-config.ts +0 -1
  30. package/src/collector-github.ts +236 -2
  31. package/src/collector-identity.ts +148 -40
  32. package/src/collector-ledger.ts +48 -10
  33. package/src/collector-receipt.ts +33 -14
  34. package/src/collector-role.ts +376 -450
  35. package/src/collector-target.ts +207 -0
  36. package/src/collector-tool-schemas.ts +62 -15
  37. package/src/host-contracts.ts +2 -1
  38. package/src/package-contracts/collector-output.ts +72 -0
  39. package/src/package-contracts/terminating-infrastructure.ts +24 -13
  40. package/src/pi/role-turn-host.ts +1 -2
  41. package/src/public-cli/cli.ts +10 -1
  42. package/src/public-cli/collector-run.ts +3 -2
  43. package/src/public-cli/github-remote.ts +45 -0
  44. package/src/public-cli/invocation.ts +60 -59
  45. package/src/public-cli/option-definitions.ts +6 -4
  46. package/src/public-cli/run-lifecycle.ts +2 -2
  47. package/src/public-cli/settlement.ts +82 -6
  48. package/src/role-runtime.ts +166 -13
  49. package/src/submission-correctable-error.ts +38 -0
@@ -32,3 +32,41 @@ export function isCorrectableExecuteError(error: unknown): boolean {
32
32
  || error instanceof WorkerUnfinishedReasonReminderError
33
33
  );
34
34
  }
35
+
36
+ /**
37
+ * Durable projection for ACP envelope tool catches only.
38
+ * Pi path keeps native throw → isError toolResult (no shared projection consumer).
39
+ */
40
+ export type CorrectableExecuteRejectionProjection = {
41
+ readonly diagnostic: string;
42
+ readonly details: Record<string, unknown>;
43
+ };
44
+
45
+ /**
46
+ * One authority for correctable execute → diagnostic text + structured details.
47
+ * Consumed by the ACP envelope tool catch; host adapters wrap transport shape only.
48
+ */
49
+ export function projectCorrectableExecuteRejection(
50
+ error: unknown,
51
+ ): CorrectableExecuteRejectionProjection {
52
+ const diagnostic = error instanceof Error ? error.message : String(error);
53
+ if (error instanceof GatekeeperDecisionError) {
54
+ return { diagnostic, details: { ...(error.result as Record<string, unknown>) } };
55
+ }
56
+ if (
57
+ error instanceof WorkerCommitReminderError
58
+ || error instanceof WorkerPrefixReminderError
59
+ || error instanceof WorkerUnfinishedReasonReminderError
60
+ ) {
61
+ return { diagnostic, details: { code: error.code } };
62
+ }
63
+ if (typeof (error as { code?: unknown }).code === "string") {
64
+ return { diagnostic, details: { code: (error as { code: string }).code } };
65
+ }
66
+ return {
67
+ diagnostic,
68
+ details: {
69
+ code: error instanceof Error && error.name ? error.name : "correctable-submission-error",
70
+ },
71
+ };
72
+ }