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
package/dist/cli.js
ADDED
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
import { constants as fsConstants } from 'node:fs';
|
|
2
|
+
import { open } from 'node:fs/promises';
|
|
3
|
+
import { TextDecoder } from 'node:util';
|
|
4
|
+
import { isProxy } from 'node:util/types';
|
|
5
|
+
import { Command, CommanderError } from 'commander';
|
|
6
|
+
import { initializeDatabase } from './commands/init.js';
|
|
7
|
+
import { useRepository } from './commands/use.js';
|
|
8
|
+
import { searchEntries, recallEntries } from './memory/retrieval.js';
|
|
9
|
+
import { readEntry, recordEntry } from './memory/entries.js';
|
|
10
|
+
import { recallScopedMemory } from './memory/scoped-memory.js';
|
|
11
|
+
import { promoteEntry, supersedeEntry, linkEntries } from './memory/lifecycle.js';
|
|
12
|
+
import { purgeEntry } from './commands/purge.js';
|
|
13
|
+
import { createBackup } from './commands/backup.js';
|
|
14
|
+
import { findMissingRepositoryLocations, removeMissingRepositoryLocations } from './repository/binding.js';
|
|
15
|
+
import { promptRemoveMissingRepositoryLocations, runDoctor } from './commands/doctor.js';
|
|
16
|
+
import { writeExport } from './commands/export.js';
|
|
17
|
+
import { importWorkspace } from './commands/import.js';
|
|
18
|
+
import { openConnection } from './db/connection.js';
|
|
19
|
+
import { errorEnvelope, successEnvelope } from './serialization/envelope.js';
|
|
20
|
+
import { KiokukoError, exitCodeFor } from './errors.js';
|
|
21
|
+
import { startWebServer } from './web/server.js';
|
|
22
|
+
import { registerServerCommands } from './commands/server.js';
|
|
23
|
+
import { registerAgentCommand } from './commands/agent.js';
|
|
24
|
+
import { registerLedgerCommands } from './commands/ledger.js';
|
|
25
|
+
import { answerAkinator, startAkinator } from './akinator/orchestrator.js';
|
|
26
|
+
import { parseSetupClients, parseEnnoSetupMode, parseSetupSkillDiscoveryMode, runSetupFlow, } from './commands/setup.js';
|
|
27
|
+
import { runMcpServer } from './mcp/server.js';
|
|
28
|
+
import { runCuratorCommand } from './commands/curator.js';
|
|
29
|
+
import { globalizeCuratorCandidate } from './memory/curator.js';
|
|
30
|
+
import { registerSkillsCommands } from './commands/skills.js';
|
|
31
|
+
import { registerEnnoCommand } from './commands/enno.js';
|
|
32
|
+
import { PACKAGE_VERSION } from './package-version.js';
|
|
33
|
+
import { parseStrictJson } from './setup/strict-json.js';
|
|
34
|
+
import { validateRecordInput } from './serialization/validate.js';
|
|
35
|
+
import { registerEmbeddingsCommands } from './commands/embeddings.js';
|
|
36
|
+
import { openEmbeddingDatabase } from './embedding/backend.js';
|
|
37
|
+
import { parseEmbeddingConfig } from './embedding/config.js';
|
|
38
|
+
import { createEmbeddingRuntime, prepareEmbeddingSearchRuntime } from './embedding/runtime.js';
|
|
39
|
+
const MAX_CLI_JSON_INPUT_BYTES = 2 * 1024 * 1024;
|
|
40
|
+
const MAX_CALL_PATH_BYTES = 4 * 1024;
|
|
41
|
+
const CONTROL_CHARACTERS = /\p{Cc}/u;
|
|
42
|
+
function invalidJsonInput() {
|
|
43
|
+
return new KiokukoError('VALIDATION_ERROR', 'Input is not valid JSON with unique keys');
|
|
44
|
+
}
|
|
45
|
+
async function readBoundedStdin() {
|
|
46
|
+
if (process.stdin.readableEncoding !== null || process.stdin.readableDidRead) {
|
|
47
|
+
throw invalidJsonInput();
|
|
48
|
+
}
|
|
49
|
+
const chunks = [];
|
|
50
|
+
let size = 0;
|
|
51
|
+
for await (const chunk of process.stdin) {
|
|
52
|
+
if (!Buffer.isBuffer(chunk))
|
|
53
|
+
throw invalidJsonInput();
|
|
54
|
+
const bytes = chunk;
|
|
55
|
+
size += bytes.byteLength;
|
|
56
|
+
if (size > MAX_CLI_JSON_INPUT_BYTES)
|
|
57
|
+
throw invalidJsonInput();
|
|
58
|
+
chunks.push(bytes);
|
|
59
|
+
}
|
|
60
|
+
return Buffer.concat(chunks);
|
|
61
|
+
}
|
|
62
|
+
function filesystemErrorCode(error) {
|
|
63
|
+
if ((typeof error !== 'object' && typeof error !== 'function') || error === null || isProxy(error)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'code');
|
|
67
|
+
return descriptor !== undefined && 'value' in descriptor && typeof descriptor.value === 'string'
|
|
68
|
+
? descriptor.value
|
|
69
|
+
: undefined;
|
|
70
|
+
}
|
|
71
|
+
async function readBoundedJsonFile(filePath) {
|
|
72
|
+
let handle;
|
|
73
|
+
try {
|
|
74
|
+
handle = await open(filePath, fsConstants.O_RDONLY | fsConstants.O_NONBLOCK);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (filesystemErrorCode(error) === 'ENOENT' || filesystemErrorCode(error) === 'ENOTDIR') {
|
|
78
|
+
throw new KiokukoError('NOT_FOUND', 'JSON input file does not exist');
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
let result;
|
|
83
|
+
let operationFailed = false;
|
|
84
|
+
let operationError;
|
|
85
|
+
try {
|
|
86
|
+
const initial = await handle.stat({ bigint: true });
|
|
87
|
+
if (!initial.isFile()) {
|
|
88
|
+
throw invalidJsonInput();
|
|
89
|
+
}
|
|
90
|
+
if (initial.size < 0n || initial.size > BigInt(MAX_CLI_JSON_INPUT_BYTES)) {
|
|
91
|
+
throw invalidJsonInput();
|
|
92
|
+
}
|
|
93
|
+
const expectedSize = Number(initial.size);
|
|
94
|
+
const bytes = Buffer.allocUnsafe(expectedSize + 1);
|
|
95
|
+
let offset = 0;
|
|
96
|
+
while (offset < bytes.byteLength) {
|
|
97
|
+
const read = await handle.read(bytes, offset, bytes.byteLength - offset, offset);
|
|
98
|
+
if (read.bytesRead === 0)
|
|
99
|
+
break;
|
|
100
|
+
offset += read.bytesRead;
|
|
101
|
+
}
|
|
102
|
+
const final = await handle.stat({ bigint: true });
|
|
103
|
+
if (offset !== expectedSize
|
|
104
|
+
|| final.size !== initial.size
|
|
105
|
+
|| final.dev !== initial.dev
|
|
106
|
+
|| final.ino !== initial.ino
|
|
107
|
+
|| final.mtimeNs !== initial.mtimeNs
|
|
108
|
+
|| final.ctimeNs !== initial.ctimeNs) {
|
|
109
|
+
throw new KiokukoError('CONFLICT', 'JSON input file changed while it was being read');
|
|
110
|
+
}
|
|
111
|
+
result = bytes.subarray(0, offset);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
operationFailed = true;
|
|
115
|
+
operationError = error;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
await handle.close();
|
|
119
|
+
}
|
|
120
|
+
catch (closeError) {
|
|
121
|
+
if (operationFailed) {
|
|
122
|
+
throw new AggregateError([operationError, closeError], 'JSON input read failed and its file descriptor could not be closed');
|
|
123
|
+
}
|
|
124
|
+
throw new AggregateError([closeError], 'JSON input was read, but its file descriptor could not be closed');
|
|
125
|
+
}
|
|
126
|
+
if (operationFailed) {
|
|
127
|
+
if (operationError instanceof KiokukoError && operationError.code === 'VALIDATION_ERROR') {
|
|
128
|
+
throw operationError;
|
|
129
|
+
}
|
|
130
|
+
throw operationError;
|
|
131
|
+
}
|
|
132
|
+
if (result === undefined)
|
|
133
|
+
throw invalidJsonInput();
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
async function readJsonInput(filePath) {
|
|
137
|
+
const bytes = filePath === '-' ? await readBoundedStdin() : await readBoundedJsonFile(filePath);
|
|
138
|
+
let text;
|
|
139
|
+
try {
|
|
140
|
+
text = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
throw invalidJsonInput();
|
|
144
|
+
}
|
|
145
|
+
return parseStrictJson(text, { allowTrailingComma: false, disallowComments: true, allowEmptyContent: false }, 'Input is not valid JSON with unique keys');
|
|
146
|
+
}
|
|
147
|
+
async function withDatabase(operation, options = {}) {
|
|
148
|
+
const result = await initializeDatabase(options);
|
|
149
|
+
const database = openConnection(result.databasePath);
|
|
150
|
+
let operationResult;
|
|
151
|
+
let operationFailed = false;
|
|
152
|
+
let operationError;
|
|
153
|
+
try {
|
|
154
|
+
operationResult = { value: await operation(database) };
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
operationFailed = true;
|
|
158
|
+
operationError = error;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
database.close();
|
|
162
|
+
}
|
|
163
|
+
catch (closeError) {
|
|
164
|
+
if (operationFailed) {
|
|
165
|
+
throw new AggregateError([operationError, closeError], 'Database operation failed and closing its connection also failed');
|
|
166
|
+
}
|
|
167
|
+
throw new AggregateError([closeError], 'Database operation completed, but closing its connection failed');
|
|
168
|
+
}
|
|
169
|
+
if (operationFailed)
|
|
170
|
+
throw operationError;
|
|
171
|
+
if (operationResult === undefined) {
|
|
172
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Database operation produced no result');
|
|
173
|
+
}
|
|
174
|
+
return operationResult.value;
|
|
175
|
+
}
|
|
176
|
+
async function withEmbeddingDatabase(dependencies, operation, options = {}) {
|
|
177
|
+
const initialized = await initializeDatabase(options);
|
|
178
|
+
const config = dependencies.embeddingEnvironment === undefined
|
|
179
|
+
? undefined
|
|
180
|
+
: parseEmbeddingConfig(dependencies.embeddingEnvironment);
|
|
181
|
+
const opened = await openEmbeddingDatabase(initialized.databasePath, {
|
|
182
|
+
...(config === undefined ? {} : { config }),
|
|
183
|
+
...(dependencies.embeddingBackend === undefined ? {} : { backend: dependencies.embeddingBackend }),
|
|
184
|
+
});
|
|
185
|
+
let operationResult;
|
|
186
|
+
let operationFailed = false;
|
|
187
|
+
let operationError;
|
|
188
|
+
try {
|
|
189
|
+
operationResult = { value: await operation(opened.database, opened.backend) };
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
operationFailed = true;
|
|
193
|
+
operationError = error;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
opened.database.close();
|
|
197
|
+
}
|
|
198
|
+
catch (closeError) {
|
|
199
|
+
if (operationFailed) {
|
|
200
|
+
throw new AggregateError([operationError, closeError], 'Embedding database operation failed and closing its connection also failed');
|
|
201
|
+
}
|
|
202
|
+
throw new AggregateError([closeError], 'Embedding database operation completed, but closing its connection failed');
|
|
203
|
+
}
|
|
204
|
+
if (operationFailed)
|
|
205
|
+
throw operationError;
|
|
206
|
+
if (operationResult === undefined) {
|
|
207
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Embedding database operation produced no result');
|
|
208
|
+
}
|
|
209
|
+
return operationResult.value;
|
|
210
|
+
}
|
|
211
|
+
function emit(value) {
|
|
212
|
+
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
213
|
+
}
|
|
214
|
+
function humanOrJson(json, operation, data, message, meta) {
|
|
215
|
+
if (json)
|
|
216
|
+
emit(successEnvelope(operation, data, meta));
|
|
217
|
+
else
|
|
218
|
+
process.stdout.write(`${message}\n`);
|
|
219
|
+
}
|
|
220
|
+
function parseExpectedRevision(value) {
|
|
221
|
+
if (value === undefined)
|
|
222
|
+
throw new KiokukoError('USAGE_ERROR', '--expected-revision is required');
|
|
223
|
+
const revision = Number(value);
|
|
224
|
+
if (!Number.isInteger(revision) || revision < 1)
|
|
225
|
+
throw new KiokukoError('VALIDATION_ERROR', 'expected revision must be a positive integer');
|
|
226
|
+
return revision;
|
|
227
|
+
}
|
|
228
|
+
function addWorkspaceOptions(command) {
|
|
229
|
+
return command.option('--workspace <name>', 'Workspace name').option('--json', 'Emit a JSON response');
|
|
230
|
+
}
|
|
231
|
+
async function withPreparedSemanticRuntime(dependencies, database, selectedBackend, query, operation) {
|
|
232
|
+
const config = dependencies.embeddingEnvironment === undefined
|
|
233
|
+
? undefined
|
|
234
|
+
: parseEmbeddingConfig(dependencies.embeddingEnvironment);
|
|
235
|
+
const runtime = createEmbeddingRuntime(database, config, {
|
|
236
|
+
...(dependencies.embeddingProvider === undefined ? {} : { provider: dependencies.embeddingProvider }),
|
|
237
|
+
...((selectedBackend ?? dependencies.embeddingBackend) === undefined
|
|
238
|
+
? {}
|
|
239
|
+
: { backend: selectedBackend ?? dependencies.embeddingBackend }),
|
|
240
|
+
});
|
|
241
|
+
let operationResult;
|
|
242
|
+
let operationError;
|
|
243
|
+
try {
|
|
244
|
+
if (runtime.profileId !== null) {
|
|
245
|
+
await runtime.drain({ maxJobs: 8, deadlineMs: 1_500 });
|
|
246
|
+
}
|
|
247
|
+
const searchRuntime = await prepareEmbeddingSearchRuntime(runtime, database, query);
|
|
248
|
+
operationResult = { value: await operation(searchRuntime) };
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
operationError = error;
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
await runtime.close();
|
|
255
|
+
}
|
|
256
|
+
catch (closeError) {
|
|
257
|
+
if (operationError !== undefined) {
|
|
258
|
+
throw new AggregateError([operationError, closeError], 'Semantic search failed and its runtime could not be closed');
|
|
259
|
+
}
|
|
260
|
+
throw closeError;
|
|
261
|
+
}
|
|
262
|
+
if (operationError !== undefined)
|
|
263
|
+
throw operationError;
|
|
264
|
+
if (operationResult === undefined)
|
|
265
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Semantic search produced no result');
|
|
266
|
+
return operationResult.value;
|
|
267
|
+
}
|
|
268
|
+
function configureRecallCommand(command, dependencies) {
|
|
269
|
+
const recall = addWorkspaceOptions(command.description('Human/operator management: recall relevant memory entries').argument('<query>'))
|
|
270
|
+
.option('--limit <number>', 'Maximum entries', '5').option('--max-chars <number>', 'Context character budget', '8000')
|
|
271
|
+
.option('--scope <scope>', 'auto, project, ecosystem, or global', 'auto').option('--cwd <path>', 'Repository path used for scoped recall');
|
|
272
|
+
recall.action(async (query, options) => {
|
|
273
|
+
let data;
|
|
274
|
+
if (options.workspace !== undefined) {
|
|
275
|
+
data = await withEmbeddingDatabase(dependencies, (database, backend) => withPreparedSemanticRuntime(dependencies, database, backend, query, (runtime) => recallEntries(database, { workspace: String(options.workspace), query, limit: Number(options.limit), maxChars: Number(options.maxChars) }, runtime)));
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
data = await withEmbeddingDatabase(dependencies, (database, backend) => withPreparedSemanticRuntime(dependencies, database, backend, query, (runtime) => recallScopedMemory(database, {
|
|
279
|
+
query,
|
|
280
|
+
scope: String(options.scope ?? 'auto'),
|
|
281
|
+
limit: Number(options.limit),
|
|
282
|
+
maxChars: Number(options.maxChars),
|
|
283
|
+
...(typeof options.cwd === 'string' ? { cwd: options.cwd } : {}),
|
|
284
|
+
}, runtime)));
|
|
285
|
+
}
|
|
286
|
+
const items = 'items' in data ? data.items : data.combined?.items ?? data.ecosystem?.items ?? data.global?.items ?? data.project?.memory.items ?? [];
|
|
287
|
+
const count = 'count' in data ? data.count : items.length;
|
|
288
|
+
const truncated = 'truncated' in data ? data.truncated : data.combined?.truncated ?? data.ecosystem?.truncated ?? false;
|
|
289
|
+
humanOrJson(options.json === true, 'recall', data, `${items.length} memory entries recalled`, { count, truncated });
|
|
290
|
+
});
|
|
291
|
+
return recall;
|
|
292
|
+
}
|
|
293
|
+
const CALL_OPERATIONS = [
|
|
294
|
+
'init',
|
|
295
|
+
'use',
|
|
296
|
+
'record',
|
|
297
|
+
'curator',
|
|
298
|
+
'curator_globalize',
|
|
299
|
+
'guide_start',
|
|
300
|
+
'guide_answer',
|
|
301
|
+
'promote',
|
|
302
|
+
'supersede',
|
|
303
|
+
'link',
|
|
304
|
+
'purge',
|
|
305
|
+
'export',
|
|
306
|
+
'import',
|
|
307
|
+
'backup',
|
|
308
|
+
'doctor',
|
|
309
|
+
];
|
|
310
|
+
const SUPPORTED_CALL_OPERATIONS = new Set(CALL_OPERATIONS);
|
|
311
|
+
function snapshotPlainJsonObject(value, message) {
|
|
312
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
313
|
+
throw new KiokukoError('VALIDATION_ERROR', message);
|
|
314
|
+
}
|
|
315
|
+
const prototype = Object.getPrototypeOf(value);
|
|
316
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
317
|
+
throw new KiokukoError('VALIDATION_ERROR', message);
|
|
318
|
+
}
|
|
319
|
+
const result = Object.create(null);
|
|
320
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
321
|
+
if (typeof key !== 'string')
|
|
322
|
+
throw new KiokukoError('VALIDATION_ERROR', message);
|
|
323
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
324
|
+
if (descriptor === undefined || !('value' in descriptor) || descriptor.enumerable !== true) {
|
|
325
|
+
throw new KiokukoError('VALIDATION_ERROR', message);
|
|
326
|
+
}
|
|
327
|
+
Object.defineProperty(result, key, {
|
|
328
|
+
value: descriptor.value,
|
|
329
|
+
enumerable: true,
|
|
330
|
+
writable: true,
|
|
331
|
+
configurable: true,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
function assertExactCallArguments(args, operation, allowed, required = []) {
|
|
337
|
+
const allowedFields = new Set(allowed);
|
|
338
|
+
for (const field of Object.keys(args)) {
|
|
339
|
+
if (!allowedFields.has(field)) {
|
|
340
|
+
throw new KiokukoError('VALIDATION_ERROR', `Unknown ${operation} argument: ${field}`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
for (const field of required) {
|
|
344
|
+
if (!Object.hasOwn(args, field)) {
|
|
345
|
+
throw new KiokukoError('VALIDATION_ERROR', `${operation}.${field} is required`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function requiredStringArgument(args, operation, field) {
|
|
350
|
+
const value = args[field];
|
|
351
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
352
|
+
throw new KiokukoError('VALIDATION_ERROR', `${operation}.${field} must be a non-empty string`);
|
|
353
|
+
}
|
|
354
|
+
return value;
|
|
355
|
+
}
|
|
356
|
+
function optionalStringArgument(args, operation, field) {
|
|
357
|
+
return Object.hasOwn(args, field) ? requiredStringArgument(args, operation, field) : undefined;
|
|
358
|
+
}
|
|
359
|
+
function requiredPathArgument(args, operation, field) {
|
|
360
|
+
const value = requiredStringArgument(args, operation, field);
|
|
361
|
+
if (CONTROL_CHARACTERS.test(value) || Buffer.byteLength(value, 'utf8') > MAX_CALL_PATH_BYTES) {
|
|
362
|
+
throw new KiokukoError('VALIDATION_ERROR', `${operation}.${field} must be a bounded path without control characters`);
|
|
363
|
+
}
|
|
364
|
+
return value;
|
|
365
|
+
}
|
|
366
|
+
function optionalPathArgument(args, operation, field) {
|
|
367
|
+
return Object.hasOwn(args, field) ? requiredPathArgument(args, operation, field) : undefined;
|
|
368
|
+
}
|
|
369
|
+
function requiredBooleanArgument(args, operation, field) {
|
|
370
|
+
const value = args[field];
|
|
371
|
+
if (typeof value !== 'boolean') {
|
|
372
|
+
throw new KiokukoError('VALIDATION_ERROR', `${operation}.${field} must be a boolean`);
|
|
373
|
+
}
|
|
374
|
+
return value;
|
|
375
|
+
}
|
|
376
|
+
function optionalBooleanArgument(args, operation, field) {
|
|
377
|
+
return Object.hasOwn(args, field) ? requiredBooleanArgument(args, operation, field) : undefined;
|
|
378
|
+
}
|
|
379
|
+
function requiredPositiveIntegerArgument(args, operation, field) {
|
|
380
|
+
const value = args[field];
|
|
381
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 1) {
|
|
382
|
+
throw new KiokukoError('VALIDATION_ERROR', `${operation}.${field} must be a positive integer`);
|
|
383
|
+
}
|
|
384
|
+
return value;
|
|
385
|
+
}
|
|
386
|
+
function validateUseCallArguments(args) {
|
|
387
|
+
const operation = 'use';
|
|
388
|
+
assertExactCallArguments(args, operation, [
|
|
389
|
+
'cwd',
|
|
390
|
+
'root',
|
|
391
|
+
'workspace',
|
|
392
|
+
'agentFile',
|
|
393
|
+
'dryRun',
|
|
394
|
+
'noAgentFile',
|
|
395
|
+
'forceRebind',
|
|
396
|
+
'allowDirectory',
|
|
397
|
+
'databasePath',
|
|
398
|
+
'migrationsDirectory',
|
|
399
|
+
'repositoryId',
|
|
400
|
+
]);
|
|
401
|
+
const result = {};
|
|
402
|
+
const cwd = optionalPathArgument(args, operation, 'cwd');
|
|
403
|
+
const root = optionalPathArgument(args, operation, 'root');
|
|
404
|
+
const workspace = optionalStringArgument(args, operation, 'workspace');
|
|
405
|
+
const agentFile = optionalPathArgument(args, operation, 'agentFile');
|
|
406
|
+
const databasePath = optionalPathArgument(args, operation, 'databasePath');
|
|
407
|
+
const migrationsDirectory = optionalPathArgument(args, operation, 'migrationsDirectory');
|
|
408
|
+
const repositoryId = optionalStringArgument(args, operation, 'repositoryId');
|
|
409
|
+
const dryRun = optionalBooleanArgument(args, operation, 'dryRun');
|
|
410
|
+
const noAgentFile = optionalBooleanArgument(args, operation, 'noAgentFile');
|
|
411
|
+
const forceRebind = optionalBooleanArgument(args, operation, 'forceRebind');
|
|
412
|
+
const allowDirectory = optionalBooleanArgument(args, operation, 'allowDirectory');
|
|
413
|
+
if (cwd !== undefined)
|
|
414
|
+
result.cwd = cwd;
|
|
415
|
+
if (root !== undefined)
|
|
416
|
+
result.root = root;
|
|
417
|
+
if (workspace !== undefined)
|
|
418
|
+
result.workspace = workspace;
|
|
419
|
+
if (agentFile !== undefined)
|
|
420
|
+
result.agentFile = agentFile;
|
|
421
|
+
if (databasePath !== undefined)
|
|
422
|
+
result.databasePath = databasePath;
|
|
423
|
+
if (migrationsDirectory !== undefined)
|
|
424
|
+
result.migrationsDirectory = migrationsDirectory;
|
|
425
|
+
if (repositoryId !== undefined)
|
|
426
|
+
result.repositoryId = repositoryId;
|
|
427
|
+
if (dryRun !== undefined)
|
|
428
|
+
result.dryRun = dryRun;
|
|
429
|
+
if (noAgentFile !== undefined)
|
|
430
|
+
result.noAgentFile = noAgentFile;
|
|
431
|
+
if (forceRebind !== undefined)
|
|
432
|
+
result.forceRebind = forceRebind;
|
|
433
|
+
if (allowDirectory !== undefined)
|
|
434
|
+
result.allowDirectory = allowDirectory;
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function validateRecordCallArguments(args) {
|
|
438
|
+
return validateRecordInput(args);
|
|
439
|
+
}
|
|
440
|
+
function validateCuratorCallArguments(args) {
|
|
441
|
+
const operation = 'curator';
|
|
442
|
+
assertExactCallArguments(args, operation, ['workspace', 'cwd', 'limit', 'entryId', 'yes']);
|
|
443
|
+
const workspace = optionalStringArgument(args, operation, 'workspace');
|
|
444
|
+
const cwd = optionalPathArgument(args, operation, 'cwd');
|
|
445
|
+
const entryId = optionalStringArgument(args, operation, 'entryId');
|
|
446
|
+
const yes = optionalBooleanArgument(args, operation, 'yes');
|
|
447
|
+
const limit = Object.hasOwn(args, 'limit')
|
|
448
|
+
? requiredPositiveIntegerArgument(args, operation, 'limit')
|
|
449
|
+
: undefined;
|
|
450
|
+
if (limit !== undefined && limit > 50) {
|
|
451
|
+
throw new KiokukoError('VALIDATION_ERROR', 'curator.limit must be an integer between 1 and 50');
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
455
|
+
...(cwd === undefined ? {} : { cwd }),
|
|
456
|
+
...(limit === undefined ? {} : { limit }),
|
|
457
|
+
...(entryId === undefined ? {} : { entryId }),
|
|
458
|
+
...(yes === undefined ? {} : { yes }),
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function validateCuratorGlobalizeCallArguments(args) {
|
|
462
|
+
const operation = 'curator_globalize';
|
|
463
|
+
assertExactCallArguments(args, operation, ['workspace', 'entryId', 'expectedRevision', 'actor'], ['workspace', 'entryId', 'expectedRevision']);
|
|
464
|
+
const actor = optionalStringArgument(args, operation, 'actor');
|
|
465
|
+
return {
|
|
466
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
467
|
+
entryId: requiredStringArgument(args, operation, 'entryId'),
|
|
468
|
+
expectedRevision: requiredPositiveIntegerArgument(args, operation, 'expectedRevision'),
|
|
469
|
+
...(actor === undefined ? {} : { actor }),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function validateGuideStartCallArguments(args) {
|
|
473
|
+
const operation = 'guide_start';
|
|
474
|
+
assertExactCallArguments(args, operation, ['workspace', 'task'], ['workspace', 'task']);
|
|
475
|
+
return {
|
|
476
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
477
|
+
task: requiredStringArgument(args, operation, 'task'),
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function validateGuideAnswerCallArguments(args) {
|
|
481
|
+
const operation = 'guide_answer';
|
|
482
|
+
assertExactCallArguments(args, operation, ['workspace', 'sessionId', 'questionId', 'value'], ['workspace', 'sessionId', 'questionId', 'value']);
|
|
483
|
+
const questionId = requiredStringArgument(args, operation, 'questionId');
|
|
484
|
+
if (!['taskType', 'target', 'expected', 'constraints'].includes(questionId)) {
|
|
485
|
+
throw new KiokukoError('VALIDATION_ERROR', 'guide_answer.questionId is unsupported');
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
489
|
+
sessionId: requiredStringArgument(args, operation, 'sessionId'),
|
|
490
|
+
questionId: questionId,
|
|
491
|
+
value: requiredStringArgument(args, operation, 'value'),
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function validatePromoteCallArguments(args) {
|
|
495
|
+
const operation = 'promote';
|
|
496
|
+
assertExactCallArguments(args, operation, ['workspace', 'entryId', 'expectedRevision'], ['workspace', 'entryId', 'expectedRevision']);
|
|
497
|
+
return {
|
|
498
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
499
|
+
entryId: requiredStringArgument(args, operation, 'entryId'),
|
|
500
|
+
expectedRevision: requiredPositiveIntegerArgument(args, operation, 'expectedRevision'),
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
function validateSupersedeCallArguments(args) {
|
|
504
|
+
const operation = 'supersede';
|
|
505
|
+
assertExactCallArguments(args, operation, ['workspace', 'oldEntryId', 'replacementEntryId', 'expectedRevision'], ['workspace', 'oldEntryId', 'replacementEntryId', 'expectedRevision']);
|
|
506
|
+
return {
|
|
507
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
508
|
+
oldEntryId: requiredStringArgument(args, operation, 'oldEntryId'),
|
|
509
|
+
replacementEntryId: requiredStringArgument(args, operation, 'replacementEntryId'),
|
|
510
|
+
expectedRevision: requiredPositiveIntegerArgument(args, operation, 'expectedRevision'),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function validateLinkCallArguments(args) {
|
|
514
|
+
const operation = 'link';
|
|
515
|
+
assertExactCallArguments(args, operation, ['workspace', 'fromEntryId', 'toEntryId', 'relation', 'actor', 'now'], ['workspace', 'fromEntryId', 'toEntryId', 'relation']);
|
|
516
|
+
const relation = requiredStringArgument(args, operation, 'relation');
|
|
517
|
+
if (!['supports', 'contradicts', 'derived_from', 'related_to'].includes(relation)) {
|
|
518
|
+
throw new KiokukoError('VALIDATION_ERROR', 'link.relation is unsupported');
|
|
519
|
+
}
|
|
520
|
+
const actor = optionalStringArgument(args, operation, 'actor');
|
|
521
|
+
const now = optionalStringArgument(args, operation, 'now');
|
|
522
|
+
return {
|
|
523
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
524
|
+
fromEntryId: requiredStringArgument(args, operation, 'fromEntryId'),
|
|
525
|
+
toEntryId: requiredStringArgument(args, operation, 'toEntryId'),
|
|
526
|
+
relation: relation,
|
|
527
|
+
...(actor === undefined ? {} : { actor }),
|
|
528
|
+
...(now === undefined ? {} : { now }),
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function validatePurgeCallArguments(args) {
|
|
532
|
+
const operation = 'purge';
|
|
533
|
+
assertExactCallArguments(args, operation, ['workspace', 'entryId', 'confirm'], ['workspace', 'entryId', 'confirm']);
|
|
534
|
+
return {
|
|
535
|
+
workspace: requiredStringArgument(args, operation, 'workspace'),
|
|
536
|
+
entryId: requiredStringArgument(args, operation, 'entryId'),
|
|
537
|
+
confirm: requiredBooleanArgument(args, operation, 'confirm'),
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function parseCallRequest(request) {
|
|
541
|
+
const value = snapshotPlainJsonObject(request, 'Request must be a JSON object');
|
|
542
|
+
const fields = Object.keys(value).sort();
|
|
543
|
+
if (fields.length !== 3
|
|
544
|
+
|| fields[0] !== 'apiVersion'
|
|
545
|
+
|| fields[1] !== 'arguments'
|
|
546
|
+
|| fields[2] !== 'operation') {
|
|
547
|
+
throw new KiokukoError('VALIDATION_ERROR', 'Request must contain exactly apiVersion, operation, and arguments');
|
|
548
|
+
}
|
|
549
|
+
if (value.apiVersion !== '1') {
|
|
550
|
+
throw new KiokukoError('VALIDATION_ERROR', 'apiVersion must be "1"');
|
|
551
|
+
}
|
|
552
|
+
if (typeof value.operation !== 'string' || value.operation.length === 0) {
|
|
553
|
+
throw new KiokukoError('VALIDATION_ERROR', 'operation must be a non-empty string');
|
|
554
|
+
}
|
|
555
|
+
const args = snapshotPlainJsonObject(value.arguments, 'arguments must be a JSON object');
|
|
556
|
+
if (!SUPPORTED_CALL_OPERATIONS.has(value.operation)) {
|
|
557
|
+
throw new KiokukoError('VALIDATION_ERROR', `Unknown operation: ${value.operation}`);
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
apiVersion: '1',
|
|
561
|
+
operation: value.operation,
|
|
562
|
+
arguments: args,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
async function dispatchRequest(request) {
|
|
566
|
+
const args = request.arguments;
|
|
567
|
+
const operation = request.operation;
|
|
568
|
+
if (operation === 'init') {
|
|
569
|
+
assertExactCallArguments(args, operation, []);
|
|
570
|
+
return initializeDatabase();
|
|
571
|
+
}
|
|
572
|
+
if (operation === 'use')
|
|
573
|
+
return useRepository(validateUseCallArguments(args));
|
|
574
|
+
if (operation === 'record') {
|
|
575
|
+
const input = validateRecordCallArguments(args);
|
|
576
|
+
return withDatabase((database) => recordEntry(database, input));
|
|
577
|
+
}
|
|
578
|
+
if (operation === 'curator') {
|
|
579
|
+
const input = validateCuratorCallArguments(args);
|
|
580
|
+
return withDatabase((database) => runCuratorCommand(database, { ...input, json: true }));
|
|
581
|
+
}
|
|
582
|
+
if (operation === 'curator_globalize') {
|
|
583
|
+
const input = validateCuratorGlobalizeCallArguments(args);
|
|
584
|
+
return withDatabase((database) => globalizeCuratorCandidate(database, input));
|
|
585
|
+
}
|
|
586
|
+
if (operation === 'guide_start') {
|
|
587
|
+
const input = validateGuideStartCallArguments(args);
|
|
588
|
+
return withDatabase((database) => startAkinator(database, input));
|
|
589
|
+
}
|
|
590
|
+
if (operation === 'guide_answer') {
|
|
591
|
+
const input = validateGuideAnswerCallArguments(args);
|
|
592
|
+
return withDatabase((database) => answerAkinator(database, input));
|
|
593
|
+
}
|
|
594
|
+
if (operation === 'promote') {
|
|
595
|
+
const input = validatePromoteCallArguments(args);
|
|
596
|
+
return withDatabase((database) => promoteEntry(database, input));
|
|
597
|
+
}
|
|
598
|
+
if (operation === 'supersede') {
|
|
599
|
+
const input = validateSupersedeCallArguments(args);
|
|
600
|
+
return withDatabase((database) => supersedeEntry(database, input));
|
|
601
|
+
}
|
|
602
|
+
if (operation === 'link') {
|
|
603
|
+
const input = validateLinkCallArguments(args);
|
|
604
|
+
return withDatabase((database) => {
|
|
605
|
+
linkEntries(database, input);
|
|
606
|
+
return { linked: true };
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
if (operation === 'purge') {
|
|
610
|
+
const input = validatePurgeCallArguments(args);
|
|
611
|
+
return withDatabase((database) => {
|
|
612
|
+
purgeEntry(database, input);
|
|
613
|
+
return { purged: true };
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
if (operation === 'export') {
|
|
617
|
+
assertExactCallArguments(args, operation, ['workspace', 'output']);
|
|
618
|
+
if (!Object.hasOwn(args, 'output')) {
|
|
619
|
+
throw new KiokukoError('VALIDATION_ERROR', 'export output is required');
|
|
620
|
+
}
|
|
621
|
+
const workspace = requiredStringArgument(args, operation, 'workspace');
|
|
622
|
+
const output = requiredPathArgument(args, operation, 'output');
|
|
623
|
+
return withDatabase((database) => writeExport(database, { workspace, output }));
|
|
624
|
+
}
|
|
625
|
+
if (operation === 'import') {
|
|
626
|
+
assertExactCallArguments(args, operation, ['input', 'workspace', 'dryRun']);
|
|
627
|
+
if (!Object.hasOwn(args, 'input')) {
|
|
628
|
+
throw new KiokukoError('VALIDATION_ERROR', 'import input is required');
|
|
629
|
+
}
|
|
630
|
+
const input = requiredPathArgument(args, operation, 'input');
|
|
631
|
+
const workspace = optionalStringArgument(args, operation, 'workspace');
|
|
632
|
+
const dryRun = optionalBooleanArgument(args, operation, 'dryRun');
|
|
633
|
+
const importOptions = {
|
|
634
|
+
input,
|
|
635
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
636
|
+
...(dryRun === undefined ? {} : { dryRun }),
|
|
637
|
+
};
|
|
638
|
+
return dryRun === true
|
|
639
|
+
? importWorkspace(undefined, importOptions)
|
|
640
|
+
: withDatabase((database) => importWorkspace(database, importOptions));
|
|
641
|
+
}
|
|
642
|
+
if (operation === 'backup') {
|
|
643
|
+
assertExactCallArguments(args, operation, ['output']);
|
|
644
|
+
if (!Object.hasOwn(args, 'output')) {
|
|
645
|
+
throw new KiokukoError('VALIDATION_ERROR', 'backup output is required');
|
|
646
|
+
}
|
|
647
|
+
const output = requiredPathArgument(args, operation, 'output');
|
|
648
|
+
return createBackup(output);
|
|
649
|
+
}
|
|
650
|
+
if (operation === 'doctor') {
|
|
651
|
+
assertExactCallArguments(args, operation, []);
|
|
652
|
+
return runDoctor();
|
|
653
|
+
}
|
|
654
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Supported call operation has no dispatcher');
|
|
655
|
+
}
|
|
656
|
+
export function buildCli(dependencies = {}) {
|
|
657
|
+
const cli = new Command();
|
|
658
|
+
cli.name('kiokuko').description('Model-agnostic external memory for AI coding agents').version(PACKAGE_VERSION);
|
|
659
|
+
cli.exitOverride();
|
|
660
|
+
cli.configureOutput({ outputError: () => undefined });
|
|
661
|
+
cli.command('version').description('Show the Kiokuko package version').action(() => {
|
|
662
|
+
process.stdout.write(`${PACKAGE_VERSION}\n`);
|
|
663
|
+
});
|
|
664
|
+
cli.command('init').description('Initialize the global Kiokuko database').option('--json').action(async (options) => {
|
|
665
|
+
const result = await initializeDatabase();
|
|
666
|
+
const backupNotice = result.backupPath === null ? '' : ` Pre-migration backup: ${result.backupPath}`;
|
|
667
|
+
humanOrJson(options.json, 'init', result, `Kiokuko database initialized (version ${result.currentVersion}).${backupNotice}`);
|
|
668
|
+
});
|
|
669
|
+
cli.command('setup').description('Configure global Kiokuko memory and refresh managed instructions in registered projects for Codex, OpenCode, Claude Code, and Hermes Agent')
|
|
670
|
+
.option('--clients <clients>', 'Comma-separated clients: codex,opencode,claude,hermes')
|
|
671
|
+
.option('--command <path>', 'Kiokuko executable name or absolute path', 'kiokuko')
|
|
672
|
+
.option('--dry-run', 'Validate and show planned changes without writing')
|
|
673
|
+
.option('--no-standard-skills', 'Skip installing bundled Kiokuko standard skills')
|
|
674
|
+
.option('--skill-discovery <mode>', 'External Skill discovery: off,official,community')
|
|
675
|
+
.option('--enno-oduno <mode>', 'Enno-Oduno agent loop: on,off')
|
|
676
|
+
.option('--json', 'Emit a JSON response')
|
|
677
|
+
.action(async (options) => {
|
|
678
|
+
const optionSkillDiscoveryMode = options.skillDiscovery === undefined
|
|
679
|
+
? undefined
|
|
680
|
+
: parseSetupSkillDiscoveryMode(options.skillDiscovery);
|
|
681
|
+
const setupEnvironment = dependencies.setupEnvironment ?? {};
|
|
682
|
+
const setupInput = dependencies.setupInput ?? process.stdin;
|
|
683
|
+
const setupOutput = dependencies.setupOutput ?? process.stdout;
|
|
684
|
+
const clients = options.clients === undefined ? undefined : parseSetupClients(options.clients);
|
|
685
|
+
const data = await runSetupFlow({
|
|
686
|
+
environment: setupEnvironment,
|
|
687
|
+
...(clients === undefined ? {} : { clients }),
|
|
688
|
+
command: options.command,
|
|
689
|
+
dryRun: options.dryRun === true,
|
|
690
|
+
standardSkills: options.standardSkills,
|
|
691
|
+
...(optionSkillDiscoveryMode === undefined ? {} : { skillDiscoveryMode: optionSkillDiscoveryMode }),
|
|
692
|
+
...(options.ennoOduno === undefined ? {} : { ennoOduno: parseEnnoSetupMode(options.ennoOduno) }),
|
|
693
|
+
json: options.json === true,
|
|
694
|
+
input: setupInput,
|
|
695
|
+
output: setupOutput,
|
|
696
|
+
});
|
|
697
|
+
const changed = data.files.filter((file) => file.action !== 'unchanged').length;
|
|
698
|
+
const projectChanged = data.projectAgentFiles.filter((file) => file.status === 'created' || file.status === 'updated').length;
|
|
699
|
+
const projectUnchanged = data.projectAgentFiles.filter((file) => file.status === 'unchanged').length;
|
|
700
|
+
const projectSkipped = data.projectAgentFiles.filter((file) => file.status === 'skipped').length;
|
|
701
|
+
const projectFailed = data.projectAgentFiles.filter((file) => file.status === 'failed').length;
|
|
702
|
+
const projectSummary = data.projectAgentFiles.length === 0
|
|
703
|
+
? ''
|
|
704
|
+
: ` Registered project instructions: ${projectChanged} changed, ${projectUnchanged} unchanged, ${projectSkipped} skipped, ${projectFailed} failed.`;
|
|
705
|
+
const clientLabel = data.clients.length === 0 ? 'no detected clients' : data.clients.join(', ');
|
|
706
|
+
const message = options.dryRun
|
|
707
|
+
? `Kiokuko setup plan for ${clientLabel}: ${changed} file${changed === 1 ? '' : 's'} would change.${projectSummary}`
|
|
708
|
+
: data.clients.length === 0
|
|
709
|
+
? `Kiokuko database initialized; no supported client executable was detected. Use --clients codex,opencode,claude,hermes to configure clients.${projectSummary}`
|
|
710
|
+
: `Now you are ready to use Kiokuko! Kiokuko configured for ${clientLabel} (${changed} file${changed === 1 ? '' : 's'} changed).${data.databaseBackupPath === null ? '' : ` Pre-migration backup: ${data.databaseBackupPath}.`}${data.recoveredEntries === 0 ? '' : ` Recovered by excluding ${data.recoveredEntries} unreadable memor${data.recoveredEntries === 1 ? 'y' : 'ies'}; the pre-migration backup retains the original data.`}${projectSummary} ${data.nextStep}`;
|
|
711
|
+
humanOrJson(options.json, 'setup', data, message);
|
|
712
|
+
});
|
|
713
|
+
cli.command('mcp').description('Run the Kiokuko MCP server over stdio').action(async () => {
|
|
714
|
+
await runMcpServer();
|
|
715
|
+
});
|
|
716
|
+
cli.command('use').description('Bind this repository to Kiokuko external memory')
|
|
717
|
+
.option('--root <path>').option('--workspace <name>').option('--agent-file <path>', 'Agent instruction file')
|
|
718
|
+
.option('--dry-run').option('--no-agent-file').option('--force-rebind').option('--allow-directory').option('--json')
|
|
719
|
+
.action(async (options) => {
|
|
720
|
+
const useOptions = {};
|
|
721
|
+
if (typeof options.root === 'string')
|
|
722
|
+
useOptions.root = options.root;
|
|
723
|
+
if (typeof options.workspace === 'string')
|
|
724
|
+
useOptions.workspace = options.workspace;
|
|
725
|
+
if (typeof options.agentFile === 'string')
|
|
726
|
+
useOptions.agentFile = options.agentFile;
|
|
727
|
+
if (options.dryRun === true)
|
|
728
|
+
useOptions.dryRun = true;
|
|
729
|
+
if (options.noAgentFile === true)
|
|
730
|
+
useOptions.noAgentFile = true;
|
|
731
|
+
if (options.forceRebind === true)
|
|
732
|
+
useOptions.forceRebind = true;
|
|
733
|
+
if (options.allowDirectory === true)
|
|
734
|
+
useOptions.allowDirectory = true;
|
|
735
|
+
const result = await useRepository(useOptions);
|
|
736
|
+
humanOrJson(options.json === true, 'use', result, `Kiokuko enabled for ${result.repositoryRoot}`);
|
|
737
|
+
});
|
|
738
|
+
configureRecallCommand(cli.command('recall'), dependencies);
|
|
739
|
+
const memory = cli.command('memory').description('Human/operator memory management');
|
|
740
|
+
configureRecallCommand(memory.command('recall'), dependencies);
|
|
741
|
+
const guide = cli.command('guide').description('Run the Akinator-style knowledge and skill intake');
|
|
742
|
+
guide.command('start').description('Start an intake session').argument('<task>').requiredOption('--workspace <name>').option('--json').action(async (task, options) => {
|
|
743
|
+
const data = await withDatabase((database) => startAkinator(database, { workspace: options.workspace, task }));
|
|
744
|
+
humanOrJson(options.json, 'guide.start', data, data.question?.prompt ?? 'Akinator context is ready');
|
|
745
|
+
});
|
|
746
|
+
guide.command('answer').description('Answer the current intake question').argument('<session-id>').requiredOption('--workspace <name>').requiredOption('--question-id <id>').requiredOption('--value <value>').option('--json').action(async (sessionId, options) => {
|
|
747
|
+
const data = await withDatabase((database) => answerAkinator(database, {
|
|
748
|
+
workspace: options.workspace,
|
|
749
|
+
sessionId,
|
|
750
|
+
questionId: options.questionId,
|
|
751
|
+
value: options.value,
|
|
752
|
+
}));
|
|
753
|
+
humanOrJson(options.json, 'guide.answer', data, data.question?.prompt ?? 'Akinator context is ready');
|
|
754
|
+
});
|
|
755
|
+
const search = addWorkspaceOptions(cli.command('search').description('Human/operator management: search memory entries').argument('<query>'))
|
|
756
|
+
.option('--limit <number>', 'Maximum entries', '20').option('--kind <kind>').option('--status <status>').option('--tag <tag>');
|
|
757
|
+
search.action(async (query, options) => {
|
|
758
|
+
const searchOptions = { workspace: String(options.workspace ?? ''), query, limit: Number(options.limit) };
|
|
759
|
+
if (typeof options.kind === 'string')
|
|
760
|
+
searchOptions.kind = options.kind;
|
|
761
|
+
if (typeof options.status === 'string')
|
|
762
|
+
searchOptions.status = options.status;
|
|
763
|
+
if (typeof options.tag === 'string')
|
|
764
|
+
searchOptions.tag = options.tag;
|
|
765
|
+
const data = await withEmbeddingDatabase(dependencies, (database, backend) => withPreparedSemanticRuntime(dependencies, database, backend, query, (runtime) => searchEntries(database, searchOptions, runtime)));
|
|
766
|
+
humanOrJson(options.json === true, 'search', data, `${data.items.length} memory entries found`, { count: data.count });
|
|
767
|
+
});
|
|
768
|
+
const read = addWorkspaceOptions(cli.command('read').description('Human/operator management: read one memory entry').argument('<entry-id>'));
|
|
769
|
+
read.action(async (entryId, options) => {
|
|
770
|
+
const data = await withDatabase((database) => readEntry(database, { workspace: String(options.workspace ?? ''), entryId }));
|
|
771
|
+
humanOrJson(options.json === true, 'read', data, `${data.title}\n${data.body}`);
|
|
772
|
+
});
|
|
773
|
+
const record = cli.command('record').description('Record a memory entry').requiredOption('--workspace <name>').requiredOption('--input-json <file>').option('--json');
|
|
774
|
+
record.action(async (options) => {
|
|
775
|
+
const parsed = snapshotPlainJsonObject(await readJsonInput(options.inputJson), 'record input must be a JSON object');
|
|
776
|
+
const input = validateRecordInput({ ...parsed, workspace: options.workspace });
|
|
777
|
+
const data = await withDatabase((database) => recordEntry(database, input));
|
|
778
|
+
humanOrJson(options.json, 'record', data, `Recorded ${data.id}`);
|
|
779
|
+
});
|
|
780
|
+
const promote = cli.command('promote').description('Promote a candidate entry').argument('<entry-id>').requiredOption('--workspace <name>').requiredOption('--expected-revision <number>').option('--json');
|
|
781
|
+
promote.action(async (entryId, options) => {
|
|
782
|
+
const data = await withDatabase((database) => promoteEntry(database, { workspace: options.workspace, entryId, expectedRevision: parseExpectedRevision(options.expectedRevision) }));
|
|
783
|
+
humanOrJson(options.json, 'promote', data, `Promoted ${data.id}`);
|
|
784
|
+
});
|
|
785
|
+
const curator = cli.command('curator').description('Review reusable knowledge and add confirmed candidates to global memory')
|
|
786
|
+
.option('--workspace <name>', 'Project workspace (defaults to the current repository)')
|
|
787
|
+
.option('--cwd <path>', 'Repository path used when resolving the current workspace')
|
|
788
|
+
.option('--entry-id <id>', 'Review one candidate entry')
|
|
789
|
+
.option('--limit <number>', 'Maximum candidates to review', '10')
|
|
790
|
+
.option('--skill-ready-only', 'Show only candidates backed by qualified independent Akinator runs')
|
|
791
|
+
.option('--yes', 'Add every displayed candidate without interactive prompts')
|
|
792
|
+
.option('--json', 'Emit candidates as JSON without changing memory');
|
|
793
|
+
curator.action(async (options) => {
|
|
794
|
+
const data = await withDatabase((database) => runCuratorCommand(database, {
|
|
795
|
+
...(options.workspace === undefined ? {} : { workspace: options.workspace }),
|
|
796
|
+
...(options.cwd === undefined ? {} : { cwd: options.cwd }),
|
|
797
|
+
limit: Number(options.limit),
|
|
798
|
+
...(options.entryId === undefined ? {} : { entryId: options.entryId }),
|
|
799
|
+
skillReadyOnly: options.skillReadyOnly === true,
|
|
800
|
+
yes: options.yes === true,
|
|
801
|
+
json: options.json === true,
|
|
802
|
+
}));
|
|
803
|
+
humanOrJson(options.json, 'curator', data, `${data.candidates.length} curator candidate${data.candidates.length === 1 ? '' : 's'} reviewed; ${data.globalized.length} added to global memory`);
|
|
804
|
+
});
|
|
805
|
+
const supersede = cli.command('supersede').description('Supersede an existing entry').argument('<old-entry-id>').requiredOption('--with <entry-id>').requiredOption('--workspace <name>').requiredOption('--expected-revision <number>').option('--json');
|
|
806
|
+
supersede.action(async (oldEntryId, options) => {
|
|
807
|
+
const data = await withDatabase((database) => supersedeEntry(database, { workspace: options.workspace, oldEntryId, replacementEntryId: options.with, expectedRevision: parseExpectedRevision(options.expectedRevision) }));
|
|
808
|
+
humanOrJson(options.json, 'supersede', data, `Superseded ${data.id}`);
|
|
809
|
+
});
|
|
810
|
+
const link = cli.command('link').description('Link two memory entries').argument('<from-entry-id>').argument('<to-entry-id>').requiredOption('--workspace <name>').requiredOption('--relation <relation>').option('--json');
|
|
811
|
+
link.action(async (fromEntryId, toEntryId, options) => {
|
|
812
|
+
const data = await withDatabase((database) => { linkEntries(database, { workspace: options.workspace, fromEntryId, toEntryId, relation: options.relation }); return { linked: true }; });
|
|
813
|
+
humanOrJson(options.json, 'link', data, `Linked ${fromEntryId} -> ${toEntryId}`);
|
|
814
|
+
});
|
|
815
|
+
const purge = cli.command('purge').description('Purge a memory entry').argument('<entry-id>').requiredOption('--workspace <name>').option('--confirm').option('--json');
|
|
816
|
+
purge.action(async (entryId, options) => {
|
|
817
|
+
const data = await withDatabase((database) => { purgeEntry(database, { workspace: options.workspace, entryId, confirm: options.confirm === true }); return { purged: true }; });
|
|
818
|
+
humanOrJson(options.json, 'purge', data, `Purged ${entryId}`);
|
|
819
|
+
});
|
|
820
|
+
cli.command('backup').description('Create a database backup').requiredOption('--output <path>').option('--json').action(async (options) => {
|
|
821
|
+
const result = await createBackup(options.output);
|
|
822
|
+
humanOrJson(options.json, 'backup', result, `Backup written to ${options.output}`);
|
|
823
|
+
});
|
|
824
|
+
cli.command('doctor').description('Check runtime, database, and Codex MCP configuration health; interactively clean missing repository locations').option('--json').action(async (options) => {
|
|
825
|
+
const doctorOptions = {
|
|
826
|
+
...(dependencies.doctorDatabasePath === undefined ? {} : { databasePath: dependencies.doctorDatabasePath }),
|
|
827
|
+
...(dependencies.doctorRuntimeDescriptorPath === undefined ? {} : { runtimeDescriptorPath: dependencies.doctorRuntimeDescriptorPath }),
|
|
828
|
+
...(dependencies.embeddingEnvironment === undefined ? {} : { embeddingEnvironment: dependencies.embeddingEnvironment }),
|
|
829
|
+
...(dependencies.embeddingBackend === undefined ? {} : { embeddingBackend: dependencies.embeddingBackend }),
|
|
830
|
+
};
|
|
831
|
+
const databaseOptions = dependencies.doctorDatabasePath === undefined
|
|
832
|
+
? {}
|
|
833
|
+
: { databasePath: dependencies.doctorDatabasePath };
|
|
834
|
+
let data = await runDoctor(doctorOptions);
|
|
835
|
+
let removed = 0;
|
|
836
|
+
const input = dependencies.doctorInput ?? process.stdin;
|
|
837
|
+
const output = dependencies.doctorOutput ?? process.stdout;
|
|
838
|
+
const interactive = options.json !== true
|
|
839
|
+
&& input.isTTY === true
|
|
840
|
+
&& output.isTTY === true;
|
|
841
|
+
if (interactive && data.checks.bindings.ok === false && (data.checks.bindings.count ?? 0) > 0) {
|
|
842
|
+
const missing = await withDatabase((database) => findMissingRepositoryLocations(database), databaseOptions);
|
|
843
|
+
if (missing.length > 0 && await promptRemoveMissingRepositoryLocations(missing, { input, output })) {
|
|
844
|
+
removed = await withDatabase((database) => removeMissingRepositoryLocations(database, missing), databaseOptions);
|
|
845
|
+
data = await runDoctor(doctorOptions);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
const cleanupNotice = removed === 0
|
|
849
|
+
? ''
|
|
850
|
+
: ` Removed ${removed} missing repository location${removed === 1 ? '' : 's'}.`;
|
|
851
|
+
const failureNotice = data.ok
|
|
852
|
+
? ''
|
|
853
|
+
: ` Failed checks: ${Object.entries(data.checks).filter(([, check]) => !check.ok).map(([name]) => name).join(', ')}.\nrun kiokuko doctor --json for detailed output`;
|
|
854
|
+
humanOrJson(options.json, 'doctor', data, `${data.ok ? 'Kiokuko doctor: OK' : 'Kiokuko doctor: FAILED'}${cleanupNotice}${failureNotice}`);
|
|
855
|
+
if (!data.ok)
|
|
856
|
+
process.exitCode = 8;
|
|
857
|
+
});
|
|
858
|
+
registerServerCommands(cli, dependencies.server);
|
|
859
|
+
registerAgentCommand(cli, dependencies.agent);
|
|
860
|
+
registerLedgerCommands(cli, { withDatabase });
|
|
861
|
+
registerSkillsCommands(cli, dependencies.skills ?? { withDatabase });
|
|
862
|
+
registerEnnoCommand(cli, { withDatabase });
|
|
863
|
+
registerEmbeddingsCommands(cli, {
|
|
864
|
+
withDatabase: (operation) => withEmbeddingDatabase(dependencies, operation),
|
|
865
|
+
...(dependencies.embeddingEnvironment === undefined ? {} : { environment: dependencies.embeddingEnvironment }),
|
|
866
|
+
...(dependencies.embeddingProvider === undefined ? {} : { provider: dependencies.embeddingProvider }),
|
|
867
|
+
...(dependencies.embeddingBackend === undefined ? {} : { backend: dependencies.embeddingBackend }),
|
|
868
|
+
...(dependencies.setupEnvironment === undefined ? {} : { pathEnvironment: dependencies.setupEnvironment }),
|
|
869
|
+
...(dependencies.setupInput === undefined ? {} : { setupInput: dependencies.setupInput }),
|
|
870
|
+
...(dependencies.setupOutput === undefined ? {} : { setupOutput: dependencies.setupOutput }),
|
|
871
|
+
output: humanOrJson,
|
|
872
|
+
});
|
|
873
|
+
cli.command('web').description('Start the local Kiokuko web UI')
|
|
874
|
+
.option('--host <host>', 'Loopback host', '127.0.0.1')
|
|
875
|
+
.option('--port <number>', 'HTTP port', '4173')
|
|
876
|
+
.option('--json')
|
|
877
|
+
.action(async (options) => {
|
|
878
|
+
const web = await startWebServer({ host: options.host, port: Number(options.port) });
|
|
879
|
+
humanOrJson(options.json, 'web', { url: web.url }, `Kiokuko Web: ${web.url}`);
|
|
880
|
+
await new Promise((resolve, reject) => {
|
|
881
|
+
let stopping = false;
|
|
882
|
+
const stop = () => {
|
|
883
|
+
if (stopping)
|
|
884
|
+
return;
|
|
885
|
+
stopping = true;
|
|
886
|
+
void web.close().then(resolve, reject);
|
|
887
|
+
};
|
|
888
|
+
process.once('SIGINT', stop);
|
|
889
|
+
process.once('SIGTERM', stop);
|
|
890
|
+
});
|
|
891
|
+
});
|
|
892
|
+
cli.command('export').description('Export workspace memory').requiredOption('--workspace <name>').requiredOption('--output <path>').option('--json').action(async (options) => {
|
|
893
|
+
const result = await withDatabase((database) => writeExport(database, { workspace: options.workspace, output: options.output }));
|
|
894
|
+
humanOrJson(options.json, 'export', { output: options.output, count: result.count, checksum: result.checksum }, `Exported ${result.count} entries`);
|
|
895
|
+
});
|
|
896
|
+
cli.command('import').description('Import workspace memory').requiredOption('--input <path>').option('--workspace <name>').option('--dry-run').option('--json').action(async (options) => {
|
|
897
|
+
const importOptions = { input: options.input };
|
|
898
|
+
if (options.workspace !== undefined)
|
|
899
|
+
importOptions.workspace = options.workspace;
|
|
900
|
+
if (options.dryRun)
|
|
901
|
+
importOptions.dryRun = true;
|
|
902
|
+
const data = options.dryRun
|
|
903
|
+
? await importWorkspace(undefined, importOptions)
|
|
904
|
+
: await withDatabase((database) => importWorkspace(database, importOptions));
|
|
905
|
+
humanOrJson(options.json, 'import', data, `${data.count} records inspected`);
|
|
906
|
+
});
|
|
907
|
+
cli.command('call').description('Process one management JSON request; memory reads are not supported').requiredOption('--input-json <file>').option('--json').action(async (options) => {
|
|
908
|
+
const request = parseCallRequest(await readJsonInput(options.inputJson));
|
|
909
|
+
const data = await dispatchRequest(request);
|
|
910
|
+
emit(successEnvelope(request.operation, data));
|
|
911
|
+
});
|
|
912
|
+
return cli;
|
|
913
|
+
}
|
|
914
|
+
function operationFor(argv) {
|
|
915
|
+
const command = argv[2] ?? 'unknown';
|
|
916
|
+
if (['server', 'agent', 'skills', 'embeddings'].includes(command) && argv[3] !== undefined && !argv[3].startsWith('-'))
|
|
917
|
+
return `${command}.${argv[3]}`;
|
|
918
|
+
return command;
|
|
919
|
+
}
|
|
920
|
+
function commanderDiagnostic(error) {
|
|
921
|
+
if (error.code === 'commander.helpDisplayed' || error.code === 'commander.version')
|
|
922
|
+
return '';
|
|
923
|
+
return `Command line usage error (${error.code})\n`;
|
|
924
|
+
}
|
|
925
|
+
export async function runCli(argv = process.argv, dependencies = {}) {
|
|
926
|
+
let serveStarted = false;
|
|
927
|
+
const serverDependencies = {
|
|
928
|
+
...(dependencies.server ?? {}),
|
|
929
|
+
onServeStarted: () => {
|
|
930
|
+
serveStarted = true;
|
|
931
|
+
dependencies.server?.onServeStarted?.();
|
|
932
|
+
},
|
|
933
|
+
};
|
|
934
|
+
const cli = buildCli({ ...dependencies, server: serverDependencies });
|
|
935
|
+
const jsonRequested = argv.includes('--json') || argv.includes('call');
|
|
936
|
+
const operation = operationFor(argv);
|
|
937
|
+
try {
|
|
938
|
+
await cli.parseAsync(argv);
|
|
939
|
+
return 0;
|
|
940
|
+
}
|
|
941
|
+
catch (error) {
|
|
942
|
+
if (error instanceof CommanderError) {
|
|
943
|
+
if (error.exitCode === 0)
|
|
944
|
+
return 0;
|
|
945
|
+
if (jsonRequested) {
|
|
946
|
+
emit(errorEnvelope(operation, new KiokukoError('USAGE_ERROR', 'Invalid command-line usage', { commanderCode: error.code })));
|
|
947
|
+
return 2;
|
|
948
|
+
}
|
|
949
|
+
const diagnostic = commanderDiagnostic(error);
|
|
950
|
+
if (diagnostic.length > 0)
|
|
951
|
+
process.stderr.write(diagnostic);
|
|
952
|
+
return 2;
|
|
953
|
+
}
|
|
954
|
+
const envelope = errorEnvelope(operation, error);
|
|
955
|
+
if (jsonRequested && !(serveStarted && operation === 'serve'))
|
|
956
|
+
emit(envelope);
|
|
957
|
+
else
|
|
958
|
+
process.stderr.write(`${envelope.error.message}\n`);
|
|
959
|
+
return exitCodeFor(error);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
//# sourceMappingURL=cli.js.map
|