@coro-ai/runner 0.1.32 → 0.1.34
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/dashboard-dist/assets/{index--JceWwKS.js → index-C7l2FOsX.js} +9 -3
- package/dashboard-dist/index.html +1 -1
- package/dist/src/clients/tracker/jira.js +6 -0
- package/dist/src/clients/tracker/jira.js.map +1 -1
- package/dist/src/clients/tracker/linear.js +6 -2
- package/dist/src/clients/tracker/linear.js.map +1 -1
- package/dist/src/clients/tracker/types.d.ts +11 -0
- package/dist/src/config/local-config.d.ts +3 -0
- package/dist/src/config/local-config.js +2 -0
- package/dist/src/config/local-config.js.map +1 -1
- package/dist/src/intake/handler.js +27 -9
- package/dist/src/intake/handler.js.map +1 -1
- package/dist/src/intake/system-prompt.d.ts +1 -0
- package/dist/src/intake/system-prompt.js +8 -1
- package/dist/src/intake/system-prompt.js.map +1 -1
- package/dist/src/intake/tools.js +5 -0
- package/dist/src/intake/tools.js.map +1 -1
- package/dist/src/jobs/runner.d.ts +6 -0
- package/dist/src/jobs/runner.js +7 -0
- package/dist/src/jobs/runner.js.map +1 -1
- package/dist/src/mcp-handlers.d.ts +1 -0
- package/dist/src/mcp-handlers.js +6 -2
- package/dist/src/mcp-handlers.js.map +1 -1
- package/dist/src/mcp-server.js +6 -1
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/plugins/builtin/github-tracker/intelligence/snippets/github-issues-keys.md +4 -1
- package/dist/src/plugins/builtin/jira/index.js +12 -0
- package/dist/src/plugins/builtin/jira/index.js.map +1 -1
- package/dist/src/plugins/builtin/jira/intelligence/snippets/jira-transitions.md +6 -1
- package/dist/src/plugins/builtin/linear/index.js +12 -0
- package/dist/src/plugins/builtin/linear/index.js.map +1 -1
- package/dist/src/plugins/builtin/linear/intelligence/snippets/linear-keys.md +6 -2
- package/dist/src/plugins/types.d.ts +12 -0
- package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
- package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.d.ts +2 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.js +25 -46
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts +7 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +76 -6
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js +3 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js +2 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.d.ts +3 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.js +5 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/login.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts +2 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js +8 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
- package/node_modules/@coro-ai/llm-openai/README.md +3 -3
- package/node_modules/@coro-ai/llm-openai/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.js +129 -87
- package/node_modules/@coro-ai/llm-openai/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.js +24 -0
- package/node_modules/@coro-ai/llm-openai/dist/models.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/package.json +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts +30 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts.map +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js +85 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js.map +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.d.ts +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/index.js +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.js.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts +20 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/body-parser/HISTORY.md +7 -1
- package/node_modules/body-parser/lib/types/json.js +7 -3
- package/node_modules/body-parser/lib/types/raw.js +7 -3
- package/node_modules/body-parser/lib/types/text.js +7 -3
- package/node_modules/body-parser/lib/types/urlencoded.js +7 -3
- package/node_modules/body-parser/package.json +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +69 -5
- package/node_modules/express-rate-limit/dist/index.d.cts +18 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +18 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +18 -0
- package/node_modules/express-rate-limit/dist/index.mjs +55 -5
- package/node_modules/express-rate-limit/node_modules/debug/LICENSE +20 -0
- package/node_modules/express-rate-limit/node_modules/debug/README.md +481 -0
- package/node_modules/express-rate-limit/node_modules/debug/package.json +64 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/browser.js +272 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/common.js +292 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/index.js +10 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/node.js +263 -0
- package/node_modules/express-rate-limit/node_modules/ms/index.js +162 -0
- package/node_modules/express-rate-limit/node_modules/ms/license.md +21 -0
- package/node_modules/express-rate-limit/node_modules/ms/package.json +38 -0
- package/node_modules/express-rate-limit/node_modules/ms/readme.md +59 -0
- package/node_modules/express-rate-limit/package.json +11 -8
- package/node_modules/express-rate-limit/readme.md +2 -2
- package/node_modules/fast-copy/README.md +46 -46
- package/node_modules/fast-copy/dist/cjs/index.cjs +13 -19
- package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
- package/node_modules/fast-copy/dist/cjs/index.d.cts +40 -6
- package/node_modules/fast-copy/dist/es/index.d.mts +40 -6
- package/node_modules/fast-copy/dist/es/index.mjs +13 -19
- package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
- package/node_modules/fast-copy/dist/umd/index.d.ts +40 -6
- package/node_modules/fast-copy/dist/umd/index.js +13 -19
- package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
- package/node_modules/fast-copy/index.d.ts +22 -22
- package/node_modules/fast-copy/package.json +30 -23
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +11 -22
- package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +11 -22
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/client/client.js +10 -1
- package/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
- package/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
- package/node_modules/hono/dist/cjs/jsx/base.js +8 -14
- package/node_modules/hono/dist/cjs/jsx/components.js +41 -21
- package/node_modules/hono/dist/cjs/jsx/context.js +131 -5
- package/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/hono/dist/client/client.js +10 -1
- package/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -1
- package/node_modules/hono/dist/helper/css/index.js +9 -1
- package/node_modules/hono/dist/jsx/base.js +15 -15
- package/node_modules/hono/dist/jsx/components.js +42 -22
- package/node_modules/hono/dist/jsx/context.js +129 -5
- package/node_modules/hono/dist/jsx/streaming.js +10 -8
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
- package/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
- package/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
- package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
- package/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/hono/package.json +11 -10
- package/node_modules/js-yaml/README.md +5 -3
- package/node_modules/js-yaml/dist/js-yaml.js +3009 -2402
- package/node_modules/js-yaml/dist/js-yaml.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.min.js +2 -33
- package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.mjs +3073 -2381
- package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
- package/node_modules/js-yaml/lib/loader.js +7 -11
- package/node_modules/js-yaml/lib/type/float.js +1 -1
- package/node_modules/js-yaml/lib/type/int.js +4 -4
- package/node_modules/js-yaml/package.json +10 -4
- package/node_modules/node-abi/abi_registry.json +8 -1
- package/node_modules/node-abi/package.json +1 -1
- package/node_modules/openai/CHANGELOG.md +117 -0
- package/node_modules/openai/README.md +94 -104
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js +41 -15
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs +41 -15
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.js +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.mjs +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.d.mts.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.d.ts.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.js +12 -4
- package/node_modules/openai/auth/workload-identity-auth.js.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.mjs +13 -5
- package/node_modules/openai/auth/workload-identity-auth.mjs.map +1 -1
- package/node_modules/openai/azure.d.mts +3 -1
- package/node_modules/openai/azure.d.mts.map +1 -1
- package/node_modules/openai/azure.d.ts +3 -1
- package/node_modules/openai/azure.d.ts.map +1 -1
- package/node_modules/openai/azure.js.map +1 -1
- package/node_modules/openai/azure.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.d.mts +14 -1
- package/node_modules/openai/beta/realtime/internal-base.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.d.ts +14 -1
- package/node_modules/openai/beta/realtime/internal-base.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.js +21 -5
- package/node_modules/openai/beta/realtime/internal-base.js.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.mjs +21 -5
- package/node_modules/openai/beta/realtime/internal-base.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.d.mts +3 -5
- package/node_modules/openai/beta/realtime/websocket.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.d.ts +3 -5
- package/node_modules/openai/beta/realtime/websocket.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.js +2 -3
- package/node_modules/openai/beta/realtime/websocket.js.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.mjs +3 -4
- package/node_modules/openai/beta/realtime/websocket.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/ws.d.mts +3 -5
- package/node_modules/openai/beta/realtime/ws.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/ws.d.ts +3 -5
- package/node_modules/openai/beta/realtime/ws.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/ws.js +2 -3
- package/node_modules/openai/beta/realtime/ws.js.map +1 -1
- package/node_modules/openai/beta/realtime/ws.mjs +3 -4
- package/node_modules/openai/beta/realtime/ws.mjs.map +1 -1
- package/node_modules/openai/client.d.mts +10 -1
- package/node_modules/openai/client.d.mts.map +1 -1
- package/node_modules/openai/client.d.ts +10 -1
- package/node_modules/openai/client.d.ts.map +1 -1
- package/node_modules/openai/client.js +67 -14
- package/node_modules/openai/client.js.map +1 -1
- package/node_modules/openai/client.mjs +67 -14
- package/node_modules/openai/client.mjs.map +1 -1
- package/node_modules/openai/core/streaming.d.mts.map +1 -1
- package/node_modules/openai/core/streaming.d.ts.map +1 -1
- package/node_modules/openai/core/streaming.js +38 -6
- package/node_modules/openai/core/streaming.js.map +1 -1
- package/node_modules/openai/core/streaming.mjs +38 -6
- package/node_modules/openai/core/streaming.mjs.map +1 -1
- package/node_modules/openai/core/uploads.d.mts +1 -1
- package/node_modules/openai/core/uploads.d.mts.map +1 -1
- package/node_modules/openai/core/uploads.d.ts +1 -1
- package/node_modules/openai/core/uploads.d.ts.map +1 -1
- package/node_modules/openai/core/uploads.js +3 -1
- package/node_modules/openai/core/uploads.js.map +1 -1
- package/node_modules/openai/core/uploads.mjs +1 -0
- package/node_modules/openai/core/uploads.mjs.map +1 -1
- package/node_modules/openai/helpers/audio.d.mts.map +1 -1
- package/node_modules/openai/helpers/audio.d.ts.map +1 -1
- package/node_modules/openai/helpers/audio.js +16 -3
- package/node_modules/openai/helpers/audio.js.map +1 -1
- package/node_modules/openai/helpers/audio.mjs +17 -4
- package/node_modules/openai/helpers/audio.mjs.map +1 -1
- package/node_modules/openai/helpers/zod.d.mts +20 -7
- package/node_modules/openai/helpers/zod.d.mts.map +1 -1
- package/node_modules/openai/helpers/zod.d.ts +20 -7
- package/node_modules/openai/helpers/zod.d.ts.map +1 -1
- package/node_modules/openai/helpers/zod.js +36 -12
- package/node_modules/openai/helpers/zod.js.map +1 -1
- package/node_modules/openai/helpers/zod.mjs +36 -12
- package/node_modules/openai/helpers/zod.mjs.map +1 -1
- package/node_modules/openai/index.d.mts +1 -1
- package/node_modules/openai/index.d.mts.map +1 -1
- package/node_modules/openai/index.d.ts +1 -1
- package/node_modules/openai/index.d.ts.map +1 -1
- package/node_modules/openai/index.js +2 -1
- package/node_modules/openai/index.js.map +1 -1
- package/node_modules/openai/index.mjs +1 -1
- package/node_modules/openai/index.mjs.map +1 -1
- package/node_modules/openai/internal/bedrock.d.mts +34 -0
- package/node_modules/openai/internal/bedrock.d.mts.map +1 -0
- package/node_modules/openai/internal/bedrock.d.ts +34 -0
- package/node_modules/openai/internal/bedrock.d.ts.map +1 -0
- package/node_modules/openai/internal/bedrock.js +107 -0
- package/node_modules/openai/internal/bedrock.js.map +1 -0
- package/node_modules/openai/internal/bedrock.mjs +99 -0
- package/node_modules/openai/internal/bedrock.mjs.map +1 -0
- package/node_modules/openai/internal/headers.d.mts.map +1 -1
- package/node_modules/openai/internal/headers.d.ts.map +1 -1
- package/node_modules/openai/internal/headers.js +7 -3
- package/node_modules/openai/internal/headers.js.map +1 -1
- package/node_modules/openai/internal/headers.mjs +7 -3
- package/node_modules/openai/internal/headers.mjs.map +1 -1
- package/node_modules/openai/internal/provider.d.mts +23 -0
- package/node_modules/openai/internal/provider.d.mts.map +1 -0
- package/node_modules/openai/internal/provider.d.ts +23 -0
- package/node_modules/openai/internal/provider.d.ts.map +1 -0
- package/node_modules/openai/internal/provider.js +36 -0
- package/node_modules/openai/internal/provider.js.map +1 -0
- package/node_modules/openai/internal/provider.mjs +32 -0
- package/node_modules/openai/internal/provider.mjs.map +1 -0
- package/node_modules/openai/internal/uploads.d.mts +26 -1
- package/node_modules/openai/internal/uploads.d.mts.map +1 -1
- package/node_modules/openai/internal/uploads.d.ts +26 -1
- package/node_modules/openai/internal/uploads.d.ts.map +1 -1
- package/node_modules/openai/internal/uploads.js +169 -1
- package/node_modules/openai/internal/uploads.js.map +1 -1
- package/node_modules/openai/internal/uploads.mjs +169 -2
- package/node_modules/openai/internal/uploads.mjs.map +1 -1
- package/node_modules/openai/internal/utils/log.d.mts.map +1 -1
- package/node_modules/openai/internal/utils/log.d.ts.map +1 -1
- package/node_modules/openai/internal/utils/log.js +1 -0
- package/node_modules/openai/internal/utils/log.js.map +1 -1
- package/node_modules/openai/internal/utils/log.mjs +1 -0
- package/node_modules/openai/internal/utils/log.mjs.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts +15 -4
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts +15 -4
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js +79 -41
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +79 -41
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/lib/AssistantStream.d.mts.map +1 -1
- package/node_modules/openai/lib/AssistantStream.d.ts.map +1 -1
- package/node_modules/openai/lib/AssistantStream.js +8 -27
- package/node_modules/openai/lib/AssistantStream.js.map +1 -1
- package/node_modules/openai/lib/AssistantStream.mjs +8 -27
- package/node_modules/openai/lib/AssistantStream.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.d.mts +26 -2
- package/node_modules/openai/lib/ChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.d.ts +26 -2
- package/node_modules/openai/lib/ChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.js +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.mjs +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts +14 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts +14 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.js +79 -29
- package/node_modules/openai/lib/ChatCompletionStream.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.mjs +78 -29
- package/node_modules/openai/lib/ChatCompletionStream.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts +25 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts +25 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.js +78 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +79 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs.map +1 -1
- package/node_modules/openai/lib/EventEmitter.d.mts.map +1 -1
- package/node_modules/openai/lib/EventEmitter.d.ts.map +1 -1
- package/node_modules/openai/lib/EventEmitter.js +12 -2
- package/node_modules/openai/lib/EventEmitter.js.map +1 -1
- package/node_modules/openai/lib/EventEmitter.mjs +12 -2
- package/node_modules/openai/lib/EventEmitter.mjs.map +1 -1
- package/node_modules/openai/lib/EventStream.d.mts +14 -0
- package/node_modules/openai/lib/EventStream.d.mts.map +1 -1
- package/node_modules/openai/lib/EventStream.d.ts +14 -0
- package/node_modules/openai/lib/EventStream.d.ts.map +1 -1
- package/node_modules/openai/lib/EventStream.js +126 -4
- package/node_modules/openai/lib/EventStream.js.map +1 -1
- package/node_modules/openai/lib/EventStream.mjs +126 -4
- package/node_modules/openai/lib/EventStream.mjs.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.mts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.ts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.js +12 -4
- package/node_modules/openai/lib/ResponsesParser.js.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.mjs +12 -4
- package/node_modules/openai/lib/ResponsesParser.mjs.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.d.mts +38 -21
- package/node_modules/openai/lib/RunnableFunction.d.mts.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.d.ts +38 -21
- package/node_modules/openai/lib/RunnableFunction.d.ts.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.js.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.mjs.map +1 -1
- package/node_modules/openai/lib/parser.d.mts +2 -2
- package/node_modules/openai/lib/parser.d.mts.map +1 -1
- package/node_modules/openai/lib/parser.d.ts +2 -2
- package/node_modules/openai/lib/parser.d.ts.map +1 -1
- package/node_modules/openai/lib/parser.js.map +1 -1
- package/node_modules/openai/lib/parser.mjs.map +1 -1
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts +15 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts +15 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.js +403 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.js.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.mjs +400 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.mjs.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.mts +19 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.mts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.ts +19 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.ts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.js +104 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.js.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.mjs +100 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.mjs.map +1 -0
- package/node_modules/openai/lib/responses/ResponseStream.d.mts +6 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.mts.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.ts +6 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.ts.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.js +26 -90
- package/node_modules/openai/lib/responses/ResponseStream.js.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.mjs +26 -90
- package/node_modules/openai/lib/responses/ResponseStream.mjs.map +1 -1
- package/node_modules/openai/package.json +24 -1
- package/node_modules/openai/providers/bedrock/aws.d.mts +24 -0
- package/node_modules/openai/providers/bedrock/aws.d.mts.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.d.ts +24 -0
- package/node_modules/openai/providers/bedrock/aws.d.ts.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.js +170 -0
- package/node_modules/openai/providers/bedrock/aws.js.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.mjs +166 -0
- package/node_modules/openai/providers/bedrock/aws.mjs.map +1 -0
- package/node_modules/openai/providers/bedrock.d.mts +7 -0
- package/node_modules/openai/providers/bedrock.d.mts.map +1 -0
- package/node_modules/openai/providers/bedrock.d.ts +7 -0
- package/node_modules/openai/providers/bedrock.d.ts.map +1 -0
- package/node_modules/openai/providers/bedrock.js +26 -0
- package/node_modules/openai/providers/bedrock.js.map +1 -0
- package/node_modules/openai/providers/bedrock.mjs +22 -0
- package/node_modules/openai/providers/bedrock.mjs.map +1 -0
- package/node_modules/openai/realtime/internal-base.d.mts +28 -1
- package/node_modules/openai/realtime/internal-base.d.mts.map +1 -1
- package/node_modules/openai/realtime/internal-base.d.ts +28 -1
- package/node_modules/openai/realtime/internal-base.d.ts.map +1 -1
- package/node_modules/openai/realtime/internal-base.js +50 -7
- package/node_modules/openai/realtime/internal-base.js.map +1 -1
- package/node_modules/openai/realtime/internal-base.mjs +49 -7
- package/node_modules/openai/realtime/internal-base.mjs.map +1 -1
- package/node_modules/openai/realtime/websocket.d.mts +4 -7
- package/node_modules/openai/realtime/websocket.d.mts.map +1 -1
- package/node_modules/openai/realtime/websocket.d.ts +4 -7
- package/node_modules/openai/realtime/websocket.d.ts.map +1 -1
- package/node_modules/openai/realtime/websocket.js +4 -8
- package/node_modules/openai/realtime/websocket.js.map +1 -1
- package/node_modules/openai/realtime/websocket.mjs +5 -9
- package/node_modules/openai/realtime/websocket.mjs.map +1 -1
- package/node_modules/openai/realtime/ws.d.mts +4 -7
- package/node_modules/openai/realtime/ws.d.mts.map +1 -1
- package/node_modules/openai/realtime/ws.d.ts +4 -7
- package/node_modules/openai/realtime/ws.d.ts.map +1 -1
- package/node_modules/openai/realtime/ws.js +4 -8
- package/node_modules/openai/realtime/ws.js.map +1 -1
- package/node_modules/openai/realtime/ws.mjs +5 -9
- package/node_modules/openai/realtime/ws.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts +2 -2
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts +2 -2
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts +12 -0
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts +12 -0
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js +4 -4
- package/node_modules/openai/resources/admin/organization/projects/index.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.js +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts +58 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts +58 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts +3 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts +3 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js +9 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts +177 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts +177 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts +1 -167
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts +1 -167
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.js +2 -97
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs +1 -95
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/usage.d.mts +517 -88
- package/node_modules/openai/resources/admin/organization/usage.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/usage.d.ts +517 -88
- package/node_modules/openai/resources/admin/organization/usage.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/assistants.d.mts +12 -26
- package/node_modules/openai/resources/beta/assistants.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/assistants.d.ts +12 -26
- package/node_modules/openai/resources/beta/assistants.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/beta.d.mts +6 -1
- package/node_modules/openai/resources/beta/beta.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/beta.d.ts +6 -1
- package/node_modules/openai/resources/beta/beta.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/beta.js +4 -0
- package/node_modules/openai/resources/beta/beta.js.map +1 -1
- package/node_modules/openai/resources/beta/beta.mjs +4 -0
- package/node_modules/openai/resources/beta/beta.mjs.map +1 -1
- package/node_modules/openai/resources/beta/index.d.mts +1 -0
- package/node_modules/openai/resources/beta/index.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/index.d.ts +1 -0
- package/node_modules/openai/resources/beta/index.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/index.js +5 -3
- package/node_modules/openai/resources/beta/index.js.map +1 -1
- package/node_modules/openai/resources/beta/index.mjs +1 -0
- package/node_modules/openai/resources/beta/index.mjs.map +1 -1
- package/node_modules/openai/resources/beta/responses/index.d.mts +6 -0
- package/node_modules/openai/resources/beta/responses/index.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.d.ts +6 -0
- package/node_modules/openai/resources/beta/responses/index.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.js +11 -0
- package/node_modules/openai/resources/beta/responses/index.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.mjs +5 -0
- package/node_modules/openai/resources/beta/responses/index.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.mts +69 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.ts +69 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.js +37 -0
- package/node_modules/openai/resources/beta/responses/input-items.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.mjs +33 -0
- package/node_modules/openai/resources/beta/responses/input-items.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts +191 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts +191 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.js +34 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.mjs +30 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.mts +71 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.ts +71 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.js +48 -0
- package/node_modules/openai/resources/beta/responses/internal-base.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.mjs +42 -0
- package/node_modules/openai/resources/beta/responses/internal-base.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.d.mts +9986 -0
- package/node_modules/openai/resources/beta/responses/responses.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.d.ts +9986 -0
- package/node_modules/openai/resources/beta/responses/responses.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.js +121 -0
- package/node_modules/openai/resources/beta/responses/responses.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.mjs +116 -0
- package/node_modules/openai/resources/beta/responses/responses.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.mts +106 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.ts +106 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.js +476 -0
- package/node_modules/openai/resources/beta/responses/ws-base.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.mjs +472 -0
- package/node_modules/openai/resources/beta/responses/ws-base.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.d.mts +13 -0
- package/node_modules/openai/resources/beta/responses/ws.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.d.ts +13 -0
- package/node_modules/openai/resources/beta/responses/ws.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.js +31 -0
- package/node_modules/openai/resources/beta/responses/ws.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.mjs +26 -0
- package/node_modules/openai/resources/beta/responses/ws.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses.d.mts +2 -0
- package/node_modules/openai/resources/beta/responses.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses.d.ts +2 -0
- package/node_modules/openai/resources/beta/responses.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses.js +6 -0
- package/node_modules/openai/resources/beta/responses.js.map +1 -0
- package/node_modules/openai/resources/beta/responses.mjs +3 -0
- package/node_modules/openai/resources/beta/responses.mjs.map +1 -0
- package/node_modules/openai/resources/beta/threads/runs/runs.d.mts +6 -13
- package/node_modules/openai/resources/beta/threads/runs/runs.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.d.ts +6 -13
- package/node_modules/openai/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.js.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.mts +170 -20
- package/node_modules/openai/resources/chat/completions/completions.d.mts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.ts +170 -20
- package/node_modules/openai/resources/chat/completions/completions.d.ts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.js.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.mjs.map +1 -1
- package/node_modules/openai/resources/completions.d.mts +4 -0
- package/node_modules/openai/resources/completions.d.mts.map +1 -1
- package/node_modules/openai/resources/completions.d.ts +4 -0
- package/node_modules/openai/resources/completions.d.ts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.d.mts +19 -0
- package/node_modules/openai/resources/conversations/conversations.d.mts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.d.ts +19 -0
- package/node_modules/openai/resources/conversations/conversations.d.ts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.js.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.mjs.map +1 -1
- package/node_modules/openai/resources/conversations/items.d.mts +45 -1
- package/node_modules/openai/resources/conversations/items.d.mts.map +1 -1
- package/node_modules/openai/resources/conversations/items.d.ts +45 -1
- package/node_modules/openai/resources/conversations/items.d.ts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.d.mts +66 -143
- package/node_modules/openai/resources/evals/runs/runs.d.mts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.d.ts +66 -143
- package/node_modules/openai/resources/evals/runs/runs.d.ts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.js.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.mjs.map +1 -1
- package/node_modules/openai/resources/graders/grader-models.d.mts +6 -13
- package/node_modules/openai/resources/graders/grader-models.d.mts.map +1 -1
- package/node_modules/openai/resources/graders/grader-models.d.ts +6 -13
- package/node_modules/openai/resources/graders/grader-models.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/calls.d.mts +1 -1
- package/node_modules/openai/resources/realtime/calls.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/calls.d.ts +1 -1
- package/node_modules/openai/resources/realtime/calls.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.mts +5 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.ts +5 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.mts +9 -1
- package/node_modules/openai/resources/realtime/realtime.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.ts +9 -1
- package/node_modules/openai/resources/realtime/realtime.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.js.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.mjs.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts +7 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts +7 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.mts +819 -26
- package/node_modules/openai/resources/responses/responses.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.ts +819 -26
- package/node_modules/openai/resources/responses/responses.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.js +1 -1
- package/node_modules/openai/resources/responses/responses.js.map +1 -1
- package/node_modules/openai/resources/responses/responses.mjs +1 -1
- package/node_modules/openai/resources/responses/responses.mjs.map +1 -1
- package/node_modules/openai/resources/shared.d.mts +20 -28
- package/node_modules/openai/resources/shared.d.mts.map +1 -1
- package/node_modules/openai/resources/shared.d.ts +20 -28
- package/node_modules/openai/resources/shared.d.ts.map +1 -1
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parseDef.ts +44 -16
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/branded.ts +2 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/catch.ts +2 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/default.ts +6 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nullable.ts +13 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/optional.ts +14 -6
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/pipeline.ts +3 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/promise.ts +6 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/readonly.ts +2 -2
- package/node_modules/openai/src/auth/workload-identity-auth.ts +16 -5
- package/node_modules/openai/src/azure.ts +4 -1
- package/node_modules/openai/src/beta/realtime/internal-base.ts +43 -5
- package/node_modules/openai/src/beta/realtime/websocket.ts +10 -7
- package/node_modules/openai/src/beta/realtime/ws.ts +10 -7
- package/node_modules/openai/src/client.ts +93 -23
- package/node_modules/openai/src/core/streaming.ts +36 -8
- package/node_modules/openai/src/core/uploads.ts +6 -1
- package/node_modules/openai/src/helpers/audio.ts +18 -4
- package/node_modules/openai/src/helpers/zod.ts +78 -23
- package/node_modules/openai/src/index.ts +1 -1
- package/node_modules/openai/src/internal/bedrock.ts +153 -0
- package/node_modules/openai/src/internal/headers.ts +7 -3
- package/node_modules/openai/src/internal/provider.ts +60 -0
- package/node_modules/openai/src/internal/uploads.ts +214 -4
- package/node_modules/openai/src/internal/utils/log.ts +1 -0
- package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +124 -50
- package/node_modules/openai/src/lib/AssistantStream.ts +8 -23
- package/node_modules/openai/src/lib/ChatCompletionRunner.ts +47 -7
- package/node_modules/openai/src/lib/ChatCompletionStream.ts +119 -28
- package/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +145 -8
- package/node_modules/openai/src/lib/EventEmitter.ts +11 -2
- package/node_modules/openai/src/lib/EventStream.ts +134 -4
- package/node_modules/openai/src/lib/ResponsesParser.ts +18 -4
- package/node_modules/openai/src/lib/RunnableFunction.ts +60 -31
- package/node_modules/openai/src/lib/parser.ts +4 -0
- package/node_modules/openai/src/lib/responses/ResponseAccumulator.ts +421 -0
- package/node_modules/openai/src/lib/responses/ResponseInputItems.ts +129 -0
- package/node_modules/openai/src/lib/responses/ResponseStream.ts +29 -90
- package/node_modules/openai/src/providers/bedrock/aws.ts +255 -0
- package/node_modules/openai/src/providers/bedrock.ts +33 -0
- package/node_modules/openai/src/realtime/internal-base.ts +90 -7
- package/node_modules/openai/src/realtime/websocket.ts +15 -13
- package/node_modules/openai/src/realtime/ws.ts +15 -13
- package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +169 -1
- package/node_modules/openai/src/resources/admin/organization/projects/api-keys.ts +15 -1
- package/node_modules/openai/src/resources/admin/organization/projects/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +13 -13
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/api-keys.ts +80 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +284 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts.ts +1 -264
- package/node_modules/openai/src/resources/admin/organization/usage.ts +616 -88
- package/node_modules/openai/src/resources/beta/assistants.ts +12 -26
- package/node_modules/openai/src/resources/beta/beta.ts +330 -2
- package/node_modules/openai/src/resources/beta/index.ts +163 -0
- package/node_modules/openai/src/resources/beta/responses/index.ts +169 -0
- package/node_modules/openai/src/resources/beta/responses/input-items.ts +105 -0
- package/node_modules/openai/src/resources/beta/responses/input-tokens.ts +245 -0
- package/node_modules/openai/src/resources/beta/responses/internal-base.ts +117 -0
- package/node_modules/openai/src/resources/beta/responses/responses.ts +12633 -0
- package/node_modules/openai/src/resources/beta/responses/ws-base.ts +615 -0
- package/node_modules/openai/src/resources/beta/responses/ws.ts +38 -0
- package/node_modules/openai/src/resources/beta/responses.ts +3 -0
- package/node_modules/openai/src/resources/beta/threads/runs/runs.ts +6 -13
- package/node_modules/openai/src/resources/chat/completions/completions.ts +237 -23
- package/node_modules/openai/src/resources/completions.ts +5 -0
- package/node_modules/openai/src/resources/conversations/conversations.ts +21 -0
- package/node_modules/openai/src/resources/conversations/items.ts +56 -0
- package/node_modules/openai/src/resources/evals/runs/runs.ts +66 -143
- package/node_modules/openai/src/resources/graders/grader-models.ts +6 -13
- package/node_modules/openai/src/resources/realtime/calls.ts +2 -0
- package/node_modules/openai/src/resources/realtime/client-secrets.ts +7 -0
- package/node_modules/openai/src/resources/realtime/realtime.ts +12 -0
- package/node_modules/openai/src/resources/responses/input-tokens.ts +8 -0
- package/node_modules/openai/src/resources/responses/responses.ts +953 -17
- package/node_modules/openai/src/resources/shared.ts +23 -27
- package/node_modules/openai/src/version.ts +1 -1
- package/node_modules/openai/version.d.mts +1 -1
- package/node_modules/openai/version.d.ts +1 -1
- package/node_modules/openai/version.js +1 -1
- package/node_modules/openai/version.mjs +1 -1
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/tar-fs/index.js +39 -10
- package/node_modules/tar-fs/package.json +6 -1
- package/node_modules/tar-fs/test/index.js +111 -0
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/package.json +6 -6
- package/node_modules/fast-copy/CHANGELOG.md +0 -176
- package/node_modules/fast-copy/dist/cjs/copier.d.cts +0 -75
- package/node_modules/fast-copy/dist/cjs/options.d.cts +0 -69
- package/node_modules/fast-copy/dist/cjs/utils.d.cts +0 -13
- package/node_modules/fast-copy/dist/es/copier.d.mts +0 -75
- package/node_modules/fast-copy/dist/es/options.d.mts +0 -69
- package/node_modules/fast-copy/dist/es/utils.d.mts +0 -13
- package/node_modules/fast-copy/dist/umd/copier.d.ts +0 -72
- package/node_modules/fast-copy/dist/umd/options.d.ts +0 -65
- package/node_modules/fast-copy/dist/umd/utils.d.ts +0 -13
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -52,7 +52,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
52
52
|
|
|
53
53
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
54
54
|
|
|
55
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},$g=`DialogDescriptionWarning`,e_=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zg($g).contentName}}.`;return x.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},t_=Eg,n_=Mg,r_=Pg,i_=Rg,a_=Ug,o_=Gg,s_=qg,c_=t_,l_=n_;function u_({className:e,...t}){return(0,G.jsx)(r_,{className:W(`fixed inset-0 z-50 bg-canvas/80 backdrop-blur-sm data-[state=open]:animate-[fade-in_180ms_ease-out] data-[state=closed]:animate-[fade-out_120ms_ease-in]`,e),...t})}function d_({className:e,children:t,...n}){return(0,G.jsxs)(l_,{children:[(0,G.jsx)(u_,{}),(0,G.jsxs)(i_,{className:W(`fixed left-1/2 top-1/2 z-50 grid w-[min(920px,calc(100vw-2rem))] max-h-[85vh] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-hidden rounded-3xl border border-line-strong bg-panel p-0 shadow-[var(--shadow-elevated)]`,e),...n,children:[t,(0,G.jsxs)(s_,{className:`absolute right-4 top-4 rounded-full p-2 text-fg-subtle transition-colors hover:bg-overlay hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,children:[(0,G.jsx)(Pi,{className:`size-4`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function f_({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex flex-col gap-1.5 border-b border-line px-6 py-5`,e),...t})}function p_({className:e,...t}){return(0,G.jsx)(a_,{className:W(`text-lg font-semibold text-fg`,e),...t})}function m_({className:e,...t}){return(0,G.jsx)(o_,{className:W(`text-sm text-fg-muted`,e),...t})}function h_({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`min-h-0 overflow-auto px-6 pb-6`,e),...t})}var g_={llmDefaultProvider:``,llmAliases:{},pluginInstalled:{},pluginDefaultScm:``,pluginDefaultTracker:``,mcpServersText:`{}`,inheritClaudeCodeMcps:!1,intelligenceDir:``,intelligenceRemote:``,workingDir:``,guardrailsEnabled:!0,guardrailRules:[],guardrailsRulesText:`[]`},__={llmDefaultProvider:`llm-provider`,llmAliases:`llm-provider`,pluginDefaultScm:`source-control`,pluginDefaultTracker:`issue-tracker`,mcpServersText:`mcp`,inheritClaudeCodeMcps:`mcp`,intelligenceDir:`paths`,intelligenceRemote:`paths`,workingDir:`paths`,guardrailsEnabled:`guardrails`,guardrailRules:`guardrails`,guardrailsRulesText:`guardrails`},v_=(0,x.createContext)(null);function y_(){let e=(0,x.useContext)(v_);if(!e)throw Error(`useSettings must be used within <SettingsProvider>`);return e}function b_(e){let t=e.config;if(!t)return g_;let n=JSON.stringify(t.mcpServers??{},null,2),r={},i=``,a=``;if(t.plugins?.installed){for(let[e,n]of Object.entries(t.plugins.installed))r[e]={...typeof n.enabled==`boolean`?{enabled:n.enabled}:{},config:{...n.config??{}}};i=t.plugins.defaults?.scm??``,a=t.plugins.defaults?.tracker??``}let o=(e.resolved?.guardrails?.rules??[]).map(e=>({...e,enabled:e.enabled!==!1})),s=JSON.stringify(t?.guardrails?.rules??[],null,2);return{llmDefaultProvider:t.llm?.defaultProvider??``,llmAliases:{...t.llm?.aliases??{}},pluginInstalled:r,pluginDefaultScm:i,pluginDefaultTracker:a,mcpServersText:n,inheritClaudeCodeMcps:t.inheritClaudeCodeMcps===!0,intelligenceDir:t.intelligence?.dir??``,intelligenceRemote:t.intelligence?.gitRemote??``,workingDir:t.paths?.workingDir??``,guardrailsEnabled:e.resolved?.guardrails?.enabled??t?.guardrails?.enabled??!0,guardrailRules:o,guardrailsRulesText:s}}function x_(e,t){if(e===t)return!0;if(typeof e==`object`&&e&&typeof t==`object`&&t)try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}return!1}function S_({children:e}){let[t,n]=(0,x.useState)(g_),[r,i]=(0,x.useState)(g_),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(null),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(()=>typeof window>`u`?!1:window.localStorage.getItem(`coro.firstRun.completed`)===`true`),O=(0,x.useRef)(r);O.current=r;let k=(0,x.useCallback)(async()=>{try{C(await q(`/plugins`)),T(null)}catch(e){T(e instanceof Error?e.message:String(e))}},[]),A=(0,x.useCallback)(async()=>{u(!0),f(null);try{let[e]=await Promise.all([q(`/config`),k()]);o({configPath:e.configPath,mode:e.mode,resolved:e.resolved,configError:e.configError,rawConfig:e.rawConfig}),c({coachMode:e.config?.coachMode,intake:e.config?.intake}),e.config?.setup?.completedAt&&(D(!0),typeof window<`u`&&window.localStorage.setItem(`coro.firstRun.completed`,`true`));let t=b_(e);n(t),i(t)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}},[k]);(0,x.useEffect)(()=>{A()},[A]);let j=(0,x.useCallback)((e,t)=>{n(n=>({...n,[e]:t})),g(null),v(null)},[]),M=(0,x.useCallback)((e,t,r)=>{n(n=>{let i=n.pluginInstalled[e]??{config:{}},a={...i.config};return r===void 0||r===``?delete a[t]:a[t]=r,{...n,pluginInstalled:{...n.pluginInstalled,[e]:{...i,config:a}}}}),g(null),v(null)},[]),N=(0,x.useCallback)((e,t)=>{n(n=>{let r=n.pluginInstalled[e]??{config:{}};return{...n,pluginInstalled:{...n.pluginInstalled,[e]:{...r,enabled:t}}}}),g(null),v(null)},[]),ee=(0,x.useCallback)((e,t)=>{n(n=>e===`scm`?{...n,pluginDefaultScm:t}:{...n,pluginDefaultTracker:t}),g(null),v(null)},[]),te=(0,x.useCallback)((e,t)=>{n(n=>({...n,guardrailRules:n.guardrailRules.map(n=>n.id===e?{...n,enabled:t}:n)})),g(null),v(null)},[]),P=(0,x.useCallback)((e,t)=>{n(n=>({...n,guardrailRules:n.guardrailRules.map(n=>n.id===e?{...n,config:t}:n)})),g(null),v(null)},[]);function F(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t.id);if(!e){r.push({id:t.id,on:t.on,check:t.check,enabled:t.enabled,...t.config?{config:t.config}:{},...t.script?{script:t.script}:{}});continue}let i={id:t.id},a=!1;t.enabled!==e.enabled&&(i.enabled=t.enabled,a=!0),JSON.stringify(t.config??{})!==JSON.stringify(e.config??{})&&(i.config=t.config??{},a=!0),a&&r.push(i)}return r}let I=(0,x.useMemo)(()=>{let e=new Set;return Object.keys(t).forEach(n=>{x_(t[n],r[n])||e.add(n)}),e},[t,r]),ne=(0,x.useMemo)(()=>{let e=new Set;if(!I.has(`pluginInstalled`))return e;let n=new Set(Object.keys(t.pluginInstalled)),i=new Set(Object.keys(r.pluginInstalled));for(let a of new Set([...n,...i])){let n=t.pluginInstalled[a],i=r.pluginInstalled[a];JSON.stringify(n)!==JSON.stringify(i)&&e.add(a)}return e},[I,t.pluginInstalled,r.pluginInstalled]),re=(0,x.useMemo)(()=>{let e=new Set;if(I.forEach(t=>{let n=__[t];n&&e.add(n)}),ne.size>0){let t=new Map(S?.plugins.map(e=>[e.manifest.id,e.manifest.kind])??[]);for(let n of ne){let r=t.get(n);r===`scm`?e.add(`source-control`):r===`tracker`?e.add(`issue-tracker`):e.add(`plugins`)}}return e},[I,ne,S]),ie=I.size>0,L=(0,x.useCallback)(()=>{n(O.current),g(null),v(null)},[]),R=(0,x.useCallback)(()=>{let e={};if((I.has(`llmDefaultProvider`)||I.has(`llmAliases`))&&(e.llm={...t.llmDefaultProvider?{defaultProvider:t.llmDefaultProvider}:{},aliases:{...t.llmAliases}}),I.has(`pluginInstalled`)||I.has(`pluginDefaultScm`)||I.has(`pluginDefaultTracker`)){let n={};for(let[e,r]of Object.entries(t.pluginInstalled))n[e]={...typeof r.enabled==`boolean`?{enabled:r.enabled}:{},config:{...r.config}};let r={};t.pluginDefaultScm&&(r.scm=t.pluginDefaultScm),t.pluginDefaultTracker&&(r.tracker=t.pluginDefaultTracker),e.plugins={...Object.keys(r).length>0?{defaults:r}:{},installed:n}}if(I.has(`mcpServersText`)){let n;try{n=JSON.parse(t.mcpServersText)}catch(e){throw Error(`MCP servers JSON is invalid: ${e.message}`)}if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`mcpServers must be a JSON object keyed by server id.`);e.mcpServers=n}if(I.has(`inheritClaudeCodeMcps`)&&(e.inheritClaudeCodeMcps=t.inheritClaudeCodeMcps),(I.has(`intelligenceDir`)||I.has(`intelligenceRemote`))&&(e.intelligence={dir:t.intelligenceDir||void 0,gitRemote:t.intelligenceRemote||void 0}),I.has(`workingDir`)&&(e.paths={workingDir:t.workingDir||void 0}),I.has(`guardrailsEnabled`)||I.has(`guardrailRules`)||I.has(`guardrailsRulesText`)){let n;if(I.has(`guardrailsRulesText`)){let e=JSON.parse(t.guardrailsRulesText);if(!Array.isArray(e))throw Error(`guardrails.rules must be a JSON array.`);n=e}else n=F(t.guardrailRules,O.current.guardrailRules);e.guardrails={enabled:t.guardrailsEnabled,rules:n}}return e},[t,I]),ae=(0,x.useCallback)(async()=>{g(null),v(null),m(!0);try{let e=R();if(Object.keys(e).length===0){m(!1);return}let t=await q(`/config`,J(e,{method:`PUT`})),n=e&&typeof e==`object`&&`paths`in e,r=e&&typeof e==`object`&&`cloud`in e;if((t.reload?.failed??[]).length>0){let e=t.reload?.failed.map(e=>e.id).join(`, `);v(`Configuration saved. Some plugins failed to hot-reload (${e}) — restart the runner if they keep failing.`)}else v(n||r?`Configuration saved. Restart the runner to apply path or cloud-mode changes.`:`Configuration saved. Changes are live for the next job — no restart needed.`);b(new Date().toISOString()),await A()}catch(e){g(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}},[R,A]),oe=(0,x.useCallback)(()=>{g(null),v(null)},[]);(0,x.useEffect)(()=>{if(!ie)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[ie]);let se={loading:l,loadError:d,reload:A,draft:t,setDraft:j,setPluginField:M,setPluginEnabled:N,setPluginDefault:ee,setGuardrailRuleEnabled:te,setGuardrailRuleConfig:P,isDirty:ie,dirtyFields:I,dirtyPluginIds:ne,dirtySections:re,discardChanges:L,save:ae,saving:p,saveError:h,saveNotice:_,clearSaveFeedback:oe,lastSavedAt:y,meta:a,preferences:s,pluginsCatalogue:S,pluginsCatalogueError:w,reloadPlugins:k,firstRunCompleted:E,markFirstRunComplete:(0,x.useCallback)(async e=>{D(!0),typeof window<`u`&&window.localStorage.setItem(`coro.firstRun.completed`,`true`);try{await q(`/config`,J({setup:{completedAt:new Date().toISOString(),...e?.skipped&&e.skipped.length>0?{skipped:e.skipped}:{}}},{method:`PUT`}))}catch{}},[]),resetFirstRun:(0,x.useCallback)(()=>{D(!1),typeof window<`u`&&window.localStorage.removeItem(`coro.firstRun.completed`)},[]),commitWizardStep:(0,x.useCallback)(async({kind:e,pluginId:t,config:n,setAsDefault:r})=>{let i=await q(`/config`),a=i.config?.plugins?.installed??{},o={};for(let[e,t]of Object.entries(a))o[e]={...typeof t.enabled==`boolean`?{enabled:t.enabled}:{},config:{...t.config??{}}};o[t]={enabled:!0,config:{...o[t]?.config??{},...n}};let s={...i.config?.plugins?.defaults??{}};r&&(e===`scm`&&(s.scm=t),e===`tracker`&&(s.tracker=t));let c={plugins:{...Object.keys(s).length>0?{defaults:s}:{},installed:o}};e===`executor`&&(c.llm={...i.config?.llm??{},defaultProvider:t}),await q(`/config`,J(c,{method:`PUT`})),await A()},[A])};return(0,G.jsx)(v_.Provider,{value:se,children:e})}function C_(){return(0,G.jsxs)(`div`,{className:`relative isolate overflow-hidden`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10 bg-[radial-gradient(ellipse_60%_45%_at_50%_-10%,rgba(97,114,255,0.22),transparent_70%),radial-gradient(ellipse_50%_40%_at_85%_110%,rgba(56,189,248,0.16),transparent_75%),radial-gradient(ellipse_40%_35%_at_15%_115%,rgba(168,85,247,0.14),transparent_75%)]`}),(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10 opacity-[0.07] [background-image:linear-gradient(to_right,rgba(255,255,255,0.6)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.6)_1px,transparent_1px)] [background-size:36px_36px] [mask-image:radial-gradient(ellipse_at_center,black_40%,transparent_75%)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-5 px-6 py-8 text-center sm:gap-6 sm:px-10 sm:py-10`,children:[(0,G.jsxs)(`div`,{className:`relative flex size-24 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-accent-500/20 blur-2xl`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-24 items-center justify-center rounded-3xl bg-gradient-to-br from-accent-500/25 via-accent-500/10 to-transparent ring-1 ring-accent-500/35 shadow-[0_0_60px_-20px_rgba(97,114,255,0.6)]`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`size-12 text-accent-200 drop-shadow-[0_0_12px_rgba(125,150,255,0.55)]`,children:[(0,G.jsx)(`path`,{d:`M19 7.5A8 8 0 1 0 19 16.5`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`}),(0,G.jsx)(`circle`,{cx:`18.25`,cy:`12`,r:`1.6`,fill:`currentColor`})]})})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-accent-500/30 bg-accent-500/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-accent-200`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`First-time setup`]}),(0,G.jsx)(`h1`,{className:`text-balance bg-gradient-to-b from-fg via-fg to-fg-muted bg-clip-text text-4xl font-semibold tracking-tight text-transparent sm:text-5xl`,children:`Welcome to Coro`}),(0,G.jsx)(`p`,{className:`mx-auto max-w-xl text-pretty text-sm text-fg-muted sm:text-base`,children:`Coro runs autonomous coding agents that plan, write, review, and merge code on your behalf. Spend the next minute wiring up a model and a code host — we'll show you what each step is for.`}),(0,G.jsxs)(`p`,{className:`mx-auto max-w-xl text-pretty text-xs text-fg-subtle sm:text-sm`,children:[`Anything you skip can be configured later from `,(0,G.jsx)(`strong`,{className:`text-fg-muted`,children:`Settings → Setup`}),`.`]})]}),(0,G.jsx)(`div`,{className:`grid w-full max-w-2xl gap-3 sm:grid-cols-3`,children:[{icon:ar,title:`Connect a model`,copy:`Claude or OpenAI — Coro uses it to plan, code, and review.`},{icon:Vr,title:`Connect your code host`,copy:`GitHub or Bitbucket. Coro clones, branches, and opens PRs.`},{icon:Oi,title:`Optional: a tracker`,copy:`Jira, Linear, or GitHub Issues — Coro reports back as work moves.`}].map(({icon:e,title:t,copy:n})=>(0,G.jsxs)(`div`,{className:`group relative overflow-hidden rounded-2xl border border-line bg-overlay/40 p-4 text-left transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -right-6 -top-6 size-20 rounded-full bg-accent-500/10 blur-2xl transition-opacity group-hover:opacity-100`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-9 items-center justify-center rounded-xl bg-accent-500/12 ring-1 ring-accent-500/25 text-accent-200`,children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`relative mt-3 text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`div`,{className:`relative mt-1 text-xs leading-relaxed text-fg-muted`,children:n})]},t))})]})]})}function w_({eyebrow:e,title:t,description:n,children:r,aside:i}){return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-fg-subtle`,children:e}),(0,G.jsx)(`h2`,{className:`text-balance text-xl font-semibold tracking-tight text-fg sm:text-2xl`,children:t}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:n})]}),i?(0,G.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,G.jsx)(`div`,{children:r}),(0,G.jsx)(`div`,{className:`lg:max-w-[260px]`,children:i})]}):r]})}var T_={anthropic:{path:`M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5527h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2932-5.9492 2.2932 5.9492Z`,tint:`text-[#D97757]`},openai:{path:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`,tint:`text-[#10A37F]`},github:{path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.4 3-.405 1.02.005 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,tint:`text-fg`},bitbucket:{path:`M.778 1.213a.768.768 0 00-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 00.77-.646l3.27-20.03a.768.768 0 00-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z`,tint:`text-[#2684FF]`},gitlab:{path:`m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.875.875 0 0 0-.9997.0539.875.875 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.857.857 0 0 0-.29-.4412.875.875 0 0 0-.9997-.0537.859.859 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z`,tint:`text-[#FC6D26]`},jira:{path:`M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.762a1.005 1.005 0 0 0-1.001-1.005zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.005 1.005 0 0 0 23.013 0z`,tint:`text-[#2684FF]`},linear:{path:`M.403 13.795A12.0073 12.0073 0 0 0 10.205 23.597zM.0093 10.6066L13.3935 23.9908a12.0676 12.0676 0 0 0 2.2914-.4634L.4727 8.3151a12.0676 12.0676 0 0 0-.4634 2.2915zm1.0186-3.7156L16.4283 22.5478a12.0728 12.0728 0 0 0 1.821-1.0354L2.5494 5.8639A12.0728 12.0728 0 0 0 1.0279 6.891zm2.4998-3.013a12 12 0 1 1 16.9744 16.9744L3.5277 3.878z`,tint:`text-[#5E6AD2]`},"github-issues":{path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.4 3-.405 1.02.005 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,tint:`text-fg`}};function E_({pluginId:e,className:t,size:n=20}){let r=T_[e];return r?(0,G.jsx)(`svg`,{role:`img`,"aria-label":e,viewBox:`0 0 24 24`,className:W(r.tint,t),style:{width:n,height:n},fill:`currentColor`,children:(0,G.jsx)(`path`,{d:r.path})}):(0,G.jsx)(fi,{"aria-hidden":!0,className:W(`text-fg-subtle`,t),style:{width:n,height:n}})}function D_({pluginId:e,title:t,subtitle:n,selected:r,recommended:i,onSelect:a}){return(0,G.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":r,className:W(`group relative flex w-full items-start gap-4 rounded-2xl border bg-overlay/30 px-4 py-4 text-left transition-all`,`hover:bg-overlay/60 hover:border-accent-500/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,r?`border-accent-500/55 bg-accent-500/8 shadow-[0_0_0_1px_rgba(97,114,255,0.35),0_18px_40px_-30px_rgba(97,114,255,0.6)]`:`border-line`),children:[(0,G.jsx)(`span`,{className:W(`flex size-11 shrink-0 items-center justify-center rounded-xl ring-1 transition-colors`,r?`bg-accent-500/15 ring-accent-500/35`:`bg-overlay/60 ring-line group-hover:bg-overlay group-hover:ring-line-strong`),children:(0,G.jsx)(E_,{pluginId:e,size:22})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[15px] font-medium text-fg`,children:t}),i?(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-accent-500/30 bg-accent-500/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-accent-200`,children:`Recommended`}):null]}),(0,G.jsx)(`div`,{className:`mt-1 text-[13px] leading-relaxed text-fg-muted`,children:n})]}),(0,G.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-muted`,children:r?(0,G.jsx)(fr,{className:`size-5 text-accent-300`}):(0,G.jsx)(vr,{className:`size-5`})})]})}var O_=x.forwardRef(function({className:e,...t},n){return(0,G.jsx)(`input`,{ref:n,className:W(`flex h-11 w-full rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}),k_=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),A_=`VisuallyHidden`,j_=x.forwardRef((e,t)=>(0,G.jsx)(ps.span,{...e,ref:t,style:{...k_,...e.style}}));j_.displayName=A_;var M_=j_,[N_,P_]=Ss(`Tooltip`,[vd]),F_=vd(),I_=`TooltipProvider`,L_=700,R_=`tooltip.open`,[z_,B_]=N_(I_),V_=e=>{let{__scopeTooltip:t,delayDuration:n=L_,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=x.useRef(!0),s=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,G.jsx)(z_,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:x.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};V_.displayName=I_;var H_=`Tooltip`,[U_,W_]=N_(H_),G_=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=B_(H_,e.__scopeTooltip),l=F_(t),[u,d]=x.useState(null),f=tl(),p=x.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=x.useRef(!1),[_,v]=gc({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(R_))):c.onClose(),a?.(e)},caller:H_}),y=x.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return x.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,G.jsx)(Nd,{...l,children:(0,G.jsx)(U_,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:x.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:b,onClose:S,disableHoverableContent:m,children:n})})};G_.displayName=H_;var K_=`TooltipTrigger`,q_=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=W_(K_,n),a=B_(K_,n),o=F_(n),s=Uo(t,x.useRef(null),i.onTriggerChange),c=x.useRef(!1),l=x.useRef(!1),u=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,G.jsx)(Pd,{asChild:!0,...o,children:(0,G.jsx)(ps.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:X(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:X(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:X(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:X(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:X(e.onBlur,i.onClose),onClick:X(e.onClick,i.onClose)})})});q_.displayName=K_;var J_=`TooltipPortal`,[Y_,X_]=N_(J_,{forceMount:void 0}),Z_=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=W_(J_,t);return(0,G.jsx)(Y_,{scope:t,forceMount:n,children:(0,G.jsx)(_s,{present:n||a.open,children:(0,G.jsx)(Rd,{asChild:!0,container:i,children:r})})})};Z_.displayName=J_;var Q_=`TooltipContent`,$_=x.forwardRef((e,t)=>{let n=X_(Q_,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=W_(Q_,e.__scopeTooltip);return(0,G.jsx)(_s,{present:r||o.open,children:o.disableHoverableContent?(0,G.jsx)(iv,{side:i,...a,ref:t}):(0,G.jsx)(ev,{side:i,...a,ref:t})})}),ev=x.forwardRef((e,t)=>{let n=W_(Q_,e.__scopeTooltip),r=B_(Q_,e.__scopeTooltip),i=x.useRef(null),a=Uo(t,i),[o,s]=x.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=x.useCallback(()=>{s(null),d(!1)},[d]),p=x.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=cv(r,sv(r,n.getBoundingClientRect())),a=lv(t.getBoundingClientRect());s(dv([...i,...a])),d(!0)},[d]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),x.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!uv(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,G.jsx)(iv,{...e,ref:a})}),[tv,nv]=N_(H_,{isInside:!1}),rv=ls(`TooltipContent`),iv=x.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=W_(Q_,n),l=F_(n),{onClose:u}=c;return x.useEffect(()=>(document.addEventListener(R_,u),()=>document.removeEventListener(R_,u)),[u]),x.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,G.jsx)(Dc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,G.jsxs)(Fd,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,G.jsx)(rv,{children:r}),(0,G.jsx)(tv,{scope:n,isInside:!0,children:(0,G.jsx)(M_,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});$_.displayName=Q_;var av=`TooltipArrow`,ov=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F_(n);return nv(av,n).isInside?null:(0,G.jsx)(Id,{...i,...r,ref:t})});ov.displayName=av;function sv(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function cv(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lv(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function uv(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dv(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),fv(t)}function fv(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var pv=V_,mv=G_,hv=q_,gv=Z_,_v=$_,vv=pv,yv=mv,bv=hv;function xv({className:e,sideOffset:t=8,...n}){return(0,G.jsx)(gv,{children:(0,G.jsx)(_v,{sideOffset:t,className:W(`z-50 overflow-hidden rounded-lg border border-line-strong bg-panel-raised px-3 py-1.5 text-xs text-fg shadow-[var(--shadow-elevated)]`,e),...n})})}function Sv({label:e,htmlFor:t,required:n,hint:r,tooltip:i,action:a,className:o,children:s}){return(0,G.jsxs)(`div`,{className:W(`space-y-2`,o),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`label`,{htmlFor:t,className:`block text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:[e,n?(0,G.jsx)(`span`,{className:`ml-1 text-danger-400`,children:`*`}):null]}),i?(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`inline-flex text-fg-subtle transition-colors hover:text-fg-muted`,"aria-label":`More about ${e}`,children:(0,G.jsx)(mr,{className:`size-3.5`})})}),(0,G.jsx)(xv,{className:`max-w-xs leading-relaxed`,children:i})]}):null,a?(0,G.jsx)(`div`,{className:`ml-auto flex items-center`,children:a}):null]}),s,r?(0,G.jsx)(`div`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null]})}var Cv=(0,x.forwardRef)(function({defaultRevealed:e=!1,className:t,...n},r){let[i,a]=(0,x.useState)(e);return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(O_,{ref:r,type:i?`text`:`password`,className:W(`pr-11`,t),autoComplete:`off`,spellCheck:!1,...n}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>a(e=>!e),className:`absolute right-1 top-1/2 size-8 -translate-y-1/2 text-fg-subtle hover:text-fg`,"aria-label":i?`Hide secret`:`Show secret`,tabIndex:-1,children:i?(0,G.jsx)(Dr,{className:`size-4`}):(0,G.jsx)(Or,{className:`size-4`})})]})});function wv({provider:e,draft:t,onChange:n}){return e.fields.length===0?null:(0,G.jsxs)(`div`,{className:`space-y-3.5 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[`Configure `,e.title]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:e.fields.map(e=>(0,G.jsx)(Tv,{field:e,value:typeof t[e.key]==`string`?t[e.key]:``,onChange:t=>n(e.key,t)},e.key))})]})}function Tv({field:e,value:t,onChange:n}){return(0,G.jsx)(Sv,{label:e.label,hint:e.hint,required:e.required,children:e.kind===`secret`?(0,G.jsx)(Cv,{value:t,placeholder:e.placeholder,onChange:e=>n(e.target.value)}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:t,placeholder:e.placeholder,onChange:e=>n(e.target.value),autoComplete:`off`,spellCheck:!1})})}function Ev({status:e,result:t}){return e===`idle`||e===`skipped`?null:e===`testing`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-xl border border-line bg-overlay/40 px-3 py-2.5 text-sm text-fg-muted`,children:[(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`}),(0,G.jsx)(`span`,{children:`Probing the provider…`})]}):t?e===`passed`?(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl border border-success-500/30 bg-success-500/8 px-3 py-2.5 text-sm text-success-300`,children:[(0,G.jsx)(fr,{className:`size-4 shrink-0 translate-y-0.5`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:`Credentials verified`}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:t.message})]})]}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl border border-danger-500/35 bg-danger-500/8 px-3 py-2.5 text-sm`,children:[(0,G.jsx)(_r,{className:`size-4 shrink-0 translate-y-0.5 text-danger-400`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:`Test failed`}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:t.message}),t.hint?(0,G.jsxs)(`div`,{className:`flex items-start gap-1.5 pt-1 text-[12px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3.5 shrink-0 translate-y-0.5 text-warning-400`}),(0,G.jsx)(`span`,{children:t.hint})]}):null]})]}),t.checks&&t.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2.5`,children:t.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2 text-[12px]`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded-full`,e.ok?`bg-success-500/15 text-success-300`:`bg-danger-500/15 text-danger-300`),children:e.ok?(0,G.jsx)(fr,{className:`size-3`}):(0,G.jsx)(_r,{className:`size-3`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:e.message}),e.hint?(0,G.jsx)(`div`,{className:`mt-0.5 text-fg-subtle`,children:e.hint}):null]})]},`${e.name}-${t}`))}):null]}):null}var Dv={neutral:qr,accent:qr,success:fr,warning:Mi,danger:_r};function Ov({tone:e=`neutral`,title:t,children:n,className:r}){let i=Dv[e];return(0,G.jsxs)(`div`,{className:W(`flex items-start gap-3 rounded-2xl border px-4 py-3 text-sm`,zo(e),r),children:[(0,G.jsx)(i,{className:`size-4 shrink-0 translate-y-0.5`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[t?(0,G.jsx)(`div`,{className:`font-medium`,children:t}):null,(0,G.jsx)(`div`,{className:`text-fg-muted`,children:n})]})]})}var kv={ok:`success`,warn:`warning`,error:`danger`,pending:`accent`,unset:`neutral`,optional:`neutral`},Av={ok:`Ready`,warn:`Needs attention`,error:`Failed`,pending:`Working…`,unset:`Not set`,optional:`Optional`};function jv({status:e,label:t,className:n}){return(0,G.jsx)(`span`,{className:W(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(kv[e]),n),children:t??Av[e]})}var Mv=[{id:`anthropic`,title:`Anthropic Claude`,subtitle:`Best results today. One-click sign-in with Claude login.`,recommended:!0,step:`llm`,fields:[],authMode:`anthropic`},{id:`openai`,title:`OpenAI`,subtitle:`GPT-4 / GPT-5 family via the OpenAI API.`,step:`llm`,fields:[{key:`apiKey`,label:`API key`,kind:`secret`,placeholder:`sk-…`,hint:`From platform.openai.com/api-keys.`,required:!0},{key:`baseURL`,label:`Base URL`,kind:`url`,placeholder:`https://api.openai.com/v1`,hint:`Optional. Override for Azure or self-hosted compatible endpoints.`}],authMode:`apiKey`},{id:`github`,title:`GitHub`,subtitle:`github.com or GitHub Enterprise. Personal or fine-grained PAT.`,step:`scm`,fields:[{key:`owner`,label:`Owner / organisation`,kind:`text`,placeholder:`acme-inc`,hint:`The org or user that owns the repos you want Coro to work in.`,required:!0},{key:`token`,label:`Personal access token`,kind:`secret`,placeholder:`ghp_… or github_pat_…`,hint:`Needs the 'repo' scope (or equivalent fine-grained permissions).`,required:!0}]},{id:`bitbucket`,title:`Bitbucket`,subtitle:`bitbucket.org workspaces. Atlassian API tokens.`,step:`scm`,fields:[{key:`workspace`,label:`Workspace`,kind:`text`,placeholder:`my-workspace`,hint:`The workspace slug from your Bitbucket URL.`,required:!0},{key:`coderUsername`,label:`Username or email`,kind:`text`,placeholder:`you@example.com`,hint:`Username for the agent account that will push commits.`,required:!0},{key:`coderToken`,label:`API token`,kind:`secret`,placeholder:`ATATT…`,hint:`Atlassian API token from id.atlassian.com/manage-profile/security/api-tokens.`,required:!0}]},{id:`jira`,title:`Jira`,subtitle:`Atlassian Cloud or Data Center. API token auth.`,step:`tracker`,fields:[{key:`baseUrl`,label:`Base URL`,kind:`url`,placeholder:`https://acme.atlassian.net`,required:!0},{key:`username`,label:`Email`,kind:`text`,placeholder:`you@example.com`,required:!0},{key:`apiToken`,label:`API token`,kind:`secret`,placeholder:`ATATT…`,required:!0}]},{id:`linear`,title:`Linear`,subtitle:`Linear API key. Fast issue tracker for product teams.`,step:`tracker`,fields:[{key:`apiKey`,label:`API key`,kind:`secret`,placeholder:`lin_api_…`,hint:`Generate in Linear → Settings → API → Personal API keys.`,required:!0},{key:`teamKey`,label:`Default team key`,kind:`text`,placeholder:`ENG`,hint:`Optional. Picks the team Coro files issues against when a job doesn't specify one.`}]},{id:`github-issues`,title:`GitHub Issues`,subtitle:`Reuse your GitHub credentials to track work in repo issues.`,step:`tracker`,fields:[{key:`defaultOwner`,label:`Owner / organisation`,kind:`text`,placeholder:`acme-inc`,required:!0},{key:`token`,label:`Personal access token`,kind:`secret`,placeholder:`ghp_…`,hint:`Needs the 'repo' scope. The same token used for source control works.`,required:!0}]}];function Nv(e){return Mv.filter(t=>t.step===e)}function Pv(e,t,n){if(e===`llm`)return{url:`/test/llm`,body:{provider:t,config:n}};if(e===`scm`)return t===`github`?{url:`/test/git`,body:{provider:`github`,username:String(n.owner??``),token:String(n.token??``),workspace:String(n.owner??``)}}:t===`bitbucket`?{url:`/test/git`,body:{provider:`bitbucket`,username:String(n.coderUsername??``),token:String(n.coderToken??``),workspace:String(n.workspace??``)}}:null;if(e===`tracker`){if(t===`jira`)return{url:`/test/tracker`,body:{provider:`jira`,jira:{baseUrl:String(n.baseUrl??``),username:String(n.username??``),apiToken:String(n.apiToken??``)}}};if(t===`linear`)return{url:`/test/tracker`,body:{provider:`linear`,linear:{apiKey:String(n.apiKey??``),teamKey:String(n.teamKey??``)}}};if(t===`github-issues`)return{url:`/test/tracker`,body:{provider:`github`,git:{provider:`github`,username:String(n.defaultOwner??``),token:String(n.token??``),workspace:String(n.defaultOwner??``)}}}}return null}function Fv({state:e,dispatch:t,onOpenDrawer:n}){let r=Nv(`llm`),i=e.selectedProviderId,a=r.find(e=>e.id===i);return(0,G.jsxs)(w_,{eyebrow:`Step 1 of 3`,title:`Which model should power Coro?`,description:`Coro uses an LLM to plan, write code, and review changes. Pick one to start — you can switch or add more later in Settings.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,recommended:e.recommended,selected:i===e.id,onSelect:()=>t({type:`selectProvider`,step:`llm`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need something else? Browse custom executor plugins`]})]}),a&&a.authMode===`anthropic`?(0,G.jsx)(Iv,{state:e,dispatch:t}):null,a&&a.authMode===`apiKey`?(0,G.jsx)(Rv,{state:e,dispatch:t,provider:a}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}function Iv({state:e,dispatch:t}){let n=e.draftConfig,r=n.method??`claudeLogin`,i=n.apiKey??``,a=n.account,[o,s]=(0,x.useState)({status:`idle`}),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a&&o.status===`idle`&&s({status:`connected`,account:a})},[a,o.status]),(0,x.useEffect)(()=>{if(o.status!==`authorizing`)return;let e=window.setInterval(async()=>{try{let e=await q(`/config/anthropic/claude-login/status`);if(e.status===`idle`)return;s(e),e.status===`connected`&&e.account&&(t({type:`setField`,step:`llm`,key:`method`,value:`claudeLogin`}),t({type:`setField`,step:`llm`,key:`account`,value:e.account}))}catch{}},2e3);return()=>window.clearInterval(e)},[o.status,t]);function m(e){t({type:`setField`,step:`llm`,key:`method`,value:e}),d(null)}async function h(){l(!0),d(null);try{let e=await q(`/config/anthropic/claude-login/start`,{method:`POST`});if(s(e),t({type:`setField`,step:`llm`,key:`method`,value:`claudeLogin`}),e.account&&t({type:`setField`,step:`llm`,key:`account`,value:e.account}),e.status===`authorizing`&&(e.automaticUrl||e.manualUrl)&&window.open(e.automaticUrl??e.manualUrl,`_blank`,`noopener,noreferrer`),e.status===`error`)throw Error(e.error??`Claude login failed to start.`)}catch(e){d(e instanceof K||e instanceof Error?e.message:String(e))}finally{l(!1)}}async function g(){p(!0),t({type:`beginTest`,step:`llm`});try{let n=await q(`/test/llm`,J({provider:`anthropic`,config:e.draftConfig},{method:`POST`}));t({type:`testResult`,step:`llm`,result:{ok:n.ok,message:n.message??(n.ok?`Authenticated.`:`Test failed.`),...n.hint?{hint:n.hint}:{}}})}catch(e){t({type:`testResult`,step:`llm`,result:{ok:!1,message:e instanceof Error?e.message:String(e)}})}finally{p(!1)}}let _=o.status===`connected`||!!a,v=r===`claudeLogin`?_:r===`apiKey`?i.length>0:!1;return(0,G.jsxs)(`div`,{className:`space-y-3.5 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`How should we authenticate?`})}),(0,G.jsxs)(`div`,{className:`inline-flex rounded-xl border border-line bg-canvas/40 p-1 text-sm`,children:[(0,G.jsx)(Lv,{active:r===`claudeLogin`,onClick:()=>m(`claudeLogin`),label:`Claude login`,badge:`Recommended`}),(0,G.jsx)(Lv,{active:r===`apiKey`,onClick:()=>m(`apiKey`),label:`API key`})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,r===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-line bg-canvas/30 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(jv,{status:o.status===`connected`||a?`ok`:o.status===`authorizing`?`pending`:o.status===`error`?`error`:`unset`,label:o.status===`connected`||a?`Connected`:o.status===`authorizing`?`Waiting for browser…`:o.status===`error`?`Failed`:`Not connected`}),(o.account??a)?.email?(0,G.jsx)(`span`,{className:`truncate text-sm text-fg-muted`,children:(o.account??a)?.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void h(),disabled:c,children:c?`Starting…`:_?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-fg-subtle`,children:`Uses Claude Code's local login session — no token to manage. Best path for Claude subscribers.`})]}):(0,G.jsx)(Sv,{label:`Anthropic API key`,hint:`From console.anthropic.com.`,required:!0,children:(0,G.jsx)(Cv,{value:i,placeholder:`sk-ant-…`,onChange:e=>t({type:`setField`,step:`llm`,key:`apiKey`,value:e.target.value})})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void g(),disabled:!v||f,children:[(0,G.jsx)(Jr,{}),f?`Testing…`:`Test connection`]})})]})}function Lv({active:e,onClick:t,label:n,badge:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:e?`inline-flex items-center gap-2 rounded-lg bg-accent-500/15 px-3 py-1.5 font-medium text-accent-200 ring-1 ring-accent-500/30`:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-fg-muted hover:text-fg`,children:[n,r?(0,G.jsx)(`span`,{className:`rounded-full bg-overlay/60 px-1.5 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:r}):null]})}function Rv({state:e,dispatch:t,provider:n}){let[r,i]=(0,x.useState)(!1);async function a(){i(!0),t({type:`beginTest`,step:`llm`});try{let r=await q(`/test/llm`,J({provider:n.id,config:e.draftConfig},{method:`POST`}));t({type:`testResult`,step:`llm`,result:{ok:r.ok,message:r.message??(r.ok?`Authenticated.`:`Test failed.`),...r.hint?{hint:r.hint}:{}}})}catch(e){t({type:`testResult`,step:`llm`,result:{ok:!1,message:e instanceof Error?e.message:String(e)}})}finally{i(!1)}}let o=n.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(wv,{provider:n,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`llm`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void a(),disabled:!o||r,children:[(0,G.jsx)(Jr,{}),r?`Testing…`:`Test connection`]})})]})}function zv({state:e,dispatch:t,onOpenDrawer:n}){let r=Nv(`scm`),i=e.selectedProviderId,a=r.find(e=>e.id===i),[o,s]=(0,x.useState)(!1);async function c(){if(!a)return;let n=Pv(`scm`,a.id,e.draftConfig);if(!n){t({type:`testResult`,step:`scm`,result:{ok:!1,message:`This plugin has no built-in connectivity test.`}});return}s(!0),t({type:`beginTest`,step:`scm`});try{let e=await q(n.url,J(n.body,{method:`POST`}));t({type:`testResult`,step:`scm`,result:{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Test failed.`),...e.hint?{hint:e.hint}:{},...e.checks?{checks:e.checks}:{}}})}catch(e){t({type:`testResult`,step:`scm`,result:{ok:!1,message:e instanceof K||e instanceof Error?e.message:String(e)}})}finally{s(!1)}}let l=!!a&&a.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(w_,{eyebrow:`Step 2 of 3`,title:`Where does your code live?`,description:`Coro clones repositories, opens branches, and submits pull requests on your behalf. Connect a git host so the agents can push their work.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,selected:i===e.id,onSelect:()=>t({type:`selectProvider`,step:`scm`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need GitLab or something else? Browse custom plugins`]})]}),a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wv,{provider:a,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`scm`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void c(),disabled:!l||o,children:[(0,G.jsx)(Ti,{}),o?`Testing…`:`Test connection`]})})]}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}function Bv({state:e,dispatch:t,onSkip:n,onOpenDrawer:r}){let i=Nv(`tracker`),a=e.selectedProviderId,o=i.find(e=>e.id===a),s=a===`__skip__`,[c,l]=(0,x.useState)(!1);async function u(){if(!o)return;let n=Pv(`tracker`,o.id,e.draftConfig);if(!n){t({type:`testResult`,step:`tracker`,result:{ok:!1,message:`This plugin has no built-in connectivity test.`}});return}l(!0),t({type:`beginTest`,step:`tracker`});try{let e=await q(n.url,J(n.body,{method:`POST`}));t({type:`testResult`,step:`tracker`,result:{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Test failed.`),...e.hint?{hint:e.hint}:{}}})}catch(e){t({type:`testResult`,step:`tracker`,result:{ok:!1,message:e instanceof K||e instanceof Error?e.message:String(e)}})}finally{l(!1)}}let d=!!o&&o.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(w_,{eyebrow:`Step 3 of 3 — optional`,title:`Where do your tickets live?`,description:`Optional. Connect a tracker so Coro can pick up assigned tickets and report progress back. You can skip this and add it later from Settings.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,selected:a===e.id,onSelect:()=>t({type:`selectProvider`,step:`tracker`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{t({type:`selectProvider`,step:`tracker`,providerId:`__skip__`}),t({type:`skip`,step:`tracker`}),n()},"aria-pressed":s,className:W(`group flex w-full items-start gap-4 rounded-2xl border bg-overlay/30 px-4 py-4 text-left transition-all`,`hover:bg-overlay/60 hover:border-accent-500/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,s?`border-accent-500/55 bg-accent-500/8`:`border-line border-dashed`),children:[(0,G.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-overlay/60 ring-1 ring-line text-fg-muted`,children:(0,G.jsx)(ir,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:`I don't use a tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-[13px] leading-relaxed text-fg-muted`,children:`Skip this step. You can wire up Jira, Linear, or GitHub Issues later in Settings.`})]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need something else? Browse custom tracker plugins`]})]}),o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wv,{provider:o,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`tracker`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void u(),disabled:!d||c,children:[(0,G.jsx)(Ti,{}),c?`Testing…`:`Test connection`]})})]}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}var Vv={selectedProviderId:null,draftConfig:{},status:`idle`,lastResult:null},Hv={currentStep:`welcome`,steps:{llm:{...Vv,draftConfig:{}},scm:{...Vv,draftConfig:{}},tracker:{...Vv,draftConfig:{}}},drawerOpen:!1,drawerForStep:null};function Uv(e,t){switch(t.type){case`goto`:return{...e,currentStep:t.step};case`selectProvider`:return e.steps[t.step].selectedProviderId===t.providerId?e:{...e,steps:{...e.steps,[t.step]:{...Vv,selectedProviderId:t.providerId}}};case`setField`:{let n=e.steps[t.step],r={...n.draftConfig};return t.value===``||t.value===void 0||t.value===null?delete r[t.key]:r[t.key]=t.value,{...e,steps:{...e.steps,[t.step]:{...n,draftConfig:r,status:`idle`,lastResult:null}}}}case`beginTest`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:`testing`}}}}case`testResult`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:t.result.ok?`passed`:`failed`,lastResult:t.result}}}}case`skip`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:`skipped`,lastResult:null}}}}case`openDrawer`:return{...e,drawerOpen:!0,drawerForStep:t.step};case`closeDrawer`:return{...e,drawerOpen:!1,drawerForStep:null};default:return e}}var Wv=[`llm`,`scm`];function Gv(e){return Wv.some(t=>e.steps[t].status===`skipped`)}var Kv={passed:{icon:fr,classes:`border-success-500/30 bg-success-500/10 text-success-300`,label:`Verified`},skipped:{icon:Mi,classes:`border-warning-500/30 bg-warning-500/10 text-warning-300`,label:`Skipped`},failed:{icon:Mi,classes:`border-danger-500/30 bg-danger-500/10 text-danger-300`,label:`Failed`},idle:{icon:Mi,classes:`border-line bg-overlay/60 text-fg-subtle`,label:`Not configured`},testing:{icon:Mi,classes:`border-line bg-overlay/60 text-fg-subtle`,label:`Pending`}};function qv({wizardState:e,onFinish:t}){let n=Gv(e);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-success-500/30 bg-success-500/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-success-300`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`Setup complete`]}),(0,G.jsx)(`h2`,{className:`text-balance text-2xl font-semibold tracking-tight text-fg`,children:n?`You're almost there`:`You're ready to run your first job`}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:n?`You can finish later from Settings. Until then, jobs that need the skipped piece will fail at dispatch.`:`Here is a quick recap. Below is how Coro works at a glance so you know what to do next.`})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:[{id:`llm`,icon:ar,label:`LLM provider`},{id:`scm`,icon:Vr,label:`Code host`},{id:`tracker`,icon:Oi,label:`Issue tracker (optional)`}].map(t=>{let n=e.steps[t.id],r=Kv[n.status],i=r.icon,a=t.icon;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-9 items-center justify-center rounded-xl bg-overlay/60 ring-1 ring-line text-fg-muted`,children:(0,G.jsx)(a,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.label}),(0,G.jsx)(`div`,{className:`truncate text-[12px] text-fg-muted`,children:n.selectedProviderId&&n.selectedProviderId!==`__skip__`?n.selectedProviderId:`Not configured`})]})]}),(0,G.jsxs)(`span`,{className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.14em]`,r.classes),children:[(0,G.jsx)(i,{className:`size-3.5`}),r.label]})]},t.id)})}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-5`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`How Coro works`}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,G.jsx)(Jv,{icon:gr,title:`Jobs and workflows`,body:`Coro runs each job through a workflow of phases — plan, code, review, evaluate. Every phase is an LLM agent with the right tools and skills.`}),(0,G.jsx)(Jv,{icon:Yr,title:`Layered intelligence`,body:`Out of the box you get the base intelligence. Add tenant- and repo-specific knowledge later from Settings → Intelligence.`}),(0,G.jsx)(Jv,{icon:Pr,title:`Watch and steer`,body:`Open the dashboard for live logs, proposed PRs, and approvals. You're always one click away from steering or pausing a run.`})]})]}),n?(0,G.jsx)(`div`,{className:`rounded-2xl border border-warning-500/30 bg-warning-500/8 p-5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(Mi,{className:`size-5 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Finish the required setup to run jobs`}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Jobs need an LLM and a code host to do their work. Finish the steps you skipped in Settings, then come back to dispatch your first job.`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/settings`,onClick:()=>t(`settings`),children:[(0,G.jsx)(xi,{}),`Finish setup in Settings`,(0,G.jsx)(rr,{})]})}),(0,G.jsx)(Y,{asChild:!0,variant:`ghost`,onClick:()=>t(`dashboard`),children:(0,G.jsx)(Dn,{to:`/`,children:`Go to dashboard`})})]})]})]})}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,G.jsx)(Y,{asChild:!0,variant:`ghost`,onClick:()=>t(`dashboard`),children:(0,G.jsx)(Dn,{to:`/`,children:`Go to dashboard`})}),(0,G.jsx)(Y,{asChild:!0,onClick:()=>t(`newJob`),children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[(0,G.jsx)(gr,{}),`Create my first job`,(0,G.jsx)(rr,{})]})})]})]})}function Jv({icon:e,title:t,body:n}){return(0,G.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-line bg-canvas/40 p-3.5`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-lg bg-accent-500/12 ring-1 ring-accent-500/25 text-accent-200`,children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`div`,{className:`text-[12px] leading-relaxed text-fg-muted`,children:n})]})}var Yv={llm:`executor`,scm:`scm`,tracker:`tracker`},Xv={llm:`LLM`,scm:`source-control`,tracker:`tracker`};function Zv({step:e,onClose:t}){let n=Yv[e],[r,i]=(0,x.useState)([]),[a,o]=(0,x.useState)(!0),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(null);async function h(){o(!0);try{i((await q(`/plugins`)).plugins.filter(e=>e.manifest.kind===n))}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}}(0,x.useEffect)(()=>{h()},[n]);async function g(e){e.preventDefault(),f(null),m(null);let t=s.trim();if(!t){f("Enter an npm package name, e.g. `@coro-ai/plugin-gitlab`.");return}u(!0);try{await q(`/plugins/install`,J({spec:t},{method:`POST`})),m(`Installed ${t}. The plugin is live — pick it from the provider list to configure it.`),c(``),await h()}catch(e){f(e instanceof K||e instanceof Error?e.message:String(e))}finally{u(!1)}}let _=r.filter(e=>e.source===`dropin`),v=r.filter(e=>e.source===`builtin`).map(e=>e.manifest.displayName).join(`, `);return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-sm text-fg-muted hover:text-fg`,children:[(0,G.jsx)(nr,{className:`size-4`}),`Back to step`]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-fg-subtle`,children:[`Custom `,Xv[e],` plugins`]}),(0,G.jsx)(`h2`,{className:`text-balance text-xl font-semibold tracking-tight text-fg`,children:`Install something the built-ins don't cover`}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:`Coro plugins are regular npm packages. Anything installed here shows up alongside the built-ins as a selectable option in the wizard.`}),v?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-subtle`,children:[`Built-in `,Xv[e],` options: `,v,`.`]}):null]}),d?(0,G.jsx)(Ov,{tone:`danger`,children:d}):null,p?(0,G.jsx)(Ov,{tone:`success`,children:p}):null,(0,G.jsxs)(`form`,{onSubmit:g,className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(Sv,{label:`Install from npm`,hint:`The runner downloads the package into ~/.coro/plugins/ and registers it on next refresh.`,children:(0,G.jsx)(O_,{value:s,onChange:e=>c(e.target.value),placeholder:`@coro-ai/plugin-gitlab (or any npm spec)`,autoComplete:`off`,spellCheck:!1,disabled:l})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsx)(Y,{type:`submit`,disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),` Installing…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ri,{}),`Install plugin`]})})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Already installed`}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(),disabled:a,children:[(0,G.jsx)(mi,{}),`Refresh`]})]}),a?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 px-3 py-4 text-sm text-fg-subtle`,children:`Loading…`}):_.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-line bg-overlay/20 px-3 py-4 text-sm text-fg-subtle`,children:`No drop-in plugins yet. Install one above to see it here.`}):(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:_.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-xl border border-line bg-overlay/30 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.manifest.displayName}),(0,G.jsxs)(`div`,{className:`truncate text-[12px] text-fg-subtle`,children:[e.manifest.id,` · v`,e.manifest.version]})]}),(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`})]},e.manifest.id))})]})]})}var Qv=[`welcome`,`llm`,`scm`,`tracker`,`success`];function $v({open:e,onOpenChange:t}){let{markFirstRunComplete:n,commitWizardStep:r,reloadPlugins:i,draft:a,pluginsCatalogue:o}=y_(),[s,c]=(0,x.useReducer)(Uv,Hv),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),h=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(!e){h.current=!1;return}if(h.current||!o)return;h.current=!0;let t=a.llmDefaultProvider;if(t&&a.pluginInstalled[t]){c({type:`selectProvider`,step:`llm`,providerId:t});for(let[e,n]of Object.entries(a.pluginInstalled[t].config))c({type:`setField`,step:`llm`,key:e,value:n})}let n=Object.entries(a.pluginInstalled).filter(([e,t])=>t.enabled!==!1&&o.plugins.find(t=>t.manifest.id===e)?.manifest.kind===`scm`),r=n.find(([e])=>e===a.pluginDefaultScm)??n[0];if(r){c({type:`selectProvider`,step:`scm`,providerId:r[0]});for(let[e,t]of Object.entries(r[1].config))c({type:`setField`,step:`scm`,key:e,value:t})}let i=Object.entries(a.pluginInstalled).filter(([e,t])=>t.enabled!==!1&&o.plugins.find(t=>t.manifest.id===e)?.manifest.kind===`tracker`),s=i.find(([e])=>e===a.pluginDefaultTracker)??i[0];if(s){c({type:`selectProvider`,step:`tracker`,providerId:s[0]});for(let[e,t]of Object.entries(s[1].config))c({type:`setField`,step:`tracker`,key:e,value:t})}},[e,a,o]);let g=Qv.indexOf(s.currentStep),_=s.currentStep===`success`,v=(0,x.useCallback)(e=>{f(null),c({type:`goto`,step:e})},[]),y=(0,x.useCallback)(()=>{f(null);let e=Qv[Math.max(0,g-1)];v(e)},[v,g]),b=(0,x.useCallback)(()=>{typeof window<`u`&&window.localStorage.getItem(`coro.firstRun.completed`)!==`true`&&window.localStorage.setItem(`coro.firstRun.dismissed`,`true`),t(!1)},[t]),S=(0,x.useCallback)(async()=>{f(null);let e=s.currentStep,t=e===`llm`?`llm`:e===`scm`?`scm`:e===`tracker`?`tracker`:null;if(t&&s.steps[t].status===`passed`){let e=s.steps[t].selectedProviderId;if(e&&e!==`__skip__`){u(!0);try{await r({kind:t===`llm`?`executor`:t,pluginId:e,config:s.steps[t].draftConfig,setAsDefault:!0})}catch(e){f(e instanceof Error?e.message:String(e)),u(!1);return}finally{u(!1)}}}let n=Qv[Math.min(Qv.length-1,g+1)];v(n)},[s,g,v,r]),C=(0,x.useCallback)(()=>{f(null);let e=s.currentStep;(e===`llm`||e===`scm`||e===`tracker`)&&c({type:`skip`,step:e});let t=Qv[Math.min(Qv.length-1,g+1)];v(t)},[s.currentStep,g,v]),w=(0,x.useCallback)(async e=>{m(!0);try{let e=[];s.steps.llm.status===`skipped`&&e.push(`llm`),s.steps.scm.status===`skipped`&&e.push(`scm`),s.steps.tracker.status===`skipped`&&e.push(`tracker`),await n({skipped:e})}finally{m(!1),t(!1)}},[n,t,s.steps]),T=s.drawerForStep,E=s.drawerOpen&&T!==null,D=s.currentStep===`llm`?`llm`:s.currentStep===`scm`?`scm`:s.currentStep===`tracker`?`tracker`:null,O=D?s.steps[D]:null,k=O?O.status===`passed`:!0,A=null;if(E&&T)A=(0,G.jsx)(Zv,{step:T,onClose:()=>{i(),c({type:`closeDrawer`})}});else switch(s.currentStep){case`welcome`:A=(0,G.jsx)(C_,{});break;case`llm`:A=(0,G.jsx)(Fv,{state:s.steps.llm,dispatch:c,onOpenDrawer:()=>c({type:`openDrawer`,step:`llm`})});break;case`scm`:A=(0,G.jsx)(zv,{state:s.steps.scm,dispatch:c,onOpenDrawer:()=>c({type:`openDrawer`,step:`scm`})});break;case`tracker`:A=(0,G.jsx)(Bv,{state:s.steps.tracker,dispatch:c,onSkip:()=>{let e=Qv[Math.min(Qv.length-1,g+1)];v(e)},onOpenDrawer:()=>c({type:`openDrawer`,step:`tracker`})});break;case`success`:A=(0,G.jsx)(qv,{wizardState:s,onFinish:w});break}let j=s.currentStep===`welcome`;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex flex-col gap-0 max-h-[min(760px,calc(100vh-2rem))]`,children:[j?(0,G.jsxs)(f_,{className:`sr-only`,children:[(0,G.jsx)(p_,{children:`Welcome to Coro`}),(0,G.jsx)(m_,{children:`First-time setup`})]}):(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3 pr-10`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(p_,{children:_?`You are set!`:`First-time setup`}),(0,G.jsx)(m_,{children:_?`Recap of what you just configured and what to do next.`:`Configure the essentials — one minute, three steps.`})]})}),(0,G.jsx)(ey,{currentStep:s.currentStep,wizardState:s})]}),j?(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:A}):(0,G.jsxs)(h_,{className:`flex-1 min-h-0 space-y-5 pt-4`,children:[d?(0,G.jsxs)(`div`,{className:`rounded-xl border border-danger-500/35 bg-danger-500/8 px-3 py-2.5 text-sm text-danger-300`,children:[`Could not save the step: `,d]}):null,A]}),!_&&!E?(0,G.jsxs)(`div`,{className:`shrink-0 flex flex-wrap items-center justify-between gap-3 border-t border-line bg-overlay/30 px-6 py-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:!j&&D?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:C,disabled:l,children:`Skip for now`}):null}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:y,disabled:j||l,children:[(0,G.jsx)(nr,{}),`Back`]}),j?null:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,disabled:l,children:`Close — finish later`}),(0,G.jsx)(Y,{type:`button`,onClick:()=>void S(),disabled:(D?!k:!1)||l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),` Saving…`]}):j?(0,G.jsxs)(G.Fragment,{children:[`Let's get started `,(0,G.jsx)(rr,{})]}):(0,G.jsxs)(G.Fragment,{children:[`Continue `,(0,G.jsx)(rr,{})]})})]})]}):null,_?(0,G.jsx)(`div`,{className:`shrink-0 border-t border-line bg-overlay/30 px-6 py-4 text-[12px] text-fg-subtle`,children:p?`Saving your setup…`:Gv(s)?`Click "Finish setup in Settings" to wrap up the remaining required pieces.`:`Click "Create my first job" to dispatch a run.`}):null]})})}function ey({currentStep:e,wizardState:t}){let n=[{id:`llm`,label:`Model`,kind:`llm`},{id:`scm`,label:`Code host`,kind:`scm`},{id:`tracker`,label:`Tracker`,kind:`tracker`}],r=Qv,i=r.indexOf(e);return(0,G.jsx)(`ol`,{className:`mt-4 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:n.map(({id:e,label:n,kind:a})=>{let o=r.indexOf(e),s=o===i,c=a?t.steps[a].status===`passed`:o<i,l=a?t.steps[a].status===`skipped`:!1,u=c||l||o<i;return(0,G.jsxs)(`li`,{className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 transition-colors`,s?`border-accent-500/45 bg-accent-500/10 text-fg`:c?`border-success-500/30 bg-success-500/8 text-success-300`:l?`border-warning-500/25 bg-warning-500/8 text-warning-300`:`border-line bg-overlay/40`),children:[(0,G.jsx)(`span`,{className:W(`inline-block size-1.5 rounded-full`,s?`bg-accent-400`:u?`bg-success-400`:`bg-fg-subtle/60`)}),(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.14em]`,children:n})]},e)})})}function ty(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ny(e,t,n){let r=e.pluginInstalled[n];if(!r||r.enabled===!1)return!1;let i=t?.manifest.configSchema;return ty(i)&&Array.isArray(i.required)?i.required.every(e=>{let t=r.config[e];return typeof t==`string`?t.length>0:t!=null}):Object.keys(r.config).length>0}var ry=[`github`,`bitbucket`,`gitlab`],iy=[`jira`,`linear`,`github-issues`],ay=[`anthropic`];function oy({draft:e,pluginsCatalogue:t}){let n=t?.plugins.filter(e=>e.manifest.kind===`executor`)??[],r=e=>t?n.some(t=>t.manifest.id===e):ay.includes(e),i=e.llmDefaultProvider||(()=>{let t=n.filter(t=>e.pluginInstalled[t.manifest.id]?.enabled===!1?!1:ny(e,t,t.manifest.id));return t.length===1||t.length>1?t[0].manifest.id:n.find(t=>e.pluginInstalled[t.manifest.id]?.enabled!==!1)?.manifest.id??n[0]?.manifest.id??``})(),a=n.find(e=>e.manifest.id===i),o=!!i&&r(i)&&ny(e,a,i),s=i?o?`${a?.manifest.displayName??i} configured`:`${a?.manifest.displayName??i} needs configuration`:`No LLM provider selected`,c=t?.plugins.filter(e=>e.manifest.kind===`scm`)??[],l=t?.plugins.filter(e=>e.manifest.kind===`tracker`)??[],u=e=>t?c.some(t=>t.manifest.id===e):ry.includes(e),d=e=>t?l.some(t=>t.manifest.id===e):iy.includes(e),f=Object.entries(e.pluginInstalled).filter(([t,n])=>n.enabled===!1||!u(t)?!1:ny(e,c.find(e=>e.manifest.id===t),t)).map(([e])=>e),p=f.length>0,m=p?f.length===1?`${f[0]} configured`:`${f.length} SCM plugins configured (default: ${e.pluginDefaultScm||f[0]})`:`No source-control plugin enabled`,h=Object.entries(e.pluginInstalled).filter(([t,n])=>n.enabled===!1||!d(t)?!1:ny(e,l.find(e=>e.manifest.id===t),t)).map(([e])=>e),g=`optional`,_=`No tracker plugin enabled`;h.length>0?(g=`ok`,_=h.length===1?`${h[0]} configured`:`${h.length} tracker plugins configured (default: ${e.pluginDefaultTracker||h[0]})`):Object.entries(e.pluginInstalled).some(([t,n])=>n.enabled===!1||!d(t)?!1:!ny(e,l.find(e=>e.manifest.id===t),t))&&(g=`warn`,_=`Tracker plugin enabled but required fields are missing`);let v=(()=>{try{let t=JSON.parse(e.mcpServersText),n=t&&typeof t==`object`?Object.keys(t).length:0;return n===0?`No BYO servers configured`:`${n} server${n===1?``:`s`} configured`}catch{return`Invalid JSON`}})(),y={general:{status:`optional`,detail:`Coach mode and Coro plan mode preferences`},"llm-provider":{status:o?`ok`:`warn`,label:o?`Connected`:`Needs setup`,detail:s},"source-control":{status:p?`ok`:`warn`,label:p?`Connected`:`Needs setup`,detail:m},"issue-tracker":{status:g,detail:_},plugins:{status:`optional`,detail:`Drop-in plugin install + uninstall`},mcp:{status:`optional`,detail:v},paths:{status:`optional`,detail:`Using resolved defaults unless overridden`},guardrails:{status:`optional`,detail:e.guardrailsEnabled?`${e.guardrailRules.filter(e=>e.enabled).length} rule(s) active`:`Disabled`}},b=[];return o||b.push(`llm-provider`),p||b.push(`source-control`),{byId:y,ready:b.length===0,missingRequired:b}}var sy={enabled:!0,graduateAfterRuns:5};function cy(e){return{enabled:e?.enabled??sy.enabled,graduateAfterRuns:e?.graduateAfterRuns??sy.graduateAfterRuns,totalRuns:e?.totalRuns??0,lastRunAt:e?.lastRunAt??``,graduatedAt:e?.graduatedAt??``}}function ly(e){let t=cy(e);return t.enabled&&!t.graduatedAt}function uy(e){let t=cy(e);return t.enabled&&!t.graduatedAt&&t.totalRuns<t.graduateAfterRuns}function dy(e){let t=cy(e);return t.enabled&&!t.graduatedAt&&t.totalRuns>=t.graduateAfterRuns}function fy(e){return ly(e)?`ai`:`form`}function py(e,t){return e?.mode??fy(t)}var my=`coro.intake.modeChoice`,hy=`coro.intake.askEachTimeChoice`;function gy(){if(typeof window>`u`)return null;let e=window.sessionStorage.getItem(my);return e===`ai`||e===`form`?e:null}function _y(e){typeof window>`u`||window.sessionStorage.setItem(my,e)}function vy(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(hy);return e===`ai`||e===`form`?e:null}function yy(e){typeof window>`u`||window.localStorage.setItem(hy,e)}var by=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}),xy=new Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1}),Sy=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2});function Cy(e){let t=e instanceof Date?e:new Date(e),n=Math.round((t.getTime()-Date.now())/1e3),r=[{limit:60,unit:`second`,divisor:1},{limit:3600,unit:`minute`,divisor:60},{limit:86400,unit:`hour`,divisor:3600},{limit:604800,unit:`day`,divisor:86400},{limit:2629800,unit:`week`,divisor:604800},{limit:31557600,unit:`month`,divisor:2629800}],i=Math.abs(n);for(let e of r)if(i<e.limit)return by.format(Math.round(n/e.divisor),e.unit);return by.format(Math.round(n/31557600),`year`)}function wy(e){return e===0?`0`:e<1e3?e.toLocaleString(`en-US`):xy.format(e)}function Ty(e){return xy.format(e)}function Ey(e){return e==null?`—`:Math.abs(e)<.01?`$${e.toFixed(4)}`:Sy.format(e)}function Dy(e){if(!e)return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Oy(e){let t=e instanceof Date?e:new Date(e);return new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function ky(e){return e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ay(e){return e.workflowPath===`workflows/campaign/workflow.md`||Array.isArray(e.campaignChildren)}function jy(e){let t=e.split(`/`).filter(Boolean),n=t.length>=2?t[t.length-2]:t[t.length-1];return n?ky(n):`Workflow`}function My(e){return`/jobs/${e.id}`}function Ny(e){let t=typeof e.params.serviceName==`string`?e.params.serviceName:null,n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null,r=typeof e.params.jiraTicketId==`string`?e.params.jiraTicketId:null;return t??n??r??e.id}function Py(e){let t=typeof e.params.description==`string`?e.params.description:null;return t&&t.trim().length>0?t:null}function Fy(e){let t=e.params.reviewers;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function Iy(e){let t=e.params.repoSlug;return typeof t==`string`&&t.length>0?t:null}function Ly(e){return e.currentWorkItem??`Waiting for the next action`}function Ry(e){return[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}var zy={singular:`Run`,singularLower:`run`,plural:`Runs`,pluralLower:`runs`},By={singular:`Sub-run`,singularLower:`sub-run`,plural:`Sub-runs`,pluralLower:`sub-runs`},Vy={runsList:`Runs`,runsListDescription:`All ${zy.pluralLower} in one place. Filter by workflow or status to change the lens.`,history:`History`,overview:`Overview`,newRun:`New ${zy.singularLower}`,backToRuns:`Back to ${zy.pluralLower}`},Hy={activeRuns:`Active ${zy.pluralLower}`,activeWithSubRuns:`${zy.pluralLower.charAt(0).toUpperCase()+zy.pluralLower.slice(1)} hosting ${By.pluralLower}`,awaitingInput:`Awaiting your input`,recentlyFinished:`Recently finished`,emptyActive:`No active ${zy.pluralLower}. Dispatch one from the New ${zy.singularLower} button.`,emptyWithSubRuns:`No ${zy.pluralLower} are coordinating ${By.pluralLower} right now.`,emptyAwaiting:`Nothing parked for approval or a response.`,emptyHistory:`Completed and failed ${zy.pluralLower} will appear here.`},Uy={job:`job`,campaign:`campaign`,"self-update":`self-update`};function Wy(e){let t=e.split(`/`).filter(Boolean);return t.length>=2?t[t.length-2]:t[t.length-1]??`workflow`}function Gy(e){let t=Wy(e);return Uy[t]??t}function Ky(e){return Ay(e)}function qy(e){return e.campaignParentId??null}function Jy(e){let t=new Set;for(let n of e)t.add(Wy(n.workflowPath));let n=[{value:`all`,label:`All workflows`}];for(let e of Array.from(t).sort())n.push({value:e,label:Uy[e]??e});return n}function Yy(e){return Gy(e.workflowPath)}function Xy(){return`Parent ${zy.singularLower}`}var Zy=`/jobs`;function Qy({title:e,jobs:t,emptyLabel:n,icon:r}){return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`flex-row items-center justify-between gap-3 border-b border-line pb-4`,children:[(0,G.jsx)(dg,{children:e}),(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] tabular-nums text-fg-muted`,children:t.length})]}),(0,G.jsx)(pg,{className:`pt-3`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-1 py-6 text-sm text-fg-subtle`,children:[(0,G.jsx)(r,{className:`size-4 shrink-0`}),(0,G.jsx)(`span`,{children:n})]}):(0,G.jsx)(`div`,{className:`-mx-1`,children:t.map(e=>(0,G.jsxs)(Dn,{to:My(e),className:`group flex items-start gap-3 rounded-xl px-3 py-2.5 transition-colors hover:bg-overlay/60`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,children:Yy(e)}),(0,G.jsx)(yg,{status:e.status})]}),Py(e)?(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px] text-fg-muted`,children:Py(e)}):null]}),(0,G.jsx)(`div`,{className:`shrink-0 pt-1 text-[11px] text-fg-subtle`,children:Cy(e.updatedAt)})]},e.id))})})]})}function $y({setup:e,onLaunchWizard:t}){let n=e.state===`not-configured`,r=n?`Welcome to Coro — finish setup`:`Runner setup is incomplete`,i=n?`Connect your model and code host. The setup wizard walks through each step.`:`One or more essentials are missing. Finish configuration so ${zy.pluralLower} can run cleanly.`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-warning-500/25 bg-warning-500/8 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-warning-500/25 bg-warning-500/10 text-warning-400`,children:n?(0,G.jsx)(Di,{className:`size-4`}):(0,G.jsx)(Mi,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:r}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm text-fg-muted`,children:i}),e.missing.length>0?(0,G.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[`Missing: `,(0,G.jsx)(`span`,{className:`text-fg`,children:e.missing.join(`, `)})]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,onClick:t,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}),(0,G.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,G.jsxs)(Dn,{to:`/settings`,children:[(0,G.jsx)(xi,{}),`Open settings`]})})]})]})}function eb(){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl border border-success-500/30 bg-success-500/8 px-4 py-2.5 text-sm text-success-300`,children:[(0,G.jsx)(fr,{className:`size-4`}),`Runner is ready. New jobs will dispatch immediately.`]})}function tb({totalRuns:e,onTurnOff:t,onKeepOn:n}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-accent-500/25 bg-accent-500/8 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-[15px] font-semibold text-fg`,children:[`You've done `,e,` runs. Ready to fly solo?`]}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:`Coach mode pauses Coro at every checkpoint. Turn it off and Coro will run end-to-end by default — you can still flip back on for any run.`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,onClick:()=>void t(),children:`Turn off coach mode`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,onClick:()=>void n(),children:`Keep it on`})]})]})}function nb(){return(0,G.jsx)(S_,{children:(0,G.jsx)(rb,{})})}function rb(){let{jobs:e,loading:t,error:n}=Eo(),{draft:r,pluginsCatalogue:i,loading:a,firstRunCompleted:o,preferences:s,reload:c}=y_(),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),p=(0,x.useMemo)(()=>{if(a||!i)return{state:`loading`,missing:[]};let e=oy({draft:r,pluginsCatalogue:i}),t=e.byId[`llm-provider`].status===`ok`,n=e.byId[`source-control`].status===`ok`,o=[];return t||o.push(`LLM provider`),n||o.push(`Source control`),o.length===0?{state:`configured`,missing:o}:{state:Object.values(r.pluginInstalled).some(e=>e.enabled!==!1&&Object.keys(e.config??{}).length>0)||r.llmDefaultProvider?`partial`:`not-configured`,missing:o}},[r,i,a]),m=(0,x.useMemo)(()=>Ry(e),[e]),h=m.filter(e=>!jo(e.status)),g=h.filter(e=>!Ky(e)),_=h.filter(e=>Ky(e)),v=m.filter(e=>e.status===`awaiting-developer-input`),y=m.filter(e=>jo(e.status)).slice(0,5),b=h.reduce((e,t)=>e+(t.tokenUsage?.totalCostUsd??0),0);(0,x.useEffect)(()=>{d||p.state===`not-configured`&&(o||typeof window>`u`||window.localStorage.getItem(`coro.firstRun.dismissed`)!==`true`&&(u(!0),f(!0)))},[p.state,d,o]);function S(e){u(e),!e&&typeof window<`u`&&!o&&window.localStorage.setItem(`coro.firstRun.dismissed`,`true`)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.overview,description:`What's live, what needs you, and what just finished.`,actions:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[Vy.newRun,(0,G.jsx)(rr,{})]})})}),p.state!==`configured`&&p.state!==`loading`?(0,G.jsx)($y,{setup:p,onLaunchWizard:()=>u(!0)}):null,p.state===`configured`?(0,G.jsx)(eb,{}):null,dy(s?.coachMode)?(0,G.jsx)(tb,{totalRuns:s?.coachMode?.totalRuns??0,onTurnOff:async()=>{await q(`/config`,J({coachMode:{enabled:!1,graduatedAt:new Date().toISOString()}},{method:`PUT`})),await c()},onKeepOn:async()=>{await q(`/config`,J({coachMode:{graduateAfterRuns:(s?.coachMode?.totalRuns??0)+10,graduatedAt:new Date().toISOString()}},{method:`PUT`})),await c()}}):null,(0,G.jsx)($v,{open:l,onOpenChange:S}),(0,G.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,G.jsx)(hg,{label:`Active ${zy.pluralLower}`,value:h.length.toString(),description:`Across all workflows`,icon:gr,tone:`accent`}),(0,G.jsx)(hg,{label:`Hosting ${By.pluralLower}`,value:_.length.toString(),description:`${zy.plural} coordinating ${By.pluralLower}`,icon:Lr,tone:`accent`}),(0,G.jsx)(hg,{label:`Needs input`,value:v.length.toString(),description:`Waiting on developer approval`,icon:Mi,tone:v.length>0?`warning`:`neutral`}),(0,G.jsx)(hg,{label:`Live spend`,value:Ey(b),description:`Across non-terminal ${zy.pluralLower}`,icon:ar,tone:`neutral`})]}),n?(0,G.jsx)(gg,{title:`Could not load ${zy.pluralLower}`,message:n}):null,t?(0,G.jsx)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:Array.from({length:4}).map((e,t)=>(0,G.jsx)(bg,{className:`h-72 w-full`},t))}):(0,G.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,G.jsx)(Qy,{title:Hy.activeRuns,jobs:g.slice(0,5),emptyLabel:Hy.emptyActive,icon:gr}),(0,G.jsx)(Qy,{title:Hy.activeWithSubRuns,jobs:_.slice(0,5),emptyLabel:Hy.emptyWithSubRuns,icon:Lr}),(0,G.jsx)(Qy,{title:Hy.awaitingInput,jobs:v.slice(0,5),emptyLabel:Hy.emptyAwaiting,icon:Kr}),(0,G.jsx)(Qy,{title:Hy.recentlyFinished,jobs:y,emptyLabel:Hy.emptyHistory,icon:ar})]})]})}function ib({icon:e,title:t,description:n,action:r,className:i}){return(0,G.jsx)(lg,{className:W(`border-dashed border-line-strong bg-transparent shadow-none`,i),children:(0,G.jsxs)(pg,{className:`flex flex-col items-center justify-center gap-4 py-12 text-center`,children:[(0,G.jsx)(`div`,{className:`rounded-2xl border border-line-strong bg-overlay p-3 text-fg-muted`,children:(0,G.jsx)(e,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:t}),(0,G.jsx)(`p`,{className:`mx-auto max-w-md text-sm text-fg-muted`,children:n})]}),r]})})}function ab({options:e,value:t,onChange:n,size:r=`md`,className:i,ariaLabel:a}){let o=r===`sm`?`px-2.5 py-1 text-[12px]`:`px-3 py-1.5 text-sm`;return(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":a,className:W(`inline-flex items-center gap-1 rounded-full border border-line bg-overlay/60 p-1`,i),children:e.map(e=>{let r=e.value===t;return(0,G.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,onClick:()=>n(e.value),className:W(`rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,o,r?`bg-panel-raised text-fg shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`:`text-fg-muted hover:text-fg`),children:e.label},e.value)})})}var ob=[{value:`all`,label:`All outcomes`},{value:`cancelled`,label:`Cancelled`},{value:`complete`,label:`Complete`},{value:`failed`,label:`Failed`},{value:`escalated`,label:`Escalated`}];function sb(){let{jobs:e,loading:t,error:n}=Eo(),[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(`all`),[s,c]=(0,x.useState)(`all`),[l,u]=(0,x.useState)(()=>new Set),d=(0,x.useMemo)(()=>Ry(e.filter(e=>jo(e.status))),[e]),f=(0,x.useMemo)(()=>Jy(d),[d]),p=(0,x.useMemo)(()=>{let e=r.trim().toLowerCase();return t=>a!==`all`&&Wy(t.workflowPath)!==a||s!==`all`&&t.status!==s?!1:e?[t.id,Ny(t),Py(t),t.phase].filter(Boolean).join(` `).toLowerCase().includes(e):!0},[r,a,s]),m=(0,x.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),h=(0,x.useMemo)(()=>{let e=new Map;for(let t of d){let n=qy(t);if(!n)continue;let r=e.get(n)??[];r.push(t),e.set(n,r)}return e},[d]),g=(0,x.useMemo)(()=>{let e=[];for(let t of d){let n=qy(t);if(!(!n||!m.has(n)))continue;let r=h.get(t.id)??[];(p(t)||r.some(p))&&e.push({parent:t,subRuns:r})}return e},[d,m,h,p]),_=(0,x.useMemo)(()=>g.reduce((e,t)=>e+1+t.subRuns.length,0),[g]),v=d.filter(e=>e.status===`cancelled`).length,y=d.filter(e=>e.status===`complete`).length,b=d.filter(e=>e.status===`failed`).length,S=d.filter(e=>e.status===`escalated`).length;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.history,description:`Completed, cancelled, failed, and escalated ${zy.pluralLower}. ${y} done · ${v} cancelled · ${b} failed · ${S} escalated.`}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line p-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ab,{options:f,value:a,onChange:o,size:`sm`,ariaLabel:`Filter by workflow`}),(0,G.jsx)(ab,{options:ob,value:s,onChange:c,size:`sm`,ariaLabel:`Filter by outcome`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative w-full lg:w-72`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:r,onChange:e=>i(e.target.value),placeholder:`Search archived ${zy.pluralLower}`,className:`h-9 pl-9 text-[13px]`})]}),(0,G.jsxs)(`span`,{className:`hidden whitespace-nowrap text-[11px] uppercase tracking-[0.14em] text-fg-subtle sm:inline`,children:[_,` / `,d.length]})]})]}),(0,G.jsx)(pg,{className:`p-0`,children:n?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(gg,{title:`Could not load history`,message:n})}):t?(0,G.jsx)(`div`,{className:`space-y-2 p-4`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(bg,{className:`h-14 w-full`},t))}):g.length===0?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(ib,{icon:Wr,title:`No archived ${zy.pluralLower} match the current filters`,description:`Adjust the filters or wait for current work to finish.`})}):(0,G.jsx)(cb,{rows:g,collapsed:l,onToggle:e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}})})]})]})}function cb({rows:e,collapsed:t,onToggle:n}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[760px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:zy.singular}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Workflow`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Outcome`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Updated`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-right font-medium`,children:`Cost`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:e.map(e=>{let r=e.subRuns.length>0,i=r&&t.has(e.parent.id);return(0,G.jsx)(lb,{row:e,isCollapsed:i,showChildren:r&&!i,onToggle:n},e.parent.id)})})]})})}function lb({row:e,isCollapsed:t,showChildren:n,onToggle:r}){let i=e.subRuns.length>0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ub,{job:e.parent,subRunCount:e.subRuns.length,isCollapsed:t,onToggle:i?()=>r(e.parent.id):void 0}),n?e.subRuns.map(e=>(0,G.jsx)(db,{job:e},e.id)):null]})}function ub({job:e,subRunCount:t,isCollapsed:n,onToggle:r}){let i=My(e),a=Ay(e)||t>0,o=n?ur:lr;return(0,G.jsxs)(`tr`,{className:`group transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay hover:text-fg`,"aria-label":n?`Expand ${By.pluralLower}`:`Collapse ${By.pluralLower}`,"aria-expanded":!n,children:(0,G.jsx)(o,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:i,className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg group-hover:text-accent-300`,children:Ny(e)}),a?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,title:`Hosts ${By.pluralLower}`,children:[(0,G.jsx)(Yr,{className:`size-2.5`}),t>0?`${t} ${t===1?By.singularLower:By.pluralLower}`:By.plural.toLowerCase()]}):null]}),Py(e)?(0,G.jsx)(`div`,{className:`line-clamp-1 text-[12px] text-fg-subtle`,children:Py(e)}):null]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:Yy(e)})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top text-[13px] text-fg-muted`,children:e.phase}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}function db({job:e}){let t=My(e),n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null;return(0,G.jsxs)(`tr`,{className:`group bg-overlay/20 transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2 pl-7`,children:[(0,G.jsx)(Cr,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle/70`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:t,className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg-muted group-hover:text-accent-300`,children:n??Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:By.singularLower})]}),(0,G.jsx)(`div`,{className:`truncate text-[11px] text-fg-subtle`,children:e.id})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:Yy(e)})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:e.phase}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}var fb=[{value:`active`,label:`Active`},{value:`waiting`,label:`Awaiting`},{value:`terminal`,label:`Finished`},{value:`all`,label:`All`}];function pb(e){return(e.campaignChildren??[]).reduce((e,t)=>{e.total+=1;let n=t.summary?.status??t.status;return n===`complete`||n===`skipped`||n===`cancelled`?e.done+=1:n===`failed`||n===`escalated`?e.blocked+=1:e.active+=1,e},{total:0,done:0,active:0,blocked:0})}function mb(e){if(!Ky(e))return Ly(e);let t=pb(e);if(t.total===0)return`Planning ${By.singularLower} graph`;let n=[`${t.done}/${t.total} done`];return t.active>0&&n.push(`${t.active} active`),t.blocked>0&&n.push(`${t.blocked} blocked`),n.join(` · `)}function hb(){let[e,t]=Fn(),{jobs:n,loading:r,error:i}=Eo(),[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(`active`),[l,u]=(0,x.useState)(()=>new Set),d=(0,x.useMemo)(()=>Ry(n),[n]),f=(0,x.useMemo)(()=>Jy(d),[d]),[p,m]=(0,x.useState)(e.get(`workflow`)??`all`);(0,x.useEffect)(()=>{if((e.get(`workflow`)??`all`)!==p){let n=new URLSearchParams(e);p===`all`?n.delete(`workflow`):n.set(`workflow`,p),t(n,{replace:!0})}},[p,e,t]),(0,x.useEffect)(()=>{let t=e.get(`workflow`)??`all`;t!==p&&m(t)},[e]);let h=(0,x.useMemo)(()=>{let e=a.trim().toLowerCase();return t=>p!==`all`&&Wy(t.workflowPath)!==p||s===`active`&&jo(t.status)||s===`waiting`&&!Mo(t.status)||s===`terminal`&&!jo(t.status)?!1:e?[t.id,Ny(t),Py(t),Iy(t),t.phase,mb(t),jy(t.workflowPath),t.workflowPath].filter(Boolean).join(` `).toLowerCase().includes(e):!0},[a,s,p]),g=(0,x.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),_=(0,x.useMemo)(()=>{let e=new Map;for(let t of d){let n=qy(t);if(!n)continue;let r=e.get(n)??[];r.push(t),e.set(n,r)}return e},[d]),v=(0,x.useMemo)(()=>{let e=[];for(let t of d){let n=qy(t);if(!(!n||!g.has(n)))continue;let r=_.get(t.id)??[];(h(t)||r.some(h))&&e.push({parent:t,subRuns:r})}return e},[d,g,_,h]),y=(0,x.useMemo)(()=>v.reduce((e,t)=>e+1+t.subRuns.length,0),[v]),b=d.filter(e=>!jo(e.status)).length,S=d.filter(e=>Mo(e.status)).length;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.runsList,description:Vy.runsListDescription,actions:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[Vy.newRun,(0,G.jsx)(rr,{})]})})}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line p-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ab,{options:f,value:p,onChange:m,size:`sm`,ariaLabel:`Filter by workflow`}),(0,G.jsx)(ab,{options:fb,value:s,onChange:c,size:`sm`,ariaLabel:`Filter by status`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative w-full lg:w-72`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`Search ${zy.pluralLower}`,className:`h-9 pl-9 text-[13px]`})]}),(0,G.jsxs)(`span`,{className:`hidden whitespace-nowrap text-[11px] uppercase tracking-[0.14em] text-fg-subtle sm:inline`,children:[y,` / `,d.length,(0,G.jsxs)(`span`,{className:`ml-2 text-fg-subtle/70`,children:[`· `,b,` active · `,S,` awaiting`]})]})]})]}),(0,G.jsx)(pg,{className:`p-0`,children:i?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(gg,{title:`Could not load ${zy.pluralLower}`,message:i})}):r?(0,G.jsx)(`div`,{className:`space-y-2 p-4`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(bg,{className:`h-14 w-full`},t))}):v.length===0?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(ib,{icon:gr,title:`No ${zy.pluralLower} match the current view`,description:`Create a ${zy.singularLower} or widen the filters to bring more work into view.`,action:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsx)(Dn,{to:`/jobs/new`,children:`Create ${zy.singularLower}`})})})}):(0,G.jsx)(gb,{rows:v,collapsed:l,onToggle:e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}})})]})]})}function gb({rows:e,collapsed:t,onToggle:n}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[920px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:zy.singular}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Workflow`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Status`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Working on`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Updated`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-right font-medium`,children:`Cost`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:e.map(e=>{let r=e.subRuns.length>0,i=r&&t.has(e.parent.id);return(0,G.jsx)(_b,{row:e,isCollapsed:i,showChildren:r&&!i,onToggle:n},e.parent.id)})})]})})}function _b({row:e,isCollapsed:t,showChildren:n,onToggle:r}){let i=e.subRuns.length>0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(vb,{job:e.parent,subRunCount:e.subRuns.length,isCollapsed:t,onToggle:i?()=>r(e.parent.id):void 0}),n?e.subRuns.map(e=>(0,G.jsx)(yb,{job:e},e.id)):null]})}function vb({job:e,subRunCount:t,isCollapsed:n,onToggle:r}){let i=Yy(e),a=Ay(e)||t>0,o=n?ur:lr;return(0,G.jsxs)(`tr`,{className:`group transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay hover:text-fg`,"aria-label":n?`Expand ${By.pluralLower}`:`Collapse ${By.pluralLower}`,"aria-expanded":!n,children:(0,G.jsx)(o,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:My(e),className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg group-hover:text-accent-300`,children:Ny(e)}),a?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,title:`Hosts ${By.pluralLower}`,children:[(0,G.jsx)(Yr,{className:`size-2.5`}),t>0?`${t} ${t===1?By.singularLower:By.pluralLower}`:By.plural.toLowerCase()]}):null]}),(0,G.jsx)(`div`,{className:`truncate text-[12px] text-fg-subtle`,children:[Iy(e)].filter(Boolean).join(` · `)||e.id})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:i})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsxs)(`td`,{className:`px-4 py-3 align-top text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px]`,children:mb(e)}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`phase: `,e.phase]})]}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}function yb({job:e}){let t=Yy(e),n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null;return(0,G.jsxs)(`tr`,{className:W(`group bg-overlay/20 transition-colors hover:bg-overlay/40`),children:[(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2 pl-7`,children:[(0,G.jsx)(Cr,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle/70`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:My(e),className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg-muted group-hover:text-accent-300`,children:n??Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:By.singularLower})]}),(0,G.jsx)(`div`,{className:`truncate text-[11px] text-fg-subtle`,children:[Iy(e),e.id].filter(Boolean).join(` · `)})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:t})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsxs)(`td`,{className:`px-4 py-2.5 align-top text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px]`,children:Ly(e)}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`phase: `,e.phase]})]}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}var bb=x.forwardRef(function({className:e,...t},n){return(0,G.jsx)(`textarea`,{ref:n,className:W(`flex min-h-28 w-full rounded-xl border border-line-strong bg-overlay px-3.5 py-3 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}),xb=`Tabs`,[Sb,Cb]=Ss(xb,[Kd]),wb=Kd(),[Tb,Eb]=Sb(xb),Db=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Es(s),[d,f]=gc({prop:r,onChange:i,defaultProp:a??``,caller:xb});return(0,G.jsx)(Tb,{scope:n,baseId:tl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,G.jsx)(ps.div,{dir:u,"data-orientation":o,...l,ref:t})})});Db.displayName=xb;var Ob=`TabsList`,kb=x.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Eb(Ob,n),o=wb(n);return(0,G.jsx)(af,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,G.jsx)(ps.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});kb.displayName=Ob;var Ab=`TabsTrigger`,jb=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Eb(Ab,n),s=wb(n),c=Pb(o.baseId,r),l=Fb(o.baseId,r),u=r===o.value;return(0,G.jsx)(of,{asChild:!0,...s,focusable:!i,active:u,children:(0,G.jsx)(ps.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:X(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:X(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:X(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});jb.displayName=Ab;var Mb=`TabsContent`,Nb=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Eb(Mb,n),c=Pb(s.baseId,r),l=Fb(s.baseId,r),u=r===s.value,d=x.useRef(u);return x.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,G.jsx)(_s,{present:i||u,children:({present:n})=>(0,G.jsx)(ps.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Nb.displayName=Mb;function Pb(e,t){return`${e}-trigger-${t}`}function Fb(e,t){return`${e}-content-${t}`}var Ib=Db,Lb=kb,Rb=jb,zb=Nb;function Bb({className:e,...t}){return(0,G.jsx)(Ib,{className:W(`flex flex-col gap-4`,e),...t})}function Vb({className:e,...t}){return(0,G.jsx)(Lb,{className:W(`inline-flex h-10 items-center gap-1 border-b border-line text-fg-muted`,e),...t})}function Hb({className:e,...t}){return(0,G.jsx)(Rb,{className:W(`relative -mb-px inline-flex h-10 items-center justify-center gap-1.5 border-b-2 border-transparent px-3 text-sm font-medium text-fg-muted transition-[color,border-color] hover:text-fg focus-visible:outline-none focus-visible:text-fg`,`data-[state=active]:border-accent-400 data-[state=active]:text-fg`,e),...t})}function Ub({className:e,...t}){return(0,G.jsx)(zb,{className:W(`outline-none`,e),...t})}var Wb=/^---\n([\s\S]*?)\n---\n?/,Gb=/^```([a-zA-Z0-9_-]*)\n([\s\S]*?)\n```/;function Kb(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function qb(e){let t=Kb(e);return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code class="rounded bg-overlay px-1 py-0.5 text-[11px]">${t}</code>`),t=t.replace(/\*\*([^*]+)\*\*/g,`<strong class="font-semibold text-fg">$1</strong>`),t=t.replace(/(^|[^*])\*([^*\n]+)\*/g,`$1<em>$2</em>`),t}function Jb(e){let t=e.replace(/\r\n/g,`
|
|
55
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},$g=`DialogDescriptionWarning`,e_=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zg($g).contentName}}.`;return x.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},t_=Eg,n_=Mg,r_=Pg,i_=Rg,a_=Ug,o_=Gg,s_=qg,c_=t_,l_=n_;function u_({className:e,...t}){return(0,G.jsx)(r_,{className:W(`fixed inset-0 z-50 bg-canvas/80 backdrop-blur-sm data-[state=open]:animate-[fade-in_180ms_ease-out] data-[state=closed]:animate-[fade-out_120ms_ease-in]`,e),...t})}function d_({className:e,children:t,...n}){return(0,G.jsxs)(l_,{children:[(0,G.jsx)(u_,{}),(0,G.jsxs)(i_,{className:W(`fixed left-1/2 top-1/2 z-50 grid w-[min(920px,calc(100vw-2rem))] max-h-[85vh] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-hidden rounded-3xl border border-line-strong bg-panel p-0 shadow-[var(--shadow-elevated)]`,e),...n,children:[t,(0,G.jsxs)(s_,{className:`absolute right-4 top-4 rounded-full p-2 text-fg-subtle transition-colors hover:bg-overlay hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,children:[(0,G.jsx)(Pi,{className:`size-4`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function f_({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex flex-col gap-1.5 border-b border-line px-6 py-5`,e),...t})}function p_({className:e,...t}){return(0,G.jsx)(a_,{className:W(`text-lg font-semibold text-fg`,e),...t})}function m_({className:e,...t}){return(0,G.jsx)(o_,{className:W(`text-sm text-fg-muted`,e),...t})}function h_({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`min-h-0 overflow-auto px-6 pb-6`,e),...t})}var g_={llmDefaultProvider:``,llmAliases:{},pluginInstalled:{},pluginDefaultScm:``,pluginDefaultTracker:``,mcpServersText:`{}`,inheritClaudeCodeMcps:!1,intelligenceDir:``,intelligenceRemote:``,workingDir:``,guardrailsEnabled:!0,guardrailRules:[],guardrailsRulesText:`[]`},__={llmDefaultProvider:`llm-provider`,llmAliases:`llm-provider`,pluginDefaultScm:`source-control`,pluginDefaultTracker:`issue-tracker`,mcpServersText:`mcp`,inheritClaudeCodeMcps:`mcp`,intelligenceDir:`paths`,intelligenceRemote:`paths`,workingDir:`paths`,guardrailsEnabled:`guardrails`,guardrailRules:`guardrails`,guardrailsRulesText:`guardrails`},v_=(0,x.createContext)(null);function y_(){let e=(0,x.useContext)(v_);if(!e)throw Error(`useSettings must be used within <SettingsProvider>`);return e}function b_(e){let t=e.config;if(!t)return g_;let n=JSON.stringify(t.mcpServers??{},null,2),r={},i=``,a=``;if(t.plugins?.installed){for(let[e,n]of Object.entries(t.plugins.installed))r[e]={...typeof n.enabled==`boolean`?{enabled:n.enabled}:{},config:{...n.config??{}}};i=t.plugins.defaults?.scm??``,a=t.plugins.defaults?.tracker??``}let o=(e.resolved?.guardrails?.rules??[]).map(e=>({...e,enabled:e.enabled!==!1})),s=JSON.stringify(t?.guardrails?.rules??[],null,2);return{llmDefaultProvider:t.llm?.defaultProvider??``,llmAliases:{...t.llm?.aliases??{}},pluginInstalled:r,pluginDefaultScm:i,pluginDefaultTracker:a,mcpServersText:n,inheritClaudeCodeMcps:t.inheritClaudeCodeMcps===!0,intelligenceDir:t.intelligence?.dir??``,intelligenceRemote:t.intelligence?.gitRemote??``,workingDir:t.paths?.workingDir??``,guardrailsEnabled:e.resolved?.guardrails?.enabled??t?.guardrails?.enabled??!0,guardrailRules:o,guardrailsRulesText:s}}function x_(e,t){if(e===t)return!0;if(typeof e==`object`&&e&&typeof t==`object`&&t)try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}return!1}function S_({children:e}){let[t,n]=(0,x.useState)(g_),[r,i]=(0,x.useState)(g_),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(null),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(null),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(()=>typeof window>`u`?!1:window.localStorage.getItem(`coro.firstRun.completed`)===`true`),O=(0,x.useRef)(r);O.current=r;let k=(0,x.useCallback)(async()=>{try{C(await q(`/plugins`)),T(null)}catch(e){T(e instanceof Error?e.message:String(e))}},[]),A=(0,x.useCallback)(async()=>{u(!0),f(null);try{let[e]=await Promise.all([q(`/config`),k()]);o({configPath:e.configPath,mode:e.mode,resolved:e.resolved,configError:e.configError,rawConfig:e.rawConfig}),c({coachMode:e.config?.coachMode,intake:e.config?.intake}),e.config?.setup?.completedAt&&(D(!0),typeof window<`u`&&window.localStorage.setItem(`coro.firstRun.completed`,`true`));let t=b_(e);n(t),i(t)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}},[k]);(0,x.useEffect)(()=>{A()},[A]);let j=(0,x.useCallback)((e,t)=>{n(n=>({...n,[e]:t})),g(null),v(null)},[]),M=(0,x.useCallback)((e,t,r)=>{n(n=>{let i=n.pluginInstalled[e]??{config:{}},a={...i.config};return r===void 0||r===``?delete a[t]:a[t]=r,{...n,pluginInstalled:{...n.pluginInstalled,[e]:{...i,config:a}}}}),g(null),v(null)},[]),N=(0,x.useCallback)((e,t)=>{n(n=>{let r=n.pluginInstalled[e]??{config:{}};return{...n,pluginInstalled:{...n.pluginInstalled,[e]:{...r,enabled:t}}}}),g(null),v(null)},[]),ee=(0,x.useCallback)((e,t)=>{n(n=>e===`scm`?{...n,pluginDefaultScm:t}:{...n,pluginDefaultTracker:t}),g(null),v(null)},[]),te=(0,x.useCallback)((e,t)=>{n(n=>({...n,guardrailRules:n.guardrailRules.map(n=>n.id===e?{...n,enabled:t}:n)})),g(null),v(null)},[]),P=(0,x.useCallback)((e,t)=>{n(n=>({...n,guardrailRules:n.guardrailRules.map(n=>n.id===e?{...n,config:t}:n)})),g(null),v(null)},[]);function F(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t.id);if(!e){r.push({id:t.id,on:t.on,check:t.check,enabled:t.enabled,...t.config?{config:t.config}:{},...t.script?{script:t.script}:{}});continue}let i={id:t.id},a=!1;t.enabled!==e.enabled&&(i.enabled=t.enabled,a=!0),JSON.stringify(t.config??{})!==JSON.stringify(e.config??{})&&(i.config=t.config??{},a=!0),a&&r.push(i)}return r}let I=(0,x.useMemo)(()=>{let e=new Set;return Object.keys(t).forEach(n=>{x_(t[n],r[n])||e.add(n)}),e},[t,r]),ne=(0,x.useMemo)(()=>{let e=new Set;if(!I.has(`pluginInstalled`))return e;let n=new Set(Object.keys(t.pluginInstalled)),i=new Set(Object.keys(r.pluginInstalled));for(let a of new Set([...n,...i])){let n=t.pluginInstalled[a],i=r.pluginInstalled[a];JSON.stringify(n)!==JSON.stringify(i)&&e.add(a)}return e},[I,t.pluginInstalled,r.pluginInstalled]),re=(0,x.useMemo)(()=>{let e=new Set;if(I.forEach(t=>{let n=__[t];n&&e.add(n)}),ne.size>0){let t=new Map(S?.plugins.map(e=>[e.manifest.id,e.manifest.kind])??[]);for(let n of ne){let r=t.get(n);r===`scm`?e.add(`source-control`):r===`tracker`?e.add(`issue-tracker`):e.add(`plugins`)}}return e},[I,ne,S]),ie=I.size>0,L=(0,x.useCallback)(()=>{n(O.current),g(null),v(null)},[]),R=(0,x.useCallback)(()=>{let e={};if((I.has(`llmDefaultProvider`)||I.has(`llmAliases`))&&(e.llm={...t.llmDefaultProvider?{defaultProvider:t.llmDefaultProvider}:{},aliases:{...t.llmAliases}}),I.has(`pluginInstalled`)||I.has(`pluginDefaultScm`)||I.has(`pluginDefaultTracker`)){let n={};for(let[e,r]of Object.entries(t.pluginInstalled))n[e]={...typeof r.enabled==`boolean`?{enabled:r.enabled}:{},config:{...r.config}};let r={};t.pluginDefaultScm&&(r.scm=t.pluginDefaultScm),t.pluginDefaultTracker&&(r.tracker=t.pluginDefaultTracker),e.plugins={...Object.keys(r).length>0?{defaults:r}:{},installed:n}}if(I.has(`mcpServersText`)){let n;try{n=JSON.parse(t.mcpServersText)}catch(e){throw Error(`MCP servers JSON is invalid: ${e.message}`)}if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`mcpServers must be a JSON object keyed by server id.`);e.mcpServers=n}if(I.has(`inheritClaudeCodeMcps`)&&(e.inheritClaudeCodeMcps=t.inheritClaudeCodeMcps),(I.has(`intelligenceDir`)||I.has(`intelligenceRemote`))&&(e.intelligence={dir:t.intelligenceDir||void 0,gitRemote:t.intelligenceRemote||void 0}),I.has(`workingDir`)&&(e.paths={workingDir:t.workingDir||void 0}),I.has(`guardrailsEnabled`)||I.has(`guardrailRules`)||I.has(`guardrailsRulesText`)){let n;if(I.has(`guardrailsRulesText`)){let e=JSON.parse(t.guardrailsRulesText);if(!Array.isArray(e))throw Error(`guardrails.rules must be a JSON array.`);n=e}else n=F(t.guardrailRules,O.current.guardrailRules);e.guardrails={enabled:t.guardrailsEnabled,rules:n}}return e},[t,I]),ae=(0,x.useCallback)(async()=>{g(null),v(null),m(!0);try{let e=R();if(Object.keys(e).length===0){m(!1);return}let t=await q(`/config`,J(e,{method:`PUT`})),n=e&&typeof e==`object`&&`paths`in e,r=e&&typeof e==`object`&&`cloud`in e;if((t.reload?.failed??[]).length>0){let e=t.reload?.failed.map(e=>e.id).join(`, `);v(`Configuration saved. Some plugins failed to hot-reload (${e}) — restart the runner if they keep failing.`)}else v(n||r?`Configuration saved. Restart the runner to apply path or cloud-mode changes.`:`Configuration saved. Changes are live for the next job — no restart needed.`);b(new Date().toISOString()),await A()}catch(e){g(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}},[R,A]),oe=(0,x.useCallback)(()=>{g(null),v(null)},[]);(0,x.useEffect)(()=>{if(!ie)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[ie]);let se={loading:l,loadError:d,reload:A,draft:t,setDraft:j,setPluginField:M,setPluginEnabled:N,setPluginDefault:ee,setGuardrailRuleEnabled:te,setGuardrailRuleConfig:P,isDirty:ie,dirtyFields:I,dirtyPluginIds:ne,dirtySections:re,discardChanges:L,save:ae,saving:p,saveError:h,saveNotice:_,clearSaveFeedback:oe,lastSavedAt:y,meta:a,preferences:s,pluginsCatalogue:S,pluginsCatalogueError:w,reloadPlugins:k,firstRunCompleted:E,markFirstRunComplete:(0,x.useCallback)(async e=>{D(!0),typeof window<`u`&&window.localStorage.setItem(`coro.firstRun.completed`,`true`);try{await q(`/config`,J({setup:{completedAt:new Date().toISOString(),...e?.skipped&&e.skipped.length>0?{skipped:e.skipped}:{}}},{method:`PUT`}))}catch{}},[]),resetFirstRun:(0,x.useCallback)(()=>{D(!1),typeof window<`u`&&window.localStorage.removeItem(`coro.firstRun.completed`)},[]),commitWizardStep:(0,x.useCallback)(async({kind:e,pluginId:t,config:n,setAsDefault:r})=>{let i=await q(`/config`),a=i.config?.plugins?.installed??{},o={};for(let[e,t]of Object.entries(a))o[e]={...typeof t.enabled==`boolean`?{enabled:t.enabled}:{},config:{...t.config??{}}};o[t]={enabled:!0,config:{...o[t]?.config??{},...n}};let s={...i.config?.plugins?.defaults??{}};r&&(e===`scm`&&(s.scm=t),e===`tracker`&&(s.tracker=t));let c={plugins:{...Object.keys(s).length>0?{defaults:s}:{},installed:o}};e===`executor`&&(c.llm={...i.config?.llm??{},defaultProvider:t}),await q(`/config`,J(c,{method:`PUT`})),await A()},[A])};return(0,G.jsx)(v_.Provider,{value:se,children:e})}function C_(){return(0,G.jsxs)(`div`,{className:`relative isolate overflow-hidden`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10 bg-[radial-gradient(ellipse_60%_45%_at_50%_-10%,rgba(97,114,255,0.22),transparent_70%),radial-gradient(ellipse_50%_40%_at_85%_110%,rgba(56,189,248,0.16),transparent_75%),radial-gradient(ellipse_40%_35%_at_15%_115%,rgba(168,85,247,0.14),transparent_75%)]`}),(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 -z-10 opacity-[0.07] [background-image:linear-gradient(to_right,rgba(255,255,255,0.6)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.6)_1px,transparent_1px)] [background-size:36px_36px] [mask-image:radial-gradient(ellipse_at_center,black_40%,transparent_75%)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-5 px-6 py-8 text-center sm:gap-6 sm:px-10 sm:py-10`,children:[(0,G.jsxs)(`div`,{className:`relative flex size-24 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-accent-500/20 blur-2xl`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-24 items-center justify-center rounded-3xl bg-gradient-to-br from-accent-500/25 via-accent-500/10 to-transparent ring-1 ring-accent-500/35 shadow-[0_0_60px_-20px_rgba(97,114,255,0.6)]`,children:(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`size-12 text-accent-200 drop-shadow-[0_0_12px_rgba(125,150,255,0.55)]`,children:[(0,G.jsx)(`path`,{d:`M19 7.5A8 8 0 1 0 19 16.5`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`}),(0,G.jsx)(`circle`,{cx:`18.25`,cy:`12`,r:`1.6`,fill:`currentColor`})]})})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-accent-500/30 bg-accent-500/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-accent-200`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`First-time setup`]}),(0,G.jsx)(`h1`,{className:`text-balance bg-gradient-to-b from-fg via-fg to-fg-muted bg-clip-text text-4xl font-semibold tracking-tight text-transparent sm:text-5xl`,children:`Welcome to Coro`}),(0,G.jsx)(`p`,{className:`mx-auto max-w-xl text-pretty text-sm text-fg-muted sm:text-base`,children:`Coro runs autonomous coding agents that plan, write, review, and merge code on your behalf. Spend the next minute wiring up a model and a code host — we'll show you what each step is for.`}),(0,G.jsxs)(`p`,{className:`mx-auto max-w-xl text-pretty text-xs text-fg-subtle sm:text-sm`,children:[`Anything you skip can be configured later from `,(0,G.jsx)(`strong`,{className:`text-fg-muted`,children:`Settings → Setup`}),`.`]})]}),(0,G.jsx)(`div`,{className:`grid w-full max-w-2xl gap-3 sm:grid-cols-3`,children:[{icon:ar,title:`Connect a model`,copy:`Claude or OpenAI — Coro uses it to plan, code, and review.`},{icon:Vr,title:`Connect your code host`,copy:`GitHub or Bitbucket. Coro clones, branches, and opens PRs.`},{icon:Oi,title:`Optional: a tracker`,copy:`Jira, Linear, or GitHub Issues — Coro reports back as work moves.`}].map(({icon:e,title:t,copy:n})=>(0,G.jsxs)(`div`,{className:`group relative overflow-hidden rounded-2xl border border-line bg-overlay/40 p-4 text-left transition-colors hover:border-accent-500/30 hover:bg-overlay/60`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -right-6 -top-6 size-20 rounded-full bg-accent-500/10 blur-2xl transition-opacity group-hover:opacity-100`}),(0,G.jsx)(`span`,{className:`relative inline-flex size-9 items-center justify-center rounded-xl bg-accent-500/12 ring-1 ring-accent-500/25 text-accent-200`,children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`relative mt-3 text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`div`,{className:`relative mt-1 text-xs leading-relaxed text-fg-muted`,children:n})]},t))})]})]})}function w_({eyebrow:e,title:t,description:n,children:r,aside:i}){return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-fg-subtle`,children:e}),(0,G.jsx)(`h2`,{className:`text-balance text-xl font-semibold tracking-tight text-fg sm:text-2xl`,children:t}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:n})]}),i?(0,G.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,G.jsx)(`div`,{children:r}),(0,G.jsx)(`div`,{className:`lg:max-w-[260px]`,children:i})]}):r]})}var T_={anthropic:{path:`M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5527h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2932-5.9492 2.2932 5.9492Z`,tint:`text-[#D97757]`},openai:{path:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.815 3.355-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.393.681zm1.097-2.365l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`,tint:`text-[#10A37F]`},github:{path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.4 3-.405 1.02.005 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,tint:`text-fg`},bitbucket:{path:`M.778 1.213a.768.768 0 00-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 00.77-.646l3.27-20.03a.768.768 0 00-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z`,tint:`text-[#2684FF]`},gitlab:{path:`m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.875.875 0 0 0-.9997.0539.875.875 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.857.857 0 0 0-.29-.4412.875.875 0 0 0-.9997-.0537.859.859 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z`,tint:`text-[#FC6D26]`},jira:{path:`M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.762a1.005 1.005 0 0 0-1.001-1.005zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.005 1.005 0 0 0 23.013 0z`,tint:`text-[#2684FF]`},linear:{path:`M.403 13.795A12.0073 12.0073 0 0 0 10.205 23.597zM.0093 10.6066L13.3935 23.9908a12.0676 12.0676 0 0 0 2.2914-.4634L.4727 8.3151a12.0676 12.0676 0 0 0-.4634 2.2915zm1.0186-3.7156L16.4283 22.5478a12.0728 12.0728 0 0 0 1.821-1.0354L2.5494 5.8639A12.0728 12.0728 0 0 0 1.0279 6.891zm2.4998-3.013a12 12 0 1 1 16.9744 16.9744L3.5277 3.878z`,tint:`text-[#5E6AD2]`},"github-issues":{path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.4 3-.405 1.02.005 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,tint:`text-fg`}};function E_({pluginId:e,className:t,size:n=20}){let r=T_[e];return r?(0,G.jsx)(`svg`,{role:`img`,"aria-label":e,viewBox:`0 0 24 24`,className:W(r.tint,t),style:{width:n,height:n},fill:`currentColor`,children:(0,G.jsx)(`path`,{d:r.path})}):(0,G.jsx)(fi,{"aria-hidden":!0,className:W(`text-fg-subtle`,t),style:{width:n,height:n}})}function D_({pluginId:e,title:t,subtitle:n,selected:r,recommended:i,onSelect:a}){return(0,G.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":r,className:W(`group relative flex w-full items-start gap-4 rounded-2xl border bg-overlay/30 px-4 py-4 text-left transition-all`,`hover:bg-overlay/60 hover:border-accent-500/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,r?`border-accent-500/55 bg-accent-500/8 shadow-[0_0_0_1px_rgba(97,114,255,0.35),0_18px_40px_-30px_rgba(97,114,255,0.6)]`:`border-line`),children:[(0,G.jsx)(`span`,{className:W(`flex size-11 shrink-0 items-center justify-center rounded-xl ring-1 transition-colors`,r?`bg-accent-500/15 ring-accent-500/35`:`bg-overlay/60 ring-line group-hover:bg-overlay group-hover:ring-line-strong`),children:(0,G.jsx)(E_,{pluginId:e,size:22})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[15px] font-medium text-fg`,children:t}),i?(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full border border-accent-500/30 bg-accent-500/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-accent-200`,children:`Recommended`}):null]}),(0,G.jsx)(`div`,{className:`mt-1 text-[13px] leading-relaxed text-fg-muted`,children:n})]}),(0,G.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-muted`,children:r?(0,G.jsx)(fr,{className:`size-5 text-accent-300`}):(0,G.jsx)(vr,{className:`size-5`})})]})}var O_=x.forwardRef(function({className:e,...t},n){return(0,G.jsx)(`input`,{ref:n,className:W(`flex h-11 w-full rounded-xl border border-line-strong bg-overlay px-3.5 py-2.5 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}),k_=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),A_=`VisuallyHidden`,j_=x.forwardRef((e,t)=>(0,G.jsx)(ps.span,{...e,ref:t,style:{...k_,...e.style}}));j_.displayName=A_;var M_=j_,[N_,P_]=Ss(`Tooltip`,[vd]),F_=vd(),I_=`TooltipProvider`,L_=700,R_=`tooltip.open`,[z_,B_]=N_(I_),V_=e=>{let{__scopeTooltip:t,delayDuration:n=L_,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=x.useRef(!0),s=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,G.jsx)(z_,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:x.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};V_.displayName=I_;var H_=`Tooltip`,[U_,W_]=N_(H_),G_=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=B_(H_,e.__scopeTooltip),l=F_(t),[u,d]=x.useState(null),f=tl(),p=x.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=x.useRef(!1),[_,v]=gc({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(R_))):c.onClose(),a?.(e)},caller:H_}),y=x.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return x.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,G.jsx)(Nd,{...l,children:(0,G.jsx)(U_,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?C():b()},[c.isOpenDelayedRef,C,b]),onTriggerLeave:x.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:b,onClose:S,disableHoverableContent:m,children:n})})};G_.displayName=H_;var K_=`TooltipTrigger`,q_=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=W_(K_,n),a=B_(K_,n),o=F_(n),s=Uo(t,x.useRef(null),i.onTriggerChange),c=x.useRef(!1),l=x.useRef(!1),u=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,G.jsx)(Pd,{asChild:!0,...o,children:(0,G.jsx)(ps.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:X(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:X(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:X(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:X(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:X(e.onBlur,i.onClose),onClick:X(e.onClick,i.onClose)})})});q_.displayName=K_;var J_=`TooltipPortal`,[Y_,X_]=N_(J_,{forceMount:void 0}),Z_=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=W_(J_,t);return(0,G.jsx)(Y_,{scope:t,forceMount:n,children:(0,G.jsx)(_s,{present:n||a.open,children:(0,G.jsx)(Rd,{asChild:!0,container:i,children:r})})})};Z_.displayName=J_;var Q_=`TooltipContent`,$_=x.forwardRef((e,t)=>{let n=X_(Q_,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=W_(Q_,e.__scopeTooltip);return(0,G.jsx)(_s,{present:r||o.open,children:o.disableHoverableContent?(0,G.jsx)(iv,{side:i,...a,ref:t}):(0,G.jsx)(ev,{side:i,...a,ref:t})})}),ev=x.forwardRef((e,t)=>{let n=W_(Q_,e.__scopeTooltip),r=B_(Q_,e.__scopeTooltip),i=x.useRef(null),a=Uo(t,i),[o,s]=x.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=x.useCallback(()=>{s(null),d(!1)},[d]),p=x.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=cv(r,sv(r,n.getBoundingClientRect())),a=lv(t.getBoundingClientRect());s(dv([...i,...a])),d(!0)},[d]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),x.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!uv(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,G.jsx)(iv,{...e,ref:a})}),[tv,nv]=N_(H_,{isInside:!1}),rv=ls(`TooltipContent`),iv=x.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=W_(Q_,n),l=F_(n),{onClose:u}=c;return x.useEffect(()=>(document.addEventListener(R_,u),()=>document.removeEventListener(R_,u)),[u]),x.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,G.jsx)(Dc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,G.jsxs)(Fd,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,G.jsx)(rv,{children:r}),(0,G.jsx)(tv,{scope:n,isInside:!0,children:(0,G.jsx)(M_,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});$_.displayName=Q_;var av=`TooltipArrow`,ov=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F_(n);return nv(av,n).isInside?null:(0,G.jsx)(Id,{...i,...r,ref:t})});ov.displayName=av;function sv(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function cv(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lv(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function uv(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dv(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),fv(t)}function fv(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var pv=V_,mv=G_,hv=q_,gv=Z_,_v=$_,vv=pv,yv=mv,bv=hv;function xv({className:e,sideOffset:t=8,...n}){return(0,G.jsx)(gv,{children:(0,G.jsx)(_v,{sideOffset:t,className:W(`z-50 overflow-hidden rounded-lg border border-line-strong bg-panel-raised px-3 py-1.5 text-xs text-fg shadow-[var(--shadow-elevated)]`,e),...n})})}function Sv({label:e,htmlFor:t,required:n,hint:r,tooltip:i,action:a,className:o,children:s}){return(0,G.jsxs)(`div`,{className:W(`space-y-2`,o),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`label`,{htmlFor:t,className:`block text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:[e,n?(0,G.jsx)(`span`,{className:`ml-1 text-danger-400`,children:`*`}):null]}),i?(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`inline-flex text-fg-subtle transition-colors hover:text-fg-muted`,"aria-label":`More about ${e}`,children:(0,G.jsx)(mr,{className:`size-3.5`})})}),(0,G.jsx)(xv,{className:`max-w-xs leading-relaxed`,children:i})]}):null,a?(0,G.jsx)(`div`,{className:`ml-auto flex items-center`,children:a}):null]}),s,r?(0,G.jsx)(`div`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null]})}var Cv=(0,x.forwardRef)(function({defaultRevealed:e=!1,className:t,...n},r){let[i,a]=(0,x.useState)(e);return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(O_,{ref:r,type:i?`text`:`password`,className:W(`pr-11`,t),autoComplete:`off`,spellCheck:!1,...n}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>a(e=>!e),className:`absolute right-1 top-1/2 size-8 -translate-y-1/2 text-fg-subtle hover:text-fg`,"aria-label":i?`Hide secret`:`Show secret`,tabIndex:-1,children:i?(0,G.jsx)(Dr,{className:`size-4`}):(0,G.jsx)(Or,{className:`size-4`})})]})});function wv({provider:e,draft:t,onChange:n}){return e.fields.length===0?null:(0,G.jsxs)(`div`,{className:`space-y-3.5 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[`Configure `,e.title]}),(0,G.jsx)(`div`,{className:`space-y-3`,children:e.fields.map(e=>(0,G.jsx)(Tv,{field:e,value:typeof t[e.key]==`string`?t[e.key]:``,onChange:t=>n(e.key,t)},e.key))})]})}function Tv({field:e,value:t,onChange:n}){return(0,G.jsx)(Sv,{label:e.label,hint:e.hint,required:e.required,children:e.kind===`secret`?(0,G.jsx)(Cv,{value:t,placeholder:e.placeholder,onChange:e=>n(e.target.value)}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:t,placeholder:e.placeholder,onChange:e=>n(e.target.value),autoComplete:`off`,spellCheck:!1})})}function Ev({status:e,result:t}){return e===`idle`||e===`skipped`?null:e===`testing`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-xl border border-line bg-overlay/40 px-3 py-2.5 text-sm text-fg-muted`,children:[(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`}),(0,G.jsx)(`span`,{children:`Probing the provider…`})]}):t?e===`passed`?(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl border border-success-500/30 bg-success-500/8 px-3 py-2.5 text-sm text-success-300`,children:[(0,G.jsx)(fr,{className:`size-4 shrink-0 translate-y-0.5`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:`Credentials verified`}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:t.message})]})]}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl border border-danger-500/35 bg-danger-500/8 px-3 py-2.5 text-sm`,children:[(0,G.jsx)(_r,{className:`size-4 shrink-0 translate-y-0.5 text-danger-400`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:`Test failed`}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:t.message}),t.hint?(0,G.jsxs)(`div`,{className:`flex items-start gap-1.5 pt-1 text-[12px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3.5 shrink-0 translate-y-0.5 text-warning-400`}),(0,G.jsx)(`span`,{children:t.hint})]}):null]})]}),t.checks&&t.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2.5`,children:t.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2 text-[12px]`,children:[(0,G.jsx)(`span`,{className:W(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded-full`,e.ok?`bg-success-500/15 text-success-300`:`bg-danger-500/15 text-danger-300`),children:e.ok?(0,G.jsx)(fr,{className:`size-3`}):(0,G.jsx)(_r,{className:`size-3`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.name}),(0,G.jsx)(`div`,{className:`text-fg-muted`,children:e.message}),e.hint?(0,G.jsx)(`div`,{className:`mt-0.5 text-fg-subtle`,children:e.hint}):null]})]},`${e.name}-${t}`))}):null]}):null}var Dv={neutral:qr,accent:qr,success:fr,warning:Mi,danger:_r};function Ov({tone:e=`neutral`,title:t,children:n,className:r}){let i=Dv[e];return(0,G.jsxs)(`div`,{className:W(`flex items-start gap-3 rounded-2xl border px-4 py-3 text-sm`,zo(e),r),children:[(0,G.jsx)(i,{className:`size-4 shrink-0 translate-y-0.5`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[t?(0,G.jsx)(`div`,{className:`font-medium`,children:t}):null,(0,G.jsx)(`div`,{className:`text-fg-muted`,children:n})]})]})}var kv={ok:`success`,warn:`warning`,error:`danger`,pending:`accent`,unset:`neutral`,optional:`neutral`},Av={ok:`Ready`,warn:`Needs attention`,error:`Failed`,pending:`Working…`,unset:`Not set`,optional:`Optional`};function jv({status:e,label:t,className:n}){return(0,G.jsx)(`span`,{className:W(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(kv[e]),n),children:t??Av[e]})}var Mv=[{id:`anthropic`,title:`Anthropic Claude`,subtitle:`Best results today. One-click sign-in with Claude login.`,recommended:!0,step:`llm`,fields:[],authMode:`anthropic`},{id:`openai`,title:`OpenAI`,subtitle:`GPT-4 / GPT-5 family via the OpenAI API.`,step:`llm`,fields:[{key:`apiKey`,label:`API key`,kind:`secret`,placeholder:`sk-…`,hint:`From platform.openai.com/api-keys.`,required:!0},{key:`baseURL`,label:`Base URL`,kind:`url`,placeholder:`https://api.openai.com/v1`,hint:`Optional. Override for Azure or self-hosted compatible endpoints.`}],authMode:`apiKey`},{id:`github`,title:`GitHub`,subtitle:`github.com or GitHub Enterprise. Personal or fine-grained PAT.`,step:`scm`,fields:[{key:`owner`,label:`Owner / organisation`,kind:`text`,placeholder:`acme-inc`,hint:`The org or user that owns the repos you want Coro to work in.`,required:!0},{key:`token`,label:`Personal access token`,kind:`secret`,placeholder:`ghp_… or github_pat_…`,hint:`Needs the 'repo' scope (or equivalent fine-grained permissions).`,required:!0}]},{id:`bitbucket`,title:`Bitbucket`,subtitle:`bitbucket.org workspaces. Atlassian API tokens.`,step:`scm`,fields:[{key:`workspace`,label:`Workspace`,kind:`text`,placeholder:`my-workspace`,hint:`The workspace slug from your Bitbucket URL.`,required:!0},{key:`coderUsername`,label:`Username or email`,kind:`text`,placeholder:`you@example.com`,hint:`Username for the agent account that will push commits.`,required:!0},{key:`coderToken`,label:`API token`,kind:`secret`,placeholder:`ATATT…`,hint:`Atlassian API token from id.atlassian.com/manage-profile/security/api-tokens.`,required:!0}]},{id:`jira`,title:`Jira`,subtitle:`Atlassian Cloud or Data Center. API token auth.`,step:`tracker`,fields:[{key:`baseUrl`,label:`Base URL`,kind:`url`,placeholder:`https://acme.atlassian.net`,required:!0},{key:`username`,label:`Email`,kind:`text`,placeholder:`you@example.com`,required:!0},{key:`apiToken`,label:`API token`,kind:`secret`,placeholder:`ATATT…`,required:!0}]},{id:`linear`,title:`Linear`,subtitle:`Linear API key. Fast issue tracker for product teams.`,step:`tracker`,fields:[{key:`apiKey`,label:`API key`,kind:`secret`,placeholder:`lin_api_…`,hint:`Generate in Linear → Settings → API → Personal API keys.`,required:!0},{key:`teamKey`,label:`Default team key`,kind:`text`,placeholder:`ENG`,hint:`Optional. Picks the team Coro files issues against when a job doesn't specify one.`}]},{id:`github-issues`,title:`GitHub Issues`,subtitle:`Reuse your GitHub credentials to track work in repo issues.`,step:`tracker`,fields:[{key:`defaultOwner`,label:`Owner / organisation`,kind:`text`,placeholder:`acme-inc`,required:!0},{key:`token`,label:`Personal access token`,kind:`secret`,placeholder:`ghp_…`,hint:`Needs the 'repo' scope. The same token used for source control works.`,required:!0}]}];function Nv(e){return Mv.filter(t=>t.step===e)}function Pv(e,t,n){if(e===`llm`)return{url:`/test/llm`,body:{provider:t,config:n}};if(e===`scm`)return t===`github`?{url:`/test/git`,body:{provider:`github`,username:String(n.owner??``),token:String(n.token??``),workspace:String(n.owner??``)}}:t===`bitbucket`?{url:`/test/git`,body:{provider:`bitbucket`,username:String(n.coderUsername??``),token:String(n.coderToken??``),workspace:String(n.workspace??``)}}:null;if(e===`tracker`){if(t===`jira`)return{url:`/test/tracker`,body:{provider:`jira`,jira:{baseUrl:String(n.baseUrl??``),username:String(n.username??``),apiToken:String(n.apiToken??``)}}};if(t===`linear`)return{url:`/test/tracker`,body:{provider:`linear`,linear:{apiKey:String(n.apiKey??``),teamKey:String(n.teamKey??``)}}};if(t===`github-issues`)return{url:`/test/tracker`,body:{provider:`github`,git:{provider:`github`,username:String(n.defaultOwner??``),token:String(n.token??``),workspace:String(n.defaultOwner??``)}}}}return null}function Fv({state:e,dispatch:t,onOpenDrawer:n}){let r=Nv(`llm`),i=e.selectedProviderId,a=r.find(e=>e.id===i);return(0,G.jsxs)(w_,{eyebrow:`Step 1 of 3`,title:`Which model should power Coro?`,description:`Coro uses an LLM to plan, write code, and review changes. Pick one to start — you can switch or add more later in Settings.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,recommended:e.recommended,selected:i===e.id,onSelect:()=>t({type:`selectProvider`,step:`llm`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need something else? Browse custom executor plugins`]})]}),a&&a.authMode===`anthropic`?(0,G.jsx)(Iv,{state:e,dispatch:t}):null,a&&a.authMode===`apiKey`?(0,G.jsx)(Rv,{state:e,dispatch:t,provider:a}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}function Iv({state:e,dispatch:t}){let n=e.draftConfig,r=n.method??`claudeLogin`,i=n.apiKey??``,a=n.account,[o,s]=(0,x.useState)({status:`idle`}),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a&&o.status===`idle`&&s({status:`connected`,account:a})},[a,o.status]),(0,x.useEffect)(()=>{if(o.status!==`authorizing`)return;let e=window.setInterval(async()=>{try{let e=await q(`/config/anthropic/claude-login/status`);if(e.status===`idle`)return;s(e),e.status===`connected`&&e.account&&(t({type:`setField`,step:`llm`,key:`method`,value:`claudeLogin`}),t({type:`setField`,step:`llm`,key:`account`,value:e.account}))}catch{}},2e3);return()=>window.clearInterval(e)},[o.status,t]);function m(e){t({type:`setField`,step:`llm`,key:`method`,value:e}),d(null)}async function h(e=!1){l(!0),d(null);try{let n=await q(`/config/anthropic/claude-login/start`,e?J({force:!0},{method:`POST`}):{method:`POST`});if(s(n),t({type:`setField`,step:`llm`,key:`method`,value:`claudeLogin`}),n.account&&t({type:`setField`,step:`llm`,key:`account`,value:n.account}),n.status===`authorizing`&&(n.automaticUrl||n.manualUrl)&&window.open(n.automaticUrl??n.manualUrl,`_blank`,`noopener,noreferrer`),n.status===`error`)throw Error(n.error??`Claude login failed to start.`)}catch(e){d(e instanceof K||e instanceof Error?e.message:String(e))}finally{l(!1)}}async function g(){p(!0),t({type:`beginTest`,step:`llm`});try{let n=await q(`/test/llm`,J({provider:`anthropic`,config:e.draftConfig},{method:`POST`}));t({type:`testResult`,step:`llm`,result:{ok:n.ok,message:n.message??(n.ok?`Authenticated.`:`Test failed.`),...n.hint?{hint:n.hint}:{}}})}catch(e){t({type:`testResult`,step:`llm`,result:{ok:!1,message:e instanceof Error?e.message:String(e)}})}finally{p(!1)}}let _=o.status===`connected`||!!a,v=r===`claudeLogin`?_:r===`apiKey`?i.length>0:!1;return(0,G.jsxs)(`div`,{className:`space-y-3.5 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,G.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`How should we authenticate?`})}),(0,G.jsxs)(`div`,{className:`inline-flex rounded-xl border border-line bg-canvas/40 p-1 text-sm`,children:[(0,G.jsx)(Lv,{active:r===`claudeLogin`,onClick:()=>m(`claudeLogin`),label:`Claude login`,badge:`Recommended`}),(0,G.jsx)(Lv,{active:r===`apiKey`,onClick:()=>m(`apiKey`),label:`API key`})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,r===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-line bg-canvas/30 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(jv,{status:o.status===`connected`||a?`ok`:o.status===`authorizing`?`pending`:o.status===`error`?`error`:`unset`,label:o.status===`connected`||a?`Connected`:o.status===`authorizing`?`Waiting for browser…`:o.status===`error`?`Failed`:`Not connected`}),(o.account??a)?.email?(0,G.jsx)(`span`,{className:`truncate text-sm text-fg-muted`,children:(o.account??a)?.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void h(_),disabled:c,children:c?`Starting…`:_?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-[12px] text-fg-subtle`,children:`Uses Claude Code's local login session — no token to manage. Best path for Claude subscribers.`})]}):(0,G.jsx)(Sv,{label:`Anthropic API key`,hint:`From console.anthropic.com.`,required:!0,children:(0,G.jsx)(Cv,{value:i,placeholder:`sk-ant-…`,onChange:e=>t({type:`setField`,step:`llm`,key:`apiKey`,value:e.target.value})})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void g(),disabled:!v||f,children:[(0,G.jsx)(Jr,{}),f?`Testing…`:`Test connection`]})})]})}function Lv({active:e,onClick:t,label:n,badge:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:e?`inline-flex items-center gap-2 rounded-lg bg-accent-500/15 px-3 py-1.5 font-medium text-accent-200 ring-1 ring-accent-500/30`:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-fg-muted hover:text-fg`,children:[n,r?(0,G.jsx)(`span`,{className:`rounded-full bg-overlay/60 px-1.5 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:r}):null]})}function Rv({state:e,dispatch:t,provider:n}){let[r,i]=(0,x.useState)(!1);async function a(){i(!0),t({type:`beginTest`,step:`llm`});try{let r=await q(`/test/llm`,J({provider:n.id,config:e.draftConfig},{method:`POST`}));t({type:`testResult`,step:`llm`,result:{ok:r.ok,message:r.message??(r.ok?`Authenticated.`:`Test failed.`),...r.hint?{hint:r.hint}:{}}})}catch(e){t({type:`testResult`,step:`llm`,result:{ok:!1,message:e instanceof Error?e.message:String(e)}})}finally{i(!1)}}let o=n.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(wv,{provider:n,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`llm`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void a(),disabled:!o||r,children:[(0,G.jsx)(Jr,{}),r?`Testing…`:`Test connection`]})})]})}function zv({state:e,dispatch:t,onOpenDrawer:n}){let r=Nv(`scm`),i=e.selectedProviderId,a=r.find(e=>e.id===i),[o,s]=(0,x.useState)(!1);async function c(){if(!a)return;let n=Pv(`scm`,a.id,e.draftConfig);if(!n){t({type:`testResult`,step:`scm`,result:{ok:!1,message:`This plugin has no built-in connectivity test.`}});return}s(!0),t({type:`beginTest`,step:`scm`});try{let e=await q(n.url,J(n.body,{method:`POST`}));t({type:`testResult`,step:`scm`,result:{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Test failed.`),...e.hint?{hint:e.hint}:{},...e.checks?{checks:e.checks}:{}}})}catch(e){t({type:`testResult`,step:`scm`,result:{ok:!1,message:e instanceof K||e instanceof Error?e.message:String(e)}})}finally{s(!1)}}let l=!!a&&a.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(w_,{eyebrow:`Step 2 of 3`,title:`Where does your code live?`,description:`Coro clones repositories, opens branches, and submits pull requests on your behalf. Connect a git host so the agents can push their work.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[r.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,selected:i===e.id,onSelect:()=>t({type:`selectProvider`,step:`scm`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need GitLab or something else? Browse custom plugins`]})]}),a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wv,{provider:a,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`scm`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void c(),disabled:!l||o,children:[(0,G.jsx)(Ti,{}),o?`Testing…`:`Test connection`]})})]}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}function Bv({state:e,dispatch:t,onSkip:n,onOpenDrawer:r}){let i=Nv(`tracker`),a=e.selectedProviderId,o=i.find(e=>e.id===a),s=a===`__skip__`,[c,l]=(0,x.useState)(!1);async function u(){if(!o)return;let n=Pv(`tracker`,o.id,e.draftConfig);if(!n){t({type:`testResult`,step:`tracker`,result:{ok:!1,message:`This plugin has no built-in connectivity test.`}});return}l(!0),t({type:`beginTest`,step:`tracker`});try{let e=await q(n.url,J(n.body,{method:`POST`}));t({type:`testResult`,step:`tracker`,result:{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Test failed.`),...e.hint?{hint:e.hint}:{}}})}catch(e){t({type:`testResult`,step:`tracker`,result:{ok:!1,message:e instanceof K||e instanceof Error?e.message:String(e)}})}finally{l(!1)}}let d=!!o&&o.fields.filter(e=>e.required).every(t=>{let n=e.draftConfig[t.key];return typeof n==`string`&&n.length>0});return(0,G.jsxs)(w_,{eyebrow:`Step 3 of 3 — optional`,title:`Where do your tickets live?`,description:`Optional. Connect a tracker so Coro can pick up assigned tickets and report progress back. You can skip this and add it later from Settings.`,children:[(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.map(e=>(0,G.jsx)(D_,{pluginId:e.id,title:e.title,subtitle:e.subtitle,selected:a===e.id,onSelect:()=>t({type:`selectProvider`,step:`tracker`,providerId:e.id})},e.id)),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{t({type:`selectProvider`,step:`tracker`,providerId:`__skip__`}),t({type:`skip`,step:`tracker`}),n()},"aria-pressed":s,className:W(`group flex w-full items-start gap-4 rounded-2xl border bg-overlay/30 px-4 py-4 text-left transition-all`,`hover:bg-overlay/60 hover:border-accent-500/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,s?`border-accent-500/55 bg-accent-500/8`:`border-line border-dashed`),children:[(0,G.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-overlay/60 ring-1 ring-line text-fg-muted`,children:(0,G.jsx)(ir,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:`I don't use a tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-[13px] leading-relaxed text-fg-muted`,children:`Skip this step. You can wire up Jira, Linear, or GitHub Issues later in Settings.`})]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-line bg-transparent px-4 py-3 text-sm text-fg-muted hover:border-accent-500/30 hover:bg-overlay/40 hover:text-fg`,children:[(0,G.jsx)(fi,{className:`size-4`}),`Need something else? Browse custom tracker plugins`]})]}),o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wv,{provider:o,draft:e.draftConfig,onChange:(e,n)=>t({type:`setField`,step:`tracker`,key:e,value:n})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,onClick:()=>void u(),disabled:!d||c,children:[(0,G.jsx)(Ti,{}),c?`Testing…`:`Test connection`]})})]}):null,(0,G.jsx)(Ev,{status:e.status,result:e.lastResult})]})}var Vv={selectedProviderId:null,draftConfig:{},status:`idle`,lastResult:null},Hv={currentStep:`welcome`,steps:{llm:{...Vv,draftConfig:{}},scm:{...Vv,draftConfig:{}},tracker:{...Vv,draftConfig:{}}},drawerOpen:!1,drawerForStep:null};function Uv(e,t){switch(t.type){case`goto`:return{...e,currentStep:t.step};case`selectProvider`:return e.steps[t.step].selectedProviderId===t.providerId?e:{...e,steps:{...e.steps,[t.step]:{...Vv,selectedProviderId:t.providerId}}};case`setField`:{let n=e.steps[t.step],r={...n.draftConfig};return t.value===``||t.value===void 0||t.value===null?delete r[t.key]:r[t.key]=t.value,{...e,steps:{...e.steps,[t.step]:{...n,draftConfig:r,status:`idle`,lastResult:null}}}}case`beginTest`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:`testing`}}}}case`testResult`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:t.result.ok?`passed`:`failed`,lastResult:t.result}}}}case`skip`:{let n=e.steps[t.step];return{...e,steps:{...e.steps,[t.step]:{...n,status:`skipped`,lastResult:null}}}}case`openDrawer`:return{...e,drawerOpen:!0,drawerForStep:t.step};case`closeDrawer`:return{...e,drawerOpen:!1,drawerForStep:null};default:return e}}var Wv=[`llm`,`scm`];function Gv(e){return Wv.some(t=>e.steps[t].status===`skipped`)}var Kv={passed:{icon:fr,classes:`border-success-500/30 bg-success-500/10 text-success-300`,label:`Verified`},skipped:{icon:Mi,classes:`border-warning-500/30 bg-warning-500/10 text-warning-300`,label:`Skipped`},failed:{icon:Mi,classes:`border-danger-500/30 bg-danger-500/10 text-danger-300`,label:`Failed`},idle:{icon:Mi,classes:`border-line bg-overlay/60 text-fg-subtle`,label:`Not configured`},testing:{icon:Mi,classes:`border-line bg-overlay/60 text-fg-subtle`,label:`Pending`}};function qv({wizardState:e,onFinish:t}){let n=Gv(e);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 rounded-full border border-success-500/30 bg-success-500/10 px-3 py-1 text-[11px] font-medium uppercase tracking-[0.18em] text-success-300`,children:[(0,G.jsx)(Di,{className:`size-3.5`}),`Setup complete`]}),(0,G.jsx)(`h2`,{className:`text-balance text-2xl font-semibold tracking-tight text-fg`,children:n?`You're almost there`:`You're ready to run your first job`}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:n?`You can finish later from Settings. Until then, jobs that need the skipped piece will fail at dispatch.`:`Here is a quick recap. Below is how Coro works at a glance so you know what to do next.`})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:[{id:`llm`,icon:ar,label:`LLM provider`},{id:`scm`,icon:Vr,label:`Code host`},{id:`tracker`,icon:Oi,label:`Issue tracker (optional)`}].map(t=>{let n=e.steps[t.id],r=Kv[n.status],i=r.icon,a=t.icon;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-9 items-center justify-center rounded-xl bg-overlay/60 ring-1 ring-line text-fg-muted`,children:(0,G.jsx)(a,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.label}),(0,G.jsx)(`div`,{className:`truncate text-[12px] text-fg-muted`,children:n.selectedProviderId&&n.selectedProviderId!==`__skip__`?n.selectedProviderId:`Not configured`})]})]}),(0,G.jsxs)(`span`,{className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.14em]`,r.classes),children:[(0,G.jsx)(i,{className:`size-3.5`}),r.label]})]},t.id)})}),(0,G.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-5`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:`How Coro works`}),(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,G.jsx)(Jv,{icon:gr,title:`Jobs and workflows`,body:`Coro runs each job through a workflow of phases — plan, code, review, evaluate. Every phase is an LLM agent with the right tools and skills.`}),(0,G.jsx)(Jv,{icon:Yr,title:`Layered intelligence`,body:`Out of the box you get the base intelligence. Add tenant- and repo-specific knowledge later from Settings → Intelligence.`}),(0,G.jsx)(Jv,{icon:Pr,title:`Watch and steer`,body:`Open the dashboard for live logs, proposed PRs, and approvals. You're always one click away from steering or pausing a run.`})]})]}),n?(0,G.jsx)(`div`,{className:`rounded-2xl border border-warning-500/30 bg-warning-500/8 p-5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(Mi,{className:`size-5 shrink-0 text-warning-400`}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Finish the required setup to run jobs`}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Jobs need an LLM and a code host to do their work. Finish the steps you skipped in Settings, then come back to dispatch your first job.`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/settings`,onClick:()=>t(`settings`),children:[(0,G.jsx)(xi,{}),`Finish setup in Settings`,(0,G.jsx)(rr,{})]})}),(0,G.jsx)(Y,{asChild:!0,variant:`ghost`,onClick:()=>t(`dashboard`),children:(0,G.jsx)(Dn,{to:`/`,children:`Go to dashboard`})})]})]})]})}):(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,G.jsx)(Y,{asChild:!0,variant:`ghost`,onClick:()=>t(`dashboard`),children:(0,G.jsx)(Dn,{to:`/`,children:`Go to dashboard`})}),(0,G.jsx)(Y,{asChild:!0,onClick:()=>t(`newJob`),children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[(0,G.jsx)(gr,{}),`Create my first job`,(0,G.jsx)(rr,{})]})})]})]})}function Jv({icon:e,title:t,body:n}){return(0,G.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-line bg-canvas/40 p-3.5`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-lg bg-accent-500/12 ring-1 ring-accent-500/25 text-accent-200`,children:(0,G.jsx)(e,{className:`size-4`})}),(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),(0,G.jsx)(`div`,{className:`text-[12px] leading-relaxed text-fg-muted`,children:n})]})}var Yv={llm:`executor`,scm:`scm`,tracker:`tracker`},Xv={llm:`LLM`,scm:`source-control`,tracker:`tracker`};function Zv({step:e,onClose:t}){let n=Yv[e],[r,i]=(0,x.useState)([]),[a,o]=(0,x.useState)(!0),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(null);async function h(){o(!0);try{i((await q(`/plugins`)).plugins.filter(e=>e.manifest.kind===n))}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}}(0,x.useEffect)(()=>{h()},[n]);async function g(e){e.preventDefault(),f(null),m(null);let t=s.trim();if(!t){f("Enter an npm package name, e.g. `@coro-ai/plugin-gitlab`.");return}u(!0);try{await q(`/plugins/install`,J({spec:t},{method:`POST`})),m(`Installed ${t}. The plugin is live — pick it from the provider list to configure it.`),c(``),await h()}catch(e){f(e instanceof K||e instanceof Error?e.message:String(e))}finally{u(!1)}}let _=r.filter(e=>e.source===`dropin`),v=r.filter(e=>e.source===`builtin`).map(e=>e.manifest.displayName).join(`, `);return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-sm text-fg-muted hover:text-fg`,children:[(0,G.jsx)(nr,{className:`size-4`}),`Back to step`]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-fg-subtle`,children:[`Custom `,Xv[e],` plugins`]}),(0,G.jsx)(`h2`,{className:`text-balance text-xl font-semibold tracking-tight text-fg`,children:`Install something the built-ins don't cover`}),(0,G.jsx)(`p`,{className:`max-w-2xl text-pretty text-sm text-fg-muted`,children:`Coro plugins are regular npm packages. Anything installed here shows up alongside the built-ins as a selectable option in the wizard.`}),v?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-subtle`,children:[`Built-in `,Xv[e],` options: `,v,`.`]}):null]}),d?(0,G.jsx)(Ov,{tone:`danger`,children:d}):null,p?(0,G.jsx)(Ov,{tone:`success`,children:p}):null,(0,G.jsxs)(`form`,{onSubmit:g,className:`space-y-3 rounded-2xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsx)(Sv,{label:`Install from npm`,hint:`The runner downloads the package into ~/.coro/plugins/ and registers it on next refresh.`,children:(0,G.jsx)(O_,{value:s,onChange:e=>c(e.target.value),placeholder:`@coro-ai/plugin-gitlab (or any npm spec)`,autoComplete:`off`,spellCheck:!1,disabled:l})}),(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,G.jsx)(Y,{type:`submit`,disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),` Installing…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ri,{}),`Install plugin`]})})})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Already installed`}),(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(),disabled:a,children:[(0,G.jsx)(mi,{}),`Refresh`]})]}),a?(0,G.jsx)(`div`,{className:`rounded-xl border border-line bg-overlay/30 px-3 py-4 text-sm text-fg-subtle`,children:`Loading…`}):_.length===0?(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-line bg-overlay/20 px-3 py-4 text-sm text-fg-subtle`,children:`No drop-in plugins yet. Install one above to see it here.`}):(0,G.jsx)(`ul`,{className:`space-y-1.5`,children:_.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3 rounded-xl border border-line bg-overlay/30 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.manifest.displayName}),(0,G.jsxs)(`div`,{className:`truncate text-[12px] text-fg-subtle`,children:[e.manifest.id,` · v`,e.manifest.version]})]}),(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`})]},e.manifest.id))})]})]})}var Qv=[`welcome`,`llm`,`scm`,`tracker`,`success`];function $v({open:e,onOpenChange:t}){let{markFirstRunComplete:n,commitWizardStep:r,reloadPlugins:i,draft:a,pluginsCatalogue:o}=y_(),[s,c]=(0,x.useReducer)(Uv,Hv),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),h=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(!e){h.current=!1;return}if(h.current||!o)return;h.current=!0;let t=a.llmDefaultProvider;if(t&&a.pluginInstalled[t]){c({type:`selectProvider`,step:`llm`,providerId:t});for(let[e,n]of Object.entries(a.pluginInstalled[t].config))c({type:`setField`,step:`llm`,key:e,value:n})}let n=Object.entries(a.pluginInstalled).filter(([e,t])=>t.enabled!==!1&&o.plugins.find(t=>t.manifest.id===e)?.manifest.kind===`scm`),r=n.find(([e])=>e===a.pluginDefaultScm)??n[0];if(r){c({type:`selectProvider`,step:`scm`,providerId:r[0]});for(let[e,t]of Object.entries(r[1].config))c({type:`setField`,step:`scm`,key:e,value:t})}let i=Object.entries(a.pluginInstalled).filter(([e,t])=>t.enabled!==!1&&o.plugins.find(t=>t.manifest.id===e)?.manifest.kind===`tracker`),s=i.find(([e])=>e===a.pluginDefaultTracker)??i[0];if(s){c({type:`selectProvider`,step:`tracker`,providerId:s[0]});for(let[e,t]of Object.entries(s[1].config))c({type:`setField`,step:`tracker`,key:e,value:t})}},[e,a,o]);let g=Qv.indexOf(s.currentStep),_=s.currentStep===`success`,v=(0,x.useCallback)(e=>{f(null),c({type:`goto`,step:e})},[]),y=(0,x.useCallback)(()=>{f(null);let e=Qv[Math.max(0,g-1)];v(e)},[v,g]),b=(0,x.useCallback)(()=>{typeof window<`u`&&window.localStorage.getItem(`coro.firstRun.completed`)!==`true`&&window.localStorage.setItem(`coro.firstRun.dismissed`,`true`),t(!1)},[t]),S=(0,x.useCallback)(async()=>{f(null);let e=s.currentStep,t=e===`llm`?`llm`:e===`scm`?`scm`:e===`tracker`?`tracker`:null;if(t&&s.steps[t].status===`passed`){let e=s.steps[t].selectedProviderId;if(e&&e!==`__skip__`){u(!0);try{await r({kind:t===`llm`?`executor`:t,pluginId:e,config:s.steps[t].draftConfig,setAsDefault:!0})}catch(e){f(e instanceof Error?e.message:String(e)),u(!1);return}finally{u(!1)}}}let n=Qv[Math.min(Qv.length-1,g+1)];v(n)},[s,g,v,r]),C=(0,x.useCallback)(()=>{f(null);let e=s.currentStep;(e===`llm`||e===`scm`||e===`tracker`)&&c({type:`skip`,step:e});let t=Qv[Math.min(Qv.length-1,g+1)];v(t)},[s.currentStep,g,v]),w=(0,x.useCallback)(async e=>{m(!0);try{let e=[];s.steps.llm.status===`skipped`&&e.push(`llm`),s.steps.scm.status===`skipped`&&e.push(`scm`),s.steps.tracker.status===`skipped`&&e.push(`tracker`),await n({skipped:e})}finally{m(!1),t(!1)}},[n,t,s.steps]),T=s.drawerForStep,E=s.drawerOpen&&T!==null,D=s.currentStep===`llm`?`llm`:s.currentStep===`scm`?`scm`:s.currentStep===`tracker`?`tracker`:null,O=D?s.steps[D]:null,k=O?O.status===`passed`:!0,A=null;if(E&&T)A=(0,G.jsx)(Zv,{step:T,onClose:()=>{i(),c({type:`closeDrawer`})}});else switch(s.currentStep){case`welcome`:A=(0,G.jsx)(C_,{});break;case`llm`:A=(0,G.jsx)(Fv,{state:s.steps.llm,dispatch:c,onOpenDrawer:()=>c({type:`openDrawer`,step:`llm`})});break;case`scm`:A=(0,G.jsx)(zv,{state:s.steps.scm,dispatch:c,onOpenDrawer:()=>c({type:`openDrawer`,step:`scm`})});break;case`tracker`:A=(0,G.jsx)(Bv,{state:s.steps.tracker,dispatch:c,onSkip:()=>{let e=Qv[Math.min(Qv.length-1,g+1)];v(e)},onOpenDrawer:()=>c({type:`openDrawer`,step:`tracker`})});break;case`success`:A=(0,G.jsx)(qv,{wizardState:s,onFinish:w});break}let j=s.currentStep===`welcome`;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex flex-col gap-0 max-h-[min(760px,calc(100vh-2rem))]`,children:[j?(0,G.jsxs)(f_,{className:`sr-only`,children:[(0,G.jsx)(p_,{children:`Welcome to Coro`}),(0,G.jsx)(m_,{children:`First-time setup`})]}):(0,G.jsxs)(f_,{className:`shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3 pr-10`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(p_,{children:_?`You are set!`:`First-time setup`}),(0,G.jsx)(m_,{children:_?`Recap of what you just configured and what to do next.`:`Configure the essentials — one minute, three steps.`})]})}),(0,G.jsx)(ey,{currentStep:s.currentStep,wizardState:s})]}),j?(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:A}):(0,G.jsxs)(h_,{className:`flex-1 min-h-0 space-y-5 pt-4`,children:[d?(0,G.jsxs)(`div`,{className:`rounded-xl border border-danger-500/35 bg-danger-500/8 px-3 py-2.5 text-sm text-danger-300`,children:[`Could not save the step: `,d]}):null,A]}),!_&&!E?(0,G.jsxs)(`div`,{className:`shrink-0 flex flex-wrap items-center justify-between gap-3 border-t border-line bg-overlay/30 px-6 py-4`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:!j&&D?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:C,disabled:l,children:`Skip for now`}):null}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:y,disabled:j||l,children:[(0,G.jsx)(nr,{}),`Back`]}),j?null:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,disabled:l,children:`Close — finish later`}),(0,G.jsx)(Y,{type:`button`,onClick:()=>void S(),disabled:(D?!k:!1)||l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),` Saving…`]}):j?(0,G.jsxs)(G.Fragment,{children:[`Let's get started `,(0,G.jsx)(rr,{})]}):(0,G.jsxs)(G.Fragment,{children:[`Continue `,(0,G.jsx)(rr,{})]})})]})]}):null,_?(0,G.jsx)(`div`,{className:`shrink-0 border-t border-line bg-overlay/30 px-6 py-4 text-[12px] text-fg-subtle`,children:p?`Saving your setup…`:Gv(s)?`Click "Finish setup in Settings" to wrap up the remaining required pieces.`:`Click "Create my first job" to dispatch a run.`}):null]})})}function ey({currentStep:e,wizardState:t}){let n=[{id:`llm`,label:`Model`,kind:`llm`},{id:`scm`,label:`Code host`,kind:`scm`},{id:`tracker`,label:`Tracker`,kind:`tracker`}],r=Qv,i=r.indexOf(e);return(0,G.jsx)(`ol`,{className:`mt-4 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:n.map(({id:e,label:n,kind:a})=>{let o=r.indexOf(e),s=o===i,c=a?t.steps[a].status===`passed`:o<i,l=a?t.steps[a].status===`skipped`:!1,u=c||l||o<i;return(0,G.jsxs)(`li`,{className:W(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 transition-colors`,s?`border-accent-500/45 bg-accent-500/10 text-fg`:c?`border-success-500/30 bg-success-500/8 text-success-300`:l?`border-warning-500/25 bg-warning-500/8 text-warning-300`:`border-line bg-overlay/40`),children:[(0,G.jsx)(`span`,{className:W(`inline-block size-1.5 rounded-full`,s?`bg-accent-400`:u?`bg-success-400`:`bg-fg-subtle/60`)}),(0,G.jsx)(`span`,{className:`font-medium uppercase tracking-[0.14em]`,children:n})]},e)})})}function ty(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ny(e,t,n){let r=e.pluginInstalled[n];if(!r||r.enabled===!1)return!1;let i=t?.manifest.configSchema;return ty(i)&&Array.isArray(i.required)?i.required.every(e=>{let t=r.config[e];return typeof t==`string`?t.length>0:t!=null}):Object.keys(r.config).length>0}var ry=[`github`,`bitbucket`,`gitlab`],iy=[`jira`,`linear`,`github-issues`],ay=[`anthropic`];function oy({draft:e,pluginsCatalogue:t}){let n=t?.plugins.filter(e=>e.manifest.kind===`executor`)??[],r=e=>t?n.some(t=>t.manifest.id===e):ay.includes(e),i=e.llmDefaultProvider||(()=>{let t=n.filter(t=>e.pluginInstalled[t.manifest.id]?.enabled===!1?!1:ny(e,t,t.manifest.id));return t.length===1||t.length>1?t[0].manifest.id:n.find(t=>e.pluginInstalled[t.manifest.id]?.enabled!==!1)?.manifest.id??n[0]?.manifest.id??``})(),a=n.find(e=>e.manifest.id===i),o=!!i&&r(i)&&ny(e,a,i),s=i?o?`${a?.manifest.displayName??i} configured`:`${a?.manifest.displayName??i} needs configuration`:`No LLM provider selected`,c=t?.plugins.filter(e=>e.manifest.kind===`scm`)??[],l=t?.plugins.filter(e=>e.manifest.kind===`tracker`)??[],u=e=>t?c.some(t=>t.manifest.id===e):ry.includes(e),d=e=>t?l.some(t=>t.manifest.id===e):iy.includes(e),f=Object.entries(e.pluginInstalled).filter(([t,n])=>n.enabled===!1||!u(t)?!1:ny(e,c.find(e=>e.manifest.id===t),t)).map(([e])=>e),p=f.length>0,m=p?f.length===1?`${f[0]} configured`:`${f.length} SCM plugins configured (default: ${e.pluginDefaultScm||f[0]})`:`No source-control plugin enabled`,h=Object.entries(e.pluginInstalled).filter(([t,n])=>n.enabled===!1||!d(t)?!1:ny(e,l.find(e=>e.manifest.id===t),t)).map(([e])=>e),g=`optional`,_=`No tracker plugin enabled`;h.length>0?(g=`ok`,_=h.length===1?`${h[0]} configured`:`${h.length} tracker plugins configured (default: ${e.pluginDefaultTracker||h[0]})`):Object.entries(e.pluginInstalled).some(([t,n])=>n.enabled===!1||!d(t)?!1:!ny(e,l.find(e=>e.manifest.id===t),t))&&(g=`warn`,_=`Tracker plugin enabled but required fields are missing`);let v=(()=>{try{let t=JSON.parse(e.mcpServersText),n=t&&typeof t==`object`?Object.keys(t).length:0;return n===0?`No BYO servers configured`:`${n} server${n===1?``:`s`} configured`}catch{return`Invalid JSON`}})(),y={general:{status:`optional`,detail:`Coach mode and Coro plan mode preferences`},"llm-provider":{status:o?`ok`:`warn`,label:o?`Connected`:`Needs setup`,detail:s},"source-control":{status:p?`ok`:`warn`,label:p?`Connected`:`Needs setup`,detail:m},"issue-tracker":{status:g,detail:_},plugins:{status:`optional`,detail:`Drop-in plugin install + uninstall`},mcp:{status:`optional`,detail:v},paths:{status:`optional`,detail:`Using resolved defaults unless overridden`},guardrails:{status:`optional`,detail:e.guardrailsEnabled?`${e.guardrailRules.filter(e=>e.enabled).length} rule(s) active`:`Disabled`}},b=[];return o||b.push(`llm-provider`),p||b.push(`source-control`),{byId:y,ready:b.length===0,missingRequired:b}}var sy={enabled:!0,graduateAfterRuns:5};function cy(e){return{enabled:e?.enabled??sy.enabled,graduateAfterRuns:e?.graduateAfterRuns??sy.graduateAfterRuns,totalRuns:e?.totalRuns??0,lastRunAt:e?.lastRunAt??``,graduatedAt:e?.graduatedAt??``}}function ly(e){let t=cy(e);return t.enabled&&!t.graduatedAt}function uy(e){let t=cy(e);return t.enabled&&!t.graduatedAt&&t.totalRuns<t.graduateAfterRuns}function dy(e){let t=cy(e);return t.enabled&&!t.graduatedAt&&t.totalRuns>=t.graduateAfterRuns}function fy(e){return ly(e)?`ai`:`form`}function py(e,t){return e?.mode??fy(t)}var my=`coro.intake.modeChoice`,hy=`coro.intake.askEachTimeChoice`;function gy(){if(typeof window>`u`)return null;let e=window.sessionStorage.getItem(my);return e===`ai`||e===`form`?e:null}function _y(e){typeof window>`u`||window.sessionStorage.setItem(my,e)}function vy(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(hy);return e===`ai`||e===`form`?e:null}function yy(e){typeof window>`u`||window.localStorage.setItem(hy,e)}var by=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`}),xy=new Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1}),Sy=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2});function Cy(e){let t=e instanceof Date?e:new Date(e),n=Math.round((t.getTime()-Date.now())/1e3),r=[{limit:60,unit:`second`,divisor:1},{limit:3600,unit:`minute`,divisor:60},{limit:86400,unit:`hour`,divisor:3600},{limit:604800,unit:`day`,divisor:86400},{limit:2629800,unit:`week`,divisor:604800},{limit:31557600,unit:`month`,divisor:2629800}],i=Math.abs(n);for(let e of r)if(i<e.limit)return by.format(Math.round(n/e.divisor),e.unit);return by.format(Math.round(n/31557600),`year`)}function wy(e){return e===0?`0`:e<1e3?e.toLocaleString(`en-US`):xy.format(e)}function Ty(e){return xy.format(e)}function Ey(e){return e==null?`—`:Math.abs(e)<.01?`$${e.toFixed(4)}`:Sy.format(e)}function Dy(e){if(!e)return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m`:r>0?`${r}m ${i}s`:`${i}s`}function Oy(e){let t=e instanceof Date?e:new Date(e);return new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function ky(e){return e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ay(e){return e.workflowPath===`workflows/campaign/workflow.md`||Array.isArray(e.campaignChildren)}function jy(e){let t=e.split(`/`).filter(Boolean),n=t.length>=2?t[t.length-2]:t[t.length-1];return n?ky(n):`Workflow`}function My(e){return`/jobs/${e.id}`}function Ny(e){let t=typeof e.params.serviceName==`string`?e.params.serviceName:null,n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null,r=typeof e.params.jiraTicketId==`string`?e.params.jiraTicketId:null;return t??n??r??e.id}function Py(e){let t=typeof e.params.description==`string`?e.params.description:null;return t&&t.trim().length>0?t:null}function Fy(e){let t=e.params.reviewers;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function Iy(e){let t=e.params.repoSlug;return typeof t==`string`&&t.length>0?t:null}function Ly(e){return e.currentWorkItem??`Waiting for the next action`}function Ry(e){return[...e].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())}var zy={singular:`Run`,singularLower:`run`,plural:`Runs`,pluralLower:`runs`},By={singular:`Sub-run`,singularLower:`sub-run`,plural:`Sub-runs`,pluralLower:`sub-runs`},Vy={runsList:`Runs`,runsListDescription:`All ${zy.pluralLower} in one place. Filter by workflow or status to change the lens.`,history:`History`,overview:`Overview`,newRun:`New ${zy.singularLower}`,backToRuns:`Back to ${zy.pluralLower}`},Hy={activeRuns:`Active ${zy.pluralLower}`,activeWithSubRuns:`${zy.pluralLower.charAt(0).toUpperCase()+zy.pluralLower.slice(1)} hosting ${By.pluralLower}`,awaitingInput:`Awaiting your input`,recentlyFinished:`Recently finished`,emptyActive:`No active ${zy.pluralLower}. Dispatch one from the New ${zy.singularLower} button.`,emptyWithSubRuns:`No ${zy.pluralLower} are coordinating ${By.pluralLower} right now.`,emptyAwaiting:`Nothing parked for approval or a response.`,emptyHistory:`Completed and failed ${zy.pluralLower} will appear here.`},Uy={job:`job`,campaign:`campaign`,"self-update":`self-update`};function Wy(e){let t=e.split(`/`).filter(Boolean);return t.length>=2?t[t.length-2]:t[t.length-1]??`workflow`}function Gy(e){let t=Wy(e);return Uy[t]??t}function Ky(e){return Ay(e)}function qy(e){return e.campaignParentId??null}function Jy(e){let t=new Set;for(let n of e)t.add(Wy(n.workflowPath));let n=[{value:`all`,label:`All workflows`}];for(let e of Array.from(t).sort())n.push({value:e,label:Uy[e]??e});return n}function Yy(e){return Gy(e.workflowPath)}function Xy(){return`Parent ${zy.singularLower}`}var Zy=`/jobs`;function Qy({title:e,jobs:t,emptyLabel:n,icon:r}){return(0,G.jsxs)(lg,{children:[(0,G.jsxs)(ug,{className:`flex-row items-center justify-between gap-3 border-b border-line pb-4`,children:[(0,G.jsx)(dg,{children:e}),(0,G.jsx)(`span`,{className:`rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] tabular-nums text-fg-muted`,children:t.length})]}),(0,G.jsx)(pg,{className:`pt-3`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-1 py-6 text-sm text-fg-subtle`,children:[(0,G.jsx)(r,{className:`size-4 shrink-0`}),(0,G.jsx)(`span`,{children:n})]}):(0,G.jsx)(`div`,{className:`-mx-1`,children:t.map(e=>(0,G.jsxs)(Dn,{to:My(e),className:`group flex items-start gap-3 rounded-xl px-3 py-2.5 transition-colors hover:bg-overlay/60`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,children:Yy(e)}),(0,G.jsx)(yg,{status:e.status})]}),Py(e)?(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px] text-fg-muted`,children:Py(e)}):null]}),(0,G.jsx)(`div`,{className:`shrink-0 pt-1 text-[11px] text-fg-subtle`,children:Cy(e.updatedAt)})]},e.id))})})]})}function $y({setup:e,onLaunchWizard:t}){let n=e.state===`not-configured`,r=n?`Welcome to Coro — finish setup`:`Runner setup is incomplete`,i=n?`Connect your model and code host. The setup wizard walks through each step.`:`One or more essentials are missing. Finish configuration so ${zy.pluralLower} can run cleanly.`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-warning-500/25 bg-warning-500/8 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-warning-500/25 bg-warning-500/10 text-warning-400`,children:n?(0,G.jsx)(Di,{className:`size-4`}):(0,G.jsx)(Mi,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[15px] font-semibold text-fg`,children:r}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm text-fg-muted`,children:i}),e.missing.length>0?(0,G.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[`Missing: `,(0,G.jsx)(`span`,{className:`text-fg`,children:e.missing.join(`, `)})]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,onClick:t,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}),(0,G.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,G.jsxs)(Dn,{to:`/settings`,children:[(0,G.jsx)(xi,{}),`Open settings`]})})]})]})}function eb(){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl border border-success-500/30 bg-success-500/8 px-4 py-2.5 text-sm text-success-300`,children:[(0,G.jsx)(fr,{className:`size-4`}),`Runner is ready. New jobs will dispatch immediately.`]})}function tb({totalRuns:e,onTurnOff:t,onKeepOn:n}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-2xl border border-accent-500/25 bg-accent-500/8 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-[15px] font-semibold text-fg`,children:[`You've done `,e,` runs. Ready to fly solo?`]}),(0,G.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:`Coach mode pauses Coro at every checkpoint. Turn it off and Coro will run end-to-end by default — you can still flip back on for any run.`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,onClick:()=>void t(),children:`Turn off coach mode`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,onClick:()=>void n(),children:`Keep it on`})]})]})}function nb(){return(0,G.jsx)(S_,{children:(0,G.jsx)(rb,{})})}function rb(){let{jobs:e,loading:t,error:n}=Eo(),{draft:r,pluginsCatalogue:i,loading:a,firstRunCompleted:o,preferences:s,reload:c}=y_(),[l,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(!1),p=(0,x.useMemo)(()=>{if(a||!i)return{state:`loading`,missing:[]};let e=oy({draft:r,pluginsCatalogue:i}),t=e.byId[`llm-provider`].status===`ok`,n=e.byId[`source-control`].status===`ok`,o=[];return t||o.push(`LLM provider`),n||o.push(`Source control`),o.length===0?{state:`configured`,missing:o}:{state:Object.values(r.pluginInstalled).some(e=>e.enabled!==!1&&Object.keys(e.config??{}).length>0)||r.llmDefaultProvider?`partial`:`not-configured`,missing:o}},[r,i,a]),m=(0,x.useMemo)(()=>Ry(e),[e]),h=m.filter(e=>!jo(e.status)),g=h.filter(e=>!Ky(e)),_=h.filter(e=>Ky(e)),v=m.filter(e=>e.status===`awaiting-developer-input`),y=m.filter(e=>jo(e.status)).slice(0,5),b=h.reduce((e,t)=>e+(t.tokenUsage?.totalCostUsd??0),0);(0,x.useEffect)(()=>{d||p.state===`not-configured`&&(o||typeof window>`u`||window.localStorage.getItem(`coro.firstRun.dismissed`)!==`true`&&(u(!0),f(!0)))},[p.state,d,o]);function S(e){u(e),!e&&typeof window<`u`&&!o&&window.localStorage.setItem(`coro.firstRun.dismissed`,`true`)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.overview,description:`What's live, what needs you, and what just finished.`,actions:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[Vy.newRun,(0,G.jsx)(rr,{})]})})}),p.state!==`configured`&&p.state!==`loading`?(0,G.jsx)($y,{setup:p,onLaunchWizard:()=>u(!0)}):null,p.state===`configured`?(0,G.jsx)(eb,{}):null,dy(s?.coachMode)?(0,G.jsx)(tb,{totalRuns:s?.coachMode?.totalRuns??0,onTurnOff:async()=>{await q(`/config`,J({coachMode:{enabled:!1,graduatedAt:new Date().toISOString()}},{method:`PUT`})),await c()},onKeepOn:async()=>{await q(`/config`,J({coachMode:{graduateAfterRuns:(s?.coachMode?.totalRuns??0)+10,graduatedAt:new Date().toISOString()}},{method:`PUT`})),await c()}}):null,(0,G.jsx)($v,{open:l,onOpenChange:S}),(0,G.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-4`,children:[(0,G.jsx)(hg,{label:`Active ${zy.pluralLower}`,value:h.length.toString(),description:`Across all workflows`,icon:gr,tone:`accent`}),(0,G.jsx)(hg,{label:`Hosting ${By.pluralLower}`,value:_.length.toString(),description:`${zy.plural} coordinating ${By.pluralLower}`,icon:Lr,tone:`accent`}),(0,G.jsx)(hg,{label:`Needs input`,value:v.length.toString(),description:`Waiting on developer approval`,icon:Mi,tone:v.length>0?`warning`:`neutral`}),(0,G.jsx)(hg,{label:`Live spend`,value:Ey(b),description:`Across non-terminal ${zy.pluralLower}`,icon:ar,tone:`neutral`})]}),n?(0,G.jsx)(gg,{title:`Could not load ${zy.pluralLower}`,message:n}):null,t?(0,G.jsx)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:Array.from({length:4}).map((e,t)=>(0,G.jsx)(bg,{className:`h-72 w-full`},t))}):(0,G.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,G.jsx)(Qy,{title:Hy.activeRuns,jobs:g.slice(0,5),emptyLabel:Hy.emptyActive,icon:gr}),(0,G.jsx)(Qy,{title:Hy.activeWithSubRuns,jobs:_.slice(0,5),emptyLabel:Hy.emptyWithSubRuns,icon:Lr}),(0,G.jsx)(Qy,{title:Hy.awaitingInput,jobs:v.slice(0,5),emptyLabel:Hy.emptyAwaiting,icon:Kr}),(0,G.jsx)(Qy,{title:Hy.recentlyFinished,jobs:y,emptyLabel:Hy.emptyHistory,icon:ar})]})]})}function ib({icon:e,title:t,description:n,action:r,className:i}){return(0,G.jsx)(lg,{className:W(`border-dashed border-line-strong bg-transparent shadow-none`,i),children:(0,G.jsxs)(pg,{className:`flex flex-col items-center justify-center gap-4 py-12 text-center`,children:[(0,G.jsx)(`div`,{className:`rounded-2xl border border-line-strong bg-overlay p-3 text-fg-muted`,children:(0,G.jsx)(e,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:t}),(0,G.jsx)(`p`,{className:`mx-auto max-w-md text-sm text-fg-muted`,children:n})]}),r]})})}function ab({options:e,value:t,onChange:n,size:r=`md`,className:i,ariaLabel:a}){let o=r===`sm`?`px-2.5 py-1 text-[12px]`:`px-3 py-1.5 text-sm`;return(0,G.jsx)(`div`,{role:`radiogroup`,"aria-label":a,className:W(`inline-flex items-center gap-1 rounded-full border border-line bg-overlay/60 p-1`,i),children:e.map(e=>{let r=e.value===t;return(0,G.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,onClick:()=>n(e.value),className:W(`rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60`,o,r?`bg-panel-raised text-fg shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`:`text-fg-muted hover:text-fg`),children:e.label},e.value)})})}var ob=[{value:`all`,label:`All outcomes`},{value:`cancelled`,label:`Cancelled`},{value:`complete`,label:`Complete`},{value:`failed`,label:`Failed`},{value:`escalated`,label:`Escalated`}];function sb(){let{jobs:e,loading:t,error:n}=Eo(),[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(`all`),[s,c]=(0,x.useState)(`all`),[l,u]=(0,x.useState)(()=>new Set),d=(0,x.useMemo)(()=>Ry(e.filter(e=>jo(e.status))),[e]),f=(0,x.useMemo)(()=>Jy(d),[d]),p=(0,x.useMemo)(()=>{let e=r.trim().toLowerCase();return t=>a!==`all`&&Wy(t.workflowPath)!==a||s!==`all`&&t.status!==s?!1:e?[t.id,Ny(t),Py(t),t.phase].filter(Boolean).join(` `).toLowerCase().includes(e):!0},[r,a,s]),m=(0,x.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),h=(0,x.useMemo)(()=>{let e=new Map;for(let t of d){let n=qy(t);if(!n)continue;let r=e.get(n)??[];r.push(t),e.set(n,r)}return e},[d]),g=(0,x.useMemo)(()=>{let e=[];for(let t of d){let n=qy(t);if(!(!n||!m.has(n)))continue;let r=h.get(t.id)??[];(p(t)||r.some(p))&&e.push({parent:t,subRuns:r})}return e},[d,m,h,p]),_=(0,x.useMemo)(()=>g.reduce((e,t)=>e+1+t.subRuns.length,0),[g]),v=d.filter(e=>e.status===`cancelled`).length,y=d.filter(e=>e.status===`complete`).length,b=d.filter(e=>e.status===`failed`).length,S=d.filter(e=>e.status===`escalated`).length;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.history,description:`Completed, cancelled, failed, and escalated ${zy.pluralLower}. ${y} done · ${v} cancelled · ${b} failed · ${S} escalated.`}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line p-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ab,{options:f,value:a,onChange:o,size:`sm`,ariaLabel:`Filter by workflow`}),(0,G.jsx)(ab,{options:ob,value:s,onChange:c,size:`sm`,ariaLabel:`Filter by outcome`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative w-full lg:w-72`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:r,onChange:e=>i(e.target.value),placeholder:`Search archived ${zy.pluralLower}`,className:`h-9 pl-9 text-[13px]`})]}),(0,G.jsxs)(`span`,{className:`hidden whitespace-nowrap text-[11px] uppercase tracking-[0.14em] text-fg-subtle sm:inline`,children:[_,` / `,d.length]})]})]}),(0,G.jsx)(pg,{className:`p-0`,children:n?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(gg,{title:`Could not load history`,message:n})}):t?(0,G.jsx)(`div`,{className:`space-y-2 p-4`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(bg,{className:`h-14 w-full`},t))}):g.length===0?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(ib,{icon:Wr,title:`No archived ${zy.pluralLower} match the current filters`,description:`Adjust the filters or wait for current work to finish.`})}):(0,G.jsx)(cb,{rows:g,collapsed:l,onToggle:e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}})})]})]})}function cb({rows:e,collapsed:t,onToggle:n}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[760px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:zy.singular}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Workflow`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Outcome`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Phase`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Updated`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-right font-medium`,children:`Cost`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:e.map(e=>{let r=e.subRuns.length>0,i=r&&t.has(e.parent.id);return(0,G.jsx)(lb,{row:e,isCollapsed:i,showChildren:r&&!i,onToggle:n},e.parent.id)})})]})})}function lb({row:e,isCollapsed:t,showChildren:n,onToggle:r}){let i=e.subRuns.length>0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ub,{job:e.parent,subRunCount:e.subRuns.length,isCollapsed:t,onToggle:i?()=>r(e.parent.id):void 0}),n?e.subRuns.map(e=>(0,G.jsx)(db,{job:e},e.id)):null]})}function ub({job:e,subRunCount:t,isCollapsed:n,onToggle:r}){let i=My(e),a=Ay(e)||t>0,o=n?ur:lr;return(0,G.jsxs)(`tr`,{className:`group transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay hover:text-fg`,"aria-label":n?`Expand ${By.pluralLower}`:`Collapse ${By.pluralLower}`,"aria-expanded":!n,children:(0,G.jsx)(o,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:i,className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg group-hover:text-accent-300`,children:Ny(e)}),a?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,title:`Hosts ${By.pluralLower}`,children:[(0,G.jsx)(Yr,{className:`size-2.5`}),t>0?`${t} ${t===1?By.singularLower:By.pluralLower}`:By.plural.toLowerCase()]}):null]}),Py(e)?(0,G.jsx)(`div`,{className:`line-clamp-1 text-[12px] text-fg-subtle`,children:Py(e)}):null]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:Yy(e)})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top text-[13px] text-fg-muted`,children:e.phase}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}function db({job:e}){let t=My(e),n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null;return(0,G.jsxs)(`tr`,{className:`group bg-overlay/20 transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2 pl-7`,children:[(0,G.jsx)(Cr,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle/70`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:t,className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg-muted group-hover:text-accent-300`,children:n??Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:By.singularLower})]}),(0,G.jsx)(`div`,{className:`truncate text-[11px] text-fg-subtle`,children:e.id})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:Yy(e)})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:e.phase}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}var fb=[{value:`active`,label:`Active`},{value:`waiting`,label:`Awaiting`},{value:`terminal`,label:`Finished`},{value:`all`,label:`All`}];function pb(e){return(e.campaignChildren??[]).reduce((e,t)=>{e.total+=1;let n=t.summary?.status??t.status;return n===`complete`||n===`skipped`||n===`cancelled`?e.done+=1:n===`failed`||n===`escalated`?e.blocked+=1:e.active+=1,e},{total:0,done:0,active:0,blocked:0})}function mb(e){if(!Ky(e))return Ly(e);let t=pb(e);if(t.total===0)return`Planning ${By.singularLower} graph`;let n=[`${t.done}/${t.total} done`];return t.active>0&&n.push(`${t.active} active`),t.blocked>0&&n.push(`${t.blocked} blocked`),n.join(` · `)}function hb(){let[e,t]=Fn(),{jobs:n,loading:r,error:i}=Eo(),[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(`active`),[l,u]=(0,x.useState)(()=>new Set),d=(0,x.useMemo)(()=>Ry(n),[n]),f=(0,x.useMemo)(()=>Jy(d),[d]),[p,m]=(0,x.useState)(e.get(`workflow`)??`all`);(0,x.useEffect)(()=>{if((e.get(`workflow`)??`all`)!==p){let n=new URLSearchParams(e);p===`all`?n.delete(`workflow`):n.set(`workflow`,p),t(n,{replace:!0})}},[p,e,t]),(0,x.useEffect)(()=>{let t=e.get(`workflow`)??`all`;t!==p&&m(t)},[e]);let h=(0,x.useMemo)(()=>{let e=a.trim().toLowerCase();return t=>p!==`all`&&Wy(t.workflowPath)!==p||s===`active`&&jo(t.status)||s===`waiting`&&!Mo(t.status)||s===`terminal`&&!jo(t.status)?!1:e?[t.id,Ny(t),Py(t),Iy(t),t.phase,mb(t),jy(t.workflowPath),t.workflowPath].filter(Boolean).join(` `).toLowerCase().includes(e):!0},[a,s,p]),g=(0,x.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),_=(0,x.useMemo)(()=>{let e=new Map;for(let t of d){let n=qy(t);if(!n)continue;let r=e.get(n)??[];r.push(t),e.set(n,r)}return e},[d]),v=(0,x.useMemo)(()=>{let e=[];for(let t of d){let n=qy(t);if(!(!n||!g.has(n)))continue;let r=_.get(t.id)??[];(h(t)||r.some(h))&&e.push({parent:t,subRuns:r})}return e},[d,g,_,h]),y=(0,x.useMemo)(()=>v.reduce((e,t)=>e+1+t.subRuns.length,0),[v]),b=d.filter(e=>!jo(e.status)).length,S=d.filter(e=>Mo(e.status)).length;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{title:Vy.runsList,description:Vy.runsListDescription,actions:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsxs)(Dn,{to:`/jobs/new`,children:[Vy.newRun,(0,G.jsx)(rr,{})]})})}),(0,G.jsxs)(lg,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line p-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(ab,{options:f,value:p,onChange:m,size:`sm`,ariaLabel:`Filter by workflow`}),(0,G.jsx)(ab,{options:fb,value:s,onChange:c,size:`sm`,ariaLabel:`Filter by status`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative w-full lg:w-72`,children:[(0,G.jsx)(yi,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`Search ${zy.pluralLower}`,className:`h-9 pl-9 text-[13px]`})]}),(0,G.jsxs)(`span`,{className:`hidden whitespace-nowrap text-[11px] uppercase tracking-[0.14em] text-fg-subtle sm:inline`,children:[y,` / `,d.length,(0,G.jsxs)(`span`,{className:`ml-2 text-fg-subtle/70`,children:[`· `,b,` active · `,S,` awaiting`]})]})]})]}),(0,G.jsx)(pg,{className:`p-0`,children:i?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(gg,{title:`Could not load ${zy.pluralLower}`,message:i})}):r?(0,G.jsx)(`div`,{className:`space-y-2 p-4`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(bg,{className:`h-14 w-full`},t))}):v.length===0?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(ib,{icon:gr,title:`No ${zy.pluralLower} match the current view`,description:`Create a ${zy.singularLower} or widen the filters to bring more work into view.`,action:(0,G.jsx)(Y,{asChild:!0,children:(0,G.jsx)(Dn,{to:`/jobs/new`,children:`Create ${zy.singularLower}`})})})}):(0,G.jsx)(gb,{rows:v,collapsed:l,onToggle:e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}})})]})]})}function gb({rows:e,collapsed:t,onToggle:n}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full min-w-[920px] text-sm`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-line text-left text-[10px] uppercase tracking-[0.16em] text-fg-subtle`,children:[(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:zy.singular}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Workflow`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Status`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Working on`}),(0,G.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Updated`}),(0,G.jsx)(`th`,{className:`px-4 py-3 text-right font-medium`,children:`Cost`})]})}),(0,G.jsx)(`tbody`,{className:`divide-y divide-line`,children:e.map(e=>{let r=e.subRuns.length>0,i=r&&t.has(e.parent.id);return(0,G.jsx)(_b,{row:e,isCollapsed:i,showChildren:r&&!i,onToggle:n},e.parent.id)})})]})})}function _b({row:e,isCollapsed:t,showChildren:n,onToggle:r}){let i=e.subRuns.length>0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(vb,{job:e.parent,subRunCount:e.subRuns.length,isCollapsed:t,onToggle:i?()=>r(e.parent.id):void 0}),n?e.subRuns.map(e=>(0,G.jsx)(yb,{job:e},e.id)):null]})}function vb({job:e,subRunCount:t,isCollapsed:n,onToggle:r}){let i=Yy(e),a=Ay(e)||t>0,o=n?ur:lr;return(0,G.jsxs)(`tr`,{className:`group transition-colors hover:bg-overlay/40`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay hover:text-fg`,"aria-label":n?`Expand ${By.pluralLower}`:`Collapse ${By.pluralLower}`,"aria-expanded":!n,children:(0,G.jsx)(o,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:My(e),className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg group-hover:text-accent-300`,children:Ny(e)}),a?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-muted`,title:`Hosts ${By.pluralLower}`,children:[(0,G.jsx)(Yr,{className:`size-2.5`}),t>0?`${t} ${t===1?By.singularLower:By.pluralLower}`:By.plural.toLowerCase()]}):null]}),(0,G.jsx)(`div`,{className:`truncate text-[12px] text-fg-subtle`,children:[Iy(e)].filter(Boolean).join(` · `)||e.id})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:i})}),(0,G.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsxs)(`td`,{className:`px-4 py-3 align-top text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px]`,children:mb(e)}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`phase: `,e.phase]})]}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}function yb({job:e}){let t=Yy(e),n=typeof e.params.campaignChildName==`string`?e.params.campaignChildName:null;return(0,G.jsxs)(`tr`,{className:W(`group bg-overlay/20 transition-colors hover:bg-overlay/40`),children:[(0,G.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2 pl-7`,children:[(0,G.jsx)(Cr,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle/70`,"aria-hidden":!0}),(0,G.jsxs)(Dn,{to:My(e),className:`block min-w-0 flex-1 space-y-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg-muted group-hover:text-accent-300`,children:n??Ny(e)}),(0,G.jsx)(`span`,{className:`inline-flex items-center gap-0.5 rounded-md border border-line bg-overlay px-1.5 py-0.5 text-[10px] uppercase tracking-[0.14em] text-fg-subtle`,title:By.singular,children:By.singularLower})]}),(0,G.jsx)(`div`,{className:`truncate text-[11px] text-fg-subtle`,children:[Iy(e),e.id].filter(Boolean).join(` · `)})]})]})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-line bg-overlay px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.12em] text-fg-muted`,children:t})}),(0,G.jsx)(`td`,{className:`px-4 py-2.5 align-top`,children:(0,G.jsx)(yg,{status:e.status})}),(0,G.jsxs)(`td`,{className:`px-4 py-2.5 align-top text-fg-muted`,children:[(0,G.jsx)(`div`,{className:`line-clamp-1 text-[13px]`,children:Ly(e)}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`phase: `,e.phase]})]}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-[13px] text-fg-muted`,children:Cy(e.updatedAt)}),(0,G.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2.5 align-top text-right tabular-nums text-fg-muted`,children:Ey(e.tokenUsage?.totalCostUsd??0)})]})}var bb=x.forwardRef(function({className:e,...t},n){return(0,G.jsx)(`textarea`,{ref:n,className:W(`flex min-h-28 w-full rounded-xl border border-line-strong bg-overlay px-3.5 py-3 text-sm text-fg shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-400/60 disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}),xb=`Tabs`,[Sb,Cb]=Ss(xb,[Kd]),wb=Kd(),[Tb,Eb]=Sb(xb),Db=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Es(s),[d,f]=gc({prop:r,onChange:i,defaultProp:a??``,caller:xb});return(0,G.jsx)(Tb,{scope:n,baseId:tl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,G.jsx)(ps.div,{dir:u,"data-orientation":o,...l,ref:t})})});Db.displayName=xb;var Ob=`TabsList`,kb=x.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Eb(Ob,n),o=wb(n);return(0,G.jsx)(af,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,G.jsx)(ps.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});kb.displayName=Ob;var Ab=`TabsTrigger`,jb=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Eb(Ab,n),s=wb(n),c=Pb(o.baseId,r),l=Fb(o.baseId,r),u=r===o.value;return(0,G.jsx)(of,{asChild:!0,...s,focusable:!i,active:u,children:(0,G.jsx)(ps.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:X(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:X(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:X(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});jb.displayName=Ab;var Mb=`TabsContent`,Nb=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Eb(Mb,n),c=Pb(s.baseId,r),l=Fb(s.baseId,r),u=r===s.value,d=x.useRef(u);return x.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,G.jsx)(_s,{present:i||u,children:({present:n})=>(0,G.jsx)(ps.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Nb.displayName=Mb;function Pb(e,t){return`${e}-trigger-${t}`}function Fb(e,t){return`${e}-content-${t}`}var Ib=Db,Lb=kb,Rb=jb,zb=Nb;function Bb({className:e,...t}){return(0,G.jsx)(Ib,{className:W(`flex flex-col gap-4`,e),...t})}function Vb({className:e,...t}){return(0,G.jsx)(Lb,{className:W(`inline-flex h-10 items-center gap-1 border-b border-line text-fg-muted`,e),...t})}function Hb({className:e,...t}){return(0,G.jsx)(Rb,{className:W(`relative -mb-px inline-flex h-10 items-center justify-center gap-1.5 border-b-2 border-transparent px-3 text-sm font-medium text-fg-muted transition-[color,border-color] hover:text-fg focus-visible:outline-none focus-visible:text-fg`,`data-[state=active]:border-accent-400 data-[state=active]:text-fg`,e),...t})}function Ub({className:e,...t}){return(0,G.jsx)(zb,{className:W(`outline-none`,e),...t})}var Wb=/^---\n([\s\S]*?)\n---\n?/,Gb=/^```([a-zA-Z0-9_-]*)\n([\s\S]*?)\n```/;function Kb(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function qb(e){let t=Kb(e);return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code class="rounded bg-overlay px-1 py-0.5 text-[11px]">${t}</code>`),t=t.replace(/\*\*([^*]+)\*\*/g,`<strong class="font-semibold text-fg">$1</strong>`),t=t.replace(/(^|[^*])\*([^*\n]+)\*/g,`$1<em>$2</em>`),t}function Jb(e){let t=e.replace(/\r\n/g,`
|
|
56
56
|
`),n=[],r=Wb.exec(t);r&&(n.push(`<div class="rounded-md border border-line bg-overlay/40 p-2"><div class="mb-1 text-[10px] uppercase tracking-wide text-fg-subtle">front matter</div><pre class="whitespace-pre-wrap font-mono text-[11px] leading-5 text-fg-muted">${Kb(r[1])}</pre></div>`),t=t.slice(r[0].length));let i=0,a=t.split(`
|
|
57
57
|
`),o=null,s=[];function c(){o&&=(n.push(`<${o} class="${o===`ul`?`list-disc`:`list-decimal`} space-y-1 pl-5 text-fg">${s.map(e=>`<li>${e}</li>`).join(``)}</${o}>`),s.length=0,null)}let l=[];function u(){l.length!==0&&(n.push(`<p class="text-fg-muted">${l.map(qb).join(` `)}</p>`),l=[])}for(;i<a.length;){let e=a[i],t=a.slice(i).join(`
|
|
58
58
|
`),r=Gb.exec(t);if(r&&t.startsWith(r[0])){u(),c();let e=r[1];n.push(`<pre class="overflow-auto rounded-md border border-line bg-canvas/80 p-3 text-[11px] leading-5"><code data-lang="${Kb(e)}">${Kb(r[2])}</code></pre>`);let t=r[0].split(`
|
|
@@ -117,7 +117,7 @@ Provide the actual conventions, snippets, or domain knowledge.
|
|
|
117
117
|
|
|
118
118
|
A short, durable insight worth remembering across jobs.
|
|
119
119
|
`}}}function Uw({open:e,onOpenChange:t,layer:n,kind:r,onCreated:i}){let[a,o]=(0,x.useState)(``),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(``),[d,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(!1),[_,v]=(0,x.useState)(null),y=(0,x.useRef)(null),b=(0,x.useMemo)(()=>Vw(a),[a]);(0,x.useEffect)(()=>{if(!e)return;let t=Hw(r,`my-`+r);o(`my-`+r),c(t.content),u(t.path),f(null),v(null)},[e,r]),(0,x.useEffect)(()=>{if(!e)return;let t=Hw(r,b||`my-`+r);u(t.path),c(e=>e.includes(`# Agent: my-`)||e.includes(`# Workflow: my-`)||e.startsWith(`---
|
|
120
|
-
name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{if(!e||!l||!s){f(null);return}return y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{m(!0),q(`/intelligence/preflight`,J({path:l,content:s},{method:`POST`})).then(e=>f(e)).catch(()=>f(null)).finally(()=>m(!1))},250),()=>{y.current&&window.clearTimeout(y.current)}},[e,l,s]);async function S(){if(!(!d?.ok||h)){g(!0),v(null);try{await q(`/intelligence/file`,J({layer:n,path:l,content:s},{method:`PUT`})),i({layer:n,path:l}),t(!1)}catch(e){v(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{g(!1)}}}let C=d?.ok===!0&&!h&&!p;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`px-6 pt-6`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(kr,{className:`size-4 text-accent-300`}),`New `,Bw[r],` in `,n===`tenant`?`Custom`:n]}),(0,G.jsx)(m_,{children:`Pick a name, edit the scaffolded content, and Coro pre-validates before saving.`})]}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 overflow-y-auto space-y-4 px-6 pb-6`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] items-center gap-3`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Name`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`my-${r}`,autoFocus:!0}),(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Resolved path`}),(0,G.jsx)(`code`,{className:`truncate rounded bg-overlay/60 px-2 py-1 font-mono text-[11px] text-fg-subtle`,children:l})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Content`}),(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[s.length,` chars`]})]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`h-[280px] w-full resize-y rounded-md border border-line bg-canvas/60 px-3 py-2 font-mono text-[12px] leading-relaxed text-fg outline-none focus:border-accent-400`})]}),(0,G.jsx)(Rw,{preflight:d,loading:p}),_?(0,G.jsx)(`div`,{className:`rounded-md border border-danger-500/50 bg-danger-500/10 px-3 py-2 text-[12px] text-danger-400`,children:_}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-line px-6 py-3`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:h,children:`Cancel`}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:S,disabled:!C,children:[h?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):null,`Create`]})]})]})})}var Ww={workflow:{label:`Workflow`,plural:`Workflows`,Icon:B,tone:`text-accent-300`,description:`Multi-phase plans the runner dispatches against. Each workflow sequences agents into phases.`},agent:{label:`Agent`,plural:`Agents`,Icon:ar,tone:`text-success`,description:`Per-phase Claude personas. Override one to change how a phase reasons or what tools it uses.`},skill:{label:`Skill`,plural:`Skills`,Icon:Di,tone:`text-warning`,description:`Claude Code skills picked up automatically when the matching context appears.`},memory:{label:`Memory`,plural:`Memory`,Icon:or,tone:`text-fg-muted`,description:`Append-mode notes. Every layer’s memory file is concatenated at runtime — nothing is shadowed.`}},Gw={base:{label:`Coro`,Icon:ii,tone:`text-fg-muted`,pitch:`Ships with the Coro runner. Read-only — copy any artefact into Custom or Repo to customise it.`},tenant:{label:`Custom`,Icon:Yr,tone:`text-accent-300`,pitch:`Your overlay at ~/.coro/intelligence. Wins over Coro for every repo on this machine.`},repo:{label:`Repo`,Icon:Si,tone:`text-success`,pitch:`The target repo’s .coro/ folder. Highest priority — wins over both Coro and Custom.`}},Kw=`coro:intelligence:intro-dismissed`;function qw(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(()=>typeof window>`u`?!0:window.localStorage.getItem(Kw)!==`1`),[u,d]=(0,x.useState)([]),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(!1);async function b(e){try{let[n,i]=await Promise.all([q(`/intelligence/layers`,{signal:e}),po().catch(()=>[])]);if(e?.aborted)return;t(n),d(i),r(null)}catch(e){if(e.name===`AbortError`)return;r(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{a(!1),s(!1)}}(0,x.useEffect)(()=>{let e=new AbortController;return b(e.signal),()=>e.abort()},[]);function S(){l(!1),typeof window<`u`&&window.localStorage.setItem(Kw,`1`)}async function C(){s(!0),await b()}let w=(0,x.useMemo)(()=>{let t={workflow:[],agent:[],skill:[],memory:[]};if(!e)return t;for(let n of e.artefacts)t[n.kind].push(n);return t},[e]);function T(e){let t=e.path.split(`/`)[1],n=u.find(n=>n.id===t||n.workflowPath===e.path);n&&(p(n),h(!0))}function E(e){_({layer:e.layer,path:e.path,displayName:e.displayName,overrides:e.overrides}),y(!0)}let D=(0,x.useMemo)(()=>e?.layers.filter(e=>e.writable).map(e=>e.layer)??[],[e]);function O(e){C(),_({layer:e.layer,path:e.path,displayName:e.path.split(`/`).pop()??e.path}),y(!0)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{eyebrow:`Intelligence`,title:`Layered Intelligence`,description:`Every workflow, agent, skill, and memory note the runner can see — grouped by the layer it lives on. Drop files into Custom or Repo to customise behaviour without forking the Coro intelligence.`,actions:(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:C,disabled:i||o,children:[(0,G.jsx)(hi,{className:`size-3.5 ${o?`animate-spin`:``}`}),`Refresh`]})}),c?(0,G.jsxs)(`div`,{className:`relative rounded-xl border border-line bg-overlay/40 p-4 pr-10 text-sm text-fg-muted`,children:[(0,G.jsx)(`button`,{onClick:S,className:`absolute right-3 top-3 rounded-md p-1 text-fg-subtle hover:bg-overlay hover:text-fg`,"aria-label":`Dismiss`,children:(0,G.jsx)(Pi,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{children:[`Coro resolves intelligence in three layers: `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Repo`}),` `,`(the working repo’s `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder) wins over`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Custom`}),` (your`,` `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`~/.coro/intelligence`}),` overlay), which wins over the`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Coro`}),` intelligence shipped with the runner.`]}),(0,G.jsxs)(`p`,{children:[`Most artefacts use `,(0,G.jsx)(`em`,{children:`last-wins replace`}),`: the highest-priority copy is the only one used. Memory files use `,(0,G.jsx)(`em`,{children:`append`}),`: every layer’s contribution is concatenated, so notes stack across layers. Drop a file at the matching path in a higher layer to override (or extend, for memory).`]})]})]})]}):null,i&&!e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`})]}):e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[e.layers.map(e=>(0,G.jsx)(Jw,{layer:e,onCreated:O},e.layer)),e.layers.some(e=>e.layer===`repo`)?null:(0,G.jsx)(Yw,{})]}):null,n?(0,G.jsx)(gg,{title:`Couldn’t load intelligence catalogue`,message:n}):null,e?(0,G.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[`workflow`,`agent`,`skill`,`memory`].map(e=>(0,G.jsx)(Xw,{kind:e,artefacts:w[e],writableLayers:D,onCreated:O,onOpenInspector:E,onOpenWorkflow:e===`workflow`?T:void 0},e))}):null,(0,G.jsx)(KC,{open:m,onOpenChange:h,workflow:f}),(0,G.jsx)(zw,{open:v,onOpenChange:y,target:g,onChanged:e=>{e&&_(t=>t&&{...t,layer:e.layer,path:e.path}),C()}})]})}function Jw({layer:e,onCreated:t}){let n=Gw[e.layer],r=n.Icon,i=e.counts.workflow+e.counts.agent+e.counts.skill+e.counts.memory;return(0,G.jsxs)(lg,{className:`flex flex-col`,children:[(0,G.jsxs)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(r,{className:`size-4 ${n.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:n.label}),(0,G.jsx)(UC,{layer:e.layer,size:`sm`}),e.writable?null:(0,G.jsx)(`span`,{className:`rounded bg-fg/8 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:`read-only`})]}),(0,G.jsx)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:n.pitch})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.writable?(0,G.jsx)($w,{layer:e.layer,onCreated:t}):null,(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums`,children:i}),(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`files`})]})]})]}),(0,G.jsxs)(pg,{className:`space-y-2 pt-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Rr,{className:`size-3`}),(0,G.jsx)(`code`,{className:`truncate font-mono`,title:e.root,children:Qw(e.root)})]}),e.exists?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3 text-warning`}),`Not yet created on disk.`]}),(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-1 pt-1`,children:[`workflow`,`agent`,`skill`,`memory`].map(t=>{let n=Ww[t].Icon;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 rounded-md border border-line bg-overlay/30 px-1 py-1.5`,title:Ww[t].plural,children:[(0,G.jsx)(n,{className:`size-3 ${Ww[t].tone}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums`,children:e.counts[t]})]},t)})})]})]})}function Yw(){return(0,G.jsx)(lg,{className:`flex flex-col border-dashed bg-overlay/20`,children:(0,G.jsx)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Si,{className:`size-4 text-success`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:`Repo`}),(0,G.jsx)(UC,{layer:`repo`,size:`sm`})]}),(0,G.jsxs)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:[`Highest-priority overlay, scoped to a single repo via its `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder. Surfaces here once a job clones a repo with one.`]})]})})})}function Xw({kind:e,artefacts:t,writableLayers:n,onCreated:r,onOpenInspector:i,onOpenWorkflow:a}){let o=Ww[e],s=o.Icon;return(0,G.jsxs)(lg,{className:`flex min-h-[12rem] flex-col`,children:[(0,G.jsxs)(ug,{className:`space-y-1 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(s,{className:`size-4 ${o.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:o.plural})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`rounded bg-overlay/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-muted`,children:t.length}),n.length>0?(0,G.jsx)(eT,{kind:e,writableLayers:n,onCreated:r}):null]})]}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-fg-subtle`,children:o.description})]}),(0,G.jsx)(pg,{className:`flex-1 space-y-1.5 pt-0`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex h-24 items-center justify-center text-center text-[11px] text-fg-subtle`,children:[`No `,o.plural.toLowerCase(),` found.`]}):t.map(e=>(0,G.jsx)(Zw,{artefact:e,onOpenInspector:i,onOpenWorkflow:a},`${e.layer}:${e.path}`))})]})}function Zw({artefact:e,onOpenInspector:t,onOpenWorkflow:n}){return(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`group block w-full rounded-lg border border-line bg-canvas/30 p-2.5 text-left transition-colors hover:border-accent-500/40 hover:bg-overlay/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:e.displayName}),e.kind===`memory`?(0,G.jsx)(`span`,{title:`Append-mode: stacks across layers`,className:`text-[10px] text-fg-subtle`,children:`∥`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ir,{className:`size-2.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`code`,{className:`truncate font-mono text-[10px] text-fg-subtle`,title:e.path,children:e.path})]}),e.description?(0,G.jsx)(`p`,{className:`line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,e.kind===`workflow`&&n?(0,G.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e)},className:`mt-1 inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide text-accent-300 hover:text-accent-200`,children:`View phases →`}):null]}),(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`})]})})}function Qw(e){if(typeof window>`u`)return e;let t=e.match(/^\/(?:Users|home)\/[^/]+/);return t?`~`+e.slice(t[0].length):e}function $w({layer:e,onCreated:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(`memory`);function o(e){a(e),r(!0)}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 px-2`,children:[(0,G.jsx)(pi,{className:`size-3`}),`New`]})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsx)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`New artefact`}),(0,G.jsx)(eg,{}),[`workflow`,`agent`,`skill`,`memory`].map(e=>{let t=Ww[e].Icon;return(0,G.jsxs)(Qh,{onClick:()=>o(e),children:[(0,G.jsx)(t,{className:`mr-2 size-3.5 ${Ww[e].tone}`}),Ww[e].label]},e)})]})]}),(0,G.jsx)(Uw,{open:n,onOpenChange:r,layer:e,kind:i,onCreated:e=>t?.(e)})]})}function eT({kind:e,writableLayers:t,onCreated:n}){let[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(t[0]),s=Ww[e];function c(e){o(e),i(!0)}let l=`inline-flex size-6 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay/60 hover:text-fg`,u=`New ${s.label.toLowerCase()}`;return(0,G.jsxs)(G.Fragment,{children:[t.length===1?(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(t[0]),className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})}):(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsxs)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:[`New `,s.label.toLowerCase(),` in…`]}),(0,G.jsx)(eg,{}),t.map(e=>(0,G.jsxs)(Qh,{onClick:()=>c(e),children:[(0,G.jsx)(UC,{layer:e,size:`sm`}),(0,G.jsx)(`span`,{className:`ml-2`,children:Gw[e].label})]},e))]})]}),(0,G.jsx)(Uw,{open:r,onOpenChange:i,layer:a,kind:e,onCreated:e=>n?.(e)})]})}var tT=[{id:`general`,group:`setup`,label:`General`,description:`Coach mode and Coro plan mode preferences.`,icon:Ei,required:!1},{id:`llm-provider`,group:`setup`,label:`LLM provider`,description:`Authenticate the runner against the model that drives every job.`,icon:ar,required:!0},{id:`source-control`,group:`setup`,label:`Source control`,description:`Git credentials used for clone, branch, push, and PR operations.`,icon:Vr,required:!0},{id:`issue-tracker`,group:`setup`,label:`Issue tracker`,description:`Optional. Used by campaigns when they need to file an epic + child issues.`,icon:Ai,required:!1},{id:`plugins`,group:`extensions`,label:`Plugins`,description:`Provider integrations the runner has loaded plus drop-in installation.`,icon:fi,required:!1},{id:`mcp`,group:`extensions`,label:`MCP servers`,description:`Bring-your-own MCP servers and Claude Code inheritance.`,icon:Si,required:!1},{id:`guardrails`,group:`extensions`,label:`Guardrails`,description:`Policies the runner enforces before agents open PRs or call tools.`,icon:Ti,required:!1},{id:`paths`,group:`advanced`,label:`Paths`,description:`Filesystem locations for intelligence overlays and working repositories.`,icon:zr,required:!1}],nT={setup:{title:`Setup`,hint:`Required to run jobs. Finish these first.`},extensions:{title:`Extensions`,hint:`Opt-in capabilities. Add when you need them.`},advanced:{title:`Advanced`,hint:`Rarely changed. Defaults work for most installs.`}};function rT(e){let t=tT.find(t=>t.id===e);if(!t)throw Error(`Unknown settings section id: ${e}`);return t}function iT({title:e,description:t,status:n,statusLabel:r,required:i,action:a,footer:o,className:s,children:c}){return(0,G.jsxs)(lg,{className:s,children:[(0,G.jsxs)(ug,{className:W(`gap-3 border-b border-line pb-4`,a?`sm:flex-row sm:items-start sm:justify-between`:``),children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(dg,{children:e}),i?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,n?(0,G.jsx)(jv,{status:n,label:r}):null]}),t?(0,G.jsx)(fg,{children:t}):null]}),a?(0,G.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,G.jsx)(pg,{className:`space-y-5 pt-5`,children:c}),o?(0,G.jsx)(`div`,{className:`border-t border-line bg-overlay/30 px-6 py-3 text-xs text-fg-subtle`,children:o}):null]})}function aT({onTest:e,disabled:t,label:n,className:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null);async function c(){a(!0),s(null);try{s(await e())}catch(e){s({ok:!1,message:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`div`,{className:W(`flex w-full flex-col gap-2`,r),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:t||i,children:[i?(0,G.jsx)($r,{className:`size-3.5 animate-spin`}):(0,G.jsx)(di,{className:`size-3.5`}),i?`Testing…`:n??`Test connection`]}),o?(0,G.jsxs)(`div`,{className:W(`flex items-center gap-1.5 text-xs`,o.ok?`text-success-300`:`text-danger-300`),role:`status`,children:[o.ok?(0,G.jsx)(fr,{className:`size-3.5`}):(0,G.jsx)(_r,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:o.message??(o.ok?`Connection succeeded.`:`Connection failed.`)})]}):null]}),o?.checks&&o.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2 text-xs`,children:o.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.ok?(0,G.jsx)(fr,{className:`mt-0.5 size-3.5 shrink-0 text-success-300`}):(0,G.jsx)(_r,{className:`mt-0.5 size-3.5 shrink-0 text-danger-300`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,G.jsx)(`span`,{className:W(`font-medium`,e.ok?`text-fg`:`text-danger-300`),children:e.name}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e.message})]}),!e.ok&&e.hint?(0,G.jsxs)(`span`,{className:`text-fg-subtle italic`,children:[`→ `,e.hint]}):null]})]},`${e.name}-${t}`))}):null]})}var oT={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-2 xl:grid-cols-4`};function sT({name:e,value:t,options:n,onChange:r,cols:i=3,className:a}){let o=e??`choice-${Math.random().toString(36).slice(2,8)}`;return(0,G.jsx)(`div`,{role:`radiogroup`,className:W(`grid gap-3`,oT[i],a),children:n.map(e=>{let n=e.value===t;return(0,G.jsxs)(`label`,{className:W(`cursor-pointer rounded-2xl border px-4 py-3 text-left text-sm transition-colors`,n?`border-accent-500/40 bg-accent-500/8 text-fg ring-1 ring-accent-500/30`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong hover:text-fg`,e.disabled&&`cursor-not-allowed opacity-60`),children:[(0,G.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:e.disabled,onChange:()=>!e.disabled&&r(e.value),className:`sr-only`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.label}),e.badge]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:e.description}):null]},e.value)})})}var cT=[{value:`claudeLogin`,label:`Claude login`,description:`Recommended. Uses Claude Code's local session and MCP permissions.`},{value:`apiKey`,label:`API key`,description:`Direct Anthropic billing with explicit service credentials.`},{value:`oauth`,label:`Legacy OAuth token`,description:`Fallback only. Stores a raw token without session refresh.`}];function lT({pluginId:e,onConnected:t}){let{draft:n,setPluginField:r}=y_(),i=n.pluginInstalled[e]?.config??{},a=i.method??`claudeLogin`,o=i.apiKey??``,s=i.oauthToken??``,c=i.account??null,[l,u]=(0,x.useState)({status:`idle`}),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a===`claudeLogin`&&l.status===`idle`&&c&&u({status:`connected`,account:c})},[a,c,l.status]),(0,x.useEffect)(()=>{if(l.status!==`authorizing`)return;let n=window.setInterval(async()=>{try{let n=await q(`/config/anthropic/claude-login/status`);if(n.status===`idle`)return;u(n),n.status===`connected`&&(r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),t?.())}catch{}},2e3);return()=>window.clearInterval(n)},[l.status,e,r,t]);let A=l.account??c,j=l.automaticUrl??l.manualUrl??null,M=l.status===`connected`||!!A;function N(t){r(e,`method`,t),b(null),T(null),D(null)}async function ee(){f(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/start`,{method:`POST`});if(u(n),r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),n.status===`connected`){t?.();return}if(n.status===`authorizing`&&(n.automaticUrl||n.manualUrl)&&window.open(n.automaticUrl??n.manualUrl,`_blank`,`noopener,noreferrer`),n.status===`error`)throw Error(n.error??`Claude login failed to start.`)}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{f(!1)}}async function te(){m(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/callback`,J(dT(h,_),{method:`POST`}));if(u(n),n.status!==`connected`)throw Error(n.error??`Claude login did not complete.`);r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),g(``),v(``),t?.()}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}}async function P(){try{return await q(`/test/llm`,J({provider:e,config:i},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}let F=a===`claudeLogin`?l.status===`connected`||!!c:a===`apiKey`?o.length>0:s.length>0;async function I(){C(!0),T(`Launching Claude Code login. Complete sign-in in your browser…`),D(null),b(null);try{let t=await q(`/config/anthropic/generate-oauth-token`,{method:`POST`});t.authUrl&&D(t.authUrl),t.token?(r(e,`oauthToken`,t.token),r(e,`method`,`oauth`),T(`Token captured (${t.token.slice(0,16)}…). Click Save to persist it.`)):(b(`Token generation returned no token.`),T(null))}catch(e){if(e instanceof K){let t=e.payload;t?.authUrl&&D(t.authUrl),(t?.error===`CLI_NOT_FOUND`||t?.error===`PLATFORM_UNSUPPORTED`)&&k(!0),b(t?.message??t?.stderr??e.message)}else b(e instanceof Error?e.message:String(e));T(null)}finally{C(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Sv,{label:`Authentication method`,children:(0,G.jsx)(sT,{name:`${e}-anthropic-method`,value:a,onChange:N,options:cT,cols:3})}),y?(0,G.jsx)(Ov,{tone:`danger`,children:y}):null,a===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(jv,{status:pT(l),label:mT(l)}),A?.email?(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:A.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void ee(),disabled:d,children:d?`Starting…`:M?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Uses Claude Code's local login session, including MCP permissions and session refresh. No copy-pasted token is stored in Coro.`}),A?(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(fT,{label:`Provider`,value:uT(A.apiProvider)}),(0,G.jsx)(fT,{label:`Organization`,value:A.organization??`Not reported`}),(0,G.jsx)(fT,{label:`Plan`,value:A.subscriptionType??`Not reported`}),(0,G.jsx)(fT,{label:`Token source`,value:A.tokenSource??`Not reported`})]}):null,l.status===`authorizing`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Ov,{tone:`warning`,children:`Waiting for the Claude browser login to finish. This panel polls automatically.`}),j?(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-canvas/40 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Continue here:`}),(0,G.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block break-all text-accent-300 hover:text-accent-400`,children:j})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-line bg-canvas/40 p-3`,children:[(0,G.jsx)(Sv,{label:`Callback URL or authorization code`,hint:`Use this only if automatic completion fails.`,children:(0,G.jsx)(O_,{value:h,onChange:e=>g(e.target.value),placeholder:`Paste the redirected URL or the code parameter`})}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`State override`,hint:`Optional if you pasted a raw authorization code.`,children:(0,G.jsx)(O_,{value:_,onChange:e=>v(e.target.value),placeholder:`Optional state`})}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void te(),disabled:p,children:p?`Completing…`:`Complete manually`})]})]})]}):null]}):null,a===`apiKey`?(0,G.jsx)(Sv,{label:`API key`,required:!0,hint:`Anthropic API key from console.anthropic.com.`,children:(0,G.jsx)(Cv,{value:o,onChange:t=>r(e,`apiKey`,t.target.value),placeholder:`sk-ant-…`})}):null,a===`oauth`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`OAuth token`,required:!0,hint:`Legacy fallback only. Prefer Claude login whenever possible.`,children:(0,G.jsx)(Cv,{value:s,onChange:t=>r(e,`oauthToken`,t.target.value),placeholder:`sk-ant-oat01-…`})}),O?null:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void I(),disabled:S,children:[(0,G.jsx)(Jr,{}),S?`Generating…`:`Generate via claude setup-token`]}),w?(0,G.jsx)(Ov,{tone:`success`,children:w}):null,E?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Sign in here:`}),(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 block break-all text-accent-300 hover:text-accent-400`,children:E})]}):null]}):null,(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsx)(aT,{onTest:P,disabled:!F,label:`Test connection`}),(0,G.jsxs)(`p`,{className:`mt-2 text-[12px] text-fg-subtle`,children:[`Sends a 1-token `,(0,G.jsx)(`span`,{className:`font-mono`,children:`/v1/messages`}),` ping with your current credentials. For Claude login, reads the OAuth session from your local keychain.`]})]})]})}function uT(e){switch(e){case`firstParty`:return`Claude`;case`anthropicAws`:return`Anthropic AWS`;case`bedrock`:return`Amazon Bedrock`;case`vertex`:return`Vertex AI`;case`foundry`:return`Azure AI Foundry`;default:return e??`Unknown`}}function dT(e,t){let n=e.trim();if(!n)throw Error(`Paste the callback URL or authorization code to complete login manually.`);if(/^https?:\/\//i.test(n)){let e=new URL(n),r=e.searchParams.get(`code`);if(!r)throw Error(`The callback URL is missing the code query parameter.`);return{authorizationCode:r,state:e.searchParams.get(`state`)??(t.trim()||void 0)}}return{authorizationCode:n,state:t.trim()||void 0}}function fT({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:t})]})}function pT(e){switch(e.status){case`connected`:return`ok`;case`authorizing`:return`pending`;case`error`:return`error`;default:return`unset`}}function mT(e){switch(e.status){case`connected`:return`Connected`;case`authorizing`:return`Waiting for browser`;case`error`:return`Failed`;default:return`Not connected`}}var hT={"anthropic-auth":lT};function gT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&(e.properties!==void 0||e.type===`object`)}function _T(e){return/token|apikey|api_key|password|secret|appPassword/i.test(e)}function vT(e,t){return t?.format===`uri`||t?.format===`url`?!0:/url|baseUrl|endpoint|host/i.test(e)}function yT(e,t){return t?.title?t.title:e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function bT(e){if(!gT(e)||!e.properties)return[];let t=new Set(e.required??[]);return Object.entries(e.properties).map(([e,n])=>{let r=_T(e)?`secret`:vT(e,n)?`url`:`text`;return{name:e,label:yT(e,n),hint:n.description,required:t.has(e),kind:r,placeholder:n.default!==void 0&&typeof n.default!=`object`?String(n.default):void 0}})}function xT({plugin:e,onTest:t,defaultControl:n,footerNotice:r,onConnected:i}){let{draft:a,setPluginField:o,setPluginEnabled:s,dirtyPluginIds:c}=y_(),{manifest:l,source:u,configured:d,active:f,activationHint:p}=e,m=l.id in a.pluginInstalled,h=m?a.pluginInstalled[l.id]:{config:{}},g=m&&h.enabled!==!1,_=(0,x.useMemo)(()=>bT(l.configSchema),[l.configSchema]),v=c.has(l.id),y=l.ui?.customPanel?hT[l.ui.customPanel]:void 0,b=_.some(e=>e.required),S=_.filter(e=>e.required).every(e=>{let t=h.config[e.name];return typeof t==`string`?t.length>0:t!=null}),C=Object.values(h.config).some(e=>typeof e==`string`?e.length>0:e!=null),w=g?f&&d?{label:`active`,tone:`success`}:d?{label:`configured`,tone:`warning`}:S&&(b||C)?{label:`ready to save`,tone:`warning`}:{label:`needs setup`,tone:`neutral`}:m?{label:`disabled`,tone:`neutral`}:{label:`not configured`,tone:`neutral`};function T(e){let t=h.config[e.name],n=typeof t==`string`?t:t==null?``:String(t),r=t=>o(l.id,e.name,t);return e.kind===`secret`?(0,G.jsx)(Cv,{value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,autoComplete:`off`}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,inputMode:e.kind===`url`?`url`:void 0})}return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border bg-overlay/40 px-4 py-4 transition-colors`,v?`border-accent-400/50`:`border-line`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(E_,{pluginId:l.id,size:20}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:l.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:l.id}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]`,u===`dropin`?`border-accent-400/40 bg-accent-500/10 text-accent-200`:`border-line bg-overlay/60 text-fg-muted`),children:u===`dropin`?`drop-in`:`built in`}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em]`,zo(w.tone)),children:w.label}),v?(0,G.jsx)(`span`,{className:`rounded-full border border-accent-400/50 bg-accent-500/10 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-accent-200`,children:`unsaved`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`v`,l.version,` · kind `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:l.kind})]}),p&&!d?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:p}):null]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,G.jsx)(`span`,{children:`Enabled`}),(0,G.jsx)(jx,{checked:g,onCheckedChange:e=>s(l.id,e),ariaLabel:`Enable ${l.displayName}`,size:`sm`})]})]}),g?(0,G.jsxs)(G.Fragment,{children:[y?(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(y,{pluginId:l.id,onConnected:i})}):_.length===0?(0,G.jsx)(Ov,{tone:`neutral`,className:`mt-4`,children:`This plugin doesn't expose configuration. Toggle Enable to register it.`}):(0,G.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:_.map(e=>(0,G.jsx)(Sv,{label:e.label,required:e.required,hint:e.hint,className:e.kind===`url`?`sm:col-span-2`:void 0,children:T(e)},e.name))}),(t||n||r)&&(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 border-t border-line pt-4`,children:[t&&!y?(0,G.jsx)(aT,{onTest:()=>t(h.config),disabled:!S}):null,n,r]})]}):null]})}async function ST(e,t){try{return await q(`/test/llm`,J({provider:e,config:t},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}var CT=[`tier:planning`,`tier:coding`,`tier:mini`];function wT(e,t){return e.startsWith(`tier:`)?`tier`:t.has(e)?`declared`:`custom`}function TT(){let[e,t]=(0,x.useState)(new Map);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/workflows`);if(e)return;let r=new Map,i=(e,t)=>{let n=r.get(e)??[];n.push(t),r.set(e,n)};for(let e of n.workflows??[])for(let t of e.phases??[]){let n={workflowId:e.id,workflowName:e.name,phaseName:t.name},r=(t.model??``).trim();r&&i(r,n);let a=(t.tier??``).trim();a&&i(`tier:${a}`,n)}t(r)}catch{}})(),()=>{e=!0}},[]),{usagesByAlias:e,referencedNames:(0,x.useMemo)(()=>Array.from(e.keys()).sort(),[e])}}function ET(){let{draft:e,setDraft:t,pluginsCatalogue:n,pluginsCatalogueError:r}=y_(),i=oy({draft:e,pluginsCatalogue:n}).byId[`llm-provider`],a=(0,x.useMemo)(()=>n?n.plugins.filter(e=>e.manifest.kind===`executor`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[n]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n===void 0||n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]),s=e.llmDefaultProvider,c=e=>{t(`llmDefaultProvider`,e)},l=(0,x.useMemo)(()=>Object.entries(e.llmAliases),[e.llmAliases]),u=e=>{t(`llmAliases`,e)},d=(t,n)=>{if(!n||n===t||e.llmAliases[n])return;let r={};for(let[i,a]of Object.entries(e.llmAliases))r[i===t?n:i]=a;u(r)},f=(t,n)=>{let r=e.llmAliases[t]??{provider:``,model:``};u({...e.llmAliases,[t]:{...r,...n}})},p=t=>{let{[t]:n,...r}=e.llmAliases;u(r)},m=()=>{let t=1,n=`new-alias`;for(;e.llmAliases[n];)t+=1,n=`new-alias-${t}`;u({...e.llmAliases,[n]:{provider:s||o[0]||``,model:``}})},{modelsByProvider:h,loadModels:g}=uC();(0,x.useEffect)(()=>{let e=new Set;for(let[,t]of l)t.provider&&!e.has(t.provider)&&(e.add(t.provider),g(t.provider));s&&g(s)},[l,s,g]);let{usagesByAlias:_,referencedNames:v}=TT(),y=(0,x.useMemo)(()=>new Set(v),[v]),b=(0,x.useMemo)(()=>v.filter(t=>!(t in e.llmAliases)&&!t.startsWith(`tier:`)),[v,e.llmAliases]),S=(0,x.useMemo)(()=>CT.filter(t=>!(t in e.llmAliases)),[e.llmAliases]),C=(0,x.useMemo)(()=>{let e=[],t=[],n=[];for(let r of l){let i=wT(r[0],y);i===`tier`?e.push(r):i===`declared`?t.push(r):n.push(r)}return{tiers:e,declared:t,custom:n}},[l,y]),[w,T]=(0,x.useState)(!1),E=t=>{u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}})},D=`alias-name-suggestions-${(0,x.useId)()}`;return(0,G.jsx)(iT,{title:`LLM providers`,description:`Configure one or more model providers and route workflow aliases to specific provider/model pairs.`,required:!0,status:i.status,statusLabel:i.label,children:(0,G.jsxs)(`div`,{className:`space-y-6`,children:[r?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,r,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No LLM-provider plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>ST(e.manifest.id,t)},e.manifest.id))}),(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default provider`,hint:`Used when an alias or workflow phase does not pin a provider explicitly.`,children:(0,G.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the runner choose — defaults to anthropic)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Aliases`}),(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Workflow shorthands that map to a concrete `,(0,G.jsx)(`span`,{className:`font-mono`,children:`provider/model`}),` pair. Three groups, in increasing specificity:`]}),(0,G.jsxs)(`ul`,{className:`mt-1.5 space-y-0.5 text-[12px] text-fg-subtle`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Tiers`}),` — capability slots every workflow defaults to (planning / coding / mini).`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Workflow-declared`}),` — alias names a specific workflow phase pins via `,(0,G.jsx)(`span`,{className:`font-mono`,children:`model:`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Custom`}),` — anything you've added that no workflow references yet.`]})]})]}),(0,G.jsxs)(DT,{title:`Tiers`,subtitle:`Workflow defaults. Every install needs these — workflows fall back to the matching tier when a phase doesn't pin a model.`,children:[C.tiers.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`tier`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),S.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-subtle`,children:`Not defined in this draft. Active LLM plugins re-seed tier defaults on every runner start — click Define to pin one explicitly.`})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>E(e),disabled:o.length===0,children:`Define`})]},e))}):null]}),C.declared.length>0||b.length>0?(0,G.jsxs)(DT,{title:`Workflow-declared`,subtitle:`Alias names referenced explicitly by a workflow phase via its model: field.`,children:[C.declared.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`declared`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),b.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:b.map(t=>{let n=_.get(t)??[];return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:t}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`Needs definition · used by`,` `,n.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}}),disabled:o.length===0,children:`Define`})]},t)})}):null]}):null,(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`flex w-full items-center justify-between gap-2 text-left text-sm font-medium text-fg-muted hover:text-fg`,children:[(0,G.jsxs)(`span`,{children:[`Custom `,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`(`,C.custom.length,`)`]})]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:w?`Hide`:`Show`})]}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`Free-form aliases not referenced by any workflow. Useful for ad-hoc experiments.`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:C.custom.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`custom`,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t))}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:m,disabled:o.length===0,children:[(0,G.jsx)(pi,{}),`Add alias`]})})]}):null]}),(0,G.jsx)(`datalist`,{id:D,children:b.map(e=>(0,G.jsx)(`option`,{value:e},e))})]}),(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})})}function DT({title:e,subtitle:t,children:n}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:t})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n})]})}function OT({name:e,row:t,kind:n,nameLocked:r=!1,enabledIds:i,executorPlugins:a,modelsByProvider:o,loadModels:s,usages:c,aliasNameDatalistId:l,existingAliasNames:u,onRename:d,onUpdate:f,onRemove:p}){let[m,h]=(0,x.useState)(e),g=(0,x.useRef)(e);(0,x.useEffect)(()=>{e!==g.current&&(h(e),g.current=e)},[e]);let _=m.trim(),v=_!==e,y=v&&_.length>0&&u.includes(_),b=v&&_.length===0,S=()=>{if(v){if(y||b){h(e);return}d(e,_),g.current=_}},C=`alias-help-${e}`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-line bg-canvas/40 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`Alias`,children:(0,G.jsx)(O_,{value:m,list:r?void 0:l,readOnly:r,tabIndex:r?-1:void 0,onChange:e=>h(e.target.value),onBlur:S,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.target.blur()):t.key===`Escape`&&(h(e),t.target.blur())},placeholder:`coding`,"aria-invalid":y||b||void 0,"aria-describedby":C,className:[y||b?`border-danger-400/60`:``,r?`cursor-default bg-overlay/40 font-mono`:``].filter(Boolean).join(` `)||void 0})}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(cC,{value:{provider:t.provider,model:t.model},onChange:t=>{f(e,{provider:t.provider,model:t.model})},providers:i.map(e=>({id:e,displayName:a.find(t=>t.manifest.id===e)?.manifest.displayName??e})),modelsByProvider:o,loadModels:s})}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>p(e),"aria-label":`Remove ${e}`,disabled:n===`tier`,title:n===`tier`?`Tier aliases are required by every workflow.`:void 0,children:(0,G.jsx)(ji,{})})]}),(0,G.jsx)(`div`,{id:C,className:`px-1 text-[11px] leading-4 text-fg-subtle`,children:y?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`An alias with that name already exists.`}):b?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`Alias name cannot be empty.`}):c.length>0?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-muted`,children:`Used in:`}),` `,c.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]}):(0,G.jsx)(`span`,{className:`opacity-70`,children:`Not referenced by any workflow yet.`})})]})}function kT(e,t){return e===`github`?{provider:`github`,username:String(t.owner??``),token:String(t.token??``),workspace:String(t.owner??``)}:e===`bitbucket`?{provider:`bitbucket`,username:String(t.coderUsername??``),token:String(t.coderToken??``),workspace:String(t.workspace??``),reviewerUsername:String(t.reviewerUsername??``),reviewerToken:String(t.reviewerToken??``)}:e===`gitlab`?{provider:`gitlab`,username:String(t.username??t.user??``),token:String(t.token??``),workspace:String(t.workspace??t.group??``)}:null}function AT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`source-control`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`scm`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=kT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/git`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Connection failed.`),checks:e.checks}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Source control`,description:`Git provider plugins. Each plugin handles clone, branch, push, PR, and review for one host. Multiple plugins can be configured side-by-side; the default below decides which one new jobs use unless overridden.`,required:!0,status:i.status,statusLabel:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No source-control plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one source-control plugin is enabled, jobs use this one unless they specify a different SCM at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultScm,onChange:e=>r(`scm`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function jT(e,t){return e===`jira`?{provider:`jira`,jira:{baseUrl:String(t.baseUrl??``),username:String(t.username??``),apiToken:String(t.apiToken??``)}}:e===`linear`?{provider:`linear`,linear:{apiKey:String(t.apiKey??``),teamKey:String(t.teamKey??``)}}:e===`github-issues`?{provider:`github`,git:{provider:`github`,username:String(t.defaultOwner??``),token:String(t.token??``),workspace:String(t.defaultOwner??``)}}:null}function MT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`issue-tracker`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`tracker`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=jT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/tracker`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Connection failed.`)}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Issue tracker`,description:`Tracker plugins. Each plugin maps Coro work units (epics + child issues) to a backlog system. Optional — leave all disabled to run jobs without tracker round-trips.`,status:i.status,statusLabel:i.status===`optional`?`Optional`:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No tracker plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one tracker plugin is enabled, jobs use this one unless they specify a different tracker at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultTracker,onChange:e=>r(`tracker`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function NT(e){return e.configured??e.installed}function PT(e){return NT(e)&&e.active?{label:`enabled`,tone:`success`}:NT(e)?{label:`configured`,tone:`warning`}:e.source===`builtin`?{label:`built in`,tone:`neutral`}:{label:`installed`,tone:`neutral`}}function FT(e){return NT(e)&&e.active?0:NT(e)?1:e.source===`builtin`?2:3}function IT(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null);(0,x.useEffect)(()=>{g()},[]);async function g(){try{r(!0),t(await q(`/plugins`))}catch{t(null)}finally{r(!1)}}async function _(e){e.preventDefault(),d(null),p(null);let t=i.trim();if(!t){d("Enter an npm package name (e.g. `@coro-ai/plugin-gitlab`).");return}try{l(!0);let e={spec:t},n=o.trim();n&&(e.id=n);let r=await q(`/plugins/install`,J(e,{method:`POST`}));p(r.restartHint?`Installed "${r.manifest.displayName}". ${r.restartHint}`:`Installed "${r.manifest.displayName}" and loaded into the registry — no restart needed.`),a(``),s(``),g()}catch(e){d((e instanceof K,e.message))}finally{l(!1)}}async function v(e,t){if(d(null),p(null),window.confirm(`Remove drop-in plugin "${t}"? The runner will need a restart to drop it from memory.`))try{h(e),p(`Removed "${t}". ${(await q(`/plugins/${encodeURIComponent(e)}`,{method:`DELETE`})).restartHint??`Restart the runner to fully unload it.`}`),g()}catch(e){d(`Failed to uninstall ${t}: ${e instanceof K,e.message}`)}finally{h(null)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Install a plugin`,description:`Drop-in plugins live under ~/.coro/plugins/. Paste any npm package name or git/tarball spec — the runner installs it locally and hot-loads it into the registry; configure credentials below to start using it.`,children:(0,G.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[2fr_1fr_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`npm spec`,htmlFor:`plugin-install-spec`,hint:`Examples: @coro-ai/plugin-gitlab, coro-plugin-jenkins@1.2.0, github:my-org/coro-plugin-acme.`,children:(0,G.jsx)(O_,{id:`plugin-install-spec`,value:i,onChange:e=>a(e.target.value),placeholder:`@coro-ai/plugin-gitlab`,disabled:c})}),(0,G.jsx)(Sv,{label:`Plugin id (optional)`,htmlFor:`plugin-install-id`,children:(0,G.jsx)(O_,{id:`plugin-install-id`,value:o,onChange:e=>s(e.target.value),placeholder:`gitlab`,disabled:c})}),(0,G.jsxs)(Y,{type:`submit`,disabled:c||!i.trim(),children:[(0,G.jsx)(ri,{}),c?`Installing…`:`Install`]})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,f?(0,G.jsx)(Ov,{tone:`success`,children:f}):null]})}),(0,G.jsx)(iT,{title:`Installed plugins`,description:`Provider integrations the runner has loaded. Each plugin contributes its own MCP tools, webhook normaliser, and (optionally) intelligence snippets.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void g(),disabled:n,children:[(0,G.jsx)(mi,{}),n?`Refreshing…`:`Refresh`]}),children:e?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default SCM`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.scm??`— (single enabled plugin wins)`})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.tracker??`— (single enabled plugin wins)`})]})]}),e.plugins.some(e=>NT(e)&&e.active)?null:(0,G.jsx)(Ov,{tone:`warning`,children:`No plugins are enabled yet. Coro ships with GitHub, Bitbucket, Jira, Linear, and GitHub Issues. Configure credentials under Source control / Issue tracker and restart the runner.`}),e.plugins.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:`No plugins discovered.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:[...e.plugins].sort((e,t)=>{let n=FT(e)-FT(t);return n===0?e.manifest.displayName.localeCompare(t.manifest.displayName):n}).map(e=>{let{manifest:t,source:n,mcpServer:r,activationHint:i}=e,a=PT(e);return(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fi,{className:`size-4 text-fg-subtle`}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:t.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:t.id}),n===`dropin`?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`kind: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:t.kind}),` · `,`v`,t.version,` · `,`host `,t.hostCompatibility]}),!NT(e)&&i?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:i}):null,r?(0,G.jsxs)(`div`,{className:`mt-2 text-[11px] text-fg-muted`,children:[`Attached MCP server: `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.type}),` · agents see tools as `,(0,G.jsxs)(`span`,{className:`font-mono`,children:[`mcp__`,t.id,`__*`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(a.tone)),children:a.label}),n===`dropin`?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void v(t.id,t.displayName),disabled:m===t.id,children:[(0,G.jsx)(ji,{}),m===t.id?`Removing…`:`Uninstall`]}):null]})]})},t.id)})})]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:n?`Loading plugins…`:`Plugin discovery is unavailable. The runner may be too old or returned an error.`})})]})}var LT=`{
|
|
120
|
+
name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{if(!e||!l||!s){f(null);return}return y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{m(!0),q(`/intelligence/preflight`,J({path:l,content:s},{method:`POST`})).then(e=>f(e)).catch(()=>f(null)).finally(()=>m(!1))},250),()=>{y.current&&window.clearTimeout(y.current)}},[e,l,s]);async function S(){if(!(!d?.ok||h)){g(!0),v(null);try{await q(`/intelligence/file`,J({layer:n,path:l,content:s},{method:`PUT`})),i({layer:n,path:l}),t(!1)}catch(e){v(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{g(!1)}}}let C=d?.ok===!0&&!h&&!p;return(0,G.jsx)(c_,{open:e,onOpenChange:t,children:(0,G.jsxs)(d_,{className:`flex max-w-3xl flex-col gap-0 max-h-[min(820px,calc(100vh-2rem))]`,children:[(0,G.jsxs)(f_,{className:`px-6 pt-6`,children:[(0,G.jsxs)(p_,{className:`flex items-center gap-2`,children:[(0,G.jsx)(kr,{className:`size-4 text-accent-300`}),`New `,Bw[r],` in `,n===`tenant`?`Custom`:n]}),(0,G.jsx)(m_,{children:`Pick a name, edit the scaffolded content, and Coro pre-validates before saving.`})]}),(0,G.jsxs)(h_,{className:`flex-1 min-h-0 overflow-y-auto space-y-4 px-6 pb-6`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[160px_1fr] items-center gap-3`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Name`}),(0,G.jsx)(O_,{value:a,onChange:e=>o(e.target.value),placeholder:`my-${r}`,autoFocus:!0}),(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Resolved path`}),(0,G.jsx)(`code`,{className:`truncate rounded bg-overlay/60 px-2 py-1 font-mono text-[11px] text-fg-subtle`,children:l})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,children:`Content`}),(0,G.jsxs)(`span`,{className:`text-[10px] text-fg-subtle`,children:[s.length,` chars`]})]}),(0,G.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),spellCheck:!1,className:`h-[280px] w-full resize-y rounded-md border border-line bg-canvas/60 px-3 py-2 font-mono text-[12px] leading-relaxed text-fg outline-none focus:border-accent-400`})]}),(0,G.jsx)(Rw,{preflight:d,loading:p}),_?(0,G.jsx)(`div`,{className:`rounded-md border border-danger-500/50 bg-danger-500/10 px-3 py-2 text-[12px] text-danger-400`,children:_}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-line px-6 py-3`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:h,children:`Cancel`}),(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onClick:S,disabled:!C,children:[h?(0,G.jsx)($r,{className:`mr-1 size-3 animate-spin`}):null,`Create`]})]})]})})}var Ww={workflow:{label:`Workflow`,plural:`Workflows`,Icon:B,tone:`text-accent-300`,description:`Multi-phase plans the runner dispatches against. Each workflow sequences agents into phases.`},agent:{label:`Agent`,plural:`Agents`,Icon:ar,tone:`text-success`,description:`Per-phase Claude personas. Override one to change how a phase reasons or what tools it uses.`},skill:{label:`Skill`,plural:`Skills`,Icon:Di,tone:`text-warning`,description:`Claude Code skills picked up automatically when the matching context appears.`},memory:{label:`Memory`,plural:`Memory`,Icon:or,tone:`text-fg-muted`,description:`Append-mode notes. Every layer’s memory file is concatenated at runtime — nothing is shadowed.`}},Gw={base:{label:`Coro`,Icon:ii,tone:`text-fg-muted`,pitch:`Ships with the Coro runner. Read-only — copy any artefact into Custom or Repo to customise it.`},tenant:{label:`Custom`,Icon:Yr,tone:`text-accent-300`,pitch:`Your overlay at ~/.coro/intelligence. Wins over Coro for every repo on this machine.`},repo:{label:`Repo`,Icon:Si,tone:`text-success`,pitch:`The target repo’s .coro/ folder. Highest priority — wins over both Coro and Custom.`}},Kw=`coro:intelligence:intro-dismissed`;function qw(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(!0),[o,s]=(0,x.useState)(!1),[c,l]=(0,x.useState)(()=>typeof window>`u`?!0:window.localStorage.getItem(Kw)!==`1`),[u,d]=(0,x.useState)([]),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(null),[v,y]=(0,x.useState)(!1);async function b(e){try{let[n,i]=await Promise.all([q(`/intelligence/layers`,{signal:e}),po().catch(()=>[])]);if(e?.aborted)return;t(n),d(i),r(null)}catch(e){if(e.name===`AbortError`)return;r(e instanceof K?`${e.message} (HTTP ${e.status})`:e.message)}finally{a(!1),s(!1)}}(0,x.useEffect)(()=>{let e=new AbortController;return b(e.signal),()=>e.abort()},[]);function S(){l(!1),typeof window<`u`&&window.localStorage.setItem(Kw,`1`)}async function C(){s(!0),await b()}let w=(0,x.useMemo)(()=>{let t={workflow:[],agent:[],skill:[],memory:[]};if(!e)return t;for(let n of e.artefacts)t[n.kind].push(n);return t},[e]);function T(e){let t=e.path.split(`/`)[1],n=u.find(n=>n.id===t||n.workflowPath===e.path);n&&(p(n),h(!0))}function E(e){_({layer:e.layer,path:e.path,displayName:e.displayName,overrides:e.overrides}),y(!0)}let D=(0,x.useMemo)(()=>e?.layers.filter(e=>e.writable).map(e=>e.layer)??[],[e]);function O(e){C(),_({layer:e.layer,path:e.path,displayName:e.path.split(`/`).pop()??e.path}),y(!0)}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(cg,{eyebrow:`Intelligence`,title:`Layered Intelligence`,description:`Every workflow, agent, skill, and memory note the runner can see — grouped by the layer it lives on. Drop files into Custom or Repo to customise behaviour without forking the Coro intelligence.`,actions:(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:C,disabled:i||o,children:[(0,G.jsx)(hi,{className:`size-3.5 ${o?`animate-spin`:``}`}),`Refresh`]})}),c?(0,G.jsxs)(`div`,{className:`relative rounded-xl border border-line bg-overlay/40 p-4 pr-10 text-sm text-fg-muted`,children:[(0,G.jsx)(`button`,{onClick:S,className:`absolute right-3 top-3 rounded-md p-1 text-fg-subtle hover:bg-overlay hover:text-fg`,"aria-label":`Dismiss`,children:(0,G.jsx)(Pi,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(qr,{className:`mt-0.5 size-4 shrink-0 text-accent-300`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`p`,{children:[`Coro resolves intelligence in three layers: `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Repo`}),` `,`(the working repo’s `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder) wins over`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Custom`}),` (your`,` `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`~/.coro/intelligence`}),` overlay), which wins over the`,` `,(0,G.jsx)(`strong`,{className:`text-fg`,children:`Coro`}),` intelligence shipped with the runner.`]}),(0,G.jsxs)(`p`,{children:[`Most artefacts use `,(0,G.jsx)(`em`,{children:`last-wins replace`}),`: the highest-priority copy is the only one used. Memory files use `,(0,G.jsx)(`em`,{children:`append`}),`: every layer’s contribution is concatenated, so notes stack across layers. Drop a file at the matching path in a higher layer to override (or extend, for memory).`]})]})]})]}):null,i&&!e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`}),(0,G.jsx)(bg,{className:`h-28`})]}):e?(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[e.layers.map(e=>(0,G.jsx)(Jw,{layer:e,onCreated:O},e.layer)),e.layers.some(e=>e.layer===`repo`)?null:(0,G.jsx)(Yw,{})]}):null,n?(0,G.jsx)(gg,{title:`Couldn’t load intelligence catalogue`,message:n}):null,e?(0,G.jsx)(`div`,{className:`grid gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[`workflow`,`agent`,`skill`,`memory`].map(e=>(0,G.jsx)(Xw,{kind:e,artefacts:w[e],writableLayers:D,onCreated:O,onOpenInspector:E,onOpenWorkflow:e===`workflow`?T:void 0},e))}):null,(0,G.jsx)(KC,{open:m,onOpenChange:h,workflow:f}),(0,G.jsx)(zw,{open:v,onOpenChange:y,target:g,onChanged:e=>{e&&_(t=>t&&{...t,layer:e.layer,path:e.path}),C()}})]})}function Jw({layer:e,onCreated:t}){let n=Gw[e.layer],r=n.Icon,i=e.counts.workflow+e.counts.agent+e.counts.skill+e.counts.memory;return(0,G.jsxs)(lg,{className:`flex flex-col`,children:[(0,G.jsxs)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(r,{className:`size-4 ${n.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:n.label}),(0,G.jsx)(UC,{layer:e.layer,size:`sm`}),e.writable?null:(0,G.jsx)(`span`,{className:`rounded bg-fg/8 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-subtle`,children:`read-only`})]}),(0,G.jsx)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:n.pitch})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.writable?(0,G.jsx)($w,{layer:e.layer,onCreated:t}):null,(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums`,children:i}),(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`files`})]})]})]}),(0,G.jsxs)(pg,{className:`space-y-2 pt-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Rr,{className:`size-3`}),(0,G.jsx)(`code`,{className:`truncate font-mono`,title:e.root,children:Qw(e.root)})]}),e.exists?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(Mi,{className:`size-3 text-warning`}),`Not yet created on disk.`]}),(0,G.jsx)(`div`,{className:`grid grid-cols-4 gap-1 pt-1`,children:[`workflow`,`agent`,`skill`,`memory`].map(t=>{let n=Ww[t].Icon;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 rounded-md border border-line bg-overlay/30 px-1 py-1.5`,title:Ww[t].plural,children:[(0,G.jsx)(n,{className:`size-3 ${Ww[t].tone}`}),(0,G.jsx)(`span`,{className:`text-xs font-medium tabular-nums`,children:e.counts[t]})]},t)})})]})]})}function Yw(){return(0,G.jsx)(lg,{className:`flex flex-col border-dashed bg-overlay/20`,children:(0,G.jsx)(ug,{className:`flex flex-row items-start justify-between gap-3 space-y-0 pb-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Si,{className:`size-4 text-success`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:`Repo`}),(0,G.jsx)(UC,{layer:`repo`,size:`sm`})]}),(0,G.jsxs)(`p`,{className:`text-xs leading-snug text-fg-muted`,children:[`Highest-priority overlay, scoped to a single repo via its `,(0,G.jsx)(`code`,{className:`rounded bg-overlay px-1`,children:`.coro/`}),` folder. Surfaces here once a job clones a repo with one.`]})]})})})}function Xw({kind:e,artefacts:t,writableLayers:n,onCreated:r,onOpenInspector:i,onOpenWorkflow:a}){let o=Ww[e],s=o.Icon;return(0,G.jsxs)(lg,{className:`flex min-h-[12rem] flex-col`,children:[(0,G.jsxs)(ug,{className:`space-y-1 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(s,{className:`size-4 ${o.tone}`}),(0,G.jsx)(dg,{className:`text-sm font-semibold`,children:o.plural})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`rounded bg-overlay/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-fg-muted`,children:t.length}),n.length>0?(0,G.jsx)(eT,{kind:e,writableLayers:n,onCreated:r}):null]})]}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-fg-subtle`,children:o.description})]}),(0,G.jsx)(pg,{className:`flex-1 space-y-1.5 pt-0`,children:t.length===0?(0,G.jsxs)(`div`,{className:`flex h-24 items-center justify-center text-center text-[11px] text-fg-subtle`,children:[`No `,o.plural.toLowerCase(),` found.`]}):t.map(e=>(0,G.jsx)(Zw,{artefact:e,onOpenInspector:i,onOpenWorkflow:a},`${e.layer}:${e.path}`))})]})}function Zw({artefact:e,onOpenInspector:t,onOpenWorkflow:n}){return(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`group block w-full rounded-lg border border-line bg-canvas/30 p-2.5 text-left transition-colors hover:border-accent-500/40 hover:bg-overlay/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate text-[13px] font-medium text-fg`,children:e.displayName}),e.kind===`memory`?(0,G.jsx)(`span`,{title:`Append-mode: stacks across layers`,className:`text-[10px] text-fg-subtle`,children:`∥`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Ir,{className:`size-2.5 shrink-0 text-fg-subtle`}),(0,G.jsx)(`code`,{className:`truncate font-mono text-[10px] text-fg-subtle`,title:e.path,children:e.path})]}),e.description?(0,G.jsx)(`p`,{className:`line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,e.kind===`workflow`&&n?(0,G.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e)},className:`mt-1 inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide text-accent-300 hover:text-accent-200`,children:`View phases →`}):null]}),(0,G.jsx)(UC,{layer:e.layer,overrides:e.overrides,size:`sm`})]})})}function Qw(e){if(typeof window>`u`)return e;let t=e.match(/^\/(?:Users|home)\/[^/]+/);return t?`~`+e.slice(t[0].length):e}function $w({layer:e,onCreated:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(`memory`);function o(e){a(e),r(!0)}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`h-7 px-2`,children:[(0,G.jsx)(pi,{className:`size-3`}),`New`]})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsx)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:`New artefact`}),(0,G.jsx)(eg,{}),[`workflow`,`agent`,`skill`,`memory`].map(e=>{let t=Ww[e].Icon;return(0,G.jsxs)(Qh,{onClick:()=>o(e),children:[(0,G.jsx)(t,{className:`mr-2 size-3.5 ${Ww[e].tone}`}),Ww[e].label]},e)})]})]}),(0,G.jsx)(Uw,{open:n,onOpenChange:r,layer:e,kind:i,onCreated:e=>t?.(e)})]})}function eT({kind:e,writableLayers:t,onCreated:n}){let[r,i]=(0,x.useState)(!1),[a,o]=(0,x.useState)(t[0]),s=Ww[e];function c(e){o(e),i(!0)}let l=`inline-flex size-6 items-center justify-center rounded text-fg-subtle transition-colors hover:bg-overlay/60 hover:text-fg`,u=`New ${s.label.toLowerCase()}`;return(0,G.jsxs)(G.Fragment,{children:[t.length===1?(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(t[0]),className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})}):(0,G.jsxs)(Jh,{children:[(0,G.jsx)(Yh,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:l,title:u,"aria-label":u,children:(0,G.jsx)(pi,{className:`size-3.5`})})}),(0,G.jsxs)(Zh,{align:`end`,className:`w-44`,children:[(0,G.jsxs)($h,{className:`text-[10px] uppercase tracking-wide text-fg-subtle`,children:[`New `,s.label.toLowerCase(),` in…`]}),(0,G.jsx)(eg,{}),t.map(e=>(0,G.jsxs)(Qh,{onClick:()=>c(e),children:[(0,G.jsx)(UC,{layer:e,size:`sm`}),(0,G.jsx)(`span`,{className:`ml-2`,children:Gw[e].label})]},e))]})]}),(0,G.jsx)(Uw,{open:r,onOpenChange:i,layer:a,kind:e,onCreated:e=>n?.(e)})]})}var tT=[{id:`general`,group:`setup`,label:`General`,description:`Coach mode and Coro plan mode preferences.`,icon:Ei,required:!1},{id:`llm-provider`,group:`setup`,label:`LLM provider`,description:`Authenticate the runner against the model that drives every job.`,icon:ar,required:!0},{id:`source-control`,group:`setup`,label:`Source control`,description:`Git credentials used for clone, branch, push, and PR operations.`,icon:Vr,required:!0},{id:`issue-tracker`,group:`setup`,label:`Issue tracker`,description:`Optional. Used by campaigns when they need to file an epic + child issues.`,icon:Ai,required:!1},{id:`plugins`,group:`extensions`,label:`Plugins`,description:`Provider integrations the runner has loaded plus drop-in installation.`,icon:fi,required:!1},{id:`mcp`,group:`extensions`,label:`MCP servers`,description:`Bring-your-own MCP servers and Claude Code inheritance.`,icon:Si,required:!1},{id:`guardrails`,group:`extensions`,label:`Guardrails`,description:`Policies the runner enforces before agents open PRs or call tools.`,icon:Ti,required:!1},{id:`paths`,group:`advanced`,label:`Paths`,description:`Filesystem locations for intelligence overlays and working repositories.`,icon:zr,required:!1}],nT={setup:{title:`Setup`,hint:`Required to run jobs. Finish these first.`},extensions:{title:`Extensions`,hint:`Opt-in capabilities. Add when you need them.`},advanced:{title:`Advanced`,hint:`Rarely changed. Defaults work for most installs.`}};function rT(e){let t=tT.find(t=>t.id===e);if(!t)throw Error(`Unknown settings section id: ${e}`);return t}function iT({title:e,description:t,status:n,statusLabel:r,required:i,action:a,footer:o,className:s,children:c}){return(0,G.jsxs)(lg,{className:s,children:[(0,G.jsxs)(ug,{className:W(`gap-3 border-b border-line pb-4`,a?`sm:flex-row sm:items-start sm:justify-between`:``),children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(dg,{children:e}),i?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,n?(0,G.jsx)(jv,{status:n,label:r}):null]}),t?(0,G.jsx)(fg,{children:t}):null]}),a?(0,G.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,G.jsx)(pg,{className:`space-y-5 pt-5`,children:c}),o?(0,G.jsx)(`div`,{className:`border-t border-line bg-overlay/30 px-6 py-3 text-xs text-fg-subtle`,children:o}):null]})}function aT({onTest:e,disabled:t,label:n,className:r}){let[i,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null);async function c(){a(!0),s(null);try{s(await e())}catch(e){s({ok:!1,message:e instanceof Error?e.message:String(e)})}finally{a(!1)}}return(0,G.jsxs)(`div`,{className:W(`flex w-full flex-col gap-2`,r),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:t||i,children:[i?(0,G.jsx)($r,{className:`size-3.5 animate-spin`}):(0,G.jsx)(di,{className:`size-3.5`}),i?`Testing…`:n??`Test connection`]}),o?(0,G.jsxs)(`div`,{className:W(`flex items-center gap-1.5 text-xs`,o.ok?`text-success-300`:`text-danger-300`),role:`status`,children:[o.ok?(0,G.jsx)(fr,{className:`size-3.5`}):(0,G.jsx)(_r,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:o.message??(o.ok?`Connection succeeded.`:`Connection failed.`)})]}):null]}),o?.checks&&o.checks.length>0?(0,G.jsx)(`ul`,{className:`space-y-1 rounded-xl border border-line bg-overlay/30 px-3 py-2 text-xs`,children:o.checks.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[e.ok?(0,G.jsx)(fr,{className:`mt-0.5 size-3.5 shrink-0 text-success-300`}):(0,G.jsx)(_r,{className:`mt-0.5 size-3.5 shrink-0 text-danger-300`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,G.jsx)(`span`,{className:W(`font-medium`,e.ok?`text-fg`:`text-danger-300`),children:e.name}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:e.message})]}),!e.ok&&e.hint?(0,G.jsxs)(`span`,{className:`text-fg-subtle italic`,children:[`→ `,e.hint]}):null]})]},`${e.name}-${t}`))}):null]})}var oT={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-2 xl:grid-cols-4`};function sT({name:e,value:t,options:n,onChange:r,cols:i=3,className:a}){let o=e??`choice-${Math.random().toString(36).slice(2,8)}`;return(0,G.jsx)(`div`,{role:`radiogroup`,className:W(`grid gap-3`,oT[i],a),children:n.map(e=>{let n=e.value===t;return(0,G.jsxs)(`label`,{className:W(`cursor-pointer rounded-2xl border px-4 py-3 text-left text-sm transition-colors`,n?`border-accent-500/40 bg-accent-500/8 text-fg ring-1 ring-accent-500/30`:`border-line bg-overlay/40 text-fg-muted hover:border-line-strong hover:text-fg`,e.disabled&&`cursor-not-allowed opacity-60`),children:[(0,G.jsx)(`input`,{type:`radio`,name:o,value:e.value,checked:n,disabled:e.disabled,onChange:()=>!e.disabled&&r(e.value),className:`sr-only`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`font-medium text-fg`,children:e.label}),e.badge]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:e.description}):null]},e.value)})})}var cT=[{value:`claudeLogin`,label:`Claude login`,description:`Recommended. Uses Claude Code's local session and MCP permissions.`},{value:`apiKey`,label:`API key`,description:`Direct Anthropic billing with explicit service credentials.`},{value:`oauth`,label:`Legacy OAuth token`,description:`Fallback only. Stores a raw token without session refresh.`}];function lT({pluginId:e,onConnected:t}){let{draft:n,setPluginField:r}=y_(),i=n.pluginInstalled[e]?.config??{},a=i.method??`claudeLogin`,o=i.apiKey??``,s=i.oauthToken??``,c=i.account??null,[l,u]=(0,x.useState)({status:`idle`}),[d,f]=(0,x.useState)(!1),[p,m]=(0,x.useState)(!1),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(``),[y,b]=(0,x.useState)(null),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1);(0,x.useEffect)(()=>{a===`claudeLogin`&&l.status===`idle`&&c&&u({status:`connected`,account:c})},[a,c,l.status]),(0,x.useEffect)(()=>{if(l.status!==`authorizing`)return;let n=window.setInterval(async()=>{try{let n=await q(`/config/anthropic/claude-login/status`);if(n.status===`idle`)return;u(n),n.status===`connected`&&(r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),t?.())}catch{}},2e3);return()=>window.clearInterval(n)},[l.status,e,r,t]);let A=l.account??c,j=l.automaticUrl??l.manualUrl??null,M=l.status===`connected`||!!A;function N(t){r(e,`method`,t),b(null),T(null),D(null)}async function ee(n=!1){f(!0),b(null);try{let i=await q(`/config/anthropic/claude-login/start`,n?J({force:!0},{method:`POST`}):{method:`POST`});if(u(i),r(e,`method`,`claudeLogin`),i.account&&r(e,`account`,i.account),i.status===`connected`){t?.();return}if(i.status===`authorizing`&&(i.automaticUrl||i.manualUrl)&&window.open(i.automaticUrl??i.manualUrl,`_blank`,`noopener,noreferrer`),i.status===`error`)throw Error(i.error??`Claude login failed to start.`)}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{f(!1)}}async function te(){m(!0),b(null);try{let n=await q(`/config/anthropic/claude-login/callback`,J(dT(h,_),{method:`POST`}));if(u(n),n.status!==`connected`)throw Error(n.error??`Claude login did not complete.`);r(e,`method`,`claudeLogin`),n.account&&r(e,`account`,n.account),g(``),v(``),t?.()}catch(e){b(e instanceof K||e instanceof Error?e.message:String(e))}finally{m(!1)}}async function P(){try{return await q(`/test/llm`,J({provider:e,config:i},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}let F=a===`claudeLogin`?l.status===`connected`||!!c:a===`apiKey`?o.length>0:s.length>0;async function I(){C(!0),T(`Launching Claude Code login. Complete sign-in in your browser…`),D(null),b(null);try{let t=await q(`/config/anthropic/generate-oauth-token`,{method:`POST`});t.authUrl&&D(t.authUrl),t.token?(r(e,`oauthToken`,t.token),r(e,`method`,`oauth`),T(`Token captured (${t.token.slice(0,16)}…). Click Save to persist it.`)):(b(`Token generation returned no token.`),T(null))}catch(e){if(e instanceof K){let t=e.payload;t?.authUrl&&D(t.authUrl),(t?.error===`CLI_NOT_FOUND`||t?.error===`PLATFORM_UNSUPPORTED`)&&k(!0),b(t?.message??t?.stderr??e.message)}else b(e instanceof Error?e.message:String(e));T(null)}finally{C(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Sv,{label:`Authentication method`,children:(0,G.jsx)(sT,{name:`${e}-anthropic-method`,value:a,onChange:N,options:cT,cols:3})}),y?(0,G.jsx)(Ov,{tone:`danger`,children:y}):null,a===`claudeLogin`?(0,G.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-line bg-overlay/40 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(jv,{status:pT(l),label:mT(l)}),A?.email?(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:A.email}):null]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void ee(M),disabled:d,children:d?`Starting…`:M?`Reconnect`:`Connect Claude`})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Uses Claude Code's local login session, including MCP permissions and session refresh. No copy-pasted token is stored in Coro.`}),A?(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(fT,{label:`Provider`,value:uT(A.apiProvider)}),(0,G.jsx)(fT,{label:`Organization`,value:A.organization??`Not reported`}),(0,G.jsx)(fT,{label:`Plan`,value:A.subscriptionType??`Not reported`}),(0,G.jsx)(fT,{label:`Token source`,value:A.tokenSource??`Not reported`})]}):null,l.status===`authorizing`?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Ov,{tone:`warning`,children:`Waiting for the Claude browser login to finish. This panel polls automatically.`}),j?(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-canvas/40 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Continue here:`}),(0,G.jsx)(`a`,{href:j,target:`_blank`,rel:`noopener noreferrer`,className:`mt-1 block break-all text-accent-300 hover:text-accent-400`,children:j})]}):null,(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-line bg-canvas/40 p-3`,children:[(0,G.jsx)(Sv,{label:`Callback URL or authorization code`,hint:`Use this only if automatic completion fails.`,children:(0,G.jsx)(O_,{value:h,onChange:e=>g(e.target.value),placeholder:`Paste the redirected URL or the code parameter`})}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`State override`,hint:`Optional if you pasted a raw authorization code.`,children:(0,G.jsx)(O_,{value:_,onChange:e=>v(e.target.value),placeholder:`Optional state`})}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void te(),disabled:p,children:p?`Completing…`:`Complete manually`})]})]})]}):null]}):null,a===`apiKey`?(0,G.jsx)(Sv,{label:`API key`,required:!0,hint:`Anthropic API key from console.anthropic.com.`,children:(0,G.jsx)(Cv,{value:o,onChange:t=>r(e,`apiKey`,t.target.value),placeholder:`sk-ant-…`})}):null,a===`oauth`?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Sv,{label:`OAuth token`,required:!0,hint:`Legacy fallback only. Prefer Claude login whenever possible.`,children:(0,G.jsx)(Cv,{value:s,onChange:t=>r(e,`oauthToken`,t.target.value),placeholder:`sk-ant-oat01-…`})}),O?null:(0,G.jsxs)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>void I(),disabled:S,children:[(0,G.jsx)(Jr,{}),S?`Generating…`:`Generate via claude setup-token`]}),w?(0,G.jsx)(Ov,{tone:`success`,children:w}):null,E?(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`div`,{children:`Browser blocked? Sign in here:`}),(0,G.jsx)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 block break-all text-accent-300 hover:text-accent-400`,children:E})]}):null]}):null,(0,G.jsxs)(`div`,{className:`border-t border-line pt-4`,children:[(0,G.jsx)(aT,{onTest:P,disabled:!F,label:`Test connection`}),(0,G.jsxs)(`p`,{className:`mt-2 text-[12px] text-fg-subtle`,children:[`Sends a 1-token `,(0,G.jsx)(`span`,{className:`font-mono`,children:`/v1/messages`}),` ping with your current credentials. For Claude login, reads the OAuth session from your local keychain.`]})]})]})}function uT(e){switch(e){case`firstParty`:return`Claude`;case`anthropicAws`:return`Anthropic AWS`;case`bedrock`:return`Amazon Bedrock`;case`vertex`:return`Vertex AI`;case`foundry`:return`Azure AI Foundry`;default:return e??`Unknown`}}function dT(e,t){let n=e.trim();if(!n)throw Error(`Paste the callback URL or authorization code to complete login manually.`);if(/^https?:\/\//i.test(n)){let e=new URL(n),r=e.searchParams.get(`code`);if(!r)throw Error(`The callback URL is missing the code query parameter.`);return{authorizationCode:r,state:e.searchParams.get(`state`)??(t.trim()||void 0)}}return{authorizationCode:n,state:t.trim()||void 0}}function fT({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-xl border border-line bg-overlay/40 px-3 py-2.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:e}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:t})]})}function pT(e){switch(e.status){case`connected`:return`ok`;case`authorizing`:return`pending`;case`error`:return`error`;default:return`unset`}}function mT(e){switch(e.status){case`connected`:return`Connected`;case`authorizing`:return`Waiting for browser`;case`error`:return`Failed`;default:return`Not connected`}}var hT={"anthropic-auth":lT};function gT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&(e.properties!==void 0||e.type===`object`)}function _T(e){return/token|apikey|api_key|password|secret|appPassword/i.test(e)}function vT(e,t){return t?.format===`uri`||t?.format===`url`?!0:/url|baseUrl|endpoint|host/i.test(e)}function yT(e,t){return t?.title?t.title:e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function bT(e){if(!gT(e)||!e.properties)return[];let t=new Set(e.required??[]);return Object.entries(e.properties).map(([e,n])=>{let r=_T(e)?`secret`:vT(e,n)?`url`:`text`;return{name:e,label:yT(e,n),hint:n.description,required:t.has(e),kind:r,placeholder:n.default!==void 0&&typeof n.default!=`object`?String(n.default):void 0}})}function xT({plugin:e,onTest:t,defaultControl:n,footerNotice:r,onConnected:i}){let{draft:a,setPluginField:o,setPluginEnabled:s,dirtyPluginIds:c}=y_(),{manifest:l,source:u,configured:d,active:f,activationHint:p}=e,m=l.id in a.pluginInstalled,h=m?a.pluginInstalled[l.id]:{config:{}},g=m&&h.enabled!==!1,_=(0,x.useMemo)(()=>bT(l.configSchema),[l.configSchema]),v=c.has(l.id),y=l.ui?.customPanel?hT[l.ui.customPanel]:void 0,b=_.some(e=>e.required),S=_.filter(e=>e.required).every(e=>{let t=h.config[e.name];return typeof t==`string`?t.length>0:t!=null}),C=Object.values(h.config).some(e=>typeof e==`string`?e.length>0:e!=null),w=g?f&&d?{label:`active`,tone:`success`}:d?{label:`configured`,tone:`warning`}:S&&(b||C)?{label:`ready to save`,tone:`warning`}:{label:`needs setup`,tone:`neutral`}:m?{label:`disabled`,tone:`neutral`}:{label:`not configured`,tone:`neutral`};function T(e){let t=h.config[e.name],n=typeof t==`string`?t:t==null?``:String(t),r=t=>o(l.id,e.name,t);return e.kind===`secret`?(0,G.jsx)(Cv,{value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,autoComplete:`off`}):(0,G.jsx)(O_,{type:e.kind===`url`?`url`:`text`,value:n,onChange:e=>r(e.target.value),placeholder:e.placeholder,inputMode:e.kind===`url`?`url`:void 0})}return(0,G.jsxs)(`div`,{className:W(`rounded-2xl border bg-overlay/40 px-4 py-4 transition-colors`,v?`border-accent-400/50`:`border-line`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(E_,{pluginId:l.id,size:20}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:l.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:l.id}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]`,u===`dropin`?`border-accent-400/40 bg-accent-500/10 text-accent-200`:`border-line bg-overlay/60 text-fg-muted`),children:u===`dropin`?`drop-in`:`built in`}),(0,G.jsx)(`span`,{className:W(`rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em]`,zo(w.tone)),children:w.label}),v?(0,G.jsx)(`span`,{className:`rounded-full border border-accent-400/50 bg-accent-500/10 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-accent-200`,children:`unsaved`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`v`,l.version,` · kind `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:l.kind})]}),p&&!d?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:p}):null]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-[12px] text-fg-muted`,children:[(0,G.jsx)(`span`,{children:`Enabled`}),(0,G.jsx)(jx,{checked:g,onCheckedChange:e=>s(l.id,e),ariaLabel:`Enable ${l.displayName}`,size:`sm`})]})]}),g?(0,G.jsxs)(G.Fragment,{children:[y?(0,G.jsx)(`div`,{className:`mt-4`,children:(0,G.jsx)(y,{pluginId:l.id,onConnected:i})}):_.length===0?(0,G.jsx)(Ov,{tone:`neutral`,className:`mt-4`,children:`This plugin doesn't expose configuration. Toggle Enable to register it.`}):(0,G.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:_.map(e=>(0,G.jsx)(Sv,{label:e.label,required:e.required,hint:e.hint,className:e.kind===`url`?`sm:col-span-2`:void 0,children:T(e)},e.name))}),(t||n||r)&&(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3 border-t border-line pt-4`,children:[t&&!y?(0,G.jsx)(aT,{onTest:()=>t(h.config),disabled:!S}):null,n,r]})]}):null]})}async function ST(e,t){try{return await q(`/test/llm`,J({provider:e,config:t},{method:`POST`}))}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}var CT=[`tier:planning`,`tier:coding`,`tier:mini`];function wT(e,t){return e.startsWith(`tier:`)?`tier`:t.has(e)?`declared`:`custom`}function TT(){let[e,t]=(0,x.useState)(new Map);return(0,x.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await q(`/workflows`);if(e)return;let r=new Map,i=(e,t)=>{let n=r.get(e)??[];n.push(t),r.set(e,n)};for(let e of n.workflows??[])for(let t of e.phases??[]){let n={workflowId:e.id,workflowName:e.name,phaseName:t.name},r=(t.model??``).trim();r&&i(r,n);let a=(t.tier??``).trim();a&&i(`tier:${a}`,n)}t(r)}catch{}})(),()=>{e=!0}},[]),{usagesByAlias:e,referencedNames:(0,x.useMemo)(()=>Array.from(e.keys()).sort(),[e])}}function ET(){let{draft:e,setDraft:t,pluginsCatalogue:n,pluginsCatalogueError:r}=y_(),i=oy({draft:e,pluginsCatalogue:n}).byId[`llm-provider`],a=(0,x.useMemo)(()=>n?n.plugins.filter(e=>e.manifest.kind===`executor`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[n]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n===void 0||n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]),s=e.llmDefaultProvider,c=e=>{t(`llmDefaultProvider`,e)},l=(0,x.useMemo)(()=>Object.entries(e.llmAliases),[e.llmAliases]),u=e=>{t(`llmAliases`,e)},d=(t,n)=>{if(!n||n===t||e.llmAliases[n])return;let r={};for(let[i,a]of Object.entries(e.llmAliases))r[i===t?n:i]=a;u(r)},f=(t,n)=>{let r=e.llmAliases[t]??{provider:``,model:``};u({...e.llmAliases,[t]:{...r,...n}})},p=t=>{let{[t]:n,...r}=e.llmAliases;u(r)},m=()=>{let t=1,n=`new-alias`;for(;e.llmAliases[n];)t+=1,n=`new-alias-${t}`;u({...e.llmAliases,[n]:{provider:s||o[0]||``,model:``}})},{modelsByProvider:h,loadModels:g}=uC();(0,x.useEffect)(()=>{let e=new Set;for(let[,t]of l)t.provider&&!e.has(t.provider)&&(e.add(t.provider),g(t.provider));s&&g(s)},[l,s,g]);let{usagesByAlias:_,referencedNames:v}=TT(),y=(0,x.useMemo)(()=>new Set(v),[v]),b=(0,x.useMemo)(()=>v.filter(t=>!(t in e.llmAliases)&&!t.startsWith(`tier:`)),[v,e.llmAliases]),S=(0,x.useMemo)(()=>CT.filter(t=>!(t in e.llmAliases)),[e.llmAliases]),C=(0,x.useMemo)(()=>{let e=[],t=[],n=[];for(let r of l){let i=wT(r[0],y);i===`tier`?e.push(r):i===`declared`?t.push(r):n.push(r)}return{tiers:e,declared:t,custom:n}},[l,y]),[w,T]=(0,x.useState)(!1),E=t=>{u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}})},D=`alias-name-suggestions-${(0,x.useId)()}`;return(0,G.jsx)(iT,{title:`LLM providers`,description:`Configure one or more model providers and route workflow aliases to specific provider/model pairs.`,required:!0,status:i.status,statusLabel:i.label,children:(0,G.jsxs)(`div`,{className:`space-y-6`,children:[r?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,r,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No LLM-provider plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>ST(e.manifest.id,t)},e.manifest.id))}),(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default provider`,hint:`Used when an alias or workflow phase does not pin a provider explicitly.`,children:(0,G.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the runner choose — defaults to anthropic)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Aliases`}),(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Workflow shorthands that map to a concrete `,(0,G.jsx)(`span`,{className:`font-mono`,children:`provider/model`}),` pair. Three groups, in increasing specificity:`]}),(0,G.jsxs)(`ul`,{className:`mt-1.5 space-y-0.5 text-[12px] text-fg-subtle`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Tiers`}),` — capability slots every workflow defaults to (planning / coding / mini).`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Workflow-declared`}),` — alias names a specific workflow phase pins via `,(0,G.jsx)(`span`,{className:`font-mono`,children:`model:`}),`.`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`Custom`}),` — anything you've added that no workflow references yet.`]})]})]}),(0,G.jsxs)(DT,{title:`Tiers`,subtitle:`Workflow defaults. Every install needs these — workflows fall back to the matching tier when a phase doesn't pin a model.`,children:[C.tiers.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`tier`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),S.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:S.map(e=>(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-subtle`,children:`Not defined in this draft. Active LLM plugins re-seed tier defaults on every runner start — click Define to pin one explicitly.`})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>E(e),disabled:o.length===0,children:`Define`})]},e))}):null]}),C.declared.length>0||b.length>0?(0,G.jsxs)(DT,{title:`Workflow-declared`,subtitle:`Alias names referenced explicitly by a workflow phase via its model: field.`,children:[C.declared.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`declared`,nameLocked:!0,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t)),b.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:b.map(t=>{let n=_.get(t)??[];return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl border border-dashed border-warning-400/50 bg-warning-50/5 px-3 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-mono text-sm text-fg`,children:t}),(0,G.jsxs)(`div`,{className:`text-[11px] text-fg-subtle`,children:[`Needs definition · used by`,` `,n.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]})]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>u({...e.llmAliases,[t]:{provider:s||o[0]||``,model:``}}),disabled:o.length===0,children:`Define`})]},t)})}):null]}):null,(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`flex w-full items-center justify-between gap-2 text-left text-sm font-medium text-fg-muted hover:text-fg`,children:[(0,G.jsxs)(`span`,{children:[`Custom `,(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[`(`,C.custom.length,`)`]})]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:w?`Hide`:`Show`})]}),w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:`Free-form aliases not referenced by any workflow. Useful for ad-hoc experiments.`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:C.custom.map(([t,n])=>(0,G.jsx)(OT,{name:t,row:n,kind:`custom`,enabledIds:o,executorPlugins:a,modelsByProvider:h,loadModels:g,usages:_.get(t)??[],aliasNameDatalistId:D,existingAliasNames:Object.keys(e.llmAliases),onRename:d,onUpdate:f,onRemove:p},t))}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`secondary`,onClick:m,disabled:o.length===0,children:[(0,G.jsx)(pi,{}),`Add alias`]})})]}):null]}),(0,G.jsx)(`datalist`,{id:D,children:b.map(e=>(0,G.jsx)(`option`,{value:e},e))})]}),(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})})}function DT({title:e,subtitle:t,children:n}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-subtle`,children:t})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n})]})}function OT({name:e,row:t,kind:n,nameLocked:r=!1,enabledIds:i,executorPlugins:a,modelsByProvider:o,loadModels:s,usages:c,aliasNameDatalistId:l,existingAliasNames:u,onRename:d,onUpdate:f,onRemove:p}){let[m,h]=(0,x.useState)(e),g=(0,x.useRef)(e);(0,x.useEffect)(()=>{e!==g.current&&(h(e),g.current=e)},[e]);let _=m.trim(),v=_!==e,y=v&&_.length>0&&u.includes(_),b=v&&_.length===0,S=()=>{if(v){if(y||b){h(e);return}d(e,_),g.current=_}},C=`alias-help-${e}`;return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-xl border border-line bg-canvas/40 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`Alias`,children:(0,G.jsx)(O_,{value:m,list:r?void 0:l,readOnly:r,tabIndex:r?-1:void 0,onChange:e=>h(e.target.value),onBlur:S,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.target.blur()):t.key===`Escape`&&(h(e),t.target.blur())},placeholder:`coding`,"aria-invalid":y||b||void 0,"aria-describedby":C,className:[y||b?`border-danger-400/60`:``,r?`cursor-default bg-overlay/40 font-mono`:``].filter(Boolean).join(` `)||void 0})}),(0,G.jsx)(`div`,{className:`sm:col-span-2`,children:(0,G.jsx)(cC,{value:{provider:t.provider,model:t.model},onChange:t=>{f(e,{provider:t.provider,model:t.model})},providers:i.map(e=>({id:e,displayName:a.find(t=>t.manifest.id===e)?.manifest.displayName??e})),modelsByProvider:o,loadModels:s})}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>p(e),"aria-label":`Remove ${e}`,disabled:n===`tier`,title:n===`tier`?`Tier aliases are required by every workflow.`:void 0,children:(0,G.jsx)(ji,{})})]}),(0,G.jsx)(`div`,{id:C,className:`px-1 text-[11px] leading-4 text-fg-subtle`,children:y?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`An alias with that name already exists.`}):b?(0,G.jsx)(`span`,{className:`text-danger-400`,children:`Alias name cannot be empty.`}):c.length>0?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-fg-muted`,children:`Used in:`}),` `,c.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:null,(0,G.jsx)(`span`,{className:`font-mono`,children:e.workflowId}),(0,G.jsxs)(`span`,{className:`text-fg-subtle`,children:[` · `,e.phaseName]})]},`${e.workflowId}-${e.phaseName}-${t}`))]}):(0,G.jsx)(`span`,{className:`opacity-70`,children:`Not referenced by any workflow yet.`})})]})}function kT(e,t){return e===`github`?{provider:`github`,username:String(t.owner??``),token:String(t.token??``),workspace:String(t.owner??``)}:e===`bitbucket`?{provider:`bitbucket`,username:String(t.coderUsername??``),token:String(t.coderToken??``),workspace:String(t.workspace??``),reviewerUsername:String(t.reviewerUsername??``),reviewerToken:String(t.reviewerToken??``)}:e===`gitlab`?{provider:`gitlab`,username:String(t.username??t.user??``),token:String(t.token??``),workspace:String(t.workspace??t.group??``)}:null}function AT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`source-control`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`scm`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=kT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/git`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Authenticated.`:`Connection failed.`),checks:e.checks}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Source control`,description:`Git provider plugins. Each plugin handles clone, branch, push, PR, and review for one host. Multiple plugins can be configured side-by-side; the default below decides which one new jobs use unless overridden.`,required:!0,status:i.status,statusLabel:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No source-control plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one source-control plugin is enabled, jobs use this one unless they specify a different SCM at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultScm,onChange:e=>r(`scm`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function jT(e,t){return e===`jira`?{provider:`jira`,jira:{baseUrl:String(t.baseUrl??``),username:String(t.username??``),apiToken:String(t.apiToken??``)}}:e===`linear`?{provider:`linear`,linear:{apiKey:String(t.apiKey??``),teamKey:String(t.teamKey??``)}}:e===`github-issues`?{provider:`github`,git:{provider:`github`,username:String(t.defaultOwner??``),token:String(t.token??``),workspace:String(t.defaultOwner??``)}}:null}function MT(){let{draft:e,pluginsCatalogue:t,pluginsCatalogueError:n,setPluginDefault:r}=y_(),i=oy({draft:e,pluginsCatalogue:t}).byId[`issue-tracker`],a=(0,x.useMemo)(()=>t?t.plugins.filter(e=>e.manifest.kind===`tracker`).sort((e,t)=>e.source===t.source?e.manifest.displayName.localeCompare(t.manifest.displayName):e.source===`builtin`?-1:1):[],[t]),o=(0,x.useMemo)(()=>a.filter(t=>{let n=e.pluginInstalled[t.manifest.id];return n!==void 0&&n.enabled!==!1}).map(e=>e.manifest.id),[a,e.pluginInstalled]);async function s(e,t){let n=jT(e,t);if(!n)return{ok:!1,message:`No generic connection test available for drop-in plugins yet — save and check the plugin healthcheck.`};try{let e=await q(`/test/tracker`,J(n,{method:`POST`}));return{ok:e.ok,message:e.message??(e.ok?`Connected.`:`Connection failed.`)}}catch(e){return{ok:!1,message:(e instanceof K,e.message)}}}return(0,G.jsxs)(iT,{title:`Issue tracker`,description:`Tracker plugins. Each plugin maps Coro work units (epics + child issues) to a backlog system. Optional — leave all disabled to run jobs without tracker round-trips.`,status:i.status,statusLabel:i.status===`optional`?`Optional`:i.label,children:[n?(0,G.jsxs)(Ov,{tone:`warning`,children:[`Couldn't load the plugin catalogue from the runner: `,n,`.`]}):null,a.length===0?(0,G.jsx)(Ov,{tone:`neutral`,children:`No tracker plugins discovered. Built-ins are bundled with the runner — restart it if this looks wrong.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:a.map(e=>(0,G.jsx)(xT,{plugin:e,onTest:t=>s(e.manifest.id,t)},e.manifest.id))}),o.length>1?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/30 px-4 py-3.5`,children:(0,G.jsx)(Sv,{label:`Default for new jobs`,hint:`When more than one tracker plugin is enabled, jobs use this one unless they specify a different tracker at creation time.`,children:(0,G.jsxs)(`select`,{value:e.pluginDefaultTracker,onChange:e=>r(`tracker`,e.target.value),className:`w-full rounded-xl border border-line bg-overlay px-3 py-2 text-sm text-fg`,children:[(0,G.jsx)(`option`,{value:``,children:`(let the registry choose)`}),o.map(e=>(0,G.jsx)(`option`,{value:e,children:a.find(t=>t.manifest.id===e)?.manifest.displayName??e},e))]})})}):null,(0,G.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:i.detail})]})}function NT(e){return e.configured??e.installed}function PT(e){return NT(e)&&e.active?{label:`enabled`,tone:`success`}:NT(e)?{label:`configured`,tone:`warning`}:e.source===`builtin`?{label:`built in`,tone:`neutral`}:{label:`installed`,tone:`neutral`}}function FT(e){return NT(e)&&e.active?0:NT(e)?1:e.source===`builtin`?2:3}function IT(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(``),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null);(0,x.useEffect)(()=>{g()},[]);async function g(){try{r(!0),t(await q(`/plugins`))}catch{t(null)}finally{r(!1)}}async function _(e){e.preventDefault(),d(null),p(null);let t=i.trim();if(!t){d("Enter an npm package name (e.g. `@coro-ai/plugin-gitlab`).");return}try{l(!0);let e={spec:t},n=o.trim();n&&(e.id=n);let r=await q(`/plugins/install`,J(e,{method:`POST`}));p(r.restartHint?`Installed "${r.manifest.displayName}". ${r.restartHint}`:`Installed "${r.manifest.displayName}" and loaded into the registry — no restart needed.`),a(``),s(``),g()}catch(e){d((e instanceof K,e.message))}finally{l(!1)}}async function v(e,t){if(d(null),p(null),window.confirm(`Remove drop-in plugin "${t}"? The runner will need a restart to drop it from memory.`))try{h(e),p(`Removed "${t}". ${(await q(`/plugins/${encodeURIComponent(e)}`,{method:`DELETE`})).restartHint??`Restart the runner to fully unload it.`}`),g()}catch(e){d(`Failed to uninstall ${t}: ${e instanceof K,e.message}`)}finally{h(null)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Install a plugin`,description:`Drop-in plugins live under ~/.coro/plugins/. Paste any npm package name or git/tarball spec — the runner installs it locally and hot-loads it into the registry; configure credentials below to start using it.`,children:(0,G.jsxs)(`form`,{onSubmit:_,className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[2fr_1fr_auto] sm:items-end`,children:[(0,G.jsx)(Sv,{label:`npm spec`,htmlFor:`plugin-install-spec`,hint:`Examples: @coro-ai/plugin-gitlab, coro-plugin-jenkins@1.2.0, github:my-org/coro-plugin-acme.`,children:(0,G.jsx)(O_,{id:`plugin-install-spec`,value:i,onChange:e=>a(e.target.value),placeholder:`@coro-ai/plugin-gitlab`,disabled:c})}),(0,G.jsx)(Sv,{label:`Plugin id (optional)`,htmlFor:`plugin-install-id`,children:(0,G.jsx)(O_,{id:`plugin-install-id`,value:o,onChange:e=>s(e.target.value),placeholder:`gitlab`,disabled:c})}),(0,G.jsxs)(Y,{type:`submit`,disabled:c||!i.trim(),children:[(0,G.jsx)(ri,{}),c?`Installing…`:`Install`]})]}),u?(0,G.jsx)(Ov,{tone:`danger`,children:u}):null,f?(0,G.jsx)(Ov,{tone:`success`,children:f}):null]})}),(0,G.jsx)(iT,{title:`Installed plugins`,description:`Provider integrations the runner has loaded. Each plugin contributes its own MCP tools, webhook normaliser, and (optionally) intelligence snippets.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void g(),disabled:n,children:[(0,G.jsx)(mi,{}),n?`Refreshing…`:`Refresh`]}),children:e?(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default SCM`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.scm??`— (single enabled plugin wins)`})]}),(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.16em] text-fg-subtle`,children:`Default tracker`}),(0,G.jsx)(`div`,{className:`mt-1 text-sm text-fg`,children:e.defaults.tracker??`— (single enabled plugin wins)`})]})]}),e.plugins.some(e=>NT(e)&&e.active)?null:(0,G.jsx)(Ov,{tone:`warning`,children:`No plugins are enabled yet. Coro ships with GitHub, Bitbucket, Jira, Linear, and GitHub Issues. Configure credentials under Source control / Issue tracker and restart the runner.`}),e.plugins.length===0?(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:`No plugins discovered.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:[...e.plugins].sort((e,t)=>{let n=FT(e)-FT(t);return n===0?e.manifest.displayName.localeCompare(t.manifest.displayName):n}).map(e=>{let{manifest:t,source:n,mcpServer:r,activationHint:i}=e,a=PT(e);return(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fi,{className:`size-4 text-fg-subtle`}),(0,G.jsx)(`div`,{className:`text-[15px] font-medium text-fg`,children:t.displayName}),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-fg-subtle`,children:t.id}),n===`dropin`?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] uppercase tracking-[0.16em] text-fg-muted`,children:`drop-in`}):null]}),(0,G.jsxs)(`div`,{className:`mt-1 text-[12px] text-fg-muted`,children:[`kind: `,(0,G.jsx)(`span`,{className:`font-mono text-fg`,children:t.kind}),` · `,`v`,t.version,` · `,`host `,t.hostCompatibility]}),!NT(e)&&i?(0,G.jsx)(`div`,{className:`mt-2 text-[12px] leading-5 text-fg-muted`,children:i}):null,r?(0,G.jsxs)(`div`,{className:`mt-2 text-[11px] text-fg-muted`,children:[`Attached MCP server: `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.type}),` · agents see tools as `,(0,G.jsxs)(`span`,{className:`font-mono`,children:[`mcp__`,t.id,`__*`]})]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full border px-2.5 py-1 text-[11px] font-medium uppercase tracking-[0.16em]`,zo(a.tone)),children:a.label}),n===`dropin`?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void v(t.id,t.displayName),disabled:m===t.id,children:[(0,G.jsx)(ji,{}),m===t.id?`Removing…`:`Uninstall`]}):null]})]})},t.id)})})]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:n?`Loading plugins…`:`Plugin discovery is unavailable. The runner may be too old or returned an error.`})})]})}var LT=`{
|
|
121
121
|
"slack": {
|
|
122
122
|
"type": "stdio",
|
|
123
123
|
"command": "npx",
|
|
@@ -125,6 +125,12 @@ name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{i
|
|
|
125
125
|
"env": { "SLACK_BOT_TOKEN": "xoxb-…" },
|
|
126
126
|
"allowedTools": ["list_channels", "search_messages"]
|
|
127
127
|
},
|
|
128
|
+
"a5-be-catalog": {
|
|
129
|
+
"type": "stdio",
|
|
130
|
+
"command": "node",
|
|
131
|
+
"args": ["/abs/path/mcp-server/dist/index.js", "--catalog-path", "/abs/path/catalog"],
|
|
132
|
+
"planMode": true
|
|
133
|
+
},
|
|
128
134
|
"sentry": {
|
|
129
135
|
"type": "http",
|
|
130
136
|
"url": "https://mcp.sentry.io",
|
|
@@ -135,4 +141,4 @@ name: my-`)||e.startsWith(`# my-`)?t.content:e)},[b,r,e]),(0,x.useEffect)(()=>{i
|
|
|
135
141
|
"url": "https://mcp.datadoghq.com/sse",
|
|
136
142
|
"enabled": false
|
|
137
143
|
}
|
|
138
|
-
}`;function RT(){let{draft:e,setDraft:t}=y_(),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1);(0,x.useEffect)(()=>{try{let t=JSON.parse(e.mcpServersText);r(typeof t!=`object`||!t||Array.isArray(t)?`mcpServers must be a JSON object keyed by server id.`:null)}catch(e){r(`Invalid JSON: ${e.message}`)}},[e.mcpServersText]);async function c(){try{s(!0),a(await q(`/config/claude-code-mcps`))}catch{a(null)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(iT,{title:`Bring-your-own MCP servers`,description:"Attach any MCP server (Slack, Sentry, Datadog, internal tooling…) to every job session. The runner spawns each entry alongside the in-process `coro` server; agents see them as `mcp__<id>__*`.",footer:(0,G.jsxs)(`span`,{children:[`Reserved id `,(0,G.jsx)(`code`,{children:`coro`}),` is rejected. Use `,(0,G.jsx)(`code`,{children:`"enabled": false`}),` to keep an entry without attaching it.`,(0,G.jsx)(`code`,{children:` allowedTools`}),` / `,(0,G.jsx)(`code`,{children:`disallowedTools`}),` become per-server tool policy. Changes save with the rest of the page.`]}),children:[(0,G.jsx)(bb,{value:e.mcpServersText,onChange:e=>t(`mcpServersText`,e.target.value),spellCheck:!1,rows:14,className:`font-mono text-[12px]`}),n?(0,G.jsx)(Ov,{tone:`danger`,children:n}):null]}),(0,G.jsxs)(iT,{title:`Inherit from Claude Code`,description:`When enabled, the runner reads MCP servers from your user-level Claude Code config (~/.claude.json and ~/.claude/settings.json) and attaches them to every job session. Explicit BYO entries above override inherited entries with the same id.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,G.jsx)(mi,{}),o?`Refreshing…`:`Refresh`]}),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Inherit Claude Code MCP servers`}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`Off by default — Claude Code configs commonly carry developer-personal entries (Notion, GitHub Personal…) that an operator may not want every job to see.`})]}),(0,G.jsx)(jx,{checked:e.inheritClaudeCodeMcps,onCheckedChange:e=>t(`inheritClaudeCodeMcps`,e),ariaLabel:`Inherit Claude Code MCP servers`})]}),i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.sources.length>0?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Read from`,` `,i.sources.map((e,t)=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[t>0?`, `:``,e]},e))]}):(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:[`No Claude Code MCP servers found. Add one with `,(0,G.jsx)(`code`,{children:`claude mcp add <name> --scope user`}),` or paste an entry into `,(0,G.jsx)(`code`,{children:`~/.claude.json`}),` under `,(0,G.jsx)(`code`,{children:`mcpServers`}),`.`]}),Object.keys(i.servers).length>0?(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:JSON.stringify(i.servers,null,2)}):null]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:o?`Loading discovered servers…`:`Click Refresh to preview the MCP servers Claude Code currently exposes.`})]}),(0,G.jsx)(iT,{title:`Examples`,description:"Drop these into the editor above. Replace placeholder secrets with real ones — values containing `...` are treated as redacted echoes and ignored on save.",children:(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:LT})})]})}function zT({targetPath:e,label:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=typeof navigator<`u`&&/Win/i.test(navigator.platform)?`explorer`:typeof navigator<`u`&&/Mac/i.test(navigator.platform)?`finder`:`files`,s=o===`finder`?`Show in Finder`:o===`explorer`?`Show in Explorer`:`Open folder`;async function c(){if(e){a(null),r(!0);try{let t=await q(`/system/reveal`,J({path:e,create:!0},{method:`POST`}));t.ok||a(t.error??`Could not open folder`)}catch(e){a((e instanceof K,e.message))}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void c(),disabled:!e||n,title:e??`${t} not configured`,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(Rr,{}),s]}),i?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-300`,children:i}):null]})}function BT(){let{draft:e,setDraft:t,meta:n}=y_(),r=e.intelligenceDir.trim()||n?.resolved.intelligenceDir,i=e.workingDir.trim()||n?.resolved.workingDir;return(0,G.jsxs)(iT,{title:`Paths`,description:`Filesystem locations the runner uses for intelligence materialisation and working repositories. Defaults are usually fine.`,children:[(0,G.jsxs)(Sv,{label:`Intelligence directory`,hint:`Leave blank to use the resolved default.`,children:[(0,G.jsx)(O_,{value:e.intelligenceDir,onChange:e=>t(`intelligenceDir`,e.target.value),placeholder:n?.resolved.intelligenceDir??``}),(0,G.jsx)(zT,{targetPath:r,label:`Intelligence directory`})]}),(0,G.jsx)(Sv,{label:`Intelligence git remote`,hint:`URL of your tenant intelligence Git repository. The runner clones it on first proposal and uses it when merging overlays.`,children:(0,G.jsx)(O_,{value:e.intelligenceRemote,onChange:e=>t(`intelligenceRemote`,e.target.value),placeholder:`https://github.com/org/coro-intelligence.git`})}),(0,G.jsxs)(Sv,{label:`Working directory`,hint:`Where repositories are cloned during job execution.`,children:[(0,G.jsx)(O_,{value:e.workingDir,onChange:e=>t(`workingDir`,e.target.value),placeholder:n?.resolved.workingDir??``}),(0,G.jsx)(zT,{targetPath:i,label:`Working directory`})]}),n?(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-2xl border border-line bg-overlay/40 p-4 text-xs sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Config path`}),(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-fg-muted`,children:n.configPath}),(0,G.jsx)(zT,{targetPath:n.configPath,label:`Config file`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Mode`}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-fg-muted`,children:n.mode})]})]}):null]})}function VT(e){let t=[`on ${e.on}`];return e.during?.length&&t.push(`during ${e.during.join(`, `)}`),t.join(` · `)}function HT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.minLength==`number`?n.minLength:80,i=Array.isArray(n.requiredHeadings)?n.requiredHeadings.join(`, `):`## What`;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Minimum description length`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,minLength:Number.isFinite(r)?r:80})}})}),(0,G.jsx)(Sv,{label:`Required headings (comma-separated)`,children:(0,G.jsx)(O_,{value:i,onChange:e=>{t({...n,requiredHeadings:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})}})})]})}function UT({rule:e,onConfigChange:t}){let n=e.config??{};return(0,G.jsx)(Sv,{label:`Minimum human approvals`,children:(0,G.jsx)(O_,{type:`number`,min:0,value:typeof n.minApprovals==`number`?n.minApprovals:1,onChange:e=>{let r=Number(e.target.value);t({...n,minApprovals:Number.isFinite(r)?r:1})}})})}function WT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.maxLines==`number`?n.maxLines:500,i=typeof n.maxFiles==`number`?n.maxFiles:40;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Max diff lines`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,maxLines:Number.isFinite(r)?r:500})}})}),(0,G.jsx)(Sv,{label:`Max changed files`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:i,onChange:e=>{let r=Number(e.target.value);t({...n,maxFiles:Number.isFinite(r)?r:40})}})})]})}function GT(){let{draft:e,setDraft:t,setGuardrailRuleEnabled:n,setGuardrailRuleConfig:r,meta:i}=y_(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),l=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check===`script`),[e.guardrailRules]),u=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check!==`script`),[e.guardrailRules]),d=i?.resolved?.guardrails?.scriptsDir??`~/.coro/guardrails`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Enable guardrails`,description:`When off, the runner skips all guardrail checks. Shipped defaults stay in the Coro package; this toggle controls whether they run.`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`Enforce guardrails on jobs`}),(0,G.jsx)(jx,{checked:e.guardrailsEnabled,onCheckedChange:e=>t(`guardrailsEnabled`,e)})]})}),u.map(t=>(0,G.jsx)(iT,{title:t.title??t.id,description:t.description,status:t.source===`override`?`warn`:void 0,statusLabel:t.source===`override`?`modified`:t.source===`bundled`?`default`:void 0,action:(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)}),footer:(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:VT(t)}),children:t.enabled&&e.guardrailsEnabled?t.check===`pr-description`?(0,G.jsx)(HT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`pr-diff-size`?(0,G.jsx)(WT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`merge-requires-approval`?(0,G.jsx)(UT,{rule:t,onConfigChange:e=>r(t.id,e)}):(0,G.jsxs)(Ov,{tone:`neutral`,children:[`No dashboard fields for check `,(0,G.jsx)(`code`,{children:t.check}),`. Edit advanced JSON below.`]}):(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Rule disabled.`})},t.id)),l.length>0?(0,G.jsx)(iT,{title:`Custom script rules`,description:`Rules that run JavaScript from your guardrails folder. Edit the script file on disk; the runner loads it on the next tool call.`,children:(0,G.jsx)(`ul`,{className:`space-y-3`,children:l.map(t=>(0,G.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line bg-overlay/30 px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-sm`,children:t.title??t.id}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted font-mono`,children:[d,`/`,t.script,`.mjs`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,t.scriptFileExists?`bg-success/15 text-success`:`bg-danger/15 text-danger`),children:t.scriptFileExists?`script found`:`script missing`}),(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)})]})]},t.id))})}):null,(0,G.jsx)(iT,{title:`Advanced`,description:`Override guardrails as raw JSON (same shape as ~/.coro/config.json guardrails.rules).`,action:(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>o(e=>!e),children:[a?(0,G.jsx)(lr,{className:`h-4 w-4`}):(0,G.jsx)(ur,{className:`h-4 w-4`}),a?`Hide`:`Show`]}),children:a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`textarea`,{value:e.guardrailsRulesText,onChange:e=>{t(`guardrailsRulesText`,e.target.value);try{JSON.parse(e.target.value),c(null)}catch(e){c(`Invalid JSON: ${e.message}`)}},spellCheck:!1,rows:10,className:`w-full rounded-md border border-line bg-bg font-mono text-[12px] p-3`}),s?(0,G.jsx)(Ov,{tone:`danger`,children:s}):null]}):null})]})}function KT(){let{preferences:e,reload:t}=y_(),n=e?.coachMode,r=e?.intake,i=n?.enabled??!0,a=n?.graduateAfterRuns??5,o=r?.mode??(i?`ai`:`form`);async function s(e){await q(`/config`,J(e,{method:`PUT`})),await t()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Coach mode`,description:`Safer defaults for new users — interactive checkpoints on by default until you graduate.`,children:(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Enable coach mode`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`New runs default to Interactive mode and show extra guidance on the New Run page.`})]}),(0,G.jsx)(jx,{checked:i,onCheckedChange:e=>void s({coachMode:{enabled:e,graduateAfterRuns:a}}),"aria-label":`Coach mode`})]})}),(0,G.jsxs)(iT,{title:`Coro plan mode`,description:`Choose how the New Run page starts — plan mode conversation or the classic form.`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`Default new-run mode`}),(0,G.jsxs)(OS,{value:o,onChange:e=>void s({intake:{...r,mode:e.target.value}}),children:[(0,G.jsx)(`option`,{value:`ai`,children:`Coro plan mode (recommended with coach mode)`}),(0,G.jsx)(`option`,{value:`form`,children:`Classic form`}),(0,G.jsx)(`option`,{value:`ask-each-time`,children:`Ask each time`})]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Coro plan mode uses your configured LLM to help shape a run brief before dispatch.`})]}),(0,G.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Allow read-only lookups`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`Let plan mode read tracker tickets and repository files to shape better briefs. Never writes.`})]}),(0,G.jsx)(jx,{checked:r?.toolsEnabled!==!1,onCheckedChange:e=>void s({intake:{...r,toolsEnabled:e}}),"aria-label":`Plan mode read-only tools`})]})]})]})}var qT={general:KT,"llm-provider":ET,"source-control":AT,"issue-tracker":MT,plugins:IT,mcp:RT,paths:BT,guardrails:GT};function JT({onLaunchWizard:e}){let{loading:t,loadError:n,reload:r,draft:i,isDirty:a,dirtySections:o,discardChanges:s,save:c,saving:l,saveError:u,saveNotice:d,clearSaveFeedback:f,meta:p,pluginsCatalogue:m}=y_(),[h,g]=(0,x.useState)(()=>{if(typeof window>`u`)return`llm-provider`;let e=window.location.hash.replace(/^#/,``);return tT.some(t=>t.id===e)?e:`llm-provider`});(0,x.useEffect)(()=>{typeof window>`u`||window.location.hash!==`#${h}`&&window.history.replaceState(null,``,`#${h}`)},[h]);let _=(0,x.useMemo)(()=>oy({draft:i,pluginsCatalogue:m}),[i,m]),v={setup:tT.filter(e=>e.group===`setup`),extensions:tT.filter(e=>e.group===`extensions`),advanced:tT.filter(e=>e.group===`advanced`)};if(t)return(0,G.jsx)(XT,{});let y=qT[h],b=rT(h),S=_.byId[h];return(0,G.jsxs)(`div`,{className:`space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`Settings`,description:`Manage authentication, integrations, and runner internals.`,actions:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:e,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:()=>void r(),children:[(0,G.jsx)(mi,{}),`Reload`]})]})}),n?(0,G.jsx)(gg,{message:n}):null,p?.configError?(0,G.jsx)(Ov,{tone:`warning`,title:`Config file failed validation`,children:`The current config file failed schema validation. Save changes once to rewrite it cleanly.`}):null,_.ready?null:(0,G.jsxs)(Ov,{tone:`warning`,title:`Setup is not complete`,children:[`Required sections still need attention before jobs can run:`,` `,_.missingRequired.map(e=>rT(e).label).join(`, `),`.`]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(`aside`,{className:`space-y-6 lg:sticky lg:top-6 lg:self-start`,children:[`setup`,`extensions`,`advanced`].map(e=>{let t=v[e];if(t.length===0)return null;let n=nT[e];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`px-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-fg-subtle`,children:n.title}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:n.hint})]}),(0,G.jsx)(`nav`,{className:`space-y-1`,"aria-label":`${n.title} sections`,children:t.map(e=>{let t=e.id===h,n=_.byId[e.id],r=e.icon,i=o.has(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),className:W(`group flex w-full items-center gap-3 rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,t?`border-accent-500/35 bg-accent-500/8 text-fg`:`border-line/60 bg-overlay/40 text-fg-muted hover:border-line hover:text-fg`),children:[(0,G.jsx)(r,{className:W(`size-4 shrink-0`,t?`text-accent-300`:`text-fg-subtle`)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),i?(0,G.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-accent-400`,"aria-label":`Unsaved changes`}):null]})}),(0,G.jsx)(YT,{status:n.status})]},e.id)})})]},e)})}),(0,G.jsxs)(`main`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:nT[b.group].title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:b.label}),b.required?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,(0,G.jsx)(jv,{status:S.status,label:S.label})]}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-5 text-fg-muted`,children:b.description})]})}),u?(0,G.jsx)(Ov,{tone:`danger`,title:`Save failed`,children:u}):null,d?(0,G.jsx)(Ov,{tone:`success`,children:d}):null,(0,G.jsx)(`div`,{className:`space-y-6`,children:(0,G.jsx)(y,{})})]})]}),a?(0,G.jsx)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/95 backdrop-blur supports-[backdrop-filter]:bg-canvas/85`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-accent-400`}),`You have unsaved changes`,(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-fg`,children:[o.size,` section`,o.size===1?``:`s`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{s(),f()},disabled:l,children:[(0,G.jsx)(gi,{}),`Discard changes`]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),`Saving…`]}):(0,G.jsxs)(G.Fragment,{children:[`Save all changes`,(0,G.jsx)(`span`,{className:`ml-1 rounded-full border border-current/30 px-1.5 text-[10px] font-medium`,children:o.size})]})})]})]})}):null]})}function YT({status:e}){return e===`ok`?(0,G.jsx)(fr,{className:`size-4 shrink-0 text-success-300`,"aria-label":`Ready`}):e===`warn`?(0,G.jsx)(Mi,{className:`size-4 shrink-0 text-warning-300`,"aria-label":`Needs attention`}):e===`error`?(0,G.jsx)(_r,{className:`size-4 shrink-0 text-danger-300`,"aria-label":`Failed`}):e===`pending`?(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`,"aria-label":`Working`}):null}function XT(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(bg,{className:`h-9 w-40`}),(0,G.jsx)(bg,{className:`h-4 w-72`}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(bg,{className:`h-96 w-full`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsx)(bg,{className:`h-64 w-full`})]})]})]})}function ZT(){let[e,t]=(0,x.useState)(!1);return(0,G.jsxs)(S_,{children:[(0,G.jsx)(JT,{onLaunchWizard:()=>t(!0)}),(0,G.jsx)($v,{open:e,onOpenChange:t})]})}function QT(){let{jobId:e}=ot();return(0,G.jsx)(At,{to:`/jobs/${e??``}`,replace:!0})}function $T(){return(0,G.jsx)(Pt,{children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(sg,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(nb,{})}),(0,G.jsx)(Mt,{path:`/jobs`,element:(0,G.jsx)(hb,{})}),(0,G.jsx)(Mt,{path:`/campaigns`,element:(0,G.jsx)(At,{to:`/jobs?workflow=campaign`,replace:!0})}),(0,G.jsx)(Mt,{path:`/history`,element:(0,G.jsx)(sb,{})}),(0,G.jsx)(Mt,{path:`/jobs/new`,element:(0,G.jsx)(ww,{})}),(0,G.jsx)(Mt,{path:`/jobs/:jobId`,element:(0,G.jsx)(VC,{})}),(0,G.jsx)(Mt,{path:`/campaigns/:jobId`,element:(0,G.jsx)(QT,{})}),(0,G.jsx)(Mt,{path:`/intelligence`,element:(0,G.jsx)(qw,{})}),(0,G.jsx)(Mt,{path:`/settings`,element:(0,G.jsx)(ZT,{})})]})})}(0,Fi.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(wn,{basename:`/dashboard`,children:(0,G.jsx)(Co,{children:(0,G.jsx)($T,{})})})}));
|
|
144
|
+
}`;function RT(){let{draft:e,setDraft:t}=y_(),[n,r]=(0,x.useState)(null),[i,a]=(0,x.useState)(null),[o,s]=(0,x.useState)(!1);(0,x.useEffect)(()=>{try{let t=JSON.parse(e.mcpServersText);r(typeof t!=`object`||!t||Array.isArray(t)?`mcpServers must be a JSON object keyed by server id.`:null)}catch(e){r(`Invalid JSON: ${e.message}`)}},[e.mcpServersText]);async function c(){try{s(!0),a(await q(`/config/claude-code-mcps`))}catch{a(null)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(iT,{title:`Bring-your-own MCP servers`,description:"Attach any MCP server (Slack, Sentry, Datadog, internal tooling…) to every job session. The runner spawns each entry alongside the in-process `coro` server; agents see them as `mcp__<id>__*`.",footer:(0,G.jsxs)(`span`,{children:[`Reserved id `,(0,G.jsx)(`code`,{children:`coro`}),` is rejected. Use `,(0,G.jsx)(`code`,{children:`"enabled": false`}),` to keep an entry without attaching it.`,(0,G.jsx)(`code`,{children:` planMode: true`}),` also attaches the server during New Run (Coro plan mode) chat.`,(0,G.jsx)(`code`,{children:` allowedTools`}),` / `,(0,G.jsx)(`code`,{children:`disallowedTools`}),` become per-server tool policy. Changes save with the rest of the page.`]}),children:[(0,G.jsx)(bb,{value:e.mcpServersText,onChange:e=>t(`mcpServersText`,e.target.value),spellCheck:!1,rows:14,className:`font-mono text-[12px]`}),n?(0,G.jsx)(Ov,{tone:`danger`,children:n}):null]}),(0,G.jsxs)(iT,{title:`Inherit from Claude Code`,description:`When enabled, the runner reads MCP servers from your user-level Claude Code config (~/.claude.json and ~/.claude/settings.json) and attaches them to every job session. Explicit BYO entries above override inherited entries with the same id.`,action:(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,G.jsx)(mi,{}),o?`Refreshing…`:`Refresh`]}),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-2xl border border-line bg-overlay/40 px-4 py-3.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Inherit Claude Code MCP servers`}),(0,G.jsx)(`div`,{className:`text-[12px] text-fg-muted`,children:`Off by default — Claude Code configs commonly carry developer-personal entries (Notion, GitHub Personal…) that an operator may not want every job to see.`})]}),(0,G.jsx)(jx,{checked:e.inheritClaudeCodeMcps,onCheckedChange:e=>t(`inheritClaudeCodeMcps`,e),ariaLabel:`Inherit Claude Code MCP servers`})]}),i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[i.sources.length>0?(0,G.jsxs)(`div`,{className:`text-[12px] text-fg-muted`,children:[`Read from`,` `,i.sources.map((e,t)=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[t>0?`, `:``,e]},e))]}):(0,G.jsxs)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:[`No Claude Code MCP servers found. Add one with `,(0,G.jsx)(`code`,{children:`claude mcp add <name> --scope user`}),` or paste an entry into `,(0,G.jsx)(`code`,{children:`~/.claude.json`}),` under `,(0,G.jsx)(`code`,{children:`mcpServers`}),`.`]}),Object.keys(i.servers).length>0?(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:JSON.stringify(i.servers,null,2)}):null]}):(0,G.jsx)(`div`,{className:`rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-sm text-fg-muted`,children:o?`Loading discovered servers…`:`Click Refresh to preview the MCP servers Claude Code currently exposes.`})]}),(0,G.jsx)(iT,{title:`Examples`,description:"Drop these into the editor above. Replace placeholder secrets with real ones — values containing `...` are treated as redacted echoes and ignored on save.",children:(0,G.jsx)(`pre`,{className:`overflow-auto rounded-2xl border border-line bg-overlay/40 px-4 py-3.5 text-[12px] text-fg-muted`,children:LT})})]})}function zT({targetPath:e,label:t}){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=typeof navigator<`u`&&/Win/i.test(navigator.platform)?`explorer`:typeof navigator<`u`&&/Mac/i.test(navigator.platform)?`finder`:`files`,s=o===`finder`?`Show in Finder`:o===`explorer`?`Show in Explorer`:`Open folder`;async function c(){if(e){a(null),r(!0);try{let t=await q(`/system/reveal`,J({path:e,create:!0},{method:`POST`}));t.ok||a(t.error??`Could not open folder`)}catch(e){a((e instanceof K,e.message))}finally{r(!1)}}}return(0,G.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,G.jsxs)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void c(),disabled:!e||n,title:e??`${t} not configured`,children:[n?(0,G.jsx)($r,{className:`animate-spin`}):(0,G.jsx)(Rr,{}),s]}),i?(0,G.jsx)(`span`,{className:`text-[11px] text-danger-300`,children:i}):null]})}function BT(){let{draft:e,setDraft:t,meta:n}=y_(),r=e.intelligenceDir.trim()||n?.resolved.intelligenceDir,i=e.workingDir.trim()||n?.resolved.workingDir;return(0,G.jsxs)(iT,{title:`Paths`,description:`Filesystem locations the runner uses for intelligence materialisation and working repositories. Defaults are usually fine.`,children:[(0,G.jsxs)(Sv,{label:`Intelligence directory`,hint:`Leave blank to use the resolved default.`,children:[(0,G.jsx)(O_,{value:e.intelligenceDir,onChange:e=>t(`intelligenceDir`,e.target.value),placeholder:n?.resolved.intelligenceDir??``}),(0,G.jsx)(zT,{targetPath:r,label:`Intelligence directory`})]}),(0,G.jsx)(Sv,{label:`Intelligence git remote`,hint:`URL of your tenant intelligence Git repository. The runner clones it on first proposal and uses it when merging overlays.`,children:(0,G.jsx)(O_,{value:e.intelligenceRemote,onChange:e=>t(`intelligenceRemote`,e.target.value),placeholder:`https://github.com/org/coro-intelligence.git`})}),(0,G.jsxs)(Sv,{label:`Working directory`,hint:`Where repositories are cloned during job execution.`,children:[(0,G.jsx)(O_,{value:e.workingDir,onChange:e=>t(`workingDir`,e.target.value),placeholder:n?.resolved.workingDir??``}),(0,G.jsx)(zT,{targetPath:i,label:`Working directory`})]}),n?(0,G.jsxs)(`div`,{className:`grid gap-2 rounded-2xl border border-line bg-overlay/40 p-4 text-xs sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Config path`}),(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-fg-muted`,children:n.configPath}),(0,G.jsx)(zT,{targetPath:n.configPath,label:`Config file`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-[0.18em] text-fg-subtle`,children:`Mode`}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-fg-muted`,children:n.mode})]})]}):null]})}function VT(e){let t=[`on ${e.on}`];return e.during?.length&&t.push(`during ${e.during.join(`, `)}`),t.join(` · `)}function HT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.minLength==`number`?n.minLength:80,i=Array.isArray(n.requiredHeadings)?n.requiredHeadings.join(`, `):`## What`;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Minimum description length`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,minLength:Number.isFinite(r)?r:80})}})}),(0,G.jsx)(Sv,{label:`Required headings (comma-separated)`,children:(0,G.jsx)(O_,{value:i,onChange:e=>{t({...n,requiredHeadings:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})}})})]})}function UT({rule:e,onConfigChange:t}){let n=e.config??{};return(0,G.jsx)(Sv,{label:`Minimum human approvals`,children:(0,G.jsx)(O_,{type:`number`,min:0,value:typeof n.minApprovals==`number`?n.minApprovals:1,onChange:e=>{let r=Number(e.target.value);t({...n,minApprovals:Number.isFinite(r)?r:1})}})})}function WT({rule:e,onConfigChange:t}){let n=e.config??{},r=typeof n.maxLines==`number`?n.maxLines:500,i=typeof n.maxFiles==`number`?n.maxFiles:40;return(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,G.jsx)(Sv,{label:`Max diff lines`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:r,onChange:e=>{let r=Number(e.target.value);t({...n,maxLines:Number.isFinite(r)?r:500})}})}),(0,G.jsx)(Sv,{label:`Max changed files`,children:(0,G.jsx)(O_,{type:`number`,min:1,value:i,onChange:e=>{let r=Number(e.target.value);t({...n,maxFiles:Number.isFinite(r)?r:40})}})})]})}function GT(){let{draft:e,setDraft:t,setGuardrailRuleEnabled:n,setGuardrailRuleConfig:r,meta:i}=y_(),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),l=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check===`script`),[e.guardrailRules]),u=(0,x.useMemo)(()=>e.guardrailRules.filter(e=>e.check!==`script`),[e.guardrailRules]),d=i?.resolved?.guardrails?.scriptsDir??`~/.coro/guardrails`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Enable guardrails`,description:`When off, the runner skips all guardrail checks. Shipped defaults stay in the Coro package; this toggle controls whether they run.`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{className:`text-sm text-fg-muted`,children:`Enforce guardrails on jobs`}),(0,G.jsx)(jx,{checked:e.guardrailsEnabled,onCheckedChange:e=>t(`guardrailsEnabled`,e)})]})}),u.map(t=>(0,G.jsx)(iT,{title:t.title??t.id,description:t.description,status:t.source===`override`?`warn`:void 0,statusLabel:t.source===`override`?`modified`:t.source===`bundled`?`default`:void 0,action:(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)}),footer:(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:VT(t)}),children:t.enabled&&e.guardrailsEnabled?t.check===`pr-description`?(0,G.jsx)(HT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`pr-diff-size`?(0,G.jsx)(WT,{rule:t,onConfigChange:e=>r(t.id,e)}):t.check===`merge-requires-approval`?(0,G.jsx)(UT,{rule:t,onConfigChange:e=>r(t.id,e)}):(0,G.jsxs)(Ov,{tone:`neutral`,children:[`No dashboard fields for check `,(0,G.jsx)(`code`,{children:t.check}),`. Edit advanced JSON below.`]}):(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Rule disabled.`})},t.id)),l.length>0?(0,G.jsx)(iT,{title:`Custom script rules`,description:`Rules that run JavaScript from your guardrails folder. Edit the script file on disk; the runner loads it on the next tool call.`,children:(0,G.jsx)(`ul`,{className:`space-y-3`,children:l.map(t=>(0,G.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line bg-overlay/30 px-4 py-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-medium text-sm`,children:t.title??t.id}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted font-mono`,children:[d,`/`,t.script,`.mjs`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:W(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,t.scriptFileExists?`bg-success/15 text-success`:`bg-danger/15 text-danger`),children:t.scriptFileExists?`script found`:`script missing`}),(0,G.jsx)(jx,{checked:t.enabled,disabled:!e.guardrailsEnabled,onCheckedChange:e=>n(t.id,e)})]})]},t.id))})}):null,(0,G.jsx)(iT,{title:`Advanced`,description:`Override guardrails as raw JSON (same shape as ~/.coro/config.json guardrails.rules).`,action:(0,G.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>o(e=>!e),children:[a?(0,G.jsx)(lr,{className:`h-4 w-4`}):(0,G.jsx)(ur,{className:`h-4 w-4`}),a?`Hide`:`Show`]}),children:a?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`textarea`,{value:e.guardrailsRulesText,onChange:e=>{t(`guardrailsRulesText`,e.target.value);try{JSON.parse(e.target.value),c(null)}catch(e){c(`Invalid JSON: ${e.message}`)}},spellCheck:!1,rows:10,className:`w-full rounded-md border border-line bg-bg font-mono text-[12px] p-3`}),s?(0,G.jsx)(Ov,{tone:`danger`,children:s}):null]}):null})]})}function KT(){let{preferences:e,reload:t}=y_(),n=e?.coachMode,r=e?.intake,i=n?.enabled??!0,a=n?.graduateAfterRuns??5,o=r?.mode??(i?`ai`:`form`);async function s(e){await q(`/config`,J(e,{method:`PUT`})),await t()}return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(iT,{title:`Coach mode`,description:`Safer defaults for new users — interactive checkpoints on by default until you graduate.`,children:(0,G.jsxs)(`label`,{className:`flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Enable coach mode`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`New runs default to Interactive mode and show extra guidance on the New Run page.`})]}),(0,G.jsx)(jx,{checked:i,onCheckedChange:e=>void s({coachMode:{enabled:e,graduateAfterRuns:a}}),"aria-label":`Coach mode`})]})}),(0,G.jsxs)(iT,{title:`Coro plan mode`,description:`Choose how the New Run page starts — plan mode conversation or the classic form.`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`text-[11px] font-medium uppercase tracking-[0.16em] text-fg-subtle`,children:`Default new-run mode`}),(0,G.jsxs)(OS,{value:o,onChange:e=>void s({intake:{...r,mode:e.target.value}}),children:[(0,G.jsx)(`option`,{value:`ai`,children:`Coro plan mode (recommended with coach mode)`}),(0,G.jsx)(`option`,{value:`form`,children:`Classic form`}),(0,G.jsx)(`option`,{value:`ask-each-time`,children:`Ask each time`})]}),(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Coro plan mode uses your configured LLM to help shape a run brief before dispatch.`})]}),(0,G.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-4 rounded-xl border border-line bg-overlay/30 p-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:`Allow read-only lookups`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:`Let plan mode read tracker tickets and repository files to shape better briefs. Never writes.`})]}),(0,G.jsx)(jx,{checked:r?.toolsEnabled!==!1,onCheckedChange:e=>void s({intake:{...r,toolsEnabled:e}}),"aria-label":`Plan mode read-only tools`})]})]})]})}var qT={general:KT,"llm-provider":ET,"source-control":AT,"issue-tracker":MT,plugins:IT,mcp:RT,paths:BT,guardrails:GT};function JT({onLaunchWizard:e}){let{loading:t,loadError:n,reload:r,draft:i,isDirty:a,dirtySections:o,discardChanges:s,save:c,saving:l,saveError:u,saveNotice:d,clearSaveFeedback:f,meta:p,pluginsCatalogue:m}=y_(),[h,g]=(0,x.useState)(()=>{if(typeof window>`u`)return`llm-provider`;let e=window.location.hash.replace(/^#/,``);return tT.some(t=>t.id===e)?e:`llm-provider`});(0,x.useEffect)(()=>{typeof window>`u`||window.location.hash!==`#${h}`&&window.history.replaceState(null,``,`#${h}`)},[h]);let _=(0,x.useMemo)(()=>oy({draft:i,pluginsCatalogue:m}),[i,m]),v={setup:tT.filter(e=>e.group===`setup`),extensions:tT.filter(e=>e.group===`extensions`),advanced:tT.filter(e=>e.group===`advanced`)};if(t)return(0,G.jsx)(XT,{});let y=qT[h],b=rT(h),S=_.byId[h];return(0,G.jsxs)(`div`,{className:`space-y-6 pb-32`,children:[(0,G.jsx)(cg,{title:`Settings`,description:`Manage authentication, integrations, and runner internals.`,actions:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e?(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:e,children:[(0,G.jsx)(Di,{}),`Run setup wizard`]}):null,(0,G.jsxs)(Y,{type:`button`,variant:`outline`,onClick:()=>void r(),children:[(0,G.jsx)(mi,{}),`Reload`]})]})}),n?(0,G.jsx)(gg,{message:n}):null,p?.configError?(0,G.jsx)(Ov,{tone:`warning`,title:`Config file failed validation`,children:`The current config file failed schema validation. Save changes once to rewrite it cleanly.`}):null,_.ready?null:(0,G.jsxs)(Ov,{tone:`warning`,title:`Setup is not complete`,children:[`Required sections still need attention before jobs can run:`,` `,_.missingRequired.map(e=>rT(e).label).join(`, `),`.`]}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(`aside`,{className:`space-y-6 lg:sticky lg:top-6 lg:self-start`,children:[`setup`,`extensions`,`advanced`].map(e=>{let t=v[e];if(t.length===0)return null;let n=nT[e];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`px-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-fg-subtle`,children:n.title}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:n.hint})]}),(0,G.jsx)(`nav`,{className:`space-y-1`,"aria-label":`${n.title} sections`,children:t.map(e=>{let t=e.id===h,n=_.byId[e.id],r=e.icon,i=o.has(e.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),className:W(`group flex w-full items-center gap-3 rounded-xl border px-3 py-2.5 text-left text-sm transition-colors`,t?`border-accent-500/35 bg-accent-500/8 text-fg`:`border-line/60 bg-overlay/40 text-fg-muted hover:border-line hover:text-fg`),children:[(0,G.jsx)(r,{className:W(`size-4 shrink-0`,t?`text-accent-300`:`text-fg-subtle`)}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),i?(0,G.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-accent-400`,"aria-label":`Unsaved changes`}):null]})}),(0,G.jsx)(YT,{status:n.status})]},e.id)})})]},e)})}),(0,G.jsxs)(`main`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:nT[b.group].title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:b.label}),b.required?(0,G.jsx)(`span`,{className:`rounded-full border border-line bg-overlay/60 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.18em] text-fg-subtle`,children:`Required`}):null,(0,G.jsx)(jv,{status:S.status,label:S.label})]}),(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-5 text-fg-muted`,children:b.description})]})}),u?(0,G.jsx)(Ov,{tone:`danger`,title:`Save failed`,children:u}):null,d?(0,G.jsx)(Ov,{tone:`success`,children:d}):null,(0,G.jsx)(`div`,{className:`space-y-6`,children:(0,G.jsx)(y,{})})]})]}),a?(0,G.jsx)(`div`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-line bg-canvas/95 backdrop-blur supports-[backdrop-filter]:bg-canvas/85`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{className:`inline-flex size-2 rounded-full bg-accent-400`}),`You have unsaved changes`,(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:`·`}),(0,G.jsxs)(`span`,{className:`text-fg`,children:[o.size,` section`,o.size===1?``:`s`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{s(),f()},disabled:l,children:[(0,G.jsx)(gi,{}),`Discard changes`]}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)($r,{className:`animate-spin`}),`Saving…`]}):(0,G.jsxs)(G.Fragment,{children:[`Save all changes`,(0,G.jsx)(`span`,{className:`ml-1 rounded-full border border-current/30 px-1.5 text-[10px] font-medium`,children:o.size})]})})]})]})}):null]})}function YT({status:e}){return e===`ok`?(0,G.jsx)(fr,{className:`size-4 shrink-0 text-success-300`,"aria-label":`Ready`}):e===`warn`?(0,G.jsx)(Mi,{className:`size-4 shrink-0 text-warning-300`,"aria-label":`Needs attention`}):e===`error`?(0,G.jsx)(_r,{className:`size-4 shrink-0 text-danger-300`,"aria-label":`Failed`}):e===`pending`?(0,G.jsx)($r,{className:`size-4 shrink-0 animate-spin text-accent-300`,"aria-label":`Working`}):null}function XT(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(bg,{className:`h-9 w-40`}),(0,G.jsx)(bg,{className:`h-4 w-72`}),(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,G.jsx)(bg,{className:`h-96 w-full`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(bg,{className:`h-12 w-full`}),(0,G.jsx)(bg,{className:`h-64 w-full`})]})]})]})}function ZT(){let[e,t]=(0,x.useState)(!1);return(0,G.jsxs)(S_,{children:[(0,G.jsx)(JT,{onLaunchWizard:()=>t(!0)}),(0,G.jsx)($v,{open:e,onOpenChange:t})]})}function QT(){let{jobId:e}=ot();return(0,G.jsx)(At,{to:`/jobs/${e??``}`,replace:!0})}function $T(){return(0,G.jsx)(Pt,{children:(0,G.jsxs)(Mt,{element:(0,G.jsx)(sg,{}),children:[(0,G.jsx)(Mt,{path:`/`,element:(0,G.jsx)(nb,{})}),(0,G.jsx)(Mt,{path:`/jobs`,element:(0,G.jsx)(hb,{})}),(0,G.jsx)(Mt,{path:`/campaigns`,element:(0,G.jsx)(At,{to:`/jobs?workflow=campaign`,replace:!0})}),(0,G.jsx)(Mt,{path:`/history`,element:(0,G.jsx)(sb,{})}),(0,G.jsx)(Mt,{path:`/jobs/new`,element:(0,G.jsx)(ww,{})}),(0,G.jsx)(Mt,{path:`/jobs/:jobId`,element:(0,G.jsx)(VC,{})}),(0,G.jsx)(Mt,{path:`/campaigns/:jobId`,element:(0,G.jsx)(QT,{})}),(0,G.jsx)(Mt,{path:`/intelligence`,element:(0,G.jsx)(qw,{})}),(0,G.jsx)(Mt,{path:`/settings`,element:(0,G.jsx)(ZT,{})})]})})}(0,Fi.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(wn,{basename:`/dashboard`,children:(0,G.jsx)(Co,{children:(0,G.jsx)($T,{})})})}));
|