@akagilnc/pi-workflow-roles 0.1.5368 → 0.1.5382

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 (188) hide show
  1. package/dist/acp-host/production-host.js +1192 -1195
  2. package/dist/activation-ledger-git.js +2 -2
  3. package/dist/activation-ledger-topology.js +1 -7
  4. package/dist/analyst-entry.js +4 -8
  5. package/dist/analyst-gate-cycles-read.js +3 -11
  6. package/dist/analyst-index.js +3 -9
  7. package/dist/analyst-ledger.js +1 -11
  8. package/dist/analyst-metric-families/acceptance-success-rework.js +1 -3
  9. package/dist/analyst-metric-families/round-timeline.js +1 -3
  10. package/dist/analyst-page.js +2 -2
  11. package/dist/archivist-record-topology.js +2 -2
  12. package/dist/audit-escalation.js +2 -1
  13. package/dist/auditor-soul.js +2 -1
  14. package/dist/collector-config.js +6 -8
  15. package/dist/collector-tool-schemas.js +18 -0
  16. package/dist/compliance-transport.js +2 -1
  17. package/dist/countersign-contracts.js +2 -1
  18. package/dist/diarist-contracts.js +29 -2
  19. package/dist/doctor-contracts.js +1 -3
  20. package/dist/doctor-evidence.js +7 -8
  21. package/dist/dossier-resolution.js +1 -3
  22. package/dist/engine-detour-usage.js +1 -3
  23. package/dist/filed-submission.js +28 -0
  24. package/dist/gatekeeper-role.js +8 -19
  25. package/dist/gleaner-left-contracts.js +18 -1
  26. package/dist/headless-host/description.js +14 -17
  27. package/dist/headless-host/production-host.js +1210 -1215
  28. package/dist/host-session-record.js +3 -2
  29. package/dist/inspector-contracts.js +2 -1
  30. package/dist/judge-role.js +8 -16
  31. package/dist/ledger-session-read.js +1 -3
  32. package/dist/merger-contracts.js +9 -9
  33. package/dist/migrate-book-topology.js +610 -321
  34. package/dist/navigator-attendance.js +9 -11
  35. package/dist/navigator-invocation-identity.js +3 -2
  36. package/dist/navigator-public-session.js +3 -5
  37. package/dist/navigator-session-contracts.js +8 -10
  38. package/dist/navigator-work-base.js +5 -8
  39. package/dist/notary-contracts.js +3 -5
  40. package/dist/package-contracts/auditor-output.js +1 -3
  41. package/dist/package-contracts/fixer-packet.js +3 -6
  42. package/dist/package-contracts/gatekeeper-output.js +1 -3
  43. package/dist/package-contracts/navigator-output.js +8 -8
  44. package/dist/package-contracts/reviewer-output.js +16 -0
  45. package/dist/package-contracts/terminating-infrastructure.js +5 -9
  46. package/dist/package-contracts/terminating-tools.js +4 -3
  47. package/dist/package-contracts/worker-output.js +18 -2
  48. package/dist/public-cli/analyst-run.js +3 -2
  49. package/dist/public-cli/auto-resume.js +3 -8
  50. package/dist/public-cli/cli.js +9 -8
  51. package/dist/public-cli/config.js +8 -11
  52. package/dist/public-cli/countersign-run.js +1 -3
  53. package/dist/public-cli/host-providers.js +7 -14
  54. package/dist/public-cli/instruction-seat-run.js +12 -14
  55. package/dist/public-cli/invocation.js +9 -8
  56. package/dist/public-cli/main.js +1820 -1599
  57. package/dist/public-cli/post-admission.js +4 -3
  58. package/dist/public-cli/run-lifecycle.js +14 -26
  59. package/dist/public-cli/settlement.js +10 -26
  60. package/dist/public-role-summons.js +3 -2
  61. package/dist/receipt-delivery-policy.js +1 -3
  62. package/dist/role-run-placement.js +3 -5
  63. package/dist/role-run-relocation.js +12 -19
  64. package/dist/role-submission-declarations.js +131 -0
  65. package/dist/run-terminal-artifacts.js +1 -11
  66. package/dist/run-ticket-number.js +2 -4
  67. package/dist/secretariat-contracts.js +23 -1
  68. package/dist/session-assistant-usage.js +2 -1
  69. package/dist/session-dialogue.js +1 -14
  70. package/dist/sitian-reader.js +2 -4
  71. package/dist/submission-correctable-error.js +2 -1
  72. package/dist/submission-errors.js +2 -1
  73. package/dist/submission-gate.js +6 -8
  74. package/dist/submission-ledger.js +4 -5
  75. package/dist/ticket-provenance-contracts.js +1 -3
  76. package/dist/ticket-provenance.js +2 -1
  77. package/dist/typed-provider-http.js +4 -7
  78. package/dist/unknown-value.js +28 -0
  79. package/dist/user-dialogue-stdin.js +2 -1
  80. package/package.json +1 -1
  81. package/src/acp-host/role-turn-host.ts +4 -2
  82. package/src/activation-ledger-git.ts +3 -2
  83. package/src/activation-ledger-topology.ts +4 -12
  84. package/src/analyst-entry.ts +3 -11
  85. package/src/analyst-gate-cycles-read.ts +3 -15
  86. package/src/analyst-index.ts +3 -13
  87. package/src/analyst-ledger.ts +2 -16
  88. package/src/analyst-metric-families/acceptance-success-rework.ts +2 -4
  89. package/src/analyst-metric-families/round-timeline.ts +2 -4
  90. package/src/analyst-page.ts +2 -2
  91. package/src/archivist-record-topology.ts +2 -2
  92. package/src/audit-escalation.ts +2 -1
  93. package/src/auditor-role.ts +2 -8
  94. package/src/auditor-soul.ts +3 -1
  95. package/src/book-topology-migration-placement.ts +5 -16
  96. package/src/book-topology-migrators-t11.ts +16 -15
  97. package/src/book-topology-mixed-volume-migrators.ts +3 -6
  98. package/src/book-topology-record-class-migrators.ts +7 -10
  99. package/src/book-topology-runs-migrator.ts +4 -3
  100. package/src/collector-config.ts +7 -9
  101. package/src/collector-role.ts +5 -28
  102. package/src/compliance-transport.ts +2 -1
  103. package/src/countersign-contracts.ts +2 -1
  104. package/src/countersign-role.ts +2 -7
  105. package/src/diarist-contracts.ts +40 -2
  106. package/src/diarist-role.ts +4 -44
  107. package/src/doctor-contracts.ts +3 -1
  108. package/src/doctor-evidence.ts +8 -7
  109. package/src/doctor-role.ts +20 -13
  110. package/src/dossier-resolution.ts +2 -4
  111. package/src/engine-detour-tool.ts +0 -2
  112. package/src/engine-detour-usage.ts +2 -4
  113. package/src/external-host-turn-loop.ts +3 -1
  114. package/src/factory-board.ts +1 -8
  115. package/src/filed-submission.ts +44 -0
  116. package/src/gatekeeper-role.ts +8 -24
  117. package/src/gleaner-left-contracts.ts +29 -2
  118. package/src/gleaner-left-role.ts +4 -32
  119. package/src/headless-host/description.ts +15 -18
  120. package/src/headless-host/role-turn-host.ts +10 -9
  121. package/src/host-session-record.ts +4 -2
  122. package/src/inspector-contracts.ts +2 -1
  123. package/src/inspector-role.ts +2 -7
  124. package/src/judge-role.ts +12 -24
  125. package/src/ledger-session-read.ts +2 -5
  126. package/src/merger-contracts.ts +10 -9
  127. package/src/merger-role.ts +5 -8
  128. package/src/navigator-attendance.ts +10 -12
  129. package/src/navigator-invocation-identity.ts +3 -2
  130. package/src/navigator-public-session.ts +4 -6
  131. package/src/navigator-role.ts +2 -8
  132. package/src/navigator-session-contracts.ts +8 -11
  133. package/src/navigator-work-base.ts +5 -8
  134. package/src/navigator-work-context.ts +2 -1
  135. package/src/notary-contracts.ts +4 -6
  136. package/src/notary-role.ts +5 -20
  137. package/src/oauth-keepalive.ts +5 -18
  138. package/src/package-contracts/auditor-output.ts +2 -4
  139. package/src/package-contracts/fixer-packet.ts +4 -6
  140. package/src/package-contracts/gatekeeper-output.ts +2 -4
  141. package/src/package-contracts/judge-output.ts +0 -1
  142. package/src/package-contracts/navigator-output.ts +8 -8
  143. package/src/package-contracts/reviewer-output.ts +25 -0
  144. package/src/package-contracts/terminating-infrastructure.ts +6 -20
  145. package/src/package-contracts/terminating-tools.ts +8 -12
  146. package/src/package-contracts/worker-output.ts +43 -5
  147. package/src/pi/adapter.ts +0 -1
  148. package/src/pi/role-turn-host.ts +0 -1
  149. package/src/public-cli/analyst-run.ts +4 -2
  150. package/src/public-cli/auto-resume.ts +4 -11
  151. package/src/public-cli/cli.ts +10 -10
  152. package/src/public-cli/config.ts +8 -27
  153. package/src/public-cli/countersign-run.ts +2 -4
  154. package/src/public-cli/host-providers.ts +10 -27
  155. package/src/public-cli/instruction-seat-run.ts +14 -15
  156. package/src/public-cli/invocation.ts +11 -10
  157. package/src/public-cli/post-admission.ts +5 -3
  158. package/src/public-cli/run-lifecycle.ts +20 -41
  159. package/src/public-cli/settlement.ts +11 -33
  160. package/src/public-role-summons.ts +4 -3
  161. package/src/receipt-delivery-policy.ts +1 -4
  162. package/src/reviewer-role.ts +7 -36
  163. package/src/role-envelope.ts +5 -3
  164. package/src/role-run-placement.ts +4 -10
  165. package/src/role-run-relocation.ts +13 -23
  166. package/src/role-runtime.ts +16 -50
  167. package/src/role-submission-declarations.ts +143 -0
  168. package/src/run-terminal-artifacts.ts +2 -16
  169. package/src/run-ticket-number.ts +4 -10
  170. package/src/secretariat-contracts.ts +35 -0
  171. package/src/secretariat-role.ts +4 -40
  172. package/src/session-assistant-usage.ts +3 -1
  173. package/src/session-dialogue.ts +1 -4
  174. package/src/session-identity.ts +0 -1
  175. package/src/sitian-reader.ts +2 -4
  176. package/src/submission-correctable-error.ts +3 -1
  177. package/src/submission-errors.ts +2 -1
  178. package/src/submission-gate.ts +10 -9
  179. package/src/submission-ledger.ts +5 -6
  180. package/src/ticket-provenance-contracts.ts +1 -4
  181. package/src/ticket-provenance.ts +3 -1
  182. package/src/ticket-snapshot.ts +2 -4
  183. package/src/ticket-trajectory.ts +1 -8
  184. package/src/typed-provider-http.ts +5 -15
  185. package/src/unknown-value.ts +34 -0
  186. package/src/user-dialogue-stdin.ts +3 -1
  187. package/src/worker-role.ts +63 -83
  188. package/src/worker-submission-gates.ts +8 -7
