@kodax-ai/kodax 0.7.42 → 0.7.43

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +34 -6
  2. package/README.md +87 -56
  3. package/README_CN.md +46 -25
  4. package/dist/chunks/chunk-7G5PSL6C.js +830 -0
  5. package/dist/chunks/{chunk-IYJ5EPRV.js → chunk-IYSK7LUK.js} +1 -1
  6. package/dist/chunks/chunk-K75O2CAE.js +31 -0
  7. package/dist/chunks/chunk-UG4262JI.js +502 -0
  8. package/dist/chunks/chunk-VHKAJDQD.js +425 -0
  9. package/dist/chunks/chunk-YMRZBS4G.js +2 -0
  10. package/dist/chunks/compaction-config-3E57ABCT.js +2 -0
  11. package/dist/chunks/{construction-bootstrap-J2WOCYEK.js → construction-bootstrap-JR63KI5N.js} +4 -4
  12. package/dist/chunks/dist-KWHUKXEL.js +2 -0
  13. package/dist/chunks/dist-XANXEVTU.js +2 -0
  14. package/dist/chunks/utils-HQ2QCKJA.js +2 -0
  15. package/dist/index.d.ts +10 -10
  16. package/dist/index.js +2 -2
  17. package/dist/kodax_cli.js +1124 -1102
  18. package/dist/sdk-agent.d.ts +850 -48
  19. package/dist/sdk-agent.js +1 -1
  20. package/dist/sdk-coding.d.ts +701 -815
  21. package/dist/sdk-coding.js +1 -1
  22. package/dist/sdk-llm.d.ts +5 -3
  23. package/dist/sdk-llm.js +1 -1
  24. package/dist/sdk-mcp.d.ts +1 -1
  25. package/dist/sdk-mcp.js +1 -1
  26. package/dist/sdk-repl.d.ts +9 -8
  27. package/dist/sdk-repl.js +1 -1
  28. package/dist/sdk-session.d.ts +22 -10
  29. package/dist/sdk-session.js +1 -1
  30. package/dist/sdk-skills.js +1 -1
  31. package/dist/types-chunks/{cost-tracker.d-B6vMoLLF.d.ts → base.d-FUJahC0i.d.ts} +2 -110
  32. package/dist/types-chunks/{bash-prefix-extractor.d-CkhaqKkg.d.ts → bash-prefix-extractor.d-DMrGImMl.d.ts} +35 -136
  33. package/dist/types-chunks/cost-tracker.d-wRtyEW9d.d.ts +110 -0
  34. package/dist/types-chunks/{history-cleanup.d-DznrzEiU.d.ts → file-tracker.d-zaLZeNBK.d.ts} +314 -6
  35. package/dist/types-chunks/manager.d-87belpiS.d.ts +370 -0
  36. package/dist/types-chunks/{resolver.d-DX9au4NJ.d.ts → resolver.d-CA68_NeH.d.ts} +149 -5
  37. package/dist/types-chunks/{session-storage.d-Cci897iM.d.ts → storage.d-DPAEX7zS.d.ts} +49 -2
  38. package/dist/types-chunks/{instance-discovery.d-BsKnIwpg.d.ts → types.d-CKJtjo-6.d.ts} +139 -2
  39. package/dist/types-chunks/{storage.d-Bc5DoAwp.d.ts → utils.d-DkLZD_wa.d.ts} +24 -46
  40. package/package.json +7 -6
  41. package/dist/chunks/chunk-3RKBXWZS.js +0 -2
  42. package/dist/chunks/chunk-7JLYVWAF.js +0 -1033
  43. package/dist/chunks/chunk-CD3R5YBH.js +0 -16
  44. package/dist/chunks/chunk-DKXUY5F2.js +0 -209
  45. package/dist/chunks/chunk-HMYEQJGT.js +0 -31
  46. package/dist/chunks/chunk-KUX5LRPP.js +0 -2
  47. package/dist/chunks/chunk-OWSKU55I.js +0 -13
  48. package/dist/chunks/chunk-ZZ4KRK2B.js +0 -465
  49. package/dist/chunks/compaction-config-FIFFP4FT.js +0 -2
  50. package/dist/chunks/dist-2ZHWDXMQ.js +0 -2
  51. package/dist/chunks/dist-W4CJWLIH.js +0 -2
  52. package/dist/chunks/utils-A5MWDTWZ.js +0 -2
  53. package/dist/types-chunks/transport.d-DuyjG30t.d.ts +0 -180
