@skydiveai/pi-extensions 0.1.0-beta.2730 → 0.1.0-beta.2732
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/README.md +3 -6
- package/dist/index.mjs +3 -63
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,12 +20,9 @@ stores the result for the originating evaluation. Ordinary sessions do not
|
|
|
20
20
|
discover or register this tool. Submission does not deliver a message; the
|
|
21
21
|
worker reconciles it only after the run succeeds.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
reviewed pi-extensions release and opt-in harness upgrade, not by rewriting
|
|
27
|
-
their harness files. Already-started v1/v2/v3 evaluations retain text-result
|
|
28
|
-
compatibility.
|
|
23
|
+
The native tool reaches agents through the normal reviewed pi-extensions
|
|
24
|
+
release and opt-in harness upgrade, not by rewriting their harness files.
|
|
25
|
+
Already-started v1/v2/v3 evaluations retain text-result compatibility.
|
|
29
26
|
|
|
30
27
|
Platform layer:
|
|
31
28
|
|
package/dist/index.mjs
CHANGED
|
@@ -4351,12 +4351,6 @@ function createSubagentExtension({ channelContext }) {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
//#endregion
|
|
4353
4353
|
//#region src/extensions/proactive-result.ts
|
|
4354
|
-
const proactiveShadowTool = {
|
|
4355
|
-
name: "get_latest_proactive_shadow_result",
|
|
4356
|
-
label: "Review proactive shadow result",
|
|
4357
|
-
description: "Use when your creator or an organization owner/admin asks what you most recently considered doing proactively or why. Returns the latest completed scheduled shadow evaluation, which is hypothetical and was not delivered. Explain the stored result faithfully without claiming that its proposed action or message was performed or sent.",
|
|
4358
|
-
parameters: Type.Object({}, { additionalProperties: false })
|
|
4359
|
-
};
|
|
4360
4354
|
const contextSchema = z.object({
|
|
4361
4355
|
proactiveAction: z.literal(true).optional(),
|
|
4362
4356
|
runId: z.string().uuid(),
|
|
@@ -4370,67 +4364,13 @@ function createProactiveResultExtension({ channelContext }) {
|
|
|
4370
4364
|
} catch (_error) {
|
|
4371
4365
|
return;
|
|
4372
4366
|
}
|
|
4373
|
-
if (!context.success) return;
|
|
4374
|
-
const {
|
|
4367
|
+
if (!context.success || !context.data.proactiveAction) return;
|
|
4368
|
+
const { runId, messageId } = context.data;
|
|
4375
4369
|
let registered = false;
|
|
4376
4370
|
pi.on("session_start", async () => {
|
|
4377
4371
|
if (registered) return;
|
|
4378
4372
|
const client = sandboxClient();
|
|
4379
4373
|
if (!client) return;
|
|
4380
|
-
if (!proactiveAction) {
|
|
4381
|
-
pi.registerTool({
|
|
4382
|
-
...proactiveShadowTool,
|
|
4383
|
-
async execute(_toolCallId, _params, signal) {
|
|
4384
|
-
try {
|
|
4385
|
-
const response = await client["proactive-result"]["latest-shadow"].$get({ query: {
|
|
4386
|
-
runId,
|
|
4387
|
-
messageId
|
|
4388
|
-
} }, { init: { signal } });
|
|
4389
|
-
if (response.status === 404) return {
|
|
4390
|
-
content: [{
|
|
4391
|
-
type: "text",
|
|
4392
|
-
text: "Proactive shadow result review is not available yet."
|
|
4393
|
-
}],
|
|
4394
|
-
isError: false,
|
|
4395
|
-
details: {}
|
|
4396
|
-
};
|
|
4397
|
-
if (!response.ok) throw new Error(`proactive shadow result lookup failed: ${response.status}`);
|
|
4398
|
-
const { result } = await response.json();
|
|
4399
|
-
if (!result) return {
|
|
4400
|
-
content: [{
|
|
4401
|
-
type: "text",
|
|
4402
|
-
text: "No completed scheduled shadow result is available to this conversation."
|
|
4403
|
-
}],
|
|
4404
|
-
isError: false,
|
|
4405
|
-
details: {}
|
|
4406
|
-
};
|
|
4407
|
-
return {
|
|
4408
|
-
content: [{
|
|
4409
|
-
type: "text",
|
|
4410
|
-
text: JSON.stringify({
|
|
4411
|
-
result,
|
|
4412
|
-
reminder: "This was a shadow evaluation. Nothing in it was performed or delivered."
|
|
4413
|
-
})
|
|
4414
|
-
}],
|
|
4415
|
-
isError: false,
|
|
4416
|
-
details: {}
|
|
4417
|
-
};
|
|
4418
|
-
} catch (err) {
|
|
4419
|
-
logger.warn({ err }, "proactive shadow result lookup failed");
|
|
4420
|
-
return {
|
|
4421
|
-
content: [{
|
|
4422
|
-
type: "text",
|
|
4423
|
-
text: "The proactive shadow result could not be retrieved."
|
|
4424
|
-
}],
|
|
4425
|
-
isError: true,
|
|
4426
|
-
details: {}
|
|
4427
|
-
};
|
|
4428
|
-
}
|
|
4429
|
-
}
|
|
4430
|
-
});
|
|
4431
|
-
registered = true;
|
|
4432
|
-
return;
|
|
4433
|
-
}
|
|
4434
4374
|
try {
|
|
4435
4375
|
const response = await client["proactive-result"].$get({ query: {
|
|
4436
4376
|
runId,
|
|
@@ -4466,7 +4406,7 @@ function createProactiveResultExtension({ channelContext }) {
|
|
|
4466
4406
|
logger.warn({
|
|
4467
4407
|
err,
|
|
4468
4408
|
runId
|
|
4469
|
-
}, "proactive result tool unavailable
|
|
4409
|
+
}, "proactive result tool unavailable");
|
|
4470
4410
|
}
|
|
4471
4411
|
});
|
|
4472
4412
|
};
|