@unbrained/pm-cli 2026.8.9 → 2026.8.11
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 +142 -80
- package/dist/cli/commander-usage.js +94 -17
- package/dist/cli/error-guidance.d.ts +10 -0
- package/dist/cli/error-guidance.js +76 -25
- package/dist/cli/help-json-payload.js +51 -16
- package/dist/cli/main.js +11 -6
- package/dist/cli/register-assurance.d.ts +8 -0
- package/dist/cli/register-assurance.js +52 -0
- package/dist/cli/register-files-lookup.js +14 -3
- package/dist/cli/register-mutation.js +30 -9
- package/dist/cli/register-operations.js +16 -11
- package/dist/cli-bundle/bundle-manifest.json +163 -163
- package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-2OOU2AFH.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +33 -0
- package/dist/cli-bundle/chunks/chunk-A2SJGHSI.js +3 -0
- package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +13 -0
- package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +194 -0
- package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-WMEZHCFI.js} +66 -60
- package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ZU34C3LH.js} +48 -48
- package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +5 -0
- package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-HAUXVUPY.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-NOCOOWQY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-23FTGO3W.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2DL3MRTD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-4H5IA6AV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-55BIB6DV.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-BKPIY34S.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +31 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-E3KCL7AY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +153 -0
- package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-J5EKAIVD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-TL5M2PAY.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-UDAZWT25.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +17 -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 +41 -39
- 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 -2
- package/dist/core/diagnostics/remediation.js +9 -9
- package/dist/core/fs/fs-utils.d.ts +10 -0
- package/dist/core/fs/fs-utils.js +16 -4
- package/dist/core/item/item-format.js +3 -32
- package/dist/core/schema/fields-file.d.ts +1 -2
- package/dist/core/schema/fields-file.js +4 -11
- package/dist/core/schema/runtime-schema.js +3 -10
- package/dist/core/schema/status-defs-file.d.ts +1 -2
- package/dist/core/schema/status-defs-file.js +4 -32
- package/dist/core/schema/status-token.d.ts +2 -0
- package/dist/core/schema/status-token.js +32 -0
- package/dist/core/schema/type-workflows.d.ts +1 -2
- package/dist/core/schema/type-workflows.js +4 -11
- package/dist/core/session/session-state.d.ts +47 -0
- package/dist/core/session/session-state.js +207 -6
- package/dist/core/shared/author.d.ts +8 -2
- package/dist/core/shared/author.js +85 -52
- package/dist/core/shared/errors.d.ts +12 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/text-normalization.d.ts +1 -1
- package/dist/core/shared/text-normalization.js +2 -2
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +52 -0
- package/dist/sdk/agent/command-suggestions.d.ts +4 -0
- package/dist/sdk/agent/command-suggestions.js +67 -0
- package/dist/sdk/agent/create-option-policy.d.ts +12 -0
- package/dist/sdk/agent/create-option-policy.js +32 -0
- package/dist/sdk/agent/item-addressing.d.ts +19 -0
- package/dist/sdk/agent/item-addressing.js +208 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
- package/dist/sdk/agent/refusal-reachability.js +72 -0
- package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
- package/dist/sdk/agent/subcommand-recovery.js +84 -0
- package/dist/sdk/cli-bootstrap.d.ts +9 -1
- package/dist/sdk/cli-bootstrap.js +25 -10
- package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
- package/dist/sdk/cli-contracts/completeness.js +13 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +77 -21
- package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +6 -3
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +513 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +251 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +96 -4
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +49 -6
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/completion.js +9 -3
- package/dist/sdk/config.js +9 -3
- package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
- package/dist/sdk/context/semantic-session-attribution.js +83 -0
- package/dist/sdk/context-intent-runtime.js +8 -5
- package/dist/sdk/context-signal-store.d.ts +34 -0
- package/dist/sdk/context-signal-store.js +24 -2
- package/dist/sdk/core-governance.d.ts +3 -1
- package/dist/sdk/core-governance.js +5 -3
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +2 -2
- package/dist/sdk/dependency-flag-validation.d.ts +15 -1
- package/dist/sdk/dependency-flag-validation.js +54 -2
- package/dist/sdk/error-code-catalog.d.ts +13 -0
- package/dist/sdk/error-code-catalog.js +35 -2
- package/dist/sdk/extension.js +18 -17
- package/dist/sdk/files.d.ts +11 -0
- package/dist/sdk/files.js +82 -24
- package/dist/sdk/generated-error-code-catalog.js +104 -13
- package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
- package/dist/sdk/governance/assurance-action-contracts.js +5 -0
- package/dist/sdk/governance/assurance-action.d.ts +70 -0
- package/dist/sdk/governance/assurance-action.js +198 -0
- package/dist/sdk/governance/assurance-limits.d.ts +7 -0
- package/dist/sdk/governance/assurance-limits.js +11 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
- package/dist/sdk/governance/assurance-runtime.js +131 -0
- package/dist/sdk/governance/assurance.d.ts +432 -0
- package/dist/sdk/governance/assurance.js +689 -0
- package/dist/sdk/governance/health.js +14 -7
- package/dist/sdk/governance/provenance-health.d.ts +13 -0
- package/dist/sdk/governance/provenance-health.js +63 -17
- package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
- package/dist/sdk/governance/validate-item-reader.js +18 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +15 -6
- package/dist/sdk/graph/run.js +8 -3
- package/dist/sdk/index.d.ts +10 -1
- package/dist/sdk/index.js +12 -3
- package/dist/sdk/lifecycle/claim.js +18 -3
- package/dist/sdk/lifecycle/close.js +17 -14
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +62 -9
- package/dist/sdk/lifecycle/focus.js +13 -3
- package/dist/sdk/lifecycle/plan.js +8 -3
- package/dist/sdk/lifecycle/update-many.js +39 -27
- package/dist/sdk/lifecycle/update.d.ts +6 -1
- package/dist/sdk/lifecycle/update.js +47 -10
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +4 -0
- package/dist/sdk/merge/install.js +28 -16
- package/dist/sdk/merge/receipts.d.ts +3 -0
- package/dist/sdk/merge/receipts.js +81 -17
- package/dist/sdk/output-projection.js +24 -4
- package/dist/sdk/provenance.d.ts +38 -0
- package/dist/sdk/provenance.js +64 -2
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +24 -10
- package/dist/sdk/query/light-metadata.d.ts +3 -0
- package/dist/sdk/query/light-metadata.js +19 -0
- package/dist/sdk/runtime-extended-actions.js +22 -5
- package/dist/sdk/runtime-primitives.d.ts +2 -0
- package/dist/sdk/runtime-primitives.js +4 -2
- package/dist/sdk/runtime.d.ts +8 -1
- package/dist/sdk/runtime.js +37 -28
- package/dist/sdk/schema-migration.js +7 -9
- package/dist/sdk/similarity-scoring.d.ts +1 -2
- package/dist/sdk/similarity-scoring.js +4 -16
- package/dist/sdk/telemetry.js +7 -4
- package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
- package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
- package/dist/sdk/traceability/source-traceability.d.ts +102 -0
- package/dist/sdk/traceability/source-traceability.js +293 -0
- package/dist/sdk/workspace-snapshot.d.ts +4 -0
- package/dist/sdk/workspace-snapshot.js +24 -11
- package/dist/types.d.ts +8 -2
- package/dist/types.js +2 -2
- package/docs/AGENT_GUIDE.md +3 -1
- package/docs/ASSURANCE.md +132 -0
- package/docs/COMMANDS.md +8 -5
- package/docs/MERGE_SAFETY.md +7 -5
- package/docs/README.md +3 -5
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
- package/docs/RELEASING.md +9 -5
- package/docs/SDK.md +44 -8
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +43 -6
- package/docs/SDK_CONTEXT.md +97 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
- package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
- package/docs/TESTING.md +12 -9
- package/docs/agent-task-token-baseline.json +2 -2
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
- package/marketplace.json +2 -2
- package/package.json +7 -6
- 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/extensions/templates/index.ts +9 -3
- 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 +1028 -48
- package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +0 -13
- package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
- package/dist/cli-bundle/chunks/chunk-EF43KODO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
- package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +0 -5
- package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-C3GCHDSQ.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VRXJSGIT.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +0 -2
|
@@ -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]="969b5bd2-e7de-5db8-bef2-6748675a100c")}catch(e){}}();
|
|
3
3
|
export { EXECUTABLE_COMMAND_ALIASES } from "./cli-contracts/command-aliases.js";
|
|
4
4
|
export { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, readFirstValueFromCommanderOptions, readFirstStringFromCommanderOptions, readStringArrayFromCommanderOptions, } from "./cli-contracts/commander-types.js";
|
|
5
5
|
export { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, } from "./cli-contracts/commander-mutation-options.js";
|
|
@@ -9,9 +9,9 @@ export { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, CREATE_COMMANDER_REPEAT
|
|
|
9
9
|
// keep importing everything from "./cli-contracts.js" unchanged.
|
|
10
10
|
export { PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_CLI_ONLY_TOOL_ACTION_WAIVERS, PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS, PM_TOOL_ACTIONS, analyzePmToolActionParity, isPmToolAction, isPmExtensionCapabilityContract, isPmExtensionServiceNameContract, isPmExtensionPolicyModeContract, isPmExtensionPolicySurfaceContract, } from "./cli-contracts/enum-contracts.js";
|
|
11
11
|
export { TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_CREATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CALENDAR_OPTION_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_DEPS_OPTION_CONTRACTS, TOOL_GRAPH_OPTION_CONTRACTS, TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE, TOOL_CREATE_OPTION_CONTRACT_SOURCE, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE, TOOL_UPDATE_OPTION_CONTRACT_SOURCE, } from "./cli-contracts/tool-option-contracts.js";
|
|
12
|
-
export { withFlagAliasMetadata, compactFlagAliasContracts, SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_SCOPE_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, REINDEX_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, EVENT_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, hasSubcommandFlagContractsForCommand, resolveSubcommandFlagContractsForCommand, toCompletionFlagString, } from "./cli-contracts/flag-contracts.js";
|
|
12
|
+
export { withFlagAliasMetadata, compactFlagAliasContracts, SUBCOMMAND_GLOBAL_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_SCOPE_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, REINDEX_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, EVENT_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, ASSURANCE_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, hasSubcommandFlagContractsForCommand, resolveSubcommandFlagContractsForCommand, toCompletionFlagString, } from "./cli-contracts/flag-contracts.js";
|
|
13
13
|
export { buildPmActionToolInputSchema, PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES, resolvePmToolCustomFieldCollision, CLOSE_ACTION_OPTION_KEYS, PLAN_CREATE_METADATA_PARAMETER_KEYS, PM_TOOL_ACTION_PARAMETER_CONTRACTS, PM_TOOL_PARAMETERS_SCHEMA_VERSION, PM_TOOL_PARAMETERS_SCHEMA_MAJOR, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION, PM_TOOL_PARAMETERS_SCHEMA, PM_PROVIDER_TOOL_PARAMETERS_SCHEMA, _testOnlyCliContracts, } from "./cli-contracts/tool-schema.js";
|
|
14
14
|
export { analyzeSdkCliParameterCompleteness, } from "./cli-contracts/completeness.js";
|
|
15
15
|
export { PM_COMMAND_OUTPUT_BUDGET_CONTRACTS, PM_OUTPUT_BUDGET_CLASSES, PM_OUTPUT_DEGRADATION_STEPS, createPmCommandOutputBudget, definePmCommandOutputBudget, estimatePmOutputTokens, inferPmOutputBudgetClass, resolvePmCommandOutputBudget, } from "./cli-contracts/agent-output-contracts.js";
|
|
16
16
|
//# sourceMappingURL=cli-contracts.js.map
|
|
17
|
-
//# debugId=
|
|
17
|
+
//# debugId=969b5bd2-e7de-5db8-bef2-6748675a100c
|
package/dist/sdk/completion.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm completion command surface and its agent-facing runtime behavior.
|
|
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]="381bfd99-bd9b-5f8f-9783-65c2bf2cd810")}catch(e){}}();
|
|
8
8
|
import { EXIT_CODE, PmCliError } from "./runtime-primitives.js";
|
|
9
9
|
import { listPmCommandsForTier } from "./agent-capability-contracts.js";
|
|
10
10
|
import { SCAFFOLD_CAPABILITIES } from "./extension/scaffold.js";
|
|
@@ -608,7 +608,7 @@ export function generateBashScript(itemTypes = [], tags = [], eagerTagExpansion
|
|
|
608
608
|
` COMPREPLY=(${compgen("--add --stdin --file --edit --delete --limit --full-history --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
|
|
609
609
|
" ;;",
|
|
610
610
|
" files)",
|
|
611
|
-
` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
|
|
611
|
+
` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
|
|
612
612
|
" ;;",
|
|
613
613
|
" docs)",
|
|
614
614
|
` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
|
|
@@ -1412,6 +1412,9 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
|
|
|
1412
1412
|
'--offset[Skip the first lookup matches]:number' \\
|
|
1413
1413
|
'--no-truncate[Return every lookup match]' \\
|
|
1414
1414
|
'--strict-read[Require authoritative source reads]' \\
|
|
1415
|
+
'--explain[Include ranked source-to-work rationale]' \\
|
|
1416
|
+
'--lines[Attribute an inclusive source line range]:start_end' \\
|
|
1417
|
+
'--decision-depth[Maximum governing-decision relationship depth]:number' \\
|
|
1415
1418
|
'--author[Mutation author]:author' \\
|
|
1416
1419
|
'--message[History message]:message' \\
|
|
1417
1420
|
'--force[Force override]' \\
|
|
@@ -2137,6 +2140,9 @@ complete -c pm -n '__fish_seen_subcommand_from files' -l limit -d 'Maximum looku
|
|
|
2137
2140
|
complete -c pm -n '__fish_seen_subcommand_from files' -l offset -d 'Skip the first lookup matches' -r
|
|
2138
2141
|
complete -c pm -n '__fish_seen_subcommand_from files' -l no-truncate -d 'Return every lookup match'
|
|
2139
2142
|
complete -c pm -n '__fish_seen_subcommand_from files' -l strict-read -d 'Require authoritative source reads'
|
|
2143
|
+
complete -c pm -n '__fish_seen_subcommand_from files' -l explain -d 'Include ranked source-to-work rationale'
|
|
2144
|
+
complete -c pm -n '__fish_seen_subcommand_from files' -l lines -d 'Attribute an inclusive source line range' -r
|
|
2145
|
+
complete -c pm -n '__fish_seen_subcommand_from files' -l decision-depth -d 'Maximum governing-decision relationship depth' -r
|
|
2140
2146
|
|
|
2141
2147
|
|
|
2142
2148
|
# search flags
|
|
@@ -2747,4 +2753,4 @@ export function runCompletion(shell, itemTypes = [], tags = [], eagerTagExpansio
|
|
|
2747
2753
|
};
|
|
2748
2754
|
}
|
|
2749
2755
|
//# sourceMappingURL=completion.js.map
|
|
2750
|
-
//# debugId=
|
|
2756
|
+
//# debugId=381bfd99-bd9b-5f8f-9783-65c2bf2cd810
|
package/dist/sdk/config.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm config command surface and its agent-facing runtime behavior.
|
|
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]="a9a8d99c-df4e-55b3-81f5-27124d598c5f")}catch(e){}}();
|
|
8
8
|
import { pathExists } from "../core/fs/fs-utils.js";
|
|
9
9
|
import { resolveConfigPositionalValue, } from "../core/config/positional-value.js";
|
|
10
10
|
import { NESTED_SETTING_DESCRIPTORS, parseNestedSettingValue, readNestedSettingValue, resolveNestedSettingDescriptor, writeNestedSettingValue, } from "../core/config/nested-settings.js";
|
|
@@ -16,6 +16,7 @@ import { buildInvalidTypeError } from "../core/schema/item-types-file.js";
|
|
|
16
16
|
import { resolveItemTypesFilePath } from "../core/schema/runtime-schema.js";
|
|
17
17
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
18
18
|
import { PmCliError } from "../core/shared/errors.js";
|
|
19
|
+
import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
|
|
19
20
|
import { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
|
|
20
21
|
import { getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../core/store/paths.js";
|
|
21
22
|
import { readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
|
|
@@ -181,7 +182,12 @@ function normalizeAction(value) {
|
|
|
181
182
|
value === "export") {
|
|
182
183
|
return value;
|
|
183
184
|
}
|
|
184
|
-
throw
|
|
185
|
+
throw createUnknownSubcommandError({
|
|
186
|
+
command_path: "config",
|
|
187
|
+
token: value.trim() || "<empty>",
|
|
188
|
+
allowed: ["export", "get", "list", "set"],
|
|
189
|
+
token_kind: "action",
|
|
190
|
+
});
|
|
185
191
|
}
|
|
186
192
|
function normalizeKey(value) {
|
|
187
193
|
const key = CONFIG_KEY_BY_ALIAS[value];
|
|
@@ -1091,4 +1097,4 @@ export const _testOnlyConfigCommand = {
|
|
|
1091
1097
|
normalizeWarnings,
|
|
1092
1098
|
};
|
|
1093
1099
|
//# sourceMappingURL=config.js.map
|
|
1094
|
-
//# debugId=
|
|
1100
|
+
//# debugId=a9a8d99c-df4e-55b3-81f5-27124d598c5f
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AgentSemanticAttribution } from "../../core/session/session-state.js";
|
|
2
|
+
import { readSettings } from "../../core/store/settings.js";
|
|
3
|
+
/** Resolve an item's canonical parent lineage under a strict depth bound. */
|
|
4
|
+
export declare function resolveSemanticLineageIds(pmRoot: string, settings: Awaited<ReturnType<typeof readSettings>>, itemId: string): Promise<string[]>;
|
|
5
|
+
/** Record one successful claim and its bounded canonical lineage. */
|
|
6
|
+
export declare function recordClaimSemanticAttribution(params: {
|
|
7
|
+
pmRoot: string;
|
|
8
|
+
settings: Awaited<ReturnType<typeof readSettings>>;
|
|
9
|
+
principal: string;
|
|
10
|
+
itemId: string;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
/** Remove one released claim from the active semantic workset. */
|
|
13
|
+
export declare function recordReleaseSemanticAttribution(params: {
|
|
14
|
+
pmRoot: string;
|
|
15
|
+
principal: string;
|
|
16
|
+
itemId: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/** Set or clear focused semantic work with canonical lineage evidence. */
|
|
19
|
+
export declare function recordFocusSemanticAttribution(params: {
|
|
20
|
+
pmRoot: string;
|
|
21
|
+
settings: Awaited<ReturnType<typeof readSettings>>;
|
|
22
|
+
principal: string;
|
|
23
|
+
itemId?: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/** Public constants used by scale and negative-control tests. */
|
|
26
|
+
export declare const SEMANTIC_ATTRIBUTION_LIMITS: {
|
|
27
|
+
readonly lineage_depth: 16;
|
|
28
|
+
readonly active_items: 64;
|
|
29
|
+
readonly evidence_rows: 32;
|
|
30
|
+
};
|
|
31
|
+
/** Convert bounded claim/focus evidence into normalized context affinity. */
|
|
32
|
+
export declare function semanticAttributionAffinity(attribution: AgentSemanticAttribution | undefined): Readonly<Record<string, number>> | undefined;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/semantic-session-attribution
|
|
3
|
+
*
|
|
4
|
+
* Maintains bounded claimed/focused lineage evidence used by automatic
|
|
5
|
+
* mutation provenance without scanning history or retaining prompt content.
|
|
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]="97c1e310-3cd9-5846-a54c-d019b0351541")}catch(e){}}();
|
|
9
|
+
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
10
|
+
import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
|
|
11
|
+
import { recordClaimedWorkAttribution, recordFocusedWorkAttribution, releaseClaimedWorkAttribution, } from "../../core/session/session-state.js";
|
|
12
|
+
import { locateItem, readLocatedItem } from "../../core/store/item-store.js";
|
|
13
|
+
const MAX_SEMANTIC_LINEAGE_DEPTH = 16;
|
|
14
|
+
/** Resolve an item's canonical parent lineage under a strict depth bound. */
|
|
15
|
+
export async function resolveSemanticLineageIds(pmRoot, settings, itemId) {
|
|
16
|
+
const typeToFolder = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations()).type_to_folder;
|
|
17
|
+
const lineage = [];
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
let cursor = itemId;
|
|
20
|
+
while (cursor && lineage.length < MAX_SEMANTIC_LINEAGE_DEPTH) {
|
|
21
|
+
const normalized = cursor.trim().toLowerCase();
|
|
22
|
+
if (!normalized || seen.has(normalized))
|
|
23
|
+
break;
|
|
24
|
+
seen.add(normalized);
|
|
25
|
+
const located = await locateItem(pmRoot, cursor, settings.id_prefix, settings.item_format, typeToFolder);
|
|
26
|
+
if (!located)
|
|
27
|
+
break;
|
|
28
|
+
const loaded = await readLocatedItem(located, { schema: settings.schema });
|
|
29
|
+
lineage.push(loaded.document.metadata.id);
|
|
30
|
+
cursor = loaded.document.metadata.parent;
|
|
31
|
+
}
|
|
32
|
+
return lineage;
|
|
33
|
+
}
|
|
34
|
+
/** Record one successful claim and its bounded canonical lineage. */
|
|
35
|
+
export async function recordClaimSemanticAttribution(params) {
|
|
36
|
+
await recordClaimedWorkAttribution({
|
|
37
|
+
pmRoot: params.pmRoot,
|
|
38
|
+
principal: params.principal,
|
|
39
|
+
itemId: params.itemId,
|
|
40
|
+
lineageIds: await resolveSemanticLineageIds(params.pmRoot, params.settings, params.itemId),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Remove one released claim from the active semantic workset. */
|
|
44
|
+
export async function recordReleaseSemanticAttribution(params) {
|
|
45
|
+
await releaseClaimedWorkAttribution(params);
|
|
46
|
+
}
|
|
47
|
+
/** Set or clear focused semantic work with canonical lineage evidence. */
|
|
48
|
+
export async function recordFocusSemanticAttribution(params) {
|
|
49
|
+
await recordFocusedWorkAttribution({
|
|
50
|
+
pmRoot: params.pmRoot,
|
|
51
|
+
principal: params.principal,
|
|
52
|
+
...(params.itemId
|
|
53
|
+
? {
|
|
54
|
+
itemId: params.itemId,
|
|
55
|
+
lineageIds: await resolveSemanticLineageIds(params.pmRoot, params.settings, params.itemId),
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Public constants used by scale and negative-control tests. */
|
|
61
|
+
export const SEMANTIC_ATTRIBUTION_LIMITS = {
|
|
62
|
+
lineage_depth: MAX_SEMANTIC_LINEAGE_DEPTH,
|
|
63
|
+
active_items: 64,
|
|
64
|
+
evidence_rows: 32,
|
|
65
|
+
};
|
|
66
|
+
/** Convert bounded claim/focus evidence into normalized context affinity. */
|
|
67
|
+
export function semanticAttributionAffinity(attribution) {
|
|
68
|
+
if (!attribution)
|
|
69
|
+
return undefined;
|
|
70
|
+
const affinity = {};
|
|
71
|
+
for (const itemId of attribution.active_item_ids)
|
|
72
|
+
affinity[itemId] = 1;
|
|
73
|
+
if (attribution.focused_item_id)
|
|
74
|
+
affinity[attribution.focused_item_id] = 1;
|
|
75
|
+
for (const evidence of attribution.evidence) {
|
|
76
|
+
const lineage = /^lineage:(.+)$/u.exec(evidence)?.[1];
|
|
77
|
+
if (lineage && affinity[lineage] === undefined)
|
|
78
|
+
affinity[lineage] = 0.75;
|
|
79
|
+
}
|
|
80
|
+
return Object.keys(affinity).length > 0 ? affinity : undefined;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=semantic-session-attribution.js.map
|
|
83
|
+
//# debugId=97c1e310-3cd9-5846-a54c-d019b0351541
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* SDK entrypoint.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
!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]="
|
|
9
|
+
!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]="7ba0243e-98d1-5aef-bd47-54f0b630be58")}catch(e){}}();
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
|
+
import { isFileAbsentError } from "../core/fs/fs-utils.js";
|
|
12
13
|
import { runWithContextIntentContracts, } from "./context-intent-contracts.js";
|
|
13
14
|
/** Conventional workspace declaration file relative to the tracker root. */
|
|
14
15
|
export const PM_CONTEXT_INTENTS_FILE = "context-intents.json";
|
|
@@ -56,9 +57,11 @@ export async function readWorkspaceContextIntentContracts(pmRoot) {
|
|
|
56
57
|
source = await readFile(declarationPath, "utf8");
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Absent declarations are the norm. `ENOTDIR` counts as absent too: when
|
|
61
|
+
// the tracker root is a regular file the declaration cannot exist, and the
|
|
62
|
+
// authoritative root guard downstream owns that refusal — this optional
|
|
63
|
+
// read must not pre-empt it with a raw runtime fault.
|
|
64
|
+
if (isFileAbsentError(error)) {
|
|
62
65
|
return [];
|
|
63
66
|
}
|
|
64
67
|
throw error;
|
|
@@ -107,4 +110,4 @@ export async function runWithDiscoveredContextIntentContracts(options, run) {
|
|
|
107
110
|
return await runWithContextIntentContracts(layers, run);
|
|
108
111
|
}
|
|
109
112
|
//# sourceMappingURL=context-intent-runtime.js.map
|
|
110
|
-
//# debugId=
|
|
113
|
+
//# debugId=7ba0243e-98d1-5aef-bd47-54f0b630be58
|
|
@@ -52,7 +52,41 @@ export interface ContextSignalStoreReadResult {
|
|
|
52
52
|
cache_status: "fresh" | "rebuilt";
|
|
53
53
|
/** Non-fatal recovery diagnostics. */
|
|
54
54
|
warnings: readonly string[];
|
|
55
|
+
/** Actionable meanings and executable recovery commands for every warning. */
|
|
56
|
+
warning_details?: readonly ContextSignalStoreWarningDetail[];
|
|
55
57
|
}
|
|
58
|
+
/** Stable recovery contract for one context signal-store warning. */
|
|
59
|
+
export interface ContextSignalStoreWarningDetail {
|
|
60
|
+
/** Machine-readable warning code also present in `warnings`. */
|
|
61
|
+
code: "context_signal_store_invalid" | "context_signal_store_stale" | "context_signal_store_write_failed";
|
|
62
|
+
/** Bounded explanation of the observed derived-state condition. */
|
|
63
|
+
meaning: string;
|
|
64
|
+
/** Safe executable command that retries or confirms recovery. */
|
|
65
|
+
recovery_command: "pm context";
|
|
66
|
+
/** Expected observable effect of the recovery command. */
|
|
67
|
+
recovery_effect: string;
|
|
68
|
+
}
|
|
69
|
+
/** Canonical actionable contracts shared by CLI, SDK, MCP, and package hosts. */
|
|
70
|
+
export declare const CONTEXT_SIGNAL_STORE_WARNING_DETAILS: {
|
|
71
|
+
readonly context_signal_store_invalid: {
|
|
72
|
+
readonly code: "context_signal_store_invalid";
|
|
73
|
+
readonly meaning: "The persisted context-signal snapshot was unreadable or invalid and was rebuilt from authoritative items.";
|
|
74
|
+
readonly recovery_command: "pm context";
|
|
75
|
+
readonly recovery_effect: "Re-read context and confirm the rebuilt snapshot can be loaded without the warning.";
|
|
76
|
+
};
|
|
77
|
+
readonly context_signal_store_stale: {
|
|
78
|
+
readonly code: "context_signal_store_stale";
|
|
79
|
+
readonly meaning: "The persisted context-signal snapshot did not match the authoritative cursor or item corpus and was rebuilt.";
|
|
80
|
+
readonly recovery_command: "pm context";
|
|
81
|
+
readonly recovery_effect: "Re-read context and confirm the rebuilt snapshot is now fresh.";
|
|
82
|
+
};
|
|
83
|
+
readonly context_signal_store_write_failed: {
|
|
84
|
+
readonly code: "context_signal_store_write_failed";
|
|
85
|
+
readonly meaning: "Context signals were rebuilt in memory, but the derived snapshot could not be persisted.";
|
|
86
|
+
readonly recovery_command: "pm context";
|
|
87
|
+
readonly recovery_effect: "Retry the derived snapshot write and confirm the warning clears after storage access is restored.";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
56
90
|
/** Workspace-bound feature-store options used by CLI, MCP, and SDK readers. */
|
|
57
91
|
export interface ReadWorkspaceContextSignalsOptions extends BuildItemContextRelevanceCandidatesOptions {
|
|
58
92
|
/** Tracker root containing rebuildable runtime state. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* history, while stale, absent, or corrupt snapshots rebuild transparently.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
!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]="
|
|
9
|
+
!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]="2a0f64cf-f6a4-5304-921d-c83b98d3a31f")}catch(e){}}();
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -24,6 +24,27 @@ const STORED_CONTEXT_SIGNAL_NAMES = [
|
|
|
24
24
|
"risk_pressure",
|
|
25
25
|
"knowledge_density",
|
|
26
26
|
];
|
|
27
|
+
/** Canonical actionable contracts shared by CLI, SDK, MCP, and package hosts. */
|
|
28
|
+
export const CONTEXT_SIGNAL_STORE_WARNING_DETAILS = {
|
|
29
|
+
context_signal_store_invalid: {
|
|
30
|
+
code: "context_signal_store_invalid",
|
|
31
|
+
meaning: "The persisted context-signal snapshot was unreadable or invalid and was rebuilt from authoritative items.",
|
|
32
|
+
recovery_command: "pm context",
|
|
33
|
+
recovery_effect: "Re-read context and confirm the rebuilt snapshot can be loaded without the warning.",
|
|
34
|
+
},
|
|
35
|
+
context_signal_store_stale: {
|
|
36
|
+
code: "context_signal_store_stale",
|
|
37
|
+
meaning: "The persisted context-signal snapshot did not match the authoritative cursor or item corpus and was rebuilt.",
|
|
38
|
+
recovery_command: "pm context",
|
|
39
|
+
recovery_effect: "Re-read context and confirm the rebuilt snapshot is now fresh.",
|
|
40
|
+
},
|
|
41
|
+
context_signal_store_write_failed: {
|
|
42
|
+
code: "context_signal_store_write_failed",
|
|
43
|
+
meaning: "Context signals were rebuilt in memory, but the derived snapshot could not be persisted.",
|
|
44
|
+
recovery_command: "pm context",
|
|
45
|
+
recovery_effect: "Retry the derived snapshot write and confirm the warning clears after storage access is restored.",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
27
48
|
function isRecord(value) {
|
|
28
49
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29
50
|
}
|
|
@@ -245,6 +266,7 @@ export class ContextSignalStore {
|
|
|
245
266
|
})),
|
|
246
267
|
cache_status: fresh ? "fresh" : "rebuilt",
|
|
247
268
|
warnings,
|
|
269
|
+
warning_details: warnings.map((warning) => CONTEXT_SIGNAL_STORE_WARNING_DETAILS[warning]),
|
|
248
270
|
};
|
|
249
271
|
}
|
|
250
272
|
}
|
|
@@ -288,4 +310,4 @@ export async function readWorkspaceContextSignals(items, options) {
|
|
|
288
310
|
return store.readOrRebuild(items, { ...options, sourceCursor, source });
|
|
289
311
|
}
|
|
290
312
|
//# sourceMappingURL=context-signal-store.js.map
|
|
291
|
-
//# debugId=
|
|
313
|
+
//# debugId=2a0f64cf-f6a4-5304-921d-c83b98d3a31f
|
|
@@ -5,5 +5,7 @@
|
|
|
5
5
|
* exposed by both the focused core entrypoint and the complete SDK barrel.
|
|
6
6
|
*/
|
|
7
7
|
export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, diagnoseAgentIdentity, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, type AgentClientInfo, type AgentModelSource, type AgentProvenance, type AgentProvenanceAbsenceReason, type AgentProvenanceObservation, type AgentProvenanceOutcome, type AuthorSource, type DetectedAgentIdentity, type DiagnosedAgentIdentity, type HarnessDetectionSignals, type HarnessSignalDescriptor, type ResolvedAuthorIdentity, } from "../core/shared/author.js";
|
|
8
|
-
export {
|
|
8
|
+
export { SEMANTIC_ATTRIBUTION_LIMITS, recordClaimSemanticAttribution, recordFocusSemanticAttribution, recordReleaseSemanticAttribution, resolveSemanticLineageIds, semanticAttributionAffinity, } from "./context/semantic-session-attribution.js";
|
|
9
|
+
export { explainSourceTraceability, parseSourceLineRange, type SourceDecisionPath, type SourceLineRange, type SourceTraceabilityEvidence, type SourceTraceabilityExplanation, type SourceTraceabilityRationale, type SourceTraceabilityReceipt, } from "./traceability/source-traceability.js";
|
|
10
|
+
export { analyzeAgentProvenanceDescriptorCoverage, evaluateSemanticAttributionCoverage, groupHistoryByEpisode, resolveHistoryEpisodeGroupIdentity, summarizeAgentProvenance, summarizeAgentModelProvenance, type AgentEpisodeGroup, type AgentModelProvenanceCoverage, type AgentProvenanceDimensionCoverage, type AgentProvenanceDescriptorCoverage, type AgentSemanticAttributionCoverage, type AgentSemanticAttributionCoverageGate, } from "./provenance.js";
|
|
9
11
|
export { analyzeSdkCliParameterCompleteness, type SdkCliActionParameterCoverage, type SdkCliCompletenessContractSource, type SdkCliParameterCoverageEntry, type SdkCliParameterDisposition, } from "./cli-contracts.js";
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* exposed by both the focused core entrypoint and the complete SDK barrel.
|
|
6
6
|
*/
|
|
7
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]="
|
|
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]="d19cfa31-a02f-53a7-8685-5d169d6e051d")}catch(e){}}();
|
|
9
9
|
export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, diagnoseAgentIdentity, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
|
|
10
|
-
export {
|
|
10
|
+
export { SEMANTIC_ATTRIBUTION_LIMITS, recordClaimSemanticAttribution, recordFocusSemanticAttribution, recordReleaseSemanticAttribution, resolveSemanticLineageIds, semanticAttributionAffinity, } from "./context/semantic-session-attribution.js";
|
|
11
|
+
export { explainSourceTraceability, parseSourceLineRange, } from "./traceability/source-traceability.js";
|
|
12
|
+
export { analyzeAgentProvenanceDescriptorCoverage, evaluateSemanticAttributionCoverage, groupHistoryByEpisode, resolveHistoryEpisodeGroupIdentity, summarizeAgentProvenance, summarizeAgentModelProvenance, } from "./provenance.js";
|
|
11
13
|
export { analyzeSdkCliParameterCompleteness, } from "./cli-contracts.js";
|
|
12
14
|
//# sourceMappingURL=core-governance.js.map
|
|
13
|
-
//# debugId=
|
|
15
|
+
//# debugId=d19cfa31-a02f-53a7-8685-5d169d6e051d
|
package/dist/sdk/core.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides the stable item lifecycle client and universal project data types.
|
|
5
5
|
*/
|
|
6
|
-
export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, canonicalDocument, classifyItemFormatVersion, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, isPmCliExpectedError, normalizeItemFormatVersion, normalizeItemId, normalizeStatusInput, nowIso, runAction, serializeItemDocument, aggregate, append, claim, claimNext, close, comments, context, copy, create, deleteItem, deps, docs, files, filesDiscover, focus, get, graph, learnings, list, next, notes, release, restore, search, update, type AggregateOptions, type AggregateResult, type AggregateRow, type AppendCommandOptions, type AppendResult, type ClaimNextOptions, type ClaimResult, type CloseResult, type CommentsCommandOptions, type CommentsResult, type ContextOptions, type ContextResult, type CopyResult, type CreateResult, type Dependency, type DeleteResult, type DepsCommandOptions, type DepsResult, type DocsCommandOptions, type DocsResult, type FilesCommandOptions, type FilesDiscoverOptions, type FilesDiscoverResult, type FilesResult, type FocusResult, type GetOptions, type GetResult, type ItemFormatVersionScanEntry, type ItemFormatVersionScanResult, type ItemFormatVersionStatus, type LearningsCommandOptions, type LearningsResult, type ListOptions, type ListResult, type NextOptions, type NextResult, type NotesCommandOptions, type NotesResult, type PmActionInput, type PmActionName, type PmActionOptions, type PmClientOptions, type ReleaseResult, type RestoreResult, type SearchOptions, type SearchResult, type UpdateResult, } from "./runtime.js";
|
|
6
|
+
export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, canonicalDocument, classifyItemFormatVersion, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, isPmCliExpectedError, normalizeItemFormatVersion, normalizeItemId, normalizeStatusInput, nowIso, runAction, serializeItemDocument, aggregate, append, claim, claimNext, close, comments, context, copy, create, deleteItem, deps, docs, files, filesDiscover, focus, get, graph, learnings, list, next, notes, release, restore, search, update, type AggregateOptions, type AggregateResult, type AggregateRow, type AssuranceActionInput, type AssuranceActionResult, type AppendCommandOptions, type AppendResult, type ClaimNextOptions, type ClaimResult, type CloseResult, type CommentsCommandOptions, type CommentsResult, type ContextOptions, type ContextResult, type CopyResult, type CreateResult, type Dependency, type DeleteResult, type DepsCommandOptions, type DepsResult, type DocsCommandOptions, type DocsResult, type FilesCommandOptions, type FilesDiscoverOptions, type FilesDiscoverResult, type FilesResult, type FocusResult, type GetOptions, type GetResult, type ItemFormatVersionScanEntry, type ItemFormatVersionScanResult, type ItemFormatVersionStatus, type LearningsCommandOptions, type LearningsResult, type ListOptions, type ListResult, type NextOptions, type NextResult, type NotesCommandOptions, type NotesResult, type PmActionInput, type PmActionName, type PmActionOptions, type PmClientOptions, type ReleaseResult, type RestoreResult, type SearchOptions, type SearchResult, type UpdateResult, } from "./runtime.js";
|
|
7
7
|
export * from "./core-governance.js";
|
|
8
8
|
export * from "./agent-session-context.js";
|
|
9
9
|
export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
|
package/dist/sdk/core.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Provides the stable item lifecycle client and universal project data types.
|
|
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]="c2f56389-6238-5b5c-add8-00296fe401b6")}catch(e){}}();
|
|
8
8
|
export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, canonicalDocument, classifyItemFormatVersion, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, isPmCliExpectedError, normalizeItemFormatVersion, normalizeItemId, normalizeStatusInput, nowIso, runAction, serializeItemDocument, aggregate, append, claim, claimNext, close, comments, context, copy, create, deleteItem, deps, docs, files, filesDiscover, focus, get, graph, learnings, list, next, notes, release, restore, search, update, } from "./runtime.js";
|
|
9
9
|
export * from "./core-governance.js";
|
|
10
10
|
export * from "./agent-session-context.js";
|
|
11
11
|
export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
|
|
12
12
|
export { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
|
|
13
13
|
//# sourceMappingURL=core.js.map
|
|
14
|
-
//# debugId=
|
|
14
|
+
//# debugId=c2f56389-6238-5b5c-add8-00296fe401b6
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Dependency } from "../types/index.js";
|
|
1
|
+
import type { Dependency, ItemFormat } from "../types/index.js";
|
|
2
2
|
import { type RelationshipKindRegistry } from "./relationships.js";
|
|
3
3
|
/** Reject malformed shorthand before item-id prefix normalization can create a dangling graph node. */
|
|
4
4
|
export declare function assertValidBareDependencyFlagValue(value: string, structured: boolean): void;
|
|
@@ -7,3 +7,17 @@ export declare function assertValidBareDependencyFlagValue(value: string, struct
|
|
|
7
7
|
* ontology before a create or update mutation writes item or history state.
|
|
8
8
|
*/
|
|
9
9
|
export declare function assertDependencyEdgesAllowed(holderId: string, dependencies: readonly Dependency[] | undefined, registry?: RelationshipKindRegistry): void;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve every newly supplied local dependency before a mutation commits.
|
|
12
|
+
* Explicit external provenance bypasses workspace lookup, while the opt-in
|
|
13
|
+
* unresolved mode returns durable warning tokens instead of pretending that
|
|
14
|
+
* the graph edge resolved successfully.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertDependencyTargetsResolvable(params: {
|
|
17
|
+
pmRoot: string;
|
|
18
|
+
dependencies: readonly Dependency[] | undefined;
|
|
19
|
+
idPrefix: string;
|
|
20
|
+
itemFormat: ItemFormat;
|
|
21
|
+
typeToFolder: Record<string, string>;
|
|
22
|
+
allowUnresolved?: boolean;
|
|
23
|
+
}): Promise<string[]>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** @module cli/commands/dependency-flag-validation */
|
|
2
2
|
|
|
3
|
-
!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]="
|
|
3
|
+
!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]="e7cd6092-ed18-52ea-94a0-03bed42eb858")}catch(e){}}();
|
|
4
4
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
5
5
|
import { PmCliError } from "../core/shared/errors.js";
|
|
6
6
|
import { toErrorMessage } from "../core/shared/primitives.js";
|
|
7
|
+
import { locateItem } from "../core/store/item-store.js";
|
|
8
|
+
import { isExternalDependencySourceKind } from "./dependency-provenance.js";
|
|
7
9
|
import { resolveWorkspaceRelationshipKindRegistry } from "./graph/assembly.js";
|
|
8
10
|
import { assertRelationshipEdgeAllowed, } from "./relationships.js";
|
|
9
11
|
/** Reject malformed shorthand before item-id prefix normalization can create a dangling graph node. */
|
|
@@ -29,5 +31,55 @@ export function assertDependencyEdgesAllowed(holderId, dependencies, registry =
|
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve every newly supplied local dependency before a mutation commits.
|
|
36
|
+
* Explicit external provenance bypasses workspace lookup, while the opt-in
|
|
37
|
+
* unresolved mode returns durable warning tokens instead of pretending that
|
|
38
|
+
* the graph edge resolved successfully.
|
|
39
|
+
*/
|
|
40
|
+
export async function assertDependencyTargetsResolvable(params) {
|
|
41
|
+
const localTargets = [
|
|
42
|
+
...new Set((params.dependencies ?? [])
|
|
43
|
+
.filter((dependency) => !isExternalDependencySourceKind(dependency.source_kind))
|
|
44
|
+
.map((dependency) => dependency.id)),
|
|
45
|
+
];
|
|
46
|
+
const resolutions = await Promise.all(localTargets.map(async (target) => ({
|
|
47
|
+
target,
|
|
48
|
+
located: await locateItem(params.pmRoot, target, params.idPrefix, params.itemFormat, params.typeToFolder),
|
|
49
|
+
})));
|
|
50
|
+
const targets = resolutions
|
|
51
|
+
.filter(({ located }) => located === null)
|
|
52
|
+
.map(({ target }) => target)
|
|
53
|
+
.sort((left, right) => (left < right ? -1 : 1));
|
|
54
|
+
if (targets.length === 0) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
if (params.allowUnresolved === true) {
|
|
58
|
+
return targets.map((target) => `dependency_target_unresolved:${target}`);
|
|
59
|
+
}
|
|
60
|
+
throw new PmCliError(`Dependency target${targets.length === 1 ? "" : "s"} not found: ${targets.join(", ")}`, EXIT_CODE.NOT_FOUND, {
|
|
61
|
+
code: "dependency_target_not_found",
|
|
62
|
+
reason: "unresolved_local_dependency",
|
|
63
|
+
required: "Every local dependency target must exist before the edge is committed.",
|
|
64
|
+
why: "Fail-fast target resolution prevents dangling graph nodes and preserves reliable traversal semantics.",
|
|
65
|
+
unresolved_targets: targets,
|
|
66
|
+
examples: [
|
|
67
|
+
"--dep id=<existing-item-id>,kind=related",
|
|
68
|
+
"--dep id=<external-id>,kind=related,source_kind=external",
|
|
69
|
+
"--allow-unresolved-deps --dep id=<future-item-id>,kind=related",
|
|
70
|
+
],
|
|
71
|
+
nextSteps: [
|
|
72
|
+
`Create or correct ${targets.length === 1 ? "the target" : "the targets"}, then retry the mutation.`,
|
|
73
|
+
"Use source_kind=external for a cross-workspace reference.",
|
|
74
|
+
"Use --allow-unresolved-deps only when the dangling local edge is intentional.",
|
|
75
|
+
],
|
|
76
|
+
recovery: {
|
|
77
|
+
recovery_mode: "compact",
|
|
78
|
+
missing: targets,
|
|
79
|
+
suggested_flags: ["--allow-unresolved-deps"],
|
|
80
|
+
suggested_retry: `pm search "${targets[0]}" --limit 10`,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
32
84
|
//# sourceMappingURL=dependency-flag-validation.js.map
|
|
33
|
-
//# debugId=
|
|
85
|
+
//# debugId=e7cd6092-ed18-52ea-94a0-03bed42eb858
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
export type PmErrorCodeStability = "provisional" | "stable";
|
|
9
9
|
/** Semantic process-exit class shared by shell and SDK consumers. */
|
|
10
10
|
export type PmErrorCodeClass = "generic_failure" | "usage" | "not_found" | "conflict" | "dependency_failed";
|
|
11
|
+
/** One externally observable refusal state and its executable entrypoint probe. */
|
|
12
|
+
export interface PmRefusalStateContract {
|
|
13
|
+
/** Stable semantic state owned by the error code. */
|
|
14
|
+
state: string;
|
|
15
|
+
/** Stable probe identifier implemented by the entrypoint conformance suite. */
|
|
16
|
+
probe_id: string;
|
|
17
|
+
/** Public command roots through which the state must remain reachable. */
|
|
18
|
+
entrypoints: string[];
|
|
19
|
+
/** Exit class expected when the probe reaches the state. */
|
|
20
|
+
expected_exit_class: PmErrorCodeClass;
|
|
21
|
+
}
|
|
11
22
|
/** Stable shell exit-code taxonomy shared by every structured error. */
|
|
12
23
|
export declare const PM_ERROR_CODE_EXIT_CLASS_CONTRACTS: readonly [{
|
|
13
24
|
readonly exit_code: 1;
|
|
@@ -47,6 +58,8 @@ export interface PmErrorCodeContract {
|
|
|
47
58
|
canonical_code?: string;
|
|
48
59
|
/** Stable compatibility spellings that resolve to this canonical code. */
|
|
49
60
|
aliases?: string[];
|
|
61
|
+
/** Observable states this code claims, each backed by a real-entrypoint probe. */
|
|
62
|
+
owned_states?: PmRefusalStateContract[];
|
|
50
63
|
}
|
|
51
64
|
/** Validate, normalize, sort, and freeze an error-code catalog. */
|
|
52
65
|
export declare function definePmErrorCodeCatalog(declarations: readonly PmErrorCodeContract[]): readonly PmErrorCodeContract[];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/** Stable shell exit-code taxonomy shared by every structured error. */
|
|
8
8
|
|
|
9
|
-
!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]="
|
|
9
|
+
!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]="c76fa303-6672-5c1e-9cf5-3a08bd3a7814")}catch(e){}}();
|
|
10
10
|
export const PM_ERROR_CODE_EXIT_CLASS_CONTRACTS = [
|
|
11
11
|
{ exit_code: 1, class: "generic_failure" },
|
|
12
12
|
{ exit_code: 2, class: "usage" },
|
|
@@ -21,6 +21,34 @@ function normalizeContractList(values) {
|
|
|
21
21
|
...new Set(values.map((value) => value.trim()).filter(Boolean)),
|
|
22
22
|
].sort();
|
|
23
23
|
}
|
|
24
|
+
function normalizeOwnedStates(states) {
|
|
25
|
+
if (!states)
|
|
26
|
+
return [];
|
|
27
|
+
const seenStates = new Set();
|
|
28
|
+
const seenProbes = new Set();
|
|
29
|
+
return states
|
|
30
|
+
.map((state) => {
|
|
31
|
+
const normalizedState = state.state.trim();
|
|
32
|
+
const probeId = state.probe_id.trim();
|
|
33
|
+
const entrypoints = normalizeContractList(state.entrypoints);
|
|
34
|
+
if (!/^[a-z][a-z0-9_]*$/.test(normalizedState) ||
|
|
35
|
+
!/^[a-z][a-z0-9-]*$/.test(probeId) ||
|
|
36
|
+
entrypoints.length === 0 ||
|
|
37
|
+
seenStates.has(normalizedState) ||
|
|
38
|
+
seenProbes.has(probeId)) {
|
|
39
|
+
throw new TypeError("Invalid pm refusal state contract");
|
|
40
|
+
}
|
|
41
|
+
seenStates.add(normalizedState);
|
|
42
|
+
seenProbes.add(probeId);
|
|
43
|
+
return {
|
|
44
|
+
state: normalizedState,
|
|
45
|
+
probe_id: probeId,
|
|
46
|
+
entrypoints,
|
|
47
|
+
expected_exit_class: state.expected_exit_class,
|
|
48
|
+
};
|
|
49
|
+
})
|
|
50
|
+
.sort((left, right) => left.state.localeCompare(right.state));
|
|
51
|
+
}
|
|
24
52
|
function isValidNormalizedErrorCodeContract(declaration, sources, emittingCommands, canonicalCode, aliases) {
|
|
25
53
|
return ![
|
|
26
54
|
[1, 2, 3, 4, 5].includes(declaration.exit_code),
|
|
@@ -86,9 +114,13 @@ export function definePmErrorCodeCatalog(declarations) {
|
|
|
86
114
|
const emittingCommands = normalizeContractList(declaration.emitting_commands);
|
|
87
115
|
const canonicalCode = (declaration.canonical_code ?? code).trim();
|
|
88
116
|
const aliases = normalizeContractList(declaration.aliases ?? []);
|
|
117
|
+
const ownedStates = normalizeOwnedStates(declaration.owned_states);
|
|
89
118
|
if (!isValidNormalizedErrorCodeContract(declaration, sources, emittingCommands, canonicalCode, aliases)) {
|
|
90
119
|
throw new TypeError(`Invalid pm error code contract: ${code}`);
|
|
91
120
|
}
|
|
121
|
+
if (ownedStates.some((state) => state.expected_exit_class !== declaration.class)) {
|
|
122
|
+
throw new TypeError(`Invalid pm refusal state exit class: ${code}`);
|
|
123
|
+
}
|
|
92
124
|
return Object.freeze({
|
|
93
125
|
...declaration,
|
|
94
126
|
code,
|
|
@@ -98,6 +130,7 @@ export function definePmErrorCodeCatalog(declarations) {
|
|
|
98
130
|
emitting_commands: emittingCommands,
|
|
99
131
|
canonical_code: canonicalCode,
|
|
100
132
|
aliases,
|
|
133
|
+
owned_states: ownedStates,
|
|
101
134
|
});
|
|
102
135
|
});
|
|
103
136
|
validateErrorCodeAliases(normalized);
|
|
@@ -118,4 +151,4 @@ export function resolvePmErrorCodeContract(code, catalog) {
|
|
|
118
151
|
return contract;
|
|
119
152
|
}
|
|
120
153
|
//# sourceMappingURL=error-code-catalog.js.map
|
|
121
|
-
//# debugId=
|
|
154
|
+
//# debugId=c76fa303-6672-5c1e-9cf5-3a08bd3a7814
|