@7n/tauri-components 0.13.9 → 0.13.11

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,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.13.11] - 2026-07-21
4
+
5
+ ### Changed
6
+
7
+ - hk.pkl gen-types тепер реально генерує декларації для всього npm/src (раніше npm/npm/src/**/*.js через дублювання dir-префікса в glob ніколи не матчився — типи для components/vue/testing взагалі не генерувались); exports у package.json отримали types-умову для ./vue, ./components, ./testing (раніше лише "." мав types)
8
+
9
+ ## [0.13.10] - 2026-07-21
10
+
11
+ ### Changed
12
+
13
+ - chore(deps): n-taze bump — 11 minor/patch (npm), 5 minor/patch (Rust)
14
+
3
15
  ## [0.13.9] - 2026-07-20
4
16
 
5
17
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7n/tauri-components",
3
- "version": "0.13.9",
3
+ "version": "0.13.11",
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",
@@ -18,9 +18,18 @@
18
18
  "types": "./types/index.d.ts",
19
19
  "default": "./src/index.js"
20
20
  },
21
- "./vue": "./src/vue/index.js",
22
- "./components": "./src/components/index.js",
23
- "./testing": "./src/testing/index.js"
21
+ "./vue": {
22
+ "types": "./types/vue/index.d.ts",
23
+ "default": "./src/vue/index.js"
24
+ },
25
+ "./components": {
26
+ "types": "./types/components/index.d.ts",
27
+ "default": "./src/components/index.js"
28
+ },
29
+ "./testing": {
30
+ "types": "./types/testing/index.d.ts",
31
+ "default": "./src/testing/index.js"
32
+ }
24
33
  },
25
34
  "files": [
26
35
  "src",
@@ -33,7 +42,7 @@
33
42
  "!**/fixtures/**"
34
43
  ],
35
44
  "dependencies": {
36
- "marked": "^18.0.5"
45
+ "marked": "^18.0.7"
37
46
  },
38
47
  "peerDependencies": {
39
48
  "@tauri-apps/api": "^2.0.0",
@@ -45,9 +54,15 @@
45
54
  "vue": "^3.0.0"
46
55
  },
47
56
  "peerDependenciesMeta": {
48
- "@tauri-apps/api": { "optional": true },
49
- "@tauri-apps/plugin-http": { "optional": true },
50
- "quasar": { "optional": true }
57
+ "@tauri-apps/api": {
58
+ "optional": true
59
+ },
60
+ "@tauri-apps/plugin-http": {
61
+ "optional": true
62
+ },
63
+ "quasar": {
64
+ "optional": true
65
+ }
51
66
  },
52
67
  "knip": {
53
68
  "ignoreDependencies": [
@@ -60,12 +75,12 @@
60
75
  },
61
76
  "devDependencies": {
62
77
  "@quasar/extras": "^2.0.2",
63
- "@storybook/addon-vitest": "^10.5.2",
64
- "@storybook/vue3-vite": "^10.5.2",
78
+ "@storybook/addon-vitest": "^10.5.3",
79
+ "@storybook/vue3-vite": "^10.5.3",
65
80
  "@vitejs/plugin-vue": "^6.0.8",
66
81
  "@vitest/browser": "^4.1.10",
67
82
  "@vitest/browser-playwright": "^4.1.10",
68
83
  "playwright": "^1.61.1",
69
- "storybook": "^10.5.2"
84
+ "storybook": "^10.5.3"
70
85
  }
71
86
  }
