kiokuko-dsh 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +50 -0
- package/README.ko.md +50 -0
- package/README.md +53 -0
- package/README.zh-CN.md +50 -0
- package/dist/agent-file/atomic-write.d.ts +93 -0
- package/dist/agent-file/atomic-write.d.ts.map +1 -0
- package/dist/agent-file/atomic-write.js +1026 -0
- package/dist/agent-file/atomic-write.js.map +1 -0
- package/dist/agent-file/managed-block.d.ts +23 -0
- package/dist/agent-file/managed-block.d.ts.map +1 -0
- package/dist/agent-file/managed-block.js +101 -0
- package/dist/agent-file/managed-block.js.map +1 -0
- package/dist/agent-file/render.d.ts +14 -0
- package/dist/agent-file/render.d.ts.map +1 -0
- package/dist/agent-file/render.js +63 -0
- package/dist/agent-file/render.js.map +1 -0
- package/dist/akinator/agent-task.d.ts +72 -0
- package/dist/akinator/agent-task.d.ts.map +1 -0
- package/dist/akinator/agent-task.js +684 -0
- package/dist/akinator/agent-task.js.map +1 -0
- package/dist/akinator/capabilities.d.ts +92 -0
- package/dist/akinator/capabilities.d.ts.map +1 -0
- package/dist/akinator/capabilities.js +364 -0
- package/dist/akinator/capabilities.js.map +1 -0
- package/dist/akinator/capability-binding.d.ts +11 -0
- package/dist/akinator/capability-binding.d.ts.map +1 -0
- package/dist/akinator/capability-binding.js +71 -0
- package/dist/akinator/capability-binding.js.map +1 -0
- package/dist/akinator/domain.d.ts +25 -0
- package/dist/akinator/domain.d.ts.map +1 -0
- package/dist/akinator/domain.js +266 -0
- package/dist/akinator/domain.js.map +1 -0
- package/dist/akinator/knowledge-path.d.ts +33 -0
- package/dist/akinator/knowledge-path.d.ts.map +1 -0
- package/dist/akinator/knowledge-path.js +474 -0
- package/dist/akinator/knowledge-path.js.map +1 -0
- package/dist/akinator/orchestrator.d.ts +7 -0
- package/dist/akinator/orchestrator.d.ts.map +1 -0
- package/dist/akinator/orchestrator.js +8 -0
- package/dist/akinator/orchestrator.js.map +1 -0
- package/dist/akinator/reasoning.d.ts +8 -0
- package/dist/akinator/reasoning.d.ts.map +1 -0
- package/dist/akinator/reasoning.js +118 -0
- package/dist/akinator/reasoning.js.map +1 -0
- package/dist/akinator/service.d.ts +32 -0
- package/dist/akinator/service.d.ts.map +1 -0
- package/dist/akinator/service.js +294 -0
- package/dist/akinator/service.js.map +1 -0
- package/dist/akinator/skill-discovery-attempt.d.ts +26 -0
- package/dist/akinator/skill-discovery-attempt.d.ts.map +1 -0
- package/dist/akinator/skill-discovery-attempt.js +469 -0
- package/dist/akinator/skill-discovery-attempt.js.map +1 -0
- package/dist/akinator/store.d.ts +96 -0
- package/dist/akinator/store.d.ts.map +1 -0
- package/dist/akinator/store.js +642 -0
- package/dist/akinator/store.js.map +1 -0
- package/dist/akinator/types.d.ts +70 -0
- package/dist/akinator/types.d.ts.map +1 -0
- package/dist/akinator/types.js +2 -0
- package/dist/akinator/types.js.map +1 -0
- package/dist/bin/kiokuko.d.ts +3 -0
- package/dist/bin/kiokuko.d.ts.map +1 -0
- package/dist/bin/kiokuko.js +13 -0
- package/dist/bin/kiokuko.js.map +1 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +962 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/server-client.d.ts +22 -0
- package/dist/client/server-client.d.ts.map +1 -0
- package/dist/client/server-client.js +729 -0
- package/dist/client/server-client.js.map +1 -0
- package/dist/commands/agent.d.ts +12 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +1138 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/backup.d.ts +6 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +77 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/curator.d.ts +25 -0
- package/dist/commands/curator.d.ts.map +1 -0
- package/dist/commands/curator.js +58 -0
- package/dist/commands/curator.js.map +1 -0
- package/dist/commands/doctor.d.ts +61 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +522 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/embeddings.d.ts +40 -0
- package/dist/commands/embeddings.d.ts.map +1 -0
- package/dist/commands/embeddings.js +317 -0
- package/dist/commands/embeddings.js.map +1 -0
- package/dist/commands/enno.d.ts +7 -0
- package/dist/commands/enno.d.ts.map +1 -0
- package/dist/commands/enno.js +76 -0
- package/dist/commands/enno.js.map +1 -0
- package/dist/commands/export.d.ts +17 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +233 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +24 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +778 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +34 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +637 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/ledger.d.ts +7 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +66 -0
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/purge.d.ts +10 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +29 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/serve.d.ts +34 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +120 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/server-status.d.ts +20 -0
- package/dist/commands/server-status.d.ts.map +1 -0
- package/dist/commands/server-status.js +21 -0
- package/dist/commands/server-status.js.map +1 -0
- package/dist/commands/server.d.ts +13 -0
- package/dist/commands/server.d.ts.map +1 -0
- package/dist/commands/server.js +89 -0
- package/dist/commands/server.js.map +1 -0
- package/dist/commands/setup.d.ts +105 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +793 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/skills.d.ts +9 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +317 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/use.d.ts +40 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +1090 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/config/paths.d.ts +57 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +352 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/project-config.d.ts +11 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +97 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/context/broker.d.ts +99 -0
- package/dist/context/broker.d.ts.map +1 -0
- package/dist/context/broker.js +923 -0
- package/dist/context/broker.js.map +1 -0
- package/dist/context/delivery-migration.d.ts +40 -0
- package/dist/context/delivery-migration.d.ts.map +1 -0
- package/dist/context/delivery-migration.js +367 -0
- package/dist/context/delivery-migration.js.map +1 -0
- package/dist/context/delivery.d.ts +61 -0
- package/dist/context/delivery.d.ts.map +1 -0
- package/dist/context/delivery.js +886 -0
- package/dist/context/delivery.js.map +1 -0
- package/dist/context/feedback.d.ts +73 -0
- package/dist/context/feedback.d.ts.map +1 -0
- package/dist/context/feedback.js +993 -0
- package/dist/context/feedback.js.map +1 -0
- package/dist/context/nudge-store.d.ts +57 -0
- package/dist/context/nudge-store.d.ts.map +1 -0
- package/dist/context/nudge-store.js +227 -0
- package/dist/context/nudge-store.js.map +1 -0
- package/dist/context/nudge-validation.d.ts +26 -0
- package/dist/context/nudge-validation.d.ts.map +1 -0
- package/dist/context/nudge-validation.js +122 -0
- package/dist/context/nudge-validation.js.map +1 -0
- package/dist/context/nudges.d.ts +38 -0
- package/dist/context/nudges.d.ts.map +1 -0
- package/dist/context/nudges.js +131 -0
- package/dist/context/nudges.js.map +1 -0
- package/dist/context/origin.d.ts +9 -0
- package/dist/context/origin.d.ts.map +1 -0
- package/dist/context/origin.js +15 -0
- package/dist/context/origin.js.map +1 -0
- package/dist/context/ranking.d.ts +92 -0
- package/dist/context/ranking.d.ts.map +1 -0
- package/dist/context/ranking.js +560 -0
- package/dist/context/ranking.js.map +1 -0
- package/dist/context/recommendations.d.ts +80 -0
- package/dist/context/recommendations.d.ts.map +1 -0
- package/dist/context/recommendations.js +341 -0
- package/dist/context/recommendations.js.map +1 -0
- package/dist/context/run-state.d.ts +26 -0
- package/dist/context/run-state.d.ts.map +1 -0
- package/dist/context/run-state.js +399 -0
- package/dist/context/run-state.js.map +1 -0
- package/dist/context/scoped-broker.d.ts +77 -0
- package/dist/context/scoped-broker.d.ts.map +1 -0
- package/dist/context/scoped-broker.js +690 -0
- package/dist/context/scoped-broker.js.map +1 -0
- package/dist/context/selection-state.d.ts +32 -0
- package/dist/context/selection-state.d.ts.map +1 -0
- package/dist/context/selection-state.js +369 -0
- package/dist/context/selection-state.js.map +1 -0
- package/dist/db/adapter.d.ts +27 -0
- package/dist/db/adapter.d.ts.map +1 -0
- package/dist/db/adapter.js +41 -0
- package/dist/db/adapter.js.map +1 -0
- package/dist/db/capabilities.d.ts +21 -0
- package/dist/db/capabilities.d.ts.map +1 -0
- package/dist/db/capabilities.js +57 -0
- package/dist/db/capabilities.js.map +1 -0
- package/dist/db/connection.d.ts +21 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +129 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/migrate.d.ts +40 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +216 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/sqlite-retry.d.ts +11 -0
- package/dist/db/sqlite-retry.d.ts.map +1 -0
- package/dist/db/sqlite-retry.js +70 -0
- package/dist/db/sqlite-retry.js.map +1 -0
- package/dist/db/transaction.d.ts +17 -0
- package/dist/db/transaction.d.ts.map +1 -0
- package/dist/db/transaction.js +68 -0
- package/dist/db/transaction.js.map +1 -0
- package/dist/db/upgrade-backup.d.ts +59 -0
- package/dist/db/upgrade-backup.d.ts.map +1 -0
- package/dist/db/upgrade-backup.js +773 -0
- package/dist/db/upgrade-backup.js.map +1 -0
- package/dist/dsh/advisory-runner.d.ts +32 -0
- package/dist/dsh/advisory-runner.d.ts.map +1 -0
- package/dist/dsh/advisory-runner.js +111 -0
- package/dist/dsh/advisory-runner.js.map +1 -0
- package/dist/dsh/agent-state.d.ts +49 -0
- package/dist/dsh/agent-state.d.ts.map +1 -0
- package/dist/dsh/agent-state.js +103 -0
- package/dist/dsh/agent-state.js.map +1 -0
- package/dist/dsh/capability-catalog.d.ts +24 -0
- package/dist/dsh/capability-catalog.d.ts.map +1 -0
- package/dist/dsh/capability-catalog.js +108 -0
- package/dist/dsh/capability-catalog.js.map +1 -0
- package/dist/dsh/commands.d.ts +43 -0
- package/dist/dsh/commands.d.ts.map +1 -0
- package/dist/dsh/commands.js +83 -0
- package/dist/dsh/commands.js.map +1 -0
- package/dist/dsh/composition.d.ts +64 -0
- package/dist/dsh/composition.d.ts.map +1 -0
- package/dist/dsh/composition.js +104 -0
- package/dist/dsh/composition.js.map +1 -0
- package/dist/dsh/config.d.ts +7 -0
- package/dist/dsh/config.d.ts.map +1 -0
- package/dist/dsh/config.js +6 -0
- package/dist/dsh/config.js.map +1 -0
- package/dist/dsh/context-injection.d.ts +24 -0
- package/dist/dsh/context-injection.d.ts.map +1 -0
- package/dist/dsh/context-injection.js +61 -0
- package/dist/dsh/context-injection.js.map +1 -0
- package/dist/dsh/enno-controller.d.ts +94 -0
- package/dist/dsh/enno-controller.d.ts.map +1 -0
- package/dist/dsh/enno-controller.js +137 -0
- package/dist/dsh/enno-controller.js.map +1 -0
- package/dist/dsh/index.d.ts +31 -0
- package/dist/dsh/index.d.ts.map +1 -0
- package/dist/dsh/index.js +52 -0
- package/dist/dsh/index.js.map +1 -0
- package/dist/dsh/intake-gate.d.ts +50 -0
- package/dist/dsh/intake-gate.d.ts.map +1 -0
- package/dist/dsh/intake-gate.js +77 -0
- package/dist/dsh/intake-gate.js.map +1 -0
- package/dist/dsh/intake-profile-resolver.d.ts +22 -0
- package/dist/dsh/intake-profile-resolver.d.ts.map +1 -0
- package/dist/dsh/intake-profile-resolver.js +44 -0
- package/dist/dsh/intake-profile-resolver.js.map +1 -0
- package/dist/dsh/message-sources.d.ts +28 -0
- package/dist/dsh/message-sources.d.ts.map +1 -0
- package/dist/dsh/message-sources.js +62 -0
- package/dist/dsh/message-sources.js.map +1 -0
- package/dist/dsh/parity.d.ts +18 -0
- package/dist/dsh/parity.d.ts.map +1 -0
- package/dist/dsh/parity.js +105 -0
- package/dist/dsh/parity.js.map +1 -0
- package/dist/dsh/prompt-policy.d.ts +18 -0
- package/dist/dsh/prompt-policy.d.ts.map +1 -0
- package/dist/dsh/prompt-policy.js +16 -0
- package/dist/dsh/prompt-policy.js.map +1 -0
- package/dist/dsh/runtime.d.ts +40 -0
- package/dist/dsh/runtime.d.ts.map +1 -0
- package/dist/dsh/runtime.js +237 -0
- package/dist/dsh/runtime.js.map +1 -0
- package/dist/dsh/session-bridge.d.ts +98 -0
- package/dist/dsh/session-bridge.d.ts.map +1 -0
- package/dist/dsh/session-bridge.js +202 -0
- package/dist/dsh/session-bridge.js.map +1 -0
- package/dist/dsh/standard-skill-provider.d.ts +50 -0
- package/dist/dsh/standard-skill-provider.d.ts.map +1 -0
- package/dist/dsh/standard-skill-provider.js +71 -0
- package/dist/dsh/standard-skill-provider.js.map +1 -0
- package/dist/dsh/tool-policy.d.ts +40 -0
- package/dist/dsh/tool-policy.d.ts.map +1 -0
- package/dist/dsh/tool-policy.js +125 -0
- package/dist/dsh/tool-policy.js.map +1 -0
- package/dist/dsh/tools.d.ts +85 -0
- package/dist/dsh/tools.d.ts.map +1 -0
- package/dist/dsh/tools.js +156 -0
- package/dist/dsh/tools.js.map +1 -0
- package/dist/dsh/user-interaction.d.ts +51 -0
- package/dist/dsh/user-interaction.d.ts.map +1 -0
- package/dist/dsh/user-interaction.js +92 -0
- package/dist/dsh/user-interaction.js.map +1 -0
- package/dist/embedding/backend.d.ts +27 -0
- package/dist/embedding/backend.d.ts.map +1 -0
- package/dist/embedding/backend.js +67 -0
- package/dist/embedding/backend.js.map +1 -0
- package/dist/embedding/config.d.ts +10 -0
- package/dist/embedding/config.d.ts.map +1 -0
- package/dist/embedding/config.js +142 -0
- package/dist/embedding/config.js.map +1 -0
- package/dist/embedding/diagnostics.d.ts +34 -0
- package/dist/embedding/diagnostics.d.ts.map +1 -0
- package/dist/embedding/diagnostics.js +274 -0
- package/dist/embedding/diagnostics.js.map +1 -0
- package/dist/embedding/document.d.ts +20 -0
- package/dist/embedding/document.d.ts.map +1 -0
- package/dist/embedding/document.js +122 -0
- package/dist/embedding/document.js.map +1 -0
- package/dist/embedding/javascript-backend.d.ts +11 -0
- package/dist/embedding/javascript-backend.d.ts.map +1 -0
- package/dist/embedding/javascript-backend.js +164 -0
- package/dist/embedding/javascript-backend.js.map +1 -0
- package/dist/embedding/jobs.d.ts +67 -0
- package/dist/embedding/jobs.d.ts.map +1 -0
- package/dist/embedding/jobs.js +259 -0
- package/dist/embedding/jobs.js.map +1 -0
- package/dist/embedding/local-model-loader.d.ts +24 -0
- package/dist/embedding/local-model-loader.d.ts.map +1 -0
- package/dist/embedding/local-model-loader.js +64 -0
- package/dist/embedding/local-model-loader.js.map +1 -0
- package/dist/embedding/local-transformers-provider.d.ts +17 -0
- package/dist/embedding/local-transformers-provider.d.ts.map +1 -0
- package/dist/embedding/local-transformers-provider.js +54 -0
- package/dist/embedding/local-transformers-provider.js.map +1 -0
- package/dist/embedding/model-download.d.ts +32 -0
- package/dist/embedding/model-download.d.ts.map +1 -0
- package/dist/embedding/model-download.js +41 -0
- package/dist/embedding/model-download.js.map +1 -0
- package/dist/embedding/model-installation.d.ts +17 -0
- package/dist/embedding/model-installation.d.ts.map +1 -0
- package/dist/embedding/model-installation.js +71 -0
- package/dist/embedding/model-installation.js.map +1 -0
- package/dist/embedding/model-manifest.d.ts +18 -0
- package/dist/embedding/model-manifest.d.ts.map +1 -0
- package/dist/embedding/model-manifest.js +86 -0
- package/dist/embedding/model-manifest.js.map +1 -0
- package/dist/embedding/openai-compatible-provider.d.ts +24 -0
- package/dist/embedding/openai-compatible-provider.d.ts.map +1 -0
- package/dist/embedding/openai-compatible-provider.js +330 -0
- package/dist/embedding/openai-compatible-provider.js.map +1 -0
- package/dist/embedding/presets/local-small.d.ts +8 -0
- package/dist/embedding/presets/local-small.d.ts.map +1 -0
- package/dist/embedding/presets/local-small.js +67 -0
- package/dist/embedding/presets/local-small.js.map +1 -0
- package/dist/embedding/presets/manifest.d.ts +27 -0
- package/dist/embedding/presets/manifest.d.ts.map +1 -0
- package/dist/embedding/presets/manifest.js +5 -0
- package/dist/embedding/presets/manifest.js.map +1 -0
- package/dist/embedding/profile.d.ts +10 -0
- package/dist/embedding/profile.d.ts.map +1 -0
- package/dist/embedding/profile.js +67 -0
- package/dist/embedding/profile.js.map +1 -0
- package/dist/embedding/provider.d.ts +13 -0
- package/dist/embedding/provider.d.ts.map +1 -0
- package/dist/embedding/provider.js +17 -0
- package/dist/embedding/provider.js.map +1 -0
- package/dist/embedding/query-cache.d.ts +45 -0
- package/dist/embedding/query-cache.d.ts.map +1 -0
- package/dist/embedding/query-cache.js +181 -0
- package/dist/embedding/query-cache.js.map +1 -0
- package/dist/embedding/runtime.d.ts +14 -0
- package/dist/embedding/runtime.d.ts.map +1 -0
- package/dist/embedding/runtime.js +407 -0
- package/dist/embedding/runtime.js.map +1 -0
- package/dist/embedding/settings.d.ts +6 -0
- package/dist/embedding/settings.d.ts.map +1 -0
- package/dist/embedding/settings.js +69 -0
- package/dist/embedding/settings.js.map +1 -0
- package/dist/embedding/setup-lock.d.ts +7 -0
- package/dist/embedding/setup-lock.d.ts.map +1 -0
- package/dist/embedding/setup-lock.js +35 -0
- package/dist/embedding/setup-lock.js.map +1 -0
- package/dist/embedding/setup-service.d.ts +53 -0
- package/dist/embedding/setup-service.d.ts.map +1 -0
- package/dist/embedding/setup-service.js +184 -0
- package/dist/embedding/setup-service.js.map +1 -0
- package/dist/embedding/sqlite-vec-backend.d.ts +9 -0
- package/dist/embedding/sqlite-vec-backend.d.ts.map +1 -0
- package/dist/embedding/sqlite-vec-backend.js +106 -0
- package/dist/embedding/sqlite-vec-backend.js.map +1 -0
- package/dist/embedding/sqlite-vec-loader.d.ts +17 -0
- package/dist/embedding/sqlite-vec-loader.d.ts.map +1 -0
- package/dist/embedding/sqlite-vec-loader.js +51 -0
- package/dist/embedding/sqlite-vec-loader.js.map +1 -0
- package/dist/embedding/store.d.ts +66 -0
- package/dist/embedding/store.d.ts.map +1 -0
- package/dist/embedding/store.js +490 -0
- package/dist/embedding/store.js.map +1 -0
- package/dist/embedding/types.d.ts +126 -0
- package/dist/embedding/types.d.ts.map +1 -0
- package/dist/embedding/types.js +2 -0
- package/dist/embedding/types.js.map +1 -0
- package/dist/embedding/vector.d.ts +9 -0
- package/dist/embedding/vector.d.ts.map +1 -0
- package/dist/embedding/vector.js +90 -0
- package/dist/embedding/vector.js.map +1 -0
- package/dist/embedding/worker.d.ts +23 -0
- package/dist/embedding/worker.d.ts.map +1 -0
- package/dist/embedding/worker.js +84 -0
- package/dist/embedding/worker.js.map +1 -0
- package/dist/enno-oduno/adapters.d.ts +21 -0
- package/dist/enno-oduno/adapters.d.ts.map +1 -0
- package/dist/enno-oduno/adapters.js +253 -0
- package/dist/enno-oduno/adapters.js.map +1 -0
- package/dist/enno-oduno/advisory-store.d.ts +31 -0
- package/dist/enno-oduno/advisory-store.d.ts.map +1 -0
- package/dist/enno-oduno/advisory-store.js +105 -0
- package/dist/enno-oduno/advisory-store.js.map +1 -0
- package/dist/enno-oduno/advisory.d.ts +18 -0
- package/dist/enno-oduno/advisory.d.ts.map +1 -0
- package/dist/enno-oduno/advisory.js +310 -0
- package/dist/enno-oduno/advisory.js.map +1 -0
- package/dist/enno-oduno/confirmation.d.ts +4 -0
- package/dist/enno-oduno/confirmation.d.ts.map +1 -0
- package/dist/enno-oduno/confirmation.js +127 -0
- package/dist/enno-oduno/confirmation.js.map +1 -0
- package/dist/enno-oduno/directives.d.ts +12 -0
- package/dist/enno-oduno/directives.d.ts.map +1 -0
- package/dist/enno-oduno/directives.js +276 -0
- package/dist/enno-oduno/directives.js.map +1 -0
- package/dist/enno-oduno/enno-oduno.d.mts +2 -0
- package/dist/enno-oduno/enno-oduno.d.mts.map +1 -0
- package/dist/enno-oduno/enno-oduno.mjs +3 -0
- package/dist/enno-oduno/enno-oduno.mjs.map +1 -0
- package/dist/enno-oduno/experts.d.ts +6 -0
- package/dist/enno-oduno/experts.d.ts.map +1 -0
- package/dist/enno-oduno/experts.js +32 -0
- package/dist/enno-oduno/experts.js.map +1 -0
- package/dist/enno-oduno/goki.d.mts +2 -0
- package/dist/enno-oduno/goki.d.mts.map +1 -0
- package/dist/enno-oduno/goki.mjs +3 -0
- package/dist/enno-oduno/goki.mjs.map +1 -0
- package/dist/enno-oduno/handoff.d.ts +4 -0
- package/dist/enno-oduno/handoff.d.ts.map +1 -0
- package/dist/enno-oduno/handoff.js +18 -0
- package/dist/enno-oduno/handoff.js.map +1 -0
- package/dist/enno-oduno/harness.d.ts +20 -0
- package/dist/enno-oduno/harness.d.ts.map +1 -0
- package/dist/enno-oduno/harness.js +66 -0
- package/dist/enno-oduno/harness.js.map +1 -0
- package/dist/enno-oduno/instructions.d.ts +9 -0
- package/dist/enno-oduno/instructions.d.ts.map +1 -0
- package/dist/enno-oduno/instructions.js +12 -0
- package/dist/enno-oduno/instructions.js.map +1 -0
- package/dist/enno-oduno/plan-recovery.d.ts +44 -0
- package/dist/enno-oduno/plan-recovery.d.ts.map +1 -0
- package/dist/enno-oduno/plan-recovery.js +160 -0
- package/dist/enno-oduno/plan-recovery.js.map +1 -0
- package/dist/enno-oduno/repository-state.d.ts +8 -0
- package/dist/enno-oduno/repository-state.d.ts.map +1 -0
- package/dist/enno-oduno/repository-state.js +139 -0
- package/dist/enno-oduno/repository-state.js.map +1 -0
- package/dist/enno-oduno/role-runner.d.ts +9 -0
- package/dist/enno-oduno/role-runner.d.ts.map +1 -0
- package/dist/enno-oduno/role-runner.js +219 -0
- package/dist/enno-oduno/role-runner.js.map +1 -0
- package/dist/enno-oduno/sanitize.d.ts +17 -0
- package/dist/enno-oduno/sanitize.d.ts.map +1 -0
- package/dist/enno-oduno/sanitize.js +88 -0
- package/dist/enno-oduno/sanitize.js.map +1 -0
- package/dist/enno-oduno/schemas.d.ts +962 -0
- package/dist/enno-oduno/schemas.d.ts.map +1 -0
- package/dist/enno-oduno/schemas.js +609 -0
- package/dist/enno-oduno/schemas.js.map +1 -0
- package/dist/enno-oduno/service.d.ts +57 -0
- package/dist/enno-oduno/service.d.ts.map +1 -0
- package/dist/enno-oduno/service.js +1379 -0
- package/dist/enno-oduno/service.js.map +1 -0
- package/dist/enno-oduno/skills.d.ts +22 -0
- package/dist/enno-oduno/skills.d.ts.map +1 -0
- package/dist/enno-oduno/skills.js +127 -0
- package/dist/enno-oduno/skills.js.map +1 -0
- package/dist/enno-oduno/store.d.ts +106 -0
- package/dist/enno-oduno/store.d.ts.map +1 -0
- package/dist/enno-oduno/store.js +712 -0
- package/dist/enno-oduno/store.js.map +1 -0
- package/dist/enno-oduno/types.d.ts +457 -0
- package/dist/enno-oduno/types.d.ts.map +1 -0
- package/dist/enno-oduno/types.js +66 -0
- package/dist/enno-oduno/types.js.map +1 -0
- package/dist/enno-oduno/validation-errors.d.ts +93 -0
- package/dist/enno-oduno/validation-errors.d.ts.map +1 -0
- package/dist/enno-oduno/validation-errors.js +152 -0
- package/dist/enno-oduno/validation-errors.js.map +1 -0
- package/dist/enno-oduno/verifier.d.ts +10 -0
- package/dist/enno-oduno/verifier.d.ts.map +1 -0
- package/dist/enno-oduno/verifier.js +214 -0
- package/dist/enno-oduno/verifier.js.map +1 -0
- package/dist/enno-oduno/zenki.d.mts +2 -0
- package/dist/enno-oduno/zenki.d.mts.map +1 -0
- package/dist/enno-oduno/zenki.mjs +3 -0
- package/dist/enno-oduno/zenki.mjs.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +60 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway/agent-service.d.ts +72 -0
- package/dist/gateway/agent-service.d.ts.map +1 -0
- package/dist/gateway/agent-service.js +594 -0
- package/dist/gateway/agent-service.js.map +1 -0
- package/dist/gateway/checkpoint-mutation-service.d.ts +33 -0
- package/dist/gateway/checkpoint-mutation-service.d.ts.map +1 -0
- package/dist/gateway/checkpoint-mutation-service.js +513 -0
- package/dist/gateway/checkpoint-mutation-service.js.map +1 -0
- package/dist/gateway/checkpoint-service.d.ts +40 -0
- package/dist/gateway/checkpoint-service.d.ts.map +1 -0
- package/dist/gateway/checkpoint-service.js +149 -0
- package/dist/gateway/checkpoint-service.js.map +1 -0
- package/dist/gateway/nudge-delivery-service.d.ts +21 -0
- package/dist/gateway/nudge-delivery-service.d.ts.map +1 -0
- package/dist/gateway/nudge-delivery-service.js +67 -0
- package/dist/gateway/nudge-delivery-service.js.map +1 -0
- package/dist/ledger/archive.d.ts +48 -0
- package/dist/ledger/archive.d.ts.map +1 -0
- package/dist/ledger/archive.js +1261 -0
- package/dist/ledger/archive.js.map +1 -0
- package/dist/ledger/checkpoint-contract.d.ts +144 -0
- package/dist/ledger/checkpoint-contract.d.ts.map +1 -0
- package/dist/ledger/checkpoint-contract.js +91 -0
- package/dist/ledger/checkpoint-contract.js.map +1 -0
- package/dist/ledger/checkpoint-eligibility.d.ts +17 -0
- package/dist/ledger/checkpoint-eligibility.d.ts.map +1 -0
- package/dist/ledger/checkpoint-eligibility.js +19 -0
- package/dist/ledger/checkpoint-eligibility.js.map +1 -0
- package/dist/ledger/hash.d.ts +22 -0
- package/dist/ledger/hash.d.ts.map +1 -0
- package/dist/ledger/hash.js +25 -0
- package/dist/ledger/hash.js.map +1 -0
- package/dist/ledger/maintenance.d.ts +68 -0
- package/dist/ledger/maintenance.d.ts.map +1 -0
- package/dist/ledger/maintenance.js +767 -0
- package/dist/ledger/maintenance.js.map +1 -0
- package/dist/ledger/projection.d.ts +38 -0
- package/dist/ledger/projection.d.ts.map +1 -0
- package/dist/ledger/projection.js +315 -0
- package/dist/ledger/projection.js.map +1 -0
- package/dist/ledger/promotion.d.ts +19 -0
- package/dist/ledger/promotion.d.ts.map +1 -0
- package/dist/ledger/promotion.js +310 -0
- package/dist/ledger/promotion.js.map +1 -0
- package/dist/ledger/query.d.ts +41 -0
- package/dist/ledger/query.d.ts.map +1 -0
- package/dist/ledger/query.js +321 -0
- package/dist/ledger/query.js.map +1 -0
- package/dist/ledger/redaction.d.ts +8 -0
- package/dist/ledger/redaction.d.ts.map +1 -0
- package/dist/ledger/redaction.js +40 -0
- package/dist/ledger/redaction.js.map +1 -0
- package/dist/ledger/store.d.ts +45 -0
- package/dist/ledger/store.d.ts.map +1 -0
- package/dist/ledger/store.js +327 -0
- package/dist/ledger/store.js.map +1 -0
- package/dist/ledger/types.d.ts +115 -0
- package/dist/ledger/types.d.ts.map +1 -0
- package/dist/ledger/types.js +27 -0
- package/dist/ledger/types.js.map +1 -0
- package/dist/ledger/validate.d.ts +10 -0
- package/dist/ledger/validate.d.ts.map +1 -0
- package/dist/ledger/validate.js +178 -0
- package/dist/ledger/validate.js.map +1 -0
- package/dist/mcp/bounded-stdio-transport.d.ts +26 -0
- package/dist/mcp/bounded-stdio-transport.d.ts.map +1 -0
- package/dist/mcp/bounded-stdio-transport.js +121 -0
- package/dist/mcp/bounded-stdio-transport.js.map +1 -0
- package/dist/mcp/request-deadline.d.ts +51 -0
- package/dist/mcp/request-deadline.d.ts.map +1 -0
- package/dist/mcp/request-deadline.js +155 -0
- package/dist/mcp/request-deadline.js.map +1 -0
- package/dist/mcp/runtime-owner.d.ts +27 -0
- package/dist/mcp/runtime-owner.d.ts.map +1 -0
- package/dist/mcp/runtime-owner.js +129 -0
- package/dist/mcp/runtime-owner.js.map +1 -0
- package/dist/mcp/server.d.ts +24 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +502 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/memory/audit.d.ts +13 -0
- package/dist/memory/audit.d.ts.map +1 -0
- package/dist/memory/audit.js +15 -0
- package/dist/memory/audit.js.map +1 -0
- package/dist/memory/checkpoint-contract.d.ts +490 -0
- package/dist/memory/checkpoint-contract.d.ts.map +1 -0
- package/dist/memory/checkpoint-contract.js +106 -0
- package/dist/memory/checkpoint-contract.js.map +1 -0
- package/dist/memory/curator-trust.d.ts +15 -0
- package/dist/memory/curator-trust.d.ts.map +1 -0
- package/dist/memory/curator-trust.js +58 -0
- package/dist/memory/curator-trust.js.map +1 -0
- package/dist/memory/curator.d.ts +115 -0
- package/dist/memory/curator.d.ts.map +1 -0
- package/dist/memory/curator.js +706 -0
- package/dist/memory/curator.js.map +1 -0
- package/dist/memory/entries.d.ts +75 -0
- package/dist/memory/entries.d.ts.map +1 -0
- package/dist/memory/entries.js +355 -0
- package/dist/memory/entries.js.map +1 -0
- package/dist/memory/federated-retrieval.d.ts +79 -0
- package/dist/memory/federated-retrieval.d.ts.map +1 -0
- package/dist/memory/federated-retrieval.js +515 -0
- package/dist/memory/federated-retrieval.js.map +1 -0
- package/dist/memory/hybrid-retrieval.d.ts +33 -0
- package/dist/memory/hybrid-retrieval.d.ts.map +1 -0
- package/dist/memory/hybrid-retrieval.js +398 -0
- package/dist/memory/hybrid-retrieval.js.map +1 -0
- package/dist/memory/lifecycle.d.ts +29 -0
- package/dist/memory/lifecycle.d.ts.map +1 -0
- package/dist/memory/lifecycle.js +65 -0
- package/dist/memory/lifecycle.js.map +1 -0
- package/dist/memory/portability.d.ts +10 -0
- package/dist/memory/portability.d.ts.map +1 -0
- package/dist/memory/portability.js +44 -0
- package/dist/memory/portability.js.map +1 -0
- package/dist/memory/rebuild-search.d.ts +24 -0
- package/dist/memory/rebuild-search.d.ts.map +1 -0
- package/dist/memory/rebuild-search.js +167 -0
- package/dist/memory/rebuild-search.js.map +1 -0
- package/dist/memory/retrieval-query.d.ts +16 -0
- package/dist/memory/retrieval-query.d.ts.map +1 -0
- package/dist/memory/retrieval-query.js +161 -0
- package/dist/memory/retrieval-query.js.map +1 -0
- package/dist/memory/retrieval.d.ts +56 -0
- package/dist/memory/retrieval.d.ts.map +1 -0
- package/dist/memory/retrieval.js +101 -0
- package/dist/memory/retrieval.js.map +1 -0
- package/dist/memory/revisions.d.ts +123 -0
- package/dist/memory/revisions.d.ts.map +1 -0
- package/dist/memory/revisions.js +759 -0
- package/dist/memory/revisions.js.map +1 -0
- package/dist/memory/scoped-memory.d.ts +76 -0
- package/dist/memory/scoped-memory.d.ts.map +1 -0
- package/dist/memory/scoped-memory.js +539 -0
- package/dist/memory/scoped-memory.js.map +1 -0
- package/dist/memory/secrets.d.ts +8 -0
- package/dist/memory/secrets.d.ts.map +1 -0
- package/dist/memory/secrets.js +54 -0
- package/dist/memory/secrets.js.map +1 -0
- package/dist/memory/structured-memory.d.ts +60 -0
- package/dist/memory/structured-memory.d.ts.map +1 -0
- package/dist/memory/structured-memory.js +341 -0
- package/dist/memory/structured-memory.js.map +1 -0
- package/dist/memory/workspaces.d.ts +26 -0
- package/dist/memory/workspaces.d.ts.map +1 -0
- package/dist/memory/workspaces.js +159 -0
- package/dist/memory/workspaces.js.map +1 -0
- package/dist/model-tools/contracts.d.ts +1297 -0
- package/dist/model-tools/contracts.d.ts.map +1 -0
- package/dist/model-tools/contracts.js +104 -0
- package/dist/model-tools/contracts.js.map +1 -0
- package/dist/model-tools/registry.d.ts +8 -0
- package/dist/model-tools/registry.d.ts.map +1 -0
- package/dist/model-tools/registry.js +59 -0
- package/dist/model-tools/registry.js.map +1 -0
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +7 -0
- package/dist/package-version.js.map +1 -0
- package/dist/repository/binding.d.ts +32 -0
- package/dist/repository/binding.d.ts.map +1 -0
- package/dist/repository/binding.js +208 -0
- package/dist/repository/binding.js.map +1 -0
- package/dist/repository/cwd-schema.d.ts +4 -0
- package/dist/repository/cwd-schema.d.ts.map +1 -0
- package/dist/repository/cwd-schema.js +8 -0
- package/dist/repository/cwd-schema.js.map +1 -0
- package/dist/repository/detect-root.d.ts +13 -0
- package/dist/repository/detect-root.d.ts.map +1 -0
- package/dist/repository/detect-root.js +77 -0
- package/dist/repository/detect-root.js.map +1 -0
- package/dist/repository/framework-version.d.ts +8 -0
- package/dist/repository/framework-version.d.ts.map +1 -0
- package/dist/repository/framework-version.js +29 -0
- package/dist/repository/framework-version.js.map +1 -0
- package/dist/repository/git-origin.d.ts +2 -0
- package/dist/repository/git-origin.d.ts.map +1 -0
- package/dist/repository/git-origin.js +15 -0
- package/dist/repository/git-origin.js.map +1 -0
- package/dist/repository/gitignore.d.ts +8 -0
- package/dist/repository/gitignore.d.ts.map +1 -0
- package/dist/repository/gitignore.js +21 -0
- package/dist/repository/gitignore.js.map +1 -0
- package/dist/repository/identity-value.d.ts +4 -0
- package/dist/repository/identity-value.d.ts.map +1 -0
- package/dist/repository/identity-value.js +24 -0
- package/dist/repository/identity-value.js.map +1 -0
- package/dist/repository/identity.d.ts +19 -0
- package/dist/repository/identity.d.ts.map +1 -0
- package/dist/repository/identity.js +25 -0
- package/dist/repository/identity.js.map +1 -0
- package/dist/repository/project-fingerprint.d.ts +33 -0
- package/dist/repository/project-fingerprint.d.ts.map +1 -0
- package/dist/repository/project-fingerprint.js +429 -0
- package/dist/repository/project-fingerprint.js.map +1 -0
- package/dist/repository/remote-url.d.ts +3 -0
- package/dist/repository/remote-url.d.ts.map +1 -0
- package/dist/repository/remote-url.js +35 -0
- package/dist/repository/remote-url.js.map +1 -0
- package/dist/runtime-version.d.ts +6 -0
- package/dist/runtime-version.d.ts.map +1 -0
- package/dist/runtime-version.js +33 -0
- package/dist/runtime-version.js.map +1 -0
- package/dist/security/sanitize.d.ts +4 -0
- package/dist/security/sanitize.d.ts.map +1 -0
- package/dist/security/sanitize.js +174 -0
- package/dist/security/sanitize.js.map +1 -0
- package/dist/serialization/boundary-json.d.ts +20 -0
- package/dist/serialization/boundary-json.d.ts.map +1 -0
- package/dist/serialization/boundary-json.js +129 -0
- package/dist/serialization/boundary-json.js.map +1 -0
- package/dist/serialization/envelope.d.ts +20 -0
- package/dist/serialization/envelope.d.ts.map +1 -0
- package/dist/serialization/envelope.js +11 -0
- package/dist/serialization/envelope.js.map +1 -0
- package/dist/serialization/validate.d.ts +38 -0
- package/dist/serialization/validate.d.ts.map +1 -0
- package/dist/serialization/validate.js +233 -0
- package/dist/serialization/validate.js.map +1 -0
- package/dist/server/agent-application.d.ts +6 -0
- package/dist/server/agent-application.d.ts.map +1 -0
- package/dist/server/agent-application.js +74 -0
- package/dist/server/agent-application.js.map +1 -0
- package/dist/server/agent-checkpoint-use-case.d.ts +41 -0
- package/dist/server/agent-checkpoint-use-case.d.ts.map +1 -0
- package/dist/server/agent-checkpoint-use-case.js +159 -0
- package/dist/server/agent-checkpoint-use-case.js.map +1 -0
- package/dist/server/app.d.ts +5 -0
- package/dist/server/app.d.ts.map +1 -0
- package/dist/server/app.js +87 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/auth.js +22 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/http.d.ts +86 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +455 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/idempotency.d.ts +6 -0
- package/dist/server/idempotency.d.ts.map +1 -0
- package/dist/server/idempotency.js +210 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/instance-lock.d.ts +17 -0
- package/dist/server/instance-lock.d.ts.map +1 -0
- package/dist/server/instance-lock.js +118 -0
- package/dist/server/instance-lock.js.map +1 -0
- package/dist/server/router.d.ts +29 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +129 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/routes/agent-capability-gate.d.ts +43 -0
- package/dist/server/routes/agent-capability-gate.d.ts.map +1 -0
- package/dist/server/routes/agent-capability-gate.js +202 -0
- package/dist/server/routes/agent-capability-gate.js.map +1 -0
- package/dist/server/routes/agent-events.d.ts +5 -0
- package/dist/server/routes/agent-events.d.ts.map +1 -0
- package/dist/server/routes/agent-events.js +53 -0
- package/dist/server/routes/agent-events.js.map +1 -0
- package/dist/server/routes/agent-intake.d.ts +5 -0
- package/dist/server/routes/agent-intake.d.ts.map +1 -0
- package/dist/server/routes/agent-intake.js +50 -0
- package/dist/server/routes/agent-intake.js.map +1 -0
- package/dist/server/routes/agent-promotions.d.ts +5 -0
- package/dist/server/routes/agent-promotions.d.ts.map +1 -0
- package/dist/server/routes/agent-promotions.js +55 -0
- package/dist/server/routes/agent-promotions.js.map +1 -0
- package/dist/server/routes/agent-runs.d.ts +32 -0
- package/dist/server/routes/agent-runs.d.ts.map +1 -0
- package/dist/server/routes/agent-runs.js +165 -0
- package/dist/server/routes/agent-runs.js.map +1 -0
- package/dist/server/routes/request-binding.d.ts +5 -0
- package/dist/server/routes/request-binding.d.ts.map +1 -0
- package/dist/server/routes/request-binding.js +49 -0
- package/dist/server/routes/request-binding.js.map +1 -0
- package/dist/server/routes/task5-support.d.ts +4 -0
- package/dist/server/routes/task5-support.d.ts.map +1 -0
- package/dist/server/routes/task5-support.js +6 -0
- package/dist/server/routes/task5-support.js.map +1 -0
- package/dist/server/routes/task5.d.ts +5 -0
- package/dist/server/routes/task5.d.ts.map +1 -0
- package/dist/server/routes/task5.js +85 -0
- package/dist/server/routes/task5.js.map +1 -0
- package/dist/server/runtime-descriptor.d.ts +24 -0
- package/dist/server/runtime-descriptor.d.ts.map +1 -0
- package/dist/server/runtime-descriptor.js +156 -0
- package/dist/server/runtime-descriptor.js.map +1 -0
- package/dist/server/write-queue.d.ts +20 -0
- package/dist/server/write-queue.d.ts.map +1 -0
- package/dist/server/write-queue.js +83 -0
- package/dist/server/write-queue.js.map +1 -0
- package/dist/setup/claude-config.d.ts +8 -0
- package/dist/setup/claude-config.d.ts.map +1 -0
- package/dist/setup/claude-config.js +95 -0
- package/dist/setup/claude-config.js.map +1 -0
- package/dist/setup/client-detection.d.ts +13 -0
- package/dist/setup/client-detection.d.ts.map +1 -0
- package/dist/setup/client-detection.js +64 -0
- package/dist/setup/client-detection.js.map +1 -0
- package/dist/setup/enno-client-config.d.ts +9 -0
- package/dist/setup/enno-client-config.d.ts.map +1 -0
- package/dist/setup/enno-client-config.js +172 -0
- package/dist/setup/enno-client-config.js.map +1 -0
- package/dist/setup/hermes-config.d.ts +7 -0
- package/dist/setup/hermes-config.d.ts.map +1 -0
- package/dist/setup/hermes-config.js +145 -0
- package/dist/setup/hermes-config.js.map +1 -0
- package/dist/setup/legacy-client-cleanup.d.ts +6 -0
- package/dist/setup/legacy-client-cleanup.d.ts.map +1 -0
- package/dist/setup/legacy-client-cleanup.js +152 -0
- package/dist/setup/legacy-client-cleanup.js.map +1 -0
- package/dist/setup/managed-text.d.ts +6 -0
- package/dist/setup/managed-text.d.ts.map +1 -0
- package/dist/setup/managed-text.js +52 -0
- package/dist/setup/managed-text.js.map +1 -0
- package/dist/setup/mcp-conflict.d.ts +4 -0
- package/dist/setup/mcp-conflict.d.ts.map +1 -0
- package/dist/setup/mcp-conflict.js +15 -0
- package/dist/setup/mcp-conflict.js.map +1 -0
- package/dist/setup/opencode-config.d.ts +8 -0
- package/dist/setup/opencode-config.d.ts.map +1 -0
- package/dist/setup/opencode-config.js +98 -0
- package/dist/setup/opencode-config.js.map +1 -0
- package/dist/setup/project-agent-refresh.d.ts +41 -0
- package/dist/setup/project-agent-refresh.d.ts.map +1 -0
- package/dist/setup/project-agent-refresh.js +158 -0
- package/dist/setup/project-agent-refresh.js.map +1 -0
- package/dist/setup/render.d.ts +13 -0
- package/dist/setup/render.d.ts.map +1 -0
- package/dist/setup/render.js +334 -0
- package/dist/setup/render.js.map +1 -0
- package/dist/setup/standard-skills.d.ts +60 -0
- package/dist/setup/standard-skills.d.ts.map +1 -0
- package/dist/setup/standard-skills.js +133 -0
- package/dist/setup/standard-skills.js.map +1 -0
- package/dist/setup/strict-json.d.ts +7 -0
- package/dist/setup/strict-json.d.ts.map +1 -0
- package/dist/setup/strict-json.js +98 -0
- package/dist/setup/strict-json.js.map +1 -0
- package/dist/setup/strict-toml.d.ts +18 -0
- package/dist/setup/strict-toml.d.ts.map +1 -0
- package/dist/setup/strict-toml.js +491 -0
- package/dist/setup/strict-toml.js.map +1 -0
- package/dist/skills/cache.d.ts +15 -0
- package/dist/skills/cache.d.ts.map +1 -0
- package/dist/skills/cache.js +19 -0
- package/dist/skills/cache.js.map +1 -0
- package/dist/skills/candidate-ranking.d.ts +15 -0
- package/dist/skills/candidate-ranking.d.ts.map +1 -0
- package/dist/skills/candidate-ranking.js +52 -0
- package/dist/skills/candidate-ranking.js.map +1 -0
- package/dist/skills/chunking.d.ts +11 -0
- package/dist/skills/chunking.d.ts.map +1 -0
- package/dist/skills/chunking.js +291 -0
- package/dist/skills/chunking.js.map +1 -0
- package/dist/skills/config.d.ts +19 -0
- package/dist/skills/config.d.ts.map +1 -0
- package/dist/skills/config.js +103 -0
- package/dist/skills/config.js.map +1 -0
- package/dist/skills/discovery-service.d.ts +26 -0
- package/dist/skills/discovery-service.d.ts.map +1 -0
- package/dist/skills/discovery-service.js +929 -0
- package/dist/skills/discovery-service.js.map +1 -0
- package/dist/skills/external-transport.d.ts +2 -0
- package/dist/skills/external-transport.d.ts.map +1 -0
- package/dist/skills/external-transport.js +30 -0
- package/dist/skills/external-transport.js.map +1 -0
- package/dist/skills/find.d.ts +17 -0
- package/dist/skills/find.d.ts.map +1 -0
- package/dist/skills/find.js +59 -0
- package/dist/skills/find.js.map +1 -0
- package/dist/skills/gap-detection.d.ts +23 -0
- package/dist/skills/gap-detection.d.ts.map +1 -0
- package/dist/skills/gap-detection.js +62 -0
- package/dist/skills/gap-detection.js.map +1 -0
- package/dist/skills/import-preparation.d.ts +4 -0
- package/dist/skills/import-preparation.d.ts.map +1 -0
- package/dist/skills/import-preparation.js +20 -0
- package/dist/skills/import-preparation.js.map +1 -0
- package/dist/skills/materialization-authority.d.ts +11 -0
- package/dist/skills/materialization-authority.d.ts.map +1 -0
- package/dist/skills/materialization-authority.js +92 -0
- package/dist/skills/materialization-authority.js.map +1 -0
- package/dist/skills/materialization-service.d.ts +22 -0
- package/dist/skills/materialization-service.d.ts.map +1 -0
- package/dist/skills/materialization-service.js +101 -0
- package/dist/skills/materialization-service.js.map +1 -0
- package/dist/skills/official-catalog.d.ts +31 -0
- package/dist/skills/official-catalog.d.ts.map +1 -0
- package/dist/skills/official-catalog.js +110 -0
- package/dist/skills/official-catalog.js.map +1 -0
- package/dist/skills/providers/schema.d.ts +30 -0
- package/dist/skills/providers/schema.d.ts.map +1 -0
- package/dist/skills/providers/schema.js +354 -0
- package/dist/skills/providers/schema.js.map +1 -0
- package/dist/skills/providers/skills-sh-compat.d.ts +17 -0
- package/dist/skills/providers/skills-sh-compat.d.ts.map +1 -0
- package/dist/skills/providers/skills-sh-compat.js +73 -0
- package/dist/skills/providers/skills-sh-compat.js.map +1 -0
- package/dist/skills/providers/skills-sh-v1.d.ts +23 -0
- package/dist/skills/providers/skills-sh-v1.d.ts.map +1 -0
- package/dist/skills/providers/skills-sh-v1.js +152 -0
- package/dist/skills/providers/skills-sh-v1.js.map +1 -0
- package/dist/skills/query-builder.d.ts +18 -0
- package/dist/skills/query-builder.d.ts.map +1 -0
- package/dist/skills/query-builder.js +93 -0
- package/dist/skills/query-builder.js.map +1 -0
- package/dist/skills/source/errors.d.ts +9 -0
- package/dist/skills/source/errors.d.ts.map +1 -0
- package/dist/skills/source/errors.js +15 -0
- package/dist/skills/source/errors.js.map +1 -0
- package/dist/skills/source/frontmatter.d.ts +9 -0
- package/dist/skills/source/frontmatter.d.ts.map +1 -0
- package/dist/skills/source/frontmatter.js +77 -0
- package/dist/skills/source/frontmatter.js.map +1 -0
- package/dist/skills/source/github-fetcher.d.ts +20 -0
- package/dist/skills/source/github-fetcher.d.ts.map +1 -0
- package/dist/skills/source/github-fetcher.js +296 -0
- package/dist/skills/source/github-fetcher.js.map +1 -0
- package/dist/skills/source/snapshot-validator.d.ts +28 -0
- package/dist/skills/source/snapshot-validator.d.ts.map +1 -0
- package/dist/skills/source/snapshot-validator.js +186 -0
- package/dist/skills/source/snapshot-validator.js.map +1 -0
- package/dist/skills/store.d.ts +180 -0
- package/dist/skills/store.d.ts.map +1 -0
- package/dist/skills/store.js +1712 -0
- package/dist/skills/store.js.map +1 -0
- package/dist/skills/types.d.ts +171 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/web/i18n.d.ts +184 -0
- package/dist/web/i18n.d.ts.map +1 -0
- package/dist/web/i18n.js +733 -0
- package/dist/web/i18n.js.map +1 -0
- package/dist/web/server.d.ts +16 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +862 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/ui.d.ts +6 -0
- package/dist/web/ui.d.ts.map +1 -0
- package/dist/web/ui.js +1328 -0
- package/dist/web/ui.js.map +1 -0
- package/docs/README.ja.md +14 -0
- package/docs/README.md +16 -0
- package/docs/agent-file.md +72 -0
- package/docs/agent-gateway.md +104 -0
- package/docs/architecture.md +12 -0
- package/docs/cli-contract.md +39 -0
- package/docs/client-compatibility.md +299 -0
- package/docs/concepts.ja.md +25 -0
- package/docs/concepts.md +33 -0
- package/docs/database.md +11 -0
- package/docs/dsh-plugin.md +108 -0
- package/docs/enno-oduno.ja.md +22 -0
- package/docs/enno-oduno.md +35 -0
- package/docs/execution-ledger.md +89 -0
- package/docs/getting-started.ja.md +88 -0
- package/docs/getting-started.md +99 -0
- package/docs/release-notes-0.1.18.md +103 -0
- package/docs/retrieval-evaluation.md +10 -0
- package/docs/security-and-trust.ja.md +29 -0
- package/docs/security-and-trust.md +39 -0
- package/docs/security.md +11 -0
- package/docs/semantic-retrieval.ja.md +18 -0
- package/docs/semantic-retrieval.md +26 -0
- package/docs/sqlite-driver-adr.md +8 -0
- package/dsh/cordis.patch.yml +7 -0
- package/migrations/001_initial.sql +123 -0
- package/migrations/002_fts.sql +22 -0
- package/migrations/003_akinator.sql +30 -0
- package/migrations/004_agent_gateway.sql +261 -0
- package/migrations/005_hybrid_search.sql +40 -0
- package/migrations/006_context_v2.sql +4 -0
- package/migrations/007_akinator_reasoning.sql +59 -0
- package/migrations/008_federated_memory.sql +46 -0
- package/migrations/009_external_skill_discovery.sql +126 -0
- package/migrations/010_nudge_deliveries.sql +50 -0
- package/migrations/011_nudge_integrity.sql +52 -0
- package/migrations/012_context_delivery_v4.sql +3 -0
- package/migrations/013_enno_oduno.sql +176 -0
- package/migrations/014_oduno_reflection_phases.sql +40 -0
- package/migrations/015_skill_discovery_attempt_digests.sql +90 -0
- package/migrations/016_enno_advisory_rounds.sql +67 -0
- package/migrations/017_enno_advisory_protocol_v2.sql +101 -0
- package/migrations/018_enno_repository_routing.sql +5 -0
- package/migrations/019_enno_execution_integrity.sql +149 -0
- package/migrations/020_cjk_fts.sql +80 -0
- package/migrations/021_semantic_embeddings.sql +122 -0
- package/migrations/022_embedding_setup_v2.sql +236 -0
- package/migrations/023_enno_dsh_client.sql +291 -0
- package/migrations/down/020_cjk_fts.sql +38 -0
- package/migrations/down/021_semantic_embeddings.sql +17 -0
- package/migrations/down/022_embedding_setup_v2.sql +133 -0
- package/package.json +101 -0
- package/skills/kiokuko-enno-oduno/SKILL.md +209 -0
- package/skills/kiokuko-enno-oduno/enno-oduno.png +0 -0
- package/skills/kiokuko-simple-work/SKILL.md +112 -0
- package/skills/kiokuko-single-purpose-functions/SKILL.md +82 -0
- package/skills/kiokuko-single-purpose-functions/references/boundaries-and-ownership.md +50 -0
- package/skills/kiokuko-single-purpose-functions/references/domain-and-types.md +48 -0
- package/skills/kiokuko-single-purpose-functions/references/effects-and-data.md +43 -0
- package/skills/kiokuko-single-purpose-functions/references/kiokuko-patterns.md +344 -0
- package/skills/kiokuko-single-purpose-functions/references/problem-shaping-and-language.md +84 -0
- package/skills/kiokuko-single-purpose-functions/references/protocols-and-idempotency.md +42 -0
- package/skills/kiokuko-single-purpose-functions/references/review-checklist.md +97 -0
- package/skills/kiokuko-single-purpose-functions/references/verification.md +41 -0
- package/skills/kiokuko-soul/SKILL.md +104 -0
- package/skills/kiokuko-ui-design-soul/SKILL.md +73 -0
- package/skills/kiokuko-ui-design-soul/references/accessibility-and-navigation.md +31 -0
- package/skills/kiokuko-ui-design-soul/references/async-recovery.md +49 -0
- package/skills/kiokuko-ui-design-soul/references/forms-and-controls.md +35 -0
- package/skills/kiokuko-ui-design-soul/references/interaction-feedback.md +34 -0
- package/skills/kiokuko-ui-design-soul/references/responsive-and-platform.md +38 -0
- package/skills/kiokuko-ui-design-soul/references/safety-and-review.md +39 -0
- package/skills/kiokuko-ui-design-soul/references/ui-checklist.md +71 -0
- package/skills/memory-reasoning/SKILL.md +52 -0
- package/templates/AGENTS.md +46 -0
|
@@ -0,0 +1,1379 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { withImmediateTransaction } from '../db/transaction.js';
|
|
3
|
+
import { KiokukoError } from '../errors.js';
|
|
4
|
+
import { assertCapabilityCatalogBinding } from '../akinator/capability-binding.js';
|
|
5
|
+
import { normalizeCapabilityCatalog } from '../akinator/capabilities.js';
|
|
6
|
+
import { getAkinatorContextService } from '../akinator/service.js';
|
|
7
|
+
import { claimAgentTaskSkillDiscoveryAttempt, completeAgentTaskSkillDiscoveryAttempt, failAgentTaskSkillDiscoveryAttempt, readAgentTaskSkillDiscoveryAttempt, } from '../akinator/skill-discovery-attempt.js';
|
|
8
|
+
import { captureProjectManifestSnapshot, resolveProjectFingerprint, } from '../repository/project-fingerprint.js';
|
|
9
|
+
import { discoverSkills } from '../skills/discovery-service.js';
|
|
10
|
+
import { SkillProviderError } from '../skills/providers/schema.js';
|
|
11
|
+
import { canonicalContentHash, canonicalJson } from '../serialization/validate.js';
|
|
12
|
+
import { sanitizeJson } from '../security/sanitize.js';
|
|
13
|
+
import { LedgerStore } from '../ledger/store.js';
|
|
14
|
+
import { directiveForIntake, directiveForRun } from './directives.js';
|
|
15
|
+
import { advisoryContextForSnapshot, advisoryInputDigest, advisoryPhaseForStatus, normalizeAdvisoryContributions } from './advisory.js';
|
|
16
|
+
import { createAdvisoryRoundInTransaction, ensureAdvisoryRoundConsumedInTransaction, readAdvisoryRound, readSubmittedAdvisoryRound, } from './advisory-store.js';
|
|
17
|
+
import { assertWorkPlanExpertCoverage } from './experts.js';
|
|
18
|
+
import { buildEnnoRequestHandoff } from './handoff.js';
|
|
19
|
+
import { identifyEnnoClientKind } from './harness.js';
|
|
20
|
+
import { assertContractVerifierCwds, parseEnnoAnswer, parseAdviceRead, parseAdviceSubmission, parseFinishRequest, parseIdealSubmission, parseMeditationSubmission, parsePlanSubmission, parseVerificationPrepare, parseWorkReport, } from './schemas.js';
|
|
21
|
+
import { completeRequiredSkillList, createSkillSetEntries, orderedUniqueSkillNames, unavailableRequiredSkills, } from './skills.js';
|
|
22
|
+
import { appendEnnoEventInTransaction, assertExecutionLeaseInTransaction, claimExecutionLeaseInTransaction, completeOperationInTransaction, createEnnoDraft, finishVerifierRunsInTransaction, readEnnoSnapshot, readFreshFinalVerifierResults, readOperationReceipt, releaseExecutionLeaseInTransaction, renewExecutionLeaseInTransaction, resolveEnnoIdentity, replaceWorkUnitsInTransaction, setWorkUnitStatusInTransaction, startOperationInTransaction, startVerifierRunsInTransaction, operationLeaseMsForVerifiers, terminalizeLedgerRunInTransaction, updateContractInTransaction, } from './store.js';
|
|
23
|
+
import { ENNO_APPLICABLE_TASK_TYPES, ENNO_MAX_EXTERNAL_SKILLS, ENNO_MAX_TOTAL_SKILL_QUERIES, ENNO_PROVENANCE_KEYS, } from './types.js';
|
|
24
|
+
import { runVerifiers } from './verifier.js';
|
|
25
|
+
import { planStartRecoveryBlocker, planStartRecoveryError, planStartRecoveryReasonFromBlocker, } from './plan-recovery.js';
|
|
26
|
+
import { ennoValidationError } from './validation-errors.js';
|
|
27
|
+
import { captureRepositoryState } from './repository-state.js';
|
|
28
|
+
import { sanitizeEnnoAnswer, sanitizeFinishRequest, sanitizeIdealSubmission, sanitizeMeditationSubmission, sanitizePlanSubmission, sanitizeWorkReport, } from './sanitize.js';
|
|
29
|
+
import { STANDARD_FUNCTION_SKILL_NAME, STANDARD_SOUL_SKILL_NAME, STANDARD_UI_SKILL_NAME, } from '../setup/standard-skills.js';
|
|
30
|
+
function stateForSnapshot(snapshot) {
|
|
31
|
+
let nextAction;
|
|
32
|
+
if (snapshot.status === 'intake')
|
|
33
|
+
nextAction = 'answer_intake';
|
|
34
|
+
else if (snapshot.status === 'oduno_ideal')
|
|
35
|
+
nextAction = 'submit_ideal';
|
|
36
|
+
else if (snapshot.status === 'zenki_planning')
|
|
37
|
+
nextAction = 'submit_plan';
|
|
38
|
+
else if (snapshot.status === 'needs_confirmation')
|
|
39
|
+
nextAction = 'ask_user_confirmation';
|
|
40
|
+
else if (snapshot.status === 'goki_executing')
|
|
41
|
+
nextAction = 'execute_work_unit';
|
|
42
|
+
else if (snapshot.status === 'enno_verifying')
|
|
43
|
+
nextAction = snapshot.finalEvidenceReady ? 'submit_final_review' : 'run_final_verification';
|
|
44
|
+
else if (snapshot.status === 'oduno_meditation')
|
|
45
|
+
nextAction = 'submit_meditation';
|
|
46
|
+
else if (snapshot.status === 'blocked')
|
|
47
|
+
nextAction = 'report_blocker';
|
|
48
|
+
else
|
|
49
|
+
nextAction = 'complete';
|
|
50
|
+
const directive = directiveForRun(snapshot);
|
|
51
|
+
return {
|
|
52
|
+
applicable: true,
|
|
53
|
+
status: snapshot.status,
|
|
54
|
+
orchestrationId: snapshot.orchestrationId,
|
|
55
|
+
clientBinding: {
|
|
56
|
+
status: snapshot.clientSessionId === null ? 'pending' : 'bound',
|
|
57
|
+
clientKind: snapshot.clientKind,
|
|
58
|
+
clientVersion: snapshot.clientVersion,
|
|
59
|
+
identified: snapshot.clientKind !== null,
|
|
60
|
+
},
|
|
61
|
+
contractRevision: snapshot.revision,
|
|
62
|
+
routeEpoch: snapshot.routeEpoch ?? 0,
|
|
63
|
+
ideal: snapshot.ideal,
|
|
64
|
+
meditation: snapshot.meditation,
|
|
65
|
+
currentRole: directive?.role ?? null,
|
|
66
|
+
directive,
|
|
67
|
+
nextAction,
|
|
68
|
+
advisoryPhaseState: snapshot.advisoryPhaseState ?? { state: 'not_started' },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function intakeEnnoState(input) {
|
|
72
|
+
const directive = directiveForIntake(input);
|
|
73
|
+
return {
|
|
74
|
+
applicable: true,
|
|
75
|
+
status: 'intake',
|
|
76
|
+
orchestrationId: input.orchestrationId,
|
|
77
|
+
clientBinding: {
|
|
78
|
+
status: input.clientSessionId === null ? 'pending' : 'bound',
|
|
79
|
+
clientKind: input.clientKind,
|
|
80
|
+
clientVersion: input.clientVersion,
|
|
81
|
+
identified: input.clientKind !== null,
|
|
82
|
+
},
|
|
83
|
+
contractRevision: null,
|
|
84
|
+
routeEpoch: null,
|
|
85
|
+
ideal: null,
|
|
86
|
+
meditation: null,
|
|
87
|
+
currentRole: 'enno-oduno',
|
|
88
|
+
directive,
|
|
89
|
+
nextAction: 'answer_intake',
|
|
90
|
+
advisoryPhaseState: { state: 'not_started' },
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function inapplicableEnnoState() {
|
|
94
|
+
return {
|
|
95
|
+
applicable: false,
|
|
96
|
+
status: 'intake',
|
|
97
|
+
orchestrationId: null,
|
|
98
|
+
clientBinding: null,
|
|
99
|
+
contractRevision: null,
|
|
100
|
+
routeEpoch: null,
|
|
101
|
+
ideal: null,
|
|
102
|
+
meditation: null,
|
|
103
|
+
currentRole: null,
|
|
104
|
+
directive: null,
|
|
105
|
+
nextAction: 'complete',
|
|
106
|
+
advisoryPhaseState: { state: 'not_started' },
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function ennoStateForPreparedTask(database, prepared, client) {
|
|
110
|
+
const taskType = prepared.intake.profile.taskType;
|
|
111
|
+
const clientKind = identifyEnnoClientKind(client?.kind);
|
|
112
|
+
const clientVersion = clientKind === null ? null : client?.version ?? null;
|
|
113
|
+
const clientSessionId = clientKind === null ? null : client?.sessionId ?? null;
|
|
114
|
+
if (prepared.intake.status === 'needs_answer' && taskType === null) {
|
|
115
|
+
return intakeEnnoState({
|
|
116
|
+
runId: prepared.run.runId,
|
|
117
|
+
orchestrationId: prepared.intake.sessionId,
|
|
118
|
+
clientKind,
|
|
119
|
+
clientVersion,
|
|
120
|
+
clientSessionId,
|
|
121
|
+
question: prepared.intake.question,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (taskType === null || !ENNO_APPLICABLE_TASK_TYPES.includes(taskType)) {
|
|
125
|
+
return inapplicableEnnoState();
|
|
126
|
+
}
|
|
127
|
+
if (prepared.intake.status === 'needs_answer') {
|
|
128
|
+
return intakeEnnoState({
|
|
129
|
+
runId: prepared.run.runId,
|
|
130
|
+
orchestrationId: prepared.intake.sessionId,
|
|
131
|
+
clientKind,
|
|
132
|
+
clientVersion,
|
|
133
|
+
clientSessionId,
|
|
134
|
+
question: prepared.intake.question,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const handoff = buildEnnoRequestHandoff(prepared.intake.profile, prepared.intake.reasoning);
|
|
138
|
+
const snapshot = createEnnoDraft(database, {
|
|
139
|
+
runId: prepared.run.runId,
|
|
140
|
+
workspace: prepared.project.workspace,
|
|
141
|
+
orchestrationId: prepared.intake.sessionId,
|
|
142
|
+
repositoryRoot: prepared.project.repositoryRoot,
|
|
143
|
+
taskType: taskType,
|
|
144
|
+
taskTarget: prepared.intake.profile.target,
|
|
145
|
+
taskExpected: prepared.intake.profile.expected,
|
|
146
|
+
handoff,
|
|
147
|
+
skillDiscovery: prepared.skillDiscovery,
|
|
148
|
+
...(clientKind === null ? {} : { initialClientKind: clientKind }),
|
|
149
|
+
...(clientVersion === null ? {} : { initialClientVersion: clientVersion }),
|
|
150
|
+
...(clientSessionId === null ? {} : { initialClientSessionId: clientSessionId }),
|
|
151
|
+
});
|
|
152
|
+
return stateForSnapshot(snapshot);
|
|
153
|
+
}
|
|
154
|
+
function operationIdentity(operation, idempotencyKey, input) {
|
|
155
|
+
const semanticInput = typeof input === 'object' && input !== null && !Array.isArray(input)
|
|
156
|
+
? Object.fromEntries(Object.entries(input)
|
|
157
|
+
.filter(([key]) => !['workspace', 'orchestrationId', 'resumeToken', 'idempotencyKey'].includes(key)))
|
|
158
|
+
: input;
|
|
159
|
+
const requestDigest = canonicalContentHash({ version: 1, operation, input: semanticInput });
|
|
160
|
+
const legacyRequestDigest = canonicalContentHash({ version: 1, operation, input });
|
|
161
|
+
return {
|
|
162
|
+
operation,
|
|
163
|
+
idempotencyKey,
|
|
164
|
+
requestDigest,
|
|
165
|
+
...(legacyRequestDigest === requestDigest ? {} : { legacyRequestDigests: [legacyRequestDigest] }),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function advisoryContextForSubmission(snapshot, phase) {
|
|
169
|
+
if (advisoryPhaseForStatus(snapshot.status) !== phase
|
|
170
|
+
|| (phase === 'final_review' && !snapshot.finalEvidenceReady)) {
|
|
171
|
+
throw new KiokukoError('CONFLICT', 'Advisory round is not valid for the current Enno phase');
|
|
172
|
+
}
|
|
173
|
+
return advisoryContextForSnapshot(snapshot, phase);
|
|
174
|
+
}
|
|
175
|
+
function assertAdvisoryRoundInput(snapshot, phase, mutationRevision, context, inputDigest, validationOperation) {
|
|
176
|
+
if (snapshot.mutationRevision !== mutationRevision) {
|
|
177
|
+
throw new KiokukoError('CONFLICT', 'Enno mutation revision changed');
|
|
178
|
+
}
|
|
179
|
+
const expectedContext = advisoryContextForSubmission(snapshot, phase);
|
|
180
|
+
if (canonicalJson(expectedContext) !== canonicalJson(context)) {
|
|
181
|
+
throw new KiokukoError('CONFLICT', 'Advisory context does not match the current Enno phase');
|
|
182
|
+
}
|
|
183
|
+
const expectedDigest = advisoryInputDigest({
|
|
184
|
+
phase,
|
|
185
|
+
contractRevision: snapshot.revision,
|
|
186
|
+
mutationRevision,
|
|
187
|
+
allowlistedContext: context,
|
|
188
|
+
});
|
|
189
|
+
if (expectedDigest !== inputDigest) {
|
|
190
|
+
if (validationOperation !== undefined) {
|
|
191
|
+
throw ennoValidationError(validationOperation, [{
|
|
192
|
+
path: ['advisoryRoundDigest'],
|
|
193
|
+
reasonCode: 'advisory_digest_stale',
|
|
194
|
+
}], 'refresh_state');
|
|
195
|
+
}
|
|
196
|
+
throw new KiokukoError('CONFLICT', 'Advisory round digest does not match the current contract');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function requireAdvisoryRound(database, snapshot, phase, mutationRevision, context, inputDigest) {
|
|
200
|
+
const operation = phase === 'planning' ? 'plan_submit' : phase === 'ideal' ? 'ideal_submit' : 'finish';
|
|
201
|
+
assertAdvisoryRoundInput(snapshot, phase, mutationRevision, context, inputDigest, operation);
|
|
202
|
+
const round = readAdvisoryRound(database, {
|
|
203
|
+
runId: snapshot.runId,
|
|
204
|
+
contractRevision: snapshot.revision,
|
|
205
|
+
mutationRevision,
|
|
206
|
+
phase,
|
|
207
|
+
inputDigest,
|
|
208
|
+
});
|
|
209
|
+
if (round === undefined)
|
|
210
|
+
throw new KiokukoError('CONFLICT', 'Required advisory round was not submitted');
|
|
211
|
+
}
|
|
212
|
+
function assertDispositionCoversRound(operation, round, dispositions) {
|
|
213
|
+
const expected = new Set(round.contributions.map((contribution) => contribution.slotId));
|
|
214
|
+
const covered = new Set();
|
|
215
|
+
for (const [index, disposition] of dispositions.entries()) {
|
|
216
|
+
if (!expected.has(disposition.slotId)) {
|
|
217
|
+
throw ennoValidationError(operation, [{
|
|
218
|
+
path: ['advisoryDisposition', index, 'slotId'],
|
|
219
|
+
reasonCode: 'advisory_slot_missing',
|
|
220
|
+
expected: { requiredSlotIds: [...expected] },
|
|
221
|
+
}]);
|
|
222
|
+
}
|
|
223
|
+
if (covered.has(disposition.slotId)) {
|
|
224
|
+
throw ennoValidationError(operation, [{
|
|
225
|
+
path: ['advisoryDisposition', index, 'slotId'],
|
|
226
|
+
reasonCode: 'advisory_slot_duplicate',
|
|
227
|
+
expected: { requiredSlotIds: [...expected] },
|
|
228
|
+
}]);
|
|
229
|
+
}
|
|
230
|
+
const contribution = round.contributions.find((item) => item.slotId === disposition.slotId);
|
|
231
|
+
const compatible = contribution.outcome === 'completed'
|
|
232
|
+
? disposition.disposition === 'adopted' || disposition.disposition === 'not_adopted'
|
|
233
|
+
: disposition.disposition === 'unavailable';
|
|
234
|
+
if (!compatible) {
|
|
235
|
+
throw ennoValidationError(operation, [{
|
|
236
|
+
path: ['advisoryDisposition', index, 'disposition'],
|
|
237
|
+
reasonCode: 'invalid_enum',
|
|
238
|
+
expected: { allowedValues: contribution.outcome === 'completed' ? ['adopted', 'not_adopted'] : ['unavailable'] },
|
|
239
|
+
}]);
|
|
240
|
+
}
|
|
241
|
+
covered.add(disposition.slotId);
|
|
242
|
+
}
|
|
243
|
+
for (const slotId of expected) {
|
|
244
|
+
if (!covered.has(slotId)) {
|
|
245
|
+
throw ennoValidationError(operation, [{
|
|
246
|
+
path: ['advisoryDisposition'],
|
|
247
|
+
reasonCode: 'advisory_slot_missing',
|
|
248
|
+
expected: { requiredSlotIds: [...expected] },
|
|
249
|
+
}]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function consumeAdvisoryRoundIfPresent(database, snapshot, phase, mutationRevision, context, inputDigest, disposition) {
|
|
254
|
+
if (inputDigest === undefined) {
|
|
255
|
+
const submitted = readSubmittedAdvisoryRound(database, {
|
|
256
|
+
runId: snapshot.runId,
|
|
257
|
+
contractRevision: snapshot.revision,
|
|
258
|
+
mutationRevision,
|
|
259
|
+
phase,
|
|
260
|
+
});
|
|
261
|
+
if (submitted !== undefined) {
|
|
262
|
+
throw ennoValidationError(phase === 'planning' ? 'plan_submit' : phase === 'ideal' ? 'ideal_submit' : 'finish', [{
|
|
263
|
+
path: ['advisoryRoundDigest'],
|
|
264
|
+
reasonCode: 'advisory_consumption_required',
|
|
265
|
+
expected: { requiredSlotIds: submitted.contributions.map((item) => item.slotId) },
|
|
266
|
+
}]);
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
}
|
|
270
|
+
if (context === undefined) {
|
|
271
|
+
throw new KiokukoError('CONFLICT', 'Advisory round is not valid for the current Enno phase');
|
|
272
|
+
}
|
|
273
|
+
const operation = phase === 'planning' ? 'plan_submit' : phase === 'ideal' ? 'ideal_submit' : 'finish';
|
|
274
|
+
assertAdvisoryRoundInput(snapshot, phase, mutationRevision, context, inputDigest, operation);
|
|
275
|
+
const dispositions = disposition ?? [];
|
|
276
|
+
if (dispositions.length === 0) {
|
|
277
|
+
throw ennoValidationError(phase === 'planning' ? 'plan_submit' : phase === 'ideal' ? 'ideal_submit' : 'finish', [{
|
|
278
|
+
path: ['advisoryDisposition'],
|
|
279
|
+
reasonCode: 'advisory_digest_requires_disposition',
|
|
280
|
+
}]);
|
|
281
|
+
}
|
|
282
|
+
const pendingRound = readAdvisoryRound(database, {
|
|
283
|
+
runId: snapshot.runId,
|
|
284
|
+
contractRevision: snapshot.revision,
|
|
285
|
+
mutationRevision,
|
|
286
|
+
phase,
|
|
287
|
+
inputDigest,
|
|
288
|
+
});
|
|
289
|
+
if (pendingRound === undefined)
|
|
290
|
+
throw new KiokukoError('CONFLICT', 'Required advisory round was not submitted');
|
|
291
|
+
assertDispositionCoversRound(operation, pendingRound, dispositions);
|
|
292
|
+
const round = ensureAdvisoryRoundConsumedInTransaction(database, {
|
|
293
|
+
runId: snapshot.runId,
|
|
294
|
+
contractRevision: snapshot.revision,
|
|
295
|
+
mutationRevision,
|
|
296
|
+
phase,
|
|
297
|
+
inputDigest,
|
|
298
|
+
});
|
|
299
|
+
appendEnnoEventInTransaction(database, snapshot.runId, 'enno.advice_disposition', 'enno-oduno', 'recorded', {
|
|
300
|
+
phase,
|
|
301
|
+
contractRevision: snapshot.revision,
|
|
302
|
+
mutationRevision,
|
|
303
|
+
inputDigest,
|
|
304
|
+
dispositions: dispositions.map((entry) => ({ slotId: entry.slotId, disposition: entry.disposition, rationale: entry.rationale })),
|
|
305
|
+
});
|
|
306
|
+
return round;
|
|
307
|
+
}
|
|
308
|
+
export function submitEnnoAdvice(database, rawInput) {
|
|
309
|
+
const parsedInput = parseAdviceSubmission(rawInput);
|
|
310
|
+
const input = {
|
|
311
|
+
...parsedInput,
|
|
312
|
+
contributions: normalizeAdvisoryContributions(parsedInput.phase, parsedInput.contributions),
|
|
313
|
+
};
|
|
314
|
+
const before = readEnnoSnapshot(database, identity(database, input));
|
|
315
|
+
const operation = operationIdentity('advice_submit', input.idempotencyKey, input);
|
|
316
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
317
|
+
if (replay !== undefined)
|
|
318
|
+
return replay;
|
|
319
|
+
const expectedPhase = advisoryPhaseForStatus(before.status);
|
|
320
|
+
if (expectedPhase !== input.phase)
|
|
321
|
+
throw new KiokukoError('CONFLICT', 'Advisory phase does not match the current Enno state');
|
|
322
|
+
const context = input.allowlistedContext;
|
|
323
|
+
const inputDigest = advisoryInputDigest({
|
|
324
|
+
phase: input.phase,
|
|
325
|
+
contractRevision: before.revision,
|
|
326
|
+
mutationRevision: input.mutationRevision,
|
|
327
|
+
allowlistedContext: context,
|
|
328
|
+
});
|
|
329
|
+
return withImmediateTransaction(database, () => {
|
|
330
|
+
const replayed = readOperationReceipt(database, input.runId, operation);
|
|
331
|
+
if (replayed !== undefined)
|
|
332
|
+
return replayed;
|
|
333
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
334
|
+
assertExpected(current, input.expectedRevision, [
|
|
335
|
+
input.phase === 'ideal' ? 'oduno_ideal' : input.phase === 'planning' ? 'zenki_planning' : 'enno_verifying',
|
|
336
|
+
]);
|
|
337
|
+
assertAdvisoryRoundInput(current, input.phase, input.mutationRevision, context, inputDigest);
|
|
338
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
339
|
+
const existing = readAdvisoryRound(database, {
|
|
340
|
+
runId: input.runId,
|
|
341
|
+
contractRevision: current.revision,
|
|
342
|
+
mutationRevision: input.mutationRevision,
|
|
343
|
+
phase: input.phase,
|
|
344
|
+
inputDigest,
|
|
345
|
+
});
|
|
346
|
+
let round;
|
|
347
|
+
if (existing !== undefined) {
|
|
348
|
+
const incoming = normalizeAdvisoryContributions(input.phase, input.contributions);
|
|
349
|
+
if (canonicalJson(existing.contributions) !== canonicalJson(incoming)) {
|
|
350
|
+
throw new KiokukoError('CONFLICT', 'Advisory round was already submitted with different contributions');
|
|
351
|
+
}
|
|
352
|
+
round = existing;
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
round = createAdvisoryRoundInTransaction(database, {
|
|
356
|
+
runId: input.runId,
|
|
357
|
+
contractRevision: current.revision,
|
|
358
|
+
mutationRevision: input.mutationRevision,
|
|
359
|
+
phase: input.phase,
|
|
360
|
+
inputDigest,
|
|
361
|
+
contributions: input.contributions,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.advice_submitted', 'enno-oduno', 'aggregated', {
|
|
365
|
+
phase: input.phase,
|
|
366
|
+
contractRevision: current.revision,
|
|
367
|
+
mutationRevision: input.mutationRevision,
|
|
368
|
+
inputDigest,
|
|
369
|
+
degraded: round.degraded,
|
|
370
|
+
});
|
|
371
|
+
const response = {
|
|
372
|
+
ennoOduno: stateForSnapshot(readEnnoSnapshot(database, identity(database, input))),
|
|
373
|
+
advisoryRound: round,
|
|
374
|
+
};
|
|
375
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
376
|
+
return response;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
export function readPendingEnnoAdvice(database, rawInput) {
|
|
380
|
+
const input = parseAdviceRead(rawInput);
|
|
381
|
+
const snapshot = readEnnoSnapshot(database, identity(database, input));
|
|
382
|
+
if (snapshot.revision !== input.expectedRevision) {
|
|
383
|
+
throw new KiokukoError('CONFLICT', 'Enno contract revision changed');
|
|
384
|
+
}
|
|
385
|
+
const phase = advisoryPhaseForStatus(snapshot.status);
|
|
386
|
+
if (phase === null || (phase === 'final_review' && !snapshot.finalEvidenceReady)) {
|
|
387
|
+
throw new KiokukoError('CONFLICT', 'Advisory round is not valid for the current Enno phase');
|
|
388
|
+
}
|
|
389
|
+
if (snapshot.advisoryPhaseState?.state !== 'aggregated') {
|
|
390
|
+
throw new KiokukoError('CONFLICT', 'Required advisory round is not aggregated');
|
|
391
|
+
}
|
|
392
|
+
if (snapshot.advisoryPhaseState.inputDigest !== input.advisoryRoundDigest) {
|
|
393
|
+
throw ennoValidationError('advice_read', [{
|
|
394
|
+
path: ['advisoryRoundDigest'],
|
|
395
|
+
reasonCode: 'advisory_digest_stale',
|
|
396
|
+
}], 'refresh_state');
|
|
397
|
+
}
|
|
398
|
+
const allowlistedContext = advisoryContextForSnapshot(snapshot, phase);
|
|
399
|
+
const expectedDigest = advisoryInputDigest({
|
|
400
|
+
phase,
|
|
401
|
+
contractRevision: snapshot.revision,
|
|
402
|
+
mutationRevision: snapshot.mutationRevision,
|
|
403
|
+
allowlistedContext,
|
|
404
|
+
});
|
|
405
|
+
if (expectedDigest !== input.advisoryRoundDigest) {
|
|
406
|
+
throw ennoValidationError('advice_read', [{
|
|
407
|
+
path: ['advisoryRoundDigest'],
|
|
408
|
+
reasonCode: 'advisory_digest_stale',
|
|
409
|
+
}], 'refresh_state');
|
|
410
|
+
}
|
|
411
|
+
const advisoryRound = readAdvisoryRound(database, {
|
|
412
|
+
runId: snapshot.runId,
|
|
413
|
+
contractRevision: snapshot.revision,
|
|
414
|
+
mutationRevision: snapshot.mutationRevision,
|
|
415
|
+
phase,
|
|
416
|
+
inputDigest: input.advisoryRoundDigest,
|
|
417
|
+
});
|
|
418
|
+
if (advisoryRound === undefined) {
|
|
419
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Stored pending advisory round is missing');
|
|
420
|
+
}
|
|
421
|
+
if (advisoryRound.state !== 'aggregated') {
|
|
422
|
+
throw new KiokukoError('CONFLICT', 'Advisory round is no longer pending');
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
protocolVersion: 1,
|
|
426
|
+
advisoryRound,
|
|
427
|
+
allowlistedContext,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function identity(database, input) {
|
|
431
|
+
return resolveEnnoIdentity(database, input);
|
|
432
|
+
}
|
|
433
|
+
function assertExpected(snapshot, expectedRevision, statuses) {
|
|
434
|
+
if (snapshot.revision !== expectedRevision)
|
|
435
|
+
throw new KiokukoError('CONFLICT', 'Enno contract revision changed');
|
|
436
|
+
if (!statuses.includes(snapshot.status))
|
|
437
|
+
throw new KiokukoError('CONFLICT', 'Enno run is not in the required state');
|
|
438
|
+
}
|
|
439
|
+
function firstReadyUnit(snapshot) {
|
|
440
|
+
const completed = new Set(snapshot.workUnits.filter((unit) => unit.status === 'completed').map((unit) => unit.workUnit.id));
|
|
441
|
+
return snapshot.workUnits.find((unit) => unit.status === 'pending'
|
|
442
|
+
&& unit.workUnit.dependencies.every((dependency) => completed.has(dependency)));
|
|
443
|
+
}
|
|
444
|
+
function startFirstReadyUnit(database, snapshot) {
|
|
445
|
+
const next = firstReadyUnit(snapshot);
|
|
446
|
+
if (next === undefined) {
|
|
447
|
+
if (snapshot.workUnits.every((unit) => unit.status === 'completed'))
|
|
448
|
+
return undefined;
|
|
449
|
+
throw new KiokukoError('CONFLICT', 'Enno WorkPlan dependencies cannot advance');
|
|
450
|
+
}
|
|
451
|
+
setWorkUnitStatusInTransaction(database, {
|
|
452
|
+
runId: snapshot.runId,
|
|
453
|
+
contractRevision: snapshot.revision,
|
|
454
|
+
workUnitId: next.workUnit.id,
|
|
455
|
+
from: 'pending',
|
|
456
|
+
to: 'in_progress',
|
|
457
|
+
});
|
|
458
|
+
appendEnnoEventInTransaction(database, snapshot.runId, 'goki.work_started', 'goki', 'started', {
|
|
459
|
+
workUnitId: next.workUnit.id,
|
|
460
|
+
contractRevision: snapshot.revision,
|
|
461
|
+
});
|
|
462
|
+
if (snapshot.clientKind === null || snapshot.clientSessionId === null)
|
|
463
|
+
return undefined;
|
|
464
|
+
return claimExecutionLeaseInTransaction(database, snapshot, next.workUnit.id, {
|
|
465
|
+
clientKind: snapshot.clientKind,
|
|
466
|
+
sessionId: snapshot.clientSessionId,
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function requiresConfirmation(provenance) {
|
|
470
|
+
return ENNO_PROVENANCE_KEYS.some((key) => provenance[key] !== 'explicit_user');
|
|
471
|
+
}
|
|
472
|
+
async function readRunTaskContext(database, snapshot) {
|
|
473
|
+
const row = database.prepare(`
|
|
474
|
+
SELECT r.repository_id AS repositoryId, ri.session_id AS sessionId
|
|
475
|
+
FROM repositories AS r
|
|
476
|
+
JOIN repository_locations AS l ON l.repository_id = r.repository_id
|
|
477
|
+
JOIN run_intakes AS ri ON ri.run_id = ?
|
|
478
|
+
WHERE r.workspace = ? AND l.canonical_root = ?
|
|
479
|
+
LIMIT 1
|
|
480
|
+
`).get(snapshot.runId, snapshot.workspace, snapshot.repositoryRoot);
|
|
481
|
+
if (row === undefined)
|
|
482
|
+
throw new KiokukoError('CONFLICT', 'Enno repository or intake binding changed');
|
|
483
|
+
const context = await getAkinatorContextService(database, {
|
|
484
|
+
workspace: snapshot.workspace,
|
|
485
|
+
sessionId: row.sessionId,
|
|
486
|
+
});
|
|
487
|
+
const project = {
|
|
488
|
+
workspace: snapshot.workspace,
|
|
489
|
+
repositoryRoot: snapshot.repositoryRoot,
|
|
490
|
+
repositoryId: row.repositoryId,
|
|
491
|
+
source: 'location',
|
|
492
|
+
};
|
|
493
|
+
const manifest = captureProjectManifestSnapshot(project);
|
|
494
|
+
return {
|
|
495
|
+
project,
|
|
496
|
+
fingerprint: resolveProjectFingerprint(database, project, manifest),
|
|
497
|
+
task: context.session.task,
|
|
498
|
+
profile: context.session.profile,
|
|
499
|
+
recommendedTags: context.recommendedTags,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function emptyDiscovery(mode) {
|
|
503
|
+
return { attempted: false, mode, requirements: [], queries: [], cacheHits: 0, candidates: 0, selected: [], failures: [] };
|
|
504
|
+
}
|
|
505
|
+
function legacyOptionalDiscoverySummary(mode, error) {
|
|
506
|
+
if (!(error instanceof SkillProviderError) || error.code !== 'registry_invalid_response')
|
|
507
|
+
return undefined;
|
|
508
|
+
return {
|
|
509
|
+
...emptyDiscovery(mode),
|
|
510
|
+
failures: [{ stage: 'search', code: error.code }],
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
async function discoverZenkiSkills(database, snapshot, plan, dependencies) {
|
|
514
|
+
const intake = snapshot.contract.skillSet.intakeDiscovery;
|
|
515
|
+
if (intake.mode === 'off')
|
|
516
|
+
return emptyDiscovery(intake.mode);
|
|
517
|
+
const context = await readRunTaskContext(database, snapshot);
|
|
518
|
+
const attempt = {
|
|
519
|
+
runId: snapshot.runId,
|
|
520
|
+
phase: 'zenki',
|
|
521
|
+
mode: intake.mode,
|
|
522
|
+
requestDigest: canonicalContentHash({
|
|
523
|
+
version: 2,
|
|
524
|
+
runId: snapshot.runId,
|
|
525
|
+
revision: snapshot.revision,
|
|
526
|
+
mode: intake.mode,
|
|
527
|
+
workPlan: plan.workPlan,
|
|
528
|
+
capabilities: plan.capabilities ?? null,
|
|
529
|
+
skillRequirements: plan.skillRequirements,
|
|
530
|
+
}),
|
|
531
|
+
};
|
|
532
|
+
let replay;
|
|
533
|
+
try {
|
|
534
|
+
replay = readAgentTaskSkillDiscoveryAttempt(database, attempt);
|
|
535
|
+
}
|
|
536
|
+
catch (error) {
|
|
537
|
+
const legacySummary = legacyOptionalDiscoverySummary(intake.mode, error);
|
|
538
|
+
if (legacySummary === undefined)
|
|
539
|
+
throw error;
|
|
540
|
+
return legacySummary;
|
|
541
|
+
}
|
|
542
|
+
if (replay !== undefined)
|
|
543
|
+
return replay.summary;
|
|
544
|
+
const claimed = claimAgentTaskSkillDiscoveryAttempt(database, attempt, {
|
|
545
|
+
queryBudget: ENNO_MAX_TOTAL_SKILL_QUERIES,
|
|
546
|
+
selectionBudget: ENNO_MAX_EXTERNAL_SKILLS,
|
|
547
|
+
});
|
|
548
|
+
if (claimed.kind === 'replay')
|
|
549
|
+
return claimed.summary;
|
|
550
|
+
if (claimed.queryBudget === 0 || claimed.selectionBudget === 0) {
|
|
551
|
+
return completeAgentTaskSkillDiscoveryAttempt(database, attempt, emptyDiscovery(intake.mode), () => {
|
|
552
|
+
assertExpected(readEnnoSnapshot(database, identity(database, plan)), plan.expectedRevision, ['zenki_planning']);
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
try {
|
|
556
|
+
const summary = await (dependencies.discoverSkills ?? discoverSkills)(database, {
|
|
557
|
+
...context,
|
|
558
|
+
task: `${context.task}\n${plan.workPlan.objective}`,
|
|
559
|
+
capabilities: plan.capabilities,
|
|
560
|
+
mode: intake.mode,
|
|
561
|
+
maxQueries: claimed.queryBudget,
|
|
562
|
+
maxSelectedSkills: claimed.selectionBudget,
|
|
563
|
+
...(dependencies.fetchImpl === undefined ? {} : { fetchImpl: dependencies.fetchImpl }),
|
|
564
|
+
}, {
|
|
565
|
+
...(dependencies.fetchImpl === undefined ? {} : { fetchImpl: dependencies.fetchImpl }),
|
|
566
|
+
assertBeforePersist: () => assertExpected(readEnnoSnapshot(database, identity(database, plan)), plan.expectedRevision, ['zenki_planning']),
|
|
567
|
+
});
|
|
568
|
+
return completeAgentTaskSkillDiscoveryAttempt(database, attempt, summary, () => {
|
|
569
|
+
assertExpected(readEnnoSnapshot(database, identity(database, plan)), plan.expectedRevision, ['zenki_planning']);
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
failAgentTaskSkillDiscoveryAttempt(database, attempt, error);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function planChangesCode(plan, taskType) {
|
|
577
|
+
return plan.workPlan.units.some((unit) => unit.routes.includes('code') || unit.routes.includes('ui'))
|
|
578
|
+
|| (taskType !== 'review' && plan.skillRequirements.some((skill) => skill.purposes.includes('implementation')));
|
|
579
|
+
}
|
|
580
|
+
function planHasUi(plan) {
|
|
581
|
+
return plan.workPlan.units.some((unit) => unit.routes.includes('ui'));
|
|
582
|
+
}
|
|
583
|
+
function assertIdealSkillCoverage(snapshot, ideal) {
|
|
584
|
+
const expected = snapshot.contract.skillSet.intakeDiscovery.selected.map((skill) => skill.name);
|
|
585
|
+
if (new Set(expected).size !== expected.length) {
|
|
586
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Akinator-discovered Skill identities are inconsistent');
|
|
587
|
+
}
|
|
588
|
+
const actual = ideal.skillContributions.map((contribution) => contribution.skillName);
|
|
589
|
+
if (actual.length !== expected.length || expected.some((name) => !actual.includes(name))) {
|
|
590
|
+
throw ennoValidationError('ideal_submit', [{
|
|
591
|
+
path: ['ideal', 'skillContributions'],
|
|
592
|
+
reasonCode: actual.length < expected.length ? 'too_few_items' : 'undeclared_skill',
|
|
593
|
+
...(actual.length < expected.length ? { expected: { minItems: expected.length } } : {}),
|
|
594
|
+
}]);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function planCapabilityRecoveryReason(database, input, workspace) {
|
|
598
|
+
if (input.capabilities === undefined)
|
|
599
|
+
return 'environment_information_missing';
|
|
600
|
+
const run = new LedgerStore(database).readRun(input.runId, workspace);
|
|
601
|
+
if (run === undefined)
|
|
602
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Enno ledger run disappeared during plan validation');
|
|
603
|
+
try {
|
|
604
|
+
assertCapabilityCatalogBinding(run.metadata, input.capabilities);
|
|
605
|
+
return null;
|
|
606
|
+
}
|
|
607
|
+
catch (error) {
|
|
608
|
+
if (error instanceof KiokukoError && error.code === 'CONFLICT') {
|
|
609
|
+
return 'environment_changed';
|
|
610
|
+
}
|
|
611
|
+
throw error;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function pausePlanStartRecovery(database, snapshot, reason) {
|
|
615
|
+
withImmediateTransaction(database, () => {
|
|
616
|
+
const updated = database.prepare(`
|
|
617
|
+
UPDATE enno_contracts
|
|
618
|
+
SET blocker = ?, updated_at = ?
|
|
619
|
+
WHERE run_id = ? AND revision = ? AND status = 'zenki_planning'
|
|
620
|
+
RETURNING run_id AS runId
|
|
621
|
+
`).get(planStartRecoveryBlocker(reason), new Date().toISOString(), snapshot.runId, snapshot.revision);
|
|
622
|
+
if (updated?.runId !== snapshot.runId)
|
|
623
|
+
throw new KiokukoError('CONFLICT', 'Enno plan state changed concurrently');
|
|
624
|
+
});
|
|
625
|
+
throw planStartRecoveryError(reason);
|
|
626
|
+
}
|
|
627
|
+
function endedBeforeWorkBecausePlanCatalogWasLost(database, snapshot, capabilities) {
|
|
628
|
+
if (capabilities === undefined
|
|
629
|
+
|| snapshot.status !== 'blocked'
|
|
630
|
+
|| snapshot.blocker?.startsWith('Required Skills unavailable:') !== true
|
|
631
|
+
|| snapshot.workUnits.length === 0
|
|
632
|
+
|| snapshot.workUnits.some((unit) => unit.status !== 'pending'))
|
|
633
|
+
return false;
|
|
634
|
+
const soulEntry = snapshot.contract.skillSet.entries.find((entry) => (entry.name.normalize('NFKC').toLowerCase() === STANDARD_SOUL_SKILL_NAME));
|
|
635
|
+
if (soulEntry?.required !== true || soulEntry.availability !== 'unavailable')
|
|
636
|
+
return false;
|
|
637
|
+
const catalog = normalizeCapabilityCatalog(capabilities);
|
|
638
|
+
if (!catalog.skills.some((skill) => skill.name.normalize('NFKC').toLowerCase() === STANDARD_SOUL_SKILL_NAME)) {
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
const run = new LedgerStore(database).readRun(snapshot.runId, snapshot.workspace);
|
|
642
|
+
if (run === undefined)
|
|
643
|
+
return false;
|
|
644
|
+
try {
|
|
645
|
+
assertCapabilityCatalogBinding(run.metadata, capabilities);
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
catch (error) {
|
|
649
|
+
if (error instanceof KiokukoError && error.code === 'CONFLICT')
|
|
650
|
+
return false;
|
|
651
|
+
throw error;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
export function submitOdunoIdeal(database, rawInput) {
|
|
655
|
+
const parsedInput = parseIdealSubmission(rawInput);
|
|
656
|
+
const before = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
657
|
+
const input = sanitizeIdealSubmission(parsedInput, before.repositoryRoot);
|
|
658
|
+
const operation = operationIdentity('ideal_submit', input.idempotencyKey, input);
|
|
659
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
660
|
+
if (replay !== undefined)
|
|
661
|
+
return replay;
|
|
662
|
+
assertExpected(before, input.expectedRevision, ['oduno_ideal']);
|
|
663
|
+
if (input.advisoryRoundDigest !== undefined) {
|
|
664
|
+
requireAdvisoryRound(database, before, 'ideal', before.mutationRevision, advisoryContextForSubmission(before, 'ideal'), input.advisoryRoundDigest);
|
|
665
|
+
}
|
|
666
|
+
const ideal = input.ideal;
|
|
667
|
+
assertIdealSkillCoverage(before, ideal);
|
|
668
|
+
return withImmediateTransaction(database, () => {
|
|
669
|
+
const replayed = readOperationReceipt(database, input.runId, operation);
|
|
670
|
+
if (replayed !== undefined)
|
|
671
|
+
return replayed;
|
|
672
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
673
|
+
assertExpected(current, input.expectedRevision, ['oduno_ideal']);
|
|
674
|
+
assertIdealSkillCoverage(current, ideal);
|
|
675
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
676
|
+
const advisoryRound = consumeAdvisoryRoundIfPresent(database, current, 'ideal', current.mutationRevision, advisoryContextForSubmission(current, 'ideal'), input.advisoryRoundDigest, input.advisoryDisposition);
|
|
677
|
+
updateContractInTransaction(database, current, {
|
|
678
|
+
contract: current.contract,
|
|
679
|
+
status: 'zenki_planning',
|
|
680
|
+
confirmationState: current.confirmationState,
|
|
681
|
+
ideal,
|
|
682
|
+
});
|
|
683
|
+
appendEnnoEventInTransaction(database, input.runId, 'oduno.ideal_derived', 'enno-oduno', 'derived', {
|
|
684
|
+
contractRevision: current.revision,
|
|
685
|
+
discoveredSkillCount: ideal.skillContributions.length,
|
|
686
|
+
principleCount: ideal.principles.length,
|
|
687
|
+
successSignalCount: ideal.successSignals.length,
|
|
688
|
+
});
|
|
689
|
+
const response = {
|
|
690
|
+
ennoOduno: stateForSnapshot(readEnnoSnapshot(database, identity(database, input))),
|
|
691
|
+
...(advisoryRound === undefined ? {} : { advisoryRound }),
|
|
692
|
+
};
|
|
693
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
694
|
+
return response;
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
export async function submitEnnoPlan(database, rawInput, dependencies = {}) {
|
|
698
|
+
const parsedInput = parsePlanSubmission(rawInput);
|
|
699
|
+
const current = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
700
|
+
const input = sanitizePlanSubmission(parsedInput, current.repositoryRoot);
|
|
701
|
+
if (endedBeforeWorkBecausePlanCatalogWasLost(database, current, input.capabilities)) {
|
|
702
|
+
throw planStartRecoveryError('previous_attempt_ended');
|
|
703
|
+
}
|
|
704
|
+
const operation = operationIdentity('plan_submit', input.idempotencyKey, input);
|
|
705
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
706
|
+
if (replay !== undefined)
|
|
707
|
+
return replay;
|
|
708
|
+
const before = current;
|
|
709
|
+
assertExpected(before, input.expectedRevision, ['zenki_planning']);
|
|
710
|
+
const pendingRecovery = planStartRecoveryReasonFromBlocker(before.blocker);
|
|
711
|
+
if (pendingRecovery === 'environment_information_missing') {
|
|
712
|
+
if (input.recoveryAction === undefined)
|
|
713
|
+
throw planStartRecoveryError(pendingRecovery);
|
|
714
|
+
}
|
|
715
|
+
else if (pendingRecovery !== null) {
|
|
716
|
+
throw planStartRecoveryError(pendingRecovery);
|
|
717
|
+
}
|
|
718
|
+
else if (input.recoveryAction !== undefined) {
|
|
719
|
+
throw new KiokukoError('CONFLICT', 'Enno plan has no pending same-run recovery choice');
|
|
720
|
+
}
|
|
721
|
+
if (input.maxAttempts <= before.attempts) {
|
|
722
|
+
throw ennoValidationError('plan_submit', [{
|
|
723
|
+
path: ['maxAttempts'],
|
|
724
|
+
reasonCode: 'too_few_items',
|
|
725
|
+
expected: { minItems: before.attempts + 1 },
|
|
726
|
+
}]);
|
|
727
|
+
}
|
|
728
|
+
const recoveryReason = planCapabilityRecoveryReason(database, input, before.workspace);
|
|
729
|
+
if (recoveryReason !== null)
|
|
730
|
+
pausePlanStartRecovery(database, before, recoveryReason);
|
|
731
|
+
if (input.advisoryRoundDigest !== undefined) {
|
|
732
|
+
requireAdvisoryRound(database, before, 'planning', before.mutationRevision, advisoryContextForSubmission(before, 'planning'), input.advisoryRoundDigest);
|
|
733
|
+
}
|
|
734
|
+
const includesCodeChanges = planChangesCode(input, before.taskType);
|
|
735
|
+
const includesUiWork = planHasUi(input);
|
|
736
|
+
assertWorkPlanExpertCoverage(input.workPlan);
|
|
737
|
+
assertContractVerifierCwds(before.repositoryRoot, {
|
|
738
|
+
workPlan: input.workPlan,
|
|
739
|
+
finalVerifiers: input.finalVerifiers,
|
|
740
|
+
});
|
|
741
|
+
const zenkiDiscovery = await discoverZenkiSkills(database, before, input, dependencies);
|
|
742
|
+
const requirements = completeRequiredSkillList({
|
|
743
|
+
requested: input.skillRequirements,
|
|
744
|
+
includesCodeChanges,
|
|
745
|
+
includesUiWork,
|
|
746
|
+
});
|
|
747
|
+
const entries = createSkillSetEntries(database, {
|
|
748
|
+
requirements,
|
|
749
|
+
capabilities: input.capabilities,
|
|
750
|
+
discoveries: [before.contract.skillSet.intakeDiscovery, zenkiDiscovery],
|
|
751
|
+
});
|
|
752
|
+
const unavailable = unavailableRequiredSkills(entries);
|
|
753
|
+
const nextRevision = input.expectedRevision + 1;
|
|
754
|
+
const contract = {
|
|
755
|
+
revision: nextRevision,
|
|
756
|
+
scope: [...input.scope],
|
|
757
|
+
exclusions: [...input.exclusions],
|
|
758
|
+
acceptanceCriteria: input.acceptanceCriteria.map((item) => ({ ...item })),
|
|
759
|
+
workPlan: {
|
|
760
|
+
objective: input.workPlan.objective,
|
|
761
|
+
units: input.workPlan.units.map((unit) => ({
|
|
762
|
+
...unit,
|
|
763
|
+
scope: [...unit.scope],
|
|
764
|
+
dependencies: [...unit.dependencies],
|
|
765
|
+
routes: [...unit.routes],
|
|
766
|
+
skillNames: orderedUniqueSkillNames([
|
|
767
|
+
STANDARD_SOUL_SKILL_NAME,
|
|
768
|
+
...(unit.routes.includes('code') || unit.routes.includes('ui') ? [STANDARD_FUNCTION_SKILL_NAME] : []),
|
|
769
|
+
...(unit.routes.includes('ui') ? [STANDARD_UI_SKILL_NAME] : []),
|
|
770
|
+
], unit.skillNames),
|
|
771
|
+
expertRefs: unit.expertRefs.map((reference) => ({ ...reference })),
|
|
772
|
+
acceptanceCriteria: [...unit.acceptanceCriteria],
|
|
773
|
+
focusedVerifiers: unit.focusedVerifiers.map((verifier) => ({ ...verifier, args: [...verifier.args] })),
|
|
774
|
+
})),
|
|
775
|
+
},
|
|
776
|
+
skillSet: {
|
|
777
|
+
entries,
|
|
778
|
+
intakeDiscovery: before.contract.skillSet.intakeDiscovery,
|
|
779
|
+
zenkiDiscovery,
|
|
780
|
+
},
|
|
781
|
+
finalVerifiers: input.finalVerifiers.map((verifier) => ({ ...verifier, args: [...verifier.args] })),
|
|
782
|
+
maxAttempts: input.maxAttempts,
|
|
783
|
+
provenance: { ...input.provenance },
|
|
784
|
+
};
|
|
785
|
+
assertContractVerifierCwds(before.repositoryRoot, contract);
|
|
786
|
+
const needsConfirmation = requiresConfirmation(contract.provenance);
|
|
787
|
+
return withImmediateTransaction(database, () => {
|
|
788
|
+
const replayed = readOperationReceipt(database, input.runId, operation);
|
|
789
|
+
if (replayed !== undefined)
|
|
790
|
+
return replayed;
|
|
791
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
792
|
+
assertExpected(current, input.expectedRevision, ['zenki_planning']);
|
|
793
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
794
|
+
const advisoryRound = consumeAdvisoryRoundIfPresent(database, current, 'planning', current.mutationRevision, advisoryContextForSubmission(current, 'planning'), input.advisoryRoundDigest, input.advisoryDisposition);
|
|
795
|
+
const status = unavailable.length > 0
|
|
796
|
+
? 'blocked'
|
|
797
|
+
: needsConfirmation ? 'needs_confirmation' : 'goki_executing';
|
|
798
|
+
const blocker = unavailable.length === 0
|
|
799
|
+
? null
|
|
800
|
+
: `Required Skills unavailable: ${unavailable.map((skill) => skill.name).join(', ')}`;
|
|
801
|
+
updateContractInTransaction(database, current, {
|
|
802
|
+
contract,
|
|
803
|
+
status,
|
|
804
|
+
confirmationState: needsConfirmation ? 'pending' : 'not_required',
|
|
805
|
+
blocker,
|
|
806
|
+
planDigest: canonicalContentHash(contract.workPlan),
|
|
807
|
+
});
|
|
808
|
+
replaceWorkUnitsInTransaction(database, input.runId, nextRevision, contract.workPlan);
|
|
809
|
+
appendEnnoEventInTransaction(database, input.runId, 'zenki.plan_created', 'zenki', 'created', {
|
|
810
|
+
contractRevision: nextRevision,
|
|
811
|
+
workUnitIds: contract.workPlan.units.map((unit) => unit.id),
|
|
812
|
+
});
|
|
813
|
+
let updated = readEnnoSnapshot(database, identity(database, input));
|
|
814
|
+
let executionLease;
|
|
815
|
+
if (status === 'blocked') {
|
|
816
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.blocked', 'enno-oduno', 'blocked', {
|
|
817
|
+
reason: blocker,
|
|
818
|
+
contractRevision: nextRevision,
|
|
819
|
+
});
|
|
820
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'failed');
|
|
821
|
+
}
|
|
822
|
+
else if (status === 'goki_executing') {
|
|
823
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.plan_confirmed', 'enno-oduno', 'not_required', {
|
|
824
|
+
contractRevision: nextRevision,
|
|
825
|
+
});
|
|
826
|
+
executionLease = startFirstReadyUnit(database, updated);
|
|
827
|
+
updated = readEnnoSnapshot(database, identity(database, input));
|
|
828
|
+
}
|
|
829
|
+
const response = {
|
|
830
|
+
ennoOduno: stateForSnapshot(updated),
|
|
831
|
+
...(advisoryRound === undefined ? {} : { advisoryRound }),
|
|
832
|
+
...(executionLease === undefined ? {} : { executionLease }),
|
|
833
|
+
};
|
|
834
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
835
|
+
return response;
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
export function answerEnno(database, rawInput) {
|
|
839
|
+
const parsedInput = parseEnnoAnswer(rawInput);
|
|
840
|
+
const before = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
841
|
+
const input = sanitizeEnnoAnswer(parsedInput, before.repositoryRoot);
|
|
842
|
+
const operation = operationIdentity('answer', input.idempotencyKey, input);
|
|
843
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
844
|
+
if (replay !== undefined)
|
|
845
|
+
return replay;
|
|
846
|
+
return withImmediateTransaction(database, () => {
|
|
847
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
848
|
+
assertExpected(current, input.expectedRevision, input.action === 'cancel' ? ['needs_confirmation', 'zenki_planning'] : ['needs_confirmation']);
|
|
849
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
850
|
+
let next;
|
|
851
|
+
let executionLease;
|
|
852
|
+
if (input.action === 'approve') {
|
|
853
|
+
updateContractInTransaction(database, current, {
|
|
854
|
+
contract: current.contract,
|
|
855
|
+
status: 'goki_executing',
|
|
856
|
+
confirmationState: 'approved',
|
|
857
|
+
});
|
|
858
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.plan_confirmed', 'enno-oduno', 'approved', {
|
|
859
|
+
contractRevision: current.revision,
|
|
860
|
+
});
|
|
861
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
862
|
+
executionLease = startFirstReadyUnit(database, next);
|
|
863
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
864
|
+
}
|
|
865
|
+
else if (input.action === 'revise') {
|
|
866
|
+
const revisedContract = {
|
|
867
|
+
...current.contract,
|
|
868
|
+
revision: current.revision + 1,
|
|
869
|
+
};
|
|
870
|
+
updateContractInTransaction(database, current, {
|
|
871
|
+
contract: revisedContract,
|
|
872
|
+
status: 'zenki_planning',
|
|
873
|
+
confirmationState: 'revision_requested',
|
|
874
|
+
blocker: input.requestedChanges ?? null,
|
|
875
|
+
});
|
|
876
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
updateContractInTransaction(database, current, {
|
|
880
|
+
contract: current.contract,
|
|
881
|
+
status: 'cancelled',
|
|
882
|
+
confirmationState: 'cancelled',
|
|
883
|
+
});
|
|
884
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.cancelled', 'enno-oduno', 'cancelled', {
|
|
885
|
+
contractRevision: current.revision,
|
|
886
|
+
});
|
|
887
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'cancelled');
|
|
888
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
889
|
+
}
|
|
890
|
+
const response = {
|
|
891
|
+
ennoOduno: stateForSnapshot(next),
|
|
892
|
+
...(executionLease === undefined ? {} : { executionLease }),
|
|
893
|
+
};
|
|
894
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
895
|
+
return response;
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
function sanitizedVerifierResults(results, repositoryRoot) {
|
|
899
|
+
return results.map((result) => {
|
|
900
|
+
const sanitized = sanitizeJson({
|
|
901
|
+
stdoutPreview: result.stdoutPreview,
|
|
902
|
+
stderrPreview: result.stderrPreview,
|
|
903
|
+
}, { workspace: repositoryRoot }).value;
|
|
904
|
+
return {
|
|
905
|
+
...result,
|
|
906
|
+
stdoutPreview: sanitized.stdoutPreview,
|
|
907
|
+
stderrPreview: sanitized.stderrPreview,
|
|
908
|
+
};
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
function spawnFailedVerifierResults(verifiers) {
|
|
912
|
+
const emptyDigest = createHash('sha256').digest('hex');
|
|
913
|
+
return verifiers.map((verifier) => ({
|
|
914
|
+
verifier: { ...verifier, args: [...verifier.args] },
|
|
915
|
+
status: 'spawn_failed',
|
|
916
|
+
exitCode: null,
|
|
917
|
+
signal: null,
|
|
918
|
+
durationMs: 0,
|
|
919
|
+
stdoutPreview: '',
|
|
920
|
+
stderrPreview: '',
|
|
921
|
+
stdoutDigest: emptyDigest,
|
|
922
|
+
stderrDigest: emptyDigest,
|
|
923
|
+
}));
|
|
924
|
+
}
|
|
925
|
+
function finalReviewFeedback(revision, reviewSummary, results) {
|
|
926
|
+
const failed = results.filter((result) => result.status !== 'passed');
|
|
927
|
+
const evidence = failed.length === 0
|
|
928
|
+
? 'all final verifiers passed'
|
|
929
|
+
: failed.map((result) => {
|
|
930
|
+
const exit = result.exitCode === null ? '' : `,exit=${result.exitCode}`;
|
|
931
|
+
return `${result.verifier.id}=${result.status}${exit}`;
|
|
932
|
+
}).join('; ');
|
|
933
|
+
return `Enno-Oduno review rejected contract revision ${revision}: ${reviewSummary}. Verifier evidence: ${evidence}. Zenki must revise the WorkPlan; Goki must not resume the rejected plan.`
|
|
934
|
+
.slice(0, 16_384);
|
|
935
|
+
}
|
|
936
|
+
function sanitizedReviewSummary(summary, repositoryRoot) {
|
|
937
|
+
return sanitizeJson({ summary }, { workspace: repositoryRoot }).value.summary;
|
|
938
|
+
}
|
|
939
|
+
function blockedForAttemptLimit(database, snapshot, operation) {
|
|
940
|
+
const operationOwner = startOperationInTransaction(database, snapshot.runId, operation);
|
|
941
|
+
const activeUnit = snapshot.workUnits.find((candidate) => candidate.status === 'in_progress');
|
|
942
|
+
if (activeUnit !== undefined) {
|
|
943
|
+
setWorkUnitStatusInTransaction(database, {
|
|
944
|
+
runId: snapshot.runId,
|
|
945
|
+
contractRevision: snapshot.revision,
|
|
946
|
+
workUnitId: activeUnit.workUnit.id,
|
|
947
|
+
from: 'in_progress',
|
|
948
|
+
to: 'blocked',
|
|
949
|
+
attemptCount: activeUnit.attemptCount,
|
|
950
|
+
result: activeUnit.result,
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
releaseExecutionLeaseInTransaction(database, snapshot.runId);
|
|
954
|
+
updateContractInTransaction(database, snapshot, {
|
|
955
|
+
contract: snapshot.contract,
|
|
956
|
+
status: 'blocked',
|
|
957
|
+
confirmationState: snapshot.confirmationState,
|
|
958
|
+
blocker: 'Enno attempt limit reached',
|
|
959
|
+
});
|
|
960
|
+
appendEnnoEventInTransaction(database, snapshot.runId, 'enno.blocked', 'enno-oduno', 'blocked', {
|
|
961
|
+
reason: 'attempt_limit',
|
|
962
|
+
attempts: snapshot.attempts,
|
|
963
|
+
});
|
|
964
|
+
terminalizeLedgerRunInTransaction(database, snapshot.runId, 'failed');
|
|
965
|
+
const response = { ennoOduno: stateForSnapshot(readEnnoSnapshot(database, {
|
|
966
|
+
runId: snapshot.runId,
|
|
967
|
+
workspace: snapshot.workspace,
|
|
968
|
+
orchestrationId: snapshot.orchestrationId,
|
|
969
|
+
})) };
|
|
970
|
+
completeOperationInTransaction(database, snapshot.runId, operation, operationOwner, response);
|
|
971
|
+
return response;
|
|
972
|
+
}
|
|
973
|
+
export async function reportEnnoWork(database, rawInput, dependencies = {}) {
|
|
974
|
+
const parsedInput = parseWorkReport(rawInput);
|
|
975
|
+
const initial = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
976
|
+
const input = sanitizeWorkReport(parsedInput, initial.repositoryRoot);
|
|
977
|
+
const operation = operationIdentity('work_report', input.idempotencyKey, input);
|
|
978
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
979
|
+
if (replay !== undefined)
|
|
980
|
+
return replay;
|
|
981
|
+
const before = initial;
|
|
982
|
+
assertExpected(before, input.expectedRevision, ['goki_executing']);
|
|
983
|
+
const unit = before.workUnits.find((candidate) => candidate.workUnit.id === input.workUnitId);
|
|
984
|
+
if (unit === undefined || unit.status !== 'in_progress')
|
|
985
|
+
throw new KiokukoError('CONFLICT', 'Reported Enno WorkUnit is not active');
|
|
986
|
+
if (before.attempts >= before.contract.maxAttempts) {
|
|
987
|
+
return withImmediateTransaction(database, () => {
|
|
988
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
989
|
+
assertExpected(current, input.expectedRevision, ['goki_executing']);
|
|
990
|
+
assertExecutionLeaseInTransaction(database, current, input);
|
|
991
|
+
return blockedForAttemptLimit(database, current, operation);
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
if (input.result.outcome !== 'completed') {
|
|
995
|
+
return withImmediateTransaction(database, () => {
|
|
996
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
997
|
+
assertExpected(current, input.expectedRevision, ['goki_executing']);
|
|
998
|
+
assertExecutionLeaseInTransaction(database, current, input);
|
|
999
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
1000
|
+
const currentUnit = current.workUnits.find((candidate) => candidate.workUnit.id === input.workUnitId);
|
|
1001
|
+
const attempts = current.attempts + 1;
|
|
1002
|
+
const mustBlock = input.result.outcome === 'blocked' || attempts >= current.contract.maxAttempts;
|
|
1003
|
+
setWorkUnitStatusInTransaction(database, {
|
|
1004
|
+
runId: input.runId,
|
|
1005
|
+
contractRevision: current.revision,
|
|
1006
|
+
workUnitId: input.workUnitId,
|
|
1007
|
+
from: 'in_progress',
|
|
1008
|
+
to: mustBlock ? 'blocked' : 'in_progress',
|
|
1009
|
+
attemptCount: currentUnit.attemptCount + 1,
|
|
1010
|
+
result: input.result,
|
|
1011
|
+
});
|
|
1012
|
+
updateContractInTransaction(database, current, {
|
|
1013
|
+
contract: current.contract,
|
|
1014
|
+
status: mustBlock ? 'blocked' : 'goki_executing',
|
|
1015
|
+
confirmationState: current.confirmationState,
|
|
1016
|
+
attempts,
|
|
1017
|
+
blocker: mustBlock ? input.result.summary : null,
|
|
1018
|
+
});
|
|
1019
|
+
appendEnnoEventInTransaction(database, input.runId, 'goki.work_failed', 'goki', input.result.outcome, {
|
|
1020
|
+
workUnitId: input.workUnitId,
|
|
1021
|
+
attempt: attempts,
|
|
1022
|
+
});
|
|
1023
|
+
if (mustBlock) {
|
|
1024
|
+
releaseExecutionLeaseInTransaction(database, input.runId);
|
|
1025
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.blocked', 'enno-oduno', 'blocked', {
|
|
1026
|
+
reason: input.result.summary,
|
|
1027
|
+
});
|
|
1028
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'failed');
|
|
1029
|
+
}
|
|
1030
|
+
const response = { ennoOduno: stateForSnapshot(readEnnoSnapshot(database, identity(database, input))) };
|
|
1031
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
1032
|
+
return response;
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
let verifierRunIds = [];
|
|
1036
|
+
let operationOwner = '';
|
|
1037
|
+
const verifierLeaseMs = operationLeaseMsForVerifiers(unit.workUnit.focusedVerifiers);
|
|
1038
|
+
withImmediateTransaction(database, () => {
|
|
1039
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1040
|
+
assertExpected(current, input.expectedRevision, ['goki_executing']);
|
|
1041
|
+
renewExecutionLeaseInTransaction(database, current, input, verifierLeaseMs);
|
|
1042
|
+
operationOwner = startOperationInTransaction(database, input.runId, operation, verifierLeaseMs);
|
|
1043
|
+
const currentUnit = current.workUnits.find((candidate) => candidate.workUnit.id === input.workUnitId);
|
|
1044
|
+
if (currentUnit === undefined || currentUnit.status !== 'in_progress') {
|
|
1045
|
+
throw new KiokukoError('CONFLICT', 'Reported Enno WorkUnit changed concurrently');
|
|
1046
|
+
}
|
|
1047
|
+
verifierRunIds = startVerifierRunsInTransaction(database, {
|
|
1048
|
+
runId: input.runId,
|
|
1049
|
+
workUnitId: input.workUnitId,
|
|
1050
|
+
revision: current.revision,
|
|
1051
|
+
mutationRevision: current.mutationRevision + (input.result.mutated ? 1 : 0),
|
|
1052
|
+
verifiers: currentUnit.workUnit.focusedVerifiers,
|
|
1053
|
+
});
|
|
1054
|
+
});
|
|
1055
|
+
let rawResults;
|
|
1056
|
+
try {
|
|
1057
|
+
rawResults = await runVerifiers(unit.workUnit.focusedVerifiers, before.repositoryRoot, dependencies);
|
|
1058
|
+
}
|
|
1059
|
+
catch {
|
|
1060
|
+
rawResults = spawnFailedVerifierResults(unit.workUnit.focusedVerifiers);
|
|
1061
|
+
}
|
|
1062
|
+
const results = sanitizedVerifierResults(rawResults, before.repositoryRoot);
|
|
1063
|
+
return withImmediateTransaction(database, () => {
|
|
1064
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1065
|
+
assertExpected(current, input.expectedRevision, ['goki_executing']);
|
|
1066
|
+
assertExecutionLeaseInTransaction(database, current, input);
|
|
1067
|
+
finishVerifierRunsInTransaction(database, verifierRunIds, results);
|
|
1068
|
+
const passed = results.every((result) => result.status === 'passed');
|
|
1069
|
+
const unsafe = results.some((result) => result.status === 'spawn_failed');
|
|
1070
|
+
const attempts = current.attempts + 1;
|
|
1071
|
+
const mustBlock = unsafe || (!passed && attempts >= current.contract.maxAttempts);
|
|
1072
|
+
const currentUnit = current.workUnits.find((candidate) => candidate.workUnit.id === input.workUnitId);
|
|
1073
|
+
setWorkUnitStatusInTransaction(database, {
|
|
1074
|
+
runId: input.runId,
|
|
1075
|
+
contractRevision: current.revision,
|
|
1076
|
+
workUnitId: input.workUnitId,
|
|
1077
|
+
from: 'in_progress',
|
|
1078
|
+
to: passed ? 'completed' : mustBlock ? 'blocked' : 'in_progress',
|
|
1079
|
+
attemptCount: currentUnit.attemptCount + 1,
|
|
1080
|
+
result: input.result,
|
|
1081
|
+
});
|
|
1082
|
+
updateContractInTransaction(database, current, {
|
|
1083
|
+
contract: current.contract,
|
|
1084
|
+
status: mustBlock ? 'blocked' : 'goki_executing',
|
|
1085
|
+
confirmationState: current.confirmationState,
|
|
1086
|
+
attempts,
|
|
1087
|
+
mutationRevision: current.mutationRevision + (input.result.mutated ? 1 : 0),
|
|
1088
|
+
blocker: mustBlock
|
|
1089
|
+
? unsafe ? 'Focused verifier could not be started safely' : 'Focused verification failed at the attempt limit'
|
|
1090
|
+
: null,
|
|
1091
|
+
});
|
|
1092
|
+
appendEnnoEventInTransaction(database, input.runId, passed ? 'goki.work_completed' : 'goki.work_failed', 'goki', passed ? 'completed' : 'verification_failed', {
|
|
1093
|
+
workUnitId: input.workUnitId,
|
|
1094
|
+
mutated: input.result.mutated,
|
|
1095
|
+
changedPaths: input.result.changedPaths,
|
|
1096
|
+
});
|
|
1097
|
+
releaseExecutionLeaseInTransaction(database, input.runId);
|
|
1098
|
+
let next = readEnnoSnapshot(database, identity(database, input));
|
|
1099
|
+
let executionLease;
|
|
1100
|
+
if (mustBlock) {
|
|
1101
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.blocked', 'enno-oduno', 'blocked', {
|
|
1102
|
+
reason: unsafe ? 'spawn_failed' : 'focused_verification_failed',
|
|
1103
|
+
});
|
|
1104
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'failed');
|
|
1105
|
+
}
|
|
1106
|
+
else if (passed) {
|
|
1107
|
+
if (next.workUnits.every((candidate) => candidate.status === 'completed')) {
|
|
1108
|
+
updateContractInTransaction(database, next, {
|
|
1109
|
+
contract: next.contract,
|
|
1110
|
+
status: 'enno_verifying',
|
|
1111
|
+
confirmationState: next.confirmationState,
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
executionLease = startFirstReadyUnit(database, next);
|
|
1116
|
+
}
|
|
1117
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
1118
|
+
}
|
|
1119
|
+
const response = {
|
|
1120
|
+
ennoOduno: stateForSnapshot(next),
|
|
1121
|
+
verifierResults: results,
|
|
1122
|
+
...(executionLease === undefined ? {} : { executionLease }),
|
|
1123
|
+
};
|
|
1124
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
1125
|
+
return response;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
export async function prepareEnnoVerification(database, rawInput, dependencies = {}) {
|
|
1129
|
+
const input = parseVerificationPrepare(rawInput);
|
|
1130
|
+
const before = readEnnoSnapshot(database, identity(database, input));
|
|
1131
|
+
const operation = operationIdentity('verify_prepare', input.idempotencyKey, input);
|
|
1132
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
1133
|
+
if (replay !== undefined)
|
|
1134
|
+
return replay;
|
|
1135
|
+
assertExpected(before, input.expectedRevision, ['enno_verifying']);
|
|
1136
|
+
const preRepositoryState = captureRepositoryState(before.repositoryRoot);
|
|
1137
|
+
const verifierSpecDigest = canonicalContentHash(before.contract.finalVerifiers);
|
|
1138
|
+
if (before.attempts >= before.contract.maxAttempts) {
|
|
1139
|
+
return withImmediateTransaction(database, () => blockedForAttemptLimit(database, readEnnoSnapshot(database, identity(database, input)), operation));
|
|
1140
|
+
}
|
|
1141
|
+
let verifierRunIds = [];
|
|
1142
|
+
let operationOwner = '';
|
|
1143
|
+
let cachedResults;
|
|
1144
|
+
const verifierLeaseMs = operationLeaseMsForVerifiers(before.contract.finalVerifiers);
|
|
1145
|
+
withImmediateTransaction(database, () => {
|
|
1146
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1147
|
+
assertExpected(current, input.expectedRevision, ['enno_verifying']);
|
|
1148
|
+
operationOwner = startOperationInTransaction(database, input.runId, operation, verifierLeaseMs);
|
|
1149
|
+
cachedResults = readFreshFinalVerifierResults(database, {
|
|
1150
|
+
runId: input.runId,
|
|
1151
|
+
revision: current.revision,
|
|
1152
|
+
mutationRevision: current.mutationRevision,
|
|
1153
|
+
verifiers: current.contract.finalVerifiers,
|
|
1154
|
+
repositoryDigest: preRepositoryState.digest,
|
|
1155
|
+
});
|
|
1156
|
+
if (cachedResults === undefined) {
|
|
1157
|
+
verifierRunIds = startVerifierRunsInTransaction(database, {
|
|
1158
|
+
runId: input.runId,
|
|
1159
|
+
workUnitId: null,
|
|
1160
|
+
revision: current.revision,
|
|
1161
|
+
mutationRevision: current.mutationRevision,
|
|
1162
|
+
verifiers: current.contract.finalVerifiers,
|
|
1163
|
+
repositoryEvidence: {
|
|
1164
|
+
policyVersion: preRepositoryState.policyVersion,
|
|
1165
|
+
preDigest: preRepositoryState.digest,
|
|
1166
|
+
verifierSpecDigest,
|
|
1167
|
+
},
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.verification_started', 'enno-oduno', cachedResults === undefined ? 'started' : 'reused', {
|
|
1171
|
+
contractRevision: current.revision,
|
|
1172
|
+
mutationRevision: current.mutationRevision,
|
|
1173
|
+
verifierIds: current.contract.finalVerifiers.map((verifier) => verifier.id),
|
|
1174
|
+
});
|
|
1175
|
+
});
|
|
1176
|
+
let results;
|
|
1177
|
+
if (cachedResults !== undefined) {
|
|
1178
|
+
results = cachedResults;
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
try {
|
|
1182
|
+
results = sanitizedVerifierResults(await runVerifiers(before.contract.finalVerifiers, before.repositoryRoot, dependencies), before.repositoryRoot);
|
|
1183
|
+
}
|
|
1184
|
+
catch {
|
|
1185
|
+
results = spawnFailedVerifierResults(before.contract.finalVerifiers);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
const postRepositoryState = captureRepositoryState(before.repositoryRoot);
|
|
1189
|
+
const changedDuringVerification = postRepositoryState.digest !== preRepositoryState.digest
|
|
1190
|
+
|| results.some((result) => result.changedDuringVerification === true);
|
|
1191
|
+
results = results.map((result) => ({
|
|
1192
|
+
...result,
|
|
1193
|
+
repositoryStatePolicyVersion: postRepositoryState.policyVersion,
|
|
1194
|
+
repositoryStateDigest: postRepositoryState.digest,
|
|
1195
|
+
changedDuringVerification,
|
|
1196
|
+
}));
|
|
1197
|
+
return withImmediateTransaction(database, () => {
|
|
1198
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1199
|
+
assertExpected(current, input.expectedRevision, ['enno_verifying']);
|
|
1200
|
+
if (verifierRunIds.length > 0)
|
|
1201
|
+
finishVerifierRunsInTransaction(database, verifierRunIds, results, {
|
|
1202
|
+
postDigest: postRepositoryState.digest,
|
|
1203
|
+
changedDuringVerification,
|
|
1204
|
+
});
|
|
1205
|
+
const response = {
|
|
1206
|
+
ennoOduno: stateForSnapshot(readEnnoSnapshot(database, identity(database, input))),
|
|
1207
|
+
verifierResults: results,
|
|
1208
|
+
};
|
|
1209
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
1210
|
+
return response;
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
export async function finishEnno(database, rawInput, dependencies = {}) {
|
|
1214
|
+
const parsedInput = parseFinishRequest(rawInput);
|
|
1215
|
+
const initial = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
1216
|
+
const input = sanitizeFinishRequest(parsedInput, initial.repositoryRoot);
|
|
1217
|
+
const operation = operationIdentity('finish', input.idempotencyKey, input);
|
|
1218
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
1219
|
+
if (replay !== undefined)
|
|
1220
|
+
return replay;
|
|
1221
|
+
const before = initial;
|
|
1222
|
+
assertExpected(before, input.expectedRevision, ['enno_verifying']);
|
|
1223
|
+
if (input.advisoryRoundDigest !== undefined) {
|
|
1224
|
+
if (!before.finalEvidenceReady) {
|
|
1225
|
+
throw ennoValidationError('finish', [{
|
|
1226
|
+
path: ['advisoryRoundDigest'],
|
|
1227
|
+
reasonCode: 'advisory_digest_stale',
|
|
1228
|
+
}], 'refresh_state');
|
|
1229
|
+
}
|
|
1230
|
+
requireAdvisoryRound(database, before, 'final_review', before.mutationRevision, advisoryContextForSubmission(before, 'final_review'), input.advisoryRoundDigest);
|
|
1231
|
+
}
|
|
1232
|
+
const reviewSummary = sanitizedReviewSummary(input.review.summary, before.repositoryRoot);
|
|
1233
|
+
if (before.attempts >= before.contract.maxAttempts) {
|
|
1234
|
+
return withImmediateTransaction(database, () => blockedForAttemptLimit(database, readEnnoSnapshot(database, identity(database, input)), operation));
|
|
1235
|
+
}
|
|
1236
|
+
return withImmediateTransaction(database, () => {
|
|
1237
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1238
|
+
assertExpected(current, input.expectedRevision, ['enno_verifying']);
|
|
1239
|
+
const currentRepositoryDigest = captureRepositoryState(current.repositoryRoot).digest;
|
|
1240
|
+
const results = readFreshFinalVerifierResults(database, {
|
|
1241
|
+
runId: input.runId,
|
|
1242
|
+
revision: current.revision,
|
|
1243
|
+
mutationRevision: current.mutationRevision,
|
|
1244
|
+
verifiers: current.contract.finalVerifiers,
|
|
1245
|
+
repositoryDigest: currentRepositoryDigest,
|
|
1246
|
+
});
|
|
1247
|
+
if (results === undefined) {
|
|
1248
|
+
throw new KiokukoError('CONFLICT', 'Final verification evidence is not prepared; call enno_verify_prepare first');
|
|
1249
|
+
}
|
|
1250
|
+
if (results.some((result) => result.repositoryStateDigest !== currentRepositoryDigest
|
|
1251
|
+
|| result.changedDuringVerification !== false)) {
|
|
1252
|
+
throw new KiokukoError('CONFLICT', 'Final verification evidence is stale for the current repository state');
|
|
1253
|
+
}
|
|
1254
|
+
const advisoryRound = consumeAdvisoryRoundIfPresent(database, current, 'final_review', current.mutationRevision, input.advisoryRoundDigest === undefined ? undefined : advisoryContextForSubmission(current, 'final_review'), input.advisoryRoundDigest, input.advisoryDisposition);
|
|
1255
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
1256
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.review_started', 'enno-oduno', 'started', {
|
|
1257
|
+
contractRevision: current.revision,
|
|
1258
|
+
mutationRevision: current.mutationRevision,
|
|
1259
|
+
requestedDecision: input.review.decision,
|
|
1260
|
+
});
|
|
1261
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.verification_started', 'enno-oduno', 'reused', {
|
|
1262
|
+
contractRevision: current.revision,
|
|
1263
|
+
mutationRevision: current.mutationRevision,
|
|
1264
|
+
verifierIds: current.contract.finalVerifiers.map((verifier) => verifier.id),
|
|
1265
|
+
});
|
|
1266
|
+
const passed = results.length > 0 && results.every((result) => result.status === 'passed');
|
|
1267
|
+
const unsafe = results.some((result) => result.status === 'spawn_failed');
|
|
1268
|
+
const attempts = current.attempts + 1;
|
|
1269
|
+
const accepted = passed && input.review.decision === 'accept';
|
|
1270
|
+
const completesLegacyRun = accepted && current.ideal === null;
|
|
1271
|
+
const mustBlock = unsafe || (!accepted && attempts >= current.contract.maxAttempts);
|
|
1272
|
+
const reviewFeedback = accepted || mustBlock
|
|
1273
|
+
? null
|
|
1274
|
+
: finalReviewFeedback(current.revision, reviewSummary, results);
|
|
1275
|
+
const nextContract = reviewFeedback === null
|
|
1276
|
+
? current.contract
|
|
1277
|
+
: { ...current.contract, revision: current.revision + 1 };
|
|
1278
|
+
const blockedReason = unsafe
|
|
1279
|
+
? 'Final verifier could not be started safely'
|
|
1280
|
+
: input.review.decision === 'replan' && passed
|
|
1281
|
+
? 'Enno review requested replanning at the attempt limit'
|
|
1282
|
+
: 'Final verification reached the attempt limit';
|
|
1283
|
+
updateContractInTransaction(database, current, {
|
|
1284
|
+
contract: nextContract,
|
|
1285
|
+
status: accepted
|
|
1286
|
+
? completesLegacyRun ? 'completed' : 'oduno_meditation'
|
|
1287
|
+
: mustBlock ? 'blocked' : 'zenki_planning',
|
|
1288
|
+
confirmationState: reviewFeedback === null ? current.confirmationState : 'revision_requested',
|
|
1289
|
+
attempts,
|
|
1290
|
+
blocker: mustBlock ? blockedReason : reviewFeedback,
|
|
1291
|
+
});
|
|
1292
|
+
appendEnnoEventInTransaction(database, input.runId, passed ? 'enno.verification_passed' : 'enno.verification_failed', 'enno-oduno', passed ? 'passed' : 'failed', {
|
|
1293
|
+
contractRevision: current.revision,
|
|
1294
|
+
mutationRevision: current.mutationRevision,
|
|
1295
|
+
statuses: results.map((result) => ({ verifierId: result.verifier.id, status: result.status })),
|
|
1296
|
+
});
|
|
1297
|
+
let next = readEnnoSnapshot(database, identity(database, input));
|
|
1298
|
+
if (accepted) {
|
|
1299
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.review_accepted', 'enno-oduno', 'accepted', {
|
|
1300
|
+
contractRevision: current.revision,
|
|
1301
|
+
mutationRevision: current.mutationRevision,
|
|
1302
|
+
summary: reviewSummary,
|
|
1303
|
+
});
|
|
1304
|
+
if (completesLegacyRun) {
|
|
1305
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.completed', 'enno-oduno', 'completed', {
|
|
1306
|
+
contractRevision: current.revision,
|
|
1307
|
+
mutationRevision: current.mutationRevision,
|
|
1308
|
+
compatibility: 'pre_oduno_ideal_run',
|
|
1309
|
+
});
|
|
1310
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'completed');
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
else if (mustBlock) {
|
|
1314
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.blocked', 'enno-oduno', 'blocked', {
|
|
1315
|
+
reason: unsafe ? 'spawn_failed' : 'attempt_limit',
|
|
1316
|
+
});
|
|
1317
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'failed');
|
|
1318
|
+
}
|
|
1319
|
+
else {
|
|
1320
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.replan_requested', 'enno-oduno', 'requested', {
|
|
1321
|
+
fromContractRevision: current.revision,
|
|
1322
|
+
toContractRevision: next.revision,
|
|
1323
|
+
reason: reviewFeedback,
|
|
1324
|
+
});
|
|
1325
|
+
next = readEnnoSnapshot(database, identity(database, input));
|
|
1326
|
+
}
|
|
1327
|
+
const response = {
|
|
1328
|
+
ennoOduno: stateForSnapshot(next),
|
|
1329
|
+
verifierResults: results,
|
|
1330
|
+
...(advisoryRound === undefined ? {} : { advisoryRound }),
|
|
1331
|
+
};
|
|
1332
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
1333
|
+
return response;
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
export function submitOdunoMeditation(database, rawInput) {
|
|
1337
|
+
const parsedInput = parseMeditationSubmission(rawInput);
|
|
1338
|
+
const before = readEnnoSnapshot(database, identity(database, parsedInput));
|
|
1339
|
+
const input = sanitizeMeditationSubmission(parsedInput, before.repositoryRoot);
|
|
1340
|
+
const operation = operationIdentity('meditation_submit', input.idempotencyKey, input);
|
|
1341
|
+
const replay = readOperationReceipt(database, input.runId, operation);
|
|
1342
|
+
if (replay !== undefined)
|
|
1343
|
+
return replay;
|
|
1344
|
+
assertExpected(before, input.expectedRevision, ['oduno_meditation']);
|
|
1345
|
+
if (before.ideal === null)
|
|
1346
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Oduno meditation requires a persisted ideal');
|
|
1347
|
+
const meditation = input.meditation;
|
|
1348
|
+
return withImmediateTransaction(database, () => {
|
|
1349
|
+
const replayed = readOperationReceipt(database, input.runId, operation);
|
|
1350
|
+
if (replayed !== undefined)
|
|
1351
|
+
return replayed;
|
|
1352
|
+
const current = readEnnoSnapshot(database, identity(database, input));
|
|
1353
|
+
assertExpected(current, input.expectedRevision, ['oduno_meditation']);
|
|
1354
|
+
if (current.ideal === null)
|
|
1355
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Oduno meditation requires a persisted ideal');
|
|
1356
|
+
const operationOwner = startOperationInTransaction(database, input.runId, operation);
|
|
1357
|
+
updateContractInTransaction(database, current, {
|
|
1358
|
+
contract: current.contract,
|
|
1359
|
+
status: 'completed',
|
|
1360
|
+
confirmationState: current.confirmationState,
|
|
1361
|
+
meditation,
|
|
1362
|
+
});
|
|
1363
|
+
appendEnnoEventInTransaction(database, input.runId, 'oduno.meditation_completed', 'enno-oduno', 'completed', {
|
|
1364
|
+
contractRevision: current.revision,
|
|
1365
|
+
mutationRevision: current.mutationRevision,
|
|
1366
|
+
inspectedPathCount: meditation.inspectedPaths.length,
|
|
1367
|
+
deletionCandidateCount: meditation.deletionCandidates.length,
|
|
1368
|
+
});
|
|
1369
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.completed', 'enno-oduno', 'completed', {
|
|
1370
|
+
contractRevision: current.revision,
|
|
1371
|
+
mutationRevision: current.mutationRevision,
|
|
1372
|
+
});
|
|
1373
|
+
terminalizeLedgerRunInTransaction(database, input.runId, 'completed');
|
|
1374
|
+
const response = { ennoOduno: stateForSnapshot(readEnnoSnapshot(database, identity(database, input))) };
|
|
1375
|
+
completeOperationInTransaction(database, input.runId, operation, operationOwner, response);
|
|
1376
|
+
return response;
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
//# sourceMappingURL=service.js.map
|