@@ -1,12 +1,130 @@
1
- export { K as KodaXCompactMemoryProgress, a as KodaXCompactMemorySeed, b as KodaXExtensionSessionRecord, c as KodaXExtensionSessionState, d as KodaXExtensionStore, e as KodaXExtensionStoreEntry, f as KodaXJsonValue, g as KodaXSessionArchiveMarkerEntry, h as KodaXSessionArtifactLedgerEntry, i as KodaXSessionBranchSummaryEntry, j as KodaXSessionCompactionEntry, k as KodaXSessionData, l as KodaXSessionEntry, m as KodaXSessionEntryBase, n as KodaXSessionLabelEntry, o as KodaXSessionLineage, p as KodaXSessionMessageEntry, q as KodaXSessionMeta, r as KodaXSessionNavigationOptions, s as KodaXSessionRuntimeInfo, t as KodaXSessionScope, u as KodaXSessionStorage, v as KodaXSessionTreeNode, w as KodaXSessionUiHistoryItem, x as KodaXSessionUiHistoryItemType, y as KodaXSessionWorkspaceKind, S as SessionErrorMetadata } from './types-chunks/types.d-mM8vqvhT.js';
2
- import { d as AgentManifest, M as ManifestPatch, k as InvariantId, Q as QualityInvariant } from './types-chunks/history-cleanup.d-DznrzEiU.js';
3
- export { A as AdmissionAuditOptions, a as AdmissionCtx, b as AdmissionVerdict, c as AdmittedHandle, C as CompactionContext, e as CompactionEntry, f as CompactionEntryPayload, g as CompactionPolicy, D as DEFAULT_SYSTEM_CAP, h as DefaultSummaryCompaction, i as DefaultSummaryCompactionOptions, j as Deliverable, I as InMemorySessionOptions, l as InvariantResult, m as InvariantSession, K as KODAX_API_MIN_INTERVAL, n as KODAX_DEFAULT_TIMEOUT, o as KODAX_HARD_TIMEOUT, p as KODAX_MAX_INCOMPLETE_RETRIES, q as KODAX_MAX_MAXTOKENS_RETRIES, r as KODAX_MAX_RETRIES, s as KODAX_MAX_TOKENS, t as KODAX_RETRY_BASE_DELAY, u as KODAX_STAGGER_DELAY, v as MessageEntry, O as ObserveCtx, P as PROMISE_PATTERN, w as PolicyCompactionResult, x as PresetDispatcher, y as PresetTracingContext, R as ReadonlyMutationTracker, z as ReadonlyRecorder, B as RunEvent, E as RunOptions, F as RunResult, G as Runner, H as RunnerEvent, S as Session, J as SessionDispatchResult, L as SessionEntry, N as SessionExtension, T as SessionForkOptions, U as StopHookContext, V as StopHookFn, W as StopHookResult, X as SystemCap, Y as TerminalCtx, Z as ToolCapability, _ as ToolPermission, $ as _resetAdmittedAgentBindings, a0 as _resetPresetDispatchers, a1 as buildSystemPrompt, a2 as cleanupIncompleteToolCalls, a3 as countTokens, a4 as createInMemorySession, a5 as createInvariantSessionForAgent, a6 as detectInstructionsInjection, a7 as estimateTokens, a8 as extractAssistantTextFromMessage, a9 as getAdmittedAgentBindings, aa as getAgentConfigHome, ab as getAgentConfigPath, ac as getAppDataDir, ad as registerPresetDispatcher, ae as runAdmissionAudit, af as setAdmittedAgentBindings, ag as setAgentConfigHome, ah as validateAndFixToolHistory } from './types-chunks/history-cleanup.d-DznrzEiU.js';
4
- import { A as Agent, H as Handoff, r as RunnerToolCall, u as RunnerToolResult, w as Span, a as AgentMessage, C as ChildTaskRegistry, D as DiscoveredInstance, S as SessionMeta, v as SessionStateSnapshot, B as StateWriterFs, k as InstanceDiscoveryFs, z as StateWriter } from './types-chunks/instance-discovery.d-BsKnIwpg.js';
5
- export { b as AgentMiddlewareDeclaration, c as AgentReasoningProfile, d as AgentTool, e as CurrentTodoSummary, f as DiscoveryOptions, G as Guardrail, g as GuardrailBlockedError, h as GuardrailContext, i as GuardrailEscalateError, j as GuardrailVerdict, I as InputGuardrail, M as MAX_TOOL_LOOP_ITERATIONS, O as OutputGuardrail, P as PersistedSessionState, R as ReasoningDepth, l as RecentlyModifiedFile, m as RequestTaskStopOptions, n as RequestTaskStopResult, o as RunnableTool, p as RunnerLlmResult, q as RunnerLlmReturn, s as RunnerToolContext, t as RunnerToolObserver, E as StateWriterOptions, T as TaskAbortRegistry, F as ToolBeforeOutcome, J as ToolGuardrail, K as buildAssistantMessageFromLlmResult, L as buildToolResultMessage, N as collectGuardrails, Q as createAgent, U as createHandoff, V as createStateWriter, W as discoverInstances, X as executeRunnerToolCall, Y as isRunnableTool, Z as isRunnerLlmResult, _ as registerChildTask, $ as requestTaskStop, a0 as runInputGuardrails, a1 as runOutputGuardrails, a2 as runToolAfterGuardrails, a3 as runToolBeforeGuardrails } from './types-chunks/instance-discovery.d-BsKnIwpg.js';
1
+ import { h as KodaXSessionArtifactLedgerEntry, d as KodaXExtensionStore, e as KodaXExtensionStoreEntry, f as KodaXJsonValue } from './types-chunks/types.d-mM8vqvhT.js';
2
+ export { K as KodaXCompactMemoryProgress, a as KodaXCompactMemorySeed, b as KodaXExtensionSessionRecord, c as KodaXExtensionSessionState, g as KodaXSessionArchiveMarkerEntry, i as KodaXSessionBranchSummaryEntry, j as KodaXSessionCompactionEntry, k as KodaXSessionData, l as KodaXSessionEntry, m as KodaXSessionEntryBase, n as KodaXSessionLabelEntry, o as KodaXSessionLineage, p as KodaXSessionMessageEntry, q as KodaXSessionMeta, r as KodaXSessionNavigationOptions, s as KodaXSessionRuntimeInfo, t as KodaXSessionScope, u as KodaXSessionStorage, v as KodaXSessionTreeNode, w as KodaXSessionUiHistoryItem, x as KodaXSessionUiHistoryItemType, y as KodaXSessionWorkspaceKind, S as SessionErrorMetadata } from './types-chunks/types.d-mM8vqvhT.js';
3
+ import { a8 as Trace, d as AgentManifest, M as ManifestPatch, k as InvariantId, Q as QualityInvariant } from './types-chunks/file-tracker.d-zaLZeNBK.js';
4
+ export { A as AdmissionAuditOptions, a as AdmissionCtx, b as AdmissionVerdict, c as AdmittedHandle, C as CompactionContext, e as CompactionEntry, f as CompactionEntryPayload, g as CompactionPolicy, D as DEFAULT_SYSTEM_CAP, h as DefaultSummaryCompaction, i as DefaultSummaryCompactionOptions, j as Deliverable, I as InMemorySessionOptions, l as InvariantResult, m as InvariantSession, K as KODAX_API_MIN_INTERVAL, n as KODAX_DEFAULT_TIMEOUT, o as KODAX_HARD_TIMEOUT, p as KODAX_MAX_INCOMPLETE_RETRIES, q as KODAX_MAX_MAXTOKENS_RETRIES, r as KODAX_MAX_RETRIES, s as KODAX_MAX_TOKENS, t as KODAX_RETRY_BASE_DELAY, u as KODAX_STAGGER_DELAY, L as LINEAGE_ENTRY_TYPES, v as LineageArtifactLedgerPayload, w as LineageCompaction, x as LineageCompactionDelegates, y as LineageEntryType, z as LineageExtension, B as LineageLabelPayload, E as LineageTreeNode, F as MessageEntry, O as ObserveCtx, P as PROMISE_PATTERN, G as PolicyCompactionResult, H as PresetDispatcher, J as PresetTracingContext, R as ReadonlyMutationTracker, N as ReadonlyRecorder, S as RunEvent, T as RunOptions, U as RunResult, V as Runner, W as RunnerEvent, X as Session, Y as SessionDispatchResult, Z as SessionEntry, _ as SessionExtension, $ as SessionForkOptions, a0 as StartTraceOptions, a1 as StopHookContext, a2 as StopHookFn, a3 as StopHookResult, a4 as SystemCap, a5 as TerminalCtx, a6 as ToolCapability, a7 as ToolPermission, a9 as TraceOptions, aa as Tracer, ab as TracerOptions, ac as _resetAdmittedAgentBindings, ad as _resetPresetDispatchers, ae as appendSessionLineageLabel, af as applyLineageTruncation, ag as applySessionCompaction, ah as archiveOldIslands, ai as buildSessionTree, aj as buildSystemPrompt, ak as cleanupIncompleteToolCalls, al as countActiveLineageMessages, am as countTokens, an as createInMemorySession, ao as createInvariantSessionForAgent, ap as createSessionLineage, aq as createTrace, ar as defaultTracer, as as detectInstructionsInjection, at as estimateTokens, au as extractArtifactLedger, av as extractAssistantTextFromMessage, aw as extractFileOps, ax as extractTitleFromMessages, ay as findPreviousUserEntryId, az as forkSessionLineage, aA as generateSessionId, aB as getAdmittedAgentBindings, aC as getAgentConfigHome, aD as getAgentConfigPath, aE as getAppDataDir, aF as getSessionLineagePath, aG as getSessionMessagesFromLineage, aH as mergeArtifactLedger, aI as mergeFileOps, aJ as registerPresetDispatcher, aK as resolveSessionLineageTarget, aL as rewindSessionLineage, aM as runAdmissionAudit, aN as setAdmittedAgentBindings, aO as setAgentConfigHome, aP as setSessionLineageActiveEntry, aQ as validateAndFixToolHistory } from './types-chunks/file-tracker.d-zaLZeNBK.js';
5
+ import { U as Span, A as Agent, H as Handoff, K as RunnerToolCall, Q as RunnerToolResult, a as AgentMessage, C as ChildTaskRegistry, D as DiscoveredInstance, S as SessionMeta, T as SessionStateSnapshot, _ as StateWriterFs, v as InstanceDiscoveryFs, Z as StateWriter, h as CompactionDetails, g as CompactionConfig, i as CompactionResult } from './types-chunks/types.d-CKJtjo-6.js';
6
+ export { b as AgentMiddlewareDeclaration, c as AgentReasoningProfile, d as AgentSpanData, e as AgentTool, f as CompactionAnchor, j as CompactionSpanData, k as CompactionUpdate, l as CurrentTodoSummary, m as DiscoveryOptions, E as EvidenceSpanData, F as FanoutSpanData, n as FileOperations, G as GenerationSpanData, o as Guardrail, p as GuardrailBlockedError, q as GuardrailContext, r as GuardrailEscalateError, s as GuardrailSpanData, t as GuardrailVerdict, u as HandoffSpanData, I as InputGuardrail, M as MAX_TOOL_LOOP_ITERATIONS, O as OutputGuardrail, P as PersistedSessionState, R as ReasoningDepth, w as RecentlyModifiedFile, x as RequestTaskStopOptions, y as RequestTaskStopResult, z as RunnableTool, B as RunnerLlmResult, J as RunnerLlmReturn, L as RunnerToolContext, N as RunnerToolObserver, V as SpanData, W as SpanError, X as SpanImpl, Y as SpanImplOptions, $ as StateWriterOptions, a0 as StopHookSpanData, a1 as TaskAbortRegistry, a2 as ToolBeforeOutcome, a3 as ToolCallSpanData, a4 as ToolGuardrail, a5 as buildAssistantMessageFromLlmResult, a6 as buildToolResultMessage, a7 as collectGuardrails, a8 as createAgent, a9 as createHandoff, aa as createStateWriter, ab as discoverInstances, ac as executeRunnerToolCall, ad as isRunnableTool, ae as isRunnerLlmResult, af as registerChildTask, ag as requestTaskStop, ah as runInputGuardrails, ai as runOutputGuardrails, aj as runToolAfterGuardrails, ak as runToolBeforeGuardrails } from './types-chunks/types.d-CKJtjo-6.js';
6
7
  import { m as KodaXMessage } from './types-chunks/types.d-B1uGoVTE.js';
7
8
  export { e as KodaXAssuranceIntent, g as KodaXContentBlock, i as KodaXExecutionMode, j as KodaXExecutionPattern, l as KodaXImageBlock, o as KodaXMutationSurface, r as KodaXProviderConfig, z as KodaXProviderStreamOptions, C as KodaXReasoningCapability, D as KodaXReasoningMode, F as KodaXReasoningRequest, G as KodaXRedactedThinkingBlock, I as KodaXRiskLevel, J as KodaXStreamResult, L as KodaXTaskActionability, M as KodaXTaskBudgetOverrides, N as KodaXTaskComplexity, O as KodaXTaskFamily, P as KodaXTaskRoutingDecision, Q as KodaXTaskType, R as KodaXTaskWorkIntent, S as KodaXTextBlock, T as KodaXThinkingBlock, U as KodaXThinkingBudgetMap, V as KodaXThinkingDepth, W as KodaXTokenUsage, X as KodaXToolDefinition, Y as KodaXToolResultBlock, a0 as KodaXToolUseBlock } from './types-chunks/types.d-B1uGoVTE.js';
8
9
  export { C as CapabilityKind, a as CapabilityProvider, b as CapabilityResult } from './types-chunks/capability.d-3C62G8Eq.js';
9
10
  import { Q as QueueEventListener, b as QueuedMessage, E as EnqueueInput, D as DequeueFilter, a as MessagePriority, M as MessageMode } from './types-chunks/types.d-C5mHR87z.js';
