@7n/tauri-components 0.13.10 → 0.14.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 +12 -0
- package/package.json +13 -4
- package/src/components/AgentDialog.vue +28 -10
- package/src/components/AuditDialog.vue +5 -1
- package/src/components/docs/AgentDialog.md +1 -1
- package/src/components/docs/AuditDialog.md +1 -1
- package/src/core/acp-agent.js +2 -2
- package/src/core/acp-kit.js +6 -6
- package/src/core/docs/acp-agent.md +1 -1
- package/src/core/docs/acp-kit.md +1 -1
- package/src/core/scope.js +1 -1
- package/src/vue/docs/use-acp-agent.md +1 -1
- package/src/vue/use-acp-agent.js +9 -3
- package/types/components/index.d.ts +1 -0
- package/types/components/status.d.ts +15 -0
- package/types/core/acp-agent-presets.d.ts +28 -0
- package/types/core/acp-agent.d.ts +114 -0
- package/types/core/acp-kit.d.ts +29 -0
- package/types/core/dispatch.d.ts +2 -5
- package/types/core/manifest.d.ts +9 -14
- package/types/core/scope.d.ts +11 -24
- package/types/core/tools.d.ts +1 -1
- package/types/index.d.ts +7 -4
- package/types/testing/index.d.ts +1 -0
- package/types/testing/quasar.d.ts +14 -0
- package/types/vue/index.d.ts +4 -0
- package/types/vue/journal-store-tauri.d.ts +9 -0
- package/types/vue/transports.d.ts +6 -0
- package/types/vue/use-acp-agent.d.ts +27 -0
- package/types/vue/use-updater.d.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.0] - 2026-07-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- AgentDialog: інкрементальний стрімінг відповіді (текст/tool-call з'являються по мірі надходження session/update-чанків, а не лише після завершення всього ходу). AuditDialog: коректно показує нативні ACP permission-request поряд з MCP tool-call approval в одному списку.
|
|
8
|
+
|
|
9
|
+
## [0.13.11] - 2026-07-21
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- hk.pkl gen-types тепер реально генерує декларації для всього npm/src (раніше npm/npm/src/**/*.js через дублювання dir-префікса в glob ніколи не матчився — типи для components/vue/testing взагалі не генерувались); exports у package.json отримали types-умову для ./vue, ./components, ./testing (раніше лише "." мав types)
|
|
14
|
+
|
|
3
15
|
## [0.13.10] - 2026-07-21
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7n/tauri-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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",
|
|
@@ -18,9 +18,18 @@
|
|
|
18
18
|
"types": "./types/index.d.ts",
|
|
19
19
|
"default": "./src/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./vue":
|
|
22
|
-
|
|
23
|
-
|
|
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",
|
|
@@ -142,12 +142,14 @@ async function scrollToEnd() {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
145
|
+
* Fill in the live turn with the final result, latch the conversation id,
|
|
146
|
+
* refresh the graph on writes.
|
|
146
147
|
* @param {object} outcome structured result from request/respond
|
|
148
|
+
* @param {object} turn the live turn pushed at the start of send(), updated in place
|
|
147
149
|
*/
|
|
148
|
-
function apply(outcome) {
|
|
150
|
+
function apply(outcome, turn) {
|
|
149
151
|
if (outcome.requestId) requestId.value = outcome.requestId
|
|
150
|
-
|
|
152
|
+
turn.result = outcome
|
|
151
153
|
if (outcome.actions?.some(action => action.envelope?.ok)) emit('ran')
|
|
152
154
|
scrollToEnd()
|
|
153
155
|
}
|
|
@@ -202,17 +204,33 @@ async function send() {
|
|
|
202
204
|
}
|
|
203
205
|
prompt.value = ''
|
|
204
206
|
turns.value.push({ role: 'user', text })
|
|
207
|
+
// Only a fresh request() actually spawns with the currently-selected
|
|
208
|
+
// agent/tier — a respond() keeps talking to whatever the conversation
|
|
209
|
+
// already started with, so the label must not move mid-conversation.
|
|
210
|
+
if (!requestId.value) {
|
|
211
|
+
activeAgentLabel.value = currentAgentLabel()
|
|
212
|
+
activeSpawnKey.value = currentSpawnKey()
|
|
213
|
+
}
|
|
214
|
+
// Pushed before the call resolves and updated in place as session/update
|
|
215
|
+
// chunks stream in (onChunk below), so the reply grows live instead of
|
|
216
|
+
// only appearing once the whole turn finishes.
|
|
217
|
+
const liveTurn = {
|
|
218
|
+
role: 'agent',
|
|
219
|
+
agentLabel: activeAgentLabel.value,
|
|
220
|
+
result: { status: 'running', summary: '', actions: [], question: null, pendingApproval: null }
|
|
221
|
+
}
|
|
222
|
+
turns.value.push(liveTurn)
|
|
205
223
|
scrollToEnd()
|
|
206
224
|
running.value = true
|
|
207
225
|
try {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (!requestId.value) {
|
|
212
|
-
activeAgentLabel.value = currentAgentLabel()
|
|
213
|
-
activeSpawnKey.value = currentSpawnKey()
|
|
226
|
+
const onChunk = ({ text: liveText, actions }) => {
|
|
227
|
+
liveTurn.result = { ...liveTurn.result, summary: liveText, actions }
|
|
228
|
+
scrollToEnd()
|
|
214
229
|
}
|
|
215
|
-
|
|
230
|
+
const outcome = await (requestId.value
|
|
231
|
+
? respond(requestId.value, payload, { onChunk })
|
|
232
|
+
: request(payload, { onChunk }))
|
|
233
|
+
apply(outcome, liveTurn)
|
|
216
234
|
} catch (error) {
|
|
217
235
|
$q.notify({ type: 'negative', message: String(error?.message ?? error) })
|
|
218
236
|
} finally {
|
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
<div v-if="expandedId === rec.id" class="audit-body">
|
|
26
26
|
<RequestView @respond="msg => onRespond(rec, msg)" :result="rec" :busy="busyId === rec.id" />
|
|
27
27
|
<div v-if="rec.status === 'needs_approval' && rec.pendingApproval" class="audit-approval">
|
|
28
|
-
<div class="audit-pending">
|
|
28
|
+
<div v-if="rec.pendingApproval.kind === 'acp'" class="audit-pending">
|
|
29
|
+
Permission request:
|
|
30
|
+
<code>{{ rec.pendingApproval.toolCall?.title ?? rec.pendingApproval.toolCall?.toolCallId }}</code>
|
|
31
|
+
</div>
|
|
32
|
+
<div v-else class="audit-pending">
|
|
29
33
|
Approve action: <code>{{ rec.pendingApproval.tool }}({{ JSON.stringify(rec.pendingApproval.input) }})</code>
|
|
30
34
|
</div>
|
|
31
35
|
<div class="row q-gutter-sm">
|
package/src/core/acp-agent.js
CHANGED
|
@@ -101,7 +101,7 @@ function applySessionUpdate(state, update) {
|
|
|
101
101
|
* @param {object} params turn parameters
|
|
102
102
|
* @param {string} params.sessionKey handle from `createAcpSession`
|
|
103
103
|
* @param {string} params.text prompt text for this turn
|
|
104
|
-
* @param {(
|
|
104
|
+
* @param {(snapshot: {text: string, actions: {tool: string, input: object, envelope: object|null}[]}) => void} [params.onChunk] optional live callback with the turn's accumulated text/tool-calls so far, fired on every session/update (UI streaming)
|
|
105
105
|
* @returns {Promise<{content: string, steps: number, trace: object[], messages: object[], stopped?: string}>} runAgent()-shaped result
|
|
106
106
|
*/
|
|
107
107
|
export async function runAcpTurn({ sessionKey, text, onChunk }) {
|
|
@@ -110,7 +110,7 @@ export async function runAcpTurn({ sessionKey, text, onChunk }) {
|
|
|
110
110
|
const unlisten = await listen('acp://session-update', event => {
|
|
111
111
|
if (event.payload?.sessionKey !== sessionKey) return
|
|
112
112
|
applySessionUpdate(state, event.payload.update)
|
|
113
|
-
onChunk?.(
|
|
113
|
+
onChunk?.({ text: state.text, actions: state.calls.values().toArray() })
|
|
114
114
|
})
|
|
115
115
|
|
|
116
116
|
try {
|
package/src/core/acp-kit.js
CHANGED
|
@@ -175,10 +175,10 @@ export function createAcpAgentKit({
|
|
|
175
175
|
/**
|
|
176
176
|
* Start a new ACP-backed request: spawns the agent session and runs the
|
|
177
177
|
* first prompt turn.
|
|
178
|
-
* @param {{intent: string, agent: object}} opts `agent` is passed straight to `createAcpSession` (agentKind/command/args/env/cwd/…)
|
|
178
|
+
* @param {{intent: string, agent: object, onChunk?: (snapshot: {text: string, actions: object[]}) => void}} opts `agent` is passed straight to `createAcpSession` (agentKind/command/args/env/cwd/…); `onChunk` streams live text/tool-calls as the turn runs
|
|
179
179
|
* @returns {Promise<object>} structured result envelope
|
|
180
180
|
*/
|
|
181
|
-
async request({ intent, agent }) {
|
|
181
|
+
async request({ intent, agent, onChunk }) {
|
|
182
182
|
await ensureListening()
|
|
183
183
|
const id = await journal.create({ intent, actor: AGENT_ACTOR })
|
|
184
184
|
await journal.update(id, { status: 'running' })
|
|
@@ -191,15 +191,15 @@ export function createAcpAgentKit({
|
|
|
191
191
|
activeSessionKey = session.sessionKey
|
|
192
192
|
activeRequestId = id
|
|
193
193
|
await journal.update(id, { acp: { agentKind: session.agentKind, sessionKey: session.sessionKey } })
|
|
194
|
-
return runAndJournal(id, [], deps.runAcpTurn({ sessionKey: activeSessionKey, text: intent }))
|
|
194
|
+
return runAndJournal(id, [], deps.runAcpTurn({ sessionKey: activeSessionKey, text: intent, onChunk }))
|
|
195
195
|
},
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* Continue the active session with a follow-up message.
|
|
199
|
-
* @param {{requestId: string, message: string}} opts resume parameters
|
|
199
|
+
* @param {{requestId: string, message: string, onChunk?: (snapshot: {text: string, actions: object[]}) => void}} opts resume parameters; `onChunk` streams live text/tool-calls as the turn runs
|
|
200
200
|
* @returns {Promise<object>} updated result envelope
|
|
201
201
|
*/
|
|
202
|
-
async respond({ requestId, message }) {
|
|
202
|
+
async respond({ requestId, message, onChunk }) {
|
|
203
203
|
if (!activeSessionKey) {
|
|
204
204
|
return {
|
|
205
205
|
requestId,
|
|
@@ -228,7 +228,7 @@ export function createAcpAgentKit({
|
|
|
228
228
|
return runAndJournal(
|
|
229
229
|
requestId,
|
|
230
230
|
record.actions ?? [],
|
|
231
|
-
deps.runAcpTurn({ sessionKey: activeSessionKey, text: message })
|
|
231
|
+
deps.runAcpTurn({ sessionKey: activeSessionKey, text: message, onChunk })
|
|
232
232
|
)
|
|
233
233
|
},
|
|
234
234
|
|
package/src/core/docs/acp-kit.md
CHANGED
package/src/core/scope.js
CHANGED
|
@@ -22,7 +22,7 @@ export function classify(catalog, actorTiers, actor, toolName) {
|
|
|
22
22
|
const tiers = actorTiers ?? DEFAULT_ACTOR_TIERS
|
|
23
23
|
const tool = getTool(catalog, toolName)
|
|
24
24
|
if (!tool) return 'deny'
|
|
25
|
-
const rank = TIER_RANK[tool.tier] ??
|
|
25
|
+
const rank = TIER_RANK[tool.tier] ?? Infinity
|
|
26
26
|
const max = tiers[actor?.kind] ?? 0
|
|
27
27
|
if (rank <= max) return 'allow'
|
|
28
28
|
if (tool.tier === 'destructive' && actor?.kind === 'agent') return 'approval'
|
package/src/vue/use-acp-agent.js
CHANGED
|
@@ -114,14 +114,20 @@ export function useAcpAgent({
|
|
|
114
114
|
journal,
|
|
115
115
|
/**
|
|
116
116
|
* @param {string} intent user prompt
|
|
117
|
-
* @param {{modelTier?: string}} [opts] per-call overrides
|
|
117
|
+
* @param {{modelTier?: string, onChunk?: (snapshot: {text: string, actions: object[]}) => void}} [opts] per-call overrides; `onChunk` streams live text/tool-calls as the turn runs
|
|
118
118
|
* @returns {Promise<object>} structured result envelope
|
|
119
119
|
*/
|
|
120
120
|
request: (intent, opts = {}) => {
|
|
121
121
|
if (opts.modelTier) modelTier.value = opts.modelTier
|
|
122
|
-
return kit.request({ intent, agent: resolveSpawnArgs() })
|
|
122
|
+
return kit.request({ intent, agent: resolveSpawnArgs(), onChunk: opts.onChunk })
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* @param {string} requestId journal record id from a prior request()/respond()
|
|
126
|
+
* @param {string} message follow-up user message
|
|
127
|
+
* @param {{onChunk?: (snapshot: {text: string, actions: object[]}) => void}} [opts] `onChunk` streams live text/tool-calls as the turn runs
|
|
128
|
+
* @returns {Promise<object>} updated result envelope
|
|
129
|
+
*/
|
|
130
|
+
respond: (requestId, message, opts = {}) => kit.respond({ requestId, message, onChunk: opts.onChunk }),
|
|
125
131
|
approve: (requestId, approve) => kit.approve({ requestId, approve })
|
|
126
132
|
}
|
|
127
133
|
}
|
|
@@ -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
|
+
};
|
package/types/core/dispatch.d.ts
CHANGED
|
@@ -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>;
|
package/types/core/manifest.d.ts
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
}[]
|
|
24
|
+
name: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
}[];
|
package/types/core/scope.d.ts
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
40
|
-
|
|
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
|
-
|
|
47
|
-
|
|
33
|
+
let human: number;
|
|
34
|
+
let agent: number;
|
|
48
35
|
}
|
package/types/core/tools.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
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,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,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;
|