@kodax-ai/kodax 0.7.62 → 0.7.66

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 (81) hide show
  1. package/CHANGELOG.md +2300 -2145
  2. package/README.md +81 -9
  3. package/README_CN.md +54 -5
  4. package/dist/chunks/{agent-4ZMCIEGD.js → agent-KER4WDNO.js} +1 -1
  5. package/dist/chunks/argument-completer-HK3MHA3K.js +2 -0
  6. package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
  7. package/dist/chunks/chunk-3HKBBY74.js +339 -0
  8. package/dist/chunks/chunk-AKBH2EEE.js +8 -0
  9. package/dist/chunks/{chunk-OGRJQGKO.js → chunk-ALS32RNZ.js} +1 -1
  10. package/dist/chunks/chunk-MHRN2LQV.js +328 -0
  11. package/dist/chunks/{chunk-JILSZHCQ.js → chunk-NBQW7PNZ.js} +2 -2
  12. package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
  13. package/dist/chunks/chunk-ONUPGMER.js +2 -0
  14. package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
  15. package/dist/chunks/{chunk-AY3BLB4Q.js → chunk-QAQ2HNXD.js} +112 -112
  16. package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
  17. package/dist/chunks/chunk-QJVZZSEO.js +56 -0
  18. package/dist/chunks/chunk-TLJGOKBT.js +729 -0
  19. package/dist/chunks/{chunk-6HTR3GHZ.js → chunk-VS4CDDEF.js} +245 -245
  20. package/dist/chunks/chunk-WBBEJIAY.js +306 -0
  21. package/dist/chunks/{chunk-HO6P6CPU.js → chunk-WMIZCY2J.js} +1 -1
  22. package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
  23. package/dist/chunks/compaction-config-7GMUFNPB.js +2 -0
  24. package/dist/chunks/{construction-bootstrap-4ZNFZFX2.js → construction-bootstrap-3XDS2D5K.js} +1 -1
  25. package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
  26. package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
  27. package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
  28. package/dist/chunks/dist-4YAYT2TO.js +2 -0
  29. package/dist/chunks/host-KG3456QP.js +2 -0
  30. package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
  31. package/dist/chunks/run-manager-6CAH3KTA.js +2 -0
  32. package/dist/chunks/utils-OT5ENFUL.js +2 -0
  33. package/dist/constructed-handler-worker.js +2 -0
  34. package/dist/index.d.ts +22 -11
  35. package/dist/index.js +6 -6
  36. package/dist/kodax_cli.js +1117 -1090
  37. package/dist/runtime-worker.js +2843 -0
  38. package/dist/sdk-agent.d.ts +29 -10
  39. package/dist/sdk-agent.js +1 -1
  40. package/dist/sdk-coding.d.ts +108 -1091
  41. package/dist/sdk-coding.js +1 -1
  42. package/dist/sdk-llm.js +1 -1
  43. package/dist/sdk-mcp.d.ts +2 -1
  44. package/dist/sdk-mcp.js +1 -1
  45. package/dist/sdk-media.js +1 -1
  46. package/dist/sdk-repl.d.ts +198 -184
  47. package/dist/sdk-repl.js +2 -2
  48. package/dist/sdk-runtime.d.ts +982 -0
  49. package/dist/sdk-runtime.js +2 -0
  50. package/dist/sdk-session.d.ts +4 -4
  51. package/dist/sdk-session.js +1 -1
  52. package/dist/sdk-skills.js +1 -1
  53. package/dist/semantic-worker.js +191 -10
  54. package/dist/types-chunks/{bash-prefix-extractor.d-Do_TCAmA.d.ts → bash-prefix-extractor.d-BjkITAva.d.ts} +266 -4
  55. package/dist/types-chunks/{run-manager.d-CYY3pZeJ.d.ts → capsule.d-hVhPNkHd.d.ts} +9 -107
  56. package/dist/types-chunks/commands.d-C3B1TdGM.d.ts +213 -0
  57. package/dist/types-chunks/{types.d-DFf4Sfys.d.ts → guardrail.d-C_Siraua.d.ts} +3 -128
  58. package/dist/types-chunks/{guardrail.d-DRp0Lqvx.d.ts → guardrail.d-wk-s0psS.d.ts} +3 -3
  59. package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
  60. package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
  61. package/dist/types-chunks/{process.d-DXkRD7hj.d.ts → process.d-CY2g03Mb.d.ts} +11 -4
  62. package/dist/types-chunks/public-api.d-jtREVfEq.d.ts +596 -0
  63. package/dist/types-chunks/run-manager.d-CFknOfo1.d.ts +91 -0
  64. package/dist/types-chunks/{sdk-session-BGGOC0cT.d.ts → sdk-session-CLqyfAmf.d.ts} +8 -304
  65. package/dist/types-chunks/types.d-BMLxKV69.d.ts +128 -0
  66. package/dist/types-chunks/types.d-CUN_bZU7.d.ts +975 -0
  67. package/dist/types-chunks/{utils.d-ChOEH3NF.d.ts → utils.d-C1rpoeDh.d.ts} +84 -72
  68. package/package.json +7 -1
  69. package/dist/chunks/argument-completer-5PWSKFKI.js +0 -2
  70. package/dist/chunks/chunk-2F4R7WM7.js +0 -52
  71. package/dist/chunks/chunk-3KD26NCI.js +0 -310
  72. package/dist/chunks/chunk-E2Q4RIOD.js +0 -731
  73. package/dist/chunks/chunk-S4ISEA6F.js +0 -341
  74. package/dist/chunks/chunk-V4WSBIXB.js +0 -2
  75. package/dist/chunks/chunk-WFE6FBQ2.js +0 -326
  76. package/dist/chunks/compaction-config-SP3REMFR.js +0 -2
  77. package/dist/chunks/dist-IKWRJW6J.js +0 -2
  78. package/dist/chunks/host-XL5CH7QP.js +0 -2
  79. package/dist/chunks/run-manager-UXIPDVVF.js +0 -2
  80. package/dist/chunks/utils-XKWEVPE3.js +0 -2
  81. package/dist/types-chunks/storage.d-C3umBC4g.d.ts +0 -280
@@ -1,28 +1,35 @@
1
- import { a0 as KodaXToolDefinition, a2 as KodaXToolResultContentItem, a8 as KodaXWireReasoningEffort, j as KodaXMessage, a5 as KodaXToolUseBlock, c as KodaXContentBlock, o as KodaXProviderCapabilityProfile, A as KodaXReasoningCapability, E as KodaXReasoningMode, U as KodaXTaskType, e as KodaXExecutionMode, T as KodaXTaskRoutingDecision, Z as KodaXThinkingDepth, $ as KodaXTokenUsage } from './types-chunks/types.d-Bp4Lm1jv.js';
1
+ import { a0 as KodaXToolDefinition, a2 as KodaXToolResultContentItem, a5 as KodaXToolUseBlock, c as KodaXContentBlock, j as KodaXMessage, o as KodaXProviderCapabilityProfile, A as KodaXReasoningCapability, E as KodaXReasoningMode, U as KodaXTaskType, e as KodaXExecutionMode, T as KodaXTaskRoutingDecision, a8 as KodaXWireReasoningEffort, Z as KodaXThinkingDepth, $ as KodaXTokenUsage } from './types-chunks/types.d-Bp4Lm1jv.js';
2
2
  export { b as KodaXChildFanoutClass, d as KodaXCustomProviderConfig, h as KodaXImageBlock, k as KodaXModelDescriptor, m as KodaXNormalizedReasoningRequest, n as KodaXProtocolFamily, p as KodaXProviderConfig, r as KodaXProviderConversationSemantics, u as KodaXProviderMcpSupport, x as KodaXProviderStreamOptions, z as KodaXProviderTransport, B as KodaXReasoningEffortPreset, C as KodaXReasoningEffortRequest, D as KodaXReasoningEffortWireStrategy, F as KodaXReasoningProfile, G as KodaXReasoningRequest, H as KodaXRedactedThinkingBlock, I as KodaXReviewScale, J as KodaXRiskLevel, L as KodaXStableEffortIntent, M as KodaXStreamResult, O as KodaXTaskBudgetOverrides, R as KodaXTaskResultMetadata, S as KodaXTaskResultSource, W as KodaXTextBlock, X as KodaXThinkingBlock, Y as KodaXThinkingBudgetMap, _ as KodaXThinkingWireStrategy, a1 as KodaXToolResultBlock } from './types-chunks/types.d-Bp4Lm1jv.js';
3
3
  export { K as KODAX_DEFAULT_PROVIDER, b as KODAX_PROVIDERS, c as KODAX_PROVIDER_SNAPSHOTS, d as KODAX_REASONING_MODE_SEQUENCE, f as KODAX_STABLE_EFFORT_INTENTS, g as KodaXAnthropicCompatProvider, h as KodaXError, i as KodaXModelCapabilities, k as KodaXOpenAICompatProvider, l as KodaXProviderError, m as KodaXRateLimitError, P as ProviderName, R as ResolveWireEffortInput, o as ResolvedWireEffort, q as clearRuntimeModelProviders, r as createCustomProvider, s as effortToLegacyReasoningMode, t as getAvailableProviderNames, u as getCustomModelCapabilities, v as getCustomProvider, w as getCustomProviderList, x as getCustomProviderModelDescriptors, y as getCustomProviderModels, z as getCustomProviderNames, B as getModelCapabilities, C as getProvider, D as getProviderConfiguredCapabilityProfile, E as getProviderConfiguredReasoningCapability, F as getProviderList, G as getProviderModel, H as getProviderModelDescriptors, I as getProviderModels, L as getRuntimeModelProvider, M as getRuntimeModelProviderNames, N as isCustomProviderName, O as isKnownProvider, Q as isProviderConfigured, S as isProviderName, U as isRuntimeModelProviderName, V as listAllModelCapabilities, W as listBuiltinModelCapabilities, X as listCustomProviderModelCapabilities, _ as mapLegacyReasoningModeToEffortIntent, $ as normalizeReasoningEffortValue, a1 as parseReasoningEffortEnv, a2 as registerCustomProviders, a3 as registerModelProvider, a4 as resolveModelCapabilities, a5 as resolveProvider, a6 as resolveProviderModelDescriptors, a7 as resolveReasoningEffort, a8 as resolveReasoningEffortForModelSwitch, aa as resolveWireEffort, ab as validateCustomProviderConfig } from './types-chunks/resolver.d-CGkfRULj.js';
4
4
  import { a as CostTracker } from './types-chunks/cost-tracker.d-CBLk1fiD.js';
5
5
  export { K as KodaXLlmTimeoutConfig, p as parseTimeoutSecEnvMs, t as timeoutSecToMs } from './types-chunks/cost-tracker.d-CBLk1fiD.js';
6
6
  import { K as KodaXBaseProvider } from './types-chunks/base.d-DalIRhbb.js';
