@try-works/dsh-model-as-tool 0.1.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dsh-tool-mode-credentials.mjs +20 -0
- package/bin/dsh-tool-mode.mjs +202 -0
- package/catalog/desert-ant-models.json +693 -693
- package/client/client.model-tools.js +614 -0
- package/client/index.js +1717 -0
- package/lib/adapters/index.d.ts.map +1 -1
- package/lib/adapters/index.js +4 -4
- package/lib/bindings.d.ts.map +1 -1
- package/lib/bindings.js +26 -25
- package/lib/capability.d.ts.map +1 -1
- package/lib/capability.js +17 -0
- package/lib/capture-path.d.ts +97 -0
- package/lib/capture-path.d.ts.map +1 -0
- package/lib/capture-path.js +152 -0
- package/lib/diagnostics.d.ts +166 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +135 -0
- package/lib/extension-dependencies.d.ts +325 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +858 -0
- package/lib/extension-dispatch.d.ts +117 -0
- package/lib/extension-dispatch.d.ts.map +1 -0
- package/lib/extension-dispatch.js +124 -0
- package/lib/extension-registrar.d.ts +100 -0
- package/lib/extension-registrar.d.ts.map +1 -0
- package/lib/extension-registrar.js +134 -0
- package/lib/extensions-api.d.ts +221 -0
- package/lib/extensions-api.d.ts.map +1 -0
- package/lib/extensions-api.js +17 -0
- package/lib/extensions-remote.d.ts +54 -0
- package/lib/extensions-remote.d.ts.map +1 -0
- package/lib/extensions-remote.js +66 -0
- package/lib/extensions-service.d.ts +367 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +1527 -0
- package/lib/harness-llm.d.ts +138 -0
- package/lib/harness-llm.d.ts.map +1 -0
- package/lib/harness-llm.js +218 -0
- package/lib/harness-serving.d.ts +95 -0
- package/lib/harness-serving.d.ts.map +1 -0
- package/lib/harness-serving.js +157 -0
- package/lib/headless.d.ts +97 -0
- package/lib/headless.d.ts.map +1 -0
- package/lib/headless.js +349 -0
- package/lib/http-acquisition.d.ts +27 -0
- package/lib/http-acquisition.d.ts.map +1 -0
- package/lib/http-acquisition.js +136 -0
- package/lib/index.d.ts +271 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2644 -70
- package/lib/invocation-accounting.d.ts +169 -0
- package/lib/invocation-accounting.d.ts.map +1 -0
- package/lib/invocation-accounting.js +148 -0
- package/lib/legacy-migration.d.ts +95 -0
- package/lib/legacy-migration.d.ts.map +1 -0
- package/lib/legacy-migration.js +429 -0
- package/lib/managed-workers.d.ts +151 -0
- package/lib/managed-workers.d.ts.map +1 -0
- package/lib/managed-workers.js +249 -0
- package/lib/mcp/client-grant.d.ts +74 -0
- package/lib/mcp/client-grant.d.ts.map +1 -0
- package/lib/mcp/client-grant.js +60 -0
- package/lib/mcp/credential-cli.d.ts +38 -0
- package/lib/mcp/credential-cli.d.ts.map +1 -0
- package/lib/mcp/credential-cli.js +148 -0
- package/lib/mcp/credential-store.d.ts +143 -0
- package/lib/mcp/credential-store.d.ts.map +1 -0
- package/lib/mcp/credential-store.js +454 -0
- package/lib/mcp/host-binding.d.ts +25 -0
- package/lib/mcp/host-binding.d.ts.map +1 -1
- package/lib/mcp/host-binding.js +107 -14
- package/lib/mcp/http.d.ts +68 -18
- package/lib/mcp/http.d.ts.map +1 -1
- package/lib/mcp/http.js +390 -62
- package/lib/mcp/oauth.d.ts +149 -0
- package/lib/mcp/oauth.d.ts.map +1 -0
- package/lib/mcp/oauth.js +396 -0
- package/lib/mcp/protocol.d.ts +46 -7
- package/lib/mcp/protocol.d.ts.map +1 -1
- package/lib/mcp/protocol.js +63 -16
- package/lib/mcp/rate-limit.d.ts +68 -0
- package/lib/mcp/rate-limit.d.ts.map +1 -0
- package/lib/mcp/rate-limit.js +114 -0
- package/lib/mcp/sdk-v2.d.ts +17 -0
- package/lib/mcp/sdk-v2.d.ts.map +1 -0
- package/lib/mcp/sdk-v2.js +181 -0
- package/lib/mcp/server.d.ts +11 -1
- package/lib/mcp/server.d.ts.map +1 -1
- package/lib/mcp/server.js +80 -13
- package/lib/mcp/stdio.d.ts.map +1 -1
- package/lib/mcp/stdio.js +9 -1
- package/lib/mcp/subscriptions.d.ts +43 -1
- package/lib/mcp/subscriptions.d.ts.map +1 -1
- package/lib/mcp/subscriptions.js +90 -9
- package/lib/model-qualification.d.ts +192 -0
- package/lib/model-qualification.d.ts.map +1 -0
- package/lib/model-qualification.js +178 -0
- package/lib/planning.d.ts +246 -0
- package/lib/planning.d.ts.map +1 -0
- package/lib/planning.js +457 -0
- package/lib/prepared-assets.d.ts +178 -0
- package/lib/prepared-assets.d.ts.map +1 -0
- package/lib/prepared-assets.js +286 -0
- package/lib/provider-bridge.d.ts +37 -0
- package/lib/provider-bridge.d.ts.map +1 -1
- package/lib/provider-bridge.js +189 -12
- package/lib/ptc-authority.d.ts +140 -0
- package/lib/ptc-authority.d.ts.map +1 -0
- package/lib/ptc-authority.js +216 -0
- package/lib/ptc-runtime.d.ts +156 -0
- package/lib/ptc-runtime.d.ts.map +1 -0
- package/lib/ptc-runtime.js +191 -0
- package/lib/publication.d.ts +2 -1
- package/lib/publication.d.ts.map +1 -1
- package/lib/publication.js +13 -5
- package/lib/receipt.d.ts.map +1 -1
- package/lib/receipt.js +8 -0
- package/lib/title-proposal.d.ts +194 -0
- package/lib/title-proposal.d.ts.map +1 -0
- package/lib/title-proposal.js +244 -0
- package/lib/tool-mode-run.d.ts +235 -0
- package/lib/tool-mode-run.d.ts.map +1 -0
- package/lib/tool-mode-run.js +283 -0
- package/lib/types.d.ts +3 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/update-surface.d.ts +79 -0
- package/lib/update-surface.d.ts.map +1 -0
- package/lib/update-surface.js +224 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +69 -55
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +4 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +26 -2
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +28 -2
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -1
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +93 -10
- package/node_modules/@try-works/tool-mode-contracts/package.json +0 -1
- package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +125 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +32 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +32 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +126 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +297 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +216 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +800 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +235 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +367 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +807 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +243 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +118 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +150 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +670 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/package.json +53 -0
- package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
- package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +427 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +592 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +60 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +936 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +200 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +105 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/images.js +129 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +325 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +227 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +407 -0
- package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
- package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
- package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
- package/package.json +43 -15
- package/remote/spec.mjs +462 -0
- package/remote/typert.host.mjs +14 -0
- package/remote/typert.remote-client.mjs +16 -0
- package/lib/adapters/tongue.d.ts +0 -31
- package/lib/adapters/tongue.d.ts.map +0 -1
- package/lib/adapters/tongue.js +0 -93
- package/lib/adapters/voz.d.ts +0 -28
- package/lib/adapters/voz.d.ts.map +0 -1
- package/lib/adapters/voz.js +0 -102
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts +0 -0
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.d.ts.map +0 -0
- /package/{lib → node_modules/@try-works/tool-mode-extension-sdk/lib}/licensing.js +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire contract between the Settings page and the host for extension
|
|
3
|
+
* management (install / enable / disable).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth both halves implement:
|
|
6
|
+
* - the host service (`extensions-service.ts`) produces these values;
|
|
7
|
+
* - the generated/registered Remote artifact exposes them as `remote.modelTools`;
|
|
8
|
+
* - the browser half calls them after installing its Install/Enable controls.
|
|
9
|
+
*
|
|
10
|
+
* Every method is deliberately explicit about what is UNKNOWN rather than
|
|
11
|
+
* inventing state: `store` is null when no extension store is configured, and a
|
|
12
|
+
* row's `integrity` is absent when nothing was ever installed.
|
|
13
|
+
*
|
|
14
|
+
* @module @try-works/dsh-model-as-tool/extensions-api
|
|
15
|
+
*/
|
|
16
|
+
/** One extension, as the UI needs it. */
|
|
17
|
+
/** What kind of prerequisite an extension (or a model it serves) has. */
|
|
18
|
+
export type ExtensionRequirementKind = 'store' | 'source' | 'dependencies' | 'assets' | 'executable' | 'harness-model' | 'platform' | 'integrity' | 'activation';
|
|
19
|
+
/** The action that clears an unmet requirement, when the deployment supports it. */
|
|
20
|
+
export type ExtensionRequirementAction = 'install' | 'prepare' | 'enable' | 'config' | 'none';
|
|
21
|
+
/**
|
|
22
|
+
* ONE activation prerequisite, computed by the host BEFORE install/enable.
|
|
23
|
+
*
|
|
24
|
+
* The point of this list is that a user never discovers a deployment gap by
|
|
25
|
+
* clicking Enable and reading an EXTENSION_FAULT: `blocked` rows carry the exact
|
|
26
|
+
* requirement that is unmet and the action (if any) that would satisfy it. A
|
|
27
|
+
* requirement is reported even when satisfied, so the page can distinguish
|
|
28
|
+
* "nothing to do" from "we did not look".
|
|
29
|
+
*/
|
|
30
|
+
export interface ExtensionRequirement {
|
|
31
|
+
readonly kind: ExtensionRequirementKind;
|
|
32
|
+
readonly satisfied: boolean;
|
|
33
|
+
/** Exact, actionable text; empty only when satisfied and self-evident. */
|
|
34
|
+
readonly reason: string;
|
|
35
|
+
readonly action: ExtensionRequirementAction;
|
|
36
|
+
}
|
|
37
|
+
export interface ExtensionState {
|
|
38
|
+
/** The extension's package identity, for example `@try-works/extension-laya`. */
|
|
39
|
+
readonly id: string;
|
|
40
|
+
/** The package name to install from, when the host knows one. */
|
|
41
|
+
readonly package: string | null;
|
|
42
|
+
/** Installed version, absent when the store does not hold it. */
|
|
43
|
+
readonly version: string | null;
|
|
44
|
+
/** Whether the store holds an installed copy. */
|
|
45
|
+
readonly installed: boolean;
|
|
46
|
+
/** Whether the host restored it on this load. */
|
|
47
|
+
readonly active: boolean;
|
|
48
|
+
/** Whether the operator disabled it (config `disabledExtensions`). */
|
|
49
|
+
readonly disabled: boolean;
|
|
50
|
+
/** Content verification of the installed copy. */
|
|
51
|
+
readonly integrity: 'unchanged' | 'changed' | 'unknown';
|
|
52
|
+
/** Tool names the extension exports once active. */
|
|
53
|
+
readonly tools: readonly string[];
|
|
54
|
+
/** Why the extension cannot install or activate, when known. */
|
|
55
|
+
readonly reason: string | null;
|
|
56
|
+
/** Every prerequisite this deployment checked, satisfied or not. */
|
|
57
|
+
readonly requirements: readonly ExtensionRequirement[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether ANY unmet requirement blocks activation. Derived from
|
|
60
|
+
* `requirements`; carried explicitly so the page never has to re-derive it.
|
|
61
|
+
*/
|
|
62
|
+
readonly blocked: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** The state of the extension surface. */
|
|
65
|
+
export interface ExtensionsDescribeResult {
|
|
66
|
+
/** The configured extension store directory, or null when unconfigured. */
|
|
67
|
+
readonly store: string | null;
|
|
68
|
+
/** Whether the host can write to the store (install/enable/disable). */
|
|
69
|
+
readonly writable: boolean;
|
|
70
|
+
/** Where the host would install first-party extensions from, or null. */
|
|
71
|
+
readonly sourceDir: string | null;
|
|
72
|
+
/** One row per extension the host knows about. */
|
|
73
|
+
readonly extensions: readonly ExtensionState[];
|
|
74
|
+
}
|
|
75
|
+
/** The result of an install request. */
|
|
76
|
+
export interface ExtensionInstallResult {
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly version: string;
|
|
79
|
+
/** Installation is not activation: `active` is false until it is enabled. */
|
|
80
|
+
readonly active: boolean;
|
|
81
|
+
/** Which route actually supplied the installed bytes. */
|
|
82
|
+
readonly source: 'registry' | 'directory';
|
|
83
|
+
/** The exact version the request resolved to (equals `version` today). */
|
|
84
|
+
readonly resolvedVersion: string;
|
|
85
|
+
}
|
|
86
|
+
/** The result of an enable/disable request. */
|
|
87
|
+
export interface ExtensionToggleResult {
|
|
88
|
+
readonly id: string;
|
|
89
|
+
readonly active: boolean;
|
|
90
|
+
readonly disabled: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The readiness vocabulary a preparation reports (EXT-25 / RES-04).
|
|
94
|
+
*
|
|
95
|
+
* Only `prepared-cold`, `loading`, `ready` and `busy` permit activation; the
|
|
96
|
+
* others name WHY they do not.
|
|
97
|
+
*/
|
|
98
|
+
export type ExtensionModelReadiness = 'unavailable' | 'needs-preparation' | 'preparing' | 'prepared-cold' | 'loading' | 'ready' | 'busy' | 'failed';
|
|
99
|
+
/**
|
|
100
|
+
* Readiness for each DECLARED model deployment, keyed by the manifest's model id.
|
|
101
|
+
*
|
|
102
|
+
* Declared ids are the projection: a stale readiness entry for a deployment the
|
|
103
|
+
* current manifest no longer declares is not reported.
|
|
104
|
+
*/
|
|
105
|
+
export type ExtensionReadinessMap = Readonly<Record<string, ExtensionModelReadiness>>;
|
|
106
|
+
/** One asset in the RES-02 preparation disclosure. */
|
|
107
|
+
export interface ExtensionPreparationAsset {
|
|
108
|
+
/** The stable asset id (`<group>/<asset>`). */
|
|
109
|
+
readonly assetId: string;
|
|
110
|
+
/** Download size in bytes. */
|
|
111
|
+
readonly bytes: number;
|
|
112
|
+
/** The pinned source the bytes come from. */
|
|
113
|
+
readonly source: string;
|
|
114
|
+
/** Whether the asset is executable, which needs the separate approval (RES-02). */
|
|
115
|
+
readonly executable: boolean;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The pre-approval disclosure of what a preparation downloads (RES-02).
|
|
119
|
+
*
|
|
120
|
+
* The same fields the management channel's `extensions-prepare-plan` action
|
|
121
|
+
* discloses; it travels with the result so the page can show bytes, storage,
|
|
122
|
+
* terms and the executable gate.
|
|
123
|
+
*/
|
|
124
|
+
export interface ExtensionPreparationPlan {
|
|
125
|
+
/** The manifest model deployment the assets belong to. */
|
|
126
|
+
readonly modelId: string;
|
|
127
|
+
/** The pinned model revision. */
|
|
128
|
+
readonly modelRevision: string;
|
|
129
|
+
/** Every asset the preparation acquires. */
|
|
130
|
+
readonly assets: readonly ExtensionPreparationAsset[];
|
|
131
|
+
/** Total download bytes. */
|
|
132
|
+
readonly totalBytes: number;
|
|
133
|
+
/** Total bytes retained after installation (stated separately from download). */
|
|
134
|
+
readonly storageBytes: number;
|
|
135
|
+
/** Whether any asset is executable and therefore needs the separate approval. */
|
|
136
|
+
readonly requiresExecutableApproval: boolean;
|
|
137
|
+
/** The pinned license terms, surfaced before the download. */
|
|
138
|
+
readonly license: {
|
|
139
|
+
readonly name: string;
|
|
140
|
+
readonly url: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The result of a preparation request. */
|
|
144
|
+
export interface ExtensionPrepareResult {
|
|
145
|
+
readonly id: string;
|
|
146
|
+
/** Whether every declared asset was verified and the readiness was recorded. */
|
|
147
|
+
readonly prepared: boolean;
|
|
148
|
+
/** Why the preparation did not complete, when it did not; null on success. */
|
|
149
|
+
readonly reason: string | null;
|
|
150
|
+
/** The RES-02 disclosure this call executed, when a plan could be resolved. */
|
|
151
|
+
readonly plan: ExtensionPreparationPlan | null;
|
|
152
|
+
/** The readiness per DECLARED model deployment after the call. */
|
|
153
|
+
readonly readiness: ExtensionReadinessMap;
|
|
154
|
+
/** The prepared asset group ids (empty when nothing was prepared). */
|
|
155
|
+
readonly groups: readonly string[];
|
|
156
|
+
/**
|
|
157
|
+
* Whether no KNOWN blocker remains for activation: the installed bytes verify
|
|
158
|
+
* and every declared deployment is in a callable readiness state.
|
|
159
|
+
*
|
|
160
|
+
* This is the preparation question only; it does not promise that activation
|
|
161
|
+
* will publish (a schema or contribution refusal can still fail an enable).
|
|
162
|
+
*/
|
|
163
|
+
readonly activationReady: boolean;
|
|
164
|
+
}
|
|
165
|
+
/** The methods the HOST service implements (raw values, in-process). */
|
|
166
|
+
export interface ModelToolsRemote {
|
|
167
|
+
/** Read the current state; the page calls this on mount and after each action. */
|
|
168
|
+
describe(signal?: AbortSignal): Promise<ExtensionsDescribeResult>;
|
|
169
|
+
/** Install one extension from `source`, or the configured first-party source. */
|
|
170
|
+
install(id: string, source?: string, signal?: AbortSignal): Promise<ExtensionInstallResult>;
|
|
171
|
+
/** Activate an installed extension (removes it from `disabledExtensions`). */
|
|
172
|
+
enable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>;
|
|
173
|
+
/** Deactivate an extension (adds it to `disabledExtensions`). */
|
|
174
|
+
disable(id: string, signal?: AbortSignal): Promise<ExtensionToggleResult>;
|
|
175
|
+
/**
|
|
176
|
+
* Acquire and verify the installed extension's model assets, then record the
|
|
177
|
+
* resulting readiness so a following `enable` can activate it.
|
|
178
|
+
*/
|
|
179
|
+
prepare(id: string, signal?: AbortSignal): Promise<ExtensionPrepareResult>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The Remote wire result wrapper.
|
|
183
|
+
*
|
|
184
|
+
* A generated Remote call resolves a `RemoteResult`, never a bare value: the
|
|
185
|
+
* gateway answers `{ok:true,value}` or `{ok:false,error}`. Declared locally (not
|
|
186
|
+
* imported) so this package does not couple to the harness gateway types, and
|
|
187
|
+
* because the browser half is plain JS that reads `.ok` structurally.
|
|
188
|
+
*/
|
|
189
|
+
export type RemoteResult<T> = {
|
|
190
|
+
readonly ok: true;
|
|
191
|
+
readonly value: T;
|
|
192
|
+
} | {
|
|
193
|
+
readonly ok: false;
|
|
194
|
+
readonly error: {
|
|
195
|
+
readonly code?: string;
|
|
196
|
+
readonly message: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* The methods the BROWSER half calls, as `ctx.remote.modelTools`.
|
|
201
|
+
*
|
|
202
|
+
* Two wire facts a caller must respect:
|
|
203
|
+
* - `describe`/`enable`/`disable` resolve a {@link RemoteResult}, not a raw value.
|
|
204
|
+
* - The install method is named `installExtension`, not `install`: the harness
|
|
205
|
+
* client's RemoteNamespaceService owns a private method `install`, and the
|
|
206
|
+
* gateway rejects a descriptor method that collides with it
|
|
207
|
+
* ("client api: method ... conflicts with its namespace service"). The host
|
|
208
|
+
* service keeps `install`, and the descriptor maps the wire name to it.
|
|
209
|
+
*/
|
|
210
|
+
export interface ModelToolsRemoteClient {
|
|
211
|
+
describe(signal?: AbortSignal): Promise<RemoteResult<ExtensionsDescribeResult>>;
|
|
212
|
+
installExtension(id: string, source?: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionInstallResult>>;
|
|
213
|
+
enable(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionToggleResult>>;
|
|
214
|
+
disable(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionToggleResult>>;
|
|
215
|
+
/**
|
|
216
|
+
* Acquire/verify the extension's model assets and record readiness. The wire
|
|
217
|
+
* name is `prepare` (no collision with the namespace service's members).
|
|
218
|
+
*/
|
|
219
|
+
prepare(id: string, signal?: AbortSignal): Promise<RemoteResult<ExtensionPrepareResult>>;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=extensions-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAA;IAChD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAA;IACtF,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAA;IACvF;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAA;CACzF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire contract between the Settings page and the host for extension
|
|
3
|
+
* management (install / enable / disable).
|
|
4
|
+
*
|
|
5
|
+
* This module is the single source of truth both halves implement:
|
|
6
|
+
* - the host service (`extensions-service.ts`) produces these values;
|
|
7
|
+
* - the generated/registered Remote artifact exposes them as `remote.modelTools`;
|
|
8
|
+
* - the browser half calls them after installing its Install/Enable controls.
|
|
9
|
+
*
|
|
10
|
+
* Every method is deliberately explicit about what is UNKNOWN rather than
|
|
11
|
+
* inventing state: `store` is null when no extension store is configured, and a
|
|
12
|
+
* row's `integrity` is absent when nothing was ever installed.
|
|
13
|
+
*
|
|
14
|
+
* @module @try-works/dsh-model-as-tool/extensions-api
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=extensions-api.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-side registration of the `modelTools` Remote namespace.
|
|
3
|
+
*
|
|
4
|
+
* The Host Gateway resolves each generated invocation through the Cordis
|
|
5
|
+
* service named by its descriptor (`modelTools`) and refuses a service without
|
|
6
|
+
* a visible `typertRemote` binding. The generated Host artifact
|
|
7
|
+
* (`remote/typert.host.mjs`, published as `./typert`) is registered
|
|
8
|
+
* automatically by `@deepseek-ai/dsh-typert-loader` for this package's Loader
|
|
9
|
+
* entry; this module supplies the other half: a bound, provided service object.
|
|
10
|
+
*
|
|
11
|
+
* Keeping both facts in one helper makes a half-wired composition fail loudly
|
|
12
|
+
* at apply time instead of on the first Remote call.
|
|
13
|
+
*
|
|
14
|
+
* The browser half is `remote/spec.mjs` + `client/client.model-tools.js`; the
|
|
15
|
+
* method-name split between the wire (`installExtension`) and the Host service
|
|
16
|
+
* (`install`) is documented in `./extensions-api.ts`.
|
|
17
|
+
*
|
|
18
|
+
* @module @try-works/dsh-model-as-tool/extensions-remote
|
|
19
|
+
*/
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
21
|
+
import type { ModelToolsRemote } from './extensions-api.ts';
|
|
22
|
+
/** Cordis service key the Host dispatch resolves through the descriptor. */
|
|
23
|
+
export declare const MODEL_TOOLS_SERVICE = "modelTools";
|
|
24
|
+
/** Wire namespace the Client mounts as `ctx.remote.modelTools`. */
|
|
25
|
+
export declare const MODEL_TOOLS_NAMESPACE = "modelTools";
|
|
26
|
+
/**
|
|
27
|
+
* The binding shape the Gateway reads from a service object.
|
|
28
|
+
* Mirrors the protocol's `TypertGatewayBinding` without importing the harness.
|
|
29
|
+
*/
|
|
30
|
+
export interface ModelToolsBinding {
|
|
31
|
+
readonly service: object;
|
|
32
|
+
readonly serviceKey: string;
|
|
33
|
+
readonly namespace: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Attach the Gateway's `typertRemote` binding to a prepared service object.
|
|
37
|
+
* @param service - the implementation of {@link ModelToolsRemote}.
|
|
38
|
+
* @returns the same service, now bindable to the `modelTools` namespace.
|
|
39
|
+
* @throws TypeError when a required method is missing.
|
|
40
|
+
*/
|
|
41
|
+
export declare function bindModelToolsRemote<T extends ModelToolsRemote>(service: T): T;
|
|
42
|
+
/**
|
|
43
|
+
* Provide the bound extension service as the `modelTools` Cordis service.
|
|
44
|
+
*
|
|
45
|
+
* The Host artifact registers strict descriptors for:
|
|
46
|
+
* `describe`, `installExtension` (dispatching to the service's `install`),
|
|
47
|
+
* `enable`, `disable`, and `prepare`.
|
|
48
|
+
*
|
|
49
|
+
* @param ctx - the plugin's Cordis context that should own the service.
|
|
50
|
+
* @param service - the prepared {@link ModelToolsRemote} implementation.
|
|
51
|
+
* @throws TypeError when the service cannot satisfy the wire contract.
|
|
52
|
+
*/
|
|
53
|
+
export declare function provideModelToolsService(ctx: Context, service: ModelToolsRemote): void;
|
|
54
|
+
//# sourceMappingURL=extensions-remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions-remote.d.ts","sourceRoot":"","sources":["../src/extensions-remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,eAAe,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAKD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAoB9E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAEtF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-side registration of the `modelTools` Remote namespace.
|
|
3
|
+
*
|
|
4
|
+
* The Host Gateway resolves each generated invocation through the Cordis
|
|
5
|
+
* service named by its descriptor (`modelTools`) and refuses a service without
|
|
6
|
+
* a visible `typertRemote` binding. The generated Host artifact
|
|
7
|
+
* (`remote/typert.host.mjs`, published as `./typert`) is registered
|
|
8
|
+
* automatically by `@deepseek-ai/dsh-typert-loader` for this package's Loader
|
|
9
|
+
* entry; this module supplies the other half: a bound, provided service object.
|
|
10
|
+
*
|
|
11
|
+
* Keeping both facts in one helper makes a half-wired composition fail loudly
|
|
12
|
+
* at apply time instead of on the first Remote call.
|
|
13
|
+
*
|
|
14
|
+
* The browser half is `remote/spec.mjs` + `client/client.model-tools.js`; the
|
|
15
|
+
* method-name split between the wire (`installExtension`) and the Host service
|
|
16
|
+
* (`install`) is documented in `./extensions-api.ts`.
|
|
17
|
+
*
|
|
18
|
+
* @module @try-works/dsh-model-as-tool/extensions-remote
|
|
19
|
+
*/
|
|
20
|
+
/** Cordis service key the Host dispatch resolves through the descriptor. */
|
|
21
|
+
export const MODEL_TOOLS_SERVICE = 'modelTools';
|
|
22
|
+
/** Wire namespace the Client mounts as `ctx.remote.modelTools`. */
|
|
23
|
+
export const MODEL_TOOLS_NAMESPACE = 'modelTools';
|
|
24
|
+
/** The public methods the Host service must expose for dispatch to work. */
|
|
25
|
+
const REQUIRED_METHODS = ['describe', 'install', 'enable', 'disable', 'prepare'];
|
|
26
|
+
/**
|
|
27
|
+
* Attach the Gateway's `typertRemote` binding to a prepared service object.
|
|
28
|
+
* @param service - the implementation of {@link ModelToolsRemote}.
|
|
29
|
+
* @returns the same service, now bindable to the `modelTools` namespace.
|
|
30
|
+
* @throws TypeError when a required method is missing.
|
|
31
|
+
*/
|
|
32
|
+
export function bindModelToolsRemote(service) {
|
|
33
|
+
const missing = REQUIRED_METHODS.filter(method => service[method] === undefined);
|
|
34
|
+
if (missing.length > 0) {
|
|
35
|
+
throw new TypeError(`model-tools: the Remote service is missing ${missing.map(method => JSON.stringify(method)).join(', ')}; `
|
|
36
|
+
+ 'the modelTools namespace cannot be dispatched');
|
|
37
|
+
}
|
|
38
|
+
if (Object.hasOwn(service, 'typertRemote'))
|
|
39
|
+
return service;
|
|
40
|
+
Object.defineProperty(service, 'typertRemote', {
|
|
41
|
+
value: Object.freeze({
|
|
42
|
+
service,
|
|
43
|
+
serviceKey: MODEL_TOOLS_SERVICE,
|
|
44
|
+
namespace: MODEL_TOOLS_NAMESPACE,
|
|
45
|
+
}),
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: false,
|
|
48
|
+
writable: false,
|
|
49
|
+
});
|
|
50
|
+
return service;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Provide the bound extension service as the `modelTools` Cordis service.
|
|
54
|
+
*
|
|
55
|
+
* The Host artifact registers strict descriptors for:
|
|
56
|
+
* `describe`, `installExtension` (dispatching to the service's `install`),
|
|
57
|
+
* `enable`, `disable`, and `prepare`.
|
|
58
|
+
*
|
|
59
|
+
* @param ctx - the plugin's Cordis context that should own the service.
|
|
60
|
+
* @param service - the prepared {@link ModelToolsRemote} implementation.
|
|
61
|
+
* @throws TypeError when the service cannot satisfy the wire contract.
|
|
62
|
+
*/
|
|
63
|
+
export function provideModelToolsService(ctx, service) {
|
|
64
|
+
ctx.provide(MODEL_TOOLS_SERVICE, bindModelToolsRemote(service));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=extensions-remote.js.map
|