kiokuko-dsh 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +50 -0
- package/README.ko.md +50 -0
- package/README.md +53 -0
- package/README.zh-CN.md +50 -0
- package/dist/agent-file/atomic-write.d.ts +93 -0
- package/dist/agent-file/atomic-write.d.ts.map +1 -0
- package/dist/agent-file/atomic-write.js +1026 -0
- package/dist/agent-file/atomic-write.js.map +1 -0
- package/dist/agent-file/managed-block.d.ts +23 -0
- package/dist/agent-file/managed-block.d.ts.map +1 -0
- package/dist/agent-file/managed-block.js +101 -0
- package/dist/agent-file/managed-block.js.map +1 -0
- package/dist/agent-file/render.d.ts +14 -0
- package/dist/agent-file/render.d.ts.map +1 -0
- package/dist/agent-file/render.js +63 -0
- package/dist/agent-file/render.js.map +1 -0
- package/dist/akinator/agent-task.d.ts +72 -0
- package/dist/akinator/agent-task.d.ts.map +1 -0
- package/dist/akinator/agent-task.js +684 -0
- package/dist/akinator/agent-task.js.map +1 -0
- package/dist/akinator/capabilities.d.ts +92 -0
- package/dist/akinator/capabilities.d.ts.map +1 -0
- package/dist/akinator/capabilities.js +364 -0
- package/dist/akinator/capabilities.js.map +1 -0
- package/dist/akinator/capability-binding.d.ts +11 -0
- package/dist/akinator/capability-binding.d.ts.map +1 -0
- package/dist/akinator/capability-binding.js +71 -0
- package/dist/akinator/capability-binding.js.map +1 -0
- package/dist/akinator/domain.d.ts +25 -0
- package/dist/akinator/domain.d.ts.map +1 -0
- package/dist/akinator/domain.js +266 -0
- package/dist/akinator/domain.js.map +1 -0
- package/dist/akinator/knowledge-path.d.ts +33 -0
- package/dist/akinator/knowledge-path.d.ts.map +1 -0
- package/dist/akinator/knowledge-path.js +474 -0
- package/dist/akinator/knowledge-path.js.map +1 -0
- package/dist/akinator/orchestrator.d.ts +7 -0
- package/dist/akinator/orchestrator.d.ts.map +1 -0
- package/dist/akinator/orchestrator.js +8 -0
- package/dist/akinator/orchestrator.js.map +1 -0
- package/dist/akinator/reasoning.d.ts +8 -0
- package/dist/akinator/reasoning.d.ts.map +1 -0
- package/dist/akinator/reasoning.js +118 -0
- package/dist/akinator/reasoning.js.map +1 -0
- package/dist/akinator/service.d.ts +32 -0
- package/dist/akinator/service.d.ts.map +1 -0
- package/dist/akinator/service.js +294 -0
- package/dist/akinator/service.js.map +1 -0
- package/dist/akinator/skill-discovery-attempt.d.ts +26 -0
- package/dist/akinator/skill-discovery-attempt.d.ts.map +1 -0
- package/dist/akinator/skill-discovery-attempt.js +469 -0
- package/dist/akinator/skill-discovery-attempt.js.map +1 -0
- package/dist/akinator/store.d.ts +96 -0
- package/dist/akinator/store.d.ts.map +1 -0
- package/dist/akinator/store.js +642 -0
- package/dist/akinator/store.js.map +1 -0
- package/dist/akinator/types.d.ts +70 -0
- package/dist/akinator/types.d.ts.map +1 -0
- package/dist/akinator/types.js +2 -0
- package/dist/akinator/types.js.map +1 -0
- package/dist/bin/kiokuko.d.ts +3 -0
- package/dist/bin/kiokuko.d.ts.map +1 -0
- package/dist/bin/kiokuko.js +13 -0
- package/dist/bin/kiokuko.js.map +1 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +962 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/server-client.d.ts +22 -0
- package/dist/client/server-client.d.ts.map +1 -0
- package/dist/client/server-client.js +729 -0
- package/dist/client/server-client.js.map +1 -0
- package/dist/commands/agent.d.ts +12 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +1138 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/backup.d.ts +6 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +77 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/curator.d.ts +25 -0
- package/dist/commands/curator.d.ts.map +1 -0
- package/dist/commands/curator.js +58 -0
- package/dist/commands/curator.js.map +1 -0
- package/dist/commands/doctor.d.ts +61 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +522 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/embeddings.d.ts +40 -0
- package/dist/commands/embeddings.d.ts.map +1 -0
- package/dist/commands/embeddings.js +317 -0
- package/dist/commands/embeddings.js.map +1 -0
- package/dist/commands/enno.d.ts +7 -0
- package/dist/commands/enno.d.ts.map +1 -0
- package/dist/commands/enno.js +76 -0
- package/dist/commands/enno.js.map +1 -0
- package/dist/commands/export.d.ts +17 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +233 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +24 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +778 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +34 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +637 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/ledger.d.ts +7 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +66 -0
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/purge.d.ts +10 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +29 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/serve.d.ts +34 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +120 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/server-status.d.ts +20 -0
- package/dist/commands/server-status.d.ts.map +1 -0
- package/dist/commands/server-status.js +21 -0
- package/dist/commands/server-status.js.map +1 -0
- package/dist/commands/server.d.ts +13 -0
- package/dist/commands/server.d.ts.map +1 -0
- package/dist/commands/server.js +89 -0
- package/dist/commands/server.js.map +1 -0
- package/dist/commands/setup.d.ts +105 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +793 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/skills.d.ts +9 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +317 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/use.d.ts +40 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +1090 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/config/paths.d.ts +57 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +352 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/project-config.d.ts +11 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +97 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/context/broker.d.ts +99 -0
- package/dist/context/broker.d.ts.map +1 -0
- package/dist/context/broker.js +923 -0
- package/dist/context/broker.js.map +1 -0
- package/dist/context/delivery-migration.d.ts +40 -0
- package/dist/context/delivery-migration.d.ts.map +1 -0
- package/dist/context/delivery-migration.js +367 -0
- package/dist/context/delivery-migration.js.map +1 -0
- package/dist/context/delivery.d.ts +61 -0
- package/dist/context/delivery.d.ts.map +1 -0
- package/dist/context/delivery.js +886 -0
- package/dist/context/delivery.js.map +1 -0
- package/dist/context/feedback.d.ts +73 -0
- package/dist/context/feedback.d.ts.map +1 -0
- package/dist/context/feedback.js +993 -0
- package/dist/context/feedback.js.map +1 -0
- package/dist/context/nudge-store.d.ts +57 -0
- package/dist/context/nudge-store.d.ts.map +1 -0
- package/dist/context/nudge-store.js +227 -0
- package/dist/context/nudge-store.js.map +1 -0
- package/dist/context/nudge-validation.d.ts +26 -0
- package/dist/context/nudge-validation.d.ts.map +1 -0
- package/dist/context/nudge-validation.js +122 -0
- package/dist/context/nudge-validation.js.map +1 -0
- package/dist/context/nudges.d.ts +38 -0
- package/dist/context/nudges.d.ts.map +1 -0
- package/dist/context/nudges.js +131 -0
- package/dist/context/nudges.js.map +1 -0
- package/dist/context/origin.d.ts +9 -0
- package/dist/context/origin.d.ts.map +1 -0
- package/dist/context/origin.js +15 -0
- package/dist/context/origin.js.map +1 -0
- package/dist/context/ranking.d.ts +92 -0
- package/dist/context/ranking.d.ts.map +1 -0
- package/dist/context/ranking.js +560 -0
- package/dist/context/ranking.js.map +1 -0
- package/dist/context/recommendations.d.ts +80 -0
- package/dist/context/recommendations.d.ts.map +1 -0
- package/dist/context/recommendations.js +341 -0
- package/dist/context/recommendations.js.map +1 -0
- package/dist/context/run-state.d.ts +26 -0
- package/dist/context/run-state.d.ts.map +1 -0
- package/dist/context/run-state.js +399 -0
- package/dist/context/run-state.js.map +1 -0
- package/dist/context/scoped-broker.d.ts +77 -0
- package/dist/context/scoped-broker.d.ts.map +1 -0
- package/dist/context/scoped-broker.js +690 -0
- package/dist/context/scoped-broker.js.map +1 -0
- package/dist/context/selection-state.d.ts +32 -0
- package/dist/context/selection-state.d.ts.map +1 -0
- package/dist/context/selection-state.js +369 -0
- package/dist/context/selection-state.js.map +1 -0
- package/dist/db/adapter.d.ts +27 -0
- package/dist/db/adapter.d.ts.map +1 -0
- package/dist/db/adapter.js +41 -0
- package/dist/db/adapter.js.map +1 -0
- package/dist/db/capabilities.d.ts +21 -0
- package/dist/db/capabilities.d.ts.map +1 -0
- package/dist/db/capabilities.js +57 -0
- package/dist/db/capabilities.js.map +1 -0
- package/dist/db/connection.d.ts +21 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +129 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/migrate.d.ts +40 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +216 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/sqlite-retry.d.ts +11 -0
- package/dist/db/sqlite-retry.d.ts.map +1 -0
- package/dist/db/sqlite-retry.js +70 -0
- package/dist/db/sqlite-retry.js.map +1 -0
- package/dist/db/transaction.d.ts +17 -0
- package/dist/db/transaction.d.ts.map +1 -0
- package/dist/db/transaction.js +68 -0
- package/dist/db/transaction.js.map +1 -0
- package/dist/db/upgrade-backup.d.ts +59 -0
- package/dist/db/upgrade-backup.d.ts.map +1 -0
- package/dist/db/upgrade-backup.js +773 -0
- package/dist/db/upgrade-backup.js.map +1 -0
- package/dist/dsh/advisory-runner.d.ts +32 -0
- package/dist/dsh/advisory-runner.d.ts.map +1 -0
- package/dist/dsh/advisory-runner.js +111 -0
- package/dist/dsh/advisory-runner.js.map +1 -0
- package/dist/dsh/agent-state.d.ts +49 -0
- package/dist/dsh/agent-state.d.ts.map +1 -0
- package/dist/dsh/agent-state.js +103 -0
- package/dist/dsh/agent-state.js.map +1 -0
- package/dist/dsh/capability-catalog.d.ts +24 -0
- package/dist/dsh/capability-catalog.d.ts.map +1 -0
- package/dist/dsh/capability-catalog.js +108 -0
- package/dist/dsh/capability-catalog.js.map +1 -0
- package/dist/dsh/commands.d.ts +43 -0
- package/dist/dsh/commands.d.ts.map +1 -0
- package/dist/dsh/commands.js +83 -0
- package/dist/dsh/commands.js.map +1 -0
- package/dist/dsh/composition.d.ts +64 -0
- package/dist/dsh/composition.d.ts.map +1 -0
- package/dist/dsh/composition.js +104 -0
- package/dist/dsh/composition.js.map +1 -0
- package/dist/dsh/config.d.ts +7 -0
- package/dist/dsh/config.d.ts.map +1 -0
- package/dist/dsh/config.js +6 -0
- package/dist/dsh/config.js.map +1 -0
- package/dist/dsh/context-injection.d.ts +24 -0
- package/dist/dsh/context-injection.d.ts.map +1 -0
- package/dist/dsh/context-injection.js +61 -0
- package/dist/dsh/context-injection.js.map +1 -0
- package/dist/dsh/enno-controller.d.ts +94 -0
- package/dist/dsh/enno-controller.d.ts.map +1 -0
- package/dist/dsh/enno-controller.js +137 -0
- package/dist/dsh/enno-controller.js.map +1 -0
- package/dist/dsh/index.d.ts +31 -0
- package/dist/dsh/index.d.ts.map +1 -0
- package/dist/dsh/index.js +52 -0
- package/dist/dsh/index.js.map +1 -0
- package/dist/dsh/intake-gate.d.ts +50 -0
- package/dist/dsh/intake-gate.d.ts.map +1 -0
- package/dist/dsh/intake-gate.js +77 -0
- package/dist/dsh/intake-gate.js.map +1 -0
- package/dist/dsh/intake-profile-resolver.d.ts +22 -0
- package/dist/dsh/intake-profile-resolver.d.ts.map +1 -0
- package/dist/dsh/intake-profile-resolver.js +44 -0
- package/dist/dsh/intake-profile-resolver.js.map +1 -0
- package/dist/dsh/message-sources.d.ts +28 -0
- package/dist/dsh/message-sources.d.ts.map +1 -0
- package/dist/dsh/message-sources.js +62 -0
- package/dist/dsh/message-sources.js.map +1 -0
- package/dist/dsh/parity.d.ts +18 -0
- package/dist/dsh/parity.d.ts.map +1 -0
- package/dist/dsh/parity.js +105 -0
- package/dist/dsh/parity.js.map +1 -0
- package/dist/dsh/prompt-policy.d.ts +18 -0
- package/dist/dsh/prompt-policy.d.ts.map +1 -0
- package/dist/dsh/prompt-policy.js +16 -0
- package/dist/dsh/prompt-policy.js.map +1 -0
- package/dist/dsh/runtime.d.ts +40 -0
- package/dist/dsh/runtime.d.ts.map +1 -0
- package/dist/dsh/runtime.js +237 -0
- package/dist/dsh/runtime.js.map +1 -0
- package/dist/dsh/session-bridge.d.ts +98 -0
- package/dist/dsh/session-bridge.d.ts.map +1 -0
- package/dist/dsh/session-bridge.js +202 -0
- package/dist/dsh/session-bridge.js.map +1 -0
- package/dist/dsh/standard-skill-provider.d.ts +50 -0
- package/dist/dsh/standard-skill-provider.d.ts.map +1 -0
- package/dist/dsh/standard-skill-provider.js +71 -0
- package/dist/dsh/standard-skill-provider.js.map +1 -0
- package/dist/dsh/tool-policy.d.ts +40 -0
- package/dist/dsh/tool-policy.d.ts.map +1 -0
- package/dist/dsh/tool-policy.js +125 -0
- package/dist/dsh/tool-policy.js.map +1 -0
- package/dist/dsh/tools.d.ts +85 -0
- package/dist/dsh/tools.d.ts.map +1 -0
- package/dist/dsh/tools.js +156 -0
- package/dist/dsh/tools.js.map +1 -0
- package/dist/dsh/user-interaction.d.ts +51 -0
- package/dist/dsh/user-interaction.d.ts.map +1 -0
- package/dist/dsh/user-interaction.js +92 -0
- package/dist/dsh/user-interaction.js.map +1 -0
- package/dist/embedding/backend.d.ts +27 -0
- package/dist/embedding/backend.d.ts.map +1 -0
- package/dist/embedding/backend.js +67 -0
- package/dist/embedding/backend.js.map +1 -0
- package/dist/embedding/config.d.ts +10 -0
- package/dist/embedding/config.d.ts.map +1 -0
- package/dist/embedding/config.js +142 -0
- package/dist/embedding/config.js.map +1 -0
- package/dist/embedding/diagnostics.d.ts +34 -0
- package/dist/embedding/diagnostics.d.ts.map +1 -0
- package/dist/embedding/diagnostics.js +274 -0
- package/dist/embedding/diagnostics.js.map +1 -0
- package/dist/embedding/document.d.ts +20 -0
- package/dist/embedding/document.d.ts.map +1 -0
- package/dist/embedding/document.js +122 -0
- package/dist/embedding/document.js.map +1 -0
- package/dist/embedding/javascript-backend.d.ts +11 -0
- package/dist/embedding/javascript-backend.d.ts.map +1 -0
- package/dist/embedding/javascript-backend.js +164 -0
- package/dist/embedding/javascript-backend.js.map +1 -0
- package/dist/embedding/jobs.d.ts +67 -0
- package/dist/embedding/jobs.d.ts.map +1 -0
- package/dist/embedding/jobs.js +259 -0
- package/dist/embedding/jobs.js.map +1 -0
- package/dist/embedding/local-model-loader.d.ts +24 -0
- package/dist/embedding/local-model-loader.d.ts.map +1 -0
- package/dist/embedding/local-model-loader.js +64 -0
- package/dist/embedding/local-model-loader.js.map +1 -0
- package/dist/embedding/local-transformers-provider.d.ts +17 -0
- package/dist/embedding/local-transformers-provider.d.ts.map +1 -0
- package/dist/embedding/local-transformers-provider.js +54 -0
- package/dist/embedding/local-transformers-provider.js.map +1 -0
- package/dist/embedding/model-download.d.ts +32 -0
- package/dist/embedding/model-download.d.ts.map +1 -0
- package/dist/embedding/model-download.js +41 -0
- package/dist/embedding/model-download.js.map +1 -0
- package/dist/embedding/model-installation.d.ts +17 -0
- package/dist/embedding/model-installation.d.ts.map +1 -0
- package/dist/embedding/model-installation.js +71 -0
- package/dist/embedding/model-installation.js.map +1 -0
- package/dist/embedding/model-manifest.d.ts +18 -0
- package/dist/embedding/model-manifest.d.ts.map +1 -0
- package/dist/embedding/model-manifest.js +86 -0
- package/dist/embedding/model-manifest.js.map +1 -0
- package/dist/embedding/openai-compatible-provider.d.ts +24 -0
- package/dist/embedding/openai-compatible-provider.d.ts.map +1 -0
- package/dist/embedding/openai-compatible-provider.js +330 -0
- package/dist/embedding/openai-compatible-provider.js.map +1 -0
- package/dist/embedding/presets/local-small.d.ts +8 -0
- package/dist/embedding/presets/local-small.d.ts.map +1 -0
- package/dist/embedding/presets/local-small.js +67 -0
- package/dist/embedding/presets/local-small.js.map +1 -0
- package/dist/embedding/presets/manifest.d.ts +27 -0
- package/dist/embedding/presets/manifest.d.ts.map +1 -0
- package/dist/embedding/presets/manifest.js +5 -0
- package/dist/embedding/presets/manifest.js.map +1 -0
- package/dist/embedding/profile.d.ts +10 -0
- package/dist/embedding/profile.d.ts.map +1 -0
- package/dist/embedding/profile.js +67 -0
- package/dist/embedding/profile.js.map +1 -0
- package/dist/embedding/provider.d.ts +13 -0
- package/dist/embedding/provider.d.ts.map +1 -0
- package/dist/embedding/provider.js +17 -0
- package/dist/embedding/provider.js.map +1 -0
- package/dist/embedding/query-cache.d.ts +45 -0
- package/dist/embedding/query-cache.d.ts.map +1 -0
- package/dist/embedding/query-cache.js +181 -0
- package/dist/embedding/query-cache.js.map +1 -0
- package/dist/embedding/runtime.d.ts +14 -0
- package/dist/embedding/runtime.d.ts.map +1 -0
- package/dist/embedding/runtime.js +407 -0
- package/dist/embedding/runtime.js.map +1 -0
- package/dist/embedding/settings.d.ts +6 -0
- package/dist/embedding/settings.d.ts.map +1 -0
- package/dist/embedding/settings.js +69 -0
- package/dist/embedding/settings.js.map +1 -0
- package/dist/embedding/setup-lock.d.ts +7 -0
- package/dist/embedding/setup-lock.d.ts.map +1 -0
- package/dist/embedding/setup-lock.js +35 -0
- package/dist/embedding/setup-lock.js.map +1 -0
- package/dist/embedding/setup-service.d.ts +53 -0
- package/dist/embedding/setup-service.d.ts.map +1 -0
- package/dist/embedding/setup-service.js +184 -0
- package/dist/embedding/setup-service.js.map +1 -0
- package/dist/embedding/sqlite-vec-backend.d.ts +9 -0
- package/dist/embedding/sqlite-vec-backend.d.ts.map +1 -0
- package/dist/embedding/sqlite-vec-backend.js +106 -0
- package/dist/embedding/sqlite-vec-backend.js.map +1 -0
- package/dist/embedding/sqlite-vec-loader.d.ts +17 -0
- package/dist/embedding/sqlite-vec-loader.d.ts.map +1 -0
- package/dist/embedding/sqlite-vec-loader.js +51 -0
- package/dist/embedding/sqlite-vec-loader.js.map +1 -0
- package/dist/embedding/store.d.ts +66 -0
- package/dist/embedding/store.d.ts.map +1 -0
- package/dist/embedding/store.js +490 -0
- package/dist/embedding/store.js.map +1 -0
- package/dist/embedding/types.d.ts +126 -0
- package/dist/embedding/types.d.ts.map +1 -0
- package/dist/embedding/types.js +2 -0
- package/dist/embedding/types.js.map +1 -0
- package/dist/embedding/vector.d.ts +9 -0
- package/dist/embedding/vector.d.ts.map +1 -0
- package/dist/embedding/vector.js +90 -0
- package/dist/embedding/vector.js.map +1 -0
- package/dist/embedding/worker.d.ts +23 -0
- package/dist/embedding/worker.d.ts.map +1 -0
- package/dist/embedding/worker.js +84 -0
- package/dist/embedding/worker.js.map +1 -0
- package/dist/enno-oduno/adapters.d.ts +21 -0
- package/dist/enno-oduno/adapters.d.ts.map +1 -0
- package/dist/enno-oduno/adapters.js +253 -0
- package/dist/enno-oduno/adapters.js.map +1 -0
- package/dist/enno-oduno/advisory-store.d.ts +31 -0
- package/dist/enno-oduno/advisory-store.d.ts.map +1 -0
- package/dist/enno-oduno/advisory-store.js +105 -0
- package/dist/enno-oduno/advisory-store.js.map +1 -0
- package/dist/enno-oduno/advisory.d.ts +18 -0
- package/dist/enno-oduno/advisory.d.ts.map +1 -0
- package/dist/enno-oduno/advisory.js +310 -0
- package/dist/enno-oduno/advisory.js.map +1 -0
- package/dist/enno-oduno/confirmation.d.ts +4 -0
- package/dist/enno-oduno/confirmation.d.ts.map +1 -0
- package/dist/enno-oduno/confirmation.js +127 -0
- package/dist/enno-oduno/confirmation.js.map +1 -0
- package/dist/enno-oduno/directives.d.ts +12 -0
- package/dist/enno-oduno/directives.d.ts.map +1 -0
- package/dist/enno-oduno/directives.js +276 -0
- package/dist/enno-oduno/directives.js.map +1 -0
- package/dist/enno-oduno/enno-oduno.d.mts +2 -0
- package/dist/enno-oduno/enno-oduno.d.mts.map +1 -0
- package/dist/enno-oduno/enno-oduno.mjs +3 -0
- package/dist/enno-oduno/enno-oduno.mjs.map +1 -0
- package/dist/enno-oduno/experts.d.ts +6 -0
- package/dist/enno-oduno/experts.d.ts.map +1 -0
- package/dist/enno-oduno/experts.js +32 -0
- package/dist/enno-oduno/experts.js.map +1 -0
- package/dist/enno-oduno/goki.d.mts +2 -0
- package/dist/enno-oduno/goki.d.mts.map +1 -0
- package/dist/enno-oduno/goki.mjs +3 -0
- package/dist/enno-oduno/goki.mjs.map +1 -0
- package/dist/enno-oduno/handoff.d.ts +4 -0
- package/dist/enno-oduno/handoff.d.ts.map +1 -0
- package/dist/enno-oduno/handoff.js +18 -0
- package/dist/enno-oduno/handoff.js.map +1 -0
- package/dist/enno-oduno/harness.d.ts +20 -0
- package/dist/enno-oduno/harness.d.ts.map +1 -0
- package/dist/enno-oduno/harness.js +66 -0
- package/dist/enno-oduno/harness.js.map +1 -0
- package/dist/enno-oduno/instructions.d.ts +9 -0
- package/dist/enno-oduno/instructions.d.ts.map +1 -0
- package/dist/enno-oduno/instructions.js +12 -0
- package/dist/enno-oduno/instructions.js.map +1 -0
- package/dist/enno-oduno/plan-recovery.d.ts +44 -0
- package/dist/enno-oduno/plan-recovery.d.ts.map +1 -0
- package/dist/enno-oduno/plan-recovery.js +160 -0
- package/dist/enno-oduno/plan-recovery.js.map +1 -0
- package/dist/enno-oduno/repository-state.d.ts +8 -0
- package/dist/enno-oduno/repository-state.d.ts.map +1 -0
- package/dist/enno-oduno/repository-state.js +139 -0
- package/dist/enno-oduno/repository-state.js.map +1 -0
- package/dist/enno-oduno/role-runner.d.ts +9 -0
- package/dist/enno-oduno/role-runner.d.ts.map +1 -0
- package/dist/enno-oduno/role-runner.js +219 -0
- package/dist/enno-oduno/role-runner.js.map +1 -0
- package/dist/enno-oduno/sanitize.d.ts +17 -0
- package/dist/enno-oduno/sanitize.d.ts.map +1 -0
- package/dist/enno-oduno/sanitize.js +88 -0
- package/dist/enno-oduno/sanitize.js.map +1 -0
- package/dist/enno-oduno/schemas.d.ts +962 -0
- package/dist/enno-oduno/schemas.d.ts.map +1 -0
- package/dist/enno-oduno/schemas.js +609 -0
- package/dist/enno-oduno/schemas.js.map +1 -0
- package/dist/enno-oduno/service.d.ts +57 -0
- package/dist/enno-oduno/service.d.ts.map +1 -0
- package/dist/enno-oduno/service.js +1379 -0
- package/dist/enno-oduno/service.js.map +1 -0
- package/dist/enno-oduno/skills.d.ts +22 -0
- package/dist/enno-oduno/skills.d.ts.map +1 -0
- package/dist/enno-oduno/skills.js +127 -0
- package/dist/enno-oduno/skills.js.map +1 -0
- package/dist/enno-oduno/store.d.ts +106 -0
- package/dist/enno-oduno/store.d.ts.map +1 -0
- package/dist/enno-oduno/store.js +712 -0
- package/dist/enno-oduno/store.js.map +1 -0
- package/dist/enno-oduno/types.d.ts +457 -0
- package/dist/enno-oduno/types.d.ts.map +1 -0
- package/dist/enno-oduno/types.js +66 -0
- package/dist/enno-oduno/types.js.map +1 -0
- package/dist/enno-oduno/validation-errors.d.ts +93 -0
- package/dist/enno-oduno/validation-errors.d.ts.map +1 -0
- package/dist/enno-oduno/validation-errors.js +152 -0
- package/dist/enno-oduno/validation-errors.js.map +1 -0
- package/dist/enno-oduno/verifier.d.ts +10 -0
- package/dist/enno-oduno/verifier.d.ts.map +1 -0
- package/dist/enno-oduno/verifier.js +214 -0
- package/dist/enno-oduno/verifier.js.map +1 -0
- package/dist/enno-oduno/zenki.d.mts +2 -0
- package/dist/enno-oduno/zenki.d.mts.map +1 -0
- package/dist/enno-oduno/zenki.mjs +3 -0
- package/dist/enno-oduno/zenki.mjs.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +60 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway/agent-service.d.ts +72 -0
- package/dist/gateway/agent-service.d.ts.map +1 -0
- package/dist/gateway/agent-service.js +594 -0
- package/dist/gateway/agent-service.js.map +1 -0
- package/dist/gateway/checkpoint-mutation-service.d.ts +33 -0
- package/dist/gateway/checkpoint-mutation-service.d.ts.map +1 -0
- package/dist/gateway/checkpoint-mutation-service.js +513 -0
- package/dist/gateway/checkpoint-mutation-service.js.map +1 -0
- package/dist/gateway/checkpoint-service.d.ts +40 -0
- package/dist/gateway/checkpoint-service.d.ts.map +1 -0
- package/dist/gateway/checkpoint-service.js +149 -0
- package/dist/gateway/checkpoint-service.js.map +1 -0
- package/dist/gateway/nudge-delivery-service.d.ts +21 -0
- package/dist/gateway/nudge-delivery-service.d.ts.map +1 -0
- package/dist/gateway/nudge-delivery-service.js +67 -0
- package/dist/gateway/nudge-delivery-service.js.map +1 -0
- package/dist/ledger/archive.d.ts +48 -0
- package/dist/ledger/archive.d.ts.map +1 -0
- package/dist/ledger/archive.js +1261 -0
- package/dist/ledger/archive.js.map +1 -0
- package/dist/ledger/checkpoint-contract.d.ts +144 -0
- package/dist/ledger/checkpoint-contract.d.ts.map +1 -0
- package/dist/ledger/checkpoint-contract.js +91 -0
- package/dist/ledger/checkpoint-contract.js.map +1 -0
- package/dist/ledger/checkpoint-eligibility.d.ts +17 -0
- package/dist/ledger/checkpoint-eligibility.d.ts.map +1 -0
- package/dist/ledger/checkpoint-eligibility.js +19 -0
- package/dist/ledger/checkpoint-eligibility.js.map +1 -0
- package/dist/ledger/hash.d.ts +22 -0
- package/dist/ledger/hash.d.ts.map +1 -0
- package/dist/ledger/hash.js +25 -0
- package/dist/ledger/hash.js.map +1 -0
- package/dist/ledger/maintenance.d.ts +68 -0
- package/dist/ledger/maintenance.d.ts.map +1 -0
- package/dist/ledger/maintenance.js +767 -0
- package/dist/ledger/maintenance.js.map +1 -0
- package/dist/ledger/projection.d.ts +38 -0
- package/dist/ledger/projection.d.ts.map +1 -0
- package/dist/ledger/projection.js +315 -0
- package/dist/ledger/projection.js.map +1 -0
- package/dist/ledger/promotion.d.ts +19 -0
- package/dist/ledger/promotion.d.ts.map +1 -0
- package/dist/ledger/promotion.js +310 -0
- package/dist/ledger/promotion.js.map +1 -0
- package/dist/ledger/query.d.ts +41 -0
- package/dist/ledger/query.d.ts.map +1 -0
- package/dist/ledger/query.js +321 -0
- package/dist/ledger/query.js.map +1 -0
- package/dist/ledger/redaction.d.ts +8 -0
- package/dist/ledger/redaction.d.ts.map +1 -0
- package/dist/ledger/redaction.js +40 -0
- package/dist/ledger/redaction.js.map +1 -0
- package/dist/ledger/store.d.ts +45 -0
- package/dist/ledger/store.d.ts.map +1 -0
- package/dist/ledger/store.js +327 -0
- package/dist/ledger/store.js.map +1 -0
- package/dist/ledger/types.d.ts +115 -0
- package/dist/ledger/types.d.ts.map +1 -0
- package/dist/ledger/types.js +27 -0
- package/dist/ledger/types.js.map +1 -0
- package/dist/ledger/validate.d.ts +10 -0
- package/dist/ledger/validate.d.ts.map +1 -0
- package/dist/ledger/validate.js +178 -0
- package/dist/ledger/validate.js.map +1 -0
- package/dist/mcp/bounded-stdio-transport.d.ts +26 -0
- package/dist/mcp/bounded-stdio-transport.d.ts.map +1 -0
- package/dist/mcp/bounded-stdio-transport.js +121 -0
- package/dist/mcp/bounded-stdio-transport.js.map +1 -0
- package/dist/mcp/request-deadline.d.ts +51 -0
- package/dist/mcp/request-deadline.d.ts.map +1 -0
- package/dist/mcp/request-deadline.js +155 -0
- package/dist/mcp/request-deadline.js.map +1 -0
- package/dist/mcp/runtime-owner.d.ts +27 -0
- package/dist/mcp/runtime-owner.d.ts.map +1 -0
- package/dist/mcp/runtime-owner.js +129 -0
- package/dist/mcp/runtime-owner.js.map +1 -0
- package/dist/mcp/server.d.ts +24 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +502 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/memory/audit.d.ts +13 -0
- package/dist/memory/audit.d.ts.map +1 -0
- package/dist/memory/audit.js +15 -0
- package/dist/memory/audit.js.map +1 -0
- package/dist/memory/checkpoint-contract.d.ts +490 -0
- package/dist/memory/checkpoint-contract.d.ts.map +1 -0
- package/dist/memory/checkpoint-contract.js +106 -0
- package/dist/memory/checkpoint-contract.js.map +1 -0
- package/dist/memory/curator-trust.d.ts +15 -0
- package/dist/memory/curator-trust.d.ts.map +1 -0
- package/dist/memory/curator-trust.js +58 -0
- package/dist/memory/curator-trust.js.map +1 -0
- package/dist/memory/curator.d.ts +115 -0
- package/dist/memory/curator.d.ts.map +1 -0
- package/dist/memory/curator.js +706 -0
- package/dist/memory/curator.js.map +1 -0
- package/dist/memory/entries.d.ts +75 -0
- package/dist/memory/entries.d.ts.map +1 -0
- package/dist/memory/entries.js +355 -0
- package/dist/memory/entries.js.map +1 -0
- package/dist/memory/federated-retrieval.d.ts +79 -0
- package/dist/memory/federated-retrieval.d.ts.map +1 -0
- package/dist/memory/federated-retrieval.js +515 -0
- package/dist/memory/federated-retrieval.js.map +1 -0
- package/dist/memory/hybrid-retrieval.d.ts +33 -0
- package/dist/memory/hybrid-retrieval.d.ts.map +1 -0
- package/dist/memory/hybrid-retrieval.js +398 -0
- package/dist/memory/hybrid-retrieval.js.map +1 -0
- package/dist/memory/lifecycle.d.ts +29 -0
- package/dist/memory/lifecycle.d.ts.map +1 -0
- package/dist/memory/lifecycle.js +65 -0
- package/dist/memory/lifecycle.js.map +1 -0
- package/dist/memory/portability.d.ts +10 -0
- package/dist/memory/portability.d.ts.map +1 -0
- package/dist/memory/portability.js +44 -0
- package/dist/memory/portability.js.map +1 -0
- package/dist/memory/rebuild-search.d.ts +24 -0
- package/dist/memory/rebuild-search.d.ts.map +1 -0
- package/dist/memory/rebuild-search.js +167 -0
- package/dist/memory/rebuild-search.js.map +1 -0
- package/dist/memory/retrieval-query.d.ts +16 -0
- package/dist/memory/retrieval-query.d.ts.map +1 -0
- package/dist/memory/retrieval-query.js +161 -0
- package/dist/memory/retrieval-query.js.map +1 -0
- package/dist/memory/retrieval.d.ts +56 -0
- package/dist/memory/retrieval.d.ts.map +1 -0
- package/dist/memory/retrieval.js +101 -0
- package/dist/memory/retrieval.js.map +1 -0
- package/dist/memory/revisions.d.ts +123 -0
- package/dist/memory/revisions.d.ts.map +1 -0
- package/dist/memory/revisions.js +759 -0
- package/dist/memory/revisions.js.map +1 -0
- package/dist/memory/scoped-memory.d.ts +76 -0
- package/dist/memory/scoped-memory.d.ts.map +1 -0
- package/dist/memory/scoped-memory.js +539 -0
- package/dist/memory/scoped-memory.js.map +1 -0
- package/dist/memory/secrets.d.ts +8 -0
- package/dist/memory/secrets.d.ts.map +1 -0
- package/dist/memory/secrets.js +54 -0
- package/dist/memory/secrets.js.map +1 -0
- package/dist/memory/structured-memory.d.ts +60 -0
- package/dist/memory/structured-memory.d.ts.map +1 -0
- package/dist/memory/structured-memory.js +341 -0
- package/dist/memory/structured-memory.js.map +1 -0
- package/dist/memory/workspaces.d.ts +26 -0
- package/dist/memory/workspaces.d.ts.map +1 -0
- package/dist/memory/workspaces.js +159 -0
- package/dist/memory/workspaces.js.map +1 -0
- package/dist/model-tools/contracts.d.ts +1297 -0
- package/dist/model-tools/contracts.d.ts.map +1 -0
- package/dist/model-tools/contracts.js +104 -0
- package/dist/model-tools/contracts.js.map +1 -0
- package/dist/model-tools/registry.d.ts +8 -0
- package/dist/model-tools/registry.d.ts.map +1 -0
- package/dist/model-tools/registry.js +59 -0
- package/dist/model-tools/registry.js.map +1 -0
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +7 -0
- package/dist/package-version.js.map +1 -0
- package/dist/repository/binding.d.ts +32 -0
- package/dist/repository/binding.d.ts.map +1 -0
- package/dist/repository/binding.js +208 -0
- package/dist/repository/binding.js.map +1 -0
- package/dist/repository/cwd-schema.d.ts +4 -0
- package/dist/repository/cwd-schema.d.ts.map +1 -0
- package/dist/repository/cwd-schema.js +8 -0
- package/dist/repository/cwd-schema.js.map +1 -0
- package/dist/repository/detect-root.d.ts +13 -0
- package/dist/repository/detect-root.d.ts.map +1 -0
- package/dist/repository/detect-root.js +77 -0
- package/dist/repository/detect-root.js.map +1 -0
- package/dist/repository/framework-version.d.ts +8 -0
- package/dist/repository/framework-version.d.ts.map +1 -0
- package/dist/repository/framework-version.js +29 -0
- package/dist/repository/framework-version.js.map +1 -0
- package/dist/repository/git-origin.d.ts +2 -0
- package/dist/repository/git-origin.d.ts.map +1 -0
- package/dist/repository/git-origin.js +15 -0
- package/dist/repository/git-origin.js.map +1 -0
- package/dist/repository/gitignore.d.ts +8 -0
- package/dist/repository/gitignore.d.ts.map +1 -0
- package/dist/repository/gitignore.js +21 -0
- package/dist/repository/gitignore.js.map +1 -0
- package/dist/repository/identity-value.d.ts +4 -0
- package/dist/repository/identity-value.d.ts.map +1 -0
- package/dist/repository/identity-value.js +24 -0
- package/dist/repository/identity-value.js.map +1 -0
- package/dist/repository/identity.d.ts +19 -0
- package/dist/repository/identity.d.ts.map +1 -0
- package/dist/repository/identity.js +25 -0
- package/dist/repository/identity.js.map +1 -0
- package/dist/repository/project-fingerprint.d.ts +33 -0
- package/dist/repository/project-fingerprint.d.ts.map +1 -0
- package/dist/repository/project-fingerprint.js +429 -0
- package/dist/repository/project-fingerprint.js.map +1 -0
- package/dist/repository/remote-url.d.ts +3 -0
- package/dist/repository/remote-url.d.ts.map +1 -0
- package/dist/repository/remote-url.js +35 -0
- package/dist/repository/remote-url.js.map +1 -0
- package/dist/runtime-version.d.ts +6 -0
- package/dist/runtime-version.d.ts.map +1 -0
- package/dist/runtime-version.js +33 -0
- package/dist/runtime-version.js.map +1 -0
- package/dist/security/sanitize.d.ts +4 -0
- package/dist/security/sanitize.d.ts.map +1 -0
- package/dist/security/sanitize.js +174 -0
- package/dist/security/sanitize.js.map +1 -0
- package/dist/serialization/boundary-json.d.ts +20 -0
- package/dist/serialization/boundary-json.d.ts.map +1 -0
- package/dist/serialization/boundary-json.js +129 -0
- package/dist/serialization/boundary-json.js.map +1 -0
- package/dist/serialization/envelope.d.ts +20 -0
- package/dist/serialization/envelope.d.ts.map +1 -0
- package/dist/serialization/envelope.js +11 -0
- package/dist/serialization/envelope.js.map +1 -0
- package/dist/serialization/validate.d.ts +38 -0
- package/dist/serialization/validate.d.ts.map +1 -0
- package/dist/serialization/validate.js +233 -0
- package/dist/serialization/validate.js.map +1 -0
- package/dist/server/agent-application.d.ts +6 -0
- package/dist/server/agent-application.d.ts.map +1 -0
- package/dist/server/agent-application.js +74 -0
- package/dist/server/agent-application.js.map +1 -0
- package/dist/server/agent-checkpoint-use-case.d.ts +41 -0
- package/dist/server/agent-checkpoint-use-case.d.ts.map +1 -0
- package/dist/server/agent-checkpoint-use-case.js +159 -0
- package/dist/server/agent-checkpoint-use-case.js.map +1 -0
- package/dist/server/app.d.ts +5 -0
- package/dist/server/app.d.ts.map +1 -0
- package/dist/server/app.js +87 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/auth.js +22 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/http.d.ts +86 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +455 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/idempotency.d.ts +6 -0
- package/dist/server/idempotency.d.ts.map +1 -0
- package/dist/server/idempotency.js +210 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/instance-lock.d.ts +17 -0
- package/dist/server/instance-lock.d.ts.map +1 -0
- package/dist/server/instance-lock.js +118 -0
- package/dist/server/instance-lock.js.map +1 -0
- package/dist/server/router.d.ts +29 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +129 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/routes/agent-capability-gate.d.ts +43 -0
- package/dist/server/routes/agent-capability-gate.d.ts.map +1 -0
- package/dist/server/routes/agent-capability-gate.js +202 -0
- package/dist/server/routes/agent-capability-gate.js.map +1 -0
- package/dist/server/routes/agent-events.d.ts +5 -0
- package/dist/server/routes/agent-events.d.ts.map +1 -0
- package/dist/server/routes/agent-events.js +53 -0
- package/dist/server/routes/agent-events.js.map +1 -0
- package/dist/server/routes/agent-intake.d.ts +5 -0
- package/dist/server/routes/agent-intake.d.ts.map +1 -0
- package/dist/server/routes/agent-intake.js +50 -0
- package/dist/server/routes/agent-intake.js.map +1 -0
- package/dist/server/routes/agent-promotions.d.ts +5 -0
- package/dist/server/routes/agent-promotions.d.ts.map +1 -0
- package/dist/server/routes/agent-promotions.js +55 -0
- package/dist/server/routes/agent-promotions.js.map +1 -0
- package/dist/server/routes/agent-runs.d.ts +32 -0
- package/dist/server/routes/agent-runs.d.ts.map +1 -0
- package/dist/server/routes/agent-runs.js +165 -0
- package/dist/server/routes/agent-runs.js.map +1 -0
- package/dist/server/routes/request-binding.d.ts +5 -0
- package/dist/server/routes/request-binding.d.ts.map +1 -0
- package/dist/server/routes/request-binding.js +49 -0
- package/dist/server/routes/request-binding.js.map +1 -0
- package/dist/server/routes/task5-support.d.ts +4 -0
- package/dist/server/routes/task5-support.d.ts.map +1 -0
- package/dist/server/routes/task5-support.js +6 -0
- package/dist/server/routes/task5-support.js.map +1 -0
- package/dist/server/routes/task5.d.ts +5 -0
- package/dist/server/routes/task5.d.ts.map +1 -0
- package/dist/server/routes/task5.js +85 -0
- package/dist/server/routes/task5.js.map +1 -0
- package/dist/server/runtime-descriptor.d.ts +24 -0
- package/dist/server/runtime-descriptor.d.ts.map +1 -0
- package/dist/server/runtime-descriptor.js +156 -0
- package/dist/server/runtime-descriptor.js.map +1 -0
- package/dist/server/write-queue.d.ts +20 -0
- package/dist/server/write-queue.d.ts.map +1 -0
- package/dist/server/write-queue.js +83 -0
- package/dist/server/write-queue.js.map +1 -0
- package/dist/setup/claude-config.d.ts +8 -0
- package/dist/setup/claude-config.d.ts.map +1 -0
- package/dist/setup/claude-config.js +95 -0
- package/dist/setup/claude-config.js.map +1 -0
- package/dist/setup/client-detection.d.ts +13 -0
- package/dist/setup/client-detection.d.ts.map +1 -0
- package/dist/setup/client-detection.js +64 -0
- package/dist/setup/client-detection.js.map +1 -0
- package/dist/setup/enno-client-config.d.ts +9 -0
- package/dist/setup/enno-client-config.d.ts.map +1 -0
- package/dist/setup/enno-client-config.js +172 -0
- package/dist/setup/enno-client-config.js.map +1 -0
- package/dist/setup/hermes-config.d.ts +7 -0
- package/dist/setup/hermes-config.d.ts.map +1 -0
- package/dist/setup/hermes-config.js +145 -0
- package/dist/setup/hermes-config.js.map +1 -0
- package/dist/setup/legacy-client-cleanup.d.ts +6 -0
- package/dist/setup/legacy-client-cleanup.d.ts.map +1 -0
- package/dist/setup/legacy-client-cleanup.js +152 -0
- package/dist/setup/legacy-client-cleanup.js.map +1 -0
- package/dist/setup/managed-text.d.ts +6 -0
- package/dist/setup/managed-text.d.ts.map +1 -0
- package/dist/setup/managed-text.js +52 -0
- package/dist/setup/managed-text.js.map +1 -0
- package/dist/setup/mcp-conflict.d.ts +4 -0
- package/dist/setup/mcp-conflict.d.ts.map +1 -0
- package/dist/setup/mcp-conflict.js +15 -0
- package/dist/setup/mcp-conflict.js.map +1 -0
- package/dist/setup/opencode-config.d.ts +8 -0
- package/dist/setup/opencode-config.d.ts.map +1 -0
- package/dist/setup/opencode-config.js +98 -0
- package/dist/setup/opencode-config.js.map +1 -0
- package/dist/setup/project-agent-refresh.d.ts +41 -0
- package/dist/setup/project-agent-refresh.d.ts.map +1 -0
- package/dist/setup/project-agent-refresh.js +158 -0
- package/dist/setup/project-agent-refresh.js.map +1 -0
- package/dist/setup/render.d.ts +13 -0
- package/dist/setup/render.d.ts.map +1 -0
- package/dist/setup/render.js +334 -0
- package/dist/setup/render.js.map +1 -0
- package/dist/setup/standard-skills.d.ts +60 -0
- package/dist/setup/standard-skills.d.ts.map +1 -0
- package/dist/setup/standard-skills.js +133 -0
- package/dist/setup/standard-skills.js.map +1 -0
- package/dist/setup/strict-json.d.ts +7 -0
- package/dist/setup/strict-json.d.ts.map +1 -0
- package/dist/setup/strict-json.js +98 -0
- package/dist/setup/strict-json.js.map +1 -0
- package/dist/setup/strict-toml.d.ts +18 -0
- package/dist/setup/strict-toml.d.ts.map +1 -0
- package/dist/setup/strict-toml.js +491 -0
- package/dist/setup/strict-toml.js.map +1 -0
- package/dist/skills/cache.d.ts +15 -0
- package/dist/skills/cache.d.ts.map +1 -0
- package/dist/skills/cache.js +19 -0
- package/dist/skills/cache.js.map +1 -0
- package/dist/skills/candidate-ranking.d.ts +15 -0
- package/dist/skills/candidate-ranking.d.ts.map +1 -0
- package/dist/skills/candidate-ranking.js +52 -0
- package/dist/skills/candidate-ranking.js.map +1 -0
- package/dist/skills/chunking.d.ts +11 -0
- package/dist/skills/chunking.d.ts.map +1 -0
- package/dist/skills/chunking.js +291 -0
- package/dist/skills/chunking.js.map +1 -0
- package/dist/skills/config.d.ts +19 -0
- package/dist/skills/config.d.ts.map +1 -0
- package/dist/skills/config.js +103 -0
- package/dist/skills/config.js.map +1 -0
- package/dist/skills/discovery-service.d.ts +26 -0
- package/dist/skills/discovery-service.d.ts.map +1 -0
- package/dist/skills/discovery-service.js +929 -0
- package/dist/skills/discovery-service.js.map +1 -0
- package/dist/skills/external-transport.d.ts +2 -0
- package/dist/skills/external-transport.d.ts.map +1 -0
- package/dist/skills/external-transport.js +30 -0
- package/dist/skills/external-transport.js.map +1 -0
- package/dist/skills/find.d.ts +17 -0
- package/dist/skills/find.d.ts.map +1 -0
- package/dist/skills/find.js +59 -0
- package/dist/skills/find.js.map +1 -0
- package/dist/skills/gap-detection.d.ts +23 -0
- package/dist/skills/gap-detection.d.ts.map +1 -0
- package/dist/skills/gap-detection.js +62 -0
- package/dist/skills/gap-detection.js.map +1 -0
- package/dist/skills/import-preparation.d.ts +4 -0
- package/dist/skills/import-preparation.d.ts.map +1 -0
- package/dist/skills/import-preparation.js +20 -0
- package/dist/skills/import-preparation.js.map +1 -0
- package/dist/skills/materialization-authority.d.ts +11 -0
- package/dist/skills/materialization-authority.d.ts.map +1 -0
- package/dist/skills/materialization-authority.js +92 -0
- package/dist/skills/materialization-authority.js.map +1 -0
- package/dist/skills/materialization-service.d.ts +22 -0
- package/dist/skills/materialization-service.d.ts.map +1 -0
- package/dist/skills/materialization-service.js +101 -0
- package/dist/skills/materialization-service.js.map +1 -0
- package/dist/skills/official-catalog.d.ts +31 -0
- package/dist/skills/official-catalog.d.ts.map +1 -0
- package/dist/skills/official-catalog.js +110 -0
- package/dist/skills/official-catalog.js.map +1 -0
- package/dist/skills/providers/schema.d.ts +30 -0
- package/dist/skills/providers/schema.d.ts.map +1 -0
- package/dist/skills/providers/schema.js +354 -0
- package/dist/skills/providers/schema.js.map +1 -0
- package/dist/skills/providers/skills-sh-compat.d.ts +17 -0
- package/dist/skills/providers/skills-sh-compat.d.ts.map +1 -0
- package/dist/skills/providers/skills-sh-compat.js +73 -0
- package/dist/skills/providers/skills-sh-compat.js.map +1 -0
- package/dist/skills/providers/skills-sh-v1.d.ts +23 -0
- package/dist/skills/providers/skills-sh-v1.d.ts.map +1 -0
- package/dist/skills/providers/skills-sh-v1.js +152 -0
- package/dist/skills/providers/skills-sh-v1.js.map +1 -0
- package/dist/skills/query-builder.d.ts +18 -0
- package/dist/skills/query-builder.d.ts.map +1 -0
- package/dist/skills/query-builder.js +93 -0
- package/dist/skills/query-builder.js.map +1 -0
- package/dist/skills/source/errors.d.ts +9 -0
- package/dist/skills/source/errors.d.ts.map +1 -0
- package/dist/skills/source/errors.js +15 -0
- package/dist/skills/source/errors.js.map +1 -0
- package/dist/skills/source/frontmatter.d.ts +9 -0
- package/dist/skills/source/frontmatter.d.ts.map +1 -0
- package/dist/skills/source/frontmatter.js +77 -0
- package/dist/skills/source/frontmatter.js.map +1 -0
- package/dist/skills/source/github-fetcher.d.ts +20 -0
- package/dist/skills/source/github-fetcher.d.ts.map +1 -0
- package/dist/skills/source/github-fetcher.js +296 -0
- package/dist/skills/source/github-fetcher.js.map +1 -0
- package/dist/skills/source/snapshot-validator.d.ts +28 -0
- package/dist/skills/source/snapshot-validator.d.ts.map +1 -0
- package/dist/skills/source/snapshot-validator.js +186 -0
- package/dist/skills/source/snapshot-validator.js.map +1 -0
- package/dist/skills/store.d.ts +180 -0
- package/dist/skills/store.d.ts.map +1 -0
- package/dist/skills/store.js +1712 -0
- package/dist/skills/store.js.map +1 -0
- package/dist/skills/types.d.ts +171 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/web/i18n.d.ts +184 -0
- package/dist/web/i18n.d.ts.map +1 -0
- package/dist/web/i18n.js +733 -0
- package/dist/web/i18n.js.map +1 -0
- package/dist/web/server.d.ts +16 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +862 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/ui.d.ts +6 -0
- package/dist/web/ui.d.ts.map +1 -0
- package/dist/web/ui.js +1328 -0
- package/dist/web/ui.js.map +1 -0
- package/docs/README.ja.md +14 -0
- package/docs/README.md +16 -0
- package/docs/agent-file.md +72 -0
- package/docs/agent-gateway.md +104 -0
- package/docs/architecture.md +12 -0
- package/docs/cli-contract.md +39 -0
- package/docs/client-compatibility.md +299 -0
- package/docs/concepts.ja.md +25 -0
- package/docs/concepts.md +33 -0
- package/docs/database.md +11 -0
- package/docs/dsh-plugin.md +108 -0
- package/docs/enno-oduno.ja.md +22 -0
- package/docs/enno-oduno.md +35 -0
- package/docs/execution-ledger.md +89 -0
- package/docs/getting-started.ja.md +88 -0
- package/docs/getting-started.md +99 -0
- package/docs/release-notes-0.1.18.md +103 -0
- package/docs/retrieval-evaluation.md +10 -0
- package/docs/security-and-trust.ja.md +29 -0
- package/docs/security-and-trust.md +39 -0
- package/docs/security.md +11 -0
- package/docs/semantic-retrieval.ja.md +18 -0
- package/docs/semantic-retrieval.md +26 -0
- package/docs/sqlite-driver-adr.md +8 -0
- package/dsh/cordis.patch.yml +7 -0
- package/migrations/001_initial.sql +123 -0
- package/migrations/002_fts.sql +22 -0
- package/migrations/003_akinator.sql +30 -0
- package/migrations/004_agent_gateway.sql +261 -0
- package/migrations/005_hybrid_search.sql +40 -0
- package/migrations/006_context_v2.sql +4 -0
- package/migrations/007_akinator_reasoning.sql +59 -0
- package/migrations/008_federated_memory.sql +46 -0
- package/migrations/009_external_skill_discovery.sql +126 -0
- package/migrations/010_nudge_deliveries.sql +50 -0
- package/migrations/011_nudge_integrity.sql +52 -0
- package/migrations/012_context_delivery_v4.sql +3 -0
- package/migrations/013_enno_oduno.sql +176 -0
- package/migrations/014_oduno_reflection_phases.sql +40 -0
- package/migrations/015_skill_discovery_attempt_digests.sql +90 -0
- package/migrations/016_enno_advisory_rounds.sql +67 -0
- package/migrations/017_enno_advisory_protocol_v2.sql +101 -0
- package/migrations/018_enno_repository_routing.sql +5 -0
- package/migrations/019_enno_execution_integrity.sql +149 -0
- package/migrations/020_cjk_fts.sql +80 -0
- package/migrations/021_semantic_embeddings.sql +122 -0
- package/migrations/022_embedding_setup_v2.sql +236 -0
- package/migrations/023_enno_dsh_client.sql +291 -0
- package/migrations/down/020_cjk_fts.sql +38 -0
- package/migrations/down/021_semantic_embeddings.sql +17 -0
- package/migrations/down/022_embedding_setup_v2.sql +133 -0
- package/package.json +101 -0
- package/skills/kiokuko-enno-oduno/SKILL.md +209 -0
- package/skills/kiokuko-enno-oduno/enno-oduno.png +0 -0
- package/skills/kiokuko-simple-work/SKILL.md +112 -0
- package/skills/kiokuko-single-purpose-functions/SKILL.md +82 -0
- package/skills/kiokuko-single-purpose-functions/references/boundaries-and-ownership.md +50 -0
- package/skills/kiokuko-single-purpose-functions/references/domain-and-types.md +48 -0
- package/skills/kiokuko-single-purpose-functions/references/effects-and-data.md +43 -0
- package/skills/kiokuko-single-purpose-functions/references/kiokuko-patterns.md +344 -0
- package/skills/kiokuko-single-purpose-functions/references/problem-shaping-and-language.md +84 -0
- package/skills/kiokuko-single-purpose-functions/references/protocols-and-idempotency.md +42 -0
- package/skills/kiokuko-single-purpose-functions/references/review-checklist.md +97 -0
- package/skills/kiokuko-single-purpose-functions/references/verification.md +41 -0
- package/skills/kiokuko-soul/SKILL.md +104 -0
- package/skills/kiokuko-ui-design-soul/SKILL.md +73 -0
- package/skills/kiokuko-ui-design-soul/references/accessibility-and-navigation.md +31 -0
- package/skills/kiokuko-ui-design-soul/references/async-recovery.md +49 -0
- package/skills/kiokuko-ui-design-soul/references/forms-and-controls.md +35 -0
- package/skills/kiokuko-ui-design-soul/references/interaction-feedback.md +34 -0
- package/skills/kiokuko-ui-design-soul/references/responsive-and-platform.md +38 -0
- package/skills/kiokuko-ui-design-soul/references/safety-and-review.md +39 -0
- package/skills/kiokuko-ui-design-soul/references/ui-checklist.md +71 -0
- package/skills/memory-reasoning/SKILL.md +52 -0
- package/templates/AGENTS.md +46 -0
|
@@ -0,0 +1,929 @@
|
|
|
1
|
+
import { satisfiesFrameworkVersion } from '../repository/framework-version.js';
|
|
2
|
+
import { detectSkillGap } from './gap-detection.js';
|
|
3
|
+
import { buildSkillQueries } from './query-builder.js';
|
|
4
|
+
import { rankSkillCandidates } from './candidate-ranking.js';
|
|
5
|
+
import { documentsFromSkillSnapshot } from './import-preparation.js';
|
|
6
|
+
import { readSkillDiscoveryConfig } from './config.js';
|
|
7
|
+
import { SkillProviderError } from './providers/schema.js';
|
|
8
|
+
import { SkillDiscoveryCache } from './cache.js';
|
|
9
|
+
import { GitHubSkillSourceFetcher, SkillSourceError } from './source/github-fetcher.js';
|
|
10
|
+
import { validateSkillSnapshot } from './source/snapshot-validator.js';
|
|
11
|
+
import { clearPersistentSkillAuditFailure, clearPersistentSkillSourceFailure, externalSkillRefreshExpectation, externalSkillRequirement, externalSkillSourceFetchRequest, externalSkillWorkspace, markExternalSkillRefreshFailureInTransaction, persistExistingSkillImportInTransaction, persistNewSkillImportInTransaction, readExternalSkill, readPersistentSkillAuditFailure, readPersistentSkillSourceFailure, refreshExternalSkillSnapshotInTransaction, listExternalSkills, readPersistentSkillSearchCache, recordDiscoveredSkillInTransaction, writePersistentSkillAuditFailure, writePersistentSkillSearchCache, writePersistentSkillSourceFailure } from './store.js';
|
|
12
|
+
import { createSkillRegistryProvider, findSkills } from './find.js';
|
|
13
|
+
import { KiokukoError } from '../errors.js';
|
|
14
|
+
import { reviewedCatalogSkill, technologyDefinition } from './official-catalog.js';
|
|
15
|
+
import { isSqliteOperationalError } from '../db/sqlite-retry.js';
|
|
16
|
+
import { withImmediateTransaction } from '../db/transaction.js';
|
|
17
|
+
import { authorizeSkillMaterialization, hasSkillMaterializationAuthorization } from './materialization-authority.js';
|
|
18
|
+
import { DEFAULT_EXTERNAL_SKILL_FAILURE_TTL_MS, externalSkillFailureTtlMs } from './materialization-service.js';
|
|
19
|
+
import { compareCanonicalStrings } from '../serialization/validate.js';
|
|
20
|
+
function candidateId(candidate) { return `${candidate.sourceType}:${candidate.source}:${candidate.slug}`; }
|
|
21
|
+
function compatibilityProvider(provider) { return provider.startsWith('skills-sh-compat-'); }
|
|
22
|
+
function containsAlias(value, alias) {
|
|
23
|
+
const escaped = alias.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
24
|
+
return new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'iu').test(value);
|
|
25
|
+
}
|
|
26
|
+
function providerFailureCode(error) {
|
|
27
|
+
if (!(error instanceof SkillProviderError))
|
|
28
|
+
return undefined;
|
|
29
|
+
const code = error.code;
|
|
30
|
+
switch (code) {
|
|
31
|
+
case 'registry_authentication_failed':
|
|
32
|
+
case 'registry_unavailable':
|
|
33
|
+
case 'registry_rate_limited':
|
|
34
|
+
case 'registry_invalid_response':
|
|
35
|
+
return code;
|
|
36
|
+
default:
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function sourceOrValidationFailureCode(error) {
|
|
41
|
+
if (!(error instanceof SkillSourceError))
|
|
42
|
+
return undefined;
|
|
43
|
+
const code = error.code;
|
|
44
|
+
switch (code) {
|
|
45
|
+
case 'source_missing':
|
|
46
|
+
return 'candidate_not_found_at_source';
|
|
47
|
+
case 'source_rate_limited':
|
|
48
|
+
case 'source_unavailable':
|
|
49
|
+
case 'candidate_not_found_at_source':
|
|
50
|
+
case 'source_tree_truncated':
|
|
51
|
+
case 'skill_disabled_for_model_invocation':
|
|
52
|
+
case 'skill_secret_detected':
|
|
53
|
+
case 'skill_too_large':
|
|
54
|
+
case 'skill_validation_failed':
|
|
55
|
+
case 'skill_blocked':
|
|
56
|
+
return code;
|
|
57
|
+
default:
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function persistenceFailureCode(error) {
|
|
62
|
+
if (error instanceof KiokukoError) {
|
|
63
|
+
if (error.code === 'CONFLICT')
|
|
64
|
+
return 'persistence_conflict';
|
|
65
|
+
if (error.code === 'BACKPRESSURE')
|
|
66
|
+
return 'persistence_failed';
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return isSqliteOperationalError(error) ? 'persistence_failed' : undefined;
|
|
70
|
+
}
|
|
71
|
+
class CallerPersistenceAssertionError extends Error {
|
|
72
|
+
assertionError;
|
|
73
|
+
constructor(assertionError) {
|
|
74
|
+
super('Caller persistence assertion failed');
|
|
75
|
+
this.assertionError = assertionError;
|
|
76
|
+
this.name = 'CallerPersistenceAssertionError';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function cachedProviderFailure(value) {
|
|
80
|
+
if (value.failureCode === 'registry_authentication_failed')
|
|
81
|
+
return value.failureCode;
|
|
82
|
+
if (value.cacheOutcome === 'unavailable')
|
|
83
|
+
return 'registry_unavailable';
|
|
84
|
+
if (value.cacheOutcome === 'rate_limited')
|
|
85
|
+
return 'registry_rate_limited';
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
function requirementMatchScore(candidate, requirement, requirements) {
|
|
89
|
+
const values = [candidate.name, candidate.slug.split('/').at(-1) ?? candidate.slug].map((value) => value.toLowerCase());
|
|
90
|
+
const identities = [...new Set([requirement.id, requirement.technology].map((value) => value.toLowerCase()))];
|
|
91
|
+
if (values.some((value) => identities.includes(value)))
|
|
92
|
+
return 100;
|
|
93
|
+
if (values.some((value) => identities.some((identity) => containsAlias(value, identity))))
|
|
94
|
+
return 80;
|
|
95
|
+
const uniqueAliases = requirement.aliases.map((alias) => alias.toLowerCase()).filter((alias) => !requirements.some((other) => other !== requirement
|
|
96
|
+
&& [other.id, other.technology, ...other.aliases].some((value) => value.toLowerCase() === alias)));
|
|
97
|
+
if (values.some((value) => uniqueAliases.some((alias) => containsAlias(value, alias))))
|
|
98
|
+
return 60;
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
function requirementFor(candidate, requirements) {
|
|
102
|
+
return requirements.map((requirement) => ({ requirement, score: requirementMatchScore(candidate, requirement, requirements) }))
|
|
103
|
+
.filter(({ score }) => score > 0)
|
|
104
|
+
.sort((left, right) => right.score - left.score || compareCanonicalStrings(left.requirement.id, right.requirement.id))[0]?.requirement;
|
|
105
|
+
}
|
|
106
|
+
function normalizeOfficial(candidate, requirement) {
|
|
107
|
+
const official = reviewedCatalogSkill(candidate) !== undefined
|
|
108
|
+
? 'catalog-verified'
|
|
109
|
+
: requirement.owners.some((owner) => candidate.source.toLowerCase().startsWith(`${owner.toLowerCase()}/`))
|
|
110
|
+
? 'owner-verified'
|
|
111
|
+
: candidate.officialStatus;
|
|
112
|
+
return { ...candidate, officialStatus: official };
|
|
113
|
+
}
|
|
114
|
+
function requirementsForQuery(query, requirements) {
|
|
115
|
+
const normalized = query.normalize('NFKC').toLowerCase();
|
|
116
|
+
return requirements.filter((requirement) => {
|
|
117
|
+
const technology = requirement.technology.normalize('NFKC').toLowerCase();
|
|
118
|
+
return requirement.queries.some((value) => value.normalize('NFKC').toLowerCase() === normalized)
|
|
119
|
+
|| normalized === `${technology} testing`
|
|
120
|
+
|| normalized === `${technology} debug`
|
|
121
|
+
|| normalized === `${technology} review`;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function locallySafeCommunityCandidate(candidate) {
|
|
125
|
+
return candidate.sourceType === 'github'
|
|
126
|
+
&& !candidate.duplicate
|
|
127
|
+
&& /^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/u.test(candidate.source)
|
|
128
|
+
&& /^[A-Za-z0-9_.\-/]{1,240}$/u.test(candidate.slug)
|
|
129
|
+
&& !candidate.slug.split('/').some((part) => part === '' || part === '.' || part === '..');
|
|
130
|
+
}
|
|
131
|
+
const CURATED_CACHE_QUERY = '__curated__';
|
|
132
|
+
const DEFAULT_AUTOMATIC_MATERIALIZATION_LIMIT = 1;
|
|
133
|
+
const MAX_AUTOMATIC_MATERIALIZATION_LIMIT = 2;
|
|
134
|
+
const MAX_SOURCE_ATTEMPTS = 6;
|
|
135
|
+
const MAX_COMMUNITY_AUDITS = 6;
|
|
136
|
+
const IMPORT_FRESHNESS_MS = 7 * 24 * 60 * 60_000;
|
|
137
|
+
function automaticMaterializationLimit(value) {
|
|
138
|
+
const resolved = value ?? DEFAULT_AUTOMATIC_MATERIALIZATION_LIMIT;
|
|
139
|
+
if (!Number.isSafeInteger(resolved) || resolved < 1 || resolved > MAX_AUTOMATIC_MATERIALIZATION_LIMIT) {
|
|
140
|
+
throw new KiokukoError('VALIDATION_ERROR', 'External skill materialization limit must be 1 or 2');
|
|
141
|
+
}
|
|
142
|
+
return resolved;
|
|
143
|
+
}
|
|
144
|
+
function providerNegativeCache(error) {
|
|
145
|
+
const code = error.code;
|
|
146
|
+
switch (code) {
|
|
147
|
+
case 'registry_rate_limited':
|
|
148
|
+
return { outcome: 'rate_limited', ttlMs: externalSkillFailureTtlMs(error.retryAfterSeconds) };
|
|
149
|
+
case 'registry_authentication_failed':
|
|
150
|
+
return { outcome: 'unavailable', ttlMs: DEFAULT_EXTERNAL_SKILL_FAILURE_TTL_MS, failureCode: code };
|
|
151
|
+
case 'registry_unavailable':
|
|
152
|
+
return { outcome: 'unavailable', ttlMs: DEFAULT_EXTERNAL_SKILL_FAILURE_TTL_MS };
|
|
153
|
+
case 'registry_invalid_response':
|
|
154
|
+
return undefined;
|
|
155
|
+
default:
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function frameworkVersionMatches(actual, expected) {
|
|
160
|
+
if (expected === undefined)
|
|
161
|
+
return true;
|
|
162
|
+
if (actual === undefined)
|
|
163
|
+
return false;
|
|
164
|
+
const compatibility = satisfiesFrameworkVersion(actual, expected);
|
|
165
|
+
return compatibility === 'exact' || compatibility === 'compatible';
|
|
166
|
+
}
|
|
167
|
+
function applicabilityMatchesFingerprint(requirement, fingerprint) {
|
|
168
|
+
const normalize = (value) => value.normalize('NFKC').toLowerCase();
|
|
169
|
+
const dimensionMatches = (expected, actual) => expected === undefined || expected.length === 0 || expected.some((value) => actual.some((candidate) => normalize(candidate) === normalize(value)));
|
|
170
|
+
if (!dimensionMatches(requirement.applicability.languages, fingerprint.languages)
|
|
171
|
+
|| !dimensionMatches(requirement.applicability.databases, fingerprint.databases)
|
|
172
|
+
|| !dimensionMatches(requirement.applicability.runtimes, fingerprint.runtimes)
|
|
173
|
+
|| !dimensionMatches(requirement.applicability.tools, fingerprint.tools))
|
|
174
|
+
return false;
|
|
175
|
+
const frameworks = requirement.applicability.frameworks;
|
|
176
|
+
return frameworks === undefined || frameworks.length === 0 || frameworks.some((expected) => fingerprint.frameworks.some((actual) => normalize(actual.name) === normalize(expected.name) && frameworkVersionMatches(actual.version, expected.version)));
|
|
177
|
+
}
|
|
178
|
+
function officialStatus(value) {
|
|
179
|
+
return value === 'curated' || value === 'catalog-verified' || value === 'owner-verified' || value === 'registry-only' ? value : 'unknown';
|
|
180
|
+
}
|
|
181
|
+
function reusableImportedSkill(record, mode) {
|
|
182
|
+
if (reviewedCatalogSkill({ source: record.sourceLocator, slug: record.slug }) !== undefined)
|
|
183
|
+
return true;
|
|
184
|
+
// The materialized record itself crossed the runtime authority boundary.
|
|
185
|
+
// Its persisted audit label is descriptive and must not become a reusable
|
|
186
|
+
// authorization input for later discovery runs.
|
|
187
|
+
return mode === 'community';
|
|
188
|
+
}
|
|
189
|
+
function isReviewedCatalogCandidate(candidate, requirement) {
|
|
190
|
+
const definition = technologyDefinition(requirement.id);
|
|
191
|
+
return definition !== undefined
|
|
192
|
+
&& requirement.repositories.some((source) => source.normalize('NFKC').toLowerCase() === candidate.source.normalize('NFKC').toLowerCase())
|
|
193
|
+
&& (definition.reviewedSkills ?? []).some((skill) => skill.slug === candidate.slug);
|
|
194
|
+
}
|
|
195
|
+
function isReviewedCatalogIdentity(record, requirement) {
|
|
196
|
+
return isReviewedCatalogCandidate(candidateFromRecord(record), requirement);
|
|
197
|
+
}
|
|
198
|
+
function freshImportedSkill(database, requirement, rows, now, mode, fingerprint) {
|
|
199
|
+
const nowMs = Date.parse(now);
|
|
200
|
+
if (!Number.isFinite(nowMs))
|
|
201
|
+
return undefined;
|
|
202
|
+
return rows.find((record) => {
|
|
203
|
+
if (record.state !== 'imported' || record.sourceCommit === null || record.snapshotHash === null)
|
|
204
|
+
return false;
|
|
205
|
+
if (!reusableImportedSkill(record, mode))
|
|
206
|
+
return false;
|
|
207
|
+
const checkedAt = Date.parse(record.lastCheckedAt);
|
|
208
|
+
const age = nowMs - checkedAt;
|
|
209
|
+
if (!Number.isFinite(checkedAt) || age < 0 || age >= IMPORT_FRESHNESS_MS)
|
|
210
|
+
return false;
|
|
211
|
+
const importedRequirement = externalSkillRequirement(database, record.skillId);
|
|
212
|
+
if (importedRequirement === undefined)
|
|
213
|
+
return false;
|
|
214
|
+
return applicabilityMatchesFingerprint(importedRequirement, fingerprint)
|
|
215
|
+
&& (requirementOverlaps(importedRequirement, requirement) || isReviewedCatalogIdentity(record, requirement));
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function sourceSkillIdentity(value) {
|
|
219
|
+
return `${value.sourceType.normalize('NFKC').toLowerCase()}\u0000${value.source.normalize('NFKC').toLowerCase()}\u0000${value.slug}`;
|
|
220
|
+
}
|
|
221
|
+
function suppressAutomaticImport(record) {
|
|
222
|
+
return record !== undefined
|
|
223
|
+
&& (record.disabledAt !== null || record.state === 'disabled' || record.state === 'blocked');
|
|
224
|
+
}
|
|
225
|
+
function sameSkillSource(record, candidate) {
|
|
226
|
+
return record.sourceType.normalize('NFKC').toLowerCase() === candidate.sourceType.normalize('NFKC').toLowerCase()
|
|
227
|
+
&& record.sourceLocator.normalize('NFKC').toLowerCase() === candidate.source.normalize('NFKC').toLowerCase();
|
|
228
|
+
}
|
|
229
|
+
function requirementOverlaps(left, right) {
|
|
230
|
+
const normalize = (value) => value.normalize('NFKC').toLowerCase();
|
|
231
|
+
const leftCanonical = new Set([left.id, left.technology].map(normalize));
|
|
232
|
+
const rightCanonical = new Set([right.id, right.technology].map(normalize));
|
|
233
|
+
if ([...leftCanonical].some((value) => rightCanonical.has(value)))
|
|
234
|
+
return true;
|
|
235
|
+
const leftNames = new Set([left.id, left.technology, ...left.aliases].map(normalize));
|
|
236
|
+
const rightNames = new Set([right.id, right.technology, ...right.aliases].map(normalize));
|
|
237
|
+
return [...rightCanonical].some((value) => leftNames.has(value))
|
|
238
|
+
&& [...leftCanonical].some((value) => rightNames.has(value));
|
|
239
|
+
}
|
|
240
|
+
function existingIdentityOwners(database, rows, candidate, canonical, requirement, fingerprint) {
|
|
241
|
+
const requestedIdentity = sourceSkillIdentity(candidate);
|
|
242
|
+
const canonicalIdentity = sourceSkillIdentity(canonical);
|
|
243
|
+
return rows.filter((record) => {
|
|
244
|
+
if (!sameSkillSource(record, canonical))
|
|
245
|
+
return false;
|
|
246
|
+
const identity = sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug });
|
|
247
|
+
if (identity === requestedIdentity || identity === canonicalIdentity)
|
|
248
|
+
return true;
|
|
249
|
+
if (record.sourceCommit === null && record.snapshotHash === null && record.state === 'stale' && record.disabledAt === null)
|
|
250
|
+
return true;
|
|
251
|
+
const stored = externalSkillRequirement(database, record.skillId);
|
|
252
|
+
return stored !== undefined && requirementOverlaps(stored, requirement)
|
|
253
|
+
&& (record.disabledAt !== null || record.state === 'disabled' || record.state === 'stale' || record.state === 'blocked'
|
|
254
|
+
|| applicabilityMatchesFingerprint(stored, fingerprint));
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function candidateFromRecord(record) {
|
|
258
|
+
if (record.sourceType !== 'github')
|
|
259
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'External Skill source type is invalid');
|
|
260
|
+
return {
|
|
261
|
+
id: record.skillId,
|
|
262
|
+
provider: record.provider,
|
|
263
|
+
name: record.name,
|
|
264
|
+
slug: record.slug,
|
|
265
|
+
source: record.sourceLocator,
|
|
266
|
+
sourceType: record.sourceType,
|
|
267
|
+
installUrl: record.installUrl,
|
|
268
|
+
installs: record.installs,
|
|
269
|
+
duplicate: record.duplicate,
|
|
270
|
+
officialStatus: officialStatus(record.officialStatus),
|
|
271
|
+
auditStatus: record.auditStatus,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export class SkillDiscoveryService {
|
|
275
|
+
cache;
|
|
276
|
+
provider;
|
|
277
|
+
sourceFetcher;
|
|
278
|
+
sourceFlights = new Map();
|
|
279
|
+
now;
|
|
280
|
+
assertBeforePersist;
|
|
281
|
+
constructor(dependencies = {}) {
|
|
282
|
+
const config = readSkillDiscoveryConfig();
|
|
283
|
+
this.provider = dependencies.provider ?? createSkillRegistryProvider(dependencies.fetchImpl);
|
|
284
|
+
this.sourceFetcher = dependencies.sourceFetcher ?? new GitHubSkillSourceFetcher({ token: config.githubToken, ...(dependencies.fetchImpl ? { fetchImpl: dependencies.fetchImpl } : {}) });
|
|
285
|
+
this.cache = dependencies.cache ?? new SkillDiscoveryCache();
|
|
286
|
+
this.now = dependencies.now ?? (() => new Date().toISOString());
|
|
287
|
+
this.assertBeforePersist = dependencies.assertBeforePersist;
|
|
288
|
+
}
|
|
289
|
+
async fetchSnapshot(candidate, request, signal) {
|
|
290
|
+
const key = JSON.stringify([candidateId(candidate), request.purpose, request.purpose === 'refresh' ? request.expectedPrimaryPath : null]);
|
|
291
|
+
const active = signal === undefined ? this.sourceFlights.get(key) : undefined;
|
|
292
|
+
if (active)
|
|
293
|
+
return active;
|
|
294
|
+
const flight = this.sourceFetcher.fetch(candidate, request, signal);
|
|
295
|
+
if (signal !== undefined)
|
|
296
|
+
return flight;
|
|
297
|
+
this.sourceFlights.set(key, flight);
|
|
298
|
+
try {
|
|
299
|
+
return await flight;
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
if (this.sourceFlights.get(key) === flight)
|
|
303
|
+
this.sourceFlights.delete(key);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async searchWithCache(database, input) {
|
|
307
|
+
const persistent = readPersistentSkillSearchCache(database, { ...input, provider: input.provider.id });
|
|
308
|
+
if (persistent !== null) {
|
|
309
|
+
if (persistent.failureCode === 'registry_authentication_failed') {
|
|
310
|
+
if (!input.allowAuthenticationFallback || input.provider.authenticationFallback === undefined)
|
|
311
|
+
return { result: persistent, cacheHits: 1, authenticationFallbackUsed: false, failureCode: persistent.failureCode };
|
|
312
|
+
const fallback = await this.searchWithCache(database, { ...input, provider: input.provider.authenticationFallback, allowAuthenticationFallback: false });
|
|
313
|
+
return { ...fallback, cacheHits: fallback.cacheHits + 1, authenticationFallbackUsed: true };
|
|
314
|
+
}
|
|
315
|
+
const failureCode = cachedProviderFailure(persistent);
|
|
316
|
+
if (failureCode !== undefined)
|
|
317
|
+
return { result: persistent, cacheHits: 1, authenticationFallbackUsed: false, failureCode };
|
|
318
|
+
return { result: persistent, cacheHits: 1, authenticationFallbackUsed: false };
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
const loaded = await this.cache.getOrLoad({
|
|
322
|
+
provider: input.provider.id,
|
|
323
|
+
query: input.query,
|
|
324
|
+
mode: input.mode,
|
|
325
|
+
owner: input.owner,
|
|
326
|
+
loader: () => findSkills({ query: input.query, limit: 20, ...(input.owner === null ? {} : { owner: input.owner }), ...(input.signal === undefined ? {} : { signal: input.signal }) }, {
|
|
327
|
+
provider: input.provider,
|
|
328
|
+
fallbackOnAuthentication: false,
|
|
329
|
+
}),
|
|
330
|
+
});
|
|
331
|
+
writePersistentSkillSearchCache(database, {
|
|
332
|
+
provider: input.provider.id,
|
|
333
|
+
query: input.query,
|
|
334
|
+
owner: input.owner,
|
|
335
|
+
mode: input.mode,
|
|
336
|
+
result: loaded.result,
|
|
337
|
+
outcome: loaded.result.candidates.length === 0 ? 'empty' : 'success',
|
|
338
|
+
ttlMs: loaded.result.candidates.length === 0 ? 6 * 60 * 60_000 : 24 * 60 * 60_000,
|
|
339
|
+
now: input.now,
|
|
340
|
+
});
|
|
341
|
+
return { result: loaded.result, cacheHits: loaded.hit ? 1 : 0, authenticationFallbackUsed: false };
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (error instanceof SkillProviderError) {
|
|
345
|
+
const negativeCache = providerNegativeCache(error);
|
|
346
|
+
if (negativeCache !== undefined) {
|
|
347
|
+
writePersistentSkillSearchCache(database, {
|
|
348
|
+
provider: input.provider.id,
|
|
349
|
+
query: input.query,
|
|
350
|
+
owner: input.owner,
|
|
351
|
+
mode: input.mode,
|
|
352
|
+
result: { provider: input.provider.id, experimental: compatibilityProvider(input.provider.id), candidates: [] },
|
|
353
|
+
outcome: negativeCache.outcome,
|
|
354
|
+
...(negativeCache.failureCode === undefined ? {} : { failureCode: negativeCache.failureCode }),
|
|
355
|
+
ttlMs: negativeCache.ttlMs,
|
|
356
|
+
now: input.now,
|
|
357
|
+
});
|
|
358
|
+
if (error.code === 'registry_authentication_failed' && input.allowAuthenticationFallback && input.provider.authenticationFallback !== undefined) {
|
|
359
|
+
const fallback = await this.searchWithCache(database, { ...input, provider: input.provider.authenticationFallback, allowAuthenticationFallback: false });
|
|
360
|
+
return { ...fallback, authenticationFallbackUsed: true };
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async discover(database, input, modeOverride) {
|
|
368
|
+
const selectedSkillLimit = automaticMaterializationLimit(input.maxSelectedSkills);
|
|
369
|
+
const requestedMode = modeOverride ?? input.mode;
|
|
370
|
+
const now = this.now();
|
|
371
|
+
if (requestedMode === 'off')
|
|
372
|
+
return { attempted: false, mode: requestedMode, requirements: [], queries: [], cacheHits: 0, candidates: 0, selected: [], failures: [] };
|
|
373
|
+
const gap = detectSkillGap({ fingerprint: input.fingerprint, task: input.task, profile: input.profile, recommendedTags: input.recommendedTags, capabilities: input.capabilities, mode: requestedMode });
|
|
374
|
+
const mode = requestedMode === 'community' && gap.catalogAvailability === 'unknown' ? 'official' : requestedMode;
|
|
375
|
+
const base = { attempted: false, mode, requirements: [], queries: [], cacheHits: 0, candidates: 0, selected: [], failures: [] };
|
|
376
|
+
base.requirements = gap.missing.map((requirement) => requirement.id);
|
|
377
|
+
if (!gap.shouldDiscover || gap.missing.length === 0)
|
|
378
|
+
return base;
|
|
379
|
+
const existingSkills = listExternalSkills(database);
|
|
380
|
+
const unresolved = [];
|
|
381
|
+
const reused = new Set();
|
|
382
|
+
for (const requirement of gap.missing) {
|
|
383
|
+
const existing = freshImportedSkill(database, requirement, existingSkills, now, mode, input.fingerprint);
|
|
384
|
+
if (!existing) {
|
|
385
|
+
unresolved.push(requirement);
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (!reused.has(existing.skillId) && base.selected.length < selectedSkillLimit) {
|
|
389
|
+
reused.add(existing.skillId);
|
|
390
|
+
base.selected.push({ skillId: existing.skillId, name: existing.name, source: existing.sourceLocator, officialStatus: officialStatus(existing.officialStatus), imported: true, updated: false });
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const nowMs = Date.parse(now);
|
|
394
|
+
if (!Number.isFinite(nowMs))
|
|
395
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Skill discovery clock is invalid');
|
|
396
|
+
const requirementsToSearch = base.selected.length >= selectedSkillLimit ? [] : unresolved;
|
|
397
|
+
if (requirementsToSearch.length === 0)
|
|
398
|
+
return base;
|
|
399
|
+
base.attempted = true;
|
|
400
|
+
const queries = buildSkillQueries({ requirements: requirementsToSearch, profile: input.profile, mode })
|
|
401
|
+
.slice(0, input.maxQueries ?? 3);
|
|
402
|
+
base.queries = queries;
|
|
403
|
+
for (const query of queries) {
|
|
404
|
+
if (requirementsForQuery(query, requirementsToSearch).length === 0)
|
|
405
|
+
throw new KiokukoError('INTEGRITY_ERROR', 'Generated Skill query has no requirement provenance');
|
|
406
|
+
}
|
|
407
|
+
const seenCandidates = new Set();
|
|
408
|
+
const officialCandidates = new Map();
|
|
409
|
+
const communityCandidates = new Map();
|
|
410
|
+
const associateCandidate = (target, candidate, requirements, forcedRequirement) => {
|
|
411
|
+
seenCandidates.add(candidateId(candidate));
|
|
412
|
+
const requirement = forcedRequirement ?? requirementFor(candidate, requirements);
|
|
413
|
+
if (requirement === undefined)
|
|
414
|
+
return;
|
|
415
|
+
const normalized = normalizeOfficial(candidate, requirement);
|
|
416
|
+
const identity = sourceSkillIdentity(normalized);
|
|
417
|
+
const current = target.get(identity);
|
|
418
|
+
const score = requirementMatchScore(normalized, requirement, gap.missing);
|
|
419
|
+
const currentScore = current === undefined ? -1 : requirementMatchScore(current.candidate, current.requirement, gap.missing);
|
|
420
|
+
if (current === undefined || score > currentScore || (score === currentScore && compareCanonicalStrings(requirement.id, current.requirement.id) < 0)) {
|
|
421
|
+
target.set(identity, { candidate: normalized, requirement });
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
let primaryAuthenticationFailed = false;
|
|
425
|
+
let providerRequestsLatched = false;
|
|
426
|
+
const search = async (query, owner, requirements, target) => {
|
|
427
|
+
if (providerRequestsLatched)
|
|
428
|
+
return;
|
|
429
|
+
try {
|
|
430
|
+
const loaded = await this.searchWithCache(database, { provider: this.provider, query, owner, mode, now, allowAuthenticationFallback: true, ...(input.signal === undefined ? {} : { signal: input.signal }) });
|
|
431
|
+
base.cacheHits += loaded.cacheHits;
|
|
432
|
+
primaryAuthenticationFailed ||= loaded.authenticationFallbackUsed;
|
|
433
|
+
if (loaded.failureCode !== undefined) {
|
|
434
|
+
base.failures.push({ stage: 'search', code: loaded.failureCode });
|
|
435
|
+
providerRequestsLatched = true;
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
for (const candidate of loaded.result.candidates)
|
|
439
|
+
associateCandidate(target, candidate, requirements);
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
const code = providerFailureCode(error);
|
|
443
|
+
if (code === undefined)
|
|
444
|
+
throw error;
|
|
445
|
+
base.failures.push({ stage: 'search', code });
|
|
446
|
+
providerRequestsLatched = true;
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
// Phase 1: scoped searches against verified owners only.
|
|
450
|
+
for (const query of queries) {
|
|
451
|
+
const queryRequirements = requirementsForQuery(query, requirementsToSearch);
|
|
452
|
+
const owners = [...new Set(queryRequirements.flatMap((requirement) => requirement.owners))];
|
|
453
|
+
for (const owner of owners) {
|
|
454
|
+
await search(query, owner, queryRequirements.filter((requirement) => requirement.owners.includes(owner)), officialCandidates);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (this.provider.curated && !primaryAuthenticationFailed && !providerRequestsLatched) {
|
|
458
|
+
const cachedCurated = readPersistentSkillSearchCache(database, { provider: this.provider.id, query: CURATED_CACHE_QUERY, owner: null, mode, now });
|
|
459
|
+
if (cachedCurated) {
|
|
460
|
+
base.cacheHits += 1;
|
|
461
|
+
const failureCode = cachedProviderFailure(cachedCurated);
|
|
462
|
+
if (failureCode !== undefined) {
|
|
463
|
+
base.failures.push({ stage: 'search', code: failureCode });
|
|
464
|
+
providerRequestsLatched = true;
|
|
465
|
+
}
|
|
466
|
+
else
|
|
467
|
+
for (const candidate of cachedCurated.candidates)
|
|
468
|
+
associateCandidate(officialCandidates, candidate, requirementsToSearch);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
try {
|
|
472
|
+
const curated = await this.provider.curated(input.signal);
|
|
473
|
+
const result = { provider: this.provider.id, experimental: compatibilityProvider(this.provider.id), candidates: curated ?? [] };
|
|
474
|
+
writePersistentSkillSearchCache(database, { provider: this.provider.id, query: CURATED_CACHE_QUERY, owner: null, mode, result, outcome: result.candidates.length === 0 ? 'empty' : 'success', ttlMs: 6 * 60 * 60_000, now });
|
|
475
|
+
for (const candidate of result.candidates)
|
|
476
|
+
associateCandidate(officialCandidates, candidate, requirementsToSearch);
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
const code = providerFailureCode(error);
|
|
480
|
+
if (code === undefined)
|
|
481
|
+
throw error;
|
|
482
|
+
if (error instanceof SkillProviderError) {
|
|
483
|
+
const negativeCache = providerNegativeCache(error);
|
|
484
|
+
if (negativeCache !== undefined) {
|
|
485
|
+
writePersistentSkillSearchCache(database, {
|
|
486
|
+
provider: this.provider.id,
|
|
487
|
+
query: CURATED_CACHE_QUERY,
|
|
488
|
+
owner: null,
|
|
489
|
+
mode,
|
|
490
|
+
result: { provider: this.provider.id, experimental: compatibilityProvider(this.provider.id), candidates: [] },
|
|
491
|
+
outcome: negativeCache.outcome,
|
|
492
|
+
...(negativeCache.failureCode === undefined ? {} : { failureCode: negativeCache.failureCode }),
|
|
493
|
+
ttlMs: negativeCache.ttlMs,
|
|
494
|
+
now,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
base.failures.push({ stage: 'search', code });
|
|
499
|
+
providerRequestsLatched = true;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
const communityAudit = new Map();
|
|
504
|
+
let auditAttempts = 0;
|
|
505
|
+
let auditLimitReported = false;
|
|
506
|
+
let communityAuditLatched = false;
|
|
507
|
+
let communityAuditUnavailableReported = false;
|
|
508
|
+
const communityAllowed = async (candidate) => {
|
|
509
|
+
if (!locallySafeCommunityCandidate(candidate))
|
|
510
|
+
return null;
|
|
511
|
+
if (reviewedCatalogSkill(candidate) !== undefined)
|
|
512
|
+
return { candidate: { ...candidate, officialStatus: 'catalog-verified', auditStatus: 'not-required' } };
|
|
513
|
+
const key = candidateId(candidate);
|
|
514
|
+
const known = communityAudit.get(key);
|
|
515
|
+
if (known !== undefined)
|
|
516
|
+
return known.allowed
|
|
517
|
+
? { candidate: { ...candidate, auditStatus: 'passed' }, authorization: known.authorization }
|
|
518
|
+
: null;
|
|
519
|
+
if (providerRequestsLatched || primaryAuthenticationFailed || communityAuditLatched || this.provider.audit === undefined) {
|
|
520
|
+
providerRequestsLatched = true;
|
|
521
|
+
communityAudit.set(key, { allowed: false });
|
|
522
|
+
communityAuditLatched = true;
|
|
523
|
+
if (!communityAuditUnavailableReported) {
|
|
524
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_unavailable' });
|
|
525
|
+
communityAuditUnavailableReported = true;
|
|
526
|
+
}
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
529
|
+
const cachedAuditFailure = readPersistentSkillAuditFailure(database, this.provider.id, candidate, now);
|
|
530
|
+
if (cachedAuditFailure !== null) {
|
|
531
|
+
providerRequestsLatched = true;
|
|
532
|
+
communityAudit.set(key, { allowed: false });
|
|
533
|
+
communityAuditLatched = true;
|
|
534
|
+
if (!communityAuditUnavailableReported) {
|
|
535
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_unavailable' });
|
|
536
|
+
communityAuditUnavailableReported = true;
|
|
537
|
+
}
|
|
538
|
+
return null;
|
|
539
|
+
}
|
|
540
|
+
if (auditAttempts >= MAX_COMMUNITY_AUDITS) {
|
|
541
|
+
communityAudit.set(key, { allowed: false });
|
|
542
|
+
if (!auditLimitReported) {
|
|
543
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_limit_reached' });
|
|
544
|
+
auditLimitReported = true;
|
|
545
|
+
}
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
auditAttempts += 1;
|
|
549
|
+
let audit;
|
|
550
|
+
try {
|
|
551
|
+
audit = await authorizeSkillMaterialization(this.provider, candidate, input.signal);
|
|
552
|
+
}
|
|
553
|
+
catch (error) {
|
|
554
|
+
const code = providerFailureCode(error);
|
|
555
|
+
if (code === undefined)
|
|
556
|
+
throw error;
|
|
557
|
+
if (error instanceof SkillProviderError && (error.code === 'registry_rate_limited' || error.code === 'registry_unavailable')) {
|
|
558
|
+
writePersistentSkillAuditFailure(database, this.provider.id, candidate, error.code, externalSkillFailureTtlMs(error.retryAfterSeconds), now);
|
|
559
|
+
}
|
|
560
|
+
providerRequestsLatched = true;
|
|
561
|
+
communityAudit.set(key, { allowed: false });
|
|
562
|
+
communityAuditLatched = true;
|
|
563
|
+
if (code === 'registry_invalid_response') {
|
|
564
|
+
base.failures.push({ stage: 'search', code });
|
|
565
|
+
}
|
|
566
|
+
else if (!communityAuditUnavailableReported) {
|
|
567
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_unavailable' });
|
|
568
|
+
communityAuditUnavailableReported = true;
|
|
569
|
+
}
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
if (audit.status === 'unavailable') {
|
|
573
|
+
writePersistentSkillAuditFailure(database, this.provider.id, candidate, 'registry_unavailable', DEFAULT_EXTERNAL_SKILL_FAILURE_TTL_MS, now);
|
|
574
|
+
providerRequestsLatched = true;
|
|
575
|
+
communityAudit.set(key, { allowed: false });
|
|
576
|
+
communityAuditLatched = true;
|
|
577
|
+
if (!communityAuditUnavailableReported) {
|
|
578
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_unavailable' });
|
|
579
|
+
communityAuditUnavailableReported = true;
|
|
580
|
+
}
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
clearPersistentSkillAuditFailure(database, this.provider.id, candidate);
|
|
584
|
+
const allowed = audit.status === 'passed' ? { candidate: audit.candidate, authorization: audit.authorization } : null;
|
|
585
|
+
communityAudit.set(key, allowed === null ? { allowed: false } : { allowed: true, authorization: allowed.authorization });
|
|
586
|
+
if (allowed === null)
|
|
587
|
+
base.failures.push({ stage: 'validation', code: 'community_audit_failed' });
|
|
588
|
+
return allowed;
|
|
589
|
+
};
|
|
590
|
+
const existingByIdentity = new Map(existingSkills.map((record) => [sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug }), record]));
|
|
591
|
+
const successfulSkills = new Set(base.selected.flatMap((candidate) => {
|
|
592
|
+
const record = existingSkills.find((skill) => skill.skillId === candidate.skillId);
|
|
593
|
+
return record === undefined ? [] : [sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug })];
|
|
594
|
+
}));
|
|
595
|
+
const successfulRequirements = new Set();
|
|
596
|
+
const attemptedSkills = new Set();
|
|
597
|
+
let sourceRequestsLatched = false;
|
|
598
|
+
const preparedSelections = [];
|
|
599
|
+
const pendingFailureTransitions = new Map();
|
|
600
|
+
const recordRecoverableFailure = (candidate, error, selectedExisting) => {
|
|
601
|
+
const code = sourceOrValidationFailureCode(error);
|
|
602
|
+
if (code === undefined)
|
|
603
|
+
return false;
|
|
604
|
+
const identity = sourceSkillIdentity(candidate);
|
|
605
|
+
const exactExisting = existingByIdentity.get(identity);
|
|
606
|
+
if (code === 'candidate_not_found_at_source') {
|
|
607
|
+
const selectedExact = selectedExisting !== undefined
|
|
608
|
+
&& sourceSkillIdentity({ sourceType: selectedExisting.sourceType, source: selectedExisting.sourceLocator, slug: selectedExisting.slug }) === identity
|
|
609
|
+
? selectedExisting
|
|
610
|
+
: undefined;
|
|
611
|
+
const existing = selectedExact ?? exactExisting;
|
|
612
|
+
if (existing === undefined)
|
|
613
|
+
pendingFailureTransitions.set(`new:${identity}`, { kind: 'new-stale', candidate });
|
|
614
|
+
else
|
|
615
|
+
pendingFailureTransitions.set(`existing:${existing.skillId}`, { kind: 'existing', record: existing, state: 'stale' });
|
|
616
|
+
}
|
|
617
|
+
else if ((code === 'skill_disabled_for_model_invocation' || code === 'skill_secret_detected' || code === 'skill_blocked') && exactExisting !== undefined) {
|
|
618
|
+
// A registry alias is only a hint. Never create or block that guessed
|
|
619
|
+
// identity when no verified canonical mapping exists.
|
|
620
|
+
pendingFailureTransitions.set(`existing:${exactExisting.skillId}`, { kind: 'existing', record: exactExisting, state: 'blocked' });
|
|
621
|
+
}
|
|
622
|
+
base.failures.push({ stage: /^(?:skill_|candidate_|source_tree)/u.test(code) ? 'validation' : 'source', code });
|
|
623
|
+
return true;
|
|
624
|
+
};
|
|
625
|
+
const processCandidates = async (candidates) => {
|
|
626
|
+
if (attemptedSkills.size >= MAX_SOURCE_ATTEMPTS || base.selected.length + preparedSelections.length >= selectedSkillLimit)
|
|
627
|
+
return;
|
|
628
|
+
const selected = new Map();
|
|
629
|
+
for (const requirement of requirementsToSearch) {
|
|
630
|
+
if (successfulRequirements.has(requirement.id))
|
|
631
|
+
continue;
|
|
632
|
+
const ranked = rankSkillCandidates({
|
|
633
|
+
candidates: [...candidates.values()].filter((item) => item.requirement.id === requirement.id).map((item) => item.candidate),
|
|
634
|
+
requirement,
|
|
635
|
+
task: input.task,
|
|
636
|
+
profile: input.profile,
|
|
637
|
+
mode,
|
|
638
|
+
});
|
|
639
|
+
for (const rankedCandidate of ranked) {
|
|
640
|
+
const candidate = rankedCandidate.candidate;
|
|
641
|
+
const identity = sourceSkillIdentity(candidate);
|
|
642
|
+
if (candidate.duplicate || selected.has(identity) || attemptedSkills.has(identity))
|
|
643
|
+
continue;
|
|
644
|
+
const owners = existingIdentityOwners(database, listExternalSkills(database), candidate, candidate, requirement, input.fingerprint);
|
|
645
|
+
const exactOwners = owners.filter((record) => sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug }) === identity);
|
|
646
|
+
if (exactOwners.length > 1 || (exactOwners.length === 0 && owners.length > 1))
|
|
647
|
+
throw new KiokukoError('CONFLICT', 'External Skill canonical identity is ambiguous');
|
|
648
|
+
const existing = exactOwners[0] ?? owners[0];
|
|
649
|
+
if (suppressAutomaticImport(existing))
|
|
650
|
+
continue;
|
|
651
|
+
const audited = await communityAllowed(candidate);
|
|
652
|
+
if (audited === null)
|
|
653
|
+
continue;
|
|
654
|
+
selected.set(identity, { candidate: audited.candidate, requirement, ...(existing === undefined ? {} : { existing }) });
|
|
655
|
+
attemptedSkills.add(identity);
|
|
656
|
+
if (attemptedSkills.size >= MAX_SOURCE_ATTEMPTS)
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
if (attemptedSkills.size >= MAX_SOURCE_ATTEMPTS)
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
for (const { candidate, requirement, existing: selectedExisting } of selected.values()) {
|
|
663
|
+
if (sourceRequestsLatched)
|
|
664
|
+
break;
|
|
665
|
+
const identity = sourceSkillIdentity(candidate);
|
|
666
|
+
if (successfulRequirements.has(requirement.id) || successfulSkills.has(identity))
|
|
667
|
+
continue;
|
|
668
|
+
const cachedSourceFailure = readPersistentSkillSourceFailure(database, candidate, now);
|
|
669
|
+
if (cachedSourceFailure !== null) {
|
|
670
|
+
base.failures.push({ stage: 'source', code: cachedSourceFailure.code });
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
let snapshot;
|
|
674
|
+
let documents;
|
|
675
|
+
let authorizedCanonicalCandidate;
|
|
676
|
+
let authorization;
|
|
677
|
+
try {
|
|
678
|
+
let fetchRequest = { purpose: 'discovery' };
|
|
679
|
+
if (selectedExisting !== undefined) {
|
|
680
|
+
const detail = readExternalSkill(database, selectedExisting.skillId);
|
|
681
|
+
if (detail === undefined)
|
|
682
|
+
throw new KiokukoError('CONFLICT', 'External Skill changed during discovery');
|
|
683
|
+
fetchRequest = externalSkillSourceFetchRequest(detail);
|
|
684
|
+
}
|
|
685
|
+
const fetched = await this.fetchSnapshot(candidate, fetchRequest, input.signal);
|
|
686
|
+
snapshot = validateSkillSnapshot({
|
|
687
|
+
candidate,
|
|
688
|
+
sourceCommit: fetched.sourceCommit,
|
|
689
|
+
files: fetched.files.map((file) => ({ path: file.path, content: file.content, primary: file.primary })),
|
|
690
|
+
});
|
|
691
|
+
const reviewedCatalog = isReviewedCatalogCandidate(candidate, requirement) ? reviewedCatalogSkill(candidate) : undefined;
|
|
692
|
+
const primaryPath = snapshot.files.find((file) => file.primary)?.path;
|
|
693
|
+
if (reviewedCatalog !== undefined && (primaryPath === undefined || !reviewedCatalog.primaryPaths.includes(primaryPath))) {
|
|
694
|
+
throw new SkillSourceError('skill_validation_failed');
|
|
695
|
+
}
|
|
696
|
+
if (requirementMatchScore(snapshot.candidate, requirement, gap.missing) === 0)
|
|
697
|
+
throw new SkillSourceError('skill_validation_failed');
|
|
698
|
+
snapshot = { ...snapshot, candidate: normalizeOfficial(snapshot.candidate, requirement) };
|
|
699
|
+
const authorized = await communityAllowed(snapshot.candidate);
|
|
700
|
+
if (authorized === null)
|
|
701
|
+
continue;
|
|
702
|
+
authorizedCanonicalCandidate = authorized.candidate;
|
|
703
|
+
authorization = authorized.authorization;
|
|
704
|
+
documents = documentsFromSkillSnapshot(snapshot);
|
|
705
|
+
clearPersistentSkillSourceFailure(database, candidate);
|
|
706
|
+
}
|
|
707
|
+
catch (error) {
|
|
708
|
+
if (error instanceof SkillSourceError && (error.code === 'source_rate_limited' || error.code === 'source_unavailable')) {
|
|
709
|
+
writePersistentSkillSourceFailure(database, candidate, error.code, externalSkillFailureTtlMs(error.retryAfterSeconds), now);
|
|
710
|
+
if (error.code === 'source_rate_limited')
|
|
711
|
+
sourceRequestsLatched = true;
|
|
712
|
+
}
|
|
713
|
+
if (!recordRecoverableFailure(candidate, error, selectedExisting))
|
|
714
|
+
throw error;
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
const canonicalCandidate = authorizedCanonicalCandidate;
|
|
718
|
+
const canonicalIdentity = sourceSkillIdentity(canonicalCandidate);
|
|
719
|
+
if (successfulSkills.has(canonicalIdentity))
|
|
720
|
+
continue;
|
|
721
|
+
preparedSelections.push({
|
|
722
|
+
requestedCandidate: candidate,
|
|
723
|
+
canonicalCandidate,
|
|
724
|
+
...(authorization === undefined ? {} : { authorization }),
|
|
725
|
+
requirement,
|
|
726
|
+
...(selectedExisting === undefined ? {} : { selectedExisting }),
|
|
727
|
+
...(existingByIdentity.get(canonicalIdentity) === undefined ? {} : { observedCanonical: existingByIdentity.get(canonicalIdentity) }),
|
|
728
|
+
snapshot: { ...snapshot, candidate: canonicalCandidate },
|
|
729
|
+
documents,
|
|
730
|
+
});
|
|
731
|
+
successfulSkills.add(canonicalIdentity);
|
|
732
|
+
successfulRequirements.add(requirement.id);
|
|
733
|
+
if (base.selected.length + preparedSelections.length >= selectedSkillLimit)
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
// Owner-scoped and curated candidates are source-validated before any
|
|
738
|
+
// unscoped community query leaves the process.
|
|
739
|
+
await processCandidates(officialCandidates);
|
|
740
|
+
// Phase 3: general registry search is community-only and runs only for
|
|
741
|
+
// requirements that direct/owner-verified discovery did not satisfy.
|
|
742
|
+
if (mode === 'community' && base.selected.length + preparedSelections.length < selectedSkillLimit && attemptedSkills.size < MAX_SOURCE_ATTEMPTS) {
|
|
743
|
+
const remaining = requirementsToSearch.filter((requirement) => !successfulRequirements.has(requirement.id));
|
|
744
|
+
for (const query of queries) {
|
|
745
|
+
const queryRequirements = requirementsForQuery(query, remaining);
|
|
746
|
+
if (queryRequirements.length > 0)
|
|
747
|
+
await search(query, null, queryRequirements, communityCandidates);
|
|
748
|
+
}
|
|
749
|
+
await processCandidates(communityCandidates);
|
|
750
|
+
}
|
|
751
|
+
if (preparedSelections.length > 0 || pendingFailureTransitions.size > 0) {
|
|
752
|
+
let outcomes;
|
|
753
|
+
try {
|
|
754
|
+
outcomes = withImmediateTransaction(database, () => {
|
|
755
|
+
// Every current-state and CAS check runs under the same write lock,
|
|
756
|
+
// before the first candidate import mutates durable state.
|
|
757
|
+
try {
|
|
758
|
+
this.assertBeforePersist?.();
|
|
759
|
+
}
|
|
760
|
+
catch (error) {
|
|
761
|
+
// Caller-owned state assertions are not persistence failures. Keep
|
|
762
|
+
// them out of the recoverable CAS/SQLite summary boundary below.
|
|
763
|
+
throw new CallerPersistenceAssertionError(error);
|
|
764
|
+
}
|
|
765
|
+
const currentSkills = listExternalSkills(database);
|
|
766
|
+
const failureTransitions = [];
|
|
767
|
+
for (const transition of pendingFailureTransitions.values()) {
|
|
768
|
+
if (transition.kind === 'new-stale') {
|
|
769
|
+
const identity = sourceSkillIdentity(transition.candidate);
|
|
770
|
+
if (!currentSkills.some((record) => sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug }) === identity)) {
|
|
771
|
+
failureTransitions.push(transition);
|
|
772
|
+
}
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
const current = currentSkills.find((record) => record.skillId === transition.record.skillId);
|
|
776
|
+
const expected = externalSkillRefreshExpectation(transition.record);
|
|
777
|
+
if (current === undefined
|
|
778
|
+
|| current.generation !== expected.generation
|
|
779
|
+
|| current.sourceCommit !== expected.sourceCommit
|
|
780
|
+
|| current.snapshotHash !== expected.snapshotHash
|
|
781
|
+
|| current.state !== expected.state
|
|
782
|
+
|| current.lastCheckedAt !== expected.lastCheckedAt) {
|
|
783
|
+
throw new KiokukoError('CONFLICT', 'External Skill changed during discovery');
|
|
784
|
+
}
|
|
785
|
+
failureTransitions.push(transition);
|
|
786
|
+
}
|
|
787
|
+
const resolvedSelections = preparedSelections.map((plan) => {
|
|
788
|
+
const { requestedCandidate, canonicalCandidate, requirement, selectedExisting, observedCanonical, snapshot, documents } = plan;
|
|
789
|
+
const canonicalIdentity = sourceSkillIdentity(canonicalCandidate);
|
|
790
|
+
const selectedMaterialized = selectedExisting !== undefined && (selectedExisting.sourceCommit !== null || selectedExisting.snapshotHash !== null);
|
|
791
|
+
const canonicalTarget = selectedExisting !== undefined && !selectedMaterialized && observedCanonical !== undefined && selectedExisting.skillId !== observedCanonical.skillId
|
|
792
|
+
? { skillId: observedCanonical.skillId, expected: externalSkillRefreshExpectation(observedCanonical) }
|
|
793
|
+
: undefined;
|
|
794
|
+
const observedExisting = selectedExisting ?? observedCanonical;
|
|
795
|
+
const currentOwners = existingIdentityOwners(database, currentSkills, requestedCandidate, canonicalCandidate, requirement, input.fingerprint);
|
|
796
|
+
const concurrentlyImported = observedExisting === undefined && currentOwners.length === 1
|
|
797
|
+
? currentOwners.find((record) => {
|
|
798
|
+
if (sourceSkillIdentity({ sourceType: record.sourceType, source: record.sourceLocator, slug: record.slug }) !== canonicalIdentity
|
|
799
|
+
|| record.state !== 'imported' || record.sourceCommit !== snapshot.sourceCommit || record.snapshotHash !== snapshot.snapshotHash
|
|
800
|
+
|| !hasSkillMaterializationAuthorization(canonicalCandidate, plan.authorization))
|
|
801
|
+
return false;
|
|
802
|
+
const storedRequirement = externalSkillRequirement(database, record.skillId);
|
|
803
|
+
return storedRequirement !== undefined && requirementOverlaps(storedRequirement, requirement)
|
|
804
|
+
&& applicabilityMatchesFingerprint(storedRequirement, input.fingerprint);
|
|
805
|
+
})
|
|
806
|
+
: undefined;
|
|
807
|
+
if (concurrentlyImported !== undefined)
|
|
808
|
+
return { kind: 'reused', plan, record: concurrentlyImported };
|
|
809
|
+
const allowedOwnerIds = new Set([selectedExisting?.skillId, observedCanonical?.skillId].filter((value) => value !== undefined));
|
|
810
|
+
if (currentOwners.some((record) => !allowedOwnerIds.has(record.skillId))
|
|
811
|
+
|| observedExisting === undefined && currentOwners.length > 0
|
|
812
|
+
|| selectedExisting === undefined && currentOwners.length > 1
|
|
813
|
+
|| selectedExisting !== undefined && !selectedMaterialized && currentOwners.length > (canonicalTarget === undefined ? 1 : 2)) {
|
|
814
|
+
throw new KiokukoError('CONFLICT', 'External Skill changed during discovery');
|
|
815
|
+
}
|
|
816
|
+
const currentObserved = observedExisting === undefined ? undefined : currentSkills.find((record) => record.skillId === observedExisting.skillId);
|
|
817
|
+
if (observedExisting !== undefined && currentObserved === undefined)
|
|
818
|
+
throw new KiokukoError('CONFLICT', 'External Skill changed during discovery');
|
|
819
|
+
if (suppressAutomaticImport(currentObserved))
|
|
820
|
+
return { kind: 'skipped', plan };
|
|
821
|
+
const prepared = {
|
|
822
|
+
skill: canonicalCandidate,
|
|
823
|
+
sourceWorkspace: externalSkillWorkspace(canonicalCandidate),
|
|
824
|
+
sourceCommit: snapshot.sourceCommit,
|
|
825
|
+
snapshotHash: snapshot.snapshotHash,
|
|
826
|
+
frontmatter: snapshot.frontmatter,
|
|
827
|
+
documents,
|
|
828
|
+
requirement,
|
|
829
|
+
};
|
|
830
|
+
if (observedExisting === undefined)
|
|
831
|
+
return { kind: 'new', plan, input: prepared };
|
|
832
|
+
if (observedExisting.sourceCommit === null && observedExisting.snapshotHash === null) {
|
|
833
|
+
return { kind: 'existing', plan, input: prepared, existing: observedExisting, ...(canonicalTarget === undefined ? {} : { canonicalTarget }) };
|
|
834
|
+
}
|
|
835
|
+
return { kind: 'refresh', plan, input: prepared, existing: observedExisting };
|
|
836
|
+
});
|
|
837
|
+
for (const transition of failureTransitions) {
|
|
838
|
+
if (transition.kind === 'existing') {
|
|
839
|
+
markExternalSkillRefreshFailureInTransaction(database, transition.record.skillId, transition.state, externalSkillRefreshExpectation(transition.record), now);
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
const discovered = recordDiscoveredSkillInTransaction(database, transition.candidate, now);
|
|
843
|
+
markExternalSkillRefreshFailureInTransaction(database, discovered.skillId, 'stale', externalSkillRefreshExpectation(discovered), now);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return resolvedSelections.map((selection) => {
|
|
847
|
+
if (selection.kind === 'reused' || selection.kind === 'skipped')
|
|
848
|
+
return selection;
|
|
849
|
+
if (selection.kind === 'new') {
|
|
850
|
+
return { kind: 'selected', plan: selection.plan, result: persistNewSkillImportInTransaction(database, selection.input, now, selection.plan.authorization) };
|
|
851
|
+
}
|
|
852
|
+
if (selection.kind === 'existing') {
|
|
853
|
+
return {
|
|
854
|
+
kind: 'selected',
|
|
855
|
+
plan: selection.plan,
|
|
856
|
+
result: persistExistingSkillImportInTransaction(database, selection.existing.skillId, selection.input, externalSkillRefreshExpectation(selection.existing), now, selection.canonicalTarget, selection.plan.authorization),
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
const result = refreshExternalSkillSnapshotInTransaction(database, selection.existing.skillId, selection.plan.snapshot, selection.input.documents, selection.plan.requirement, externalSkillRefreshExpectation(selection.existing), now, selection.plan.authorization);
|
|
860
|
+
return result.kind === 'staled'
|
|
861
|
+
? { kind: 'staled', plan: selection.plan }
|
|
862
|
+
: { kind: 'selected', plan: selection.plan, result: result.result };
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
catch (error) {
|
|
867
|
+
if (error instanceof CallerPersistenceAssertionError)
|
|
868
|
+
throw error.assertionError;
|
|
869
|
+
const code = persistenceFailureCode(error);
|
|
870
|
+
if (code === undefined)
|
|
871
|
+
throw error;
|
|
872
|
+
base.failures.push({ stage: 'persistence', code });
|
|
873
|
+
outcomes = [];
|
|
874
|
+
}
|
|
875
|
+
for (const outcome of outcomes) {
|
|
876
|
+
if (outcome.kind === 'staled') {
|
|
877
|
+
base.failures.push({ stage: 'persistence', code: 'persistence_conflict' });
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
if (outcome.kind === 'skipped' || base.selected.length >= selectedSkillLimit)
|
|
881
|
+
continue;
|
|
882
|
+
if (outcome.kind === 'reused') {
|
|
883
|
+
if (!base.selected.some((item) => item.skillId === outcome.record.skillId)) {
|
|
884
|
+
base.selected.push({ skillId: outcome.record.skillId, name: outcome.record.name, source: outcome.record.sourceLocator, officialStatus: officialStatus(outcome.record.officialStatus), imported: true, updated: false });
|
|
885
|
+
}
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (!base.selected.some((item) => item.skillId === outcome.result.skillId)) {
|
|
889
|
+
base.selected.push({
|
|
890
|
+
skillId: outcome.result.skillId,
|
|
891
|
+
name: outcome.plan.canonicalCandidate.name,
|
|
892
|
+
source: outcome.plan.canonicalCandidate.source,
|
|
893
|
+
officialStatus: outcome.plan.canonicalCandidate.officialStatus,
|
|
894
|
+
imported: outcome.result.imported > 0,
|
|
895
|
+
updated: outcome.result.updated,
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
base.candidates = seenCandidates.size;
|
|
901
|
+
return base;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
export async function discoverSkills(database, input, dependencies = {}) {
|
|
905
|
+
const effectiveDependencies = dependencies.fetchImpl === undefined && input.fetchImpl !== undefined
|
|
906
|
+
? { ...dependencies, fetchImpl: input.fetchImpl }
|
|
907
|
+
: dependencies;
|
|
908
|
+
return discoveryServiceFor(effectiveDependencies).discover(database, input);
|
|
909
|
+
}
|
|
910
|
+
let sharedDiscoveryService;
|
|
911
|
+
const fetchDiscoveryServices = new WeakMap();
|
|
912
|
+
function discoveryServiceFor(dependencies) {
|
|
913
|
+
const keys = Object.keys(dependencies);
|
|
914
|
+
if (keys.length === 0) {
|
|
915
|
+
sharedDiscoveryService ??= new SkillDiscoveryService();
|
|
916
|
+
return sharedDiscoveryService;
|
|
917
|
+
}
|
|
918
|
+
if (keys.length === 1 && dependencies.fetchImpl !== undefined) {
|
|
919
|
+
const key = dependencies.fetchImpl;
|
|
920
|
+
const existing = fetchDiscoveryServices.get(key);
|
|
921
|
+
if (existing)
|
|
922
|
+
return existing;
|
|
923
|
+
const service = new SkillDiscoveryService(dependencies);
|
|
924
|
+
fetchDiscoveryServices.set(key, service);
|
|
925
|
+
return service;
|
|
926
|
+
}
|
|
927
|
+
return new SkillDiscoveryService(dependencies);
|
|
928
|
+
}
|
|
929
|
+
//# sourceMappingURL=discovery-service.js.map
|