7
- import { C as CapabilityKind, a as CapabilityProvider, b as CapabilityResult } from './types-chunks/capability.d-3C62G8Eq.js';
8
- import { ap as KodaXToolExecutionContext, aW as ToolSideEffect, U as KodaXRepoIntelligenceCapability, X as KodaXRepoIntelligenceTrace, V as KodaXRepoIntelligenceMode, W as KodaXRepoIntelligenceResolvedMode, Z as KodaXRepoRoutingSignals, Q as KodaXOptions, u as KodaXContextOptions, T as KodaXProviderPolicyHints, aH as ProviderResilienceConfig, aI as ProviderResiliencePolicy, F as FailureStage, aN as ResilienceClassification, aF as ProviderExecutionState, aK as RecoveryDecision, aM as RecoveryResult, _ as KodaXResult, a2 as KodaXSessionControl, a3 as KodaXSessionMutators, A as KodaXManagedProtocolPayload, E as ExtensionRuntimeContract, aS as RuntimeDefaultsSnapshot, c as BoundExtensionRuntimeController, x as KodaXEvents, g as GoalCompleteResult, aP as ResolveKodaXManualInput, aQ as ResolveKodaXManualOptions, aR as ResolveKodaXManualResult, N as KodaXManualTopicId, M as KodaXManualTopic, d as ChildSnapshotEvent, r as KodaXChildContextBundle, s as KodaXChildExecutionResult, aX as WorkflowHostPolicy, an as KodaXTimeoutConfig } from './types-chunks/bash-prefix-extractor.d-Do_TCAmA.js';
9
- export { B as BASH_POLICY_SPEC, a as BashPrefixExtractor, b as BashPrefixResult, C as CapabilityRuntimeContract, e as CreateBashPrefixExtractorOptions, D as DiagnosticsRequest, f as ExtractCommandPrefixOptions, G as GoalBlockedResult, h as GoalCreateInput, i as GoalLifecycleContext, j as GoalRuntimeBinding, k as GoalRuntimeBindingDeps, l as GoalToolsContext, K as KodaXActivityEventMeta, m as KodaXAgentMode, n as KodaXAgentProfile, o as KodaXBudgetDisclosureZone, p as KodaXBudgetExtensionRequest, q as KodaXChildAgentResult, t as KodaXCompactionOverride, v as KodaXContextTokenSnapshot, w as KodaXEffectiveTaskConfig, y as KodaXLiveEventMeta, z as KodaXManagedBudgetSnapshot, H as KodaXManagedTask, I as KodaXManagedTaskRuntimeState, J as KodaXManagedTaskStatusEvent, L as KodaXManualSource, O as KodaXManualTopicInput, P as KodaXMemoryStrategy, R as KodaXOrchestrationVerdict, S as KodaXParentReductionContract, Y as KodaXRepoIntelligenceTraceEvent, $ as KodaXRoleRoundSummary, a0 as KodaXRuntimeVerificationContract, a1 as KodaXSelfManualConfig, a4 as KodaXSessionOptions, a5 as KodaXSidecarMessageEvent, a6 as KodaXSkillDynamicContextPolicy, a7 as KodaXSkillInvocationContext, a8 as KodaXSkillMap, a9 as KodaXSkillProjectionConfidence, aa as KodaXTaskCapabilityHint, ab as KodaXTaskContract, ac as KodaXTaskEvidenceArtifact, ad as KodaXTaskEvidenceBundle, ae as KodaXTaskEvidenceEntry, af as KodaXTaskRole, ag as KodaXTaskRoleAssignment, ah as KodaXTaskStatus, ai as KodaXTaskSurface, aj as KodaXTaskToolPolicy, ak as KodaXTaskVerificationContract, al as KodaXTaskVerificationCriterion, am as KodaXTaskWorkItem, ao as KodaXToolEventMeta, aq as KodaXToolVisibilityMeta, ar as KodaXToolVisibilityPolicy, as as KodaXTurnCompletedEvent, at as KodaXTurnDeliveryKind, au as KodaXTurnFailedEvent, av as KodaXTurnStartedEvent, aw as KodaXVerificationScorecard, ax as KodaXVerificationScorecardCriterion, ay as KodaXWorkflowAgentDigestEvent, az as KodaXWorkflowEventMeta, aA as KodaXWorkflowTimeoutConfig, aB as LSP_SERVERS, aC as LspServerInfo, aD as LspService, aE as LspServiceConfig, aG as ProviderRecoveryEvent, aJ as RecoveryAction, aL as RecoveryLadderStep, aO as ResilienceErrorClass, aT as TodoItem, aU as TodoList, aV as TodoStatus, aY as WorkflowInvocationAction, aZ as WorkflowInvocationPolicyDecision, a_ as WorkflowInvocationPolicyInput, a$ as WorkflowInvocationSource, b0 as WorkflowRunProgressView, b1 as WorkflowStartOutcome, b2 as WorkflowToolHost, b3 as WorkflowToolHostInlineInput, b4 as WorkflowToolHostResult, b5 as WorkflowToolHostStartResult, b6 as buildGoalRuntimeBinding, b7 as createBashPrefixExtractor, b8 as decideWorkflowInvocation, b9 as extractCommandPrefix, ba as getDefaultLspService, bb as makeDisabledGoalToolsContext, bc as providerResilienceConfigFromTimeouts, bd as shutdownDefaultLspService, be as withGoalBeforeNextTurn, bf as withGoalStopHook, bg as workflowStartOutcomeConsumesTurn } from './types-chunks/bash-prefix-extractor.d-Do_TCAmA.js';
7
+ import { b as CapabilityResult, a as CapabilityProvider } from './types-chunks/capability.d-3C62G8Eq.js';
8
+ export { C as CapabilityKind } from './types-chunks/capability.d-3C62G8Eq.js';
9
+ import { aw as KodaXToolExecutionContext, t as KodaXAgentScope, b3 as RuntimeContextPressure, b0 as RuntimeContextBudgetSnapshot, $ as KodaXRepoIntelligenceCapability, a2 as KodaXRepoIntelligenceTrace, a0 as KodaXRepoIntelligenceMode, a1 as KodaXRepoIntelligenceResolvedMode, a4 as KodaXRepoRoutingSignals, X as KodaXOptions, H as KodaXContextOptions, _ as KodaXProviderPolicyHints, aO as ProviderResilienceConfig, aP as ProviderResiliencePolicy, F as FailureStage, aU as ResilienceClassification, aM as ProviderExecutionState, aR as RecoveryDecision, aT as RecoveryResult, a5 as KodaXResult, a9 as KodaXSessionControl, aa as KodaXSessionMutators, O as KodaXManagedProtocolPayload, E as ExtensionRuntimeContract, b4 as RuntimeDefaultsSnapshot, c as BoundExtensionRuntimeController, L as KodaXEvents, l as GoalCompleteResult, aW as ResolveKodaXManualInput, aX as ResolveKodaXManualOptions, aY as ResolveKodaXManualResult, U as KodaXManualTopicId, T as KodaXManualTopic, d as ChildSnapshotEvent, x as KodaXChildContextBundle, y as KodaXChildExecutionResult, be as WorkflowHostPolicy, au as KodaXTimeoutConfig } from './types-chunks/bash-prefix-extractor.d-BjkITAva.js';
10
+ export { A as ALWAYS_RESIDENT_TOOL_NAMES, B as BASH_POLICY_SPEC, a as BashPrefixExtractor, b as BashPrefixResult, C as CapabilityRuntimeContract, e as CompactionAntiThrashConfig, f as CompactionAntiThrashState, g as CompactionSavingsDecision, h as CompactionSavingsSample, i as CompactionSkipReason, j as CreateBashPrefixExtractorOptions, D as DiagnosticsRequest, k as ExtractCommandPrefixOptions, G as GoalBlockedResult, m as GoalCreateInput, n as GoalLifecycleContext, o as GoalRuntimeBinding, p as GoalRuntimeBindingDeps, q as GoalToolsContext, K as KodaXActivityEventMeta, r as KodaXAgentMode, s as KodaXAgentProfile, u as KodaXBudgetDisclosureZone, v as KodaXBudgetExtensionRequest, w as KodaXChildAgentResult, z as KodaXCompactionOverride, I as KodaXContextTokenSnapshot, J as KodaXEffectiveTaskConfig, M as KodaXLiveEventMeta, N as KodaXManagedBudgetSnapshot, P as KodaXManagedTask, Q as KodaXManagedTaskRuntimeState, R as KodaXManagedTaskStatusEvent, S as KodaXManualSource, V as KodaXManualTopicInput, W as KodaXMemoryStrategy, Y as KodaXOrchestrationVerdict, Z as KodaXParentReductionContract, a3 as KodaXRepoIntelligenceTraceEvent, a6 as KodaXRoleRoundSummary, a7 as KodaXRuntimeVerificationContract, a8 as KodaXSelfManualConfig, ab as KodaXSessionOptions, ac as KodaXSidecarMessageEvent, ad as KodaXSkillDynamicContextPolicy, 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 KodaXToolEventMeta, ax as KodaXToolVisibilityMeta, ay as KodaXToolVisibilityPolicy, az as KodaXTurnCompletedEvent, aA as KodaXTurnDeliveryKind, aB as KodaXTurnFailedEvent, aC as KodaXTurnStartedEvent, aD as KodaXVerificationScorecard, aE as KodaXVerificationScorecardCriterion, aF as KodaXWorkflowAgentDigestEvent, aG as KodaXWorkflowEventMeta, aH as KodaXWorkflowTimeoutConfig, aI as LSP_SERVERS, aJ as LspServerInfo, aK as LspService, aL as LspServiceConfig, aN as ProviderRecoveryEvent, aQ as RecoveryAction, aS as RecoveryLadderStep, aV as ResilienceErrorClass, aZ as RuntimeCompactionSkippedEvent, a_ as RuntimeContextBudgetBreakdown, a$ as RuntimeContextBudgetRecommendation, b1 as RuntimeContextBudgetSnapshotInput, b2 as RuntimeContextOptimizationProfile, b5 as RuntimeToolExposureDecision, b6 as RuntimeToolExposureMode, b7 as RuntimeToolExposurePlan, b8 as RuntimeToolExposurePlanInput, b9 as RuntimeToolExposureReason, ba as TodoItem, bb as TodoList, bc as TodoStatus, bd as ToolSideEffect, bf as WorkflowInvocationAction, bg as WorkflowInvocationPolicyDecision, bh as WorkflowInvocationPolicyInput, bi as WorkflowInvocationSource, bj as WorkflowRunProgressView, bk as WorkflowStartOutcome, bl as WorkflowToolHost, bm as WorkflowToolHostInlineInput, bn as WorkflowToolHostResult, bo as WorkflowToolHostStartResult, bp as buildGoalRuntimeBinding, bq as consumeCompactionCooldown, br as createBashPrefixExtractor, bs as createCompactionAntiThrashState, bt as createRuntimeContextBudgetSnapshot, bu as decideWorkflowInvocation, bv as drainPendingSwaps, bw as estimateToolSchemaTokens, bx as extractCommandPrefix, by as getDefaultLspService, bz as hasPendingSwap, bA as makeDisabledGoalToolsContext, bB as planToolExposure, bC as providerResilienceConfigFromTimeouts, bD as recordCompactionSavings, bE as resolveConstructedAgent, bF as shouldSkipLlmCompaction, bG as shutdownDefaultLspService, bH as withGoalBeforeNextTurn, bI as withGoalStopHook, bJ as workflowStartOutcomeConsumesTurn } from './types-chunks/bash-prefix-extractor.d-BjkITAva.js';
10
11
  export { CreateFileArtifactFromPathOptions, CreateImageArtifactFromPathOptions, CreateVideoArtifactFromPathOptions, EnqueueWithArtifactsInput, GetModelInputCapabilitiesInput, ImageResizeError, KODAX_FILE_MEDIA_TYPES, KODAX_IMAGE_MEDIA_TYPES, KODAX_VIDEO_MEDIA_TYPES, KodaXInputCapabilityStatus, KodaXMediaError, KodaXMediaErrorCode, KodaXMediaErrorOptions, KodaXModalityInputCapability, MAX_DIMENSION, ModelInputCapabilities, NormalizeImageOptions, NormalizedImage, PASTE_TMP_DIR_ENV, PASTE_TMP_TTL_MS, PersistImageAsBlockOptions, TARGET_RAW_SIZE_BYTES, ValidateInputArtifactsOptions, createFileArtifactFromPath, createImageArtifactFromPath, createVideoArtifactFromPath, enqueueWithArtifacts, getModelInputCapabilities, inferImageMediaType, inferVideoMediaType, normalizePastedImage, persistImageAsBlock, prunePasteTmpDir, readAndNormalizeClipboardImage, readClipboardImage, validateInputArtifactsForModel } from './sdk-media.js';
11
- import { h as AgentMessage, f as Agent, bo as RunnerLlmReturn, a4 as KodaXJsonValue, U as KodaXExtensionSessionRecord, W as KodaXExtensionStore, a2 as KodaXInputArtifact, bw as SessionErrorMetadata, ba as QualityInvariant, bS as ToolCapability, bk as RunnableTool, bp as RunnerToolCall, _ as KodaXGoalState, c4 as WorkflowEventCorrelation, J as Guardrail, cD as WorkflowTaskSummaryEventUpdate, bZ as WorkflowAgentBackend, cc as WorkflowModule, cs as WorkflowProcessTrackerOptions, c3 as WorkflowEvent, c1 as WorkflowArtifactRef, ca as WorkflowMeta, cu as WorkflowRunState, b$ as WorkflowApproval, cg as WorkflowProcessEvent, c0 as WorkflowApprovalSummary, c8 as WorkflowLimits, cm as WorkflowProcessSnapshot } from './types-chunks/process.d-DXkRD7hj.js';
12
- export { j as AgentReasoningProfile, l as AgentTool, m as AskUserAnswer, n as AskUserCustomInputAnswer, o as AskUserMultiOptions, p as AskUserQuestionItem, q as AskUserQuestionOptions, r as AskUserSelectionAnswer, s as CompactionAnchor, v as CompactionResult, x as CompactionUpdate, L as Handoff, N as InMemorySessionOptions, S as KodaXCompactMemoryProgress, T as KodaXCompactMemorySeed, V as KodaXExtensionSessionState, Y as KodaXFileInputArtifact, a0 as KodaXImageInputArtifact, a1 as KodaXImageMediaType, a3 as KodaXInputArtifactSource, a6 as KodaXSessionArtifactLedgerEntry, a7 as KodaXSessionBranchSummaryEntry, a9 as KodaXSessionCompactionEntry, aa as KodaXSessionData, ab as KodaXSessionEntry, ac as KodaXSessionEntryBase, ae as KodaXSessionLabelEntry, af as KodaXSessionLineage, ag as KodaXSessionMessageEntry, ah as KodaXSessionMeta, ai as KodaXSessionNavigationOptions, aj as KodaXSessionRuntimeInfo, ak as KodaXSessionScope, al as KodaXSessionStorage, am as KodaXSessionTreeNode, an as KodaXSessionUiHistoryItem, ao as KodaXSessionUiHistoryItemType, ap as KodaXSessionUiTextHistoryItem, aq as KodaXSessionUiTextHistoryItemType, ar as KodaXSessionUiToolCall, as as KodaXSessionUiToolCallStatus, at as KodaXSessionUiToolGroupHistoryItem, au as KodaXSessionWorkspaceKind, av as KodaXVideoInputArtifact, aw as KodaXVideoMediaType, b5 as MessageEntry, b8 as PresetDispatcher, bd as ReasoningDepth, bh as RunEvent, bi as RunOptions, bj as RunResult, bl as Runner, bt as Session, bv as SessionEntry, bx as SessionExtension, by as SessionForkOptions, cQ as createAgent, cR as createHandoff, cS as createInMemorySession, d8 as registerPresetDispatcher } from './types-chunks/process.d-DXkRD7hj.js';
13
- import { y as MessageQueue, X as WorkflowScriptManifest, F as WorkflowCapsule, I as WorkflowCapsuleIntent, H as WorkflowCapsuleInputs, N as WorkflowCapsuleRequirements, J as WorkflowCapsuleProvenance, w as ManagedWorkflowSnapshot$1, V as WorkflowRunManager$1, R as WorkflowQualityLintFinding, O as WorkflowPatternId } from './types-chunks/run-manager.d-CYY3pZeJ.js';
14
- export { C as CompactionContext, a as CompactionEntry, b as CompactionEntryPayload, c as CompactionPolicy, D as DefaultSummaryCompaction, e as DefaultSummaryCompactionOptions, K as KODAX_API_MIN_INTERVAL, f as KODAX_DEFAULT_TIMEOUT, g as KODAX_HARD_TIMEOUT, h as KODAX_MAX_INCOMPLETE_RETRIES, j as KODAX_MAX_RETRIES, k as KODAX_MAX_TOKENS, l as KODAX_RETRY_BASE_DELAY, m as KODAX_STAGGER_DELAY, L as LINEAGE_ENTRY_TYPES, n as LineageArtifactLedgerPayload, o as LineageCompaction, p as LineageCompactionDelegates, q as LineageEntryType, r as LineageExtension, s as LineageLabelPayload, t as LineageTreeNode, x as ManagedWorkflowStatus, P as PROMISE_PATTERN, Y as appendSessionLineageLabel, $ as applySessionCompaction, a0 as archiveOldIslands, a2 as buildSessionTree, a4 as cleanupIncompleteToolCalls, a5 as countActiveLineageMessages, a6 as countTokens, a7 as createSessionLineage, ab as estimateTokens, ac as extractArtifactLedger, ae as extractTitleFromMessages, af as findPreviousUserEntryId, ag as forkSessionLineage, ah as generateSessionId, ai as getAgentConfigHome, aj as getAgentConfigPath, ak as getAppDataDir, an as getSessionLineagePath, ao as getSessionMessagesFromLineage, aq as mergeArtifactLedger, as as resolveSessionLineageTarget, at as rewindSessionLineage, au as setAgentConfigHome, av as setSessionLineageActiveEntry, aw as validateAndFixToolHistory } from './types-chunks/run-manager.d-CYY3pZeJ.js';
12
+ import { J as LocalToolDefinition, P as RegisteredToolDefinition, X as ToolHandler, Z as ToolRegistrationOptions, C as Capabilities, a as AgentContent, T as StagedHandle, f as ConstructionPolicy, d as ConstructionArtifact, U as TestResult, S as ScriptSource, Y as ToolHandlerSync, H as KodaXRetrievalToolName, F as KodaXRetrievalResult, B as KodaXRetrievalItem, r as ExtensionLoadSource, p as ExtensionFailureStage, m as ExtensionContributionSource, q as ExtensionHookMap, n as ExtensionEventMap, j as ExtensionCommandDefinition, u as ExtensionRuntimeDiagnostics } from './types-chunks/types.d-CUN_bZU7.js';
13
+ export { A as AgentArtifact, b as ArtifactStatus, c as CapabilityDeniedError, e as ConstructionManifestError, g as ConstructionPolicyVerdict, D as DEFAULT_HANDLER_TIMEOUT_MS, E as ExecOptions, h as ExecResult, i as ExtensionCommandContext, k as ExtensionCommandInvocation, l as ExtensionCommandResult, o as ExtensionFailureDiagnostic, s as ExtensionLogger, t as ExtensionRuntimeController, v as ExtensionToolBeforeHookContext, K as KodaXExtensionAPI, w as KodaXExtensionActivationResult, x as KodaXExtensionModule, y as KodaXRetrievalArtifact, z as KodaXRetrievalFreshness, G as KodaXRetrievalScope, I as KodaXRetrievalTrust, L as LoadedExtensionDiagnostic, M as ModelProviderRegistration, R as RegisteredCapabilityProviderDiagnostic, N as RegisteredCommandDiagnostic, O as RegisteredHookDiagnostic, Q as RegisteredToolDiagnostic, V as ToolContent, W as ToolDefinitionSource, _ as ToolRegistry, $ as WebhookOptions, a0 as WebhookResult, a1 as defaultPolicy, a2 as exec, a3 as webhook } from './types-chunks/types.d-CUN_bZU7.js';
14
+ import { h as AgentMessage, f as Agent, bp as RunnerLlmReturn, a2 as KodaXInputArtifact, bx as SessionErrorMetadata, bb as QualityInvariant, bT as ToolCapability, bl as RunnableTool, bq as RunnerToolCall, _ as KodaXGoalState, c5 as WorkflowEventCorrelation, J as Guardrail, cE as WorkflowTaskSummaryEventUpdate, b_ as WorkflowAgentBackend, cd as WorkflowModule, ct as WorkflowProcessTrackerOptions, c4 as WorkflowEvent, c2 as WorkflowArtifactRef, cb as WorkflowMeta, cv as WorkflowRunState, c0 as WorkflowApproval, ch as WorkflowProcessEvent, c1 as WorkflowApprovalSummary, c9 as WorkflowLimits, cn as WorkflowProcessSnapshot } from './types-chunks/process.d-CY2g03Mb.js';
15
+ export { j as AgentReasoningProfile, l as AgentTool, m as AskUserAnswer, n as AskUserCustomInputAnswer, o as AskUserMultiOptions, p as AskUserQuestionItem, q as AskUserQuestionOptions, r as AskUserSelectionAnswer, s as CompactionAnchor, v as CompactionResult, x as CompactionUpdate, L as Handoff, N as InMemorySessionOptions, S as KodaXCompactMemoryProgress, T as KodaXCompactMemorySeed, U as KodaXExtensionSessionRecord, V as KodaXExtensionSessionState, Y as KodaXFileInputArtifact, a0 as KodaXImageInputArtifact, a1 as KodaXImageMediaType, a3 as KodaXInputArtifactSource, a4 as KodaXJsonValue, a6 as KodaXSessionArtifactLedgerEntry, a7 as KodaXSessionBranchSummaryEntry, a9 as KodaXSessionCompactionEntry, aa as KodaXSessionData, ab as KodaXSessionEntry, ac as KodaXSessionEntryBase, ae as KodaXSessionLabelEntry, af as KodaXSessionLineage, ag as KodaXSessionMessageEntry, ah as KodaXSessionMeta, ai as KodaXSessionNavigationOptions, ak as KodaXSessionRuntimeInfo, al as KodaXSessionScope, am as KodaXSessionStorage, an as KodaXSessionTreeNode, ao as KodaXSessionUiHistoryItem, ap as KodaXSessionUiHistoryItemType, aq as KodaXSessionUiTextHistoryItem, ar as KodaXSessionUiTextHistoryItemType, as as KodaXSessionUiToolCall, at as KodaXSessionUiToolCallStatus, au as KodaXSessionUiToolGroupHistoryItem, av as KodaXSessionWorkspaceKind, aw as KodaXVideoInputArtifact, ax as KodaXVideoMediaType, b6 as MessageEntry, b9 as PresetDispatcher, be as ReasoningDepth, bi as RunEvent, bj as RunOptions, bk as RunResult, bm as Runner, bu as Session, bw as SessionEntry, by as SessionExtension, bz as SessionForkOptions, cR as createAgent, cS as createHandoff, cT as createInMemorySession, d9 as registerPresetDispatcher } from './types-chunks/process.d-CY2g03Mb.js';
16
+ import { M as MessageQueue, N as WorkflowScriptManifest, y as WorkflowCapsule, B as WorkflowCapsuleIntent, A as WorkflowCapsuleInputs, F as WorkflowCapsuleRequirements, E as WorkflowCapsuleProvenance, H as WorkflowQualityLintFinding, G as WorkflowPatternId } from './types-chunks/capsule.d-hVhPNkHd.js';
17
+ export { C as CompactionContext, a as CompactionEntry, b as CompactionEntryPayload, c as CompactionPolicy, D as DefaultSummaryCompaction, e as DefaultSummaryCompactionOptions, K as KODAX_API_MIN_INTERVAL, f as KODAX_DEFAULT_TIMEOUT, g as KODAX_HARD_TIMEOUT, h as KODAX_MAX_INCOMPLETE_RETRIES, j as KODAX_MAX_RETRIES, k as KODAX_MAX_TOKENS, l as KODAX_RETRY_BASE_DELAY, m as KODAX_STAGGER_DELAY, L as LINEAGE_ENTRY_TYPES, n as LineageArtifactLedgerPayload, o as LineageCompaction, p as LineageCompactionDelegates, q as LineageEntryType, r as LineageExtension, s as LineageLabelPayload, t as LineageTreeNode, P as PROMISE_PATTERN, O as appendSessionLineageLabel, R as applySessionCompaction, S as archiveOldIslands, U as buildSessionTree, X as cleanupIncompleteToolCalls, Y as countActiveLineageMessages, Z as countTokens, $ as createSessionLineage, a2 as estimateTokens, a3 as extractArtifactLedger, a5 as extractTitleFromMessages, a6 as findPreviousUserEntryId, a7 as forkSessionLineage, a8 as generateSessionId, a9 as getAgentConfigHome, aa as getAgentConfigPath, ab as getAppDataDir, ad as getSessionLineagePath, ae as getSessionMessagesFromLineage, ag as mergeArtifactLedger, ai as resolveSessionLineageTarget, aj as rewindSessionLineage, ak as setAgentConfigHome, al as setSessionLineageActiveEntry, am as validateAndFixToolHistory } from './types-chunks/capsule.d-hVhPNkHd.js';
15
18
  import { b as McpServersConfig } from './types-chunks/config.d-CJy1WENT.js';
