@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,296 +1,24 @@
1
- import { m as KodaXMessage, X as KodaXToolDefinition, Z as KodaXToolResultContentItem, D as KodaXReasoningMode, a0 as KodaXToolUseBlock, g as KodaXContentBlock, q as KodaXProviderCapabilityProfile, C as KodaXReasoningCapability, Q as KodaXTaskType, i as KodaXExecutionMode, P as KodaXTaskRoutingDecision, K as KodaXAmaControllerDecision, V as KodaXThinkingDepth } from './types-chunks/types.d-B1uGoVTE.js';
1
+ import { X as KodaXToolDefinition, Z as KodaXToolResultContentItem, D as KodaXReasoningMode, m as KodaXMessage, a0 as KodaXToolUseBlock, g as KodaXContentBlock, q as KodaXProviderCapabilityProfile, C as KodaXReasoningCapability, Q as KodaXTaskType, i as KodaXExecutionMode, P as KodaXTaskRoutingDecision, K as KodaXAmaControllerDecision, V as KodaXThinkingDepth } from './types-chunks/types.d-B1uGoVTE.js';
2
2
  export { a as KodaXAmaFanoutClass, b as KodaXAmaFanoutPolicy, c as KodaXAmaProfile, d as KodaXAmaTactic, h as KodaXCustomProviderConfig, l as KodaXImageBlock, n as KodaXModelDescriptor, p as KodaXProtocolFamily, r as KodaXProviderConfig, t as KodaXProviderConversationSemantics, w as KodaXProviderMcpSupport, z as KodaXProviderStreamOptions, B as KodaXProviderTransport, E as KodaXReasoningOverride, F as KodaXReasoningRequest, G as KodaXRedactedThinkingBlock, H as KodaXReviewScale, I as KodaXRiskLevel, J as KodaXStreamResult, M as KodaXTaskBudgetOverrides, S as KodaXTextBlock, T as KodaXThinkingBlock, U as KodaXThinkingBudgetMap, W as KodaXTokenUsage, Y as KodaXToolResultBlock } from './types-chunks/types.d-B1uGoVTE.js';
3
- export { K as KODAX_DEFAULT_PROVIDER, b as KODAX_PROVIDERS, c as KODAX_PROVIDER_SNAPSHOTS, d as KODAX_REASONING_MODE_SEQUENCE, f as KodaXAnthropicCompatProvider, g as KodaXError, i as KodaXOpenAICompatProvider, j as KodaXProviderError, k as KodaXRateLimitError, P as ProviderName, m as buildReasoningOverrideKey, o as clearReasoningOverride, p as clearRuntimeModelProviders, q as createCustomProvider, r as getAvailableProviderNames, s as getCustomProvider, t as getCustomProviderList, u as getCustomProviderModels, v as getCustomProviderNames, x as getProvider, y as getProviderConfiguredCapabilityProfile, z as getProviderConfiguredReasoningCapability, A as getProviderList, B as getProviderModel, C as getProviderModels, E as getRuntimeModelProvider, F as getRuntimeModelProviderNames, G as isCustomProviderName, H as isKnownProvider, I as isProviderConfigured, J as isProviderName, M as isRuntimeModelProviderName, N as loadReasoningOverride, R as reasoningCapabilityToOverride, S as reasoningOverrideToCapability, T as registerCustomProviders, U as registerModelProvider, V as resolveProvider, X as saveReasoningOverride, Y as validateCustomProviderConfig } from './types-chunks/resolver.d-DX9au4NJ.js';
4
- import { K as KodaXBaseProvider, a as CostTracker } from './types-chunks/cost-tracker.d-B6vMoLLF.js';
3
+ export { K as KODAX_DEFAULT_PROVIDER, b as KODAX_PROVIDERS, c as KODAX_PROVIDER_SNAPSHOTS, d as KODAX_REASONING_MODE_SEQUENCE, f as KodaXAnthropicCompatProvider, g as KodaXError, h as KodaXModelCapabilities, j as KodaXOpenAICompatProvider, k as KodaXProviderError, l as KodaXRateLimitError, P as ProviderName, n as buildReasoningOverrideKey, p as clearReasoningOverride, q as clearRuntimeModelProviders, r as createCustomProvider, s as getAvailableProviderNames, t as getCustomModelCapabilities, u as getCustomProvider, v as getCustomProviderList, w as getCustomProviderModelDescriptors, x as getCustomProviderModels, y as getCustomProviderNames, A as getModelCapabilities, B as getProvider, C as getProviderConfiguredCapabilityProfile, D as getProviderConfiguredReasoningCapability, E as getProviderList, F as getProviderModel, G as getProviderModelDescriptors, H as getProviderModels, J as getRuntimeModelProvider, L as getRuntimeModelProviderNames, M as isCustomProviderName, N as isKnownProvider, O as isProviderConfigured, Q as isProviderName, S as isRuntimeModelProviderName, T as listAllModelCapabilities, U as listBuiltinModelCapabilities, V as listCustomProviderModelCapabilities, W as loadReasoningOverride, Z as reasoningCapabilityToOverride, _ as reasoningOverrideToCapability, $ as registerCustomProviders, a0 as registerModelProvider, a1 as resolveModelCapabilities, a2 as resolveProvider, a3 as resolveProviderModelDescriptors, a5 as saveReasoningOverride, a6 as validateCustomProviderConfig } from './types-chunks/resolver.d-CA68_NeH.js';
4
+ import { K as KodaXBaseProvider } from './types-chunks/base.d-FUJahC0i.js';
5
5
  import { C as CapabilityKind, a as CapabilityProvider, b as CapabilityResult } from './types-chunks/capability.d-3C62G8Eq.js';
6
- import { q as CompactionDetails, au as KodaXToolExecutionContext, a2 as KodaXRepoIntelligenceCapability, a5 as KodaXRepoIntelligenceTrace, a3 as KodaXRepoIntelligenceMode, a7 as KodaXRepoRoutingSignals, a4 as KodaXRepoIntelligenceResolvedMode, _ as KodaXOptions, P as KodaXInputArtifact, G as KodaXContextOptions, a1 as KodaXProviderPolicyHints, aB as ProviderResilienceConfig, aC as ProviderResiliencePolicy, F as FailureStage, aH as ResilienceClassification, az as ProviderExecutionState, aE as RecoveryDecision, aG as RecoveryResult, a8 as KodaXResult, ab as KodaXSessionControl, ac as KodaXSessionMutators, O as KodaXFanoutSchedulerPlan, M as KodaXFanoutBranchTransition, N as KodaXFanoutSchedulerInput, z as KodaXChildContextBundle, a0 as KodaXParentReductionContract, L as KodaXFanoutBranchRecord, R as KodaXManagedProtocolPayload, u as ExtensionRuntimeContract, I as KodaXEvents, k as AutoRules, aQ as ToolCallSignal, aL as SignalCollector } from './types-chunks/bash-prefix-extractor.d-CkhaqKkg.js';
7
- export { C as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD, n as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD, A as AgentsFile, a as AskUserMultiOptions, b as AskUserQuestionItem, c as AskUserQuestionOptions, d as AutoModeAskUser, e as AutoModeAskUserVerdict, D as AutoModeDenialTracker, f as AutoModeEngine, g as AutoModeGuardrailConfig, h as AutoModeSharedState, i as AutoModeStats, j as AutoModeToolGuardrail, B as BASH_POLICY_SPEC, E as BREAKER_ERROR_THRESHOLD, aS as BREAKER_WINDOW_MS, l as BashPrefixExtractor, m as BashPrefixResult, o as CircuitBreaker, p as CompactionAnchor, r as CompactionResult, s as CompactionUpdate, t as CreateBashPrefixExtractorOptions, v as ExtractCommandPrefixOptions, K as KodaXAgentMode, w as KodaXBudgetDisclosureZone, x as KodaXBudgetExtensionRequest, y as KodaXChildAgentResult, H as KodaXContextTokenSnapshot, J as KodaXFanoutBranchLifecycle, Q as KodaXManagedBudgetSnapshot, S as KodaXManagedTask, T as KodaXManagedTaskRuntimeState, U as KodaXManagedTaskStatusEvent, V as KodaXMcpConnectMode, W as KodaXMcpServerConfig, X as KodaXMcpServersConfig, Y as KodaXMcpTransport, Z as KodaXMemoryStrategy, $ as KodaXOrchestrationVerdict, a6 as KodaXRepoIntelligenceTraceEvent, a9 as KodaXRoleRoundSummary, aa as KodaXRuntimeVerificationContract, ad as KodaXSessionOptions, ae as KodaXSkillInvocationContext, af as KodaXSkillMap, ag as KodaXSkillProjectionConfidence, ah as KodaXTaskCapabilityHint, ai as KodaXTaskContract, aj as KodaXTaskEvidenceArtifact, ak as KodaXTaskEvidenceBundle, al as KodaXTaskEvidenceEntry, am as KodaXTaskRole, an as KodaXTaskRoleAssignment, ao as KodaXTaskStatus, ap as KodaXTaskSurface, aq as KodaXTaskToolPolicy, ar as KodaXTaskVerificationContract, as as KodaXTaskVerificationCriterion, at as KodaXTaskWorkItem, av as KodaXVerificationScorecard, aw as KodaXVerificationScorecardCriterion, ax as LoadAgentsOptions, ay as LoadedRulesSource, aA as ProviderRecoveryEvent, aD as RecoveryAction, aF as RecoveryLadderStep, aI as ResilienceErrorClass, aJ as RulesLoadError, aK as RulesLoadResult, aM as SkippedRulesSource, aN as TodoItem, aO as TodoList, aP as TodoStatus, aR as TrustState, b7 as autoModeDenialShouldFallback, b8 as breakerShouldFallback, aT as collectAllSignals, aU as computeRulesFingerprint, aY as createAutoModeDenialTracker, aV as createAutoModeToolGuardrail, aW as createBashPrefixExtractor, aX as createCircuitBreaker, aZ as extractCommandPrefix, a_ as formatAgentsForPrompt, a$ as getKodaxGlobalDir, b0 as loadAgentsFiles, b1 as loadAutoRules, b2 as parseAutoRules, b3 as readTrustState, b4 as recordAutoModeAllow, b5 as recordAutoModeBlock, b6 as recordBreakerError, b9 as trustProjectRules } from './types-chunks/bash-prefix-extractor.d-CkhaqKkg.js';
8
- import { N as SessionExtension, L as SessionEntry, g as CompactionPolicy, S as Session, C as CompactionContext, w as PolicyCompactionResult, Q as QualityInvariant, Z as ToolCapability } from './types-chunks/history-cleanup.d-DznrzEiU.js';
9
- export { e as CompactionEntry, f as CompactionEntryPayload, h as DefaultSummaryCompaction, i as DefaultSummaryCompactionOptions, I as InMemorySessionOptions, K as KODAX_API_MIN_INTERVAL, n as KODAX_DEFAULT_TIMEOUT, o as KODAX_HARD_TIMEOUT, p as KODAX_MAX_INCOMPLETE_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, P as PROMISE_PATTERN, x as PresetDispatcher, B as RunEvent, E as RunOptions, F as RunResult, G as Runner, T as SessionForkOptions, a2 as cleanupIncompleteToolCalls, a3 as countTokens, a4 as createInMemorySession, a7 as estimateTokens, aa as getAgentConfigHome, ab as getAgentConfigPath, ac as getAppDataDir, ad as registerPresetDispatcher, ag as setAgentConfigHome, ah as validateAndFixToolHistory } from './types-chunks/history-cleanup.d-DznrzEiU.js';
10
- import { o as KodaXSessionLineage, f as KodaXJsonValue, a as KodaXCompactMemorySeed, l as KodaXSessionEntry, v as KodaXSessionTreeNode, n as KodaXSessionLabelEntry, r as KodaXSessionNavigationOptions, h as KodaXSessionArtifactLedgerEntry, b as KodaXExtensionSessionRecord, d as KodaXExtensionStore, S as SessionErrorMetadata } from './types-chunks/types.d-mM8vqvhT.js';
11
- export { K as KodaXCompactMemoryProgress, c as KodaXExtensionSessionState, i as KodaXSessionBranchSummaryEntry, j as KodaXSessionCompactionEntry, k as KodaXSessionData, m as KodaXSessionEntryBase, p as KodaXSessionMessageEntry, q as KodaXSessionMeta, s as KodaXSessionRuntimeInfo, t as KodaXSessionScope, u as KodaXSessionStorage, w as KodaXSessionUiHistoryItem, x as KodaXSessionUiHistoryItemType, y as KodaXSessionWorkspaceKind } from './types-chunks/types.d-mM8vqvhT.js';
12
- import { o as RunnableTool, A as Agent, J as ToolGuardrail, a as AgentMessage, q as RunnerLlmReturn, r as RunnerToolCall } from './types-chunks/instance-discovery.d-BsKnIwpg.js';
13
- export { c as AgentReasoningProfile, d as AgentTool, G as Guardrail, H as Handoff, R as ReasoningDepth, Q as createAgent, U as createHandoff } from './types-chunks/instance-discovery.d-BsKnIwpg.js';
6
+ import { aq as KodaXToolExecutionContext, _ as KodaXRepoIntelligenceCapability, a1 as KodaXRepoIntelligenceTrace, $ as KodaXRepoIntelligenceMode, a3 as KodaXRepoRoutingSignals, a0 as KodaXRepoIntelligenceResolvedMode, W as KodaXOptions, L as KodaXInputArtifact, w as KodaXContextOptions, Z as KodaXProviderPolicyHints, ax as ProviderResilienceConfig, ay as ProviderResiliencePolicy, F as FailureStage, aD as ResilienceClassification, av as ProviderExecutionState, aA as RecoveryDecision, aC as RecoveryResult, a4 as KodaXResult, a7 as KodaXSessionControl, a8 as KodaXSessionMutators, J as KodaXFanoutSchedulerPlan, H as KodaXFanoutBranchTransition, I as KodaXFanoutSchedulerInput, v as KodaXChildContextBundle, Y as KodaXParentReductionContract, G as KodaXFanoutBranchRecord, N as KodaXManagedProtocolPayload, q as ExtensionRuntimeContract, y as KodaXEvents, k as AutoRules, aM as ToolCallSignal, aH as SignalCollector } from './types-chunks/bash-prefix-extractor.d-DMrGImMl.js';
7
+ export { C as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD, n as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD, A as AgentsFile, a as AskUserMultiOptions, b as AskUserQuestionItem, c as AskUserQuestionOptions, d as AutoModeAskUser, e as AutoModeAskUserVerdict, D as AutoModeDenialTracker, f as AutoModeEngine, g as AutoModeGuardrailConfig, h as AutoModeSharedState, i as AutoModeStats, j as AutoModeToolGuardrail, B as BASH_POLICY_SPEC, E as BREAKER_ERROR_THRESHOLD, aO as BREAKER_WINDOW_MS, l as BashPrefixExtractor, m as BashPrefixResult, o as CircuitBreaker, p as CreateBashPrefixExtractorOptions, r as ExtractCommandPrefixOptions, K as KodaXAgentMode, s as KodaXBudgetDisclosureZone, t as KodaXBudgetExtensionRequest, u as KodaXChildAgentResult, x as KodaXContextTokenSnapshot, z as KodaXFanoutBranchLifecycle, M as KodaXManagedBudgetSnapshot, O as KodaXManagedTask, P as KodaXManagedTaskRuntimeState, Q as KodaXManagedTaskStatusEvent, R as KodaXMcpConnectMode, S as KodaXMcpServerConfig, T as KodaXMcpServersConfig, U as KodaXMcpTransport, V as KodaXMemoryStrategy, X as KodaXOrchestrationVerdict, a2 as KodaXRepoIntelligenceTraceEvent, a5 as KodaXRoleRoundSummary, a6 as KodaXRuntimeVerificationContract, a9 as KodaXSessionOptions, aa as KodaXSkillInvocationContext, ab as KodaXSkillMap, ac as KodaXSkillProjectionConfidence, ad as KodaXTaskCapabilityHint, ae as KodaXTaskContract, af as KodaXTaskEvidenceArtifact, ag as KodaXTaskEvidenceBundle, ah as KodaXTaskEvidenceEntry, ai as KodaXTaskRole, aj as KodaXTaskRoleAssignment, ak as KodaXTaskStatus, al as KodaXTaskSurface, am as KodaXTaskToolPolicy, an as KodaXTaskVerificationContract, ao as KodaXTaskVerificationCriterion, ap as KodaXTaskWorkItem, ar as KodaXVerificationScorecard, as as KodaXVerificationScorecardCriterion, at as LoadAgentsOptions, au as LoadedRulesSource, aw as ProviderRecoveryEvent, az as RecoveryAction, aB as RecoveryLadderStep, aE as ResilienceErrorClass, aF as RulesLoadError, aG as RulesLoadResult, aI as SkippedRulesSource, aJ as TodoItem, aK as TodoList, aL as TodoStatus, aN as TrustState, b3 as autoModeDenialShouldFallback, b4 as breakerShouldFallback, aP as collectAllSignals, aQ as computeRulesFingerprint, aU as createAutoModeDenialTracker, aR as createAutoModeToolGuardrail, aS as createBashPrefixExtractor, aT as createCircuitBreaker, aV as extractCommandPrefix, aW as formatAgentsForPrompt, aX as getKodaxGlobalDir, aY as loadAgentsFiles, aZ as loadAutoRules, a_ as parseAutoRules, a$ as readTrustState, b0 as recordAutoModeAllow, b1 as recordAutoModeBlock, b2 as recordBreakerError, b5 as trustProjectRules } from './types-chunks/bash-prefix-extractor.d-DMrGImMl.js';
8
+ import { f as KodaXJsonValue, b as KodaXExtensionSessionRecord, d as KodaXExtensionStore, S as SessionErrorMetadata } from './types-chunks/types.d-mM8vqvhT.js';
9
+ export { K as KodaXCompactMemoryProgress, a as KodaXCompactMemorySeed, c as KodaXExtensionSessionState, 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 } from './types-chunks/types.d-mM8vqvhT.js';
10
+ import { Q as QualityInvariant, a6 as ToolCapability } from './types-chunks/file-tracker.d-zaLZeNBK.js';
11
+ export { C as CompactionContext, e as CompactionEntry, f as CompactionEntryPayload, g as CompactionPolicy, h as DefaultSummaryCompaction, i as DefaultSummaryCompactionOptions, I as InMemorySessionOptions, K as KODAX_API_MIN_INTERVAL, n as KODAX_DEFAULT_TIMEOUT, o as KODAX_HARD_TIMEOUT, p as KODAX_MAX_INCOMPLETE_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, P as PROMISE_PATTERN, H as PresetDispatcher, S as RunEvent, T as RunOptions, U as RunResult, V as Runner, X as Session, Z as SessionEntry, _ as SessionExtension, $ as SessionForkOptions, ae as appendSessionLineageLabel, ag as applySessionCompaction, ah as archiveOldIslands, ai as buildSessionTree, ak as cleanupIncompleteToolCalls, al as countActiveLineageMessages, am as countTokens, an as createInMemorySession, ap as createSessionLineage, at as estimateTokens, au as extractArtifactLedger, ax as extractTitleFromMessages, ay as findPreviousUserEntryId, az as forkSessionLineage, aA as generateSessionId, aC as getAgentConfigHome, aD as getAgentConfigPath, aE as getAppDataDir, aF as getSessionLineagePath, aG as getSessionMessagesFromLineage, aH as mergeArtifactLedger, aJ as registerPresetDispatcher, aK as resolveSessionLineageTarget, aL as rewindSessionLineage, aO as setAgentConfigHome, aP as setSessionLineageActiveEntry, aQ as validateAndFixToolHistory } from './types-chunks/file-tracker.d-zaLZeNBK.js';
12
+ import { z as RunnableTool, A as Agent, a4 as ToolGuardrail, a as AgentMessage, J as RunnerLlmReturn, K as RunnerToolCall } from './types-chunks/types.d-CKJtjo-6.js';
13
+ export { c as AgentReasoningProfile, e as AgentTool, f as CompactionAnchor, i as CompactionResult, k as CompactionUpdate, o as Guardrail, H as Handoff, R as ReasoningDepth, a8 as createAgent, a9 as createHandoff } from './types-chunks/types.d-CKJtjo-6.js';
14
14
  import { b as McpServersConfig } from './types-chunks/config.d-BfJUXxC0.js';
