@loompad/cli 0.1.0 → 1.1.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/ARCHITECTURE.md +96 -11
- package/CHANGELOG.md +1054 -0
- package/README.md +1473 -44
- package/THIRD_PARTY_NOTICES.md +275 -0
- package/dist/adapters/antigravity-cli.d.ts +62 -0
- package/dist/adapters/antigravity-cli.js +258 -0
- package/dist/adapters/antigravity-cli.js.map +1 -0
- package/dist/adapters/base.d.ts +61 -9
- package/dist/adapters/base.js +266 -15
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/bridges/antigravity.d.ts +9 -12
- package/dist/adapters/bridges/antigravity.js +9 -12
- package/dist/adapters/bridges/antigravity.js.map +1 -1
- package/dist/adapters/echo.d.ts +1 -0
- package/dist/adapters/echo.js +59 -3
- package/dist/adapters/echo.js.map +1 -1
- package/dist/adapters/grok.d.ts +7 -0
- package/dist/adapters/grok.js +20 -10
- package/dist/adapters/grok.js.map +1 -1
- package/dist/adapters/index.d.ts +5 -1
- package/dist/adapters/index.js +53 -7
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/model.d.ts +137 -0
- package/dist/adapters/model.js +527 -0
- package/dist/adapters/model.js.map +1 -0
- package/dist/adapters/opencode.d.ts +101 -1
- package/dist/adapters/opencode.js +874 -98
- package/dist/adapters/opencode.js.map +1 -1
- package/dist/cli/doctor.d.ts +32 -0
- package/dist/cli/doctor.js +89 -4
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.js +2651 -87
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tui-model.js +3 -1
- package/dist/cli/tui-model.js.map +1 -1
- package/dist/cli/tui.js +44 -1
- package/dist/cli/tui.js.map +1 -1
- package/dist/cli/ui.d.ts +2 -0
- package/dist/cli/ui.js +13 -0
- package/dist/cli/ui.js.map +1 -1
- package/dist/core/ades.d.ts +32 -16
- package/dist/core/ades.js +57 -20
- package/dist/core/ades.js.map +1 -1
- package/dist/core/agent-state.d.ts +14 -0
- package/dist/core/agent-state.js +32 -0
- package/dist/core/agent-state.js.map +1 -0
- package/dist/core/approvals.d.ts +33 -0
- package/dist/core/approvals.js +29 -0
- package/dist/core/approvals.js.map +1 -0
- package/dist/core/backup.d.ts +19 -0
- package/dist/core/backup.js +86 -0
- package/dist/core/backup.js.map +1 -0
- package/dist/core/baton.d.ts +2 -2
- package/dist/core/baton.js.map +1 -1
- package/dist/core/brain-extract.d.ts +17 -0
- package/dist/core/brain-extract.js +28 -2
- package/dist/core/brain-extract.js.map +1 -1
- package/dist/core/brain-index.d.ts +71 -0
- package/dist/core/brain-index.js +204 -5
- package/dist/core/brain-index.js.map +1 -1
- package/dist/core/brain.d.ts +58 -2
- package/dist/core/brain.js +79 -1
- package/dist/core/brain.js.map +1 -1
- package/dist/core/chat-import.d.ts +71 -0
- package/dist/core/chat-import.js +419 -0
- package/dist/core/chat-import.js.map +1 -0
- package/dist/core/checkpoint.d.ts +107 -0
- package/dist/core/checkpoint.js +259 -0
- package/dist/core/checkpoint.js.map +1 -0
- package/dist/core/claude-cli.js +1 -1
- package/dist/core/claude-cli.js.map +1 -1
- package/dist/core/continuity/artifacts.d.ts +14 -0
- package/dist/core/continuity/artifacts.js +118 -0
- package/dist/core/continuity/artifacts.js.map +1 -0
- package/dist/core/continuity/capabilities.d.ts +65 -0
- package/dist/core/continuity/capabilities.js +129 -0
- package/dist/core/continuity/capabilities.js.map +1 -0
- package/dist/core/continuity/contracts.d.ts +352 -0
- package/dist/core/continuity/contracts.js +117 -0
- package/dist/core/continuity/contracts.js.map +1 -0
- package/dist/core/continuity/engine.d.ts +55 -0
- package/dist/core/continuity/engine.js +504 -0
- package/dist/core/continuity/engine.js.map +1 -0
- package/dist/core/continuity/store.d.ts +73 -0
- package/dist/core/continuity/store.js +438 -0
- package/dist/core/continuity/store.js.map +1 -0
- package/dist/core/conversations.d.ts +19 -0
- package/dist/core/conversations.js +87 -0
- package/dist/core/conversations.js.map +1 -0
- package/dist/core/crew-coordination.d.ts +6 -0
- package/dist/core/crew-coordination.js +24 -0
- package/dist/core/crew-coordination.js.map +1 -0
- package/dist/core/crew-policy.d.ts +18 -0
- package/dist/core/crew-policy.js +40 -0
- package/dist/core/crew-policy.js.map +1 -0
- package/dist/core/crew-protocol.d.ts +64 -0
- package/dist/core/crew-protocol.js +146 -0
- package/dist/core/crew-protocol.js.map +1 -0
- package/dist/core/crew-requests.d.ts +14 -0
- package/dist/core/crew-requests.js +22 -0
- package/dist/core/crew-requests.js.map +1 -0
- package/dist/core/crew.d.ts +395 -0
- package/dist/core/crew.js +1857 -0
- package/dist/core/crew.js.map +1 -0
- package/dist/core/digest.d.ts +40 -0
- package/dist/core/digest.js +94 -0
- package/dist/core/digest.js.map +1 -0
- package/dist/core/distill.js +3 -5
- package/dist/core/distill.js.map +1 -1
- package/dist/core/eventlog.d.ts +27 -25
- package/dist/core/eventlog.js +97 -150
- package/dist/core/eventlog.js.map +1 -1
- package/dist/core/events/contracts.d.ts +51 -0
- package/dist/core/events/contracts.js +2 -0
- package/dist/core/events/contracts.js.map +1 -0
- package/dist/core/events/jsonl-store.d.ts +23 -0
- package/dist/core/events/jsonl-store.js +90 -0
- package/dist/core/events/jsonl-store.js.map +1 -0
- package/dist/core/events/sqlite-store.d.ts +37 -0
- package/dist/core/events/sqlite-store.js +215 -0
- package/dist/core/events/sqlite-store.js.map +1 -0
- package/dist/core/forecast.d.ts +44 -0
- package/dist/core/forecast.js +46 -0
- package/dist/core/forecast.js.map +1 -0
- package/dist/core/free-pool.d.ts +65 -0
- package/dist/core/free-pool.js +171 -0
- package/dist/core/free-pool.js.map +1 -0
- package/dist/core/git.d.ts +30 -0
- package/dist/core/git.js +50 -2
- package/dist/core/git.js.map +1 -1
- package/dist/core/github-events.d.ts +53 -0
- package/dist/core/github-events.js +227 -0
- package/dist/core/github-events.js.map +1 -0
- package/dist/core/goal-lanes.d.ts +53 -0
- package/dist/core/goal-lanes.js +99 -0
- package/dist/core/goal-lanes.js.map +1 -0
- package/dist/core/hosted.d.ts +27 -0
- package/dist/core/hosted.js +50 -0
- package/dist/core/hosted.js.map +1 -0
- package/dist/core/http-server.d.ts +5 -0
- package/dist/core/http-server.js +8 -0
- package/dist/core/http-server.js.map +1 -0
- package/dist/core/invite-link.d.ts +31 -0
- package/dist/core/invite-link.js +45 -0
- package/dist/core/invite-link.js.map +1 -0
- package/dist/core/loops.d.ts +37 -0
- package/dist/core/loops.js +81 -0
- package/dist/core/loops.js.map +1 -0
- package/dist/core/mcp-catalog.d.ts +182 -0
- package/dist/core/mcp-catalog.js +431 -0
- package/dist/core/mcp-catalog.js.map +1 -0
- package/dist/core/mcp.d.ts +87 -0
- package/dist/core/mcp.js +181 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/memory.d.ts +1 -0
- package/dist/core/memory.js +5 -2
- package/dist/core/memory.js.map +1 -1
- package/dist/core/model-tools.d.ts +97 -0
- package/dist/core/model-tools.js +388 -0
- package/dist/core/model-tools.js.map +1 -0
- package/dist/core/notify.js +19 -1
- package/dist/core/notify.js.map +1 -1
- package/dist/core/orchestra.d.ts +635 -0
- package/dist/core/orchestra.js +2120 -0
- package/dist/core/orchestra.js.map +1 -0
- package/dist/core/permissions.d.ts +56 -0
- package/dist/core/permissions.js +122 -0
- package/dist/core/permissions.js.map +1 -0
- package/dist/core/preview-proxy.d.ts +70 -0
- package/dist/core/preview-proxy.js +563 -0
- package/dist/core/preview-proxy.js.map +1 -0
- package/dist/core/preview-shot.d.ts +46 -0
- package/dist/core/preview-shot.js +109 -0
- package/dist/core/preview-shot.js.map +1 -0
- package/dist/core/process.d.ts +36 -0
- package/dist/core/process.js +168 -0
- package/dist/core/process.js.map +1 -0
- package/dist/core/prompt-queue.d.ts +136 -0
- package/dist/core/prompt-queue.js +269 -0
- package/dist/core/prompt-queue.js.map +1 -0
- package/dist/core/prompts.d.ts +53 -0
- package/dist/core/prompts.js +127 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/proof.d.ts +82 -0
- package/dist/core/proof.js +216 -0
- package/dist/core/proof.js.map +1 -0
- package/dist/core/provider-text.d.ts +23 -0
- package/dist/core/provider-text.js +66 -0
- package/dist/core/provider-text.js.map +1 -0
- package/dist/core/providers.d.ts +152 -0
- package/dist/core/providers.js +343 -0
- package/dist/core/providers.js.map +1 -0
- package/dist/core/quota.d.ts +33 -0
- package/dist/core/quota.js +74 -0
- package/dist/core/quota.js.map +1 -0
- package/dist/core/recipes.d.ts +50 -0
- package/dist/core/recipes.js +99 -0
- package/dist/core/recipes.js.map +1 -0
- package/dist/core/registry.d.ts +54 -0
- package/dist/core/registry.js +62 -5
- package/dist/core/registry.js.map +1 -1
- package/dist/core/relay-client.d.ts +67 -0
- package/dist/core/relay-client.js +184 -0
- package/dist/core/relay-client.js.map +1 -0
- package/dist/core/relay-protocol.d.ts +140 -0
- package/dist/core/relay-protocol.js +189 -0
- package/dist/core/relay-protocol.js.map +1 -0
- package/dist/core/replay.d.ts +18 -0
- package/dist/core/replay.js +191 -0
- package/dist/core/replay.js.map +1 -0
- package/dist/core/review-triage.d.ts +41 -0
- package/dist/core/review-triage.js +124 -0
- package/dist/core/review-triage.js.map +1 -0
- package/dist/core/router.js +2 -2
- package/dist/core/router.js.map +1 -1
- package/dist/core/routes.d.ts +39 -3
- package/dist/core/routes.js +137 -4
- package/dist/core/routes.js.map +1 -1
- package/dist/core/run-command.d.ts +14 -0
- package/dist/core/run-command.js +45 -0
- package/dist/core/run-command.js.map +1 -0
- package/dist/core/runner-setup.d.ts +36 -0
- package/dist/core/runner-setup.js +114 -0
- package/dist/core/runner-setup.js.map +1 -0
- package/dist/core/search.js +0 -0
- package/dist/core/search.js.map +1 -1
- package/dist/core/semantic.d.ts +92 -0
- package/dist/core/semantic.js +227 -0
- package/dist/core/semantic.js.map +1 -0
- package/dist/core/servers.d.ts +115 -0
- package/dist/core/servers.js +305 -0
- package/dist/core/servers.js.map +1 -0
- package/dist/core/setup.js +64 -6
- package/dist/core/setup.js.map +1 -1
- package/dist/core/shield.d.ts +17 -0
- package/dist/core/shield.js +81 -0
- package/dist/core/shield.js.map +1 -0
- package/dist/core/shift.d.ts +69 -0
- package/dist/core/shift.js +120 -0
- package/dist/core/shift.js.map +1 -0
- package/dist/core/skill-install.d.ts +125 -0
- package/dist/core/skill-install.js +328 -0
- package/dist/core/skill-install.js.map +1 -0
- package/dist/core/skills.d.ts +116 -0
- package/dist/core/skills.js +223 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/step-conditions.d.ts +65 -0
- package/dist/core/step-conditions.js +102 -0
- package/dist/core/step-conditions.js.map +1 -0
- package/dist/core/subagents.d.ts +45 -0
- package/dist/core/subagents.js +90 -0
- package/dist/core/subagents.js.map +1 -0
- package/dist/core/team-canon.d.ts +42 -0
- package/dist/core/team-canon.js +121 -0
- package/dist/core/team-canon.js.map +1 -0
- package/dist/core/team-crypto.d.ts +97 -0
- package/dist/core/team-crypto.js +175 -0
- package/dist/core/team-crypto.js.map +1 -0
- package/dist/core/team-hub.d.ts +514 -0
- package/dist/core/team-hub.js +964 -0
- package/dist/core/team-hub.js.map +1 -0
- package/dist/core/team-landing.d.ts +239 -0
- package/dist/core/team-landing.js +504 -0
- package/dist/core/team-landing.js.map +1 -0
- package/dist/core/team-leases.d.ts +44 -0
- package/dist/core/team-leases.js +145 -0
- package/dist/core/team-leases.js.map +1 -0
- package/dist/core/team-memory.d.ts +42 -0
- package/dist/core/team-memory.js +84 -0
- package/dist/core/team-memory.js.map +1 -0
- package/dist/core/team-policy.d.ts +85 -0
- package/dist/core/team-policy.js +191 -0
- package/dist/core/team-policy.js.map +1 -0
- package/dist/core/thread-md.d.ts +6 -0
- package/dist/core/thread-md.js +42 -0
- package/dist/core/thread-md.js.map +1 -0
- package/dist/core/turn-stats.d.ts +61 -0
- package/dist/core/turn-stats.js +124 -0
- package/dist/core/turn-stats.js.map +1 -0
- package/dist/core/updater.d.ts +73 -0
- package/dist/core/updater.js +153 -0
- package/dist/core/updater.js.map +1 -0
- package/dist/core/usage.d.ts +75 -0
- package/dist/core/usage.js +163 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/core/windows-jobs.d.ts +15 -0
- package/dist/core/windows-jobs.js +170 -0
- package/dist/core/windows-jobs.js.map +1 -0
- package/dist/core/worktree-merge.d.ts +57 -0
- package/dist/core/worktree-merge.js +123 -0
- package/dist/core/worktree-merge.js.map +1 -0
- package/dist/core/worktree.d.ts +5 -0
- package/dist/core/worktree.js +45 -5
- package/dist/core/worktree.js.map +1 -1
- package/dist/core/worktrees.d.ts +6 -0
- package/dist/core/worktrees.js +21 -0
- package/dist/core/worktrees.js.map +1 -0
- package/dist/daemon/app-page.d.ts +0 -17
- package/dist/daemon/app-page.js +10 -6346
- package/dist/daemon/app-page.js.map +1 -1
- package/dist/daemon/auth.d.ts +24 -3
- package/dist/daemon/auth.js +66 -7
- package/dist/daemon/auth.js.map +1 -1
- package/dist/daemon/board.d.ts +7 -0
- package/dist/daemon/board.js +12 -1
- package/dist/daemon/board.js.map +1 -1
- package/dist/daemon/brand-icons.d.ts +6 -1
- package/dist/daemon/brand-icons.js +11 -3
- package/dist/daemon/brand-icons.js.map +1 -1
- package/dist/daemon/client.d.ts +665 -1
- package/dist/daemon/client.js +381 -3
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/delivery.d.ts +34 -0
- package/dist/daemon/delivery.js +63 -0
- package/dist/daemon/delivery.js.map +1 -0
- package/dist/daemon/deploys.d.ts +62 -0
- package/dist/daemon/deploys.js +159 -0
- package/dist/daemon/deploys.js.map +1 -0
- package/dist/daemon/landing.d.ts +192 -0
- package/dist/daemon/landing.js +992 -0
- package/dist/daemon/landing.js.map +1 -0
- package/dist/daemon/onboard.d.ts +150 -0
- package/dist/daemon/onboard.js +390 -0
- package/dist/daemon/onboard.js.map +1 -0
- package/dist/daemon/proof.d.ts +70 -0
- package/dist/daemon/proof.js +172 -0
- package/dist/daemon/proof.js.map +1 -0
- package/dist/daemon/push.d.ts +19 -1
- package/dist/daemon/push.js +90 -3
- package/dist/daemon/push.js.map +1 -1
- package/dist/daemon/relay.d.ts +82 -0
- package/dist/daemon/relay.js +351 -0
- package/dist/daemon/relay.js.map +1 -0
- package/dist/daemon/routes/agent-discovery.d.ts +4 -0
- package/dist/daemon/routes/agent-discovery.js +29 -0
- package/dist/daemon/routes/agent-discovery.js.map +1 -0
- package/dist/daemon/routes/agent-settings.d.ts +4 -0
- package/dist/daemon/routes/agent-settings.js +94 -0
- package/dist/daemon/routes/agent-settings.js.map +1 -0
- package/dist/daemon/routes/agents.d.ts +4 -0
- package/dist/daemon/routes/agents.js +105 -0
- package/dist/daemon/routes/agents.js.map +1 -0
- package/dist/daemon/routes/alerts.d.ts +4 -0
- package/dist/daemon/routes/alerts.js +137 -0
- package/dist/daemon/routes/alerts.js.map +1 -0
- package/dist/daemon/routes/approvals.d.ts +4 -0
- package/dist/daemon/routes/approvals.js +40 -0
- package/dist/daemon/routes/approvals.js.map +1 -0
- package/dist/daemon/routes/assets.d.ts +3 -0
- package/dist/daemon/routes/assets.js +64 -0
- package/dist/daemon/routes/assets.js.map +1 -0
- package/dist/daemon/routes/board.d.ts +4 -0
- package/dist/daemon/routes/board.js +147 -0
- package/dist/daemon/routes/board.js.map +1 -0
- package/dist/daemon/routes/brain.d.ts +4 -0
- package/dist/daemon/routes/brain.js +270 -0
- package/dist/daemon/routes/brain.js.map +1 -0
- package/dist/daemon/routes/chats.d.ts +4 -0
- package/dist/daemon/routes/chats.js +249 -0
- package/dist/daemon/routes/chats.js.map +1 -0
- package/dist/daemon/routes/clients.d.ts +4 -0
- package/dist/daemon/routes/clients.js +49 -0
- package/dist/daemon/routes/clients.js.map +1 -0
- package/dist/daemon/routes/cloud.d.ts +4 -0
- package/dist/daemon/routes/cloud.js +46 -0
- package/dist/daemon/routes/cloud.js.map +1 -0
- package/dist/daemon/routes/config.d.ts +4 -0
- package/dist/daemon/routes/config.js +35 -0
- package/dist/daemon/routes/config.js.map +1 -0
- package/dist/daemon/routes/context.d.ts +51 -0
- package/dist/daemon/routes/context.js +2 -0
- package/dist/daemon/routes/context.js.map +1 -0
- package/dist/daemon/routes/crews.d.ts +4 -0
- package/dist/daemon/routes/crews.js +149 -0
- package/dist/daemon/routes/crews.js.map +1 -0
- package/dist/daemon/routes/files.d.ts +3 -0
- package/dist/daemon/routes/files.js +253 -0
- package/dist/daemon/routes/files.js.map +1 -0
- package/dist/daemon/routes/git.d.ts +4 -0
- package/dist/daemon/routes/git.js +96 -0
- package/dist/daemon/routes/git.js.map +1 -0
- package/dist/daemon/routes/history.d.ts +4 -0
- package/dist/daemon/routes/history.js +101 -0
- package/dist/daemon/routes/history.js.map +1 -0
- package/dist/daemon/routes/integrations-project.d.ts +3 -0
- package/dist/daemon/routes/integrations-project.js +103 -0
- package/dist/daemon/routes/integrations-project.js.map +1 -0
- package/dist/daemon/routes/integrations.d.ts +3 -0
- package/dist/daemon/routes/integrations.js +111 -0
- package/dist/daemon/routes/integrations.js.map +1 -0
- package/dist/daemon/routes/logs.d.ts +3 -0
- package/dist/daemon/routes/logs.js +40 -0
- package/dist/daemon/routes/logs.js.map +1 -0
- package/dist/daemon/routes/messages.d.ts +4 -0
- package/dist/daemon/routes/messages.js +60 -0
- package/dist/daemon/routes/messages.js.map +1 -0
- package/dist/daemon/routes/observability.d.ts +4 -0
- package/dist/daemon/routes/observability.js +247 -0
- package/dist/daemon/routes/observability.js.map +1 -0
- package/dist/daemon/routes/onboard.d.ts +12 -0
- package/dist/daemon/routes/onboard.js +67 -0
- package/dist/daemon/routes/onboard.js.map +1 -0
- package/dist/daemon/routes/orchestra.d.ts +4 -0
- package/dist/daemon/routes/orchestra.js +110 -0
- package/dist/daemon/routes/orchestra.js.map +1 -0
- package/dist/daemon/routes/pairing.d.ts +4 -0
- package/dist/daemon/routes/pairing.js +155 -0
- package/dist/daemon/routes/pairing.js.map +1 -0
- package/dist/daemon/routes/preview.d.ts +24 -0
- package/dist/daemon/routes/preview.js +122 -0
- package/dist/daemon/routes/preview.js.map +1 -0
- package/dist/daemon/routes/project-actions.d.ts +4 -0
- package/dist/daemon/routes/project-actions.js +53 -0
- package/dist/daemon/routes/project-actions.js.map +1 -0
- package/dist/daemon/routes/project-team.d.ts +4 -0
- package/dist/daemon/routes/project-team.js +201 -0
- package/dist/daemon/routes/project-team.js.map +1 -0
- package/dist/daemon/routes/projects.d.ts +14 -0
- package/dist/daemon/routes/projects.js +138 -0
- package/dist/daemon/routes/projects.js.map +1 -0
- package/dist/daemon/routes/prompts.d.ts +4 -0
- package/dist/daemon/routes/prompts.js +44 -0
- package/dist/daemon/routes/prompts.js.map +1 -0
- package/dist/daemon/routes/proof.d.ts +4 -0
- package/dist/daemon/routes/proof.js +22 -0
- package/dist/daemon/routes/proof.js.map +1 -0
- package/dist/daemon/routes/providers.d.ts +3 -0
- package/dist/daemon/routes/providers.js +60 -0
- package/dist/daemon/routes/providers.js.map +1 -0
- package/dist/daemon/routes/public.d.ts +4 -0
- package/dist/daemon/routes/public.js +64 -0
- package/dist/daemon/routes/public.js.map +1 -0
- package/dist/daemon/routes/queue.d.ts +4 -0
- package/dist/daemon/routes/queue.js +140 -0
- package/dist/daemon/routes/queue.js.map +1 -0
- package/dist/daemon/routes/routing.d.ts +4 -0
- package/dist/daemon/routes/routing.js +61 -0
- package/dist/daemon/routes/routing.js.map +1 -0
- package/dist/daemon/routes/runtime-handler.d.ts +2 -0
- package/dist/daemon/routes/runtime-handler.js +63 -0
- package/dist/daemon/routes/runtime-handler.js.map +1 -0
- package/dist/daemon/routes/search.d.ts +4 -0
- package/dist/daemon/routes/search.js +17 -0
- package/dist/daemon/routes/search.js.map +1 -0
- package/dist/daemon/routes/servers.d.ts +4 -0
- package/dist/daemon/routes/servers.js +133 -0
- package/dist/daemon/routes/servers.js.map +1 -0
- package/dist/daemon/routes/setup.d.ts +3 -0
- package/dist/daemon/routes/setup.js +50 -0
- package/dist/daemon/routes/setup.js.map +1 -0
- package/dist/daemon/routes/shift.d.ts +4 -0
- package/dist/daemon/routes/shift.js +30 -0
- package/dist/daemon/routes/shift.js.map +1 -0
- package/dist/daemon/routes/specs.d.ts +4 -0
- package/dist/daemon/routes/specs.js +57 -0
- package/dist/daemon/routes/specs.js.map +1 -0
- package/dist/daemon/routes/task-delivery.d.ts +4 -0
- package/dist/daemon/routes/task-delivery.js +38 -0
- package/dist/daemon/routes/task-delivery.js.map +1 -0
- package/dist/daemon/routes/team.d.ts +4 -0
- package/dist/daemon/routes/team.js +193 -0
- package/dist/daemon/routes/team.js.map +1 -0
- package/dist/daemon/routes/terminals.d.ts +4 -0
- package/dist/daemon/routes/terminals.js +87 -0
- package/dist/daemon/routes/terminals.js.map +1 -0
- package/dist/daemon/routes/tools.d.ts +4 -0
- package/dist/daemon/routes/tools.js +180 -0
- package/dist/daemon/routes/tools.js.map +1 -0
- package/dist/daemon/routes/updates.d.ts +4 -0
- package/dist/daemon/routes/updates.js +89 -0
- package/dist/daemon/routes/updates.js.map +1 -0
- package/dist/daemon/routes/voice.d.ts +4 -0
- package/dist/daemon/routes/voice.js +53 -0
- package/dist/daemon/routes/voice.js.map +1 -0
- package/dist/daemon/runner.d.ts +186 -0
- package/dist/daemon/runner.js +612 -0
- package/dist/daemon/runner.js.map +1 -0
- package/dist/daemon/runtime/accounting.d.ts +130 -0
- package/dist/daemon/runtime/accounting.js +303 -0
- package/dist/daemon/runtime/accounting.js.map +1 -0
- package/dist/daemon/runtime/agents.d.ts +16 -0
- package/dist/daemon/runtime/agents.js +71 -0
- package/dist/daemon/runtime/agents.js.map +1 -0
- package/dist/daemon/runtime/briefings.d.ts +134 -0
- package/dist/daemon/runtime/briefings.js +329 -0
- package/dist/daemon/runtime/briefings.js.map +1 -0
- package/dist/daemon/runtime/native-usage.d.ts +21 -0
- package/dist/daemon/runtime/native-usage.js +71 -0
- package/dist/daemon/runtime/native-usage.js.map +1 -0
- package/dist/daemon/runtime/queue.d.ts +94 -0
- package/dist/daemon/runtime/queue.js +222 -0
- package/dist/daemon/runtime/queue.js.map +1 -0
- package/dist/daemon/runtime/relay.d.ts +93 -0
- package/dist/daemon/runtime/relay.js +240 -0
- package/dist/daemon/runtime/relay.js.map +1 -0
- package/dist/daemon/runtime/turns.d.ts +202 -0
- package/dist/daemon/runtime/turns.js +663 -0
- package/dist/daemon/runtime/turns.js.map +1 -0
- package/dist/daemon/runtime-support.d.ts +76 -0
- package/dist/daemon/runtime-support.js +134 -0
- package/dist/daemon/runtime-support.js.map +1 -0
- package/dist/daemon/runtime.d.ts +739 -70
- package/dist/daemon/runtime.js +2751 -470
- package/dist/daemon/runtime.js.map +1 -1
- package/dist/daemon/server.d.ts +82 -55
- package/dist/daemon/server.js +674 -1435
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/shift.d.ts +70 -0
- package/dist/daemon/shift.js +170 -0
- package/dist/daemon/shift.js.map +1 -0
- package/dist/daemon/specs.d.ts +92 -0
- package/dist/daemon/specs.js +285 -0
- package/dist/daemon/specs.js.map +1 -0
- package/dist/daemon/system.d.ts +208 -0
- package/dist/daemon/system.js +557 -0
- package/dist/daemon/system.js.map +1 -0
- package/dist/daemon/tasks.js +1 -1
- package/dist/daemon/team-brain.d.ts +136 -0
- package/dist/daemon/team-brain.js +659 -0
- package/dist/daemon/team-brain.js.map +1 -0
- package/dist/daemon/team-coordinator.d.ts +78 -0
- package/dist/daemon/team-coordinator.js +408 -0
- package/dist/daemon/team-coordinator.js.map +1 -0
- package/dist/daemon/team.d.ts +339 -0
- package/dist/daemon/team.js +1433 -0
- package/dist/daemon/team.js.map +1 -0
- package/dist/daemon/terminals.d.ts +22 -3
- package/dist/daemon/terminals.js +236 -16
- package/dist/daemon/terminals.js.map +1 -1
- package/dist/hub/client.d.ts +120 -0
- package/dist/hub/client.js +228 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/hub/server.d.ts +32 -0
- package/dist/hub/server.js +180 -0
- package/dist/hub/server.js.map +1 -0
- package/dist/hub/supabase-client.d.ts +220 -0
- package/dist/hub/supabase-client.js +843 -0
- package/dist/hub/supabase-client.js.map +1 -0
- package/dist/observability/ask.d.ts +91 -0
- package/dist/observability/ask.js +179 -0
- package/dist/observability/ask.js.map +1 -0
- package/dist/observability/clickhouse.d.ts +33 -0
- package/dist/observability/clickhouse.js +48 -0
- package/dist/observability/clickhouse.js.map +1 -0
- package/dist/observability/decisions.d.ts +176 -0
- package/dist/observability/decisions.js +377 -0
- package/dist/observability/decisions.js.map +1 -0
- package/dist/observability/index.d.ts +89 -0
- package/dist/observability/index.js +348 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/insights.d.ts +151 -0
- package/dist/observability/insights.js +319 -0
- package/dist/observability/insights.js.map +1 -0
- package/dist/observability/logs-query.d.ts +82 -0
- package/dist/observability/logs-query.js +102 -0
- package/dist/observability/logs-query.js.map +1 -0
- package/dist/observability/logs.d.ts +72 -0
- package/dist/observability/logs.js +295 -0
- package/dist/observability/logs.js.map +1 -0
- package/dist/observability/metrics.d.ts +86 -0
- package/dist/observability/metrics.js +303 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/otlp.d.ts +127 -0
- package/dist/observability/otlp.js +242 -0
- package/dist/observability/otlp.js.map +1 -0
- package/dist/observability/snapshots.d.ts +43 -0
- package/dist/observability/snapshots.js +129 -0
- package/dist/observability/snapshots.js.map +1 -0
- package/dist/observability/triage.d.ts +49 -0
- package/dist/observability/triage.js +284 -0
- package/dist/observability/triage.js.map +1 -0
- package/dist/providers/adapter.d.ts +50 -0
- package/dist/providers/adapter.js +38 -0
- package/dist/providers/adapter.js.map +1 -0
- package/dist/providers/agent.d.ts +110 -0
- package/dist/providers/agent.js +487 -0
- package/dist/providers/agent.js.map +1 -0
- package/dist/providers/approvals.d.ts +24 -0
- package/dist/providers/approvals.js +78 -0
- package/dist/providers/approvals.js.map +1 -0
- package/dist/providers/attachments.d.ts +20 -0
- package/dist/providers/attachments.js +51 -0
- package/dist/providers/attachments.js.map +1 -0
- package/dist/providers/claude/adapter.d.ts +99 -0
- package/dist/providers/claude/adapter.js +790 -0
- package/dist/providers/claude/adapter.js.map +1 -0
- package/dist/providers/codex/adapter.d.ts +113 -0
- package/dist/providers/codex/adapter.js +881 -0
- package/dist/providers/codex/adapter.js.map +1 -0
- package/dist/providers/codex/instructions.d.ts +11 -0
- package/dist/providers/codex/instructions.js +154 -0
- package/dist/providers/codex/instructions.js.map +1 -0
- package/dist/providers/codex/rpc.d.ts +36 -0
- package/dist/providers/codex/rpc.js +104 -0
- package/dist/providers/codex/rpc.js.map +1 -0
- package/dist/providers/contracts.d.ts +339 -0
- package/dist/providers/contracts.js +19 -0
- package/dist/providers/contracts.js.map +1 -0
- package/dist/providers/directory.d.ts +70 -0
- package/dist/providers/directory.js +95 -0
- package/dist/providers/directory.js.map +1 -0
- package/dist/providers/errors.d.ts +47 -0
- package/dist/providers/errors.js +24 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/index.d.ts +18 -0
- package/dist/providers/index.js +19 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/ingestion.d.ts +80 -0
- package/dist/providers/ingestion.js +330 -0
- package/dist/providers/ingestion.js.map +1 -0
- package/dist/providers/live.d.ts +22 -0
- package/dist/providers/live.js +56 -0
- package/dist/providers/live.js.map +1 -0
- package/dist/providers/process.d.ts +29 -0
- package/dist/providers/process.js +71 -0
- package/dist/providers/process.js.map +1 -0
- package/dist/providers/reaper.d.ts +33 -0
- package/dist/providers/reaper.js +65 -0
- package/dist/providers/reaper.js.map +1 -0
- package/dist/providers/service.d.ts +87 -0
- package/dist/providers/service.js +256 -0
- package/dist/providers/service.js.map +1 -0
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.js.map +1 -1
- package/dist/types.d.ts +385 -6
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +7 -0
- package/dist/version.js +16 -0
- package/dist/version.js.map +1 -0
- package/dist/web/app.css +4646 -0
- package/dist/web/app.js +22640 -0
- package/dist/web/app.js.map +7 -0
- package/dist/web/shell.html +39 -0
- package/docs/README.md +21 -0
- package/docs/SETUP.md +10 -0
- package/docs/adapters.md +21 -8
- package/docs/brain-continuity.md +186 -0
- package/docs/cloud.md +108 -0
- package/docs/crews.md +62 -0
- package/docs/design-system.md +31 -2
- package/docs/integration-notes.md +128 -20
- package/docs/loompad.md +105 -0
- package/docs/observability.md +220 -0
- package/docs/play-store.md +123 -0
- package/docs/proposals/agent-teams.md +249 -0
- package/docs/proposals/brain-continuity-implementation.md +468 -0
- package/docs/proposals/brain-session-continuity.md +623 -0
- package/docs/proposals/t3code-port.md +81 -0
- package/docs/proposals/t3code-reference.md +95 -0
- package/docs/refactoring/AGENT-TEAMS-PROGRESS.md +88 -0
- package/docs/refactoring/BOUNDARIES.md +120 -0
- package/docs/refactoring/BRAIN-AUDIT.md +176 -0
- package/docs/refactoring/BRAIN-NOTES.md +390 -0
- package/docs/refactoring/BRAIN-TODO.md +214 -0
- package/docs/refactoring/NOTES.md +129 -0
- package/docs/refactoring/T3-PORT-NOTES.md +165 -0
- package/docs/refactoring/T3-PORT-TODO.md +123 -0
- package/docs/refactoring/TODO.md +46 -0
- package/docs/refactoring/brain-benchmark-2026-09-28.json +48 -0
- package/docs/refactoring/brain-benchmark-audit-2026-09-28.json +48 -0
- package/docs/release-notes/v0.2.0.md +35 -0
- package/docs/release-notes/v0.2.1.md +59 -0
- package/docs/release-notes/v0.2.3.md +77 -0
- package/docs/release-notes/v0.2.4.md +128 -0
- package/docs/release-notes/v0.2.5.md +153 -0
- package/docs/release-notes/v0.2.6.md +62 -0
- package/docs/release-notes/v1.0.0.md +120 -0
- package/docs/release-notes/v1.0.1.md +77 -0
- package/docs/release-notes/v1.1.0.md +71 -0
- package/docs/release-notes/v1.1.1.md +38 -0
- package/docs/release-notes/v1.1.2.md +21 -0
- package/docs/teams-architecture.md +697 -0
- package/docs/teams.md +171 -0
- package/docs/windows.md +85 -0
- package/package.json +22 -9
- package/dist/adapters/claude-code.d.ts +0 -26
- package/dist/adapters/claude-code.js +0 -209
- package/dist/adapters/claude-code.js.map +0 -1
- package/dist/adapters/codex.d.ts +0 -51
- package/dist/adapters/codex.js +0 -291
- package/dist/adapters/codex.js.map +0 -1
- package/docs/img/board-linear.png +0 -0
- package/docs/img/board-projects.png +0 -0
- package/docs/img/brain.png +0 -0
- package/docs/img/settings.png +0 -0
- package/docs/img/workspace.png +0 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loom Teams — the hub protocol, and an in-memory hub that is its reference.
|
|
3
|
+
*
|
|
4
|
+
* The Team Hub is the thin coordination plane between members' daemons
|
|
5
|
+
* (docs/teams-architecture.md). Three implementations speak `HubClient`:
|
|
6
|
+
*
|
|
7
|
+
* - MemoryHub (here): in-process, authoritative for the rules. Tests and the
|
|
8
|
+
* local hub server both run it, so the rules are written once.
|
|
9
|
+
* - HttpHubClient (src/hub/client.ts): talks to `loom hub` — a self-hosted
|
|
10
|
+
* hub with no Supabase (D1), and the way two daemons meet in tests.
|
|
11
|
+
* - Supabase (supabase/migrations/0002_teams.sql): the hosted hub, the same
|
|
12
|
+
* rules as row-level security and SQL functions.
|
|
13
|
+
*
|
|
14
|
+
* Phase 1 ("see each other"): teams, members, devices, invites, key envelopes,
|
|
15
|
+
* shared repos, presence heartbeats and a durable feed. What the hub stores is
|
|
16
|
+
* plain metadata plus sealed content it cannot read (D2).
|
|
17
|
+
*/
|
|
18
|
+
import type { Sealed } from "./team-crypto.js";
|
|
19
|
+
import { type LeaseScope } from "./team-leases.js";
|
|
20
|
+
export type TeamRole = "owner" | "member" | "viewer";
|
|
21
|
+
export interface HubUser {
|
|
22
|
+
id: string;
|
|
23
|
+
github: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
export interface Team {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
createdAt: number;
|
|
30
|
+
/** Current team-key version; bumped by rotation (D6). */
|
|
31
|
+
keyVersion: number;
|
|
32
|
+
}
|
|
33
|
+
export interface HubDevice {
|
|
34
|
+
id: string;
|
|
35
|
+
userId: string;
|
|
36
|
+
label: string;
|
|
37
|
+
sealPub: string;
|
|
38
|
+
signPub: string;
|
|
39
|
+
createdAt: number;
|
|
40
|
+
}
|
|
41
|
+
export interface MemberView {
|
|
42
|
+
user: HubUser;
|
|
43
|
+
role: TeamRole;
|
|
44
|
+
joinedAt: number;
|
|
45
|
+
devices: HubDevice[];
|
|
46
|
+
}
|
|
47
|
+
/** One live session on one member's machine (D24: intent, not transcripts). */
|
|
48
|
+
export interface PresenceIn {
|
|
49
|
+
deviceId: string;
|
|
50
|
+
repo: string;
|
|
51
|
+
runId?: string;
|
|
52
|
+
taskId?: string;
|
|
53
|
+
agent: string;
|
|
54
|
+
kind: string;
|
|
55
|
+
branch?: string;
|
|
56
|
+
touches: string[];
|
|
57
|
+
state: "idle" | "planning" | "running" | "reviewing" | "waiting_human" | "ci";
|
|
58
|
+
since: number;
|
|
59
|
+
/** Goal title, task title, intent line — sealed to the team. */
|
|
60
|
+
sealed?: Sealed;
|
|
61
|
+
sig?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface Presence extends PresenceIn {
|
|
64
|
+
teamId: string;
|
|
65
|
+
userId: string;
|
|
66
|
+
github: string;
|
|
67
|
+
ts: number;
|
|
68
|
+
}
|
|
69
|
+
/** A goal's claim on part of a repo (Phase 2, D28–D36). */
|
|
70
|
+
export interface Lease extends LeaseScope {
|
|
71
|
+
id: string;
|
|
72
|
+
teamId: string;
|
|
73
|
+
userId: string;
|
|
74
|
+
github: string;
|
|
75
|
+
deviceId: string;
|
|
76
|
+
repo: string;
|
|
77
|
+
runId: string;
|
|
78
|
+
taskId: string;
|
|
79
|
+
/** active while the task runs; landing after it finishes, until the goal's PR merges (D36). */
|
|
80
|
+
state: "active" | "landing";
|
|
81
|
+
/** Goal/task titles, sealed to the team (D2). */
|
|
82
|
+
sealed?: Sealed;
|
|
83
|
+
since: number;
|
|
84
|
+
ts: number;
|
|
85
|
+
/** Computed on read: no renewal within LEASE_TTL_MS (the owner's laptop is asleep — D12). */
|
|
86
|
+
stale?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface LeaseClaim extends LeaseScope {
|
|
89
|
+
deviceId: string;
|
|
90
|
+
repo: string;
|
|
91
|
+
runId: string;
|
|
92
|
+
taskId: string;
|
|
93
|
+
/** The team policy's hard zones, as the claimer's reviewed loom.team.json says (D37). */
|
|
94
|
+
hardZones: string[];
|
|
95
|
+
sealed?: Sealed;
|
|
96
|
+
}
|
|
97
|
+
export interface ClaimResult {
|
|
98
|
+
/** Null when refused (a hard zone is held — D31). */
|
|
99
|
+
lease: Lease | null;
|
|
100
|
+
/** Everyone else's live leases this one overlaps, with the colliding paths (D29: advisory). */
|
|
101
|
+
overlaps: Array<{
|
|
102
|
+
lease: Lease;
|
|
103
|
+
paths: string[];
|
|
104
|
+
}>;
|
|
105
|
+
blockedBy?: {
|
|
106
|
+
lease: Lease;
|
|
107
|
+
zone: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A memory shared with the team (Phase 3, D40–D51). The hub holds its content
|
|
112
|
+
* sealed; `hmac` (HMAC of the normalized text under the team key) lets it
|
|
113
|
+
* merge exact duplicates as confirmations without reading them (D41).
|
|
114
|
+
*/
|
|
115
|
+
export interface TeamMemory {
|
|
116
|
+
id: string;
|
|
117
|
+
teamId: string;
|
|
118
|
+
repo: string;
|
|
119
|
+
authorId: string;
|
|
120
|
+
author: string;
|
|
121
|
+
hmac: string;
|
|
122
|
+
sealed: Sealed;
|
|
123
|
+
/** live → in briefings; superseded → resolved against (D47); forgotten → its author withdrew it. */
|
|
124
|
+
state: "live" | "superseded" | "forgotten";
|
|
125
|
+
/** A correction points at what it corrects (D40). */
|
|
126
|
+
supersedes?: string;
|
|
127
|
+
supersededBy?: string;
|
|
128
|
+
resolvedBy?: string;
|
|
129
|
+
resolvedReason?: string;
|
|
130
|
+
/** Members whose agents learned exactly this — the author first (D41). */
|
|
131
|
+
confirmedBy: string[];
|
|
132
|
+
createdAt: number;
|
|
133
|
+
updatedAt: number;
|
|
134
|
+
}
|
|
135
|
+
export interface TeamMemoryIn {
|
|
136
|
+
id: string;
|
|
137
|
+
repo: string;
|
|
138
|
+
hmac: string;
|
|
139
|
+
sealed: Sealed;
|
|
140
|
+
deviceId: string;
|
|
141
|
+
supersedes?: string;
|
|
142
|
+
}
|
|
143
|
+
export type FeedType = "crew_request" | "crew_request_answered" | "member_joined" | "member_left" | "key_rotated" | "repo_shared" | "goal_started" | "goal_finished" | "plan_written" | "pr_opened" | "pr_merged" | "pr_closed" | "check_failed" | "check_passed" | "review_requested" | "review_submitted" | "lease_released" | "overlap_decided" | "drift" | "zone_waiting" | "conflict_predicted" | "memory_resolved" | "canon_proposed" | "goal_landed" | "goal_needs_someone" | "goal_adopted" | "goal_returned" | "check_flaky" | "goal_moved" | "deploy_started" | "deploy_succeeded" | "deploy_failed" | "land_queued" | "land_turn";
|
|
144
|
+
export interface FeedIn {
|
|
145
|
+
repo?: string;
|
|
146
|
+
type: FeedType;
|
|
147
|
+
/** Plain metadata: ids, numbers, states, branch names, paths. */
|
|
148
|
+
meta: Record<string, unknown>;
|
|
149
|
+
/** Titles and free text, sealed to the team. */
|
|
150
|
+
sealed?: Sealed;
|
|
151
|
+
deviceId?: string;
|
|
152
|
+
sig?: string;
|
|
153
|
+
/** Idempotency: the same key twice appends once (GitHub events get polled repeatedly). */
|
|
154
|
+
dedupeKey?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface FeedEvent extends FeedIn {
|
|
157
|
+
id: number;
|
|
158
|
+
teamId: string;
|
|
159
|
+
userId: string | null;
|
|
160
|
+
github: string | null;
|
|
161
|
+
ts: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A runner (Phase 5, D67–D71): one member's always-on Loom daemon that takes
|
|
165
|
+
* goals from the hub. A device of that member, marked runner.
|
|
166
|
+
*/
|
|
167
|
+
export interface Runner {
|
|
168
|
+
deviceId: string;
|
|
169
|
+
userId: string;
|
|
170
|
+
github: string;
|
|
171
|
+
label: string;
|
|
172
|
+
/** Agent kinds installed on it. */
|
|
173
|
+
kinds: string[];
|
|
174
|
+
/** Takes any member's goals, not just its owner's (D68). */
|
|
175
|
+
shared: boolean;
|
|
176
|
+
/** Goals at once. */
|
|
177
|
+
capacity: number;
|
|
178
|
+
lastSeen: number;
|
|
179
|
+
}
|
|
180
|
+
export type JobKind = "start" | "continue" | "fix" | "return" | "land";
|
|
181
|
+
export type JobState = "queued" | "claimed" | "done" | "failed" | "cancelled";
|
|
182
|
+
/** Work for a runner (D71). Everything but routing metadata is sealed to the team. */
|
|
183
|
+
export interface Job {
|
|
184
|
+
id: string;
|
|
185
|
+
teamId: string;
|
|
186
|
+
repo: string;
|
|
187
|
+
kind: JobKind;
|
|
188
|
+
/** Who asked. */
|
|
189
|
+
userId: string;
|
|
190
|
+
github: string;
|
|
191
|
+
/** A specific runner (device id), or any eligible one. */
|
|
192
|
+
target?: string;
|
|
193
|
+
state: JobState;
|
|
194
|
+
runnerId?: string;
|
|
195
|
+
runnerGithub?: string;
|
|
196
|
+
claimedAt?: number;
|
|
197
|
+
heartbeatAt?: number;
|
|
198
|
+
/** The goal, the run record, the briefing. */
|
|
199
|
+
sealed: Sealed;
|
|
200
|
+
/** The runner's latest snapshot of the goal (status, tasks, landing). */
|
|
201
|
+
progress?: Sealed;
|
|
202
|
+
result?: Sealed;
|
|
203
|
+
error?: string;
|
|
204
|
+
createdAt: number;
|
|
205
|
+
updatedAt: number;
|
|
206
|
+
}
|
|
207
|
+
export interface JobIn {
|
|
208
|
+
repo: string;
|
|
209
|
+
kind: JobKind;
|
|
210
|
+
target?: string;
|
|
211
|
+
sealed: Sealed;
|
|
212
|
+
deviceId: string;
|
|
213
|
+
}
|
|
214
|
+
/** A claimed job whose runner went quiet this long is claimable again (D12, D71). */
|
|
215
|
+
export declare const JOB_TTL_MS: number;
|
|
216
|
+
export type HubEvent = {
|
|
217
|
+
type: "memory";
|
|
218
|
+
teamId: string;
|
|
219
|
+
memory: TeamMemory;
|
|
220
|
+
} | {
|
|
221
|
+
type: "lease";
|
|
222
|
+
teamId: string;
|
|
223
|
+
lease: Lease;
|
|
224
|
+
} | {
|
|
225
|
+
type: "lease_gone";
|
|
226
|
+
teamId: string;
|
|
227
|
+
leaseIds: string[];
|
|
228
|
+
runId: string;
|
|
229
|
+
} | {
|
|
230
|
+
type: "presence";
|
|
231
|
+
teamId: string;
|
|
232
|
+
presence: Presence;
|
|
233
|
+
} | {
|
|
234
|
+
type: "presence_gone";
|
|
235
|
+
teamId: string;
|
|
236
|
+
userId: string;
|
|
237
|
+
deviceId: string;
|
|
238
|
+
agent: string;
|
|
239
|
+
repo: string;
|
|
240
|
+
} | {
|
|
241
|
+
type: "feed";
|
|
242
|
+
teamId: string;
|
|
243
|
+
event: FeedEvent;
|
|
244
|
+
} | {
|
|
245
|
+
type: "job";
|
|
246
|
+
teamId: string;
|
|
247
|
+
job: Job;
|
|
248
|
+
};
|
|
249
|
+
/** Everything a daemon (or phone) can do against a hub, as one signed-in user. */
|
|
250
|
+
export interface HubClient {
|
|
251
|
+
me(): Promise<HubUser>;
|
|
252
|
+
createTeam(name: string): Promise<Team>;
|
|
253
|
+
teams(): Promise<Array<Team & {
|
|
254
|
+
role: TeamRole;
|
|
255
|
+
}>>;
|
|
256
|
+
registerDevice(input: {
|
|
257
|
+
label: string;
|
|
258
|
+
sealPub: string;
|
|
259
|
+
signPub: string;
|
|
260
|
+
}): Promise<HubDevice>;
|
|
261
|
+
createInvite(teamId: string, ttlMs?: number): Promise<{
|
|
262
|
+
invite: string;
|
|
263
|
+
expiresAt: number;
|
|
264
|
+
}>;
|
|
265
|
+
redeemInvite(invite: string): Promise<{
|
|
266
|
+
team: Team;
|
|
267
|
+
role: TeamRole;
|
|
268
|
+
}>;
|
|
269
|
+
members(teamId: string): Promise<MemberView[]>;
|
|
270
|
+
removeMember(teamId: string, userId: string): Promise<void>;
|
|
271
|
+
/** Store a new key version sealed to each device. Owners only; version must be current or next. */
|
|
272
|
+
putKeyEnvelopes(teamId: string, version: number, envelopes: Array<{
|
|
273
|
+
deviceId: string;
|
|
274
|
+
box: string;
|
|
275
|
+
}>): Promise<void>;
|
|
276
|
+
keyEnvelopes(teamId: string, deviceId: string): Promise<Array<{
|
|
277
|
+
version: number;
|
|
278
|
+
box: string;
|
|
279
|
+
}>>;
|
|
280
|
+
shareRepo(teamId: string, repo: string): Promise<void>;
|
|
281
|
+
repos(teamId: string): Promise<string[]>;
|
|
282
|
+
heartbeat(teamId: string, p: PresenceIn): Promise<void>;
|
|
283
|
+
/** Tell teammates a session ended now, rather than waiting for the TTL. */
|
|
284
|
+
clearPresence(teamId: string, key: {
|
|
285
|
+
deviceId: string;
|
|
286
|
+
agent: string;
|
|
287
|
+
repo: string;
|
|
288
|
+
}): Promise<void>;
|
|
289
|
+
presence(teamId: string): Promise<Presence[]>;
|
|
290
|
+
appendFeed(teamId: string, e: FeedIn): Promise<FeedEvent | null>;
|
|
291
|
+
feed(teamId: string, opts?: {
|
|
292
|
+
since?: number;
|
|
293
|
+
limit?: number;
|
|
294
|
+
}): Promise<FeedEvent[]>;
|
|
295
|
+
subscribe(teamId: string, cb: (e: HubEvent) => void): Promise<() => void>;
|
|
296
|
+
claimLease(teamId: string, c: LeaseClaim): Promise<ClaimResult>;
|
|
297
|
+
/** Widen a lease to more paths (drift, D33). Same answer shape as a claim; a held hard zone refuses. */
|
|
298
|
+
extendLease(teamId: string, leaseId: string, scope: LeaseScope, hardZones: string[]): Promise<ClaimResult>;
|
|
299
|
+
/** Heartbeat for leases: keeps every lease of this device fresh (D12). */
|
|
300
|
+
renewLeases(teamId: string, deviceId: string): Promise<number>;
|
|
301
|
+
setRunLeaseState(teamId: string, runId: string, state: "active" | "landing"): Promise<number>;
|
|
302
|
+
/** The goal merged or was abandoned (D36). Owners release their own; returns how many. */
|
|
303
|
+
releaseLeases(teamId: string, runId: string, reason: string): Promise<number>;
|
|
304
|
+
leases(teamId: string, repo?: string): Promise<Lease[]>;
|
|
305
|
+
/** Share a memory; an exact duplicate (same hmac) becomes a confirmation instead (D41). */
|
|
306
|
+
publishMemory(teamId: string, m: TeamMemoryIn): Promise<{
|
|
307
|
+
memory: TeamMemory;
|
|
308
|
+
merged: boolean;
|
|
309
|
+
}>;
|
|
310
|
+
/** The author revises their own memory (D40). */
|
|
311
|
+
updateTeamMemory(teamId: string, id: string, patch: {
|
|
312
|
+
hmac: string;
|
|
313
|
+
sealed: Sealed;
|
|
314
|
+
}): Promise<TeamMemory>;
|
|
315
|
+
/** The author withdraws it (made private, or forgotten). */
|
|
316
|
+
forgetTeamMemory(teamId: string, id: string, reason: string): Promise<void>;
|
|
317
|
+
/** A human picks the winner of a contradiction or duplicate; the loser is superseded, kept (D47). */
|
|
318
|
+
resolveMemories(teamId: string, winnerId: string, loserId: string, reason: string): Promise<TeamMemory>;
|
|
319
|
+
/** Live memories (D50 snapshot); with history, superseded and forgotten ones too. */
|
|
320
|
+
teamMemories(teamId: string, repo: string, opts?: {
|
|
321
|
+
history?: boolean;
|
|
322
|
+
}): Promise<TeamMemory[]>;
|
|
323
|
+
/** Mark one of your devices a runner (or update it). Visible to every team you're in. */
|
|
324
|
+
registerRunner(input: {
|
|
325
|
+
deviceId: string;
|
|
326
|
+
kinds: string[];
|
|
327
|
+
shared: boolean;
|
|
328
|
+
capacity?: number;
|
|
329
|
+
}): Promise<Runner>;
|
|
330
|
+
/** Runners that can take this team's goals: members' runners. */
|
|
331
|
+
runners(teamId: string): Promise<Runner[]>;
|
|
332
|
+
/** Remove one of your devices (a runner being revoked); rotate the team key after (D74). */
|
|
333
|
+
revokeDevice(deviceId: string): Promise<void>;
|
|
334
|
+
createJob(teamId: string, j: JobIn): Promise<Job>;
|
|
335
|
+
/** The oldest job this runner may take, claimed atomically; null when none. */
|
|
336
|
+
claimJob(teamId: string, runnerDeviceId: string, instantOnly?: boolean): Promise<Job | null>;
|
|
337
|
+
/** The claiming runner is alive; optionally with a progress snapshot. */
|
|
338
|
+
heartbeatJob(teamId: string, jobId: string, runnerDeviceId: string, progress?: Sealed): Promise<Job>;
|
|
339
|
+
finishJob(teamId: string, jobId: string, runnerDeviceId: string, outcome: {
|
|
340
|
+
state: "done" | "failed";
|
|
341
|
+
result?: Sealed;
|
|
342
|
+
error?: string;
|
|
343
|
+
}): Promise<Job>;
|
|
344
|
+
/** Its author withdraws it; a runner holding it stops. */
|
|
345
|
+
cancelJob(teamId: string, jobId: string): Promise<Job>;
|
|
346
|
+
jobs(teamId: string, opts?: {
|
|
347
|
+
active?: boolean;
|
|
348
|
+
}): Promise<Job[]>;
|
|
349
|
+
/** The team's webhook secret, created on first ask; `rotate` replaces it. Owners only. */
|
|
350
|
+
webhookSecret(teamId: string, rotate?: boolean): Promise<{
|
|
351
|
+
secret: string;
|
|
352
|
+
}>;
|
|
353
|
+
}
|
|
354
|
+
export declare class HubError extends Error {
|
|
355
|
+
readonly status: number;
|
|
356
|
+
constructor(message: string, status?: number);
|
|
357
|
+
}
|
|
358
|
+
/** A heartbeat older than this is a session that stopped (laptop closed, crash). */
|
|
359
|
+
export declare const PRESENCE_TTL_MS = 45000;
|
|
360
|
+
export declare const INVITE_TTL_MS: number;
|
|
361
|
+
/** A short, one-way tag for an invite token: names it in the feed without revealing it. */
|
|
362
|
+
export declare function inviteTag(invite: string): string;
|
|
363
|
+
export declare const FREE_SEATS = 3;
|
|
364
|
+
/** A lease not renewed for this long is stale: its owner's machine is asleep or gone (D12). */
|
|
365
|
+
export declare const LEASE_TTL_MS: number;
|
|
366
|
+
export declare function normalizeRepo(repo: string): string;
|
|
367
|
+
export declare class MemoryHub {
|
|
368
|
+
private now;
|
|
369
|
+
private users;
|
|
370
|
+
private tokens;
|
|
371
|
+
private teamsById;
|
|
372
|
+
private memberships;
|
|
373
|
+
private devices;
|
|
374
|
+
private invites;
|
|
375
|
+
private envelopes;
|
|
376
|
+
private reposByTeam;
|
|
377
|
+
private presenceByTeam;
|
|
378
|
+
private feedByTeam;
|
|
379
|
+
private dedupe;
|
|
380
|
+
private feedSeq;
|
|
381
|
+
private leasesByTeam;
|
|
382
|
+
private memoriesByTeam;
|
|
383
|
+
private runnersByDevice;
|
|
384
|
+
private jobsByTeam;
|
|
385
|
+
private webhookSecrets;
|
|
386
|
+
private listeners;
|
|
387
|
+
constructor(now?: () => number);
|
|
388
|
+
/**
|
|
389
|
+
* Dev/self-host sign-in: a claimed GitHub login gets a session token.
|
|
390
|
+
* The hosted hub (Supabase) replaces this with real GitHub OAuth; the local
|
|
391
|
+
* hub server gates it behind its own admin secret.
|
|
392
|
+
*/
|
|
393
|
+
signIn(github: string, name?: string): {
|
|
394
|
+
token: string;
|
|
395
|
+
user: HubUser;
|
|
396
|
+
};
|
|
397
|
+
/** A client bound to one session — the only way to act on the hub. */
|
|
398
|
+
client(token: string): HubClient;
|
|
399
|
+
user(id: string): HubUser;
|
|
400
|
+
role(teamId: string, userId: string): TeamRole | null;
|
|
401
|
+
requireRole(teamId: string, userId: string, atLeast: TeamRole): TeamRole;
|
|
402
|
+
team(teamId: string): Team;
|
|
403
|
+
createTeam(userId: string, name: string): Team;
|
|
404
|
+
teamsOf(userId: string): Array<Team & {
|
|
405
|
+
role: TeamRole;
|
|
406
|
+
}>;
|
|
407
|
+
registerDevice(userId: string, input: {
|
|
408
|
+
label: string;
|
|
409
|
+
sealPub: string;
|
|
410
|
+
signPub: string;
|
|
411
|
+
}): HubDevice;
|
|
412
|
+
device(deviceId: string, userId: string): HubDevice;
|
|
413
|
+
createInvite(userId: string, teamId: string, ttlMs?: number | null): {
|
|
414
|
+
invite: string;
|
|
415
|
+
expiresAt: number;
|
|
416
|
+
};
|
|
417
|
+
redeemInvite(userId: string, invite: string): {
|
|
418
|
+
team: Team;
|
|
419
|
+
role: TeamRole;
|
|
420
|
+
};
|
|
421
|
+
members(userId: string, teamId: string): MemberView[];
|
|
422
|
+
removeMember(userId: string, teamId: string, target: string): void;
|
|
423
|
+
private withStale;
|
|
424
|
+
/**
|
|
425
|
+
* Everyone's live (non-stale) leases in a repo, except this user's own run.
|
|
426
|
+
* Matching on the run alone let anyone dodge a rival's lease by reusing its
|
|
427
|
+
* run id.
|
|
428
|
+
*/
|
|
429
|
+
private rivals;
|
|
430
|
+
private judge;
|
|
431
|
+
claimLease(userId: string, teamId: string, c: LeaseClaim): ClaimResult;
|
|
432
|
+
private ownLease;
|
|
433
|
+
extendLease(userId: string, teamId: string, leaseId: string, scope: LeaseScope, hardZones: string[]): ClaimResult;
|
|
434
|
+
renewLeases(userId: string, teamId: string, deviceId: string): number;
|
|
435
|
+
setRunLeaseState(userId: string, teamId: string, runId: string, state: "active" | "landing"): number;
|
|
436
|
+
releaseLeases(userId: string, teamId: string, runId: string, reason: string): number;
|
|
437
|
+
private mem;
|
|
438
|
+
publishMemory(userId: string, teamId: string, m: TeamMemoryIn): {
|
|
439
|
+
memory: TeamMemory;
|
|
440
|
+
merged: boolean;
|
|
441
|
+
};
|
|
442
|
+
private ownMemory;
|
|
443
|
+
updateTeamMemory(userId: string, teamId: string, id: string, patch: {
|
|
444
|
+
hmac: string;
|
|
445
|
+
sealed: Sealed;
|
|
446
|
+
}): TeamMemory;
|
|
447
|
+
forgetTeamMemory(userId: string, teamId: string, id: string, reason: string): void;
|
|
448
|
+
resolveMemories(userId: string, teamId: string, winnerId: string, loserId: string, reason: string): TeamMemory;
|
|
449
|
+
teamMemories(userId: string, teamId: string, repo: string, opts?: {
|
|
450
|
+
history?: boolean;
|
|
451
|
+
}): TeamMemory[];
|
|
452
|
+
registerRunner(userId: string, input: {
|
|
453
|
+
deviceId: string;
|
|
454
|
+
kinds: string[];
|
|
455
|
+
shared: boolean;
|
|
456
|
+
capacity?: number;
|
|
457
|
+
}): Runner;
|
|
458
|
+
runners(userId: string, teamId: string): Runner[];
|
|
459
|
+
revokeDevice(userId: string, deviceId: string): void;
|
|
460
|
+
private jobMap;
|
|
461
|
+
/** May this runner take this job? Its owner's jobs, or anyone's when shared (D68). */
|
|
462
|
+
private eligible;
|
|
463
|
+
createJob(userId: string, teamId: string, j: JobIn): Job;
|
|
464
|
+
claimJob(userId: string, teamId: string, runnerDeviceId: string, instantOnly?: boolean): Job | null;
|
|
465
|
+
private heldJob;
|
|
466
|
+
heartbeatJob(userId: string, teamId: string, jobId: string, runnerDeviceId: string, progress?: Sealed): Job;
|
|
467
|
+
finishJob(userId: string, teamId: string, jobId: string, runnerDeviceId: string, outcome: {
|
|
468
|
+
state: "done" | "failed";
|
|
469
|
+
result?: Sealed;
|
|
470
|
+
error?: string;
|
|
471
|
+
}): Job;
|
|
472
|
+
cancelJob(userId: string, teamId: string, jobId: string): Job;
|
|
473
|
+
jobs(userId: string, teamId: string, opts?: {
|
|
474
|
+
active?: boolean;
|
|
475
|
+
}): Job[];
|
|
476
|
+
webhookSecret(userId: string, teamId: string, rotate?: boolean): {
|
|
477
|
+
secret: string;
|
|
478
|
+
};
|
|
479
|
+
/** The receiver's side (no session): the secret to verify a delivery against; null for no such team, or none set. */
|
|
480
|
+
webhookSecretOf(teamId: string): string | null;
|
|
481
|
+
/**
|
|
482
|
+
* A verified delivery: its events, for repos this team shares only, appended
|
|
483
|
+
* as system events (no member). Returns how many were new — the rest were
|
|
484
|
+
* already in the feed (polled first, or a redelivery).
|
|
485
|
+
*/
|
|
486
|
+
receiveGithubWebhook(teamId: string, event: string, payload: unknown): number;
|
|
487
|
+
leases(userId: string, teamId: string, repo?: string): Lease[];
|
|
488
|
+
putKeyEnvelopes(userId: string, teamId: string, version: number, envs: Array<{
|
|
489
|
+
deviceId: string;
|
|
490
|
+
box: string;
|
|
491
|
+
}>): void;
|
|
492
|
+
keyEnvelopes(userId: string, teamId: string, deviceId: string): Array<{
|
|
493
|
+
version: number;
|
|
494
|
+
box: string;
|
|
495
|
+
}>;
|
|
496
|
+
shareRepo(userId: string, teamId: string, repo: string): void;
|
|
497
|
+
repos(userId: string, teamId: string): string[];
|
|
498
|
+
private presenceKey;
|
|
499
|
+
heartbeat(userId: string, teamId: string, p: PresenceIn): void;
|
|
500
|
+
clearPresence(userId: string, teamId: string, key: {
|
|
501
|
+
deviceId: string;
|
|
502
|
+
agent: string;
|
|
503
|
+
repo: string;
|
|
504
|
+
}): void;
|
|
505
|
+
presence(userId: string, teamId: string): Presence[];
|
|
506
|
+
appendFeed(userId: string, teamId: string, e: FeedIn): FeedEvent | null;
|
|
507
|
+
appendFeedRaw(teamId: string, userId: string | null, e: FeedIn): FeedEvent | null;
|
|
508
|
+
feed(userId: string, teamId: string, opts?: {
|
|
509
|
+
since?: number;
|
|
510
|
+
limit?: number;
|
|
511
|
+
}): FeedEvent[];
|
|
512
|
+
subscribe(userId: string, teamId: string, cb: (e: HubEvent) => void): () => void;
|
|
513
|
+
private emit;
|
|
514
|
+
}
|