@kodax-ai/kodax 0.7.56 → 0.7.58
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 +2004 -1887
- package/README.md +52 -48
- package/README_CN.md +37 -32
- package/dist/builtin/code-review/SKILL.md +22 -3
- package/dist/chunks/agent-YJNC2755.js +2 -0
- package/dist/chunks/argument-completer-QGBNXTYJ.js +2 -0
- package/dist/chunks/chunk-526OILYL.js +2 -0
- package/dist/chunks/{chunk-ZBK3DZ3S.js → chunk-6AU6EPO6.js} +1 -1
- package/dist/chunks/chunk-73Z7BK5H.js +15 -0
- package/dist/chunks/chunk-7QB55SYG.js +326 -0
- package/dist/chunks/chunk-CQ6EQG7E.js +322 -0
- package/dist/chunks/chunk-CV6JHPEO.js +2 -0
- package/dist/chunks/chunk-D6QVXQNI.js +1 -0
- package/dist/chunks/chunk-HS2K74I4.js +31 -0
- package/dist/chunks/chunk-NKHXRN7G.js +403 -0
- package/dist/chunks/chunk-OBPB5BQ6.js +310 -0
- package/dist/chunks/chunk-P4VF3JEP.js +7 -0
- package/dist/chunks/chunk-PIQWODWN.js +18 -0
- package/dist/chunks/chunk-QHWXPJEG.js +601 -0
- package/dist/chunks/chunk-XXEIFNBE.js +52 -0
- package/dist/chunks/chunk-ZZDC75H4.js +681 -0
- package/dist/chunks/compaction-config-OPMRZSAK.js +2 -0
- package/dist/chunks/{construction-bootstrap-EDDVNP2B.js → construction-bootstrap-CIXFH5SE.js} +4 -4
- package/dist/chunks/dist-JSE7NICF.js +2 -0
- package/dist/chunks/dist-SDNQOW52.js +2 -0
- package/dist/chunks/host-H7FQMMRC.js +2 -0
- package/dist/chunks/{paste-5IDBBQQ3.js → paste-Y4DVUWSM.js} +1 -1
- package/dist/chunks/run-manager-4H5HWMVW.js +2 -0
- package/dist/chunks/utils-FLVVQHM7.js +2 -0
- package/dist/index.d.ts +22 -18
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1303 -1108
- package/dist/provider-capabilities.json +986 -197
- package/dist/sdk-agent.d.ts +162 -14
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +285 -255
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +66 -43
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +64 -5
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +114 -107
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-session.d.ts +7 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +11 -0
- package/dist/types-chunks/{base.d-CwPfI8WQ.d.ts → base.d-BA9Doaj_.d.ts} +38 -8
- package/dist/types-chunks/{bash-prefix-extractor.d-DZF1gDDz.d.ts → bash-prefix-extractor.d-D3cddmyV.d.ts} +639 -163
- package/dist/types-chunks/capability-learning.d-DRV80ISB.d.ts +29 -0
- package/dist/types-chunks/{cost-tracker.d-wRtyEW9d.d.ts → cost-tracker.d-CBLk1fiD.d.ts} +24 -2
- package/dist/types-chunks/{guardrail.d-DQQknOfb.d.ts → guardrail.d-iK7FwMdW.d.ts} +32 -10
- package/dist/types-chunks/{manager.d-DLmDhX3i.d.ts → manager.d-DBD7SOTT.d.ts} +7 -2
- package/dist/types-chunks/{process.d-BdiIUr8T.d.ts → process.d-DHow2y2G.d.ts} +170 -14
- package/dist/types-chunks/{resolver.d-Djq8KlCE.d.ts → resolver.d-DDOfVYDr.d.ts} +111 -18
- package/dist/types-chunks/{capsule.d-D0kjnqYy.d.ts → run-manager.d-ByDcJc5g.d.ts} +124 -13
- package/dist/types-chunks/{sdk-session-BP6ZNpOp.d.ts → sdk-session-21Tt3N_x.d.ts} +74 -9
- package/dist/types-chunks/{storage.d-CkydxFsV.d.ts → storage.d-BsZrBPYu.d.ts} +2 -2
- package/dist/types-chunks/{types.d-BJmoMf5H.d.ts → types.d-Ci5YPFEh.d.ts} +135 -22
- package/dist/types-chunks/{types.d-BKuHSiR0.d.ts → types.d-D4ZA8LJV.d.ts} +7 -3
- package/dist/types-chunks/{utils.d-bC97IuQZ.d.ts → utils.d-BURxOxFd.d.ts} +94 -19
- package/package.json +12 -7
- package/dist/chunks/agent-MAAKRAF2.js +0 -2
- package/dist/chunks/argument-completer-OWEXGWNL.js +0 -2
- package/dist/chunks/chunk-4OHXHC2S.js +0 -314
- package/dist/chunks/chunk-5YJIAP6C.js +0 -551
- package/dist/chunks/chunk-7EAGBLRV.js +0 -2
- package/dist/chunks/chunk-CDGOEK3T.js +0 -31
- package/dist/chunks/chunk-DHETLULC.js +0 -425
- package/dist/chunks/chunk-JCDO2FR4.js +0 -584
- package/dist/chunks/chunk-NZVJ3DFC.js +0 -656
- package/dist/chunks/chunk-QI3MRJGU.js +0 -5
- package/dist/chunks/chunk-XXQ3RLA2.js +0 -2
- package/dist/chunks/compaction-config-NAJEEPG5.js +0 -2
- package/dist/chunks/dist-2267YGB5.js +0 -2
- package/dist/chunks/dist-GW32CHO5.js +0 -2
- package/dist/chunks/utils-J7XBBZGB.js +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Diagnostic, Position, Location, Hover, DocumentSymbol, SymbolInformation } from 'vscode-languageserver-protocol';
|
|
1
|
+
import { W as KodaXGoalState, g as AgentMessage, b8 as StopHookFn, aa as KodaXSessionLineage, a0 as KodaXJsonValue, Q as KodaXExtensionSessionRecord, af as KodaXSessionScope, ag as KodaXSessionStorage, R as KodaXExtensionSessionState, _ as KodaXInputArtifact, C as ChildTaskRegistry, bt as WorkflowEventCorrelation, t as CompactionUpdate, bF as WorkflowProcessEvent, bs as WorkflowEvent, n as AskUserQuestionOptions, l as AskUserMultiOptions, z as Guardrail, bw as WorkflowIsolation, a2 as KodaXSessionArtifactLedgerEntry, aV as SessionErrorMetadata, w as DiscoveredInstance, bc as TaskAbortRegistry } from './process.d-DHow2y2G.js';
|
|
2
|
+
import { Z as KodaXTokenUsage, j as KodaXMessage, a6 as KodaXWireReasoningEffort, E as KodaXReasoningMode, g as KodaXHarnessProfile, T as KodaXTaskWorkIntent, I as KodaXReviewScale, P as KodaXTaskComplexity, b as KodaXChildFanoutClass, R as KodaXTaskRoutingDecision, S as KodaXTaskType, J as KodaXRiskLevel, e as KodaXExecutionMode } from './types.d-Ci5YPFEh.js';
|
|
3
|
+
import { Diagnostic, Position, Location, Hover, DocumentSymbol, SymbolInformation, WorkspaceSymbol, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall } from 'vscode-languageserver-protocol';
|
|
4
|
+
import { K as KodaXLlmTimeoutConfig, a as CostTracker } from './cost-tracker.d-CBLk1fiD.js';
|
|
4
5
|
import { C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
|
|
5
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
6
|
-
import { a as CostTracker } from './cost-tracker.d-wRtyEW9d.js';
|
|
6
|
+
import { K as KodaXBaseProvider } from './base.d-BA9Doaj_.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* FEATURE_192 v0.7.44 Phase C — Goal-tools execution context.
|
|
@@ -408,26 +408,41 @@ interface TodoStore {
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
type WorkflowInvocationSource = 'natural-language' | 'command';
|
|
411
|
-
type WorkflowInvocationAction = 'none' | 'suggest'
|
|
412
|
-
type WorkflowInvocationTrigger = 'explicit' | 'complexity' | 'negated' | 'none';
|
|
411
|
+
type WorkflowInvocationAction = 'none' | 'suggest';
|
|
413
412
|
type WorkflowStartOutcome = 'started' | 'declined' | 'cancelled' | 'failed';
|
|
413
|
+
/**
|
|
414
|
+
* Host-owned execution ceilings for a workflow run (FEATURE_229). These clamp
|
|
415
|
+
* the run-manager / runner (maxAgents, concurrency, token budget); they do not
|
|
416
|
+
* affect whether a workflow launches — that is decided by the source alone
|
|
417
|
+
* (ADR-047).
|
|
418
|
+
*/
|
|
414
419
|
interface WorkflowHostPolicy {
|
|
415
|
-
readonly autoStart?: 'off' | 'confirm' | 'on';
|
|
416
420
|
readonly maxAgents?: number;
|
|
417
421
|
readonly maxConcurrency?: number;
|
|
418
422
|
readonly tokenBudget?: number;
|
|
419
423
|
}
|
|
420
424
|
interface WorkflowInvocationPolicyInput {
|
|
421
|
-
readonly agentMode: KodaXAgentMode;
|
|
422
425
|
readonly source: WorkflowInvocationSource;
|
|
423
|
-
readonly input: string;
|
|
424
|
-
readonly hostPolicy?: WorkflowHostPolicy;
|
|
425
426
|
}
|
|
426
427
|
interface WorkflowInvocationPolicyDecision {
|
|
427
428
|
readonly action: WorkflowInvocationAction;
|
|
428
|
-
readonly trigger: WorkflowInvocationTrigger;
|
|
429
|
-
readonly reason: string;
|
|
430
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Decide whether the REPL host should launch a workflow before the agent runs.
|
|
432
|
+
*
|
|
433
|
+
* FEATURE_246 A5 (ADR-047): the host only launches workflows for an explicit
|
|
434
|
+
* `/workflow` command (`'suggest'`). Natural language is never intercepted in
|
|
435
|
+
* any mode (`'none'`) — in AMA/AMAW the Worker owns the decision through the
|
|
436
|
+
* `run_workflow` tool, which scouts the codebase first and authors a script
|
|
437
|
+
* from real findings (file paths, the actual sub-problems, a concrete
|
|
438
|
+
* outputSchema). A blind host-side generator cannot investigate, so pre-empting
|
|
439
|
+
* NL here produced shallow, disjointed workflows. SA has no workflow host.
|
|
440
|
+
*
|
|
441
|
+
* The decision is the source alone, so this takes no agent mode or input text:
|
|
442
|
+
* the earlier NL detection (explicit/complexity/negation regexes) existed only
|
|
443
|
+
* to gate the removed auto-start path — that judgment now belongs to the Worker
|
|
444
|
+
* with full context, not a keyword match.
|
|
445
|
+
*/
|
|
431
446
|
declare function decideWorkflowInvocation(input: WorkflowInvocationPolicyInput): WorkflowInvocationPolicyDecision;
|
|
432
447
|
declare function workflowStartOutcomeConsumesTurn(input: {
|
|
433
448
|
readonly outcome: WorkflowStartOutcome;
|
|
@@ -524,6 +539,16 @@ interface LspClient {
|
|
|
524
539
|
references(file: string, position: Position): Promise<Location[]>;
|
|
525
540
|
/** The document's symbol outline. */
|
|
526
541
|
documentSymbols(file: string): Promise<Array<DocumentSymbol | SymbolInformation>>;
|
|
542
|
+
/** Project-wide symbols matching a query string. */
|
|
543
|
+
workspaceSymbols(query: string): Promise<Array<SymbolInformation | WorkspaceSymbol>>;
|
|
544
|
+
/** Implementation site(s) of the symbol at a position. */
|
|
545
|
+
implementation(file: string, position: Position): Promise<Location[]>;
|
|
546
|
+
/** Prepare the call hierarchy item(s) for a symbol at a position. */
|
|
547
|
+
prepareCallHierarchy(file: string, position: Position): Promise<CallHierarchyItem[]>;
|
|
548
|
+
/** Incoming callers for a prepared call hierarchy item. */
|
|
549
|
+
incomingCalls(item: CallHierarchyItem): Promise<CallHierarchyIncomingCall[]>;
|
|
550
|
+
/** Outgoing callees for a prepared call hierarchy item. */
|
|
551
|
+
outgoingCalls(item: CallHierarchyItem): Promise<CallHierarchyOutgoingCall[]>;
|
|
527
552
|
/** Graceful shutdown (await server exit so the OS releases handles). */
|
|
528
553
|
shutdown(): Promise<void>;
|
|
529
554
|
/** Synchronous best-effort kill, for a `process.on('exit')` last resort. */
|
|
@@ -596,6 +621,16 @@ declare class LspService {
|
|
|
596
621
|
getReferences(file: string, position: Position, request?: DiagnosticsRequest): Promise<string>;
|
|
597
622
|
/** The file's symbol outline, as indented text. */
|
|
598
623
|
getDocumentSymbols(file: string, request?: DiagnosticsRequest): Promise<string>;
|
|
624
|
+
/** Project-wide symbols matching `query`, across all available language servers. */
|
|
625
|
+
getWorkspaceSymbols(query: string, request?: DiagnosticsRequest): Promise<string>;
|
|
626
|
+
/** Implementation site(s) of the symbol at `position` (0-based), as text. */
|
|
627
|
+
getImplementation(file: string, position: Position, request?: DiagnosticsRequest): Promise<string>;
|
|
628
|
+
/** Prepared call hierarchy item(s) for the symbol at `position` (0-based). */
|
|
629
|
+
getPrepareCallHierarchy(file: string, position: Position, request?: DiagnosticsRequest): Promise<string>;
|
|
630
|
+
/** Incoming callers of the symbol at `position` (0-based). */
|
|
631
|
+
getIncomingCalls(file: string, position: Position, request?: DiagnosticsRequest): Promise<string>;
|
|
632
|
+
/** Outgoing callees of the symbol at `position` (0-based). */
|
|
633
|
+
getOutgoingCalls(file: string, position: Position, request?: DiagnosticsRequest): Promise<string>;
|
|
599
634
|
/**
|
|
600
635
|
* Resolve the primary client for a navigation request, opening the file so
|
|
601
636
|
* the server has current content. Returns guidance text when no server is
|
|
@@ -603,6 +638,7 @@ declare class LspService {
|
|
|
603
638
|
* NOT silent), or an unsupported message for non-LSP file types.
|
|
604
639
|
*/
|
|
605
640
|
private navClient;
|
|
641
|
+
private workspaceClients;
|
|
606
642
|
/** Shut down all spawned servers gracefully (call on session teardown). */
|
|
607
643
|
shutdownAll(): Promise<void>;
|
|
608
644
|
/** Synchronous best-effort kill of all servers — for `process.on('exit')`. */
|
|
@@ -879,6 +915,22 @@ interface KodaXManualSource {
|
|
|
879
915
|
readonly label: string;
|
|
880
916
|
readonly path: string;
|
|
881
917
|
}
|
|
918
|
+
interface KodaXManualTopic {
|
|
919
|
+
readonly id: KodaXManualTopicId;
|
|
920
|
+
/** Human title, shown as the answer heading. */
|
|
921
|
+
readonly title: string;
|
|
922
|
+
/** Lookup aliases (English + Chinese high-frequency terms). */
|
|
923
|
+
readonly aliases: readonly string[];
|
|
924
|
+
/** One-line summary, shown in the index listing. */
|
|
925
|
+
readonly summary: string;
|
|
926
|
+
/**
|
|
927
|
+
* Bounded topic body. Built at module load — dynamic parts (e.g. the
|
|
928
|
+
* provider list) read live constants so the manual cannot drift from code.
|
|
929
|
+
*/
|
|
930
|
+
readonly body: string;
|
|
931
|
+
readonly sources: readonly KodaXManualSource[];
|
|
932
|
+
readonly nextTopics: readonly KodaXManualTopicId[];
|
|
933
|
+
}
|
|
882
934
|
interface ResolveKodaXManualInput {
|
|
883
935
|
/** Exact topic id or alias. Takes precedence over `query`. */
|
|
884
936
|
readonly topic?: string;
|
|
@@ -903,10 +955,24 @@ interface KodaXManualTopicInput {
|
|
|
903
955
|
}
|
|
904
956
|
/** Per-call resolver options — consumer topic injection + product re-branding. */
|
|
905
957
|
interface ResolveKodaXManualOptions {
|
|
906
|
-
/** Injected consumer topics, merged over the
|
|
958
|
+
/** Injected consumer topics, merged over the seeded base (override by id, then append). */
|
|
907
959
|
readonly extraTopics?: readonly KodaXManualTopicInput[];
|
|
908
960
|
/** Product name used in the scope anchor (default "KodaX"). */
|
|
909
961
|
readonly productName?: string;
|
|
962
|
+
/**
|
|
963
|
+
* FEATURE_221 — which KodaX base topics to SEED before `extraTopics` is
|
|
964
|
+
* layered on top. Orthogonal to `extraTopics` (whose override-by-id/append
|
|
965
|
+
* semantics are unchanged).
|
|
966
|
+
*
|
|
967
|
+
* - `undefined` → seed all base topics (`MANUAL_TOPIC_IDS`). Today's exact
|
|
968
|
+
* behavior (byte-identical default).
|
|
969
|
+
* - `[]` → seed ZERO base topics; only `extraTopics` populate the manual
|
|
970
|
+
* (full white-label replace).
|
|
971
|
+
* - `KodaXManualTopicId[]` → seed exactly this curated subset (e.g.
|
|
972
|
+
* `KODAX_UNDERLYING_CAPABILITY_TOPICS`), so a replacing consumer can still
|
|
973
|
+
* keep the mechanism topics its product inherits from KodaX.
|
|
974
|
+
*/
|
|
975
|
+
readonly baseTopics?: readonly KodaXManualTopicId[];
|
|
910
976
|
}
|
|
911
977
|
interface ResolveKodaXManualResult {
|
|
912
978
|
/** A topic id (KodaX base or injected consumer topic), or 'index'. */
|
|
@@ -918,64 +984,6 @@ interface ResolveKodaXManualResult {
|
|
|
918
984
|
readonly nextTopics: readonly string[];
|
|
919
985
|
}
|
|
920
986
|
|
|
921
|
-
/**
|
|
922
|
-
* FEATURE_093 (v0.7.24): minimal contract interfaces for the coding extension
|
|
923
|
-
* runtime. Extracted so `@kodax-ai/coding/src/types.ts` can reference the
|
|
924
|
-
* extension runtime at the type level without importing `./extensions/runtime.js`,
|
|
925
|
-
* which in turn imports from `types.ts` — a cycle that lasted since v0.7.20.
|
|
926
|
-
*
|
|
927
|
-
* Scope: the capability methods that tool execution consumes, plus optional
|
|
928
|
-
* session lifecycle hooks that the coding run loop uses when the runtime
|
|
929
|
-
* supports them.
|
|
930
|
-
*
|
|
931
|
-
* File must have NO imports from `../types.js` (that is the cycle we are
|
|
932
|
-
* breaking). Shared capability/session value types come from `@kodax-ai/agent`.
|
|
933
|
-
*/
|
|
934
|
-
|
|
935
|
-
interface ExtensionRuntimeModelSelection {
|
|
936
|
-
provider?: string;
|
|
937
|
-
model?: string;
|
|
938
|
-
}
|
|
939
|
-
interface RuntimeDefaultsSnapshot {
|
|
940
|
-
activeTools?: string[];
|
|
941
|
-
modelSelection: ExtensionRuntimeModelSelection;
|
|
942
|
-
thinkingLevel?: KodaXReasoningMode;
|
|
943
|
-
}
|
|
944
|
-
interface BoundExtensionRuntimeController {
|
|
945
|
-
queueUserMessage(message: string | KodaXMessage): void;
|
|
946
|
-
getSessionState<T = KodaXJsonValue>(extensionId: string, key: string): T | undefined;
|
|
947
|
-
setSessionState(extensionId: string, key: string, value: KodaXJsonValue | undefined): void;
|
|
948
|
-
getSessionStateSnapshot(extensionId: string): Record<string, KodaXJsonValue>;
|
|
949
|
-
appendSessionRecord(extensionId: string, type: string, data?: KodaXJsonValue, options?: {
|
|
950
|
-
dedupeKey?: string;
|
|
951
|
-
}): KodaXExtensionSessionRecord;
|
|
952
|
-
listSessionRecords(extensionId: string, type?: string): KodaXExtensionSessionRecord[];
|
|
953
|
-
clearSessionRecords(extensionId: string, type?: string): number;
|
|
954
|
-
getActiveTools(): string[];
|
|
955
|
-
setActiveTools(toolNames: string[]): void;
|
|
956
|
-
getModelSelection(): ExtensionRuntimeModelSelection;
|
|
957
|
-
setModelSelection(next: ExtensionRuntimeModelSelection): void;
|
|
958
|
-
getThinkingLevel(): KodaXReasoningMode | undefined;
|
|
959
|
-
setThinkingLevel(level: KodaXReasoningMode): void;
|
|
960
|
-
}
|
|
961
|
-
interface CapabilityRuntimeContract {
|
|
962
|
-
searchCapabilities(providerId: string, query: string, options?: {
|
|
963
|
-
kind?: CapabilityKind;
|
|
964
|
-
limit?: number;
|
|
965
|
-
server?: string;
|
|
966
|
-
}): Promise<unknown[]>;
|
|
967
|
-
describeCapability(providerId: string, capabilityId: string): Promise<unknown>;
|
|
968
|
-
executeCapability(providerId: string, capabilityId: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
969
|
-
readCapability(providerId: string, capabilityId: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
970
|
-
getCapabilityPrompt(providerId: string, capabilityId: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
971
|
-
getCapabilityPromptContext(providerId: string): Promise<string | undefined>;
|
|
972
|
-
}
|
|
973
|
-
interface ExtensionRuntimeContract extends CapabilityRuntimeContract {
|
|
974
|
-
getDefaults?(): RuntimeDefaultsSnapshot;
|
|
975
|
-
bindController?(controller: BoundExtensionRuntimeController): (() => void) | void;
|
|
976
|
-
hydrateSession?(sessionId: string): Promise<void>;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
987
|
/**
|
|
980
988
|
* KodaX Provider Resilience Types (Feature 045)
|
|
981
989
|
*
|
|
@@ -1107,6 +1115,130 @@ interface ProviderResiliencePolicy extends ProviderResilienceConfig {
|
|
|
1107
1115
|
provider: string;
|
|
1108
1116
|
}
|
|
1109
1117
|
|
|
1118
|
+
interface KodaXWorkflowTimeoutConfig {
|
|
1119
|
+
/** Workflow harness generation LLM call timeout, in seconds. Default 120s. */
|
|
1120
|
+
readonly generationTimeoutSec?: number;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Public timeout budgets for user-facing waits. Internal cleanup and
|
|
1124
|
+
* resource-protection watchdogs intentionally stay outside this SDK contract.
|
|
1125
|
+
*/
|
|
1126
|
+
interface KodaXTimeoutConfig {
|
|
1127
|
+
readonly llm?: KodaXLlmTimeoutConfig;
|
|
1128
|
+
readonly workflow?: KodaXWorkflowTimeoutConfig;
|
|
1129
|
+
}
|
|
1130
|
+
declare function providerResilienceConfigFromTimeouts(timeouts: KodaXTimeoutConfig | undefined): ProviderResilienceConfig | undefined;
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* FEATURE_093 (v0.7.24): minimal contract interfaces for the coding extension
|
|
1134
|
+
* runtime. Extracted so `@kodax-ai/coding/src/types.ts` can reference the
|
|
1135
|
+
* extension runtime at the type level without importing `./extensions/runtime.js`,
|
|
1136
|
+
* which in turn imports from `types.ts` — a cycle that lasted since v0.7.20.
|
|
1137
|
+
*
|
|
1138
|
+
* Scope: the capability methods that tool execution consumes, plus optional
|
|
1139
|
+
* session lifecycle hooks that the coding run loop uses when the runtime
|
|
1140
|
+
* supports them.
|
|
1141
|
+
*
|
|
1142
|
+
* File must have NO imports from `../types.js` (that is the cycle we are
|
|
1143
|
+
* breaking). Shared capability/session value types come from `@kodax-ai/agent`.
|
|
1144
|
+
*/
|
|
1145
|
+
|
|
1146
|
+
interface ExtensionRuntimeModelSelection {
|
|
1147
|
+
provider?: string;
|
|
1148
|
+
model?: string;
|
|
1149
|
+
}
|
|
1150
|
+
interface RuntimeDefaultsSnapshot {
|
|
1151
|
+
activeTools?: string[];
|
|
1152
|
+
modelSelection: ExtensionRuntimeModelSelection;
|
|
1153
|
+
thinkingLevel?: KodaXWireReasoningEffort;
|
|
1154
|
+
}
|
|
1155
|
+
interface BoundExtensionRuntimeController {
|
|
1156
|
+
queueUserMessage(message: string | KodaXMessage): void;
|
|
1157
|
+
getSessionState<T = KodaXJsonValue>(extensionId: string, key: string): T | undefined;
|
|
1158
|
+
setSessionState(extensionId: string, key: string, value: KodaXJsonValue | undefined): void;
|
|
1159
|
+
getSessionStateSnapshot(extensionId: string): Record<string, KodaXJsonValue>;
|
|
1160
|
+
appendSessionRecord(extensionId: string, type: string, data?: KodaXJsonValue, options?: {
|
|
1161
|
+
dedupeKey?: string;
|
|
1162
|
+
}): KodaXExtensionSessionRecord;
|
|
1163
|
+
listSessionRecords(extensionId: string, type?: string): KodaXExtensionSessionRecord[];
|
|
1164
|
+
clearSessionRecords(extensionId: string, type?: string): number;
|
|
1165
|
+
getActiveTools(): string[];
|
|
1166
|
+
setActiveTools(toolNames: string[]): void;
|
|
1167
|
+
getModelSelection(): ExtensionRuntimeModelSelection;
|
|
1168
|
+
setModelSelection(next: ExtensionRuntimeModelSelection): void;
|
|
1169
|
+
getThinkingLevel(): KodaXWireReasoningEffort | undefined;
|
|
1170
|
+
setThinkingLevel(level: KodaXWireReasoningEffort): void;
|
|
1171
|
+
}
|
|
1172
|
+
interface CapabilityRuntimeContract {
|
|
1173
|
+
searchCapabilities(providerId: string, query: string, options?: {
|
|
1174
|
+
kind?: CapabilityKind;
|
|
1175
|
+
limit?: number;
|
|
1176
|
+
server?: string;
|
|
1177
|
+
}): Promise<unknown[]>;
|
|
1178
|
+
describeCapability(providerId: string, capabilityId: string): Promise<unknown>;
|
|
1179
|
+
executeCapability(providerId: string, capabilityId: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
1180
|
+
readCapability(providerId: string, capabilityId: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
1181
|
+
getCapabilityPrompt(providerId: string, capabilityId: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
1182
|
+
getCapabilityPromptContext(providerId: string): Promise<string | undefined>;
|
|
1183
|
+
}
|
|
1184
|
+
interface ExtensionRuntimeContract extends CapabilityRuntimeContract {
|
|
1185
|
+
getDefaults?(): RuntimeDefaultsSnapshot;
|
|
1186
|
+
bindController?(controller: BoundExtensionRuntimeController): (() => void) | void;
|
|
1187
|
+
hydrateSession?(sessionId: string): Promise<void>;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* v0.7.42 — Declarative tool side-effect class.
|
|
1192
|
+
*
|
|
1193
|
+
* FEATURE_247: extracted into this leaf module (from `tools/types.ts`) so the
|
|
1194
|
+
* main `coding/src/types.ts` can import `ToolSideEffect` for the tool-visibility
|
|
1195
|
+
* policy WITHOUT forming a type-level import cycle with `tools/types.ts` (which
|
|
1196
|
+
* imports `KodaXToolExecutionContext` back from `types.ts`). This file imports
|
|
1197
|
+
* nothing from the coding type graph.
|
|
1198
|
+
*
|
|
1199
|
+
* Required field on every {@link import('./types.js').LocalToolDefinition}. Used by:
|
|
1200
|
+
* - Plan mode: tools with `sideEffect !== 'readonly'` are blocked unless
|
|
1201
|
+
* they explicitly opt in via `planModeAllowed: true` (e.g.
|
|
1202
|
+
* `exit_plan_mode`, `task_stop`).
|
|
1203
|
+
* - SDK embedders (KodaX Space etc.): iterate `getAllRegisteredTools()`
|
|
1204
|
+
* and build their own blocklist by category — replaces the previous
|
|
1205
|
+
* practice of hardcoding a `Set<string>` of tool names, which silently
|
|
1206
|
+
* drifted whenever KodaX added a new tool.
|
|
1207
|
+
* - Internal permission system: `FILE_MODIFICATION_TOOLS` and
|
|
1208
|
+
* `MODIFICATION_TOOLS` exports in `@kodax-ai/repl` are now computed
|
|
1209
|
+
* from this metadata at module load time, so adding a new
|
|
1210
|
+
* `'mutates-fs'` tool here automatically reaches every callsite
|
|
1211
|
+
* that consumes those sets.
|
|
1212
|
+
*
|
|
1213
|
+
* Categories (mutually exclusive; pick the dominant effect):
|
|
1214
|
+
* - `'readonly'` — produces no observable side effect, just reads
|
|
1215
|
+
* local state (FS, registry, computed views).
|
|
1216
|
+
* - `'mutates-fs'` — writes to the local filesystem (write, edit,
|
|
1217
|
+
* multi-edit, undo, worktree-*, construction
|
|
1218
|
+
* artifacts). Bash is NOT in this bucket; it has
|
|
1219
|
+
* its own.
|
|
1220
|
+
* - `'mutates-shell'` — invokes an arbitrary shell command (bash).
|
|
1221
|
+
* - `'reads-network'` — FEATURE_247: performs a network request whose
|
|
1222
|
+
* LLM-facing semantics are read-only, i.e. no remote
|
|
1223
|
+
* mutation (web_search, mcp_read_resource,
|
|
1224
|
+
* mcp_get_prompt). Distinct from `'mutates-network'`
|
|
1225
|
+
* so a permission broker can allow web research while
|
|
1226
|
+
* still blocking mutating network calls. Plan-mode
|
|
1227
|
+
* eligibility is still driven by `planModeAllowed`,
|
|
1228
|
+
* unchanged.
|
|
1229
|
+
* - `'mutates-network'` — performs a network request that may mutate remote
|
|
1230
|
+
* state (web_fetch with a mutating method, mcp_call).
|
|
1231
|
+
* - `'mutates-state'` — changes internal session/agent state without
|
|
1232
|
+
* FS or shell side effects (todo_update,
|
|
1233
|
+
* send_message, dispatch_child_task,
|
|
1234
|
+
* exit_plan_mode, emit_managed_protocol).
|
|
1235
|
+
*
|
|
1236
|
+
* Pick the dominant effect when a tool touches multiple. e.g. `dispatch_
|
|
1237
|
+
* child_task` may transitively run any tool, but its own direct effect is
|
|
1238
|
+
* spawning a child agent (`mutates-state`).
|
|
1239
|
+
*/
|
|
1240
|
+
type ToolSideEffect = 'readonly' | 'reads-network' | 'mutates-fs' | 'mutates-shell' | 'mutates-network' | 'mutates-state';
|
|
1241
|
+
|
|
1110
1242
|
/**
|
|
1111
1243
|
* FEATURE_200 Phase F (v0.7.45) — Todo domain types extracted from types.ts.
|
|
1112
1244
|
* Self-contained (no other coding-type deps); re-exported from ../types.ts
|
|
@@ -1203,12 +1335,11 @@ type TodoList = readonly TodoItem[];
|
|
|
1203
1335
|
* from types.ts. Self-contained; re-exported from ../types.ts (and 4 members
|
|
1204
1336
|
* re-imported there for internal use). `../types` importers unaffected.
|
|
1205
1337
|
*/
|
|
1206
|
-
type KodaXRepoIntelligenceMode = 'auto' | 'off' | '
|
|
1207
|
-
type KodaXRepoIntelligenceResolvedMode = 'off' | '
|
|
1338
|
+
type KodaXRepoIntelligenceMode = 'auto' | 'off' | 'light' | 'full';
|
|
1339
|
+
type KodaXRepoIntelligenceResolvedMode = 'off' | 'light' | 'full';
|
|
1208
1340
|
interface KodaXRepoIntelligenceCapability {
|
|
1209
1341
|
mode: KodaXRepoIntelligenceResolvedMode;
|
|
1210
|
-
engine: '
|
|
1211
|
-
bridge: 'none' | 'shared' | 'native';
|
|
1342
|
+
engine: 'light' | 'full';
|
|
1212
1343
|
level: 'basic' | 'enhanced';
|
|
1213
1344
|
status: 'ok' | 'limited' | 'unavailable' | 'warming';
|
|
1214
1345
|
warnings: string[];
|
|
@@ -1216,12 +1347,9 @@ interface KodaXRepoIntelligenceCapability {
|
|
|
1216
1347
|
}
|
|
1217
1348
|
interface KodaXRepoIntelligenceTrace {
|
|
1218
1349
|
mode: KodaXRepoIntelligenceResolvedMode;
|
|
1219
|
-
engine: '
|
|
1220
|
-
bridge: 'none' | 'shared' | 'native';
|
|
1350
|
+
engine: 'light' | 'full';
|
|
1221
1351
|
triggeredAt: string;
|
|
1222
|
-
source: '
|
|
1223
|
-
daemonLatencyMs?: number;
|
|
1224
|
-
cliLatencyMs?: number;
|
|
1352
|
+
source: 'light' | 'full';
|
|
1225
1353
|
cacheHit?: boolean;
|
|
1226
1354
|
capsuleBytes?: number;
|
|
1227
1355
|
capsuleEstimatedTokens?: number;
|
|
@@ -1259,6 +1387,28 @@ interface KodaXActivityEventMeta extends KodaXWorkflowEventMeta {
|
|
|
1259
1387
|
readonly childAgentName?: string;
|
|
1260
1388
|
readonly parentToolId?: string;
|
|
1261
1389
|
readonly liveOnly?: boolean;
|
|
1390
|
+
/**
|
|
1391
|
+
* FEATURE_247 (R8) — session id this event belongs to. Lets a host that runs
|
|
1392
|
+
* concurrent Partner/Coder sessions attribute a streamed event to the right
|
|
1393
|
+
* session. Absent on paths that do not yet thread the resolved session id.
|
|
1394
|
+
*/
|
|
1395
|
+
readonly sessionId?: string;
|
|
1396
|
+
/**
|
|
1397
|
+
* FEATURE_247 (R8) — SDK-consumer agent profile that produced this event.
|
|
1398
|
+
* Absent ⇒ default Coding Agent (or an event emitted before a profile is known).
|
|
1399
|
+
*/
|
|
1400
|
+
readonly agentProfile?: KodaXAgentProfile;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* ADR-049: a single workflow child agent reached a terminal/summary state during
|
|
1404
|
+
* an inline `run_workflow` run. The raw `WorkflowEvent` is forwarded (not a
|
|
1405
|
+
* pre-formatted string) so the REPL renders it with its own
|
|
1406
|
+
* `formatWorkflowAgentDigest` — keeping digest formatting in the UI layer and the
|
|
1407
|
+
* coding layer free of presentation logic.
|
|
1408
|
+
*/
|
|
1409
|
+
interface KodaXWorkflowAgentDigestEvent {
|
|
1410
|
+
readonly runId: string;
|
|
1411
|
+
readonly event: WorkflowEvent;
|
|
1262
1412
|
}
|
|
1263
1413
|
interface KodaXToolEventMeta extends KodaXActivityEventMeta {
|
|
1264
1414
|
readonly toolId?: string;
|
|
@@ -1272,6 +1422,17 @@ interface KodaXSidecarMessageEvent {
|
|
|
1272
1422
|
readonly content: string;
|
|
1273
1423
|
readonly suggestedFix?: string;
|
|
1274
1424
|
readonly trace?: string;
|
|
1425
|
+
/**
|
|
1426
|
+
* FEATURE_247 (R3/R8) — session id the verdict belongs to, so a host running
|
|
1427
|
+
* concurrent Partner/Coder sessions can correlate a sidecar verdict to the
|
|
1428
|
+
* right session. Absent when the resolved session id is not available.
|
|
1429
|
+
*/
|
|
1430
|
+
readonly sessionId?: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* FEATURE_247 (R3/R8) — SDK-consumer agent profile whose output was verified.
|
|
1433
|
+
* Absent ⇒ default Coding Agent.
|
|
1434
|
+
*/
|
|
1435
|
+
readonly agentProfile?: KodaXAgentProfile;
|
|
1275
1436
|
}
|
|
1276
1437
|
interface KodaXTodoDriftWarningEvent {
|
|
1277
1438
|
readonly kind: 'work_started_without_claimed_todo';
|
|
@@ -1377,8 +1538,7 @@ interface KodaXEvents {
|
|
|
1377
1538
|
* Fires whenever a provider's `withRateLimit` loop catches a 429 /
|
|
1378
1539
|
* 503 / 529 (overloaded) response and decides to wait before
|
|
1379
1540
|
* retrying. Supersedes the legacy `onProviderRateLimit` (kept for
|
|
1380
|
-
* back-compat) by carrying the parsed source of the wait duration —
|
|
1381
|
-
* UI layers (InkREPL spinner, cost tracker) can surface the
|
|
1541
|
+
* back-compat) by carrying the parsed source of the wait duration — * UI layers (InkREPL spinner, cost tracker) can surface the
|
|
1382
1542
|
* difference between "provider told us to wait 45s" and "no header,
|
|
1383
1543
|
* we're guessing 4s exp-backoff".
|
|
1384
1544
|
*
|
|
@@ -1396,6 +1556,17 @@ interface KodaXEvents {
|
|
|
1396
1556
|
attempt: number;
|
|
1397
1557
|
maxAttempts: number;
|
|
1398
1558
|
}, meta?: KodaXActivityEventMeta) => void;
|
|
1559
|
+
/**
|
|
1560
|
+
* Passive capability learning: fired when a provider HARD-rejects a
|
|
1561
|
+
* reasoning-effort value. Hosts can record it via the agent-layer capability
|
|
1562
|
+
* cache so the rung is narrowed out of the ladder and never offered/sent
|
|
1563
|
+
* again.
|
|
1564
|
+
*/
|
|
1565
|
+
onReasoningEffortRejected?: (event: {
|
|
1566
|
+
provider: string;
|
|
1567
|
+
model: string;
|
|
1568
|
+
effort: string;
|
|
1569
|
+
}) => void;
|
|
1399
1570
|
onRepoIntelligenceTrace?: (event: KodaXRepoIntelligenceTraceEvent) => void;
|
|
1400
1571
|
/**
|
|
1401
1572
|
* Fired when the Sidecar Verifier produces an actionable message.
|
|
@@ -1429,8 +1600,24 @@ interface KodaXEvents {
|
|
|
1429
1600
|
onComplete?: () => void;
|
|
1430
1601
|
onError?: (error: Error) => void;
|
|
1431
1602
|
onManagedTaskStatus?: (status: KodaXManagedTaskStatusEvent) => void;
|
|
1603
|
+
/**
|
|
1604
|
+
* FEATURE_247 (R4) — fired once at managed-task start with the effective
|
|
1605
|
+
* profile / tool scope / verification snapshot. Lets an SDK embedder confirm
|
|
1606
|
+
* the intended profile (e.g. Partner) actually entered the SDK managed task
|
|
1607
|
+
* and diagnose the tools + verification constraints it was given.
|
|
1608
|
+
*/
|
|
1609
|
+
onEffectiveConfig?: (config: KodaXEffectiveTaskConfig) => void;
|
|
1432
1610
|
/** FEATURE_229: workflow process snapshot stream for SDK/host panels. */
|
|
1433
1611
|
onWorkflowProcessEvent?: (event: WorkflowProcessEvent) => void;
|
|
1612
|
+
/**
|
|
1613
|
+
* ADR-049: per-agent digest stream for the inline `run_workflow` path. Fires
|
|
1614
|
+
* once per workflow child agent reaching a terminal/summary state
|
|
1615
|
+
* (`agent_completed` / `agent_unverified` / `agent_failed` /
|
|
1616
|
+
* `agent_summary_updated`). The REPL formats each via `formatWorkflowAgentDigest`
|
|
1617
|
+
* and writes it to the transcript — matching the slash `/workflow` path and
|
|
1618
|
+
* `dispatch_child_task` children, whose summaries persist in scrollback.
|
|
1619
|
+
*/
|
|
1620
|
+
onWorkflowAgentDigest?: (event: KodaXWorkflowAgentDigestEvent) => void;
|
|
1434
1621
|
/**
|
|
1435
1622
|
* Fired when Scout's managed-task completion is inferred but the harness
|
|
1436
1623
|
* detected suspicious signals (mutation expected but none happened, budget
|
|
@@ -1468,10 +1655,11 @@ interface KodaXEvents {
|
|
|
1468
1655
|
};
|
|
1469
1656
|
/** Tool execution hook - called before tool execution, return false to block - 工具执行前回调 */
|
|
1470
1657
|
beforeToolExecute?: (tool: string, input: Record<string, unknown>, meta?: KodaXToolEventMeta) => Promise<boolean | string>;
|
|
1471
|
-
/** Ask user a question interactively - Issue 069 -
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1658
|
+
/** Ask user a question interactively - Issue 069 - 交互式向用户提问. Multi-select
|
|
1659
|
+
* (options.multiSelect) resolves string[]; single-select resolves string. */
|
|
1660
|
+
askUser?: (options: AskUserQuestionOptions, meta?: KodaXToolEventMeta) => Promise<string | string[]>;
|
|
1661
|
+
/** Ask user multiple independent questions sequentially - 澶氶棶棰橀『搴忔彁闂?*/
|
|
1662
|
+
askUserMulti?: (options: AskUserMultiOptions, meta?: KodaXToolEventMeta) => Promise<Record<string, string | string[]> | undefined>;
|
|
1475
1663
|
/** Ask user for free-text input - 自由文本输入 (Issue 112) */
|
|
1476
1664
|
askUserInput?: (options: {
|
|
1477
1665
|
question: string;
|
|
@@ -1618,10 +1806,52 @@ interface KodaXTaskVerificationContract {
|
|
|
1618
1806
|
requiredEvidence?: string[];
|
|
1619
1807
|
requiredChecks?: string[];
|
|
1620
1808
|
capabilityHints?: KodaXTaskCapabilityHint[];
|
|
1621
|
-
rubricFamily?: 'code-review' | 'frontend' | 'product-completeness' | 'functionality' | 'code-quality';
|
|
1809
|
+
rubricFamily?: 'code-review' | 'frontend' | 'product-completeness' | 'functionality' | 'code-quality' | 'partner-research';
|
|
1622
1810
|
criteria?: KodaXTaskVerificationCriterion[];
|
|
1623
1811
|
runtime?: KodaXRuntimeVerificationContract;
|
|
1624
1812
|
}
|
|
1813
|
+
/**
|
|
1814
|
+
* FEATURE_247 — SDK-consumer agent profile identity (e.g. KodaX-Space Partner).
|
|
1815
|
+
*
|
|
1816
|
+
* The SDK core treats this as OPAQUE attribution: it is echoed onto results,
|
|
1817
|
+
* events, the effective-config snapshot, session runtimeInfo, and tool context
|
|
1818
|
+
* so an embedder can confirm which profile actually ran and can attribute
|
|
1819
|
+
* concurrent Partner/Coder sessions. Absent ⇒ the default Coding Agent, with no
|
|
1820
|
+
* behavioral change anywhere.
|
|
1821
|
+
*
|
|
1822
|
+
* Only two fields carry behavior, both additive and gated on their own presence:
|
|
1823
|
+
* - `instructions` — on the SA path the embedder sets
|
|
1824
|
+
* `context.systemPromptOverride`; the AMA/AMAW path builds role prompts
|
|
1825
|
+
* internally, so when this is set the Worker role prompt PREPENDS this block
|
|
1826
|
+
* (absent ⇒ byte-identical default coding role prompt).
|
|
1827
|
+
* - `verification` — a profile-default verifier standard the Sidecar Verifier
|
|
1828
|
+
* applies; per-task `context.taskVerification` still overrides/augments it.
|
|
1829
|
+
*
|
|
1830
|
+
* Everything else (`surface`/`id`/`version`/`name`) is pure identity passthrough.
|
|
1831
|
+
*/
|
|
1832
|
+
interface KodaXAgentProfile {
|
|
1833
|
+
/** Surface/profile label, e.g. `'code'` | `'partner'`. Opaque to the core. */
|
|
1834
|
+
readonly surface?: string;
|
|
1835
|
+
/** Stable profile id (UUID or stable name). Opaque to the core. */
|
|
1836
|
+
readonly id?: string;
|
|
1837
|
+
/** Profile version. Opaque to the core. */
|
|
1838
|
+
readonly version?: string;
|
|
1839
|
+
/** Human-facing display name. Opaque to the core. */
|
|
1840
|
+
readonly name?: string;
|
|
1841
|
+
/**
|
|
1842
|
+
* Partner behavior instructions injected into the AMA/AMAW Worker role prompt
|
|
1843
|
+
* (prepended). The SA path uses `context.systemPromptOverride` instead — this
|
|
1844
|
+
* field is the AMA-path equivalent so a Partner profile behaves consistently
|
|
1845
|
+
* across both execution modes.
|
|
1846
|
+
*/
|
|
1847
|
+
readonly instructions?: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* Profile-default verification standard. Merged with per-task
|
|
1850
|
+
* `context.taskVerification` (per-task fields win) before reaching the Sidecar
|
|
1851
|
+
* Verifier.
|
|
1852
|
+
*/
|
|
1853
|
+
readonly verification?: KodaXTaskVerificationContract;
|
|
1854
|
+
}
|
|
1625
1855
|
type KodaXSkillProjectionConfidence = 'high' | 'medium' | 'low';
|
|
1626
1856
|
interface KodaXSkillInvocationContext {
|
|
1627
1857
|
name: string;
|
|
@@ -1659,7 +1889,7 @@ interface KodaXTaskToolPolicy {
|
|
|
1659
1889
|
}
|
|
1660
1890
|
interface KodaXChildContextBundle {
|
|
1661
1891
|
id: string;
|
|
1662
|
-
fanoutClass:
|
|
1892
|
+
fanoutClass: KodaXChildFanoutClass;
|
|
1663
1893
|
objective: string;
|
|
1664
1894
|
scopeSummary?: string;
|
|
1665
1895
|
evidenceRefs: string[];
|
|
@@ -1700,6 +1930,15 @@ interface KodaXChildContextBundle {
|
|
|
1700
1930
|
*/
|
|
1701
1931
|
provider?: string;
|
|
1702
1932
|
model?: string;
|
|
1933
|
+
/** Optional per-dispatch reasoning effort. Omit to inherit the parent effort. */
|
|
1934
|
+
effort?: KodaXWireReasoningEffort;
|
|
1935
|
+
/**
|
|
1936
|
+
* FEATURE_246 Part B — optional JSON Schema (opaque) for the child's
|
|
1937
|
+
* structured output. When set, the child briefing asks for a fenced JSON
|
|
1938
|
+
* block matching it; the child executor parses + validates the result (with
|
|
1939
|
+
* one bounded repair turn) and surfaces it on `KodaXChildAgentResult.structured`.
|
|
1940
|
+
*/
|
|
1941
|
+
outputSchema?: unknown;
|
|
1703
1942
|
}
|
|
1704
1943
|
/**
|
|
1705
1944
|
* FEATURE_120 v0.7.39 Phase 4 — model tier hint. Tier semantics:
|
|
@@ -1714,7 +1953,7 @@ interface KodaXChildContextBundle {
|
|
|
1714
1953
|
type KodaXChildModelHint = 'fast' | 'balanced' | 'deep';
|
|
1715
1954
|
interface KodaXChildAgentResult {
|
|
1716
1955
|
childId: string;
|
|
1717
|
-
fanoutClass:
|
|
1956
|
+
fanoutClass: KodaXChildFanoutClass;
|
|
1718
1957
|
status: 'completed' | 'blocked' | 'failed';
|
|
1719
1958
|
disposition: 'candidate' | 'valid' | 'false-positive' | 'needs-more-evidence';
|
|
1720
1959
|
summary: string;
|
|
@@ -1746,6 +1985,13 @@ interface KodaXChildAgentResult {
|
|
|
1746
1985
|
* and consumed by dispatch-child-tasks' empty-summary fallback.
|
|
1747
1986
|
*/
|
|
1748
1987
|
interrupted?: boolean;
|
|
1988
|
+
/**
|
|
1989
|
+
* FEATURE_246 Part B — schema-validated structured output parsed from the
|
|
1990
|
+
* child's final text (present only when the bundle carried `outputSchema`
|
|
1991
|
+
* and a JSON value was parseable). Surfaced to the workflow runtime as
|
|
1992
|
+
* `WorkflowTaskResult.structured`.
|
|
1993
|
+
*/
|
|
1994
|
+
structured?: unknown;
|
|
1749
1995
|
}
|
|
1750
1996
|
interface KodaXParentReductionContract {
|
|
1751
1997
|
owner: 'parent';
|
|
@@ -1767,46 +2013,6 @@ interface KodaXChildFinding {
|
|
|
1767
2013
|
readonly evidence: readonly string[];
|
|
1768
2014
|
readonly artifacts: readonly string[];
|
|
1769
2015
|
}
|
|
1770
|
-
interface KodaXFanoutSchedulerInput {
|
|
1771
|
-
profile: KodaXAmaProfile;
|
|
1772
|
-
fanoutClass: KodaXAmaFanoutClass;
|
|
1773
|
-
maxChildren?: number;
|
|
1774
|
-
bundles: KodaXChildContextBundle[];
|
|
1775
|
-
reductionStrategy: KodaXParentReductionContract['strategy'];
|
|
1776
|
-
}
|
|
1777
|
-
type KodaXFanoutBranchLifecycle = 'scheduled' | 'deferred' | 'completed' | 'cancelled';
|
|
1778
|
-
interface KodaXFanoutBranchRecord {
|
|
1779
|
-
bundleId: string;
|
|
1780
|
-
status: KodaXFanoutBranchLifecycle;
|
|
1781
|
-
workerId?: string;
|
|
1782
|
-
childId?: string;
|
|
1783
|
-
reason?: string;
|
|
1784
|
-
}
|
|
1785
|
-
type KodaXFanoutBranchTransition = {
|
|
1786
|
-
type: 'assign';
|
|
1787
|
-
bundleId: string;
|
|
1788
|
-
workerId: string;
|
|
1789
|
-
} | {
|
|
1790
|
-
type: 'complete';
|
|
1791
|
-
bundleId: string;
|
|
1792
|
-
childId?: string;
|
|
1793
|
-
} | {
|
|
1794
|
-
type: 'cancel';
|
|
1795
|
-
bundleId: string;
|
|
1796
|
-
reason: string;
|
|
1797
|
-
};
|
|
1798
|
-
interface KodaXFanoutSchedulerPlan {
|
|
1799
|
-
enabled: boolean;
|
|
1800
|
-
profile: KodaXAmaProfile;
|
|
1801
|
-
fanoutClass: KodaXAmaFanoutClass;
|
|
1802
|
-
branches: KodaXFanoutBranchRecord[];
|
|
1803
|
-
scheduledBundleIds: string[];
|
|
1804
|
-
deferredBundleIds: string[];
|
|
1805
|
-
maxParallel: number;
|
|
1806
|
-
mergeStrategy: KodaXParentReductionContract['strategy'];
|
|
1807
|
-
cancellationPolicy: 'none' | 'winner-cancel' | 'budget-cancel';
|
|
1808
|
-
reason: string;
|
|
1809
|
-
}
|
|
1810
2016
|
type KodaXAgentMode = 'ama' | 'sa' | 'amaw';
|
|
1811
2017
|
type KodaXMemoryStrategy = 'continuous' | 'compact' | 'reset-handoff';
|
|
1812
2018
|
type KodaXBudgetDisclosureZone = 'green' | 'yellow' | 'orange' | 'red';
|
|
@@ -1835,9 +2041,14 @@ interface KodaXManagedLiveEvent {
|
|
|
1835
2041
|
interface KodaXManagedTaskStatusEvent {
|
|
1836
2042
|
agentMode: KodaXAgentMode;
|
|
1837
2043
|
harnessProfile: KodaXHarnessProfile;
|
|
2044
|
+
/**
|
|
2045
|
+
* FEATURE_247 — SDK-consumer agent profile driving this managed task, echoed
|
|
2046
|
+
* from `options.context.agentProfile`. Absent ⇒ default Coding Agent.
|
|
2047
|
+
*/
|
|
2048
|
+
agentProfile?: KodaXAgentProfile;
|
|
1838
2049
|
activeWorkerId?: string;
|
|
1839
2050
|
activeWorkerTitle?: string;
|
|
1840
|
-
childFanoutClass?:
|
|
2051
|
+
childFanoutClass?: KodaXChildFanoutClass;
|
|
1841
2052
|
childFanoutCount?: number;
|
|
1842
2053
|
currentRound?: number;
|
|
1843
2054
|
maxRounds?: number;
|
|
@@ -1878,11 +2089,33 @@ interface KodaXManagedTaskStatusEvent {
|
|
|
1878
2089
|
* can tell how many outstanding pieces of work are pending. 0 with
|
|
1879
2090
|
* `idleWaiting=true` is the transitional "background banner queued,
|
|
1880
2091
|
* registry already drained" state (fast-child race recovery path,
|
|
1881
|
-
* see FEATURE_155 hotfix follow-up #2) and renders as "idle —
|
|
1882
|
-
* resuming".
|
|
2092
|
+
* see FEATURE_155 hotfix follow-up #2) and renders as "idle — * resuming".
|
|
1883
2093
|
*/
|
|
1884
2094
|
idleWaitingPendingCount?: number;
|
|
1885
2095
|
}
|
|
2096
|
+
/**
|
|
2097
|
+
* FEATURE_247 (R4) — effective managed-task configuration snapshot, emitted once
|
|
2098
|
+
* at run start via {@link KodaXEvents.onEffectiveConfig} so an SDK embedder can
|
|
2099
|
+
* (a) assert the intended profile actually entered the SDK managed task and
|
|
2100
|
+
* (b) diagnose which tools + verification standard are in force.
|
|
2101
|
+
*/
|
|
2102
|
+
interface KodaXEffectiveTaskConfig {
|
|
2103
|
+
readonly agentMode: KodaXAgentMode;
|
|
2104
|
+
/** SDK-consumer profile driving the run; undefined ⇒ default Coding Agent. */
|
|
2105
|
+
readonly agentProfile?: KodaXAgentProfile;
|
|
2106
|
+
/** Tool names visible to the model for this run. */
|
|
2107
|
+
readonly toolScope: readonly string[];
|
|
2108
|
+
/**
|
|
2109
|
+
* Effective verification standard reaching the Sidecar Verifier — the profile
|
|
2110
|
+
* default merged with per-task `context.taskVerification` (per-task wins).
|
|
2111
|
+
*/
|
|
2112
|
+
readonly verification?: KodaXTaskVerificationContract;
|
|
2113
|
+
/** Resolved Sidecar Verifier provider/model, when the verifier is active. */
|
|
2114
|
+
readonly verifier?: {
|
|
2115
|
+
readonly provider?: string;
|
|
2116
|
+
readonly model?: string;
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
1886
2119
|
interface KodaXVerificationScorecardCriterion {
|
|
1887
2120
|
id: string;
|
|
1888
2121
|
label: string;
|
|
@@ -1944,13 +2177,56 @@ interface KodaXManagedBudgetSnapshot {
|
|
|
1944
2177
|
extensionDenied?: boolean;
|
|
1945
2178
|
extensionReason?: string;
|
|
1946
2179
|
}
|
|
1947
|
-
/** Mutable tracker for
|
|
2180
|
+
/** Mutable tracker for filesystem/shell mutations observed during managed Worker execution. */
|
|
1948
2181
|
interface ManagedMutationTracker {
|
|
1949
2182
|
readonly files: Map<string, number>;
|
|
1950
2183
|
totalOps: number;
|
|
2184
|
+
/**
|
|
2185
|
+
* Count of high-risk shell mutations (git push/commit/rm, npm install/publish,
|
|
2186
|
+
* rm/mv/cp, etc.) the Worker ran via `bash`. Tracked separately from `totalOps`
|
|
2187
|
+
* because bash writes are a blind spot — we cannot know which file / how many
|
|
2188
|
+
* lines a shell command touched — so the Verifier gate fires conservatively on
|
|
2189
|
+
* any risky shell op rather than inferring risk back out of `totalOps`.
|
|
2190
|
+
* Optional: defaults to 0 when absent (read as `riskyShellOps ?? 0`).
|
|
2191
|
+
*/
|
|
2192
|
+
riskyShellOps?: number;
|
|
2193
|
+
/**
|
|
2194
|
+
* Count of filesystem mutations whose touched file could NOT be attributed
|
|
2195
|
+
* from the tool input (the path is computed inside the handler): `undo`,
|
|
2196
|
+
* `worktree_create` / `worktree_remove`, `stage_construction` /
|
|
2197
|
+
* `stage_agent_construction`, or `stage_self_modify`. These bump `totalOps`
|
|
2198
|
+
* but leave `files` empty,
|
|
2199
|
+
* so without a separate count they would look like trivial no-op work to the
|
|
2200
|
+
* Verifier gate. Like `riskyShellOps`, an unattributable write is a blind spot
|
|
2201
|
+
* the gate fires on conservatively. Optional: read as `unattributedWriteOps ?? 0`.
|
|
2202
|
+
*/
|
|
2203
|
+
unattributedWriteOps?: number;
|
|
1951
2204
|
/** Set to true after scope reflection has been injected once. Prevents repeated injection. */
|
|
1952
2205
|
reflectionInjected?: boolean;
|
|
1953
2206
|
}
|
|
2207
|
+
/**
|
|
2208
|
+
* FEATURE_247 (R2) — a minimal, stable per-tool view handed to a
|
|
2209
|
+
* {@link KodaXToolVisibilityPolicy}. Only the load-bearing declarative metadata
|
|
2210
|
+
* is exposed (never the handler / full schema) so the contract stays stable as
|
|
2211
|
+
* tools evolve. `sideEffect` distinguishes readonly / reads-network /
|
|
2212
|
+
* mutates-* classes; `planModeAllowed` marks query-shaped tools.
|
|
2213
|
+
*/
|
|
2214
|
+
interface KodaXToolVisibilityMeta {
|
|
2215
|
+
readonly name: string;
|
|
2216
|
+
readonly sideEffect: ToolSideEffect;
|
|
2217
|
+
readonly planModeAllowed: boolean;
|
|
2218
|
+
}
|
|
2219
|
+
/**
|
|
2220
|
+
* FEATURE_247 (R2) — an SDK-consumer predicate evaluated for every candidate
|
|
2221
|
+
* tool BEFORE the model-visible tool list is built. Return `false` to hide a
|
|
2222
|
+
* tool from the model. Space uses this to express profile-scoped rules such as
|
|
2223
|
+
* "only readonly + reads-network visible" and to default-deny anything it does
|
|
2224
|
+
* not explicitly recognize, without enumerating a name list that drifts as the
|
|
2225
|
+
* SDK adds tools. Covers SDK builtin + host-registered + extension + MCP tools
|
|
2226
|
+
* uniformly (each carries a required `sideEffect`). A tool with no resolvable
|
|
2227
|
+
* metadata is hidden (fail-closed).
|
|
2228
|
+
*/
|
|
2229
|
+
type KodaXToolVisibilityPolicy = (tool: KodaXToolVisibilityMeta) => boolean;
|
|
1954
2230
|
interface KodaXContextOptions {
|
|
1955
2231
|
/** Project root used for project-scoped prompts, permissions, and path policy. */
|
|
1956
2232
|
gitRoot?: string | null;
|
|
@@ -1982,8 +2258,7 @@ interface KodaXContextOptions {
|
|
|
1982
2258
|
/**
|
|
1983
2259
|
* FEATURE_087/088 (v0.7.28): when true, the prompt builder injects a
|
|
1984
2260
|
* Tool Construction section that orients the LLM to the
|
|
1985
|
-
* scaffold_tool → validate_tool → stage_construction → test_tool →
|
|
1986
|
-
* activate_tool staircase. Off by default; the surrounding agent (REPL
|
|
2261
|
+
* scaffold_tool → validate_tool → stage_construction → test_tool → * activate_tool staircase. Off by default; the surrounding agent (REPL
|
|
1987
2262
|
* config or task router) flips this on when self-construction is
|
|
1988
2263
|
* authorized for the session. The corresponding builtin tool handlers
|
|
1989
2264
|
* are still gated independently by the active-tool set.
|
|
@@ -2014,6 +2289,13 @@ interface KodaXContextOptions {
|
|
|
2014
2289
|
mutationTracker?: ManagedMutationTracker;
|
|
2015
2290
|
/** FEATURE_067 v3: Tool names to exclude from API-level tool list (child agents). */
|
|
2016
2291
|
excludeTools?: readonly string[];
|
|
2292
|
+
/**
|
|
2293
|
+
* FEATURE_247 (R2) — profile-scoped tool visibility predicate applied when the
|
|
2294
|
+
* model-visible tool list is built (in addition to `excludeTools`). Tools for
|
|
2295
|
+
* which it returns `false` are hidden from the model. Absent ⇒ no policy (only
|
|
2296
|
+
* `excludeTools` applies) — the default Coding Agent path is unchanged.
|
|
2297
|
+
*/
|
|
2298
|
+
toolVisibilityPolicy?: KodaXToolVisibilityPolicy;
|
|
2017
2299
|
/**
|
|
2018
2300
|
* FEATURE_067 v3: Override the entire system prompt for this run.
|
|
2019
2301
|
* When set, buildSystemPromptSnapshot is skipped — only this string is used.
|
|
@@ -2024,6 +2306,13 @@ interface KodaXContextOptions {
|
|
|
2024
2306
|
taskMetadata?: Record<string, KodaXJsonValue>;
|
|
2025
2307
|
/** Optional structured verification contract carried into managed tasks. */
|
|
2026
2308
|
taskVerification?: KodaXTaskVerificationContract;
|
|
2309
|
+
/**
|
|
2310
|
+
* FEATURE_247 — SDK-consumer agent profile (KodaX-Space Partner et al).
|
|
2311
|
+
* Opaque identity + optional AMA-path instructions + optional default verifier
|
|
2312
|
+
* standard. Absent ⇒ the default Coding Agent (no behavioral change). See
|
|
2313
|
+
* {@link KodaXAgentProfile}.
|
|
2314
|
+
*/
|
|
2315
|
+
agentProfile?: KodaXAgentProfile;
|
|
2027
2316
|
/**
|
|
2028
2317
|
* FEATURE_074: Plan-mode block predicate provided by the parent REPL. The predicate
|
|
2029
2318
|
* closes over live parent state so mid-run mode toggles propagate to in-flight
|
|
@@ -2089,12 +2378,25 @@ interface KodaXContextOptions {
|
|
|
2089
2378
|
* FEATURE_221 — an SDK consumer (a product built on KodaX, e.g. KodaX-Space)
|
|
2090
2379
|
* injects its own product manual so that when ITS users ask "how do I use /
|
|
2091
2380
|
* configure <product>?", the kodax_manual tool answers with the consumer's
|
|
2092
|
-
* topics. `topics` extend the
|
|
2093
|
-
* re-brands the routing rule + scope anchor. Topics are still
|
|
2381
|
+
* topics. `topics` extend the seeded base (override by id, then append);
|
|
2382
|
+
* `productName` re-brands the routing rule + scope anchor. Topics are still
|
|
2383
|
+
* byte-capped.
|
|
2384
|
+
*
|
|
2385
|
+
* `baseTopics` controls how much of KodaX's own manual is present underneath:
|
|
2386
|
+
* omit it for the default full base, `[]` for a full white-label replace, or a
|
|
2387
|
+
* curated subset (e.g. `KODAX_UNDERLYING_CAPABILITY_TOPICS`) to keep only the
|
|
2388
|
+
* mechanism topics a product built on KodaX inherits. For build-time docs, a
|
|
2389
|
+
* consumer can import `MANUAL_REGISTRY` to read the base topic bodies directly.
|
|
2094
2390
|
*/
|
|
2095
2391
|
interface KodaXSelfManualConfig {
|
|
2096
2392
|
readonly productName?: string;
|
|
2097
2393
|
readonly topics?: readonly KodaXManualTopicInput[];
|
|
2394
|
+
/**
|
|
2395
|
+
* Which KodaX base topics to seed before `topics` is layered on. `undefined`
|
|
2396
|
+
* ⇒ all base topics (default). `[]` ⇒ none (full replace). A subset ⇒ exactly
|
|
2397
|
+
* those ids. See {@link ResolveKodaXManualOptions.baseTopics}.
|
|
2398
|
+
*/
|
|
2399
|
+
readonly baseTopics?: readonly KodaXManualTopicId[];
|
|
2098
2400
|
}
|
|
2099
2401
|
/**
|
|
2100
2402
|
* SDK-consumer auto-compaction override. When a field is provided it wins
|
|
@@ -2117,6 +2419,7 @@ interface KodaXOptions {
|
|
|
2117
2419
|
provider: string;
|
|
2118
2420
|
model?: string;
|
|
2119
2421
|
modelOverride?: string;
|
|
2422
|
+
effort?: KodaXWireReasoningEffort;
|
|
2120
2423
|
thinking?: boolean;
|
|
2121
2424
|
reasoningMode?: KodaXReasoningMode;
|
|
2122
2425
|
agentMode?: KodaXAgentMode;
|
|
@@ -2127,6 +2430,54 @@ interface KodaXOptions {
|
|
|
2127
2430
|
extensionRuntime?: ExtensionRuntimeContract;
|
|
2128
2431
|
/** FEATURE_229: host-owned policy for workflow auto-start and ceilings. */
|
|
2129
2432
|
workflowHostPolicy?: WorkflowHostPolicy;
|
|
2433
|
+
/**
|
|
2434
|
+
* FEATURE_246 Part A2 (ADR-046): durable run-graph base dir for workflow runs
|
|
2435
|
+
* the model launches via `run_workflow`. The host (REPL / SDK) resolves it
|
|
2436
|
+
* (e.g. `getAgentConfigPath('workflow-runs', projectKey)`); when set + the
|
|
2437
|
+
* agent mode is ama/amaw, the tool-execution context wires `ctx.workflowHost`.
|
|
2438
|
+
*/
|
|
2439
|
+
workflowRunsBaseDir?: string;
|
|
2440
|
+
/**
|
|
2441
|
+
* M2 — per-agent model TIERS for the workflow / dispatch `model_hint`. An
|
|
2442
|
+
* embedder maps the semantic tiers to concrete models; a workflow script /
|
|
2443
|
+
* dispatch then expresses intent via `modelHint: 'fast' | 'deep'` (NOT a
|
|
2444
|
+
* concrete model name — the authoring model has no cognition of the
|
|
2445
|
+
* embedder's configured providers). 'fast' routes read-only children only
|
|
2446
|
+
* (write/codegen stays on the parent — a quality guard); 'deep' routes any
|
|
2447
|
+
* child; an unset tier inherits the parent provider/model. Carried run-scoped
|
|
2448
|
+
* (AsyncLocalStorage) by runManagedTask so concurrent SDK sessions never
|
|
2449
|
+
* clobber each other; KODAX_FAST/DEEP_PROVIDER/MODEL is the env fallback used
|
|
2450
|
+
* by the CLI / config.json path.
|
|
2451
|
+
*/
|
|
2452
|
+
modelTiers?: {
|
|
2453
|
+
readonly fast?: {
|
|
2454
|
+
readonly provider?: string;
|
|
2455
|
+
readonly model?: string;
|
|
2456
|
+
};
|
|
2457
|
+
readonly deep?: {
|
|
2458
|
+
readonly provider?: string;
|
|
2459
|
+
readonly model?: string;
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
/**
|
|
2463
|
+
* Config-surface SDK peers for settings the llm layer otherwise reads via env.
|
|
2464
|
+
* Carried run-scoped (AsyncLocalStorage) by runManagedTask so concurrent SDK
|
|
2465
|
+
* sessions are isolated; the KODAX_* env vars are the CLI/config.json fallback.
|
|
2466
|
+
* `maxOutputTokens` caps every provider call; `disablePromptCache` turns off
|
|
2467
|
+
* Anthropic prompt caching; `lsp: false` disables LSP-assisted diagnostics.
|
|
2468
|
+
*/
|
|
2469
|
+
maxOutputTokens?: number;
|
|
2470
|
+
disablePromptCache?: boolean;
|
|
2471
|
+
lsp?: boolean;
|
|
2472
|
+
/**
|
|
2473
|
+
* Workflow engine run-scoped overrides. `maxConcurrency` caps how many child
|
|
2474
|
+
* agents a `run_workflow` fans out at once (default 8, clamped to [1, 32]); the
|
|
2475
|
+
* `KODAX_WORKFLOW_MAX_CONCURRENCY` env var (bridged from config.json) is the
|
|
2476
|
+
* CLI fallback. Carried run-scoped so concurrent SDK sessions stay isolated.
|
|
2477
|
+
*/
|
|
2478
|
+
workflow?: {
|
|
2479
|
+
readonly maxConcurrency?: number;
|
|
2480
|
+
};
|
|
2130
2481
|
/** FEATURE_221: SDK-consumer self-manual injection (product name + topics). */
|
|
2131
2482
|
selfManual?: KodaXSelfManualConfig;
|
|
2132
2483
|
/**
|
|
@@ -2156,6 +2507,12 @@ interface KodaXOptions {
|
|
|
2156
2507
|
* and `~/.kodax/config.json`. See {@link KodaXCompactionOverride}.
|
|
2157
2508
|
*/
|
|
2158
2509
|
compaction?: KodaXCompactionOverride;
|
|
2510
|
+
/**
|
|
2511
|
+
* SDK-consumer timeout budgets for user-facing waits. Values are seconds at
|
|
2512
|
+
* the public API boundary; KodaX converts them to milliseconds internally.
|
|
2513
|
+
* This does not control internal cleanup/resource-protection watchdogs.
|
|
2514
|
+
*/
|
|
2515
|
+
timeouts?: KodaXTimeoutConfig;
|
|
2159
2516
|
}
|
|
2160
2517
|
/**
|
|
2161
2518
|
* Low-level mutators handed to a `KodaXSessionControl` by the substrate.
|
|
@@ -2226,16 +2583,6 @@ interface KodaXTaskEvidenceArtifact {
|
|
|
2226
2583
|
path: string;
|
|
2227
2584
|
description?: string;
|
|
2228
2585
|
}
|
|
2229
|
-
type KodaXImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
2230
|
-
type KodaXInputArtifactSource = 'user-inline' | 'clipboard' | 'drag-drop' | 'file-picker';
|
|
2231
|
-
interface KodaXImageInputArtifact {
|
|
2232
|
-
readonly kind: 'image';
|
|
2233
|
-
readonly path: string;
|
|
2234
|
-
readonly mediaType?: KodaXImageMediaType;
|
|
2235
|
-
readonly source?: KodaXInputArtifactSource;
|
|
2236
|
-
readonly description?: string;
|
|
2237
|
-
}
|
|
2238
|
-
type KodaXInputArtifact = KodaXImageInputArtifact;
|
|
2239
2586
|
interface KodaXTaskEvidenceEntry {
|
|
2240
2587
|
assignmentId: string;
|
|
2241
2588
|
role: KodaXTaskRole;
|
|
@@ -2265,14 +2612,9 @@ interface KodaXOrchestrationVerdict {
|
|
|
2265
2612
|
disposition?: 'complete' | 'blocked' | 'needs_continuation';
|
|
2266
2613
|
}
|
|
2267
2614
|
interface KodaXManagedTaskRuntimeState {
|
|
2268
|
-
amaProfile?: KodaXAmaProfile;
|
|
2269
|
-
amaTactics?: KodaXAmaTactic[];
|
|
2270
|
-
amaFanout?: KodaXAmaFanoutPolicy;
|
|
2271
|
-
amaControllerReason?: string;
|
|
2272
2615
|
childContextBundles?: KodaXChildContextBundle[];
|
|
2273
2616
|
childAgentResults?: KodaXChildAgentResult[];
|
|
2274
2617
|
parentReductionContract?: KodaXParentReductionContract;
|
|
2275
|
-
fanoutSchedulerPlan?: KodaXFanoutSchedulerPlan;
|
|
2276
2618
|
budget?: KodaXManagedBudgetSnapshot;
|
|
2277
2619
|
scorecard?: KodaXVerificationScorecard;
|
|
2278
2620
|
qualityAssuranceMode?: 'required' | 'optional';
|
|
@@ -2327,8 +2669,7 @@ interface KodaXManagedTask {
|
|
|
2327
2669
|
runtime?: KodaXManagedTaskRuntimeState;
|
|
2328
2670
|
}
|
|
2329
2671
|
interface KodaXManagedVerdictPayload {
|
|
2330
|
-
/** FEATURE_184 (v0.7.45): `'sidecar'` is the new architectural source —
|
|
2331
|
-
* Sidecar Verifier replaces the in-chain Evaluator role. `'evaluator'`
|
|
2672
|
+
/** FEATURE_184 (v0.7.45): `'sidecar'` is the new architectural source — * Sidecar Verifier replaces the in-chain Evaluator role. `'evaluator'`
|
|
2332
2673
|
* / `'worker'` are retained for backward-compat reads of session jsonl
|
|
2333
2674
|
* written before v0.7.45. New writes use `'sidecar'`. */
|
|
2334
2675
|
source: 'evaluator' | 'worker' | 'sidecar';
|
|
@@ -2382,6 +2723,12 @@ interface KodaXResult {
|
|
|
2382
2723
|
signalDebugReason?: string;
|
|
2383
2724
|
messages: KodaXMessage[];
|
|
2384
2725
|
sessionId: string;
|
|
2726
|
+
/**
|
|
2727
|
+
* FEATURE_247 — the agent profile this run executed under, echoed verbatim from
|
|
2728
|
+
* `options.context.agentProfile`. Lets an embedder confirm the running profile
|
|
2729
|
+
* was Partner (not the default Coding Agent). Absent ⇒ default Coding Agent.
|
|
2730
|
+
*/
|
|
2731
|
+
agentProfile?: KodaXAgentProfile;
|
|
2385
2732
|
/** Internal raw protocol output retained for artifact persistence after compacting visible failure text. */
|
|
2386
2733
|
protocolRawText?: string;
|
|
2387
2734
|
/** Structured managed-task protocol payload separated from visible text. */
|
|
@@ -2416,8 +2763,33 @@ interface KodaXResult {
|
|
|
2416
2763
|
interface KodaXToolExecutionContext {
|
|
2417
2764
|
/** File backups for undo functionality - 文件备份用于撤销功能 */
|
|
2418
2765
|
backups: Map<string, string>;
|
|
2419
|
-
/** Git root directory - Git
|
|
2766
|
+
/** Git root directory - Git 鏍圭洰褰?*/
|
|
2420
2767
|
gitRoot?: string;
|
|
2768
|
+
/**
|
|
2769
|
+
* FEATURE_247 (R7) — runtime-resolved session id for the run that owns this
|
|
2770
|
+
* tool call. Lets host-registered tools (Space artifact/source/KB) attribute a
|
|
2771
|
+
* call to the right session when multiple Partner/Coder sessions run
|
|
2772
|
+
* concurrently, without AsyncLocalStorage. Absent on paths that do not resolve
|
|
2773
|
+
* a session id (e.g. isolated tool tests).
|
|
2774
|
+
*/
|
|
2775
|
+
sessionId?: string;
|
|
2776
|
+
/**
|
|
2777
|
+
* FEATURE_247 (R7) — id of the LLM `tool_use` block this execution backs
|
|
2778
|
+
* (same value surfaced as `KodaXToolEventMeta.toolId`). Lets a host correlate a
|
|
2779
|
+
* tool handler invocation to its event stream and de-duplicate retries.
|
|
2780
|
+
*/
|
|
2781
|
+
toolCallId?: string;
|
|
2782
|
+
/**
|
|
2783
|
+
* FEATURE_247 (R7) — task surface/profile label forwarded from
|
|
2784
|
+
* `options.context.taskSurface`, so a tool handler can tell a Partner call from
|
|
2785
|
+
* a Coder call. Absent ⇒ not set by the caller.
|
|
2786
|
+
*/
|
|
2787
|
+
taskSurface?: KodaXTaskSurface;
|
|
2788
|
+
/**
|
|
2789
|
+
* FEATURE_247 (R7) — SDK-consumer agent profile owning this tool call, echoed
|
|
2790
|
+
* from `options.context.agentProfile`. Absent ⇒ default Coding Agent.
|
|
2791
|
+
*/
|
|
2792
|
+
agentProfile?: KodaXAgentProfile;
|
|
2421
2793
|
/** FEATURE_221: SDK-consumer self-manual injection, forwarded from KodaXOptions. */
|
|
2422
2794
|
selfManual?: KodaXSelfManualConfig;
|
|
2423
2795
|
/** Working directory used to resolve relative paths and execute shell commands. */
|
|
@@ -2438,10 +2810,11 @@ interface KodaXToolExecutionContext {
|
|
|
2438
2810
|
workflowWorktreeBaseDir?: string;
|
|
2439
2811
|
/** Shared extension capability runtime used by retrieval-family tools. */
|
|
2440
2812
|
extensionRuntime?: CapabilityRuntimeContract;
|
|
2441
|
-
/** Ask user a question interactively (select mode) - 交互式向用户提问 (Issue 069)
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2813
|
+
/** Ask user a question interactively (select mode) - 交互式向用户提问 (Issue 069).
|
|
2814
|
+
* Multi-select resolves string[]; single-select resolves string. */
|
|
2815
|
+
askUser?: (options: AskUserQuestionOptions) => Promise<string | string[]>;
|
|
2816
|
+
/** Ask user multiple independent questions sequentially - 澶氶棶棰橀『搴忔彁闂?*/
|
|
2817
|
+
askUserMulti?: (options: AskUserMultiOptions) => Promise<Record<string, string | string[]> | undefined>;
|
|
2445
2818
|
/** Ask user for free-text input - 自由文本输入 (Issue 112) */
|
|
2446
2819
|
askUserInput?: (options: {
|
|
2447
2820
|
question: string;
|
|
@@ -2482,6 +2855,9 @@ interface KodaXToolExecutionContext {
|
|
|
2482
2855
|
readonly provider: string;
|
|
2483
2856
|
readonly model?: string;
|
|
2484
2857
|
readonly reasoningMode?: KodaXReasoningMode;
|
|
2858
|
+
readonly effort?: KodaXWireReasoningEffort;
|
|
2859
|
+
readonly repoIntelligenceMode?: KodaXRepoIntelligenceMode;
|
|
2860
|
+
readonly repoIntelligenceTrace?: boolean;
|
|
2485
2861
|
};
|
|
2486
2862
|
/**
|
|
2487
2863
|
* Parent SDK/REPL callback surface available to child-dispatch tools.
|
|
@@ -2562,7 +2938,6 @@ interface KodaXToolExecutionContext {
|
|
|
2562
2938
|
* child's `Runner.run` via `KodaXOptions.guardrails`. Sharing the SAME
|
|
2563
2939
|
* guardrail instance means the auto-mode `engine` + `denialTracker` +
|
|
2564
2940
|
* `circuitBreaker` state is observed across the parent/child boundary —
|
|
2565
|
-
* design doc "防绕阈值" defense (a child can't escape the parent's
|
|
2566
2941
|
* rate-limit by hitting the threshold from a fresh tracker).
|
|
2567
2942
|
*
|
|
2568
2943
|
* Single-process / single-thread execution makes the shared mutable state
|
|
@@ -2718,6 +3093,107 @@ interface KodaXToolExecutionContext {
|
|
|
2718
3093
|
* See `packages/coding/src/goal/tools-context.ts`.
|
|
2719
3094
|
*/
|
|
2720
3095
|
goalContext?: GoalToolsContext;
|
|
3096
|
+
/**
|
|
3097
|
+
* FEATURE_246 Part A2 (ADR-046): narrow capability the `run_workflow` tool
|
|
3098
|
+
* uses to start a managed workflow run. Wired by tool-execution-context (via
|
|
3099
|
+
* a lazy import of the coding WorkflowHost) only when the session enables it;
|
|
3100
|
+
* absent in SA / when no runs dir is configured, so the tool fails closed.
|
|
3101
|
+
*/
|
|
3102
|
+
workflowHost?: WorkflowToolHost;
|
|
3103
|
+
/**
|
|
3104
|
+
* Gap A — run-level progress getters keyed by a background workflow's runId.
|
|
3105
|
+
* The async `run_workflow` path registers a getter here on start and removes
|
|
3106
|
+
* it when the run settles, so `task_output(runId)` can render live workflow
|
|
3107
|
+
* progress (phase + active/finished agents) while it is in flight, instead of
|
|
3108
|
+
* `not_found`. Same lifetime as `childAbortControllers` (per ctx). Undefined
|
|
3109
|
+
* outside the async/idle-yield path.
|
|
3110
|
+
*/
|
|
3111
|
+
workflowRunProgress?: Map<string, () => WorkflowRunProgressView | undefined>;
|
|
3112
|
+
}
|
|
3113
|
+
/** Result of a model-launched workflow run (FEATURE_246 Part A2). */
|
|
3114
|
+
interface WorkflowToolHostResult {
|
|
3115
|
+
readonly kind: 'declined' | 'started';
|
|
3116
|
+
/** declined: why the host/generator declined to run. */
|
|
3117
|
+
readonly reason?: string;
|
|
3118
|
+
/** started: the minted run id. */
|
|
3119
|
+
readonly runId?: string;
|
|
3120
|
+
/** started: terminal status once the run settled. */
|
|
3121
|
+
readonly status?: string;
|
|
3122
|
+
/** started: the run's displayable result text, when completed. */
|
|
3123
|
+
readonly resultText?: string;
|
|
3124
|
+
/** started: terminal error message, when failed. */
|
|
3125
|
+
readonly error?: string;
|
|
3126
|
+
/** started: names of child agents that completed but FAILED their sidecar
|
|
3127
|
+
* verification in warn-only mode (`agent_unverified`). The overall run still
|
|
3128
|
+
* settles as `completed`, so without surfacing these the Worker would act on
|
|
3129
|
+
* the result unaware that some verification failed. Empty/omitted = all
|
|
3130
|
+
* completed children verified (or none were verified). */
|
|
3131
|
+
readonly verificationWarnings?: readonly string[];
|
|
3132
|
+
}
|
|
3133
|
+
/**
|
|
3134
|
+
* Narrow ctx capability for launching workflows from a tool. Intentionally free
|
|
3135
|
+
* of any workflow-layer type import (keeps `types.ts` dependency-light); the
|
|
3136
|
+
* concrete implementation lives behind a lazy import in tool-execution-context.
|
|
3137
|
+
*/
|
|
3138
|
+
interface WorkflowToolHostInlineInput {
|
|
3139
|
+
readonly manifest: unknown;
|
|
3140
|
+
readonly source: string;
|
|
3141
|
+
readonly args?: unknown;
|
|
3142
|
+
readonly resumeFromRunId?: string;
|
|
3143
|
+
/**
|
|
3144
|
+
* Per-run abort signal, combined with the session signal. Lets the Worker stop
|
|
3145
|
+
* THIS running workflow (via task_stop on its task_id) without aborting the
|
|
3146
|
+
* whole session — so it can change the goal, stop, and re-run an improved script.
|
|
3147
|
+
*/
|
|
3148
|
+
readonly signal?: AbortSignal;
|
|
3149
|
+
}
|
|
3150
|
+
/**
|
|
3151
|
+
* Compact live view of a running workflow. Surfaced so the Worker can peek at a
|
|
3152
|
+
* background `run_workflow`'s progress via `task_output(runId)` while it is still
|
|
3153
|
+
* in flight (gap A) — otherwise it only ever sees the final `<task-completed>`.
|
|
3154
|
+
* Derived on demand from the run's process snapshot; deliberately free of any
|
|
3155
|
+
* workflow-layer type import so this module stays dependency-light.
|
|
3156
|
+
*/
|
|
3157
|
+
interface WorkflowRunProgressView {
|
|
3158
|
+
readonly status: 'running' | 'completed' | 'failed' | 'stopped';
|
|
3159
|
+
readonly workflowName: string;
|
|
3160
|
+
/** Active phase title (e.g. "Verify"), when the script uses phases. */
|
|
3161
|
+
readonly phase?: string;
|
|
3162
|
+
readonly phaseIndex?: number;
|
|
3163
|
+
readonly phaseTotal?: number;
|
|
3164
|
+
/** Names of the agents currently running. */
|
|
3165
|
+
readonly activeAgents: readonly string[];
|
|
3166
|
+
readonly completedAgents: number;
|
|
3167
|
+
readonly failedAgents: number;
|
|
3168
|
+
readonly stoppedAgents: number;
|
|
3169
|
+
readonly totalSpawned: number;
|
|
3170
|
+
readonly plannedAgents?: number;
|
|
3171
|
+
readonly elapsedMs?: number;
|
|
3172
|
+
}
|
|
3173
|
+
/** ADR-049: a started-but-not-awaited workflow handle. `done` resolves with the
|
|
3174
|
+
* terminal result when the run settles — the async run_workflow path registers it
|
|
3175
|
+
* in the Worker's childTaskRegistry so the idle-yield loop resumes the Worker with
|
|
3176
|
+
* the synthesis instead of blocking the turn. */
|
|
3177
|
+
type WorkflowToolHostStartResult = {
|
|
3178
|
+
readonly kind: 'declined';
|
|
3179
|
+
readonly reason?: string;
|
|
3180
|
+
} | {
|
|
3181
|
+
readonly kind: 'started';
|
|
3182
|
+
readonly runId: string;
|
|
3183
|
+
readonly done: Promise<WorkflowToolHostResult>;
|
|
3184
|
+
/** Gap A: on-demand live progress for a `task_output(runId)` peek while the
|
|
3185
|
+
* run is in flight. Absent when the host cannot snapshot the run. */
|
|
3186
|
+
readonly getProgress?: () => WorkflowRunProgressView | undefined;
|
|
3187
|
+
};
|
|
3188
|
+
interface WorkflowToolHost {
|
|
3189
|
+
/** Start an inline-authored workflow ({manifest, source}) and await its result.
|
|
3190
|
+
* `resumeFromRunId` (FEATURE_246 Part D) seeds the result cache from a prior
|
|
3191
|
+
* run so unchanged effects replay and only changed ones re-run live. */
|
|
3192
|
+
runInline(input: WorkflowToolHostInlineInput): Promise<WorkflowToolHostResult>;
|
|
3193
|
+
/** ADR-049: start the workflow and return immediately with a `done` promise,
|
|
3194
|
+
* without blocking the calling turn. The async/idle-yield run_workflow path uses
|
|
3195
|
+
* this; `runInline` is just `startInline` + `await done`. */
|
|
3196
|
+
startInline(input: WorkflowToolHostInlineInput): Promise<WorkflowToolHostStartResult>;
|
|
2721
3197
|
}
|
|
2722
3198
|
|
|
2723
3199
|
/**
|
|
@@ -2869,5 +3345,5 @@ interface CreateBashPrefixExtractorOptions {
|
|
|
2869
3345
|
*/
|
|
2870
3346
|
declare function createBashPrefixExtractor(opts: CreateBashPrefixExtractorOptions): BashPrefixExtractor;
|
|
2871
3347
|
|
|
2872
|
-
export { BASH_POLICY_SPEC as B,
|
|
2873
|
-
export type {
|
|
3348
|
+
export { BASH_POLICY_SPEC as B, LSP_SERVERS as av, LspService as ax, buildGoalRuntimeBinding as b0, createBashPrefixExtractor as b1, decideWorkflowInvocation as b2, extractCommandPrefix as b3, getDefaultLspService as b4, makeDisabledGoalToolsContext as b5, providerResilienceConfigFromTimeouts as b6, shutdownDefaultLspService as b7, withGoalBeforeNextTurn as b8, withGoalStopHook as b9, workflowStartOutcomeConsumesTurn as ba };
|
|
3349
|
+
export type { KodaXRuntimeVerificationContract as $, KodaXManagedTask as A, CapabilityRuntimeContract as C, DiagnosticsRequest as D, ExtensionRuntimeContract as E, FailureStage as F, GoalBlockedResult as G, KodaXManagedTaskRuntimeState as H, KodaXManagedTaskStatusEvent as I, KodaXManualSource as J, KodaXActivityEventMeta as K, KodaXManualTopic as L, KodaXManualTopicId as M, KodaXManualTopicInput as N, KodaXMemoryStrategy as O, KodaXOptions as P, KodaXOrchestrationVerdict as Q, KodaXParentReductionContract as R, KodaXProviderPolicyHints as S, KodaXRepoIntelligenceCapability as T, KodaXRepoIntelligenceMode as U, KodaXRepoIntelligenceResolvedMode as V, KodaXRepoIntelligenceTrace as W, KodaXRepoIntelligenceTraceEvent as X, KodaXRepoRoutingSignals as Y, KodaXResult as Z, KodaXRoleRoundSummary as _, BashPrefixExtractor as a, WorkflowToolHostStartResult as a$, KodaXSelfManualConfig as a0, KodaXSessionControl as a1, KodaXSessionMutators as a2, KodaXSessionOptions as a3, KodaXSidecarMessageEvent as a4, KodaXSkillInvocationContext as a5, KodaXSkillMap as a6, KodaXSkillProjectionConfidence as a7, KodaXTaskCapabilityHint as a8, KodaXTaskContract as a9, ProviderRecoveryEvent as aA, ProviderResilienceConfig as aB, ProviderResiliencePolicy as aC, RecoveryAction as aD, RecoveryDecision as aE, RecoveryLadderStep as aF, RecoveryResult as aG, ResilienceClassification as aH, ResilienceErrorClass as aI, ResolveKodaXManualInput as aJ, ResolveKodaXManualOptions as aK, ResolveKodaXManualResult as aL, RuntimeDefaultsSnapshot as aM, TodoItem as aN, TodoList as aO, TodoStatus as aP, ToolSideEffect as aQ, WorkflowHostPolicy as aR, WorkflowInvocationAction as aS, WorkflowInvocationPolicyDecision as aT, WorkflowInvocationPolicyInput as aU, WorkflowInvocationSource as aV, WorkflowRunProgressView as aW, WorkflowStartOutcome as aX, WorkflowToolHost as aY, WorkflowToolHostInlineInput as aZ, WorkflowToolHostResult as a_, KodaXTaskEvidenceArtifact as aa, KodaXTaskEvidenceBundle as ab, KodaXTaskEvidenceEntry as ac, KodaXTaskRole as ad, KodaXTaskRoleAssignment as ae, KodaXTaskStatus as af, KodaXTaskSurface as ag, KodaXTaskToolPolicy as ah, KodaXTaskVerificationContract as ai, KodaXTaskVerificationCriterion as aj, KodaXTaskWorkItem as ak, KodaXTimeoutConfig as al, KodaXToolEventMeta as am, KodaXToolExecutionContext as an, KodaXToolVisibilityMeta as ao, KodaXToolVisibilityPolicy as ap, KodaXVerificationScorecard as aq, KodaXVerificationScorecardCriterion as ar, KodaXWorkflowAgentDigestEvent as as, KodaXWorkflowEventMeta as at, KodaXWorkflowTimeoutConfig as au, LspServerInfo as aw, LspServiceConfig as ay, ProviderExecutionState as az, BashPrefixResult as b, BoundExtensionRuntimeController as c, ChildSnapshotEvent as d, CreateBashPrefixExtractorOptions as e, ExtractCommandPrefixOptions as f, GoalCompleteResult as g, GoalCreateInput as h, GoalLifecycleContext as i, GoalRuntimeBinding as j, GoalRuntimeBindingDeps as k, GoalToolsContext as l, KodaXAgentMode as m, KodaXAgentProfile as n, KodaXBudgetDisclosureZone as o, KodaXBudgetExtensionRequest as p, KodaXChildAgentResult as q, KodaXChildContextBundle as r, KodaXChildExecutionResult as s, KodaXCompactionOverride as t, KodaXContextOptions as u, KodaXContextTokenSnapshot as v, KodaXEffectiveTaskConfig as w, KodaXEvents as x, KodaXManagedBudgetSnapshot as y, KodaXManagedProtocolPayload as z };
|