@retaw106/mmc-oc 2.2.1 → 2.4.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/cli.js +14 -3
- package/dist/config/deprecated-config.d.ts +4 -0
- package/dist/config/deprecated-config.d.ts.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +2 -2
- package/dist/config/schema/magic-context.d.ts +36 -3
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/config-init.js +14 -3
- package/dist/{context-mrvm92n8.js → context-c72brxe5.js} +2410 -1801
- package/dist/{derive-budgets-rjjz5f7y.js → derive-budgets-s1p37t2g.js} +2 -2
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/historian-failure-reason.d.ts +7 -0
- package/dist/features/magic-context/historian-failure-reason.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/launcher.d.ts +13 -4
- package/dist/features/magic-context/memory-maintainer/launcher.d.ts.map +1 -1
- package/dist/features/magic-context/memory-maintainer/manual-commands.d.ts.map +1 -1
- package/dist/features/magic-context/memory-maintainer/model-chain.d.ts +47 -0
- package/dist/features/magic-context/memory-maintainer/model-chain.d.ts.map +1 -0
- package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts +17 -4
- package/dist/features/magic-context/memory-maintainer/oc2-adapter.d.ts.map +1 -1
- package/dist/features/magic-context/memory-maintainer/pipeline.d.ts +6 -0
- package/dist/features/magic-context/memory-maintainer/pipeline.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +21 -3
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +7 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/pi-content-decisions.d.ts +7 -1
- package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +29 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts +2 -0
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-compartment-history-version.d.ts +4 -0
- package/dist/features/magic-context/storage-compartment-history-version.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +23 -5
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts +7 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +5 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tag-identity-revision.d.ts +50 -0
- package/dist/features/magic-context/storage-tag-identity-revision.d.ts.map +1 -0
- package/dist/features/magic-context/storage-tags.d.ts +159 -5
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +2 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +60 -2
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts +34 -0
- package/dist/hooks/magic-context/__fixtures__/tail-hygiene-refresh.d.ts.map +1 -0
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts +2 -0
- package/dist/hooks/magic-context/active-anthropic-turn.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +10 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts +2 -2
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +2 -2
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger-error.d.ts +11 -0
- package/dist/hooks/magic-context/compartment-trigger-error.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts +1 -0
- package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts +2 -0
- package/dist/hooks/magic-context/degraded-pass-refusal.d.ts.map +1 -1
- package/dist/hooks/magic-context/edit-marker.d.ts +2 -0
- package/dist/hooks/magic-context/edit-marker.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/history-boundary-repair.d.ts +11 -2
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +10 -13
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +62 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +38 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts +16 -9
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +141 -2
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/opaque-thinking.d.ts +12 -0
- package/dist/hooks/magic-context/opaque-thinking.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts +14 -0
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts +10 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -0
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -1
- package/dist/hooks/magic-context/provider-visible-parts.d.ts +51 -0
- package/dist/hooks/magic-context/provider-visible-parts.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +22 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +3 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +5 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +123 -1
- package/dist/hooks/magic-context/read-session-raw.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.d.ts.map +1 -1
- package/dist/hooks/magic-context/render-options.d.ts +19 -0
- package/dist/hooks/magic-context/render-options.d.ts.map +1 -0
- package/dist/hooks/magic-context/sentinel.d.ts +41 -1
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strict-thinking-prefix.d.ts +8 -0
- package/dist/hooks/magic-context/strict-thinking-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +38 -24
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/supersession-reclaim.d.ts +5 -3
- package/dist/hooks/magic-context/supersession-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-date-refresh.d.ts +29 -0
- package/dist/hooks/magic-context/system-date-refresh.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts +6 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts +47 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +18 -5
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +19 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-owner-warmup.d.ts +14 -0
- package/dist/hooks/magic-context/tag-owner-warmup.d.ts.map +1 -0
- package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts +18 -0
- package/dist/hooks/magic-context/tail-hygiene-output-count.d.ts.map +1 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +8 -4
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/token-count-exact.d.ts +35 -0
- package/dist/hooks/magic-context/token-count-exact.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts +2 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-reclaim.d.ts +5 -2
- package/dist/hooks/magic-context/tool-reclaim.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +9 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +21 -11
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +5 -1
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -1
- package/dist/{index-g2z2k5m4.js → index-27ddyx39.js} +2 -2
- package/dist/{index-btp5tdc8.js → index-48e9znrc.js} +1248 -570
- package/dist/{index-5cep2r9n.js → index-5ty9rnbx.js} +60 -258
- package/dist/{index-z2g20msd.js → index-azbmnekv.js} +4 -4
- package/dist/{index-1j34a56j.js → index-dwh99z66.js} +293 -36
- package/dist/{index-qbkzdkk0.js → index-k59af64t.js} +6 -2
- package/dist/{index-5b7x80ec.js → index-kahkxcqw.js} +12532 -10348
- package/dist/{index-53g38ggt.js → index-kmbme1v1.js} +1 -1
- package/dist/{index-amycb7b1.js → index-r7s7d350.js} +3 -3
- package/dist/{index-33gprt9g.js → index-yjv8dpht.js} +1 -1
- package/dist/index-ykq24x1n.js +1477 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +114 -2
- package/dist/{message-time-backfill-phrwp2fz.js → message-time-backfill-j96x1sab.js} +3 -3
- package/dist/model-resolution-cvyrrcjw.js +8 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{read-session-chunk-2xm4sc4y.js → read-session-chunk-t8bg6wkz.js} +6 -4
- package/dist/recomp-orchestrator-k760qy1n.js +21 -0
- package/dist/{safe-notification-target-ph3xd1ve.js → safe-notification-target-1jkf0m82.js} +2 -2
- package/dist/{send-session-notification-rnc4nrsr.js → send-session-notification-njjf3b4s.js} +5 -5
- package/dist/shared/auto-search-lifecycle.d.ts +14 -0
- package/dist/shared/auto-search-lifecycle.d.ts.map +1 -1
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +21 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/models-dev-temperature.d.ts +18 -0
- package/dist/shared/models-dev-temperature.d.ts.map +1 -0
- package/dist/shared/processed-image-eligibility.d.ts +22 -0
- package/dist/shared/processed-image-eligibility.d.ts.map +1 -0
- package/dist/shared/project-directory-key.d.ts +16 -0
- package/dist/shared/project-directory-key.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +5 -0
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- package/dist/shared/reclaim-distance.d.ts +33 -0
- package/dist/shared/reclaim-distance.d.ts.map +1 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts +9 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +35 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/stable-json.d.ts +7 -0
- package/dist/shared/stable-json.d.ts.map +1 -1
- package/dist/shared/storage-file-mutex.d.ts +9 -0
- package/dist/shared/storage-file-mutex.d.ts.map +1 -0
- package/dist/shared/storage-permissions.d.ts +6 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/subagent-temperature.d.ts +46 -0
- package/dist/shared/subagent-temperature.d.ts.map +1 -0
- package/dist/shared/tag-owner-id.d.ts +1 -0
- package/dist/shared/tag-owner-id.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +9 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/tail-hygiene-json.d.ts +22 -0
- package/dist/shared/tail-hygiene-json.d.ts.map +1 -0
- package/dist/shared/user-facing-codes.d.ts +2 -2
- package/dist/shared/window-geometry.d.ts +9 -66
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/standalone-plugin-marker.d.ts +8 -0
- package/dist/standalone-plugin-marker.d.ts.map +1 -0
- package/dist/tools/ctx-expand/search-archive.d.ts +4 -0
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/constants.d.ts +1 -2
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +20 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts +19 -0
- package/dist/v2/hooks/copied-tag-notation.d.ts.map +1 -0
- package/dist/v2/hooks/generate.d.ts +9 -2
- package/dist/v2/hooks/generate.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +22 -1
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/system-prompt-response.d.ts +5 -0
- package/dist/v2/hooks/system-prompt-response.d.ts.map +1 -0
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +26593 -21940
- package/dist/v2/store-reader.d.ts +27 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/web/main.js +401 -23
- package/dist/{wrapup-orchestrator-yknks3ad.js → wrapup-orchestrator-b2gswatj.js} +10 -10
- package/package.json +1 -1
- package/src/config/deprecated-config.ts +18 -0
- package/src/config/index.test.ts +13 -37
- package/src/config/index.ts +2 -2
- package/src/config/latch-permanence-guard.test.ts +4 -0
- package/src/config/project-security.test.ts +17 -0
- package/src/config/project-security.ts +3 -3
- package/src/config/schema/magic-context.test.ts +50 -0
- package/src/config/schema/magic-context.ts +44 -7
- package/src/shared/auto-search-lifecycle.ts +43 -0
- package/src/shared/logger.ts +10 -2
- package/src/shared/model-suggestion-retry.ts +5 -1
- package/src/shared/models-dev-cache.ts +1 -7
- package/src/shared/models-dev-temperature.ts +107 -0
- package/src/shared/processed-image-eligibility.test.ts +68 -0
- package/src/shared/processed-image-eligibility.ts +41 -0
- package/src/shared/processed-image-position-review.json +20 -0
- package/src/shared/processed-image-position-review.test.ts +19 -0
- package/src/shared/project-directory-key.ts +20 -0
- package/src/shared/prompt-surface-runtime.ts +12 -0
- package/src/shared/reclaim-distance.test.ts +111 -0
- package/src/shared/reclaim-distance.ts +91 -0
- package/src/shared/recovery-reasoning-prefix.test.ts +34 -0
- package/src/shared/recovery-reasoning-prefix.ts +35 -0
- package/src/shared/root-async-context.probe.mjs +36 -0
- package/src/shared/root-async-context.test.ts +49 -0
- package/src/shared/sqlite-acquisition-routing.test.ts +4 -3
- package/src/shared/sqlite-busy-budget-review.test.ts +291 -0
- package/src/shared/sqlite-foreground-wait.test.ts +304 -0
- package/src/shared/sqlite-pass-scope.test.ts +4 -4
- package/src/shared/sqlite-writer-diagnostics.test.ts +52 -12
- package/src/shared/sqlite.ts +428 -46
- package/src/shared/stable-json.ts +79 -7
- package/src/shared/storage-file-mutex.test.ts +50 -0
- package/src/shared/storage-file-mutex.ts +130 -0
- package/src/shared/storage-permissions.ts +46 -0
- package/src/shared/subagent-temperature.ts +110 -0
- package/src/shared/tag-owner-id.ts +13 -0
- package/src/shared/tag-transcript.ts +118 -0
- package/src/shared/tail-hygiene-json.test.ts +117 -0
- package/src/shared/tail-hygiene-json.ts +217 -0
- package/src/shared/user-facing-codes.ts +2 -2
- package/src/shared/window-geometry.test.ts +102 -236
- package/src/shared/window-geometry.ts +23 -413
- package/dist/index-ramz5kkm.js +0 -514
- package/dist/model-resolution-wazv26n0.js +0 -6
- package/dist/recomp-orchestrator-frmwj9hz.js +0 -21
- package/src/shared/__fixtures__/window-overlay.v1.json +0 -337
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Database } from "../../shared/sqlite";
|
|
2
2
|
export interface RawMessageParts {
|
|
3
3
|
id: string;
|
|
4
4
|
role: string;
|
|
@@ -36,6 +36,10 @@ export declare function readRawSessionMessagesFromDb(db: Database, sessionId: st
|
|
|
36
36
|
* cannot monopolize the event loop by hydrating an entire long session.
|
|
37
37
|
*/
|
|
38
38
|
export declare function readRawSessionMessagePageFromDb(db: Database, sessionId: string, afterOrdinal: number, limit: number, finalWatermark?: number, after?: RawMessageOrdinalAnchor): RawMessage[];
|
|
39
|
+
/** @internal Message rows examined by raw page reads, including excluded rows. */
|
|
40
|
+
export declare function getRawMessagePageRowsVisitedForTest(): number;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare function resetRawMessagePageRowsVisitedForTest(): void;
|
|
39
43
|
/** Longest text a summary page keeps from one text part or one tool key argument. */
|
|
40
44
|
export declare const RAW_SUMMARY_TEXT_MAX_CHARS = 8192;
|
|
41
45
|
/**
|
|
@@ -46,6 +50,13 @@ export declare const RAW_SUMMARY_TEXT_MAX_CHARS = 8192;
|
|
|
46
50
|
* of small projected parts, whatever the session or tool-output size.
|
|
47
51
|
*/
|
|
48
52
|
export declare function readRawSessionMessageSummaryPageFromDb(db: Database, sessionId: string, afterOrdinal: number, limit: number, finalWatermark?: number, after?: RawMessageOrdinalAnchor): RawMessage[];
|
|
53
|
+
/**
|
|
54
|
+
* Number of ordinal-bearing messages in a session. Counted from the
|
|
55
|
+
* `(session_id, time_created, id)` index minus the session's finished
|
|
56
|
+
* compaction summaries (see {@link countCanonicalOrdinalsIndexed}); the
|
|
57
|
+
* statement below, which reads every message's JSON, is used only when that
|
|
58
|
+
* path is unavailable.
|
|
59
|
+
*/
|
|
49
60
|
export declare function countRawSessionMessageOrdinalsFromDb(db: Database, sessionId: string): number;
|
|
50
61
|
/**
|
|
51
62
|
* Read the canonical raw-message ordinal space without loading or parsing part rows.
|
|
@@ -150,6 +161,85 @@ export declare function buildInMemoryTailRawMessages(args: {
|
|
|
150
161
|
anchorMessageId: string | null;
|
|
151
162
|
}): InMemoryTailResult | null;
|
|
152
163
|
export declare function readRawSessionMessagePartsByIdFromDb(db: Database, sessionId: string, messageId: string, onQuery?: () => void): RawMessageParts | null;
|
|
164
|
+
interface OrdinalKey {
|
|
165
|
+
timeCreated: number;
|
|
166
|
+
id: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Stop reusing every ordinal watermark of a session. The store stamp already
|
|
170
|
+
* catches every write; this lets a removal event drop the watermark early.
|
|
171
|
+
*/
|
|
172
|
+
export declare function forgetRawSessionOrdinalWatermark(sessionId: string): void;
|
|
173
|
+
/** @internal Rows the canonical ordinal statements have visited since the last reset. */
|
|
174
|
+
export declare function getRawSessionOrdinalRowsVisitedForTest(): number;
|
|
175
|
+
/** @internal */
|
|
176
|
+
export declare function resetRawSessionOrdinalRowsVisitedForTest(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Rebuild a session's summary candidates from a full scan on the next count.
|
|
179
|
+
* Needed only after an in-place edit that gave an existing ordinary row the
|
|
180
|
+
* `summary` flag; deletes, inserts, moved timestamps and summaries finishing
|
|
181
|
+
* are all seen without it.
|
|
182
|
+
*/
|
|
183
|
+
export declare function forgetRawSessionSummaryRows(sessionId: string): void;
|
|
184
|
+
/**
|
|
185
|
+
* Record that this process wrote a compaction-summary row, so counts on every
|
|
186
|
+
* connection re-read it even when the write rewrote an existing row in place.
|
|
187
|
+
*/
|
|
188
|
+
export declare function noteRawSessionSummaryRowWritten(sessionId: string, messageId: string): void;
|
|
189
|
+
/** @internal Message rows whose JSON the ordinal counts may have parsed since the last reset. */
|
|
190
|
+
export declare function getRawSessionOrdinalJsonRowsReadForTest(): number;
|
|
191
|
+
/** @internal Full summary scans of a session since the last reset. */
|
|
192
|
+
export declare function getRawSessionSummaryFullScansForTest(): number;
|
|
193
|
+
/** @internal */
|
|
194
|
+
export declare function resetRawSessionOrdinalJsonRowsReadForTest(): void;
|
|
195
|
+
/**
|
|
196
|
+
* A worker snapshot of summary candidates, global rowid anchors and exact ranks.
|
|
197
|
+
* Checkpoints are durable prefix ranks: new messages extend the last anchor,
|
|
198
|
+
* and a revert truncates to the newest surviving checkpoint. Message identities
|
|
199
|
+
* and ordering are immutable outside tail deletion in the OpenCode store.
|
|
200
|
+
*/
|
|
201
|
+
export interface RawSessionSummaryScan {
|
|
202
|
+
anchors: Array<{
|
|
203
|
+
rowid: number;
|
|
204
|
+
id: string;
|
|
205
|
+
}>;
|
|
206
|
+
ids: string[];
|
|
207
|
+
/** Rows of the session whose JSON the scan read. */
|
|
208
|
+
sessionRows: number;
|
|
209
|
+
checkpoints?: Array<OrdinalKey & {
|
|
210
|
+
ordinal: number;
|
|
211
|
+
storedCount?: number;
|
|
212
|
+
}>;
|
|
213
|
+
total?: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Fork adaptation (A/B): upstream's off-thread warm-up replaced by a
|
|
217
|
+
* synchronous in-process scan. Builds the summary candidates and the prefix
|
|
218
|
+
* rank checkpoints on THIS connection (no worker exists in this fork), so
|
|
219
|
+
* bounded ordinal reads and page reads become cheap after the first call.
|
|
220
|
+
* Returns true when the connection is warm afterwards.
|
|
221
|
+
*/
|
|
222
|
+
export declare function warmRawSessionOrdinalsForDb(db: Database, sessionId: string): boolean;
|
|
223
|
+
/** Retained ranks seed a worker when more than one bounded page was appended. */
|
|
224
|
+
export declare function rawOrdinalSummarySeed(db: Database, sessionId: string): RawSessionSummaryScan | undefined;
|
|
225
|
+
/** Discover summary candidates and build ranks on the worker's read snapshot. */
|
|
226
|
+
export declare function scanRawSessionSummaryRows(db: Database, sessionId: string, previous?: RawSessionSummaryScan): RawSessionSummaryScan;
|
|
227
|
+
/** The value to pass to {@link installRawSessionSummaryScan} for a scan started now. */
|
|
228
|
+
export declare function getRawSessionSummaryEpoch(sessionId: string): number;
|
|
229
|
+
/**
|
|
230
|
+
* Retain discovered candidates and prefix ranks for incremental extension.
|
|
231
|
+
* Tail removals during a cold scan are repaired against the serving snapshot
|
|
232
|
+
* before ranks become ready. A later revert retains the same surviving prefix.
|
|
233
|
+
*/
|
|
234
|
+
export declare function installRawSessionSummaryScan(db: Database, sessionId: string, scan: RawSessionSummaryScan, epoch: number, workerPrepared?: boolean): boolean;
|
|
235
|
+
/**
|
|
236
|
+
* File-store reads need worker-built prefix ranks so host lookups read only a
|
|
237
|
+
* bounded suffix. Workers and memory stores can discover summary candidates
|
|
238
|
+
* directly, retaining them while their remembered rowid still names the same row.
|
|
239
|
+
*/
|
|
240
|
+
export declare function isRawSessionSummaryWarm(db: Database, sessionId: string): boolean;
|
|
241
|
+
/** Message rows of a session, counted from the `(session_id, ...)` index alone. */
|
|
242
|
+
export declare function countStoredRawSessionRowsIndexed(db: Database, sessionId: string): number;
|
|
153
243
|
/**
|
|
154
244
|
* Resolve one message ID in the canonical raw-message ordinal space. Synthetic
|
|
155
245
|
* compaction summaries are excluded so this count matches every module wire
|
|
@@ -161,4 +251,36 @@ export declare function readRawSessionMessageByIdFromDb(db: Database, sessionId:
|
|
|
161
251
|
export declare function hasRawSessionMessageByIdFromDb(db: Database, sessionId: string, messageId: string): boolean;
|
|
162
252
|
/** Read the canonical servable tail and its parts in one query, including its boundary row. */
|
|
163
253
|
export declare function readRawSeedTailFromDb(db: Database, sessionId: string, boundaryId: string | null): Map<string, RawMessage>;
|
|
254
|
+
/**
|
|
255
|
+
* What compartment boundary resolution needs to know about one boundary
|
|
256
|
+
* message. `null` in the result map means the message is not servable (absent,
|
|
257
|
+
* unreadable, or a finished compaction summary), exactly the messages
|
|
258
|
+
* {@link readRawSessionMessagePartsByIdFromDb} returns null for.
|
|
259
|
+
*/
|
|
260
|
+
export interface RawBoundaryEndpoint {
|
|
261
|
+
/** Ordinal as {@link readRawSessionMessageIdOrdinalsForRangeFromDb} numbers it; null when it has none. */
|
|
262
|
+
ordinal: number | null;
|
|
263
|
+
createdAt: number;
|
|
264
|
+
/**
|
|
265
|
+
* Index of the message's last module block, the value
|
|
266
|
+
* `moduleRawBlockMappings(parts).at(-1)?.blockIndex ?? 0` yields. Only
|
|
267
|
+
* present when the caller asked for it.
|
|
268
|
+
*/
|
|
269
|
+
lastBlockIndex?: number;
|
|
270
|
+
}
|
|
271
|
+
/** @internal Boundary message ids read from the store since the last reset. */
|
|
272
|
+
export declare function getRawBoundaryEndpointRowsReadForTest(): number;
|
|
273
|
+
/** @internal */
|
|
274
|
+
export declare function resetRawBoundaryEndpointRowsReadForTest(): void;
|
|
275
|
+
/**
|
|
276
|
+
* For each id, its ordinal and creation time, or null when it is not
|
|
277
|
+
* servable (see RawBoundaryEndpoint). Ids in `blockIds` also get
|
|
278
|
+
* `lastBlockIndex`, the index of the message's last module block. Message rows
|
|
279
|
+
* are read in two statements over just the requested ids, and block counts in
|
|
280
|
+
* one more, so no message JSON other than theirs reaches JavaScript. While the
|
|
281
|
+
* store is unchanged since an earlier call, ids answered then are not read
|
|
282
|
+
* again.
|
|
283
|
+
*/
|
|
284
|
+
export declare function readRawSessionBoundaryEndpointsFromDb(db: Database, sessionId: string, ids: readonly string[], blockIds?: readonly string[]): Map<string, RawBoundaryEndpoint | null>;
|
|
285
|
+
export {};
|
|
164
286
|
//# sourceMappingURL=read-session-raw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-session-raw.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-raw.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-session-raw.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-raw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,qBAAqB,CAAC;AAM3E,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,eAAe;IAC/C,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,8FAA8F;AAC9F,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,GAAG,O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AAS,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAkBf;AAED,wBAAgB,+BAA+B,CAC3C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,UAAU,GAAG,IAAI,CAoCnB;AAED,2EAA2E;AAC3E,wBAAgB,8BAA8B,CAC1C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,OAAO,CAYT;AAED,+FAA+F;AAC/F,wBAAgB,qBAAqB,CACjC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,IAAI,GAC1B,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CA+CzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAChC,0GAA0G;IAC1G,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAoFD,+EAA+E;AAC/E,wBAAgB,qCAAqC,IAAI,MAAM,CAE9D;AAED,gBAAgB;AAChB,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D;AAqDD;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,CACjD,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,QAAQ,GAAE,SAAS,MAAM,EAAO,GACjC,GAAG,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC,CAkCzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-session-true-raw-tokens.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-true-raw-tokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-session-true-raw-tokens.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session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CACtC,QAAQ,EAAE,SAAS,UAAU,EAAE,EAC/B,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,GACrB,MAAM,CAQR;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EACA,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,GACnB,6BAA6B,GAC7B,uBAAuB,GACvB,kBAAkB,CAAC;CAC5B,GAAG,IAAI,CAYP;AAED,wBAAgB,4CAA4C,CACxD,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,MAAM,EAAE,GAC1B,iBAAiB,CA2DnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning-budget.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/reasoning-budget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reasoning-budget.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/reasoning-budget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAmB5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,gGAAgG;AAChG,wBAAgB,oCAAoC,CAChD,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,EAAE,EACvB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACnB,MAAM,CA8BR;AAED,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElE,wBAAgB,0BAA0B,CACtC,MAAM,EAAE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AAC,CAAC;CACzC,GAAG,MAAM,CA+DT"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ContextUsage } from "../../features/magic-context/types";
|
|
2
|
+
import type { TransformDeps } from "./transform";
|
|
3
|
+
type RenderControls = Pick<TransformDeps, "memoryConfig" | "experimentalTemporalAwareness" | "historyBudgetPercentage" | "executeThresholdPercentage" | "executeThresholdTokens">;
|
|
4
|
+
/**
|
|
5
|
+
* Share memory, docs, temporal and history-budget settings between context
|
|
6
|
+
* requests and host folds. The memory project identity must be absent when memory
|
|
7
|
+
* is disabled: the materializer selects project memories by identity presence.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createM0RenderOptions(controls: RenderControls, contextUsage: ContextUsage, modelKey: string | undefined, resolvedContextLimit?: number, projectPath?: string): {
|
|
10
|
+
projectPath: string | undefined;
|
|
11
|
+
memoryEnabled: boolean | undefined;
|
|
12
|
+
memoryInjectionBudgetTokens: number | undefined;
|
|
13
|
+
temporalAwareness: boolean | undefined;
|
|
14
|
+
historyBudgetTokens: number | undefined;
|
|
15
|
+
historyBudgetPolicyIdentity: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveHistoryBudgetTokens(historyBudgetPercentage: number | undefined, contextUsage: ContextUsage, executeThresholdPercentage: TransformDeps["executeThresholdPercentage"], modelKey: string | undefined, executeThresholdTokens?: TransformDeps["executeThresholdTokens"], resolvedContextLimit?: number): number | undefined;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=render-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-options.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/render-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,cAAc,GAAG,IAAI,CACtB,aAAa,EACX,cAAc,GACd,+BAA+B,GAC/B,yBAAyB,GACzB,4BAA4B,GAC5B,wBAAwB,CAC7B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,oBAAoB,CAAC,EAAE,MAAM,EAC7B,WAAW,CAAC,EAAE,MAAM;;;;;;;EAsBvB;AAED,wBAAgB,0BAA0B,CACtC,uBAAuB,EAAE,MAAM,GAAG,SAAS,EAC3C,YAAY,EAAE,YAAY,EAC1B,0BAA0B,EAAE,aAAa,CAAC,4BAA4B,CAAC,EACvE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,sBAAsB,CAAC,EAAE,aAAa,CAAC,wBAAwB,CAAC,EAChE,oBAAoB,CAAC,EAAE,MAAM,GAC9B,MAAM,GAAG,SAAS,CAqCpB"}
|
|
@@ -120,6 +120,43 @@ export declare function makeWholeMessageSentinel(providerID?: string): {
|
|
|
120
120
|
type: "text";
|
|
121
121
|
text: string;
|
|
122
122
|
} & Record<string, unknown>;
|
|
123
|
+
/**
|
|
124
|
+
* True when neutralizing this whole message must leave it with no parts at all
|
|
125
|
+
* instead of a sentinel part.
|
|
126
|
+
*
|
|
127
|
+
* OpenCode 2 hands host system updates (instruction changes, other plugins'
|
|
128
|
+
* reminders) to the transform as `system` rows; OpenCode 1 and Pi never do.
|
|
129
|
+
* OpenCode 2's Anthropic adapter drops empty text in user and assistant
|
|
130
|
+
* messages, but sends a `system` row as an in-conversation system message
|
|
131
|
+
* (Claude models with native system updates: Opus 4.8 and every Claude 5)
|
|
132
|
+
* with its text blocks as they are, and Anthropic rejects an empty text block
|
|
133
|
+
* with HTTP 400 `text content blocks must be non-empty`. On older Claude
|
|
134
|
+
* models the host instead appends the row to the user turn as a
|
|
135
|
+
* `<system-update>` text block; with the row removed, that block goes too.
|
|
136
|
+
*
|
|
137
|
+
* A message left with no parts is omitted when the payload goes back to the
|
|
138
|
+
* host (`adaptPayload().commit()` in v2/hooks/payload.ts), the same rule the
|
|
139
|
+
* Rust module applies to a rendered message with no content. Other providers
|
|
140
|
+
* keep the `[dropped]` row: it is valid there and already served.
|
|
141
|
+
*/
|
|
142
|
+
export declare function wholeMessageNeutralizationRemoves(message: {
|
|
143
|
+
info: {
|
|
144
|
+
role?: unknown;
|
|
145
|
+
};
|
|
146
|
+
}, providerID?: string): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Neutralize a whole message in place: replace its parts with one
|
|
149
|
+
* `makeWholeMessageSentinel` part, or with no parts at all when
|
|
150
|
+
* `wholeMessageNeutralizationRemoves` says the row must leave the request.
|
|
151
|
+
* The message object stays in the array either way, so index-addressed lanes
|
|
152
|
+
* later in the pass still line up.
|
|
153
|
+
*/
|
|
154
|
+
export declare function neutralizeWholeMessage(message: {
|
|
155
|
+
info: {
|
|
156
|
+
role?: unknown;
|
|
157
|
+
};
|
|
158
|
+
parts: unknown[];
|
|
159
|
+
}, providerID?: string): void;
|
|
123
160
|
/**
|
|
124
161
|
* Detect whether a part is already a sentinel produced by `makeSentinel`
|
|
125
162
|
* or `makeWholeMessageSentinel`. Used by strip functions to stay
|
|
@@ -132,13 +169,16 @@ export declare function makeWholeMessageSentinel(providerID?: string): {
|
|
|
132
169
|
export declare function isSentinel(part: unknown): boolean;
|
|
133
170
|
/**
|
|
134
171
|
* Replay persisted whole-message decisions onto a fresh host projection.
|
|
135
|
-
* Canonical Anthropic keeps empty sentinels because its adapter filters them
|
|
172
|
+
* Canonical Anthropic keeps empty sentinels because its adapter filters them,
|
|
173
|
+
* except on OpenCode 2 `system` rows, which are left with no parts (see
|
|
174
|
+
* `wholeMessageNeutralizationRemoves`).
|
|
136
175
|
* For non-empty-sentinel providers, hidden seam rows are removed instead: they
|
|
137
176
|
* were absent on the fold pass, so removal is the only byte-identical replay.
|
|
138
177
|
*/
|
|
139
178
|
export declare function replaySentinelByMessageIds(messages: Array<{
|
|
140
179
|
info: {
|
|
141
180
|
id?: string;
|
|
181
|
+
role?: unknown;
|
|
142
182
|
};
|
|
143
183
|
parts: unknown[];
|
|
144
184
|
}>, ids: Set<string>, providerID?: string, hiddenSeamIds?: ReadonlySet<string>): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/sentinel.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,cAAc,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAErE;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAMrF;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAiBlE;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAa9F;AAED,qEAAqE;AACrE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAIjE;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAEjE;AA4BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAW9F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,OAAO,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc1B;AAED;;;;;;;;;GASG;A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
/** Compare m[0]/m[1] text and muralDataUrl image with the two knowledge messages last served. */
|
|
2
|
+
export declare function servedPrefixMatches(args: {
|
|
3
|
+
messages: readonly unknown[] | null | undefined;
|
|
4
|
+
m0Text: string | null | undefined;
|
|
5
|
+
m1Text: string | null | undefined;
|
|
6
|
+
muralDataUrl?: string | null;
|
|
7
|
+
}): boolean;
|
|
8
|
+
//# sourceMappingURL=strict-thinking-prefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strict-thinking-prefix.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/strict-thinking-prefix.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACtC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,GAAG,OAAO,CAgCV"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FrozenReasoningPart } from "../../features/magic-context/merged-reasoning-decisions";
|
|
1
2
|
import type { MessageLike, ThinkingLikePart } from "./tag-messages";
|
|
2
3
|
export declare function isMarkerOnlyText(text: string): boolean;
|
|
3
4
|
/**
|
|
@@ -17,7 +18,9 @@ export declare function isMarkerOnlyText(text: string): boolean;
|
|
|
17
18
|
* length so proxy providers that hash message-array structure see a stable
|
|
18
19
|
* prefix. For Anthropic/Bedrock, the provider's upstream filter drops
|
|
19
20
|
* empty-content messages on the wire anyway — same effective behavior, no
|
|
20
|
-
* mid-pipeline array mutation.
|
|
21
|
+
* mid-pipeline array mutation. An OpenCode 2 `system` row on canonical
|
|
22
|
+
* Anthropic is left with no parts instead and omitted when the payload goes
|
|
23
|
+
* back to the host (see `wholeMessageNeutralizationRemoves`).
|
|
21
24
|
*/
|
|
22
25
|
export declare function stripSystemInjectedMessages(messages: MessageLike[], protectedTailStart: number, providerID?: string, onFirstApplication?: (message: MessageLike, partIndex: number) => void): {
|
|
23
26
|
stripped: number;
|
|
@@ -47,7 +50,8 @@ export declare function stripSystemInjectedMessages(messages: MessageLike[], pro
|
|
|
47
50
|
* length so proxy providers that hash message-array structure see a stable
|
|
48
51
|
* prefix. For Anthropic/Bedrock, OpenCode's upstream filter drops empty
|
|
49
52
|
* content messages on the wire — same effective behavior, no mid-pipeline
|
|
50
|
-
* array mutation.
|
|
53
|
+
* array mutation. An OpenCode 2 `system` row on canonical Anthropic is left
|
|
54
|
+
* with no parts instead (see `wholeMessageNeutralizationRemoves`).
|
|
51
55
|
*
|
|
52
56
|
* Returns both count and sentineled IDs so callers can persist-and-replay.
|
|
53
57
|
*/
|
|
@@ -181,6 +185,14 @@ export declare function findMergedReasoningStripDecisions(messages: MessageLike[
|
|
|
181
185
|
export declare function stripReasoningFromMergedAssistants(messages: MessageLike[], providerID?: string, options?: {
|
|
182
186
|
mutationExemptMessage?: MessageLike;
|
|
183
187
|
frozenMessageIds?: ReadonlySet<string>;
|
|
188
|
+
/**
|
|
189
|
+
* `readFrozenMergedReasoningParts(frozenMessageIds)` and its key set,
|
|
190
|
+
* when the caller already decoded them. A caller that strips one message
|
|
191
|
+
* at a time passes these so each call does not decode every frozen
|
|
192
|
+
* decision again. They must describe the same `frozenMessageIds`.
|
|
193
|
+
*/
|
|
194
|
+
frozenParts?: ReadonlyMap<string, readonly FrozenReasoningPart[]>;
|
|
195
|
+
frozenPartMessageIds?: ReadonlySet<string>;
|
|
184
196
|
protectedMessages?: ReadonlySet<MessageLike>;
|
|
185
197
|
restoreMessages?: ReadonlySet<MessageLike>;
|
|
186
198
|
}): number;
|
|
@@ -188,34 +200,36 @@ export interface StripProcessedImagesResult {
|
|
|
188
200
|
stripped: number;
|
|
189
201
|
newlyStrippedIds: string[];
|
|
190
202
|
}
|
|
203
|
+
export declare function getEmptyImageParts(messages: readonly MessageLike[]): ReadonlyMap<string, ReadonlySet<number>>;
|
|
191
204
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* on cache-busting passes and replaying it everywhere removes the moving
|
|
206
|
-
* boundary: DETECT (cache-busting passes only) finds newly-aged processed image
|
|
207
|
-
* messages, strips them, and returns their ids to persist; REPLAY (every pass,
|
|
208
|
-
* incl. defer) re-strips only already-frozen ids, byte-identical regardless of
|
|
209
|
-
* how the live array grew.
|
|
210
|
-
*
|
|
211
|
-
* Caller contract: run only when `modelAcceptsEmptyContent(providerID)` is
|
|
212
|
-
* true, because non-Anthropic adapters can forward the empty text replacement
|
|
213
|
-
* to the wire.
|
|
205
|
+
* Remove answered inline images older than content already dropped from the
|
|
206
|
+
* transcript. Tags number transcript content in order; the watermark is the
|
|
207
|
+
* largest tag number marked dropped. First replacements require permission to
|
|
208
|
+
* rewrite the cached conversation prefix, since removing image bytes invalidates
|
|
209
|
+
* that cache. Persist ids and marker text before applying any replacement.
|
|
210
|
+
* Later passes replay those decisions without consulting the moving age boundary or
|
|
211
|
+
* current provider, so growing history cannot silently change cached bytes.
|
|
212
|
+
*
|
|
213
|
+
* User images prefer empty text on Anthropic and `[image stripped]` elsewhere.
|
|
214
|
+
* New empty forms retain a non-empty separator if omitting the row would join
|
|
215
|
+
* same-role neighbors or disturb a tool arc. Historical forms replay unchanged.
|
|
216
|
+
* Tool attachments always put non-empty markers in the result's text output,
|
|
217
|
+
* because the attachment array admits files only and a result must not be empty.
|
|
214
218
|
*/
|
|
215
219
|
export declare function stripProcessedImages(messages: MessageLike[], frozenIds: Set<string>, options: {
|
|
216
220
|
detect: boolean;
|
|
217
221
|
watermark: number;
|
|
218
222
|
messageTagNumbers: Map<MessageLike, number>;
|
|
223
|
+
protectedCutoff?: number | null;
|
|
224
|
+
contextPercentage?: number;
|
|
225
|
+
/** Marker for newly discovered ids only; legacy frozen ids keep empty sentinels. */
|
|
226
|
+
replacementText?: "" | "[image stripped]";
|
|
227
|
+
/** Stored text takes precedence if another process already persisted the same id. */
|
|
228
|
+
frozenMarkers?: ReadonlyMap<string, "" | "[image stripped]">;
|
|
229
|
+
/** Per-tool result exemptions still block stripping when emergency cleanup waives recency protection. */
|
|
230
|
+
protectedMessageIds?: ReadonlySet<string>;
|
|
231
|
+
/** Commit new replay IDs before changing bytes; false leaves new images intact. */
|
|
232
|
+
persistNewIds?: (ids: readonly string[], markers: ReadonlyMap<string, "" | "[image stripped]">) => boolean;
|
|
219
233
|
/** Reports only first strips, never restoring an already frozen image. */
|
|
220
234
|
onFirstApplication?: (message: MessageLike, partIndex: number) => void;
|
|
221
235
|
}): StripProcessedImagesResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-content.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/strip-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strip-content.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/strip-content.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,mBAAmB,EAG3B,MAAM,yDAAyD,CAAC;AAWjE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAsBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CACvC,QAAQ,EAAE,WAAW,EAAE,EACvB,kBAAkB,EAAE,MAAM,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAA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M,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAE1C;AAgBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,OAAO,EAAE;IACL,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,eAAe,CAAC,EAAE,EAAE,GAAG,kBAAkB,CAAC;IAC1C,qFAAqF;IACrF,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,kBAAkB,CAAC,CAAC;IAC7D,yGAAyG;IACzG,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,mFAAmF;IACnF,aAAa,CAAC,EAAE,CACZ,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,kBAAkB,CAAC,KACpD,OAAO,CAAC;IACb,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1E,GACF,0BAA0B,CAuK5B"}
|
|
@@ -34,14 +34,16 @@ export declare function buildSupersessionReclaimOps(input: {
|
|
|
34
34
|
/**
|
|
35
35
|
* Select superseded edit/write tool calls for COMPRESSION (not full drop).
|
|
36
36
|
* Among active edit/write tags grouped by their `filePath`, the newest stays
|
|
37
|
-
* full;
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* full; an older edit to the same file is an edit_marker target only below the
|
|
38
|
+
* previous bookmark: its output had three newer user turns or a quarter-window
|
|
39
|
+
* of newer content at an earlier cache rebuild. Replaced todowrite/mmc_reduce
|
|
40
|
+
* outputs do not need that delay; an edit's body does.
|
|
40
41
|
*
|
|
41
42
|
* Returns both the drop ops AND the set of tag ids that must be compressed as
|
|
42
43
|
* edit_marker (the caller passes the set to applyPendingOperations).
|
|
43
44
|
*/
|
|
44
45
|
export declare function buildEditSupersessionReclaim(input: {
|
|
46
|
+
watermark: number;
|
|
45
47
|
db: ContextDatabase;
|
|
46
48
|
sessionId: string;
|
|
47
49
|
targets: Map<number, TagTarget>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supersession-reclaim.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/supersession-reclaim.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,sCAAsC,CAAC;AAEpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC7C,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,GAClB,GAAG,CAAC,MAAM,CAAC,CAEb;AASD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IAC/C,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7C,GAAG,SAAS,EAAE,CAsDd;AAED
|
|
1
|
+
{"version":3,"file":"supersession-reclaim.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/supersession-reclaim.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,sCAAsC,CAAC;AAEpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD,qFAAqF;AACrF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC7C,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,GAClB,GAAG,CAAC,MAAM,CAAC,CAEb;AASD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IAC/C,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7C,GAAG,SAAS,EAAE,CAsDd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7C,GAAG;IAAE,GAAG,EAAE,SAAS,EAAE,CAAC;IAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAkDtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type SystemDateRequestIdentity = object | string;
|
|
2
|
+
export interface SystemDateRequest {
|
|
3
|
+
readonly sessionId: string;
|
|
4
|
+
readonly identity: SystemDateRequestIdentity;
|
|
5
|
+
}
|
|
6
|
+
/** Use the last real-user message ID that anchors thinking recovery, including
|
|
7
|
+
* its exclusions for synthetic messages and tool-result carriers. */
|
|
8
|
+
export declare function systemDateTurnId(messages: readonly unknown[]): string | undefined;
|
|
9
|
+
/** Keep OpenCode 2's per-request draft identity on the adapted messages output
|
|
10
|
+
* so both hook stages address the same request. */
|
|
11
|
+
export declare function bindSystemDateRequestIdentity(output: object, identity: SystemDateRequestIdentity): void;
|
|
12
|
+
export declare function systemDateRequestIdentity(output: object): SystemDateRequestIdentity | undefined;
|
|
13
|
+
export declare function bindSystemDateRequest(output: object, request: SystemDateRequest | undefined): void;
|
|
14
|
+
export declare function systemDateRequestForOutput(history: Set<string>, output: object): SystemDateRequest | undefined;
|
|
15
|
+
/** Reapply deferred host dates after the host copied the system prompt strings. */
|
|
16
|
+
export declare function bindSystemDateOutput(system: string[], update: () => void): void;
|
|
17
|
+
export declare function publishSystemDateOutput(system: string[]): void;
|
|
18
|
+
export declare function registerSystemDateRefresh(history: Set<string>): void;
|
|
19
|
+
export declare function hasSystemDateRefresh(history: Set<string>): boolean;
|
|
20
|
+
/** Each pass owns a unique handle. Without a host request identity, opposite
|
|
21
|
+
* stages may pair only on an unambiguous real-user turn. Overlapping unidentified
|
|
22
|
+
* requests in that turn stay frozen rather than borrowing another pass's grant. */
|
|
23
|
+
export declare function beginSystemDateRequest(history: Set<string>, sessionId: string, stage: "system" | "system-after-messages" | "messages", turnId: string | undefined, identity?: SystemDateRequestIdentity): SystemDateRequest | undefined;
|
|
24
|
+
export declare function systemDateRefreshPermission(history: Set<string>, request: SystemDateRequest | undefined): boolean | undefined;
|
|
25
|
+
export declare function waitForSystemDateRefresh(history: Set<string>, request: SystemDateRequest | undefined, apply: (permitted: boolean) => void): boolean;
|
|
26
|
+
export declare function finishSystemDateRefresh(history: Set<string>, request: SystemDateRequest | undefined, permitted: boolean): void;
|
|
27
|
+
export declare function finishSystemDateHook(history: Set<string>, request: SystemDateRequest | undefined): void;
|
|
28
|
+
export declare function clearSystemDateRefresh(history: Set<string>, sessionId: string): void;
|
|
29
|
+
//# sourceMappingURL=system-date-refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-date-refresh.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/system-date-refresh.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,MAAM,CAAC;AACxD,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;CAChD;AAiBD;qEACqE;AACrE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,GAAG,SAAS,CAMjF;AAED;mDACmD;AACnD,wBAAgB,6BAA6B,CACzC,MAAM,EAAE,MAAM,EACd,QAAQ,EA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,GACpC,OAAO,CAKT;AAcD,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,EAAE,OAAO,GACnB,IAAI,CAQN;AACD,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,IAAI,CAKN;AACD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Capture each host date field so separate system prompt elements keep their own fixed dates. */
|
|
2
|
+
export declare function systemPromptDates(prompt: string, sticky?: string): {
|
|
3
|
+
live: string | undefined;
|
|
4
|
+
stable: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=system-prompt-dates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt-dates.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/system-prompt-dates.ts"],"names":[],"mappings":"AAYA,kGAAkG;AAClG,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GAChB;IACC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAClB,CAUA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
2
|
+
import type { LkgRequestIdentity } from "./lkg-measured-request";
|
|
3
|
+
export declare function recordSystemRefreshOwnership(sessionId: string, hash: string, ownsHistoryRefresh: boolean, history?: Set<string>, materialization?: Set<string>): void;
|
|
4
|
+
/** Save the producer's final hash, not a later session-wide observation. Either
|
|
5
|
+
* hook order is supported by pairing it with the provider request identity. */
|
|
6
|
+
export declare function recordSystemPromptForRequest(sessionId: string, request: LkgRequestIdentity | undefined, hash: string, db: ContextDatabase, ownsHistoryRefresh?: boolean, history?: Set<string>, materialization?: Set<string>): void;
|
|
7
|
+
export declare function recordHeldHeadForRequest(sessionId: string, request: LkgRequestIdentity | undefined, deferRefresh?: (ownsHistoryRefresh: boolean) => void): void;
|
|
8
|
+
/** The host must first identify the assistant row created for the prepared call,
|
|
9
|
+
* or the exact SDK message appended after its saved input entry. A later reply
|
|
10
|
+
* with the same model and a newer timestamp cannot establish that link itself. */
|
|
11
|
+
export declare function bindSystemPromptResponse(sessionId: string, request: LkgRequestIdentity | undefined, response: {
|
|
12
|
+
responseId: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
modelKey?: string;
|
|
15
|
+
}): void;
|
|
16
|
+
export declare function isHeldHeadForRequest(sessionId: string, request: LkgRequestIdentity | undefined): boolean;
|
|
17
|
+
/** Signed thinking can require the synthetic m[0]/m[1] messages to stay unchanged
|
|
18
|
+
* even when a request sends new system instructions. A successful response for
|
|
19
|
+
* that exact request proves the provider received those instructions. Record
|
|
20
|
+
* their hash so the next pass does not misread it as another cache eviction;
|
|
21
|
+
* do not change the frozen messages or authorize pending edits to them. */
|
|
22
|
+
export declare function acknowledgeSystemPromptDelivery(args: {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
request: LkgRequestIdentity | undefined;
|
|
25
|
+
responseId?: string;
|
|
26
|
+
modelKey?: string;
|
|
27
|
+
completedAt?: number;
|
|
28
|
+
finish?: string;
|
|
29
|
+
error?: unknown;
|
|
30
|
+
v2?: boolean;
|
|
31
|
+
createdAt?: number;
|
|
32
|
+
}): void;
|
|
33
|
+
/** Already-delivered system instructions do not authorize a second cache rewrite.
|
|
34
|
+
* Keep the associated history/materialization work in deferred queues, which
|
|
35
|
+
* run only when another cause permits rebuilding. Preserve explicit flushes
|
|
36
|
+
* and refresh requests that were pending for other reasons. */
|
|
37
|
+
export declare function deferDeliveredSystemRefresh(deps: {
|
|
38
|
+
historyRefreshSessions: Set<string>;
|
|
39
|
+
pendingMaterializationSessions: Set<string>;
|
|
40
|
+
deferredHistoryRefreshSessions?: Set<string>;
|
|
41
|
+
deferredMaterializationSessions?: Set<string>;
|
|
42
|
+
}, sessionId: string, ownsHistoryRefresh: boolean): void;
|
|
43
|
+
export declare function clearSystemPromptDelivery(sessionId: string): void;
|
|
44
|
+
/** A replay sends older instructions; keep its queued refresh work, but discard
|
|
45
|
+
* the prepared hash and prevent late callbacks from reviving that preparation. */
|
|
46
|
+
export declare function retirePendingSystemPromptDelivery(sessionId: string): void;
|
|
47
|
+
//# sourceMappingURL=system-prompt-delivery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt-delivery.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/system-prompt-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAwBjE,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,OAAO,EAC3B,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC9B,IAAI,CAaN;AAWD;+EAC+E;AAC/E,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,eAAe,EACnB,kBAAkB,CAAC,EAAE,OAAO,EAC5B,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC9B,IAAI,CAiBN;AAED,wBAAgB,wBAAwB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,kBA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