hostlet 0.0.0-stage → 0.1.0-alpha.1
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 +916 -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 +130 -0
- package/dist/plugins/model-profiles/rules.js +729 -0
- package/dist/plugins/model-profiles/skills/model-profile/SKILL.md +59 -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 +84 -0
- package/dist/plugins/model-profiles/storage.js +315 -0
- package/dist/plugins/model-profiles/types.d.ts +179 -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 +455 -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 +270 -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,619 @@
|
|
|
1
|
+
export default function (ui) {
|
|
2
|
+
ui.registerMemberCredentials(() => ui.request('GET', '/api/keys'));
|
|
3
|
+
const t = ui.t;
|
|
4
|
+
const models = {}, actions = {}, inputs = {}, changes = {};
|
|
5
|
+
const dashboard = () => vmRead('plugin:ops/dashboard');
|
|
6
|
+
let panel, pageShown = false, keysLoading = true, keysError = '';
|
|
7
|
+
let localAccounts = [], localRead = 0, listedMembers = HL.members;
|
|
8
|
+
let range = '24h', historyAccount = '', historyWindow = '';
|
|
9
|
+
let burn = null, burnLoading = true, burnError = '', sampling = false, sampleMessage = '', burnRequest = 0;
|
|
10
|
+
|
|
11
|
+
const showingAccounts = () => panel === 'quota' || ui.shown('keys');
|
|
12
|
+
|
|
13
|
+
async function readLocalAccounts() {
|
|
14
|
+
const reading = ++localRead;
|
|
15
|
+
const rows = await ui.request('GET', '/api/keys/accounts/local');
|
|
16
|
+
if (ui.signal.aborted || reading !== localRead) return;
|
|
17
|
+
const previous = new Map(localAccounts.flatMap(group => group.members.map(id => [id, group.key])));
|
|
18
|
+
for (const group of rows) {
|
|
19
|
+
for (const id of group.members) {
|
|
20
|
+
if (previous.get(id) !== group.key && (previous.has(id) || group.configured)) HL_RUN_QUOTAS.delete(id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
localAccounts = rows;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function refreshLocalAccounts() {
|
|
28
|
+
if (!showingAccounts() || !(await readLocalAccounts())) return;
|
|
29
|
+
if (!ui.signal.aborted && showingAccounts()) {
|
|
30
|
+
hlReadKeysQuotas();
|
|
31
|
+
render(true);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function readKeys() {
|
|
36
|
+
await Promise.all([hlKeysRead(ui.request), readLocalAccounts()]);
|
|
37
|
+
if (showingAccounts() && !ui.signal.aborted) hlReadKeysQuotas();
|
|
38
|
+
render(true);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function readBurn(tab, quiet = false) {
|
|
42
|
+
const reading = ++burnRequest;
|
|
43
|
+
const query = new URLSearchParams({ includeUsage: 'false' });
|
|
44
|
+
if (tab === 'usage') {
|
|
45
|
+
query.set('range', range);
|
|
46
|
+
query.set('includePoints', 'true');
|
|
47
|
+
}
|
|
48
|
+
burnError = '';
|
|
49
|
+
if (!quiet) {
|
|
50
|
+
burnLoading = true;
|
|
51
|
+
render(true);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const result = await ui.request('GET', '/api/keys/quotas/burn?' + query);
|
|
55
|
+
if (reading !== burnRequest || ui.signal.aborted) return;
|
|
56
|
+
burn = result;
|
|
57
|
+
if (tab === 'usage' && !historyAccount) {
|
|
58
|
+
const firstPlottable = result.accounts.find(account => Object.values(account.windows)
|
|
59
|
+
.some(window => window.points?.some(point => point.usedPercent != null)));
|
|
60
|
+
if (firstPlottable) historyAccount = firstPlottable.key;
|
|
61
|
+
}
|
|
62
|
+
} catch (failure) {
|
|
63
|
+
if (reading === burnRequest && !ui.signal.aborted) burnError = failure.message;
|
|
64
|
+
} finally {
|
|
65
|
+
if (reading === burnRequest && !ui.signal.aborted) {
|
|
66
|
+
burnLoading = false;
|
|
67
|
+
render(true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function refreshBurn() {
|
|
73
|
+
if (panel === 'quota' || panel === 'usage') return readBurn(panel, true);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function readQuotaAccounts() {
|
|
77
|
+
keysLoading = true;
|
|
78
|
+
keysError = '';
|
|
79
|
+
render(true);
|
|
80
|
+
try {
|
|
81
|
+
await readKeys();
|
|
82
|
+
} catch (failure) {
|
|
83
|
+
if (!ui.signal.aborted) keysError = failure.message;
|
|
84
|
+
} finally {
|
|
85
|
+
if (!ui.signal.aborted) {
|
|
86
|
+
keysLoading = false;
|
|
87
|
+
render(true);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function hlProtocols() { return [['openai', t('protoOpenai')], ['openai-responses', t('protoResponses')], ['anthropic', 'Anthropic'], ['gemini', 'Gemini']]; }
|
|
93
|
+
function hlLocalAccountGroups() {
|
|
94
|
+
return localAccounts.map(function (group) {
|
|
95
|
+
const adapter = HLP.adapters?.find(function (item) { return item.name === group.adapter; });
|
|
96
|
+
const members = group.members.map(hlMember).filter(function (m) {
|
|
97
|
+
return m && !m.key && m.adapter === group.adapter;
|
|
98
|
+
});
|
|
99
|
+
return { ...group, adapterName: group.adapter, adapter, members, rep: members.find(function (m) { return m.id === group.rep; }) };
|
|
100
|
+
}).filter(function (group) { return group.members.length > 0; });
|
|
101
|
+
}
|
|
102
|
+
function hlKeyQuotaRep(keyId) {
|
|
103
|
+
const adapters = HLP.adapters || [];
|
|
104
|
+
const users = (HL.members || []).filter(function (m) {
|
|
105
|
+
return m.key === keyId && adapters.find(function (a) { return a.name === m.adapter; })?.capabilities.quota;
|
|
106
|
+
});
|
|
107
|
+
return users.find(function (m) { return m.enabled; }) || users[0] || null;
|
|
108
|
+
}
|
|
109
|
+
function hlReadKeyQuotas(force) {
|
|
110
|
+
const reqs = [];
|
|
111
|
+
(HLP.keys || []).forEach(function (k) {
|
|
112
|
+
const rep = k.adapter ? (k.loggedIn && HLP.adapters?.find(function (a) { return a.name === k.adapter; })?.capabilities.quota ? k : null) : hlKeyQuotaRep(k.id);
|
|
113
|
+
if (rep) {
|
|
114
|
+
const p = hlRunQuotaRead(rep, force);
|
|
115
|
+
if (p) reqs.push(p);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return reqs;
|
|
119
|
+
}
|
|
120
|
+
function hlReadKeysQuotas(force) {
|
|
121
|
+
const reqs = [];
|
|
122
|
+
hlLocalAccountGroups().forEach(function (g) {
|
|
123
|
+
if (g.adapter?.capabilities?.quota && g.rep) {
|
|
124
|
+
const p = hlRunQuotaRead(g.rep, force);
|
|
125
|
+
if (p) reqs.push(p);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return reqs.concat(hlReadKeyQuotas(force));
|
|
129
|
+
}
|
|
130
|
+
function hlKeyQuotaRings(member, groups) {
|
|
131
|
+
const rings = groups.flatMap(function (group) {
|
|
132
|
+
return group.items.map(function (item) { return item.gauge; });
|
|
133
|
+
});
|
|
134
|
+
return rings.length ? { id: member.id, rings: rings } : null;
|
|
135
|
+
}
|
|
136
|
+
function hlKeyQuotaDetails(member) {
|
|
137
|
+
const groups = hlRunQuotaGroups(hlRunQuotaWindows(member));
|
|
138
|
+
return { groups: groups, loading: !groups.length && hlRunQuotaLoading(member) };
|
|
139
|
+
}
|
|
140
|
+
function hlKeysRead(request = hlFetch) {
|
|
141
|
+
return Promise.all([request('GET', '/api/keys'), request('GET', '/api/keys/tiers'), hlAdaptersRead()]).then(function ([keys, tiers]) {
|
|
142
|
+
HLP.keys = keys;
|
|
143
|
+
HLP.tiers = tiers || {};
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function hlKeysView({ prefix = 'hl', readOnly = false } = {}) {
|
|
147
|
+
const adaptersLoaded = Array.isArray(HLP.adapters);
|
|
148
|
+
const sep = tc('hl.common.sepList');
|
|
149
|
+
const managed = (HLP.keys || []).filter(function (key) { return key.adapter; }).map(function (account) {
|
|
150
|
+
return { key: account.id, adapterName: account.adapter, adapter: HLP.adapters?.find(function (a) { return a.name === account.adapter; }),
|
|
151
|
+
members: HL.members.filter(function (m) { return m.key === account.id; }), rep: account.loggedIn ? account : null, account: account };
|
|
152
|
+
});
|
|
153
|
+
const accounts = managed.concat(hlLocalAccountGroups()).map(function (g) {
|
|
154
|
+
const a = g.adapter, account = g.account, rep = g.rep;
|
|
155
|
+
const client = a?.title || g.adapterName;
|
|
156
|
+
const hasQuota = !!a?.capabilities?.quota && !!rep;
|
|
157
|
+
const usage = g.members.length ? t('usedBy', g.members.map(function (m) { return m.name; }).join(sep)) : t('notUsed');
|
|
158
|
+
const clientState = !a ? '' : !a.capabilities?.detect ? tc('hl.members.clientRegistered') :
|
|
159
|
+
a.detected?.installed ? [tc('hl.members.clientDetected'), a.detected.version || a.detected.note].filter(Boolean).join(' · ') :
|
|
160
|
+
[tc('hl.members.clientMissing'), a.detected?.note].filter(Boolean).join(' · ');
|
|
161
|
+
const isToken = account?.authMode === 'token';
|
|
162
|
+
const tokenCap = a?.capabilities?.accountToken;
|
|
163
|
+
const tier = (HLP.tiers || {})[g.key] || account?.tier || '';
|
|
164
|
+
const kv = [{ k: t('kvClient'), v: [client, clientState].filter(Boolean).join(' · ') }];
|
|
165
|
+
if (tier) kv.push({ k: t('setTier'), v: tier });
|
|
166
|
+
if (isToken) kv.push({ k: t('authMode'), v: tokenCap?.label || t('authToken') });
|
|
167
|
+
if (account) kv.push({ k: t('accountDir'), v: account.dir, copy: true });
|
|
168
|
+
kv.push({ k: t('kvMembers'), v: g.members.map(function (m) {
|
|
169
|
+
return m.name + ' (@' + m.handle + ')' + (m.enabled ? '' : tc('hl.members.disabledTag'));
|
|
170
|
+
}).join(sep) || t('notUsed') });
|
|
171
|
+
if (g.customCmd) kv.push({ k: t('kvCommand'), v: g.customCmd });
|
|
172
|
+
const quotas = hasQuota ? hlKeyQuotaDetails(rep) : null;
|
|
173
|
+
const canManage = !readOnly && !!account && webLocalConsole();
|
|
174
|
+
const stateKey = isToken
|
|
175
|
+
? (account.loggedIn === null ? 'clientUnavailable' : account.loggedIn ? 'tokenConfigured' : 'tokenMissing')
|
|
176
|
+
: (account?.loggedIn === null ? 'clientUnavailable' : account?.loggedIn ? 'signedIn' : 'signedOut');
|
|
177
|
+
return {
|
|
178
|
+
key: g.key, id: account?.id, title: account ? account.name : client,
|
|
179
|
+
identity: { name: client, avatarPath: a?.icon, color: a?.memberTemplate?.color },
|
|
180
|
+
sub: [account ? client : t(g.configured ? 'configuredAccount' : 'localAccount'),
|
|
181
|
+
isToken ? t('authToken') : '',
|
|
182
|
+
tier,
|
|
183
|
+
account ? t(stateKey) : '',
|
|
184
|
+
a?.detected?.installed === false ? tc('hl.members.clientMissing') : '', g.customCmd, usage,
|
|
185
|
+
g.members.length && g.members.every(function (m) { return !m.enabled; }) ? tc('hl.common.disabled') : ''].filter(Boolean).join(' · '),
|
|
186
|
+
supportsQuota: hasQuota, quota: hasQuota ? hlMemberQuota(rep) : null, quotaRefreshing: hasQuota && hlRunQuotaLoading(rep),
|
|
187
|
+
quotaNote: adaptersLoaded && !a?.capabilities?.quota ? t('noQuota') : '',
|
|
188
|
+
quotas: quotas, kv: kv,
|
|
189
|
+
login: canManage && !isToken && !!a?.capabilities.account && !account.loggedIn,
|
|
190
|
+
setToken: canManage && isToken && !!tokenCap && !account.loggedIn,
|
|
191
|
+
updateToken: canManage && isToken && !!tokenCap && !!account.loggedIn,
|
|
192
|
+
logout: canManage && !isToken && !!account.loggedIn,
|
|
193
|
+
clearToken: canManage && isToken && !!account.loggedIn,
|
|
194
|
+
remove: canManage && !g.members.length,
|
|
195
|
+
canEditTier: !readOnly,
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
const keys = (HLP.keys || []).filter(function (k) { return k.protocol; }).map(function (k) {
|
|
199
|
+
const users = HL.members.filter(function (m) { return m.key === k.id; });
|
|
200
|
+
const quotaRep = hlKeyQuotaRep(k.id);
|
|
201
|
+
const quotas = quotaRep ? hlKeyQuotaDetails(quotaRep) : null;
|
|
202
|
+
return {
|
|
203
|
+
id: k.id,
|
|
204
|
+
name: k.name,
|
|
205
|
+
sub: k.protocol + ' · ' + (k.endpoint || t('defaultEndpoint')) + ' · ' + (users.length ? t('usedBy', users.map(function (m) { return m.name; }).join(sep)) : t('notUsed')),
|
|
206
|
+
quota: quotas ? hlKeyQuotaRings(quotaRep, quotas.groups) : null,
|
|
207
|
+
quotas: quotas, client: quotaRep?.adapter,
|
|
208
|
+
quotaRefreshing: !!quotaRep && hlRunQuotaLoading(quotaRep),
|
|
209
|
+
};
|
|
210
|
+
}).filter(function (key) { return !readOnly || key.quotas; });
|
|
211
|
+
return {
|
|
212
|
+
accounts: accounts,
|
|
213
|
+
accountListId: prefix + '-accounts',
|
|
214
|
+
keyListId: prefix + '-keys',
|
|
215
|
+
manageKeys: !readOnly,
|
|
216
|
+
showKeys: !readOnly || keys.length > 0,
|
|
217
|
+
canAddAccount: !readOnly && webLocalConsole() && HLP.adapters?.some(function (a) { return a.capabilities.account; }),
|
|
218
|
+
keys: keys,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function hlBurnRateText(value) {
|
|
222
|
+
if (value == null) return '—';
|
|
223
|
+
if (value === 0) return '0%/h';
|
|
224
|
+
return (Math.abs(value) < 10 ? value.toFixed(1) : String(Math.round(value))).replace(/\.0$/, '') + '%/h';
|
|
225
|
+
}
|
|
226
|
+
function hlBurnDuration(ms) {
|
|
227
|
+
if (ms == null || !Number.isFinite(ms)) return '—';
|
|
228
|
+
if (ms <= 0) return t('depleted');
|
|
229
|
+
if (ms < 60_000) return t('lessThanMinute');
|
|
230
|
+
if (ms < 3_600_000) return t('minutesOnly', Math.max(1, Math.round(ms / 60_000)));
|
|
231
|
+
const hours = ms / 3_600_000;
|
|
232
|
+
if (hours < 48) return t('hoursOnly', String(Math.round(hours * 10) / 10).replace(/\.0$/, ''));
|
|
233
|
+
let days = Math.floor(hours / 24);
|
|
234
|
+
let rest = Math.round(hours - days * 24);
|
|
235
|
+
if (rest === 24) { days += 1; rest = 0; }
|
|
236
|
+
return rest === 0 ? t('daysOnly', days) : t('daysHours', days, rest);
|
|
237
|
+
}
|
|
238
|
+
function hlBurnTime(at) {
|
|
239
|
+
return at == null ? '' : new Date(at).toLocaleString(ui.lang());
|
|
240
|
+
}
|
|
241
|
+
function hlBurnDepletionText(w) {
|
|
242
|
+
if (w.predictionStatus === 'depleted') return t('depleted');
|
|
243
|
+
if (w.predictionStatus === 'predicted' && w.hoursToDeplete != null) {
|
|
244
|
+
const text = hlBurnDuration(w.hoursToDeplete * 3_600_000);
|
|
245
|
+
return w.beforeReset === true ? t('depleteBeforeReset', text) : text;
|
|
246
|
+
}
|
|
247
|
+
if (w.predictionStatus === 'no_consumption') return t('noConsumption');
|
|
248
|
+
if (w.predictionStatus === 'awaiting_sample') return t('awaitingSample');
|
|
249
|
+
return t('insufficientSamples');
|
|
250
|
+
}
|
|
251
|
+
function hlBurnSource(account) {
|
|
252
|
+
const client = account.adapterTitle || account.adapter;
|
|
253
|
+
if (!client) return t('sourceUnknown');
|
|
254
|
+
const source = account.local ? 'sourceLocal' : account.apiKey ? 'sourceApiKey' : 'sourceManaged';
|
|
255
|
+
return client + ' · ' + t(source);
|
|
256
|
+
}
|
|
257
|
+
function hlBurnAccountTitle(account) {
|
|
258
|
+
return account.name + (account.tier ? ' (' + account.tier + ')' : '');
|
|
259
|
+
}
|
|
260
|
+
function hlBurnRow(account, label, w) {
|
|
261
|
+
const normalized = w.rateBasis === 'h1' ? w.h1.normalizedRatePerHour : w.rateBasis === 'h24' ? w.h24.normalizedRatePerHour : null;
|
|
262
|
+
const depletionTip = w.depletesAt ? t('depletesAt', hlBurnTime(w.depletesAt)) + (w.beforeReset === true ? '\n' + t('beforeResetTip') : '') : '';
|
|
263
|
+
return {
|
|
264
|
+
label: hlBurnAccountTitle(account) + ' · ' + label,
|
|
265
|
+
cells: [
|
|
266
|
+
{ text: hlBurnSource(account) },
|
|
267
|
+
{ text: w.currentPercent == null ? '—' : Math.round(w.currentPercent) + '%', tip: w.lastSampleAt ? t('sampledAt', hlBurnTime(w.lastSampleAt)) : '' },
|
|
268
|
+
{ text: hlBurnRateText(w.h1.ratePerHour), tip: t('rateTip', w.h1.samples, Math.round(w.h1.elapsedMs / 60000)) },
|
|
269
|
+
{ text: hlBurnRateText(w.h24.ratePerHour), tip: t('rateTip', w.h24.samples, Math.round(w.h24.elapsedMs / 60000)) },
|
|
270
|
+
{ text: account.multiplier == null ? '—' : hlBurnRateText(normalized), tip: t('normalizedTip', hlBurnRateText(w.h1.normalizedRatePerHour), hlBurnRateText(w.h24.normalizedRatePerHour)) },
|
|
271
|
+
{ text: hlBurnDepletionText(w), tip: depletionTip },
|
|
272
|
+
{ text: w.resetInMs != null ? hlBurnDuration(w.resetInMs) : '—', tip: w.resetsAt ? t('resetsAt', hlBurnTime(w.resetsAt)) : '' },
|
|
273
|
+
{ text: String(w.sampleCount), tip: t('samplesTip', w.sampleCount, w.lastSampleAt ? hlBurnTime(w.lastSampleAt) : '—') },
|
|
274
|
+
],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function hlBurnChart(account, windowLabel, now, range) {
|
|
279
|
+
const span = range === '24h' ? 86_400_000 : range === '7d' ? 7 * 86_400_000 : 14 * 86_400_000;
|
|
280
|
+
const windows = windowLabel ? [[windowLabel, account.windows[windowLabel]]] : Object.entries(account.windows);
|
|
281
|
+
return {
|
|
282
|
+
label: hlBurnAccountTitle(account) + ' · ' + hlBurnSource(account),
|
|
283
|
+
min: 0,
|
|
284
|
+
max: 100,
|
|
285
|
+
xMin: now - span,
|
|
286
|
+
xMax: now,
|
|
287
|
+
xLabels: range === '24h'
|
|
288
|
+
? [t('range24Start'), t('range24Mid'), t('rangeNow')]
|
|
289
|
+
: range === '7d'
|
|
290
|
+
? [t('range7Start'), t('range7Mid'), t('rangeNow')]
|
|
291
|
+
: [t('range14Start'), t('range14Mid'), t('rangeNow')],
|
|
292
|
+
empty: t('chartEmpty'),
|
|
293
|
+
series: windows.map(function ([label, w]) {
|
|
294
|
+
let pendingReset = false;
|
|
295
|
+
const points = [];
|
|
296
|
+
for (const point of w.points || []) {
|
|
297
|
+
if (point.reset) pendingReset = true;
|
|
298
|
+
if (point.usedPercent == null) continue;
|
|
299
|
+
const reset = pendingReset;
|
|
300
|
+
pendingReset = false;
|
|
301
|
+
points.push({
|
|
302
|
+
x: point.at,
|
|
303
|
+
y: point.usedPercent,
|
|
304
|
+
reset,
|
|
305
|
+
tip: label + ' · ' + Math.round(point.usedPercent) + '% · ' + hlBurnTime(point.at) + (reset ? ' · ' + t('resetMark') : ''),
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return { name: label, points };
|
|
309
|
+
}).filter(function (series) { return series.points.length > 0; }),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function hlKeyQuotaTarget(key) {
|
|
314
|
+
if (!key) return null;
|
|
315
|
+
const item = (HLP.keys || []).find(function (k) { return k.id === key; });
|
|
316
|
+
if (item) {
|
|
317
|
+
if (item.adapter) return item.loggedIn && HLP.adapters?.find(function (a) { return a.name === item.adapter; })?.capabilities.quota ? item : null;
|
|
318
|
+
return hlKeyQuotaRep(item.id);
|
|
319
|
+
}
|
|
320
|
+
const local = hlLocalAccountGroups().find(function (g) { return g.key === key; });
|
|
321
|
+
return local?.adapter?.capabilities?.quota ? local.rep : null;
|
|
322
|
+
}
|
|
323
|
+
actions.hlKeyQuotaRefresh = function (d) {
|
|
324
|
+
const rep = hlKeyQuotaTarget(d?.key);
|
|
325
|
+
if (!rep) return;
|
|
326
|
+
const req = hlRunQuotaRead(rep, true);
|
|
327
|
+
render(true);
|
|
328
|
+
return req;
|
|
329
|
+
};
|
|
330
|
+
function hlAccountRefresh(id) {
|
|
331
|
+
HL_RUN_QUOTAS.delete(id);
|
|
332
|
+
HL.members.forEach(function (m) { if (m.key === id) HL_RUN_QUOTAS.delete(m.id); });
|
|
333
|
+
return ui.shown('keys') ? readKeys() : Promise.resolve(hlRefreshVisibleMemberQuotas());
|
|
334
|
+
}
|
|
335
|
+
async function hlAccountTerminal(account) {
|
|
336
|
+
const terminal = await ui.request('POST', '/api/keys/' + account.id + '/login', {});
|
|
337
|
+
const title = t('loginTitle', account.name);
|
|
338
|
+
const command = { path: terminal.path, title: title, onExit: async function (frame) {
|
|
339
|
+
if (frame.code !== 0 || frame.signal) return;
|
|
340
|
+
const keys = await ui.request('GET', '/api/keys');
|
|
341
|
+
if (S.dialog?.commandTerminal !== command || !keys.some(function (k) { return k.id === account.id && k.loggedIn; })) return;
|
|
342
|
+
HLP.keys = keys;
|
|
343
|
+
S.dialog = null;
|
|
344
|
+
toast(t('loginSaved', account.name));
|
|
345
|
+
} };
|
|
346
|
+
ui.dialog({ title: title, layout: 'viewport', text: account.dir && t('loginDir', account.dir),
|
|
347
|
+
commandTerminal: command, body: { type: 'view', id: 'ws.terminal' } });
|
|
348
|
+
}
|
|
349
|
+
function hlAccountAddFields(clients, adapterName, mode, values) {
|
|
350
|
+
const selected = clients.find(function (a) { return a.name === adapterName; }) || clients[0];
|
|
351
|
+
const tokenCap = selected?.capabilities?.accountToken;
|
|
352
|
+
const authMode = tokenCap && mode === 'token' ? 'token' : 'login';
|
|
353
|
+
const fields = [
|
|
354
|
+
{ id: 'hl-account-name', label: tc('hl.common.name'), value: values.name || '', req: true },
|
|
355
|
+
{ id: 'hl-account-client', label: t('kvClient'), value: selected.name,
|
|
356
|
+
options: clients.map(function (a) { return [a.name, a.title]; }), change: ui.key('hlAccountAddClient') }
|
|
357
|
+
];
|
|
358
|
+
if (tokenCap) {
|
|
359
|
+
fields.push({ id: 'hl-account-mode', label: t('authMode'), value: authMode,
|
|
360
|
+
options: [['login', t('authLogin')], ['token', tokenCap.label]], change: ui.key('hlAccountAddMode') });
|
|
361
|
+
if (authMode === 'token') {
|
|
362
|
+
fields.push({ id: 'hl-account-token', label: t('tokenLabel'), value: values.token || '', req: true,
|
|
363
|
+
placeholder: tokenCap.placeholder || '', help: tokenCap.help || '' });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
fields.push({ id: 'hl-account-dir', label: t('accountDir'), value: values.dir || '', req: true,
|
|
367
|
+
foot: t('accountDirHelp'), links: [{ label: t('chooseDir'), act: ui.key('hlAccountPickDir') }] });
|
|
368
|
+
return { fields: fields, authMode: authMode };
|
|
369
|
+
}
|
|
370
|
+
function hlAccountAddSync(adapterName, mode) {
|
|
371
|
+
const form = S.dialog;
|
|
372
|
+
if (!form?.accountAdd) return;
|
|
373
|
+
dlgSync();
|
|
374
|
+
const values = {
|
|
375
|
+
name: dlgFieldById('hl-account-name')?.value || '',
|
|
376
|
+
token: dlgFieldById('hl-account-token')?.value || '',
|
|
377
|
+
dir: dlgFieldById('hl-account-dir')?.value || form.accountAdd.draft.dir
|
|
378
|
+
};
|
|
379
|
+
const next = hlAccountAddFields(form.accountAdd.clients, adapterName, mode, values);
|
|
380
|
+
form.accountAdd.adapter = adapterName;
|
|
381
|
+
form.accountAdd.mode = next.authMode;
|
|
382
|
+
form.fields = next.fields;
|
|
383
|
+
form.ok = next.authMode === 'token' ? tc('hl.common.save') : t('login');
|
|
384
|
+
render(true);
|
|
385
|
+
}
|
|
386
|
+
changes.hlAccountAddClient = function (e) { hlAccountAddSync(e.target.value, 'login'); };
|
|
387
|
+
changes.hlAccountAddMode = function (e) { hlAccountAddSync(S.dialog?.accountAdd?.adapter, e.target.value); };
|
|
388
|
+
actions.hlAccountAdd = async function () {
|
|
389
|
+
const previous = S.dialog, route = S.route;
|
|
390
|
+
const draft = await ui.request('POST', '/api/keys/accounts/draft', {}).catch(hlFail);
|
|
391
|
+
if (!draft || S.dialog !== previous || S.route !== route) return;
|
|
392
|
+
const clients = HLP.adapters.filter(function (a) { return a.capabilities.account; });
|
|
393
|
+
const initial = hlAccountAddFields(clients, clients[0].name, 'login', { dir: draft.dir });
|
|
394
|
+
const state = { draft: draft, clients: clients, adapter: clients[0].name, mode: initial.authMode };
|
|
395
|
+
ui.dialog({ title: t('addAccount'), ok: initial.authMode === 'token' ? tc('hl.common.save') : t('login'),
|
|
396
|
+
accountAdd: state, fields: initial.fields, on: function () {
|
|
397
|
+
const name = val('hl-account-name'), adapter = val('hl-account-client'), dir = val('hl-account-dir');
|
|
398
|
+
const mode = state.mode === 'token' ? 'token' : 'login';
|
|
399
|
+
const token = mode === 'token' ? val('hl-account-token') : '';
|
|
400
|
+
if (!name || !dir || (mode === 'token' && !token)) return false;
|
|
401
|
+
const body = { id: draft.id, name: name, adapter: adapter, dir: dir };
|
|
402
|
+
if (mode === 'token') {
|
|
403
|
+
body.authMode = 'token';
|
|
404
|
+
body.token = token;
|
|
405
|
+
}
|
|
406
|
+
return (async function () {
|
|
407
|
+
const account = await ui.request('POST', '/api/keys/accounts', body);
|
|
408
|
+
await readKeys();
|
|
409
|
+
if (mode === 'token') toast(t('tokenSaved', account.name));
|
|
410
|
+
else await hlAccountTerminal(account).catch(hlFail);
|
|
411
|
+
})();
|
|
412
|
+
} });
|
|
413
|
+
};
|
|
414
|
+
actions.hlAccountToken = function (d) {
|
|
415
|
+
const account = HLP.keys.find(function (k) { return k.id === d.id; });
|
|
416
|
+
const tokenCap = HLP.adapters?.find(function (a) { return a.name === account?.adapter; })?.capabilities?.accountToken;
|
|
417
|
+
if (!account || !tokenCap) return;
|
|
418
|
+
ui.dialog({ title: t('tokenTitle', account.name), ok: tc('hl.common.save'), fields: [
|
|
419
|
+
{ id: 'hl-account-token', label: t('tokenLabel'), value: '', req: true,
|
|
420
|
+
placeholder: tokenCap.placeholder || '', help: tokenCap.help || '' }
|
|
421
|
+
], on: function () {
|
|
422
|
+
const token = val('hl-account-token');
|
|
423
|
+
if (!token) return false;
|
|
424
|
+
return (async function () {
|
|
425
|
+
await ui.request('POST', '/api/keys/' + account.id + '/token', { token: token });
|
|
426
|
+
await readKeys();
|
|
427
|
+
toast(t('tokenSaved', account.name));
|
|
428
|
+
})();
|
|
429
|
+
} });
|
|
430
|
+
};
|
|
431
|
+
actions.hlAccountPickDir = async function () {
|
|
432
|
+
const form = S.dialog, field = dlgFieldById('hl-account-dir');
|
|
433
|
+
if (!field) return;
|
|
434
|
+
const picked = await ui.request('POST', '/api/console/directory/pick', { title: t('chooseDir'), initial: val(field.id) }).catch(hlFail);
|
|
435
|
+
if (!picked?.path || S.dialog !== form) return;
|
|
436
|
+
field.value = picked.path;
|
|
437
|
+
document.getElementById(field.id).value = picked.path;
|
|
438
|
+
};
|
|
439
|
+
actions.hlAccountLogin = function (d) { return hlAccountTerminal(HLP.keys.find(function (k) { return k.id === d.id; })).catch(hlFail); };
|
|
440
|
+
actions.hlAccountLogout = function (d) {
|
|
441
|
+
const account = HLP.keys.find(function (k) { return k.id === d.id; });
|
|
442
|
+
const isToken = account?.authMode === 'token';
|
|
443
|
+
ui.dialog({ title: t(isToken ? 'tokenClearTitle' : 'logoutTitle', account.name),
|
|
444
|
+
text: t(isToken ? 'tokenClearText' : 'logoutText'),
|
|
445
|
+
ok: t(isToken ? 'tokenClear' : 'logout'), danger: true,
|
|
446
|
+
on: function () { return ui.request('POST', '/api/keys/' + account.id + '/logout', {}); } });
|
|
447
|
+
};
|
|
448
|
+
actions.hlAccountTier = function (d) {
|
|
449
|
+
if (!d?.key) return;
|
|
450
|
+
const current = (HLP.tiers || {})[d.key] || '';
|
|
451
|
+
ui.dialog({ title: t('tierTitle', d.title || d.key), ok: tc('hl.common.save'), fields: [
|
|
452
|
+
{ id: 'hl-account-tier', label: t('setTier'), value: current, help: t('tierHelp') }
|
|
453
|
+
], on: function () {
|
|
454
|
+
const tier = val('hl-account-tier');
|
|
455
|
+
return (async function () {
|
|
456
|
+
const result = await ui.request('POST', '/api/keys/tiers', { key: d.key, tier: tier });
|
|
457
|
+
HLP.tiers = { ...(HLP.tiers || {}) };
|
|
458
|
+
if (result.tier) HLP.tiers[d.key] = result.tier;
|
|
459
|
+
else delete HLP.tiers[d.key];
|
|
460
|
+
toast(t(result.tier ? 'tierSaved' : 'tierCleared'));
|
|
461
|
+
render(true);
|
|
462
|
+
})();
|
|
463
|
+
} });
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
actions.hlKeyEdit = function (d) {
|
|
467
|
+
const cur = d.id ? HLP.keys.find(function (k) { return k.id === d.id; }) : null;
|
|
468
|
+
ui.dialog({ title: cur ? t('editTitle', cur.name) : t('addTitle'), ok: tc('hl.common.save'), danger: false, text: t('formText'),
|
|
469
|
+
fields: [
|
|
470
|
+
{ id: 'hl-key-name', label: tc('hl.common.name'), value: cur ? cur.name : '', req: true, placeholder: t('namePh') },
|
|
471
|
+
{ id: 'hl-key-protocol', label: t('protoLabel'), options: hlProtocols(), value: cur ? cur.protocol : 'openai' },
|
|
472
|
+
{ id: 'hl-key-endpoint', label: t('endpointLabel'), value: cur ? (cur.endpoint || '') : '', placeholder: 'https://example.com/v1', help: t('endpointHelp') },
|
|
473
|
+
{ id: 'hl-key-secret', label: 'API key', value: '', req: !cur, placeholder: cur ? t('secretKeepPh') : 'sk-…', help: t('secretHelp') }],
|
|
474
|
+
on: function () {
|
|
475
|
+
const name = val('hl-key-name'), secret = val('hl-key-secret'); if (!name || (!cur && !secret)) return false;
|
|
476
|
+
const body = { name: name, protocol: val('hl-key-protocol'), endpoint: val('hl-key-endpoint') }; if (cur) body.id = cur.id; if (secret) body.apiKey = secret;
|
|
477
|
+
return hlSave(ui.request('POST', '/api/keys', body).then(function (key) {
|
|
478
|
+
HL.members.forEach(function (member) { if (member.key === key.id) HL_RUN_QUOTAS.delete(member.id); });
|
|
479
|
+
return readKeys();
|
|
480
|
+
}));
|
|
481
|
+
} });
|
|
482
|
+
};
|
|
483
|
+
actions.hlKeyTry = function (d) {
|
|
484
|
+
const k = HLP.keys.find(function (x) { return x.id === d.id; }), size = function (n) { const u = n % 1024 === 0 ? 1024 : 1000; return n >= u * u ? +(n / (u * u)).toFixed(1) + 'M' : Math.round(n / u) + 'K'; };
|
|
485
|
+
ui.request('GET', '/api/keys/' + d.id + '/models').then(function (r) {
|
|
486
|
+
const lines = r.models.map(function (m) { return m.id + (m.name ? ' (' + m.name + ')' : '') + (m.contextWindow ? t('modelCtx', size(m.contextWindow)) : '') + (m.maxOutput ? t('modelOut', size(m.maxOutput)) : ''); });
|
|
487
|
+
ui.dialog({ kind: 'hlText', title: t('tryTitle', k.name, r.models.length), wide: true, args: { text: lines.join('\n') || t('tryEmpty') } });
|
|
488
|
+
}, hlFail);
|
|
489
|
+
};
|
|
490
|
+
actions.hlKeyRemove = function (d) {
|
|
491
|
+
const k = HLP.keys.find(function (x) { return x.id === d.id; });
|
|
492
|
+
const text = k.adapter ? t('delAccount', k.dir) : t('delText');
|
|
493
|
+
ui.dialog({ title: t('delTitle', k.name), text: text, ok: tc('hl.common.delete'),
|
|
494
|
+
on: function () { return hlSave(ui.request('DELETE', '/api/keys/' + d.id).then(function () { return readKeys(); })); } });
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
models.page = function () { return hlKeysView(); };
|
|
498
|
+
models.quotas = function () {
|
|
499
|
+
const topicId = dashboard()?.topicId;
|
|
500
|
+
const base = !keysLoading && !keysError ? hlKeysView({ prefix: topicId ? 'ops-' + topicId : 'ops', readOnly: true }) : null;
|
|
501
|
+
const data = !burnLoading && !burnError ? burn : null;
|
|
502
|
+
const rows = (data?.accounts || []).flatMap(account =>
|
|
503
|
+
Object.entries(account.windows).map(([label, window]) => hlBurnRow(account, label, window)));
|
|
504
|
+
const schedule = data?.schedule;
|
|
505
|
+
const meta = !data ? '' : !schedule ? t('scheduleMissing') : !schedule.enabled ? t('scheduleDisabled') : '';
|
|
506
|
+
return {
|
|
507
|
+
...base,
|
|
508
|
+
keysLoading,
|
|
509
|
+
keysError,
|
|
510
|
+
burnLoading,
|
|
511
|
+
sampling,
|
|
512
|
+
sampleMessage,
|
|
513
|
+
meta,
|
|
514
|
+
burnError,
|
|
515
|
+
empty: Boolean(data && !rows.length),
|
|
516
|
+
rateTable: rows.length ? {
|
|
517
|
+
label: t('tableLabel'),
|
|
518
|
+
compact: true,
|
|
519
|
+
columns: [
|
|
520
|
+
{ label: t('colAccount') }, { label: t('colSource') }, { label: t('colCurrent'), numeric: true }, { label: t('colH1'), numeric: true },
|
|
521
|
+
{ label: t('colH24'), numeric: true }, { label: t('colNormalized'), numeric: true }, { label: t('colDeplete') },
|
|
522
|
+
{ label: t('colReset') }, { label: t('colSamples'), numeric: true },
|
|
523
|
+
],
|
|
524
|
+
rows,
|
|
525
|
+
} : null,
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
models.history = function () {
|
|
529
|
+
const accounts = (burn?.accounts || []).filter(account => Object.keys(account.windows).length);
|
|
530
|
+
const account = accounts.find(account => account.key === historyAccount) || accounts[0];
|
|
531
|
+
const windows = Object.keys(account?.windows || {});
|
|
532
|
+
const window = windows.includes(historyWindow) ? historyWindow : '';
|
|
533
|
+
const ready = !burnLoading && !burnError;
|
|
534
|
+
return {
|
|
535
|
+
account: account?.key,
|
|
536
|
+
accountOptions: accounts.map(account => ({ v: account.key, label: hlBurnAccountTitle(account), sub: hlBurnSource(account) })),
|
|
537
|
+
source: account && hlBurnSource(account),
|
|
538
|
+
noAccount: !account,
|
|
539
|
+
window, windowOptions: [['', t('allWindows')], ...windows.map(label => [label, label])],
|
|
540
|
+
range, rangeOptions: [['24h', t('range24')], ['7d', t('range7')], ['14d', t('range14')]],
|
|
541
|
+
burnLoading,
|
|
542
|
+
burnError,
|
|
543
|
+
chart: account && ready && hlBurnChart(account, window, burn.now, burn.range),
|
|
544
|
+
empty: !account && ready,
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
actions.readQuotaAccounts = readQuotaAccounts;
|
|
548
|
+
actions.readQuotas = () => readBurn('quota');
|
|
549
|
+
actions.readHistory = () => readBurn('usage');
|
|
550
|
+
actions.sampleNow = async function () {
|
|
551
|
+
if (sampling) return;
|
|
552
|
+
sampling = true;
|
|
553
|
+
sampleMessage = '';
|
|
554
|
+
render(true);
|
|
555
|
+
try {
|
|
556
|
+
const result = await ui.request('POST', '/api/keys/quotas/sample', {});
|
|
557
|
+
sampleMessage = result.errors?.length
|
|
558
|
+
? t('samplePartial', result.sampledAccounts, result.writtenSamples, result.errors.length)
|
|
559
|
+
: t('sampleDone', result.sampledAccounts, result.writtenSamples);
|
|
560
|
+
await refreshBurn();
|
|
561
|
+
} catch (failure) {
|
|
562
|
+
sampleMessage = failure.message;
|
|
563
|
+
} finally {
|
|
564
|
+
if (!ui.signal.aborted) {
|
|
565
|
+
sampling = false;
|
|
566
|
+
render(true);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
changes.range = function (event) {
|
|
571
|
+
range = event.target.value;
|
|
572
|
+
return readBurn('usage');
|
|
573
|
+
};
|
|
574
|
+
changes.historyAccount = function (event) {
|
|
575
|
+
historyAccount = event.target.value;
|
|
576
|
+
historyWindow = '';
|
|
577
|
+
render(true);
|
|
578
|
+
};
|
|
579
|
+
changes.historyWindow = function (event) {
|
|
580
|
+
historyWindow = event.target.value;
|
|
581
|
+
render(true);
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
return {
|
|
585
|
+
update() {
|
|
586
|
+
const active = dashboard()?.tab;
|
|
587
|
+
const keysPage = ui.shown('keys');
|
|
588
|
+
const membersChanged = listedMembers !== HL.members;
|
|
589
|
+
listedMembers = HL.members;
|
|
590
|
+
const openingAccounts = (active === 'quota' && active !== panel) || (keysPage && !pageShown);
|
|
591
|
+
if (active !== panel) {
|
|
592
|
+
panel = active;
|
|
593
|
+
if (panel === 'quota') void readQuotaAccounts();
|
|
594
|
+
if (panel === 'quota' || panel === 'usage') void readBurn(panel);
|
|
595
|
+
else burnRequest++;
|
|
596
|
+
}
|
|
597
|
+
if (keysPage !== pageShown) {
|
|
598
|
+
pageShown = keysPage;
|
|
599
|
+
if (keysPage) void readKeys().catch(ui.fail);
|
|
600
|
+
}
|
|
601
|
+
if (membersChanged && !openingAccounts) void refreshLocalAccounts().catch(ui.fail);
|
|
602
|
+
},
|
|
603
|
+
events: {
|
|
604
|
+
'config.changed': () => void refreshLocalAccounts().catch(ui.fail),
|
|
605
|
+
'keys.login_changed': function (d) {
|
|
606
|
+
void hlAccountRefresh(d?.id).catch(ui.fail);
|
|
607
|
+
},
|
|
608
|
+
'keys.quota_changed': refreshBurn,
|
|
609
|
+
'keys.tiers_changed': function (d) {
|
|
610
|
+
HLP.tiers = { ...(HLP.tiers || {}) };
|
|
611
|
+
if (d?.tier) HLP.tiers[d.key] = d.tier;
|
|
612
|
+
else if (d?.key) delete HLP.tiers[d.key];
|
|
613
|
+
render(true);
|
|
614
|
+
void refreshBurn();
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
actions, inputs, changes, models,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Home, Plugin } from 'hostlet/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* API keys, kept once: a name, the protocol the key speaks (OpenAI chat, OpenAI responses, Anthropic or Gemini), an endpoint when it is
|
|
4
|
+
* not the usual one, and the key. A member names the key its client runs with; how that reaches the client
|
|
5
|
+
* (which variables, which config) is the adapter's business, and so is listing the models the key can use.
|
|
6
|
+
*/
|
|
7
|
+
export default function keysPlugin(home: Home): Plugin;
|