16
19
  export { M as McpConnectMode, a as McpServerConfig, c as McpTransportKind } from './types-chunks/config.d-CJy1WENT.js';
17
- import { k as McpProviderOptions, c as McpCapabilityProvider, l as McpReverseCapabilities, m as McpRoot } from './types-chunks/manager.d-DBD7SOTT.js';
18
- export { A as AuthorizationServerMetadata, D as DiscoveredOAuthEndpoints, M as McpAuthRequiredError, a as McpCapabilityDescriptor, b as McpCapabilityKind, d as McpCapabilityRisk, e as McpCatalogItem, f as McpElicitRequest, g as McpElicitResult, h as McpExpiredSessionError, i as McpIcon, j as McpManager, n as McpSamplingRequest, o as McpSamplingResult, p as McpServerCatalog, q as McpServerCatalogSnapshot, r as McpServerLogs, s as McpServerRuntime, t as McpServerRuntimeDiagnostics, u as McpServerStatus, v as McpServerToolList, w as McpToolTaskSupport, x as McpTransport, y as McpTransportEvents, O as OAuthClientInfo, z as OAuthLoginConsent, P as PerformOAuthLoginOptions, B as ProtectedResourceMetadata, W as WwwAuthenticateChallenge, C as buildInitializeCapabilities, E as createMcpCapabilityId, F as createMcpManager, G as createMcpTransport, H as defaultMcpCacheDir, I as discoverAuthorizationServerMetadata, J as discoverOAuthEndpoints, K as discoverProtectedResourceMetadata, L as extractInsufficientScope, N as extractResourceMetadataUrl, Q as getMcpCachePaths, R as loadValidToken, S as normalizeMcpCapabilityId, T as parseMcpCapabilityId, U as performOAuthLogin, V as registerOAuthClient, X as searchMcpCatalog } from './types-chunks/manager.d-DBD7SOTT.js';
19
- import { h as AutoRules, T as ToolCallSignal, S as SignalCollector } from './types-chunks/guardrail.d-DRp0Lqvx.js';
20
- export { C as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD, i as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD, A as AgentsFile, a as AutoModeAskUser, b as AutoModeAskUserVerdict, D as AutoModeDenialTracker, c as AutoModeEngine, d as AutoModeGuardrailConfig, e as AutoModeSharedState, f as AutoModeStats, g as AutoModeToolGuardrail, E as BREAKER_ERROR_THRESHOLD, W as BREAKER_WINDOW_MS, j as CircuitBreaker, K as KodaXMcpConnectMode, k as KodaXMcpServerConfig, l as KodaXMcpServersConfig, m as KodaXMcpTransport, L as LoadAgentsOptions, n as LoadedRulesSource, R as RulesLoadError, o as RulesLoadResult, p as SkippedRulesSource, q as TrustState, J as autoModeDenialShouldFallback, M as breakerShouldFallback, r as collectAllSignals, s as computeRulesFingerprint, v as createAutoModeDenialTracker, t as createAutoModeToolGuardrail, u as createCircuitBreaker, w as formatAgentsForPrompt, x as getKodaxGlobalDir, y as loadAgentsFiles, z as loadAutoRules, B as parseAutoRules, F as readTrustState, G as recordAutoModeAllow, H as recordAutoModeBlock, I as recordBreakerError, N as trustProjectRules } from './types-chunks/guardrail.d-DRp0Lqvx.js';
21
- import { g as ToolGuardrail } from './types-chunks/types.d-DFf4Sfys.js';
20
+ import { i as McpProviderOptions, b as McpCapabilityProvider, j as McpReverseCapabilities, k as McpRoot } from './types-chunks/manager.d-Zum9cGHU.js';
21
+ export { M as McpCapabilityDescriptor, a as McpCapabilityKind, c as McpCapabilityRisk, d as McpCatalogItem, e as McpElicitRequest, f as McpElicitResult, g as McpIcon, h as McpManager, l as McpSamplingRequest, m as McpSamplingResult, n as McpServerCatalog, o as McpServerCatalogSnapshot, p as McpServerLogs, q as McpServerRuntime, r as McpServerRuntimeDiagnostics, s as McpServerStatus, t as McpServerToolList, u as McpToolTaskSupport, v as buildInitializeCapabilities, w as createMcpCapabilityId, x as createMcpManager, y as defaultMcpCacheDir, z as getMcpCachePaths, A as normalizeMcpCapabilityId, B as parseMcpCapabilityId, C as searchMcpCatalog } from './types-chunks/manager.d-Zum9cGHU.js';
22
+ export { A as AuthorizationServerMetadata, D as DiscoveredOAuthEndpoints, M as McpAuthRequiredError, a as McpExpiredSessionError, b as McpTransport, c as McpTransportEvents, O as OAuthClientInfo, d as OAuthLoginConsent, P as PerformOAuthLoginOptions, e as ProtectedResourceMetadata, W as WwwAuthenticateChallenge, f as createMcpTransport, g as discoverAuthorizationServerMetadata, h as discoverOAuthEndpoints, i as discoverProtectedResourceMetadata, j as extractInsufficientScope, k as extractResourceMetadataUrl, l as loadValidToken, p as performOAuthLogin, r as registerOAuthClient } from './types-chunks/oauth-login.d-Bgb4rdLN.js';
23
+ import { c as ManagedWorkflowSnapshot$1, e as WorkflowRunManager$1 } from './types-chunks/run-manager.d-CFknOfo1.js';
24
+ export { d as ManagedWorkflowStatus } from './types-chunks/run-manager.d-CFknOfo1.js';
25
+ import { h as AutoRules, T as ToolCallSignal, S as SignalCollector } from './types-chunks/guardrail.d-wk-s0psS.js';
26
+ export { C as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD, i as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD, A as AgentsFile, a as AutoModeAskUser, b as AutoModeAskUserVerdict, D as AutoModeDenialTracker, c as AutoModeEngine, d as AutoModeGuardrailConfig, e as AutoModeSharedState, f as AutoModeStats, g as AutoModeToolGuardrail, E as BREAKER_ERROR_THRESHOLD, W as BREAKER_WINDOW_MS, j as CircuitBreaker, K as KodaXMcpConnectMode, k as KodaXMcpServerConfig, l as KodaXMcpServersConfig, m as KodaXMcpTransport, L as LoadAgentsOptions, n as LoadedRulesSource, R as RulesLoadError, o as RulesLoadResult, p as SkippedRulesSource, q as TrustState, J as autoModeDenialShouldFallback, M as breakerShouldFallback, r as collectAllSignals, s as computeRulesFingerprint, v as createAutoModeDenialTracker, t as createAutoModeToolGuardrail, u as createCircuitBreaker, w as formatAgentsForPrompt, x as getKodaxGlobalDir, y as loadAgentsFiles, z as loadAutoRules, B as parseAutoRules, F as readTrustState, G as recordAutoModeAllow, H as recordAutoModeBlock, I as recordBreakerError, N as trustProjectRules } from './types-chunks/guardrail.d-wk-s0psS.js';
27
+ import { d as ToolGuardrail } from './types-chunks/guardrail.d-C_Siraua.js';
22
28
  import { Diagnostic } from 'vscode-languageserver-protocol';
23
29
  import '@anthropic-ai/sdk';
24
30
  import 'openai';
25
31
  import './types-chunks/types.d-vJExiRje.js';
32
+ import './types-chunks/types.d-BMLxKV69.js';
26
33
 
27
34
  /**
28
35
  * KodaX Core Errors
@@ -84,208 +91,6 @@ declare const CANCELLED_TOOL_RESULT_PREFIX = "[Cancelled]";
84
91
  /** Standard cancellation message returned when a tool is cancelled by the user. */
85
92
  declare const CANCELLED_TOOL_RESULT_MESSAGE = "[Cancelled] Operation cancelled by user";
86
93
 
87
- /**
88
- * KodaX Tool Types
89
- */
90
-
91
- /**
92
- * Progress yield from a streaming (async generator) tool.
93
- * Each yield appears as a real-time status update in the REPL transcript.
94
- */
95
- interface ToolProgress {
96
- readonly stage: string;
97
- readonly message: string;
98
- }
99
- /**
100
- * Final result a tool may return. Either a plain string (the default for
101
- * text-only tools) OR a typed-array form for multimodal returns (e.g.
102
- * `read` on an image path returns `[{type:'text',...}, {type:'image',...}]`).
103
- * Providers serialize each shape to their wire format; OpenAI-compat
104
- * gateways downgrade image items to a placeholder rather than rejecting.
105
- *
106
- * The array form mirrors claudecode's FileReadTool image return — Claude
107
- * Code packs image data into `tool_result` content so the model can
108
- * re-fetch images via the tool path. See
109
- * `c:/Works/claudecode/src/tools/FileReadTool/FileReadTool.ts:866-891`.
110
- */
111
- type ToolResult = string | readonly KodaXToolResultContentItem[];
112
- /** Standard tool handler — returns a final result (text or multimodal). */
113
- type ToolHandlerSync = (input: Record<string, unknown>, context: KodaXToolExecutionContext) => Promise<ToolResult>;
114
- /** Streaming tool handler — yields progress updates, returns final result. */
115
- type ToolHandlerStreaming = (input: Record<string, unknown>, context: KodaXToolExecutionContext) => AsyncGenerator<ToolProgress, ToolResult, void>;
116
- /** Union of both handler types. Existing tools use ToolHandlerSync; new long-running tools may use ToolHandlerStreaming. */
117
- type ToolHandler = ToolHandlerSync | ToolHandlerStreaming;
118
-
119
- /**
120
- * FEATURE_149 (v0.7.38) — interrupt-on-submit policy for in-flight tools.
121
- *
122
- * Controls whether submitting a new prompt while THIS tool is mid-execution
123
- * triggers a fast-abort of the current agent round (so the new prompt starts
124
- * immediately) or queues the prompt to run after the tool resolves.
125
- *
126
- * - `'cancel'` — long-running tools whose work the user is likely to want
127
- * to abandon when they redirect (e.g., `bash` running a 30s script,
128
- * `dispatch_child_task` synchronously awaiting a child, sleep-style
129
- * tools). InkREPL submit handler aborts the round immediately.
130
- *
131
- * - `'wait'` (default) — atomic / fast tools (read, grep, glob, write,
132
- * edit, …) where waiting for completion is cheaper than aborting and
133
- * redoing.
134
- *
135
- * Mirrors Claude Code `interruptBehavior` (`utils/handlePromptSubmit.ts`).
136
- */
137
- type ToolInterruptBehavior = 'cancel' | 'wait';
138
- interface LocalToolDefinition extends KodaXToolDefinition {
139
- handler: ToolHandler;
140
- /**
141
- * v0.7.42 — Required declarative side-effect class. See
142
- * {@link ToolSideEffect} for category definitions and rationale. Plan
143
- * mode and SDK embedders' permission brokers consume this; failure to
144
- * declare is a TypeScript error (by design — `sideEffect` is required,
145
- * not optional, to prevent silent drift when new tools are added).
146
- */
147
- sideEffect: ToolSideEffect;
148
- /**
149
- * v0.7.42 — Optional plan-mode override.
150
- *
151
- * - `undefined` (default): plan-mode permits only `sideEffect ===
152
- * 'readonly'` tools.
153
- * - `true`: explicitly permitted in plan mode even when sideEffect is
154
- * not `'readonly'`. Reserve for tools whose effect is itself part of
155
- * the planning loop (`exit_plan_mode`, `task_stop`, `todo_update`,
156
- * `todo_create`, `ask_user_question`).
157
- * - `false`: explicitly blocked in plan mode even when sideEffect is
158
- * `'readonly'`. Rare — useful for read-only tools whose output would
159
- * leak content the planner should not see.
160
- */
161
- planModeAllowed?: boolean;
162
- /**
163
- * FEATURE_149 (v0.7.38) — submit-time interrupt policy. See
164
- * {@link ToolInterruptBehavior}. Default `'wait'` when undefined.
165
- */
166
- interruptBehavior?: ToolInterruptBehavior;
167
- /**
168
- * Progressive disclosure — when `true`, the tool's full description is
169
- * replaced with `searchHint` (a one-line summary) in the LLM-visible
170
- * tool schema until the per-session unlock Set marks the tool name as
171
- * unlocked. Unlocking happens via the `tool_search` tool: the LLM
172
- * invokes `tool_search` with a query that selects this tool, and the
173
- * full description + JSON schema are returned in the tool_result text.
174
- * The next `getActiveToolDefinitions` call for the same session sees
175
- * the unlock and emits the full description.
176
- *
177
- * Use for tools with rich descriptions (>500 bytes) whose teaching
178
- * content the model only needs to consume when it actually plans to
179
- * call the tool. Saves turn-1 context without dropping the tool.
180
- *
181
- * Mirrors claudecode `Tool.shouldDefer` — see
182
- * `c:/Works/claudecode/src/tools/Tool.ts` for the parent design and
183
- * `c:/Works/claudecode/src/tools/ToolSearchTool/` for the bootstrap.
184
- */
185
- shouldDefer?: boolean;
186
- /**
187
- * One-line hint shown in place of the full description when this tool
188
- * is deferred and not yet unlocked. Required when `shouldDefer: true`.
189
- * Should answer "when would I want to look this up" in ≤ 100 chars
190
- * so the LLM can decide whether to invoke `tool_search` for the full
191
- * schema. Example: `'Fetch a specific remote URL — use tool_search to load full schema.'`
192
- */
193
- searchHint?: string;
194
- /**
195
- * Classifier projection — REQUIRED (FEATURE_092 v0.7.33).
196
- *
197
- * Returns a one-line string that the auto-mode classifier sees as the
198
- * `<action>` to evaluate. The classifier asks: "Given the user's
199
- * intent + rules, should the agent be allowed to run this?"
200
- *
201
- * THREE-TIER STRATEGY (pick by tool's risk profile):
202
- *
203
- * 1. ZERO RISK (read-only, structural):
204
- * → return '' (Tier 1 — classifier is skipped entirely, zero token cost)
205
- * Examples: read, grep, glob, ask_user_question, exit_plan_mode
206
- *
207
- * 2. HIGH RISK (mutates state, network, exec, spawn):
208
- * → write a CUSTOM projection that surfaces the risk-bearing fields
209
- * Examples: bash (`Bash: ${i.command}`), web_fetch (`WebFetch ${i.url}`)
210
- * See `classifier-projection.ts` for examples by category.
211
- *
212
- * 3. LOW RISK (structured input, side-effect-capable):
213
- * → return defaultToClassifierInput(name, input) (one-line helper)
214
- * Examples: semantic_lookup (refresh: true rebuilds index)
215
- *
216
- * KEEP IT SHORT: ≤ 100 chars typical. Variable-length user-provided fields
217
- * (bash command, URL, dispatch_child_task objective) may legitimately
218
- * exceed this — the projection's job is to make the risk visible, not to
219
- * fit a fixed budget at the cost of hiding it.
220
- *
221
- * NEVER include: raw file contents, secrets, API keys, full LLM-emitted
222
- * reasoning, or untrusted text passed through verbatim. Use byte/line
223
- * counts as proxies (`Write ${path} (${content.length} bytes)`).
224
- *
225
- * See `docs/features/v0.7.33.md` "Tool 接口扩展" for design rationale.
226
- */
227
- toClassifierInput: (input: unknown) => string;
228
- }
229
- interface ToolDefinitionSource {
230
- /**
231
- * Origin of the registered tool. `'constructed'` (FEATURE_087, v0.7.28)
232
- * marks tools materialized at runtime by `ConstructionRuntime` from
233
- * `.kodax/constructed/tools/<name>/<version>.json` artifacts.
234
- */
235
- kind: 'builtin' | 'extension' | 'constructed';
236
- id?: string;
237
- label?: string;
238
- /**
239
- * Constructed-only: semver of the activated artifact. Used by
240
- * `findByVersion()` and by `revoke()` to locate a specific stack entry.
241
- */
242
- version?: string;
243
- /**
244
- * Constructed-only: absolute path to the artifact JSON on disk.
245
- * Lets revoke / inspect operations round-trip back to the source of
246
- * truth without re-globbing.
247
- */
248
- manifestPath?: string;
249
- }
250
- interface RegisteredToolDefinition extends LocalToolDefinition {
251
- registrationId: string;
252
- requiredParams: string[];
253
- source: ToolDefinitionSource;
254
- }
255
- interface ToolRegistrationOptions {
256
- source?: ToolDefinitionSource;
257
- }
258
- type ToolRegistry = Map<string, RegisteredToolDefinition[]>;
259
- type KodaXRetrievalToolName = 'web_search' | 'web_fetch' | 'code_search' | 'semantic_lookup' | 'mcp_search' | 'mcp_describe' | 'mcp_call' | 'mcp_read_resource' | 'mcp_get_prompt';
260
- type KodaXRetrievalScope = 'workspace' | 'remote';
261
- type KodaXRetrievalTrust = 'workspace' | 'provider' | 'open-world';
262
- type KodaXRetrievalFreshness = 'fresh' | 'snapshot' | 'unknown';
263
- interface KodaXRetrievalArtifact {
264
- kind: 'url' | 'path' | 'symbol' | 'module' | 'process' | 'provider';
265
- label: string;
266
- value: string;
267
- }
268
- interface KodaXRetrievalItem {
269
- title: string;
270
- locator?: string;
271
- snippet?: string;
272
- score?: number;
273
- metadata?: Record<string, unknown>;
274
- }
275
- interface KodaXRetrievalResult {
276
- tool: KodaXRetrievalToolName;
277
- query?: string;
278
- scope: KodaXRetrievalScope;
279
- trust: KodaXRetrievalTrust;
280
- freshness: KodaXRetrievalFreshness;
281
- provider?: string;
282
- summary: string;
283
- content?: string;
284
- items: KodaXRetrievalItem[];
285
- artifacts?: KodaXRetrievalArtifact[];
286
- metadata?: Record<string, unknown>;
287
- }
288
-
289
94
  declare const KODAX_TOOLS: KodaXToolDefinition[];
