@unbrained/pm-cli 2026.8.6 → 2026.8.8
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +65 -0
- package/dist/cli/main.js +6 -3
- package/dist/cli/register-annotations.d.ts +11 -0
- package/dist/cli/register-annotations.js +195 -0
- package/dist/cli/register-history-author.js +7 -30
- package/dist/cli/register-mutation.js +25 -206
- package/dist/cli/register-operations.js +11 -2
- package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
- package/dist/cli/runtime-compatibility-boundary.js +43 -0
- package/dist/cli/stats-analytics-json.d.ts +9 -0
- package/dist/cli/stats-analytics-json.js +69 -0
- package/dist/cli-bundle/bundle-manifest.json +156 -692
- package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
- package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
- package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
- package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
- package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +38 -37
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +1 -1
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -1
- package/dist/cli.js +14 -4
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/workspace-history.d.ts +22 -2
- package/dist/core/history/workspace-history.js +60 -36
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +10 -2
- package/dist/core/sentry/helpers.d.ts +10 -0
- package/dist/core/sentry/helpers.js +59 -4
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/constants.d.ts +2 -0
- package/dist/core/shared/constants.js +4 -2
- package/dist/mcp/tool-definitions.js +6 -2
- package/dist/sdk/annotations.d.ts +40 -0
- package/dist/sdk/annotations.js +61 -9
- package/dist/sdk/author-attribution.d.ts +12 -0
- package/dist/sdk/author-attribution.js +87 -9
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
- package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
- package/dist/sdk/cli-contracts/completeness.js +54 -5
- package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +22 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/comments.d.ts +7 -0
- package/dist/sdk/comments.js +2 -2
- package/dist/sdk/completion.js +12 -5
- package/dist/sdk/contracts.d.ts +2 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core.d.ts +3 -1
- package/dist/sdk/core.js +4 -3
- package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
- package/dist/sdk/environment/host-environment-errors.js +124 -0
- package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
- package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
- package/dist/sdk/environment/source-context.d.ts +23 -0
- package/dist/sdk/environment/source-context.js +29 -0
- package/dist/sdk/error-code-catalog.d.ts +6 -0
- package/dist/sdk/error-code-catalog.js +62 -8
- package/dist/sdk/extension.js +9 -11
- package/dist/sdk/generated-error-code-catalog.js +739 -3
- package/dist/sdk/governance/health.d.ts +11 -3
- package/dist/sdk/governance/health.js +5 -5
- package/dist/sdk/history-analytics.d.ts +141 -0
- package/dist/sdk/history-analytics.js +283 -0
- package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
- package/dist/sdk/improvement-ledger-validation.js +63 -0
- package/dist/sdk/improvement-ledger.d.ts +139 -0
- package/dist/sdk/improvement-ledger.js +261 -0
- package/dist/sdk/index.d.ts +13 -5
- package/dist/sdk/index.js +15 -7
- package/dist/sdk/learnings.d.ts +15 -0
- package/dist/sdk/learnings.js +2 -2
- package/dist/sdk/lifecycle/close-many.d.ts +6 -1
- package/dist/sdk/lifecycle/close-many.js +43 -5
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.d.ts +2 -1
- package/dist/sdk/lifecycle/update-many.js +29 -5
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +21 -0
- package/dist/sdk/merge/install.js +58 -20
- package/dist/sdk/notes.d.ts +7 -0
- package/dist/sdk/notes.js +2 -2
- package/dist/sdk/read-output-budget.js +24 -22
- package/dist/sdk/read-output-contracts.d.ts +10 -2
- package/dist/sdk/read-output-contracts.js +204 -66
- package/dist/sdk/read-output-rows.d.ts +29 -0
- package/dist/sdk/read-output-rows.js +100 -0
- package/dist/sdk/read-output-session.d.ts +69 -0
- package/dist/sdk/read-output-session.js +200 -0
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +14 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime-stats-options.d.ts +9 -0
- package/dist/sdk/runtime-stats-options.js +38 -0
- package/dist/sdk/runtime.d.ts +1 -0
- package/dist/sdk/runtime.js +13 -50
- package/dist/sdk/stats.d.ts +40 -0
- package/dist/sdk/stats.js +112 -29
- package/dist/sdk/test/execution.js +4 -2
- package/dist/sdk/test/parsers.js +5 -2
- package/dist/sdk/workspace-snapshot.d.ts +9 -0
- package/dist/sdk/workspace-snapshot.js +48 -16
- package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
- package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
- package/docs/RELEASING.md +27 -2
- package/docs/SCRIPTING.md +27 -1
- package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
- package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
- package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
- package/docs/TESTING.md +17 -0
- package/marketplace.json +2 -2
- package/package.json +6 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +875 -827
- package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
- package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
- package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
- package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
- package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
- package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
- package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
- package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
- package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
- package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
- package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
- package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
- package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
- package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
- package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
- package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
- package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
- package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
- package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
- package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
- package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
- package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
- package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
- package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
- package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
- package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
- package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
- package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
- package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
- package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
- package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
- package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
- package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
- package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
- package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
- package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
- package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
- package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
- package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
- package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { parseImprovementLedgerDocument as parseLedger } from "./improvement-ledger-validation.js";
|
|
2
|
+
/** Direction in which a metric represents improvement. */
|
|
3
|
+
export type ImprovementDirection = "higher" | "lower" | "target";
|
|
4
|
+
/** One immutable quantitative observation retained by the workspace ledger. */
|
|
5
|
+
export interface ImprovementObservation {
|
|
6
|
+
/** Content-derived observation identity. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Stable, agent-readable metric name. */
|
|
9
|
+
metric: string;
|
|
10
|
+
/** Finite observed numeric value. */
|
|
11
|
+
value: number;
|
|
12
|
+
/** Direction in which later values improve. */
|
|
13
|
+
direction: ImprovementDirection;
|
|
14
|
+
/** Optional domain unit such as count, ms, bytes, or percent. */
|
|
15
|
+
unit?: string;
|
|
16
|
+
/** Required target when direction is target; optional gate threshold otherwise. */
|
|
17
|
+
threshold?: number;
|
|
18
|
+
/** ISO timestamp at which the value was observed. */
|
|
19
|
+
observed_at: string;
|
|
20
|
+
/** Git commit, caller revision, or explicit unversioned marker. */
|
|
21
|
+
revision: string;
|
|
22
|
+
/** How the revision value was obtained. */
|
|
23
|
+
revision_source: "caller" | "git" | "unversioned";
|
|
24
|
+
/** Attributed actor that recorded the observation. */
|
|
25
|
+
author: string;
|
|
26
|
+
/** Optional tracked item owning the measurement. */
|
|
27
|
+
item_id?: string;
|
|
28
|
+
/** Optional producing instrument or gate name. */
|
|
29
|
+
source?: string;
|
|
30
|
+
/** Stable retry key when supplied or derivable from a revision. */
|
|
31
|
+
idempotency_key?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Versioned workspace singleton containing every retained observation. */
|
|
34
|
+
export interface ImprovementLedgerDocument {
|
|
35
|
+
/** Storage contract revision. */
|
|
36
|
+
format_version: 1;
|
|
37
|
+
/** Append-only observations in deterministic chronological order. */
|
|
38
|
+
observations: ImprovementObservation[];
|
|
39
|
+
}
|
|
40
|
+
/** Mutation controls accepted by {@link recordImprovementObservation}. */
|
|
41
|
+
export interface RecordImprovementObservationOptions {
|
|
42
|
+
/** Stable metric name. */
|
|
43
|
+
metric: string;
|
|
44
|
+
/** Finite observed numeric value. */
|
|
45
|
+
value: number;
|
|
46
|
+
/** Direction in which later values improve. */
|
|
47
|
+
direction?: ImprovementDirection;
|
|
48
|
+
/** Optional domain unit. */
|
|
49
|
+
unit?: string;
|
|
50
|
+
/** Target or gate threshold associated with this observation. */
|
|
51
|
+
threshold?: number;
|
|
52
|
+
/** Optional producing instrument or gate name. */
|
|
53
|
+
source?: string;
|
|
54
|
+
/** Optional tracked item owning the observation. */
|
|
55
|
+
itemId?: string;
|
|
56
|
+
/** Explicit source revision; otherwise git HEAD is resolved when available. */
|
|
57
|
+
revision?: string;
|
|
58
|
+
/** Explicit observation time, primarily for reproducible importers. */
|
|
59
|
+
observedAt?: string;
|
|
60
|
+
/** Explicit retry identity. */
|
|
61
|
+
idempotencyKey?: string;
|
|
62
|
+
/** Intentional author override. */
|
|
63
|
+
author?: string;
|
|
64
|
+
/** Human-readable audit rationale. */
|
|
65
|
+
message?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Receipt returned after recording or replaying one observation. */
|
|
68
|
+
export interface RecordImprovementObservationResult {
|
|
69
|
+
/** Whether a new observation was appended. */
|
|
70
|
+
changed: boolean;
|
|
71
|
+
/** Recorded or idempotently replayed observation. */
|
|
72
|
+
observation: ImprovementObservation;
|
|
73
|
+
/** Workspace-relative singleton path. */
|
|
74
|
+
ledger_path: "improvement-ledger.json";
|
|
75
|
+
}
|
|
76
|
+
/** Bounded read controls for {@link readImprovementLedger}. */
|
|
77
|
+
export interface ReadImprovementLedgerOptions {
|
|
78
|
+
/** Explicit tracker root, equivalent to global --pm-path. */
|
|
79
|
+
pmRoot?: string;
|
|
80
|
+
/** Working directory used for implicit tracker discovery. */
|
|
81
|
+
cwd?: string;
|
|
82
|
+
/** Optional exact metric filter. */
|
|
83
|
+
metric?: string;
|
|
84
|
+
/** Optional tracked owner filter. */
|
|
85
|
+
itemId?: string;
|
|
86
|
+
/** Inclusive ISO timestamp lower bound. */
|
|
87
|
+
since?: string;
|
|
88
|
+
/** Maximum newest observations returned. */
|
|
89
|
+
limit?: number;
|
|
90
|
+
}
|
|
91
|
+
/** One baseline-to-latest trend computed without rewriting observations. */
|
|
92
|
+
export interface ImprovementTrend {
|
|
93
|
+
/** Stable metric name. */
|
|
94
|
+
metric: string;
|
|
95
|
+
/** Direction used to interpret the delta. */
|
|
96
|
+
direction: ImprovementDirection;
|
|
97
|
+
/** Oldest matching observation. */
|
|
98
|
+
baseline: ImprovementObservation;
|
|
99
|
+
/** Newest matching observation. */
|
|
100
|
+
latest: ImprovementObservation;
|
|
101
|
+
/** Latest value minus baseline value. */
|
|
102
|
+
delta: number;
|
|
103
|
+
/** Whether the latest value improved over the baseline. */
|
|
104
|
+
improved: boolean;
|
|
105
|
+
/** Number of observations contributing to the trend. */
|
|
106
|
+
sample_count: number;
|
|
107
|
+
}
|
|
108
|
+
/** Bounded ledger page plus complete aggregate trend metadata. */
|
|
109
|
+
export interface ImprovementLedgerResult {
|
|
110
|
+
/** Newest-first observation page. */
|
|
111
|
+
observations: ImprovementObservation[];
|
|
112
|
+
/** Matching observation count before the page limit. */
|
|
113
|
+
total: number;
|
|
114
|
+
/** Whether older matching rows were omitted. */
|
|
115
|
+
truncated: boolean;
|
|
116
|
+
/** Trends for every matching metric, sorted by metric name. */
|
|
117
|
+
trends: ImprovementTrend[];
|
|
118
|
+
/** Read provenance for deterministic consumers. */
|
|
119
|
+
source: "audited_workspace_singleton";
|
|
120
|
+
}
|
|
121
|
+
declare function normalizeMetricName(value: string): string;
|
|
122
|
+
declare function normalizeDirection(value: ImprovementDirection | undefined): ImprovementDirection;
|
|
123
|
+
declare function parseObservationLimit(value: number | undefined): number;
|
|
124
|
+
declare function trendForMetric(observations: ImprovementObservation[]): ImprovementTrend;
|
|
125
|
+
/** Record one audited observation, returning an idempotent receipt on retry. */
|
|
126
|
+
export declare function recordImprovementObservation(options: RecordImprovementObservationOptions, global?: {
|
|
127
|
+
path?: string;
|
|
128
|
+
}): Promise<RecordImprovementObservationResult>;
|
|
129
|
+
/** Read a bounded newest-first observation page and derive complete trends. */
|
|
130
|
+
export declare function readImprovementLedger(options?: ReadImprovementLedgerOptions): Promise<ImprovementLedgerResult>;
|
|
131
|
+
/** Pure helpers exposed for storage and trend contract tests. */
|
|
132
|
+
export declare const _testOnlyImprovementLedger: {
|
|
133
|
+
normalizeMetricName: typeof normalizeMetricName;
|
|
134
|
+
normalizeDirection: typeof normalizeDirection;
|
|
135
|
+
parseLedger: typeof parseLedger;
|
|
136
|
+
parseObservationLimit: typeof parseObservationLimit;
|
|
137
|
+
trendForMetric: typeof trendForMetric;
|
|
138
|
+
};
|
|
139
|
+
export {};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/improvement-ledger
|
|
3
|
+
*
|
|
4
|
+
* Persists append-only quantitative observations in an audited workspace
|
|
5
|
+
* singleton and exposes bounded trend reads for self-improvement loops.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="aaa927b3-4bc4-561f-aff1-85dc95c12ea1")}catch(e){}}();
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { promisify } from "node:util";
|
|
13
|
+
import { pathExists, readFileIfExists } from "../core/fs/fs-utils.js";
|
|
14
|
+
import { mutateWorkspaceJsonWithHistory } from "../core/history/workspace-history.js";
|
|
15
|
+
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
16
|
+
import { resolveAuthor } from "../core/shared/author.js";
|
|
17
|
+
import { PmCliError } from "../core/shared/errors.js";
|
|
18
|
+
import { stableStringify } from "../core/shared/serialization.js";
|
|
19
|
+
import { nowIso } from "../core/shared/time.js";
|
|
20
|
+
import { getSettingsPath, resolvePmRoot, resolveWorkspaceRoot, } from "../core/store/paths.js";
|
|
21
|
+
import { readSettings } from "../core/store/settings.js";
|
|
22
|
+
import { parseImprovementLedgerDocument as parseLedger } from "./improvement-ledger-validation.js";
|
|
23
|
+
const execFileAsync = promisify(execFile);
|
|
24
|
+
const DEFAULT_OBSERVATION_LIMIT = 50;
|
|
25
|
+
const MAX_OBSERVATION_LIMIT = 1_000;
|
|
26
|
+
const METRIC_NAME_PATTERN = /^[a-z0-9](?:[a-z0-9._/-]{0,126}[a-z0-9])?$/u;
|
|
27
|
+
function normalizeMetricName(value) {
|
|
28
|
+
const metric = value.trim().toLowerCase();
|
|
29
|
+
if (!METRIC_NAME_PATTERN.test(metric)) {
|
|
30
|
+
throw new PmCliError(`Invalid metric name "${value}"; use 1-128 lowercase letters, digits, dots, slashes, underscores, or hyphens.`, EXIT_CODE.USAGE, { code: "invalid_improvement_metric" });
|
|
31
|
+
}
|
|
32
|
+
return metric;
|
|
33
|
+
}
|
|
34
|
+
function normalizeDirection(value) {
|
|
35
|
+
const direction = value ?? "lower";
|
|
36
|
+
if (!["higher", "lower", "target"].includes(direction)) {
|
|
37
|
+
throw new PmCliError("Improvement direction must be higher, lower, or target.", EXIT_CODE.USAGE, { code: "invalid_improvement_observation" });
|
|
38
|
+
}
|
|
39
|
+
return direction;
|
|
40
|
+
}
|
|
41
|
+
function normalizeOptionalText(value, field) {
|
|
42
|
+
const normalized = value?.trim();
|
|
43
|
+
if (!normalized)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (normalized.length > 256) {
|
|
46
|
+
throw new PmCliError(`${field} must not exceed 256 characters.`, EXIT_CODE.USAGE, { code: "invalid_improvement_observation" });
|
|
47
|
+
}
|
|
48
|
+
return normalized;
|
|
49
|
+
}
|
|
50
|
+
function parseObservationLimit(value) {
|
|
51
|
+
const limit = value ?? DEFAULT_OBSERVATION_LIMIT;
|
|
52
|
+
if (!Number.isSafeInteger(limit) ||
|
|
53
|
+
limit < 0 ||
|
|
54
|
+
limit > MAX_OBSERVATION_LIMIT) {
|
|
55
|
+
throw new PmCliError(`Improvement observation limit must be an integer from 0 to ${MAX_OBSERVATION_LIMIT}.`, EXIT_CODE.USAGE, { code: "invalid_improvement_observation_limit" });
|
|
56
|
+
}
|
|
57
|
+
return limit;
|
|
58
|
+
}
|
|
59
|
+
function parseIsoTimestamp(value, field) {
|
|
60
|
+
const milliseconds = Date.parse(value);
|
|
61
|
+
if (!Number.isFinite(milliseconds)) {
|
|
62
|
+
throw new PmCliError(`${field} must be an ISO timestamp.`, EXIT_CODE.USAGE, {
|
|
63
|
+
code: "invalid_improvement_observation_timestamp",
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return new Date(milliseconds).toISOString();
|
|
67
|
+
}
|
|
68
|
+
async function buildImprovementObservation(pmRoot, settings, options) {
|
|
69
|
+
if (!Number.isFinite(options.value)) {
|
|
70
|
+
throw new PmCliError("Improvement observation value must be finite.", EXIT_CODE.USAGE, { code: "invalid_improvement_observation" });
|
|
71
|
+
}
|
|
72
|
+
const metric = normalizeMetricName(options.metric);
|
|
73
|
+
const direction = normalizeDirection(options.direction);
|
|
74
|
+
if ((options.threshold !== undefined && !Number.isFinite(options.threshold)) ||
|
|
75
|
+
(direction === "target" && options.threshold === undefined)) {
|
|
76
|
+
throw new PmCliError("Target-directed observations require a finite threshold.", EXIT_CODE.USAGE, { code: "invalid_improvement_observation" });
|
|
77
|
+
}
|
|
78
|
+
const revision = await resolveObservationRevision(pmRoot, options.revision);
|
|
79
|
+
const source = normalizeOptionalText(options.source, "source");
|
|
80
|
+
const itemId = normalizeOptionalText(options.itemId, "itemId");
|
|
81
|
+
const unit = normalizeOptionalText(options.unit, "unit");
|
|
82
|
+
const idempotencyKey = normalizeOptionalText(options.idempotencyKey, "idempotencyKey") ??
|
|
83
|
+
(revision.revision_source === "unversioned"
|
|
84
|
+
? undefined
|
|
85
|
+
: [
|
|
86
|
+
revision.revision,
|
|
87
|
+
metric,
|
|
88
|
+
source ?? "manual",
|
|
89
|
+
itemId ?? "workspace",
|
|
90
|
+
].join(":"));
|
|
91
|
+
const observationWithoutId = {
|
|
92
|
+
metric,
|
|
93
|
+
value: options.value,
|
|
94
|
+
direction,
|
|
95
|
+
...(unit === undefined ? {} : { unit }),
|
|
96
|
+
...(options.threshold === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: { threshold: options.threshold }),
|
|
99
|
+
observed_at: parseIsoTimestamp(options.observedAt ?? nowIso(), "observedAt"),
|
|
100
|
+
...revision,
|
|
101
|
+
author: resolveAuthor(options.author, settings.author_default),
|
|
102
|
+
...(itemId === undefined ? {} : { item_id: itemId }),
|
|
103
|
+
...(source === undefined ? {} : { source }),
|
|
104
|
+
...(idempotencyKey === undefined
|
|
105
|
+
? {}
|
|
106
|
+
: { idempotency_key: idempotencyKey }),
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
id: createHash("sha256")
|
|
110
|
+
.update(stableStringify(observationWithoutId))
|
|
111
|
+
.digest("hex")
|
|
112
|
+
.slice(0, 24),
|
|
113
|
+
...observationWithoutId,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function ensureObservationCanAppend(ledger, observation) {
|
|
117
|
+
const existing = observation.idempotency_key
|
|
118
|
+
? ledger.observations.find((row) => row.idempotency_key === observation.idempotency_key)
|
|
119
|
+
: ledger.observations.find((row) => row.id === observation.id);
|
|
120
|
+
if (existing) {
|
|
121
|
+
if (existing.metric !== observation.metric ||
|
|
122
|
+
existing.value !== observation.value ||
|
|
123
|
+
existing.direction !== observation.direction ||
|
|
124
|
+
existing.threshold !== observation.threshold ||
|
|
125
|
+
existing.unit !== observation.unit) {
|
|
126
|
+
throw new PmCliError(`Improvement observation retry key already records a different value for ${observation.metric}.`, EXIT_CODE.CONFLICT, { code: "improvement_observation_conflict" });
|
|
127
|
+
}
|
|
128
|
+
return existing;
|
|
129
|
+
}
|
|
130
|
+
const priorMetric = ledger.observations.find((row) => row.metric === observation.metric);
|
|
131
|
+
if (priorMetric &&
|
|
132
|
+
(priorMetric.direction !== observation.direction ||
|
|
133
|
+
priorMetric.unit !== observation.unit ||
|
|
134
|
+
(observation.direction === "target" &&
|
|
135
|
+
priorMetric.threshold !== observation.threshold))) {
|
|
136
|
+
throw new PmCliError(`Metric ${observation.metric} is already declared with direction ${priorMetric.direction} and unit ${priorMetric.unit ?? "<none>"}.`, EXIT_CODE.CONFLICT, { code: "improvement_metric_contract_conflict" });
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
async function resolveObservationRevision(pmRoot, explicit) {
|
|
141
|
+
const callerRevision = normalizeOptionalText(explicit, "revision");
|
|
142
|
+
if (callerRevision) {
|
|
143
|
+
return { revision: callerRevision, revision_source: "caller" };
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const result = await execFileAsync("git", ["rev-parse", "--verify", "HEAD^{commit}"], {
|
|
147
|
+
cwd: resolveWorkspaceRoot(pmRoot),
|
|
148
|
+
encoding: "utf8",
|
|
149
|
+
timeout: 5_000,
|
|
150
|
+
});
|
|
151
|
+
const revision = result.stdout.trim();
|
|
152
|
+
return { revision, revision_source: "git" };
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Git is optional for root-layout and embedded SDK workspaces.
|
|
156
|
+
}
|
|
157
|
+
return { revision: "unversioned", revision_source: "unversioned" };
|
|
158
|
+
}
|
|
159
|
+
function trendForMetric(observations) {
|
|
160
|
+
const baseline = observations[0];
|
|
161
|
+
const latest = observations[observations.length - 1];
|
|
162
|
+
const delta = latest.value - baseline.value;
|
|
163
|
+
const improved = latest.direction === "higher"
|
|
164
|
+
? delta > 0
|
|
165
|
+
: latest.direction === "lower"
|
|
166
|
+
? delta < 0
|
|
167
|
+
: Math.abs(latest.value - latest.threshold) <
|
|
168
|
+
Math.abs(baseline.value - baseline.threshold);
|
|
169
|
+
return {
|
|
170
|
+
metric: latest.metric,
|
|
171
|
+
direction: latest.direction,
|
|
172
|
+
baseline,
|
|
173
|
+
latest,
|
|
174
|
+
delta,
|
|
175
|
+
improved,
|
|
176
|
+
sample_count: observations.length,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/** Record one audited observation, returning an idempotent receipt on retry. */
|
|
180
|
+
export async function recordImprovementObservation(options, global = {}) {
|
|
181
|
+
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
182
|
+
if (!(await pathExists(getSettingsPath(pmRoot)))) {
|
|
183
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
184
|
+
}
|
|
185
|
+
const settings = await readSettings(pmRoot);
|
|
186
|
+
const observation = await buildImprovementObservation(pmRoot, settings, options);
|
|
187
|
+
const filePath = path.join(pmRoot, "improvement-ledger.json");
|
|
188
|
+
const mutation = await mutateWorkspaceJsonWithHistory({
|
|
189
|
+
pmRoot,
|
|
190
|
+
filePath,
|
|
191
|
+
op: "improvement_observe",
|
|
192
|
+
author: observation.author,
|
|
193
|
+
lockTtlSeconds: settings.locks.ttl_seconds,
|
|
194
|
+
lockWaitMs: settings.locks.wait_ms,
|
|
195
|
+
message: options.message ??
|
|
196
|
+
`Record ${observation.metric}=${String(options.value)} improvement observation`,
|
|
197
|
+
mutate: (beforeRaw) => {
|
|
198
|
+
const ledger = parseLedger(beforeRaw);
|
|
199
|
+
const existing = ensureObservationCanAppend(ledger, observation);
|
|
200
|
+
if (existing) {
|
|
201
|
+
return { raw: beforeRaw, result: existing };
|
|
202
|
+
}
|
|
203
|
+
ledger.observations.push(observation);
|
|
204
|
+
ledger.observations.sort((left, right) => left.observed_at.localeCompare(right.observed_at) ||
|
|
205
|
+
left.metric.localeCompare(right.metric) ||
|
|
206
|
+
left.id.localeCompare(right.id));
|
|
207
|
+
return {
|
|
208
|
+
raw: `${stableStringify(ledger)}\n`,
|
|
209
|
+
result: observation,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
changed: mutation.changed,
|
|
215
|
+
observation: mutation.result,
|
|
216
|
+
ledger_path: "improvement-ledger.json",
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/** Read a bounded newest-first observation page and derive complete trends. */
|
|
220
|
+
export async function readImprovementLedger(options = {}) {
|
|
221
|
+
const pmRoot = resolvePmRoot(options.cwd ?? process.cwd(), options.pmRoot);
|
|
222
|
+
if (!(await pathExists(getSettingsPath(pmRoot)))) {
|
|
223
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
224
|
+
}
|
|
225
|
+
const metric = options.metric === undefined
|
|
226
|
+
? undefined
|
|
227
|
+
: normalizeMetricName(options.metric);
|
|
228
|
+
const since = options.since === undefined
|
|
229
|
+
? undefined
|
|
230
|
+
: parseIsoTimestamp(options.since, "since");
|
|
231
|
+
const limit = parseObservationLimit(options.limit);
|
|
232
|
+
const ledger = parseLedger(await readFileIfExists(path.join(pmRoot, "improvement-ledger.json")));
|
|
233
|
+
const matching = ledger.observations.filter((row) => (metric === undefined || row.metric === metric) &&
|
|
234
|
+
(options.itemId === undefined || row.item_id === options.itemId) &&
|
|
235
|
+
(since === undefined || row.observed_at >= since));
|
|
236
|
+
const byMetric = new Map();
|
|
237
|
+
for (const observation of matching) {
|
|
238
|
+
const rows = byMetric.get(observation.metric) ?? [];
|
|
239
|
+
rows.push(observation);
|
|
240
|
+
byMetric.set(observation.metric, rows);
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
observations: [...matching].reverse().slice(0, limit),
|
|
244
|
+
total: matching.length,
|
|
245
|
+
truncated: matching.length > limit,
|
|
246
|
+
trends: [...byMetric]
|
|
247
|
+
.map(([, observations]) => trendForMetric(observations))
|
|
248
|
+
.sort((left, right) => left.metric.localeCompare(right.metric)),
|
|
249
|
+
source: "audited_workspace_singleton",
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/** Pure helpers exposed for storage and trend contract tests. */
|
|
253
|
+
export const _testOnlyImprovementLedger = {
|
|
254
|
+
normalizeMetricName,
|
|
255
|
+
normalizeDirection,
|
|
256
|
+
parseLedger,
|
|
257
|
+
parseObservationLimit,
|
|
258
|
+
trendForMetric,
|
|
259
|
+
};
|
|
260
|
+
//# sourceMappingURL=improvement-ledger.js.map
|
|
261
|
+
//# debugId=aaa927b3-4bc4-561f-aff1-85dc95c12ea1
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
7
7
|
export * from "./agent-session-context.js";
|
|
8
8
|
export type { PmCommandVisibilityContract, PmCommandVisibilityTier, PmMcpPromptArgumentContract, PmMcpPromptContract, PmMcpResourceContract, PmMcpToolProfile, } from "./agent-capability-contracts.js";
|
|
9
|
-
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, type AnnotationCommandConfig, type AnnotationCommandOptions, type AnnotationCommandResult, type AnnotationEntry, type AnnotationInput, type AnnotationSourceOptions, type OwnershipConflictGuidance, } from "./annotations.js";
|
|
10
|
-
export { acknowledgeUnknownAuthorHistoryEvents, inspectHistoryAuthorStream, scanHistoryAuthorAttribution, type AcknowledgeUnknownAuthorEventsOptions, type HistoryAuthorAttributionScan, type UnknownAuthorHistoryEvent, } from "./author-attribution.js";
|
|
9
|
+
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, type AnnotationCommandConfig, type AnnotationCommandOptions, type AnnotationCommandResult, type AnnotationEntry, type AnnotationInput, type AnnotationHistoryRestoration, type AnnotationMutationReceipt, type AnnotationOmissionReceipt, type AnnotationSourceOptions, type OwnershipConflictGuidance, } from "./annotations.js";
|
|
10
|
+
export { acknowledgeUnknownAuthorHistoryEvents, acknowledgeUnknownAuthorHistoryEventsFromTransport, inspectHistoryAuthorStream, parseUnknownAuthorHistoryEventCoordinates, resolveUnknownAuthorAcknowledgmentSelector, scanHistoryAuthorAttribution, type AcknowledgeUnknownAuthorEventsOptions, type HistoryAuthorAttributionScan, type UnknownAuthorHistoryEvent, } from "./author-attribution.js";
|
|
11
11
|
export { BUILTIN_CORPUS_SHAPES, PM_CORPUS_SHAPE_SCHEMA, buildCorpusShapeItemPlan, createCorpusShapeMeasurement, defineCorpusShape, listBuiltinCorpusShapes, measureCorpusShapePlan, resolveBuiltinCorpusShape, type BuiltinCorpusShapeName, type CorpusShape, type CorpusShapeEdgeWeight, type CorpusShapeItemPlan, type CorpusShapeMeasurement, type CorpusShapeProfile, } from "./corpus-shape.js";
|
|
12
12
|
export * from "./core-governance.js";
|
|
13
13
|
export { createPmCliProgram } from "./cli-program.js";
|
|
@@ -20,7 +20,7 @@ export { quoteCommandArg, quoteWindowsCommandArg, renderPmCommand, } from "./com
|
|
|
20
20
|
export { runGc, type GcCheckpointsSummary, type GcLocksSummary, } from "./governance/gc.js";
|
|
21
21
|
export { _testOnlyHealthCommand, runHealth, type HealthCheck, } from "./governance/health.js";
|
|
22
22
|
export { _testOnlyValidateCommand, projectValidateCounts, runValidate, type ValidateCheck, type ValidateCountsFixesSummary, type ValidateCountsResult, type ValidateFixesSummary, type ValidateMutationServices, } from "./governance/validate.js";
|
|
23
|
-
export { runExtension, type ExtensionCommandAction
|
|
23
|
+
export { runExtension, type ExtensionCommandAction } from "./extension.js";
|
|
24
24
|
export { resolveExtensionInstallSourceIdentity, type ExtensionInstallSourceCandidate, type ExtensionInstallSourceResolution, type ExtensionInstallSourceSelection, type ResolvedExtensionInstallSource, } from "./extension/source-resolution.js";
|
|
25
25
|
export { applyStoredExtensionMigrationState, readExtensionMigrationState, resolveExtensionMigrationStatePath, runExtensionMigrateAction, runExtensionMigrations, type ExtensionMigrationActionContext, type ExtensionMigrationOutcomeStatus, type ExtensionMigrationReceipt, type ExtensionMigrationRunResult, type ExtensionMigrationState, type ExtensionMigrationStateEntry, type RunExtensionMigrationsOptions, } from "./extension/migrations.js";
|
|
26
26
|
export { findInstalledNpmPackageCandidate, type GithubInstallSource, type InstalledNpmPackageCandidate, type InstallSource, type LocalInstallSource, type NpmInstallSource, type ResolvedInstallSource, } from "./extension/install-sources.js";
|
|
@@ -29,7 +29,7 @@ export { runEvent, runMeet, runRemind, type MeetingEventShortcutOptions, type Re
|
|
|
29
29
|
export { createExtensionCommandSdk } from "./extension-command-context.js";
|
|
30
30
|
export { isRuntimeRecord } from "./runtime-input.js";
|
|
31
31
|
export { resolveStartTaskInProgressStatus } from "./start-task-status.js";
|
|
32
|
-
export { auditMergeAttributeFence, buildMergeAttributePatterns, findGitWorkspaceRoot, installMergeFence, refreshMergeAttributeFenceIfInstalled, resolveProjectMergeTypeFolders, runMergeInstall, type MergeFenceAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallResult, } from "./merge/install.js";
|
|
32
|
+
export { auditMergeAttributeFence, buildMergeAttributePatterns, findGitWorkspaceRoot, installMergeFence, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, resolveProjectMergeTypeFolders, runMergeInstall, type MergeFenceAuditResult, type MergeFenceRefreshOutcome, type MergeInstallOptions, type MergeInstallContextResolution, type MergeInstallResult, } from "./merge/install.js";
|
|
33
33
|
export { deriveSchemaEvolutionMigrationId, formatSchemaEvolutionMigrationHuman, planSchemaEvolutionMigration, runSchemaEvolutionMigration, type PlanSchemaEvolutionMigrationOptions, type SchemaEvolutionFieldChange, type SchemaEvolutionItemPlan, type SchemaEvolutionMigrationPlan, } from "./schema-migration.js";
|
|
34
34
|
export { runWithActiveExtensions, type ActiveExtensionScopeOptions, } from "./runtime.js";
|
|
35
35
|
export { applyInvocationAuthorOverride } from "./invocation-author.js";
|
|
@@ -52,6 +52,10 @@ export { ACTIVITY_FLAG_CONTRACTS, ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, AG
|
|
|
52
52
|
export type { CliFlagContract, OptionsFromContracts, PmActionSchemaContract, PmActionToolInputSchemaOptions, PmToolCustomFieldCollision, PmBulkMutationControlOptions, PmBulkMutationFilterOptions, PmCloseActionOptions, PmCloseManyActionOptions, PmCreateActionOptions, PmMutationAttributionOptions, PmOptionScalar, PmCommandOutputBudgetContract, PmOutputBudgetClass, PmOutputDegradationStep, PmUpdateActionOptions, PmUpdateManyActionOptions, PmExtensionCapabilityContract, PmExtensionPolicyModeContract, PmExtensionPolicySurfaceContract, PmExtensionSandboxProfileContract, PmExtensionServiceNameContract, PmExtensionTrustModeContract, PmToolAction, SdkCliActionParameterCoverage, SdkCliCompletenessContractSource, SdkCliParameterCoverageEntry, SdkCliParameterDisposition, ToolOptionFlagContract, } from "./cli-contracts.js";
|
|
53
53
|
export * from "./compose.js";
|
|
54
54
|
export * from "./compile-cache.js";
|
|
55
|
+
export * from "./environment/project-runtime-compatibility.js";
|
|
56
|
+
export * from "./environment/source-context.js";
|
|
57
|
+
export * from "./environment/host-environment-errors.js";
|
|
58
|
+
export * from "./cli-contracts/command-exit-contracts.js";
|
|
55
59
|
export * from "./context-relevance.js";
|
|
56
60
|
export * from "./context-intent-contracts.js";
|
|
57
61
|
export * from "./context-intent-runtime.js";
|
|
@@ -61,6 +65,8 @@ export * from "./lifecycle-completion.js";
|
|
|
61
65
|
export * from "./lifecycle-policy.js";
|
|
62
66
|
export * from "./output-projection.js";
|
|
63
67
|
export * from "./read-output-contracts.js";
|
|
68
|
+
export * from "./read-output-rows.js";
|
|
69
|
+
export * from "./read-output-session.js";
|
|
64
70
|
export * from "./output-token-accounting.js";
|
|
65
71
|
export * from "./context-packing.js";
|
|
66
72
|
export * from "./context-usage.js";
|
|
@@ -70,7 +76,7 @@ export * from "./history-compact.js";
|
|
|
70
76
|
export * from "./history-read.js";
|
|
71
77
|
export * from "./history-provenance.js";
|
|
72
78
|
export * from "./mutation-events.js";
|
|
73
|
-
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
|
|
79
|
+
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
|
|
74
80
|
export * from "./history-redact.js";
|
|
75
81
|
export { _testOnly } from "./history-redact.js";
|
|
76
82
|
export * from "./history-repair.js";
|
|
@@ -125,6 +131,8 @@ export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT
|
|
|
125
131
|
export { extensionMigrate, packageMigrate } from "./package-migrations.js";
|
|
126
132
|
export { CONTEXT_OUTPUT_VALUES, NEXT_OUTPUT_VALUES, PM_GITIGNORE_END, PM_GITIGNORE_START, analyzeSdkActionCoverage, ensurePmGitignore, getPmGitignoreBlock, closeItem, runAggregate, runClose, runCopy, runContext, runDelete, runFocus, runGet, runNext, runRestore, runUpdate, type CloseCommandOptions, type CopyOptions, type DeleteCommandOptions, type EnsurePmGitignoreResult, type HierarchyChild, type HierarchyNode, type HotFile, type FocusOptions, type ImportPriorityValue, type ProgressEntry, type RecentContextItem, type RestoreCommandOptions, type SdkActionCoverageRow, type StaleEntry, type TestHealthSummary, type UpdateCommandOptions, type WorkloadEntry, } from "./runtime.js";
|
|
127
133
|
export { runStats } from "./stats.js";
|
|
134
|
+
export { readImprovementLedger, recordImprovementObservation, type ImprovementDirection, type ImprovementLedgerDocument, type ImprovementLedgerResult, type ImprovementObservation, type ImprovementTrend, type ReadImprovementLedgerOptions, type RecordImprovementObservationOptions, type RecordImprovementObservationResult, } from "./improvement-ledger.js";
|
|
135
|
+
export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, type FleetAttributionAnalytics, type FleetAttributionDimension, type FleetAttributionRow, type HistoryAnalyticsWindowOptions, type HistoryAnalyticsWindowReceipt, type HistoryAnalyticsEvent, type HistoryAnalyticsWindow, type ProvenanceCoverageAnalytics, } from "./history-analytics.js";
|
|
128
136
|
export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, type EvalOptions, type EvalQueryReport, type EvalResult, } from "./eval.js";
|
|
129
137
|
export { runTelemetry, TELEMETRY_SUBCOMMANDS, type TelemetryCommandOptions, type TelemetryFlushResult, type TelemetryStatusSummary, type TelemetrySubcommand, } from "./telemetry.js";
|
|
130
138
|
export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, type LinkedTestFailureCategory, type TestCommandOptions, type TestResult, type TestRunResult, } from "./test/execution.js";
|
package/dist/sdk/index.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Index.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
7
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ae84c7af-bfa7-577d-b9f3-2bd9450d5755")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./agent-session-context.js";
|
|
10
|
-
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
|
|
11
|
-
export { acknowledgeUnknownAuthorHistoryEvents, inspectHistoryAuthorStream, scanHistoryAuthorAttribution, } from "./author-attribution.js";
|
|
10
|
+
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
|
|
11
|
+
export { acknowledgeUnknownAuthorHistoryEvents, acknowledgeUnknownAuthorHistoryEventsFromTransport, inspectHistoryAuthorStream, parseUnknownAuthorHistoryEventCoordinates, resolveUnknownAuthorAcknowledgmentSelector, scanHistoryAuthorAttribution, } from "./author-attribution.js";
|
|
12
12
|
export { BUILTIN_CORPUS_SHAPES, PM_CORPUS_SHAPE_SCHEMA, buildCorpusShapeItemPlan, createCorpusShapeMeasurement, defineCorpusShape, listBuiltinCorpusShapes, measureCorpusShapePlan, resolveBuiltinCorpusShape, } from "./corpus-shape.js";
|
|
13
13
|
export * from "./core-governance.js";
|
|
14
14
|
export { createPmCliProgram } from "./cli-program.js";
|
|
@@ -21,7 +21,7 @@ export { quoteCommandArg, quoteWindowsCommandArg, renderPmCommand, } from "./com
|
|
|
21
21
|
export { runGc, } from "./governance/gc.js";
|
|
22
22
|
export { _testOnlyHealthCommand, runHealth, } from "./governance/health.js";
|
|
23
23
|
export { _testOnlyValidateCommand, projectValidateCounts, runValidate, } from "./governance/validate.js";
|
|
24
|
-
export { runExtension
|
|
24
|
+
export { runExtension } from "./extension.js";
|
|
25
25
|
export { resolveExtensionInstallSourceIdentity, } from "./extension/source-resolution.js";
|
|
26
26
|
export { applyStoredExtensionMigrationState, readExtensionMigrationState, resolveExtensionMigrationStatePath, runExtensionMigrateAction, runExtensionMigrations, } from "./extension/migrations.js";
|
|
27
27
|
export { findInstalledNpmPackageCandidate, } from "./extension/install-sources.js";
|
|
@@ -30,7 +30,7 @@ export { runEvent, runMeet, runRemind, } from "./scheduling-shortcuts.js";
|
|
|
30
30
|
export { createExtensionCommandSdk } from "./extension-command-context.js";
|
|
31
31
|
export { isRuntimeRecord } from "./runtime-input.js";
|
|
32
32
|
export { resolveStartTaskInProgressStatus } from "./start-task-status.js";
|
|
33
|
-
export { auditMergeAttributeFence, buildMergeAttributePatterns, findGitWorkspaceRoot, installMergeFence, refreshMergeAttributeFenceIfInstalled, resolveProjectMergeTypeFolders, runMergeInstall, } from "./merge/install.js";
|
|
33
|
+
export { auditMergeAttributeFence, buildMergeAttributePatterns, findGitWorkspaceRoot, installMergeFence, refreshMergeAttributeFenceIfInstalled, resolveMergeInstallContext, resolveProjectMergeTypeFolders, runMergeInstall, } from "./merge/install.js";
|
|
34
34
|
export { deriveSchemaEvolutionMigrationId, formatSchemaEvolutionMigrationHuman, planSchemaEvolutionMigration, runSchemaEvolutionMigration, } from "./schema-migration.js";
|
|
35
35
|
export { runWithActiveExtensions, } from "./runtime.js";
|
|
36
36
|
export { applyInvocationAuthorOverride } from "./invocation-author.js";
|
|
@@ -50,6 +50,10 @@ export { PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS, PM_PACKAGE_RESOURCE_KINDS, coll
|
|
|
50
50
|
export { ACTIVITY_FLAG_CONTRACTS, ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_ACTION_OPTION_KEYS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EVAL_FLAG_CONTRACTS, EVENT_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_SCOPE_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, PLAN_FLAG_CONTRACTS, PM_COMMAND_OUTPUT_BUDGET_CONTRACTS, PM_CLI_ONLY_TOOL_ACTION_WAIVERS, PM_CORE_COMMAND_NAMES, PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION, PM_TOOL_ACTIONS, analyzePmToolActionParity, PM_TOOL_ACTION_PARAMETER_CONTRACTS, PM_TOOL_PARAMETERS_SCHEMA, PM_TOOL_PARAMETERS_SCHEMA_MAJOR, PM_TOOL_PARAMETERS_SCHEMA_VERSION, PM_OUTPUT_BUDGET_CLASSES, PM_OUTPUT_DEGRADATION_STEPS, PROFILE_FLAG_CONTRACTS, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE, TOOL_CALENDAR_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACT_SOURCE, TOOL_DEPS_OPTION_CONTRACTS, TOOL_GRAPH_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACT_SOURCE, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, buildPmActionToolInputSchema, PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES, compactFlagAliasContracts, createPmCommandOutputBudget, definePmCommandOutputBudget, estimatePmOutputTokens, inferPmOutputBudgetClass, analyzeSdkCliParameterCompleteness, isPmExtensionCapabilityContract, isPmExtensionPolicyModeContract, isPmExtensionPolicySurfaceContract, isPmExtensionServiceNameContract, isPmToolAction, hasSubcommandFlagContractsForCommand, readFirstStringFromCommanderOptions, readFirstValueFromCommanderOptions, readStringArrayFromCommanderOptions, resolveSubcommandFlagContractsForCommand, resolvePmCommandOutputBudget, resolvePmToolCustomFieldCollision, toCompletionFlagString, withFlagAliasMetadata, } from "./cli-contracts.js";
|
|
51
51
|
export * from "./compose.js";
|
|
52
52
|
export * from "./compile-cache.js";
|
|
53
|
+
export * from "./environment/project-runtime-compatibility.js";
|
|
54
|
+
export * from "./environment/source-context.js";
|
|
55
|
+
export * from "./environment/host-environment-errors.js";
|
|
56
|
+
export * from "./cli-contracts/command-exit-contracts.js";
|
|
53
57
|
export * from "./context-relevance.js";
|
|
54
58
|
export * from "./context-intent-contracts.js";
|
|
55
59
|
export * from "./context-intent-runtime.js";
|
|
@@ -59,6 +63,8 @@ export * from "./lifecycle-completion.js";
|
|
|
59
63
|
export * from "./lifecycle-policy.js";
|
|
60
64
|
export * from "./output-projection.js";
|
|
61
65
|
export * from "./read-output-contracts.js";
|
|
66
|
+
export * from "./read-output-rows.js";
|
|
67
|
+
export * from "./read-output-session.js";
|
|
62
68
|
export * from "./output-token-accounting.js";
|
|
63
69
|
export * from "./context-packing.js";
|
|
64
70
|
export * from "./context-usage.js";
|
|
@@ -68,7 +74,7 @@ export * from "./history-compact.js";
|
|
|
68
74
|
export * from "./history-read.js";
|
|
69
75
|
export * from "./history-provenance.js";
|
|
70
76
|
export * from "./mutation-events.js";
|
|
71
|
-
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
|
|
77
|
+
export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
|
|
72
78
|
export * from "./history-redact.js";
|
|
73
79
|
export { _testOnly } from "./history-redact.js";
|
|
74
80
|
export * from "./history-repair.js";
|
|
@@ -117,6 +123,8 @@ export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT
|
|
|
117
123
|
export { extensionMigrate, packageMigrate } from "./package-migrations.js";
|
|
118
124
|
export { CONTEXT_OUTPUT_VALUES, NEXT_OUTPUT_VALUES, PM_GITIGNORE_END, PM_GITIGNORE_START, analyzeSdkActionCoverage, ensurePmGitignore, getPmGitignoreBlock, closeItem, runAggregate, runClose, runCopy, runContext, runDelete, runFocus, runGet, runNext, runRestore, runUpdate, } from "./runtime.js";
|
|
119
125
|
export { runStats } from "./stats.js";
|
|
126
|
+
export { readImprovementLedger, recordImprovementObservation, } from "./improvement-ledger.js";
|
|
127
|
+
export { evaluateProvenanceCoverage, projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, runFleetAttributionAnalytics, runProvenanceCoverageAnalytics, } from "./history-analytics.js";
|
|
120
128
|
export { DEFAULT_EVAL_QUERIES_RELATIVE_PATH, EVAL_QUERY_SET_CONTRACT, EVAL_QUERY_SET_EXAMPLE, EVAL_QUERY_SET_SCHEMA_ID, parseEvalQuerySet, runEval, } from "./eval.js";
|
|
121
129
|
export { runTelemetry, TELEMETRY_SUBCOMMANDS, } from "./telemetry.js";
|
|
122
130
|
export { classifyLinkedTestFailure, countFailureCategories, extractReferencedPmItemIdsFromCommand, resolveLinkedTestFailureExitCode, runLinkedTests, runTest, summarizeContextPreflight, } from "./test/execution.js";
|
|
@@ -133,4 +141,4 @@ export * from "./governance.js";
|
|
|
133
141
|
export * from "./query.js";
|
|
134
142
|
export * from "./testing.js";
|
|
135
143
|
//# sourceMappingURL=index.js.map
|
|
136
|
-
//# debugId=
|
|
144
|
+
//# debugId=ae84c7af-bfa7-577d-b9f3-2bd9450d5755
|
package/dist/sdk/learnings.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type GlobalOptions } from "./runtime-primitives.js";
|
|
7
7
|
import type { LogNote } from "../types/index.js";
|
|
8
|
+
import { type AnnotationMutationReceipt, type AnnotationOmissionReceipt } from "./annotations.js";
|
|
8
9
|
/** Documents the learnings command options payload exchanged by command, SDK, and package integrations. */
|
|
9
10
|
export interface LearningsCommandOptions {
|
|
10
11
|
/** Value that configures or reports add for this contract. */
|
|
@@ -19,6 +20,8 @@ export interface LearningsCommandOptions {
|
|
|
19
20
|
delete?: number;
|
|
20
21
|
/** Value that configures or reports limit for this contract. */
|
|
21
22
|
limit?: string;
|
|
23
|
+
/** Return complete learning history after a mutation instead of a bounded receipt. */
|
|
24
|
+
fullHistory?: boolean;
|
|
22
25
|
/** Value that configures or reports author for this contract. */
|
|
23
26
|
author?: string;
|
|
24
27
|
/** Human-readable explanation suitable for logs and agent-facing output. */
|
|
@@ -34,6 +37,18 @@ export interface LearningsResult {
|
|
|
34
37
|
learnings: LogNote[];
|
|
35
38
|
/** Value that configures or reports count for this contract. */
|
|
36
39
|
count: number;
|
|
40
|
+
/** Total learning count after the mutation. */
|
|
41
|
+
total_count?: number;
|
|
42
|
+
/** Number of learning entries returned in this projection. */
|
|
43
|
+
returned_count?: number;
|
|
44
|
+
/** Whether additional stored learning entries were withheld. */
|
|
45
|
+
has_more?: boolean;
|
|
46
|
+
/** Applied read limit when one was requested. */
|
|
47
|
+
limit?: number;
|
|
48
|
+
/** Mutation identity when this result changed the collection. */
|
|
49
|
+
mutation_receipt?: AnnotationMutationReceipt;
|
|
50
|
+
/** Declares whether older learnings were withheld from a mutation response. */
|
|
51
|
+
omission_receipt?: AnnotationOmissionReceipt;
|
|
37
52
|
}
|
|
38
53
|
/** Implements run learnings for the public runtime surface of this module. */
|
|
39
54
|
export declare function runLearnings(id: string, options: LearningsCommandOptions, global: GlobalOptions): Promise<LearningsResult>;
|
package/dist/sdk/learnings.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="93184f29-f215-5413-9628-fb5b34523995")}catch(e){}}();
|
|
3
3
|
import { parseAnnotationTextInput, resolveAnnotationInput, runAnnotationCommand, } from "./annotations.js";
|
|
4
4
|
/** Implements run learnings for the public runtime surface of this module. */
|
|
5
5
|
export async function runLearnings(id, options, global) {
|
|
@@ -24,4 +24,4 @@ export async function runLearnings(id, options, global) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=learnings.js.map
|
|
27
|
-
//# debugId=
|
|
27
|
+
//# debugId=93184f29-f215-5413-9628-fb5b34523995
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type GlobalOptions, readSettings } from "../runtime-primitives.js";
|
|
7
7
|
import { type ListOptions } from "../query/list.js";
|
|
8
|
+
import { type PmCommandEffectReceipt } from "../cli-contracts/command-exit-contracts.js";
|
|
8
9
|
/** Documents the close many command options payload exchanged by command, SDK, and package integrations. */
|
|
9
10
|
export interface CloseManyCommandOptions {
|
|
10
11
|
/** Lifecycle state reported for status. */
|
|
@@ -55,7 +56,7 @@ interface CloseManyApplyRow {
|
|
|
55
56
|
error?: string;
|
|
56
57
|
}
|
|
57
58
|
/** Documents the close many result payload exchanged by command, SDK, and package integrations. */
|
|
58
|
-
export interface CloseManyResult {
|
|
59
|
+
export interface CloseManyResult extends PmCommandEffectReceipt {
|
|
59
60
|
/** Value that configures or reports mode for this contract. */
|
|
60
61
|
mode: "dry_run" | "apply" | "rollback";
|
|
61
62
|
/** Number of matched entries represented by this result. */
|
|
@@ -97,6 +98,10 @@ export interface CloseManyResult {
|
|
|
97
98
|
}>;
|
|
98
99
|
/** Value that configures or reports ids for this contract. */
|
|
99
100
|
ids: string[];
|
|
101
|
+
/** Explicitly requested --ids values that matched no selected item. */
|
|
102
|
+
unmatched_ids?: string[];
|
|
103
|
+
/** Number of explicitly requested --ids values that matched no selected item. */
|
|
104
|
+
unmatched_count?: number;
|
|
100
105
|
}
|
|
101
106
|
declare function hasCloseManyFilters(list: ListOptions | undefined, status: string | undefined): boolean;
|
|
102
107
|
declare function hasCloseManyRollbackConflicts(list: ListOptions | undefined, status: string | undefined): boolean;
|