vessel-agent 0.0.0-stage → 2.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +466 -2
- package/README.zh-CN.md +476 -0
- package/apps/web/dist/Vela.png +0 -0
- package/apps/web/dist/Vessel.svg +24 -0
- package/apps/web/dist/apple-touch-icon.png +0 -0
- package/apps/web/dist/assets/ConfigView-BKdxb1s5.js +1 -0
- package/apps/web/dist/assets/DesignLabContent-CY5HfVn_.js +4 -0
- package/apps/web/dist/assets/DesignLabView-DTBWv5-E.js +1 -0
- package/apps/web/dist/assets/action-menu.preview-CpIL3tay.js +1 -0
- package/apps/web/dist/assets/agent-message.preview-CSYnJxgr.js +1 -0
- package/apps/web/dist/assets/assistant-text.preview-Bc2Is6sW.js +2 -0
- package/apps/web/dist/assets/badges.preview-DP0oPcs5.js +1 -0
- package/apps/web/dist/assets/buttons.preview-Y84aT4k3.js +1 -0
- package/apps/web/dist/assets/card-shell.preview-mwRwhVb8.js +1 -0
- package/apps/web/dist/assets/chip-tones.preview-dQ_6pwft.js +1 -0
- package/apps/web/dist/assets/composer-controls.preview-CBtJVrMo.js +1 -0
- package/apps/web/dist/assets/confirm-dialog.preview-BkNEtLld.js +1 -0
- package/apps/web/dist/assets/data-table.preview-DPZ7Pnn8.js +1 -0
- package/apps/web/dist/assets/depth-color.preview-CtCbAgCH.js +1 -0
- package/apps/web/dist/assets/entity-header.preview-BxPLNUSH.js +1 -0
- package/apps/web/dist/assets/env-card.preview-Bv4UlMjr.js +1 -0
- package/apps/web/dist/assets/failure-card.preview-DD3-RMju.js +1 -0
- package/apps/web/dist/assets/filter-popover.preview-D7Q7Kws8.js +1 -0
- package/apps/web/dist/assets/form.preview-D_Qltx-j.js +1 -0
- package/apps/web/dist/assets/index-ee36IO2F.js +600 -0
- package/apps/web/dist/assets/index-uU9N5oTa.css +1 -0
- package/apps/web/dist/assets/key-value.preview-B0gzxwtK.js +1 -0
- package/apps/web/dist/assets/mention-popover.preview-Duza1RgL.js +1 -0
- package/apps/web/dist/assets/message-fold.preview-Cx-CD3Y4.js +1 -0
- package/apps/web/dist/assets/modal-shell.preview-DYKwUk2S.js +1 -0
- package/apps/web/dist/assets/nav-item.preview-FTbsBQ2g.js +1 -0
- package/apps/web/dist/assets/nav-status-legend.preview-bS4LDFbd.js +1 -0
- package/apps/web/dist/assets/page-scaffold.preview-bzBFkjZ6.js +1 -0
- package/apps/web/dist/assets/plugin-ui-BxTydP3l.js +1 -0
- package/apps/web/dist/assets/projection-card.preview-BV0P-y8e.js +6 -0
- package/apps/web/dist/assets/queued.preview-zQqFe4Zr.js +1 -0
- package/apps/web/dist/assets/react-vendor-CUu194FT.js +9 -0
- package/apps/web/dist/assets/reasoning.preview-DtHXgW_8.js +2 -0
- package/apps/web/dist/assets/section.preview-A-PRm-rh.js +1 -0
- package/apps/web/dist/assets/sidebar-shell.preview-DFKMwNoo.js +1 -0
- package/apps/web/dist/assets/stat.preview-BzChSFLL.js +1 -0
- package/apps/web/dist/assets/states.preview-CyXZWnZ-.js +1 -0
- package/apps/web/dist/assets/status-icons.preview-DHdWwUis.js +1 -0
- package/apps/web/dist/assets/tabs.preview-CHbK1Two.js +1 -0
- package/apps/web/dist/assets/tool-card.preview-Z48fekTD.js +2 -0
- package/apps/web/dist/assets/toolbar.preview-Bl6hLYXX.js +1 -0
- package/apps/web/dist/assets/tooltip.preview-GKGTGfMP.js +1 -0
- package/apps/web/dist/assets/user-bubble.preview-CHYvio9z.js +1 -0
- package/apps/web/dist/assets/vendor/jsx-runtime.mjs +7 -0
- package/apps/web/dist/assets/vendor/plugin-sdk.mjs +12 -0
- package/apps/web/dist/assets/vendor/react-dom-client.mjs +6 -0
- package/apps/web/dist/assets/vendor/react-dom.mjs +11 -0
- package/apps/web/dist/assets/vendor/react.mjs +39 -0
- package/apps/web/dist/build.json +5 -0
- package/apps/web/dist/favicon.ico +0 -0
- package/apps/web/dist/index.html +24 -0
- package/package.json +70 -4
- package/packages/agent/package.json +32 -0
- package/packages/agent/src/address-display.ts +141 -0
- package/packages/agent/src/conversation-budget.ts +651 -0
- package/packages/agent/src/conversation-store.ts +351 -0
- package/packages/agent/src/distress.ts +161 -0
- package/packages/agent/src/env-info-scope.ts +153 -0
- package/packages/agent/src/error-text.ts +28 -0
- package/packages/agent/src/inbox-source.ts +73 -0
- package/packages/agent/src/inbox.ts +2335 -0
- package/packages/agent/src/index.ts +273 -0
- package/packages/agent/src/member-cwd.ts +128 -0
- package/packages/agent/src/member-ports.ts +162 -0
- package/packages/agent/src/refs.ts +51 -0
- package/packages/agent/src/registry.ts +741 -0
- package/packages/agent/src/runtime.ts +2501 -0
- package/packages/agent/src/self-card-delta.ts +428 -0
- package/packages/agent/src/service.ts +9212 -0
- package/packages/agent/src/snapshot.ts +614 -0
- package/packages/agent/src/team-address.ts +96 -0
- package/packages/agent/src/team-log.ts +487 -0
- package/packages/agent/src/team-service.ts +1966 -0
- package/packages/agent/src/team-slug.ts +167 -0
- package/packages/agent/src/team-store.ts +619 -0
- package/packages/agent/src/tool.ts +1306 -0
- package/packages/agent/src/types/budget.ts +168 -0
- package/packages/agent/src/types/constants.ts +17 -0
- package/packages/agent/src/types/dispatch.ts +133 -0
- package/packages/agent/src/types/events.ts +132 -0
- package/packages/agent/src/types/execution.ts +289 -0
- package/packages/agent/src/types/lifecycle.ts +372 -0
- package/packages/agent/src/types/member.ts +221 -0
- package/packages/agent/src/types/message.ts +113 -0
- package/packages/agent/src/types/results.ts +64 -0
- package/packages/agent/src/types/roster.ts +137 -0
- package/packages/agent/src/types/service.ts +702 -0
- package/packages/agent/src/types/session.ts +102 -0
- package/packages/agent/src/types/team.ts +558 -0
- package/packages/agent/src/types.ts +22 -0
- package/packages/agent/tsconfig.json +8 -0
- package/packages/config/package.json +32 -0
- package/packages/config/src/auth-origins.ts +85 -0
- package/packages/config/src/auth-strategies/avatar-ref.ts +40 -0
- package/packages/config/src/auth-strategies/gitee.ts +72 -0
- package/packages/config/src/auth-strategies/github.ts +64 -0
- package/packages/config/src/auth-strategies/index.ts +47 -0
- package/packages/config/src/auth-strategies/match.ts +82 -0
- package/packages/config/src/auth-strategies/microsoft.ts +100 -0
- package/packages/config/src/auth-strategies/oauth-exchange.ts +192 -0
- package/packages/config/src/auth-strategies/password.ts +34 -0
- package/packages/config/src/auth-strategies/registry.ts +105 -0
- package/packages/config/src/auth-strategies/shapes.ts +138 -0
- package/packages/config/src/auth-strategies/types.ts +190 -0
- package/packages/config/src/auth.ts +305 -0
- package/packages/config/src/config-lock.ts +328 -0
- package/packages/config/src/defaults.ts +271 -0
- package/packages/config/src/env-file.ts +175 -0
- package/packages/config/src/env-injection.ts +117 -0
- package/packages/config/src/explain.ts +283 -0
- package/packages/config/src/gateway.ts +107 -0
- package/packages/config/src/index.ts +253 -0
- package/packages/config/src/loader.ts +871 -0
- package/packages/config/src/model-migration.ts +534 -0
- package/packages/config/src/model-registry.ts +374 -0
- package/packages/config/src/models-disk.ts +72 -0
- package/packages/config/src/models-validation.ts +467 -0
- package/packages/config/src/node-registration.ts +583 -0
- package/packages/config/src/root-secret.ts +402 -0
- package/packages/config/src/secrets.ts +452 -0
- package/packages/config/src/sources.ts +82 -0
- package/packages/config/src/team-policy.ts +422 -0
- package/packages/config/src/types/agent.ts +263 -0
- package/packages/config/src/types/attention.ts +28 -0
- package/packages/config/src/types/auth.ts +126 -0
- package/packages/config/src/types/connect.ts +21 -0
- package/packages/config/src/types/hub.ts +59 -0
- package/packages/config/src/types/models.ts +153 -0
- package/packages/config/src/types/node.ts +202 -0
- package/packages/config/src/types/observability.ts +84 -0
- package/packages/config/src/types/root.ts +240 -0
- package/packages/config/src/types/runtime.ts +123 -0
- package/packages/config/src/types/security.ts +43 -0
- package/packages/config/src/types/serve.ts +34 -0
- package/packages/config/src/types/snapshot.ts +28 -0
- package/packages/config/src/types/team.ts +112 -0
- package/packages/config/src/types/ui.ts +179 -0
- package/packages/config/src/types.ts +22 -0
- package/packages/config/src/user-config.ts +175 -0
- package/packages/config/src/utils.ts +55 -0
- package/packages/config/src/validator/auth.ts +302 -0
- package/packages/config/src/validator/hub.ts +329 -0
- package/packages/config/src/validator/models.ts +1304 -0
- package/packages/config/src/validator/serve.ts +784 -0
- package/packages/config/src/validator/settings.ts +244 -0
- package/packages/config/src/validator/shared.ts +304 -0
- package/packages/config/src/validator/tenant-keys.ts +91 -0
- package/packages/config/src/validator/unknown-keys.ts +452 -0
- package/packages/config/src/validator.ts +1146 -0
- package/packages/config/tsconfig.json +8 -0
- package/packages/core/package.json +38 -0
- package/packages/core/src/context/anchor.ts +57 -0
- package/packages/core/src/context/archive-notice.ts +283 -0
- package/packages/core/src/context/cleared-tool-result.ts +262 -0
- package/packages/core/src/context/compaction-index.ts +381 -0
- package/packages/core/src/context/composition.ts +251 -0
- package/packages/core/src/context/context-manager.ts +1585 -0
- package/packages/core/src/context/context-notice.ts +218 -0
- package/packages/core/src/context/index.ts +220 -0
- package/packages/core/src/context/model-change-notice.ts +81 -0
- package/packages/core/src/context/projection-policy.ts +719 -0
- package/packages/core/src/context/prompt-context.ts +66 -0
- package/packages/core/src/context/read-side-mask.ts +63 -0
- package/packages/core/src/context/request-sequence.ts +423 -0
- package/packages/core/src/context/request-view.ts +256 -0
- package/packages/core/src/context/session-breaker.ts +100 -0
- package/packages/core/src/context/tool-result-whitelist.ts +135 -0
- package/packages/core/src/events/event-stream.ts +271 -0
- package/packages/core/src/events/file-event-store.ts +119 -0
- package/packages/core/src/events/index.ts +15 -0
- package/packages/core/src/events/replay.ts +82 -0
- package/packages/core/src/events/summarize-event.ts +135 -0
- package/packages/core/src/index.ts +475 -0
- package/packages/core/src/kernel/cancellation.ts +54 -0
- package/packages/core/src/kernel/event-bus.ts +65 -0
- package/packages/core/src/kernel/index.ts +32 -0
- package/packages/core/src/kernel/internal.ts +32 -0
- package/packages/core/src/kernel/scheduler.ts +406 -0
- package/packages/core/src/kernel/types.ts +269 -0
- package/packages/core/src/limits/index.ts +23 -0
- package/packages/core/src/limits/limit-checker.ts +270 -0
- package/packages/core/src/limits/limit-error.ts +29 -0
- package/packages/core/src/log-format.ts +722 -0
- package/packages/core/src/log-hub.ts +278 -0
- package/packages/core/src/logging.ts +64 -0
- package/packages/core/src/observability/index.ts +24 -0
- package/packages/core/src/observability/metrics.ts +279 -0
- package/packages/core/src/observability/read-trace.ts +163 -0
- package/packages/core/src/observability/rebuild-metrics.ts +37 -0
- package/packages/core/src/observability/trace-prune.ts +248 -0
- package/packages/core/src/observability/trace-recorder.ts +484 -0
- package/packages/core/src/observability/trace-redactor.ts +93 -0
- package/packages/core/src/pii/index.ts +88 -0
- package/packages/core/src/pii/notice.ts +156 -0
- package/packages/core/src/pii/reveal.ts +198 -0
- package/packages/core/src/pii/rules.ts +545 -0
- package/packages/core/src/pii/types.ts +140 -0
- package/packages/core/src/pii/vault.ts +764 -0
- package/packages/core/src/provider/errors.ts +41 -0
- package/packages/core/src/provider/index.ts +19 -0
- package/packages/core/src/provider/providers.ts +1011 -0
- package/packages/core/src/provider/request-extras.ts +285 -0
- package/packages/core/src/provider/stream-accumulator.ts +168 -0
- package/packages/core/src/provider/usage.ts +112 -0
- package/packages/core/src/runtime/error-envelope.ts +451 -0
- package/packages/core/src/runtime/error-summary.ts +174 -0
- package/packages/core/src/runtime/execution-unit.ts +6675 -0
- package/packages/core/src/runtime/guardrail-runner.ts +86 -0
- package/packages/core/src/runtime/hook-runner.ts +137 -0
- package/packages/core/src/runtime/index.ts +123 -0
- package/packages/core/src/runtime/permission-policy.ts +267 -0
- package/packages/core/src/runtime/plugin-host.ts +489 -0
- package/packages/core/src/runtime/plugin-install.ts +144 -0
- package/packages/core/src/runtime/policy/index.ts +21 -0
- package/packages/core/src/runtime/prompt-prefix-guard.ts +166 -0
- package/packages/core/src/runtime/provider-retry.ts +220 -0
- package/packages/core/src/runtime/resume-markers.ts +114 -0
- package/packages/core/src/runtime/resume-recovery.ts +164 -0
- package/packages/core/src/runtime/run-journal.ts +382 -0
- package/packages/core/src/runtime/run-timing.ts +217 -0
- package/packages/core/src/runtime/runtime.ts +349 -0
- package/packages/core/src/runtime/safepoint-pause.ts +29 -0
- package/packages/core/src/runtime/tool-attachment.ts +170 -0
- package/packages/core/src/runtime/tool-calling-loop.ts +1219 -0
- package/packages/core/src/runtime/tool-name.ts +215 -0
- package/packages/core/src/runtime/tool-pipeline.ts +459 -0
- package/packages/core/src/runtime/tool-provenance.ts +48 -0
- package/packages/core/src/runtime/tool-result-gate.ts +329 -0
- package/packages/core/src/session/atomic-write.ts +335 -0
- package/packages/core/src/session/compaction-index-derive.ts +173 -0
- package/packages/core/src/session/compaction-index-store.ts +161 -0
- package/packages/core/src/session/compaction-recall.ts +375 -0
- package/packages/core/src/session/delete-session.ts +198 -0
- package/packages/core/src/session/file-backend.ts +1311 -0
- package/packages/core/src/session/index.ts +118 -0
- package/packages/core/src/session/message-identity.ts +272 -0
- package/packages/core/src/session/project-messages.ts +908 -0
- package/packages/core/src/session/projection-cache.ts +254 -0
- package/packages/core/src/session/prune.ts +153 -0
- package/packages/core/src/session/run-record-store.ts +307 -0
- package/packages/core/src/session/session-index.ts +158 -0
- package/packages/core/src/session/session-log-dir.ts +39 -0
- package/packages/core/src/session/session-store.ts +266 -0
- package/packages/core/src/session/sqlite-backend.ts +391 -0
- package/packages/core/src/socket-inherit-guard.ts +188 -0
- package/packages/core/src/storage/metadata-sidecar.ts +124 -0
- package/packages/core/src/tenant/index.ts +13 -0
- package/packages/core/src/tenant/resolve-tenant.ts +19 -0
- package/packages/core/src/tenant/tenant-paths.ts +83 -0
- package/packages/core/src/timeline/archive-audit.ts +316 -0
- package/packages/core/src/timeline/archive-lock.ts +124 -0
- package/packages/core/src/timeline/blocks.ts +1639 -0
- package/packages/core/src/timeline/enum-stats.ts +34 -0
- package/packages/core/src/timeline/holes.ts +431 -0
- package/packages/core/src/timeline/index.ts +387 -0
- package/packages/core/src/timeline/legacy-format.ts +97 -0
- package/packages/core/src/timeline/read-port.ts +582 -0
- package/packages/core/src/timeline/types.ts +371 -0
- package/packages/core/src/timeline/wal.ts +2485 -0
- package/packages/core/src/timeline/writer.ts +2079 -0
- package/packages/core/src/timeout.ts +93 -0
- package/packages/core/src/transport/in-process.ts +86 -0
- package/packages/core/src/transport/index.ts +6 -0
- package/packages/core/src/types/context.ts +229 -0
- package/packages/core/src/types/env-cadence.ts +35 -0
- package/packages/core/src/types/error-registry.ts +343 -0
- package/packages/core/src/types/error.ts +107 -0
- package/packages/core/src/types/event.ts +496 -0
- package/packages/core/src/types/guardrail.ts +35 -0
- package/packages/core/src/types/hook.ts +122 -0
- package/packages/core/src/types/index.ts +28 -0
- package/packages/core/src/types/lease.ts +91 -0
- package/packages/core/src/types/limits.ts +112 -0
- package/packages/core/src/types/logging.ts +54 -0
- package/packages/core/src/types/member-port.ts +194 -0
- package/packages/core/src/types/plugin.ts +392 -0
- package/packages/core/src/types/projection-cache.ts +80 -0
- package/packages/core/src/types/projection.ts +100 -0
- package/packages/core/src/types/provider.ts +319 -0
- package/packages/core/src/types/run-journal.ts +178 -0
- package/packages/core/src/types/run-record-store.ts +128 -0
- package/packages/core/src/types/run.ts +140 -0
- package/packages/core/src/types/session.ts +328 -0
- package/packages/core/src/types/source-module.ts +68 -0
- package/packages/core/src/types/tenant.ts +41 -0
- package/packages/core/src/types/tool-name.ts +57 -0
- package/packages/core/src/types/tool.ts +122 -0
- package/packages/core/src/types/trace.ts +38 -0
- package/packages/core/src/types/vision.ts +219 -0
- package/packages/core/src/vision/blobs.ts +328 -0
- package/packages/core/src/vision/index.ts +73 -0
- package/packages/core/src/vision/ingest.ts +126 -0
- package/packages/core/src/vision/notice.ts +58 -0
- package/packages/core/src/vision/plan.ts +358 -0
- package/packages/core/src/vision/staging.ts +81 -0
- package/packages/core/tsconfig.json +8 -0
- package/packages/permission/package.json +31 -0
- package/packages/permission/src/index.ts +60 -0
- package/packages/plugin-sdk/package.json +21 -0
- package/packages/plugin-sdk/src/index.ts +478 -0
- package/packages/plugin-sdk/src/semver.ts +154 -0
- package/packages/plugin-ui/package.json +33 -0
- package/packages/plugin-ui/src/Badge.tsx +41 -0
- package/packages/plugin-ui/src/Button.tsx +84 -0
- package/packages/plugin-ui/src/ComposerAttachments.tsx +87 -0
- package/packages/plugin-ui/src/ComposerContextMeter.tsx +209 -0
- package/packages/plugin-ui/src/ComposerToolbar.tsx +233 -0
- package/packages/plugin-ui/src/CountBadge.tsx +57 -0
- package/packages/plugin-ui/src/DataTable.tsx +168 -0
- package/packages/plugin-ui/src/Field.tsx +543 -0
- package/packages/plugin-ui/src/KeyValueList.tsx +32 -0
- package/packages/plugin-ui/src/Page.tsx +39 -0
- package/packages/plugin-ui/src/Pager.tsx +63 -0
- package/packages/plugin-ui/src/SearchInput.tsx +33 -0
- package/packages/plugin-ui/src/Section.tsx +47 -0
- package/packages/plugin-ui/src/Stat.tsx +25 -0
- package/packages/plugin-ui/src/TableToolbar.tsx +27 -0
- package/packages/plugin-ui/src/Tabs.tsx +77 -0
- package/packages/plugin-ui/src/card-surface.ts +11 -0
- package/packages/plugin-ui/src/cn.ts +7 -0
- package/packages/plugin-ui/src/dom-globals.d.ts +124 -0
- package/packages/plugin-ui/src/host.ts +270 -0
- package/packages/plugin-ui/src/index.ts +26 -0
- package/packages/plugin-ui/src/styles.css +386 -0
- package/packages/plugin-ui/src/useStaleWhileRevalidate.ts +211 -0
- package/packages/serve/package.json +32 -0
- package/packages/serve/src/agent-control.ts +595 -0
- package/packages/serve/src/agents-registry.ts +409 -0
- package/packages/serve/src/auth/avatar.ts +352 -0
- package/packages/serve/src/auth/bootstrap.ts +184 -0
- package/packages/serve/src/auth/credentials.ts +275 -0
- package/packages/serve/src/auth/github-oauth.ts +33 -0
- package/packages/serve/src/auth/index.ts +121 -0
- package/packages/serve/src/auth/oauth.ts +394 -0
- package/packages/serve/src/auth/origins.ts +145 -0
- package/packages/serve/src/auth/password.ts +187 -0
- package/packages/serve/src/auth/ratelimit.ts +249 -0
- package/packages/serve/src/auth/routes.ts +1757 -0
- package/packages/serve/src/auth/session.ts +407 -0
- package/packages/serve/src/auth/totp.ts +183 -0
- package/packages/serve/src/backpressure.ts +91 -0
- package/packages/serve/src/durable.ts +216 -0
- package/packages/serve/src/evals.ts +140 -0
- package/packages/serve/src/event-buffer.ts +92 -0
- package/packages/serve/src/event-summary.ts +11 -0
- package/packages/serve/src/federation.ts +1100 -0
- package/packages/serve/src/feishu.ts +51 -0
- package/packages/serve/src/gateway/auth.ts +773 -0
- package/packages/serve/src/gateway/errors.ts +21 -0
- package/packages/serve/src/gateway/frames.ts +195 -0
- package/packages/serve/src/gateway/methods/admin.ts +530 -0
- package/packages/serve/src/gateway/methods/agents.ts +1727 -0
- package/packages/serve/src/gateway/methods/attachments.ts +354 -0
- package/packages/serve/src/gateway/methods/common.ts +50 -0
- package/packages/serve/src/gateway/methods/config.ts +883 -0
- package/packages/serve/src/gateway/methods/evals.ts +87 -0
- package/packages/serve/src/gateway/methods/feishu.ts +52 -0
- package/packages/serve/src/gateway/methods/fleet.ts +225 -0
- package/packages/serve/src/gateway/methods/images.ts +196 -0
- package/packages/serve/src/gateway/methods/interactions.ts +721 -0
- package/packages/serve/src/gateway/methods/jobs.ts +148 -0
- package/packages/serve/src/gateway/methods/kanban.ts +637 -0
- package/packages/serve/src/gateway/methods/mcp.ts +82 -0
- package/packages/serve/src/gateway/methods/observability.ts +264 -0
- package/packages/serve/src/gateway/methods/permissions.ts +397 -0
- package/packages/serve/src/gateway/methods/rpc-namespaces.ts +80 -0
- package/packages/serve/src/gateway/methods/runs.ts +434 -0
- package/packages/serve/src/gateway/methods/schemas.ts +1196 -0
- package/packages/serve/src/gateway/methods/sessions.ts +2568 -0
- package/packages/serve/src/gateway/methods/subscription.ts +515 -0
- package/packages/serve/src/gateway/methods/teams.ts +638 -0
- package/packages/serve/src/gateway/sse.ts +130 -0
- package/packages/serve/src/gateway/static.ts +66 -0
- package/packages/serve/src/gateway/timeline-protocol.ts +532 -0
- package/packages/serve/src/gateway.ts +4974 -0
- package/packages/serve/src/hub-control.ts +86 -0
- package/packages/serve/src/hub-frames.ts +435 -0
- package/packages/serve/src/hub-protocol.ts +182 -0
- package/packages/serve/src/index.ts +511 -0
- package/packages/serve/src/interactions-registry.ts +1362 -0
- package/packages/serve/src/interactions-store.ts +360 -0
- package/packages/serve/src/local.ts +48 -0
- package/packages/serve/src/log-event.ts +57 -0
- package/packages/serve/src/mcp.ts +73 -0
- package/packages/serve/src/metrics.ts +137 -0
- package/packages/serve/src/platform/auth.ts +146 -0
- package/packages/serve/src/platform/index.ts +54 -0
- package/packages/serve/src/platform/listen-guard.ts +68 -0
- package/packages/serve/src/platform/metrics.ts +123 -0
- package/packages/serve/src/platform/proxy-config.ts +368 -0
- package/packages/serve/src/platform/proxy-ws.ts +737 -0
- package/packages/serve/src/platform/proxy.ts +909 -0
- package/packages/serve/src/platform/registry.ts +130 -0
- package/packages/serve/src/platform/rpc.ts +445 -0
- package/packages/serve/src/platform/server.ts +1148 -0
- package/packages/serve/src/platform/types.ts +276 -0
- package/packages/serve/src/plugin-host/catalog.ts +212 -0
- package/packages/serve/src/plugin-host/child.ts +767 -0
- package/packages/serve/src/plugin-host/dto.ts +191 -0
- package/packages/serve/src/plugin-host/errors.ts +50 -0
- package/packages/serve/src/plugin-host/events.ts +114 -0
- package/packages/serve/src/plugin-host/expose.ts +142 -0
- package/packages/serve/src/plugin-host/http.ts +823 -0
- package/packages/serve/src/plugin-host/index.ts +170 -0
- package/packages/serve/src/plugin-host/manager.ts +2027 -0
- package/packages/serve/src/plugin-host/ndjson.ts +136 -0
- package/packages/serve/src/plugin-host/proxy.ts +358 -0
- package/packages/serve/src/plugin-host/registry.ts +208 -0
- package/packages/serve/src/plugin-host/static.ts +162 -0
- package/packages/serve/src/plugin-host/types.ts +529 -0
- package/packages/serve/src/plugin-host/ws-proxy.ts +431 -0
- package/packages/serve/src/prometheus.ts +98 -0
- package/packages/serve/src/protocol.ts +332 -0
- package/packages/serve/src/replay-budget.ts +481 -0
- package/packages/serve/src/rpc.ts +614 -0
- package/packages/serve/src/run-control.ts +106 -0
- package/packages/serve/src/session-search.ts +142 -0
- package/packages/serve/src/shutdown-step.ts +128 -0
- package/packages/serve/src/team-control.ts +282 -0
- package/packages/serve/src/tenant-event-hub.ts +194 -0
- package/packages/serve/src/tenant.ts +169 -0
- package/packages/serve/src/tool-events.ts +244 -0
- package/packages/tui/package.json +40 -0
- package/packages/tui/src/commands/agents-command.ts +402 -0
- package/packages/tui/src/commands/capabilities-command.ts +356 -0
- package/packages/tui/src/commands/commands.ts +1361 -0
- package/packages/tui/src/commands/config-command.ts +541 -0
- package/packages/tui/src/commands/context-command.ts +348 -0
- package/packages/tui/src/commands/cost-command.ts +66 -0
- package/packages/tui/src/commands/details-command.ts +47 -0
- package/packages/tui/src/commands/errors-command.ts +205 -0
- package/packages/tui/src/commands/export-command.ts +193 -0
- package/packages/tui/src/commands/feishu-command.ts +101 -0
- package/packages/tui/src/commands/mcp-command.ts +319 -0
- package/packages/tui/src/commands/metrics-command.ts +314 -0
- package/packages/tui/src/commands/permissions-command.ts +117 -0
- package/packages/tui/src/commands/runs-command.ts +421 -0
- package/packages/tui/src/commands/sessions-command.ts +367 -0
- package/packages/tui/src/commands/settings-command.ts +180 -0
- package/packages/tui/src/commands/status-command.ts +30 -0
- package/packages/tui/src/commands/trace-command.ts +382 -0
- package/packages/tui/src/components/AskUserDialog.tsx +663 -0
- package/packages/tui/src/components/BottomBar.tsx +44 -0
- package/packages/tui/src/components/ConfirmDialog.tsx +175 -0
- package/packages/tui/src/components/DataTable.tsx +99 -0
- package/packages/tui/src/components/DetailPanel.tsx +80 -0
- package/packages/tui/src/components/EmptyState.tsx +27 -0
- package/packages/tui/src/components/InlineAutocomplete.tsx +319 -0
- package/packages/tui/src/components/InteractiveViewHost.tsx +652 -0
- package/packages/tui/src/components/KeyHints.tsx +41 -0
- package/packages/tui/src/components/Markdown.tsx +489 -0
- package/packages/tui/src/components/PanelFrame.tsx +113 -0
- package/packages/tui/src/components/QueuePreview.tsx +113 -0
- package/packages/tui/src/components/QuickHelp.tsx +91 -0
- package/packages/tui/src/components/ReasoningBlock.tsx +42 -0
- package/packages/tui/src/components/SessionTable.tsx +523 -0
- package/packages/tui/src/components/SpinnerWithVerb.tsx +116 -0
- package/packages/tui/src/components/StateTracker.ts +102 -0
- package/packages/tui/src/components/StatusBar.tsx +315 -0
- package/packages/tui/src/components/StreamOutput.tsx +302 -0
- package/packages/tui/src/components/SubagentActivity.tsx +57 -0
- package/packages/tui/src/components/TextViewer.tsx +100 -0
- package/packages/tui/src/components/ToolDisplay.tsx +248 -0
- package/packages/tui/src/components/ToolTrail.tsx +104 -0
- package/packages/tui/src/components/UiItemView.tsx +460 -0
- package/packages/tui/src/components/UpdateBanner.tsx +48 -0
- package/packages/tui/src/components/indicator.ts +61 -0
- package/packages/tui/src/error-classifier.ts +255 -0
- package/packages/tui/src/i18n/index.ts +67 -0
- package/packages/tui/src/i18n/messages/en.ts +543 -0
- package/packages/tui/src/i18n/messages/zh-CN.ts +528 -0
- package/packages/tui/src/index.ts +335 -0
- package/packages/tui/src/renderer/ask-user.ts +431 -0
- package/packages/tui/src/renderer/notify-user.ts +184 -0
- package/packages/tui/src/renderer/stream-renderer.ts +149 -0
- package/packages/tui/src/renderer/tool-confirm.ts +47 -0
- package/packages/tui/src/repl/agent-registry.ts +747 -0
- package/packages/tui/src/repl/cache-metrics.ts +241 -0
- package/packages/tui/src/repl/clear-on-start.ts +28 -0
- package/packages/tui/src/repl/error-archive.ts +95 -0
- package/packages/tui/src/repl/error-log.ts +212 -0
- package/packages/tui/src/repl/ink-repl.tsx +1735 -0
- package/packages/tui/src/repl/layout.ts +303 -0
- package/packages/tui/src/repl/limit-info.ts +630 -0
- package/packages/tui/src/repl/permission-pending.ts +49 -0
- package/packages/tui/src/repl/project/ui-item.ts +1307 -0
- package/packages/tui/src/repl/queue-info.ts +109 -0
- package/packages/tui/src/repl/resume-picker.ts +24 -0
- package/packages/tui/src/repl/run-turn.ts +60 -0
- package/packages/tui/src/repl/runtime-counters.ts +91 -0
- package/packages/tui/src/repl/startup-header.ts +144 -0
- package/packages/tui/src/repl/startup-notice.ts +100 -0
- package/packages/tui/src/repl/status-format.ts +513 -0
- package/packages/tui/src/repl/status-metrics.ts +88 -0
- package/packages/tui/src/repl/status-snapshot.ts +454 -0
- package/packages/tui/src/repl/use-repl-state.ts +548 -0
- package/packages/tui/src/repl-context.ts +349 -0
- package/packages/tui/src/rich-renderer.ts +63 -0
- package/packages/tui/src/rpc-events.ts +161 -0
- package/packages/tui/src/rpc.ts +149 -0
- package/packages/tui/src/theme.ts +180 -0
- package/packages/tui/src/types/events.ts +284 -0
- package/packages/tui/src/utils/dialog.ts +35 -0
- package/packages/tui/src/utils/diff.ts +124 -0
- package/packages/tui/src/utils/display-labels.ts +56 -0
- package/packages/tui/src/utils/file-reference.ts +180 -0
- package/packages/tui/src/utils/git.ts +24 -0
- package/packages/tui/src/utils/sanitize-terminal-text.ts +109 -0
- package/packages/tui/src/utils/text-layout.ts +127 -0
- package/packages/tui/src/utils/time.ts +25 -0
- package/packages/tui/src/utils/tool-input-summary.ts +70 -0
- package/packages/tui/src/views/keys.ts +344 -0
- package/packages/tui/src/views/layout.ts +224 -0
- package/packages/tui/src/views/render-text.ts +154 -0
- package/packages/tui/src/views/selection.ts +57 -0
- package/packages/tui/src/views/session-picker.ts +215 -0
- package/packages/tui/src/views/tones.ts +24 -0
- package/packages/tui/src/views/types.ts +200 -0
- package/packages/tui/src/wizard/setup-wizard.ts +439 -0
- package/packages/tui/tsconfig.json +10 -0
- package/plugins/context/doc-subscription/package.json +32 -0
- package/plugins/context/doc-subscription/src/agent.ts +151 -0
- package/plugins/context/doc-subscription/src/auto-sub.ts +80 -0
- package/plugins/context/doc-subscription/src/config.ts +358 -0
- package/plugins/context/doc-subscription/src/diff.ts +107 -0
- package/plugins/context/doc-subscription/src/friend-edges.ts +118 -0
- package/plugins/context/doc-subscription/src/health.ts +163 -0
- package/plugins/context/doc-subscription/src/hook.ts +1222 -0
- package/plugins/context/doc-subscription/src/implicit.ts +84 -0
- package/plugins/context/doc-subscription/src/index.ts +288 -0
- package/plugins/context/doc-subscription/src/lifecycle-listener.ts +58 -0
- package/plugins/context/doc-subscription/src/lifecycle.ts +186 -0
- package/plugins/context/doc-subscription/src/mute.ts +39 -0
- package/plugins/context/doc-subscription/src/notice.ts +347 -0
- package/plugins/context/doc-subscription/src/script.ts +288 -0
- package/plugins/context/doc-subscription/src/sources.ts +187 -0
- package/plugins/context/doc-subscription/src/store.ts +748 -0
- package/plugins/context/doc-subscription/src/team-log.ts +155 -0
- package/plugins/context/doc-subscription/src/tool.ts +2132 -0
- package/plugins/context/skills/package.json +182 -0
- package/plugins/context/skills/src/config.ts +178 -0
- package/plugins/context/skills/src/frontmatter.ts +166 -0
- package/plugins/context/skills/src/index.ts +144 -0
- package/plugins/context/skills/src/rpc.ts +274 -0
- package/plugins/context/skills/src/scanner.ts +262 -0
- package/plugins/context/skills/src/service.ts +277 -0
- package/plugins/context/skills/src/store.ts +333 -0
- package/plugins/context/skills/src/tool.ts +354 -0
- package/plugins/context/skills/src/trust.ts +71 -0
- package/plugins/context/skills/src/types.ts +130 -0
- package/plugins/context/skills/src/watch.ts +83 -0
- package/plugins/context/skills/tsconfig.web.json +29 -0
- package/plugins/context/skills/vite.config.embed.ts +107 -0
- package/plugins/context/skills/vite.config.ts +121 -0
- package/plugins/context/skills/web/assets/skills-8su2cNqF.css +2 -0
- package/plugins/context/skills/web/assets/skills-BhiDTAac.js +10 -0
- package/plugins/context/skills/web/embed/index.css +3 -0
- package/plugins/context/skills/web/embed/index.mjs +4251 -0
- package/plugins/context/skills/web/skills.html +13 -0
- package/plugins/context/skills/web-src/App.tsx +47 -0
- package/plugins/context/skills/web-src/SkillsView.tsx +649 -0
- package/plugins/context/skills/web-src/embed.css +153 -0
- package/plugins/context/skills/web-src/embed.tsx +36 -0
- package/plugins/context/skills/web-src/env.d.ts +2 -0
- package/plugins/context/skills/web-src/i18n.ts +195 -0
- package/plugins/context/skills/web-src/main.tsx +14 -0
- package/plugins/context/skills/web-src/shared.tsx +226 -0
- package/plugins/context/skills/web-src/skills.html +12 -0
- package/plugins/context/skills/web-src/styles.css +62 -0
- package/plugins/context/skills/web-src/types.ts +85 -0
- package/plugins/context/thinking-intensity/package.json +201 -0
- package/plugins/context/thinking-intensity/src/index.ts +285 -0
- package/plugins/context/thinking-intensity/src/mapping.ts +175 -0
- package/plugins/context/thinking-intensity/src/state.ts +134 -0
- package/plugins/evals/harness/package.json +32 -0
- package/plugins/evals/harness/src/assertions.ts +99 -0
- package/plugins/evals/harness/src/errors.ts +23 -0
- package/plugins/evals/harness/src/index.ts +48 -0
- package/plugins/evals/harness/src/mock-provider.ts +64 -0
- package/plugins/evals/harness/src/plugin.ts +48 -0
- package/plugins/evals/harness/src/report.ts +66 -0
- package/plugins/evals/harness/src/runner.ts +417 -0
- package/plugins/evals/harness/src/suite.ts +352 -0
- package/plugins/evals/harness/src/types.ts +154 -0
- package/plugins/fleet/compose/README.md +40 -0
- package/plugins/fleet/compose/package.json +172 -0
- package/plugins/fleet/compose/src/cli.ts +347 -0
- package/plugins/fleet/compose/src/i18n.ts +99 -0
- package/plugins/fleet/compose/src/index.ts +3 -0
- package/plugins/fleet/compose/src/manifest.ts +194 -0
- package/plugins/im/feishu/FEISHU.md +142 -0
- package/plugins/im/feishu/package.json +33 -0
- package/plugins/im/feishu/src/channel.ts +360 -0
- package/plugins/im/feishu/src/config.ts +133 -0
- package/plugins/im/feishu/src/dedupe.ts +30 -0
- package/plugins/im/feishu/src/errors.ts +21 -0
- package/plugins/im/feishu/src/index.ts +47 -0
- package/plugins/im/feishu/src/messages.ts +41 -0
- package/plugins/im/feishu/src/queue.ts +71 -0
- package/plugins/im/feishu/src/runner.ts +356 -0
- package/plugins/im/feishu/src/sdk-transport.ts +220 -0
- package/plugins/im/feishu/src/text.ts +56 -0
- package/plugins/im/feishu/src/types.ts +150 -0
- package/plugins/marketplace/marketplace/package.json +166 -0
- package/plugins/marketplace/marketplace/registry-template/README.md +105 -0
- package/plugins/marketplace/marketplace/registry-template/index.sample.json +71 -0
- package/plugins/marketplace/marketplace/registry-template/validate.mjs +272 -0
- package/plugins/marketplace/marketplace/registry-template/validate.yml +35 -0
- package/plugins/marketplace/marketplace/src/config-lock.ts +325 -0
- package/plugins/marketplace/marketplace/src/config.ts +432 -0
- package/plugins/marketplace/marketplace/src/errors.ts +79 -0
- package/plugins/marketplace/marketplace/src/index.ts +364 -0
- package/plugins/marketplace/marketplace/src/install.ts +930 -0
- package/plugins/marketplace/marketplace/src/jobs.ts +155 -0
- package/plugins/marketplace/marketplace/src/registry.ts +508 -0
- package/plugins/marketplace/marketplace/src/semver.ts +162 -0
- package/plugins/marketplace/marketplace/src/settings.ts +108 -0
- package/plugins/marketplace/marketplace/src/tar.ts +269 -0
- package/plugins/marketplace/marketplace/tsconfig.ui.json +26 -0
- package/plugins/marketplace/marketplace/vite.config.ts +107 -0
- package/plugins/marketplace/marketplace/web/assets/index-B2V7bx73.css +2 -0
- package/plugins/marketplace/marketplace/web/assets/index-B4NAz59m.js +13 -0
- package/plugins/marketplace/marketplace/web/index.html +13 -0
- package/plugins/marketplace/marketplace/web-src/App.tsx +193 -0
- package/plugins/marketplace/marketplace/web-src/api.ts +153 -0
- package/plugins/marketplace/marketplace/web-src/catalog.ts +27 -0
- package/plugins/marketplace/marketplace/web-src/components/ConfirmDialog.tsx +96 -0
- package/plugins/marketplace/marketplace/web-src/components/InstalledTable.tsx +152 -0
- package/plugins/marketplace/marketplace/web-src/components/JobStatus.tsx +70 -0
- package/plugins/marketplace/marketplace/web-src/components/Permissions.tsx +116 -0
- package/plugins/marketplace/marketplace/web-src/components/RegistryBanners.tsx +22 -0
- package/plugins/marketplace/marketplace/web-src/components/RegistrySetup.tsx +69 -0
- package/plugins/marketplace/marketplace/web-src/components/States.tsx +97 -0
- package/plugins/marketplace/marketplace/web-src/i18n.ts +337 -0
- package/plugins/marketplace/marketplace/web-src/index.html +12 -0
- package/plugins/marketplace/marketplace/web-src/main.tsx +17 -0
- package/plugins/marketplace/marketplace/web-src/styles.css +37 -0
- package/plugins/marketplace/marketplace/web-src/types.ts +175 -0
- package/plugins/marketplace/marketplace/web-src/views/InstalledView.tsx +150 -0
- package/plugins/marketplace/marketplace/web-src/views/MarketplaceView.tsx +479 -0
- package/plugins/marketplace/marketplace/web-src/views/UpdatesView.tsx +207 -0
- package/plugins/marketplace/marketplace/web-src/vite-env.d.ts +1 -0
- package/plugins/mcp/client/package.json +31 -0
- package/plugins/mcp/client/src/config-validate.ts +37 -0
- package/plugins/mcp/client/src/http-transport.ts +369 -0
- package/plugins/mcp/client/src/index.ts +35 -0
- package/plugins/mcp/client/src/json-rpc.ts +104 -0
- package/plugins/mcp/client/src/logging.ts +51 -0
- package/plugins/mcp/client/src/naming.ts +36 -0
- package/plugins/mcp/client/src/plugin.ts +310 -0
- package/plugins/mcp/client/src/registration.ts +143 -0
- package/plugins/mcp/client/src/server-connection.ts +556 -0
- package/plugins/mcp/client/src/stdio-transport.ts +377 -0
- package/plugins/mcp/client/src/transport.ts +11 -0
- package/plugins/mcp/client/src/types.ts +147 -0
- package/plugins/media/media/package.json +33 -0
- package/plugins/media/media/src/binaries.ts +88 -0
- package/plugins/media/media/src/config.ts +184 -0
- package/plugins/media/media/src/exec.ts +172 -0
- package/plugins/media/media/src/index.ts +125 -0
- package/plugins/media/media/src/tool.ts +640 -0
- package/plugins/observability/hook-logging/package.json +31 -0
- package/plugins/observability/hook-logging/src/index.ts +286 -0
- package/plugins/observability/usage/package.json +163 -0
- package/plugins/observability/usage/src/aggregate.ts +919 -0
- package/plugins/observability/usage/src/index.ts +362 -0
- package/plugins/observability/usage/src/query.ts +322 -0
- package/plugins/observability/usage/src/store.ts +1455 -0
- package/plugins/observability/usage/src/worker-client.ts +263 -0
- package/plugins/observability/usage/src/worker.ts +87 -0
- package/plugins/observability/usage/tsconfig.web.json +29 -0
- package/plugins/observability/usage/vite.config.embed.ts +105 -0
- package/plugins/observability/usage/vite.config.ts +121 -0
- package/plugins/observability/usage/web/assets/main-DD4g5VDL.css +2 -0
- package/plugins/observability/usage/web/assets/main-DVmWaf73.js +10 -0
- package/plugins/observability/usage/web/embed/index.css +3 -0
- package/plugins/observability/usage/web/embed/index.mjs +4560 -0
- package/plugins/observability/usage/web/logs.html +13 -0
- package/plugins/observability/usage/web/usage.html +13 -0
- package/plugins/observability/usage/web-src/App.tsx +54 -0
- package/plugins/observability/usage/web-src/LogsView.tsx +505 -0
- package/plugins/observability/usage/web-src/ModelTable.tsx +102 -0
- package/plugins/observability/usage/web-src/UsageView.tsx +210 -0
- package/plugins/observability/usage/web-src/embed.css +96 -0
- package/plugins/observability/usage/web-src/embed.tsx +75 -0
- package/plugins/observability/usage/web-src/env.d.ts +2 -0
- package/plugins/observability/usage/web-src/format.ts +88 -0
- package/plugins/observability/usage/web-src/i18n.ts +261 -0
- package/plugins/observability/usage/web-src/logs.html +12 -0
- package/plugins/observability/usage/web-src/main.tsx +19 -0
- package/plugins/observability/usage/web-src/shared.tsx +187 -0
- package/plugins/observability/usage/web-src/styles.css +22 -0
- package/plugins/observability/usage/web-src/usage.html +12 -0
- package/plugins/provider/anthropic/package.json +31 -0
- package/plugins/provider/anthropic/src/index.ts +75 -0
- package/plugins/provider/anthropic/src/retry.ts +266 -0
- package/plugins/provider/anthropic/src/timeout.ts +84 -0
- package/plugins/provider/model-registry/package.json +167 -0
- package/plugins/provider/model-registry/src/connectivity.ts +123 -0
- package/plugins/provider/model-registry/src/credential-store.ts +219 -0
- package/plugins/provider/model-registry/src/index.ts +453 -0
- package/plugins/provider/model-registry/src/registry-store.ts +223 -0
- package/plugins/provider/model-registry/tsconfig.web.json +29 -0
- package/plugins/provider/model-registry/vite.config.embed.ts +105 -0
- package/plugins/provider/model-registry/vite.config.ts +122 -0
- package/plugins/provider/model-registry/web/assets/main-BofPzD0n.js +10 -0
- package/plugins/provider/model-registry/web/assets/main-DkpGgdsZ.css +2 -0
- package/plugins/provider/model-registry/web/credentials.html +13 -0
- package/plugins/provider/model-registry/web/embed/index.css +3 -0
- package/plugins/provider/model-registry/web/embed/index.mjs +4887 -0
- package/plugins/provider/model-registry/web/models.html +13 -0
- package/plugins/provider/model-registry/web-src/App.tsx +54 -0
- package/plugins/provider/model-registry/web-src/CredentialsView.tsx +357 -0
- package/plugins/provider/model-registry/web-src/ModelForm.tsx +489 -0
- package/plugins/provider/model-registry/web-src/ModelsView.tsx +383 -0
- package/plugins/provider/model-registry/web-src/credentials.html +12 -0
- package/plugins/provider/model-registry/web-src/embed.css +96 -0
- package/plugins/provider/model-registry/web-src/embed.tsx +43 -0
- package/plugins/provider/model-registry/web-src/env.d.ts +2 -0
- package/plugins/provider/model-registry/web-src/i18n.ts +323 -0
- package/plugins/provider/model-registry/web-src/main.tsx +21 -0
- package/plugins/provider/model-registry/web-src/models.html +12 -0
- package/plugins/provider/model-registry/web-src/shared.tsx +147 -0
- package/plugins/provider/model-registry/web-src/styles.css +22 -0
- package/plugins/provider/model-registry/web-src/types.ts +120 -0
- package/plugins/provider/openai/package.json +31 -0
- package/plugins/provider/openai/src/index.ts +104 -0
- package/plugins/provider/openai/src/retry.ts +266 -0
- package/plugins/provider/openai/src/timeout.ts +84 -0
- package/plugins/provider/openai/src/vision.ts +121 -0
- package/plugins/security/guardrail-pii/package.json +31 -0
- package/plugins/security/guardrail-pii/src/index.ts +285 -0
- package/plugins/security/guardrail-pii/src/rules.ts +197 -0
- package/plugins/security/redact-secrets/package.json +31 -0
- package/plugins/security/redact-secrets/src/index.ts +145 -0
- package/plugins/security/redact-secrets/src/redactor.ts +83 -0
- package/plugins/security/redact-secrets/src/rules.ts +137 -0
- package/plugins/security/tool-policy/package.json +31 -0
- package/plugins/security/tool-policy/src/index.ts +184 -0
- package/plugins/tools/basic-tools/package.json +32 -0
- package/plugins/tools/basic-tools/src/background-jobs.ts +356 -0
- package/plugins/tools/basic-tools/src/bash-source.ts +58 -0
- package/plugins/tools/basic-tools/src/call-scope.ts +80 -0
- package/plugins/tools/basic-tools/src/config.ts +130 -0
- package/plugins/tools/basic-tools/src/index.ts +202 -0
- package/plugins/tools/basic-tools/src/path-boundary.ts +258 -0
- package/plugins/tools/basic-tools/src/shared.ts +221 -0
- package/plugins/tools/basic-tools/src/text.ts +49 -0
- package/plugins/tools/basic-tools/src/tools/bash-async.ts +1830 -0
- package/plugins/tools/basic-tools/src/tools/bash-exec.ts +567 -0
- package/plugins/tools/basic-tools/src/tools/bash.ts +300 -0
- package/plugins/tools/basic-tools/src/tools/edit.ts +160 -0
- package/plugins/tools/basic-tools/src/tools/grep.ts +601 -0
- package/plugins/tools/basic-tools/src/tools/read.ts +151 -0
- package/plugins/tools/basic-tools/src/tools/write.ts +494 -0
- package/plugins/tools/basic-tools/src/write-coord.ts +291 -0
- package/plugins/tools/basic-tools/src/write-lock.ts +353 -0
- package/plugins/tools/engine-client/package.json +34 -0
- package/plugins/tools/engine-client/src/client.ts +276 -0
- package/plugins/tools/engine-client/src/forward.ts +164 -0
- package/plugins/tools/engine-client/src/index.ts +18 -0
- package/plugins/tools/engine-client/src/pending.ts +101 -0
- package/plugins/tools/engine-client/src/pool.ts +1173 -0
- package/plugins/tools/engine-client/src/protocol.ts +249 -0
- package/plugins/tools/engine-client/src/registry.ts +138 -0
- package/plugins/tools/file-refs/README.md +68 -0
- package/plugins/tools/file-refs/package.json +135 -0
- package/plugins/tools/file-refs/src/index.ts +24 -0
- package/plugins/tools/file-refs/tsconfig.web.json +27 -0
- package/plugins/tools/file-refs/vite.config.embed.ts +88 -0
- package/plugins/tools/file-refs/web/embed/index.css +3 -0
- package/plugins/tools/file-refs/web/embed/index.mjs +879 -0
- package/plugins/tools/file-refs/web-src/AttachSheet.tsx +613 -0
- package/plugins/tools/file-refs/web-src/FileRefCard.tsx +206 -0
- package/plugins/tools/file-refs/web-src/FileRefLinkCard.tsx +90 -0
- package/plugins/tools/file-refs/web-src/attach-handler.tsx +116 -0
- package/plugins/tools/file-refs/web-src/attach-paths.ts +69 -0
- package/plugins/tools/file-refs/web-src/drop-handler.ts +15 -0
- package/plugins/tools/file-refs/web-src/embed.css +518 -0
- package/plugins/tools/file-refs/web-src/embed.tsx +18 -0
- package/plugins/tools/file-refs/web-src/env.d.ts +2 -0
- package/plugins/tools/file-refs/web-src/i18n.ts +137 -0
- package/plugins/tools/file-refs/web-src/icons.tsx +122 -0
- package/plugins/tools/file-refs/web-src/staging.ts +120 -0
- package/plugins/tools/file-refs/web-src/thumbnail.tsx +36 -0
- package/plugins/tools/recall/package.json +31 -0
- package/plugins/tools/recall/src/config.ts +74 -0
- package/plugins/tools/recall/src/index.ts +151 -0
- package/plugins/tools/recall/src/tool.ts +307 -0
- package/plugins/tools/web-tools/README.md +330 -0
- package/plugins/tools/web-tools/package.json +184 -0
- package/plugins/tools/web-tools/src/backends.ts +61 -0
- package/plugins/tools/web-tools/src/budget.ts +80 -0
- package/plugins/tools/web-tools/src/cache.ts +94 -0
- package/plugins/tools/web-tools/src/config.ts +412 -0
- package/plugins/tools/web-tools/src/deepseek-client.ts +406 -0
- package/plugins/tools/web-tools/src/deepseek-fetch.ts +168 -0
- package/plugins/tools/web-tools/src/extract.ts +373 -0
- package/plugins/tools/web-tools/src/fetch/local.ts +36 -0
- package/plugins/tools/web-tools/src/fetch/provider.ts +56 -0
- package/plugins/tools/web-tools/src/http.ts +415 -0
- package/plugins/tools/web-tools/src/index.ts +649 -0
- package/plugins/tools/web-tools/src/limits.ts +388 -0
- package/plugins/tools/web-tools/src/provider-http.ts +102 -0
- package/plugins/tools/web-tools/src/render.ts +248 -0
- package/plugins/tools/web-tools/src/robots.ts +187 -0
- package/plugins/tools/web-tools/src/search/custom.ts +595 -0
- package/plugins/tools/web-tools/src/search/deepseek.ts +111 -0
- package/plugins/tools/web-tools/src/search/index.ts +725 -0
- package/plugins/tools/web-tools/src/search/provider.ts +200 -0
- package/plugins/tools/web-tools/src/search/serper.ts +157 -0
- package/plugins/tools/web-tools/src/search/tavily.ts +146 -0
- package/plugins/tools/web-tools/src/secrets.ts +87 -0
- package/plugins/tools/web-tools/src/ssrf.ts +287 -0
- package/plugins/tools/web-tools/src/types.ts +137 -0
- package/skills/code-writing.md +33 -0
- package/src/agent/agent-control.ts +409 -0
- package/src/agent/agent-owner-client.ts +150 -0
- package/src/agent/agent-owner-server.ts +689 -0
- package/src/agent/agent-service-wiring.ts +675 -0
- package/src/agent/agent-wiring.ts +48 -0
- package/src/agent/ask-answer-delivery.ts +215 -0
- package/src/agent/local-run-adapter.ts +335 -0
- package/src/agent/peer-notices.ts +459 -0
- package/src/agent/peer-source.ts +63 -0
- package/src/agent/self-card.ts +52 -0
- package/src/agent/team-human-delivery.ts +144 -0
- package/src/assembly/collect.ts +161 -0
- package/src/assembly/feature.ts +133 -0
- package/src/assembly/features/attachments.ts +38 -0
- package/src/assembly/features/fleet.ts +31 -0
- package/src/assembly/features/jobs.ts +32 -0
- package/src/assembly/features/kanban.ts +56 -0
- package/src/assembly/features/restart.ts +35 -0
- package/src/assembly/features/subscription.ts +32 -0
- package/src/assembly/features.ts +30 -0
- package/src/cli/agent-call.ts +107 -0
- package/src/cli/args.ts +551 -0
- package/src/cli/ask-channel.ts +447 -0
- package/src/cli/command-spec/agent.ts +306 -0
- package/src/cli/command-spec/config.ts +179 -0
- package/src/cli/command-spec/define.ts +86 -0
- package/src/cli/command-spec/federation.ts +333 -0
- package/src/cli/command-spec/flags.ts +668 -0
- package/src/cli/command-spec/gateway.ts +350 -0
- package/src/cli/command-spec/hub.ts +290 -0
- package/src/cli/command-spec/kanban.ts +134 -0
- package/src/cli/command-spec/misc.ts +1032 -0
- package/src/cli/command-spec/model.ts +338 -0
- package/src/cli/command-spec/node.ts +160 -0
- package/src/cli/command-spec/plugin.ts +148 -0
- package/src/cli/command-spec/shared.ts +86 -0
- package/src/cli/command-spec/team.ts +582 -0
- package/src/cli/command-spec/token.ts +111 -0
- package/src/cli/command-spec.ts +270 -0
- package/src/cli/command-support.ts +53 -0
- package/src/cli/commands/agent/agent-command.ts +279 -0
- package/src/cli/commands/agent/agent-inbox-command.ts +141 -0
- package/src/cli/commands/agent/agents-command.ts +145 -0
- package/src/cli/commands/attention.ts +896 -0
- package/src/cli/commands/cli-update.ts +283 -0
- package/src/cli/commands/completion-command.ts +29 -0
- package/src/cli/commands/config-command.ts +545 -0
- package/src/cli/commands/dev-command.ts +429 -0
- package/src/cli/commands/doctor-command.ts +873 -0
- package/src/cli/commands/doctor-fleet.ts +410 -0
- package/src/cli/commands/errors-command.ts +469 -0
- package/src/cli/commands/eval-command.ts +168 -0
- package/src/cli/commands/federation-pair.ts +426 -0
- package/src/cli/commands/federation-peer.ts +445 -0
- package/src/cli/commands/federation.ts +527 -0
- package/src/cli/commands/fleet/fleet-inventory.ts +222 -0
- package/src/cli/commands/fleet/fleet-status-command.ts +433 -0
- package/src/cli/commands/fleet/ps-command.ts +387 -0
- package/src/cli/commands/fleet/restart-command.ts +745 -0
- package/src/cli/commands/fleet/start-command.ts +176 -0
- package/src/cli/commands/fleet/status-command.ts +318 -0
- package/src/cli/commands/fleet/stop-command.ts +548 -0
- package/src/cli/commands/gateway/gateway-command.ts +4204 -0
- package/src/cli/commands/gateway/gateway-nodes-command.ts +401 -0
- package/src/cli/commands/hub-command.ts +1007 -0
- package/src/cli/commands/kanban-command.ts +204 -0
- package/src/cli/commands/logs-command.ts +148 -0
- package/src/cli/commands/migrate-command.ts +131 -0
- package/src/cli/commands/model.ts +427 -0
- package/src/cli/commands/node-command.ts +805 -0
- package/src/cli/commands/permission/permission-show-command.ts +189 -0
- package/src/cli/commands/plugin/plugin-cli-command.ts +831 -0
- package/src/cli/commands/plugin/plugin-cli-local.ts +267 -0
- package/src/cli/commands/plugin/plugin-command.ts +407 -0
- package/src/cli/commands/prune-command.ts +233 -0
- package/src/cli/commands/resume-command.ts +100 -0
- package/src/cli/commands/rpc-command.ts +226 -0
- package/src/cli/commands/session/session-status-command.ts +352 -0
- package/src/cli/commands/team-command.ts +722 -0
- package/src/cli/commands/token-command.ts +494 -0
- package/src/cli/commands/trace-command.ts +133 -0
- package/src/cli/completion-script.ts +627 -0
- package/src/cli/completion-spec.ts +101 -0
- package/src/cli/control-plane-target.ts +295 -0
- package/src/cli/control-plane-types.ts +189 -0
- package/src/cli/feishu-command.ts +45 -0
- package/src/cli/headless-runner.ts +354 -0
- package/src/cli/help-search.ts +320 -0
- package/src/cli/help.ts +489 -0
- package/src/cli/output.ts +141 -0
- package/src/cli/parse-engine.ts +701 -0
- package/src/cli/parse-validators.ts +155 -0
- package/src/cli/project.ts +355 -0
- package/src/cli/registry.ts +25 -0
- package/src/cli.ts +2272 -0
- package/src/config/cli-overrides.ts +74 -0
- package/src/config/config-error-format.ts +44 -0
- package/src/config/config-snapshot.ts +15 -0
- package/src/config/config-watch.ts +436 -0
- package/src/config/config-write-apply.ts +98 -0
- package/src/config/empty-response-settings.ts +49 -0
- package/src/config/hot-apply-appliers.ts +527 -0
- package/src/config/hot-apply-assembly.ts +317 -0
- package/src/config/legacy-tool-names.ts +48 -0
- package/src/config/permission-defaults.ts +26 -0
- package/src/config/ui-settings.ts +568 -0
- package/src/config/vision-settings.ts +98 -0
- package/src/data/attachment-ingest.ts +101 -0
- package/src/data/attachment-staging.ts +377 -0
- package/src/data/attachments-list.ts +240 -0
- package/src/data/auto-prune.ts +342 -0
- package/src/data/data-lock.ts +580 -0
- package/src/data/data-paths.ts +265 -0
- package/src/data/image-blob-gc.ts +341 -0
- package/src/data/migrate.ts +480 -0
- package/src/data/path-resolution.ts +172 -0
- package/src/data/permission-store.ts +322 -0
- package/src/data/prune-wiring.ts +1037 -0
- package/src/data/refs-notice-hook.ts +417 -0
- package/src/federation/attention-client.ts +196 -0
- package/src/federation/attention-nodes.ts +142 -0
- package/src/federation/federation-address.ts +276 -0
- package/src/federation/federation-client.ts +620 -0
- package/src/federation/federation-config.ts +222 -0
- package/src/federation/federation-outbox.ts +374 -0
- package/src/federation/federation-pair-store.ts +236 -0
- package/src/federation/federation-pairing.ts +176 -0
- package/src/federation/federation-peer-store.ts +145 -0
- package/src/federation/federation-secrets.ts +140 -0
- package/src/federation/federation-send-port.ts +436 -0
- package/src/gateway/clean-spawn.ts +260 -0
- package/src/gateway/daemon.ts +336 -0
- package/src/gateway/fleet-index.ts +262 -0
- package/src/gateway/gateway-banner.ts +199 -0
- package/src/gateway/gateway-config-control.ts +53 -0
- package/src/gateway/gateway-reload-wiring.ts +512 -0
- package/src/gateway/gateway-wiring.ts +113 -0
- package/src/gateway/handoff.ts +131 -0
- package/src/gateway/instance-lock.ts +244 -0
- package/src/gateway/interactions-dir.ts +27 -0
- package/src/gateway/node-listen.ts +123 -0
- package/src/gateway/node-registry.ts +401 -0
- package/src/gateway/node-supervisor.ts +2226 -0
- package/src/gateway/pid.ts +827 -0
- package/src/gateway/pool-supervisor.ts +1150 -0
- package/src/gateway/reload.ts +238 -0
- package/src/gateway/restart-stop-exemption.ts +43 -0
- package/src/gateway/self-restart.ts +147 -0
- package/src/gateway/serve-auth.ts +184 -0
- package/src/gateway/serve-config.ts +135 -0
- package/src/gateway/service.ts +361 -0
- package/src/gateway/shutdown-report.ts +47 -0
- package/src/gateway/shutdown-sequence.ts +70 -0
- package/src/gateway/stop-drain.ts +299 -0
- package/src/gateway/stop-nodes-marker.ts +151 -0
- package/src/gateway/transport-factory.ts +53 -0
- package/src/gateway/watchdog.ts +622 -0
- package/src/gateway/web-dist.ts +1155 -0
- package/src/hub/client-protocol.ts +43 -0
- package/src/hub/derive-origins.ts +193 -0
- package/src/hub/hub-wiring.ts +310 -0
- package/src/hub/inbound-control.ts +432 -0
- package/src/hub/join-policy.ts +75 -0
- package/src/hub/join-store.ts +243 -0
- package/src/hub/node-credential-store.ts +295 -0
- package/src/hub/node-state.ts +279 -0
- package/src/hub/node-url.ts +33 -0
- package/src/hub/outbound-client.ts +509 -0
- package/src/hub/outbound-wiring.ts +168 -0
- package/src/hub/pairing-code.ts +27 -0
- package/src/hub/registry.ts +575 -0
- package/src/hub/runtime.ts +599 -0
- package/src/hub/secret-store.ts +571 -0
- package/src/hub/server.ts +1032 -0
- package/src/hub/snapshot-policy.ts +67 -0
- package/src/hub/types.ts +258 -0
- package/src/i18n/index.ts +94 -0
- package/src/i18n/messages/en.ts +1462 -0
- package/src/i18n/messages/zh-CN.ts +1323 -0
- package/src/mock/scenarios.ts +165 -0
- package/src/node/node-auto-resume.ts +264 -0
- package/src/node/node-drain.ts +520 -0
- package/src/node/node-identity.ts +240 -0
- package/src/node/node-resume.ts +511 -0
- package/src/node/resume-scan.ts +97 -0
- package/src/node/token-derive.ts +504 -0
- package/src/observability/logging.ts +72 -0
- package/src/observability/observability-wiring.ts +82 -0
- package/src/observability/startup-timing.ts +151 -0
- package/src/observability/trace-wiring.ts +250 -0
- package/src/observability/usage-pricing.ts +80 -0
- package/src/plugin/eval-wiring.ts +175 -0
- package/src/plugin/feishu-wiring.ts +250 -0
- package/src/plugin/mcp-wiring.ts +200 -0
- package/src/plugin/plugin-config.ts +491 -0
- package/src/plugin/plugin-host-assembly.ts +448 -0
- package/src/plugin/plugin-lifecycle.ts +130 -0
- package/src/plugin/plugin-loader.ts +788 -0
- package/src/plugin/plugin-manifest.ts +1936 -0
- package/src/plugin/plugin-selection.ts +200 -0
- package/src/plugin/plugin-surface.ts +207 -0
- package/src/plugin/plugin-watch.ts +114 -0
- package/src/rpc/http-client.ts +579 -0
- package/src/rpc/index.ts +34 -0
- package/src/rpc/local-client.ts +55 -0
- package/src/rpc/types.ts +125 -0
- package/src/run/connect-run-wait.ts +544 -0
- package/src/run/durable-wiring.ts +133 -0
- package/src/run/lease-service.ts +510 -0
- package/src/run/run-control.ts +160 -0
- package/src/run/run-record-store-factory.ts +89 -0
- package/src/runtime/agent-activity-watch.ts +335 -0
- package/src/runtime/agent-assembly.ts +818 -0
- package/src/runtime/agent-events-bridge.ts +86 -0
- package/src/runtime/bash-job-delivery.ts +291 -0
- package/src/runtime/bootstrap-connect.ts +644 -0
- package/src/runtime/bootstrap-types.ts +303 -0
- package/src/runtime/bootstrap.ts +1020 -0
- package/src/runtime/bus-source.ts +62 -0
- package/src/runtime/gc-assembly.ts +214 -0
- package/src/runtime/local-rpc-surface.ts +301 -0
- package/src/runtime/model-registry-wiring.ts +653 -0
- package/src/runtime/node-health-watch.ts +484 -0
- package/src/runtime/node-restart.ts +444 -0
- package/src/runtime/process-handlers.ts +164 -0
- package/src/runtime/provider-factory.ts +86 -0
- package/src/runtime/reasoning.ts +47 -0
- package/src/runtime/repl-context.ts +234 -0
- package/src/runtime/runtime-notice-hook.ts +357 -0
- package/src/runtime/runtime-notice.ts +273 -0
- package/src/runtime/session-id.ts +15 -0
- package/src/runtime/shutdown-sequence.ts +429 -0
- package/src/runtime/subscription-mute-bridge.ts +99 -0
- package/src/runtime/subscription-rpc-port.ts +597 -0
- package/src/runtime/team-log-bridge.ts +46 -0
- package/src/runtime/tenant-runtime-factory.ts +1838 -0
- package/src/runtime/thinking-agent-bridge.ts +57 -0
- package/src/runtime/tool-output-env.ts +80 -0
- package/src/runtime/vessel-meta.ts +338 -0
- package/src/session/context-composition.ts +147 -0
- package/src/session/context-ratio-source.ts +165 -0
- package/src/session/context-usage.ts +346 -0
- package/src/session/image-delivery.ts +297 -0
- package/src/session/session-control.ts +135 -0
- package/src/session/session-events.ts +144 -0
- package/src/session/session-factory.ts +73 -0
- package/src/session/session-liveness.ts +405 -0
- package/src/session/session-lock-runtime.ts +64 -0
- package/src/session/session-lock.ts +399 -0
- package/src/session/session-resume.ts +282 -0
- package/src/session/system-context.ts +235 -0
- package/src/session/timeline-dual-write.ts +2129 -0
- package/src/session/timeline-session-log.ts +140 -0
- package/src/shared/port-in-use.ts +27 -0
- package/src/shared/socket-inherit-guard.ts +13 -0
- package/src/shared/version.ts +38 -0
- package/src/tools-engine/engine.ts +286 -0
- package/src/tools-engine/entry.ts +757 -0
- package/src/tools-engine/mcp-engine-wiring.ts +354 -0
- package/src/tools-engine/mcp.ts +324 -0
- package/src/tools-engine/supervisor.ts +234 -0
- package/src/tools-engine/tools-list.ts +148 -0
- package/src/tools-engine/validate.ts +395 -0
- package/src/tools-engine/wiring.ts +88 -0
- package/src/tools-engine/worker.ts +110 -0
- package/src/update/background.ts +64 -0
- package/src/update/cache.ts +70 -0
- package/src/update/check.ts +138 -0
- package/src/update/gateway-check.ts +231 -0
- package/src/update/install-detect.ts +125 -0
- package/src/update/manifest.ts +132 -0
- package/src/update/semver.ts +70 -0
- package/src/update/stage.ts +219 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main-thread side of the worker: lifecycle, queueing and the fallback.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities, in the order they matter:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Off the event loop.** A query is posted to worker.ts and awaited; the main
|
|
7
|
+
* thread does no parsing, so it stays responsive while a few hundred
|
|
8
|
+
* milliseconds of NDJSON are read elsewhere.
|
|
9
|
+
* 2. **One heavy job at a time.** Queries are serialised through a promise chain
|
|
10
|
+
* and answered in order. The worker holds one event store and one index memo;
|
|
11
|
+
* running two ranges at once would only make them both thrash that state (and
|
|
12
|
+
* the second one's cache would evict the first one's files). Concurrent RPCs
|
|
13
|
+
* therefore queue — and because the caches are inside the worker, a queued
|
|
14
|
+
* request for a range that was just read answers from cache.
|
|
15
|
+
* 3. **Lazy and self-limiting.** The thread starts on the first query and exits
|
|
16
|
+
* after WORKER_IDLE_MS of silence, or when the plugin deactivates.
|
|
17
|
+
* 4. **Honest degradation.** If the thread cannot start (embedders that forbid
|
|
18
|
+
* workers, a broken environment) or dies mid-query, the same QueryRuntime code
|
|
19
|
+
* runs on the main thread instead. Slower and blocking, but correct — and the
|
|
20
|
+
* answer says which path produced it (SourceCoverage.worker).
|
|
21
|
+
*/
|
|
22
|
+
import { Worker } from 'node:worker_threads';
|
|
23
|
+
import { type QueryOutcome, QueryRuntime, type UsageQuery, WORKER_IDLE_MS } from './query.js';
|
|
24
|
+
import type { Settings } from './store.js';
|
|
25
|
+
|
|
26
|
+
interface WorkerReply {
|
|
27
|
+
id: number;
|
|
28
|
+
ok: boolean;
|
|
29
|
+
outcome?: QueryOutcome;
|
|
30
|
+
error?: string;
|
|
31
|
+
worker?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface WorkerAnswer {
|
|
35
|
+
outcome: QueryOutcome;
|
|
36
|
+
/** True when the worker thread produced this answer. */
|
|
37
|
+
worker: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A start that failed once may be retried; a process that forbids workers is final. */
|
|
41
|
+
const MAX_START_FAILURES = 2;
|
|
42
|
+
|
|
43
|
+
export class WorkerQueryClient {
|
|
44
|
+
/** Main-thread runtime, used when no worker is available. */
|
|
45
|
+
readonly fallback = new QueryRuntime();
|
|
46
|
+
private worker: Worker | null = null;
|
|
47
|
+
private starting: Promise<Worker> | null = null;
|
|
48
|
+
private readonly pending = new Map<
|
|
49
|
+
number,
|
|
50
|
+
{ resolve: (value: WorkerReply) => void; reject: (error: Error) => void }
|
|
51
|
+
>();
|
|
52
|
+
private sequence = 0;
|
|
53
|
+
private chain: Promise<unknown> = Promise.resolve();
|
|
54
|
+
private startFailures = 0;
|
|
55
|
+
private idleTimer: ReturnType<typeof setTimeout> | null = null;
|
|
56
|
+
private lastInit: { dataDir: string; settings: Settings } | null = null;
|
|
57
|
+
|
|
58
|
+
/** when the next query will go to a worker (diagnostics + probe). */
|
|
59
|
+
get usingWorker(): boolean {
|
|
60
|
+
return this.worker !== null && this.startFailures < MAX_START_FAILURES;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** How many queries this client has answered from the worker. */
|
|
64
|
+
get workerQueries(): number {
|
|
65
|
+
return this.workerRuns;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private workerRuns = 0;
|
|
69
|
+
|
|
70
|
+
private readonly idleMs: number;
|
|
71
|
+
private readonly spawn: () => Worker;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* `spawn` is injectable so a test (and a host that wants a preloaded worker)
|
|
75
|
+
* can replace the thread factory; the default is this module's sibling
|
|
76
|
+
* worker.ts. Making it a parameter is also how the fallback path is tested:
|
|
77
|
+
* a factory that throws is exactly "this environment cannot spawn workers".
|
|
78
|
+
*/
|
|
79
|
+
constructor(options: { idleMs?: number; spawn?: () => Worker } = {}) {
|
|
80
|
+
this.idleMs = options.idleMs === undefined ? WORKER_IDLE_MS : options.idleMs;
|
|
81
|
+
this.spawn =
|
|
82
|
+
options.spawn === undefined
|
|
83
|
+
? () => new Worker(new URL('./worker.ts', import.meta.url), { name: 'usage-worker' })
|
|
84
|
+
: options.spawn;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async query(
|
|
88
|
+
query: UsageQuery,
|
|
89
|
+
init: { dataDir: string; settings: Settings },
|
|
90
|
+
): Promise<WorkerAnswer> {
|
|
91
|
+
if (this.startFailures >= MAX_START_FAILURES) {
|
|
92
|
+
return this.local(query, init);
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const outcome = await this.enqueue(query, init);
|
|
96
|
+
this.workerRuns += 1;
|
|
97
|
+
return { outcome, worker: true };
|
|
98
|
+
} catch {
|
|
99
|
+
// A dead worker must not cost a request: answer it here and stop trying.
|
|
100
|
+
return this.local(query, init);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Graceful shutdown (plugin.deactivate / process exit). */
|
|
105
|
+
async terminate(): Promise<void> {
|
|
106
|
+
this.clearIdle();
|
|
107
|
+
const worker = this.worker;
|
|
108
|
+
this.worker = null;
|
|
109
|
+
this.starting = null;
|
|
110
|
+
this.failPending(new Error('worker terminated'));
|
|
111
|
+
if (worker === null) return;
|
|
112
|
+
try {
|
|
113
|
+
await worker.terminate();
|
|
114
|
+
} catch {
|
|
115
|
+
// Already gone.
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private async local(
|
|
120
|
+
query: UsageQuery,
|
|
121
|
+
init: { dataDir: string; settings: Settings },
|
|
122
|
+
): Promise<WorkerAnswer> {
|
|
123
|
+
this.fallback.init(init.dataDir, init.settings);
|
|
124
|
+
return { outcome: await this.fallback.query(query), worker: false };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Serialise on the promise chain: one heavy job at a time, answered in order. */
|
|
128
|
+
private enqueue(
|
|
129
|
+
query: UsageQuery,
|
|
130
|
+
init: { dataDir: string; settings: Settings },
|
|
131
|
+
): Promise<QueryOutcome> {
|
|
132
|
+
const run = this.chain.then(() => this.send(query, init));
|
|
133
|
+
// Keep the chain alive after a failure; the failure itself is the caller's.
|
|
134
|
+
this.chain = run.then(
|
|
135
|
+
() => undefined,
|
|
136
|
+
() => undefined,
|
|
137
|
+
);
|
|
138
|
+
return run;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private async send(
|
|
142
|
+
query: UsageQuery,
|
|
143
|
+
init: { dataDir: string; settings: Settings },
|
|
144
|
+
): Promise<QueryOutcome> {
|
|
145
|
+
const worker = await this.ensureWorker();
|
|
146
|
+
await this.ensureInit(worker, init);
|
|
147
|
+
const reply = await this.post(worker, { kind: 'query', query });
|
|
148
|
+
this.scheduleIdle();
|
|
149
|
+
if (reply.ok !== true || reply.outcome === undefined) {
|
|
150
|
+
throw new Error(reply.error === undefined ? 'worker query failed' : reply.error);
|
|
151
|
+
}
|
|
152
|
+
return reply.outcome;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private async ensureWorker(): Promise<Worker> {
|
|
156
|
+
if (this.worker !== null) return this.worker;
|
|
157
|
+
if (this.starting === null) {
|
|
158
|
+
this.starting = this.start();
|
|
159
|
+
}
|
|
160
|
+
const worker = await this.starting;
|
|
161
|
+
this.worker = worker;
|
|
162
|
+
return worker;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private async start(): Promise<Worker> {
|
|
166
|
+
try {
|
|
167
|
+
const worker = this.spawn();
|
|
168
|
+
worker.on('message', (message: WorkerReply) => {
|
|
169
|
+
const entry = this.pending.get(message.id);
|
|
170
|
+
if (entry === undefined) return;
|
|
171
|
+
this.pending.delete(message.id);
|
|
172
|
+
entry.resolve(message);
|
|
173
|
+
});
|
|
174
|
+
worker.on('error', (error: Error) => {
|
|
175
|
+
this.startFailures += 1;
|
|
176
|
+
this.onWorkerGone(error);
|
|
177
|
+
});
|
|
178
|
+
worker.on('exit', (code: number) => {
|
|
179
|
+
if (this.worker === worker) this.startFailures += 1;
|
|
180
|
+
this.onWorkerGone(new Error(`usage worker exited with code ${code}`));
|
|
181
|
+
});
|
|
182
|
+
// A handshake proves the module actually loaded (a bad path or a runtime
|
|
183
|
+
// without worker support fails here, not on the first real query).
|
|
184
|
+
await this.post(worker, { kind: 'ping', id: -1 }, true);
|
|
185
|
+
return worker;
|
|
186
|
+
} catch (error) {
|
|
187
|
+
this.startFailures += 1;
|
|
188
|
+
this.starting = null;
|
|
189
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private async ensureInit(
|
|
194
|
+
worker: Worker,
|
|
195
|
+
init: { dataDir: string; settings: Settings },
|
|
196
|
+
): Promise<void> {
|
|
197
|
+
const last = this.lastInit;
|
|
198
|
+
if (last !== null && last.dataDir === init.dataDir && last.settings === init.settings) return;
|
|
199
|
+
const reply = await this.post(worker, {
|
|
200
|
+
kind: 'init',
|
|
201
|
+
dataDir: init.dataDir,
|
|
202
|
+
settings: init.settings,
|
|
203
|
+
});
|
|
204
|
+
if (reply.ok !== true) throw new Error('usage worker init failed');
|
|
205
|
+
this.lastInit = init;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
private post(
|
|
209
|
+
worker: Worker,
|
|
210
|
+
payload: { kind: string } & Record<string, unknown>,
|
|
211
|
+
handshake = false,
|
|
212
|
+
): Promise<WorkerReply> {
|
|
213
|
+
const id = this.sequence++;
|
|
214
|
+
return new Promise<WorkerReply>((resolve, reject) => {
|
|
215
|
+
this.pending.set(id, { resolve, reject });
|
|
216
|
+
worker.postMessage({ ...payload, id });
|
|
217
|
+
if (handshake) {
|
|
218
|
+
// A handshake that never answers means the module did not load.
|
|
219
|
+
setTimeout(() => {
|
|
220
|
+
const entry = this.pending.get(id);
|
|
221
|
+
if (entry === undefined) return;
|
|
222
|
+
this.pending.delete(id);
|
|
223
|
+
reject(new Error('usage worker did not answer the handshake'));
|
|
224
|
+
}, 5_000);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private onWorkerGone(error: Error): void {
|
|
230
|
+
const worker = this.worker;
|
|
231
|
+
this.worker = null;
|
|
232
|
+
this.starting = null;
|
|
233
|
+
this.lastInit = null;
|
|
234
|
+
this.clearIdle();
|
|
235
|
+
this.failPending(error);
|
|
236
|
+
if (worker !== null) {
|
|
237
|
+
void worker.terminate().catch(() => undefined); // benign: worker 终止尽力而为——进程退出兜底。
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private failPending(error: Error): void {
|
|
242
|
+
for (const entry of this.pending.values()) entry.reject(error);
|
|
243
|
+
this.pending.clear();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private scheduleIdle(): void {
|
|
247
|
+
this.clearIdle();
|
|
248
|
+
const timer = setTimeout(() => {
|
|
249
|
+
this.idleTimer = null;
|
|
250
|
+
void this.terminate();
|
|
251
|
+
}, this.idleMs);
|
|
252
|
+
// An idle worker must never keep the process alive on its own.
|
|
253
|
+
timer.unref?.();
|
|
254
|
+
this.idleTimer = timer;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private clearIdle(): void {
|
|
258
|
+
if (this.idleTimer !== null) {
|
|
259
|
+
clearTimeout(this.idleTimer);
|
|
260
|
+
this.idleTimer = null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker-thread entry: the plugin's read + aggregate work, off the host's event
|
|
3
|
+
* loop.
|
|
4
|
+
*
|
|
5
|
+
* The main thread (index.ts) only parses the RPC and forwards a small query; this
|
|
6
|
+
* thread owns the event store (byte offsets, first-line cache, LRU event cache),
|
|
7
|
+
* the run index and the aggregation, and answers with a finished DTO plus the
|
|
8
|
+
* coverage/metrics. Nothing is ever posted back except the answer, so no event
|
|
9
|
+
* array crosses the thread boundary.
|
|
10
|
+
*
|
|
11
|
+
* Why a thread at all: reading ~125 MiB of session logs and folding 18k request
|
|
12
|
+
* records takes a few hundred milliseconds. On the main thread that freezes every
|
|
13
|
+
* other RPC, which is exactly why the old reader needed hard I/O caps that made
|
|
14
|
+
* the totals silently partial. Off the main thread the caps can go away and a
|
|
15
|
+
* range is simply complete (see ReadLimits in store.ts).
|
|
16
|
+
*
|
|
17
|
+
* Protocol (parent <-> here), one JSON object per message:
|
|
18
|
+
* { id, kind: 'init', dataDir, settings } -> { id, ok: true }
|
|
19
|
+
* { id, kind: 'query', query: UsageQuery } -> { id, ok: true, outcome }
|
|
20
|
+
* { id, kind: 'reset' } -> { id, ok: true }
|
|
21
|
+
* { id, kind: 'ping' } -> { id, ok: true, worker: true }
|
|
22
|
+
* Any failure answers { id, ok: false, error } so the caller can fall back.
|
|
23
|
+
*/
|
|
24
|
+
import { parentPort } from 'node:worker_threads';
|
|
25
|
+
import { type QueryOutcome, QueryRuntime, type UsageQuery } from './query.js';
|
|
26
|
+
import type { Settings } from './store.js';
|
|
27
|
+
|
|
28
|
+
interface InitMessage {
|
|
29
|
+
id: number;
|
|
30
|
+
kind: 'init';
|
|
31
|
+
dataDir: string;
|
|
32
|
+
settings: Settings;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface QueryMessage {
|
|
36
|
+
id: number;
|
|
37
|
+
kind: 'query';
|
|
38
|
+
query: UsageQuery;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SimpleMessage {
|
|
42
|
+
id: number;
|
|
43
|
+
kind: 'reset' | 'ping';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type Incoming = InitMessage | QueryMessage | SimpleMessage;
|
|
47
|
+
|
|
48
|
+
const runtime = new QueryRuntime();
|
|
49
|
+
const port = parentPort;
|
|
50
|
+
|
|
51
|
+
if (port === null) {
|
|
52
|
+
// Imported outside a worker: nothing to serve. Fail loudly but harmlessly —
|
|
53
|
+
// the plugin only loads this file through new Worker().
|
|
54
|
+
process.stderr.write('[usage] worker.ts loaded outside a worker thread\n');
|
|
55
|
+
} else {
|
|
56
|
+
port.on('message', (message: Incoming) => {
|
|
57
|
+
void handle(message).catch((error: unknown) => {
|
|
58
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
59
|
+
port.postMessage({ id: message.id, ok: false, error: reason });
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function handle(message: Incoming): Promise<void> {
|
|
65
|
+
if (port === null) return;
|
|
66
|
+
switch (message.kind) {
|
|
67
|
+
case 'init': {
|
|
68
|
+
runtime.init(message.dataDir, message.settings);
|
|
69
|
+
port.postMessage({ id: message.id, ok: true, worker: true });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
case 'reset': {
|
|
73
|
+
runtime.reset();
|
|
74
|
+
port.postMessage({ id: message.id, ok: true, worker: true });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
case 'ping': {
|
|
78
|
+
port.postMessage({ id: message.id, ok: true, worker: true });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
case 'query': {
|
|
82
|
+
const outcome: QueryOutcome = await runtime.query(message.query);
|
|
83
|
+
port.postMessage({ id: message.id, ok: true, outcome, worker: true });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"paths": {
|
|
10
|
+
"@vessel-agent/plugin-ui": ["../../../packages/plugin-ui/src/index.ts"],
|
|
11
|
+
"@vessel-agent/plugin-ui/*": ["../../../packages/plugin-ui/src/*"],
|
|
12
|
+
"@vessel-agent/plugin-sdk": ["../../../packages/plugin-sdk/src/index.ts"]
|
|
13
|
+
},
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"strict": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"noImplicitReturns": true,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"forceConsistentCasingInFileNames": true,
|
|
26
|
+
"types": ["bun"]
|
|
27
|
+
},
|
|
28
|
+
"include": ["web-src", "vite.config.ts", "vite.config.embed.ts"]
|
|
29
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import { defineConfig, type Plugin } from 'vite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Usage plugin embed build (plugin-embed 契约 §10).
|
|
8
|
+
*
|
|
9
|
+
* Lib 模式 ESM 产物 `web/embed/index.mjs`(+ `index.css`):React / SDK 全部
|
|
10
|
+
* external 化,由宿主 import map 指向 vendor shim(与宿主 bundle 共用同一份
|
|
11
|
+
* 实例)。iframe 产物仍由 vite.config.ts 的 classic-script 流程单独构建,
|
|
12
|
+
* 两条产线共用同一份 web-src。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 契约 §9 要求 plugin.usage 层位于宿主 utilities **之前**。层序按首次声明
|
|
17
|
+
* 排定,后加载的插件样式无法自行插队——真正的保证是宿主 index.css 预留了
|
|
18
|
+
* `plugin` 槽位(legacy 与 utilities 之间),plugin.usage 嵌套其下。
|
|
19
|
+
* 这里在产物最前再补一条完整层序声明作防御:在宿主控制台里它不引入任何新层
|
|
20
|
+
* (properties/theme/base/legacy/utilities 均已声明,plugin.usage 落入 plugin
|
|
21
|
+
* 槽位),只兜底「插件 CSS 先于宿主样式加载」的异常时序。
|
|
22
|
+
*/
|
|
23
|
+
function pluginLayerOrder(): Plugin {
|
|
24
|
+
const order = '@layer properties, theme, base, legacy, plugin.usage, utilities;\n';
|
|
25
|
+
return {
|
|
26
|
+
name: 'vessel-plugin-layer-order',
|
|
27
|
+
apply: 'build',
|
|
28
|
+
// post:lib + cssCodeSplit:false 的合并 CSS 由 vite:css 的 generateBundle
|
|
29
|
+
// 才 emitFile,normal 钩子看不到它。两个 post 插件按数组顺序:先插层序
|
|
30
|
+
// 声明,generatedBiomeIgnore 再把 biome 头插到最前。
|
|
31
|
+
enforce: 'post',
|
|
32
|
+
generateBundle(_options, bundle) {
|
|
33
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
34
|
+
if (!file.endsWith('.css') || output.type !== 'asset') continue;
|
|
35
|
+
const css =
|
|
36
|
+
typeof output.source === 'string'
|
|
37
|
+
? output.source
|
|
38
|
+
: new TextDecoder().decode(output.source);
|
|
39
|
+
if (!css.includes(order)) output.source = order + css;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 产物入库,必须带 biome-ignore-all 头(照 vite.config.ts 的
|
|
47
|
+
* generatedBiomeIgnore;这里覆盖 .mjs chunk,并多抑制 assist 类——
|
|
48
|
+
* organizeImports 会挑生成产物的 import 顺序,lint/format 头挡不住它)。
|
|
49
|
+
*/
|
|
50
|
+
function generatedBiomeIgnore(): Plugin {
|
|
51
|
+
return {
|
|
52
|
+
name: 'vessel-generated-biome-ignore',
|
|
53
|
+
apply: 'build',
|
|
54
|
+
enforce: 'post',
|
|
55
|
+
generateBundle(_options, bundle) {
|
|
56
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
57
|
+
const header =
|
|
58
|
+
'/* biome-ignore-all lint format assist: generated by `bun run build:ui` */\n';
|
|
59
|
+
if (
|
|
60
|
+
(file.endsWith('.mjs') || file.endsWith('.js')) &&
|
|
61
|
+
output.type === 'chunk' &&
|
|
62
|
+
!output.code.startsWith(header)
|
|
63
|
+
) {
|
|
64
|
+
output.code = header + output.code;
|
|
65
|
+
} else if (file.endsWith('.css') && output.type === 'asset') {
|
|
66
|
+
const css =
|
|
67
|
+
typeof output.source === 'string'
|
|
68
|
+
? output.source
|
|
69
|
+
: new TextDecoder().decode(output.source);
|
|
70
|
+
if (!css.startsWith(header)) output.source = header + css;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default defineConfig({
|
|
78
|
+
plugins: [react(), tailwindcss(), pluginLayerOrder(), generatedBiomeIgnore()],
|
|
79
|
+
build: {
|
|
80
|
+
outDir: resolve(__dirname, 'web/embed'),
|
|
81
|
+
emptyOutDir: true,
|
|
82
|
+
cssCodeSplit: false,
|
|
83
|
+
sourcemap: false,
|
|
84
|
+
lib: {
|
|
85
|
+
entry: resolve(__dirname, 'web-src/embed.tsx'),
|
|
86
|
+
formats: ['es'],
|
|
87
|
+
fileName: () => 'index.mjs',
|
|
88
|
+
cssFileName: 'index',
|
|
89
|
+
},
|
|
90
|
+
rollupOptions: {
|
|
91
|
+
// 宿主经 import map 提供这些模块(契约 §6);打进产物就是第二份 React。
|
|
92
|
+
external: [
|
|
93
|
+
'react',
|
|
94
|
+
'react-dom',
|
|
95
|
+
'react-dom/client',
|
|
96
|
+
'react/jsx-runtime',
|
|
97
|
+
'@vessel-agent/plugin-sdk',
|
|
98
|
+
],
|
|
99
|
+
output: {
|
|
100
|
+
chunkFileNames: 'chunks/[name]-[hash].mjs',
|
|
101
|
+
assetFileNames: '[name][extname]',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import { defineConfig, type Plugin } from 'vite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Usage plugin UI build (CONTRACT-0.45).
|
|
8
|
+
*
|
|
9
|
+
* Sources live in `web-src/`; the published iframe payload is `web/`. The
|
|
10
|
+
* manifest keeps `ui.dir: web` and the three page entries unchanged, so the
|
|
11
|
+
* host and its `/plugins/<id>/<entry>` static route need no changes.
|
|
12
|
+
*
|
|
13
|
+
* `base: './'` keeps the assets relative to the HTML file: an opaque-origin
|
|
14
|
+
* sandboxed iframe has no useful origin to build absolute URLs from.
|
|
15
|
+
*/
|
|
16
|
+
const root = resolve(__dirname, 'web-src');
|
|
17
|
+
const pluginUiSrc = resolve(__dirname, '../../../packages/plugin-ui/src');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generated chunks are committed, so they must not trip biome's format/lint
|
|
21
|
+
* gate. Both files are machine output; the suppression is part of the bundle.
|
|
22
|
+
*/
|
|
23
|
+
function generatedBiomeIgnore(): Plugin {
|
|
24
|
+
return {
|
|
25
|
+
name: 'vessel-generated-biome-ignore',
|
|
26
|
+
apply: 'build',
|
|
27
|
+
generateBundle(_options, bundle) {
|
|
28
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
29
|
+
const header = '/* biome-ignore-all lint format: generated by `bun run build:ui` */\n';
|
|
30
|
+
if (file.endsWith('.js') && output.type === 'chunk' && !output.code.startsWith(header)) {
|
|
31
|
+
output.code = header + output.code;
|
|
32
|
+
} else if (file.endsWith('.css') && output.type === 'asset') {
|
|
33
|
+
const css =
|
|
34
|
+
typeof output.source === 'string'
|
|
35
|
+
? output.source
|
|
36
|
+
: new TextDecoder().decode(output.source);
|
|
37
|
+
if (!css.startsWith(header)) output.source = header + css;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The host mounts plugin UI inside `<iframe sandbox="allow-scripts allow-forms">`
|
|
46
|
+
* (no `allow-same-origin`), so the document has an opaque origin. Module scripts
|
|
47
|
+
* are fetched in CORS mode and the gateway sends no `Access-Control-Allow-Origin`
|
|
48
|
+
* for `/plugins/*`, so they never execute there (verified in headless Chrome).
|
|
49
|
+
* A classic script at the end of `<body>` is not CORS-mode and sees `#root`
|
|
50
|
+
* already parsed; that is the only form that boots under the sandbox.
|
|
51
|
+
*
|
|
52
|
+
* Guard: a classic script cannot contain ESM syntax. The three pages share one
|
|
53
|
+
* entry/chunk, so this is safe today; the build fails loudly if that changes.
|
|
54
|
+
*/
|
|
55
|
+
function classicScriptForSandbox(): Plugin {
|
|
56
|
+
return {
|
|
57
|
+
name: 'vessel-classic-script',
|
|
58
|
+
apply: 'build',
|
|
59
|
+
enforce: 'post',
|
|
60
|
+
transformIndexHtml(html) {
|
|
61
|
+
const match = html.match(/<script type="module" crossorigin src="([^"]+)"><\/script>/);
|
|
62
|
+
const tag = match?.[0];
|
|
63
|
+
const src = match?.[1];
|
|
64
|
+
if (tag === undefined || src === undefined) return html;
|
|
65
|
+
// `crossorigin` makes the stylesheet a CORS request too; the sandboxed
|
|
66
|
+
// opaque origin has no matching ACAO, so drop it (same-URL no-cors is
|
|
67
|
+
// sufficient for a stylesheet).
|
|
68
|
+
return html
|
|
69
|
+
.replace(tag, '')
|
|
70
|
+
.replace(/[ \t]+\n/g, '\n')
|
|
71
|
+
.replace(/<link rel="stylesheet" crossorigin href=/g, '<link rel="stylesheet" href=')
|
|
72
|
+
.replace('</body>', `<script src="${src}"></script></body>`);
|
|
73
|
+
},
|
|
74
|
+
generateBundle(_options, bundle) {
|
|
75
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
76
|
+
if (!file.endsWith('.js') || output.type !== 'chunk') continue;
|
|
77
|
+
const esm =
|
|
78
|
+
/(^|[\n;])\s*(?:import|export)\s*[{*(]/.test(output.code) ||
|
|
79
|
+
/(^|[^\w$.])import\s*\(/.test(output.code) ||
|
|
80
|
+
/\bimport\.meta\b/.test(output.code);
|
|
81
|
+
if (esm) {
|
|
82
|
+
this.error(
|
|
83
|
+
`${file} contains ESM syntax; a sandboxed classic script cannot load it (use one chunk, no dynamic import).`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default defineConfig({
|
|
92
|
+
root,
|
|
93
|
+
base: './',
|
|
94
|
+
resolve: {
|
|
95
|
+
// Same strategy as apps/web: consume the workspace package source
|
|
96
|
+
// directly. `styles.css` must be matched before the package root.
|
|
97
|
+
alias: [
|
|
98
|
+
{
|
|
99
|
+
find: '@vessel-agent/plugin-ui/styles.css',
|
|
100
|
+
replacement: resolve(pluginUiSrc, 'styles.css'),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
find: /^@vessel-agent\/plugin-ui$/,
|
|
104
|
+
replacement: resolve(pluginUiSrc, 'index.ts'),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
plugins: [react(), tailwindcss(), classicScriptForSandbox(), generatedBiomeIgnore()],
|
|
109
|
+
build: {
|
|
110
|
+
outDir: resolve(__dirname, 'web'),
|
|
111
|
+
emptyOutDir: true,
|
|
112
|
+
// The iframe is local; sourcemaps would only add committed noise.
|
|
113
|
+
sourcemap: false,
|
|
114
|
+
rollupOptions: {
|
|
115
|
+
input: {
|
|
116
|
+
usage: resolve(root, 'usage.html'),
|
|
117
|
+
logs: resolve(root, 'logs.html'),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* biome-ignore-all lint format: generated by `bun run build:ui` */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base{*,:before,:after{box-sizing:border-box}button,input,textarea,select{color:inherit;font-family:inherit}button{cursor:pointer;background-color:#0000;border:0}button:disabled{cursor:not-allowed}:focus-visible{box-shadow:var(--focus-ring);outline:none}}@layer legacy;@layer utilities{.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.sticky{position:sticky}.top-0{top:0}.z-1{z-index:1}.z-tooltip{z-index:var(--z-tooltip)}.mx-auto{margin-inline:auto}.mt-0{margin-top:0}.mt-1{margin-top:var(--space-1)}.mt-1\.5{margin-top:calc(var(--space-1) * 1.5)}.mt-2{margin-top:calc(var(--space-1) * 2)}.mt-2\.5{margin-top:calc(var(--space-1) * 2.5)}.mt-3\.5{margin-top:calc(var(--space-1) * 3.5)}.mt-5{margin-top:calc(var(--space-1) * 5)}.mb-1\.5{margin-bottom:calc(var(--space-1) * 1.5)}.mb-2{margin-bottom:calc(var(--space-1) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.table{display:table}.size-3{width:calc(var(--space-1) * 3);height:calc(var(--space-1) * 3)}.h-5{height:calc(var(--space-1) * 5)}.h-10{height:calc(var(--space-1) * 10)}.h-control{height:var(--control-h)}.h-full{height:100%}.min-h-8{min-height:calc(var(--space-1) * 8)}.w-36{width:calc(var(--space-1) * 36)}.w-44{width:calc(var(--space-1) * 44)}.w-52{width:calc(var(--space-1) * 52)}.w-auto{width:auto}.w-full{width:100%}.max-w-36{max-width:calc(var(--space-1) * 36)}.max-w-\[var\(--content-max\)\]{max-width:var(--content-max)}.max-w-full{max-width:100%}.max-w-prose{max-width:65ch}.max-w-search{max-width:var(--search-max-w)}.min-w-0{min-width:0}.min-w-5{min-width:calc(var(--space-1) * 5)}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-60{flex-basis:calc(var(--space-1) * 60)}.border-separate{border-collapse:separate}.border-spacing-y-px{--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[minmax\(90px\,max-content\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(90px,max-content) minmax(0,1fr)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--space-1) * .5)}.gap-1{gap:var(--space-1)}.gap-1\.5{gap:calc(var(--space-1) * 1.5)}.gap-1\.25{gap:calc(var(--space-1) * 1.25)}.gap-2{gap:calc(var(--space-1) * 2)}.gap-2\.5{gap:calc(var(--space-1) * 2.5)}.gap-3{gap:calc(var(--space-1) * 3)}.gap-5{gap:calc(var(--space-1) * 5)}.gap-x-3{column-gap:calc(var(--space-1) * 3)}.gap-x-4{column-gap:calc(var(--space-1) * 4)}.gap-y-1{row-gap:var(--space-1)}.gap-y-1\.5{row-gap:calc(var(--space-1) * 1.5)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-md{border-radius:var(--shape-md)}.rounded-sm{border-radius:var(--shape-sm)}.rounded-br-md{border-bottom-right-radius:var(--shape-md)}.rounded-bl-md{border-bottom-left-radius:var(--shape-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-line{border-color:var(--line)}.border-line-strong{border-color:var(--line-strong)}.border-transparent{border-color:#0000}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-bg{background-color:var(--bg)}.bg-danger{background-color:var(--danger)}.bg-danger-soft{background-color:var(--danger-soft)}.bg-hover{background-color:var(--hover-tint)}.bg-info-soft{background-color:var(--info-soft)}.bg-raised{background-color:var(--surface-raised)}.bg-success-soft{background-color:var(--ok-soft)}.bg-sunken{background-color:var(--surface-sunken)}.bg-surface{background-color:var(--surface)}.bg-transparent{background-color:#0000}.bg-warn-soft{background-color:var(--warn-soft)}.stroke-current{stroke:currentColor}.stroke-line-strong{stroke:var(--line-strong)}.p-0{padding:0}.p-1{padding:var(--space-1)}.p-6{padding:calc(var(--space-1) * 6)}.px-1{padding-inline:var(--space-1)}.px-1\.5{padding-inline:calc(var(--space-1) * 1.5)}.px-2{padding-inline:calc(var(--space-1) * 2)}.px-2\.5{padding-inline:calc(var(--space-1) * 2.5)}.px-2\.75{padding-inline:calc(var(--space-1) * 2.75)}.px-3{padding-inline:calc(var(--space-1) * 3)}.px-3\.5{padding-inline:calc(var(--space-1) * 3.5)}.px-4{padding-inline:calc(var(--space-1) * 4)}.px-4\.5{padding-inline:calc(var(--space-1) * 4.5)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--space-1) * .5)}.py-1{padding-block:var(--space-1)}.py-1\.5{padding-block:calc(var(--space-1) * 1.5)}.py-1\.75{padding-block:calc(var(--space-1) * 1.75)}.py-2{padding-block:calc(var(--space-1) * 2)}.py-3{padding-block:calc(var(--space-1) * 3)}.py-4{padding-block:calc(var(--space-1) * 4)}.py-6{padding-block:calc(var(--space-1) * 6)}.py-px{padding-block:1px}.pt-1\.5{padding-top:calc(var(--space-1) * 1.5)}.pr-1{padding-right:var(--space-1)}.pb-0\.5{padding-bottom:calc(var(--space-1) * .5)}.pb-10{padding-bottom:calc(var(--space-1) * 10)}.pl-2{padding-left:calc(var(--space-1) * 2)}.text-left{text-align:left}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-serif{font-family:var(--font-serif)}.text-2xs{font-size:var(--size-2xs);line-height:var(--tw-leading,1.5)}.text-md{font-size:var(--size-md);line-height:var(--tw-leading,1.5)}.text-sm{font-size:var(--size-sm);line-height:var(--tw-leading,1.5)}.text-title{font-size:var(--size-2xl);line-height:var(--tw-leading,1.3)}.text-xl{font-size:var(--size-xl);line-height:var(--tw-leading,1.35)}.text-xs{font-size:var(--size-xs);line-height:var(--tw-leading,1.45)}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.wrap-anywhere{overflow-wrap:anywhere}.whitespace-nowrap{white-space:nowrap}.text-accent{color:var(--accent)}.text-accent-ink{color:var(--accent-ink)}.text-amber{color:var(--amber)}.text-danger{color:var(--danger)}.text-faint{color:var(--faint)}.text-info{color:var(--info)}.text-inherit{color:inherit}.text-ink{color:var(--ink)}.text-muted{color:var(--muted)}.text-success{color:var(--ok)}.text-surface{color:var(--surface)}.text-warn{color:var(--warn)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-45{opacity:.45}.shadow-elev-1{--tw-shadow:var(--elev-1);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-elev-3{--tw-shadow:var(--elev-3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-elev-inset{--tw-shadow:var(--elev-inset);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.filter{filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}@media(hover:hover){:is(:where(.group):hover .group-hover\:bg-hover){background-color:var(--hover-tint)}}:is(:where(.group)[data-active=true] .group-data-\[active\=true\]\:bg-accent-soft){background-color:var(--accent-soft)}.placeholder\:text-faint::placeholder{color:var(--faint)}.first\:rounded-tl-md:first-child{border-top-left-radius:var(--shape-md)}.last\:rounded-tr-md:last-child{border-top-right-radius:var(--shape-md)}@media(hover:hover){.hover\:border-line:hover{border-color:var(--line)}.hover\:bg-accent-ink:hover{background-color:var(--accent-ink)}.hover\:bg-danger-soft:hover{background-color:var(--danger-soft)}.hover\:bg-hover:hover{background-color:var(--hover-tint)}.hover\:bg-surface-hover:hover{background-color:var(--surface-hover)}.hover\:text-accent-ink:hover{color:var(--accent-ink)}.hover\:text-ink:hover{color:var(--ink)}.hover\:shadow-elev-1:hover{--tw-shadow:var(--elev-1);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:shadow-focus:focus{--tw-shadow:var(--focus-ring);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:shadow-none:focus{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-accent:focus-visible{--tw-ring-color:var(--accent)}.focus-visible\:ring-line-strong:focus-visible{--tw-ring-color:var(--line-strong)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset, ) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset, ) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-surface:focus-visible{--tw-ring-offset-color:var(--surface)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:bg-accent-ink:active{background-color:var(--accent-ink)}@media(hover:hover){.enabled\:hover\:text-ink:enabled:hover{color:var(--ink)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-faint:disabled{color:var(--faint)}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-100:disabled{opacity:1}@media(hover:hover){.disabled\:hover\:bg-transparent:disabled:hover{background-color:#0000}.disabled\:hover\:text-muted:disabled:hover{color:var(--muted)}}.aria-pressed\:bg-accent-soft[aria-pressed=true]{background-color:var(--accent-soft)}.aria-pressed\:text-accent-ink[aria-pressed=true]{color:var(--accent-ink)}.aria-selected\:bg-accent-soft[aria-selected=true]{background-color:var(--accent-soft)}.aria-selected\:text-accent-ink[aria-selected=true],.data-\[active\=true\]\:text-accent-ink[data-active=true]{color:var(--accent-ink)}@media not all and (min-width:1023px){.max-wide\:hidden{display:none}.max-wide\:whitespace-normal{white-space:normal}}@media not all and (min-width:680px){.max-compact\:hidden{display:none}.max-compact\:px-1\.5{padding-inline:calc(var(--space-1) * 1.5)}.max-compact\:px-3{padding-inline:calc(var(--space-1) * 3)}.max-compact\:px-4{padding-inline:calc(var(--space-1) * 4)}.max-compact\:pt-4{padding-top:calc(var(--space-1) * 4)}.max-compact\:pb-7{padding-bottom:calc(var(--space-1) * 7)}}@media(min-width:680px){.compact\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(min-width:1023px){.wide\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(prefers-color-scheme:dark){.dark\:bg-deep:where(:root:not([data-theme=light]) *,:root:not([data-theme=light])){background-color:var(--surface-deep)}}.dark\:bg-deep:where(:root[data-theme=dark] *,:root[data-theme=dark]){background-color:var(--surface-deep)}@media(prefers-color-scheme:dark){.dark\:bg-raised:where(:root:not([data-theme=light]) *,:root:not([data-theme=light])){background-color:var(--surface-raised)}}.dark\:bg-raised:where(:root[data-theme=dark] *,:root[data-theme=dark]){background-color:var(--surface-raised)}@media(prefers-color-scheme:dark){.dark\:bg-sunken:where(:root:not([data-theme=light]) *,:root:not([data-theme=light])){background-color:var(--surface-sunken)}}.dark\:bg-sunken:where(:root[data-theme=dark] *,:root[data-theme=dark]){background-color:var(--surface-sunken)}@media(forced-colors:active){.forced-colors\:border{border-style:var(--tw-border-style);border-width:1px}}@media(pointer:coarse){.pointer-coarse\:min-h-touch{min-height:var(--touch-target)}}}:root{color-scheme:light;--bg:#f7f7f8;--surface:#fff;--surface-raised:#fff;--surface-hover:#fff;--surface-sunken:#f1f1f2;--surface-deep:#e8e8ea;--ink:#101012;--muted:#5c5c60;--faint:#7a7a7f;--line:#e4e4e7;--line-strong:#d0d0d5;--accent:#0b7f66;--accent-ink:#086b56;--accent-soft:#0b7f661a;--ok:#0b7f66;--ok-soft:#0b7f661a;--warn:#4a4a4e;--warn-soft:#4a4a4e1a;--amber:#8a5a00;--amber-soft:#fcf2d4;--amber-ink:#6b4400;--danger:#c0362c;--danger-soft:#c0362c17;--info:#5c5c60;--info-soft:#5c5c601a;--elev-1:0 1px 2px #0000000a, 0 4px 12px #0000000d;--elev-2:0 2px 4px #0000000d, 0 10px 28px #00000014;--elev-3:0 4px 8px #0000000f, 0 18px 48px #0000001f;--elev-4:0 8px 16px #00000014, 0 28px 72px #00000029;--elev-inset:inset 0 1px 2px #0000000d;--hover-tint:#0000000a;--press-tint:#00000014;--scrim:#0000008c;--font-sans:"Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;--font-serif:"Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", Georgia, serif;--font-mono:"JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;--shape-xs:6px;--shape-sm:8px;--shape-md:12px;--shape-lg:16px;--shape-xl:20px;--radius-xs:var(--shape-xs);--radius-sm:var(--shape-sm);--radius-md:var(--shape-md);--radius-lg:var(--shape-lg);--radius-xl:var(--shape-xl);--radius-pill:999px;--ease:cubic-bezier(.22, .61, .36, 1);--space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:20px;--space-6:24px;--space-8:32px;--size-2xs:10px;--size-xs:10.5px;--size-sm:11.5px;--size-md:12.5px;--size-base:14px;--size-lg:16px;--size-xl:19px;--size-2xl:22px;--text-xs:var(--size-2xs);--text-sm:var(--size-sm);--text-body:var(--size-base);--text-title:var(--size-2xl);--appbar-h:56px;--nav-w:256px;--nav-w-collapsed:56px;--nav-w-rail:64px;--sessions-w:280px;--team-list-w:280px;--team-list-w-compact:240px;--team-members-w:272px;--team-members-w-compact:240px;--team-avatar:28px;--team-notice-max:720px;--team-list-max-w:960px;--team-member-max-w:900px;--content-max:1440px;--drawer-w:320px;--palette-w:680px;--modal-w-sm:420px;--modal-w-md:620px;--modal-w-lg:760px;--modal-max-h:780px;--panel-max-h:420px;--search-max-w:420px;--select-min-w:128px;--row-h-session:56px;--row-h-tool:36px;--control-h:32px;--tracking-wide:.08em;--motion-ui:.2s;--dock-gap:16px;--dock-safe-bottom:env(safe-area-inset-bottom);--dock-width:860px;--transcript-min-h:120px;--bottom-nav-h:0px;--composer-input-max-h:min(34dvh, 200px);--dock-max-h:min(56dvh, 520px, calc(var(--vvh,100dvh) - var(--appbar-h) - var(--transcript-min-h) - var(--bottom-nav-h,0px) - var(--dock-gap) - var(--dock-safe-bottom)));--touch-target:44px;--z-drawer:60;--z-modal:70;--z-palette:75;--z-toast:80;--z-tooltip:90;--focus-ring:0 0 0 2px var(--surface), 0 0 0 4px var(--accent)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){color-scheme:dark;--bg:#0b0b0c;--surface:#121214;--surface-raised:#1a1a1d;--surface-hover:#313134;--surface-sunken:#0e0e10;--surface-deep:#08080a;--ink:#f2f2f3;--muted:#a1a1a6;--faint:#7e7e84;--line:#242428;--line-strong:#34343a;--accent:#1effc7;--accent-ink:#6bffd8;--accent-soft:#1effc71f;--ok:#1effc7;--ok-soft:#1effc71f;--warn:#d6d6da;--warn-soft:#d6d6da1a;--amber:#f0b354;--amber-soft:#2b2216;--amber-ink:#f7d9a0;--danger:#ff6e6e;--danger-soft:#ff6e6e1f;--info:#a1a1a6;--info-soft:#a1a1a61f;--elev-1:0 1px 2px #00000052, 0 4px 12px #00000038;--elev-2:0 2px 4px #0000005c, 0 10px 28px #0000004d;--elev-3:0 4px 8px #0006, 0 18px 48px #0000006b;--elev-4:0 8px 16px #00000073, 0 28px 72px #0000008c;--elev-inset:inset 0 1px 2px #00000059;--hover-tint:#ffffff0f;--press-tint:#ffffff17;--scrim:#000000b3}}:root[data-theme=dark]{color-scheme:dark;--bg:#0b0b0c;--surface:#121214;--surface-raised:#1a1a1d;--surface-hover:#313134;--surface-sunken:#0e0e10;--surface-deep:#08080a;--ink:#f2f2f3;--muted:#a1a1a6;--faint:#7e7e84;--line:#242428;--line-strong:#34343a;--accent:#1effc7;--accent-ink:#6bffd8;--accent-soft:#1effc71f;--ok:#1effc7;--ok-soft:#1effc71f;--warn:#d6d6da;--warn-soft:#d6d6da1a;--amber:#f0b354;--amber-soft:#2b2216;--amber-ink:#f7d9a0;--danger:#ff6e6e;--danger-soft:#ff6e6e1f;--info:#a1a1a6;--info-soft:#a1a1a61f;--elev-1:0 1px 2px #00000052, 0 4px 12px #00000038;--elev-2:0 2px 4px #0000005c, 0 10px 28px #0000004d;--elev-3:0 4px 8px #0006, 0 18px 48px #0000006b;--elev-4:0 8px 16px #00000073, 0 28px 72px #0000008c;--elev-inset:inset 0 1px 2px #00000059;--hover-tint:#ffffff0f;--press-tint:#ffffff17;--scrim:#000000b3}@media(max-width:680px){:root{--dock-gap:8px;--dock-safe-bottom:0;--bottom-nav-h:57px}}html,body{min-height:100%}body{background-color:var(--bg);color:var(--ink);font-family:var(--font-sans);font-size:var(--size-base);-webkit-font-smoothing:antialiased;margin:0;line-height:1.6}#root{min-height:100dvh}@property --tw-border-spacing-x{syntax:"<length>";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"<length>";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}
|