11
+ export { M as McpConnectMode, a as McpServerConfig, b as McpServersConfig, c as McpTransportKind } from './types-chunks/config.d-BfJUXxC0.js';
12
+ export { M as McpCapabilityDescriptor, a as McpCapabilityKind, b as McpCapabilityProvider, c as McpCapabilityRisk, d as McpCatalogItem, e as McpManager, f as McpProviderOptions, g as McpServerCatalog, h as McpServerCatalogSnapshot, i as McpServerLogs, j as McpServerRuntime, k as McpServerRuntimeDiagnostics, l as McpServerStatus, m as McpServerToolList, n as McpTransport, o as McpTransportEvents, p as createMcpCapabilityId, q as createMcpManager, r as createMcpTransport, s as defaultMcpCacheDir, t as getMcpCachePaths, u as parseMcpCapabilityId, v as searchMcpCatalog } from './types-chunks/manager.d-87belpiS.js';
13
+ export { createMcpTestServerFixture } from './sdk-mcp.js';
14
+ export { DiscoveryResult, ExecutionMode, ExecutionOptions, ISkillRegistry, IVariableResolver, Skill, SkillArtifact, SkillContext, SkillDynamicContextExecutor, SkillExecutor, SkillExpansionResult, SkillFile, SkillFrontmatter, SkillHook, SkillHooks, SkillMetadata, SkillPathsConfig, SkillRegistry, SkillResult, SkillSource, VariableResolver, clearPluginSkillPaths, createExecutor, createResolver, discoverSkills, discoverSkillsWithMonorepo, executeSkill, expandSkillForLLM, formatSkillActivationMessage, getDefaultSkillPaths, getNestedSkillPaths, getSkillPathsFlat, getSkillRegistry, initializeSkillRegistry, listPluginSkillPaths, loadFullSkill, loadSkillFileContent, loadSkillMetadata, parseArguments, parseSkillMarkdown, registerPluginSkillPath, resetSkillRegistry, resolveSkillContent, unregisterPluginSkillPath } from './sdk-skills.js';
15
+ import { K as KodaXBaseProvider } from './types-chunks/base.d-FUJahC0i.js';
16
+
17
+ /**
18
+ * TracingProcessor — sink for span/trace lifecycle events.
19
+ *
20
+ * FEATURE_083 (v0.7.24): minimal processor contract modeled after
21
+ * openai-agents-python. External adapters (OpenTelemetry, Langfuse, custom
22
+ * telemetry) implement this interface and register via
23
+ * `addTracingProcessor` / `setTracingProcessors`.
24
+ *
25
+ * Lifecycle:
26
+ * - `onSpanStart(span)` fires when a span is created and attached to its
27
+ * parent. Called synchronously; implementations should defer I/O.
28
+ * - `onSpanEnd(span)` fires on `span.end()`. The span's `endedAt`,
29
+ * `error`, and final children list are authoritative at this point.
30
+ * - `onTraceEnd(trace)` fires on `trace.end()` after the root span ends.
31
+ * - `shutdown()` is optional; called when the host wants processors to
32
+ * flush pending work (e.g. batch buffers).
33
+ */
34
+
35
+ interface TracingProcessor {
36
+ onSpanStart(span: Span): void;
37
+ onSpanEnd(span: Span): void;
38
+ onTraceEnd(trace: Trace): void;
39
+ shutdown?(): Promise<void>;
40
+ }
41
+ /**
42
+ * Register a tracing processor. Returns an unregister function.
43
+ *
44
+ * Consumers typically call this at app startup:
45
+ *
46
+ * addTracingProcessor(new ConsoleTracingProcessor());
47
+ */
48
+ declare function addTracingProcessor(p: TracingProcessor): () => void;
49
+ /**
50
+ * Replace the current processor list. Useful in tests where you want a
51
+ * deterministic set of sinks.
52
+ */
53
+ declare function setTracingProcessors(ps: TracingProcessor[]): void;
54
+ /** @internal */
55
+ declare function _getRegisteredProcessors(): readonly TracingProcessor[];
56
+ /** @internal */
57
+ declare function _emitSpanStart(span: Span): void;
58
+ /** @internal */
59
+ declare function _emitSpanEnd(span: Span): void;
60
+ /** @internal */
61
+ declare function _emitTraceEnd(trace: Trace): void;
62
+ /**
63
+ * Flush-and-shutdown all registered processors. Callers can await this on
64
+ * process shutdown.
65
+ */
66
+ declare function shutdownTracing(): Promise<void>;
67
+
68
+ /**
69
+ * ConsoleTracingProcessor — writes span lifecycle lines to stdout.
70
+ *
71
+ * FEATURE_083 (v0.7.24): handy for local development. Not intended for
72
+ * production traffic.
73
+ *
74
+ * Output format (one line per event):
75
+ *
76
+ * [span:start] traceId=... spanId=... name=... kind=...
77
+ * [span:end] traceId=... spanId=... name=... kind=... durationMs=...
78
+ * [trace:end] traceId=... rootName=... durationMs=...
79
+ */
80
+
81
+ type WriteFn = (line: string) => void;
82
+ interface ConsoleTracingProcessorOptions {
83
+ /**
84
+ * Writer override. Defaults to `process.stdout.write`. Useful in tests so
85
+ * output goes to a capture buffer instead of the real stdout.
86
+ */
87
+ readonly write?: WriteFn;
88
+ }
89
+ declare class ConsoleTracingProcessor implements TracingProcessor {
90
+ private readonly write;
91
+ constructor(opts?: ConsoleTracingProcessorOptions);
92
+ onSpanStart(span: Span): void;
93
+ onSpanEnd(span: Span): void;
94
+ onTraceEnd(trace: Trace): void;
95
+ }
96
+
97
+ /**
98
+ * FileTracingProcessor — writes JSONL records to `.kodax/.traces/{traceId}.jsonl`.
99
+ *
100
+ * FEATURE_083 (v0.7.24): simple append-only log for offline analysis. Each
101
+ * span start / end / trace end becomes a separate JSON line.
102
+ *
103
+ * The processor buffers per-trace writes to the file system; call
104
+ * `shutdown()` on process exit to flush pending writes.
105
+ */
106
+
107
+ interface FileTracingProcessorOptions {
108
+ /**
109
+ * Directory for trace files. Defaults to `./.kodax/.traces`. Must be an
110
+ * absolute path or resolvable relative to `process.cwd()`.
111
+ */
112
+ readonly traceDir?: string;
113
+ }
114
+ declare class FileTracingProcessor implements TracingProcessor {
115
+ private readonly traceDir;
116
+ private readonly queues;
117
+ private writeChain;
118
+ private ensuredDir;
119
+ constructor(opts?: FileTracingProcessorOptions);
120
+ onSpanStart(span: Span): void;
121
+ onSpanEnd(span: Span): void;
122
+ onTraceEnd(trace: Trace): void;
123
+ shutdown(): Promise<void>;
124
+ private scheduleFlush;
125
+ private enqueue;
126
+ private flushTrace;
127
+ }
10
128
 
11
129
  /**
12
130
  * Runner Handoff Helpers — FEATURE_084 Shard 4 (v0.7.26).
@@ -605,9 +723,22 @@ interface IdleYieldSnapshot {
605
723
  /**
606
724
  * True if the run's managed-protocol payload has been populated
607
725
  * with a handoff (typically `emit_handoff` for the worker→evaluator
608
- * boundary). False = the run ended without a handoff. Idle-yield
609
- * REQUIRES this to be false; otherwise the handoff target already
610
- * owns the next step.
726
+ * boundary in legacy V1 / V2 chains). False = the run ended without
727
+ * a handoff. Idle-yield REQUIRES this to be false; otherwise the
728
+ * handoff target already owns the next step.
729
+ *
730
+ * **FEATURE_184 (v0.7.45) + FEATURE_190 (v0.7.43)**: the Evaluator
731
+ * role was retired and Worker/Generator are now terminal. Under the
732
+ * Sidecar Verifier architecture, the CANONICAL post-F184 terminal
733
+ * signal is text-only termination — Worker produces a final text
734
+ * message with no `tool_use` block, Runner.run exits via the no-
735
+ * tool-calls branch, and this snapshot reads `hasEmittedHandoff:
736
+ * false` + `lastAssistantToolCallCount: 0`. `detectIdleYield`
737
+ * correctly returns false in that state (no pending child, no
738
+ * pending banner) → the outer loop breaks. So text-only termination
739
+ * is a first-class exit path; `hasEmittedHandoff` retained only for
740
+ * the pre-FEATURE_190 Phase 3 legacy `emit_handoff` tool that
741
+ * remains in scope through the cleanup window.
611
742
  */
612
743
  readonly hasEmittedHandoff: boolean;
613
744
  /**
@@ -660,44 +791,6 @@ interface IdleYieldSnapshot {
660
791
  * resume gate (fast-child race recovery; see field docs).
661
792
  */
662
793
  declare function detectIdleYield(snapshot: IdleYieldSnapshot): boolean;
663
- /**
664
- * FEATURE_167 (v0.7.41) — terminal-verdict-missing predicate.
665
- *
666
- * Companion to `detectIdleYield`, gating the OPPOSITE half of the
667
- * outer-loop exit decision: when the inner Runner.run loop exits
668
- * with no tool calls AFTER a handoff has fired but BEFORE the
669
- * Evaluator has emitted a terminal verdict, the run is structurally
670
- * INCOMPLETE — the audit step is missing. `detectIdleYield` correctly
671
- * returns false in this state (the gate at line 174 short-circuits on
672
- * `hasEmittedHandoff`), so the outer loop currently terminates with
673
- * `recorder.verdict === undefined`. Downstream `deriveFinalStatus`
674
- * then falls back to `signal:'COMPLETE'`, falsely reporting success
675
- * for a failed audit (production session 20260515_185354).
676
- *
677
- * This predicate identifies that exact missing-verdict state so the
678
- * outer loop can branch into a retry path (inject a "call emit_verdict"
679
- * prompt and re-invoke the Evaluator) before falling through to a
680
- * synthesized fallback verdict.
681
- *
682
- * **Disjoint from `detectIdleYield`** by construction:
683
- *
684
- * - `detectIdleYield` requires `!hasEmittedHandoff`
685
- * - `detectMissingTerminalVerdict` requires `hasEmittedHandoff`
686
- *
687
- * Both also require `lastAssistantToolCallCount === 0`. Both gate on
688
- * `!hasEmittedTerminalVerdict`. The two predicates partition the
689
- * "Evaluator turn just exited text-only" space cleanly — no run can
690
- * satisfy both.
691
- *
692
- * **Pending children take precedence over verdict retry.** Predicate
693
- * is intentionally `pendingChildTaskCount <= 0 && !hasPendingBackgroundMessages`
694
- * so that if Evaluator dispatched audit children and is correctly
695
- * idle-yielding for them (FEATURE_155 Bug C discipline), the
696
- * verdict-missing retry does NOT fire — `detectIdleYield` handles
697
- * that path instead. Only when there's nothing left to wait on does
698
- * the verdict-missing branch take over.
699
- */
700
- declare function detectMissingTerminalVerdict(snapshot: IdleYieldSnapshot): boolean;
701
794
  /**
702
795
  * Discriminated union surfacing the reason a wake completed.
703
796
  *
@@ -1376,5 +1469,714 @@ declare function getActiveTeamModeWriter(): StateWriter | null;
1376
1469
  */
1377
1470
  declare function updateActiveTeamMode(patch: Partial<SessionStateSnapshot>): void;
1378
1471
 