@@ -1,4 +1,20 @@
1
+ import { Type } from "typebox";
2
+ import { openToolObject } from "./open-tool-schema.js";
3
+ import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.js";
4
+ import { isRecord } from "./unknown-value.js";
1
5
  const GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
6
+ const gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
7
+ openToolObject(
8
+ Type.Object({
9
+ status: Type.Unknown({
10
+ description: "completed"
11
+ }),
12
+ findings: Type.Unknown({
13
+ description: "\u5F39\u7AE0\u5217\u8868\uFF1B\u6BCF\u6761\u53EF\u542B pointer\uFF08\u6587\u4EF6/\u884C\u6307\u9488\uFF09\u4E0E statement\uFF08\u7591\u70B9\u9648\u8FF0\uFF09\uFF0C\u539F\u6837\u7559\u5B58\u3002\u7A7A\u5217\u8868\u5408\u6CD5\u5B8C\u5C40\uFF1B\u673A\u5668\u4E0D\u5224\u5F39\u7AE0\u662F\u5426\u6210\u7ACB\u3002"
14
+ })
15
+ })
16
+ )
17
+ );
2
18
  const GLEANER_LEFT_BASE_FLAG = {
3
19
  name: "ak-gleaner-left-base",
4
20
  definition: {
@@ -7,7 +23,7 @@ const GLEANER_LEFT_BASE_FLAG = {
7
23
  }
8
24
  };
9
25
  function validateRecordedGleanerLeftOutput(value) {
10
- if (value === null || typeof value !== "object" || Array.isArray(value)) {
26
+ if (!isRecord(value)) {
11
27
  throw new Error("Gleaner-left output has no execution discriminator");
12
28
  }
13
29
  let status;
@@ -24,5 +40,6 @@ function validateRecordedGleanerLeftOutput(value) {
24
40
  export {
25
41
  GLEANER_LEFT_BASE_FLAG,
26
42
  GLEANER_LEFT_OUTPUT_TOOL_NAME,
43
+ gleanerLeftOutputSchema,
27
44
  validateRecordedGleanerLeftOutput
28
45
  };
@@ -1,3 +1,4 @@
1
+ import { isRecord } from "../unknown-value.js";
1
2
  export function isClaudePrintDescription(description) {
2
3
  return description.protocol === "claude-print";
3
4
  }
@@ -89,7 +90,7 @@ const CODEX_JSON_VALUE_SCHEMA = Object.freeze({
89
90
  */
90
91
  export function closeJsonSchemaForCodex(schema) {
91
92
  const closed = closeSchemaNode(schema);
92
- const existingDefs = isPlainObject(closed.$defs)
93
+ const existingDefs = isRecord(closed.$defs)
93
94
  ? closed.$defs
94
95
  : {};
95
96
  return {
@@ -100,13 +101,9 @@ export function closeJsonSchemaForCodex(schema) {
100
101
  },
101
102
  };
102
103
  }
103
- /** Shared plain-object guard for headless host schema/event reduction. */
104
- export function isPlainObject(value) {
105
- return typeof value === "object" && value !== null && !Array.isArray(value);
106
- }
107
104
  /** Pure null leaf only — composite type|null is stripped in-leaf, not dropped whole. */
108
105
  function isPureNullTypeSchema(value) {
109
- if (!isPlainObject(value))
106
+ if (!isRecord(value))
110
107
  return false;
111
108
  if (value.type === "null")
112
109
  return true;
@@ -120,7 +117,7 @@ function isPureNullTypeSchema(value) {
120
117
  * Required edges keep the non-null type(s); optional edges re-add null once.
121
118
  */
122
119
  function stripNullFromLeafType(leaf) {
123
- if (!isPlainObject(leaf) || !Array.isArray(leaf.type))
120
+ if (!isRecord(leaf) || !Array.isArray(leaf.type))
124
121
  return leaf;
125
122
  const nonNull = leaf.type.filter((t) => t !== "null");
126
123
  if (nonNull.length === leaf.type.length)
@@ -137,7 +134,7 @@ function stripNullFromLeafType(leaf) {
137
134
  * lack `type`; strict structured output rejects those intermediate nodes.
138
135
  */
139
136
  function flattenUnionLeaves(schema) {
140
- if (!isPlainObject(schema))
137
+ if (!isRecord(schema))
141
138
  return [schema];
142
139
  if (Array.isArray(schema.anyOf)) {
143
140
  return schema.anyOf.flatMap(flattenUnionLeaves);
@@ -155,7 +152,7 @@ function nonNullLeaves(schema) {
155
152
  * Required → closed non-null leaf(s). Optional → closed leaf(s) + null.
156
153
  */
157
154
  function closePropertySchema(schema, optional) {
158
- const description = isPlainObject(schema) && typeof schema.description === "string"
155
+ const description = isRecord(schema) && typeof schema.description === "string"
159
156
  ? { description: schema.description }
160
157
  : {};
161
158
  const leaves = nonNullLeaves(schema).map(closeSchemaNode);
@@ -165,10 +162,10 @@ function closePropertySchema(schema, optional) {
165
162
  const closed = leaves.length === 1 ? leaves[0] : { anyOf: leaves };
166
163
  // Codex strict does not allow sibling keys on $ref; put property guidance
167
164
  // on an enclosing schema instead of losing it or weakening the free-JSON ref.
168
- if (isPlainObject(closed) && typeof closed.$ref === "string") {
165
+ if (isRecord(closed) && typeof closed.$ref === "string") {
169
166
  return { anyOf: [closed], ...description };
170
167
  }
171
- return isPlainObject(closed) ? { ...closed, ...description } : closed;
168
+ return isRecord(closed) ? { ...closed, ...description } : closed;
172
169
  }
173
170
  return { anyOf: [...leaves, { type: "null" }], ...description };
174
171
  }
@@ -182,7 +179,7 @@ function ensureTypedLeaf(schema) {
182
179
  return schema;
183
180
  if (typeof schema.$ref === "string")
184
181
  return schema;
185
- if (isPlainObject(schema.properties) || schema.additionalProperties !== undefined) {
182
+ if (isRecord(schema.properties) || schema.additionalProperties !== undefined) {
186
183
  return { ...schema, type: "object" };
187
184
  }
188
185
  if (schema.items !== undefined) {
@@ -211,7 +208,7 @@ function originalRequiredNames(node) {
211
208
  return new Set(node.required.filter((item) => typeof item === "string"));
212
209
  }
213
210
  function closeSchemaNode(node) {
214
- if (!isPlainObject(node))
211
+ if (!isRecord(node))
215
212
  return node;
216
213
  // Already a ref (free-JSON leaf or pre-existing) — do not retype.
217
214
  if (typeof node.$ref === "string")
@@ -229,10 +226,10 @@ function closeSchemaNode(node) {
229
226
  if (node.items !== undefined) {
230
227
  out.items = closeSchemaNode(node.items);
231
228
  }
232
- if (isPlainObject(node.$defs)) {
229
+ if (isRecord(node.$defs)) {
233
230
  out.$defs = Object.fromEntries(Object.entries(node.$defs).map(([key, value]) => [key, closeSchemaNode(value)]));
234
231
  }
235
- const hasProperties = isPlainObject(node.properties);
232
+ const hasProperties = isRecord(node.properties);
236
233
  const isObjectType = node.type === "object"
237
234
  || (Array.isArray(node.type) && node.type.includes("object"))
238
235
  || hasProperties
@@ -273,11 +270,11 @@ function closeSchemaNode(node) {
273
270
  function stringEnvironment(value) {
274
271
  const entries = Array.isArray(value)
275
272
  ? value.flatMap((item) => {
276
- if (!isPlainObject(item) || typeof item.name !== "string" || typeof item.value !== "string")
273
+ if (!isRecord(item) || typeof item.name !== "string" || typeof item.value !== "string")
277
274
  return [];
278
275
  return [[item.name, item.value]];
279
276
  })
280
- : isPlainObject(value)
277
+ : isRecord(value)
281
278
  ? Object.entries(value).filter((entry) => typeof entry[1] === "string")
282
279
  : [];
283
280
  return entries.length === 0 ? undefined : Object.fromEntries(entries);