@sema-agent/core 1.295.0 → 1.296.1
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/agents/subagent.d.ts.map +1 -1
- package/dist/agents/subagent.js +2 -0
- package/dist/agents/subagent.js.map +1 -1
- package/dist/bin/sema-tb.d.ts +20 -0
- package/dist/bin/sema-tb.d.ts.map +1 -1
- package/dist/bin/sema-tb.js +64 -21
- package/dist/bin/sema-tb.js.map +1 -1
- package/dist/brain/anthropic.d.ts.map +1 -1
- package/dist/brain/anthropic.js +8 -0
- package/dist/brain/anthropic.js.map +1 -1
- package/dist/brain/openai.d.ts.map +1 -1
- package/dist/brain/openai.js +8 -0
- package/dist/brain/openai.js.map +1 -1
- package/dist/brain/stream-engine.d.ts +7 -0
- package/dist/brain/stream-engine.d.ts.map +1 -1
- package/dist/brain/stream-engine.js +50 -11
- package/dist/brain/stream-engine.js.map +1 -1
- package/dist/brain/timeout.d.ts +2 -1
- package/dist/brain/timeout.d.ts.map +1 -1
- package/dist/brain/timeout.js +14 -1
- package/dist/brain/timeout.js.map +1 -1
- package/dist/core/ask-question.d.ts.map +1 -1
- package/dist/core/ask-question.js.map +1 -1
- package/dist/core/fs-write-gate-policy.d.ts.map +1 -1
- package/dist/core/fs-write-gate-policy.js +5 -11
- package/dist/core/fs-write-gate-policy.js.map +1 -1
- package/dist/core/runner/assemble-result.d.ts +1 -0
- package/dist/core/runner/assemble-result.d.ts.map +1 -1
- package/dist/core/runner/assemble-result.js.map +1 -1
- package/dist/core/runner/call-cap.d.ts +4 -1
- package/dist/core/runner/call-cap.d.ts.map +1 -1
- package/dist/core/runner/call-cap.js +4 -1
- package/dist/core/runner/call-cap.js.map +1 -1
- package/dist/core/runner/cut-kill.d.ts +11 -0
- package/dist/core/runner/cut-kill.d.ts.map +1 -0
- package/dist/core/runner/cut-kill.js +38 -0
- package/dist/core/runner/cut-kill.js.map +1 -0
- package/dist/core/runner/prepare-task.d.ts +5 -0
- package/dist/core/runner/prepare-task.d.ts.map +1 -1
- package/dist/core/runner/prepare-task.js +41 -15
- package/dist/core/runner/prepare-task.js.map +1 -1
- package/dist/core/runner/runtask.d.ts.map +1 -1
- package/dist/core/runner/runtask.js +13 -1
- package/dist/core/runner/runtask.js.map +1 -1
- package/dist/core/sensitive-path-policy.d.ts.map +1 -1
- package/dist/core/sensitive-path-policy.js +5 -4
- package/dist/core/sensitive-path-policy.js.map +1 -1
- package/dist/core/trace.d.ts +3 -0
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/core/trace.js.map +1 -1
- package/dist/core/types.d.ts +3 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/engine/execution-env/kill-tree.d.ts +1 -0
- package/dist/engine/execution-env/kill-tree.d.ts.map +1 -1
- package/dist/engine/execution-env/kill-tree.js +25 -2
- package/dist/engine/execution-env/kill-tree.js.map +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +5 -0
- package/dist/engine/execution-env/node-execution-env.d.ts.map +1 -1
- package/dist/engine/execution-env/node-execution-env.js +19 -0
- package/dist/engine/execution-env/node-execution-env.js.map +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -0
- package/dist/engine/harness/agent-harness.d.ts.map +1 -1
- package/dist/engine/harness/agent-harness.js +4 -0
- package/dist/engine/harness/agent-harness.js.map +1 -1
- package/dist/engine/harness/types.d.ts +7 -0
- package/dist/engine/harness/types.d.ts.map +1 -1
- package/dist/engine/harness/types.js.map +1 -1
- package/dist/engine/llm/types.d.ts +6 -0
- package/dist/engine/llm/types.d.ts.map +1 -1
- package/dist/engine/loop/agent-loop.js +3 -0
- package/dist/engine/loop/agent-loop.js.map +1 -1
- package/dist/engine/loop/types.d.ts +2 -0
- package/dist/engine/loop/types.d.ts.map +1 -1
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.d.ts.map +1 -1
- package/dist/tools/fs/index.d.ts +4 -0
- package/dist/tools/fs/index.d.ts.map +1 -1
- package/dist/tools/fs/index.js +33 -10
- package/dist/tools/fs/index.js.map +1 -1
- package/dist/tools/fs/safety.d.ts +1 -0
- package/dist/tools/fs/safety.d.ts.map +1 -1
- package/dist/tools/fs/safety.js +7 -0
- package/dist/tools/fs/safety.js.map +1 -1
- package/package.json +1 -1
|
@@ -1103,6 +1103,9 @@ export class Runner {
|
|
|
1103
1103
|
turnUsage.cacheWriteTokens += u.cacheWrite || 0;
|
|
1104
1104
|
turnUsage.costMicroUsd += turnCostMicroUsd;
|
|
1105
1105
|
const callEndAt = Date.now();
|
|
1106
|
+
const callIssuedAt = prepared.callIssuedAtRef?.current;
|
|
1107
|
+
if (prepared.callIssuedAtRef)
|
|
1108
|
+
prepared.callIssuedAtRef.current = undefined;
|
|
1106
1109
|
const capLast = prepared.callCapRef?.state.last;
|
|
1107
1110
|
if (prepared.callCapRef) {
|
|
1108
1111
|
recordCallSample(prepared.callCapRef.state, u.output || 0, callStartAt !== undefined ? callEndAt - callStartAt : 0);
|
|
@@ -1123,6 +1126,7 @@ export class Runner {
|
|
|
1123
1126
|
cacheWrite: u.cacheWrite || 0,
|
|
1124
1127
|
latencyMs: callStartAt !== undefined ? callEndAt - callStartAt : 0,
|
|
1125
1128
|
firstTokenMs: callStartAt !== undefined && firstTokenAt !== undefined ? firstTokenAt - callStartAt : undefined,
|
|
1129
|
+
...(callIssuedAt !== undefined ? { callStartedAt: callIssuedAt } : {}),
|
|
1126
1130
|
costMicroUsd: turnCostMicroUsd,
|
|
1127
1131
|
...(capLast !== undefined ? { callCap: capLast.cap, capThinkingSkipped: capLast.thinkingSkipped } : {}),
|
|
1128
1132
|
...(m.role === "assistant" && typeof m.stopReason === "string"
|
|
@@ -2317,7 +2321,8 @@ export class Runner {
|
|
|
2317
2321
|
const toolClamps = prepared.callCapRef?.toolClamps ?? 0;
|
|
2318
2322
|
const toolCuts = prepared.callCapRef?.toolCuts ?? 0;
|
|
2319
2323
|
const pendingCutTools = prepared.callCapRef?.pendingCutTools ?? 0;
|
|
2320
|
-
|
|
2324
|
+
const toolCutKills = prepared.cutKills?.kills ?? 0;
|
|
2325
|
+
if (finalizeInjected || nudgesSent > 0 || capShrinks > 0 || callCutoffs > 0 || toolClamps > 0 || toolCuts > 0 || toolCutKills > 0 || pendingCutTools > 0 || finalVerifyInjections > 0 || attachmentsInjected > 0 || repetitionCuts > 0 || repetitionSpared > 0) {
|
|
2321
2326
|
stats.mechanisms = {
|
|
2322
2327
|
...(finalizeInjected ? { finalizeInjected: true } : {}),
|
|
2323
2328
|
...(nudgesSent > 0 ? { nudgesSent } : {}),
|
|
@@ -2325,6 +2330,7 @@ export class Runner {
|
|
|
2325
2330
|
...(callCutoffs > 0 ? { callCutoffs } : {}),
|
|
2326
2331
|
...(toolClamps > 0 ? { toolClamps } : {}),
|
|
2327
2332
|
...(toolCuts > 0 ? { toolCuts } : {}),
|
|
2333
|
+
...(toolCutKills > 0 ? { toolCutKills } : {}),
|
|
2328
2334
|
...(pendingCutTools > 0 ? { pendingCutTools } : {}),
|
|
2329
2335
|
...(finalVerifyInjections > 0 ? { finalVerifyInjected: true } : {}),
|
|
2330
2336
|
...(finalVerifyInjections > 0 ? { finalVerifyInjections } : {}),
|
|
@@ -2425,6 +2431,9 @@ export class Runner {
|
|
|
2425
2431
|
...(stats.mechanisms !== undefined
|
|
2426
2432
|
? { mechanisms: (({ repetitionEvents: _events, ...scalars }) => scalars)(stats.mechanisms) }
|
|
2427
2433
|
: {}),
|
|
2434
|
+
...(timeout.latenessMs !== undefined && timeout.latenessMs > TIMER_LATENESS_REPORT_MS
|
|
2435
|
+
? { timerLatenessMs: timeout.latenessMs }
|
|
2436
|
+
: {}),
|
|
2428
2437
|
ts: Date.now(),
|
|
2429
2438
|
}));
|
|
2430
2439
|
setResult(result);
|
|
@@ -3102,12 +3111,15 @@ export function runTask(spec, deps) {
|
|
|
3102
3111
|
return new Runner(deps).runTask(spec);
|
|
3103
3112
|
}
|
|
3104
3113
|
const WALLTIME_SUSPEND_GRACE_SEC = 120;
|
|
3114
|
+
const TIMER_LATENESS_REPORT_MS = 5_000;
|
|
3105
3115
|
function startTimeout(harness, abortController, timeoutSec, softSuspendable = false) {
|
|
3106
3116
|
const state = { fired: false, clear: () => { } };
|
|
3107
3117
|
if (timeoutSec && timeoutSec > 0) {
|
|
3108
3118
|
const hardSec = softSuspendable ? timeoutSec + WALLTIME_SUSPEND_GRACE_SEC : timeoutSec;
|
|
3119
|
+
const scheduledAtMs = Date.now() + hardSec * 1000;
|
|
3109
3120
|
const timer = setTimeout(() => {
|
|
3110
3121
|
state.fired = true;
|
|
3122
|
+
state.latenessMs = Math.max(0, Date.now() - scheduledAtMs);
|
|
3111
3123
|
abortController.abort();
|
|
3112
3124
|
void harness.abort();
|
|
3113
3125
|
}, hardSec * 1000);
|