@kodax-ai/kodax 0.7.96 → 0.7.97-alpha.2
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 +86 -0
- package/README.md +85 -62
- package/README_CN.md +57 -67
- package/config-templates/config.example.jsonc +0 -14
- package/dist/chunks/{agent-7N427EVB.js → agent-J7SHFM5N.js} +1 -1
- package/dist/chunks/argument-completer-ZJQOWTIS.js +2 -0
- package/dist/chunks/{chunk-ABZDFK2X.js → chunk-2GV6MQ4T.js} +14 -14
- package/dist/chunks/{chunk-6QI3GOYG.js → chunk-3PS3YEDS.js} +1 -1
- package/dist/chunks/chunk-4VJMQDTH.js +417 -0
- package/dist/chunks/{chunk-NI7PBPUR.js → chunk-5DSUVP46.js} +1 -1
- package/dist/chunks/chunk-5P7RTSZT.js +21 -0
- package/dist/chunks/{chunk-XXNR6S4Q.js → chunk-6ZAQKFIM.js} +1 -1
- package/dist/chunks/chunk-7V2QBZ73.js +137 -0
- package/dist/chunks/{chunk-C7U542KM.js → chunk-F7DHZH6T.js} +1 -1
- package/dist/chunks/{chunk-7IMWOR34.js → chunk-HSRYDDPF.js} +1 -1
- package/dist/chunks/chunk-K3DQGSQU.js +372 -0
- package/dist/chunks/chunk-NO23K2CB.js +2 -0
- package/dist/chunks/{chunk-NKT3B3DR.js → chunk-OT5WHAX4.js} +1 -1
- package/dist/chunks/{chunk-YEAUDI6U.js → chunk-QGWHJIO4.js} +1 -1
- package/dist/chunks/chunk-QOFFAY5C.js +261 -0
- package/dist/chunks/{chunk-4PFZ7BEE.js → chunk-QVDTORL3.js} +11 -11
- package/dist/chunks/chunk-QZ4B4AWG.js +473 -0
- package/dist/chunks/chunk-RXDS6CNA.js +355 -0
- package/dist/chunks/{chunk-WV3DJVW4.js → chunk-VDGPJQL7.js} +135 -135
- package/dist/chunks/chunk-VEZ4WHPN.js +641 -0
- package/dist/chunks/chunk-ZPPAT25E.js +5 -0
- package/dist/chunks/chunk-ZQYWDI4O.js +1 -0
- package/dist/chunks/chunk-ZS2GUADU.js +498 -0
- package/dist/chunks/{chunk-GN2IY5YE.js → chunk-ZTYZYXGV.js} +1 -1
- package/dist/chunks/{chunk-EM4XJBTK.js → chunk-ZZQ4GDVU.js} +1 -1
- package/dist/chunks/{client-6WZZTTSV.js → client-MXOJ5XUN.js} +1 -1
- package/dist/chunks/{compaction-config-ZMEJU4U7.js → compaction-config-5VZSGKBQ.js} +1 -1
- package/dist/chunks/{construction-bootstrap-RX4DMHI7.js → construction-bootstrap-U2ZU2WAT.js} +1 -1
- package/dist/chunks/dist-CSLNWLOE.js +2 -0
- package/dist/chunks/dist-XXMJMJDU.js +2 -0
- package/dist/chunks/host-RUXYZFYN.js +2 -0
- package/dist/chunks/readline-helpers-JCVULR4C.js +2 -0
- package/dist/chunks/run-manager-DRIM5VNE.js +2 -0
- package/dist/chunks/utils-MQEBGKIX.js +2 -0
- package/dist/index.d.ts +63 -30
- package/dist/index.js +10 -6
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1745 -1734
- package/dist/kodax_resume.js +32 -35
- package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
- package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/sandbox-network-broker.js +77 -77
- package/dist/sdk-a2a.d.ts +33 -18
- package/dist/sdk-a2a.js +8 -9
- package/dist/sdk-agent.d.ts +33 -26
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-client.d.ts +40 -0
- package/dist/sdk-client.js +2 -0
- package/dist/sdk-coding.d.ts +87 -499
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +3 -4
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +11 -9
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +3 -3
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +3 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +317 -70
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +580 -452
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +13 -9
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +57 -57
- package/dist/types-chunks/{base.d-Bt9lhwSV.d.ts → base.d-ZBOdjDUT.d.ts} +2 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-DWFIMg0v.d.ts → bash-prefix-extractor.d-DvswAXKS.d.ts} +136 -66
- package/dist/types-chunks/{capability-learning.d-gRtO03f6.d.ts → capability-learning.d-B4pxKwP4.d.ts} +1 -1
- package/dist/types-chunks/{capability.d-Ch5Vos33.d.ts → capability.d-DOF3r0fJ.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-Dj1n6s0Y.d.ts → capsule.d-B4atvlxE.d.ts} +7 -19
- package/dist/types-chunks/client-contract-A1jdk6xz.d.ts +1993 -0
- package/dist/types-chunks/{controller.d-C0IM1Tud.d.ts → controller.d-BkUJ_3sl.d.ts} +1 -1
- package/dist/types-chunks/{controller.d-J2t1q8Ly.d.ts → controller.d-yyKajPTi.d.ts} +140 -1380
- package/dist/types-chunks/{cost-tracker.d-BWI4lFWn.d.ts → cost-tracker.d-BeaenODW.d.ts} +2 -47
- package/dist/types-chunks/{history-retrieval.d-CPN5PMBV.d.ts → history-retrieval.d-JdFfkeF3.d.ts} +2 -2
- package/dist/types-chunks/{manager.d-rtmywU9M.d.ts → manager.d-C_20XqCV.d.ts} +8 -1
- package/dist/types-chunks/manifest.d-Bw2i-zQi.d.ts +18 -0
- package/dist/types-chunks/provider-credential-context.d-BH2OaB1b.d.ts +47 -0
- package/dist/types-chunks/provider-request-observation.d-jL8T6wVO.d.ts +34 -0
- package/dist/types-chunks/{public-api.d-amBop8Nk.d.ts → public-api.d-Cq8ILMte.d.ts} +52 -13
- package/dist/types-chunks/{resolver.d-BrwLoWNr.d.ts → resolver.d-DLY01RHx.d.ts} +4 -2
- package/dist/types-chunks/{types.d-CSv0_cZC.d.ts → review-inbox.d-BeaLRNHx.d.ts} +251 -3
- package/dist/types-chunks/{shell-command-sets.d-oejwpP_7.d.ts → review-packet.d-D4bbTbq3.d.ts} +46 -3
- package/dist/types-chunks/{exec-policy.d-BPESl90L.d.ts → run-manager.d-C7Q71rin.d.ts} +385 -62
- package/dist/types-chunks/runtime-client-info-CxnlZlW5.d.ts +175 -0
- package/dist/types-chunks/{sdk-session-B6XjHNU1.d.ts → sdk-session-BDFjCpDn.d.ts} +12 -4
- package/dist/types-chunks/{side-query.d-DHWG1JZg.d.ts → side-query.d-DTrhVd_r.d.ts} +4 -3
- package/dist/types-chunks/trusted-repl-entry-vbUM8R6P.d.ts +445 -0
- package/dist/types-chunks/{types.d-CtO8mR1s.d.ts → types.d-BJTN-RZr.d.ts} +5 -5
- package/dist/types-chunks/{types.d-BrQMB-hy.d.ts → types.d-BjOq57-z.d.ts} +6 -0
- package/dist/types-chunks/types.d-o7t9dds4.d.ts +1484 -0
- package/dist/types-chunks/{utils.d-DcznBeQ3.d.ts → utils.d-CWiMhFfu.d.ts} +202 -36
- package/docs/CLIENT_CONTRACT.md +441 -0
- package/docs/SDK_MIGRATION.md +123 -0
- package/docs/SPACE_SDK_SEAMS.md +139 -0
- package/package.json +10 -5
- package/public_docs/README.md +12 -133
- package/public_docs/configuration/config-files.md +8 -14
- package/public_docs/sdk/embedder-guide.md +494 -420
- package/dist/chunks/argument-completer-FAIHW7HZ.js +0 -2
- package/dist/chunks/chunk-66XN5AFU.js +0 -417
- package/dist/chunks/chunk-7O2AIFNE.js +0 -373
- package/dist/chunks/chunk-DSXUXUZG.js +0 -5
- package/dist/chunks/chunk-GYO73UYQ.js +0 -275
- package/dist/chunks/chunk-HPCS3LZ5.js +0 -324
- package/dist/chunks/chunk-HZYRLIOC.js +0 -137
- package/dist/chunks/chunk-SC2ELSUS.js +0 -675
- package/dist/chunks/chunk-TEUD5VPJ.js +0 -471
- package/dist/chunks/chunk-TYZ2ZAYL.js +0 -487
- package/dist/chunks/dist-3UCCMCYR.js +0 -2
- package/dist/chunks/dist-F5IWZSAY.js +0 -2
- package/dist/chunks/host-W2JJ3V3Q.js +0 -2
- package/dist/chunks/run-manager-RBWU3EVE.js +0 -2
- package/dist/chunks/utils-DJ4ZFJGL.js +0 -2
- package/dist/runtime-worker.js +0 -5381
- package/dist/types-chunks/review-inbox.d-CTeUIKda.d.ts +0 -225
- package/dist/types-chunks/run-manager.d-hm1XgEou.d.ts +0 -94
- package/dist/types-chunks/trusted-repl-entry-D0w5M0UZ.d.ts +0 -323
- package/dist/types-chunks/types.d-B1l9pWyX.d.ts +0 -146
|
@@ -0,0 +1,1993 @@
|
|
|
1
|
+
import { ai as KodaXJsonValue, ab as KodaXExtensionSessionState, aa as KodaXExtensionSessionRecord, ao as KodaXSessionArtifactLedgerEntry, bB as SessionErrorMetadata, aQ as MemoryActionProposal, aT as MemoryApplyResult, bh as MemoryRejectResult, bf as MemoryRefFilter, b6 as MemoryItemRef, aY as MemoryBodySnapshot, bi as MemoryRememberInput, bj as MemoryRememberResult, b8 as MemoryLifecycleOperationResult, by as PendingEpisodeReviewSummary, af as KodaXGoalState, at as KodaXSessionEntry, N as AgentTreeSnapshot, s as AgentDetail, M as AgentSpawnInput, Q as AgentTurnRef, r as AgentDataClassification, y as AgentFollowupResult, I as AgentOutput, t as AgentEvent } from './review-inbox.d-BeaLRNHx.js';
|
|
2
|
+
import { P as ProviderRequestObservation } from './provider-request-observation.d-jL8T6wVO.js';
|
|
3
|
+
import { b8 as WorkflowIsolation, aN as LearningQuery, aM as LearningPage, ax as LearnedCapabilityRecord, aP as LearningSurfaceSnapshot, aI as LearningEvent, aO as LearningSubscribeOptions, a4 as CompactionReport, bt as WorkflowProcessSnapshot, _ as AskUserQuestionOptions, Y as AskUserMultiOptions, am as KodaXInputArtifact, aW as ManagedWorkflowStatus, bm as WorkflowProcessEvent, W as AskUserAnswer, ah as ExternalAgentRegistrationSummary, ag as ExternalAgentRegistration, J as AgentRegistrationMutationOptions, I as AgentRegistrationEnabledMutationOptions } from './types.d-o7t9dds4.js';
|
|
4
|
+
import { k as KodaXMessage, W as KodaXTaskRoutingDecision, X as KodaXTaskType, Y as KodaXTaskWorkIntent, S as KodaXTaskComplexity, N as KodaXRiskLevel, h as KodaXHarnessProfile, f as KodaXExecutionMode, b as KodaXChildFanoutClass, ab as KodaXWireReasoningEffort, a2 as KodaXTokenUsage } from './types.d-BjOq57-z.js';
|
|
5
|
+
|
|
6
|
+
interface CircuitBreaker {
|
|
7
|
+
readonly timestamps: readonly number[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface DenialTracker {
|
|
11
|
+
readonly consecutive: number;
|
|
12
|
+
/** Lifetime diagnostic only; never trips the breaker by itself. */
|
|
13
|
+
readonly cumulative: number;
|
|
14
|
+
/** Bounded completed-review window. `true` means the reviewer denied. */
|
|
15
|
+
readonly recent?: readonly boolean[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* KodaX Provider Resilience Types (Feature 045)
|
|
20
|
+
*
|
|
21
|
+
* Defines the type system for failure taxonomy, recovery ladder,
|
|
22
|
+
* and execution state tracking used by the resilience module.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Fine-grained error classification beyond the basic ErrorCategory.
|
|
26
|
+
* Each class maps to a distinct recovery strategy.
|
|
27
|
+
*/
|
|
28
|
+
type ResilienceErrorClass = 'rate_limit' | 'provider_overloaded' | 'request_timeout' | 'stream_idle_timeout' | 'chunk_timeout' | 'connection_failure' | 'incomplete_stream' | 'user_abort' | 'non_retryable_provider_error' | 'reasoning_content_required';
|
|
29
|
+
/**
|
|
30
|
+
* The stage of the provider request lifecycle when the failure occurred.
|
|
31
|
+
* Determines the stable boundary and recovery strategy.
|
|
32
|
+
*/
|
|
33
|
+
type FailureStage = 'before_request_accepted' | 'before_first_delta' | 'mid_stream_text' | 'mid_stream_thinking' | 'mid_stream_tool_input' | 'post_tool_execution_pre_assistant_close';
|
|
34
|
+
|
|
35
|
+
type RuntimeContextOptimizationProfile = 'off' | 'report_only' | 'balanced' | 'small_window' | 'aggressive';
|
|
36
|
+
type RuntimeContextPressure = 'low' | 'medium' | 'high' | 'critical';
|
|
37
|
+
interface RuntimeContextBudgetBreakdown {
|
|
38
|
+
readonly systemPrompt: number;
|
|
39
|
+
readonly toolSchemas: number;
|
|
40
|
+
readonly skillCatalog: number;
|
|
41
|
+
readonly mcpCatalog: number;
|
|
42
|
+
readonly transcript: number;
|
|
43
|
+
readonly pendingInput: number;
|
|
44
|
+
readonly recentToolResults: number;
|
|
45
|
+
readonly reservedResponse: number;
|
|
46
|
+
readonly total: number;
|
|
47
|
+
}
|
|
48
|
+
interface RuntimeContextBudgetSnapshot {
|
|
49
|
+
/** The policy used by the execution owner, including its actual physical reserves. */
|
|
50
|
+
readonly compactionBudget?: {
|
|
51
|
+
readonly triggerPercent: number;
|
|
52
|
+
readonly absoluteTriggerTokens?: number;
|
|
53
|
+
readonly triggerTokens: number;
|
|
54
|
+
readonly physicalCapacityTokens: number;
|
|
55
|
+
readonly reservedResponseTokens: number;
|
|
56
|
+
readonly reservedMemoryTokens: number;
|
|
57
|
+
};
|
|
58
|
+
readonly sessionId?: string;
|
|
59
|
+
readonly runId?: string;
|
|
60
|
+
readonly turnId?: string;
|
|
61
|
+
readonly contextId?: string;
|
|
62
|
+
readonly contextKind?: 'root' | 'child';
|
|
63
|
+
readonly parentContextId?: string;
|
|
64
|
+
readonly agentId?: string;
|
|
65
|
+
readonly provider?: string;
|
|
66
|
+
readonly model?: string;
|
|
67
|
+
readonly profile: RuntimeContextOptimizationProfile;
|
|
68
|
+
readonly contextWindow: number;
|
|
69
|
+
readonly smallWindow: boolean;
|
|
70
|
+
readonly pressure: RuntimeContextPressure;
|
|
71
|
+
readonly tokenBreakdown: RuntimeContextBudgetBreakdown;
|
|
72
|
+
readonly usedTokens: number;
|
|
73
|
+
/** Diagnostic slack for the existing snapshot; never an append budget. */
|
|
74
|
+
readonly availableTokens: number;
|
|
75
|
+
readonly usedRatio: number;
|
|
76
|
+
readonly toolSchemaRatio: number;
|
|
77
|
+
readonly recommendations: readonly RuntimeContextBudgetRecommendation[];
|
|
78
|
+
readonly createdAt: string;
|
|
79
|
+
}
|
|
80
|
+
type RuntimeContextBudgetRecommendation = 'prefer_progressive_tool_exposure' | 'compact_or_summarize_history' | 'trim_recent_tool_results' | 'reserve_response_budget';
|
|
81
|
+
|
|
82
|
+
type KodaXShellSandboxBackend = 'windows-restricted-user' | 'macos-seatbelt' | 'linux-bubblewrap' | 'unsupported';
|
|
83
|
+
type KodaXShellSandboxObservation = {
|
|
84
|
+
readonly version: 1;
|
|
85
|
+
readonly state: 'applied';
|
|
86
|
+
readonly backend: KodaXShellSandboxBackend;
|
|
87
|
+
readonly policyId: 'kodax-workspace-shell-v1';
|
|
88
|
+
} | {
|
|
89
|
+
readonly version: 1;
|
|
90
|
+
readonly state: 'fallback';
|
|
91
|
+
readonly reason: 'not_ready' | 'prepare_failed' | 'backend_failed' | 'session_reset_pending' | 'acl_transition_pending';
|
|
92
|
+
readonly execution: 'normal_permission_policy';
|
|
93
|
+
} | {
|
|
94
|
+
readonly version: 1;
|
|
95
|
+
readonly state: 'not_selected';
|
|
96
|
+
};
|
|
97
|
+
interface KodaXTodoDriftWarningEvent {
|
|
98
|
+
readonly kind: 'work_started_without_claimed_todo';
|
|
99
|
+
readonly toolName: string;
|
|
100
|
+
readonly toolCallId?: string;
|
|
101
|
+
readonly count: number;
|
|
102
|
+
readonly pendingCount: number;
|
|
103
|
+
readonly openCount: number;
|
|
104
|
+
readonly firstPendingTodoId?: string;
|
|
105
|
+
readonly firstPendingTodoSubject?: string;
|
|
106
|
+
}
|
|
107
|
+
interface KodaXContextTokenSnapshot {
|
|
108
|
+
/** Request-local ceiling learned from rejection; cleared by new usage. */
|
|
109
|
+
capacityWindow?: number;
|
|
110
|
+
/** Current best-known token count for the full conversation context. */
|
|
111
|
+
currentTokens: number;
|
|
112
|
+
/** Local estimate for the same message set, used to adjust later message deltas. */
|
|
113
|
+
baselineEstimatedTokens: number;
|
|
114
|
+
/** Whether the snapshot is based on provider/API usage or local estimation. */
|
|
115
|
+
source: 'api' | 'estimate';
|
|
116
|
+
/** Optional turn usage from the latest provider response. */
|
|
117
|
+
usage?: KodaXTokenUsage;
|
|
118
|
+
}
|
|
119
|
+
interface KodaXTaskCapabilityHint {
|
|
120
|
+
kind: 'skill' | 'tool' | 'command' | 'workflow';
|
|
121
|
+
name: string;
|
|
122
|
+
details?: string;
|
|
123
|
+
}
|
|
124
|
+
interface KodaXTaskVerificationCriterion {
|
|
125
|
+
id: string;
|
|
126
|
+
label: string;
|
|
127
|
+
description: string;
|
|
128
|
+
threshold: number;
|
|
129
|
+
weight: number;
|
|
130
|
+
requiredEvidence?: string[];
|
|
131
|
+
}
|
|
132
|
+
interface KodaXRuntimeVerificationContract {
|
|
133
|
+
startupCommand?: string;
|
|
134
|
+
cwd?: string;
|
|
135
|
+
env?: Record<string, string>;
|
|
136
|
+
readySignal?: string;
|
|
137
|
+
baseUrl?: string;
|
|
138
|
+
uiFlows?: string[];
|
|
139
|
+
apiChecks?: string[];
|
|
140
|
+
dbChecks?: string[];
|
|
141
|
+
fixtures?: string[];
|
|
142
|
+
}
|
|
143
|
+
interface KodaXTaskVerificationContract {
|
|
144
|
+
summary?: string;
|
|
145
|
+
instructions?: string[];
|
|
146
|
+
requiredEvidence?: string[];
|
|
147
|
+
requiredChecks?: string[];
|
|
148
|
+
capabilityHints?: KodaXTaskCapabilityHint[];
|
|
149
|
+
rubricFamily?: 'code-review' | 'frontend' | 'product-completeness' | 'functionality' | 'code-quality' | 'partner-research';
|
|
150
|
+
criteria?: KodaXTaskVerificationCriterion[];
|
|
151
|
+
runtime?: KodaXRuntimeVerificationContract;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* FEATURE_247 — SDK-consumer agent profile identity (e.g. KodaX-Space Partner).
|
|
155
|
+
*
|
|
156
|
+
* The SDK core treats this as OPAQUE attribution: it is echoed onto results,
|
|
157
|
+
* events, the effective-config snapshot, session runtimeInfo, and tool context
|
|
158
|
+
* so an embedder can confirm which profile actually ran and can attribute
|
|
159
|
+
* concurrent Partner/Coder sessions. Absent ⇒ the default Coding Agent, with no
|
|
160
|
+
* behavioral change anywhere.
|
|
161
|
+
*
|
|
162
|
+
* Only two fields carry behavior, both additive and gated on their own presence:
|
|
163
|
+
* - `instructions` — on the SA path the embedder sets
|
|
164
|
+
* `context.systemPromptOverride`; the AMA/AMAW path builds role prompts
|
|
165
|
+
* internally, so when this is set the Worker role prompt PREPENDS this block
|
|
166
|
+
* (absent ⇒ byte-identical default coding role prompt).
|
|
167
|
+
* - `verification` — a profile-default verifier standard the Sidecar Verifier
|
|
168
|
+
* applies; per-task `context.taskVerification` still overrides/augments it.
|
|
169
|
+
*
|
|
170
|
+
* Everything else (`surface`/`id`/`version`/`name`) is pure identity passthrough.
|
|
171
|
+
*/
|
|
172
|
+
interface KodaXAgentProfile {
|
|
173
|
+
/** Surface/profile label, e.g. `'code'` | `'partner'`. Opaque to the core. */
|
|
174
|
+
readonly surface?: string;
|
|
175
|
+
/** Stable profile id (UUID or stable name). Opaque to the core. */
|
|
176
|
+
readonly id?: string;
|
|
177
|
+
/** Profile version. Opaque to the core. */
|
|
178
|
+
readonly version?: string;
|
|
179
|
+
/** Human-facing display name. Opaque to the core. */
|
|
180
|
+
readonly name?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Partner behavior instructions injected into the AMA/AMAW Worker role prompt
|
|
183
|
+
* (prepended). The SA path uses `context.systemPromptOverride` instead — this
|
|
184
|
+
* field is the AMA-path equivalent so a Partner profile behaves consistently
|
|
185
|
+
* across both execution modes.
|
|
186
|
+
*/
|
|
187
|
+
readonly instructions?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Profile-default verification standard. Merged with per-task
|
|
190
|
+
* `context.taskVerification` (per-task fields win) before reaching the Sidecar
|
|
191
|
+
* Verifier.
|
|
192
|
+
*/
|
|
193
|
+
readonly verification?: KodaXTaskVerificationContract;
|
|
194
|
+
}
|
|
195
|
+
interface KodaXTaskToolPolicy {
|
|
196
|
+
summary: string;
|
|
197
|
+
allowedTools?: string[];
|
|
198
|
+
blockedTools?: string[];
|
|
199
|
+
allowedShellPatterns?: string[];
|
|
200
|
+
allowedWritePathPatterns?: string[];
|
|
201
|
+
}
|
|
202
|
+
interface KodaXChildContextBundle {
|
|
203
|
+
id: string;
|
|
204
|
+
fanoutClass: KodaXChildFanoutClass;
|
|
205
|
+
objective: string;
|
|
206
|
+
scopeSummary?: string;
|
|
207
|
+
evidenceRefs: string[];
|
|
208
|
+
constraints: string[];
|
|
209
|
+
readOnly: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* FEATURE_102 / FEATURE_259 — semantic model tier intent. The runtime maps
|
|
212
|
+
* configured `fast`/`deep` tiers to concrete routes and safely inherits the
|
|
213
|
+
* parent when a tier is unavailable or ineligible.
|
|
214
|
+
*/
|
|
215
|
+
modelHint?: KodaXChildModelHint;
|
|
216
|
+
/**
|
|
217
|
+
* FEATURE_217 (v0.7.49): workflow-level child isolation hint. Default is
|
|
218
|
+
* shared parent cwd; `worktree` is opt-in and parent-managed.
|
|
219
|
+
*/
|
|
220
|
+
isolation?: WorkflowIsolation;
|
|
221
|
+
/**
|
|
222
|
+
* FEATURE_191 — optional registered specialist agent name. When set,
|
|
223
|
+
* the child is dispatched with that agent's `instructions` /
|
|
224
|
+
* `tools` / `reasoning` / `guardrails` instead of the stock Worker
|
|
225
|
+
* bundle. Resolved via `resolveConstructedAgent(name)` at dispatch
|
|
226
|
+
* time; unknown names are rejected by `toolDispatchChildTask` with
|
|
227
|
+
* a tool-result error (not throw) before the bundle reaches
|
|
228
|
+
* `executeReadChild` / `executeWriteChild`. Optional — omitting
|
|
229
|
+
* preserves byte-identical v0.7.42 baseline dispatch behavior.
|
|
230
|
+
*/
|
|
231
|
+
specialistName?: string;
|
|
232
|
+
/**
|
|
233
|
+
* FEATURE_102 Phase 2 (v0.7.45) — explicit per-dispatch provider/model the
|
|
234
|
+
* dispatching agent chose for this child (e.g. a cross-family second review).
|
|
235
|
+
* Priority in child-executor: `bundle.provider/model` > specialist's declared
|
|
236
|
+
* model > parent default. Omitting both inherits the parent (byte-identical).
|
|
237
|
+
*/
|
|
238
|
+
provider?: string;
|
|
239
|
+
model?: string;
|
|
240
|
+
/** Optional per-dispatch reasoning effort. Omit to inherit the parent effort. */
|
|
241
|
+
effort?: KodaXWireReasoningEffort;
|
|
242
|
+
/**
|
|
243
|
+
* FEATURE_246 Part B — optional JSON Schema (opaque) for the child's
|
|
244
|
+
* structured output. When set, the child briefing asks for a fenced JSON
|
|
245
|
+
* block matching it; the child executor parses + validates the result (with
|
|
246
|
+
* one bounded repair turn) and surfaces it on `KodaXChildAgentResult.structured`.
|
|
247
|
+
*/
|
|
248
|
+
outputSchema?: unknown;
|
|
249
|
+
/**
|
|
250
|
+
* Runtime-only fixed AMA result contract. Unlike Workflow outputSchema,
|
|
251
|
+
* invalid output is parse-only and never starts a repair model turn.
|
|
252
|
+
*/
|
|
253
|
+
structuredOutputContract?: 'pattern-disposition-parse-only';
|
|
254
|
+
/** Trusted host provenance plus the generated script's terse-result declaration. */
|
|
255
|
+
workflowOutputContract?: {
|
|
256
|
+
readonly kodaxAuthored: boolean;
|
|
257
|
+
readonly terseResult: boolean;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* FEATURE_120 v0.7.39 Phase 4 — model tier hint. Tier semantics:
|
|
262
|
+
* - `'fast'` — short lookups (read 1-2 files, simple grep).
|
|
263
|
+
* - `'balanced'` — normal subtasks (default behavior; same as omit).
|
|
264
|
+
* - `'deep'` — heavy reasoning (multi-file analysis, complex audit).
|
|
265
|
+
*
|
|
266
|
+
* `omit` ≡ `'balanced'` so the absent case maps to "default routing".
|
|
267
|
+
* Validators MUST reject other strings (the dispatch tool drops
|
|
268
|
+
* unknown values silently with a tolerant fallback to `undefined`).
|
|
269
|
+
*/
|
|
270
|
+
type KodaXChildModelHint = 'fast' | 'balanced' | 'deep';
|
|
271
|
+
type KodaXChildTierOutcome = 'applied' | 'balanced-parent' | 'fast-write-ineligible' | 'unconfigured' | 'shadowed-by-selector' | 'inherited';
|
|
272
|
+
type KodaXChildRouteSource = 'explicit' | 'specialist' | 'tier' | 'parent' | 'default';
|
|
273
|
+
interface KodaXChildRouteFacts {
|
|
274
|
+
readonly requestedTier: KodaXChildModelHint | 'inherited';
|
|
275
|
+
readonly tierOutcome: KodaXChildTierOutcome;
|
|
276
|
+
readonly providerSource: KodaXChildRouteSource;
|
|
277
|
+
readonly modelSource?: Exclude<KodaXChildRouteSource, 'default'>;
|
|
278
|
+
readonly initialProvider?: string;
|
|
279
|
+
readonly initialModel?: string;
|
|
280
|
+
readonly finalProvider?: string;
|
|
281
|
+
readonly finalModel?: string;
|
|
282
|
+
readonly resolvedEffort?: string;
|
|
283
|
+
readonly fallbackReason?: string;
|
|
284
|
+
readonly iterations?: number;
|
|
285
|
+
readonly inputTokens?: number;
|
|
286
|
+
readonly cacheReadTokens?: number;
|
|
287
|
+
readonly outputTokens?: number;
|
|
288
|
+
readonly digestTokens?: number;
|
|
289
|
+
readonly durationMs?: number;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Bounded terminal execution failure facts. Provider failures use only safe
|
|
293
|
+
* structured facts, never raw upstream messages or bodies. Local exceptions
|
|
294
|
+
* retain a bounded diagnostic with scoped Provider credentials redacted.
|
|
295
|
+
*/
|
|
296
|
+
interface KodaXExecutionFailure {
|
|
297
|
+
readonly source?: 'provider' | 'local';
|
|
298
|
+
/** Bounded diagnostic, independent of any assistant reply. */
|
|
299
|
+
readonly message: string;
|
|
300
|
+
readonly safeMessage: string;
|
|
301
|
+
readonly errorName?: string;
|
|
302
|
+
readonly errorClass: ResilienceErrorClass | 'local_execution_error';
|
|
303
|
+
/** Most specific safe upstream or KodaX failure code available. */
|
|
304
|
+
readonly code?: string;
|
|
305
|
+
readonly failureCode?: 'provider_not_registered' | 'request_build_failed' | 'protocol_mismatch' | 'response_stream_error';
|
|
306
|
+
readonly provider?: string;
|
|
307
|
+
readonly model?: string;
|
|
308
|
+
readonly requestPhase: FailureStage | 'local_execution';
|
|
309
|
+
readonly providerStage?: 'catalog' | 'request_build' | 'transport' | 'response_stream';
|
|
310
|
+
readonly httpStatus?: number;
|
|
311
|
+
readonly upstreamCode?: string;
|
|
312
|
+
readonly requestId?: string;
|
|
313
|
+
readonly retryAfterMs?: number;
|
|
314
|
+
readonly elapsedMs?: number;
|
|
315
|
+
}
|
|
316
|
+
interface KodaXChildAgentResult {
|
|
317
|
+
readonly iteration?: {
|
|
318
|
+
readonly current: number;
|
|
319
|
+
readonly max: number;
|
|
320
|
+
};
|
|
321
|
+
childId: string;
|
|
322
|
+
fanoutClass: KodaXChildFanoutClass;
|
|
323
|
+
status: 'completed' | 'blocked' | 'failed';
|
|
324
|
+
disposition: 'candidate' | 'valid' | 'false-positive' | 'needs-more-evidence';
|
|
325
|
+
summary: string;
|
|
326
|
+
evidenceRefs: string[];
|
|
327
|
+
contradictions: string[];
|
|
328
|
+
artifactPaths?: string[];
|
|
329
|
+
sessionId?: string;
|
|
330
|
+
/** Bounded workflow transcript digest. Full `summary` remains the synthesis/audit source. */
|
|
331
|
+
digest?: string;
|
|
332
|
+
/** True when a workflow child digest was attempted but failed (error/timeout/empty distillation). */
|
|
333
|
+
digestFailed?: boolean;
|
|
334
|
+
/** True when a workflow child digest is running asynchronously and may arrive later. */
|
|
335
|
+
digestPending?: boolean;
|
|
336
|
+
/** Actual provider/model selected for this child run, when known. */
|
|
337
|
+
provider?: string;
|
|
338
|
+
model?: string;
|
|
339
|
+
/** Terminal execution failure, independent of assistant text. */
|
|
340
|
+
failure?: KodaXExecutionFailure;
|
|
341
|
+
/** Actual iterations consumed by this child agent. */
|
|
342
|
+
actualIterations?: number;
|
|
343
|
+
/** Best-known token usage for this child run. Used by workflow budget accounting. */
|
|
344
|
+
totalTokensUsed?: number;
|
|
345
|
+
/** Token usage attributable only to the optional presentation digest call. */
|
|
346
|
+
digestTokensUsed?: number;
|
|
347
|
+
/** Provider-reported usage for the optional digest call (diagnostic subset of totalTokensUsed). */
|
|
348
|
+
digestUsage?: {
|
|
349
|
+
readonly inputTokens?: number;
|
|
350
|
+
readonly outputTokens?: number;
|
|
351
|
+
readonly totalTokens?: number;
|
|
352
|
+
readonly cacheReadTokens?: number;
|
|
353
|
+
};
|
|
354
|
+
/** Correlated model-tier and fallback facts for cost/quality reporting. */
|
|
355
|
+
routeFacts?: KodaXChildRouteFacts;
|
|
356
|
+
/** True when the child exhausted its iteration budget before completing. */
|
|
357
|
+
limitReached?: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* True when the child's `runKodaX` exited via CAP-083 AbortError silent
|
|
360
|
+
* terminal (`KodaXResult.interrupted === true`). Surfaces the
|
|
361
|
+
* "success but empty lastText" path that produces empty
|
|
362
|
+
* `<task-completed task_id="X"></task-completed>` banners.
|
|
363
|
+
* Diagnostic field — populated by child-executor on the success branch
|
|
364
|
+
* and consumed by dispatch-child-tasks' empty-summary fallback.
|
|
365
|
+
*/
|
|
366
|
+
interrupted?: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* FEATURE_246 Part B — schema-validated structured output parsed from the
|
|
369
|
+
* child's final text (present only when the bundle carried `outputSchema`
|
|
370
|
+
* and a JSON value was parseable). Surfaced to the workflow runtime as
|
|
371
|
+
* `WorkflowTaskResult.structured`.
|
|
372
|
+
*/
|
|
373
|
+
structured?: unknown;
|
|
374
|
+
}
|
|
375
|
+
interface KodaXParentReductionContract {
|
|
376
|
+
owner: 'parent';
|
|
377
|
+
strategy: 'direct-parent' | 'evaluator-assisted' | 'reducer-child';
|
|
378
|
+
collapseChildTranscripts: boolean;
|
|
379
|
+
summary: string;
|
|
380
|
+
requiredArtifacts: string[];
|
|
381
|
+
}
|
|
382
|
+
type KodaXMemoryStrategy = 'continuous' | 'compact' | 'reset-handoff';
|
|
383
|
+
type KodaXBudgetDisclosureZone = 'green' | 'yellow' | 'orange' | 'red';
|
|
384
|
+
interface KodaXManagedTaskHarnessTransition {
|
|
385
|
+
from: KodaXHarnessProfile;
|
|
386
|
+
to: KodaXHarnessProfile;
|
|
387
|
+
round: number;
|
|
388
|
+
source: 'scout' | 'evaluator';
|
|
389
|
+
reason?: string;
|
|
390
|
+
approved: boolean;
|
|
391
|
+
denialReason?: string;
|
|
392
|
+
}
|
|
393
|
+
type KodaXManagedTaskPhase = 'starting' | 'routing' | 'preflight' | 'round' | 'worker' | 'upgrade' | 'verifying' | 'completed';
|
|
394
|
+
type KodaXManagedLiveEventPresentation = 'status' | 'assistant' | 'thinking';
|
|
395
|
+
interface KodaXManagedLiveEvent {
|
|
396
|
+
key: string;
|
|
397
|
+
kind: 'progress' | 'completed' | 'notification' | 'warning';
|
|
398
|
+
presentation?: KodaXManagedLiveEventPresentation;
|
|
399
|
+
phase?: KodaXManagedTaskPhase;
|
|
400
|
+
workerId?: string;
|
|
401
|
+
workerTitle?: string;
|
|
402
|
+
summary: string;
|
|
403
|
+
detail?: string;
|
|
404
|
+
persistToHistory?: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface KodaXVerificationScorecardCriterion {
|
|
407
|
+
id: string;
|
|
408
|
+
label: string;
|
|
409
|
+
threshold: number;
|
|
410
|
+
score: number;
|
|
411
|
+
passed: boolean;
|
|
412
|
+
weight: number;
|
|
413
|
+
requiredEvidence?: string[];
|
|
414
|
+
evidence?: string[];
|
|
415
|
+
reason?: string;
|
|
416
|
+
}
|
|
417
|
+
interface KodaXVerificationScorecard {
|
|
418
|
+
rubricFamily?: KodaXTaskVerificationContract['rubricFamily'];
|
|
419
|
+
overallScore: number;
|
|
420
|
+
verdict: 'accept' | 'revise' | 'blocked';
|
|
421
|
+
criteria: KodaXVerificationScorecardCriterion[];
|
|
422
|
+
trend?: 'improving' | 'flat' | 'regressing';
|
|
423
|
+
summary?: string;
|
|
424
|
+
}
|
|
425
|
+
interface KodaXRoleRoundSummary {
|
|
426
|
+
role: KodaXTaskRole;
|
|
427
|
+
round: number;
|
|
428
|
+
objective: string;
|
|
429
|
+
confirmedConclusions: string[];
|
|
430
|
+
unresolvedQuestions: string[];
|
|
431
|
+
nextFocus: string[];
|
|
432
|
+
summary: string;
|
|
433
|
+
sourceWorkerId?: string;
|
|
434
|
+
updatedAt: string;
|
|
435
|
+
}
|
|
436
|
+
interface KodaXManagedBudgetSnapshot {
|
|
437
|
+
totalBudget: number;
|
|
438
|
+
reserveBudget: number;
|
|
439
|
+
reserveRemaining: number;
|
|
440
|
+
upgradeReserveBudget?: number;
|
|
441
|
+
upgradeReserveRemaining?: number;
|
|
442
|
+
plannedRounds: number;
|
|
443
|
+
currentRound: number;
|
|
444
|
+
spentBudget: number;
|
|
445
|
+
remainingBudget: number;
|
|
446
|
+
workerId?: string;
|
|
447
|
+
role?: KodaXTaskRole;
|
|
448
|
+
currentHarness?: KodaXHarnessProfile;
|
|
449
|
+
upgradeCeiling?: KodaXHarnessProfile;
|
|
450
|
+
zone?: KodaXBudgetDisclosureZone;
|
|
451
|
+
showExactRoundCounter?: boolean;
|
|
452
|
+
allowExtensionRequest?: boolean;
|
|
453
|
+
mustConverge?: boolean;
|
|
454
|
+
softMaxIter?: number;
|
|
455
|
+
hardMaxIter?: number;
|
|
456
|
+
extensionGrantedIters?: number;
|
|
457
|
+
extensionDenied?: boolean;
|
|
458
|
+
extensionReason?: string;
|
|
459
|
+
}
|
|
460
|
+
type KodaXTaskSurface = 'cli' | 'repl' | 'plan';
|
|
461
|
+
type KodaXTaskStatus = 'planned' | 'running' | 'blocked' | 'failed' | 'completed';
|
|
462
|
+
type KodaXTaskRole = 'direct' | 'scout' | 'planner' | 'generator' | 'evaluator' | 'worker';
|
|
463
|
+
interface KodaXTaskContract {
|
|
464
|
+
taskId: string;
|
|
465
|
+
surface: KodaXTaskSurface;
|
|
466
|
+
objective: string;
|
|
467
|
+
createdAt: string;
|
|
468
|
+
updatedAt: string;
|
|
469
|
+
status: KodaXTaskStatus;
|
|
470
|
+
primaryTask: KodaXTaskType;
|
|
471
|
+
workIntent: KodaXTaskWorkIntent;
|
|
472
|
+
complexity: KodaXTaskComplexity;
|
|
473
|
+
riskLevel: KodaXRiskLevel;
|
|
474
|
+
harnessProfile: KodaXHarnessProfile;
|
|
475
|
+
recommendedMode: KodaXExecutionMode;
|
|
476
|
+
requiresBrainstorm: boolean;
|
|
477
|
+
reason: string;
|
|
478
|
+
contractSummary?: string;
|
|
479
|
+
successCriteria: string[];
|
|
480
|
+
requiredEvidence: string[];
|
|
481
|
+
constraints: string[];
|
|
482
|
+
contractCreatedByAssignmentId?: string;
|
|
483
|
+
contractUpdatedAt?: string;
|
|
484
|
+
metadata?: Record<string, KodaXJsonValue>;
|
|
485
|
+
verification?: KodaXTaskVerificationContract;
|
|
486
|
+
}
|
|
487
|
+
interface KodaXTaskRoleAssignment {
|
|
488
|
+
id: string;
|
|
489
|
+
role: KodaXTaskRole;
|
|
490
|
+
title: string;
|
|
491
|
+
dependsOn: string[];
|
|
492
|
+
status: KodaXTaskStatus;
|
|
493
|
+
agent?: string;
|
|
494
|
+
toolPolicy?: KodaXTaskToolPolicy;
|
|
495
|
+
summary?: string;
|
|
496
|
+
sessionId?: string;
|
|
497
|
+
}
|
|
498
|
+
interface KodaXTaskWorkItem {
|
|
499
|
+
id: string;
|
|
500
|
+
assignmentId: string;
|
|
501
|
+
description: string;
|
|
502
|
+
execution: 'serial' | 'parallel';
|
|
503
|
+
}
|
|
504
|
+
interface KodaXTaskEvidenceArtifact {
|
|
505
|
+
kind: 'json' | 'text' | 'markdown' | 'image';
|
|
506
|
+
path: string;
|
|
507
|
+
description?: string;
|
|
508
|
+
}
|
|
509
|
+
interface KodaXTaskEvidenceEntry {
|
|
510
|
+
assignmentId: string;
|
|
511
|
+
role: KodaXTaskRole;
|
|
512
|
+
status: KodaXTaskStatus;
|
|
513
|
+
title?: string;
|
|
514
|
+
round?: number;
|
|
515
|
+
summary?: string;
|
|
516
|
+
output?: string;
|
|
517
|
+
sessionId?: string;
|
|
518
|
+
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
519
|
+
signalReason?: string;
|
|
520
|
+
}
|
|
521
|
+
interface KodaXTaskEvidenceBundle {
|
|
522
|
+
workspaceDir: string;
|
|
523
|
+
runId?: string;
|
|
524
|
+
artifacts: KodaXTaskEvidenceArtifact[];
|
|
525
|
+
entries: KodaXTaskEvidenceEntry[];
|
|
526
|
+
routingNotes: string[];
|
|
527
|
+
}
|
|
528
|
+
interface KodaXOrchestrationVerdict {
|
|
529
|
+
status: KodaXTaskStatus;
|
|
530
|
+
decidedByAssignmentId: string;
|
|
531
|
+
summary: string;
|
|
532
|
+
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
533
|
+
signalReason?: string;
|
|
534
|
+
signalDebugReason?: string;
|
|
535
|
+
disposition?: 'complete' | 'blocked' | 'needs_continuation';
|
|
536
|
+
}
|
|
537
|
+
interface KodaXManagedTaskRuntimeState {
|
|
538
|
+
childContextBundles?: KodaXChildContextBundle[];
|
|
539
|
+
childAgentResults?: KodaXChildAgentResult[];
|
|
540
|
+
parentReductionContract?: KodaXParentReductionContract;
|
|
541
|
+
budget?: KodaXManagedBudgetSnapshot;
|
|
542
|
+
scorecard?: KodaXVerificationScorecard;
|
|
543
|
+
qualityAssuranceMode?: 'required' | 'optional';
|
|
544
|
+
memoryStrategies?: Record<string, KodaXMemoryStrategy>;
|
|
545
|
+
memoryNotes?: Record<string, string>;
|
|
546
|
+
roleRoundSummaries?: Partial<Record<KodaXTaskRole, KodaXRoleRoundSummary>>;
|
|
547
|
+
routingAttempts?: number;
|
|
548
|
+
routingSource?: KodaXTaskRoutingDecision['routingSource'];
|
|
549
|
+
currentHarness?: KodaXHarnessProfile;
|
|
550
|
+
upgradeCeiling?: KodaXHarnessProfile;
|
|
551
|
+
harnessTransitions?: KodaXManagedTaskHarnessTransition[];
|
|
552
|
+
completionContractStatus?: Record<string, 'ready' | 'incomplete' | 'blocked' | 'missing'>;
|
|
553
|
+
rawRoutingDecision?: KodaXTaskRoutingDecision;
|
|
554
|
+
finalRoutingDecision?: KodaXTaskRoutingDecision;
|
|
555
|
+
routingOverrideReason?: string;
|
|
556
|
+
providerRuntimeBehavior?: {
|
|
557
|
+
downgraded?: boolean;
|
|
558
|
+
reasons: string[];
|
|
559
|
+
};
|
|
560
|
+
degradedVerification?: {
|
|
561
|
+
fallbackWorkerId?: string;
|
|
562
|
+
reason: string;
|
|
563
|
+
debugReason?: string;
|
|
564
|
+
};
|
|
565
|
+
degradedContinue?: boolean;
|
|
566
|
+
reviewFilesOrAreas?: string[];
|
|
567
|
+
toolOutputTruncated?: boolean;
|
|
568
|
+
toolOutputTruncationNotes?: string[];
|
|
569
|
+
/**
|
|
570
|
+
* Warn-only todo hygiene telemetry: successful real work started while
|
|
571
|
+
* pending todos existed and no item was marked in_progress. The runner
|
|
572
|
+
* never mutates todo state from this signal.
|
|
573
|
+
*/
|
|
574
|
+
todoDriftWarnings?: KodaXTodoDriftWarningEvent[];
|
|
575
|
+
managedTimeline?: KodaXManagedLiveEvent[];
|
|
576
|
+
evidenceAcquisitionMode?: 'overview' | 'diff-bundle' | 'diff-slice' | 'file-read';
|
|
577
|
+
consecutiveEvidenceOnlyIterations?: number;
|
|
578
|
+
globalWorkBudget?: number;
|
|
579
|
+
budgetUsage?: number;
|
|
580
|
+
budgetApprovalRequired?: boolean;
|
|
581
|
+
/** FEATURE_067: Evaluator review prompt for write fan-out diffs. */
|
|
582
|
+
childWriteReviewPrompt?: string;
|
|
583
|
+
/** FEATURE_067: Number of write child diffs pending evaluator review. */
|
|
584
|
+
childWriteDiffCount?: number;
|
|
585
|
+
}
|
|
586
|
+
interface KodaXManagedTask {
|
|
587
|
+
contract: KodaXTaskContract;
|
|
588
|
+
roleAssignments: KodaXTaskRoleAssignment[];
|
|
589
|
+
workItems: KodaXTaskWorkItem[];
|
|
590
|
+
evidence: KodaXTaskEvidenceBundle;
|
|
591
|
+
verdict: KodaXOrchestrationVerdict;
|
|
592
|
+
runtime?: KodaXManagedTaskRuntimeState;
|
|
593
|
+
}
|
|
594
|
+
interface KodaXManagedVerdictPayload {
|
|
595
|
+
/** FEATURE_184 (v0.7.45): `'sidecar'` is the new architectural source — * Sidecar Verifier replaces the in-chain Evaluator role. `'evaluator'`
|
|
596
|
+
* / `'worker'` are retained for backward-compat reads of session jsonl
|
|
597
|
+
* written before v0.7.45. New writes use `'sidecar'`. */
|
|
598
|
+
source: 'evaluator' | 'worker' | 'sidecar';
|
|
599
|
+
status: 'accept' | 'revise' | 'blocked';
|
|
600
|
+
reason?: string;
|
|
601
|
+
debugReason?: string;
|
|
602
|
+
followups: string[];
|
|
603
|
+
userFacingText: string;
|
|
604
|
+
userAnswer?: string;
|
|
605
|
+
artifactPath?: string;
|
|
606
|
+
rawArtifactPath?: string;
|
|
607
|
+
rawResponseText?: string;
|
|
608
|
+
nextHarness?: KodaXTaskRoutingDecision['harnessProfile'];
|
|
609
|
+
protocolParseFailed?: boolean;
|
|
610
|
+
verificationDegraded?: boolean;
|
|
611
|
+
strategyReasonCode?: 'missing_requirement' | 'contradicted_evidence' | 'unsupported_claim' | 'unresolved_high_risk' | 'verification_degraded';
|
|
612
|
+
recommendedPattern?: 'classify-and-act' | 'fan-out-and-synthesize' | 'adversarial-verification' | 'generate-and-filter' | 'tournament' | 'loop-until-done';
|
|
613
|
+
targetEvidenceRefs?: string[];
|
|
614
|
+
preferredFallbackWorkerId?: string;
|
|
615
|
+
/**
|
|
616
|
+
* v0.7.26 Risk-3 fix — Evaluator explicit budget-extension request.
|
|
617
|
+
* When present, the Runner-driven `wrapEmitterWithRecorder` fires the
|
|
618
|
+
* budget-extension dialog regardless of the 90% threshold, using this
|
|
619
|
+
* string as the user-visible summary. Mirrors legacy Evaluator's
|
|
620
|
+
* `budgetRequest` field which was parsed from the fenced-block
|
|
621
|
+
* `kodax-budget-request` payload in v0.7.22.
|
|
622
|
+
*/
|
|
623
|
+
budgetRequest?: string;
|
|
624
|
+
}
|
|
625
|
+
interface KodaXManagedProtocolPayload {
|
|
626
|
+
verdict?: KodaXManagedVerdictPayload;
|
|
627
|
+
}
|
|
628
|
+
interface KodaXRuntimeSessionSnapshot {
|
|
629
|
+
extensionState?: KodaXExtensionSessionState;
|
|
630
|
+
extensionRecords?: KodaXExtensionSessionRecord[];
|
|
631
|
+
}
|
|
632
|
+
interface KodaXWrittenFile {
|
|
633
|
+
readonly path: string;
|
|
634
|
+
/** Retains a successful Skill promotion even if a later edit changes the file. */
|
|
635
|
+
readonly sourceTool: 'write' | 'edit' | 'multi_edit' | 'insert_after_anchor' | 'run_skill_script';
|
|
636
|
+
}
|
|
637
|
+
interface KodaXResult {
|
|
638
|
+
success: boolean;
|
|
639
|
+
lastText: string;
|
|
640
|
+
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
641
|
+
signalReason?: string;
|
|
642
|
+
signalDebugReason?: string;
|
|
643
|
+
messages: KodaXMessage[];
|
|
644
|
+
sessionId: string;
|
|
645
|
+
/**
|
|
646
|
+
* FEATURE_247 — the agent profile this run executed under, echoed verbatim from
|
|
647
|
+
* `options.context.agentProfile`. Lets an embedder confirm the running profile
|
|
648
|
+
* was Partner (not the default Coding Agent). Absent ⇒ default Coding Agent.
|
|
649
|
+
*/
|
|
650
|
+
agentProfile?: KodaXAgentProfile;
|
|
651
|
+
/** Internal raw protocol output retained for artifact persistence after compacting visible failure text. */
|
|
652
|
+
protocolRawText?: string;
|
|
653
|
+
/** Structured managed-task protocol payload separated from visible text. */
|
|
654
|
+
managedProtocolPayload?: KodaXManagedProtocolPayload;
|
|
655
|
+
/** Final visible routing decision for this run, including harness and work intent. */
|
|
656
|
+
routingDecision?: KodaXTaskRoutingDecision;
|
|
657
|
+
/** Managed task summary produced by the task engine for this run. */
|
|
658
|
+
managedTask?: KodaXManagedTask;
|
|
659
|
+
/** Best-known token snapshot after the round completes. */
|
|
660
|
+
contextTokenSnapshot?: KodaXContextTokenSnapshot;
|
|
661
|
+
/** Latest provider usage when the caller has it directly. */
|
|
662
|
+
usage?: KodaXTokenUsage;
|
|
663
|
+
/** Serializable runtime-owned session state for host-owned persistence. */
|
|
664
|
+
runtimeSessionSnapshot?: KodaXRuntimeSessionSnapshot;
|
|
665
|
+
/**
|
|
666
|
+
* FEATURE_076: artifact ledger pre-extracted before round-boundary reshape.
|
|
667
|
+
* Populated when the reshape replaces `messages` with a clean {user, assistant}
|
|
668
|
+
* dialog — tool_result blocks (the source of artifact ledger entries) no
|
|
669
|
+
* longer live in `messages` after reshape. REPL consumers should read this
|
|
670
|
+
* field first, falling back to `extractArtifactLedger(messages)` for
|
|
671
|
+
* backward compatibility on code paths that have not yet been updated.
|
|
672
|
+
*/
|
|
673
|
+
artifactLedger?: readonly KodaXSessionArtifactLedgerEntry[];
|
|
674
|
+
/** Successful writes in this invocation; candidates, not permission to publish files.
|
|
675
|
+
* Unlike the compaction ledger, this list is not truncated with conversation history.
|
|
676
|
+
* An empty list is authoritative; undefined supports older/custom executors.
|
|
677
|
+
*/
|
|
678
|
+
writtenFiles?: readonly KodaXWrittenFile[];
|
|
679
|
+
/** 是否被用户中断 (Ctrl+C) */
|
|
680
|
+
interrupted?: boolean;
|
|
681
|
+
/** 是否达到迭代上限 */
|
|
682
|
+
limitReached?: boolean;
|
|
683
|
+
/** Error metadata for recovery - 错误元数据用于恢复 */
|
|
684
|
+
errorMetadata?: SessionErrorMetadata;
|
|
685
|
+
/** Terminal execution failure, independent of assistant text. */
|
|
686
|
+
failure?: KodaXExecutionFailure;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/** Existing product domain operations. This module has no Host or UI dependencies. */
|
|
690
|
+
|
|
691
|
+
interface ClientCompactSessionResult {
|
|
692
|
+
readonly compacted: boolean;
|
|
693
|
+
readonly tokensBefore: number;
|
|
694
|
+
readonly tokensAfter: number;
|
|
695
|
+
/** Host-committed context, or the unchanged context for a no-op. */
|
|
696
|
+
readonly messages: KodaXMessage[];
|
|
697
|
+
readonly report?: CompactionReport;
|
|
698
|
+
/** A no-op or failure explanation; a lost reply never implies success. */
|
|
699
|
+
readonly reason?: string;
|
|
700
|
+
}
|
|
701
|
+
/** Preview revision accompanies fingerprints so a second UI need not recreate it. */
|
|
702
|
+
interface ClientMemoryProposal extends MemoryActionProposal {
|
|
703
|
+
readonly revision: string;
|
|
704
|
+
}
|
|
705
|
+
interface ClientMemoryController {
|
|
706
|
+
listInbox(): Promise<readonly ClientMemoryProposal[]>;
|
|
707
|
+
showProposal(id: string): Promise<ClientMemoryProposal | undefined>;
|
|
708
|
+
approveProposal(id: string, expectedFingerprints: Readonly<Record<string, string>>, expectedRevision?: string): Promise<MemoryApplyResult>;
|
|
709
|
+
rejectProposal(id: string, reason?: string, expectedRevision?: string): Promise<MemoryRejectResult>;
|
|
710
|
+
listRefs(filter?: MemoryRefFilter): Promise<readonly MemoryItemRef[]>;
|
|
711
|
+
/** Host resolves the exact ref ID; a supplied storage path is never write authority. */
|
|
712
|
+
readRef(ref: MemoryItemRef): Promise<MemoryBodySnapshot>;
|
|
713
|
+
remember(input: MemoryRememberInput): Promise<MemoryRememberResult>;
|
|
714
|
+
forgetRef(id: string, expectedBodyFingerprint?: string): Promise<MemoryLifecycleOperationResult>;
|
|
715
|
+
}
|
|
716
|
+
interface ClientMemoryRebuildResult {
|
|
717
|
+
readonly status: 'missing-dir' | 'no-topics' | 'rebuilt';
|
|
718
|
+
readonly memoryRoot: string;
|
|
719
|
+
readonly entrypointPath: string;
|
|
720
|
+
readonly entryCount: number;
|
|
721
|
+
readonly malformedFiles: readonly string[];
|
|
722
|
+
readonly warnings: readonly string[];
|
|
723
|
+
}
|
|
724
|
+
interface ClientMemoryPlane {
|
|
725
|
+
readonly controller: ClientMemoryController;
|
|
726
|
+
readonly memoryRoot: string;
|
|
727
|
+
readonly entrypointPath: string;
|
|
728
|
+
listReviews(): Promise<readonly PendingEpisodeReviewSummary[]>;
|
|
729
|
+
reviewerProviderConfigured(): boolean;
|
|
730
|
+
rebuild(): Promise<ClientMemoryRebuildResult>;
|
|
731
|
+
/** Validate containment and required directories; the UI launches its own editor. */
|
|
732
|
+
ensureOpenTarget(targetPath: string): Promise<string>;
|
|
733
|
+
}
|
|
734
|
+
interface ClientMemoryService {
|
|
735
|
+
/** Host derives the project identity and rechecks authorization for each operation. */
|
|
736
|
+
forProject(projectRoot: string): Promise<ClientMemoryPlane>;
|
|
737
|
+
}
|
|
738
|
+
/** Learning notifications belong to the authenticated client; governance is shared. */
|
|
739
|
+
interface ClientLearningSubscription extends AsyncIterableIterator<LearningEvent> {
|
|
740
|
+
/** Registration only; read a snapshot after awaiting ready. */
|
|
741
|
+
readonly ready: Promise<void>;
|
|
742
|
+
}
|
|
743
|
+
interface ClientLearningService {
|
|
744
|
+
list(query?: LearningQuery): Promise<LearningPage>;
|
|
745
|
+
get(nameOrSlugOrId: string): Promise<LearnedCapabilityRecord>;
|
|
746
|
+
getSnapshot(): Promise<LearningSurfaceSnapshot>;
|
|
747
|
+
events(afterRevision?: number): Promise<readonly LearningEvent[]>;
|
|
748
|
+
subscribe(options?: LearningSubscribeOptions): ClientLearningSubscription;
|
|
749
|
+
acknowledge(nameOrSlugOrId: string): Promise<void>;
|
|
750
|
+
snooze(nameOrSlugOrId: string, until: string): Promise<void>;
|
|
751
|
+
reject(nameOrSlugOrId: string): Promise<void>;
|
|
752
|
+
disable(nameOrSlugOrId: string): Promise<void>;
|
|
753
|
+
rollback(nameOrSlugOrId: string): Promise<void>;
|
|
754
|
+
promote(nameOrSlugOrId: string, scope: 'user'): Promise<void>;
|
|
755
|
+
review(nameOrSlugOrId: string): Promise<void>;
|
|
756
|
+
trust(nameOrSlugOrId: string): Promise<void>;
|
|
757
|
+
}
|
|
758
|
+
interface ClientCommandInput {
|
|
759
|
+
readonly sessionId: string;
|
|
760
|
+
readonly inputId: string;
|
|
761
|
+
readonly name: string;
|
|
762
|
+
readonly args?: readonly string[];
|
|
763
|
+
}
|
|
764
|
+
type ClientCommandResult = {
|
|
765
|
+
readonly kind: 'completed';
|
|
766
|
+
readonly success: boolean;
|
|
767
|
+
readonly message?: string;
|
|
768
|
+
} | {
|
|
769
|
+
readonly kind: 'started';
|
|
770
|
+
readonly runId: string;
|
|
771
|
+
readonly message?: string;
|
|
772
|
+
};
|
|
773
|
+
interface ClientReviewInput {
|
|
774
|
+
readonly sessionId: string;
|
|
775
|
+
readonly inputId: string;
|
|
776
|
+
readonly args?: readonly string[];
|
|
777
|
+
}
|
|
778
|
+
interface ClientReviewService {
|
|
779
|
+
start(input: ClientReviewInput): Promise<ClientCommandResult>;
|
|
780
|
+
}
|
|
781
|
+
interface ClientCommandService {
|
|
782
|
+
/** Plain editable text only. Reading or cancelling a draft has no execution effects. */
|
|
783
|
+
readPrompt(input: Omit<ClientCommandInput, 'inputId'>): Promise<{
|
|
784
|
+
readonly title: string;
|
|
785
|
+
readonly text: string;
|
|
786
|
+
} | null>;
|
|
787
|
+
/** Execute an existing registered command. Never automatically replay a lost reply. */
|
|
788
|
+
execute(input: ClientCommandInput): Promise<ClientCommandResult>;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/** Display facts only; extension handlers and Host execution types stay private. */
|
|
792
|
+
interface ClientLoadedExtension {
|
|
793
|
+
readonly path: string;
|
|
794
|
+
readonly label: string;
|
|
795
|
+
readonly loadSource: string;
|
|
796
|
+
}
|
|
797
|
+
interface ClientExtensionSource {
|
|
798
|
+
readonly kind: string;
|
|
799
|
+
readonly id?: string;
|
|
800
|
+
readonly label?: string;
|
|
801
|
+
}
|
|
802
|
+
interface ClientExtensionDiagnostics {
|
|
803
|
+
readonly loadedExtensions: readonly ClientLoadedExtension[];
|
|
804
|
+
readonly capabilityProviders: readonly {
|
|
805
|
+
readonly id: string;
|
|
806
|
+
readonly kinds: readonly string[];
|
|
807
|
+
readonly metadata?: Record<string, unknown>;
|
|
808
|
+
}[];
|
|
809
|
+
readonly commands: readonly {
|
|
810
|
+
readonly name: string;
|
|
811
|
+
readonly aliases?: readonly string[];
|
|
812
|
+
readonly description: string;
|
|
813
|
+
}[];
|
|
814
|
+
readonly tools: readonly {
|
|
815
|
+
readonly name: string;
|
|
816
|
+
readonly source: ClientExtensionSource;
|
|
817
|
+
readonly shadowedSources: readonly ClientExtensionSource[];
|
|
818
|
+
}[];
|
|
819
|
+
readonly hooks: readonly {
|
|
820
|
+
readonly hook: string;
|
|
821
|
+
readonly order: number;
|
|
822
|
+
readonly source: ClientExtensionSource;
|
|
823
|
+
}[];
|
|
824
|
+
readonly failures: readonly {
|
|
825
|
+
readonly stage: string;
|
|
826
|
+
readonly target: string;
|
|
827
|
+
readonly message: string;
|
|
828
|
+
readonly source: ClientExtensionSource;
|
|
829
|
+
}[];
|
|
830
|
+
readonly defaults: {
|
|
831
|
+
readonly activeTools?: readonly string[];
|
|
832
|
+
readonly modelSelection: {
|
|
833
|
+
readonly provider?: string;
|
|
834
|
+
readonly model?: string;
|
|
835
|
+
};
|
|
836
|
+
readonly thinkingLevel?: string;
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
interface ClientSession {
|
|
840
|
+
readonly executionCwd?: string;
|
|
841
|
+
/** Active conversation messages, when supplied by a Host read. */
|
|
842
|
+
readonly msgCount?: number;
|
|
843
|
+
readonly id: string;
|
|
844
|
+
readonly archived?: boolean;
|
|
845
|
+
readonly title: string;
|
|
846
|
+
readonly tag?: string;
|
|
847
|
+
readonly gitRoot?: string;
|
|
848
|
+
readonly workspaceRoot?: string;
|
|
849
|
+
readonly branch?: string;
|
|
850
|
+
readonly workspaceKind?: 'detected' | 'managed';
|
|
851
|
+
readonly surface?: string;
|
|
852
|
+
readonly profileId?: string;
|
|
853
|
+
readonly createdAt?: string;
|
|
854
|
+
}
|
|
855
|
+
interface ClientSessionSummary extends ClientSession {
|
|
856
|
+
/** Opaque continuation token for list pagination. */
|
|
857
|
+
readonly cursor?: string;
|
|
858
|
+
readonly msgCount: number;
|
|
859
|
+
readonly tag?: string;
|
|
860
|
+
readonly projectKey?: string;
|
|
861
|
+
readonly archived?: boolean;
|
|
862
|
+
}
|
|
863
|
+
interface ClientSessionFilter {
|
|
864
|
+
readonly projectRoot?: string;
|
|
865
|
+
readonly scope?: 'user' | 'managed-task-worker' | 'all';
|
|
866
|
+
readonly includeArchived?: boolean;
|
|
867
|
+
readonly limit?: number;
|
|
868
|
+
readonly before?: string;
|
|
869
|
+
readonly tag?: string;
|
|
870
|
+
readonly surface?: string;
|
|
871
|
+
readonly cursor?: string;
|
|
872
|
+
}
|
|
873
|
+
interface KodaXProductClient {
|
|
874
|
+
readonly lifecycle: ClientLifecycleService;
|
|
875
|
+
readonly statistics: ClientStatisticsService;
|
|
876
|
+
readonly commands: ClientCommandService;
|
|
877
|
+
readonly review: ClientReviewService;
|
|
878
|
+
readonly memory: ClientMemoryService;
|
|
879
|
+
readonly learning: ClientLearningService;
|
|
880
|
+
readonly host: {
|
|
881
|
+
/** Request an idle Host to shut down. Acceptance does not prove cleanup has completed. */
|
|
882
|
+
shutdown(): Promise<{
|
|
883
|
+
readonly accepted: true;
|
|
884
|
+
}>;
|
|
885
|
+
};
|
|
886
|
+
readonly sessions: {
|
|
887
|
+
cancel(input: ClientSessionCancelInput): Promise<ClientSessionCancelReceipt>;
|
|
888
|
+
compact(sessionId: string, input?: {
|
|
889
|
+
readonly customInstructions?: string;
|
|
890
|
+
}): Promise<ClientCompactSessionResult>;
|
|
891
|
+
create(input?: ClientCreateSessionInput): Promise<ClientSession>;
|
|
892
|
+
list(filter?: ClientSessionFilter): Promise<readonly ClientSessionSummary[]>;
|
|
893
|
+
read(sessionId: string): Promise<ClientSession>;
|
|
894
|
+
delete(sessionId: string): Promise<void>;
|
|
895
|
+
archive(sessionId: string): Promise<void>;
|
|
896
|
+
unarchive(sessionId: string): Promise<void>;
|
|
897
|
+
getSettings(sessionId: string): Promise<ClientSessionSettings>;
|
|
898
|
+
/** Read the Host's existing settings revision for a conditional edit or restoration. */
|
|
899
|
+
getSettingsVersioned(sessionId: string): Promise<ClientSessionSettingsSnapshot>;
|
|
900
|
+
/** Reject with conflict if another settings edit has occurred since expectedRevision. */
|
|
901
|
+
updateSettingsVersioned(sessionId: string, patch: ClientSessionSettingsPatch, options: {
|
|
902
|
+
readonly expectedRevision: number;
|
|
903
|
+
}): Promise<ClientSessionSettingsSnapshot>;
|
|
904
|
+
/** Existing Host Auto reviewer diagnostics; undefined when Auto mode is not selected. */
|
|
905
|
+
getAutoModeStats(sessionId: string): Promise<ClientAutoModeStats | undefined>;
|
|
906
|
+
/** Change this Session only. The next physical request uses the updated selection. */
|
|
907
|
+
updateSettings(sessionId: string, patch: ClientSessionSettingsPatch): Promise<ClientSessionSettings>;
|
|
908
|
+
/** Delivers the current view first, then replacements; no event cursor is needed. */
|
|
909
|
+
observe(sessionId: string, onView: (view: ClientSessionView) => void, options?: ClientObserveOptions): Promise<ClientObservation>;
|
|
910
|
+
/** Read the original content behind a bounded display item. Offsets are UTF-16 characters. */
|
|
911
|
+
readItem(sessionId: string, itemId: string, options?: ClientItemReadOptions): Promise<ClientItemContent | null>;
|
|
912
|
+
/** Newest page of the canonical conversation first; older pages via nextCursor. */
|
|
913
|
+
readHistory(sessionId: string, options?: ClientHistoryReadOptions): Promise<ClientHistoryPage>;
|
|
914
|
+
/** Full body behind one oversized history entry, chunked like readItem. */
|
|
915
|
+
readHistoryEntry(sessionId: string, itemId: string, options?: ClientItemReadOptions): Promise<ClientItemContent | null>;
|
|
916
|
+
/** Search the whole Session history; entryIndex values are stable within the returned revision. */
|
|
917
|
+
searchHistory(sessionId: string, input: ClientHistorySearchInput): Promise<ClientHistorySearchResult>;
|
|
918
|
+
/** Persistent session goal owned by the Host; every client reads the same state. */
|
|
919
|
+
readGoal(sessionId: string): Promise<ClientSessionGoal | null>;
|
|
920
|
+
/** Create a goal; conflicts while a non-complete goal is active. Budget rules are the domain's. */
|
|
921
|
+
createGoal(sessionId: string, input: ClientGoalCreateInput): Promise<ClientSessionGoal>;
|
|
922
|
+
/** Pause an active goal; conflicts from any other status. */
|
|
923
|
+
pauseGoal(sessionId: string): Promise<ClientSessionGoal>;
|
|
924
|
+
/** Resume a paused goal; conflicts from any other status. */
|
|
925
|
+
resumeGoal(sessionId: string): Promise<ClientSessionGoal>;
|
|
926
|
+
/** Clear the current goal; conflicts when no goal exists. */
|
|
927
|
+
clearGoal(sessionId: string): Promise<void>;
|
|
928
|
+
/** Host-owned notice append; UIs never write lineage or session files directly. */
|
|
929
|
+
appendNotice(sessionId: string, input: {
|
|
930
|
+
readonly content: string;
|
|
931
|
+
readonly source?: string;
|
|
932
|
+
}): Promise<void>;
|
|
933
|
+
/** Branch structure owned by the Host; both clients see the same head. Null when the session predates lineage. */
|
|
934
|
+
readLineage(sessionId: string): Promise<ClientLineageSummary | null>;
|
|
935
|
+
/** Label (or unlabel when `label` is omitted) one entry by id or existing label; unknown selectors conflict. */
|
|
936
|
+
labelEntry(sessionId: string, input: ClientLineageLabelInput): Promise<ClientLineageSummary>;
|
|
937
|
+
/** Move the active head to an entry by id or label; stale selectors conflict, never silently no-op. */
|
|
938
|
+
selectBranch(sessionId: string, selector: string, options?: {
|
|
939
|
+
readonly summarizeCurrentBranch?: boolean;
|
|
940
|
+
}): Promise<ClientSession>;
|
|
941
|
+
/** Move the head back to an entry; idle sessions only, and file effects are never rolled back. */
|
|
942
|
+
rewindSession(sessionId: string, input: {
|
|
943
|
+
readonly selector?: string;
|
|
944
|
+
readonly historyBoundary?: ClientHistoryBoundary;
|
|
945
|
+
readonly expectedHead: string | null;
|
|
946
|
+
}): Promise<ClientSession>;
|
|
947
|
+
/** Derive a new Session from this idle session's history; the source stays unchanged. */
|
|
948
|
+
forkSession(sessionId: string, input?: ClientSessionForkInput): Promise<ClientSession>;
|
|
949
|
+
/** Derive a new Session from a deterministic recovery seed (no LLM call); continue with a normal input submit. */
|
|
950
|
+
recoverSession(sessionId: string, input?: ClientSessionRecoverInput): Promise<ClientSession>;
|
|
951
|
+
};
|
|
952
|
+
readonly inputs: {
|
|
953
|
+
submit(input: ClientSubmitInput): Promise<ClientInputAcceptance>;
|
|
954
|
+
read(sessionId: string, inputId: string): Promise<ClientInputAcceptance | null>;
|
|
955
|
+
withdraw(sessionId: string, inputId: string): Promise<ClientSubmitInput>;
|
|
956
|
+
};
|
|
957
|
+
readonly runs: {
|
|
958
|
+
/** Explicit tool execution through the Host's ordinary tool gates, without a model prompt. */
|
|
959
|
+
startTool(input: ClientToolInvocationInput): Promise<{
|
|
960
|
+
readonly runId: string;
|
|
961
|
+
readonly sessionId: string;
|
|
962
|
+
}>;
|
|
963
|
+
/** Current lifecycle facts of one Run; internal stages stay internal. */
|
|
964
|
+
read(runId: string): Promise<ClientRunStatus>;
|
|
965
|
+
/** Request a stop; accepted only means the durable Stop request was created. */
|
|
966
|
+
stop(runId: string): Promise<ClientRunStopReceipt>;
|
|
967
|
+
/** Resolve at a terminal phase; `unknown` means the outcome could not be confirmed, never success. */
|
|
968
|
+
await(runId: string): Promise<ClientRunOutcome>;
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* FEATURE_298 T22 — Host-owned workflow control. `start` takes a declarative
|
|
972
|
+
* source (validated/resolved inside the Host, never a prepared module), so
|
|
973
|
+
* every client of the same Host observes and controls the same work.
|
|
974
|
+
*/
|
|
975
|
+
readonly workflows: {
|
|
976
|
+
start(input: ClientWorkflowStartInput): Promise<ClientWorkflowStartResult>;
|
|
977
|
+
list(filter?: {
|
|
978
|
+
readonly runId?: string;
|
|
979
|
+
readonly limit?: number;
|
|
980
|
+
}): Promise<readonly ClientWorkflowRun[]>;
|
|
981
|
+
get(runId: string): Promise<ClientWorkflowProcess | undefined>;
|
|
982
|
+
/** Existing Host process events; subscriptions carry facts, never executable workflow modules. */
|
|
983
|
+
/** Terminates on transport failure; rebuild, await ready, then read a snapshot. */
|
|
984
|
+
subscribe(filter: {
|
|
985
|
+
readonly runId?: string;
|
|
986
|
+
}, listener: (event: ClientWorkflowEvent) => void, onError?: (error: unknown) => void): {
|
|
987
|
+
readonly ready: Promise<void>;
|
|
988
|
+
close(): void;
|
|
989
|
+
};
|
|
990
|
+
pause(runId: string): Promise<boolean>;
|
|
991
|
+
resume(runId: string): Promise<boolean>;
|
|
992
|
+
stop(runId: string, options?: {
|
|
993
|
+
readonly sessionId: string;
|
|
994
|
+
}): Promise<boolean>;
|
|
995
|
+
};
|
|
996
|
+
readonly interactions: {
|
|
997
|
+
/** Answers the Host is currently waiting for. */
|
|
998
|
+
list(filter?: {
|
|
999
|
+
readonly sessionId?: string;
|
|
1000
|
+
}): Promise<readonly ClientInteraction[]>;
|
|
1001
|
+
/** Precise request ID + typed response; only the first valid answer counts. */
|
|
1002
|
+
respond(requestId: string, response: ClientInteractionResponse): Promise<ClientInteractionResult>;
|
|
1003
|
+
};
|
|
1004
|
+
readonly permissions: {
|
|
1005
|
+
/** Effective explicit grants; every client sees the same revision. */
|
|
1006
|
+
listGrants(): Promise<ClientPermissionGrants>;
|
|
1007
|
+
/** Revoke exactly one grant by its domain identity; the revision must match. */
|
|
1008
|
+
revokeGrant(grantId: string, expectedRevision: number): Promise<boolean>;
|
|
1009
|
+
};
|
|
1010
|
+
/**
|
|
1011
|
+
* FEATURE_298 T30 — Host-owned external Agent registry. Mutations use the
|
|
1012
|
+
* registry's own domain identity (configuration revision CAS, management
|
|
1013
|
+
* ownership), never a generic operation envelope.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly registrations: {
|
|
1016
|
+
list(): Promise<readonly ExternalAgentRegistrationSummary[]>;
|
|
1017
|
+
upsert(registration: ExternalAgentRegistration, options?: AgentRegistrationMutationOptions): Promise<ExternalAgentRegistrationSummary>;
|
|
1018
|
+
setEnabled(agentId: string, enabled: boolean, options?: AgentRegistrationEnabledMutationOptions): Promise<ExternalAgentRegistrationSummary | undefined>;
|
|
1019
|
+
remove(agentId: string, options?: AgentRegistrationMutationOptions): Promise<boolean>;
|
|
1020
|
+
};
|
|
1021
|
+
/**
|
|
1022
|
+
* FEATURE_298 T30 — collaboration control over the Host's Session Actors.
|
|
1023
|
+
* Reads return the actual domain objects; `wait` resolves one Agent event.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly agents: {
|
|
1026
|
+
reviewLean(input: Omit<ClientReviewInput, 'args'>): Promise<ClientCommandResult>;
|
|
1027
|
+
tree(sessionId: string): Promise<AgentTreeSnapshot>;
|
|
1028
|
+
detail(sessionId: string, actorPath: string): Promise<AgentDetail>;
|
|
1029
|
+
spawn(sessionId: string, input: AgentSpawnInput): Promise<AgentTurnRef>;
|
|
1030
|
+
send(sessionId: string, actorPath: string, content: string, classification?: AgentDataClassification): Promise<void>;
|
|
1031
|
+
followup(sessionId: string, actorPath: string, objective: string, options?: {
|
|
1032
|
+
readonly expectedRevision?: number;
|
|
1033
|
+
}): Promise<AgentFollowupResult>;
|
|
1034
|
+
interrupt(sessionId: string, actorPath: string, reason?: string): Promise<void>;
|
|
1035
|
+
output(sessionId: string, actorPath: string, turnId?: string): Promise<AgentOutput>;
|
|
1036
|
+
wait(sessionId: string, afterSequence?: number, timeoutMs?: number, options?: {
|
|
1037
|
+
readonly signal?: AbortSignal;
|
|
1038
|
+
}): Promise<AgentEvent | undefined>;
|
|
1039
|
+
};
|
|
1040
|
+
readonly config: {
|
|
1041
|
+
/** Saved user defaults. Session overrides remain independent. */
|
|
1042
|
+
read(): Promise<ClientConfig>;
|
|
1043
|
+
/** Live execution controls only; never exposes credentials or arbitrary environment. */
|
|
1044
|
+
readEffective(): Promise<ClientEffectiveExecutionConfig>;
|
|
1045
|
+
/** Omitted keys stay unchanged; null clears a saved default. */
|
|
1046
|
+
patch(patch: {
|
|
1047
|
+
[K in keyof ClientConfig]?: ClientConfig[K] | null;
|
|
1048
|
+
}): Promise<ClientConfig>;
|
|
1049
|
+
reload(): Promise<{
|
|
1050
|
+
readonly ok: true;
|
|
1051
|
+
readonly config: ClientConfig;
|
|
1052
|
+
}>;
|
|
1053
|
+
};
|
|
1054
|
+
readonly catalog: {
|
|
1055
|
+
extensions(): Promise<{
|
|
1056
|
+
readonly active: boolean;
|
|
1057
|
+
readonly extensions: readonly ClientLoadedExtension[];
|
|
1058
|
+
readonly diagnostics?: ClientExtensionDiagnostics;
|
|
1059
|
+
}>;
|
|
1060
|
+
providers(): Promise<readonly ClientProviderInfo[]>;
|
|
1061
|
+
models(filter?: {
|
|
1062
|
+
readonly provider?: string;
|
|
1063
|
+
}): Promise<readonly ClientModelCatalog[]>;
|
|
1064
|
+
reasoningEfforts(input: ClientModelSelection): Promise<readonly string[]>;
|
|
1065
|
+
/** Explicitly sends minimal Provider requests; never runs during connect or discovery. */
|
|
1066
|
+
probeReasoningEfforts(input: ClientModelSelection & {
|
|
1067
|
+
readonly efforts: readonly string[];
|
|
1068
|
+
}): Promise<readonly ClientCapabilityProbeResult[]>;
|
|
1069
|
+
forgetCapabilities(input?: {
|
|
1070
|
+
readonly provider?: string;
|
|
1071
|
+
readonly model?: string;
|
|
1072
|
+
}): Promise<void>;
|
|
1073
|
+
/**
|
|
1074
|
+
* Slash commands visible for a workspace. `source` is where the Host
|
|
1075
|
+
* resolved the command from — one of the registry origins ("builtin",
|
|
1076
|
+
* "user", "project", "learned", "extension") — reported as a string so
|
|
1077
|
+
* the contract stays forward-compatible with new origins.
|
|
1078
|
+
*/
|
|
1079
|
+
commands(workspaceRoot: string): Promise<readonly ClientCommandInfo[]>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Skills the Host can invoke. `source` uses the same registry-origin
|
|
1082
|
+
* vocabulary as `commands`; see {@link ClientSkillInfo}.
|
|
1083
|
+
*/
|
|
1084
|
+
skills(input?: {
|
|
1085
|
+
readonly userInvocableOnly?: boolean;
|
|
1086
|
+
}): Promise<readonly ClientSkillInfo[]>;
|
|
1087
|
+
};
|
|
1088
|
+
readonly mcp: {
|
|
1089
|
+
/** Current Host diagnostics; never connects or refreshes a server. */
|
|
1090
|
+
status(): Promise<readonly ClientMcpServerStatus[]>;
|
|
1091
|
+
listServers(): Promise<Readonly<Record<string, ClientMcpServerConfig>>>;
|
|
1092
|
+
getServer(name: string): Promise<ClientMcpServerConfig | undefined>;
|
|
1093
|
+
validateServer(name: string, config: unknown): Promise<{
|
|
1094
|
+
readonly ok: true;
|
|
1095
|
+
readonly config: ClientMcpServerConfig;
|
|
1096
|
+
} | {
|
|
1097
|
+
readonly ok: false;
|
|
1098
|
+
readonly error: string;
|
|
1099
|
+
}>;
|
|
1100
|
+
upsertServer(name: string, config: ClientMcpServerConfig): Promise<ClientMcpServerConfig>;
|
|
1101
|
+
deleteServer(name: string): Promise<boolean>;
|
|
1102
|
+
reloadServers(): Promise<{
|
|
1103
|
+
readonly ok: true;
|
|
1104
|
+
readonly servers: readonly ClientMcpServerStatus[];
|
|
1105
|
+
}>;
|
|
1106
|
+
listTools(filter?: {
|
|
1107
|
+
readonly server?: string;
|
|
1108
|
+
readonly forceRefresh?: boolean;
|
|
1109
|
+
}): Promise<readonly {
|
|
1110
|
+
readonly serverId: string;
|
|
1111
|
+
readonly tools: readonly ClientMcpTool[];
|
|
1112
|
+
readonly cachedAt?: string;
|
|
1113
|
+
}[]>;
|
|
1114
|
+
};
|
|
1115
|
+
/** Release this connection. The Host and its work retain their own lifetime. */
|
|
1116
|
+
disconnect(): Promise<void>;
|
|
1117
|
+
}
|
|
1118
|
+
interface ClientObservation {
|
|
1119
|
+
close(): void;
|
|
1120
|
+
}
|
|
1121
|
+
type ClientObservationStatus = {
|
|
1122
|
+
readonly state: 'live';
|
|
1123
|
+
} | {
|
|
1124
|
+
readonly state: 'interrupted';
|
|
1125
|
+
readonly message?: string;
|
|
1126
|
+
} | {
|
|
1127
|
+
readonly state: 'closed';
|
|
1128
|
+
readonly reason: 'client' | 'unavailable';
|
|
1129
|
+
readonly message?: string;
|
|
1130
|
+
};
|
|
1131
|
+
interface ClientObserveOptions {
|
|
1132
|
+
/** Live is emitted only after delivery of a complete current view. */
|
|
1133
|
+
readonly onStatus?: (status: ClientObservationStatus) => void;
|
|
1134
|
+
}
|
|
1135
|
+
interface ClientModelSelection {
|
|
1136
|
+
readonly provider: string;
|
|
1137
|
+
readonly model?: string;
|
|
1138
|
+
}
|
|
1139
|
+
interface ClientModelCatalog {
|
|
1140
|
+
readonly provider: string;
|
|
1141
|
+
readonly models: readonly string[];
|
|
1142
|
+
}
|
|
1143
|
+
/** `source`: registry origin — "builtin" | "user" | "project" | "learned" | "extension". */
|
|
1144
|
+
interface ClientCommandInfo {
|
|
1145
|
+
readonly name: string;
|
|
1146
|
+
readonly aliases?: readonly string[];
|
|
1147
|
+
readonly description: string;
|
|
1148
|
+
/** Where the Host discovered the command (builtin/project/extension/...). */
|
|
1149
|
+
readonly source: string;
|
|
1150
|
+
readonly userInvocable?: boolean;
|
|
1151
|
+
}
|
|
1152
|
+
/** `source`: same registry-origin vocabulary as ClientCommandInfo. */
|
|
1153
|
+
interface ClientSkillInfo {
|
|
1154
|
+
readonly name: string;
|
|
1155
|
+
readonly description: string;
|
|
1156
|
+
readonly userInvocable: boolean;
|
|
1157
|
+
readonly path: string;
|
|
1158
|
+
/** Where the Host discovered the Skill (builtin/user/project/...). */
|
|
1159
|
+
readonly source: string;
|
|
1160
|
+
}
|
|
1161
|
+
interface ClientProviderInfo {
|
|
1162
|
+
readonly name: string;
|
|
1163
|
+
readonly model: string;
|
|
1164
|
+
readonly models: readonly string[];
|
|
1165
|
+
readonly configured: boolean;
|
|
1166
|
+
readonly source: 'builtin' | 'config' | 'runtime';
|
|
1167
|
+
readonly reasoningCapability: string;
|
|
1168
|
+
readonly capabilityProfile: {
|
|
1169
|
+
readonly transport: 'native-api' | 'cli-bridge';
|
|
1170
|
+
readonly conversationSemantics: 'full-history' | 'last-user-message';
|
|
1171
|
+
readonly mcpSupport: 'native' | 'none';
|
|
1172
|
+
readonly contextFidelity?: 'full' | 'partial' | 'lossy';
|
|
1173
|
+
readonly toolCallingFidelity?: 'full' | 'limited' | 'none';
|
|
1174
|
+
readonly sessionSupport?: 'full' | 'limited' | 'stateless';
|
|
1175
|
+
readonly longRunningSupport?: 'full' | 'limited' | 'none';
|
|
1176
|
+
readonly multimodalSupport?: 'none' | 'image-input' | 'full';
|
|
1177
|
+
readonly evidenceSupport?: 'full' | 'limited' | 'none';
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
interface ClientMcpTool {
|
|
1181
|
+
readonly id: string;
|
|
1182
|
+
readonly serverId: string;
|
|
1183
|
+
readonly name: string;
|
|
1184
|
+
readonly title?: string;
|
|
1185
|
+
readonly summary: string;
|
|
1186
|
+
readonly cachedAt: string;
|
|
1187
|
+
readonly inputSchema?: unknown;
|
|
1188
|
+
readonly outputSchema?: unknown;
|
|
1189
|
+
readonly annotations?: Readonly<Record<string, unknown>>;
|
|
1190
|
+
readonly risk?: 'read' | 'write' | 'network' | 'exec';
|
|
1191
|
+
readonly taskSupport?: 'forbidden' | 'optional' | 'required';
|
|
1192
|
+
}
|
|
1193
|
+
interface ClientCapabilityProbeResult {
|
|
1194
|
+
readonly effort: string;
|
|
1195
|
+
readonly status: 'accepted' | 'rejected' | 'error';
|
|
1196
|
+
readonly error?: string;
|
|
1197
|
+
}
|
|
1198
|
+
interface ClientItemReadOptions {
|
|
1199
|
+
readonly offset?: number;
|
|
1200
|
+
readonly part?: 'text' | 'input';
|
|
1201
|
+
}
|
|
1202
|
+
/** Paging over a Session's canonical conversation history. */
|
|
1203
|
+
interface ClientHistoryReadOptions {
|
|
1204
|
+
/** Cursor from a previous page's nextCursor; omit to read the newest page. */
|
|
1205
|
+
readonly cursor?: string;
|
|
1206
|
+
readonly limit?: number;
|
|
1207
|
+
}
|
|
1208
|
+
interface ClientHistoryPage {
|
|
1209
|
+
/** This page's entries projected like view items, oldest first. */
|
|
1210
|
+
readonly items: readonly ClientViewItem[];
|
|
1211
|
+
/** Conversation revision this page was read at. */
|
|
1212
|
+
readonly revision: string;
|
|
1213
|
+
/** Canonical storage revision used by operation boundaries; distinct from the page revision. */
|
|
1214
|
+
readonly sourceRevision: string;
|
|
1215
|
+
readonly status: 'resolved' | 'partial' | 'ambiguous';
|
|
1216
|
+
readonly issues: readonly ClientHistoryIssue[];
|
|
1217
|
+
/** Cursor of the next older page; absent when this is the oldest page. */
|
|
1218
|
+
readonly nextCursor?: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Entries too large to inline as items. Read the full body by itemId with
|
|
1221
|
+
* readHistoryEntry; the page never substitutes a truncated preview.
|
|
1222
|
+
*/
|
|
1223
|
+
readonly oversized: readonly {
|
|
1224
|
+
readonly itemId: string;
|
|
1225
|
+
readonly byteLength: number;
|
|
1226
|
+
}[];
|
|
1227
|
+
}
|
|
1228
|
+
/** Durable, client-scoped exit control; receipt acceptance is separate from verified outcomes. */
|
|
1229
|
+
interface ClientLifecycleService {
|
|
1230
|
+
requestExit(input: {
|
|
1231
|
+
readonly requestId: string;
|
|
1232
|
+
readonly shutdownHost?: boolean;
|
|
1233
|
+
}): Promise<ClientExitReceipt>;
|
|
1234
|
+
readExit(requestId: string): Promise<ClientExitReceipt | null>;
|
|
1235
|
+
listPendingExits(): Promise<readonly ClientExitReceipt[]>;
|
|
1236
|
+
}
|
|
1237
|
+
type ClientExecutionTarget = {
|
|
1238
|
+
readonly kind: 'run';
|
|
1239
|
+
readonly runId: string;
|
|
1240
|
+
} | {
|
|
1241
|
+
readonly kind: 'actor_turn';
|
|
1242
|
+
readonly actorPath: string;
|
|
1243
|
+
readonly turnId: string;
|
|
1244
|
+
readonly parentRunId?: string;
|
|
1245
|
+
} | {
|
|
1246
|
+
readonly kind: 'operation';
|
|
1247
|
+
readonly operationId: string;
|
|
1248
|
+
readonly operation: 'session.compact';
|
|
1249
|
+
};
|
|
1250
|
+
interface ClientUsageTotals {
|
|
1251
|
+
readonly inputTokens: number;
|
|
1252
|
+
readonly outputTokens: number;
|
|
1253
|
+
readonly totalTokens: number;
|
|
1254
|
+
readonly cacheReadTokens: number;
|
|
1255
|
+
readonly cacheWriteTokens: number;
|
|
1256
|
+
readonly thoughtTokens: number;
|
|
1257
|
+
}
|
|
1258
|
+
interface ClientProviderRequestFact extends Omit<ProviderRequestObservation, 'state'> {
|
|
1259
|
+
readonly state: ProviderRequestObservation['state'] | 'unknown';
|
|
1260
|
+
readonly revision: number;
|
|
1261
|
+
readonly sessionId: string;
|
|
1262
|
+
readonly runtimeId: string;
|
|
1263
|
+
readonly target: ClientExecutionTarget;
|
|
1264
|
+
readonly previousRequestId?: string;
|
|
1265
|
+
readonly fallback: boolean;
|
|
1266
|
+
/** Restart recovery only marks an unfinished request unknown; it never invents usage. */
|
|
1267
|
+
readonly recovery?: 'outcome_unknown';
|
|
1268
|
+
}
|
|
1269
|
+
interface ClientToolExecutionFact {
|
|
1270
|
+
readonly id: string;
|
|
1271
|
+
readonly revision: number;
|
|
1272
|
+
readonly toolId: string;
|
|
1273
|
+
readonly name: string;
|
|
1274
|
+
readonly sessionId: string;
|
|
1275
|
+
readonly runtimeId: string;
|
|
1276
|
+
readonly target: ClientExecutionTarget;
|
|
1277
|
+
readonly state: 'prepared' | 'executing' | 'completed' | 'not_executed' | 'unknown';
|
|
1278
|
+
readonly result?: 'succeeded' | 'failed' | 'cancelled';
|
|
1279
|
+
readonly updatedAt: string;
|
|
1280
|
+
/** Actual adapter observations, in order. Empty means the backend was not reported. */
|
|
1281
|
+
readonly sandbox: readonly KodaXShellSandboxObservation[];
|
|
1282
|
+
}
|
|
1283
|
+
interface ClientExecutionFactsPage<T> {
|
|
1284
|
+
readonly revision: number;
|
|
1285
|
+
readonly items: readonly T[];
|
|
1286
|
+
readonly nextCursor?: string;
|
|
1287
|
+
}
|
|
1288
|
+
/** Last request-preparation estimate for a context, retained across disconnect and restart. */
|
|
1289
|
+
interface ClientContextBudgetFact extends RuntimeContextBudgetSnapshot {
|
|
1290
|
+
readonly runtimeId: string;
|
|
1291
|
+
readonly revision: number;
|
|
1292
|
+
readonly target: ClientExecutionTarget;
|
|
1293
|
+
readonly contextRevision?: number;
|
|
1294
|
+
}
|
|
1295
|
+
interface ClientStatisticsService {
|
|
1296
|
+
read(sessionId: string): Promise<{
|
|
1297
|
+
readonly sessionId: string;
|
|
1298
|
+
readonly revision: number;
|
|
1299
|
+
readonly coverage: 'complete' | 'partial';
|
|
1300
|
+
readonly issues: readonly string[];
|
|
1301
|
+
readonly usage: ClientUsageTotals;
|
|
1302
|
+
readonly requestCount: number;
|
|
1303
|
+
readonly requestsWithoutUsage: number;
|
|
1304
|
+
readonly physicalRequestCount: number;
|
|
1305
|
+
readonly operationCount: number;
|
|
1306
|
+
readonly contexts: readonly ClientContextBudgetFact[];
|
|
1307
|
+
}>;
|
|
1308
|
+
readRequests(sessionId: string, options?: {
|
|
1309
|
+
readonly cursor?: string;
|
|
1310
|
+
readonly limit?: number;
|
|
1311
|
+
}): Promise<ClientExecutionFactsPage<ClientProviderRequestFact>>;
|
|
1312
|
+
readTools(sessionId: string, options?: {
|
|
1313
|
+
readonly cursor?: string;
|
|
1314
|
+
readonly limit?: number;
|
|
1315
|
+
}): Promise<ClientExecutionFactsPage<ClientToolExecutionFact>>;
|
|
1316
|
+
}
|
|
1317
|
+
interface ClientExitReceipt {
|
|
1318
|
+
readonly requestId: string;
|
|
1319
|
+
readonly clientId: string;
|
|
1320
|
+
readonly runtimeId: string;
|
|
1321
|
+
readonly accepted: true;
|
|
1322
|
+
readonly requestedAt: string;
|
|
1323
|
+
readonly updatedAt: string;
|
|
1324
|
+
readonly cleanup: {
|
|
1325
|
+
readonly actorTurns: readonly {
|
|
1326
|
+
readonly actorPath: string;
|
|
1327
|
+
readonly turnId: string;
|
|
1328
|
+
}[];
|
|
1329
|
+
readonly operationIds: readonly string[];
|
|
1330
|
+
readonly state: 'pending' | 'succeeded' | 'unknown' | 'failed';
|
|
1331
|
+
readonly runIds: readonly string[];
|
|
1332
|
+
readonly withdrawnInputs: readonly {
|
|
1333
|
+
readonly sessionId: string;
|
|
1334
|
+
readonly inputId: string;
|
|
1335
|
+
}[];
|
|
1336
|
+
readonly issues: readonly string[];
|
|
1337
|
+
};
|
|
1338
|
+
readonly host: {
|
|
1339
|
+
readonly requested: boolean;
|
|
1340
|
+
readonly state: 'not_requested' | 'pending' | 'protected' | 'accepted' | 'succeeded' | 'failed' | 'unknown';
|
|
1341
|
+
readonly owner: {
|
|
1342
|
+
readonly runtimeId: string;
|
|
1343
|
+
readonly pid: number;
|
|
1344
|
+
readonly kind?: 'daemon' | 'inline';
|
|
1345
|
+
readonly processStartIdentity?: string;
|
|
1346
|
+
readonly processContainment?: 'windows-job';
|
|
1347
|
+
readonly supervisorPid?: number;
|
|
1348
|
+
readonly supervisorProcessStartIdentity?: string;
|
|
1349
|
+
};
|
|
1350
|
+
readonly cleanup?: 'succeeded' | 'failed';
|
|
1351
|
+
readonly message?: string;
|
|
1352
|
+
readonly replacementRunning?: boolean;
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
/** Host-issued canonical boundary. Pass it back unchanged; never derive it from an item ID. */
|
|
1356
|
+
interface ClientHistoryBoundary {
|
|
1357
|
+
readonly entryId: string;
|
|
1358
|
+
readonly sourceRevision: string;
|
|
1359
|
+
}
|
|
1360
|
+
interface ClientHistoryIssue {
|
|
1361
|
+
readonly code: string;
|
|
1362
|
+
readonly message: string;
|
|
1363
|
+
readonly occurrenceCount: number;
|
|
1364
|
+
readonly entryCount: number;
|
|
1365
|
+
readonly entryIds: readonly string[];
|
|
1366
|
+
}
|
|
1367
|
+
interface ClientHistorySearchInput {
|
|
1368
|
+
readonly query: string;
|
|
1369
|
+
readonly limit?: number;
|
|
1370
|
+
readonly role?: 'user' | 'assistant';
|
|
1371
|
+
/** 'all' (default) searches active and compacted history; 'compacted' only the compacted tail. */
|
|
1372
|
+
readonly scope?: 'all' | 'compacted';
|
|
1373
|
+
}
|
|
1374
|
+
/** The domain's persistent goal state, written only by Host commands. */
|
|
1375
|
+
type ClientSessionGoal = KodaXGoalState;
|
|
1376
|
+
interface ClientGoalCreateInput {
|
|
1377
|
+
readonly objective: string;
|
|
1378
|
+
/** Optional hard token ceiling; the domain validates positive integers. */
|
|
1379
|
+
readonly tokenBudget?: number;
|
|
1380
|
+
}
|
|
1381
|
+
/** Lineage facts with a bounded text preview; raw messages stay in the Host. */
|
|
1382
|
+
interface ClientLineageEntry {
|
|
1383
|
+
readonly id: string;
|
|
1384
|
+
readonly parentId: string | null;
|
|
1385
|
+
readonly type: KodaXSessionEntry['type'];
|
|
1386
|
+
readonly timestamp: string;
|
|
1387
|
+
readonly role?: 'user' | 'assistant' | 'system' | 'tool';
|
|
1388
|
+
/** Bounded content hint, never a substitute for history/readItem. */
|
|
1389
|
+
readonly preview?: string;
|
|
1390
|
+
/** Present on label entries: the labeled target entry. */
|
|
1391
|
+
readonly targetId?: string;
|
|
1392
|
+
/** Present on label entries; absent means the label was removed. */
|
|
1393
|
+
readonly label?: string;
|
|
1394
|
+
/** Present on rewind markers: how many entries left the active branch. */
|
|
1395
|
+
readonly truncatedCount?: number;
|
|
1396
|
+
}
|
|
1397
|
+
interface ClientLineageSummary {
|
|
1398
|
+
readonly activeEntryId: string | null;
|
|
1399
|
+
readonly entries: readonly ClientLineageEntry[];
|
|
1400
|
+
}
|
|
1401
|
+
interface ClientLineageLabelInput {
|
|
1402
|
+
/** Entry id or an existing label name. */
|
|
1403
|
+
readonly selector: string;
|
|
1404
|
+
/** Omit to remove the target's label. */
|
|
1405
|
+
readonly label?: string;
|
|
1406
|
+
}
|
|
1407
|
+
interface ClientSessionForkInput {
|
|
1408
|
+
/** Exclude the boundary message when deriving Retry; requires historyBoundary. */
|
|
1409
|
+
readonly before?: boolean;
|
|
1410
|
+
/** Entry id or label naming the boundary; defaults to the active head. */
|
|
1411
|
+
readonly selector?: string;
|
|
1412
|
+
/** Explicit conversation-history boundary; stale revisions surface as resync_required. */
|
|
1413
|
+
readonly historyBoundary?: ClientHistoryBoundary;
|
|
1414
|
+
readonly title?: string;
|
|
1415
|
+
}
|
|
1416
|
+
interface ClientSessionRecoverInput {
|
|
1417
|
+
readonly title?: string;
|
|
1418
|
+
/** Free-form reason recorded in the seed header. */
|
|
1419
|
+
readonly reason?: string;
|
|
1420
|
+
}
|
|
1421
|
+
interface ClientHistorySearchResult {
|
|
1422
|
+
readonly revision: string;
|
|
1423
|
+
readonly hits: readonly {
|
|
1424
|
+
/** Opaque reference readable through readHistoryEntry; expired snapshots require a new search. */
|
|
1425
|
+
readonly itemId: string;
|
|
1426
|
+
/** Stable within this revision; indexes the transcript at that revision. */
|
|
1427
|
+
readonly entryIndex: number;
|
|
1428
|
+
readonly role: 'user' | 'assistant';
|
|
1429
|
+
readonly timestamp?: string;
|
|
1430
|
+
readonly snippet: string;
|
|
1431
|
+
}[];
|
|
1432
|
+
}
|
|
1433
|
+
interface ClientItemContent {
|
|
1434
|
+
readonly outputState?: 'draft' | 'committed';
|
|
1435
|
+
/** Same revision and outputState as the observed item, for frozen reads. */
|
|
1436
|
+
readonly textRevision?: number;
|
|
1437
|
+
readonly id: string;
|
|
1438
|
+
readonly text: string;
|
|
1439
|
+
readonly offset: number;
|
|
1440
|
+
readonly totalLength: number;
|
|
1441
|
+
readonly nextOffset?: number;
|
|
1442
|
+
}
|
|
1443
|
+
interface ClientSessionView {
|
|
1444
|
+
/** Effective configuration for the current parent selection; not a physical request receipt. */
|
|
1445
|
+
readonly contextBudget?: ClientContextBudget;
|
|
1446
|
+
/** Host estimate of the saved parent context, available without a live Run. */
|
|
1447
|
+
readonly parentContextTokens?: number;
|
|
1448
|
+
readonly activity?: ClientSessionActivity;
|
|
1449
|
+
readonly queue: readonly ClientQueuedInput[];
|
|
1450
|
+
readonly session: ClientSession;
|
|
1451
|
+
readonly items: readonly ClientViewItem[];
|
|
1452
|
+
/** Effective Host profile values plus Session overrides; getSettings/updateSettings retain raw overrides. */
|
|
1453
|
+
readonly settings: ClientSessionSettings;
|
|
1454
|
+
/** Pending answers in this Session; all observers see the same identities. */
|
|
1455
|
+
readonly interactions: readonly ClientInteraction[];
|
|
1456
|
+
readonly runs: readonly {
|
|
1457
|
+
readonly runId: string;
|
|
1458
|
+
readonly phase: string;
|
|
1459
|
+
readonly provider: string;
|
|
1460
|
+
readonly model?: string;
|
|
1461
|
+
readonly error?: string;
|
|
1462
|
+
}[];
|
|
1463
|
+
}
|
|
1464
|
+
interface ClientContextBudget {
|
|
1465
|
+
readonly scope: 'parent' | 'worker';
|
|
1466
|
+
readonly provider: string;
|
|
1467
|
+
readonly model: string;
|
|
1468
|
+
readonly contextWindow: number;
|
|
1469
|
+
readonly reservedResponseTokens: number;
|
|
1470
|
+
readonly reservedMemoryTokens?: number;
|
|
1471
|
+
readonly contextId?: string;
|
|
1472
|
+
readonly compaction: {
|
|
1473
|
+
readonly enabled: true;
|
|
1474
|
+
readonly triggerPercent: number;
|
|
1475
|
+
readonly absoluteTriggerTokens?: number;
|
|
1476
|
+
/** Present only when execution has supplied its Memory and provider-envelope capacity. */
|
|
1477
|
+
readonly triggerTokens?: number;
|
|
1478
|
+
readonly physicalCapacityTokens?: number;
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
/** Display facts for the latest Run; worker context is distinct from parent context. */
|
|
1482
|
+
interface ClientSessionActivity {
|
|
1483
|
+
/** Transient request progress; never saved as conversation history or partial tool arguments. */
|
|
1484
|
+
readonly streaming?: {
|
|
1485
|
+
readonly kind: 'thinking';
|
|
1486
|
+
readonly providerRequestId: string;
|
|
1487
|
+
readonly itemId: string;
|
|
1488
|
+
readonly charCount: number;
|
|
1489
|
+
/** Host estimate for the current request's visible thinking, not Provider usage. */
|
|
1490
|
+
readonly estimatedTokenCount?: number;
|
|
1491
|
+
} | {
|
|
1492
|
+
readonly kind: 'tool-input';
|
|
1493
|
+
readonly providerRequestId: string;
|
|
1494
|
+
readonly toolName: string;
|
|
1495
|
+
readonly callId?: string;
|
|
1496
|
+
/** Cumulative characters for this call; absent when the Provider supplied no call identity. */
|
|
1497
|
+
readonly charCount?: number;
|
|
1498
|
+
};
|
|
1499
|
+
readonly workflow?: ClientWorkflowProcess;
|
|
1500
|
+
/** Latest execution budget, whose model and scope may differ from the current Session selection. */
|
|
1501
|
+
readonly contextBudget?: ClientContextBudget;
|
|
1502
|
+
readonly runId: string;
|
|
1503
|
+
readonly costReport?: string;
|
|
1504
|
+
readonly children?: readonly {
|
|
1505
|
+
readonly id: string;
|
|
1506
|
+
readonly label: string;
|
|
1507
|
+
readonly source: 'workflow' | 'normal';
|
|
1508
|
+
readonly kind: 'assistant' | 'thinking' | 'tool' | 'progress' | 'prompt' | 'stream';
|
|
1509
|
+
readonly detail: string;
|
|
1510
|
+
readonly status: 'running' | 'completed';
|
|
1511
|
+
readonly startedAt: number;
|
|
1512
|
+
}[];
|
|
1513
|
+
readonly managedTask?: {
|
|
1514
|
+
readonly childFanoutClass?: 'finding-validation' | 'module-triage' | 'evidence-scan' | 'hypothesis-check';
|
|
1515
|
+
readonly harnessProfile?: string;
|
|
1516
|
+
readonly globalWorkBudget?: number;
|
|
1517
|
+
readonly budgetUsage?: number;
|
|
1518
|
+
readonly budgetApprovalRequired?: boolean;
|
|
1519
|
+
readonly phase?: string;
|
|
1520
|
+
readonly workerId?: string;
|
|
1521
|
+
readonly workerTitle?: string;
|
|
1522
|
+
readonly breadcrumb?: string;
|
|
1523
|
+
readonly expandedBreadcrumb?: string;
|
|
1524
|
+
readonly round?: number;
|
|
1525
|
+
readonly maximumRounds?: number;
|
|
1526
|
+
readonly idleWaiting: boolean;
|
|
1527
|
+
readonly pendingChildren?: number;
|
|
1528
|
+
readonly fanoutCount?: number;
|
|
1529
|
+
};
|
|
1530
|
+
readonly compacting?: boolean;
|
|
1531
|
+
readonly iteration?: {
|
|
1532
|
+
readonly current: number;
|
|
1533
|
+
readonly maximum: number;
|
|
1534
|
+
};
|
|
1535
|
+
readonly context?: {
|
|
1536
|
+
readonly tokenCount: number;
|
|
1537
|
+
readonly tokenSource: 'api' | 'estimate';
|
|
1538
|
+
readonly scope: 'parent' | 'worker';
|
|
1539
|
+
};
|
|
1540
|
+
/** Latest root iteration/compaction fact; child events never overwrite it. */
|
|
1541
|
+
readonly parentContextTokens?: number;
|
|
1542
|
+
readonly usage?: {
|
|
1543
|
+
readonly inputTokens: number;
|
|
1544
|
+
readonly outputTokens: number;
|
|
1545
|
+
readonly totalTokens: number;
|
|
1546
|
+
readonly cacheReadTokens?: number;
|
|
1547
|
+
readonly cacheWriteTokens?: number;
|
|
1548
|
+
readonly thoughtTokens?: number;
|
|
1549
|
+
};
|
|
1550
|
+
readonly todos?: readonly {
|
|
1551
|
+
readonly id: string;
|
|
1552
|
+
readonly subject: string;
|
|
1553
|
+
readonly status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'skipped' | 'cancelled';
|
|
1554
|
+
readonly description?: string;
|
|
1555
|
+
readonly owner?: string;
|
|
1556
|
+
readonly note?: string;
|
|
1557
|
+
readonly activeForm?: string;
|
|
1558
|
+
}[];
|
|
1559
|
+
}
|
|
1560
|
+
interface ClientViewItem {
|
|
1561
|
+
/** Image references proven by canonical user/tool content; does not include file bytes. */
|
|
1562
|
+
readonly attachments?: readonly {
|
|
1563
|
+
readonly kind: 'image';
|
|
1564
|
+
readonly path: string;
|
|
1565
|
+
readonly mediaType?: string;
|
|
1566
|
+
}[];
|
|
1567
|
+
/** Boundary after the complete canonical message, shared by all its display blocks. */
|
|
1568
|
+
readonly historyBoundary?: ClientHistoryBoundary;
|
|
1569
|
+
/** Host checkpoint provenance for retained output and tool evidence. */
|
|
1570
|
+
readonly sourceRunId?: string;
|
|
1571
|
+
readonly sourceTurnId?: string;
|
|
1572
|
+
/** One generated assistant message, shared by its draft and canonical items. */
|
|
1573
|
+
readonly outputId?: string;
|
|
1574
|
+
readonly outputState?: 'draft' | 'committed';
|
|
1575
|
+
/** Draft revision changes on replacement, never append; immutable committed output uses 0. Compare with outputState. */
|
|
1576
|
+
readonly textRevision?: number;
|
|
1577
|
+
/** Host recovery metadata; clients render the supplied item order. */
|
|
1578
|
+
readonly afterInputId?: string;
|
|
1579
|
+
readonly id: string;
|
|
1580
|
+
/** Accepted input identity of a canonical user message; absent on legacy history. */
|
|
1581
|
+
readonly inputId?: string;
|
|
1582
|
+
readonly type: 'user' | 'assistant' | 'thinking' | 'info' | 'error' | 'event' | 'hint' | 'sidecar' | 'system' | 'tool';
|
|
1583
|
+
readonly text: string;
|
|
1584
|
+
/** Present when text is a bounded suffix; readItem retains the complete original. */
|
|
1585
|
+
readonly textOffset?: number;
|
|
1586
|
+
readonly totalTextLength?: number;
|
|
1587
|
+
readonly timestamp?: number;
|
|
1588
|
+
readonly icon?: string;
|
|
1589
|
+
readonly compactText?: string;
|
|
1590
|
+
/** Verifier facts, independent of the consumer's label, icon or color. */
|
|
1591
|
+
readonly sidecar?: {
|
|
1592
|
+
readonly verdict?: 'revise' | 'blocked';
|
|
1593
|
+
readonly delivery?: 'synthetic-user-message' | 'budget-exhausted' | 'terminal-block';
|
|
1594
|
+
};
|
|
1595
|
+
readonly tool?: {
|
|
1596
|
+
readonly assistantOutputId?: string;
|
|
1597
|
+
readonly executionBegan?: true;
|
|
1598
|
+
readonly resultRecorded?: true;
|
|
1599
|
+
readonly callId: string;
|
|
1600
|
+
readonly name: string;
|
|
1601
|
+
readonly status: 'running' | 'success' | 'error' | 'cancelled' | 'awaiting_approval';
|
|
1602
|
+
readonly inputText?: string;
|
|
1603
|
+
readonly totalInputLength?: number;
|
|
1604
|
+
readonly progress?: string;
|
|
1605
|
+
readonly startedAt?: number;
|
|
1606
|
+
readonly endedAt?: number;
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
interface ClientCreateSessionInput {
|
|
1610
|
+
readonly mcpServers?: Readonly<Record<string, ClientMcpServerConfig>>;
|
|
1611
|
+
/** Delete this Session when its task ends, including after the client detaches. */
|
|
1612
|
+
readonly temporary?: boolean;
|
|
1613
|
+
readonly sessionId?: string;
|
|
1614
|
+
readonly title?: string;
|
|
1615
|
+
readonly projectPath?: string;
|
|
1616
|
+
readonly gitRoot?: string;
|
|
1617
|
+
readonly surface?: string;
|
|
1618
|
+
readonly profileId?: string;
|
|
1619
|
+
readonly tag?: string;
|
|
1620
|
+
}
|
|
1621
|
+
interface ClientSubmitInput {
|
|
1622
|
+
/** 'steer' and 'redirect' additionally require targetRunId. */
|
|
1623
|
+
readonly delivery?: 'immediate' | 'after_turn' | 'steer' | 'redirect';
|
|
1624
|
+
readonly sessionId: string;
|
|
1625
|
+
readonly inputId: string;
|
|
1626
|
+
readonly text: string;
|
|
1627
|
+
/** The only Run a 'steer' or 'redirect' delivery may act on. */
|
|
1628
|
+
readonly targetRunId?: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Image/file/video references anchored by the prompt (@path syntax,
|
|
1631
|
+
* clipboard, drag-drop). Part of the input's intent: resubmitting the same
|
|
1632
|
+
* inputId with a different artifact set is a conflict.
|
|
1633
|
+
*/
|
|
1634
|
+
readonly inputArtifacts?: readonly KodaXInputArtifact[];
|
|
1635
|
+
}
|
|
1636
|
+
/** Identity of an accepted input in the current Host, not a completion receipt. */
|
|
1637
|
+
interface ClientInputAcceptance {
|
|
1638
|
+
/**
|
|
1639
|
+
* 'submitted' is saved in the conversation context (does not prove the
|
|
1640
|
+
* Provider received it); 'queued' waits for its slot; 'withdrawn' was
|
|
1641
|
+
* taken back by the user; 'dropped' means the target Run settled before
|
|
1642
|
+
* delivery — the text never entered the context, so resubmit with a new ID.
|
|
1643
|
+
*/
|
|
1644
|
+
readonly state: 'submitted' | 'queued' | 'withdrawn' | 'dropped';
|
|
1645
|
+
readonly sessionId: string;
|
|
1646
|
+
readonly inputId: string;
|
|
1647
|
+
readonly runId?: string;
|
|
1648
|
+
}
|
|
1649
|
+
interface ClientQueuedInput {
|
|
1650
|
+
readonly inputId: string;
|
|
1651
|
+
/** Bounded display preview; withdraw returns the complete original text. */
|
|
1652
|
+
readonly text: string;
|
|
1653
|
+
readonly enqueuedAt: number;
|
|
1654
|
+
}
|
|
1655
|
+
/** User-explainable lifecycle facts; accepting a Stop never implies them. */
|
|
1656
|
+
interface ClientRunTerminal {
|
|
1657
|
+
readonly revision: number;
|
|
1658
|
+
readonly kind: 'completed' | 'failed' | 'cancelled' | 'interrupted';
|
|
1659
|
+
readonly code: string;
|
|
1660
|
+
/** Execution settlement and confirmed tool effects are separate facts. */
|
|
1661
|
+
readonly effectOutcome: 'none' | 'known' | 'unknown';
|
|
1662
|
+
readonly message?: string;
|
|
1663
|
+
readonly failureKind?: string;
|
|
1664
|
+
}
|
|
1665
|
+
interface ClientRunStatus {
|
|
1666
|
+
readonly terminal?: ClientRunTerminal;
|
|
1667
|
+
readonly runId: string;
|
|
1668
|
+
readonly sessionId: string;
|
|
1669
|
+
readonly phase: string;
|
|
1670
|
+
readonly startedAt?: string;
|
|
1671
|
+
readonly error?: string;
|
|
1672
|
+
readonly stop?: {
|
|
1673
|
+
readonly requestedAt: string;
|
|
1674
|
+
readonly state: string;
|
|
1675
|
+
readonly outcome: string;
|
|
1676
|
+
readonly reason: string;
|
|
1677
|
+
readonly resolvedAt?: string;
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
/** Stop acceptance is distinct from the Run's real terminal outcome. */
|
|
1681
|
+
interface ClientRunStopReceipt {
|
|
1682
|
+
readonly runId: string;
|
|
1683
|
+
readonly sessionId: string;
|
|
1684
|
+
/** True only when this call durably created the Stop request. */
|
|
1685
|
+
readonly accepted: boolean;
|
|
1686
|
+
readonly state: string;
|
|
1687
|
+
readonly outcome: string;
|
|
1688
|
+
readonly phase: string;
|
|
1689
|
+
}
|
|
1690
|
+
interface ClientSessionSettingsSnapshot {
|
|
1691
|
+
readonly revision: number;
|
|
1692
|
+
readonly value: ClientSessionSettings;
|
|
1693
|
+
}
|
|
1694
|
+
interface ClientSessionCancelInput {
|
|
1695
|
+
readonly sessionId: string;
|
|
1696
|
+
readonly expectedRunId: string;
|
|
1697
|
+
readonly requestId: string;
|
|
1698
|
+
}
|
|
1699
|
+
interface ClientSessionCancelReceipt extends ClientSessionCancelInput {
|
|
1700
|
+
readonly frontier: number;
|
|
1701
|
+
readonly receipts: readonly ClientRunStopReceipt[];
|
|
1702
|
+
}
|
|
1703
|
+
interface ClientToolInvocationInput {
|
|
1704
|
+
readonly sessionId: string;
|
|
1705
|
+
readonly inputId: string;
|
|
1706
|
+
readonly name: string;
|
|
1707
|
+
readonly input: Record<string, unknown>;
|
|
1708
|
+
readonly rawInput: string;
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Terminal facts of one Run. `result` is present only for settled runs the
|
|
1712
|
+
* Host could observe; `phase: 'unknown'` means settlement could not be
|
|
1713
|
+
* confirmed, even on a healthy connection. Preserve error; transport failures
|
|
1714
|
+
* reject separately. Unknown is never success or cancellation.
|
|
1715
|
+
*/
|
|
1716
|
+
interface ClientRunOutcome {
|
|
1717
|
+
readonly terminal?: ClientRunTerminal;
|
|
1718
|
+
readonly stop?: ClientRunStatus['stop'];
|
|
1719
|
+
readonly runId: string;
|
|
1720
|
+
readonly sessionId: string;
|
|
1721
|
+
readonly phase: string;
|
|
1722
|
+
readonly result?: KodaXResult;
|
|
1723
|
+
readonly error?: string;
|
|
1724
|
+
}
|
|
1725
|
+
/** Facts of one concrete operation awaiting an approval decision. */
|
|
1726
|
+
interface ClientPermissionInteractionOptions {
|
|
1727
|
+
/** Complete finalized plan for exit_plan_mode approval; never a truncated input preview. */
|
|
1728
|
+
readonly plan?: string;
|
|
1729
|
+
readonly toolName: string;
|
|
1730
|
+
readonly toolCallId?: string;
|
|
1731
|
+
readonly reason?: string;
|
|
1732
|
+
readonly risk?: 'low' | 'medium' | 'high';
|
|
1733
|
+
readonly inputPreview?: string;
|
|
1734
|
+
readonly executionCwd?: string;
|
|
1735
|
+
/** Opaque pending-request-local ids; return one unchanged to widen a decision. */
|
|
1736
|
+
readonly grantSuggestions?: readonly {
|
|
1737
|
+
readonly id: string;
|
|
1738
|
+
readonly kind: 'session' | 'persistent';
|
|
1739
|
+
readonly label: string;
|
|
1740
|
+
}[];
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* One pending answer the Host is waiting for. `kind` selects both the typed
|
|
1744
|
+
* payload and the typed response this request accepts.
|
|
1745
|
+
*/
|
|
1746
|
+
type ClientInteraction = ClientInteractionBase & {
|
|
1747
|
+
readonly kind: 'question';
|
|
1748
|
+
readonly options: AskUserQuestionOptions;
|
|
1749
|
+
readonly expiresAt: string;
|
|
1750
|
+
} | ClientInteractionBase & {
|
|
1751
|
+
readonly kind: 'question_multi';
|
|
1752
|
+
readonly options: AskUserMultiOptions;
|
|
1753
|
+
readonly expiresAt: string;
|
|
1754
|
+
} | ClientInteractionBase & {
|
|
1755
|
+
readonly kind: 'question_input';
|
|
1756
|
+
readonly options: {
|
|
1757
|
+
readonly question: string;
|
|
1758
|
+
readonly default?: string;
|
|
1759
|
+
};
|
|
1760
|
+
readonly expiresAt: string;
|
|
1761
|
+
} | ClientInteractionBase & {
|
|
1762
|
+
readonly kind: 'permission';
|
|
1763
|
+
readonly options: ClientPermissionInteractionOptions;
|
|
1764
|
+
readonly expiresAt?: string;
|
|
1765
|
+
};
|
|
1766
|
+
interface ClientInteractionBase {
|
|
1767
|
+
readonly requestId: string;
|
|
1768
|
+
readonly sessionId: string;
|
|
1769
|
+
readonly runId: string;
|
|
1770
|
+
readonly createdAt: string;
|
|
1771
|
+
}
|
|
1772
|
+
/** Typed answer for one pending interaction; kinds must match the request. */
|
|
1773
|
+
type ClientInteractionResponse = {
|
|
1774
|
+
readonly kind: 'question';
|
|
1775
|
+
readonly answer: AskUserAnswer;
|
|
1776
|
+
} | {
|
|
1777
|
+
readonly kind: 'question_multi';
|
|
1778
|
+
readonly answers: Readonly<Record<string, AskUserAnswer>>;
|
|
1779
|
+
} | {
|
|
1780
|
+
readonly kind: 'question_input';
|
|
1781
|
+
readonly text: string;
|
|
1782
|
+
} | {
|
|
1783
|
+
readonly kind: 'permission';
|
|
1784
|
+
readonly decision: ClientPermissionDecision;
|
|
1785
|
+
} | {
|
|
1786
|
+
readonly kind: 'cancel';
|
|
1787
|
+
readonly reason?: string;
|
|
1788
|
+
};
|
|
1789
|
+
type ClientPermissionDecision = {
|
|
1790
|
+
readonly type: 'allow_once';
|
|
1791
|
+
} | {
|
|
1792
|
+
readonly type: 'allow_session';
|
|
1793
|
+
readonly suggestionId: string;
|
|
1794
|
+
} | {
|
|
1795
|
+
readonly type: 'allow_always';
|
|
1796
|
+
readonly suggestionId: string;
|
|
1797
|
+
} | {
|
|
1798
|
+
readonly type: 'reject';
|
|
1799
|
+
readonly reason?: string;
|
|
1800
|
+
};
|
|
1801
|
+
/** First valid answer wins; every other case is explicitly not accepted. */
|
|
1802
|
+
interface ClientInteractionResult {
|
|
1803
|
+
readonly requestId: string;
|
|
1804
|
+
readonly accepted: boolean;
|
|
1805
|
+
/** 'already_resolved' covers late, duplicate, cancelled, expired and unknown targets. */
|
|
1806
|
+
readonly status: 'answered' | 'dismissed' | 'already_resolved';
|
|
1807
|
+
}
|
|
1808
|
+
interface ClientPermissionGrant {
|
|
1809
|
+
readonly id: string;
|
|
1810
|
+
/** Host-recorded Session scope. Absence alone does not imply a global grant. */
|
|
1811
|
+
readonly sessionId?: string;
|
|
1812
|
+
readonly label?: string;
|
|
1813
|
+
readonly persistence?: 'session' | 'persistent';
|
|
1814
|
+
}
|
|
1815
|
+
interface ClientPermissionGrants {
|
|
1816
|
+
readonly revision: number;
|
|
1817
|
+
readonly grants: readonly ClientPermissionGrant[];
|
|
1818
|
+
}
|
|
1819
|
+
interface ClientSessionSettings {
|
|
1820
|
+
/** Host-owned plan-mode default; an explicit Session effort takes precedence. */
|
|
1821
|
+
readonly planModeEffort?: string;
|
|
1822
|
+
readonly repoIntelligenceMode?: 'auto' | 'off' | 'light' | 'full';
|
|
1823
|
+
readonly repoIntelligenceTrace?: boolean;
|
|
1824
|
+
/** Shared manual/automatic summary policy, independent of main-turn effort. */
|
|
1825
|
+
readonly compactionReasoning?: boolean | {
|
|
1826
|
+
readonly effort: string;
|
|
1827
|
+
};
|
|
1828
|
+
readonly provider?: string;
|
|
1829
|
+
readonly model?: string;
|
|
1830
|
+
readonly effort?: string;
|
|
1831
|
+
readonly thinking?: boolean;
|
|
1832
|
+
readonly reasoningMode?: 'off' | 'auto' | 'quick' | 'balanced' | 'deep';
|
|
1833
|
+
readonly permissionMode?: 'plan' | 'accept-edits' | 'auto' | 'full-access';
|
|
1834
|
+
readonly agentMode?: 'ama' | 'sa' | 'amaw';
|
|
1835
|
+
readonly autoModeClassifierModel?: string;
|
|
1836
|
+
readonly compactionTriggerPercent?: number;
|
|
1837
|
+
readonly compactionTriggerTokens?: number;
|
|
1838
|
+
/** Per-run iteration fuse; unset falls back to the engine default. */
|
|
1839
|
+
readonly maxIter?: number;
|
|
1840
|
+
}
|
|
1841
|
+
type ClientSessionSettingsPatch = {
|
|
1842
|
+
readonly [Key in keyof ClientSessionSettings]?: ClientSessionSettings[Key] | null;
|
|
1843
|
+
};
|
|
1844
|
+
interface ClientConfig {
|
|
1845
|
+
readonly provider?: string;
|
|
1846
|
+
readonly model?: string;
|
|
1847
|
+
readonly effort?: string;
|
|
1848
|
+
readonly planModeEffort?: string;
|
|
1849
|
+
readonly thinking?: boolean;
|
|
1850
|
+
readonly reasoningMode?: ClientSessionSettings['reasoningMode'];
|
|
1851
|
+
readonly permissionMode?: ClientSessionSettings['permissionMode'];
|
|
1852
|
+
readonly agentMode?: ClientSessionSettings['agentMode'];
|
|
1853
|
+
readonly locale?: string;
|
|
1854
|
+
readonly providerModels?: Record<string, string[]>;
|
|
1855
|
+
readonly extensions?: string[];
|
|
1856
|
+
readonly fallbackProviders?: string[];
|
|
1857
|
+
readonly repoIntelligenceMode?: 'auto' | 'off' | 'light' | 'full';
|
|
1858
|
+
readonly repoIntelligenceTrace?: boolean;
|
|
1859
|
+
readonly verifierLog?: boolean;
|
|
1860
|
+
readonly stallLog?: boolean;
|
|
1861
|
+
readonly fastProvider?: string;
|
|
1862
|
+
readonly fastModel?: string;
|
|
1863
|
+
readonly deepProvider?: string;
|
|
1864
|
+
readonly deepModel?: string;
|
|
1865
|
+
readonly maxOutputTokens?: number;
|
|
1866
|
+
readonly disablePromptCache?: boolean;
|
|
1867
|
+
readonly lsp?: boolean;
|
|
1868
|
+
readonly lspAutoDownload?: boolean;
|
|
1869
|
+
readonly acpLogLevel?: string;
|
|
1870
|
+
readonly sessionRetentionDays?: number;
|
|
1871
|
+
readonly repoIntelligence?: {
|
|
1872
|
+
readonly toolWaitMs?: number;
|
|
1873
|
+
readonly workerTimeoutMs?: number;
|
|
1874
|
+
readonly workerOldSpaceMb?: number;
|
|
1875
|
+
readonly storageDir?: string;
|
|
1876
|
+
};
|
|
1877
|
+
readonly workflow?: {
|
|
1878
|
+
readonly maxConcurrency?: number;
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
interface ClientEffectiveConfigValue<T> {
|
|
1882
|
+
readonly value: T;
|
|
1883
|
+
readonly source: 'runtime_override' | 'environment' | 'persisted' | 'unset';
|
|
1884
|
+
readonly applied: boolean;
|
|
1885
|
+
}
|
|
1886
|
+
interface ClientEffectiveExecutionConfig {
|
|
1887
|
+
readonly verifierLog: ClientEffectiveConfigValue<boolean>;
|
|
1888
|
+
readonly stallLog: ClientEffectiveConfigValue<boolean>;
|
|
1889
|
+
readonly fallbackProviders: ClientEffectiveConfigValue<readonly string[]>;
|
|
1890
|
+
}
|
|
1891
|
+
/** MCP configuration only; executable connections and callbacks stay in the Host. */
|
|
1892
|
+
interface ClientMcpServerConfig {
|
|
1893
|
+
readonly type?: 'stdio' | 'sse' | 'streamable-http' | 'http';
|
|
1894
|
+
readonly command?: string;
|
|
1895
|
+
readonly args?: string[];
|
|
1896
|
+
readonly cwd?: string;
|
|
1897
|
+
readonly env?: Record<string, string>;
|
|
1898
|
+
readonly url?: string;
|
|
1899
|
+
readonly headers?: Record<string, string>;
|
|
1900
|
+
readonly connect?: 'lazy' | 'prewarm' | 'disabled';
|
|
1901
|
+
readonly startupTimeoutMs?: number;
|
|
1902
|
+
readonly requestTimeoutMs?: number;
|
|
1903
|
+
readonly auth?: {
|
|
1904
|
+
readonly type: 'oauth2';
|
|
1905
|
+
readonly clientId?: string;
|
|
1906
|
+
readonly authorizationUrl?: string;
|
|
1907
|
+
readonly tokenUrl?: string;
|
|
1908
|
+
readonly scopes?: readonly string[];
|
|
1909
|
+
readonly redirectPort?: number;
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
interface ClientMcpServerStatus {
|
|
1913
|
+
readonly serverId: string;
|
|
1914
|
+
readonly config: ClientMcpServerConfig;
|
|
1915
|
+
readonly connect: 'lazy' | 'prewarm' | 'disabled';
|
|
1916
|
+
readonly status: 'idle' | 'connecting' | 'ready' | 'error' | 'disabled';
|
|
1917
|
+
readonly tools: number;
|
|
1918
|
+
readonly resources: number;
|
|
1919
|
+
readonly prompts: number;
|
|
1920
|
+
readonly dirty: boolean;
|
|
1921
|
+
readonly resolvedTransport?: string;
|
|
1922
|
+
readonly cachedAt?: string;
|
|
1923
|
+
readonly lastError?: string;
|
|
1924
|
+
}
|
|
1925
|
+
type ClientWorkflowStartSource = {
|
|
1926
|
+
readonly kind: 'inline';
|
|
1927
|
+
readonly manifest: unknown;
|
|
1928
|
+
readonly source: string;
|
|
1929
|
+
} | {
|
|
1930
|
+
readonly kind: 'request';
|
|
1931
|
+
readonly request: string;
|
|
1932
|
+
} | {
|
|
1933
|
+
readonly kind: 'name';
|
|
1934
|
+
readonly name: string;
|
|
1935
|
+
};
|
|
1936
|
+
/**
|
|
1937
|
+
* FEATURE_298 T22 — serializable process metadata for a declarative start.
|
|
1938
|
+
* Mirrors the run-graph WorkflowRunProcessMetadata the Host attaches to the
|
|
1939
|
+
* minted run, so saved/rerun lineage (savedWorkflowName, sourceRunId, …)
|
|
1940
|
+
* survives the client→Host boundary.
|
|
1941
|
+
*/
|
|
1942
|
+
interface ClientWorkflowStartMetadata {
|
|
1943
|
+
readonly displayName?: string;
|
|
1944
|
+
readonly goal?: string;
|
|
1945
|
+
readonly source?: 'command' | 'review' | 'sdk' | 'capsule' | 'extension' | 'automation';
|
|
1946
|
+
readonly savedWorkflowName?: string;
|
|
1947
|
+
readonly sourceRunId?: string;
|
|
1948
|
+
readonly sourceWorkflowName?: string;
|
|
1949
|
+
readonly revisionOf?: string;
|
|
1950
|
+
readonly resumedFromRunId?: string;
|
|
1951
|
+
readonly hostMetadata?: Readonly<Record<string, string>>;
|
|
1952
|
+
}
|
|
1953
|
+
interface ClientWorkflowStartInput {
|
|
1954
|
+
readonly sessionId?: string;
|
|
1955
|
+
readonly projectRoot: string;
|
|
1956
|
+
readonly source: ClientWorkflowStartSource;
|
|
1957
|
+
readonly args?: unknown;
|
|
1958
|
+
readonly provider?: string;
|
|
1959
|
+
readonly model?: string;
|
|
1960
|
+
readonly metadata?: ClientWorkflowStartMetadata;
|
|
1961
|
+
}
|
|
1962
|
+
type ClientWorkflowStartResult = {
|
|
1963
|
+
readonly kind: 'declined';
|
|
1964
|
+
readonly reason: string;
|
|
1965
|
+
} | {
|
|
1966
|
+
readonly kind: 'started';
|
|
1967
|
+
readonly runId: string;
|
|
1968
|
+
};
|
|
1969
|
+
type ClientWorkflowProcess = WorkflowProcessSnapshot;
|
|
1970
|
+
type ClientWorkflowEvent = WorkflowProcessEvent;
|
|
1971
|
+
interface ClientWorkflowRun {
|
|
1972
|
+
readonly runId: string;
|
|
1973
|
+
readonly workflowName: string;
|
|
1974
|
+
readonly status: ManagedWorkflowStatus;
|
|
1975
|
+
readonly totalSpawned: number;
|
|
1976
|
+
readonly eventCount: number;
|
|
1977
|
+
readonly runDir: string;
|
|
1978
|
+
readonly endedAt?: string;
|
|
1979
|
+
readonly startedAt: string;
|
|
1980
|
+
readonly updatedAt: string;
|
|
1981
|
+
readonly displayName?: string;
|
|
1982
|
+
readonly resultSummary?: string;
|
|
1983
|
+
readonly error?: string;
|
|
1984
|
+
}
|
|
1985
|
+
/** Read-only Auto review facts; changing permissions still uses Session settings. */
|
|
1986
|
+
interface ClientAutoModeStats {
|
|
1987
|
+
readonly classifierHealth: 'healthy' | 'degraded';
|
|
1988
|
+
readonly classifierModel?: string;
|
|
1989
|
+
readonly denials: DenialTracker;
|
|
1990
|
+
readonly breaker: CircuitBreaker;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
export type { ClientPermissionGrants as $, ClientInteractionResponse as A, ClientInteractionResult as B, ClientAutoModeStats as C, ClientItemContent as D, ClientItemReadOptions as E, ClientLearningService as F, ClientLearningSubscription as G, ClientLifecycleService as H, ClientLineageEntry as I, ClientLineageLabelInput as J, ClientLineageSummary as K, ClientLoadedExtension as L, ClientMcpServerConfig as M, ClientMcpServerStatus as N, ClientMcpTool as O, ClientMemoryController as P, ClientMemoryPlane as Q, ClientMemoryProposal as R, ClientMemoryRebuildResult as S, ClientMemoryService as T, ClientModelCatalog as U, ClientModelSelection as V, ClientObservation as W, ClientObservationStatus as X, ClientObserveOptions as Y, ClientPermissionDecision as Z, ClientPermissionGrant as _, ClientCapabilityProbeResult as a, ClientPermissionInteractionOptions as a0, ClientProviderInfo as a1, ClientProviderRequestFact as a2, ClientQueuedInput as a3, ClientReviewInput as a4, ClientReviewService as a5, ClientRunOutcome as a6, ClientRunStatus as a7, ClientRunStopReceipt as a8, ClientRunTerminal as a9, ClientWorkflowStartSource as aA, KodaXProductClient as aB, ClientSession as aa, ClientSessionActivity as ab, ClientSessionCancelInput as ac, ClientSessionCancelReceipt as ad, ClientSessionFilter as ae, ClientSessionForkInput as af, ClientSessionGoal as ag, ClientSessionRecoverInput as ah, ClientSessionSettings as ai, ClientSessionSettingsPatch as aj, ClientSessionSettingsSnapshot as ak, ClientSessionSummary as al, ClientSessionView as am, ClientSkillInfo as an, ClientStatisticsService as ao, ClientSubmitInput as ap, ClientToolExecutionFact as aq, ClientToolInvocationInput as ar, ClientUsageTotals as as, ClientViewItem as at, ClientWorkflowEvent as au, ClientWorkflowProcess as av, ClientWorkflowRun as aw, ClientWorkflowStartInput as ax, ClientWorkflowStartMetadata as ay, ClientWorkflowStartResult as az, ClientCommandInfo as b, ClientCommandInput as c, ClientCommandResult as d, ClientCommandService as e, ClientCompactSessionResult as f, ClientConfig as g, ClientContextBudget as h, ClientContextBudgetFact as i, ClientCreateSessionInput as j, ClientEffectiveConfigValue as k, ClientEffectiveExecutionConfig as l, ClientExecutionFactsPage as m, ClientExecutionTarget as n, ClientExitReceipt as o, ClientExtensionDiagnostics as p, ClientExtensionSource as q, ClientGoalCreateInput as r, ClientHistoryBoundary as s, ClientHistoryIssue as t, ClientHistoryPage as u, ClientHistoryReadOptions as v, ClientHistorySearchInput as w, ClientHistorySearchResult as x, ClientInputAcceptance as y, ClientInteraction as z };
|