@squadrules/mcp 4.8.6 → 5.0.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/README.md +37 -32
- package/dist/.tsbuildinfo +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.js +3 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/cli/api-client.d.ts +1 -1
- package/dist/cli/api-client.js +3 -3
- package/dist/cli/api-client.js.map +1 -1
- package/dist/cli/auth-error.js +1 -1
- package/dist/cli/auth-error.js.map +1 -1
- package/dist/cli/client-factory.js +2 -2
- package/dist/cli/client-factory.js.map +1 -1
- package/dist/cli/commands/attest.js +2 -2
- package/dist/cli/commands/attest.js.map +1 -1
- package/dist/cli/commands/begin.js +2 -2
- package/dist/cli/commands/begin.js.map +1 -1
- package/dist/cli/commands/cli-train.js +4 -4
- package/dist/cli/commands/cli-train.js.map +1 -1
- package/dist/cli/commands/delete-metadata.d.ts +2 -2
- package/dist/cli/commands/delete-metadata.d.ts.map +1 -1
- package/dist/cli/commands/delete-metadata.js +2 -2
- package/dist/cli/commands/delete-metadata.js.map +1 -1
- package/dist/cli/commands/export.js +2 -2
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/login.d.ts +1 -1
- package/dist/cli/commands/login.js +13 -13
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/logout.d.ts +1 -1
- package/dist/cli/commands/logout.js +1 -1
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/serve.d.ts +3 -3
- package/dist/cli/commands/serve.js +9 -9
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/token.d.ts +1 -1
- package/dist/cli/commands/token.js +3 -3
- package/dist/cli/commands/token.js.map +1 -1
- package/dist/cli/commands/update.js +3 -3
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/config-file-internals.d.ts +1 -1
- package/dist/cli/config-file-internals.d.ts.map +1 -1
- package/dist/cli/config-file-internals.js +3 -3
- package/dist/cli/config-file-internals.js.map +1 -1
- package/dist/cli/config-file-write.js +1 -1
- package/dist/cli/config-file-write.js.map +1 -1
- package/dist/cli/config-file.d.ts +2 -2
- package/dist/cli/config-file.js +6 -6
- package/dist/cli/config-file.js.map +1 -1
- package/dist/cli/config.d.ts +2 -2
- package/dist/cli/config.js +3 -3
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/fetch-error.js +1 -1
- package/dist/cli/fetch-error.js.map +1 -1
- package/dist/cli/format-next-call.js +3 -3
- package/dist/cli/format-next-call.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/keyring.d.ts +5 -12
- package/dist/cli/keyring.d.ts.map +1 -1
- package/dist/cli/keyring.js +18 -64
- package/dist/cli/keyring.js.map +1 -1
- package/dist/cli/oauth-refresh.d.ts +2 -2
- package/dist/cli/oauth-refresh.d.ts.map +1 -1
- package/dist/cli/oauth-refresh.js +3 -3
- package/dist/cli/oauth-refresh.js.map +1 -1
- package/dist/cli/program.js +4 -4
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/resolve-api-base.d.ts +1 -1
- package/dist/cli/resolve-api-base.js +2 -2
- package/dist/cli/resolve-api-base.js.map +1 -1
- package/dist/cli/skill-zip-local-write.js +2 -2
- package/dist/cli/skill-zip-local-write.js.map +1 -1
- package/dist/cli/upload-guards.js +3 -3
- package/dist/cli/upload-guards.js.map +1 -1
- package/dist/config/adapter-markdown-size-limits.d.ts +2 -5
- package/dist/config/adapter-markdown-size-limits.d.ts.map +1 -1
- package/dist/config/adapter-markdown-size-limits.js +19 -10
- package/dist/config/adapter-markdown-size-limits.js.map +1 -1
- package/dist/config/embedding-fastembed.d.ts +9 -0
- package/dist/config/embedding-fastembed.d.ts.map +1 -0
- package/dist/config/embedding-fastembed.js +20 -0
- package/dist/config/embedding-fastembed.js.map +1 -0
- package/dist/config/export-download-settings.d.ts +2 -2
- package/dist/config/export-download-settings.d.ts.map +1 -1
- package/dist/config/export-download-settings.js +3 -23
- package/dist/config/export-download-settings.js.map +1 -1
- package/dist/config/export-zip-settings.d.ts +2 -3
- package/dist/config/export-zip-settings.d.ts.map +1 -1
- package/dist/config/export-zip-settings.js +3 -6
- package/dist/config/export-zip-settings.js.map +1 -1
- package/dist/config.d.ts +35 -31
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +50 -47
- package/dist/config.js.map +1 -1
- package/dist/constants/builtin-search-meta.d.ts +5 -5
- package/dist/constants/builtin-search-meta.d.ts.map +1 -1
- package/dist/constants/builtin-search-meta.js +6 -6
- package/dist/constants/builtin-search-meta.js.map +1 -1
- package/dist/embed-docs/mem/README.md +9 -9
- package/dist/embed-docs/mem/adapter-migration.md +2 -2
- package/dist/embed-docs/mem/bulk-insert-adapters-via-cli.md +20 -20
- package/dist/embed-docs/mem/challenge-type-guide.md +10 -10
- package/dist/embed-docs/mem/create-new-protocol.md +16 -16
- package/dist/embed-docs/mem/phase-critic-guide.md +2 -2
- package/dist/embed-docs/mem/phase-critic.md +2 -2
- package/dist/embed-docs/mem/protocol-linking-guide.md +6 -6
- package/dist/embed-docs/mem/refine-search.md +3 -3
- package/dist/embed-docs/mem/skill-format-guide.md +24 -24
- package/dist/http/bearer-validate.d.ts +1 -1
- package/dist/http/bearer-validate.d.ts.map +1 -1
- package/dist/http/export-skill-zip-http.js +3 -3
- package/dist/http/export-skill-zip-http.js.map +1 -1
- package/dist/http/http-api-snapshot.d.ts.map +1 -1
- package/dist/http/http-api-snapshot.js +13 -1
- package/dist/http/http-api-snapshot.js.map +1 -1
- package/dist/http/http-api-train-json.js +8 -8
- package/dist/http/http-api-train-json.js.map +1 -1
- package/dist/http/http-api-train-raw.js +8 -8
- package/dist/http/http-api-train-raw.js.map +1 -1
- package/dist/http/http-auth-callback.js +1 -1
- package/dist/http/http-auth-middleware.d.ts +1 -1
- package/dist/http/http-auth-middleware.d.ts.map +1 -1
- package/dist/http/http-auth-middleware.js +7 -15
- package/dist/http/http-auth-middleware.js.map +1 -1
- package/dist/http/http-export-artifact-download-routes.js +1 -1
- package/dist/http/http-export-artifact-download-routes.js.map +1 -1
- package/dist/http/http-health-routes.d.ts.map +1 -1
- package/dist/http/http-health-routes.js +6 -3
- package/dist/http/http-health-routes.js.map +1 -1
- package/dist/http/http-mcp-handler.js +2 -2
- package/dist/http/http-mcp-handler.js.map +1 -1
- package/dist/http/http-route-errors.js +4 -4
- package/dist/http/http-route-errors.js.map +1 -1
- package/dist/http/http-ui-static.js +8 -8
- package/dist/http/http-ui-static.js.map +1 -1
- package/dist/http/http-well-known.js +1 -1
- package/dist/http/http-well-known.js.map +1 -1
- package/dist/http/oidc-profile-claims.d.ts +5 -5
- package/dist/http/oidc-profile-claims.d.ts.map +1 -1
- package/dist/http/oidc-profile-claims.js +5 -5
- package/dist/http/oidc-profile-claims.js.map +1 -1
- package/dist/http/oidc-scopes.js +2 -2
- package/dist/http/oidc-scopes.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -11
- package/dist/index.js.map +1 -1
- package/dist/mcp-apps/activate-widget-html.js +4 -4
- package/dist/mcp-apps/activate-widget-html.js.map +1 -1
- package/dist/mcp-apps/activate-widget-inline-css.js +1 -1
- package/dist/mcp-apps/activate-widget-inline-script.js +9 -9
- package/dist/mcp-apps/forward-widget-html.js +4 -4
- package/dist/mcp-apps/forward-widget-html.js.map +1 -1
- package/dist/mcp-apps/forward-widget-inline-script.d.ts.map +1 -1
- package/dist/mcp-apps/forward-widget-inline-script.js +8 -8
- package/dist/mcp-apps/forward-widget-inline-script.js.map +1 -1
- package/dist/mcp-apps/list-offerings-for-ui.d.ts.map +1 -1
- package/dist/mcp-apps/list-offerings-for-ui.js +16 -16
- package/dist/mcp-apps/list-offerings-for-ui.js.map +1 -1
- package/dist/mcp-apps/mcp-widget-presentation-inject.d.ts +2 -2
- package/dist/mcp-apps/mcp-widget-presentation-inject.d.ts.map +1 -1
- package/dist/mcp-apps/mcp-widget-presentation-inject.js +4 -4
- package/dist/mcp-apps/mcp-widget-presentation-inject.js.map +1 -1
- package/dist/mcp-apps/register-activate-ui-resources.d.ts +1 -1
- package/dist/mcp-apps/register-activate-ui-resources.d.ts.map +1 -1
- package/dist/mcp-apps/register-activate-ui-resources.js +2 -13
- package/dist/mcp-apps/register-activate-ui-resources.js.map +1 -1
- package/dist/mcp-apps/register-forward-ui-resources.d.ts +1 -1
- package/dist/mcp-apps/register-forward-ui-resources.d.ts.map +1 -1
- package/dist/mcp-apps/register-forward-ui-resources.js +3 -14
- package/dist/mcp-apps/register-forward-ui-resources.js.map +1 -1
- package/dist/mcp-apps/register-spaces-ui-resources.d.ts +1 -1
- package/dist/mcp-apps/register-spaces-ui-resources.d.ts.map +1 -1
- package/dist/mcp-apps/register-spaces-ui-resources.js +2 -13
- package/dist/mcp-apps/register-spaces-ui-resources.js.map +1 -1
- package/dist/mcp-apps/spaces-mcp-app-widget-html.js +8 -8
- package/dist/mcp-apps/spaces-mcp-app-widget-html.js.map +1 -1
- package/dist/mcp-apps/spaces-widget-html.js +1 -1
- package/dist/mcp-apps/squadrules-logo-embedded.d.ts +3 -0
- package/dist/mcp-apps/squadrules-logo-embedded.d.ts.map +1 -0
- package/dist/mcp-apps/squadrules-logo-embedded.js +3 -0
- package/dist/mcp-apps/squadrules-logo-embedded.js.map +1 -0
- package/dist/mcp-apps/{kairos-server-ui-capability.d.ts → squadrules-server-ui-capability.d.ts} +2 -2
- package/dist/mcp-apps/squadrules-server-ui-capability.d.ts.map +1 -0
- package/dist/mcp-apps/{kairos-server-ui-capability.js → squadrules-server-ui-capability.js} +3 -3
- package/dist/mcp-apps/squadrules-server-ui-capability.js.map +1 -0
- package/dist/mcp-apps/{kairos-ui-constants.d.ts → squadrules-ui-constants.d.ts} +14 -52
- package/dist/mcp-apps/squadrules-ui-constants.d.ts.map +1 -0
- package/dist/mcp-apps/squadrules-ui-constants.js +59 -0
- package/dist/mcp-apps/squadrules-ui-constants.js.map +1 -0
- package/dist/resources/docs-resources.js +2 -2
- package/dist/resources/docs-resources.js.map +1 -1
- package/dist/resources/embedded-mcp-resources.js +17 -17
- package/dist/resources/embedded-mcp-resources.js.map +1 -1
- package/dist/resources/mem-resources-boot.d.ts.map +1 -1
- package/dist/resources/mem-resources-boot.js +5 -31
- package/dist/resources/mem-resources-boot.js.map +1 -1
- package/dist/resources/mem-uuid-mapper.d.ts.map +1 -1
- package/dist/resources/mem-uuid-mapper.js +8 -23
- package/dist/resources/mem-uuid-mapper.js.map +1 -1
- package/dist/resources/resource-bootstrap.js +4 -4
- package/dist/resources/resource-bootstrap.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +16 -14
- package/dist/server.js.map +1 -1
- package/dist/services/adapter-navigation.js +1 -1
- package/dist/services/adapter-navigation.js.map +1 -1
- package/dist/services/embedding/fastembed-provider.d.ts +2 -0
- package/dist/services/embedding/fastembed-provider.d.ts.map +1 -0
- package/dist/services/embedding/fastembed-provider.js +78 -0
- package/dist/services/embedding/fastembed-provider.js.map +1 -0
- package/dist/services/embedding/health.d.ts.map +1 -1
- package/dist/services/embedding/health.js +99 -96
- package/dist/services/embedding/health.js.map +1 -1
- package/dist/services/embedding/provider-audit.d.ts +15 -0
- package/dist/services/embedding/provider-audit.d.ts.map +1 -0
- package/dist/services/embedding/provider-audit.js +28 -0
- package/dist/services/embedding/provider-audit.js.map +1 -0
- package/dist/services/embedding/providers.d.ts +2 -1
- package/dist/services/embedding/providers.d.ts.map +1 -1
- package/dist/services/embedding/providers.js +21 -23
- package/dist/services/embedding/providers.js.map +1 -1
- package/dist/services/embedding/service.d.ts +2 -2
- package/dist/services/embedding/service.d.ts.map +1 -1
- package/dist/services/embedding/service.js +13 -16
- package/dist/services/embedding/service.js.map +1 -1
- package/dist/services/execution-trace-store.d.ts +5 -29
- package/dist/services/execution-trace-store.d.ts.map +1 -1
- package/dist/services/execution-trace-store.js +10 -2
- package/dist/services/execution-trace-store.js.map +1 -1
- package/dist/services/export-artifact-download-capability.js +4 -4
- package/dist/services/export-artifact-download-capability.js.map +1 -1
- package/dist/services/export-download-capability.js +4 -4
- package/dist/services/export-download-capability.js.map +1 -1
- package/dist/services/id-generator.d.ts +11 -11
- package/dist/services/id-generator.d.ts.map +1 -1
- package/dist/services/id-generator.js +20 -30
- package/dist/services/id-generator.js.map +1 -1
- package/dist/services/memory/artifact-metadata.js +1 -1
- package/dist/services/memory/artifact-metadata.js.map +1 -1
- package/dist/services/memory/qdrant-point-to-memory.js +2 -2
- package/dist/services/memory/qdrant-point-to-memory.js.map +1 -1
- package/dist/services/memory/store-adapter-default-handler.js +2 -2
- package/dist/services/memory/store-adapter-default-handler.js.map +1 -1
- package/dist/services/memory/store-adapter-helpers.js +7 -7
- package/dist/services/memory/store-adapter-helpers.js.map +1 -1
- package/dist/services/memory/store-adapter.js +2 -2
- package/dist/services/memory/store-adapter.js.map +1 -1
- package/dist/services/memory/store-artifact.js +4 -4
- package/dist/services/memory/store-artifact.js.map +1 -1
- package/dist/services/memory/store-methods.js +7 -7
- package/dist/services/memory/store-methods.js.map +1 -1
- package/dist/services/memory/store-title-similarity-search.js +2 -2
- package/dist/services/memory/store-title-similarity-search.js.map +1 -1
- package/dist/services/memory/store.d.ts +23 -0
- package/dist/services/memory/store.d.ts.map +1 -1
- package/dist/services/memory/store.js +111 -4
- package/dist/services/memory/store.js.map +1 -1
- package/dist/services/memory/validate-protocol-structure.d.ts +1 -1
- package/dist/services/memory/validate-protocol-structure.d.ts.map +1 -1
- package/dist/services/memory/validate-protocol-structure.js +1 -1
- package/dist/services/memory/validate-protocol-structure.js.map +1 -1
- package/dist/services/memory-store.d.ts +5 -0
- package/dist/services/memory-store.d.ts.map +1 -1
- package/dist/services/memory-store.js +8 -3
- package/dist/services/memory-store.js.map +1 -1
- package/dist/services/metrics/agent-metrics.js +4 -4
- package/dist/services/metrics/agent-metrics.js.map +1 -1
- package/dist/services/metrics/anomaly-metrics.js +1 -1
- package/dist/services/metrics/anomaly-metrics.js.map +1 -1
- package/dist/services/metrics/embedding-metrics.js +5 -5
- package/dist/services/metrics/embedding-metrics.js.map +1 -1
- package/dist/services/metrics/export-metrics.js +4 -4
- package/dist/services/metrics/export-metrics.js.map +1 -1
- package/dist/services/metrics/http-metrics.js +5 -5
- package/dist/services/metrics/http-metrics.js.map +1 -1
- package/dist/services/metrics/mcp-metrics.d.ts +3 -3
- package/dist/services/metrics/mcp-metrics.d.ts.map +1 -1
- package/dist/services/metrics/mcp-metrics.js +10 -10
- package/dist/services/metrics/mcp-metrics.js.map +1 -1
- package/dist/services/metrics/memory-metrics.js +3 -3
- package/dist/services/metrics/memory-metrics.js.map +1 -1
- package/dist/services/metrics/qdrant-metrics.js +4 -4
- package/dist/services/metrics/qdrant-metrics.js.map +1 -1
- package/dist/services/metrics/registry.d.ts +1 -1
- package/dist/services/metrics/registry.js +3 -3
- package/dist/services/metrics/registry.js.map +1 -1
- package/dist/services/metrics/system-metrics.js +3 -3
- package/dist/services/metrics/system-metrics.js.map +1 -1
- package/dist/services/qdrant/connection.d.ts.map +1 -1
- package/dist/services/qdrant/connection.js +6 -6
- package/dist/services/qdrant/connection.js.map +1 -1
- package/dist/services/qdrant/initialization.d.ts +1 -1
- package/dist/services/qdrant/initialization.js +4 -4
- package/dist/services/qdrant/initialization.js.map +1 -1
- package/dist/services/qdrant/memory-retrieval.js +6 -6
- package/dist/services/qdrant/memory-retrieval.js.map +1 -1
- package/dist/services/qdrant/memory-updates.js +4 -4
- package/dist/services/qdrant/memory-updates.js.map +1 -1
- package/dist/services/qdrant/quality.js +4 -4
- package/dist/services/qdrant/quality.js.map +1 -1
- package/dist/services/qdrant/resources.js +2 -2
- package/dist/services/qdrant/resources.js.map +1 -1
- package/dist/services/qdrant/service.d.ts.map +1 -1
- package/dist/services/qdrant/service.js +11 -2
- package/dist/services/qdrant/service.js.map +1 -1
- package/dist/services/qdrant/snapshots.js +1 -1
- package/dist/services/qdrant/snapshots.js.map +1 -1
- package/dist/services/qdrant/utils.js +13 -13
- package/dist/services/qdrant/utils.js.map +1 -1
- package/dist/services/redis-cache.js +4 -4
- package/dist/services/redis-cache.js.map +1 -1
- package/dist/services/redis.d.ts +2 -2
- package/dist/services/redis.js +5 -5
- package/dist/services/redis.js.map +1 -1
- package/dist/services/reward-metrics.js +2 -2
- package/dist/services/reward-metrics.js.map +1 -1
- package/dist/services/vector-store/IExecutionTraceStore.d.ts +25 -0
- package/dist/services/vector-store/IExecutionTraceStore.d.ts.map +1 -0
- package/dist/services/vector-store/IExecutionTraceStore.js +2 -0
- package/dist/services/vector-store/IExecutionTraceStore.js.map +1 -0
- package/dist/services/vector-store/IVectorRecordStore.d.ts +58 -0
- package/dist/services/vector-store/IVectorRecordStore.d.ts.map +1 -0
- package/dist/services/vector-store/IVectorRecordStore.js +2 -0
- package/dist/services/vector-store/IVectorRecordStore.js.map +1 -0
- package/dist/services/vector-store/commit-retry.d.ts +21 -0
- package/dist/services/vector-store/commit-retry.d.ts.map +1 -0
- package/dist/services/vector-store/commit-retry.js +58 -0
- package/dist/services/vector-store/commit-retry.js.map +1 -0
- package/dist/services/vector-store/embedded-store-singleton.d.ts +12 -0
- package/dist/services/vector-store/embedded-store-singleton.d.ts.map +1 -0
- package/dist/services/vector-store/embedded-store-singleton.js +17 -0
- package/dist/services/vector-store/embedded-store-singleton.js.map +1 -0
- package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.d.ts +28 -0
- package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.js +222 -0
- package/dist/services/vector-store/lancedb/LanceExecutionTraceStore.js.map +1 -0
- package/dist/services/vector-store/lancedb/LanceVectorRecordStore.d.ts +77 -0
- package/dist/services/vector-store/lancedb/LanceVectorRecordStore.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/LanceVectorRecordStore.js +136 -0
- package/dist/services/vector-store/lancedb/LanceVectorRecordStore.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-engine.d.ts +41 -0
- package/dist/services/vector-store/lancedb/lance-records-engine.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-engine.js +102 -0
- package/dist/services/vector-store/lancedb/lance-records-engine.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts +22 -0
- package/dist/services/vector-store/lancedb/lance-records-mutations.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-mutations.js +211 -0
- package/dist/services/vector-store/lancedb/lance-records-mutations.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-reads.d.ts +64 -0
- package/dist/services/vector-store/lancedb/lance-records-reads.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-reads.js +237 -0
- package/dist/services/vector-store/lancedb/lance-records-reads.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-schema.d.ts +48 -0
- package/dist/services/vector-store/lancedb/lance-records-schema.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-schema.js +159 -0
- package/dist/services/vector-store/lancedb/lance-records-schema.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-search.d.ts +30 -0
- package/dist/services/vector-store/lancedb/lance-records-search.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-search.js +112 -0
- package/dist/services/vector-store/lancedb/lance-records-search.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts +11 -0
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.js +121 -0
- package/dist/services/vector-store/lancedb/lance-records-write-artifact.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-write-helpers.d.ts +52 -0
- package/dist/services/vector-store/lancedb/lance-records-write-helpers.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-write-helpers.js +216 -0
- package/dist/services/vector-store/lancedb/lance-records-write-helpers.js.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-writes.d.ts +21 -0
- package/dist/services/vector-store/lancedb/lance-records-writes.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb/lance-records-writes.js +294 -0
- package/dist/services/vector-store/lancedb/lance-records-writes.js.map +1 -0
- package/dist/services/vector-store/lancedb-connection.d.ts +12 -0
- package/dist/services/vector-store/lancedb-connection.d.ts.map +1 -0
- package/dist/services/vector-store/lancedb-connection.js +28 -0
- package/dist/services/vector-store/lancedb-connection.js.map +1 -0
- package/dist/services/vector-store/types.d.ts +85 -0
- package/dist/services/vector-store/types.d.ts.map +1 -0
- package/dist/services/vector-store/types.js +2 -0
- package/dist/services/vector-store/types.js.map +1 -0
- package/dist/stdio/stdio-server.js +1 -1
- package/dist/stdio/stdio-server.js.map +1 -1
- package/dist/tools/activate.js +11 -11
- package/dist/tools/activate.js.map +1 -1
- package/dist/tools/activate_schema.d.ts +0 -1
- package/dist/tools/activate_schema.d.ts.map +1 -1
- package/dist/tools/activate_schema.js +8 -10
- package/dist/tools/activate_schema.js.map +1 -1
- package/dist/tools/artifact-catalog.d.ts.map +1 -1
- package/dist/tools/artifact-catalog.js +6 -33
- package/dist/tools/artifact-catalog.js.map +1 -1
- package/dist/tools/delete.js +4 -4
- package/dist/tools/delete.js.map +1 -1
- package/dist/tools/delete_schema.js +3 -3
- package/dist/tools/delete_schema.js.map +1 -1
- package/dist/tools/dump.d.ts.map +1 -1
- package/dist/tools/dump.js +4 -13
- package/dist/tools/dump.js.map +1 -1
- package/dist/tools/export-resolve-adapter.js +2 -2
- package/dist/tools/export-resolve-adapter.js.map +1 -1
- package/dist/tools/export-reward-jsonl.js +3 -3
- package/dist/tools/export-reward-jsonl.js.map +1 -1
- package/dist/tools/export-selection.js +4 -4
- package/dist/tools/export-selection.js.map +1 -1
- package/dist/tools/export-source.js +5 -5
- package/dist/tools/export-source.js.map +1 -1
- package/dist/tools/export.js +5 -5
- package/dist/tools/export.js.map +1 -1
- package/dist/tools/export_schema.js +4 -4
- package/dist/tools/export_schema.js.map +1 -1
- package/dist/tools/forward-register.js +4 -4
- package/dist/tools/forward-register.js.map +1 -1
- package/dist/tools/forward-tool-error.d.ts +2 -2
- package/dist/tools/forward-tool-error.d.ts.map +1 -1
- package/dist/tools/forward-tool-error.js.map +1 -1
- package/dist/tools/forward-trace.js +1 -1
- package/dist/tools/forward-trace.js.map +1 -1
- package/dist/tools/forward-view.d.ts +2 -2
- package/dist/tools/forward-view.d.ts.map +1 -1
- package/dist/tools/forward-view.js +3 -3
- package/dist/tools/forward-view.js.map +1 -1
- package/dist/tools/forward.js +5 -5
- package/dist/tools/forward.js.map +1 -1
- package/dist/tools/forward_schema.d.ts +1 -2
- package/dist/tools/forward_schema.d.ts.map +1 -1
- package/dist/tools/forward_schema.js +5 -7
- package/dist/tools/forward_schema.js.map +1 -1
- package/dist/tools/local-artifact-dir-contract.d.ts +2 -8
- package/dist/tools/local-artifact-dir-contract.d.ts.map +1 -1
- package/dist/tools/local-artifact-dir-contract.js +2 -9
- package/dist/tools/local-artifact-dir-contract.js.map +1 -1
- package/dist/tools/mcp-tool-input-teaching.d.ts +3 -3
- package/dist/tools/mcp-tool-input-teaching.d.ts.map +1 -1
- package/dist/tools/mcp-tool-input-teaching.js +22 -22
- package/dist/tools/mcp-tool-input-teaching.js.map +1 -1
- package/dist/tools/next-missing-proof-payload.js +1 -1
- package/dist/tools/next-missing-proof-payload.js.map +1 -1
- package/dist/tools/next-pow-challenge-shape.js +1 -1
- package/dist/tools/next-pow-challenge-shape.js.map +1 -1
- package/dist/tools/next-pow-helpers.d.ts +1 -1
- package/dist/tools/next-pow-helpers.d.ts.map +1 -1
- package/dist/tools/next-pow-helpers.js +4 -4
- package/dist/tools/next-pow-helpers.js.map +1 -1
- package/dist/tools/next-previous-step.js +1 -1
- package/dist/tools/next-previous-step.js.map +1 -1
- package/dist/tools/next.js +8 -8
- package/dist/tools/next.js.map +1 -1
- package/dist/tools/next_schema.d.ts +0 -1
- package/dist/tools/next_schema.d.ts.map +1 -1
- package/dist/tools/next_schema.js +3 -5
- package/dist/tools/next_schema.js.map +1 -1
- package/dist/tools/review-evidence-check.js +1 -1
- package/dist/tools/review-evidence-check.js.map +1 -1
- package/dist/tools/reward.js +6 -6
- package/dist/tools/reward.js.map +1 -1
- package/dist/tools/reward_schema.js +1 -1
- package/dist/tools/reward_schema.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +20 -34
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/search_output.js +11 -11
- package/dist/tools/search_output.js.map +1 -1
- package/dist/tools/search_schema.d.ts +1 -1
- package/dist/tools/search_schema.js +7 -7
- package/dist/tools/search_schema.js.map +1 -1
- package/dist/tools/skill-export/assemble-skill-item.d.ts.map +1 -1
- package/dist/tools/skill-export/assemble-skill-item.js +11 -15
- package/dist/tools/skill-export/assemble-skill-item.js.map +1 -1
- package/dist/tools/skill-export/derive-metadata.d.ts +1 -1
- package/dist/tools/skill-export/derive-metadata.d.ts.map +1 -1
- package/dist/tools/skill-export/enumerate-space-adapters.d.ts +2 -2
- package/dist/tools/skill-export/enumerate-space-adapters.d.ts.map +1 -1
- package/dist/tools/skill-export/enumerate-space-adapters.js +12 -28
- package/dist/tools/skill-export/enumerate-space-adapters.js.map +1 -1
- package/dist/tools/skill-export/types.d.ts +1 -1
- package/dist/tools/skill-export/types.d.ts.map +1 -1
- package/dist/tools/spaces.d.ts.map +1 -1
- package/dist/tools/spaces.js +9 -22
- package/dist/tools/spaces.js.map +1 -1
- package/dist/tools/spaces_schema.js +1 -1
- package/dist/tools/spaces_schema.js.map +1 -1
- package/dist/tools/{kairos-challenge-display.d.ts → squadrules-challenge-display.d.ts} +1 -1
- package/dist/tools/squadrules-challenge-display.d.ts.map +1 -0
- package/dist/tools/{kairos-challenge-display.js → squadrules-challenge-display.js} +3 -3
- package/dist/tools/squadrules-challenge-display.js.map +1 -0
- package/dist/tools/{kairos-genesis-proof-hash.d.ts → squadrules-genesis-proof-hash.d.ts} +1 -1
- package/dist/tools/squadrules-genesis-proof-hash.d.ts.map +1 -0
- package/dist/tools/{kairos-genesis-proof-hash.js → squadrules-genesis-proof-hash.js} +1 -1
- package/dist/tools/squadrules-genesis-proof-hash.js.map +1 -0
- package/dist/tools/{kairos-uri.d.ts → squadrules-uri.d.ts} +4 -4
- package/dist/tools/squadrules-uri.d.ts.map +1 -0
- package/dist/tools/{kairos-uri.js → squadrules-uri.js} +18 -29
- package/dist/tools/squadrules-uri.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +11 -13
- package/dist/tools/tool-registry.d.ts.map +1 -1
- package/dist/tools/tool-registry.js +8 -8
- package/dist/tools/tool-registry.js.map +1 -1
- package/dist/tools/train-artifact-adapter-uri.js +3 -3
- package/dist/tools/train-artifact-adapter-uri.js.map +1 -1
- package/dist/tools/train-output-adapter-uri.js +2 -2
- package/dist/tools/train-output-adapter-uri.js.map +1 -1
- package/dist/tools/train-store.js +4 -4
- package/dist/tools/train-store.js.map +1 -1
- package/dist/tools/train.js +11 -11
- package/dist/tools/train.js.map +1 -1
- package/dist/tools/train_schema.js +4 -4
- package/dist/tools/train_schema.js.map +1 -1
- package/dist/tools/tune-execute.d.ts.map +1 -1
- package/dist/tools/tune-execute.js +5 -5
- package/dist/tools/tune-execute.js.map +1 -1
- package/dist/tools/tune-messages.js +2 -2
- package/dist/tools/tune-messages.js.map +1 -1
- package/dist/tools/tune_schema.js +3 -3
- package/dist/tools/tune_schema.js.map +1 -1
- package/dist/tools/update.js +2 -2
- package/dist/tools/update.js.map +1 -1
- package/dist/tools/update_schema.d.ts.map +1 -1
- package/dist/tools/update_schema.js +3 -5
- package/dist/tools/update_schema.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/index.js.map +1 -1
- package/dist/ui/assets/{AccountPage-DBrqe8KI.js → AccountPage-BJm56sur.js} +1 -1
- package/dist/ui/assets/HomePage-B06u5RCw.js +1 -0
- package/dist/ui/assets/{ProtocolDetailPage-C20Yd3q6.js → ProtocolDetailPage-DCw5D34S.js} +1 -1
- package/dist/ui/assets/ProtocolEditPage-mChBe3JY.js +5 -0
- package/dist/ui/assets/{RichTextEditor-uun0UIVc.js → RichTextEditor-Bj6JxHM5.js} +1 -1
- package/dist/ui/assets/{RunGuidedPage-BbyHZjPU.js → RunGuidedPage-Bd1bUTBH.js} +1 -1
- package/dist/ui/assets/{RunsPage-BijmxS6f.js → RunsPage-4kDF_Ylg.js} +1 -1
- package/dist/ui/assets/{SkillBundlePage-BsndXJaC.js → SkillBundlePage-D1OPKJzA.js} +1 -1
- package/dist/ui/assets/SquadrulesPage-D84vIaBc.js +1 -0
- package/dist/ui/assets/{export-skill-zip-CIyOWxuI.js → export-skill-zip-C1bRyhE2.js} +1 -1
- package/dist/ui/assets/index-PouLvU1c.js +8 -0
- package/dist/ui/assets/{kairos-mcp-DNiKVgiO.svg → squadrules-mcp-Qc5pokoj.svg} +1 -1
- package/dist/ui/assets/useRunSession-BX2U9D53.js +1 -0
- package/dist/ui/favicon.svg +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/logo.svg +1 -1
- package/dist/utils/build-version.d.ts +1 -1
- package/dist/utils/build-version.js +1 -1
- package/dist/utils/global-error-handlers.d.ts +1 -1
- package/dist/utils/global-error-handlers.js +1 -1
- package/dist/utils/log-core.d.ts +1 -1
- package/dist/utils/log-core.js +1 -1
- package/dist/utils/mcp-tool-doc-runtime.d.ts +1 -1
- package/dist/utils/mcp-tool-doc-runtime.js +2 -2
- package/dist/utils/mcp-tool-doc-runtime.js.map +1 -1
- package/dist/utils/memory-body.d.ts +1 -1
- package/dist/utils/memory-body.js +2 -2
- package/dist/utils/memory-body.js.map +1 -1
- package/dist/utils/protected-space-write-guard.js +3 -3
- package/dist/utils/protected-space-write-guard.js.map +1 -1
- package/dist/utils/qdrant-vector-management.js +3 -3
- package/dist/utils/qdrant-vector-management.js.map +1 -1
- package/dist/utils/resolve-space-param.d.ts +1 -1
- package/dist/utils/resolve-space-param.js +8 -8
- package/dist/utils/resolve-space-param.js.map +1 -1
- package/dist/utils/space-display.d.ts +2 -2
- package/dist/utils/space-display.d.ts.map +1 -1
- package/dist/utils/space-display.js +6 -6
- package/dist/utils/space-display.js.map +1 -1
- package/dist/utils/squadrules-local-artifact-dirs.d.ts +12 -0
- package/dist/utils/squadrules-local-artifact-dirs.d.ts.map +1 -0
- package/dist/utils/squadrules-local-artifact-dirs.js +34 -0
- package/dist/utils/squadrules-local-artifact-dirs.js.map +1 -0
- package/dist/utils/squadrules-user-dirs.d.ts +26 -0
- package/dist/utils/squadrules-user-dirs.d.ts.map +1 -0
- package/dist/utils/squadrules-user-dirs.js +67 -0
- package/dist/utils/squadrules-user-dirs.js.map +1 -0
- package/dist/utils/structured-logger.d.ts +1 -1
- package/dist/utils/structured-logger.js +1 -1
- package/dist/utils/tenant-context.d.ts +3 -3
- package/dist/utils/tenant-context.d.ts.map +1 -1
- package/dist/utils/tenant-context.js +12 -12
- package/dist/utils/tenant-context.js.map +1 -1
- package/dist/utils/uri-builder.d.ts +12 -12
- package/dist/utils/uri-builder.js +14 -14
- package/dist/utils/uri-builder.js.map +1 -1
- package/package.json +21 -16
- package/dist/config/env-alias.d.ts +0 -56
- package/dist/config/env-alias.d.ts.map +0 -1
- package/dist/config/env-alias.js +0 -112
- package/dist/config/env-alias.js.map +0 -1
- package/dist/mcp-apps/kairos-logo-embedded.d.ts +0 -3
- package/dist/mcp-apps/kairos-logo-embedded.d.ts.map +0 -1
- package/dist/mcp-apps/kairos-logo-embedded.js +0 -3
- package/dist/mcp-apps/kairos-logo-embedded.js.map +0 -1
- package/dist/mcp-apps/kairos-server-ui-capability.d.ts.map +0 -1
- package/dist/mcp-apps/kairos-server-ui-capability.js.map +0 -1
- package/dist/mcp-apps/kairos-ui-constants.d.ts.map +0 -1
- package/dist/mcp-apps/kairos-ui-constants.js +0 -100
- package/dist/mcp-apps/kairos-ui-constants.js.map +0 -1
- package/dist/squadrules-mcp-4.8.6.tgz +0 -0
- package/dist/tools/kairos-challenge-display.d.ts.map +0 -1
- package/dist/tools/kairos-challenge-display.js.map +0 -1
- package/dist/tools/kairos-genesis-proof-hash.d.ts.map +0 -1
- package/dist/tools/kairos-genesis-proof-hash.js.map +0 -1
- package/dist/tools/kairos-uri.d.ts.map +0 -1
- package/dist/tools/kairos-uri.js.map +0 -1
- package/dist/ui/assets/HomePage-DIKsxKaH.js +0 -1
- package/dist/ui/assets/KairosPage-n5qbiyxb.js +0 -1
- package/dist/ui/assets/ProtocolEditPage-hc87ZsgM.js +0 -5
- package/dist/ui/assets/index-D7zMHqYN.js +0 -8
- package/dist/ui/assets/useRunSession-062hqhcN.js +0 -1
- package/dist/utils/kairos-local-artifact-dirs.d.ts +0 -13
- package/dist/utils/kairos-local-artifact-dirs.d.ts.map +0 -1
- package/dist/utils/kairos-local-artifact-dirs.js +0 -35
- package/dist/utils/kairos-local-artifact-dirs.js.map +0 -1
- package/dist/utils/kairos-user-dirs.d.ts +0 -62
- package/dist/utils/kairos-user-dirs.d.ts.map +0 -1
- package/dist/utils/kairos-user-dirs.js +0 -165
- package/dist/utils/kairos-user-dirs.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Canonical layer URIs
|
|
2
|
-
const LAYER_URI_IN_MESSAGE = new RegExp(
|
|
1
|
+
/** Canonical layer URIs in tool copy. */
|
|
2
|
+
const LAYER_URI_IN_MESSAGE = new RegExp('squadrules://layer/[0-9a-f-]{36}', 'gi');
|
|
3
3
|
export function rewriteTuneMessage(message, layerUri) {
|
|
4
4
|
return message
|
|
5
5
|
.replace(/\bmemory\b/gi, (match) => (match[0] === 'M' ? 'Adapter layer' : 'adapter layer'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tune-messages.js","sourceRoot":"","sources":["../../src/tools/tune-messages.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tune-messages.js","sourceRoot":"","sources":["../../src/tools/tune-messages.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,oBAAoB,GAAG,IAAI,MAAM,CACrC,kCAAkC,EAClC,IAAI,CACL,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,QAAgB;IAClE,OAAO,OAAO;SACX,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;SAC1F,OAAO,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAuD,EACvD,QAAgB;IAEhB,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,iBAAiB,QAAQ,uBAAuB,CAAC;IAC1D,CAAC;IAED,OAAO,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ADAPTER_SLUG_URI_INPUT_REGEX, LAYER_URI_INPUT_REGEX } from './
|
|
2
|
+
import { ADAPTER_SLUG_URI_INPUT_REGEX, LAYER_URI_INPUT_REGEX } from './squadrules-uri.js';
|
|
3
3
|
const adapterUriSchema = z
|
|
4
4
|
.string()
|
|
5
|
-
.regex(ADAPTER_SLUG_URI_INPUT_REGEX, 'must match
|
|
5
|
+
.regex(ADAPTER_SLUG_URI_INPUT_REGEX, 'must match squadrules://adapter/{slug}');
|
|
6
6
|
const layerUriSchema = z
|
|
7
7
|
.string()
|
|
8
|
-
.regex(LAYER_URI_INPUT_REGEX, 'must match
|
|
8
|
+
.regex(LAYER_URI_INPUT_REGEX, 'must match squadrules://layer/{uuid}[?execution_id={uuid}]');
|
|
9
9
|
const tuneUriSchema = z.union([adapterUriSchema, layerUriSchema]);
|
|
10
10
|
export const tuneInputSchema = z
|
|
11
11
|
.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tune_schema.js","sourceRoot":"","sources":["../../src/tools/tune_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tune_schema.js","sourceRoot":"","sources":["../../src/tools/tune_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,MAAM,gBAAgB,GAAG,CAAC;KACvB,MAAM,EAAE;KACR,KAAK,CAAC,4BAA4B,EAAE,wCAAwC,CAAC,CAAC;AAEjF,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,EAAE,4DAA4D,CAAC,CAAC;AAE9F,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IACtG,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAC/F,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IACrH,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;SAC1C,QAAQ,EAAE;SACV,QAAQ,CAAC,mHAAmH,CAAC;IAChI,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QACnF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QAC7D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;KAClE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACpB,wFAAwF;UACtF,4CAA4C,CAC/C;CACF,CAAC;KACD,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAChE,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,IAAI,EAAE,CAAC,SAAS,CAAC;YACjB,OAAO,EAAE,sDAAsD;SAChE,CAAC,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IAClF,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,IAAI,EAAE,CAAC,SAAS,CAAC;YACjB,OAAO,EAAE,oCAAoC;SAC9C,CAAC,CAAC;IACL,CAAC;IACD,4EAA4E;IAC5E,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzH,IAAI,UAAU,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QACzC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACzB,OAAO,EAAE,+HAA+H;SACzI,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxB,GAAG,EAAE,aAAa;QAClB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CAAC;IACH,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
package/dist/tools/update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractMemoryBody, hasMemoryBodyMarkers } from '../utils/memory-body.js';
|
|
2
2
|
import { validateAdapterMarkdownSize } from '../services/memory/validate-adapter-markdown-size.js';
|
|
3
|
-
import { buildLayerUri,
|
|
3
|
+
import { buildLayerUri, parseSquadrulesUriOrThrow } from './squadrules-uri.js';
|
|
4
4
|
/** Shared execute: update memories by URIs. Used by MCP tool and HTTP route. */
|
|
5
5
|
export async function executeUpdate(qdrantService, input) {
|
|
6
6
|
const { uris, content, updates } = input;
|
|
@@ -13,7 +13,7 @@ export async function executeUpdate(qdrantService, input) {
|
|
|
13
13
|
for (let index = 0; index < uris.length; index++) {
|
|
14
14
|
const uri = uris[index];
|
|
15
15
|
try {
|
|
16
|
-
const parsed =
|
|
16
|
+
const parsed = parseSquadrulesUriOrThrow(uri);
|
|
17
17
|
if (parsed.kind !== 'layer') {
|
|
18
18
|
throw new Error('update requires a layer URI (stored layer row), not an adapter or artifact URI');
|
|
19
19
|
}
|
package/dist/tools/update.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/tools/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/tools/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,aAA4B,EAC5B,KAAkB;IAElB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACzC,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;YAC9C,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;YACpG,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACzE,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,UAAU,GAAG,2BAA2B,CAAC,YAAY,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC7F,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;gBAChE,CAAC;gBACD,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBAC7C,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACzD,CAAC;iBAAM,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtD,IAAI,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;oBACjF,MAAM,UAAU,GAAG,2BAA2B,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;oBAChG,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;wBACnB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,KAAK,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;oBAChE,CAAC;oBACD,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChD,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACzD,CAAC;qBAAM,CAAC;oBACN,MAAM,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,CAAC,IAAI,CAAC;gBACX,GAAG,EAAE,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,iBAAiB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,uBAAuB;aACzF,CAAC,CAAC;YACH,YAAY,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC;gBACX,GAAG;gBACH,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,4BAA4B,YAAY,EAAE;aACpD,CAAC,CAAC;YACH,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,aAAa,EAAE,YAAY;QAC3B,YAAY,EAAE,WAAW;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_schema.d.ts","sourceRoot":"","sources":["../../src/tools/update_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"update_schema.d.ts","sourceRoot":"","sources":["../../src/tools/update_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;iBAU7B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
const CANONICAL_LAYER_URI = /^
|
|
3
|
-
/** Transitional ingest: older ambiguous surface that still meant a layer row UUID. */
|
|
4
|
-
const OLDER_LAYER_ROW_URI = new RegExp(`^${['kairos', '://', 'me', 'm', '/'].join('')}[0-9a-f-]{36}$`, 'i');
|
|
2
|
+
const CANONICAL_LAYER_URI = /^squadrules:\/\/layer\/[0-9a-f-]{36}(?:\?execution_id=[0-9a-f-]{36})?$/i;
|
|
5
3
|
const layerUriSchema = z
|
|
6
4
|
.string()
|
|
7
|
-
.refine((s) => CANONICAL_LAYER_URI.test(s)
|
|
8
|
-
message: 'must be
|
|
5
|
+
.refine((s) => CANONICAL_LAYER_URI.test(s), {
|
|
6
|
+
message: 'must be squadrules://layer/{layer-uuid} with optional ?execution_id='
|
|
9
7
|
});
|
|
10
8
|
export const updateInputSchema = z.object({
|
|
11
9
|
uris: z.array(layerUriSchema).nonempty().describe('Non-empty array of layer URIs (stored layer rows) to update'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_schema.js","sourceRoot":"","sources":["../../src/tools/update_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"update_schema.js","sourceRoot":"","sources":["../../src/tools/update_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,yEAAyE,CAAC;AAEtG,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IAC1C,OAAO,EACL,sEAAsE;CACzE,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IAChH,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IACxG,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;CACtH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,cAAc;QACnB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CACH;IACD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* SQUADRULES Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Simplified data structures for Stage 1 implementation
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class SquadrulesError extends Error {
|
|
7
7
|
code: string;
|
|
8
8
|
statusCode: number;
|
|
9
9
|
details?: Record<string, any> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,qBAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,qBAAa,eAAgB,SAAQ,KAAK;IAG3B,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAHpC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAY,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAA;CAK3C;AAGD,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,oBAAoB,CAAC,EAAE,mBAAmB,CAAC;IAC3C,oBAAoB,CAAC,EAAE,mBAAmB,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACxD;AAGD,MAAM,WAAW,mBAAmB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AAGD,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAGD,MAAM,WAAW,mBAAmB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAClD;AAGD,MAAM,WAAW,eAAe;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAGD,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* SQUADRULES Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Simplified data structures for Stage 1 implementation
|
|
5
5
|
*/
|
|
6
|
-
// Core
|
|
6
|
+
// Core SQUADRULES memory structure - removed in favor of Qdrant SDK types
|
|
7
7
|
// Individual items are now represented as Qdrant points with embedded metadata
|
|
8
|
-
export class
|
|
8
|
+
export class SquadrulesError extends Error {
|
|
9
9
|
code;
|
|
10
10
|
statusCode;
|
|
11
11
|
details;
|
|
@@ -15,7 +15,7 @@ export class KairosError extends Error {
|
|
|
15
15
|
this.code = code;
|
|
16
16
|
this.statusCode = statusCode;
|
|
17
17
|
this.details = details;
|
|
18
|
-
this.name = '
|
|
18
|
+
this.name = 'SquadrulesError';
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0EAA0E;AAC1E,+EAA+E;AAE/E,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAG3B;IACA;IACA;IAJX,YACI,OAAe,EACR,IAAY,EACZ,aAAqB,GAAG,EACxB,OAA6B,CAAC,iDAAiD;;QAEtF,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAc;QACxB,YAAO,GAAP,OAAO,CAAsB;QAGpC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,y as t}from"./vendor-DGTQ2S8W.js";import{t as n}from"./react-CR5VJ85Q.js";import{n as r,r as i,t as a}from"./index-
|
|
1
|
+
import{g as e,y as t}from"./vendor-DGTQ2S8W.js";import{t as n}from"./react-CR5VJ85Q.js";import{n as r,r as i,t as a}from"./index-PouLvU1c.js";import{t as o}from"./api-BgTb-tmJ.js";async function s(){let e=await o(`/api/me`);if(!e.ok){let t=await e.json().catch(()=>({})),n=Error(t.message??e.statusText);throw n.statusCode=e.status,n}return e.json()}function c(){return e({queryKey:[`me`],queryFn:s,retry:!1})}var l=n(),u={light:`account.themeOptionLight`,dark:`account.themeOptionDark`};function d(e){if(e.name&&e.name.trim().length>0)return e.name;let t=[e.given_name,e.family_name].filter(e=>typeof e==`string`&&e.trim().length>0);return t.length>0?t.join(` `):e.preferred_username&&e.preferred_username.length>0?e.preferred_username:e.sub}function f(){let{t:e}=t(),{data:n,isLoading:o,isError:s}=c(),{preference:f,setPreference:p}=i();return o?(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):s||!n?(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,l.jsx)(`a`,{href:`/auth/callback`,className:`mt-4 min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.signIn`)})]}):(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,l.jsxs)(`div`,{className:`mb-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,l.jsx)(`h2`,{className:`mb-1 text-base font-semibold text-[var(--color-text-heading)]`,children:e(`account.themeTitle`)}),(0,l.jsx)(`p`,{className:`mb-3 text-sm text-[var(--color-text-muted)]`,children:e(`account.themeDescription`)}),(0,l.jsx)(`label`,{htmlFor:`account-theme-preference`,className:`sr-only`,children:e(`account.themePreferenceLabel`)}),(0,l.jsxs)(`select`,{id:`account-theme-preference`,value:f,onChange:e=>{let t=e.target.value;r(t)&&p(t)},className:`min-h-[44px] w-full max-w-xs rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-3 py-2 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:[(0,l.jsx)(`option`,{value:`system`,children:e(`account.themeOptionSystem`)}),a.map(t=>(0,l.jsx)(`option`,{value:t,children:e(u[t])},t))]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:d(n)})]}),n.preferred_username&&n.preferred_username!==d(n)&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.username`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.preferred_username})]}),n.email&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,l.jsxs)(`span`,{className:`text-[var(--color-text-heading)]`,children:[n.email,n.email_verified===!0?` (${e(`account.emailVerified`)})`:``]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.accountType`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.account_label})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.realm`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.realm})]}),n.identity_provider&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.identityProvider`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.identity_provider})]}),n.groups.length>0&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.groups`)}),(0,l.jsx)(`ul`,{className:`list-disc list-inside text-[var(--color-text-heading)] space-y-1`,children:n.groups.map(e=>(0,l.jsx)(`li`,{children:e},e))})]}),(0,l.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,l.jsx)(`a`,{href:`/auth/logout`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.logOut`)})})]})]})}export{f as AccountPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,p as t,y as n}from"./vendor-DGTQ2S8W.js";import{t as r}from"./react-CR5VJ85Q.js";import{n as i,r as a}from"./SpaceSelect-DDhPkDXU.js";import{t as o}from"./SurfaceCard-CRidnDLP.js";var s=r();function c(){let{t:r}=n(),c=t(),{data:l,isLoading:u,isError:d}=a(),f=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;c(t?`/squadrules?q=${encodeURIComponent(t)}`:`/squadrules`)},p=l?.spaces??[],m=u||d||p.length===0;return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`home.title`)}),(0,s.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:r(`home.tagline`)}),(0,s.jsx)(o,{title:r(`home.findCardTitle`),subtitle:r(`home.findCardSubtitle`),className:`mb-6`,children:(0,s.jsxs)(`form`,{onSubmit:f,className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end`,"aria-label":r(`home.searchLabel`),children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`home.searchLabel`)}),(0,s.jsx)(`input`,{id:`home-search-query`,name:`q`,type:`search`,autoComplete:`off`,placeholder:r(`home.searchPlaceholder`),"aria-describedby":`home-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,s.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.searchHint`)})]}),(0,s.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:flex-col md:items-stretch`,children:[(0,s.jsx)(`button`,{type:`submit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`squadrules.search`)}),(0,s.jsx)(e,{to:`/squadrules`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`home.goToBrowse`)})]})]})}),(0,s.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3 mb-6`,children:[(0,s.jsx)(o,{title:r(`home.cardBrowseTitle`),subtitle:r(`home.cardBrowseSubtitle`),children:(0,s.jsx)(e,{to:`/squadrules`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`home.cardBrowseCta`)})}),(0,s.jsx)(o,{title:r(`home.cardCreateTitle`),subtitle:r(`home.cardCreateSubtitle`),children:(0,s.jsx)(e,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`home.cardCreateCta`)})}),(0,s.jsx)(o,{title:r(`home.cardRunsTitle`),subtitle:r(`home.cardRunsSubtitle`),children:(0,s.jsx)(e,{to:`/runs`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`home.cardRunsCta`)})})]}),(0,s.jsxs)(`section`,{"aria-labelledby":`home-stats-heading`,children:[(0,s.jsx)(`h2`,{id:`home-stats-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:r(`home.spacesHeading`)}),(0,s.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,"aria-label":r(`home.statsLabel`),children:[m&&p.length===0?(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,s.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:r(`home.stats.spacesLabel`)}),(0,s.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.stats.protocolCount`,{count:0})})]}):null,p.map(e=>(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`div`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:u?`—`:e.adapter_count}),(0,s.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,s.jsx)(`span`,{className:`text-xs uppercase tracking-wide text-[var(--color-text-muted)]`,children:e.name}),(0,s.jsx)(i,{type:e.type})]}),(0,s.jsx)(`div`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:u?`—`:r(`home.stats.protocolCount`,{count:e.adapter_count})})]},e.space_id))]})]})]})}export{c as HomePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,m as n,y as r}from"./vendor-DGTQ2S8W.js";import{i,t as a}from"./react-CR5VJ85Q.js";import{t as o}from"./SurfaceCard-CRidnDLP.js";import{a as s,n as c,r as l,s as u,t as d}from"./export-skill-zip-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,m as n,y as r}from"./vendor-DGTQ2S8W.js";import{i,t as a}from"./react-CR5VJ85Q.js";import{t as o}from"./SurfaceCard-CRidnDLP.js";import{a as s,n as c,r as l,s as u,t as d}from"./export-skill-zip-C1bRyhE2.js";import{n as f}from"./ChallengeCard-gY-n7rwI.js";import{n as p,t as m}from"./StepFlowGraph-DsL5lsIq.js";var h=e(i(),1),g=a();function _({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,h.useState)(!1),s=(0,h.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]);return(0,g.jsx)(`button`,{type:`button`,onClick:s,className:n,"aria-label":a?i(`run.copied`):t,title:t,children:i(a?`run.copied`:`run.copy`)})}function v(e){return e.body.replace(/\n```json\s*[\s\S]*?```\s*$/g,``).trim()}function y(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:y,isError:b,error:x}=u(i?decodeURIComponent(i):void 0,!0),[S,C]=(0,h.useState)(!1),[w,T]=(0,h.useState)(null);if(y&&!a)return(0,g.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(b||!a)return(0,g.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[x instanceof Error?x.message:e(`protocol.notFound`),(0,g.jsx)(t,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:E,steps:D,triggers:O,completion:k}=s(a.content),A=E.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,j=()=>{let e=new Blob([a.content],{type:`text/markdown;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${A}.md`,n.click(),URL.revokeObjectURL(t)},M=async()=>{if(a?.uri){T(null),C(!0);try{let{blob:e,skill_bundle_manifest:t}=await d(a.uri),n=c(t,A);l(e,n)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},N=`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`;return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:E}),(0,g.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,g.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,g.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,g.jsx)(`code`,{className:`break-all rounded bg-[var(--color-surface-elevated)] px-2 py-0.5 text-xs`,children:a.uri}),(0,g.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]}),a.space_name!=null&&a.space_name.length>0?(0,g.jsxs)(`span`,{className:`ml-2 block w-full sm:inline sm:w-auto`,children:[`· `,e(`protocol.spaceLabel`),`: `,a.space_name]}):null]}),(0,g.jsx)(_,{value:a.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,g.jsxs)(`div`,{className:`mb-6 flex flex-wrap gap-2`,children:[(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:N,children:e(`protocol.edit`)}),(0,g.jsx)(t,{to:`/protocols/new`,className:N,children:e(`protocol.duplicate`)})]}),(0,g.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.6fr_1fr]`,children:[(0,g.jsx)(o,{title:e(`protocol.howToUse`),subtitle:e(`protocol.howToUseInProduct`),children:(0,g.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[e(`protocol.howToUseCopy`),` `,(0,g.jsx)(`a`,{href:`https://github.com/SquadRules/mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})}),(0,g.jsx)(o,{title:e(`protocol.exportCardTitle`),subtitle:e(`protocol.exportCardSubtitle`),children:(0,g.jsxs)(`div`,{className:`w-full max-w-[22rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,g.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocol.download`)}),(0,g.jsxs)(`button`,{type:`button`,onClick:j,className:`flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`,children:[(0,g.jsx)(`span`,{children:e(`protocol.downloadAsMarkdown`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>void M(),disabled:S,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] disabled:opacity-60`,children:[(0,g.jsx)(`span`,{children:e(`protocol.downloadAsSkill`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.zip`})]}),w?(0,g.jsx)(`p`,{className:`mt-2 text-xs text-[var(--color-error)] m-0`,role:`alert`,children:w}):null,(0,g.jsxs)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)]`,children:[(0,g.jsx)(`span`,{children:e(`protocol.editAsSkill`)}),(0,g.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`bundle`})]}),(0,g.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-[var(--color-text-muted)] m-0`,children:e(`protocol.exportFooter`)})]})})]}),(0,g.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`flow-heading`,children:[(0,g.jsx)(`h2`,{id:`flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.stepFlow`)}),(0,g.jsx)(m,{steps:D.map(e=>({label:e.label}))})]}),(0,g.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-6`,children:[(0,g.jsx)(`h2`,{id:`steps-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.steps`)}),(0,g.jsx)(`ul`,{className:`m-0 list-none divide-y divide-[var(--color-border)] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-0`,children:D.map((e,t)=>{let n=v(e);return(0,g.jsxs)(`li`,{className:`p-4`,children:[(0,g.jsxs)(`strong`,{className:`block text-[var(--color-text-heading)]`,children:[t+1,`. `,e.label]}),(0,g.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)] break-words`,children:e.summary}),(0,g.jsx)(`div`,{className:`mt-3`,children:(0,g.jsx)(f,{type:e.type,payload:e.challengePayload})}),n?(0,g.jsx)(`div`,{className:`mt-3 border-t border-[var(--color-border)] pt-3`,children:(0,g.jsx)(p,{content:n})}):null]},t)})})]}),(O||k)&&(0,g.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[O?(0,g.jsx)(o,{title:e(`protocol.triggers`),children:(0,g.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,g.jsx)(p,{content:O})})}):null,k?(0,g.jsx)(o,{title:e(`protocol.completion`),children:(0,g.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,g.jsx)(p,{content:k})})}):null]})]})}export{y as ProtocolDetailPage};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,m as n,p as r,t as i,y as a}from"./vendor-DGTQ2S8W.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as c}from"./api-BgTb-tmJ.js";import{r as l,t as u}from"./SpaceSelect-DDhPkDXU.js";import{t as d}from"./SurfaceCard-CRidnDLP.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./export-skill-zip-C1bRyhE2.js";import{t as y}from"./ChallengeCard-gY-n7rwI.js";import{t as b}from"./RichTextEditor-Bj6JxHM5.js";var x=e(o(),1),S=i().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Activation Patterns\b/i.test(e),`Include an "Activation Patterns" section (H2)`).refine(e=>/(^|\n)##\s+Reward Signal\b/i.test(e),`Include a "Reward Signal" section (H2)`),C={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},w=[`shell`,`mcp`,`user_input`,`comment`],T=/^squadrules:\/\/adapter\/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,E=s();function D({t:e,fileInputRef:n,onUpload:r,isNew:i,decodedUri:a}){return(0,E.jsx)(d,{className:`mb-8`,title:e(`protocolEdit.importCardTitle`),subtitle:e(`protocolEdit.uploadHint`),children:(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(`input`,{ref:n,type:`file`,accept:`.md,text/markdown`,onChange:r,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>n.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!i&&a&&(0,E.jsx)(t,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})})}function O({t:e,preview:n,skillFolderSlug:r,isNew:i,decodedUri:a}){let[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(null);return(0,E.jsxs)(`div`,{className:`space-y-4`,"aria-label":e(`protocolEdit.previewLabel`),children:[(0,E.jsxs)(d,{title:e(`protocolEdit.previewRenderedTitle`),subtitle:e(`protocolEdit.previewRenderedSubtitle`),children:[(0,E.jsx)(`div`,{className:`text-lg font-semibold text-[var(--color-text-heading)]`,children:n.title}),(0,E.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.steps.length===0?(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):n.steps.slice(0,20).map((t,n)=>(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewStepLine`,{n:n+1,label:t.label})}),(0,E.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:y[t.type]??t.type})]},`${t.label}:${n}`))}),(0,E.jsxs)(`div`,{className:`mt-4 border-t border-[var(--color-border)] pt-4 text-sm text-[var(--color-text-muted)]`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,n.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,E.jsxs)(`div`,{className:`mt-1`,children:[(0,E.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,n.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]}),!i&&a?(0,E.jsxs)(d,{title:e(`protocolEdit.skillShortcutTitle`),subtitle:e(`protocolEdit.skillShortcutSubtitle`),children:[(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,E.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[r,`-skill/`]}),(0,E.jsxs)(`div`,{className:`mt-2 font-mono text-sm text-[var(--color-text-muted)]`,children:[`Skill.md`,(0,E.jsx)(`br`,{}),`references/`,(0,E.jsx)(`br`,{}),`\xA0\xA0SQUADRULES.md`]})]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,E.jsx)(t,{to:`/protocols/${encodeURIComponent(a)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)}),(0,E.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{(async()=>{if(a){l(null),s(!0);try{let{blob:e,skill_bundle_manifest:t}=await v(a),n=m(t,r);g(e,n)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}})()},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 text-sm font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(`protocol.downloadAsSkill`)}),c?(0,E.jsx)(`p`,{className:`mt-2 m-0 text-xs text-[var(--color-error)]`,role:`alert`,children:c}):null]})]}):null]})}function k({t:e,isNew:t,spaces:n,spacesLoading:r,targetSpace:i,setTargetSpace:a,forkSourceUri:o,setForkSourceUri:s,moveSpace:c,setMoveSpace:l}){return(0,E.jsx)(`section`,{className:`mb-8 space-y-5 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:t?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-target-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.targetSpaceLabel`)}),(0,E.jsx)(u,{id:`protocol-target-space`,spaces:n,value:i,onChange:a,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.targetSpaceHint`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-fork-source`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.forkSourceLabel`)}),(0,E.jsx)(`input`,{id:`protocol-fork-source`,type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:e(`protocolEdit.forkSourcePlaceholder`),autoComplete:`off`,className:`min-h-[44px] w-full max-w-2xl rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.forkSourceHint`)})]})]}):(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-move-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.moveSpaceLabel`)}),(0,E.jsx)(u,{id:`protocol-move-space`,spaces:n,value:c,onChange:l,disabled:r}),(0,E.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.moveSpaceHint`)})]})})}var A=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,j=`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`;function M({t:e,step:t,index:n,stepsLength:r,uploadKey:i,challengeTypeLabel:a,setStep:o,removeStep:s}){return(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,E.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepHeading`,{n:n+1})}),(0,E.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.stepEditorHint`)})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(n),disabled:r<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,E.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>o(n,{label:e.target.value}),className:A})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>o(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}:void 0,mcp:e===`mcp`?{tool_name:t.mcp?.tool_name??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:a[e]},e))})]}),(0,E.jsx)(`div`,{children:(0,E.jsx)(b,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>o(n,{bodyMarkdown:e}),contentKey:i})}),(0,E.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,E.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>o(n,{shell:{cmd:e.target.value,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:j})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,E.jsx)(`input`,{type:`number`,min:1,value:t.shell?.timeout_seconds??30,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:Math.max(1,Number(e.target.value)||30),interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:j})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.interpreter??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:e.target.value||void 0,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:j})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,E.jsx)(`input`,{type:`text`,value:t.shell?.workdir??``,onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:e.target.value||void 0,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:j})]}),(0,E.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,E.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
2
|
+
`),onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:e.target.value.split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean),args:t.shell?.args??[]}}),className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,E.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellArgs`)}),(0,E.jsx)(`textarea`,{rows:3,value:(t.shell?.args??[]).join(`
|
|
4
|
+
`),onChange:e=>o(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:e.target.value.split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(Boolean)}}),className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]})]}),t.type===`mcp`&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.mcpToolName`)}),(0,E.jsx)(`input`,{type:`text`,value:t.mcp?.tool_name??``,onChange:e=>o(n,{mcp:{tool_name:e.target.value}}),className:j})]}),t.type===`user_input`&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.userInputPrompt`)}),(0,E.jsx)(`input`,{type:`text`,value:t.user_input?.prompt??``,onChange:e=>o(n,{user_input:{prompt:e.target.value}}),className:j})]}),t.type===`comment`&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.commentMinLength`)}),(0,E.jsx)(`input`,{type:`number`,min:1,value:t.comment?.min_length??10,onChange:e=>o(n,{comment:{min_length:Math.max(1,parseInt(e.target.value,10)||10)}}),className:j})]})]})]})]})}function N(){let{t:e}=a(),{uri:i}=n(),o=r(),s=i?decodeURIComponent(i):void 0,u=!s,{data:d,isLoading:m}=_(s,!u),[g,v]=(0,x.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...C}],completionMarkdown:``}),[y,w]=(0,x.useState)(()=>String(Date.now())),[A,j]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)(null),L=(0,x.useRef)(null),R=(0,x.useRef)(``),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(``),[U,W]=(0,x.useState)(``),{data:G,isLoading:K}=l(!0,{});(0,x.useEffect)(()=>{u&&(B(``),W(``))},[u]),(0,x.useEffect)(()=>{if(!u)return;let e=G?.spaces?.find(e=>e.type===`personal`);B(t=>t===``&&e?e.space_id:t)},[u,G?.spaces]),(0,x.useEffect)(()=>{if(u||!d)return;let e=typeof d.space_id==`string`?d.space_id.trim():``;R.current=e,H(e)},[u,d]),(0,x.useEffect)(()=>{if(d?.content)try{v(h(d.content)),w(String(Date.now()))}catch{v({protocolLabel:d.label||`Protocol`,triggersMarkdown:``,steps:[{...C}],completionMarkdown:``})}},[d]);let q=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{let e=typeof n.result==`string`?n.result:``;try{v(h(e)),w(String(Date.now())),I(null),P(null)}catch{P(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},J=(e,t)=>{v(n=>({...n,[e]:t}))},Y=(e,t)=>{v(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},X=()=>{v(e=>({...e,steps:[...e.steps,{...C,label:`Step ${e.steps.length+1}`}]}))},Z=e=>{v(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},Q=async t=>{t.preventDefault(),P(null),I(null);let n=p(g),r=S.safeParse(n);if(!r.success){I(r.error.issues[0]?.message??`Invalid`);return}let i=U.trim();if(i&&!T.test(i)){I(e(`protocolEdit.forkUriInvalid`));return}j(!0);try{if(u){let e=z.trim()||`personal`,t=await c(`/api/train`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n,llm_model_id:`squadrules-ui`,force_update:!1,space:e,...i?{source_adapter_uri:i}:{}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}let r=await t.json(),a=r.items?.[0]?.adapter_uri,s=r.items?.[0]?.uri;o(a?`/protocols/${encodeURIComponent(a)}`:s?`/protocols/${encodeURIComponent(s)}`:`/`)}else{let e=R.current.trim(),t=V.trim(),r={uris:[s],content:[n]};t&&t!==e&&(r.space=t);let i=await c(`/api/tune`,{method:`POST`,body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){P(e instanceof Error?e.message:String(e))}finally{j(!1)}},$=(()=>{try{return f(p(g))}catch{return{title:g.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!u&&m&&!d)return(0,E.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let ee={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)},te=(g.protocolLabel.trim()||$.title||`skill`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``).toLowerCase()||`skill`;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(u?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,E.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,E.jsx)(k,{t:e,isNew:u,spaces:G?.spaces,spacesLoading:K,targetSpace:z,setTargetSpace:B,forkSourceUri:U,setForkSourceUri:W,moveSpace:V,setMoveSpace:H}),(0,E.jsx)(D,{t:e,fileInputRef:L,onUpload:q,isNew:u,decodedUri:s}),(0,E.jsx)(`form`,{onSubmit:Q,"aria-label":e(`protocolEdit.formLabel`),children:(0,E.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.45fr_1fr]`,children:[(0,E.jsxs)(`div`,{className:`space-y-6`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,E.jsx)(`input`,{id:`protocol-label`,type:`text`,value:g.protocolLabel,onChange:e=>J(`protocolLabel`,e.target.value),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,E.jsx)(b,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersEditorHint`),value:g.triggersMarkdown,onChange:e=>J(`triggersMarkdown`,e),contentKey:y}),g.steps.map((t,n)=>(0,E.jsx)(M,{t:e,step:t,index:n,stepsLength:g.steps.length,uploadKey:y,challengeTypeLabel:ee,setStep:Y,removeStep:Z},n)),(0,E.jsx)(`button`,{type:`button`,onClick:X,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.addStep`)}),(0,E.jsx)(b,{label:e(`protocolEdit.completionLabel`),value:g.completionMarkdown,onChange:e=>J(`completionMarkdown`,e),contentKey:y}),F&&(0,E.jsx)(`p`,{className:`text-sm text-[var(--color-error)]`,role:`alert`,children:F}),N&&(0,E.jsx)(`div`,{className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,role:`alert`,children:N}),(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(`button`,{type:`submit`,disabled:A,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(A?`protocolEdit.saving`:`protocolEdit.save`)}),(0,E.jsx)(t,{to:u?`/`:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.cancel`)})]})]}),(0,E.jsx)(O,{t:e,preview:$,skillFolderSlug:te,isNew:u,decodedUri:s})]})})]})}export{N as ProtocolEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./tiptap-74Cp-fci.js";var f=e(t(),1);function p(){return[c.configure({link:!1,heading:{levels:[2,3,4]}}),u.configure({openOnClick:!1,autolink:!1}),s.configure({resizable:!1}),r,l,a,d.configure({markedOptions:{gfm:!0,breaks:!1}})]}var m=n(),h=`min-h-[11rem] px-4 py-3 text-sm leading-6 text-[var(--color-text)] focus:outline-none prose prose-sm max-w-none [&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-2 [&_th]:py-1.5 [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-2 [&_td]:py-1.5`;function g({children:e,className:t=`h-4 w-4`}){return(0,m.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:e})}function _(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`path`,{d:`M6 4h7`}),(0,m.jsx)(`path`,{d:`M6 8h7`}),(0,m.jsx)(`path`,{d:`M6 12h7`})]})}function v(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,m.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,m.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function y(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,m.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function b(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,m.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function x(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,m.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,m.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function S(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,m.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,m.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 4v11`}),(0,m.jsx)(`path`,{d:`M6 4v11`}),(0,m.jsx)(`path`,{d:`M10 4v11`}),(0,m.jsx)(`path`,{d:`M14 4v11`})]})}function C({label:e,ariaLabel:t,active:n,onClick:r}){return(0,m.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:r,className:`inline-flex min-h-[36px] min-w-[36px] items-center justify-center rounded-[var(--radius-sm)] border px-3 text-xs font-medium transition-colors ${n?`border-[var(--color-primary)] bg-[var(--color-primary)] text-white`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text)]`}`,children:e})}function w({editor:e}){return e?(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-3 py-2`,children:[(0,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(_,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(v,{}),ariaLabel:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Enter URL`,t??`https://`);if(n==null)return;let r=n.trim();if(!r){e.chain().focus().unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}}),(0,m.jsx)(C,{label:(0,m.jsx)(y,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(b,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(x,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(S,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function T({value:e,onChange:t,label:n,hint:r,id:a,contentKey:s}){let c=(0,f.useRef)(s),l=(0,f.useRef)(null),u=(0,f.useRef)(e),d=(0,f.useRef)(t);u.current=e,d.current=t;let g=o({
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./tiptap-74Cp-fci.js";var f=e(t(),1);function p(){return[c.configure({link:!1,heading:{levels:[2,3,4]}}),u.configure({openOnClick:!1,autolink:!1}),s.configure({resizable:!1}),r,l,a,d.configure({markedOptions:{gfm:!0,breaks:!1}})]}var m=n(),h=`min-h-[11rem] px-4 py-3 text-sm leading-6 text-[var(--color-text)] focus:outline-none prose prose-sm max-w-none [&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-2 [&_th]:py-1.5 [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-2 [&_td]:py-1.5`;function g({children:e,className:t=`h-4 w-4`}){return(0,m.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:e})}function _(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`path`,{d:`M6 4h7`}),(0,m.jsx)(`path`,{d:`M6 8h7`}),(0,m.jsx)(`path`,{d:`M6 12h7`})]})}function v(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,m.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,m.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function y(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,m.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function b(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,m.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function x(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,m.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,m.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function S(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,m.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,m.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 4v11`}),(0,m.jsx)(`path`,{d:`M6 4v11`}),(0,m.jsx)(`path`,{d:`M10 4v11`}),(0,m.jsx)(`path`,{d:`M14 4v11`})]})}function C({label:e,ariaLabel:t,active:n,onClick:r}){return(0,m.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:r,className:`inline-flex min-h-[36px] min-w-[36px] items-center justify-center rounded-[var(--radius-sm)] border px-3 text-xs font-medium transition-colors ${n?`border-[var(--color-primary)] bg-[var(--color-primary)] text-white`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text)]`}`,children:e})}function w({editor:e}){return e?(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-3 py-2`,children:[(0,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(_,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(v,{}),ariaLabel:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Enter URL`,t??`https://`);if(n==null)return;let r=n.trim();if(!r){e.chain().focus().unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}}),(0,m.jsx)(C,{label:(0,m.jsx)(y,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(b,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(x,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(S,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function T({value:e,onChange:t,label:n,hint:r,id:a,contentKey:s}){let c=(0,f.useRef)(s),l=(0,f.useRef)(null),u=(0,f.useRef)(e),d=(0,f.useRef)(t);u.current=e,d.current=t;let g=o({immediatelyRender:!1,extensions:p(),content:e,contentType:`markdown`,editorProps:{attributes:{class:h}},onUpdate:({editor:e})=>{let t=e.getMarkdown?.()??``;l.current=t,t!==u.current&&d.current(t)}});return(0,f.useEffect)(()=>{if(g){if(s!==c.current){c.current=s,l.current=e,g.commands.setContent(e,{emitUpdate:!1,contentType:`markdown`});return}e!==l.current&&(l.current=e,g.commands.setContent(e,{emitUpdate:!1,contentType:`markdown`}))}},[s,e,g]),(0,m.jsxs)(`div`,{children:[n&&(0,m.jsx)(`label`,{htmlFor:a,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:n}),(0,m.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,children:[(0,m.jsx)(w,{editor:g}),(0,m.jsx)(i,{editor:g})]}),r&&(0,m.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:r})]})}export{T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,h as n,m as r,s as i,y as a}from"./vendor-DGTQ2S8W.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as c}from"./api-BgTb-tmJ.js";import{t as l}from"./SurfaceCard-CRidnDLP.js";import{t as u}from"./ErrorAlert-BQMph5Nh.js";import{n as d}from"./ChallengeCard-gY-n7rwI.js";import{n as f,t as p}from"./StepFlowGraph-DsL5lsIq.js";import{n as m,t as h}from"./useRunSession-062hqhcN.js";var g=e(o(),1),_=s();function v(e){let t=e.trim();return t?JSON.parse(t):null}function y({contract:e,disabled:t,onSubmit:n}){let{t:r}=a(),i=e.type,[o,s]=(0,g.useState)(0),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),m=e.mcp?.tool_name??``,[h,y]=(0,g.useState)(!0),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),w=e.user_input?.prompt??``,[T,E]=(0,g.useState)(``),D=e.comment?.min_length??10,[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(null);(0,g.useEffect)(()=>{j(null),s(0),l(``),d(``),p(``),y(!0),x(``),C(``),E(``),k(``)},[i,m,w,D]);let M=(0,g.useMemo)(()=>i===`tensor`?f.trim().length>0:i===`shell`?Number.isFinite(o):i===`mcp`?m.trim().length>0:i===`user_input`?T.trim().length>0:i===`comment`&&O.trim().length>=D,[i,o,m,T,O,D]);return(0,_.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),j(null),M)try{if(i===`tensor`){let t=v(f);n({type:i,tensor:{name:e.tensor?.output.name??`tensor`,value:t}});return}if(i===`shell`){n({type:i,shell:{exit_code:o,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`mcp`){let e=v(b),t=v(S);n({type:i,mcp:{tool_name:m,...e===null?{}:{arguments:e},result:t,success:h}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:T.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:O.trim()}});return}}catch(e){j(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[A&&(0,_.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:A}),i===`shell`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,_.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:o,onChange:e=>s(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`tensor`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:`Output tensor`}),(0,_.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[e.tensor?.output.name??`tensor`,` (`,e.tensor?.output.type??`unknown`,`)`]}),e.tensor?.required_inputs?.length?(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-2`,children:[`Required inputs: `,e.tensor.required_inputs.join(`, `)]}):null]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-tensor-value`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:`Tensor value (JSON)`}),(0,_.jsx)(`textarea`,{id:`run-tensor-value`,value:f,onChange:e=>p(e.target.value),placeholder:`"example string" or ["item1", "item2"]`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`mcp`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.mcp.toolName`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:m||r(`run.mcp.toolMissing`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>y(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.mcp.success`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-mcp-args`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.arguments`)}),(0,_.jsx)(`textarea`,{id:`run-mcp-args`,value:b,onChange:e=>x(e.target.value),placeholder:`{ "example": true }`,className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-mcp-result`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.result`)}),(0,_.jsx)(`textarea`,{id:`run-mcp-result`,value:S,onChange:e=>C(e.target.value),placeholder:`{ "ok": true }`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`user_input`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:w||r(`run.userInput.promptMissing`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,_.jsx)(`textarea`,{id:`run-user-confirmation`,value:T,onChange:e=>E(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:D}),` · `,r(`run.comment.count`,{count:O.length})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,_.jsx)(`textarea`,{id:`run-comment-text`,value:O,onChange:e=>k(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":O.trim().length>0&&O.trim().length<D})]})]}),(0,_.jsx)(`button`,{type:`submit`,disabled:t||!M,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function b(e){let t=e.type;if(t===`shell`){let t=e.shell?.cmd;return{type:`shell`,...t?{payload:{cmd:t}}:{}}}if(t===`mcp`){let t=e.mcp?.tool_name,n=e.mcp?.arguments,r=n!==void 0&&typeof n==`object`&&!!n&&!Array.isArray(n);return{type:`mcp`,...t||r?{payload:{...t?{tool_name:t}:{},...r?{arguments:n}:{}}}:{}}}if(t===`user_input`){let t=e.user_input?.prompt;return{type:`user_input`,...t?{payload:{prompt:t}}:{}}}if(t===`comment`){let t=e.comment?.min_length;return{type:`comment`,...t==null?{}:{payload:{min_length:t}}}}return{type:t}}function x(e,t){let n=e.history.length,r=e.status===`running`,i=!!e.current_layer,a=e.status===`ready_to_reward`||e.status===`completed`||e.status===`error`,o=a?Math.max(n,1):Math.max(n+(r&&i?1:0),+!!r)||1;return{flowSteps:Array.from({length:o},(e,n)=>({label:t(n+1)})),currentFlowIndex:r&&i?n:void 0,displayCurrent:r&&i?n+1:a?o:Math.max(n,1),displayTotal:o}}function S({run:e,rewardOutcome:t,setRewardOutcome:n,rewardFeedback:r,setRewardFeedback:i,copyStatus:o,onCopy:s,onSubmitStep:c,onReward:l,isForwardStepPending:u,isForwardStartPending:m,isRewardPending:h}){let{t:g}=a(),{flowSteps:v,currentFlowIndex:S,displayCurrent:C,displayTotal:w}=x(e,e=>g(`run.flowStepN`,{n:e})),T=b(e.contract);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`run-flow-heading`,children:[(0,_.jsx)(`h2`,{id:`run-flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.progressHeading`)}),(0,_.jsx)(p,{steps:v,currentIndex:S})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,children:[(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:g(`run.stepProgress`,{current:C,total:w})}),(0,_.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,_.jsx)(`span`,{children:g(`run.sessionBadge`)})]}),e.last_message&&(0,_.jsxs)(`div`,{className:`mb-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,role:`status`,"aria-live":`polite`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:g(`run.serverMessage`)}),(0,_.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-current-step`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.currentStepHeading`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_layer?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`mb-2 text-sm text-[var(--color-text-muted)]`,children:[g(`run.layerUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.current_layer.uri})]}),e.current_layer.content?(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none text-[var(--color-text)]`,children:(0,_.jsx)(f,{content:e.current_layer.content})}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})]}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-challenge`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.challengeHeading`)}),(0,_.jsx)(d,{type:T.type,payload:T.payload}),e.contract.type===`shell`&&e.contract.shell?.cmd&&(0,_.jsxs)(`div`,{className:`mt-2`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>s(e.contract.shell.cmd),className:`min-h-[44px] min-w-[44px] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:g(`run.copyShellCommand`)}),o?(0,_.jsx)(`div`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:o}):null]}),(0,_.jsxs)(`details`,{className:`mt-4 text-sm`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:g(`run.advanced`)}),(0,_.jsxs)(`div`,{className:`mt-2 space-y-2 text-[var(--color-text-muted)]`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:g(`run.contractType`)}),`:`,` `,(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.contract.type})]}),e.contract.description&&(0,_.jsx)(`p`,{className:`m-0 text-sm`,children:e.contract.description}),e.contract.nonce&&(0,_.jsxs)(`div`,{children:[g(`run.nonce`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.nonce})]}),e.contract.proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.proofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.proof_hash})]}),e.previous_proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.previousProofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]}),e.contract.type===`tensor`&&(0,_.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:`Tensor output`}),(0,_.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[e.contract.tensor?.output.name??`tensor`,` (`,e.contract.tensor?.output.type??`unknown`,`)`]}),e.contract.tensor?.required_inputs?.length?(0,_.jsxs)(`div`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:[`Required inputs: `,e.contract.tensor.required_inputs.join(`, `)]}):null]})]}),e.status!==`completed`&&e.status!==`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-solution`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.solution`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,_.jsx)(y,{contract:e.contract,disabled:u||m,onSubmit:c})})]}),e.status===`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-reward`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-reward`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.reward.title`)}),(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsx)(`div`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:g(`run.reward.subtitle`)}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap gap-4`,role:`radiogroup`,"aria-label":g(`run.reward.outcomeLabel`),children:[(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.success`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.failure`)})]})]}),(0,_.jsxs)(`div`,{className:`mb-4`,children:[(0,_.jsx)(`label`,{htmlFor:`run-reward-feedback`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:g(`run.reward.feedback`)}),(0,_.jsx)(`textarea`,{id:`run-reward-feedback`,value:r,onChange:e=>i(e.target.value),className:`min-h-[8rem] w-full resize-y rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:l,disabled:h,className:`min-h-[44px] min-w-[44px] cursor-pointer rounded-[var(--radius-md)] border-0 bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-60`,children:g(h?`run.reward.submitting`:`run.reward.submit`)})]})]}),e.history.length>0&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-history`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.history`)}),(0,_.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,"aria-label":g(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,_.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.contract.type,` ·`,` `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.layer.uri})]}),e.server_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text)]`,children:e.server_message})]},`${e.layer.uri}:${t}`))})]}),e.status===`completed`&&(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--status-success-bg)] p-4 text-[var(--status-success-fg)]`,children:[(0,_.jsx)(`strong`,{className:`block`,children:g(`run.completed`)}),e.last_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm`,children:e.last_message})]})]})}async function C(e){let t=await c(`/api/forward`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function w(){return n({mutationFn:e=>C(e)})}async function T(e){let t=await c(`/api/forward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function E(){return n({mutationFn:e=>T(e)})}async function D(e){let t=await c(`/api/reward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function O(){return n({mutationFn:e=>D(e)})}function k(e){if(e)return e.match(/(?:kairos|squadrules):\/\/layer\/[0-9a-fA-F-]{36}(?:\?execution_id=[0-9a-fA-F-]{36})?/)?.[0]}function A(){return new Date().toISOString()}function j(){let{t:e}=a(),{uri:n}=r(),[o]=i(),s=n?decodeURIComponent(n):void 0,c=o.get(`session`),{session:d}=h(c),{upsert:f}=m(),p=w(),v=E(),y=O(),[b,x]=(0,g.useState)(null),[C,T]=(0,g.useState)(`success`),[D,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{d&&!b&&(x(d),T(`success`),j(``))},[d,b]);let P=e=>{x(e),f(e)},F=async()=>{if(s)try{let e=await p.mutateAsync(s),t=A(),n=`${s}:${t}`,r=e.next_action?.includes(`reward`)?`ready_to_reward`:`running`,i=k(e.next_action);P({id:n,adapter_uri:s,started_at:t,updated_at:t,status:r,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,reward_uri:r===`ready_to_reward`?i:void 0,history:[]})}catch{x(null)}};return s?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,_.jsx)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:e(`run.guidedIntro`)}),(0,_.jsxs)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:[e(`run.adapterUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:s})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,_.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,_.jsx)(`button`,{type:`button`,onClick:F,disabled:p.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:p.isPending?e(`run.starting`):e(`run.start`)})]}),(0,_.jsx)(l,{className:`mb-6`,title:e(`run.safety.title`),children:(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})}),p.isError&&(0,_.jsx)(u,{message:p.error instanceof Error?p.error.message:String(p.error),onRetry:()=>F(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,_.jsx)(`div`,{className:`mb-6`,children:(0,_.jsx)(u,{message:b.last_message,onRetry:()=>F(),showGoBack:!0})}),b&&b.status!==`error`&&(0,_.jsx)(S,{run:b,rewardOutcome:C,setRewardOutcome:T,rewardFeedback:D,setRewardFeedback:j,copyStatus:M,onCopy:async t=>{N(null);try{await navigator.clipboard.writeText(t),N(e(`run.copied`)),setTimeout(()=>N(null),1500)}catch(e){N(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_layer)return;let t=b.contract.nonce,n=b.previous_proof_hash??b.contract.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await v.mutateAsync({uri:b.current_layer.uri,solution:r}),t=A(),n=e.next_action?.includes(`reward`)||(e.message?.toLowerCase().includes(`call reward`)??!1),i=k(e.next_action)??b.reward_uri;P({...b,updated_at:t,status:n?`ready_to_reward`:`running`,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,reward_uri:n?i:void 0,history:[...b.history,{layer:b.current_layer,contract:b.contract,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){P({...b,updated_at:A(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onReward:async()=>{if(!b)return;let t=b.reward_uri??b.current_layer?.uri;if(t)try{let n=await y.mutateAsync({uri:t,outcome:C,feedback:D.trim()||e(`run.reward.defaultFeedback`)});P({...b,updated_at:A(),status:`completed`,last_message:n.results[0]?.feedback??b.last_message})}catch(e){P({...b,updated_at:A(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isForwardStepPending:v.isPending,isForwardStartPending:p.isPending,isRewardPending:y.isPending})]}):(0,_.jsx)(u,{message:e(`run.missingUri`),showGoBack:!0})}export{j as RunGuidedPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,h as n,m as r,s as i,y as a}from"./vendor-DGTQ2S8W.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as c}from"./api-BgTb-tmJ.js";import{t as l}from"./SurfaceCard-CRidnDLP.js";import{t as u}from"./ErrorAlert-BQMph5Nh.js";import{n as d}from"./ChallengeCard-gY-n7rwI.js";import{n as f,t as p}from"./StepFlowGraph-DsL5lsIq.js";import{n as m,t as h}from"./useRunSession-BX2U9D53.js";var g=e(o(),1),_=s();function v(e){let t=e.trim();return t?JSON.parse(t):null}function y({contract:e,disabled:t,onSubmit:n}){let{t:r}=a(),i=e.type,[o,s]=(0,g.useState)(0),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(``),m=e.mcp?.tool_name??``,[h,y]=(0,g.useState)(!0),[b,x]=(0,g.useState)(``),[S,C]=(0,g.useState)(``),w=e.user_input?.prompt??``,[T,E]=(0,g.useState)(``),D=e.comment?.min_length??10,[O,k]=(0,g.useState)(``),[A,j]=(0,g.useState)(null);(0,g.useEffect)(()=>{j(null),s(0),l(``),d(``),p(``),y(!0),x(``),C(``),E(``),k(``)},[i,m,w,D]);let M=(0,g.useMemo)(()=>i===`tensor`?f.trim().length>0:i===`shell`?Number.isFinite(o):i===`mcp`?m.trim().length>0:i===`user_input`?T.trim().length>0:i===`comment`&&O.trim().length>=D,[i,o,m,T,O,D]);return(0,_.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),j(null),M)try{if(i===`tensor`){let t=v(f);n({type:i,tensor:{name:e.tensor?.output.name??`tensor`,value:t}});return}if(i===`shell`){n({type:i,shell:{exit_code:o,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`mcp`){let e=v(b),t=v(S);n({type:i,mcp:{tool_name:m,...e===null?{}:{arguments:e},result:t,success:h}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:T.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:O.trim()}});return}}catch(e){j(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[A&&(0,_.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:A}),i===`shell`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,_.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:o,onChange:e=>s(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,_.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`tensor`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:`Output tensor`}),(0,_.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[e.tensor?.output.name??`tensor`,` (`,e.tensor?.output.type??`unknown`,`)`]}),e.tensor?.required_inputs?.length?(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-2`,children:[`Required inputs: `,e.tensor.required_inputs.join(`, `)]}):null]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-tensor-value`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:`Tensor value (JSON)`}),(0,_.jsx)(`textarea`,{id:`run-tensor-value`,value:f,onChange:e=>p(e.target.value),placeholder:`"example string" or ["item1", "item2"]`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`mcp`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.mcp.toolName`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:m||r(`run.mcp.toolMissing`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>y(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.mcp.success`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-mcp-args`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.arguments`)}),(0,_.jsx)(`textarea`,{id:`run-mcp-args`,value:b,onChange:e=>x(e.target.value),placeholder:`{ "example": true }`,className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-mcp-result`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.result`)}),(0,_.jsx)(`textarea`,{id:`run-mcp-result`,value:S,onChange:e=>C(e.target.value),placeholder:`{ "ok": true }`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`user_input`&&(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,_.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:w||r(`run.userInput.promptMissing`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,_.jsx)(`textarea`,{id:`run-user-confirmation`,value:T,onChange:e=>E(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:D}),` · `,r(`run.comment.count`,{count:O.length})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,_.jsx)(`textarea`,{id:`run-comment-text`,value:O,onChange:e=>k(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":O.trim().length>0&&O.trim().length<D})]})]}),(0,_.jsx)(`button`,{type:`submit`,disabled:t||!M,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function b(e){let t=e.type;if(t===`shell`){let t=e.shell?.cmd;return{type:`shell`,...t?{payload:{cmd:t}}:{}}}if(t===`mcp`){let t=e.mcp?.tool_name,n=e.mcp?.arguments,r=n!==void 0&&typeof n==`object`&&!!n&&!Array.isArray(n);return{type:`mcp`,...t||r?{payload:{...t?{tool_name:t}:{},...r?{arguments:n}:{}}}:{}}}if(t===`user_input`){let t=e.user_input?.prompt;return{type:`user_input`,...t?{payload:{prompt:t}}:{}}}if(t===`comment`){let t=e.comment?.min_length;return{type:`comment`,...t==null?{}:{payload:{min_length:t}}}}return{type:t}}function x(e,t){let n=e.history.length,r=e.status===`running`,i=!!e.current_layer,a=e.status===`ready_to_reward`||e.status===`completed`||e.status===`error`,o=a?Math.max(n,1):Math.max(n+(r&&i?1:0),+!!r)||1;return{flowSteps:Array.from({length:o},(e,n)=>({label:t(n+1)})),currentFlowIndex:r&&i?n:void 0,displayCurrent:r&&i?n+1:a?o:Math.max(n,1),displayTotal:o}}function S({run:e,rewardOutcome:t,setRewardOutcome:n,rewardFeedback:r,setRewardFeedback:i,copyStatus:o,onCopy:s,onSubmitStep:c,onReward:l,isForwardStepPending:u,isForwardStartPending:m,isRewardPending:h}){let{t:g}=a(),{flowSteps:v,currentFlowIndex:S,displayCurrent:C,displayTotal:w}=x(e,e=>g(`run.flowStepN`,{n:e})),T=b(e.contract);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`run-flow-heading`,children:[(0,_.jsx)(`h2`,{id:`run-flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.progressHeading`)}),(0,_.jsx)(p,{steps:v,currentIndex:S})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,children:[(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:g(`run.stepProgress`,{current:C,total:w})}),(0,_.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,_.jsx)(`span`,{children:g(`run.sessionBadge`)})]}),e.last_message&&(0,_.jsxs)(`div`,{className:`mb-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,role:`status`,"aria-live":`polite`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:g(`run.serverMessage`)}),(0,_.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-current-step`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.currentStepHeading`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_layer?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`mb-2 text-sm text-[var(--color-text-muted)]`,children:[g(`run.layerUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.current_layer.uri})]}),e.current_layer.content?(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none text-[var(--color-text)]`,children:(0,_.jsx)(f,{content:e.current_layer.content})}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})]}):(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:g(`run.noLayerContent`)})})]}),(0,_.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-challenge`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.challengeHeading`)}),(0,_.jsx)(d,{type:T.type,payload:T.payload}),e.contract.type===`shell`&&e.contract.shell?.cmd&&(0,_.jsxs)(`div`,{className:`mt-2`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>s(e.contract.shell.cmd),className:`min-h-[44px] min-w-[44px] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:g(`run.copyShellCommand`)}),o?(0,_.jsx)(`div`,{className:`mt-2 text-xs text-[var(--color-text-muted)]`,children:o}):null]}),(0,_.jsxs)(`details`,{className:`mt-4 text-sm`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:g(`run.advanced`)}),(0,_.jsxs)(`div`,{className:`mt-2 space-y-2 text-[var(--color-text-muted)]`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:g(`run.contractType`)}),`:`,` `,(0,_.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.contract.type})]}),e.contract.description&&(0,_.jsx)(`p`,{className:`m-0 text-sm`,children:e.contract.description}),e.contract.nonce&&(0,_.jsxs)(`div`,{children:[g(`run.nonce`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.nonce})]}),e.contract.proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.proofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.contract.proof_hash})]}),e.previous_proof_hash&&(0,_.jsxs)(`div`,{children:[g(`run.previousProofHash`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]}),e.contract.type===`tensor`&&(0,_.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,_.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:`Tensor output`}),(0,_.jsxs)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:[e.contract.tensor?.output.name??`tensor`,` (`,e.contract.tensor?.output.type??`unknown`,`)`]}),e.contract.tensor?.required_inputs?.length?(0,_.jsxs)(`div`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:[`Required inputs: `,e.contract.tensor.required_inputs.join(`, `)]}):null]})]}),e.status!==`completed`&&e.status!==`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-solution`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.solution`)}),(0,_.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,_.jsx)(y,{contract:e.contract,disabled:u||m,onSubmit:c})})]}),e.status===`ready_to_reward`&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-reward`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-reward`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.reward.title`)}),(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsx)(`div`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:g(`run.reward.subtitle`)}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap gap-4`,role:`radiogroup`,"aria-label":g(`run.reward.outcomeLabel`),children:[(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.success`)})]}),(0,_.jsxs)(`label`,{className:`inline-flex min-h-[44px] items-center gap-2`,children:[(0,_.jsx)(`input`,{type:`radio`,name:`reward-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,_.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:g(`run.reward.failure`)})]})]}),(0,_.jsxs)(`div`,{className:`mb-4`,children:[(0,_.jsx)(`label`,{htmlFor:`run-reward-feedback`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:g(`run.reward.feedback`)}),(0,_.jsx)(`textarea`,{id:`run-reward-feedback`,value:r,onChange:e=>i(e.target.value),className:`min-h-[8rem] w-full resize-y rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,_.jsx)(`button`,{type:`button`,onClick:l,disabled:h,className:`min-h-[44px] min-w-[44px] cursor-pointer rounded-[var(--radius-md)] border-0 bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-60`,children:g(h?`run.reward.submitting`:`run.reward.submit`)})]})]}),e.history.length>0&&(0,_.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,_.jsx)(`h2`,{id:`run-history`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:g(`run.history`)}),(0,_.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,"aria-label":g(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,_.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,_.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.contract.type,` ·`,` `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:e.layer.uri})]}),e.server_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text)]`,children:e.server_message})]},`${e.layer.uri}:${t}`))})]}),e.status===`completed`&&(0,_.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--status-success-bg)] p-4 text-[var(--status-success-fg)]`,children:[(0,_.jsx)(`strong`,{className:`block`,children:g(`run.completed`)}),e.last_message&&(0,_.jsx)(`div`,{className:`mt-1 text-sm`,children:e.last_message})]})]})}async function C(e){let t=await c(`/api/forward`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function w(){return n({mutationFn:e=>C(e)})}async function T(e){let t=await c(`/api/forward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function E(){return n({mutationFn:e=>T(e)})}async function D(e){let t=await c(`/api/reward`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return await t.json()}function O(){return n({mutationFn:e=>D(e)})}function k(e){if(e)return e.match(/squadrules:\/\/layer\/[0-9a-fA-F-]{36}(?:\?execution_id=[0-9a-fA-F-]{36})?/)?.[0]}function A(){return new Date().toISOString()}function j(){let{t:e}=a(),{uri:n}=r(),[o]=i(),s=n?decodeURIComponent(n):void 0,c=o.get(`session`),{session:d}=h(c),{upsert:f}=m(),p=w(),v=E(),y=O(),[b,x]=(0,g.useState)(null),[C,T]=(0,g.useState)(`success`),[D,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{d&&!b&&(x(d),T(`success`),j(``))},[d,b]);let P=e=>{x(e),f(e)},F=async()=>{if(s)try{let e=await p.mutateAsync(s),t=A(),n=`${s}:${t}`,r=e.next_action?.includes(`reward`)?`ready_to_reward`:`running`,i=k(e.next_action);P({id:n,adapter_uri:s,started_at:t,updated_at:t,status:r,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,reward_uri:r===`ready_to_reward`?i:void 0,history:[]})}catch{x(null)}};return s?(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,_.jsx)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:e(`run.guidedIntro`)}),(0,_.jsxs)(`p`,{className:`mb-4 text-sm text-[var(--color-text-muted)]`,children:[e(`run.adapterUri`),`: `,(0,_.jsx)(`span`,{className:`font-mono break-all`,children:s})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,_.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,_.jsx)(`button`,{type:`button`,onClick:F,disabled:p.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:p.isPending?e(`run.starting`):e(`run.start`)})]}),(0,_.jsx)(l,{className:`mb-6`,title:e(`run.safety.title`),children:(0,_.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})}),p.isError&&(0,_.jsx)(u,{message:p.error instanceof Error?p.error.message:String(p.error),onRetry:()=>F(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,_.jsx)(`div`,{className:`mb-6`,children:(0,_.jsx)(u,{message:b.last_message,onRetry:()=>F(),showGoBack:!0})}),b&&b.status!==`error`&&(0,_.jsx)(S,{run:b,rewardOutcome:C,setRewardOutcome:T,rewardFeedback:D,setRewardFeedback:j,copyStatus:M,onCopy:async t=>{N(null);try{await navigator.clipboard.writeText(t),N(e(`run.copied`)),setTimeout(()=>N(null),1500)}catch(e){N(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_layer)return;let t=b.contract.nonce,n=b.previous_proof_hash??b.contract.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await v.mutateAsync({uri:b.current_layer.uri,solution:r}),t=A(),n=e.next_action?.includes(`reward`)||(e.message?.toLowerCase().includes(`call reward`)??!1),i=k(e.next_action)??b.reward_uri;P({...b,updated_at:t,status:n?`ready_to_reward`:`running`,current_layer:e.current_layer??null,contract:e.contract,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,reward_uri:n?i:void 0,history:[...b.history,{layer:b.current_layer,contract:b.contract,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){P({...b,updated_at:A(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onReward:async()=>{if(!b)return;let t=b.reward_uri??b.current_layer?.uri;if(t)try{let n=await y.mutateAsync({uri:t,outcome:C,feedback:D.trim()||e(`run.reward.defaultFeedback`)});P({...b,updated_at:A(),status:`completed`,last_message:n.results[0]?.feedback??b.last_message})}catch(e){P({...b,updated_at:A(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isForwardStepPending:v.isPending,isForwardStartPending:p.isPending,isRewardPending:y.isPending})]}):(0,_.jsx)(u,{message:e(`run.missingUri`),showGoBack:!0})}export{j as RunGuidedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,y as t}from"./vendor-DGTQ2S8W.js";import{t as n}from"./react-CR5VJ85Q.js";import{n as r}from"./useRunSession-
|
|
1
|
+
import{a as e,y as t}from"./vendor-DGTQ2S8W.js";import{t as n}from"./react-CR5VJ85Q.js";import{n as r}from"./useRunSession-BX2U9D53.js";var i=n();function a(){let{t:n}=t(),{sessions:a,remove:o}=r();return(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:n(`runs.title`)}),(0,i.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:n(`runs.subtitle`)}),a.length===0?(0,i.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:(0,i.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:n(`runs.empty`)})}):(0,i.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-3`,"aria-label":n(`runs.listLabel`),children:a.map(t=>(0,i.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[(0,i.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] truncate`,children:t.adapter_uri}),(0,i.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n(`runs.status`),`: `,t.status,` · `,n(`runs.updated`),`: `,new Date(t.updated_at).toLocaleString(),` · `,n(`runs.stepsDone`,{count:t.history.length})]}),t.last_message&&(0,i.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:t.last_message})]}),(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-2 flex-shrink-0`,children:[(0,i.jsx)(e,{to:`/protocols/${encodeURIComponent(t.adapter_uri)}/run?session=${encodeURIComponent(t.id)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.resume`)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(t.id),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.remove`)})]})]},t.id))})]})}export{a as RunsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,m as n,y as r}from"./vendor-DGTQ2S8W.js";import{i,t as a}from"./react-CR5VJ85Q.js";import{t as o}from"./SurfaceCard-CRidnDLP.js";import{a as s,n as c,r as l,s as u,t as d}from"./export-skill-zip-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,m as n,y as r}from"./vendor-DGTQ2S8W.js";import{i,t as a}from"./react-CR5VJ85Q.js";import{t as o}from"./SurfaceCard-CRidnDLP.js";import{a as s,n as c,r as l,s as u,t as d}from"./export-skill-zip-C1bRyhE2.js";import{t as f}from"./RichTextEditor-Bj6JxHM5.js";var p=e(i(),1),m=a();function h(e){return`min-h-[44px] rounded-full px-4 text-sm font-medium ${e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`}function g(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:g,isError:_,error:v}=u(i?decodeURIComponent(i):void 0,!0),[y,b]=(0,p.useState)(``),[x,S]=(0,p.useState)(``),[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(!0),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(null);if(g&&!a)return(0,m.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(_||!a)return(0,m.jsxs)(`div`,{role:`alert`,className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,children:[v instanceof Error?v.message:e(`protocol.notFound`),(0,m.jsx)(t,{to:`/`,className:`mt-2 block text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:j}=s(a.content),M=(y.trim()||j).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`skill`,N=`${M}-skill`,P=async()=>{A(null),O(!0);try{let{blob:e,skill_bundle_manifest:t}=await d(a.uri),n=c(t,M);l(e,n)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}};return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(`skill.title`)}),(0,m.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`skill.subtitle`)}),(0,m.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.3fr_1fr]`,children:[(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`skill-name`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.skillName`)}),(0,m.jsx)(`input`,{id:`skill-name`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:j,className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,m.jsx)(f,{label:e(`skill.description`),hint:e(`skill.descriptionHint`),value:x,onChange:S,contentKey:`skill-desc`}),(0,m.jsx)(f,{label:e(`skill.whenToUse`),value:C,onChange:w,contentKey:`skill-when`}),(0,m.jsx)(o,{title:e(`skill.bundleContentsTitle`),subtitle:e(`skill.bundleContentsSubtitle`),children:(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,"aria-pressed":T,onClick:()=>E(e=>!e),className:h(T),children:e(`skill.includeReferences`)}),(0,m.jsx)(`button`,{type:`button`,disabled:!0,className:`${h(!1)} cursor-not-allowed opacity-50`,title:e(`skill.comingSoon`),children:e(`skill.chipReadme`)}),(0,m.jsx)(`button`,{type:`button`,disabled:!0,className:`${h(!1)} cursor-not-allowed opacity-50`,title:e(`skill.comingSoon`),children:e(`skill.chipPrompts`)})]})}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>void P(),disabled:D,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(`skill.downloadAsSkill`)}),k?(0,m.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-error)]`,role:`alert`,children:k}):null,(0,m.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.backToProtocol`)})]})]}),(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsx)(o,{title:e(`skill.bundlePreviewTitle`),subtitle:e(`skill.bundlePreviewSubtitle`),children:(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4 font-mono text-sm text-[var(--color-text)]`,children:[N,`.zip`,(0,m.jsx)(`br`,{}),`└── `,N,`/`,(0,m.jsx)(`br`,{}),`\xA0\xA0\xA0\xA0├── Skill.md`,(0,m.jsx)(`br`,{}),T?(0,m.jsxs)(m.Fragment,{children:[`\xA0\xA0\xA0\xA0└── references/`,(0,m.jsx)(`br`,{}),`\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0└── SQUADRULES.md`]}):(0,m.jsx)(m.Fragment,{children:`\xA0\xA0\xA0\xA0└── (no references/)`})]})}),(0,m.jsx)(o,{title:e(`skill.whyExportTitle`),subtitle:e(`skill.whyExportSubtitle`),children:(0,m.jsx)(`p`,{className:`m-0 text-sm text-[var(--color-text-muted)]`,children:e(`skill.whyExportBody`)})})]})]})]})}export{g as SkillBundlePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,g as n,s as r,y as i}from"./vendor-DGTQ2S8W.js";import{i as a,t as o}from"./react-CR5VJ85Q.js";import{t as s}from"./api-BgTb-tmJ.js";import{n as c,r as l,t as u}from"./SpaceSelect-DDhPkDXU.js";import{t as d}from"./ErrorAlert-BQMph5Nh.js";var f=e(a(),1);async function p(e,t){let n={query:e.trim()},r=t?.space?.trim();r&&(n.space=r),t?.max_choices!=null&&(n.max_choices=t.max_choices);let i=await s(`/api/activate`,{method:`POST`,body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}return await i.json()}function m(e,t,n){let r=e.trim();return{queryKey:[`activate`,r,(n?.space?.trim()??``)||null,n?.max_choices??null],queryFn:()=>p(r,n),enabled:t&&r.length>0}}function h(e,t,r){return n(m(e,t,r))}var g=o();function _(){return(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,g.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex justify-between items-start gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,g.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,g.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}function v(e){return typeof e!=`number`||Number.isNaN(e)?0:Math.round(Math.max(0,Math.min(e,1))*100)}var y=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``);function b(e){let t=[];for(let n of e??[])for(let e of n.adapters??[])t.push({adapter_id:e.adapter_id,title:e.title,layer_count:e.layer_count,slug:e.slug,uri:e.uri,space_name:n.name,space_type:n.type});let n=new Map,r=[];for(let e of t){let t=(e.adapter_id??``).trim();if(!t){r.push(e);continue}let i=n.get(t);i?(e.layer_count??0)>(i.layer_count??0)&&n.set(t,e):n.set(t,e)}let i=[...n.values(),...r],a={};for(let e of y)a[e]=0;for(let e of i){let t=(e.title??``).trim().charAt(0).toUpperCase();y.includes(t)&&(a[t]=(a[t]??0)+1)}return{browseAdapters:i,countsByLetter:a}}function x(e){let{t:n,spacesLoading:r,browseAdapters:i,countsByLetter:a}=e,[o,s]=(0,f.useState)(null),l=(0,f.useMemo)(()=>o?i.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===o).sort((e,t)=>(e.title??``).localeCompare(t.title??``,void 0,{sensitivity:`base`})):[],[i,o]),u=i.length>0;return(0,g.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,g.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`squadrules.browseByLabel`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:n(`squadrules.browseByLetterHint`)}),!r&&!u?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`squadrules.browseEmpty`)}):null,!r&&u?(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":n(`squadrules.browseByLabel`),children:y.map(e=>{let t=a[e]??0;return(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(t=>t===e?null:e),"aria-expanded":o===e,"aria-controls":`browse-letter-panel-${e}`,"aria-pressed":o===e,"aria-label":n(`squadrules.letterCount`,{letter:e,count:t}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center rounded-[var(--radius-md)] border px-3 py-2 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 ${o===e?`border-[var(--color-primary)] bg-[var(--color-surface-elevated)] text-[var(--color-primary)]`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`}`,children:[e,`: `,t]},e)})}):null,o&&!r&&u?(0,g.jsxs)(`div`,{id:`browse-letter-panel-${o}`,role:`region`,"aria-labelledby":`browse-letter-panel-heading`,"aria-live":`polite`,className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,g.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`squadrules.labelsStartingWith`,{letter:o})}),l.length===0?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`squadrules.noLabelsForLetter`)}):(0,g.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,role:`list`,"aria-label":n(`squadrules.labelsStartingWith`,{letter:o}),children:l.map(e=>(0,g.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.title}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(c,{type:e.space_type}),(0,g.jsx)(`span`,{className:`text-xs text-[var(--color-text-muted)]`,children:e.space_name})]})]}),(0,g.jsx)(`div`,{className:`flex-shrink-0`,children:(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.uri)}`,"aria-label":n(`squadrules.viewProtocol`,{title:e.title}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`squadrules.view`)})})]},e.adapter_id))})]}):null]})}function S(e){let{t:n,choices:r,topScore:i,roleBadgeClass:a}=e;return(0,g.jsxs)(g.Fragment,{children:[r.length>0&&(0,g.jsx)(`p`,{id:`squadrules-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:n(`squadrules.foundMatches`,{count:r.length,top:i==null?0:Math.round(i)})}),(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":n(`squadrules.resultsLabel`),children:r.map(e=>(0,g.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 flex justify-between items-start gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:e.label}),(0,g.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[e.adapter_name??(e.role===`refine`?n(`squadrules.refineMeta`):e.role===`create`?n(`squadrules.createMeta`):``),e.role===`match`&&e.space_name!=null&&e.space_name.length>0&&(0,g.jsxs)(g.Fragment,{children:[` `,`· `,n(`squadrules.spaceLabel`),`: `,e.space_name]}),e.activation_score!=null&&` · ${n(`squadrules.score`)}: ${v(e.activation_score)}%`,e.adapter_version&&` · ${n(`squadrules.version`)}: ${e.adapter_version}`]}),(0,g.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${a[e.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${e.role}`,children:e.role}),e.tags?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":n(`squadrules.tagsLabel`),children:e.tags.slice(0,8).map(e=>(0,g.jsx)(`span`,{className:`inline-block text-xs px-2 py-0.5 rounded bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-muted)]`,children:e},e))})]}),(0,g.jsxs)(`div`,{className:`flex-shrink-0`,children:[e.role===`match`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.uri)}`,"aria-label":n(`squadrules.viewProtocol`,{title:e.label}),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`squadrules.view`)}),e.role===`refine`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`squadrules.refineSearch`)}),e.role===`create`&&(0,g.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`squadrules.createNew`)})]})]},e.uri))})]})}var C={match:`bg-[var(--badge-match-bg)] text-[var(--badge-match-fg)]`,refine:`bg-[var(--badge-refine-bg)] text-[var(--badge-refine-fg)]`,create:`bg-[var(--badge-create-bg)] text-[var(--badge-create-fg)]`};function w(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,s=n.get(`space`)??``,[c,p]=(0,f.useState)(o),[m,y]=(0,f.useState)(o),[w,T]=(0,f.useState)(s),[E,D]=(0,f.useState)(s),O=E.trim(),{data:k,isLoading:A,isError:j,error:M,refetch:N}=h(m,!!m,{...O?{space:O}:{}}),P=!m,{data:F,isLoading:I,isError:L,error:R,refetch:z}=l(!0,{includeAdapterTitles:P});(0,f.useEffect)(()=>{let e=n.get(`q`)??``,t=n.get(`space`)??``;p(e),y(e),T(t),D(t)},[n]);let B=e=>{e.preventDefault(),y(c),D(w);let t={};c.trim()&&(t.q=c.trim()),w.trim()&&(t.space=w.trim()),a(t,{replace:!0})},V=k?.choices??[],H={match:0,refine:1,create:2},U=V.slice().sort((e,t)=>{let n=(H[e.role]??99)-(H[t.role]??99);if(n!==0)return n;let r=e.activation_score??-1;return(t.activation_score??-1)-r}),W=U.length>0?Math.max(...U.map(e=>v(e.activation_score))):null,{browseAdapters:G,countsByLetter:K}=(0,f.useMemo)(()=>b(F?.spaces),[F?.spaces]);return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`squadrules.title`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:e(`squadrules.searchHint`)}),(0,g.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,g.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`squadrules.searchLabel`)}),(0,g.jsxs)(`form`,{onSubmit:B,"aria-label":e(`squadrules.searchLabel`),children:[(0,g.jsx)(`label`,{htmlFor:`squadrules-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`squadrules.searchLabel`)}),(0,g.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end mb-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`input`,{id:`squadrules-search-query`,type:`search`,value:c,onChange:e=>p(e.target.value),placeholder:e(`squadrules.searchPlaceholder`),"aria-describedby":`squadrules-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,g.jsx)(`p`,{id:`squadrules-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`squadrules.searchHintShort`)})]}),(0,g.jsx)(`div`,{className:`flex md:pb-0 pb-0`,children:(0,g.jsx)(`button`,{type:`submit`,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`squadrules.search`)})})]}),(0,g.jsxs)(`div`,{className:`max-w-md mb-6`,children:[(0,g.jsx)(`label`,{htmlFor:`squadrules-activate-space`,className:`block text-sm font-medium text-[var(--color-text-heading)] mb-2`,children:e(`squadrules.scopeSpaceLabel`)}),(0,g.jsx)(u,{id:`squadrules-activate-space`,spaces:F?.spaces,value:w,onChange:T,includeAllOption:!0,disabled:I,"aria-describedby":`squadrules-search-hint`})]})]})]}),j&&(0,g.jsx)(d,{message:M instanceof Error?M.message:String(M),onRetry:()=>N(),showGoBack:!0}),P&&L&&(0,g.jsx)(d,{message:R instanceof Error?R.message:String(R),onRetry:()=>z(),showGoBack:!0}),A&&m&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`squadrules.loading`)}),(0,g.jsx)(_,{})]}),P&&I&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`squadrules.loading`)}),(0,g.jsx)(_,{})]}),!A&&!j&&!(P&&L)&&(0,g.jsx)(g.Fragment,{children:m?U.length===0?(0,g.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,role:`status`,"aria-live":`polite`,children:[(0,g.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`squadrules.empty`)}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.jsx)(t,{to:`/squadrules`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`squadrules.refineSearch`)}),(0,g.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`squadrules.createNew`)})]})]}):m?(0,g.jsx)(S,{t:e,choices:U,topScore:W,roleBadgeClass:C}):null:(0,g.jsx)(x,{t:e,spacesLoading:I,browseAdapters:G,countsByLetter:K})})]})}export{w as SquadrulesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{g as e}from"./vendor-DGTQ2S8W.js";import{t}from"./api-BgTb-tmJ.js";async function n(e){let n=await t(`/api/export`,{method:`POST`,body:JSON.stringify({uri:e,format:`markdown`})});if(!n.ok){let e=(await n.json().catch(()=>({}))).message??n.statusText,t=Error(e);throw t.statusCode=n.status,t}let r=await n.json();return{content:r.content,uri:r.uri,label:r.adapter_name??`Adapter`,adapter_name:r.adapter_name??null,...r.adapter_version?{protocol_version:r.adapter_version}:{},...r.space_id!==void 0&&{space_id:r.space_id},...r.space_name!==void 0&&{space_name:r.space_name},...r.space_type!==void 0&&{space_type:r.space_type}}}function r(t,r){return e({queryKey:[`protocol`,t],queryFn:()=>n(t),enabled:!!(t&&r)})}function i(e){let t=e.split(`
|
|
2
2
|
`),n=`Protocol`,r=[],i=``,a=``,o=t.find(e=>e.startsWith(`# `));o&&(n=o.replace(/^#\s+/,``).trim());let s=e.split(/\n##\s+/);for(let e=1;e<s.length;e++){let t=s[e],n=t.split(`
|
|
3
3
|
`)[0]??``,o=n.trim(),c=t.slice(n.length).replace(/^\n+/,``).trim();if(o.toLowerCase().includes(`activation pattern`)||o.toLowerCase().includes(`natural language trigger`))i=c.replace(/\n```json[\s\S]*?```/g,``).trim();else if(o.toLowerCase().includes(`reward signal`)||o.toLowerCase().includes(`completion rule`))a=c.replace(/\n```json[\s\S]*?```/g,``).trim();else{let e=c.match(/```json\s*([\s\S]*?)```/),t=`comment`,n=`Comment`,i;if(e)try{let r=JSON.parse(e[1].trim()),a=r?.contract??r?.challenge??r;if(a?.type&&(t=String(a.type)),t===`shell`){let e=a?.shell?.cmd??a?.cmd,t=a?.shell?.interpreter;n=e?t?`Shell (${t}): ${String(e).slice(0,60)}${String(e).length>60?`…`:``}`:`Shell: ${String(e).slice(0,80)}${String(e).length>80?`…`:``}`:`Shell`,e&&(i={cmd:String(e)})}else if(t===`mcp`){let e=a?.mcp?.tool_name;n=e?`MCP: ${String(e)}`:`MCP`,e&&(i={tool_name:String(e)})}else if(t===`user_input`){let e=a?.user_input?.prompt;n=e?`User input: ${String(e)}`:`User input`,e&&(i={prompt:String(e)})}else if(t===`tensor`){let e=a?.tensor?.output?.name,t=a?.tensor?.output?.type;n=e?`Tensor: ${String(e)}${t?` (${String(t)})`:``}`:`Tensor`}else if(t===`comment`){let e=a?.comment?.min_length;n=e?`Comment: min ${Number(e)} chars`:`Comment`,e!=null&&!Number.isNaN(Number(e))&&(i={min_length:Number(e)})}else n=String(t)}catch{}n||=String(t),r.push({label:o,type:t,summary:n,body:c,challengePayload:i})}}return{title:n,steps:r,triggers:i,completion:a}}function a(e){let{title:t,steps:n,triggers:r,completion:a}=i(e);return{protocolLabel:t,triggersMarkdown:r,steps:n.map(e=>{let t=e.body.replace(/\n```json\s*[\s\S]*?```\s*$/g,``).trim(),n=`comment`,r={label:e.label,bodyMarkdown:t,type:n},i=e.body.match(/```json\s*([\s\S]*?)```/);if(i)try{let e=JSON.parse(i[1].trim()),t=e?.contract??e?.challenge??e;if(t?.type&&[`shell`,`mcp`,`user_input`,`comment`].includes(String(t.type))&&(n=t.type,r.type=n),n===`shell`){let e=t?.shell;r.shell={cmd:String(e?.cmd??t?.cmd??``).trim(),timeout_seconds:Number(e?.timeout_seconds??30),interpreter:typeof e?.interpreter==`string`?e.interpreter:void 0,workdir:typeof e?.workdir==`string`?e.workdir:void 0,flags:Array.isArray(e?.flags)?e.flags.map(String):[],args:Array.isArray(e?.args)?e.args.map(String):[]}}else n===`mcp`?r.mcp={tool_name:String(t?.mcp?.tool_name??``).trim()}:n===`user_input`?r.user_input={prompt:String(t?.user_input?.prompt??``).trim()}:n===`comment`&&(r.comment={min_length:Number(t?.comment?.min_length??10)})}catch{}return r}),completionMarkdown:a}}function o(e){let t=[];t.push(`# ${e.protocolLabel.trim()||`Protocol`}`),t.push(``),t.push(`## Activation Patterns`),t.push(``),t.push(e.triggersMarkdown.trim()||`Describe when this protocol should run.`),t.push(``);for(let n of e.steps){t.push(`## ${n.label.trim()||`Step`}`),t.push(``),t.push(n.bodyMarkdown.trim()||`Step content.`);let e={type:n.type};if(n.type===`shell`){let t={cmd:n.shell?.cmd??``,timeout_seconds:n.shell?.timeout_seconds??30},r=n.shell?.interpreter?.trim();r&&(t.interpreter=r);let i=n.shell?.workdir?.trim();i&&(t.workdir=i),n.shell?.flags?.length&&(t.flags=n.shell.flags),n.shell?.args?.length&&(t.args=n.shell.args),e.shell=t}else n.type===`mcp`?e.mcp={tool_name:n.mcp?.tool_name??``}:n.type===`user_input`?e.user_input={prompt:n.user_input?.prompt??``}:n.type===`comment`&&(e.comment={min_length:n.comment?.min_length??10});t.push(``),t.push("```json"),t.push(JSON.stringify({contract:e},null,2)),t.push("```"),t.push(``)}return t.push(`## Reward Signal`),t.push(``),t.push(e.completionMarkdown.trim()||`Describe how this adapter should be rewarded when it completes.`),t.join(`
|
|
4
|
-
`)}async function s(e){let n=await t(`/api/export`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({uri:e,format:`skill_zip`})});if(!n.ok){let e=(await n.json().catch(()=>({}))).message??n.statusText;throw Error(e)}let r=await n.json();if(r.format===`skill_zip`&&r.download_ref?.url){let e=await fetch(r.download_ref.url,{credentials:`same-origin`});if(!e.ok)throw Error(`Download failed: ${e.statusText}`);return{blob:await e.blob(),skill_bundle_manifest:r.skill_bundle_manifest}}if(r.format!==`skill_zip`||r.content_encoding!==`base64`)throw Error(`Expected a skill_zip export with download_ref or base64-encoded content.`);return{blob:c(r.content,r.content_type||`application/zip`),skill_bundle_manifest:r.skill_bundle_manifest}}function c(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}function l(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function u(e,t){try{if(e){let t=JSON.parse(e).skills?.[0]?.slug;if(t&&t.length>0)return`${t}-
|
|
4
|
+
`)}async function s(e){let n=await t(`/api/export`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({uri:e,format:`skill_zip`})});if(!n.ok){let e=(await n.json().catch(()=>({}))).message??n.statusText;throw Error(e)}let r=await n.json();if(r.format===`skill_zip`&&r.download_ref?.url){let e=await fetch(r.download_ref.url,{credentials:`same-origin`});if(!e.ok)throw Error(`Download failed: ${e.statusText}`);return{blob:await e.blob(),skill_bundle_manifest:r.skill_bundle_manifest}}if(r.format!==`skill_zip`||r.content_encoding!==`base64`)throw Error(`Expected a skill_zip export with download_ref or base64-encoded content.`);return{blob:c(r.content,r.content_type||`application/zip`),skill_bundle_manifest:r.skill_bundle_manifest}}function c(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}function l(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function u(e,t){try{if(e){let t=JSON.parse(e).skills?.[0]?.slug;if(t&&t.length>0)return`${t}-squadrules-skill.zip`}}catch{}return`${t.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`squadrules-skill`}-squadrules-skill.zip`}export{i as a,o as i,u as n,a as o,l as r,r as s,s as t};
|