@7n/tauri-components 0.10.0 → 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.
Files changed (53) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/package.json +2 -1
  3. package/src/components/AgentDialog.vue +21 -46
  4. package/src/components/AuditDialog.vue +9 -17
  5. package/src/components/BaseDialog.vue +2 -6
  6. package/src/components/DialogActions.vue +2 -3
  7. package/src/components/RequestView.vue +2 -3
  8. package/src/components/StatePill.vue +1 -1
  9. package/src/components/docs/AgentDialog.md +4 -4
  10. package/src/components/docs/index.md +4 -4
  11. package/src/components/index.js +2 -2
  12. package/src/components/status.js +1 -1
  13. package/src/core/acp-agent-presets.js +2 -2
  14. package/src/core/acp-agent.js +21 -15
  15. package/src/core/acp-kit.js +79 -30
  16. package/src/core/dispatch.js +3 -3
  17. package/src/core/docs/acp-agent.md +4 -4
  18. package/src/core/docs/acp-kit.md +4 -4
  19. package/src/core/manifest.js +10 -8
  20. package/src/docs/index.md +4 -4
  21. package/src/index.js +3 -8
  22. package/src/testing/quasar.js +2 -2
  23. package/src/vue/docs/index.md +4 -4
  24. package/src/vue/docs/journal-store-tauri.md +4 -4
  25. package/src/vue/docs/use-acp-agent.md +4 -4
  26. package/src/vue/index.js +4 -6
  27. package/src/vue/journal-store-tauri.js +2 -2
  28. package/src/vue/use-acp-agent.js +22 -14
  29. package/src/vue/use-updater.js +4 -6
  30. package/types/core/dispatch.d.ts +5 -2
  31. package/types/core/manifest.d.ts +14 -9
  32. package/types/core/scope.d.ts +24 -11
  33. package/types/core/tools.d.ts +1 -1
  34. package/types/index.d.ts +4 -9
  35. package/src/core/agent-handler.js +0 -171
  36. package/src/core/agent-kit.js +0 -43
  37. package/src/core/docs/agent-handler.md +0 -31
  38. package/src/core/docs/agent-kit.md +0 -25
  39. package/src/core/docs/llm.md +0 -29
  40. package/src/core/docs/omlx-models.md +0 -30
  41. package/src/core/docs/resolve-omlx-base-url.md +0 -40
  42. package/src/core/llm.js +0 -90
  43. package/src/core/omlx-models.js +0 -34
  44. package/src/core/resolve-omlx-base-url.js +0 -84
  45. package/src/vue/docs/use-agent.md +0 -29
  46. package/src/vue/docs/use-omlx.md +0 -30
  47. package/src/vue/use-agent.js +0 -60
  48. package/src/vue/use-omlx.js +0 -102
  49. package/types/core/agent-handler.d.ts +0 -43
  50. package/types/core/agent-kit.d.ts +0 -30
  51. package/types/core/llm.d.ts +0 -52
  52. package/types/core/omlx-models.d.ts +0 -17
  53. package/types/core/resolve-omlx-base-url.d.ts +0 -42
@@ -3,17 +3,15 @@ import { createDispatch } from './dispatch.js'
3
3
  import { classify, DEFAULT_ACTOR_TIERS } from './scope.js'
4
4
 
5
5
  // createAcpAgentKit binds an app's catalog + journal to the ACP execution
6
- // engine — the ACP-flavored sibling of createAgentKit (agent-kit.js), added
7
- // alongside it so existing consumers keep working on the old omlx/runAgent
8
- // path while migrating at their own pace (see SPEC / plan for the sequencing).
6
+ // engine — the sole agent kit (the earlier omlx/runAgent-based createAgentKit
7
+ // has been removed; see CHANGELOG).
9
8
  //
10
- // The two engines differ in where tool dispatch happens: runAgent() drove its
11
- // own tool-calling loop and dispatched synchronously inside handleRequest.
12
- // Here the ACP agent process drives its OWN loop and calls domain tools
13
- // through the Rust-side MCP bridge — so dispatch is triggered by a STANDING
14
- // listener on `acp://mcp-tool-call`, not by anything in request()/respond().
15
- // Every such call is tier-classified as an `{kind:'agent'}` actor, since by
16
- // construction only an autonomous agent process can reach the bridge.
9
+ // The ACP agent process drives its OWN tool-calling loop and calls domain
10
+ // tools through the Rust-side MCP bridge so dispatch is triggered by a
11
+ // STANDING listener on `acp://mcp-tool-call`, not by anything in
12
+ // request()/respond(). Every such call is tier-classified as an
13
+ // `{kind:'agent'}` actor, since by construction only an autonomous agent
14
+ // process can reach the bridge.
17
15
  //
18
16
  // Scope: one active session/request at a time, matching how AgentDialog is
19
17
  // actually used today (a single live conversation). A tool call or permission
