@blxzer/pactile 0.5.0 → 0.6.0-beta.2
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/CHANGELOG.md +612 -563
- package/LICENSE +235 -235
- package/README.md +108 -105
- package/README.zh-CN.md +105 -105
- package/bin/compat-warning.js +11 -11
- package/bin/cstl.js +6 -6
- package/bin/pactile.js +3 -3
- package/bin/smart-search.js +38 -38
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +79 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/codex.d.ts +3 -0
- package/dist/commands/codex.d.ts.map +1 -0
- package/dist/commands/codex.js +54 -0
- package/dist/commands/codex.js.map +1 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +272 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +285 -456
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/parallel.d.ts +2 -0
- package/dist/commands/parallel.d.ts.map +1 -0
- package/dist/commands/parallel.js +26 -0
- package/dist/commands/parallel.js.map +1 -0
- package/dist/commands/pi.d.ts +3 -0
- package/dist/commands/pi.d.ts.map +1 -0
- package/dist/commands/pi.js +94 -0
- package/dist/commands/pi.js.map +1 -0
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +169 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/task.d.ts +3 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +1026 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/update.d.ts +3 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +130 -47
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +1 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/index.d.ts +5 -51
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +9 -140
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +7 -66
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +17 -262
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +5 -6
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +11 -39
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +1 -5
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +1 -5
- package/dist/constants/paths.js.map +1 -1
- package/dist/core/compat/environment.d.ts +43 -0
- package/dist/core/compat/environment.d.ts.map +1 -0
- package/dist/core/compat/environment.js +91 -0
- package/dist/core/compat/environment.js.map +1 -0
- package/dist/core/compat/index.d.ts +2 -0
- package/dist/core/compat/index.d.ts.map +1 -0
- package/dist/core/compat/index.js +2 -0
- package/dist/core/compat/index.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pactile/capability.d.ts +65 -0
- package/dist/core/pactile/capability.d.ts.map +1 -0
- package/dist/core/pactile/capability.js +199 -0
- package/dist/core/pactile/capability.js.map +1 -0
- package/dist/core/pactile/index.d.ts +15 -0
- package/dist/core/pactile/index.d.ts.map +1 -0
- package/dist/core/pactile/index.js +13 -0
- package/dist/core/pactile/index.js.map +1 -0
- package/dist/core/pactile/lifecycle.d.ts +106 -0
- package/dist/core/pactile/lifecycle.d.ts.map +1 -0
- package/dist/core/pactile/lifecycle.js +607 -0
- package/dist/core/pactile/lifecycle.js.map +1 -0
- package/dist/core/pactile/middleware/index.d.ts +3 -0
- package/dist/core/pactile/middleware/index.d.ts.map +1 -0
- package/dist/core/pactile/middleware/index.js +2 -0
- package/dist/core/pactile/middleware/index.js.map +1 -0
- package/dist/core/pactile/middleware/redaction.d.ts +4 -0
- package/dist/core/pactile/middleware/redaction.d.ts.map +1 -0
- package/dist/core/pactile/middleware/redaction.js +34 -0
- package/dist/core/pactile/middleware/redaction.js.map +1 -0
- package/dist/core/pactile/middleware/resolver.d.ts +62 -0
- package/dist/core/pactile/middleware/resolver.d.ts.map +1 -0
- package/dist/core/pactile/middleware/resolver.js +803 -0
- package/dist/core/pactile/middleware/resolver.js.map +1 -0
- package/dist/core/pactile/projection.d.ts +81 -0
- package/dist/core/pactile/projection.d.ts.map +1 -0
- package/dist/core/pactile/projection.js +399 -0
- package/dist/core/pactile/projection.js.map +1 -0
- package/dist/core/pactile/provider.d.ts +81 -0
- package/dist/core/pactile/provider.d.ts.map +1 -0
- package/dist/core/pactile/provider.js +313 -0
- package/dist/core/pactile/provider.js.map +1 -0
- package/dist/core/pactile/runtime.d.ts +56 -0
- package/dist/core/pactile/runtime.d.ts.map +1 -0
- package/dist/core/pactile/runtime.js +176 -0
- package/dist/core/pactile/runtime.js.map +1 -0
- package/dist/core/pactile/tile-compiler-types.d.ts +32 -0
- package/dist/core/pactile/tile-compiler-types.d.ts.map +1 -0
- package/dist/core/pactile/tile-compiler-types.js +2 -0
- package/dist/core/pactile/tile-compiler-types.js.map +1 -0
- package/dist/core/pactile/tile.d.ts +71 -0
- package/dist/core/pactile/tile.d.ts.map +1 -0
- package/dist/core/pactile/tile.js +228 -0
- package/dist/core/pactile/tile.js.map +1 -0
- package/dist/core/pactile/trace-runtime/index.d.ts +38 -0
- package/dist/core/pactile/trace-runtime/index.d.ts.map +1 -0
- package/dist/core/pactile/trace-runtime/index.js +292 -0
- package/dist/core/pactile/trace-runtime/index.js.map +1 -0
- package/dist/core/pactile/trace.d.ts +42 -0
- package/dist/core/pactile/trace.d.ts.map +1 -0
- package/dist/core/pactile/trace.js +221 -0
- package/dist/core/pactile/trace.js.map +1 -0
- package/dist/core/pactile/validation.d.ts +91 -0
- package/dist/core/pactile/validation.d.ts.map +1 -0
- package/dist/core/pactile/validation.js +301 -0
- package/dist/core/pactile/validation.js.map +1 -0
- package/dist/core/task/adapter-middleware.d.ts +122 -0
- package/dist/core/task/adapter-middleware.d.ts.map +1 -0
- package/dist/core/task/adapter-middleware.js +476 -0
- package/dist/core/task/adapter-middleware.js.map +1 -0
- package/dist/core/task/compat.d.ts +7 -0
- package/dist/core/task/compat.d.ts.map +1 -0
- package/dist/core/task/compat.js +2 -0
- package/dist/core/task/compat.js.map +1 -0
- package/dist/core/task/contract-migrate.d.ts +29 -0
- package/dist/core/task/contract-migrate.d.ts.map +1 -0
- package/dist/core/task/contract-migrate.js +207 -0
- package/dist/core/task/contract-migrate.js.map +1 -0
- package/dist/core/task/full-quality.d.ts +89 -0
- package/dist/core/task/full-quality.d.ts.map +1 -0
- package/dist/core/task/full-quality.js +379 -0
- package/dist/core/task/full-quality.js.map +1 -0
- package/dist/core/task/index.d.ts +32 -0
- package/dist/core/task/index.d.ts.map +1 -0
- package/dist/core/task/index.js +20 -0
- package/dist/core/task/index.js.map +1 -0
- package/dist/core/task/kernel-cli.d.ts +51 -0
- package/dist/core/task/kernel-cli.d.ts.map +1 -0
- package/dist/core/task/kernel-cli.js +301 -0
- package/dist/core/task/kernel-cli.js.map +1 -0
- package/dist/core/task/kernel-contract.d.ts +164 -0
- package/dist/core/task/kernel-contract.d.ts.map +1 -0
- package/dist/core/task/kernel-contract.js +475 -0
- package/dist/core/task/kernel-contract.js.map +1 -0
- package/dist/core/task/kernel-store.d.ts +130 -0
- package/dist/core/task/kernel-store.d.ts.map +1 -0
- package/dist/core/task/kernel-store.js +905 -0
- package/dist/core/task/kernel-store.js.map +1 -0
- package/dist/core/task/kernel-surface.d.ts +70 -0
- package/dist/core/task/kernel-surface.d.ts.map +1 -0
- package/dist/core/task/kernel-surface.js +121 -0
- package/dist/core/task/kernel-surface.js.map +1 -0
- package/dist/core/task/lite-context-pack.d.ts +71 -0
- package/dist/core/task/lite-context-pack.d.ts.map +1 -0
- package/dist/core/task/lite-context-pack.js +175 -0
- package/dist/core/task/lite-context-pack.js.map +1 -0
- package/dist/core/task/ondemand-topology.d.ts +108 -0
- package/dist/core/task/ondemand-topology.d.ts.map +1 -0
- package/dist/core/task/ondemand-topology.js +456 -0
- package/dist/core/task/ondemand-topology.js.map +1 -0
- package/dist/core/task/p36-artifact-migrate.d.ts +58 -0
- package/dist/core/task/p36-artifact-migrate.d.ts.map +1 -0
- package/dist/core/task/p36-artifact-migrate.js +293 -0
- package/dist/core/task/p36-artifact-migrate.js.map +1 -0
- package/dist/core/task/p36-wave-c.d.ts +39 -0
- package/dist/core/task/p36-wave-c.d.ts.map +1 -0
- package/dist/core/task/p36-wave-c.js +100 -0
- package/dist/core/task/p36-wave-c.js.map +1 -0
- package/dist/core/task/paths.d.ts +37 -0
- package/dist/core/task/paths.d.ts.map +1 -0
- package/dist/core/task/paths.js +49 -0
- package/dist/core/task/paths.js.map +1 -0
- package/dist/core/task/phase.d.ts +27 -0
- package/dist/core/task/phase.d.ts.map +1 -0
- package/dist/core/task/phase.js +24 -0
- package/dist/core/task/phase.js.map +1 -0
- package/dist/core/task/records.d.ts +48 -0
- package/dist/core/task/records.d.ts.map +1 -0
- package/dist/core/task/records.js +100 -0
- package/dist/core/task/records.js.map +1 -0
- package/dist/core/task/schema.d.ts +77 -0
- package/dist/core/task/schema.d.ts.map +1 -0
- package/dist/core/task/schema.js +220 -0
- package/dist/core/task/schema.js.map +1 -0
- package/dist/core/testing/index.d.ts +2 -0
- package/dist/core/testing/index.d.ts.map +1 -0
- package/dist/core/testing/index.js +4 -0
- package/dist/core/testing/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -9
- package/dist/migrations/manifests/0.1.1.json +9 -9
- package/dist/migrations/manifests/0.1.2.json +9 -9
- package/dist/migrations/manifests/0.1.3.json +9 -9
- package/dist/migrations/manifests/0.1.4.json +9 -9
- package/dist/migrations/manifests/0.2.1.json +9 -9
- package/dist/migrations/manifests/0.2.10.json +374 -374
- package/dist/migrations/manifests/0.2.2.json +8 -8
- package/dist/migrations/manifests/0.2.3.json +9 -9
- package/dist/migrations/manifests/0.2.4.json +8 -8
- package/dist/migrations/manifests/0.2.5.json +8 -8
- package/dist/migrations/manifests/0.2.6.json +8 -8
- package/dist/migrations/manifests/0.2.7.json +8 -8
- package/dist/migrations/manifests/0.2.8.json +9 -9
- package/dist/migrations/manifests/0.2.9.json +9 -9
- package/dist/migrations/manifests/0.3.0.json +89 -89
- package/dist/migrations/manifests/0.3.1.json +32 -32
- package/dist/migrations/manifests/0.3.2.json +16 -16
- package/dist/migrations/manifests/0.3.3.json +9 -9
- package/dist/migrations/manifests/0.3.4.json +9 -9
- package/dist/migrations/manifests/0.3.5.json +9 -9
- package/dist/migrations/manifests/0.3.6.json +9 -9
- package/dist/migrations/manifests/0.4.0.json +9 -9
- package/dist/migrations/manifests/0.4.1.json +9 -9
- package/dist/migrations/manifests/0.4.2.json +9 -9
- package/dist/migrations/manifests/0.4.3.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.0.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.2.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.3.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.5.json +9 -9
- package/dist/migrations/manifests/0.5.0.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.1.json +35 -0
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0.json +9 -0
- package/dist/pactile/adapters/codex/index.js +1 -1
- package/dist/pactile/adapters/codex/index.js.map +1 -1
- package/dist/pactile/adapters/index.d.ts +0 -1
- package/dist/pactile/adapters/index.d.ts.map +1 -1
- package/dist/pactile/adapters/index.js +0 -1
- package/dist/pactile/adapters/index.js.map +1 -1
- package/dist/pactile/adoption/bindings.d.ts +1 -1
- package/dist/pactile/adoption/bindings.d.ts.map +1 -1
- package/dist/pactile/adoption/bindings.js +1 -1
- package/dist/pactile/adoption/bindings.js.map +1 -1
- package/dist/pactile/adoption/inventory.d.ts +1 -1
- package/dist/pactile/adoption/inventory.d.ts.map +1 -1
- package/dist/pactile/adoption/inventory.js +1 -1
- package/dist/pactile/adoption/inventory.js.map +1 -1
- package/dist/pactile/adoption/safety.js +1 -1
- package/dist/pactile/adoption/safety.js.map +1 -1
- package/dist/pactile/adoption/workflow.d.ts +1 -1
- package/dist/pactile/adoption/workflow.d.ts.map +1 -1
- package/dist/pactile/adoption/workflow.js +1 -1
- package/dist/pactile/adoption/workflow.js.map +1 -1
- package/dist/pactile/codex/bridge.d.ts +71 -0
- package/dist/pactile/codex/bridge.d.ts.map +1 -0
- package/dist/pactile/codex/bridge.js +271 -0
- package/dist/pactile/codex/bridge.js.map +1 -0
- package/dist/pactile/compat/init-context.js +1 -1
- package/dist/pactile/compat/init-context.js.map +1 -1
- package/dist/pactile/compat/node-entry-migration.d.ts +3 -0
- package/dist/pactile/compat/node-entry-migration.d.ts.map +1 -0
- package/dist/pactile/compat/node-entry-migration.js +25 -0
- package/dist/pactile/compat/node-entry-migration.js.map +1 -0
- package/dist/pactile/exit/receipt.js +1 -1
- package/dist/pactile/exit/receipt.js.map +1 -1
- package/dist/pactile/exit/service.d.ts +1 -1
- package/dist/pactile/exit/service.d.ts.map +1 -1
- package/dist/pactile/exit/service.js +1 -3
- package/dist/pactile/exit/service.js.map +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts.map +1 -1
- package/dist/pactile/lifecycle/command-runner.js +1 -3
- package/dist/pactile/lifecycle/command-runner.js.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.d.ts.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.js +8 -32
- package/dist/pactile/lifecycle/default-adapters.js.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.js +1 -1
- package/dist/pactile/lifecycle/orchestrator.js.map +1 -1
- package/dist/pactile/lifecycle/project-files.d.ts.map +1 -1
- package/dist/pactile/lifecycle/project-files.js +4 -1
- package/dist/pactile/lifecycle/project-files.js.map +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts.map +1 -1
- package/dist/pactile/middleware/manifest-loader.js +1 -1
- package/dist/pactile/middleware/manifest-loader.js.map +1 -1
- package/dist/pactile/migration/transaction.d.ts +1 -1
- package/dist/pactile/migration/transaction.d.ts.map +1 -1
- package/dist/pactile/migration/transaction.js +1 -1
- package/dist/pactile/migration/transaction.js.map +1 -1
- package/dist/pactile/parallel/batch.d.ts +41 -0
- package/dist/pactile/parallel/batch.d.ts.map +1 -0
- package/dist/pactile/parallel/batch.js +190 -0
- package/dist/pactile/parallel/batch.js.map +1 -0
- package/dist/pactile/parallel/policy.d.ts +18 -0
- package/dist/pactile/parallel/policy.d.ts.map +1 -0
- package/dist/pactile/parallel/policy.js +174 -0
- package/dist/pactile/parallel/policy.js.map +1 -0
- package/dist/pactile/pi/bridge.d.ts +51 -0
- package/dist/pactile/pi/bridge.d.ts.map +1 -0
- package/dist/pactile/pi/bridge.js +353 -0
- package/dist/pactile/pi/bridge.js.map +1 -0
- package/dist/pactile/pi/rpc.d.ts +41 -0
- package/dist/pactile/pi/rpc.d.ts.map +1 -0
- package/dist/pactile/pi/rpc.js +219 -0
- package/dist/pactile/pi/rpc.js.map +1 -0
- package/dist/pactile/projection/planner.d.ts +1 -1
- package/dist/pactile/projection/planner.d.ts.map +1 -1
- package/dist/pactile/projection/planner.js +1 -1
- package/dist/pactile/projection/planner.js.map +1 -1
- package/dist/pactile/projection/shared/index.js +1 -1
- package/dist/pactile/projection/shared/index.js.map +1 -1
- package/dist/pactile/projection/store.js +1 -1
- package/dist/pactile/projection/store.js.map +1 -1
- package/dist/pactile/providers/probes.d.ts +2 -2
- package/dist/pactile/providers/probes.d.ts.map +1 -1
- package/dist/pactile/providers/probes.js +0 -6
- package/dist/pactile/providers/probes.js.map +1 -1
- package/dist/pactile/registry.d.ts +1 -8
- package/dist/pactile/registry.d.ts.map +1 -1
- package/dist/pactile/registry.js +8 -25
- package/dist/pactile/registry.js.map +1 -1
- package/dist/pactile/retrieval/envelope.d.ts +19 -0
- package/dist/pactile/retrieval/envelope.d.ts.map +1 -0
- package/dist/pactile/retrieval/envelope.js +115 -0
- package/dist/pactile/retrieval/envelope.js.map +1 -0
- package/dist/pactile/retrieval/evidence.js +1 -1
- package/dist/pactile/retrieval/evidence.js.map +1 -1
- package/dist/pactile/retrieval/pack.d.ts +9 -0
- package/dist/pactile/retrieval/pack.d.ts.map +1 -0
- package/dist/pactile/retrieval/pack.js +300 -0
- package/dist/pactile/retrieval/pack.js.map +1 -0
- package/dist/pactile/retrieval/planner.d.ts +1 -1
- package/dist/pactile/retrieval/planner.d.ts.map +1 -1
- package/dist/pactile/retrieval/planner.js +1 -1
- package/dist/pactile/retrieval/planner.js.map +1 -1
- package/dist/pactile/retrieval/types.d.ts +1 -1
- package/dist/pactile/retrieval/types.d.ts.map +1 -1
- package/dist/pactile/runtime/json-api.d.ts +1 -1
- package/dist/pactile/runtime/json-api.js +1 -1
- package/dist/pactile/runtime/paths.js +1 -1
- package/dist/pactile/runtime/paths.js.map +1 -1
- package/dist/pactile/runtime/stores.d.ts +1 -1
- package/dist/pactile/runtime/stores.d.ts.map +1 -1
- package/dist/pactile/runtime/stores.js +1 -1
- package/dist/pactile/runtime/stores.js.map +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.d.ts +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.js +1 -1
- package/dist/pactile/task/config.d.ts +9 -0
- package/dist/pactile/task/config.d.ts.map +1 -0
- package/dist/pactile/task/config.js +103 -0
- package/dist/pactile/task/config.js.map +1 -0
- package/dist/pactile/task/context.d.ts +19 -0
- package/dist/pactile/task/context.d.ts.map +1 -0
- package/dist/pactile/task/context.js +117 -0
- package/dist/pactile/task/context.js.map +1 -0
- package/dist/pactile/task/guards.d.ts +21 -0
- package/dist/pactile/task/guards.d.ts.map +1 -0
- package/dist/pactile/task/guards.js +232 -0
- package/dist/pactile/task/guards.js.map +1 -0
- package/dist/pactile/task/scaffold.d.ts +6 -0
- package/dist/pactile/task/scaffold.d.ts.map +1 -0
- package/dist/pactile/task/scaffold.js +57 -0
- package/dist/pactile/task/scaffold.js.map +1 -0
- package/dist/pactile/task/session-memory.d.ts +2 -0
- package/dist/pactile/task/session-memory.d.ts.map +1 -0
- package/dist/pactile/task/session-memory.js +123 -0
- package/dist/pactile/task/session-memory.js.map +1 -0
- package/dist/pactile/task/session-pack.d.ts +3 -0
- package/dist/pactile/task/session-pack.d.ts.map +1 -0
- package/dist/pactile/task/session-pack.js +139 -0
- package/dist/pactile/task/session-pack.js.map +1 -0
- package/dist/pactile/task/session.d.ts +13 -0
- package/dist/pactile/task/session.d.ts.map +1 -0
- package/dist/pactile/task/session.js +105 -0
- package/dist/pactile/task/session.js.map +1 -0
- package/dist/pactile/task/strategy.d.ts +24 -0
- package/dist/pactile/task/strategy.d.ts.map +1 -0
- package/dist/pactile/task/strategy.js +136 -0
- package/dist/pactile/task/strategy.js.map +1 -0
- package/dist/pactile/task/task-map.d.ts +35 -0
- package/dist/pactile/task/task-map.d.ts.map +1 -0
- package/dist/pactile/task/task-map.js +217 -0
- package/dist/pactile/task/task-map.js.map +1 -0
- package/dist/pactile/task/workflow-phase.d.ts +3 -0
- package/dist/pactile/task/workflow-phase.d.ts.map +1 -0
- package/dist/pactile/task/workflow-phase.js +56 -0
- package/dist/pactile/task/workflow-phase.js.map +1 -0
- package/dist/pactile/tiles/catalog.d.ts +1 -1
- package/dist/pactile/tiles/catalog.d.ts.map +1 -1
- package/dist/pactile/tiles/catalog.js +1 -1
- package/dist/pactile/tiles/catalog.js.map +1 -1
- package/dist/pactile/tiles/compiler.d.ts +1 -1
- package/dist/pactile/tiles/compiler.d.ts.map +1 -1
- package/dist/pactile/tiles/compiler.js +1 -1
- package/dist/pactile/tiles/compiler.js.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.d.ts +2 -2
- package/dist/pactile/tiles/content/ondemand/index.d.ts.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.js +2 -16
- package/dist/pactile/tiles/content/ondemand/index.js.map +1 -1
- package/dist/pactile/tiles/loader.d.ts +1 -1
- package/dist/pactile/tiles/loader.d.ts.map +1 -1
- package/dist/pactile/tiles/loader.js +1 -1
- package/dist/pactile/tiles/loader.js.map +1 -1
- package/dist/templates/common/bundled-skills/pactile-check/SKILL.md +161 -161
- package/dist/templates/common/bundled-skills/pactile-check/references/fowler-12-smells.md +28 -28
- package/dist/templates/common/bundled-skills/pactile-handoff/SKILL.md +117 -117
- package/dist/templates/common/bundled-skills/pactile-meta/SKILL.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/add-project-local-conventions.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-agents.md +5 -47
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-context-loading.md +79 -84
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-hooks.md +5 -57
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-skills-or-commands.md +7 -77
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-spec-structure.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-task-lifecycle.md +82 -88
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-workflow.md +65 -65
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/overview.md +12 -55
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/context-injection.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/generated-files.md +7 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/overview.md +7 -51
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/spec-system.md +102 -102
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/task-system.md +138 -133
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workflow.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workspace-memory.md +71 -71
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/agents.md +7 -69
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/hooks-and-settings.md +7 -59
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/overview.md +5 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/platform-map.md +9 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/skills-and-commands.md +7 -108
- package/dist/templates/common/bundled-skills/pactile-micro-grill/SKILL.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-skill-creator/SKILL.md +47 -47
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/authoring-rules.md +170 -170
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/general-authoring.md +189 -189
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/pactile-skill-locations.md +11 -52
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/review-checklist.md +52 -52
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/SKILL.md +41 -41
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/mcp-setup.md +18 -90
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/repository-analysis.md +41 -59
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-task-planning.md +61 -61
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-writing.md +70 -70
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +393 -393
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -3
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -98
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -89
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +323 -323
- package/dist/templates/common/commands/continue.md +60 -62
- package/dist/templates/common/commands/finish-work.md +84 -82
- package/dist/templates/common/commands/start.md +66 -66
- package/dist/templates/common/index.d.ts +0 -20
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +0 -16
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/before-dev.md +35 -35
- package/dist/templates/common/skills/brainstorm.md +204 -204
- package/dist/templates/common/skills/break-loop.md +125 -125
- package/dist/templates/common/skills/update-spec.md +363 -363
- package/dist/templates/extract.d.ts +1 -8
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +0 -31
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/agents.md +14 -14
- package/dist/templates/markdown/framework/artifact-locale-guide.md.txt +93 -93
- package/dist/templates/markdown/framework/codex-worker-dispatch.md.txt +9 -0
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +7 -28
- package/dist/templates/markdown/framework/execution-strategy.md.txt +14 -45
- package/dist/templates/markdown/framework/index.md.txt +20 -31
- package/dist/templates/markdown/framework/injection-budget-guide.md.txt +7 -111
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +139 -238
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +116 -116
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +105 -105
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -30
- package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +9 -199
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -15
- package/dist/templates/markdown/framework/verification-strength-guide.md.txt +185 -185
- package/dist/templates/markdown/gitignore.txt +15 -15
- package/dist/templates/markdown/index.d.ts +1 -5
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +3 -23
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -38
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -59
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -39
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -51
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +174 -174
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +162 -162
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +17 -634
- package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -227
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +75 -75
- package/dist/templates/markdown/spec/guides/e2e-walkthrough-guide.md.txt +88 -93
- package/dist/templates/markdown/spec/guides/index.md.txt +131 -131
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +137 -139
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +179 -179
- package/dist/templates/markdown/workspace-index.md +122 -125
- package/dist/templates/markdown/worktree.yaml.txt +58 -58
- package/dist/templates/pactile/CONTEXT.md +101 -113
- package/dist/templates/pactile/config/execution-strategy-rules.json +30 -31
- package/dist/templates/pactile/config.yaml +111 -130
- package/dist/templates/pactile/docs/adr/README.md +21 -21
- package/dist/templates/pactile/gitignore.txt +35 -35
- package/dist/templates/pactile/index.d.ts +3 -127
- package/dist/templates/pactile/index.d.ts.map +1 -1
- package/dist/templates/pactile/index.js +13 -298
- package/dist/templates/pactile/index.js.map +1 -1
- package/dist/templates/pactile/modules/approval-personal/contract.md +43 -43
- package/dist/templates/pactile/modules/close-basic/contract.md +37 -37
- package/dist/templates/pactile/modules/context-progressive/contract.md +44 -44
- package/dist/templates/pactile/modules/debug-recovery/contract.md +44 -44
- package/dist/templates/pactile/modules/define-basic/contract.md +39 -39
- package/dist/templates/pactile/modules/define-extended/contract.md +45 -45
- package/dist/templates/pactile/modules/execute-agent/contract.md +38 -38
- package/dist/templates/pactile/modules/independent-check/contract.md +35 -35
- package/dist/templates/pactile/modules/index.json +127 -133
- package/dist/templates/pactile/modules/intake-basic/contract.md +34 -34
- package/dist/templates/pactile/modules/observability-local/contract.md +31 -31
- package/dist/templates/pactile/modules/parent-child/contract.md +45 -45
- package/dist/templates/pactile/modules/personal-memory/contract.md +55 -55
- package/dist/templates/pactile/modules/retention-storage/contract.md +43 -43
- package/dist/templates/pactile/modules/retrieval-extended/contract.md +78 -77
- package/dist/templates/pactile/modules/session-transfer/contract.md +41 -41
- package/dist/templates/pactile/modules/spec-learning/contract.md +50 -50
- package/dist/templates/pactile/modules/vcs-integration/contract.md +46 -46
- package/dist/templates/pactile/modules/verify-basic/contract.md +38 -38
- package/dist/templates/pactile/modules/worker-orchestration/contract.md +47 -47
- package/dist/templates/pactile/scripts/retrieval_probe_matrix_template.json +43 -43
- package/dist/templates/pactile/tasks/locale/en/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/locale/zh/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/templates/release-execution/design.md +60 -60
- package/dist/templates/pactile/tasks/templates/release-execution/handoff-template.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/prd.md +30 -30
- package/dist/templates/pactile/tasks/templates/release-readiness/design.md +49 -49
- package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +38 -38
- package/dist/templates/pactile/tasks/templates/release-readiness/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-readiness/prd.md +30 -30
- package/dist/templates/pactile/workflow.md +65 -64
- package/dist/types/ai-tools.d.ts +12 -13
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +15 -14
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -1
- package/dist/utils/cwd-guard.js +1 -1
- package/dist/utils/cwd-guard.js.map +1 -1
- package/dist/utils/developer.d.ts +5 -0
- package/dist/utils/developer.d.ts.map +1 -0
- package/dist/utils/developer.js +38 -0
- package/dist/utils/developer.js.map +1 -0
- package/dist/utils/git-root.d.ts +3 -0
- package/dist/utils/git-root.d.ts.map +1 -0
- package/dist/utils/git-root.js +24 -0
- package/dist/utils/git-root.js.map +1 -0
- package/dist/utils/local-date.d.ts +3 -0
- package/dist/utils/local-date.d.ts.map +1 -0
- package/dist/utils/local-date.js +8 -0
- package/dist/utils/local-date.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +5 -4
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +11 -21
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/p36-upgrade.d.ts +1 -1
- package/dist/utils/p36-upgrade.d.ts.map +1 -1
- package/dist/utils/p36-upgrade.js +1 -1
- package/dist/utils/p36-upgrade.js.map +1 -1
- package/dist/utils/post-update-smoke.d.ts +1 -4
- package/dist/utils/post-update-smoke.d.ts.map +1 -1
- package/dist/utils/post-update-smoke.js +13 -25
- package/dist/utils/post-update-smoke.js.map +1 -1
- package/dist/utils/project-capabilities.d.ts +2 -17
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +14 -119
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +14 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +61 -30
- package/dist/utils/readiness.js.map +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts.map +1 -1
- package/dist/utils/task-json.d.ts +3 -3
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +3 -3
- package/dist/utils/task-json.js.map +1 -1
- package/dist/utils/template-hash.d.ts +4 -0
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +1 -1
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/update-rollout-report.d.ts +9 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -1
- package/dist/utils/update-rollout-report.js +14 -1
- package/dist/utils/update-rollout-report.js.map +1 -1
- package/package.json +22 -11
- package/scripts/postinstall.js +6 -6
- package/dist/commands/channel/adapters/claude.d.ts +0 -29
- package/dist/commands/channel/adapters/claude.d.ts.map +0 -1
- package/dist/commands/channel/adapters/claude.js +0 -203
- package/dist/commands/channel/adapters/claude.js.map +0 -1
- package/dist/commands/channel/adapters/codex.d.ts +0 -85
- package/dist/commands/channel/adapters/codex.d.ts.map +0 -1
- package/dist/commands/channel/adapters/codex.js +0 -505
- package/dist/commands/channel/adapters/codex.js.map +0 -1
- package/dist/commands/channel/adapters/index.d.ts +0 -84
- package/dist/commands/channel/adapters/index.d.ts.map +0 -1
- package/dist/commands/channel/adapters/index.js +0 -115
- package/dist/commands/channel/adapters/index.js.map +0 -1
- package/dist/commands/channel/adapters/types.d.ts +0 -33
- package/dist/commands/channel/adapters/types.d.ts.map +0 -1
- package/dist/commands/channel/adapters/types.js +0 -2
- package/dist/commands/channel/adapters/types.js.map +0 -1
- package/dist/commands/channel/agent-loader.d.ts +0 -32
- package/dist/commands/channel/agent-loader.d.ts.map +0 -1
- package/dist/commands/channel/agent-loader.js +0 -154
- package/dist/commands/channel/agent-loader.js.map +0 -1
- package/dist/commands/channel/context-loader.d.ts +0 -26
- package/dist/commands/channel/context-loader.d.ts.map +0 -1
- package/dist/commands/channel/context-loader.js +0 -290
- package/dist/commands/channel/context-loader.js.map +0 -1
- package/dist/commands/channel/context.d.ts +0 -16
- package/dist/commands/channel/context.d.ts.map +0 -1
- package/dist/commands/channel/context.js +0 -83
- package/dist/commands/channel/context.js.map +0 -1
- package/dist/commands/channel/create.d.ts +0 -27
- package/dist/commands/channel/create.d.ts.map +0 -1
- package/dist/commands/channel/create.js +0 -39
- package/dist/commands/channel/create.js.map +0 -1
- package/dist/commands/channel/dev-parse-trace.d.ts +0 -14
- package/dist/commands/channel/dev-parse-trace.d.ts.map +0 -1
- package/dist/commands/channel/dev-parse-trace.js +0 -70
- package/dist/commands/channel/dev-parse-trace.js.map +0 -1
- package/dist/commands/channel/guard.d.ts +0 -150
- package/dist/commands/channel/guard.d.ts.map +0 -1
- package/dist/commands/channel/guard.js +0 -475
- package/dist/commands/channel/guard.js.map +0 -1
- package/dist/commands/channel/index.d.ts +0 -3
- package/dist/commands/channel/index.d.ts.map +0 -1
- package/dist/commands/channel/index.js +0 -531
- package/dist/commands/channel/index.js.map +0 -1
- package/dist/commands/channel/interrupt.d.ts +0 -10
- package/dist/commands/channel/interrupt.d.ts.map +0 -1
- package/dist/commands/channel/interrupt.js +0 -22
- package/dist/commands/channel/interrupt.js.map +0 -1
- package/dist/commands/channel/kill.d.ts +0 -7
- package/dist/commands/channel/kill.d.ts.map +0 -1
- package/dist/commands/channel/kill.js +0 -121
- package/dist/commands/channel/kill.js.map +0 -1
- package/dist/commands/channel/list.d.ts +0 -17
- package/dist/commands/channel/list.d.ts.map +0 -1
- package/dist/commands/channel/list.js +0 -233
- package/dist/commands/channel/list.js.map +0 -1
- package/dist/commands/channel/messages.d.ts +0 -15
- package/dist/commands/channel/messages.d.ts.map +0 -1
- package/dist/commands/channel/messages.js +0 -245
- package/dist/commands/channel/messages.js.map +0 -1
- package/dist/commands/channel/rm.d.ts +0 -27
- package/dist/commands/channel/rm.d.ts.map +0 -1
- package/dist/commands/channel/rm.js +0 -216
- package/dist/commands/channel/rm.js.map +0 -1
- package/dist/commands/channel/run.d.ts +0 -30
- package/dist/commands/channel/run.d.ts.map +0 -1
- package/dist/commands/channel/run.js +0 -130
- package/dist/commands/channel/run.js.map +0 -1
- package/dist/commands/channel/send.d.ts +0 -11
- package/dist/commands/channel/send.d.ts.map +0 -1
- package/dist/commands/channel/send.js +0 -24
- package/dist/commands/channel/send.js.map +0 -1
- package/dist/commands/channel/spawn.d.ts +0 -40
- package/dist/commands/channel/spawn.d.ts.map +0 -1
- package/dist/commands/channel/spawn.js +0 -242
- package/dist/commands/channel/spawn.js.map +0 -1
- package/dist/commands/channel/store/events.d.ts +0 -39
- package/dist/commands/channel/store/events.d.ts.map +0 -1
- package/dist/commands/channel/store/events.js +0 -87
- package/dist/commands/channel/store/events.js.map +0 -1
- package/dist/commands/channel/store/filter.d.ts +0 -3
- package/dist/commands/channel/store/filter.d.ts.map +0 -1
- package/dist/commands/channel/store/filter.js +0 -2
- package/dist/commands/channel/store/filter.js.map +0 -1
- package/dist/commands/channel/store/lock.d.ts +0 -23
- package/dist/commands/channel/store/lock.d.ts.map +0 -1
- package/dist/commands/channel/store/lock.js +0 -99
- package/dist/commands/channel/store/lock.js.map +0 -1
- package/dist/commands/channel/store/paths.d.ts +0 -63
- package/dist/commands/channel/store/paths.d.ts.map +0 -1
- package/dist/commands/channel/store/paths.js +0 -247
- package/dist/commands/channel/store/paths.js.map +0 -1
- package/dist/commands/channel/store/schema.d.ts +0 -27
- package/dist/commands/channel/store/schema.d.ts.map +0 -1
- package/dist/commands/channel/store/schema.js +0 -34
- package/dist/commands/channel/store/schema.js.map +0 -1
- package/dist/commands/channel/store/thread-state.d.ts +0 -5
- package/dist/commands/channel/store/thread-state.d.ts.map +0 -1
- package/dist/commands/channel/store/thread-state.js +0 -16
- package/dist/commands/channel/store/thread-state.js.map +0 -1
- package/dist/commands/channel/store/watch.d.ts +0 -19
- package/dist/commands/channel/store/watch.d.ts.map +0 -1
- package/dist/commands/channel/store/watch.js +0 -146
- package/dist/commands/channel/store/watch.js.map +0 -1
- package/dist/commands/channel/supervisor/idle.d.ts +0 -46
- package/dist/commands/channel/supervisor/idle.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/idle.js +0 -72
- package/dist/commands/channel/supervisor/idle.js.map +0 -1
- package/dist/commands/channel/supervisor/inbox.d.ts +0 -30
- package/dist/commands/channel/supervisor/inbox.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/inbox.js +0 -160
- package/dist/commands/channel/supervisor/inbox.js.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.d.ts +0 -68
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.js +0 -146
- package/dist/commands/channel/supervisor/shutdown.js.map +0 -1
- package/dist/commands/channel/supervisor/stdout.d.ts +0 -51
- package/dist/commands/channel/supervisor/stdout.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/stdout.js +0 -121
- package/dist/commands/channel/supervisor/stdout.js.map +0 -1
- package/dist/commands/channel/supervisor/turns.d.ts +0 -31
- package/dist/commands/channel/supervisor/turns.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/turns.js +0 -45
- package/dist/commands/channel/supervisor/turns.js.map +0 -1
- package/dist/commands/channel/supervisor/warning.d.ts +0 -48
- package/dist/commands/channel/supervisor/warning.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/warning.js +0 -77
- package/dist/commands/channel/supervisor/warning.js.map +0 -1
- package/dist/commands/channel/supervisor.d.ts +0 -59
- package/dist/commands/channel/supervisor.d.ts.map +0 -1
- package/dist/commands/channel/supervisor.js +0 -345
- package/dist/commands/channel/supervisor.js.map +0 -1
- package/dist/commands/channel/text-body.d.ts +0 -13
- package/dist/commands/channel/text-body.d.ts.map +0 -1
- package/dist/commands/channel/text-body.js +0 -47
- package/dist/commands/channel/text-body.js.map +0 -1
- package/dist/commands/channel/threads.d.ts +0 -39
- package/dist/commands/channel/threads.d.ts.map +0 -1
- package/dist/commands/channel/threads.js +0 -106
- package/dist/commands/channel/threads.js.map +0 -1
- package/dist/commands/channel/title.d.ts +0 -12
- package/dist/commands/channel/title.d.ts.map +0 -1
- package/dist/commands/channel/title.js +0 -24
- package/dist/commands/channel/title.js.map +0 -1
- package/dist/commands/channel/wait.d.ts +0 -17
- package/dist/commands/channel/wait.d.ts.map +0 -1
- package/dist/commands/channel/wait.js +0 -75
- package/dist/commands/channel/wait.js.map +0 -1
- package/dist/commands/validate-rules.d.ts +0 -6
- package/dist/commands/validate-rules.d.ts.map +0 -1
- package/dist/commands/validate-rules.js +0 -33
- package/dist/commands/validate-rules.js.map +0 -1
- package/dist/configurators/cursor.d.ts +0 -21
- package/dist/configurators/cursor.d.ts.map +0 -1
- package/dist/configurators/cursor.js +0 -51
- package/dist/configurators/cursor.js.map +0 -1
- package/dist/pactile/adapters/cursor/index.d.ts +0 -60
- package/dist/pactile/adapters/cursor/index.d.ts.map +0 -1
- package/dist/pactile/adapters/cursor/index.js +0 -186
- package/dist/pactile/adapters/cursor/index.js.map +0 -1
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +0 -179
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +0 -149
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +0 -904
- package/dist/templates/cursor/agents/pactile-check.md +0 -58
- package/dist/templates/cursor/agents/pactile-implement.md +0 -56
- package/dist/templates/cursor/agents/pactile-research.md +0 -51
- package/dist/templates/cursor/commands/handoff.md +0 -101
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +0 -14
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +0 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +0 -20
- package/dist/templates/cursor/fixtures/expected-rules.js.map +0 -1
- package/dist/templates/cursor/hooks.json +0 -52
- package/dist/templates/cursor/index.d.ts +0 -19
- package/dist/templates/cursor/index.d.ts.map +0 -1
- package/dist/templates/cursor/index.js +0 -19
- package/dist/templates/cursor/index.js.map +0 -1
- package/dist/templates/cursor/rules/pactile-bootstrap.mdc +0 -18
- package/dist/templates/cursor/worktrees.json +0 -11
- package/dist/templates/markdown/framework/cursor-context-injection-guide.md.txt +0 -85
- package/dist/templates/markdown/framework/cursor-native-modes-guide.md.txt +0 -239
- package/dist/templates/markdown/framework/cursor-semantic-compliance.md.txt +0 -41
- package/dist/templates/markdown/framework/cursor-subagent-policy.md.txt +0 -90
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +0 -45
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +0 -25
- package/dist/templates/pactile/modules/candidate-pool/contract.md +0 -37
- package/dist/templates/pactile/pool/README.md +0 -149
- package/dist/templates/pactile/pool/items/.gitkeep +0 -0
- package/dist/templates/pactile/pool/plan.md +0 -50
- package/dist/templates/pactile/scripts/__init__.py +0 -5
- package/dist/templates/pactile/scripts/add_session.py +0 -547
- package/dist/templates/pactile/scripts/build_context_pack.py +0 -17
- package/dist/templates/pactile/scripts/build_retrieval_pack.py +0 -376
- package/dist/templates/pactile/scripts/codegraph_session_smoke.py +0 -76
- package/dist/templates/pactile/scripts/common/__init__.py +0 -103
- package/dist/templates/pactile/scripts/common/active_task.py +0 -576
- package/dist/templates/pactile/scripts/common/adapter_middleware.py +0 -1373
- package/dist/templates/pactile/scripts/common/artifact_locale.py +0 -303
- package/dist/templates/pactile/scripts/common/artifact_search.py +0 -587
- package/dist/templates/pactile/scripts/common/cli_adapter.py +0 -135
- package/dist/templates/pactile/scripts/common/cli_environment.py +0 -155
- package/dist/templates/pactile/scripts/common/codebase_retrieval_router.py +0 -1339
- package/dist/templates/pactile/scripts/common/config.py +0 -497
- package/dist/templates/pactile/scripts/common/context_pack.py +0 -371
- package/dist/templates/pactile/scripts/common/cursor_retrieval_env.py +0 -31
- package/dist/templates/pactile/scripts/common/developer.py +0 -190
- package/dist/templates/pactile/scripts/common/execution_strategy.py +0 -268
- package/dist/templates/pactile/scripts/common/full_quality.py +0 -237
- package/dist/templates/pactile/scripts/common/git.py +0 -37
- package/dist/templates/pactile/scripts/common/git_context.py +0 -198
- package/dist/templates/pactile/scripts/common/injection_budget.py +0 -317
- package/dist/templates/pactile/scripts/common/io.py +0 -37
- package/dist/templates/pactile/scripts/common/kernel_command.py +0 -369
- package/dist/templates/pactile/scripts/common/lite_context.py +0 -280
- package/dist/templates/pactile/scripts/common/log.py +0 -45
- package/dist/templates/pactile/scripts/common/ondemand_topology.py +0 -419
- package/dist/templates/pactile/scripts/common/packages_context.py +0 -239
- package/dist/templates/pactile/scripts/common/pactile_config.py +0 -131
- package/dist/templates/pactile/scripts/common/parallel_declaration.py +0 -369
- package/dist/templates/pactile/scripts/common/parent_orchestration.py +0 -1198
- package/dist/templates/pactile/scripts/common/paths.py +0 -756
- package/dist/templates/pactile/scripts/common/pool_refs.py +0 -119
- package/dist/templates/pactile/scripts/common/pool_slice.py +0 -269
- package/dist/templates/pactile/scripts/common/pool_store.py +0 -766
- package/dist/templates/pactile/scripts/common/project_file_stats.py +0 -91
- package/dist/templates/pactile/scripts/common/retrieval_adapter_metadata.py +0 -943
- package/dist/templates/pactile/scripts/common/retrieval_agent_instructions.py +0 -123
- package/dist/templates/pactile/scripts/common/retrieval_evidence.py +0 -915
- package/dist/templates/pactile/scripts/common/retrieval_pack.py +0 -422
- package/dist/templates/pactile/scripts/common/retrieval_pack_context.py +0 -122
- package/dist/templates/pactile/scripts/common/retrieval_plan_gate.py +0 -61
- package/dist/templates/pactile/scripts/common/retrieval_result_ranking.py +0 -104
- package/dist/templates/pactile/scripts/common/retrieval_tool_classification.py +0 -166
- package/dist/templates/pactile/scripts/common/safe_commit.py +0 -285
- package/dist/templates/pactile/scripts/common/semantic_plan_gate.py +0 -53
- package/dist/templates/pactile/scripts/common/session_context.py +0 -1213
- package/dist/templates/pactile/scripts/common/session_memory.py +0 -386
- package/dist/templates/pactile/scripts/common/session_pack.py +0 -886
- package/dist/templates/pactile/scripts/common/smart_search_evidence.py +0 -514
- package/dist/templates/pactile/scripts/common/smart_search_resolve.py +0 -150
- package/dist/templates/pactile/scripts/common/subagent_dispatch.py +0 -592
- package/dist/templates/pactile/scripts/common/task_context.py +0 -241
- package/dist/templates/pactile/scripts/common/task_dashboard.py +0 -286
- package/dist/templates/pactile/scripts/common/task_dependencies.py +0 -648
- package/dist/templates/pactile/scripts/common/task_gates.py +0 -2478
- package/dist/templates/pactile/scripts/common/task_map.py +0 -703
- package/dist/templates/pactile/scripts/common/task_queue.py +0 -188
- package/dist/templates/pactile/scripts/common/task_store.py +0 -2252
- package/dist/templates/pactile/scripts/common/task_utils.py +0 -274
- package/dist/templates/pactile/scripts/common/tasks.py +0 -231
- package/dist/templates/pactile/scripts/common/test_adapter_middleware.py +0 -199
- package/dist/templates/pactile/scripts/common/test_depends_mode_block.py +0 -509
- package/dist/templates/pactile/scripts/common/test_full_quality.py +0 -197
- package/dist/templates/pactile/scripts/common/test_kernel_command.py +0 -336
- package/dist/templates/pactile/scripts/common/test_lite_path.py +0 -190
- package/dist/templates/pactile/scripts/common/test_observable_defaults.py +0 -141
- package/dist/templates/pactile/scripts/common/test_ondemand_topology.py +0 -237
- package/dist/templates/pactile/scripts/common/test_parallel_declaration.py +0 -264
- package/dist/templates/pactile/scripts/common/test_pool_slice.py +0 -198
- package/dist/templates/pactile/scripts/common/test_pool_store.py +0 -452
- package/dist/templates/pactile/scripts/common/test_retrieval_arbitration.py +0 -331
- package/dist/templates/pactile/scripts/common/test_task_dashboard.py +0 -155
- package/dist/templates/pactile/scripts/common/test_task_dependencies.py +0 -329
- package/dist/templates/pactile/scripts/common/test_task_store_kernel_patch.py +0 -163
- package/dist/templates/pactile/scripts/common/types.py +0 -110
- package/dist/templates/pactile/scripts/common/workflow_phase.py +0 -194
- package/dist/templates/pactile/scripts/compile_session_pack.py +0 -15
- package/dist/templates/pactile/scripts/cursor_retrieval_probe.py +0 -64
- package/dist/templates/pactile/scripts/cursor_retrieval_probe_prompt.md +0 -33
- package/dist/templates/pactile/scripts/generate_dispatch_prompt.py +0 -182
- package/dist/templates/pactile/scripts/get_context.py +0 -19
- package/dist/templates/pactile/scripts/get_developer.py +0 -26
- package/dist/templates/pactile/scripts/hooks/linear_sync.py +0 -243
- package/dist/templates/pactile/scripts/init_developer.py +0 -51
- package/dist/templates/pactile/scripts/injection_budget_probe.py +0 -69
- package/dist/templates/pactile/scripts/pool.py +0 -237
- package/dist/templates/pactile/scripts/rank_retrieval_candidates.py +0 -98
- package/dist/templates/pactile/scripts/route_codebase_retrieval.py +0 -72
- package/dist/templates/pactile/scripts/run_smart_search.py +0 -12
- package/dist/templates/pactile/scripts/score_evidence.py +0 -131
- package/dist/templates/pactile/scripts/search_artifacts.py +0 -13
- package/dist/templates/pactile/scripts/search_memory.py +0 -12
- package/dist/templates/pactile/scripts/spec_health_outcomes.py +0 -160
- package/dist/templates/pactile/scripts/task.py +0 -1118
- package/dist/templates/pactile/scripts/verify_evidence_probe.py +0 -138
- package/dist/templates/shared-hooks/event-bridge.py +0 -121
- package/dist/templates/shared-hooks/index.d.ts +0 -50
- package/dist/templates/shared-hooks/index.d.ts.map +0 -1
- package/dist/templates/shared-hooks/index.js +0 -96
- package/dist/templates/shared-hooks/index.js.map +0 -1
- package/dist/templates/shared-hooks/inject-retrieval-plan.py +0 -217
- package/dist/templates/shared-hooks/inject-shell-session-context.py +0 -183
- package/dist/templates/shared-hooks/inject-subagent-context.py +0 -267
- package/dist/templates/shared-hooks/inject-workflow-state.py +0 -106
- package/dist/templates/shared-hooks/rename-session-for-task.py +0 -231
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +0 -345
- package/dist/templates/shared-hooks/session-start.py +0 -355
- package/dist/templates/shared-hooks/spec-write-audit.py +0 -173
- package/dist/utils/mirror-check.d.ts +0 -22
- package/dist/utils/mirror-check.d.ts.map +0 -1
- package/dist/utils/mirror-check.js +0 -90
- package/dist/utils/mirror-check.js.map +0 -1
- package/dist/utils/validate-rules.d.ts +0 -21
- package/dist/utils/validate-rules.d.ts.map +0 -1
- package/dist/utils/validate-rules.js +0 -88
- package/dist/utils/validate-rules.js.map +0 -1
|
@@ -1,1339 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Host-neutral Pactile retrieval request, plan, and evidence contract.
|
|
3
|
-
|
|
4
|
-
This is the Python mirror of the TypeScript V3 planner. It describes intent,
|
|
5
|
-
assurance, policy, evidence, budgets, and stop conditions; concrete capability
|
|
6
|
-
binding belongs to the project resolver and its adapters.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from __future__ import annotations
|
|
10
|
-
|
|
11
|
-
import hashlib
|
|
12
|
-
import json
|
|
13
|
-
import math
|
|
14
|
-
import re
|
|
15
|
-
import unicodedata
|
|
16
|
-
from datetime import datetime
|
|
17
|
-
from pathlib import Path
|
|
18
|
-
from typing import Any, cast
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ROUTER_VERSION = 3
|
|
22
|
-
RETRIEVAL_ABI_VERSION = ROUTER_VERSION
|
|
23
|
-
|
|
24
|
-
INTENT_ORDER = ("exact", "semantic", "structural", "external")
|
|
25
|
-
PROVIDER_INTENTS = ("semantic", "structural", "external")
|
|
26
|
-
ASSURANCE_LEVELS = ("best-effort", "evidence-backed", "verified")
|
|
27
|
-
PROVIDER_STATUSES = (
|
|
28
|
-
"resolution-required",
|
|
29
|
-
"ready",
|
|
30
|
-
"degraded",
|
|
31
|
-
"unavailable",
|
|
32
|
-
"unsupported",
|
|
33
|
-
)
|
|
34
|
-
PROVIDER_READINESS = ("ready", "degraded", "unavailable")
|
|
35
|
-
CORROBORATION_KINDS = (
|
|
36
|
-
"source-reference",
|
|
37
|
-
"git-evidence",
|
|
38
|
-
"repeatable-test",
|
|
39
|
-
)
|
|
40
|
-
REASON_CODES = (
|
|
41
|
-
"invalid-plan",
|
|
42
|
-
"invalid-evidence",
|
|
43
|
-
"query-empty",
|
|
44
|
-
"provider-resolution-required",
|
|
45
|
-
"provider-degraded",
|
|
46
|
-
"provider-unavailable",
|
|
47
|
-
"provider-unsupported",
|
|
48
|
-
"candidate-missing",
|
|
49
|
-
"corroboration-required",
|
|
50
|
-
"required-evidence-missing",
|
|
51
|
-
"minimum-assurance-not-met",
|
|
52
|
-
"verified-provider-proof-required",
|
|
53
|
-
"repeatable-verification-required",
|
|
54
|
-
"budget-exhausted",
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
FILESYSTEM_CEILINGS = ("none", "read", "write")
|
|
58
|
-
PROCESS_CEILINGS = ("none", "execute")
|
|
59
|
-
NETWORK_CEILINGS = ("forbidden", "project-authorized")
|
|
60
|
-
CREDENTIAL_CEILINGS = ("forbidden", "project-authorized")
|
|
61
|
-
PRIVACY_CEILINGS = ("local-only", "project-approved-egress", "external")
|
|
62
|
-
TELEMETRY_CEILINGS = ("forbidden", "local-only", "project-authorized")
|
|
63
|
-
COST_CEILINGS = ("none", "free", "low", "medium", "high")
|
|
64
|
-
|
|
65
|
-
DEFAULT_RETRIEVAL_BUDGET_V3: dict[str, int] = {
|
|
66
|
-
"maxSteps": 16,
|
|
67
|
-
"maxCandidatesPerStep": 50,
|
|
68
|
-
}
|
|
69
|
-
DEFAULT_RETRIEVAL_POLICY_V3: dict[str, object] = {
|
|
70
|
-
"filesystem": "read",
|
|
71
|
-
"process": "execute",
|
|
72
|
-
"network": "forbidden",
|
|
73
|
-
"credentials": "forbidden",
|
|
74
|
-
"privacy": "local-only",
|
|
75
|
-
"egressDestinations": [],
|
|
76
|
-
"telemetry": "local-only",
|
|
77
|
-
"cost": "free",
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
MAX_QUERY_BYTES = 16 * 1024
|
|
81
|
-
MAX_SCOPE_HINTS = 128
|
|
82
|
-
MAX_SCOPE_HINT_BYTES = 512
|
|
83
|
-
MAX_EVIDENCE_KINDS = 64
|
|
84
|
-
MAX_LOGICAL_ID_BYTES = 128
|
|
85
|
-
LOGICAL_ID = re.compile(r"^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$")
|
|
86
|
-
SEMVER = re.compile(
|
|
87
|
-
r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)"
|
|
88
|
-
r"(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?"
|
|
89
|
-
r"(?:\+[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$"
|
|
90
|
-
)
|
|
91
|
-
RFC3339 = re.compile(
|
|
92
|
-
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$"
|
|
93
|
-
)
|
|
94
|
-
LOGICAL_REF = re.compile(
|
|
95
|
-
r"^(?:artifact|evidence|source|git|test)://"
|
|
96
|
-
r"([a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)*)$"
|
|
97
|
-
)
|
|
98
|
-
SENSITIVE_REFERENCE_TERMS = frozenset(
|
|
99
|
-
{"credential", "credentials", "passwd", "password", "secret", "token"}
|
|
100
|
-
)
|
|
101
|
-
FORBIDDEN_JSON_KEYS = frozenset({"__proto__", "constructor", "prototype"})
|
|
102
|
-
_MISSING_CONTEXT = object()
|
|
103
|
-
|
|
104
|
-
EXACT_SIGNALS = (
|
|
105
|
-
"where is",
|
|
106
|
-
"defined",
|
|
107
|
-
"definition",
|
|
108
|
-
"symbol",
|
|
109
|
-
"path",
|
|
110
|
-
"file",
|
|
111
|
-
"literal",
|
|
112
|
-
"identifier",
|
|
113
|
-
"exact",
|
|
114
|
-
"grep",
|
|
115
|
-
"rg ",
|
|
116
|
-
"在哪里",
|
|
117
|
-
"定义",
|
|
118
|
-
"路径",
|
|
119
|
-
"文件",
|
|
120
|
-
"字面量",
|
|
121
|
-
)
|
|
122
|
-
SEMANTIC_SIGNALS = (
|
|
123
|
-
"concept",
|
|
124
|
-
"conceptual",
|
|
125
|
-
"semantic",
|
|
126
|
-
"behavior",
|
|
127
|
-
"behaviour",
|
|
128
|
-
"how does",
|
|
129
|
-
"unknown name",
|
|
130
|
-
"概念",
|
|
131
|
-
"语义",
|
|
132
|
-
"行为",
|
|
133
|
-
"如何工作",
|
|
134
|
-
)
|
|
135
|
-
STRUCTURAL_SIGNALS = (
|
|
136
|
-
"caller",
|
|
137
|
-
"callee",
|
|
138
|
-
"call graph",
|
|
139
|
-
"dependency",
|
|
140
|
-
"dependencies",
|
|
141
|
-
"impact",
|
|
142
|
-
"blast radius",
|
|
143
|
-
"structural",
|
|
144
|
-
"architecture",
|
|
145
|
-
"调用者",
|
|
146
|
-
"调用链",
|
|
147
|
-
"依赖",
|
|
148
|
-
"影响面",
|
|
149
|
-
"结构",
|
|
150
|
-
"架构",
|
|
151
|
-
)
|
|
152
|
-
EXTERNAL_SIGNALS = (
|
|
153
|
-
"latest",
|
|
154
|
-
"current version",
|
|
155
|
-
"release note",
|
|
156
|
-
"official docs",
|
|
157
|
-
"web",
|
|
158
|
-
"cve",
|
|
159
|
-
"external",
|
|
160
|
-
"remote system",
|
|
161
|
-
"最新",
|
|
162
|
-
"当前版本",
|
|
163
|
-
"发布说明",
|
|
164
|
-
"官方文档",
|
|
165
|
-
"外部",
|
|
166
|
-
"远端系统",
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
def _utf8_key(value: str) -> bytes:
|
|
171
|
-
return value.encode("utf-8")
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def _copy_policy(policy: dict[str, object]) -> dict[str, object]:
|
|
175
|
-
destinations = cast(list[str], policy["egressDestinations"])
|
|
176
|
-
return {**policy, "egressDestinations": list(destinations)}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def _canonical_json(value: object) -> str:
|
|
180
|
-
return json.dumps(
|
|
181
|
-
value,
|
|
182
|
-
sort_keys=True,
|
|
183
|
-
ensure_ascii=False,
|
|
184
|
-
separators=(",", ":"),
|
|
185
|
-
allow_nan=False,
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def _is_plain_json_tree(
|
|
190
|
-
value: object,
|
|
191
|
-
*,
|
|
192
|
-
active: set[int] | None = None,
|
|
193
|
-
depth: int = 0,
|
|
194
|
-
counter: list[int] | None = None,
|
|
195
|
-
) -> bool:
|
|
196
|
-
"""Accept only finite builtin JSON trees and reject cycles/subclasses."""
|
|
197
|
-
if active is None:
|
|
198
|
-
active = set()
|
|
199
|
-
if counter is None:
|
|
200
|
-
counter = [0]
|
|
201
|
-
counter[0] += 1
|
|
202
|
-
if counter[0] > 100_000 or depth > 64:
|
|
203
|
-
return False
|
|
204
|
-
if value is None or type(value) in (str, bool, int):
|
|
205
|
-
return True
|
|
206
|
-
if type(value) is float:
|
|
207
|
-
return math.isfinite(value)
|
|
208
|
-
if type(value) not in (dict, list):
|
|
209
|
-
return False
|
|
210
|
-
identity = id(value)
|
|
211
|
-
if identity in active:
|
|
212
|
-
return False
|
|
213
|
-
active.add(identity)
|
|
214
|
-
try:
|
|
215
|
-
if type(value) is list:
|
|
216
|
-
items = cast(list[object], value)
|
|
217
|
-
return all(
|
|
218
|
-
_is_plain_json_tree(
|
|
219
|
-
item, active=active, depth=depth + 1, counter=counter
|
|
220
|
-
)
|
|
221
|
-
for item in items
|
|
222
|
-
)
|
|
223
|
-
mapping = cast(dict[object, object], value)
|
|
224
|
-
if any(
|
|
225
|
-
type(key) is not str or key in FORBIDDEN_JSON_KEYS
|
|
226
|
-
for key in mapping
|
|
227
|
-
):
|
|
228
|
-
return False
|
|
229
|
-
return all(
|
|
230
|
-
_is_plain_json_tree(
|
|
231
|
-
item, active=active, depth=depth + 1, counter=counter
|
|
232
|
-
)
|
|
233
|
-
for item in mapping.values()
|
|
234
|
-
)
|
|
235
|
-
finally:
|
|
236
|
-
active.remove(identity)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
def fingerprint_pactile_contract_v1(value: object) -> str:
|
|
240
|
-
digest = hashlib.sha256(_canonical_json(value).encode("utf-8")).hexdigest()
|
|
241
|
-
return f"sha256:{digest}"
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
def _issue(
|
|
245
|
-
issues: list[dict[str, str]], code: str, path: str, message: str
|
|
246
|
-
) -> None:
|
|
247
|
-
issues.append({"code": code, "path": path, "message": message})
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
def _sorted_issues(issues: list[dict[str, str]]) -> list[dict[str, str]]:
|
|
251
|
-
return sorted(issues, key=lambda item: (_utf8_key(item["path"]), _utf8_key(item["code"])))
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def _record(
|
|
255
|
-
value: object,
|
|
256
|
-
path: str,
|
|
257
|
-
allowed: tuple[str, ...],
|
|
258
|
-
issues: list[dict[str, str]],
|
|
259
|
-
) -> dict[str, object] | None:
|
|
260
|
-
if type(value) is not dict:
|
|
261
|
-
_issue(issues, "invalid-type", path, "must be an object")
|
|
262
|
-
return None
|
|
263
|
-
allowed_set = set(allowed)
|
|
264
|
-
output: dict[str, object] = {}
|
|
265
|
-
for key in sorted(value, key=_utf8_key):
|
|
266
|
-
if type(key) is not str:
|
|
267
|
-
_issue(issues, "unknown-field", path, "must contain only string fields")
|
|
268
|
-
elif key not in allowed_set:
|
|
269
|
-
_issue(issues, "unknown-field", path, "contains an unknown field")
|
|
270
|
-
else:
|
|
271
|
-
output[key] = value[key]
|
|
272
|
-
return output
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def _required(
|
|
276
|
-
record: dict[str, object] | None,
|
|
277
|
-
key: str,
|
|
278
|
-
path: str,
|
|
279
|
-
issues: list[dict[str, str]],
|
|
280
|
-
) -> object:
|
|
281
|
-
if record is None or key not in record:
|
|
282
|
-
_issue(issues, "missing-field", f"{path}.{key}", "is required")
|
|
283
|
-
return None
|
|
284
|
-
return record[key]
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
def _array(
|
|
288
|
-
value: object,
|
|
289
|
-
path: str,
|
|
290
|
-
issues: list[dict[str, str]],
|
|
291
|
-
max_items: int,
|
|
292
|
-
) -> list[object]:
|
|
293
|
-
if type(value) is not list:
|
|
294
|
-
_issue(issues, "invalid-type", path, "must be an array")
|
|
295
|
-
return []
|
|
296
|
-
if len(value) > max_items:
|
|
297
|
-
_issue(issues, "limit-exceeded", path, f"must contain at most {max_items} items")
|
|
298
|
-
return list(value[:max_items])
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
def _text(
|
|
302
|
-
value: object,
|
|
303
|
-
path: str,
|
|
304
|
-
issues: list[dict[str, str]],
|
|
305
|
-
*,
|
|
306
|
-
max_bytes: int,
|
|
307
|
-
collapse_whitespace: bool = False,
|
|
308
|
-
logical_id: bool = False,
|
|
309
|
-
) -> str:
|
|
310
|
-
if type(value) is not str:
|
|
311
|
-
_issue(issues, "invalid-type", path, "must be a string")
|
|
312
|
-
return ""
|
|
313
|
-
try:
|
|
314
|
-
value.encode("utf-8")
|
|
315
|
-
except UnicodeEncodeError:
|
|
316
|
-
_issue(issues, "invalid-value", path, "must contain valid Unicode scalar values")
|
|
317
|
-
return ""
|
|
318
|
-
normalized = (
|
|
319
|
-
re.sub(r"\s+", " ", value).strip() if collapse_whitespace else value.strip()
|
|
320
|
-
)
|
|
321
|
-
normalized = unicodedata.normalize("NFC", normalized)
|
|
322
|
-
if not normalized:
|
|
323
|
-
_issue(issues, "invalid-value", path, "must not be empty")
|
|
324
|
-
if any(unicodedata.category(character) == "Cc" for character in normalized):
|
|
325
|
-
_issue(issues, "invalid-value", path, "must not contain control characters")
|
|
326
|
-
if len(normalized.encode("utf-8")) > max_bytes:
|
|
327
|
-
_issue(issues, "limit-exceeded", path, f"must be at most {max_bytes} UTF-8 bytes")
|
|
328
|
-
if logical_id and normalized and LOGICAL_ID.fullmatch(normalized) is None:
|
|
329
|
-
_issue(issues, "invalid-value", path, "must be a lowercase logical id")
|
|
330
|
-
return normalized
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
def _enum(
|
|
334
|
-
value: object,
|
|
335
|
-
values: tuple[str, ...],
|
|
336
|
-
path: str,
|
|
337
|
-
issues: list[dict[str, str]],
|
|
338
|
-
) -> str:
|
|
339
|
-
if type(value) is not str or value not in values:
|
|
340
|
-
_issue(issues, "invalid-value", path, f"must be one of: {', '.join(values)}")
|
|
341
|
-
return values[0]
|
|
342
|
-
return value
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
def _integer(
|
|
346
|
-
value: object,
|
|
347
|
-
path: str,
|
|
348
|
-
issues: list[dict[str, str]],
|
|
349
|
-
minimum: int,
|
|
350
|
-
maximum: int,
|
|
351
|
-
) -> int:
|
|
352
|
-
if type(value) is not int or value < minimum or value > maximum:
|
|
353
|
-
_issue(
|
|
354
|
-
issues,
|
|
355
|
-
"invalid-value",
|
|
356
|
-
path,
|
|
357
|
-
f"must be a safe integer from {minimum} through {maximum}",
|
|
358
|
-
)
|
|
359
|
-
return minimum
|
|
360
|
-
return value
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
def _string_set(
|
|
364
|
-
value: object,
|
|
365
|
-
path: str,
|
|
366
|
-
issues: list[dict[str, str]],
|
|
367
|
-
*,
|
|
368
|
-
max_items: int,
|
|
369
|
-
max_bytes: int,
|
|
370
|
-
logical_id: bool = False,
|
|
371
|
-
) -> list[str]:
|
|
372
|
-
raw = _array(value, path, issues, max_items)
|
|
373
|
-
normalized = [
|
|
374
|
-
_text(
|
|
375
|
-
item,
|
|
376
|
-
f"{path}[{index}]",
|
|
377
|
-
issues,
|
|
378
|
-
max_bytes=max_bytes,
|
|
379
|
-
logical_id=logical_id,
|
|
380
|
-
)
|
|
381
|
-
for index, item in enumerate(raw)
|
|
382
|
-
]
|
|
383
|
-
seen: set[str] = set()
|
|
384
|
-
for index, item in enumerate(normalized):
|
|
385
|
-
if item in seen:
|
|
386
|
-
_issue(
|
|
387
|
-
issues,
|
|
388
|
-
"duplicate-value",
|
|
389
|
-
f"{path}[{index}]",
|
|
390
|
-
"must be unique after normalization",
|
|
391
|
-
)
|
|
392
|
-
seen.add(item)
|
|
393
|
-
return sorted(normalized, key=_utf8_key)
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
def _policy(
|
|
397
|
-
value: object, path: str, issues: list[dict[str, str]]
|
|
398
|
-
) -> dict[str, object]:
|
|
399
|
-
allowed = (
|
|
400
|
-
"filesystem",
|
|
401
|
-
"process",
|
|
402
|
-
"network",
|
|
403
|
-
"credentials",
|
|
404
|
-
"privacy",
|
|
405
|
-
"egressDestinations",
|
|
406
|
-
"telemetry",
|
|
407
|
-
"cost",
|
|
408
|
-
)
|
|
409
|
-
record = _record(value, path, allowed, issues)
|
|
410
|
-
policy: dict[str, object] = {
|
|
411
|
-
"filesystem": _enum(
|
|
412
|
-
_required(record, "filesystem", path, issues),
|
|
413
|
-
FILESYSTEM_CEILINGS,
|
|
414
|
-
f"{path}.filesystem",
|
|
415
|
-
issues,
|
|
416
|
-
),
|
|
417
|
-
"process": _enum(
|
|
418
|
-
_required(record, "process", path, issues),
|
|
419
|
-
PROCESS_CEILINGS,
|
|
420
|
-
f"{path}.process",
|
|
421
|
-
issues,
|
|
422
|
-
),
|
|
423
|
-
"network": _enum(
|
|
424
|
-
_required(record, "network", path, issues),
|
|
425
|
-
NETWORK_CEILINGS,
|
|
426
|
-
f"{path}.network",
|
|
427
|
-
issues,
|
|
428
|
-
),
|
|
429
|
-
"credentials": _enum(
|
|
430
|
-
_required(record, "credentials", path, issues),
|
|
431
|
-
CREDENTIAL_CEILINGS,
|
|
432
|
-
f"{path}.credentials",
|
|
433
|
-
issues,
|
|
434
|
-
),
|
|
435
|
-
"privacy": _enum(
|
|
436
|
-
_required(record, "privacy", path, issues),
|
|
437
|
-
PRIVACY_CEILINGS,
|
|
438
|
-
f"{path}.privacy",
|
|
439
|
-
issues,
|
|
440
|
-
),
|
|
441
|
-
"egressDestinations": _string_set(
|
|
442
|
-
_required(record, "egressDestinations", path, issues),
|
|
443
|
-
f"{path}.egressDestinations",
|
|
444
|
-
issues,
|
|
445
|
-
max_items=64,
|
|
446
|
-
max_bytes=256,
|
|
447
|
-
),
|
|
448
|
-
"telemetry": _enum(
|
|
449
|
-
_required(record, "telemetry", path, issues),
|
|
450
|
-
TELEMETRY_CEILINGS,
|
|
451
|
-
f"{path}.telemetry",
|
|
452
|
-
issues,
|
|
453
|
-
),
|
|
454
|
-
"cost": _enum(
|
|
455
|
-
_required(record, "cost", path, issues),
|
|
456
|
-
COST_CEILINGS,
|
|
457
|
-
f"{path}.cost",
|
|
458
|
-
issues,
|
|
459
|
-
),
|
|
460
|
-
}
|
|
461
|
-
if policy["network"] == "forbidden" and (
|
|
462
|
-
policy["privacy"] != "local-only" or policy["egressDestinations"]
|
|
463
|
-
):
|
|
464
|
-
_issue(
|
|
465
|
-
issues,
|
|
466
|
-
"policy-violation",
|
|
467
|
-
f"{path}.privacy",
|
|
468
|
-
"network-forbidden policy cannot permit egress",
|
|
469
|
-
)
|
|
470
|
-
if (
|
|
471
|
-
policy["network"] == "project-authorized"
|
|
472
|
-
and policy["privacy"] != "local-only"
|
|
473
|
-
and not policy["egressDestinations"]
|
|
474
|
-
):
|
|
475
|
-
_issue(
|
|
476
|
-
issues,
|
|
477
|
-
"policy-violation",
|
|
478
|
-
f"{path}.egressDestinations",
|
|
479
|
-
"external egress requires at least one destination",
|
|
480
|
-
)
|
|
481
|
-
if policy["network"] == "forbidden" and policy["telemetry"] == "project-authorized":
|
|
482
|
-
_issue(
|
|
483
|
-
issues,
|
|
484
|
-
"policy-violation",
|
|
485
|
-
f"{path}.telemetry",
|
|
486
|
-
"network-forbidden policy cannot permit remote telemetry",
|
|
487
|
-
)
|
|
488
|
-
return policy
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
def _budget(
|
|
492
|
-
value: object, path: str, issues: list[dict[str, str]]
|
|
493
|
-
) -> dict[str, int]:
|
|
494
|
-
record = _record(value, path, ("maxSteps", "maxCandidatesPerStep"), issues)
|
|
495
|
-
return {
|
|
496
|
-
"maxSteps": _integer(
|
|
497
|
-
_required(record, "maxSteps", path, issues),
|
|
498
|
-
f"{path}.maxSteps",
|
|
499
|
-
issues,
|
|
500
|
-
1,
|
|
501
|
-
32,
|
|
502
|
-
),
|
|
503
|
-
"maxCandidatesPerStep": _integer(
|
|
504
|
-
_required(record, "maxCandidatesPerStep", path, issues),
|
|
505
|
-
f"{path}.maxCandidatesPerStep",
|
|
506
|
-
issues,
|
|
507
|
-
1,
|
|
508
|
-
1000,
|
|
509
|
-
),
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
def _intents(
|
|
514
|
-
value: object, path: str, issues: list[dict[str, str]]
|
|
515
|
-
) -> list[str]:
|
|
516
|
-
raw = _array(value, path, issues, len(INTENT_ORDER))
|
|
517
|
-
if not raw:
|
|
518
|
-
_issue(issues, "invalid-value", path, "must contain at least one intent")
|
|
519
|
-
values = [
|
|
520
|
-
_enum(item, INTENT_ORDER, f"{path}[{index}]", issues)
|
|
521
|
-
for index, item in enumerate(raw)
|
|
522
|
-
]
|
|
523
|
-
seen: set[str] = set()
|
|
524
|
-
for index, item in enumerate(values):
|
|
525
|
-
if item in seen:
|
|
526
|
-
_issue(issues, "duplicate-value", f"{path}[{index}]", "must be unique")
|
|
527
|
-
seen.add(item)
|
|
528
|
-
return [intent for intent in INTENT_ORDER if intent in seen]
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
def parse_retrieval_request_v3(value: object) -> dict[str, object]:
|
|
532
|
-
"""Strictly parse and canonicalize a V3 request."""
|
|
533
|
-
if type(value) is not dict or not _is_plain_json_tree(value):
|
|
534
|
-
return {
|
|
535
|
-
"success": False,
|
|
536
|
-
"issues": [
|
|
537
|
-
{
|
|
538
|
-
"code": "invalid-type",
|
|
539
|
-
"path": "$",
|
|
540
|
-
"message": "must be a plain data value",
|
|
541
|
-
}
|
|
542
|
-
],
|
|
543
|
-
}
|
|
544
|
-
issues: list[dict[str, str]] = []
|
|
545
|
-
try:
|
|
546
|
-
record = _record(
|
|
547
|
-
value,
|
|
548
|
-
"$",
|
|
549
|
-
(
|
|
550
|
-
"schemaVersion",
|
|
551
|
-
"query",
|
|
552
|
-
"intents",
|
|
553
|
-
"scopeHints",
|
|
554
|
-
"minimumAssurance",
|
|
555
|
-
"requestedPolicy",
|
|
556
|
-
"requiredEvidenceKinds",
|
|
557
|
-
"budget",
|
|
558
|
-
),
|
|
559
|
-
issues,
|
|
560
|
-
)
|
|
561
|
-
schema_version = _required(record, "schemaVersion", "$", issues)
|
|
562
|
-
if type(schema_version) is not int or schema_version != RETRIEVAL_ABI_VERSION:
|
|
563
|
-
_issue(issues, "invalid-value", "$.schemaVersion", "must equal 3")
|
|
564
|
-
query = _text(
|
|
565
|
-
_required(record, "query", "$", issues),
|
|
566
|
-
"$.query",
|
|
567
|
-
issues,
|
|
568
|
-
max_bytes=MAX_QUERY_BYTES,
|
|
569
|
-
collapse_whitespace=True,
|
|
570
|
-
)
|
|
571
|
-
intents = _intents(_required(record, "intents", "$", issues), "$.intents", issues)
|
|
572
|
-
scope_hints = _string_set(
|
|
573
|
-
_required(record, "scopeHints", "$", issues),
|
|
574
|
-
"$.scopeHints",
|
|
575
|
-
issues,
|
|
576
|
-
max_items=MAX_SCOPE_HINTS,
|
|
577
|
-
max_bytes=MAX_SCOPE_HINT_BYTES,
|
|
578
|
-
)
|
|
579
|
-
minimum_assurance = _enum(
|
|
580
|
-
_required(record, "minimumAssurance", "$", issues),
|
|
581
|
-
ASSURANCE_LEVELS,
|
|
582
|
-
"$.minimumAssurance",
|
|
583
|
-
issues,
|
|
584
|
-
)
|
|
585
|
-
requested_policy = _policy(
|
|
586
|
-
_required(record, "requestedPolicy", "$", issues),
|
|
587
|
-
"$.requestedPolicy",
|
|
588
|
-
issues,
|
|
589
|
-
)
|
|
590
|
-
required_evidence_kinds = _string_set(
|
|
591
|
-
_required(record, "requiredEvidenceKinds", "$", issues),
|
|
592
|
-
"$.requiredEvidenceKinds",
|
|
593
|
-
issues,
|
|
594
|
-
max_items=MAX_EVIDENCE_KINDS,
|
|
595
|
-
max_bytes=MAX_LOGICAL_ID_BYTES,
|
|
596
|
-
logical_id=True,
|
|
597
|
-
)
|
|
598
|
-
if minimum_assurance != "best-effort" and not required_evidence_kinds:
|
|
599
|
-
_issue(
|
|
600
|
-
issues,
|
|
601
|
-
"policy-violation",
|
|
602
|
-
"$.requiredEvidenceKinds",
|
|
603
|
-
"evidence-backed and verified requests require evidence kinds",
|
|
604
|
-
)
|
|
605
|
-
budget = _budget(_required(record, "budget", "$", issues), "$.budget", issues)
|
|
606
|
-
if issues:
|
|
607
|
-
return {"success": False, "issues": _sorted_issues(issues)}
|
|
608
|
-
return {
|
|
609
|
-
"success": True,
|
|
610
|
-
"data": {
|
|
611
|
-
"schemaVersion": RETRIEVAL_ABI_VERSION,
|
|
612
|
-
"query": query,
|
|
613
|
-
"intents": intents,
|
|
614
|
-
"scopeHints": scope_hints,
|
|
615
|
-
"minimumAssurance": minimum_assurance,
|
|
616
|
-
"requestedPolicy": requested_policy,
|
|
617
|
-
"requiredEvidenceKinds": required_evidence_kinds,
|
|
618
|
-
"budget": budget,
|
|
619
|
-
},
|
|
620
|
-
}
|
|
621
|
-
except (AttributeError, KeyError, TypeError, UnicodeError, ValueError):
|
|
622
|
-
return {
|
|
623
|
-
"success": False,
|
|
624
|
-
"issues": [
|
|
625
|
-
{
|
|
626
|
-
"code": "invalid-type",
|
|
627
|
-
"path": "$",
|
|
628
|
-
"message": "must be a plain data value",
|
|
629
|
-
}
|
|
630
|
-
],
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
def classify_codebase_retrieval_intents(query: str) -> list[str]:
|
|
635
|
-
"""Return the four canonical intents in frozen order."""
|
|
636
|
-
normalized = unicodedata.normalize("NFC", re.sub(r"\s+", " ", query).strip()).lower()
|
|
637
|
-
matched: set[str] = set()
|
|
638
|
-
if any(signal in normalized for signal in EXACT_SIGNALS):
|
|
639
|
-
matched.add("exact")
|
|
640
|
-
if any(signal in normalized for signal in SEMANTIC_SIGNALS):
|
|
641
|
-
matched.add("semantic")
|
|
642
|
-
if any(signal in normalized for signal in STRUCTURAL_SIGNALS):
|
|
643
|
-
matched.add("structural")
|
|
644
|
-
if any(signal in normalized for signal in EXTERNAL_SIGNALS):
|
|
645
|
-
matched.add("external")
|
|
646
|
-
if not matched:
|
|
647
|
-
matched.add("exact")
|
|
648
|
-
return [intent for intent in INTENT_ORDER if intent in matched]
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
def build_retrieval_request_v3(
|
|
652
|
-
query: str,
|
|
653
|
-
*,
|
|
654
|
-
intents: list[str] | tuple[str, ...] | None = None,
|
|
655
|
-
scope_hints: list[str] | tuple[str, ...] | None = None,
|
|
656
|
-
minimum_assurance: str = "evidence-backed",
|
|
657
|
-
requested_policy: dict[str, object] | None = None,
|
|
658
|
-
required_evidence_kinds: list[str] | tuple[str, ...] | None = None,
|
|
659
|
-
budget: dict[str, int] | None = None,
|
|
660
|
-
) -> dict[str, object]:
|
|
661
|
-
candidate: dict[str, object] = {
|
|
662
|
-
"schemaVersion": RETRIEVAL_ABI_VERSION,
|
|
663
|
-
"query": query,
|
|
664
|
-
"intents": list(intents) if intents is not None else classify_codebase_retrieval_intents(query),
|
|
665
|
-
"scopeHints": list(scope_hints if scope_hints is not None else []),
|
|
666
|
-
"minimumAssurance": minimum_assurance,
|
|
667
|
-
"requestedPolicy": _copy_policy(
|
|
668
|
-
requested_policy
|
|
669
|
-
if requested_policy is not None
|
|
670
|
-
else DEFAULT_RETRIEVAL_POLICY_V3
|
|
671
|
-
),
|
|
672
|
-
"requiredEvidenceKinds": list(
|
|
673
|
-
required_evidence_kinds
|
|
674
|
-
if required_evidence_kinds is not None
|
|
675
|
-
else ("source-reference",)
|
|
676
|
-
),
|
|
677
|
-
"budget": dict(budget if budget is not None else DEFAULT_RETRIEVAL_BUDGET_V3),
|
|
678
|
-
}
|
|
679
|
-
parsed = parse_retrieval_request_v3(candidate)
|
|
680
|
-
if not parsed["success"]:
|
|
681
|
-
raise ValueError(
|
|
682
|
-
"PACTILE_RETRIEVAL_REQUEST_INVALID:" + _canonical_json(parsed["issues"])
|
|
683
|
-
)
|
|
684
|
-
return dict(cast(dict[str, object], parsed["data"]))
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
def _parse_planning_context(value: object) -> dict[str, object]:
|
|
688
|
-
if type(value) is not dict or not _is_plain_json_tree(value):
|
|
689
|
-
return {
|
|
690
|
-
"success": False,
|
|
691
|
-
"issues": [
|
|
692
|
-
{
|
|
693
|
-
"code": "invalid-type",
|
|
694
|
-
"path": "$context",
|
|
695
|
-
"message": "must be a plain data value",
|
|
696
|
-
}
|
|
697
|
-
],
|
|
698
|
-
}
|
|
699
|
-
issues: list[dict[str, str]] = []
|
|
700
|
-
try:
|
|
701
|
-
record = _record(value, "$context", ("providerAvailability",), issues)
|
|
702
|
-
raw = record.get("providerAvailability", []) if record is not None else []
|
|
703
|
-
entries = _array(raw, "$context.providerAvailability", issues, 3)
|
|
704
|
-
output: list[dict[str, object]] = []
|
|
705
|
-
seen: set[str] = set()
|
|
706
|
-
for index, entry in enumerate(entries):
|
|
707
|
-
path = f"$context.providerAvailability[{index}]"
|
|
708
|
-
item = _record(entry, path, ("intent", "status", "readiness"), issues)
|
|
709
|
-
intent = _enum(
|
|
710
|
-
_required(item, "intent", path, issues),
|
|
711
|
-
PROVIDER_INTENTS,
|
|
712
|
-
f"{path}.intent",
|
|
713
|
-
issues,
|
|
714
|
-
)
|
|
715
|
-
status = _enum(
|
|
716
|
-
_required(item, "status", path, issues),
|
|
717
|
-
PROVIDER_STATUSES[1:],
|
|
718
|
-
f"{path}.status",
|
|
719
|
-
issues,
|
|
720
|
-
)
|
|
721
|
-
readiness_raw = item.get("readiness") if item is not None else None
|
|
722
|
-
readiness = (
|
|
723
|
-
None
|
|
724
|
-
if readiness_raw is None
|
|
725
|
-
else _enum(readiness_raw, PROVIDER_READINESS, f"{path}.readiness", issues)
|
|
726
|
-
)
|
|
727
|
-
if intent in seen:
|
|
728
|
-
_issue(issues, "duplicate-value", f"{path}.intent", "must be unique")
|
|
729
|
-
seen.add(intent)
|
|
730
|
-
if readiness is not None and status != "unsupported" and status != readiness:
|
|
731
|
-
_issue(
|
|
732
|
-
issues,
|
|
733
|
-
"policy-violation",
|
|
734
|
-
f"{path}.readiness",
|
|
735
|
-
"must agree with the neutral provider status",
|
|
736
|
-
)
|
|
737
|
-
if status == "unsupported" and readiness not in (None, "unavailable"):
|
|
738
|
-
_issue(
|
|
739
|
-
issues,
|
|
740
|
-
"policy-violation",
|
|
741
|
-
f"{path}.readiness",
|
|
742
|
-
"unsupported intent may only report unavailable readiness",
|
|
743
|
-
)
|
|
744
|
-
value_out: dict[str, object] = {"intent": intent, "status": status}
|
|
745
|
-
if readiness is not None:
|
|
746
|
-
value_out["readiness"] = readiness
|
|
747
|
-
output.append(value_out)
|
|
748
|
-
if issues:
|
|
749
|
-
return {"success": False, "issues": _sorted_issues(issues)}
|
|
750
|
-
ordered = [
|
|
751
|
-
entry
|
|
752
|
-
for intent in PROVIDER_INTENTS
|
|
753
|
-
for entry in output
|
|
754
|
-
if entry["intent"] == intent
|
|
755
|
-
]
|
|
756
|
-
return {"success": True, "data": ordered}
|
|
757
|
-
except (AttributeError, KeyError, TypeError, UnicodeError, ValueError):
|
|
758
|
-
return {
|
|
759
|
-
"success": False,
|
|
760
|
-
"issues": [
|
|
761
|
-
{
|
|
762
|
-
"code": "invalid-type",
|
|
763
|
-
"path": "$context",
|
|
764
|
-
"message": "must be a plain data value",
|
|
765
|
-
}
|
|
766
|
-
],
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
def _status_reason(intent: str, status: str) -> dict[str, object] | None:
|
|
771
|
-
codes = {
|
|
772
|
-
"resolution-required": "provider-resolution-required",
|
|
773
|
-
"degraded": "provider-degraded",
|
|
774
|
-
"unavailable": "provider-unavailable",
|
|
775
|
-
"unsupported": "provider-unsupported",
|
|
776
|
-
}
|
|
777
|
-
code = codes.get(status)
|
|
778
|
-
return None if code is None else {"code": code, "intent": intent, "blocking": True}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
def _build_plan(
|
|
782
|
-
request: dict[str, object], availability: list[dict[str, object]]
|
|
783
|
-
) -> dict[str, object]:
|
|
784
|
-
request_intents = cast(list[str], request["intents"])
|
|
785
|
-
request_scope_hints = cast(list[str], request["scopeHints"])
|
|
786
|
-
requested_policy = cast(dict[str, object], request["requestedPolicy"])
|
|
787
|
-
required_evidence_kinds = cast(list[str], request["requiredEvidenceKinds"])
|
|
788
|
-
request_budget = cast(dict[str, int], request["budget"])
|
|
789
|
-
statuses = {str(entry["intent"]): str(entry["status"]) for entry in availability}
|
|
790
|
-
all_steps: list[dict[str, object]] = []
|
|
791
|
-
for index, raw_intent in enumerate(request_intents):
|
|
792
|
-
intent = str(raw_intent)
|
|
793
|
-
if intent == "exact":
|
|
794
|
-
all_steps.append(
|
|
795
|
-
{
|
|
796
|
-
"order": index + 1,
|
|
797
|
-
"intent": intent,
|
|
798
|
-
"kind": "local-exact",
|
|
799
|
-
"localToolHint": "rg",
|
|
800
|
-
"providerRequirement": None,
|
|
801
|
-
"outputRole": "candidate",
|
|
802
|
-
}
|
|
803
|
-
)
|
|
804
|
-
continue
|
|
805
|
-
status = statuses.get(intent, "resolution-required")
|
|
806
|
-
all_steps.append(
|
|
807
|
-
{
|
|
808
|
-
"order": index + 1,
|
|
809
|
-
"intent": intent,
|
|
810
|
-
"kind": "provider-request",
|
|
811
|
-
"localToolHint": None,
|
|
812
|
-
"providerRequirement": {
|
|
813
|
-
"intent": intent,
|
|
814
|
-
"minimumAssurance": request["minimumAssurance"],
|
|
815
|
-
"requestedPolicy": _copy_policy(requested_policy),
|
|
816
|
-
"requiredEvidenceKinds": list(required_evidence_kinds),
|
|
817
|
-
"status": status,
|
|
818
|
-
},
|
|
819
|
-
"outputRole": "candidate",
|
|
820
|
-
}
|
|
821
|
-
)
|
|
822
|
-
steps = [
|
|
823
|
-
{**step, "order": index + 1}
|
|
824
|
-
for index, step in enumerate(all_steps[: request_budget["maxSteps"]])
|
|
825
|
-
]
|
|
826
|
-
stop_reasons: list[dict[str, object]] = []
|
|
827
|
-
if len(steps) < len(all_steps):
|
|
828
|
-
stop_reasons.append({"code": "budget-exhausted", "intent": None, "blocking": True})
|
|
829
|
-
for step in steps:
|
|
830
|
-
requirement = step["providerRequirement"]
|
|
831
|
-
if type(requirement) is dict:
|
|
832
|
-
reason = _status_reason(str(requirement["intent"]), str(requirement["status"]))
|
|
833
|
-
if reason is not None:
|
|
834
|
-
stop_reasons.append(reason)
|
|
835
|
-
plan: dict[str, object] = {
|
|
836
|
-
"schemaVersion": RETRIEVAL_ABI_VERSION,
|
|
837
|
-
"query": request["query"],
|
|
838
|
-
"intents": list(request_intents),
|
|
839
|
-
"scopeHints": list(request_scope_hints),
|
|
840
|
-
"minimumAssurance": request["minimumAssurance"],
|
|
841
|
-
"requestedPolicy": _copy_policy(requested_policy),
|
|
842
|
-
"requiredEvidenceKinds": list(required_evidence_kinds),
|
|
843
|
-
"budget": dict(request_budget),
|
|
844
|
-
"steps": steps,
|
|
845
|
-
"verificationChain": [
|
|
846
|
-
{
|
|
847
|
-
"order": 1,
|
|
848
|
-
"stage": "candidate",
|
|
849
|
-
"required": True,
|
|
850
|
-
"acceptableEvidenceKinds": [],
|
|
851
|
-
},
|
|
852
|
-
*[
|
|
853
|
-
{
|
|
854
|
-
"order": order,
|
|
855
|
-
"stage": stage,
|
|
856
|
-
"required": True,
|
|
857
|
-
"acceptableEvidenceKinds": list(CORROBORATION_KINDS),
|
|
858
|
-
}
|
|
859
|
-
for order, stage in (
|
|
860
|
-
(2, "corroborate"),
|
|
861
|
-
(3, "classify-evidence"),
|
|
862
|
-
(4, "check-assurance"),
|
|
863
|
-
(5, "accept-or-stop"),
|
|
864
|
-
)
|
|
865
|
-
],
|
|
866
|
-
],
|
|
867
|
-
"stopReasons": stop_reasons,
|
|
868
|
-
}
|
|
869
|
-
plan["fingerprint"] = fingerprint_pactile_contract_v1(plan)
|
|
870
|
-
return plan
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
def plan_retrieval_v3(
|
|
874
|
-
request: object, context: object = _MISSING_CONTEXT
|
|
875
|
-
) -> dict[str, object]:
|
|
876
|
-
parsed = parse_retrieval_request_v3(request)
|
|
877
|
-
if not parsed["success"]:
|
|
878
|
-
return parsed
|
|
879
|
-
context_value: object = {} if context is _MISSING_CONTEXT else context
|
|
880
|
-
availability = _parse_planning_context(context_value)
|
|
881
|
-
if not availability["success"]:
|
|
882
|
-
return availability
|
|
883
|
-
return {
|
|
884
|
-
"success": True,
|
|
885
|
-
"data": _build_plan(
|
|
886
|
-
dict(cast(dict[str, object], parsed["data"])),
|
|
887
|
-
list(cast(list[dict[str, object]], availability["data"])),
|
|
888
|
-
),
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
def route_codebase_retrieval(
|
|
893
|
-
query: str,
|
|
894
|
-
*,
|
|
895
|
-
intents: list[str] | tuple[str, ...] | None = None,
|
|
896
|
-
scope_hints: list[str] | tuple[str, ...] | None = None,
|
|
897
|
-
minimum_assurance: str = "evidence-backed",
|
|
898
|
-
requested_policy: dict[str, object] | None = None,
|
|
899
|
-
required_evidence_kinds: list[str] | tuple[str, ...] | None = None,
|
|
900
|
-
budget: dict[str, int] | None = None,
|
|
901
|
-
provider_availability: list[dict[str, object]] | None = None,
|
|
902
|
-
**_compatibility_metadata: object,
|
|
903
|
-
) -> dict[str, object]:
|
|
904
|
-
"""Build a deterministic V3 plan; compatibility metadata has no effect."""
|
|
905
|
-
request = build_retrieval_request_v3(
|
|
906
|
-
query,
|
|
907
|
-
intents=intents,
|
|
908
|
-
scope_hints=scope_hints,
|
|
909
|
-
minimum_assurance=minimum_assurance,
|
|
910
|
-
requested_policy=requested_policy,
|
|
911
|
-
required_evidence_kinds=required_evidence_kinds,
|
|
912
|
-
budget=budget,
|
|
913
|
-
)
|
|
914
|
-
result = plan_retrieval_v3(
|
|
915
|
-
request,
|
|
916
|
-
{
|
|
917
|
-
"providerAvailability": list(provider_availability)
|
|
918
|
-
if provider_availability is not None
|
|
919
|
-
else []
|
|
920
|
-
},
|
|
921
|
-
)
|
|
922
|
-
if not result["success"]:
|
|
923
|
-
raise ValueError("PACTILE_RETRIEVAL_PLAN_INVALID:" + _canonical_json(result["issues"]))
|
|
924
|
-
return dict(cast(dict[str, object], result["data"]))
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
def _normalized_refs(values: object) -> list[str] | None:
|
|
928
|
-
if type(values) is not list or len(values) > 1024:
|
|
929
|
-
return None
|
|
930
|
-
output: list[str] = []
|
|
931
|
-
for value in values:
|
|
932
|
-
if type(value) is not str or not _valid_logical_ref(value):
|
|
933
|
-
return None
|
|
934
|
-
output.append(value)
|
|
935
|
-
return sorted(set(output), key=_utf8_key)
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
def _normalized_facts(values: object) -> list[dict[str, str]] | None:
|
|
939
|
-
if type(values) is not list or len(values) > 1024:
|
|
940
|
-
return None
|
|
941
|
-
output: list[dict[str, str]] = []
|
|
942
|
-
seen: set[tuple[str, str]] = set()
|
|
943
|
-
for value in values:
|
|
944
|
-
if type(value) is not dict or set(value) != {"kind", "ref"}:
|
|
945
|
-
return None
|
|
946
|
-
kind = value["kind"]
|
|
947
|
-
ref = value["ref"]
|
|
948
|
-
if (
|
|
949
|
-
type(kind) is not str
|
|
950
|
-
or LOGICAL_ID.fullmatch(kind) is None
|
|
951
|
-
or type(ref) is not str
|
|
952
|
-
or not _valid_logical_ref(ref)
|
|
953
|
-
):
|
|
954
|
-
return None
|
|
955
|
-
identity = (kind, ref)
|
|
956
|
-
if identity not in seen:
|
|
957
|
-
seen.add(identity)
|
|
958
|
-
output.append({"kind": kind, "ref": ref})
|
|
959
|
-
return sorted(output, key=lambda item: (_utf8_key(item["kind"]), _utf8_key(item["ref"])))
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
def _valid_plan(plan: object, intent: str) -> bool:
|
|
963
|
-
expected_keys = {
|
|
964
|
-
"schemaVersion",
|
|
965
|
-
"query",
|
|
966
|
-
"intents",
|
|
967
|
-
"scopeHints",
|
|
968
|
-
"minimumAssurance",
|
|
969
|
-
"requestedPolicy",
|
|
970
|
-
"requiredEvidenceKinds",
|
|
971
|
-
"budget",
|
|
972
|
-
"steps",
|
|
973
|
-
"verificationChain",
|
|
974
|
-
"stopReasons",
|
|
975
|
-
"fingerprint",
|
|
976
|
-
}
|
|
977
|
-
if (
|
|
978
|
-
type(plan) is not dict
|
|
979
|
-
or not _is_plain_json_tree(plan)
|
|
980
|
-
or set(plan) != expected_keys
|
|
981
|
-
or type(plan.get("intents")) is not list
|
|
982
|
-
or intent not in plan["intents"]
|
|
983
|
-
or type(plan.get("steps")) is not list
|
|
984
|
-
):
|
|
985
|
-
return False
|
|
986
|
-
request = {
|
|
987
|
-
key: plan[key]
|
|
988
|
-
for key in (
|
|
989
|
-
"schemaVersion",
|
|
990
|
-
"query",
|
|
991
|
-
"intents",
|
|
992
|
-
"scopeHints",
|
|
993
|
-
"minimumAssurance",
|
|
994
|
-
"requestedPolicy",
|
|
995
|
-
"requiredEvidenceKinds",
|
|
996
|
-
"budget",
|
|
997
|
-
)
|
|
998
|
-
}
|
|
999
|
-
availability: list[dict[str, object]] = []
|
|
1000
|
-
for candidate in cast(list[object], plan["steps"]):
|
|
1001
|
-
if type(candidate) is not dict:
|
|
1002
|
-
return False
|
|
1003
|
-
requirement = candidate.get("providerRequirement")
|
|
1004
|
-
if requirement is None:
|
|
1005
|
-
continue
|
|
1006
|
-
if type(requirement) is not dict:
|
|
1007
|
-
return False
|
|
1008
|
-
provider_intent = requirement.get("intent")
|
|
1009
|
-
status = requirement.get("status")
|
|
1010
|
-
if provider_intent not in PROVIDER_INTENTS or status not in PROVIDER_STATUSES:
|
|
1011
|
-
return False
|
|
1012
|
-
if status != "resolution-required":
|
|
1013
|
-
availability.append(
|
|
1014
|
-
{
|
|
1015
|
-
"intent": provider_intent,
|
|
1016
|
-
"status": status,
|
|
1017
|
-
"readiness": "unavailable" if status == "unsupported" else status,
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
1020
|
-
replanned = plan_retrieval_v3(
|
|
1021
|
-
request, {"providerAvailability": availability}
|
|
1022
|
-
)
|
|
1023
|
-
return bool(replanned.get("success") and replanned.get("data") == plan)
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
def _valid_logical_ref(value: str) -> bool:
|
|
1027
|
-
if len(value) > 256:
|
|
1028
|
-
return False
|
|
1029
|
-
match = LOGICAL_REF.fullmatch(value)
|
|
1030
|
-
if match is None:
|
|
1031
|
-
return False
|
|
1032
|
-
return not any(
|
|
1033
|
-
term in SENSITIVE_REFERENCE_TERMS
|
|
1034
|
-
for term in re.split(r"[._/-]", match.group(1))
|
|
1035
|
-
)
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
def _valid_core_string_array(value: object) -> bool:
|
|
1039
|
-
return (
|
|
1040
|
-
type(value) is list
|
|
1041
|
-
and all(type(item) is str and bool(item.strip()) for item in value)
|
|
1042
|
-
and len(value) == len(set(value))
|
|
1043
|
-
)
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
def _valid_timestamp(value: object) -> bool:
|
|
1047
|
-
if type(value) is not str or RFC3339.fullmatch(value) is None:
|
|
1048
|
-
return False
|
|
1049
|
-
try:
|
|
1050
|
-
datetime.fromisoformat(value.replace("Z", "+00:00"))
|
|
1051
|
-
except ValueError:
|
|
1052
|
-
return False
|
|
1053
|
-
return True
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
def _parsed_policy(value: object) -> dict[str, object] | None:
|
|
1057
|
-
issues: list[dict[str, str]] = []
|
|
1058
|
-
parsed = _policy(value, "$policy", issues)
|
|
1059
|
-
return None if issues else parsed
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
def _policy_within(requested: dict[str, object], ceiling: dict[str, object]) -> bool:
|
|
1063
|
-
dimensions = (
|
|
1064
|
-
("filesystem", FILESYSTEM_CEILINGS),
|
|
1065
|
-
("process", PROCESS_CEILINGS),
|
|
1066
|
-
("network", NETWORK_CEILINGS),
|
|
1067
|
-
("credentials", CREDENTIAL_CEILINGS),
|
|
1068
|
-
("privacy", PRIVACY_CEILINGS),
|
|
1069
|
-
("telemetry", TELEMETRY_CEILINGS),
|
|
1070
|
-
("cost", COST_CEILINGS),
|
|
1071
|
-
)
|
|
1072
|
-
try:
|
|
1073
|
-
if any(
|
|
1074
|
-
values.index(str(requested[key])) > values.index(str(ceiling[key]))
|
|
1075
|
-
for key, values in dimensions
|
|
1076
|
-
):
|
|
1077
|
-
return False
|
|
1078
|
-
requested_destinations = cast(list[str], requested["egressDestinations"])
|
|
1079
|
-
ceiling_destinations = cast(list[str], ceiling["egressDestinations"])
|
|
1080
|
-
return all(destination in ceiling_destinations for destination in requested_destinations)
|
|
1081
|
-
except (KeyError, TypeError, ValueError):
|
|
1082
|
-
return False
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
def _valid_resolution(plan: dict[str, object], intent: str, value: object) -> bool:
|
|
1086
|
-
required_keys = {
|
|
1087
|
-
"schemaVersion",
|
|
1088
|
-
"intent",
|
|
1089
|
-
"minimumAssurance",
|
|
1090
|
-
"origin",
|
|
1091
|
-
"providerId",
|
|
1092
|
-
"providerVersion",
|
|
1093
|
-
"assurance",
|
|
1094
|
-
"readiness",
|
|
1095
|
-
"requestedPolicy",
|
|
1096
|
-
"effectivePolicy",
|
|
1097
|
-
"evidenceRefs",
|
|
1098
|
-
"freshness",
|
|
1099
|
-
"probedAt",
|
|
1100
|
-
"probeResult",
|
|
1101
|
-
"fallbackFromProviderId",
|
|
1102
|
-
}
|
|
1103
|
-
if (
|
|
1104
|
-
type(value) is not dict
|
|
1105
|
-
or not _is_plain_json_tree(value)
|
|
1106
|
-
or set(value) != required_keys
|
|
1107
|
-
):
|
|
1108
|
-
return False
|
|
1109
|
-
origin = value["origin"]
|
|
1110
|
-
provider_id = value["providerId"]
|
|
1111
|
-
provider_version = value["providerVersion"]
|
|
1112
|
-
assurance = value["assurance"]
|
|
1113
|
-
readiness = value["readiness"]
|
|
1114
|
-
requested_policy = _parsed_policy(value["requestedPolicy"])
|
|
1115
|
-
effective_policy = _parsed_policy(value["effectivePolicy"])
|
|
1116
|
-
freshness = value["freshness"]
|
|
1117
|
-
probed_at = value["probedAt"]
|
|
1118
|
-
probe_result = value["probeResult"]
|
|
1119
|
-
fallback = value["fallbackFromProviderId"]
|
|
1120
|
-
if (
|
|
1121
|
-
type(value["schemaVersion"]) is not int
|
|
1122
|
-
or value["schemaVersion"] != 1
|
|
1123
|
-
or value["intent"] not in INTENT_ORDER
|
|
1124
|
-
or value["intent"] != intent
|
|
1125
|
-
or value["minimumAssurance"] not in ASSURANCE_LEVELS
|
|
1126
|
-
or value["minimumAssurance"] != plan["minimumAssurance"]
|
|
1127
|
-
or origin not in ("native", "provider", "heuristic", "unsupported")
|
|
1128
|
-
or readiness not in PROVIDER_READINESS
|
|
1129
|
-
or freshness not in ("fresh", "stale", "unknown", "not-applicable")
|
|
1130
|
-
or probe_result not in ("passed", "failed", "not-run")
|
|
1131
|
-
or (provider_id is not None and (type(provider_id) is not str or LOGICAL_ID.fullmatch(provider_id) is None))
|
|
1132
|
-
or (provider_version is not None and (type(provider_version) is not str or SEMVER.fullmatch(provider_version) is None))
|
|
1133
|
-
or (assurance is not None and assurance not in ASSURANCE_LEVELS)
|
|
1134
|
-
or (fallback is not None and (type(fallback) is not str or LOGICAL_ID.fullmatch(fallback) is None))
|
|
1135
|
-
or requested_policy is None
|
|
1136
|
-
or fingerprint_pactile_contract_v1(requested_policy)
|
|
1137
|
-
!= fingerprint_pactile_contract_v1(plan["requestedPolicy"])
|
|
1138
|
-
or not _valid_core_string_array(value["evidenceRefs"])
|
|
1139
|
-
):
|
|
1140
|
-
return False
|
|
1141
|
-
if origin == "unsupported":
|
|
1142
|
-
return False
|
|
1143
|
-
if (
|
|
1144
|
-
provider_id is None
|
|
1145
|
-
or provider_version is None
|
|
1146
|
-
or assurance is None
|
|
1147
|
-
or effective_policy is None
|
|
1148
|
-
or readiness != "ready"
|
|
1149
|
-
or not _policy_within(effective_policy, requested_policy)
|
|
1150
|
-
or ASSURANCE_LEVELS.index(assurance)
|
|
1151
|
-
< ASSURANCE_LEVELS.index(str(plan["minimumAssurance"]))
|
|
1152
|
-
):
|
|
1153
|
-
return False
|
|
1154
|
-
if assurance in ("evidence-backed", "verified") and not value["evidenceRefs"]:
|
|
1155
|
-
return False
|
|
1156
|
-
if assurance == "verified" and (
|
|
1157
|
-
freshness != "fresh"
|
|
1158
|
-
or probe_result != "passed"
|
|
1159
|
-
or not _valid_timestamp(probed_at)
|
|
1160
|
-
):
|
|
1161
|
-
return False
|
|
1162
|
-
if probed_at is not None and not _valid_timestamp(probed_at):
|
|
1163
|
-
return False
|
|
1164
|
-
if probe_result == "not-run" and probed_at is not None:
|
|
1165
|
-
return False
|
|
1166
|
-
if probe_result != "not-run" and probed_at is None:
|
|
1167
|
-
return False
|
|
1168
|
-
if provider_id is not None and fallback == provider_id:
|
|
1169
|
-
return False
|
|
1170
|
-
return True
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
def _rejected(intent: str, reasons: list[str], evidence_refs: list[str] | None = None) -> dict[str, object]:
|
|
1174
|
-
unique = set(reasons)
|
|
1175
|
-
return {
|
|
1176
|
-
"schemaVersion": RETRIEVAL_ABI_VERSION,
|
|
1177
|
-
"intent": intent,
|
|
1178
|
-
"accepted": False,
|
|
1179
|
-
"achievedAssurance": None,
|
|
1180
|
-
"evidenceRefs": list(evidence_refs or []),
|
|
1181
|
-
"reasonCodes": [code for code in REASON_CODES if code in unique],
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
def assess_retrieval_claim_v3(value: object) -> dict[str, object]:
|
|
1186
|
-
"""Assess facts without treating ranking confidence as evidence."""
|
|
1187
|
-
intent = "exact"
|
|
1188
|
-
try:
|
|
1189
|
-
if (
|
|
1190
|
-
type(value) is not dict
|
|
1191
|
-
or not _is_plain_json_tree(value)
|
|
1192
|
-
or any(
|
|
1193
|
-
key
|
|
1194
|
-
not in {
|
|
1195
|
-
"plan",
|
|
1196
|
-
"intent",
|
|
1197
|
-
"candidateRefs",
|
|
1198
|
-
"corroboration",
|
|
1199
|
-
"resolution",
|
|
1200
|
-
"providerScore",
|
|
1201
|
-
}
|
|
1202
|
-
for key in value
|
|
1203
|
-
)
|
|
1204
|
-
):
|
|
1205
|
-
return _rejected(intent, ["invalid-evidence"])
|
|
1206
|
-
raw_intent = value.get("intent")
|
|
1207
|
-
if raw_intent not in INTENT_ORDER:
|
|
1208
|
-
return _rejected(intent, ["invalid-evidence"])
|
|
1209
|
-
intent = cast(str, raw_intent)
|
|
1210
|
-
plan = value.get("plan")
|
|
1211
|
-
if intent not in INTENT_ORDER or not _valid_plan(plan, intent):
|
|
1212
|
-
return _rejected(intent, ["invalid-plan"])
|
|
1213
|
-
plan = cast(dict[str, object], plan)
|
|
1214
|
-
required_evidence_kinds = cast(list[str], plan["requiredEvidenceKinds"])
|
|
1215
|
-
plan_steps = cast(list[dict[str, object]], plan["steps"])
|
|
1216
|
-
candidate_refs = _normalized_refs(value.get("candidateRefs"))
|
|
1217
|
-
facts = _normalized_facts(value.get("corroboration"))
|
|
1218
|
-
if candidate_refs is None or facts is None:
|
|
1219
|
-
return _rejected(intent, ["invalid-evidence"])
|
|
1220
|
-
evidence_refs = sorted(
|
|
1221
|
-
set(candidate_refs + [fact["ref"] for fact in facts]), key=_utf8_key
|
|
1222
|
-
)
|
|
1223
|
-
reasons: list[str] = []
|
|
1224
|
-
if not candidate_refs:
|
|
1225
|
-
reasons.append("candidate-missing")
|
|
1226
|
-
fact_kinds = {fact["kind"] for fact in facts}
|
|
1227
|
-
if any(kind not in fact_kinds for kind in required_evidence_kinds):
|
|
1228
|
-
reasons.append("required-evidence-missing")
|
|
1229
|
-
has_corroboration = any(kind in CORROBORATION_KINDS for kind in fact_kinds)
|
|
1230
|
-
has_repeatable_test = "repeatable-test" in fact_kinds
|
|
1231
|
-
if intent != "exact" and not has_corroboration:
|
|
1232
|
-
reasons.append("corroboration-required")
|
|
1233
|
-
step = next((item for item in plan_steps if item.get("intent") == intent), None)
|
|
1234
|
-
requirement = step.get("providerRequirement") if type(step) is dict else None
|
|
1235
|
-
status = (
|
|
1236
|
-
requirement.get("status")
|
|
1237
|
-
if type(requirement) is dict
|
|
1238
|
-
else None
|
|
1239
|
-
)
|
|
1240
|
-
status_reasons = {
|
|
1241
|
-
"degraded": "provider-degraded",
|
|
1242
|
-
"unavailable": "provider-unavailable",
|
|
1243
|
-
"unsupported": "provider-unsupported",
|
|
1244
|
-
}
|
|
1245
|
-
if status in status_reasons:
|
|
1246
|
-
reasons.append(status_reasons[status])
|
|
1247
|
-
resolution_valid = intent == "exact" or _valid_resolution(
|
|
1248
|
-
plan, intent, value.get("resolution")
|
|
1249
|
-
)
|
|
1250
|
-
if intent != "exact" and not resolution_valid:
|
|
1251
|
-
reasons.append("minimum-assurance-not-met")
|
|
1252
|
-
minimum = str(plan["minimumAssurance"])
|
|
1253
|
-
achieved: str | None
|
|
1254
|
-
if minimum == "best-effort":
|
|
1255
|
-
achieved = "best-effort"
|
|
1256
|
-
elif not has_corroboration:
|
|
1257
|
-
achieved = None
|
|
1258
|
-
elif minimum == "evidence-backed":
|
|
1259
|
-
achieved = "evidence-backed"
|
|
1260
|
-
else:
|
|
1261
|
-
achieved = "verified" if has_repeatable_test else None
|
|
1262
|
-
if achieved is None:
|
|
1263
|
-
reasons.append(
|
|
1264
|
-
"repeatable-verification-required"
|
|
1265
|
-
if minimum == "verified"
|
|
1266
|
-
else "minimum-assurance-not-met"
|
|
1267
|
-
)
|
|
1268
|
-
resolution = value.get("resolution")
|
|
1269
|
-
if minimum == "verified" and intent != "exact" and (
|
|
1270
|
-
not resolution_valid
|
|
1271
|
-
or type(resolution) is not dict
|
|
1272
|
-
or resolution.get("assurance") != "verified"
|
|
1273
|
-
):
|
|
1274
|
-
reasons.append("verified-provider-proof-required")
|
|
1275
|
-
if reasons or achieved is None:
|
|
1276
|
-
return _rejected(intent, reasons, evidence_refs)
|
|
1277
|
-
return {
|
|
1278
|
-
"schemaVersion": RETRIEVAL_ABI_VERSION,
|
|
1279
|
-
"intent": intent,
|
|
1280
|
-
"accepted": True,
|
|
1281
|
-
"achievedAssurance": achieved,
|
|
1282
|
-
"evidenceRefs": evidence_refs,
|
|
1283
|
-
"reasonCodes": [],
|
|
1284
|
-
}
|
|
1285
|
-
except (AttributeError, KeyError, TypeError, UnicodeError, ValueError):
|
|
1286
|
-
return _rejected(intent, ["invalid-evidence"])
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
def codebase_retrieval_selected_from_capabilities(
|
|
1290
|
-
_capabilities: dict[str, Any] | None,
|
|
1291
|
-
) -> bool:
|
|
1292
|
-
"""Compatibility helper; V3 capability resolution is deferred."""
|
|
1293
|
-
return True
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
def load_capabilities_json(repo_root: Path | None) -> dict[str, Any] | None:
|
|
1297
|
-
"""Compatibility reader retained for callers that inspect project metadata."""
|
|
1298
|
-
if repo_root is None:
|
|
1299
|
-
return None
|
|
1300
|
-
path = repo_root / ".pactile" / "capabilities.json"
|
|
1301
|
-
if not path.is_file():
|
|
1302
|
-
return None
|
|
1303
|
-
try:
|
|
1304
|
-
parsed = json.loads(path.read_text(encoding="utf-8"))
|
|
1305
|
-
except (OSError, UnicodeError, json.JSONDecodeError):
|
|
1306
|
-
return None
|
|
1307
|
-
return parsed if type(parsed) is dict else None
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
def resolve_router_envelope(
|
|
1311
|
-
_repo_root: Path | None,
|
|
1312
|
-
*,
|
|
1313
|
-
explicit_router: dict[str, Any] | None = None,
|
|
1314
|
-
query: str | None = None,
|
|
1315
|
-
**_compatibility_metadata: object,
|
|
1316
|
-
) -> dict[str, object] | None:
|
|
1317
|
-
"""Validate an explicit V3 request/plan or build a plan from a query."""
|
|
1318
|
-
if type(explicit_router) is dict:
|
|
1319
|
-
explicit_intents = explicit_router.get("intents")
|
|
1320
|
-
first_intent = (
|
|
1321
|
-
explicit_intents[0]
|
|
1322
|
-
if type(explicit_intents) is list and explicit_intents
|
|
1323
|
-
else "exact"
|
|
1324
|
-
)
|
|
1325
|
-
if _valid_plan(explicit_router, str(first_intent)):
|
|
1326
|
-
return dict(explicit_router)
|
|
1327
|
-
parsed = parse_retrieval_request_v3(explicit_router)
|
|
1328
|
-
if parsed["success"]:
|
|
1329
|
-
planned = plan_retrieval_v3(parsed["data"])
|
|
1330
|
-
return (
|
|
1331
|
-
dict(cast(dict[str, object], planned["data"]))
|
|
1332
|
-
if planned["success"]
|
|
1333
|
-
else None
|
|
1334
|
-
)
|
|
1335
|
-
explicit_query = explicit_router.get("query")
|
|
1336
|
-
if type(explicit_query) is str and explicit_query.strip():
|
|
1337
|
-
return route_codebase_retrieval(explicit_query)
|
|
1338
|
-
normalized = re.sub(r"\s+", " ", query or "").strip()
|
|
1339
|
-
return route_codebase_retrieval(normalized) if normalized else None
|