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,712 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { withImmediateTransaction } from '../db/transaction.js';
|
|
4
|
+
import { KiokukoError } from '../errors.js';
|
|
5
|
+
import { LedgerStore } from '../ledger/store.js';
|
|
6
|
+
import { canonicalContentHash, canonicalJson } from '../serialization/validate.js';
|
|
7
|
+
import { parseStrictJson } from '../setup/strict-json.js';
|
|
8
|
+
import { parseEnnoContract, parseEnnoRequestHandoff, parseOdunoIdeal, parseOdunoMeditation, parseVerifierSpec, parseWorkReportResult, parseWorkPlan, } from './schemas.js';
|
|
9
|
+
import { ADVISORY_OUTCOMES, ENNO_DEFAULT_MAX_ATTEMPTS, ENNO_APPLICABLE_TASK_TYPES, ENNO_CLIENT_KINDS, ENNO_STATUSES, } from './types.js';
|
|
10
|
+
import { advisoryContextForSnapshot, advisoryInputDigest, advisoryPhaseForStatus, advisorySlotDefinitions, } from './advisory.js';
|
|
11
|
+
import { captureRepositoryState } from './repository-state.js';
|
|
12
|
+
function advisoryPhaseState(database, input) {
|
|
13
|
+
const phase = advisoryPhaseForStatus(input.status);
|
|
14
|
+
if (phase === null || (phase === 'final_review' && !input.finalEvidenceReady))
|
|
15
|
+
return { state: 'not_started' };
|
|
16
|
+
const row = database.prepare(`
|
|
17
|
+
SELECT input_digest AS inputDigest, state
|
|
18
|
+
FROM enno_advisory_rounds
|
|
19
|
+
WHERE run_id = ? AND contract_revision = ? AND mutation_revision = ? AND phase = ?
|
|
20
|
+
ORDER BY created_at DESC, round_id DESC
|
|
21
|
+
LIMIT 1
|
|
22
|
+
`).get(input.runId, input.revision, input.mutationRevision, phase);
|
|
23
|
+
if (row === undefined || row.inputDigest !== input.currentInputDigest) {
|
|
24
|
+
return { state: 'fanout_requested', slots: advisorySlotDefinitions(phase) };
|
|
25
|
+
}
|
|
26
|
+
if (row.state === 'consumed')
|
|
27
|
+
return { state: 'consumed', inputDigest: row.inputDigest };
|
|
28
|
+
if (row.state !== 'aggregated')
|
|
29
|
+
return integrity('Stored advisory lifecycle state is invalid');
|
|
30
|
+
const contributions = database.prepare(`
|
|
31
|
+
SELECT c.slot_id AS slotId, c.outcome
|
|
32
|
+
FROM enno_advisory_contributions AS c
|
|
33
|
+
JOIN enno_advisory_rounds AS r ON r.round_id = c.round_id
|
|
34
|
+
WHERE r.run_id = ? AND r.contract_revision = ? AND r.mutation_revision = ?
|
|
35
|
+
AND r.phase = ? AND r.input_digest = ?
|
|
36
|
+
ORDER BY c.slot_rank
|
|
37
|
+
`).all(input.runId, input.revision, input.mutationRevision, phase, row.inputDigest);
|
|
38
|
+
const slots = advisorySlotDefinitions(phase);
|
|
39
|
+
if (contributions.length !== slots.length)
|
|
40
|
+
return integrity('Stored advisory lifecycle contributions are invalid');
|
|
41
|
+
return {
|
|
42
|
+
state: 'aggregated',
|
|
43
|
+
inputDigest: row.inputDigest,
|
|
44
|
+
requiredDispositionSlots: slots.map((slot, index) => {
|
|
45
|
+
const contribution = contributions[index];
|
|
46
|
+
if (contribution?.slotId !== slot.slotId || !ADVISORY_OUTCOMES.includes(contribution.outcome)) {
|
|
47
|
+
return integrity('Stored advisory lifecycle contributions are invalid');
|
|
48
|
+
}
|
|
49
|
+
const outcome = contribution.outcome;
|
|
50
|
+
return {
|
|
51
|
+
slotId: slot.slotId,
|
|
52
|
+
outcome,
|
|
53
|
+
allowedDispositions: outcome === 'completed'
|
|
54
|
+
? ['adopted', 'not_adopted']
|
|
55
|
+
: ['unavailable'],
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function resolveEnnoIdentity(database, input) {
|
|
61
|
+
if (input.workspace !== undefined && input.orchestrationId !== undefined && input.resumeToken === undefined) {
|
|
62
|
+
return { runId: input.runId, workspace: input.workspace, orchestrationId: input.orchestrationId };
|
|
63
|
+
}
|
|
64
|
+
if (input.resumeToken === undefined || input.workspace !== undefined || input.orchestrationId !== undefined) {
|
|
65
|
+
throw new KiokukoError('VALIDATION_ERROR', 'Enno identity requires either explicit identity or one resume token');
|
|
66
|
+
}
|
|
67
|
+
const tokenHash = createHash('sha256').update(input.resumeToken, 'utf8').digest('hex');
|
|
68
|
+
const row = database.prepare(`
|
|
69
|
+
SELECT ec.run_id AS runId, ec.workspace, ec.orchestration_session_id AS orchestrationId,
|
|
70
|
+
ec.route_epoch AS routeEpoch, rt.route_epoch AS tokenRouteEpoch,
|
|
71
|
+
rt.repository_root AS tokenRepositoryRoot, ec.repository_root AS repositoryRoot,
|
|
72
|
+
rt.client_kind AS tokenClientKind, ec.client_kind AS clientKind,
|
|
73
|
+
rt.client_session_id AS tokenClientSessionId, ec.client_session_id AS clientSessionId,
|
|
74
|
+
rt.expires_at AS expiresAt
|
|
75
|
+
FROM enno_resume_tokens AS rt
|
|
76
|
+
JOIN enno_contracts AS ec ON ec.run_id = rt.run_id
|
|
77
|
+
WHERE rt.token_hash = ? AND rt.run_id = ?
|
|
78
|
+
`).get(tokenHash, input.runId);
|
|
79
|
+
if (row === undefined)
|
|
80
|
+
throw new KiokukoError('CONFLICT', 'Enno resume token is invalid or expired');
|
|
81
|
+
const expiresAt = Date.parse(row.expiresAt);
|
|
82
|
+
if (row.routeEpoch !== row.tokenRouteEpoch || row.repositoryRoot !== row.tokenRepositoryRoot
|
|
83
|
+
|| row.clientKind !== row.tokenClientKind || row.clientSessionId !== row.tokenClientSessionId
|
|
84
|
+
|| !Number.isFinite(expiresAt) || expiresAt <= Date.now()) {
|
|
85
|
+
throw new KiokukoError('CONFLICT', 'Enno resume token is stale');
|
|
86
|
+
}
|
|
87
|
+
return { runId: row.runId, workspace: row.workspace, orchestrationId: row.orchestrationId };
|
|
88
|
+
}
|
|
89
|
+
const OPERATION_LEASE_MS = 6 * 60_000;
|
|
90
|
+
const VERIFIER_LEASE_GRACE_MS = 60_000;
|
|
91
|
+
const VERIFIER_TERMINATION_GRACE_MS = 1_000;
|
|
92
|
+
export function operationLeaseMsForVerifiers(verifiers) {
|
|
93
|
+
const sequentialRuntime = verifiers.reduce((total, verifier) => total + verifier.timeoutMs + VERIFIER_TERMINATION_GRACE_MS, VERIFIER_LEASE_GRACE_MS);
|
|
94
|
+
return Math.max(OPERATION_LEASE_MS, sequentialRuntime);
|
|
95
|
+
}
|
|
96
|
+
function integrity(message) {
|
|
97
|
+
throw new KiokukoError('INTEGRITY_ERROR', message);
|
|
98
|
+
}
|
|
99
|
+
function parseCanonicalJson(value, message) {
|
|
100
|
+
let parsed;
|
|
101
|
+
try {
|
|
102
|
+
parsed = parseStrictJson(value, { allowTrailingComma: false, disallowComments: true, allowEmptyContent: false }, message);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return integrity(message);
|
|
106
|
+
}
|
|
107
|
+
if (canonicalJson(parsed) !== value)
|
|
108
|
+
return integrity(message);
|
|
109
|
+
return parsed;
|
|
110
|
+
}
|
|
111
|
+
function contractRow(database, runId) {
|
|
112
|
+
return database.prepare('SELECT * FROM enno_contracts WHERE run_id = ?').get(runId);
|
|
113
|
+
}
|
|
114
|
+
function validateContractRow(row) {
|
|
115
|
+
if (!ENNO_STATUSES.includes(row.status)
|
|
116
|
+
|| !ENNO_APPLICABLE_TASK_TYPES.includes(row.task_type)
|
|
117
|
+
|| !Number.isSafeInteger(row.revision) || row.revision < 1
|
|
118
|
+
|| !Number.isSafeInteger(row.attempts) || row.attempts < 0 || row.attempts > 20
|
|
119
|
+
|| !Number.isSafeInteger(row.mutation_revision) || row.mutation_revision < 0
|
|
120
|
+
|| !Number.isSafeInteger(row.route_epoch) || row.route_epoch < 0) {
|
|
121
|
+
integrity('Stored Enno run state is invalid');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function exposedStatus(row) {
|
|
125
|
+
if (row.phase === null)
|
|
126
|
+
return row.status;
|
|
127
|
+
if (row.phase === 'oduno_ideal' && row.status === 'zenki_planning')
|
|
128
|
+
return row.phase;
|
|
129
|
+
if (row.phase === 'oduno_meditation' && row.status === 'enno_verifying')
|
|
130
|
+
return row.phase;
|
|
131
|
+
return integrity('Stored Oduno phase is inconsistent');
|
|
132
|
+
}
|
|
133
|
+
function persistedState(status) {
|
|
134
|
+
if (status === 'oduno_ideal')
|
|
135
|
+
return { status: 'zenki_planning', phase: status };
|
|
136
|
+
if (status === 'oduno_meditation')
|
|
137
|
+
return { status: 'enno_verifying', phase: status };
|
|
138
|
+
return { status, phase: null };
|
|
139
|
+
}
|
|
140
|
+
function storedWorkResult(value, repositoryRoot) {
|
|
141
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
142
|
+
return parseWorkReportResult(value);
|
|
143
|
+
const result = value;
|
|
144
|
+
if (!Array.isArray(result.changedPaths))
|
|
145
|
+
return parseWorkReportResult(value);
|
|
146
|
+
const changedPaths = result.changedPaths.map((candidate) => {
|
|
147
|
+
if (typeof candidate !== 'string' || !path.isAbsolute(candidate))
|
|
148
|
+
return candidate;
|
|
149
|
+
const relative = path.relative(repositoryRoot, candidate);
|
|
150
|
+
if (relative.startsWith(`..${path.sep}`) || relative === '..' || path.isAbsolute(relative))
|
|
151
|
+
return candidate;
|
|
152
|
+
return (relative || '.').split(path.sep).join('/');
|
|
153
|
+
});
|
|
154
|
+
return parseWorkReportResult({ ...result, changedPaths });
|
|
155
|
+
}
|
|
156
|
+
function workUnits(database, runId, revision, repositoryRoot) {
|
|
157
|
+
const rows = database.prepare(`
|
|
158
|
+
SELECT work_unit_json, status, attempt_count, result_json
|
|
159
|
+
FROM enno_work_units
|
|
160
|
+
WHERE run_id = ? AND contract_revision = ?
|
|
161
|
+
ORDER BY order_index
|
|
162
|
+
`).all(runId, revision);
|
|
163
|
+
if (rows.length === 0)
|
|
164
|
+
return [];
|
|
165
|
+
const parsed = parseWorkPlan({
|
|
166
|
+
objective: 'stored units',
|
|
167
|
+
units: rows.map((row) => parseCanonicalJson(row.work_unit_json, 'Stored Enno WorkUnit is invalid')),
|
|
168
|
+
});
|
|
169
|
+
return rows.map((row, index) => ({
|
|
170
|
+
workUnit: parsed.units[index],
|
|
171
|
+
status: row.status,
|
|
172
|
+
attemptCount: row.attempt_count,
|
|
173
|
+
result: row.result_json === null
|
|
174
|
+
? null
|
|
175
|
+
: storedWorkResult(parseCanonicalJson(row.result_json, 'Stored Enno work result is invalid'), repositoryRoot),
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
function assertLedgerIdentity(database, identity, repositoryRoot) {
|
|
179
|
+
const run = new LedgerStore(database).readRun(identity.runId, identity.workspace);
|
|
180
|
+
if (run === undefined)
|
|
181
|
+
throw new KiokukoError('NOT_FOUND', 'Enno run was not found');
|
|
182
|
+
const intake = database.prepare('SELECT session_id AS sessionId FROM run_intakes WHERE run_id = ?')
|
|
183
|
+
.get(identity.runId);
|
|
184
|
+
if (intake?.sessionId !== identity.orchestrationId) {
|
|
185
|
+
throw new KiokukoError('CONFLICT', 'Enno orchestration session does not own this run');
|
|
186
|
+
}
|
|
187
|
+
if (repositoryRoot !== undefined && contractRow(database, identity.runId)?.repository_root !== repositoryRoot) {
|
|
188
|
+
throw new KiokukoError('CONFLICT', 'Enno repository binding changed');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
export function readEnnoSnapshot(database, identity) {
|
|
192
|
+
assertLedgerIdentity(database, identity);
|
|
193
|
+
const row = contractRow(database, identity.runId);
|
|
194
|
+
if (row === undefined)
|
|
195
|
+
throw new KiokukoError('NOT_FOUND', 'Enno contract was not found');
|
|
196
|
+
validateContractRow(row);
|
|
197
|
+
if (row.workspace !== identity.workspace || row.orchestration_session_id !== identity.orchestrationId) {
|
|
198
|
+
throw new KiokukoError('CONFLICT', 'Enno run identity changed');
|
|
199
|
+
}
|
|
200
|
+
if ((row.client_kind !== null && !ENNO_CLIENT_KINDS.includes(row.client_kind))
|
|
201
|
+
|| ((row.client_version !== null || row.client_session_id !== null) && row.client_kind === null)) {
|
|
202
|
+
integrity('Stored Enno client routing metadata is invalid');
|
|
203
|
+
}
|
|
204
|
+
const contract = parseEnnoContract(parseCanonicalJson(row.contract_json, 'Stored Enno contract is invalid'));
|
|
205
|
+
const handoff = parseEnnoRequestHandoff(parseCanonicalJson(row.handoff_json, 'Stored Enno request handoff is invalid'));
|
|
206
|
+
const ideal = row.ideal_json === null
|
|
207
|
+
? null
|
|
208
|
+
: parseOdunoIdeal(parseCanonicalJson(row.ideal_json, 'Stored Oduno ideal is invalid'));
|
|
209
|
+
const meditation = row.meditation_json === null
|
|
210
|
+
? null
|
|
211
|
+
: parseOdunoMeditation(parseCanonicalJson(row.meditation_json, 'Stored Oduno meditation is invalid'));
|
|
212
|
+
const status = exposedStatus(row);
|
|
213
|
+
if (contract.revision !== row.revision)
|
|
214
|
+
integrity('Stored Enno contract revision is inconsistent');
|
|
215
|
+
if (handoff.taskType !== row.task_type)
|
|
216
|
+
integrity('Stored Enno request handoff is inconsistent');
|
|
217
|
+
if (status === 'oduno_ideal' && ideal !== null)
|
|
218
|
+
integrity('Stored Oduno ideal phase is inconsistent');
|
|
219
|
+
if (status === 'oduno_meditation' && (ideal === null || meditation !== null)) {
|
|
220
|
+
integrity('Stored Oduno meditation phase is inconsistent');
|
|
221
|
+
}
|
|
222
|
+
if (meditation !== null && status !== 'completed')
|
|
223
|
+
integrity('Stored Oduno meditation result is inconsistent');
|
|
224
|
+
const currentRepositoryDigest = status === 'enno_verifying' && contract.finalVerifiers.length > 0
|
|
225
|
+
? captureRepositoryState(row.repository_root).digest
|
|
226
|
+
: undefined;
|
|
227
|
+
const finalEvidenceReady = contract.finalVerifiers.length > 0
|
|
228
|
+
&& hasFreshFinalVerifierResults(database, {
|
|
229
|
+
runId: row.run_id,
|
|
230
|
+
revision: row.revision,
|
|
231
|
+
mutationRevision: row.mutation_revision,
|
|
232
|
+
verifiers: contract.finalVerifiers,
|
|
233
|
+
...(currentRepositoryDigest === undefined ? {} : { repositoryDigest: currentRepositoryDigest }),
|
|
234
|
+
});
|
|
235
|
+
const finalEvidence = finalEvidenceReady
|
|
236
|
+
? readFreshFinalVerifierResults(database, {
|
|
237
|
+
runId: row.run_id,
|
|
238
|
+
revision: row.revision,
|
|
239
|
+
mutationRevision: row.mutation_revision,
|
|
240
|
+
verifiers: contract.finalVerifiers,
|
|
241
|
+
...(currentRepositoryDigest === undefined ? {} : { repositoryDigest: currentRepositoryDigest }),
|
|
242
|
+
}) ?? []
|
|
243
|
+
: [];
|
|
244
|
+
const snapshot = {
|
|
245
|
+
runId: row.run_id,
|
|
246
|
+
workspace: row.workspace,
|
|
247
|
+
orchestrationId: row.orchestration_session_id,
|
|
248
|
+
clientKind: row.client_kind,
|
|
249
|
+
clientVersion: row.client_version,
|
|
250
|
+
clientSessionId: row.client_session_id,
|
|
251
|
+
repositoryRoot: row.repository_root,
|
|
252
|
+
taskType: row.task_type,
|
|
253
|
+
status,
|
|
254
|
+
revision: row.revision,
|
|
255
|
+
confirmationState: row.confirmation_state,
|
|
256
|
+
attempts: row.attempts,
|
|
257
|
+
mutationRevision: row.mutation_revision,
|
|
258
|
+
routeEpoch: row.route_epoch,
|
|
259
|
+
ideal,
|
|
260
|
+
meditation,
|
|
261
|
+
contract,
|
|
262
|
+
handoff,
|
|
263
|
+
workUnits: workUnits(database, identity.runId, row.revision, row.repository_root),
|
|
264
|
+
finalEvidenceReady,
|
|
265
|
+
finalEvidence,
|
|
266
|
+
blocker: row.blocker,
|
|
267
|
+
advisoryPhaseState: { state: 'not_started' },
|
|
268
|
+
};
|
|
269
|
+
const advisoryPhase = advisoryPhaseForStatus(status);
|
|
270
|
+
const currentInputDigest = advisoryPhase === null || (advisoryPhase === 'final_review' && !finalEvidenceReady)
|
|
271
|
+
? undefined
|
|
272
|
+
: advisoryInputDigest({
|
|
273
|
+
phase: advisoryPhase,
|
|
274
|
+
contractRevision: row.revision,
|
|
275
|
+
mutationRevision: row.mutation_revision,
|
|
276
|
+
allowlistedContext: advisoryContextForSnapshot(snapshot, advisoryPhase),
|
|
277
|
+
});
|
|
278
|
+
snapshot.advisoryPhaseState = advisoryPhaseState(database, {
|
|
279
|
+
runId: row.run_id,
|
|
280
|
+
status,
|
|
281
|
+
revision: row.revision,
|
|
282
|
+
mutationRevision: row.mutation_revision,
|
|
283
|
+
finalEvidenceReady,
|
|
284
|
+
currentInputDigest,
|
|
285
|
+
});
|
|
286
|
+
return snapshot;
|
|
287
|
+
}
|
|
288
|
+
function emptyDiscovery(mode) {
|
|
289
|
+
return {
|
|
290
|
+
attempted: false,
|
|
291
|
+
mode,
|
|
292
|
+
requirements: [],
|
|
293
|
+
queries: [],
|
|
294
|
+
cacheHits: 0,
|
|
295
|
+
candidates: 0,
|
|
296
|
+
selected: [],
|
|
297
|
+
failures: [],
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
export function createEnnoDraft(database, input) {
|
|
301
|
+
return withImmediateTransaction(database, () => {
|
|
302
|
+
assertLedgerIdentity(database, input);
|
|
303
|
+
const existing = contractRow(database, input.runId);
|
|
304
|
+
if (existing !== undefined)
|
|
305
|
+
return readEnnoSnapshot(database, input);
|
|
306
|
+
const contract = {
|
|
307
|
+
revision: 1,
|
|
308
|
+
scope: input.taskTarget === null ? [] : [input.taskTarget],
|
|
309
|
+
exclusions: [],
|
|
310
|
+
acceptanceCriteria: input.taskExpected === null ? [] : [{ id: 'task-expected', description: input.taskExpected }],
|
|
311
|
+
workPlan: { objective: input.taskTarget ?? 'Plan the requested task', units: [] },
|
|
312
|
+
skillSet: {
|
|
313
|
+
entries: [],
|
|
314
|
+
intakeDiscovery: input.skillDiscovery,
|
|
315
|
+
zenkiDiscovery: emptyDiscovery(input.skillDiscovery.mode),
|
|
316
|
+
},
|
|
317
|
+
finalVerifiers: [],
|
|
318
|
+
maxAttempts: ENNO_DEFAULT_MAX_ATTEMPTS,
|
|
319
|
+
provenance: {
|
|
320
|
+
scope: 'inferred',
|
|
321
|
+
exclusions: 'inferred',
|
|
322
|
+
acceptanceCriteria: 'inferred',
|
|
323
|
+
workPlan: 'inferred',
|
|
324
|
+
skillSet: 'inferred',
|
|
325
|
+
finalVerifiers: 'inferred',
|
|
326
|
+
maxAttempts: 'inferred',
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
const recognizedClientKind = typeof input.initialClientKind === 'string'
|
|
330
|
+
&& ENNO_CLIENT_KINDS.includes(input.initialClientKind)
|
|
331
|
+
? input.initialClientKind
|
|
332
|
+
: null;
|
|
333
|
+
const clientVersion = recognizedClientKind === null ? null : input.initialClientVersion ?? null;
|
|
334
|
+
const clientSessionId = recognizedClientKind === null ? null : input.initialClientSessionId ?? null;
|
|
335
|
+
const now = new Date().toISOString();
|
|
336
|
+
database.prepare(`
|
|
337
|
+
INSERT INTO enno_contracts (
|
|
338
|
+
run_id, workspace, orchestration_session_id, client_kind, client_version, client_session_id,
|
|
339
|
+
repository_root, task_type, status, revision,
|
|
340
|
+
confirmation_state, attempts, mutation_revision, contract_json, handoff_json,
|
|
341
|
+
intake_discovery_json, plan_digest, blocker, created_at, updated_at
|
|
342
|
+
, phase, ideal_json, meditation_json
|
|
343
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, 'zenki_planning', 1, 'not_required', 0, 0, ?, ?, ?, NULL, NULL, ?, ?, 'oduno_ideal', NULL, NULL)
|
|
344
|
+
`).run(input.runId, input.workspace, input.orchestrationId, recognizedClientKind, clientVersion, clientSessionId, input.repositoryRoot, input.taskType, canonicalJson(contract), canonicalJson(input.handoff), canonicalJson(input.skillDiscovery), now, now);
|
|
345
|
+
appendEnnoEventInTransaction(database, input.runId, 'enno.started', 'enno-oduno', 'started', {
|
|
346
|
+
contractRevision: 1,
|
|
347
|
+
harnessKind: recognizedClientKind,
|
|
348
|
+
clientBinding: clientSessionId === null ? 'pending' : 'bound',
|
|
349
|
+
});
|
|
350
|
+
return readEnnoSnapshot(database, input);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
export function appendEnnoEventInTransaction(database, runId, eventType, actor, outcome, payload) {
|
|
354
|
+
new LedgerStore(database).appendBatchInTransaction(runId, { events: [{
|
|
355
|
+
eventId: randomUUID(),
|
|
356
|
+
eventType,
|
|
357
|
+
actor,
|
|
358
|
+
outcome,
|
|
359
|
+
payload,
|
|
360
|
+
}] });
|
|
361
|
+
}
|
|
362
|
+
export function updateContractInTransaction(database, snapshot, input) {
|
|
363
|
+
const nextState = persistedState(input.status);
|
|
364
|
+
const currentState = persistedState(snapshot.status);
|
|
365
|
+
const updated = database.prepare(`
|
|
366
|
+
UPDATE enno_contracts
|
|
367
|
+
SET status = ?, phase = ?, revision = ?, confirmation_state = ?, attempts = ?, mutation_revision = ?,
|
|
368
|
+
contract_json = ?, ideal_json = ?, meditation_json = ?, plan_digest = ?, blocker = ?, updated_at = ?
|
|
369
|
+
WHERE run_id = ? AND workspace = ? AND orchestration_session_id = ? AND revision = ?
|
|
370
|
+
AND status = ? AND phase IS ?
|
|
371
|
+
RETURNING run_id AS runId
|
|
372
|
+
`).get(nextState.status, nextState.phase, input.contract.revision, input.confirmationState, input.attempts ?? snapshot.attempts, input.mutationRevision ?? snapshot.mutationRevision, canonicalJson(input.contract), input.ideal === undefined
|
|
373
|
+
? snapshot.ideal === null ? null : canonicalJson(snapshot.ideal)
|
|
374
|
+
: input.ideal === null ? null : canonicalJson(input.ideal), input.meditation === undefined
|
|
375
|
+
? snapshot.meditation === null ? null : canonicalJson(snapshot.meditation)
|
|
376
|
+
: input.meditation === null ? null : canonicalJson(input.meditation), input.planDigest ?? null, input.blocker ?? null, new Date().toISOString(), snapshot.runId, snapshot.workspace, snapshot.orchestrationId, snapshot.revision, currentState.status, currentState.phase);
|
|
377
|
+
if (updated?.runId !== snapshot.runId)
|
|
378
|
+
throw new KiokukoError('CONFLICT', 'Enno state changed concurrently');
|
|
379
|
+
}
|
|
380
|
+
export function replaceWorkUnitsInTransaction(database, runId, revision, workPlan) {
|
|
381
|
+
database.prepare('DELETE FROM enno_work_units WHERE run_id = ? AND contract_revision = ?').run(runId, revision);
|
|
382
|
+
const statement = database.prepare(`
|
|
383
|
+
INSERT INTO enno_work_units (
|
|
384
|
+
run_id, work_unit_id, contract_revision, order_index, work_unit_json,
|
|
385
|
+
status, attempt_count, result_json, created_at, updated_at
|
|
386
|
+
) VALUES (?, ?, ?, ?, ?, 'pending', 0, NULL, ?, ?)
|
|
387
|
+
`);
|
|
388
|
+
const now = new Date().toISOString();
|
|
389
|
+
workPlan.units.forEach((unit, index) => {
|
|
390
|
+
statement.run(runId, unit.id, revision, index, canonicalJson(unit), now, now);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
export function setWorkUnitStatusInTransaction(database, input) {
|
|
394
|
+
const from = Array.isArray(input.from) ? input.from : [input.from];
|
|
395
|
+
const placeholders = from.map(() => '?').join(', ');
|
|
396
|
+
const updated = database.prepare(`
|
|
397
|
+
UPDATE enno_work_units
|
|
398
|
+
SET status = ?,
|
|
399
|
+
attempt_count = COALESCE(?, attempt_count),
|
|
400
|
+
result_json = ?,
|
|
401
|
+
updated_at = ?
|
|
402
|
+
WHERE run_id = ? AND contract_revision = ? AND work_unit_id = ? AND status IN (${placeholders})
|
|
403
|
+
RETURNING work_unit_id AS workUnitId
|
|
404
|
+
`).get(input.to, input.attemptCount ?? null, input.result === undefined || input.result === null ? null : canonicalJson(input.result), new Date().toISOString(), input.runId, input.contractRevision, input.workUnitId, ...from);
|
|
405
|
+
if (updated?.workUnitId !== input.workUnitId)
|
|
406
|
+
throw new KiokukoError('CONFLICT', 'Enno WorkUnit changed concurrently');
|
|
407
|
+
}
|
|
408
|
+
const EXECUTION_LEASE_MS = 15 * 60_000;
|
|
409
|
+
export function claimExecutionLeaseInTransaction(database, snapshot, workUnitId, owner) {
|
|
410
|
+
const nowDate = new Date();
|
|
411
|
+
const now = nowDate.toISOString();
|
|
412
|
+
const existing = database.prepare(`
|
|
413
|
+
SELECT contract_revision AS contractRevision, mutation_revision AS mutationRevision,
|
|
414
|
+
work_unit_id AS workUnitId, route_epoch AS routeEpoch,
|
|
415
|
+
owner_client_kind AS ownerClientKind, owner_session_id AS ownerSessionId,
|
|
416
|
+
lease_expires_at AS expiresAt
|
|
417
|
+
FROM enno_execution_leases WHERE run_id = ?
|
|
418
|
+
`).get(snapshot.runId);
|
|
419
|
+
if (existing !== undefined && existing.expiresAt > now
|
|
420
|
+
&& (existing.contractRevision !== snapshot.revision
|
|
421
|
+
|| existing.mutationRevision !== snapshot.mutationRevision
|
|
422
|
+
|| existing.workUnitId !== workUnitId
|
|
423
|
+
|| existing.routeEpoch !== (snapshot.routeEpoch ?? 0)
|
|
424
|
+
|| existing.ownerClientKind !== owner.clientKind
|
|
425
|
+
|| existing.ownerSessionId !== owner.sessionId)) {
|
|
426
|
+
throw new KiokukoError('CONFLICT', 'Enno WorkUnit is leased to another current actor');
|
|
427
|
+
}
|
|
428
|
+
const leaseToken = randomUUID();
|
|
429
|
+
const tokenHash = createHash('sha256').update(leaseToken, 'utf8').digest('hex');
|
|
430
|
+
const expiresAt = new Date(nowDate.getTime() + EXECUTION_LEASE_MS).toISOString();
|
|
431
|
+
database.prepare(`
|
|
432
|
+
INSERT INTO enno_execution_leases (
|
|
433
|
+
run_id, contract_revision, mutation_revision, work_unit_id, route_epoch,
|
|
434
|
+
owner_client_kind, owner_session_id, lease_token_hash, lease_expires_at,
|
|
435
|
+
heartbeat_at, created_at, updated_at
|
|
436
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
437
|
+
ON CONFLICT(run_id) DO UPDATE SET
|
|
438
|
+
contract_revision = excluded.contract_revision,
|
|
439
|
+
mutation_revision = excluded.mutation_revision,
|
|
440
|
+
work_unit_id = excluded.work_unit_id,
|
|
441
|
+
route_epoch = excluded.route_epoch,
|
|
442
|
+
owner_client_kind = excluded.owner_client_kind,
|
|
443
|
+
owner_session_id = excluded.owner_session_id,
|
|
444
|
+
lease_token_hash = excluded.lease_token_hash,
|
|
445
|
+
lease_expires_at = excluded.lease_expires_at,
|
|
446
|
+
heartbeat_at = excluded.heartbeat_at,
|
|
447
|
+
updated_at = excluded.updated_at
|
|
448
|
+
`).run(snapshot.runId, snapshot.revision, snapshot.mutationRevision, workUnitId, snapshot.routeEpoch ?? 0, owner.clientKind, owner.sessionId, tokenHash, expiresAt, now, now, now);
|
|
449
|
+
return {
|
|
450
|
+
leaseToken,
|
|
451
|
+
routeEpoch: snapshot.routeEpoch ?? 0,
|
|
452
|
+
contractRevision: snapshot.revision,
|
|
453
|
+
mutationRevision: snapshot.mutationRevision,
|
|
454
|
+
workUnitId,
|
|
455
|
+
expiresAt,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
export function assertExecutionLeaseInTransaction(database, snapshot, input) {
|
|
459
|
+
const row = database.prepare(`
|
|
460
|
+
SELECT contract_revision AS contractRevision, mutation_revision AS mutationRevision,
|
|
461
|
+
work_unit_id AS workUnitId, route_epoch AS routeEpoch,
|
|
462
|
+
owner_client_kind AS ownerClientKind, owner_session_id AS ownerSessionId,
|
|
463
|
+
lease_token_hash AS tokenHash, lease_expires_at AS expiresAt
|
|
464
|
+
FROM enno_execution_leases WHERE run_id = ?
|
|
465
|
+
`).get(snapshot.runId);
|
|
466
|
+
if (row === undefined) {
|
|
467
|
+
if (input.leaseToken !== undefined || input.routeEpoch !== undefined) {
|
|
468
|
+
throw new KiokukoError('CONFLICT', 'Enno execution lease is not active');
|
|
469
|
+
}
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const tokenHash = input.leaseToken === undefined
|
|
473
|
+
? null
|
|
474
|
+
: createHash('sha256').update(input.leaseToken, 'utf8').digest('hex');
|
|
475
|
+
if (row.expiresAt <= new Date().toISOString()
|
|
476
|
+
|| row.contractRevision !== snapshot.revision
|
|
477
|
+
|| row.mutationRevision !== snapshot.mutationRevision
|
|
478
|
+
|| row.workUnitId !== input.workUnitId
|
|
479
|
+
|| row.routeEpoch !== input.routeEpoch
|
|
480
|
+
|| row.routeEpoch !== (snapshot.routeEpoch ?? 0)
|
|
481
|
+
|| row.ownerClientKind !== snapshot.clientKind
|
|
482
|
+
|| row.ownerSessionId !== snapshot.clientSessionId
|
|
483
|
+
|| tokenHash !== row.tokenHash) {
|
|
484
|
+
throw new KiokukoError('CONFLICT', 'Enno execution lease is stale or belongs to another actor');
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
export function releaseExecutionLeaseInTransaction(database, runId) {
|
|
488
|
+
database.prepare('DELETE FROM enno_execution_leases WHERE run_id = ?').run(runId);
|
|
489
|
+
}
|
|
490
|
+
export function renewExecutionLeaseInTransaction(database, snapshot, input, minimumLeaseMs) {
|
|
491
|
+
assertExecutionLeaseInTransaction(database, snapshot, input);
|
|
492
|
+
const existing = database.prepare('SELECT 1 AS present FROM enno_execution_leases WHERE run_id = ?')
|
|
493
|
+
.get(snapshot.runId);
|
|
494
|
+
if (existing === undefined)
|
|
495
|
+
return;
|
|
496
|
+
const now = new Date();
|
|
497
|
+
const leaseExpiresAt = new Date(now.getTime() + Math.max(EXECUTION_LEASE_MS, minimumLeaseMs)).toISOString();
|
|
498
|
+
const updated = database.prepare(`
|
|
499
|
+
UPDATE enno_execution_leases
|
|
500
|
+
SET lease_expires_at = ?, heartbeat_at = ?, updated_at = ?
|
|
501
|
+
WHERE run_id = ?
|
|
502
|
+
RETURNING run_id AS runId
|
|
503
|
+
`).get(leaseExpiresAt, now.toISOString(), now.toISOString(), snapshot.runId);
|
|
504
|
+
if (updated?.runId !== snapshot.runId)
|
|
505
|
+
throw new KiokukoError('CONFLICT', 'Enno execution lease changed concurrently');
|
|
506
|
+
}
|
|
507
|
+
export function startVerifierRunsInTransaction(database, input) {
|
|
508
|
+
const nowDate = new Date();
|
|
509
|
+
const now = nowDate.toISOString();
|
|
510
|
+
database.prepare(`
|
|
511
|
+
UPDATE enno_verifier_runs
|
|
512
|
+
SET status = 'abandoned', failure_code = 'lease_expired', finished_at = ?
|
|
513
|
+
WHERE run_id = ? AND status = 'started' AND lease_expires_at <= ?
|
|
514
|
+
`).run(now, input.runId, now);
|
|
515
|
+
const statement = database.prepare(`
|
|
516
|
+
INSERT INTO enno_verifier_runs (
|
|
517
|
+
verifier_run_id, run_id, work_unit_id, contract_revision, mutation_revision,
|
|
518
|
+
verifier_id, verifier_json, status, owner_nonce, lease_expires_at, heartbeat_at,
|
|
519
|
+
repository_state_policy_version, pre_repository_digest, verifier_spec_digest, started_at
|
|
520
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, 'started', ?, ?, ?, ?, ?, ?, ?)
|
|
521
|
+
`);
|
|
522
|
+
const leaseMs = operationLeaseMsForVerifiers(input.verifiers);
|
|
523
|
+
const leaseExpiresAt = new Date(nowDate.getTime() + leaseMs).toISOString();
|
|
524
|
+
return input.verifiers.map((verifier) => {
|
|
525
|
+
const verifierRunId = randomUUID();
|
|
526
|
+
statement.run(verifierRunId, input.runId, input.workUnitId, input.revision, input.mutationRevision, verifier.id, canonicalJson(verifier), randomUUID(), leaseExpiresAt, now, input.repositoryEvidence?.policyVersion ?? null, input.repositoryEvidence?.preDigest ?? null, input.repositoryEvidence?.verifierSpecDigest ?? null, now);
|
|
527
|
+
return verifierRunId;
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
export function finishVerifierRunsInTransaction(database, verifierRunIds, results, repositoryEvidence) {
|
|
531
|
+
if (verifierRunIds.length !== results.length)
|
|
532
|
+
integrity('Enno verifier result count is inconsistent');
|
|
533
|
+
const finishedAt = new Date().toISOString();
|
|
534
|
+
results.forEach((result, index) => {
|
|
535
|
+
const verifierRunId = verifierRunIds[index];
|
|
536
|
+
if (verifierRunId === undefined)
|
|
537
|
+
integrity('Enno verifier result count is inconsistent');
|
|
538
|
+
const updated = database.prepare(`
|
|
539
|
+
UPDATE enno_verifier_runs
|
|
540
|
+
SET status = ?, exit_code = ?, signal = ?, duration_ms = ?,
|
|
541
|
+
stdout_preview = ?, stderr_preview = ?, stdout_digest = ?, stderr_digest = ?,
|
|
542
|
+
post_repository_digest = ?, changed_during_verification = ?, finished_at = ?
|
|
543
|
+
WHERE verifier_run_id = ? AND status = 'started'
|
|
544
|
+
RETURNING verifier_run_id AS verifierRunId
|
|
545
|
+
`).get(result.status, result.exitCode, result.signal, result.durationMs, result.stdoutPreview, result.stderrPreview, result.stdoutDigest, result.stderrDigest, repositoryEvidence?.postDigest ?? null, repositoryEvidence === undefined ? null : repositoryEvidence.changedDuringVerification ? 1 : 0, finishedAt, verifierRunId);
|
|
546
|
+
if (updated?.verifierRunId !== verifierRunId)
|
|
547
|
+
throw new KiokukoError('CONFLICT', 'Enno verifier state changed concurrently');
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
export function readFreshFinalVerifierResults(database, input) {
|
|
551
|
+
if (input.verifiers.length === 0)
|
|
552
|
+
return undefined;
|
|
553
|
+
const rows = database.prepare(`
|
|
554
|
+
SELECT verifier_id, verifier_json, status, exit_code, signal, duration_ms,
|
|
555
|
+
stdout_preview, stderr_preview, stdout_digest, stderr_digest,
|
|
556
|
+
repository_state_policy_version, pre_repository_digest, post_repository_digest,
|
|
557
|
+
verifier_spec_digest, changed_during_verification, finished_at
|
|
558
|
+
FROM enno_verifier_runs
|
|
559
|
+
WHERE run_id = ? AND work_unit_id IS NULL
|
|
560
|
+
AND contract_revision = ? AND mutation_revision = ?
|
|
561
|
+
ORDER BY verifier_id, finished_at DESC, verifier_run_id DESC
|
|
562
|
+
`).all(input.runId, input.revision, input.mutationRevision);
|
|
563
|
+
const completedRows = rows.filter((row) => row.status !== 'started' && row.status !== 'abandoned');
|
|
564
|
+
const byId = new Map();
|
|
565
|
+
for (const row of completedRows)
|
|
566
|
+
if (!byId.has(row.verifier_id))
|
|
567
|
+
byId.set(row.verifier_id, row);
|
|
568
|
+
if (byId.size !== input.verifiers.length || input.verifiers.some((verifier) => !byId.has(verifier.id)))
|
|
569
|
+
return undefined;
|
|
570
|
+
for (const verifier of input.verifiers) {
|
|
571
|
+
const row = byId.get(verifier.id);
|
|
572
|
+
const storedVerifier = parseVerifierSpec(parseCanonicalJson(row.verifier_json, 'Stored Enno verifier is invalid'));
|
|
573
|
+
if (canonicalJson(storedVerifier) !== canonicalJson(verifier))
|
|
574
|
+
return undefined;
|
|
575
|
+
if (row.changed_during_verification === 1)
|
|
576
|
+
return undefined;
|
|
577
|
+
if (input.repositoryDigest !== undefined
|
|
578
|
+
&& (row.pre_repository_digest !== input.repositoryDigest
|
|
579
|
+
|| row.post_repository_digest !== input.repositoryDigest
|
|
580
|
+
|| row.verifier_spec_digest !== canonicalContentHash(input.verifiers)))
|
|
581
|
+
return undefined;
|
|
582
|
+
}
|
|
583
|
+
return input.verifiers.map((verifier) => {
|
|
584
|
+
const row = byId.get(verifier.id);
|
|
585
|
+
const storedVerifier = parseVerifierSpec(parseCanonicalJson(row.verifier_json, 'Stored Enno verifier is invalid'));
|
|
586
|
+
return {
|
|
587
|
+
verifier: { ...storedVerifier, args: [...storedVerifier.args] },
|
|
588
|
+
status: row.status,
|
|
589
|
+
exitCode: row.exit_code,
|
|
590
|
+
signal: row.signal,
|
|
591
|
+
durationMs: row.duration_ms,
|
|
592
|
+
stdoutPreview: row.stdout_preview,
|
|
593
|
+
stderrPreview: row.stderr_preview,
|
|
594
|
+
stdoutDigest: row.stdout_digest,
|
|
595
|
+
stderrDigest: row.stderr_digest,
|
|
596
|
+
...(row.repository_state_policy_version === null ? {} : { repositoryStatePolicyVersion: row.repository_state_policy_version }),
|
|
597
|
+
...(row.post_repository_digest === null ? {} : { repositoryStateDigest: row.post_repository_digest }),
|
|
598
|
+
...(row.changed_during_verification === null ? {} : { changedDuringVerification: row.changed_during_verification === 1 }),
|
|
599
|
+
};
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
export function hasFreshFinalVerifierResults(database, input) {
|
|
603
|
+
try {
|
|
604
|
+
return readFreshFinalVerifierResults(database, input) !== undefined;
|
|
605
|
+
}
|
|
606
|
+
catch {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
export function readOperationReceipt(database, runId, operation) {
|
|
611
|
+
const row = database.prepare(`
|
|
612
|
+
SELECT request_digest, state, response_json, lease_expires_at
|
|
613
|
+
FROM enno_operation_receipts
|
|
614
|
+
WHERE run_id = ? AND operation = ? AND idempotency_key = ?
|
|
615
|
+
`).get(runId, operation.operation, operation.idempotencyKey);
|
|
616
|
+
if (row === undefined)
|
|
617
|
+
return undefined;
|
|
618
|
+
if (row.request_digest !== operation.requestDigest
|
|
619
|
+
&& !operation.legacyRequestDigests?.includes(row.request_digest)) {
|
|
620
|
+
throw new KiokukoError('CONFLICT', 'Enno idempotency key was reused with different input');
|
|
621
|
+
}
|
|
622
|
+
if (row.request_digest !== operation.requestDigest) {
|
|
623
|
+
const normalized = database.prepare(`
|
|
624
|
+
UPDATE enno_operation_receipts SET request_digest = ?
|
|
625
|
+
WHERE run_id = ? AND operation = ? AND idempotency_key = ? AND request_digest = ?
|
|
626
|
+
RETURNING run_id AS runId
|
|
627
|
+
`).get(operation.requestDigest, runId, operation.operation, operation.idempotencyKey, row.request_digest);
|
|
628
|
+
if (normalized?.runId !== runId)
|
|
629
|
+
throw new KiokukoError('CONFLICT', 'Enno operation receipt changed concurrently');
|
|
630
|
+
row.request_digest = operation.requestDigest;
|
|
631
|
+
}
|
|
632
|
+
if (row.state === 'started') {
|
|
633
|
+
if (row.lease_expires_at === null || !Number.isFinite(Date.parse(row.lease_expires_at))) {
|
|
634
|
+
return integrity('Stored Enno operation receipt lease is invalid');
|
|
635
|
+
}
|
|
636
|
+
const now = new Date().toISOString();
|
|
637
|
+
if (row.lease_expires_at > now)
|
|
638
|
+
throw new KiokukoError('CONFLICT', 'Enno operation is already in progress');
|
|
639
|
+
const abandoned = database.prepare(`
|
|
640
|
+
UPDATE enno_operation_receipts
|
|
641
|
+
SET state = 'abandoned', failure_code = 'lease_expired', finished_at = ?
|
|
642
|
+
WHERE run_id = ? AND operation = ? AND idempotency_key = ?
|
|
643
|
+
AND request_digest = ? AND state = 'started' AND lease_expires_at <= ?
|
|
644
|
+
RETURNING run_id AS runId
|
|
645
|
+
`).get(now, runId, operation.operation, operation.idempotencyKey, operation.requestDigest, now);
|
|
646
|
+
if (abandoned?.runId !== runId)
|
|
647
|
+
throw new KiokukoError('CONFLICT', 'Enno operation state changed concurrently');
|
|
648
|
+
return undefined;
|
|
649
|
+
}
|
|
650
|
+
if (row.state === 'failed' || row.state === 'abandoned')
|
|
651
|
+
return undefined;
|
|
652
|
+
if (row.response_json === null)
|
|
653
|
+
integrity('Stored Enno operation receipt is invalid');
|
|
654
|
+
return parseCanonicalJson(row.response_json, 'Stored Enno operation receipt is invalid');
|
|
655
|
+
}
|
|
656
|
+
export function startOperationInTransaction(database, runId, operation, leaseMs = OPERATION_LEASE_MS) {
|
|
657
|
+
const replay = readOperationReceipt(database, runId, operation);
|
|
658
|
+
if (replay !== undefined)
|
|
659
|
+
throw new KiokukoError('CONFLICT', 'Completed Enno operation must be replayed before mutation');
|
|
660
|
+
if (!Number.isSafeInteger(leaseMs) || leaseMs < OPERATION_LEASE_MS)
|
|
661
|
+
integrity('Enno operation lease duration is invalid');
|
|
662
|
+
const nowDate = new Date();
|
|
663
|
+
const now = nowDate.toISOString();
|
|
664
|
+
database.prepare(`
|
|
665
|
+
UPDATE enno_operation_receipts
|
|
666
|
+
SET state = 'abandoned', failure_code = 'lease_expired', finished_at = ?
|
|
667
|
+
WHERE run_id = ? AND state = 'started' AND lease_expires_at <= ?
|
|
668
|
+
`).run(now, runId, now);
|
|
669
|
+
const active = database.prepare(`
|
|
670
|
+
SELECT operation FROM enno_operation_receipts
|
|
671
|
+
WHERE run_id = ? AND state = 'started' AND lease_expires_at > ?
|
|
672
|
+
LIMIT 1
|
|
673
|
+
`).get(runId, now);
|
|
674
|
+
if (active !== undefined)
|
|
675
|
+
throw new KiokukoError('CONFLICT', 'Another Enno operation is already in progress');
|
|
676
|
+
const ownerNonce = randomUUID();
|
|
677
|
+
const leaseExpiresAt = new Date(nowDate.getTime() + leaseMs).toISOString();
|
|
678
|
+
const started = database.prepare(`
|
|
679
|
+
INSERT INTO enno_operation_receipts (
|
|
680
|
+
run_id, operation, idempotency_key, request_digest, state, response_json,
|
|
681
|
+
owner_nonce, lease_expires_at, heartbeat_at, failure_code, created_at, finished_at
|
|
682
|
+
) VALUES (?, ?, ?, ?, 'started', NULL, ?, ?, ?, NULL, ?, NULL)
|
|
683
|
+
ON CONFLICT(run_id, operation, idempotency_key) DO UPDATE SET
|
|
684
|
+
state = 'started', response_json = NULL, owner_nonce = excluded.owner_nonce,
|
|
685
|
+
lease_expires_at = excluded.lease_expires_at, heartbeat_at = excluded.heartbeat_at,
|
|
686
|
+
failure_code = NULL, created_at = excluded.created_at, finished_at = NULL
|
|
687
|
+
WHERE enno_operation_receipts.request_digest = excluded.request_digest
|
|
688
|
+
AND enno_operation_receipts.state IN ('failed', 'abandoned')
|
|
689
|
+
RETURNING run_id AS runId
|
|
690
|
+
`).get(runId, operation.operation, operation.idempotencyKey, operation.requestDigest, ownerNonce, leaseExpiresAt, now, now);
|
|
691
|
+
if (started?.runId !== runId)
|
|
692
|
+
throw new KiokukoError('CONFLICT', 'Enno operation could not be claimed');
|
|
693
|
+
return ownerNonce;
|
|
694
|
+
}
|
|
695
|
+
export function completeOperationInTransaction(database, runId, operation, ownerNonce, response) {
|
|
696
|
+
const serialized = canonicalJson(response);
|
|
697
|
+
const finishedAt = new Date().toISOString();
|
|
698
|
+
const updated = database.prepare(`
|
|
699
|
+
UPDATE enno_operation_receipts
|
|
700
|
+
SET state = 'completed', response_json = ?, finished_at = ?
|
|
701
|
+
WHERE run_id = ? AND operation = ? AND idempotency_key = ?
|
|
702
|
+
AND request_digest = ? AND state = 'started' AND owner_nonce = ?
|
|
703
|
+
AND lease_expires_at > ?
|
|
704
|
+
RETURNING run_id AS runId
|
|
705
|
+
`).get(serialized, finishedAt, runId, operation.operation, operation.idempotencyKey, operation.requestDigest, ownerNonce, finishedAt);
|
|
706
|
+
if (updated?.runId !== runId)
|
|
707
|
+
throw new KiokukoError('CONFLICT', 'Enno operation receipt changed concurrently');
|
|
708
|
+
}
|
|
709
|
+
export function terminalizeLedgerRunInTransaction(database, runId, status) {
|
|
710
|
+
new LedgerStore(database).updateRunStatusInTransaction(runId, status);
|
|
711
|
+
}
|
|
712
|
+
//# sourceMappingURL=store.js.map
|