@skydiveai/pi-extensions 0.1.0-beta.2730 → 0.1.0-beta.2735
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 +5 -68
- 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
|
@@ -2929,8 +2929,7 @@ const bashDefaultTimeoutExtension = (pi) => {
|
|
|
2929
2929
|
* first time usage crosses a warn threshold, folds a system notification into
|
|
2930
2930
|
* the open turn so the agent can checkpoint, shed work (constrain
|
|
2931
2931
|
* parallelism, kill a background hog, clean scratch space), or request a
|
|
2932
|
-
* bigger tier BEFORE the kill.
|
|
2933
|
-
* agent must not narrate it to the user unless asked.
|
|
2932
|
+
* bigger tier BEFORE the kill.
|
|
2934
2933
|
*
|
|
2935
2934
|
* The notification is triggered by the two conditions that actually kill
|
|
2936
2935
|
* work — memory near the cgroup hard cap, disk near full — and reports a
|
|
@@ -3064,9 +3063,7 @@ function resourcePressureWarningText(trigger, { mem, cpuPct, diskPct }) {
|
|
|
3064
3063
|
if (diskPct !== null) stats.push(`disk ${diskPct}% full`);
|
|
3065
3064
|
const lead = trigger === "memory" ? `Your sandbox is at ${mem?.pct}% of its memory cap. If usage keeps climbing, the kernel will kill the offending process and this turn may die with it.` : `Your sandbox's disk is ${diskPct}% full. If it fills completely, writes will start failing and this turn may die with them.`;
|
|
3066
3065
|
const remedy = trigger === "memory" ? "checkpoint in-flight work (commit and push), then reduce the footprint — constrain parallelism, run heavy steps sequentially, or kill background processes you no longer need." : "checkpoint in-flight work (commit and push), then free space — clean build artifacts, caches, and scratch files you no longer need.";
|
|
3067
|
-
|
|
3068
|
-
const jargon = trigger === "memory" ? "\"I freed up memory on my computer\" or \"I'll probably need a bigger computer with more memory\", not \"I killed the leftover Chromium render so we don't get OOM'd\". Instead, just request the resources you need or change how you work on the task to succeed within this budget." : "\"I freed up disk on my computer\", not \"the root filesystem is at capacity\". Change how you work on the task to succeed within this budget. Do not request a compute upgrade for disk pressure.";
|
|
3069
|
-
return `<system_notification>${lead} Current usage: ${stats.join(", ")}. Act now: ${remedy} ${closer} Do not mention this constraint as you work unless the user asks. No jargon: ${jargon} This is an automated resource warning, not a message from the user; continue the task, adjusted.</system_notification>`;
|
|
3066
|
+
return `<system_notification>${lead} Current usage: ${stats.join(", ")}. Act now: ${remedy} If the workload genuinely needs more resources, request a bigger sandbox with \`platform compute request\`. This is an automated resource warning, not a message from the user; continue the task, adjusted.</system_notification>`;
|
|
3070
3067
|
}
|
|
3071
3068
|
const resourcePressureWarningExtension = (pi) => {
|
|
3072
3069
|
let agentActive = false;
|
|
@@ -4351,12 +4348,6 @@ function createSubagentExtension({ channelContext }) {
|
|
|
4351
4348
|
}
|
|
4352
4349
|
//#endregion
|
|
4353
4350
|
//#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
4351
|
const contextSchema = z.object({
|
|
4361
4352
|
proactiveAction: z.literal(true).optional(),
|
|
4362
4353
|
runId: z.string().uuid(),
|
|
@@ -4370,67 +4361,13 @@ function createProactiveResultExtension({ channelContext }) {
|
|
|
4370
4361
|
} catch (_error) {
|
|
4371
4362
|
return;
|
|
4372
4363
|
}
|
|
4373
|
-
if (!context.success) return;
|
|
4374
|
-
const {
|
|
4364
|
+
if (!context.success || !context.data.proactiveAction) return;
|
|
4365
|
+
const { runId, messageId } = context.data;
|
|
4375
4366
|
let registered = false;
|
|
4376
4367
|
pi.on("session_start", async () => {
|
|
4377
4368
|
if (registered) return;
|
|
4378
4369
|
const client = sandboxClient();
|
|
4379
4370
|
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
4371
|
try {
|
|
4435
4372
|
const response = await client["proactive-result"].$get({ query: {
|
|
4436
4373
|
runId,
|
|
@@ -4466,7 +4403,7 @@ function createProactiveResultExtension({ channelContext }) {
|
|
|
4466
4403
|
logger.warn({
|
|
4467
4404
|
err,
|
|
4468
4405
|
runId
|
|
4469
|
-
}, "proactive result tool unavailable
|
|
4406
|
+
}, "proactive result tool unavailable");
|
|
4470
4407
|
}
|
|
4471
4408
|
});
|
|
4472
4409
|
};
|