@unbrained/pm-cli 2026.9.3 → 2026.9.5

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 (228) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
  2. package/.agents/skills/README.md +2 -2
  3. package/.agents/skills/pm-developer/SKILL.md +4 -1
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +10 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +3 -1
  6. package/.agents/skills/pm-extensions/SKILL.md +2 -2
  7. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +3 -3
  8. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +3 -3
  9. package/.agents/skills/pm-user/SKILL.md +2 -0
  10. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +5 -0
  11. package/.agents/skills/pm-user/references/WORKFLOWS.md +20 -5
  12. package/.claude-plugin/marketplace.json +2 -2
  13. package/CHANGELOG.md +52 -0
  14. package/dist/cli/commander-usage.d.ts +2 -0
  15. package/dist/cli/commander-usage.js +15 -12
  16. package/dist/cli/help-json-payload.js +12 -7
  17. package/dist/cli/main.js +15 -6
  18. package/dist/cli/register-list-query.js +4 -2
  19. package/dist/cli/register-mutation.js +4 -2
  20. package/dist/cli/register-operations.js +6 -2
  21. package/dist/cli-bundle/bundle-manifest.json +154 -154
  22. package/dist/cli-bundle/chunks/{chunk-EDPIS7EB.js → chunk-3HBDTJRK.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-66VPKFP2.js +5 -0
  24. package/dist/cli-bundle/chunks/{chunk-Y4PJ6HPK.js → chunk-HUAQITVW.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-DKGP3QLE.js → chunk-IBYREGSP.js} +2 -2
  26. package/dist/cli-bundle/chunks/chunk-LUI4E32I.js +231 -0
  27. package/dist/cli-bundle/chunks/{chunk-UPPM2FOZ.js → chunk-QPZHQY2O.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-34HASX3S.js → chunk-SF6SM6U5.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-SVK5Y64D.js +40 -0
  30. package/dist/cli-bundle/chunks/chunk-V5GBD5KV.js +9 -0
  31. package/dist/cli-bundle/chunks/{chunk-LENC656S.js → chunk-WWAEGW4V.js} +67 -70
  32. package/dist/cli-bundle/chunks/chunk-ZRAQS3UA.js +8 -0
  33. package/dist/cli-bundle/chunks/{register-list-query-W2ZTOMKP.js → register-list-query-AYKGODWT.js} +3 -3
  34. package/dist/cli-bundle/chunks/{register-mutation-RVND5NCG.js → register-mutation-YZYG53SQ.js} +4 -4
  35. package/dist/cli-bundle/chunks/register-operations-KFSCC7QV.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-D3ZFHY3L.js → register-setup-UJCRVGBG.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-24IG6ONG.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-M5M6SVHS.js → chunk-3ASU6WGI.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-3ITLIBKS.js +56 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-3NQD5YDG.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-S27XMBIN.js → chunk-4OSHLNUE.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-65N6JHAN.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-5RFXUPN5.js → chunk-B2TTQGFG.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-GUBM3RGY.js +20 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-Q45NHPF2.js → chunk-H5FOGAVD.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-JX3RCVCX.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-D7KXFBXV.js → chunk-KWWCBWFO.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-MV752SUC.js +12 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-PKIPMCFS.js +6 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-4HJFY4MB.js → chunk-QL66QNWG.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/chunk-RJMR2JIF.js +9 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-WIUPWIZR.js +177 -0
  53. package/dist/cli-bundle/focused-chunks/chunk-WOCIPMW7.js +2 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-GT7MXDLW.js → chunk-YEF5PQQ2.js} +2 -2
  55. package/dist/cli-bundle/main.js +22 -15
  56. package/dist/cli-bundle/sdk-authoring.js +1 -1
  57. package/dist/cli-bundle/sdk-contracts.js +1 -1
  58. package/dist/cli-bundle/sdk-core.js +29 -32
  59. package/dist/cli-bundle/sdk-governance.js +1 -1
  60. package/dist/cli-bundle/sdk-graph.js +1 -1
  61. package/dist/cli-bundle/sdk-merge.js +45 -37
  62. package/dist/cli-bundle/sdk-query.js +1 -1
  63. package/dist/cli-bundle/sdk-runtime.js +1 -1
  64. package/dist/cli-bundle/sdk-testing.js +1 -1
  65. package/dist/cli-bundle/sdk.js +10 -10
  66. package/dist/core/diagnostics/remediation.js +4 -4
  67. package/dist/core/extensions/extension-types.d.ts +2 -0
  68. package/dist/core/extensions/extension-types.js +2 -2
  69. package/dist/core/history/drift-scan.d.ts +5 -0
  70. package/dist/core/history/drift-scan.js +16 -6
  71. package/dist/core/history/event-classification.d.ts +1 -1
  72. package/dist/core/history/event-classification.js +3 -2
  73. package/dist/core/history/history.d.ts +37 -1
  74. package/dist/core/history/history.js +311 -59
  75. package/dist/core/history/identity.d.ts +15 -0
  76. package/dist/core/history/identity.js +31 -0
  77. package/dist/core/history/projection.js +50 -17
  78. package/dist/core/history/read.js +6 -3
  79. package/dist/core/history/replay.d.ts +1 -2
  80. package/dist/core/history/replay.js +70 -36
  81. package/dist/core/history/version-address.d.ts +13 -0
  82. package/dist/core/history/version-address.js +33 -0
  83. package/dist/core/item/actionability.d.ts +21 -1
  84. package/dist/core/item/actionability.js +45 -10
  85. package/dist/core/item/id.js +8 -4
  86. package/dist/core/item/item-type-definition.d.ts +2 -0
  87. package/dist/core/item/item-type-definition.js +9 -2
  88. package/dist/core/item/type-registry.d.ts +5 -1
  89. package/dist/core/item/type-registry.js +9 -4
  90. package/dist/core/lock/lock.d.ts +10 -0
  91. package/dist/core/lock/lock.js +42 -3
  92. package/dist/core/shared/author.d.ts +3 -1
  93. package/dist/core/shared/author.js +111 -23
  94. package/dist/core/shared/errors.d.ts +8 -0
  95. package/dist/core/shared/errors.js +2 -2
  96. package/dist/core/store/item-store.d.ts +14 -0
  97. package/dist/core/store/item-store.js +48 -10
  98. package/dist/core/store/settings-validator.js +3 -2
  99. package/dist/sdk/actionability.d.ts +1 -1
  100. package/dist/sdk/actionability.js +3 -3
  101. package/dist/sdk/cli-contracts/command-aliases.js +11 -2
  102. package/dist/sdk/cli-contracts/completeness.js +4 -3
  103. package/dist/sdk/cli-contracts/flag-contracts.js +29 -5
  104. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +19 -12
  105. package/dist/sdk/cli-contracts/tool-parameter-tables.js +14 -2
  106. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  107. package/dist/sdk/cli-contracts/tool-schema.js +19 -6
  108. package/dist/sdk/context-intent-contracts.js +3 -3
  109. package/dist/sdk/context-usage.js +9 -11
  110. package/dist/sdk/define.d.ts +1 -1
  111. package/dist/sdk/define.js +2 -2
  112. package/dist/sdk/environment/agent-environment.d.ts +296 -0
  113. package/dist/sdk/environment/agent-environment.js +467 -0
  114. package/dist/sdk/environment/project-runtime-compatibility.d.ts +19 -1
  115. package/dist/sdk/environment/project-runtime-compatibility.js +118 -21
  116. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +98 -38
  117. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
  118. package/dist/sdk/governance/health.js +13 -44
  119. package/dist/sdk/governance/merge-receipt-history.d.ts +62 -0
  120. package/dist/sdk/governance/merge-receipt-history.js +207 -0
  121. package/dist/sdk/governance/provenance-health.js +9 -3
  122. package/dist/sdk/governance/validate-history-drift.js +16 -5
  123. package/dist/sdk/guide-topics.js +116 -2
  124. package/dist/sdk/history/salvage.d.ts +35 -0
  125. package/dist/sdk/history/salvage.js +248 -0
  126. package/dist/sdk/history-compact.js +41 -37
  127. package/dist/sdk/history-read.d.ts +3 -2
  128. package/dist/sdk/history-read.js +6 -3
  129. package/dist/sdk/history-redact.js +58 -23
  130. package/dist/sdk/history-repair.d.ts +5 -0
  131. package/dist/sdk/history-repair.js +28 -6
  132. package/dist/sdk/index.d.ts +2 -0
  133. package/dist/sdk/index.js +4 -2
  134. package/dist/sdk/lifecycle/claim.d.ts +4 -0
  135. package/dist/sdk/lifecycle/claim.js +9 -3
  136. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  137. package/dist/sdk/lifecycle/restore.js +19 -7
  138. package/dist/sdk/merge/driver.d.ts +3 -1
  139. package/dist/sdk/merge/driver.js +9 -9
  140. package/dist/sdk/merge/index.d.ts +1 -1
  141. package/dist/sdk/merge/index.js +3 -3
  142. package/dist/sdk/merge/receipts.d.ts +17 -6
  143. package/dist/sdk/merge/receipts.js +246 -75
  144. package/dist/sdk/merge/reconcile.d.ts +9 -7
  145. package/dist/sdk/merge/reconcile.js +175 -12
  146. package/dist/sdk/merge/three-way.d.ts +22 -2
  147. package/dist/sdk/merge/three-way.js +92 -25
  148. package/dist/sdk/output-projection.d.ts +3 -1
  149. package/dist/sdk/output-projection.js +11 -3
  150. package/dist/sdk/public-surface.json +1 -0
  151. package/dist/sdk/query/context.d.ts +9 -0
  152. package/dist/sdk/query/context.js +33 -21
  153. package/dist/sdk/query/get.d.ts +2 -2
  154. package/dist/sdk/query/get.js +4 -3
  155. package/dist/sdk/query/history.d.ts +11 -0
  156. package/dist/sdk/query/history.js +34 -10
  157. package/dist/sdk/query/next.d.ts +15 -1
  158. package/dist/sdk/query/next.js +43 -20
  159. package/dist/sdk/query.d.ts +1 -0
  160. package/dist/sdk/query.js +3 -2
  161. package/dist/sdk/runtime-primitives.d.ts +3 -3
  162. package/dist/sdk/runtime-primitives.js +5 -5
  163. package/dist/types.d.ts +27 -0
  164. package/dist/types.js +2 -2
  165. package/docs/AGENT_ENVIRONMENTS.md +47 -0
  166. package/docs/AGENT_GUIDE.md +36 -0
  167. package/docs/AGENT_PROVENANCE_ADR.md +17 -2
  168. package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +38 -1
  169. package/docs/HISTORY_RECOVERY.md +146 -0
  170. package/docs/MERGE_SAFETY.md +119 -23
  171. package/docs/README.md +2 -0
  172. package/docs/RELEASING.md +25 -11
  173. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +24 -2
  174. package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
  175. package/docs/SDK_EXECUTION_CONTRACTS.md +105 -0
  176. package/docs/SDK_RUNTIME_BOUNDARIES.md +17 -1
  177. package/docs/TESTING.md +5 -0
  178. package/docs/agent-task-token-baseline.json +17 -17
  179. package/docs/agent-task-transcripts.json +2 -1
  180. package/docs/examples/sdk-agent-environment/README.md +14 -0
  181. package/docs/examples/sdk-agent-environment/package.json +8 -0
  182. package/docs/examples/sdk-agent-environment/run-agent-environment.mjs +154 -0
  183. package/docs/generated/FLAG_LEXICON_BUDGETS.md +10 -10
  184. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
  185. package/marketplace.json +2 -2
  186. package/package.json +5 -6
  187. package/packages/pm-beads/package.json +1 -1
  188. package/packages/pm-calendar/package.json +1 -1
  189. package/packages/pm-command-kit/package.json +1 -1
  190. package/packages/pm-digital-twin/package.json +1 -1
  191. package/packages/pm-governance-audit/package.json +1 -1
  192. package/packages/pm-guide-shell/package.json +1 -1
  193. package/packages/pm-kanban/package.json +1 -1
  194. package/packages/pm-lifecycle-hooks/package.json +1 -1
  195. package/packages/pm-linked-test-adapters/package.json +1 -1
  196. package/packages/pm-search-advanced/package.json +1 -1
  197. package/packages/pm-templates/package.json +1 -1
  198. package/packages/pm-todos/package.json +1 -1
  199. package/packages/pm-vcs/package.json +1 -1
  200. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  201. package/plugins/pm-claude/skills/pm-audit/SKILL.md +2 -2
  202. package/plugins/pm-claude/skills/pm-developer/SKILL.md +2 -2
  203. package/plugins/pm-claude/skills/pm-planner/SKILL.md +2 -2
  204. package/plugins/pm-claude/skills/pm-release/SKILL.md +2 -2
  205. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +3 -3
  206. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  207. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +2 -2
  208. package/plugins/pm-codex/skills/pm-native/SKILL.md +3 -4
  209. package/plugins/pm-codex/skills/pm-release/SKILL.md +2 -2
  210. package/scripts/finalize-build.mjs +13 -1
  211. package/dist/cli-bundle/chunks/chunk-AY324UJ5.js +0 -9
  212. package/dist/cli-bundle/chunks/chunk-E5RBBCXO.js +0 -230
  213. package/dist/cli-bundle/chunks/chunk-IEHHE6GA.js +0 -5
  214. package/dist/cli-bundle/chunks/chunk-L7B7343B.js +0 -8
  215. package/dist/cli-bundle/chunks/chunk-LISESA7W.js +0 -35
  216. package/dist/cli-bundle/chunks/register-operations-TTROIVC4.js +0 -2
  217. package/dist/cli-bundle/focused-chunks/chunk-3ZBI35HU.js +0 -176
  218. package/dist/cli-bundle/focused-chunks/chunk-4RRHC3S4.js +0 -6
  219. package/dist/cli-bundle/focused-chunks/chunk-4WR46RMG.js +0 -9
  220. package/dist/cli-bundle/focused-chunks/chunk-BWKHEIVF.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-GHCZ3YFR.js +0 -20
  222. package/dist/cli-bundle/focused-chunks/chunk-KBLZRU62.js +0 -2
  223. package/dist/cli-bundle/focused-chunks/chunk-KZ2NB3ET.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-OL5EH6I3.js +0 -2
  225. package/dist/cli-bundle/focused-chunks/chunk-QKHCSUGJ.js +0 -51
  226. package/dist/cli-bundle/focused-chunks/chunk-TXE4TSHM.js +0 -12
  227. package/dist/cli-bundle/focused-chunks/chunk-UCLO3XDU.js +0 -2
  228. package/sdk/public-surface.json +0 -32524
@@ -0,0 +1,296 @@
1
+ import { type WorkspaceRecipe } from "../workspace-recipe.js";
2
+ /** Schema identifier for a portable observation contract. */
3
+ export declare const PM_OBSERVATION_SCHEMA: "pm.agent-observation/v1";
4
+ /** Schema identifier for a deterministic verdict contract. */
5
+ export declare const PM_VERDICT_SCHEMA: "pm.agent-verdict/v1";
6
+ /** Schema identifier for a bounded agent-environment episode. */
7
+ export declare const PM_EPISODE_SCHEMA: "pm.agent-episode/v1";
8
+ /** A JSON-compatible object used as immutable recorded workspace state. */
9
+ export type RecordedStateObject = Readonly<Record<string, unknown>>;
10
+ /** One declared read and its guaranteed token ceiling. */
11
+ export interface ObservationReadDeclaration {
12
+ /** Public SDK or CLI command name used to collect the read. */
13
+ command: string;
14
+ /** Maximum tokens this read may consume. */
15
+ budget_tokens: number;
16
+ }
17
+ /** Emitted-byte calibration for a representative observation corpus. */
18
+ export interface ObservationCalibration {
19
+ /** Stable measurement basis; serialized payload bytes are authoritative. */
20
+ basis: "emitted_bytes";
21
+ /** Historical emitted-byte measurements used to calibrate expectations. */
22
+ samples: readonly number[];
23
+ /** Expected serialized payload size before an observation is served. */
24
+ expected_emitted_bytes: number;
25
+ /** Accepted drift around the expected emitted-byte measurement. */
26
+ tolerance_bytes: number;
27
+ }
28
+ /** Declares whether observation cost varies with corpus size. */
29
+ export type ObservationCorpusDependence = {
30
+ readonly kind: "independent";
31
+ } | {
32
+ readonly kind: "bounded";
33
+ readonly dimension: string;
34
+ readonly maximum: number;
35
+ };
36
+ /** One ordered disclosure tier in an observation degradation ladder. */
37
+ export interface ObservationTier {
38
+ /** Stable tier identity included in every observation receipt. */
39
+ id: string;
40
+ /** Maximum tokens this tier is permitted to emit. */
41
+ max_tokens: number;
42
+ /** Dot-separated recorded-state fields disclosed by the tier. */
43
+ fields: readonly string[];
44
+ }
45
+ /** Portable declaration for a bounded, calibrated observation. */
46
+ export interface ObservationContract {
47
+ /** Versioned schema identity. */
48
+ schema: typeof PM_OBSERVATION_SCHEMA;
49
+ /** Stable contract identity. */
50
+ id: string;
51
+ /** Positive contract revision. */
52
+ version: number;
53
+ /** Reads whose ceilings form the guaranteed collection cost. */
54
+ reads: readonly ObservationReadDeclaration[];
55
+ /** Emitted-byte calibration visible before collection starts. */
56
+ calibration: ObservationCalibration;
57
+ /** Explicit corpus-size dependence of the cost model. */
58
+ corpus_dependence: ObservationCorpusDependence;
59
+ /** Ordered richest-to-smallest degradation ladder. */
60
+ tiers: readonly ObservationTier[];
61
+ }
62
+ /** Pre-call observation-cost description available to schedulers. */
63
+ export interface ObservationCostDescription {
64
+ /** Stable observation identity. */
65
+ contract_id: string;
66
+ /** Observation revision. */
67
+ contract_version: number;
68
+ /** Sum of all declared collection ceilings. */
69
+ guaranteed_ceiling_tokens: number;
70
+ /** Calibrated expected serialized payload size. */
71
+ expected_emitted_bytes: number;
72
+ /** Conservative token estimate derived from emitted bytes. */
73
+ expected_tokens: number;
74
+ /** Accepted emitted-byte calibration drift. */
75
+ tolerance_bytes: number;
76
+ /** Stable calibration basis. */
77
+ calibration_basis: "emitted_bytes";
78
+ /** Declared corpus-size dependence. */
79
+ corpus_dependence: ObservationCorpusDependence;
80
+ }
81
+ /** Audit receipt emitted for every served or refused observation. */
82
+ export interface ObservationReceipt {
83
+ /** Stable observation identity. */
84
+ contract_id: string;
85
+ /** Observation revision. */
86
+ contract_version: number;
87
+ /** Tier whose payload was returned, or null after truthful refusal. */
88
+ served_tier: string | null;
89
+ /** Whether a smaller tier was attempted or served. */
90
+ degraded: boolean;
91
+ /** Tier identities evaluated in deterministic order. */
92
+ attempted_tiers: readonly string[];
93
+ /** Exact serialized payload bytes, or null when nothing was served. */
94
+ emitted_bytes: number | null;
95
+ /** Conservative token estimate, or null when nothing was served. */
96
+ estimated_tokens: number | null;
97
+ /** Stable measurement basis. */
98
+ calibration_basis: "emitted_bytes";
99
+ }
100
+ /** Successful bounded observation with its explicit receipt. */
101
+ export interface ServedObservation<T> {
102
+ /** Discriminator for a payload-bearing response. */
103
+ status: "served";
104
+ /** Payload produced by the declared tier. */
105
+ payload: T;
106
+ /** Cost and degradation evidence. */
107
+ receipt: ObservationReceipt;
108
+ }
109
+ /** Refusal returned when no declared tier can fit the caller's ceiling. */
110
+ export interface RefusedObservation {
111
+ /** Discriminator for a payload-free refusal. */
112
+ status: "refused";
113
+ /** Stable reason callers can route without parsing prose. */
114
+ reason: "no_declared_tier_fits_budget";
115
+ /** Cost and degradation evidence. */
116
+ receipt: ObservationReceipt;
117
+ }
118
+ /** Complete outcome of attempting one declared observation. */
119
+ export type ObservationResult<T> = ServedObservation<T> | RefusedObservation;
120
+ /** Caller-imposed ceiling for one observation response. */
121
+ export interface ObservationRequest {
122
+ /** Maximum response tokens accepted by the caller. */
123
+ budget_tokens: number;
124
+ }
125
+ /** Predicate supported by the versioned total-verdict interpreter. */
126
+ export type VerdictPredicate = {
127
+ readonly id: string;
128
+ readonly kind: "field_equals";
129
+ readonly path: string;
130
+ readonly expected: unknown;
131
+ } | {
132
+ readonly id: string;
133
+ readonly kind: "field_present";
134
+ readonly path: string;
135
+ } | {
136
+ readonly id: string;
137
+ readonly kind: "field_absent";
138
+ readonly path: string;
139
+ };
140
+ /** Declarative composition applied to predicate outcomes. */
141
+ export interface VerdictComposition {
142
+ /** Whether every or at least one referenced predicate must satisfy. */
143
+ operator: "all" | "any";
144
+ /** Ordered predicate identities evaluated by the total verdict. */
145
+ predicate_ids: readonly string[];
146
+ }
147
+ /** Portable named and versioned total-verdict declaration. */
148
+ export interface VerdictContract {
149
+ /** Versioned schema identity. */
150
+ schema: typeof PM_VERDICT_SCHEMA;
151
+ /** Stable contract identity. */
152
+ id: string;
153
+ /** Positive contract revision. */
154
+ version: number;
155
+ /** Predicates evaluated exclusively over recorded state. */
156
+ predicates: readonly VerdictPredicate[];
157
+ /** Explicit deterministic predicate composition. */
158
+ composition: VerdictComposition;
159
+ }
160
+ /** Recorded state and stable snapshot identity supplied by an adapter. */
161
+ export interface WorkspaceRecordedState {
162
+ /** Stable identity of the exact state being evaluated. */
163
+ snapshot_id: string;
164
+ /** Recorded, JSON-compatible project state. */
165
+ state: RecordedStateObject;
166
+ }
167
+ /** Per-predicate evidence in a deterministic total verdict. */
168
+ export interface PredicateVerdict {
169
+ /** Declared predicate identity. */
170
+ id: string;
171
+ /** Whether the predicate is satisfied by recorded state. */
172
+ outcome: "satisfied" | "violated";
173
+ /** Snapshot-qualified JSON pointer to the inspected field. */
174
+ evidence_pointer: string;
175
+ /** Hash of the observed value without duplicating potentially private data. */
176
+ evidence_digest: string;
177
+ }
178
+ /** Total, reproducible result produced by a verdict contract. */
179
+ export interface VerdictResult {
180
+ /** Stable verdict identity. */
181
+ contract_id: string;
182
+ /** Verdict revision. */
183
+ contract_version: number;
184
+ /** Exact recorded-state snapshot evaluated. */
185
+ snapshot_id: string;
186
+ /** Total outcome, including an explicit empty-contract state. */
187
+ outcome: "satisfied" | "violated" | "not_applicable";
188
+ /** Satisfied fraction, or null when no predicates are declared. */
189
+ score: number | null;
190
+ /** Explicitly separates evaluation from reward or learning signals. */
191
+ policy: "verdict_only_no_reward";
192
+ /** Stable explanation for a not-applicable verdict. */
193
+ reason?: "no_predicates_declared";
194
+ /** Ordered predicate evidence. */
195
+ predicates: readonly PredicateVerdict[];
196
+ }
197
+ /** Hard limits enforced within one isolated episode. */
198
+ export interface EpisodeLimits {
199
+ /** Maximum ordinary project-management actions. */
200
+ max_actions: number;
201
+ /** Maximum observations, including the close-time grading read. */
202
+ max_observations: number;
203
+ /** Per-observation response ceiling. */
204
+ max_tokens_per_observation: number;
205
+ }
206
+ /** Portable specification shared by evaluation and training harnesses. */
207
+ export interface EpisodeSpecification {
208
+ /** Versioned schema identity. */
209
+ schema: typeof PM_EPISODE_SCHEMA;
210
+ /** Stable episode identity and session provenance key. */
211
+ id: string;
212
+ /** Positive episode revision. */
213
+ version: number;
214
+ /** Consumer intent without coupling the runtime to a training framework. */
215
+ mode: "benchmark" | "evaluation" | "training" | "scale_transfer";
216
+ /** Deterministic workspace construction recipe. */
217
+ recipe: WorkspaceRecipe;
218
+ /** Canonical pm items that define the task set. */
219
+ task_item_ids: readonly string[];
220
+ /** State fields that observations may disclose. */
221
+ observable_fields: readonly string[];
222
+ /** Grading-only fields that must never enter observations. */
223
+ withheld_fields: readonly string[];
224
+ /** Bounded observation declaration. */
225
+ observation: ObservationContract;
226
+ /** Recorded-state verdict declaration. */
227
+ verdict: VerdictContract;
228
+ /** Hard action and observation limits. */
229
+ limits: EpisodeLimits;
230
+ }
231
+ /** Reset receipt returned by an episode adapter. */
232
+ export interface EpisodeResetReceipt {
233
+ /** Adapter-defined isolated workspace identity. */
234
+ workspace_id: string;
235
+ /** Stable state identity after reset. */
236
+ state_id: string;
237
+ }
238
+ /** Action receipt returned by an episode adapter. */
239
+ export interface EpisodeActionReceipt<TOutput> {
240
+ /** Stable state identity after the action. */
241
+ state_id: string;
242
+ /** Adapter-defined ordinary command result. */
243
+ output: TOutput;
244
+ }
245
+ /** Host boundary for ordinary pm SDK actions and recorded-state reads. */
246
+ export interface EpisodeRuntimeAdapter<TAction, TOutput = unknown> {
247
+ /** Construct a fresh isolated workspace using the declared recipe. */
248
+ reset(recipe: WorkspaceRecipe): Promise<EpisodeResetReceipt>;
249
+ /** Execute one ordinary action, normally by calling `PmClient.run`. */
250
+ execute(action: TAction): Promise<EpisodeActionReceipt<TOutput>>;
251
+ /** Read immutable grading state from the workspace system of record. */
252
+ readRecordedState(): Promise<WorkspaceRecordedState>;
253
+ }
254
+ /** One deterministic entry in a portable episode trajectory. */
255
+ export interface EpisodeTrajectoryEntry {
256
+ /** Monotonic event number within the isolated episode. */
257
+ sequence: number;
258
+ /** Stable event classification. */
259
+ kind: "reset" | "observation" | "action" | "verdict" | "close";
260
+ /** Snapshot, state, or observation tier associated with the event. */
261
+ state_id: string;
262
+ }
263
+ /** Closed episode evidence without reward or framework-specific shaping. */
264
+ export interface ClosedEpisode {
265
+ /** Deterministic total verdict. */
266
+ verdict: VerdictResult;
267
+ /** Complete bounded trajectory. */
268
+ trajectory: readonly EpisodeTrajectoryEntry[];
269
+ /** Explicitly absent to prevent verdicts from becoming reward signals. */
270
+ reward?: never;
271
+ }
272
+ /** Isolated runtime returned for one declared agent episode. */
273
+ export interface PmEpisodeSession<TAction, TOutput> {
274
+ /** Observe recorded state through the declared disclosure ladder. */
275
+ observe(): Promise<ObservationResult<RecordedStateObject>>;
276
+ /** Execute one bounded ordinary project-management action. */
277
+ step(action: TAction): Promise<EpisodeActionReceipt<TOutput>>;
278
+ /** Evaluate the current recorded state without closing the session. */
279
+ score(): Promise<VerdictResult>;
280
+ /** Evaluate and close the episode, returning immutable evidence. */
281
+ close(): Promise<ClosedEpisode>;
282
+ }
283
+ /** Validate, clone, and freeze a portable observation declaration. */
284
+ export declare function defineObservationContract(declaration: ObservationContract): ObservationContract;
285
+ /** Describe guaranteed and calibrated observation cost before collection. */
286
+ export declare function describeObservationCost(contract: ObservationContract): ObservationCostDescription;
287
+ /** Serve the richest declared tier that fits both caller and tier ceilings. */
288
+ export declare function serveDeclaredObservation<T>(contract: ObservationContract, collect: (tier: ObservationTier) => Promise<T>, request: ObservationRequest): Promise<ObservationResult<T>>;
289
+ /** Validate, clone, and freeze a portable total-verdict declaration. */
290
+ export declare function defineVerdictContract(declaration: VerdictContract): VerdictContract;
291
+ /** Evaluate a total verdict exclusively from one immutable recorded snapshot. */
292
+ export declare function evaluateVerdictContract(contract: VerdictContract, recorded: WorkspaceRecordedState): VerdictResult;
293
+ /** Validate, clone, and freeze a portable episode specification. */
294
+ export declare function defineEpisodeSpecification(declaration: EpisodeSpecification): EpisodeSpecification;
295
+ /** Open one isolated, deterministic episode around an adapter's ordinary actions. */
296
+ export declare function openPmEpisode<TAction, TOutput = unknown>(specification: EpisodeSpecification, adapter: EpisodeRuntimeAdapter<TAction, TOutput>): Promise<PmEpisodeSession<TAction, TOutput>>;