@kodax-ai/kodax 0.7.57 → 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 -1920
- package/README.md +31 -25
- package/README_CN.md +22 -15
- 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-LZKGOR2C.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-4SHP3M67.js → chunk-CV6JHPEO.js} +1 -1
- 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-YSVPF6SN.js → chunk-QHWXPJEG.js} +268 -264
- 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-55B7Q5RX.js → construction-bootstrap-CIXFH5SE.js} +1 -1
- 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-Y4DVUWSM.js +2 -0
- package/dist/chunks/run-manager-4H5HWMVW.js +2 -0
- package/dist/chunks/utils-FLVVQHM7.js +2 -0
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2 -2
- package/dist/kodax_cli.js +1206 -1036
- package/dist/sdk-agent.d.ts +153 -12
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +186 -186
- 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.js +1 -1
- package/dist/sdk-media.d.ts +18 -2
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +20 -22
- 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/types-chunks/{base.d-BnjQrSVf.d.ts → base.d-BA9Doaj_.d.ts} +3 -3
- package/dist/types-chunks/{bash-prefix-extractor.d-BgvMbfq6.d.ts → bash-prefix-extractor.d-D3cddmyV.d.ts} +490 -69
- 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-C1DhxnvC.d.ts → guardrail.d-iK7FwMdW.d.ts} +4 -4
- package/dist/types-chunks/{process.d-BZncyzEj.d.ts → process.d-DHow2y2G.d.ts} +169 -14
- package/dist/types-chunks/{resolver.d-ZvKQgl0X.d.ts → resolver.d-DDOfVYDr.d.ts} +31 -2
- package/dist/types-chunks/{capsule.d-DwJp5r63.d.ts → run-manager.d-ByDcJc5g.d.ts} +113 -5
- package/dist/types-chunks/{sdk-session-DAScB0rW.d.ts → sdk-session-21Tt3N_x.d.ts} +72 -9
- package/dist/types-chunks/{storage.d-CPvn9qI0.d.ts → storage.d-BsZrBPYu.d.ts} +2 -2
- package/dist/types-chunks/{types.d-6VOXvF88.d.ts → types.d-Ci5YPFEh.d.ts} +39 -5
- package/dist/types-chunks/{guardrail.d-BP3yyr6u.d.ts → types.d-D4ZA8LJV.d.ts} +125 -3
- package/dist/types-chunks/{utils.d-CpgVIjYZ.d.ts → utils.d-BURxOxFd.d.ts} +83 -6
- package/package.json +2 -2
- package/dist/chunks/agent-EHWQZA4C.js +0 -2
- package/dist/chunks/argument-completer-AYDAYGKL.js +0 -2
- package/dist/chunks/chunk-3WWPJGPQ.js +0 -2
- package/dist/chunks/chunk-KN6IJMTB.js +0 -636
- package/dist/chunks/chunk-MJFPFRGK.js +0 -423
- package/dist/chunks/chunk-N2N2W3AQ.js +0 -584
- package/dist/chunks/chunk-PCPFLPS4.js +0 -5
- package/dist/chunks/chunk-TCLSPUTR.js +0 -31
- package/dist/chunks/chunk-VACH6QWN.js +0 -315
- package/dist/chunks/compaction-config-TLDMFMZO.js +0 -2
- package/dist/chunks/dist-IE4HVWP7.js +0 -2
- package/dist/chunks/dist-IKOK2MJQ.js +0 -2
- package/dist/chunks/paste-WTL2XN7P.js +0 -2
- package/dist/chunks/utils-EJ2VCRTC.js +0 -2
- package/dist/types-chunks/types.d-D8WcfrOD.d.ts +0 -143
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as PermissionMode,
|
|
2
|
-
import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock } from './types.d-
|
|
3
|
-
import { m as KodaXAgentMode } from './bash-prefix-extractor.d-
|
|
4
|
-
import {
|
|
1
|
+
import { b as PermissionMode, F as FileSessionStorage, S as SessionData } from './storage.d-BsZrBPYu.js';
|
|
2
|
+
import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock } from './types.d-Ci5YPFEh.js';
|
|
3
|
+
import { m as KodaXAgentMode } from './bash-prefix-extractor.d-D3cddmyV.js';
|
|
4
|
+
import { ai as KodaXSessionUiHistoryItem, am as KodaXSessionUiToolCall } from './process.d-DHow2y2G.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* TextBuffer - Text buffer management class - 文本缓冲区管理类
|
|
@@ -540,7 +540,7 @@ interface ToolCall {
|
|
|
540
540
|
* History item type - 历史项类型
|
|
541
541
|
* Reference: Gemini CLI HistoryItem - 参考: Gemini CLI HistoryItem
|
|
542
542
|
*/
|
|
543
|
-
type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinking" | "error" | "event" | "info" | "hint";
|
|
543
|
+
type HistoryItemType = "user" | "assistant" | "system" | "tool_group" | "thinking" | "error" | "event" | "info" | "hint" | "sidecar";
|
|
544
544
|
/**
|
|
545
545
|
* History item base class - 历史项基类
|
|
546
546
|
*/
|
|
@@ -624,15 +624,30 @@ interface HistoryItemHint extends HistoryItemBase {
|
|
|
624
624
|
type: "hint";
|
|
625
625
|
text: string;
|
|
626
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Sidecar Verifier message - Sidecar 验证器消息
|
|
629
|
+
* Displayed as an independent "role" with its own header so the user can
|
|
630
|
+
* clearly see that the Sidecar Verifier is actively reviewing the output.
|
|
631
|
+
* verdict: 'revise' | 'blocked' | undefined; delivery 'budget-exhausted' means
|
|
632
|
+
* the verifier ran out of budget before returning a verdict.
|
|
633
|
+
*/
|
|
634
|
+
interface HistoryItemSidecar extends HistoryItemBase {
|
|
635
|
+
type: "sidecar";
|
|
636
|
+
text: string;
|
|
637
|
+
/** 'revise' or 'blocked'; absent when delivery === 'budget-exhausted' */
|
|
638
|
+
verdict?: "revise" | "blocked";
|
|
639
|
+
/** Set when the verifier exhausted its token budget before reaching a verdict */
|
|
640
|
+
delivery?: "budget-exhausted";
|
|
641
|
+
}
|
|
627
642
|
/**
|
|
628
643
|
* Union type of all history items - 所有历史项的联合类型
|
|
629
644
|
*/
|
|
630
|
-
type HistoryItem = HistoryItemUser | HistoryItemAssistant | HistoryItemSystem | HistoryItemToolGroup | HistoryItemThinking | HistoryItemError | HistoryItemEvent | HistoryItemInfo | HistoryItemHint;
|
|
645
|
+
type HistoryItem = HistoryItemUser | HistoryItemAssistant | HistoryItemSystem | HistoryItemToolGroup | HistoryItemThinking | HistoryItemError | HistoryItemEvent | HistoryItemInfo | HistoryItemHint | HistoryItemSidecar;
|
|
631
646
|
/**
|
|
632
647
|
* Creatable history item types (with text property) - 可创建的历史项类型(带 text 属性)
|
|
633
648
|
* Used for addHistoryItem function parameter type - 用于 addHistoryItem 等函数的参数类型
|
|
634
649
|
*/
|
|
635
|
-
type CreatableHistoryItem = Omit<HistoryItemUser, "id" | "timestamp"> | Omit<HistoryItemAssistant, "id" | "timestamp"> | Omit<HistoryItemSystem, "id" | "timestamp"> | Omit<HistoryItemThinking, "id" | "timestamp"> | Omit<HistoryItemError, "id" | "timestamp"> | Omit<HistoryItemEvent, "id" | "timestamp"> | Omit<HistoryItemInfo, "id" | "timestamp"> | Omit<HistoryItemHint, "id" | "timestamp"> | Omit<HistoryItemToolGroup, "id" | "timestamp">;
|
|
650
|
+
type CreatableHistoryItem = Omit<HistoryItemUser, "id" | "timestamp"> | Omit<HistoryItemAssistant, "id" | "timestamp"> | Omit<HistoryItemSystem, "id" | "timestamp"> | Omit<HistoryItemThinking, "id" | "timestamp"> | Omit<HistoryItemError, "id" | "timestamp"> | Omit<HistoryItemEvent, "id" | "timestamp"> | Omit<HistoryItemInfo, "id" | "timestamp"> | Omit<HistoryItemHint, "id" | "timestamp"> | Omit<HistoryItemSidecar, "id" | "timestamp"> | Omit<HistoryItemToolGroup, "id" | "timestamp">;
|
|
636
651
|
/**
|
|
637
652
|
* UI global state interface - UI 全局状态接口
|
|
638
653
|
* Reference: Gemini CLI UIStateContext - 参考: Gemini CLI UIStateContext
|
|
@@ -757,6 +772,50 @@ declare function extractTitle(messages: KodaXMessage[]): string;
|
|
|
757
772
|
*/
|
|
758
773
|
declare function formatMessagePreview(content: string, maxLength?: number): string;
|
|
759
774
|
|
|
775
|
+
/**
|
|
776
|
+
* FEATURE_247 (R6) — imperative session compaction.
|
|
777
|
+
*
|
|
778
|
+
* Lets an SDK embedder (KodaX-Space) compact a session by id immediately —
|
|
779
|
+
* e.g. when the user clicks a "/compact" button — instead of forging a token
|
|
780
|
+
* snapshot or appending an empty message to trip auto-compaction. Loads the
|
|
781
|
+
* session, runs the same `compact()` pass the REPL `/compact` command uses,
|
|
782
|
+
* applies the result to the session lineage (so `loadFullTranscript` / resume
|
|
783
|
+
* see the compaction entry), and writes it back.
|
|
784
|
+
*
|
|
785
|
+
* Applies uniformly to Partner and Coder sessions. Never throws — failures
|
|
786
|
+
* return `{ compacted: false, reason }`.
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
interface CompactSessionOptions {
|
|
790
|
+
/** Provider alias for the summarizer. Defaults to the session's persisted provider, then 'anthropic'. */
|
|
791
|
+
readonly provider?: string;
|
|
792
|
+
/** Model override forwarded to the summarizer. */
|
|
793
|
+
readonly model?: string;
|
|
794
|
+
/** Custom summarizer instructions (same as `/compact <text>`). */
|
|
795
|
+
readonly customInstructions?: string;
|
|
796
|
+
/** Provider context-window override (tokens). Otherwise resolved from the provider/model. */
|
|
797
|
+
readonly contextWindow?: number;
|
|
798
|
+
/** Sessions directory (mirrors createSessionManager's override). */
|
|
799
|
+
readonly sessionsDir?: string;
|
|
800
|
+
/** Injected storage instance (takes precedence over sessionsDir). */
|
|
801
|
+
readonly storage?: FileSessionStorage;
|
|
802
|
+
}
|
|
803
|
+
interface CompactSessionResult {
|
|
804
|
+
/** True when the session was actually rewritten. */
|
|
805
|
+
readonly compacted: boolean;
|
|
806
|
+
readonly tokensBefore: number;
|
|
807
|
+
readonly tokensAfter: number;
|
|
808
|
+
/** The rewritten (or unchanged) message list. */
|
|
809
|
+
readonly messages: KodaXMessage[];
|
|
810
|
+
/** Populated when `compacted` is false to explain why (not-found / no-op / error). */
|
|
811
|
+
readonly reason?: string;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Compact a session by id, writing the result (lineage + messages) back to
|
|
815
|
+
* storage. Never throws.
|
|
816
|
+
*/
|
|
817
|
+
declare function compactSession(sessionId: string, options?: CompactSessionOptions): Promise<CompactSessionResult>;
|
|
818
|
+
|
|
760
819
|
/**
|
|
761
820
|
* FEATURE_173 Part B (v0.7.42) — Session Management Public SDK.
|
|
762
821
|
*
|
|
@@ -777,6 +836,8 @@ interface SessionSummary {
|
|
|
777
836
|
readonly runtimeInfo?: {
|
|
778
837
|
workspaceRoot?: string;
|
|
779
838
|
gitRoot?: string;
|
|
839
|
+
surface?: string;
|
|
840
|
+
profileId?: string;
|
|
780
841
|
};
|
|
781
842
|
/**
|
|
782
843
|
* FEATURE_219 (v0.7.46) — the per-project directory key this session lives
|
|
@@ -848,6 +909,8 @@ interface SessionManager {
|
|
|
848
909
|
unarchiveSession: typeof unarchiveSession;
|
|
849
910
|
listRunningSessions: typeof listRunningSessions;
|
|
850
911
|
watchSessions: typeof watchSessions;
|
|
912
|
+
/** FEATURE_247 (R6) — imperatively compact a session by id (writes lineage + emits nothing; returns stats). */
|
|
913
|
+
compactSession: typeof compactSession;
|
|
851
914
|
/**
|
|
852
915
|
* v0.7.43 — the raw write-side storage instance. SDK embedders pass
|
|
853
916
|
* this into `runKodaX({ session: { id, scope, storage } })` so the
|
|
@@ -975,5 +1038,5 @@ declare function createSessionManager(opts?: {
|
|
|
975
1038
|
sessionsDir?: string;
|
|
976
1039
|
}): SessionManager;
|
|
977
1040
|
|
|
978
|
-
export { DEFAULT_UI_STATE as D, StreamingState as
|
|
979
|
-
export type {
|
|
1041
|
+
export { DEFAULT_UI_STATE as D, StreamingState as O, TOOL_STATUS_ICONS as T, TextBuffer as U, ToolCallStatus as _, archiveSession as a5, createSessionManager as a6, deleteSession as a7, extractHistorySeedsFromMessage as a8, extractHistorySeedsFromMessages as a9, extractTextContent as aa, extractTitle as ab, forkSession as ac, formatMessagePreview as ad, listRunningSessions as ae, listSessions as af, loadFullTranscript as ag, loadSession as ah, restoreHistoryItemsFromSession as ai, rewindSession as aj, seedToHistoryItem as ak, setActiveEntry as al, toolCallSeedToHistoryToolCall as am, trimPersistedUiHistorySnapshot as an, unarchiveSession as ao, watchSessions as ap, KeypressHandlerPriority as v };
|
|
1042
|
+
export type { UIActions as $, AppProps as A, RunningSessionInfo as B, Completer as C, SessionSummary as E, FullTranscriptSessionData as F, SessionTranscriptEntry as G, HistoryEntry as H, InputPromptProps as I, SessionTranscriptEntryType as J, KeyInfo as K, LegacyMessageListProps as L, Message as M, StatusBarProps as N, PastedContent as P, Suggestion as Q, RestoreHistoryItemsFromSessionInput as R, SessionManager as S, TextBufferOptions as V, Theme as W, ThemeColors as X, ThemeSymbols as Y, ToolCall as Z, AppState as a, UIState as a0, UseTextBufferReturn as a1, VisualCursor as a2, VisualLayout as a3, WatchSessionsCallback as a4, Completion as b, CreatableHistoryItem as c, CursorPosition as d, DeleteSessionResult as e, HistoryItem as f, HistoryItemAssistant as g, HistoryItemBase as h, HistoryItemError as i, HistoryItemEvent as j, HistoryItemHint as k, HistoryItemInfo as l, HistoryItemSidecar as m, HistoryItemSystem as n, HistoryItemThinking as o, HistoryItemToolGroup as p, HistoryItemType as q, HistoryItemUser as r, HistorySeedSourceMessage as s, KeypressEvent as t, KeypressHandler as u, ListSessionsOptions as w, PromptEditingMode as x, PromptSubmitPayload as y, RestoredHistorySeed as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-
|
|
2
|
-
import {
|
|
1
|
+
import { a as BashPrefixExtractor } from './bash-prefix-extractor.d-D3cddmyV.js';
|
|
2
|
+
import { a5 as KodaXSessionData, aa as KodaXSessionLineage, ad as KodaXSessionNavigationOptions, ae as KodaXSessionRuntimeInfo, ag as KodaXSessionStorage } from './process.d-DHow2y2G.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Permission Types
|
|
@@ -12,6 +12,31 @@ interface KodaXToolUseBlock {
|
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
14
|
input: Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Set true when `input` was salvaged from malformed JSON (strict `JSON.parse`
|
|
17
|
+
* threw). RAW signal — set regardless of stop reason. On its own it means the
|
|
18
|
+
* payload is syntactically suspect: even a "complete" turn can carry malformed
|
|
19
|
+
* JSON (e.g. unescaped quotes) that the partial-json salvage silently truncates
|
|
20
|
+
* mid-value. `checkIncompleteToolCalls` therefore treats a salvaged input on a
|
|
21
|
+
* MUTATING tool (write/edit/bash — `isToolMutation`) as incomplete even on a
|
|
22
|
+
* clean stop, because executing a silently-cut payload corrupts files; a
|
|
23
|
+
* salvaged input on a read-only tool is allowed through on a clean stop.
|
|
24
|
+
*/
|
|
25
|
+
_salvaged?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Set true when `input` was salvaged AND the stream did NOT end on a
|
|
28
|
+
* recognized clean stop (`max_tokens`/`length`, or an ambiguous/`unknown`
|
|
29
|
+
* stop). A truncating stop means the payload may be cut mid-value, so this is
|
|
30
|
+
* unsafe to execute for ANY tool (not just mutating ones) — the agent loop
|
|
31
|
+
* routes it into the incomplete-tool retry (CAP-072). Subset of `_salvaged`.
|
|
32
|
+
*
|
|
33
|
+
* Both markers are internal: provider serializers never write them to the wire
|
|
34
|
+
* (they read only type/id/name/input). They may transiently remain on an
|
|
35
|
+
* assistant tool_use block in session history on the retry-cap path; harmless
|
|
36
|
+
* and never reaches the model. Mirrors the `KodaXMessage._synthetic`
|
|
37
|
+
* convention.
|
|
38
|
+
*/
|
|
39
|
+
_truncated?: boolean;
|
|
15
40
|
}
|
|
16
41
|
/**
|
|
17
42
|
* Tool-result content blocks — a structural subset of the full
|
|
@@ -93,6 +118,14 @@ interface KodaXMessage {
|
|
|
93
118
|
content: string | KodaXContentBlock[];
|
|
94
119
|
/** Marks messages injected by the system (auto-continue, retry prompts). Hidden in REPL display. */
|
|
95
120
|
_synthetic?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Identifies which subsystem injected a synthetic message so consumers can
|
|
123
|
+
* render/attribute it distinctly instead of treating it like a user query.
|
|
124
|
+
* Absent on genuine user/assistant/system messages. Known values include
|
|
125
|
+
* `'sidecar-verifier'` (Sidecar Verifier revise feedback). Exposed verbatim
|
|
126
|
+
* through `KodaXResult.messages` and session-load APIs for SDK consumers.
|
|
127
|
+
*/
|
|
128
|
+
_source?: string;
|
|
96
129
|
}
|
|
97
130
|
interface KodaXTokenUsage {
|
|
98
131
|
inputTokens: number;
|
|
@@ -133,7 +166,7 @@ interface KodaXReasoningEffortPreset {
|
|
|
133
166
|
readonly isDefault?: boolean;
|
|
134
167
|
readonly isUserVisible?: boolean;
|
|
135
168
|
}
|
|
136
|
-
type KodaXReasoningEffortWireStrategy = 'openai-responses-effort' | 'openai-chat-effort' | 'codex-cli-config' | 'anthropic-output-effort' | 'provider-budget' | 'provider-toggle' | 'prompt-only' | 'none';
|
|
169
|
+
type KodaXReasoningEffortWireStrategy = 'openai-responses-effort' | 'openai-chat-effort' | 'codex-cli-config' | 'anthropic-output-effort' | 'anthropic-reasoning-effort' | 'provider-budget' | 'provider-toggle' | 'prompt-only' | 'none';
|
|
137
170
|
type KodaXThinkingWireStrategy = 'anthropic-adaptive' | 'anthropic-budget' | 'provider-budget' | 'provider-toggle' | 'none';
|
|
138
171
|
interface KodaXReasoningProfile {
|
|
139
172
|
readonly reasoningPreset?: KodaXReasoningPresetName;
|
|
@@ -540,10 +573,11 @@ interface KodaXProviderStreamOptions {
|
|
|
540
573
|
}) => void;
|
|
541
574
|
/** 会话标识,用于多轮对话上下文恢复 */
|
|
542
575
|
/**
|
|
543
|
-
* Passive capability learning
|
|
544
|
-
* reasoning-effort value (400/422 naming the param).
|
|
545
|
-
*
|
|
546
|
-
* offered or sent again (see
|
|
576
|
+
* Passive capability learning: fired when a provider HARD-rejects a
|
|
577
|
+
* reasoning-effort value (400/422 naming the param). Hosts can record it via
|
|
578
|
+
* the agent-layer capability cache so the rung is removed from the effective
|
|
579
|
+
* ladder and never offered or sent again (see
|
|
580
|
+
* `classifyReasoningEffortRejection`).
|
|
547
581
|
*/
|
|
548
582
|
onReasoningEffortRejected?: (event: {
|
|
549
583
|
provider: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z as Guardrail, aO as RunnerToolCall, e as Agent, g as AgentMessage, aR as RunnerToolResult, a_ as Span, _ as KodaXInputArtifact } from './process.d-DHow2y2G.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Guardrail Runtime — FEATURE_085 (v0.7.26).
|
|
@@ -151,5 +151,127 @@ declare function runToolBeforeGuardrails(call: RunnerToolCall, guardrails: reado
|
|
|
151
151
|
*/
|
|
152
152
|
declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerToolResult, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<RunnerToolResult>;
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
/**
|
|
155
|
+
* @kodax-ai/agent/messaging — Message queue types
|
|
156
|
+
*
|
|
157
|
+
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
158
|
+
*
|
|
159
|
+
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
160
|
+
* specific). Downstream consumers:
|
|
161
|
+
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
162
|
+
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
163
|
+
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
164
|
+
*
|
|
165
|
+
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
166
|
+
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
type MessagePriority = 'user' | 'background';
|
|
170
|
+
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
171
|
+
type QueuedInputArtifact = KodaXInputArtifact;
|
|
172
|
+
interface QueuedMessage {
|
|
173
|
+
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
174
|
+
readonly id: string;
|
|
175
|
+
readonly priority: MessagePriority;
|
|
176
|
+
/**
|
|
177
|
+
* Routing key:
|
|
178
|
+
* undefined = main thread / coordinator agent
|
|
179
|
+
* 'agent-id-XYZ' = subagent / specific consumer
|
|
180
|
+
*
|
|
181
|
+
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
182
|
+
* undefined-agentId messages, not "any agent".
|
|
183
|
+
*/
|
|
184
|
+
readonly agentId?: string;
|
|
185
|
+
readonly mode: MessageMode;
|
|
186
|
+
readonly content: string;
|
|
187
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
188
|
+
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
189
|
+
readonly enqueuedAt: number;
|
|
190
|
+
}
|
|
191
|
+
interface DequeueFilter {
|
|
192
|
+
/**
|
|
193
|
+
* Only return messages with this agentId.
|
|
194
|
+
* undefined matches messages with no agentId (main-thread messages only).
|
|
195
|
+
*/
|
|
196
|
+
readonly agentId?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Highest priority level included in the drain.
|
|
199
|
+
* 'user' → only user priority drained, background stays queued
|
|
200
|
+
* 'background' → both user + background drained (Sleep-gated case)
|
|
201
|
+
*/
|
|
202
|
+
readonly maxPriority: MessagePriority;
|
|
203
|
+
/**
|
|
204
|
+
* Optional cap on number of messages drained in this call.
|
|
205
|
+
* Defaults to unlimited (drains all matching).
|
|
206
|
+
*/
|
|
207
|
+
readonly limit?: number;
|
|
208
|
+
/**
|
|
209
|
+
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
210
|
+
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
211
|
+
* input vs `mode:'task-notification'` for child completion banners)
|
|
212
|
+
* without separate queues. When omitted, all modes match.
|
|
213
|
+
*/
|
|
214
|
+
readonly mode?: MessageMode;
|
|
215
|
+
/**
|
|
216
|
+
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
217
|
+
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
218
|
+
* other filters still apply (agentId / priority / mode mismatches still
|
|
219
|
+
* skip the message), so callers can't accidentally remove a message
|
|
220
|
+
* outside their scope.
|
|
221
|
+
*/
|
|
222
|
+
readonly id?: string;
|
|
223
|
+
/**
|
|
224
|
+
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
225
|
+
* the structured filters. Lets SDK consumers express conditions the
|
|
226
|
+
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
227
|
+
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
228
|
+
* code should prefer the typed fields for readability; this is the
|
|
229
|
+
* "data-driven main path + predicate escape" pattern.
|
|
230
|
+
*
|
|
231
|
+
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
232
|
+
* inspects `message.content` never runs on messages outside the
|
|
233
|
+
* caller's `agentId` / `mode` / `id` scope.
|
|
234
|
+
*/
|
|
235
|
+
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
239
|
+
*
|
|
240
|
+
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
241
|
+
* affected messages so SDK observability consumers (logging, tracing,
|
|
242
|
+
* metrics) can react per-event without re-diffing snapshots.
|
|
243
|
+
*
|
|
244
|
+
* Event granularity rules:
|
|
245
|
+
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
246
|
+
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
247
|
+
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
248
|
+
* (filter matched nothing) fire no event — quiet by design so the
|
|
249
|
+
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
250
|
+
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
251
|
+
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
252
|
+
*
|
|
253
|
+
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
254
|
+
* only needs the change signal); SDK / tracer consumers read the event.
|
|
255
|
+
*/
|
|
256
|
+
type QueueEvent = {
|
|
257
|
+
readonly kind: 'enqueued';
|
|
258
|
+
readonly message: QueuedMessage;
|
|
259
|
+
} | {
|
|
260
|
+
readonly kind: 'dequeued';
|
|
261
|
+
readonly messages: readonly QueuedMessage[];
|
|
262
|
+
} | {
|
|
263
|
+
readonly kind: 'cleared';
|
|
264
|
+
readonly messages: readonly QueuedMessage[];
|
|
265
|
+
};
|
|
266
|
+
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
267
|
+
type QueueEventListener = (event: QueueEvent) => void;
|
|
268
|
+
interface EnqueueInput {
|
|
269
|
+
readonly priority: MessagePriority;
|
|
270
|
+
readonly mode: MessageMode;
|
|
271
|
+
readonly content: string;
|
|
272
|
+
readonly agentId?: string;
|
|
273
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export { GuardrailBlockedError as G, GuardrailEscalateError as b, collectGuardrails as h, runOutputGuardrails as i, runToolAfterGuardrails as j, runToolBeforeGuardrails as k, runInputGuardrails as r };
|
|
277
|
+
export type { DequeueFilter as D, EnqueueInput as E, InputGuardrail as I, MessageMode as M, OutputGuardrail as O, QueueEventListener as Q, ToolBeforeOutcome as T, GuardrailContext as a, GuardrailVerdict as c, MessagePriority as d, QueuedInputArtifact as e, QueuedMessage as f, ToolGuardrail as g };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as SessionStorage$1, b as PermissionMode } from './storage.d-
|
|
3
|
-
import {
|
|
4
|
-
import { j as KodaXMessage, E as KodaXReasoningMode, o as KodaXProviderCapabilityProfile, d as KodaXCustomProviderConfig } from './types.d-
|
|
5
|
-
import { A as AgentsFile, f as AutoModeStats, l as KodaXMcpServersConfig } from './guardrail.d-
|
|
1
|
+
import { P as KodaXOptions, v as KodaXContextTokenSnapshot, m as KodaXAgentMode, U as KodaXRepoIntelligenceMode, a5 as KodaXSkillInvocationContext } from './bash-prefix-extractor.d-D3cddmyV.js';
|
|
2
|
+
import { c as SessionStorage$1, b as PermissionMode } from './storage.d-BsZrBPYu.js';
|
|
3
|
+
import { ai as KodaXSessionUiHistoryItem, aa as KodaXSessionLineage, a2 as KodaXSessionArtifactLedgerEntry, R as KodaXExtensionSessionState, Q as KodaXExtensionSessionRecord, ae as KodaXSessionRuntimeInfo, ag as KodaXSessionStorage, a5 as KodaXSessionData, bL as WorkflowProcessSource } from './process.d-DHow2y2G.js';
|
|
4
|
+
import { j as KodaXMessage, E as KodaXReasoningMode, o as KodaXProviderCapabilityProfile, d as KodaXCustomProviderConfig } from './types.d-Ci5YPFEh.js';
|
|
5
|
+
import { A as AgentsFile, f as AutoModeStats, l as KodaXMcpServersConfig } from './guardrail.d-iK7FwMdW.js';
|
|
6
6
|
import * as readline from 'readline';
|
|
7
7
|
import { SpawnSyncReturns } from 'child_process';
|
|
8
8
|
|
|
@@ -277,6 +277,14 @@ interface CommandInvocationRequest extends CommandExecutionMetadata {
|
|
|
277
277
|
displayName: string;
|
|
278
278
|
path?: string;
|
|
279
279
|
skillInvocation?: KodaXSkillInvocationContext;
|
|
280
|
+
/**
|
|
281
|
+
* FEATURE_246: per-turn agent-mode elevation for this invocation only.
|
|
282
|
+
* The `/workflow` command in AMA sets this to `'amaw'` so its authoring turn
|
|
283
|
+
* gets `run_workflow` (scout-then-author) — matching AMAW's capability without
|
|
284
|
+
* making plain AMA self-activate workflows from natural language. The session
|
|
285
|
+
* mode is unchanged; only this one turn runs elevated.
|
|
286
|
+
*/
|
|
287
|
+
agentModeOverride?: KodaXAgentMode;
|
|
280
288
|
}
|
|
281
289
|
interface CommandWorkflowInvocationRequest {
|
|
282
290
|
request: string;
|
|
@@ -458,7 +466,55 @@ declare function loadConfig(): {
|
|
|
458
466
|
* layer, which has no config access. Set via the `/fallback` command.
|
|
459
467
|
*/
|
|
460
468
|
fallbackProviders?: string[];
|
|
469
|
+
/**
|
|
470
|
+
* Per-agent model TIERS for the workflow / dispatch `model_hint` (M2 config
|
|
471
|
+
* surface). Operators point a tier at a concrete provider+model; a workflow
|
|
472
|
+
* script / dispatch then expresses intent via `modelHint: 'fast' | 'deep'`.
|
|
473
|
+
* 'fast' routes read-only children only (write/codegen stays on the parent —
|
|
474
|
+
* a quality guard); 'deep' routes any child. Mirrored to
|
|
475
|
+
* KODAX_FAST/DEEP_PROVIDER/MODEL for the coding layer (which has no config
|
|
476
|
+
* access); env wins if pre-set. An unset tier inherits the parent model.
|
|
477
|
+
*/
|
|
478
|
+
fastProvider?: string;
|
|
479
|
+
fastModel?: string;
|
|
480
|
+
deepProvider?: string;
|
|
481
|
+
deepModel?: string;
|
|
482
|
+
/**
|
|
483
|
+
* Config surface for settings the coding/llm layer reads only via env (it has
|
|
484
|
+
* no config access). Bridged to their KODAX_* env vars in prepareRuntimeConfig
|
|
485
|
+
* (env-wins). See CONFIG_ENV_BRIDGES for the mapping.
|
|
486
|
+
*/
|
|
487
|
+
maxOutputTokens?: number;
|
|
488
|
+
disablePromptCache?: boolean;
|
|
489
|
+
lsp?: boolean;
|
|
490
|
+
lspAutoDownload?: boolean;
|
|
491
|
+
acpLogLevel?: string;
|
|
492
|
+
sessionRetentionDays?: number;
|
|
493
|
+
repoIntelligence?: {
|
|
494
|
+
toolWaitMs?: number;
|
|
495
|
+
workerTimeoutMs?: number;
|
|
496
|
+
workerOldSpaceMb?: number;
|
|
497
|
+
storageDir?: string;
|
|
498
|
+
};
|
|
499
|
+
workflow?: {
|
|
500
|
+
maxConcurrency?: number;
|
|
501
|
+
};
|
|
461
502
|
};
|
|
503
|
+
/**
|
|
504
|
+
* F1 — first-launch onboarding. config.json must be STRICT JSON (no comments), so we
|
|
505
|
+
* cannot ship a self-documenting config.json. Instead, on first launch (no config.json
|
|
506
|
+
* yet) we write a heavily-commented `config.example.jsonc` REFERENCE file next to it.
|
|
507
|
+
* It is never loaded by KodaX — it exists purely so a new user can see the minimal
|
|
508
|
+
* fields and the inline guidance (especially custom-provider thinking/reasoning) and
|
|
509
|
+
* copy what they need into config.json.
|
|
510
|
+
*
|
|
511
|
+
* Returns the example path only when it was just created (so the caller can print a
|
|
512
|
+
* one-time pointer); returns undefined if config.json already exists, the example
|
|
513
|
+
* already exists, or the write failed. Never throws — a template-write failure must
|
|
514
|
+
* not block startup.
|
|
515
|
+
*/
|
|
516
|
+
declare const KODAX_EXAMPLE_CONFIG_FILE: string;
|
|
517
|
+
declare function ensureExampleConfigFile(): string | undefined;
|
|
462
518
|
declare function prepareRuntimeConfig(): ReturnType<typeof loadConfig>;
|
|
463
519
|
declare function saveConfig(config: {
|
|
464
520
|
provider?: string;
|
|
@@ -482,6 +538,27 @@ declare function saveConfig(config: {
|
|
|
482
538
|
stallLog?: boolean;
|
|
483
539
|
/** FEATURE_102 Phase 3 — cross-provider child fallback chain. */
|
|
484
540
|
fallbackProviders?: string[];
|
|
541
|
+
/** M2 — per-agent model tiers (workflow / dispatch model_hint). */
|
|
542
|
+
fastProvider?: string;
|
|
543
|
+
fastModel?: string;
|
|
544
|
+
deepProvider?: string;
|
|
545
|
+
deepModel?: string;
|
|
546
|
+
/** Config surface bridged to KODAX_* env for the coding/llm layer. */
|
|
547
|
+
maxOutputTokens?: number;
|
|
548
|
+
disablePromptCache?: boolean;
|
|
549
|
+
lsp?: boolean;
|
|
550
|
+
lspAutoDownload?: boolean;
|
|
551
|
+
acpLogLevel?: string;
|
|
552
|
+
sessionRetentionDays?: number;
|
|
553
|
+
repoIntelligence?: {
|
|
554
|
+
toolWaitMs?: number;
|
|
555
|
+
workerTimeoutMs?: number;
|
|
556
|
+
workerOldSpaceMb?: number;
|
|
557
|
+
storageDir?: string;
|
|
558
|
+
};
|
|
559
|
+
workflow?: {
|
|
560
|
+
maxConcurrency?: number;
|
|
561
|
+
};
|
|
485
562
|
}): void;
|
|
486
563
|
/**
|
|
487
564
|
* Get git root directory.
|
|
@@ -500,5 +577,5 @@ declare function saveConfig(config: {
|
|
|
500
577
|
declare function getGitRoot(cwd?: string): Promise<string | null>;
|
|
501
578
|
declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
|
|
502
579
|
|
|
503
|
-
export { BUILTIN_COMMANDS as B, KODAX_CONFIG_FILE as K, PREVIEW_MAX_LENGTH as P, KODAX_DIR as e,
|
|
580
|
+
export { touchContext as A, BUILTIN_COMMANDS as B, KODAX_CONFIG_FILE as K, PREVIEW_MAX_LENGTH as P, KODAX_DIR as e, KODAX_EXAMPLE_CONFIG_FILE as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, createInteractiveContext as i, ensureExampleConfigFile as j, executeCommand as k, getGitRoot as l, getProviderList as m, getProviderModel as n, getVersion as o, hydrateProcessEnvFromShell as p, isProviderConfigured as q, loadConfig as r, parseCommand as s, prepareRuntimeConfig as t, processSpecialSyntax as u, rateLimitedCall as v, registerConfiguredCustomProviders as w, runInkInteractiveMode as x, runInteractiveMode as y, saveConfig as z };
|
|
504
581
|
export type { Command as C, InkREPLOptions as I, RepLOptions as R, CommandCallbacks as a, CurrentConfig as b, InteractiveContext as c, InteractiveMode as d };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodax-ai/kodax",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.7.58",
|
|
4
|
+
"description": "KodaX lightweight coding agent - TypeScript implementation with 15 built-in LLM provider aliases, published as a Node-free single-file CLI and SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{Ab as f,ac as g,ec as h,ld as i,qd as j,xb as c,yb as d,zb as e}from"./chunk-KN6IJMTB.js";import"./chunk-PCPFLPS4.js";import"./chunk-TCLSPUTR.js";import{kb as a,lb as b}from"./chunk-N2N2W3AQ.js";import"./chunk-V4WSBIXB.js";export{d as bucketProviderPayloadSize,g as buildAutoRepoIntelligenceContext,e as checkPromiseSignal,b as cleanupIncompleteToolCalls,h as describeTransientProviderRetry,f as emitResilienceDebug,c as estimateProviderPayloadBytes,j as runKodaX,i as saveSessionSnapshot,a as validateAndFixToolHistory};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{wa as a,xa as b}from"./chunk-YSVPF6SN.js";import"./chunk-3WWPJGPQ.js";import"./chunk-LZKGOR2C.js";import"./chunk-MJFPFRGK.js";import"./chunk-KN6IJMTB.js";import"./chunk-PCPFLPS4.js";import"./chunk-TCLSPUTR.js";import"./chunk-N2N2W3AQ.js";import"./chunk-V4WSBIXB.js";export{a as ArgumentCompleter,b as createArgumentCompleter};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{lb as G,nb as H}from"./chunk-KN6IJMTB.js";import{V as T,W as j,X as N,Y as F,Z as K,_ as w,fa as $,ga as y,ja as x,ta as X,u as D,v as P,xa as V}from"./chunk-TCLSPUTR.js";import{va as v}from"./chunk-N2N2W3AQ.js";import{a as r}from"./chunk-V4WSBIXB.js";import u from"fs";import d from"path";import{exec as ue,spawnSync as fe}from"child_process";import{promisify as de}from"util";import{fileURLToPath as pe}from"url";var R="en";function ie(){return(process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG||"").toLowerCase().startsWith("zh")?"zh":"en"}r(ie,"detectSystemLocale");function z(e){if(!e||e==="auto"){R=ie();return}R=e.toLowerCase().replace(/[-_].*/,"")==="zh"?"zh":"en"}r(z,"setLocale");var U={en:{"dialog.confirm":"[Confirm]","dialog.select":"[Select]","dialog.input":"[Input]","confirm.instruction.basic":"Press (y) yes, (n) no","confirm.instruction.always":"Press (y) yes, (a) always yes for this tool, (n) no","confirm.instruction.protected":"Press (y) to confirm, (n) to cancel (protected path)","confirm.result.approved":"Approved","confirm.result.approved_always":"Approved (always)","confirm.result.denied":"Denied","tool.bash.title":"Execute bash command?","tool.shell.title":"Execute shell command?","tool.write.title":"Write to file?","tool.edit.title":"Edit file?","tool.generic.title":"Execute {tool}?","field.reason":"Reason","field.intent":"Intent","field.target":"Target","field.scope":"Scope","field.risk":"Risk","field.summary":"Summary","intent.read":"Read project files","intent.delete":"Delete files","intent.deps":"Modify dependencies or environment","intent.modify":"Modify files","intent.execute":"Execute command","intent.write_file":"Write file","intent.edit_file":"Edit file","intent.use_tool":"Use {tool}","risk.destructive":"Destructive change","risk.deps":"May change dependencies or local tools","risk.modify":"May modify files","risk.unknown":"Command effects depend on its arguments","risk.network":"May access network","scope.outside":"Outside project","scope.protected":"Protected path","waiting.confirm":"Waiting: approval required","waiting.select":"Waiting: choose an option","waiting.input":"Waiting: answer the prompt","placeholder.confirm":"Respond to the approval prompt above...","placeholder.select":"Choose an option above...","placeholder.input":"Answer the prompt above...","placeholder.busy":"Agent is busy...","placeholder.queue":"Queue a follow-up for the next round...","placeholder.idle":"Type a message...","select.choice":"Choice:","select.type_number":"(type a number)","select.more":"{count} more choices...","select.more_above":"\u2191 {count} more above","select.more_below":"\u2193 {count} more below","select.confirm_hint":"Press Enter to confirm, Esc to cancel","select.navigate_hint":"Use \u2191\u2193 to navigate, Enter to confirm, Esc to cancel","select.multiselect_hint":"Use \u2191\u2193 to navigate, Space to toggle, Enter to confirm, Esc to cancel","select.multiselect_empty":"Select at least one option with Space before confirming.","select.back_prev":"\u2190 Back to previous question","input.default":"Default:","input.value":"Value:","input.type_response":"(type your response)","managed.completed":"Task completed","managed.completed.blocked":"Task blocked","managed.completed.continuation":"Task needs continuation",cancelled:"[Cancelled] Operation cancelled by user"},zh:{"dialog.confirm":"[\u786E\u8BA4]","dialog.select":"[\u9009\u62E9]","dialog.input":"[\u8F93\u5165]","confirm.instruction.basic":"\u6309 (y) \u786E\u8BA4, (n) \u62D2\u7EDD","confirm.instruction.always":"\u6309 (y) \u786E\u8BA4, (a) \u59CB\u7EC8\u5141\u8BB8\u6B64\u5DE5\u5177, (n) \u62D2\u7EDD","confirm.instruction.protected":"\u6309 (y) \u786E\u8BA4, (n) \u53D6\u6D88 (\u53D7\u4FDD\u62A4\u8DEF\u5F84)","confirm.result.approved":"\u5DF2\u6279\u51C6","confirm.result.approved_always":"\u5DF2\u6279\u51C6 (\u59CB\u7EC8\u5141\u8BB8)","confirm.result.denied":"\u5DF2\u62D2\u7EDD","tool.bash.title":"\u6267\u884C bash \u547D\u4EE4\uFF1F","tool.shell.title":"\u6267\u884C shell \u547D\u4EE4\uFF1F","tool.write.title":"\u5199\u5165\u6587\u4EF6\uFF1F","tool.edit.title":"\u7F16\u8F91\u6587\u4EF6\uFF1F","tool.generic.title":"\u6267\u884C {tool}\uFF1F","field.reason":"\u539F\u56E0","field.intent":"\u610F\u56FE","field.target":"\u76EE\u6807","field.scope":"\u8303\u56F4","field.risk":"\u98CE\u9669","field.summary":"\u6458\u8981","intent.read":"\u8BFB\u53D6\u9879\u76EE\u6587\u4EF6","intent.delete":"\u5220\u9664\u6587\u4EF6","intent.deps":"\u4FEE\u6539\u4F9D\u8D56\u6216\u73AF\u5883","intent.modify":"\u4FEE\u6539\u6587\u4EF6","intent.execute":"\u6267\u884C\u547D\u4EE4","intent.write_file":"\u5199\u5165\u6587\u4EF6","intent.edit_file":"\u7F16\u8F91\u6587\u4EF6","intent.use_tool":"\u4F7F\u7528 {tool}","risk.destructive":"\u7834\u574F\u6027\u53D8\u66F4","risk.deps":"\u53EF\u80FD\u4FEE\u6539\u4F9D\u8D56\u6216\u672C\u5730\u5DE5\u5177","risk.modify":"\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6","risk.unknown":"\u547D\u4EE4\u6548\u679C\u53D6\u51B3\u4E8E\u53C2\u6570","risk.network":"\u53EF\u80FD\u8BBF\u95EE\u7F51\u7EDC","scope.outside":"\u9879\u76EE\u5916\u90E8","scope.protected":"\u53D7\u4FDD\u62A4\u8DEF\u5F84","waiting.confirm":"\u7B49\u5F85\u4E2D\uFF1A\u9700\u8981\u5BA1\u6279","waiting.select":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u9009\u62E9","waiting.input":"\u7B49\u5F85\u4E2D\uFF1A\u8BF7\u56DE\u7B54","placeholder.confirm":"\u8BF7\u56DE\u5E94\u4E0A\u65B9\u7684\u5BA1\u6279\u63D0\u793A...","placeholder.select":"\u8BF7\u5728\u4E0A\u65B9\u9009\u62E9\u4E00\u4E2A\u9009\u9879...","placeholder.input":"\u8BF7\u56DE\u7B54\u4E0A\u65B9\u7684\u63D0\u793A...","placeholder.busy":"\u667A\u80FD\u4F53\u6B63\u5728\u5DE5\u4F5C\u4E2D...","placeholder.queue":"\u6392\u961F\u7B49\u5F85\u4E0B\u4E00\u8F6E\u8DDF\u8FDB...","placeholder.idle":"\u8F93\u5165\u6D88\u606F...","select.choice":"\u9009\u9879\uFF1A","select.type_number":"(\u8F93\u5165\u7F16\u53F7)","select.more":"\u8FD8\u6709 {count} \u4E2A\u9009\u9879...","select.more_above":"\u2191 \u4E0A\u65B9\u8FD8\u6709 {count} \u4E2A","select.more_below":"\u2193 \u4E0B\u65B9\u8FD8\u6709 {count} \u4E2A","select.confirm_hint":"\u6309 Enter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.navigate_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_hint":"\u4F7F\u7528 \u2191\u2193 \u5BFC\u822A\uFF0C\u7A7A\u683C \u5207\u6362\u9009\u4E2D\uFF0CEnter \u786E\u8BA4\uFF0CEsc \u53D6\u6D88","select.multiselect_empty":"\u8BF7\u5148\u4F7F\u7528\u7A7A\u683C\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u9009\u9879\u3002","select.back_prev":"\u2190 \u8FD4\u56DE\u4E0A\u4E00\u9898","input.default":"\u9ED8\u8BA4\u503C\uFF1A","input.value":"\u503C\uFF1A","input.type_response":"(\u8F93\u5165\u4F60\u7684\u56DE\u7B54)","managed.completed":"\u4EFB\u52A1\u5B8C\u6210","managed.completed.blocked":"\u4EFB\u52A1\u53D7\u963B","managed.completed.continuation":"\u4EFB\u52A1\u9700\u8981\u7EE7\u7EED",cancelled:"[\u5DF2\u53D6\u6D88] \u64CD\u4F5C\u5DF2\u88AB\u7528\u6237\u53D6\u6D88"}};function Fe(e,t){let o=U[R][e]??U.en[e]??e;if(t)for(let[i,s]of Object.entries(t))o=o.replace(`{${i}}`,String(s));return o}r(Fe,"t");import b from"fs";import L from"path";var He=L.join(v(),"capability-cache.json");function B(){return L.join(v(),"capability-cache.json")}r(B,"getCapabilityCacheFile");function A(e,t){return`${e}/${t??""}`}r(A,"capabilityCacheKey");function q(e,t){if(t.length===0)return e;let n=new Set(t);return{...e,supportedEfforts:e.supportedEfforts?.filter(o=>!n.has(o.value)),localRejectEfforts:Array.from(new Set([...e.localRejectEfforts??[],...t]))}}r(q,"narrowReasoningProfile");function se(e,t,n){return e[A(t,n)]?.rejected??[]}r(se,"getRejectedEfforts");function ce(e,t,n,o,i,s){let c=A(t,n),l=e[c],a=l?.rejected.includes(o)?l.rejected:[...l?.rejected??[],o];return{...e,[c]:{rejected:a,source:i,updatedAt:s}}}r(ce,"addRejectedEffort");function ae(e,t,n){if(!t)return{};let o={...e};return delete o[A(t,n)],o}r(ae,"removeCacheEntry");function le(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(!o||typeof o!="object")continue;let i=o,s=Array.isArray(i.rejected)?i.rejected.filter(a=>typeof a=="string"):[],c=i.source==="probed"?"probed":"observed",l=typeof i.updatedAt=="string"?i.updatedAt:"";t[n]={rejected:s,source:c,updatedAt:l}}return t}r(le,"sanitizeCache");var m=null;function k(){if(m)return m;let e=B();try{m=b.existsSync(e)?le(JSON.parse(b.readFileSync(e,"utf-8"))):{}}catch{m={}}return m}r(k,"loadCapabilityCache");function J(e){m=e;let t=B();b.mkdirSync(L.dirname(t),{recursive:!0}),b.writeFileSync(t,JSON.stringify(e,null,2))}r(J,"persistCapabilityCache");function W(e,t){return se(k(),e,t)}r(W,"getCachedRejectedEfforts");function Ue(e,t,n,o,i){J(ce(k(),e,t,n,o,i))}r(Ue,"recordRejectedEffort");function ze(e,t){J(ae(k(),e,t))}r(ze,"clearCapabilityCache");var me=de(ue),Z=v(),rt=d.join(Z,"sessions"),p=d.join(Z,"config.json"),it=60,f=null,I=!1,ge="dumb";function ye(e){let t=d.basename(e).toLowerCase(),n="__KODAX_SHELL_ENV_START__",o=`printf '%s\\0' '${n}'; env -0`;return t==="fish"?{args:["-i","-c",o],sentinel:n}:{args:t==="bash"||t==="zsh"?["-ic",o]:["-lc",o],sentinel:n}}r(ye,"buildShellEnvCommand");function ve(e,t){let n=`${t}\0`,o=e.lastIndexOf(n);if(o===-1)return{};let i=e.slice(o+n.length),s={};for(let c of i.split("\0")){if(!c)continue;let l=c.indexOf("=");l<=0||(s[c.slice(0,l)]=c.slice(l+1))}return s}r(ve,"parseNullDelimitedShellEnv");function he(e={}){let t=e.env??process.env;if((e.platform??process.platform)==="win32"||t.KODAX_DISABLE_SHELL_ENV_HYDRATION==="1")return!1;let o=e.shell??t.SHELL;if(!o||!d.isAbsolute(o))return!1;let{args:i,sentinel:s}=ye(o),c=e.run??fe,l={...t,TERM:ge},a=c(o,i,{encoding:"utf8",env:l,maxBuffer:1024*1024,timeout:5e3,windowsHide:!0,detached:!0,stdio:["ignore","pipe","pipe"]});if(a.status!==0||!a.stdout)return!1;let ne=typeof a.stdout=="string"?a.stdout:a.stdout.toString("utf8"),oe=ve(ne,s),M=!1;for(let[_,re]of Object.entries(oe))_!=="TERM"&&t[_]===void 0&&(t[_]=re,M=!0);return M}r(he,"hydrateProcessEnvFromShell");function be(){if(!I){I=!0;try{he()}catch{}}}r(be,"ensureShellEnvironmentHydrated");function st(){I=!1}r(st,"resetShellEnvironmentHydrationForTesting");function Ee(e){$(e.customProviders??[])}r(Ee,"registerConfiguredCustomProviders");function ee(e){if(!Array.isArray(e))return;let t=e.filter(n=>typeof n=="string").map(n=>n.trim()).filter(n=>n.length>0);return t.length>0?t:[]}r(ee,"normalizeConfiguredExtensions");function Ce(e){if(e.permissionMode!=="default")return e;let t={...e,permissionMode:"accept-edits"};try{u.mkdirSync(d.dirname(p),{recursive:!0}),u.writeFileSync(p,JSON.stringify(t,null,2))}catch{}return t}r(Ce,"migrateLegacyPermissionModeInConfig");function Se(e){if(e.permissionMode!=="auto-in-project")return e;try{let t=u.readFileSync(p,"utf-8"),n=t.replace(/("permissionMode"\s*:\s*)"auto-in-project"/,'$1"auto"');n!==t&&u.writeFileSync(p,n)}catch{}return{...e,permissionMode:"auto"}}r(Se,"migrateAutoInProjectAliasInConfig");function _e(){if(f)return f;let e="0.7.57";if(e)return f=e,f;let t=d.join(d.dirname(pe(import.meta.url)),"../../package.json");if(u.existsSync(t))try{return f=JSON.parse(u.readFileSync(t,"utf-8")).version??"0.0.0",f??"0.0.0"}catch{}return f="0.0.0",f}r(_e,"getVersion");var ct=_e();function Pe(e){return j(e)}r(Pe,"getProviderModel");function O(e,t){let n=new Set(e.map(i=>i.toLowerCase())),o=[...e];for(let i of t)n.has(i.toLowerCase())||o.push(i);return o}r(O,"mergeModels");function we(e,t){t||(t=S().providerModels);let n=t?.[e];if(n&&n.length>0){try{let o=w(e);if(o.length>0)return O(n,o)}catch{}try{let o=y(e);if(o)return O(n,o.getAvailableModels())}catch{}return n}try{let o=w(e);if(o.length>0)return o}catch{}try{let o=y(e);if(o)return o.getAvailableModels()}catch{}return[]}r(we,"getProviderAvailableModels");function xe(e,t){let n=N(e,t);if(n!=="unknown")return n;try{let o=y(e);if(o)return o.getReasoningCapability(t)}catch{}return"unknown"}r(xe,"getProviderReasoningCapability");function Re(e){let t=F(e);if(t)return t;try{return x().find(o=>o.name===e)?.capabilityProfile??null}catch{return null}}r(Re,"getProviderCapabilityProfile");function te(e,t){let n=Re(e),o=xe(e,t);if(n)return{capabilityProfile:n,reasoningCapability:o};try{let i=X(e);return{capabilityProfile:i.getCapabilityProfile(),reasoningCapability:i.getReasoningCapability(t)}}catch{return null}}r(te,"getProviderCapabilityMetadata");function at(e,t){let n=te(e,t);return n?G({providerName:e,model:t,capabilityProfile:n.capabilityProfile,reasoningCapability:n.reasoningCapability==="unknown"?void 0:n.reasoningCapability}):null}r(at,"getProviderCapabilitySnapshot");function Le(e,t,n,o){let i=te(e,t);return i?H({providerName:e,model:t,capabilityProfile:i.capabilityProfile,reasoningCapability:i.reasoningCapability==="unknown"?void 0:i.reasoningCapability,reasoningMode:n,hints:o}):null}r(Le,"getProviderPolicyDecision");function lt(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"forwards only the latest user message":"preserves full conversation history",o=e.mcpSupport==="native"?"MCP available":"MCP unavailable";return`${t}; ${n}; ${o}`}r(lt,"describeProviderCapabilitySummary");function ut(e){switch(e){case"native-budget":return"B";case"native-effort":return"E";case"native-toggle":return"T";case"native-adaptive":return"A";default:return"-"}}r(ut,"formatReasoningCapabilityShort");function g(e){if(e)return e==="none"?"off":e}r(g,"formatReasoningEffortForDisplay");function E(e,t){let n=g(t);n&&!e.includes(n)&&e.push(n)}r(E,"pushUniqueEffortDisplay");function ft(e,t){let n=["auto"],i=C(e,t)?.supportedEfforts?.filter(s=>s.isUserVisible!==!1);if(!i||i.length===0){for(let s of["off","low","medium","high"])E(n,s);return n}for(let s of i)E(n,s.value);return n}r(ft,"getProviderReasoningEffortOptions");function dt(e,t){let n=C(e,t),o=new Set(n?.disabledEfforts??[]),i=n?.supportedEfforts?.filter(a=>a.isUserVisible!==!1),s=[],c=n?.supportsDisabledThinking===!0;if(!i||i.length===0){for(let a of["low","medium","high"])E(s,a);c=!0}else for(let a of i){if(a.value==="none"){c=!0;continue}if(o.has(a.value)){c=!0;continue}E(s,a.value)}let l=[];return c&&l.push("off"),l.push(...s),l.push("auto"),l}r(dt,"getProviderReasoningEffortCycle");function Ae(e,t){if(t===!1)return"off";switch(e){case"off":return"off";case"quick":return"low";case"balanced":return"medium";case"deep":return"high";default:return"auto"}}r(Ae,"legacyReasoningModeToEffortDisplay");function C(e,t){let n=t??Pe(e);if(!n)return;let o=V(e,n)?.reasoningProfile;if(o)return q(o,W(e,n))}r(C,"resolveReasoningProfileForDisplay");function pt(e){let t=g(e.effort)??Ae(e.reasoningMode,e.thinking),n=C(e.provider,e.model);if(!n)return t;try{let o=D({capability:n,explicitEffort:e.effortOverride?e.effort:void 0,sessionEffort:e.effortOverride?void 0:e.effort,legacyReasoningMode:e.reasoningMode,thinking:e.thinking}),i=g(o.configuredEffort)??t,c=o.configuredEffort!==void 0&&n.disabledEfforts?.includes(o.configuredEffort)===!0?"off":g(o.effectiveEffort);return c&&c!==i?`${i}->${c}`:i}catch{if(e.effort)try{let o=P({currentEffort:e.effort,capability:n}),i=g(e.effort)??t,s=g(o.effectiveEffort);return s&&s!==i?`${i}->${s}`:i}catch{return t}return t}}r(pt,"formatReasoningEffortStatusLabel");function mt(e){let t=je(e);if(!t)return{preserved:!0};let n=C(e.provider,e.model);if(!n)return{configuredEffort:t,runtimeEffort:t,preserved:!0};let o=P({currentEffort:t,capability:n});return{configuredEffort:t,runtimeEffort:o.effectiveEffort,preserved:o.preserved,diagnostic:o.diagnostic}}r(mt,"resolveProviderReasoningRuntimeEffort");function ke(e){switch(e){case"native-budget":return"budget";case"native-effort":return"effort";case"native-toggle":return"toggle";case"native-adaptive":return"adaptive";default:return"none"}}r(ke,"describeReasoningCapabilityControl");function gt(e,t){if(e==="off")return"Reasoning disabled";switch(t){case"native-budget":return"Uses native thinking budget control";case"native-effort":return"Uses native reasoning effort control";case"native-toggle":return"Uses provider-native thinking toggle only";case"native-adaptive":return"Model adaptively decides thinking depth (Opus 4.7+)";case"none":return"Runs without native reasoning parameters";case"prompt-only":return"Uses prompt overlays only; no native reasoning parameter";default:return"Runs without native reasoning parameters"}}r(gt,"describeReasoningExecution");function yt(e){let t=[];e||(e=S().providerModels);for(let n of K())t.push({name:n.name,model:n.model,models:we(n.name,e),configured:n.capabilityProfile.transport==="cli-bridge"?!0:n.configured,reasoningCapability:n.reasoningCapability,capabilityProfile:n.capabilityProfile});try{let n=x().map(o=>({...o,models:(()=>{let i=e?.[o.name];return i&&i.length>0?O(i,o.models):o.models})()}));t.push(...n)}catch{}return t}r(yt,"getProviderList");function vt(e){if(T(e))return!0;try{return y(e)?.isConfigured()??!1}catch{return!1}}r(vt,"isProviderConfigured");function S(){try{if(u.existsSync(p)){let e=JSON.parse(u.readFileSync(p,"utf-8")),t=e.reasoningCeiling??e.reasoningMode;return Se(Ce({...e,reasoningMode:t,extensions:ee(e.extensions)}))}}catch{}return{}}r(S,"loadConfig");function Ie(e){e.streamIdleTimeoutMs&&!process.env.KODAX_STREAM_IDLE_TIMEOUT_MS&&(process.env.KODAX_STREAM_IDLE_TIMEOUT_MS=String(e.streamIdleTimeoutMs))}r(Ie,"applyResilienceRuntimeEnv");function Oe(e){e.repoIntelligenceMode&&!process.env.KODAX_REPO_INTELLIGENCE&&(process.env.KODAX_REPO_INTELLIGENCE=e.repoIntelligenceMode),e.repoIntelligenceTrace===!0&&!process.env.KODAX_REPO_INTELLIGENCE_TRACE&&(process.env.KODAX_REPO_INTELLIGENCE_TRACE="1")}r(Oe,"applyRepoIntelligenceRuntimeEnv");function Me(e){e.verifierLog===!0&&!process.env.KODAX_VERIFIER_LOG&&(process.env.KODAX_VERIFIER_LOG="1")}r(Me,"applyVerifierRuntimeEnv");function De(e){e.stallLog===!0&&!process.env.KODAX_STALL_LOG&&(process.env.KODAX_STALL_LOG="1")}r(De,"applyStallSidecarRuntimeEnv");function Te(e){let t=e.fallbackProviders?.filter(n=>n.trim().length>0)??[];t.length>0&&!process.env.KODAX_FALLBACK_PROVIDERS&&(process.env.KODAX_FALLBACK_PROVIDERS=t.join(","))}r(Te,"applyFallbackRuntimeEnv");function ht(){be();let e=S();return Ie(e),Oe(e),Me(e),De(e),Te(e),Ee(e),z(e.locale),e}r(ht,"prepareRuntimeConfig");function bt(e){let n={...S(),...e},o=ee(n.extensions);o!==void 0&&(n.extensions=o);for(let i of Object.keys(e))e[i]===void 0&&delete n[i];u.mkdirSync(d.dirname(p),{recursive:!0}),u.writeFileSync(p,JSON.stringify(n,null,2))}r(bt,"saveConfig");function Et(e,t){return e.effort!==void 0||t.effort!==void 0}r(Et,"resolveInitialEffortOverride");function je(e){return e.permissionMode==="plan"&&e.effortOverride!==!0&&e.planModeEffort!==void 0?e.planModeEffort:e.effort}r(je,"resolvePermissionModeEffort");async function Ct(e){try{let{stdout:t}=await me("git rev-parse --show-toplevel",{cwd:e});return t.trim()}catch{return null}}r(Ct,"getGitRoot");function Ne(e){switch(e){case"builtin":return"Built-in";case"runtime":return"Runtime extension";case"custom":return"Custom config";default:return"Unknown"}}r(Ne,"formatProviderSourceKind");function St(e){let t=e.transport==="cli-bridge"?"CLI bridge":"Native API",n=e.conversationSemantics==="last-user-message"?"latest-user-message only":"full conversation history";return[`Source: ${Ne(e.sourceKind)}`,`Transport: ${t}`,`Conversation semantics: ${n}`,`Context fidelity: ${e.contextFidelity}`,`Tool calling: ${e.toolCallingFidelity}`,`Session behavior: ${e.sessionSupport}`,`Long-running support: ${e.longRunningSupport}`,`Evidence-heavy flows: ${e.evidenceSupport}`,`Multimodal support: ${e.multimodalSupport}`,`MCP support: ${e.mcpSupport}`,`Reasoning control: ${ke(e.reasoningCapability)}`]}r(St,"formatProviderCapabilityDetailLines");function _t(e,t,n){return[{label:"General coding",hints:{}},{label:"Evidence-heavy review",hints:{evidenceHeavy:!0}},{label:"Long-running task",hints:{longRunning:!0}}].map(i=>({label:i.label,decision:Le(e,t,n,i.hints)})).filter(i=>i.decision!==null)}r(_t,"getProviderCommonPolicyScenarios");var Y=.5,Q=0,h={locked:!1,queue:[]};async function Pt(e){for(;h.locked;)await new Promise(t=>h.queue.push(t));h.locked=!0;try{let t=(Date.now()-Q)/1e3;t<Y&&await new Promise(o=>setTimeout(o,(Y-t)*1e3));let n=await e();return Q=Date.now(),n}finally{h.locked=!1;let t=h.queue.shift();t&&t()}}r(Pt,"rateLimitedCall");export{Fe as a,W as b,Ue as c,ze as d,Z as e,rt as f,p as g,it as h,he as i,st as j,Ee as k,_e as l,ct as m,Pe as n,we as o,xe as p,Re as q,at as r,Le as s,lt as t,ut as u,g as v,ft as w,dt as x,pt as y,mt as z,ke as A,gt as B,yt as C,vt as D,S as E,ht as F,bt as G,Et as H,je as I,Ct as J,Ne as K,St as L,_t as M,Pt as N};
|