@try-works/dsh-model-as-tool 0.1.2 → 0.3.6
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 +592 -0
- package/client/index.js +1679 -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 +197 -0
- package/lib/extension-dependencies.d.ts.map +1 -0
- package/lib/extension-dependencies.js +369 -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 +217 -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 +334 -0
- package/lib/extensions-service.d.ts.map +1 -0
- package/lib/extensions-service.js +1351 -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 +250 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2625 -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/lang-detect.d.ts +16 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +85 -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/stt-transcribe.d.ts +20 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -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 +82 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/index.js +48 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +104 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +55 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +107 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
- package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
- package/node_modules/@try-works/tool-mode-contracts/package.json +34 -0
- 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 +31 -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 +31 -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 +185 -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/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 +50 -17
- package/remote/spec.mjs +439 -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,592 @@
|
|
|
1
|
+
// Generated by scripts/gen-remote-artifacts.mjs from remote/spec.mjs — do not edit.
|
|
2
|
+
//
|
|
3
|
+
// The package-local chunk the browser half loads with
|
|
4
|
+
// require.async('./client.model-tools.js'). It carries the same strict descriptors as
|
|
5
|
+
// the ESM ./remote artifact; see remote/spec.mjs for the wire contract.
|
|
6
|
+
window.__ModuleLoader__.load({
|
|
7
|
+
id: "@try-works/dsh-model-as-tool",
|
|
8
|
+
chunk: "client.model-tools.js",
|
|
9
|
+
factory(require) {
|
|
10
|
+
var module = { exports: {} }
|
|
11
|
+
var exports = module.exports
|
|
12
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
|
|
13
|
+
|
|
14
|
+
const PACKAGE = "@try-works/dsh-model-as-tool"
|
|
15
|
+
const SERVICE = "modelTools"
|
|
16
|
+
const NAMESPACE = "modelTools"
|
|
17
|
+
const INSTALL_WIRE_METHOD = "installExtension"
|
|
18
|
+
|
|
19
|
+
function parseModelToolsValue(schema, value) {
|
|
20
|
+
switch (schema.kind) {
|
|
21
|
+
case 'string':
|
|
22
|
+
if (typeof value !== 'string') throw new TypeError('expected a string')
|
|
23
|
+
return value
|
|
24
|
+
case 'boolean':
|
|
25
|
+
if (typeof value !== 'boolean') throw new TypeError('expected a boolean')
|
|
26
|
+
return value
|
|
27
|
+
case 'number':
|
|
28
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) throw new TypeError('expected a finite number')
|
|
29
|
+
return value
|
|
30
|
+
case 'null':
|
|
31
|
+
if (value !== null) throw new TypeError('expected null')
|
|
32
|
+
return null
|
|
33
|
+
case 'literal':
|
|
34
|
+
if (value !== schema.value) throw new TypeError('expected ' + JSON.stringify(schema.value))
|
|
35
|
+
return value
|
|
36
|
+
case 'optional':
|
|
37
|
+
return value === undefined ? undefined : parseModelToolsValue(schema.of, value)
|
|
38
|
+
case 'nullable':
|
|
39
|
+
return value === null ? null : parseModelToolsValue(schema.of, value)
|
|
40
|
+
case 'array':
|
|
41
|
+
if (!Array.isArray(value)) throw new TypeError('expected an array')
|
|
42
|
+
return value.map((item) => parseModelToolsValue(schema.of, item))
|
|
43
|
+
case 'record': {
|
|
44
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
45
|
+
throw new TypeError('expected a string-keyed record')
|
|
46
|
+
}
|
|
47
|
+
const parsed = {}
|
|
48
|
+
for (const [key, item] of Object.entries(value)) parsed[key] = parseModelToolsValue(schema.of, item)
|
|
49
|
+
return parsed
|
|
50
|
+
}
|
|
51
|
+
case 'object': {
|
|
52
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
53
|
+
throw new TypeError('expected an object')
|
|
54
|
+
}
|
|
55
|
+
const parsed = {}
|
|
56
|
+
for (const [key, field] of Object.entries(schema.fields)) {
|
|
57
|
+
const raw = value[key]
|
|
58
|
+
if (field.kind === 'optional') {
|
|
59
|
+
const item = parseModelToolsValue(field, raw)
|
|
60
|
+
if (item !== undefined) parsed[key] = item
|
|
61
|
+
continue
|
|
62
|
+
}
|
|
63
|
+
if (raw === undefined) throw new TypeError('missing field ' + JSON.stringify(key))
|
|
64
|
+
parsed[key] = parseModelToolsValue(field, raw)
|
|
65
|
+
}
|
|
66
|
+
return parsed
|
|
67
|
+
}
|
|
68
|
+
case 'union': {
|
|
69
|
+
let last
|
|
70
|
+
for (const variant of schema.of) {
|
|
71
|
+
try {
|
|
72
|
+
return parseModelToolsValue(variant, value)
|
|
73
|
+
} catch (error) {
|
|
74
|
+
last = error
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
throw new TypeError('value matched no union variant: ' + last.message)
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
throw new TypeError('unknown schema kind ' + JSON.stringify(schema.kind))
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function codecForModelToolsValue(typeSymbol, schema) {
|
|
85
|
+
let parser
|
|
86
|
+
return {
|
|
87
|
+
mode: 'strict',
|
|
88
|
+
typeSymbol,
|
|
89
|
+
create: () => (parser ??= { parse: (value) => parseModelToolsValue(schema, value) }),
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function descriptorsFromModelToolsSpecs(packageName, serviceKey, namespace, specs) {
|
|
94
|
+
return specs.map((spec) => {
|
|
95
|
+
const descriptor = {
|
|
96
|
+
id: packageName + '#' + namespace + '/' + spec.method,
|
|
97
|
+
service: serviceKey,
|
|
98
|
+
namespace,
|
|
99
|
+
method: spec.method,
|
|
100
|
+
description: spec.description,
|
|
101
|
+
invocation: { kind: 'direct' },
|
|
102
|
+
parameters: spec.parameters.map((parameter) => {
|
|
103
|
+
const entry = {
|
|
104
|
+
name: parameter.name,
|
|
105
|
+
wire: parameter.wire,
|
|
106
|
+
source: 'json',
|
|
107
|
+
codec: codecForModelToolsValue(parameter.typeSymbol, parameter.schema),
|
|
108
|
+
strictCodec: codecForModelToolsValue(parameter.strictTypeSymbol, parameter.schema),
|
|
109
|
+
}
|
|
110
|
+
if (parameter.description !== undefined) entry.description = parameter.description
|
|
111
|
+
if (parameter.acceptsUndefined === true) entry.acceptsUndefined = true
|
|
112
|
+
return entry
|
|
113
|
+
}),
|
|
114
|
+
cancellation: { parameter: 'signal' },
|
|
115
|
+
result: {
|
|
116
|
+
mode: 'strict',
|
|
117
|
+
typeSymbol: spec.result.typeSymbol,
|
|
118
|
+
create: codecForModelToolsValue(spec.result.typeSymbol, spec.result.schema).create,
|
|
119
|
+
description: spec.result.description,
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
if (spec.implementation !== undefined) descriptor.implementation = spec.implementation
|
|
123
|
+
return descriptor
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const METHOD_SPECS = [
|
|
128
|
+
{
|
|
129
|
+
"method": "describe",
|
|
130
|
+
"description": "Read the current extension state; the page calls it on mount and after each action.",
|
|
131
|
+
"parameters": [],
|
|
132
|
+
"result": {
|
|
133
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/describe:result",
|
|
134
|
+
"description": "the extension surface as the host currently sees it.",
|
|
135
|
+
"schema": {
|
|
136
|
+
"kind": "object",
|
|
137
|
+
"fields": {
|
|
138
|
+
"store": {
|
|
139
|
+
"kind": "nullable",
|
|
140
|
+
"of": {
|
|
141
|
+
"kind": "string"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"writable": {
|
|
145
|
+
"kind": "boolean"
|
|
146
|
+
},
|
|
147
|
+
"sourceDir": {
|
|
148
|
+
"kind": "nullable",
|
|
149
|
+
"of": {
|
|
150
|
+
"kind": "string"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"extensions": {
|
|
154
|
+
"kind": "array",
|
|
155
|
+
"of": {
|
|
156
|
+
"kind": "object",
|
|
157
|
+
"fields": {
|
|
158
|
+
"id": {
|
|
159
|
+
"kind": "string"
|
|
160
|
+
},
|
|
161
|
+
"package": {
|
|
162
|
+
"kind": "nullable",
|
|
163
|
+
"of": {
|
|
164
|
+
"kind": "string"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"version": {
|
|
168
|
+
"kind": "nullable",
|
|
169
|
+
"of": {
|
|
170
|
+
"kind": "string"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"installed": {
|
|
174
|
+
"kind": "boolean"
|
|
175
|
+
},
|
|
176
|
+
"active": {
|
|
177
|
+
"kind": "boolean"
|
|
178
|
+
},
|
|
179
|
+
"disabled": {
|
|
180
|
+
"kind": "boolean"
|
|
181
|
+
},
|
|
182
|
+
"integrity": {
|
|
183
|
+
"kind": "union",
|
|
184
|
+
"of": [
|
|
185
|
+
{
|
|
186
|
+
"kind": "literal",
|
|
187
|
+
"value": "unchanged"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"kind": "literal",
|
|
191
|
+
"value": "changed"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "literal",
|
|
195
|
+
"value": "unknown"
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"tools": {
|
|
200
|
+
"kind": "array",
|
|
201
|
+
"of": {
|
|
202
|
+
"kind": "string"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"reason": {
|
|
206
|
+
"kind": "nullable",
|
|
207
|
+
"of": {
|
|
208
|
+
"kind": "string"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"requirements": {
|
|
212
|
+
"kind": "optional",
|
|
213
|
+
"of": {
|
|
214
|
+
"kind": "array",
|
|
215
|
+
"of": {
|
|
216
|
+
"kind": "object",
|
|
217
|
+
"fields": {
|
|
218
|
+
"kind": {
|
|
219
|
+
"kind": "union",
|
|
220
|
+
"of": [
|
|
221
|
+
{
|
|
222
|
+
"kind": "literal",
|
|
223
|
+
"value": "store"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"kind": "literal",
|
|
227
|
+
"value": "source"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"kind": "literal",
|
|
231
|
+
"value": "dependencies"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"kind": "literal",
|
|
235
|
+
"value": "assets"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"kind": "literal",
|
|
239
|
+
"value": "executable"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"kind": "literal",
|
|
243
|
+
"value": "harness-model"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"kind": "literal",
|
|
247
|
+
"value": "platform"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"kind": "literal",
|
|
251
|
+
"value": "integrity"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"kind": "literal",
|
|
255
|
+
"value": "activation"
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
"satisfied": {
|
|
260
|
+
"kind": "boolean"
|
|
261
|
+
},
|
|
262
|
+
"reason": {
|
|
263
|
+
"kind": "string"
|
|
264
|
+
},
|
|
265
|
+
"action": {
|
|
266
|
+
"kind": "union",
|
|
267
|
+
"of": [
|
|
268
|
+
{
|
|
269
|
+
"kind": "literal",
|
|
270
|
+
"value": "install"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"kind": "literal",
|
|
274
|
+
"value": "prepare"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"kind": "literal",
|
|
278
|
+
"value": "enable"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"kind": "literal",
|
|
282
|
+
"value": "config"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"kind": "literal",
|
|
286
|
+
"value": "none"
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"blocked": {
|
|
295
|
+
"kind": "optional",
|
|
296
|
+
"of": {
|
|
297
|
+
"kind": "boolean"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"method": "installExtension",
|
|
309
|
+
"implementation": "install",
|
|
310
|
+
"description": "Install one extension from `source`, or the configured first-party source.",
|
|
311
|
+
"parameters": [
|
|
312
|
+
{
|
|
313
|
+
"name": "id",
|
|
314
|
+
"wire": "id",
|
|
315
|
+
"description": "the extension id, for example `@try-works/extension-laya`.",
|
|
316
|
+
"acceptsUndefined": false,
|
|
317
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/install:id",
|
|
318
|
+
"strictTypeSymbol": "@try-works/dsh-model-as-tool#modelTools/install:id",
|
|
319
|
+
"schema": {
|
|
320
|
+
"kind": "string"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"name": "source",
|
|
325
|
+
"wire": "source",
|
|
326
|
+
"description": "an explicit install directory; absent means the configured first-party source.",
|
|
327
|
+
"acceptsUndefined": true,
|
|
328
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/install:source",
|
|
329
|
+
"strictTypeSymbol": "@try-works/dsh-model-as-tool#modelTools/install:source",
|
|
330
|
+
"schema": {
|
|
331
|
+
"kind": "optional",
|
|
332
|
+
"of": {
|
|
333
|
+
"kind": "string"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
"result": {
|
|
339
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/install:result",
|
|
340
|
+
"description": "the installed extension; installation is not activation.",
|
|
341
|
+
"schema": {
|
|
342
|
+
"kind": "object",
|
|
343
|
+
"fields": {
|
|
344
|
+
"id": {
|
|
345
|
+
"kind": "string"
|
|
346
|
+
},
|
|
347
|
+
"version": {
|
|
348
|
+
"kind": "string"
|
|
349
|
+
},
|
|
350
|
+
"active": {
|
|
351
|
+
"kind": "boolean"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"method": "enable",
|
|
359
|
+
"description": "Activate an installed extension (removes it from `disabledExtensions`).",
|
|
360
|
+
"parameters": [
|
|
361
|
+
{
|
|
362
|
+
"name": "id",
|
|
363
|
+
"wire": "id",
|
|
364
|
+
"description": "the extension id to activate.",
|
|
365
|
+
"acceptsUndefined": false,
|
|
366
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/enable:id",
|
|
367
|
+
"strictTypeSymbol": "@try-works/dsh-model-as-tool#modelTools/enable:id",
|
|
368
|
+
"schema": {
|
|
369
|
+
"kind": "string"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
"result": {
|
|
374
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/enable:result",
|
|
375
|
+
"description": "the extension state after activation.",
|
|
376
|
+
"schema": {
|
|
377
|
+
"kind": "object",
|
|
378
|
+
"fields": {
|
|
379
|
+
"id": {
|
|
380
|
+
"kind": "string"
|
|
381
|
+
},
|
|
382
|
+
"active": {
|
|
383
|
+
"kind": "boolean"
|
|
384
|
+
},
|
|
385
|
+
"disabled": {
|
|
386
|
+
"kind": "boolean"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"method": "disable",
|
|
394
|
+
"description": "Deactivate an extension (adds it to `disabledExtensions`).",
|
|
395
|
+
"parameters": [
|
|
396
|
+
{
|
|
397
|
+
"name": "id",
|
|
398
|
+
"wire": "id",
|
|
399
|
+
"description": "the extension id to deactivate.",
|
|
400
|
+
"acceptsUndefined": false,
|
|
401
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/disable:id",
|
|
402
|
+
"strictTypeSymbol": "@try-works/dsh-model-as-tool#modelTools/disable:id",
|
|
403
|
+
"schema": {
|
|
404
|
+
"kind": "string"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
"result": {
|
|
409
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/disable:result",
|
|
410
|
+
"description": "the extension state after deactivation.",
|
|
411
|
+
"schema": {
|
|
412
|
+
"kind": "object",
|
|
413
|
+
"fields": {
|
|
414
|
+
"id": {
|
|
415
|
+
"kind": "string"
|
|
416
|
+
},
|
|
417
|
+
"active": {
|
|
418
|
+
"kind": "boolean"
|
|
419
|
+
},
|
|
420
|
+
"disabled": {
|
|
421
|
+
"kind": "boolean"
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"method": "prepare",
|
|
429
|
+
"description": "Acquire and verify the installed extension's model assets, then record the readiness a following enable needs.",
|
|
430
|
+
"parameters": [
|
|
431
|
+
{
|
|
432
|
+
"name": "id",
|
|
433
|
+
"wire": "id",
|
|
434
|
+
"description": "the installed extension id to prepare.",
|
|
435
|
+
"acceptsUndefined": false,
|
|
436
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/prepare:id",
|
|
437
|
+
"strictTypeSymbol": "@try-works/dsh-model-as-tool#modelTools/prepare:id",
|
|
438
|
+
"schema": {
|
|
439
|
+
"kind": "string"
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"result": {
|
|
444
|
+
"typeSymbol": "@try-works/dsh-model-as-tool#modelTools/prepare:result",
|
|
445
|
+
"description": "the preparation outcome, its RES-02 disclosure, and the readiness recorded for each declared model.",
|
|
446
|
+
"schema": {
|
|
447
|
+
"kind": "object",
|
|
448
|
+
"fields": {
|
|
449
|
+
"id": {
|
|
450
|
+
"kind": "string"
|
|
451
|
+
},
|
|
452
|
+
"prepared": {
|
|
453
|
+
"kind": "boolean"
|
|
454
|
+
},
|
|
455
|
+
"reason": {
|
|
456
|
+
"kind": "nullable",
|
|
457
|
+
"of": {
|
|
458
|
+
"kind": "string"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"plan": {
|
|
462
|
+
"kind": "nullable",
|
|
463
|
+
"of": {
|
|
464
|
+
"kind": "object",
|
|
465
|
+
"fields": {
|
|
466
|
+
"modelId": {
|
|
467
|
+
"kind": "string"
|
|
468
|
+
},
|
|
469
|
+
"modelRevision": {
|
|
470
|
+
"kind": "string"
|
|
471
|
+
},
|
|
472
|
+
"assets": {
|
|
473
|
+
"kind": "array",
|
|
474
|
+
"of": {
|
|
475
|
+
"kind": "object",
|
|
476
|
+
"fields": {
|
|
477
|
+
"assetId": {
|
|
478
|
+
"kind": "string"
|
|
479
|
+
},
|
|
480
|
+
"bytes": {
|
|
481
|
+
"kind": "number"
|
|
482
|
+
},
|
|
483
|
+
"source": {
|
|
484
|
+
"kind": "string"
|
|
485
|
+
},
|
|
486
|
+
"executable": {
|
|
487
|
+
"kind": "boolean"
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"totalBytes": {
|
|
493
|
+
"kind": "number"
|
|
494
|
+
},
|
|
495
|
+
"storageBytes": {
|
|
496
|
+
"kind": "number"
|
|
497
|
+
},
|
|
498
|
+
"requiresExecutableApproval": {
|
|
499
|
+
"kind": "boolean"
|
|
500
|
+
},
|
|
501
|
+
"license": {
|
|
502
|
+
"kind": "object",
|
|
503
|
+
"fields": {
|
|
504
|
+
"name": {
|
|
505
|
+
"kind": "string"
|
|
506
|
+
},
|
|
507
|
+
"url": {
|
|
508
|
+
"kind": "string"
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
"readiness": {
|
|
516
|
+
"kind": "record",
|
|
517
|
+
"of": {
|
|
518
|
+
"kind": "union",
|
|
519
|
+
"of": [
|
|
520
|
+
{
|
|
521
|
+
"kind": "literal",
|
|
522
|
+
"value": "unavailable"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"kind": "literal",
|
|
526
|
+
"value": "needs-preparation"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"kind": "literal",
|
|
530
|
+
"value": "preparing"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"kind": "literal",
|
|
534
|
+
"value": "prepared-cold"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"kind": "literal",
|
|
538
|
+
"value": "loading"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"kind": "literal",
|
|
542
|
+
"value": "ready"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"kind": "literal",
|
|
546
|
+
"value": "busy"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"kind": "literal",
|
|
550
|
+
"value": "failed"
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
"groups": {
|
|
556
|
+
"kind": "array",
|
|
557
|
+
"of": {
|
|
558
|
+
"kind": "string"
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
"activationReady": {
|
|
562
|
+
"kind": "boolean"
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
]
|
|
569
|
+
|
|
570
|
+
const contribution = {
|
|
571
|
+
package: PACKAGE,
|
|
572
|
+
descriptors: descriptorsFromModelToolsSpecs(PACKAGE, SERVICE, NAMESPACE, METHOD_SPECS),
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Mount the contribution in the calling client plugin's fiber.
|
|
577
|
+
* @param ctx - the client Cordis context whose Remote service is available.
|
|
578
|
+
* @returns null when this Host/assembly has no Client Remote service, else
|
|
579
|
+
* the Remote service and the namespace disposer.
|
|
580
|
+
*/
|
|
581
|
+
async function mount(ctx) {
|
|
582
|
+
const remote = typeof ctx?.get === 'function' ? ctx.get('remote') : undefined
|
|
583
|
+
if (remote === undefined || remote === null || typeof remote.$mount !== 'function') return null
|
|
584
|
+
const dispose = await remote.$mount(contribution)
|
|
585
|
+
return { remote, dispose }
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
exports.contribution = contribution
|
|
589
|
+
exports.mount = mount
|
|
590
|
+
return module.exports
|
|
591
|
+
},
|
|
592
|
+
})
|