@skydiveai/pi-extensions 0.1.0-beta.2814 → 0.1.0-beta.2818
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/dist/index.mjs +21 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4375,8 +4375,28 @@ function createProactiveResultExtension({ channelContext }) {
|
|
|
4375
4375
|
} });
|
|
4376
4376
|
if (response.status === 404) return;
|
|
4377
4377
|
if (!response.ok) throw new Error(`proactive result discovery failed: ${response.status}`);
|
|
4378
|
-
const { tool } = await response.json();
|
|
4378
|
+
const { tool, destinationsTool } = await response.json();
|
|
4379
4379
|
if (!tool) return;
|
|
4380
|
+
if (destinationsTool) pi.registerTool({
|
|
4381
|
+
name: destinationsTool.name,
|
|
4382
|
+
label: "List proactive delivery destinations",
|
|
4383
|
+
description: destinationsTool.description,
|
|
4384
|
+
parameters: Type.Unsafe(destinationsTool.parameters),
|
|
4385
|
+
async execute(_toolCallId, _input, signal) {
|
|
4386
|
+
const listed = await client["proactive-result"].destinations.$get({ query: {
|
|
4387
|
+
runId,
|
|
4388
|
+
messageId
|
|
4389
|
+
} }, { init: { signal } });
|
|
4390
|
+
return {
|
|
4391
|
+
content: [{
|
|
4392
|
+
type: "text",
|
|
4393
|
+
text: await listed.text()
|
|
4394
|
+
}],
|
|
4395
|
+
isError: !listed.ok,
|
|
4396
|
+
details: {}
|
|
4397
|
+
};
|
|
4398
|
+
}
|
|
4399
|
+
});
|
|
4380
4400
|
pi.registerTool({
|
|
4381
4401
|
name: tool.name,
|
|
4382
4402
|
label: "Submit proactive result",
|