kiokuko-dsh 0.2.1 → 0.2.3
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/PERMISSIONS.md +21 -28
- package/README.ja.md +8 -6
- package/README.md +12 -6
- package/THIRD_PARTY_NOTICES.md +8 -0
- package/dist/client.cjs +2248 -1383
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/context/continuity-view.d.ts +1 -1
- package/dist/deep-thinker/configuration.d.ts.map +1 -1
- package/dist/deep-thinker/configuration.js +8 -5
- package/dist/deep-thinker/configuration.js.map +1 -1
- package/dist/deep-thinker/core/contracts.d.ts +107 -13
- package/dist/deep-thinker/core/contracts.d.ts.map +1 -1
- package/dist/deep-thinker/core/contracts.js +4 -2
- package/dist/deep-thinker/core/contracts.js.map +1 -1
- package/dist/deep-thinker/memory-finalizer.d.ts +10 -10
- package/dist/deep-thinker/memory-finalizer.js +2 -2
- package/dist/deep-thinker/memory-finalizer.js.map +1 -1
- package/dist/deep-thinker/report.d.ts +1 -1
- package/dist/deep-thinker/store.d.ts +10 -10
- package/dist/deep-thinker/store.d.ts.map +1 -1
- package/dist/deep-thinker/store.js +2 -2
- package/dist/deep-thinker/store.js.map +1 -1
- package/dist/dsh/coding-workflow/contracts.d.ts +120 -0
- package/dist/dsh/coding-workflow/contracts.d.ts.map +1 -0
- package/dist/dsh/coding-workflow/contracts.js +77 -0
- package/dist/dsh/coding-workflow/contracts.js.map +1 -0
- package/dist/dsh/coding-workflow/host.d.ts +41 -0
- package/dist/dsh/coding-workflow/host.d.ts.map +1 -0
- package/dist/dsh/coding-workflow/host.js +235 -0
- package/dist/dsh/coding-workflow/host.js.map +1 -0
- package/dist/dsh/coding-workflow/intent.d.ts +15 -0
- package/dist/dsh/coding-workflow/intent.d.ts.map +1 -0
- package/dist/dsh/coding-workflow/intent.js +86 -0
- package/dist/dsh/coding-workflow/intent.js.map +1 -0
- package/dist/dsh/coding-workflow/service.d.ts +155 -0
- package/dist/dsh/coding-workflow/service.d.ts.map +1 -0
- package/dist/dsh/coding-workflow/service.js +282 -0
- package/dist/dsh/coding-workflow/service.js.map +1 -0
- package/dist/dsh/coding-workflow/store.d.ts +17 -0
- package/dist/dsh/coding-workflow/store.d.ts.map +1 -0
- package/dist/dsh/coding-workflow/store.js +77 -0
- package/dist/dsh/coding-workflow/store.js.map +1 -0
- package/dist/dsh/completion-verifiers.d.ts +39 -0
- package/dist/dsh/completion-verifiers.d.ts.map +1 -0
- package/dist/dsh/completion-verifiers.js +9 -0
- package/dist/dsh/completion-verifiers.js.map +1 -0
- package/dist/dsh/config.d.ts +5 -1
- package/dist/dsh/config.d.ts.map +1 -1
- package/dist/dsh/core/host.d.ts +1 -1
- package/dist/dsh/core/host.d.ts.map +1 -1
- package/dist/dsh/core/host.js +97 -11
- package/dist/dsh/core/host.js.map +1 -1
- package/dist/dsh/core/index.d.ts +4 -4
- package/dist/dsh/core/index.js +2 -2
- package/dist/dsh/core/index.js.map +1 -1
- package/dist/dsh/core/tasks.d.ts +2 -0
- package/dist/dsh/core/tasks.d.ts.map +1 -1
- package/dist/dsh/core/tasks.js +43 -1
- package/dist/dsh/core/tasks.js.map +1 -1
- package/dist/dsh/core-runtime.d.ts +1 -0
- package/dist/dsh/core-runtime.d.ts.map +1 -1
- package/dist/dsh/core-runtime.js +4 -1
- package/dist/dsh/core-runtime.js.map +1 -1
- package/dist/dsh/decisions/config.d.ts +2 -2
- package/dist/dsh/enno-delegation.js +2 -2
- package/dist/dsh/enno-delegation.js.map +1 -1
- package/dist/dsh/execution-command.d.ts +4 -0
- package/dist/dsh/execution-command.d.ts.map +1 -0
- package/dist/dsh/execution-command.js +52 -0
- package/dist/dsh/execution-command.js.map +1 -0
- package/dist/dsh/execution-journal.d.ts +17 -0
- package/dist/dsh/execution-journal.d.ts.map +1 -0
- package/dist/dsh/execution-journal.js +69 -0
- package/dist/dsh/execution-journal.js.map +1 -0
- package/dist/dsh/execution-result.d.ts +20 -0
- package/dist/dsh/execution-result.d.ts.map +1 -0
- package/dist/dsh/execution-result.js +7 -0
- package/dist/dsh/execution-result.js.map +1 -0
- package/dist/dsh/execution-selection.d.ts +150 -23
- package/dist/dsh/execution-selection.d.ts.map +1 -1
- package/dist/dsh/execution-selection.js +18 -6
- package/dist/dsh/execution-selection.js.map +1 -1
- package/dist/dsh/host-adapter/admission.d.ts.map +1 -1
- package/dist/dsh/host-adapter/admission.js +33 -22
- package/dist/dsh/host-adapter/admission.js.map +1 -1
- package/dist/dsh/host-adapter/boundaries.d.ts.map +1 -1
- package/dist/dsh/host-adapter/boundaries.js +2 -0
- package/dist/dsh/host-adapter/boundaries.js.map +1 -1
- package/dist/dsh/host-adapter/context.d.ts.map +1 -1
- package/dist/dsh/host-adapter/context.js +18 -13
- package/dist/dsh/host-adapter/context.js.map +1 -1
- package/dist/dsh/host-adapter/lifecycle.d.ts.map +1 -1
- package/dist/dsh/host-adapter/lifecycle.js +12 -0
- package/dist/dsh/host-adapter/lifecycle.js.map +1 -1
- package/dist/dsh/host-adapter/routing.js +1 -1
- package/dist/dsh/host-adapter/routing.js.map +1 -1
- package/dist/dsh/host-adapter/turn-state.js +1 -1
- package/dist/dsh/host-adapter/turn-state.js.map +1 -1
- package/dist/dsh/host-adapter.d.ts.map +1 -1
- package/dist/dsh/host-adapter.js +61 -18
- package/dist/dsh/host-adapter.js.map +1 -1
- package/dist/dsh/index.d.ts +4 -2
- package/dist/dsh/index.d.ts.map +1 -1
- package/dist/dsh/index.js +7 -0
- package/dist/dsh/index.js.map +1 -1
- package/dist/dsh/intake-gate.d.ts +1 -0
- package/dist/dsh/intake-gate.d.ts.map +1 -1
- package/dist/dsh/intake-gate.js +9 -1
- package/dist/dsh/intake-gate.js.map +1 -1
- package/dist/dsh/lisp/approval.d.ts +2 -1
- package/dist/dsh/lisp/approval.d.ts.map +1 -1
- package/dist/dsh/lisp/approval.js +4 -3
- package/dist/dsh/lisp/approval.js.map +1 -1
- package/dist/dsh/lisp/candidate.d.ts +1 -1
- package/dist/dsh/lisp/code-intelligence-contracts.d.ts +78 -0
- package/dist/dsh/lisp/code-intelligence-contracts.d.ts.map +1 -0
- package/dist/dsh/lisp/code-intelligence-contracts.js +54 -0
- package/dist/dsh/lisp/code-intelligence-contracts.js.map +1 -0
- package/dist/dsh/lisp/code-intelligence-provider.d.ts +116 -0
- package/dist/dsh/lisp/code-intelligence.d.ts +13 -0
- package/dist/dsh/lisp/code-intelligence.d.ts.map +1 -0
- package/dist/dsh/lisp/code-intelligence.js +181 -0
- package/dist/dsh/lisp/code-intelligence.js.map +1 -0
- package/dist/dsh/lisp/coding-choice.d.ts +4 -1
- package/dist/dsh/lisp/coding-choice.d.ts.map +1 -1
- package/dist/dsh/lisp/coding-choice.js +26 -10
- package/dist/dsh/lisp/coding-choice.js.map +1 -1
- package/dist/dsh/lisp/compiled-cache.d.ts.map +1 -1
- package/dist/dsh/lisp/compiled-cache.js +3 -2
- package/dist/dsh/lisp/compiled-cache.js.map +1 -1
- package/dist/dsh/lisp/contracts.d.ts +4 -0
- package/dist/dsh/lisp/contracts.d.ts.map +1 -1
- package/dist/dsh/lisp/contracts.js +1 -0
- package/dist/dsh/lisp/contracts.js.map +1 -1
- package/dist/dsh/lisp/manager.d.ts +9 -1
- package/dist/dsh/lisp/manager.d.ts.map +1 -1
- package/dist/dsh/lisp/manager.js +91 -24
- package/dist/dsh/lisp/manager.js.map +1 -1
- package/dist/dsh/lisp/model-result.d.ts.map +1 -1
- package/dist/dsh/lisp/model-result.js +35 -1
- package/dist/dsh/lisp/model-result.js.map +1 -1
- package/dist/dsh/lisp/proposal-batch.d.ts +2 -0
- package/dist/dsh/lisp/proposal-batch.d.ts.map +1 -1
- package/dist/dsh/lisp/proposal-batch.js +32 -2
- package/dist/dsh/lisp/proposal-batch.js.map +1 -1
- package/dist/dsh/lisp/request-surface.d.ts +12 -2
- package/dist/dsh/lisp/request-surface.d.ts.map +1 -1
- package/dist/dsh/lisp/request-surface.js +1 -1
- package/dist/dsh/lisp/request-surface.js.map +1 -1
- package/dist/dsh/lisp/sandbox.d.ts +3 -0
- package/dist/dsh/lisp/sandbox.d.ts.map +1 -1
- package/dist/dsh/lisp/sandbox.js +13 -6
- package/dist/dsh/lisp/sandbox.js.map +1 -1
- package/dist/dsh/lisp/surface.d.ts +1 -1
- package/dist/dsh/lisp/surface.d.ts.map +1 -1
- package/dist/dsh/lisp/surface.js +118 -23
- package/dist/dsh/lisp/surface.js.map +1 -1
- package/dist/dsh/lisp/worker.d.ts +2 -0
- package/dist/dsh/lisp/worker.d.ts.map +1 -1
- package/dist/dsh/lisp/worker.js +7 -5
- package/dist/dsh/lisp/worker.js.map +1 -1
- package/dist/dsh/lisp-service-key.d.ts +9 -0
- package/dist/dsh/lisp-service-key.d.ts.map +1 -1
- package/dist/dsh/lisp-service-key.js +11 -0
- package/dist/dsh/lisp-service-key.js.map +1 -1
- package/dist/dsh/memory-application.d.ts +1 -1
- package/dist/dsh/memory-application.d.ts.map +1 -1
- package/dist/dsh/memory-application.js +4 -3
- package/dist/dsh/memory-application.js.map +1 -1
- package/dist/dsh/model-auto/candidates.d.ts.map +1 -1
- package/dist/dsh/model-auto/candidates.js +31 -22
- package/dist/dsh/model-auto/candidates.js.map +1 -1
- package/dist/dsh/model-configuration.d.ts +145 -2
- package/dist/dsh/model-configuration.d.ts.map +1 -1
- package/dist/dsh/model-configuration.js +10 -3
- package/dist/dsh/model-configuration.js.map +1 -1
- package/dist/dsh/model-selection-ui.d.ts.map +1 -1
- package/dist/dsh/model-selection-ui.js +7 -2
- package/dist/dsh/model-selection-ui.js.map +1 -1
- package/dist/dsh/models/config-store.d.ts +8 -0
- package/dist/dsh/models/config-store.d.ts.map +1 -0
- package/dist/dsh/models/config-store.js +49 -0
- package/dist/dsh/models/config-store.js.map +1 -0
- package/dist/dsh/models/contracts.d.ts +107 -0
- package/dist/dsh/models/contracts.d.ts.map +1 -0
- package/dist/dsh/models/contracts.js +104 -0
- package/dist/dsh/models/contracts.js.map +1 -0
- package/dist/dsh/models/metadata.d.ts +7 -0
- package/dist/dsh/models/metadata.d.ts.map +1 -0
- package/dist/dsh/models/metadata.js +13 -0
- package/dist/dsh/models/metadata.js.map +1 -0
- package/dist/dsh/models/profiles.d.ts +10 -0
- package/dist/dsh/models/profiles.d.ts.map +1 -0
- package/dist/dsh/models/profiles.js +176 -0
- package/dist/dsh/models/profiles.js.map +1 -0
- package/dist/dsh/models/service.d.ts +97 -0
- package/dist/dsh/models/service.d.ts.map +1 -0
- package/dist/dsh/models/service.js +518 -0
- package/dist/dsh/models/service.js.map +1 -0
- package/dist/dsh/models/surface.d.ts +8 -0
- package/dist/dsh/models/surface.d.ts.map +1 -0
- package/dist/dsh/models/surface.js +162 -0
- package/dist/dsh/models/surface.js.map +1 -0
- package/dist/dsh/models/vendor/THIRD_PARTY_NOTICES.txt +134 -0
- package/dist/dsh/models/vendor/abortable.d.ts +3 -0
- package/dist/dsh/models/vendor/abortable.d.ts.map +1 -0
- package/dist/dsh/models/vendor/abortable.js +10 -0
- package/dist/dsh/models/vendor/abortable.js.map +1 -0
- package/dist/dsh/models/vendor/auth-contract.d.ts +67 -0
- package/dist/dsh/models/vendor/auth-contract.d.ts.map +1 -0
- package/dist/dsh/models/vendor/auth-contract.js +2 -0
- package/dist/dsh/models/vendor/auth-contract.js.map +1 -0
- package/dist/dsh/models/vendor/credentials.d.ts +58 -0
- package/dist/dsh/models/vendor/credentials.d.ts.map +1 -0
- package/dist/dsh/models/vendor/credentials.js +205 -0
- package/dist/dsh/models/vendor/credentials.js.map +1 -0
- package/dist/dsh/models/vendor/nous-oauth.d.ts +6 -0
- package/dist/dsh/models/vendor/nous-oauth.d.ts.map +1 -0
- package/dist/dsh/models/vendor/nous-oauth.js +113 -0
- package/dist/dsh/models/vendor/nous-oauth.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-adapter.d.ts +38 -0
- package/dist/dsh/models/vendor/opencode-adapter.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-adapter.js +207 -0
- package/dist/dsh/models/vendor/opencode-adapter.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-catalog.d.ts +73 -0
- package/dist/dsh/models/vendor/opencode-catalog.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-catalog.js +253 -0
- package/dist/dsh/models/vendor/opencode-catalog.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-codec.d.ts +7 -0
- package/dist/dsh/models/vendor/opencode-codec.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-codec.js +107 -0
- package/dist/dsh/models/vendor/opencode-codec.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-owned.generated.d.ts +114 -0
- package/dist/dsh/models/vendor/opencode-owned.generated.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-owned.generated.js +2867 -0
- package/dist/dsh/models/vendor/opencode-owned.generated.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-replay.d.ts +17 -0
- package/dist/dsh/models/vendor/opencode-replay.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-replay.js +147 -0
- package/dist/dsh/models/vendor/opencode-replay.js.map +1 -0
- package/dist/dsh/models/vendor/opencode-sdk.d.ts +6 -0
- package/dist/dsh/models/vendor/opencode-sdk.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-sdk.js +49915 -0
- package/dist/dsh/models/vendor/opencode-sdk.js.map +7 -0
- package/dist/dsh/models/vendor/opencode-transport.d.ts +6 -0
- package/dist/dsh/models/vendor/opencode-transport.d.ts.map +1 -0
- package/dist/dsh/models/vendor/opencode-transport.js +70 -0
- package/dist/dsh/models/vendor/opencode-transport.js.map +1 -0
- package/dist/dsh/models/vendor/pi-ai.d.ts +23 -0
- package/dist/dsh/models/vendor/pi-ai.d.ts.map +1 -0
- package/dist/dsh/models/vendor/pi-ai.js +27 -0
- package/dist/dsh/models/vendor/pi-ai.js.map +1 -0
- package/dist/dsh/modules/lisp.d.ts +1 -1
- package/dist/dsh/modules/lisp.d.ts.map +1 -1
- package/dist/dsh/modules/lisp.js +2 -13
- package/dist/dsh/modules/lisp.js.map +1 -1
- package/dist/dsh/modules/resources.d.ts +3 -1
- package/dist/dsh/modules/resources.d.ts.map +1 -1
- package/dist/dsh/modules/resources.js +4 -0
- package/dist/dsh/modules/resources.js.map +1 -1
- package/dist/dsh/native-model-catalog.d.ts.map +1 -1
- package/dist/dsh/native-model-catalog.js +4 -3
- package/dist/dsh/native-model-catalog.js.map +1 -1
- package/dist/dsh/node-tap-summary.d.ts +8 -1
- package/dist/dsh/node-tap-summary.d.ts.map +1 -1
- package/dist/dsh/node-tap-summary.js +33 -3
- package/dist/dsh/node-tap-summary.js.map +1 -1
- package/dist/dsh/on-demand-intake.d.ts +1 -1
- package/dist/dsh/on-demand-intake.d.ts.map +1 -1
- package/dist/dsh/on-demand-intake.js +35 -14
- package/dist/dsh/on-demand-intake.js.map +1 -1
- package/dist/dsh/owned-evidence.d.ts +49 -0
- package/dist/dsh/owned-evidence.d.ts.map +1 -0
- package/dist/dsh/owned-evidence.js +69 -0
- package/dist/dsh/owned-evidence.js.map +1 -0
- package/dist/dsh/owned-execution.d.ts +99 -0
- package/dist/dsh/owned-execution.d.ts.map +1 -0
- package/dist/dsh/owned-execution.js +558 -0
- package/dist/dsh/owned-execution.js.map +1 -0
- package/dist/dsh/plan-transition.d.ts +5 -0
- package/dist/dsh/plan-transition.d.ts.map +1 -0
- package/dist/dsh/plan-transition.js +34 -0
- package/dist/dsh/plan-transition.js.map +1 -0
- package/dist/dsh/session-memory-finalizer.d.ts.map +1 -1
- package/dist/dsh/session-memory-finalizer.js +46 -3
- package/dist/dsh/session-memory-finalizer.js.map +1 -1
- package/dist/dsh/setup.d.ts +1 -1
- package/dist/dsh/setup.d.ts.map +1 -1
- package/dist/dsh/setup.js +2 -0
- package/dist/dsh/setup.js.map +1 -1
- package/dist/dsh/skill-prompts.json +1 -1
- package/dist/dsh/task-completion-host.js +3 -3
- package/dist/dsh/task-completion-host.js.map +1 -1
- package/dist/dsh/task-completion.d.ts +17 -0
- package/dist/dsh/task-completion.d.ts.map +1 -1
- package/dist/dsh/task-completion.js +144 -38
- package/dist/dsh/task-completion.js.map +1 -1
- package/dist/dsh/task-intake.d.ts.map +1 -1
- package/dist/dsh/task-intake.js +7 -0
- package/dist/dsh/task-intake.js.map +1 -1
- package/dist/enno-oduno/coding-workflow.d.ts +39 -0
- package/dist/enno-oduno/coding-workflow.d.ts.map +1 -0
- package/dist/enno-oduno/coding-workflow.js +33 -0
- package/dist/enno-oduno/coding-workflow.js.map +1 -0
- package/dist/enno-oduno/schemas.d.ts +10 -10
- package/dist/enno-oduno/store.d.ts.map +1 -1
- package/dist/enno-oduno/store.js +56 -1
- package/dist/enno-oduno/store.js.map +1 -1
- package/dist/enno-oduno/types.d.ts +1 -0
- package/dist/enno-oduno/types.d.ts.map +1 -1
- package/dist/enno-oduno/verifier.d.ts.map +1 -1
- package/dist/enno-oduno/verifier.js +4 -1
- package/dist/enno-oduno/verifier.js.map +1 -1
- package/dist/locale/en.json +1 -1
- package/dist/locale/ja.json +1 -1
- package/dist/locale/ko.json +1 -1
- package/dist/locale/zh-CN.json +1 -1
- package/dist/memory/application.d.ts +2 -1
- package/dist/memory/application.d.ts.map +1 -1
- package/dist/memory/application.js +26 -12
- package/dist/memory/application.js.map +1 -1
- package/dist/memory/evidence.d.ts +2 -0
- package/dist/memory/evidence.d.ts.map +1 -1
- package/dist/memory/evidence.js +3 -1
- package/dist/memory/evidence.js.map +1 -1
- package/dist/model-tools/contracts.d.ts +4 -4
- package/dist/models-client.cjs +635 -0
- package/dist/models-client.d.ts +26 -0
- package/dist/models-client.d.ts.map +1 -0
- package/dist/models-client.js +642 -0
- package/dist/models-client.js.map +1 -0
- package/docs/code-intelligence.md +149 -0
- package/docs/coding-workflow.md +45 -0
- package/docs/dsh-auth-LICENSE.txt +22 -0
- package/docs/dsh-auth-provenance.md +25 -0
- package/docs/dsh-plugin.md +19 -0
- package/docs/execution-support.md +4 -0
- package/docs/kiokuko-models.md +66 -0
- package/docs/lisp-hot-tools.md +2 -2
- package/docs/lisp.md +112 -63
- package/docs/model-selection.ja.md +7 -9
- package/docs/model-selection.md +14 -12
- package/docs/owned-execution.md +99 -0
- package/lisp/supervisor.mjs +8 -2
- package/lisp/tools.lisp +31 -3
- package/migrations/035_owned_execution.sql +19 -0
- package/migrations/036_coding_workflow.sql +26 -0
- package/package.json +47 -12
- package/skills/coding-ideal-routine-skill/SKILL.md +6 -0
- package/skills/kiokuko-lisp/SKILL.md +53 -67
- package/skills/kiokuko-soul/SKILL.md +7 -28
- package/skills/one-shot-software-completion/SKILL.md +5 -6
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "kiokuko-dsh",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
const { createSnapshotStore } = require("@deepseek-ai/dsh-client-store");
|
|
7
|
+
const { jsx, jsxs, Fragment } = require("react/jsx-runtime");
|
|
8
|
+
const { useState, useRef, useEffect } = require("react");
|
|
9
|
+
const { Modal, Button, IconDownloadOutline16, MarkdownText } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
"use strict";
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// dist/models-client.js
|
|
30
|
+
var models_client_exports = {};
|
|
31
|
+
__export(models_client_exports, {
|
|
32
|
+
apply: () => apply,
|
|
33
|
+
inject: () => inject,
|
|
34
|
+
mountModelsClient: () => mountModelsClient
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(models_client_exports);
|
|
37
|
+
function messageOf(error) {
|
|
38
|
+
return error instanceof Error ? error.message : String(error);
|
|
39
|
+
}
|
|
40
|
+
var inject = ["slots", "locale"];
|
|
41
|
+
function apply(ctx) {
|
|
42
|
+
mountModelsClient(ctx);
|
|
43
|
+
}
|
|
44
|
+
var MODELS_NS = "kiokuko-models";
|
|
45
|
+
var MODEL_CONNECTION_DEFAULTS = {
|
|
46
|
+
openai: ["OpenAI API", "https://api.openai.com/v1", "responses"],
|
|
47
|
+
codex: ["Codex", "https://chatgpt.com/backend-api/codex", "responses"],
|
|
48
|
+
claude: ["Claude", "https://api.anthropic.com", "messages"],
|
|
49
|
+
xai: ["xAI", "https://api.x.ai/v1", "chat-completions"],
|
|
50
|
+
deepseek: ["DeepSeek", "https://api.deepseek.com/v1", "chat-completions"],
|
|
51
|
+
opencode: ["OpenCode Zen", "https://opencode.ai/zen/v1", "chat-completions"],
|
|
52
|
+
"opencode-go": [
|
|
53
|
+
"OpenCode Go",
|
|
54
|
+
"https://opencode.ai/zen/go/v1",
|
|
55
|
+
"chat-completions"
|
|
56
|
+
],
|
|
57
|
+
openrouter: [
|
|
58
|
+
"OpenRouter",
|
|
59
|
+
"https://openrouter.ai/api/v1",
|
|
60
|
+
"chat-completions"
|
|
61
|
+
],
|
|
62
|
+
nous: [
|
|
63
|
+
"Nous / Hermes",
|
|
64
|
+
"https://inference-api.nousresearch.com/v1",
|
|
65
|
+
"chat-completions"
|
|
66
|
+
],
|
|
67
|
+
infron: ["Infron", "https://llm.onerouter.pro/v1", "chat-completions"],
|
|
68
|
+
ollama: ["Ollama", "http://localhost:11434/v1", "chat-completions"],
|
|
69
|
+
custom: ["Custom connection", "http://localhost:8080/v1", "chat-completions"]
|
|
70
|
+
};
|
|
71
|
+
async function modelsApi(body, query = "") {
|
|
72
|
+
const response = await fetch("/api/kiokuko.models" + query, {
|
|
73
|
+
...body ? {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: { "content-type": "application/json" },
|
|
76
|
+
body: JSON.stringify(body)
|
|
77
|
+
} : {},
|
|
78
|
+
cache: "no-store"
|
|
79
|
+
});
|
|
80
|
+
const value = await response.json();
|
|
81
|
+
if (!response.ok)
|
|
82
|
+
throw new Error(value.error ?? "Kiokuko Models request failed");
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
function KiokukoModelsPanel(props) {
|
|
86
|
+
const [state, setState] = useState({ revision: 0, connections: [] }), [connection, setConnection] = useState(null), [models, setModels] = useState([]), [filter, setFilter] = useState("");
|
|
87
|
+
const [busy, setBusy] = useState(false), [error, setError] = useState(""), [notice, setNotice] = useState(""), [key, setKey] = useState(""), [auth, setAuth] = useState(null), [answer, setAnswer] = useState("");
|
|
88
|
+
const [manual, setManual] = useState({
|
|
89
|
+
id: "",
|
|
90
|
+
contextWindow: 262144,
|
|
91
|
+
maxTokens: 32768,
|
|
92
|
+
reasoning: false,
|
|
93
|
+
image: false
|
|
94
|
+
});
|
|
95
|
+
const operation = useRef(void 0), mounted = useRef(true), working = useRef(false);
|
|
96
|
+
const sessionId = props.sessionId;
|
|
97
|
+
const load = async () => {
|
|
98
|
+
const value = await modelsApi();
|
|
99
|
+
if (mounted.current)
|
|
100
|
+
setState(value);
|
|
101
|
+
return value;
|
|
102
|
+
};
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
mounted.current = true;
|
|
105
|
+
void load().catch((e) => setError(messageOf(e)));
|
|
106
|
+
return () => {
|
|
107
|
+
mounted.current = false;
|
|
108
|
+
if (operation.current)
|
|
109
|
+
void modelsApi({ op: "cancel", id: operation.current }).catch(() => void 0);
|
|
110
|
+
};
|
|
111
|
+
}, []);
|
|
112
|
+
const run = async (action) => {
|
|
113
|
+
if (working.current)
|
|
114
|
+
return;
|
|
115
|
+
working.current = true;
|
|
116
|
+
setBusy(true);
|
|
117
|
+
setError("");
|
|
118
|
+
setNotice("");
|
|
119
|
+
try {
|
|
120
|
+
await action();
|
|
121
|
+
} catch (e) {
|
|
122
|
+
if (mounted.current)
|
|
123
|
+
setError(messageOf(e));
|
|
124
|
+
} finally {
|
|
125
|
+
working.current = false;
|
|
126
|
+
if (mounted.current)
|
|
127
|
+
setBusy(false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const choose = async (c) => {
|
|
131
|
+
setConnection({ ...c });
|
|
132
|
+
setKey("");
|
|
133
|
+
setError("");
|
|
134
|
+
setModels([]);
|
|
135
|
+
try {
|
|
136
|
+
setModels(await modelsApi(void 0, "?op=models&id=" + encodeURIComponent(c.id)));
|
|
137
|
+
} catch (e) {
|
|
138
|
+
setError(messageOf(e));
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const save = async () => {
|
|
142
|
+
await modelsApi({
|
|
143
|
+
op: "save",
|
|
144
|
+
connection: {
|
|
145
|
+
id: connection.id,
|
|
146
|
+
kind: connection.kind,
|
|
147
|
+
name: connection.name,
|
|
148
|
+
baseURL: connection.baseURL,
|
|
149
|
+
protocol: connection.protocol,
|
|
150
|
+
serviceTier: connection.serviceTier,
|
|
151
|
+
models: connection.models
|
|
152
|
+
},
|
|
153
|
+
revision: state.revision
|
|
154
|
+
});
|
|
155
|
+
const next = await load();
|
|
156
|
+
await choose(next.connections.find((c) => c.id === connection.id));
|
|
157
|
+
setNotice("Connection saved");
|
|
158
|
+
};
|
|
159
|
+
const newConnection = (kind) => {
|
|
160
|
+
const spec = MODEL_CONNECTION_DEFAULTS[kind];
|
|
161
|
+
setConnection({
|
|
162
|
+
id: "kiokuko-" + kind + "-" + crypto.randomUUID().slice(0, 8),
|
|
163
|
+
kind,
|
|
164
|
+
name: spec[0],
|
|
165
|
+
baseURL: spec[1],
|
|
166
|
+
protocol: spec[2],
|
|
167
|
+
serviceTier: "standard",
|
|
168
|
+
models: []
|
|
169
|
+
});
|
|
170
|
+
setModels([]);
|
|
171
|
+
setKey("");
|
|
172
|
+
setError("");
|
|
173
|
+
};
|
|
174
|
+
const update = (field, value) => setConnection({ ...connection, [field]: value });
|
|
175
|
+
const startLogin = async () => {
|
|
176
|
+
await save();
|
|
177
|
+
const result = await modelsApi({ op: "login", id: connection.id });
|
|
178
|
+
operation.current = result.operationId;
|
|
179
|
+
setAuth({ id: result.operationId, status: "pending", events: [] });
|
|
180
|
+
};
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (!auth || auth.status !== "pending")
|
|
183
|
+
return;
|
|
184
|
+
let stopped = false;
|
|
185
|
+
const timer = setInterval(() => {
|
|
186
|
+
void modelsApi(void 0, "?op=auth&id=" + encodeURIComponent(auth.id)).then((next) => {
|
|
187
|
+
if (stopped)
|
|
188
|
+
return;
|
|
189
|
+
setAuth(next);
|
|
190
|
+
if (next.status !== "pending") {
|
|
191
|
+
operation.current = void 0;
|
|
192
|
+
void load().then((value) => {
|
|
193
|
+
if (next.status === "success")
|
|
194
|
+
return choose(value.connections.find((c) => c.id === connection.id));
|
|
195
|
+
setError(next.error ?? "Authentication cancelled");
|
|
196
|
+
}).catch((e) => setError(messageOf(e)));
|
|
197
|
+
}
|
|
198
|
+
}, (e) => {
|
|
199
|
+
if (!stopped)
|
|
200
|
+
setError(messageOf(e));
|
|
201
|
+
});
|
|
202
|
+
}, 500);
|
|
203
|
+
return () => {
|
|
204
|
+
stopped = true;
|
|
205
|
+
clearInterval(timer);
|
|
206
|
+
};
|
|
207
|
+
}, [auth?.id, auth?.status]);
|
|
208
|
+
const input = (label, value, onChange, type = "text") => jsx("label", {
|
|
209
|
+
children: jsxs(Fragment, {
|
|
210
|
+
children: [
|
|
211
|
+
jsx("span", { children: label }),
|
|
212
|
+
jsx("input", {
|
|
213
|
+
type,
|
|
214
|
+
value,
|
|
215
|
+
"aria-label": label,
|
|
216
|
+
disabled: busy || label === "Base URL" && ["codex", "opencode", "opencode-go"].includes(connection?.kind),
|
|
217
|
+
onChange: (e) => onChange(e.target.value),
|
|
218
|
+
autoComplete: type === "password" ? "new-password" : "off"
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
const button = (label, action, disabled = false) => jsx("button", {
|
|
224
|
+
type: "button",
|
|
225
|
+
disabled: busy || disabled,
|
|
226
|
+
onClick: action,
|
|
227
|
+
children: label
|
|
228
|
+
});
|
|
229
|
+
return jsxs("section", {
|
|
230
|
+
className: "kiokuko-models-panel",
|
|
231
|
+
"aria-label": "Kiokuko Models",
|
|
232
|
+
"aria-busy": busy,
|
|
233
|
+
children: [
|
|
234
|
+
jsx("h2", { children: "Kiokuko Models" }),
|
|
235
|
+
jsx("p", {
|
|
236
|
+
children: "Connect directly for chat, Enno and Deep. Credentials are shared with dsh-cli. Signing out also signs dsh-cli out."
|
|
237
|
+
}),
|
|
238
|
+
...error ? [jsx("p", { role: "alert", children: error })] : [],
|
|
239
|
+
...notice ? [jsx("p", { role: "status", children: notice })] : [],
|
|
240
|
+
...busy ? [jsx("p", { role: "status", children: "Working\u2026" })] : [],
|
|
241
|
+
button("Reload", () => void run(load)),
|
|
242
|
+
jsx("label", {
|
|
243
|
+
children: jsxs(Fragment, {
|
|
244
|
+
children: [
|
|
245
|
+
"Add connection",
|
|
246
|
+
jsxs("select", {
|
|
247
|
+
"aria-label": "Add connection",
|
|
248
|
+
value: "",
|
|
249
|
+
disabled: busy,
|
|
250
|
+
onChange: (e) => newConnection(e.target.value),
|
|
251
|
+
children: [
|
|
252
|
+
jsx("option", { value: "", children: "Choose provider\u2026" }),
|
|
253
|
+
...Object.entries(MODEL_CONNECTION_DEFAULTS).map(([id, spec]) => jsx("option", { value: id, children: spec[0] }, id))
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
})
|
|
258
|
+
}),
|
|
259
|
+
jsx("ul", {
|
|
260
|
+
children: state.connections.map((c) => jsx("li", {
|
|
261
|
+
children: button(c.name + " \xB7 " + c.authState, () => void choose(c))
|
|
262
|
+
}, c.id))
|
|
263
|
+
}),
|
|
264
|
+
...connection ? [
|
|
265
|
+
jsxs("div", {
|
|
266
|
+
className: "kiokuko-models-editor",
|
|
267
|
+
children: [
|
|
268
|
+
input("Connection name", connection.name, (value) => update("name", value)),
|
|
269
|
+
input("Base URL", connection.baseURL, (value) => update("baseURL", value)),
|
|
270
|
+
jsx("label", {
|
|
271
|
+
children: jsxs(Fragment, {
|
|
272
|
+
children: [
|
|
273
|
+
"Protocol",
|
|
274
|
+
jsx("select", {
|
|
275
|
+
"aria-label": "Protocol",
|
|
276
|
+
value: connection.protocol,
|
|
277
|
+
disabled: busy || [
|
|
278
|
+
"codex",
|
|
279
|
+
"infron",
|
|
280
|
+
"opencode",
|
|
281
|
+
"opencode-go"
|
|
282
|
+
].includes(connection.kind),
|
|
283
|
+
onChange: (e) => update("protocol", e.target.value),
|
|
284
|
+
children: [
|
|
285
|
+
["chat-completions", "Chat Completions"],
|
|
286
|
+
["responses", "Responses"],
|
|
287
|
+
["messages", "Messages"]
|
|
288
|
+
].map(([id, name]) => jsx("option", { value: id, children: name }, id))
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
})
|
|
292
|
+
}),
|
|
293
|
+
...connection.kind === "infron" ? [
|
|
294
|
+
jsx("label", {
|
|
295
|
+
children: jsxs(Fragment, {
|
|
296
|
+
children: [
|
|
297
|
+
"Service tier",
|
|
298
|
+
jsx("select", {
|
|
299
|
+
"aria-label": "Service tier",
|
|
300
|
+
value: connection.serviceTier,
|
|
301
|
+
disabled: busy,
|
|
302
|
+
onChange: (e) => update("serviceTier", e.target.value),
|
|
303
|
+
children: [
|
|
304
|
+
jsx("option", {
|
|
305
|
+
value: "standard",
|
|
306
|
+
children: "Standard"
|
|
307
|
+
}),
|
|
308
|
+
jsx("option", {
|
|
309
|
+
value: "flex",
|
|
310
|
+
children: "Flex"
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
})
|
|
314
|
+
]
|
|
315
|
+
})
|
|
316
|
+
}),
|
|
317
|
+
jsx("p", {
|
|
318
|
+
children: "Requested tier: " + connection.serviceTier + ". Last request: " + (connection.lastRequestedTier ?? "none") + ". Actual served tier: " + (connection.actualTier ?? "unknown") + ". Infron may serve Standard for a Flex request."
|
|
319
|
+
})
|
|
320
|
+
] : [],
|
|
321
|
+
button("Save connection", () => void run(save)),
|
|
322
|
+
...connection.kind !== "codex" && connection.kind !== "ollama" ? [
|
|
323
|
+
input("API key / bearer token", key, setKey, "password"),
|
|
324
|
+
button("Save key", () => void run(async () => {
|
|
325
|
+
await save();
|
|
326
|
+
await modelsApi({
|
|
327
|
+
op: "key",
|
|
328
|
+
id: connection.id,
|
|
329
|
+
key
|
|
330
|
+
});
|
|
331
|
+
setKey("");
|
|
332
|
+
await load();
|
|
333
|
+
await choose(connection);
|
|
334
|
+
setNotice("Key saved");
|
|
335
|
+
}), !key)
|
|
336
|
+
] : [],
|
|
337
|
+
...[
|
|
338
|
+
"codex",
|
|
339
|
+
"claude",
|
|
340
|
+
"xai",
|
|
341
|
+
"openai",
|
|
342
|
+
"openrouter",
|
|
343
|
+
"nous"
|
|
344
|
+
].includes(connection.kind) ? [
|
|
345
|
+
button("Log in", () => void run(startLogin), auth?.status === "pending")
|
|
346
|
+
] : [],
|
|
347
|
+
button("Log out (also dsh-cli)", () => void run(async () => {
|
|
348
|
+
await modelsApi({ op: "logout", id: connection.id });
|
|
349
|
+
setKey("");
|
|
350
|
+
setModels([]);
|
|
351
|
+
await load();
|
|
352
|
+
setNotice("Signed out");
|
|
353
|
+
})),
|
|
354
|
+
button("Refresh models", () => void run(async () => {
|
|
355
|
+
await modelsApi({ op: "refresh", id: connection.id });
|
|
356
|
+
const next = await load();
|
|
357
|
+
await choose(next.connections.find((c) => c.id === connection.id));
|
|
358
|
+
setNotice("Models refreshed");
|
|
359
|
+
})),
|
|
360
|
+
...auth?.status === "pending" ? [
|
|
361
|
+
jsxs("div", {
|
|
362
|
+
"aria-label": "Authentication",
|
|
363
|
+
children: [
|
|
364
|
+
jsx("p", {
|
|
365
|
+
role: "status",
|
|
366
|
+
children: "Waiting for authentication"
|
|
367
|
+
}),
|
|
368
|
+
...auth.events.map((event, index) => jsx("div", {
|
|
369
|
+
children: event.type === "auth_url" ? jsxs(Fragment, {
|
|
370
|
+
children: [
|
|
371
|
+
jsx("a", {
|
|
372
|
+
href: event.url,
|
|
373
|
+
target: "_blank",
|
|
374
|
+
rel: "noopener noreferrer",
|
|
375
|
+
children: "Open authentication link"
|
|
376
|
+
}),
|
|
377
|
+
jsx("p", {
|
|
378
|
+
children: event.instructions
|
|
379
|
+
})
|
|
380
|
+
]
|
|
381
|
+
}) : event.type === "device_code" ? jsxs(Fragment, {
|
|
382
|
+
children: [
|
|
383
|
+
jsx("a", {
|
|
384
|
+
href: event.verificationUri,
|
|
385
|
+
target: "_blank",
|
|
386
|
+
rel: "noopener noreferrer",
|
|
387
|
+
children: "Open sign-in page"
|
|
388
|
+
}),
|
|
389
|
+
jsx("p", {
|
|
390
|
+
children: "Code: " + event.userCode
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
}) : jsxs(Fragment, {
|
|
394
|
+
children: [
|
|
395
|
+
jsx("p", {
|
|
396
|
+
children: event.message
|
|
397
|
+
}),
|
|
398
|
+
...(event.links ?? []).map((link) => jsx("a", {
|
|
399
|
+
href: link.url,
|
|
400
|
+
target: "_blank",
|
|
401
|
+
rel: "noopener noreferrer",
|
|
402
|
+
children: link.label ?? "Open link"
|
|
403
|
+
}, link.url))
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
}, index)),
|
|
407
|
+
...auth.prompt ? [
|
|
408
|
+
auth.prompt.type === "select" ? jsx("label", {
|
|
409
|
+
children: jsxs(Fragment, {
|
|
410
|
+
children: [
|
|
411
|
+
auth.prompt.message,
|
|
412
|
+
jsxs("select", {
|
|
413
|
+
"aria-label": auth.prompt.message,
|
|
414
|
+
value: answer,
|
|
415
|
+
onChange: (e) => setAnswer(e.target.value),
|
|
416
|
+
children: [
|
|
417
|
+
jsx("option", {
|
|
418
|
+
value: "",
|
|
419
|
+
children: "Choose\u2026"
|
|
420
|
+
}),
|
|
421
|
+
...auth.prompt.options.map((option) => jsx("option", {
|
|
422
|
+
value: option.id,
|
|
423
|
+
children: option.label
|
|
424
|
+
}, option.id))
|
|
425
|
+
]
|
|
426
|
+
})
|
|
427
|
+
]
|
|
428
|
+
})
|
|
429
|
+
}) : input(auth.prompt.message, answer, setAnswer, auth.prompt.type === "secret" ? "password" : "text"),
|
|
430
|
+
button("Submit authentication answer", () => void run(async () => {
|
|
431
|
+
await modelsApi({
|
|
432
|
+
op: "answer",
|
|
433
|
+
id: auth.id,
|
|
434
|
+
answer
|
|
435
|
+
});
|
|
436
|
+
setAnswer("");
|
|
437
|
+
}))
|
|
438
|
+
] : [],
|
|
439
|
+
button("Cancel authentication", () => void run(async () => {
|
|
440
|
+
await modelsApi({ op: "cancel", id: auth.id });
|
|
441
|
+
operation.current = void 0;
|
|
442
|
+
setAuth(null);
|
|
443
|
+
setNotice("Authentication cancelled");
|
|
444
|
+
}))
|
|
445
|
+
]
|
|
446
|
+
})
|
|
447
|
+
] : [],
|
|
448
|
+
...!["opencode", "opencode-go"].includes(connection.kind) ? [
|
|
449
|
+
jsx("details", {
|
|
450
|
+
children: jsxs(Fragment, {
|
|
451
|
+
children: [
|
|
452
|
+
jsx("summary", {
|
|
453
|
+
children: "Register model manually"
|
|
454
|
+
}),
|
|
455
|
+
input("Model ID", manual.id, (value) => setManual({ ...manual, id: value })),
|
|
456
|
+
input("Context window", manual.contextWindow, (value) => setManual({
|
|
457
|
+
...manual,
|
|
458
|
+
contextWindow: Number(value)
|
|
459
|
+
}), "number"),
|
|
460
|
+
input("Maximum output tokens", manual.maxTokens, (value) => setManual({
|
|
461
|
+
...manual,
|
|
462
|
+
maxTokens: Number(value)
|
|
463
|
+
}), "number"),
|
|
464
|
+
jsx("label", {
|
|
465
|
+
children: jsxs(Fragment, {
|
|
466
|
+
children: [
|
|
467
|
+
jsx("input", {
|
|
468
|
+
type: "checkbox",
|
|
469
|
+
checked: manual.reasoning,
|
|
470
|
+
onChange: (e) => setManual({
|
|
471
|
+
...manual,
|
|
472
|
+
reasoning: e.target.checked
|
|
473
|
+
})
|
|
474
|
+
}),
|
|
475
|
+
"Reasoning supported"
|
|
476
|
+
]
|
|
477
|
+
})
|
|
478
|
+
}),
|
|
479
|
+
jsx("label", {
|
|
480
|
+
children: jsxs(Fragment, {
|
|
481
|
+
children: [
|
|
482
|
+
jsx("input", {
|
|
483
|
+
type: "checkbox",
|
|
484
|
+
checked: manual.image,
|
|
485
|
+
onChange: (e) => setManual({
|
|
486
|
+
...manual,
|
|
487
|
+
image: e.target.checked
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
"Image input supported"
|
|
491
|
+
]
|
|
492
|
+
})
|
|
493
|
+
}),
|
|
494
|
+
button("Add manual model", () => {
|
|
495
|
+
update("models", [
|
|
496
|
+
...connection.models.filter((m) => m.id !== manual.id),
|
|
497
|
+
{ ...manual, name: manual.id }
|
|
498
|
+
]);
|
|
499
|
+
setNotice("Model added to draft. Save connection to register it.");
|
|
500
|
+
}, !manual.id)
|
|
501
|
+
]
|
|
502
|
+
})
|
|
503
|
+
})
|
|
504
|
+
] : [],
|
|
505
|
+
input("Search models", filter, setFilter),
|
|
506
|
+
jsx("ul", {
|
|
507
|
+
children: models.filter((m) => (m.id + " " + m.name).toLowerCase().includes(filter.toLowerCase())).map((m) => jsx("li", {
|
|
508
|
+
children: jsxs(Fragment, {
|
|
509
|
+
children: [
|
|
510
|
+
jsx("span", { children: m.name + " \xB7 " + m.id }),
|
|
511
|
+
button("Use in current chat", () => void run(async () => {
|
|
512
|
+
await modelsApi({
|
|
513
|
+
op: "select",
|
|
514
|
+
id: connection.id,
|
|
515
|
+
model: m.id,
|
|
516
|
+
scope: "current",
|
|
517
|
+
sessionId
|
|
518
|
+
});
|
|
519
|
+
setNotice("Model selected for this chat");
|
|
520
|
+
}), !sessionId),
|
|
521
|
+
button("Default for new chats", () => void run(async () => {
|
|
522
|
+
await modelsApi({
|
|
523
|
+
op: "select",
|
|
524
|
+
id: connection.id,
|
|
525
|
+
model: m.id,
|
|
526
|
+
scope: "default"
|
|
527
|
+
});
|
|
528
|
+
setNotice("Default model saved for new chats");
|
|
529
|
+
}))
|
|
530
|
+
]
|
|
531
|
+
})
|
|
532
|
+
}, m.id))
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
})
|
|
536
|
+
] : []
|
|
537
|
+
]
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function KiokukoModelsDialog(props) {
|
|
541
|
+
const useModels = props.useKiokukoModels;
|
|
542
|
+
const state = useModels((s) => s), close = props.closeModels;
|
|
543
|
+
return jsx(Modal, {
|
|
544
|
+
open: state.open,
|
|
545
|
+
className: "kiokuko-models-modal",
|
|
546
|
+
title: "Kiokuko Models",
|
|
547
|
+
closeLabel: "Close",
|
|
548
|
+
onClose: close,
|
|
549
|
+
children: state.open ? jsx(KiokukoModelsPanel, { sessionId: state.sessionId }) : null
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function KiokukoModelsAnchor(props) {
|
|
553
|
+
const active = props.activeModelsSession;
|
|
554
|
+
useEffect(() => {
|
|
555
|
+
active.current = props.sessionId;
|
|
556
|
+
return () => {
|
|
557
|
+
if (active.current === props.sessionId)
|
|
558
|
+
active.current = void 0;
|
|
559
|
+
};
|
|
560
|
+
}, [props.sessionId]);
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
function mountModelsClient(ctx) {
|
|
564
|
+
const store = createSnapshotStore({
|
|
565
|
+
open: false
|
|
566
|
+
}), active = { current: void 0 };
|
|
567
|
+
let focusFrame;
|
|
568
|
+
const close = () => {
|
|
569
|
+
store.update((s) => {
|
|
570
|
+
s.open = false;
|
|
571
|
+
});
|
|
572
|
+
if (focusFrame !== void 0)
|
|
573
|
+
cancelAnimationFrame(focusFrame);
|
|
574
|
+
focusFrame = requestAnimationFrame(() => {
|
|
575
|
+
focusFrame = void 0;
|
|
576
|
+
const sessionId = active.current;
|
|
577
|
+
if (!sessionId)
|
|
578
|
+
return;
|
|
579
|
+
const sessions = ctx.get?.("sessions", false);
|
|
580
|
+
const scope = sessions?.scope(sessionId);
|
|
581
|
+
if (!scope)
|
|
582
|
+
return;
|
|
583
|
+
const conversation = scope.get("conversation", false);
|
|
584
|
+
conversation?.input.for(scope).focus();
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
ctx.effect(() => () => {
|
|
588
|
+
if (focusFrame !== void 0)
|
|
589
|
+
cancelAnimationFrame(focusFrame);
|
|
590
|
+
}, "kiokuko models focus lifecycle");
|
|
591
|
+
ctx.effect(() => {
|
|
592
|
+
const style = document.createElement("style");
|
|
593
|
+
style.textContent = ".kiokuko-models-modal{width:min(900px,calc(100vw - 32px))}.kiokuko-models-panel{box-sizing:border-box;width:100%;max-width:900px;padding:16px;overflow:auto;max-height:75vh}.kiokuko-models-panel label{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:12px 0}.kiokuko-models-panel input,.kiokuko-models-panel select{max-width:100%;box-sizing:border-box;border:1px solid #888;border-radius:6px;padding:8px;color:inherit;background:transparent}.kiokuko-models-panel button{border:1px solid #888;border-radius:6px;padding:8px;margin:4px;color:inherit}.kiokuko-models-panel button:disabled{opacity:.5}.kiokuko-models-panel li{margin:8px 0}.kiokuko-models-panel :focus-visible{outline:2px solid #3286ff;outline-offset:3px}";
|
|
594
|
+
document.head.append(style);
|
|
595
|
+
return () => style.remove();
|
|
596
|
+
}, "kiokuko models style");
|
|
597
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
598
|
+
name: "settings.section",
|
|
599
|
+
id: MODELS_NS,
|
|
600
|
+
order: 1e3,
|
|
601
|
+
label: "Kiokuko Models",
|
|
602
|
+
locale: MODELS_NS
|
|
603
|
+
}, () => jsx(KiokukoModelsPanel, { sessionId: active.current })));
|
|
604
|
+
ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
|
|
605
|
+
name: "conversation.input.left",
|
|
606
|
+
id: "kiokuko-models-dialog",
|
|
607
|
+
locale: MODELS_NS,
|
|
608
|
+
inject: () => ({
|
|
609
|
+
hooks: { kiokukoModels: store },
|
|
610
|
+
closeModels: close,
|
|
611
|
+
activeModelsSession: active
|
|
612
|
+
})
|
|
613
|
+
}, KiokukoModelsAnchor));
|
|
614
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
615
|
+
name: "shell.overlay",
|
|
616
|
+
id: "kiokuko-models-overlay",
|
|
617
|
+
locale: MODELS_NS,
|
|
618
|
+
inject: () => ({ hooks: { kiokukoModels: store }, closeModels: close })
|
|
619
|
+
}, KiokukoModelsDialog));
|
|
620
|
+
ctx.on("command/executed", (sessionId, name, result) => {
|
|
621
|
+
if (name === "kiokuko" && result.kind === "success")
|
|
622
|
+
store.update((s) => {
|
|
623
|
+
s.open = true;
|
|
624
|
+
s.sessionId = sessionId;
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
ctx.effect(() => ctx.locale.register(MODELS_NS, {
|
|
628
|
+
en: { "meta.title": "Kiokuko Models" },
|
|
629
|
+
ja: { "meta.title": "Kiokuko Models" }
|
|
630
|
+
}), "kiokuko models labels");
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return module.exports;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface DshClientContext {
|
|
2
|
+
get?(name: string, required?: false): unknown;
|
|
3
|
+
slots: {
|
|
4
|
+
inject(name: string, register: () => unknown): unknown;
|
|
5
|
+
register(definition: {
|
|
6
|
+
name: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
order?: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
inject?: () => Record<string, unknown>;
|
|
12
|
+
}, component: (props: Record<string, unknown>) => unknown): unknown;
|
|
13
|
+
};
|
|
14
|
+
locale: {
|
|
15
|
+
register(namespace: string, dictionaries: Record<string, Record<string, string>>): unknown;
|
|
16
|
+
};
|
|
17
|
+
effect(setup: () => void | (() => void | Promise<void>), label: string): unknown;
|
|
18
|
+
on(event: 'command/executed', listener: (sessionId: string, name: string, result: {
|
|
19
|
+
readonly kind: string;
|
|
20
|
+
}) => void): unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare const inject: readonly ["slots", "locale"];
|
|
23
|
+
export declare function apply(ctx: DshClientContext): void;
|
|
24
|
+
export declare function mountModelsClient(ctx: DshClientContext): void;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=models-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models-client.d.ts","sourceRoot":"","sources":["../src/models-client.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACxB,GAAG,CAAC,CAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,CAAC,EAAC,KAAK,GAAE,OAAO,CAAC;IAC1C,KAAK,EAAE;QACL,MAAM,CAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAI,OAAO,GAAE,OAAO,CAAC;QACjD,QAAQ,CAAC,UAAU,EAAC;YAAC,IAAI,EAAC,MAAM,CAAC;YAAA,EAAE,CAAC,EAAC,MAAM,CAAC;YAAA,KAAK,CAAC,EAAC,MAAM,CAAC;YAAA,KAAK,CAAC,EAAC,MAAM,CAAC;YAAA,MAAM,EAAC,MAAM,CAAC;YAAA,MAAM,CAAC,EAAC,MAAI,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAA;SAAC,EAAC,SAAS,EAAC,CAAC,KAAK,EAAC,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,KAAG,OAAO,GAAE,OAAO,CAAC;KACtL,CAAC;IACF,MAAM,EAAC;QAAC,QAAQ,CAAC,SAAS,EAAC,MAAM,EAAC,YAAY,EAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC,GAAE,OAAO,CAAA;KAAC,CAAC;IAC9F,MAAM,CAAC,KAAK,EAAC,MAAI,IAAI,GAAC,CAAC,MAAI,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC,KAAK,EAAC,MAAM,GAAE,OAAO,CAAC;IACrE,EAAE,CAAC,KAAK,EAAC,kBAAkB,EAAC,QAAQ,EAAC,CAAC,SAAS,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC;QAAC,QAAQ,CAAC,IAAI,EAAC,MAAM,CAAA;KAAC,KAAG,IAAI,GAAE,OAAO,CAAC;CAClH;AA4BD,eAAO,MAAM,MAAM,8BAA+B,CAAC;AACnD,wBAAgB,KAAK,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAEjD;AA8sBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAqF7D"}
|