290
95
  declare function registerTool(definition: LocalToolDefinition, options?: ToolRegistrationOptions): () => void;
291
96
  declare function getTool(name: string): ToolHandler | undefined;
@@ -441,293 +246,6 @@ declare function toolCodeSearch(input: Record<string, unknown>, ctx: KodaXToolEx
441
246
 
442
247
  declare function toolSemanticLookup(input: Record<string, unknown>, ctx: KodaXToolExecutionContext): Promise<string>;
443
248
 
444
- /**
445
- * KodaX Constructed-World types (FEATURE_087, v0.7.28).
446
- *
447
- * Runtime-generated capabilities (tools / agents / skills / ...) live in
448
- * `.kodax/constructed/` and are loaded into the same registries as builtin
449
- * primitives. v0.7.28 only ships tool generation (FEATURE_088); other kinds
450
- * land in FEATURE_089 / FEATURE_090.
451
- *
452
- * Cross-references:
453
- * - DD §14 — lifecycle, security model, registry merge semantics.
454
- * - docs/features/v0.7.28.md — capability schema, generation flow.
455
- */
456
-
457
- /**
458
- * Handler script source. v0.7.28 limits language to `'javascript'` so that
459
- * `loadHandler()` can `await import()` the file directly without an
460
- * intermediate TS → JS compile step (no esbuild / tsx dependency).
461
- *
462
- * TypeScript handlers are explicitly out of scope; Coding Agent generates
463
- * JS strings on the wire.
464
- */
465
- interface ScriptSource {
466
- readonly kind: 'script';
467
- readonly language: 'javascript';
468
- readonly code: string;
469
- }
470
- /**
471
- * Capability declaration.
472
- *
473
- * v0.7.28 ships the single-dimension form: a whitelist of builtin tool
474
- * names that the handler may invoke through `ctx.tools.<name>(...)`.
475
- * All I/O — fs / net / env — must flow through builtin tools (`read` /
476
- * `write` / `bash` / etc.); handlers do not receive direct `ctx.fs` /
477
- * `ctx.net` / `ctx.env` entry points.
478
- *
479
- * Forward-compatible evolution: if the future demands path/domain-level
480
- * constraints, this can grow to `(string | { name; constraints })[]`
481
- * without breaking existing manifests.
482
- */
483
- interface Capabilities {
484
- readonly tools: readonly string[];
485
- }
486
- /**
487
- * Tool-kind artifact body (the `content` of `ConstructionArtifact` when
488
- * `kind === 'tool'`).
489
- */
490
- interface ToolContent {
491
- readonly description: string;
492
- readonly inputSchema: Record<string, unknown>;
493
- readonly capabilities: Capabilities;
494
- readonly handler: ScriptSource;
495
- /**
496
- * Per-tool timeout override. Defaults to {@link DEFAULT_HANDLER_TIMEOUT_MS}
497
- * when omitted. Bounded by AbortController in `loadHandler()`.
498
- */
499
- readonly timeoutMs?: number;
500
- }
501
- /**
502
- * Default handler timeout. Picked to match the historical ceiling on
503
- * builtin streaming tools (30s); revisit if a constructed tool demands
504
- * longer-running computation.
505
- */
506
- declare const DEFAULT_HANDLER_TIMEOUT_MS = 30000;
507
- /**
508
- * Lifecycle state on disk. Drives both the startup glob filter and the
509
- * `revoke()` semantics. See DD §14.1 — file system is the single source
510
- * of truth; no separate `_manifest.json` index file (C4 decision).
511
- */
512
- type ArtifactStatus = 'staged' | 'active' | 'revoked';
513
- /**
514
- * Reference to a tool by stable id. v0.7.31 (FEATURE_089) introduces
515
- * Agent manifests that bundle tool refs rather than inline tool bodies;
516
- * the resolver expands these refs to concrete `KodaXToolDefinition`
517
- * instances at activate time.
518
- *
519
- * `ref` shape:
520
- * - `builtin:<name>` — a tool from the static registry
521
- * (e.g. `builtin:read`, `builtin:bash`)
522
- * - `constructed:<name>@<ver>` — a previously-activated constructed tool
523
- */
524
- interface ToolRef {
525
- readonly ref: string;
526
- }
527
- /**
528
- * Reference to a Guardrail by stable id. The Layer A `Guardrail`
529
- * declaration is name-only (no runtime hooks); resolvers map known
530
- * names to constructed `ToolGuardrail` / `InputGuardrail` /
531
- * `OutputGuardrail` instances at activation time.
532
- */
533
- interface GuardrailRef {
534
- readonly kind: 'input' | 'output' | 'tool';
535
- readonly ref: string;
536
- }
537
- /**
538
- * Reference to a handoff target by stable id (another constructed agent
539
- * or a builtin role). The resolver expands `target.ref` to the actual
540
- * `Agent` declaration at admission time so the handoff DAG check
541
- * (`handoffLegality` invariant) sees the full graph.
542
- */
543
- interface AgentHandoffRef {
544
- readonly target: {
545
- readonly ref: string;
546
- };
547
- readonly kind: 'continuation' | 'as-tool';
548
- readonly description?: string;
549
- }
550
- /**
551
- * Reasoning profile declaration mirroring the Layer A
552
- * `AgentReasoningProfile`. Kept structurally identical so the resolver
553
- * passes the value through without re-shaping.
554
- */
555
- interface AgentReasoningRef {
556
- readonly default: 'quick' | 'balanced' | 'deep';
557
- readonly max?: 'quick' | 'balanced' | 'deep';
558
- readonly escalateOnRevise?: boolean;
559
- }
560
- /**
561
- * Sandbox test case. Used by `sandbox_test_agent` to verify a
562
- * constructed agent before it can activate. Each case feeds `input`
563
- * to a sandbox Runner instance and grades the agent's final output:
564
- *
565
- * - `expectMatch` — final text must match this regex (string form)
566
- * - `expectNotMatch` — final text must NOT match this regex
567
- * - `expectFinalText` — exact substring match (case-sensitive)
568
- *
569
- * At least one of the three expect-fields must be present; the cases
570
- * are graded by `runSandboxAgentTest()` (FEATURE_089 Phase 3.5).
571
- */
572
- interface AgentTestCase {
573
- readonly id: string;
574
- readonly input: string;
575
- readonly expectMatch?: string;
576
- readonly expectNotMatch?: string;
577
- readonly expectFinalText?: string;
578
- }
579
- /**
580
- * Agent-kind artifact body (the `content` of `ConstructionArtifact`
581
- * when `kind === 'agent'`).
582
- *
583
- * FEATURE_089 (v0.7.31): all fields except `instructions` are optional;
584
- * a minimal "echo agent" can be expressed as `{ instructions: '...' }`.
585
- * Tool / handoff / guardrail refs are resolved at admission time
586
- * (Runner.admit's 5-step audit expands them and feeds the resolved
587
- * Agent through the invariant chain).
588
- */
589
- interface AgentContent {
590
- readonly instructions: string;
591
- readonly tools?: readonly ToolRef[];
592
- readonly handoffs?: readonly AgentHandoffRef[];
593
- readonly reasoning?: AgentReasoningRef;
594
- readonly guardrails?: readonly GuardrailRef[];
595
- readonly model?: string;
596
- readonly provider?: string;
597
- readonly effort?: KodaXWireReasoningEffort;
598
- /**
599
- * FEATURE_191 — one-sentence human-readable summary surfaced in the
600
- * Worker system prompt's `=== Available specialist agents ===`
601
- * block (FEATURE_191 A.3) and in `/agents list` UIs. Frontmatter
602
- * `description` field of `~/.kodax/agents/<name>.md` and the
603
- * `name`-paired argument of `KodaXExtensionAPI.registerAgent`
604
- * funnel into this field. Optional for backward compatibility with
605
- * FEATURE_089 minimal-agent shape (`{ instructions: '...' }`);
606
- * the SP block renders `(no description)` when absent.
607
- */
608
- readonly description?: string;
609
- /**
610
- * Optional structured-output schema mirroring `Agent.outputSchema`.
611
- * Pure pass-through to the runtime — admission does not validate
612
- * shape semantics here, only well-formed JSON.
613
- */
614
- readonly outputSchema?: Record<string, unknown>;
615
- /**
616
- * Optional sandbox test cases. When present, `sandbox_test_agent`
617
- * runs them; when absent, the test step performs only the static
618
- * checks (manifest schema + admission audit).
619
- */
620
- readonly testCases?: readonly AgentTestCase[];
621
- /**
622
- * Maximum total budget (iteration count) the agent may consume.
623
- * Plumbed onto the resolved `AgentManifest.maxBudget` and clamped by
624
- * `budgetCeiling` invariant during admission.
625
- */
626
- readonly maxBudget?: number;
627
- /**
628
- * Voluntary additional invariants the LLM declares this agent
629
- * commits to. Plumbed onto `AgentManifest.declaredInvariants`;
630
- * unioned on top of the required set during admission.
631
- */
632
- readonly declaredInvariants?: readonly string[];
633
- }
634
- /**
635
- * Persisted artifact shape (one JSON file per name/version under
636
- * `.kodax/constructed/<kind>s/<name>/<version>.json`).
637
- *
638
- * Discriminated union over `kind`:
639
- * - `kind: 'tool'` — v0.7.28 (FEATURE_088) tool generation
640
- * - `kind: 'agent'` — v0.7.31 (FEATURE_089) agent generation; passes
641
- * through `Runner.admit()` at activation time
642
- *
643
- * Lifecycle fields (status / timestamps / contentHash / sourceAgent /
644
- * signedBy) are common to all kinds.
645
- */
646
- type ConstructionArtifact = ToolArtifact | AgentArtifact;
647
- interface ConstructionArtifactBase {
648
- readonly name: string;
649
- readonly version: string;
650
- status: ArtifactStatus;
651
- readonly signedBy?: string;
652
- readonly createdAt: number;
653
- readonly sourceAgent?: string;
654
- testedAt?: number;
655
- activatedAt?: number;
656
- revokedAt?: number;
657
- /**
658
- * SHA-256 of `JSON.stringify(content)` captured at activate time.
659
- * `rehydrateActiveArtifacts()` recomputes and compares — a mismatch
660
- * indicates the manifest was edited between activation and the next
661
- * boot (naive cross-session tampering, e.g. an LLM rewriting the .json
662
- * via the Write tool without recomputing the hash). Mismatched
663
- * artifacts are skipped at rehydrate with a stderr warning. This is
664
- * NOT a defense against a coordinated attacker who recomputes the
665
- * hash; the threat model is single-user CLI integrity, not multi-user
666
- * supply chain.
667
- */
668
- contentHash?: string;
669
- }
670
- interface ToolArtifact extends ConstructionArtifactBase {
671
- readonly kind: 'tool';
672
- readonly content: ToolContent;
673
- }
674
- interface AgentArtifact extends ConstructionArtifactBase {
675
- readonly kind: 'agent';
676
- readonly content: AgentContent;
677
- }
678
- /**
679
- * Returned by {@link ConstructionRuntime.stage}; opaque handle that
680
- * downstream `test()` / `activate()` calls bind to.
681
- */
682
- interface StagedHandle {
683
- readonly artifact: ConstructionArtifact;
684
- readonly stagedAt: number;
685
- }
686
- /**
687
- * Outcome of {@link ConstructionRuntime.test}. `ok=false` blocks
688
- * activation; `warnings` surface but do not block.
689
- */
690
- interface TestResult {
691
- readonly ok: boolean;
692
- readonly errors?: readonly string[];
693
- readonly warnings?: readonly string[];
694
- }
695
- /**
696
- * Policy gate — invoked once per `activate()` before the artifact is
697
- * registered. Default rejects implicit auto-approval; the REPL surface
698
- * binds a dialog-based policy in `packages/repl/src/common/construction-
699
- * bootstrap.ts` so user approval flows through the live askUser channel.
700
- *
701
- * Modeled as a function type rather than an interface (D3 decision):
702
- * keeps the contract surface tiny, no class boilerplate.
703
- *
704
- * No declarative `kodax.config.ts` override hatch is provided — see the
705
- * "Deferred Design Decisions" section in `features/v0.7.28.md` for why
706
- * a `risk_mode` enum (when truly needed) is preferred over user-authored
707
- * policy functions.
708
- */
709
- type ConstructionPolicy = (artifact: ConstructionArtifact) => Promise<ConstructionPolicyVerdict>;
710
- type ConstructionPolicyVerdict = 'approve' | 'reject' | 'ask-user';
711
- /** Default policy: always ask the user; no implicit approvals. */
712
- declare const defaultPolicy: ConstructionPolicy;
713
- /**
714
- * Thrown by `CtxProxy` when handler attempts to access a tool not declared
715
- * in `capabilities.tools`. Caught in tracer; surfaces as a tool error.
716
- */
717
- declare class CapabilityDeniedError extends Error {
718
- readonly toolName: string;
719
- readonly declaredTools: readonly string[];
720
- constructor(toolName: string, declaredTools: readonly string[]);
721
- }
722
- /**
723
- * Thrown when a manifest cannot be parsed / is missing required fields.
724
- * Surfaces during stage() / startup glob; tracer records details.
725
- */
726
- declare class ConstructionManifestError extends Error {
727
- readonly path?: string;
728
- constructor(message: string, path?: string);
729
- }
730
-
731
249
  /**
732
250
  * FEATURE_089 Phase 3.5 — Sandbox Agent Test Runner.
733
251
  *
@@ -990,9 +508,9 @@ declare function _resetRuntimeForTesting(): void;
990
508
  * refuses to overwrite. Bumping the semver is the supported update path.
991
509
  *
992
510
  * Why "any status", not just `'active'`:
993
- * The handler's `.js` module is loaded via `await import(file://…)`
511
+ * The handler's `.mjs` module is loaded via `await import(file://…)`
994
512
  * which the ESM module cache keys by absolute file URL. Re-writing
995
- * `<version>.js` in place leaves the cached module pointing at the
513
+ * `<version>.mjs` in place leaves the cached module pointing at the
996
514
  * OLD code; subsequent loadHandler() calls return the cached export.
997
515
  * Even revoking first does not flush the cache (Node has no public
998
516
  * ESM cache eviction API). The only safe-by-construction policy is
@@ -1097,8 +615,9 @@ declare function activate(handle: StagedHandle): Promise<void>;
1097
615
  * tools.
1098
616
  *
1099
617
  * Returns counts so callers can surface a loaded/failed/tampered banner.
1100
- * Failures are logged (console.warn) and rehydration continues for the
1101
- * remaining artifacts; a single bad manifest must not break boot.
618
+ * Failures are emitted through the diagnostic channel and rehydration
619
+ * continues for the remaining artifacts; a single bad manifest must not
620
+ * break boot.
1102
621
  */
1103
622
  declare function rehydrateActiveArtifacts(): Promise<{
1104
623
  loaded: number;
@@ -1157,77 +676,6 @@ declare function findByVersion(name: string, version: string): RegisteredToolDef
1157
676
  */
1158
677
  declare function listAll(): RegisteredToolDefinition[];
1159
678
 
1160
- /**
1161
- * FEATURE_089 (v0.7.31) Phase 3.4 — Constructed Agent Resolver.
1162
- *
1163
- * Module-singleton registry mapping `name` → runnable `Agent` for
1164
- * agents that have passed admission and been activated through
1165
- * `ConstructionRuntime.activate()`. Mirrors the way TOOL_REGISTRY
1166
- * holds activated constructed tools, but for agents.
1167
- *
1168
- * Why a separate registry (not in TOOL_REGISTRY):
1169
- *
1170
- * - Tools and Agents are different runtime types. A `KodaXToolDefinition`
1171
- * has `input_schema` + `handler`; an `Agent` has `instructions` +
1172
- * `tools` + `handoffs` + `reasoning`. Conflating them would force
1173
- * consumers to discriminate on every lookup.
1174
- * - Resolution semantics differ: a tool lookup returns the executable
1175
- * handler; an agent lookup returns the declarative spec (Runner.run
1176
- * drives the loop separately).
1177
- *
1178
- * Resolution surface:
1179
- *
1180
- * - `resolveConstructedAgent(name)` — name → Agent | undefined
1181
- * - `listConstructedAgents()` — snapshot of activated agents
1182
- * - `registerConstructedAgent(artifact)` → unregister fn (called by
1183
- * runtime on activate, captured in the runtime's `_activated` map)
1184
- * - `_resetAgentResolverForTesting()` — test isolation
1185
- *
1186
- * Tool / handoff ref resolution:
1187
- * - Tool refs are resolved against TOOL_REGISTRY at activation time —
1188
- * a snapshot. If a referenced tool is later revoked, the agent
1189
- * keeps its stale ref; Phase 3.5 sandbox testing catches this.
1190
- * - Handoff target refs lift to stub Agent objects (`name` only) when
1191
- * the target hasn't been activated yet. Transitive admission ran
1192
- * at test time so the graph is known to be acyclic; runtime
1193
- * traversal just walks the names.
1194
- *
1195
- * Non-goal: full referential consistency between tools / agents /
1196
- * handoffs. The threat model is single-user CLI integrity (DD §14.5);
1197
- * stale refs are an LLM-authoring footgun, not a security bypass.
1198
- */
1199
-
1200
- /**
1201
- * Look up an activated constructed agent by name. Returns the
1202
- * resolved `Agent` (with tools / handoffs lifted from refs). Returns
1203
- * `undefined` when no agent at that name has been activated.
1204
- */
1205
- declare function resolveConstructedAgent(name: string): Agent | undefined;
1206
- /**
1207
- * FEATURE_090 — `true` iff a self-modify activation has been staged
1208
- * for `name` but has not yet been drained into the active registry.
1209
- * Surfaces for tooling that wants to display "next run will use
1210
- * version X" hints, and as a sanity-check assertion in tests.
1211
- */
1212
- declare function hasPendingSwap(name: string): boolean;
1213
- /**
1214
- * FEATURE_090 — promote every pending self-modify entry into
1215
- * `AGENT_REGISTRY`, replacing the prior active version. Returns the
1216
- * names that were drained so the caller can surface a hint
1217
- * ("alpha is now running version 1.1.0").
1218
- *
1219
- * Idempotent: calling on an empty pending map is a no-op. Atomic at
1220
- * the JS event-loop level (a single synchronous pass); drain cannot
1221
- * partially complete.
1222
- *
1223
- * Integration contract: the REPL surface calls this immediately after
1224
- * any top-level `Runner.run` returns. KodaX is single-process and
1225
- * single-user, so "the run that triggered the change" and "all
1226
- * in-flight runs" are the same set — no concurrent-run coordination
1227
- * needed.
1228
- */
1229
- declare function drainPendingSwaps(): readonly string[];
1230
-
1231
679
  /**
1232
680
  * FEATURE_191 (v0.7.43) — markdown-defined agent loader.
1233
681
  *
@@ -1262,6 +710,7 @@ declare function drainPendingSwaps(): readonly string[];
1262
710
  * decision. Ignoring them silently keeps user `.md` files
1263
711
  * forward-compatible across future feature versions.
1264
712
  */
713
+
1265
714
  /**
1266
715
  * Per-file failure record returned to the boot caller. Mirrors
1267
716
  * claudecode's `getAgentDefinitionsWithOverrides.failedFiles` shape so
@@ -1291,6 +740,36 @@ interface LoadAgentsFromMarkdownOptions {
1291
740
  */
1292
741
  readonly configHome?: string;
1293
742
  }
743
+ interface LoadMarkdownAgentScopeOptions extends LoadAgentsFromMarkdownOptions {
744
+ /** Stable host-chosen id for diagnostics. Defaults to the resolved project cwd. */
745
+ readonly id?: string;
746
+ }
747
+ interface MarkdownAgentToolFilter {
748
+ readonly name: string;
749
+ readonly reason: 'not-registered' | 'admission-clamped';
750
+ }
751
+ interface MarkdownAgentLoadWarning {
752
+ readonly path: string;
753
+ readonly agentName?: string;
754
+ readonly reason: string;
755
+ }
756
+ interface LoadedMarkdownAgent {
757
+ readonly name: string;
758
+ readonly description: string;
759
+ readonly source: 'markdown:user' | 'markdown:project';
760
+ readonly path: string;
761
+ readonly requestedTools?: readonly string[];
762
+ readonly effectiveTools?: readonly string[];
763
+ readonly filteredTools: readonly MarkdownAgentToolFilter[];
764
+ readonly admissionWarnings: readonly string[];
765
+ }
766
+ interface LoadMarkdownAgentScopeResult {
767
+ readonly scope: KodaXAgentScope;
768
+ readonly loaded: readonly LoadedMarkdownAgent[];
769
+ readonly failed: readonly MarkdownLoadFailure[];
770
+ readonly warnings: readonly MarkdownAgentLoadWarning[];
771
+ dispose(): Promise<void>;
772
+ }
1294
773
  /**
1295
774
  * FEATURE_197 (v0.7.43) — discovered markdown agent metadata.
1296
775
  *
@@ -1341,6 +820,7 @@ interface DiscoverMarkdownAgentsResult {
1341
820
  * not break boot.
1342
821
  */
1343
822
  declare function loadAgentsFromMarkdown(opts?: LoadAgentsFromMarkdownOptions): Promise<LoadAgentsFromMarkdownResult>;
823
+ declare function loadMarkdownAgentScope(opts?: LoadMarkdownAgentScopeOptions): Promise<LoadMarkdownAgentScopeResult>;
1344
824
  /**
1345
825
  * FEATURE_197 (v0.7.43) — read-only counterpart to
1346
826
  * `loadAgentsFromMarkdown`. Scans the same two-tier path (user dir
@@ -1388,8 +868,8 @@ declare function ensureBuiltinRepoExplorerAgent(): Promise<boolean>;
1388
868
  /**
1389
869
  * CtxProxy — runtime gate for constructed tool handlers.
1390
870
  *
1391
- * Constructed handlers run in the host process (no JS-level sandbox; see
1392
- * DD §14.5 for why we deliberately avoid worker_threads / isolated-vm).
871
+ * Constructed handlers run in a disposable Worker. Capability and policy
872
+ * checks still execute in the host through reverse tool RPC.
1393
873
  * Safety derives from a four-layer model — Guardrail static check,
1394
874
  * `capabilities.tools` whitelist declaration, this CtxProxy at runtime,
1395
875
  * and policy gate on activate.
@@ -1412,8 +892,9 @@ declare function ensureBuiltinRepoExplorerAgent(): Promise<boolean>;
1412
892
  * keeps the parent agent loop alive and reportable.
1413
893
  * - Direct `ctx.tools` enumeration / introspection is gated; the
1414
894
  * proxied `tools` object only exposes whitelisted names.
1415
- * - All other `ctx.<x>` properties (executionCwd, abortSignal, etc.)
1416
- * pass through unchanged they are framework infra, not tool calls.
895
+ * - The host proxy retains the live execution context for reverse tool RPC.
896
+ * The handler Worker receives only cloneable informational fields plus a
897
+ * bridged AbortSignal; host callbacks and mutable services stay here.
1417
898
  *
1418
899
  * Anti-tampering:
1419
900
  * - Returned proxy is `Object.freeze`d at the top level so handlers
@@ -1439,43 +920,13 @@ interface CreateCtxProxyOptions {
1439
920
  }
1440
921
  declare function createCtxProxy(ctx: unknown, capabilities: Capabilities, options?: CreateCtxProxyOptions): unknown;
1441
922
 
1442
- /**
1443
- * loadHandler — turns a manifest's handler script into a callable
1444
- * `ToolHandler` ready to register into `TOOL_REGISTRY`.
1445
- *
1446
- * Pipeline:
1447
- * 1. Validate language === 'javascript' (v0.7.28 hard limit).
1448
- * 2. Materialize the handler source onto disk under
1449
- * `<cwd>/.kodax/constructed/tools/<name>/<version>.js`.
1450
- * 3. Dynamic `import()` of the file URL — host-process module load,
1451
- * no worker / vm isolation (DD §14.4).
1452
- * 4. Wrap with `createCtxProxy` + a Promise.race timeout.
1453
- *
1454
- * Design notes:
1455
- * - Returning `ToolHandlerSync` (not the streaming variant) — v0.7.28
1456
- * constructed tools are non-streaming computations.
1457
- * - Handler return value is stringified for the agent loop, mirroring
1458
- * builtin tool result conventions.
1459
- * - ESM module cache is intentional: re-loading the same `<version>.js`
1460
- * returns the cached module. Constructed artifacts are immutable per
1461
- * version, so this is correct (revoke + new version is the proper
1462
- * update path).
1463
- * - Timeout is enforced via Promise.race; the underlying handler
1464
- * promise is *not* hard-aborted (Node has no general task abort).
1465
- * Long-running CPU loops will leak past timeout — accepted in the
1466
- * v0.7.28 threat model (LLM hallucination, not adversarial DoS).
1467
- */
1468
-
1469
923
  interface LoadHandlerScope {
1470
924
  readonly name: string;
1471
925
  readonly version: string;
1472
- /** Workspace root; defaults to `process.cwd()`. */
1473
926
  readonly cwd?: string;
1474
927
  }
1475
928
  interface LoadHandlerOptions {
1476
- /** Per-tool override; falls back to {@link DEFAULT_HANDLER_TIMEOUT_MS}. */
1477
929
  readonly timeoutMs?: number;
1478
- /** Pass-through to {@link createCtxProxy}. */
1479
930
  readonly ctxProxyOptions?: CreateCtxProxyOptions;
1480
931
  }
1481
932
  declare function loadHandler(scope: LoadHandlerScope, source: ScriptSource, capabilities: Capabilities, options?: LoadHandlerOptions): Promise<ToolHandlerSync>;
@@ -1869,484 +1320,6 @@ interface RollbackResult {
1869
1320
  */
1870
1321
  declare function rollbackSelfModify(name: string): Promise<RollbackResult>;
1871
1322
 
1872
- interface ExecOptions {
1873
- /** Extra environment variables to inject (merged with safe base env). */
1874
- readonly env?: Readonly<Record<string, string>>;
1875
- /** Working directory. Defaults to process.cwd(). */
1876
- readonly cwd?: string;
1877
- /** Timeout in milliseconds. Defaults to 30000. */
1878
- readonly timeout?: number;
1879
- /** Shell to use. Defaults to 'bash' on Unix, 'powershell' on Windows. */
1880
- readonly shell?: 'bash' | 'powershell';
1881
- }
1882
- interface ExecResult {
1883
- readonly exitCode: number;
1884
- readonly stdout: string;
1885
- readonly stderr: string;
1886
- }
1887
- /**
1888
- * Run a shell command with a sandboxed environment.
1889
- *
1890
- * SECURITY: Only a whitelist of safe environment variables is passed to the
1891
- * subprocess. API keys and tokens from the parent environment are NOT inherited.
1892
- */
1893
- declare function exec(command: string, options?: ExecOptions): Promise<ExecResult>;
1894
- interface WebhookOptions {
1895
- /** HTTP method. Defaults to 'POST'. */
1896
- readonly method?: 'POST' | 'PUT';
1897
- /** Extra HTTP headers. */
1898
- readonly headers?: Readonly<Record<string, string>>;
1899
- /** Timeout in milliseconds. Defaults to 10000. */
1900
- readonly timeout?: number;
1901
- }
1902
- interface WebhookResult {
1903
- readonly ok: boolean;
1904
- readonly status: number;
1905
- readonly body?: string;
1906
- }
1907
- /**
1908
- * Send an HTTP webhook with timeout support.
1909
- * Returns a result object instead of throwing on errors.
1910
- */
1911
- declare function webhook(url: string, payload: unknown, options?: WebhookOptions): Promise<WebhookResult>;
1912
-
1913
- interface ModelProviderRegistration {
1914
- name: string;
1915
- factory: () => KodaXBaseProvider;
1916
- }
1917
- interface ExtensionCommandDefinition {
1918
- name: string;
1919
- aliases?: string[];
1920
- description: string;
1921
- usage?: string;
1922
- metadata?: Record<string, unknown>;
1923
- handler: (args: string[], context: ExtensionCommandContext) => Promise<ExtensionCommandResult | void> | ExtensionCommandResult | void;
1924
- }
1925
- interface ExtensionModelSelection {
1926
- provider?: string;
1927
- model?: string;
1928
- }
1929
- interface ExtensionLogger {
1930
- debug: (...args: unknown[]) => void;
1931
- info: (...args: unknown[]) => void;
1932
- warn: (...args: unknown[]) => void;
1933
- error: (...args: unknown[]) => void;
1934
- }
1935
- interface ExtensionFileContributionSource {
1936
- kind: 'extension';
1937
- id: string;
1938
- label: string;
1939
- path: string;
1940
- }
1941
- interface RuntimeContributionSource {
1942
- kind: 'runtime';
1943
- id: string;
1944
- label: string;
1945
- path?: string;
1946
- }
1947
- type ExtensionContributionSource = ExtensionFileContributionSource | RuntimeContributionSource;
1948
- type ExtensionLoadSource = 'api' | 'cli' | 'config' | 'discovery';
1949
- interface LoadedExtensionDiagnostic {
1950
- path: string;
1951
- label: string;
1952
- loadSource: ExtensionLoadSource;
1953
- sessionStateKeys?: string[];
1954
- sessionRecordCounts?: Record<string, number>;
1955
- }
1956
- interface RegisteredCapabilityProviderDiagnostic {
1957
- id: string;
1958
- kinds: CapabilityKind[];
1959
- source: ExtensionContributionSource;
1960
- metadata?: Record<string, unknown>;
1961
- }
1962
- interface RegisteredCommandDiagnostic {
1963
- name: string;
1964
- aliases?: string[];
1965
- description: string;
1966
- usage?: string;
1967
- metadata?: Record<string, unknown>;
1968
- source: ExtensionContributionSource;
1969
- }
1970
- interface RegisteredToolDiagnostic {
1971
- name: string;
1972
- description: string;
1973
- requiredParams: string[];
1974
- source: RegisteredToolDefinition['source'];
1975
- shadowedSources: RegisteredToolDefinition['source'][];
1976
- }
1977
- interface RegisteredHookDiagnostic {
1978
- hook: keyof ExtensionHookMap;
1979
- order: number;
1980
- source: ExtensionContributionSource;
1981
- }
1982
- type ExtensionFailureStage = 'load' | 'reload' | 'event' | 'hook' | 'persistence';
1983
- interface ExtensionFailureDiagnostic {
1984
- stage: ExtensionFailureStage;
1985
- target: string;
1986
- message: string;
1987
- occurredAt: string;
1988
- source: ExtensionContributionSource;
1989
- }
1990
- interface ExtensionRuntimeDiagnostics {
1991
- loadedExtensions: LoadedExtensionDiagnostic[];
1992
- capabilityProviders: RegisteredCapabilityProviderDiagnostic[];
1993
- commands: RegisteredCommandDiagnostic[];
1994
- tools: RegisteredToolDiagnostic[];
1995
- hooks: RegisteredHookDiagnostic[];
1996
- failures: ExtensionFailureDiagnostic[];
1997
- defaults: {
1998
- activeTools?: string[];
1999
- modelSelection: ExtensionModelSelection;
2000
- thinkingLevel?: KodaXWireReasoningEffort;
2001
- };
2002
- }
2003
- interface ExtensionCommandInvocation {
2004
- prompt: string;
2005
- displayName?: string;
2006
- disableModelInvocation?: boolean;
2007
- allowedTools?: string;
2008
- context?: 'fork';
2009
- model?: string;
2010
- }
2011
- interface ExtensionCommandResult {
2012
- success?: boolean;
2013
- message?: string;
2014
- data?: unknown;
2015
- invocation?: ExtensionCommandInvocation;
2016
- }
2017
- interface ExtensionCommandContext {
2018
- sessionId?: string;
2019
- gitRoot?: string;
2020
- workingDirectory: string;
2021
- reloadExtensions: () => Promise<void>;
2022
- getDiagnostics: () => ExtensionRuntimeDiagnostics;
2023
- logger: ExtensionLogger;
2024
- }
2025
- interface ExtensionToolBeforeHookContext {
2026
- name: string;
2027
- input: Record<string, unknown>;
2028
- toolId?: string;
2029
- executionCwd?: string;
2030
- gitRoot?: string;
2031
- }
2032
- interface ExtensionProviderBeforeHookContext {
2033
- provider: string;
2034
- model?: string;
2035
- reasoningMode?: KodaXWireReasoningEffort;
2036
- systemPrompt: string;
2037
- block: (reason: string) => void;
2038
- replaceProvider: (provider: string) => void;
2039
- replaceModel: (model?: string) => void;
2040
- replaceSystemPrompt: (systemPrompt: string) => void;
2041
- setThinkingLevel: (level: KodaXWireReasoningEffort) => void;
2042
- }
2043
- interface ExtensionTurnSettleHookContext {
2044
- sessionId: string;
2045
- lastText: string;
2046
- hadToolCalls: boolean;
2047
- success: boolean;
2048
- signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
2049
- queueUserMessage: (message: string | KodaXMessage) => void;
2050
- setModelSelection: (next: ExtensionModelSelection) => void;
2051
- setThinkingLevel: (level: KodaXWireReasoningEffort) => void;
2052
- }
2053
- /**
2054
- * FEATURE_184 (v0.7.45) — Stop Hook bridge context for extensions.
2055
- *
2056
- * Fires ONLY when the model terminates a turn text-only (no tool_use)
2057
- * — a strict subset of `turn:settle`, which fires on every turn end
2058
- * including mid-task tool turns. Use this hook for verification or
2059
- * "is the task actually done?" checks. The three-state return surface
2060
- * mirrors `RunOptions.stopHook` at the agent layer; the bridge passes
2061
- * the extension's return through unchanged.
2062
- *
2063
- * Coding-layer first-party consumers (Sidecar Verifier, FEATURE_184
2064
- * Phase D) wire directly to the agent `stopHook`. Third-party
2065
- * extensions write `api.hook('turn:complete', handler)` and the bridge
2066
- * dispatches to them inside the agent's `stopHook` callback. Handlers
2067
- * fire in registration order, first non-`void` return short-circuits
2068
- * the chain (matches `tool:before` semantics).
2069
- *
2070
- * Scope note: this hook fires on the AMA `runner-driven` path only
2071
- * (main loop, B1 retry, V2 worker). SA-path child agents dispatched
2072
- * via `dispatch_child_task` go through `runKodaX` and do NOT trigger
2073
- * this hook — observe their lifecycle via `turn:settle` on the SA
2074
- * path. Extensions wanting "every agent termination" semantics must
2075
- * register both hooks.
2076
- */
2077
- interface ExtensionTurnCompleteHookContext {
2078
- sessionId: string;
2079
- lastAssistantText: string;
2080
- signal: 'natural-end';
2081
- reanimateCount: number;
2082
- reanimateBudget: number;
2083
- }
2084
- /**
2085
- * FEATURE_184 (v0.7.45) — Extension `turn:complete` return surface.
2086
- *
2087
- * - `void` / `undefined` → accept the termination, defer to next
2088
- * handler (or fall through to agent terminal path if none).
2089
- * - `string` → reanimate: synthesize a user message, run another
2090
- * turn. Bounded by Runner's `stopHookReanimateBudget`.
2091
- * - `{ abort: true, reason }` → halt the run, surface reason to
2092
- * caller via `RunResult.output` + `stoppedByHook = true`.
2093
- */
2094
- type ExtensionTurnCompleteHookResult = void | string | {
2095
- readonly abort: true;
2096
- readonly reason: string;
2097
- };
2098
- interface ExtensionSessionHydrateHookContext {
2099
- sessionId: string;
2100
- getState: <T = KodaXJsonValue>(key: string) => T | undefined;
2101
- setState: (key: string, value: KodaXJsonValue | undefined) => void;
2102
- listRecords: (type?: string) => KodaXExtensionSessionRecord[];
2103
- appendRecord: (type: string, data?: KodaXJsonValue, options?: {
2104
- dedupeKey?: string;
2105
- }) => KodaXExtensionSessionRecord | undefined;
2106
- clearRecords: (type?: string) => number;
2107
- }
2108
- interface ExtensionEventMap {
2109
- 'session:start': {
2110
- provider: string;
2111
- sessionId: string;
2112
- };
2113
- 'turn:start': {
2114
- sessionId: string;
2115
- iteration: number;
2116
- maxIter: number;
2117
- };
2118
- 'text:delta': {
2119
- text: string;
2120
- };
2121
- 'thinking:delta': {
2122
- text: string;
2123
- };
2124
- 'thinking:end': {
2125
- thinking: string;
2126
- };
2127
- 'tool:start': {
2128
- name: string;
2129
- id: string;
2130
- input?: Record<string, unknown>;
2131
- };
2132
- 'tool:result': {
2133
- id: string;
2134
- name: string;
2135
- content: string;
2136
- };
2137
- 'provider:selected': {
2138
- provider: string;
2139
- model?: string;
2140
- };
2141
- 'provider:rate-limit': {
2142
- provider: string;
2143
- attempt: number;
2144
- maxRetries: number;
2145
- delayMs: number;
2146
- };
2147
- 'capability:search': {
2148
- providerId: string;
2149
- query: string;
2150
- kind?: CapabilityKind;
2151
- limit?: number;
2152
- };
2153
- 'capability:describe': {
2154
- providerId: string;
2155
- capabilityId: string;
2156
- };
2157
- 'capability:invoke': {
2158
- providerId: string;
2159
- capabilityId: string;
2160
- kind: CapabilityKind;
2161
- };
2162
- 'capability:refresh': {
2163
- providerId: string;
2164
- };
2165
- 'stream:end': undefined;
2166
- 'turn:end': {
2167
- sessionId: string;
2168
- iteration: number;
2169
- lastText: string;
2170
- hadToolCalls: boolean;
2171
- signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
2172
- };
2173
- 'complete': {
2174
- success: boolean;
2175
- signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
2176
- };
2177
- 'error': {
2178
- error: Error;
2179
- };
2180
- 'todo:created': {
2181
- id: string;
2182
- item: KodaXTodoItem;
2183
- source: TodoMutationSource;
2184
- };
2185
- 'todo:updated': {
2186
- id: string;
2187
- before: KodaXTodoItem;
2188
- after: KodaXTodoItem;
2189
- changedFields: readonly (keyof KodaXTodoItem)[];
2190
- source: TodoMutationSource;
2191
- };
2192
- 'todo:deleted': {
2193
- id: string;
2194
- item: KodaXTodoItem;
2195
- source: TodoMutationSource;
2196
- };
2197
- }
2198
- /**
2199
- * FEATURE_170 v0.7.41 — provenance tag for todo:* events / hooks. Lets
2200
- * extension authors distinguish LLM-driven mutations (`tool`) from
2201
- * runner-side automation (`internal`) — e.g. an extension that audits
2202
- * todo churn should ignore `internal` flips to avoid false positives.
2203
- */
2204
- type TodoMutationSource = 'tool' | 'internal';
2205
- /**
2206
- * FEATURE_170 v0.7.41 — seed shape passed to `'todo:before-create'`.
2207
- * Mirrors `TodoAddSeed` from todo-store.ts (kept structurally compatible
2208
- * to avoid coupling extension authors to the internal task-engine type).
2209
- *
2210
- * v0.7.42 — `content` renamed to `subject` + optional `description` to
2211
- * match claudecode V2 `TaskCreateTool` schema. See `TodoItem` JSDoc in
2212
- * packages/coding/src/types.ts.
2213
- */
2214
- interface ExtensionTodoCreateSeed {
2215
- readonly subject: string;
2216
- readonly description?: string;
2217
- readonly activeForm?: string;
2218
- readonly evaluator?: 'build' | 'test' | 'lint';
2219
- readonly owner?: string;
2220
- readonly sourceObligationIndex?: number;
2221
- readonly metadata?: Record<string, unknown>;
2222
- }
2223
- /**
2224
- * FEATURE_170 v0.7.41 — minimal todo item shape exposed to extensions
2225
- * via the todo:* events. Kept structurally identical to the engine's
2226
- * `TodoItem` so the runtime can pass values straight through without
2227
- * conversion, but redeclared here so extension consumers don't import
2228
- * from `packages/coding/src/types.ts` (which is task-engine internal).
2229
- *
2230
- * Drift guard: a compile-time assignability assertion at the bottom of
2231
- * this file fires if `TodoItem` (engine) gains a field that this
2232
- * extension-facing shape does NOT mirror — see `__todoItemParity` below.
2233
- */
2234
- interface KodaXTodoItem {
2235
- readonly id: string;
2236
- /** v0.7.42 — see TodoItem.subject JSDoc in packages/coding/src/types.ts. */
2237
- readonly subject: string;
2238
- readonly description?: string;
2239
- readonly status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'skipped' | 'cancelled';
2240
- readonly owner?: string;
2241
- readonly sourceObligationIndex?: number;
2242
- readonly note?: string;
2243
- readonly evaluator?: 'build' | 'test' | 'lint';
2244
- readonly activeForm?: string;
2245
- readonly metadata?: Record<string, unknown>;
2246
- }
2247
- interface ExtensionHookMap {
2248
- 'tool:before': (context: ExtensionToolBeforeHookContext) => Promise<void | string | false> | void | string | false;
2249
- 'provider:before': (context: ExtensionProviderBeforeHookContext) => Promise<void> | void;
2250
- 'turn:settle': (context: ExtensionTurnSettleHookContext) => Promise<void> | void;
2251
- 'turn:complete': (context: ExtensionTurnCompleteHookContext) => Promise<ExtensionTurnCompleteHookResult> | ExtensionTurnCompleteHookResult;
2252
- 'session:hydrate': (context: ExtensionSessionHydrateHookContext) => Promise<void> | void;
2253
- 'todo:before-create': (context: {
2254
- seed: ExtensionTodoCreateSeed;
2255
- }) => Promise<void | string | false> | void | string | false;
2256
- 'todo:before-complete': (context: {
2257
- id: string;
2258
- item: KodaXTodoItem;
2259
- }) => Promise<void | string | false> | void | string | false;
2260
- }
2261
- interface ExtensionRuntimeController {
2262
- queueUserMessage(message: string | KodaXMessage): void;
2263
- getSessionState<T = KodaXJsonValue>(key: string): T | undefined;
2264
- setSessionState(key: string, value: KodaXJsonValue | undefined): void;
2265
- appendSessionRecord(type: string, data?: KodaXJsonValue, options?: {
2266
- dedupeKey?: string;
2267
- }): KodaXExtensionSessionRecord | undefined;
2268
- listSessionRecords(type?: string): KodaXExtensionSessionRecord[];
2269
- clearSessionRecords(type?: string): number;
2270
- getActiveTools(): string[];
2271
- setActiveTools(toolNames: string[]): void;
2272
- getModelSelection(): ExtensionModelSelection;
2273
- setModelSelection(next: ExtensionModelSelection): void;
2274
- getThinkingLevel(): KodaXWireReasoningEffort | undefined;
2275
- setThinkingLevel(level: KodaXWireReasoningEffort): void;
2276
- }
2277
- interface KodaXExtensionAPI {
2278
- registerTool: (definition: LocalToolDefinition) => () => void;
2279
- getTool: (name: string) => RegisteredToolDefinition | undefined;
2280
- getBuiltinTool: (name: string) => RegisteredToolDefinition | undefined;
2281
- registerModelProvider: (registration: ModelProviderRegistration) => () => void;
2282
- registerCapabilityProvider: (provider: CapabilityProvider) => () => void;
2283
- registerCommand: (command: ExtensionCommandDefinition) => () => void;
2284
- registerSkillPath: (skillPath: string) => () => void;
2285
- /**
2286
- * FEATURE_191 (v0.7.43) — register a constructed agent at extension
2287
- * activate time. The extension supplies the agent name and an
2288
- * `AgentContent` body (instructions + optional tools/handoffs/
2289
- * reasoning/model/description); the runtime threads it through
2290
- * `buildAdmissionManifest` + `Runner.admit` and registers the
2291
- * activated Agent via `registerConstructedAgent({ source:
2292
- * 'extension' })`. The returned dispose fn (also auto-pushed onto
2293
- * the extension's disposables list) unregisters the agent on
2294
- * extension deactivate.
2295
- *
2296
- * Returns `Promise<() => void>` — **you MUST `await` the call**
2297
- * before invoking the dispose function. Unlike sibling
2298
- * `registerTool` (sync), this is async because `Runner.admit` is
2299
- * declared async (FEATURE_101 admission contract — admission may
2300
- * consult disk for handoff-target staged-agent resolution).
2301
- *
2302
- * @example
2303
- * ```ts
2304
- * // CORRECT — await unwraps the Promise to a sync dispose
2305
- * export default async function activate(api: KodaXExtensionAPI) {
2306
- * const dispose = await api.registerAgent('db-reviewer', {
2307
- * instructions: 'You review DB migrations.',
2308
- * description: 'DB migration reviewer',
2309
- * });
2310
- * // dispose() is now callable on demand; the runtime also auto-
2311
- * // disposes via the extension's disposables list at deactivate.
2312
- * }
2313
- * ```
2314
- *
2315
- * @example
2316
- * ```ts
2317
- * // WRONG — TypeScript catches this; .js / @ts-ignore consumers
2318
- * // hit a runtime TypeError because Promise is not a function.
2319
- * export default function activate(api: KodaXExtensionAPI) {
2320
- * const dispose = api.registerAgent('x', { instructions: '...' });
2321
- * dispose(); // TypeError: dispose is not a function
2322
- * }
2323
- * ```
2324
- *
2325
- * Throws on admission rejection (with the verdict reason) so the
2326
- * extension author sees the failure at activate time rather than
2327
- * having a silently-dropped registration. The throw also halts
2328
- * extension loading — the extension's other registrations roll back
2329
- * via `LoadedExtensionRecord.disposables` reverse-iterate.
2330
- */
2331
- registerAgent: (name: string, content: AgentContent) => Promise<() => void>;
2332
- on: <TEvent extends keyof ExtensionEventMap>(event: TEvent, handler: (payload: ExtensionEventMap[TEvent]) => Promise<void> | void) => () => void;
2333
- hook: <THook extends keyof ExtensionHookMap>(hook: THook, handler: ExtensionHookMap[THook]) => () => void;
2334
- logger: ExtensionLogger;
2335
- config: Readonly<Record<string, unknown>>;
2336
- runtime: ExtensionRuntimeController;
2337
- /** Extension-scoped key-value store that persists across sessions. */
2338
- persistence: KodaXExtensionStore;
2339
- /** Run a shell command with sandboxed environment (no API key leakage). */
2340
- exec: (command: string, options?: ExecOptions) => Promise<ExecResult>;
2341
- /** Send an HTTP webhook with timeout support. */
2342
- webhook: (url: string, payload: unknown, options?: WebhookOptions) => Promise<WebhookResult>;
2343
- }
2344
- type KodaXExtensionActivationResult = void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>;
2345
- interface KodaXExtensionModule {
2346
- default?: (api: KodaXExtensionAPI) => KodaXExtensionActivationResult;
2347
- activate?: (api: KodaXExtensionAPI) => KodaXExtensionActivationResult;
2348
- }
2349
-
2350
1323
  declare function stripHtmlToText(html: string): string;
2351
1324
  declare function extractHtmlTitle(html: string): string | undefined;
2352
1325
  declare function convertProviderSearchResults(results: unknown[], limit: number): KodaXRetrievalItem[];
@@ -2385,6 +1358,22 @@ declare function truncateLine(line: string, maxChars?: number): {
2385
1358
  };
2386
1359
  declare function persistToolOutput(toolName: string, content: string, ctx?: Pick<KodaXToolExecutionContext, 'gitRoot' | 'executionCwd'>): Promise<string>;
2387
1360
 
1361
+ type ToolResultBudgetReason = 'large_window' | 'normal_pressure' | 'small_window_pressure' | 'critical_pressure';
1362
+ interface ToolResultBudget {
1363
+ readonly pressure: RuntimeContextPressure;
1364
+ readonly contextWindow: number;
1365
+ readonly aggregateInlineBytes: number;
1366
+ readonly perResultInlineBytes: number;
1367
+ readonly reason: ToolResultBudgetReason;
1368
+ }
1369
+ interface ToolResultBudgetUsageInput {
1370
+ readonly contextWindow: number;
1371
+ readonly currentTokens: number;
1372
+ }
1373
+ declare function buildToolResultBudget(snapshot: RuntimeContextBudgetSnapshot): ToolResultBudget;
1374
+ declare function buildToolResultBudgetFromUsage(input: ToolResultBudgetUsageInput): ToolResultBudget;
1375
+ declare function clampToolResultPolicyToBudget(policy: ToolResultPolicy, budget: ToolResultBudget | undefined): ToolResultPolicy;
1376
+
2388
1377
  interface ToolResultPolicy {
2389
1378
  maxLines: number;
2390
1379
  maxBytes: number;
@@ -2414,6 +1403,8 @@ interface ApplyToolResultGuardrailOptions {
2414
1403
  * but together exceed the envelope cap.
2415
1404
  */
2416
1405
  forceSpill?: boolean;
1406
+ /** Optional context-aware cap; omitted keeps the legacy per-tool policy. */
1407
+ toolResultBudget?: ToolResultBudget;
2417
1408
  }
2418
1409
  declare function applyToolResultGuardrail(toolName: string, content: string, ctx: KodaXToolExecutionContext, options?: ApplyToolResultGuardrailOptions): Promise<GuardedToolResult>;
2419
1410
 
@@ -2936,6 +1927,32 @@ declare function buildPromptMessageContent(prompt: string, inputArtifacts?: read
2936
1927
  declare function extractPromptComparableText(content: string | readonly KodaXContentBlock[]): string;
2937
1928
  declare function extractComparableUserMessageText(message: KodaXMessage | undefined): string | undefined;
2938
1929
 
1930
+ interface ToolSearchIndexEntry {
1931
+ readonly name: string;
1932
+ readonly text: string;
1933
+ readonly terms: ReadonlyMap<string, number>;
1934
+ readonly tokenCount: number;
1935
+ }
1936
+ interface ToolSearchIndex {
1937
+ readonly entries: readonly ToolSearchIndexEntry[];
1938
+ readonly documentFrequency: ReadonlyMap<string, number>;
1939
+ }
1940
+ interface ToolSearchQueryParts {
1941
+ readonly required: readonly string[];
1942
+ readonly loose: readonly string[];
1943
+ }
1944
+ interface ToolSearchIndexOptions {
1945
+ readonly hints?: Readonly<Record<string, string>>;
1946
+ }
1947
+ interface ToolSearchResult {
1948
+ readonly name: string;
1949
+ readonly score: number;
1950
+ readonly matchedTerms: readonly string[];
1951
+ }
1952
+ declare function buildToolSearchIndex(definitions: readonly KodaXToolDefinition[], options?: ToolSearchIndexOptions): ToolSearchIndex;
1953
+ declare function searchToolIndex(index: ToolSearchIndex, query: string | ToolSearchQueryParts, maxResults: number): readonly ToolSearchResult[];
1954
+ declare function parseToolSearchQuery(query: string): ToolSearchQueryParts;
1955
+
2939
1956
  type KodaXProviderSourceKind = 'builtin' | 'runtime' | 'custom' | 'unknown';
2940
1957
  interface KodaXProviderCapabilitySnapshot {
2941
1958
  provider: string;
@@ -5791,5 +4808,5 @@ interface AuthorWorkflowViaWorkerHandle {
5791
4808
  */
5792
4809
  declare function authorWorkflowViaWorker(input: AuthorWorkflowViaWorkerInput): AuthorWorkflowViaWorkerHandle;
5793
4810
 
5794
- export { Agent, AgentMessage, AutoRules, BLOCKER_REQUIRED_CONSECUTIVE_TURNS, BUILTIN_WORKFLOWS, BoundExtensionRuntimeController, 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, CombinedExtensionRuntime, 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, DEFAULT_WORKFLOW_GENERATION_TIMEOUT_MS, EMIT_VERDICT_TOOL_NAME, ErrorCategory, ExtensionRuntimeContract, FailureStage, GENERATOR_AGENT_NAME, GoalCompleteResult, Guardrail, KODAX_TOOLS, KODAX_UNDERLYING_CAPABILITY_TOPICS, KodaXBaseProvider, KodaXChildContextBundle, KodaXClient, KodaXContentBlock, KodaXContextOptions, KodaXEvents, KodaXExecutionMode, KodaXExtensionRuntime, KodaXExtensionSessionRecord, KodaXInputArtifact, KodaXJsonValue, KodaXManualTopic, KodaXManualTopicId, KodaXMessage, KodaXOptions, KodaXProviderCapabilityProfile, KodaXProviderPolicyHints, KodaXReasoningCapability, KodaXReasoningMode, KodaXRepoIntelligenceCapability, KodaXRepoIntelligenceMode, KodaXRepoIntelligenceResolvedMode, KodaXRepoIntelligenceTrace, KodaXRepoRoutingSignals, KodaXResult, KodaXSessionControl, KodaXSessionError, KodaXSessionMutators, KodaXTaskRoutingDecision, KodaXTaskType, KodaXTerminalError, KodaXThinkingDepth, KodaXTimeoutConfig, KodaXTokenUsage, KodaXToolDefinition, KodaXToolError, KodaXToolExecutionContext, KodaXToolUseBlock, KodaXWireReasoningEffort, MANUAL_REGISTRY, MANUAL_TOPIC_IDS, McpCapabilityProvider, McpProviderOptions, McpReverseCapabilities, McpRoot, 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, REPO_EXPLORER_AGENT_NAME, REPO_EXPLORER_TOOL_NAMES, RecoveryDecision, RecoveryResult, ResilienceClassification, ResolveKodaXManualInput, ResolveKodaXManualOptions, ResolveKodaXManualResult, RuntimeDefaultsSnapshot, SCOUT_AGENT_NAME, SCOUT_THEN_AUTHOR_PROMPT_LINES, SELF_KNOWLEDGE_ROUTING_RULE, SYSTEM_PROMPT, SYSTEM_WORKFLOW_LIMITS, SessionErrorMetadata, SignalCollector, StableBoundaryTracker, TASK_ENGINE_ROLE_AGENTS, TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME, TRACING_ENV, ToolCallSignal, ToolSideEffect, WORKER_AGENT_NAME, WORKFLOW_GENERATION_SYSTEM_PROMPT, WorkflowEventCorrelation, WorkflowHostPolicy, _resetRuntimeForTesting, activate, analyzeChangedScope, appendAuditEntry, applyAccountingDelta, applyToolResultGuardrail, authorWorkflowViaWorker, bashSignalCollector, bootstrapTracing, boundedRevise, budgetCeiling, buildApprovalSummary, buildBlockedGoal, buildCapabilityContextSections, buildClassifierPrompt, buildCompleteGoal, buildCreatedGoal, buildFallbackRoutingDecision, buildLlmReviewPrompt, buildManualToolDescription, buildMcpReverseCapabilities, buildPausedGoal, buildPromptMessageContent, buildPromptSnapshot, buildProviderCapabilitySnapshot, buildProviderPolicyHintsForDecision, buildProviderPolicyPromptNotes, buildRepoIntelligenceContext, buildRepoIntelligenceIndex, buildRepoOverview, buildResumedGoal, buildScoutThenAuthorPrompt, buildSelfKnowledgeRoutingRule, buildSystemPrompt, buildSystemPromptSnapshot, buildWorkflowGenerationSkillContext, buildWorkflowGenerationUserPrompt, checkAbsoluteDeny, checkIncompleteToolCalls, checkPromiseSignal, clampWorkflowLimits, classify, classifyBashCommand, classifyError, classifyResilienceError, combineExtensionRuntimes, computeInputSignature, configureRuntime, convertCapabilityReadResult, convertProviderSearchResults, createBashClassifierConfig, createBuiltinToolDefinition, createCodingWorkflowBackend, createCtxProxy, createDefaultCodingAgent, createDenialTracker, createExtensionRuntime, createKodaXTaskRunner, createPromptSection, createReasoningPlan, createRunGraphWriter, createSessionControl, createToolResultTruncationGuardrail, createWorkflowLifecycleController, createWorkflowPatternTemplateModule, createWorkflowRunManager, dedupeExtensionPathsByEntrypoint, defaultPolicy, deleteSavedWorkflow, disableSelfModify, discoverDefaultExtensions, discoverExtensionsInDirectory, discoverExtensionsInDirectoryDetailed, discoverMarkdownAgents, discoverSavedWorkflows, drainPendingSwaps, emitVerdict, emitWorkflowAgentDigest, ensureBuiltinRepoExplorerAgent, evaluateProviderPolicy, excludeExtensionPathsByEntrypoint, exec, executeTool, extractComparableUserMessageText, extractHtmlTitle, extractPromptComparableText, fileSignalCollector, finalizeRetrievalResult, findByVersion, formatParallelDispatchResult, formatSize, generateWorkflow, generateWorkflowFromOptions, getActiveExtensionRuntime, getAllRegisteredTools, getBuiltinRegisteredToolDefinition, getBuiltinToolDefinition, getBuiltinWorkflow, getDefaultExtensionDirectory, getDefaultWorkflowRunManager, getDenialContext, getImpactEstimate, getModuleContext, getProcessContext, getRegisteredToolDefinition, getRepoIntelligenceIndex, getRepoOverview, getRepoRoutingSignals, getRequiredToolParams, getSymbolContext, getTool, getToolDefinition, getToolRegistrations, getToolResultPolicy, getWorkflowPatternTemplate, goalTokenDelta, hasPendingSwap, inferTaskType, inspectEditFailure, inspectRepoIntelligenceRuntime, isDeniedRecently, isParallelDispatchDirective, isSessionRecoveryCandidateError, isSupportedExtensionModulePath, isToolFileMutation, isToolMutation, isToolNetworkRead, isToolPlanModeAllowed, isValidTokenBudget, languageIdForPath, listAll, list as listArtifacts, listBuiltinToolDefinitions, listBuiltinWorkflows, listConstructed, listToolDefinitions, listTools, listWorkflowPatternTemplates, loadAgentsFromMarkdown, loadGeneratedWorkflowFromRun, loadHandler, loadSavedWorkflow, loadSavedWorkflowCapsule, mcpRootsFromWorkspace, normalizeWorkflowModule, orderPromptSections, parallelInvestigation, parseClassifierOutput, parseEditToolError, parseLlmReviewVerdict, parseModelSpec, parseWorkflowGeneration, persistToolOutput, preflightWorkflowCapsule, prewarmRepoIntelligenceCaches, readArtifact, readAuditEntries, readBudget, readDisableState, readWindowFromEnv as readSpeculativeWindowFromEnv, reasoningModeToDepth, reconstructMessagesWithToolGuard, recordBlockerAttempt, recordDenial, registerCodingInvariants, registerConfiguredMcpCapabilityProvider, registerOfficialSandboxExtension, registerTool, rehydrateActiveArtifacts, remaining as remainingSelfModifyBudget, renameSavedWorkflow, renderChangedScope, renderImpactEstimate, renderModuleContext, renderProcessContext, renderPromptSections, renderRepoOverview, renderRetrievalResult, renderSymbolContext, replaceSavedWorkflow, report as reportLspDiagnostics, resetBlockerCounter, resetBudget, resolveClassifierModel, resolveConstructedAgent, resolveExtensionEntrypoint, resolveKodaXManual, resolveReasoningMode, resolveRepoIntelligenceMode, resolveRepoIntelligenceRuntimeConfig, resolveResilienceConfig, resolveToolCapability, resolveWorkflowGenerationTimeoutMs, resolveWorkflowIdentity, revoke, rollbackSelfModify, runAstRules, runKodaX, runLlmReview, runManagedTask, runOrchestration, runWorkflowFromOptions, runWorkflowModule, safeWorkflowArtifactName, saveGeneratedWorkflow, saveGeneratedWorkflowFromRun, setActiveExtensionRuntime, shouldFlipBudgetLimited, speculativeRace, stage, startKodaX, startManagedWorkflow, 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, turnWallTimeDelta, validateGeneratedWorkflowSource, validateSubtaskIndependence, validateToolSchemaForProvider, verifyGoalCompletion, webhook, withManualToolBranding, workerAgent };
5795
- export type { AbsoluteDenyMatch, AbsoluteDenyMiss, AbsoluteDenyResult, AgentArtifact, ArtifactStatus, AstCheckResult, AstRuleId, AstRuleViolation, AuditEntry, AuditEventKind, AuthorWorkflowViaWorkerHandle, AuthorWorkflowViaWorkerInput, BashClassificationResult, BashClassifierConfig, BashRiskLevel, BlockerAttemptResult, BootstrapTracingOptions, BudgetState, BuildClassifierPromptInput, BuildPromptInput, Capabilities, ChangedFileEntry, ChangedFileStatus, ChangedScopeAreaSummary, ChangedScopeReport, ClassifierDecision, ClassifierPrompt, ClassifyDecision, ClassifyOptions, CodingWorkflowBackendDeps, ConstructionArtifact, ConstructionPolicy, ConstructionPolicyVerdict, CreateCtxProxyOptions, CreateKodaXTaskRunnerOptions, CreateWorkflowLifecycleControllerOptions, DeleteSavedWorkflowInput, DeleteWorkflowRunOptions, DenialRecord, DenialTracker, DisableState, DiscoverMarkdownAgentsResult, DiscoveredMarkdownAgent, EditRecoveryDiagnostic, EditToolErrorCode, ErrorClassification, ExecOptions, ExecResult, ExtensionCommandContext, ExtensionCommandDefinition, ExtensionCommandInvocation, ExtensionCommandResult, ExtensionContributionSource, ExtensionDiscoveryResult, ExtensionDiscoverySkipReason, ExtensionEventMap, ExtensionFailureDiagnostic, ExtensionFailureStage, ExtensionHookMap, ExtensionLoadSource, ExtensionLogger, ExtensionRuntimeController, ExtensionRuntimeDiagnostics, ExtensionToolBeforeHookContext, GenerateWorkflowFromOptionsInput, GenerateWorkflowInput, GeneratedWorkflow, GoalCompletionVerifier, ImpactEstimateResult, InvestigationFinding, 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, LoadGeneratedWorkflowFromRunInput, LoadHandlerOptions, LoadHandlerScope, LoadedExtensionDiagnostic, LoadedGeneratedWorkflowFromRun, LocalToolDefinition, ManagedWorkflowRun, ManagedWorkflowSnapshot, ManagedWorkflowSource, MarkdownLoadFailure, McpReverseWorkspace, ModelProviderRegistration, ModuleCapsule, ModuleContextResult, OfficialSandboxMode, OfficialSandboxOptions, OrchestrationArtifact, OrchestrationCompletedTask, OrchestrationRunEvents, OrchestrationRunOptions, OrchestrationRunResult, OrchestrationTaskBudget, OrchestrationTaskContext, OrchestrationTaskExecution, OrchestrationTaskStatus, OrchestrationTraceEvent, OrchestrationWorkerResult, OrchestrationWorkerRunner, OrchestrationWorkerSpec, ParallelDispatchDirective, ParallelDispatchResult, ParallelInvestigationArgs, ParallelInvestigationResult, ParallelSubtask, ParsedModelSpec, ProcessCapsule, ProcessContextResult, ProcessStep, ProtocolEmitterMetadata, RegisteredCapabilityProviderDiagnostic, RegisteredCommandDiagnostic, RegisteredHookDiagnostic, RegisteredToolDefinition, RegisteredToolDiagnostic, RenameSavedWorkflowInput, ReplaceSavedWorkflowInput, ReplaceSavedWorkflowResult, RepoAreaKind, RepoAreaOverview, RepoIntelligenceIndex, RepoIntelligenceRuntimeInspection, RepoLanguageId, RepoLanguageSupport, RepoOverview, RepoSymbolKind, RepoSymbolRecord, RepoSymbolReference, ResolveClassifierModelOptions, ResolveSource, ResolvedClassifierModel, RollbackResult, RunGraphWriter, RunGraphWriterDeps, RunJsonInput, RunWorkflowFromOptionsInput, RunWorkflowModuleOptions, RunWorkflowModuleOutcome, RunningSession, SaveGeneratedWorkflowFromRunInput, SaveGeneratedWorkflowInput, SavedGeneratedWorkflowFile, SavedWorkflowDirs, SavedWorkflowExecution, SavedWorkflowRef, SavedWorkflowSource, SchemaProvider, SchemaValidationResult, ScriptSource, SelfModifyAskUser, SelfModifyAskUserInput, SelfModifyDiffSeverity, SelfModifyDiffSummary, SkippedExtensionDiscoveryEntry, SpeculativeResult, StagedHandle, StartManagedWorkflowInput, StartManagedWorkflowResult, StripOptions, SymbolContextResult, TestArtifactOptions, TestResult, TierZeroPatternId, ToolContent, ToolDefinitionSource, ToolHandler, ToolRegistrationOptions, ToolRegistry, VerifyGoalCompletionOptions, WebhookOptions, WebhookResult, WorkflowCapsulePreflightEnvironment, WorkflowCapsulePreflightInput, WorkflowCapsulePreflightIssue, WorkflowCapsulePreflightResult, WorkflowChildOptions, WorkflowGenerationResult, WorkflowGenerationTextFn, WorkflowGenerationTextRequest, WorkflowIdentityResolution, WorkflowIdentityResolverInput, WorkflowLifecycleController, WorkflowPatternTemplate, WorkflowRunListOptions, WorkflowRunManager, WorkflowRunProcessMetadata, WorkflowRunRetentionOptions, WorkflowRunRetentionResult, WorkflowScriptSnapshotInput, WorkflowScriptSnapshotRef };
4811
+ export { Agent, AgentMessage, AutoRules, BLOCKER_REQUIRED_CONSECUTIVE_TURNS, BUILTIN_WORKFLOWS, BoundExtensionRuntimeController, CANCELLED_TOOL_RESULT_MESSAGE, CANCELLED_TOOL_RESULT_PREFIX, CODING_AGENT_MARKER, CODING_INVARIANTS, CODING_SUMMARY_PROMPT, CODING_UPDATE_SUMMARY_PROMPT, Capabilities, CapabilityProvider, CapabilityResult, KodaXClient as Client, CombinedExtensionRuntime, ConstructionArtifact, ConstructionPolicy, DEFAULT_CODING_AGENT_NAME, DEFAULT_DANGEROUS_PATTERNS, 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, DEFAULT_WORKFLOW_GENERATION_TIMEOUT_MS, EMIT_VERDICT_TOOL_NAME, ErrorCategory, ExtensionCommandDefinition, ExtensionContributionSource, ExtensionEventMap, ExtensionFailureStage, ExtensionHookMap, ExtensionLoadSource, ExtensionRuntimeContract, ExtensionRuntimeDiagnostics, FailureStage, GENERATOR_AGENT_NAME, GoalCompleteResult, Guardrail, KODAX_TOOLS, KODAX_UNDERLYING_CAPABILITY_TOPICS, KodaXAgentScope, KodaXBaseProvider, KodaXChildContextBundle, KodaXClient, KodaXContentBlock, KodaXContextOptions, KodaXEvents, KodaXExecutionMode, KodaXExtensionRuntime, KodaXInputArtifact, KodaXManualTopic, KodaXManualTopicId, KodaXMessage, KodaXOptions, KodaXProviderCapabilityProfile, KodaXProviderPolicyHints, KodaXReasoningCapability, KodaXReasoningMode, KodaXRepoIntelligenceCapability, KodaXRepoIntelligenceMode, KodaXRepoIntelligenceResolvedMode, KodaXRepoIntelligenceTrace, KodaXRepoRoutingSignals, KodaXResult, KodaXRetrievalItem, KodaXRetrievalResult, KodaXRetrievalToolName, KodaXSessionControl, KodaXSessionError, KodaXSessionMutators, KodaXTaskRoutingDecision, KodaXTaskType, KodaXTerminalError, KodaXThinkingDepth, KodaXTimeoutConfig, KodaXTokenUsage, KodaXToolDefinition, KodaXToolError, KodaXToolExecutionContext, KodaXToolUseBlock, KodaXWireReasoningEffort, LocalToolDefinition, MANUAL_REGISTRY, MANUAL_TOPIC_IDS, McpCapabilityProvider, McpProviderOptions, McpReverseCapabilities, McpRoot, 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, REPO_EXPLORER_AGENT_NAME, REPO_EXPLORER_TOOL_NAMES, RecoveryDecision, RecoveryResult, RegisteredToolDefinition, ResilienceClassification, ResolveKodaXManualInput, ResolveKodaXManualOptions, ResolveKodaXManualResult, RuntimeContextBudgetSnapshot, RuntimeContextPressure, RuntimeDefaultsSnapshot, SCOUT_AGENT_NAME, SCOUT_THEN_AUTHOR_PROMPT_LINES, SELF_KNOWLEDGE_ROUTING_RULE, SYSTEM_PROMPT, SYSTEM_WORKFLOW_LIMITS, ScriptSource, SessionErrorMetadata, SignalCollector, StableBoundaryTracker, StagedHandle, TASK_ENGINE_ROLE_AGENTS, TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME, TRACING_ENV, TestResult, ToolCallSignal, ToolHandler, ToolRegistrationOptions, WORKER_AGENT_NAME, WORKFLOW_GENERATION_SYSTEM_PROMPT, WorkflowEventCorrelation, WorkflowHostPolicy, _resetRuntimeForTesting, activate, analyzeChangedScope, appendAuditEntry, applyAccountingDelta, applyToolResultGuardrail, authorWorkflowViaWorker, bashSignalCollector, bootstrapTracing, boundedRevise, budgetCeiling, buildApprovalSummary, buildBlockedGoal, buildCapabilityContextSections, buildClassifierPrompt, buildCompleteGoal, buildCreatedGoal, buildFallbackRoutingDecision, buildLlmReviewPrompt, buildManualToolDescription, buildMcpReverseCapabilities, buildPausedGoal, buildPromptMessageContent, buildPromptSnapshot, buildProviderCapabilitySnapshot, buildProviderPolicyHintsForDecision, buildProviderPolicyPromptNotes, buildRepoIntelligenceContext, buildRepoIntelligenceIndex, buildRepoOverview, buildResumedGoal, buildScoutThenAuthorPrompt, buildSelfKnowledgeRoutingRule, buildSystemPrompt, buildSystemPromptSnapshot, buildToolResultBudget, buildToolResultBudgetFromUsage, buildToolSearchIndex, buildWorkflowGenerationSkillContext, buildWorkflowGenerationUserPrompt, checkAbsoluteDeny, checkIncompleteToolCalls, checkPromiseSignal, clampToolResultPolicyToBudget, clampWorkflowLimits, classify, classifyBashCommand, classifyError, classifyResilienceError, combineExtensionRuntimes, computeInputSignature, configureRuntime, convertCapabilityReadResult, convertProviderSearchResults, createBashClassifierConfig, createBuiltinToolDefinition, createCodingWorkflowBackend, createCtxProxy, createDefaultCodingAgent, createDenialTracker, createExtensionRuntime, createKodaXTaskRunner, createPromptSection, createReasoningPlan, createRunGraphWriter, createSessionControl, createToolResultTruncationGuardrail, createWorkflowLifecycleController, createWorkflowPatternTemplateModule, createWorkflowRunManager, dedupeExtensionPathsByEntrypoint, deleteSavedWorkflow, disableSelfModify, discoverDefaultExtensions, discoverExtensionsInDirectory, discoverExtensionsInDirectoryDetailed, discoverMarkdownAgents, discoverSavedWorkflows, emitVerdict, emitWorkflowAgentDigest, ensureBuiltinRepoExplorerAgent, evaluateProviderPolicy, excludeExtensionPathsByEntrypoint, executeTool, extractComparableUserMessageText, extractHtmlTitle, extractPromptComparableText, fileSignalCollector, finalizeRetrievalResult, findByVersion, formatParallelDispatchResult, formatSize, generateWorkflow, generateWorkflowFromOptions, getActiveExtensionRuntime, getAllRegisteredTools, getBuiltinRegisteredToolDefinition, getBuiltinToolDefinition, getBuiltinWorkflow, getDefaultExtensionDirectory, getDefaultWorkflowRunManager, getDenialContext, getImpactEstimate, getModuleContext, getProcessContext, getRegisteredToolDefinition, getRepoIntelligenceIndex, getRepoOverview, getRepoRoutingSignals, getRequiredToolParams, getSymbolContext, getTool, getToolDefinition, getToolRegistrations, getToolResultPolicy, getWorkflowPatternTemplate, goalTokenDelta, inferTaskType, inspectEditFailure, inspectRepoIntelligenceRuntime, isDeniedRecently, isParallelDispatchDirective, isSessionRecoveryCandidateError, isSupportedExtensionModulePath, isToolFileMutation, isToolMutation, isToolNetworkRead, isToolPlanModeAllowed, isValidTokenBudget, languageIdForPath, listAll, list as listArtifacts, listBuiltinToolDefinitions, listBuiltinWorkflows, listConstructed, listToolDefinitions, listTools, listWorkflowPatternTemplates, loadAgentsFromMarkdown, loadGeneratedWorkflowFromRun, loadHandler, loadMarkdownAgentScope, loadSavedWorkflow, loadSavedWorkflowCapsule, mcpRootsFromWorkspace, normalizeWorkflowModule, orderPromptSections, parallelInvestigation, parseClassifierOutput, parseEditToolError, parseLlmReviewVerdict, parseModelSpec, parseToolSearchQuery, parseWorkflowGeneration, persistToolOutput, preflightWorkflowCapsule, prewarmRepoIntelligenceCaches, readArtifact, readAuditEntries, readBudget, readDisableState, readWindowFromEnv as readSpeculativeWindowFromEnv, reasoningModeToDepth, reconstructMessagesWithToolGuard, recordBlockerAttempt, recordDenial, registerCodingInvariants, registerConfiguredMcpCapabilityProvider, registerOfficialSandboxExtension, registerTool, rehydrateActiveArtifacts, remaining as remainingSelfModifyBudget, renameSavedWorkflow, renderChangedScope, renderImpactEstimate, renderModuleContext, renderProcessContext, renderPromptSections, renderRepoOverview, renderRetrievalResult, renderSymbolContext, replaceSavedWorkflow, report as reportLspDiagnostics, resetBlockerCounter, resetBudget, resolveClassifierModel, resolveExtensionEntrypoint, resolveKodaXManual, resolveReasoningMode, resolveRepoIntelligenceMode, resolveRepoIntelligenceRuntimeConfig, resolveResilienceConfig, resolveToolCapability, resolveWorkflowGenerationTimeoutMs, resolveWorkflowIdentity, revoke, rollbackSelfModify, runAstRules, runKodaX, runLlmReview, runManagedTask, runOrchestration, runWorkflowFromOptions, runWorkflowModule, safeWorkflowArtifactName, saveGeneratedWorkflow, saveGeneratedWorkflowFromRun, searchToolIndex, setActiveExtensionRuntime, shouldFlipBudgetLimited, speculativeRace, stage, startKodaX, startManagedWorkflow, 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, turnWallTimeDelta, validateGeneratedWorkflowSource, validateSubtaskIndependence, validateToolSchemaForProvider, verifyGoalCompletion, withManualToolBranding, workerAgent };
4812
+ export type { AbsoluteDenyMatch, AbsoluteDenyMiss, AbsoluteDenyResult, AstCheckResult, AstRuleId, AstRuleViolation, AuditEntry, AuditEventKind, AuthorWorkflowViaWorkerHandle, AuthorWorkflowViaWorkerInput, BashClassificationResult, BashClassifierConfig, BashRiskLevel, BlockerAttemptResult, BootstrapTracingOptions, BudgetState, BuildClassifierPromptInput, BuildPromptInput, ChangedFileEntry, ChangedFileStatus, ChangedScopeAreaSummary, ChangedScopeReport, ClassifierDecision, ClassifierPrompt, ClassifyDecision, ClassifyOptions, CodingWorkflowBackendDeps, CreateCtxProxyOptions, CreateKodaXTaskRunnerOptions, CreateWorkflowLifecycleControllerOptions, DeleteSavedWorkflowInput, DeleteWorkflowRunOptions, DenialRecord, DenialTracker, DisableState, DiscoverMarkdownAgentsResult, DiscoveredMarkdownAgent, EditRecoveryDiagnostic, EditToolErrorCode, ErrorClassification, ExtensionDiscoveryResult, ExtensionDiscoverySkipReason, GenerateWorkflowFromOptionsInput, GenerateWorkflowInput, GeneratedWorkflow, GoalCompletionVerifier, ImpactEstimateResult, InvestigationFinding, KodaXAgentWorkerSpec, KodaXPromptSection, KodaXPromptSectionDefinition, KodaXPromptSectionSlot, KodaXPromptSectionStability, KodaXPromptSnapshot, KodaXPromptSnapshotMetadata, KodaXProviderCapabilitySnapshot, KodaXProviderPolicyDecision, KodaXProviderPolicyIssue, KodaXProviderPolicyIssueSeverity, KodaXProviderSourceKind, LanguageCapabilityTier, LlmReviewClient, LlmReviewResult, LlmReviewVerdict, LoadAgentsFromMarkdownOptions, LoadAgentsFromMarkdownResult, LoadGeneratedWorkflowFromRunInput, LoadHandlerOptions, LoadHandlerScope, LoadMarkdownAgentScopeOptions, LoadMarkdownAgentScopeResult, LoadedGeneratedWorkflowFromRun, LoadedMarkdownAgent, ManagedWorkflowRun, ManagedWorkflowSnapshot, ManagedWorkflowSource, MarkdownAgentLoadWarning, MarkdownAgentToolFilter, MarkdownLoadFailure, McpReverseWorkspace, ModuleCapsule, ModuleContextResult, OfficialSandboxMode, OfficialSandboxOptions, OrchestrationArtifact, OrchestrationCompletedTask, OrchestrationRunEvents, OrchestrationRunOptions, OrchestrationRunResult, OrchestrationTaskBudget, OrchestrationTaskContext, OrchestrationTaskExecution, OrchestrationTaskStatus, OrchestrationTraceEvent, OrchestrationWorkerResult, OrchestrationWorkerRunner, OrchestrationWorkerSpec, ParallelDispatchDirective, ParallelDispatchResult, ParallelInvestigationArgs, ParallelInvestigationResult, ParallelSubtask, ParsedModelSpec, ProcessCapsule, ProcessContextResult, ProcessStep, ProtocolEmitterMetadata, RenameSavedWorkflowInput, ReplaceSavedWorkflowInput, ReplaceSavedWorkflowResult, RepoAreaKind, RepoAreaOverview, RepoIntelligenceIndex, RepoIntelligenceRuntimeInspection, RepoLanguageId, RepoLanguageSupport, RepoOverview, RepoSymbolKind, RepoSymbolRecord, RepoSymbolReference, ResolveClassifierModelOptions, ResolveSource, ResolvedClassifierModel, RollbackResult, RunGraphWriter, RunGraphWriterDeps, RunJsonInput, RunWorkflowFromOptionsInput, RunWorkflowModuleOptions, RunWorkflowModuleOutcome, RunningSession, SaveGeneratedWorkflowFromRunInput, SaveGeneratedWorkflowInput, SavedGeneratedWorkflowFile, SavedWorkflowDirs, SavedWorkflowExecution, SavedWorkflowRef, SavedWorkflowSource, SchemaProvider, SchemaValidationResult, SelfModifyAskUser, SelfModifyAskUserInput, SelfModifyDiffSeverity, SelfModifyDiffSummary, SkippedExtensionDiscoveryEntry, SpeculativeResult, StartManagedWorkflowInput, StartManagedWorkflowResult, StripOptions, SymbolContextResult, TestArtifactOptions, TierZeroPatternId, ToolResultBudget, ToolResultBudgetReason, ToolResultBudgetUsageInput, ToolSearchIndex, ToolSearchIndexEntry, ToolSearchIndexOptions, ToolSearchQueryParts, ToolSearchResult, VerifyGoalCompletionOptions, WorkflowCapsulePreflightEnvironment, WorkflowCapsulePreflightInput, WorkflowCapsulePreflightIssue, WorkflowCapsulePreflightResult, WorkflowChildOptions, WorkflowGenerationResult, WorkflowGenerationTextFn, WorkflowGenerationTextRequest, WorkflowIdentityResolution, WorkflowIdentityResolverInput, WorkflowLifecycleController, WorkflowPatternTemplate, WorkflowRunListOptions, WorkflowRunManager, WorkflowRunProcessMetadata, WorkflowRunRetentionOptions, WorkflowRunRetentionResult, WorkflowScriptSnapshotInput, WorkflowScriptSnapshotRef };