@blxzer/pactile 0.5.0 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +612 -563
- package/LICENSE +235 -235
- package/README.md +108 -105
- package/README.zh-CN.md +105 -105
- package/bin/compat-warning.js +11 -11
- package/bin/cstl.js +6 -6
- package/bin/pactile.js +3 -3
- package/bin/smart-search.js +38 -38
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +79 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/codex.d.ts +3 -0
- package/dist/commands/codex.d.ts.map +1 -0
- package/dist/commands/codex.js +54 -0
- package/dist/commands/codex.js.map +1 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +272 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +285 -456
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.js +1 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/parallel.d.ts +2 -0
- package/dist/commands/parallel.d.ts.map +1 -0
- package/dist/commands/parallel.js +26 -0
- package/dist/commands/parallel.js.map +1 -0
- package/dist/commands/pi.d.ts +3 -0
- package/dist/commands/pi.d.ts.map +1 -0
- package/dist/commands/pi.js +94 -0
- package/dist/commands/pi.js.map +1 -0
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +169 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/task.d.ts +3 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +1026 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/update.d.ts +3 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +130 -47
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +1 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/index.d.ts +5 -51
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +9 -140
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +7 -66
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +17 -262
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +5 -6
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +11 -39
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +1 -5
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +1 -5
- package/dist/constants/paths.js.map +1 -1
- package/dist/core/compat/environment.d.ts +43 -0
- package/dist/core/compat/environment.d.ts.map +1 -0
- package/dist/core/compat/environment.js +91 -0
- package/dist/core/compat/environment.js.map +1 -0
- package/dist/core/compat/index.d.ts +2 -0
- package/dist/core/compat/index.d.ts.map +1 -0
- package/dist/core/compat/index.js +2 -0
- package/dist/core/compat/index.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pactile/capability.d.ts +65 -0
- package/dist/core/pactile/capability.d.ts.map +1 -0
- package/dist/core/pactile/capability.js +199 -0
- package/dist/core/pactile/capability.js.map +1 -0
- package/dist/core/pactile/index.d.ts +15 -0
- package/dist/core/pactile/index.d.ts.map +1 -0
- package/dist/core/pactile/index.js +13 -0
- package/dist/core/pactile/index.js.map +1 -0
- package/dist/core/pactile/lifecycle.d.ts +106 -0
- package/dist/core/pactile/lifecycle.d.ts.map +1 -0
- package/dist/core/pactile/lifecycle.js +607 -0
- package/dist/core/pactile/lifecycle.js.map +1 -0
- package/dist/core/pactile/middleware/index.d.ts +3 -0
- package/dist/core/pactile/middleware/index.d.ts.map +1 -0
- package/dist/core/pactile/middleware/index.js +2 -0
- package/dist/core/pactile/middleware/index.js.map +1 -0
- package/dist/core/pactile/middleware/redaction.d.ts +4 -0
- package/dist/core/pactile/middleware/redaction.d.ts.map +1 -0
- package/dist/core/pactile/middleware/redaction.js +34 -0
- package/dist/core/pactile/middleware/redaction.js.map +1 -0
- package/dist/core/pactile/middleware/resolver.d.ts +62 -0
- package/dist/core/pactile/middleware/resolver.d.ts.map +1 -0
- package/dist/core/pactile/middleware/resolver.js +803 -0
- package/dist/core/pactile/middleware/resolver.js.map +1 -0
- package/dist/core/pactile/projection.d.ts +81 -0
- package/dist/core/pactile/projection.d.ts.map +1 -0
- package/dist/core/pactile/projection.js +399 -0
- package/dist/core/pactile/projection.js.map +1 -0
- package/dist/core/pactile/provider.d.ts +81 -0
- package/dist/core/pactile/provider.d.ts.map +1 -0
- package/dist/core/pactile/provider.js +313 -0
- package/dist/core/pactile/provider.js.map +1 -0
- package/dist/core/pactile/runtime.d.ts +56 -0
- package/dist/core/pactile/runtime.d.ts.map +1 -0
- package/dist/core/pactile/runtime.js +176 -0
- package/dist/core/pactile/runtime.js.map +1 -0
- package/dist/core/pactile/tile-compiler-types.d.ts +32 -0
- package/dist/core/pactile/tile-compiler-types.d.ts.map +1 -0
- package/dist/core/pactile/tile-compiler-types.js +2 -0
- package/dist/core/pactile/tile-compiler-types.js.map +1 -0
- package/dist/core/pactile/tile.d.ts +71 -0
- package/dist/core/pactile/tile.d.ts.map +1 -0
- package/dist/core/pactile/tile.js +228 -0
- package/dist/core/pactile/tile.js.map +1 -0
- package/dist/core/pactile/trace-runtime/index.d.ts +38 -0
- package/dist/core/pactile/trace-runtime/index.d.ts.map +1 -0
- package/dist/core/pactile/trace-runtime/index.js +292 -0
- package/dist/core/pactile/trace-runtime/index.js.map +1 -0
- package/dist/core/pactile/trace.d.ts +42 -0
- package/dist/core/pactile/trace.d.ts.map +1 -0
- package/dist/core/pactile/trace.js +221 -0
- package/dist/core/pactile/trace.js.map +1 -0
- package/dist/core/pactile/validation.d.ts +91 -0
- package/dist/core/pactile/validation.d.ts.map +1 -0
- package/dist/core/pactile/validation.js +301 -0
- package/dist/core/pactile/validation.js.map +1 -0
- package/dist/core/task/adapter-middleware.d.ts +122 -0
- package/dist/core/task/adapter-middleware.d.ts.map +1 -0
- package/dist/core/task/adapter-middleware.js +476 -0
- package/dist/core/task/adapter-middleware.js.map +1 -0
- package/dist/core/task/compat.d.ts +7 -0
- package/dist/core/task/compat.d.ts.map +1 -0
- package/dist/core/task/compat.js +2 -0
- package/dist/core/task/compat.js.map +1 -0
- package/dist/core/task/contract-migrate.d.ts +29 -0
- package/dist/core/task/contract-migrate.d.ts.map +1 -0
- package/dist/core/task/contract-migrate.js +207 -0
- package/dist/core/task/contract-migrate.js.map +1 -0
- package/dist/core/task/full-quality.d.ts +89 -0
- package/dist/core/task/full-quality.d.ts.map +1 -0
- package/dist/core/task/full-quality.js +379 -0
- package/dist/core/task/full-quality.js.map +1 -0
- package/dist/core/task/index.d.ts +32 -0
- package/dist/core/task/index.d.ts.map +1 -0
- package/dist/core/task/index.js +20 -0
- package/dist/core/task/index.js.map +1 -0
- package/dist/core/task/kernel-cli.d.ts +51 -0
- package/dist/core/task/kernel-cli.d.ts.map +1 -0
- package/dist/core/task/kernel-cli.js +301 -0
- package/dist/core/task/kernel-cli.js.map +1 -0
- package/dist/core/task/kernel-contract.d.ts +164 -0
- package/dist/core/task/kernel-contract.d.ts.map +1 -0
- package/dist/core/task/kernel-contract.js +475 -0
- package/dist/core/task/kernel-contract.js.map +1 -0
- package/dist/core/task/kernel-store.d.ts +130 -0
- package/dist/core/task/kernel-store.d.ts.map +1 -0
- package/dist/core/task/kernel-store.js +905 -0
- package/dist/core/task/kernel-store.js.map +1 -0
- package/dist/core/task/kernel-surface.d.ts +70 -0
- package/dist/core/task/kernel-surface.d.ts.map +1 -0
- package/dist/core/task/kernel-surface.js +121 -0
- package/dist/core/task/kernel-surface.js.map +1 -0
- package/dist/core/task/lite-context-pack.d.ts +71 -0
- package/dist/core/task/lite-context-pack.d.ts.map +1 -0
- package/dist/core/task/lite-context-pack.js +175 -0
- package/dist/core/task/lite-context-pack.js.map +1 -0
- package/dist/core/task/ondemand-topology.d.ts +108 -0
- package/dist/core/task/ondemand-topology.d.ts.map +1 -0
- package/dist/core/task/ondemand-topology.js +456 -0
- package/dist/core/task/ondemand-topology.js.map +1 -0
- package/dist/core/task/p36-artifact-migrate.d.ts +58 -0
- package/dist/core/task/p36-artifact-migrate.d.ts.map +1 -0
- package/dist/core/task/p36-artifact-migrate.js +293 -0
- package/dist/core/task/p36-artifact-migrate.js.map +1 -0
- package/dist/core/task/p36-wave-c.d.ts +39 -0
- package/dist/core/task/p36-wave-c.d.ts.map +1 -0
- package/dist/core/task/p36-wave-c.js +100 -0
- package/dist/core/task/p36-wave-c.js.map +1 -0
- package/dist/core/task/paths.d.ts +37 -0
- package/dist/core/task/paths.d.ts.map +1 -0
- package/dist/core/task/paths.js +49 -0
- package/dist/core/task/paths.js.map +1 -0
- package/dist/core/task/phase.d.ts +27 -0
- package/dist/core/task/phase.d.ts.map +1 -0
- package/dist/core/task/phase.js +24 -0
- package/dist/core/task/phase.js.map +1 -0
- package/dist/core/task/records.d.ts +48 -0
- package/dist/core/task/records.d.ts.map +1 -0
- package/dist/core/task/records.js +100 -0
- package/dist/core/task/records.js.map +1 -0
- package/dist/core/task/schema.d.ts +77 -0
- package/dist/core/task/schema.d.ts.map +1 -0
- package/dist/core/task/schema.js +220 -0
- package/dist/core/task/schema.js.map +1 -0
- package/dist/core/testing/index.d.ts +2 -0
- package/dist/core/testing/index.d.ts.map +1 -0
- package/dist/core/testing/index.js +4 -0
- package/dist/core/testing/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.0.json +9 -9
- package/dist/migrations/manifests/0.1.1.json +9 -9
- package/dist/migrations/manifests/0.1.2.json +9 -9
- package/dist/migrations/manifests/0.1.3.json +9 -9
- package/dist/migrations/manifests/0.1.4.json +9 -9
- package/dist/migrations/manifests/0.2.1.json +9 -9
- package/dist/migrations/manifests/0.2.10.json +374 -374
- package/dist/migrations/manifests/0.2.2.json +8 -8
- package/dist/migrations/manifests/0.2.3.json +9 -9
- package/dist/migrations/manifests/0.2.4.json +8 -8
- package/dist/migrations/manifests/0.2.5.json +8 -8
- package/dist/migrations/manifests/0.2.6.json +8 -8
- package/dist/migrations/manifests/0.2.7.json +8 -8
- package/dist/migrations/manifests/0.2.8.json +9 -9
- package/dist/migrations/manifests/0.2.9.json +9 -9
- package/dist/migrations/manifests/0.3.0.json +89 -89
- package/dist/migrations/manifests/0.3.1.json +32 -32
- package/dist/migrations/manifests/0.3.2.json +16 -16
- package/dist/migrations/manifests/0.3.3.json +9 -9
- package/dist/migrations/manifests/0.3.4.json +9 -9
- package/dist/migrations/manifests/0.3.5.json +9 -9
- package/dist/migrations/manifests/0.3.6.json +9 -9
- package/dist/migrations/manifests/0.4.0.json +9 -9
- package/dist/migrations/manifests/0.4.1.json +9 -9
- package/dist/migrations/manifests/0.4.2.json +9 -9
- package/dist/migrations/manifests/0.4.3.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.0.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.2.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.3.json +8 -8
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -9
- package/dist/migrations/manifests/0.5.0-beta.5.json +9 -9
- package/dist/migrations/manifests/0.5.0.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.1.json +35 -0
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0.json +9 -0
- package/dist/pactile/adapters/codex/index.js +1 -1
- package/dist/pactile/adapters/codex/index.js.map +1 -1
- package/dist/pactile/adapters/index.d.ts +0 -1
- package/dist/pactile/adapters/index.d.ts.map +1 -1
- package/dist/pactile/adapters/index.js +0 -1
- package/dist/pactile/adapters/index.js.map +1 -1
- package/dist/pactile/adoption/bindings.d.ts +1 -1
- package/dist/pactile/adoption/bindings.d.ts.map +1 -1
- package/dist/pactile/adoption/bindings.js +1 -1
- package/dist/pactile/adoption/bindings.js.map +1 -1
- package/dist/pactile/adoption/inventory.d.ts +1 -1
- package/dist/pactile/adoption/inventory.d.ts.map +1 -1
- package/dist/pactile/adoption/inventory.js +1 -1
- package/dist/pactile/adoption/inventory.js.map +1 -1
- package/dist/pactile/adoption/safety.js +1 -1
- package/dist/pactile/adoption/safety.js.map +1 -1
- package/dist/pactile/adoption/workflow.d.ts +1 -1
- package/dist/pactile/adoption/workflow.d.ts.map +1 -1
- package/dist/pactile/adoption/workflow.js +1 -1
- package/dist/pactile/adoption/workflow.js.map +1 -1
- package/dist/pactile/codex/bridge.d.ts +71 -0
- package/dist/pactile/codex/bridge.d.ts.map +1 -0
- package/dist/pactile/codex/bridge.js +271 -0
- package/dist/pactile/codex/bridge.js.map +1 -0
- package/dist/pactile/compat/init-context.js +1 -1
- package/dist/pactile/compat/init-context.js.map +1 -1
- package/dist/pactile/compat/node-entry-migration.d.ts +3 -0
- package/dist/pactile/compat/node-entry-migration.d.ts.map +1 -0
- package/dist/pactile/compat/node-entry-migration.js +25 -0
- package/dist/pactile/compat/node-entry-migration.js.map +1 -0
- package/dist/pactile/exit/receipt.js +1 -1
- package/dist/pactile/exit/receipt.js.map +1 -1
- package/dist/pactile/exit/service.d.ts +1 -1
- package/dist/pactile/exit/service.d.ts.map +1 -1
- package/dist/pactile/exit/service.js +1 -3
- package/dist/pactile/exit/service.js.map +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts +1 -1
- package/dist/pactile/lifecycle/command-runner.d.ts.map +1 -1
- package/dist/pactile/lifecycle/command-runner.js +1 -3
- package/dist/pactile/lifecycle/command-runner.js.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.d.ts.map +1 -1
- package/dist/pactile/lifecycle/default-adapters.js +8 -32
- package/dist/pactile/lifecycle/default-adapters.js.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts +1 -1
- package/dist/pactile/lifecycle/orchestrator.d.ts.map +1 -1
- package/dist/pactile/lifecycle/orchestrator.js +1 -1
- package/dist/pactile/lifecycle/orchestrator.js.map +1 -1
- package/dist/pactile/lifecycle/project-files.d.ts.map +1 -1
- package/dist/pactile/lifecycle/project-files.js +4 -1
- package/dist/pactile/lifecycle/project-files.js.map +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts +1 -1
- package/dist/pactile/middleware/manifest-loader.d.ts.map +1 -1
- package/dist/pactile/middleware/manifest-loader.js +1 -1
- package/dist/pactile/middleware/manifest-loader.js.map +1 -1
- package/dist/pactile/migration/transaction.d.ts +1 -1
- package/dist/pactile/migration/transaction.d.ts.map +1 -1
- package/dist/pactile/migration/transaction.js +1 -1
- package/dist/pactile/migration/transaction.js.map +1 -1
- package/dist/pactile/parallel/batch.d.ts +41 -0
- package/dist/pactile/parallel/batch.d.ts.map +1 -0
- package/dist/pactile/parallel/batch.js +190 -0
- package/dist/pactile/parallel/batch.js.map +1 -0
- package/dist/pactile/parallel/policy.d.ts +18 -0
- package/dist/pactile/parallel/policy.d.ts.map +1 -0
- package/dist/pactile/parallel/policy.js +174 -0
- package/dist/pactile/parallel/policy.js.map +1 -0
- package/dist/pactile/pi/bridge.d.ts +51 -0
- package/dist/pactile/pi/bridge.d.ts.map +1 -0
- package/dist/pactile/pi/bridge.js +353 -0
- package/dist/pactile/pi/bridge.js.map +1 -0
- package/dist/pactile/pi/rpc.d.ts +41 -0
- package/dist/pactile/pi/rpc.d.ts.map +1 -0
- package/dist/pactile/pi/rpc.js +219 -0
- package/dist/pactile/pi/rpc.js.map +1 -0
- package/dist/pactile/projection/planner.d.ts +1 -1
- package/dist/pactile/projection/planner.d.ts.map +1 -1
- package/dist/pactile/projection/planner.js +1 -1
- package/dist/pactile/projection/planner.js.map +1 -1
- package/dist/pactile/projection/shared/index.js +1 -1
- package/dist/pactile/projection/shared/index.js.map +1 -1
- package/dist/pactile/projection/store.js +1 -1
- package/dist/pactile/projection/store.js.map +1 -1
- package/dist/pactile/providers/probes.d.ts +2 -2
- package/dist/pactile/providers/probes.d.ts.map +1 -1
- package/dist/pactile/providers/probes.js +0 -6
- package/dist/pactile/providers/probes.js.map +1 -1
- package/dist/pactile/registry.d.ts +1 -8
- package/dist/pactile/registry.d.ts.map +1 -1
- package/dist/pactile/registry.js +8 -25
- package/dist/pactile/registry.js.map +1 -1
- package/dist/pactile/retrieval/envelope.d.ts +19 -0
- package/dist/pactile/retrieval/envelope.d.ts.map +1 -0
- package/dist/pactile/retrieval/envelope.js +115 -0
- package/dist/pactile/retrieval/envelope.js.map +1 -0
- package/dist/pactile/retrieval/evidence.js +1 -1
- package/dist/pactile/retrieval/evidence.js.map +1 -1
- package/dist/pactile/retrieval/pack.d.ts +9 -0
- package/dist/pactile/retrieval/pack.d.ts.map +1 -0
- package/dist/pactile/retrieval/pack.js +300 -0
- package/dist/pactile/retrieval/pack.js.map +1 -0
- package/dist/pactile/retrieval/planner.d.ts +1 -1
- package/dist/pactile/retrieval/planner.d.ts.map +1 -1
- package/dist/pactile/retrieval/planner.js +1 -1
- package/dist/pactile/retrieval/planner.js.map +1 -1
- package/dist/pactile/retrieval/types.d.ts +1 -1
- package/dist/pactile/retrieval/types.d.ts.map +1 -1
- package/dist/pactile/runtime/json-api.d.ts +1 -1
- package/dist/pactile/runtime/json-api.js +1 -1
- package/dist/pactile/runtime/paths.js +1 -1
- package/dist/pactile/runtime/paths.js.map +1 -1
- package/dist/pactile/runtime/stores.d.ts +1 -1
- package/dist/pactile/runtime/stores.d.ts.map +1 -1
- package/dist/pactile/runtime/stores.js +1 -1
- package/dist/pactile/runtime/stores.js.map +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.d.ts +1 -1
- package/dist/pactile/runtime/unicode-nfc-data.js +1 -1
- package/dist/pactile/task/config.d.ts +9 -0
- package/dist/pactile/task/config.d.ts.map +1 -0
- package/dist/pactile/task/config.js +103 -0
- package/dist/pactile/task/config.js.map +1 -0
- package/dist/pactile/task/context.d.ts +19 -0
- package/dist/pactile/task/context.d.ts.map +1 -0
- package/dist/pactile/task/context.js +117 -0
- package/dist/pactile/task/context.js.map +1 -0
- package/dist/pactile/task/guards.d.ts +21 -0
- package/dist/pactile/task/guards.d.ts.map +1 -0
- package/dist/pactile/task/guards.js +232 -0
- package/dist/pactile/task/guards.js.map +1 -0
- package/dist/pactile/task/scaffold.d.ts +6 -0
- package/dist/pactile/task/scaffold.d.ts.map +1 -0
- package/dist/pactile/task/scaffold.js +57 -0
- package/dist/pactile/task/scaffold.js.map +1 -0
- package/dist/pactile/task/session-memory.d.ts +2 -0
- package/dist/pactile/task/session-memory.d.ts.map +1 -0
- package/dist/pactile/task/session-memory.js +123 -0
- package/dist/pactile/task/session-memory.js.map +1 -0
- package/dist/pactile/task/session-pack.d.ts +3 -0
- package/dist/pactile/task/session-pack.d.ts.map +1 -0
- package/dist/pactile/task/session-pack.js +139 -0
- package/dist/pactile/task/session-pack.js.map +1 -0
- package/dist/pactile/task/session.d.ts +13 -0
- package/dist/pactile/task/session.d.ts.map +1 -0
- package/dist/pactile/task/session.js +105 -0
- package/dist/pactile/task/session.js.map +1 -0
- package/dist/pactile/task/strategy.d.ts +24 -0
- package/dist/pactile/task/strategy.d.ts.map +1 -0
- package/dist/pactile/task/strategy.js +136 -0
- package/dist/pactile/task/strategy.js.map +1 -0
- package/dist/pactile/task/task-map.d.ts +35 -0
- package/dist/pactile/task/task-map.d.ts.map +1 -0
- package/dist/pactile/task/task-map.js +217 -0
- package/dist/pactile/task/task-map.js.map +1 -0
- package/dist/pactile/task/workflow-phase.d.ts +3 -0
- package/dist/pactile/task/workflow-phase.d.ts.map +1 -0
- package/dist/pactile/task/workflow-phase.js +56 -0
- package/dist/pactile/task/workflow-phase.js.map +1 -0
- package/dist/pactile/tiles/catalog.d.ts +1 -1
- package/dist/pactile/tiles/catalog.d.ts.map +1 -1
- package/dist/pactile/tiles/catalog.js +1 -1
- package/dist/pactile/tiles/catalog.js.map +1 -1
- package/dist/pactile/tiles/compiler.d.ts +1 -1
- package/dist/pactile/tiles/compiler.d.ts.map +1 -1
- package/dist/pactile/tiles/compiler.js +1 -1
- package/dist/pactile/tiles/compiler.js.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.d.ts +2 -2
- package/dist/pactile/tiles/content/ondemand/index.d.ts.map +1 -1
- package/dist/pactile/tiles/content/ondemand/index.js +2 -16
- package/dist/pactile/tiles/content/ondemand/index.js.map +1 -1
- package/dist/pactile/tiles/loader.d.ts +1 -1
- package/dist/pactile/tiles/loader.d.ts.map +1 -1
- package/dist/pactile/tiles/loader.js +1 -1
- package/dist/pactile/tiles/loader.js.map +1 -1
- package/dist/templates/common/bundled-skills/pactile-check/SKILL.md +161 -161
- package/dist/templates/common/bundled-skills/pactile-check/references/fowler-12-smells.md +28 -28
- package/dist/templates/common/bundled-skills/pactile-handoff/SKILL.md +117 -117
- package/dist/templates/common/bundled-skills/pactile-meta/SKILL.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/add-project-local-conventions.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-agents.md +5 -47
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-context-loading.md +79 -84
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-hooks.md +5 -57
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-skills-or-commands.md +7 -77
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-spec-structure.md +83 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-task-lifecycle.md +82 -88
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-workflow.md +65 -65
- package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/overview.md +12 -55
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/context-injection.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/generated-files.md +7 -83
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/overview.md +7 -51
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/spec-system.md +102 -102
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/task-system.md +138 -133
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workflow.md +75 -75
- package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/workspace-memory.md +71 -71
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/agents.md +7 -69
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/hooks-and-settings.md +7 -59
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/overview.md +5 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/platform-map.md +9 -45
- package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/skills-and-commands.md +7 -108
- package/dist/templates/common/bundled-skills/pactile-micro-grill/SKILL.md +68 -68
- package/dist/templates/common/bundled-skills/pactile-skill-creator/SKILL.md +47 -47
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/authoring-rules.md +170 -170
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/general-authoring.md +189 -189
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/pactile-skill-locations.md +11 -52
- package/dist/templates/common/bundled-skills/pactile-skill-creator/references/review-checklist.md +52 -52
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/SKILL.md +41 -41
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/mcp-setup.md +18 -90
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/repository-analysis.md +41 -59
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-task-planning.md +61 -61
- package/dist/templates/common/bundled-skills/pactile-spec-bootstrap/references/spec-writing.md +70 -70
- package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +393 -393
- package/dist/templates/common/bundled-skills/smart-search-cli/agents/openai.yaml +3 -3
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/batch-search.md +98 -98
- package/dist/templates/common/bundled-skills/smart-search-cli/examples/evidence-gathering.md +89 -89
- package/dist/templates/common/bundled-skills/smart-search-cli/references/cli-contract.md +323 -323
- package/dist/templates/common/commands/continue.md +60 -62
- package/dist/templates/common/commands/finish-work.md +84 -82
- package/dist/templates/common/commands/start.md +66 -66
- package/dist/templates/common/index.d.ts +0 -20
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +0 -16
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/before-dev.md +35 -35
- package/dist/templates/common/skills/brainstorm.md +204 -204
- package/dist/templates/common/skills/break-loop.md +125 -125
- package/dist/templates/common/skills/update-spec.md +363 -363
- package/dist/templates/extract.d.ts +1 -8
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +0 -31
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/agents.md +14 -14
- package/dist/templates/markdown/framework/artifact-locale-guide.md.txt +93 -93
- package/dist/templates/markdown/framework/codex-worker-dispatch.md.txt +9 -0
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +7 -28
- package/dist/templates/markdown/framework/execution-strategy.md.txt +14 -45
- package/dist/templates/markdown/framework/index.md.txt +20 -31
- package/dist/templates/markdown/framework/injection-budget-guide.md.txt +7 -111
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +139 -238
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +116 -116
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +105 -105
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -30
- package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +9 -199
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -15
- package/dist/templates/markdown/framework/verification-strength-guide.md.txt +185 -185
- package/dist/templates/markdown/gitignore.txt +15 -15
- package/dist/templates/markdown/index.d.ts +1 -5
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +3 -23
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -38
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -59
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -54
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -39
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -51
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -51
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +174 -174
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +162 -162
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +17 -634
- package/dist/templates/markdown/spec/guides/debug-loop-guide.md.txt +227 -227
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +75 -75
- package/dist/templates/markdown/spec/guides/e2e-walkthrough-guide.md.txt +88 -93
- package/dist/templates/markdown/spec/guides/index.md.txt +131 -131
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +137 -139
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +179 -179
- package/dist/templates/markdown/workspace-index.md +122 -125
- package/dist/templates/markdown/worktree.yaml.txt +58 -58
- package/dist/templates/pactile/CONTEXT.md +101 -113
- package/dist/templates/pactile/config/execution-strategy-rules.json +30 -31
- package/dist/templates/pactile/config.yaml +111 -130
- package/dist/templates/pactile/docs/adr/README.md +21 -21
- package/dist/templates/pactile/gitignore.txt +35 -35
- package/dist/templates/pactile/index.d.ts +3 -127
- package/dist/templates/pactile/index.d.ts.map +1 -1
- package/dist/templates/pactile/index.js +13 -298
- package/dist/templates/pactile/index.js.map +1 -1
- package/dist/templates/pactile/modules/approval-personal/contract.md +43 -43
- package/dist/templates/pactile/modules/close-basic/contract.md +37 -37
- package/dist/templates/pactile/modules/context-progressive/contract.md +44 -44
- package/dist/templates/pactile/modules/debug-recovery/contract.md +44 -44
- package/dist/templates/pactile/modules/define-basic/contract.md +39 -39
- package/dist/templates/pactile/modules/define-extended/contract.md +45 -45
- package/dist/templates/pactile/modules/execute-agent/contract.md +38 -38
- package/dist/templates/pactile/modules/independent-check/contract.md +35 -35
- package/dist/templates/pactile/modules/index.json +127 -133
- package/dist/templates/pactile/modules/intake-basic/contract.md +34 -34
- package/dist/templates/pactile/modules/observability-local/contract.md +31 -31
- package/dist/templates/pactile/modules/parent-child/contract.md +45 -45
- package/dist/templates/pactile/modules/personal-memory/contract.md +55 -55
- package/dist/templates/pactile/modules/retention-storage/contract.md +43 -43
- package/dist/templates/pactile/modules/retrieval-extended/contract.md +78 -77
- package/dist/templates/pactile/modules/session-transfer/contract.md +41 -41
- package/dist/templates/pactile/modules/spec-learning/contract.md +50 -50
- package/dist/templates/pactile/modules/vcs-integration/contract.md +46 -46
- package/dist/templates/pactile/modules/verify-basic/contract.md +38 -38
- package/dist/templates/pactile/modules/worker-orchestration/contract.md +47 -47
- package/dist/templates/pactile/scripts/retrieval_probe_matrix_template.json +43 -43
- package/dist/templates/pactile/tasks/locale/en/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/locale/zh/default-prd.md +27 -27
- package/dist/templates/pactile/tasks/templates/release-execution/design.md +60 -60
- package/dist/templates/pactile/tasks/templates/release-execution/handoff-template.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-execution/prd.md +30 -30
- package/dist/templates/pactile/tasks/templates/release-readiness/design.md +49 -49
- package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +38 -38
- package/dist/templates/pactile/tasks/templates/release-readiness/implement.md +28 -28
- package/dist/templates/pactile/tasks/templates/release-readiness/prd.md +30 -30
- package/dist/templates/pactile/workflow.md +65 -64
- package/dist/types/ai-tools.d.ts +12 -13
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +15 -14
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts +1 -1
- package/dist/utils/codebase-retrieval-router.d.ts.map +1 -1
- package/dist/utils/cwd-guard.js +1 -1
- package/dist/utils/cwd-guard.js.map +1 -1
- package/dist/utils/developer.d.ts +5 -0
- package/dist/utils/developer.d.ts.map +1 -0
- package/dist/utils/developer.js +38 -0
- package/dist/utils/developer.js.map +1 -0
- package/dist/utils/git-root.d.ts +3 -0
- package/dist/utils/git-root.d.ts.map +1 -0
- package/dist/utils/git-root.js +24 -0
- package/dist/utils/git-root.js.map +1 -0
- package/dist/utils/local-date.d.ts +3 -0
- package/dist/utils/local-date.d.ts.map +1 -0
- package/dist/utils/local-date.js +8 -0
- package/dist/utils/local-date.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +5 -4
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +11 -21
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/p36-upgrade.d.ts +1 -1
- package/dist/utils/p36-upgrade.d.ts.map +1 -1
- package/dist/utils/p36-upgrade.js +1 -1
- package/dist/utils/p36-upgrade.js.map +1 -1
- package/dist/utils/post-update-smoke.d.ts +1 -4
- package/dist/utils/post-update-smoke.d.ts.map +1 -1
- package/dist/utils/post-update-smoke.js +13 -25
- package/dist/utils/post-update-smoke.js.map +1 -1
- package/dist/utils/project-capabilities.d.ts +2 -17
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +14 -119
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +14 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +61 -30
- package/dist/utils/readiness.js.map +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts +1 -1
- package/dist/utils/retrieval-execution-telemetry.d.ts.map +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts +1 -1
- package/dist/utils/retrieval-result-ranking.d.ts.map +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts +1 -1
- package/dist/utils/retrieval-tool-classification.d.ts.map +1 -1
- package/dist/utils/task-json.d.ts +3 -3
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +3 -3
- package/dist/utils/task-json.js.map +1 -1
- package/dist/utils/template-hash.d.ts +4 -0
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +1 -1
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/update-rollout-report.d.ts +9 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -1
- package/dist/utils/update-rollout-report.js +14 -1
- package/dist/utils/update-rollout-report.js.map +1 -1
- package/package.json +22 -11
- package/scripts/postinstall.js +6 -6
- package/dist/commands/channel/adapters/claude.d.ts +0 -29
- package/dist/commands/channel/adapters/claude.d.ts.map +0 -1
- package/dist/commands/channel/adapters/claude.js +0 -203
- package/dist/commands/channel/adapters/claude.js.map +0 -1
- package/dist/commands/channel/adapters/codex.d.ts +0 -85
- package/dist/commands/channel/adapters/codex.d.ts.map +0 -1
- package/dist/commands/channel/adapters/codex.js +0 -505
- package/dist/commands/channel/adapters/codex.js.map +0 -1
- package/dist/commands/channel/adapters/index.d.ts +0 -84
- package/dist/commands/channel/adapters/index.d.ts.map +0 -1
- package/dist/commands/channel/adapters/index.js +0 -115
- package/dist/commands/channel/adapters/index.js.map +0 -1
- package/dist/commands/channel/adapters/types.d.ts +0 -33
- package/dist/commands/channel/adapters/types.d.ts.map +0 -1
- package/dist/commands/channel/adapters/types.js +0 -2
- package/dist/commands/channel/adapters/types.js.map +0 -1
- package/dist/commands/channel/agent-loader.d.ts +0 -32
- package/dist/commands/channel/agent-loader.d.ts.map +0 -1
- package/dist/commands/channel/agent-loader.js +0 -154
- package/dist/commands/channel/agent-loader.js.map +0 -1
- package/dist/commands/channel/context-loader.d.ts +0 -26
- package/dist/commands/channel/context-loader.d.ts.map +0 -1
- package/dist/commands/channel/context-loader.js +0 -290
- package/dist/commands/channel/context-loader.js.map +0 -1
- package/dist/commands/channel/context.d.ts +0 -16
- package/dist/commands/channel/context.d.ts.map +0 -1
- package/dist/commands/channel/context.js +0 -83
- package/dist/commands/channel/context.js.map +0 -1
- package/dist/commands/channel/create.d.ts +0 -27
- package/dist/commands/channel/create.d.ts.map +0 -1
- package/dist/commands/channel/create.js +0 -39
- package/dist/commands/channel/create.js.map +0 -1
- package/dist/commands/channel/dev-parse-trace.d.ts +0 -14
- package/dist/commands/channel/dev-parse-trace.d.ts.map +0 -1
- package/dist/commands/channel/dev-parse-trace.js +0 -70
- package/dist/commands/channel/dev-parse-trace.js.map +0 -1
- package/dist/commands/channel/guard.d.ts +0 -150
- package/dist/commands/channel/guard.d.ts.map +0 -1
- package/dist/commands/channel/guard.js +0 -475
- package/dist/commands/channel/guard.js.map +0 -1
- package/dist/commands/channel/index.d.ts +0 -3
- package/dist/commands/channel/index.d.ts.map +0 -1
- package/dist/commands/channel/index.js +0 -531
- package/dist/commands/channel/index.js.map +0 -1
- package/dist/commands/channel/interrupt.d.ts +0 -10
- package/dist/commands/channel/interrupt.d.ts.map +0 -1
- package/dist/commands/channel/interrupt.js +0 -22
- package/dist/commands/channel/interrupt.js.map +0 -1
- package/dist/commands/channel/kill.d.ts +0 -7
- package/dist/commands/channel/kill.d.ts.map +0 -1
- package/dist/commands/channel/kill.js +0 -121
- package/dist/commands/channel/kill.js.map +0 -1
- package/dist/commands/channel/list.d.ts +0 -17
- package/dist/commands/channel/list.d.ts.map +0 -1
- package/dist/commands/channel/list.js +0 -233
- package/dist/commands/channel/list.js.map +0 -1
- package/dist/commands/channel/messages.d.ts +0 -15
- package/dist/commands/channel/messages.d.ts.map +0 -1
- package/dist/commands/channel/messages.js +0 -245
- package/dist/commands/channel/messages.js.map +0 -1
- package/dist/commands/channel/rm.d.ts +0 -27
- package/dist/commands/channel/rm.d.ts.map +0 -1
- package/dist/commands/channel/rm.js +0 -216
- package/dist/commands/channel/rm.js.map +0 -1
- package/dist/commands/channel/run.d.ts +0 -30
- package/dist/commands/channel/run.d.ts.map +0 -1
- package/dist/commands/channel/run.js +0 -130
- package/dist/commands/channel/run.js.map +0 -1
- package/dist/commands/channel/send.d.ts +0 -11
- package/dist/commands/channel/send.d.ts.map +0 -1
- package/dist/commands/channel/send.js +0 -24
- package/dist/commands/channel/send.js.map +0 -1
- package/dist/commands/channel/spawn.d.ts +0 -40
- package/dist/commands/channel/spawn.d.ts.map +0 -1
- package/dist/commands/channel/spawn.js +0 -242
- package/dist/commands/channel/spawn.js.map +0 -1
- package/dist/commands/channel/store/events.d.ts +0 -39
- package/dist/commands/channel/store/events.d.ts.map +0 -1
- package/dist/commands/channel/store/events.js +0 -87
- package/dist/commands/channel/store/events.js.map +0 -1
- package/dist/commands/channel/store/filter.d.ts +0 -3
- package/dist/commands/channel/store/filter.d.ts.map +0 -1
- package/dist/commands/channel/store/filter.js +0 -2
- package/dist/commands/channel/store/filter.js.map +0 -1
- package/dist/commands/channel/store/lock.d.ts +0 -23
- package/dist/commands/channel/store/lock.d.ts.map +0 -1
- package/dist/commands/channel/store/lock.js +0 -99
- package/dist/commands/channel/store/lock.js.map +0 -1
- package/dist/commands/channel/store/paths.d.ts +0 -63
- package/dist/commands/channel/store/paths.d.ts.map +0 -1
- package/dist/commands/channel/store/paths.js +0 -247
- package/dist/commands/channel/store/paths.js.map +0 -1
- package/dist/commands/channel/store/schema.d.ts +0 -27
- package/dist/commands/channel/store/schema.d.ts.map +0 -1
- package/dist/commands/channel/store/schema.js +0 -34
- package/dist/commands/channel/store/schema.js.map +0 -1
- package/dist/commands/channel/store/thread-state.d.ts +0 -5
- package/dist/commands/channel/store/thread-state.d.ts.map +0 -1
- package/dist/commands/channel/store/thread-state.js +0 -16
- package/dist/commands/channel/store/thread-state.js.map +0 -1
- package/dist/commands/channel/store/watch.d.ts +0 -19
- package/dist/commands/channel/store/watch.d.ts.map +0 -1
- package/dist/commands/channel/store/watch.js +0 -146
- package/dist/commands/channel/store/watch.js.map +0 -1
- package/dist/commands/channel/supervisor/idle.d.ts +0 -46
- package/dist/commands/channel/supervisor/idle.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/idle.js +0 -72
- package/dist/commands/channel/supervisor/idle.js.map +0 -1
- package/dist/commands/channel/supervisor/inbox.d.ts +0 -30
- package/dist/commands/channel/supervisor/inbox.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/inbox.js +0 -160
- package/dist/commands/channel/supervisor/inbox.js.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.d.ts +0 -68
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/shutdown.js +0 -146
- package/dist/commands/channel/supervisor/shutdown.js.map +0 -1
- package/dist/commands/channel/supervisor/stdout.d.ts +0 -51
- package/dist/commands/channel/supervisor/stdout.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/stdout.js +0 -121
- package/dist/commands/channel/supervisor/stdout.js.map +0 -1
- package/dist/commands/channel/supervisor/turns.d.ts +0 -31
- package/dist/commands/channel/supervisor/turns.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/turns.js +0 -45
- package/dist/commands/channel/supervisor/turns.js.map +0 -1
- package/dist/commands/channel/supervisor/warning.d.ts +0 -48
- package/dist/commands/channel/supervisor/warning.d.ts.map +0 -1
- package/dist/commands/channel/supervisor/warning.js +0 -77
- package/dist/commands/channel/supervisor/warning.js.map +0 -1
- package/dist/commands/channel/supervisor.d.ts +0 -59
- package/dist/commands/channel/supervisor.d.ts.map +0 -1
- package/dist/commands/channel/supervisor.js +0 -345
- package/dist/commands/channel/supervisor.js.map +0 -1
- package/dist/commands/channel/text-body.d.ts +0 -13
- package/dist/commands/channel/text-body.d.ts.map +0 -1
- package/dist/commands/channel/text-body.js +0 -47
- package/dist/commands/channel/text-body.js.map +0 -1
- package/dist/commands/channel/threads.d.ts +0 -39
- package/dist/commands/channel/threads.d.ts.map +0 -1
- package/dist/commands/channel/threads.js +0 -106
- package/dist/commands/channel/threads.js.map +0 -1
- package/dist/commands/channel/title.d.ts +0 -12
- package/dist/commands/channel/title.d.ts.map +0 -1
- package/dist/commands/channel/title.js +0 -24
- package/dist/commands/channel/title.js.map +0 -1
- package/dist/commands/channel/wait.d.ts +0 -17
- package/dist/commands/channel/wait.d.ts.map +0 -1
- package/dist/commands/channel/wait.js +0 -75
- package/dist/commands/channel/wait.js.map +0 -1
- package/dist/commands/validate-rules.d.ts +0 -6
- package/dist/commands/validate-rules.d.ts.map +0 -1
- package/dist/commands/validate-rules.js +0 -33
- package/dist/commands/validate-rules.js.map +0 -1
- package/dist/configurators/cursor.d.ts +0 -21
- package/dist/configurators/cursor.d.ts.map +0 -1
- package/dist/configurators/cursor.js +0 -51
- package/dist/configurators/cursor.js.map +0 -1
- package/dist/pactile/adapters/cursor/index.d.ts +0 -60
- package/dist/pactile/adapters/cursor/index.d.ts.map +0 -1
- package/dist/pactile/adapters/cursor/index.js +0 -186
- package/dist/pactile/adapters/cursor/index.js.map +0 -1
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +0 -179
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +0 -149
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +0 -904
- package/dist/templates/cursor/agents/pactile-check.md +0 -58
- package/dist/templates/cursor/agents/pactile-implement.md +0 -56
- package/dist/templates/cursor/agents/pactile-research.md +0 -51
- package/dist/templates/cursor/commands/handoff.md +0 -101
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +0 -14
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +0 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +0 -20
- package/dist/templates/cursor/fixtures/expected-rules.js.map +0 -1
- package/dist/templates/cursor/hooks.json +0 -52
- package/dist/templates/cursor/index.d.ts +0 -19
- package/dist/templates/cursor/index.d.ts.map +0 -1
- package/dist/templates/cursor/index.js +0 -19
- package/dist/templates/cursor/index.js.map +0 -1
- package/dist/templates/cursor/rules/pactile-bootstrap.mdc +0 -18
- package/dist/templates/cursor/worktrees.json +0 -11
- package/dist/templates/markdown/framework/cursor-context-injection-guide.md.txt +0 -85
- package/dist/templates/markdown/framework/cursor-native-modes-guide.md.txt +0 -239
- package/dist/templates/markdown/framework/cursor-semantic-compliance.md.txt +0 -41
- package/dist/templates/markdown/framework/cursor-subagent-policy.md.txt +0 -90
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +0 -45
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +0 -25
- package/dist/templates/pactile/modules/candidate-pool/contract.md +0 -37
- package/dist/templates/pactile/pool/README.md +0 -149
- package/dist/templates/pactile/pool/items/.gitkeep +0 -0
- package/dist/templates/pactile/pool/plan.md +0 -50
- package/dist/templates/pactile/scripts/__init__.py +0 -5
- package/dist/templates/pactile/scripts/add_session.py +0 -547
- package/dist/templates/pactile/scripts/build_context_pack.py +0 -17
- package/dist/templates/pactile/scripts/build_retrieval_pack.py +0 -376
- package/dist/templates/pactile/scripts/codegraph_session_smoke.py +0 -76
- package/dist/templates/pactile/scripts/common/__init__.py +0 -103
- package/dist/templates/pactile/scripts/common/active_task.py +0 -576
- package/dist/templates/pactile/scripts/common/adapter_middleware.py +0 -1373
- package/dist/templates/pactile/scripts/common/artifact_locale.py +0 -303
- package/dist/templates/pactile/scripts/common/artifact_search.py +0 -587
- package/dist/templates/pactile/scripts/common/cli_adapter.py +0 -135
- package/dist/templates/pactile/scripts/common/cli_environment.py +0 -155
- package/dist/templates/pactile/scripts/common/codebase_retrieval_router.py +0 -1339
- package/dist/templates/pactile/scripts/common/config.py +0 -497
- package/dist/templates/pactile/scripts/common/context_pack.py +0 -371
- package/dist/templates/pactile/scripts/common/cursor_retrieval_env.py +0 -31
- package/dist/templates/pactile/scripts/common/developer.py +0 -190
- package/dist/templates/pactile/scripts/common/execution_strategy.py +0 -268
- package/dist/templates/pactile/scripts/common/full_quality.py +0 -237
- package/dist/templates/pactile/scripts/common/git.py +0 -37
- package/dist/templates/pactile/scripts/common/git_context.py +0 -198
- package/dist/templates/pactile/scripts/common/injection_budget.py +0 -317
- package/dist/templates/pactile/scripts/common/io.py +0 -37
- package/dist/templates/pactile/scripts/common/kernel_command.py +0 -369
- package/dist/templates/pactile/scripts/common/lite_context.py +0 -280
- package/dist/templates/pactile/scripts/common/log.py +0 -45
- package/dist/templates/pactile/scripts/common/ondemand_topology.py +0 -419
- package/dist/templates/pactile/scripts/common/packages_context.py +0 -239
- package/dist/templates/pactile/scripts/common/pactile_config.py +0 -131
- package/dist/templates/pactile/scripts/common/parallel_declaration.py +0 -369
- package/dist/templates/pactile/scripts/common/parent_orchestration.py +0 -1198
- package/dist/templates/pactile/scripts/common/paths.py +0 -756
- package/dist/templates/pactile/scripts/common/pool_refs.py +0 -119
- package/dist/templates/pactile/scripts/common/pool_slice.py +0 -269
- package/dist/templates/pactile/scripts/common/pool_store.py +0 -766
- package/dist/templates/pactile/scripts/common/project_file_stats.py +0 -91
- package/dist/templates/pactile/scripts/common/retrieval_adapter_metadata.py +0 -943
- package/dist/templates/pactile/scripts/common/retrieval_agent_instructions.py +0 -123
- package/dist/templates/pactile/scripts/common/retrieval_evidence.py +0 -915
- package/dist/templates/pactile/scripts/common/retrieval_pack.py +0 -422
- package/dist/templates/pactile/scripts/common/retrieval_pack_context.py +0 -122
- package/dist/templates/pactile/scripts/common/retrieval_plan_gate.py +0 -61
- package/dist/templates/pactile/scripts/common/retrieval_result_ranking.py +0 -104
- package/dist/templates/pactile/scripts/common/retrieval_tool_classification.py +0 -166
- package/dist/templates/pactile/scripts/common/safe_commit.py +0 -285
- package/dist/templates/pactile/scripts/common/semantic_plan_gate.py +0 -53
- package/dist/templates/pactile/scripts/common/session_context.py +0 -1213
- package/dist/templates/pactile/scripts/common/session_memory.py +0 -386
- package/dist/templates/pactile/scripts/common/session_pack.py +0 -886
- package/dist/templates/pactile/scripts/common/smart_search_evidence.py +0 -514
- package/dist/templates/pactile/scripts/common/smart_search_resolve.py +0 -150
- package/dist/templates/pactile/scripts/common/subagent_dispatch.py +0 -592
- package/dist/templates/pactile/scripts/common/task_context.py +0 -241
- package/dist/templates/pactile/scripts/common/task_dashboard.py +0 -286
- package/dist/templates/pactile/scripts/common/task_dependencies.py +0 -648
- package/dist/templates/pactile/scripts/common/task_gates.py +0 -2478
- package/dist/templates/pactile/scripts/common/task_map.py +0 -703
- package/dist/templates/pactile/scripts/common/task_queue.py +0 -188
- package/dist/templates/pactile/scripts/common/task_store.py +0 -2252
- package/dist/templates/pactile/scripts/common/task_utils.py +0 -274
- package/dist/templates/pactile/scripts/common/tasks.py +0 -231
- package/dist/templates/pactile/scripts/common/test_adapter_middleware.py +0 -199
- package/dist/templates/pactile/scripts/common/test_depends_mode_block.py +0 -509
- package/dist/templates/pactile/scripts/common/test_full_quality.py +0 -197
- package/dist/templates/pactile/scripts/common/test_kernel_command.py +0 -336
- package/dist/templates/pactile/scripts/common/test_lite_path.py +0 -190
- package/dist/templates/pactile/scripts/common/test_observable_defaults.py +0 -141
- package/dist/templates/pactile/scripts/common/test_ondemand_topology.py +0 -237
- package/dist/templates/pactile/scripts/common/test_parallel_declaration.py +0 -264
- package/dist/templates/pactile/scripts/common/test_pool_slice.py +0 -198
- package/dist/templates/pactile/scripts/common/test_pool_store.py +0 -452
- package/dist/templates/pactile/scripts/common/test_retrieval_arbitration.py +0 -331
- package/dist/templates/pactile/scripts/common/test_task_dashboard.py +0 -155
- package/dist/templates/pactile/scripts/common/test_task_dependencies.py +0 -329
- package/dist/templates/pactile/scripts/common/test_task_store_kernel_patch.py +0 -163
- package/dist/templates/pactile/scripts/common/types.py +0 -110
- package/dist/templates/pactile/scripts/common/workflow_phase.py +0 -194
- package/dist/templates/pactile/scripts/compile_session_pack.py +0 -15
- package/dist/templates/pactile/scripts/cursor_retrieval_probe.py +0 -64
- package/dist/templates/pactile/scripts/cursor_retrieval_probe_prompt.md +0 -33
- package/dist/templates/pactile/scripts/generate_dispatch_prompt.py +0 -182
- package/dist/templates/pactile/scripts/get_context.py +0 -19
- package/dist/templates/pactile/scripts/get_developer.py +0 -26
- package/dist/templates/pactile/scripts/hooks/linear_sync.py +0 -243
- package/dist/templates/pactile/scripts/init_developer.py +0 -51
- package/dist/templates/pactile/scripts/injection_budget_probe.py +0 -69
- package/dist/templates/pactile/scripts/pool.py +0 -237
- package/dist/templates/pactile/scripts/rank_retrieval_candidates.py +0 -98
- package/dist/templates/pactile/scripts/route_codebase_retrieval.py +0 -72
- package/dist/templates/pactile/scripts/run_smart_search.py +0 -12
- package/dist/templates/pactile/scripts/score_evidence.py +0 -131
- package/dist/templates/pactile/scripts/search_artifacts.py +0 -13
- package/dist/templates/pactile/scripts/search_memory.py +0 -12
- package/dist/templates/pactile/scripts/spec_health_outcomes.py +0 -160
- package/dist/templates/pactile/scripts/task.py +0 -1118
- package/dist/templates/pactile/scripts/verify_evidence_probe.py +0 -138
- package/dist/templates/shared-hooks/event-bridge.py +0 -121
- package/dist/templates/shared-hooks/index.d.ts +0 -50
- package/dist/templates/shared-hooks/index.d.ts.map +0 -1
- package/dist/templates/shared-hooks/index.js +0 -96
- package/dist/templates/shared-hooks/index.js.map +0 -1
- package/dist/templates/shared-hooks/inject-retrieval-plan.py +0 -217
- package/dist/templates/shared-hooks/inject-shell-session-context.py +0 -183
- package/dist/templates/shared-hooks/inject-subagent-context.py +0 -267
- package/dist/templates/shared-hooks/inject-workflow-state.py +0 -106
- package/dist/templates/shared-hooks/rename-session-for-task.py +0 -231
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +0 -345
- package/dist/templates/shared-hooks/session-start.py +0 -355
- package/dist/templates/shared-hooks/spec-write-audit.py +0 -173
- package/dist/utils/mirror-check.d.ts +0 -22
- package/dist/utils/mirror-check.d.ts.map +0 -1
- package/dist/utils/mirror-check.js +0 -90
- package/dist/utils/mirror-check.js.map +0 -1
- package/dist/utils/validate-rules.d.ts +0 -21
- package/dist/utils/validate-rules.d.ts.map +0 -1
- package/dist/utils/validate-rules.js +0 -88
- package/dist/utils/validate-rules.js.map +0 -1
|
@@ -1,1373 +0,0 @@
|
|
|
1
|
-
"""Stage 6 Event Bridge + Middleware Provider projection.
|
|
2
|
-
|
|
3
|
-
Kernel extras remain authoritative. This module mirrors the contract for
|
|
4
|
-
hooks and tests. It does not write a second store or invent Command ops.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
import hashlib
|
|
10
|
-
import json
|
|
11
|
-
import math
|
|
12
|
-
import re
|
|
13
|
-
from datetime import datetime
|
|
14
|
-
from typing import Any
|
|
15
|
-
|
|
16
|
-
STAGE6_SOURCE = "stage6-adapter-middleware"
|
|
17
|
-
STAGE6_SCHEMA_VERSION = 1
|
|
18
|
-
SMART_SEARCH_PROVIDER = "legacy.external"
|
|
19
|
-
EXTERNAL_KNOWLEDGE_CAPABILITY = "external-knowledge"
|
|
20
|
-
RETRIEVAL_INTENTS = ("exact", "semantic", "structural", "external")
|
|
21
|
-
OPTIONAL_CODE_INTEL_PROVIDERS: tuple[str, ...] = ()
|
|
22
|
-
SHIPPED_MIDDLEWARE_PROVIDERS: tuple[str, ...] = ()
|
|
23
|
-
DEFAULT_REQUIRED_MIDDLEWARE_PROVIDERS: tuple[str, ...] = ()
|
|
24
|
-
SHIPPED_PROVIDER_CAPABILITY: dict[str, str] = {}
|
|
25
|
-
SHIPPED_PROVIDER_PROBE: dict[str, str] = {}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class AdapterMiddlewareError(RuntimeError):
|
|
29
|
-
"""Event Bridge / Middleware contract rejected a request."""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
PROFILE_BASELINE_MODULES = (
|
|
33
|
-
"intake-basic",
|
|
34
|
-
"define-basic",
|
|
35
|
-
"approval-personal",
|
|
36
|
-
"execute-agent",
|
|
37
|
-
"verify-basic",
|
|
38
|
-
"close-basic",
|
|
39
|
-
"context-progressive",
|
|
40
|
-
"observability-local",
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# Hook subscriptions filled/cleared with Profile activation. Unsubscribed
|
|
44
|
-
# hooks stay no-op and must not crash.
|
|
45
|
-
MODULE_HOOK_SUBSCRIPTIONS: dict[str, tuple[dict[str, str], ...]] = {
|
|
46
|
-
"context-progressive": (
|
|
47
|
-
{
|
|
48
|
-
"event": "sessionStart",
|
|
49
|
-
"module": "context-progressive",
|
|
50
|
-
"hook": "session-start.py",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"event": "beforeShellExecution",
|
|
54
|
-
"module": "context-progressive",
|
|
55
|
-
"hook": "inject-shell-session-context.py",
|
|
56
|
-
},
|
|
57
|
-
),
|
|
58
|
-
"worker-orchestration": (
|
|
59
|
-
{
|
|
60
|
-
"event": "preToolUse",
|
|
61
|
-
"module": "worker-orchestration",
|
|
62
|
-
"hook": "inject-subagent-context.py",
|
|
63
|
-
},
|
|
64
|
-
),
|
|
65
|
-
"retrieval-extended": (
|
|
66
|
-
{
|
|
67
|
-
"event": "beforeSubmitPrompt",
|
|
68
|
-
"module": "retrieval-extended",
|
|
69
|
-
"hook": "inject-retrieval-plan.py",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"event": "stop",
|
|
73
|
-
"module": "retrieval-extended",
|
|
74
|
-
"hook": "research-end-retrieval-pack.py",
|
|
75
|
-
},
|
|
76
|
-
),
|
|
77
|
-
"spec-learning": (
|
|
78
|
-
{
|
|
79
|
-
"event": "preToolUse",
|
|
80
|
-
"module": "spec-learning",
|
|
81
|
-
"hook": "spec-write-audit.py",
|
|
82
|
-
},
|
|
83
|
-
),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def default_event_bridge() -> dict[str, Any]:
|
|
88
|
-
return {
|
|
89
|
-
"schema_version": STAGE6_SCHEMA_VERSION,
|
|
90
|
-
"source": STAGE6_SOURCE,
|
|
91
|
-
"subscriptions": [],
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def _unique_ids(values: list[Any]) -> list[str]:
|
|
96
|
-
out: list[str] = []
|
|
97
|
-
for value in values:
|
|
98
|
-
if not isinstance(value, str):
|
|
99
|
-
continue
|
|
100
|
-
item = value.strip()
|
|
101
|
-
if item and item not in out:
|
|
102
|
-
out.append(item)
|
|
103
|
-
return out
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def _baseline_active_ids(extras: dict[str, Any]) -> list[str]:
|
|
107
|
-
block = extras.get("baseline_modules")
|
|
108
|
-
if not isinstance(block, dict) or "active" not in block:
|
|
109
|
-
return list(PROFILE_BASELINE_MODULES)
|
|
110
|
-
raw = block.get("active")
|
|
111
|
-
if not isinstance(raw, list):
|
|
112
|
-
return []
|
|
113
|
-
allowed = set(PROFILE_BASELINE_MODULES)
|
|
114
|
-
return _unique_ids([item for item in raw if isinstance(item, str) and item in allowed])
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def _ondemand_active_ids(extras: dict[str, Any]) -> list[str]:
|
|
118
|
-
block = extras.get("ondemand_modules")
|
|
119
|
-
if not isinstance(block, dict):
|
|
120
|
-
return []
|
|
121
|
-
raw = block.get("active") or []
|
|
122
|
-
if not isinstance(raw, list):
|
|
123
|
-
return []
|
|
124
|
-
return _unique_ids([item for item in raw if isinstance(item, str)])
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
def subscriptions_for_active_modules(
|
|
128
|
-
*,
|
|
129
|
-
baseline_active: list[str] | None = None,
|
|
130
|
-
ondemand_active: list[str] | None = None,
|
|
131
|
-
) -> list[dict[str, str]]:
|
|
132
|
-
ids = _unique_ids(list(baseline_active or []) + list(ondemand_active or []))
|
|
133
|
-
seen: set[tuple[str, str]] = set()
|
|
134
|
-
out: list[dict[str, str]] = []
|
|
135
|
-
for module_id in ids:
|
|
136
|
-
for item in MODULE_HOOK_SUBSCRIPTIONS.get(module_id, ()):
|
|
137
|
-
key = (item.get("event", ""), item.get("module", ""))
|
|
138
|
-
if key in seen:
|
|
139
|
-
continue
|
|
140
|
-
seen.add(key)
|
|
141
|
-
out.append(dict(item))
|
|
142
|
-
return out
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def sync_event_bridge_subscriptions(extras: dict[str, Any]) -> dict[str, Any]:
|
|
146
|
-
"""Fill or clear `event_bridge.subscriptions` from still-active modules."""
|
|
147
|
-
bridge = extras.get("event_bridge")
|
|
148
|
-
if not isinstance(bridge, dict):
|
|
149
|
-
bridge = default_event_bridge()
|
|
150
|
-
extras["event_bridge"] = bridge
|
|
151
|
-
bridge["subscriptions"] = subscriptions_for_active_modules(
|
|
152
|
-
baseline_active=_baseline_active_ids(extras),
|
|
153
|
-
ondemand_active=_ondemand_active_ids(extras),
|
|
154
|
-
)
|
|
155
|
-
return extras
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def event_bridge_for_dispatch(extras: dict[str, Any] | None) -> dict[str, Any]:
|
|
159
|
-
"""Hook-safe view: missing extras still default Baseline eight on."""
|
|
160
|
-
payload: dict[str, Any] = dict(extras or {})
|
|
161
|
-
sync_event_bridge_subscriptions(payload)
|
|
162
|
-
bridge = payload.get("event_bridge")
|
|
163
|
-
return bridge if isinstance(bridge, dict) else default_event_bridge()
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def _default_readiness() -> dict[str, Any]:
|
|
167
|
-
return {
|
|
168
|
-
provider_id: {
|
|
169
|
-
"status": "unknown",
|
|
170
|
-
"capability": SHIPPED_PROVIDER_CAPABILITY[provider_id],
|
|
171
|
-
"evidence": None,
|
|
172
|
-
}
|
|
173
|
-
for provider_id in SHIPPED_MIDDLEWARE_PROVIDERS
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
def default_middleware_providers() -> dict[str, Any]:
|
|
178
|
-
return {
|
|
179
|
-
"schema_version": STAGE6_SCHEMA_VERSION,
|
|
180
|
-
"source": STAGE6_SOURCE,
|
|
181
|
-
"registered": list(SHIPPED_MIDDLEWARE_PROVIDERS),
|
|
182
|
-
"required": list(DEFAULT_REQUIRED_MIDDLEWARE_PROVIDERS),
|
|
183
|
-
"active": [],
|
|
184
|
-
"degraded": [],
|
|
185
|
-
"readiness": _default_readiness(),
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def default_capability_router() -> dict[str, Any]:
|
|
190
|
-
return {
|
|
191
|
-
"schema_version": STAGE6_SCHEMA_VERSION,
|
|
192
|
-
"source": STAGE6_SOURCE,
|
|
193
|
-
"exact": True,
|
|
194
|
-
"semantic": True,
|
|
195
|
-
"structural": True,
|
|
196
|
-
"external": True,
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
def dispatch_hook_event(
|
|
201
|
-
event_bridge: dict[str, Any],
|
|
202
|
-
event: str,
|
|
203
|
-
*,
|
|
204
|
-
source: str = "host-hooks",
|
|
205
|
-
at: str | None = None,
|
|
206
|
-
) -> dict[str, Any]:
|
|
207
|
-
name = (event or "").strip()
|
|
208
|
-
if not name:
|
|
209
|
-
raise AdapterMiddlewareError("event_bridge.last_event.event must be a non-empty string")
|
|
210
|
-
delivered: list[str] = []
|
|
211
|
-
skipped: list[str] = []
|
|
212
|
-
for item in event_bridge.get("subscriptions") or []:
|
|
213
|
-
if not isinstance(item, dict):
|
|
214
|
-
continue
|
|
215
|
-
module = str(item.get("module") or "").strip()
|
|
216
|
-
if not module:
|
|
217
|
-
continue
|
|
218
|
-
if item.get("event") == name:
|
|
219
|
-
if module not in delivered:
|
|
220
|
-
delivered.append(module)
|
|
221
|
-
else:
|
|
222
|
-
skipped.append(module)
|
|
223
|
-
return {
|
|
224
|
-
"event": name,
|
|
225
|
-
"at": at or "",
|
|
226
|
-
"source": source,
|
|
227
|
-
"delivered": delivered,
|
|
228
|
-
"skipped": skipped,
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
def classify_transport_probe(
|
|
233
|
-
*,
|
|
234
|
-
present: bool | None = None,
|
|
235
|
-
reachable: bool | None = None,
|
|
236
|
-
available: bool | None = None,
|
|
237
|
-
status: str | None = None,
|
|
238
|
-
evidence: str | None = None,
|
|
239
|
-
) -> dict[str, Any]:
|
|
240
|
-
safe_evidence = evidence if _valid_evidence_reference(evidence) else None
|
|
241
|
-
if status in {"ready", "missing", "failed", "unknown"}:
|
|
242
|
-
return {"status": status, "evidence": safe_evidence}
|
|
243
|
-
resolved_present = present if present is not None else available
|
|
244
|
-
if resolved_present is False:
|
|
245
|
-
return {"status": "missing", "evidence": safe_evidence}
|
|
246
|
-
if resolved_present is True and reachable is False:
|
|
247
|
-
return {"status": "failed", "evidence": safe_evidence}
|
|
248
|
-
if resolved_present is True:
|
|
249
|
-
return {"status": "ready", "evidence": safe_evidence}
|
|
250
|
-
return {"status": "unknown", "evidence": safe_evidence}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
def mcp_server_ids_from_config(raw: Any) -> list[str]:
|
|
254
|
-
if not isinstance(raw, dict):
|
|
255
|
-
return []
|
|
256
|
-
servers = raw.get("mcpServers")
|
|
257
|
-
if not isinstance(servers, dict):
|
|
258
|
-
return []
|
|
259
|
-
return [str(name) for name in servers.keys()]
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
def select_registered_mcp_servers(
|
|
263
|
-
configured: list[str] | tuple[str, ...],
|
|
264
|
-
registered: list[str] | tuple[str, ...] | None = None,
|
|
265
|
-
) -> list[str]:
|
|
266
|
-
allow = list(registered if registered is not None else SHIPPED_MIDDLEWARE_PROVIDERS)
|
|
267
|
-
out: list[str] = []
|
|
268
|
-
for name in configured:
|
|
269
|
-
if name in allow and name not in out:
|
|
270
|
-
out.append(name)
|
|
271
|
-
return out
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
def probe_shipped_provider_readiness(
|
|
275
|
-
provider_id: str,
|
|
276
|
-
*,
|
|
277
|
-
present: bool | None = None,
|
|
278
|
-
reachable: bool | None = None,
|
|
279
|
-
available: bool | None = None,
|
|
280
|
-
status: str | None = None,
|
|
281
|
-
evidence: str | None = None,
|
|
282
|
-
capability: str | None = None,
|
|
283
|
-
) -> dict[str, Any]:
|
|
284
|
-
classified = classify_transport_probe(
|
|
285
|
-
present=present,
|
|
286
|
-
reachable=reachable,
|
|
287
|
-
available=available,
|
|
288
|
-
status=status,
|
|
289
|
-
evidence=evidence,
|
|
290
|
-
)
|
|
291
|
-
return {
|
|
292
|
-
"status": classified["status"],
|
|
293
|
-
"capability": capability or SHIPPED_PROVIDER_CAPABILITY.get(
|
|
294
|
-
provider_id,
|
|
295
|
-
EXTERNAL_KNOWLEDGE_CAPABILITY if provider_id == SMART_SEARCH_PROVIDER else "unknown",
|
|
296
|
-
),
|
|
297
|
-
"evidence": classified["evidence"] if _valid_evidence_reference(classified["evidence"]) else None,
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
def apply_middleware_probes(
|
|
302
|
-
providers: dict[str, Any],
|
|
303
|
-
probes: dict[str, Any],
|
|
304
|
-
) -> dict[str, Any]:
|
|
305
|
-
registered = providers.get("registered") or []
|
|
306
|
-
readiness = dict(providers.get("readiness") or {})
|
|
307
|
-
if not isinstance(probes, dict):
|
|
308
|
-
return providers
|
|
309
|
-
for provider_id, value in probes.items():
|
|
310
|
-
if provider_id not in registered or not isinstance(value, dict):
|
|
311
|
-
continue
|
|
312
|
-
readiness[provider_id] = probe_shipped_provider_readiness(
|
|
313
|
-
provider_id,
|
|
314
|
-
present=value.get("present"),
|
|
315
|
-
reachable=value.get("reachable"),
|
|
316
|
-
available=value.get("available"),
|
|
317
|
-
status=value.get("status"),
|
|
318
|
-
evidence=value.get("evidence") if isinstance(value.get("evidence"), str) else None,
|
|
319
|
-
capability=value.get("capability") if isinstance(value.get("capability"), str) else None,
|
|
320
|
-
)
|
|
321
|
-
next_providers = {**providers, "readiness": readiness}
|
|
322
|
-
return next_providers
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
def probe_smart_search_readiness(*, available: bool | None = None, status: str | None = None) -> dict[str, Any]:
|
|
326
|
-
return probe_shipped_provider_readiness(
|
|
327
|
-
SMART_SEARCH_PROVIDER,
|
|
328
|
-
available=available,
|
|
329
|
-
status=status,
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
def normalize_capability_router(raw: Any) -> dict[str, Any]:
|
|
334
|
-
if raw is None:
|
|
335
|
-
return default_capability_router()
|
|
336
|
-
if not isinstance(raw, dict):
|
|
337
|
-
raise AdapterMiddlewareError("capability_router must be a JSON object")
|
|
338
|
-
allowed = {"schema_version", "source", *RETRIEVAL_INTENTS}
|
|
339
|
-
for key in list(raw.keys()):
|
|
340
|
-
if key not in allowed:
|
|
341
|
-
raise AdapterMiddlewareError(
|
|
342
|
-
"capability_router must contain only retrieval intent keys"
|
|
343
|
-
)
|
|
344
|
-
next_router = default_capability_router()
|
|
345
|
-
for intent in RETRIEVAL_INTENTS:
|
|
346
|
-
if raw.get(intent) is False:
|
|
347
|
-
next_router.pop(intent, None)
|
|
348
|
-
else:
|
|
349
|
-
next_router[intent] = True
|
|
350
|
-
return next_router
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
def required_capabilities(extras: dict[str, Any]) -> list[str]:
|
|
354
|
-
raw = extras.get("required_capabilities") or []
|
|
355
|
-
if not isinstance(raw, list):
|
|
356
|
-
return []
|
|
357
|
-
out: list[str] = []
|
|
358
|
-
for item in raw:
|
|
359
|
-
if isinstance(item, str) and item.strip() and item not in out:
|
|
360
|
-
out.append(item.strip())
|
|
361
|
-
return out
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
def assert_external_knowledge(
|
|
365
|
-
extras: dict[str, Any],
|
|
366
|
-
readiness: dict[str, Any],
|
|
367
|
-
*,
|
|
368
|
-
phase: str,
|
|
369
|
-
) -> None:
|
|
370
|
-
if phase in {"create", "patch"}:
|
|
371
|
-
return
|
|
372
|
-
if EXTERNAL_KNOWLEDGE_CAPABILITY not in required_capabilities(extras):
|
|
373
|
-
return
|
|
374
|
-
if readiness.get("status") == "ready":
|
|
375
|
-
return
|
|
376
|
-
if extras.get("external_knowledge_policy") == "degrade":
|
|
377
|
-
extras["profile_health"] = "degraded"
|
|
378
|
-
return
|
|
379
|
-
raise AdapterMiddlewareError(
|
|
380
|
-
"required external capability has no ready authorized Provider"
|
|
381
|
-
)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
# Pactile Provider Resolver v1 -------------------------------------------------
|
|
385
|
-
#
|
|
386
|
-
# This is the shipped Python mirror of the host-neutral TypeScript resolver.
|
|
387
|
-
# It consumes caller-supplied facts only: no clock, filesystem, process,
|
|
388
|
-
# network, environment, credential, host config, or probe is read here.
|
|
389
|
-
|
|
390
|
-
PROVIDER_RESOLUTION_REASON_CODES_V1 = (
|
|
391
|
-
"provider-selected",
|
|
392
|
-
"provider-unsupported",
|
|
393
|
-
"provider-input-invalid",
|
|
394
|
-
"provider-manifest-invalid",
|
|
395
|
-
"provider-manifest-duplicate",
|
|
396
|
-
"provider-runtime-fact-duplicate",
|
|
397
|
-
"provider-binding-duplicate",
|
|
398
|
-
"provider-not-authorized",
|
|
399
|
-
"provider-intent-mismatch",
|
|
400
|
-
"provider-capability-mismatch",
|
|
401
|
-
"provider-policy-filesystem-exceeded",
|
|
402
|
-
"provider-policy-process-exceeded",
|
|
403
|
-
"provider-policy-network-exceeded",
|
|
404
|
-
"provider-policy-credentials-exceeded",
|
|
405
|
-
"provider-policy-privacy-exceeded",
|
|
406
|
-
"provider-policy-egress-exceeded",
|
|
407
|
-
"provider-policy-telemetry-exceeded",
|
|
408
|
-
"provider-policy-cost-exceeded",
|
|
409
|
-
"provider-policy-exceeded",
|
|
410
|
-
"provider-binding-missing",
|
|
411
|
-
"provider-binding-capability-mismatch",
|
|
412
|
-
"provider-binding-intent-mismatch",
|
|
413
|
-
"provider-binding-readiness-unknown",
|
|
414
|
-
"provider-binding-unavailable",
|
|
415
|
-
"provider-runtime-fact-missing",
|
|
416
|
-
"provider-runtime-version-mismatch",
|
|
417
|
-
"provider-readiness-unknown",
|
|
418
|
-
"provider-readiness-unavailable",
|
|
419
|
-
"provider-probe-unexpected",
|
|
420
|
-
"provider-probe-not-run",
|
|
421
|
-
"provider-probe-failed",
|
|
422
|
-
"provider-probe-time-invalid",
|
|
423
|
-
"provider-probe-from-future",
|
|
424
|
-
"provider-probe-expired",
|
|
425
|
-
"provider-freshness-unknown",
|
|
426
|
-
"provider-freshness-stale",
|
|
427
|
-
"provider-assurance-exceeds-manifest",
|
|
428
|
-
"provider-assurance-insufficient",
|
|
429
|
-
"provider-evidence-missing",
|
|
430
|
-
"provider-degraded-without-evidence",
|
|
431
|
-
"provider-active-missing",
|
|
432
|
-
"provider-fallback-disabled",
|
|
433
|
-
"provider-not-preferred",
|
|
434
|
-
"provider-not-selected",
|
|
435
|
-
"provider-eligible",
|
|
436
|
-
"provider-selected-active",
|
|
437
|
-
"provider-selected-fallback",
|
|
438
|
-
"provider-selected-stable",
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
_ASSURANCE_LEVELS = ("best-effort", "evidence-backed", "verified")
|
|
442
|
-
_INTENTS = ("exact", "semantic", "structural", "external")
|
|
443
|
-
_ORIGINS = ("native", "provider", "heuristic")
|
|
444
|
-
_READINESS = ("ready", "degraded", "unavailable")
|
|
445
|
-
_FRESHNESS = ("fresh", "stale", "unknown", "not-applicable")
|
|
446
|
-
_PROBE_RESULTS = ("passed", "failed", "not-run")
|
|
447
|
-
_FILESYSTEM = ("none", "read", "write")
|
|
448
|
-
_PROCESS = ("none", "execute")
|
|
449
|
-
_NETWORK = ("forbidden", "project-authorized")
|
|
450
|
-
_CREDENTIALS = ("forbidden", "project-authorized")
|
|
451
|
-
_PRIVACY = ("local-only", "project-approved-egress", "external")
|
|
452
|
-
_TELEMETRY = ("forbidden", "local-only", "project-authorized")
|
|
453
|
-
_COST = ("none", "free", "low", "medium", "high")
|
|
454
|
-
_LOGICAL_ID = re.compile(r"^[a-z][a-z0-9]*(?:[._:-][a-z0-9]+)*$")
|
|
455
|
-
_SEMVER = re.compile(
|
|
456
|
-
r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)"
|
|
457
|
-
r"(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?"
|
|
458
|
-
r"(?:\+[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$"
|
|
459
|
-
)
|
|
460
|
-
_EVIDENCE_REFERENCE = re.compile(
|
|
461
|
-
r"^evidence://[a-z0-9]+(?:[._-][a-z0-9]+)*"
|
|
462
|
-
r"(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)*$"
|
|
463
|
-
)
|
|
464
|
-
_POLICY_DESTINATION = re.compile(
|
|
465
|
-
r"^[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[0-9]+)?$"
|
|
466
|
-
)
|
|
467
|
-
_OPAQUE_REFERENCE = re.compile(
|
|
468
|
-
r"^([a-z][a-z0-9-]{0,31})://"
|
|
469
|
-
r"([a-z0-9]+(?:[._-][a-z0-9]+)*(?:/[a-z0-9]+(?:[._-][a-z0-9]+)*)*)$"
|
|
470
|
-
)
|
|
471
|
-
_FINGERPRINT = re.compile(r"^sha256:[0-9a-f]{64}$")
|
|
472
|
-
_RFC3339 = re.compile(
|
|
473
|
-
r"^(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})"
|
|
474
|
-
r"T(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2}):(?P<second>[0-9]{2})"
|
|
475
|
-
r"(?:\.(?P<fraction>[0-9]{1,9}))?"
|
|
476
|
-
r"(?:Z|(?P<offset_sign>[+-])(?P<offset_hour>[0-9]{2}):(?P<offset_minute>[0-9]{2}))$"
|
|
477
|
-
)
|
|
478
|
-
_SENSITIVE_REFERENCE_TERMS = {
|
|
479
|
-
"credential",
|
|
480
|
-
"credentials",
|
|
481
|
-
"passwd",
|
|
482
|
-
"password",
|
|
483
|
-
"secret",
|
|
484
|
-
"token",
|
|
485
|
-
}
|
|
486
|
-
_POLICY_KEYS = {
|
|
487
|
-
"filesystem",
|
|
488
|
-
"process",
|
|
489
|
-
"network",
|
|
490
|
-
"credentials",
|
|
491
|
-
"privacy",
|
|
492
|
-
"egressDestinations",
|
|
493
|
-
"telemetry",
|
|
494
|
-
"cost",
|
|
495
|
-
}
|
|
496
|
-
_INVALID_JSON_VALUE = object()
|
|
497
|
-
_FORBIDDEN_JSON_RECORD_KEYS = {"__proto__", "constructor", "prototype"}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
def _snapshot_plain_json_value(value: Any, seen: set[int] | None = None) -> Any:
|
|
501
|
-
if value is None or type(value) in {bool, int, str}:
|
|
502
|
-
return value
|
|
503
|
-
if type(value) is float:
|
|
504
|
-
return value if math.isfinite(value) else _INVALID_JSON_VALUE
|
|
505
|
-
if type(value) not in {dict, list}:
|
|
506
|
-
return _INVALID_JSON_VALUE
|
|
507
|
-
|
|
508
|
-
if seen is None:
|
|
509
|
-
seen = set()
|
|
510
|
-
identity = id(value)
|
|
511
|
-
if identity in seen:
|
|
512
|
-
return _INVALID_JSON_VALUE
|
|
513
|
-
seen.add(identity)
|
|
514
|
-
|
|
515
|
-
if type(value) is list:
|
|
516
|
-
result = []
|
|
517
|
-
for item in value:
|
|
518
|
-
snapshot = _snapshot_plain_json_value(item, seen)
|
|
519
|
-
if snapshot is _INVALID_JSON_VALUE:
|
|
520
|
-
seen.remove(identity)
|
|
521
|
-
return _INVALID_JSON_VALUE
|
|
522
|
-
result.append(snapshot)
|
|
523
|
-
seen.remove(identity)
|
|
524
|
-
return result
|
|
525
|
-
|
|
526
|
-
result = {}
|
|
527
|
-
for key, item in value.items():
|
|
528
|
-
if type(key) is not str or key in _FORBIDDEN_JSON_RECORD_KEYS:
|
|
529
|
-
seen.remove(identity)
|
|
530
|
-
return _INVALID_JSON_VALUE
|
|
531
|
-
snapshot = _snapshot_plain_json_value(item, seen)
|
|
532
|
-
if snapshot is _INVALID_JSON_VALUE:
|
|
533
|
-
seen.remove(identity)
|
|
534
|
-
return _INVALID_JSON_VALUE
|
|
535
|
-
result[key] = snapshot
|
|
536
|
-
seen.remove(identity)
|
|
537
|
-
return result
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
def _is_leap_year(year: int) -> bool:
|
|
541
|
-
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
def _parse_timestamp_ms(value: Any) -> int | None:
|
|
545
|
-
if not isinstance(value, str):
|
|
546
|
-
return None
|
|
547
|
-
match = _RFC3339.fullmatch(value)
|
|
548
|
-
if match is None:
|
|
549
|
-
return None
|
|
550
|
-
year = int(match.group("year"))
|
|
551
|
-
month = int(match.group("month"))
|
|
552
|
-
day = int(match.group("day"))
|
|
553
|
-
hour = int(match.group("hour"))
|
|
554
|
-
minute = int(match.group("minute"))
|
|
555
|
-
second = int(match.group("second"))
|
|
556
|
-
offset_hour = int(match.group("offset_hour") or 0)
|
|
557
|
-
offset_minute = int(match.group("offset_minute") or 0)
|
|
558
|
-
days_in_month = (
|
|
559
|
-
31,
|
|
560
|
-
29 if _is_leap_year(year) else 28,
|
|
561
|
-
31,
|
|
562
|
-
30,
|
|
563
|
-
31,
|
|
564
|
-
30,
|
|
565
|
-
31,
|
|
566
|
-
31,
|
|
567
|
-
30,
|
|
568
|
-
31,
|
|
569
|
-
30,
|
|
570
|
-
31,
|
|
571
|
-
)
|
|
572
|
-
if (
|
|
573
|
-
year == 0
|
|
574
|
-
or month < 1
|
|
575
|
-
or month > 12
|
|
576
|
-
or day < 1
|
|
577
|
-
or day > days_in_month[month - 1]
|
|
578
|
-
or hour > 23
|
|
579
|
-
or minute > 59
|
|
580
|
-
or second > 59
|
|
581
|
-
or offset_hour > 23
|
|
582
|
-
or offset_minute > 59
|
|
583
|
-
):
|
|
584
|
-
return None
|
|
585
|
-
|
|
586
|
-
local = datetime(year, month, day, hour, minute, second)
|
|
587
|
-
epoch = datetime(1970, 1, 1)
|
|
588
|
-
delta = local - epoch
|
|
589
|
-
fraction_ms = int(((match.group("fraction") or "") + "000")[:3])
|
|
590
|
-
offset_minutes = offset_hour * 60 + offset_minute
|
|
591
|
-
if match.group("offset_sign") == "-":
|
|
592
|
-
offset_minutes = -offset_minutes
|
|
593
|
-
return (
|
|
594
|
-
(delta.days * 86_400 + delta.seconds) * 1_000
|
|
595
|
-
+ fraction_ms
|
|
596
|
-
- offset_minutes * 60_000
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
def _valid_timestamp(value: Any) -> bool:
|
|
601
|
-
return _parse_timestamp_ms(value) is not None
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
def _timestamp_ms(value: str) -> int:
|
|
605
|
-
parsed = _parse_timestamp_ms(value)
|
|
606
|
-
if parsed is None:
|
|
607
|
-
raise ValueError("invalid RFC3339 timestamp")
|
|
608
|
-
return parsed
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
def _valid_evidence_reference(value: Any) -> bool:
|
|
612
|
-
if (
|
|
613
|
-
not isinstance(value, str)
|
|
614
|
-
or len(value) > 256
|
|
615
|
-
or _EVIDENCE_REFERENCE.fullmatch(value) is None
|
|
616
|
-
):
|
|
617
|
-
return False
|
|
618
|
-
payload = value[len("evidence://") :].replace("/", ".")
|
|
619
|
-
return not any(
|
|
620
|
-
term in _SENSITIVE_REFERENCE_TERMS for term in re.split(r"[_.-]", payload)
|
|
621
|
-
)
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
def _valid_policy_destination(value: Any) -> bool:
|
|
625
|
-
if (
|
|
626
|
-
not isinstance(value, str)
|
|
627
|
-
or len(value) > 253
|
|
628
|
-
or _POLICY_DESTINATION.fullmatch(value) is None
|
|
629
|
-
):
|
|
630
|
-
return False
|
|
631
|
-
return not any(
|
|
632
|
-
term in _SENSITIVE_REFERENCE_TERMS
|
|
633
|
-
for term in re.split(r"[_.:-]", value)
|
|
634
|
-
)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
def _valid_opaque_reference(value: Any, allowed_schemes: set[str]) -> bool:
|
|
638
|
-
if not isinstance(value, str) or len(value) > 256:
|
|
639
|
-
return False
|
|
640
|
-
match = _OPAQUE_REFERENCE.fullmatch(value)
|
|
641
|
-
if match is None or match.group(1) not in allowed_schemes:
|
|
642
|
-
return False
|
|
643
|
-
return not any(
|
|
644
|
-
term in _SENSITIVE_REFERENCE_TERMS
|
|
645
|
-
for term in re.split(r"[_.\-/]", match.group(2))
|
|
646
|
-
)
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
def _normalize_install_hint(value: Any) -> dict[str, Any] | None:
|
|
650
|
-
keys = {
|
|
651
|
-
"schemaVersion",
|
|
652
|
-
"mechanism",
|
|
653
|
-
"label",
|
|
654
|
-
"reference",
|
|
655
|
-
"requiresAuthentication",
|
|
656
|
-
}
|
|
657
|
-
if not isinstance(value, dict) or set(value) != keys or value.get("schemaVersion") != 1:
|
|
658
|
-
return None
|
|
659
|
-
label = value.get("label")
|
|
660
|
-
reference = value.get("reference")
|
|
661
|
-
if (
|
|
662
|
-
value.get("mechanism") not in {"host-native", "package-manager", "manual"}
|
|
663
|
-
or not isinstance(label, str)
|
|
664
|
-
or len(label) > 128
|
|
665
|
-
or _LOGICAL_ID.fullmatch(label) is None
|
|
666
|
-
or not (
|
|
667
|
-
reference is None
|
|
668
|
-
or _valid_opaque_reference(
|
|
669
|
-
reference, {"docs", "host-native", "package-manager"}
|
|
670
|
-
)
|
|
671
|
-
)
|
|
672
|
-
or not isinstance(value.get("requiresAuthentication"), bool)
|
|
673
|
-
):
|
|
674
|
-
return None
|
|
675
|
-
return dict(value)
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
def _sorted_unique_strings(value: Any, *, logical_ids: bool = False) -> list[str] | None:
|
|
679
|
-
if not isinstance(value, list) or not all(isinstance(item, str) for item in value):
|
|
680
|
-
return None
|
|
681
|
-
if logical_ids and not all(_LOGICAL_ID.fullmatch(item) for item in value):
|
|
682
|
-
return None
|
|
683
|
-
return sorted(set(value))
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
def _normalize_policy(value: Any) -> dict[str, Any] | None:
|
|
687
|
-
if not isinstance(value, dict) or set(value) != _POLICY_KEYS:
|
|
688
|
-
return None
|
|
689
|
-
destinations = value.get("egressDestinations")
|
|
690
|
-
if (
|
|
691
|
-
not isinstance(destinations, list)
|
|
692
|
-
or not all(_valid_policy_destination(item) for item in destinations)
|
|
693
|
-
or len(set(destinations)) != len(destinations)
|
|
694
|
-
or value.get("filesystem") not in _FILESYSTEM
|
|
695
|
-
or value.get("process") not in _PROCESS
|
|
696
|
-
or value.get("network") not in _NETWORK
|
|
697
|
-
or value.get("credentials") not in _CREDENTIALS
|
|
698
|
-
or value.get("privacy") not in _PRIVACY
|
|
699
|
-
or value.get("telemetry") not in _TELEMETRY
|
|
700
|
-
or value.get("cost") not in _COST
|
|
701
|
-
):
|
|
702
|
-
return None
|
|
703
|
-
if value["network"] == "forbidden" and (
|
|
704
|
-
value["privacy"] != "local-only" or destinations
|
|
705
|
-
):
|
|
706
|
-
return None
|
|
707
|
-
if (
|
|
708
|
-
value["network"] == "project-authorized"
|
|
709
|
-
and value["privacy"] != "local-only"
|
|
710
|
-
and not destinations
|
|
711
|
-
):
|
|
712
|
-
return None
|
|
713
|
-
if value["network"] == "forbidden" and value["telemetry"] == "project-authorized":
|
|
714
|
-
return None
|
|
715
|
-
return {
|
|
716
|
-
"filesystem": value["filesystem"],
|
|
717
|
-
"process": value["process"],
|
|
718
|
-
"network": value["network"],
|
|
719
|
-
"credentials": value["credentials"],
|
|
720
|
-
"privacy": value["privacy"],
|
|
721
|
-
"egressDestinations": sorted(destinations),
|
|
722
|
-
"telemetry": value["telemetry"],
|
|
723
|
-
"cost": value["cost"],
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
def _normalize_manifest(value: Any) -> dict[str, Any] | None:
|
|
728
|
-
keys = {
|
|
729
|
-
"schemaVersion",
|
|
730
|
-
"id",
|
|
731
|
-
"version",
|
|
732
|
-
"origin",
|
|
733
|
-
"intents",
|
|
734
|
-
"capabilityIds",
|
|
735
|
-
"maximumAssurance",
|
|
736
|
-
"policyCeiling",
|
|
737
|
-
"evidenceKinds",
|
|
738
|
-
"probe",
|
|
739
|
-
}
|
|
740
|
-
if not isinstance(value, dict) or set(value) != keys or value.get("schemaVersion") != 1:
|
|
741
|
-
return None
|
|
742
|
-
intents = _sorted_unique_strings(value.get("intents"))
|
|
743
|
-
capability_ids = _sorted_unique_strings(value.get("capabilityIds"))
|
|
744
|
-
evidence_kinds = _sorted_unique_strings(value.get("evidenceKinds"))
|
|
745
|
-
policy = _normalize_policy(value.get("policyCeiling"))
|
|
746
|
-
probe = value.get("probe")
|
|
747
|
-
if (
|
|
748
|
-
not isinstance(value.get("id"), str)
|
|
749
|
-
or _LOGICAL_ID.fullmatch(value["id"]) is None
|
|
750
|
-
or not isinstance(value.get("version"), str)
|
|
751
|
-
or _SEMVER.fullmatch(value["version"]) is None
|
|
752
|
-
or value.get("origin") not in _ORIGINS
|
|
753
|
-
or intents is None
|
|
754
|
-
or not intents
|
|
755
|
-
or len(intents) != len(value["intents"])
|
|
756
|
-
or not all(intent in _INTENTS for intent in intents)
|
|
757
|
-
or capability_ids is None
|
|
758
|
-
or len(capability_ids) != len(value["capabilityIds"])
|
|
759
|
-
or not all(_LOGICAL_ID.fullmatch(item) for item in capability_ids)
|
|
760
|
-
or value.get("maximumAssurance") not in _ASSURANCE_LEVELS
|
|
761
|
-
or policy is None
|
|
762
|
-
or evidence_kinds is None
|
|
763
|
-
or len(evidence_kinds) != len(value["evidenceKinds"])
|
|
764
|
-
or not all(evidence_kinds)
|
|
765
|
-
or not isinstance(probe, dict)
|
|
766
|
-
or set(probe) != {"supported", "maxAgeSeconds"}
|
|
767
|
-
or not isinstance(probe.get("supported"), bool)
|
|
768
|
-
):
|
|
769
|
-
return None
|
|
770
|
-
max_age = probe.get("maxAgeSeconds")
|
|
771
|
-
if probe["supported"]:
|
|
772
|
-
if not isinstance(max_age, int) or isinstance(max_age, bool) or max_age < 1:
|
|
773
|
-
return None
|
|
774
|
-
elif max_age is not None:
|
|
775
|
-
return None
|
|
776
|
-
if value["maximumAssurance"] in {"evidence-backed", "verified"} and not evidence_kinds:
|
|
777
|
-
return None
|
|
778
|
-
if value["maximumAssurance"] == "verified" and not probe["supported"]:
|
|
779
|
-
return None
|
|
780
|
-
return {
|
|
781
|
-
"schemaVersion": 1,
|
|
782
|
-
"id": value["id"],
|
|
783
|
-
"version": value["version"],
|
|
784
|
-
"origin": value["origin"],
|
|
785
|
-
"intents": intents,
|
|
786
|
-
"capabilityIds": capability_ids,
|
|
787
|
-
"maximumAssurance": value["maximumAssurance"],
|
|
788
|
-
"policyCeiling": policy,
|
|
789
|
-
"evidenceKinds": evidence_kinds,
|
|
790
|
-
"probe": {"supported": probe["supported"], "maxAgeSeconds": max_age},
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
def _normalize_binding(value: Any) -> dict[str, Any] | None:
|
|
795
|
-
keys = {
|
|
796
|
-
"schemaVersion",
|
|
797
|
-
"id",
|
|
798
|
-
"capabilityId",
|
|
799
|
-
"mode",
|
|
800
|
-
"control",
|
|
801
|
-
"deleteBoundary",
|
|
802
|
-
"asset",
|
|
803
|
-
"intents",
|
|
804
|
-
"providerId",
|
|
805
|
-
}
|
|
806
|
-
if not isinstance(value, dict) or set(value) != keys or value.get("schemaVersion") != 1:
|
|
807
|
-
return None
|
|
808
|
-
asset = value.get("asset")
|
|
809
|
-
owner = asset.get("owner") if isinstance(asset, dict) else None
|
|
810
|
-
asset_keys = {
|
|
811
|
-
"schemaVersion",
|
|
812
|
-
"id",
|
|
813
|
-
"kind",
|
|
814
|
-
"source",
|
|
815
|
-
"scope",
|
|
816
|
-
"owner",
|
|
817
|
-
"locator",
|
|
818
|
-
"fingerprint",
|
|
819
|
-
"readiness",
|
|
820
|
-
"installHint",
|
|
821
|
-
}
|
|
822
|
-
if (
|
|
823
|
-
not isinstance(value.get("id"), str)
|
|
824
|
-
or _LOGICAL_ID.fullmatch(value["id"]) is None
|
|
825
|
-
or not isinstance(value.get("capabilityId"), str)
|
|
826
|
-
or _LOGICAL_ID.fullmatch(value["capabilityId"]) is None
|
|
827
|
-
or value.get("mode") not in {"native", "adopted", "composed"}
|
|
828
|
-
or value.get("control") not in {"borrowed", "pactile-owned"}
|
|
829
|
-
or value.get("deleteBoundary") not in {"preserve", "remove-when-unclaimed"}
|
|
830
|
-
or not isinstance(asset, dict)
|
|
831
|
-
or set(asset) != asset_keys
|
|
832
|
-
or asset.get("schemaVersion") != 1
|
|
833
|
-
or not isinstance(asset.get("id"), str)
|
|
834
|
-
or _LOGICAL_ID.fullmatch(asset["id"]) is None
|
|
835
|
-
or asset.get("kind") not in {"skill", "mcp", "plugin", "executable", "service"}
|
|
836
|
-
or asset.get("source") not in {
|
|
837
|
-
"host-native",
|
|
838
|
-
"user-installed",
|
|
839
|
-
"pactile-bundled",
|
|
840
|
-
"project-vendored",
|
|
841
|
-
}
|
|
842
|
-
or asset.get("scope") not in {"project", "user", "host"}
|
|
843
|
-
or not isinstance(owner, dict)
|
|
844
|
-
or set(owner) != {"kind", "id"}
|
|
845
|
-
or owner.get("kind") not in {"user", "host", "pactile", "third-party"}
|
|
846
|
-
or asset.get("readiness") not in {"ready", "degraded", "missing", "unknown"}
|
|
847
|
-
):
|
|
848
|
-
return None
|
|
849
|
-
owner_id = owner.get("id")
|
|
850
|
-
fingerprint = asset.get("fingerprint")
|
|
851
|
-
hint_value = asset.get("installHint")
|
|
852
|
-
hint = None if hint_value is None else _normalize_install_hint(hint_value)
|
|
853
|
-
if (
|
|
854
|
-
not (owner_id is None or isinstance(owner_id, str) and bool(owner_id))
|
|
855
|
-
or owner["kind"] in {"pactile", "third-party"} and owner_id is None
|
|
856
|
-
or asset["source"] == "pactile-bundled" and owner["kind"] != "pactile"
|
|
857
|
-
or asset["source"] == "host-native" and owner["kind"] != "host"
|
|
858
|
-
or not _valid_opaque_reference(asset.get("locator"), {asset["source"]})
|
|
859
|
-
or not (
|
|
860
|
-
fingerprint is None
|
|
861
|
-
or isinstance(fingerprint, str) and _FINGERPRINT.fullmatch(fingerprint)
|
|
862
|
-
)
|
|
863
|
-
or hint_value is not None and hint is None
|
|
864
|
-
or asset["readiness"] == "missing" and hint is None
|
|
865
|
-
):
|
|
866
|
-
return None
|
|
867
|
-
intents = _sorted_unique_strings(value.get("intents"))
|
|
868
|
-
provider_id = value.get("providerId")
|
|
869
|
-
if (
|
|
870
|
-
intents is None
|
|
871
|
-
or len(intents) != len(value["intents"])
|
|
872
|
-
or not all(intent in _INTENTS for intent in intents)
|
|
873
|
-
or not (
|
|
874
|
-
provider_id is None
|
|
875
|
-
or isinstance(provider_id, str) and _LOGICAL_ID.fullmatch(provider_id)
|
|
876
|
-
)
|
|
877
|
-
or asset["kind"] == "mcp" and provider_id is None
|
|
878
|
-
or value["control"] == "borrowed" and value["deleteBoundary"] != "preserve"
|
|
879
|
-
or value["mode"] in {"native", "adopted"} and value["control"] != "borrowed"
|
|
880
|
-
or value["mode"] == "native"
|
|
881
|
-
and asset["source"] not in {"host-native", "user-installed"}
|
|
882
|
-
or value["mode"] == "adopted" and asset["source"] == "pactile-bundled"
|
|
883
|
-
or value["control"] == "pactile-owned"
|
|
884
|
-
and (
|
|
885
|
-
owner["kind"] != "pactile"
|
|
886
|
-
or value["deleteBoundary"] != "remove-when-unclaimed"
|
|
887
|
-
or value["mode"] != "composed"
|
|
888
|
-
or asset["source"] not in {"pactile-bundled", "project-vendored"}
|
|
889
|
-
)
|
|
890
|
-
):
|
|
891
|
-
return None
|
|
892
|
-
normalized = dict(value)
|
|
893
|
-
normalized["asset"] = {
|
|
894
|
-
**asset,
|
|
895
|
-
"owner": dict(owner),
|
|
896
|
-
"installHint": hint,
|
|
897
|
-
}
|
|
898
|
-
normalized["intents"] = intents
|
|
899
|
-
return normalized
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
def _normalize_runtime_fact(value: Any) -> dict[str, Any] | None:
|
|
903
|
-
keys = {
|
|
904
|
-
"providerId",
|
|
905
|
-
"providerVersion",
|
|
906
|
-
"readiness",
|
|
907
|
-
"assurance",
|
|
908
|
-
"freshness",
|
|
909
|
-
"probedAt",
|
|
910
|
-
"probeResult",
|
|
911
|
-
"evidenceRefs",
|
|
912
|
-
}
|
|
913
|
-
if not isinstance(value, dict) or set(value) != keys:
|
|
914
|
-
return None
|
|
915
|
-
refs = value.get("evidenceRefs")
|
|
916
|
-
probed_at = value.get("probedAt")
|
|
917
|
-
if (
|
|
918
|
-
not isinstance(value.get("providerId"), str)
|
|
919
|
-
or _LOGICAL_ID.fullmatch(value["providerId"]) is None
|
|
920
|
-
or not isinstance(value.get("providerVersion"), str)
|
|
921
|
-
or _SEMVER.fullmatch(value["providerVersion"]) is None
|
|
922
|
-
or value.get("readiness") not in {*_READINESS, "unknown"}
|
|
923
|
-
or value.get("assurance") not in {*_ASSURANCE_LEVELS, None}
|
|
924
|
-
or value.get("freshness") not in _FRESHNESS
|
|
925
|
-
or value.get("probeResult") not in _PROBE_RESULTS
|
|
926
|
-
or not isinstance(refs, list)
|
|
927
|
-
or not all(_valid_evidence_reference(ref) for ref in refs)
|
|
928
|
-
or not (probed_at is None or _valid_timestamp(probed_at))
|
|
929
|
-
or value["probeResult"] == "not-run" and probed_at is not None
|
|
930
|
-
or value["probeResult"] != "not-run" and probed_at is None
|
|
931
|
-
):
|
|
932
|
-
return None
|
|
933
|
-
normalized = dict(value)
|
|
934
|
-
normalized["evidenceRefs"] = sorted(set(refs))
|
|
935
|
-
return normalized
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
def _invalid_resolution(reason: str) -> dict[str, Any]:
|
|
939
|
-
return {
|
|
940
|
-
"schemaVersion": 1,
|
|
941
|
-
"status": "invalid",
|
|
942
|
-
"resolution": None,
|
|
943
|
-
"fingerprint": None,
|
|
944
|
-
"explain": {
|
|
945
|
-
"schemaVersion": 1,
|
|
946
|
-
"decision": "invalid",
|
|
947
|
-
"reasonCode": reason,
|
|
948
|
-
"selectedProviderId": None,
|
|
949
|
-
"fallbackFromProviderId": None,
|
|
950
|
-
"effectivePolicy": None,
|
|
951
|
-
"evidenceRefs": [],
|
|
952
|
-
"candidates": [],
|
|
953
|
-
},
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
def _normalize_resolver_input(value: Any) -> tuple[dict[str, Any] | None, str | None]:
|
|
958
|
-
keys = {
|
|
959
|
-
"schemaVersion",
|
|
960
|
-
"intent",
|
|
961
|
-
"capabilityId",
|
|
962
|
-
"minimumAssurance",
|
|
963
|
-
"requestedPolicy",
|
|
964
|
-
"authorizedProviderIds",
|
|
965
|
-
"activeProviderIds",
|
|
966
|
-
"standbyProviderIds",
|
|
967
|
-
"fallbackAllowed",
|
|
968
|
-
"manifests",
|
|
969
|
-
"bindings",
|
|
970
|
-
"runtimeFacts",
|
|
971
|
-
"now",
|
|
972
|
-
}
|
|
973
|
-
if (
|
|
974
|
-
not isinstance(value, dict)
|
|
975
|
-
or set(value) != keys
|
|
976
|
-
or value.get("schemaVersion") != 1
|
|
977
|
-
):
|
|
978
|
-
return None, "provider-input-invalid"
|
|
979
|
-
policy = _normalize_policy(value.get("requestedPolicy"))
|
|
980
|
-
authorized = _sorted_unique_strings(value.get("authorizedProviderIds"), logical_ids=True)
|
|
981
|
-
active = _sorted_unique_strings(value.get("activeProviderIds"), logical_ids=True)
|
|
982
|
-
standby = _sorted_unique_strings(value.get("standbyProviderIds"), logical_ids=True)
|
|
983
|
-
capability_id = value.get("capabilityId")
|
|
984
|
-
if (
|
|
985
|
-
policy is None
|
|
986
|
-
or authorized is None
|
|
987
|
-
or active is None
|
|
988
|
-
or standby is None
|
|
989
|
-
or any(item in standby for item in active)
|
|
990
|
-
or not isinstance(value.get("fallbackAllowed"), bool)
|
|
991
|
-
or value.get("intent") not in _INTENTS
|
|
992
|
-
or value.get("minimumAssurance") not in _ASSURANCE_LEVELS
|
|
993
|
-
or not (
|
|
994
|
-
capability_id is None
|
|
995
|
-
or isinstance(capability_id, str) and _LOGICAL_ID.fullmatch(capability_id)
|
|
996
|
-
)
|
|
997
|
-
or not _valid_timestamp(value.get("now"))
|
|
998
|
-
or not isinstance(value.get("manifests"), list)
|
|
999
|
-
or not isinstance(value.get("bindings"), list)
|
|
1000
|
-
or not isinstance(value.get("runtimeFacts"), list)
|
|
1001
|
-
):
|
|
1002
|
-
return None, "provider-input-invalid"
|
|
1003
|
-
|
|
1004
|
-
manifests: list[dict[str, Any]] = []
|
|
1005
|
-
for item in value["manifests"]:
|
|
1006
|
-
manifest = _normalize_manifest(item)
|
|
1007
|
-
if manifest is None:
|
|
1008
|
-
return None, "provider-manifest-invalid"
|
|
1009
|
-
manifests.append(manifest)
|
|
1010
|
-
manifests.sort(key=lambda item: (item["id"], item["version"]))
|
|
1011
|
-
identities = [(item["id"], item["version"]) for item in manifests]
|
|
1012
|
-
if len(set(identities)) != len(identities):
|
|
1013
|
-
return None, "provider-manifest-duplicate"
|
|
1014
|
-
|
|
1015
|
-
bindings: list[dict[str, Any]] = []
|
|
1016
|
-
for item in value["bindings"]:
|
|
1017
|
-
binding = _normalize_binding(item)
|
|
1018
|
-
if binding is None:
|
|
1019
|
-
return None, "provider-input-invalid"
|
|
1020
|
-
bindings.append(binding)
|
|
1021
|
-
bindings.sort(key=lambda item: item["id"])
|
|
1022
|
-
if len({item["id"] for item in bindings}) != len(bindings):
|
|
1023
|
-
return None, "provider-binding-duplicate"
|
|
1024
|
-
|
|
1025
|
-
runtime_facts: list[dict[str, Any]] = []
|
|
1026
|
-
for item in value["runtimeFacts"]:
|
|
1027
|
-
fact = _normalize_runtime_fact(item)
|
|
1028
|
-
if fact is None:
|
|
1029
|
-
return None, "provider-input-invalid"
|
|
1030
|
-
runtime_facts.append(fact)
|
|
1031
|
-
runtime_facts.sort(key=lambda item: (item["providerId"], item["providerVersion"]))
|
|
1032
|
-
fact_ids = [(item["providerId"], item["providerVersion"]) for item in runtime_facts]
|
|
1033
|
-
if len(set(fact_ids)) != len(fact_ids):
|
|
1034
|
-
return None, "provider-runtime-fact-duplicate"
|
|
1035
|
-
|
|
1036
|
-
return {
|
|
1037
|
-
"schemaVersion": 1,
|
|
1038
|
-
"intent": value["intent"],
|
|
1039
|
-
"capabilityId": capability_id,
|
|
1040
|
-
"minimumAssurance": value["minimumAssurance"],
|
|
1041
|
-
"requestedPolicy": policy,
|
|
1042
|
-
"authorizedProviderIds": authorized,
|
|
1043
|
-
"activeProviderIds": active,
|
|
1044
|
-
"standbyProviderIds": standby,
|
|
1045
|
-
"fallbackAllowed": value["fallbackAllowed"],
|
|
1046
|
-
"manifests": manifests,
|
|
1047
|
-
"bindings": bindings,
|
|
1048
|
-
"runtimeFacts": runtime_facts,
|
|
1049
|
-
"nowEpochMs": _timestamp_ms(value["now"]),
|
|
1050
|
-
}, None
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
def _policy_rejection(requested: dict[str, Any], ceiling: dict[str, Any]) -> str | None:
|
|
1054
|
-
ordered = (
|
|
1055
|
-
("filesystem", _FILESYSTEM, "provider-policy-filesystem-exceeded"),
|
|
1056
|
-
("process", _PROCESS, "provider-policy-process-exceeded"),
|
|
1057
|
-
("network", _NETWORK, "provider-policy-network-exceeded"),
|
|
1058
|
-
("credentials", _CREDENTIALS, "provider-policy-credentials-exceeded"),
|
|
1059
|
-
("privacy", _PRIVACY, "provider-policy-privacy-exceeded"),
|
|
1060
|
-
)
|
|
1061
|
-
for field, levels, reason in ordered:
|
|
1062
|
-
if levels.index(requested[field]) > levels.index(ceiling[field]):
|
|
1063
|
-
return reason
|
|
1064
|
-
if any(item not in ceiling["egressDestinations"] for item in requested["egressDestinations"]):
|
|
1065
|
-
return "provider-policy-egress-exceeded"
|
|
1066
|
-
if _TELEMETRY.index(requested["telemetry"]) > _TELEMETRY.index(ceiling["telemetry"]):
|
|
1067
|
-
return "provider-policy-telemetry-exceeded"
|
|
1068
|
-
if _COST.index(requested["cost"]) > _COST.index(ceiling["cost"]):
|
|
1069
|
-
return "provider-policy-cost-exceeded"
|
|
1070
|
-
return None
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
def _candidate_role(provider_id: str, value: dict[str, Any]) -> str:
|
|
1074
|
-
if provider_id in value["activeProviderIds"]:
|
|
1075
|
-
return "active"
|
|
1076
|
-
if provider_id in value["standbyProviderIds"]:
|
|
1077
|
-
return "standby"
|
|
1078
|
-
return "default"
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
def _evaluate_candidate(manifest: dict[str, Any], value: dict[str, Any]) -> dict[str, Any]:
|
|
1082
|
-
role = _candidate_role(manifest["id"], value)
|
|
1083
|
-
|
|
1084
|
-
def rejected(reason: str, fact: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
1085
|
-
return {"manifest": manifest, "fact": fact, "role": role, "rejection": reason}
|
|
1086
|
-
|
|
1087
|
-
if manifest["id"] not in value["authorizedProviderIds"]:
|
|
1088
|
-
return rejected("provider-not-authorized")
|
|
1089
|
-
if value["intent"] not in manifest["intents"]:
|
|
1090
|
-
return rejected("provider-intent-mismatch")
|
|
1091
|
-
if value["capabilityId"] is not None and value["capabilityId"] not in manifest["capabilityIds"]:
|
|
1092
|
-
return rejected("provider-capability-mismatch")
|
|
1093
|
-
policy_reason = _policy_rejection(value["requestedPolicy"], manifest["policyCeiling"])
|
|
1094
|
-
if policy_reason is not None:
|
|
1095
|
-
return rejected(policy_reason)
|
|
1096
|
-
|
|
1097
|
-
provider_bindings = [
|
|
1098
|
-
item for item in value["bindings"] if item["providerId"] == manifest["id"]
|
|
1099
|
-
]
|
|
1100
|
-
if not provider_bindings:
|
|
1101
|
-
return rejected("provider-binding-missing")
|
|
1102
|
-
capability_bindings = [
|
|
1103
|
-
item
|
|
1104
|
-
for item in provider_bindings
|
|
1105
|
-
if (
|
|
1106
|
-
item["capabilityId"] in manifest["capabilityIds"]
|
|
1107
|
-
if value["capabilityId"] is None
|
|
1108
|
-
else item["capabilityId"] == value["capabilityId"]
|
|
1109
|
-
)
|
|
1110
|
-
]
|
|
1111
|
-
if not capability_bindings:
|
|
1112
|
-
return rejected("provider-binding-capability-mismatch")
|
|
1113
|
-
intent_bindings = [
|
|
1114
|
-
item for item in capability_bindings if value["intent"] in item["intents"]
|
|
1115
|
-
]
|
|
1116
|
-
if not intent_bindings:
|
|
1117
|
-
return rejected("provider-binding-intent-mismatch")
|
|
1118
|
-
ready_bindings = [
|
|
1119
|
-
item for item in intent_bindings if item["asset"]["readiness"] in {"ready", "degraded"}
|
|
1120
|
-
]
|
|
1121
|
-
if not ready_bindings:
|
|
1122
|
-
reason = (
|
|
1123
|
-
"provider-binding-readiness-unknown"
|
|
1124
|
-
if any(item["asset"]["readiness"] == "unknown" for item in intent_bindings)
|
|
1125
|
-
else "provider-binding-unavailable"
|
|
1126
|
-
)
|
|
1127
|
-
return rejected(reason)
|
|
1128
|
-
|
|
1129
|
-
fact = next(
|
|
1130
|
-
(
|
|
1131
|
-
item
|
|
1132
|
-
for item in value["runtimeFacts"]
|
|
1133
|
-
if item["providerId"] == manifest["id"]
|
|
1134
|
-
and item["providerVersion"] == manifest["version"]
|
|
1135
|
-
),
|
|
1136
|
-
None,
|
|
1137
|
-
)
|
|
1138
|
-
if fact is None:
|
|
1139
|
-
reason = (
|
|
1140
|
-
"provider-runtime-version-mismatch"
|
|
1141
|
-
if any(item["providerId"] == manifest["id"] for item in value["runtimeFacts"])
|
|
1142
|
-
else "provider-runtime-fact-missing"
|
|
1143
|
-
)
|
|
1144
|
-
return rejected(reason)
|
|
1145
|
-
if fact["readiness"] == "unknown":
|
|
1146
|
-
return rejected("provider-readiness-unknown", fact)
|
|
1147
|
-
if fact["readiness"] == "unavailable":
|
|
1148
|
-
return rejected("provider-readiness-unavailable", fact)
|
|
1149
|
-
|
|
1150
|
-
if manifest["probe"]["supported"]:
|
|
1151
|
-
if fact["probeResult"] == "not-run":
|
|
1152
|
-
return rejected("provider-probe-not-run", fact)
|
|
1153
|
-
if fact["probeResult"] == "failed":
|
|
1154
|
-
return rejected("provider-probe-failed", fact)
|
|
1155
|
-
if fact["freshness"] in {"unknown", "not-applicable"}:
|
|
1156
|
-
return rejected("provider-freshness-unknown", fact)
|
|
1157
|
-
if fact["freshness"] == "stale":
|
|
1158
|
-
return rejected("provider-freshness-stale", fact)
|
|
1159
|
-
if fact["probedAt"] is None or manifest["probe"]["maxAgeSeconds"] is None:
|
|
1160
|
-
return rejected("provider-probe-time-invalid", fact)
|
|
1161
|
-
probed_at_ms = _timestamp_ms(fact["probedAt"])
|
|
1162
|
-
if probed_at_ms > value["nowEpochMs"]:
|
|
1163
|
-
return rejected("provider-probe-from-future", fact)
|
|
1164
|
-
if value["nowEpochMs"] - probed_at_ms > manifest["probe"]["maxAgeSeconds"] * 1000:
|
|
1165
|
-
return rejected("provider-probe-expired", fact)
|
|
1166
|
-
elif (
|
|
1167
|
-
fact["probeResult"] != "not-run"
|
|
1168
|
-
or fact["probedAt"] is not None
|
|
1169
|
-
or fact["freshness"] not in {"unknown", "not-applicable"}
|
|
1170
|
-
):
|
|
1171
|
-
return rejected("provider-probe-unexpected", fact)
|
|
1172
|
-
|
|
1173
|
-
assurance = fact["assurance"]
|
|
1174
|
-
if assurance is None:
|
|
1175
|
-
return rejected("provider-assurance-insufficient", fact)
|
|
1176
|
-
if _ASSURANCE_LEVELS.index(assurance) > _ASSURANCE_LEVELS.index(manifest["maximumAssurance"]):
|
|
1177
|
-
return rejected("provider-assurance-exceeds-manifest", fact)
|
|
1178
|
-
if _ASSURANCE_LEVELS.index(assurance) < _ASSURANCE_LEVELS.index(value["minimumAssurance"]):
|
|
1179
|
-
return rejected("provider-assurance-insufficient", fact)
|
|
1180
|
-
if _ASSURANCE_LEVELS.index(assurance) >= 1 and not fact["evidenceRefs"]:
|
|
1181
|
-
return rejected("provider-evidence-missing", fact)
|
|
1182
|
-
if (
|
|
1183
|
-
fact["readiness"] == "degraded"
|
|
1184
|
-
or all(item["asset"]["readiness"] == "degraded" for item in ready_bindings)
|
|
1185
|
-
) and (_ASSURANCE_LEVELS.index(assurance) < 1 or not fact["evidenceRefs"]):
|
|
1186
|
-
return rejected("provider-degraded-without-evidence", fact)
|
|
1187
|
-
return {"manifest": manifest, "fact": fact, "role": role, "rejection": None}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
def _resolver_fingerprint(value: dict[str, Any]) -> str:
|
|
1191
|
-
payload = {
|
|
1192
|
-
"schemaVersion": value["schemaVersion"],
|
|
1193
|
-
"intent": value["intent"],
|
|
1194
|
-
"capabilityId": value["capabilityId"],
|
|
1195
|
-
"minimumAssurance": value["minimumAssurance"],
|
|
1196
|
-
"requestedPolicy": value["requestedPolicy"],
|
|
1197
|
-
"authorizedProviderIds": value["authorizedProviderIds"],
|
|
1198
|
-
"activeProviderIds": value["activeProviderIds"],
|
|
1199
|
-
"standbyProviderIds": value["standbyProviderIds"],
|
|
1200
|
-
"fallbackAllowed": value["fallbackAllowed"],
|
|
1201
|
-
"manifests": value["manifests"],
|
|
1202
|
-
"bindings": value["bindings"],
|
|
1203
|
-
"runtimeFacts": value["runtimeFacts"],
|
|
1204
|
-
}
|
|
1205
|
-
canonical = json.dumps(payload, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
|
|
1206
|
-
return "sha256:" + hashlib.sha256(canonical.encode("utf-8")).hexdigest()
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
def _unsupported_resolution(value: dict[str, Any]) -> dict[str, Any]:
|
|
1210
|
-
return {
|
|
1211
|
-
"schemaVersion": 1,
|
|
1212
|
-
"intent": value["intent"],
|
|
1213
|
-
"minimumAssurance": value["minimumAssurance"],
|
|
1214
|
-
"origin": "unsupported",
|
|
1215
|
-
"providerId": None,
|
|
1216
|
-
"providerVersion": None,
|
|
1217
|
-
"assurance": None,
|
|
1218
|
-
"readiness": "unavailable",
|
|
1219
|
-
"requestedPolicy": value["requestedPolicy"],
|
|
1220
|
-
"effectivePolicy": None,
|
|
1221
|
-
"evidenceRefs": [],
|
|
1222
|
-
"freshness": "not-applicable",
|
|
1223
|
-
"probedAt": None,
|
|
1224
|
-
"probeResult": "not-run",
|
|
1225
|
-
"fallbackFromProviderId": None,
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
def _resolve_plain_provider_v1(raw: Any) -> dict[str, Any]:
|
|
1230
|
-
value, invalid_reason = _normalize_resolver_input(raw)
|
|
1231
|
-
if value is None:
|
|
1232
|
-
return _invalid_resolution(invalid_reason or "provider-input-invalid")
|
|
1233
|
-
fingerprint = _resolver_fingerprint(value)
|
|
1234
|
-
evaluated = [_evaluate_candidate(manifest, value) for manifest in value["manifests"]]
|
|
1235
|
-
eligible = [item for item in evaluated if item["rejection"] is None]
|
|
1236
|
-
|
|
1237
|
-
selected: dict[str, Any] | None = None
|
|
1238
|
-
fallback_from: str | None = None
|
|
1239
|
-
if value["activeProviderIds"]:
|
|
1240
|
-
selected = next((item for item in eligible if item["role"] == "active"), None)
|
|
1241
|
-
if selected is None and value["fallbackAllowed"]:
|
|
1242
|
-
selected = next((item for item in eligible if item["role"] == "standby"), None)
|
|
1243
|
-
if selected is not None:
|
|
1244
|
-
fallback_from = value["activeProviderIds"][0]
|
|
1245
|
-
elif not value["standbyProviderIds"]:
|
|
1246
|
-
selected = eligible[0] if eligible else None
|
|
1247
|
-
|
|
1248
|
-
candidates: list[dict[str, Any]] = []
|
|
1249
|
-
for item in evaluated:
|
|
1250
|
-
if item["rejection"] is not None:
|
|
1251
|
-
candidates.append(
|
|
1252
|
-
{
|
|
1253
|
-
"providerId": item["manifest"]["id"],
|
|
1254
|
-
"providerVersion": item["manifest"]["version"],
|
|
1255
|
-
"role": item["role"],
|
|
1256
|
-
"accepted": False,
|
|
1257
|
-
"selected": False,
|
|
1258
|
-
"reasonCodes": [item["rejection"]],
|
|
1259
|
-
"effectivePolicy": None,
|
|
1260
|
-
"evidenceRefs": [],
|
|
1261
|
-
}
|
|
1262
|
-
)
|
|
1263
|
-
continue
|
|
1264
|
-
if item is selected:
|
|
1265
|
-
selected_reason = {
|
|
1266
|
-
"active": "provider-selected-active",
|
|
1267
|
-
"standby": "provider-selected-fallback",
|
|
1268
|
-
"default": "provider-selected-stable",
|
|
1269
|
-
}[item["role"]]
|
|
1270
|
-
candidates.append(
|
|
1271
|
-
{
|
|
1272
|
-
"providerId": item["manifest"]["id"],
|
|
1273
|
-
"providerVersion": item["manifest"]["version"],
|
|
1274
|
-
"role": item["role"],
|
|
1275
|
-
"accepted": True,
|
|
1276
|
-
"selected": True,
|
|
1277
|
-
"reasonCodes": [selected_reason],
|
|
1278
|
-
"effectivePolicy": value["requestedPolicy"],
|
|
1279
|
-
"evidenceRefs": item["fact"]["evidenceRefs"],
|
|
1280
|
-
}
|
|
1281
|
-
)
|
|
1282
|
-
continue
|
|
1283
|
-
if item["role"] == "standby" and not value["fallbackAllowed"]:
|
|
1284
|
-
reason = "provider-fallback-disabled"
|
|
1285
|
-
elif value["activeProviderIds"] and item["role"] == "default":
|
|
1286
|
-
reason = "provider-not-preferred"
|
|
1287
|
-
else:
|
|
1288
|
-
reason = "provider-not-selected"
|
|
1289
|
-
candidates.append(
|
|
1290
|
-
{
|
|
1291
|
-
"providerId": item["manifest"]["id"],
|
|
1292
|
-
"providerVersion": item["manifest"]["version"],
|
|
1293
|
-
"role": item["role"],
|
|
1294
|
-
"accepted": False,
|
|
1295
|
-
"selected": False,
|
|
1296
|
-
"reasonCodes": [reason],
|
|
1297
|
-
"effectivePolicy": None,
|
|
1298
|
-
"evidenceRefs": [],
|
|
1299
|
-
}
|
|
1300
|
-
)
|
|
1301
|
-
|
|
1302
|
-
if selected is None or selected["fact"] is None:
|
|
1303
|
-
if not value["activeProviderIds"] and value["standbyProviderIds"]:
|
|
1304
|
-
reason = "provider-active-missing"
|
|
1305
|
-
elif value["activeProviderIds"] and not value["fallbackAllowed"]:
|
|
1306
|
-
reason = "provider-fallback-disabled"
|
|
1307
|
-
elif candidates:
|
|
1308
|
-
reason = candidates[0]["reasonCodes"][0]
|
|
1309
|
-
else:
|
|
1310
|
-
reason = "provider-unsupported"
|
|
1311
|
-
return {
|
|
1312
|
-
"schemaVersion": 1,
|
|
1313
|
-
"status": "unsupported",
|
|
1314
|
-
"resolution": _unsupported_resolution(value),
|
|
1315
|
-
"fingerprint": fingerprint,
|
|
1316
|
-
"explain": {
|
|
1317
|
-
"schemaVersion": 1,
|
|
1318
|
-
"decision": "unsupported",
|
|
1319
|
-
"reasonCode": reason,
|
|
1320
|
-
"selectedProviderId": None,
|
|
1321
|
-
"fallbackFromProviderId": None,
|
|
1322
|
-
"effectivePolicy": None,
|
|
1323
|
-
"evidenceRefs": [],
|
|
1324
|
-
"candidates": candidates,
|
|
1325
|
-
},
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
fact = selected["fact"]
|
|
1329
|
-
manifest = selected["manifest"]
|
|
1330
|
-
resolution = {
|
|
1331
|
-
"schemaVersion": 1,
|
|
1332
|
-
"intent": value["intent"],
|
|
1333
|
-
"minimumAssurance": value["minimumAssurance"],
|
|
1334
|
-
"origin": manifest["origin"],
|
|
1335
|
-
"providerId": manifest["id"],
|
|
1336
|
-
"providerVersion": manifest["version"],
|
|
1337
|
-
"assurance": fact["assurance"],
|
|
1338
|
-
"readiness": fact["readiness"],
|
|
1339
|
-
"requestedPolicy": value["requestedPolicy"],
|
|
1340
|
-
"effectivePolicy": value["requestedPolicy"],
|
|
1341
|
-
"evidenceRefs": fact["evidenceRefs"],
|
|
1342
|
-
"freshness": fact["freshness"],
|
|
1343
|
-
"probedAt": fact["probedAt"],
|
|
1344
|
-
"probeResult": fact["probeResult"],
|
|
1345
|
-
"fallbackFromProviderId": fallback_from,
|
|
1346
|
-
}
|
|
1347
|
-
return {
|
|
1348
|
-
"schemaVersion": 1,
|
|
1349
|
-
"status": "supported",
|
|
1350
|
-
"resolution": resolution,
|
|
1351
|
-
"fingerprint": fingerprint,
|
|
1352
|
-
"explain": {
|
|
1353
|
-
"schemaVersion": 1,
|
|
1354
|
-
"decision": "supported",
|
|
1355
|
-
"reasonCode": "provider-selected",
|
|
1356
|
-
"selectedProviderId": manifest["id"],
|
|
1357
|
-
"fallbackFromProviderId": fallback_from,
|
|
1358
|
-
"effectivePolicy": value["requestedPolicy"],
|
|
1359
|
-
"evidenceRefs": fact["evidenceRefs"],
|
|
1360
|
-
"candidates": candidates,
|
|
1361
|
-
},
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
def resolve_provider_v1(raw: Any) -> dict[str, Any]:
|
|
1366
|
-
"""Resolve plain JSON Provider facts with the redacted TypeScript ABI."""
|
|
1367
|
-
try:
|
|
1368
|
-
snapshot = _snapshot_plain_json_value(raw)
|
|
1369
|
-
if snapshot is _INVALID_JSON_VALUE or type(snapshot) is not dict:
|
|
1370
|
-
return _invalid_resolution("provider-input-invalid")
|
|
1371
|
-
return _resolve_plain_provider_v1(snapshot)
|
|
1372
|
-
except Exception:
|
|
1373
|
-
return _invalid_resolution("provider-input-invalid")
|