@theokit/tauri 0.1.2 → 1.0.0-next.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 CHANGED
@@ -1,15 +1,24 @@
1
1
  # Changelog — @theokit/tauri
2
2
 
3
+ ## 1.0.0-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8333525]
8
+ - theokit@0.65.0-next.0
9
+
3
10
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
11
 
5
12
  ## [0.1.1] - 2026-07-12
6
13
 
7
14
  ### Fixed
15
+
8
16
  - **Published package no longer carries a `workspace:*` dependency.** `0.1.0` was published with `npm publish`, which (unlike `pnpm publish`) does not resolve the `theokit: workspace:*` dev dependency — so `npm install`-ing any project that depended on `@theokit/tauri@0.1.0` failed with `EUNSUPPORTEDPROTOCOL "workspace:"`. Republished with `pnpm publish` so every dependency resolves to a real version. `0.1.0` is deprecated.
9
17
 
10
18
  ## [0.1.0] - 2026-07-12
11
19
 
12
20
  ### Added
21
+
13
22
  - Initial release — desktop transport glue for TheoKit agents (ADR-0055).
14
23
  - **Webview** (`@theokit/tauri`): `createTauriChannelSource(core, { runCommand?, approveCommand? })` bridges an injected Tauri `{ invoke, Channel }` into a `ChannelPushSource` (the M42 `ChannelTransport` push contract) — JSONL `Channel` events (possibly multi-line) become `onLine`, the `run_turn` invoke resolves to `onClose` / rejects to `onError` (never swallowed, Rule 8), and `settle` routes a HITL decision to the `approve` command. `createTauriAgentClient(core, options?)` is the no-React convenience over M44 `createAgentClient`.
15
24
  - **Node sidecar** (`@theokit/tauri/sidecar`): `runTurnToJsonl(mod, apiKey, message, write, awaitApproval?)` streams one agent turn via `streamAgentTurnInProcess` and writes each `UIMessageChunk` as a JSONL line; a thrown error is emitted as a trailing `{type:'error'}` line.
package/LICENSE CHANGED
@@ -137,8 +137,8 @@
137
137
 
138
138
  6. Trademarks. This License does not grant permission to use the trade
139
139
  names, trademarks, service marks, or product names of the Licensor,
140
- except as required for describing the origin of the Work and
141
- reproducing the content of the NOTICE file.
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
142
 
143
143
  7. Disclaimer of Warranty. Unless required by applicable law or
