@hoknie/aip 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +3 -0
- package/dist/app/actors.js +82 -0
- package/dist/app/actors.js.map +1 -0
- package/dist/app/application.js +71 -56
- package/dist/app/application.js.map +1 -1
- package/dist/app/integration-operations.js +34 -0
- package/dist/app/integration-operations.js.map +1 -0
- package/dist/app/lifecycle.js +91 -2
- package/dist/app/lifecycle.js.map +1 -1
- package/dist/app/notifications/index.js +44 -0
- package/dist/app/notifications/index.js.map +1 -0
- package/dist/app/oidc.js +27 -0
- package/dist/app/oidc.js.map +1 -0
- package/dist/app/saml.js +43 -0
- package/dist/app/saml.js.map +1 -0
- package/dist/app/timings.js +2 -1
- package/dist/app/timings.js.map +1 -1
- package/dist/app/wire.js +88 -0
- package/dist/app/wire.js.map +1 -0
- package/dist/app/wiring.js +10 -0
- package/dist/app/wiring.js.map +1 -1
- package/dist/cli/main.js +42 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/feature/access/services/access.js +73 -0
- package/dist/feature/access/services/access.js.map +1 -0
- package/dist/feature/access/services/create.js +31 -0
- package/dist/feature/access/services/create.js.map +1 -0
- package/dist/feature/access/services/index.js +3 -0
- package/dist/feature/access/services/index.js.map +1 -0
- package/dist/feature/access/types/actions.js +145 -0
- package/dist/feature/access/types/actions.js.map +1 -0
- package/dist/feature/access/types/evaluate.js +58 -0
- package/dist/feature/access/types/evaluate.js.map +1 -0
- package/dist/feature/access/types/index.js +4 -0
- package/dist/feature/access/types/index.js.map +1 -0
- package/dist/feature/access/types/presets.js +41 -0
- package/dist/feature/access/types/presets.js.map +1 -0
- package/dist/feature/agents/clients/agy/runtime.js +1 -0
- package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
- package/dist/feature/agents/clients/claude/permissions.js +5 -2
- package/dist/feature/agents/clients/claude/permissions.js.map +1 -1
- package/dist/feature/agents/clients/claude/runtime.js +2 -0
- package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
- package/dist/feature/agents/clients/cline/runtime.js +1 -0
- package/dist/feature/agents/clients/cline/runtime.js.map +1 -1
- package/dist/feature/agents/clients/codex/runtime.js +1 -0
- package/dist/feature/agents/clients/codex/runtime.js.map +1 -1
- package/dist/feature/agents/clients/copilot/runtime.js +1 -0
- package/dist/feature/agents/clients/copilot/runtime.js.map +1 -1
- package/dist/feature/agents/clients/kilo/runtime.js +1 -0
- package/dist/feature/agents/clients/kilo/runtime.js.map +1 -1
- package/dist/feature/agents/clients/opencode/runtime.js +1 -0
- package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
- package/dist/feature/agents/services/skills.js +4 -1
- package/dist/feature/agents/services/skills.js.map +1 -1
- package/dist/feature/agents/services/supervisor.js +7 -3
- package/dist/feature/agents/services/supervisor.js.map +1 -1
- package/dist/feature/agents/types/mcp/env.js +6 -1
- package/dist/feature/agents/types/mcp/env.js.map +1 -1
- package/dist/feature/agents/types/message.js +13 -1
- package/dist/feature/agents/types/message.js.map +1 -1
- package/dist/feature/agents/types/runtime.js.map +1 -1
- package/dist/feature/agents/types/worker-tools.js +6 -1
- package/dist/feature/agents/types/worker-tools.js.map +1 -1
- package/dist/feature/audit/repositories/events.js +66 -0
- package/dist/feature/audit/repositories/events.js.map +1 -0
- package/dist/feature/audit/repositories/index.js +2 -0
- package/dist/feature/audit/repositories/index.js.map +1 -0
- package/dist/feature/audit/services/audit-log.js +24 -0
- package/dist/feature/audit/services/audit-log.js.map +1 -0
- package/dist/feature/audit/services/create.js +6 -0
- package/dist/feature/audit/services/create.js.map +1 -0
- package/dist/feature/audit/services/index.js +3 -0
- package/dist/feature/audit/services/index.js.map +1 -0
- package/dist/feature/audit/types/event.js +12 -0
- package/dist/feature/audit/types/event.js.map +1 -0
- package/dist/feature/audit/types/index.js +2 -0
- package/dist/feature/audit/types/index.js.map +1 -0
- package/dist/feature/compose/services/repository-move.js +8 -1
- package/dist/feature/compose/services/repository-move.js.map +1 -1
- package/dist/feature/compose/services/repository-removal.js +6 -1
- package/dist/feature/compose/services/repository-removal.js.map +1 -1
- package/dist/feature/delivery/ports/authors.js +2 -0
- package/dist/feature/delivery/ports/authors.js.map +1 -0
- package/dist/feature/delivery/services/commit-stamp.js +20 -0
- package/dist/feature/delivery/services/commit-stamp.js.map +1 -0
- package/dist/feature/delivery/services/create.js +6 -2
- package/dist/feature/delivery/services/create.js.map +1 -1
- package/dist/feature/delivery/services/deliver.js +8 -0
- package/dist/feature/delivery/services/deliver.js.map +1 -1
- package/dist/feature/delivery/services/push.js +23 -0
- package/dist/feature/delivery/services/push.js.map +1 -0
- package/dist/feature/delivery/types/index.js +2 -0
- package/dist/feature/delivery/types/index.js.map +1 -1
- package/dist/feature/delivery/types/remote-url.js +44 -0
- package/dist/feature/delivery/types/remote-url.js.map +1 -0
- package/dist/feature/delivery/types/trailer.js +22 -0
- package/dist/feature/delivery/types/trailer.js.map +1 -0
- package/dist/feature/identity/clients/oidc/client.js +78 -0
- package/dist/feature/identity/clients/oidc/client.js.map +1 -0
- package/dist/feature/identity/clients/oidc/index.js +2 -0
- package/dist/feature/identity/clients/oidc/index.js.map +1 -0
- package/dist/feature/identity/clients/oidc/signature.js +51 -0
- package/dist/feature/identity/clients/oidc/signature.js.map +1 -0
- package/dist/feature/identity/clients/saml/client.js +108 -0
- package/dist/feature/identity/clients/saml/client.js.map +1 -0
- package/dist/feature/identity/clients/saml/idp-metadata.js +123 -0
- package/dist/feature/identity/clients/saml/idp-metadata.js.map +1 -0
- package/dist/feature/identity/clients/saml/index.js +3 -0
- package/dist/feature/identity/clients/saml/index.js.map +1 -0
- package/dist/feature/identity/ports/clock.js +2 -0
- package/dist/feature/identity/ports/clock.js.map +1 -0
- package/dist/feature/identity/ports/index.js +2 -0
- package/dist/feature/identity/ports/index.js.map +1 -0
- package/dist/feature/identity/ports/oidc.js +2 -0
- package/dist/feature/identity/ports/oidc.js.map +1 -0
- package/dist/feature/identity/ports/saml.js +2 -0
- package/dist/feature/identity/ports/saml.js.map +1 -0
- package/dist/feature/identity/repositories/index.js +7 -0
- package/dist/feature/identity/repositories/index.js.map +1 -0
- package/dist/feature/identity/repositories/links.js +57 -0
- package/dist/feature/identity/repositories/links.js.map +1 -0
- package/dist/feature/identity/repositories/saml-assertions.js +16 -0
- package/dist/feature/identity/repositories/saml-assertions.js.map +1 -0
- package/dist/feature/identity/repositories/sessions.js +27 -0
- package/dist/feature/identity/repositories/sessions.js.map +1 -0
- package/dist/feature/identity/repositories/sso-requests.js +34 -0
- package/dist/feature/identity/repositories/sso-requests.js.map +1 -0
- package/dist/feature/identity/repositories/tokens.js +55 -0
- package/dist/feature/identity/repositories/tokens.js.map +1 -0
- package/dist/feature/identity/repositories/users.js +75 -0
- package/dist/feature/identity/repositories/users.js.map +1 -0
- package/dist/feature/identity/services/cli-login.js +48 -0
- package/dist/feature/identity/services/cli-login.js.map +1 -0
- package/dist/feature/identity/services/create.js +76 -0
- package/dist/feature/identity/services/create.js.map +1 -0
- package/dist/feature/identity/services/index.js +10 -0
- package/dist/feature/identity/services/index.js.map +1 -0
- package/dist/feature/identity/services/saml.js +115 -0
- package/dist/feature/identity/services/saml.js.map +1 -0
- package/dist/feature/identity/services/sessions.js +81 -0
- package/dist/feature/identity/services/sessions.js.map +1 -0
- package/dist/feature/identity/services/sso-accounts.js +46 -0
- package/dist/feature/identity/services/sso-accounts.js.map +1 -0
- package/dist/feature/identity/services/sso.js +120 -0
- package/dist/feature/identity/services/sso.js.map +1 -0
- package/dist/feature/identity/services/system.js +15 -0
- package/dist/feature/identity/services/system.js.map +1 -0
- package/dist/feature/identity/services/tokens.js +74 -0
- package/dist/feature/identity/services/tokens.js.map +1 -0
- package/dist/feature/identity/services/users.js +103 -0
- package/dist/feature/identity/services/users.js.map +1 -0
- package/dist/feature/identity/types/claims.js +39 -0
- package/dist/feature/identity/types/claims.js.map +1 -0
- package/dist/feature/identity/types/index.js +5 -0
- package/dist/feature/identity/types/index.js.map +1 -0
- package/dist/feature/identity/types/token.js +11 -0
- package/dist/feature/identity/types/token.js.map +1 -0
- package/dist/feature/identity/types/ttl.js +19 -0
- package/dist/feature/identity/types/ttl.js.map +1 -0
- package/dist/feature/identity/types/user.js +47 -0
- package/dist/feature/identity/types/user.js.map +1 -0
- package/dist/feature/integrations/ports/adapter.js +2 -0
- package/dist/feature/integrations/ports/adapter.js.map +1 -0
- package/dist/feature/integrations/ports/changes.js +2 -0
- package/dist/feature/integrations/ports/changes.js.map +1 -0
- package/dist/feature/integrations/ports/index.js +5 -0
- package/dist/feature/integrations/ports/index.js.map +1 -0
- package/dist/feature/integrations/ports/operations.js +2 -0
- package/dist/feature/integrations/ports/operations.js.map +1 -0
- package/dist/feature/integrations/ports/secrets.js +2 -0
- package/dist/feature/integrations/ports/secrets.js.map +1 -0
- package/dist/feature/integrations/repositories/connections.js +89 -0
- package/dist/feature/integrations/repositories/connections.js.map +1 -0
- package/dist/feature/integrations/repositories/deliveries.js +56 -0
- package/dist/feature/integrations/repositories/deliveries.js.map +1 -0
- package/dist/feature/integrations/repositories/index.js +4 -0
- package/dist/feature/integrations/repositories/index.js.map +1 -0
- package/dist/feature/integrations/repositories/secrets.js +102 -0
- package/dist/feature/integrations/repositories/secrets.js.map +1 -0
- package/dist/feature/integrations/services/access.js +63 -0
- package/dist/feature/integrations/services/access.js.map +1 -0
- package/dist/feature/integrations/services/catalog.js +38 -0
- package/dist/feature/integrations/services/catalog.js.map +1 -0
- package/dist/feature/integrations/services/checks.js +66 -0
- package/dist/feature/integrations/services/checks.js.map +1 -0
- package/dist/feature/integrations/services/connections.js +189 -0
- package/dist/feature/integrations/services/connections.js.map +1 -0
- package/dist/feature/integrations/services/create.js +71 -0
- package/dist/feature/integrations/services/create.js.map +1 -0
- package/dist/feature/integrations/services/dispatch.js +162 -0
- package/dist/feature/integrations/services/dispatch.js.map +1 -0
- package/dist/feature/integrations/services/index.js +9 -0
- package/dist/feature/integrations/services/index.js.map +1 -0
- package/dist/feature/integrations/services/outbound.js +46 -0
- package/dist/feature/integrations/services/outbound.js.map +1 -0
- package/dist/feature/integrations/services/secrets.js +271 -0
- package/dist/feature/integrations/services/secrets.js.map +1 -0
- package/dist/feature/integrations/types/connection.js +81 -0
- package/dist/feature/integrations/types/connection.js.map +1 -0
- package/dist/feature/integrations/types/deliveries.js +5 -0
- package/dist/feature/integrations/types/deliveries.js.map +1 -0
- package/dist/feature/integrations/types/errors.js +58 -0
- package/dist/feature/integrations/types/errors.js.map +1 -0
- package/dist/feature/integrations/types/index.js +6 -0
- package/dist/feature/integrations/types/index.js.map +1 -0
- package/dist/feature/integrations/types/operations.js +16 -0
- package/dist/feature/integrations/types/operations.js.map +1 -0
- package/dist/feature/integrations/types/secrets.js +8 -0
- package/dist/feature/integrations/types/secrets.js.map +1 -0
- package/dist/feature/notifications/clients/index.js +7 -0
- package/dist/feature/notifications/clients/index.js.map +1 -0
- package/dist/feature/notifications/clients/slack/api.js +133 -0
- package/dist/feature/notifications/clients/slack/api.js.map +1 -0
- package/dist/feature/notifications/clients/slack/blocks.js +189 -0
- package/dist/feature/notifications/clients/slack/blocks.js.map +1 -0
- package/dist/feature/notifications/clients/slack/channel.js +219 -0
- package/dist/feature/notifications/clients/slack/channel.js.map +1 -0
- package/dist/feature/notifications/clients/slack/events.js +117 -0
- package/dist/feature/notifications/clients/slack/events.js.map +1 -0
- package/dist/feature/notifications/clients/slack/kind.js +39 -0
- package/dist/feature/notifications/clients/slack/kind.js.map +1 -0
- package/dist/feature/notifications/clients/slack/socket.js +141 -0
- package/dist/feature/notifications/clients/slack/socket.js.map +1 -0
- package/dist/feature/notifications/clients/telegram/api.js +93 -0
- package/dist/feature/notifications/clients/telegram/api.js.map +1 -0
- package/dist/feature/notifications/clients/telegram/channel.js +250 -0
- package/dist/feature/notifications/clients/telegram/channel.js.map +1 -0
- package/dist/feature/notifications/clients/telegram/kind.js +34 -0
- package/dist/feature/notifications/clients/telegram/kind.js.map +1 -0
- package/dist/feature/notifications/clients/telegram/render.js +68 -0
- package/dist/feature/notifications/clients/telegram/render.js.map +1 -0
- package/dist/feature/notifications/clients/telegram/updates.js +71 -0
- package/dist/feature/notifications/clients/telegram/updates.js.map +1 -0
- package/dist/feature/notifications/clients/webhook/channel.js +131 -0
- package/dist/feature/notifications/clients/webhook/channel.js.map +1 -0
- package/dist/feature/notifications/clients/webhook/kind.js +52 -0
- package/dist/feature/notifications/clients/webhook/kind.js.map +1 -0
- package/dist/feature/notifications/clients/webhook/payload.js +96 -0
- package/dist/feature/notifications/clients/webhook/payload.js.map +1 -0
- package/dist/feature/notifications/clients/webhook/sign.js +15 -0
- package/dist/feature/notifications/clients/webhook/sign.js.map +1 -0
- package/dist/feature/notifications/ports/channel.js +2 -0
- package/dist/feature/notifications/ports/channel.js.map +1 -0
- package/dist/feature/notifications/ports/index.js +2 -0
- package/dist/feature/notifications/ports/index.js.map +1 -0
- package/dist/feature/notifications/ports/publish.js +2 -0
- package/dist/feature/notifications/ports/publish.js.map +1 -0
- package/dist/feature/notifications/repositories/answers.js +25 -0
- package/dist/feature/notifications/repositories/answers.js.map +1 -0
- package/dist/feature/notifications/repositories/attempts.js +34 -0
- package/dist/feature/notifications/repositories/attempts.js.map +1 -0
- package/dist/feature/notifications/repositories/cursors.js +25 -0
- package/dist/feature/notifications/repositories/cursors.js.map +1 -0
- package/dist/feature/notifications/repositories/deliveries.js +118 -0
- package/dist/feature/notifications/repositories/deliveries.js.map +1 -0
- package/dist/feature/notifications/repositories/index.js +7 -0
- package/dist/feature/notifications/repositories/index.js.map +1 -0
- package/dist/feature/notifications/repositories/outcomes.js +80 -0
- package/dist/feature/notifications/repositories/outcomes.js.map +1 -0
- package/dist/feature/notifications/repositories/subscriptions.js +85 -0
- package/dist/feature/notifications/repositories/subscriptions.js.map +1 -0
- package/dist/feature/notifications/services/channels.js +199 -0
- package/dist/feature/notifications/services/channels.js.map +1 -0
- package/dist/feature/notifications/services/closer.js +79 -0
- package/dist/feature/notifications/services/closer.js.map +1 -0
- package/dist/feature/notifications/services/create.js +116 -0
- package/dist/feature/notifications/services/create.js.map +1 -0
- package/dist/feature/notifications/services/dispatcher.js +210 -0
- package/dist/feature/notifications/services/dispatcher.js.map +1 -0
- package/dist/feature/notifications/services/drawing.js +27 -0
- package/dist/feature/notifications/services/drawing.js.map +1 -0
- package/dist/feature/notifications/services/factories.js +31 -0
- package/dist/feature/notifications/services/factories.js.map +1 -0
- package/dist/feature/notifications/services/inbound.js +172 -0
- package/dist/feature/notifications/services/inbound.js.map +1 -0
- package/dist/feature/notifications/services/index.js +10 -0
- package/dist/feature/notifications/services/index.js.map +1 -0
- package/dist/feature/notifications/services/journal.js +38 -0
- package/dist/feature/notifications/services/journal.js.map +1 -0
- package/dist/feature/notifications/services/lanes.js +28 -0
- package/dist/feature/notifications/services/lanes.js.map +1 -0
- package/dist/feature/notifications/services/outbox.js +2 -0
- package/dist/feature/notifications/services/outbox.js.map +1 -0
- package/dist/feature/notifications/services/sender.js +129 -0
- package/dist/feature/notifications/services/sender.js.map +1 -0
- package/dist/feature/notifications/services/senders/index.js +3 -0
- package/dist/feature/notifications/services/senders/index.js.map +1 -0
- package/dist/feature/notifications/services/senders/recent.js +32 -0
- package/dist/feature/notifications/services/senders/recent.js.map +1 -0
- package/dist/feature/notifications/services/senders/senders.js +23 -0
- package/dist/feature/notifications/services/senders/senders.js.map +1 -0
- package/dist/feature/notifications/services/subscriptions.js +221 -0
- package/dist/feature/notifications/services/subscriptions.js.map +1 -0
- package/dist/feature/notifications/services/webhooks/index.js +3 -0
- package/dist/feature/notifications/services/webhooks/index.js.map +1 -0
- package/dist/feature/notifications/services/webhooks/streaks.js +44 -0
- package/dist/feature/notifications/services/webhooks/streaks.js.map +1 -0
- package/dist/feature/notifications/services/webhooks/webhooks.js +249 -0
- package/dist/feature/notifications/services/webhooks/webhooks.js.map +1 -0
- package/dist/feature/notifications/types/answers.js +42 -0
- package/dist/feature/notifications/types/answers.js.map +1 -0
- package/dist/feature/notifications/types/channel.js +20 -0
- package/dist/feature/notifications/types/channel.js.map +1 -0
- package/dist/feature/notifications/types/display-url.js +11 -0
- package/dist/feature/notifications/types/display-url.js.map +1 -0
- package/dist/feature/notifications/types/drafts.js +35 -0
- package/dist/feature/notifications/types/drafts.js.map +1 -0
- package/dist/feature/notifications/types/errors.js +38 -0
- package/dist/feature/notifications/types/errors.js.map +1 -0
- package/dist/feature/notifications/types/events.js +137 -0
- package/dist/feature/notifications/types/events.js.map +1 -0
- package/dist/feature/notifications/types/index.js +13 -0
- package/dist/feature/notifications/types/index.js.map +1 -0
- package/dist/feature/notifications/types/limits.js +32 -0
- package/dist/feature/notifications/types/limits.js.map +1 -0
- package/dist/feature/notifications/types/model.js +29 -0
- package/dist/feature/notifications/types/model.js.map +1 -0
- package/dist/feature/notifications/types/render.js +132 -0
- package/dist/feature/notifications/types/render.js.map +1 -0
- package/dist/feature/notifications/types/retry.js +35 -0
- package/dist/feature/notifications/types/retry.js.map +1 -0
- package/dist/feature/notifications/types/texts.js +130 -0
- package/dist/feature/notifications/types/texts.js.map +1 -0
- package/dist/feature/notifications/types/webhooks.js +22 -0
- package/dist/feature/notifications/types/webhooks.js.map +1 -0
- package/dist/feature/queue/repositories/queues.js +6 -4
- package/dist/feature/queue/repositories/queues.js.map +1 -1
- package/dist/feature/queue/services/advance.js +2 -0
- package/dist/feature/queue/services/advance.js.map +1 -1
- package/dist/feature/queue/services/create.js +2 -0
- package/dist/feature/queue/services/create.js.map +1 -1
- package/dist/feature/queue/services/edit.js +2 -0
- package/dist/feature/queue/services/edit.js.map +1 -1
- package/dist/feature/queue/services/items.js +26 -47
- package/dist/feature/queue/services/items.js.map +1 -1
- package/dist/feature/queue/services/projects.js +22 -6
- package/dist/feature/queue/services/projects.js.map +1 -1
- package/dist/feature/queue/services/worker/tasks.js +108 -0
- package/dist/feature/queue/services/worker/tasks.js.map +1 -0
- package/dist/feature/queue/types/duplicates.js +46 -0
- package/dist/feature/queue/types/duplicates.js.map +1 -0
- package/dist/feature/queue/types/edit.js +2 -0
- package/dist/feature/queue/types/edit.js.map +1 -1
- package/dist/feature/queue/types/index.js +1 -0
- package/dist/feature/queue/types/index.js.map +1 -1
- package/dist/feature/queue/types/items.js.map +1 -1
- package/dist/feature/queue/types/limit-hits.js +2 -0
- package/dist/feature/queue/types/limit-hits.js.map +1 -1
- package/dist/feature/queue/types/returns.js +2 -0
- package/dist/feature/queue/types/returns.js.map +1 -1
- package/dist/feature/repos/services/projects.js +26 -2
- package/dist/feature/repos/services/projects.js.map +1 -1
- package/dist/feature/repos/types/index.js +1 -0
- package/dist/feature/repos/types/index.js.map +1 -1
- package/dist/feature/repos/types/remote.js +28 -0
- package/dist/feature/repos/types/remote.js.map +1 -0
- package/dist/feature/runs/machine/answers.js +13 -0
- package/dist/feature/runs/machine/answers.js.map +1 -1
- package/dist/feature/runs/machine/delivery-checks.js +4 -2
- package/dist/feature/runs/machine/delivery-checks.js.map +1 -1
- package/dist/feature/runs/machine/delivery-flow.js +3 -0
- package/dist/feature/runs/machine/delivery-flow.js.map +1 -1
- package/dist/feature/runs/machine/push/index.js +2 -0
- package/dist/feature/runs/machine/push/index.js.map +1 -0
- package/dist/feature/runs/machine/push/push.js +48 -0
- package/dist/feature/runs/machine/push/push.js.map +1 -0
- package/dist/feature/runs/machine/transition.js +21 -2
- package/dist/feature/runs/machine/transition.js.map +1 -1
- package/dist/feature/runs/ports/commits.js +2 -0
- package/dist/feature/runs/ports/commits.js.map +1 -0
- package/dist/feature/runs/ports/notify.js +2 -0
- package/dist/feature/runs/ports/notify.js.map +1 -0
- package/dist/feature/runs/ports/push.js +2 -0
- package/dist/feature/runs/ports/push.js.map +1 -0
- package/dist/feature/runs/ports/registry-project.js +2 -0
- package/dist/feature/runs/ports/registry-project.js.map +1 -0
- package/dist/feature/runs/ports/registry-skills.js +2 -0
- package/dist/feature/runs/ports/registry-skills.js.map +1 -0
- package/dist/feature/runs/ports/remote-mcp.js +2 -0
- package/dist/feature/runs/ports/remote-mcp.js.map +1 -0
- package/dist/feature/runs/repositories/finished-runs.js +5 -1
- package/dist/feature/runs/repositories/finished-runs.js.map +1 -1
- package/dist/feature/runs/repositories/rows.js +9 -0
- package/dist/feature/runs/repositories/rows.js.map +1 -1
- package/dist/feature/runs/repositories/write.js +4 -4
- package/dist/feature/runs/repositories/write.js.map +1 -1
- package/dist/feature/runs/services/create.js +1 -0
- package/dist/feature/runs/services/create.js.map +1 -1
- package/dist/feature/runs/services/effects/actions.js +2 -1
- package/dist/feature/runs/services/effects/actions.js.map +1 -1
- package/dist/feature/runs/services/effects/attempts.js +44 -54
- package/dist/feature/runs/services/effects/attempts.js.map +1 -1
- package/dist/feature/runs/services/effects/context.js +2 -0
- package/dist/feature/runs/services/effects/context.js.map +1 -1
- package/dist/feature/runs/services/effects/conversations.js +159 -1
- package/dist/feature/runs/services/effects/conversations.js.map +1 -1
- package/dist/feature/runs/services/effects/effects.js +2 -0
- package/dist/feature/runs/services/effects/effects.js.map +1 -1
- package/dist/feature/runs/services/effects/git.js +15 -2
- package/dist/feature/runs/services/effects/git.js.map +1 -1
- package/dist/feature/runs/services/effects/runtime-check.js +24 -0
- package/dist/feature/runs/services/effects/runtime-check.js.map +1 -1
- package/dist/feature/runs/services/effects/skills/index.js +3 -0
- package/dist/feature/runs/services/effects/skills/index.js.map +1 -0
- package/dist/feature/runs/services/effects/skills/outside-queue.js +58 -0
- package/dist/feature/runs/services/effects/skills/outside-queue.js.map +1 -0
- package/dist/feature/runs/services/effects/skills/registry.js +70 -0
- package/dist/feature/runs/services/effects/skills/registry.js.map +1 -0
- package/dist/feature/runs/services/engine.js +8 -1
- package/dist/feature/runs/services/engine.js.map +1 -1
- package/dist/feature/runs/services/index.js +1 -1
- package/dist/feature/runs/services/index.js.map +1 -1
- package/dist/feature/runs/services/reads.js +21 -1
- package/dist/feature/runs/services/reads.js.map +1 -1
- package/dist/feature/runs/services/requests.js +14 -4
- package/dist/feature/runs/services/requests.js.map +1 -1
- package/dist/feature/runs/services/states.js +2 -2
- package/dist/feature/runs/services/states.js.map +1 -1
- package/dist/feature/runs/types/answers/answers-text.js +7 -0
- package/dist/feature/runs/types/answers/answers-text.js.map +1 -0
- package/dist/feature/runs/types/constants.js +1 -1
- package/dist/feature/runs/types/constants.js.map +1 -1
- package/dist/feature/runs/types/create.js +5 -3
- package/dist/feature/runs/types/create.js.map +1 -1
- package/dist/feature/runs/types/index.js +1 -0
- package/dist/feature/runs/types/index.js.map +1 -1
- package/dist/feature/runs/types/problems.js +9 -5
- package/dist/feature/runs/types/problems.js.map +1 -1
- package/dist/feature/runs/types/run.js.map +1 -1
- package/dist/feature/runs/types/stage-status.js +3 -1
- package/dist/feature/runs/types/stage-status.js.map +1 -1
- package/dist/feature/service-registry/clients/http-mcp/client.js +164 -0
- package/dist/feature/service-registry/clients/http-mcp/client.js.map +1 -0
- package/dist/feature/service-registry/clients/http-mcp/index.js +2 -0
- package/dist/feature/service-registry/clients/http-mcp/index.js.map +1 -0
- package/dist/feature/service-registry/ports/adapter.js +2 -0
- package/dist/feature/service-registry/ports/adapter.js.map +1 -0
- package/dist/feature/service-registry/ports/index.js +3 -0
- package/dist/feature/service-registry/ports/index.js.map +1 -0
- package/dist/feature/service-registry/ports/transport.js +2 -0
- package/dist/feature/service-registry/ports/transport.js.map +1 -0
- package/dist/feature/service-registry/repositories/index.js +2 -0
- package/dist/feature/service-registry/repositories/index.js.map +1 -0
- package/dist/feature/service-registry/repositories/links.js +61 -0
- package/dist/feature/service-registry/repositories/links.js.map +1 -0
- package/dist/feature/service-registry/services/adapter.js +63 -0
- package/dist/feature/service-registry/services/adapter.js.map +1 -0
- package/dist/feature/service-registry/services/calls.js +86 -0
- package/dist/feature/service-registry/services/calls.js.map +1 -0
- package/dist/feature/service-registry/services/catalog-scan.js +49 -0
- package/dist/feature/service-registry/services/catalog-scan.js.map +1 -0
- package/dist/feature/service-registry/services/create.js +30 -0
- package/dist/feature/service-registry/services/create.js.map +1 -0
- package/dist/feature/service-registry/services/forwarder.js +107 -0
- package/dist/feature/service-registry/services/forwarder.js.map +1 -0
- package/dist/feature/service-registry/services/index.js +6 -0
- package/dist/feature/service-registry/services/index.js.map +1 -0
- package/dist/feature/service-registry/services/links.js +256 -0
- package/dist/feature/service-registry/services/links.js.map +1 -0
- package/dist/feature/service-registry/services/skill-cache.js +135 -0
- package/dist/feature/service-registry/services/skill-cache.js.map +1 -0
- package/dist/feature/service-registry/services/skill-source.js +128 -0
- package/dist/feature/service-registry/services/skill-source.js.map +1 -0
- package/dist/feature/service-registry/services/skills.js +197 -0
- package/dist/feature/service-registry/services/skills.js.map +1 -0
- package/dist/feature/service-registry/types/descriptor.js +41 -0
- package/dist/feature/service-registry/types/descriptor.js.map +1 -0
- package/dist/feature/service-registry/types/endpoint.js +2 -0
- package/dist/feature/service-registry/types/endpoint.js.map +1 -0
- package/dist/feature/service-registry/types/errors.js +26 -0
- package/dist/feature/service-registry/types/errors.js.map +1 -0
- package/dist/feature/service-registry/types/index.js +7 -0
- package/dist/feature/service-registry/types/index.js.map +1 -0
- package/dist/feature/service-registry/types/link.js +26 -0
- package/dist/feature/service-registry/types/link.js.map +1 -0
- package/dist/feature/service-registry/types/semver.js +2 -0
- package/dist/feature/service-registry/types/semver.js.map +1 -0
- package/dist/feature/service-registry/types/skills.js +27 -0
- package/dist/feature/service-registry/types/skills.js.map +1 -0
- package/dist/feature/stats/repositories/meta.js +10 -0
- package/dist/feature/stats/repositories/meta.js.map +1 -1
- package/dist/feature/stats/repositories/records.js +18 -7
- package/dist/feature/stats/repositories/records.js.map +1 -1
- package/dist/feature/stats/repositories/report.js +14 -4
- package/dist/feature/stats/repositories/report.js.map +1 -1
- package/dist/feature/stats/services/ledger.js +16 -1
- package/dist/feature/stats/services/ledger.js.map +1 -1
- package/dist/feature/stats/services/report.js +7 -2
- package/dist/feature/stats/services/report.js.map +1 -1
- package/dist/feature/stats/types/capture.js +3 -0
- package/dist/feature/stats/types/capture.js.map +1 -1
- package/dist/feature/stats/types/records.js.map +1 -1
- package/dist/feature/stats/types/report.js +2 -0
- package/dist/feature/stats/types/report.js.map +1 -1
- package/dist/feature/swarm-config/services/access/file.js +83 -0
- package/dist/feature/swarm-config/services/access/file.js.map +1 -0
- package/dist/feature/swarm-config/services/access/index.js +3 -0
- package/dist/feature/swarm-config/services/access/index.js.map +1 -0
- package/dist/feature/swarm-config/services/access/validate.js +134 -0
- package/dist/feature/swarm-config/services/access/validate.js.map +1 -0
- package/dist/feature/swarm-config/services/assemble.js +32 -1
- package/dist/feature/swarm-config/services/assemble.js.map +1 -1
- package/dist/feature/swarm-config/services/index.js +3 -2
- package/dist/feature/swarm-config/services/index.js.map +1 -1
- package/dist/feature/swarm-config/services/load.js +10 -1
- package/dist/feature/swarm-config/services/load.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/mcp-servers.js +33 -5
- package/dist/feature/swarm-config/services/sections/mcp-servers.js.map +1 -1
- package/dist/feature/swarm-config/services/sections/server-saml.js +116 -0
- package/dist/feature/swarm-config/services/sections/server-saml.js.map +1 -0
- package/dist/feature/swarm-config/services/sections/server.js +272 -0
- package/dist/feature/swarm-config/services/sections/server.js.map +1 -0
- package/dist/feature/swarm-config/services/settings.js +25 -1
- package/dist/feature/swarm-config/services/settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-settings.js +51 -3
- package/dist/feature/swarm-config/services/validate-settings.js.map +1 -1
- package/dist/feature/swarm-config/services/validate-specialists.js +23 -0
- package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -1
- package/dist/feature/swarm-config/services/validate.js +30 -2
- package/dist/feature/swarm-config/services/validate.js.map +1 -1
- package/dist/feature/swarm-config/types/access/index.js +2 -0
- package/dist/feature/swarm-config/types/access/index.js.map +1 -0
- package/dist/feature/swarm-config/types/access/policy.js +10 -0
- package/dist/feature/swarm-config/types/access/policy.js.map +1 -0
- package/dist/feature/swarm-config/types/index.js +2 -0
- package/dist/feature/swarm-config/types/index.js.map +1 -1
- package/dist/feature/swarm-config/types/providers/provider.js +9 -0
- package/dist/feature/swarm-config/types/providers/provider.js.map +1 -1
- package/dist/feature/swarm-config/types/settings.js +31 -7
- package/dist/feature/swarm-config/types/settings.js.map +1 -1
- package/dist/feature/swarm-config/types/skills/index.js +3 -0
- package/dist/feature/swarm-config/types/skills/index.js.map +1 -0
- package/dist/feature/swarm-config/types/skills/semver.js +250 -0
- package/dist/feature/swarm-config/types/skills/semver.js.map +1 -0
- package/dist/feature/swarm-config/types/skills/skill-ref.js +35 -0
- package/dist/feature/swarm-config/types/skills/skill-ref.js.map +1 -0
- package/dist/feature/swarm-config/types/specialist.js +2 -0
- package/dist/feature/swarm-config/types/specialist.js.map +1 -1
- package/dist/feature/swarm-config/types/web/index.js +2 -0
- package/dist/feature/swarm-config/types/web/index.js.map +1 -0
- package/dist/feature/swarm-config/types/web/settings.js +14 -0
- package/dist/feature/swarm-config/types/web/settings.js.map +1 -0
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js +2 -0
- package/dist/feature/swarm-edit/services/mcp/editor-mcp.js.map +1 -1
- package/dist/feature/swarm-edit/services/plan-settings.js +2 -1
- package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
- package/dist/feature/swarm-edit/services/references.js +2 -0
- package/dist/feature/swarm-edit/services/references.js.map +1 -1
- package/dist/feature/swarm-edit/types/editor.js.map +1 -1
- package/dist/feature/swarm-edit/types/setting-fields.js +1 -0
- package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
- package/dist/platform/archive/index.js +2 -0
- package/dist/platform/archive/index.js.map +1 -0
- package/dist/platform/archive/zip.js +164 -0
- package/dist/platform/archive/zip.js.map +1 -0
- package/dist/platform/files/index.js +2 -0
- package/dist/platform/files/index.js.map +1 -0
- package/dist/platform/files/read.js +20 -0
- package/dist/platform/files/read.js.map +1 -0
- package/dist/platform/git/authorship.js +12 -0
- package/dist/platform/git/authorship.js.map +1 -0
- package/dist/platform/git/changes.js +26 -0
- package/dist/platform/git/changes.js.map +1 -0
- package/dist/platform/git/delivery.js +8 -20
- package/dist/platform/git/delivery.js.map +1 -1
- package/dist/platform/git/index.js +3 -0
- package/dist/platform/git/index.js.map +1 -1
- package/dist/platform/git/remote.js +69 -0
- package/dist/platform/git/remote.js.map +1 -0
- package/dist/platform/git/workspace.js +3 -4
- package/dist/platform/git/workspace.js.map +1 -1
- package/dist/platform/http/index.js +3 -0
- package/dist/platform/http/index.js.map +1 -0
- package/dist/platform/http/request.js +157 -0
- package/dist/platform/http/request.js.map +1 -0
- package/dist/platform/http/websocket-frames.js +155 -0
- package/dist/platform/http/websocket-frames.js.map +1 -0
- package/dist/platform/http/websocket.js +259 -0
- package/dist/platform/http/websocket.js.map +1 -0
- package/dist/platform/paths/index.js +1 -1
- package/dist/platform/paths/index.js.map +1 -1
- package/dist/platform/paths/paths.js +6 -0
- package/dist/platform/paths/paths.js.map +1 -1
- package/dist/platform/secrets/command.js +30 -0
- package/dist/platform/secrets/command.js.map +1 -0
- package/dist/platform/secrets/errors.js +16 -0
- package/dist/platform/secrets/errors.js.map +1 -0
- package/dist/platform/secrets/file-key.js +43 -0
- package/dist/platform/secrets/file-key.js.map +1 -0
- package/dist/platform/secrets/file.js +158 -0
- package/dist/platform/secrets/file.js.map +1 -0
- package/dist/platform/secrets/index.js +6 -0
- package/dist/platform/secrets/index.js.map +1 -0
- package/dist/platform/secrets/keyring.js +73 -0
- package/dist/platform/secrets/keyring.js.map +1 -0
- package/dist/platform/secrets/select.js +124 -0
- package/dist/platform/secrets/select.js.map +1 -0
- package/dist/platform/secrets/store.js +2 -0
- package/dist/platform/secrets/store.js.map +1 -0
- package/dist/platform/sqlite/authorship-migration.js +23 -0
- package/dist/platform/sqlite/authorship-migration.js.map +1 -0
- package/dist/platform/sqlite/identity-migration.js +52 -0
- package/dist/platform/sqlite/identity-migration.js.map +1 -0
- package/dist/platform/sqlite/integrations-migration.js +147 -0
- package/dist/platform/sqlite/integrations-migration.js.map +1 -0
- package/dist/platform/sqlite/parts.js +27 -0
- package/dist/platform/sqlite/parts.js.map +1 -1
- package/dist/platform/sqlite/saml-migration.js +9 -0
- package/dist/platform/sqlite/saml-migration.js.map +1 -0
- package/dist/platform/sqlite/sso-migration.js +17 -0
- package/dist/platform/sqlite/sso-migration.js.map +1 -0
- package/dist/platform/sqlite/stats-migration.js +8 -0
- package/dist/platform/sqlite/stats-migration.js.map +1 -1
- package/dist/presentation/cli/commands/daemon.js +5 -3
- package/dist/presentation/cli/commands/daemon.js.map +1 -1
- package/dist/presentation/cli/commands/integration/index.js +3 -0
- package/dist/presentation/cli/commands/integration/index.js.map +1 -0
- package/dist/presentation/cli/commands/integration/integrations.js +239 -0
- package/dist/presentation/cli/commands/integration/integrations.js.map +1 -0
- package/dist/presentation/cli/commands/integration/skills.js +24 -0
- package/dist/presentation/cli/commands/integration/skills.js.map +1 -0
- package/dist/presentation/cli/commands/mcp.js +23 -1
- package/dist/presentation/cli/commands/mcp.js.map +1 -1
- package/dist/presentation/cli/commands/notify/index.js +2 -0
- package/dist/presentation/cli/commands/notify/index.js.map +1 -0
- package/dist/presentation/cli/commands/notify/notify.js +145 -0
- package/dist/presentation/cli/commands/notify/notify.js.map +1 -0
- package/dist/presentation/cli/commands/queue-edit.js +0 -24
- package/dist/presentation/cli/commands/queue-edit.js.map +1 -1
- package/dist/presentation/cli/commands/queue.js +3 -3
- package/dist/presentation/cli/commands/queue.js.map +1 -1
- package/dist/presentation/cli/commands/run-delivery.js +23 -2
- package/dist/presentation/cli/commands/run-delivery.js.map +1 -1
- package/dist/presentation/cli/commands/run.js +26 -8
- package/dist/presentation/cli/commands/run.js.map +1 -1
- package/dist/presentation/cli/commands/server/access.js +43 -0
- package/dist/presentation/cli/commands/server/access.js.map +1 -0
- package/dist/presentation/cli/commands/server/admin.js +118 -0
- package/dist/presentation/cli/commands/server/admin.js.map +1 -0
- package/dist/presentation/cli/commands/server/apply.js +82 -0
- package/dist/presentation/cli/commands/server/apply.js.map +1 -0
- package/dist/presentation/cli/commands/server/audit.js +38 -0
- package/dist/presentation/cli/commands/server/audit.js.map +1 -0
- package/dist/presentation/cli/commands/server/login.js +141 -0
- package/dist/presentation/cli/commands/server/login.js.map +1 -0
- package/dist/presentation/cli/commands/server/profile.js +38 -0
- package/dist/presentation/cli/commands/server/profile.js.map +1 -0
- package/dist/presentation/cli/commands/server/register.js +12 -0
- package/dist/presentation/cli/commands/server/register.js.map +1 -0
- package/dist/presentation/cli/commands/server/repository.js +34 -0
- package/dist/presentation/cli/commands/server/repository.js.map +1 -0
- package/dist/presentation/cli/commands/stats.js +10 -1
- package/dist/presentation/cli/commands/stats.js.map +1 -1
- package/dist/presentation/cli/commands/web.js +26 -5
- package/dist/presentation/cli/commands/web.js.map +1 -1
- package/dist/presentation/cli/commands/webhook/index.js +2 -0
- package/dist/presentation/cli/commands/webhook/index.js.map +1 -0
- package/dist/presentation/cli/commands/webhook/webhook.js +172 -0
- package/dist/presentation/cli/commands/webhook/webhook.js.map +1 -0
- package/dist/presentation/cli/context.js +34 -2
- package/dist/presentation/cli/context.js.map +1 -1
- package/dist/presentation/cli/help.js +20 -1
- package/dist/presentation/cli/help.js.map +1 -1
- package/dist/presentation/cli/io.js.map +1 -1
- package/dist/presentation/cli/local/config-check-providers.js +11 -0
- package/dist/presentation/cli/local/config-check-providers.js.map +1 -1
- package/dist/presentation/cli/local/config-check.js +16 -8
- package/dist/presentation/cli/local/config-check.js.map +1 -1
- package/dist/presentation/cli/options.js +53 -0
- package/dist/presentation/cli/options.js.map +1 -1
- package/dist/presentation/cli/program.js +8 -0
- package/dist/presentation/cli/program.js.map +1 -1
- package/dist/presentation/cli/queue-add.js +53 -35
- package/dist/presentation/cli/queue-add.js.map +1 -1
- package/dist/presentation/cli/queue-print.js +34 -1
- package/dist/presentation/cli/queue-print.js.map +1 -1
- package/dist/presentation/cli/secret-keys.js +38 -0
- package/dist/presentation/cli/secret-keys.js.map +1 -0
- package/dist/presentation/format/access/access.js +30 -0
- package/dist/presentation/format/access/access.js.map +1 -0
- package/dist/presentation/format/access/index.js +2 -0
- package/dist/presentation/format/access/index.js.map +1 -0
- package/dist/presentation/format/audit/audit.js +29 -0
- package/dist/presentation/format/audit/audit.js.map +1 -0
- package/dist/presentation/format/audit/index.js +2 -0
- package/dist/presentation/format/audit/index.js.map +1 -0
- package/dist/presentation/format/index.js +5 -0
- package/dist/presentation/format/index.js.map +1 -1
- package/dist/presentation/format/integration/index.js +3 -0
- package/dist/presentation/format/integration/index.js.map +1 -0
- package/dist/presentation/format/integration/integrations.js +95 -0
- package/dist/presentation/format/integration/integrations.js.map +1 -0
- package/dist/presentation/format/integration/skills.js +17 -0
- package/dist/presentation/format/integration/skills.js.map +1 -0
- package/dist/presentation/format/notifications/index.js +2 -0
- package/dist/presentation/format/notifications/index.js.map +1 -0
- package/dist/presentation/format/notifications/notifications.js +44 -0
- package/dist/presentation/format/notifications/notifications.js.map +1 -0
- package/dist/presentation/format/overview.js +2 -1
- package/dist/presentation/format/overview.js.map +1 -1
- package/dist/presentation/format/providers/provider-list.js +4 -1
- package/dist/presentation/format/providers/provider-list.js.map +1 -1
- package/dist/presentation/format/queue.js +2 -1
- package/dist/presentation/format/queue.js.map +1 -1
- package/dist/presentation/format/runs.js +30 -2
- package/dist/presentation/format/runs.js.map +1 -1
- package/dist/presentation/format/stats.js +9 -3
- package/dist/presentation/format/stats.js.map +1 -1
- package/dist/presentation/format/webhooks/index.js +2 -0
- package/dist/presentation/format/webhooks/index.js.map +1 -0
- package/dist/presentation/format/webhooks/webhooks.js +59 -0
- package/dist/presentation/format/webhooks/webhooks.js.map +1 -0
- package/dist/presentation/ipc/client/address.js +8 -0
- package/dist/presentation/ipc/client/address.js.map +1 -0
- package/dist/presentation/ipc/client/client.js +23 -6
- package/dist/presentation/ipc/client/client.js.map +1 -1
- package/dist/presentation/ipc/client/index.js +1 -0
- package/dist/presentation/ipc/client/index.js.map +1 -1
- package/dist/presentation/ipc/client/remote.js +85 -0
- package/dist/presentation/ipc/client/remote.js.map +1 -0
- package/dist/presentation/ipc/contract/access/access.js +21 -0
- package/dist/presentation/ipc/contract/access/access.js.map +1 -0
- package/dist/presentation/ipc/contract/access/index.js +2 -0
- package/dist/presentation/ipc/contract/access/index.js.map +1 -0
- package/dist/presentation/ipc/contract/envelope.js +90 -6
- package/dist/presentation/ipc/contract/envelope.js.map +1 -1
- package/dist/presentation/ipc/contract/identity/audit.js +21 -0
- package/dist/presentation/ipc/contract/identity/audit.js.map +1 -0
- package/dist/presentation/ipc/contract/identity/identity.js +120 -0
- package/dist/presentation/ipc/contract/identity/identity.js.map +1 -0
- package/dist/presentation/ipc/contract/identity/index.js +3 -0
- package/dist/presentation/ipc/contract/identity/index.js.map +1 -0
- package/dist/presentation/ipc/contract/index.js +6 -0
- package/dist/presentation/ipc/contract/index.js.map +1 -1
- package/dist/presentation/ipc/contract/integrations/integrations.js +85 -0
- package/dist/presentation/ipc/contract/integrations/integrations.js.map +1 -0
- package/dist/presentation/ipc/contract/integrations/remote.js +16 -0
- package/dist/presentation/ipc/contract/integrations/remote.js.map +1 -0
- package/dist/presentation/ipc/contract/notifications/notifications.js +44 -0
- package/dist/presentation/ipc/contract/notifications/notifications.js.map +1 -0
- package/dist/presentation/ipc/contract/notifications/webhooks.js +48 -0
- package/dist/presentation/ipc/contract/notifications/webhooks.js.map +1 -0
- package/dist/presentation/ipc/contract/panel.js +5 -1
- package/dist/presentation/ipc/contract/panel.js.map +1 -1
- package/dist/presentation/ipc/contract/queue.js +46 -5
- package/dist/presentation/ipc/contract/queue.js.map +1 -1
- package/dist/presentation/ipc/contract/repositories.js +4 -0
- package/dist/presentation/ipc/contract/repositories.js.map +1 -1
- package/dist/presentation/ipc/contract/responses/stats.js +3 -0
- package/dist/presentation/ipc/contract/responses/stats.js.map +1 -1
- package/dist/presentation/ipc/contract/runs.js +12 -2
- package/dist/presentation/ipc/contract/runs.js.map +1 -1
- package/dist/presentation/ipc/contract/stats/stats.js +2 -0
- package/dist/presentation/ipc/contract/stats/stats.js.map +1 -1
- package/dist/presentation/ipc/handlers/access/access.js +74 -0
- package/dist/presentation/ipc/handlers/access/access.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/author.js +25 -0
- package/dist/presentation/ipc/handlers/access/author.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/guard.js +57 -0
- package/dist/presentation/ipc/handlers/access/guard.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/index.js +5 -0
- package/dist/presentation/ipc/handlers/access/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/method-actions.js +13 -0
- package/dist/presentation/ipc/handlers/access/method-actions.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/method-runs.js +76 -0
- package/dist/presentation/ipc/handlers/access/method-runs.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/method-settings.js +120 -0
- package/dist/presentation/ipc/handlers/access/method-settings.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/resource.js +129 -0
- package/dist/presentation/ipc/handlers/access/resource.js.map +1 -0
- package/dist/presentation/ipc/handlers/access/visible.js +13 -0
- package/dist/presentation/ipc/handlers/access/visible.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-account-actions.js +52 -0
- package/dist/presentation/ipc/handlers/audit/audit-account-actions.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-actions.js +220 -0
- package/dist/presentation/ipc/handlers/audit/audit-actions.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-helpers.js +56 -0
- package/dist/presentation/ipc/handlers/audit/audit-helpers.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-list.js +57 -0
- package/dist/presentation/ipc/handlers/audit/audit-list.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-readers.js +74 -0
- package/dist/presentation/ipc/handlers/audit/audit-readers.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-settings-actions.js +73 -0
- package/dist/presentation/ipc/handlers/audit/audit-settings-actions.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit-table.js +10 -0
- package/dist/presentation/ipc/handlers/audit/audit-table.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/audit.js +101 -0
- package/dist/presentation/ipc/handlers/audit/audit.js.map +1 -0
- package/dist/presentation/ipc/handlers/audit/index.js +5 -0
- package/dist/presentation/ipc/handlers/audit/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/identity/identity.js +182 -0
- package/dist/presentation/ipc/handlers/identity/identity.js.map +1 -0
- package/dist/presentation/ipc/handlers/identity/index.js +2 -0
- package/dist/presentation/ipc/handlers/identity/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/index.js +6 -0
- package/dist/presentation/ipc/handlers/integrations/index.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/integrations.js +114 -0
- package/dist/presentation/ipc/handlers/integrations/integrations.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/notifications.js +49 -0
- package/dist/presentation/ipc/handlers/integrations/notifications.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/remote.js +35 -0
- package/dist/presentation/ipc/handlers/integrations/remote.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/skills.js +18 -0
- package/dist/presentation/ipc/handlers/integrations/skills.js.map +1 -0
- package/dist/presentation/ipc/handlers/integrations/webhooks.js +30 -0
- package/dist/presentation/ipc/handlers/integrations/webhooks.js.map +1 -0
- package/dist/presentation/ipc/handlers/observers.js +10 -2
- package/dist/presentation/ipc/handlers/observers.js.map +1 -1
- package/dist/presentation/ipc/handlers/providers.js +9 -1
- package/dist/presentation/ipc/handlers/providers.js.map +1 -1
- package/dist/presentation/ipc/handlers/queue.js +70 -18
- package/dist/presentation/ipc/handlers/queue.js.map +1 -1
- package/dist/presentation/ipc/handlers/repositories.js +28 -13
- package/dist/presentation/ipc/handlers/repositories.js.map +1 -1
- package/dist/presentation/ipc/handlers/runs.js +13 -5
- package/dist/presentation/ipc/handlers/runs.js.map +1 -1
- package/dist/presentation/ipc/handlers/stats.js +27 -6
- package/dist/presentation/ipc/handlers/stats.js.map +1 -1
- package/dist/presentation/ipc/handlers/system.js +8 -1
- package/dist/presentation/ipc/handlers/system.js.map +1 -1
- package/dist/presentation/ipc/handlers/table.js +18 -3
- package/dist/presentation/ipc/handlers/table.js.map +1 -1
- package/dist/presentation/ipc/log-signals.js +78 -0
- package/dist/presentation/ipc/log-signals.js.map +1 -0
- package/dist/presentation/ipc/publisher.js +20 -3
- package/dist/presentation/ipc/publisher.js.map +1 -1
- package/dist/presentation/ipc/server.js +58 -14
- package/dist/presentation/ipc/server.js.map +1 -1
- package/dist/presentation/ipc/snapshots.js +22 -3
- package/dist/presentation/ipc/snapshots.js.map +1 -1
- package/dist/presentation/ipc/views/index.js +2 -0
- package/dist/presentation/ipc/views/index.js.map +1 -1
- package/dist/presentation/ipc/views/notifications/notifications.js +7 -0
- package/dist/presentation/ipc/views/notifications/notifications.js.map +1 -0
- package/dist/presentation/ipc/views/notifications/webhooks.js +6 -0
- package/dist/presentation/ipc/views/notifications/webhooks.js.map +1 -0
- package/dist/presentation/ipc/views/queue.js +3 -0
- package/dist/presentation/ipc/views/queue.js.map +1 -1
- package/dist/presentation/ipc/views/runs.js +18 -7
- package/dist/presentation/ipc/views/runs.js.map +1 -1
- package/dist/presentation/ipc/views/stats.js +11 -3
- package/dist/presentation/ipc/views/stats.js.map +1 -1
- package/dist/presentation/mcp/host-kit.js +2 -1
- package/dist/presentation/mcp/host-kit.js.map +1 -1
- package/dist/presentation/mcp/host-queue.js +19 -13
- package/dist/presentation/mcp/host-queue.js.map +1 -1
- package/dist/presentation/mcp/host-runs.js +10 -14
- package/dist/presentation/mcp/host-runs.js.map +1 -1
- package/dist/presentation/mcp/index.js +1 -0
- package/dist/presentation/mcp/index.js.map +1 -1
- package/dist/presentation/mcp/remote-bridge.js +50 -0
- package/dist/presentation/mcp/remote-bridge.js.map +1 -0
- package/dist/presentation/mcp/tools.js +18 -0
- package/dist/presentation/mcp/tools.js.map +1 -1
- package/dist/presentation/mcp/worker-extra.js +77 -5
- package/dist/presentation/mcp/worker-extra.js.map +1 -1
- package/dist/presentation/mcp/worker-tools.js.map +1 -1
- package/dist/presentation/mcp/worker.js +2 -1
- package/dist/presentation/mcp/worker.js.map +1 -1
- package/dist/presentation/web/access.js +42 -0
- package/dist/presentation/web/access.js.map +1 -0
- package/dist/presentation/web/auth/context.js +3 -0
- package/dist/presentation/web/auth/context.js.map +1 -0
- package/dist/presentation/web/auth/gate.js +33 -0
- package/dist/presentation/web/auth/gate.js.map +1 -0
- package/dist/presentation/web/auth/oidc.js +49 -0
- package/dist/presentation/web/auth/oidc.js.map +1 -0
- package/dist/presentation/web/auth/pages.js +43 -0
- package/dist/presentation/web/auth/pages.js.map +1 -0
- package/dist/presentation/web/auth/proxy.js +54 -0
- package/dist/presentation/web/auth/proxy.js.map +1 -0
- package/dist/presentation/web/auth/routes.js +152 -0
- package/dist/presentation/web/auth/routes.js.map +1 -0
- package/dist/presentation/web/auth/saml.js +65 -0
- package/dist/presentation/web/auth/saml.js.map +1 -0
- package/dist/presentation/web/auth/session.js +53 -0
- package/dist/presentation/web/auth/session.js.map +1 -0
- package/dist/presentation/web/errors.js +18 -1
- package/dist/presentation/web/errors.js.map +1 -1
- package/dist/presentation/web/hub.js +101 -22
- package/dist/presentation/web/hub.js.map +1 -1
- package/dist/presentation/web/live/protocol.js +68 -0
- package/dist/presentation/web/live/protocol.js.map +1 -0
- package/dist/presentation/web/live/read.js +29 -0
- package/dist/presentation/web/live/read.js.map +1 -0
- package/dist/presentation/web/live/socket.js +93 -0
- package/dist/presentation/web/live/socket.js.map +1 -0
- package/dist/presentation/web/live/state-topics.js +127 -0
- package/dist/presentation/web/live/state-topics.js.map +1 -0
- package/dist/presentation/web/live/topics.js +119 -0
- package/dist/presentation/web/live/topics.js.map +1 -0
- package/dist/presentation/web/options.js.map +1 -1
- package/dist/presentation/web/panel/daemon-panel.js +24 -4
- package/dist/presentation/web/panel/daemon-panel.js.map +1 -1
- package/dist/presentation/web/request.js +42 -3
- package/dist/presentation/web/request.js.map +1 -1
- package/dist/presentation/web/routes/access/access.js +14 -0
- package/dist/presentation/web/routes/access/access.js.map +1 -0
- package/dist/presentation/web/routes/audit/audit.js +11 -0
- package/dist/presentation/web/routes/audit/audit.js.map +1 -0
- package/dist/presentation/web/routes/integrations/integrations.js +147 -0
- package/dist/presentation/web/routes/integrations/integrations.js.map +1 -0
- package/dist/presentation/web/routes/integrations/webhooks.js +73 -0
- package/dist/presentation/web/routes/integrations/webhooks.js.map +1 -0
- package/dist/presentation/web/routes/queue.js +1 -1
- package/dist/presentation/web/routes/queue.js.map +1 -1
- package/dist/presentation/web/routes/runs.js +5 -1
- package/dist/presentation/web/routes/runs.js.map +1 -1
- package/dist/presentation/web/routes/system.js +21 -13
- package/dist/presentation/web/routes/system.js.map +1 -1
- package/dist/presentation/web/server.js +95 -17
- package/dist/presentation/web/server.js.map +1 -1
- package/dist/presentation/web/visible.js +93 -0
- package/dist/presentation/web/visible.js.map +1 -0
- package/dist/web/assets/EntryList-CMEscRod.js +3 -0
- package/dist/web/assets/FilterField-BQc_UwWN.js +7 -0
- package/dist/web/assets/LinkTabs-v8NyjDyU.js +4 -0
- package/dist/web/assets/SharedPipelinesGroup-BzlZ5U2Y.js +1 -0
- package/dist/web/assets/deliveryModes-CHEVNJxR.js +1 -0
- package/dist/web/assets/empty-Bho47NOE.js +41 -0
- package/dist/web/assets/index-vRNf1iRZ.css +2 -0
- package/dist/web/assets/index-ztjIJ-Ig.js +41 -0
- package/dist/web/assets/locales-BTrmAl7v.js +1 -0
- package/dist/web/assets/pipelines-DVZ7cqyZ.js +14 -0
- package/dist/web/assets/settingFields-iGwxRKJI.js +1 -0
- package/dist/web/assets/settings-DN_KmJBg.js +6 -0
- package/dist/web/assets/stats-4iy1ZRny.js +1 -0
- package/dist/web/assets/tabs-D26rwwNs.js +1 -0
- package/dist/web/assets/toggle-group-D-oIoacR.js +1 -0
- package/dist/web/assets/topology-CaSfGJbk.js +1 -0
- package/dist/web/index.html +10 -10
- package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
- package/package.json +12 -4
- package/dist/web/assets/EntryList-Cyc9PxYQ.js +0 -3
- package/dist/web/assets/FilterField-DOat7bHi.js +0 -7
- package/dist/web/assets/LinkTabs-V5hVhmkv.js +0 -4
- package/dist/web/assets/SharedPipelinesGroup-CMV55Qri.js +0 -1
- package/dist/web/assets/card-DDDwEBup.js +0 -1
- package/dist/web/assets/deliveryModes-OVH1wAmC.js +0 -1
- package/dist/web/assets/empty-CF7EgKd2.js +0 -41
- package/dist/web/assets/index-7lFvzi1k.js +0 -41
- package/dist/web/assets/index-BJYNhfGR.css +0 -2
- package/dist/web/assets/locales-3BQ5tRcZ.js +0 -1
- package/dist/web/assets/pipelines-BLhOZXCy.js +0 -14
- package/dist/web/assets/settingFields-C8-XJpPl.js +0 -1
- package/dist/web/assets/settings-96DThDqz.js +0 -6
- package/dist/web/assets/stats-B1imf_Vj.js +0 -1
- package/dist/web/assets/tabs-DyEM16mP.js +0 -1
- package/dist/web/assets/topology-Dyq425Mw.js +0 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { subscribe } from '../ipc/client/index.js';
|
|
2
2
|
import { streamEventSchema } from '../ipc/contract/index.js';
|
|
3
3
|
import { RECHECK_MS } from './options.js';
|
|
4
|
+
import { eventFor } from './visible.js';
|
|
5
|
+
/** How long the readable projects of a subscriber are kept before they are asked for again. */
|
|
6
|
+
export const ACCESS_CACHE_MS = 10_000;
|
|
4
7
|
/** Fan-out of the daemon event stream; keeps the latest state of every run. */
|
|
5
8
|
export class Hub {
|
|
6
9
|
socket;
|
|
@@ -16,15 +19,21 @@ export class Hub {
|
|
|
16
19
|
ready = false;
|
|
17
20
|
stopped = false;
|
|
18
21
|
abort = new AbortController();
|
|
19
|
-
|
|
22
|
+
subscribers = new Set();
|
|
23
|
+
/** The event streams to close when the hub stops. */
|
|
24
|
+
ends = new Set();
|
|
25
|
+
readable;
|
|
26
|
+
onSignal;
|
|
20
27
|
ensure;
|
|
21
28
|
/** Build mismatch with the daemon, as the panel shows it; null when the builds match. */
|
|
22
29
|
daemon = null;
|
|
23
30
|
checking = null;
|
|
24
31
|
recheck;
|
|
25
|
-
constructor(socket, ensure) {
|
|
32
|
+
constructor(socket, ensure, onSignal = () => undefined, readable) {
|
|
33
|
+
this.readable = readable;
|
|
26
34
|
this.socket = socket;
|
|
27
35
|
this.ensure = ensure;
|
|
36
|
+
this.onSignal = onSignal;
|
|
28
37
|
this.recheck = setInterval(() => {
|
|
29
38
|
if (this.daemon?.outdated === 'daemon')
|
|
30
39
|
void this.check();
|
|
@@ -51,7 +60,9 @@ export class Hub {
|
|
|
51
60
|
if (this.stopped)
|
|
52
61
|
break;
|
|
53
62
|
try {
|
|
54
|
-
await subscribe(this.socket, (line) => this.onLine(line), this.abort.signal
|
|
63
|
+
await subscribe(this.socket, (line) => this.onLine(line), this.abort.signal, {
|
|
64
|
+
logs: true,
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
67
|
catch {
|
|
57
68
|
// the daemon is not reachable yet; retry below
|
|
@@ -75,7 +86,12 @@ export class Hub {
|
|
|
75
86
|
catch {
|
|
76
87
|
return;
|
|
77
88
|
}
|
|
78
|
-
if (event.event === '
|
|
89
|
+
if (event.event === 'log') {
|
|
90
|
+
// Never relayed: the subscriptions read the log and send what is new.
|
|
91
|
+
this.seq = event.seq;
|
|
92
|
+
this.onSignal(event);
|
|
93
|
+
}
|
|
94
|
+
else if (event.event === 'snapshot') {
|
|
79
95
|
this.tags = event.tags ?? [];
|
|
80
96
|
this.runs = new Map(event.runs.map((run) => [run.id, run]));
|
|
81
97
|
this.queues = new Map((event.queues ?? []).map((queue) => [queue.repository, queue]));
|
|
@@ -90,6 +106,7 @@ export class Hub {
|
|
|
90
106
|
this.runs.set(event.run.id, event.run);
|
|
91
107
|
this.seq = event.seq;
|
|
92
108
|
this.broadcast(event);
|
|
109
|
+
this.onSignal({ event: 'run', runId: event.run.id });
|
|
93
110
|
}
|
|
94
111
|
else if (event.event === 'repositories') {
|
|
95
112
|
this.repositories = event.repositories;
|
|
@@ -139,12 +156,72 @@ export class Hub {
|
|
|
139
156
|
daemon: this.daemon,
|
|
140
157
|
};
|
|
141
158
|
}
|
|
159
|
+
/** Asks which projects the subscriber reads; no answer yet means none, a later failure keeps the last. */
|
|
160
|
+
refresh(subscriber) {
|
|
161
|
+
const { actor } = subscriber;
|
|
162
|
+
if (actor === undefined || this.readable === undefined) {
|
|
163
|
+
subscriber.allowed = null;
|
|
164
|
+
return Promise.resolve();
|
|
165
|
+
}
|
|
166
|
+
subscriber.loading ??= this.readable(actor)
|
|
167
|
+
.then((paths) => {
|
|
168
|
+
subscriber.allowed = paths === null ? null : new Set(paths);
|
|
169
|
+
}, () => {
|
|
170
|
+
subscriber.allowed ??= new Set();
|
|
171
|
+
})
|
|
172
|
+
.finally(() => {
|
|
173
|
+
subscriber.loadedAt = Date.now();
|
|
174
|
+
subscriber.loading = null;
|
|
175
|
+
});
|
|
176
|
+
return subscriber.loading;
|
|
177
|
+
}
|
|
178
|
+
/** Sends an event to a subscriber, without what belongs to the projects it does not read. */
|
|
179
|
+
deliver(subscriber, event, text) {
|
|
180
|
+
const { allowed } = subscriber;
|
|
181
|
+
if (allowed === undefined)
|
|
182
|
+
return; // its snapshot follows as soon as its projects are known
|
|
183
|
+
if (subscriber.actor !== undefined && Date.now() - subscriber.loadedAt > ACCESS_CACHE_MS) {
|
|
184
|
+
void this.refresh(subscriber);
|
|
185
|
+
}
|
|
186
|
+
if (allowed === null)
|
|
187
|
+
return subscriber.write(text);
|
|
188
|
+
const visible = eventFor(event, allowed);
|
|
189
|
+
if (visible !== null)
|
|
190
|
+
subscriber.write(JSON.stringify(visible));
|
|
191
|
+
}
|
|
142
192
|
broadcast(event) {
|
|
143
|
-
const
|
|
144
|
-
for (const
|
|
145
|
-
|
|
193
|
+
const text = JSON.stringify(event);
|
|
194
|
+
for (const subscriber of this.subscribers)
|
|
195
|
+
this.deliver(subscriber, event, text);
|
|
196
|
+
}
|
|
197
|
+
/** The snapshot and the last processes: what a new connection gets first. */
|
|
198
|
+
greet(subscriber) {
|
|
199
|
+
if (!this.ready)
|
|
200
|
+
return;
|
|
201
|
+
const snapshot = this.snapshot();
|
|
202
|
+
this.deliver(subscriber, snapshot, JSON.stringify(snapshot));
|
|
203
|
+
if (this.processes) {
|
|
204
|
+
const processes = { ...this.processes, seq: this.seq };
|
|
205
|
+
this.deliver(subscriber, processes, JSON.stringify(processes));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
add(write, actor) {
|
|
209
|
+
const subscriber = {
|
|
210
|
+
write,
|
|
211
|
+
actor,
|
|
212
|
+
allowed: undefined,
|
|
213
|
+
loadedAt: 0,
|
|
214
|
+
loading: null,
|
|
215
|
+
};
|
|
216
|
+
this.subscribers.add(subscriber);
|
|
217
|
+
void this.refresh(subscriber).then(() => this.greet(subscriber));
|
|
218
|
+
return () => this.subscribers.delete(subscriber);
|
|
219
|
+
}
|
|
220
|
+
/** A live connection: the snapshot and the last processes now, then every event. */
|
|
221
|
+
join(send, actor) {
|
|
222
|
+
return this.add(send, actor);
|
|
146
223
|
}
|
|
147
|
-
attach(incoming, response) {
|
|
224
|
+
attach(incoming, response, actor) {
|
|
148
225
|
response.writeHead(200, {
|
|
149
226
|
'content-type': 'text/event-stream; charset=utf-8',
|
|
150
227
|
'cache-control': 'no-store',
|
|
@@ -152,26 +229,28 @@ export class Hub {
|
|
|
152
229
|
'x-accel-buffering': 'no',
|
|
153
230
|
});
|
|
154
231
|
response.write('retry: 2000\n\n');
|
|
155
|
-
this.
|
|
156
|
-
if (this.ready) {
|
|
157
|
-
response.write(`data: ${JSON.stringify(this.snapshot())}\n\n`);
|
|
158
|
-
if (this.processes) {
|
|
159
|
-
response.write(`data: ${JSON.stringify({ ...this.processes, seq: this.seq })}\n\n`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
232
|
+
const leave = this.add((text) => response.write(`data: ${text}\n\n`), actor);
|
|
162
233
|
const beat = setInterval(() => response.write(': ping\n\n'), 15_000);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
234
|
+
const end = {
|
|
235
|
+
response,
|
|
236
|
+
done: () => {
|
|
237
|
+
clearInterval(beat);
|
|
238
|
+
leave();
|
|
239
|
+
this.ends.delete(end);
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
incoming.on('close', end.done);
|
|
243
|
+
this.ends.add(end);
|
|
167
244
|
}
|
|
168
245
|
stop() {
|
|
169
246
|
this.stopped = true;
|
|
170
247
|
clearInterval(this.recheck);
|
|
171
248
|
this.abort.abort();
|
|
172
|
-
for (const
|
|
173
|
-
|
|
174
|
-
|
|
249
|
+
for (const { response, done } of this.ends) {
|
|
250
|
+
done();
|
|
251
|
+
response.end();
|
|
252
|
+
}
|
|
253
|
+
this.ends.clear();
|
|
175
254
|
}
|
|
176
255
|
}
|
|
177
256
|
//# sourceMappingURL=hub.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub.js","sourceRoot":"","sources":["../../../src/presentation/web/hub.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"hub.js","sourceRoot":"","sources":["../../../src/presentation/web/hub.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAEtD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAoBtC,+EAA+E;AAC/E,MAAM,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AI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;SACF,CAAC;QACF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3C,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,GAAG,EAAE,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { renderPanelError } from '../errors.js';
|
|
3
|
+
/** The longest message a client may send, in bytes. */
|
|
4
|
+
export const MAX_MESSAGE_BYTES = 4 * 1024;
|
|
5
|
+
/** How many subscriptions one connection may hold. */
|
|
6
|
+
export const MAX_SUBSCRIPTIONS = 64;
|
|
7
|
+
const id = z.string().min(1).max(128);
|
|
8
|
+
const target = { runId: z.string().min(1).max(128), group: z.string().min(1).max(256) };
|
|
9
|
+
export const topicSchema = z.discriminatedUnion('kind', [
|
|
10
|
+
z.strictObject({
|
|
11
|
+
kind: z.literal('transcript'),
|
|
12
|
+
...target,
|
|
13
|
+
seq: z.number().int().positive(),
|
|
14
|
+
after: z.number().int().nonnegative().optional(),
|
|
15
|
+
}),
|
|
16
|
+
z.strictObject({ kind: z.literal('group'), ...target }),
|
|
17
|
+
z.strictObject({
|
|
18
|
+
kind: z.literal('group_spec'),
|
|
19
|
+
...target,
|
|
20
|
+
/** Read again when the log of the group grows, not only when the run changes. */
|
|
21
|
+
watch: z.boolean().optional(),
|
|
22
|
+
}),
|
|
23
|
+
z.strictObject({
|
|
24
|
+
kind: z.literal('providers'),
|
|
25
|
+
repository: z.string().min(1).max(4096).optional(),
|
|
26
|
+
level: z.literal('global').optional(),
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
29
|
+
export const clientMessageSchema = z.discriminatedUnion('op', [
|
|
30
|
+
z.strictObject({ op: z.literal('subscribe'), id, topic: topicSchema }),
|
|
31
|
+
z.strictObject({ op: z.literal('unsubscribe'), id }),
|
|
32
|
+
/** Read the data of the subscription again now. */
|
|
33
|
+
z.strictObject({ op: z.literal('refresh'), id }),
|
|
34
|
+
]);
|
|
35
|
+
/** The id a refused message names, when it has one. */
|
|
36
|
+
function idOf(raw) {
|
|
37
|
+
const given = raw?.id;
|
|
38
|
+
return typeof given === 'string' ? given.slice(0, 128) : '';
|
|
39
|
+
}
|
|
40
|
+
/** A message of a client, or the refusal to send back; the input is never quoted. */
|
|
41
|
+
export function parseClientMessage(text) {
|
|
42
|
+
let raw;
|
|
43
|
+
try {
|
|
44
|
+
raw = JSON.parse(text);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return {
|
|
48
|
+
event: 'topic_error',
|
|
49
|
+
id: '',
|
|
50
|
+
error: 'message is not valid JSON',
|
|
51
|
+
code: 'live.invalid',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const parsed = clientMessageSchema.safeParse(raw);
|
|
55
|
+
if (parsed.success)
|
|
56
|
+
return parsed.data;
|
|
57
|
+
return { event: 'topic_error', id: idOf(raw), error: 'invalid message', code: 'live.invalid' };
|
|
58
|
+
}
|
|
59
|
+
export function topicError(id, error) {
|
|
60
|
+
const { body } = renderPanelError(error);
|
|
61
|
+
return {
|
|
62
|
+
event: 'topic_error',
|
|
63
|
+
id,
|
|
64
|
+
error: body.error,
|
|
65
|
+
...(body.code === undefined ? {} : { code: body.code }),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../src/presentation/web/live/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC;AAC1C,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtC,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AAExF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACtD,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QAC7B,GAAG,MAAM;QACT,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;KACjD,CAAC;IACF,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IACv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,CAAC,IAAY;IAC7C,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,KAAK,EAAE,aAAa;YACpB,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,2BAA2B;YAClC,IAAI,EAAE,cAAc;SACrB,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACjG,CAAC;AAgBD,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,KAAc;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO;QACL,KAAK,EAAE,aAAa;QACpB,EAAE;QACF,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { request } from '../../ipc/client/index.js';
|
|
2
|
+
import { requestRepository } from '../request.js';
|
|
3
|
+
/** How many lines of the log the view of a group carries, as the panel asks for it. */
|
|
4
|
+
const GROUP_TAIL_LINES = 200;
|
|
5
|
+
/** Reads the data of a topic with the method of the daemon the matching request of the API uses. */
|
|
6
|
+
export function topicReader(socket, options) {
|
|
7
|
+
return async (topic, actor) => {
|
|
8
|
+
const call = (method, params) => request(socket, method, params, undefined, actor);
|
|
9
|
+
if (topic.kind === 'transcript') {
|
|
10
|
+
const { runId, group, seq, after } = topic;
|
|
11
|
+
return call('transcript', { runId, group, seq, ...(after === undefined ? {} : { after }) });
|
|
12
|
+
}
|
|
13
|
+
if (topic.kind === 'group') {
|
|
14
|
+
return call('group', { runId: topic.runId, group: topic.group, tailLines: GROUP_TAIL_LINES });
|
|
15
|
+
}
|
|
16
|
+
if (topic.kind === 'group_spec') {
|
|
17
|
+
return call('group_spec', { runId: topic.runId, group: topic.group });
|
|
18
|
+
}
|
|
19
|
+
const url = new URL('http://panel/api/config/providers');
|
|
20
|
+
if (topic.repository !== undefined)
|
|
21
|
+
url.searchParams.set('repository', topic.repository);
|
|
22
|
+
const repository = await requestRepository(url, options);
|
|
23
|
+
return call('config_providers', {
|
|
24
|
+
repository,
|
|
25
|
+
...(topic.level === 'global' ? { level: 'global' } : {}),
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/presentation/web/live/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIlD,uFAAuF;AACvF,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,oGAAoG;AACpG,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,OAA6D;IAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,CAAmB,MAAS,EAAE,MAAmB,EAAE,EAAE,CAChE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAChC,MAAM,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 'ws';
|
|
2
|
+
import { panel, renderPanelError } from '../errors.js';
|
|
3
|
+
import { MAX_MESSAGE_BYTES, parseClientMessage } from './protocol.js';
|
|
4
|
+
export const LIVE_PATH = '/api/ws';
|
|
5
|
+
/** How often a connection is pinged; one that did not answer the last ping is closed. */
|
|
6
|
+
export const PING_MS = 15_000;
|
|
7
|
+
/** How often the access of a connection is looked at again in server mode. */
|
|
8
|
+
export const RECHECK_ACCESS_MS = 60_000;
|
|
9
|
+
/** A connection with more than this waiting to be sent does not keep up and is closed. */
|
|
10
|
+
const BUFFER_LIMIT = 8 * 1024 * 1024;
|
|
11
|
+
/** The close code of a connection whose access is gone. */
|
|
12
|
+
const ACCESS_GONE = 4401;
|
|
13
|
+
/** Answers a request that may not open a connection, with the status a request of the API gets. */
|
|
14
|
+
function refuse(socket, error) {
|
|
15
|
+
const { status, body } = renderPanelError(error);
|
|
16
|
+
const text = JSON.stringify(body);
|
|
17
|
+
socket.end(`HTTP/1.1 ${status} Refused\r\ncontent-type: application/json; charset=utf-8\r\n` +
|
|
18
|
+
`content-length: ${Buffer.byteLength(text)}\r\nconnection: close\r\n\r\n${text}`);
|
|
19
|
+
}
|
|
20
|
+
/** One open connection: the events, the subscriptions, the ping and the access check. */
|
|
21
|
+
function serve(ws, identity, options) {
|
|
22
|
+
const sendText = (text) => {
|
|
23
|
+
if (ws.readyState !== ws.OPEN)
|
|
24
|
+
return;
|
|
25
|
+
if (ws.bufferedAmount > BUFFER_LIMIT)
|
|
26
|
+
ws.terminate();
|
|
27
|
+
else
|
|
28
|
+
ws.send(text);
|
|
29
|
+
};
|
|
30
|
+
const client = {
|
|
31
|
+
actor: identity.actor,
|
|
32
|
+
send: (message) => sendText(JSON.stringify(message)),
|
|
33
|
+
};
|
|
34
|
+
const leave = options.join(sendText, identity.actor);
|
|
35
|
+
let alive = true;
|
|
36
|
+
ws.on('pong', () => {
|
|
37
|
+
alive = true;
|
|
38
|
+
});
|
|
39
|
+
const ping = setInterval(() => {
|
|
40
|
+
if (!alive)
|
|
41
|
+
return ws.terminate();
|
|
42
|
+
alive = false;
|
|
43
|
+
ws.ping();
|
|
44
|
+
}, options.pingMs ?? PING_MS);
|
|
45
|
+
const recheck = identity.recheck;
|
|
46
|
+
const access = recheck === null
|
|
47
|
+
? null
|
|
48
|
+
: setInterval(() => {
|
|
49
|
+
void recheck().then((allowed) => {
|
|
50
|
+
if (!allowed)
|
|
51
|
+
ws.close(ACCESS_GONE, 'access is gone');
|
|
52
|
+
}, () => undefined);
|
|
53
|
+
}, options.recheckMs ?? RECHECK_ACCESS_MS);
|
|
54
|
+
ws.on('message', (data, binary) => {
|
|
55
|
+
if (binary)
|
|
56
|
+
return;
|
|
57
|
+
const message = parseClientMessage(String(data));
|
|
58
|
+
if ('event' in message)
|
|
59
|
+
client.send(message);
|
|
60
|
+
else
|
|
61
|
+
options.topics.handle(client, message);
|
|
62
|
+
});
|
|
63
|
+
ws.on('error', () => undefined);
|
|
64
|
+
ws.on('close', () => {
|
|
65
|
+
clearInterval(ping);
|
|
66
|
+
if (access)
|
|
67
|
+
clearInterval(access);
|
|
68
|
+
leave();
|
|
69
|
+
options.topics.drop(client);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Serves the live connection of the panel on the HTTP server; returns the function that stops it. */
|
|
73
|
+
export function serveLive(server, options) {
|
|
74
|
+
const sockets = new WebSocketServer({ noServer: true, maxPayload: MAX_MESSAGE_BYTES });
|
|
75
|
+
server.on('upgrade', (incoming, socket, head) => {
|
|
76
|
+
socket.on('error', () => undefined);
|
|
77
|
+
const path = new URL(incoming.url ?? '/', 'http://panel').pathname;
|
|
78
|
+
Promise.resolve()
|
|
79
|
+
.then(() => {
|
|
80
|
+
if (path !== LIVE_PATH)
|
|
81
|
+
throw panel('not_found', 'not found');
|
|
82
|
+
return options.identify(incoming);
|
|
83
|
+
})
|
|
84
|
+
.then((identity) => sockets.handleUpgrade(incoming, socket, head, (ws) => serve(ws, identity, options)), (error) => refuse(socket, error));
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
for (const ws of sockets.clients)
|
|
88
|
+
ws.terminate();
|
|
89
|
+
sockets.close();
|
|
90
|
+
options.topics.stop();
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=socket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../../src/presentation/web/live/socket.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAGrD,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAmB,MAAM,eAAe,CAAC;AAGvF,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AACnC,yFAAyF;AACzF,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC;AAC9B,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,0FAA0F;AAC1F,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACrC,2DAA2D;AAC3D,MAAM,WAAW,GAAG,IAAI,CAAC;AAYzB,mGAAmG;AACnG,SAAS,MAAM,CAAC,MAAc,EAAE,KAAc;IAC5C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,CACR,YAAY,MAAM,+DAA+D;QAC/E,mBAAmB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,gCAAgC,IAAI,EAAE,CACnF,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,SAAS,KAAK,CAAC,EAAa,EAAE,QAA4B,EAAE,OAAoB;IAC9E,MAAM,QAAQ,GAA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CAAC;QACnE,OAAO,CAAC,OAAO,EAAE;aACd,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,IAAI,KAAK,SAAS;gBAAE,MAAM,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC9D,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC,CAAC;aACD,IAAI,CACH,CAAC,QAAQ,EAAE,EAAE,CACX,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,EACrF,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAC1C,CAAC;IACN,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE;QACV,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,OAAO;YAAE,EAAE,CAAC,SAAS,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { topicError, } from './protocol.js';
|
|
2
|
+
/** A topic that is not read again more often than this, whatever happens. */
|
|
3
|
+
export const TOPIC_THROTTLE_MS = 5000;
|
|
4
|
+
function subscribersOf(entry) {
|
|
5
|
+
return [...entry.subscribers].flatMap(([client, ids]) => [...ids].map((id) => [client, id]));
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The topics whose data is one value (a group, its change documents, the providers): the value is
|
|
9
|
+
* read when the daemon says something changed and sent only when it differs from the last one.
|
|
10
|
+
*/
|
|
11
|
+
export class StateTopics {
|
|
12
|
+
read;
|
|
13
|
+
now;
|
|
14
|
+
entries = new Map();
|
|
15
|
+
constructor(read, now) {
|
|
16
|
+
this.read = read;
|
|
17
|
+
this.now = now;
|
|
18
|
+
}
|
|
19
|
+
/** Adds a subscriber; returns how to read its topic again and how to remove it. */
|
|
20
|
+
watch(client, id, topic) {
|
|
21
|
+
const key = JSON.stringify([client.actor ?? null, topic]);
|
|
22
|
+
let entry = this.entries.get(key);
|
|
23
|
+
if (!entry) {
|
|
24
|
+
entry = {
|
|
25
|
+
topic,
|
|
26
|
+
actor: client.actor,
|
|
27
|
+
subscribers: new Map(),
|
|
28
|
+
sent: null,
|
|
29
|
+
reading: false,
|
|
30
|
+
again: false,
|
|
31
|
+
readAt: -Infinity,
|
|
32
|
+
timer: null,
|
|
33
|
+
};
|
|
34
|
+
this.entries.set(key, entry);
|
|
35
|
+
}
|
|
36
|
+
else if (entry.sent !== null) {
|
|
37
|
+
client.send({ event: 'topic', id, data: JSON.parse(entry.sent) });
|
|
38
|
+
}
|
|
39
|
+
const ids = entry.subscribers.get(client) ?? new Set();
|
|
40
|
+
entry.subscribers.set(client, ids.add(id));
|
|
41
|
+
// The first read failed for those who came before: this subscriber gets its own answer.
|
|
42
|
+
if (entry.sent === null && !entry.reading)
|
|
43
|
+
void this.refresh(entry);
|
|
44
|
+
const watched = entry;
|
|
45
|
+
const stop = () => {
|
|
46
|
+
ids.delete(id);
|
|
47
|
+
if (ids.size === 0)
|
|
48
|
+
watched.subscribers.delete(client);
|
|
49
|
+
if (watched.subscribers.size > 0)
|
|
50
|
+
return;
|
|
51
|
+
if (watched.timer)
|
|
52
|
+
clearTimeout(watched.timer);
|
|
53
|
+
this.entries.delete(key);
|
|
54
|
+
};
|
|
55
|
+
return { stop, refresh: () => void this.refresh(watched) };
|
|
56
|
+
}
|
|
57
|
+
signal(signal) {
|
|
58
|
+
for (const entry of this.entries.values()) {
|
|
59
|
+
const { topic } = entry;
|
|
60
|
+
if (topic.kind === 'providers') {
|
|
61
|
+
// Status and limits of the providers follow the runs.
|
|
62
|
+
if (signal.event === 'run')
|
|
63
|
+
this.later(entry);
|
|
64
|
+
}
|
|
65
|
+
else if (topic.runId !== signal.runId) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
else if (signal.event === 'run') {
|
|
69
|
+
void this.refresh(entry);
|
|
70
|
+
}
|
|
71
|
+
else if (topic.kind === 'group_spec' && topic.watch && topic.group === signal.group) {
|
|
72
|
+
// An agent at work writes to its log; its documents may have changed with it.
|
|
73
|
+
this.later(entry);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
stop() {
|
|
78
|
+
for (const entry of this.entries.values())
|
|
79
|
+
if (entry.timer)
|
|
80
|
+
clearTimeout(entry.timer);
|
|
81
|
+
this.entries.clear();
|
|
82
|
+
}
|
|
83
|
+
/** Reads now, or once the quiet time since the last read is over. */
|
|
84
|
+
later(entry) {
|
|
85
|
+
if (entry.timer)
|
|
86
|
+
return;
|
|
87
|
+
const wait = entry.readAt + TOPIC_THROTTLE_MS - this.now();
|
|
88
|
+
if (wait <= 0) {
|
|
89
|
+
void this.refresh(entry);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
entry.timer = setTimeout(() => {
|
|
93
|
+
entry.timer = null;
|
|
94
|
+
void this.refresh(entry);
|
|
95
|
+
}, wait);
|
|
96
|
+
entry.timer.unref();
|
|
97
|
+
}
|
|
98
|
+
async refresh(entry) {
|
|
99
|
+
if (entry.reading) {
|
|
100
|
+
entry.again = true;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
entry.reading = true;
|
|
104
|
+
entry.readAt = this.now();
|
|
105
|
+
try {
|
|
106
|
+
const data = await this.read(entry.topic, entry.actor);
|
|
107
|
+
const text = JSON.stringify(data ?? null);
|
|
108
|
+
if (text !== entry.sent) {
|
|
109
|
+
entry.sent = text;
|
|
110
|
+
for (const [client, id] of subscribersOf(entry))
|
|
111
|
+
client.send({ event: 'topic', id, data });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
for (const [client, id] of subscribersOf(entry))
|
|
116
|
+
client.send(topicError(id, error));
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
entry.reading = false;
|
|
120
|
+
}
|
|
121
|
+
if (entry.again && entry.subscribers.size > 0) {
|
|
122
|
+
entry.again = false;
|
|
123
|
+
void this.refresh(entry);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=state-topics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-topics.js","sourceRoot":"","sources":["../../../../src/presentation/web/live/state-topics.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,eAAe,CAAC;AAEvB,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAetC,SAAS,aAAa,CAAC,KAAY;IACjC,OAAO,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,CACtD,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAwB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,WAAW;IACL,IAAI,CAAY;IAChB,GAAG,CAAe;IAClB,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEpD,YAAY,IAAe,EAAE,GAAiB;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,mFAAmF;IACnF,KAAK,CAAC,MAAkB,EAAE,EAAU,EAAE,KAAiB;QACrD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,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