hostlet 0.0.0-stage → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +233 -2
- package/bin/hostlet.js +61 -0
- package/console/app/api.js +1223 -0
- package/console/app/boot.js +165 -0
- package/console/app/cards.js +222 -0
- package/console/app/compose-quote.js +127 -0
- package/console/app/config-form.js +727 -0
- package/console/app/document-drafts.js +62 -0
- package/console/app/document-tools.mjs +67 -0
- package/console/app/documents.js +106 -0
- package/console/app/pages.js +6483 -0
- package/console/app/plugins.js +509 -0
- package/console/app/preview-tools.js +172 -0
- package/console/app/reference-labels.js +118 -0
- package/console/app/selection.js +372 -0
- package/console/app/store.js +57 -0
- package/console/app/text-anchor.js +26 -0
- package/console/app/topic-local.js +322 -0
- package/console/app/topic-nav.js +414 -0
- package/console/app/topic-status.js +109 -0
- package/console/app/views.js +43 -0
- package/console/apple-touch-icon.png +0 -0
- package/console/avatars/agy.svg +34 -0
- package/console/avatars/alhena.svg +36 -0
- package/console/avatars/castor.svg +38 -0
- package/console/avatars/claude.svg +34 -0
- package/console/avatars/codex.svg +34 -0
- package/console/avatars/devin.svg +34 -0
- package/console/avatars/echo.svg +34 -0
- package/console/avatars/kimi.svg +33 -0
- package/console/avatars/opencode.svg +33 -0
- package/console/avatars/pinion.svg +34 -0
- package/console/avatars/sprocket.svg +34 -0
- package/console/avatars/vela.svg +44 -0
- package/console/avatars/wasat.svg +38 -0
- package/console/clients/agy.svg +1 -0
- package/console/clients/claude.svg +1 -0
- package/console/clients/codex.svg +1 -0
- package/console/clients/devin.svg +1 -0
- package/console/clients/kimi.svg +1 -0
- package/console/clients/opencode.svg +1 -0
- package/console/favicon.ico +0 -0
- package/console/favicon.svg +16 -0
- package/console/index.html +99 -0
- package/console/pdl/engine/README.md +13 -0
- package/console/pdl/engine/anchor.js +195 -0
- package/console/pdl/engine/core.js +1340 -0
- package/console/pdl/engine/frame.js +1252 -0
- package/console/pdl/engine/i18n.js +67 -0
- package/console/pdl/engine/pdl-check.js +102 -0
- package/console/pdl/engine/pdl-doc.js +353 -0
- package/console/pdl/engine/pdl-view.js +280 -0
- package/console/pdl/engine/pdl.js +1064 -0
- package/console/pdl/engine/platform.js +18 -0
- package/console/pdl/engine/proj.js +279 -0
- package/console/pdl/engine/theme.js +176 -0
- package/console/pdl/engine/tree.js +171 -0
- package/console/pdl/engine/units.js +546 -0
- package/console/pdl/library/README.md +28 -0
- package/console/pdl/library/blocks.js +1512 -0
- package/console/pdl/library/buttons.js +86 -0
- package/console/pdl/library/capsules.js +130 -0
- package/console/pdl/library/charts.js +287 -0
- package/console/pdl/library/code.js +98 -0
- package/console/pdl/library/css/base.css +12 -0
- package/console/pdl/library/css/blocks.css +98 -0
- package/console/pdl/library/css/capsules.css +42 -0
- package/console/pdl/library/css/catalog-page.css +24 -0
- package/console/pdl/library/css/chat.css +100 -0
- package/console/pdl/library/css/composer-top.css +145 -0
- package/console/pdl/library/css/controls.css +195 -0
- package/console/pdl/library/css/drag.css +29 -0
- package/console/pdl/library/css/edit-layout.css +93 -0
- package/console/pdl/library/css/floating-window.css +30 -0
- package/console/pdl/library/css/hover.css +50 -0
- package/console/pdl/library/css/label-search.css +37 -0
- package/console/pdl/library/css/layers.css +43 -0
- package/console/pdl/library/css/library-parts.css +33 -0
- package/console/pdl/library/css/library.css +117 -0
- package/console/pdl/library/css/member-select.css +34 -0
- package/console/pdl/library/css/message.css +72 -0
- package/console/pdl/library/css/page.css +104 -0
- package/console/pdl/library/css/parts.css +338 -0
- package/console/pdl/library/css/responsive.css +40 -0
- package/console/pdl/library/css/roles.css +28 -0
- package/console/pdl/library/css/rows.css +231 -0
- package/console/pdl/library/css/settings-rows.css +37 -0
- package/console/pdl/library/css/shell.css +59 -0
- package/console/pdl/library/css/stream.css +296 -0
- package/console/pdl/library/css/theme-calculator.css +18 -0
- package/console/pdl/library/css/thumb-choice.css +69 -0
- package/console/pdl/library/css/tweaks.css +16 -0
- package/console/pdl/library/css/widgets.css +211 -0
- package/console/pdl/library/css/workbench.css +59 -0
- package/console/pdl/library/feedback.js +83 -0
- package/console/pdl/library/floating-window.mjs +100 -0
- package/console/pdl/library/fold.js +238 -0
- package/console/pdl/library/format.js +53 -0
- package/console/pdl/library/frames.js +123 -0
- package/console/pdl/library/icons.js +165 -0
- package/console/pdl/library/identity.js +149 -0
- package/console/pdl/library/inputs.js +801 -0
- package/console/pdl/library/label-search.js +214 -0
- package/console/pdl/library/markdown-text.js +115 -0
- package/console/pdl/library/markdown.js +150 -0
- package/console/pdl/library/media-viewer.js +293 -0
- package/console/pdl/library/member-select.mjs +32 -0
- package/console/pdl/library/message.js +105 -0
- package/console/pdl/library/motion.js +56 -0
- package/console/pdl/library/overlays.js +165 -0
- package/console/pdl/library/page.js +142 -0
- package/console/pdl/library/plugin-form.js +154 -0
- package/console/pdl/library/registry.js +198 -0
- package/console/pdl/library/rows.js +523 -0
- package/console/pdl/library/shell.js +151 -0
- package/console/pdl/library/stream.js +58 -0
- package/console/pdl/library/tabs.js +259 -0
- package/console/pdl/library/theme-calculator.js +300 -0
- package/console/pdl/library/widgets.js +114 -0
- package/console/pdl/load-order.json +74 -0
- package/console/pdl/platform/README.md +3 -0
- package/console/pdl/platform/rich-markdown.mjs +17 -0
- package/console/pdl/platform/web-links.js +26 -0
- package/console/pdl/platform/web.js +80 -0
- package/console/sdk-browser/mentions.d.mts +16 -0
- package/console/sdk-browser/mentions.mjs +84 -0
- package/console/theme/assets.js +21 -0
- package/console/theme/theme.json +9417 -0
- package/console/theme/tokens.json +444 -0
- package/dist/core/a2a.d.ts +288 -0
- package/dist/core/a2a.js +2197 -0
- package/dist/core/address.d.ts +34 -0
- package/dist/core/address.js +33 -0
- package/dist/core/approval-inputs.d.ts +17 -0
- package/dist/core/approval-inputs.js +70 -0
- package/dist/core/archive.d.ts +19 -0
- package/dist/core/archive.js +135 -0
- package/dist/core/attachments.d.ts +17 -0
- package/dist/core/attachments.js +143 -0
- package/dist/core/blocked-handoffs.d.ts +132 -0
- package/dist/core/blocked-handoffs.js +349 -0
- package/dist/core/config-schema.d.ts +124 -0
- package/dist/core/config-schema.js +192 -0
- package/dist/core/config.d.ts +117 -0
- package/dist/core/config.js +638 -0
- package/dist/core/disk-usage.d.ts +26 -0
- package/dist/core/disk-usage.js +83 -0
- package/dist/core/documents.d.ts +9 -0
- package/dist/core/documents.js +48 -0
- package/dist/core/entry.d.ts +316 -0
- package/dist/core/entry.js +711 -0
- package/dist/core/home.d.ts +76 -0
- package/dist/core/home.js +449 -0
- package/dist/core/i18n.d.ts +36 -0
- package/dist/core/i18n.js +458 -0
- package/dist/core/instances.d.ts +224 -0
- package/dist/core/instances.js +1272 -0
- package/dist/core/members.d.ts +190 -0
- package/dist/core/members.js +358 -0
- package/dist/core/mentions.d.ts +12 -0
- package/dist/core/mentions.js +49 -0
- package/dist/core/messages.d.ts +876 -0
- package/dist/core/messages.js +916 -0
- package/dist/core/notices.d.ts +88 -0
- package/dist/core/notices.js +54 -0
- package/dist/core/ops.d.ts +117 -0
- package/dist/core/ops.js +146 -0
- package/dist/core/package.d.ts +2 -0
- package/dist/core/package.js +14 -0
- package/dist/core/parts.d.ts +25 -0
- package/dist/core/parts.js +119 -0
- package/dist/core/plugins/catalog.d.ts +14 -0
- package/dist/core/plugins/catalog.js +54 -0
- package/dist/core/plugins/external.d.ts +7 -0
- package/dist/core/plugins/external.js +921 -0
- package/dist/core/plugins/index.d.ts +5 -0
- package/dist/core/plugins/index.js +51 -0
- package/dist/core/plugins/npm.d.ts +12 -0
- package/dist/core/plugins/npm.js +99 -0
- package/dist/core/plugins/plugin-manifest.d.ts +12 -0
- package/dist/core/plugins/plugin-manifest.js +231 -0
- package/dist/core/push.d.ts +22 -0
- package/dist/core/push.js +63 -0
- package/dist/core/resource.d.ts +77 -0
- package/dist/core/resource.js +48 -0
- package/dist/core/spawn.d.ts +12 -0
- package/dist/core/spawn.js +30 -0
- package/dist/core/storage-inventory.d.ts +118 -0
- package/dist/core/storage-inventory.js +279 -0
- package/dist/core/storage.d.ts +45 -0
- package/dist/core/storage.js +602 -0
- package/dist/core/store.d.ts +15 -0
- package/dist/core/store.js +33 -0
- package/dist/core/topic-index.d.ts +19 -0
- package/dist/core/topic-index.js +70 -0
- package/dist/core/topic-ops.d.ts +139 -0
- package/dist/core/topic-ops.js +507 -0
- package/dist/core/topic-status.d.ts +32 -0
- package/dist/core/topic-status.js +105 -0
- package/dist/core/topics.d.ts +327 -0
- package/dist/core/topics.js +786 -0
- package/dist/core/turn-clients.d.ts +1 -0
- package/dist/core/turn-clients.js +5 -0
- package/dist/core/types.d.ts +2866 -0
- package/dist/core/types.js +166 -0
- package/dist/core/util.d.ts +10 -0
- package/dist/core/util.js +47 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.js +82 -0
- package/dist/plugins/adapter-acp/index.d.ts +3 -0
- package/dist/plugins/adapter-acp/index.js +57 -0
- package/dist/plugins/adapter-acp/plugin.yaml +100 -0
- package/dist/plugins/adapter-agy/command.d.ts +9 -0
- package/dist/plugins/adapter-agy/command.js +34 -0
- package/dist/plugins/adapter-agy/index.d.ts +5 -0
- package/dist/plugins/adapter-agy/index.js +65 -0
- package/dist/plugins/adapter-agy/quota.d.ts +2 -0
- package/dist/plugins/adapter-agy/quota.js +155 -0
- package/dist/plugins/adapter-agy/terminal.d.ts +6 -0
- package/dist/plugins/adapter-agy/terminal.js +132 -0
- package/dist/plugins/adapter-agy/version.d.ts +9 -0
- package/dist/plugins/adapter-agy/version.js +17 -0
- package/dist/plugins/adapter-claude/index.d.ts +43 -0
- package/dist/plugins/adapter-claude/index.js +412 -0
- package/dist/plugins/adapter-claude/quota.d.ts +14 -0
- package/dist/plugins/adapter-claude/quota.js +103 -0
- package/dist/plugins/adapter-codex/index.d.ts +4 -0
- package/dist/plugins/adapter-codex/index.js +688 -0
- package/dist/plugins/adapter-codex/responses-model.d.ts +9 -0
- package/dist/plugins/adapter-codex/responses-model.js +82 -0
- package/dist/plugins/adapter-kimi/index.d.ts +4 -0
- package/dist/plugins/adapter-kimi/index.js +51 -0
- package/dist/plugins/adapter-kimi/quota.d.ts +3 -0
- package/dist/plugins/adapter-kimi/quota.js +171 -0
- package/dist/plugins/adapter-opencode/index.d.ts +12 -0
- package/dist/plugins/adapter-opencode/index.js +64 -0
- package/dist/plugins/annotations/console/cards.css +189 -0
- package/dist/plugins/annotations/console/cards.mjs +439 -0
- package/dist/plugins/annotations/console/pdl.json +52 -0
- package/dist/plugins/annotations/console/view.mjs +241 -0
- package/dist/plugins/annotations/console/window.mjs +219 -0
- package/dist/plugins/annotations/followups.d.ts +51 -0
- package/dist/plugins/annotations/followups.js +112 -0
- package/dist/plugins/annotations/index.d.ts +3 -0
- package/dist/plugins/annotations/index.js +298 -0
- package/dist/plugins/annotations/plugin.yaml +3 -0
- package/dist/plugins/ask-choice/index.d.ts +9 -0
- package/dist/plugins/ask-choice/index.js +24 -0
- package/dist/plugins/ask-choice/plugin.yaml +2 -0
- package/dist/plugins/background/index.d.ts +2 -0
- package/dist/plugins/background/index.js +398 -0
- package/dist/plugins/background/plugin.yaml +7 -0
- package/dist/plugins/builtin.json +37 -0
- package/dist/plugins/cards/console/pdl.json +516 -0
- package/dist/plugins/cards/console/view.mjs +67 -0
- package/dist/plugins/cards/index.d.ts +8 -0
- package/dist/plugins/cards/index.js +627 -0
- package/dist/plugins/cards/plugin.yaml +3 -0
- package/dist/plugins/console/browser.d.ts +2 -0
- package/dist/plugins/console/browser.js +115 -0
- package/dist/plugins/console/console/pdl.json +38 -0
- package/dist/plugins/console/console/view.mjs +26 -0
- package/dist/plugins/console/index.d.ts +4 -0
- package/dist/plugins/console/index.js +94 -0
- package/dist/plugins/console/picker.d.ts +2 -0
- package/dist/plugins/console/picker.js +48 -0
- package/dist/plugins/console/plugin.yaml +3 -0
- package/dist/plugins/console/topic-view.d.ts +3 -0
- package/dist/plugins/console/topic-view.js +388 -0
- package/dist/plugins/handoff/index.d.ts +2 -0
- package/dist/plugins/handoff/index.js +147 -0
- package/dist/plugins/handoff/plugin.yaml +8 -0
- package/dist/plugins/host-api/index.d.ts +7 -0
- package/dist/plugins/host-api/index.js +310 -0
- package/dist/plugins/host-api/plugin.yaml +2 -0
- package/dist/plugins/host-api/signing.d.ts +63 -0
- package/dist/plugins/host-api/signing.js +427 -0
- package/dist/plugins/host-api/skills/host-ops/SKILL.md +28 -0
- package/dist/plugins/host-api/skills/hostlet-plugin-dev/SKILL.md +38 -0
- package/dist/plugins/inbox/index.d.ts +15 -0
- package/dist/plugins/inbox/index.js +161 -0
- package/dist/plugins/inbox/plugin.yaml +2 -0
- package/dist/plugins/keys/account-directories.d.ts +18 -0
- package/dist/plugins/keys/account-directories.js +86 -0
- package/dist/plugins/keys/account-storage.d.ts +18 -0
- package/dist/plugins/keys/account-storage.js +112 -0
- package/dist/plugins/keys/console/pdl.json +710 -0
- package/dist/plugins/keys/console/view.mjs +619 -0
- package/dist/plugins/keys/index.d.ts +7 -0
- package/dist/plugins/keys/index.js +842 -0
- package/dist/plugins/keys/login-link.d.ts +2 -0
- package/dist/plugins/keys/login-link.js +15 -0
- package/dist/plugins/keys/plugin.yaml +3 -0
- package/dist/plugins/keys/quota-history.d.ts +91 -0
- package/dist/plugins/keys/quota-history.js +420 -0
- package/dist/plugins/mcp/console/pdl.json +412 -0
- package/dist/plugins/mcp/console/view.mjs +207 -0
- package/dist/plugins/mcp/index.d.ts +7 -0
- package/dist/plugins/mcp/index.js +494 -0
- package/dist/plugins/mcp/plugin.yaml +3 -0
- package/dist/plugins/member-health/index.d.ts +2 -0
- package/dist/plugins/member-health/index.js +478 -0
- package/dist/plugins/member-health/plugin.yaml +2 -0
- package/dist/plugins/memory/capabilities.d.ts +10 -0
- package/dist/plugins/memory/capabilities.js +70 -0
- package/dist/plugins/memory/console/pdl.json +459 -0
- package/dist/plugins/memory/console/view.mjs +254 -0
- package/dist/plugins/memory/corpus.d.ts +60 -0
- package/dist/plugins/memory/corpus.js +521 -0
- package/dist/plugins/memory/engines/fts-tree-diversity.d.ts +8 -0
- package/dist/plugins/memory/engines/fts-tree-diversity.js +49 -0
- package/dist/plugins/memory/engines/fts-tree-text.d.ts +12 -0
- package/dist/plugins/memory/engines/fts-tree-text.js +93 -0
- package/dist/plugins/memory/engines/fts-tree.d.ts +4 -0
- package/dist/plugins/memory/engines/fts-tree.js +387 -0
- package/dist/plugins/memory/engines/search.d.ts +9 -0
- package/dist/plugins/memory/engines/search.js +35 -0
- package/dist/plugins/memory/index.d.ts +3 -0
- package/dist/plugins/memory/index.js +465 -0
- package/dist/plugins/memory/notes.d.ts +22 -0
- package/dist/plugins/memory/notes.js +140 -0
- package/dist/plugins/memory/plugin.yaml +23 -0
- package/dist/plugins/model-profiles/index.d.ts +2 -0
- package/dist/plugins/model-profiles/index.js +919 -0
- package/dist/plugins/model-profiles/plugin.yaml +13 -0
- package/dist/plugins/model-profiles/review-source.d.ts +11 -0
- package/dist/plugins/model-profiles/review-source.js +640 -0
- package/dist/plugins/model-profiles/rules.d.ts +132 -0
- package/dist/plugins/model-profiles/rules.js +767 -0
- package/dist/plugins/model-profiles/skills/model-profile/SKILL.md +60 -0
- package/dist/plugins/model-profiles/sources.d.ts +61 -0
- package/dist/plugins/model-profiles/sources.js +375 -0
- package/dist/plugins/model-profiles/storage.d.ts +104 -0
- package/dist/plugins/model-profiles/storage.js +352 -0
- package/dist/plugins/model-profiles/types.d.ts +187 -0
- package/dist/plugins/model-profiles/types.js +12 -0
- package/dist/plugins/model-profiles/wakeup.d.ts +29 -0
- package/dist/plugins/model-profiles/wakeup.js +390 -0
- package/dist/plugins/models/index.d.ts +2 -0
- package/dist/plugins/models/index.js +63 -0
- package/dist/plugins/models/plugin.yaml +8 -0
- package/dist/plugins/ops/collector.d.ts +22 -0
- package/dist/plugins/ops/collector.js +48 -0
- package/dist/plugins/ops/config.d.ts +11 -0
- package/dist/plugins/ops/config.js +13 -0
- package/dist/plugins/ops/console/pdl.json +676 -0
- package/dist/plugins/ops/console/view.mjs +700 -0
- package/dist/plugins/ops/index.d.ts +3 -0
- package/dist/plugins/ops/index.js +20 -0
- package/dist/plugins/ops/journal.d.ts +7 -0
- package/dist/plugins/ops/journal.js +109 -0
- package/dist/plugins/ops/metrics.d.ts +3 -0
- package/dist/plugins/ops/metrics.js +81 -0
- package/dist/plugins/ops/plugin.yaml +63 -0
- package/dist/plugins/ops/samples.d.ts +54 -0
- package/dist/plugins/ops/samples.js +100 -0
- package/dist/plugins/ops/trace.d.ts +3 -0
- package/dist/plugins/ops/trace.js +104 -0
- package/dist/plugins/ops/usage.d.ts +2 -0
- package/dist/plugins/ops/usage.js +152 -0
- package/dist/plugins/plans/acceptance.d.ts +284 -0
- package/dist/plugins/plans/acceptance.js +247 -0
- package/dist/plugins/plans/blocked.d.ts +25 -0
- package/dist/plugins/plans/blocked.js +66 -0
- package/dist/plugins/plans/console/pdl.json +639 -0
- package/dist/plugins/plans/console/view.d.mts +2 -0
- package/dist/plugins/plans/console/view.mjs +855 -0
- package/dist/plugins/plans/dependencies.d.ts +5 -0
- package/dist/plugins/plans/dependencies.js +21 -0
- package/dist/plugins/plans/index.d.ts +72 -0
- package/dist/plugins/plans/index.js +2057 -0
- package/dist/plugins/plans/plugin.yaml +44 -0
- package/dist/plugins/plans/progress.d.ts +82 -0
- package/dist/plugins/plans/progress.js +516 -0
- package/dist/plugins/prompt/index.d.ts +8 -0
- package/dist/plugins/prompt/index.js +361 -0
- package/dist/plugins/prompt/plugin.yaml +2 -0
- package/dist/plugins/recovery/console/pdl.json +50 -0
- package/dist/plugins/recovery/console/view.mjs +46 -0
- package/dist/plugins/recovery/index.d.ts +9 -0
- package/dist/plugins/recovery/index.js +454 -0
- package/dist/plugins/recovery/plugin.yaml +9 -0
- package/dist/plugins/recovery/probe.d.ts +11 -0
- package/dist/plugins/recovery/probe.js +128 -0
- package/dist/plugins/restart/console/pdl.json +112 -0
- package/dist/plugins/restart/console/view.mjs +85 -0
- package/dist/plugins/restart/index.d.ts +10 -0
- package/dist/plugins/restart/index.js +669 -0
- package/dist/plugins/restart/plugin.yaml +9 -0
- package/dist/plugins/restart/scope.d.ts +6 -0
- package/dist/plugins/restart/scope.js +44 -0
- package/dist/plugins/schedule/console/pdl.json +696 -0
- package/dist/plugins/schedule/console/view.mjs +398 -0
- package/dist/plugins/schedule/events.d.ts +76 -0
- package/dist/plugins/schedule/events.js +158 -0
- package/dist/plugins/schedule/index.d.ts +32 -0
- package/dist/plugins/schedule/index.js +1199 -0
- package/dist/plugins/schedule/plugin.yaml +26 -0
- package/dist/plugins/schedule/when.d.ts +14 -0
- package/dist/plugins/schedule/when.js +83 -0
- package/dist/plugins/sessions/console/pdl.json +259 -0
- package/dist/plugins/sessions/console/view.mjs +355 -0
- package/dist/plugins/sessions/index.d.ts +3 -0
- package/dist/plugins/sessions/index.js +126 -0
- package/dist/plugins/sessions/participants.d.ts +28 -0
- package/dist/plugins/sessions/participants.js +83 -0
- package/dist/plugins/sessions/plugin.yaml +3 -0
- package/dist/plugins/signals/console/pdl.json +802 -0
- package/dist/plugins/signals/console/view.mjs +284 -0
- package/dist/plugins/signals/content.d.ts +31 -0
- package/dist/plugins/signals/content.js +151 -0
- package/dist/plugins/signals/index.d.ts +2 -0
- package/dist/plugins/signals/index.js +601 -0
- package/dist/plugins/signals/plugin.yaml +32 -0
- package/dist/plugins/signals/skills/signal-sources/SKILL.md +27 -0
- package/dist/plugins/skills/console/pdl.json +254 -0
- package/dist/plugins/skills/console/view.mjs +204 -0
- package/dist/plugins/skills/index.d.ts +11 -0
- package/dist/plugins/skills/index.js +567 -0
- package/dist/plugins/skills/install.d.ts +69 -0
- package/dist/plugins/skills/install.js +265 -0
- package/dist/plugins/skills/plugin.yaml +24 -0
- package/dist/plugins/skills/safety-scan.d.ts +17 -0
- package/dist/plugins/skills/safety-scan.js +78 -0
- package/dist/plugins/skills/skills/skill-ops/SKILL.md +29 -0
- package/dist/plugins/terminal/console/pdl.json +115 -0
- package/dist/plugins/terminal/console/view.mjs +178 -0
- package/dist/plugins/terminal/index.d.ts +3 -0
- package/dist/plugins/terminal/index.js +204 -0
- package/dist/plugins/terminal/plugin.yaml +2 -0
- package/dist/plugins/tools/index.d.ts +3 -0
- package/dist/plugins/tools/index.js +458 -0
- package/dist/plugins/tools/plugin.yaml +2 -0
- package/dist/plugins/tools/token.d.ts +61 -0
- package/dist/plugins/tools/token.js +179 -0
- package/dist/plugins/topic-tools/index.d.ts +9 -0
- package/dist/plugins/topic-tools/index.js +29 -0
- package/dist/plugins/topic-tools/plugin.yaml +2 -0
- package/dist/plugins/topic-tools/skills/topic-tidy/SKILL.md +108 -0
- package/dist/plugins/works/console/pdl.json +120 -0
- package/dist/plugins/works/console/view.mjs +91 -0
- package/dist/plugins/works/document-words.d.ts +50 -0
- package/dist/plugins/works/document-words.js +27 -0
- package/dist/plugins/works/editors.d.ts +3 -0
- package/dist/plugins/works/editors.js +162 -0
- package/dist/plugins/works/events.d.ts +58 -0
- package/dist/plugins/works/events.js +82 -0
- package/dist/plugins/works/files.d.ts +23 -0
- package/dist/plugins/works/files.js +53 -0
- package/dist/plugins/works/index.d.ts +9 -0
- package/dist/plugins/works/index.js +1088 -0
- package/dist/plugins/works/plugin.yaml +9 -0
- package/dist/plugins/works/preview.d.ts +10 -0
- package/dist/plugins/works/preview.js +30 -0
- package/dist/plugins/works/project.d.ts +3 -0
- package/dist/plugins/works/project.js +245 -0
- package/dist/plugins/works/resource.d.ts +28 -0
- package/dist/plugins/works/resource.js +71 -0
- package/dist/plugins/works/retention.d.ts +36 -0
- package/dist/plugins/works/retention.js +295 -0
- package/dist/plugins/works/skills/works-ops/SKILL.md +14 -0
- package/dist/plugins/works/viewers.d.ts +13 -0
- package/dist/plugins/works/viewers.js +87 -0
- package/dist/plugins/works/web/anchors.js +94 -0
- package/dist/plugins/works/web/document-edit.js +245 -0
- package/dist/plugins/works/web/preview-bridge.js +142 -0
- package/dist/plugins/works/web/reading-position.js +74 -0
- package/dist/plugins/works/web/view.html +1118 -0
- package/dist/runtime/runtime.d.ts +210 -0
- package/dist/runtime/runtime.js +338 -0
- package/dist/sdk/adapter-kit.d.ts +1 -0
- package/dist/sdk/adapter-kit.js +1 -0
- package/dist/sdk/client.d.ts +163 -0
- package/dist/sdk/client.js +43 -0
- package/dist/sdk/contracts.d.ts +1263 -0
- package/dist/sdk/contracts.js +1 -0
- package/dist/sdk/index.d.ts +57 -0
- package/dist/sdk/index.js +27 -0
- package/dist/sdk/source-choice.d.ts +40 -0
- package/dist/sdk/source-choice.js +217 -0
- package/dist/sdk/topic-text.d.ts +5 -0
- package/dist/sdk/topic-text.js +26 -0
- package/dist/sdk/transport.d.ts +12 -0
- package/dist/sdk/transport.js +34 -0
- package/node_modules/@hostlet/adapter-kit/dist/acp.d.ts +88 -0
- package/node_modules/@hostlet/adapter-kit/dist/acp.js +674 -0
- package/node_modules/@hostlet/adapter-kit/dist/command.d.ts +18 -0
- package/node_modules/@hostlet/adapter-kit/dist/command.js +39 -0
- package/node_modules/@hostlet/adapter-kit/dist/index.d.ts +8 -0
- package/node_modules/@hostlet/adapter-kit/dist/index.js +6 -0
- package/node_modules/@hostlet/adapter-kit/dist/models.d.ts +29 -0
- package/node_modules/@hostlet/adapter-kit/dist/models.js +108 -0
- package/node_modules/@hostlet/adapter-kit/dist/quota.d.ts +3 -0
- package/node_modules/@hostlet/adapter-kit/dist/quota.js +4 -0
- package/node_modules/@hostlet/adapter-kit/dist/rpc.d.ts +29 -0
- package/node_modules/@hostlet/adapter-kit/dist/rpc.js +84 -0
- package/node_modules/@hostlet/adapter-kit/dist/upstream-failure.d.ts +5 -0
- package/node_modules/@hostlet/adapter-kit/dist/upstream-failure.js +37 -0
- package/node_modules/@hostlet/adapter-kit/package.json +16 -0
- package/node_modules/@hostlet/platform/dist/desktop.d.ts +16 -0
- package/node_modules/@hostlet/platform/dist/desktop.js +276 -0
- package/node_modules/@hostlet/platform/dist/files.d.ts +24 -0
- package/node_modules/@hostlet/platform/dist/files.js +113 -0
- package/node_modules/@hostlet/platform/dist/index.d.ts +6 -0
- package/node_modules/@hostlet/platform/dist/index.js +4 -0
- package/node_modules/@hostlet/platform/dist/paths.d.ts +4 -0
- package/node_modules/@hostlet/platform/dist/paths.js +9 -0
- package/node_modules/@hostlet/platform/dist/process.d.ts +45 -0
- package/node_modules/@hostlet/platform/dist/process.js +297 -0
- package/node_modules/@hostlet/platform/package.json +14 -0
- package/package.json +60 -4
|
@@ -0,0 +1,1263 @@
|
|
|
1
|
+
import type { TurnRecord } from '../core/a2a.ts';
|
|
2
|
+
import type { Op } from '../core/entry.ts';
|
|
3
|
+
import type { Notice } from '../core/notices.ts';
|
|
4
|
+
import type { Locator, ResourceChange, ResourceRef, parseResource, resourceWithin } from '../core/resource.ts';
|
|
5
|
+
import type { Child } from '../core/spawn.ts';
|
|
6
|
+
import type { Card, CardAnswer, CardItem, CardResult, ClientAccountStorage, InputValues, Member, Message, Sender, Signature, Topic, TopicView as PluginTopicView } from '../core/types.ts';
|
|
7
|
+
import type { Action, Ctx, Disposer, Events } from '../runtime/runtime.ts';
|
|
8
|
+
import type { ConfigField, ConfigSaveResult, ConfigurationStep, ConfigurationVariants, LocalizedText, Setting } from '../core/config-schema.ts';
|
|
9
|
+
export type { ConfigDeclaration, ConfigField, ConfigKind, ConfigOption, ConfigSaveResult, ConfigUnit, ConfigurationStep, ConfigurationVariants, LocalizedText, OperationRef, Scalar, FieldValue, ConfigRecord, Setting, RequiredWhen, VariantTest, } from '../core/config-schema.ts';
|
|
10
|
+
export type ValueKind = 'string' | 'number' | 'url' | 'boolean' | 'select' | 'list' | 'member' | 'map';
|
|
11
|
+
export type ValueField = ConfigField;
|
|
12
|
+
export type ConfigurationValue = ConfigField;
|
|
13
|
+
export type ConfigurationOperation = ConfigField & {
|
|
14
|
+
kind: 'operation';
|
|
15
|
+
target: string[];
|
|
16
|
+
actions: ConfigurationStep[];
|
|
17
|
+
};
|
|
18
|
+
export type ConfigurationField = ConfigField;
|
|
19
|
+
/** Display and navigation only. Operations save credentials on the server. */
|
|
20
|
+
export interface ConfigurationOperationResult {
|
|
21
|
+
state: 'pending' | 'done' | 'error';
|
|
22
|
+
label?: string;
|
|
23
|
+
step?: string;
|
|
24
|
+
saved?: true;
|
|
25
|
+
expiresAt?: number;
|
|
26
|
+
pollAfter?: number;
|
|
27
|
+
render?: ConfigurationStep['resultRender'];
|
|
28
|
+
data?: string | {
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface PluginManifest {
|
|
33
|
+
pluginId: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
/** Keep this core capability out of the console's default plugin list and its enable/disable controls. */
|
|
37
|
+
foundation?: boolean;
|
|
38
|
+
/** Offer a switch per topic. Built-in packages default to false, external packages to true. */
|
|
39
|
+
topicSwitch?: boolean;
|
|
40
|
+
/** Image path inside the package. Used for member identities without their own image. */
|
|
41
|
+
icon?: string;
|
|
42
|
+
/** Directory inside the package containing the console PDL and optional view module. */
|
|
43
|
+
console?: string;
|
|
44
|
+
description?: LocalizedText;
|
|
45
|
+
steps?: (string | {
|
|
46
|
+
text: LocalizedText;
|
|
47
|
+
mode?: string;
|
|
48
|
+
})[];
|
|
49
|
+
configuration?: ConfigField[];
|
|
50
|
+
configurationVariants?: ConfigurationVariants;
|
|
51
|
+
/** Group-level configuration metadata registered with the unified host config registry. */
|
|
52
|
+
visibility?: 'system' | 'private';
|
|
53
|
+
approvalRisk?: LocalizedText;
|
|
54
|
+
/** The one topic this plugin owns, created only when the plugin asks for it. */
|
|
55
|
+
topic?: {
|
|
56
|
+
title: string;
|
|
57
|
+
summary: string;
|
|
58
|
+
pinned?: boolean;
|
|
59
|
+
view?: PluginTopicView;
|
|
60
|
+
};
|
|
61
|
+
runtime?: {
|
|
62
|
+
entrypoint?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface ExternalPluginContext {
|
|
66
|
+
id: string;
|
|
67
|
+
/** Directory that contains the plugin package, which can be separate from its data directory. */
|
|
68
|
+
dir: string;
|
|
69
|
+
manifest?: PluginManifest;
|
|
70
|
+
config: {
|
|
71
|
+
get(key: string): Setting | undefined;
|
|
72
|
+
all(): Record<string, Setting>;
|
|
73
|
+
set(key: string, value: Setting | null): void;
|
|
74
|
+
/** Register host-managed settings while running. Saved values are available on the next read. */
|
|
75
|
+
declare(fields: ConfigField[]): Disposer;
|
|
76
|
+
applyOperation(operationKey: string, updates: Record<string, unknown>): Promise<ConfigSaveResult>;
|
|
77
|
+
};
|
|
78
|
+
secrets: {
|
|
79
|
+
get(key: string): string | undefined;
|
|
80
|
+
};
|
|
81
|
+
/** The topic declared by this plugin: the bound one if there is one, else created from the manifest declaration. */
|
|
82
|
+
topic(): Topic;
|
|
83
|
+
/** Ask the host to restart this plugin (read its code again and start it) once the current call returns: for configuration read only at start. */
|
|
84
|
+
reload(): void;
|
|
85
|
+
}
|
|
86
|
+
declare module '../runtime/runtime.ts' {
|
|
87
|
+
interface Events {
|
|
88
|
+
'plugin.changed': {
|
|
89
|
+
name: string;
|
|
90
|
+
kind: 'installed' | 'updated' | 'uninstalled' | 'enabled' | 'disabled' | 'reloaded' | 'configured';
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export interface TopicView {
|
|
95
|
+
id: string;
|
|
96
|
+
view?: string;
|
|
97
|
+
title: string;
|
|
98
|
+
icon?: string;
|
|
99
|
+
about?: string;
|
|
100
|
+
places: ('main' | 'panel')[];
|
|
101
|
+
defaultPanel?: string;
|
|
102
|
+
/** Include this view in the default workbench tabs. */
|
|
103
|
+
defaultPanelTab?: true;
|
|
104
|
+
cap?: string;
|
|
105
|
+
group?: string;
|
|
106
|
+
localPage?: true;
|
|
107
|
+
activeTopic?: true;
|
|
108
|
+
}
|
|
109
|
+
export interface ConsoleFragment {
|
|
110
|
+
/** Load the companion module when enabled, before opening the initial route. */
|
|
111
|
+
eager?: true;
|
|
112
|
+
ns?: string;
|
|
113
|
+
topicViews?: TopicView[];
|
|
114
|
+
icons?: Record<string, unknown>;
|
|
115
|
+
i18n?: Record<string, unknown>;
|
|
116
|
+
rows?: Record<string, unknown>;
|
|
117
|
+
inserts?: object[];
|
|
118
|
+
templates?: object[];
|
|
119
|
+
views?: Record<string, Record<string, unknown>>;
|
|
120
|
+
popups?: Record<string, unknown>;
|
|
121
|
+
requests?: Record<string, {
|
|
122
|
+
path: string;
|
|
123
|
+
method?: string;
|
|
124
|
+
query?: object;
|
|
125
|
+
body?: object;
|
|
126
|
+
invalidateOn?: string[];
|
|
127
|
+
}>;
|
|
128
|
+
components?: {
|
|
129
|
+
js?: string[];
|
|
130
|
+
css?: string[];
|
|
131
|
+
module?: string;
|
|
132
|
+
};
|
|
133
|
+
documentTools?: {
|
|
134
|
+
module: string;
|
|
135
|
+
actions: string[];
|
|
136
|
+
references?: string[];
|
|
137
|
+
};
|
|
138
|
+
replaces?: Record<string, {
|
|
139
|
+
use: string;
|
|
140
|
+
props: string[];
|
|
141
|
+
}>;
|
|
142
|
+
}
|
|
143
|
+
export interface ConsoleRegistry {
|
|
144
|
+
register(plugin: string, fragment: ConsoleFragment): Disposer;
|
|
145
|
+
}
|
|
146
|
+
/** A plugin-selected command that an owner can open in the local console. */
|
|
147
|
+
export interface CommandTerminal {
|
|
148
|
+
path: string;
|
|
149
|
+
exited: Promise<void>;
|
|
150
|
+
close(): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
/** Receives the command's current replay buffer, including records split across PTY reads. */
|
|
153
|
+
export type CommandOutput = (output: string) => Promise<unknown> | void;
|
|
154
|
+
declare module '../core/types.ts' {
|
|
155
|
+
interface ClientAccount {
|
|
156
|
+
/** The authorization page printed by this CLI and any environment needed to suppress its own browser launch. */
|
|
157
|
+
loginBrowser?: {
|
|
158
|
+
endpoint: string;
|
|
159
|
+
env?: NodeJS.ProcessEnv;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
declare module '../runtime/runtime.ts' {
|
|
164
|
+
interface Services {
|
|
165
|
+
console: ConsoleRegistry;
|
|
166
|
+
terminal: {
|
|
167
|
+
command(command: [string, ...string[]], cwd: string, env: NodeJS.ProcessEnv, onOutput?: CommandOutput): CommandTerminal;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
interface Events {
|
|
171
|
+
/** The console registry is available; optional contributors can register again on enable. */
|
|
172
|
+
'console.ready': Record<string, never>;
|
|
173
|
+
'console.pdl.changed': {
|
|
174
|
+
plugin: string;
|
|
175
|
+
};
|
|
176
|
+
'topic.view.changed': {
|
|
177
|
+
topicId: string;
|
|
178
|
+
kind: 'view' | 'data';
|
|
179
|
+
revision: string;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export interface JobStart {
|
|
184
|
+
id: string;
|
|
185
|
+
topicId: string;
|
|
186
|
+
memberId: string;
|
|
187
|
+
thread?: string;
|
|
188
|
+
startedMessageId?: string;
|
|
189
|
+
command: string;
|
|
190
|
+
note: string;
|
|
191
|
+
startedAt: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Long commands a member wants to wait for. The host runs them, not the member's CLI, so the result reaches the
|
|
195
|
+
* topic whatever happens to the member's instance meanwhile: when a job ends, a message in the topic tells
|
|
196
|
+
* the member, which wakes it.
|
|
197
|
+
*/
|
|
198
|
+
export interface Job extends JobStart {
|
|
199
|
+
child: Child;
|
|
200
|
+
output: string;
|
|
201
|
+
stopped?: boolean;
|
|
202
|
+
}
|
|
203
|
+
export interface Background {
|
|
204
|
+
start(input: {
|
|
205
|
+
topicId: string;
|
|
206
|
+
memberId: string;
|
|
207
|
+
command: string;
|
|
208
|
+
note?: string;
|
|
209
|
+
thread?: string;
|
|
210
|
+
startedMessageId?: string;
|
|
211
|
+
}): string;
|
|
212
|
+
get(id: string): Job | undefined;
|
|
213
|
+
running(topicId: string): Pick<JobStart, 'memberId' | 'thread' | 'startedAt'>[];
|
|
214
|
+
}
|
|
215
|
+
declare module '../runtime/runtime.ts' {
|
|
216
|
+
interface Services {
|
|
217
|
+
background: Background;
|
|
218
|
+
}
|
|
219
|
+
interface Events {
|
|
220
|
+
'background.started': {
|
|
221
|
+
topicId: string;
|
|
222
|
+
};
|
|
223
|
+
'background.finished': {
|
|
224
|
+
jobId: string;
|
|
225
|
+
topicId: string;
|
|
226
|
+
memberId: string;
|
|
227
|
+
code: number | null;
|
|
228
|
+
signal: string | null;
|
|
229
|
+
stopped: boolean;
|
|
230
|
+
messageId?: string;
|
|
231
|
+
error?: string;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** A card as its sender gives it: what is asked. Options and items given without an id are numbered. */
|
|
236
|
+
export type NewCard = Omit<Card, 'ask' | 'to' | 'rev' | 'state' | 'answer' | 'outcome' | 'note' | 'signs' | 'options' | 'items'> & {
|
|
237
|
+
options?: (Omit<NonNullable<Card['options']>[number], 'id'> & {
|
|
238
|
+
id?: string;
|
|
239
|
+
})[];
|
|
240
|
+
items?: (Omit<CardItem, 'id' | 'result'> & {
|
|
241
|
+
id?: string;
|
|
242
|
+
})[];
|
|
243
|
+
};
|
|
244
|
+
/** What a card's sender is handed once a person has answered it. */
|
|
245
|
+
export interface Answered {
|
|
246
|
+
message: Message;
|
|
247
|
+
card: Card;
|
|
248
|
+
answer: CardAnswer;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Cards: a member or a plugin asks a person for an answer with something the person answers on the thing itself.
|
|
252
|
+
* Two kinds are answered here, a choice and an approval; a plugin may draw a kind of its own under one of them.
|
|
253
|
+
* A card is a message in the channel or part of a live reply. What becomes of it is kept on it.
|
|
254
|
+
*/
|
|
255
|
+
export interface Cards {
|
|
256
|
+
/** Put a card in a topic's channel, for the people it asks (the owner, when nobody is named). */
|
|
257
|
+
send(input: {
|
|
258
|
+
topicId: string;
|
|
259
|
+
from: Sender;
|
|
260
|
+
card: NewCard;
|
|
261
|
+
to?: string[];
|
|
262
|
+
replyTo?: string;
|
|
263
|
+
inbox?: false;
|
|
264
|
+
}): Message;
|
|
265
|
+
/** Change what is asked (one more thing to approve, other words). Only while it waits for its answer. */
|
|
266
|
+
update(id: string, patch: Partial<NewCard>): Message;
|
|
267
|
+
/** Once it is answered: write on the card what was done about it. `tell`: hand the card to these members to read. */
|
|
268
|
+
report(id: string, report: {
|
|
269
|
+
results?: Record<string, CardResult>;
|
|
270
|
+
outcome?: CardResult;
|
|
271
|
+
tell?: string[];
|
|
272
|
+
}): Message;
|
|
273
|
+
/** Withdraw a standalone card that still waits, leaving it in the channel and clearing its inbox receipts. */
|
|
274
|
+
close(id: string, note?: string): Message;
|
|
275
|
+
/**
|
|
276
|
+
* A person answers, or an invited member signs. Only one who was asked, only once, and only the card as it is now
|
|
277
|
+
* (`rev`). A person's answer settles it; members' votes settle it once `quorum.need` approve, and a dissent blocks
|
|
278
|
+
* them or rejects it. The settled answer goes back to the member, the plugin's handler, or the adapter waiting.
|
|
279
|
+
*/
|
|
280
|
+
answer(id: string, by: string, answer: {
|
|
281
|
+
rev: number;
|
|
282
|
+
picked?: string[];
|
|
283
|
+
text?: string;
|
|
284
|
+
approved?: boolean;
|
|
285
|
+
remember?: boolean;
|
|
286
|
+
ask?: string;
|
|
287
|
+
values?: Record<string, string>;
|
|
288
|
+
turnId?: string;
|
|
289
|
+
inputs?: InputValues;
|
|
290
|
+
}): Message;
|
|
291
|
+
/** Approved cards that have no outcome written yet: what was approved may not have been done. */
|
|
292
|
+
awaitingOutcome(filter?: {
|
|
293
|
+
from?: Sender;
|
|
294
|
+
}): Message[];
|
|
295
|
+
get(id: string): Message | undefined;
|
|
296
|
+
/** The cards that wait for their answer. */
|
|
297
|
+
pending(filter?: {
|
|
298
|
+
topicId?: string;
|
|
299
|
+
from?: Sender;
|
|
300
|
+
}): Message[];
|
|
301
|
+
}
|
|
302
|
+
export type Consumer = (answered: Answered) => CardResult | void | Promise<CardResult | void>;
|
|
303
|
+
/** The source plugin validates the private submission before the public answer is committed. */
|
|
304
|
+
export type InputConsumer = (inputs: InputValues) => Consumer;
|
|
305
|
+
/** Structured lifecycle events emitted by the approval provider (`host-api`) for every approval card. */
|
|
306
|
+
export interface ApprovalRequestedEvent {
|
|
307
|
+
card: string;
|
|
308
|
+
topicId: string;
|
|
309
|
+
op: string;
|
|
310
|
+
args: unknown;
|
|
311
|
+
by: string;
|
|
312
|
+
turnId?: string;
|
|
313
|
+
}
|
|
314
|
+
export interface ApprovalSettledEvent extends ApprovalRequestedEvent {
|
|
315
|
+
resolution: 'approved' | 'rejected' | 'withdrawn' | 'expired';
|
|
316
|
+
via?: 'owner' | 'quorum';
|
|
317
|
+
answer?: CardAnswer;
|
|
318
|
+
note?: string;
|
|
319
|
+
}
|
|
320
|
+
declare module '../runtime/runtime.ts' {
|
|
321
|
+
interface Services {
|
|
322
|
+
cards: Cards;
|
|
323
|
+
}
|
|
324
|
+
interface Events {
|
|
325
|
+
/** The accepted answer, published only after the source message has been revised. */
|
|
326
|
+
'card.answered': Answered;
|
|
327
|
+
/** A sender may claim a request before its answer is recorded. The consumer receives the persisted answer. */
|
|
328
|
+
'card.answering': {
|
|
329
|
+
message: Message;
|
|
330
|
+
/** The answer about to be kept. */
|
|
331
|
+
answer: CardAnswer;
|
|
332
|
+
accept(consume: Consumer): void;
|
|
333
|
+
/** Only the context that registered the sending identity can bind a private preflight and execution. */
|
|
334
|
+
acceptInputs?(owner: Ctx, prepare: InputConsumer): void;
|
|
335
|
+
/** Members' votes are about to settle it: the sender may refuse, and the card waits for the people it asks. */
|
|
336
|
+
refuse?(reason: string): void;
|
|
337
|
+
};
|
|
338
|
+
/** A member's vote was kept on a card that still waits (or now waits for the people it asks). */
|
|
339
|
+
'card.signed': {
|
|
340
|
+
message: Message;
|
|
341
|
+
card: Card;
|
|
342
|
+
signature: Signature;
|
|
343
|
+
};
|
|
344
|
+
/** A pending standalone card was closed (withdrawn, expired or stale). */
|
|
345
|
+
'card.closed': {
|
|
346
|
+
message: Message;
|
|
347
|
+
card: Card;
|
|
348
|
+
note?: string;
|
|
349
|
+
};
|
|
350
|
+
'approval.requested': ApprovalRequestedEvent;
|
|
351
|
+
'approval.settled': ApprovalSettledEvent;
|
|
352
|
+
}
|
|
353
|
+
interface Hooks {
|
|
354
|
+
/** A sender may refresh a waiting card against current data before its answer is recorded. */
|
|
355
|
+
'cards.refresh': [Message, void];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/** A local Git update observed by the review hook. The actor and turn are present only for a pre-bound member intent. */
|
|
359
|
+
export interface ReviewMergedEvent {
|
|
360
|
+
dir: string;
|
|
361
|
+
old: string;
|
|
362
|
+
new: string;
|
|
363
|
+
card: string;
|
|
364
|
+
at: number;
|
|
365
|
+
commit: string;
|
|
366
|
+
plan: string;
|
|
367
|
+
intent?: string;
|
|
368
|
+
by?: string;
|
|
369
|
+
turnId?: string;
|
|
370
|
+
}
|
|
371
|
+
export interface ReviewRecord {
|
|
372
|
+
dir: string;
|
|
373
|
+
repo: string;
|
|
374
|
+
branch: string;
|
|
375
|
+
commit: string;
|
|
376
|
+
plan: string;
|
|
377
|
+
reviewer: string;
|
|
378
|
+
fixes?: {
|
|
379
|
+
commit: string;
|
|
380
|
+
stage: '实现' | '转述' | '需求' | '未知';
|
|
381
|
+
source?: string;
|
|
382
|
+
missed?: boolean;
|
|
383
|
+
};
|
|
384
|
+
supersedes?: string;
|
|
385
|
+
card: string;
|
|
386
|
+
author: string;
|
|
387
|
+
topicId: string;
|
|
388
|
+
turnId?: string;
|
|
389
|
+
at: number;
|
|
390
|
+
source: PlanSource;
|
|
391
|
+
decision?: Pick<ApprovalSettledEvent, 'resolution' | 'via' | 'answer' | 'note'>;
|
|
392
|
+
revoked?: {
|
|
393
|
+
by: string;
|
|
394
|
+
at: number;
|
|
395
|
+
text: string;
|
|
396
|
+
};
|
|
397
|
+
status: ApprovalSettledEvent['resolution'] | 'pending' | 'revoked' | 'merged';
|
|
398
|
+
signatures: Signature[];
|
|
399
|
+
updates: ReviewMergedEvent[];
|
|
400
|
+
}
|
|
401
|
+
/** Emitted when a signer or the owner revokes a previously approved, unmerged review. */
|
|
402
|
+
export interface ReviewRevokedEvent {
|
|
403
|
+
card: string;
|
|
404
|
+
dir: string;
|
|
405
|
+
commit: string;
|
|
406
|
+
plan: string;
|
|
407
|
+
by: string;
|
|
408
|
+
at: number;
|
|
409
|
+
text: string;
|
|
410
|
+
}
|
|
411
|
+
export interface ReviewService {
|
|
412
|
+
list(opts?: {
|
|
413
|
+
after?: string;
|
|
414
|
+
limit?: number;
|
|
415
|
+
}): {
|
|
416
|
+
items: ReviewRecord[];
|
|
417
|
+
next: string | null;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
declare module '../runtime/runtime.ts' {
|
|
421
|
+
interface Services {
|
|
422
|
+
review: ReviewService;
|
|
423
|
+
}
|
|
424
|
+
interface Events {
|
|
425
|
+
'review.merged': ReviewMergedEvent;
|
|
426
|
+
'review.revoked': ReviewRevokedEvent;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
export interface AffectedPlan {
|
|
430
|
+
id: string;
|
|
431
|
+
title: string;
|
|
432
|
+
sourceMessageId?: string;
|
|
433
|
+
}
|
|
434
|
+
export interface PlanSource {
|
|
435
|
+
message?: string;
|
|
436
|
+
doc?: {
|
|
437
|
+
resource: string;
|
|
438
|
+
section?: string;
|
|
439
|
+
};
|
|
440
|
+
assignment?: string;
|
|
441
|
+
}
|
|
442
|
+
declare module '../runtime/runtime.ts' {
|
|
443
|
+
interface Services {
|
|
444
|
+
plans: {
|
|
445
|
+
source(id: string): PlanSource | undefined;
|
|
446
|
+
affectedWork(turn: TurnRecord, reply: Message): AffectedPlan[];
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
interface Events {
|
|
450
|
+
'plans.changed': {
|
|
451
|
+
topicIds: string[];
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
export interface MemberHealthAttempt {
|
|
456
|
+
replyId: string;
|
|
457
|
+
turnId: string;
|
|
458
|
+
}
|
|
459
|
+
export interface MemberHealthReference extends MemberHealthAttempt {
|
|
460
|
+
topicId: string;
|
|
461
|
+
memberId: string;
|
|
462
|
+
planned?: true;
|
|
463
|
+
}
|
|
464
|
+
export interface MemberHealthIssue extends MemberHealthReference {
|
|
465
|
+
failure: 'account' | 'provider';
|
|
466
|
+
reason: string | null;
|
|
467
|
+
failedAt: number;
|
|
468
|
+
}
|
|
469
|
+
declare module '../runtime/runtime.ts' {
|
|
470
|
+
interface Services {
|
|
471
|
+
memberHealth: {
|
|
472
|
+
issue(topicId: string, replyId: string, turnId: string, viewerId: string): MemberHealthIssue | undefined;
|
|
473
|
+
memberIssue(memberId: string, viewerId: string): MemberHealthIssue | undefined;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
interface Events {
|
|
477
|
+
'memberHealth.changed': {
|
|
478
|
+
memberId: string;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
declare module '../runtime/runtime.ts' {
|
|
483
|
+
interface Services {
|
|
484
|
+
recovery: {
|
|
485
|
+
waiting(replyId: string, turnId: string): boolean;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
interface Events {
|
|
489
|
+
'recovery.changed': Record<string, never>;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
export type McpChange = {
|
|
493
|
+
name: string;
|
|
494
|
+
topicId?: string;
|
|
495
|
+
kind: 'added' | 'updated' | 'removed';
|
|
496
|
+
} | {
|
|
497
|
+
name: string;
|
|
498
|
+
topicId?: string;
|
|
499
|
+
kind: 'switched';
|
|
500
|
+
on: boolean;
|
|
501
|
+
} | {
|
|
502
|
+
name: string;
|
|
503
|
+
topicId: string;
|
|
504
|
+
kind: 'overridden';
|
|
505
|
+
on: boolean | null;
|
|
506
|
+
} | {
|
|
507
|
+
name: string;
|
|
508
|
+
topicId: string;
|
|
509
|
+
kind: 'selected';
|
|
510
|
+
choice: SourceChoice | null;
|
|
511
|
+
};
|
|
512
|
+
declare module '../runtime/runtime.ts' {
|
|
513
|
+
interface Events {
|
|
514
|
+
'mcp.changed': McpChange;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
export type SourceChoice = 'keep-local' | 'use-upstream';
|
|
518
|
+
export type SkillChange = {
|
|
519
|
+
kind: 'sources';
|
|
520
|
+
name?: never;
|
|
521
|
+
topicId?: never;
|
|
522
|
+
} | {
|
|
523
|
+
name: string;
|
|
524
|
+
topicId?: string;
|
|
525
|
+
kind: 'installed';
|
|
526
|
+
} | {
|
|
527
|
+
name: string;
|
|
528
|
+
topicId?: never;
|
|
529
|
+
kind: 'switched';
|
|
530
|
+
on: boolean;
|
|
531
|
+
} | {
|
|
532
|
+
name: string;
|
|
533
|
+
topicId: string;
|
|
534
|
+
kind: 'overridden';
|
|
535
|
+
on: boolean | null;
|
|
536
|
+
} | {
|
|
537
|
+
name: string;
|
|
538
|
+
topicId: string;
|
|
539
|
+
kind: 'selected';
|
|
540
|
+
place: string;
|
|
541
|
+
choice: SourceChoice | null;
|
|
542
|
+
};
|
|
543
|
+
declare module '../runtime/runtime.ts' {
|
|
544
|
+
interface Events {
|
|
545
|
+
'skills.changed': SkillChange;
|
|
546
|
+
}
|
|
547
|
+
interface Hooks {
|
|
548
|
+
/** A plugin's own skills: the directory they are in (by convention `skills/` in the plugin's folder), one folder a skill. */
|
|
549
|
+
'skills.dirs': [Record<string, never>, string];
|
|
550
|
+
/** Names at a topic's root that a plugin writes and keeps (`works.json`, `.claude`): storage cleanup never treats them as `other`. */
|
|
551
|
+
'topic.records': [Record<string, never>, string | string[]];
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
declare module '../runtime/runtime.ts' {
|
|
555
|
+
interface Events {
|
|
556
|
+
'restart.changed': RestartStatus;
|
|
557
|
+
}
|
|
558
|
+
interface Hooks {
|
|
559
|
+
/** One line per piece of work a plugin would lose if the host stopped now. */
|
|
560
|
+
'restart.busy': [Record<string, never>, string | string[] | undefined];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
/** Who asked for the restart: a member in a topic, or a person (neither). */
|
|
564
|
+
export interface RestartAsker {
|
|
565
|
+
topicId?: string;
|
|
566
|
+
memberId?: string;
|
|
567
|
+
note: string;
|
|
568
|
+
askedAt: number;
|
|
569
|
+
}
|
|
570
|
+
export type RestartPhase = 'waiting' | 'holding' | 'stalled' | 'checking' | 'refused';
|
|
571
|
+
export interface RestartStatus {
|
|
572
|
+
supervised: boolean;
|
|
573
|
+
checking: boolean;
|
|
574
|
+
waiting: {
|
|
575
|
+
askers: (RestartAsker & {
|
|
576
|
+
by: string;
|
|
577
|
+
})[];
|
|
578
|
+
phase: RestartPhase;
|
|
579
|
+
holding: boolean;
|
|
580
|
+
next: number | null;
|
|
581
|
+
for: string[];
|
|
582
|
+
asked: string[];
|
|
583
|
+
detail: Omit<Notice, 'id'>;
|
|
584
|
+
problem?: string;
|
|
585
|
+
} | null;
|
|
586
|
+
}
|
|
587
|
+
declare module '../runtime/runtime.ts' {
|
|
588
|
+
interface Events {
|
|
589
|
+
/** The host is to stop and be started again with the code as it is now. Whoever owns the process does it. */
|
|
590
|
+
'host.restart': Record<string, never>;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* When a task is due. There are three kinds and no more: one time, every so many minutes, and a time of day on
|
|
595
|
+
* every day or on some days of the week. Times of day are in the machine's own time zone.
|
|
596
|
+
*/
|
|
597
|
+
export type When = {
|
|
598
|
+
kind: 'once';
|
|
599
|
+
at: number;
|
|
600
|
+
}
|
|
601
|
+
/** Due at `from` + n × `minutes`, n ≥ 1. */
|
|
602
|
+
| {
|
|
603
|
+
kind: 'every';
|
|
604
|
+
minutes: number;
|
|
605
|
+
from: number;
|
|
606
|
+
}
|
|
607
|
+
/** `time` is HH:MM. `days`: 0 is Sunday … 6 is Saturday; absent means every day. */
|
|
608
|
+
| {
|
|
609
|
+
kind: 'daily';
|
|
610
|
+
time: string;
|
|
611
|
+
days?: number[];
|
|
612
|
+
};
|
|
613
|
+
export interface ScheduledOp {
|
|
614
|
+
op: string;
|
|
615
|
+
args: Record<string, unknown>;
|
|
616
|
+
about?: string;
|
|
617
|
+
ref?: string;
|
|
618
|
+
key: string;
|
|
619
|
+
when: When | {
|
|
620
|
+
kind: 'every';
|
|
621
|
+
minutes: number;
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
declare module '../runtime/runtime.ts' {
|
|
625
|
+
interface Services {
|
|
626
|
+
schedule: {
|
|
627
|
+
register(input: ScheduledOp, by: string): Disposer;
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
export interface ContextMark {
|
|
632
|
+
/** Percentage mark (0..100) shown on the execution panel context gauge. */
|
|
633
|
+
at: number;
|
|
634
|
+
/** Localized suffix appended to context summaries and tooltips. */
|
|
635
|
+
note: string;
|
|
636
|
+
}
|
|
637
|
+
declare module '../runtime/runtime.ts' {
|
|
638
|
+
interface Hooks {
|
|
639
|
+
/** Optional threshold mark shown on a member's execution context gauge. */
|
|
640
|
+
'member.contextMark': [{
|
|
641
|
+
member: Member;
|
|
642
|
+
}, ContextMark | undefined];
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/** Who is calling: every MCP server handed to a member's CLI comes with a token that names its topic and member. */
|
|
646
|
+
export interface ToolCaller {
|
|
647
|
+
topicId: string;
|
|
648
|
+
member: Member;
|
|
649
|
+
}
|
|
650
|
+
export interface ToolSource {
|
|
651
|
+
core?: true;
|
|
652
|
+
plugin?: string;
|
|
653
|
+
title: string;
|
|
654
|
+
}
|
|
655
|
+
export interface Tool {
|
|
656
|
+
name: string;
|
|
657
|
+
description: string;
|
|
658
|
+
/** JSON Schema of the arguments. */
|
|
659
|
+
input: Record<string, unknown>;
|
|
660
|
+
/** Which plugin registered this tool; omitted for host core operations. */
|
|
661
|
+
plugin?: string;
|
|
662
|
+
run(args: any, caller: ToolCaller): unknown | Promise<unknown>;
|
|
663
|
+
}
|
|
664
|
+
export interface ToolSummary {
|
|
665
|
+
name: string;
|
|
666
|
+
description: string;
|
|
667
|
+
inputSchema: Record<string, unknown>;
|
|
668
|
+
source: ToolSource;
|
|
669
|
+
}
|
|
670
|
+
export interface ToolServerSummary {
|
|
671
|
+
server: string;
|
|
672
|
+
url: string;
|
|
673
|
+
tools: ToolSummary[];
|
|
674
|
+
}
|
|
675
|
+
export interface ProbedTool {
|
|
676
|
+
name: string;
|
|
677
|
+
description: string;
|
|
678
|
+
inputSchema?: Record<string, unknown>;
|
|
679
|
+
}
|
|
680
|
+
export interface MountedServer {
|
|
681
|
+
/** The plugin shown as the source of this service's tools. */
|
|
682
|
+
plugin?: string;
|
|
683
|
+
/** Known tools for the console. Reading this must not wake the service. */
|
|
684
|
+
tools?(): ProbedTool[];
|
|
685
|
+
/** Handle JSON-RPC after host authentication. A missing caller is a read-only probe. */
|
|
686
|
+
handle(body: unknown, caller: ToolCaller | undefined, meta: {
|
|
687
|
+
protocolVersion?: string;
|
|
688
|
+
}): Promise<unknown>;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Tools for members, grouped into MCP servers. Core and stable high-frequency tools share the `hostlet` server;
|
|
692
|
+
* optional domain plugins register tools or mount a JSON-RPC handler. All share the host's one port and caller
|
|
693
|
+
* authentication. An operation declared as a tool uses its group here and runs through `entry`.
|
|
694
|
+
*/
|
|
695
|
+
export interface Tools {
|
|
696
|
+
register(server: string, tool: Tool): Disposer;
|
|
697
|
+
mount(server: string, mounted: MountedServer): Disposer;
|
|
698
|
+
/** An unscoped lookup includes all registrations. A topic sees only contributions from its enabled plugins. */
|
|
699
|
+
servers(topicId?: string): ToolServerSummary[];
|
|
700
|
+
/** Connect to one of the host's own MCP endpoints over HTTP and list its tools. */
|
|
701
|
+
probe(server: string): Promise<ProbedTool[]>;
|
|
702
|
+
/** Record something that happened on the host for host.events. */
|
|
703
|
+
recordEvent(type: string, summary: string): void;
|
|
704
|
+
}
|
|
705
|
+
declare module '../runtime/runtime.ts' {
|
|
706
|
+
interface Services {
|
|
707
|
+
tools: Tools;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
export interface WorkSource {
|
|
711
|
+
topicId: string;
|
|
712
|
+
title: string;
|
|
713
|
+
via: 'ancestor' | 'ref';
|
|
714
|
+
note?: string;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* A work is anything a topic made. Four kinds, and no more: a file (a document, a picture, sound, video), a link
|
|
718
|
+
* (a page, a pull request, an issue), a note (a conclusion in words), a commit (in a repository the topic uses).
|
|
719
|
+
*/
|
|
720
|
+
export interface Work {
|
|
721
|
+
id: ResourceRef;
|
|
722
|
+
resource: ResourceRef;
|
|
723
|
+
kind: 'file' | 'link' | 'note' | 'commit';
|
|
724
|
+
title: string;
|
|
725
|
+
path?: string;
|
|
726
|
+
url?: string;
|
|
727
|
+
text?: string;
|
|
728
|
+
repo?: string;
|
|
729
|
+
hash?: string;
|
|
730
|
+
by: string;
|
|
731
|
+
byBasis?: FileBasis;
|
|
732
|
+
updatedBy?: string;
|
|
733
|
+
updatedByBasis?: FileBasis;
|
|
734
|
+
registeredBy?: string;
|
|
735
|
+
at: number;
|
|
736
|
+
pinned: boolean;
|
|
737
|
+
/** Shown first on the topic's page: pinned, or among the newest few. The rest is material. */
|
|
738
|
+
current: boolean;
|
|
739
|
+
from?: WorkSource;
|
|
740
|
+
}
|
|
741
|
+
export interface WorkReceiver {
|
|
742
|
+
surface: string;
|
|
743
|
+
target: string;
|
|
744
|
+
events: readonly string[];
|
|
745
|
+
receive(topicId: string, op: WorkOp): void | Promise<void>;
|
|
746
|
+
}
|
|
747
|
+
export type EventBody = {
|
|
748
|
+
event: string;
|
|
749
|
+
locator?: Locator;
|
|
750
|
+
payload?: Record<string, unknown>;
|
|
751
|
+
};
|
|
752
|
+
export type WorkEvent = EventBody & ({
|
|
753
|
+
resource: ResourceRef;
|
|
754
|
+
surface?: never;
|
|
755
|
+
target?: never;
|
|
756
|
+
} | {
|
|
757
|
+
resource?: never;
|
|
758
|
+
surface: string;
|
|
759
|
+
target: string;
|
|
760
|
+
});
|
|
761
|
+
export type WorkOp = WorkEvent & {
|
|
762
|
+
by: string;
|
|
763
|
+
at: number;
|
|
764
|
+
};
|
|
765
|
+
export interface ResolvedResource {
|
|
766
|
+
resource: ResourceRef;
|
|
767
|
+
kind: 'file' | 'link' | 'note' | 'commit';
|
|
768
|
+
title: string;
|
|
769
|
+
path?: string;
|
|
770
|
+
content?: string;
|
|
771
|
+
url?: string;
|
|
772
|
+
text?: string;
|
|
773
|
+
}
|
|
774
|
+
export interface ViewerCapabilities {
|
|
775
|
+
editable?: boolean;
|
|
776
|
+
annotatable?: boolean;
|
|
777
|
+
actions?: readonly string[];
|
|
778
|
+
}
|
|
779
|
+
export interface OpenTarget {
|
|
780
|
+
url: string;
|
|
781
|
+
frame?: true;
|
|
782
|
+
initialUrl?: string;
|
|
783
|
+
inline?: 'image' | 'text' | 'binary' | 'web';
|
|
784
|
+
renderer?: string;
|
|
785
|
+
}
|
|
786
|
+
export interface ViewerRegistration {
|
|
787
|
+
id: string;
|
|
788
|
+
match: {
|
|
789
|
+
exts?: readonly string[];
|
|
790
|
+
mime?: readonly string[];
|
|
791
|
+
kinds?: readonly ResolvedResource['kind'][];
|
|
792
|
+
};
|
|
793
|
+
priority?: number;
|
|
794
|
+
capabilities: ViewerCapabilities;
|
|
795
|
+
editor?: FileEditor;
|
|
796
|
+
open(resource: ResolvedResource, ctx: {
|
|
797
|
+
topicId: string;
|
|
798
|
+
locator?: Locator;
|
|
799
|
+
}): OpenTarget;
|
|
800
|
+
}
|
|
801
|
+
export interface ResourceView {
|
|
802
|
+
resource: ResourceRef;
|
|
803
|
+
title: string;
|
|
804
|
+
content?: string;
|
|
805
|
+
url?: string;
|
|
806
|
+
text?: string;
|
|
807
|
+
reveal?: boolean;
|
|
808
|
+
capabilities: ViewerCapabilities;
|
|
809
|
+
open: OpenTarget;
|
|
810
|
+
}
|
|
811
|
+
export type WordParagraph = {
|
|
812
|
+
table: boolean;
|
|
813
|
+
runs: {
|
|
814
|
+
index: number;
|
|
815
|
+
text: string;
|
|
816
|
+
}[];
|
|
817
|
+
};
|
|
818
|
+
type RunChange = {
|
|
819
|
+
index: number;
|
|
820
|
+
text: string;
|
|
821
|
+
};
|
|
822
|
+
export type DocumentChange = {
|
|
823
|
+
text?: string;
|
|
824
|
+
runs?: RunChange[];
|
|
825
|
+
};
|
|
826
|
+
type EditModel = {
|
|
827
|
+
format: 'text';
|
|
828
|
+
text: string;
|
|
829
|
+
} | {
|
|
830
|
+
format: 'docx';
|
|
831
|
+
paragraphs: WordParagraph[];
|
|
832
|
+
};
|
|
833
|
+
export interface FileEditor {
|
|
834
|
+
read(bytes: Buffer): EditModel | Promise<EditModel>;
|
|
835
|
+
apply(bytes: Buffer, change: DocumentChange): Buffer | Promise<Buffer>;
|
|
836
|
+
}
|
|
837
|
+
export type FileBasis = 'write' | 'turn';
|
|
838
|
+
export interface ResourceRetention {
|
|
839
|
+
retained: boolean;
|
|
840
|
+
protected: boolean;
|
|
841
|
+
}
|
|
842
|
+
/** `artifacts/` formal outputs, `attachments/` chat files, `tmp/` scratch, `other`: anything at the topic root no one declared. */
|
|
843
|
+
export type TopicResourceZone = 'artifacts' | 'attachments' | 'tmp' | 'other';
|
|
844
|
+
/** Content category exposed in Storage: image, rich media (audio/video), or file (including whole scratch directories). */
|
|
845
|
+
export type StorageCategory = 'image' | 'media' | 'file';
|
|
846
|
+
export interface TopicCleanupEntry {
|
|
847
|
+
topicId: string;
|
|
848
|
+
resource: ResourceRef;
|
|
849
|
+
path: string;
|
|
850
|
+
zone: TopicResourceZone;
|
|
851
|
+
category: StorageCategory;
|
|
852
|
+
/** True when this entry is a whole unprotected directory removed asynchronously as one unit. */
|
|
853
|
+
isDir: boolean;
|
|
854
|
+
/** Regular file count inside this unit (1 for a file, >= 0 for a directory). */
|
|
855
|
+
files: number;
|
|
856
|
+
/** Logical bytes, using regular files' stat.size. */
|
|
857
|
+
bytes: number;
|
|
858
|
+
/** Last modification time in ms (newest change for a directory unit). */
|
|
859
|
+
modifiedAt: number;
|
|
860
|
+
/** Identity fingerprint for change detection. */
|
|
861
|
+
version: string;
|
|
862
|
+
}
|
|
863
|
+
/** One cleanable path inside a client account directory, measured whole. */
|
|
864
|
+
export interface AccountStorageItem {
|
|
865
|
+
/** Relative to the account directory. */
|
|
866
|
+
path: string;
|
|
867
|
+
kind: ClientAccountStorage['kind'];
|
|
868
|
+
isDir: boolean;
|
|
869
|
+
files: number;
|
|
870
|
+
bytes: number;
|
|
871
|
+
modifiedAt: number;
|
|
872
|
+
version: string;
|
|
873
|
+
}
|
|
874
|
+
/** A client account directory as Storage shows it. */
|
|
875
|
+
export interface AccountStorageEntry {
|
|
876
|
+
accountId: string;
|
|
877
|
+
name: string;
|
|
878
|
+
adapter: string;
|
|
879
|
+
adapterTitle: string;
|
|
880
|
+
/** The whole directory. */
|
|
881
|
+
files: number;
|
|
882
|
+
bytes: number;
|
|
883
|
+
/** A member using the account has a live instance (or the account is being changed): nothing is offered. */
|
|
884
|
+
busy: boolean;
|
|
885
|
+
/** A member using the account holds a session taken in from outside: its session history is not offered. */
|
|
886
|
+
sessionsKept: boolean;
|
|
887
|
+
items: AccountStorageItem[];
|
|
888
|
+
}
|
|
889
|
+
declare module '../runtime/runtime.ts' {
|
|
890
|
+
interface Services {
|
|
891
|
+
/** Client account directories, from the plugin that owns the accounts. */
|
|
892
|
+
'storage.accounts': {
|
|
893
|
+
inventory(): Promise<AccountStorageEntry[]>;
|
|
894
|
+
/**
|
|
895
|
+
* Measure the listed items again and remove them all if every one is still offered at the same version;
|
|
896
|
+
* undefined (nothing removed) when the account is busy or any item changed.
|
|
897
|
+
*/
|
|
898
|
+
clean(accountId: string, items: readonly {
|
|
899
|
+
path: string;
|
|
900
|
+
version: string;
|
|
901
|
+
}[]): Promise<{
|
|
902
|
+
removed: AccountStorageItem[];
|
|
903
|
+
failed: number;
|
|
904
|
+
} | undefined>;
|
|
905
|
+
};
|
|
906
|
+
'storage.topicResources': {
|
|
907
|
+
/** Unprotected cleanup units in `tmp/`, `attachments/` and undeclared `other`. Never scans `artifacts/`. */
|
|
908
|
+
candidates(topicIds: readonly string[]): Promise<TopicCleanupEntry[]>;
|
|
909
|
+
/** Remove the listed units that are still unprotected candidates at the same version; returns what was removed. */
|
|
910
|
+
clean(topicId: string, entries: readonly {
|
|
911
|
+
resource: string;
|
|
912
|
+
version: string;
|
|
913
|
+
}[]): Promise<TopicCleanupEntry[]>;
|
|
914
|
+
};
|
|
915
|
+
works: {
|
|
916
|
+
list(topic: Topic): Work[];
|
|
917
|
+
links(prefix: string): {
|
|
918
|
+
topicId: string;
|
|
919
|
+
url: string;
|
|
920
|
+
}[];
|
|
921
|
+
link(topic: Topic, input: {
|
|
922
|
+
title: string;
|
|
923
|
+
url: string;
|
|
924
|
+
}, by: string): void;
|
|
925
|
+
register(receiver: WorkReceiver): () => void;
|
|
926
|
+
registerViewer(viewer: ViewerRegistration): () => void;
|
|
927
|
+
parseResource: typeof parseResource;
|
|
928
|
+
resourceWithin: typeof resourceWithin;
|
|
929
|
+
open(topic: Topic, resource: string, locator?: Locator): ResourceView | undefined;
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
interface Events {
|
|
933
|
+
'resource.changed': ResourceChange;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
export type MemoryKind = 'topic' | 'message' | 'note' | 'page' | 'file';
|
|
937
|
+
export type MemoryScope = 'all' | 'topic' | 'subtree';
|
|
938
|
+
export type NoteState = 'active' | 'retired';
|
|
939
|
+
export interface NoteSource {
|
|
940
|
+
topicId: string | null;
|
|
941
|
+
messageId?: string;
|
|
942
|
+
doc?: string;
|
|
943
|
+
}
|
|
944
|
+
export interface MemoryDoc {
|
|
945
|
+
id: string;
|
|
946
|
+
kind: MemoryKind;
|
|
947
|
+
topicId: string | null;
|
|
948
|
+
topicPath: string[];
|
|
949
|
+
tags: string[];
|
|
950
|
+
title: string;
|
|
951
|
+
who: string;
|
|
952
|
+
text: string;
|
|
953
|
+
state: NoteState;
|
|
954
|
+
version?: number;
|
|
955
|
+
fingerprint: string;
|
|
956
|
+
createdAt: number;
|
|
957
|
+
updatedAt: number;
|
|
958
|
+
meta?: {
|
|
959
|
+
parentId?: string | null;
|
|
960
|
+
dirRefs?: string[];
|
|
961
|
+
topicRefs?: string[];
|
|
962
|
+
archivedAt?: number | null;
|
|
963
|
+
thread?: string | null;
|
|
964
|
+
replyTo?: string | null;
|
|
965
|
+
read?: string[];
|
|
966
|
+
source?: NoteSource;
|
|
967
|
+
relPath?: string;
|
|
968
|
+
mtimeMs?: number;
|
|
969
|
+
size?: number;
|
|
970
|
+
sectionPlugin?: string;
|
|
971
|
+
rowIds?: string[];
|
|
972
|
+
rowAddresses?: Record<string, string>;
|
|
973
|
+
rowMessages?: string[];
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
export interface MemoryWhere {
|
|
977
|
+
url: string;
|
|
978
|
+
label: string;
|
|
979
|
+
topicId?: string;
|
|
980
|
+
messageId?: string;
|
|
981
|
+
file?: string;
|
|
982
|
+
heading?: string;
|
|
983
|
+
line?: number;
|
|
984
|
+
endLine?: number;
|
|
985
|
+
}
|
|
986
|
+
export interface MemorySearchOpts {
|
|
987
|
+
mode?: string;
|
|
988
|
+
scope?: MemoryScope;
|
|
989
|
+
topicId?: string;
|
|
990
|
+
kinds?: MemoryKind[];
|
|
991
|
+
since?: string;
|
|
992
|
+
until?: string;
|
|
993
|
+
includeRetired?: boolean;
|
|
994
|
+
limit?: number;
|
|
995
|
+
}
|
|
996
|
+
/** The shell resolves scope and dates once so all engines search the same set of documents. */
|
|
997
|
+
export interface MemorySearchFilters {
|
|
998
|
+
mode?: string;
|
|
999
|
+
topicIds?: string[];
|
|
1000
|
+
kinds?: MemoryKind[];
|
|
1001
|
+
since?: number;
|
|
1002
|
+
until?: number;
|
|
1003
|
+
includeRetired?: boolean;
|
|
1004
|
+
limit: number;
|
|
1005
|
+
}
|
|
1006
|
+
export type RankedDoc = MemoryDoc & {
|
|
1007
|
+
score?: number;
|
|
1008
|
+
match?: {
|
|
1009
|
+
text?: string;
|
|
1010
|
+
heading?: string;
|
|
1011
|
+
line?: number;
|
|
1012
|
+
endLine?: number;
|
|
1013
|
+
};
|
|
1014
|
+
};
|
|
1015
|
+
export interface MemoryHit {
|
|
1016
|
+
id: string;
|
|
1017
|
+
kind: MemoryKind;
|
|
1018
|
+
topicId: string | null;
|
|
1019
|
+
path: string;
|
|
1020
|
+
who: string;
|
|
1021
|
+
title: string;
|
|
1022
|
+
text: string;
|
|
1023
|
+
createdAt: number;
|
|
1024
|
+
where: MemoryWhere;
|
|
1025
|
+
score?: number;
|
|
1026
|
+
}
|
|
1027
|
+
export interface MemorySearchResult<Hit = MemoryHit> {
|
|
1028
|
+
by: string;
|
|
1029
|
+
total: number;
|
|
1030
|
+
hits: Hit[];
|
|
1031
|
+
}
|
|
1032
|
+
export interface MemoryEngineContext {
|
|
1033
|
+
dir: string;
|
|
1034
|
+
changed(): void;
|
|
1035
|
+
}
|
|
1036
|
+
/** Registrations owned by one activation. Operations run in order with engine switches. */
|
|
1037
|
+
export interface MemoryEngineScope {
|
|
1038
|
+
group(name: string, about: string): void;
|
|
1039
|
+
op(declaration: Op): void;
|
|
1040
|
+
effect(dispose: Disposer): void;
|
|
1041
|
+
}
|
|
1042
|
+
export interface MemoryEngineCapabilities {
|
|
1043
|
+
/** A native PDL view contributed by this engine. */
|
|
1044
|
+
panel?: string;
|
|
1045
|
+
/** Absolute directory containing the engine's bundled Skill folders. */
|
|
1046
|
+
skillsDir?: string;
|
|
1047
|
+
register?(scope: MemoryEngineScope): void;
|
|
1048
|
+
}
|
|
1049
|
+
export interface MemorySearchMode {
|
|
1050
|
+
id: string;
|
|
1051
|
+
label: string;
|
|
1052
|
+
about?: string;
|
|
1053
|
+
}
|
|
1054
|
+
export interface MemoryEngineToggle {
|
|
1055
|
+
on: boolean;
|
|
1056
|
+
busy?: boolean;
|
|
1057
|
+
label: string;
|
|
1058
|
+
enable: Action | 'configure';
|
|
1059
|
+
disable: Action;
|
|
1060
|
+
}
|
|
1061
|
+
export interface MemoryEngineConfigure {
|
|
1062
|
+
label: string;
|
|
1063
|
+
title?: string;
|
|
1064
|
+
submitLabel?: string;
|
|
1065
|
+
previewPath: string;
|
|
1066
|
+
applyPath: string;
|
|
1067
|
+
}
|
|
1068
|
+
export interface MemoryEngineStatus {
|
|
1069
|
+
state: string;
|
|
1070
|
+
label: string;
|
|
1071
|
+
tone?: 'ok' | 'warn' | 'danger';
|
|
1072
|
+
rows?: {
|
|
1073
|
+
label: string;
|
|
1074
|
+
value: string;
|
|
1075
|
+
}[];
|
|
1076
|
+
toggle?: MemoryEngineToggle;
|
|
1077
|
+
configure?: MemoryEngineConfigure;
|
|
1078
|
+
whenDisabled?: Action[];
|
|
1079
|
+
actions?: Action[];
|
|
1080
|
+
log?: string[];
|
|
1081
|
+
error?: string;
|
|
1082
|
+
}
|
|
1083
|
+
export interface MemoryEngine {
|
|
1084
|
+
readonly id: string;
|
|
1085
|
+
readonly title: string;
|
|
1086
|
+
readonly about: string;
|
|
1087
|
+
readonly manageUrl?: string;
|
|
1088
|
+
open(ctx: MemoryEngineContext): Promise<void> | void;
|
|
1089
|
+
close?(): Promise<void> | void;
|
|
1090
|
+
needsRebuild(): boolean;
|
|
1091
|
+
fingerprints(): Promise<Map<string, string>> | Map<string, string>;
|
|
1092
|
+
rebuild(docs: AsyncIterable<MemoryDoc>): Promise<void>;
|
|
1093
|
+
upsert(docs: MemoryDoc[]): Promise<void> | void;
|
|
1094
|
+
remove(ids: string[]): Promise<void> | void;
|
|
1095
|
+
removeTopic(topicId: string): Promise<void> | void;
|
|
1096
|
+
/** The first available mode is the default. */
|
|
1097
|
+
modes(): MemorySearchMode[];
|
|
1098
|
+
search(query: string, opts: MemorySearchFilters): Promise<MemorySearchResult<RankedDoc>>;
|
|
1099
|
+
status(): MemoryEngineStatus;
|
|
1100
|
+
onTurnEnded?(payload: {
|
|
1101
|
+
turn: TurnRecord;
|
|
1102
|
+
message?: Message;
|
|
1103
|
+
}): Promise<void> | void;
|
|
1104
|
+
}
|
|
1105
|
+
export interface NoteInput {
|
|
1106
|
+
text: string;
|
|
1107
|
+
title?: string;
|
|
1108
|
+
tags?: string[];
|
|
1109
|
+
}
|
|
1110
|
+
export interface MemoryNote extends NoteInput {
|
|
1111
|
+
id: string;
|
|
1112
|
+
tags: string[];
|
|
1113
|
+
topicId: string | null;
|
|
1114
|
+
who: string;
|
|
1115
|
+
at: number;
|
|
1116
|
+
updatedAt: number;
|
|
1117
|
+
version: number;
|
|
1118
|
+
state: NoteState;
|
|
1119
|
+
source?: NoteSource;
|
|
1120
|
+
reason?: string;
|
|
1121
|
+
replacedBy?: string;
|
|
1122
|
+
}
|
|
1123
|
+
export type NotePatch = Partial<NoteInput & Pick<MemoryNote, 'state' | 'reason' | 'replacedBy'>> & {
|
|
1124
|
+
baseVersion?: number;
|
|
1125
|
+
};
|
|
1126
|
+
export interface NoteQuery {
|
|
1127
|
+
scope?: MemoryScope;
|
|
1128
|
+
topicId?: string;
|
|
1129
|
+
state?: NoteState;
|
|
1130
|
+
limit?: number;
|
|
1131
|
+
}
|
|
1132
|
+
export type MemoryRead = MemoryDoc & {
|
|
1133
|
+
where: MemoryWhere;
|
|
1134
|
+
context?: {
|
|
1135
|
+
before?: MemoryDoc;
|
|
1136
|
+
after?: MemoryDoc;
|
|
1137
|
+
};
|
|
1138
|
+
history?: MemoryNote[];
|
|
1139
|
+
note?: MemoryNote;
|
|
1140
|
+
};
|
|
1141
|
+
export interface MemoryStatus {
|
|
1142
|
+
engineId: string;
|
|
1143
|
+
/** Only published while the active engine's capabilities are mounted. */
|
|
1144
|
+
panel?: string;
|
|
1145
|
+
unavailableEngineId?: string;
|
|
1146
|
+
engines: Pick<MemoryEngine, 'id' | 'title' | 'about' | 'manageUrl'>[];
|
|
1147
|
+
modes: MemorySearchMode[];
|
|
1148
|
+
engine?: MemoryEngineStatus;
|
|
1149
|
+
counts: Record<MemoryKind, number>;
|
|
1150
|
+
sync: {
|
|
1151
|
+
state: 'syncing' | 'ready' | 'error';
|
|
1152
|
+
error?: string;
|
|
1153
|
+
syncedAt?: number;
|
|
1154
|
+
rebuiltAt?: number;
|
|
1155
|
+
};
|
|
1156
|
+
notes: (MemoryNote & {
|
|
1157
|
+
where: MemoryWhere;
|
|
1158
|
+
path: string;
|
|
1159
|
+
archived: boolean;
|
|
1160
|
+
})[];
|
|
1161
|
+
}
|
|
1162
|
+
export interface MemoryService {
|
|
1163
|
+
/** Advertise a candidate for the lifetime of its provider. Mount its capabilities only while selected. */
|
|
1164
|
+
registerEngine(owner: Ctx, engine: MemoryEngine, capabilities?: MemoryEngineCapabilities): void;
|
|
1165
|
+
search(query: string, opts?: MemorySearchOpts): Promise<MemorySearchResult>;
|
|
1166
|
+
get(id: string, opts?: {
|
|
1167
|
+
context?: boolean;
|
|
1168
|
+
history?: boolean;
|
|
1169
|
+
}): Promise<MemoryRead | undefined>;
|
|
1170
|
+
listNotes(opts?: NoteQuery): MemoryStatus['notes'];
|
|
1171
|
+
saveNote(input: NoteInput & {
|
|
1172
|
+
topicId: string | null;
|
|
1173
|
+
who: string;
|
|
1174
|
+
source?: NoteSource;
|
|
1175
|
+
}): Promise<MemoryNote>;
|
|
1176
|
+
updateNote(id: string, patch: NotePatch): Promise<{
|
|
1177
|
+
conflict: boolean;
|
|
1178
|
+
note: MemoryNote;
|
|
1179
|
+
}>;
|
|
1180
|
+
forgetNote(id: string): Promise<void>;
|
|
1181
|
+
rebuild(engineId?: string): Promise<void>;
|
|
1182
|
+
status(): Promise<MemoryStatus>;
|
|
1183
|
+
}
|
|
1184
|
+
export interface MemorySourceDoc {
|
|
1185
|
+
id: string;
|
|
1186
|
+
title: string;
|
|
1187
|
+
text: string;
|
|
1188
|
+
rowIds?: string[];
|
|
1189
|
+
rowAddresses?: Record<string, string>;
|
|
1190
|
+
rowMessages?: string[];
|
|
1191
|
+
}
|
|
1192
|
+
export interface MemorySource {
|
|
1193
|
+
/** The provider's existing domain event that signals a change to its indexed documents. */
|
|
1194
|
+
event?: {
|
|
1195
|
+
[K in keyof Events]: Events[K] extends {
|
|
1196
|
+
topicIds: string[];
|
|
1197
|
+
} | {
|
|
1198
|
+
topicId: string;
|
|
1199
|
+
} ? K : never;
|
|
1200
|
+
}[keyof Events];
|
|
1201
|
+
/** Topics affected by a change on `sourceTopicId`, or all topics with content when omitted. */
|
|
1202
|
+
topics?(sourceTopicId?: string): Iterable<string>;
|
|
1203
|
+
/** Documents contributed by this provider for one topic. */
|
|
1204
|
+
docs(topicId: string): MemorySourceDoc[] | Promise<MemorySourceDoc[]>;
|
|
1205
|
+
}
|
|
1206
|
+
declare module '../runtime/runtime.ts' {
|
|
1207
|
+
interface Hooks {
|
|
1208
|
+
'memory.engines': [Record<string, never>, MemoryEngine];
|
|
1209
|
+
'memory.sources': [Record<string, never>, MemorySource];
|
|
1210
|
+
}
|
|
1211
|
+
interface Services {
|
|
1212
|
+
memory: MemoryService;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
export type ModelFamilyResolver = (model: string) => readonly string[] | null | undefined;
|
|
1216
|
+
export interface MemberModelInfo {
|
|
1217
|
+
model: string;
|
|
1218
|
+
turnId: string;
|
|
1219
|
+
at: number;
|
|
1220
|
+
}
|
|
1221
|
+
export interface ModelsService {
|
|
1222
|
+
familiesOf(model: string | null | undefined): string[];
|
|
1223
|
+
memberModel(memberId: string): MemberModelInfo | null;
|
|
1224
|
+
turnModel(turnId: string): string | null;
|
|
1225
|
+
/** Resolve the model to check for co-signing/review: reported turn model > configured member model > latest reported turn model. */
|
|
1226
|
+
effectiveModel(memberId: string, turnId?: string): string | null;
|
|
1227
|
+
registerFamilyResolver(resolver: ModelFamilyResolver): Disposer;
|
|
1228
|
+
}
|
|
1229
|
+
export interface ModelProfilesService {
|
|
1230
|
+
rebuild(since?: number): Promise<{
|
|
1231
|
+
count: number;
|
|
1232
|
+
sources: Record<string, boolean>;
|
|
1233
|
+
}>;
|
|
1234
|
+
checkExpiry(now?: number): Promise<{
|
|
1235
|
+
demoted: {
|
|
1236
|
+
key: string;
|
|
1237
|
+
kind: 'model' | 'client';
|
|
1238
|
+
count: number;
|
|
1239
|
+
}[];
|
|
1240
|
+
}>;
|
|
1241
|
+
checkWakeup(now?: number): Promise<{
|
|
1242
|
+
woke: {
|
|
1243
|
+
model: string;
|
|
1244
|
+
memberId: string;
|
|
1245
|
+
reason: string;
|
|
1246
|
+
messageId: string;
|
|
1247
|
+
}[];
|
|
1248
|
+
deferred: string[];
|
|
1249
|
+
}>;
|
|
1250
|
+
}
|
|
1251
|
+
declare module '../runtime/runtime.ts' {
|
|
1252
|
+
interface Services {
|
|
1253
|
+
models: ModelsService;
|
|
1254
|
+
modelProfiles: ModelProfilesService;
|
|
1255
|
+
}
|
|
1256
|
+
interface Events {
|
|
1257
|
+
'profiles.changed': {
|
|
1258
|
+
topicId: string;
|
|
1259
|
+
key?: string;
|
|
1260
|
+
kind?: 'model' | 'client';
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
}
|