@kodax-ai/kodax 0.7.77 → 0.7.78
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 +176 -4
- package/README.md +200 -64
- package/README_CN.md +153 -49
- package/config-templates/config.example.jsonc +114 -32
- package/dist/chunks/agent-ASP4MS3X.js +2 -0
- package/dist/chunks/argument-completer-JYQ7FX3W.js +2 -0
- package/dist/chunks/{chunk-XSA37BVM.js → chunk-2CFHBKRE.js} +1 -1
- package/dist/chunks/chunk-35PPHOQ2.js +292 -0
- package/dist/chunks/chunk-43QNNDHR.js +29 -0
- package/dist/chunks/chunk-5BNQXXGY.js +1 -0
- package/dist/chunks/chunk-5GO6FH7L.js +458 -0
- package/dist/chunks/{chunk-FSXI4MAV.js → chunk-5NDCSFOP.js} +14 -14
- package/dist/chunks/{chunk-3DD4QEBH.js → chunk-6FOJVETH.js} +10 -10
- package/dist/chunks/chunk-6XM4B6K2.js +48 -0
- package/dist/chunks/chunk-6YZUE6NC.js +240 -0
- package/dist/chunks/{chunk-HORNWBYR.js → chunk-7OEBJGHK.js} +1 -1
- package/dist/chunks/{chunk-OAMKECRG.js → chunk-KQLQYHWU.js} +205 -200
- package/dist/chunks/{chunk-IQT4RPCE.js → chunk-NXO6GWSY.js} +2 -2
- package/dist/chunks/chunk-T2XZTLYE.js +316 -0
- package/dist/chunks/chunk-TQDBTTIM.js +348 -0
- package/dist/chunks/{chunk-FNW2XUL5.js → chunk-UID7BLAB.js} +1 -1
- package/dist/chunks/chunk-VAT2QYXM.js +765 -0
- package/dist/chunks/chunk-YAZQTC2L.js +5 -0
- package/dist/chunks/chunk-YVRYHC4C.js +655 -0
- package/dist/chunks/{chunk-EH7AOMJ7.js → chunk-Z3KFRTSB.js} +1 -1
- package/dist/chunks/compaction-config-BQSSIWK5.js +2 -0
- package/dist/chunks/{construction-bootstrap-RPRL3L7R.js → construction-bootstrap-VQLQGWPY.js} +1 -1
- package/dist/chunks/{dist-FDSOIR35.js → dist-BFT5YIGU.js} +1 -1
- package/dist/chunks/dist-PCFE24YP.js +2 -0
- package/dist/chunks/host-UTFXCYYM.js +2 -0
- package/dist/chunks/run-manager-PJU3WIFJ.js +2 -0
- package/dist/chunks/utils-SID4HW2Q.js +2 -0
- package/dist/index.d.ts +18 -17
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1751 -1352
- package/dist/kodax_resume.js +17 -17
- package/dist/runtime-worker.js +1680 -1299
- package/dist/sandbox-workspace-session.js +563 -0
- package/dist/sdk-a2a.d.ts +16 -16
- package/dist/sdk-a2a.js +8 -8
- package/dist/sdk-agent.d.ts +275 -60
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +33 -165
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +2 -2
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +2 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +67 -25
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +194 -147
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +93 -0
- package/dist/sdk-sandbox.js +2 -0
- package/dist/sdk-session.d.ts +6 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.d.ts +2 -2
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +15 -15
- package/dist/types-chunks/{bash-prefix-extractor.d-pZdu6qt7.d.ts → bash-prefix-extractor.d-uAe2Oqda.d.ts} +126 -8
- package/dist/types-chunks/{capsule.d-CxCm1KZz.d.ts → capsule.d-BlSv9l3V.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-CJx9RRd3.d.ts → guardrail.d-BRE_ErEj.d.ts} +1 -1
- package/dist/types-chunks/{guardrail.d-B0PwAZVR.d.ts → guardrail.d-CXDYRgZ3.d.ts} +200 -34
- package/dist/types-chunks/{history-retrieval.d-B__aEN62.d.ts → history-retrieval.d-DtCy7x64.d.ts} +1 -1
- package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts} +23 -8
- package/dist/types-chunks/{public-api.d--fF88JrC.d.ts → public-api.d-B3AohsxN.d.ts} +36 -7
- package/dist/types-chunks/{commands.d-BccESAMV.d.ts → repl.d-Ie_ZXb_U.d.ts} +89 -78
- package/dist/types-chunks/{side-query.d-5JvXhuOZ.d.ts → resolver.d-iAQ9ocLB.d.ts} +3 -66
- package/dist/types-chunks/{run-manager.d-B47hIqnI.d.ts → run-manager.d-D1twIhF9.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-CLWf8Adb.d.ts → sdk-session-DB9KksIx.d.ts} +2 -2
- package/dist/types-chunks/side-query.d-DTuLPcC5.d.ts +77 -0
- package/dist/types-chunks/{types-LanCEDj8.d.ts → types-D3g6XUQr.d.ts} +41 -2
- package/dist/types-chunks/{types.d-RdWRfUEs.d.ts → types.d-BA-Jwpfs.d.ts} +459 -7
- package/dist/types-chunks/{types.d-CODuyyqy.d.ts → types.d-BH0ZkTGf.d.ts} +1 -1
- package/dist/types-chunks/{types.d-DCQVBqVn.d.ts → types.d-BbtGlKZu.d.ts} +25 -3
- package/dist/types-chunks/{types.d-DCsKM8aT.d.ts → types.d-DVDTIfB_.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-CDduqbFw.d.ts → utils.d-CVp6bFl9.d.ts} +22 -6
- package/docs/SDK_EMBEDDER_GUIDE.md +399 -55
- package/package.json +8 -1
- package/dist/chunks/agent-NGSWFE73.js +0 -2
- package/dist/chunks/argument-completer-WGGZPEEO.js +0 -2
- package/dist/chunks/chunk-27QLRH3D.js +0 -5
- package/dist/chunks/chunk-2MQPVY6P.js +0 -770
- package/dist/chunks/chunk-6WAPVAGQ.js +0 -74
- package/dist/chunks/chunk-AOENDSVN.js +0 -448
- package/dist/chunks/chunk-HV2GMZUZ.js +0 -343
- package/dist/chunks/chunk-JS2BHGJP.js +0 -158
- package/dist/chunks/chunk-ON2WG2LG.js +0 -622
- package/dist/chunks/chunk-RUGAAHTF.js +0 -321
- package/dist/chunks/chunk-TGCG7U2W.js +0 -37
- package/dist/chunks/compaction-config-BE7VYWH6.js +0 -2
- package/dist/chunks/dist-ZZBNVTKU.js +0 -2
- package/dist/chunks/host-QAKQVC4A.js +0 -2
- package/dist/chunks/run-manager-N4UFWA2D.js +0 -2
- package/dist/chunks/utils-AUHCI4D5.js +0 -2
- package/dist/types-chunks/center-types.d-BBT122uJ.d.ts +0 -91
package/dist/types-chunks/{integration-config.d-ojG4swOP.d.ts → integration-config.d-BNowXE8k.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as McpServersConfig } from './config.d-CJy1WENT.js';
|
|
2
2
|
|
|
3
|
-
type IntegrationDomain =
|
|
4
|
-
type IntegrationConfigSource =
|
|
3
|
+
type IntegrationDomain = "mcp" | "a2a" | "extensions";
|
|
4
|
+
type IntegrationConfigSource = "user" | "legacy-user" | "default";
|
|
5
5
|
interface McpIntegrationDocument {
|
|
6
6
|
readonly version: 1;
|
|
7
7
|
readonly servers: McpServersConfig;
|
|
@@ -19,7 +19,7 @@ interface IntegrationConfigSnapshot<T extends object> {
|
|
|
19
19
|
readonly loadedAt: string;
|
|
20
20
|
}
|
|
21
21
|
interface IntegrationConfigDiagnostic {
|
|
22
|
-
readonly code:
|
|
22
|
+
readonly code: "invalid-config" | "activation-failed" | "watcher-degraded";
|
|
23
23
|
readonly message: string;
|
|
24
24
|
readonly time: string;
|
|
25
25
|
}
|
|
@@ -33,7 +33,7 @@ interface IntegrationConfigStatus {
|
|
|
33
33
|
readonly watching: boolean;
|
|
34
34
|
}
|
|
35
35
|
interface LegacyIntegrationMigrationDomainPlan {
|
|
36
|
-
readonly action:
|
|
36
|
+
readonly action: "create" | "none";
|
|
37
37
|
readonly entries: number;
|
|
38
38
|
readonly destination: string;
|
|
39
39
|
readonly reason?: string;
|
|
@@ -44,9 +44,12 @@ interface LegacyIntegrationMigrationPlan {
|
|
|
44
44
|
readonly warnings: readonly string[];
|
|
45
45
|
}
|
|
46
46
|
interface LegacyIntegrationMigrationResult extends LegacyIntegrationMigrationPlan {
|
|
47
|
-
readonly applied: readonly (
|
|
47
|
+
readonly applied: readonly ("mcp" | "extensions")[];
|
|
48
48
|
readonly cleanedLegacy: boolean;
|
|
49
49
|
}
|
|
50
|
+
declare class IntegrationConfigConflictError extends Error {
|
|
51
|
+
constructor(file: string, expected: string | undefined, actual: string | undefined);
|
|
52
|
+
}
|
|
50
53
|
type IntegrationDocumentValidator<T extends object> = (value: unknown) => T;
|
|
51
54
|
type IntegrationConfigListener<T extends object> = (snapshot: IntegrationConfigSnapshot<T>, previous: IntegrationConfigSnapshot<T> | undefined) => Promise<void> | void;
|
|
52
55
|
type IntegrationReloadResult<T extends object> = {
|
|
@@ -71,7 +74,8 @@ declare function writeIntegrationDocument<T extends object>(input: {
|
|
|
71
74
|
readonly configHome: string;
|
|
72
75
|
readonly document: T;
|
|
73
76
|
readonly validate: IntegrationDocumentValidator<T>;
|
|
74
|
-
|
|
77
|
+
/** `null` means the destination must still be absent when committed. */
|
|
78
|
+
readonly expectedRevision?: string | null;
|
|
75
79
|
}): IntegrationConfigSnapshot<T>;
|
|
76
80
|
declare class IntegrationConfigController<T extends object> {
|
|
77
81
|
#private;
|
|
@@ -80,6 +84,17 @@ declare class IntegrationConfigController<T extends object> {
|
|
|
80
84
|
readonly configHome: string;
|
|
81
85
|
readonly validate: IntegrationDocumentValidator<T>;
|
|
82
86
|
readonly read: () => IntegrationConfigSnapshot<T>;
|
|
87
|
+
/**
|
|
88
|
+
* Optional legacy source consulted only while the split domain file is
|
|
89
|
+
* absent. It participates in both filesystem watching and polling.
|
|
90
|
+
*/
|
|
91
|
+
readonly fallbackPath?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Explicit fail-closed document used only when the first disk read is
|
|
94
|
+
* invalid. The diagnostic remains visible and a later valid file replaces
|
|
95
|
+
* this snapshot through the normal reload path.
|
|
96
|
+
*/
|
|
97
|
+
readonly coldStartDefault?: T;
|
|
83
98
|
});
|
|
84
99
|
initialize(): Promise<IntegrationConfigSnapshot<T>>;
|
|
85
100
|
snapshot(): IntegrationConfigSnapshot<T> | undefined;
|
|
@@ -91,5 +106,5 @@ declare class IntegrationConfigController<T extends object> {
|
|
|
91
106
|
close(): void;
|
|
92
107
|
}
|
|
93
108
|
|
|
94
|
-
export {
|
|
95
|
-
export type { ExtensionsIntegrationDocument as E, LegacyIntegrationMigrationDomainPlan as L, McpIntegrationDocument as M, IntegrationConfigDiagnostic as
|
|
109
|
+
export { IntegrationConfigConflictError as I, IntegrationConfigController as a, parseMcpIntegrationDocument as k, planLegacyIntegrationMigration as l, migrateLegacyIntegrationConfig as m, readMcpIntegration as n, resolveIntegrationConfigPath as o, parseExtensionsIntegrationDocument as p, readExtensionsIntegration as r, writeIntegrationDocument as w };
|
|
110
|
+
export type { ExtensionsIntegrationDocument as E, LegacyIntegrationMigrationDomainPlan as L, McpIntegrationDocument as M, IntegrationConfigDiagnostic as b, IntegrationConfigListener as c, IntegrationConfigSnapshot as d, IntegrationConfigSource as e, IntegrationConfigStatus as f, IntegrationDocumentValidator as g, IntegrationDomain as h, LegacyIntegrationMigrationPlan as i, LegacyIntegrationMigrationResult as j };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as BashPrefixExtractor, t as KodaXAgentMode } from './bash-prefix-extractor.d-
|
|
1
|
+
import { a as BashPrefixExtractor, t as KodaXAgentMode } from './bash-prefix-extractor.d-uAe2Oqda.js';
|
|
2
2
|
import { F as KodaXReasoningMode, k as KodaXMessage, S as KodaXTaskResultMetadata } from './types.d-DIpZJKUl.js';
|
|
3
|
-
import {
|
|
4
|
-
import { bH as KodaXSessionData, bM as KodaXSessionLineage, bR as KodaXSessionNavigationOptions, bT as KodaXSessionRuntimeInfo, bV as KodaXSessionStorage, i as AgentActorSnapshot, aQ as CompactionReport, by as KodaXJsonValue } from './types.d-RdWRfUEs.js';
|
|
3
|
+
import { cP as LearningSurfaceSnapshot$1, cK as LearningQuery, cJ as LearningPage, cm as LearnedCapabilityRecord, cF as LearningEvent, cO as LearningSubscribeOptions, bP as KodaXSessionData, bU as KodaXSessionLineage, bZ as KodaXSessionNavigationOptions, b$ as KodaXSessionRuntimeInfo, c1 as KodaXSessionStorage, j as AgentActorSnapshot, aU as CompactionReport, bF as KodaXJsonValue } from './types.d-BA-Jwpfs.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* TextBuffer - Text buffer management class - 文本缓冲区管理类
|
|
@@ -904,6 +903,7 @@ declare function createMemorySessionStorage(): SessionStorage;
|
|
|
904
903
|
|
|
905
904
|
declare class FileSessionStorage implements KodaXSessionStorage {
|
|
906
905
|
private readonly sessionsDir;
|
|
906
|
+
private readonly configHome;
|
|
907
907
|
/**
|
|
908
908
|
* v0.7.46 — optional explicit project cwd for in-process embedders
|
|
909
909
|
* (KodaX Space) serving multiple projects from a single runtime.
|
|
@@ -927,6 +927,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
927
927
|
private readonly emitMismatchWarnings;
|
|
928
928
|
constructor(opts?: {
|
|
929
929
|
sessionsDir?: string;
|
|
930
|
+
configHome?: string;
|
|
930
931
|
cwd?: string;
|
|
931
932
|
emitMismatchWarnings?: boolean;
|
|
932
933
|
});
|
|
@@ -934,6 +935,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
934
935
|
getSessionsDir(): string;
|
|
935
936
|
private writeQueues;
|
|
936
937
|
private serializedWrite;
|
|
938
|
+
private sessionWriteLockPath;
|
|
937
939
|
private appendState;
|
|
938
940
|
private sessionDirCache;
|
|
939
941
|
private projectJsonWritten;
|
|
@@ -969,9 +971,13 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
969
971
|
private shouldRunMaintenance;
|
|
970
972
|
private runMaintenance;
|
|
971
973
|
save(id: string, data: SessionData): Promise<void>;
|
|
974
|
+
mutateLineage(id: string, mutation: (lineage: KodaXSessionLineage) => KodaXSessionLineage): Promise<boolean>;
|
|
972
975
|
/** F270/F269 owner mutation: CAS-update only the Actor section of a session snapshot. */
|
|
973
976
|
saveActorSnapshot(id: string, snapshot: AgentActorSnapshot, expectedRevision: number): Promise<void>;
|
|
977
|
+
/** Read Session data without recovery writes or append-watermark mutation. */
|
|
978
|
+
peek(id: string): Promise<SessionData | null>;
|
|
974
979
|
load(id: string): Promise<SessionData | null>;
|
|
980
|
+
isArchived(id: string): Promise<boolean>;
|
|
975
981
|
getLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
976
982
|
loadFullLineage(id: string): Promise<KodaXSessionLineage | null>;
|
|
977
983
|
setActiveEntry(id: string, selector: string, options?: {
|
|
@@ -1016,26 +1022,43 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
1016
1022
|
* (never orphans the sidecar). No-op + returns false for a missing session.
|
|
1017
1023
|
*/
|
|
1018
1024
|
archive(id: string): Promise<boolean>;
|
|
1025
|
+
archiveOwned(id: string, ownerId: string): Promise<boolean>;
|
|
1026
|
+
private archiveWithActorOwner;
|
|
1019
1027
|
/** Restore an archived session back into its project directory. */
|
|
1020
1028
|
unarchive(id: string): Promise<boolean>;
|
|
1029
|
+
unarchiveOwned(id: string, ownerId: string): Promise<boolean>;
|
|
1030
|
+
private unarchiveWithActorOwner;
|
|
1021
1031
|
/**
|
|
1022
1032
|
* Move a session + its island sidecar between two directories. Propagates a
|
|
1023
1033
|
* non-ENOENT rename error (e.g. Windows file-in-use) so a partial move is
|
|
1024
1034
|
* surfaced as a failure instead of silently splitting main + sidecar.
|
|
1025
1035
|
*/
|
|
1026
1036
|
private movePair;
|
|
1037
|
+
/**
|
|
1038
|
+
* Remove a complete Session file set without exposing a partial failure.
|
|
1039
|
+
* Every canonical path is first renamed to an ignored tombstone. A staging
|
|
1040
|
+
* failure rolls all prior renames back; only after the full set is hidden do
|
|
1041
|
+
* we unlink tombstones. A locked tombstone is recoverable and no longer
|
|
1042
|
+
* represents a live Session, so cleanup failure is diagnostic rather than a
|
|
1043
|
+
* failed logical deletion.
|
|
1044
|
+
*/
|
|
1045
|
+
private removeFileSetAtomically;
|
|
1046
|
+
private assertActorFileOwner;
|
|
1027
1047
|
delete(id: string): Promise<void>;
|
|
1048
|
+
/** Strict deletion path for the Runtime that already owns the Actor tree. */
|
|
1049
|
+
deleteOwned(id: string, ownerId: string): Promise<void>;
|
|
1050
|
+
private deleteWithActorOwner;
|
|
1028
1051
|
deleteAll(gitRoot?: string): Promise<void>;
|
|
1029
1052
|
/**
|
|
1030
|
-
* Auto-retention: delete
|
|
1053
|
+
* Auto-retention: delete a complete Session file set when its main file
|
|
1031
1054
|
* mtime is older than `retentionDays`. Modeled on claudecode's
|
|
1032
1055
|
* `cleanup.ts` (`unlinkIfOld`). Bounds the sessions directory so it never
|
|
1033
1056
|
* accumulates unboundedly — which is what keeps `list()`'s head-read pass
|
|
1034
1057
|
* fast (its cost scales with file COUNT, not size). A non-positive /
|
|
1035
1058
|
* non-finite `retentionDays` disables cleanup (no-op). Best-effort: per-file
|
|
1036
|
-
* errors are
|
|
1037
|
-
* sweep.
|
|
1038
|
-
*
|
|
1059
|
+
* errors are isolated so a single locked/racing file never aborts the
|
|
1060
|
+
* sweep. Durable Actor owners and non-terminal turns are never eligible.
|
|
1061
|
+
* Returns the number of files removed.
|
|
1039
1062
|
*/
|
|
1040
1063
|
cleanupOldSessions(retentionDays: number): Promise<number>;
|
|
1041
1064
|
}
|
|
@@ -1308,6 +1331,10 @@ type DeleteSessionResult = {
|
|
|
1308
1331
|
startedAt: number;
|
|
1309
1332
|
};
|
|
1310
1333
|
};
|
|
1334
|
+
} | {
|
|
1335
|
+
error: {
|
|
1336
|
+
code: 'delete_failed';
|
|
1337
|
+
};
|
|
1311
1338
|
};
|
|
1312
1339
|
/**
|
|
1313
1340
|
* Delete a session by ID.
|
|
@@ -1347,9 +1374,11 @@ declare function watchSessions(cb: WatchSessionsCallback): {
|
|
|
1347
1374
|
* that directory instead of the module-load-frozen `KODAX_SESSIONS_DIR`.
|
|
1348
1375
|
* `listRunningSessions` still consults the agent-config-home instances
|
|
1349
1376
|
* directory (sibling-process awareness is not scoped per sessions dir).
|
|
1377
|
+
* `configHome` binds rewind/setActive review fencing to the same Runtime owner.
|
|
1350
1378
|
*/
|
|
1351
1379
|
declare function createSessionManager(opts?: {
|
|
1352
1380
|
sessionsDir?: string;
|
|
1381
|
+
configHome?: string;
|
|
1353
1382
|
}): SessionManager;
|
|
1354
1383
|
|
|
1355
1384
|
export { KeypressHandlerPriority as B, DEFAULT_UI_STATE as D, FILE_MODIFICATION_TOOLS as F, MemorySessionStorage as M, PERMISSION_MODES as P, StreamingState as a0, TOOL_STATUS_ICONS as a2, TextBuffer as a3, ToolCallStatus as a9, appendClientNotice as ag, archiveSession as ah, compactSession as ai, computeConfirmTools as aj, createMemorySessionStorage as ak, createSessionManager as al, deleteSession as am, forkSession as an, isPermissionMode as ao, listRunningSessions as ap, listSessions as aq, loadFullTranscript as ar, loadSession as as, normalizePermissionMode as at, permissionModeDisplayName as au, rewindSession as av, setActiveEntry as aw, unarchiveSession as ax, watchSessions as ay, FileSessionStorage as j };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { n as ResolvedAutoModeSettings, b as CommandDefinition, e as CommandSource, c as CommandInfo, C as Command$1, I as InteractiveContext, a as CommandCallbacks, g as CurrentConfig, d as CommandInvocationRequest, f as CommandWorkflowInvocationRequest, p as RuntimeSurfaceStatus } from './utils.d-CVp6bFl9.js';
|
|
2
|
+
import { X as SessionStorage$1, R as PermissionMode, L as LearningBinding } from './public-api.d-B3AohsxN.js';
|
|
3
|
+
import { a1 as KodaXOptions, ad as KodaXResult } from './bash-prefix-extractor.d-uAe2Oqda.js';
|
|
4
|
+
import { c1 as KodaXSessionStorage, bP as KodaXSessionData } from './types.d-BA-Jwpfs.js';
|
|
5
|
+
import { s as AutoModeStats } from './guardrail.d-CXDYRgZ3.js';
|
|
6
6
|
|
|
7
7
|
interface ReplRuntimePermissionGrantSuggestion {
|
|
8
8
|
readonly id: string;
|
|
@@ -49,77 +49,6 @@ interface ReplRuntimeAutoModeSettings {
|
|
|
49
49
|
}
|
|
50
50
|
declare function toReplRuntimeAutoModeSettings(settings: ResolvedAutoModeSettings): ReplRuntimeAutoModeSettings;
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
* InkREPL - Ink-based REPL Adapter
|
|
54
|
-
*
|
|
55
|
-
* Bridges Ink UI components with existing KodaX command processing logic.
|
|
56
|
-
* Replaces the Node.js readline-based input with Ink's React components.
|
|
57
|
-
*
|
|
58
|
-
* Architecture based on Gemini CLI:
|
|
59
|
-
* - Uses UIStateContext for global state
|
|
60
|
-
* - Uses KeypressContext for priority-based keyboard handling
|
|
61
|
-
* - Uses StreamingContext for streaming response management
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
interface InkRuntimeRunnerInput {
|
|
65
|
-
readonly options: KodaXOptions;
|
|
66
|
-
readonly prompt: string;
|
|
67
|
-
readonly sessionId: string;
|
|
68
|
-
readonly permissionMode: PermissionMode;
|
|
69
|
-
readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
|
|
70
|
-
readonly requestPermission?: ReplRuntimePermissionPrompt;
|
|
71
|
-
/** Marks the callback installed by the REPL's legacy permission UI. */
|
|
72
|
-
readonly legacyPermissionHook?: true;
|
|
73
|
-
}
|
|
74
|
-
type InkRuntimeRunner = (input: InkRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
75
|
-
type InkRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
76
|
-
interface InkREPLOptions extends KodaXOptions {
|
|
77
|
-
storage?: SessionStorage$1;
|
|
78
|
-
hardExitOnClose?: boolean;
|
|
79
|
-
runtimeRunner?: InkRuntimeRunner;
|
|
80
|
-
runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
|
|
81
|
-
getRuntimeStatus?: InkRuntimeStatusProvider;
|
|
82
|
-
learning?: LearningBinding;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Run Ink-based interactive mode
|
|
86
|
-
*/
|
|
87
|
-
declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
|
|
88
|
-
|
|
89
|
-
interface SessionStorage extends KodaXSessionStorage {
|
|
90
|
-
list(gitRoot?: string, options?: {
|
|
91
|
-
limit?: number;
|
|
92
|
-
includeArchived?: boolean;
|
|
93
|
-
}): Promise<Array<{
|
|
94
|
-
id: string;
|
|
95
|
-
title: string;
|
|
96
|
-
msgCount: number;
|
|
97
|
-
tag?: string;
|
|
98
|
-
runtimeInfo?: KodaXSessionData['runtimeInfo'];
|
|
99
|
-
}>>;
|
|
100
|
-
}
|
|
101
|
-
interface ReplRuntimeRunnerInput {
|
|
102
|
-
readonly options: KodaXOptions;
|
|
103
|
-
readonly prompt: string;
|
|
104
|
-
readonly sessionId: string;
|
|
105
|
-
readonly permissionMode: PermissionMode;
|
|
106
|
-
readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
|
|
107
|
-
readonly requestPermission?: ReplRuntimePermissionPrompt;
|
|
108
|
-
/** Marks the callback installed by the REPL's legacy permission UI. */
|
|
109
|
-
readonly legacyPermissionHook?: true;
|
|
110
|
-
}
|
|
111
|
-
type ReplRuntimeRunner = (input: ReplRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
112
|
-
type ReplRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
113
|
-
interface RepLOptions extends KodaXOptions {
|
|
114
|
-
storage?: SessionStorage;
|
|
115
|
-
runtimeRunner?: ReplRuntimeRunner;
|
|
116
|
-
runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
|
|
117
|
-
getRuntimeStatus?: ReplRuntimeStatusProvider;
|
|
118
|
-
learning?: LearningBinding;
|
|
119
|
-
}
|
|
120
|
-
declare function runInteractiveMode(options: RepLOptions): Promise<void>;
|
|
121
|
-
declare function processSpecialSyntax(input: string, executionCwd?: string): Promise<string>;
|
|
122
|
-
|
|
123
52
|
/**
|
|
124
53
|
* Command Registry - Dynamic command registration system
|
|
125
54
|
* 命令注册表 - 动态命令注册系统
|
|
@@ -270,5 +199,87 @@ declare function executeCommand(parsed: {
|
|
|
270
199
|
};
|
|
271
200
|
}, context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig): Promise<CommandResult>;
|
|
272
201
|
|
|
273
|
-
|
|
274
|
-
|
|
202
|
+
/**
|
|
203
|
+
* InkREPL - Ink-based REPL Adapter
|
|
204
|
+
*
|
|
205
|
+
* Bridges Ink UI components with existing KodaX command processing logic.
|
|
206
|
+
* Replaces the Node.js readline-based input with Ink's React components.
|
|
207
|
+
*
|
|
208
|
+
* Architecture based on Gemini CLI:
|
|
209
|
+
* - Uses UIStateContext for global state
|
|
210
|
+
* - Uses KeypressContext for priority-based keyboard handling
|
|
211
|
+
* - Uses StreamingContext for streaming response management
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
interface InkRuntimeRunnerInput {
|
|
215
|
+
readonly options: KodaXOptions;
|
|
216
|
+
readonly prompt: string;
|
|
217
|
+
readonly sessionId: string;
|
|
218
|
+
readonly permissionMode: PermissionMode;
|
|
219
|
+
readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
|
|
220
|
+
readonly requestPermission?: ReplRuntimePermissionPrompt;
|
|
221
|
+
/** Marks the callback installed by the REPL's legacy permission UI. */
|
|
222
|
+
readonly legacyPermissionHook?: true;
|
|
223
|
+
}
|
|
224
|
+
type InkRuntimeRunner = (input: InkRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
225
|
+
type InkRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
226
|
+
interface InkTransientNotice {
|
|
227
|
+
readonly text: string;
|
|
228
|
+
readonly tone: "success" | "warning";
|
|
229
|
+
}
|
|
230
|
+
interface InkREPLOptions extends KodaXOptions {
|
|
231
|
+
storage?: SessionStorage$1;
|
|
232
|
+
hardExitOnClose?: boolean;
|
|
233
|
+
runtimeRunner?: InkRuntimeRunner;
|
|
234
|
+
runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
|
|
235
|
+
getRuntimeStatus?: InkRuntimeStatusProvider;
|
|
236
|
+
validateSetupA2AConfig?: (value: unknown) => unknown;
|
|
237
|
+
prepareSetupSandbox?: CommandCallbacks['prepareSetupSandbox'];
|
|
238
|
+
inspectSandbox?: CommandCallbacks['inspectSandbox'];
|
|
239
|
+
learning?: LearningBinding;
|
|
240
|
+
subscribeTransientNotices?: (listener: (notice: InkTransientNotice) => void) => () => void;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Run Ink-based interactive mode
|
|
244
|
+
*/
|
|
245
|
+
declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
|
|
246
|
+
|
|
247
|
+
interface SessionStorage extends KodaXSessionStorage {
|
|
248
|
+
list(gitRoot?: string, options?: {
|
|
249
|
+
limit?: number;
|
|
250
|
+
includeArchived?: boolean;
|
|
251
|
+
}): Promise<Array<{
|
|
252
|
+
id: string;
|
|
253
|
+
title: string;
|
|
254
|
+
msgCount: number;
|
|
255
|
+
tag?: string;
|
|
256
|
+
runtimeInfo?: KodaXSessionData['runtimeInfo'];
|
|
257
|
+
}>>;
|
|
258
|
+
}
|
|
259
|
+
interface ReplRuntimeRunnerInput {
|
|
260
|
+
readonly options: KodaXOptions;
|
|
261
|
+
readonly prompt: string;
|
|
262
|
+
readonly sessionId: string;
|
|
263
|
+
readonly permissionMode: PermissionMode;
|
|
264
|
+
readonly autoModeSettings?: ReplRuntimeAutoModeSettings;
|
|
265
|
+
readonly requestPermission?: ReplRuntimePermissionPrompt;
|
|
266
|
+
/** Marks the callback installed by the REPL's legacy permission UI. */
|
|
267
|
+
readonly legacyPermissionHook?: true;
|
|
268
|
+
}
|
|
269
|
+
type ReplRuntimeRunner = (input: ReplRuntimeRunnerInput) => Promise<KodaXResult>;
|
|
270
|
+
type ReplRuntimeStatusProvider = () => Promise<RuntimeSurfaceStatus | undefined>;
|
|
271
|
+
interface RepLOptions extends KodaXOptions {
|
|
272
|
+
storage?: SessionStorage;
|
|
273
|
+
runtimeRunner?: ReplRuntimeRunner;
|
|
274
|
+
runtimeAutoModeControl?: ReplRuntimeAutoModeControl;
|
|
275
|
+
getRuntimeStatus?: ReplRuntimeStatusProvider;
|
|
276
|
+
validateSetupA2AConfig?: (value: unknown) => unknown;
|
|
277
|
+
prepareSetupSandbox?: CommandCallbacks['prepareSetupSandbox'];
|
|
278
|
+
inspectSandbox?: CommandCallbacks['inspectSandbox'];
|
|
279
|
+
learning?: LearningBinding;
|
|
280
|
+
}
|
|
281
|
+
declare function runInteractiveMode(options: RepLOptions): Promise<void>;
|
|
282
|
+
declare function processSpecialSyntax(input: string, executionCwd?: string): Promise<string>;
|
|
283
|
+
|
|
284
|
+
export { BUILTIN_COMMANDS as B, RUNTIME_PERMISSION_PENDING_NOTICE as R, executeCommand as o, getCommandRegistry as p, parseCommand as q, processSpecialSyntax as r, runInkInteractiveMode as s, runInteractiveMode as t, toReplRuntimeAutoModeSettings as u };
|
|
285
|
+
export type { Command as C, InkREPLOptions as I, InkRuntimeRunner as a, InkRuntimeRunnerInput as b, InkRuntimeStatusProvider as c, InkTransientNotice as d, RepLOptions as e, ReplRuntimeAutoModeControl as f, ReplRuntimeAutoModeSettings as g, ReplRuntimePermissionDecision as h, ReplRuntimePermissionGrantSuggestion as i, ReplRuntimePermissionPrompt as j, ReplRuntimePermissionRequest as k, ReplRuntimeRunner as l, ReplRuntimeRunnerInput as m, ReplRuntimeStatusProvider as n };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { F as KodaXReasoningMode, M as KodaXStableEffortIntent, a9 as KodaXWireReasoningEffort, G as KodaXReasoningProfile, Z as KodaXThinkingBudgetMap, _ as KodaXThinkingDepth, q as KodaXProviderConfig, B as KodaXReasoningCapability, H as KodaXReasoningRequest, n as KodaXNormalizedReasoningRequest, V as KodaXTaskType, a7 as KodaXVerifyCredentialResult, a1 as KodaXToolDefinition, k as KodaXMessage, y as KodaXProviderStreamOptions, N as KodaXStreamResult, l as KodaXModelDescriptor, p as KodaXProviderCapabilityProfile, a8 as KodaXVerifyStrategy, d as KodaXCustomProviderConfig, j as KodaXListModelsResult
|
|
1
|
+
import { F as KodaXReasoningMode, M as KodaXStableEffortIntent, a9 as KodaXWireReasoningEffort, G as KodaXReasoningProfile, Z as KodaXThinkingBudgetMap, _ as KodaXThinkingDepth, q as KodaXProviderConfig, B as KodaXReasoningCapability, H as KodaXReasoningRequest, n as KodaXNormalizedReasoningRequest, V as KodaXTaskType, a7 as KodaXVerifyCredentialResult, a1 as KodaXToolDefinition, k as KodaXMessage, y as KodaXProviderStreamOptions, N as KodaXStreamResult, l as KodaXModelDescriptor, p as KodaXProviderCapabilityProfile, a8 as KodaXVerifyStrategy, d as KodaXCustomProviderConfig, j as KodaXListModelsResult } from './types.d-DIpZJKUl.js';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
3
|
import { K as KodaXBaseProvider } from './base.d-4e74xDdy.js';
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
|
-
import { a as CostTracker } from './cost-tracker.d-BeaenODW.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* KodaX AI Errors
|
|
@@ -661,67 +660,5 @@ declare function listProviderModels(name: string, _opts?: {
|
|
|
661
660
|
signal?: AbortSignal;
|
|
662
661
|
}): Promise<KodaXListModelsResult>;
|
|
663
662
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
*
|
|
667
|
-
* Used by features that need a clean LLM call outside the main agent loop.
|
|
668
|
-
* The auto mode classifier (FEATURE_092) is the first consumer; future
|
|
669
|
-
* users include compaction, title generation, and SA mutation reflection.
|
|
670
|
-
*
|
|
671
|
-
* Constraints (deliberate):
|
|
672
|
-
* - tools=[] hardcoded — sideQuery is single-turn, no tool loop
|
|
673
|
-
* - text-only output — tool_use blocks from the model produce stopReason='error'
|
|
674
|
-
* - independent timeout (default 30s; callers may supply a bounded deadline)
|
|
675
|
-
* - independent cost bucket via querySource (mapped to TokenUsageRecord.role)
|
|
676
|
-
*
|
|
677
|
-
* Failure handling: never throws. Timeout, abort, provider error, and
|
|
678
|
-
* unexpected tool_use all produce a result with stopReason='timeout' /
|
|
679
|
-
* 'aborted' / 'error' so callers implement their own degradation.
|
|
680
|
-
*/
|
|
681
|
-
|
|
682
|
-
type SideQueryStopReason = 'end_turn' | 'max_tokens' | 'timeout' | 'aborted' | 'error';
|
|
683
|
-
interface SideQueryRequest {
|
|
684
|
-
readonly provider: KodaXBaseProvider;
|
|
685
|
-
readonly model: string;
|
|
686
|
-
readonly system: string;
|
|
687
|
-
readonly messages: readonly KodaXMessage[];
|
|
688
|
-
readonly reasoning?: KodaXReasoningRequest;
|
|
689
|
-
/** Optional per-request cap for small structured sidecar responses. */
|
|
690
|
-
readonly maxOutputTokens?: number;
|
|
691
|
-
readonly timeoutMs?: number;
|
|
692
|
-
readonly abortSignal?: AbortSignal;
|
|
693
|
-
readonly querySource: string;
|
|
694
|
-
readonly costTracker?: CostTracker;
|
|
695
|
-
}
|
|
696
|
-
interface SideQueryResult {
|
|
697
|
-
readonly text: string;
|
|
698
|
-
readonly usage: KodaXTokenUsage;
|
|
699
|
-
readonly costTracker?: CostTracker;
|
|
700
|
-
readonly stopReason: SideQueryStopReason;
|
|
701
|
-
/**
|
|
702
|
-
* Bounded request metadata only; prompts and response text are never copied.
|
|
703
|
-
* The built-in `sideQuery()` always supplies it. Optionality preserves source
|
|
704
|
-
* compatibility for existing SDK mocks and structural result adapters.
|
|
705
|
-
*/
|
|
706
|
-
readonly diagnostics?: SideQueryDiagnostics;
|
|
707
|
-
readonly error?: Error;
|
|
708
|
-
}
|
|
709
|
-
type SideQueryTerminalPhase = 'completed' | 'pre_output' | 'streaming' | 'contract_error';
|
|
710
|
-
interface SideQueryDiagnostics {
|
|
711
|
-
readonly provider: string;
|
|
712
|
-
readonly model: string;
|
|
713
|
-
readonly timeoutMs: number;
|
|
714
|
-
readonly elapsedMs: number;
|
|
715
|
-
readonly retryCount: number;
|
|
716
|
-
readonly retryWaitMs: number;
|
|
717
|
-
/** Time until the first non-empty text delta, when the adapter exposes it. */
|
|
718
|
-
readonly firstOutputMs?: number;
|
|
719
|
-
/** Time from the first observed text delta until termination. */
|
|
720
|
-
readonly streamMs?: number;
|
|
721
|
-
/** Honest coarse phase; provider adapters cannot split DNS/connect/remote queue. */
|
|
722
|
-
readonly terminalPhase: SideQueryTerminalPhase;
|
|
723
|
-
}
|
|
724
|
-
declare function sideQuery(req: SideQueryRequest): Promise<SideQueryResult>;
|
|
725
|
-
|
|
726
|
-
export { isRuntimeModelProviderName as $, getCustomProviderList as A, getCustomProviderModelDescriptors as B, getCustomProviderModels as C, getCustomProviderNames as D, getDefaultThinkingDepthForMode as E, getModelCapabilities as F, getProvider as G, getProviderConfiguredCapabilityProfile as H, getProviderConfiguredReasoningCapability as I, getProviderCredentialEnvironmentNames as J, KODAX_DEFAULT_PROVIDER as K, getProviderList as L, getProviderModel as M, getProviderModelDescriptors as N, getProviderModels as O, getReasoningCapability as Q, getRuntimeModelProvider as T, getRuntimeModelProviderCredentialEnvironmentNames as U, getRuntimeModelProviderNames as V, isCustomProviderName as W, isKnownProvider as X, isProviderConfigured as Y, isProviderName as Z, isReasoningEnabled as _, KODAX_DEFAULT_THINKING_BUDGETS as a, listAllModelCapabilities as a0, listBuiltinModelCapabilities as a1, listCustomProviderModelCapabilities as a2, listProviderModels as a3, mapDepthToOpenAIReasoningEffort as a4, mapLegacyReasoningModeToEffortIntent as a5, normalizeReasoningEffortValue as a6, normalizeReasoningRequest as a7, parseReasoningEffortEnv as a8, registerCustomProviders as a9, registerModelProvider as aa, resolveModelCapabilities as ab, resolveProvider as ac, resolveProviderModelDescriptors as ad, resolveReasoningEffort as ae, resolveReasoningEffortForModelSwitch as af, resolveThinkingBudget as ag, resolveWireEffort as ah, sideQuery as ai, validateCustomProviderConfig as aj, verifyProviderCredential as ak, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KODAX_STABLE_EFFORT_INTENTS as f, KodaXAnthropicCompatProvider as g, KodaXError as h, KodaXNetworkError as j, KodaXOpenAICompatProvider as k, KodaXProviderError as l, KodaXRateLimitError as m, KodaXToolCallIdError as n, clampThinkingBudget as t, clearRuntimeModelProviders as u, createCustomProvider as v, effortToLegacyReasoningMode as w, getAvailableProviderNames as x, getCustomModelCapabilities as y, getCustomProvider as z };
|
|
727
|
-
export type { ProviderName as P, ResolveWireEffortInput as R, SideQueryDiagnostics as S, KodaXModelCapabilities as i, ResolvedWireEffort as o, SideQueryRequest as p, SideQueryResult as q, SideQueryStopReason as r, SideQueryTerminalPhase as s };
|
|
663
|
+
export { mapDepthToOpenAIReasoningEffort as $, getDefaultThinkingDepthForMode as A, getModelCapabilities as B, getProvider as C, getProviderConfiguredCapabilityProfile as D, getProviderConfiguredReasoningCapability as E, getProviderCredentialEnvironmentNames as F, getProviderList as G, getProviderModel as H, getProviderModelDescriptors as I, getProviderModels as J, KODAX_DEFAULT_PROVIDER as K, getReasoningCapability as L, getRuntimeModelProvider as M, getRuntimeModelProviderCredentialEnvironmentNames as N, getRuntimeModelProviderNames as O, isCustomProviderName as Q, isKnownProvider as S, isProviderConfigured as T, isProviderName as U, isReasoningEnabled as V, isRuntimeModelProviderName as W, listAllModelCapabilities as X, listBuiltinModelCapabilities as Y, listCustomProviderModelCapabilities as Z, listProviderModels as _, KODAX_DEFAULT_THINKING_BUDGETS as a, mapLegacyReasoningModeToEffortIntent as a0, normalizeReasoningEffortValue as a1, normalizeReasoningRequest as a2, parseReasoningEffortEnv as a3, registerCustomProviders as a4, registerModelProvider as a5, resolveModelCapabilities as a6, resolveProvider as a7, resolveProviderModelDescriptors as a8, resolveReasoningEffort as a9, resolveReasoningEffortForModelSwitch as aa, resolveThinkingBudget as ab, resolveWireEffort as ac, validateCustomProviderConfig as ad, verifyProviderCredential as ae, KODAX_PROVIDERS as b, KODAX_PROVIDER_SNAPSHOTS as c, KODAX_REASONING_MODE_SEQUENCE as d, KODAX_REASONING_SAFETY_RESERVE as e, KODAX_STABLE_EFFORT_INTENTS as f, KodaXAnthropicCompatProvider as g, KodaXError as h, KodaXNetworkError as j, KodaXOpenAICompatProvider as k, KodaXProviderError as l, KodaXRateLimitError as m, KodaXToolCallIdError as n, clampThinkingBudget as p, clearRuntimeModelProviders as q, createCustomProvider as r, effortToLegacyReasoningMode as s, getAvailableProviderNames as t, getCustomModelCapabilities as u, getCustomProvider as v, getCustomProviderList as w, getCustomProviderModelDescriptors as x, getCustomProviderModels as y, getCustomProviderNames as z };
|
|
664
|
+
export type { ProviderName as P, ResolveWireEffortInput as R, KodaXModelCapabilities as i, ResolvedWireEffort as o };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f4 as WorkflowProcessTrackerOptions, eC as WorkflowEvent, e_ as WorkflowProcessSnapshot, eU as WorkflowProcessEvent } from './types.d-BA-Jwpfs.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* FEATURE_246 Part A0 (ADR-046) — neutral workflow run lifecycle manager.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as CreatableHistoryItem, a8 as ToolCall } from './public-api.d
|
|
1
|
+
import { g as CreatableHistoryItem, a8 as ToolCall } from './public-api.d-B3AohsxN.js';
|
|
2
2
|
import { k as KodaXMessage, c as KodaXContentBlock } from './types.d-DIpZJKUl.js';
|
|
3
|
-
import {
|
|
3
|
+
import { c3 as KodaXSessionUiHistoryItem, c7 as KodaXSessionUiToolCall } from './types.d-BA-Jwpfs.js';
|
|
4
4
|
|
|
5
5
|
interface RestoreHistoryItemsFromSessionInput {
|
|
6
6
|
messages: readonly KodaXMessage[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { k as KodaXMessage, H as KodaXReasoningRequest, a0 as KodaXTokenUsage } from './types.d-DIpZJKUl.js';
|
|
2
|
+
import { K as KodaXBaseProvider } from './base.d-4e74xDdy.js';
|
|
3
|
+
import { a as CostTracker } from './cost-tracker.d-BeaenODW.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* sideQuery — independent one-shot LLM invocation.
|
|
7
|
+
*
|
|
8
|
+
* Used by features that need a clean LLM call outside the main agent loop.
|
|
9
|
+
* The auto mode classifier (FEATURE_092) is the first consumer; future
|
|
10
|
+
* users include compaction, title generation, and SA mutation reflection.
|
|
11
|
+
*
|
|
12
|
+
* Constraints (deliberate):
|
|
13
|
+
* - tools=[] hardcoded — sideQuery is single-turn, no tool loop
|
|
14
|
+
* - text-only output — tool_use blocks from the model produce stopReason='error'
|
|
15
|
+
* - independent timeout (default 30s; callers may supply a bounded deadline)
|
|
16
|
+
* - independent cost bucket via querySource (mapped to TokenUsageRecord.role)
|
|
17
|
+
*
|
|
18
|
+
* Failure handling: never throws. Timeout, abort, provider error, and
|
|
19
|
+
* unexpected tool_use all produce a result with stopReason='timeout' /
|
|
20
|
+
* 'aborted' / 'error' so callers implement their own degradation.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
type SideQueryStopReason = 'end_turn' | 'max_tokens' | 'timeout' | 'aborted' | 'error';
|
|
24
|
+
interface SideQueryRequest {
|
|
25
|
+
readonly provider: KodaXBaseProvider;
|
|
26
|
+
readonly model: string;
|
|
27
|
+
readonly system: string;
|
|
28
|
+
readonly messages: readonly KodaXMessage[];
|
|
29
|
+
readonly reasoning?: KodaXReasoningRequest;
|
|
30
|
+
/** Optional per-request cap for small structured sidecar responses. */
|
|
31
|
+
readonly maxOutputTokens?: number;
|
|
32
|
+
readonly timeoutMs?: number;
|
|
33
|
+
readonly abortSignal?: AbortSignal;
|
|
34
|
+
readonly querySource: string;
|
|
35
|
+
readonly costTracker?: CostTracker;
|
|
36
|
+
}
|
|
37
|
+
interface SideQueryResult {
|
|
38
|
+
readonly text: string;
|
|
39
|
+
readonly usage: KodaXTokenUsage;
|
|
40
|
+
readonly costTracker?: CostTracker;
|
|
41
|
+
readonly stopReason: SideQueryStopReason;
|
|
42
|
+
/**
|
|
43
|
+
* Bounded request metadata only; prompts and response text are never copied.
|
|
44
|
+
* The built-in `sideQuery()` always supplies it. Optionality preserves source
|
|
45
|
+
* compatibility for existing SDK mocks and structural result adapters.
|
|
46
|
+
*/
|
|
47
|
+
readonly diagnostics?: SideQueryDiagnostics;
|
|
48
|
+
readonly error?: Error;
|
|
49
|
+
}
|
|
50
|
+
type SideQueryTerminalPhase = 'completed' | 'pre_output' | 'awaiting_text' | 'thinking' | 'streaming' | 'contract_error';
|
|
51
|
+
interface SideQueryDiagnostics {
|
|
52
|
+
readonly provider: string;
|
|
53
|
+
readonly model: string;
|
|
54
|
+
readonly timeoutMs: number;
|
|
55
|
+
readonly elapsedMs: number;
|
|
56
|
+
readonly systemBytes: number;
|
|
57
|
+
readonly messageBytes: number;
|
|
58
|
+
readonly promptBytes: number;
|
|
59
|
+
readonly retryCount: number;
|
|
60
|
+
readonly retryWaitMs: number;
|
|
61
|
+
/** Time until the first lifecycle/data event exposed by the provider adapter. */
|
|
62
|
+
readonly firstUpstreamEventMs?: number;
|
|
63
|
+
/** Time until the first non-empty thinking delta. */
|
|
64
|
+
readonly firstThinkingDeltaMs?: number;
|
|
65
|
+
/** Time until the first non-empty text delta. */
|
|
66
|
+
readonly firstTextDeltaMs?: number;
|
|
67
|
+
/** Time until the first non-empty text delta, when the adapter exposes it. */
|
|
68
|
+
readonly firstOutputMs?: number;
|
|
69
|
+
/** Time from the first observed text delta until termination. */
|
|
70
|
+
readonly streamMs?: number;
|
|
71
|
+
/** Honest coarse phase; provider adapters cannot split DNS/connect/remote queue. */
|
|
72
|
+
readonly terminalPhase: SideQueryTerminalPhase;
|
|
73
|
+
}
|
|
74
|
+
declare function sideQuery(req: SideQueryRequest): Promise<SideQueryResult>;
|
|
75
|
+
|
|
76
|
+
export { sideQuery as s };
|
|
77
|
+
export type { SideQueryDiagnostics as S, SideQueryRequest as a, SideQueryResult as b, SideQueryStopReason as c, SideQueryTerminalPhase as d };
|