omnius 1.0.923 → 1.0.925
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/{providerRegistry.d.ts → _types/backend-vllm/providerRegistry.d.ts} +0 -1
- package/dist/_types/backend-vllm/types.d.ts +209 -0
- package/dist/_types/execution/av/media-capability.d.ts +94 -0
- package/dist/_types/execution/delegation-contract.d.ts +102 -0
- package/dist/_types/execution/evidence.d.ts +68 -0
- package/dist/_types/execution/html-source-evidence.d.ts +65 -0
- package/dist/_types/execution/mcp/types.d.ts +169 -0
- package/dist/_types/execution/mutation-contract.d.ts +102 -0
- package/dist/_types/execution/nol/artifacts.d.ts +39 -0
- package/dist/_types/execution/nol/checkpoint-edits.d.ts +98 -0
- package/dist/_types/execution/nol/distributions.d.ts +128 -0
- package/dist/_types/execution/nol/gguf-checkpoint-edits.d.ts +194 -0
- package/dist/_types/execution/nol/gguf-control-reader.d.ts +224 -0
- package/dist/_types/execution/nol/lora-exports.d.ts +129 -0
- package/dist/_types/execution/nol/neuronary.d.ts +212 -0
- package/dist/_types/execution/nol/pytorch-control-reader.d.ts +143 -0
- package/dist/_types/execution/nol/qwen35-head-sites.d.ts +61 -0
- package/dist/_types/execution/nol/worker-assets.d.ts +82 -0
- package/dist/_types/execution/nol/worker-protocol.d.ts +94 -0
- package/dist/_types/execution/page-content-source.d.ts +40 -0
- package/dist/_types/execution/rapid-computer-use/artifact-store.d.ts +21 -0
- package/dist/_types/execution/rapid-computer-use/contracts.d.ts +320 -0
- package/dist/_types/execution/rapid-computer-use/decision.d.ts +70 -0
- package/dist/_types/execution/rapid-computer-use/desktop-verification.d.ts +23 -0
- package/dist/_types/execution/rapid-computer-use/geometry.d.ts +57 -0
- package/dist/_types/execution/rapid-computer-use/planner.d.ts +78 -0
- package/dist/_types/execution/rapid-computer-use/trace.d.ts +80 -0
- package/dist/_types/execution/rapid-computer-use/visual.d.ts +48 -0
- package/dist/_types/execution/shell-runs.d.ts +78 -0
- package/dist/_types/execution/streamed-web-source.d.ts +64 -0
- package/dist/_types/execution/tools/browser-page-fallback.d.ts +25 -0
- package/dist/_types/execution/tools/network-egress-policy.d.ts +30 -0
- package/dist/_types/execution/tools/pdf-native-tables.d.ts +46 -0
- package/dist/_types/execution/tools/todo-store.d.ts +133 -0
- package/dist/_types/execution/tools/web-fetch.d.ts +57 -0
- package/dist/_types/execution/tools/workboard.d.ts +1223 -0
- package/dist/_types/execution/types.d.ts +549 -0
- package/dist/_types/execution/web-source.d.ts +14 -0
- package/dist/_types/memory/artifactReviewSourceIndex.d.ts +133 -0
- package/dist/_types/memory/contextMemoryLedger.d.ts +213 -0
- package/dist/_types/memory/db.d.ts +12 -0
- package/dist/_types/memory/embeddings.d.ts +36 -0
- package/dist/_types/memory/immutableEvidenceStore.d.ts +165 -0
- package/dist/_types/memory/memoryIngestion.d.ts +65 -0
- package/dist/_types/memory/memoryTypes.d.ts +312 -0
- package/dist/_types/memory/sourceCorpusStore.d.ts +331 -0
- package/dist/_types/memory/structuredMemoryStore.d.ts +105 -0
- package/dist/_types/memory/unifiedMemoryStore.d.ts +127 -0
- package/dist/_types/memory/virtualMemory.d.ts +187 -0
- package/dist/_types/orchestrator/agentic-page-content-receipt.d.ts +20 -0
- package/dist/_types/orchestrator/agentic-web-fetch-receipt.d.ts +20 -0
- package/dist/_types/orchestrator/agenticRunner.d.ts +5219 -0
- package/dist/_types/orchestrator/app-state.d.ts +171 -0
- package/dist/_types/orchestrator/artifactClaimCritic.d.ts +63 -0
- package/dist/_types/orchestrator/artifactQuality.d.ts +15 -0
- package/dist/_types/orchestrator/artifactSemanticIntegrity.d.ts +203 -0
- package/dist/_types/orchestrator/canonical-context-projection.d.ts +254 -0
- package/dist/_types/orchestrator/canonical-source-body-projection.d.ts +51 -0
- package/dist/_types/orchestrator/completion-review-pending.d.ts +24 -0
- package/dist/_types/orchestrator/completionContract.d.ts +103 -0
- package/dist/_types/orchestrator/completionFinalization.d.ts +224 -0
- package/dist/_types/orchestrator/completionLedger.d.ts +429 -0
- package/dist/_types/orchestrator/completionReadiness.d.ts +234 -0
- package/dist/_types/orchestrator/context-admission.d.ts +93 -0
- package/dist/_types/orchestrator/context-dump-retention.d.ts +25 -0
- package/dist/_types/orchestrator/context-fabric.d.ts +133 -0
- package/dist/_types/orchestrator/contextEngine.d.ts +68 -0
- package/dist/_types/orchestrator/contextWindowDump.d.ts +327 -0
- package/dist/_types/orchestrator/convergence-breaker.d.ts +225 -0
- package/dist/_types/orchestrator/convergence-progress.d.ts +66 -0
- package/dist/_types/orchestrator/deliveryCoverage.d.ts +181 -0
- package/dist/_types/orchestrator/document-persistence-goal-binding.d.ts +106 -0
- package/dist/_types/orchestrator/durable-document-worker.d.ts +85 -0
- package/dist/_types/orchestrator/evidenceBranch.d.ts +291 -0
- package/dist/_types/orchestrator/expected-inference-response.d.ts +55 -0
- package/dist/_types/orchestrator/expectedOutcomeContract.d.ts +58 -0
- package/dist/_types/orchestrator/failure-taxonomy.d.ts +36 -0
- package/dist/_types/orchestrator/focusSupervisor.d.ts +436 -0
- package/dist/_types/orchestrator/forced-update-requirement-recovery.d.ts +105 -0
- package/dist/_types/orchestrator/hooks.d.ts +100 -0
- package/dist/_types/orchestrator/inference-pressure.d.ts +61 -0
- package/dist/_types/orchestrator/integrationClosure.d.ts +89 -0
- package/dist/_types/orchestrator/interruption-lifecycle.d.ts +154 -0
- package/dist/_types/orchestrator/live-memory-passages.d.ts +51 -0
- package/dist/_types/orchestrator/liveVirtualContext.d.ts +84 -0
- package/dist/_types/orchestrator/memory-compiler.d.ts +254 -0
- package/dist/_types/orchestrator/memory-consolidation.d.ts +134 -0
- package/dist/_types/orchestrator/model-router.d.ts +17 -0
- package/dist/_types/orchestrator/modelResponseDiagnostics.d.ts +71 -0
- package/dist/_types/orchestrator/nativeRequirementAmendment.d.ts +63 -0
- package/dist/_types/orchestrator/nol/coordinator.d.ts +204 -0
- package/dist/_types/orchestrator/nol/datasets.d.ts +58 -0
- package/dist/_types/orchestrator/nol/discovery.d.ts +286 -0
- package/dist/_types/orchestrator/nol/evaluation.d.ts +59 -0
- package/dist/_types/orchestrator/nol/model-validation.d.ts +198 -0
- package/dist/_types/orchestrator/nol/statistics.d.ts +142 -0
- package/dist/_types/orchestrator/nol/store.d.ts +133 -0
- package/dist/_types/orchestrator/nol/variant-registry.d.ts +292 -0
- package/dist/_types/orchestrator/ollama-context-policy.d.ts +34 -0
- package/dist/_types/orchestrator/personality.d.ts +66 -0
- package/dist/_types/orchestrator/prompt-cache.d.ts +24 -0
- package/dist/_types/orchestrator/remote-inference-fallback.d.ts +224 -0
- package/dist/_types/orchestrator/remote-inference-policy.d.ts +58 -0
- package/dist/_types/orchestrator/request-budget.d.ts +75 -0
- package/dist/_types/orchestrator/requirementCoverage.d.ts +69 -0
- package/dist/_types/orchestrator/reviewedInterpretation.d.ts +111 -0
- package/dist/_types/orchestrator/runEvents.d.ts +115 -0
- package/dist/_types/orchestrator/runtime-rollout.d.ts +63 -0
- package/dist/_types/orchestrator/semanticVerification.d.ts +135 -0
- package/dist/_types/orchestrator/source-wide-extraction.d.ts +202 -0
- package/dist/_types/orchestrator/steeringIntake.d.ts +123 -0
- package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +89 -0
- package/dist/_types/orchestrator/structuredMemoryInference.d.ts +62 -0
- package/dist/_types/orchestrator/successful-procedure-memory.d.ts +127 -0
- package/dist/_types/orchestrator/supportedAnswer.d.ts +68 -0
- package/dist/_types/orchestrator/taskEffectEvidence.d.ts +38 -0
- package/dist/_types/orchestrator/taskExecutionSnapshot.d.ts +67 -0
- package/dist/_types/orchestrator/taskObjective.d.ts +310 -0
- package/dist/_types/orchestrator/taskObjectiveContinuation.d.ts +134 -0
- package/dist/_types/orchestrator/taskRequirementReview.d.ts +246 -0
- package/dist/_types/orchestrator/taskRequirements.d.ts +80 -0
- package/dist/_types/orchestrator/taskSemanticAdmission.d.ts +159 -0
- package/dist/_types/orchestrator/taskWorkDelegation.d.ts +147 -0
- package/dist/_types/orchestrator/taskWorkPlan.d.ts +177 -0
- package/dist/_types/orchestrator/telegram-passive-history.d.ts +42 -0
- package/dist/_types/orchestrator/terminalTaskReport.d.ts +91 -0
- package/dist/_types/orchestrator/todoObservability.d.ts +147 -0
- package/dist/_types/orchestrator/tool-exposure-policy.d.ts +100 -0
- package/dist/_types/orchestrator/trajectory-checkpoint.d.ts +159 -0
- package/dist/_types/orchestrator/types.d.ts +185 -0
- package/dist/_types/schemas/dispatch.d.ts +53 -0
- package/dist/_types/schemas/feature-workflow.d.ts +362 -0
- package/dist/_types/schemas/messages.d.ts +15 -0
- package/dist/_types/schemas/nol-assets.d.ts +955 -0
- package/dist/_types/schemas/nol-json.d.ts +2 -0
- package/dist/_types/schemas/nol.d.ts +3995 -0
- package/dist/_types/schemas/patch.d.ts +47 -0
- package/dist/_types/schemas/plan.d.ts +47 -0
- package/dist/_types/schemas/repoProfile.d.ts +116 -0
- package/dist/_types/schemas/retrieval.d.ts +44 -0
- package/dist/_types/schemas/task.d.ts +57 -0
- package/dist/_types/schemas/tools.d.ts +16 -0
- package/dist/_types/schemas/verification.d.ts +31 -0
- package/dist/api/py-embed.js +3353 -1829
- package/dist/assets/nol-checkpoint-editor.py +701 -0
- package/dist/assets/nol-gguf-checkpoint-editor.py +785 -0
- package/dist/assets/nol-gguf-control-reader.py +428 -0
- package/dist/assets/nol-gne-tools-worker.py +425 -0
- package/dist/assets/nol-gne-worker.py +1081 -0
- package/dist/assets/nol-lora-exporter.py +349 -0
- package/dist/assets/nol-pytorch-control-reader.py +470 -0
- package/dist/assets/nol-transformers-nnsight-worker.py +512 -0
- package/dist/assets/nol-transformers-peft-validation-worker.py +385 -0
- package/dist/assets/nol-transformers-peft-worker.py +488 -0
- package/dist/assets/nol-transformers-research-worker.py +472 -0
- package/dist/assets/nol-transformers-worker.py +920 -0
- package/dist/assets/nol-vllm-owned-worker.py +803 -0
- package/dist/assets/nol-vllm-runtime.py +695 -0
- package/dist/assets/nol-vllm-tokenizer.py +93 -0
- package/dist/assets/nol-vllm-worker.py +201 -0
- package/dist/computer-use/configured-planner.d.ts +37 -0
- package/dist/computer-use/configured-point.d.ts +35 -0
- package/dist/computer-use/host-session.d.ts +60 -0
- package/dist/computer-use/runner-ui-port.d.ts +37 -0
- package/dist/computer-use/session-review.d.ts +14 -0
- package/dist/computer-use/task-spec.d.ts +84 -0
- package/dist/discovery.d.ts +16 -2
- package/dist/index.js +2 -2
- package/dist/library.d.ts +94 -10
- package/dist/library.js +144003 -87414
- package/dist/memory-maintenance-worker.js +1676 -511
- package/dist/nol/cpu-control-reader-profile.d.ts +93 -0
- package/dist/nol/cpu-control-reader-service.d.ts +87 -0
- package/dist/nol/cuda-lease.d.ts +111 -0
- package/dist/nol/cuda-mutations.d.ts +34 -0
- package/dist/nol/export-runtime-config.d.ts +114 -0
- package/dist/nol/export-service.d.ts +143 -0
- package/dist/nol/facade.d.ts +147 -0
- package/dist/nol/gguf-cpu-control-reader-profile.d.ts +106 -0
- package/dist/nol/gguf-cpu-control-reader-service.d.ts +91 -0
- package/dist/nol/gguf-model-control-verifier.d.ts +120 -0
- package/dist/nol/gguf-parameter-inventory.d.ts +28 -0
- package/dist/nol/gne-adapter.d.ts +134 -0
- package/dist/nol/gne-agent-evaluation.d.ts +84 -0
- package/dist/nol/gne-profile.d.ts +124 -0
- package/dist/nol/gne-tools-profile.d.ts +148 -0
- package/dist/nol/gne-tools-transport.d.ts +194 -0
- package/dist/nol/model-actions.d.ts +662 -0
- package/dist/nol/model-control-verifier.d.ts +135 -0
- package/dist/nol/model-json-scorer.d.ts +13 -0
- package/dist/nol/model-runtime-config.d.ts +830 -0
- package/dist/nol/model-serving.d.ts +130 -0
- package/dist/nol/model-subject-adapter.d.ts +72 -0
- package/dist/nol/model-validation-factory.d.ts +113 -0
- package/dist/nol/neuronary-catalog.d.ts +130 -0
- package/dist/nol/orphan-custody.d.ts +72 -0
- package/dist/nol/peft-conformance.d.ts +48 -0
- package/dist/nol/peft-control-types.d.ts +137 -0
- package/dist/nol/peft-control-verifier.d.ts +8 -0
- package/dist/nol/peft-model-actions.d.ts +41 -0
- package/dist/nol/peft-model-authority.d.ts +146 -0
- package/dist/nol/peft-model-controls.d.ts +20 -0
- package/dist/nol/peft-model-host.d.ts +47 -0
- package/dist/nol/peft-model-profile.d.ts +161 -0
- package/dist/nol/peft-model-runtime-config.d.ts +174 -0
- package/dist/nol/peft-model-subject-adapter.d.ts +36 -0
- package/dist/nol/peft-validation.d.ts +105 -0
- package/dist/nol/persistent-parameter-inventory.d.ts +32 -0
- package/dist/nol/runtime.d.ts +100 -0
- package/dist/nol/sqlite-store.d.ts +80 -0
- package/dist/nol/transformers-adapter.d.ts +119 -0
- package/dist/nol/transformers-nnsight.d.ts +87 -0
- package/dist/nol/transformers-peft.d.ts +107 -0
- package/dist/nol/transformers-research.d.ts +114 -0
- package/dist/nol/variant-service.d.ts +143 -0
- package/dist/nol/variant-store.d.ts +51 -0
- package/dist/nol/vllm-actions.d.ts +774 -0
- package/dist/nol/vllm-adapter.d.ts +1473 -0
- package/dist/nol/vllm-authority.d.ts +55 -0
- package/dist/nol/vllm-conformance.d.ts +662 -0
- package/dist/nol/vllm-profile.d.ts +850 -0
- package/dist/nol/vllm-protocol.d.ts +1505 -0
- package/dist/nol/vllm-runtime-config.d.ts +120 -0
- package/dist/nol/vllm-runtime.d.ts +34 -0
- package/dist/nol/vllm-startup.d.ts +235 -0
- package/dist/omni-setup-worker.js +3433 -1909
- package/dist/service-version.d.ts +0 -1
- package/dist/tui/async-process.d.ts +27 -0
- package/dist/tui/native/worker.js +3 -1
- package/dist/tui/telegram-action-session-registry.d.ts +136 -0
- package/dist/tui/telegram-cognition-queue.d.ts +154 -0
- package/dist/tui/telegram-context-packet-v2.d.ts +99 -0
- package/dist/tui/telegram-input-ownership.d.ts +78 -0
- package/dist/tui/telegram-turn-contract-v2.d.ts +62 -0
- package/dist/update-worker-runtime.js +4216 -2603
- package/docs/DISCOVERY.json +389 -0
- package/docs/DISCOVERY.md +4 -0
- package/npm-shrinkwrap.json +28 -12
- package/package.json +3 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A backend-independent, conservative admission boundary. It deliberately
|
|
3
|
+
* works on the final runner request rather than a pre-assembly context guess:
|
|
4
|
+
* provider tokenizers differ, but a 3-byte text / 2-byte schema upper-bound is
|
|
5
|
+
* materially safer than the historic characters÷4 telemetry estimate.
|
|
6
|
+
*/
|
|
7
|
+
export interface ContextAdmissionMessage {
|
|
8
|
+
role: string;
|
|
9
|
+
/** Runtime-owned policy is indivisible authority, even under emergency admission. */
|
|
10
|
+
policyScope?: "runtime";
|
|
11
|
+
/** Host-created exact/derived source requirements are indivisible data, not instruction authority. */
|
|
12
|
+
requiredSourceEvidence?: {
|
|
13
|
+
schema: "omnius.required-source-evidence.v1";
|
|
14
|
+
scope: string;
|
|
15
|
+
};
|
|
16
|
+
content?: unknown;
|
|
17
|
+
tool_calls?: unknown;
|
|
18
|
+
tool_call_id?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface ContextAdmissionRequest {
|
|
22
|
+
messages: ContextAdmissionMessage[];
|
|
23
|
+
tools?: unknown[];
|
|
24
|
+
maxTokens: number;
|
|
25
|
+
memoryPrefix?: string;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export type ContextLimitSource = "declared" | "observed_server" | "unknown";
|
|
29
|
+
export type ContextAdmissionDecision = "admit" | "clamp_output" | "compact_context" | "reject" | "unknown_limit";
|
|
30
|
+
export interface ContextAdmissionReceipt {
|
|
31
|
+
schemaVersion: 1;
|
|
32
|
+
requestFingerprintBefore: string;
|
|
33
|
+
requestFingerprintAfter: string;
|
|
34
|
+
contextLimitTokens?: number;
|
|
35
|
+
contextLimitSource: ContextLimitSource;
|
|
36
|
+
inputEstimateMethod: "conservative_serialized_upper_bound";
|
|
37
|
+
estimatedInputTokens: number;
|
|
38
|
+
requestedOutputTokens: number;
|
|
39
|
+
/** Caller-owned minimum needed for this phase, bounded by its output ceiling. */
|
|
40
|
+
requiredOutputTokens?: number;
|
|
41
|
+
admittedOutputTokens: number;
|
|
42
|
+
safetyMarginTokens: number;
|
|
43
|
+
projectedTotalTokens?: number;
|
|
44
|
+
decision: ContextAdmissionDecision;
|
|
45
|
+
compactedMessageCount: number;
|
|
46
|
+
reducedToolSchema: boolean;
|
|
47
|
+
reason: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ContextAdmissionResult {
|
|
50
|
+
request: ContextAdmissionRequest;
|
|
51
|
+
receipt: ContextAdmissionReceipt;
|
|
52
|
+
}
|
|
53
|
+
/** Caller-owned selection truth; source/model text cannot designate a schema optional. */
|
|
54
|
+
export interface ContextAdmissionToolPolicy {
|
|
55
|
+
schema: "omnius.context-admission-tool-policy.v1";
|
|
56
|
+
requiredToolNames: readonly string[];
|
|
57
|
+
optionalToolNamesBestFirst: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
export interface ProviderContextOverflow {
|
|
60
|
+
kind: "context_overflow";
|
|
61
|
+
status?: number;
|
|
62
|
+
contextLimitTokens?: number;
|
|
63
|
+
requestedTokens?: number;
|
|
64
|
+
textInputTokens?: number;
|
|
65
|
+
toolInputTokens?: number;
|
|
66
|
+
outputTokens?: number;
|
|
67
|
+
message: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Text tokenization is language/model dependent. JSON schemas are denser
|
|
71
|
+
* than normal prose, so charge them at two bytes/token and message/prefix text
|
|
72
|
+
* at three. This is an admission bound, not a usage display estimate.
|
|
73
|
+
*/
|
|
74
|
+
export declare function estimateConservativeRequestInputTokens(request: ContextAdmissionRequest): number;
|
|
75
|
+
export declare function minimumOutputTokens(limit: number): number;
|
|
76
|
+
export declare function safetyMarginTokens(limit: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* Build an admitted detached request. The caller must explicitly replace its
|
|
79
|
+
* request with this result, making it impossible to accidentally retry an old
|
|
80
|
+
* overflowing payload after a provider has supplied a ceiling.
|
|
81
|
+
*/
|
|
82
|
+
export declare function admitContextRequest(input: {
|
|
83
|
+
request: ContextAdmissionRequest;
|
|
84
|
+
contextLimitTokens?: number;
|
|
85
|
+
contextLimitSource?: ContextLimitSource;
|
|
86
|
+
toolPolicy?: ContextAdmissionToolPolicy;
|
|
87
|
+
/** The unified compiler may inspect intact input before final admission. */
|
|
88
|
+
allowContentCompaction?: boolean;
|
|
89
|
+
/** Host-owned phase reserve; never taken from provider/model request text. */
|
|
90
|
+
minimumOutputReservation?: number;
|
|
91
|
+
}): ContextAdmissionResult;
|
|
92
|
+
/** Parse non-secret capacity facts from common provider 400 payload text. */
|
|
93
|
+
export declare function parseProviderContextOverflow(error: unknown): ProviderContextOverflow | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ContextDumpRetention {
|
|
2
|
+
pin: "failure" | "checkpoint" | "terminal" | "representative";
|
|
3
|
+
reason?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ContextDumpCausalIdentity {
|
|
6
|
+
segmentId?: string;
|
|
7
|
+
observationSequence?: number;
|
|
8
|
+
checkpointId?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Pin exact redacted request bodies; no model text or secrets enter this manifest. */
|
|
11
|
+
export declare function retainContextDump(dir: string, input: {
|
|
12
|
+
id: string;
|
|
13
|
+
runId: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
estimatedTokens: number;
|
|
16
|
+
anomalous: boolean;
|
|
17
|
+
retention?: ContextDumpRetention;
|
|
18
|
+
}, payload: string): void;
|
|
19
|
+
/** Append a durable pruning explanation before removing a body; preserve all pins. */
|
|
20
|
+
export declare function pruneContextDumps(dir: string): void;
|
|
21
|
+
export declare function contextDumpRetentionStatus(dir: string, id: string): {
|
|
22
|
+
state: "retained" | "pruned" | "unknown";
|
|
23
|
+
reason?: string;
|
|
24
|
+
sha256?: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Fabric
|
|
3
|
+
*
|
|
4
|
+
* A small, typed intake layer for runtime context signals. Producers submit
|
|
5
|
+
* facts into the ledger; the builder emits one bounded frame before a model
|
|
6
|
+
* call. This keeps context ownership explicit and prevents scattered prompt
|
|
7
|
+
* injections from accumulating duplicate steering blocks.
|
|
8
|
+
*/
|
|
9
|
+
import type { CanonicalContextSlot, CanonicalProtectionReason } from "./canonical-context-projection.js";
|
|
10
|
+
/** Shared detector for serialized current and legacy runtime frames, never inferred authority. */
|
|
11
|
+
export declare function inspectRenderedContext(text: string): {
|
|
12
|
+
frameCount: number;
|
|
13
|
+
controller: boolean;
|
|
14
|
+
control: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ContextSignalKind = "goal" | "user_steering" | "trajectory_checkpoint" | "runtime_guidance" | "action_contract" | "task_state" | "git_state" | "known_files" | "recent_failure" | "tool_cache" | "skill_manifest" | "memory" | "semantic_chunk" | "session_history" | "anchor" | "handoff" | "environment" | "compaction_summary";
|
|
17
|
+
export interface ContextSignal {
|
|
18
|
+
id: string;
|
|
19
|
+
kind: ContextSignalKind;
|
|
20
|
+
source: string;
|
|
21
|
+
content: string;
|
|
22
|
+
priority?: number;
|
|
23
|
+
createdTurn?: number;
|
|
24
|
+
ttlTurns?: number;
|
|
25
|
+
dedupeKey?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Stable meaning-level key. Unlike `dedupeKey`, this should remain the same
|
|
28
|
+
* when the wording varies but the runtime intent is identical.
|
|
29
|
+
*/
|
|
30
|
+
semanticKey?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Mutually exclusive model-facing lane. The frame builder keeps only the
|
|
33
|
+
* highest priority/newest signal in each group.
|
|
34
|
+
*/
|
|
35
|
+
conflictGroup?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Semantic/dedupe/id keys superseded by this signal.
|
|
38
|
+
*/
|
|
39
|
+
invalidates?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Operator telemetry can live in the ledger without being rendered to the
|
|
42
|
+
* model. Defaults to true.
|
|
43
|
+
*/
|
|
44
|
+
modelVisible?: boolean;
|
|
45
|
+
tags?: string[];
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
/** Producer-owned selection metadata; source text cannot assign authority. */
|
|
48
|
+
canonical?: {
|
|
49
|
+
slot: CanonicalContextSlot;
|
|
50
|
+
protection?: CanonicalProtectionReason[];
|
|
51
|
+
/** Exact canonical signal identities needed to interpret this signal. */
|
|
52
|
+
dependsOn?: string[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface ContextFrameDiagnostics {
|
|
56
|
+
includedSignals: number;
|
|
57
|
+
droppedSignals: number;
|
|
58
|
+
hiddenSignals: number;
|
|
59
|
+
semanticDedupedSignals: number;
|
|
60
|
+
conflictDroppedSignals: number;
|
|
61
|
+
invalidatedSignals: number;
|
|
62
|
+
truncatedSignals: number;
|
|
63
|
+
estimatedTokens: number;
|
|
64
|
+
totalChars: number;
|
|
65
|
+
semanticChunkCount: number;
|
|
66
|
+
controlChars: number;
|
|
67
|
+
evidenceChars: number;
|
|
68
|
+
controlToEvidenceRatio: number;
|
|
69
|
+
qualityWarnings: string[];
|
|
70
|
+
pressureReports?: unknown[];
|
|
71
|
+
forgettingReports?: unknown[];
|
|
72
|
+
sections: Array<{
|
|
73
|
+
kind: ContextSignalKind;
|
|
74
|
+
label: string;
|
|
75
|
+
signals: number;
|
|
76
|
+
chars: number;
|
|
77
|
+
dropped: number;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
export interface ContextFrame {
|
|
81
|
+
content: string | null;
|
|
82
|
+
diagnostics: ContextFrameDiagnostics;
|
|
83
|
+
included: ContextSignal[];
|
|
84
|
+
dropped: ContextSignal[];
|
|
85
|
+
}
|
|
86
|
+
export declare const PRIORITY: {
|
|
87
|
+
readonly GOAL: 100;
|
|
88
|
+
readonly ACTION_CONTRACT: 98;
|
|
89
|
+
readonly TRAJECTORY: 97;
|
|
90
|
+
readonly USER_STEERING: 95;
|
|
91
|
+
readonly RUNTIME_GUIDANCE: 94;
|
|
92
|
+
readonly GIT_STATE: 86;
|
|
93
|
+
readonly TASK_STATE: 80;
|
|
94
|
+
readonly KNOWN_FILES: 70;
|
|
95
|
+
readonly RECENT_FAILURE: 65;
|
|
96
|
+
readonly TOOL_CACHE: 60;
|
|
97
|
+
readonly SKILL_MANIFEST: 55;
|
|
98
|
+
readonly MEMORY: 50;
|
|
99
|
+
readonly SEMANTIC_CHUNK: 45;
|
|
100
|
+
readonly SESSION_HISTORY: 40;
|
|
101
|
+
readonly ANCHOR: 35;
|
|
102
|
+
readonly HANDOFF: 30;
|
|
103
|
+
readonly ENVIRONMENT: 25;
|
|
104
|
+
readonly COMPACTION_SUMMARY: 20;
|
|
105
|
+
};
|
|
106
|
+
export declare class ContextLedger {
|
|
107
|
+
private signals;
|
|
108
|
+
private sequence;
|
|
109
|
+
private invalidatedSinceLastBuild;
|
|
110
|
+
upsert(signal: ContextSignal): void;
|
|
111
|
+
upsertMany(signals: ContextSignal[]): void;
|
|
112
|
+
removeWhere(predicate: (signal: ContextSignal) => boolean): number;
|
|
113
|
+
clearSource(source: string): number;
|
|
114
|
+
clearSources(prefix: string): number;
|
|
115
|
+
prune(turn: number): number;
|
|
116
|
+
values(): ContextSignal[];
|
|
117
|
+
size(): number;
|
|
118
|
+
consumeInvalidatedCount(): number;
|
|
119
|
+
}
|
|
120
|
+
export interface ContextFrameBuildOptions {
|
|
121
|
+
turn?: number;
|
|
122
|
+
maxChars?: number;
|
|
123
|
+
kindCharBudget?: Partial<Record<ContextSignalKind, number>>;
|
|
124
|
+
includeDiagnostics?: boolean;
|
|
125
|
+
invalidatedSignals?: number;
|
|
126
|
+
maxControlToEvidenceRatio?: number;
|
|
127
|
+
}
|
|
128
|
+
export declare class ContextFrameBuilder {
|
|
129
|
+
build(signals: ContextSignal[], options?: ContextFrameBuildOptions): ContextFrame;
|
|
130
|
+
}
|
|
131
|
+
export declare function signalFromBlock(kind: ContextSignalKind, source: string, content: string | null | undefined, options?: Omit<ContextSignal, "kind" | "source" | "content" | "id"> & {
|
|
132
|
+
id?: string;
|
|
133
|
+
}): ContextSignal | null;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ContextAllocationClass, type ContextBudget } from "../memory/virtualMemory.js";
|
|
2
|
+
export interface ContextEngineMessage {
|
|
3
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
4
|
+
content: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Typed by the producer; the context engine never infers semantic claims from prose. */
|
|
7
|
+
allocationClass?: ContextAllocationClass;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
score?: number;
|
|
10
|
+
sourceChunkIds?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ContextEngineToolEvent {
|
|
13
|
+
name: string;
|
|
14
|
+
success?: boolean;
|
|
15
|
+
outputPreview?: string;
|
|
16
|
+
argsPreview?: string;
|
|
17
|
+
targetPaths?: string[];
|
|
18
|
+
family?: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
evidenceId?: string;
|
|
21
|
+
turn?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ContextEngineRunState {
|
|
24
|
+
runId?: string;
|
|
25
|
+
tokenBudget?: number;
|
|
26
|
+
completionContract?: string;
|
|
27
|
+
/** Frontier models receive evidence handles, not copied tool-output bodies. */
|
|
28
|
+
compactEvidenceReceipts?: boolean;
|
|
29
|
+
/** Optional explicit physical working-set allocation. Defaults scale to tokenBudget. */
|
|
30
|
+
virtualContextBudget?: ContextBudget;
|
|
31
|
+
}
|
|
32
|
+
export interface ContextEngineInput {
|
|
33
|
+
goal: string;
|
|
34
|
+
surface: "tui" | "telegram-public" | "telegram-admin" | "api" | "background";
|
|
35
|
+
messages: ContextEngineMessage[];
|
|
36
|
+
toolEvents?: ContextEngineToolEvent[];
|
|
37
|
+
memoryHints?: string[];
|
|
38
|
+
runState?: ContextEngineRunState;
|
|
39
|
+
}
|
|
40
|
+
export interface ContextEngineDiagnostics {
|
|
41
|
+
surface: ContextEngineInput["surface"];
|
|
42
|
+
tokenEstimateBefore: number;
|
|
43
|
+
tokenEstimateAfter: number;
|
|
44
|
+
compacted: boolean;
|
|
45
|
+
compactionStrategy: "none" | "virtual_memory_budget";
|
|
46
|
+
evidenceRetained: number;
|
|
47
|
+
evidenceDropped: number;
|
|
48
|
+
evidenceFolded: number;
|
|
49
|
+
allocations?: Partial<Record<ContextAllocationClass, number>>;
|
|
50
|
+
}
|
|
51
|
+
export interface ContextEngineOutput {
|
|
52
|
+
messages: ContextEngineMessage[];
|
|
53
|
+
compactedMessages: ContextEngineMessage[];
|
|
54
|
+
systemMessages: ContextEngineMessage[];
|
|
55
|
+
conversationMessages: ContextEngineMessage[];
|
|
56
|
+
compacted: boolean;
|
|
57
|
+
diagnostics: ContextEngineDiagnostics;
|
|
58
|
+
}
|
|
59
|
+
export interface ContextEngine {
|
|
60
|
+
build(input: ContextEngineInput): Promise<ContextEngineOutput>;
|
|
61
|
+
compact(input: ContextEngineInput): Promise<ContextEngineOutput>;
|
|
62
|
+
}
|
|
63
|
+
export declare class DefaultContextEngine implements ContextEngine {
|
|
64
|
+
build(input: ContextEngineInput): Promise<ContextEngineOutput>;
|
|
65
|
+
compact(input: ContextEngineInput): Promise<ContextEngineOutput>;
|
|
66
|
+
private render;
|
|
67
|
+
}
|
|
68
|
+
export declare function createDefaultContextEngine(): ContextEngine;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { type OutboundRequestBudget } from "./request-budget.js";
|
|
2
|
+
import type { ContextAdmissionReceipt } from "./context-admission.js";
|
|
3
|
+
import type { CanonicalRequestTrace } from "./canonical-context-projection.js";
|
|
4
|
+
import { type ContextDumpRetention, type ContextDumpCausalIdentity } from "./context-dump-retention.js";
|
|
5
|
+
export { contextDumpRetentionStatus } from "./context-dump-retention.js";
|
|
6
|
+
export type { ContextDumpRetention, ContextDumpCausalIdentity } from "./context-dump-retention.js";
|
|
7
|
+
export type ContextWindowAgentType = "main" | "sub-agent" | "internal" | "adversary" | "auxiliary";
|
|
8
|
+
export interface ContextWindowDumpInput {
|
|
9
|
+
source: string;
|
|
10
|
+
stage: string;
|
|
11
|
+
agentType: ContextWindowAgentType;
|
|
12
|
+
sessionId?: string;
|
|
13
|
+
runId?: string;
|
|
14
|
+
turn?: number;
|
|
15
|
+
attempt?: number;
|
|
16
|
+
model?: string;
|
|
17
|
+
cwd?: string;
|
|
18
|
+
request: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional immutable budget compiled by the caller from this same request.
|
|
21
|
+
* Reusing it binds shadow analysis, the request dump, and later headroom
|
|
22
|
+
* telemetry to one request fingerprint rather than recompiling after an
|
|
23
|
+
* asynchronous observer has run.
|
|
24
|
+
*/
|
|
25
|
+
requestBudget?: OutboundRequestBudget;
|
|
26
|
+
note?: string;
|
|
27
|
+
retention?: ContextDumpRetention;
|
|
28
|
+
causal?: ContextDumpCausalIdentity;
|
|
29
|
+
focusSupervisor?: ContextWindowDumpFocusSupervisor | null;
|
|
30
|
+
/** Request-assembly telemetry, persisted beside (never inside) model history. */
|
|
31
|
+
requestCompilation?: ContextWindowRequestCompilation | null;
|
|
32
|
+
}
|
|
33
|
+
export interface ContextWindowDumpRecord {
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
id: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
source: string;
|
|
38
|
+
stage: string;
|
|
39
|
+
agentType: ContextWindowAgentType;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
runId: string;
|
|
42
|
+
turn?: number;
|
|
43
|
+
attempt?: number;
|
|
44
|
+
model?: string;
|
|
45
|
+
cwd: string;
|
|
46
|
+
note?: string;
|
|
47
|
+
retention?: ContextDumpRetention;
|
|
48
|
+
causal?: ContextDumpCausalIdentity;
|
|
49
|
+
focusSupervisor?: ContextWindowDumpFocusSupervisor;
|
|
50
|
+
requestCompilation?: ContextWindowRequestCompilation;
|
|
51
|
+
metrics: ContextWindowDumpMetrics;
|
|
52
|
+
/** Normalized, source-attributed accounting for every outbound request. */
|
|
53
|
+
contextAccounting: ContextWindowContextAccounting;
|
|
54
|
+
/** Exact request budget including late schemas and output reservation. */
|
|
55
|
+
requestBudget: OutboundRequestBudget;
|
|
56
|
+
apiView: ContextWindowApiViewSummary;
|
|
57
|
+
request: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export interface ContextWindowContextAccounting {
|
|
60
|
+
schemaVersion: 1;
|
|
61
|
+
totalMessageChars: number;
|
|
62
|
+
toolSchemaChars: number;
|
|
63
|
+
estimatedTokens: number;
|
|
64
|
+
sources: Array<{
|
|
65
|
+
source: string;
|
|
66
|
+
messageCount: number;
|
|
67
|
+
chars: number;
|
|
68
|
+
estimatedTokens: number;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface ContextWindowReferenceContractTrace {
|
|
72
|
+
id: string;
|
|
73
|
+
sourcePath: string;
|
|
74
|
+
sourceHash: string;
|
|
75
|
+
sourceChars: number;
|
|
76
|
+
renderedChars: number;
|
|
77
|
+
phase: string;
|
|
78
|
+
reason: string;
|
|
79
|
+
modelVisible: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Typed, non-model-visible explanation of the request compiler's live choices.
|
|
83
|
+
* The exact outbound request remains the source of truth for rendered text.
|
|
84
|
+
*/
|
|
85
|
+
export interface ContextWindowRequestCompilation {
|
|
86
|
+
schemaVersion: 1;
|
|
87
|
+
taskEpoch: number;
|
|
88
|
+
modelTier: string;
|
|
89
|
+
phase: string;
|
|
90
|
+
contracts: ContextWindowReferenceContractTrace[];
|
|
91
|
+
/** Ledger-backed explanation only; record bodies remain in the durable store. */
|
|
92
|
+
memoryWorkingSet?: {
|
|
93
|
+
epoch: string;
|
|
94
|
+
rootRecordIds: string[];
|
|
95
|
+
recordIds: string[];
|
|
96
|
+
transactionIds: string[];
|
|
97
|
+
fingerprint: string;
|
|
98
|
+
};
|
|
99
|
+
/** Shadow-only compiler proposal, never inserted into model history. */
|
|
100
|
+
memoryCompilerShadow?: {
|
|
101
|
+
stateFingerprint: string;
|
|
102
|
+
requestFingerprint: string;
|
|
103
|
+
decision: "compact" | "hold" | "skipped";
|
|
104
|
+
accepted: boolean;
|
|
105
|
+
cacheHit: boolean;
|
|
106
|
+
candidateRecordIds: string[];
|
|
107
|
+
activeRecordIds: string[];
|
|
108
|
+
retainedRecordIds?: string[];
|
|
109
|
+
archivedRecordIds?: string[];
|
|
110
|
+
reason: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Operator-facing audit of a typed memory compilation plan. This is never
|
|
114
|
+
* rendered into the model request: artifact bodies remain in the artifact
|
|
115
|
+
* store and this record contains only bounded dispositions and locators.
|
|
116
|
+
*/
|
|
117
|
+
memoryCompilationPlan?: ContextWindowMemoryCompilationPlanAudit;
|
|
118
|
+
contextSignals?: {
|
|
119
|
+
included: string[];
|
|
120
|
+
dropped: string[];
|
|
121
|
+
};
|
|
122
|
+
/** Exact structural projection of the request passed to the backend. */
|
|
123
|
+
canonicalProjection?: CanonicalRequestTrace;
|
|
124
|
+
/** Final, non-model-visible capacity admission for this exact request. */
|
|
125
|
+
contextAdmission?: ContextAdmissionReceipt;
|
|
126
|
+
/** Capacity observations retain their phase so raw history pressure cannot masquerade as final pressure. */
|
|
127
|
+
contextAdmissionPasses?: Array<{
|
|
128
|
+
phase: "pre_projection" | "projection_capacity_refresh" | "final_materialized" | "final_capacity_refresh";
|
|
129
|
+
receipt: ContextAdmissionReceipt;
|
|
130
|
+
}>;
|
|
131
|
+
/** Set only by the primary task producer; conversation and auxiliary requests need no task frame. */
|
|
132
|
+
taskFrameRequired?: boolean;
|
|
133
|
+
invariantErrors?: string[];
|
|
134
|
+
appendOnlyOutboundDecisions?: Array<{
|
|
135
|
+
logicalRequestId: string;
|
|
136
|
+
mode: "full" | "extended";
|
|
137
|
+
reason: string;
|
|
138
|
+
}>;
|
|
139
|
+
}
|
|
140
|
+
/** The only model-visible-content dispositions a memory compilation plan may use. */
|
|
141
|
+
export type ContextWindowMemoryDisposition = "retain_full" | "retain_partial" | "retain_reference" | "compact_event" | "compact_summary" | "archive";
|
|
142
|
+
/** Lifecycle state of a compiler proposal as observed by the request compiler. */
|
|
143
|
+
export type ContextWindowMemoryCompilationPlanState = "shadow" | "hold" | "applied" | "rejected" | "skipped";
|
|
144
|
+
/** Body-free reason an otherwise successful inference response was unusable. */
|
|
145
|
+
export type ContextWindowMemoryCompilationInvalidOutputDetail = "empty_content" | "reasoning_only" | "no_complete_json" | "malformed_json" | "schema_invalid" | "duplicate_candidate_id" | "unknown_candidate_id" | "locked_candidate_id";
|
|
146
|
+
/** A durable pointer to source evidence; it deliberately has no artifact body. */
|
|
147
|
+
export interface ContextWindowMemoryArtifactLocator {
|
|
148
|
+
artifactId?: string;
|
|
149
|
+
/** Content-addressed resolver URI, e.g. omnius-artifact://sha256/<hash>. */
|
|
150
|
+
artifactUri?: string;
|
|
151
|
+
path?: string;
|
|
152
|
+
revision?: string;
|
|
153
|
+
lineStart?: number;
|
|
154
|
+
lineEnd?: number;
|
|
155
|
+
}
|
|
156
|
+
/** One classified candidate in the operator audit. Text is rationale, never source content. */
|
|
157
|
+
export interface ContextWindowMemoryDispositionAudit {
|
|
158
|
+
candidateId: string;
|
|
159
|
+
disposition: ContextWindowMemoryDisposition;
|
|
160
|
+
locators: ContextWindowMemoryArtifactLocator[];
|
|
161
|
+
justification?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Bounded, serializable compilation-plan receipt for dumps and the TUI.
|
|
165
|
+
* It permits an operator to inspect why an artifact changed representation
|
|
166
|
+
* without leaking a raw artifact body into a recap, summary, or event feed.
|
|
167
|
+
*/
|
|
168
|
+
export interface ContextWindowMemoryCompilationPlanAudit {
|
|
169
|
+
schemaVersion: 1;
|
|
170
|
+
id: string;
|
|
171
|
+
state: ContextWindowMemoryCompilationPlanState;
|
|
172
|
+
preRequestFingerprint: string;
|
|
173
|
+
postRequestFingerprint?: string;
|
|
174
|
+
/** Relates this stage's receipt to the subsequently projected wire request. */
|
|
175
|
+
finalRequestFingerprint?: string;
|
|
176
|
+
finalProjectionChanged?: boolean;
|
|
177
|
+
inferenceOutcome?: "plan" | "invalid_output" | "backend_error";
|
|
178
|
+
inferenceAttempts?: number;
|
|
179
|
+
inferenceErrorKind?: "invalid_output" | "timeout" | "rate_limited" | "server_error" | "connection" | "request_rejected" | "unknown";
|
|
180
|
+
inferenceErrorStatus?: number;
|
|
181
|
+
inferenceInvalidOutputDetail?: ContextWindowMemoryCompilationInvalidOutputDetail;
|
|
182
|
+
inferenceOutputTruncated?: boolean;
|
|
183
|
+
cacheHit?: boolean;
|
|
184
|
+
dispositionCounts: Partial<Record<ContextWindowMemoryDisposition, number>>;
|
|
185
|
+
dispositions: ContextWindowMemoryDispositionAudit[];
|
|
186
|
+
allCandidatesClassified?: boolean;
|
|
187
|
+
justification?: string;
|
|
188
|
+
}
|
|
189
|
+
export interface ContextWindowDumpSummary extends Omit<ContextWindowDumpRecord, "request" | "requestCompilation" | "requestBudget"> {
|
|
190
|
+
path: string;
|
|
191
|
+
requestCompilation?: {
|
|
192
|
+
schemaVersion: 1;
|
|
193
|
+
taskEpoch: number;
|
|
194
|
+
modelTier: string;
|
|
195
|
+
phase: string;
|
|
196
|
+
contractIds: string[];
|
|
197
|
+
memoryWorkingSetFingerprint?: string;
|
|
198
|
+
memoryCompilerShadowDecision?: "compact" | "hold" | "skipped";
|
|
199
|
+
contextAdmissionPasses?: ContextWindowRequestCompilation["contextAdmissionPasses"];
|
|
200
|
+
taskFrameRequired?: boolean;
|
|
201
|
+
invariantErrors?: string[];
|
|
202
|
+
appendOnlyOutboundDecisions?: ContextWindowRequestCompilation["appendOnlyOutboundDecisions"];
|
|
203
|
+
canonicalProjection?: Pick<CanonicalRequestTrace, "schema" | "status" | "maxRequestBytes" | "finalRequestBytes" | "overflowBytes" | "requestHash" | "selectedMessageIds" | "droppedMessageIds" | "historyDecisions">;
|
|
204
|
+
memoryCompilationPlan?: {
|
|
205
|
+
id: string;
|
|
206
|
+
state: ContextWindowMemoryCompilationPlanState;
|
|
207
|
+
preRequestFingerprint: string;
|
|
208
|
+
postRequestFingerprint?: string;
|
|
209
|
+
finalRequestFingerprint?: string;
|
|
210
|
+
finalProjectionChanged?: boolean;
|
|
211
|
+
inferenceOutcome?: "plan" | "invalid_output" | "backend_error";
|
|
212
|
+
inferenceAttempts?: number;
|
|
213
|
+
inferenceErrorKind?: "invalid_output" | "timeout" | "rate_limited" | "server_error" | "connection" | "request_rejected" | "unknown";
|
|
214
|
+
inferenceErrorStatus?: number;
|
|
215
|
+
inferenceInvalidOutputDetail?: ContextWindowMemoryCompilationInvalidOutputDetail;
|
|
216
|
+
inferenceOutputTruncated?: boolean;
|
|
217
|
+
cacheHit?: boolean;
|
|
218
|
+
dispositionCounts: Partial<Record<ContextWindowMemoryDisposition, number>>;
|
|
219
|
+
locatorCount: number;
|
|
220
|
+
justificationCount: number;
|
|
221
|
+
};
|
|
222
|
+
contextAdmission?: Pick<ContextAdmissionReceipt, "contextLimitTokens" | "contextLimitSource" | "estimatedInputTokens" | "admittedOutputTokens" | "safetyMarginTokens" | "projectedTotalTokens" | "decision" | "compactedMessageCount" | "reducedToolSchema">;
|
|
223
|
+
};
|
|
224
|
+
requestBudget: Pick<OutboundRequestBudget, "requestFingerprint" | "modelContextTokens" | "projectedTotalTokens" | "freeTokens" | "freeRatio" | "compactionEligible" | "serializedRequestBytes">;
|
|
225
|
+
}
|
|
226
|
+
export interface ContextWindowDumpMetrics {
|
|
227
|
+
messageCount: number;
|
|
228
|
+
estimatedTokens: number;
|
|
229
|
+
totalChars: number;
|
|
230
|
+
imageCount: number;
|
|
231
|
+
toolSchemaCount: number;
|
|
232
|
+
toolSchemaChars: number;
|
|
233
|
+
roleCounts: Record<string, number>;
|
|
234
|
+
roleChars: Record<string, number>;
|
|
235
|
+
activeEvidenceChars: number;
|
|
236
|
+
activeContextFrameChars: number;
|
|
237
|
+
activeContextFrameCount: number;
|
|
238
|
+
compactedDiscoveryChars: number;
|
|
239
|
+
rawDiscoveryToolChars: number;
|
|
240
|
+
toolResultChars: number;
|
|
241
|
+
systemChars: number;
|
|
242
|
+
userChars: number;
|
|
243
|
+
userMessageCount: number;
|
|
244
|
+
assistantChars: number;
|
|
245
|
+
runtimeControlChars: number;
|
|
246
|
+
controlToEvidenceRatio: number;
|
|
247
|
+
hasConcreteUserGoal: boolean;
|
|
248
|
+
userlessTaskTurn: boolean;
|
|
249
|
+
modelVisibleNoiseChars: number;
|
|
250
|
+
qualityWarnings: string[];
|
|
251
|
+
signalToNoise: {
|
|
252
|
+
structuralSignalChars: number;
|
|
253
|
+
structuralNoiseCandidateChars: number;
|
|
254
|
+
ratio: number;
|
|
255
|
+
snrDb: number;
|
|
256
|
+
lineNoiseChars: number;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
export interface ContextWindowApiViewSummary {
|
|
260
|
+
kind: "model-facing-api-view";
|
|
261
|
+
/** Exact fingerprints/accounting are retained, but the durable body is redacted. */
|
|
262
|
+
exactRequestStored: false;
|
|
263
|
+
requestStorage: "redacted";
|
|
264
|
+
messageCount: number;
|
|
265
|
+
toolSchemaCount: number;
|
|
266
|
+
roleCounts: Record<string, number>;
|
|
267
|
+
estimatedTokens: number;
|
|
268
|
+
activeContextFrameCount: number;
|
|
269
|
+
hasConcreteUserGoal: boolean;
|
|
270
|
+
userlessTaskTurn: boolean;
|
|
271
|
+
qualityWarnings: string[];
|
|
272
|
+
currentGoalPreview?: string;
|
|
273
|
+
messagePreviews: Array<{
|
|
274
|
+
index: number;
|
|
275
|
+
role: string;
|
|
276
|
+
chars: number;
|
|
277
|
+
preview: string;
|
|
278
|
+
}>;
|
|
279
|
+
}
|
|
280
|
+
export interface ContextWindowDumpFocusSupervisor {
|
|
281
|
+
mode?: string;
|
|
282
|
+
enabled?: boolean;
|
|
283
|
+
state?: string;
|
|
284
|
+
lastDecision?: string;
|
|
285
|
+
lastReason?: string;
|
|
286
|
+
directive?: {
|
|
287
|
+
id?: string;
|
|
288
|
+
state?: string;
|
|
289
|
+
reason?: string;
|
|
290
|
+
requiredNextAction?: string;
|
|
291
|
+
forbiddenActionFamilies?: string[];
|
|
292
|
+
createdTurn?: number;
|
|
293
|
+
ignoredCount?: number;
|
|
294
|
+
} | null;
|
|
295
|
+
context?: {
|
|
296
|
+
estimatedTokens?: number;
|
|
297
|
+
rawDiscoveryChars?: number;
|
|
298
|
+
activeEvidenceChars?: number;
|
|
299
|
+
activeFrameChars?: number;
|
|
300
|
+
signalToNoiseRatio?: number;
|
|
301
|
+
pressureRatio?: number;
|
|
302
|
+
droppedSignals?: number;
|
|
303
|
+
truncatedSignals?: number;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
export declare function contextWindowDumpDir(cwd?: string): string;
|
|
307
|
+
export declare function recordContextWindowDump(input: ContextWindowDumpInput): ContextWindowDumpRecord | null;
|
|
308
|
+
export declare function readContextWindowDump(id: string, opts?: {
|
|
309
|
+
cwd?: string;
|
|
310
|
+
agentType?: ContextWindowAgentType | string;
|
|
311
|
+
}): ContextWindowDumpRecord | null;
|
|
312
|
+
export declare function listContextWindowDumps(opts?: {
|
|
313
|
+
cwd?: string;
|
|
314
|
+
limit?: number;
|
|
315
|
+
agentType?: string;
|
|
316
|
+
sessionId?: string;
|
|
317
|
+
includeRequest?: boolean;
|
|
318
|
+
}): Array<ContextWindowDumpSummary | ContextWindowDumpRecord>;
|
|
319
|
+
export declare function analyzeContextWindowDumpRequest(request: Record<string, unknown>): ContextWindowDumpMetrics;
|
|
320
|
+
/**
|
|
321
|
+
* Normalize a compilation-plan receipt at the persistence/UI boundary. Raw
|
|
322
|
+
* source bodies, arbitrary nested model output, and oversize rationale text
|
|
323
|
+
* cannot enter the audit through this shape. Invalid receipts are omitted
|
|
324
|
+
* rather than being converted into an untyped recap.
|
|
325
|
+
*/
|
|
326
|
+
export declare function normalizeMemoryCompilationPlanAudit(input: unknown): ContextWindowMemoryCompilationPlanAudit | null;
|
|
327
|
+
export declare function defaultContextWindowDumpLocations(cwd?: string): string[];
|