@@ -43,7 +41,7 @@ function finalizeTurn(turn) {
43
41
  if (turn.stopped === 'max_steps' || turn.stopped === 'refusal') status = 'partial'
44
42
  else if (turn.stopped === 'cancelled') status = 'partial'
45
43
  else if (question) status = 'needs_clarification'
46
- return { status, summary: question ? null : (turn.content || null), question }
44
+ return { status, summary: question ? null : turn.content || null, question }
47
45
  }
48
46
 
49
47
  /**
@@ -53,9 +51,15 @@ function finalizeTurn(turn) {
53
51
  * @param {(tool: object, input: object) => unknown} [config.transport] backend runner for domain tools; omit for a chat-only kit (no domain MCP tools)
54
52
  * @param {Record<string, number>} [config.actorTiers] max executable tier rank per actor kind
55
53
  * @param {object} [config.deps] injectable `acp-agent.js` functions (tests only — defaults to the real module)
56
- * @returns {{request: Function, respond: Function, approve: Function}} bound kit
54
+ * @returns {{request: (opts: {intent: string, agent: object}) => Promise<object>, respond: (opts: {requestId: string, message: string}) => Promise<object>, approve: (opts: {requestId: string, approve: boolean}) => Promise<object>}} bound kit
57
55
  */
58
- export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DEFAULT_ACTOR_TIERS, deps = acpAgent } = {}) {
56
+ export function createAcpAgentKit({
57
+ catalog,
58
+ journal,
59
+ transport,
60
+ actorTiers = DEFAULT_ACTOR_TIERS,
61
+ deps = acpAgent
62
+ } = {}) {
59
63
  if (!Array.isArray(catalog)) throw new Error('createAcpAgentKit: catalog (array) is required')
60
64
 
61
65
  const dispatch = transport ? createDispatch(catalog, transport) : null
@@ -71,17 +75,26 @@ export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DE
71
75
  */
72
76
  async function handleToolCall({ requestId, tool, input }) {
73
77
  if (!dispatch) {
74
- await deps.respondAcpToolCall(requestId, { ok: false, error: { code: 'forbidden', message: 'No transport configured.' } })
78
+ await deps.respondAcpToolCall(requestId, {
79
+ ok: false,
80
+ error: { code: 'forbidden', message: 'No transport configured.' }
81
+ })
75
82
  return
76
83
  }
77
84
  const decision = classify(catalog, actorTiers, AGENT_ACTOR, tool)
78
85
  if (decision === 'deny') {
79
- await deps.respondAcpToolCall(requestId, { ok: false, error: { code: 'forbidden', message: `Tool "${tool}" is not allowed.` } })
86
+ await deps.respondAcpToolCall(requestId, {
87
+ ok: false,
88
+ error: { code: 'forbidden', message: `Tool "${tool}" is not allowed.` }
89
+ })
80
90
  return
81
91
  }
82
92
  if (decision === 'approval') {
83
93
  if (activeRequestId) {
84
- await journal.update(activeRequestId, { status: 'needs_approval', pendingApproval: { kind: 'mcp', requestId, tool, input } })
94
+ await journal.update(activeRequestId, {
95
+ status: 'needs_approval',
96
+ pendingApproval: { kind: 'mcp', requestId, tool, input }
97
+ })
85
98
  }
86
99
  return // acp_mcp_tool_result comes later, from approve()
87
100
  }
@@ -127,8 +140,7 @@ export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DE
127
140
  let turn
128
141
  try {
129
142
  turn = await turnPromise
130
- }
131
- catch (error) {
143
+ } catch (error) {
132
144
  await journal.update(requestId, { status: 'failed', error: String(error?.message ?? error) })
133
145
  return { requestId, status: 'failed', summary: null, actions: baseActions, question: null, pendingApproval: null }
134
146
  }
@@ -163,18 +175,35 @@ export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DE
163
175
  */
164
176
  async respond({ requestId, message }) {
165
177
  if (!activeSessionKey) {
166
- return { requestId, status: 'failed', summary: null, actions: [], question: 'No active ACP session.', pendingApproval: null }
178
+ return {
179
+ requestId,
180
+ status: 'failed',
181
+ summary: null,
182
+ actions: [],
183
+ question: 'No active ACP session.',
184
+ pendingApproval: null
185
+ }
167
186
  }
168
187
  let record
169
188
  try {
170
189
  record = await journal.load(requestId)
171
- }
172
- catch {
173
- return { requestId, status: 'failed', summary: null, actions: [], question: 'Request not found.', pendingApproval: null }
190
+ } catch {
191
+ return {
192
+ requestId,
193
+ status: 'failed',
194
+ summary: null,
195
+ actions: [],
196
+ question: 'Request not found.',
197
+ pendingApproval: null
198
+ }
174
199
  }
175
200
  await journal.update(requestId, { status: 'running' })
176
201
  activeRequestId = requestId
177
- return runAndJournal(requestId, record.actions ?? [], deps.runAcpTurn({ sessionKey: activeSessionKey, text: message }))
202
+ return runAndJournal(
203
+ requestId,
204
+ record.actions ?? [],
205
+ deps.runAcpTurn({ sessionKey: activeSessionKey, text: message })
206
+ )
178
207
  },
179
208
 
180
209
  /**
@@ -187,19 +216,32 @@ export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DE
187
216
  let record
188
217
  try {
189
218
  record = await journal.load(requestId)
190
- }
191
- catch {
192
- return { requestId, status: 'failed', summary: null, actions: [], question: 'Request not found.', pendingApproval: null }
219
+ } catch {
220
+ return {
221
+ requestId,
222
+ status: 'failed',
223
+ summary: null,
224
+ actions: [],
225
+ question: 'Request not found.',
226
+ pendingApproval: null
227
+ }
193
228
  }
194
229
 
195
230
  const pending = record.pendingApproval
196
231
  if (record.status !== 'needs_approval' || !pending) {
197
- return { requestId, status: record.status, summary: record.summary, actions: record.actions ?? [], question: null, pendingApproval: null }
232
+ return {
233
+ requestId,
234
+ status: record.status,
235
+ summary: record.summary,
236
+ actions: record.actions ?? [],
237
+ question: null,
238
+ pendingApproval: null
239
+ }
198
240
  }
199
241
 
200
242
  if (pending.kind === 'acp') return approveAcpPermission(deps, journal, requestId, record, pending, decision)
201
243
  return approveMcpToolCall(deps, dispatch, journal, requestId, record, pending, decision)
202
- },
244
+ }
203
245
  }
204
246
  }
205
247
 
@@ -216,7 +258,7 @@ export function createAcpAgentKit({ catalog, journal, transport, actorTiers = DE
216
258
  * means the old "retry a failed dispatch" UX doesn't carry over: once the
217
259
  * agent has been told a tool call failed, it has already moved on.
218
260
  * @param {object} deps injected acp-agent.js functions
219
- * @param {Function} dispatch bound `createDispatch` result
261
+ * @param {(name: string, input?: object) => Promise<object>} dispatch bound `createDispatch` result
220
262
  * @param {object} journal journal store
221
263
  * @param {string} requestId journal record id
222
264
  * @param {object} record loaded journal record
@@ -256,5 +298,12 @@ async function approveAcpPermission(deps, journal, requestId, record, pending, d
256
298
  await deps.respondAcpPermission(pending.requestId, option?.optionId)
257
299
 
258
300
  await journal.update(requestId, { status: 'running', pendingApproval: null })
259
- return { requestId, status: 'running', summary: null, actions: record.actions ?? [], question: null, pendingApproval: null }
301
+ return {
302
+ requestId,
303
+ status: 'running',
304
+ summary: null,
305
+ actions: record.actions ?? [],
306
+ question: null,
307
+ pendingApproval: null
308
+ }
260
309
  }
@@ -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))) return `Field "${key}" must be an object`
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
- source: npm/src/core/acp-agent.js
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), і винятки не викидаються назовні.
@@ -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
- source: npm/src/core/acp-kit.js
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` створює агента на основі заданих компонентів. Модуль дозволяє розпочинати нові запити, продовжувати активні сесії або вирішувати відкладені питання, такі як виклики інструментів чи запити на дозвіл.
@@ -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.filter(tool => allow(tool)).map(tool => ({
28
- type: 'function',
29
- function: {
30
- name: tool.name,
31
- description: tool.summary,
32
- parameters: toJsonSchema(tool.input),
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
- source: npm/src/index.js
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 loop, tool surface and the
2
- // kit that binds them to an app catalog. Import this entry from headless
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'
@@ -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
  }
@@ -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
- source: npm/src/vue/index.js
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
- source: npm/src/vue/journal-store-tauri.js
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
- source: npm/src/vue/use-acp-agent.js
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 agent kit
2
- // to the webview (omlx over tauri-http, tools/journal over Tauri invoke).
3
- // Requires the host app to provide vue + @tauri-apps/* (peer deps) and the
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 agent-handler stays backend-agnostic. The host app must
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
  }
@@ -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 ACP-flavored sibling of `useAgent()` (which
8
- // stays on the old omlx/runAgent path). Binds an app's catalog to
9
- // createAcpAgentKit and resolves two independent defaults per SPEC/plan:
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, mirroring how `useOmlx().loadEnv()` resolves the
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({ catalog, agents = {}, defaultTier = DEFAULT_TIER, cwd, actorTiers, transport = tauriTransport } = {}) {
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 = cfg.defaultAgentKind && agents[cfg.defaultAgentKind] ? cfg.defaultAgentKind : (configuredKinds[0] ?? null)
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(() => Object.entries(agents[agentKind.value]?.tiers ?? {}).map(([id, t]) => ({ id, label: t.label ?? id }))),
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
  }
@@ -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)
@@ -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(catalog: object[], transport: (tool: object, input: object) => unknown): (name: string, input?: object) => Promise<object>;
14
+ export function createDispatch(
15
+ catalog: object[],
16
+ transport: (tool: object, input: object) => unknown
17
+ ): (name: string, input?: object) => Promise<object>
@@ -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(input: Record<string, {
7
- type: string;
8
- required?: boolean;
9
- description?: string;
10
- }>): object;
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
- name: string;
25
- summary: string;
26
- }[];
29
+ name: string
30
+ summary: string
31
+ }[]