@skydiveai/pi-extensions 0.1.258-beta.122 → 0.1.258-beta.124
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 +153 -85
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -265,7 +265,7 @@ function createHealthHandler({ metadata }) {
|
|
|
265
265
|
const CAPABILITY_SOUL_NUDGE = "New capability gained — once the current task is done, if this changes what you can do for the user, record it in `soul.md` so it carries into future conversations rather than being rediscovered from scratch (then commit and push).";
|
|
266
266
|
//#endregion
|
|
267
267
|
//#region src/extensions/tool-call-summary.ts
|
|
268
|
-
const log$
|
|
268
|
+
const log$21 = logger.child({ module: "tool-call-summary-extension" });
|
|
269
269
|
/**
|
|
270
270
|
* The injected parameter name. Deliberately markdown-safe: the previous wire
|
|
271
271
|
* name (`__skydive_summary__`, now `TOOL_CALL_SUMMARY_FIELD_LEGACY`) carried
|
|
@@ -499,7 +499,7 @@ function withSummaryStrippedBeforeValidation(tool) {
|
|
|
499
499
|
try {
|
|
500
500
|
stripped = withoutInjectedSummary(args);
|
|
501
501
|
} catch (err) {
|
|
502
|
-
log$
|
|
502
|
+
log$21.error({
|
|
503
503
|
err,
|
|
504
504
|
event: "tool_call_summary_prepare_strip_failed",
|
|
505
505
|
toolName: tool.name
|
|
@@ -530,7 +530,7 @@ function stripInjectedSummary(pi, toolName, input) {
|
|
|
530
530
|
if (toolDeclaresSummaryParam(pi, toolName)) return;
|
|
531
531
|
for (const field of TOOL_CALL_SUMMARY_FIELDS) delete input[field];
|
|
532
532
|
} catch (err) {
|
|
533
|
-
log$
|
|
533
|
+
log$21.error({
|
|
534
534
|
err,
|
|
535
535
|
event: "tool_call_summary_strip_failed",
|
|
536
536
|
toolName
|
|
@@ -546,7 +546,7 @@ function buildInjectedPayload(pi, payload) {
|
|
|
546
546
|
try {
|
|
547
547
|
return injectToolCallSummary(payload, getStrictToolNames(pi));
|
|
548
548
|
} catch (err) {
|
|
549
|
-
log$
|
|
549
|
+
log$21.error({
|
|
550
550
|
err,
|
|
551
551
|
event: "tool_call_summary_injection_failed"
|
|
552
552
|
}, "tool_call_summary injection failed; passing payload through unchanged");
|
|
@@ -565,7 +565,7 @@ const toolCallSummaryExtension = (pi) => {
|
|
|
565
565
|
pi.registerTool(withSummaryStrippedBeforeValidation(createEditToolDefinition(ctx.cwd)));
|
|
566
566
|
editOverrideRegistered = true;
|
|
567
567
|
} catch (err) {
|
|
568
|
-
log$
|
|
568
|
+
log$21.error({
|
|
569
569
|
err,
|
|
570
570
|
event: "tool_call_summary_edit_override_failed"
|
|
571
571
|
}, "failed to register summary-tolerant edit tool; built-in remains active");
|
|
@@ -596,7 +596,7 @@ const toolCallSummaryExtension = (pi) => {
|
|
|
596
596
|
* or `ToolDefinition[]`. Files starting with `_` or `.` are skipped, so
|
|
597
597
|
* `tools/_example.ts` documents the shape without registering.
|
|
598
598
|
*/
|
|
599
|
-
const log$
|
|
599
|
+
const log$20 = logger.child({ module: "local-tools-extension" });
|
|
600
600
|
const TOOLS_DIRNAME = "tools";
|
|
601
601
|
const fileState = /* @__PURE__ */ new Map();
|
|
602
602
|
let pendingLocalToolsUpdate = null;
|
|
@@ -740,7 +740,7 @@ async function reconcileAndQueue({ pi, dir, reason }) {
|
|
|
740
740
|
dir
|
|
741
741
|
});
|
|
742
742
|
if (reason !== "session_start" && summaryHasChanges$1(summary)) pendingLocalToolsUpdate = summary;
|
|
743
|
-
log$
|
|
743
|
+
log$20.info({
|
|
744
744
|
event: "local_tools_reconcile",
|
|
745
745
|
reason,
|
|
746
746
|
total_tools: summary.totalTools,
|
|
@@ -762,7 +762,7 @@ const localToolsExtension = (pi) => {
|
|
|
762
762
|
reason: "session_start"
|
|
763
763
|
});
|
|
764
764
|
} catch (err) {
|
|
765
|
-
log$
|
|
765
|
+
log$20.error({
|
|
766
766
|
err,
|
|
767
767
|
event: "local_tools_reconcile_failed"
|
|
768
768
|
}, "local tools reconcile failed");
|
|
@@ -774,7 +774,7 @@ const localToolsExtension = (pi) => {
|
|
|
774
774
|
try {
|
|
775
775
|
current = await listToolFiles(dir);
|
|
776
776
|
} catch (err) {
|
|
777
|
-
log$
|
|
777
|
+
log$20.warn({
|
|
778
778
|
err,
|
|
779
779
|
event: "local_tools_listing_failed"
|
|
780
780
|
}, "tools/ listing failed");
|
|
@@ -796,7 +796,7 @@ const localToolsExtension = (pi) => {
|
|
|
796
796
|
reason: "auto_reload"
|
|
797
797
|
});
|
|
798
798
|
} catch (err) {
|
|
799
|
-
log$
|
|
799
|
+
log$20.error({
|
|
800
800
|
err,
|
|
801
801
|
event: "local_tools_auto_reload_failed"
|
|
802
802
|
}, "auto-reload after tools/ change failed");
|
|
@@ -1500,7 +1500,7 @@ function toProviderSafeSchema(inputSchema) {
|
|
|
1500
1500
|
* Clients are keyed by JSON-stringified config and reused across
|
|
1501
1501
|
* reloads — only changed configs reconnect.
|
|
1502
1502
|
*/
|
|
1503
|
-
const log$
|
|
1503
|
+
const log$19 = logger.child({ module: "mcp-extension" });
|
|
1504
1504
|
function resolveToolSelection(server) {
|
|
1505
1505
|
return {
|
|
1506
1506
|
allow: server?.tools?.length ? new Set(server.tools) : null,
|
|
@@ -1698,7 +1698,7 @@ function providerSafeTools({ serverId, tools }) {
|
|
|
1698
1698
|
for (const tool of tools) {
|
|
1699
1699
|
const result = toProviderSafeSchema(tool.inputSchema);
|
|
1700
1700
|
if (!result.ok) {
|
|
1701
|
-
log$
|
|
1701
|
+
log$19.warn({
|
|
1702
1702
|
event: "mcp_tool_schema_unsupported",
|
|
1703
1703
|
server_id: serverId,
|
|
1704
1704
|
tool_name: tool.name,
|
|
@@ -2172,7 +2172,7 @@ var McpExtension = class {
|
|
|
2172
2172
|
});
|
|
2173
2173
|
this.lastConfigMtimeMs = await readConfigMtimeMs(configPath);
|
|
2174
2174
|
if (reason !== "session_start" && summaryHasChanges(summary)) this.pendingMcpUpdate = summary;
|
|
2175
|
-
log$
|
|
2175
|
+
log$19.info({
|
|
2176
2176
|
event: "mcp_reconcile",
|
|
2177
2177
|
reason,
|
|
2178
2178
|
total_tools: summary.totalTools,
|
|
@@ -2199,7 +2199,7 @@ var McpExtension = class {
|
|
|
2199
2199
|
contextWindow: ctx.model?.contextWindow
|
|
2200
2200
|
});
|
|
2201
2201
|
} catch (err) {
|
|
2202
|
-
log$
|
|
2202
|
+
log$19.error({
|
|
2203
2203
|
err,
|
|
2204
2204
|
event: "mcp_reconcile_failed"
|
|
2205
2205
|
}, "MCP reconcile failed");
|
|
@@ -2213,7 +2213,7 @@ var McpExtension = class {
|
|
|
2213
2213
|
for (const legacy of renamed) {
|
|
2214
2214
|
if (this.loggedLegacyToolNames.has(legacy)) continue;
|
|
2215
2215
|
this.loggedLegacyToolNames.add(legacy);
|
|
2216
|
-
log$
|
|
2216
|
+
log$19.info({
|
|
2217
2217
|
event: "mcp_tool_legacy_name",
|
|
2218
2218
|
legacy_name: legacy,
|
|
2219
2219
|
tool_name: this.legacyToolNames.get(legacy)
|
|
@@ -2227,7 +2227,7 @@ var McpExtension = class {
|
|
|
2227
2227
|
try {
|
|
2228
2228
|
mtime = await readConfigMtimeMs(configPath);
|
|
2229
2229
|
} catch (err) {
|
|
2230
|
-
log$
|
|
2230
|
+
log$19.warn({
|
|
2231
2231
|
err,
|
|
2232
2232
|
event: "mcp_mtime_check_failed"
|
|
2233
2233
|
}, "mtime check on mcp.config.json failed");
|
|
@@ -2242,7 +2242,7 @@ var McpExtension = class {
|
|
|
2242
2242
|
contextWindow: ctx.model?.contextWindow
|
|
2243
2243
|
});
|
|
2244
2244
|
} catch (err) {
|
|
2245
|
-
log$
|
|
2245
|
+
log$19.error({
|
|
2246
2246
|
err,
|
|
2247
2247
|
event: "mcp_auto_reload_failed"
|
|
2248
2248
|
}, "auto-reload after mcp.config.json change failed");
|
|
@@ -2958,7 +2958,7 @@ const SEAT_QUERY_TIMEOUTS = {
|
|
|
2958
2958
|
preparation: 3e4
|
|
2959
2959
|
};
|
|
2960
2960
|
const PI_TOOLS_SERVER = "custom-tools";
|
|
2961
|
-
const log$
|
|
2961
|
+
const log$18 = logger.child({ module: "claude-seat-sdk" });
|
|
2962
2962
|
/** Preserve existing MCP names; only ordinary Pi tools need a server prefix. */
|
|
2963
2963
|
function toolBindings(context) {
|
|
2964
2964
|
const parsed = (context.tools ?? []).map((definition) => {
|
|
@@ -3016,7 +3016,7 @@ var SeatQuery = class {
|
|
|
3016
3016
|
this.deadline = setTimeout(() => {
|
|
3017
3017
|
const err = /* @__PURE__ */ new Error(`Claude seat SDK timed out waiting for ${phase}`);
|
|
3018
3018
|
err.name = "TimeoutError";
|
|
3019
|
-
log$
|
|
3019
|
+
log$18.error({
|
|
3020
3020
|
err,
|
|
3021
3021
|
phase
|
|
3022
3022
|
}, "Claude seat SDK wait deadline exceeded");
|
|
@@ -3197,7 +3197,7 @@ var SeatQuery = class {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
} catch (err) {
|
|
3199
3199
|
this.failure = err;
|
|
3200
|
-
if (!this.controller.signal.aborted) log$
|
|
3200
|
+
if (!this.controller.signal.aborted) log$18.error({
|
|
3201
3201
|
err,
|
|
3202
3202
|
sessionId
|
|
3203
3203
|
}, "Claude seat SDK query failed");
|
|
@@ -3212,7 +3212,7 @@ var SeatQuery = class {
|
|
|
3212
3212
|
force: true
|
|
3213
3213
|
});
|
|
3214
3214
|
} catch (err) {
|
|
3215
|
-
log$
|
|
3215
|
+
log$18.error({
|
|
3216
3216
|
err,
|
|
3217
3217
|
sessionId
|
|
3218
3218
|
}, "Could not remove Claude seat SDK config");
|
|
@@ -3245,7 +3245,7 @@ function mapUsage(usage) {
|
|
|
3245
3245
|
//#endregion
|
|
3246
3246
|
//#region src/extensions/claude-seat-response.ts
|
|
3247
3247
|
const toolInput = z.record(z.string(), z.unknown());
|
|
3248
|
-
const log$
|
|
3248
|
+
const log$17 = logger.child({ module: "claude-seat-sdk" });
|
|
3249
3249
|
/**
|
|
3250
3250
|
* Claude sometimes calls a tool by the name it had outside the bridge (Pi's
|
|
3251
3251
|
* own name from non-seat history, or a bare MCP tool name). Resolve those when
|
|
@@ -3259,7 +3259,7 @@ function piToolName({ name, context, sessionId }) {
|
|
|
3259
3259
|
const bare = bindings.filter((binding) => binding.toolName === name);
|
|
3260
3260
|
const [only] = bare;
|
|
3261
3261
|
if (only && bare.length === 1) return only.definition.name;
|
|
3262
|
-
log$
|
|
3262
|
+
log$17.warn({
|
|
3263
3263
|
sessionId,
|
|
3264
3264
|
toolName: name,
|
|
3265
3265
|
candidates: bare.length
|
|
@@ -3450,7 +3450,7 @@ var ModelResponse = class {
|
|
|
3450
3450
|
* each step resumes a private structured snapshot after Pi extensions run.
|
|
3451
3451
|
* Initially adapted from elidickinson/pi-claude-bridge (MIT).
|
|
3452
3452
|
*/
|
|
3453
|
-
const log$
|
|
3453
|
+
const log$16 = logger.child({ module: "claude-seat-sdk" });
|
|
3454
3454
|
const SEAT_SDK_ACTIVITY_EVENT = "claude-seat-sdk:activity";
|
|
3455
3455
|
/** Session-scoped adapter; only the flagged provider dispatches here. */
|
|
3456
3456
|
var SeatSdkBridge = class {
|
|
@@ -3501,7 +3501,7 @@ var SeatSdkBridge = class {
|
|
|
3501
3501
|
} else if (message.type === "result") {
|
|
3502
3502
|
const hasTools = response.hasTools;
|
|
3503
3503
|
if (message.is_error && !(message.subtype === "error_max_turns" && hasTools)) throw new Error("errors" in message ? message.errors.join("; ") : message.result);
|
|
3504
|
-
log$
|
|
3504
|
+
log$16.info({
|
|
3505
3505
|
sessionId: this.deps.sessionId,
|
|
3506
3506
|
queryUsage: mapUsage(message.usage),
|
|
3507
3507
|
requestUsage: response.message.usage
|
|
@@ -3522,7 +3522,7 @@ var SeatSdkBridge = class {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
} catch (err) {
|
|
3524
3524
|
const reason = (seatQuery?.controller.signal.aborted || signal.aborted) && !(err instanceof Error && err.name === "TimeoutError") ? "aborted" : "error";
|
|
3525
|
-
if (reason === "error") log$
|
|
3525
|
+
if (reason === "error") log$16.error({
|
|
3526
3526
|
err,
|
|
3527
3527
|
sessionId: this.deps.sessionId
|
|
3528
3528
|
}, "Claude seat SDK response failed");
|
|
@@ -3593,7 +3593,7 @@ const HEARTBEAT_THROTTLE_MS = 6e4;
|
|
|
3593
3593
|
const TOOL_HEARTBEAT_INTERVAL_MS = 5e3;
|
|
3594
3594
|
const MAX_TOOL_HEARTBEATS = 1440 * 60 * 1e3 / TOOL_HEARTBEAT_INTERVAL_MS;
|
|
3595
3595
|
const DAEMON_URL = "http://localhost:38994";
|
|
3596
|
-
const log$
|
|
3596
|
+
const log$15 = logger.child({ module: "platform-ext" });
|
|
3597
3597
|
function sandboxClient() {
|
|
3598
3598
|
const apiUrl = apiBaseUrl();
|
|
3599
3599
|
if (!apiUrl) return null;
|
|
@@ -3661,7 +3661,7 @@ async function fetchHarnessFlags() {
|
|
|
3661
3661
|
try {
|
|
3662
3662
|
const res = await client["feature-flags"].$get();
|
|
3663
3663
|
if (!res.ok) {
|
|
3664
|
-
log$
|
|
3664
|
+
log$15.debug({
|
|
3665
3665
|
status: res.status,
|
|
3666
3666
|
event: "feature_flags_fetch_failed"
|
|
3667
3667
|
}, "feature-flags fetch failed");
|
|
@@ -3673,7 +3673,7 @@ async function fetchHarnessFlags() {
|
|
|
3673
3673
|
closingText: body.closingText ?? null
|
|
3674
3674
|
};
|
|
3675
3675
|
} catch (err) {
|
|
3676
|
-
log$
|
|
3676
|
+
log$15.debug({
|
|
3677
3677
|
err,
|
|
3678
3678
|
event: "feature_flags_fetch_error"
|
|
3679
3679
|
}, "feature-flags request errored");
|
|
@@ -3684,7 +3684,7 @@ function postHeartbeat({ messageId }) {
|
|
|
3684
3684
|
const client = sandboxClient();
|
|
3685
3685
|
if (!client) return;
|
|
3686
3686
|
client.heartbeat.$post({ json: { messageId } }).catch((err) => {
|
|
3687
|
-
log$
|
|
3687
|
+
log$15.debug({
|
|
3688
3688
|
err,
|
|
3689
3689
|
event: "heartbeat_failed"
|
|
3690
3690
|
}, "heartbeat failed");
|
|
@@ -3696,7 +3696,7 @@ async function resolveConversationFromApi(messageId) {
|
|
|
3696
3696
|
try {
|
|
3697
3697
|
const res = await client["message-conversation"].$get({ query: { messageId } });
|
|
3698
3698
|
if (!res.ok) {
|
|
3699
|
-
log$
|
|
3699
|
+
log$15.warn({
|
|
3700
3700
|
status: res.status,
|
|
3701
3701
|
messageId,
|
|
3702
3702
|
event: "resolve_conversation_failed"
|
|
@@ -3705,7 +3705,7 @@ async function resolveConversationFromApi(messageId) {
|
|
|
3705
3705
|
}
|
|
3706
3706
|
return (await res.json()).conversationId ?? null;
|
|
3707
3707
|
} catch (err) {
|
|
3708
|
-
log$
|
|
3708
|
+
log$15.warn({
|
|
3709
3709
|
err,
|
|
3710
3710
|
messageId,
|
|
3711
3711
|
event: "resolve_conversation_error"
|
|
@@ -3730,13 +3730,13 @@ async function putBackgroundTaskJournalSpec({ messageId, spec }) {
|
|
|
3730
3730
|
messageId,
|
|
3731
3731
|
spec
|
|
3732
3732
|
} });
|
|
3733
|
-
if (!res.ok) log$
|
|
3733
|
+
if (!res.ok) log$15.warn({
|
|
3734
3734
|
status: res.status,
|
|
3735
3735
|
taskId: spec.id,
|
|
3736
3736
|
event: "bg_journal_put_failed"
|
|
3737
3737
|
}, "bg-task journal PUT failed");
|
|
3738
3738
|
} catch (err) {
|
|
3739
|
-
log$
|
|
3739
|
+
log$15.warn({
|
|
3740
3740
|
err,
|
|
3741
3741
|
taskId: spec.id,
|
|
3742
3742
|
event: "bg_journal_put_failed"
|
|
@@ -3752,7 +3752,7 @@ async function deleteBackgroundTaskJournalSpec({ messageId, taskId }) {
|
|
|
3752
3752
|
taskId
|
|
3753
3753
|
} });
|
|
3754
3754
|
} catch (err) {
|
|
3755
|
-
log$
|
|
3755
|
+
log$15.debug({
|
|
3756
3756
|
err,
|
|
3757
3757
|
taskId,
|
|
3758
3758
|
event: "bg_journal_delete_failed"
|
|
@@ -3767,7 +3767,7 @@ async function listBackgroundTaskJournalSpecs({ messageId }) {
|
|
|
3767
3767
|
if (!res.ok) return [];
|
|
3768
3768
|
return (await res.json()).specs ?? [];
|
|
3769
3769
|
} catch (err) {
|
|
3770
|
-
log$
|
|
3770
|
+
log$15.debug({
|
|
3771
3771
|
err,
|
|
3772
3772
|
event: "bg_journal_list_failed"
|
|
3773
3773
|
}, "bg-task journal GET failed");
|
|
@@ -3781,7 +3781,7 @@ function postBackgroundTasksSnapshot({ messageId, tasks }) {
|
|
|
3781
3781
|
messageId,
|
|
3782
3782
|
tasks
|
|
3783
3783
|
} }).catch((err) => {
|
|
3784
|
-
log$
|
|
3784
|
+
log$15.debug({
|
|
3785
3785
|
err,
|
|
3786
3786
|
event: "bg_tasks_snapshot_failed"
|
|
3787
3787
|
}, "bg-tasks snapshot publish failed");
|
|
@@ -3879,7 +3879,7 @@ function createToolHeartbeat({ messageId }) {
|
|
|
3879
3879
|
}
|
|
3880
3880
|
heartbeatCount++;
|
|
3881
3881
|
if (heartbeatCount > MAX_TOOL_HEARTBEATS) {
|
|
3882
|
-
log$
|
|
3882
|
+
log$15.warn({
|
|
3883
3883
|
heartbeatCount,
|
|
3884
3884
|
activeToolCalls: [...activeToolCalls]
|
|
3885
3885
|
}, "tool heartbeat max reached, stopping");
|
|
@@ -3910,7 +3910,7 @@ function postToDaemon(path, body) {
|
|
|
3910
3910
|
headers: { "content-type": "application/json" },
|
|
3911
3911
|
body: JSON.stringify(body)
|
|
3912
3912
|
}).catch((err) => {
|
|
3913
|
-
log$
|
|
3913
|
+
log$15.debug({
|
|
3914
3914
|
err,
|
|
3915
3915
|
path,
|
|
3916
3916
|
event: "daemon_post_failed"
|
|
@@ -3919,7 +3919,7 @@ function postToDaemon(path, body) {
|
|
|
3919
3919
|
}
|
|
3920
3920
|
function createPlatformExtensions({ sessionId, channelContext }) {
|
|
3921
3921
|
return (pi) => {
|
|
3922
|
-
log$
|
|
3922
|
+
log$15.info({
|
|
3923
3923
|
sessionId,
|
|
3924
3924
|
hasChannelContext: Boolean(channelContext)
|
|
3925
3925
|
}, "platform extension initialized");
|
|
@@ -3973,7 +3973,7 @@ function createPlatformExtensions({ sessionId, channelContext }) {
|
|
|
3973
3973
|
});
|
|
3974
3974
|
});
|
|
3975
3975
|
pi.on("agent_end", () => {
|
|
3976
|
-
log$
|
|
3976
|
+
log$15.info({ sessionId }, "session ending");
|
|
3977
3977
|
postToDaemon("/session/end", { sessionId });
|
|
3978
3978
|
});
|
|
3979
3979
|
};
|
|
@@ -4109,7 +4109,7 @@ const toolCallEnvExtension = (pi) => {
|
|
|
4109
4109
|
* semantics; once promoted, the command inherits background-task lifecycle
|
|
4110
4110
|
* (its own controller) and the foreground kill timeout no longer applies.
|
|
4111
4111
|
*/
|
|
4112
|
-
const log$
|
|
4112
|
+
const log$14 = logger.child({ module: "background-tasks-ext" });
|
|
4113
4113
|
const ops = createLocalBashOperations();
|
|
4114
4114
|
const STEER_BACKGROUND_DEFAULT_SECONDS = 60;
|
|
4115
4115
|
const STEER_BACKGROUND_ENV_KEYS = ["BASH_STEER_BACKGROUND_SECONDS", "SKYDIVE_BASH_STEER_BACKGROUND_SECONDS"];
|
|
@@ -4124,7 +4124,7 @@ function steerBackgroundThresholdMs() {
|
|
|
4124
4124
|
if (raw === void 0 || raw.trim() === "") continue;
|
|
4125
4125
|
const parsed = Number(raw);
|
|
4126
4126
|
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
4127
|
-
log$
|
|
4127
|
+
log$14.warn({
|
|
4128
4128
|
envKey: key,
|
|
4129
4129
|
raw
|
|
4130
4130
|
}, "invalid BASH_STEER_BACKGROUND_SECONDS, using default");
|
|
@@ -4153,7 +4153,7 @@ async function notifyBashSteerArrival(args) {
|
|
|
4153
4153
|
try {
|
|
4154
4154
|
await listener();
|
|
4155
4155
|
} catch (err) {
|
|
4156
|
-
log$
|
|
4156
|
+
log$14.error({
|
|
4157
4157
|
err,
|
|
4158
4158
|
sessionId: args.sessionId
|
|
4159
4159
|
}, "bash steer promotion failed");
|
|
@@ -4248,14 +4248,14 @@ function watchdogTick(now) {
|
|
|
4248
4248
|
const overSize = meta.logBytes > MAX_LOG_BYTES;
|
|
4249
4249
|
if (!overRuntime && !overSize) continue;
|
|
4250
4250
|
const reason = overSize ? `output exceeded ${MAX_LOG_BYTES / (1024 * 1024)}MiB` : `exceeded ${KEEPALIVE_MAX_MS / 6e4}m max runtime`;
|
|
4251
|
-
log$
|
|
4251
|
+
log$14.warn({
|
|
4252
4252
|
taskId: meta.id,
|
|
4253
4253
|
reason
|
|
4254
4254
|
}, "watchdog killing bg task");
|
|
4255
4255
|
try {
|
|
4256
4256
|
killTask(meta, reason);
|
|
4257
4257
|
} catch (err) {
|
|
4258
|
-
log$
|
|
4258
|
+
log$14.warn({
|
|
4259
4259
|
err,
|
|
4260
4260
|
taskId: meta.id
|
|
4261
4261
|
}, "watchdog kill failed");
|
|
@@ -4314,7 +4314,7 @@ function createBackgroundTasksExtension({ channelContext, sessionId }) {
|
|
|
4314
4314
|
const now = Date.now();
|
|
4315
4315
|
const promotable = [...foregroundBash.values()].filter((call) => now - call.startedAt >= thresholdMs);
|
|
4316
4316
|
if (promotable.length === 0) return;
|
|
4317
|
-
log$
|
|
4317
|
+
log$14.info({
|
|
4318
4318
|
event: "bash_steer_promotion",
|
|
4319
4319
|
count: promotable.length,
|
|
4320
4320
|
thresholdSeconds: Math.round(thresholdMs / 1e3),
|
|
@@ -4339,7 +4339,7 @@ function createBackgroundTasksExtension({ channelContext, sessionId }) {
|
|
|
4339
4339
|
try {
|
|
4340
4340
|
await mkdir(tasksDir(), { recursive: true });
|
|
4341
4341
|
} catch (err) {
|
|
4342
|
-
log$
|
|
4342
|
+
log$14.error({ err }, "bg task adopt: mkdir failed");
|
|
4343
4343
|
}
|
|
4344
4344
|
const logStream = createWriteStream(logPath(id), { flags: "a" });
|
|
4345
4345
|
logStream.on("error", () => {});
|
|
@@ -4366,7 +4366,7 @@ function createBackgroundTasksExtension({ channelContext, sessionId }) {
|
|
|
4366
4366
|
tasks.set(id, meta);
|
|
4367
4367
|
ensureWatchdog();
|
|
4368
4368
|
schedulePublishSnapshot();
|
|
4369
|
-
log$
|
|
4369
|
+
log$14.info({
|
|
4370
4370
|
taskId: id,
|
|
4371
4371
|
conversationId,
|
|
4372
4372
|
startedAt: args.startedAt
|
|
@@ -4519,7 +4519,7 @@ function createBackgroundTasksExtension({ channelContext, sessionId }) {
|
|
|
4519
4519
|
try {
|
|
4520
4520
|
shellPath = SettingsManager.create(ctx.cwd, getAgentDir()).getShellPath();
|
|
4521
4521
|
} catch (err) {
|
|
4522
|
-
log$
|
|
4522
|
+
log$14.warn({
|
|
4523
4523
|
err,
|
|
4524
4524
|
cwd: ctx.cwd
|
|
4525
4525
|
}, "bash steer promotion: shell settings unavailable, using default shell");
|
|
@@ -4534,7 +4534,7 @@ function createBackgroundTasksExtension({ channelContext, sessionId }) {
|
|
|
4534
4534
|
...definition,
|
|
4535
4535
|
description: `${definition.description}\n\nLong-running bash commands are automatically moved to a background task when a new message arrives while the command has already been running for at least a minute: you get the task id immediately, are woken on completion, and must not depend on the command's output until that wake arrives. Shorter commands finish in the foreground like they always have.`
|
|
4536
4536
|
});
|
|
4537
|
-
log$
|
|
4537
|
+
log$14.info({
|
|
4538
4538
|
event: "bash_steer_promotion_enabled",
|
|
4539
4539
|
thresholdSeconds: Math.round(thresholdMs / 1e3)
|
|
4540
4540
|
}, "supervised bash tool registered (steer-triggered backgrounding)");
|
|
@@ -4577,7 +4577,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4577
4577
|
triggerTurn: true,
|
|
4578
4578
|
deliverAs: "followUp"
|
|
4579
4579
|
});
|
|
4580
|
-
log$
|
|
4580
|
+
log$14.info({
|
|
4581
4581
|
taskId: meta.id,
|
|
4582
4582
|
conversationId
|
|
4583
4583
|
}, "bg task completion delivered live (followUp)");
|
|
@@ -4585,7 +4585,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4585
4585
|
}
|
|
4586
4586
|
if (meta.messageId) {
|
|
4587
4587
|
meta.notified = true;
|
|
4588
|
-
log$
|
|
4588
|
+
log$14.info({
|
|
4589
4589
|
taskId: meta.id,
|
|
4590
4590
|
messageId: meta.messageId
|
|
4591
4591
|
}, "posting idle bg-task-done wake");
|
|
@@ -4595,12 +4595,12 @@ or if you were explicitly waiting to report it.`,
|
|
|
4595
4595
|
content: message.content
|
|
4596
4596
|
}).catch((err) => {
|
|
4597
4597
|
meta.notified = false;
|
|
4598
|
-
log$
|
|
4598
|
+
log$14.warn({
|
|
4599
4599
|
err,
|
|
4600
4600
|
taskId: meta.id
|
|
4601
4601
|
}, "bg-task-done wake failed; will retry at next session_start");
|
|
4602
4602
|
});
|
|
4603
|
-
} else log$
|
|
4603
|
+
} else log$14.info({ taskId: meta.id }, "bg task completed idle with no origin message; deferring to next session_start");
|
|
4604
4604
|
}
|
|
4605
4605
|
const SNAPSHOT_TAIL_LINES = 40;
|
|
4606
4606
|
let lastPublishedSignature = null;
|
|
@@ -4637,7 +4637,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4637
4637
|
tasks: snapshot
|
|
4638
4638
|
});
|
|
4639
4639
|
} catch (err) {
|
|
4640
|
-
log$
|
|
4640
|
+
log$14.debug({
|
|
4641
4641
|
err,
|
|
4642
4642
|
event: "bg_tasks_snapshot_build_failed"
|
|
4643
4643
|
}, "building bg-tasks snapshot failed");
|
|
@@ -4680,7 +4680,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4680
4680
|
logStream.end();
|
|
4681
4681
|
await finished(logStream).catch(() => {});
|
|
4682
4682
|
meta.running = false;
|
|
4683
|
-
log$
|
|
4683
|
+
log$14.info({
|
|
4684
4684
|
taskId: meta.id,
|
|
4685
4685
|
exitCode: meta.exitCode
|
|
4686
4686
|
}, "bg task finished");
|
|
@@ -4697,14 +4697,14 @@ or if you were explicitly waiting to report it.`,
|
|
|
4697
4697
|
try {
|
|
4698
4698
|
await mkdir(tasksDir(), { recursive: true });
|
|
4699
4699
|
} catch (err) {
|
|
4700
|
-
log$
|
|
4700
|
+
log$14.error({
|
|
4701
4701
|
err,
|
|
4702
4702
|
taskId: id
|
|
4703
4703
|
}, "background task dir unavailable");
|
|
4704
4704
|
}
|
|
4705
4705
|
const logStream = createWriteStream(logPath(id), { flags: "a" });
|
|
4706
4706
|
logStream.on("error", (err) => {
|
|
4707
|
-
log$
|
|
4707
|
+
log$14.warn({
|
|
4708
4708
|
err,
|
|
4709
4709
|
taskId: id
|
|
4710
4710
|
}, "bg task log write failed");
|
|
@@ -4754,7 +4754,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4754
4754
|
}).catch((err) => {
|
|
4755
4755
|
if (!meta.controller.signal.aborted) {
|
|
4756
4756
|
meta.error = err instanceof Error ? err.message : String(err);
|
|
4757
|
-
log$
|
|
4757
|
+
log$14.warn({
|
|
4758
4758
|
err,
|
|
4759
4759
|
taskId: id
|
|
4760
4760
|
}, "bg task exec error");
|
|
@@ -4763,7 +4763,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4763
4763
|
await finishTask(meta, logStream);
|
|
4764
4764
|
});
|
|
4765
4765
|
ensureWatchdog();
|
|
4766
|
-
log$
|
|
4766
|
+
log$14.info({
|
|
4767
4767
|
taskId: id,
|
|
4768
4768
|
conversationId
|
|
4769
4769
|
}, "bg task started");
|
|
@@ -4782,7 +4782,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4782
4782
|
for (const spec of specs) {
|
|
4783
4783
|
const live = tasks.get(spec.id);
|
|
4784
4784
|
if (live && sameScope(live, scopeKey())) continue;
|
|
4785
|
-
log$
|
|
4785
|
+
log$14.info({
|
|
4786
4786
|
taskId: spec.id,
|
|
4787
4787
|
conversationId
|
|
4788
4788
|
}, "relaunching journaled resumable bg task after restart");
|
|
@@ -4800,7 +4800,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4800
4800
|
stream.write(`<resumed-after-restart>requeued and relaunched on a new sandbox after the previous one was drained; this is a fresh execution of the command from the start, not a continuation</resumed-after-restart>\n`);
|
|
4801
4801
|
stream.end();
|
|
4802
4802
|
} catch (err) {
|
|
4803
|
-
log$
|
|
4803
|
+
log$14.debug({
|
|
4804
4804
|
err,
|
|
4805
4805
|
taskId: meta.id
|
|
4806
4806
|
}, "resume banner write failed");
|
|
@@ -4820,7 +4820,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
4820
4820
|
meta.notified = true;
|
|
4821
4821
|
pi.sendMessage(await taskDoneMessage(meta));
|
|
4822
4822
|
}
|
|
4823
|
-
if (unnotified.length > 0) log$
|
|
4823
|
+
if (unnotified.length > 0) log$14.info({
|
|
4824
4824
|
conversationId,
|
|
4825
4825
|
count: unnotified.length
|
|
4826
4826
|
}, "injected completed bg tasks at session_start");
|
|
@@ -5015,7 +5015,7 @@ or if you were explicitly waiting to report it.`,
|
|
|
5015
5015
|
* read on the hot path before every LLM call), it falls back to the default
|
|
5016
5016
|
* for that knob and logs once.
|
|
5017
5017
|
*/
|
|
5018
|
-
const log$
|
|
5018
|
+
const log$13 = logger.child({ module: "context-management-config" });
|
|
5019
5019
|
const DEFAULT_CONTEXT_MANAGEMENT_CONFIG = {
|
|
5020
5020
|
enabled: false,
|
|
5021
5021
|
perResultMaxBytes: 16 * 1024,
|
|
@@ -5060,7 +5060,7 @@ function resolveContextManagementConfig(env = process.env) {
|
|
|
5060
5060
|
clearAtLeastTokens: env.SKYDIVE_CTX_CLEAR_AT_LEAST_TOKENS
|
|
5061
5061
|
});
|
|
5062
5062
|
if (!parsed.success) {
|
|
5063
|
-
log$
|
|
5063
|
+
log$13.warn({
|
|
5064
5064
|
event: "context_management_config_invalid",
|
|
5065
5065
|
err: parsed.error
|
|
5066
5066
|
}, "falling back to default context-management config");
|
|
@@ -5144,7 +5144,7 @@ function hasFlagSource(env = process.env) {
|
|
|
5144
5144
|
* alive and an indeterminate result (no api url / transient failure) leaves the
|
|
5145
5145
|
* last-known values untouched so a blip can't silently flip behavior.
|
|
5146
5146
|
*/
|
|
5147
|
-
const log$
|
|
5147
|
+
const log$12 = logger.child({ module: "feature-flags-poll" });
|
|
5148
5148
|
const FLAG_POLL_INTERVAL_MS = 6e4;
|
|
5149
5149
|
let contextManagement = null;
|
|
5150
5150
|
let closingText = null;
|
|
@@ -5184,7 +5184,7 @@ function apply(name, next) {
|
|
|
5184
5184
|
if (next !== prev) for (const cb of subscribers[name]) try {
|
|
5185
5185
|
cb(next);
|
|
5186
5186
|
} catch (err) {
|
|
5187
|
-
log$
|
|
5187
|
+
log$12.warn({
|
|
5188
5188
|
err,
|
|
5189
5189
|
flag: name
|
|
5190
5190
|
}, "flag subscriber threw");
|
|
@@ -5197,7 +5197,7 @@ async function pollOnce() {
|
|
|
5197
5197
|
apply("contextManagement", flags.contextManagement ?? null);
|
|
5198
5198
|
apply("closingText", flags.closingText ?? null);
|
|
5199
5199
|
} catch (err) {
|
|
5200
|
-
log$
|
|
5200
|
+
log$12.debug({ err }, "feature-flag poll threw");
|
|
5201
5201
|
}
|
|
5202
5202
|
}
|
|
5203
5203
|
/**
|
|
@@ -5399,7 +5399,7 @@ const bashDefaultTimeoutExtension = (pi) => {
|
|
|
5399
5399
|
* turn over an observability feature.
|
|
5400
5400
|
*/
|
|
5401
5401
|
const execFileAsync = promisify(execFile);
|
|
5402
|
-
const log$
|
|
5402
|
+
const log$11 = logger.child({ module: "resource-pressure-warning" });
|
|
5403
5403
|
const POLL_INTERVAL_MS = 1e4;
|
|
5404
5404
|
function envOverride(name) {
|
|
5405
5405
|
for (const prefix of ["SKYDIVE_", "ANYONE_"]) {
|
|
@@ -5596,7 +5596,7 @@ const resourcePressureWarningExtension = (pi) => {
|
|
|
5596
5596
|
warnedDiskThisTurn = true;
|
|
5597
5597
|
}
|
|
5598
5598
|
if (trigger === null) return;
|
|
5599
|
-
log$
|
|
5599
|
+
log$11.warn({
|
|
5600
5600
|
trigger,
|
|
5601
5601
|
mem,
|
|
5602
5602
|
cpuPct,
|
|
@@ -5634,7 +5634,7 @@ const resourcePressureWarningExtension = (pi) => {
|
|
|
5634
5634
|
if (!timer) {
|
|
5635
5635
|
timer = setInterval(() => {
|
|
5636
5636
|
checkOnce().catch((err) => {
|
|
5637
|
-
log$
|
|
5637
|
+
log$11.error({ err }, "resource pressure check failed");
|
|
5638
5638
|
});
|
|
5639
5639
|
}, POLL_INTERVAL_MS);
|
|
5640
5640
|
timer.unref?.();
|
|
@@ -5650,7 +5650,7 @@ const resourcePressureWarningExtension = (pi) => {
|
|
|
5650
5650
|
};
|
|
5651
5651
|
//#endregion
|
|
5652
5652
|
//#region src/extensions/disk-guard.ts
|
|
5653
|
-
const log$
|
|
5653
|
+
const log$10 = logger.child({ module: "disk-guard" });
|
|
5654
5654
|
/**
|
|
5655
5655
|
* In-band bypass. The guard is a safety net, not a jail: when the agent knows
|
|
5656
5656
|
* a flagged command is genuinely safe (writing to a different mount, a tiny
|
|
@@ -5672,7 +5672,7 @@ const BYPASS_HINT$2 = "# disk-guard: allow";
|
|
|
5672
5672
|
* first; the SKYDIVE_/ANYONE_ prefixes are accepted too for consistency with
|
|
5673
5673
|
* the other env overrides. Empty/unset/"0"/"false" leave the guard on.
|
|
5674
5674
|
*/
|
|
5675
|
-
function guardDisabledByEnv$
|
|
5675
|
+
function guardDisabledByEnv$3() {
|
|
5676
5676
|
for (const name of [
|
|
5677
5677
|
"DISK_GUARD_DISABLE",
|
|
5678
5678
|
"SKYDIVE_DISK_GUARD_DISABLE",
|
|
@@ -5783,14 +5783,14 @@ function diskBlockReason(command, diskPct) {
|
|
|
5783
5783
|
const diskGuardExtension = (pi) => {
|
|
5784
5784
|
pi.on("tool_call", async (event) => {
|
|
5785
5785
|
if (event.toolName !== "bash") return;
|
|
5786
|
-
if (guardDisabledByEnv$
|
|
5786
|
+
if (guardDisabledByEnv$3()) return;
|
|
5787
5787
|
const command = event.input.command;
|
|
5788
5788
|
if (typeof command !== "string" || command.length === 0) return;
|
|
5789
5789
|
if (hasBypassMarker$2(command)) return;
|
|
5790
5790
|
if (!isSpaceHungryCommand(command)) return;
|
|
5791
5791
|
const diskPct = await readDiskUsePct();
|
|
5792
5792
|
if (!shouldBlockForDisk(command, diskPct)) return;
|
|
5793
|
-
log$
|
|
5793
|
+
log$10.warn({
|
|
5794
5794
|
diskPct,
|
|
5795
5795
|
command: command.slice(0, 200)
|
|
5796
5796
|
}, "blocked space-hungry bash command on near-full disk");
|
|
@@ -5802,7 +5802,7 @@ const diskGuardExtension = (pi) => {
|
|
|
5802
5802
|
};
|
|
5803
5803
|
//#endregion
|
|
5804
5804
|
//#region src/extensions/noop-loop-guard.ts
|
|
5805
|
-
const log$
|
|
5805
|
+
const log$9 = logger.child({ module: "noop-loop-guard" });
|
|
5806
5806
|
/** Length of the rolling window that counts silence commands across streak resets. */
|
|
5807
5807
|
const SILENCE_WINDOW_MS = 300 * 1e3;
|
|
5808
5808
|
/** Bare shell no-op: `true` or `:` (case-insensitive). */
|
|
@@ -5818,9 +5818,9 @@ const ECHO_ARG_MAX_LEN = 64;
|
|
|
5818
5818
|
/** Marker that forces a single command through the guard. */
|
|
5819
5819
|
const BYPASS_HINT$1 = "noop-guard: allow";
|
|
5820
5820
|
/** Env vars that turn the guard off for the process. */
|
|
5821
|
-
const KILL_SWITCH_KEYS = ["NOOP_LOOP_GUARD_DISABLE", "SKYDIVE_NOOP_LOOP_GUARD_DISABLE"];
|
|
5822
|
-
function guardDisabledByEnv$
|
|
5823
|
-
return KILL_SWITCH_KEYS.some((key) => {
|
|
5821
|
+
const KILL_SWITCH_KEYS$1 = ["NOOP_LOOP_GUARD_DISABLE", "SKYDIVE_NOOP_LOOP_GUARD_DISABLE"];
|
|
5822
|
+
function guardDisabledByEnv$2() {
|
|
5823
|
+
return KILL_SWITCH_KEYS$1.some((key) => {
|
|
5824
5824
|
const value = process.env[key];
|
|
5825
5825
|
return value !== void 0 && value !== "" && value !== "0";
|
|
5826
5826
|
});
|
|
@@ -5944,17 +5944,20 @@ const noopLoopGuardExtension = (pi) => {
|
|
|
5944
5944
|
};
|
|
5945
5945
|
pi.on("tool_call", async (event, ctx) => {
|
|
5946
5946
|
if (event.toolName !== "bash") return;
|
|
5947
|
-
if (guardDisabledByEnv$
|
|
5948
|
-
const
|
|
5949
|
-
if (typeof
|
|
5947
|
+
if (guardDisabledByEnv$2()) return;
|
|
5948
|
+
const rawCommand = event.input.command;
|
|
5949
|
+
if (typeof rawCommand !== "string" || rawCommand.length === 0) return;
|
|
5950
|
+
const command = stripPlatformExportsForDisplay(rawCommand);
|
|
5950
5951
|
const now = Date.now();
|
|
5951
|
-
const
|
|
5952
|
+
const silence = isSilenceCommand(command);
|
|
5953
|
+
const bypassed = silence && hasBypassMarker$1(command);
|
|
5952
5954
|
const streak = recordNoopCommand(state, command, now);
|
|
5955
|
+
if (!silence) return;
|
|
5953
5956
|
const windowCount = countSilenceInWindow(state, now);
|
|
5954
5957
|
if (bypassed) return;
|
|
5955
5958
|
if (streak < 3 && windowCount < 8) return;
|
|
5956
5959
|
const aborted = streak >= 25 || windowCount >= 40;
|
|
5957
|
-
log$
|
|
5960
|
+
log$9.warn({
|
|
5958
5961
|
streak,
|
|
5959
5962
|
windowCount,
|
|
5960
5963
|
aborted,
|
|
@@ -5972,6 +5975,70 @@ const noopLoopGuardExtension = (pi) => {
|
|
|
5972
5975
|
});
|
|
5973
5976
|
};
|
|
5974
5977
|
//#endregion
|
|
5978
|
+
//#region src/extensions/repeat-call-guard.ts
|
|
5979
|
+
const log$8 = logger.child({ module: "repeat-call-guard" });
|
|
5980
|
+
const KILL_SWITCH_KEYS = ["REPEAT_CALL_GUARD_DISABLE", "SKYDIVE_REPEAT_CALL_GUARD_DISABLE"];
|
|
5981
|
+
function guardDisabledByEnv$1() {
|
|
5982
|
+
return KILL_SWITCH_KEYS.some((key) => {
|
|
5983
|
+
const value = process.env[key];
|
|
5984
|
+
return value !== void 0 && value !== "" && value !== "0";
|
|
5985
|
+
});
|
|
5986
|
+
}
|
|
5987
|
+
/**
|
|
5988
|
+
* Identity of a tool call for repeat detection: tool name plus arguments,
|
|
5989
|
+
* minus the fields the platform adds per call.
|
|
5990
|
+
*/
|
|
5991
|
+
function toolCallKey({ toolName, input }) {
|
|
5992
|
+
const normalized = {};
|
|
5993
|
+
for (const [key, value] of Object.entries(input)) {
|
|
5994
|
+
if (TOOL_CALL_SUMMARY_FIELDS.includes(key)) continue;
|
|
5995
|
+
normalized[key] = key === "command" && typeof value === "string" ? stripPlatformExportsForDisplay(value) : value;
|
|
5996
|
+
}
|
|
5997
|
+
return `${toolName}\u0000${JSON.stringify(normalized)}`;
|
|
5998
|
+
}
|
|
5999
|
+
/** Count one call against the streak; returns the new streak length. */
|
|
6000
|
+
function recordToolCall(state, key) {
|
|
6001
|
+
state.streak = key === state.lastKey ? state.streak + 1 : 1;
|
|
6002
|
+
state.lastKey = key;
|
|
6003
|
+
return state.streak;
|
|
6004
|
+
}
|
|
6005
|
+
function repeatBlockReason({ toolName, streak, aborted }) {
|
|
6006
|
+
const head = `Repeated call: ${streak} consecutive \`${toolName}\` calls with exactly the same arguments. Repeating it will not change the outcome. If you are done, END THE TURN (reply, or emit nothing to stay silent). If you are waiting on a background task, end the turn: it wakes you when it finishes. Otherwise change approach.`;
|
|
6007
|
+
if (aborted) return `${head} The harness is now stopping this run.`;
|
|
6008
|
+
const remaining = 40 - streak;
|
|
6009
|
+
return `${head} ${remaining} more identical call${remaining === 1 ? "" : "s"} and the harness stops the run.`;
|
|
6010
|
+
}
|
|
6011
|
+
const repeatCallGuardExtension = (pi) => {
|
|
6012
|
+
const state = {
|
|
6013
|
+
lastKey: null,
|
|
6014
|
+
streak: 0
|
|
6015
|
+
};
|
|
6016
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
6017
|
+
if (guardDisabledByEnv$1()) return;
|
|
6018
|
+
const streak = recordToolCall(state, toolCallKey({
|
|
6019
|
+
toolName: event.toolName,
|
|
6020
|
+
input: event.input
|
|
6021
|
+
}));
|
|
6022
|
+
if (streak < 20) return;
|
|
6023
|
+
const aborted = streak >= 40;
|
|
6024
|
+
log$8.warn({
|
|
6025
|
+
toolName: event.toolName,
|
|
6026
|
+
streak,
|
|
6027
|
+
aborted,
|
|
6028
|
+
toolCallId: event.toolCallId
|
|
6029
|
+
}, "repeat-call guard fired");
|
|
6030
|
+
if (aborted) ctx.abort();
|
|
6031
|
+
return {
|
|
6032
|
+
block: true,
|
|
6033
|
+
reason: repeatBlockReason({
|
|
6034
|
+
toolName: event.toolName,
|
|
6035
|
+
streak,
|
|
6036
|
+
aborted
|
|
6037
|
+
})
|
|
6038
|
+
};
|
|
6039
|
+
});
|
|
6040
|
+
};
|
|
6041
|
+
//#endregion
|
|
5975
6042
|
//#region src/extensions/sleep-guard.ts
|
|
5976
6043
|
/**
|
|
5977
6044
|
* Foreground sleep guard: block `sleep` commands that hold the turn open.
|
|
@@ -7584,6 +7651,7 @@ const all = [
|
|
|
7584
7651
|
bashDefaultTimeoutExtension,
|
|
7585
7652
|
diskGuardExtension,
|
|
7586
7653
|
noopLoopGuardExtension,
|
|
7654
|
+
repeatCallGuardExtension,
|
|
7587
7655
|
sleepGuardExtension,
|
|
7588
7656
|
toolCallSummaryExtension
|
|
7589
7657
|
];
|