@kodax-ai/kodax 0.7.63 → 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.
- package/CHANGELOG.md +2300 -2204
- package/README.md +79 -7
- package/README_CN.md +52 -3
- package/dist/chunks/{agent-SL444XLN.js → agent-KER4WDNO.js} +1 -1
- package/dist/chunks/argument-completer-HK3MHA3K.js +2 -0
- package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
- package/dist/chunks/chunk-3HKBBY74.js +339 -0
- package/dist/chunks/chunk-AKBH2EEE.js +8 -0
- package/dist/chunks/{chunk-KCFVGXVK.js → chunk-ALS32RNZ.js} +1 -1
- package/dist/chunks/chunk-MHRN2LQV.js +328 -0
- package/dist/chunks/{chunk-HP4FXMEM.js → chunk-NBQW7PNZ.js} +2 -2
- package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
- package/dist/chunks/chunk-ONUPGMER.js +2 -0
- package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
- package/dist/chunks/{chunk-4MIHVNB7.js → chunk-QAQ2HNXD.js} +112 -112
- package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
- package/dist/chunks/chunk-QJVZZSEO.js +56 -0
- package/dist/chunks/chunk-TLJGOKBT.js +729 -0
- package/dist/chunks/{chunk-7MPU7TP6.js → chunk-VS4CDDEF.js} +243 -243
- package/dist/chunks/chunk-WBBEJIAY.js +306 -0
- package/dist/chunks/{chunk-L3MF5V64.js → chunk-WMIZCY2J.js} +1 -1
- package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
- package/dist/chunks/compaction-config-7GMUFNPB.js +2 -0
- package/dist/chunks/{construction-bootstrap-EFZBONTK.js → construction-bootstrap-3XDS2D5K.js} +1 -1
- package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
- package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
- package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
- package/dist/chunks/dist-4YAYT2TO.js +2 -0
- package/dist/chunks/host-KG3456QP.js +2 -0
- package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
- package/dist/chunks/run-manager-6CAH3KTA.js +2 -0
- package/dist/chunks/utils-OT5ENFUL.js +2 -0
- package/dist/constructed-handler-worker.js +2 -0
- package/dist/index.d.ts +21 -10
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1116 -1089
- package/dist/runtime-worker.js +2843 -0
- package/dist/sdk-agent.d.ts +27 -8
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +76 -1020
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +2 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +197 -183
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +982 -0
- package/dist/sdk-runtime.js +2 -0
- package/dist/sdk-session.d.ts +3 -3
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +191 -10
- package/dist/types-chunks/{bash-prefix-extractor.d-CZW9fRoa.d.ts → bash-prefix-extractor.d-BjkITAva.d.ts} +142 -3
- package/dist/types-chunks/{run-manager.d-CYTnWhZY.d.ts → capsule.d-hVhPNkHd.d.ts} +5 -92
- package/dist/types-chunks/commands.d-C3B1TdGM.d.ts +213 -0
- package/dist/types-chunks/{types.d-1CnTg7Sd.d.ts → guardrail.d-C_Siraua.d.ts} +3 -128
- package/dist/types-chunks/{guardrail.d-MR6LwMB2.d.ts → guardrail.d-wk-s0psS.d.ts} +2 -2
- package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
- package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
- package/dist/types-chunks/public-api.d-jtREVfEq.d.ts +596 -0
- package/dist/types-chunks/run-manager.d-CFknOfo1.d.ts +91 -0
- package/dist/types-chunks/{sdk-session-RBSBBKol.d.ts → sdk-session-CLqyfAmf.d.ts} +8 -306
- package/dist/types-chunks/types.d-BMLxKV69.d.ts +128 -0
- package/dist/types-chunks/types.d-CUN_bZU7.d.ts +975 -0
- package/dist/types-chunks/{utils.d-C14jZ9ZM.d.ts → utils.d-C1rpoeDh.d.ts} +84 -72
- package/package.json +7 -1
- package/dist/chunks/argument-completer-EN63ZVJK.js +0 -2
- package/dist/chunks/chunk-KHICMJIR.js +0 -310
- package/dist/chunks/chunk-LGR7ACBQ.js +0 -326
- package/dist/chunks/chunk-RR7W7UF6.js +0 -341
- package/dist/chunks/chunk-UGTK2JIJ.js +0 -731
- package/dist/chunks/chunk-V4WSBIXB.js +0 -2
- package/dist/chunks/chunk-VSWROENP.js +0 -52
- package/dist/chunks/compaction-config-4VIONMFB.js +0 -2
- package/dist/chunks/dist-EDF2YUF6.js +0 -2
- package/dist/chunks/host-J4HPDLFC.js +0 -2
- package/dist/chunks/run-manager-ZVSW2OWM.js +0 -2
- package/dist/chunks/utils-5HDLYTZJ.js +0 -2
- package/dist/types-chunks/storage.d-C6kkAEch.d.ts +0 -280
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as KodaXGoalState, h as AgentMessage, bM as StopHookFn, af as KodaXSessionLineage, a4 as KodaXJsonValue, U as KodaXExtensionSessionRecord, f as Agent, c8 as WorkflowIsolation, V as KodaXExtensionSessionState, a6 as KodaXSessionArtifactLedgerEntry, bx as SessionErrorMetadata, al as KodaXSessionScope, am as KodaXSessionStorage, a2 as KodaXInputArtifact, C as ChildTaskRegistry, c5 as WorkflowEventCorrelation, x as CompactionUpdate, ch as WorkflowProcessEvent, c4 as WorkflowEvent, q as AskUserQuestionOptions, m as AskUserAnswer, o as AskUserMultiOptions, b0 as MemoryReviewPlan, b1 as MemoryReviewRunner, J as Guardrail, B as DiscoveredInstance, bQ as TaskAbortRegistry } from './process.d-CY2g03Mb.js';
|
|
2
|
-
import { $ as KodaXTokenUsage, j as KodaXMessage, a8 as KodaXWireReasoningEffort, T as KodaXTaskRoutingDecision, U as KodaXTaskType, V as KodaXTaskWorkIntent, P as KodaXTaskComplexity, J as KodaXRiskLevel, g as KodaXHarnessProfile, e as KodaXExecutionMode, b as KodaXChildFanoutClass, E as KodaXReasoningMode, I as KodaXReviewScale } from './types.d-Bp4Lm1jv.js';
|
|
2
|
+
import { $ as KodaXTokenUsage, j as KodaXMessage, a0 as KodaXToolDefinition, a8 as KodaXWireReasoningEffort, T as KodaXTaskRoutingDecision, U as KodaXTaskType, V as KodaXTaskWorkIntent, P as KodaXTaskComplexity, J as KodaXRiskLevel, g as KodaXHarnessProfile, e as KodaXExecutionMode, b as KodaXChildFanoutClass, E as KodaXReasoningMode, I as KodaXReviewScale } from './types.d-Bp4Lm1jv.js';
|
|
3
3
|
import { d as SkillDynamicContextExecutor } from './types.d-vJExiRje.js';
|
|
4
4
|
import { Diagnostic, Position, Location, Hover, DocumentSymbol, SymbolInformation, WorkspaceSymbol, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from 'vscode-languageserver-protocol';
|
|
5
5
|
import { K as KodaXLlmTimeoutConfig, a as CostTracker } from './cost-tracker.d-CBLk1fiD.js';
|
|
@@ -1130,6 +1130,134 @@ interface KodaXTimeoutConfig {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
declare function providerResilienceConfigFromTimeouts(timeouts: KodaXTimeoutConfig | undefined): ProviderResilienceConfig | undefined;
|
|
1132
1132
|
|
|
1133
|
+
type RuntimeContextOptimizationProfile = 'off' | 'report_only' | 'balanced' | 'small_window' | 'aggressive';
|
|
1134
|
+
type RuntimeContextPressure = 'low' | 'medium' | 'high' | 'critical';
|
|
1135
|
+
interface RuntimeContextBudgetBreakdown {
|
|
1136
|
+
readonly systemPrompt: number;
|
|
1137
|
+
readonly toolSchemas: number;
|
|
1138
|
+
readonly skillCatalog: number;
|
|
1139
|
+
readonly mcpCatalog: number;
|
|
1140
|
+
readonly transcript: number;
|
|
1141
|
+
readonly pendingInput: number;
|
|
1142
|
+
readonly recentToolResults: number;
|
|
1143
|
+
readonly reservedResponse: number;
|
|
1144
|
+
readonly total: number;
|
|
1145
|
+
}
|
|
1146
|
+
interface RuntimeContextBudgetSnapshot {
|
|
1147
|
+
readonly sessionId?: string;
|
|
1148
|
+
readonly runId?: string;
|
|
1149
|
+
readonly turnId?: string;
|
|
1150
|
+
readonly provider?: string;
|
|
1151
|
+
readonly model?: string;
|
|
1152
|
+
readonly profile: RuntimeContextOptimizationProfile;
|
|
1153
|
+
readonly contextWindow: number;
|
|
1154
|
+
readonly smallWindow: boolean;
|
|
1155
|
+
readonly pressure: RuntimeContextPressure;
|
|
1156
|
+
readonly tokenBreakdown: RuntimeContextBudgetBreakdown;
|
|
1157
|
+
readonly usedTokens: number;
|
|
1158
|
+
readonly availableTokens: number;
|
|
1159
|
+
readonly usedRatio: number;
|
|
1160
|
+
readonly toolSchemaRatio: number;
|
|
1161
|
+
readonly recommendations: readonly RuntimeContextBudgetRecommendation[];
|
|
1162
|
+
readonly createdAt: string;
|
|
1163
|
+
}
|
|
1164
|
+
type RuntimeContextBudgetRecommendation = 'prefer_progressive_tool_exposure' | 'compact_or_summarize_history' | 'trim_recent_tool_results' | 'reserve_response_budget';
|
|
1165
|
+
interface RuntimeContextBudgetSnapshotInput {
|
|
1166
|
+
readonly sessionId?: string;
|
|
1167
|
+
readonly runId?: string;
|
|
1168
|
+
readonly turnId?: string;
|
|
1169
|
+
readonly provider?: string;
|
|
1170
|
+
readonly model?: string;
|
|
1171
|
+
readonly profile?: RuntimeContextOptimizationProfile;
|
|
1172
|
+
readonly contextWindow: number;
|
|
1173
|
+
readonly systemPrompt?: string;
|
|
1174
|
+
readonly toolDefinitions?: readonly KodaXToolDefinition[];
|
|
1175
|
+
readonly skillCatalogText?: string;
|
|
1176
|
+
readonly mcpCatalogText?: string;
|
|
1177
|
+
readonly messages?: readonly KodaXMessage[];
|
|
1178
|
+
readonly pendingInput?: string;
|
|
1179
|
+
readonly recentToolResults?: readonly string[];
|
|
1180
|
+
readonly reservedResponseTokens?: number;
|
|
1181
|
+
readonly now?: () => Date;
|
|
1182
|
+
}
|
|
1183
|
+
declare function estimateToolSchemaTokens(definition: KodaXToolDefinition, descriptionOverride?: string): number;
|
|
1184
|
+
declare function createRuntimeContextBudgetSnapshot(input: RuntimeContextBudgetSnapshotInput): RuntimeContextBudgetSnapshot;
|
|
1185
|
+
|
|
1186
|
+
type RuntimeToolExposureMode = 'resident' | 'hint' | 'bridge' | 'native_deferred' | 'hidden';
|
|
1187
|
+
type RuntimeToolExposureReason = 'profile_off' | 'protected_core' | 'already_unlocked' | 'low_pressure' | 'deferred_hint' | 'portable_bridge' | 'native_deferred' | 'bridge_unavailable';
|
|
1188
|
+
interface RuntimeToolExposureDecision {
|
|
1189
|
+
readonly toolName: string;
|
|
1190
|
+
readonly mode: RuntimeToolExposureMode;
|
|
1191
|
+
readonly recommendedMode: RuntimeToolExposureMode;
|
|
1192
|
+
readonly reason: RuntimeToolExposureReason;
|
|
1193
|
+
readonly estimatedTokensBefore: number;
|
|
1194
|
+
readonly estimatedTokensAfter: number;
|
|
1195
|
+
readonly estimatedTokensIfApplied: number;
|
|
1196
|
+
readonly modelVisible: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
interface RuntimeToolExposurePlan {
|
|
1199
|
+
readonly profile: RuntimeContextOptimizationProfile;
|
|
1200
|
+
readonly reportOnly: boolean;
|
|
1201
|
+
readonly pressure: RuntimeContextPressure;
|
|
1202
|
+
readonly bridgeAvailable: boolean;
|
|
1203
|
+
readonly nativeDeferredAvailable: boolean;
|
|
1204
|
+
readonly decisions: readonly RuntimeToolExposureDecision[];
|
|
1205
|
+
readonly modelVisibleToolNames: readonly string[];
|
|
1206
|
+
readonly estimatedToolSchemaTokensBefore: number;
|
|
1207
|
+
readonly estimatedToolSchemaTokensAfter: number;
|
|
1208
|
+
readonly estimatedToolSchemaTokensIfApplied: number;
|
|
1209
|
+
readonly estimatedTokensSaved: number;
|
|
1210
|
+
readonly estimatedTokensSavedIfApplied: number;
|
|
1211
|
+
readonly residentToolCount: number;
|
|
1212
|
+
readonly hintedToolCount: number;
|
|
1213
|
+
readonly bridgeToolCount: number;
|
|
1214
|
+
readonly nativeDeferredToolCount: number;
|
|
1215
|
+
readonly hiddenToolCount: number;
|
|
1216
|
+
}
|
|
1217
|
+
interface RuntimeToolExposurePlanInput {
|
|
1218
|
+
readonly tools: readonly KodaXToolDefinition[];
|
|
1219
|
+
readonly budget: RuntimeContextBudgetSnapshot;
|
|
1220
|
+
readonly profile?: RuntimeContextOptimizationProfile;
|
|
1221
|
+
readonly bridgeAvailable?: boolean;
|
|
1222
|
+
readonly nativeDeferredAvailable?: boolean;
|
|
1223
|
+
readonly unlockedDeferredTools?: ReadonlySet<string>;
|
|
1224
|
+
}
|
|
1225
|
+
declare const ALWAYS_RESIDENT_TOOL_NAMES: ReadonlySet<string>;
|
|
1226
|
+
declare function planToolExposure(input: RuntimeToolExposurePlanInput): RuntimeToolExposurePlan;
|
|
1227
|
+
|
|
1228
|
+
interface CompactionAntiThrashState {
|
|
1229
|
+
readonly lowSavingsStreak: number;
|
|
1230
|
+
readonly cooldownTurnsRemaining: number;
|
|
1231
|
+
}
|
|
1232
|
+
interface CompactionSavingsSample {
|
|
1233
|
+
readonly tokensBefore: number;
|
|
1234
|
+
readonly tokensAfter: number;
|
|
1235
|
+
}
|
|
1236
|
+
interface CompactionAntiThrashConfig {
|
|
1237
|
+
readonly lowSavingsRatio?: number;
|
|
1238
|
+
readonly lowSavingsStreakLimit?: number;
|
|
1239
|
+
readonly cooldownTurns?: number;
|
|
1240
|
+
}
|
|
1241
|
+
interface CompactionSavingsDecision {
|
|
1242
|
+
readonly state: CompactionAntiThrashState;
|
|
1243
|
+
readonly savingsRatio: number;
|
|
1244
|
+
readonly lowSavings: boolean;
|
|
1245
|
+
readonly enteredCooldown: boolean;
|
|
1246
|
+
}
|
|
1247
|
+
type CompactionSkipReason = 'low_savings_cooldown';
|
|
1248
|
+
interface RuntimeCompactionSkippedEvent {
|
|
1249
|
+
readonly reason: CompactionSkipReason;
|
|
1250
|
+
readonly currentTokens: number;
|
|
1251
|
+
readonly contextWindow: number;
|
|
1252
|
+
readonly triggerPercent: number;
|
|
1253
|
+
readonly cooldownTurnsRemaining: number;
|
|
1254
|
+
readonly lowSavingsStreak: number;
|
|
1255
|
+
}
|
|
1256
|
+
declare function createCompactionAntiThrashState(): CompactionAntiThrashState;
|
|
1257
|
+
declare function shouldSkipLlmCompaction(state: CompactionAntiThrashState | undefined): boolean;
|
|
1258
|
+
declare function consumeCompactionCooldown(state: CompactionAntiThrashState | undefined): CompactionAntiThrashState;
|
|
1259
|
+
declare function recordCompactionSavings(state: CompactionAntiThrashState | undefined, sample: CompactionSavingsSample, config?: CompactionAntiThrashConfig): CompactionSavingsDecision;
|
|
1260
|
+
|
|
1133
1261
|
/**
|
|
1134
1262
|
* FEATURE_093 (v0.7.24): minimal contract interfaces for the coding extension
|
|
1135
1263
|
* runtime. Extracted so `@kodax-ai/coding/src/types.ts` can reference the
|
|
@@ -1709,6 +1837,12 @@ interface KodaXEvents {
|
|
|
1709
1837
|
effort: string;
|
|
1710
1838
|
} & Partial<KodaXLiveEventMeta>) => void;
|
|
1711
1839
|
onRepoIntelligenceTrace?: (event: KodaXRepoIntelligenceTraceEvent & Partial<KodaXLiveEventMeta>) => void;
|
|
1840
|
+
/** Optional bounded context diagnostics. Emitted only when context.contextDiagnostics is true. */
|
|
1841
|
+
onContextBudgetSnapshot?: (event: RuntimeContextBudgetSnapshot & Partial<KodaXLiveEventMeta>) => void;
|
|
1842
|
+
/** Optional bounded tool-exposure diagnostics. Emitted only when context.contextDiagnostics is true. */
|
|
1843
|
+
onToolExposurePlanned?: (event: RuntimeToolExposurePlan & Partial<KodaXLiveEventMeta>) => void;
|
|
1844
|
+
/** Optional bounded compaction-pressure diagnostics. Emitted only when context.contextDiagnostics is true. */
|
|
1845
|
+
onContextCompactionSkipped?: (event: RuntimeCompactionSkippedEvent & Partial<KodaXLiveEventMeta>) => void;
|
|
1712
1846
|
/**
|
|
1713
1847
|
* Fired when the Sidecar Verifier produces an actionable message.
|
|
1714
1848
|
*
|
|
@@ -2397,6 +2531,11 @@ interface KodaXContextOptions {
|
|
|
2397
2531
|
repoIntelligenceMode?: KodaXRepoIntelligenceMode;
|
|
2398
2532
|
/** Optional repo-intelligence trace toggle for this run. */
|
|
2399
2533
|
repoIntelligenceTrace?: boolean;
|
|
2534
|
+
/**
|
|
2535
|
+
* Optional runtime-context diagnostics for SDK/daemon hosts. When false or
|
|
2536
|
+
* omitted, no extra budget/exposure calculation is performed.
|
|
2537
|
+
*/
|
|
2538
|
+
contextDiagnostics?: boolean;
|
|
2400
2539
|
disableAutoTaskReroute?: boolean;
|
|
2401
2540
|
/**
|
|
2402
2541
|
* FEATURE_087/088 (v0.7.28): when true, the prompt builder injects a
|
|
@@ -3539,5 +3678,5 @@ interface CreateBashPrefixExtractorOptions {
|
|
|
3539
3678
|
*/
|
|
3540
3679
|
declare function createBashPrefixExtractor(opts: CreateBashPrefixExtractorOptions): BashPrefixExtractor;
|
|
3541
3680
|
|
|
3542
|
-
export { BASH_POLICY_SPEC as B, LSP_SERVERS as
|
|
3543
|
-
export type {
|
|
3681
|
+
export { ALWAYS_RESIDENT_TOOL_NAMES as A, BASH_POLICY_SPEC as B, LSP_SERVERS as aI, LspService as aK, makeDisabledGoalToolsContext as bA, planToolExposure as bB, providerResilienceConfigFromTimeouts as bC, recordCompactionSavings as bD, resolveConstructedAgent as bE, shouldSkipLlmCompaction as bF, shutdownDefaultLspService as bG, withGoalBeforeNextTurn as bH, withGoalStopHook as bI, workflowStartOutcomeConsumesTurn as bJ, buildGoalRuntimeBinding as bp, consumeCompactionCooldown as bq, createBashPrefixExtractor as br, createCompactionAntiThrashState as bs, createRuntimeContextBudgetSnapshot as bt, decideWorkflowInvocation as bu, drainPendingSwaps as bv, estimateToolSchemaTokens as bw, extractCommandPrefix as bx, getDefaultLspService as by, hasPendingSwap as bz };
|
|
3682
|
+
export type { KodaXRepoIntelligenceCapability as $, CapabilityRuntimeContract as C, DiagnosticsRequest as D, ExtensionRuntimeContract as E, FailureStage as F, GoalBlockedResult as G, KodaXContextOptions as H, KodaXContextTokenSnapshot as I, KodaXEffectiveTaskConfig as J, KodaXActivityEventMeta as K, KodaXEvents as L, KodaXLiveEventMeta as M, KodaXManagedBudgetSnapshot as N, KodaXManagedProtocolPayload as O, KodaXManagedTask as P, KodaXManagedTaskRuntimeState as Q, KodaXManagedTaskStatusEvent as R, KodaXManualSource as S, KodaXManualTopic as T, KodaXManualTopicId as U, KodaXManualTopicInput as V, KodaXMemoryStrategy as W, KodaXOptions as X, KodaXOrchestrationVerdict as Y, KodaXParentReductionContract as Z, KodaXProviderPolicyHints as _, BashPrefixExtractor as a, RuntimeContextBudgetRecommendation as a$, KodaXRepoIntelligenceMode as a0, KodaXRepoIntelligenceResolvedMode as a1, KodaXRepoIntelligenceTrace as a2, KodaXRepoIntelligenceTraceEvent as a3, KodaXRepoRoutingSignals as a4, KodaXResult as a5, KodaXRoleRoundSummary as a6, KodaXRuntimeVerificationContract as a7, KodaXSelfManualConfig as a8, KodaXSessionControl as a9, KodaXTurnDeliveryKind as aA, KodaXTurnFailedEvent as aB, KodaXTurnStartedEvent as aC, KodaXVerificationScorecard as aD, KodaXVerificationScorecardCriterion as aE, KodaXWorkflowAgentDigestEvent as aF, KodaXWorkflowEventMeta as aG, KodaXWorkflowTimeoutConfig as aH, LspServerInfo as aJ, LspServiceConfig as aL, ProviderExecutionState as aM, ProviderRecoveryEvent as aN, ProviderResilienceConfig as aO, ProviderResiliencePolicy as aP, RecoveryAction as aQ, RecoveryDecision as aR, RecoveryLadderStep as aS, RecoveryResult as aT, ResilienceClassification as aU, ResilienceErrorClass as aV, ResolveKodaXManualInput as aW, ResolveKodaXManualOptions as aX, ResolveKodaXManualResult as aY, RuntimeCompactionSkippedEvent as aZ, RuntimeContextBudgetBreakdown as a_, KodaXSessionMutators as aa, KodaXSessionOptions as ab, KodaXSidecarMessageEvent as ac, KodaXSkillDynamicContextPolicy as ad, KodaXSkillInvocationContext as ae, KodaXSkillMap as af, KodaXSkillProjectionConfidence as ag, KodaXTaskCapabilityHint as ah, KodaXTaskContract as ai, KodaXTaskEvidenceArtifact as aj, KodaXTaskEvidenceBundle as ak, KodaXTaskEvidenceEntry as al, KodaXTaskRole as am, KodaXTaskRoleAssignment as an, KodaXTaskStatus as ao, KodaXTaskSurface as ap, KodaXTaskToolPolicy as aq, KodaXTaskVerificationContract as ar, KodaXTaskVerificationCriterion as as, KodaXTaskWorkItem as at, KodaXTimeoutConfig as au, KodaXToolEventMeta as av, KodaXToolExecutionContext as aw, KodaXToolVisibilityMeta as ax, KodaXToolVisibilityPolicy as ay, KodaXTurnCompletedEvent as az, BashPrefixResult as b, RuntimeContextBudgetSnapshot as b0, RuntimeContextBudgetSnapshotInput as b1, RuntimeContextOptimizationProfile as b2, RuntimeContextPressure as b3, RuntimeDefaultsSnapshot as b4, RuntimeToolExposureDecision as b5, RuntimeToolExposureMode as b6, RuntimeToolExposurePlan as b7, RuntimeToolExposurePlanInput as b8, RuntimeToolExposureReason as b9, TodoItem as ba, TodoList as bb, TodoStatus as bc, ToolSideEffect as bd, WorkflowHostPolicy as be, WorkflowInvocationAction as bf, WorkflowInvocationPolicyDecision as bg, WorkflowInvocationPolicyInput as bh, WorkflowInvocationSource as bi, WorkflowRunProgressView as bj, WorkflowStartOutcome as bk, WorkflowToolHost as bl, WorkflowToolHostInlineInput as bm, WorkflowToolHostResult as bn, WorkflowToolHostStartResult as bo, BoundExtensionRuntimeController as c, ChildSnapshotEvent as d, CompactionAntiThrashConfig as e, CompactionAntiThrashState as f, CompactionSavingsDecision as g, CompactionSavingsSample as h, CompactionSkipReason as i, CreateBashPrefixExtractorOptions as j, ExtractCommandPrefixOptions as k, GoalCompleteResult as l, GoalCreateInput as m, GoalLifecycleContext as n, GoalRuntimeBinding as o, GoalRuntimeBindingDeps as p, GoalToolsContext as q, KodaXAgentMode as r, KodaXAgentProfile as s, KodaXAgentScope as t, KodaXBudgetDisclosureZone as u, KodaXBudgetExtensionRequest as v, KodaXChildAgentResult as w, KodaXChildContextBundle as x, KodaXChildExecutionResult as y, KodaXCompactionOverride as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as KodaXMessage } from './types.d-Bp4Lm1jv.js';
|
|
2
|
-
import { Q as QueueEventListener,
|
|
3
|
-
import { h as AgentMessage, bw as SessionEntry, bu as Session, by as SessionExtension, af as KodaXSessionLineage, a4 as KodaXJsonValue, u as CompactionDetails, T as KodaXCompactMemorySeed, ab as KodaXSessionEntry, an as KodaXSessionTreeNode, ae as KodaXSessionLabelEntry, ad as KodaXSessionGoalEntry, a8 as KodaXSessionClientNoticeEntry, aj as KodaXSessionRewindMarkerEntry, ai as KodaXSessionNavigationOptions, a6 as KodaXSessionArtifactLedgerEntry, H as FileOperations, cb as WorkflowMeta, cc as WorkflowModelHint, cd as WorkflowModule
|
|
2
|
+
import { Q as QueueEventListener, c as QueuedMessage, E as EnqueueInput, D as DequeueFilter } from './types.d-BMLxKV69.js';
|
|
3
|
+
import { h as AgentMessage, bw as SessionEntry, bu as Session, by as SessionExtension, af as KodaXSessionLineage, a4 as KodaXJsonValue, u as CompactionDetails, T as KodaXCompactMemorySeed, ab as KodaXSessionEntry, an as KodaXSessionTreeNode, ae as KodaXSessionLabelEntry, ad as KodaXSessionGoalEntry, a8 as KodaXSessionClientNoticeEntry, aj as KodaXSessionRewindMarkerEntry, ai as KodaXSessionNavigationOptions, a6 as KodaXSessionArtifactLedgerEntry, H as FileOperations, cb as WorkflowMeta, cc as WorkflowModelHint, cd as WorkflowModule } from './process.d-CY2g03Mb.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @kodax-ai/agent Constants
|
|
@@ -33,7 +33,7 @@ declare const PROMISE_PATTERN: RegExp;
|
|
|
33
33
|
* - 内容文本
|
|
34
34
|
* - 工具调用和结果
|
|
35
35
|
*/
|
|
36
|
-
declare function estimateTokens(messages: KodaXMessage[]): number;
|
|
36
|
+
declare function estimateTokens(messages: readonly KodaXMessage[]): number;
|
|
37
37
|
/**
|
|
38
38
|
* 计算单个文本的 token 数量(便捷函数)
|
|
39
39
|
*/
|
|
@@ -831,92 +831,5 @@ declare function buildWorkflowCapsuleIntent(manifest: {
|
|
|
831
831
|
readonly originalRequest?: string;
|
|
832
832
|
}): WorkflowCapsuleIntent;
|
|
833
833
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
*
|
|
837
|
-
* Domain-neutral run registry + lifecycle (pause / resume / stop), process-event
|
|
838
|
-
* tracking, and terminal settle — lifted out of `@kodax-ai/coding` so any agent
|
|
839
|
-
* (including non-coding SDK hosts) can host and manage workflow runs.
|
|
840
|
-
*
|
|
841
|
-
* It never knows HOW a run executes: the caller injects a `runFn` thunk that
|
|
842
|
-
* receives lifecycle hooks (`onEvent` / `signal` / `beforeSpawn`) and returns a
|
|
843
|
-
* caller-shaped outcome, plus a `classify` mapping that outcome to a neutral
|
|
844
|
-
* terminal status and an `onError` that synthesizes a failure outcome. The
|
|
845
|
-
* coding layer wires `runFn` to its `runWorkflowModule` / `runWorkflowFromOptions`
|
|
846
|
-
* (backend + run-graph + worktrees); SDK hosts wire their own. Dependency arrows
|
|
847
|
-
* therefore point only coding → agent — no cycle.
|
|
848
|
-
*/
|
|
849
|
-
|
|
850
|
-
type ManagedWorkflowStatus = 'running' | 'paused' | 'completed' | 'failed' | 'denied' | 'stopped';
|
|
851
|
-
/** Provenance/display metadata for a run's process tracker. */
|
|
852
|
-
type WorkflowProcessMetadata = Pick<WorkflowProcessTrackerOptions, 'displayName' | 'goal' | 'source' | 'savedWorkflowName' | 'sourceRunId' | 'sourceWorkflowName' | 'revisionOf' | 'resumedFromRunId' | 'hostMetadata'>;
|
|
853
|
-
interface ManagedWorkflowSnapshot {
|
|
854
|
-
readonly runId: string;
|
|
855
|
-
readonly workflow: string;
|
|
856
|
-
readonly status: ManagedWorkflowStatus;
|
|
857
|
-
readonly totalSpawned: number;
|
|
858
|
-
readonly eventCount: number;
|
|
859
|
-
readonly startedAt: number;
|
|
860
|
-
readonly endedAt?: number;
|
|
861
|
-
readonly error?: string;
|
|
862
|
-
readonly resultText?: string;
|
|
863
|
-
}
|
|
864
|
-
interface ManagedWorkflowRun<TOutcome = unknown> {
|
|
865
|
-
readonly runId: string;
|
|
866
|
-
readonly done: Promise<TOutcome>;
|
|
867
|
-
getSnapshot(): ManagedWorkflowSnapshot | undefined;
|
|
868
|
-
getProcessSnapshot(): WorkflowProcessSnapshot | undefined;
|
|
869
|
-
}
|
|
870
|
-
/** Lifecycle hooks the manager injects into the caller's `runFn`. */
|
|
871
|
-
interface ManagedRunHooks {
|
|
872
|
-
/** Forward every workflow event so the manager can track spawn/progress. */
|
|
873
|
-
readonly onEvent: (event: WorkflowEvent) => void;
|
|
874
|
-
/** Abort signal owned by the manager (fires on stop()). */
|
|
875
|
-
readonly signal: AbortSignal;
|
|
876
|
-
/** Await before launching each agent so pause() can gate new spawns. */
|
|
877
|
-
readonly beforeSpawn: () => Promise<void>;
|
|
878
|
-
}
|
|
879
|
-
/** Neutral terminal classification of a caller-shaped outcome. */
|
|
880
|
-
interface ManagedRunClassification {
|
|
881
|
-
readonly status: 'completed' | 'failed' | 'denied';
|
|
882
|
-
readonly error?: Error;
|
|
883
|
-
readonly resultText?: string;
|
|
884
|
-
}
|
|
885
|
-
interface StartManagedRunInput<TOutcome> {
|
|
886
|
-
readonly runId: string;
|
|
887
|
-
/** Display name (usually the workflow's `meta.name`). */
|
|
888
|
-
readonly workflow: string;
|
|
889
|
-
readonly phases?: readonly string[];
|
|
890
|
-
readonly maxAgents?: number;
|
|
891
|
-
readonly plannedAgents?: number;
|
|
892
|
-
readonly tokenBudget?: number;
|
|
893
|
-
readonly processMetadata?: WorkflowProcessMetadata;
|
|
894
|
-
readonly signal?: AbortSignal;
|
|
895
|
-
/** Executes the run with the manager's lifecycle hooks injected. */
|
|
896
|
-
readonly runFn: (hooks: ManagedRunHooks) => Promise<TOutcome>;
|
|
897
|
-
/** Map the caller's terminal outcome to a neutral status for the snapshot. */
|
|
898
|
-
readonly classify: (outcome: TOutcome) => ManagedRunClassification;
|
|
899
|
-
/** Synthesize a caller-shaped outcome when `runFn` throws. */
|
|
900
|
-
readonly onError: (error: unknown) => TOutcome;
|
|
901
|
-
}
|
|
902
|
-
interface WorkflowRunManager {
|
|
903
|
-
start<TOutcome>(input: StartManagedRunInput<TOutcome>): ManagedWorkflowRun<TOutcome>;
|
|
904
|
-
list(): readonly ManagedWorkflowSnapshot[];
|
|
905
|
-
get(runId: string): ManagedWorkflowSnapshot | undefined;
|
|
906
|
-
subscribeWorkflowProcess(listener: (event: WorkflowProcessEvent) => void): () => void;
|
|
907
|
-
getWorkflowProcessSnapshot(runId: string): WorkflowProcessSnapshot | undefined;
|
|
908
|
-
listWorkflowProcessSnapshots(options?: {
|
|
909
|
-
readonly activeOnly?: boolean;
|
|
910
|
-
readonly limit?: number;
|
|
911
|
-
}): readonly WorkflowProcessSnapshot[];
|
|
912
|
-
pause(runId: string): boolean;
|
|
913
|
-
resume(runId: string): boolean;
|
|
914
|
-
stop(runId: string, reason?: string): boolean;
|
|
915
|
-
}
|
|
916
|
-
declare function createWorkflowRunManager(deps?: {
|
|
917
|
-
readonly now?: () => number;
|
|
918
|
-
}): WorkflowRunManager;
|
|
919
|
-
declare function getDefaultWorkflowRunManager(): WorkflowRunManager;
|
|
920
|
-
|
|
921
|
-
export { applySessionCompaction as $, WORKFLOW_CAPSULE_FORMAT as A, WORKFLOW_CAPSULE_VERSION as B, DefaultSummaryCompaction as D, WORKFLOW_PATTERN_IDS as E, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, PROMISE_PATTERN as P, WORKFLOW_CAPSULE_API_VERSION as W, appendSessionLineageLabel as Y, applyLineageTruncation as Z, _resetMessageQueueForTests as _, archiveOldIslands as a0, assertRestrictedWorkflowQuality as a1, buildSessionTree as a2, buildWorkflowCapsuleIntent as a3, cleanupIncompleteToolCalls as a4, countActiveLineageMessages as a5, countTokens as a6, createSessionLineage as a7, createWorkflowCapsule as a8, createWorkflowModuleFromCapsule as a9, createWorkflowRunManager as aa, estimateTokens as ab, extractArtifactLedger as ac, extractFileOps as ad, extractTitleFromMessages as ae, findPreviousUserEntryId as af, forkSessionLineage as ag, generateSessionId as ah, getAgentConfigHome as ai, getAgentConfigPath as aj, getAppDataDir as ak, getDefaultWorkflowRunManager as al, getMessageQueue as am, getSessionLineagePath as an, getSessionMessagesFromLineage as ao, lintRestrictedWorkflowSource as ap, mergeArtifactLedger as aq, mergeFileOps as ar, resolveSessionLineageTarget as as, rewindSessionLineage as at, setAgentConfigHome as au, setSessionLineageActiveEntry as av, validateAndFixToolHistory as aw, validateWorkflowCapsule as ax, validateWorkflowScriptManifest as ay, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, MessageQueue as y };
|
|
922
|
-
export type { CompactionContext as C, WorkflowCapsule as F, WorkflowCapsuleEnvironmentRequirement as G, WorkflowCapsuleInputs as H, WorkflowCapsuleIntent as I, WorkflowCapsuleProvenance as J, ManagedRunClassification as M, WorkflowCapsuleRequirements as N, WorkflowPatternId as O, WorkflowProcessMetadata as Q, WorkflowQualityLintFinding as R, StartManagedRunInput as S, WorkflowQualityLintOptions as T, WorkflowQualityLintSeverity as U, WorkflowRunManager as V, WorkflowScriptManifest as X, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, ManagedRunHooks as u, ManagedWorkflowRun as v, ManagedWorkflowSnapshot as w, ManagedWorkflowStatus as x, PolicyCompactionResult as z };
|
|
834
|
+
export { createSessionLineage as $, DefaultSummaryCompaction as D, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, MessageQueue as M, appendSessionLineageLabel as O, PROMISE_PATTERN as P, applyLineageTruncation as Q, applySessionCompaction as R, archiveOldIslands as S, assertRestrictedWorkflowQuality as T, buildSessionTree as U, buildWorkflowCapsuleIntent as V, WORKFLOW_CAPSULE_API_VERSION as W, cleanupIncompleteToolCalls as X, countActiveLineageMessages as Y, countTokens as Z, _resetMessageQueueForTests as _, createWorkflowCapsule as a0, createWorkflowModuleFromCapsule as a1, estimateTokens as a2, extractArtifactLedger as a3, extractFileOps as a4, extractTitleFromMessages as a5, findPreviousUserEntryId as a6, forkSessionLineage as a7, generateSessionId as a8, getAgentConfigHome as a9, getAgentConfigPath as aa, getAppDataDir as ab, getMessageQueue as ac, getSessionLineagePath as ad, getSessionMessagesFromLineage as ae, lintRestrictedWorkflowSource as af, mergeArtifactLedger as ag, mergeFileOps as ah, resolveSessionLineageTarget as ai, rewindSessionLineage as aj, setAgentConfigHome as ak, setSessionLineageActiveEntry as al, validateAndFixToolHistory as am, validateWorkflowCapsule as an, validateWorkflowScriptManifest as ao, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, WORKFLOW_CAPSULE_FORMAT as v, WORKFLOW_CAPSULE_VERSION as w, WORKFLOW_PATTERN_IDS as x };
|
|
835
|
+
export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowQualityLintFinding as H, WorkflowQualityLintOptions as I, WorkflowQualityLintSeverity as J, WorkflowScriptManifest as N, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, PolicyCompactionResult as u, WorkflowCapsule as y, WorkflowCapsuleEnvironmentRequirement as z };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { h as SessionStorage$1, f as PermissionMode } from './public-api.d-jtREVfEq.js';
|
|
2
|
+
import { X as KodaXOptions, a5 as KodaXResult } from './bash-prefix-extractor.d-BjkITAva.js';
|
|
3
|
+
import { m as RuntimeSurfaceStatus, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, g as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest } from './utils.d-C1rpoeDh.js';
|
|
4
|
+
import { am as KodaXSessionStorage, aa as KodaXSessionData } from './process.d-CY2g03Mb.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* InkREPL - Ink-based REPL Adapter
|
|
8
|
+
*
|
|
9
|
+
* Bridges Ink UI components with existing KodaX command processing logic.
|
|
10
|
+
* Replaces the Node.js readline-based input with Ink's React components.
|
|
11
|
+
*
|
|
12
|
+
* Architecture based on Gemini CLI:
|
|
13
|
+
* - Uses UIStateContext for global state
|
|
14
|
+
* - Uses KeypressContext for priority-based keyboard handling
|
|
15
|
+
* - Uses StreamingContext for streaming response management
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface InkRuntimeRunnerInput {
|
|
19
|
+
readonly options: KodaXOptions;
|
|
20
|
+
readonly prompt: string;
|
|
21
|
+
readonly sessionId: string;
|
|
22
|
+
readonly permissionMode: PermissionMode;
|
|
23
|
+
}
|
|
24
|
+
type InkRuntimeRunner = (input: InkRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
25
|
+
type InkRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
26
|
+
interface InkREPLOptions extends KodaXOptions {
|
|
27
|
+
storage?: SessionStorage$1;
|
|
28
|
+
hardExitOnClose?: boolean;
|
|
29
|
+
runtimeRunner?: InkRuntimeRunner;
|
|
30
|
+
getRuntimeStatus?: InkRuntimeStatusProvider;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Run Ink-based interactive mode
|
|
34
|
+
*/
|
|
35
|
+
declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
|
|
36
|
+
|
|
37
|
+
interface SessionStorage extends KodaXSessionStorage {
|
|
38
|
+
list(gitRoot?: string): Promise<Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
msgCount: number;
|
|
42
|
+
tag?: string;
|
|
43
|
+
runtimeInfo?: KodaXSessionData['runtimeInfo'];
|
|
44
|
+
}>>;
|
|
45
|
+
}
|
|
46
|
+
interface ReplRuntimeRunnerInput {
|
|
47
|
+
readonly options: KodaXOptions;
|
|
48
|
+
readonly prompt: string;
|
|
49
|
+
readonly sessionId: string;
|
|
50
|
+
readonly permissionMode: PermissionMode;
|
|
51
|
+
}
|
|
52
|
+
type ReplRuntimeRunner = (input: ReplRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
53
|
+
type ReplRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
54
|
+
interface RepLOptions extends KodaXOptions {
|
|
55
|
+
storage?: SessionStorage;
|
|
56
|
+
runtimeRunner?: ReplRuntimeRunner;
|
|
57
|
+
getRuntimeStatus?: ReplRuntimeStatusProvider;
|
|
58
|
+
}
|
|
59
|
+
declare function runInteractiveMode(options: RepLOptions): Promise<void>;
|
|
60
|
+
declare function processSpecialSyntax(input: string): Promise<string>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Command Registry - Dynamic command registration system
|
|
64
|
+
* 命令注册表 - 动态命令注册系统
|
|
65
|
+
*
|
|
66
|
+
* Provides centralized command management with source tracking,
|
|
67
|
+
* supporting dynamic registration, lookup, and listing of commands.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* CommandRegistry - Centralized command management
|
|
72
|
+
* 命令注册表 - 集中式命令管理
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const registry = new CommandRegistry();
|
|
77
|
+
*
|
|
78
|
+
* // Register a command
|
|
79
|
+
* registry.register({
|
|
80
|
+
* name: 'copy',
|
|
81
|
+
* description: 'Copy last message to clipboard',
|
|
82
|
+
* source: 'builtin',
|
|
83
|
+
* handler: async (args, context, callbacks, config) => {
|
|
84
|
+
* // Implementation
|
|
85
|
+
* }
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // Get a command
|
|
89
|
+
* const cmd = registry.get('copy');
|
|
90
|
+
*
|
|
91
|
+
* // List all commands
|
|
92
|
+
* const allCommands = registry.getAll();
|
|
93
|
+
*
|
|
94
|
+
* // List builtin commands only
|
|
95
|
+
* const builtinCommands = registry.getBySource('builtin');
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare class CommandRegistry {
|
|
99
|
+
/**
|
|
100
|
+
* Internal command storage
|
|
101
|
+
* 内部命令存储
|
|
102
|
+
*/
|
|
103
|
+
private commands;
|
|
104
|
+
/**
|
|
105
|
+
* Alias to command name mapping
|
|
106
|
+
* 别名到命令名称的映射
|
|
107
|
+
*/
|
|
108
|
+
private aliases;
|
|
109
|
+
/**
|
|
110
|
+
* Register a command
|
|
111
|
+
* 注册命令
|
|
112
|
+
*
|
|
113
|
+
* @param def - Command definition
|
|
114
|
+
* @throws Error if command with same name already exists
|
|
115
|
+
*/
|
|
116
|
+
register(def: CommandDefinition): void;
|
|
117
|
+
/**
|
|
118
|
+
* Unregister a command
|
|
119
|
+
* 注销命令
|
|
120
|
+
*
|
|
121
|
+
* @param name - Command name or alias
|
|
122
|
+
* @returns true if command was unregistered, false if not found
|
|
123
|
+
*/
|
|
124
|
+
unregister(name: string): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Get a command by name or alias
|
|
127
|
+
* 通过名称或别名获取命令
|
|
128
|
+
*
|
|
129
|
+
* @param name - Command name or alias
|
|
130
|
+
* @returns Command definition or undefined if not found
|
|
131
|
+
*/
|
|
132
|
+
get(name: string): CommandDefinition | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Check if a command exists
|
|
135
|
+
* 检查命令是否存在
|
|
136
|
+
*
|
|
137
|
+
* @param name - Command name or alias
|
|
138
|
+
* @returns true if command exists, false otherwise
|
|
139
|
+
*/
|
|
140
|
+
has(name: string): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Get all commands with optional source filter
|
|
143
|
+
* 获取所有命令,可选按来源过滤
|
|
144
|
+
*
|
|
145
|
+
* @param source - Optional source filter
|
|
146
|
+
* @returns Array of command information
|
|
147
|
+
*/
|
|
148
|
+
getAll(source?: CommandSource): CommandInfo[];
|
|
149
|
+
/**
|
|
150
|
+
* Get commands by source
|
|
151
|
+
* 按来源获取命令
|
|
152
|
+
*
|
|
153
|
+
* @param source - Command source
|
|
154
|
+
* @returns Array of command information
|
|
155
|
+
*/
|
|
156
|
+
getBySource(source: CommandSource): CommandInfo[];
|
|
157
|
+
/**
|
|
158
|
+
* Get all command names
|
|
159
|
+
* 获取所有命令名称
|
|
160
|
+
*
|
|
161
|
+
* @returns Array of command names
|
|
162
|
+
*/
|
|
163
|
+
getNames(): string[];
|
|
164
|
+
/**
|
|
165
|
+
* Clear all commands
|
|
166
|
+
* 清空所有命令
|
|
167
|
+
*/
|
|
168
|
+
clear(): void;
|
|
169
|
+
/**
|
|
170
|
+
* Get command count
|
|
171
|
+
* 获取命令数量
|
|
172
|
+
*
|
|
173
|
+
* @returns Number of registered commands
|
|
174
|
+
*/
|
|
175
|
+
get size(): number;
|
|
176
|
+
/**
|
|
177
|
+
* Get alias count
|
|
178
|
+
* 获取别名数量
|
|
179
|
+
*
|
|
180
|
+
* @returns Number of registered aliases
|
|
181
|
+
*/
|
|
182
|
+
get aliasCount(): number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* KodaX Interactive Command System
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
type Command = Command$1;
|
|
190
|
+
declare const BUILTIN_COMMANDS: Command[];
|
|
191
|
+
declare function getCommandRegistry(projectRoot?: string): CommandRegistry;
|
|
192
|
+
declare function parseCommand(input: string): {
|
|
193
|
+
command: string;
|
|
194
|
+
args: string[];
|
|
195
|
+
skillInvocation?: {
|
|
196
|
+
name: string;
|
|
197
|
+
};
|
|
198
|
+
} | null;
|
|
199
|
+
type CommandResult = boolean | {
|
|
200
|
+
skillContent?: string;
|
|
201
|
+
invocation?: CommandInvocationRequest;
|
|
202
|
+
workflow?: CommandWorkflowInvocationRequest;
|
|
203
|
+
};
|
|
204
|
+
declare function executeCommand(parsed: {
|
|
205
|
+
command: string;
|
|
206
|
+
args: string[];
|
|
207
|
+
skillInvocation?: {
|
|
208
|
+
name: string;
|
|
209
|
+
};
|
|
210
|
+
}, context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig): Promise<CommandResult>;
|
|
211
|
+
|
|
212
|
+
export { BUILTIN_COMMANDS as B, executeCommand as g, getCommandRegistry as h, processSpecialSyntax as i, runInteractiveMode as j, parseCommand as p, runInkInteractiveMode as r };
|
|
213
|
+
export type { Command as C, InkREPLOptions as I, RepLOptions as R, InkRuntimeRunner as a, InkRuntimeRunnerInput as b, InkRuntimeStatusProvider as c, ReplRuntimeRunner as d, ReplRuntimeRunnerInput as e, ReplRuntimeStatusProvider as f };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { J as Guardrail, bq as RunnerToolCall, f as Agent, h as AgentMessage, bt as RunnerToolResult, bC as Span
|
|
2
|
-
import { R as KodaXTaskResultMetadata } from './types.d-Bp4Lm1jv.js';
|
|
1
|
+
import { J as Guardrail, bq as RunnerToolCall, f as Agent, h as AgentMessage, bt as RunnerToolResult, bC as Span } from './process.d-CY2g03Mb.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Guardrail Runtime — FEATURE_085 (v0.7.26).
|
|
@@ -152,129 +151,5 @@ declare function runToolBeforeGuardrails(call: RunnerToolCall, guardrails: reado
|
|
|
152
151
|
*/
|
|
153
152
|
declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerToolResult, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<RunnerToolResult>;
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
159
|
-
*
|
|
160
|
-
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
161
|
-
* specific). Downstream consumers:
|
|
162
|
-
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
163
|
-
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
164
|
-
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
165
|
-
*
|
|
166
|
-
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
167
|
-
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
type MessagePriority = 'user' | 'background';
|
|
171
|
-
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
172
|
-
type QueuedInputArtifact = KodaXInputArtifact;
|
|
173
|
-
interface QueuedMessage {
|
|
174
|
-
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
175
|
-
readonly id: string;
|
|
176
|
-
readonly priority: MessagePriority;
|
|
177
|
-
/**
|
|
178
|
-
* Routing key:
|
|
179
|
-
* undefined = main thread / coordinator agent
|
|
180
|
-
* 'agent-id-XYZ' = subagent / specific consumer
|
|
181
|
-
*
|
|
182
|
-
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
183
|
-
* undefined-agentId messages, not "any agent".
|
|
184
|
-
*/
|
|
185
|
-
readonly agentId?: string;
|
|
186
|
-
readonly mode: MessageMode;
|
|
187
|
-
readonly content: string;
|
|
188
|
-
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
189
|
-
readonly taskResult?: KodaXTaskResultMetadata;
|
|
190
|
-
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
191
|
-
readonly enqueuedAt: number;
|
|
192
|
-
}
|
|
193
|
-
interface DequeueFilter {
|
|
194
|
-
/**
|
|
195
|
-
* Only return messages with this agentId.
|
|
196
|
-
* undefined matches messages with no agentId (main-thread messages only).
|
|
197
|
-
*/
|
|
198
|
-
readonly agentId?: string;
|
|
199
|
-
/**
|
|
200
|
-
* Highest priority level included in the drain.
|
|
201
|
-
* 'user' → only user priority drained, background stays queued
|
|
202
|
-
* 'background' → both user + background drained (Sleep-gated case)
|
|
203
|
-
*/
|
|
204
|
-
readonly maxPriority: MessagePriority;
|
|
205
|
-
/**
|
|
206
|
-
* Optional cap on number of messages drained in this call.
|
|
207
|
-
* Defaults to unlimited (drains all matching).
|
|
208
|
-
*/
|
|
209
|
-
readonly limit?: number;
|
|
210
|
-
/**
|
|
211
|
-
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
212
|
-
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
213
|
-
* input vs `mode:'task-notification'` for child completion banners)
|
|
214
|
-
* without separate queues. When omitted, all modes match.
|
|
215
|
-
*/
|
|
216
|
-
readonly mode?: MessageMode;
|
|
217
|
-
/**
|
|
218
|
-
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
219
|
-
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
220
|
-
* other filters still apply (agentId / priority / mode mismatches still
|
|
221
|
-
* skip the message), so callers can't accidentally remove a message
|
|
222
|
-
* outside their scope.
|
|
223
|
-
*/
|
|
224
|
-
readonly id?: string;
|
|
225
|
-
/**
|
|
226
|
-
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
227
|
-
* the structured filters. Lets SDK consumers express conditions the
|
|
228
|
-
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
229
|
-
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
230
|
-
* code should prefer the typed fields for readability; this is the
|
|
231
|
-
* "data-driven main path + predicate escape" pattern.
|
|
232
|
-
*
|
|
233
|
-
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
234
|
-
* inspects `message.content` never runs on messages outside the
|
|
235
|
-
* caller's `agentId` / `mode` / `id` scope.
|
|
236
|
-
*/
|
|
237
|
-
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
241
|
-
*
|
|
242
|
-
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
243
|
-
* affected messages so SDK observability consumers (logging, tracing,
|
|
244
|
-
* metrics) can react per-event without re-diffing snapshots.
|
|
245
|
-
*
|
|
246
|
-
* Event granularity rules:
|
|
247
|
-
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
248
|
-
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
249
|
-
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
250
|
-
* (filter matched nothing) fire no event — quiet by design so the
|
|
251
|
-
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
252
|
-
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
253
|
-
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
254
|
-
*
|
|
255
|
-
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
256
|
-
* only needs the change signal); SDK / tracer consumers read the event.
|
|
257
|
-
*/
|
|
258
|
-
type QueueEvent = {
|
|
259
|
-
readonly kind: 'enqueued';
|
|
260
|
-
readonly message: QueuedMessage;
|
|
261
|
-
} | {
|
|
262
|
-
readonly kind: 'dequeued';
|
|
263
|
-
readonly messages: readonly QueuedMessage[];
|
|
264
|
-
} | {
|
|
265
|
-
readonly kind: 'cleared';
|
|
266
|
-
readonly messages: readonly QueuedMessage[];
|
|
267
|
-
};
|
|
268
|
-
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
269
|
-
type QueueEventListener = (event: QueueEvent) => void;
|
|
270
|
-
interface EnqueueInput {
|
|
271
|
-
readonly priority: MessagePriority;
|
|
272
|
-
readonly mode: MessageMode;
|
|
273
|
-
readonly content: string;
|
|
274
|
-
readonly agentId?: string;
|
|
275
|
-
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
276
|
-
readonly taskResult?: KodaXTaskResultMetadata;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as h, runOutputGuardrails as i, runToolAfterGuardrails as j, runToolBeforeGuardrails as k, runInputGuardrails as r };
|
|
280
|
-
export type { DequeueFilter as D, EnqueueInput as E, InputGuardrail as I, MessageMode as M, OutputGuardrail as O, QueueEventListener as Q, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, MessagePriority as d, QueuedInputArtifact as e, QueuedMessage as f, ToolGuardrail as g };
|
|
154
|
+
export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as e, runOutputGuardrails as f, runToolAfterGuardrails as g, runToolBeforeGuardrails as h, runInputGuardrails as r };
|
|
155
|
+
export type { InputGuardrail as I, OutputGuardrail as O, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, ToolGuardrail as d };
|