@blxzer/pactile 0.5.0
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 +602 -0
- package/LICENSE +235 -0
- package/README.md +115 -0
- package/README.zh-CN.md +115 -0
- package/bin/compat-warning.js +11 -0
- package/bin/cstl.js +6 -0
- package/bin/pactile.js +3 -0
- package/bin/smart-search.js +38 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +362 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/capability-smoke.d.ts +24 -0
- package/dist/commands/capability-smoke.d.ts.map +1 -0
- package/dist/commands/capability-smoke.js +83 -0
- package/dist/commands/capability-smoke.js.map +1 -0
- package/dist/commands/channel/adapters/claude.d.ts +29 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +203 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +85 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +505 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +84 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +115 -0
- package/dist/commands/channel/adapters/index.js.map +1 -0
- package/dist/commands/channel/adapters/types.d.ts +33 -0
- package/dist/commands/channel/adapters/types.d.ts.map +1 -0
- package/dist/commands/channel/adapters/types.js +2 -0
- package/dist/commands/channel/adapters/types.js.map +1 -0
- package/dist/commands/channel/agent-loader.d.ts +32 -0
- package/dist/commands/channel/agent-loader.d.ts.map +1 -0
- package/dist/commands/channel/agent-loader.js +154 -0
- package/dist/commands/channel/agent-loader.js.map +1 -0
- package/dist/commands/channel/context-loader.d.ts +26 -0
- package/dist/commands/channel/context-loader.d.ts.map +1 -0
- package/dist/commands/channel/context-loader.js +290 -0
- package/dist/commands/channel/context-loader.js.map +1 -0
- package/dist/commands/channel/context.d.ts +16 -0
- package/dist/commands/channel/context.d.ts.map +1 -0
- package/dist/commands/channel/context.js +83 -0
- package/dist/commands/channel/context.js.map +1 -0
- package/dist/commands/channel/create.d.ts +27 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +39 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
- package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
- package/dist/commands/channel/dev-parse-trace.js +70 -0
- package/dist/commands/channel/dev-parse-trace.js.map +1 -0
- package/dist/commands/channel/guard.d.ts +150 -0
- package/dist/commands/channel/guard.d.ts.map +1 -0
- package/dist/commands/channel/guard.js +475 -0
- package/dist/commands/channel/guard.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +531 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/interrupt.d.ts +10 -0
- package/dist/commands/channel/interrupt.d.ts.map +1 -0
- package/dist/commands/channel/interrupt.js +22 -0
- package/dist/commands/channel/interrupt.js.map +1 -0
- package/dist/commands/channel/kill.d.ts +7 -0
- package/dist/commands/channel/kill.d.ts.map +1 -0
- package/dist/commands/channel/kill.js +121 -0
- package/dist/commands/channel/kill.js.map +1 -0
- package/dist/commands/channel/list.d.ts +17 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +233 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/messages.d.ts +15 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +245 -0
- package/dist/commands/channel/messages.js.map +1 -0
- package/dist/commands/channel/rm.d.ts +27 -0
- package/dist/commands/channel/rm.d.ts.map +1 -0
- package/dist/commands/channel/rm.js +216 -0
- package/dist/commands/channel/rm.js.map +1 -0
- package/dist/commands/channel/run.d.ts +30 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +130 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +11 -0
- package/dist/commands/channel/send.d.ts.map +1 -0
- package/dist/commands/channel/send.js +24 -0
- package/dist/commands/channel/send.js.map +1 -0
- package/dist/commands/channel/spawn.d.ts +40 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +242 -0
- package/dist/commands/channel/spawn.js.map +1 -0
- package/dist/commands/channel/store/events.d.ts +39 -0
- package/dist/commands/channel/store/events.d.ts.map +1 -0
- package/dist/commands/channel/store/events.js +87 -0
- package/dist/commands/channel/store/events.js.map +1 -0
- package/dist/commands/channel/store/filter.d.ts +3 -0
- package/dist/commands/channel/store/filter.d.ts.map +1 -0
- package/dist/commands/channel/store/filter.js +2 -0
- package/dist/commands/channel/store/filter.js.map +1 -0
- package/dist/commands/channel/store/lock.d.ts +23 -0
- package/dist/commands/channel/store/lock.d.ts.map +1 -0
- package/dist/commands/channel/store/lock.js +99 -0
- package/dist/commands/channel/store/lock.js.map +1 -0
- package/dist/commands/channel/store/paths.d.ts +63 -0
- package/dist/commands/channel/store/paths.d.ts.map +1 -0
- package/dist/commands/channel/store/paths.js +247 -0
- package/dist/commands/channel/store/paths.js.map +1 -0
- package/dist/commands/channel/store/schema.d.ts +27 -0
- package/dist/commands/channel/store/schema.d.ts.map +1 -0
- package/dist/commands/channel/store/schema.js +34 -0
- package/dist/commands/channel/store/schema.js.map +1 -0
- package/dist/commands/channel/store/thread-state.d.ts +5 -0
- package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
- package/dist/commands/channel/store/thread-state.js +16 -0
- package/dist/commands/channel/store/thread-state.js.map +1 -0
- package/dist/commands/channel/store/watch.d.ts +19 -0
- package/dist/commands/channel/store/watch.d.ts.map +1 -0
- package/dist/commands/channel/store/watch.js +146 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/idle.d.ts +46 -0
- package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/idle.js +72 -0
- package/dist/commands/channel/supervisor/idle.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +160 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +146 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +121 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor/turns.d.ts +31 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +45 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +59 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +345 -0
- package/dist/commands/channel/supervisor.js.map +1 -0
- package/dist/commands/channel/text-body.d.ts +13 -0
- package/dist/commands/channel/text-body.d.ts.map +1 -0
- package/dist/commands/channel/text-body.js +47 -0
- package/dist/commands/channel/text-body.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +39 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +106 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/title.d.ts +12 -0
- package/dist/commands/channel/title.d.ts.map +1 -0
- package/dist/commands/channel/title.js +24 -0
- package/dist/commands/channel/title.js.map +1 -0
- package/dist/commands/channel/wait.d.ts +17 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +75 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/detach.d.ts +7 -0
- package/dist/commands/detach.d.ts.map +1 -0
- package/dist/commands/detach.js +31 -0
- package/dist/commands/detach.js.map +1 -0
- package/dist/commands/init.d.ts +51 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1660 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate.d.ts +10 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +38 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/purge.d.ts +9 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +29 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/rollback.d.ts +7 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +27 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/rollout.d.ts +34 -0
- package/dist/commands/rollout.d.ts.map +1 -0
- package/dist/commands/rollout.js +102 -0
- package/dist/commands/rollout.js.map +1 -0
- package/dist/commands/uninstall.d.ts +23 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +68 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +139 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +2459 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/upgrade.d.ts +28 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +84 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/validate-rules.d.ts +6 -0
- package/dist/commands/validate-rules.d.ts.map +1 -0
- package/dist/commands/validate-rules.js +33 -0
- package/dist/commands/validate-rules.js.map +1 -0
- package/dist/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +220 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/cursor.d.ts +21 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +51 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/index.d.ts +68 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +170 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/shared.d.ts +200 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +602 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/workflow.d.ts +45 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +256 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +93 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +106 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +187 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -0
- package/dist/migrations/manifests/0.1.1.json +9 -0
- package/dist/migrations/manifests/0.1.2.json +9 -0
- package/dist/migrations/manifests/0.1.3.json +9 -0
- package/dist/migrations/manifests/0.1.4.json +9 -0
- package/dist/migrations/manifests/0.2.1.json +9 -0
- package/dist/migrations/manifests/0.2.10.json +374 -0
- package/dist/migrations/manifests/0.2.2.json +9 -0
- package/dist/migrations/manifests/0.2.3.json +9 -0
- package/dist/migrations/manifests/0.2.4.json +9 -0
- package/dist/migrations/manifests/0.2.5.json +9 -0
- package/dist/migrations/manifests/0.2.6.json +9 -0
- package/dist/migrations/manifests/0.2.7.json +9 -0
- package/dist/migrations/manifests/0.2.8.json +9 -0
- package/dist/migrations/manifests/0.2.9.json +9 -0
- package/dist/migrations/manifests/0.3.0.json +89 -0
- package/dist/migrations/manifests/0.3.1.json +32 -0
- package/dist/migrations/manifests/0.3.2.json +16 -0
- package/dist/migrations/manifests/0.3.3.json +9 -0
- package/dist/migrations/manifests/0.3.4.json +9 -0
- package/dist/migrations/manifests/0.3.5.json +9 -0
- package/dist/migrations/manifests/0.3.6.json +9 -0
- package/dist/migrations/manifests/0.4.0.json +9 -0
- package/dist/migrations/manifests/0.4.1.json +9 -0
- package/dist/migrations/manifests/0.4.2.json +9 -0
- package/dist/migrations/manifests/0.4.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.0.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.5.json +9 -0
- package/dist/pactile/adapters/codex/index.d.ts +75 -0
- package/dist/pactile/adapters/codex/index.d.ts.map +1 -0
- package/dist/pactile/adapters/codex/index.js +269 -0
- package/dist/pactile/adapters/codex/index.js.map +1 -0
- package/dist/pactile/adapters/cursor/index.d.ts +60 -0
- package/dist/pactile/adapters/cursor/index.d.ts.map +1 -0
- package/dist/pactile/adapters/cursor/index.js +186 -0
- package/dist/pactile/adapters/cursor/index.js.map +1 -0
- package/dist/pactile/adapters/index.d.ts +4 -0
- package/dist/pactile/adapters/index.d.ts.map +1 -0
- package/dist/pactile/adapters/index.js +4 -0
- package/dist/pactile/adapters/index.js.map +1 -0
- package/dist/pactile/adoption/bindings.d.ts +20 -0
- package/dist/pactile/adoption/bindings.d.ts.map +1 -0
- package/dist/pactile/adoption/bindings.js +99 -0
- package/dist/pactile/adoption/bindings.js.map +1 -0
- package/dist/pactile/adoption/discovery.d.ts +8 -0
- package/dist/pactile/adoption/discovery.d.ts.map +1 -0
- package/dist/pactile/adoption/discovery.js +159 -0
- package/dist/pactile/adoption/discovery.js.map +1 -0
- package/dist/pactile/adoption/inventory.d.ts +28 -0
- package/dist/pactile/adoption/inventory.d.ts.map +1 -0
- package/dist/pactile/adoption/inventory.js +261 -0
- package/dist/pactile/adoption/inventory.js.map +1 -0
- package/dist/pactile/adoption/safety.d.ts +19 -0
- package/dist/pactile/adoption/safety.d.ts.map +1 -0
- package/dist/pactile/adoption/safety.js +88 -0
- package/dist/pactile/adoption/safety.js.map +1 -0
- package/dist/pactile/adoption/workflow.d.ts +31 -0
- package/dist/pactile/adoption/workflow.d.ts.map +1 -0
- package/dist/pactile/adoption/workflow.js +259 -0
- package/dist/pactile/adoption/workflow.js.map +1 -0
- package/dist/pactile/compat/cli-options.d.ts +9 -0
- package/dist/pactile/compat/cli-options.d.ts.map +1 -0
- package/dist/pactile/compat/cli-options.js +9 -0
- package/dist/pactile/compat/cli-options.js.map +1 -0
- package/dist/pactile/compat/init-context.d.ts +16 -0
- package/dist/pactile/compat/init-context.d.ts.map +1 -0
- package/dist/pactile/compat/init-context.js +87 -0
- package/dist/pactile/compat/init-context.js.map +1 -0
- package/dist/pactile/compat/legacy-migrations.d.ts +8 -0
- package/dist/pactile/compat/legacy-migrations.d.ts.map +1 -0
- package/dist/pactile/compat/legacy-migrations.js +17 -0
- package/dist/pactile/compat/legacy-migrations.js.map +1 -0
- package/dist/pactile/compat/retired-alternate-client.d.ts +42 -0
- package/dist/pactile/compat/retired-alternate-client.d.ts.map +1 -0
- package/dist/pactile/compat/retired-alternate-client.js +153 -0
- package/dist/pactile/compat/retired-alternate-client.js.map +1 -0
- package/dist/pactile/compat/update-residue.d.ts +4 -0
- package/dist/pactile/compat/update-residue.d.ts.map +1 -0
- package/dist/pactile/compat/update-residue.js +55 -0
- package/dist/pactile/compat/update-residue.js.map +1 -0
- package/dist/pactile/exit/index.d.ts +3 -0
- package/dist/pactile/exit/index.d.ts.map +1 -0
- package/dist/pactile/exit/index.js +3 -0
- package/dist/pactile/exit/index.js.map +1 -0
- package/dist/pactile/exit/receipt.d.ts +23 -0
- package/dist/pactile/exit/receipt.d.ts.map +1 -0
- package/dist/pactile/exit/receipt.js +64 -0
- package/dist/pactile/exit/receipt.js.map +1 -0
- package/dist/pactile/exit/service.d.ts +107 -0
- package/dist/pactile/exit/service.d.ts.map +1 -0
- package/dist/pactile/exit/service.js +774 -0
- package/dist/pactile/exit/service.js.map +1 -0
- package/dist/pactile/index.d.ts +26 -0
- package/dist/pactile/index.d.ts.map +1 -0
- package/dist/pactile/index.js +22 -0
- package/dist/pactile/index.js.map +1 -0
- package/dist/pactile/lifecycle/command-runner.d.ts +26 -0
- package/dist/pactile/lifecycle/command-runner.d.ts.map +1 -0
- package/dist/pactile/lifecycle/command-runner.js +129 -0
- package/dist/pactile/lifecycle/command-runner.js.map +1 -0
- package/dist/pactile/lifecycle/default-adapters.d.ts +5 -0
- package/dist/pactile/lifecycle/default-adapters.d.ts.map +1 -0
- package/dist/pactile/lifecycle/default-adapters.js +136 -0
- package/dist/pactile/lifecycle/default-adapters.js.map +1 -0
- package/dist/pactile/lifecycle/index.d.ts +6 -0
- package/dist/pactile/lifecycle/index.d.ts.map +1 -0
- package/dist/pactile/lifecycle/index.js +6 -0
- package/dist/pactile/lifecycle/index.js.map +1 -0
- package/dist/pactile/lifecycle/legacy-import.d.ts +16 -0
- package/dist/pactile/lifecycle/legacy-import.d.ts.map +1 -0
- package/dist/pactile/lifecycle/legacy-import.js +228 -0
- package/dist/pactile/lifecycle/legacy-import.js.map +1 -0
- package/dist/pactile/lifecycle/orchestrator.d.ts +109 -0
- package/dist/pactile/lifecycle/orchestrator.d.ts.map +1 -0
- package/dist/pactile/lifecycle/orchestrator.js +1030 -0
- package/dist/pactile/lifecycle/orchestrator.js.map +1 -0
- package/dist/pactile/lifecycle/project-files.d.ts +28 -0
- package/dist/pactile/lifecycle/project-files.d.ts.map +1 -0
- package/dist/pactile/lifecycle/project-files.js +297 -0
- package/dist/pactile/lifecycle/project-files.js.map +1 -0
- package/dist/pactile/middleware/index.d.ts +3 -0
- package/dist/pactile/middleware/index.d.ts.map +1 -0
- package/dist/pactile/middleware/index.js +2 -0
- package/dist/pactile/middleware/index.js.map +1 -0
- package/dist/pactile/middleware/manifest-loader.d.ts +22 -0
- package/dist/pactile/middleware/manifest-loader.d.ts.map +1 -0
- package/dist/pactile/middleware/manifest-loader.js +228 -0
- package/dist/pactile/middleware/manifest-loader.js.map +1 -0
- package/dist/pactile/migration/index.d.ts +2 -0
- package/dist/pactile/migration/index.d.ts.map +1 -0
- package/dist/pactile/migration/index.js +2 -0
- package/dist/pactile/migration/index.js.map +1 -0
- package/dist/pactile/migration/transaction.d.ts +54 -0
- package/dist/pactile/migration/transaction.d.ts.map +1 -0
- package/dist/pactile/migration/transaction.js +445 -0
- package/dist/pactile/migration/transaction.js.map +1 -0
- package/dist/pactile/projection/managed-block.d.ts +32 -0
- package/dist/pactile/projection/managed-block.d.ts.map +1 -0
- package/dist/pactile/projection/managed-block.js +78 -0
- package/dist/pactile/projection/managed-block.js.map +1 -0
- package/dist/pactile/projection/planner.d.ts +65 -0
- package/dist/pactile/projection/planner.d.ts.map +1 -0
- package/dist/pactile/projection/planner.js +349 -0
- package/dist/pactile/projection/planner.js.map +1 -0
- package/dist/pactile/projection/shared/index.d.ts +38 -0
- package/dist/pactile/projection/shared/index.d.ts.map +1 -0
- package/dist/pactile/projection/shared/index.js +186 -0
- package/dist/pactile/projection/shared/index.js.map +1 -0
- package/dist/pactile/projection/store.d.ts +72 -0
- package/dist/pactile/projection/store.d.ts.map +1 -0
- package/dist/pactile/projection/store.js +669 -0
- package/dist/pactile/projection/store.js.map +1 -0
- package/dist/pactile/projection/structured-merge.d.ts +11 -0
- package/dist/pactile/projection/structured-merge.d.ts.map +1 -0
- package/dist/pactile/projection/structured-merge.js +347 -0
- package/dist/pactile/projection/structured-merge.js.map +1 -0
- package/dist/pactile/providers/index.d.ts +3 -0
- package/dist/pactile/providers/index.d.ts.map +1 -0
- package/dist/pactile/providers/index.js +3 -0
- package/dist/pactile/providers/index.js.map +1 -0
- package/dist/pactile/providers/probes.d.ts +55 -0
- package/dist/pactile/providers/probes.d.ts.map +1 -0
- package/dist/pactile/providers/probes.js +164 -0
- package/dist/pactile/providers/probes.js.map +1 -0
- package/dist/pactile/registry.d.ts +64 -0
- package/dist/pactile/registry.d.ts.map +1 -0
- package/dist/pactile/registry.js +196 -0
- package/dist/pactile/registry.js.map +1 -0
- package/dist/pactile/retrieval/boundary.d.ts +18 -0
- package/dist/pactile/retrieval/boundary.d.ts.map +1 -0
- package/dist/pactile/retrieval/boundary.js +113 -0
- package/dist/pactile/retrieval/boundary.js.map +1 -0
- package/dist/pactile/retrieval/evidence.d.ts +9 -0
- package/dist/pactile/retrieval/evidence.d.ts.map +1 -0
- package/dist/pactile/retrieval/evidence.js +327 -0
- package/dist/pactile/retrieval/evidence.js.map +1 -0
- package/dist/pactile/retrieval/index.d.ts +4 -0
- package/dist/pactile/retrieval/index.d.ts.map +1 -0
- package/dist/pactile/retrieval/index.js +4 -0
- package/dist/pactile/retrieval/index.js.map +1 -0
- package/dist/pactile/retrieval/planner.d.ts +23 -0
- package/dist/pactile/retrieval/planner.d.ts.map +1 -0
- package/dist/pactile/retrieval/planner.js +702 -0
- package/dist/pactile/retrieval/planner.js.map +1 -0
- package/dist/pactile/retrieval/types.d.ts +108 -0
- package/dist/pactile/retrieval/types.d.ts.map +1 -0
- package/dist/pactile/retrieval/types.js +36 -0
- package/dist/pactile/retrieval/types.js.map +1 -0
- package/dist/pactile/runtime/case-fold.d.ts +2 -0
- package/dist/pactile/runtime/case-fold.d.ts.map +1 -0
- package/dist/pactile/runtime/case-fold.js +31 -0
- package/dist/pactile/runtime/case-fold.js.map +1 -0
- package/dist/pactile/runtime/index.d.ts +8 -0
- package/dist/pactile/runtime/index.d.ts.map +1 -0
- package/dist/pactile/runtime/index.js +5 -0
- package/dist/pactile/runtime/index.js.map +1 -0
- package/dist/pactile/runtime/json-api.d.ts +15 -0
- package/dist/pactile/runtime/json-api.d.ts.map +1 -0
- package/dist/pactile/runtime/json-api.js +68 -0
- package/dist/pactile/runtime/json-api.js.map +1 -0
- package/dist/pactile/runtime/paths.d.ts +59 -0
- package/dist/pactile/runtime/paths.d.ts.map +1 -0
- package/dist/pactile/runtime/paths.js +201 -0
- package/dist/pactile/runtime/paths.js.map +1 -0
- package/dist/pactile/runtime/stores.d.ts +54 -0
- package/dist/pactile/runtime/stores.d.ts.map +1 -0
- package/dist/pactile/runtime/stores.js +375 -0
- package/dist/pactile/runtime/stores.js.map +1 -0
- package/dist/pactile/runtime/unicode-nfc-data.d.ts +12 -0
- package/dist/pactile/runtime/unicode-nfc-data.d.ts.map +1 -0
- package/dist/pactile/runtime/unicode-nfc-data.js +8 -0
- package/dist/pactile/runtime/unicode-nfc-data.js.map +1 -0
- package/dist/pactile/runtime/unicode-nfc.d.ts +3 -0
- package/dist/pactile/runtime/unicode-nfc.d.ts.map +1 -0
- package/dist/pactile/runtime/unicode-nfc.js +77 -0
- package/dist/pactile/runtime/unicode-nfc.js.map +1 -0
- package/dist/pactile/tiles/catalog.d.ts +35 -0
- package/dist/pactile/tiles/catalog.d.ts.map +1 -0
- package/dist/pactile/tiles/catalog.js +235 -0
- package/dist/pactile/tiles/catalog.js.map +1 -0
- package/dist/pactile/tiles/compiler.d.ts +54 -0
- package/dist/pactile/tiles/compiler.d.ts.map +1 -0
- package/dist/pactile/tiles/compiler.js +270 -0
- package/dist/pactile/tiles/compiler.js.map +1 -0
- package/dist/pactile/tiles/content/baseline/index.d.ts +5 -0
- package/dist/pactile/tiles/content/baseline/index.d.ts.map +1 -0
- package/dist/pactile/tiles/content/baseline/index.js +115 -0
- package/dist/pactile/tiles/content/baseline/index.js.map +1 -0
- package/dist/pactile/tiles/content/index.d.ts +4 -0
- package/dist/pactile/tiles/content/index.d.ts.map +1 -0
- package/dist/pactile/tiles/content/index.js +4 -0
- package/dist/pactile/tiles/content/index.js.map +1 -0
- package/dist/pactile/tiles/content/ondemand/index.d.ts +5 -0
- package/dist/pactile/tiles/content/ondemand/index.d.ts.map +1 -0
- package/dist/pactile/tiles/content/ondemand/index.js +184 -0
- package/dist/pactile/tiles/content/ondemand/index.js.map +1 -0
- package/dist/pactile/tiles/content/source.d.ts +29 -0
- package/dist/pactile/tiles/content/source.d.ts.map +1 -0
- package/dist/pactile/tiles/content/source.js +86 -0
- package/dist/pactile/tiles/content/source.js.map +1 -0
- package/dist/pactile/tiles/loader.d.ts +31 -0
- package/dist/pactile/tiles/loader.d.ts.map +1 -0
- package/dist/pactile/tiles/loader.js +139 -0
- package/dist/pactile/tiles/loader.js.map +1 -0
- package/dist/pactile/tiles/safe-yaml.d.ts +11 -0
- package/dist/pactile/tiles/safe-yaml.d.ts.map +1 -0
- package/dist/pactile/tiles/safe-yaml.js +212 -0
- package/dist/pactile/tiles/safe-yaml.js.map +1 -0
- package/dist/templates/common/bundled-skills/pactile-check/SKILL.md +161 -0
- package/dist/templates/common/bundled-skills/pactile-check/references/fowler-12-smells.md +28 -0
- package/dist/templates/common/bundled-skills/pactile-handoff/SKILL.md +117 -0
- package/dist/templates/common/bundled-skills/pactile-meta/SKILL.md +75 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-agents.md +47 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-context-loading.md +84 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-skills-or-commands.md +77 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-task-lifecycle.md +88 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-workflow.md +65 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/generated-files.md +83 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/task-system.md +133 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/agents.md +69 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/hooks-and-settings.md +59 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/overview.md +45 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/platform-map.md +45 -0
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/skills-and-commands.md +108 -0
- package/dist/templates/common/bundled-skills/pactile-micro-grill/SKILL.md +68 -0
- package/dist/templates/common/bundled-skills/pactile-skill-creator/SKILL.md +47 -0
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/authoring-rules.md +171 -0
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/general-authoring.md +189 -0
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/pactile-skill-locations.md +52 -0
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/review-checklist.md +52 -0
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-writing.md +70 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +393 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -0
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +323 -0
- package/dist/templates/common/commands/continue.md +62 -0
- package/dist/templates/common/commands/finish-work.md +82 -0
- package/dist/templates/common/commands/start.md +66 -0
- package/dist/templates/common/index.d.ts +68 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +123 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +179 -0
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +149 -0
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +904 -0
- package/dist/templates/common/skills/before-dev.md +35 -0
- package/dist/templates/common/skills/brainstorm.md +204 -0
- package/dist/templates/common/skills/break-loop.md +125 -0
- package/dist/templates/common/skills/update-spec.md +364 -0
- package/dist/templates/cursor/agents/pactile-check.md +58 -0
- package/dist/templates/cursor/agents/pactile-implement.md +56 -0
- package/dist/templates/cursor/agents/pactile-research.md +51 -0
- package/dist/templates/cursor/commands/handoff.md +101 -0
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +14 -0
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -0
- package/dist/templates/cursor/fixtures/expected-rules.js +20 -0
- package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -0
- package/dist/templates/cursor/hooks.json +52 -0
- package/dist/templates/cursor/index.d.ts +19 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +19 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/cursor/rules/pactile-bootstrap.mdc +18 -0
- package/dist/templates/cursor/worktrees.json +11 -0
- package/dist/templates/extract.d.ts +38 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +120 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/markdown/agents.md +14 -0
- package/dist/templates/markdown/framework/artifact-locale-guide.md.txt +93 -0
- package/dist/templates/markdown/framework/cursor-context-injection-guide.md.txt +85 -0
- package/dist/templates/markdown/framework/cursor-native-modes-guide.md.txt +239 -0
- package/dist/templates/markdown/framework/cursor-semantic-compliance.md.txt +41 -0
- package/dist/templates/markdown/framework/cursor-subagent-policy.md.txt +90 -0
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +28 -0
- package/dist/templates/markdown/framework/execution-strategy.md.txt +45 -0
- package/dist/templates/markdown/framework/index.md.txt +31 -0
- package/dist/templates/markdown/framework/injection-budget-guide.md.txt +111 -0
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +45 -0
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +238 -0
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +116 -0
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +105 -0
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -0
- package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +199 -0
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -0
- package/dist/templates/markdown/framework/verification-strength-guide.md.txt +185 -0
- package/dist/templates/markdown/gitignore.txt +15 -0
- package/dist/templates/markdown/index.d.ts +59 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +144 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +25 -0
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +174 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +162 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +634 -0
- package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -0
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +76 -0
- package/dist/templates/markdown/spec/guides/e2e-walkthrough-guide.md.txt +93 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +131 -0
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +139 -0
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +179 -0
- package/dist/templates/markdown/workspace-index.md +125 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/pactile/CONTEXT.md +113 -0
- package/dist/templates/pactile/config/execution-strategy-rules.json +31 -0
- package/dist/templates/pactile/config.yaml +130 -0
- package/dist/templates/pactile/docs/adr/README.md +21 -0
- package/dist/templates/pactile/gitignore.txt +35 -0
- package/dist/templates/pactile/index.d.ts +134 -0
- package/dist/templates/pactile/index.d.ts.map +1 -0
- package/dist/templates/pactile/index.js +316 -0
- package/dist/templates/pactile/index.js.map +1 -0
- package/dist/templates/pactile/modules/approval-personal/contract.md +43 -0
- package/dist/templates/pactile/modules/candidate-pool/contract.md +37 -0
- package/dist/templates/pactile/modules/catalog.d.ts +32 -0
- package/dist/templates/pactile/modules/catalog.d.ts.map +1 -0
- package/dist/templates/pactile/modules/catalog.js +46 -0
- package/dist/templates/pactile/modules/catalog.js.map +1 -0
- package/dist/templates/pactile/modules/close-basic/contract.md +38 -0
- package/dist/templates/pactile/modules/context-progressive/contract.md +44 -0
- package/dist/templates/pactile/modules/debug-recovery/contract.md +44 -0
- package/dist/templates/pactile/modules/define-basic/contract.md +39 -0
- package/dist/templates/pactile/modules/define-extended/contract.md +45 -0
- package/dist/templates/pactile/modules/execute-agent/contract.md +38 -0
- package/dist/templates/pactile/modules/independent-check/contract.md +35 -0
- package/dist/templates/pactile/modules/index.json +133 -0
- package/dist/templates/pactile/modules/intake-basic/contract.md +34 -0
- package/dist/templates/pactile/modules/observability-local/contract.md +31 -0
- package/dist/templates/pactile/modules/parent-child/contract.md +45 -0
- package/dist/templates/pactile/modules/personal-memory/contract.md +56 -0
- package/dist/templates/pactile/modules/retention-storage/contract.md +43 -0
- package/dist/templates/pactile/modules/retrieval-extended/contract.md +77 -0
- package/dist/templates/pactile/modules/session-transfer/contract.md +41 -0
- package/dist/templates/pactile/modules/spec-learning/contract.md +50 -0
- package/dist/templates/pactile/modules/vcs-integration/contract.md +46 -0
- package/dist/templates/pactile/modules/verify-basic/contract.md +38 -0
- package/dist/templates/pactile/modules/worker-orchestration/contract.md +47 -0
- package/dist/templates/pactile/pool/README.md +149 -0
- package/dist/templates/pactile/pool/items/.gitkeep +0 -0
- package/dist/templates/pactile/pool/plan.md +50 -0
- package/dist/templates/pactile/scripts/__init__.py +5 -0
- package/dist/templates/pactile/scripts/add_session.py +547 -0
- package/dist/templates/pactile/scripts/build_context_pack.py +17 -0
- package/dist/templates/pactile/scripts/build_retrieval_pack.py +376 -0
- package/dist/templates/pactile/scripts/codegraph_session_smoke.py +76 -0
- package/dist/templates/pactile/scripts/common/__init__.py +103 -0
- package/dist/templates/pactile/scripts/common/active_task.py +576 -0
- package/dist/templates/pactile/scripts/common/adapter_middleware.py +1373 -0
- package/dist/templates/pactile/scripts/common/artifact_locale.py +303 -0
- package/dist/templates/pactile/scripts/common/artifact_search.py +587 -0
- package/dist/templates/pactile/scripts/common/cli_adapter.py +135 -0
- package/dist/templates/pactile/scripts/common/cli_environment.py +155 -0
- package/dist/templates/pactile/scripts/common/codebase_retrieval_router.py +1339 -0
- package/dist/templates/pactile/scripts/common/config.py +497 -0
- package/dist/templates/pactile/scripts/common/context_pack.py +371 -0
- package/dist/templates/pactile/scripts/common/cursor_retrieval_env.py +31 -0
- package/dist/templates/pactile/scripts/common/developer.py +190 -0
- package/dist/templates/pactile/scripts/common/execution_strategy.py +268 -0
- package/dist/templates/pactile/scripts/common/full_quality.py +237 -0
- package/dist/templates/pactile/scripts/common/git.py +37 -0
- package/dist/templates/pactile/scripts/common/git_context.py +198 -0
- package/dist/templates/pactile/scripts/common/injection_budget.py +317 -0
- package/dist/templates/pactile/scripts/common/io.py +37 -0
- package/dist/templates/pactile/scripts/common/kernel_command.py +369 -0
- package/dist/templates/pactile/scripts/common/lite_context.py +280 -0
- package/dist/templates/pactile/scripts/common/log.py +45 -0
- package/dist/templates/pactile/scripts/common/ondemand_topology.py +419 -0
- package/dist/templates/pactile/scripts/common/packages_context.py +239 -0
- package/dist/templates/pactile/scripts/common/pactile_config.py +131 -0
- package/dist/templates/pactile/scripts/common/parallel_declaration.py +369 -0
- package/dist/templates/pactile/scripts/common/parent_orchestration.py +1198 -0
- package/dist/templates/pactile/scripts/common/paths.py +756 -0
- package/dist/templates/pactile/scripts/common/pool_refs.py +119 -0
- package/dist/templates/pactile/scripts/common/pool_slice.py +269 -0
- package/dist/templates/pactile/scripts/common/pool_store.py +766 -0
- package/dist/templates/pactile/scripts/common/project_file_stats.py +91 -0
- package/dist/templates/pactile/scripts/common/retrieval_adapter_metadata.py +943 -0
- package/dist/templates/pactile/scripts/common/retrieval_agent_instructions.py +123 -0
- package/dist/templates/pactile/scripts/common/retrieval_evidence.py +915 -0
- package/dist/templates/pactile/scripts/common/retrieval_pack.py +422 -0
- package/dist/templates/pactile/scripts/common/retrieval_pack_context.py +122 -0
- package/dist/templates/pactile/scripts/common/retrieval_plan_gate.py +61 -0
- package/dist/templates/pactile/scripts/common/retrieval_result_ranking.py +104 -0
- package/dist/templates/pactile/scripts/common/retrieval_tool_classification.py +166 -0
- package/dist/templates/pactile/scripts/common/safe_commit.py +285 -0
- package/dist/templates/pactile/scripts/common/semantic_plan_gate.py +53 -0
- package/dist/templates/pactile/scripts/common/session_context.py +1213 -0
- package/dist/templates/pactile/scripts/common/session_memory.py +386 -0
- package/dist/templates/pactile/scripts/common/session_pack.py +886 -0
- package/dist/templates/pactile/scripts/common/smart_search_evidence.py +514 -0
- package/dist/templates/pactile/scripts/common/smart_search_resolve.py +150 -0
- package/dist/templates/pactile/scripts/common/subagent_dispatch.py +592 -0
- package/dist/templates/pactile/scripts/common/task_context.py +241 -0
- package/dist/templates/pactile/scripts/common/task_dashboard.py +286 -0
- package/dist/templates/pactile/scripts/common/task_dependencies.py +648 -0
- package/dist/templates/pactile/scripts/common/task_gates.py +2478 -0
- package/dist/templates/pactile/scripts/common/task_map.py +703 -0
- package/dist/templates/pactile/scripts/common/task_queue.py +188 -0
- package/dist/templates/pactile/scripts/common/task_store.py +2252 -0
- package/dist/templates/pactile/scripts/common/task_utils.py +274 -0
- package/dist/templates/pactile/scripts/common/tasks.py +231 -0
- package/dist/templates/pactile/scripts/common/test_adapter_middleware.py +199 -0
- package/dist/templates/pactile/scripts/common/test_depends_mode_block.py +509 -0
- package/dist/templates/pactile/scripts/common/test_full_quality.py +197 -0
- package/dist/templates/pactile/scripts/common/test_kernel_command.py +336 -0
- package/dist/templates/pactile/scripts/common/test_lite_path.py +190 -0
- package/dist/templates/pactile/scripts/common/test_observable_defaults.py +141 -0
- package/dist/templates/pactile/scripts/common/test_ondemand_topology.py +237 -0
- package/dist/templates/pactile/scripts/common/test_parallel_declaration.py +264 -0
- package/dist/templates/pactile/scripts/common/test_pool_slice.py +198 -0
- package/dist/templates/pactile/scripts/common/test_pool_store.py +452 -0
- package/dist/templates/pactile/scripts/common/test_retrieval_arbitration.py +331 -0
- package/dist/templates/pactile/scripts/common/test_task_dashboard.py +155 -0
- package/dist/templates/pactile/scripts/common/test_task_dependencies.py +329 -0
- package/dist/templates/pactile/scripts/common/test_task_store_kernel_patch.py +163 -0
- package/dist/templates/pactile/scripts/common/types.py +110 -0
- package/dist/templates/pactile/scripts/common/workflow_phase.py +194 -0
- package/dist/templates/pactile/scripts/compile_session_pack.py +15 -0
- package/dist/templates/pactile/scripts/cursor_retrieval_probe.py +64 -0
- package/dist/templates/pactile/scripts/cursor_retrieval_probe_prompt.md +33 -0
- package/dist/templates/pactile/scripts/generate_dispatch_prompt.py +182 -0
- package/dist/templates/pactile/scripts/get_context.py +19 -0
- package/dist/templates/pactile/scripts/get_developer.py +26 -0
- package/dist/templates/pactile/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/pactile/scripts/init_developer.py +51 -0
- package/dist/templates/pactile/scripts/injection_budget_probe.py +69 -0
- package/dist/templates/pactile/scripts/pool.py +237 -0
- package/dist/templates/pactile/scripts/rank_retrieval_candidates.py +98 -0
- package/dist/templates/pactile/scripts/retrieval_probe_matrix_template.json +43 -0
- package/dist/templates/pactile/scripts/route_codebase_retrieval.py +72 -0
- package/dist/templates/pactile/scripts/run_smart_search.py +12 -0
- package/dist/templates/pactile/scripts/score_evidence.py +131 -0
- package/dist/templates/pactile/scripts/search_artifacts.py +13 -0
- package/dist/templates/pactile/scripts/search_memory.py +12 -0
- package/dist/templates/pactile/scripts/spec_health_outcomes.py +160 -0
- package/dist/templates/pactile/scripts/task.py +1118 -0
- package/dist/templates/pactile/scripts/verify_evidence_probe.py +138 -0
- package/dist/templates/pactile/tasks/.gitkeep +0 -0
- package/dist/templates/pactile/tasks/locale/en/default-prd.md +27 -0
- package/dist/templates/pactile/tasks/locale/zh/default-prd.md +27 -0
- package/dist/templates/pactile/tasks/templates/release-execution/design.md +61 -0
- package/dist/templates/pactile/tasks/templates/release-execution/handoff-template.md +29 -0
- package/dist/templates/pactile/tasks/templates/release-execution/implement.md +29 -0
- package/dist/templates/pactile/tasks/templates/release-execution/prd.md +31 -0
- package/dist/templates/pactile/tasks/templates/release-readiness/design.md +50 -0
- package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +39 -0
- package/dist/templates/pactile/tasks/templates/release-readiness/implement.md +29 -0
- package/dist/templates/pactile/tasks/templates/release-readiness/prd.md +31 -0
- package/dist/templates/pactile/workflow.md +64 -0
- package/dist/templates/shared-hooks/event-bridge.py +121 -0
- package/dist/templates/shared-hooks/index.d.ts +50 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +96 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/inject-retrieval-plan.py +217 -0
- package/dist/templates/shared-hooks/inject-shell-session-context.py +183 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +267 -0
- package/dist/templates/shared-hooks/inject-workflow-state.py +106 -0
- package/dist/templates/shared-hooks/rename-session-for-task.py +231 -0
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +345 -0
- package/dist/templates/shared-hooks/session-start.py +355 -0
- package/dist/templates/shared-hooks/spec-write-audit.py +173 -0
- package/dist/templates/template-utils.d.ts +28 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +83 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/types/ai-tools.d.ts +102 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +60 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +125 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/agents-md.d.ts +27 -0
- package/dist/utils/agents-md.d.ts.map +1 -0
- package/dist/utils/agents-md.js +70 -0
- package/dist/utils/agents-md.js.map +1 -0
- package/dist/utils/codebase-retrieval-router.d.ts +31 -0
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -0
- package/dist/utils/codebase-retrieval-router.js +88 -0
- package/dist/utils/codebase-retrieval-router.js.map +1 -0
- package/dist/utils/compare-versions.d.ts +12 -0
- package/dist/utils/compare-versions.d.ts.map +1 -0
- package/dist/utils/compare-versions.js +86 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/cursor-retrieval-env.d.ts +17 -0
- package/dist/utils/cursor-retrieval-env.d.ts.map +1 -0
- package/dist/utils/cursor-retrieval-env.js +19 -0
- package/dist/utils/cursor-retrieval-env.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +63 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +203 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +59 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +176 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/mirror-check.d.ts +22 -0
- package/dist/utils/mirror-check.d.ts.map +1 -0
- package/dist/utils/mirror-check.js +90 -0
- package/dist/utils/mirror-check.js.map +1 -0
- package/dist/utils/normalize-text.d.ts +7 -0
- package/dist/utils/normalize-text.d.ts.map +1 -0
- package/dist/utils/normalize-text.js +16 -0
- package/dist/utils/normalize-text.js.map +1 -0
- package/dist/utils/p36-upgrade.d.ts +62 -0
- package/dist/utils/p36-upgrade.d.ts.map +1 -0
- package/dist/utils/p36-upgrade.js +165 -0
- package/dist/utils/p36-upgrade.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/post-update-smoke.d.ts +7 -0
- package/dist/utils/post-update-smoke.d.ts.map +1 -0
- package/dist/utils/post-update-smoke.js +40 -0
- package/dist/utils/post-update-smoke.js.map +1 -0
- package/dist/utils/project-capabilities.d.ts +82 -0
- package/dist/utils/project-capabilities.d.ts.map +1 -0
- package/dist/utils/project-capabilities.js +691 -0
- package/dist/utils/project-capabilities.js.map +1 -0
- package/dist/utils/project-detector.d.ts +46 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +666 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/proxy.d.ts +25 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +60 -0
- package/dist/utils/proxy.js.map +1 -0
- package/dist/utils/readiness.d.ts +40 -0
- package/dist/utils/readiness.d.ts.map +1 -0
- package/dist/utils/readiness.js +491 -0
- package/dist/utils/readiness.js.map +1 -0
- package/dist/utils/retrieval-agent-instructions.d.ts +10 -0
- package/dist/utils/retrieval-agent-instructions.d.ts.map +1 -0
- package/dist/utils/retrieval-agent-instructions.js +97 -0
- package/dist/utils/retrieval-agent-instructions.js.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts +53 -0
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -0
- package/dist/utils/retrieval-execution-telemetry.js +116 -0
- package/dist/utils/retrieval-execution-telemetry.js.map +1 -0
- package/dist/utils/retrieval-result-ranking.d.ts +34 -0
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -0
- package/dist/utils/retrieval-result-ranking.js +71 -0
- package/dist/utils/retrieval-result-ranking.js.map +1 -0
- package/dist/utils/retrieval-tool-classification.d.ts +18 -0
- package/dist/utils/retrieval-tool-classification.d.ts.map +1 -0
- package/dist/utils/retrieval-tool-classification.js +118 -0
- package/dist/utils/retrieval-tool-classification.js.map +1 -0
- package/dist/utils/semantic-plan-gate.d.ts +8 -0
- package/dist/utils/semantic-plan-gate.d.ts.map +1 -0
- package/dist/utils/semantic-plan-gate.js +24 -0
- package/dist/utils/semantic-plan-gate.js.map +1 -0
- package/dist/utils/task-json.d.ts +13 -0
- package/dist/utils/task-json.d.ts.map +1 -0
- package/dist/utils/task-json.js +12 -0
- package/dist/utils/task-json.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +150 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +907 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +123 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +375 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +30 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +196 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/dist/utils/update-rollout-report.d.ts +171 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -0
- package/dist/utils/update-rollout-report.js +126 -0
- package/dist/utils/update-rollout-report.js.map +1 -0
- package/dist/utils/validate-rules.d.ts +21 -0
- package/dist/utils/validate-rules.d.ts.map +1 -0
- package/dist/utils/validate-rules.js +88 -0
- package/dist/utils/validate-rules.js.map +1 -0
- package/dist/utils/workflow-dir.d.ts +15 -0
- package/dist/utils/workflow-dir.d.ts.map +1 -0
- package/dist/utils/workflow-dir.js +33 -0
- package/dist/utils/workflow-dir.js.map +1 -0
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +117 -0
- package/scripts/postinstall.js +6 -0
|
@@ -0,0 +1,1339 @@
|
|
|
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
|