@unbrained/pm-cli 2026.11.16 → 2026.11.18
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 +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-mutation.js +3 -2
- package/dist/cli/runtime/invocation-rewrites.js +2 -0
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-2VH6COJE.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-NHNM3GIP.js → chunk-5OFMWP3Q.js} +3 -3
- package/dist/cli-bundle/chunks/chunk-7ETRLLK3.js +31 -0
- package/dist/cli-bundle/chunks/chunk-7LCJA54R.js +2 -0
- package/dist/cli-bundle/chunks/chunk-7UUPLMCU.js +115 -0
- package/dist/cli-bundle/chunks/chunk-AGU7632B.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-J257NZRD.js → chunk-CGTVDSAR.js} +11 -11
- package/dist/cli-bundle/chunks/chunk-CR5GC3VO.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-KGOGLKL2.js → chunk-FJQCORYR.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-H64BNM4A.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-2D26HRXB.js → chunk-HQYIKAC6.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-JBPXNG6P.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-4I7YG3VZ.js → chunk-L2ZLH3LZ.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LGWP5D7V.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-I3T2FVUA.js → chunk-MUGGRKK3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FZ4XWWLO.js → chunk-OD2I3SFQ.js} +43 -43
- package/dist/cli-bundle/chunks/chunk-QK7RAN7R.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-2WNORBVN.js → chunk-S3RMFLEG.js} +83 -83
- package/dist/cli-bundle/chunks/chunk-SSZBVRIN.js +6 -0
- package/dist/cli-bundle/chunks/chunk-T3E3WNHO.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-DZWRNL6R.js → chunk-TA5VN4ME.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TS2CZE3O.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-F7P42FL5.js → chunk-VETSGCF4.js} +4 -4
- package/dist/cli-bundle/chunks/{chunk-VJLZHOTP.js → chunk-WKHS4QC6.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-XDIJK6VW.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-NYN5OR2T.js → chunk-Y4LXVPA5.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-YJI2Y5N6.js +2 -0
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-HNLN6UXH.js → indexed-receipt-blobs-ELEMA7IW.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-PSOL5I4H.js → item-revision-BV5BUBCR.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-E2ST3A3X.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-BDBBH3ZS.js → mutation-actor-DDYJW5B4.js} +2 -2
- package/dist/cli-bundle/chunks/mutation-admission-5AWMXMCB.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-AESCVO6H.js → register-list-query-RJT7YBRF.js} +2 -2
- package/dist/cli-bundle/chunks/register-mutation-6KTMJGYF.js +21 -0
- package/dist/cli-bundle/chunks/register-operations-W24TA3HZ.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-QK67WUX6.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-MVVVUIVZ.js → settlement-hook-E5LHZ4RD.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-RMU3JAWM.js → stage-XGWW3T64.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3H3SVHAT.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-DFBHW7HP.js → chunk-5JVB42Z7.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-ONM2R32I.js → chunk-6OZ7BKWJ.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-HHMMIHZP.js → chunk-7RF2YPZ5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7Z2NYAK4.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-A2CLYPDA.js +102 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7SEPCQV2.js → chunk-DH4DHL6V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UBBTBNUY.js → chunk-DWCFZVT2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DZMP3VYQ.js → chunk-EO4XM3XJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-EZXLY6S4.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KRNF3WTC.js → chunk-FPPYE6CY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-HO2YUD4P.js +91 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BEHIMEV2.js → chunk-ICEHI4SN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IGMFXB5W.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PDXSMSO5.js → chunk-IXYBN6D2.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-PEL4SQXV.js → chunk-LZR3JKYT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MTBC32ZR.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-OAIAZHRG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SFATIM77.js → chunk-ONHUG7IL.js} +9 -9
- package/dist/cli-bundle/focused-chunks/chunk-OPY43DNJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PNCCTZKI.js +44 -0
- package/dist/cli-bundle/focused-chunks/chunk-T3NMYMW4.js +27 -0
- package/dist/cli-bundle/focused-chunks/chunk-XS2YZCT5.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-ZFUZ4YYN.js +8 -0
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-ADMQXF3N.js → indexed-receipt-blobs-ZTRFCPH7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-NS2V4WON.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-NENC4HYI.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-2SVBO324.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-DZIBDJAE.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-5U2M75BY.js → settlement-hook-OUBUN45C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/stage-LVAGKCEE.js +2 -0
- package/dist/cli-bundle/main.js +27 -27
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +1 -1
- 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 +58 -58
- 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 +4 -4
- package/dist/core/extensions/extension-hook-runtime.d.ts +14 -2
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-types.d.ts +14 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/fs/file-glob.js +2 -0
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +83 -4
- package/dist/core/shared/secret-rules.js +5 -4
- package/dist/core/store/item-mutation-precondition.d.ts +32 -1
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/transaction-coordinator-scope.js +2 -0
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/linked-artifacts.js +2 -2
- package/dist/sdk/mutation-guard.d.ts +25 -4
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/package-import-adapters.d.ts +14 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/testing.d.ts +21 -3
- package/dist/sdk/testing.js +2 -2
- package/dist/sdk/workspace-transaction.js +2 -2
- package/docs/COMMANDS.md +33 -0
- package/docs/DEFECT_RECURRENCE.md +3 -2
- package/docs/EXTENSIONS.md +1 -1
- package/docs/MIGRATION_CLI_SIMPLIFICATION.md +1 -1
- package/docs/MUTATION_INTEGRITY.md +187 -7
- package/docs/SDK.md +40 -3
- package/docs/WORKFLOW_POLICIES.md +23 -0
- package/marketplace.json +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/core/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/core/package.json +2 -2
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/execAsync.js +1 -0
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/execAsync.js +1 -0
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-bsd.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esnext/detectors/platform/node/machine-id/getMachineId-darwin.js +3 -2
- package/node_modules/@opentelemetry/resources/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.d.ts +1 -0
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js +2 -1
- package/node_modules/@opentelemetry/resources/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/resources/package.json +3 -3
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace/package.json +5 -5
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/esnext/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.d.ts +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/build/src/version.js +1 -1
- package/node_modules/@opentelemetry/sdk-trace-base/package.json +7 -7
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +18202 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/experimental_attributes.js → dist/experimental_attributes.d.cts} +3328 -1993
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_attributes.js → dist/experimental_attributes.d.mts} +3328 -1935
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +16385 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +325 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_events.js → dist/experimental_events.d.cts} +37 -41
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_events.js → dist/experimental_events.d.mts} +37 -41
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +295 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +4929 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/experimental_metrics.js → dist/experimental_metrics.d.cts} +955 -597
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/experimental_metrics.js → dist/experimental_metrics.d.mts} +955 -597
- package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +4419 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +2619 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.cts +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.d.mts +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +7 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +670 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.cts +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.d.mts +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +6 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.cjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/internal/utils.mjs +20 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.cjs +1326 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.cts} +600 -597
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/resource/SemanticResourceAttributes.d.ts → dist/resource/SemanticResourceAttributes.d.mts} +600 -597
- package/node_modules/@opentelemetry/semantic-conventions/dist/resource/SemanticResourceAttributes.mjs +1188 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +2038 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_attributes.js → dist/stable_attributes.d.cts} +327 -220
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/stable_attributes.js → dist/stable_attributes.d.mts} +327 -220
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +1841 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.cjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.cts +8 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.d.mts +8 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_events.mjs +9 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +378 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/stable_metrics.js → dist/stable_metrics.d.cts} +69 -63
- package/node_modules/@opentelemetry/semantic-conventions/{build/esm/stable_metrics.js → dist/stable_metrics.d.mts} +69 -59
- package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +326 -0
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.cjs +2508 -0
- package/node_modules/@opentelemetry/semantic-conventions/{build/esnext/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.cts} +1097 -1094
- package/node_modules/@opentelemetry/semantic-conventions/{build/src/trace/SemanticAttributes.d.ts → dist/trace/SemanticAttributes.d.mts} +1097 -1094
- package/node_modules/@opentelemetry/semantic-conventions/dist/trace/SemanticAttributes.mjs +2236 -0
- package/node_modules/@opentelemetry/semantic-conventions/package.json +27 -42
- package/node_modules/@sentry/core/build/cjs/client.js +14 -5
- package/node_modules/@sentry/core/build/cjs/integrations/express/patch-layer.js +15 -1
- package/node_modules/@sentry/core/build/cjs/integrations/http/client-subscriptions.js +10 -1
- package/node_modules/@sentry/core/build/cjs/scope.js +0 -1
- package/node_modules/@sentry/core/build/cjs/tracing/openai/utils.js +1 -7
- package/node_modules/@sentry/core/build/cjs/tracing/sentrySpan.js +11 -0
- package/node_modules/@sentry/core/build/cjs/utils/envelope.js +1 -1
- package/node_modules/@sentry/core/build/cjs/utils/sql.js +1 -1
- package/node_modules/@sentry/core/build/cjs/utils/tunnel.js +9 -0
- package/node_modules/@sentry/core/build/cjs/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/esm/client.js +14 -5
- package/node_modules/@sentry/core/build/esm/integrations/express/patch-layer.js +15 -1
- package/node_modules/@sentry/core/build/esm/integrations/http/client-subscriptions.js +10 -1
- package/node_modules/@sentry/core/build/esm/package.json +1 -1
- package/node_modules/@sentry/core/build/esm/scope.js +0 -1
- package/node_modules/@sentry/core/build/esm/tracing/openai/utils.js +1 -7
- package/node_modules/@sentry/core/build/esm/tracing/sentrySpan.js +11 -0
- package/node_modules/@sentry/core/build/esm/utils/envelope.js +1 -1
- package/node_modules/@sentry/core/build/esm/utils/sql.js +1 -1
- package/node_modules/@sentry/core/build/esm/utils/tunnel.js +9 -1
- package/node_modules/@sentry/core/build/esm/utils/version.js +1 -1
- package/node_modules/@sentry/core/build/types/types/datacategory.d.ts +1 -1
- package/node_modules/@sentry/core/build/types/utils/tunnel.d.ts +1 -0
- package/node_modules/@sentry/core/build/types-ts3.8/types/datacategory.d.ts +1 -1
- package/node_modules/@sentry/core/build/types-ts3.8/utils/tunnel.d.ts +1 -0
- package/node_modules/@sentry/core/package.json +1 -1
- package/node_modules/@sentry/node/build/cjs/integrations/tracing/redis/index.js +1 -1
- package/node_modules/@sentry/node/build/esm/package.json +1 -1
- package/node_modules/@sentry/node/package.json +6 -6
- package/node_modules/@sentry/node-core/build/cjs/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/contextlines.js +6 -4
- package/node_modules/@sentry/node-core/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/cjs/integrations/modules.js +21 -2
- package/node_modules/@sentry/node-core/build/cjs/integrations/node-fetch/undici-instrumentation.js +8 -0
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/index.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/anr/worker-script.js +2 -2
- package/node_modules/@sentry/node-core/build/esm/integrations/contextlines.js +7 -5
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/local-variables/worker-script.js +1 -1
- package/node_modules/@sentry/node-core/build/esm/integrations/node-fetch/undici-instrumentation.js +8 -0
- package/node_modules/@sentry/node-core/build/esm/package.json +1 -1
- package/node_modules/@sentry/node-core/package.json +9 -9
- package/node_modules/@sentry/opentelemetry/build/esm/package.json +1 -1
- package/node_modules/@sentry/opentelemetry/package.json +6 -6
- package/node_modules/@sentry/server-utils/build/THIRD-PARTY-LICENSES.txt +32 -32
- package/node_modules/@sentry/server-utils/build/cjs/integrations/tracing-channel/express/instrumentation.js +12 -1
- package/node_modules/@sentry/server-utils/build/esm/integrations/tracing-channel/express/instrumentation.js +13 -2
- package/node_modules/@sentry/server-utils/build/esm/package.json +1 -1
- package/node_modules/@sentry/server-utils/build/types/integrations/tracing-channel/express/types.d.ts +1 -1
- package/node_modules/@sentry/server-utils/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +1 -1
- package/node_modules/@sentry/server-utils/package.json +2 -2
- package/node_modules/debug/package.json +1 -1
- package/node_modules/es-module-lexer/dist/lexer.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.asm.js +2 -2
- package/node_modules/es-module-lexer/dist/lexer.minimal.cjs +1 -1
- package/node_modules/es-module-lexer/dist/lexer.minimal.js +2 -2
- package/node_modules/es-module-lexer/package.json +1 -1
- package/node_modules/import-in-the-middle/CHANGELOG.md +35 -0
- package/node_modules/import-in-the-middle/README.md +15 -1
- package/node_modules/import-in-the-middle/create-hook.mjs +370 -155
- package/node_modules/import-in-the-middle/index.d.ts +8 -2
- package/node_modules/import-in-the-middle/index.js +80 -53
- package/node_modules/import-in-the-middle/lib/get-esm-exports.mjs +37 -3
- package/node_modules/import-in-the-middle/lib/get-exports.mjs +33 -40
- package/node_modules/import-in-the-middle/lib/register.js +81 -16
- package/node_modules/import-in-the-middle/package.json +9 -5
- package/node_modules/supports-color/browser.js +21 -2
- package/node_modules/supports-color/index.js +41 -24
- package/node_modules/supports-color/license +1 -1
- package/node_modules/supports-color/package.json +11 -6
- package/node_modules/supports-color/readme.md +8 -7
- package/package.json +4 -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/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-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-4WIVCOA7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-A3WCP4TU.js +0 -6
- package/dist/cli-bundle/chunks/chunk-AB5S6TWE.js +0 -124
- package/dist/cli-bundle/chunks/chunk-BV7J3LRH.js +0 -114
- package/dist/cli-bundle/chunks/chunk-E4BQRZF2.js +0 -10
- package/dist/cli-bundle/chunks/chunk-ERD2RYWM.js +0 -31
- package/dist/cli-bundle/chunks/chunk-IGEBFNWE.js +0 -2
- package/dist/cli-bundle/chunks/chunk-IYICNCK2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-JD3XWF66.js +0 -3
- package/dist/cli-bundle/chunks/chunk-JLHD7OQ2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LC4DJVXR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OFZQEQ6X.js +0 -2
- package/dist/cli-bundle/chunks/chunk-QGL5IAP4.js +0 -8
- package/dist/cli-bundle/chunks/chunk-R24NZ2TB.js +0 -8
- package/dist/cli-bundle/chunks/chunk-VO2HSB5F.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-55QTCU2M.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-WUN7JYVJ.js +0 -2
- package/dist/cli-bundle/chunks/register-mutation-SKCEP5QU.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-ZT4OYCF3.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-JVWNS2TY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3WVMEA2A.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-5UVJOAUP.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-5WQ3LNUK.js +0 -78
- package/dist/cli-bundle/focused-chunks/chunk-6E4X7MQA.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-7XHE335U.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CZFZCSOX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HPC2M6JD.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-HR5FEUUL.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-J7ESCE7M.js +0 -24
- package/dist/cli-bundle/focused-chunks/chunk-KWZLY35A.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-M4IA4LC6.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-NASE6JC2.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QJ647CQE.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZCN35TCK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZSQ2FT22.js +0 -44
- package/dist/cli-bundle/focused-chunks/item-revision-GNKYO6GZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-AUUQHR5Z.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-actor-OBRD7HFZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-6TX3EOJX.js +0 -2
- package/dist/cli-bundle/focused-chunks/stage-LERF2YJU.js +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_attributes.js +0 -14991
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.d.ts +0 -1453
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.d.ts +0 -2664
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esm/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index-incubating.js +0 -13
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/index.js +0 -16
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/internal/utils.js +0 -23
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/SemanticResourceAttributes.js +0 -1250
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/resource/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_events.js +0 -12
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/stable_metrics.js +0 -315
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/SemanticAttributes.js +0 -2360
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/trace/index.js +0 -10
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/esnext/version.js +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_attributes.d.ts +0 -14984
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.d.ts +0 -291
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_events.js +0 -301
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.d.ts +0 -4053
- package/node_modules/@opentelemetry/semantic-conventions/build/src/experimental_metrics.js +0 -4072
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index-incubating.js +0 -29
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.d.ts +0 -6
- package/node_modules/@opentelemetry/semantic-conventions/build/src/index.js +0 -32
- package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.d.ts +0 -7
- package/node_modules/@opentelemetry/semantic-conventions/build/src/internal/utils.js +0 -27
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/SemanticResourceAttributes.js +0 -1255
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/resource/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.d.ts +0 -1726
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_attributes.js +0 -1759
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.d.ts +0 -5
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_events.js +0 -15
- package/node_modules/@opentelemetry/semantic-conventions/build/src/stable_metrics.d.ts +0 -308
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/SemanticAttributes.js +0 -2368
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/trace/index.js +0 -26
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.d.ts +0 -2
- package/node_modules/@opentelemetry/semantic-conventions/build/src/version.js +0 -10
- package/node_modules/fdir/LICENSE +0 -7
- package/node_modules/fdir/README.md +0 -91
- package/node_modules/fdir/dist/index.cjs +0 -588
- package/node_modules/fdir/dist/index.d.cts +0 -155
- package/node_modules/fdir/dist/index.d.mts +0 -155
- package/node_modules/fdir/dist/index.mjs +0 -570
- package/node_modules/fdir/package.json +0 -106
- package/node_modules/picomatch/LICENSE +0 -21
- package/node_modules/picomatch/README.md +0 -743
- package/node_modules/picomatch/index.js +0 -17
- package/node_modules/picomatch/lib/constants.js +0 -184
- package/node_modules/picomatch/lib/parse.js +0 -1425
- package/node_modules/picomatch/lib/picomatch.js +0 -361
- package/node_modules/picomatch/lib/scan.js +0 -403
- package/node_modules/picomatch/lib/utils.js +0 -72
- package/node_modules/picomatch/package.json +0 -83
- package/node_modules/picomatch/posix.js +0 -3
- package/node_modules/tinyglobby/LICENSE +0 -21
- package/node_modules/tinyglobby/README.md +0 -25
- package/node_modules/tinyglobby/dist/index.cjs +0 -335
- package/node_modules/tinyglobby/dist/index.d.cts +0 -148
- package/node_modules/tinyglobby/dist/index.d.mts +0 -148
- package/node_modules/tinyglobby/dist/index.mjs +0 -307
- package/node_modules/tinyglobby/package.json +0 -70
- /package/node_modules/import-in-the-middle/{register-hooks.d.ts → register-hooks.d.mts} +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{$b as ae,Aa as $t,Eb as ke,Fb as Ee,Gb as se,Hb as Ae,Ia as ve,Jc as Gt,Xb as Re,Yb as Ft,Zb as Te,_ as Mt,ac as Se,bd as qt,cb as ie,nb as Bt,od as zt,sc as xe,ya as Ut,za as Lt}from"./chunk-3WVMEA2A.js";import{A as h,E as Pt,z as y}from"./chunk-PDXSMSO5.js";import{stripVTControlCharacters as qo}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="493a0675-0114-5b93-b3b4-5bd895ac691f")}catch{}})();var zo=["full","compact","brief","summary","counts"],Aa=["mutation","read","discovery","governance"],Kt=["error","warning","validation_summary","recovery_bundle"],Wo=["full","omit_explanation","limit_collections","compact_recovery","action_only"],Ko=new Set(["append","claim","close","close-many","close-task","comments","config","copy","create","delete","docs","event","files","focus","history-author-acknowledge","history-compact","history-redact","history-repair","init","item","learnings","meet","notes","pause-task","release","remind","restore","schema","start-task","update","update-many"]),Vo=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),Ho=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),Jo={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},Yo=3,Xo=2,Qo=192,Zo={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},er=Kt.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:Zo[e],minimum_max_estimated_tokens:Qo,degradation_ladder:Wo,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),tr=new Map(er.map(e=>[e.diagnostic_class,e]));function nr(e){let[t=""]=ie(e).split(/\s+/u);return Ko.has(t)?"mutation":Vo.has(t)?"discovery":Ho.has(t)?"governance":"read"}function Vt(e,t=nr(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let o=Jo[t];return or({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*Yo/Xo)},degradation_ladder:zo,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function or(e){if(!Number.isSafeInteger(e.default_max_estimated_tokens)||e.default_max_estimated_tokens<=0)throw new RangeError("default_max_estimated_tokens must be a positive safe integer");for(let[t,n]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var rr=Bt.map(e=>Vt(e)),ir=new Map(rr.map(e=>[e.command,e]));function Ht(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=ie(n).split(" "),r=ir.get(o);return r?{...r,command:n}:t.generateFallback?Vt(n):null}function $(e){return Math.ceil(Math.max(0,e)/4)}function Jt(e){let t=tr.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${Kt.join(", ")}`);return t}function j(e){return $(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Je(e){if(!sr(e))return;let t={};for(let n of["suggested_retry","suggested_retry_args","next_best_command","allowed_values","candidate_commands","missing","missing_required_fields","option_scope","retry_after_ms","waited_ms","owner_handoffs"]){let o=e[n];Array.isArray(o)?t[n]=n==="suggested_retry_args"?o:o.slice(0,3):o!==void 0&&(t[n]=o)}return Object.keys(t).length>0?t:void 0}function ar(e,t){return typeof e!="string"||e.length<=t?e:`${Re(e,Math.max(1,t-3))}...`}function L(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let n="...",o=Array.from(e),r=0,i=o.length;for(;r<i;){let s=Math.ceil((r+i)/2),a=`${o.slice(0,s).join("")}${n}`;Buffer.byteLength(a,"utf8")<=t?r=s:i=s-1}return`${o.slice(0,r).join("")}${n}`}function Yt(e){let t={};for(let n of["code","required","recovery","next_steps","exit_code","type","title","detail","why","examples"])Object.hasOwn(e,n)&&e[n]!==void 0&&(t[n]=e[n]);for(let[n,o]of Object.entries(e))n!=="__proto__"&&!Object.hasOwn(t,n)&&(t[n]=o);return t}var cr=new Set(["limit_collections","compact_recovery","action_only"]),ur=new Set(["compact_recovery","action_only"]);function dr(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:ar(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},n=Je(e.recovery);return n!==void 0?t.recovery=n:Array.isArray(e.next_steps)&&(t.next_steps=e.next_steps.slice(0,1)),e.exit_code!==void 0&&(t.exit_code=e.exit_code),e.type!==void 0&&(t.type=e.type),t}function lr(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),cr.has(t))for(let[o,r]of Object.entries(n))Array.isArray(r)&&(n[o]=r.slice(0,3));if(ur.has(t)){let o=Je(n.recovery);o?n.recovery=o:delete n.recovery}return t!=="action_only"?Yt(n):dr(n)}function J(e,t){let n={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let o=0;o<4;o+=1){let r=j(n),i=n.diagnostic_output;if(i.estimated_tokens===r)break;i.estimated_tokens=r}return n}function fr(e,t,n){let o=J(e,t);for(let i of["recovery","exit_code"])j(o)<=n||e[i]===void 0||(delete e[i],o=J(e,t));let r=40;for(;j(o)>n&&r>4;)r-=4,e.code=L(String(e.code),r),e.required=L(String(e.required),r),o=J(e,t);return o}function _r(e,t){let n=e.diagnostic_output,{estimated_tokens:o,...r}=n,i=r.omitted_fields.slice(0,8).map(_=>L(_,32)),s={...r,omitted_fields:i,...r.omitted_fields.length>i.length?{omitted_fields_overflow_count:r.omitted_fields.length-i.length}:{}},a=Je(e.recovery),c=a&&j(a)<=48?a:void 0,d={code:L(String(e.code),320),required:L(String(e.required),320),...c?{recovery:c}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},u=J(d,s);for(;j(u)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=r.omitted_fields.length-s.omitted_fields.length,u=J(d,s);return u=fr(d,s,t),u}function Ra(e,t={}){let n=e,o=t.diagnosticClass??"error",r=Jt(o),i=t.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.json,a=j(n),c=Object.keys(n);if(a<=s)return Yt(structuredClone(n));let d;for(let[u,_]of r.degradation_ladder.entries()){let l=lr(n,_),f=c.filter(p=>!Object.hasOwn(l,p)),m=J(l,{diagnostic_class:o,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:u>0,degradation_steps:r.degradation_ladder.slice(0,u+1),omitted_fields:f});if(d=m,j(m)<=s)break}return j(d)>s&&(d=_r(d,s)),d}function Wt(e){return qo(e).replace(/\r\n/gu,`
|
|
2
|
-
`).replace(/[^\P{Cc}\n]/gu," ")}function Ta(e,t,n={}){let o=n.diagnosticClass??"error",r=Jt(o),i=n.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.text,a=Wt(e),c=$(Buffer.byteLength(a,"utf8")),d=c>s,u=`What is required:
|
|
3
|
-
`,_=`
|
|
4
|
-
|
|
5
|
-
${L(a.trimStart().split(/\r?\n/u,1)[0].trim(),320)}
|
|
6
|
-
|
|
7
|
-
Diagnostic output exceeded its declared ${s}-token ceiling; rerun with structured JSON for the bounded recovery envelope.`,l=Wt(t).trim()||"Inspect the diagnostic code and retry with corrected input.",f=Math.max(1,s*4-Buffer.byteLength(`${u}${_}`,"utf8")),m=d?`${u}${L(l,f)}${_}`:a;return{output:m,diagnostic_output:{diagnostic_class:o,format:"text",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:c,estimated_tokens:$(Buffer.byteLength(m,"utf8")),truncated:d,degradation_steps:d?[...r.degradation_ladder]:["full"],omitted_fields:d?["explanation","collections"]:[]}}}var Ye=Object.freeze({required:"Adjust command input or tracker state and retry.",why:Object.freeze(["pm enforces explicit, deterministic contracts for data and command semantics.","Commander validates CLI contracts before execution.","Unexpected runtime failures can occur from environment or extension-level issues.","Validation protects data consistency and deterministic behavior across commands.","Required options define command intent and enforce deterministic write contracts."]),examples:Object.freeze(["pm --help","pm <command> --help"])});function Sa(e){return e?.trim()===Ye.required}function xa(e){let t=e?.trim();return t!==void 0&&Ye.why.includes(t)}function Ca(e){return(e??[]).filter(t=>!Ye.examples.includes(t.trim()))}var Ia=Object.freeze(["attempted_command","normalized_args","provided_fields"]);function ja(e){if(!e)return;let{attempted_command:t,normalized_args:n,provided_fields:o,...r}=e;return Object.values(r).some(i=>i!==void 0)?r:void 0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3a351971-6cfb-55eb-a266-3fec0af9eaa4")}catch{}})();var S=Object.freeze({comments:Object.freeze({paths:Object.freeze(["comments"]),total_key:"total_count"}),notes:Object.freeze({paths:Object.freeze(["notes"]),total_key:"total_count",delivered_row_counters:Object.freeze([Object.freeze({key:"structured_event_count",field:"format",equals:"json"})])}),learnings:Object.freeze({paths:Object.freeze(["learnings"]),total_key:"total_count"})});function B(e,t){return e===void 0?!1:(Object.hasOwn(S,e)?S[e]:void 0)?.paths.includes(t)===!0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a65d6520-0e6f-5627-a4dd-bd455c2db0fa")}catch{}})();var Zt=new WeakMap;function Ua(e,t){Zt.set(e,new Set(t))}var Ce='.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end',mr={context:{row_keys:["high_level","low_level"],fields:"supported"},get:{row_keys:["children"],fields:"supported"},list:{row_keys:["items"],fields:"supported"},next:{row_keys:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],fields:"unsupported"},search:{row_keys:["items"],fields:"supported"},activity:{row_keys:["activity_digest","compact_activity","provenance_activity","activity"],fields:"unsupported"},history:{row_keys:["compact_history","provenance_history","history","diff"],fields:"unsupported"},deps:{row_keys:["graph.nodes","graph.edges","context.nodes","context.edges"],fields:"unsupported"},health:{row_keys:["checks"],fields:"unsupported"},aggregate:{row_keys:["groups"],fields:"unsupported"},duplicates:{row_keys:["clusters"],fields:"unsupported"},stats:{row_keys:["by_type","by_status"],fields:"unsupported"},comments:{row_keys:["comments"],fields:"unsupported"},notes:{row_keys:["notes"],fields:"unsupported"},learnings:{row_keys:["learnings"],fields:"unsupported"},files:{row_keys:["files"],fields:"unsupported"},docs:{row_keys:["docs"],fields:"unsupported"},validate:{row_keys:["checks","warnings"],fields:"unsupported"},contracts:{row_keys:["command_summaries","commands"],fields:"unsupported"}},pr=[{command:"activity",complete_mode:"full",omissions_by_mode:{digest:[{name:"event_rows",restore_with:"--raw"}],compact:[{name:"provenance",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}},{command:"history",complete_mode:"full",omissions_by_mode:{compact:[{name:"raw_history",restore_with:"--full"}],provenance:[{name:"patch_and_hashes",restore_with:"--full"}]}}];function La(e,t,n){if(e&&t)throw new h(`${n} cannot be combined with --full`,y.USAGE)}function x(e,t=new Set){let n=e.filter(o=>!t.has(o.name)).map(o=>({...o}));return{has_omissions:n.length>0,omitted_field_group_count:n.length,omitted_field_groups:n}}function $a(e,t){let n=pr.find(r=>r.command===e);if(n===void 0)throw new TypeError(`Unknown mode-paired output command: ${e}`);if(t===n.complete_mode)return x([]);let o=n.omissions_by_mode[t];if(o===void 0)throw new TypeError(`Unknown ${e} output mode: ${t}`);return x(o)}var gr=[{name:"hierarchy",restore_with:"--section hierarchy"},{name:"activity",restore_with:"--section activity"},{name:"progress",restore_with:"--section progress"},{name:"blockers",restore_with:"--section blockers"},{name:"recently_created",restore_with:"--section recently_created"},{name:"unparented",restore_with:"--section unparented"},{name:"files",restore_with:"--section files"},{name:"workload",restore_with:"--section workload"},{name:"staleness",restore_with:"--section staleness"},{name:"tests",restore_with:"--section tests"}];function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var yr=new Set([void 0,"tabular_when_uniform"]),hr=new Set(["collection","none"]),br=new Set(["supported","unsupported"]);function Xt(e,t){return Array.isArray(e)&&(t||e.length>0)&&e.every(n=>typeof n=="string"&&n.length>0)&&new Set(e).size===e.length}function wr(e){return R(e)&&typeof e.command=="string"&&e.command.trim().length>0&&hr.has(e.row_kind)&&Xt(e.row_keys,!0)&&(e.continuation_row_keys===void 0||Xt(e.continuation_row_keys,!1))&&br.has(e.fields)&&yr.has(e.toon_encoding)&&(e.row_kind==="collection"?e.row_keys.length>0&&typeof e.jq_selector=="string"&&e.jq_selector.trim().length>0:e.row_keys.length===0&&e.jq_selector===void 0)}var Or={ancestors:["ids"],descendants:["ids"],predecessors:["ids"],successors:["ids"],paths:["paths"],impact:["affected"],audit:["findings"],communities:["communities"],redundancy:["redundant"],dominators:["bottlenecks"],slack:["rows"],centrality:["rows"],articulation:["articulation_points","bridges"],plan:["steps"]},vr={context:["sections_included","high_level","low_level"],get:["item"],list:["items","projection"],next:["recommended","ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items","projection"],activity:["activity_digest","compact_activity","provenance_activity","activity"],history:["compact_history","provenance_history","history","diff"],deps:["tree","graph","projection"],health:["checks"],aggregate:["groups"],duplicates:["clusters"],stats:["totals","by_type","by_status"],comments:["comments"],notes:["notes"],learnings:["learnings"],files:["files"],docs:["docs"],validate:["checks","warnings"],contracts:["command_summaries","commands","selected"]};function kr(e,t){let n=e.trim().toLowerCase().split(/\s+/u,1)[0],o=n?.startsWith("list-")?"list":n;if(o==="graph"){let s=typeof t.subcommand=="string"?t.subcommand:"";if(s.length===0)return;let a=Or[s];if(a===void 0)return;let c=a.filter(d=>Array.isArray(t[d])||R(t[d]));return{command:"graph",row_kind:c.length>0?"collection":"none",row_keys:c,fields:"unsupported",...c.length>0?{jq_selector:Ce}:{},toon_encoding:"tabular_when_uniform"}}let r=mr[o],i=vr[o];return r===void 0||i===void 0||!i.some(s=>Object.hasOwn(t,s))?void 0:(()=>{let s=r.row_keys.filter(a=>{let c=a.split(".").reduce((d,u)=>R(d)?d[u]:void 0,t);return Array.isArray(c)||R(c)});return{command:o,row_kind:s.length>0?"collection":"none",row_keys:s,fields:r.fields,...s.length>0?{jq_selector:Ce}:{},toon_encoding:"tabular_when_uniform"}})()}function Er(e){if(!R(e.projection)||typeof e.projection.mode!="string"||e.projection.mode.trim().length===0)return;let t=e.projection.declared_field_groups,n=e.projection.included_field_groups;if(!Array.isArray(t)||!Array.isArray(n))return;let o=t.filter(s=>R(s)&&typeof s.name=="string"&&s.name.trim().length>0&&typeof s.restore_with=="string"&&s.restore_with.trim().length>0),r=n.filter(s=>typeof s=="string");if(o.length!==t.length||r.length!==n.length)return;let i=new Set(o.map(s=>s.name));if(!(i.size!==o.length||new Set(r).size!==r.length||r.some(s=>!i.has(s))))return x(o,new Set(r))}function Ar(e){if(!Array.isArray(e.sections_included))return;let t=x(gr,new Set(e.sections_included.filter(n=>typeof n=="string")));return R(e.summary)&&e.summary.scope==="matching_items"&&(t.summary_scope="matching_items"),t}function Rr(e,t,n){if(e==="dependency_provenance")return!1;let o=en(e);if(o!==void 0){let r=n[o.facet];return R(r)&&Object.hasOwn(r,o.member)}return Object.hasOwn(t,e)||(e==="reminders"||e==="events")&&R(n.schedule)&&Object.hasOwn(n.schedule,e)||["files","tests","docs"].includes(e)&&R(n.linked)&&Array.isArray(n.linked[e])&&n.linked[e].length>0}function en(e){let t=e.indexOf(".");return t===-1?void 0:{facet:e.slice(0,t),member:e.slice(t+1)}}function Tr(e){if(!R(e.item))return;let t=e.item,n=["comments","notes","learnings","files","tests","docs","reminders","events"],o=["body","children","claim_state","linked","schedule"],r=Zt.get(e),i=a=>n.includes(a)||a==="body"||a==="dependency_provenance"?t:e,s=["body",...n,...o.slice(1),...r?.has("dependency_provenance")?["dependency_provenance"]:[],...r?.has("blockers")||Object.hasOwn(e,"blockers")?["blockers"]:[],...[...r??[]].filter(a=>en(a)!==void 0)].filter(a=>r===void 0||r.has(a)||Object.hasOwn(i(a),a)).map(a=>({name:a,restore_with:a==="blockers"?"--full":a==="dependency_provenance"?"--fields dependencies":`--fields ${a}`}));return x(s,new Set(s.flatMap(({name:a})=>Rr(a,i(a),e)?[a]:[])))}function Qt(e){if(R(e.projection))return x([{name:"full_item_fields",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_item_fields"]:[]))}function Sr(e){if(!R(e.projection))return x([]);if(typeof e.projection.mode=="string")return x([{name:"full_check_details",restore_with:"--full"}],new Set(e.projection.mode==="full"?["full_check_details"]:[]))}function xr(e){if(!(!R(e.selected)||typeof e.selected.summary!="boolean"))return x([{name:"full_contract_catalog",restore_with:"--full"}],new Set(e.selected.summary?[]:["full_contract_catalog"]))}function Cr(e,t){let n=Er(t);if(n!==void 0)return n;let[o]=e.split(/\s+/u,1);if(o==="context")return Ar(t);if(o==="get")return Tr(t);if(o==="list"||o.startsWith("list-"))return Qt(t);if(o==="search")return Qt(t)??x([{name:"projection_metadata",restore_with:"--full"}]);if(o==="health")return Sr(t);if(o==="contracts")return xr(t)}function tn(e,t){if(e===void 0||!R(t))return t;let n=Cr(e,t),o=t.row_contract,r=wr(o)?o:kr(e,t),i=r!==void 0?{...t,row_contract:r}:Object.hasOwn(t,"row_contract")?Object.fromEntries(Object.entries(t).filter(([s])=>s!=="row_contract")):t;return R(i.omission_receipt)||n===void 0?i:{...i,omission_receipt:n}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e1fd9abd-a586-5302-940e-eec2a3eb8641")}catch{}})();function Xe(e){let t=e.trim().toLowerCase().startsWith("extension:"),n=e.trim().toLowerCase().replace(/^extension:/u,"");if(Ae(n))return;let o=qt()?.commands??[],r=[...o].reverse().find(s=>s.command===n)?.command??(t?void 0:o.find(s=>s.action===n)?.command),i=[...o].reverse().find(s=>s.command===r);return i===void 0||Ae(i.command)||Ae(i.action)?void 0:i}function Ir(e){let t=Xe(e);return t?.read_output===void 0?void 0:t}function jr(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new h("Read-only extension commands must return a structured object.",y.USAGE,{code:"extension_read_output_invalid"});for(let n of e.row_keys){let o=t;for(let r of n.split("."))o=typeof o=="object"&&o!==null&&Object.hasOwn(o,r)?Reflect.get(o,r):void 0;if(o===null||typeof o!="object")throw new h(`Read-only extension result is missing declared row collection ${n}.`,y.USAGE,{code:"extension_read_output_invalid",required:`Return ${n} as an object or array (an empty collection is valid); an output_format service renders the compact receipt from it.`,why:"A command that declares read_output.row_keys promises those row collections, and pm checks them before projection, budgeting or custom formatting."})}}function nn(e,t){let n=Ir(e),o=n?.read_output;return o===void 0?t:(jr(o,t),{...t,row_contract:{command:`extension:${n.command}`,row_kind:o.row_keys.length>0?"collection":"none",row_keys:[...o.row_keys],fields:"supported",...o.row_keys.length>0?{jq_selector:Ce}:{},toon_encoding:"tabular_when_uniform"}})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="040fff2e-c66f-5091-9ea8-7dcdaf6e203b")}catch{}})();var Qe={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded","--after"],encoding:["--stream"]},validate:{include:["--counts","--full"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},learnings:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Ze=new Set(["--collapse","--fields","--section"]),Ie=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--collapse":"--collapse retains dependency grouping semantics; --output-include does not replace it.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--no-truncate":"--no-truncate is a compatibility alias; prefer --output-limit unbounded --output-budget unbounded.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding.","--unbounded":"--unbounded is a compatibility alias; prefer --output-limit unbounded."});function je(e){return e.slice(2).replaceAll("-","_")}function on(e,t={}){let n=e==="package catalog"||e==="packages catalog"||e==="package-catalog"||(e==="package"||e==="packages"||e==="extension")&&(t.catalog===!0||t.target==="catalog"||t.action==="catalog")?"package-catalog":e==="package manage"||e==="package-manage"?"package-manage":e.split(" ")[0],o=n.startsWith("list-")?"list":n==="ctx"?"context":n;return se.includes(o)?o:void 0}function et(e){return new Map((Qe[e]?.include??[]).filter(t=>!Ze.has(t)&&Ie[t]===void 0).map(t=>[je(t),tt(t)]))}function tt(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="975b7c1d-e398-586a-bd50-b3bf0528d24a")}catch{}})();var De="changed_fields",Dr="changed_field_count",nt="rows",Nr=new Set(["apply","rollback"]),cn=new Set(["deleted","would_delete"]),rn=256,sn={start_task:["claim","update"],pause_task:["update","release"],close_task:["close","release"]};function Pr(e,t){if(!T(e)||typeof e.action!="string"||typeof e.id!="string"||e.id.length===0)return null;let n=Object.hasOwn(sn,e.action)?sn[e.action]:void 0;if(!n||!n.every(i=>{let s=e[i];return T(s)&&T(s.item)&&s.item.id===e.id&&Array.isArray(s.changed_fields)&&s.changed_fields.every(a=>typeof a=="string")}))return null;let o=e[n.at(-1)],r=dn(o);return t.idOnly?r:!t.compactEnvelope&&t.changedFields!=="compact"?null:{...e,...t.compactEnvelope?{...r,changed_field_count:new Set(n.flatMap(i=>e[i].changed_fields)).size}:{},...Object.fromEntries(n.map(i=>[i,ln(e[i],t)]))}}function an(e){return typeof e!="string"||e.length<=rn?e:`${Re(e,rn-1)}\u2026`}function Mr(e){if(!T(e))return null;let t={...e};return t.reason=an(t.reason),T(t.previous_terminal)&&(t.previous_terminal=Object.fromEntries(Object.entries(t.previous_terminal).map(([n,o])=>[n,an(o)]))),t}function T(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function un(e){let t=e[De];if(!Array.isArray(t))return null;let n=Object.getPrototypeOf(e)===null?Object.create(null):{};for(let[o,r]of Object.entries(e))o!==De&&(n[o]=r);return n[Dr]=t.length,n}function Ur(e){return"item"in e&&Array.isArray(e[De])}function Lr(e){return typeof e.mode=="string"&&Nr.has(e.mode)&&Array.isArray(e[nt])}function $r(e,t){let n=Object.getPrototypeOf(e)===null?Object.create(null):{};return Object.assign(n,e),n[nt]=t,n}function dn(e){if(!T(e))return null;let t=T(e.item)?e.item:T(e.plan)?e.plan:null;if(t===null)return null;let n=typeof t.id=="string"?t.id:void 0,o=typeof e.outcome=="string"&&cn.has(e.outcome)?e.outcome:typeof t.status=="string"?t.status:void 0;return n?o?{id:n,status:o,...typeof e.deleted=="boolean"?{deleted:e.deleted}:{}}:{id:n}:null}function Br(e,t){if(!T(e))return null;if(T(e.plan)&&T(e.mutation_receipt)&&e.mutation_receipt.kind==="plan_mutation"&&e.mutation_receipt.id===e.plan.id&&e.mutation_receipt.action===e.action)return e.mutation_receipt;if(!t||!T(e.item)||typeof e.item.id!="string")return null;let n=e[De];if(!Array.isArray(n))return null;let o={id:e.item.id,...typeof e.outcome=="string"&&cn.has(e.outcome)?{status:e.outcome}:typeof e.item.status=="string"?{status:e.item.status}:{},...typeof e.deleted=="boolean"?{deleted:e.deleted}:{},...typeof e.previous_status=="string"?{previous_status:e.previous_status}:{},changed_field_count:n.length};return Fr(e,e.item,o),o}function Fr(e,t,n){let o=typeof e.close_reason=="string"?e.close_reason:typeof t.close_reason=="string"?t.close_reason:void 0;o!==void 0&&(n.close_reason=o);let r=Mr(e.recurrence);r!==null&&(n.recurrence=r),Array.isArray(e.warnings)&&e.warnings.length>0&&(n.warnings=e.warnings);for(let i of["recovery","follow_up","handoff","completion","start","takeover"])T(e[i])&&(n[i]=e[i]);if(typeof e.claimed_by=="string"||typeof e.released_by=="string")for(let i of["claimed_by","released_by","previous_assignee","forced","skipped","available","attempts","start_refused","suggestions"])Object.hasOwn(e,i)&&(n[i]=e[i])}function Gr(e){let t=Lr(e)?e[nt]:void 0;if(!Array.isArray(t))return{projected:e,changed:!1};let n=!1,o=t.map(r=>{if(!T(r))return r;let i=un(r);return i?(n=!0,i):r});return n?{projected:$r(e,o),changed:!0}:{projected:e,changed:!1}}function ln(e,t={}){let n=Pr(e,t);if(n!==null)return n;if(t.idOnly===!0){let a=dn(e);if(a!==null)return a}if(t.compactEnvelope===!0||t.changedFields==="compact"){let a=Br(e,t.compactEnvelope===!0);if(a!==null)return a}if((t.changedFields??"full")==="full"||!T(e))return e;let o=!1,r=e,i=Ur(e)?un(e):null;i!==null&&(r=i,o=!0);let s=Gr(r);return s.changed&&(r=s.projected,o=!0),o?r:e}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1f8bc22d-02b9-522a-a2cd-0d34bf6e3ec3")}catch{}})();import{AsyncLocalStorage as Ai}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9bb3b2ed-c289-5b96-99ce-9df6e202c464")}catch{}})();var fn=new Set(["--pm-path","--path","--author","--expect-hash","--output-include","--output-limit","--output-budget","--output-format","--format","--output-session","--output-cursor"]),qr=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function zr(e){let t=e.indexOf("=");return t>0&&fn.has(e.slice(0,t))}function Wr(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function _n(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(fn.has(n)){t+=Wr(n,e[t+1])?1:0;continue}if(!(zr(n)||qr.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function Qa(e){let t=_n(e);return t===void 0?void 0:e[t].trim().toLowerCase()}import Kr from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f08c44a-dfdf-5c23-8f68-0e3ed73582b0")}catch{}})();var ot=new WeakMap;function _c(e){ot.set(e,e.path)}function Vr(e){if(!process.env.PM_PATH?.trim())return;let t=Lt(e);return Mt($t(t),e)&&t===Ut(e)?void 0:Kr.relative(e,t)||"."}function mc(e,t=process.cwd()){let n=ot.has(e)?ot.get(e):e.path,o=n?.trim()?n:Vr(t),r=o?["--pm-path",o]:[];return e.noExtensions&&r.push("--no-extensions"),r}import{createHash as si}from"node:crypto";import{createHash as Zr}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f539ecb5-2f49-5867-96c7-48eddb81a628")}catch{}})();var Hr=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function E(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function mn(e,t){let n=e;for(let o of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(o))return;n=n[Number(o)]}else{if(!E(n))return;n=n[o]}return n}function rt(e,t,n){let o=t.split("."),r=(i,s)=>{if(s===o.length)return n;let a=o[s];if(Array.isArray(i)){let d=Number(a),u=[...i];return u[d]=r(i[d],s+1),u}let c=i;return{...c,[a]:r(c[a],s+1)}};return r(e,0)}function it(e,t,n,o){let r=Y(e).find(a=>a.path===t);if(!r)return e;let i=Array.isArray(r.value)?r.value.slice(n,o):Object.fromEntries(Object.entries(r.value).slice(n,o)),s=rt(e,t,i);return E(s.summary)&&E(s.summary.focus_row_states)&&typeof s.summary.focus_row_states[t]=="string"&&(s.summary={...s.summary,focus_row_states:{...s.summary.focus_row_states,[t]:s.summary.focus_row_states[t].slice(n,o)}}),de(s),s}function Pe(e){let t=e.row_contract;return E(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function Jr(e){let t=e.row_contract;return E(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Pe(e)}function D(e){return Pe(e).flatMap(t=>{let n=mn(e,t);return Array.isArray(n)||E(n)?[{path:t,value:n}]:[]})}function Y(e){return Jr(e).flatMap(t=>{let n=mn(e,t);return Array.isArray(n)||E(n)?[{path:t,value:n}]:[]})}function ce(e){let t=D(e),n=new Set(t.map(r=>r.path)),o=(r,i)=>{if(Array.isArray(r)){n.has(i)||t.push({path:i,value:r}),r.forEach((s,a)=>o(s,`${i}.${a}`));return}if(E(r))for(let[s,a]of Object.entries(r))i.length===0&&Hr.has(s)||o(a,i.length===0?s:`${i}.${s}`)};return o(e,""),t}function X(e){return D(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function ue(e,t){let n=e;for(let o of D(n)){let r=Array.isArray(o.value)?o.value.map((i,s)=>t(i,o.path,s)):Object.fromEntries(Object.entries(o.value).map(([i,s],a)=>[i,t(s,o.path,a)]));n=rt(n,o.path,r)}return n}function pn(e,t,n=()=>!1){let o=e,r=!1;for(let i of D(o)){let s=Array.isArray(i.value)?i.value:Object.entries(i.value);if(s.length<=t)continue;r=!0;let a=n(i.path)?s.length-t:0,c=s.slice(a,a+t),d=Array.isArray(i.value)?c:Object.fromEntries(c);o=rt(o,i.path,d)}return{result:o,truncated:r}}var gn=["high_level","low_level","blocked_fallback"];function Ne(e){let t=e.status==="in_progress"?"i":"o";return e.blocked===!0?t.toUpperCase():t}function gc(e,t){if(!E(e.summary)||!E(e.summary.returned_focus))return;let n=new Map(t.map(o=>[o.id,o]));e.summary={...e.summary,focus_row_states:Object.fromEntries(gn.map(o=>[o,Array.isArray(e[o])?e[o].filter(E).map(r=>Ne(n.get(r.id)??r)).join(""):""]))}}function Yr(e,t){if(e!==void 0){if(typeof e!="string"||e.length!==t||!/^[iIoO]*$/u.test(e))throw new TypeError("Context focus classification receipt must contain one i/I/o/O code per delivered record");return e}}function Xr(e,t,n,o){let r=Array.isArray(t[n])?t[n].filter(E):[],i=Yr(o[n],r.length)??r.map(Ne).join(""),s=new Map(r.flatMap((d,u)=>d.id===void 0?[]:[[d.id,i[u]]])),a=Array.isArray(e[n])?e[n].filter(E):[],c=!1;return{states:a.map((d,u)=>{let _=s.get(d.id)??(d.id===void 0?i[u]:void 0)??Ne(d);return _!==Ne(d)&&(c=!0),_}).join(""),needsStates:c}}function Qr(e,t){typeof e.count=="number"&&(e.count_only===!0||t.count_only===!0?typeof t.count=="number"&&(e.count=t.count):Array.isArray(e.items)&&(e.count=e.items.length))}function de(e,t=e){if(Qr(e,t),!E(e.summary)||!E(e.summary.returned_focus))return;let n={...e.summary},o=E(t.summary)&&E(t.summary.focus_row_states)?t.summary.focus_row_states:{},r=gn.map(c=>({key:c,...Xr(e,t,c,o)})),i=Object.fromEntries(r.map(({key:c,states:d})=>[c,d])),s=r.some(c=>c.needsStates),a=Object.values(i).join("");typeof n.high_level=="number"&&(n.high_level=Array.isArray(e.high_level)?e.high_level.length:0),typeof n.low_level=="number"&&(n.low_level=Array.isArray(e.low_level)?e.low_level.length:0),n.returned_focus={active_items:a.length,in_progress:[...a].filter(c=>c.toLowerCase()==="i").length,open:[...a].filter(c=>c.toLowerCase()==="o").length,blocked:[...a].filter(c=>c===c.toUpperCase()).length},s?n.focus_row_states=i:delete n.focus_row_states,e.summary=n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8cd9862-6b60-599e-9a19-b97fd7b1ce1f")}catch{}})();var ei=4096,ti=Object.freeze(["queue_draining","queue_entries","queue_exists","queue_high_retry_entries","queue_invalid_rows","queue_max_attempts","queue_rows_total","queue_size_bytes","pending_otel_spans","last_attempted_flush_at","last_failed_flush_at","last_otel_attempt_at","last_otel_failure_at","last_otel_success_at","last_successful_flush_at"]),hn=Object.freeze({health:Object.freeze({version:3,paths:Object.freeze(["checks"]),ignored_detail_field_names_by_row:Object.freeze({telemetry:ti}),guarantee:"nonvolatile_snapshot_and_stable_configuration"})});function Q(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function bn(e,t,n=e,o){let r=Object.hasOwn(S,t)?S[t]:void 0;if(r?.delivered_row_counters===void 0)return;let i=r.paths[0],s=e[i],a=n[i];if(!Array.isArray(s)||!Array.isArray(a))return;let c=o??a.length,d=a.slice(Math.max(0,c-s.length),c);for(let u of r.delivered_row_counters)typeof e[u.key]=="number"&&(e[u.key]=d.filter(_=>Q(_)&&_[u.field]===u.equals).length)}function le(e){return Array.isArray(e)?e.map(le):Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,le(n)])):e}function yn(e,t){if(!Q(e))return le(e);let n=typeof e.name=="string"?e.name:void 0,o=n!==void 0&&Object.hasOwn(t.ignored_detail_field_names_by_row,n)?t.ignored_detail_field_names_by_row[n]:void 0;return Object.fromEntries(Object.entries(e).map(([r,i])=>r!=="details"||!o||!Q(i)?[r,le(i)]:[r,Object.fromEntries(Object.entries(i).filter(([s])=>!o.includes(s)).map(([s,a])=>[s,le(a)]))]))}function ni(e,t){return Array.isArray(e)?e.map(n=>yn(n,t)):yn(e,t)}function Me(e,t,n){let o=n?hn[n]:void 0,r=o?.paths.includes(e)===!0;return Zr("sha256").update(ve({path:e,value:r?ni(t,o):t,...r?{fingerprint_policy_version:o.version}:{}})).digest("base64url").slice(0,16)}function st(e){return Buffer.from(JSON.stringify({v:1,c:e.command,p:e.path,o:e.offset,n:e.total_rows,f:e.fingerprint,...e.direction==="backward"?{d:"b"}:{}}),"utf8").toString("base64url")}function oi(e){return typeof e=="string"&&(F(e)===e||/^extension:\S(?:[^\r\n]*\S)?$/u.test(e))}function ri(e){return e===void 0||e==="b"}function ii(e){if(Se(e))throw new h("The read-output continuation cursor was shortened by output compaction: it contains an ellipsis, which no cursor encoder emits.",y.USAGE,{code:"read_output_cursor_invalid",reason:"cursor_compacted",required:"Pass the whole cursor the previous page emitted; a shortened cursor cannot resume the read.",nextSteps:["Re-read the previous page with a larger --output-budget (or --output-budget unbounded) and pass its whole output_cursor to --output-cursor."]})}function fe(e){if(ii(e),e.length>ei)throw new h("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{t=null}if(!Q(t)||t.v!==1||!oi(t.c)||typeof t.p!="string"||t.p.length===0||!Number.isSafeInteger(t.o)||t.o<0||!Number.isSafeInteger(t.n)||t.n<1||typeof t.f!="string"||t.f.length===0||!ri(t.d))throw new h("The read-output continuation cursor is malformed or unsupported.",y.USAGE,{code:"read_output_cursor_invalid"});return{version:1,command:t.c,path:t.p,offset:t.o,total_rows:t.n,fingerprint:t.f,...t.d==="b"?{direction:"backward"}:{}}}function wn(e){if(!Array.isArray(e.assertions))return e;let t=n=>!Q(n)||n.verdict==="pass"?4:n.verdict==="retired"?3:n.enforcement==="block"?0:n.enforcement==="warn"?1:2;return{...e,assertions:e.assertions.map((n,o)=>({row:n,index:o})).sort((n,o)=>t(n.row)-t(o.row)||n.index-o.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function On(e,t,n){if(!n)return e;if(n.command!==t)throw new h(`The read-output cursor belongs to ${n.command}, not ${t}.`,y.USAGE,{code:"read_output_cursor_command_mismatch"});let o=Y(e).find(c=>c.path===n.path),r=o?Array.isArray(o.value)?o.value.length:Object.keys(o.value).length:0,i=B(t,n.path);if(!o||r!==n.total_rows||n.offset>r||i!==(n.direction==="backward")||Me(n.path,o.value,t)!==n.fingerprint)throw new h("The read-output continuation no longer matches the declared row collection; restart the bounded read.",y.USAGE,{code:"read_output_cursor_stale"});if(!i)return it(e,n.path,n.offset);let s=it(e,n.path,0,n.offset);for(let c of["count","returned_count"])typeof s[c]=="number"&&(s[c]=n.offset);let a=S[t].total_key;return typeof s[a]!="number"&&(s[a]=n.total_rows),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9c5d8732-3e10-5224-a558-e870397090f2")}catch{}})();var ct=1,vn=4096,ai=/^[A-Za-z0-9_-]+$/;function at(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Nc(e,t){let n=[...Object.values(ke),...Ee],o=new Set(n.flatMap(r=>[at(r),r.slice(2).replaceAll("-","_")]));for(let r of t)if(r.cursor_semantics==="presentation"){o.add(at(r.flag));for(let i of r.aliases??[])o.add(at(i))}return Object.fromEntries(Object.entries(e).filter(([r])=>!o.has(r)))}function Pc(e,t){return si("sha256").update(e).update("\0").update(ve(t)).digest("hex").slice(0,24)}function _e(e,t,n,o){return Buffer.from(JSON.stringify({version:ct,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...o===void 0?{}:{snapshot:o}})).toString("base64url")}function G(e,t){return new h(e,y.USAGE,{code:"invalid_query_cursor",nextSteps:[`Repeat the original query without ${t} to obtain a fresh cursor.`]})}function ci(e){return new h("Query cursor was shortened by output compaction: it contains an ellipsis, which no cursor encoder emits.",y.USAGE,{code:"invalid_query_cursor",reason:"cursor_compacted",required:"Pass the whole cursor the previous page emitted; a shortened cursor cannot resume the query.",nextSteps:[`Re-read the previous page with a larger --output-budget (or --output-budget unbounded) and pass its whole next_cursor to ${e}.`,`Or repeat the original query without ${e} to obtain a fresh cursor.`]})}function ui(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===ct&&typeof t.fingerprint=="string"&&typeof t.after_id=="string"&&t.after_id.length>0&&(t.after_index===void 0||Number.isSafeInteger(t.after_index)&&t.after_index>=0)&&(t.snapshot===void 0||typeof t.snapshot=="string"&&t.snapshot.length>0)}function ut(e,t="--after"){if(typeof e!="string")throw G("Query cursor is malformed.",t);let n=e.trim();if(Se(n))throw ci(t);if(n.length===0||n.length>vn||!ai.test(n))throw G("Query cursor is malformed.",t);let o;try{o=JSON.parse(Buffer.from(n,"base64url").toString("utf8"))}catch{throw G("Query cursor is malformed.",t)}if(!ui(o)){let r=!1;try{fe(n),r=!0}catch{}throw r?new h(`An output cursor must be continued with --output-cursor, not ${t}.`,y.USAGE,{code:"invalid_query_cursor",nextSteps:[`Repeat the same query, replacing ${t} with --output-cursor ${n}; retain any producer ${t} cursor from the original page.`]}):G("Query cursor version or payload is unsupported.",t)}return o}function dt(e,t,n="--after"){let o=ut(e,n);if(o.fingerprint!==t)throw G(`Query cursor does not match the current filters, sort, or query (${o.fingerprint} != ${t}).`,n);return{after_id:o.after_id,...o.after_index===void 0?{}:{after_index:o.after_index},...o.snapshot===void 0?{}:{snapshot:o.snapshot}}}function Mc(e,t){return dt(e,t).after_id}function di(e,t,n,o,r="--after"){if(t===void 0)return 0;let i=dt(t,n,r),s=e.findIndex(a=>o(a)===i.after_id);if(s<0){if(i.after_index!==void 0)return Math.min(i.after_index,e.length);throw G(`Query cursor item ${i.after_id} is no longer present in this result set.`,r)}return s+1}function Uc(e,t){if(t.cursor!==void 0&&dt(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw G("Query cursor does not match the requested snapshot.","--after");let n=di(e,t.cursor,t.fingerprint,t.readId),o=e.slice(n,n+t.limit),r=o.length>0&&n+o.length<e.length,i=o.at(-1);return{rows:o,has_more:r,...r&&i!==void 0?{next_cursor:_e(t.fingerprint,t.readId(i),n+o.length-1,t.snapshot)}:{}}}var Lc=Object.freeze({version:ct,max_length:vn});import{randomUUID as pi}from"node:crypto";import{randomUUID as li}from"node:crypto";import{constants as Z}from"node:fs";import{lstat as kn,mkdir as fi,open as An,rename as _i,rm as mi}from"node:fs/promises";import Ue from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="71b65888-baa5-5c5f-a02c-4a0fd818fadb")}catch{}})();var I={max_serving_rows:256,max_bytes:262144,max_event_bytes:32768,retained_byte_fraction:.5,max_events:2048,retention_days:30},k=class extends TypeError{code="context_usage_validation_failed";constructor(t){super(t),this.name="ContextUsageValidationError"}};function q(e){let t=Date.parse(e.now??new Date().toISOString());if(!Number.isFinite(t))throw new k("Context usage now must be a valid timestamp");return{iso:new Date(t).toISOString(),ms:t}}function Rn(e){let t=e.maxBytes??I.max_bytes,n=e.maxEvents??I.max_events,o=e.retentionDays??I.retention_days;if(!Number.isSafeInteger(t)||t<1024||t>I.max_bytes||!Number.isSafeInteger(n)||n<1||!Number.isFinite(o)||o<=0)throw new k("Context usage retention requires positive maxEvents and retentionDays, and maxBytes from 1024 through 262144");return{maxBytes:t,maxEvents:n,cutoff:q(e).ms-o*864e5}}async function Tn(e,t){if(!(await kn(Ue.dirname(e))).isDirectory())throw new k("Context usage runtime must be a real directory");try{if((await kn(e)).isSymbolicLink())throw new k("Context usage ledger must not be a symbolic link")}catch(o){if(!Pt(o))throw o}let n=await An(e,t|Z.O_NOFOLLOW|Z.O_NONBLOCK,384);try{let o=await n.stat();if(!o.isFile()||o.nlink!==1)throw new k("Context usage ledger must be an unshared regular file");return n}catch(o){throw await n.close(),o}}async function Le(e){let t=Rn(e);try{let n=await Tn(Ue.join(e.pmRoot,"runtime","context-usage.jsonl"),Z.O_RDONLY);try{let o=(await n.stat()).size,r=Math.max(0,o-t.maxBytes),i=Buffer.alloc(Math.min(o,t.maxBytes)),{bytesRead:s}=await n.read(i,0,i.length,r),a=i.subarray(0,s).toString("utf8");return(r>0?a.includes(`
|
|
8
|
-
`)?a.slice(a.indexOf(`
|
|
9
|
-
`)+1):"":a).split(`
|
|
10
|
-
`).flatMap(c=>{try{let d=JSON.parse(c);return d&&Date.parse(d.at)>=t.cutoff?[d]:[]}catch{return[]}}).slice(-t.maxEvents)}finally{await n.close()}}catch{return[]}}function En(e,t,n){let o=[],r=0;for(let i=e.length-1;i>=0&&o.length<n;i-=1){let s=`${JSON.stringify(e[i])}
|
|
11
|
-
`;if(r+=Buffer.byteLength(s),r>t)break;o.push(s)}return o.reverse().join("")}async function me(e,t,n){let o=Rn(e),r=Ue.join(e.pmRoot,"runtime","context-usage.jsonl"),i=Math.floor(o.maxBytes*I.retained_byte_fraction),s=Math.min(I.max_event_bytes,i);if(t.some(l=>Buffer.byteLength(`${JSON.stringify(l)}
|
|
12
|
-
`)>s))throw new k("Context usage event exceeds the declared byte ceiling");let a=t.filter(l=>Date.parse(l.at)>=o.cutoff),c=En(a,i,o.maxEvents),d=performance.now(),u=await Gt(e.pmRoot,"context-usage-ledger",30,`context-usage:${process.pid}`,!1,!1,3e3),_=performance.now()-d;try{await fi(Ue.dirname(r),{recursive:!0});let l=await Tn(r,Z.O_WRONLY|Z.O_CREAT|Z.O_APPEND);try{let f=(await l.stat()).size,m=n===void 0?void 0:await Le(e);if(m?.some(O=>O.kind==="delivery"&&O.serve_id===n))return{written_bytes:0,ledger_bytes:f,compacted:!1,lock_wait_ms:_};if(!(e.maxEvents!==void 0||e.retentionDays!==void 0)&&f+Buffer.byteLength(c)<=o.maxBytes)return await l.writeFile(c,"utf8"),{written_bytes:Buffer.byteLength(c),ledger_bytes:f+Buffer.byteLength(c),compacted:!1,lock_wait_ms:_};let p=En([...m??await Le(e),...a],i,o.maxEvents),g=`${r}.${process.pid}.${li()}.tmp`,b=await An(g,"wx",384);try{try{await b.writeFile(p,"utf8")}finally{await b.close()}return await l.close(),l=void 0,await _i(g,r),{written_bytes:Buffer.byteLength(p),ledger_bytes:Buffer.byteLength(p),compacted:!0,lock_wait_ms:_}}finally{await mi(g,{force:!0})}}finally{await l?.close()}}finally{await u()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e76b38ce-b2aa-589b-9d17-0952eca9e7a2")}catch{}})();var gi=864e5,$e=Symbol.for("@unbrained/pm-cli/context-usage-serving-receipt");function A(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function Yc(e,t){let n=A(e);n!==null&&t!==null&&(n[$e]=t)}function pe(e,t){let n=A(e),o=A(t),r=n?.[$e];o!==null&&r!==void 0&&(o[$e]=r)}function yi(e){return A(e)?.[$e]??null}function xn(e){let t=A(e);for(let n of["read_output","context_intent"])if(A(t?.[n])?.result_omitted===!0)return!0;return!1}function N(e,t){typeof t=="string"&&t.trim().length>0&&e.add(t.trim())}function Cn(e,t){if(Array.isArray(t))for(let n of t)N(e,A(n)?.id)}function Sn(e,t){if(Array.isArray(t))for(let n of t)N(e,n)}function hi(e,t){let n=A(e.recommended)===null?[]:[e.recommended];for(let o of["ready","decision_needed","gate_needed","containers","blocked","held_by_others"])Array.isArray(e[o])&&n.push(...e[o]);for(let o of n){let r=A(o);N(t,r?.id);for(let i of Array.isArray(r?.blockers)?r.blockers:[])N(t,A(i)?.id);for(let i of Array.isArray(r?.unblocks)?r.unblocks:[])N(t,i)}}function bi(e,t){for(let n of["high_level","low_level","blocked_fallback","recently_created","unparented","activity","progress","blockers","staleness"])Cn(t,e[n]);for(let n of Array.isArray(e.blockers)?e.blockers:[])N(t,A(n)?.blocked_by);wi(e,t)}function wi(e,t){for(let r of Array.isArray(e.hierarchy)?e.hierarchy:[]){let i=A(r);N(t,i?.id),Cn(t,i?.children)}for(let r of["files","workload"])for(let i of Array.isArray(e[r])?e[r]:[])Sn(t,A(i)?.items);let n=A(e.agenda);for(let r of Array.isArray(n?.events)?n.events:[])N(t,A(r)?.item_id);let o=A(e.tests);Sn(t,o?.items_failing)}function Oi(e,t){let n=A(e);if(n===null||xn(e))return[];let o=new Set;return t==="next"?hi(n,o):bi(n,o),[...o]}async function Xc(e){let t=yi(e.result);if(t===null)return!1;let n=xn(e.result);return await vi({pmRoot:e.pmRoot,receipt:t,deliveredItemIds:Oi(e.result,t.surface),resultOmitted:n}),!0}async function Qc(e){if([process.env.PM_CONTEXT_USAGE_DISABLED==="1",e.enabled===!1].includes(!0))return null;if(!e.author.trim()||e.rows.some(r=>!r.id.trim()||!Number.isInteger(r.rank)||r.rank<1))throw new k("Context usage serving requires an author and valid ranked rows");let t=e.rows.map(r=>({id:r.id.trim(),rank:r.rank,included:r.included}));if(new Set(t.map(r=>r.id)).size!==t.length)throw new k("Context usage serving requires unique normalized row ids");let n=t.slice(0,I.max_serving_rows),o={serve_id:pi(),author:e.author.trim(),surface:e.surface,rows:t,recorded_item_ids:n.map(r=>r.id)};return o.storage=await me(e,[{kind:"serve",schema_version:2,serve_id:o.serve_id,at:q(e).iso,author:e.author.trim(),surface:e.surface,profile:e.profile.trim()||"balanced",rows:n,candidate_count:t.length,omitted_row_count:t.length-n.length,result_omitted:!1,packed_item_ids:n.filter(r=>r.included).map(r=>r.id)}]),o}async function vi(e){if(e.receipt===null||process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)return;let t=new Set(e.receipt.rows.map(i=>i.id)),n=[...new Set(e.deliveredItemIds.map(i=>i.trim()))];if(n.some(i=>i.length===0||!t.has(i))||e.resultOmitted&&n.length>0)throw new k("Context usage delivery requires emitted ranked ids and zero ids for an omitted result");let o=new Set(e.receipt.recorded_item_ids??e.receipt.rows.map(i=>i.id)),r={kind:"delivery",schema_version:2,serve_id:e.receipt.serve_id,at:q(e).iso,author:e.receipt.author,surface:e.receipt.surface,result_omitted:e.resultOmitted,delivered_item_ids:n.filter(i=>o.has(i))};await me(e,[r],r.serve_id)}async function Zc(e){if(!(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)){if(!e.author.trim()||!e.itemId.trim()||!e.intent.trim())throw new k("Context usage touch requires author, itemId, and intent");await me(e,[{kind:"touch",at:q(e).iso,author:e.author.trim(),item_id:e.itemId.trim(),intent:e.intent.trim()}])}}async function eu(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1||e.itemIds.length===0)return;let t=e.author.trim(),n=e.intent.trim();if(!t||!n)throw new k("Context usage touch requires author and intent");let o=new Set;for(let s of e.itemIds){if(typeof s!="string")throw new k("Context usage touch requires string itemIds");let a=s.trim();if(!a)throw new k("Context usage touch requires non-empty itemId");o.add(a)}let r=q(e).iso,i=[...o].map(s=>({kind:"touch",at:r,author:t,item_id:s,intent:n}));await me(e,i)}function ki(e,t,n,o){return e.find(({entry:r,time:i})=>r.item_id===t&&i>=n&&i-n<=o)?.time}function Ei(e,t){let n=new Map;for(let o of e)o.kind==="delivery"&&o.schema_version===2&&o.author===t&&!n.has(o.serve_id)&&n.set(o.serve_id,o);return n}async function tu(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)return{affinity:{},positive_judgments:0,serving_events:0,untrusted_serving_events:0};let t=await Le(e),n=q(e).ms,o=(e.horizonHours??24)*36e5;if(![Number.isFinite(o),o>0].every(Boolean))throw new k("Context usage horizonHours must be positive");let r=e.author.trim(),i=t.filter(l=>l.kind==="touch").filter(l=>l.author===r).map(l=>({entry:l,time:Date.parse(l.at)})),s=new Map,a=0,c=0,d=0,u=Ei(t,r);t.filter(l=>l.kind==="serve").filter(l=>l.author===r).forEach(l=>{if(![l.schema_version===2,!!l.serve_id].every(Boolean)){c+=1;return}a+=1;let f=Date.parse(l.at),m=u.get(l.serve_id),p=new Set(m?.delivered_item_ids??[]);for(let g of l.rows){if(!p.has(g.id))continue;let b=ki(i,g.id,f,o);if(b===void 0)continue;d+=1;let O=Math.max(0,(n-b)/gi);s.set(g.id,(s.get(g.id)??0)+Math.exp(-O/14))}});let _=Math.max(0,...s.values());return{affinity:Object.fromEntries([...s.entries()].map(([l,f])=>[l,_===0?.05:.05+.95*f/_])),positive_judgments:d,serving_events:a,untrusted_serving_events:c}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="100048de-2349-5062-b6c2-7176277ec38d")}catch{}})();var Ri="limit_overridden_by_intent",Mn=Object.freeze([{command:"context",intent:"orient",description:"Bounded active hierarchy, ownership, blockers, and recent progress.",included_field_groups:["summary","focus","hierarchy","blockers","activity"],token_budget:3e3,source:"core"},{command:"context",intent:"handoff",description:"Active ownership, evidence, decisions, and immediate continuation context.",included_field_groups:["summary","focus","in_progress","decisions","activity"],token_budget:2200,source:"core"},{command:"get",intent:"inspect",description:"Standard-depth item metadata, relationships, evidence, and lifecycle state.",included_field_groups:["item","children","claim_state","linked"],token_budget:3200,source:"core"},{command:"list",intent:"triage",description:"A budget-derived page of compact governance, ownership, priority, and blocker rows for triage.",included_field_groups:["identity","governance","ownership","dependencies"],token_budget:3200,source:"core"},{command:"next",intent:"execute",description:"The highest-ranked actionable work with concise ranking evidence.",included_field_groups:["recommended"],token_budget:1200,source:"core"},{command:"search",intent:"discover",description:"A budget-derived page of ranked canonical lineage candidates with compact match evidence.",included_field_groups:["identity","status","lineage","match"],token_budget:1800,source:"core"}]),Un=new Ai;function Ti(){return Un.getStore()??Mn}function mu(e,t){return Un.run(xi(e.workspaceContracts,e.packageContracts),t)}function Si(e,t){let n=e.command.trim().toLowerCase(),o=e.intent.trim().toLowerCase(),r=`${n}:${o}`;if(!/^[a-z0-9][a-z0-9-]*$/.test(n)||!/^[a-z0-9][a-z0-9-]*$/.test(o))throw new TypeError(`Invalid context intent command or name: ${r}`);if(e.description.trim().length===0)throw new TypeError(`Context intent ${r} requires a non-empty description`);if(!Number.isSafeInteger(e.token_budget)||e.token_budget<=0)throw new TypeError(`Context intent ${r} requires a positive integer token_budget`);let i=[...new Set(e.included_field_groups.map(s=>s.trim()).filter(Boolean))];if(i.length===0)throw new TypeError(`Context intent ${r} requires included_field_groups`);return{command:n,intent:o,description:e.description.trim(),included_field_groups:i,token_budget:e.token_budget,source:t}}function xi(e=[],t=[]){let n=[{source:"core",contracts:Mn,allowOverride:!1},{source:"package",contracts:t,allowOverride:!1},{source:"workspace",contracts:e,allowOverride:!0}],o=new Map,r=new Set;for(let i of n){r.clear();for(let s of i.contracts){let a=Si(s,i.source),c=`${a.command}:${a.intent}`;if(r.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);if(r.add(c),!i.allowOverride&&o.has(c))throw new TypeError(`Duplicate context intent declaration: ${c}`);o.set(c,a)}}return[...o.values()].sort((i,s)=>i.command.localeCompare(s.command)||i.intent.localeCompare(s.intent))}function Ln(e,t,n=Ti(),o=[]){let r=e.trim().toLowerCase(),i=t.trim().toLowerCase(),s=n.find(l=>l.command===r&&l.intent===i);if(s)return{...s,source:s.source??"core"};let a=n.filter(l=>l.command===r).map(l=>l.intent);if(a.length===0)return;let c=a.map(l=>{let f=Array.from({length:i.length+1},(m,p)=>p);for(let m=1;m<=l.length;m+=1){let p=f[0];f[0]=m;for(let g=1;g<=i.length;g+=1){let b=f[g];f[g]=Math.min(f[g]+1,f[g-1]+1,p+(l[m-1]===i[g-1]?0:1)),p=b}}return{candidate:l,distance:f[i.length]}}).sort((l,f)=>l.distance-f.distance||l.candidate.localeCompare(f.candidate))[0].candidate,d=[r,...o,"--for",i],u=[r,...o,"--for",c],_=xe(u);throw new h(`Unknown context intent "${i}" for ${r}. Did you mean "${c}"?`,y.USAGE,{code:"unknown_context_intent",reason:"unknown_intent",field:"for",flag:"--for",value:i,required:`Use a declared ${r} intent.`,why:"Intent names are command-local contracts and cannot be inferred from output section names.",nextSteps:[_],recovery:{recovery_mode:"compact",attempted_command:xe(d),allowed_values:[...a].sort(),suggested_retry:_,suggested_retry_args:u}})}function lt(e,t){let n=W(e.limit),o=String(n===void 0?t:Math.min(n,t));return(e.limit===void 0||n!==void 0)&&(e.limit=o),o}var $n={context:(e,t,n,o)=>{e.section===void 0&&e.depth===void 0&&(e.section=t.intent==="handoff"?["activity","progress","blockers"]:["hierarchy","blockers","activity"]),e.depth===void 0&&(e.depth=t.intent==="handoff"?"deep":"standard");let r=Fe(o,e.tokenBudget,t.token_budget),i=Ge("context",t.intent,r,n),s=lt(e,i);e.activityLimit===void 0&&(e.activityLimit=s)},get:e=>{e.depth===void 0&&e.fields===void 0&&(e.depth="standard")},list:(e,t,n,o)=>{e.brief===void 0&&e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.fields="id,title,status,type,priority,parent,assignee,risk,blocked_by");let r=Fe(o,e.tokenBudget,t.token_budget),i=Ge("list",t.intent,r,n);lt(e,i)},next:e=>{e.readyOnly===void 0&&(e.readyOnly=!0)},search:(e,t,n,o)=>{e.compact===void 0&&e.full===void 0&&e.fields===void 0&&(e.compact=!0);let r=Fe(o,e.tokenBudget,t.token_budget),i=Ge("search",t.intent,r,n);lt(e,i)}};function pu(e,t,n=[]){let o=t.tokenBudget??t.token_budget;if(typeof t.for!="string"){if(o!==void 0&&(e==="get"||e==="list"||e==="search"))throw new h("--token-budget requires a declared context intent selected with --for",y.USAGE,{code:"missing_required_option",field:"for",required:"Select a context intent with --for when setting --token-budget.",why:"A token-budget override has no projection contract to constrain without a selected intent.",nextSteps:["Retry with --for <intent> --token-budget <n>, or omit --token-budget."]});if(t.tokenBudget!==void 0||t.token_budget===void 0)return t;let c={...t,tokenBudget:o};return delete c.token_budget,c}let r=Ln(e,t.for,void 0,n),i=ge(t),s=W(o)!==void 0||typeof i=="number",a={...t};return a.tokenBudget===void 0&&o!==void 0&&(a.tokenBudget=o),delete a.token_budget,typeof i=="number"?a.tokenBudget=String(i):a.tokenBudget===void 0&&(a.tokenBudget=String(r.token_budget)),$n[e](a,r,s,i),a}var Ci={context:"bounded_sections",get:"standard_item",list:"bounded_fields_and_rows",next:"bounded_ranked_rows",search:"bounded_ranked_rows"},Be=256;function _t(e){return Array.isArray(e)?e.map(_t):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,typeof n=="string"&&ae(t)?n:_t(n)])):typeof e=="string"?Te(e):e}function W(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function ge(e){let t=e.outputBudget??e.output_budget;return t==="unbounded"?t:W(t)}function Ii(e){return ge(e)===void 0?"--token-budget":"--output-budget"}function Fe(e,t,n){return typeof e=="number"?e:ji(t,n)}function ji(e,t){let n=W(e);if(n===void 0)return t;if(n<Be)throw new h(`Context intent token budget must be at least ${Be}`,y.USAGE,{code:"invalid_argument_value",reason:"below_minimum",field:"tokenBudget",value:String(e),required:`Use an integer token budget of at least ${Be}.`,why:"Smaller ceilings cannot contain the minimum machine-readable intent receipt.",nextSteps:[`Retry with --token-budget ${Be} or omit the override.`]});return n}function Bn(e,t){return e==="context"?e==="context"&&t==="orient"?{overhead:1200,rowCost:600}:{overhead:800,rowCost:500}:{overhead:e==="list"?520:480,rowCost:16}}function Ge(e,t,n,o){if(e==="get"||e==="next")return;let{overhead:r,rowCost:i}=Bn(e,t),s=Math.max(e==="context"?1:2,Math.floor((n-r)/i));return o?s:Math.min(e==="context"?20:100,s)}function K(e,t,n){let o=te(n),r=n.outputRowContract===!0||n.output_row_contract===!0,i=t.estimated_tokens,s=i;for(let a=0;a<gt;a+=1){t.estimated_tokens=i;let c=M(r||!Object.hasOwn(e,"row_contract")?e:Object.fromEntries(Object.entries(e).filter(([d])=>d!=="row_contract")),o);if(c===i)return;i=c,s=Math.max(s,i)}t.estimated_tokens=s}var In={context:["high_level","low_level","blocked_fallback","recently_created","unparented","hierarchy","activity","blockers"],get:["children"],list:["items"],next:["ready","decision_needed","gate_needed","containers","blocked","held_by_others"],search:["items"]};function Fn(e){try{let t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return typeof t.fingerprint!="string"||!Number.isSafeInteger(t.after_index)?void 0:{fingerprint:t.fingerprint,after_index:t.after_index,...typeof t.snapshot=="string"?{snapshot:t.snapshot}:{}}}catch{return}}function Di(e){if(e===null||typeof e!="object")return;if(typeof e.id=="string")return e.id;let t=e.item?.id;return typeof t=="string"?t:void 0}function Ni(e,t,n,o){let r=!1;for(;;){if(K(e,t,o),t.estimated_tokens<=t.token_budget||n.length<=1)return r;let i=Buffer.byteLength(JSON.stringify(n),"utf8"),s=(t.estimated_tokens-t.token_budget)*4;n.splice(-Math.min(n.length-1,Math.max(1,Math.ceil(s/Math.max(1,Math.ceil(i/n.length)))))),r=!0}}function Pi(e,t,n){let o=e.items,r=typeof e.next_cursor=="string",i=r?e.next_cursor:n.after;if(!Array.isArray(o)||typeof i!="string")return!1;let s=Fn(i);if(s===void 0)return!1;let a=o.length,c=[...o],d=!1;for(;;){if(d=Ni(e,t,o,n)||d,!d)return!1;let u=Di(o.at(-1));if(u===void 0)return o.splice(0,o.length,...c),K(e,t,n),!1;if(e.next_cursor=_e(s.fingerprint,u,r?s.after_index-(a-o.length):s.after_index+o.length,s.snapshot),K(e,t,n),t.estimated_tokens<=t.token_budget||o.length<=1)break}return typeof e.count=="number"&&(e.count=o.length),typeof e.applied_limit=="number"&&(e.applied_limit=o.length),!0}function Mi(e,t,n,o){if(e==="list"||e==="search")return Pi(t,n,o);if(e!=="next"||typeof t.next_cursor=="string")return!1;let r=!1;for(;;){if(K(t,n,o),n.estimated_tokens<=n.token_budget)return r;let i=In[e].map(l=>({key:l,rows:Array.isArray(t[l])?t[l]:[]})).filter(({rows:l})=>l.length>0).sort((l,f)=>f.rows.length-l.rows.length||l.key.localeCompare(f.key))[0];if(i===void 0)return r;let s=In[e].reduce((l,f)=>l+(Array.isArray(t[f])?t[f].length:0),0);if(s<=1)return r;let a=Math.min(i.rows.length,s-1),c=Buffer.byteLength(JSON.stringify(i.rows),"utf8"),d=Math.max(1,Math.ceil(c/i.rows.length)),u=(n.estimated_tokens-n.token_budget)*4,_=Math.min(a,Math.max(1,Math.ceil(u/d)));i.rows.splice(-_,_),r=!0}}function jn(e,t,n){if(typeof t.for!="string")return n;let o=e.startsWith("list-")?"list":e;if(!(o in $n))return n;let r=o,i=Ln(r,t.for),s=ge(t),a=Fe(s,t.tokenBudget??t.token_budget,i.token_budget),c={command:r,intent:i.intent,source:i.source,included_field_groups:[...i.included_field_groups],token_budget:a,declared_token_budget:i.token_budget,token_budget_override:a-i.token_budget,estimated_tokens:0,within_budget:!0,degradation:Ci[r],declaration_feasible:!0,result_omitted:!1},d={...n},u=Ge(r,i.intent,c.token_budget,W(t.tokenBudget??t.token_budget)!==void 0||typeof s=="number");if(u!==void 0){let p=W(t.limit),g=p!==void 0&&p<u;c.budget_derived_limit=u,c.binding_constraint=g?"explicit_limit":"token_budget",c.limit_reason=g?"The caller supplied a smaller row limit than the budget-derived ceiling.":"The selected intent token budget constrains the effective row ceiling.",d.budget_derived_limit=u,Gi({builtInCommand:r,intent:i.intent},c,d,t)}let _=Gn.get(t)??0,l=c.token_budget;c.token_budget=l-_;let f=s==="unbounded"?mt(d,c,t):Ui(r,d,c,t);c.declaration_feasible=c.estimated_tokens<=c.declared_token_budget;let m=qn(s,c,f,()=>Wn(e,r,i.intent,{...c,token_budget:l,estimated_tokens:c.estimated_tokens+_},d,t));return c.result_omitted&&(c.estimated_tokens+=_,c.declaration_feasible=c.estimated_tokens<=c.declared_token_budget),c.token_budget=l,m}function mt(e,t,n){let o={...e,context_intent:t};return K(o,t,n),o}function Ui(e,t,n,o){let r=mt(t,n,o);return n.estimated_tokens>n.token_budget&&(n.degradation="recursive_budget_compaction",r=mt(_t(t),n,o)),n.estimated_tokens>n.token_budget&&Mi(e,r,n,o)&&(n.degradation="budget_row_compaction",K(r,n,o)),r}var Gn=new WeakMap;function qn(e,t,n,o){return t.estimated_tokens<=t.token_budget||(t.within_budget=!1,e==="unbounded")?n:(t.degradation="budget_receipt_only",t.result_omitted=!0,typeof e=="number"?{output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},context_intent:t}:{budget_exceeded:{omitted_result:!0,reason:t.token_budget_override===0?"declared_budget_infeasible":"effective_budget_infeasible",restore_with:o()},context_intent:t})}var Li=["applied_limit","completeness","context_intent","count","filters","has_more","now","omission_receipt","projection","row_contract","sorting","total","truncated"];function $i(e,t){if(typeof e.after!="string"||e.after.length===0||ee(t))return t;let n=Fn(e.after)?.fingerprint??"opaque_cursor",o={...t};for(let r of Li)delete o[r];return o.continuation_contract={fingerprint:n,metadata:"reference",restore_with:"omit --after"},o}function P(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Bi(e,t){let n=e==="get"&&P(t.item)&&typeof t.item.id=="string"?t.item.id:e==="search"&&typeof t.query=="string"?t.query:void 0;return n===void 0?"":` ${zn(n)}`}function zn(e){return`'${e.replaceAll("'",`'"'"'`)}'`}function Fi(e){return typeof e.fields=="string"&&e.fields.trim()!==""?` --fields ${zn(e.fields)}`:""}function Gi(e,t,n,o){let r=W(o.limit),i=t.budget_derived_limit;if(r===void 0||r<=i)return;let{overhead:s,rowCost:a}=Bn(e.builtInCommand,e.intent),c=Math.max(t.token_budget,s+a*r);t.limit_reason=`The ${t.token_budget}-token ${e.intent} budget carries ${i} rows, so it reduced the caller's --limit ${r}.`,t.limit_override={flag:"--limit",requested:r,effective:i,...Number.isSafeInteger(c)?{token_budget_for_requested:c,restore_with:`${Ii(o)} ${c}`}:{}};let d=`${Ri}:--limit ${r}->${i}`;n.warnings=Array.isArray(n.warnings)?[...n.warnings,d]:[d],P(n.filters)&&(n.filters={...n.filters,requested_limit:String(r)})}function Wn(e,t,n,o,r,i){let s=Bi(t,r),a=t==="get"?"":` --limit ${o.budget_derived_limit??1}`,{output_budget:c}=ye({effective_budget_tokens:o.token_budget,measured_result_tokens:o.estimated_tokens});return`pm ${e}${s}${Fi(i)} --for ${n} --token-budget ${c}${a}`}function z(e,t){if(P(e))return typeof e[t]=="number"?e[t]:void 0}function Dn(e,t){let n=e;for(let o=0;o<8;o+=1){qi(n);let r=z(n.context_intent,"estimated_tokens"),i=z(n.read_output,"estimated_tokens"),s=z(n.read_session,"spent_this_call_tokens");if(P(n.context_intent)&&n.context_intent.result_omitted!==!0&&K(n,n.context_intent,t),n=pt(n,t),z(n.context_intent,"estimated_tokens")===r&&z(n.read_output,"estimated_tokens")===i&&z(n.read_session,"spent_this_call_tokens")===s)break}return n}function qi(e){let t=e.context_intent;P(t)&&Number(t.estimated_tokens)>Number(t.token_budget)&&(t.within_budget=!1)}function zi(e,t,n){let o=tn(e,nn(e??"",n));if(typeof o!="object"||o===null||Array.isArray(o))return pe(n,o),o;let r=e??"",i=o,s=jn(r,t,i),a=z(s.context_intent,"estimated_tokens"),c=ft(r,t,n,s),d=Nn(t,c,s.context_intent);if(d===void 0)return c;let u={...t};Gn.set(u,d.estimated-Number(a));let _=jn(r,u,i),l=ft(r,u,n,_),f=Nn(t,l,_.context_intent);if(f===void 0)return l;let m={...f.receipt,estimated_tokens:f.estimated};return ft(r,t,n,qn(ge(t),m,l,()=>Wn(r,m.command,m.intent,m,i,t)))}function Nn(e,t,n){let o=P(t.context_intent),r=o?t.context_intent:n;if(!P(r)||r.result_omitted===!0||Object.hasOwn(t,"output_budget_exceeded"))return;let i=r,s=o?i.estimated_tokens:M(t,te(e));return ge(e)==="unbounded"||s<=i.token_budget?void 0:{receipt:i,estimated:s}}function ft(e,t,n,o){let r=Pn(e,{...t,outputRowContract:t.outputRowContract===!0||t.output_row_contract===!0},$i(t,o));if(pe(n,r),t.outputRowContract===!0||t.output_row_contract===!0||!Object.hasOwn(r,"row_contract"))return P(r.context_intent)?Dn(r,t):r;let i=Object.fromEntries(Object.entries(r).filter(([a])=>a!=="row_contract"));Object.defineProperty(i,"row_contract",{value:r.row_contract,enumerable:!1,configurable:!0});let s=Dn(i,t);return delete s.row_contract,pe(r,s),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cb1266f3-8375-586f-87c6-356cf7843969")}catch{}})();var ne=["result_rows","envelope","diagnostics","hints"],Wi=/^(?:items|results|rows|ready|blocked|recommended|decision_needed|children|dependencies|events|matches|commands|tools)$/u,Ki=/^(?:diagnostics|errors?|warnings?|findings|violations|failures?)$/u,Vi=/^(?:hints?|suggestions?|next_steps?|recovery|remediation|examples?)$/u,Hi=8;function yt(e){return Buffer.byteLength(e,"utf8")}function Kn(e){return yt(JSON.stringify(e)??"null")}function Ji(e,t){return Ki.test(e)?"diagnostics":Vi.test(e)?"hints":Wi.test(e)||Array.isArray(t)?"result_rows":"envelope"}function Yi(e){let t={result_rows:0,envelope:0,diagnostics:0,hints:0};if(typeof e!="object"||e===null||Array.isArray(e))return t[Array.isArray(e)?"result_rows":"envelope"]=Kn(e),t;for(let[n,o]of Object.entries(e))t[Ji(n,o)]+=Kn({[n]:o});return Object.values(t).every(n=>n===0)&&(t.envelope=1),t}function Xi(e,t){let n=ne.reduce((s,a)=>s+t[a],0),o=ne.map(s=>({section:s,value:e*t[s]/n})),r={result_rows:0,envelope:0,diagnostics:0,hints:0};for(let s of o)r[s.section]=Math.floor(s.value);let i=e-ne.reduce((s,a)=>s+r[a],0);for(let s of[...o].sort((a,c)=>c.value-Math.floor(c.value)-(a.value-Math.floor(a.value))||ne.indexOf(a.section)-ne.indexOf(c.section))){if(i===0)break;r[s.section]+=1,i-=1}return r}function Vn(e,t){return typeof e=="object"&&e!==null&&!Array.isArray(e)?{...e,token_accounting:t}:{result:e,token_accounting:t}}function Qi(e,t){let n=yt(t(e)),o=Xi(n,Yi(e)),r=Object.fromEntries(ne.map(a=>[a,{bytes:o[a],estimated_tokens:$(o[a])}])),i={version:1,measurement_scope:"output_before_token_accounting",estimator:"ceil(utf8_bytes / 4)",total_bytes:n,total_estimated_tokens:$(n),sections:r,accounting_receipt_bytes:0,accounting_receipt_estimated_tokens:0,excluded_fields:["token_accounting"],section_allocation:"proportional_canonical_json"},s=Vn(e,i);for(let a=0;a<Hi;a+=1){let c=yt(t(s))-n;if(c===i.accounting_receipt_bytes)return s;i={...i,accounting_receipt_bytes:c,accounting_receipt_estimated_tokens:$(c)},s=Vn(e,i)}return s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="787e6c05-d503-5602-a173-e6a59699cea6")}catch{}})();var bu=Object.freeze({comments:Object.freeze(["comments"]),notes:Object.freeze(["notes"]),learnings:Object.freeze(["learnings"])});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8e86e884-98ca-5b28-838b-db3543051112")}catch{}})();var Hn=new Set(["body","item_hash","linked","claim_state","children","schedule","blockers"]),Ou=new Set(["linked","claim_state","children","schedule"]);import{encode as Ot}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bafcd4e4-ec0f-5340-89ce-b85d822b2323")}catch{}})();function Jn(e,t={}){let n=[...new Set(e.flatMap(u=>Object.keys(u)))],o=t.compact?n.filter(u=>e.every(_=>Object.hasOwn(_,u)&&_[u]===null)):[],r=t.compact?n.filter(u=>e.every(_=>{if(!Object.hasOwn(_,u))return!0;let l=_[u];return Array.isArray(l)&&l.every(f=>typeof f=="string"&&f!==""&&!f.includes(";"))})):[],i=new Set(r),s=new Set(o),a=n.filter(u=>!i.has(u)&&e.some(_=>{let l=_[u];return l!==null&&typeof l=="object"})),c=new Set(a),d=[];return{rows:e.map((u,_)=>Object.fromEntries(n.filter(l=>!s.has(l)).map(l=>{if(!Object.hasOwn(u,l))return d.push([_,l]),[l,null];let f=u[l];return i.has(l)?[l,f.join(";")]:[l,c.has(l)?JSON.stringify(f):f]}))),encoding:{json_columns:a,absent:d,...r.length?{list_columns:Object.fromEntries(r.map(u=>[u,";"]))}:{},...o.length?{null_columns:o,null_column_index:o.map(u=>n.indexOf(u))}:{}}}}function Yn(e){let{json_columns:t,absent:n,...o}=e,r=new Map;for(let[i,s]of n){let a=r.get(s)??[];a.push(i),r.set(s,a)}return{...t.length>0?{json_columns:t}:{},...r.size>0?{absent_rows:Object.fromEntries(r)}:{},...o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="43d2915b-7301-5e96-89e0-51c8e817789e")}catch{}})();function C(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Zi=new Set(["brief","compact","fields"]);function Xn(e){if(!C(e))return!1;let t=e.fields;return Zi.has(e.mode)&&Object.keys(e).length===2&&Array.isArray(t)&&t.length>0&&t.every(n=>typeof n=="string"&&n.length>0)}function Qn(e,t){return e.every(n=>C(n)&&Object.keys(n).length===t.fields.length&&t.fields.every(o=>Object.hasOwn(n,o)))}function Zn(e,t){return e.mode==="fields"&&t===0?{projection:e}:{}}function eo(e,t){return typeof e.has_more=="boolean"&&e.truncated===e.has_more&&e.count===t&&typeof e.total=="number"&&Number.isSafeInteger(e.total)&&(e.has_more?e.total>t&&typeof e.next_cursor=="string"&&e.next_cursor.length>0:e.total===t&&e.next_cursor==null)}function es(e){return C(e)&&(e.status==="complete"||e.status==="unchecked")&&e.unreadable_item_count===0&&e.unreadable_directory_count===0}function ht(e,t="full_item_fields"){if(!C(e)||!Array.isArray(e.omitted_field_groups))return!1;let n=e.omitted_field_groups,o=n[0];return e.has_omissions===!0&&e.omitted_field_group_count===1&&Object.keys(e).length===3&&n.length===1&&C(o)&&Object.keys(o).length===2&&o.name===t&&o.restore_with==="--full"}function to(e){if(!C(e)||!Array.isArray(e.items)||Object.hasOwn(e,"details")||!Xn(e.projection)||!Qn(e.items,e.projection)||!es(e.completeness)||!eo(e,e.items.length)||!ht(e.omission_receipt))return e;let{total:t,has_more:n,truncated:o,next_cursor:r,completeness:i,projection:s,now:a,omission_receipt:c,sorting:d,filters:u,..._}=e,l=i.status==="complete"&&!n&&Object.keys(i).length===3,{unreadable_item_count:f,unreadable_directory_count:m,...p}=i;return{..._,...l?{}:{total:t,has_more:n,completeness:p},...n?{next_cursor:r}:{},...os(d),...no(u,_.applied_limit,s),...Zn(s,e.items.length),details:"--full"}}function ts(e){return C(e)&&e.sort==="default"&&e.order==="asc"&&Object.keys(e).every(t=>t==="sort"||t==="order"||t==="effective_keys")}function ns(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&(e[1]==="asc"||e[1]==="desc")}function os(e){if(!ts(e))return{sorting:e};let t=e.effective_keys;return t===void 0?{}:!Array.isArray(t)||!t.every(ns)?{sorting:e}:{sorting:{effective_keys:t.map(([n,o])=>`${n} ${o}`).join(", ")}}}function rs(e,t){if(typeof e!="string"||t===void 0)return!1;let n=e.split(",").map(o=>o.trim()).filter(Boolean);return n.length===t.fields.length&&n.every((o,r)=>o===t.fields[r])}function no(e,t,n){if(!C(e))return e===void 0?{}:{filters:e};let o=Object.fromEntries(Object.entries(e).filter(([r,i])=>!(r==="limit"&&String(i)===String(t))&&!(r==="fields"&&rs(i,n))&&!(r==="runtime_filters"&&C(i)&&Object.keys(i).length===0)));return Object.keys(o).length===0?{}:{filters:o}}function is(e,t){return e.count===t&&!Object.hasOwn(e,"has_more")&&!Object.hasOwn(e,"truncated")&&e.next_cursor==null&&(e.total===void 0||e.total===t)}function ss(e){if(!Object.hasOwn(e,"projection"))return ht(e.omission_receipt,"projection_metadata")?{}:void 0;let t=e.projection;return Xn(t)&&t.mode==="fields"&&Qn(e.items,t)&&typeof e.now=="string"&&ht(e.omission_receipt)?{projection:t}:void 0}function oo(e){if(!C(e)||typeof e.query!="string"||!Array.isArray(e.items)||Object.hasOwn(e,"details")||!(eo(e,e.items.length)||is(e,e.items.length)))return e;let t=ss(e);if(t===void 0)return e;let{truncated:n,omission_receipt:o,filters:r,projection:i,now:s,mode_source:a,...c}=e;return{...c,...a==="settings"||t.projection===void 0&&a!==void 0?{mode_source:a}:{},...no(r,c.applied_limit,t.projection),...t.projection?Zn(t.projection,e.items.length):{},details:"--full"}}import{isBoxedPrimitive as as}from"node:util/types";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1b399abd-460a-55a5-9df2-db23537aac0d")}catch{}})();var ro=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/gu;function Su(e){return e.replaceAll(ro,"\uFFFD")}function cs(e,t,n){return n&&/^\d+$/u.test(t)?`${e}[${t}]`:/^[A-Za-z_$][\w$]*$/u.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}function bt(e,t,n){if(typeof e=="string"){let o=e.search(ro);return o<0?void 0:{field:t,index:o}}if(!(e===null||typeof e!="object"||n.has(e))){n.add(e);for(let[o,r]of Object.entries(e)){let i=cs(t,o,Array.isArray(e)),s=bt(o,`${i} (key)`,n)??bt(r,i,n);if(s)return s}}}function io(e,t,n){if(e===null||typeof e!="object")return e;if(as(e)||typeof e.toJSON=="function")return JSON.parse(JSON.stringify({[t]:e}))[t];if(n.has(e))return n.get(e);let o=Array.isArray(e)?new Array(e.length):{};n.set(e,o);for(let r of Object.keys(e))Object.defineProperty(o,r,{value:io(e[r],r,n),enumerable:!0,configurable:!0,writable:!0});return o}function wt(e){let t=io(e,"",new WeakMap),n=bt(t,"$",new WeakSet);return n&&us(n),t}function us(e){throw new h(`Output field ${e.field} contains an unpaired surrogate code unit at index ${e.index}; structured output requires well-formed Unicode.`,y.USAGE,{code:"text_unpaired_surrogate",field:e.field,required:"Well-formed UTF-16 strings and object keys in both JSON and TOON output.",nextSteps:["Repair the producer's text before returning output; use toWellFormedText from @unbrained/pm-cli/sdk when replacement is intended."]})}function xu(e){wt(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f33393ac-6b72-5e46-92a5-f276d1fbfff1")}catch{}})();var ed=new Set(Object.values(y)),ls=new Map([["notes_count","notes"],["tests_count","tests"]]);var so=!1;function w(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vt(e){return typeof e=="object"&&e!==null&&e.code==="EPIPE"}function fs(){(process.exitCode===void 0||process.exitCode===y.SUCCESS)&&(process.exitCode=y.SUCCESS)}function _s(){(process.exitCode===void 0||process.exitCode===y.SUCCESS)&&(process.exitCode=y.GENERIC_FAILURE)}function kt(e){if(e==="stdout"){fs();return}_s()}function ao(e){let t=e instanceof Error?e:new Error(String(e));setImmediate(()=>{throw t})}function ms(){so||(so=!0,process.stdout.on("error",e=>{if(vt(e)){kt("stdout");return}ao(e)}),process.stderr.on("error",e=>{if(vt(e)){kt("stderr");return}ao(e)}))}function ps(e,t){ms();try{return e==="stdout"?process.stdout.write(t):process.stderr.write(t),!0}catch(n){if(vt(n))return kt(e),!1;throw n}}function gs(e){return ps("stderr",e)}function co(e){return typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"?String(e):e===null?"null":JSON.stringify(e)}function Et(e,t){let n=" ".repeat(t);return e.split(`
|
|
13
|
-
`).map(o=>`${n}${o}`).join(`
|
|
14
|
-
`)}function ys(e){let t=new Set,n=0;for(let o of e){let r=Object.keys(o);n+=r.length;for(let i of r)t.add(i)}return e.length*t.size<=n*2}function hs(e,t,n,o){let r=" ".repeat(n);if(!w(t)&&!Array.isArray(t))return`${r}${e}: ${co(t)}`;let i=e==="omission_receipt"?bs(t,n):void 0;if(i!==void 0)return i;if(Array.isArray(t)){if(t.length===0)return`${r}${e}: []`;let s=Et(Ot({[e]:t}),n);return o&&t.length>=1&&t.every(w)&&ys(t)?[!1,!0].map(a=>{let c=Jn(t,{compact:a});return Et(Ot({[e]:c.rows,[`${e}_encoding`]:Yn(c.encoding)}),n)}).reduce((a,c)=>Buffer.byteLength(c)<Buffer.byteLength(a)?c:a,s):s}return w(t)&&Object.keys(t).length===0?`${r}${e}: {}`:`${r}${e}:
|
|
15
|
-
${qe(t,n+1)}`}function bs(e,t){let n=" ".repeat(t);if(xs(e))return`${n}omission_receipt: complete`;let o=w(e)?ws(e):void 0;if(o===void 0)return;let r=`${n}omission_receipt:
|
|
16
|
-
${qe(e,t+1)}`,i=`${n}omission_receipt:
|
|
17
|
-
${qe(o,t+1)}`;return Buffer.byteLength(i)<Buffer.byteLength(r)?i:r}function ws(e){let t=e.omitted_field_groups;if(!Array.isArray(t)||t.length===0||Object.hasOwn(e,"restore_with"))return;let n=[],o;for(let r of t){if(!w(r)||Object.keys(r).length!==2)return;let{name:i,restore_with:s}=r;if(typeof i!="string"||i.length===0||typeof s!="string"||!s.endsWith(i))return;let a=s.slice(0,s.length-i.length);if(o!==void 0&&a!==o)return;o=a,n.push(i)}return Object.fromEntries(Object.entries(e).flatMap(([r,i])=>r==="omitted_field_groups"?[[r,n],["restore_with",`${o}<name>`]]:[[r,i]]))}function Os(e,t,n){let o=e.map(r=>V(r,t,n||t.preserveRowFacts&&w(r))).filter(r=>r!==void 0);return o.length>0||n?o:void 0}function V(e,t={omitDuplicateCountAliases:!0,preserveRowFacts:!0},n=!1){if(e===null)return n?null:void 0;if(Array.isArray(e))return Os(e,t,n);if(w(e)){let o=[],r=Object.entries(e).filter(([i,s])=>{let a=ls.get(i);return!t.omitDuplicateCountAliases||a===void 0||!w(e.collection_counts)||s!==e.collection_counts[a]});for(let[i,s]of r){if(i==="omitted_field_groups"&&Array.isArray(s)&&s.length===0){o.push([i,[]]);continue}let a=V(s,t,n);a!==void 0&&o.push([i,a])}return o.length>0||n?Object.fromEntries(o):void 0}return e}function qe(e,t){let n=" ".repeat(t);if(Array.isArray(e))return e.length===0?"[]":Et(Ot(e),t);if(w(e)){let o=Object.entries(e);return o.length===0?"{}":o.map(([r,i])=>hs(r,i,t,!Object.hasOwn(e,`${r}_encoding`)&&!(r==="checks"&&w(e.verdict)&&e.verdict.authority==="ok"))).join(`
|
|
18
|
-
`)}return`${n}${co(e)}`}var vs=new Set(["filters","now","projection","sorting"]);function ks(e){let t=V(e,{omitDuplicateCountAliases:!1,preserveRowFacts:!1});if(!w(t)||!Array.isArray(t.items))return t??null;let n=Object.fromEntries(Object.entries(t).filter(([o])=>!vs.has(o)));return n.has_more!==!0&&delete n.next_cursor,n}function Es(e){return!w(e)||e.ok!==!0||!w(e.verdict)||e.verdict.authority!=="ok"||!Array.isArray(e.checks)?e:{...e,checks:e.checks.map(As)}}function As(e){if(!w(e)||e.ok!==!0||!w(e.details)||Object.keys(e.details).length!==0)return e;let{details:t,...n}=e;return n}function uo(e,t,n=!1,o={}){if(e=wt(e),t==="json"){let i=n?ks(e):e,s=w(e)&&w(e.projection)&&e.projection.mode==="brief"&&Array.isArray(e.items);return`${JSON.stringify(i,null,s?void 0:2)}
|
|
19
|
-
`}let r=Ts(e,Rs(e,V(Es(oo(to(e))),ze),o.preserveEmptyItemCollections===!0),o.positionalRowPaths??[]);return r===void 0?`{}
|
|
20
|
-
`:`${qe(r,0)}
|
|
21
|
-
`}var ze={omitDuplicateCountAliases:!0,preserveRowFacts:!0};function At(e,t,n=!1){if(Array.isArray(e)){if(e.length===0)return[];let i=Array.isArray(t)?t:[],s=i.length===e.length,a=0,c=e.flatMap(d=>{let u=n||w(d),_=!s&&V(d,ze,u)===void 0,l=At(d,_?void 0:i[a++],u);return l===void 0?[]:[l]});return c.length>0?c:t}if(!w(e))return t;let o=w(t)?t:{},r=Object.entries(e).flatMap(([i,s])=>{let a=At(s,Object.hasOwn(o,i)?o[i]:void 0,n);return a===void 0?[]:[[i,a]]});return r.length>0||Object.keys(e).length===0?Object.fromEntries(r):t}function Rs(e,t,n){if(!n||!w(e))return t;let o=w(t)?t:{},r=new Map(Object.keys(e).filter(i=>i==="item"||Hn.has(i)).map(i=>[i,At(e[i],o[i])]));return lo(e,o,r)}function lo(e,t,n){let o=Object.entries(t).map(([i,s])=>[i,n.has(i)?n.get(i):s]),r=Object.keys(e);for(let[i,s]of n){if(Object.hasOwn(t,i)||s===void 0)continue;let a=new Set(r.slice(r.indexOf(i)+1)),c=o.findIndex(([d])=>a.has(d));o.splice(c===-1?o.length:c,0,[i,s])}return Object.fromEntries(o)}function Ts(e,t,n){if(!w(e))return t;let o=n.filter(s=>{let a=e[s];return Array.isArray(a)&&a.some(c=>V(c,ze,w(c))===void 0)});if(o.length===0)return t;let r=w(t)?t:{},i=new Map(o.map(s=>[s,e[s].map(a=>V(a,ze,!0))]));return lo(e,r,i)}var Ss=JSON.stringify({has_omissions:!1,omitted_field_group_count:0,omitted_field_groups:[]});function xs(e){let t=Object.entries(Object(e)).sort(([n],[o])=>n.localeCompare(o));return JSON.stringify(Object.fromEntries(t))===Ss}function td(e){let t=zt("error_format",{message:e}),n=t.handled&&typeof t.result=="string"?t.result:e;gs(n.endsWith(`
|
|
22
|
-
`)?n:`${n}
|
|
23
|
-
`)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="21a8bc0d-7750-5528-9893-f13d295424fb")}catch{}})();var gt=8,Cs=64,Is=5,js=4,fo=100;function _o(e,t,n){if(e!=="get"||!Rt(n.item)||["fields","outputInclude","output_include","outputCursor","output_cursor"].some(c=>t[c]!==void 0)||t.full===!0||t.tree===!0||t.depth!==void 0&&t.depth!=="standard")return;let o=n.item,r=["linked","claim_state","schedule"],i=r.filter(c=>Object.hasOwn(n,c)),s=Object.fromEntries(Object.entries(n).filter(([c])=>!r.includes(c)));s.item=Object.fromEntries(Object.entries(o).filter(([c])=>c!=="body")),Object.hasOwn(o,"body")&&i.push("body");let a=[...Rt(n.omission_receipt)&&Array.isArray(n.omission_receipt.omitted_field_groups)?n.omission_receipt.omitted_field_groups:[],...i.map(c=>({name:c,restore_with:`--fields ${c}`}))];return s.omission_receipt={has_omissions:a.length>0,omitted_field_group_count:a.length,omitted_field_groups:a},s}function ye(e){let t=Math.trunc(e.effective_budget_tokens),n=Math.trunc(e.measured_result_tokens);if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(n)||n<=0)return{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"};let o=Math.max(t+1,n),r=Math.ceil(o*Is/js),i=Math.ceil(r/fo)*fo;return Number.isSafeInteger(i)?{output_budget:i,recovery_budget_multiplier:i/t,rule_version:"v1"}:{output_budget:"unbounded",recovery_budget_multiplier:null,rule_version:"v1"}}function oe(e,t,n=!1){let o=Object.getOwnPropertyDescriptor(e,"row_contract");o&&(n||o.enumerable===!1)&&Object.defineProperty(t,"row_contract",{...o,enumerable:!1})}function te(e){let t=e.resolvedOutputFormat??e.outputFormat??e.output_format??e.format;return t==="json"||t==="toon"?t:void 0}var he;function M(e,t){let n=t===void 0?JSON.stringify(e):he!==void 0&&he.format===t?Ds(he,e):uo(e,t);return Math.ceil(Buffer.byteLength(n,"utf8")/4)}function Ds(e,t){he=void 0;try{return e.render(t)}finally{he=e}}function Rt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Tt(e,t,n=!1){return typeof e=="string"?n?e:(e.length>Ft&&(t.compacted=!0),Te(e)):Array.isArray(e)?e.map(o=>Tt(o,t,n)):Rt(e)?Object.fromEntries(Object.entries(e).map(([o,r])=>[o,Tt(r,t,n||o==="focus_row_states"||typeof r=="string"&&ae(o))])):e}function U(e,t,n){let o=t.estimated_tokens;for(let r=0;r<gt;r+=1){t.estimated_tokens=o;let i=M(e,n);if(i===o)return;o=i}t.estimated_tokens=o}function Ns(e,t){return ce(e).filter(n=>(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length)>Math.max(1,t.get(n.path)??0)).map(n=>({collection:n,length:Array.isArray(n.value)?n.value.length:Object.keys(n.value).length})).sort((n,o)=>o.length-n.length||n.collection.path.localeCompare(o.collection.path))[0]?.collection}function Ps(e,t,n,o,r,i,s){for(let a=0;a<Cs;a+=1){if(i?.(e),U(e,t,r),t.estimated_tokens<=n)return;let c=Ns(e,o);if(!c)return;let d=Math.max(1,o.get(c.path)??0),u=Array.isArray(c.value)?[...c.value]:Object.entries(c.value),_=s(c.path),l=g=>{let b=_?u.length-g:0;if(Array.isArray(c.value)){c.value.length=g;for(let O=0;O<g;O+=1)c.value[O]=u[b+O]}else{for(let O of Object.keys(c.value))delete c.value[O];Object.defineProperties(c.value,Object.getOwnPropertyDescriptors(Object.fromEntries(u.slice(b,b+g))))}typeof e.count=="number"&&(e.count=X(e)),typeof e.returned_count=="number"&&(e.returned_count=X(e)),c.path==="items"&&(e.applied_limit=g),i?.(e),U(e,t,r)};t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],c.path])].sort((g,b)=>g.localeCompare(b)),e.has_more=!0,e.truncated=!0;let f=d,m=u.length-1,p=d;for(;f<=m;){let g=Math.floor((f+m)/2);l(g),t.estimated_tokens<=n?(p=g,f=g+1):m=g-1}l(p)}}function mo(e,t,n,o=new Map,r,i,s=!1,a=()=>!1){let c={compacted:!1},d=Object.fromEntries(Object.entries(e).map(([u,_])=>[u,Tt(_,c,s&&u==="diff"||typeof _=="string"&&ae(u))]));return oe(e,d),t.strings_compacted=c.compacted,d.read_output=t,Ps(d,t,n,o,r,i,a),U(d,t,r),d}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="24a8de41-54f9-5b59-8e58-7ac924ba6e08")}catch{}})();function fd(e){return typeof e=="object"&&e!==null&&"id"in e&&typeof e.id=="string"&&"context_ref"in e&&typeof e.context_ref=="string"&&e.context_ref.startsWith("session:")&&e.context_ref.endsWith(`:${e.id}`)}var St=256,xt=1e4,Ms=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,po=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Us=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Ls=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&Ms.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=St,reason:`token_budget must be a safe integer of at least ${St}.`},{valid:e=>Number.isSafeInteger(e.spent_tokens)&&e.spent_tokens>=0&&e.spent_tokens<=e.token_budget,reason:"spent_tokens must be a non-negative safe integer no larger than token_budget."},{valid:e=>Array.isArray(e.seen_item_ids)&&e.seen_item_ids.length<=xt&&e.seen_item_ids.every(t=>typeof t=="string"&&po.test(t)),reason:`seen_item_ids must contain at most ${xt} portable item identifiers.`}];function Ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function We(e){throw new h(`--output-session ${e}`,y.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function Ve(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{We("must be a valid JSON object.")}Ke(t)||We("must be a JSON object.");let n=Object.keys(t).filter(i=>!Us.has(i));n.length>0&&We(`contains unknown field "${n.sort()[0]}".`);let o=Ls.find(i=>!i.valid(t));o!==void 0&&We(o.reason);let r=[...new Set(t.seen_item_ids)].sort();return{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:r}}function go(e){if(Ke(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:Ke(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function $s(e){let t=new Set,n=0,o=D(e),r=new Set(o.map(({path:s})=>s)),i=Object.entries(e).flatMap(([s,a])=>Array.isArray(a)&&!r.has(s)?[{path:s,value:a}]:[]);for(let s of[...o,...i]){let a=Array.isArray(s.value)?s.value:Object.values(s.value);for(let c of a){if(!Ke(c))continue;if(typeof c.context_ref=="string"){n+=1;continue}let d=go(c);d!==void 0&&po.test(d)&&t.add(d)}}return{deliveredIds:t,suppressedRepeatCount:n}}function yo(e,t){let n=new Set(t.seen_item_ids);return ue(e,o=>{let r=go(o);return r!==void 0&&n.has(r)?{id:r,context_ref:`session:${t.id}:${r}`}:o})}function Ct(e,t,n){let{deliveredIds:o,suppressedRepeatCount:r}=$s(e),i=new Set(t.seen_item_ids),s=[...o].filter(p=>!i.has(p)).sort(),a=s.slice(0,xt-t.seen_item_ids.length),c=[...t.seen_item_ids,...a].sort(),d=s.length-a.length,u={contract_version:1,id:t.id,measurement_scope:"complete_read_envelope",estimator:"ceil(utf8_bytes / 4)",token_budget:t.token_budget,spent_before_tokens:t.spent_tokens,spent_this_call_tokens:0,charged_this_call_tokens:0,spent_total_tokens:t.spent_tokens,remaining_tokens:t.token_budget-t.spent_tokens,exhausted:!1,seen_before_count:t.seen_item_ids.length,new_item_count:o.size,...d===0?{}:{seen_item_overflow_count:d},suppressed_repeat_count:r,reference_format:"session:<session-id>:<item-id>",restore_reference_with:"pm get <item-id> --depth brief",next_state:{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:c}},_={...e,read_session:u},l=p=>{u.spent_this_call_tokens=p,u.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,p),u.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+u.charged_this_call_tokens),u.remaining_tokens=Math.max(0,t.token_budget-u.spent_total_tokens),u.exhausted=u.remaining_tokens<St,u.next_state.spent_tokens=u.spent_total_tokens},f=0,m=0;for(let p=0;p<8;p+=1){l(f);let g=M(_,n);if(g===f)return _;m=Math.max(m,g),f=g}return l(m),_}function ho(e){return Math.max(0,e.token_budget-e.spent_tokens)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cc0fcb7-2aaa-5233-bdfd-4b4d0fb3e9c1")}catch{}})();var be=Symbol.for("pm.readOutputInvocationProvenance");function md(e,t){return Reflect.set(e,be,{canonical_include_modes:[...t],explicit_legacy_aliases:[],sdk_invocation_observed:!0}),e}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2a596392-747a-5b55-854d-1e80964468d3")}catch{}})();var H=["include","amount","cost","encoding"],Ao=["canonical","legacy","intent","default"],Oe=ke,Nd=Object.freeze(H.map(e=>Oe[e])),Pd=Ee;function Bs(e,t){let n=Ie[e];if(n!==void 0)return n;let o=t==="include"?Ze.has(e)?"<csv>":je(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${Oe[t]} ${o}.`}function Ro(e){let t=Qe[e]??{},n=Object.freeze(Object.fromEntries(H.map(o=>[o,Object.freeze({dimension:o,canonical_option:Oe[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,semantics:Ie[r]===void 0?"replacement":"behavior_preserving",migration_hint:Bs(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:Ao,budget_retention_policy:e==="assurance"?"verdict_priority":Object.hasOwn(S,e)?"ordered_suffix":"ordered_prefix",projection_modes:Object.freeze([...et(e).keys()])})}var Fs=Object.freeze(se.map(Ro)),Gs=new Map(Fs.map(e=>[e.command,e]));function F(e,t={}){let n=ie(e.trim().toLowerCase()),o=Xe(n);return o!==void 0?o.read_output===void 0?void 0:`extension:${o.command}`:on(n,t)}var qs=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],bo={comments:["add","body","comment","text","stdin","file","edit","delete"],notes:["add","note","text","addJson","stdin","file","edit","delete"],learnings:["add","learning","text","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function zs(e){return qs.some(t=>t!=="outputFormat"&&t!=="output_format"&&e[t]!==void 0)}var Ws=[{keys:["outputInclude","output_include"],valid:e=>we(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||re(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||re(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputSession","output_session"],valid:e=>(Ve(e),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:e=>typeof e=="string"&&e.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}],Md="read_output_mutation_conflict",To=[{flag:"--output-include",keys:["outputInclude","output_include"]},{flag:"--output-limit",keys:["outputLimit","output_limit"]},{flag:"--output-budget",keys:["outputBudget","output_budget"]},{flag:"--output-session",keys:["outputSession","output_session"]},{flag:"--output-cursor",keys:["outputCursor","output_cursor"]},{flag:"--output-row-contract",keys:["outputRowContract","output_row_contract"]}],Ud=To.map(({flag:e})=>e);function Ks(e,t,n){let o=To.filter(({keys:a})=>a.some(c=>t[c]!==void 0)),r=o.map(({flag:a})=>a),i=o.flatMap(({keys:a})=>a.filter(c=>t[c]!==void 0)),s=r.join(", ");return new h(`Universal output controls (${s}) cannot be combined with a ${e} mutation; nothing was written.`,y.USAGE,{code:"read_output_mutation_conflict",field:r[0],details:{surface:e,output_controls:r,output_option_keys:i,mutation_options:[...n]},required:`Retry the ${e} mutation without ${s}. To bound or page the result, read it with those controls in a separate call after the write.`,why:"Universal output controls shape a read. A mutation returns its own bounded receipt, so the controls have nothing to shape and the write is refused before it runs.",examples:[...Vs[e]]})}var Vs={comments:['pm comments <id> --add "<text>"',"pm comments <id> --output-limit 5"],notes:['pm notes <id> --add "<text>"',"pm notes <id> --output-limit 5"],learnings:['pm learnings <id> --add "<text>"',"pm learnings <id> --output-limit 5"],files:["pm files <id> --add path=<path>","pm files <id> --output-limit 5"],docs:["pm docs <id> --add path=<path>","pm docs <id> --output-limit 5"],"package-catalog":["pm package install <source> --project","pm package catalog --output-limit 5"]};function Ld(e,t){let n=t.outputFormat??t.output_format;if(n!==void 0&&n!=="json"&&n!=="toon")throw new h("--output-format must be toon or json.",y.USAGE);if(!zs(t))return;let o=F(e,t);if(!o)throw new h(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,y.USAGE);if(Object.hasOwn(bo,o)){let r=o,i=bo[r].filter(s=>t[s]!==void 0&&t[s]!==!1);if(i.length>0)throw Ks(r,t,i)}for(let r of Ws){let i=r.keys.map(s=>t[s]).find(s=>s!==void 0);if(i!==void 0&&!r.valid(i))throw new h(r.message,y.USAGE)}}function So(e){let t=F(e);return t?et(t):new Map}function Hs(e,t,n){let o=we(t)??[],r=So(e),i=[],s=[],a=n,c=a[be],d=new Set(c?.canonical_include_modes??[]),u=new Set(c?.explicit_legacy_aliases??[]);for(let f of o){let m=r.get(f);if(m===void 0){i.push(f);continue}let p=`--${f.replaceAll("_","-")}`;jt(It(n,p))&&u.add(p),n[m]=!0,s.push(f),d.add(f)}let _=F(e)==="get"?i.filter(f=>f!=="item"):[],l=_.length>0;return l&&(n.fields=[...new Set([...we(n.fields)??[],..._])].join(","),d.add("fields")),(s.length>0||l)&&(a[be]={canonical_include_modes:[...d],explicit_legacy_aliases:[...u],...c?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function $d(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:o,modes:r}=Hs(e,n,t);if(r.length===0)return;let i=o.length>0?o.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function It(e,t){let n=tt(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function jt(e){return e!==void 0&&e!==!1&&e!==null}function we(e){let t=(Array.isArray(e)?e:[e]).flatMap(n=>typeof n=="string"?n.split(","):[]).map(n=>n.trim()).filter(Boolean);return t.length>0?[...new Set(t)]:void 0}function re(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function Js(e,t,n,o){for(let r of e.legacy_aliases){if(o(r.flag))continue;let i=It(t,r.flag),s={value:i,flag:r.flag};if(jt(i)&&n(s))return s}}function wo(e,t){let n=we(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:we(t.value)??[je(t.flag)]}}function Oo(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=re(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=re(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function vo(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=re(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=re(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function ko(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function xo(e,t,n){if(!e)return!1;let o=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0||e.sdk_invocation_observed===!0)return!o.has(n);let r=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&r.has(n)&&!o.has(n)}function Ys(e,t,n,o){return e.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||jt(It(o,"--no-truncate"))&&!xo(n,"amount","--no-truncate")||t.amount?.flag==="--no-truncate"||t.include?.flag==="--full"||n?.canonical_include_modes.includes("full")===!0}function Xs(e,t){return H.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[Oe[n]]:[])}function Co(e,t){let n=F(e,t);if(!n)return;let o=Gs.get(n)??Ro(n),r=t[be],i={include:b=>wo(void 0,b),amount:b=>Oo(void 0,b),cost:b=>vo(void 0,b),encoding:b=>ko(void 0,b)},s=Object.fromEntries(H.map(b=>[b,Js(o.dimensions[b],t,O=>i[b](O)!==void 0,O=>xo(r,b,O))])),a=H.flatMap(b=>{let O=s[b];return O?[O.flag]:[]}),c=H.flatMap(b=>{let O=s[b];return O?[o.dimensions[b].legacy_aliases.find(Go=>Go.flag===O.flag).migration_hint]:[]}),d=ko(t.outputFormat??t.output_format,s.encoding),u=wo(t.outputInclude??t.output_include,s.include),_=Oo(t.outputLimit??t.output_limit,s.amount),l=vo(t.outputBudget??t.output_budget,s.cost),f=Ys(e,s,r,t),m=Ht(e,{generateFallback:!0}),p=d?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",g=l??(f?{source:"intent",value:"unbounded"}:{source:"default",value:m.default_max_estimated_tokens_by_format[p]});return{command:n,include:u,amount:_,cost:g,encoding:d,canonical_options_used:Xs({include:u,amount:_,cost:g,encoding:d},r),legacy_aliases_used:a,migration_hints:c,precedence:Ao}}function v(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Dt=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),Qs=["collection_counts","notes_count","tests_count"];function Io(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function Zs(e){let t=v(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...Qs.filter(r=>Object.hasOwn(t,r))])].sort((r,i)=>r.localeCompare(i)),o=Object.keys(e).filter(r=>r!=="item"&&r!=="read_output"&&!Dt.has(r)).sort((r,i)=>r.localeCompare(i));return{item:t,itemFields:n,sections:o,valid:[...n,"item",...n.map(r=>`item.${r}`),...o]}}function ea(e,t){let n=Zs(e),o=t.filter(u=>!n.valid.includes(u));if(o.length>0)throw new h(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,y.USAGE);let r=t.includes("item"),i=t.flatMap(u=>u.startsWith("item.")?[u.slice(5)]:n.itemFields.includes(u)?[u]:[]).filter((u,_,l)=>l.indexOf(u)===_);if(r&&i.length>0)throw new h("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",y.USAGE);let s=new Set(t.filter(u=>n.sections.includes(u))),a=Object.fromEntries(Object.entries(e).filter(([u])=>Dt.has(u)||s.has(u)));r?a.item=n.item:i.length>0&&(a.item=Io(n.item,i));let c=[...r?[]:i.length>0?n.itemFields.filter(u=>!i.includes(u)).map(u=>({name:`item.${u}`,restore_with:`--output-include item.${u}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(u=>!s.has(u)).map(u=>({name:u,restore_with:`--output-include ${u}`}))],d=[...v(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...c];return a.omission_receipt={has_omissions:d.length>0,omitted_field_group_count:d.length,omitted_field_groups:d},a}function Eo(e){let t=0;return ue({...e},n=>(v(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function ta(e,t,n,o){if(Eo(t)===0||Eo(n)>0)return;let r=[...So(e).keys()],i=r.length>0?` Declared ${e} projection modes: ${r.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new h(`Unknown --output-include selector(s) for ${e}: ${o.join(", ")}. No selector matched any returned row field.${i}`,y.USAGE)}function na(e,t,n){if(e==="get")return ea(t,n);let o=Pe(t),r=n.flatMap(s=>o.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=n.some(s=>Object.hasOwn(t,s.split(".")[0])&&!o.some(a=>s.startsWith(`${a}.`)));if(o.length>0&&(!i||r.length>0)){let s={...t},a=r.length>0?r:n,c=ue(s,d=>v(d)?Io(d,a):d);return ta(e,t,c,a),c}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||Dt.has(s)))}function oa(e,t,n,o){if(t==="unbounded")return e;let{result:r,truncated:i}=pn(e,t,s=>B(n,s));if(!i)return r;if(r.has_more=!0,r.truncated=!0,Po(r,n,[...o.entries()].flatMap(([s,a])=>a.rows>t?[{path:s,total_rows:a.totalRows}]:[])),typeof r.count=="number"){let s=v(r.projection)?r.projection.row_key:void 0;r.count=typeof s=="string"&&Array.isArray(r[s])?r[s].length:X(r)}return typeof r.returned_count=="number"&&(r.returned_count=X(r)),r.applied_bound={kind:"output_limit",source:"explicit",value:t},r}function ra(e){return H.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(Oe[t]))}function He(e,t,n,o){let r=Ct(e,t,o);oe(e,r);for(let i=0;i<8;i+=1){let s=n.estimated_tokens,a=r.read_session.spent_this_call_tokens;U(r,n,o);let c=r;r=Ct(r,t,o),oe(c,r);let d=r.read_session.spent_this_call_tokens;if(n.estimated_tokens===s&&d===a)return r}return r}function pt(e,t){if(!v(e.read_output))return e;let n=te(t),o=e.read_output,r=Ve(t.outputSession??t.output_session);return r===void 0?(U(e,o,n),e):He(e,r,o,n)}function ia(e,t){if(e!=="validate")return t;let n=v(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>v(u)&&u.name==="diagnostic_rows"))return t;let o=[...new Set(ce(t).map(({path:u})=>u).filter(u=>/^checks\.\d+\.details\./u.test(u)))],r=o.filter(u=>!o.some(_=>_!==u&&u.startsWith(`${_}.`)));if(r.length===0)return t;let i=v(t.row_contract)?t.row_contract:{},s=Array.isArray(i.row_keys)?i.row_keys.filter(u=>typeof u=="string"):[],a=Array.isArray(i.continuation_row_keys)?i.continuation_row_keys.filter(u=>typeof u=="string"):[],c=s.length>0?s:r,d=[...new Set(r)];return JSON.stringify(c)===JSON.stringify(s)&&JSON.stringify(d)===JSON.stringify(a)?t:{...t,row_contract:{...i,row_keys:c,continuation_row_keys:d,jq_selector:typeof i.jq_selector=="string"?i.jq_selector:".checks[].details"}}}function sa(e,t){return e.include?.source==="canonical"&&!ee(t)}function aa(e,t,n,o,r){let i={...e};if(sa(t,e)&&(i=na(t.command,i,t.include.value)),t.command==="assurance"&&(i=wn(i)),de(i,e),i=On(i,t.command,o),t.command==="history"&&o){let c=["compact_history","provenance_history","history","diff"];if(i=Object.fromEntries(Object.entries(i).filter(([d])=>!c.includes(d)||d===o.path)),v(i.projection)&&(i.projection={...i.projection,row_key:o.path}),v(i.row_contract)){let d=i.row_contract;i.row_contract={...d,row_keys:[o.path],...Array.isArray(d.continuation_row_keys)?{continuation_row_keys:[o.path]}:{}}}i.count=Object.keys(i[o.path]).length}let s=e.count_only===!0?{...i,count_only:!0,count:e.count}:i,a=pa(i,e,t.command,o,r);return t.amount?.source==="canonical"&&(i=oa(i,t.amount.value,t.command,a.collectionsBeforeBudget),a.cursorContinuesExistingPage&&Uo(i,a.originalItems,a.cursorSource,!0,a.originalItemOffset)),de(i,s),Mo(i,t.command,a),{projected:n===void 0?i:yo(i,n),continuationState:a}}function ca(e,t){return[...e.cost!==void 0&&e.cost.value!=="unbounded"&&(e.cost.source==="canonical"||e.cost.source==="default"||e.command==="context"&&e.cost.source==="legacy")?[{source:e.cost.source,tokens:e.cost.value}]:[],...t===void 0?[]:[{source:"session",tokens:ho(t)}]].sort((n,o)=>n.tokens-o.tokens)[0]}function jo(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function Do(e,t){return v(e.context_intent)&&e.context_intent.command==="context"&&e.context_intent.token_budget===t&&e.context_intent.within_budget===!0}function ua(e,t,n){return e.command!=="next"||(t.tokenBudget??t.token_budget)===void 0?!1:!(v(n.context_intent)&&n.context_intent.command==="next"&&n.context_intent.within_budget===!0)}function No(e,t={}){return e?.source==="default"||e?.source==="legacy"&&!Do(t,e.tokens)?{budget_source:e.source,budget_tokens:e.tokens}:{}}function da(e,t,n,o,r,i){let s={contract_version:1,command:e.command,requested_dimensions:t,...No(o),precedence:e.precedence,...jo(e),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:r}:{}},a={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:s},c=n===void 0?a:He(a,n,s,i);if(n===void 0&&U(c,s,i),n!==void 0&&s.estimated_tokens>o.tokens)throw new h("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",y.USAGE);return c}function la(e,t,n){return e.command==="context"&&e.cost?.source==="legacy"&&!Do(n,e.cost.value)||ua(e,t,n)||t.outputRowContract===!0||t.output_row_contract===!0||e.canonical_options_used.includes("--output-include")||e.command==="list"&&e.canonical_options_used.length>0&&e.include?.value.includes("full")===!0}function fa(e,t,n,o,r){if(t!==void 0||ee(n)||la(e,r,n))return!1;if(e.amount?.source==="canonical"&&e.amount.value!=="unbounded"){let i=e.amount.value;if(D(n).some(({value:s})=>(Array.isArray(s)?s.length:Object.keys(s).length)>i))return!1}return e.cost===void 0||e.cost.value==="unbounded"||e.cost.source==="legacy"&&e.command!=="context"||M(r.outputRowContract===!1?Object.fromEntries(Object.entries(n).filter(([i])=>i!=="row_contract")):n,o)<=e.cost.value}function Po(e,t,n){let o=Object.hasOwn(S,t)?S[t]:void 0,r=n.find(i=>o?.paths.includes(i.path));o!==void 0&&r!==void 0&&typeof e[o.total_key]!="number"&&(e[o.total_key]=r.total_rows)}function Mo(e,t,n){let o=S[t]?.paths[0];o!==void 0&&bn(e,t,n.producer,n.collectionsBeforeBudget.get(o)?.rows)}function _a(e,t,n,o){let r=n.backward?n.rows-o:n.baseOffset+o;return{path:t,cursor:st({command:e,path:t,offset:r,total_rows:n.totalRows,fingerprint:n.fingerprint,...n.backward?{direction:"backward"}:{}}),retained_rows:o,remaining_rows:n.backward?r:n.totalRows-r,total_rows:n.totalRows}}function ma(e,t,n,o,r,i,s){if(!n.rows_compacted)return;let a=t.amount?.value==="unbounded"?["amount"]:[],c=new Map(Y(e).map(m=>[m.path,Array.isArray(m.value)?m.value.length:Object.keys(m.value).length])),d=[...s.entries()].flatMap(([m,p])=>{let g=c.get(m);return g>=p.rows?[]:[_a(t.command,m,p,g)]}),u=d[0];Po(e,t.command,d);let _=u?"; page --output-cursor":"",l=o.source==="session"?`Truncated by the remaining ${o.tokens}-token session budget; start a new output session with a larger token_budget${_}.`:`${o.tokens}-token: raise --output-budget${_}`;n.migration_hints=[l,...t.migration_hints];let f=ye({effective_budget_tokens:o.tokens,measured_result_tokens:i});u&&!r&&(typeof e.next_cursor!="string"||e.continuation_kind==="output_cursor")&&(e.next_cursor=u.cursor),e.continuation_kind=r?"producer_cursor":u?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:a,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:r,continuation_available:d.length>0,recovery_budget_multiplier:u?1:f.recovery_budget_multiplier,continuations:d,restore_with:u?"recovery":`Retry with --output-budget ${f.output_budget} because no declared row collection can be continued.`,recovery:u?{cursor:u.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:`--output-budget ${f.output_budget}`,sdk:{outputBudget:f.output_budget},mcp:{outputBudget:f.output_budget}}}}function Uo(e,t,n,o,r){if(typeof n!="string"||!Array.isArray(e.items))return!1;let i=e.items.length,s=t.length;if(i===0||i>=s)return!1;let a;try{a=ut(n)}catch{return!1}let c=a.after_index;if(c===void 0)return!1;let d=t[i-1];if(Object.prototype.toString.call(d)!=="[object Object]")return!1;let u=Reflect.get(d,"id");if(typeof u!="string"||u.length===0)return!1;let _=o?c-(s-i):c+r+i;return _<0?!1:(e.next_cursor=_e(a.fingerprint,u,_,a.snapshot),!0)}function pa(e,t,n,o,r){let i=new Map(Y(e).map(c=>{let d=Array.isArray(c.value)?c.value.length:Object.keys(c.value).length,u=o?.path===c.path,_=B(n,c.path);return[c.path,{rows:d,totalRows:u?o.total_rows:d,baseOffset:u&&!_?o.offset:0,backward:_,fingerprint:u?o.fingerprint:Me(c.path,c.value,n)}]})),s=typeof e.next_cursor=="string",a=o?.path==="items"?o.offset:0;return{collectionsBeforeBudget:i,originalItems:Array.isArray(t.items)?a>0?t.items.slice(a):t.items:[],originalItemOffset:a,cursorContinuesExistingPage:s,cursorSource:s?e.next_cursor:r.after,producer:t}}function ga(e,t,n,o,r,i,s,a,c,d){let u={...t,count_only:n},_=o.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(f=>v(f)&&f.verdict!=="pass").length:0,l=new Map;if(_>0&&l.set("assertions",_),o.command==="history"&&Array.isArray(e.diff))for(let f of ce(e))f.path.startsWith("diff.")&&l.set(f.path,Object.keys(f.value).length);return mo(e,r,i.tokens,l,d,f=>{de(f,u),Mo(f,o.command,a);let m=Uo(f,a.originalItems,a.cursorSource,a.cursorContinuesExistingPage,a.originalItemOffset);if(ma(f,o,r,i,m,c,a.collectionsBeforeBudget),o.command==="history"&&v(f.projection)){f.has_more=typeof f.next_cursor=="string"||f.applied_bound?.kind==="output_limit";let p=f.projection.row_key;typeof p=="string"&&Array.isArray(f[p])&&(f.count=f[p].length)}s!==void 0&&Object.assign(f,He(f,s,r,d))},o.command==="history"&&Array.isArray(e.diff),f=>B(o.command,f))}function Pn(e,t,n){let o=Co(e,t);if(!o)return n;let r=te(t),i=Ve(t.outputSession??t.output_session),s=t.outputCursor??t.output_cursor,a=typeof s=="string"?fe(s):void 0,c=ra(o),d=ia(o.command,n);if(a===void 0&&fa(o,i,d,r,t))return d;let u=ca(o,i),_=aa(d,o,i,a,t),l=_.projected;oe(l,l,t.outputRowContract===!1);let f=ee(l),m={contract_version:1,command:o.command,requested_dimensions:c,...No(u,l),precedence:o.precedence,...jo(o),legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!f,strings_compacted:!1,rows_compacted:!1,result_omitted:f};if(l.read_output=m,l=i===void 0?l:He(l,i,m,r),U(l,m,r),u!==void 0&&m.estimated_tokens>u.tokens){let p=_o(o.command,t,l);p!==void 0&&(m.applied_depth="brief",m.degradation_reason="output_budget_reached",oe(l,p),l=pt(p,t)),m.estimated_tokens>u.tokens&&(l=ga(l,l,d.count_only===!0,o,m,u,i,_.continuationState,m.estimated_tokens,r))}return u!==void 0&&m.estimated_tokens>u.tokens?da(o,c,i,u,m.estimated_tokens,r):l}function ya(e){return v(e)&&v(e.context_intent)&&e.context_intent.result_omitted===!0}function ee(e){return ha(e)||ya(e)}function ha(e){return v(e)&&v(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function ds(e,t){let n=t.outputFormat??t.output_format;if(n==="json"||n==="toon")return n;let o=Co(e,t)?.encoding;return o?.value==="json"||o?.value==="toon"?o.value:void 0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7e894d1f-fe1a-53f2-9a29-4e9846a9f986")}catch{}})();var Lo=["append","cancel","claim","close","comment_add","comment_edit","comment_delete","create","delete","docs_add","docs_remove","files_add","files_remove","files_discover","history_author_acknowledge","history_compact","history_compact_baseline","history_redact","history_repair","history_salvage","import","improvement_observe","learning_add","learning_edit","learning_delete","normalize","note_add","note_edit","note_delete","plan_create_metadata","plan_create_initial_step","plan_add_step","plan_reorder_step","plan_remove_step","plan_link_step","plan_unlink_step","plan_append_decision","plan_append_discovery","plan_append_validation","plan_resume","plan_approve","plan_materialize","plan_update_step","plan_complete_step","plan_block_step","policy_approve","policy_refused","release","reopen","restore","schema_migration","schema_migration_reference","test_run_track","tests_add","tests_remove","tests_update","update","update_audit","update_ownership_bypass","workspace_snapshot_restore","extension_migrations_apply","merge_reconcile"],$o=["history:author-acknowledge","settings:write","init:type_preset","templates:save","profile:apply-types","profile:apply-statuses","profile:apply-fields","profile:apply-config","schema:add-type","schema:remove-type","schema:add-status","schema:remove-status","schema:add-field","schema:remove-field","schema:apply-preset","schema:infer-types","schema:policy-put","schema:policy-remove","schema:policy-mode","assurance:bundle:apply","assurance:gate:verdict","telemetry:install_id","telemetry:first_run_prompt","telemetry:clear","item_format:auto_select_default","transaction_abandon"],Nt={"init:type-preset":"init:type_preset"},Bo=["^config:(?:set|unset):[a-z][a-z0-9_.:-]*$","^assurance:(?:measurement|invariant|gate):(?:put|remove)$","^schema_(?:rename_type|rename_status|remap_status|rename_field|remove_type|remove_status|remove_field)(?:_compensate)?$","^extension:[a-z][a-z0-9_-]*:[a-z][a-z0-9_]*$"],Fd={version:1,item:Lo,workspace:$o,aliases:Nt,patterns:Bo,read_policy:"preserve_original_operation",custom_operation_grammar:"extension:<package_name>:<snake_case_operation>",legacy_custom_operation_grammar:"lowercase segments separated by underscore, hyphen, colon, or dot; optional opaque colon-suffixed retry key",excluded_surfaces:["json_patch","on_write_hook","telemetry_span"]},ba=new Set([...Lo,...$o]),wa=Bo.map(e=>new RegExp(e,"u"));function Fo(e){return Object.hasOwn(Nt,e)?Nt[e]:e}function Gd(e){let t=Fo(e);if(ba.has(t)||wa.some(n=>n.test(t)))return t;throw new TypeError("Undeclared history operation; use a native contract identity or extension:<package_name>:<snake_case_operation>.")}function qd(e){let t=Fo(e),n=t.indexOf(":"),o=n<0?t:t.slice(0,n),r=n<0||n<t.length-1&&!/[\s\p{C}]/u.test(t.slice(n+1));if(/^[a-z][a-z0-9]*(?:[_.-][a-z0-9]+)*$/u.test(o)&&r)return t;throw new TypeError("History operation must use lowercase alphanumeric segments with an optional non-whitespace colon-suffixed retry key.")}export{ln as a,Ua as b,La as c,$a as d,fn as e,_n as f,Qa as g,_c as h,mc as i,zo as j,Aa as k,Kt as l,Wo as m,er as n,nr as o,Vt as p,or as q,rr as r,Ht as s,$ as t,Jt as u,Ra as v,Ta as w,Ye as x,Sa as y,xa as z,Ca as A,Ia as B,ja as C,gc as D,de as E,S as F,B as G,be as H,md as I,H as J,Nd as K,Pd as L,Fs as M,F as N,Md as O,Ud as P,Ld as Q,So as R,Hs as S,$d as T,Co as U,pt as V,Pn as W,ee as X,ha as Y,ds as Z,hn as _,Me as $,st as aa,fe as ba,Nc as ca,Pc as da,_e as ea,ut as fa,dt as ga,Mc as ha,di as ia,Uc as ja,Lc as ka,I as la,k as ma,Yc as na,pe as oa,Oi as pa,Xc as qa,Qc as ra,vi as sa,Zc as ta,eu as ua,tu as va,Ri as wa,Mn as xa,Ti as ya,mu as za,xi as Aa,Ln as Ba,pu as Ca,Fn as Da,Di as Ea,jn as Fa,zi as Ga,Qi as Ha,Hn as Ia,Ou as Ja,Su as Ka,xu as La,gs as Ma,uo as Na,td as Oa,ye as Pa,M as Qa,fd as Ra,xt as Sa,Ve as Ta,yo as Ua,Ct as Va,ho as Wa,Lo as Xa,$o as Ya,Nt as Za,Bo as _a,Fd as $a,Fo as ab,Gd as bb,qd as cb};
|
|
24
|
-
//# sourceMappingURL=chunk-J7ESCE7M.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as Fe,o as G,p as Ge,q as $e,s as qe,w as $,x as Ue,y as Be,z as ze}from"./chunk-QJ647CQE.js";import{aa as Le,e as Oe}from"./chunk-5UVJOAUP.js";import{N as je,bb as Me,hb as Pe,j as Se}from"./chunk-5WQ3LNUK.js";import{a as I}from"./chunk-I5LGPUWH.js";import{c as Ne,da as Ae,ea as oe,ha as Re}from"./chunk-J7ESCE7M.js";import{Jc as De,T as we,Y as ke,bd as Te,ob as ie,sa as xe,uc as Ce,za as Ee}from"./chunk-3WVMEA2A.js";import{A as k,F as j,I as re,K as Ie,z as w}from"./chunk-PDXSMSO5.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="403706c5-987d-5db1-95d2-b0eaded98e92")}catch{}})();function Ut(e,t,n,r,i,o){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=o)return"truncate";e.seen.add(t),e.parents.set(t,n.id);let s=n.depth+1;return e.queue.push({id:t,depth:s}),e.cursorFound?(e.affected.push({id:t,distance:s,path:Yt(r,t,e.parents)}),"continue"):(e.cursorFound=t===i,"skip")}function Ke(e,t,n,r){let i=Ae("graph impact",{root:e,direction:n,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(r)?r:"unbounded"});return{fingerprint:i,after:t.after===void 0?void 0:Re(t.after,i)}}function C(e,t,n){e.get(t).add(n)}function M(e){return new Map(e.map(t=>[t,new Set]))}function Ve(e){for(let t of e)t.sort();return e.sort((t,n)=>n.length-t.length||t[0].localeCompare(n[0]))}function q(e){if(Array.isArray(e))return e.map(n=>q(n));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?q(t.call(e)):Object.fromEntries(Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,q(r)]))}function He(e){return JSON.stringify(q(e))}function Bt(e,t,n,r){let i=[{id:e,expanded:!1}];for(;i.length>0;){let o=i.pop();if(o.expanded){r.push(o.id);continue}if(n.has(o.id))continue;n.add(o.id),i.push({id:o.id,expanded:!0});let s=[...t.get(o.id)].sort().reverse();for(let a of s)n.has(a)||i.push({id:a,expanded:!1})}}function zt(e,t){let n=new Set,r=[];for(let i of e)n.has(i)||Bt(i,t,n,r);return r}function Ht(e,t){let n=new Set,r=[];for(let i of[...e].reverse()){if(n.has(i))continue;let o=[],s=[i];for(n.add(i);s.length>0;){let a=s.pop();o.push(a);for(let c of t.get(a))n.has(c)||(n.add(c),s.push(c))}r.push(o)}return Ve(r)}function We(e,t){let n=M(e);for(let[r,i]of t)for(let o of i)C(n,o,r);return Ht(zt(e,t),n)}function Kt(e,t){let n=M(e.nodes());for(let r of e.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let o=(i.precedence??"source_before_target")==="source_before_target";C(n,o?r.source:r.target,o?r.target:r.source)}return n}function Vt(e,t){let n=new Map(e.map(o=>[o,0]));for(let o of t.values())for(let s of o)n.set(s,n.get(s)+1);let r=e.filter(o=>n.get(o)===0).sort(),i=[];for(;r.length>0;){i.push(r);let o=[];for(let s of r)for(let a of t.get(s)){let c=n.get(a)-1;n.set(a,c),c===0&&o.push(a)}r=o.sort()}return i}function Wt(e,t){let n=new Map(e.map(s=>[s,0])),r=new Map;for(let s of e)for(let a of t.get(s)){if(!n.has(a))continue;let c=n.get(s)+1,d=r.get(a);(c>n.get(a)||c===n.get(a)&&(d===void 0||s.localeCompare(d)<0))&&(n.set(a,c),r.set(a,s))}let i=[...e].sort((s,a)=>n.get(a)-n.get(s)||s.localeCompare(a))[0],o=i===void 0?[]:[i];for(;o[0]!==void 0&&r.has(o[0]);)o.unshift(r.get(o[0]));return{depth:Object.fromEntries(n),path:o}}function Yt(e,t,n){let r=[t],i=t;for(;i!==e;)i=n.get(i),r.push(i);return r.reverse()}function B(e,t={}){let n=t.registry??we(),r=[...e.nodes()],i=Kt(e,n),o=Vt(r,i),s=o.flat(),a=s.length===r.length,c=a?[]:We(r,i).filter(l=>l.length>1||i.get(l[0]).has(l[0])),d=Wt(s,i);return{exact:!0,acyclic:a,order:s,layers:o,frontier:o[0]??[],depth:d.depth,criticalPath:d.path,criticalPathLength:Math.max(0,d.path.length-1),cycles:c,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Xt(e,t,n){let r=M(e.nodes()),i=n===void 0?void 0:new Set(n.map(s=>e.registry().require(s).kind)),o=e.edges();for(let s of o){let a=e.registry().require(s.kind);i!==void 0&&!i.has(s.kind)&&(a.inverse===void 0||!i.has(a.inverse))||C(r,t==="incoming"?s.target:s.source,t==="incoming"?s.source:s.target)}return{adjacency:r,inspectedEdges:o.length}}function Jt(e,t,n,r,i,o){let s=U(e,t,{...n,after:void 0,direction:"incoming",limit:void 0}),a=U(e,t,{...n,after:void 0,direction:"outgoing",limit:void 0}),c=new Map,d=[...s.affected,...a.affected].sort((p,m)=>p.distance-m.distance||p.id.localeCompare(m.id)||p.path.join("\0").localeCompare(m.path.join("\0")));for(let p of d)c.has(p.id)||c.set(p.id,p);let l=[...c.values()].sort((p,m)=>p.distance-m.distance||p.id.localeCompare(m.id)),g=r===void 0||r===t?-1:l.findIndex(p=>p.id===r);if(r!==void 0&&r!==t&&g<0)throw new TypeError(`Unknown impact cursor item: ${r}`);let u=l.slice(g+1,g+1+i),f=g+1+u.length<l.length;return{root:t,affected:u,exact:!0,truncated:s.truncated||a.truncated||f,...f?{nextCursor:oe(o,u.at(-1)?.id??t)}:{},cost:{visitedNodes:s.cost.visitedNodes+a.cost.visitedNodes,inspectedEdges:s.cost.inspectedEdges+a.cost.inspectedEdges}}}function Qt(e,t,n){let r=n.direction,i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:a}=Ke(t,n,r,i),{adjacency:c,inspectedEdges:d}=Xt(e,r,n.kinds),l={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:a===void 0||a===t},g=0,u=!1,f=!1;e:for(let p=0;p<l.queue.length;p+=1){n.signal?.throwIfAborted();let m=l.queue[p];g+=1;let b=[...c.get(m.id)].sort();if(m.depth>=i){b.some(v=>!l.seen.has(v))&&(u=!0);continue}for(let v of b)if(Ut(l,v,m,t,a,o)==="truncate"){u=!0,f=!0;break e}}if(!l.cursorFound)throw new TypeError(`Unknown impact cursor item: ${a}`);return{root:t,affected:l.affected,exact:!0,truncated:u,...f?{nextCursor:oe(s,l.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:g,inspectedEdges:d}}}function U(e,t,n={}){let r=n.direction??"outgoing";if(r!=="both")return Qt(e,t,{...n,direction:r});let i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:a}=Ke(t,n,r,i);return Jt(e,t,n,a,o,s)}function Ye(e){let t=[...e.nodes()],n=M(t),r=M(t);for(let c of e.edges())C(n,c.source,c.target),C(n,c.target,c.source),C(r,c.source,c.target);let i=[],o=new Set;for(let c of t){if(o.has(c))continue;let d=[],l=[c];for(o.add(c);l.length>0;){let g=l.pop();d.push(g);for(let u of n.get(g))o.has(u)||(o.add(u),l.push(u))}i.push(d)}let s=t.map(c=>({id:c,degree:n.get(c).size})),a=Math.max(0,...s.map(({degree:c})=>c));return{components:Ve(i),stronglyConnected:We(t,r),orphans:s.filter(({degree:c})=>c===0).map(({id:c})=>c),hubs:s.filter(({degree:c})=>c>0&&c===a),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Xr(e,t){let n=new Map(e.edges.map(i=>[He(i),i])),r=new Map(t.edges.map(i=>[He(i),i]));return{fromVersion:e.version,toVersion:t.version,added:[...r].filter(([i])=>!n.has(i)).map(([,i])=>i),removed:[...n].filter(([i])=>!r.has(i)).map(([,i])=>i),unchangedCount:[...n.keys()].filter(i=>r.has(i)).length,exact:!0}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f60c628a-2e42-5770-a001-39cce5f92595")}catch{}})();var Zt=I.paths,en=I.visited_paths,tn=I.path_depth;function se(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function z(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function P(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function D(e,t){let n=P(e,t);return{predecessor:n,successor:n===e.source?e.target:e.source}}function nn(e,t,n){if(t===void 0)return;let r=e.registry(),i=new Set;for(let o of t){let s=r.require(o),a=s.traversal;if(a==="association")throw new TypeError(`Relationship kind ${s.kind} uses association traversal; use graph impact --direction both`);if(a!==n&&a!=="semantic"){let c=a==="hierarchy"?"graph ancestors or graph descendants":"graph predecessors or graph successors";throw new TypeError(`Relationship kind ${s.kind} uses ${a} traversal; use ${c}`)}i.add(s.kind)}return i}function rn(e,t,n,r,i){let o=e.registry(),s=e.neighborEdges(t,{direction:"both",...n===void 0?{}:{kinds:[...n]}}),a=[],c=new Set;for(let d of s.value){let l=o.require(d.edge.kind);n===void 0&&!l[r]||i(d,l,t)&&(c.has(d.id)||(c.add(d.id),a.push(d.id)))}return{neighbors:a,inspectedEdges:s.meta.inspectedEdges}}function on(e,t,n,r,i,o){if(t>=n)return e.neighbors.some(s=>!o.seen.has(s))&&(o.truncated=!0),!1;for(let s of e.neighbors)if(!o.seen.has(s)){if(o.seen.add(s),o.queue.push({id:s,depth:t+1}),!o.resumed){s===i&&(o.resumed=!0);continue}if(o.value.length>=r)return o.truncated=!0,!0;o.value.push(s)}return!1}function H(e,t,n,r,i){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let o=nn(e,n.kinds,r),s=n.limit??Number.POSITIVE_INFINITY,a=n.maxDepth??Number.POSITIVE_INFINITY,c=n.after,d={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:c===void 0,truncated:!1},l=0,g=0;for(let u=0;u<d.queue.length;u+=1){n.signal?.throwIfAborted();let f=d.queue[u];l+=1;let p=rn(e,f.id,o,r,i);if(g+=p.inspectedEdges,on(p,f.depth,a,s,c,d))break}if(!d.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${c}`);return{value:d.value,meta:{visitedNodes:l,inspectedEdges:g,truncated:d.truncated,nextCursor:d.value.at(-1)}}}function Xe(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function Je(e,t,n,r,i){let o=e.neighborEdges(t.nodes.at(-1),{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});return i.inspectedEdges+=o.meta.inspectedEdges,o.value.filter(s=>!t.nodeSet.has(s.id))}function sn(e,t,n,r,i,o,s){for(let a of Je(e,t,r,i,s)){let c=[...t.nodes,a.id],d=new Set(t.nodeSet).add(a.id),l=[...t.edges,a.edge];if(a.id===n){if(s.value.push({nodes:c,edges:l,length:l.length}),s.value.length>=o)return!0}else s.queue.push({nodes:c,nodeSet:d,edges:l})}return!1}function Qe(e,t,n={}){return H(e,t,n,"hierarchy",(r,i)=>z(r.edge,i)===r.id)}function Ze(e,t,n={}){return H(e,t,n,"hierarchy",(r,i,o)=>z(r.edge,i)===o)}function et(e,t,n={}){return H(e,t,n,"ordering",(r,i)=>P(r.edge,i)===r.id)}function tt(e,t,n={}){return H(e,t,n,"ordering",(r,i,o)=>P(r.edge,i)===o)}function an(e,t,n,r,i,o,s,a){let c={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},d=0,l=!1,g=i+1;for(let u=0;u<c.queue.length;u+=1){if(r.signal?.throwIfAborted(),c.value.length>=g||d>=o){l=!0;break}let f=c.queue[u];if(d+=1,f.edges.length>=s){Je(e,f,r,a,c).length>0&&(l=!0);continue}if(sn(e,f,n,r,a,g,c)){l=!0;break}}return{value:c.value.slice(0,i),meta:{visitedNodes:d,inspectedEdges:c.inspectedEdges,truncated:l}}}function nt(e,t,n,r={}){Xe(e,t),Xe(e,n);let i=r.maxPaths??Zt,o=r.maxVisitedPaths??en,s=r.maxDepth??tn;se("maxPaths",i),se("maxVisitedPaths",o),se("maxDepth",s);let a=r.direction??"outgoing";r.signal?.throwIfAborted();for(let c of r.kinds??[])e.registry().require(c);return t===n?i===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:an(e,t,n,r,i,o,s,a)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="789f7451-ceb1-5e5c-b2b6-45eec49580ce")}catch{}})();var cn=16,dn=2,ln=8;function K(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function V(e,t,n){let r=e.registry(),i=t===void 0?void 0:new Set(t.map(o=>r.require(o).kind));for(let o of e.edges()){if(o.source===o.target)continue;let s=r.require(o.kind);i!==void 0&&!(i.has(s.kind)||s.inverse!==void 0&&i.has(s.inverse))||n(o,s)}}function un(e,t){let n=new Map;V(e,t,r=>{rt(n,r.source,r.target),rt(n,r.target,r.source)});for(let r of n.values())r.sort();return n}function rt(e,t,n){let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)}function gn(e,t){let n=new Map;for(let o of e){let s=t.get(o);n.set(s,(n.get(s)??0)+1)}let r,i=0;for(let[o,s]of n)(s>i||s===i&&o<r)&&(r=o,i=s);return r}function fn(e,t){let n=new Map;for(let[i,o]of e){let s=n.get(o);s===void 0?n.set(o,[i]):s.push(i)}let r=[];for(let i of n.values())i.length<t||(i.sort(),r.push({representative:i[0],size:i.length,members:i}));return r.sort((i,o)=>o.size-i.size||i.representative.localeCompare(o.representative))}function it(e,t={}){let n=t.maxIterations??cn,r=t.minSize??dn;K("maxIterations",n),K("minSize",r);let i=un(e,t.kinds),o=e.nodes(),s=new Map(o.map(g=>[g,g])),a=0,c=!1,d=0,l=0;for(;a<n&&!c;){t.signal?.throwIfAborted(),a+=1,c=!0;for(let g of o){d+=1;let u=i.get(g);if(u===void 0)continue;l+=u.length;let f=gn(u,s);f!==s.get(g)&&(s.set(g,f),c=!1)}}return{value:{communities:fn(s,r),iterations:a,converged:c},meta:{visitedNodes:d,inspectedEdges:l,truncated:!c}}}function W(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Y(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function ae(e,t){return(t.hierarchy?z(e,t):e.source===P(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function pn(e,t){if(t===void 0)return;let n=e.registry(),r=new Set;for(let i of t){let o=n.require(i);if(!W(o))throw new TypeError(`Relationship kind ${o.kind} is not a directed ordering or hierarchy kind`);r.add(Y(o))}return r}function hn(e,t){let n=e.registry(),r=new Map;for(let i of e.edges()){let o=n.require(i.kind);if(!W(o))continue;let s=Y(o);if(t!==void 0&&!t.has(s))continue;let a=ae(i,o);if(a.from===a.to)continue;let c=r.get(s);c===void 0&&(c={adjacency:new Map,records:[]},r.set(s,c));let d=c.adjacency.get(a.from);d===void 0?c.adjacency.set(a.from,new Set([a.to])):d.add(a.to),c.records.push({...a,edge:i})}return r}function mn(e){let t=new Map;for(let[n,r]of e.adjacency)t.set(n,[...r].sort());return t}function _n(e,t,n,r){let i=[r];for(let o=n;o!==t;o=e.get(o))i.push(o);return i.push(t),i.reverse()}function yn(e,t,n,r,i,o){for(let s of e.get(n.id)??[])if(o.inspectedEdges+=1,!(n.depth===0&&s===t.to)&&!r.has(s)){if(r.set(s,n.id),s===t.to)return _n(r,t.from,n.id,s);i.push({id:s,depth:n.depth+1})}}function bn(e,t,n,r){let i=new Map([[t.from,t.from]]),o=[{id:t.from,depth:0}];for(let s=0;s<o.length;s+=1){let a=o[s];if(r.visitedNodes+=1,a.depth>=n)continue;let c=yn(e,t,a,i,o,r);if(c!==void 0)return c}}function T(e,t={}){let n=t.maxDepth??ln;K("maxDepth",n),t.limit!==void 0&&K("limit",t.limit);let r=t.limit??Number.POSITIVE_INFINITY,i=pn(e,t.kinds),o=hn(e,i),s=[],a={visitedNodes:0,inspectedEdges:0},c=!1;e:for(let d of[...o.keys()].sort()){let l=o.get(d),g=mn(l);for(let u of l.records){t.signal?.throwIfAborted();let f=bn(g,u,n,a);if(f!==void 0){if(s.length>=r){c=!0;break e}s.push({edge:u.edge,witness:f})}}}return{value:s,meta:{visitedNodes:a.visitedNodes,inspectedEdges:a.inspectedEdges,truncated:c}}}function vn(e,t,n,r,i){let o=new Set,s=[];for(let a of n){if(a.id===e||o.has(a.id))continue;if(!i.seen.has(a.id)){if(t>=r){i.truncated=!0;continue}i.seen.add(a.id),i.queue.push({id:a.id,depth:t+1})}o.add(a.id),s.push(a.id);let c=i.predecessors.get(a.id);c===void 0&&(c=new Set,i.predecessors.set(a.id,c)),c.add(e)}return s}function wn(e,t,n){let r=n.direction??"outgoing",i=n.maxDepth??Number.POSITIVE_INFINITY,o=[],s=new Map,a={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},c=0;for(let d=0;d<a.queue.length;d+=1){n.signal?.throwIfAborted();let{id:l,depth:g}=a.queue[d];o.push(l);let u=e.neighborEdges(l,{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});c+=u.meta.inspectedEdges,s.set(l,vn(l,g,u.value,i,a))}return{order:o,successors:s,predecessors:a.predecessors,inspectedEdges:c,truncated:a.truncated}}function kn(e,t){let n=[],r=new Set([t]),i=[{id:t,index:0}];for(;i.length>0;){let o=i.at(-1),s=e.successors.get(o.id);if(o.index<s.length){let a=s[o.index];o.index+=1,r.has(a)||(r.add(a),i.push({id:a,index:0}))}else n.push(o.id),i.pop()}return n.reverse()}function In(e,t,n,r){let i=e,o=t;for(;i!==o;){for(;r.get(i)>r.get(o);)i=n.get(i);for(;r.get(o)>r.get(i);)o=n.get(o)}return i}function xn(e,t,n){let r;for(let i of[...e].sort())t.has(i)&&(r=r===void 0?i:In(r,i,t,n));return r}function En(e,t,n,r,i){let o=new Map([[t,t]]),s=!0;for(;s;){s=!1;for(let a of n){if(i?.throwIfAborted(),a===t)continue;let c=xn(e.predecessors.get(a),o,r);c!==void 0&&o.get(a)!==c&&(o.set(a,c),s=!0)}}return o}function ot(e,t,n={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(n.maxDepth!==void 0&&(!Number.isInteger(n.maxDepth)||n.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(n.maxDepth)}`);let r=wn(e,t,n),i=kn(r,t),o=new Map(i.map((d,l)=>[d,l])),s=En(r,t,i,o,n.signal),a=new Map(i.map(d=>[d,1]));for(let d=i.length-1;d>=0;d-=1){let l=i[d];if(l===t)continue;let g=s.get(l);a.set(g,a.get(g)+a.get(l))}let c=i.filter(d=>d!==t).map(d=>({id:d,idom:s.get(d),dominatedCount:a.get(d)-1})).sort((d,l)=>l.dominatedCount-d.dominatedCount||d.id.localeCompare(l.id));return{value:{root:t,reachableCount:r.order.length,rows:c},meta:{visitedNodes:r.order.length,inspectedEdges:r.inspectedEdges,truncated:r.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3cef3a97-fda4-5811-9e69-04ff722e40a1")}catch{}})();function st(e){return Math.round(e*1e6)/1e6}function at(e,t,n){let r=e.get(t);r===void 0?e.set(t,new Set([n])):r.add(n)}function ct(e,t){let n=new Map(e.nodes().map(i=>[i,new Set]));V(e,t,i=>{n.get(i.source).add(i.target),n.get(i.target).add(i.source)});let r=new Map;for(let[i,o]of n)r.set(i,[...o].sort());return r}function Sn(e,t){let n=new Map,r=new Map;return V(e,t,(i,o)=>{if(!o.ordering)return;let{predecessor:s,successor:a}=D(i,o);at(r,s,a),at(n,a,s)}),{incoming:n,outgoing:r}}function Cn(e,t,n){let r=new Map([[e,0]]),i=new Map([[e,1]]),o=new Map,s=[],a=[e],c=0,d=0;for(let l=0;l<a.length;l+=1){let g=a[l];n.visitedNodes+=1,s.push(g);let u=r.get(g);g!==e&&(c+=1,d+=u);for(let f of t.get(g))if(n.inspectedEdges+=1,r.has(f)||(r.set(f,u+1),a.push(f)),r.get(f)===u+1){i.set(f,(i.get(f)??0)+i.get(g));let p=o.get(f);p===void 0?o.set(f,[g]):p.push(g)}}return{stack:s,sigma:i,predecessors:o,reachableCount:c,distanceSum:d}}function Dn(e,t,n){let r=new Map;for(let i=e.stack.length-1;i>=0;i-=1){let o=e.stack[i],s=(1+(r.get(o)??0))/e.sigma.get(o);for(let a of e.predecessors.get(o)??[])r.set(a,(r.get(a)??0)+e.sigma.get(a)*s);o!==t&&n.set(o,(n.get(o)??0)+(r.get(o)??0))}}function Tn(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Nn(e,t,n,r,i){return{id:e,degree:t.get(e).length,inDegree:n.incoming.get(e)?.size??0,outDegree:n.outgoing.get(e)?.size??0,betweenness:st((r.get(e)??0)/2),closeness:st(i.get(e))}}function dt(e,t={}){let n=ct(e,t.kinds),r=Sn(e,t.kinds),i=e.nodes(),o=new Map,s=new Map,a={visitedNodes:0,inspectedEdges:0};for(let l of i){t.signal?.throwIfAborted();let g=Cn(l,n,a);s.set(l,Tn(g,i.length)),Dn(g,l,o)}let c=0;for(let l of n.values())c+=l.length;let d=i.map(l=>Nn(l,n,r,o,s)).sort((l,g)=>g.betweenness-l.betweenness||g.degree-l.degree||l.id.localeCompare(g.id));return{value:{nodeCount:i.length,edgeCount:c/2,rows:d},meta:{visitedNodes:a.visitedNodes,inspectedEdges:a.inspectedEdges,truncated:!1}}}function An(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Rn(e,t,n){let r=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,n.inspectedEdges+=1,r!==e.parent){if(n.discovery.has(r)){n.low.set(e.node,Math.min(n.low.get(e.node),n.discovery.get(r)));return}return e.children+=1,n.discovery.set(r,n.timer),n.low.set(r,n.timer),n.timer+=1,{node:r,parent:e.node,neighborIndex:0,children:0}}}function On(e,t,n){if(e.parent===null){e.children>1&&n.articulation.add(e.node);return}let r=e.parent,i=n.low.get(e.node);n.low.set(r,Math.min(n.low.get(r),i)),r!==t&&i>=n.discovery.get(r)&&n.articulation.add(r),i>n.discovery.get(r)&&n.bridges.push(An(r,e.node))}function jn(e,t,n,r){n.discovery.set(e,n.timer),n.low.set(e,n.timer),n.timer+=1;let i=[{node:e,parent:null,neighborIndex:0,children:0}];for(;i.length>0;){r?.throwIfAborted();let o=i.at(-1);if(o.neighborIndex<t.get(o.node).length){let s=Rn(o,t,n);s!==void 0&&i.push(s)}else On(o,e,n),i.pop()}}function X(e,t={}){let n=ct(e,t.kinds),r={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let i of e.nodes())r.discovery.has(i)||jn(i,n,r,t.signal);return{value:{articulationPoints:[...r.articulation].sort(),bridges:r.bridges.sort((i,o)=>i.source.localeCompare(o.source)||i.target.localeCompare(o.target))},meta:{visitedNodes:r.discovery.size,inspectedEdges:r.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="32f3ce0d-64ac-5ad4-b27a-2a279718de22")}catch{}})();function Mn(e){let t=e.registry(),n=new Map,r=new Set;for(let i of e.edges()){let o=t.require(i.kind);if(!o.ordering)continue;let{predecessor:s,successor:a}=D(i,o);if(r.add(s),r.add(a),s===a)continue;let c=n.get(s);c===void 0?n.set(s,new Set([a])):c.add(a)}return{forward:n,participants:r}}function Pn(e,t,n,r){if(e===void 0)return r;let i=r;for(let o of e)t.has(o)&&(i=Math.min(i,n.get(o)));return i}function Ln(e,t,n){let r=n-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:n,latestFinish:n+1,slack:r,critical:r===0}}function Fn(e,t,n,r,i){let o=new Map;for(let s=e.length-1;s>=0;s-=1){let a=e[s],c=Pn(t.forward.get(a),r,o,i);o.set(a,c-1)}return e.map(s=>Ln(s,n[s],o.get(s))).sort((s,a)=>s.slack-a.slack||s.earliestStart-a.earliestStart||s.id.localeCompare(a.id))}function lt(e,t={}){t.signal?.throwIfAborted();let n=B(e,{registry:e.registry()}),r=Mn(e),i=new Set(n.order),o=n.order.filter(d=>r.participants.has(d)),s=o.reduce((d,l)=>Math.max(d,n.depth[l]+1),0),a=Fn(o,r,n.depth,i,s),c=a.length>0;return{exact:!0,acyclic:n.acyclic,makespan:s,scheduledCount:a.length,criticalPath:c?n.criticalPath:[],criticalPathLength:c?n.criticalPathLength:0,cycles:n.cycles,rows:a,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fa17672a-97a2-5f94-bdfe-9df970cc038b")}catch{}})();function Gn(e,t,n){for(let r=e.length-1;r>=0;r-=1){n?.throwIfAborted();let i=t.get(e[r]);for(let o of i.successors){n?.throwIfAborted();let s=t.get(o);if(s.latest===void 0||s.duration===void 0)continue;let a=s.latest-s.duration;(i.latest===void 0||a<i.latest)&&(i.latest=a,i.anchor=s.anchor)}}}function $n(e,t,n,r){let i=[],o=e;for(;o!==void 0&&i.length<n;)r?.throwIfAborted(),i.push(o),o=t.get(o).predecessor;return i.reverse(),{path:i,path_truncated:o!==void 0}}function qn(e,t,n,r,i){let o=new Map(t.map(a=>[a.id,a])),s=new Map;for(let a of e){i?.throwIfAborted();let c=o.get(a),d=c?.estimated_minutes,l=typeof d=="number"&&Number.isFinite(d)&&d>=0?d:void 0,g={item:c,duration:l,pending:0,successors:new Set,earliest:0};if(c?.deadline!==void 0){let u=Date.parse(c.deadline);Number.isFinite(u)?(g.deadline=(u-n)/6e4,g.latest=g.deadline,g.anchor=a):r(a,"invalid_deadline")}s.set(a,g)}return s}function Un(e,t,n){for(let r of e.edges()){n?.throwIfAborted();let i=e.registry().require(r.kind);if(!i.ordering)continue;let{predecessor:o,successor:s}=D(r,i),a=t.get(o);a.successors.has(s)||(a.successors.add(s),t.get(s).pending+=1)}}function Bn(e,t,n){let r=e.filter(i=>t.get(i).pending===0);for(let i=0;i<r.length;i+=1){n?.throwIfAborted();let o=r[i],s=t.get(o),a=s.earliest===null||s.duration===void 0?null:s.earliest+s.duration;for(let c of s.successors){n?.throwIfAborted();let d=t.get(c);a===null?d.earliest=null:d.earliest!==null&&(a>d.earliest||a===d.earliest&&(d.predecessor===void 0||o<d.predecessor))&&(d.earliest=a,d.predecessor=o),d.pending-=1,d.pending===0&&r.push(c)}}return r}function zn(e,t,n,r,i,o,s,a){let c=t.duration;if(t.latest!==void 0){r.scheduled_count+=1;let d=t.latest-c;r.rows.length<o?r.rows.push({id:e,deadline_id:t.anchor,latest_start:new Date(i+d*6e4).toISOString(),slack_minutes:t.earliest===null?null:d-t.earliest}):r.truncated=!0}if(t.deadline!==void 0&&t.earliest!==null&&t.earliest+c>t.deadline)if(r.overcommitted_count+=1,r.overcommitted.length<o){let d=$n(e,n,Math.min(o,s.remaining),a);s.remaining-=d.path.length,d.path_truncated&&(r.truncated=!0),r.overcommitted.push({deadline_id:e,deadline:t.item.deadline,shortfall_minutes:t.earliest+c-t.deadline,...d})}else r.truncated=!0}function Hn(e,t,n,r,i,o,s,a){let c={remaining:o};for(let d of e){a?.throwIfAborted();let l=t.get(d);if(l.pending>0){s(d,"cycle_or_gated_by_cycle");continue}if(l.duration===void 0){s(d,"unknown_estimate");continue}if(l.latest!==void 0&&!Number.isFinite(new Date(r+(l.latest-l.duration)*6e4).getTime())){s(d,"date_range_exceeded");continue}l.earliest===null&&s(d,"unknown_predecessor_estimate"),zn(d,l,t,n,r,i,c,a)}}function ut(e,t,n={}){n.signal?.throwIfAborted();let r=Date.parse(n.now??new Date().toISOString());if(!Number.isFinite(r))throw new TypeError("Invalid scheduling clock");let i=n.maxWork??1e5,o=n.limit??10;for(let[u,f]of[["maxWork",i],["limit",o]])if(!Number.isSafeInteger(f)||f<1)throw new TypeError(`Invalid scheduling ${u}`);let s={as_of:new Date(r).toISOString(),basis:"derived_elapsed_minutes",complete:!0,truncated:!1,work_limit_exceeded:!1,scheduled_count:0,residual_count:0,overcommitted_count:0,rows:[],residuals:[],overcommitted:[]},a=e.nodes(),c=e.edges();if(a.length+c.length+t.length>i)return{...s,complete:!1,work_limit_exceeded:!0};let d=(u,f)=>{s.complete=!1,s.residual_count+=1,s.residuals.length<o?s.residuals.push({id:u,reason:f}):s.truncated=!0},l=qn(a,t,r,d,n.signal);Un(e,l,n.signal);let g=Bn(a,l,n.signal);return Gn(g,l,n.signal),Hn(a,l,s,r,o,i,d,n.signal),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ccb7d865-8baa-5379-a810-7be494eadcb1")}catch{}})();function N(){return{nodes:0,isolated:0,degree_leq_one:0,semantic_nodes:0,without_semantic_edges:0,degree_histogram:{}}}function pt(e,t,n,r){let i={all:N(),active:N(),terminal:N()},o=new Map;for(let s of e.details){if(r?.throwIfAborted(),e.missingIdSet.has(s.id.toLowerCase())||s.status==="external")continue;let a=o.get(s.status)??N();o.set(s.status,a);let c=e.graph.incidentEdges(s.id),d=c.some(l=>n(l.kind));for(let l of[i.all,i[t(s.status)?"terminal":"active"],a]){l.nodes+=1,l.isolated+=+(c.length===0),c.length<=1&&(l.degree_leq_one+=1),d?l.semantic_nodes+=1:l.without_semantic_edges+=1;let g=String(c.length);l.degree_histogram[g]=(l.degree_histogram[g]??0)+1}}return{coverage_by_lifecycle:i,coverage_by_status:Object.fromEntries([...o].sort(([s],[a])=>s.localeCompare(a)))}}function gt(e){if(!J(e))return!1;let t=e;if(!["nodes","isolated","degree_leq_one","semantic_nodes","without_semantic_edges"].every(r=>Number.isSafeInteger(t[r])&&Number(t[r])>=0)||!J(t.degree_histogram))return!1;let n=Object.entries(t.degree_histogram);return n.every(([r,i])=>/^(0|[1-9]\d*)$/.test(r)&&Number.isSafeInteger(i)&&Number(i)>=0)&&n.reduce((r,[,i])=>r+Number(i),0)===t.nodes&&Number(t.isolated)<=Number(t.degree_leq_one)&&Number(t.degree_leq_one)<=Number(t.nodes)&&Number(t.semantic_nodes)+Number(t.without_semantic_edges)===t.nodes}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ht(e){for(let r of["ordering_acyclic","active_ordering_acyclic"])if(e[r]!==void 0&&typeof e[r]!="boolean")return!1;let t=e.coverage_by_lifecycle,n=e.coverage_by_status;return t===void 0&&n===void 0?!0:!J(t)||!J(n)?!1:["all","active","terminal"].every(r=>gt(t[r]))&&Object.values(n).every(gt)}function ft(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].sort().map(n=>{let r=Object.hasOwn(e,n)?e[n]:N(),i=Object.hasOwn(t,n)?t[n]:N(),o=Object.fromEntries([...new Set([...Object.keys(r.degree_histogram),...Object.keys(i.degree_histogram)])].sort().map(s=>[s,(i.degree_histogram[s]??0)-(r.degree_histogram[s]??0)]));return[n,{nodes:i.nodes-r.nodes,isolated:i.isolated-r.isolated,degree_leq_one:i.degree_leq_one-r.degree_leq_one,semantic_nodes:i.semantic_nodes-r.semantic_nodes,without_semantic_edges:i.without_semantic_edges-r.without_semantic_edges,degree_histogram:o}]}))}function mt(e,t){return!e.coverage_by_lifecycle||!t.coverage_by_lifecycle||!e.coverage_by_status||!t.coverage_by_status?{lifecycle_comparable:!1}:{lifecycle_comparable:!0,coverage_by_lifecycle:ft(e.coverage_by_lifecycle,t.coverage_by_lifecycle),coverage_by_status:ft(e.coverage_by_status,t.coverage_by_status)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="896e1553-b127-532f-ac39-e0d47f29eebc")}catch{}})();var A=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","hierarchy_cycle","legacy_hierarchy_cycle","hierarchy_cardinality_violation","legacy_hierarchy_cardinality_violation","hierarchy_direction_violation","legacy_hierarchy_direction_violation","duplicate_edge","legacy_duplicate_edge","duplicate_dependency_row","legacy_duplicate_dependency_row","stale_lifecycle_block","isolated_active_node","sparse_active_node"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="34b2e83e-f6a1-57e7-84ee-4ad83acb2e19")}catch{}})();var Kn=25,Vn="milestone",Wn="outcome milestone:",Yn=new Set(["discovered_from","incident_from","recurs_from","supersedes","verifies"]);function Q(e){return Yn.has(e)}var _t={error:0,warning:1,info:2};function yt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function R(e,t,n,r,i,o,s,a){let c=[...i].sort((d,l)=>d.localeCompare(l));return{code:e,severity:t,policy:n,message:r(c.length),count:c.length,sample:c.slice(0,o),sample_truncated:c.length>o,remediation:s,...a===void 0?{}:{evidence:[...a].sort((d,l)=>d.localeCompare(l)).slice(0,o)}}}function Xn(e,t){return e.cycles.map(n=>R(n.legacy_terminal?"legacy_hierarchy_cycle":"hierarchy_cycle",n.legacy_terminal?"info":"error","Structural hierarchy must be acyclic across scalar and registered dependency relationships.",r=>`${r} items participate in one hierarchy cycle.`,n.item_ids,t,n.legacy_terminal?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove or retype one exact hierarchy relation before continuing mutation."))}function bt(e,t,n){let r=e.cardinality_violations.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_cardinality_violation":"hierarchy_cardinality_violation",n?"info":"error","Every structural child must resolve to at most one logical parent across all hierarchy spellings.",i=>`${i} child item${i===1?"":"s"} resolve to multiple hierarchy parents.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove the exact surplus hierarchy rows so each child has one parent.",r.map(i=>`${i.child_id} <- ${i.parent_ids.join(", ")}`))]}function vt(e,t,n){let r=e.divergences.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_direction_violation":"hierarchy_direction_violation",n?"info":"error","Scalar parent metadata and dependency-backed hierarchy rows must resolve to the same logical parent.",i=>`${i} child item${i===1?"":"s"} have divergent hierarchy storage surfaces.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Align the scalar parent and exact dependency rows to one canonical parent.",r.map(i=>`${i.child_id}: scalar=${i.scalar_parent_id} dependencies=${i.dependency_parent_ids.join(",")}`))]}function Jn(e,t){let n=G(e);return n?[...Xn(n,t),...bt(n,t,!1),...bt(n,t,!0),...vt(n,t,!1),...vt(n,t,!0)]:[]}function Qn(e){let t=e.graph.registry(),n=new Map;for(let r of e.graph.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let[o,s]=(i.precedence??"source_before_target")==="target_before_source"?[r.target,r.source]:[r.source,r.target],a=n.get(o);a?a.push(s):n.set(o,[s])}for(let r of n.values())r.sort((i,o)=>i.localeCompare(o));return n}function kt(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function Zn(e,t,n,r){let i=n.get(e.node)??[];if(e.neighborIndex>=i.length)return!1;let o=i[e.neighborIndex];return e.neighborIndex+=1,r.indexes.has(o)?r.onStack.has(o)&&r.lowLinks.set(e.node,Math.min(r.lowLinks.get(e.node),r.indexes.get(o))):(kt(o,r),t.push({node:o,neighborIndex:0})),!0}function er(e,t,n,r){t.pop();let i=t.at(-1);if(i&&r.lowLinks.set(i.node,Math.min(r.lowLinks.get(i.node),r.lowLinks.get(e.node))),r.lowLinks.get(e.node)!==r.indexes.get(e.node))return;let o=[];for(;;){let s=r.stack.pop();if(r.onStack.delete(s),o.push(s),s===e.node)break}(o.length>1||o.length===1&&n.get(o[0])?.includes(o[0]))&&r.components.push(o.sort((s,a)=>s.localeCompare(a)))}function tr(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},n=[...e.keys()].sort((r,i)=>r.localeCompare(i));for(let r of n){if(t.indexes.has(r))continue;let i=[{node:r,neighborIndex:0}];for(kt(r,t);i.length>0;){let o=i.at(-1);Zn(o,i,e,t)||er(o,i,e,t)}}return t.components.sort((r,i)=>r[0].localeCompare(i[0]))}function ce(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function y(e,t,n,r,i,o,s,a){t.length!==0&&e.push(R(r,i,o,s,t,n,a))}function nr(e,t,n){let r=[],i=[...e.dangling.active,...e.dangling.legacy_terminal].filter(o=>!o.no_active_blocker_sentinel);return y(r,i.filter(o=>!t(o.holder_status)).map(ce),n,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",o=>`${o} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),y(r,i.filter(o=>t(o.holder_status)).map(ce),n,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",o=>`${o} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),y(r,e.dangling.no_active_blocker_sentinels.map(ce),n,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",o=>`${o} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),r}function le(e,t){let n=t.get(e);return n?!n.terminal:!0}function It(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function rr(e,t){let n=[],r=[];for(let o of e.orderingContradictions??[])(o.legacy_terminal?r:n).push(It(o));let i=[];return y(i,n,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",o=>`${o} active scalar-versus-structured ordering contradiction(s)`,"Remove the structured dependency row that points the holder before its scalar blocker, or replace both representations with one unambiguous ordering edge."),y(i,r,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",o=>`${o} terminal scalar-versus-structured ordering contradiction(s)`,"Remove the contradictory blocks dependency row in a dedicated changelog-safe closed-item batch; preserve the scalar blocker as the historical precedence record."),i}function ir(e,t,n,r){let i=[],o=Qn(e);for(let c of tr(o)){let d=c.some(u=>le(u,t)),l=new Set(c.map(u=>u.toLowerCase())),g=(e.orderingContradictions??[]).filter(u=>l.has(u.holder_id.toLowerCase())&&l.has(u.target_id.toLowerCase())).map(It);i.push(d?R("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",u=>`execution-order cycle across ${u} item(s)`,c,r,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",g.length===0?void 0:g):R("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",u=>`terminal-only execution-order cycle across ${u} item(s)`,c,r,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc.",g.length===0?void 0:g))}let s=new Map;for(let[c,d]of o)for(let l of d){let g=s.get(l);g?g.push(c):s.set(l,[c])}let a=[...t.values()].filter(c=>!c.missing&&!c.terminal&&n(c.status)&&!(s.get(c.id)??[]).some(d=>{let l=t.get(d);return l===void 0||!l.terminal})).map(c=>c.id);return y(i,a,r,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",c=>`${c} status-blocked item(s) with no open blocker edge`,'Add a local blocker edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status.'),i}function Z(e){let t=e.edges.map(n=>n.kind).sort((n,r)=>n.localeCompare(r));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function ue(e){let t=e.graph.registry(),n=new Map;for(let i of e.graph.edges()){let o=t.require(i.kind);if(!W(o))continue;let s=ae(i,o);if(s.from===s.to)continue;let a=`${Y(o)}::${s.from}::${s.to}`,c=n.get(a);c?c.edges.push(i):n.set(a,{...s,edges:[i]})}let r=[...n.values()].filter(i=>i.edges.length>=2);for(let i of r)i.edges.sort((o,s)=>o.kind.localeCompare(s.kind));return r.sort((i,o)=>i.from.localeCompare(o.from)||i.to.localeCompare(o.to))}function or(e,t,n){let r=[],i=[];for(let s of ue(e))(le(s.from,t)||le(s.to,t)?r:i).push(Z(s));let o=[];return y(o,r,n,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",s=>`${s} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),y(o,i,n,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",s=>`${s} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),o}function sr(e,t){let n=[],r=[];for(let o of e.duplicateRows??[])(o.legacy_terminal?r:n).push(`${o.holder_id} -> ${o.target_id} (${o.kind} x${o.occurrences})`);let i=[];return y(i,n,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",o=>`${o} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),y(i,r,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",o=>`${o} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function ar(e,t){let n=new Map,r={source_to_target:[],target_to_source:[],both:[]};for(let s of e.graph.registry().list())s.outcomeTraversal!==void 0&&r[s.outcomeTraversal].push(s.kind);let i={source_to_target:r.source_to_target.join(","),target_to_source:r.target_to_source.join(","),both:r.both.join(",")},o=(s,a)=>{let c=n.get(a)??new Set;c.add(s),n.set(a,c)};for(let s of e.graph.edges()){t?.throwIfAborted();let a=e.graph.registry().require(s.kind);(a.outcomeTraversal==="source_to_target"||a.outcomeTraversal==="both")&&o(s.source,s.target),(a.outcomeTraversal==="target_to_source"||a.outcomeTraversal==="both")&&o(s.target,s.source)}return{basis:i,reverse:n}}function cr(e,t,n){let r=new Set(e),i=[...e].sort();for(let o=0;o<i.length;o+=1){n?.throwIfAborted();for(let s of[...t.get(i[o])??[]].sort())r.has(s)||(r.add(s),i.push(s))}return r}function dr(e,t,n,r){let i=0,o=0,s=0,a=0;for(let f of e.values())if(r?.throwIfAborted(),!t.has(f.id)&&!(f.missing||f.status==="external")){if(f.terminal){s+=1,n.has(f.id)&&(a+=1);continue}n.has(f.id)?i+=1:o+=1}let c=i+o,d=s-a,l=i+a,g=o+d,u=l+g;return{active_outcome_reachable_nodes:i,active_outcome_unreachable_nodes:o,active_outcome_reachability_basis_points:c===0?0:Math.floor(i*1e4/c),terminal_nodes:s,terminal_outcome_reachable_nodes:a,terminal_outcome_unreachable_nodes:d,terminal_outcome_reachability_basis_points:s===0?0:Math.floor(a*1e4/s),outcome_reachable_nodes:l,outcome_unreachable_nodes:g,outcome_reachability_basis_points:u===0?0:Math.floor(l*1e4/u)}}function lr(e,t,n){let r=new Set(e.details.filter(a=>a.type?.toLowerCase()===Vn&&a.title.trim().toLowerCase().startsWith(Wn)).map(a=>a.id)),{basis:i,reverse:o}=ar(e,n),s=cr(r,o,n);return{outcome_nodes:r.size,outcome_reachability_basis:i,...dr(t,r,s,n)}}function ur(e,t,n,r,i){e.active+=1;let o=t.type??"(untyped)",s=e.byType.get(o);s||(s={active:0,isolated:0,degree_leq_one:0},e.byType.set(o,s)),s.active+=1,!(n>1)&&(e.degreeLeqOne+=1,s.degree_leq_one+=1,n===0&&(e.isolated+=1,s.isolated+=1),!(r.has(t.id.toLowerCase())||i.has(o.toLowerCase()))&&(n===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function gr(e,t,n,r,i,o,s){let a={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let h of e.graph.nodes()){s?.throwIfAborted();let _=t.get(h);if(_){if(_.missing){a.missing+=1;continue}_.terminal||ur(a,_,e.graph.incidentEdges(h).length,n,r)}}let{isolates:c,sparse:d}=a,l=[];y(l,c,i,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",h=>`${h} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),y(l,d,i,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",h=>`${h} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");let g=e.graph.edges().length,u=T(e.graph,{signal:s}).value,f=new Set(u.map(({edge:h})=>`${h.source.toLowerCase()}\0${h.target.toLowerCase()}\0${h.kind}`));for(let h of e.orderingContradictions??[])f.add(`${h.holder_id.toLowerCase()}\0${h.target_id.toLowerCase()}\0${h.dependency_kind}`);let p=Object.fromEntries(Object.entries(o).sort(([h],[_])=>h.localeCompare(_))),m=Object.entries(p).reduce((h,[_,E])=>h+(Q(_)?E:0),0),b=X(e.graph,{signal:s}).value,v=lr(e,t,s);return{findings:l,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(h=>h.status!=="missing"&&h.status!=="external").length,edges:g,informative_edges:g-f.size,redundant_edges:u.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:p,edge_share_by_kind:Object.fromEntries(Object.entries(p).map(([h,_])=>[h,_/g])),semantic_edges:m,semantic_edge_share:g===0?0:m/g,active_nodes:a.active,missing_nodes:a.missing,isolated_active_nodes:a.isolated,degree_leq_one_active_nodes:a.degreeLeqOne,coverage_by_type:Object.fromEntries([...a.byType.entries()].sort(([h],[_])=>h<_?-1:1)),articulation_points:b.articulationPoints.length,bridge_edges:b.bridges.length,...v,finding_subjects_by_code:Object.fromEntries(A.map(h=>[h,0]))}}}function ee(e,t={}){let n=t.isTerminal??(u=>u==="closed"||u==="canceled"),r=t.isBlocked??(u=>u==="blocked"),i=t.maxSampleSize??Kn;if(!Number.isInteger(i)||i<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let o=yt(t.exemptIsolates),s=yt(t.isolateExemptTypes),a=new Map(e.details.map(u=>[u.id,{id:u.id,status:u.status,missing:e.missingIdSet.has(u.id.toLowerCase()),terminal:n(u.status),...u.type===void 0?{}:{type:u.type}}]));t.signal?.throwIfAborted();let c={};for(let u of e.graph.edges())c[u.kind]=(c[u.kind]??0)+1;let d=nr(e,n,i);d.push(...Jn(e,i)),t.signal?.throwIfAborted(),d.push(...rr(e,i)),t.signal?.throwIfAborted(),d.push(...ir(e,a,r,i)),t.signal?.throwIfAborted(),d.push(...or(e,a,i),...sr(e,i)),t.signal?.throwIfAborted();let l=gr(e,a,o,s,i,c,t.signal);d.push(...l.findings),d.sort((u,f)=>_t[u.severity]-_t[f.severity]||u.code.localeCompare(f.code)||u.sample[0].localeCompare(f.sample[0]));let g=l.profile.finding_subjects_by_code;for(let u of d)g[u.code]+=u.count;return{findings:d,profile:{...l.profile,...pt(e,n,Q,t.signal),ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"||u.code==="legacy_ordering_cycle"),active_ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"),finding_subjects_by_code:g}}}function de(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),r={};for(let i of n){let o=(t[i]??0)-(e[i]??0);o!==0&&(r[i]=o)}return r}function wt(e){return e.profile.coverage_by_type??{}}function fr(e,t){let n={},r=wt(e),i=wt(t),o=[...new Set([...Object.keys(r),...Object.keys(i)])].sort();for(let s of o){let a=Object.assign({active:0,isolated:0,degree_leq_one:0},r[s]),c=Object.assign({active:0,isolated:0,degree_leq_one:0},i[s]),d={active:c.active-a.active,isolated:c.isolated-a.isolated,degree_leq_one:c.degree_leq_one-a.degree_leq_one};Object.values(d).some(l=>l!==0)&&(n[s]=d)}return n}function xt(e,t){let n=fr(e,t),{edge_share_by_kind:r={},semantic_edges:i=0,semantic_edge_share:o=0}=e.profile,{edge_share_by_kind:s={},semantic_edges:a=0,semantic_edge_share:c=0}=t.profile,d=e.profile.recorded_nodes??e.profile.nodes,l=t.profile.recorded_nodes??t.profile.nodes,g=e.profile.informative_edges??e.profile.edges,u=t.profile.informative_edges??t.profile.edges,f=e.profile.redundant_edges??0,p=t.profile.redundant_edges??0,m=e.profile.ordering_contradiction_edges??0,b=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:de(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:l-d,edges:t.profile.edges-e.profile.edges,informative_edges:u-g,redundant_edges:p-f,ordering_contradiction_edges:b-m,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:de(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:de(r,s),semantic_edges:a-i,semantic_edge_share:c-o,coverage_by_type:n,...mt(e.profile,t.profile)}}}import Et from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5089f2d-3fc5-5843-95ab-ba3dd2ab9582")}catch{}})();var St=2,ge=500,pr=64,hr="graph-durable-cache";function Ct(e){return De(e,hr,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function F(e){return Et.join(e,"runtime","graph-cache.json")}function Dt(e){return Et.join(e,"runtime","graph-audit-baseline.json")}function fe(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==St||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function pe(e,t){let n=await j(F(e)),r=fe(n),i=r?.fingerprint===t;return{exists:n!==null,fresh:i,results:i?r.results:{}}}async function he(e,t,n,r,i){let o=await Ct(e);try{let s=fe(await j(F(e))),a=s?.fingerprint===t?s.results:{};delete a[r],a[r]=i;let c=Object.keys(a);for(let d of c.slice(0,Math.max(0,c.length-pr)))delete a[d];await re(F(e),JSON.stringify({version:St,fingerprint:t,saved_at:new Date().toISOString(),results:a})),n.results=a}finally{await o()}}async function me(e){let t=await Ct(e);try{await Ie(F(e))}finally{await t()}}async function Tt(e,t){let n=F(e),r=await j(n),i=fe(r);return i===void 0?{exists:r!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:i.fingerprint===t,entry_count:Object.keys(i.results).length,fingerprint:i.fingerprint.slice(0,12),saved_at:i.saved_at,bytes:Buffer.byteLength(r,"utf8")}}function _e(e,t){return t||e>=ge}function te(e){return O(e)&&Object.values(e).every(x)}function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e){return Number.isInteger(e)&&Number(e)>=0}function Nt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function L(e,t){return e===void 0||t(e)}function mr(e){return O(e)&&Object.values(e).every(Nt)}function _r(e){return O(e)?Object.values(e).every(t=>O(t)&&[t.active,t.isolated,t.degree_leq_one].every(x)):!1}function yr(e,t,n){let r=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],i=r.filter(s=>e[s]!==void 0).length;if(i!==0&&i!==r.length||!r.every(s=>L(e[s],x)))return;let o={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??n,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return o.recorded_nodes<=t&&o.informative_edges<=n&&o.redundant_edges<=n&&o.ordering_contradiction_edges<=n?o:void 0}function br(e,t,n){let r=[...t,...n,"finding_subjects_by_code"],i=r.filter(o=>e[o]!==void 0).length;return i!==0&&i!==r.length?!1:t.every(o=>L(e[o],x))&&n.every(o=>L(e[o],x)&&(e[o]===void 0||Number(e[o])<=1e4))&&L(e.finding_subjects_by_code,te)}function vr(e,t,n,r){let i=yr(e,n,r);if(i===void 0)return;let o=["articulation_points","bridge_edges","outcome_nodes","active_outcome_reachable_nodes","active_outcome_unreachable_nodes","terminal_nodes","terminal_outcome_reachable_nodes","terminal_outcome_unreachable_nodes","outcome_reachable_nodes","outcome_unreachable_nodes"],s=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!br(e,o,s)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let a=te(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...i,...Object.fromEntries(o.map(c=>[c,e[c]??0])),...Object.fromEntries(s.map(c=>[c,e[c]??0])),finding_subjects_by_code:Object.fromEntries(A.map(c=>[c,a[c]??t[c]??0]))}}function wr(e,t,n,r,i){let o=[n,r,i],s=o.filter(d=>d!==void 0).length;if(s===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(s!==o.length||!mr(n)||!x(r)||!Nt(i))return;let a=Object.entries(t);if(a.reduce((d,[,l])=>d+l,0)!==e||Object.keys(n).length!==a.length||a.some(([d,l])=>n[d]!==(e===0?0:l/e)))return;let c=a.reduce((d,[l,g])=>d+(Q(l)?g:0),0);if(!(r!==c||i!==(e===0?0:c/e)))return{edge_share_by_kind:n,semantic_edges:r,semantic_edge_share:i}}function kr(e){if(e!==null)try{let t=JSON.parse(e);if(!O(t))return;let n=t,r=n.profile;if(typeof n.saved_at!="string"||typeof n.fingerprint!="string")return;let i=n.affected_subjects_by_code;if(!te(i)||!O(r)||!ht(r)||![r.nodes,r.edges,r.active_nodes,r.missing_nodes,r.isolated_active_nodes,r.degree_leq_one_active_nodes].every(x)||!te(r.edges_by_kind)||!L(r.coverage_by_type,_r))return;let o=wr(r.edges,r.edges_by_kind,r.edge_share_by_kind,r.semantic_edges,r.semantic_edge_share);if(o===void 0)return;let s=vr(r,i,r.nodes,r.edges);if(s===void 0)return;let{coverage_by_type:a={}}=r;return{...n,profile:{...r,...o,...s,coverage_by_type:a}}}catch{return}}async function At(e){return kr(await j(Dt(e)))}async function Rt(e,t){await re(Dt(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="253f392d-4e91-57ec-b656-6134583d57e5")}catch{}})();var Ir={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge."},legacy_ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history."},hierarchy_cycle:{op:"investigate",confidence:"low",rationale:"Cut or retype one exact structural relation in the cycle; the planner preserves every evidence row because intent determines the correct parent."},legacy_hierarchy_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only hierarchy cycles are historical debt; waive them unless an explicit closed-history repair is approved."},hierarchy_cardinality_violation:{op:"investigate",confidence:"medium",rationale:"Choose the canonical parent and remove or retype the exact surplus hierarchy rows; the planner cannot infer ownership intent."},legacy_hierarchy_cardinality_violation:{op:"waive",confidence:"high",rationale:"Multiple parents confined to terminal items are historical debt; waive them unless a dedicated history repair is approved."},hierarchy_direction_violation:{op:"investigate",confidence:"medium",rationale:"Align the scalar parent and dependency-backed hierarchy rows to the intended canonical parent."},legacy_hierarchy_direction_violation:{op:"waive",confidence:"high",rationale:"Divergent hierarchy storage confined to terminal items is historical debt; waive it unless a dedicated history repair is approved."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:`Add a local ordering edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status; only the holder's owner knows which is true.`},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function Ot(e){return`${e.source} -${e.kind}-> ${e.target}`}function xr(e){let[t,...n]=e.edges;return n.map(r=>({op:"remove",code:"duplicate_edge",subject:Ot(r),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${Ot(t)}`,`group: ${Z(e)}`],confidence:"high"}))}function Er(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(r=>xr(t.get(r)));let n=Ir[e.code];return e.sample.map(r=>({op:n.op,code:e.code,subject:r,rationale:n.rationale,evidence:[e.policy],confidence:n.confidence}))}function jt(e,t={}){let{redundancyLimit:n,...r}=t,i=ee(e,r),o=new Map(ue(e).map(d=>[Z(d),d])),s=i.findings.flatMap(d=>Er(d,o)),a=i.findings.some(d=>d.sample_truncated);t.signal?.throwIfAborted();let c=T(e.graph,{limit:n??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let d of c.value)s.push({op:"remove",code:"redundant_edge",subject:`${d.edge.source} -> ${d.edge.target} (${d.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${d.witness.join(" -> ")}`],confidence:"medium"});return a=a||c.meta.truncated,{steps:s,report:i,truncated:a,cost:{visitedNodes:c.meta.visitedNodes,inspectedEdges:c.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="66df3949-0caf-5f01-8cec-3bba3d1e6111")}catch{}})();var Ft=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]);function Mt(e,t,n){let r=e;if(t&&e.subcommand==="audit"){let{nodes:i,recorded_nodes:o,edges:s,active_nodes:a,terminal_nodes:c,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:g,coverage_by_lifecycle:u}=e.profile,f=Object.fromEntries(Object.entries(u).map(([p,m])=>{let{degree_histogram:b,...v}=m;return[p,v]}));r={...e,profile:{nodes:i,recorded_nodes:o,edges:s,active_nodes:a,terminal_nodes:c,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:g,coverage_by_lifecycle:f}}}return{...r,projection:{mode:t?"summary":"full",declared_field_groups:n===void 0?[]:[{name:n,restore_with:"--full"}],included_field_groups:n===void 0||t?[]:[n]}}}function Sr(e,t,n,r){return{assembly:t,...n===void 0?{}:{kinds:n},maxDepth:Ue(r.maxDepth),limit:e==="impact"&&Number(r.limit)===0?0:$(r.limit,"limit")??(r.full===!0?Number.MAX_SAFE_INTEGER:I.rows),after:r.after?.trim()||void 0,direction:Be(r.direction),maxPaths:$(r.maxPaths,"max-paths"),sample:$(r.sample,"sample")??I.samples,exemptIsolates:Pt(r.exemptIsolate),exemptIsolateTypes:Pt(r.exemptIsolateType),saveBaseline:r.saveBaseline===!0,summary:r.summary===!0,unbounded:r.full===!0}}function Pt(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function Cr(e,t,n){let r=e.trim().toLowerCase();if(!ie.includes(r))throw Oe({command_path:"graph",token:r||"<empty>",allowed:ie});let i=r;if(Ft.has(i)&&!t?.trim())throw new k(`graph ${i} requires an item id.`,w.USAGE);if(i==="paths"&&!n?.trim())throw new k("graph paths requires a source and a target item id.",w.USAGE);return i}function ye(e){throw e instanceof TypeError?new k(e.message,w.USAGE):e}function be(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function Lt(e,t){let n=t.trim().toLowerCase();for(let r of e.details)if(r.id.trim().toLowerCase()===n&&!e.missingIdSet.has(r.id.toLowerCase()))return r.id;throw new k(`Item ${t} not found`,w.NOT_FOUND)}function Dr(e,t,n){let r={ancestors:Qe,descendants:Ze,predecessors:et,successors:tt}[e],i;try{i=r(n.assembly.graph,t,{...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},limit:n.limit,...n.after===void 0?{}:{after:n.after}})}catch(s){ye(s)}let o=be(i.meta);return{subcommand:e,root:t,count:i.value.length,...o,...i.meta.nextCursor===void 0?{}:{next_cursor:i.meta.nextCursor},...n.summary?{}:{ids:i.value}}}function Tr(e,t,n){let r=nt(n.assembly.graph,e,t,{direction:n.direction,...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.maxPaths===void 0?{}:{maxPaths:n.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:n.direction,count:r.value.length,...be(r.meta),...n.summary?{}:{paths:r.value.map(i=>({nodes:i.nodes,kinds:i.edges.map(o=>o.kind),length:i.length}))}}}function Nr(e,t){let n;try{n=U(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit},...t.after===void 0?{}:{after:t.after}})}catch(r){ye(r)}return{subcommand:"impact",root:e,direction:t.direction,count:n.affected.length,truncated:n.truncated,...n.nextCursor===void 0?{}:{next_cursor:n.nextCursor},cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...t.summary?{}:{affected:n.affected}}}function Ar(e,t,n){return{acyclic:e.acyclic,ordered_node_count:e.order.length,layer_count:e.layers.length,frontier_count:e.frontier.length,critical_path_length:e.criticalPathLength,cycle_count:e.cycles.length,...t?{}:{frontier:e.frontier.slice(0,n),critical_path:e.criticalPath.slice(0,n),cycles:e.cycles.slice(0,n)}}}function Rr(e,t,n){return{component_count:e.components.length,largest_component_size:e.components[0]?.length??0,orphan_count:e.orphans.length,...t?{}:{orphans:e.orphans.slice(0,n),hubs:e.hubs.slice(0,n)}}}function Or(e,t,n){let r=0,i=0,o=0;for(let s of e.cycles)r+=Number(s.legacy_terminal);for(let s of e.cardinality_violations)i+=Number(s.legacy_terminal);for(let s of e.divergences)o+=Number(s.legacy_terminal);return{acyclic:e.cycles.length===0,relation_count:e.relations.length,cycle_count:e.cycles.length,active_cycle_count:e.cycles.length-r,legacy_cycle_count:r,cardinality_violation_count:e.cardinality_violations.length,active_cardinality_violation_count:e.cardinality_violations.length-i,legacy_cardinality_violation_count:i,parent_divergence_count:e.divergences.length,active_parent_divergence_count:e.divergences.length-o,legacy_parent_divergence_count:o,...t?{}:{cycles:e.cycles.slice(0,n).map(s=>s.item_ids)}}}function jr(e){let t=e.assembly.graph,n=e.limit,r=B(t,{registry:t.registry()}),i=Ye(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:n,execution:Ar(r,e.summary,n),knowledge:Rr(i,e.summary,n),hierarchy:Or(G(e.assembly),e.summary,n)}}function Mr(e,t){let n=ee(e.assembly,{isTerminal:t,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),r={},i={},o={},s={};for(let d of n.findings)r[d.severity]=(r[d.severity]??0)+1,i[d.code]=(i[d.code]??0)+1,o[d.severity]=(o[d.severity]??0)+d.count,s[d.code]=(s[d.code]??0)+d.count;let{finding_subjects_by_code:a,...c}=n.profile;return{subcommand:"audit",truncated:n.findings.length>e.limit,finding_count:n.findings.length,findings_by_severity:r,findings_by_code:i,affected_subjects_by_severity:o,affected_subjects_by_code:s,profile:e.summary?c:n.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:n.findings.slice(0,e.limit)}}}function Pr(e){let t=e.limit,n={};e.kinds!==void 0&&(n.kinds=e.kinds);let r=it(e.assembly.graph,n),i=r.value;return{subcommand:"communities",community_count:i.communities.length,largest_community_size:i.communities[0]?.size??0,iterations:i.iterations,converged:i.converged,truncated:!i.converged||i.communities.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{communities:i.communities.slice(0,t).map(o=>({representative:o.representative,size:o.size,members:o.members.slice(0,t)}))}}}function Lr(e){let t;try{t=T(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},limit:e.limit})}catch(n){ye(n)}return{subcommand:"redundancy",redundant_count:t.value.length,...be(t.meta),...e.summary?{}:{redundant:t.value.map(n=>({source:n.edge.source,target:n.edge.target,kind:n.edge.kind,witness:n.witness}))}}}function Fr(e,t){let n=t.limit,r=ot(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),i=r.value.rows.filter(o=>o.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:r.value.reachableCount,bottleneck_count:i.length,truncated:r.meta.truncated||i.length>n,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...t.summary?{}:{bottlenecks:i.slice(0,n).map(o=>({id:o.id,idom:o.idom,dominated_count:o.dominatedCount}))}}}function Gr(e){let t=e.limit,n=lt(e.assembly.graph),r=n.rows.filter(i=>i.critical).length;return{subcommand:"slack",acyclic:n.acyclic,makespan:n.makespan,scheduled_count:n.scheduledCount,critical_count:r,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,truncated:n.rows.length>t,...e.summary?{}:{critical_path:n.criticalPath.slice(0,t),rows:n.rows.slice(0,t).map(i=>({id:i.id,earliest_start:i.earliestStart,latest_start:i.latestStart,slack:i.slack,critical:i.critical}))}}}function $r(e){let t=e.limit,n=dt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),r=n.value;return{subcommand:"centrality",node_count:r.nodeCount,edge_count:r.edgeCount,edge_basis:"simple_undirected",truncated:r.rows.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{rows:r.rows.slice(0,t).map(i=>({id:i.id,degree:i.degree,in_degree:i.inDegree,out_degree:i.outDegree,betweenness:i.betweenness,closeness:i.closeness}))}}}function qr(e){let t=e.limit,n=X(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:r,bridges:i}=n.value;return{subcommand:"articulation",articulation_count:r.length,bridge_count:i.length,truncated:r.length>t||i.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{articulation_points:r.slice(0,t),bridges:i.slice(0,t)}}}function Ur(e,t){let n=e.limit,r=jt(e.assembly,{isTerminal:t,redundancyLimit:n,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),i={},o={};for(let s of r.steps)i[s.op]=(i[s.op]??0)+1,o[s.code]=(o[s.code]??0)+1;return{subcommand:"plan",step_count:r.steps.length,steps_by_op:i,steps_by_code:o,finding_count:r.report.findings.length,truncated:r.truncated||r.steps.length>n,cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...e.summary?{}:{steps:r.steps.slice(0,n)}}}function Gt(e,t,n,r){return JSON.stringify({projection_version:2,subcommand:e,root:t??null,target:n??null,kinds:r.kinds??null,maxDepth:r.maxDepth??null,limit:r.limit,after:r.after??null,direction:r.direction,maxPaths:r.maxPaths??null,sample:r.sample,exemptIsolates:[...new Set(r.exemptIsolates.map(i=>i.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(r.exemptIsolateTypes.map(i=>i.toLowerCase()))].sort(),summary:r.summary,unbounded:r.unbounded})}function $t(e,t,n,r,i){return e==="analyze"?jr(r):e==="audit"?Mr(r,i):e==="plan"?Ur(r,i):e==="communities"?Pr(r):e==="redundancy"?Lr(r):e==="dominators"?Fr(t,r):e==="slack"?Gr(r):e==="centrality"?$r(r):e==="articulation"?qr(r):e==="paths"?Tr(t,n,r):e==="impact"?Nr(t,r):Dr(e,t,r)}function Br(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new k("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new k("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new k("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new k("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(t.full===!0&&t.limit!==void 0)throw new k(`graph ${e} accepts either --full or --limit, not both.`,w.USAGE)}async function zr(e,t,n,r,i,o){let s="status";if(o.clear===!0&&(await me(e),s="cleared"),o.rebuild===!0){await me(e);let c=await pe(e,t),d={assembly:n.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,limit:I.rows,sample:I.samples,unbounded:!1};for(let l of["analyze","audit"])await he(e,t,c,Gt(l,void 0,void 0,d),$t(l,void 0,void 0,d,i));s="rebuilt"}let a=await Tt(e,t);return{subcommand:"index",action:s,state:a.exists?a.fresh?"fresh":"stale":"absent",entry_count:a.entry_count,item_count:r,min_items_threshold:ge,persist_enabled:_e(r,a.exists),current_fingerprint:t.slice(0,12),...a.saved_at===void 0?{}:{saved_at:a.saved_at},...a.bytes===void 0?{}:{bytes:a.bytes}}}async function Hr(e,t,n,r){let i={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:n.affected_subjects_by_code,profile:{...n.profile,finding_subjects_by_code:Object.fromEntries(A.map(s=>[s,n.affected_subjects_by_code[s]??0]))}},o=await At(e);return r&&await Rt(e,i),o===void 0?n:{...n,baseline:xt(o,i)}}async function Kr(e,t,n,r,i){try{await he(e,t,n,r,i)}catch{}}function Vr(e,t,n,r){if(e.subcommand!=="slack")return;let i=new Set(t.assembly.details.filter(u=>r(u.status)).map(u=>u.id)),o=t.assembly.graph,s=new ke(o.nodes().filter(u=>!i.has(u)),o.edges().filter(u=>!i.has(u.source)&&!i.has(u.target)),o.registry()),a=ut(s,n.filter(u=>!i.has(u.id)),{now:Ce(),limit:t.limit}),{rows:c,residuals:d,overcommitted:l,...g}=a;e.deadline_schedule={population:"active",...g,...t.summary?{}:{rows:c,residuals:d,overcommitted:l}}}async function ro(e,t,n,r,i){let o=Cr(e,t,n);Ne(r.summary===!0,r.full===!0,"--summary");let s=Ee(process.cwd(),i.path);await Pe(s);let a=await Me(s),c=xe(a,Te()),d=await Le(s,a.item_format,c.type_to_folder,void 0,a.schema),l=Se(a.schema),g=qt=>je(qt,l);Br(o,r);let u=Fe(),f=ze(r.kind,u),p=qe().lookup(s,$e(d,g,u),()=>Ge(d,g,u)),m=Sr(o,p.assembly,f,r);if(o==="index")return Mt(await zr(s,p.fingerprint,m,d.length,g,r),!1);let b=Ft.has(o)?Lt(m.assembly,t):void 0,v=o==="paths"?Lt(m.assembly,n):void 0,h=Gt(o,b,v,m),_=await pe(s,p.fingerprint),E=_.results[h],S=p.memoize(h,()=>E!==void 0?structuredClone(E):$t(o,b,v,m,g)),ve=_e(d.length,_.exists);!S.reused&&E===void 0&&ve&&await Kr(s,p.fingerprint,_,h,S.value);let ne=S.value.subcommand==="audit"?await Hr(s,p.fingerprint,S.value,m.saveBaseline):S.value;return ne.cache={fingerprint:p.fingerprint.slice(0,12),assembly:p.assemblyReused?"hit":"miss",result:S.reused?"hit":"miss",durable:E!==void 0?"hit":ve?"miss":"off"},Vr(ne,m,d,g),Mt(ne,m.summary,"result_rows")}export{B as a,U as b,Ye as c,Xr as d,Qe as e,Ze as f,et as g,tt as h,nt as i,V as j,it as k,T as l,ot as m,dt as n,X as o,lt as p,ut as q,tr as r,It as s,Z as t,ue as u,ee as v,xt as w,St as x,ge as y,F as z,Dt as A,pe as B,he as C,me as D,Tt as E,_e as F,At as G,Rt as H,jt as I,Cr as J,ro as K};
|
|
2
|
-
//# sourceMappingURL=chunk-KWZLY35A.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as q,s as V}from"./chunk-KWZLY35A.js";import{d as m,j as M,l as k}from"./chunk-QJ647CQE.js";import{da as D,ga as j,ja as z}from"./chunk-J7ESCE7M.js";import{Ia as O,Jc as N,T as x,Y as g}from"./chunk-3WVMEA2A.js";import{A as C,E as _,I as L,z as S}from"./chunk-PDXSMSO5.js";import{constants as p}from"node:fs";import{lstat as A,mkdir as I,open as P}from"node:fs/promises";import h from"node:path";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function E(i,e){if(typeof i!="string"||i.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return i.trim()}function $(i,e){let t=e.require(i.kind),n=t.direction==="undirected"?[i.source,i.target].sort().join("\0"):`${i.source}\0${i.target}`;return`${t.kind}\0${n}`}function Q(i){return Object.freeze({...i,...i.payload===void 0?{}:{payload:Object.freeze(structuredClone(i.payload))}})}function U(i,e,t,n){let r=t.require(i.kind),o=n.outgoingOne.get(`${r.kind}\0${i.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=n.incomingOne.get(`${r.kind}\0${i.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=$(i,t),a=n.identities.get(c);if(a!==void 0&&a!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function Y(i){let e=new Map;for(let t of i)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function X(i,e,t){if(i.expectedVersion!==void 0&&i.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${i.expectedVersion}, current ${e}`);let n=E(i.eventId,"eventId");if(t.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(i.action!=="add"&&i.action!=="remove"&&i.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${i.action}`);if(!Number.isFinite(Date.parse(i.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:E(i.relationshipId,"relationshipId"),author:E(i.author,"author"),timestamp:new Date(i.timestamp).toISOString()}}function Z(i,e,t,n,r,o){let s=t.has(e);if(i.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(i.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(i.action==="remove")return;if(!i.edge)throw new TypeError(`Relationship ${i.action} event requires an edge`);let c=typeof i.edge.source=="string"?i.edge.source.trim():"",a=typeof i.edge.target=="string"?i.edge.target.trim():"";if(!n.has(c)||!n.has(a))throw new TypeError(`Relationship endpoint not found: ${c} -> ${a}`);let d=new g([c,a],[i.edge],r).edges()[0];return U(d,e,r,o),Q(d)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#i=t.registry??x()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,n=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<n;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,n)))}project(e,t,n={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...n,batchSize:256}))for(let a of c)r=t(r,a),o+=1,s=a;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let n=this.#i.require(t.kind);this.#r.identities.set($(t,this.#i),e),n.outgoing==="one"&&this.#r.outgoingOne.set(`${n.kind}\0${t.source}`,e),n.incoming==="one"&&this.#r.incomingOne.set(`${n.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete($(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=X(e,this.version,this.#o),n=this.#e.get(t.relationshipId),r=Z(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),n&&this.#a(n),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let n=Y(t),r=new g(this.#t,n.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=D("relationship-events",{order:"append-sequence"}),n=e.cursor===void 0?this.version:Number(j(e.cursor,t).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=z(this.#n.slice(0,n),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(n)});return{version:n,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},ee="relationship-event-store",W=p.O_NOFOLLOW;function w(i){return N(i,ee,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(i,e="relationships/events.jsonl"){let t=h.resolve(i),n=h.resolve(t,e),r=h.relative(t,n);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await I(t,{recursive:!0}),(await A(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=t;for(let s of r.split(h.sep)){o=h.join(o,s);try{if((await A(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(_(c))break;throw c}}return n}async function y(i,e,t){let n=new T(e,{registry:t}),r,o;try{o=await P(i,p.O_RDONLY|W),r=await o.readFile("utf8")}catch(c){if(_(c))return{log:n,raw:""};throw c}finally{await o?.close()}let s=r.split(`
|
|
2
|
-
`);for(let c=0;c<s.length;c+=1){let a=s[c].trim();if(!a)continue;let d;try{d=JSON.parse(a)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(d.sequence!==n.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);n.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:n.version})}return{log:n,raw:r}}function te(i,e,t,n){let r=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new g(t,[e.edge],n).edges()[0]),i.eventId===e.eventId.trim()&&i.relationshipId===e.relationshipId.trim()&&i.action===e.action&&i.author===e.author.trim()&&Number.isFinite(r)&&i.timestamp===new Date(r).toISOString()&&i.reason===(e.reason?.trim()||void 0)&&O(i.edge)===O(o)}var F=class i{#t;#i;#n;#o;#e;constructor(e,t,n,r){this.#t=e.pmRoot,this.#i=t,this.#n=e.registry,this.#o=n,this.#e=r}static async open(e){let t=Object.freeze([...e.nodes]),n=await f(e.pmRoot,e.relativePath),r=await w(e.pmRoot);try{await f(e.pmRoot,n);let{log:o}=await y(n,t,e.registry);return new i(e,t,n,o)}finally{await r()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(e){let t=await w(this.#t);try{let n=await f(this.#t,this.#o),{log:r}=await y(n,this.#i,this.#n),o=r.append(e);await I(h.dirname(n),{recursive:!0}),await f(this.#t,n);let s=await P(n,p.O_APPEND|p.O_CREAT|p.O_WRONLY|W);try{await s.appendFile(`${JSON.stringify(o)}
|
|
3
|
-
`,"utf8")}finally{await s.close()}return this.#e=r,o}finally{await t()}}async appendBatch(e,t={}){let n=await w(this.#t);try{let r=await f(this.#t,this.#o),{log:o,raw:s}=await y(r,this.#i,this.#n),c=o.version,a=new Map(o.events().map(l=>[l.eventId,l])),d=[],R=[];for(let l of e){let u=l.eventId.trim(),v=a.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&te(v,l,this.#i,this.#n)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let b=o.append(l);a.set(b.eventId,b),d.push(b)}if(d.length>0){let l=s.length===0||s.endsWith(`
|
|
4
|
-
`)?s:`${s}
|
|
5
|
-
`;await I(h.dirname(r),{recursive:!0}),await f(this.#t,r),await L(r,`${l}${d.map(u=>JSON.stringify(u)).join(`
|
|
6
|
-
`)}
|
|
7
|
-
`)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(d),skipped_event_ids:Object.freeze(R)})}finally{await n()}}async snapshot(e={}){return this.#e=await this.#r(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#r(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#r(),yield*this.#e.stream(e)}async project(e,t,n={}){return this.#e=await this.#r(),this.#e.project(e,t,n)}async#r(){let e=await w(this.#t);try{let t=await f(this.#t,this.#o);return(await y(t,this.#i,this.#n)).log}finally{await e()}}};(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="73852fdf-f072-51ab-9449-d7922712eeb4")}catch{}})();function K(i){return[...i].sort().join("\0")}function ie(i,e,t){let n=i.successors.get(e);n?n.push(t):i.successors.set(e,[t]);let r=i.predecessors.get(t);r?r.push(e):i.predecessors.set(t,[e])}function G(i,e,t,n,r){let o=e.resolve(r);if(o?.ordering!==!0)return;let s=M(n),c=s===void 0?void 0:i.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let a=(o.precedence??"source_before_target")==="source_before_target";ie(i,a?t:c,a?c:t)}function ne(i,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},n=i.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of n){let o=r.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let r of n){let o=r.id.trim();G(t,e,o,r.blocked_by,"blocked_by");for(let s of r.dependencies??[])typeof s!="object"||s===null||G(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let r of[t.successors,t.predecessors])for(let o of r.values())o.sort();return t}function re(i,e){let t=new Set([e]),n=[e];for(;n.length>0;){let r=n.pop();for(let o of[i.successors,i.predecessors])for(let s of o.get(r)??[])t.has(s)||(t.add(s),n.push(s))}return t}function oe(i,e){let t=new Map;for(let n of e){let r=(i.successors.get(n)??[]).filter(o=>e.has(o));r.length>0&&t.set(n,r)}return t}function H(i,e,t){let n=ne(i,e),r=n.canonicalIds.get(t.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:t};let o=oe(n,re(n,r));return{cycles:q(o).filter(s=>s.includes(r)),successors:o,canonical:r}}function se(i,e,t){let n=new Set(e),r=n.has(t)?t:e[0];if(i.get(r)?.includes(r))return[r,r];for(let o of i.get(r)??[]){if(!n.has(o))continue;let s=ae(i,n,r,o);if(s)return s}return[...e,e[0]]}function ae(i,e,t,n){let r=[[n]],o=new Set([t,n]);for(;r.length>0;){let s=r.shift(),c=s.at(-1);for(let a of i.get(c)??[]){if(a===t)return[t,...s,t];!e.has(a)||o.has(a)||(o.add(a),r.push([...s,a]))}}}function ve(i,e,t){let n=m(),r=H(i,n,t),o=H(e,n,t),s=new Set(r.cycles.map(K)),c=new Set(k(i,void 0,n).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[...k(e,void 0,n).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${V(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(K(a))).map(a=>`ordering_cycle_created:${se(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new i.Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="5f2ca18e-450d-5b6e-9e07-7bbf080764f9")}catch{}})();function Ee(i,e){let t=e.resolve(i);return t?.hierarchy===!0||t?.outgoing==="one"||t?.incoming==="one"}function J(i,e,t,n,r){let o=JSON.stringify([e,t,n]),s=i.get(o);s===void 0&&(s={kind:e,direction:t,node_id:n,endpoints:new Set},i.set(o,s)),s.endpoints.add(r)}function B(i,e){let t=new Map;for(let n of i)for(let r of n.dependencies??[]){let o=e.resolve(r.kind);o===void 0||o.hierarchy||(o.outgoing==="one"&&J(t,o.kind,"outgoing",n.id,r.id),o.incoming==="one"&&J(t,o.kind,"incoming",r.id,n.id))}return t}function Ie(i,e,t=m()){let n=B(i,t),r=B(e,t);for(let o of[...r.keys()].sort()){let s=r.get(o);if(s.endpoints.size<=1)continue;let c=n.get(o);if(![...s.endpoints].every(a=>c?.endpoints.has(a)))throw new C(`Relationship ${s.kind} permits only one ${s.direction} endpoint for ${s.node_id}.`,S.USAGE,{code:"dependency_cardinality_created",field:"dependencies",value:s.kind,relationship_cardinality:{kind:s.kind,direction:s.direction,node_id:s.node_id,endpoint_ids:[...s.endpoints].sort()},required:"The final dependency set must satisfy the active relationship kind's one-edge cardinality.",nextSteps:["Drop extra --dep seeds, or remove conflicting rows with update --dep-remove before adding another edge.","Choose another kind only when its declared semantics match the intended relationship."]})}}export{T as a,F as b,ve as c,Ee as d,Ie as e};
|
|
8
|
-
//# sourceMappingURL=chunk-M4IA4LC6.js.map
|