car-runtime 0.9.0 → 0.10.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/index.d.ts +16 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -642,8 +642,11 @@ export class CarRuntime {
|
|
|
642
642
|
|
|
643
643
|
/**
|
|
644
644
|
* Execute a proposal through a CarRuntime with a JS tool callback.
|
|
645
|
-
* The callback receives
|
|
646
|
-
*
|
|
645
|
+
* The callback receives
|
|
646
|
+
* `{"tool":"name","params":{...},"action_id":"<id>"}` as a JSON
|
|
647
|
+
* string and must return a JSON string. `action_id` is the
|
|
648
|
+
* originating `Action.id` from the proposal — useful for routing
|
|
649
|
+
* when the same callback closes over multiple in-flight calls.
|
|
647
650
|
*
|
|
648
651
|
* `sessionId`, when provided, scopes per-action policy validation to
|
|
649
652
|
* the named session opened via `CarRuntime.openSession()`. Global
|
|
@@ -844,10 +847,17 @@ export function registerVoiceEventHandler(
|
|
|
844
847
|
* proposal carrying host-owned tools, every tool routes through
|
|
845
848
|
* this handler.
|
|
846
849
|
*
|
|
847
|
-
* `handlerFn(callJson)` receives
|
|
848
|
-
* as a JSON
|
|
849
|
-
*
|
|
850
|
-
*
|
|
850
|
+
* `handlerFn(callJson)` receives
|
|
851
|
+
* `{"tool":"name","params":{...},"action_id":"<id>"}` as a JSON
|
|
852
|
+
* string and MUST return a Promise resolving to the tool's
|
|
853
|
+
* JSON-encoded result. Throwing rejects the daemon-side action
|
|
854
|
+
* with a -32000 JSON-RPC error.
|
|
855
|
+
*
|
|
856
|
+
* `action_id` carries the originating `Action.id` from the
|
|
857
|
+
* proposal so process-wide handlers can route concurrent
|
|
858
|
+
* callbacks back to the right per-call closure. Empty string when
|
|
859
|
+
* the daemon's `tools.execute` payload omits it (legacy daemons;
|
|
860
|
+
* not expected on >=0.9.x).
|
|
851
861
|
*
|
|
852
862
|
* Process-wide setter — re-calling overwrites the previous
|
|
853
863
|
* handler. Pair with `unregisterToolHandler` to clear. Symmetric
|