144
144
  agreed to in writing, Licensor provides the Work (and each
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n ChannelTransport,\n createAgentClient,\n type AgentClientHandle,\n type ApprovalDecision,\n type ChannelPushSource,\n type CreateAgentClientOptions,\n} from 'theokit/client/core'\n\n/**\n * `@theokit/tauri` (ADR-0055) — the desktop transport glue for TheoKit agents.\n *\n * The webview consumes the agent via the unified client (`ChannelTransport` M42 + `createAgentClient` M44 /\n * `useAgent` M41). This module turns the Tauri `Channel`/`invoke` push into a `ChannelPushSource` so the\n * webview app writes one call instead of hand-rolling the bridge. The UI is `@theokit/ui` (the webview is a\n * browser); the runtime is `@theokit/sdk` (in the sidecar — see `@theokit/tauri/sidecar`). Core `theokit`\n * stays Tauri-agnostic — the `@tauri-apps/api` primitives are INJECTED here (ADR-0055 D3), never a hard dep.\n */\n\n/** A Tauri `Channel<string>` — structurally matches `@tauri-apps/api/core`'s `Channel` (no hard dep). */\nexport interface TauriChannel {\n onmessage: (line: string) => void\n}\n\n/** The Tauri `core` primitives injected into the source (structurally matches `@tauri-apps/api/core`). */\nexport interface TauriCore {\n invoke: (cmd: string, args?: Record<string, unknown>) => Promise<unknown>\n Channel: new () => TauriChannel\n}\n\nexport interface TauriChannelSourceOptions {\n /** The Rust `#[tauri::command]` that runs one agent turn (default `run_turn`, matching the M45 scaffold). */\n runCommand?: string\n /** The Rust `#[tauri::command]` that settles a HITL approval (default `approve`). */\n approveCommand?: string\n}\n\n/**\n * Build a {@link ChannelPushSource} bridging a Tauri `run_turn` `Channel` + `approve` `invoke` (ADR-0045 D3).\n * Pass it to `new ChannelTransport({ source })` (M42) and drive it with `useAgent(transport)` (React webview)\n * or `createAgentClient(transport)` (see {@link createTauriAgentClient}).\n */\nexport function createTauriChannelSource(\n core: TauriCore,\n options: TauriChannelSourceOptions = {},\n): ChannelPushSource {\n const runCommand = options.runCommand ?? 'run_turn'\n const approveCommand = options.approveCommand ?? 'approve'\n\n return {\n start(turn, { onLine, onClose, onError }) {\n const channel = new core.Channel()\n channel.onmessage = (line: string) => {\n // A Stdout event may carry multiple newline-delimited JSON lines (ADR-0045 D2).\n for (const part of line.split('\\n')) {\n const trimmed = part.trim()\n if (trimmed) onLine(trimmed)\n }\n }\n // Forward the M43 per-request context alongside the message — the sidecar receives it via the Rust\n // command args (the ChannelPushSource contract obliges the invoke to carry `turn.context`, not drop it).\n void core\n .invoke(runCommand, { message: turn.message, context: turn.context, onChunk: channel })\n .then(onClose, (err: unknown) => {\n // A Tauri command rejection is a real error — surface it, never swallow it (Rule 8 / M45 review LOW).\n onError?.(err instanceof Error ? err : new Error(String(err)))\n })\n // The Rust shell kills the prior sidecar on the next run, so no explicit abort is needed.\n return () => undefined\n },\n settle: async (approvalId: string, decision: ApprovalDecision) => {\n await core.invoke(approveCommand, { approvalId, approved: decision.approved })\n },\n }\n}\n\n/**\n * Convenience: a standalone (no-React) agent client wired to the Tauri desktop transport. Equivalent to\n * `createAgentClient(new ChannelTransport({ source: createTauriChannelSource(core, opts) }), { context })`.\n * A React webview should instead use `useAgent(new ChannelTransport({ source: createTauriChannelSource(core) }))`\n * from `theokit/client` (so it can render with `@theokit/ui`).\n */\nexport function createTauriAgentClient<TInput = unknown>(\n core: TauriCore,\n options: TauriChannelSourceOptions & CreateAgentClientOptions = {},\n): AgentClientHandle<TInput> {\n const { runCommand, approveCommand, ...clientOptions } = options\n const source = createTauriChannelSource(core, { runCommand, approveCommand })\n return createAgentClient<TInput>(new ChannelTransport({ source }), clientOptions)\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK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AAQ,GAAG;AACxC,YAAM,UAAU,IAAI,KAAK,QAAQ;AACjC,cAAQ,YAAY,CAAC,SAAiB;AAEpC,mBAAW,QAAQ,KAAK,MAAM,IAAI,GAAG;AACnC,gBAAM,UAAU,KAAK,KAAK;AAC1B,cAAI,QAAS,QAAO,OAAO;AAAA,QAC7B;AAAA,MACF;AAGA,WAAK,KACF,OAAO,YAAY,EAAE,SAAS,KAAK,SAAS,SAAS,KAAK,SAAS,SAAS,QAAQ,CAAC,EACrF,KAAK,SAAS,CAAC,QAAiB;AAE/B,kBAAU,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;AAAA,MAC/D,CAAC;AAEH,aAAO,MAAM;AAAA,IACf;AAAA,IACA,QAAQ,OAAO,YAAoB,aAA+B;AAChE,YAAM,KAAK,OAAO,gBAAgB,EAAE,YAAY,UAAU,SAAS,SAAS,CAAC;AAAA,IAC/E;AAAA,EACF;AACF;AAQO,SAAS,uBACd,MACA,UAAgE,CAAC,GACtC;AAC3B,QAAM,EAAE,YAAY,gBAAgB,GAAG,cAAc,IAAI;AACzD,QAAM,SAAS,yBAAyB,MAAM,EAAE,YAAY,eAAe,CAAC;AAC5E,SAAO,kBAA0B,IAAI,iBAAiB,EAAE,OAAO,CAAC,GAAG,aAAa;AAClF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sidecar.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nimport { streamAgentTurnInProcess, type InProcessAwaitApproval } from 'theokit/server/agent'\n\n/** Writes one JSONL line (the sidecar's stdout `write`). */\nexport type WriteLine = (line: string) => void\n\n/**\n * Resolve one gated-tool approval inline (the Rust shell forwards the webview's decision over stdin).\n * Aliases the seam's {@link InProcessAwaitApproval} so a sidecar can return the full `boolean | HitlDecision`\n * the SDK supports — never a narrower shape (the desktop stdin protocol carries `approved` today, but the\n * type stays forward-compatible with structured decisions).\n */\nexport type SidecarAwaitApproval = InProcessAwaitApproval\n\n/**\n * `@theokit/tauri/sidecar` (ADR-0055 D2) — the NODE side of the desktop app. Run ONE agent turn via the\n * in-process seam (`streamAgentTurnInProcess`, M35/M36) and emit each `UIMessageChunk` as a single JSONL\n * line to `write`; the Rust shell streams these to the webview over a Tauri `Channel`. A thrown error is\n * surfaced as a trailing `{type:'error'}` line, never swallowed (Rule 8). HITL: a gated tool pauses; the\n * caller resolves `awaitApproval` (typically after the Rust shell forwards the webview's decision on stdin).\n */\nexport async function runTurnToJsonl(\n mod: unknown,\n apiKey: string,\n message: string,\n write: WriteLine,\n awaitApproval?: SidecarAwaitApproval,\n): Promise<void> {\n try {\n for await (const chunk of streamAgentTurnInProcess(mod, apiKey, {\n message,\n sessionId: `desktop-${randomUUID()}`,\n awaitApproval,\n })) {\n write(`${JSON.stringify(chunk)}\\n`)\n }\n } catch (err) {\n const errorText = err instanceof Error ? err.message : String(err)\n write(`${JSON.stringify({ type: 'error', errorText })}\\n`)\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,gCAA6D;AAoBtE,eAAsB,eACpB,KACA,QACA,SACA,OACA,eACe;AACf,MAAI;AACF,qBAAiB,SAAS,yBAAyB,KAAK,QAAQ;AAAA,MAC9D;AAAA,MACA,WAAW,WAAW,WAAW,CAAC;AAAA,MAClC;AAAA,IACF,CAAC,GAAG;AACF,YAAM,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,CAAI;AAAA,IACpC;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,YAAY,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACjE,UAAM,GAAG,KAAK,UAAU,EAAE,MAAM,SAAS,UAAU,CAAC,CAAC;AAAA,CAAI;AAAA,EAC3D;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/sidecar.ts"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,gCAA6D;AAoBtE,eAAsB,eACpB,KACA,QACA,SACA,OACA,eACe;AACf,MAAI;AACF,qBAAiB,SAAS,yBAAyB,KAAK,QAAQ;AAAA,MAC9D;AAAA,MACA,WAAW,WAAW,WAAW,CAAC;AAAA,MAClC;AAAA,IACF,CAAC,GAAG;AACF,YAAM,GAAG,KAAK,UAAU,KAAK,CAAC;AAAA,CAAI;AAAA,IACpC;AAAA,EACF,SAAS,KAAK;AACZ,UAAM,YAAY,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AACjE,UAAM,GAAG,KAAK,UAAU,EAAE,MAAM,SAAS,UAAU,CAAC,CAAC;AAAA,CAAI;AAAA,EAC3D;AACF;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@theokit/tauri",
3
- "version": "0.1.2",
3
+ "version": "1.0.0-next.0",
4
4
  "description": "Tauri desktop glue for TheoKit agents — the Channel/invoke transport source (webview) + the JSONL sidecar (node), over the unified client. UI is @theokit/ui; the runtime is @theokit/sdk.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/usetheokit/theokit.git",
8
+ "directory": "packages/tauri"
9
+ },
10
+ "homepage": "https://github.com/usetheokit/theokit/tree/main/packages/tauri#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/usetheokit/theokit/issues"
13
+ },
5
14
  "license": "Apache-2.0",
6
15
  "type": "module",
7
16
  "sideEffects": false,
@@ -20,7 +29,7 @@
20
29
  "CHANGELOG.md"
21
30
  ],
22
31
  "peerDependencies": {
23
- "theokit": ">=0.30.0",
32
+ "theokit": ">=0.65.0-next.0",
24
33
  "@tauri-apps/api": ">=2.0.0"
25
34
  },
26
35
  "peerDependenciesMeta": {
@@ -29,9 +38,11 @@
29
38
  }
30
39
  },
31
40
  "devDependencies": {
32
- "theokit": "0.30.2"
41
+ "theokit": "0.65.0-next.0",
42
+ "@theokit/presenter": "0.8.0"
33
43
  },
34
44
  "publishConfig": {
45
+ "provenance": true,
35
46
  "access": "public"
36
47
  },
37
48
  "engines": {