@@ -0,0 +1 @@
1
+ export { STATUS_COLOR, statusColor } from "./status.js";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @param {string} status request status
3
+ * @returns {string} accent color (fallback grey for unknown statuses)
4
+ */
5
+ export function statusColor(status: string): string;
6
+ export namespace STATUS_COLOR {
7
+ let pending: string;
8
+ let running: string;
9
+ let done: string;
10
+ let partial: string;
11
+ let needs_clarification: string;
12
+ let needs_approval: string;
13
+ let failed: string;
14
+ let rejected: string;
15
+ }
@@ -0,0 +1,28 @@
1
+ export namespace CODEX_ACP_AGENT_PRESET {
2
+ let command: string;
3
+ let args: string[];
4
+ namespace tiers {
5
+ namespace MIN {
6
+ let label: string;
7
+ let env: {
8
+ CODEX_CONFIG: string;
9
+ };
10
+ }
11
+ namespace AVG {
12
+ let label_1: string;
13
+ export { label_1 as label };
14
+ let env_1: {
15
+ CODEX_CONFIG: string;
16
+ };
17
+ export { env_1 as env };
18
+ }
19
+ namespace MAX {
20
+ let label_2: string;
21
+ export { label_2 as label };
22
+ let env_2: {
23
+ CODEX_CONFIG: string;
24
+ };
25
+ export { env_2 as env };
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Spawn an ACP agent subprocess and run its `initialize` + `session/new`
3
+ * handshake. Returns a session handle to pass to `runAcpTurn`/`cancelAcpSession`.
4
+ * @param {object} params spawn parameters
5
+ * @param {string} params.agentKind 'codex'|'claude'|'cursor'|'pi' (informational — passed through, not interpreted here)
6
+ * @param {string} params.command executable to spawn (e.g. 'npx')
7
+ * @param {string[]} [params.args] command arguments
8
+ * @param {Record<string,string>} [params.env] extra environment variables for the subprocess
9
+ * @param {string} params.cwd session working directory (absolute path)
10
+ * @param {string} [params.mcpBridgeUrl] this app's domain MCP bridge URL (from acpStartMcpBridge), omit for no domain tools
11
+ * @param {boolean} [params.allowFs] grant fs/read_text_file + fs/write_text_file
12
+ * @param {boolean} [params.allowTerminal] grant terminal/*
13
+ * @returns {Promise<{sessionKey: string, agentKind: string}>} session handle
14
+ */
15
+ export function createAcpSession({ agentKind, command, args, env, cwd, mcpBridgeUrl, allowFs, allowTerminal }: {
16
+ agentKind: string;
17
+ command: string;
18
+ args?: string[];
19
+ env?: Record<string, string>;
20
+ cwd: string;
21
+ mcpBridgeUrl?: string;
22
+ allowFs?: boolean;
23
+ allowTerminal?: boolean;
24
+ }): Promise<{
25
+ sessionKey: string;
26
+ agentKind: string;
27
+ }>;
28
+ /**
29
+ * Run one prompt turn on an already-spawned ACP session, streaming
30
+ * `session/update` chunks into the same shape `runAgent()` returned.
31
+ * @param {object} params turn parameters
32
+ * @param {string} params.sessionKey handle from `createAcpSession`
33
+ * @param {string} params.text prompt text for this turn
34
+ * @param {(update: object) => void} [params.onChunk] optional live callback for each raw session/update (UI streaming)
35
+ * @returns {Promise<{content: string, steps: number, trace: object[], messages: object[], stopped?: string}>} runAgent()-shaped result
36
+ */
37
+ export function runAcpTurn({ sessionKey, text, onChunk }: {
38
+ sessionKey: string;
39
+ text: string;
40
+ onChunk?: (update: object) => void;
41
+ }): Promise<{
42
+ content: string;
43
+ steps: number;
44
+ trace: object[];
45
+ messages: object[];
46
+ stopped?: string;
47
+ }>;
48
+ /**
49
+ * Ask the agent to cancel its in-flight prompt turn.
50
+ * @param {string} sessionKey handle from `createAcpSession`
51
+ * @returns {Promise<void>} resolves once the cancel notification is sent
52
+ */
53
+ export function cancelAcpSession(sessionKey: string): Promise<void>;
54
+ /**
55
+ * Subscribe to `acp://mcp-tool-call` (a domain-catalog tool call the agent
56
+ * made through the MCP bridge, waiting on `acp_mcp_tool_result`).
57
+ * @param {(payload: {requestId: string, tool: string, input: object}) => void} handler callback
58
+ * @returns {Promise<() => void>} unlisten function
59
+ */
60
+ export function onAcpToolCall(handler: (payload: {
61
+ requestId: string;
62
+ tool: string;
63
+ input: object;
64
+ }) => void): Promise<() => void>;
65
+ /**
66
+ * Resolve a pending `acp://mcp-tool-call` with the same envelope shape
67
+ * `createDispatch` returns.
68
+ * @param {string} requestId id from the `acp://mcp-tool-call` payload
69
+ * @param {{ok: boolean, output?: unknown, error?: {code: string, message: string}}} envelope dispatch result
70
+ * @returns {Promise<void>} resolves once the reply reaches the Rust bridge
71
+ */
72
+ export function respondAcpToolCall(requestId: string, envelope: {
73
+ ok: boolean;
74
+ output?: unknown;
75
+ error?: {
76
+ code: string;
77
+ message: string;
78
+ };
79
+ }): Promise<void>;
80
+ /**
81
+ * Subscribe to `acp://permission-request` (a native ACP `session/request_permission`
82
+ * call, e.g. the agent's own file-edit/bash tools asking before running).
83
+ * @param {(payload: {sessionKey: string, requestId: string, toolCall: object, options: {optionId: string, name: string}[]}) => void} handler callback
84
+ * @returns {Promise<() => void>} unlisten function
85
+ */
86
+ export function onAcpPermissionRequest(handler: (payload: {
87
+ sessionKey: string;
88
+ requestId: string;
89
+ toolCall: object;
90
+ options: {
91
+ optionId: string;
92
+ name: string;
93
+ }[];
94
+ }) => void): Promise<() => void>;
95
+ /**
96
+ * Resolve a pending `acp://permission-request` by selecting one of its options.
97
+ * @param {string} requestId id from the `acp://permission-request` payload
98
+ * @param {string} optionId one of the payload's `options[].optionId`
99
+ * @returns {Promise<void>} resolves once the permission response is sent
100
+ */
101
+ export function respondAcpPermission(requestId: string, optionId: string): Promise<void>;
102
+ /**
103
+ * Register this app's tool catalog with the domain MCP bridge and start it.
104
+ * @param {object[]} catalog tool definitions (same shape passed to `createAcpAgentKit`)
105
+ * @returns {Promise<string>} the bridge's loopback URL, e.g. `http://127.0.0.1:54321/`
106
+ */
107
+ export function startAcpMcpBridge(catalog: object[]): Promise<string>;
108
+ /**
109
+ * Read the per-machine default agent kind (`ACP_DEFAULT_AGENT` env var).
110
+ * @returns {Promise<{defaultAgentKind: string|null}>} config
111
+ */
112
+ export function acpConfig(): Promise<{
113
+ defaultAgentKind: string | null;
114
+ }>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @param {object} config kit configuration
3
+ * @param {object[]} config.catalog tool definitions (required)
4
+ * @param {object} config.journal journal store { create, load, update, list }
5
+ * @param {(tool: object, input: object) => unknown} [config.transport] backend runner for domain tools; omit for a chat-only kit (no domain MCP tools)
6
+ * @param {Record<string, number>} [config.actorTiers] max executable tier rank per actor kind
7
+ * @param {object} [config.deps] injectable `acp-agent.js` functions (tests only — defaults to the real module)
8
+ * @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
9
+ */
10
+ export function createAcpAgentKit({ catalog, journal, transport, actorTiers, deps }?: {
11
+ catalog: object[];
12
+ journal: object;
13
+ transport?: (tool: object, input: object) => unknown;
14
+ actorTiers?: Record<string, number>;
15
+ deps?: object;
16
+ }): {
17
+ request: (opts: {
18
+ intent: string;
19
+ agent: object;
20
+ }) => Promise<object>;
21
+ respond: (opts: {
22
+ requestId: string;
23
+ message: string;
24
+ }) => Promise<object>;
25
+ approve: (opts: {
26
+ requestId: string;
27
+ approve: boolean;
28
+ }) => Promise<object>;
29
+ };
@@ -4,14 +4,11 @@
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(
15
- catalog: object[],
16
- transport: (tool: object, input: object) => unknown
17
- ): (name: string, input?: object) => Promise<object>
14
+ export function createDispatch(catalog: object[], transport: (tool: object, input: object) => unknown): (name: string, input?: object) => Promise<object>;
@@ -3,29 +3,24 @@
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
- input: Record<
8
- string,
9
- {
10
- type: string
11
- required?: boolean
12
- description?: string
13
- }
14
- >
15
- ): object
6
+ export function toJsonSchema(input: Record<string, {
7
+ type: string;
8
+ required?: boolean;
9
+ description?: string;
10
+ }>): object;
16
11
  /**
17
12
  * OpenAI function-calling tool definitions, optionally filtered (e.g. by scope).
18
13
  * @param {object[]} catalog tool definitions
19
14
  * @param {(tool: object) => boolean} [allow] predicate; default includes all tools
20
15
  * @returns {object[]} OpenAI `tools` array
21
16
  */
22
- export function toolManifest(catalog: object[], allow?: (tool: object) => boolean): object[]
17
+ export function toolManifest(catalog: object[], allow?: (tool: object) => boolean): object[];
23
18
  /**
24
19
  * Compact catalog listing (name + summary).
25
20
  * @param {object[]} catalog tool definitions
26
21
  * @returns {{name: string, summary: string}[]} tool list
27
22
  */
28
23
  export function listTools(catalog: object[]): {
29
- name: string
30
- summary: string
31
- }[]
24
+ name: string;
25
+ summary: string;
26
+ }[];
@@ -6,14 +6,9 @@
6
6
  * @param {string} toolName tool name
7
7
  * @returns {'allow'|'approval'|'deny'} decision
8
8
  */
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'
9
+ export function classify(catalog: object[], actorTiers: Record<string, number> | undefined, actor: {
10
+ kind?: string;
11
+ }, toolName: string): "allow" | "approval" | "deny";
17
12
  /**
18
13
  * LLM tool manifest visible to the actor (everything it may run OR request approval for).
19
14
  * @param {object[]} catalog tool definitions
@@ -21,13 +16,9 @@ export function classify(
21
16
  * @param {{ kind?: string }} actor caller identity
22
17
  * @returns {object[]} OpenAI tools array
23
18
  */
24
- export function scopedManifest(
25
- catalog: object[],
26
- actorTiers: Record<string, number> | undefined,
27
- actor: {
28
- kind?: string
29
- }
30
- ): object[]
19
+ export function scopedManifest(catalog: object[], actorTiers: Record<string, number> | undefined, actor: {
20
+ kind?: string;
21
+ }): object[];
31
22
  /**
32
23
  * Tool names visible to the actor.
33
24
  * @param {object[]} catalog tool definitions
@@ -35,14 +26,10 @@ export function scopedManifest(
35
26
  * @param {{ kind?: string }} actor caller identity
36
27
  * @returns {string[]} visible tool names
37
28
  */
38
- export function scopedToolNames(
39
- catalog: object[],
40
- actorTiers: Record<string, number> | undefined,
41
- actor: {
42
- kind?: string
43
- }
44
- ): string[]
29
+ export function scopedToolNames(catalog: object[], actorTiers: Record<string, number> | undefined, actor: {
30
+ kind?: string;
31
+ }): string[];
45
32
  export namespace DEFAULT_ACTOR_TIERS {
46
- let human: number
47
- let agent: number
33
+ let human: number;
34
+ let agent: number;
48
35
  }
@@ -4,4 +4,4 @@
4
4
  * @param {string} name tool name
5
5
  * @returns {object|null} the tool definition, or null if unknown
6
6
  */
7
- export function getTool(catalog: object[], name: string): object | null
7
+ export function getTool(catalog: object[], name: string): object | null;
package/types/index.d.ts CHANGED
@@ -1,4 +1,7 @@
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'
1
+ export { CODEX_ACP_AGENT_PRESET } from "./core/acp-agent-presets.js";
2
+ export { createAcpAgentKit } from "./core/acp-kit.js";
3
+ export { getTool } from "./core/tools.js";
4
+ export { acpConfig, cancelAcpSession, createAcpSession, onAcpPermissionRequest, onAcpToolCall, respondAcpPermission, respondAcpToolCall, runAcpTurn, startAcpMcpBridge } from "./core/acp-agent.js";
5
+ export { createDispatch, validateInput } from "./core/dispatch.js";
6
+ export { listTools, toJsonSchema, toolManifest } from "./core/manifest.js";
7
+ export { classify, DEFAULT_ACTOR_TIERS, scopedManifest, scopedToolNames } from "./core/scope.js";
@@ -0,0 +1 @@
1
+ export { mountQuasar, mountWithQuasar } from "./quasar.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Mount a component with Quasar registered, without any layout wrapper.
3
+ * @param {object} component Vue component (e.g. one that renders its own QLayout)
4
+ * @param {object} [options] mount options (forwarded)
5
+ * @returns {object} test wrapper
6
+ */
7
+ export function mountQuasar(component: object, options?: object): object;
8
+ /**
9
+ * Mount a page-level component wrapped in QLayout > QPageContainer.
10
+ * @param {object} component Vue component
11
+ * @param {object} [options] mount options (forwarded)
12
+ * @returns {object} test wrapper
13
+ */
14
+ export function mountWithQuasar(component: object, options?: object): object;
@@ -0,0 +1,4 @@
1
+ export { useAcpAgent } from "./use-acp-agent.js";
2
+ export { useUpdater } from "./use-updater.js";
3
+ export { createTauriJournalStore } from "./journal-store-tauri.js";
4
+ export { tauriTransport } from "./transports.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @returns {{ create: (r:object)=>Promise<string>, load: (id:string)=>Promise<object>, update: (id:string,patch:object)=>Promise<void>, list: ()=>Promise<object[]> }} journal store
3
+ */
4
+ export function createTauriJournalStore(): {
5
+ create: (r: object) => Promise<string>;
6
+ load: (id: string) => Promise<object>;
7
+ update: (id: string, patch: object) => Promise<void>;
8
+ list: () => Promise<object[]>;
9
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {object} tool tool definition (uses `tool.tauri`)
3
+ * @param {object} input tool input, forwarded as command args
4
+ * @returns {Promise<unknown>} the command result
5
+ */
6
+ export function tauriTransport(tool: object, input: object): Promise<unknown>;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @param {object} config gateway config
3
+ * @param {object[]} config.catalog app tool catalog (required — passed to the domain MCP bridge)
4
+ * @param {Record<string, {command: string, args?: string[], env?: Record<string,string>, tiers: Record<string, {label: string, args?: string[], env?: Record<string,string>}>}>} config.agents per-agent-kind spawn presets, keyed by 'codex'|'claude'|'cursor'|'pi'
5
+ * @param {string} [config.defaultTier] fallback modelTier when a request doesn't specify one (default 'AVG')
6
+ * @param {string} config.cwd session working directory (absolute path)
7
+ * @param {Record<string, number>} [config.actorTiers] max executable tier rank per actor kind
8
+ * @param {(tool: object, input: object) => unknown} [config.transport] tool transport (default Tauri invoke)
9
+ * @returns {object} in-app ACP agent gateway
10
+ */
11
+ export function useAcpAgent({ catalog, agents, defaultTier, cwd, actorTiers, transport }?: {
12
+ catalog: object[];
13
+ agents: Record<string, {
14
+ command: string;
15
+ args?: string[];
16
+ env?: Record<string, string>;
17
+ tiers: Record<string, {
18
+ label: string;
19
+ args?: string[];
20
+ env?: Record<string, string>;
21
+ }>;
22
+ }>;
23
+ defaultTier?: string;
24
+ cwd: string;
25
+ actorTiers?: Record<string, number>;
26
+ transport?: (tool: object, input: object) => unknown;
27
+ }): object;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @returns {void}
3
+ */
4
+ export function useUpdater(): void;