@particle-academy/agent-integrations 0.50.0 → 0.52.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 +91 -0
- package/README.md +69 -0
- package/dist/bridges/artboard.d.cts +3 -3
- package/dist/bridges/artboard.d.ts +3 -3
- package/dist/bridges/catalog.d.cts +3 -3
- package/dist/bridges/catalog.d.ts +3 -3
- package/dist/bridges/charts.d.cts +3 -3
- package/dist/bridges/charts.d.ts +3 -3
- package/dist/bridges/cms.d.cts +3 -3
- package/dist/bridges/cms.d.ts +3 -3
- package/dist/bridges/code.d.cts +3 -3
- package/dist/bridges/code.d.ts +3 -3
- package/dist/bridges/doc.d.cts +3 -3
- package/dist/bridges/doc.d.ts +3 -3
- package/dist/bridges/features.d.cts +3 -3
- package/dist/bridges/features.d.ts +3 -3
- package/dist/bridges/files.d.cts +3 -3
- package/dist/bridges/files.d.ts +3 -3
- package/dist/bridges/flow.d.cts +3 -3
- package/dist/bridges/flow.d.ts +3 -3
- package/dist/bridges/forms.d.cts +55 -10
- package/dist/bridges/forms.d.ts +55 -10
- package/dist/bridges/git.d.cts +3 -3
- package/dist/bridges/git.d.ts +3 -3
- package/dist/bridges/grid.d.cts +3 -3
- package/dist/bridges/grid.d.ts +3 -3
- package/dist/bridges/map.d.cts +3 -3
- package/dist/bridges/map.d.ts +3 -3
- package/dist/bridges/navigation.d.cts +3 -3
- package/dist/bridges/navigation.d.ts +3 -3
- package/dist/bridges/passkeys.d.cts +3 -3
- package/dist/bridges/passkeys.d.ts +3 -3
- package/dist/bridges/scene.d.cts +3 -3
- package/dist/bridges/scene.d.ts +3 -3
- package/dist/bridges/screen-doc.d.cts +3 -3
- package/dist/bridges/screen-doc.d.ts +3 -3
- package/dist/bridges/screens.d.cts +3 -3
- package/dist/bridges/screens.d.ts +3 -3
- package/dist/bridges/sheets.d.cts +3 -3
- package/dist/bridges/sheets.d.ts +3 -3
- package/dist/bridges/slides.d.cts +3 -3
- package/dist/bridges/slides.d.ts +3 -3
- package/dist/bridges/terminal.d.cts +3 -3
- package/dist/bridges/terminal.d.ts +3 -3
- package/dist/bridges/tui.d.cts +2 -2
- package/dist/bridges/tui.d.ts +2 -2
- package/dist/bridges/whiteboard.d.cts +3 -3
- package/dist/bridges/whiteboard.d.ts +3 -3
- package/dist/bridges-artboard.cjs +11 -5
- package/dist/bridges-artboard.cjs.map +1 -1
- package/dist/bridges-artboard.js +6 -4
- package/dist/bridges-artboard.js.map +1 -1
- package/dist/bridges-catalog.cjs +11 -5
- package/dist/bridges-catalog.cjs.map +1 -1
- package/dist/bridges-catalog.js +3 -3
- package/dist/bridges-charts.cjs +11 -5
- package/dist/bridges-charts.cjs.map +1 -1
- package/dist/bridges-charts.js +3 -3
- package/dist/bridges-cms.cjs +11 -5
- package/dist/bridges-cms.cjs.map +1 -1
- package/dist/bridges-cms.js +4 -4
- package/dist/bridges-code.cjs +11 -5
- package/dist/bridges-code.cjs.map +1 -1
- package/dist/bridges-code.js +3 -3
- package/dist/bridges-doc.cjs +11 -5
- package/dist/bridges-doc.cjs.map +1 -1
- package/dist/bridges-doc.js +3 -3
- package/dist/bridges-features.cjs +11 -5
- package/dist/bridges-features.cjs.map +1 -1
- package/dist/bridges-features.js +3 -3
- package/dist/bridges-files.cjs +11 -5
- package/dist/bridges-files.cjs.map +1 -1
- package/dist/bridges-files.js +3 -3
- package/dist/bridges-flow.cjs +11 -5
- package/dist/bridges-flow.cjs.map +1 -1
- package/dist/bridges-flow.js +6 -4
- package/dist/bridges-flow.js.map +1 -1
- package/dist/bridges-forms.cjs +123 -16
- package/dist/bridges-forms.cjs.map +1 -1
- package/dist/bridges-forms.js +4 -3
- package/dist/bridges-git.cjs +10 -5
- package/dist/bridges-git.cjs.map +1 -1
- package/dist/bridges-git.js +3 -3
- package/dist/bridges-grid.cjs +11 -5
- package/dist/bridges-grid.cjs.map +1 -1
- package/dist/bridges-grid.js +3 -3
- package/dist/bridges-map.cjs +11 -5
- package/dist/bridges-map.cjs.map +1 -1
- package/dist/bridges-map.js +3 -3
- package/dist/bridges-navigation.cjs +11 -5
- package/dist/bridges-navigation.cjs.map +1 -1
- package/dist/bridges-navigation.js +3 -3
- package/dist/bridges-passkeys.cjs +11 -5
- package/dist/bridges-passkeys.cjs.map +1 -1
- package/dist/bridges-passkeys.js +3 -3
- package/dist/bridges-scene.cjs +11 -5
- package/dist/bridges-scene.cjs.map +1 -1
- package/dist/bridges-scene.js +3 -3
- package/dist/bridges-screen-doc.cjs +14 -6
- package/dist/bridges-screen-doc.cjs.map +1 -1
- package/dist/bridges-screen-doc.js +4 -4
- package/dist/bridges-screens.cjs +15 -7
- package/dist/bridges-screens.cjs.map +1 -1
- package/dist/bridges-screens.js +4 -3
- package/dist/bridges-sheets.cjs +11 -5
- package/dist/bridges-sheets.cjs.map +1 -1
- package/dist/bridges-sheets.js +3 -3
- package/dist/bridges-slides.cjs +11 -5
- package/dist/bridges-slides.cjs.map +1 -1
- package/dist/bridges-slides.js +3 -3
- package/dist/bridges-terminal.cjs +11 -5
- package/dist/bridges-terminal.cjs.map +1 -1
- package/dist/bridges-terminal.js +3 -3
- package/dist/bridges-tui.cjs +1 -1
- package/dist/bridges-tui.cjs.map +1 -1
- package/dist/bridges-tui.js +2 -2
- package/dist/bridges-whiteboard.cjs +11 -5
- package/dist/bridges-whiteboard.cjs.map +1 -1
- package/dist/bridges-whiteboard.js +3 -3
- package/dist/{chunk-CZV3WUW5.js → chunk-3GFKC6OK.js} +20 -7
- package/dist/chunk-3GFKC6OK.js.map +1 -0
- package/dist/{chunk-JLHVQWOV.js → chunk-6Q3PMT7K.js} +4 -4
- package/dist/chunk-6Q3PMT7K.js.map +1 -0
- package/dist/{chunk-HOZCDDRA.js → chunk-7HHZBPDE.js} +9 -29
- package/dist/chunk-7HHZBPDE.js.map +1 -0
- package/dist/{chunk-VFWFT3OK.js → chunk-AL77RO25.js} +97 -17
- package/dist/chunk-AL77RO25.js.map +1 -0
- package/dist/{chunk-AXWMWYH5.js → chunk-C4AQ2YBW.js} +7 -6
- package/dist/chunk-C4AQ2YBW.js.map +1 -0
- package/dist/{chunk-NH6HUVXQ.js → chunk-CI5ZVHDY.js} +8 -6
- package/dist/chunk-CI5ZVHDY.js.map +1 -0
- package/dist/{chunk-5ZWNCHZS.js → chunk-CKJL5C7A.js} +8 -6
- package/dist/chunk-CKJL5C7A.js.map +1 -0
- package/dist/chunk-DPBAEWB5.js +28 -0
- package/dist/chunk-DPBAEWB5.js.map +1 -0
- package/dist/{chunk-BG3QXNM6.js → chunk-HNVHAY4A.js} +8 -6
- package/dist/chunk-HNVHAY4A.js.map +1 -0
- package/dist/{chunk-5M5ELTHE.js → chunk-KAEPC6N4.js} +8 -6
- package/dist/chunk-KAEPC6N4.js.map +1 -0
- package/dist/{chunk-3WVXAB3D.js → chunk-M423JOQ3.js} +3 -3
- package/dist/{chunk-3WVXAB3D.js.map → chunk-M423JOQ3.js.map} +1 -1
- package/dist/{chunk-SWWJUOCY.js → chunk-MKC633WU.js} +3 -3
- package/dist/{chunk-SWWJUOCY.js.map → chunk-MKC633WU.js.map} +1 -1
- package/dist/{chunk-LQB42OSA.js → chunk-MKJE6V4Z.js} +8 -6
- package/dist/chunk-MKJE6V4Z.js.map +1 -0
- package/dist/{chunk-MIDZWKIF.js → chunk-NB5AQIR2.js} +8 -6
- package/dist/chunk-NB5AQIR2.js.map +1 -0
- package/dist/{chunk-VMRUW4B4.js → chunk-OUUHFR4N.js} +8 -6
- package/dist/chunk-OUUHFR4N.js.map +1 -0
- package/dist/{chunk-FCXSR7I5.js → chunk-P6SJBP5T.js} +8 -6
- package/dist/chunk-P6SJBP5T.js.map +1 -0
- package/dist/{chunk-5JLTXHX6.js → chunk-PMPBI6I3.js} +7 -5
- package/dist/chunk-PMPBI6I3.js.map +1 -0
- package/dist/{chunk-4WVLZ6YP.js → chunk-PV4FZDYX.js} +8 -6
- package/dist/chunk-PV4FZDYX.js.map +1 -0
- package/dist/{chunk-3UUF5KKZ.js → chunk-QEVSNDJW.js} +8 -6
- package/dist/chunk-QEVSNDJW.js.map +1 -0
- package/dist/{chunk-VOCUGTZB.js → chunk-S4DA2UTJ.js} +8 -6
- package/dist/chunk-S4DA2UTJ.js.map +1 -0
- package/dist/{chunk-RVMM4BHK.js → chunk-V6EHKHSF.js} +8 -6
- package/dist/chunk-V6EHKHSF.js.map +1 -0
- package/dist/{chunk-36MKPTVD.js → chunk-VE7TRWZR.js} +8 -6
- package/dist/chunk-VE7TRWZR.js.map +1 -0
- package/dist/{chunk-Z5NL5D4J.js → chunk-VFUKZ6UA.js} +8 -6
- package/dist/chunk-VFUKZ6UA.js.map +1 -0
- package/dist/{chunk-3HVYUMQF.js → chunk-VHB3VE53.js} +8 -6
- package/dist/chunk-VHB3VE53.js.map +1 -0
- package/dist/{chunk-R4XXOGQH.js → chunk-ZDKYKJFH.js} +10 -6
- package/dist/chunk-ZDKYKJFH.js.map +1 -0
- package/dist/components-shared-whiteboard.cjs +29 -10
- package/dist/components-shared-whiteboard.cjs.map +1 -1
- package/dist/components-shared-whiteboard.js +3 -3
- package/dist/dom-navigation/index.d.cts +3 -3
- package/dist/dom-navigation/index.d.ts +3 -3
- package/dist/index.cjs +211 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +27 -26
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.cts +5 -5
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/stdio.d.cts +3 -3
- package/dist/mcp/stdio.d.ts +3 -3
- package/dist/mcp.cjs +18 -5
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/presence/index.d.cts +1 -1
- package/dist/presence/index.d.ts +1 -1
- package/dist/{server-1y0n61R5.d.cts → server-DJJygNo1.d.cts} +2 -2
- package/dist/{server-vq6qVl3T.d.ts → server-Dwo9LOxh.d.ts} +2 -2
- package/dist/sharing/index.d.cts +3 -3
- package/dist/sharing/index.d.ts +3 -3
- package/dist/sheets-adapter.d.cts +3 -3
- package/dist/sheets-adapter.d.ts +3 -3
- package/dist/{tool-host-LYfdPE8u.d.ts → tool-host-BBSaU7IJ.d.cts} +10 -4
- package/dist/{tool-host-D67N2a2h.d.cts → tool-host-BqJRPr_T.d.ts} +10 -4
- package/dist/{types-DP5yQZQU.d.cts → types-D_H2f-wF.d.cts} +1 -1
- package/dist/{types-VX_9je7w.d.ts → types-D_TzdBsK.d.ts} +1 -1
- package/dist/{types-gzIpsUDE.d.cts → types-ITRQFAir.d.cts} +26 -1
- package/dist/{types-gzIpsUDE.d.ts → types-ITRQFAir.d.ts} +26 -1
- package/dist/undo/index.d.cts +2 -2
- package/dist/undo/index.d.ts +2 -2
- package/dist/undo.cjs +7 -3
- package/dist/undo.cjs.map +1 -1
- package/dist/undo.js +3 -3
- package/docs/multi-form-hosts.md +97 -0
- package/package.json +1 -1
- package/dist/chunk-36MKPTVD.js.map +0 -1
- package/dist/chunk-3HVYUMQF.js.map +0 -1
- package/dist/chunk-3UUF5KKZ.js.map +0 -1
- package/dist/chunk-4WVLZ6YP.js.map +0 -1
- package/dist/chunk-5JLTXHX6.js.map +0 -1
- package/dist/chunk-5M5ELTHE.js.map +0 -1
- package/dist/chunk-5ZWNCHZS.js.map +0 -1
- package/dist/chunk-AXWMWYH5.js.map +0 -1
- package/dist/chunk-BG3QXNM6.js.map +0 -1
- package/dist/chunk-CZV3WUW5.js.map +0 -1
- package/dist/chunk-FCXSR7I5.js.map +0 -1
- package/dist/chunk-HOZCDDRA.js.map +0 -1
- package/dist/chunk-JLHVQWOV.js.map +0 -1
- package/dist/chunk-LQB42OSA.js.map +0 -1
- package/dist/chunk-MIDZWKIF.js.map +0 -1
- package/dist/chunk-NH6HUVXQ.js.map +0 -1
- package/dist/chunk-R4XXOGQH.js.map +0 -1
- package/dist/chunk-RVMM4BHK.js.map +0 -1
- package/dist/chunk-VFWFT3OK.js.map +0 -1
- package/dist/chunk-VMRUW4B4.js.map +0 -1
- package/dist/chunk-VOCUGTZB.js.map +0 -1
- package/dist/chunk-Z5NL5D4J.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.52.0] - 2026-10-30
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **Form bridge waits for the host to accept a write.** `setValue` and
|
|
19
|
+
`setValues` on `FormBridgeAdapter` may now return a Promise resolving to
|
|
20
|
+
`void` or the new exported `FormAdapterResult`
|
|
21
|
+
(`{ ok: true } | { ok: false; error; code? }`); the return type is the new
|
|
22
|
+
exported `FormAdapterCommit`. The bridge awaits it: `form_set_value` and
|
|
23
|
+
`form_set_values` report success, and emit their `AgentActivity` event, only
|
|
24
|
+
after the host accepts. A rejection or `{ ok: false }` is that call's error
|
|
25
|
+
result with the host's message (never a stack) and emits no activity. Use
|
|
26
|
+
`{ ok: false, code: "stale" }` to refuse a stale draft; the bridge adds no
|
|
27
|
+
expected-value argument because the host's write is the authority.
|
|
28
|
+
**Nothing to do:** sync `void` setters behave exactly as before.
|
|
29
|
+
- Without `setValues`, `form_set_values` awaits `setValue` once per field and
|
|
30
|
+
stops at the first refusal. The error names the fields already committed,
|
|
31
|
+
`structuredContent` carries `{ committed, failed, notAttempted }`, and one
|
|
32
|
+
activity event is emitted for the committed fields.
|
|
33
|
+
- `FormAdapterResult`, `FormAdapterCommit` and `FormConfirmRequest` are now
|
|
34
|
+
exported from the package root as well as `…/bridges/forms`.
|
|
35
|
+
- `docs/multi-form-hosts.md`: a design note on supporting several forms on one
|
|
36
|
+
host. It is a proposal only; today the supported model is one form bridge per
|
|
37
|
+
host.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **Form bridge reported success before an async host had accepted the write.**
|
|
42
|
+
The setter was typed `void` and called without `await`, so a host with a
|
|
43
|
+
gated or refusable write got "success" and an activity event first, and a
|
|
44
|
+
later refusal was never the tool call's result.
|
|
45
|
+
- **Disposing a form bridge mid-call no longer leaves the call hanging.** A
|
|
46
|
+
write, confirm or submit still pending when the bridge is disposed now settles
|
|
47
|
+
at once as an error saying the outcome is unknown, with no activity. A late
|
|
48
|
+
settle from the host is ignored, and a late rejection is never unhandled. A
|
|
49
|
+
submit whose human confirm was pending when the form closed is never sent.
|
|
50
|
+
- The `registerFormBridge` doc comment still said a host could register several
|
|
51
|
+
form bridges by giving each a distinct id. That has not worked since 0.51.0.
|
|
52
|
+
It now says one form bridge per host.
|
|
53
|
+
|
|
54
|
+
## [0.51.0] - 2026-10-27
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
|
|
58
|
+
- **BREAKING: `registerTool` refuses a tool name already held by a different
|
|
59
|
+
registrant.** It used to replace the existing tool silently, so when two
|
|
60
|
+
bridges or two agents in one app registered the same name, the second won.
|
|
61
|
+
The first stayed in `tools/list`, but every call reached the second handler
|
|
62
|
+
and nothing reported it. That breaks multi-agent apps. It now throws an
|
|
63
|
+
`Error` naming the tool and both owners, and leaves the first registration in
|
|
64
|
+
place.
|
|
65
|
+
**What to do:**
|
|
66
|
+
- **If you only use the bridges, nothing.** Every first-party bridge now
|
|
67
|
+
registers under its bridge id (`"whiteboard"`, `` `chart:${adapter.id}` ``,
|
|
68
|
+
`` `form:${adapter.id}` ``, …), so a remount of the same bridge still
|
|
69
|
+
re-registers, with or without a dispose in between. The shared undo tools
|
|
70
|
+
(`agent_undo` / `agent_redo` / `agent_history`) register under one owner,
|
|
71
|
+
`"agent-undo"`, so `ensureUndoToolsRegistered` and a direct
|
|
72
|
+
`registerUndoTools` call on the same host still coexist, as the showcase
|
|
73
|
+
playground does. A census of every first-party bridge found **no two
|
|
74
|
+
bridges sharing a tool name**, and all of them mount on one host together.
|
|
75
|
+
- **If you mount two instances of a multi-instance bridge on ONE host** (two
|
|
76
|
+
charts, grids, code editors, forms, scenes, catalogs, feature panels or
|
|
77
|
+
passkey surfaces with different adapter ids), the second now throws. Their
|
|
78
|
+
tool names were never instance-scoped, so the second instance had already
|
|
79
|
+
taken over the first's tools and the first was not drivable. Give each
|
|
80
|
+
instance its own host, or drive both through one adapter.
|
|
81
|
+
- **If you call `registerTool` yourself**, pass `{ owner: "<your surface>" }`.
|
|
82
|
+
The same owner may re-register its own names. A registration with no owner
|
|
83
|
+
can be identified by nothing, so it never counts as the same registrant:
|
|
84
|
+
registering an unowned name twice without disposing the first now throws.
|
|
85
|
+
If you re-register by name on purpose to swap a handler, either pass the
|
|
86
|
+
same `owner` both times or pass `{ replace: true }`, the explicit opt-in for
|
|
87
|
+
the old behaviour. No first-party consumer relies on overwriting another
|
|
88
|
+
registrant: `fancy-flow-mcp-js` registers each name once per server, and
|
|
89
|
+
the only repeat in the showcase is the playground registering the undo
|
|
90
|
+
tools itself before its bridges ensure them, which is one owner.
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- `RegisterToolOptions` (`owner`, `replace`), the optional third argument of
|
|
95
|
+
`ToolHost.registerTool`, exported from the package root and `/mcp`. Custom
|
|
96
|
+
`ToolHost` implementations keep compiling: the argument is optional.
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
|
|
100
|
+
- **A late disposer no longer withdraws the registration that replaced it.** A
|
|
101
|
+
disposer used to delete whatever held the name, so a remount whose first
|
|
102
|
+
cleanup ran after the second mount unregistered the live tool. A disposer now
|
|
103
|
+
removes only the registration it returned from.
|
|
104
|
+
|
|
14
105
|
## [0.50.0] - 2026-10-27
|
|
15
106
|
|
|
16
107
|
### Fixed
|
package/README.md
CHANGED
|
@@ -140,6 +140,64 @@ registerScreensBridge(host, {
|
|
|
140
140
|
The screens bridge pushes **no undo entries**: `agent_undo` cannot revert a
|
|
141
141
|
screens tool. Keep your own history if you need to.
|
|
142
142
|
|
|
143
|
+
### Form bridge: acknowledge after the host accepts the write
|
|
144
|
+
|
|
145
|
+
`setValue` and `setValues` on `FormBridgeAdapter` may return `void` **or** a
|
|
146
|
+
Promise (`FormAdapterCommit`). A sync `void` setter behaves exactly as it always
|
|
147
|
+
has. When the host's write is authoritative (a persisted draft, a server that
|
|
148
|
+
can refuse it or report it stale), return a Promise and the bridge waits for it:
|
|
149
|
+
|
|
150
|
+
- `form_set_value` / `form_set_values` report success, and emit their
|
|
151
|
+
`AgentActivity` event, only after the promise resolves to `void` or
|
|
152
|
+
`{ ok: true }`. Your `getValue` / `getValues` should return the new value by
|
|
153
|
+
then, so a read straight after a success sees it.
|
|
154
|
+
- A rejection, or a resolved `{ ok: false, error }` (`FormAdapterResult`), is
|
|
155
|
+
**that call's** error result, carrying the host's `error` text (its message
|
|
156
|
+
only, never a stack), and emits **no** activity. Leave your state unchanged
|
|
157
|
+
when you refuse.
|
|
158
|
+
- Without `setValues`, `form_set_values` awaits `setValue` once per field, in
|
|
159
|
+
order, and stops at the first refusal. Earlier fields stay committed (that
|
|
160
|
+
path is not atomic): the error names them, `structuredContent` carries
|
|
161
|
+
`{ committed, failed, notAttempted }`, and one activity event is emitted for
|
|
162
|
+
the committed part. Provide `setValues` if the batch must be all-or-nothing.
|
|
163
|
+
- If you `dispose()` the bridge (the form closes) while a write, a confirm or a
|
|
164
|
+
submit is pending, the call settles at once as an error saying the outcome is
|
|
165
|
+
unknown, emits no activity, and a later settle is ignored. A submit whose
|
|
166
|
+
human confirm was still pending is never sent.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import {
|
|
170
|
+
registerFormBridge,
|
|
171
|
+
type FormAdapterResult,
|
|
172
|
+
} from "@particle-academy/agent-integrations/bridges/forms";
|
|
173
|
+
|
|
174
|
+
registerFormBridge(host, {
|
|
175
|
+
adapter: {
|
|
176
|
+
id: "invoice-draft",
|
|
177
|
+
getFields: () => fields,
|
|
178
|
+
getValue: (name) => draft.values[name],
|
|
179
|
+
getValues: () => ({ ...draft.values }),
|
|
180
|
+
// Resolve once the server has accepted it; refuse with a reason the agent can act on.
|
|
181
|
+
setValue: async (name, value): Promise<FormAdapterResult> => {
|
|
182
|
+
const res = await api.patch(`/drafts/${draft.id}`, { [name]: value, version: draft.version });
|
|
183
|
+
if (!res.ok) return { ok: false, error: res.reason, code: res.status === 409 ? "stale" : undefined };
|
|
184
|
+
draft = res.draft; // update state BEFORE resolving
|
|
185
|
+
return { ok: true };
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Staleness is the host's call.** The bridge has no expected-value / version
|
|
192
|
+
argument: your write is the authority, so check your own version or ETag there
|
|
193
|
+
and refuse with `{ ok: false, error: "Draft changed since you read it; re-read
|
|
194
|
+
and retry", code: "stale" }`. The agent gets that sentence as the tool error.
|
|
195
|
+
|
|
196
|
+
The form bridge pushes **no undo entries**, and **one form bridge per host**:
|
|
197
|
+
since 0.51.0 a second form bridge with a different `id` on the same host throws,
|
|
198
|
+
because the tool names are not scoped to the form. See
|
|
199
|
+
[`docs/multi-form-hosts.md`](./docs/multi-form-hosts.md).
|
|
200
|
+
|
|
143
201
|
`registerScreenDocBridge` edits the nodes inside one screen and exports its
|
|
144
202
|
`DocAdapter`, `ScreenDocBridgeOptions`, `ScreenDocNode` and `ScreenDocOp` types
|
|
145
203
|
from `@particle-academy/agent-integrations/bridges/screen-doc`. The existing
|
|
@@ -198,6 +256,17 @@ ends are delivered before the transport closes.
|
|
|
198
256
|
Import `/mcp/stdio` only from Node. Browser bundles import `/mcp`, which never
|
|
199
257
|
pulls it in.
|
|
200
258
|
|
|
259
|
+
**A tool name belongs to whoever registered it.** `registerTool` throws when a
|
|
260
|
+
name is already held by a different registrant, and the error names both. Pass
|
|
261
|
+
`{ owner }` to identify yourself: the same owner may register a name again (a
|
|
262
|
+
React remount does), and every bridge already registers under its bridge id.
|
|
263
|
+
Disposing frees the name. To take over another registrant's tool on purpose,
|
|
264
|
+
pass `{ replace: true }`.
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
server.registerTool(definition, handler, { owner: "support-triage" });
|
|
268
|
+
```
|
|
269
|
+
|
|
201
270
|
## Connect an agent to your app — `<ConnectorButtons>`
|
|
202
271
|
|
|
203
272
|
The step *before* presence: getting your MCP server installed in the user's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Transport-level JSON shapes. These intentionally mirror fancy-artboard's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Transport-level JSON shapes. These intentionally mirror fancy-artboard's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Headless bridge for `@particle-academy/fancy-catalog` — a Stripe catalog with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Headless bridge for `@particle-academy/fancy-catalog` — a Stripe catalog with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Adapter wires a single fancy-echarts chart to the bridge. Charts are
|
package/dist/bridges/charts.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Adapter wires a single fancy-echarts chart to the bridge. Charts are
|
package/dist/bridges/cms.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
3
|
import { DocAdapter } from './doc.cjs';
|
|
4
4
|
import { StyledNode, StagePolicy, TreeOp, StyleProps, LayoutMode, DocReducer, DocTree } from '@particle-academy/fancy-doc-commons';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-ITRQFAir.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* registerCmsBridge — the greenfield CMS agent bridge, built entirely on
|
package/dist/bridges/cms.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
3
|
import { DocAdapter } from './doc.js';
|
|
4
4
|
import { StyledNode, StagePolicy, TreeOp, StyleProps, LayoutMode, DocReducer, DocTree } from '@particle-academy/fancy-doc-commons';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-ITRQFAir.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* registerCmsBridge — the greenfield CMS agent bridge, built entirely on
|
package/dist/bridges/code.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Adapter the host wires to a fancy-code CodeEditor (typically via the
|
package/dist/bridges/code.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Adapter the host wires to a fancy-code CodeEditor (typically via the
|
package/dist/bridges/doc.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { J as JsonObject } from '../types-
|
|
3
|
-
import { B as Bridge } from '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { J as JsonObject } from '../types-ITRQFAir.cjs';
|
|
3
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
4
4
|
import { DocNode, DocTree, TreeOp, DocReducer, StagePolicy } from '@particle-academy/fancy-doc-commons';
|
|
5
5
|
|
|
6
6
|
/** Host-provided access to the document tree. */
|
package/dist/bridges/doc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { J as JsonObject } from '../types-
|
|
3
|
-
import { B as Bridge } from '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { J as JsonObject } from '../types-ITRQFAir.js';
|
|
3
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
4
4
|
import { DocNode, DocTree, TreeOp, DocReducer, StagePolicy } from '@particle-academy/fancy-doc-commons';
|
|
5
5
|
|
|
6
6
|
/** Host-provided access to the document tree. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Headless bridge for `@particle-academy/fancy-features` — feature management
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Headless bridge for `@particle-academy/fancy-features` — feature management
|
package/dist/bridges/files.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
type FileKind = "file" | "dir";
|
|
6
6
|
type FileEntry = {
|
package/dist/bridges/files.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
type FileKind = "file" | "dir";
|
|
6
6
|
type FileEntry = {
|
package/dist/bridges/flow.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
type FlowNode = {
|
|
6
6
|
id: string;
|
package/dist/bridges/flow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
type FlowNode = {
|
|
6
6
|
id: string;
|
package/dist/bridges/forms.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Field descriptor — what the host says about each form field. Mirrors the
|
|
@@ -29,6 +29,14 @@ type FormFieldDescriptor = {
|
|
|
29
29
|
* Adapter the host wires per form. Matches the controlled-state pattern
|
|
30
30
|
* react-fancy already uses (`value` / `onValueChange`); this adapter just
|
|
31
31
|
* exposes those state slots in a form-shaped way the bridge can call.
|
|
32
|
+
*
|
|
33
|
+
* `setValue` / `setValues` may be sync (`void`) or async (a Promise); see
|
|
34
|
+
* {@link FormAdapterCommit}. Return a Promise when the host's write is
|
|
35
|
+
* authoritative — a persisted draft, or one the host can refuse or report
|
|
36
|
+
* stale — so the agent is told the truth instead of "success" before anything
|
|
37
|
+
* was accepted.
|
|
38
|
+
*
|
|
39
|
+
* This bridge pushes NO undo entries: `agent_undo` cannot revert a form write.
|
|
32
40
|
*/
|
|
33
41
|
type FormBridgeAdapter = {
|
|
34
42
|
/** Stable id for the form (used in form_describe + presence target). */
|
|
@@ -44,10 +52,18 @@ type FormBridgeAdapter = {
|
|
|
44
52
|
getValue: (name: string) => unknown;
|
|
45
53
|
/** Read all values as { fieldName: value }. */
|
|
46
54
|
getValues: () => Record<string, unknown>;
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Set a single field's value. The host wires this to its setState, or to
|
|
57
|
+
* an authoritative write it awaits. Sync `void` behaves as it always has; a
|
|
58
|
+
* Promise is awaited, and a rejection or `{ ok: false }` is the tool's error.
|
|
59
|
+
*/
|
|
60
|
+
setValue: (name: string, value: unknown) => FormAdapterCommit;
|
|
61
|
+
/**
|
|
62
|
+
* Set many at once, ideally as one host commit. Same sync/async contract as
|
|
63
|
+
* `setValue`. When absent, the bridge awaits `setValue` once per field in
|
|
64
|
+
* order and stops at the first refusal (so that path is NOT atomic).
|
|
65
|
+
*/
|
|
66
|
+
setValues?: (values: Record<string, unknown>) => FormAdapterCommit;
|
|
51
67
|
/** Programmatically focus a field (host implements DOM focus). Optional. */
|
|
52
68
|
focus?: (name: string) => void;
|
|
53
69
|
/** Submit the form. Returns the values that were submitted (or rejection). */
|
|
@@ -64,6 +80,31 @@ type FormBridgeAdapter = {
|
|
|
64
80
|
*/
|
|
65
81
|
confirm?: (request: FormConfirmRequest) => Promise<boolean> | boolean;
|
|
66
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* What an async `setValue` / `setValues` may resolve to, to acknowledge (or
|
|
85
|
+
* refuse) a write. `{ ok: false }` is a refusal the agent can act on: `error`
|
|
86
|
+
* is shown to the agent verbatim, so keep it a human-readable sentence (e.g.
|
|
87
|
+
* "Draft changed since you read it; re-read and retry"), never a stack trace or
|
|
88
|
+
* an internal path. `code` (e.g. `"stale"`, `"forbidden"`) is for the host's own
|
|
89
|
+
* use; it is not shown to the agent.
|
|
90
|
+
*/
|
|
91
|
+
type FormAdapterResult = {
|
|
92
|
+
ok: true;
|
|
93
|
+
} | {
|
|
94
|
+
ok: false;
|
|
95
|
+
error: string;
|
|
96
|
+
code?: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Return type of `setValue` / `setValues`. A sync `void` return keeps the
|
|
100
|
+
* original behaviour. A Promise makes the bridge WAIT: the tool reports
|
|
101
|
+
* success, and emits its AgentActivity event, only after the promise resolves
|
|
102
|
+
* (to `void` or `{ ok: true }`). A rejection or `{ ok: false }` becomes that
|
|
103
|
+
* tool call's error result and emits no activity. If the bridge is disposed
|
|
104
|
+
* while the write is pending, the call settles at once as an error saying the
|
|
105
|
+
* outcome is unknown, and a later settle is ignored.
|
|
106
|
+
*/
|
|
107
|
+
type FormAdapterCommit = void | Promise<void | FormAdapterResult>;
|
|
67
108
|
/** What a `form_submit` confirm gate is asked to approve. */
|
|
68
109
|
type FormConfirmRequest = {
|
|
69
110
|
action: "submit";
|
|
@@ -89,9 +130,13 @@ type FormBridgeOptions = {
|
|
|
89
130
|
};
|
|
90
131
|
/**
|
|
91
132
|
* registerFormBridge — wires schema-driven MCP access to a single form.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
133
|
+
*
|
|
134
|
+
* ONE form bridge per host. The tool names (`form_set_value`, …) are not
|
|
135
|
+
* scoped to the form id, so since 0.51.0 a second form bridge with a different
|
|
136
|
+
* adapter id on the same host throws (the duplicate-registrant refusal); a
|
|
137
|
+
* remount of the SAME form re-registers fine. For several forms, give each its
|
|
138
|
+
* own host for now — see `docs/multi-form-hosts.md`.
|
|
94
139
|
*/
|
|
95
140
|
declare function registerFormBridge(host: ToolHost, options: FormBridgeOptions): Bridge;
|
|
96
141
|
|
|
97
|
-
export { type FormBridgeAdapter, type FormBridgeOptions, type FormConfirmRequest, type FormFieldDescriptor, registerFormBridge };
|
|
142
|
+
export { type FormAdapterCommit, type FormAdapterResult, type FormBridgeAdapter, type FormBridgeOptions, type FormConfirmRequest, type FormFieldDescriptor, registerFormBridge };
|
package/dist/bridges/forms.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Field descriptor — what the host says about each form field. Mirrors the
|
|
@@ -29,6 +29,14 @@ type FormFieldDescriptor = {
|
|
|
29
29
|
* Adapter the host wires per form. Matches the controlled-state pattern
|
|
30
30
|
* react-fancy already uses (`value` / `onValueChange`); this adapter just
|
|
31
31
|
* exposes those state slots in a form-shaped way the bridge can call.
|
|
32
|
+
*
|
|
33
|
+
* `setValue` / `setValues` may be sync (`void`) or async (a Promise); see
|
|
34
|
+
* {@link FormAdapterCommit}. Return a Promise when the host's write is
|
|
35
|
+
* authoritative — a persisted draft, or one the host can refuse or report
|
|
36
|
+
* stale — so the agent is told the truth instead of "success" before anything
|
|
37
|
+
* was accepted.
|
|
38
|
+
*
|
|
39
|
+
* This bridge pushes NO undo entries: `agent_undo` cannot revert a form write.
|
|
32
40
|
*/
|
|
33
41
|
type FormBridgeAdapter = {
|
|
34
42
|
/** Stable id for the form (used in form_describe + presence target). */
|
|
@@ -44,10 +52,18 @@ type FormBridgeAdapter = {
|
|
|
44
52
|
getValue: (name: string) => unknown;
|
|
45
53
|
/** Read all values as { fieldName: value }. */
|
|
46
54
|
getValues: () => Record<string, unknown>;
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Set a single field's value. The host wires this to its setState, or to
|
|
57
|
+
* an authoritative write it awaits. Sync `void` behaves as it always has; a
|
|
58
|
+
* Promise is awaited, and a rejection or `{ ok: false }` is the tool's error.
|
|
59
|
+
*/
|
|
60
|
+
setValue: (name: string, value: unknown) => FormAdapterCommit;
|
|
61
|
+
/**
|
|
62
|
+
* Set many at once, ideally as one host commit. Same sync/async contract as
|
|
63
|
+
* `setValue`. When absent, the bridge awaits `setValue` once per field in
|
|
64
|
+
* order and stops at the first refusal (so that path is NOT atomic).
|
|
65
|
+
*/
|
|
66
|
+
setValues?: (values: Record<string, unknown>) => FormAdapterCommit;
|
|
51
67
|
/** Programmatically focus a field (host implements DOM focus). Optional. */
|
|
52
68
|
focus?: (name: string) => void;
|
|
53
69
|
/** Submit the form. Returns the values that were submitted (or rejection). */
|
|
@@ -64,6 +80,31 @@ type FormBridgeAdapter = {
|
|
|
64
80
|
*/
|
|
65
81
|
confirm?: (request: FormConfirmRequest) => Promise<boolean> | boolean;
|
|
66
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* What an async `setValue` / `setValues` may resolve to, to acknowledge (or
|
|
85
|
+
* refuse) a write. `{ ok: false }` is a refusal the agent can act on: `error`
|
|
86
|
+
* is shown to the agent verbatim, so keep it a human-readable sentence (e.g.
|
|
87
|
+
* "Draft changed since you read it; re-read and retry"), never a stack trace or
|
|
88
|
+
* an internal path. `code` (e.g. `"stale"`, `"forbidden"`) is for the host's own
|
|
89
|
+
* use; it is not shown to the agent.
|
|
90
|
+
*/
|
|
91
|
+
type FormAdapterResult = {
|
|
92
|
+
ok: true;
|
|
93
|
+
} | {
|
|
94
|
+
ok: false;
|
|
95
|
+
error: string;
|
|
96
|
+
code?: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Return type of `setValue` / `setValues`. A sync `void` return keeps the
|
|
100
|
+
* original behaviour. A Promise makes the bridge WAIT: the tool reports
|
|
101
|
+
* success, and emits its AgentActivity event, only after the promise resolves
|
|
102
|
+
* (to `void` or `{ ok: true }`). A rejection or `{ ok: false }` becomes that
|
|
103
|
+
* tool call's error result and emits no activity. If the bridge is disposed
|
|
104
|
+
* while the write is pending, the call settles at once as an error saying the
|
|
105
|
+
* outcome is unknown, and a later settle is ignored.
|
|
106
|
+
*/
|
|
107
|
+
type FormAdapterCommit = void | Promise<void | FormAdapterResult>;
|
|
67
108
|
/** What a `form_submit` confirm gate is asked to approve. */
|
|
68
109
|
type FormConfirmRequest = {
|
|
69
110
|
action: "submit";
|
|
@@ -89,9 +130,13 @@ type FormBridgeOptions = {
|
|
|
89
130
|
};
|
|
90
131
|
/**
|
|
91
132
|
* registerFormBridge — wires schema-driven MCP access to a single form.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
133
|
+
*
|
|
134
|
+
* ONE form bridge per host. The tool names (`form_set_value`, …) are not
|
|
135
|
+
* scoped to the form id, so since 0.51.0 a second form bridge with a different
|
|
136
|
+
* adapter id on the same host throws (the duplicate-registrant refusal); a
|
|
137
|
+
* remount of the SAME form re-registers fine. For several forms, give each its
|
|
138
|
+
* own host for now — see `docs/multi-form-hosts.md`.
|
|
94
139
|
*/
|
|
95
140
|
declare function registerFormBridge(host: ToolHost, options: FormBridgeOptions): Bridge;
|
|
96
141
|
|
|
97
|
-
export { type FormBridgeAdapter, type FormBridgeOptions, type FormConfirmRequest, type FormFieldDescriptor, registerFormBridge };
|
|
142
|
+
export { type FormAdapterCommit, type FormAdapterResult, type FormBridgeAdapter, type FormBridgeOptions, type FormConfirmRequest, type FormFieldDescriptor, registerFormBridge };
|
package/dist/bridges/git.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
type GitProposal = {
|
|
6
6
|
operation: string;
|
package/dist/bridges/git.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
type GitProposal = {
|
|
6
6
|
operation: string;
|
package/dist/bridges/grid.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Loose grid types — the public state shape of `@particle-academy/fancy-grid`,
|
package/dist/bridges/grid.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BqJRPr_T.js';
|
|
2
|
+
import { B as Bridge } from '../types-D_TzdBsK.js';
|
|
3
|
+
import '../types-ITRQFAir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Loose grid types — the public state shape of `@particle-academy/fancy-grid`,
|
package/dist/bridges/map.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ToolHost } from '../tool-host-
|
|
2
|
-
import { B as Bridge } from '../types-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { T as ToolHost } from '../tool-host-BBSaU7IJ.cjs';
|
|
2
|
+
import { B as Bridge } from '../types-D_H2f-wF.cjs';
|
|
3
|
+
import '../types-ITRQFAir.cjs';
|
|
4
4
|
|
|
5
5
|
type LatLng = {
|
|
6
6
|
lat: number;
|