@cortexkit/opencode-magic-context 0.46.0 → 0.47.0
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/auto-search-worker.js +115 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts.map +1 -1
- package/dist/config/migrate-config-location.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +15 -7
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-7fj2b9jw.js → conflict-warning-hook-z44ynfz7.js} +5 -4
- package/dist/{context-8dkpszy5.js → context-wq4ffwyb.js} +164 -37
- package/dist/{derive-budgets-7nj7r1rv.js → derive-budgets-ke12jnnh.js} +1 -1
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +7 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +2 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-storage.d.ts +8 -2
- package/dist/features/magic-context/session-project-storage.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +2 -5
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +12 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +7 -2
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +3 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts +8 -0
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts.map +1 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-blocking.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-blocking.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts +7 -0
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-host-review.fixture.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-host-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-lock-review.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-lock-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-long-lock-review.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-long-lock-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-omp-host-review.fixture.d.ts +4 -0
- package/dist/hooks/magic-context/auto-search-omp-host-review.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-omp-loader.fixture.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-omp-loader.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-snapshot.fixture.d.ts +4 -0
- package/dist/hooks/magic-context/auto-search-snapshot.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +69 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-worker.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-worker.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +3 -5
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +3 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +2 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-drain-gate.d.ts +11 -0
- package/dist/hooks/magic-context/historian-drain-gate.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook.d.ts +2 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts +25 -0
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +61 -0
- package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/opencode-proven-floor.d.ts +6 -0
- package/dist/hooks/magic-context/opencode-proven-floor.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/reasoning-budget-status.d.ts +15 -0
- package/dist/hooks/magic-context/reasoning-budget-status.d.ts.map +1 -0
- package/dist/hooks/magic-context/reasoning-budget.d.ts +40 -0
- package/dist/hooks/magic-context/reasoning-budget.d.ts.map +1 -0
- package/dist/hooks/magic-context/reasoning-removal.d.ts +6 -6
- package/dist/hooks/magic-context/reasoning-removal.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +4 -0
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +7 -3
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +13 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +5 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +3 -28
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +28 -6
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +3 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-0d3g3461.js → index-0c82743p.js} +2 -1
- package/dist/{index-e2dtv0ra.js → index-5a2r0p9f.js} +3 -3
- package/dist/{index-p821bjdb.js → index-6d9e1m08.js} +4726 -11050
- package/dist/{index-majxda46.js → index-6wkcswft.js} +1 -1
- package/dist/index-92bp57hg.js +2063 -0
- package/dist/{index-sfnj6h8h.js → index-9pk9exrb.js} +3 -3
- package/dist/{index-7qw742ev.js → index-adwfkpex.js} +5 -24
- package/dist/{index-3h0ybwah.js → index-bb36vgr3.js} +80 -12
- package/dist/{index-k4404na5.js → index-cwf6s3ay.js} +1072 -2422
- package/dist/index-fnn5pjtt.js +6554 -0
- package/dist/{index-j7fvnjye.js → index-gg8j07zz.js} +1 -1
- package/dist/{index-yasgb8ej.js → index-m5fe6jch.js} +9 -3
- package/dist/{v2/server-g0fjrkta.js → index-rrbbspwh.js} +42 -27
- package/dist/index-rrrsepyw.js +3464 -0
- package/dist/{index-qr6r7akd.js → index-w2t4ah5j.js} +950 -502
- package/dist/{v2/server-fg34g6a5.js → index-wx8a6bw3.js} +48 -8
- package/dist/{index-r5hmbx3t.js → index-x3kwrmqk.js} +146 -3571
- package/dist/index-yr3zj7e7.js +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +624 -65
- package/dist/{message-time-backfill-68gj6t3e.js → message-time-backfill-r5epkzj3.js} +1 -1
- package/dist/migration-worker.js +7 -5
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/host-stall-profiler-report.d.ts +67 -0
- package/dist/plugin/host-stall-profiler-report.d.ts.map +1 -0
- package/dist/plugin/host-stall-profiler.d.ts +96 -0
- package/dist/plugin/host-stall-profiler.d.ts.map +1 -0
- package/dist/plugin/messages-transform.d.ts +21 -6
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/{read-session-chunk-egz7r68d.js → read-session-chunk-4jey7hpt.js} +4 -4
- package/dist/{recomp-orchestrator-ejq7ex5d.js → recomp-orchestrator-rervg6q4.js} +13 -10
- package/dist/{send-session-notification-dyw42dtr.js → send-session-notification-0m68ms3n.js} +4 -3
- package/dist/shared/auto-search-lifecycle.d.ts +7 -0
- package/dist/shared/auto-search-lifecycle.d.ts.map +1 -0
- package/dist/shared/historian-tool-expansions.d.ts +1 -1
- package/dist/shared/historian-tool-expansions.d.ts.map +1 -1
- package/dist/shared/historian-tool-template.d.ts +2 -2
- package/dist/shared/historian-tool-template.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +16 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +4 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-tz3pat2p.js → transform-postprocess-phase-z5hzpsxv.js} +13 -10
- package/dist/v2/auto-search-worker.js +115 -0
- package/dist/v2/{context-8vgtb6sz.js → context-14v1hr8b.js} +4918 -5760
- package/dist/v2/{derive-budgets-kdgp4s3r.js → derive-budgets-nc9avxz8.js} +2 -2
- package/dist/v2/embedding-worker.js +3 -3
- package/dist/v2/hidden-child-native.d.ts +7 -0
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +8 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +15 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +54 -3
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +12 -1
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/{message-time-backfill-r6qkem1x.js → message-time-backfill-1f9tzvcs.js} +1 -1
- package/dist/v2/migration-worker.js +7 -5
- package/dist/v2/{read-session-chunk-8vjp6581.js → read-session-chunk-gyyv7w2r.js} +4 -4
- package/dist/v2/{recomp-orchestrator-5xj0yzyk.js → recomp-orchestrator-42vjba7p.js} +17 -14
- package/dist/v2/{send-session-notification-qs0j78v6.js → send-session-notification-c0wtscea.js} +5 -4
- package/dist/v2/server-3trjk1hx.js +6360 -0
- package/dist/v2/{server-xtp687da.js → server-50hvkg3v.js} +9 -3
- package/dist/v2/{server-y8maxeft.js → server-cpepxy2q.js} +2 -1
- package/dist/v2/server-d0sraw7m.js +3403 -0
- package/dist/v2/server-e0c1b7a7.js +2063 -0
- package/dist/v2/{server-mcfawjgc.js → server-efhwzx05.js} +5 -24
- package/dist/v2/{server-3n4q9xme.js → server-fcdehk1s.js} +1 -1
- package/dist/{index-q4yp4b52.js → v2/server-fq7kq32k.js} +42 -27
- package/dist/v2/{server-vnh7r35f.js → server-nf82q6pt.js} +2459 -8603
- package/dist/v2/{server-frbm99q5.js → server-njt3np1k.js} +99 -3465
- package/dist/v2/{server-qp5hx1ad.js → server-nm9n3aqq.js} +107 -12
- package/dist/v2/{server-p2en78c8.js → server-rz514f14.js} +7 -2
- package/dist/v2/{server-wvjvfhck.js → server-vd4e7174.js} +1 -1
- package/dist/{index-fg34g6a5.js → v2/server-wx8a6bw3.js} +48 -8
- package/dist/v2/{server-4663ejam.js → server-y10vbq6y.js} +1 -1
- package/dist/v2/server-yr3zj7e7.js +23 -0
- package/dist/v2/server.js +5 -5
- package/dist/v2/{wrapup-orchestrator-r5t1pyj8.js → wrapup-orchestrator-nbz854vc.js} +16 -13
- package/dist/wrapup-orchestrator-b2dztrar.js +29 -0
- package/package.json +6 -5
- package/src/config/index.ts +6 -0
- package/src/config/live-run-config.test.ts +37 -1
- package/src/config/live-run-config.ts +28 -0
- package/src/config/migrate-config-location.ts +10 -3
- package/src/config/schema/magic-context.test.ts +4 -3
- package/src/config/schema/magic-context.ts +23 -6
- package/src/shared/auto-search-lifecycle.ts +27 -0
- package/src/shared/historian-tool-defaults.json +6 -6
- package/src/shared/historian-tool-expansions.ts +65 -8
- package/src/shared/historian-tool-preview-defaults.json +13 -0
- package/src/shared/historian-tool-template.ts +48 -14
- package/src/shared/sqlite-640-review-r2.test.ts +136 -0
- package/src/shared/sqlite-640-review.test.ts +183 -0
- package/src/shared/sqlite-acquisition-routing.test.ts +18 -0
- package/src/shared/sqlite.ts +84 -14
- package/src/shared/status-view.test.ts +6 -1
- package/src/shared/status-view.ts +15 -1
- package/src/shared/tag-transcript.ts +6 -0
- package/src/shared/window-geometry.ts +10 -0
- package/dist/wrapup-orchestrator-kw3x3myw.js +0 -26
- /package/dist/{index-en1k8h8m.js → index-5prbx026.js} +0 -0
- /package/dist/v2/{index-en1k8h8m.js → index-5prbx026.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sendStatusNotification2
|
|
3
|
-
} from "./index-7qw742ev.js";
|
|
4
1
|
import {
|
|
5
2
|
importPluginModule,
|
|
6
3
|
log
|
|
7
4
|
} from "./index-hybnrwq0.js";
|
|
5
|
+
import {
|
|
6
|
+
sendStatusNotification2
|
|
7
|
+
} from "./index-adwfkpex.js";
|
|
8
8
|
import {
|
|
9
9
|
formatConflictShort
|
|
10
10
|
} from "./index-8da2zjhz.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
observeEmbeddingActivity
|
|
3
|
+
} from "./index-yr3zj7e7.js";
|
|
1
4
|
import {
|
|
2
5
|
importPluginModule,
|
|
3
6
|
sessionLog
|
|
@@ -7,33 +10,11 @@ import {
|
|
|
7
10
|
} from "./index-fzbvakh0.js";
|
|
8
11
|
import {
|
|
9
12
|
shouldHoldIgnoredNotification
|
|
10
|
-
} from "./index-
|
|
13
|
+
} from "./index-6wkcswft.js";
|
|
11
14
|
import {
|
|
12
15
|
getErrorMessage
|
|
13
16
|
} from "./index-y8v6yerm.js";
|
|
14
17
|
|
|
15
|
-
// src/shared/embedding-activity.ts
|
|
16
|
-
var busySessions = new Set;
|
|
17
|
-
function setEmbeddingSessionBusy(sessionId, busy) {
|
|
18
|
-
if (busy)
|
|
19
|
-
busySessions.add(sessionId);
|
|
20
|
-
else
|
|
21
|
-
busySessions.delete(sessionId);
|
|
22
|
-
}
|
|
23
|
-
function observeEmbeddingActivity(event) {
|
|
24
|
-
const props = event.properties;
|
|
25
|
-
if (!props || typeof props.sessionID !== "string")
|
|
26
|
-
return;
|
|
27
|
-
if (event.type === "session.idle" || event.type === "session.deleted" || event.type === "session.status" && props.status?.type === "idle") {
|
|
28
|
-
setEmbeddingSessionBusy(props.sessionID, false);
|
|
29
|
-
} else if (event.type === "session.status" && props.status?.type) {
|
|
30
|
-
setEmbeddingSessionBusy(props.sessionID, true);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function isEmbeddingHostBusy() {
|
|
34
|
-
return busySessions.size > 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
18
|
// src/hooks/magic-context/send-session-notification.ts
|
|
38
19
|
var MAX_QUEUED_IGNORED_NOTIFICATIONS2 = 16;
|
|
39
20
|
var queuedIgnoredNotifications = new Map;
|
|
@@ -420,4 +401,4 @@ async function sendStatusNotification2(_client, sessionId, text, params) {
|
|
|
420
401
|
}
|
|
421
402
|
}
|
|
422
403
|
|
|
423
|
-
export {
|
|
404
|
+
export { MAX_QUEUED_IGNORED_NOTIFICATIONS2, __ignoredNotificationTest2, setNotificationServerUrl2, sendCommandResult2, sendIgnoredMessage2, flushIgnoredMessages2, clearIgnoredMessages2, observeIgnoredNotificationEvent2, sendStatusNotification2 };
|
|
@@ -39,13 +39,13 @@ import {
|
|
|
39
39
|
DEFAULT_PROTECTED_TOOLS,
|
|
40
40
|
normalizeProtectedToolName,
|
|
41
41
|
mergeProtectedTools
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-rrbbspwh.js";
|
|
43
43
|
import {
|
|
44
44
|
openCodeDbExists,
|
|
45
45
|
withReadOnlySessionDb,
|
|
46
46
|
getRawSessionMessageCountFromDb,
|
|
47
47
|
getMessageTimesFromOpenCodeDb
|
|
48
|
-
} from "./index-
|
|
48
|
+
} from "./index-6wkcswft.js";
|
|
49
49
|
import {
|
|
50
50
|
canonicalModelIdentity
|
|
51
51
|
} from "./index-avwt563y.js";
|
|
@@ -2187,6 +2187,17 @@ function getAllStatusTagTokenTotalsFlat(db, sessionId, floor = 0, calibration =
|
|
|
2187
2187
|
}
|
|
2188
2188
|
return { totals, nullMessageIds };
|
|
2189
2189
|
}
|
|
2190
|
+
function getReasoningTokenEstimatesByMessage(db, sessionId, proseRatio) {
|
|
2191
|
+
const rows = db.prepare(`SELECT type, message_id, tool_owner_message_id, reasoning_token_count FROM tags WHERE session_id = ? AND reasoning_token_count IS NOT NULL`).all(sessionId);
|
|
2192
|
+
const totals = new Map;
|
|
2193
|
+
for (const row of rows) {
|
|
2194
|
+
if (row.type !== "message")
|
|
2195
|
+
continue;
|
|
2196
|
+
const id = ownerMessageIdForTagRow(row);
|
|
2197
|
+
totals.set(id, Math.max(totals.get(id) ?? 0, row.reasoning_token_count * proseRatio));
|
|
2198
|
+
}
|
|
2199
|
+
return totals;
|
|
2200
|
+
}
|
|
2190
2201
|
function tagTokenCountIsNull(db, sessionId, tagNumber) {
|
|
2191
2202
|
const row = db.prepare("SELECT token_count FROM tags WHERE session_id = ? AND tag_number = ?").get(sessionId, tagNumber);
|
|
2192
2203
|
return row != null && row.token_count === null;
|
|
@@ -2948,6 +2959,20 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
|
|
|
2948
2959
|
}
|
|
2949
2960
|
// src/shared/historian-tool-defaults.json
|
|
2950
2961
|
var historian_tool_defaults_default = {
|
|
2962
|
+
ctx_note: "Note ${input.action} ${input.note_ids}: ${input.content} → ${output.truncate(160)}",
|
|
2963
|
+
ctx_memory: "Memory ${input.action} ${input.category} ${input.ids}: ${input.content} → ${output.truncate(160)}",
|
|
2964
|
+
todowrite: 'Todos (${input.todos.count}): ${input.todos.each("${status}: ${content}")}',
|
|
2965
|
+
question: 'Asked user: ${input.questions[*].question.join(" / ")} → ${output}',
|
|
2966
|
+
task: "Task ${input.subagent_type}: ${input.prompt.truncate(600)} → ${output.truncate(200)}",
|
|
2967
|
+
ask: 'Asked: ${input.question} [options: ${input.options.join(" / ")}] ${input.text}${input.resolution} → ${output.truncate(300)}',
|
|
2968
|
+
peer_send: "PM ${input.recipient}: ${input.message}",
|
|
2969
|
+
board: 'Board ${input.verb}${input.board_lane}: ${input.ops.each("${op} ${lane_label} ${item}${props.text}${lane.items} ${state}${props.state}${lane.status}${id}${title}")}',
|
|
2970
|
+
room: "Room ${input.action} ${input.room_label}: ${input.room_detail}",
|
|
2971
|
+
work: "Work ${input.action} ${input.title}${input.id}: ${input.prompt.truncate(600)}${input.notes.truncate(600)} → ${output.truncate(160)}",
|
|
2972
|
+
knowhow: "Looked up how-to: ${input.query}${input.id}"
|
|
2973
|
+
};
|
|
2974
|
+
// src/shared/historian-tool-preview-defaults.json
|
|
2975
|
+
var historian_tool_preview_defaults_default = {
|
|
2951
2976
|
ctx_note: "Note ${input.action} ${input.note_ids}: ${input.content} → ${output.truncate(160)}",
|
|
2952
2977
|
ctx_memory: "Memory ${input.action} ${input.category} ${input.ids}: ${input.content} → ${output.truncate(160)}",
|
|
2953
2978
|
todowrite: 'Todos (${input.todos.count}): ${input.todos.each("${status}: ${content}")}',
|
|
@@ -2962,17 +2987,48 @@ var historian_tool_defaults_default = {
|
|
|
2962
2987
|
};
|
|
2963
2988
|
|
|
2964
2989
|
// src/shared/historian-tool-expansions.ts
|
|
2965
|
-
function
|
|
2990
|
+
function builtinInput(tool, input) {
|
|
2991
|
+
if (!input || typeof input !== "object")
|
|
2992
|
+
return input;
|
|
2993
|
+
const i = input;
|
|
2994
|
+
if (tool === "peer_send") {
|
|
2995
|
+
const external = i.external;
|
|
2996
|
+
const recipient = i.reply_to_pmid ? `reply to ${i.reply_to_pmid}` : i.agent || i.agent_id ? `to ${i.agent || i.agent_id}` : external?.session_id || i.session_id ? `to session ${external?.session_id || i.session_id}` : "to unknown recipient";
|
|
2997
|
+
return { ...i, recipient };
|
|
2998
|
+
}
|
|
2999
|
+
if (tool === "room") {
|
|
3000
|
+
return {
|
|
3001
|
+
...i,
|
|
3002
|
+
room_label: i.room_id || i.title,
|
|
3003
|
+
room_detail: i.action === "create" || i.action === "invite" ? `invitees: ${renderToolTemplate("${input.invitees}", i)}` : i.text
|
|
3004
|
+
};
|
|
3005
|
+
}
|
|
3006
|
+
if (tool === "board") {
|
|
3007
|
+
return {
|
|
3008
|
+
...i,
|
|
3009
|
+
board_lane: i.lane ? ` ${i.lane}` : "",
|
|
3010
|
+
ops: Array.isArray(i.ops) ? i.ops.map((op) => op && typeof op === "object" ? {
|
|
3011
|
+
...op,
|
|
3012
|
+
lane_label: typeof op.lane === "string" ? op.lane : op.lane?.title || op.lane?.id
|
|
3013
|
+
} : op) : i.ops
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
return input;
|
|
3017
|
+
}
|
|
3018
|
+
function expandToolPart(part, overrides, legacyPreview = false) {
|
|
2966
3019
|
if (!part || typeof part !== "object")
|
|
2967
3020
|
return null;
|
|
2968
3021
|
const p = part;
|
|
2969
3022
|
if (p.type !== "tool" || typeof p.tool !== "string")
|
|
2970
3023
|
return null;
|
|
2971
|
-
const
|
|
3024
|
+
const builtinDefaults = legacyPreview ? historian_tool_preview_defaults_default : historian_tool_defaults_default;
|
|
3025
|
+
const overridden = overrides && Object.hasOwn(overrides, p.tool);
|
|
3026
|
+
const template = overridden ? overrides[p.tool] : Object.hasOwn(builtinDefaults, p.tool) ? builtinDefaults[p.tool] : undefined;
|
|
2972
3027
|
if (typeof template !== "string")
|
|
2973
3028
|
return null;
|
|
2974
3029
|
const state = p.state;
|
|
2975
|
-
|
|
3030
|
+
const input = overridden || legacyPreview ? state?.input : builtinInput(p.tool, state?.input);
|
|
3031
|
+
return renderToolTemplate(template, input, state?.output ?? state?.error, legacyPreview);
|
|
2976
3032
|
}
|
|
2977
3033
|
|
|
2978
3034
|
// src/hooks/magic-context/host-served-rows.ts
|
|
@@ -3928,20 +3984,22 @@ function fenceBoundaryForCompletedToolArcs(candidate, arcs, publicationFloorOrdi
|
|
|
3928
3984
|
return minInvocation < publicationFloorOrdinal ? maxResult + 1 : minInvocation;
|
|
3929
3985
|
}
|
|
3930
3986
|
function fenceBoundaryForToolArcs(candidate, arcs, lastCompartmentEndOrdinal, recentOpenArcCutoff) {
|
|
3931
|
-
|
|
3987
|
+
let boundary = fenceBoundaryForCompletedToolArcs(candidate, arcs, lastCompartmentEndOrdinal + 1);
|
|
3932
3988
|
for (const arc of arcs) {
|
|
3933
3989
|
if (arc.resOrdinal !== null)
|
|
3934
3990
|
continue;
|
|
3935
3991
|
if (arc.invOrdinal < recentOpenArcCutoff)
|
|
3936
3992
|
continue;
|
|
3937
3993
|
if (arc.invOrdinal >= lastCompartmentEndOrdinal + 1 && arc.invOrdinal < boundary) {
|
|
3938
|
-
|
|
3994
|
+
boundary = arc.invOrdinal;
|
|
3995
|
+
break;
|
|
3939
3996
|
}
|
|
3940
3997
|
if (arc.invOrdinal >= boundary) {
|
|
3941
|
-
|
|
3998
|
+
boundary = arc.invOrdinal;
|
|
3999
|
+
break;
|
|
3942
4000
|
}
|
|
3943
4001
|
}
|
|
3944
|
-
return boundary;
|
|
4002
|
+
return fenceBoundaryForCompletedToolArcs(boundary, arcs, 1);
|
|
3945
4003
|
}
|
|
3946
4004
|
function tokenForMessage(message, options) {
|
|
3947
4005
|
const key = messageCacheKey(message, options);
|
|
@@ -4731,7 +4789,7 @@ function estimateFinalWireInputTokens(input) {
|
|
|
4731
4789
|
total.toolCall += next.toolCall;
|
|
4732
4790
|
return total;
|
|
4733
4791
|
}, { conversation: 0, toolCall: 0 });
|
|
4734
|
-
const measuredToolDefinitions = input.providerID && input.modelID ? getMeasuredToolDefinitionTokens(input.providerID, input.modelID, input.agentName) : undefined;
|
|
4792
|
+
const measuredToolDefinitions = input.toolDefinitionTokens ?? (input.providerID && input.modelID ? getMeasuredToolDefinitionTokens(input.providerID, input.modelID, input.agentName) : undefined);
|
|
4735
4793
|
const calibration = resolveDecisionCalibration(input.providerID, input.modelID);
|
|
4736
4794
|
const largestToolDefinitions = measuredToolDefinitions === undefined ? getLargestMeasuredToolDefinitionTokens() : undefined;
|
|
4737
4795
|
const toolDefinitions = measuredToolDefinitions ?? (largestToolDefinitions === undefined ? undefined : Math.ceil(largestToolDefinitions * UNKNOWN_FIT_RATIO / (calibration.seeded ? calibration.toolsRatio : UNKNOWN_FIT_RATIO)));
|
|
@@ -4964,10 +5022,15 @@ function detectThinkingBindingMismatch(error) {
|
|
|
4964
5022
|
...firstChangedPath ? { firstChangedPath } : {}
|
|
4965
5023
|
};
|
|
4966
5024
|
}
|
|
5025
|
+
function detectLatestTurnThinkingMismatch(error) {
|
|
5026
|
+
const status = extractExplicitHttpStatus(error);
|
|
5027
|
+
return (status === undefined || status === 400) && /(?:thinking|redacted_thinking)[\s\S]*latest assistant (?:message|turn)[\s\S]*cannot be modified/i.test(extractErrorMessage(error));
|
|
5028
|
+
}
|
|
4967
5029
|
var PREFIX_BOUND_THINKING_MODELS = [
|
|
4968
5030
|
["fable", 5, 1],
|
|
4969
5031
|
["opus", 5, 5],
|
|
4970
|
-
["sonnet", 5, 5]
|
|
5032
|
+
["sonnet", 5, 5],
|
|
5033
|
+
["haiku", 5, 5]
|
|
4971
5034
|
];
|
|
4972
5035
|
var PREFIX_BOUND_THINKING_PATTERN = new RegExp(`(?:^|[-_.:/])(?:${PREFIX_BOUND_THINKING_MODELS.map(([family, major, minor]) => `${family}[-_.]?${major}[-_.]${minor}`).join("|")})(?:$|[-_.:/@])`, "i");
|
|
4973
5036
|
function isPrefixBoundThinkingModel(_providerID, modelID) {
|
|
@@ -5104,6 +5167,9 @@ function restoreNeutralizedReasoningPart(part, legacyCleared) {
|
|
|
5104
5167
|
function isNeutralizedReasoningPart(part) {
|
|
5105
5168
|
return isRecord(part) && part[REMOVED_REASONING_MARK] === true;
|
|
5106
5169
|
}
|
|
5170
|
+
function neutralizedReasoningSource(part) {
|
|
5171
|
+
return isRecord(part) ? NEUTRALIZED_ORIGINALS.get(part) ?? part : part;
|
|
5172
|
+
}
|
|
5107
5173
|
var VARIANT_CACHE_PRESERVING_MODELS = {
|
|
5108
5174
|
"anthropic/claude-fable-5-1": "2026-09-02",
|
|
5109
5175
|
"openai/gpt-6-astra": "2026-09-05",
|
|
@@ -5556,6 +5622,8 @@ function createToolDropTarget(compositeKey, thinkingParts, index, batch, tagId)
|
|
|
5556
5622
|
return "truncated";
|
|
5557
5623
|
};
|
|
5558
5624
|
return {
|
|
5625
|
+
dropReasoningParts: thinkingParts,
|
|
5626
|
+
mutationParts: index.get(compositeKey)?.occurrences.map(({ message, part }) => ({ message, part })) ?? [],
|
|
5559
5627
|
measureReclaim: (skeleton) => {
|
|
5560
5628
|
const entry = index.get(compositeKey);
|
|
5561
5629
|
const parts = entry?.occurrences.map((occ) => occ.part) ?? [];
|
|
@@ -6537,4 +6605,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
|
|
|
6537
6605
|
});
|
|
6538
6606
|
}
|
|
6539
6607
|
|
|
6540
|
-
export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, getAllStatusTagTokenTotalsFlat, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, markWhitespaceAssistantTagInert, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, updateTagMessageId, foldShrunkPartTags, markTagsCompactedByMessageIds, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, TAG_SELECT_COLUMNS, getTagsBySession, getActiveTagsBySession, getTailHygieneTags, getDroppedTagsBySession, getTagsByNumbers, getNewestToolTagNumbers, getDroppedTagsByNumbers, getMaxDroppedTagNumber, getTagById, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, isStrictGapHealingMessage, isRawCompactionSummaryInfo, extractInMemoryMessageViews, buildInMemoryTailRawMessages, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, toolPartHasUserAnswer, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, recordToolParameters, createDroppedInputGuard, assertExecutableToolInput, createDroppedInputToolExecuteBeforeHook, isEditTool, describeFinalWireTail, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, detectThinkingBindingMismatch, isPrefixBoundThinkingModel, detectOverflow, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, SKELETON_REAL_INPUT_MAX_BYTES, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, readRawSessionMessageRange2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
6608
|
+
export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, getAllStatusTagTokenTotalsFlat, getReasoningTokenEstimatesByMessage, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, markWhitespaceAssistantTagInert, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, updateTagMessageId, foldShrunkPartTags, markTagsCompactedByMessageIds, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, TAG_SELECT_COLUMNS, getTagsBySession, getActiveTagsBySession, getTailHygieneTags, getDroppedTagsBySession, getTagsByNumbers, getNewestToolTagNumbers, getDroppedTagsByNumbers, getMaxDroppedTagNumber, getTagById, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, isStrictGapHealingMessage, isRawCompactionSummaryInfo, extractInMemoryMessageViews, buildInMemoryTailRawMessages, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, toolPartHasUserAnswer, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, recordToolParameters, createDroppedInputGuard, assertExecutableToolInput, createDroppedInputToolExecuteBeforeHook, isEditTool, describeFinalWireTail, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, neutralizedReasoningSource, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, SKELETON_REAL_INPUT_MAX_BYTES, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, readRawSessionMessageRange2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|