1379
- export { Agent, AgentManifest, AgentMessage, CORE_INVARIANTS, ChildTaskRegistry, DEFAULT_IDLE_YIELD_MAX_ITERATIONS, DequeueFilter, DiscoveredInstance, EnqueueInput, Handoff, InstanceDiscoveryFs, InvariantId, KodaXMessage, ManifestPatch, MessageMode, MessagePriority, MessageQueue, QualityInvariant, QueuedMessage, RunnerToolCall, RunnerToolResult, SessionMeta, SessionStateSnapshot, StateWriter, StateWriterFs, YIELD_TOOL_NAMES, _resetAdmissionMetrics, _resetInvariantRegistry, _resetMessageQueueForTests, applyManifestPatch, bootstrapTeamMode, buildOtherInstancesPromptBlock, composeIdleYieldUserMessage, composePatches, countLastAssistantToolCalls, detectHandoffSignal, detectIdleYield, detectMissingTerminalVerdict, emitHandoffSpan, enqueueChildTaskNotification, evidenceTrail, finalOwner, getActiveTeamModeWriter, getAdmissionMetricsSnapshot, getInvariant, getMessageQueue, handoffLegality, isAdmissionDebugEnabled, isIdleYieldEnabled, listRegisteredInvariants, maybeDrainMidTurn, midTurnDrainPriority, registerCoreInvariants, registerInvariant, replaceSystemMessage, resolveEffectiveInvariants, resolveRequiredInvariants, routeMessage, runFanOut, runWithIdleYield, setActiveTeamModeWriter, updateActiveTeamMode, waitForWakeEvent };
1380
- export type { AdmissionMetricsSnapshot, EnqueueChildTaskNotificationInput, EnvelopeAggregateEnforcer, FanOutOutcome, FanOutProgressEvent, HandoffSignal, IdleYieldSnapshot, MaybeDrainMidTurnInput, RenderOptions, RouteMessageOptions, RouteMessageResult, RunFanOutOptions, RunFanOutResult, RunWithIdleYieldOptions, RunWithIdleYieldRunResult, TeamModeBootstrapOptions, TeamModeHandle, WaitForWakeEventOptions, WakeEvent };
1472
+ /**
1473
+ * FEATURE_124 (v0.7.43) Memory System Alignment: path resolver.
1474
+ *
1475
+ * Per-project isolated memory directory under
1476
+ * `<agentConfigHome>/projects/<sanitized-project-key>/memory/`. Mirrors
1477
+ * claudecode `src/memdir/paths.ts` per-project layout so the same repo
1478
+ * gets the same memory directory across worktrees / machines.
1479
+ *
1480
+ * Resolution order:
1481
+ * 1. `git config --get remote.origin.url` (when present) — stable across
1482
+ * worktrees + clones, matches claudecode's `findCanonicalGitRoot`
1483
+ * semantic without re-implementing git plumbing.
1484
+ * 2. `local-<sha256(cwd)>` fallback — for repos without a remote, or
1485
+ * when git is unavailable. Stable within a single clone path.
1486
+ *
1487
+ * Reuses `getAgentConfigPath('projects', key, 'memory')` from
1488
+ * `runtime/agent-home.ts` (v0.7.35.1 FEATURE_145) so substrate consumers
1489
+ * who override `setAgentConfigHome()` automatically get a fresh memory
1490
+ * directory tree under their override root.
1491
+ */
1492
+ /**
1493
+ * Sanitize a git remote URL to a filesystem-safe project key.
1494
+ *
1495
+ * Strips protocol / SSH user prefix, lowercases host, replaces `:`, `@`,
1496
+ * `/` with `-`, drops trailing `.git`. The result is deterministic and
1497
+ * collision-free for distinct repos (different host or path → different
1498
+ * key) and stable across clones of the same repo (same remote → same key).
1499
+ *
1500
+ * Examples:
1501
+ * `https://github.com/user/repo.git` → `github.com-user-repo`
1502
+ * `git@github.com:user/repo.git` → `github.com-user-repo`
1503
+ * `ssh://git@gitlab.example.com/team/repo` → `gitlab.example.com-team-repo`
1504
+ *
1505
+ * Note: hosts `github.com` over HTTPS and `git@github.com:` over SSH
1506
+ * intentionally produce the same key — they identify the same repo,
1507
+ * just different access protocols.
1508
+ */
1509
+ declare function sanitizeProjectKey(remoteUrl: string): string;
1510
+ /**
1511
+ * SHA-256 hash of an absolute cwd, truncated to 16 hex chars. Used as
1512
+ * the project key fallback when `git config --get remote.origin.url`
1513
+ * returns nothing.
1514
+ *
1515
+ * Path is normalized + lowercased before hashing so case-insensitive
1516
+ * filesystems (macOS default, Windows) produce the same key for
1517
+ * `/Users/X/repo` and `/users/x/repo`.
1518
+ */
1519
+ declare function hashCwd(cwd: string): string;
1520
+ /**
1521
+ * Read `git config --get remote.origin.url` from the given cwd. Returns
1522
+ * `undefined` on any failure (no git installed / not a repo / no remote
1523
+ * configured / git timed out). NEVER throws.
1524
+ *
1525
+ * 1000ms timeout — guards against pathological git hangs on broken
1526
+ * .git/config without blocking session startup.
1527
+ */
1528
+ declare function tryGitRemote(cwd: string): string | undefined;
1529
+ /**
1530
+ * Resolve the memory directory for the given cwd.
1531
+ *
1532
+ * `<agentConfigHome>/projects/<key>/memory/` where key is:
1533
+ * - sanitized git remote URL when available
1534
+ * - `local-<sha256(cwd)[:16]>` fallback otherwise
1535
+ */
1536
+ declare function resolveMemoryRoot(cwd: string): string;
1537
+ /**
1538
+ * Path of the MEMORY.md index file inside a resolved memory root.
1539
+ */
1540
+ declare function resolveMemoryEntrypoint(cwd: string): string;
1541
+ /**
1542
+ * Check whether a given absolute path is inside ANY memory directory
1543
+ * (under `<agentConfigHome>/projects/*​/memory/`). Used by the REPL
1544
+ * transcript renderer to badge memory writes / reads, and by future
1545
+ * tool-permission carve-outs.
1546
+ *
1547
+ * Returns true only for `.md` files inside a `memory/` directory whose
1548
+ * parent is the agent config home's `projects/<key>/` tree. Path
1549
+ * traversal (`..`) is normalized before the check.
1550
+ *
1551
+ * The check is path-prefix only — it does NOT verify the file exists
1552
+ * on disk. A planned write to `<memoryRoot>/feedback_X.md` returns true
1553
+ * even before the file is created.
1554
+ */
1555
+ declare function isAutoManagedMemoryFile(filePath: string): boolean;
1556
+ /**
1557
+ * Best-effort filename-based type guess for badge rendering. Mirrors the
1558
+ * 4-type taxonomy: `feedback_*.md` → `feedback`, etc. Returns `undefined`
1559
+ * for filenames that don't follow the convention — UI should fall back
1560
+ * to reading frontmatter or showing a generic `[memory]` badge.
1561
+ *
1562
+ * This is a HEURISTIC for cheap UI display. Authoritative type lives in
1563
+ * the file's YAML frontmatter (see `frontmatter.ts`).
1564
+ */
1565
+ declare function parseMemoryTypeFromFilename(filePath: string): 'user' | 'feedback' | 'project' | 'reference' | undefined;
1566
+
1567
+ /**
1568
+ * FEATURE_124 (v0.7.43) — Memory frontmatter parser.
1569
+ *
1570
+ * Minimal YAML frontmatter subset for memory files:
1571
+ *
1572
+ * ---
1573
+ * name: User role
1574
+ * description: Senior backend engineer, Go/PostgreSQL focus
1575
+ * type: user
1576
+ * ---
1577
+ *
1578
+ * <body markdown>
1579
+ *
1580
+ * Why a hand-rolled parser instead of `yaml` dep:
1581
+ * - `@kodax-ai/agent` is the substrate package; adding a runtime YAML
1582
+ * dependency would propagate to every consumer (kodax CLI, downstream
1583
+ * `@kodax-ai/data-analysis-agent`, etc.). Frontmatter has only 3
1584
+ * scalar string fields — a 40-line regex parser is the appropriate
1585
+ * scope.
1586
+ * - Degraded-tolerant: corrupt YAML / unknown type / missing
1587
+ * frontmatter MUST NOT throw — the file remains readable as
1588
+ * `{ raw: <full content>, type: undefined }`. Memory directories
1589
+ * accumulate files over months; one bad file cannot break session
1590
+ * startup.
1591
+ *
1592
+ * Contract guarantees (verified by frontmatter.test.ts):
1593
+ * - Parser NEVER throws.
1594
+ * - Unknown / mistyped `type:` → `type: undefined` (still readable).
1595
+ * - Missing frontmatter → `{ name: undefined, description: undefined,
1596
+ * type: undefined, body: <full content> }`.
1597
+ * - Body extraction strips the frontmatter block + leading newlines.
1598
+ */
1599
+ type MemoryType = 'user' | 'feedback' | 'project' | 'reference';
1600
+ interface MemoryFrontmatter {
1601
+ /** Human-readable short title. May be undefined when frontmatter is malformed or missing. */
1602
+ readonly name: string | undefined;
1603
+ /** One-line search hint. May be undefined when frontmatter is malformed or missing. */
1604
+ readonly description: string | undefined;
1605
+ /** 4-type taxonomy; undefined for unknown / missing types (degraded tolerant). */
1606
+ readonly type: MemoryType | undefined;
1607
+ }
1608
+ interface ParsedMemoryFile {
1609
+ readonly frontmatter: MemoryFrontmatter;
1610
+ /** Body content WITHOUT the frontmatter block. May be empty. */
1611
+ readonly body: string;
1612
+ }
1613
+ /**
1614
+ * Coerce a raw frontmatter value to the closed 4-type taxonomy.
1615
+ * Returns `undefined` for unknown types — degraded tolerance lets the
1616
+ * file remain in the directory without breaking the index or session
1617
+ * startup.
1618
+ */
1619
+ declare function parseMemoryType(raw: unknown): MemoryType | undefined;
1620
+ /**
1621
+ * Parse a memory file's raw text into frontmatter + body. NEVER throws.
1622
+ *
1623
+ * Behavior:
1624
+ * - No frontmatter block → all fields undefined, body = full input.
1625
+ * - Frontmatter present + parseable → fields populated where possible,
1626
+ * unknown / mistyped fields → undefined. Body = content after the
1627
+ * closing `---` line.
1628
+ * - Frontmatter block syntactically present but no parseable
1629
+ * `key: value` lines → all fields undefined, body = content after
1630
+ * closing `---`. (Garbage frontmatter is not an error.)
1631
+ */
1632
+ declare function parseMemoryFile(raw: string): ParsedMemoryFile;
1633
+ /**
1634
+ * Parse `key: value` scalar lines from a YAML block. Supports:
1635
+ * - bare strings: `name: Hello world`
1636
+ * - single-quoted strings: `name: 'Hello: world'`
1637
+ * - double-quoted strings: `name: "Hello: world"`
1638
+ *
1639
+ * Does NOT support: nested objects, sequences (lists), multiline scalars,
1640
+ * YAML anchors / aliases / tags. Lines that don't match the simple
1641
+ * scalar shape are silently skipped (degraded tolerance).
1642
+ *
1643
+ * Visibility: exported only for testing; consumers use `parseMemoryFile`.
1644
+ */
1645
+ declare function parseScalarFields(yamlBlock: string): Record<string, string>;
1646
+
1647
+ /**
1648
+ * FEATURE_124 (v0.7.43) — MEMORY.md entrypoint truncation.
1649
+ *
1650
+ * Mirrors claudecode `src/memdir/memdir.ts` `truncateEntrypointContent`
1651
+ * (caps + warning text) byte-for-byte semantically — verified by
1652
+ * truncate.test.ts text-mirror assertion against the claudecode-shape
1653
+ * warning string. Mirroring the caps + warning is intentional: it pins
1654
+ * the same context-budget invariant (≤25KB SP overhead from MEMORY.md)
1655
+ * across both agents and inherits claudecode's empirical line/byte
1656
+ * tuning without re-deriving thresholds.
1657
+ *
1658
+ * Two-stage truncation:
1659
+ * 1. If `lineCount > MAX_ENTRYPOINT_LINES`, slice the array to that
1660
+ * many lines and re-join.
1661
+ * 2. If the resulting (or original, when no line truncation) string is
1662
+ * still > MAX_ENTRYPOINT_BYTES, find the last newline at or before
1663
+ * the byte cap and slice there. Falls back to a hard byte slice if
1664
+ * no newline is found within the cap (one giant line worse-case).
1665
+ *
1666
+ * Warning is appended only when at least one cap fired. Warning text
1667
+ * mirrors claudecode line 87-97; the test asserts the literal string.
1668
+ */
1669
+ declare const MAX_ENTRYPOINT_LINES = 200;
1670
+ declare const MAX_ENTRYPOINT_BYTES = 25000;
1671
+ interface EntrypointTruncation {
1672
+ /** Truncated content with claudecode-shape WARNING line appended (if any cap fired). */
1673
+ readonly content: string;
1674
+ /** Original line count BEFORE truncation. */
1675
+ readonly lineCount: number;
1676
+ /** Original byte count BEFORE truncation. */
1677
+ readonly byteCount: number;
1678
+ readonly wasLineTruncated: boolean;
1679
+ readonly wasByteTruncated: boolean;
1680
+ }
1681
+ /**
1682
+ * Truncate MEMORY.md content to the line AND byte caps, appending a
1683
+ * claudecode-shape WARNING when truncated. Pass-through when within caps.
1684
+ *
1685
+ * Input MAY be trimmed of leading/trailing whitespace before measurement
1686
+ * (matches claudecode). Returns a `content` string ready for direct SP
1687
+ * injection.
1688
+ */
1689
+ declare function truncateEntrypointContent(raw: string): EntrypointTruncation;
1690
+
1691
+ /**
1692
+ * ../../index.js Compaction Utils
1693
+ *
1694
+ * 消息序列化工具 - 将消息转换为结构化文本格式
1695
+ */
1696
+
1697
+ /**
1698
+ * 序列化对话为文本
1699
+ *
1700
+ * 将消息转换为结构化文本格式,保留完整内容不截断
1701
+ * 参考 pi-mono 的实现:让 LLM 决定重点,不通过截断丢失信息
1702
+ *
1703
+ * 输出格式:
1704
+ * ```
1705
+ * [User]: 用户说的内容
1706
+ * [Assistant thinking]: 内部推理
1707
+ * [Assistant]: 响应文本
1708
+ * [Assistant tool calls]: read(path="foo.ts"); edit(path="bar.ts", ...)
1709
+ * [Tool result]: 工具输出
1710
+ * ```
1711
+ *
1712
+ * @param messages - 消息列表
1713
+ * @returns 序列化后的文本
1714
+ */
1715
+ declare function serializeConversation(messages: KodaXMessage[]): string;
1716
+
1717
+ /**
1718
+ * ../../index.js Compaction Summary Generator
1719
+ *
1720
+ * Generates continuation-oriented summaries for compacted conversations.
1721
+ */
1722
+
1723
+ /**
1724
+ * Default neutral compaction summary prompts (v0.7.35.1 FEATURE_142 B-R1).
1725
+ *
1726
+ * These are the *generic* defaults shipped with @kodax-ai/session-lineage.
1727
+ * They are the "candidate-a-conservative" winner from the prompt eval
1728
+ * (`tests/compaction-prompt.eval.ts`, 150 cells over 5 aliases × 10
1729
+ * fixtures × 3 candidates) — schema-stable and high-recall on both
1730
+ * coding and non-coding fixtures, with domain-neutral wording.
1731
+ *
1732
+ * The prior coding-flavored prompts (referencing "coding agent",
1733
+ * "file paths, function names", "HTTP status codes", "## Files & Changes")
1734
+ * have moved to `@kodax-ai/coding` as `CODING_SUMMARY_PROMPT` /
1735
+ * `CODING_UPDATE_SUMMARY_PROMPT`. Coding callers pass them via the
1736
+ * `summaryPrompt` / `updateSummaryPrompt` parameters of
1737
+ * `buildCompactionPromptSnapshot()` and `generateSummary()` / `compact()`
1738
+ * to preserve the v0.7.35 behavior byte-equivalent on the coding path.
1739
+ *
1740
+ * Why this split (per ADR-021): @kodax-ai/session-lineage is the generic
1741
+ * compaction primitive package. Its public surface must not assume the
1742
+ * caller is a coding agent — domain-specific prompt language belongs
1743
+ * one layer up.
1744
+ */
1745
+ declare const DEFAULT_SUMMARY_PROMPT = "Create a structured summary for the conversation below.\n\nThis summary will be handed to another agent so it can continue the same task with minimal context.\nKeep only information that is still useful for continuing the work.\n\nYou may drop:\n- completed low-value micro-steps\n- repetitive thinking\n- stale intermediate plans\n- verbose tool output details\n\nYou must keep:\n- the current goal\n- user constraints and preferences\n- current progress and unfinished work\n- blockers or unresolved questions\n- the most important next steps\n- EXACT identifiers, references, and concrete locations the agent operated on or referenced\n- EXACT error messages, status codes, and exception types\n- EXACT configuration values, parameter values, and external resource names mentioned\n- key decisions WITH reasoning (not just the choice)\n\nCRITICAL: Every user REQUEST and DECISION must be preserved verbatim or near-verbatim.\nNever reduce \"user asked to upgrade dependency X to v3.4 to resolve incompatibility with system Y\"\nto \"user asked to fix an issue\".\n\nKeep the summary concise and high-signal. Do not mechanically preserve every historical detail.\n\nFirst, wrap your analysis in <analysis> tags:\n- Walk through messages chronologically\n- Note exact identifiers, references, error codes, configuration values\n- Identify user's explicit requests vs inferred intent\n- Flag technical details that MUST survive compression\n\nThen output the structured summary in <summary> tags.\n\nOutput format (strict markdown, inside <summary> tags):\n\n## Goal\n[1-2 sentences describing the active goal]\n\n## Constraints & Preferences\n- [One item per line]\n- [Write \"None\" if there are no explicit constraints]\n\n## Progress\n### Completed\n- [x] [Completed work that still matters for context]\n\n### In Progress\n- [ ] [Current work that is actively underway]\n\n### Blockers\n- [Current blockers, or \"None\"]\n\n## Key Decisions\n- **[Decision]**: [Short reason]\n\n## Next Steps\n1. [Highest-priority next action]\n\n## Key Context\n- [Critical context needed to continue]\n\n---\n\n<read-files>\n[One reference per line \u2014 file paths, URLs, IDs, or other locations the agent read; leave empty if none]\n</read-files>\n\n<modified-files>\n[One reference per line \u2014 locations the agent modified; leave empty if none]\n</modified-files>\n\nConversation:\n";
1746
+ declare const DEFAULT_UPDATE_SUMMARY_PROMPT = "Merge the new conversation content above into <previous-summary>.\n\nUpdate the structured summary so another agent can continue the task immediately.\nKeep only the information needed to continue the work.\n\nYou may remove:\n- repetitive or superseded plans\n- completed low-value steps\n- outdated blockers\n- noisy tool output details\n\nYou must preserve or update:\n- the current goal\n- user constraints and preferences\n- current progress and unfinished work\n- blockers that still matter\n- next steps based on the latest state\n- EXACT identifiers, references, and concrete locations\n- EXACT error messages, status codes, and exception types\n- EXACT configuration values, parameter values, and external resource names\n- key decisions WITH reasoning\n\nCRITICAL: Every user REQUEST and DECISION must be preserved verbatim or near-verbatim.\n\nDo not accumulate every past detail. Compress aggressively while keeping continuation-critical context.\n\nFirst, wrap your analysis in <analysis> tags, then output the summary in <summary> tags.\n\nOutput format (strict markdown, inside <summary> tags):\n\n## Goal\n[Updated goal]\n\n## Constraints & Preferences\n- [Relevant constraints only]\n\n## Progress\n### Completed\n- [x] [Completed work that still matters]\n\n### In Progress\n- [ ] [Active work in the latest state]\n\n### Blockers\n- [Current blockers, or \"None\"]\n\n## Key Decisions\n- **[Decision]**: [Short reason]\n\n## Next Steps\n1. [Most relevant next action]\n\n## Key Context\n- [Critical context needed to continue]\n\n---\n\n<read-files>\n[One reference per line \u2014 file paths, URLs, IDs, or other locations the agent read; leave empty if none]\n</read-files>\n\n<modified-files>\n[One reference per line \u2014 locations the agent modified; leave empty if none]\n</modified-files>\n\nKeep every section concise.";
1747
+ type KodaXCompactionPromptVariant = 'initial-summary' | 'update-summary';
1748
+ interface KodaXCompactionPromptSection {
1749
+ id: string;
1750
+ title: string;
1751
+ owner: 'compaction';
1752
+ /**
1753
+ * Provenance label — opaque string identifying which feature ticket
1754
+ * authored this section, used by debug tooling and prompt-eval
1755
+ * provenance traces. v0.7.35.1 FEATURE_142: widened from coding-side
1756
+ * `'FEATURE_044' | 'FEATURE_050'` literal union per ADR-021 — the
1757
+ * session-lineage package is generic and must not enumerate coding
1758
+ * feature IDs in its public type surface.
1759
+ */
1760
+ feature: string;
1761
+ slot: 'conversation' | 'history' | 'instructions' | 'tracking';
1762
+ order: number;
1763
+ stability: 'stable' | 'dynamic' | 'specialist';
1764
+ inclusionReason: string;
1765
+ content: string;
1766
+ }
1767
+ interface KodaXCompactionPromptSnapshot {
1768
+ kind: 'specialist';
1769
+ specialist: 'compaction-summary';
1770
+ variant: KodaXCompactionPromptVariant;
1771
+ systemPrompt: string;
1772
+ userPrompt: string;
1773
+ sections: KodaXCompactionPromptSection[];
1774
+ hash: string;
1775
+ }
1776
+ declare function buildCompactionPromptSnapshot(args: {
1777
+ messages: KodaXMessage[];
1778
+ details: CompactionDetails;
1779
+ customInstructions?: string;
1780
+ systemPrompt?: string;
1781
+ previousSummary?: string;
1782
+ /**
1783
+ * Override the initial-summary instructions. When omitted, falls back
1784
+ * to {@link DEFAULT_SUMMARY_PROMPT}. Coding callers pass
1785
+ * `CODING_SUMMARY_PROMPT` (from @kodax-ai/coding) here to preserve the
1786
+ * v0.7.35 byte-equivalent prompt on the coding path.
1787
+ */
1788
+ summaryPrompt?: string;
1789
+ /**
1790
+ * Override the update-summary instructions. When omitted, falls back
1791
+ * to {@link DEFAULT_UPDATE_SUMMARY_PROMPT}. Coding callers pass
1792
+ * `CODING_UPDATE_SUMMARY_PROMPT` (from @kodax-ai/coding) here.
1793
+ */
1794
+ updateSummaryPrompt?: string;
1795
+ }): KodaXCompactionPromptSnapshot;
1796
+ declare function generateSummary(messages: KodaXMessage[], provider: KodaXBaseProvider, details: CompactionDetails, customInstructions?: string, systemPrompt?: string, previousSummary?: string, summaryPrompt?: string, updateSummaryPrompt?: string): Promise<string>;
1797
+
1798
+ /**
1799
+ * ../../index.js Compaction Core
1800
+ *
1801
+ * Progressive compaction with lightweight tool-result pruning and rolling
1802
+ * summarization to an internal low-water mark.
1803
+ */
1804
+
1805
+ /**
1806
+ * Exported as the canonical PROTECTED set so peer modules
1807
+ * (microcompaction.ts default config, registry-parity test, future
1808
+ * Stage 3 ledger work) can pull a single source-of-truth.
1809
+ */
1810
+ declare const PROTECTED_TOOL_NAMES: ReadonlySet<string>;
1811
+ /**
1812
+ * Marker prefix on the synthesized summary system message. Other packages
1813
+ * use this literal as the discriminator to tell CompactionSummary system
1814
+ * messages apart from role-prompt system messages \u2014 exported so callers
1815
+ * (notably `@kodax-ai/coding`'s `preserveTranscriptForRoundExit`) cannot
1816
+ * drift from the producer side.
1817
+ */
1818
+ declare const COMPACTION_SUMMARY_PREFIX = "[\u5BF9\u8BDD\u5386\u53F2\u6458\u8981]\n\n";
1819
+ /**
1820
+ * FEATURE_181 (v0.7.42): detect LLM "I have no content to summarize" output.
1821
+ *
1822
+ * Empty-like markers observed across 788 sessions (7.8% of compactions):
1823
+ * - "No active goal" / "no active goal"
1824
+ * - "conversation is empty" / "The conversation is empty"
1825
+ * - "no prior context"
1826
+ * - "nothing to summarize" / "no content to summarize"
1827
+ *
1828
+ * Also catches very short outputs (< 80 chars) — a meaningful goal summary
1829
+ * is empirically ≥150 chars even for simple tasks. Conservative threshold:
1830
+ * false positives only cause us to KEEP the previous summary, never lose
1831
+ * information.
1832
+ *
1833
+ * Exported for unit testing.
1834
+ */
1835
+ declare function isEmptyLikeSummary(summary: string): boolean;
1836
+ declare function needsCompaction(messages: KodaXMessage[], config: CompactionConfig, contextWindow?: number, tokenCountOverride?: number): boolean;
1837
+ declare function compact(messages: KodaXMessage[], config: CompactionConfig, provider: KodaXBaseProvider, contextWindow?: number, customInstructions?: string, systemPrompt?: string, tokenCountOverride?: number, summaryPrompt?: string, updateSummaryPrompt?: string): Promise<CompactionResult>;
1838
+
1839
+ /**
1840
+ * KodaX Microcompaction - Time-driven context cleanup
1841
+ *
1842
+ * Clears old tool result content from messages to slow context growth.
1843
+ * Pure function, no LLM calls, runs after each agent turn.
1844
+ *
1845
+ * Design:
1846
+ * - Tracks "turns" (role switches from assistant to user)
1847
+ * - Clears tool_result blocks older than maxAge turns
1848
+ * - Preserves thinking blocks (token cost is marginal; Kimi requires non-empty
1849
+ * reasoning_content on every tool-call assistant message)
1850
+ * - Preserves image blocks (replacing them invalidates Anthropic prompt-cache
1851
+ * prefixes and discards multimodal context; all reference agents — claudecode,
1852
+ * pi-mono, opencode — also preserve images at this layer. Token cost is handled
1853
+ * by the LLM compaction layer that produces a summary when budget pressure hits.)
1854
+ * - Preserves protected tools (e.g., ask_user_question)
1855
+ * - Placeholder format matches compaction pruning: `[Cleared: grep src/auth.ts "pattern"]`
1856
+ * - Immutable: returns new array, never mutates input
1857
+ */
1858
+
1859
+ interface MicrocompactionConfig {
1860
+ readonly enabled: boolean;
1861
+ readonly maxAge: number;
1862
+ readonly protectedTools: readonly string[];
1863
+ }
1864
+ /**
1865
+ * FEATURE_183 (v0.7.42): align `protectedTools` with the canonical
1866
+ * PROTECTED_TOOL_NAMES from compaction.ts so microcompact and the
1867
+ * slow-path pruneToolResults agree on which tools are off-limits. Pre-F183
1868
+ * the two sets had drifted (microcompact = `['ask_user_question']`, prune
1869
+ * = `['skill']`), meaning a tool could be cleared by one path and
1870
+ * protected by the other depending on whether maxAge or pruning ran
1871
+ * first — semantically incoherent.
1872
+ */
1873
+ declare const DEFAULT_MICROCOMPACTION_CONFIG: MicrocompactionConfig;
1874
+ /**
1875
+ * Microcompact messages by clearing old tool result content.
1876
+ * Returns a new array - does NOT mutate the input.
1877
+ *
1878
+ * Placeholder format reuses the same rich preview as compaction pruning:
1879
+ * - bash: `[Cleared: git status]`
1880
+ * - grep: `[Cleared: grep src/auth.ts "pattern"]`
1881
+ * - read: `[Cleared: read auth.ts]`
1882
+ * - edit: `[Cleared: edit auth.ts]`
1883
+ *
1884
+ * @param messages - The input messages to microcompact
1885
+ * @param config - Configuration (defaults to DEFAULT_MICROCOMPACTION_CONFIG)
1886
+ * @returns A new message array with old tool results cleared, or original if unchanged
1887
+ */
1888
+ declare function microcompact(messages: readonly KodaXMessage[], config?: MicrocompactionConfig): readonly KodaXMessage[];
1889
+
1890
+ /**
1891
+ * Post-Compact Reconstruction
1892
+ *
1893
+ * After compaction, injects artifact ledger summary and recently modified
1894
+ * file content back into the context so the agent remembers what it
1895
+ * operated on without re-reading files.
1896
+ *
1897
+ * Budget rule: total post-compact attachments are capped by the smaller of
1898
+ * (freed tokens × budgetRatio) and POST_COMPACT_TOKEN_BUDGET (absolute cap).
1899
+ * The absolute cap mirrors Claude Code's `POST_COMPACT_TOKEN_BUDGET = 50_000`
1900
+ * and prevents re-inflation when a single compaction frees a huge chunk.
1901
+ * Within the budget: ledger gets ≤15%, rest goes to file content
1902
+ * (per-file cap = min(perFileShare × total, POST_COMPACT_MAX_TOKENS_PER_FILE),
1903
+ * max 5 files).
1904
+ *
1905
+ * Idempotence: `injectPostCompactAttachments` strips any prior
1906
+ * `[Post-compact: ...]` system messages before inserting new ones, so a flat
1907
+ * messages array that survives across compaction rounds does not accumulate
1908
+ * multiple generations of post-compact attachments.
1909
+ */
1910
+
1911
+ /**
1912
+ * Absolute cap on total post-compact attachment tokens.
1913
+ * Mirrors Claude Code's POST_COMPACT_TOKEN_BUDGET (services/compact/compact.ts).
1914
+ */
1915
+ declare const POST_COMPACT_TOKEN_BUDGET = 50000;
1916
+ /**
1917
+ * Per-file hard cap on content tokens.
1918
+ * Mirrors Claude Code's POST_COMPACT_MAX_TOKENS_PER_FILE.
1919
+ */
1920
+ declare const POST_COMPACT_MAX_TOKENS_PER_FILE = 5000;
1921
+ interface PostCompactConfig {
1922
+ /** Ratio of freed tokens to use for post-compact attachments. Default 0.5. */
1923
+ readonly budgetRatio: number;
1924
+ /** Maximum files to inject. Default 5. */
1925
+ readonly maxFiles: number;
1926
+ /** Ledger share as fraction of total budget. Default 0.15. */
1927
+ readonly ledgerShare: number;
1928
+ /** Per-file share as fraction of total budget. Default 0.20. */
1929
+ readonly perFileShare: number;
1930
+ }
1931
+ declare const DEFAULT_POST_COMPACT_CONFIG: PostCompactConfig;
1932
+ interface PostCompactAttachments {
1933
+ readonly ledgerMessage: KodaXMessage | null;
1934
+ readonly fileMessages: readonly KodaXMessage[];
1935
+ readonly totalTokens: number;
1936
+ }
1937
+ /**
1938
+ * Build post-compact system messages from the artifact ledger.
1939
+ * Does NOT read files from disk — that is the caller's responsibility.
1940
+ *
1941
+ * @param ledger - The artifact ledger from compaction
1942
+ * @param freedTokens - Tokens freed by compaction (tokensBefore - tokensAfter)
1943
+ * @param config - Budget configuration
1944
+ * @returns Attachments to inject after the compacted messages
1945
+ */
1946
+ declare function buildPostCompactAttachments(ledger: readonly KodaXSessionArtifactLedgerEntry[], freedTokens: number, config?: PostCompactConfig): PostCompactAttachments;
1947
+ /**
1948
+ * Inject post-compact attachments into the compacted message array.
1949
+ *
1950
+ * Inserts after the compaction summary (first system message with the
1951
+ * summary prefix) and before the protected tail. Any existing post-compact
1952
+ * attachment messages in the input are stripped first to keep the injection
1953
+ * idempotent — without this, compaction repeated across iterations would
1954
+ * stack N generations of attachments, causing monotonic context growth.
1955
+ */
1956
+ declare function injectPostCompactAttachments(messages: KodaXMessage[], attachments: PostCompactAttachments): KodaXMessage[];
1957
+ /**
1958
+ * Read recently modified files from disk and build system messages for
1959
+ * post-compact context restoration.
1960
+ *
1961
+ * @param ledger - Artifact ledger from compaction
1962
+ * @param budgetTokens - Remaining token budget after ledger injection
1963
+ * @param config - Budget configuration
1964
+ * @returns File content messages to merge into PostCompactAttachments.fileMessages
1965
+ */
1966
+ declare function buildFileContentMessages(ledger: readonly KodaXSessionArtifactLedgerEntry[], budgetTokens: number, config?: PostCompactConfig): Promise<readonly KodaXMessage[]>;
1967
+
1968
+ /**
1969
+ * ../index.js Extension Persistence Store
1970
+ *
1971
+ * JSONL-backed key-value store scoped to a single extension identity.
1972
+ * Each store instance owns one `.jsonl` file inside the extension store
1973
+ * directory. All I/O is async and safe for single-writer use.
1974
+ *
1975
+ * File format (one JSON object per line):
1976
+ *
1977
+ * {"_type":"entry","key":"...","value":...,"version":"...","updatedAt":...}
1978
+ */
1979
+
1980
+ /**
1981
+ * JSONL-backed implementation of {@link KodaXExtensionStore}.
1982
+ *
1983
+ * All data for a single extension namespace lives in one JSONL file under
1984
+ * `~/.kodax/extension-store/<namespace>/store.jsonl`. The file is rewritten
1985
+ * atomically on every mutation (replace-then-rename).
1986
+ */
1987
+ declare class FileExtensionStore implements KodaXExtensionStore {
1988
+ private readonly filePath;
1989
+ constructor(namespaceId: string);
1990
+ get(key: string): Promise<KodaXExtensionStoreEntry | undefined>;
1991
+ put(key: string, value: KodaXJsonValue, options?: {
1992
+ expectedVersion?: string;
1993
+ }): Promise<KodaXExtensionStoreEntry | false>;
1994
+ delete(key: string): Promise<boolean>;
1995
+ list(options?: {
1996
+ prefix?: string;
1997
+ }): Promise<string[]>;
1998
+ clear(options?: {
1999
+ prefix?: string;
2000
+ }): Promise<number>;
2001
+ private readAllEntries;
2002
+ private writeAllEntries;
2003
+ }
2004
+ /**
2005
+ * Create a {@link FileExtensionStore} for the given extension namespace.
2006
+ *
2007
+ * The namespace is typically the `extensionId` (e.g. `cli:extension:/path/to/ext.mjs`).
2008
+ */
2009
+ declare function createExtensionStore(namespaceId: string): KodaXExtensionStore;
2010
+
2011
+ /**
2012
+ * Compaction trigger decision — CAP-059
2013
+ *
2014
+ * Capability inventory: docs/features/v0.7.29-capability-inventory.md#cap-059-compaction-trigger-decision
2015
+ *
2016
+ * Class 1 (substrate). Per-turn predicate read BEFORE the provider
2017
+ * stream call to decide whether the compaction lifecycle (CAP-060)
2018
+ * should run this turn. Time-ordering: AFTER microcompact (CAP-014);
2019
+ * BEFORE intelligentCompact orchestration (CAP-060).
2020
+ *
2021
+ * The wrapper preserves the historical short-circuit `compactionConfig.enabled`
2022
+ * gate from `agent.ts` even though the underlying `needsCompaction`
2023
+ * helper already returns `false` when the config is disabled. The
2024
+ * double-gate matches the pre-FEATURE_100 baseline byte-for-byte —
2025
+ * removing the redundancy is a P3.6 cleanup concern, not a P3.4
2026
+ * extraction concern.
2027
+ *
2028
+ * Migration history:
2029
+ * - extracted from `agent.ts:598-600` — pre-FEATURE_100 baseline —
2030
+ * during FEATURE_100 P3.4a.
2031
+ * - moved from `../../index.js/src/runtime-middleware/` to
2032
+ * `@kodax-ai/session-lineage/src/runtime-middleware/` in v0.7.36 to
2033
+ * break the build cycle introduced by FEATURE_142 Batch D
2034
+ * (agent → session-lineage → agent). session-lineage already
2035
+ * depends on agent, so this direction is acyclic. Semantically
2036
+ * this also reflects that compaction trigger is part of the
2037
+ * compaction lifecycle, which is session-lineage's domain.
2038
+ */
2039
+
2040
+ interface ShouldCompactInput {
2041
+ readonly messages: KodaXMessage[];
2042
+ readonly compactionConfig: CompactionConfig;
2043
+ readonly contextWindow: number;
2044
+ readonly currentTokens: number;
2045
+ }
2046
+ /**
2047
+ * Returns `true` iff the compaction lifecycle should run this turn.
2048
+ * Combines the config-enabled gate with the underlying trigger
2049
+ * threshold check from `@kodax-ai/session-lineage`'s `needsCompaction`.
2050
+ */
2051
+ declare function shouldCompact(input: ShouldCompactInput): boolean;
2052
+
2053
+ /**
2054
+ * Graceful compaction degradation — CAP-028
2055
+ *
2056
+ * Capability inventory: docs/features/v0.7.29-capability-inventory.md#cap-028-graceful-compaction-degradation
2057
+ *
2058
+ * Class 1 (substrate middleware). Truncation-based fallback that fires
2059
+ * when the primary FEATURE_072 lineage compaction fails (LLM error,
2060
+ * token overflow during summarization, etc.) so the run can continue
2061
+ * instead of hard-failing.
2062
+ *
2063
+ * Strategy: drop the oldest atomic blocks (tool_use + tool_result
2064
+ * pairs) one at a time from the front until token estimate is below
2065
+ * the target threshold (`triggerPercent * 80%` of context window).
2066
+ * Three invariants are load-bearing:
2067
+ *
2068
+ * 1. **Summary preservation** — if the very first message is a
2069
+ * `system` message OR a `user` message containing `'[对话历史摘要]'`
2070
+ * (the FEATURE_072 lineage marker), `startIdx = 1` so the
2071
+ * summary itself is never dropped.
2072
+ *
2073
+ * 2. **Tool pairing** — `tool_use` blocks (assistant) and
2074
+ * `tool_result` blocks (user) MUST stay paired. If we encounter
2075
+ * a `tool_use` without a following `tool_result` (or a
2076
+ * `tool_result` without a preceding `tool_use`), we skip past
2077
+ * it rather than orphaning its partner. This is critical because
2078
+ * providers reject unpaired tool blocks with `400` errors.
2079
+ *
2080
+ * 3. **Recent-context preservation** — the loop terminates as soon
2081
+ * as the running token estimate dips below the target, so the
2082
+ * tail of the conversation (most-recent messages) is preserved.
2083
+ *
2084
+ * The function is INTENTIONALLY destructive — it returns a NEW array
2085
+ * with the dropped messages removed. Callers do not mutate the input
2086
+ * array directly (the `messages = [...messages.slice(...)]` pattern
2087
+ * inside the loop ensures each iteration starts from a fresh copy).
2088
+ *
2089
+ * The two content-block predicates (`isTypedContentBlock`,
2090
+ * `isToolResultContentBlock`) are private helpers carried over with
2091
+ * this function — by the time this batch ran, prior batches had
2092
+ * already migrated `validateAndFixToolHistory` (the only other
2093
+ * consumer of these predicates in HEAD `agent.ts`) into
2094
+ * `agent-runtime/history-cleanup.ts` along with its own local copies
2095
+ * of the predicates (CAP-002). So at the point of extraction, the
2096
+ * predicates' only remaining `agent.ts` consumer was
2097
+ * `gracefulCompactDegradation` itself. Co-locating them here keeps
2098
+ * the module self-contained.
2099
+ *
2100
+ * (The original `agent.ts` also defined `isToolUseContentBlock` next
2101
+ * to these. In HEAD it had 2 callers inside
2102
+ * `validateAndFixToolHistory`; those callers moved with the function
2103
+ * to `history-cleanup.ts` (CAP-002) and the agent.ts copy of
2104
+ * `isToolUseContentBlock` was left without callers. It is therefore
2105
+ * intentionally NOT carried over to this module. The dispatcher's
2106
+ * tool-use checks elsewhere in `agent.ts` use the inline pattern
2107
+ * `isTypedContentBlock(b) && b.type === 'tool_use'` instead.)
2108
+ *
2109
+ * Migration history:
2110
+ * - extracted from `agent.ts:185-187` + `195-199` (the two carried
2111
+ * predicates) + `agent.ts:201-266` (`gracefulCompactDegradation`
2112
+ * with its docstring) — pre-FEATURE_100 baseline — during
2113
+ * FEATURE_100 P2.
2114
+ * - moved from `../../index.js/src/runtime-middleware/` to
2115
+ * `@kodax-ai/session-lineage/src/runtime-middleware/` in v0.7.36 to
2116
+ * break the build cycle introduced by FEATURE_142 Batch D
2117
+ * (agent → session-lineage → agent). Semantically this also
2118
+ * reflects that compaction degradation is part of the compaction
2119
+ * lifecycle, which is session-lineage's domain.
2120
+ */
2121
+
2122
+ /**
2123
+ * Graceful compact degradation: drop oldest atomic blocks (tool_use + tool_result pairs)
2124
+ * one at a time from the front until tokens are below the target threshold.
2125
+ * Preserves summary messages, message structure integrity, and recent context.
2126
+ */
2127
+ declare function gracefulCompactDegradation(messages: KodaXMessage[], contextWindow: number, config: CompactionConfig): KodaXMessage[];
2128
+
2129
+ /**
2130
+ * Effective context-window resolver — CAP-056
2131
+ *
2132
+ * Capability inventory: docs/features/v0.7.29-capability-inventory.md#cap-056-effective-context-window-resolution-cascade
2133
+ *
2134
+ * Class 1 (substrate middleware). Pure four-step cascade evaluated at
2135
+ * the start of every turn (after per-turn provider re-resolution,
2136
+ * before the compaction trigger decision). The cascade order is
2137
+ * load-bearing — earlier sources override later ones:
2138
+ *
2139
+ * 1. **`compactionConfig.contextWindow`** (user-supplied) — wins
2140
+ * unconditionally so an operator can pin a smaller window for
2141
+ * cost / latency reasons even if the provider would advertise a
2142
+ * larger one.
2143
+ * 2. **`provider.getEffectiveContextWindow?.(model)`** — model-
2144
+ * specific window when the provider exposes it (e.g.
2145
+ * `claude-3-5-sonnet-20241022` advertises 200000, while a
2146
+ * provider with multiple models returns a per-model value).
2147
+ * 3. **`provider.getContextWindow?.()`** — provider-level default
2148
+ * (used when the provider only exposes a single window).
2149
+ * 4. **`200000`** — hard fallback. Mirrors Anthropic's standard
2150
+ * Claude window; safe default for providers that don't implement
2151
+ * either capability check.
2152
+ *
2153
+ * The optional-chained calls are load-bearing — providers that don't
2154
+ * implement `getEffectiveContextWindow` / `getContextWindow` simply
2155
+ * skip to the next step in the cascade rather than throwing.
2156
+ *
2157
+ * P3 note: per inventory's stated migration target this module is
2158
+ * "shared with CAP-055" (per-turn provider re-resolution). CAP-055
2159
+ * lives inline in `runKodaX`'s for-loop today; once P3 substrate
2160
+ * adoption lands and the per-turn block lives inside the Runner
2161
+ * frame, both helpers will likely co-locate in
2162
+ * `per-turn-provider-resolution.ts`. For P2 this single-cascade
2163
+ * helper is the only piece tractable as a discrete extraction.
2164
+ *
2165
+ * Migration history:
2166
+ * - extracted from `agent.ts:1700-1703` — pre-FEATURE_100 baseline
2167
+ * — during FEATURE_100 P2.
2168
+ * - moved from `../../index.js/src/runtime-middleware/` to
2169
+ * `@kodax-ai/session-lineage/src/runtime-middleware/` in v0.7.36 to
2170
+ * break the build cycle introduced by FEATURE_142 Batch D
2171
+ * (agent → session-lineage → agent). Semantically this also
2172
+ * reflects that the resolver consumes session-lineage's
2173
+ * `CompactionConfig`, so its canonical home is alongside
2174
+ * compaction policy types.
2175
+ */
2176
+
2177
+ /** Hard fallback. Mirrors Anthropic standard Claude window. */
2178
+ declare const DEFAULT_CONTEXT_WINDOW = 200000;
2179
+ declare function resolveContextWindow(compactionConfig: CompactionConfig, provider: KodaXBaseProvider, modelOverride: string | undefined): number;
2180
+
2181
+ export { Agent, AgentManifest, AgentMessage, COMPACTION_SUMMARY_PREFIX, CORE_INVARIANTS, ChildTaskRegistry, CompactionConfig, CompactionDetails, CompactionResult, ConsoleTracingProcessor, DEFAULT_CONTEXT_WINDOW, DEFAULT_IDLE_YIELD_MAX_ITERATIONS, DEFAULT_MICROCOMPACTION_CONFIG, DEFAULT_POST_COMPACT_CONFIG, DEFAULT_SUMMARY_PROMPT, DEFAULT_UPDATE_SUMMARY_PROMPT, DequeueFilter, DiscoveredInstance, EnqueueInput, FileExtensionStore, FileTracingProcessor, Handoff, InstanceDiscoveryFs, InvariantId, KodaXExtensionStore, KodaXExtensionStoreEntry, KodaXJsonValue, KodaXMessage, KodaXSessionArtifactLedgerEntry, MAX_ENTRYPOINT_BYTES, MAX_ENTRYPOINT_LINES, ManifestPatch, MessageMode, MessagePriority, MessageQueue, POST_COMPACT_MAX_TOKENS_PER_FILE, POST_COMPACT_TOKEN_BUDGET, PROTECTED_TOOL_NAMES, QualityInvariant, QueuedMessage, RunnerToolCall, RunnerToolResult, SessionMeta, SessionStateSnapshot, Span, StateWriter, StateWriterFs, Trace, YIELD_TOOL_NAMES, _emitSpanEnd, _emitSpanStart, _emitTraceEnd, _getRegisteredProcessors, _resetAdmissionMetrics, _resetInvariantRegistry, _resetMessageQueueForTests, addTracingProcessor, applyManifestPatch, bootstrapTeamMode, buildCompactionPromptSnapshot, buildFileContentMessages, buildOtherInstancesPromptBlock, buildPostCompactAttachments, compact, composeIdleYieldUserMessage, composePatches, countLastAssistantToolCalls, createExtensionStore, detectHandoffSignal, detectIdleYield, emitHandoffSpan, enqueueChildTaskNotification, evidenceTrail, finalOwner, generateSummary, getActiveTeamModeWriter, getAdmissionMetricsSnapshot, getInvariant, getMessageQueue, gracefulCompactDegradation, handoffLegality, hashCwd, injectPostCompactAttachments, isAdmissionDebugEnabled, isAutoManagedMemoryFile, isEmptyLikeSummary, isIdleYieldEnabled, listRegisteredInvariants, maybeDrainMidTurn, microcompact, midTurnDrainPriority, needsCompaction, parseMemoryFile, parseMemoryType, parseMemoryTypeFromFilename, parseScalarFields, registerCoreInvariants, registerInvariant, replaceSystemMessage, resolveContextWindow, resolveEffectiveInvariants, resolveMemoryEntrypoint, resolveMemoryRoot, resolveRequiredInvariants, routeMessage, runFanOut, runWithIdleYield, sanitizeProjectKey, serializeConversation, setActiveTeamModeWriter, setTracingProcessors, shouldCompact, shutdownTracing, truncateEntrypointContent, tryGitRemote, updateActiveTeamMode, waitForWakeEvent };
2182
+ export type { AdmissionMetricsSnapshot, ConsoleTracingProcessorOptions, EnqueueChildTaskNotificationInput, EntrypointTruncation, EnvelopeAggregateEnforcer, FanOutOutcome, FanOutProgressEvent, FileTracingProcessorOptions, HandoffSignal, IdleYieldSnapshot, KodaXCompactionPromptSection, KodaXCompactionPromptSnapshot, KodaXCompactionPromptVariant, MaybeDrainMidTurnInput, MemoryFrontmatter, MemoryType, MicrocompactionConfig, ParsedMemoryFile, PostCompactAttachments, PostCompactConfig, RenderOptions, RouteMessageOptions, RouteMessageResult, RunFanOutOptions, RunFanOutResult, RunWithIdleYieldOptions, RunWithIdleYieldRunResult, ShouldCompactInput, TeamModeBootstrapOptions, TeamModeHandle, TracingProcessor, WaitForWakeEventOptions, WakeEvent };