15
15
  export { M as McpConnectMode, a as McpServerConfig, c as McpTransportKind } from './types-chunks/config.d-BfJUXxC0.js';
16
- import { e as McpProviderOptions, b as McpCapabilityProvider } from './types-chunks/transport.d-DuyjG30t.js';
17
- export { M as McpCapabilityDescriptor, a as McpCapabilityKind, c as McpCapabilityRisk, d as McpCatalogItem, f as McpServerCatalogSnapshot, g as McpServerRuntime, h as McpServerRuntimeDiagnostics, i as McpTransport, j as McpTransportEvents, k as createMcpCapabilityId, l as createMcpTransport, m as defaultMcpCacheDir, n as getMcpCachePaths, p as parseMcpCapabilityId, s as searchMcpCatalog } from './types-chunks/transport.d-DuyjG30t.js';
16
+ import { f as McpProviderOptions, b as McpCapabilityProvider } from './types-chunks/manager.d-87belpiS.js';
17
+ export { M as McpCapabilityDescriptor, a as McpCapabilityKind, c as McpCapabilityRisk, d as McpCatalogItem, e as McpManager, 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';
18
+ import { a as CostTracker } from './types-chunks/cost-tracker.d-wRtyEW9d.js';
18
19
  import '@anthropic-ai/sdk';
19
20
  import 'openai';
20
21
 
21
- /**
22
- * LineageExtension — SessionExtension façade over lineage semantics.
23
- *
24
- * FEATURE_081 (v0.7.23): expresses today's `KodaXSessionLineage` operations
25
- * (label, rewind, compaction ledger, branch summary) as a
26
- * `SessionExtension` over the base `Session` primitive.
27
- *
28
- * FEATURE_082 (v0.7.24): moved from `@kodax-ai/coding/src/extensions/lineage.ts`
29
- * to this package. Depends on `@kodax-ai/agent` for `Session` / `SessionEntry` /
30
- * `SessionExtension` (Layer A primitives — extracted to `@kodax-ai/core` in
31
- * FEATURE_082, merged back into `@kodax-ai/agent` in v0.7.35.1 FEATURE_142).
32
- * `@kodax-ai/coding` keeps a barrel re-export.
33
- *
34
- * Scope:
35
- * - Declare the extension object.
36
- * - Implement `label` and `attachArtifact` operators that append standard
37
- * entries to a Session.
38
- * - Implement a `buildLineageTree` reducer that projects an entry stream
39
- * back to a navigable tree.
40
- * - NOT re-implemented here: `branch`, `rewind`, full compaction. Those
41
- * stay in `@kodax-ai/agent/session-lineage.ts` for coding-preset use; the
42
- * `LineageCompaction` policy in this package is the thin wrapper that
43
- * adapts them to the Layer A `CompactionPolicy` contract.
44
- */
45
-
46
- /**
47
- * Entry types claimed by `LineageExtension`. Mirrors the legacy
48
- * `KodaXSessionEntry` tagged union plus a `rewind_marker` placeholder (the
49
- * legacy lineage records rewinds via `activeEntryId` mutation; Session is
50
- * linear, so a marker entry is the equivalent).
51
- */
52
- declare const LINEAGE_ENTRY_TYPES: readonly ["message", "label", "compaction", "branch_summary", "archive_marker", "rewind_marker", "artifact_ledger"];
53
- type LineageEntryType = (typeof LINEAGE_ENTRY_TYPES)[number];
54
- /**
55
- * Payload shape for a `label` entry. Mirrors
56
- * `KodaXSessionLabelEntry.targetId`/`label` fields on the legacy lineage.
57
- */
58
- interface LineageLabelPayload {
59
- readonly targetId: string;
60
- readonly label?: string;
61
- }
62
- /**
63
- * Payload shape for an `artifact_ledger` entry. Mirrors a minimal subset of
64
- * `KodaXSessionArtifactLedgerEntry`; full semantic fidelity is kept on the
65
- * legacy side for now and normalised in FEATURE_082.
66
- */
67
- interface LineageArtifactLedgerPayload {
68
- readonly ref: string;
69
- readonly kind?: string;
70
- readonly summary?: string;
71
- }
72
- /**
73
- * Projected tree node. Mirrors the navigation shape of
74
- * `KodaXSessionTreeNode` from `@kodax-ai/agent/types.ts`, restricted to the
75
- * fields the base Session can supply.
76
- */
77
- interface LineageTreeNode {
78
- readonly entry: SessionEntry;
79
- readonly children: LineageTreeNode[];
80
- readonly label?: string;
81
- }
82
- /**
83
- * The exported extension. Operators write standard-shaped entries; the
84
- * reducer projects an entry stream back to a navigable tree.
85
- *
86
- * Immutability: top-level object, `operators`, and `reducers` are all
87
- * frozen. Freezes are shallow — the functions stored inside `operators`
88
- * and `reducers` are immutable by nature (closures reference only
89
- * module-private state). External code must not mutate the extension;
90
- * doing so is a programmer error that the type-level `readonly` already
91
- * disallows without a cast.
92
- */
93
- declare const LineageExtension: SessionExtension;
94
-
95
- /**
96
- * LineageCompaction — `CompactionPolicy` adapter for the coding preset's
97
- * FEATURE_072 lineage-native compaction runtime.
98
- *
99
- * FEATURE_082 (v0.7.24): introduced alongside the lineage extraction so the
100
- * coding preset can implement `CompactionPolicy` without re-implementing the
101
- * compaction loop. The actual compaction runtime (microcompaction, post-
102
- * compact reconstruction, summary generation) stays in
103
- * `@kodax-ai/agent/src/compaction/` until FEATURE_084 (v0.7.26) consolidates it.
104
- *
105
- * Usage (inside @kodax-ai/coding):
106
- *
107
- * const policy = new LineageCompaction({
108
- * shouldCompact: (session, used, budget) => runFeature072Heuristic(used, budget),
109
- * compact: async (session, ctx) => runFeature072Compaction(session, ctx),
110
- * });
111
- *
112
- * The injected delegates keep this package free of coding-specific imports,
113
- * preserving the dependency direction
114
- * `@kodax-ai/coding -> @kodax-ai/session-lineage -> @kodax-ai/agent`.
115
- */
116
-
117
- /**
118
- * Delegates required to implement `LineageCompaction`. The coding preset
119
- * supplies implementations that bridge to the existing FEATURE_072 code
120
- * paths.
121
- */
122
- interface LineageCompactionDelegates {
123
- readonly shouldCompact: (session: Session, tokensUsed: number, budget: number) => boolean;
124
- readonly compact: (session: Session, ctx: CompactionContext) => Promise<PolicyCompactionResult>;
125
- readonly restore?: (session: Session, hint: unknown) => Promise<void>;
126
- }
127
- /**
128
- * `CompactionPolicy` implementation that preserves FEATURE_072 lineage-native
129
- * compaction semantics by delegating to injected coding-preset functions.
130
- */
131
- declare class LineageCompaction implements CompactionPolicy {
132
- readonly name = "lineage-compaction";
133
- private readonly delegates;
134
- constructor(delegates: LineageCompactionDelegates);
135
- shouldCompact(session: Session, tokensUsed: number, budget: number): boolean;
136
- compact(session: Session, ctx: CompactionContext): Promise<PolicyCompactionResult>;
137
- restore(session: Session, hint: unknown): Promise<void>;
138
- }
139
-
140
- /**
141
- * @kodax-ai/agent Session
142
- *
143
- * 会话管理 - Session ID 生成和消息处理
144
- */
145
-
146
- /**
147
- * 生成会话 ID
148
- * 格式: YYYYMMDD_HHMMSS
149
- */
150
- declare function generateSessionId(): Promise<string>;
151
- /**
152
- * 从消息中提取标题
153
- * 取第一条用户消息的前50个字符
154
- */
155
- declare function extractTitleFromMessages(messages: KodaXMessage[]): string;
156
-
157
- type NavigableSessionEntry = Exclude<KodaXSessionEntry, KodaXSessionLabelEntry>;
158
- /**
159
- * Reconcile a linear message list against an existing lineage tree.
160
- *
161
- * Existing matching entries are reused when possible, and only the missing
162
- * tail is appended as new message entries.
163
- */
164
- declare function createSessionLineage(messages: KodaXMessage[], previous?: KodaXSessionLineage): KodaXSessionLineage;
165
- /**
166
- * Walk the lineage from a target entry back to the root.
167
- *
168
- * Traversal stops safely if malformed data introduces a parent cycle.
169
- */
170
- declare function getSessionLineagePath(lineage: KodaXSessionLineage, targetId?: string | null): NavigableSessionEntry[];
171
- /**
172
- * Build the effective LLM-visible message context for the active lineage path.
173
- *
174
- * FEATURE_072: for non-rewind compaction entries that carry
175
- * `postCompactAttachments`, the slicer inlines attachments immediately after
176
- * the summary. `getContextMessagesForEntry` stays 1-to-1 — attachments are a
177
- * slicer-layer concern, which preserves the contract
178
- * `entryMatchesContextMessage` and FEATURE_073's future firstKeptEntryId-based
179
- * slicing both depend on.
180
- */
181
- declare function getSessionMessagesFromLineage(lineage: KodaXSessionLineage, targetId?: string | null): KodaXMessage[];
182
- /**
183
- * Resolve an entry selector using either a direct entry id or the latest label.
184
- */
185
- declare function resolveSessionLineageTarget(lineage: KodaXSessionLineage, selector: string): NavigableSessionEntry | undefined;
186
- /**
187
- * Move the active leaf to a selected target, optionally appending a
188
- * branch-summary node that captures the abandoned path.
189
- */
190
- declare function setSessionLineageActiveEntry(lineage: KodaXSessionLineage, selector: string, options?: KodaXSessionNavigationOptions): KodaXSessionLineage | null;
191
- /**
192
- * Append a label change entry that bookmarks a lineage node.
193
- */
194
- declare function appendSessionLineageLabel(lineage: KodaXSessionLineage, selector: string, label?: string): KodaXSessionLineage | null;
195
- /**
196
- * Apply a compaction event to the lineage.
197
- *
198
- * FEATURE_072 signature change: `keptMessages` (the post-summary tail that
199
- * will become lineage entries) and `postCompactAttachments` (ledger +
200
- * file-content messages that live on the CompactionEntry itself) are now
201
- * separate parameters. The kept tail MUST NOT include attachments — otherwise
202
- * they would be double-stored (once as message entries in lineage, once on
203
- * the compaction entry). Phase A keeps `postCompactAttachments` optional so
204
- * current callers that pass `[]` (or omit it) behave identically to today.
205
- * Phase B migrates callers to supply real attachments.
206
- */
207
- declare function applySessionCompaction(lineage: KodaXSessionLineage | undefined, compactedMessages: KodaXMessage[], anchor: {
208
- summary: string;
209
- tokensBefore?: number;
210
- tokensAfter?: number;
211
- artifactLedgerId?: string;
212
- reason?: string;
213
- details?: KodaXJsonValue | CompactionDetails;
214
- memorySeed?: KodaXCompactMemorySeed;
215
- }, postCompactAttachments?: readonly KodaXMessage[]): KodaXSessionLineage;
216
- /**
217
- * Rewind the current session lineage to a target entry, truncating all entries after it.
218
- * Records a rewind event in the lineage for auditability.
219
- * Returns null if targetEntryId is not found.
220
- *
221
- * @param lineage - The session lineage to rewind
222
- * @param targetEntryId - The entry ID to rewind to (inclusive)
223
- * @returns A new lineage with entries truncated after the target, or null if target not found
224
- */
225
- /**
226
- * Find the entry ID of the second-to-last user message in the lineage.
227
- * Used by `/rewind` (no argument) to go back one conversational turn.
228
- * Returns null if fewer than 2 user messages exist.
229
- */
230
- declare function findPreviousUserEntryId(lineage: KodaXSessionLineage): string | null;
231
- declare function rewindSessionLineage(lineage: KodaXSessionLineage, targetEntryId: string): KodaXSessionLineage | null;
232
- declare function forkSessionLineage(lineage: KodaXSessionLineage, selector?: string): KodaXSessionLineage | null;
233
- /**
234
- * Convert a lineage into a nested tree structure for UI presentation.
235
- */
236
- declare function buildSessionTree(lineage: KodaXSessionLineage): KodaXSessionTreeNode[];
237
- /**
238
- * Count the effective context messages on the active lineage path.
239
- */
240
- declare function countActiveLineageMessages(lineage: KodaXSessionLineage): number;
241
- /**
242
- * Archive message entries from old "islands" (disconnected subtrees).
243
- *
244
- * Each compaction entry has parentId: null, creating an independent island.
245
- * The active leaf lives in one island (the "current" island). All other
246
- * islands are considered "old" and eligible for archival.
247
- *
248
- * A "preserve closure" is computed first:
249
- * - All entries in the current island (active path + recent branches)
250
- * - Label targets and their ancestor chains
251
- * - Non-message entries and their ancestor chains (prevents tree drift)
252
- *
253
- * Only entries outside the preserve closure are archived.
254
- */
255
- declare function archiveOldIslands(lineage: KodaXSessionLineage): {
256
- slimmedLineage: KodaXSessionLineage;
257
- archivedEntries: KodaXSessionEntry[];
258
- archivedCount: number;
259
- archiveBatchId: string;
260
- };
261
-
262
- /**
263
- * @kodax-ai/agent File Tracking — artifactLedger extraction.
264
- *
265
- * FEATURE_185 (v0.7.42) extends the previous input-only extractor to also
266
- * read each tool_use's matching tool_result, enriching `metadata` with parsed
267
- * hits / matchedPaths / exitCode / tail. Pipeline:
268
- *
269
- * Round end (REPL: repl.ts:1279/1371)
270
- * → extractArtifactLedger(result.messages)
271
- * → tool_result still raw (top-of-loop microcompact hasn't run on these)
272
- * → buildArtifactEntry parses result content into metadata
273
- * → mergeArtifactLedger commits enrichment to context.artifactLedger
274
- * → storage.save persists the enriched ledger
275
- *
276
- * Top-of-loop microcompact (run-substrate.ts:621, iteration N+1)
277
- * → clears tool_result.content older than maxAge to `[Cleared: ...]`
278
- *
279
- * Compaction time (compaction.ts:257)
280
- * → extractArtifactLedger(toProcess) re-runs on cleared messages
281
- * → buildArtifactEntry's parsers refuse `[Cleared: ...]` → no fresh hits
282
- * → mergeArtifactLedger preserves the round-end enrichment via
283
- * per-key non-empty preference (see `mergeLedgerMetadata`).
284
- *
285
- * The metadata-aware merge is the keystone — without it, every compaction
286
- * would silently downgrade ledger entries to input-only. End-to-end
287
- * preservation is exercised by the "end-to-end enrichment survives
288
- * microcompact" tests in file-tracker.test.ts.
289
- */
290
-
291
- declare function extractArtifactLedger(messages: KodaXMessage[]): KodaXSessionArtifactLedgerEntry[];
292
- declare function mergeArtifactLedger(existing: KodaXSessionArtifactLedgerEntry[], next: KodaXSessionArtifactLedgerEntry[]): KodaXSessionArtifactLedgerEntry[];
293
-
294
22
  /**
295
23
  * KodaX Core Errors
296
24
  *
@@ -468,6 +196,33 @@ interface LocalToolDefinition extends KodaXToolDefinition {
468
196
  * {@link ToolInterruptBehavior}. Default `'wait'` when undefined.
469
197
  */
470
198
  interruptBehavior?: ToolInterruptBehavior;
199
+ /**
200
+ * Progressive disclosure — when `true`, the tool's full description is
201
+ * replaced with `searchHint` (a one-line summary) in the LLM-visible
202
+ * tool schema until the per-session unlock Set marks the tool name as
203
+ * unlocked. Unlocking happens via the `tool_search` tool: the LLM
204
+ * invokes `tool_search` with a query that selects this tool, and the
205
+ * full description + JSON schema are returned in the tool_result text.
206
+ * The next `getActiveToolDefinitions` call for the same session sees
207
+ * the unlock and emits the full description.
208
+ *
209
+ * Use for tools with rich descriptions (>500 bytes) whose teaching
210
+ * content the model only needs to consume when it actually plans to
211
+ * call the tool. Saves turn-1 context without dropping the tool.
212
+ *
213
+ * Mirrors claudecode `Tool.shouldDefer` — see
214
+ * `c:/Works/claudecode/src/tools/Tool.ts` for the parent design and
215
+ * `c:/Works/claudecode/src/tools/ToolSearchTool/` for the bootstrap.
216
+ */
217
+ shouldDefer?: boolean;
218
+ /**
219
+ * One-line hint shown in place of the full description when this tool
220
+ * is deferred and not yet unlocked. Required when `shouldDefer: true`.
221
+ * Should answer "when would I want to look this up" in ≤ 100 chars
222
+ * so the LLM can decide whether to invoke `tool_search` for the full
223
+ * schema. Example: `'Fetch a specific remote URL — use tool_search to load full schema.'`
224
+ */
225
+ searchHint?: string;
471
226
  /**
472
227
  * Classifier projection — REQUIRED (FEATURE_092 v0.7.33).
473
228
  *
@@ -674,34 +429,319 @@ declare function toolUndo(_input: Record<string, unknown>, ctx: KodaXToolExecuti
674
429
  */
675
430
 
676
431
  /**
677
- * Ask user a question with multiple interaction modes.
678
- *
679
- * This tool requires context.askUser (select) or context.askUserInput (input)
680
- * callback to be provided by the REPL layer.
432
+ * Ask user a question with multiple interaction modes.
433
+ *
434
+ * This tool requires context.askUser (select) or context.askUserInput (input)
435
+ * callback to be provided by the REPL layer.
436
+ */
437
+ declare function toolAskUserQuestion(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
438
+
439
+ declare function toolRepoOverview(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
440
+
441
+ declare function toolChangedScope(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
442
+
443
+ declare function toolChangedDiff(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
444
+
445
+ declare function toolModuleContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
446
+
447
+ declare function toolSymbolContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
448
+
449
+ declare function toolProcessContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
450
+
451
+ declare function toolImpactEstimate(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
452
+
453
+ declare function toolWebSearch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
454
+
455
+ declare function toolWebFetch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
456
+
457
+ declare function toolCodeSearch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
458
+
459
+ declare function toolSemanticLookup(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
460
+
461
+ /**
462
+ * KodaX Constructed-World types (FEATURE_087, v0.7.28).
463
+ *
464
+ * Runtime-generated capabilities (tools / agents / skills / ...) live in
465
+ * `.kodax/constructed/` and are loaded into the same registries as builtin
466
+ * primitives. v0.7.28 only ships tool generation (FEATURE_088); other kinds
467
+ * land in FEATURE_089 / FEATURE_090.
468
+ *
469
+ * Cross-references:
470
+ * - DD §14 — lifecycle, security model, registry merge semantics.
471
+ * - docs/features/v0.7.28.md — capability schema, generation flow.
472
+ */
473
+ /**
474
+ * Handler script source. v0.7.28 limits language to `'javascript'` so that
475
+ * `loadHandler()` can `await import()` the file directly without an
476
+ * intermediate TS → JS compile step (no esbuild / tsx dependency).
477
+ *
478
+ * TypeScript handlers are explicitly out of scope; Coding Agent generates
479
+ * JS strings on the wire.
480
+ */
481
+ interface ScriptSource {
482
+ readonly kind: 'script';
483
+ readonly language: 'javascript';
484
+ readonly code: string;
485
+ }
486
+ /**
487
+ * Capability declaration.
488
+ *
489
+ * v0.7.28 ships the single-dimension form: a whitelist of builtin tool
490
+ * names that the handler may invoke through `ctx.tools.<name>(...)`.
491
+ * All I/O — fs / net / env — must flow through builtin tools (`read` /
492
+ * `write` / `bash` / etc.); handlers do not receive direct `ctx.fs` /
493
+ * `ctx.net` / `ctx.env` entry points.
494
+ *
495
+ * Forward-compatible evolution: if the future demands path/domain-level
496
+ * constraints, this can grow to `(string | { name; constraints })[]`
497
+ * without breaking existing manifests.
498
+ */
499
+ interface Capabilities {
500
+ readonly tools: readonly string[];
501
+ }
502
+ /**
503
+ * Tool-kind artifact body (the `content` of `ConstructionArtifact` when
504
+ * `kind === 'tool'`).
505
+ */
506
+ interface ToolContent {
507
+ readonly description: string;
508
+ readonly inputSchema: Record<string, unknown>;
509
+ readonly capabilities: Capabilities;
510
+ readonly handler: ScriptSource;
511
+ /**
512
+ * Per-tool timeout override. Defaults to {@link DEFAULT_HANDLER_TIMEOUT_MS}
513
+ * when omitted. Bounded by AbortController in `loadHandler()`.
514
+ */
515
+ readonly timeoutMs?: number;
516
+ }
517
+ /**
518
+ * Default handler timeout. Picked to match the historical ceiling on
519
+ * builtin streaming tools (30s); revisit if a constructed tool demands
520
+ * longer-running computation.
521
+ */
522
+ declare const DEFAULT_HANDLER_TIMEOUT_MS = 30000;
523
+ /**
524
+ * Lifecycle state on disk. Drives both the startup glob filter and the
525
+ * `revoke()` semantics. See DD §14.1 — file system is the single source
526
+ * of truth; no separate `_manifest.json` index file (C4 decision).
527
+ */
528
+ type ArtifactStatus = 'staged' | 'active' | 'revoked';
529
+ /**
530
+ * Reference to a tool by stable id. v0.7.31 (FEATURE_089) introduces
531
+ * Agent manifests that bundle tool refs rather than inline tool bodies;
532
+ * the resolver expands these refs to concrete `KodaXToolDefinition`
533
+ * instances at activate time.
534
+ *
535
+ * `ref` shape:
536
+ * - `builtin:<name>` — a tool from the static registry
537
+ * (e.g. `builtin:read`, `builtin:bash`)
538
+ * - `constructed:<name>@<ver>` — a previously-activated constructed tool
539
+ */
540
+ interface ToolRef {
541
+ readonly ref: string;
542
+ }
543
+ /**
544
+ * Reference to a Guardrail by stable id. The Layer A `Guardrail`
545
+ * declaration is name-only (no runtime hooks); resolvers map known
546
+ * names to constructed `ToolGuardrail` / `InputGuardrail` /
547
+ * `OutputGuardrail` instances at activation time.
548
+ */
549
+ interface GuardrailRef {
550
+ readonly kind: 'input' | 'output' | 'tool';
551
+ readonly ref: string;
552
+ }
553
+ /**
554
+ * Reference to a handoff target by stable id (another constructed agent
555
+ * or a builtin role). The resolver expands `target.ref` to the actual
556
+ * `Agent` declaration at admission time so the handoff DAG check
557
+ * (`handoffLegality` invariant) sees the full graph.
558
+ */
559
+ interface AgentHandoffRef {
560
+ readonly target: {
561
+ readonly ref: string;
562
+ };
563
+ readonly kind: 'continuation' | 'as-tool';
564
+ readonly description?: string;
565
+ }
566
+ /**
567
+ * Reasoning profile declaration mirroring the Layer A
568
+ * `AgentReasoningProfile`. Kept structurally identical so the resolver
569
+ * passes the value through without re-shaping.
570
+ */
571
+ interface AgentReasoningRef {
572
+ readonly default: 'quick' | 'balanced' | 'deep';
573
+ readonly max?: 'quick' | 'balanced' | 'deep';
574
+ readonly escalateOnRevise?: boolean;
575
+ }
576
+ /**
577
+ * Sandbox test case. Used by `sandbox_test_agent` to verify a
578
+ * constructed agent before it can activate. Each case feeds `input`
579
+ * to a sandbox Runner instance and grades the agent's final output:
580
+ *
581
+ * - `expectMatch` — final text must match this regex (string form)
582
+ * - `expectNotMatch` — final text must NOT match this regex
583
+ * - `expectFinalText` — exact substring match (case-sensitive)
584
+ *
585
+ * At least one of the three expect-fields must be present; the cases
586
+ * are graded by `runSandboxAgentTest()` (FEATURE_089 Phase 3.5).
587
+ */
588
+ interface AgentTestCase {
589
+ readonly id: string;
590
+ readonly input: string;
591
+ readonly expectMatch?: string;
592
+ readonly expectNotMatch?: string;
593
+ readonly expectFinalText?: string;
594
+ }
595
+ /**
596
+ * Agent-kind artifact body (the `content` of `ConstructionArtifact`
597
+ * when `kind === 'agent'`).
598
+ *
599
+ * FEATURE_089 (v0.7.31): all fields except `instructions` are optional;
600
+ * a minimal "echo agent" can be expressed as `{ instructions: '...' }`.
601
+ * Tool / handoff / guardrail refs are resolved at admission time
602
+ * (Runner.admit's 5-step audit expands them and feeds the resolved
603
+ * Agent through the invariant chain).
604
+ */
605
+ interface AgentContent {
606
+ readonly instructions: string;
607
+ readonly tools?: readonly ToolRef[];
608
+ readonly handoffs?: readonly AgentHandoffRef[];
609
+ readonly reasoning?: AgentReasoningRef;
610
+ readonly guardrails?: readonly GuardrailRef[];
611
+ readonly model?: string;
612
+ readonly provider?: string;
613
+ /**
614
+ * FEATURE_191 — one-sentence human-readable summary surfaced in the
615
+ * Worker system prompt's `=== Available specialist agents ===`
616
+ * block (FEATURE_191 A.3) and in `/agents list` UIs. Frontmatter
617
+ * `description` field of `~/.kodax/agents/<name>.md` and the
618
+ * `name`-paired argument of `KodaXExtensionAPI.registerAgent`
619
+ * funnel into this field. Optional for backward compatibility with
620
+ * FEATURE_089 minimal-agent shape (`{ instructions: '...' }`);
621
+ * the SP block renders `(no description)` when absent.
622
+ */
623
+ readonly description?: string;
624
+ /**
625
+ * Optional structured-output schema mirroring `Agent.outputSchema`.
626
+ * Pure pass-through to the runtime — admission does not validate
627
+ * shape semantics here, only well-formed JSON.
628
+ */
629
+ readonly outputSchema?: Record<string, unknown>;
630
+ /**
631
+ * Optional sandbox test cases. When present, `sandbox_test_agent`
632
+ * runs them; when absent, the test step performs only the static
633
+ * checks (manifest schema + admission audit).
634
+ */
635
+ readonly testCases?: readonly AgentTestCase[];
636
+ /**
637
+ * Maximum total budget (iteration count) the agent may consume.
638
+ * Plumbed onto the resolved `AgentManifest.maxBudget` and clamped by
639
+ * `budgetCeiling` invariant during admission.
640
+ */
641
+ readonly maxBudget?: number;
642
+ /**
643
+ * Voluntary additional invariants the LLM declares this agent
644
+ * commits to. Plumbed onto `AgentManifest.declaredInvariants`;
645
+ * unioned on top of the required set during admission.
646
+ */
647
+ readonly declaredInvariants?: readonly string[];
648
+ }
649
+ /**
650
+ * Persisted artifact shape (one JSON file per name/version under
651
+ * `.kodax/constructed/<kind>s/<name>/<version>.json`).
652
+ *
653
+ * Discriminated union over `kind`:
654
+ * - `kind: 'tool'` — v0.7.28 (FEATURE_088) tool generation
655
+ * - `kind: 'agent'` — v0.7.31 (FEATURE_089) agent generation; passes
656
+ * through `Runner.admit()` at activation time
657
+ *
658
+ * Lifecycle fields (status / timestamps / contentHash / sourceAgent /
659
+ * signedBy) are common to all kinds.
660
+ */
661
+ type ConstructionArtifact = ToolArtifact | AgentArtifact;
662
+ interface ConstructionArtifactBase {
663
+ readonly name: string;
664
+ readonly version: string;
665
+ status: ArtifactStatus;
666
+ readonly signedBy?: string;
667
+ readonly createdAt: number;
668
+ readonly sourceAgent?: string;
669
+ testedAt?: number;
670
+ activatedAt?: number;
671
+ revokedAt?: number;
672
+ /**
673
+ * SHA-256 of `JSON.stringify(content)` captured at activate time.
674
+ * `rehydrateActiveArtifacts()` recomputes and compares — a mismatch
675
+ * indicates the manifest was edited between activation and the next
676
+ * boot (naive cross-session tampering, e.g. an LLM rewriting the .json
677
+ * via the Write tool without recomputing the hash). Mismatched
678
+ * artifacts are skipped at rehydrate with a stderr warning. This is
679
+ * NOT a defense against a coordinated attacker who recomputes the
680
+ * hash; the threat model is single-user CLI integrity, not multi-user
681
+ * supply chain.
682
+ */
683
+ contentHash?: string;
684
+ }
685
+ interface ToolArtifact extends ConstructionArtifactBase {
686
+ readonly kind: 'tool';
687
+ readonly content: ToolContent;
688
+ }
689
+ interface AgentArtifact extends ConstructionArtifactBase {
690
+ readonly kind: 'agent';
691
+ readonly content: AgentContent;
692
+ }
693
+ /**
694
+ * Returned by {@link ConstructionRuntime.stage}; opaque handle that
695
+ * downstream `test()` / `activate()` calls bind to.
696
+ */
697
+ interface StagedHandle {
698
+ readonly artifact: ConstructionArtifact;
699
+ readonly stagedAt: number;
700
+ }
701
+ /**
702
+ * Outcome of {@link ConstructionRuntime.test}. `ok=false` blocks
703
+ * activation; `warnings` surface but do not block.
704
+ */
705
+ interface TestResult {
706
+ readonly ok: boolean;
707
+ readonly errors?: readonly string[];
708
+ readonly warnings?: readonly string[];
709
+ }
710
+ /**
711
+ * Policy gate — invoked once per `activate()` before the artifact is
712
+ * registered. Default rejects implicit auto-approval; the REPL surface
713
+ * binds a dialog-based policy in `packages/repl/src/common/construction-
714
+ * bootstrap.ts` so user approval flows through the live askUser channel.
715
+ *
716
+ * Modeled as a function type rather than an interface (D3 decision):
717
+ * keeps the contract surface tiny, no class boilerplate.
718
+ *
719
+ * No declarative `kodax.config.ts` override hatch is provided — see the
720
+ * "Deferred Design Decisions" section in `features/v0.7.28.md` for why
721
+ * a `risk_mode` enum (when truly needed) is preferred over user-authored
722
+ * policy functions.
723
+ */
724
+ type ConstructionPolicy = (artifact: ConstructionArtifact) => Promise<ConstructionPolicyVerdict>;
725
+ type ConstructionPolicyVerdict = 'approve' | 'reject' | 'ask-user';
726
+ /** Default policy: always ask the user; no implicit approvals. */
727
+ declare const defaultPolicy: ConstructionPolicy;
728
+ /**
729
+ * Thrown by `CtxProxy` when handler attempts to access a tool not declared
730
+ * in `capabilities.tools`. Caught in tracer; surfaces as a tool error.
731
+ */
732
+ declare class CapabilityDeniedError extends Error {
733
+ readonly toolName: string;
734
+ readonly declaredTools: readonly string[];
735
+ constructor(toolName: string, declaredTools: readonly string[]);
736
+ }
737
+ /**
738
+ * Thrown when a manifest cannot be parsed / is missing required fields.
739
+ * Surfaces during stage() / startup glob; tracer records details.
681
740
  */
682
- declare function toolAskUserQuestion(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
683
-
684
- declare function toolRepoOverview(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
685
-
686
- declare function toolChangedScope(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
687
-
688
- declare function toolChangedDiff(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
689
-
690
- declare function toolModuleContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
691
-
692
- declare function toolSymbolContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
693
-
694
- declare function toolProcessContext(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
695
-
696
- declare function toolImpactEstimate(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
697
-
698
- declare function toolWebSearch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
699
-
700
- declare function toolWebFetch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
701
-
702
- declare function toolCodeSearch(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
703
-
704
- declare function toolSemanticLookup(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
741
+ declare class ConstructionManifestError extends Error {
742
+ readonly path?: string;
743
+ constructor(message: string, path?: string);
744
+ }
705
745
 
706
746
  interface ExecOptions {
707
747
  /** Extra environment variables to inject (merged with safe base env). */
@@ -1116,6 +1156,53 @@ interface KodaXExtensionAPI {
1116
1156
  registerCapabilityProvider: (provider: CapabilityProvider) => () => void;
1117
1157
  registerCommand: (command: ExtensionCommandDefinition) => () => void;
1118
1158
  registerSkillPath: (skillPath: string) => () => void;
1159
+ /**
1160
+ * FEATURE_191 (v0.7.43) — register a constructed agent at extension
1161
+ * activate time. The extension supplies the agent name and an
1162
+ * `AgentContent` body (instructions + optional tools/handoffs/
1163
+ * reasoning/model/description); the runtime threads it through
1164
+ * `buildAdmissionManifest` + `Runner.admit` and registers the
1165
+ * activated Agent via `registerConstructedAgent({ source:
1166
+ * 'extension' })`. The returned dispose fn (also auto-pushed onto
1167
+ * the extension's disposables list) unregisters the agent on
1168
+ * extension deactivate.
1169
+ *
1170
+ * Returns `Promise<() => void>` — **you MUST `await` the call**
1171
+ * before invoking the dispose function. Unlike sibling
1172
+ * `registerTool` (sync), this is async because `Runner.admit` is
1173
+ * declared async (FEATURE_101 admission contract — admission may
1174
+ * consult disk for handoff-target staged-agent resolution).
1175
+ *
1176
+ * @example
1177
+ * ```ts
1178
+ * // CORRECT — await unwraps the Promise to a sync dispose
1179
+ * export default async function activate(api: KodaXExtensionAPI) {
1180
+ * const dispose = await api.registerAgent('db-reviewer', {
1181
+ * instructions: 'You review DB migrations.',
1182
+ * description: 'DB migration reviewer',
1183
+ * });
1184
+ * // dispose() is now callable on demand; the runtime also auto-
1185
+ * // disposes via the extension's disposables list at deactivate.
1186
+ * }
1187
+ * ```
1188
+ *
1189
+ * @example
1190
+ * ```ts
1191
+ * // WRONG — TypeScript catches this; .js / @ts-ignore consumers
1192
+ * // hit a runtime TypeError because Promise is not a function.
1193
+ * export default function activate(api: KodaXExtensionAPI) {
1194
+ * const dispose = api.registerAgent('x', { instructions: '...' });
1195
+ * dispose(); // TypeError: dispose is not a function
1196
+ * }
1197
+ * ```
1198
+ *
1199
+ * Throws on admission rejection (with the verdict reason) so the
1200
+ * extension author sees the failure at activate time rather than
1201
+ * having a silently-dropped registration. The throw also halts
1202
+ * extension loading — the extension's other registrations roll back
1203
+ * via `LoadedExtensionRecord.disposables` reverse-iterate.
1204
+ */
1205
+ registerAgent: (name: string, content: AgentContent) => Promise<() => void>;
1119
1206
  on: <TEvent extends keyof ExtensionEventMap>(event: TEvent, handler: (payload: ExtensionEventMap[TEvent]) => Promise<void> | void) => () => void;
1120
1207
  hook: <THook extends keyof ExtensionHookMap>(hook: THook, handler: ExtensionHookMap[THook]) => () => void;
1121
1208
  logger: ExtensionLogger;
@@ -1538,7 +1625,7 @@ declare function warmRepoIntelligenceRuntime(options?: {
1538
1625
  trace?: boolean;
1539
1626
  }): Promise<RepoIntelligenceRuntimeWarmResult>;
1540
1627
 
1541
- declare const SYSTEM_PROMPT = "You are KodaX, a helpful multi-provider coding agent. You can read, write, and edit files, and execute shell commands.\n\n## Error Handling\n\nWhen a tool call returns an error:\n1. STOP and READ the error message carefully\n2. DO NOT repeat the same tool call with the same parameters\n3. Identify what's wrong (missing parameter? wrong type? wrong path?)\n4. Fix the issue BEFORE making another tool call\n5. Common errors:\n - \"Missing required parameter 'X'\" -> Add the missing parameter to your JSON\n - \"File not found\" -> Check the path with read or glob first\n - \"String not found\" -> Read the file again to see exact content\n\nWhen a shell command fails, prefer this recovery order:\n1. Check whether a specialized tool can solve the task directly\n2. Fix the command itself (quoting, workdir, platform-specific command, smaller scope)\n3. Split the task into smaller read/edit/write steps\n4. Only create a helper script when repeated inline commands are clearly less safe or less maintainable\n\n## Editing Files\n\n- Always read the file first to understand its current content\n- Make precise, targeted edits rather than rewriting entire files\n- Preserve the existing code style and formatting\n- Do not create new files unless the user asks for one or the task genuinely needs one. Prefer editing an existing file to creating a new one, as this prevents file bloat and keeps each tool call small\n- When a modification is scoped to an existing file, ALWAYS prefer `edit` over `write`. Only fall back to `write` when no file exists yet or the user explicitly requested a complete rewrite\n\n## Tool Usage\n\nPrefer specialized tools over shell for file operations:\n- Use read to view files instead of cat, head, or tail\n- Use edit to modify existing files instead of sed or awk when possible\n- Use write to create new files instead of echo redirection or heredocs\n- Use glob or grep for file discovery and content search before falling back to shell\n- When multiple read-only tool calls are independent, emit them in the same response so parallel mode can run them together\n- Only serialize tool calls when a later call depends on an earlier result\n- Keep parallel batches focused: prefer a few narrow grep/read/diff calls over many tiny sequential probes\n\nRead is intentionally bounded:\n- A single read call only returns a limited slice of a file\n- For large files, continue with offset/limit instead of retrying a whole-file read\n- Prefer grep first, then read the specific section you need\n\nTool outputs are also bounded:\n- Large bash output may be truncated to the tail\n- Large grep results and diffs may be summarized\n- When you see a truncation hint, narrow the next tool call instead of repeating the same broad request\n- If edit fails to find a stable anchor, do not rewrite the entire existing file with write; retry with a smaller unique edit anchor or use insert_after_anchor for section appends\n\nIf you truly need a script:\n- Do NOT create temporary scripts or scratch files in the project root\n- Do NOT place them at `.agent/` top level \u2014 that directory is reserved for system-managed artifacts (managed-tasks/, project/, repo-intelligence/, etc.)\n- Write them to `.agent/tmp/` (relative to the git root). This is the designated ephemeral workspace; files there can be safely cleaned up later\n- Alternatively, use the system temp directory if the script does not need to be inspectable from the project\n- Treat helper scripts as a last resort, not the default recovery path\n\n## Shell Commands\n\n- Be careful with destructive operations\n- Reserve shell commands for terminal operations such as git, package managers, builds, tests, and system commands\n- Prefer read-only operations when possible\n- For file edits, prefer read/edit/write over shell transforms unless shell scripting is genuinely more efficient\n\n### Cross-Platform Notes\n\nDifferent platforms have different commands:\n- Move: `move` (Windows) vs `mv` (Unix/Mac)\n- List: `dir` (Windows) vs `ls` (Unix/Mac)\n- Delete: `del` (Windows) vs `rm` (Unix/Mac)\n\n**IMPORTANT: Directories are created automatically by the `write` tool.**\n- NEVER use `mkdir` before writing files - the write tool handles directory creation\n- If you truly need an empty directory: `mkdir dir` (Windows) or `mkdir -p dir` (Unix)\n\nIf you see \"not recognized\", \"\u4E0D\u662F\u5185\u90E8\u6216\u5916\u90E8\u547D\u4EE4\", or a similar shell lookup error, the command does not exist on this platform. Try the platform equivalent.\n\n## Multi-step Tasks\n\n- Track your progress by listing what you've done and what's next\n- Break complex tasks into smaller steps\n- Summarize progress periodically\n\n## Plan Before Action\n\nFor any non-trivial task (creating files, editing code, running complex commands):\n1. First explain your understanding of the task\n2. Outline your approach (what files, what changes, what order)\n3. Consider potential issues (edge cases, dependencies, conflicts)\n4. Then execute step by step\n\nFor simple read-only tasks (reading a file, listing directory), just do it directly.\n\nIf the environment is currently in a read-only planning mode:\n- Do not try to write files or run mutating shell commands during planning\n- Finish the plan first\n- After the plan is complete, use `ask_user_question` to ask whether the user wants to proceed with implementation\n- If the user confirms, call `set_permission_mode` with `mode: \"accept-edits\"` to switch to implementation mode\n- If the user declines, stay in plan mode \u2014 do NOT call `set_permission_mode`\n\n## Asking User Questions\n\nWhen you need the user to make decisions, use `ask_user_question`.\n- For **multiple independent questions**, use the `questions` array (1-4 items). Each question has its own `question`, `header`, `options`, and optional `multi_select`. The user answers each question separately. Do NOT combine multiple questions into a single question string with pre-combined option combinations.\n- For a **single question**, use the `question` + `options` fields as before.\n- For **free-text input**, use `kind: \"input\"`.\n\nAlways explain what you're doing before taking action.\n\n{context}";
1628
+ declare const SYSTEM_PROMPT = "You are KodaX, a helpful multi-provider coding agent. You can read, write, and edit files, and execute shell commands.\n\n## Error Handling\n\nWhen a tool call returns an error:\n1. STOP and READ the error message carefully\n2. DO NOT repeat the same tool call with the same parameters \u2014 a re-issue with identical params almost always lands in a retry loop that wastes tokens without producing new information. Vary the params or switch to a different tool\n3. Identify what's wrong (missing parameter? wrong type? wrong path?)\n4. Fix the issue BEFORE making another tool call\n5. Common errors:\n - \"Missing required parameter 'X'\" -> Add the missing parameter to your JSON\n - \"File not found\" -> Check the path with read or glob first\n - \"String not found\" -> Read the file again to see exact content\n\nWhen a shell command fails, prefer this recovery order:\n1. Check whether a specialized tool can solve the task directly\n2. Fix the command itself (quoting, workdir, platform-specific command, smaller scope)\n3. Split the task into smaller read/edit/write steps\n4. Only create a helper script when repeated inline commands are clearly less safe or less maintainable\n\n## Editing Files\n\n- Always read the file first to understand its current content\n- Make precise, targeted edits rather than rewriting entire files\n- Preserve the existing code style and formatting\n- Do not create new files unless the user asks for one or the task genuinely needs one. Prefer editing an existing file to creating a new one, as this prevents file bloat and keeps each tool call small\n- When a modification is scoped to an existing file, ALWAYS prefer `edit` over `write`. Only fall back to `write` when no file exists yet or the user explicitly requested a complete rewrite\n\n## Tool Usage\n\nPrefer specialized tools over shell for file operations:\n- Use read to view files instead of cat, head, or tail\n- Use edit to modify existing files instead of sed or awk when possible\n- Use write to create new files instead of echo redirection or heredocs\n- Use glob or grep for file discovery and content search before falling back to shell\n- When multiple read-only tool calls are independent, emit them in the same response so parallel mode can run them together\n- Only serialize tool calls when a later call depends on an earlier result\n- Keep parallel batches focused: prefer a few narrow grep/read/diff calls over many tiny sequential probes\n\nRead is intentionally bounded:\n- A single read call only returns a limited slice of a file\n- For large files, continue with offset/limit instead of retrying a whole-file read\n- Prefer grep first, then read the specific section you need\n\nTool outputs are also bounded:\n- Large bash output may be truncated to the tail\n- Large grep results and diffs may be summarized\n- When you see a truncation hint, narrow the next tool call instead of repeating the same broad request\n- If edit fails to find a stable anchor, do not rewrite the entire existing file with write; retry with a smaller unique edit anchor or use insert_after_anchor for section appends\n\nIf you truly need a script:\n- Do NOT create temporary scripts or scratch files in the project root \u2014 they leak into `git status` and file listings, confusing the user about what was actually changed\n- Do NOT place them at `.agent/` top level \u2014 that directory is reserved for system-managed artifacts (managed-tasks/, project/, repo-intelligence/, etc.)\n- Write them to `.agent/tmp/` (relative to the git root). This is the designated ephemeral workspace; files there can be safely cleaned up later\n- Alternatively, use the system temp directory if the script does not need to be inspectable from the project\n- Treat helper scripts as a last resort, not the default recovery path\n\n## Shell Commands\n\n- Be careful with destructive operations\n- Reserve shell commands for terminal operations such as git, package managers, builds, tests, and system commands\n- Prefer read-only operations when possible\n- For file edits, prefer read/edit/write over shell transforms unless shell scripting is genuinely more efficient\n\n### Cross-Platform Notes\n\nDifferent platforms have different commands:\n- Move: `move` (Windows) vs `mv` (Unix/Mac)\n- List: `dir` (Windows) vs `ls` (Unix/Mac)\n- Delete: `del` (Windows) vs `rm` (Unix/Mac)\n\n**IMPORTANT: Directories are created automatically by the `write` tool.**\n- NEVER use `mkdir` before writing files - the write tool handles directory creation\n- If you truly need an empty directory: `mkdir dir` (Windows) or `mkdir -p dir` (Unix)\n\nIf you see \"not recognized\", \"\u4E0D\u662F\u5185\u90E8\u6216\u5916\u90E8\u547D\u4EE4\", or a similar shell lookup error, the command does not exist on this platform. Try the platform equivalent.\n\n## Multi-step Tasks\n\n- Track your progress by listing what you've done and what's next\n- Break complex tasks into smaller steps\n- Summarize progress periodically\n\n## Plan Before Action\n\nFor any non-trivial task (creating files, editing code, running complex commands):\n1. First explain your understanding of the task\n2. Outline your approach (what files, what changes, what order)\n3. Consider potential issues (edge cases, dependencies, conflicts)\n4. Then execute step by step\n\nFor simple read-only tasks (reading a file, listing directory), just do it directly.\n\nIf the environment is currently in a read-only planning mode:\n- Do not try to write files or run mutating shell commands during planning\n- Finish the plan first\n- After the plan is complete, use `ask_user_question` to ask whether the user wants to proceed with implementation\n- If the user confirms, call `set_permission_mode` with `mode: \"accept-edits\"` to switch to implementation mode\n- If the user declines, stay in plan mode \u2014 do NOT call `set_permission_mode`\n\n## Asking User Questions\n\nWhen you need the user to make decisions, use `ask_user_question`.\n- For **multiple independent questions**, use the `questions` array (the schema accepts up to 4 items per call \u2014 if you need more, ask the additional ones in a follow-up turn). Each question has its own `question`, `header`, `options`, and optional `multi_select`. The user answers each question separately. Do NOT combine multiple questions into a single question string with pre-combined option combinations, because that forces the user to mentally disambiguate combinations and breaks the option-button UI.\n- For a **single question**, use the `question` + `options` fields as before.\n- For **free-text input**, use `kind: \"input\"`.\n\nAlways explain what you're doing before taking action.\n\n{context}";
1542
1629
 
1543
1630
  type KodaXPromptSectionSlot = 'base' | 'runtime-context' | 'session-context' | 'capability-truth' | 'base-suffix' | 'mode-overlay' | 'project-rules' | 'skill-addendum' | 'specialist';
1544
1631
  type KodaXPromptSectionStability = 'stable' | 'dynamic' | 'project' | 'specialist';
@@ -1632,7 +1719,7 @@ declare function buildSystemPrompt(options: KodaXOptions, isNewSession: boolean)
1632
1719
  * reuse is at the **pattern** level (each agent has its own
1633
1720
  * `capability-sections.ts`), not the **content** level.
1634
1721
  * - Hoisting to `@kodax-ai/agent/` would force `@kodax-ai/agent` →
1635
- * `@kodax-ai/skills` / `@kodax-ai/mcp` cross-package dependencies,
1722
+ * `@kodax-ai/agent` / `@kodax-ai/agent` cross-package dependencies,
1636
1723
  * breaking the "agent doesn't depend on application-layer
1637
1724
  * packages" promise.
1638
1725
  * - The drift problem this batch solves is "SA / AMA assemble the
@@ -1836,11 +1923,12 @@ declare function createReasoningPlan(options: KodaXOptions, prompt: string, prov
1836
1923
  *
1837
1924
  * Capability inventory: docs/features/v0.7.29-capability-inventory.md#cap-039-promise-signal-split-for-thinking-mode-replay
1838
1925
  *
1839
- * Recognises the convention used by managed-protocol harnesses (Scout,
1840
- * Planner, Generator, Evaluator) to embed a single-line signal at the end
1841
- * of an assistant turn — e.g. `[CONFIRMED H1_EXECUTE_EVAL]` — that downstream
1842
- * lifecycle code (scout-signals.ts, evaluator gating, etc.) inspects to
1843
- * decide whether to advance the harness state.
1926
+ * Recognises the convention historically used by V1 managed-protocol
1927
+ * harnesses (Scout / Planner / Generator / Evaluator) to embed a single-line
1928
+ * signal at the end of an assistant turn — e.g. `[CONFIRMED H1_EXECUTE_EVAL]`.
1929
+ * Most of those downstream consumers (`scout-signals.ts`, in-chain Evaluator
1930
+ * gating) were retired in FEATURE_184 / FEATURE_193; the helper is kept as
1931
+ * the canonical signal-extraction primitive for any future consumer.
1844
1932
  *
1845
1933
  * Returns `[signal, residual]` where:
1846
1934
  * - `signal` — uppercased tag (e.g. `CONFIRMED`) or `''` when absent
@@ -2149,14 +2237,14 @@ declare function startKodaX(options: KodaXOptions, prompt: string): RunningSessi
2149
2237
  *
2150
2238
  * These are the verbatim v0.7.35 compaction prompts (byte-identical to
2151
2239
  * the prior `SUMMARY_PROMPT` / `UPDATE_SUMMARY_PROMPT` constants in
2152
- * `@kodax-ai/session-lineage/src/compaction/summary-generator.ts`). They
2240
+ * `@kodax-ai/agent/src/compaction/summary-generator.ts`). They
2153
2241
  * remain the empirically best-performing prompts on the coding domain
2154
2242
  * (96.7% recall on the 10-fixture eval; see
2155
2243
  * `tests/compaction-prompt.eval.ts`) AND happen to also be the best on
2156
2244
  * the non-coding domain (97.0% recall) in the same eval — the wording
2157
2245
  * is coding-flavored but the structure generalizes.
2158
2246
  *
2159
- * Why they live here: per ADR-021, @kodax-ai/session-lineage is the
2247
+ * Why they live here: per ADR-021, @kodax-ai/agent is the
2160
2248
  * generic compaction primitive package and must not enumerate
2161
2249
  * coding-specific language ("coding agent", "file paths, function
2162
2250
  * names", "HTTP status codes", "## Files & Changes") in its public
@@ -2170,7 +2258,7 @@ declare function startKodaX(options: KodaXOptions, prompt: string): RunningSessi
2170
2258
  * coding path produces a byte-equivalent prompt to v0.7.35 — preserving
2171
2259
  * the empirically validated 96.7% recall.
2172
2260
  *
2173
- * Generic / non-coding consumers of @kodax-ai/session-lineage get the
2261
+ * Generic / non-coding consumers of @kodax-ai/agent get the
2174
2262
  * neutral `DEFAULT_SUMMARY_PROMPT` / `DEFAULT_UPDATE_SUMMARY_PROMPT`
2175
2263
  * (the candidate-a-conservative eval winner) by default — they pay a
2176
2264
  * 2-3pt non-coding recall cost for not knowing they should pass these
@@ -2292,7 +2380,10 @@ declare const toolPermission: QualityInvariant;
2292
2380
  * `ctx.recorder.scout.payload.scout.confirmedHarness` and lives here
2293
2381
  * too (v0.7.35.1 FEATURE_142 A-R2 moved it from @kodax-ai/agent per
2294
2382
  * ADR-021 — agent admission framework must not enumerate coding-AMA
2295
- * field names).
2383
+ * field names). FEATURE_193 (v0.7.43) retired V1 Scout — the
2384
+ * invariant is now a permanent no-op (predicate always admits)
2385
+ * but stays registered so existing admission manifests + tests
2386
+ * keep working.
2296
2387
  *
2297
2388
  * `registerCodingInvariants()` is the canonical bootstrap entry point
2298
2389
  * — call it once at SDK startup (or in test setup paired with
@@ -2308,11 +2399,11 @@ declare const toolPermission: QualityInvariant;
2308
2399
  *
2309
2400
  * v0.7.36 FEATURE_114: added `planBeforeMutate` — V2 plan-first
2310
2401
  * structural observation. Registers alongside `harnessSelectionTiming`
2311
- * (not as a replacement); the two coexist because V1 runs gate on the
2312
- * Scout-emitted harness verdict while V2 runs gate on Worker
2313
- * `todo_update`. Each predicate no-ops when its expected fields are
2314
- * absent, so ship-side flag toggle (KODAX_HARNESS_V2) does not need a
2315
- * separate registry.
2402
+ * (not as a replacement). FEATURE_193 (v0.7.43) retired V1 the
2403
+ * `harnessSelectionTiming` predicate is now a permanent no-op (it
2404
+ * always admits, since the V2 Worker single-loop is the new V2
2405
+ * harness-discipline anchor) but stays registered so existing
2406
+ * admission manifests + tests keep working.
2316
2407
  */
2317
2408
  declare const CODING_INVARIANTS: readonly QualityInvariant[];
2318
2409
  /**
@@ -2356,40 +2447,30 @@ declare function markFanoutBranchCompleted(plan: KodaXFanoutSchedulerPlan, bundl
2356
2447
  declare function markFanoutBranchCancelled(plan: KodaXFanoutSchedulerPlan, bundleId: string, reason: string): KodaXFanoutSchedulerPlan;
2357
2448
 
2358
2449
  /**
2359
- * Protocol emitter tools — FEATURE_084 Shard 2 (v0.7.26).
2360
- *
2361
- * Four role-specific `RunnableTool`s that replace the fenced-block text
2362
- * protocol used by Scout / Planner / Generator / Evaluator today. Each tool
2363
- * accepts a structured JSON payload, normalizes it via
2364
- * `coerceManagedProtocolToolPayload` (the same normalizer the old fenced-block
2365
- * parser uses), and surfaces the normalized payload on the tool result
2366
- * `metadata.payload` field so the new Runner-driven task engine
2367
- * (FEATURE_084 Shard 5) can make routing decisions without text parsing.
2450
+ * Protocol emitter tools.
2368
2451
  *
2369
- * **Data-only at this shard**: nothing consumes these tools yet. The SA
2370
- * preset path and the existing managed-task engine continue to use the
2371
- * legacy `emit_managed_protocol` tool + fenced-block fallback unchanged.
2372
- *
2373
- * **Payload parity contract**: a given JSON input MUST produce an identical
2374
- * normalized payload to what the legacy fenced-block parser would produce
2375
- * for the same JSON. This is enforced by sharing
2376
- * `coerceManagedProtocolToolPayload` between both paths.
2452
+ * After FEATURE_193 (v0.7.43) V1 chain retirement, this module exposes a
2453
+ * single emitter: `emitVerdict` (the Sidecar Verifier verdict tool). The
2454
+ * supporting types and helpers (`ProtocolEmitterMetadata`,
2455
+ * `resolveHandoffTarget`, `buildEmitter`, `summarizeNormalized`) survive in
2456
+ * generic form because `verifier-recorder-bridge.ts` and the recorder
2457
+ * still observe the emitter metadata shape but every Scout / Planner /
2458
+ * Generator branch is gone with the V1 roles.
2377
2459
  */
2378
2460
 
2379
- /** Public tool name — LLM sees this on the tool list. */
2380
- declare const EMIT_SCOUT_VERDICT_TOOL_NAME = "emit_scout_verdict";
2381
- declare const EMIT_CONTRACT_TOOL_NAME = "emit_contract";
2382
- declare const EMIT_HANDOFF_TOOL_NAME = "emit_handoff";
2383
2461
  declare const EMIT_VERDICT_TOOL_NAME = "emit_verdict";
2384
2462
  /**
2385
2463
  * Shared metadata shape on the tool result. The Runner-driven task engine
2386
- * (Shard 5) inspects `payload` to understand verdicts and
2387
- * `handoffTarget` to execute the next role transition.
2464
+ * inspects `payload` to understand the Sidecar Verifier verdict.
2465
+ *
2466
+ * FEATURE_193 (v0.7.43): the role union narrowed from the V1 four-role
2467
+ * set (scout/planner/generator/evaluator) to `'evaluator'` only — Sidecar
2468
+ * Verifier is the sole emitter that survives V1 chain retirement.
2388
2469
  */
2389
2470
  interface ProtocolEmitterMetadata {
2390
- /** The role that emitted this payload — always matches the tool's role. */
2391
- readonly role: 'scout' | 'planner' | 'generator' | 'evaluator';
2392
- /** Normalized payload slice (scout / contract / handoff / verdict). */
2471
+ /** The role that emitted this payload — always `'evaluator'` in V2. */
2472
+ readonly role: 'evaluator';
2473
+ /** Normalized payload slice (verdict). */
2393
2474
  readonly payload: Partial<KodaXManagedProtocolPayload>;
2394
2475
  /**
2395
2476
  * FEATURE_084 Shard 4 handoff signal. When set, the Runner looks up the
@@ -2406,29 +2487,19 @@ interface ProtocolEmitterMetadata {
2406
2487
  readonly isTerminal?: boolean;
2407
2488
  }
2408
2489
  /**
2409
- * Scout verdict emitter. Reports the outcome of scope analysis and the
2410
- * chosen harness tier. The Runner-driven task engine reads
2411
- * `metadata.payload.scout.confirmedHarness` to decide whether to hand off
2412
- * to Generator (H1) or Planner (H2), or to finish directly (H0).
2413
- */
2414
- declare const emitScoutVerdict: RunnableTool;
2415
- /**
2416
- * Planner contract emitter (H2 only). Produces the execution contract the
2417
- * Generator consumes: success criteria, required evidence, constraints.
2490
+ * Sidecar Verifier verdict emitter (FEATURE_184). Decides the terminal
2491
+ * outcome of the round: accept, revise (Worker re-runs to fix), or
2492
+ * blocked. The Runner-driven engine reads `metadata.payload.verdict.status`
2493
+ * to decide next hop. Called by the Stop-hook Sidecar Verifier, never
2494
+ * by Worker/Generator directly.
2418
2495
  */
2419
- declare const emitContract: RunnableTool;
2420
- /**
2421
- * Generator handoff emitter. Signals that the Generator has finished its
2422
- * execution round and hands off to the Evaluator for verification.
2423
- */
2424
- declare const emitHandoff: RunnableTool;
2496
+ declare const emitVerdict: RunnableTool;
2425
2497
  /**
2426
- * Evaluator verdict emitter. Decides the terminal outcome of the round:
2427
- * accept, revise (retry with same harness), or blocked. The Runner-driven
2428
- * engine reads `metadata.payload.verdict.status` to decide next hop.
2498
+ * Emitter tools tuple. FEATURE_190 (v0.7.43) shrank from 4→3 with
2499
+ * `emitHandoff` deletion; FEATURE_193 (v0.7.43) shrank to 1 with
2500
+ * `emitScoutVerdict` + `emitContract` deletion only the Sidecar Verifier
2501
+ * emitter survives.
2429
2502
  */
2430
- declare const emitVerdict: RunnableTool;
2431
- /** All four emitter tools, exposed as a tuple for iteration. */
2432
2503
  declare const PROTOCOL_EMITTER_TOOLS: readonly RunnableTool[];
2433
2504
 
2434
2505
  declare function runManagedTask(options: KodaXOptions, prompt: string): Promise<KodaXResult>;
@@ -2537,11 +2608,11 @@ declare function getActiveExtensionRuntime(): KodaXExtensionRuntime | null;
2537
2608
 
2538
2609
  /**
2539
2610
  * Coding-runtime adapter: registers an `McpCapabilityProvider` (from
2540
- * `@kodax-ai/mcp`) against the coding-specific `KodaXExtensionRuntime`.
2611
+ * `@kodax-ai/agent`) against the coding-specific `KodaXExtensionRuntime`.
2541
2612
  *
2542
2613
  * FEATURE_082 (v0.7.24): split out of the old
2543
2614
  * `capabilities/providers/mcp/provider.ts`. The provider class now lives in
2544
- * `@kodax-ai/mcp` and stays free of any coding runtime dependency; this file
2615
+ * `@kodax-ai/agent` and stays free of any coding runtime dependency; this file
2545
2616
  * is the thin bridge that wires the provider into the coding extension
2546
2617
  * runtime.
2547
2618
  */
@@ -2613,13 +2684,13 @@ type OrchestrationWorkerRunner<TTask extends OrchestrationWorkerSpec = Orchestra
2613
2684
  * `appendTrace` to `{workspaceDir}/orchestration-trace.jsonl`.
2614
2685
  *
2615
2686
  * @deprecated FEATURE_083 (v0.7.24) originally superseded this by
2616
- * `AgentSpan` / `HandoffSpan` in `@kodax-ai/tracing`. **FEATURE_086 (v0.7.27)
2687
+ * `AgentSpan` / `HandoffSpan` in `@kodax-ai/agent`. **FEATURE_086 (v0.7.27)
2617
2688
  * evaluated removal and kept it**: AgentSpan is scoped to a single Runner
2618
2689
  * lifecycle, whereas OrchestrationTraceEvent spans across Tasks scheduled
2619
2690
  * by `runOrchestration` — no cross-task span equivalent exists yet, and
2620
2691
  * `runOrchestration` + this type are part of the `@kodax-ai/coding` public
2621
2692
  * surface. The `@deprecated` tag is kept as a signal that new code
2622
- * targeting in-Runner tracing should prefer `@kodax-ai/tracing` spans;
2693
+ * targeting in-Runner tracing should prefer `@kodax-ai/agent` spans;
2623
2694
  * cross-task orchestration code is free to continue using this event.
2624
2695
  */
2625
2696
  interface OrchestrationTraceEvent {
@@ -2764,463 +2835,135 @@ declare function createDenialTracker(): DenialTracker;
2764
2835
  * - bash: first 3 tokens of the command
2765
2836
  * - edit/write/read: file path
2766
2837
  * - other: tool name + hash prefix
2767
- */
2768
- declare function computeInputSignature(toolName: string, input: Record<string, unknown>): string;
2769
- declare function recordDenial(tracker: DenialTracker, toolName: string, input: Record<string, unknown>, reason?: string): DenialTracker;
2770
- declare function isDeniedRecently(tracker: DenialTracker, toolName: string, input: Record<string, unknown>, ttl?: number): boolean;
2771
- /**
2772
- * Generate a denial context string for injection into agent messages.
2773
- * Tells the LLM what was denied so it can adjust its strategy.
2774
- */
2775
- declare function getDenialContext(tracker: DenialTracker): string;
2776
-
2777
- /**
2778
- * Placeholder Agent declarations for the coding-AMA H2 task-engine roles
2779
- * (Scout / Planner / Generator / Worker).
2780
- *
2781
- * FEATURE_080 (v0.7.23): these declarations exist so the role identities
2782
- * are represented as Layer A `Agent` data, which downstream features need:
2783
- *
2784
- * - FEATURE_084 (v0.7.26): runtime rewrite of Scout/Planner/Generator
2785
- * on top of `Runner` consumes these declarations as the source of
2786
- * truth for role metadata.
2787
- * - FEATURE_078 (v0.7.29): reasoning profiles attach to the `reasoning`
2788
- * field on these declarations.
2789
- * - FEATURE_087+ self-construction: Agent-as-data means role specs can
2790
- * be serialized, versioned, and mutated.
2791
- *
2792
- * Runtime note: **no preset dispatcher is registered for these agents**.
2793
- * They are declarative placeholders. `Runner.run(scoutAgent, ...)` without
2794
- * an `opts.llm` callback will throw the generic "no dispatcher" error;
2795
- * that's intentional — the current task-engine executes these roles via
2796
- * its existing internal flow, not through `Runner`. FEATURE_084 wires the
2797
- * Runner runtime to these declarations.
2798
- *
2799
- * `instructions` strings here are short identifier-level summaries — the
2800
- * full role prompts live in
2801
- * `packages/coding/src/task-engine/_internal/prompts/role-prompt.ts` (the
2802
- * FEATURE_079 extraction) and are loaded by the existing code path.
2803
- *
2804
- * v0.7.35.1 FEATURE_142 (A-R1): moved from `@kodax-ai/agent/src/primitives/`
2805
- * back to `@kodax-ai/coding/src/agents/`. These role declarations are
2806
- * coding-AMA-specific (Scout / Planner / Generator are the H2 state-machine
2807
- * roles, not generic Agent platform primitives). Per ADR-021, the universal
2808
- * `@kodax-ai/agent` framework must not predeclare coding's H2 role
2809
- * identities.
2810
- */
2811
-
2812
- declare const SCOUT_AGENT_NAME = "kodax/role/scout";
2813
- declare const PLANNER_AGENT_NAME = "kodax/role/planner";
2814
- declare const GENERATOR_AGENT_NAME = "kodax/role/generator";
2815
- /**
2816
- * Scout role declaration. Scout is the AMA entry point that both judges
2817
- * task complexity and executes the H0 direct case; on H1/H2 it hands off
2818
- * to Generator or Planner (see FEATURE_061).
2819
- */
2820
- declare const scoutAgent: Agent;
2821
- /**
2822
- * Planner role declaration. Produces an execution plan consumed by
2823
- * Generator in the H2 harness.
2824
- */
2825
- declare const plannerAgent: Agent;
2826
- /**
2827
- * Generator role declaration. Performs the actual code changes /
2828
- * investigations in both H1 harness; text-only terminates so Sidecar
2829
- * Verifier (FEATURE_184 Phase D.2) takes over verification.
2830
- */
2831
- declare const generatorAgent: Agent;
2832
- /** All three placeholder role agents, exposed for iteration in downstream features. */
2833
- declare const TASK_ENGINE_ROLE_AGENTS: Readonly<{
2834
- readonly scout: Agent<unknown>;
2835
- readonly planner: Agent<unknown>;
2836
- readonly generator: Agent<unknown>;
2837
- }>;
2838
-
2839
- /**
2840
- * Default coding agent preset (FEATURE_080 → FEATURE_100).
2841
- *
2842
- * History:
2843
- * v0.7.23 (FEATURE_080) introduced "Option Y": a `registerPresetDispatcher`
2844
- * indirection that wrapped `runKodaX` so `Runner.run(defaultCodingAgent, …)`
2845
- * appeared SDK-native while the body stayed on the legacy path. The trade-off
2846
- * was deliberate parity insurance during the Layer-A primitives rollout.
2847
- *
2848
- * v0.7.29 (FEATURE_100) deletes Option Y per ADR-020. The substrate executor
2849
- * is attached directly to the Agent declaration via `Agent.substrateExecutor`
2850
- * (an Agent field added in this version), and `Runner.run` consults that
2851
- * field before any registry lookup. No `registerPresetDispatcher` call is
2852
- * made any more, so `Runner.run(createDefaultCodingAgent(), …)` and
2853
- * `runKodaX(opts, prompt)` (now a thin `Runner.run` wrapper in `agent.ts`)
2854
- * share one execution path.
2855
- *
2856
- * This file stays in `@kodax-ai/coding` because the substrate executor closure
2857
- * imports `runSubstrate` from `agent-runtime/run-substrate.ts`. Importing
2858
- * `@kodax-ai/core` alone never loads the substrate body.
2859
- */
2860
-
2861
- /** Stable name used as the dispatch key for the built-in coding preset. */
2862
- declare const DEFAULT_CODING_AGENT_NAME = "kodax/coding/default";
2863
- /**
2864
- * Construct the default coding Agent declaration. SDK consumers may write
2865
- * `Runner.run(createDefaultCodingAgent(), prompt, { presetOptions })` and
2866
- * the Runner will execute the substrate via `Agent.substrateExecutor`.
2867
- *
2868
- * `overrides` lets callers attach additional declarative fields
2869
- * (e.g. custom `reasoning` profile, extra `guardrails`, custom
2870
- * `provider`/`model`); these are preserved on the Agent and may be
2871
- * consumed by the substrate executor through `presetOptions`.
2872
- */
2873
- declare function createDefaultCodingAgent(overrides?: Partial<Omit<Agent, 'name' | 'instructions'>>): Agent;
2874
-
2875
- /**
2876
- * Coding Agent declarations — FEATURE_084 (v0.7.26).
2877
- *
2878
- * **These are declarative references exposing the canonical Scout /
2879
- * Planner / Generator topology to SDK consumers.** Each exported Agent
2880
- * carries the role's emit tool + the H0/H1/H2 handoff graph, but carries
2881
- * ONLY a short identifier `instructions` string and NO coding tools
2882
- * (read / grep / bash / write / edit / etc.).
2883
- *
2884
- * **The runtime agents are built fresh by
2885
- * `task-engine/runner-driven.ts::buildRunnerAgentChain` on every run**,
2886
- * with:
2887
- * - full v0.7.22-parity `instructions` via
2888
- * `_internal/managed-task/role-prompt.ts::createRolePrompt` (dynamic
2889
- * closure resolving decision / contract / metadata / verification /
2890
- * tool-policy / evidence-strategy / dispatch guidance per turn)
2891
- * - per-run coding tools (read / grep / glob / bash / write / edit /
2892
- * dispatch_child_task) wrapped with budget + mutation tracking +
2893
- * progress reporting
2894
- * - recorder-wrapped emit tools that drive the budget-extension
2895
- * dialog + degraded-continue logic
2896
- *
2897
- * So these exports are **useful as topology documentation and as a
2898
- * starting point for custom Runner invocations** (e.g. Runner.run with
2899
- * your own llm adapter), but they are NOT the agents that run under
2900
- * normal AMA dispatch. Do not expect wrapping `scoutCodingAgent` to
2901
- * give you the behaviour of an in-SDK AMA run — for that, use
2902
- * `runManagedTaskViaRunner` or the preset dispatcher on
2903
- * `createDefaultCodingAgent`.
2904
- */
2905
-
2906
- /** Marker exported for tests and for future binding sites in Shard 5. */
2907
- declare const CODING_AGENT_MARKER: "kodax-coding-agent@0.7.26";
2908
- declare const scoutCodingAgent: Agent;
2909
- declare const plannerCodingAgent: Agent;
2910
- declare const generatorCodingAgent: Agent;
2911
- /**
2912
- * Topology record — iterable form of the three coding agents. Shard 5's
2913
- * Runner-driven dispatcher uses this as the agent lookup.
2914
- */
2915
- declare const CODING_AGENTS: Readonly<{
2916
- readonly scout: Agent<unknown>;
2917
- readonly planner: Agent<unknown>;
2918
- readonly generator: Agent<unknown>;
2919
- }>;
2920
-
2921
- /**
2922
- * Adapter: wrap `applyToolResultGuardrail` (the existing per-tool truncation
2923
- * policy) as a Layer A `ToolGuardrail.afterTool`.
2924
- *
2925
- * FEATURE_085 (v0.7.26): the tri-layer Guardrail runtime lives in
2926
- * `@kodax-ai/core`. The existing truncation logic in `tool-result-policy.ts`
2927
- * predates that runtime and targets `KodaXToolExecutionContext`. Rather
2928
- * than merge the two, we expose an adapter that coding consumers can
2929
- * register when driving a Runner through the generic path — the adapter
2930
- * preserves byte-exact truncation behaviour while participating in the
2931
- * new Guardrail lifecycle (Span emission, declaration-order composition).
2932
- *
2933
- * **Not** registered by default. Consumers opt in via
2934
- * `Runner.run(agent, input, { guardrails: [createToolResultTruncationGuardrail(ctx)] })`.
2935
- * The built-in `runKodaX` preset dispatcher continues to call
2936
- * `applyToolResultGuardrail` directly — no behavioural change there.
2937
- */
2938
-
2939
- declare const TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME = "tool-result-truncation";
2940
- /**
2941
- * Create a `ToolGuardrail` that delegates to `applyToolResultGuardrail` in
2942
- * its `afterTool` hook. The returned guardrail does not touch the call
2943
- * going in (no `beforeTool`).
2944
- *
2945
- * @param ctx The coding-layer execution context that
2946
- * `applyToolResultGuardrail` needs (mutation tracker, persistence dir,
2947
- * etc.). Typically created alongside the `KodaXOptions` for the run.
2948
- */
2949
- declare function createToolResultTruncationGuardrail(ctx: KodaXToolExecutionContext): ToolGuardrail;
2950
-
2951
- /**
2952
- * KodaX Constructed-World types (FEATURE_087, v0.7.28).
2953
- *
2954
- * Runtime-generated capabilities (tools / agents / skills / ...) live in
2955
- * `.kodax/constructed/` and are loaded into the same registries as builtin
2956
- * primitives. v0.7.28 only ships tool generation (FEATURE_088); other kinds
2957
- * land in FEATURE_089 / FEATURE_090.
2958
- *
2959
- * Cross-references:
2960
- * - DD §14 — lifecycle, security model, registry merge semantics.
2961
- * - docs/features/v0.7.28.md — capability schema, generation flow.
2962
- */
2963
- /**
2964
- * Handler script source. v0.7.28 limits language to `'javascript'` so that
2965
- * `loadHandler()` can `await import()` the file directly without an
2966
- * intermediate TS → JS compile step (no esbuild / tsx dependency).
2967
- *
2968
- * TypeScript handlers are explicitly out of scope; Coding Agent generates
2969
- * JS strings on the wire.
2970
- */
2971
- interface ScriptSource {
2972
- readonly kind: 'script';
2973
- readonly language: 'javascript';
2974
- readonly code: string;
2975
- }
2976
- /**
2977
- * Capability declaration.
2978
- *
2979
- * v0.7.28 ships the single-dimension form: a whitelist of builtin tool
2980
- * names that the handler may invoke through `ctx.tools.<name>(...)`.
2981
- * All I/O — fs / net / env — must flow through builtin tools (`read` /
2982
- * `write` / `bash` / etc.); handlers do not receive direct `ctx.fs` /
2983
- * `ctx.net` / `ctx.env` entry points.
2984
- *
2985
- * Forward-compatible evolution: if the future demands path/domain-level
2986
- * constraints, this can grow to `(string | { name; constraints })[]`
2987
- * without breaking existing manifests.
2988
- */
2989
- interface Capabilities {
2990
- readonly tools: readonly string[];
2991
- }
2992
- /**
2993
- * Tool-kind artifact body (the `content` of `ConstructionArtifact` when
2994
- * `kind === 'tool'`).
2995
- */
2996
- interface ToolContent {
2997
- readonly description: string;
2998
- readonly inputSchema: Record<string, unknown>;
2999
- readonly capabilities: Capabilities;
3000
- readonly handler: ScriptSource;
3001
- /**
3002
- * Per-tool timeout override. Defaults to {@link DEFAULT_HANDLER_TIMEOUT_MS}
3003
- * when omitted. Bounded by AbortController in `loadHandler()`.
3004
- */
3005
- readonly timeoutMs?: number;
3006
- }
3007
- /**
3008
- * Default handler timeout. Picked to match the historical ceiling on
3009
- * builtin streaming tools (30s); revisit if a constructed tool demands
3010
- * longer-running computation.
3011
- */
3012
- declare const DEFAULT_HANDLER_TIMEOUT_MS = 30000;
3013
- /**
3014
- * Lifecycle state on disk. Drives both the startup glob filter and the
3015
- * `revoke()` semantics. See DD §14.1 — file system is the single source
3016
- * of truth; no separate `_manifest.json` index file (C4 decision).
3017
- */
3018
- type ArtifactStatus = 'staged' | 'active' | 'revoked';
3019
- /**
3020
- * Reference to a tool by stable id. v0.7.31 (FEATURE_089) introduces
3021
- * Agent manifests that bundle tool refs rather than inline tool bodies;
3022
- * the resolver expands these refs to concrete `KodaXToolDefinition`
3023
- * instances at activate time.
3024
- *
3025
- * `ref` shape:
3026
- * - `builtin:<name>` — a tool from the static registry
3027
- * (e.g. `builtin:read`, `builtin:bash`)
3028
- * - `constructed:<name>@<ver>` — a previously-activated constructed tool
3029
- */
3030
- interface ToolRef {
3031
- readonly ref: string;
3032
- }
3033
- /**
3034
- * Reference to a Guardrail by stable id. The Layer A `Guardrail`
3035
- * declaration is name-only (no runtime hooks); resolvers map known
3036
- * names to constructed `ToolGuardrail` / `InputGuardrail` /
3037
- * `OutputGuardrail` instances at activation time.
3038
- */
3039
- interface GuardrailRef {
3040
- readonly kind: 'input' | 'output' | 'tool';
3041
- readonly ref: string;
3042
- }
3043
- /**
3044
- * Reference to a handoff target by stable id (another constructed agent
3045
- * or a builtin role). The resolver expands `target.ref` to the actual
3046
- * `Agent` declaration at admission time so the handoff DAG check
3047
- * (`handoffLegality` invariant) sees the full graph.
3048
- */
3049
- interface AgentHandoffRef {
3050
- readonly target: {
3051
- readonly ref: string;
3052
- };
3053
- readonly kind: 'continuation' | 'as-tool';
3054
- readonly description?: string;
3055
- }
2838
+ */
2839
+ declare function computeInputSignature(toolName: string, input: Record<string, unknown>): string;
2840
+ declare function recordDenial(tracker: DenialTracker, toolName: string, input: Record<string, unknown>, reason?: string): DenialTracker;
2841
+ declare function isDeniedRecently(tracker: DenialTracker, toolName: string, input: Record<string, unknown>, ttl?: number): boolean;
3056
2842
  /**
3057
- * Reasoning profile declaration mirroring the Layer A
3058
- * `AgentReasoningProfile`. Kept structurally identical so the resolver
3059
- * passes the value through without re-shaping.
2843
+ * Generate a denial context string for injection into agent messages.
2844
+ * Tells the LLM what was denied so it can adjust its strategy.
3060
2845
  */
3061
- interface AgentReasoningRef {
3062
- readonly default: 'quick' | 'balanced' | 'deep';
3063
- readonly max?: 'quick' | 'balanced' | 'deep';
3064
- readonly escalateOnRevise?: boolean;
3065
- }
2846
+ declare function getDenialContext(tracker: DenialTracker): string;
2847
+
3066
2848
  /**
3067
- * Sandbox test case. Used by `sandbox_test_agent` to verify a
3068
- * constructed agent before it can activate. Each case feeds `input`
3069
- * to a sandbox Runner instance and grades the agent's final output:
2849
+ * Role-name constants for the coding-AMA task-engine.
3070
2850
  *
3071
- * - `expectMatch` — final text must match this regex (string form)
3072
- * - `expectNotMatch` — final text must NOT match this regex
3073
- * - `expectFinalText` exact substring match (case-sensitive)
2851
+ * FEATURE_193 v0.7.43: V1 chain (Scout/Planner/Generator) retired the
2852
+ * placeholder Agent declarations are deleted, but the name constants
2853
+ * (`SCOUT_AGENT_NAME` / `PLANNER_AGENT_NAME` / `GENERATOR_AGENT_NAME`) survive
2854
+ * as string literals so:
2855
+ * - verdict-recorder.ts routing logic that compares `handoffTarget` against
2856
+ * these names still compiles
2857
+ * - historical session id strings that reference these roles can still parse
3074
2858
  *
3075
- * At least one of the three expect-fields must be present; the cases
3076
- * are graded by `runSandboxAgentTest()` (FEATURE_089 Phase 3.5).
2859
+ * Worker is the only live placeholder Agent the runtime Worker (with full
2860
+ * tool set, handoffs, mutation guards) is constructed in
2861
+ * `task-engine/runner-driven.ts::buildRunnerAgentChain`.
3077
2862
  */
3078
- interface AgentTestCase {
3079
- readonly id: string;
3080
- readonly input: string;
3081
- readonly expectMatch?: string;
3082
- readonly expectNotMatch?: string;
3083
- readonly expectFinalText?: string;
3084
- }
2863
+
2864
+ declare const SCOUT_AGENT_NAME = "kodax/role/scout";
2865
+ declare const PLANNER_AGENT_NAME = "kodax/role/planner";
2866
+ declare const GENERATOR_AGENT_NAME = "kodax/role/generator";
2867
+ declare const WORKER_AGENT_NAME = "kodax/role/worker";
3085
2868
  /**
3086
- * Agent-kind artifact body (the `content` of `ConstructionArtifact`
3087
- * when `kind === 'agent'`).
2869
+ * Worker role declaration FEATURE_114 v0.7.36. The single primary agent
2870
+ * after FEATURE_193 V1 chain retirement. Plans (todo_update), executes
2871
+ * (read/write/edit/bash/dispatch), text-only terminates so Sidecar Verifier
2872
+ * (FEATURE_184 Phase D.2) runs verification.
3088
2873
  *
3089
- * FEATURE_089 (v0.7.31): all fields except `instructions` are optional;
3090
- * a minimal "echo agent" can be expressed as `{ instructions: '...' }`.
3091
- * Tool / handoff / guardrail refs are resolved at admission time
3092
- * (Runner.admit's 5-step audit expands them and feeds the resolved
3093
- * Agent through the invariant chain).
2874
+ * Placeholder for Layer A `Agent` data — the runtime Worker (with full
2875
+ * tool set, handoffs, mutation guards) is constructed in
2876
+ * `task-engine/runner-driven.ts::buildRunnerAgentChain`.
3094
2877
  */
3095
- interface AgentContent {
3096
- readonly instructions: string;
3097
- readonly tools?: readonly ToolRef[];
3098
- readonly handoffs?: readonly AgentHandoffRef[];
3099
- readonly reasoning?: AgentReasoningRef;
3100
- readonly guardrails?: readonly GuardrailRef[];
3101
- readonly model?: string;
3102
- readonly provider?: string;
3103
- /**
3104
- * Optional structured-output schema mirroring `Agent.outputSchema`.
3105
- * Pure pass-through to the runtime — admission does not validate
3106
- * shape semantics here, only well-formed JSON.
3107
- */
3108
- readonly outputSchema?: Record<string, unknown>;
3109
- /**
3110
- * Optional sandbox test cases. When present, `sandbox_test_agent`
3111
- * runs them; when absent, the test step performs only the static
3112
- * checks (manifest schema + admission audit).
3113
- */
3114
- readonly testCases?: readonly AgentTestCase[];
3115
- /**
3116
- * Maximum total budget (iteration count) the agent may consume.
3117
- * Plumbed onto the resolved `AgentManifest.maxBudget` and clamped by
3118
- * `budgetCeiling` invariant during admission.
3119
- */
3120
- readonly maxBudget?: number;
3121
- /**
3122
- * Voluntary additional invariants the LLM declares this agent
3123
- * commits to. Plumbed onto `AgentManifest.declaredInvariants`;
3124
- * unioned on top of the required set during admission.
3125
- */
3126
- readonly declaredInvariants?: readonly string[];
3127
- }
2878
+ declare const workerAgent: Agent;
2879
+ /** Worker role agent exposed for iteration in downstream features. */
2880
+ declare const TASK_ENGINE_ROLE_AGENTS: Readonly<{
2881
+ readonly worker: Agent<unknown>;
2882
+ }>;
2883
+
3128
2884
  /**
3129
- * Persisted artifact shape (one JSON file per name/version under
3130
- * `.kodax/constructed/<kind>s/<name>/<version>.json`).
2885
+ * Default coding agent preset (FEATURE_080 FEATURE_100).
3131
2886
  *
3132
- * Discriminated union over `kind`:
3133
- * - `kind: 'tool'` — v0.7.28 (FEATURE_088) tool generation
3134
- * - `kind: 'agent'` v0.7.31 (FEATURE_089) agent generation; passes
3135
- * through `Runner.admit()` at activation time
2887
+ * History:
2888
+ * v0.7.23 (FEATURE_080) introduced "Option Y": a `registerPresetDispatcher`
2889
+ * indirection that wrapped `runKodaX` so `Runner.run(defaultCodingAgent, )`
2890
+ * appeared SDK-native while the body stayed on the legacy path. The trade-off
2891
+ * was deliberate parity insurance during the Layer-A primitives rollout.
3136
2892
  *
3137
- * Lifecycle fields (status / timestamps / contentHash / sourceAgent /
3138
- * signedBy) are common to all kinds.
2893
+ * v0.7.29 (FEATURE_100) deletes Option Y per ADR-020. The substrate executor
2894
+ * is attached directly to the Agent declaration via `Agent.substrateExecutor`
2895
+ * (an Agent field added in this version), and `Runner.run` consults that
2896
+ * field before any registry lookup. No `registerPresetDispatcher` call is
2897
+ * made any more, so `Runner.run(createDefaultCodingAgent(), …)` and
2898
+ * `runKodaX(opts, prompt)` (now a thin `Runner.run` wrapper in `agent.ts`)
2899
+ * share one execution path.
2900
+ *
2901
+ * This file stays in `@kodax-ai/coding` because the substrate executor closure
2902
+ * imports `runSubstrate` from `agent-runtime/run-substrate.ts`. Importing
2903
+ * `@kodax-ai/core` alone never loads the substrate body.
3139
2904
  */
3140
- type ConstructionArtifact = ToolArtifact | AgentArtifact;
3141
- interface ConstructionArtifactBase {
3142
- readonly name: string;
3143
- readonly version: string;
3144
- status: ArtifactStatus;
3145
- readonly signedBy?: string;
3146
- readonly createdAt: number;
3147
- readonly sourceAgent?: string;
3148
- testedAt?: number;
3149
- activatedAt?: number;
3150
- revokedAt?: number;
3151
- /**
3152
- * SHA-256 of `JSON.stringify(content)` captured at activate time.
3153
- * `rehydrateActiveArtifacts()` recomputes and compares — a mismatch
3154
- * indicates the manifest was edited between activation and the next
3155
- * boot (naive cross-session tampering, e.g. an LLM rewriting the .json
3156
- * via the Write tool without recomputing the hash). Mismatched
3157
- * artifacts are skipped at rehydrate with a stderr warning. This is
3158
- * NOT a defense against a coordinated attacker who recomputes the
3159
- * hash; the threat model is single-user CLI integrity, not multi-user
3160
- * supply chain.
3161
- */
3162
- contentHash?: string;
3163
- }
3164
- interface ToolArtifact extends ConstructionArtifactBase {
3165
- readonly kind: 'tool';
3166
- readonly content: ToolContent;
3167
- }
3168
- interface AgentArtifact extends ConstructionArtifactBase {
3169
- readonly kind: 'agent';
3170
- readonly content: AgentContent;
3171
- }
2905
+
2906
+ /** Stable name used as the dispatch key for the built-in coding preset. */
2907
+ declare const DEFAULT_CODING_AGENT_NAME = "kodax/coding/default";
3172
2908
  /**
3173
- * Returned by {@link ConstructionRuntime.stage}; opaque handle that
3174
- * downstream `test()` / `activate()` calls bind to.
2909
+ * Construct the default coding Agent declaration. SDK consumers may write
2910
+ * `Runner.run(createDefaultCodingAgent(), prompt, { presetOptions })` and
2911
+ * the Runner will execute the substrate via `Agent.substrateExecutor`.
2912
+ *
2913
+ * `overrides` lets callers attach additional declarative fields
2914
+ * (e.g. custom `reasoning` profile, extra `guardrails`, custom
2915
+ * `provider`/`model`); these are preserved on the Agent and may be
2916
+ * consumed by the substrate executor through `presetOptions`.
3175
2917
  */
3176
- interface StagedHandle {
3177
- readonly artifact: ConstructionArtifact;
3178
- readonly stagedAt: number;
3179
- }
2918
+ declare function createDefaultCodingAgent(overrides?: Partial<Omit<Agent, 'name' | 'instructions'>>): Agent;
2919
+
3180
2920
  /**
3181
- * Outcome of {@link ConstructionRuntime.test}. `ok=false` blocks
3182
- * activation; `warnings` surface but do not block.
2921
+ * Coding Agent declarations — FEATURE_193 v0.7.43.
2922
+ *
2923
+ * The V1 chain (Scout / Planner / Generator) was retired in FEATURE_193.
2924
+ * The Worker single-loop is now the only entry path; the runtime Worker
2925
+ * agent (with full tool set, handoffs, mutation guards) is constructed
2926
+ * fresh by `task-engine/runner-driven.ts::buildRunnerAgentChain` on every
2927
+ * run. This file retains only the declarative marker for the
2928
+ * `Constructed` admission contract since downstream consumers
2929
+ * (coding-preset / extension API) test against it.
3183
2930
  */
3184
- interface TestResult {
3185
- readonly ok: boolean;
3186
- readonly errors?: readonly string[];
3187
- readonly warnings?: readonly string[];
3188
- }
3189
2931
  /**
3190
- * Policy gate invoked once per `activate()` before the artifact is
3191
- * registered. Default rejects implicit auto-approval; the REPL surface
3192
- * binds a dialog-based policy in `packages/repl/src/common/construction-
3193
- * bootstrap.ts` so user approval flows through the live askUser channel.
3194
- *
3195
- * Modeled as a function type rather than an interface (D3 decision):
3196
- * keeps the contract surface tiny, no class boilerplate.
3197
- *
3198
- * No declarative `kodax.config.ts` override hatch is provided — see the
3199
- * "Deferred Design Decisions" section in `features/v0.7.28.md` for why
3200
- * a `risk_mode` enum (when truly needed) is preferred over user-authored
3201
- * policy functions.
2932
+ * Sentinel guardrail name used by the coding-AMA admission contract to
2933
+ * identify Constructed agents (FEATURE_087+). Kept here as the canonical
2934
+ * marker string after the V1 chain agent declarations were retired.
3202
2935
  */
3203
- type ConstructionPolicy = (artifact: ConstructionArtifact) => Promise<ConstructionPolicyVerdict>;
3204
- type ConstructionPolicyVerdict = 'approve' | 'reject' | 'ask-user';
3205
- /** Default policy: always ask the user; no implicit approvals. */
3206
- declare const defaultPolicy: ConstructionPolicy;
2936
+ declare const CODING_AGENT_MARKER = "kodax/coding-agent";
2937
+
3207
2938
  /**
3208
- * Thrown by `CtxProxy` when handler attempts to access a tool not declared
3209
- * in `capabilities.tools`. Caught in tracer; surfaces as a tool error.
2939
+ * Adapter: wrap `applyToolResultGuardrail` (the existing per-tool truncation
2940
+ * policy) as a Layer A `ToolGuardrail.afterTool`.
2941
+ *
2942
+ * FEATURE_085 (v0.7.26): the tri-layer Guardrail runtime lives in
2943
+ * `@kodax-ai/core`. The existing truncation logic in `tool-result-policy.ts`
2944
+ * predates that runtime and targets `KodaXToolExecutionContext`. Rather
2945
+ * than merge the two, we expose an adapter that coding consumers can
2946
+ * register when driving a Runner through the generic path — the adapter
2947
+ * preserves byte-exact truncation behaviour while participating in the
2948
+ * new Guardrail lifecycle (Span emission, declaration-order composition).
2949
+ *
2950
+ * **Not** registered by default. Consumers opt in via
2951
+ * `Runner.run(agent, input, { guardrails: [createToolResultTruncationGuardrail(ctx)] })`.
2952
+ * The built-in `runKodaX` preset dispatcher continues to call
2953
+ * `applyToolResultGuardrail` directly — no behavioural change there.
3210
2954
  */
3211
- declare class CapabilityDeniedError extends Error {
3212
- readonly toolName: string;
3213
- readonly declaredTools: readonly string[];
3214
- constructor(toolName: string, declaredTools: readonly string[]);
3215
- }
2955
+
2956
+ declare const TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME = "tool-result-truncation";
3216
2957
  /**
3217
- * Thrown when a manifest cannot be parsed / is missing required fields.
3218
- * Surfaces during stage() / startup glob; tracer records details.
2958
+ * Create a `ToolGuardrail` that delegates to `applyToolResultGuardrail` in
2959
+ * its `afterTool` hook. The returned guardrail does not touch the call
2960
+ * going in (no `beforeTool`).
2961
+ *
2962
+ * @param ctx The coding-layer execution context that
2963
+ * `applyToolResultGuardrail` needs (mutation tracker, persistence dir,
2964
+ * etc.). Typically created alongside the `KodaXOptions` for the run.
3219
2965
  */
3220
- declare class ConstructionManifestError extends Error {
3221
- readonly path?: string;
3222
- constructor(message: string, path?: string);
3223
- }
2966
+ declare function createToolResultTruncationGuardrail(ctx: KodaXToolExecutionContext): ToolGuardrail;
3224
2967
 
3225
2968
  /**
3226
2969
  * FEATURE_089 Phase 3.5 — Sandbox Agent Test Runner.
@@ -3722,6 +3465,149 @@ declare function hasPendingSwap(name: string): boolean;
3722
3465
  */
3723
3466
  declare function drainPendingSwaps(): readonly string[];
3724
3467
 
3468
+ /**
3469
+ * FEATURE_191 (v0.7.43) — markdown-defined agent loader.
3470
+ *
3471
+ * Scans two directories for user/project-authored agent definitions
3472
+ * (claudecode-style `<name>.md` with YAML frontmatter + body) and
3473
+ * registers them as constructed agents via `Runner.admit` →
3474
+ * `registerConstructedAgent`. Two-tier path (user first, then project)
3475
+ * with `last-write-wins` semantics implements precedence: a project
3476
+ * agent of the same name shadows the user agent (the more-specific
3477
+ * scope wins).
3478
+ *
3479
+ * Markdown shape:
3480
+ *
3481
+ * ---
3482
+ * name: db-reviewer
3483
+ * description: Reviews DB migrations for safety
3484
+ * tools: [read, grep]
3485
+ * model: claude-sonnet-4-6
3486
+ * ---
3487
+ * You are a DB migration reviewer. ...
3488
+ *
3489
+ * Files without YAML frontmatter, or with a missing `name`, are
3490
+ * silently skipped (claudecode-compatible: a `.md` without
3491
+ * frontmatter is treated as a reference doc). Files with frontmatter
3492
+ * but a missing/invalid `description` are reported as failures so the
3493
+ * REPL can surface diagnostics.
3494
+ *
3495
+ * `mcpServers` / `hooks` / `memory` / `isolation` / `permissionMode` /
3496
+ * `maxTurns` / `skills` frontmatter fields are ignored in v0.7.43 — they
3497
+ * are intentional non-goals; each one is an independent product
3498
+ * decision. Ignoring them silently keeps user `.md` files
3499
+ * forward-compatible across future feature versions.
3500
+ */
3501
+ /**
3502
+ * Per-file failure record returned to the boot caller. Mirrors
3503
+ * claudecode's `getAgentDefinitionsWithOverrides.failedFiles` shape so
3504
+ * the REPL `/agents list` diagnostic can surface per-file reasons
3505
+ * instead of a global count.
3506
+ */
3507
+ interface MarkdownLoadFailure {
3508
+ readonly path: string;
3509
+ readonly reason: string;
3510
+ }
3511
+ interface LoadAgentsFromMarkdownResult {
3512
+ readonly loaded: number;
3513
+ readonly failed: readonly MarkdownLoadFailure[];
3514
+ }
3515
+ interface LoadAgentsFromMarkdownOptions {
3516
+ /**
3517
+ * Project root. Defaults to `process.cwd()`. Project agents live at
3518
+ * `<cwd>/.kodax/agents/*.md` and override user-level agents of the
3519
+ * same name via last-write-wins (loaded second).
3520
+ */
3521
+ readonly cwd?: string;
3522
+ /**
3523
+ * Override for the user-level config home. Defaults to the agent
3524
+ * runtime's resolved config home (`getAgentConfigHome()`, e.g.
3525
+ * `~/.kodax`). User agents live at `<configHome>/agents/*.md` and
3526
+ * are loaded before project agents.
3527
+ */
3528
+ readonly configHome?: string;
3529
+ }
3530
+ /**
3531
+ * FEATURE_197 (v0.7.43) — discovered markdown agent metadata.
3532
+ *
3533
+ * Read-only counterpart to `ConstructedAgentEntry` exposed by
3534
+ * `discoverMarkdownAgents`. Differs from `ConstructedAgentEntry` in
3535
+ * three ways: (1) no resolved `Agent` runtime object — discovery is
3536
+ * purely file-system-side; (2) `source` is narrowed to the two
3537
+ * markdown scopes only; (3) `path` carries the source file location
3538
+ * so consumers can offer "open file" affordances.
3539
+ */
3540
+ interface DiscoveredMarkdownAgent {
3541
+ /** Agent name from frontmatter `name` field. */
3542
+ readonly name: string;
3543
+ /** Agent description from frontmatter `description` field. */
3544
+ readonly description: string;
3545
+ /** Provenance: which scope the file was found in. */
3546
+ readonly source: 'markdown:user' | 'markdown:project';
3547
+ /** Absolute path of the markdown file on disk. */
3548
+ readonly path: string;
3549
+ /**
3550
+ * Tool names declared in the frontmatter `tools` field, normalized
3551
+ * to a string array. The `builtin:` prefix that the loader applies
3552
+ * to `ToolRef`s is NOT applied here — discovery returns the raw
3553
+ * names the user wrote.
3554
+ */
3555
+ readonly tools?: readonly string[];
3556
+ /** Optional model alias from frontmatter `model` field. */
3557
+ readonly model?: string;
3558
+ }
3559
+ interface DiscoverMarkdownAgentsResult {
3560
+ /**
3561
+ * Well-formed agents found in the scanned directories. Same
3562
+ * last-write-wins precedence as `loadAgentsFromMarkdown`: when a
3563
+ * name appears in both user and project scopes, the project entry
3564
+ * wins and the user entry is omitted. The returned set mirrors
3565
+ * exactly what `loadAgentsFromMarkdown` would activate.
3566
+ */
3567
+ readonly agents: readonly DiscoveredMarkdownAgent[];
3568
+ /** Files that had frontmatter but failed validation. */
3569
+ readonly failed: readonly MarkdownLoadFailure[];
3570
+ }
3571
+ /**
3572
+ * Entry point. Scans user then project dirs; registers every
3573
+ * well-formed agent that passes admission. Failures are accumulated
3574
+ * into the result instead of throwing — a single malformed file must
3575
+ * not break boot.
3576
+ */
3577
+ declare function loadAgentsFromMarkdown(opts?: LoadAgentsFromMarkdownOptions): Promise<LoadAgentsFromMarkdownResult>;
3578
+ /**
3579
+ * FEATURE_197 (v0.7.43) — read-only counterpart to
3580
+ * `loadAgentsFromMarkdown`. Scans the same two-tier path (user dir
3581
+ * then project dir) and returns metadata for every well-formed
3582
+ * agent found, WITHOUT calling `Runner.admit` or
3583
+ * `registerConstructedAgent`. Pure file-system + YAML parse — no
3584
+ * mutation of the in-memory agent registry.
3585
+ *
3586
+ * SDK consumers building an "agent picker" UI call this to preview
3587
+ * available agents before deciding whether (and when) to call
3588
+ * `loadAgentsFromMarkdown` to activate them.
3589
+ *
3590
+ * Validation semantics match `loadAgentsFromMarkdown` exactly so
3591
+ * that `discoverMarkdownAgents` + `loadAgentsFromMarkdown` agree on
3592
+ * which files are well-formed:
3593
+ * - Missing/empty `description` → reported in `failed`
3594
+ * - Empty body → reported in `failed`
3595
+ * - No frontmatter / missing `name` → silently skipped (treated
3596
+ * as reference doc, claudecode parity)
3597
+ * - I/O error on a single file → reported in `failed`
3598
+ *
3599
+ * Precedence: project entries shadow user entries of the same name
3600
+ * (last-write-wins via `Map.set`), matching the loader's effective
3601
+ * activation order. Consumers wanting to see shadowed user entries
3602
+ * should run a separate pass with `cwd` pointing at a non-existent
3603
+ * dir — feature not added by default per YAGNI.
3604
+ *
3605
+ * Does NOT validate against admission invariants — discovered
3606
+ * agents may still be rejected when `loadAgentsFromMarkdown` runs
3607
+ * (e.g. unknown tool refs). Validation happens at load time.
3608
+ */
3609
+ declare function discoverMarkdownAgents(opts?: LoadAgentsFromMarkdownOptions): Promise<DiscoverMarkdownAgentsResult>;
3610
+
3725
3611
  /**
3726
3612
  * CtxProxy — runtime gate for constructed tool handlers.
3727
3613
  *
@@ -4610,5 +4496,5 @@ declare function readWindowFromEnv(): number | undefined;
4610
4496
  */
4611
4497
  declare function speculativeRace<T>(promise: Promise<T>, windowMs?: number): Promise<SpeculativeResult<T>>;
4612
4498
 
4613
- export { Agent, AgentMessage, AutoRules, CANCELLED_TOOL_RESULT_MESSAGE, CANCELLED_TOOL_RESULT_PREFIX, CODING_AGENTS, CODING_AGENT_MARKER, CODING_INVARIANTS, CODING_SUMMARY_PROMPT, CODING_UPDATE_SUMMARY_PROMPT, CapabilityDeniedError, CapabilityKind, CapabilityProvider, CapabilityResult, KodaXClient as Client, CompactionContext, CompactionPolicy, ConstructionManifestError, DEFAULT_CODING_AGENT_NAME, DEFAULT_DANGEROUS_PATTERNS, DEFAULT_HANDLER_TIMEOUT_MS, DEFAULT_RESILIENCE_CONFIG, DEFAULT_SAFE_PATTERNS, DEFAULT_SELF_MODIFY_BUDGET, DEFAULT_WINDOW_MS as DEFAULT_SPECULATIVE_WINDOW_MS, DEFAULT_TOOL_OUTPUT_MAX_BYTES, DEFAULT_TOOL_OUTPUT_MAX_LINES, EMIT_CONTRACT_TOOL_NAME, EMIT_HANDOFF_TOOL_NAME, EMIT_SCOUT_VERDICT_TOOL_NAME, EMIT_VERDICT_TOOL_NAME, ErrorCategory, FailureStage, GENERATOR_AGENT_NAME, KODAX_TOOLS, KodaXAmaControllerDecision, KodaXBaseProvider, KodaXChildContextBundle, KodaXClient, KodaXCompactMemorySeed, KodaXContentBlock, KodaXContextOptions, KodaXEvents, KodaXExecutionMode, KodaXExtensionRuntime, KodaXExtensionSessionRecord, KodaXFanoutBranchRecord, KodaXFanoutBranchTransition, KodaXFanoutSchedulerInput, KodaXFanoutSchedulerPlan, KodaXInputArtifact, KodaXJsonValue, KodaXMessage, KodaXOptions, KodaXParentReductionContract, KodaXProviderCapabilityProfile, KodaXProviderPolicyHints, KodaXReasoningCapability, KodaXReasoningMode, KodaXRepoIntelligenceCapability, KodaXRepoIntelligenceMode, KodaXRepoIntelligenceResolvedMode, KodaXRepoIntelligenceTrace, KodaXRepoRoutingSignals, KodaXResult, KodaXSessionArtifactLedgerEntry, KodaXSessionControl, KodaXSessionEntry, KodaXSessionError, KodaXSessionLabelEntry, KodaXSessionLineage, KodaXSessionMutators, KodaXSessionNavigationOptions, KodaXSessionTreeNode, KodaXTaskRoutingDecision, KodaXTaskType, KodaXTerminalError, KodaXThinkingDepth, KodaXToolDefinition, KodaXToolError, KodaXToolExecutionContext, KodaXToolUseBlock, LINEAGE_ENTRY_TYPES, LineageCompaction, LineageExtension, McpCapabilityProvider, McpProviderOptions, McpServersConfig, PLANNER_AGENT_NAME, PROMPT_SECTION_REGISTRY, PROTOCOL_EMITTER_TOOLS, ProviderExecutionState, ProviderRecoveryCoordinator, ProviderResilienceConfig, ProviderResiliencePolicy, READ_DEFAULT_LIMIT, READ_MAX_LINE_CHARS, READ_PREFLIGHT_SIZE_BYTES, REPOINTEL_DEFAULT_ENDPOINT, RecoveryDecision, RecoveryResult, ResilienceClassification, SCOUT_AGENT_NAME, SYSTEM_PROMPT, Session, SessionEntry, SessionErrorMetadata, SessionExtension, SignalCollector, StableBoundaryTracker, TASK_ENGINE_ROLE_AGENTS, TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME, ToolCallSignal, _resetRuntimeForTesting, activate, analyzeChangedScope, appendAuditEntry, appendSessionLineageLabel, applyFanoutBranchTransition, applySessionCompaction, applyToolResultGuardrail, archiveOldIslands, assignFanoutBranchWorker, bashSignalCollector, boundedRevise, budgetCeiling, buildAmaControllerDecision, buildCapabilityContextSections, buildClassifierPrompt, buildFallbackRoutingDecision, buildFanoutSchedulerPlan, buildLlmReviewPrompt, buildPromptMessageContent, buildPromptOverlay, buildPromptSnapshot, buildProviderCapabilitySnapshot, buildProviderPolicyHintsForDecision, buildProviderPolicyPromptNotes, buildRepoIntelligenceContext, buildRepoIntelligenceIndex, buildRepoOverview, buildSessionTree, buildSystemPrompt, buildSystemPromptSnapshot, checkAbsoluteDeny, checkIncompleteToolCalls, checkPromiseSignal, classify, classifyBashCommand, classifyError, classifyResilienceError, computeInputSignature, configureRuntime, convertCapabilityReadResult, convertProviderSearchResults, countActiveFanoutBranches, countActiveLineageMessages, createBashClassifierConfig, createBuiltinToolDefinition, createCtxProxy, createDefaultCodingAgent, createDenialTracker, createExtensionRuntime, createFanoutSchedulerInput, createKodaXTaskRunner, createPromptSection, createReasoningPlan, createSessionControl, createSessionLineage, createToolResultTruncationGuardrail, defaultPolicy, disableSelfModify, drainPendingSwaps, emitContract, emitHandoff, emitScoutVerdict, emitVerdict, evaluateProviderPolicy, exec, executeTool, extractArtifactLedger, extractComparableUserMessageText, extractHtmlTitle, extractPromptComparableText, extractTitleFromMessages, fileSignalCollector, finalizeRetrievalResult, findByVersion, findPreviousUserEntryId, forkSessionLineage, formatParallelDispatchResult, formatSize, generateSessionId, generatorAgent, generatorCodingAgent, getActiveExtensionRuntime, getAllRegisteredTools, getBuiltinRegisteredToolDefinition, getBuiltinToolDefinition, getDenialContext, getFanoutBranch, getImpactEstimate, getModuleContext, getProcessContext, getRegisteredToolDefinition, getRepoIntelligenceIndex, getRepoOverview, getRepoRoutingSignals, getRequiredToolParams, getSessionLineagePath, getSessionMessagesFromLineage, getSymbolContext, getTool, getToolDefinition, getToolRegistrations, getToolResultPolicy, hasPendingSwap, inferTaskType, inspectEditFailure, inspectRepoIntelligenceRuntime, isDeniedRecently, isParallelDispatchDirective, isToolFileMutation, isToolMutation, isToolPlanModeAllowed, listAll, list as listArtifacts, listBuiltinToolDefinitions, listConstructed, listToolDefinitions, listTools, loadHandler, markFanoutBranchCancelled, markFanoutBranchCompleted, mergeArtifactLedger, orderPromptSections, parseClassifierOutput, parseEditToolError, parseLlmReviewVerdict, parseModelSpec, persistToolOutput, plannerAgent, plannerCodingAgent, prewarmRepoIntelligenceCaches, readArtifact, readAuditEntries, readBudget, readDisableState, readWindowFromEnv as readSpeculativeWindowFromEnv, reasoningModeToDepth, reconstructMessagesWithToolGuard, recordDenial, registerCodingInvariants, registerConfiguredMcpCapabilityProvider, registerOfficialSandboxExtension, registerTool, rehydrateActiveArtifacts, remaining as remainingSelfModifyBudget, renderChangedScope, renderImpactEstimate, renderModuleContext, renderProcessContext, renderPromptSections, renderRepoOverview, renderRetrievalResult, renderSymbolContext, resetBudget, resolveClassifierModel, resolveConstructedAgent, resolveReasoningMode, resolveRepoIntelligenceMode, resolveRepoIntelligenceRuntimeConfig, resolveResilienceConfig, resolveSessionLineageTarget, resolveToolCapability, revoke, rewindSessionLineage, rollbackSelfModify, runAstRules, runKodaX, runLlmReview, runManagedTask, runOrchestration, scoutAgent, scoutCodingAgent, setActiveExtensionRuntime, setSessionLineageActiveEntry, speculativeRace, stage, startKodaX, stripAssistantText, stripHtmlToText, test as testArtifact, toolAskUserQuestion, toolBash, toolChangedDiff, toolChangedScope, toolCodeSearch, toolEdit, toolGlob, toolGrep, toolImpactEstimate, toolInsertAfterAnchor, toolModuleContext, toolPermission, toolProcessContext, toolRead, toolRepoOverview, toolSemanticLookup, toolSymbolContext, toolUndo, toolWebFetch, toolWebSearch, toolWrite, truncateHead, truncateLine, truncateTail, validateSubtaskIndependence, validateToolSchemaForProvider, warmRepoIntelligenceRuntime, webhook };
4614
- export type { AbsoluteDenyMatch, AbsoluteDenyMiss, AbsoluteDenyResult, AgentArtifact, ArtifactStatus, AstCheckResult, AstRuleId, AstRuleViolation, AuditEntry, AuditEventKind, BashClassificationResult, BashClassifierConfig, BashRiskLevel, BudgetState, BuildClassifierPromptInput, BuildPromptInput, Capabilities, ChangedFileEntry, ChangedFileStatus, ChangedScopeAreaSummary, ChangedScopeReport, ClassifierDecision, ClassifierPrompt, ClassifyDecision, ClassifyOptions, ConstructionArtifact, ConstructionPolicy, ConstructionPolicyVerdict, CreateCtxProxyOptions, CreateKodaXTaskRunnerOptions, DenialRecord, DenialTracker, DisableState, EditRecoveryDiagnostic, EditToolErrorCode, ErrorClassification, ExecOptions, ExecResult, ExtensionCommandContext, ExtensionCommandDefinition, ExtensionCommandInvocation, ExtensionCommandResult, ExtensionContributionSource, ExtensionEventMap, ExtensionFailureDiagnostic, ExtensionFailureStage, ExtensionHookMap, ExtensionLoadSource, ExtensionLogger, ExtensionRuntimeController, ExtensionRuntimeDiagnostics, ExtensionToolBeforeHookContext, ImpactEstimateResult, KodaXAgentWorkerSpec, KodaXExtensionAPI, KodaXExtensionActivationResult, KodaXExtensionModule, KodaXPromptSection, KodaXPromptSectionDefinition, KodaXPromptSectionSlot, KodaXPromptSectionStability, KodaXPromptSnapshot, KodaXPromptSnapshotMetadata, KodaXProviderCapabilitySnapshot, KodaXProviderPolicyDecision, KodaXProviderPolicyIssue, KodaXProviderPolicyIssueSeverity, KodaXProviderSourceKind, KodaXRetrievalArtifact, KodaXRetrievalFreshness, KodaXRetrievalItem, KodaXRetrievalResult, KodaXRetrievalScope, KodaXRetrievalToolName, KodaXRetrievalTrust, LanguageCapabilityTier, LineageArtifactLedgerPayload, LineageCompactionDelegates, LineageEntryType, LineageLabelPayload, LineageTreeNode, LlmReviewClient, LlmReviewResult, LlmReviewVerdict, LoadHandlerOptions, LoadHandlerScope, LoadedExtensionDiagnostic, LocalToolDefinition, ModelProviderRegistration, ModuleCapsule, ModuleContextResult, OfficialSandboxMode, OfficialSandboxOptions, OrchestrationArtifact, OrchestrationCompletedTask, OrchestrationRunEvents, OrchestrationRunOptions, OrchestrationRunResult, OrchestrationTaskBudget, OrchestrationTaskContext, OrchestrationTaskExecution, OrchestrationTaskStatus, OrchestrationTraceEvent, OrchestrationWorkerResult, OrchestrationWorkerRunner, OrchestrationWorkerSpec, ParallelDispatchDirective, ParallelDispatchResult, ParallelSubtask, ParsedModelSpec, ProcessCapsule, ProcessContextResult, ProcessStep, ProtocolEmitterMetadata, RegisteredCapabilityProviderDiagnostic, RegisteredCommandDiagnostic, RegisteredHookDiagnostic, RegisteredToolDefinition, RegisteredToolDiagnostic, RepoAreaKind, RepoAreaOverview, RepoIntelligenceIndex, RepoIntelligenceRuntimeInspection, RepoIntelligenceRuntimeWarmResult, RepoLanguageId, RepoLanguageSupport, RepoOverview, RepoSymbolKind, RepoSymbolRecord, RepoSymbolReference, ResolveClassifierModelOptions, ResolveSource, ResolvedClassifierModel, RollbackResult, RunningSession, SchemaProvider, SchemaValidationResult, ScriptSource, SelfModifyAskUser, SelfModifyAskUserInput, SelfModifyDiffSeverity, SelfModifyDiffSummary, SpeculativeResult, StagedHandle, StripOptions, SymbolContextResult, TestArtifactOptions, TestResult, TierZeroPatternId, ToolContent, ToolDefinitionSource, ToolHandler, ToolRegistrationOptions, ToolRegistry, ToolSideEffect, WebhookOptions, WebhookResult };
4499
+ export { Agent, AgentMessage, AutoRules, CANCELLED_TOOL_RESULT_MESSAGE, CANCELLED_TOOL_RESULT_PREFIX, CODING_AGENT_MARKER, CODING_INVARIANTS, CODING_SUMMARY_PROMPT, CODING_UPDATE_SUMMARY_PROMPT, CapabilityDeniedError, CapabilityKind, CapabilityProvider, CapabilityResult, KodaXClient as Client, ConstructionManifestError, DEFAULT_CODING_AGENT_NAME, DEFAULT_DANGEROUS_PATTERNS, DEFAULT_HANDLER_TIMEOUT_MS, DEFAULT_RESILIENCE_CONFIG, DEFAULT_SAFE_PATTERNS, DEFAULT_SELF_MODIFY_BUDGET, DEFAULT_WINDOW_MS as DEFAULT_SPECULATIVE_WINDOW_MS, DEFAULT_TOOL_OUTPUT_MAX_BYTES, DEFAULT_TOOL_OUTPUT_MAX_LINES, EMIT_VERDICT_TOOL_NAME, ErrorCategory, FailureStage, GENERATOR_AGENT_NAME, KODAX_TOOLS, KodaXAmaControllerDecision, KodaXBaseProvider, KodaXChildContextBundle, KodaXClient, KodaXContentBlock, KodaXContextOptions, KodaXEvents, KodaXExecutionMode, KodaXExtensionRuntime, KodaXExtensionSessionRecord, KodaXFanoutBranchRecord, KodaXFanoutBranchTransition, KodaXFanoutSchedulerInput, KodaXFanoutSchedulerPlan, KodaXInputArtifact, KodaXJsonValue, KodaXMessage, KodaXOptions, KodaXParentReductionContract, KodaXProviderCapabilityProfile, KodaXProviderPolicyHints, KodaXReasoningCapability, KodaXReasoningMode, KodaXRepoIntelligenceCapability, KodaXRepoIntelligenceMode, KodaXRepoIntelligenceResolvedMode, KodaXRepoIntelligenceTrace, KodaXRepoRoutingSignals, KodaXResult, KodaXSessionControl, KodaXSessionError, KodaXSessionMutators, KodaXTaskRoutingDecision, KodaXTaskType, KodaXTerminalError, KodaXThinkingDepth, KodaXToolDefinition, KodaXToolError, KodaXToolExecutionContext, KodaXToolUseBlock, McpCapabilityProvider, McpProviderOptions, McpServersConfig, PLANNER_AGENT_NAME, PROMPT_SECTION_REGISTRY, PROTOCOL_EMITTER_TOOLS, ProviderExecutionState, ProviderRecoveryCoordinator, ProviderResilienceConfig, ProviderResiliencePolicy, READ_DEFAULT_LIMIT, READ_MAX_LINE_CHARS, READ_PREFLIGHT_SIZE_BYTES, REPOINTEL_DEFAULT_ENDPOINT, RecoveryDecision, RecoveryResult, ResilienceClassification, SCOUT_AGENT_NAME, SYSTEM_PROMPT, SessionErrorMetadata, SignalCollector, StableBoundaryTracker, TASK_ENGINE_ROLE_AGENTS, TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME, ToolCallSignal, WORKER_AGENT_NAME, _resetRuntimeForTesting, activate, analyzeChangedScope, appendAuditEntry, applyFanoutBranchTransition, applyToolResultGuardrail, assignFanoutBranchWorker, bashSignalCollector, boundedRevise, budgetCeiling, buildAmaControllerDecision, buildCapabilityContextSections, buildClassifierPrompt, buildFallbackRoutingDecision, buildFanoutSchedulerPlan, buildLlmReviewPrompt, buildPromptMessageContent, buildPromptOverlay, buildPromptSnapshot, buildProviderCapabilitySnapshot, buildProviderPolicyHintsForDecision, buildProviderPolicyPromptNotes, buildRepoIntelligenceContext, buildRepoIntelligenceIndex, buildRepoOverview, buildSystemPrompt, buildSystemPromptSnapshot, checkAbsoluteDeny, checkIncompleteToolCalls, checkPromiseSignal, classify, classifyBashCommand, classifyError, classifyResilienceError, computeInputSignature, configureRuntime, convertCapabilityReadResult, convertProviderSearchResults, countActiveFanoutBranches, createBashClassifierConfig, createBuiltinToolDefinition, createCtxProxy, createDefaultCodingAgent, createDenialTracker, createExtensionRuntime, createFanoutSchedulerInput, createKodaXTaskRunner, createPromptSection, createReasoningPlan, createSessionControl, createToolResultTruncationGuardrail, defaultPolicy, disableSelfModify, discoverMarkdownAgents, drainPendingSwaps, emitVerdict, evaluateProviderPolicy, exec, executeTool, extractComparableUserMessageText, extractHtmlTitle, extractPromptComparableText, fileSignalCollector, finalizeRetrievalResult, findByVersion, formatParallelDispatchResult, formatSize, getActiveExtensionRuntime, getAllRegisteredTools, getBuiltinRegisteredToolDefinition, getBuiltinToolDefinition, getDenialContext, getFanoutBranch, getImpactEstimate, getModuleContext, getProcessContext, getRegisteredToolDefinition, getRepoIntelligenceIndex, getRepoOverview, getRepoRoutingSignals, getRequiredToolParams, getSymbolContext, getTool, getToolDefinition, getToolRegistrations, getToolResultPolicy, hasPendingSwap, inferTaskType, inspectEditFailure, inspectRepoIntelligenceRuntime, isDeniedRecently, isParallelDispatchDirective, isToolFileMutation, isToolMutation, isToolPlanModeAllowed, listAll, list as listArtifacts, listBuiltinToolDefinitions, listConstructed, listToolDefinitions, listTools, loadAgentsFromMarkdown, loadHandler, markFanoutBranchCancelled, markFanoutBranchCompleted, orderPromptSections, parseClassifierOutput, parseEditToolError, parseLlmReviewVerdict, parseModelSpec, persistToolOutput, prewarmRepoIntelligenceCaches, readArtifact, readAuditEntries, readBudget, readDisableState, readWindowFromEnv as readSpeculativeWindowFromEnv, reasoningModeToDepth, reconstructMessagesWithToolGuard, recordDenial, registerCodingInvariants, registerConfiguredMcpCapabilityProvider, registerOfficialSandboxExtension, registerTool, rehydrateActiveArtifacts, remaining as remainingSelfModifyBudget, renderChangedScope, renderImpactEstimate, renderModuleContext, renderProcessContext, renderPromptSections, renderRepoOverview, renderRetrievalResult, renderSymbolContext, resetBudget, resolveClassifierModel, resolveConstructedAgent, resolveReasoningMode, resolveRepoIntelligenceMode, resolveRepoIntelligenceRuntimeConfig, resolveResilienceConfig, resolveToolCapability, revoke, rollbackSelfModify, runAstRules, runKodaX, runLlmReview, runManagedTask, runOrchestration, setActiveExtensionRuntime, speculativeRace, stage, startKodaX, stripAssistantText, stripHtmlToText, test as testArtifact, toolAskUserQuestion, toolBash, toolChangedDiff, toolChangedScope, toolCodeSearch, toolEdit, toolGlob, toolGrep, toolImpactEstimate, toolInsertAfterAnchor, toolModuleContext, toolPermission, toolProcessContext, toolRead, toolRepoOverview, toolSemanticLookup, toolSymbolContext, toolUndo, toolWebFetch, toolWebSearch, toolWrite, truncateHead, truncateLine, truncateTail, validateSubtaskIndependence, validateToolSchemaForProvider, warmRepoIntelligenceRuntime, webhook, workerAgent };
4500
+ export type { AbsoluteDenyMatch, AbsoluteDenyMiss, AbsoluteDenyResult, AgentArtifact, ArtifactStatus, AstCheckResult, AstRuleId, AstRuleViolation, AuditEntry, AuditEventKind, BashClassificationResult, BashClassifierConfig, BashRiskLevel, BudgetState, BuildClassifierPromptInput, BuildPromptInput, Capabilities, ChangedFileEntry, ChangedFileStatus, ChangedScopeAreaSummary, ChangedScopeReport, ClassifierDecision, ClassifierPrompt, ClassifyDecision, ClassifyOptions, ConstructionArtifact, ConstructionPolicy, ConstructionPolicyVerdict, CreateCtxProxyOptions, CreateKodaXTaskRunnerOptions, DenialRecord, DenialTracker, DisableState, DiscoverMarkdownAgentsResult, DiscoveredMarkdownAgent, EditRecoveryDiagnostic, EditToolErrorCode, ErrorClassification, ExecOptions, ExecResult, ExtensionCommandContext, ExtensionCommandDefinition, ExtensionCommandInvocation, ExtensionCommandResult, ExtensionContributionSource, ExtensionEventMap, ExtensionFailureDiagnostic, ExtensionFailureStage, ExtensionHookMap, ExtensionLoadSource, ExtensionLogger, ExtensionRuntimeController, ExtensionRuntimeDiagnostics, ExtensionToolBeforeHookContext, ImpactEstimateResult, KodaXAgentWorkerSpec, KodaXExtensionAPI, KodaXExtensionActivationResult, KodaXExtensionModule, KodaXPromptSection, KodaXPromptSectionDefinition, KodaXPromptSectionSlot, KodaXPromptSectionStability, KodaXPromptSnapshot, KodaXPromptSnapshotMetadata, KodaXProviderCapabilitySnapshot, KodaXProviderPolicyDecision, KodaXProviderPolicyIssue, KodaXProviderPolicyIssueSeverity, KodaXProviderSourceKind, KodaXRetrievalArtifact, KodaXRetrievalFreshness, KodaXRetrievalItem, KodaXRetrievalResult, KodaXRetrievalScope, KodaXRetrievalToolName, KodaXRetrievalTrust, LanguageCapabilityTier, LlmReviewClient, LlmReviewResult, LlmReviewVerdict, LoadAgentsFromMarkdownOptions, LoadAgentsFromMarkdownResult, LoadHandlerOptions, LoadHandlerScope, LoadedExtensionDiagnostic, LocalToolDefinition, MarkdownLoadFailure, ModelProviderRegistration, ModuleCapsule, ModuleContextResult, OfficialSandboxMode, OfficialSandboxOptions, OrchestrationArtifact, OrchestrationCompletedTask, OrchestrationRunEvents, OrchestrationRunOptions, OrchestrationRunResult, OrchestrationTaskBudget, OrchestrationTaskContext, OrchestrationTaskExecution, OrchestrationTaskStatus, OrchestrationTraceEvent, OrchestrationWorkerResult, OrchestrationWorkerRunner, OrchestrationWorkerSpec, ParallelDispatchDirective, ParallelDispatchResult, ParallelSubtask, ParsedModelSpec, ProcessCapsule, ProcessContextResult, ProcessStep, ProtocolEmitterMetadata, RegisteredCapabilityProviderDiagnostic, RegisteredCommandDiagnostic, RegisteredHookDiagnostic, RegisteredToolDefinition, RegisteredToolDiagnostic, RepoAreaKind, RepoAreaOverview, RepoIntelligenceIndex, RepoIntelligenceRuntimeInspection, RepoIntelligenceRuntimeWarmResult, RepoLanguageId, RepoLanguageSupport, RepoOverview, RepoSymbolKind, RepoSymbolRecord, RepoSymbolReference, ResolveClassifierModelOptions, ResolveSource, ResolvedClassifierModel, RollbackResult, RunningSession, SchemaProvider, SchemaValidationResult, ScriptSource, SelfModifyAskUser, SelfModifyAskUserInput, SelfModifyDiffSeverity, SelfModifyDiffSummary, SpeculativeResult, StagedHandle, StripOptions, SymbolContextResult, TestArtifactOptions, TestResult, TierZeroPatternId, ToolContent, ToolDefinitionSource, ToolHandler, ToolRegistrationOptions, ToolRegistry, ToolSideEffect, WebhookOptions, WebhookResult };