@7n/tauri-components 0.3.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7n/tauri-components",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Shared LLM agent engine + Vue/Quasar UI for Tauri apps (chat, journal, trust-tier approval).",
6
6
  "license": "MIT",
@@ -44,7 +44,11 @@ export function createDispatch(catalog, transport) {
44
44
  return { ok: true, output }
45
45
  }
46
46
  catch (error) {
47
- return { ok: false, error: { code: 'io', message: String(error?.message ?? error) } }
47
+ const envelope = { code: 'io', message: String(error?.message ?? error) }
48
+ // Preserve a backend-provided error kind (e.g. a typed Tauri command error)
49
+ // so callers can branch on it — e.g. re-auth on a 'ReauthRequired' kind.
50
+ if (error?.kind !== undefined) envelope.kind = error.kind
51
+ return { ok: false, error: envelope }
48
52
  }
49
53
  }
50
54
  }
@@ -23,12 +23,13 @@ const DEFAULT_ACTOR = { kind: 'human', id: 'local' }
23
23
  * @param {Record<string, number>} [config.actorTiers] tier overrides
24
24
  * @param {{ kind: string, id: string }} [config.actor] caller identity (default human:local)
25
25
  * @param {{ storagePrefix?: string, defaultBaseUrl?: string, defaultModel?: string }} [config.omlx] omlx config options
26
+ * @param {(tool: object, input: object) => unknown} [config.transport] tool transport (default Tauri invoke); override to route some tools elsewhere (e.g. JS/OPFS-backed handlers)
26
27
  * @returns {object} in-app agent gateway
27
28
  */
28
- export function useAgent({ catalog, systemPrompt, grounding, actorTiers, actor = DEFAULT_ACTOR, omlx } = {}) {
29
+ export function useAgent({ catalog, systemPrompt, grounding, actorTiers, actor = DEFAULT_ACTOR, omlx, transport = tauriTransport } = {}) {
29
30
  const { baseUrl, model, apiKey, save, loadEnv } = useOmlx(omlx)
30
31
  const journal = createTauriJournalStore()
31
- const kit = createAgentKit({ catalog, systemPrompt, transport: tauriTransport, journal, actorTiers, grounding })
32
+ const kit = createAgentKit({ catalog, systemPrompt, transport, journal, actorTiers, grounding })
32
33
 
33
34
  /**
34
35
  * Build an omlx chat fn from the current config (tauri-http transport).