@kodax-ai/kodax 0.7.42 → 0.7.44
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 +65 -6
- package/README.md +87 -56
- package/README_CN.md +46 -25
- package/dist/chunks/chunk-35BDEEC5.js +2 -0
- package/dist/chunks/chunk-4YPL2UVZ.js +848 -0
- package/dist/chunks/chunk-DI2G3YWL.js +31 -0
- package/dist/chunks/chunk-HHQ7YTGM.js +425 -0
- package/dist/chunks/chunk-QHILHQBB.js +519 -0
- package/dist/chunks/{chunk-IYJ5EPRV.js → chunk-RUDYNAK7.js} +1 -1
- package/dist/chunks/compaction-config-NAPRF7XR.js +2 -0
- package/dist/chunks/{construction-bootstrap-J2WOCYEK.js → construction-bootstrap-PHTGBRNU.js} +4 -4
- package/dist/chunks/dist-CCYBJJZY.js +2 -0
- package/dist/chunks/dist-RHIHZAYX.js +2 -0
- package/dist/chunks/utils-TV3UYCHQ.js +2 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.js +2 -2
- package/dist/kodax_cli.js +1159 -1102
- package/dist/provider-capabilities.json +167 -0
- package/dist/sdk-agent.d.ts +905 -48
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +995 -755
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +5 -3
- 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-repl.d.ts +10 -9
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-session.d.ts +23 -11
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{cost-tracker.d-B6vMoLLF.d.ts → base.d-FUJahC0i.d.ts} +2 -110
- package/dist/types-chunks/{bash-prefix-extractor.d-CkhaqKkg.d.ts → bash-prefix-extractor.d-DdoSeghD.d.ts} +442 -131
- package/dist/types-chunks/cost-tracker.d-wRtyEW9d.d.ts +110 -0
- package/dist/types-chunks/file-tracker.d-DOfaoCbJ.d.ts +633 -0
- package/dist/types-chunks/manager.d-87belpiS.d.ts +370 -0
- package/dist/types-chunks/{resolver.d-DX9au4NJ.d.ts → resolver.d-B7ZnVuuf.d.ts} +157 -10
- package/dist/types-chunks/{session-storage.d-Cci897iM.d.ts → storage.d-DFD9ln5c.d.ts} +49 -2
- package/dist/types-chunks/{history-cleanup.d-DznrzEiU.d.ts → types.d-DM8zEJgF.d.ts} +1084 -282
- package/dist/types-chunks/{types.d-mM8vqvhT.d.ts → types.d-HBbWT-iA.d.ts} +41 -3
- package/dist/types-chunks/{storage.d-Bc5DoAwp.d.ts → utils.d-C5fzCE9W.d.ts} +25 -47
- package/package.json +7 -6
- package/dist/chunks/chunk-3RKBXWZS.js +0 -2
- package/dist/chunks/chunk-7JLYVWAF.js +0 -1033
- package/dist/chunks/chunk-CD3R5YBH.js +0 -16
- package/dist/chunks/chunk-DKXUY5F2.js +0 -209
- package/dist/chunks/chunk-HMYEQJGT.js +0 -31
- package/dist/chunks/chunk-KUX5LRPP.js +0 -2
- package/dist/chunks/chunk-OWSKU55I.js +0 -13
- package/dist/chunks/chunk-ZZ4KRK2B.js +0 -465
- package/dist/chunks/compaction-config-FIFFP4FT.js +0 -2
- package/dist/chunks/dist-2ZHWDXMQ.js +0 -2
- package/dist/chunks/dist-W4CJWLIH.js +0 -2
- package/dist/chunks/utils-A5MWDTWZ.js +0 -2
- package/dist/types-chunks/instance-discovery.d-BsKnIwpg.d.ts +0 -990
- package/dist/types-chunks/transport.d-DuyjG30t.d.ts +0 -180
|
@@ -82,7 +82,45 @@ interface KodaXSessionArchiveMarkerEntry extends KodaXSessionEntryBase {
|
|
|
82
82
|
/** Brief summary of the archived content */
|
|
83
83
|
summary: string;
|
|
84
84
|
}
|
|
85
|
-
type
|
|
85
|
+
type KodaXGoalStatus = 'active' | 'paused' | 'budget_limited' | 'blocked' | 'complete';
|
|
86
|
+
/**
|
|
87
|
+
* Persistent user-set goal state. v0.7.44 FEATURE_192 — backs the
|
|
88
|
+
* `/goal` slash command and the get_goal / create_goal / update_goal
|
|
89
|
+
* tools.
|
|
90
|
+
*
|
|
91
|
+
* Persistence model: each lifecycle event (create / update / pause /
|
|
92
|
+
* resume / clear / budget_limited / blocked / complete) appends a
|
|
93
|
+
* `KodaXSessionGoalEntry` carrying a frozen `KodaXGoalState` snapshot
|
|
94
|
+
* to the session lineage. `readLatestGoalFromBranch` walks the active
|
|
95
|
+
* branch's message-entry IDs and returns the latest goal entry whose
|
|
96
|
+
* parentId belongs to that branch — so forks and rewinds naturally
|
|
97
|
+
* drop goals attached to abandoned message paths.
|
|
98
|
+
*/
|
|
99
|
+
interface KodaXGoalState {
|
|
100
|
+
readonly version: 1;
|
|
101
|
+
/** `${createdAt}-${rand}` — stable across updates of the same goal. */
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly objective: string;
|
|
104
|
+
readonly status: KodaXGoalStatus;
|
|
105
|
+
/** Optional explicit token budget; null when the user did not set one. */
|
|
106
|
+
readonly tokenBudget: number | null;
|
|
107
|
+
readonly tokensUsed: number;
|
|
108
|
+
readonly timeUsedSeconds: number;
|
|
109
|
+
/** Consecutive turns the model has reported the same blocker. */
|
|
110
|
+
readonly blockerTurnCount: number;
|
|
111
|
+
/** The blocker_kind string the model last reported, or null. */
|
|
112
|
+
readonly lastBlockerKind: string | null;
|
|
113
|
+
readonly createdAt: number;
|
|
114
|
+
readonly updatedAt: number;
|
|
115
|
+
}
|
|
116
|
+
type KodaXGoalEventType = 'created' | 'updated' | 'paused' | 'resumed' | 'cleared' | 'budget_limited' | 'blocked' | 'complete';
|
|
117
|
+
interface KodaXSessionGoalEntry extends KodaXSessionEntryBase {
|
|
118
|
+
type: 'goal';
|
|
119
|
+
/** Snapshot at time of event; `null` only when `event === 'cleared'`. */
|
|
120
|
+
goal: KodaXGoalState | null;
|
|
121
|
+
event: KodaXGoalEventType;
|
|
122
|
+
}
|
|
123
|
+
type KodaXSessionEntry = KodaXSessionMessageEntry | KodaXSessionCompactionEntry | KodaXSessionBranchSummaryEntry | KodaXSessionLabelEntry | KodaXSessionArchiveMarkerEntry | KodaXSessionGoalEntry;
|
|
86
124
|
interface KodaXSessionArtifactLedgerEntry {
|
|
87
125
|
id: string;
|
|
88
126
|
kind: 'file_read' | 'file_modified' | 'file_created' | 'file_deleted' | 'path_scope' | 'search_scope' | 'command_scope' | 'check_result' | 'decision' | 'image_input' | 'tombstone';
|
|
@@ -119,7 +157,7 @@ interface KodaXSessionNavigationOptions {
|
|
|
119
157
|
summarizeCurrentBranch?: boolean;
|
|
120
158
|
}
|
|
121
159
|
interface KodaXSessionTreeNode {
|
|
122
|
-
entry: Exclude<KodaXSessionEntry, KodaXSessionLabelEntry>;
|
|
160
|
+
entry: Exclude<KodaXSessionEntry, KodaXSessionLabelEntry | KodaXSessionGoalEntry>;
|
|
123
161
|
children: KodaXSessionTreeNode[];
|
|
124
162
|
label?: string;
|
|
125
163
|
active: boolean;
|
|
@@ -251,4 +289,4 @@ interface KodaXSessionStorage {
|
|
|
251
289
|
deleteAll?(gitRoot?: string): Promise<void>;
|
|
252
290
|
}
|
|
253
291
|
|
|
254
|
-
export type { KodaXCompactMemoryProgress as K, SessionErrorMetadata as S, KodaXCompactMemorySeed as a, KodaXExtensionSessionRecord as b, KodaXExtensionSessionState as c, KodaXExtensionStore as d, KodaXExtensionStoreEntry as e,
|
|
292
|
+
export type { KodaXSessionUiHistoryItem as A, KodaXSessionUiHistoryItemType as B, KodaXSessionWorkspaceKind as C, KodaXCompactMemoryProgress as K, SessionErrorMetadata as S, KodaXCompactMemorySeed as a, KodaXExtensionSessionRecord as b, KodaXExtensionSessionState as c, KodaXExtensionStore as d, KodaXExtensionStoreEntry as e, KodaXGoalEventType as f, KodaXGoalState as g, KodaXGoalStatus as h, KodaXJsonValue as i, KodaXSessionArchiveMarkerEntry as j, KodaXSessionArtifactLedgerEntry as k, KodaXSessionBranchSummaryEntry as l, KodaXSessionCompactionEntry as m, KodaXSessionData as n, KodaXSessionEntry as o, KodaXSessionEntryBase as p, KodaXSessionGoalEntry as q, KodaXSessionLabelEntry as r, KodaXSessionLineage as s, KodaXSessionMessageEntry as t, KodaXSessionMeta as u, KodaXSessionNavigationOptions as v, KodaXSessionRuntimeInfo as w, KodaXSessionScope as x, KodaXSessionStorage as y, KodaXSessionTreeNode as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as BashPrefixExtractor,
|
|
2
|
-
import { a as SessionStorage$1
|
|
3
|
-
import {
|
|
1
|
+
import { l as BashPrefixExtractor, a1 as KodaXOptions, L as KodaXContextTokenSnapshot, K as KodaXAgentMode, a6 as KodaXRepoIntelligenceMode, A as AgentsFile, i as AutoModeStats, ah as KodaXSkillInvocationContext, _ as KodaXMcpServersConfig } from './bash-prefix-extractor.d-DdoSeghD.js';
|
|
2
|
+
import { a as SessionStorage$1 } from './storage.d-DFD9ln5c.js';
|
|
3
|
+
import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-HBbWT-iA.js';
|
|
4
4
|
import { m as KodaXMessage, D as KodaXReasoningMode, q as KodaXProviderCapabilityProfile, E as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-B1uGoVTE.js';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
6
|
import { SpawnSyncReturns } from 'child_process';
|
|
@@ -462,6 +462,23 @@ declare function loadConfig(): {
|
|
|
462
462
|
repointelBin?: string;
|
|
463
463
|
repoIntelligenceTrace?: boolean;
|
|
464
464
|
streamIdleTimeoutMs?: number;
|
|
465
|
+
/**
|
|
466
|
+
* FEATURE_184 Phase D.3 follow-up (v0.7.42) — opt-in Sidecar Verifier
|
|
467
|
+
* observability. When `true`, the runtime emits a persisted note per
|
|
468
|
+
* verifier call:
|
|
469
|
+
* `[Sidecar Verifier] {verdict} · {model} · {ms}ms · {trace}`
|
|
470
|
+
* Mirrored to env var `KODAX_VERIFIER_LOG=1` so the agent-runtime
|
|
471
|
+
* layer (which has no access to `~/.kodax/config.json`) can read it.
|
|
472
|
+
*/
|
|
473
|
+
verifierLog?: boolean;
|
|
474
|
+
/**
|
|
475
|
+
* FEATURE_187 Phase C (v0.7.43) — opt-in Stall Sidecar observability.
|
|
476
|
+
* When `true`, the runtime emits a persisted note per L2 stall
|
|
477
|
+
* verdict (isStuck true OR false):
|
|
478
|
+
* `[Stall Sidecar] isStuck={true|false} · {provider}/{model} · {ms}ms · {trace}`
|
|
479
|
+
* Mirrored to env var `KODAX_STALL_LOG=1`.
|
|
480
|
+
*/
|
|
481
|
+
stallLog?: boolean;
|
|
465
482
|
};
|
|
466
483
|
declare function prepareRuntimeConfig(): ReturnType<typeof loadConfig>;
|
|
467
484
|
declare function saveConfig(config: {
|
|
@@ -481,52 +498,13 @@ declare function saveConfig(config: {
|
|
|
481
498
|
repointelEndpoint?: string;
|
|
482
499
|
repointelBin?: string;
|
|
483
500
|
repoIntelligenceTrace?: boolean;
|
|
501
|
+
/** FEATURE_184 Phase D.3 follow-up — opt-in verifier log line. */
|
|
502
|
+
verifierLog?: boolean;
|
|
503
|
+
/** FEATURE_187 Phase C — opt-in stall sidecar log line. */
|
|
504
|
+
stallLog?: boolean;
|
|
484
505
|
}): void;
|
|
485
506
|
declare function getGitRoot(): Promise<string | null>;
|
|
486
507
|
declare function rateLimitedCall<T>(fn: () => Promise<T>): Promise<T>;
|
|
487
508
|
|
|
488
|
-
|
|
489
|
-
* KodaX session storage - filesystem implementation.
|
|
490
|
-
*/
|
|
491
|
-
|
|
492
|
-
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
493
|
-
private writeQueues;
|
|
494
|
-
private serializedWrite;
|
|
495
|
-
private appendState;
|
|
496
|
-
/** Update watermarks. Only overwrites fields the caller actually provided. */
|
|
497
|
-
private syncAppendState;
|
|
498
|
-
private getSessionFilePath;
|
|
499
|
-
private getArchiveFilePath;
|
|
500
|
-
private readSession;
|
|
501
|
-
private writeSessionInternal;
|
|
502
|
-
private mergeAndWriteInternal;
|
|
503
|
-
appendSessionDelta(id: string, data: SessionData): Promise<void>;
|
|
504
|
-
private shouldRunMaintenance;
|
|
505
|
-
private runMaintenance;
|
|
506
|
-
save(id: string, data: SessionData): Promise<void>;
|
|
507
|
-
load(id: string): Promise<SessionData | null>;
|
|
508
|
-
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
509
|
-
setActiveEntry(id: string, selector: string, options?: {
|
|
510
|
-
summarizeCurrentBranch?: boolean;
|
|
511
|
-
}): Promise<SessionData | null>;
|
|
512
|
-
rewind(id: string, selector?: string): Promise<SessionData | null>;
|
|
513
|
-
setLabel(id: string, selector: string, label?: string): Promise<SessionData | null>;
|
|
514
|
-
fork(id: string, selector?: string, options?: {
|
|
515
|
-
sessionId?: string;
|
|
516
|
-
title?: string;
|
|
517
|
-
}): Promise<{
|
|
518
|
-
sessionId: string;
|
|
519
|
-
data: SessionData;
|
|
520
|
-
} | null>;
|
|
521
|
-
list(gitRoot?: string): Promise<Array<{
|
|
522
|
-
id: string;
|
|
523
|
-
title: string;
|
|
524
|
-
msgCount: number;
|
|
525
|
-
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
526
|
-
}>>;
|
|
527
|
-
delete(id: string): Promise<void>;
|
|
528
|
-
deleteAll(gitRoot?: string): Promise<void>;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export { processSpecialSyntax as A, BUILTIN_COMMANDS as B, rateLimitedCall as D, registerConfiguredCustomProviders as E, FileSessionStorage as F, runInkInteractiveMode as G, runInteractiveMode as H, saveConfig as J, KODAX_CONFIG_FILE as K, touchContext as L, PERMISSION_MODES as P, KODAX_DIR as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, PREVIEW_MAX_LENGTH as i, computeConfirmTools as l, createInteractiveContext as m, executeCommand as n, getGitRoot as o, getProviderList as p, getProviderModel as q, getVersion as r, hydrateProcessEnvFromShell as s, isPermissionMode as t, isProviderConfigured as u, loadConfig as v, normalizePermissionMode as w, parseCommand as x, permissionModeDisplayName as y, prepareRuntimeConfig as z };
|
|
509
|
+
export { processSpecialSyntax as A, BUILTIN_COMMANDS as B, rateLimitedCall as D, registerConfiguredCustomProviders as E, runInkInteractiveMode as F, runInteractiveMode as G, saveConfig as H, touchContext as J, KODAX_CONFIG_FILE as K, PERMISSION_MODES as P, KODAX_DIR as f, KODAX_SESSIONS_DIR as g, KODAX_VERSION as h, PREVIEW_MAX_LENGTH as i, computeConfirmTools as l, createInteractiveContext as m, executeCommand as n, getGitRoot as o, getProviderList as p, getProviderModel as q, getVersion as r, hydrateProcessEnvFromShell as s, isPermissionMode as t, isProviderConfigured as u, loadConfig as v, normalizePermissionMode as w, parseCommand as x, permissionModeDisplayName as y, prepareRuntimeConfig as z };
|
|
532
510
|
export type { Command as C, InkREPLOptions as I, RepLOptions as R, CommandCallbacks as a, ConfirmResult as b, CurrentConfig as c, InteractiveContext as d, InteractiveMode as e, PermissionContext as j, PermissionMode as k };
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodax-ai/kodax",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.44",
|
|
4
4
|
"description": "极致轻量化 Coding Agent - TypeScript 实现,支持 12 个 LLM 提供商,可发布为免 Node 单文件二进制",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
6
10
|
"workspaces": [
|
|
7
11
|
"packages/*"
|
|
8
12
|
],
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
"scripts": {
|
|
50
54
|
"build": "npm run build:packages && npm run build:bundle && npm run build:dts",
|
|
51
55
|
"build:dts": "node scripts/build-dts.mjs",
|
|
52
|
-
"build:packages": "tsc -b tsconfig.build.json && npm run copy:builtin -w @kodax-ai/
|
|
56
|
+
"build:packages": "tsc -b tsconfig.build.json && npm run copy:builtin -w @kodax-ai/agent && npm run copy:provider-caps -w @kodax-ai/llm",
|
|
53
57
|
"build:bundle": "node scripts/build-bundle.mjs",
|
|
54
58
|
"dev": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs --import tsx src/kodax_cli.ts",
|
|
55
59
|
"dev:cli": "node --max-old-space-size=4096 --require ./scripts/production-env.cjs --import tsx src/kodax_cli.ts",
|
|
@@ -150,8 +154,5 @@
|
|
|
150
154
|
"README_CN.md",
|
|
151
155
|
"LICENSE",
|
|
152
156
|
"CHANGELOG.md"
|
|
153
|
-
]
|
|
154
|
-
"publishConfig": {
|
|
155
|
-
"access": "public"
|
|
156
|
-
}
|
|
157
|
+
]
|
|
157
158
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{a as n}from"./chunk-V4WSBIXB.js";var o=class r{static{n(this,"SpanImpl")}id;traceId;parentId;name;data;startedAt;_endedAt;_error;_children=[];now;nextSpanId;onChildCreated;onSpanEnd;_ended=!1;constructor(e){this.id=e.id,this.traceId=e.traceId,this.parentId=e.parentId,this.name=e.name,this.data=e.data,this.now=e.now??(()=>Date.now()),this.startedAt=e.startedAt??this.now(),this.nextSpanId=e.nextSpanId??I,this.onChildCreated=e.onChildCreated,this.onSpanEnd=e.onSpanEnd}get endedAt(){return this._endedAt}get error(){return this._error}get children(){return this._children}addChild(e,a){let t=new r({id:this.nextSpanId(),traceId:this.traceId,parentId:this.id,name:e,data:a,now:this.now,nextSpanId:this.nextSpanId,onChildCreated:this.onChildCreated,onSpanEnd:this.onSpanEnd});return this._children.push(t),this.onChildCreated&&this.onChildCreated(t),t}setError(e){e instanceof Error?this._error={message:e.message,stack:e.stack}:this._error=e}end(){this._ended||(this._ended=!0,this._endedAt=this.now(),this.onSpanEnd&&this.onSpanEnd(this))}},f=0;function I(){f+=1;let r=Math.random().toString(36).slice(2,8);return`span-${Date.now()}-${f}-${r}`}n(I,"defaultNextSpanId");var g=0;function w(){g+=1;let r=Math.random().toString(36).slice(2,8);return`trace-${Date.now()}-${g}-${r}`}n(w,"defaultNextTraceId");function s(r={}){let e=r.now??(()=>Date.now()),a=r.id??(r.nextTraceId??w)(),t=e(),u=r.name??"trace",T=r.metadata??new Map,x=r.rootSpanData??{kind:"agent",agentName:u},m=!1,h,v,d=new o({id:`${a}-root`,traceId:a,name:u,data:x,startedAt:t,now:e,nextSpanId:r.nextSpanId,onChildCreated:r.onSpanStart,onSpanEnd:r.onSpanEnd});r.onSpanStart&&r.onSpanStart(d);let y={id:a,startedAt:t,rootSpan:d,metadata:T,get endedAt(){return h},get error(){return v??d.error},end(){m||(m=!0,h=e(),d.end(),r.onTraceEnd&&r.onTraceEnd(y))}};return y}n(s,"createTrace");var p=[];function c(r){for(let e of p)try{e.onSpanStart(r)}catch{}}n(c,"_emitSpanStart");function l(r){for(let e of p)try{e.onSpanEnd(r)}catch{}}n(l,"_emitSpanEnd");function S(r){for(let e of p)try{e.onTraceEnd(r)}catch{}}n(S,"_emitTraceEnd");var i=class{static{n(this,"Tracer")}options;constructor(e={}){this.options=e}startTrace(e={}){return s({id:e.id,name:e.name,rootSpanData:e.rootSpanData,metadata:e.metadata,now:this.options.now,nextSpanId:this.options.nextSpanId,nextTraceId:this.options.nextTraceId,onSpanStart:c,onSpanEnd:l,onTraceEnd:S})}},E=new i;export{E as a};
|