@7n/tauri-components 0.10.1 → 0.11.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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/components/AgentDialog.vue +21 -46
- package/src/components/AuditDialog.vue +9 -17
- package/src/components/BaseDialog.vue +2 -6
- package/src/components/DialogActions.vue +2 -3
- package/src/components/RequestView.vue +2 -3
- package/src/components/StatePill.vue +1 -1
- package/src/components/docs/AgentDialog.md +4 -4
- package/src/components/docs/index.md +4 -4
- package/src/components/index.js +2 -2
- package/src/components/status.js +1 -1
- package/src/core/acp-agent-presets.js +2 -2
- package/src/core/acp-agent.js +21 -15
- package/src/core/acp-kit.js +79 -30
- package/src/core/dispatch.js +3 -3
- package/src/core/docs/acp-agent.md +4 -4
- package/src/core/docs/acp-kit.md +4 -4
- package/src/core/manifest.js +10 -8
- package/src/docs/index.md +4 -4
- package/src/index.js +3 -8
- package/src/testing/quasar.js +2 -2
- package/src/vue/docs/index.md +4 -4
- package/src/vue/docs/journal-store-tauri.md +4 -4
- package/src/vue/docs/use-acp-agent.md +4 -4
- package/src/vue/index.js +4 -6
- package/src/vue/journal-store-tauri.js +2 -2
- package/src/vue/use-acp-agent.js +22 -14
- package/src/vue/use-updater.js +4 -6
- package/types/core/dispatch.d.ts +5 -2
- package/types/core/manifest.d.ts +14 -9
- package/types/core/scope.d.ts +24 -11
- package/types/core/tools.d.ts +1 -1
- package/types/index.d.ts +4 -9
- package/src/core/agent-handler.js +0 -171
- package/src/core/agent-kit.js +0 -43
- package/src/core/docs/agent-handler.md +0 -31
- package/src/core/docs/agent-kit.md +0 -25
- package/src/core/docs/llm.md +0 -29
- package/src/core/docs/omlx-models.md +0 -30
- package/src/core/docs/resolve-omlx-base-url.md +0 -40
- package/src/core/llm.js +0 -90
- package/src/core/omlx-models.js +0 -34
- package/src/core/resolve-omlx-base-url.js +0 -84
- package/src/vue/docs/use-agent.md +0 -29
- package/src/vue/docs/use-omlx.md +0 -30
- package/src/vue/use-agent.js +0 -60
- package/src/vue/use-omlx.js +0 -102
- package/types/core/agent-handler.d.ts +0 -43
- package/types/core/agent-kit.d.ts +0 -30
- package/types/core/llm.d.ts +0 -52
- package/types/core/omlx-models.d.ts +0 -17
- package/types/core/resolve-omlx-base-url.d.ts +0 -42
package/src/core/dispatch.js
CHANGED
|
@@ -20,7 +20,8 @@ export function validateInput(tool, input) {
|
|
|
20
20
|
continue
|
|
21
21
|
}
|
|
22
22
|
if (spec.type === 'string' && typeof value !== 'string') return `Field "${key}" must be a string`
|
|
23
|
-
if (spec.type === 'object' && (typeof value !== 'object' || Array.isArray(value)))
|
|
23
|
+
if (spec.type === 'object' && (typeof value !== 'object' || Array.isArray(value)))
|
|
24
|
+
return `Field "${key}" must be an object`
|
|
24
25
|
}
|
|
25
26
|
return tool.validate ? tool.validate(data) : null
|
|
26
27
|
}
|
|
@@ -42,8 +43,7 @@ export function createDispatch(catalog, transport) {
|
|
|
42
43
|
try {
|
|
43
44
|
const output = await transport(tool, input ?? {})
|
|
44
45
|
return { ok: true, output }
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
46
|
+
} catch (error) {
|
|
47
47
|
const envelope = { code: 'io', message: String(error?.message ?? error) }
|
|
48
48
|
// Preserve a backend-provided error kind (e.g. a typed Tauri command error)
|
|
49
49
|
// so callers can branch on it — e.g. re-auth on a 'ReauthRequired' kind.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: acp-agent.js
|
|
4
|
+
resource: npm/src/core/acp-agent.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: e30fb954
|
|
6
|
+
crc: a9f48a2c
|
|
5
7
|
model: omlx/gemma-4-e4b-it-OptiQ-4bit
|
|
6
8
|
score: 100
|
|
7
9
|
issues: judge:inaccurate:0.98
|
|
8
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
# acp-agent.js
|
|
12
|
-
|
|
13
13
|
## Огляд
|
|
14
14
|
|
|
15
15
|
Модуль керує життєвим циклом сесій агента ACP. Він дозволяє ініціалізувати сесії за допомогою `createAcpSession`, виконувати ходи промпта через `runAcpTurn` та скасовувати сесії за допомогою `cancelAcpSession`. Модуль встановлює мережевий зв'язок через <http://127.0.0.1:54321/> та ініціалізує MCP-міст за допомогою `startAcpMcpBridge`. Він реєструє інструменти та обробляє запити на виклики інструментів через `onAcpToolCall` та відповіді на них через `respondAcpToolCall`. Модуль також обробляє запити на дозволи через `onAcpPermissionRequest` та надає відповіді за допомогою `respondAcpPermission`. Модуль надає конфігурацію типу агента за допомогою `acpConfig`. Усі помилки перехоплюються (fail-safe), і винятки не викидаються назовні.
|
package/src/core/docs/acp-kit.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: acp-kit.js
|
|
4
|
+
resource: npm/src/core/acp-kit.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: caab4cf6
|
|
6
|
+
crc: 7838ed4e
|
|
5
7
|
model: omlx/gemma-4-e4b-it-OptiQ-4bit
|
|
6
8
|
score: 100
|
|
7
9
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
8
10
|
---
|
|
9
11
|
|
|
10
|
-
# acp-kit.js
|
|
11
|
-
|
|
12
12
|
## Огляд
|
|
13
13
|
|
|
14
14
|
Модуль ініціалізує агента та керує життєвим циклом його запитів. Функція `createAcpAgentKit` створює агента на основі заданих компонентів. Модуль дозволяє розпочинати нові запити, продовжувати активні сесії або вирішувати відкладені питання, такі як виклики інструментів чи запити на дозвіл.
|
package/src/core/manifest.js
CHANGED
|
@@ -24,14 +24,16 @@ export function toJsonSchema(input) {
|
|
|
24
24
|
* @returns {object[]} OpenAI `tools` array
|
|
25
25
|
*/
|
|
26
26
|
export function toolManifest(catalog, allow = () => true) {
|
|
27
|
-
return catalog
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
return catalog
|
|
28
|
+
.filter(tool => allow(tool))
|
|
29
|
+
.map(tool => ({
|
|
30
|
+
type: 'function',
|
|
31
|
+
function: {
|
|
32
|
+
name: tool.name,
|
|
33
|
+
description: tool.summary,
|
|
34
|
+
parameters: toJsonSchema(tool.input)
|
|
35
|
+
}
|
|
36
|
+
}))
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/**
|
package/src/docs/index.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: index.js
|
|
4
|
+
resource: npm/src/index.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: 60cbbdaf
|
|
6
|
+
crc: 4c44e807
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
# index.js
|
|
8
|
-
|
|
9
9
|
## Огляд
|
|
10
10
|
|
|
11
11
|
Модуль керує життєвим циклом агента, охоплюючи етапи ініціалізації, виконання та завершення роботи. Він відповідає за налаштування конфігурації, реєстрацію обробників запитів та інструментів. Модуль ініціалізує сесії та забезпечує взаємодію агента з зовнішніми системами, такими як MCP та Omlx, використовуючи лише дані, які є read-only.
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// `@7n/tauri-components` — core (no Vue). The agent
|
|
2
|
-
//
|
|
1
|
+
// `@7n/tauri-components` — core (no Vue). The ACP agent kit and the tool
|
|
2
|
+
// surface it binds to an app catalog. Import this entry from headless
|
|
3
3
|
// consumers (CLI orchestrators, MCP wrappers); the Vue/Quasar layers live under
|
|
4
4
|
// the ./vue and ./components subpaths.
|
|
5
5
|
|
|
@@ -12,16 +12,11 @@ export {
|
|
|
12
12
|
respondAcpPermission,
|
|
13
13
|
respondAcpToolCall,
|
|
14
14
|
runAcpTurn,
|
|
15
|
-
startAcpMcpBridge
|
|
15
|
+
startAcpMcpBridge
|
|
16
16
|
} from './core/acp-agent.js'
|
|
17
17
|
export { CODEX_ACP_AGENT_PRESET } from './core/acp-agent-presets.js'
|
|
18
18
|
export { createAcpAgentKit } from './core/acp-kit.js'
|
|
19
|
-
export { createAgentKit } from './core/agent-kit.js'
|
|
20
|
-
export { handleApprove, handleRequest, handleRespond } from './core/agent-handler.js'
|
|
21
19
|
export { createDispatch, validateInput } from './core/dispatch.js'
|
|
22
|
-
export { createOpenAiChat, runAgent } from './core/llm.js'
|
|
23
|
-
export { listOmlxModels, resolveModel } from './core/omlx-models.js'
|
|
24
|
-
export { DIRECT_OMLX_BASE_URL, isDirectOmlxUrl, PROXY_OMLX_BASE_URL, resolveOmlxBaseUrl, resolveOmlxBaseUrlCached } from './core/resolve-omlx-base-url.js'
|
|
25
20
|
export { listTools, toJsonSchema, toolManifest } from './core/manifest.js'
|
|
26
21
|
export { classify, DEFAULT_ACTOR_TIERS, scopedManifest, scopedToolNames } from './core/scope.js'
|
|
27
22
|
export { getTool } from './core/tools.js'
|
package/src/testing/quasar.js
CHANGED
|
@@ -18,7 +18,7 @@ function quasarGlobal(userGlobal = {}) {
|
|
|
18
18
|
return {
|
|
19
19
|
...userGlobal,
|
|
20
20
|
components: { ...quasarComponents, ...userGlobal.components },
|
|
21
|
-
plugins: [...(userGlobal.plugins || []), [Quasar.Quasar, { config: { dark: false } }]]
|
|
21
|
+
plugins: [...(userGlobal.plugins || []), [Quasar.Quasar, { config: { dark: false } }]]
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -42,7 +42,7 @@ export function mountWithQuasar(component, options = {}) {
|
|
|
42
42
|
const wrapper = {
|
|
43
43
|
render() {
|
|
44
44
|
return h(Quasar.QLayout, { view: 'hHh lpR fFf' }, () => h(Quasar.QPageContainer, () => h(component)))
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
return mount(wrapper, { ...options, global: quasarGlobal(options.global) })
|
|
48
48
|
}
|
package/src/vue/docs/index.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: index.js
|
|
4
|
+
resource: npm/src/vue/index.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: ac7a549c
|
|
6
|
+
crc: ae0b9450
|
|
5
7
|
model: omlx/gemma-4-e4b-it-OptiQ-4bit
|
|
6
8
|
score: 100
|
|
7
9
|
issues: judge:inaccurate:0.98
|
|
8
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
# index.js
|
|
12
|
-
|
|
13
13
|
## Огляд
|
|
14
14
|
|
|
15
15
|
Цей файл є центральною точкою взаємодії системи. Він забезпечує механізми для комунікації з агентом ACP, загальним агентом та протоколом OMLX. Він створює сховище журналу, використовуючи механізми Tauri, та надає об'єкт для транспортування даних.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: journal-store-tauri.js
|
|
4
|
+
resource: npm/src/vue/journal-store-tauri.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: 6356740d
|
|
6
|
+
crc: be2482bb
|
|
5
7
|
model: omlx/gemma-4-e4b-it-OptiQ-4bit
|
|
6
8
|
score: 100
|
|
7
9
|
issues: judge:inaccurate:0.99
|
|
8
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
# journal-store-tauri.js
|
|
12
|
-
|
|
13
13
|
## Огляд
|
|
14
14
|
|
|
15
15
|
Цей модуль керує доступом до механізму журналу. Він дозволяє створювати сховище журналу та отримувати повний список існуючих записів.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
type: JS Module
|
|
3
|
+
title: use-acp-agent.js
|
|
4
|
+
resource: npm/src/vue/use-acp-agent.js
|
|
2
5
|
docgen:
|
|
3
|
-
|
|
4
|
-
crc: 227f9b8b
|
|
6
|
+
crc: 0477b0ca
|
|
5
7
|
model: omlx/gemma-4-e4b-it-OptiQ-4bit
|
|
6
8
|
score: 100
|
|
7
9
|
issues: judge:inaccurate:0.97
|
|
8
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
# use-acp-agent.js
|
|
12
|
-
|
|
13
13
|
## Огляд
|
|
14
14
|
|
|
15
15
|
Модуль ініціалізує шлюз агента та налаштовує доменне мостове з'єднання MCP, якщо каталог доступний. Він звертається до мережі для відправки запитів до агента. Публічна функція `useAcpAgent` використовується для передачі намірів агенту, що дозволяє оновлювати рівень моделі. Після цього модуль надає відповідь та схвалює запит. Цей модуль є Read-only і не виконує записів у файлову систему чи бази даних.
|
package/src/vue/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
// `@7n/tauri-components/vue` — Vue + Tauri composables. Wires the core
|
|
2
|
-
// to the webview (
|
|
3
|
-
// Requires the host app to provide vue +
|
|
4
|
-
// tauri-plugin-agent backend commands.
|
|
1
|
+
// `@7n/tauri-components/vue` — Vue + Tauri composables. Wires the core ACP
|
|
2
|
+
// agent kit to the webview (spawns codex/claude/cursor/pi via Tauri invoke,
|
|
3
|
+
// tools/journal over Tauri invoke). Requires the host app to provide vue +
|
|
4
|
+
// @tauri-apps/* (peer deps) and the tauri-plugin-agent backend commands.
|
|
5
5
|
|
|
6
6
|
export { useAcpAgent } from './use-acp-agent.js'
|
|
7
|
-
export { useAgent } from './use-agent.js'
|
|
8
|
-
export { useOmlx } from './use-omlx.js'
|
|
9
7
|
export { useUpdater } from './use-updater.js'
|
|
10
8
|
export { createTauriJournalStore } from './journal-store-tauri.js'
|
|
11
9
|
export { tauriTransport } from './transports.js'
|
|
@@ -2,7 +2,7 @@ import { invoke } from '@tauri-apps/api/core'
|
|
|
2
2
|
|
|
3
3
|
// Webview journal store: routes journal FS through the shared `tauri-plugin-agent`
|
|
4
4
|
// commands (`plugin:agent|journal_*`, see SPEC §6). Same shape any other store
|
|
5
|
-
// implements, so
|
|
5
|
+
// implements, so createAcpAgentKit stays backend-agnostic. The host app must
|
|
6
6
|
// register the plugin and grant `agent:default`.
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -13,6 +13,6 @@ export function createTauriJournalStore() {
|
|
|
13
13
|
create: ({ intent, actor }) => invoke('plugin:agent|journal_create', { intent, actor }),
|
|
14
14
|
load: id => invoke('plugin:agent|journal_load', { id }),
|
|
15
15
|
update: (id, patch) => invoke('plugin:agent|journal_update', { id, patch }),
|
|
16
|
-
list: () => invoke('plugin:agent|journal_list')
|
|
16
|
+
list: () => invoke('plugin:agent|journal_list')
|
|
17
17
|
}
|
|
18
18
|
}
|
package/src/vue/use-acp-agent.js
CHANGED
|
@@ -4,9 +4,10 @@ import { createAcpAgentKit } from '../core/acp-kit.js'
|
|
|
4
4
|
import { createTauriJournalStore } from './journal-store-tauri.js'
|
|
5
5
|
import { tauriTransport } from './transports.js'
|
|
6
6
|
|
|
7
|
-
// In-app ACP agent gateway — the
|
|
8
|
-
//
|
|
9
|
-
// createAcpAgentKit and resolves two independent defaults per
|
|
7
|
+
// In-app ACP agent gateway — the sole agent composable (the earlier
|
|
8
|
+
// omlx/runAgent-based `useAgent()` has been removed; see CHANGELOG). Binds an
|
|
9
|
+
// app's catalog to createAcpAgentKit and resolves two independent defaults per
|
|
10
|
+
// SPEC/plan:
|
|
10
11
|
//
|
|
11
12
|
// - which AGENT (codex/claude/cursor/pi) — per-machine, from `ACP_DEFAULT_AGENT`
|
|
12
13
|
// (via `acp_config()`), since different developers have different CLIs
|
|
@@ -17,8 +18,7 @@ import { tauriTransport } from './transports.js'
|
|
|
17
18
|
// (`request(intent, { modelTier: 'MAX' })`); otherwise `defaultTier` applies.
|
|
18
19
|
//
|
|
19
20
|
// The domain MCP bridge is started once (`loadEnv()`) and its URL is reused
|
|
20
|
-
// for every spawned session
|
|
21
|
-
// omlx base URL once and reuses it.
|
|
21
|
+
// for every spawned session.
|
|
22
22
|
|
|
23
23
|
const DEFAULT_TIER = 'AVG'
|
|
24
24
|
|
|
@@ -32,7 +32,14 @@ const DEFAULT_TIER = 'AVG'
|
|
|
32
32
|
* @param {(tool: object, input: object) => unknown} [config.transport] tool transport (default Tauri invoke)
|
|
33
33
|
* @returns {object} in-app ACP agent gateway
|
|
34
34
|
*/
|
|
35
|
-
export function useAcpAgent({
|
|
35
|
+
export function useAcpAgent({
|
|
36
|
+
catalog,
|
|
37
|
+
agents = {},
|
|
38
|
+
defaultTier = DEFAULT_TIER,
|
|
39
|
+
cwd,
|
|
40
|
+
actorTiers,
|
|
41
|
+
transport = tauriTransport
|
|
42
|
+
} = {}) {
|
|
36
43
|
const defaultAgentKind = ref(null)
|
|
37
44
|
const agentKind = ref(null)
|
|
38
45
|
const modelTier = ref(defaultTier)
|
|
@@ -51,9 +58,9 @@ export function useAcpAgent({ catalog, agents = {}, defaultTier = DEFAULT_TIER,
|
|
|
51
58
|
const configuredKinds = Object.keys(agents)
|
|
52
59
|
try {
|
|
53
60
|
const cfg = await acpConfig()
|
|
54
|
-
defaultAgentKind.value =
|
|
55
|
-
|
|
56
|
-
catch {
|
|
61
|
+
defaultAgentKind.value =
|
|
62
|
+
cfg.defaultAgentKind && agents[cfg.defaultAgentKind] ? cfg.defaultAgentKind : (configuredKinds[0] ?? null)
|
|
63
|
+
} catch {
|
|
57
64
|
defaultAgentKind.value = configuredKinds[0] ?? null
|
|
58
65
|
}
|
|
59
66
|
if (!agentKind.value) agentKind.value = defaultAgentKind.value
|
|
@@ -61,8 +68,7 @@ export function useAcpAgent({ catalog, agents = {}, defaultTier = DEFAULT_TIER,
|
|
|
61
68
|
if (catalog?.length) {
|
|
62
69
|
try {
|
|
63
70
|
mcpBridgeUrl.value = await startAcpMcpBridge(catalog)
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
71
|
+
} catch {
|
|
66
72
|
mcpBridgeUrl.value = null
|
|
67
73
|
}
|
|
68
74
|
}
|
|
@@ -82,7 +88,7 @@ export function useAcpAgent({ catalog, agents = {}, defaultTier = DEFAULT_TIER,
|
|
|
82
88
|
args: [...(preset.args ?? []), ...(tier?.args ?? [])],
|
|
83
89
|
env: { ...preset.env, ...tier?.env },
|
|
84
90
|
cwd,
|
|
85
|
-
mcpBridgeUrl: mcpBridgeUrl.value ?? undefined
|
|
91
|
+
mcpBridgeUrl: mcpBridgeUrl.value ?? undefined
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
|
|
@@ -91,7 +97,9 @@ export function useAcpAgent({ catalog, agents = {}, defaultTier = DEFAULT_TIER,
|
|
|
91
97
|
modelTier,
|
|
92
98
|
defaultAgentKind,
|
|
93
99
|
availableAgentKinds: computed(() => Object.keys(agents)),
|
|
94
|
-
availableTiers: computed(() =>
|
|
100
|
+
availableTiers: computed(() =>
|
|
101
|
+
Object.entries(agents[agentKind.value]?.tiers ?? {}).map(([id, t]) => ({ id, label: t.label ?? id }))
|
|
102
|
+
),
|
|
95
103
|
loadEnv,
|
|
96
104
|
journal,
|
|
97
105
|
/**
|
|
@@ -104,6 +112,6 @@ export function useAcpAgent({ catalog, agents = {}, defaultTier = DEFAULT_TIER,
|
|
|
104
112
|
return kit.request({ intent, agent: resolveSpawnArgs() })
|
|
105
113
|
},
|
|
106
114
|
respond: (requestId, message) => kit.respond({ requestId, message }),
|
|
107
|
-
approve: (requestId, approve) => kit.approve({ requestId, approve })
|
|
115
|
+
approve: (requestId, approve) => kit.approve({ requestId, approve })
|
|
108
116
|
}
|
|
109
117
|
}
|
package/src/vue/use-updater.js
CHANGED
|
@@ -45,14 +45,13 @@ export function useUpdater() {
|
|
|
45
45
|
message: `Версія ${update.version} готова. Встановити зараз?`,
|
|
46
46
|
cancel: { label: 'Пізніше', flat: true },
|
|
47
47
|
ok: { label: 'Встановити', color: 'primary' },
|
|
48
|
-
persistent: true
|
|
48
|
+
persistent: true
|
|
49
49
|
})
|
|
50
50
|
.onOk(() => installAndRelaunch(update))
|
|
51
51
|
.onCancel(() => {
|
|
52
52
|
busy = false
|
|
53
53
|
})
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
54
|
+
} catch (error) {
|
|
56
55
|
// No network, or the updater isn't configured/permitted — don't bother
|
|
57
56
|
// the user, but leave a trace for diagnosis.
|
|
58
57
|
console.error('[updater] check failed:', error)
|
|
@@ -94,10 +93,9 @@ export function useUpdater() {
|
|
|
94
93
|
message: `Перезапустити зараз, щоб перейти на версію ${update.version}?`,
|
|
95
94
|
cancel: { label: 'Пізніше', flat: true },
|
|
96
95
|
ok: { label: 'Перезапустити', color: 'primary' },
|
|
97
|
-
persistent: true
|
|
96
|
+
persistent: true
|
|
98
97
|
}).onOk(() => relaunch())
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
98
|
+
} catch (error) {
|
|
101
99
|
dismiss()
|
|
102
100
|
busy = false
|
|
103
101
|
console.error('[updater] install failed:', error)
|
package/types/core/dispatch.d.ts
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* @param {object} [input] candidate input
|
|
5
5
|
* @returns {string|null} error message, or null when valid
|
|
6
6
|
*/
|
|
7
|
-
export function validateInput(tool: object, input?: object): string | null
|
|
7
|
+
export function validateInput(tool: object, input?: object): string | null
|
|
8
8
|
/**
|
|
9
9
|
* Build a dispatch function bound to a catalog and a transport.
|
|
10
10
|
* @param {object[]} catalog tool definitions
|
|
11
11
|
* @param {(tool: object, input: object) => unknown} transport runs the tool's backend call
|
|
12
12
|
* @returns {(name: string, input?: object) => Promise<object>} dispatch returning an envelope
|
|
13
13
|
*/
|
|
14
|
-
export function createDispatch(
|
|
14
|
+
export function createDispatch(
|
|
15
|
+
catalog: object[],
|
|
16
|
+
transport: (tool: object, input: object) => unknown
|
|
17
|
+
): (name: string, input?: object) => Promise<object>
|
package/types/core/manifest.d.ts
CHANGED
|
@@ -3,24 +3,29 @@
|
|
|
3
3
|
* @param {Record<string, {type: string, required?: boolean, description?: string}>} input tool input spec
|
|
4
4
|
* @returns {object} JSON Schema for the parameters object
|
|
5
5
|
*/
|
|
6
|
-
export function toJsonSchema(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export function toJsonSchema(
|
|
7
|
+
input: Record<
|
|
8
|
+
string,
|
|
9
|
+
{
|
|
10
|
+
type: string
|
|
11
|
+
required?: boolean
|
|
12
|
+
description?: string
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
): object
|
|
11
16
|
/**
|
|
12
17
|
* OpenAI function-calling tool definitions, optionally filtered (e.g. by scope).
|
|
13
18
|
* @param {object[]} catalog tool definitions
|
|
14
19
|
* @param {(tool: object) => boolean} [allow] predicate; default includes all tools
|
|
15
20
|
* @returns {object[]} OpenAI `tools` array
|
|
16
21
|
*/
|
|
17
|
-
export function toolManifest(catalog: object[], allow?: (tool: object) => boolean): object[]
|
|
22
|
+
export function toolManifest(catalog: object[], allow?: (tool: object) => boolean): object[]
|
|
18
23
|
/**
|
|
19
24
|
* Compact catalog listing (name + summary).
|
|
20
25
|
* @param {object[]} catalog tool definitions
|
|
21
26
|
* @returns {{name: string, summary: string}[]} tool list
|
|
22
27
|
*/
|
|
23
28
|
export function listTools(catalog: object[]): {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}[]
|
|
29
|
+
name: string
|
|
30
|
+
summary: string
|
|
31
|
+
}[]
|
package/types/core/scope.d.ts
CHANGED
|
@@ -6,9 +6,14 @@
|
|
|
6
6
|
* @param {string} toolName tool name
|
|
7
7
|
* @returns {'allow'|'approval'|'deny'} decision
|
|
8
8
|
*/
|
|
9
|
-
export function classify(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export function classify(
|
|
10
|
+
catalog: object[],
|
|
11
|
+
actorTiers: Record<string, number> | undefined,
|
|
12
|
+
actor: {
|
|
13
|
+
kind?: string
|
|
14
|
+
},
|
|
15
|
+
toolName: string
|
|
16
|
+
): 'allow' | 'approval' | 'deny'
|
|
12
17
|
/**
|
|
13
18
|
* LLM tool manifest visible to the actor (everything it may run OR request approval for).
|
|
14
19
|
* @param {object[]} catalog tool definitions
|
|
@@ -16,9 +21,13 @@ export function classify(catalog: object[], actorTiers: Record<string, number> |
|
|
|
16
21
|
* @param {{ kind?: string }} actor caller identity
|
|
17
22
|
* @returns {object[]} OpenAI tools array
|
|
18
23
|
*/
|
|
19
|
-
export function scopedManifest(
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
export function scopedManifest(
|
|
25
|
+
catalog: object[],
|
|
26
|
+
actorTiers: Record<string, number> | undefined,
|
|
27
|
+
actor: {
|
|
28
|
+
kind?: string
|
|
29
|
+
}
|
|
30
|
+
): object[]
|
|
22
31
|
/**
|
|
23
32
|
* Tool names visible to the actor.
|
|
24
33
|
* @param {object[]} catalog tool definitions
|
|
@@ -26,10 +35,14 @@ export function scopedManifest(catalog: object[], actorTiers: Record<string, num
|
|
|
26
35
|
* @param {{ kind?: string }} actor caller identity
|
|
27
36
|
* @returns {string[]} visible tool names
|
|
28
37
|
*/
|
|
29
|
-
export function scopedToolNames(
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
export function scopedToolNames(
|
|
39
|
+
catalog: object[],
|
|
40
|
+
actorTiers: Record<string, number> | undefined,
|
|
41
|
+
actor: {
|
|
42
|
+
kind?: string
|
|
43
|
+
}
|
|
44
|
+
): string[]
|
|
32
45
|
export namespace DEFAULT_ACTOR_TIERS {
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
let human: number
|
|
47
|
+
let agent: number
|
|
35
48
|
}
|
package/types/core/tools.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export { createOpenAiChat, runAgent } from "./core/llm.js";
|
|
6
|
-
export { listOmlxModels, resolveModel } from "./core/omlx-models.js";
|
|
7
|
-
export { DIRECT_OMLX_BASE_URL, isDirectOmlxUrl, PROXY_OMLX_BASE_URL, resolveOmlxBaseUrl, resolveOmlxBaseUrlCached } from "./core/resolve-omlx-base-url.js";
|
|
8
|
-
export { listTools, toJsonSchema, toolManifest } from "./core/manifest.js";
|
|
9
|
-
export { classify, DEFAULT_ACTOR_TIERS, scopedManifest, scopedToolNames } from "./core/scope.js";
|
|
1
|
+
export { getTool } from './core/tools.js'
|
|
2
|
+
export { createDispatch, validateInput } from './core/dispatch.js'
|
|
3
|
+
export { listTools, toJsonSchema, toolManifest } from './core/manifest.js'
|
|
4
|
+
export { classify, DEFAULT_ACTOR_TIERS, scopedManifest, scopedToolNames } from './core/scope.js'
|