@kodax-ai/kodax 0.7.63 → 0.7.66
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 +2300 -2204
- package/README.md +79 -7
- package/README_CN.md +52 -3
- package/dist/chunks/{agent-SL444XLN.js → agent-KER4WDNO.js} +1 -1
- package/dist/chunks/argument-completer-HK3MHA3K.js +2 -0
- package/dist/chunks/{chunk-ARUWXX25.js → chunk-35P7QL2Q.js} +1 -1
- package/dist/chunks/chunk-3HKBBY74.js +339 -0
- package/dist/chunks/chunk-AKBH2EEE.js +8 -0
- package/dist/chunks/{chunk-KCFVGXVK.js → chunk-ALS32RNZ.js} +1 -1
- package/dist/chunks/chunk-MHRN2LQV.js +328 -0
- package/dist/chunks/{chunk-HP4FXMEM.js → chunk-NBQW7PNZ.js} +2 -2
- package/dist/chunks/{chunk-S4GVQO3W.js → chunk-O7N22GJ3.js} +1 -1
- package/dist/chunks/chunk-ONUPGMER.js +2 -0
- package/dist/chunks/{chunk-ZL5CEANW.js → chunk-PZTG2C33.js} +1 -1
- package/dist/chunks/{chunk-4MIHVNB7.js → chunk-QAQ2HNXD.js} +112 -112
- package/dist/chunks/{chunk-6OZ5KWG3.js → chunk-QJJKMNZF.js} +1 -1
- package/dist/chunks/chunk-QJVZZSEO.js +56 -0
- package/dist/chunks/chunk-TLJGOKBT.js +729 -0
- package/dist/chunks/{chunk-7MPU7TP6.js → chunk-VS4CDDEF.js} +243 -243
- package/dist/chunks/chunk-WBBEJIAY.js +306 -0
- package/dist/chunks/{chunk-L3MF5V64.js → chunk-WMIZCY2J.js} +1 -1
- package/dist/chunks/{chunk-UA744TZM.js → chunk-YRBNXFHY.js} +1 -1
- package/dist/chunks/compaction-config-7GMUFNPB.js +2 -0
- package/dist/chunks/{construction-bootstrap-EFZBONTK.js → construction-bootstrap-3XDS2D5K.js} +1 -1
- package/dist/chunks/{devtools-4CRULTR2.js → devtools-CD6KSIHE.js} +1 -1
- package/dist/chunks/{devtools-YINBSZC7.js → devtools-XR5F2C6T.js} +1 -1
- package/dist/chunks/{dist-73L4OYPD.js → dist-4PXB7U22.js} +1 -1
- package/dist/chunks/dist-4YAYT2TO.js +2 -0
- package/dist/chunks/host-KG3456QP.js +2 -0
- package/dist/chunks/{paste-FDYM7SZX.js → paste-C33GZQV5.js} +1 -1
- package/dist/chunks/run-manager-6CAH3KTA.js +2 -0
- package/dist/chunks/utils-OT5ENFUL.js +2 -0
- package/dist/constructed-handler-worker.js +2 -0
- package/dist/index.d.ts +21 -10
- package/dist/index.js +6 -6
- package/dist/kodax_cli.js +1116 -1089
- package/dist/runtime-worker.js +2843 -0
- package/dist/sdk-agent.d.ts +27 -8
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +76 -1020
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +2 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +197 -183
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +982 -0
- package/dist/sdk-runtime.js +2 -0
- package/dist/sdk-session.d.ts +3 -3
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +191 -10
- package/dist/types-chunks/{bash-prefix-extractor.d-CZW9fRoa.d.ts → bash-prefix-extractor.d-BjkITAva.d.ts} +142 -3
- package/dist/types-chunks/{run-manager.d-CYTnWhZY.d.ts → capsule.d-hVhPNkHd.d.ts} +5 -92
- package/dist/types-chunks/commands.d-C3B1TdGM.d.ts +213 -0
- package/dist/types-chunks/{types.d-1CnTg7Sd.d.ts → guardrail.d-C_Siraua.d.ts} +3 -128
- package/dist/types-chunks/{guardrail.d-MR6LwMB2.d.ts → guardrail.d-wk-s0psS.d.ts} +2 -2
- package/dist/types-chunks/{manager.d-DBD7SOTT.d.ts → manager.d-Zum9cGHU.d.ts} +3 -173
- package/dist/types-chunks/oauth-login.d-Bgb4rdLN.d.ts +174 -0
- package/dist/types-chunks/public-api.d-jtREVfEq.d.ts +596 -0
- package/dist/types-chunks/run-manager.d-CFknOfo1.d.ts +91 -0
- package/dist/types-chunks/{sdk-session-RBSBBKol.d.ts → sdk-session-CLqyfAmf.d.ts} +8 -306
- package/dist/types-chunks/types.d-BMLxKV69.d.ts +128 -0
- package/dist/types-chunks/types.d-CUN_bZU7.d.ts +975 -0
- package/dist/types-chunks/{utils.d-C14jZ9ZM.d.ts → utils.d-C1rpoeDh.d.ts} +84 -72
- package/package.json +7 -1
- package/dist/chunks/argument-completer-EN63ZVJK.js +0 -2
- package/dist/chunks/chunk-KHICMJIR.js +0 -310
- package/dist/chunks/chunk-LGR7ACBQ.js +0 -326
- package/dist/chunks/chunk-RR7W7UF6.js +0 -341
- package/dist/chunks/chunk-UGTK2JIJ.js +0 -731
- package/dist/chunks/chunk-V4WSBIXB.js +0 -2
- package/dist/chunks/chunk-VSWROENP.js +0 -52
- package/dist/chunks/compaction-config-4VIONMFB.js +0 -2
- package/dist/chunks/dist-EDF2YUF6.js +0 -2
- package/dist/chunks/host-J4HPDLFC.js +0 -2
- package/dist/chunks/run-manager-ZVSW2OWM.js +0 -2
- package/dist/chunks/utils-5HDLYTZJ.js +0 -2
- package/dist/types-chunks/storage.d-C6kkAEch.d.ts +0 -280
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock
|
|
3
|
-
import {
|
|
4
|
-
import { ao as KodaXSessionUiHistoryItem, as as KodaXSessionUiToolCall
|
|
1
|
+
import { f as PermissionMode } from './public-api.d-jtREVfEq.js';
|
|
2
|
+
import { E as KodaXReasoningMode, j as KodaXMessage, c as KodaXContentBlock } from './types.d-Bp4Lm1jv.js';
|
|
3
|
+
import { r as KodaXAgentMode } from './bash-prefix-extractor.d-BjkITAva.js';
|
|
4
|
+
import { ao as KodaXSessionUiHistoryItem, as as KodaXSessionUiToolCall } from './process.d-CY2g03Mb.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* TextBuffer - Text buffer management class - 文本缓冲区管理类
|
|
@@ -380,6 +380,8 @@ interface InputPromptProps {
|
|
|
380
380
|
initialValue?: string;
|
|
381
381
|
/** Callback when input text changes - 输入文本变化时的回调 */
|
|
382
382
|
onInputChange?: (text: string) => void;
|
|
383
|
+
/** Called for a transient UI notice when image paste falls back to text. */
|
|
384
|
+
onPasteFallback?: (message: string) => void;
|
|
383
385
|
/**
|
|
384
386
|
* Called when the ↑ arrow history recall brings back an entry with stored
|
|
385
387
|
* paste contents. Consumer can hydrate a disk-backed paste cache here.
|
|
@@ -788,305 +790,5 @@ declare function extractTitle(messages: KodaXMessage[]): string;
|
|
|
788
790
|
*/
|
|
789
791
|
declare function formatMessagePreview(content: string, maxLength?: number): string;
|
|
790
792
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
*
|
|
794
|
-
* Lets an SDK embedder (KodaX-Space) compact a session by id immediately —
|
|
795
|
-
* e.g. when the user clicks a "/compact" button — instead of forging a token
|
|
796
|
-
* snapshot or appending an empty message to trip auto-compaction. Loads the
|
|
797
|
-
* session, runs the same `compact()` pass the REPL `/compact` command uses,
|
|
798
|
-
* applies the result to the session lineage (so `loadFullTranscript` / resume
|
|
799
|
-
* see the compaction entry), and writes it back.
|
|
800
|
-
*
|
|
801
|
-
* Applies uniformly to Partner and Coder sessions. Never throws — failures
|
|
802
|
-
* return `{ compacted: false, reason }`.
|
|
803
|
-
*/
|
|
804
|
-
|
|
805
|
-
interface CompactSessionOptions {
|
|
806
|
-
/** Provider alias for the summarizer. Defaults to the session's persisted provider, then 'anthropic'. */
|
|
807
|
-
readonly provider?: string;
|
|
808
|
-
/** Model override forwarded to the summarizer. */
|
|
809
|
-
readonly model?: string;
|
|
810
|
-
/** Custom summarizer instructions (same as `/compact <text>`). */
|
|
811
|
-
readonly customInstructions?: string;
|
|
812
|
-
/** Provider context-window override (tokens). Otherwise resolved from the provider/model. */
|
|
813
|
-
readonly contextWindow?: number;
|
|
814
|
-
/** Sessions directory (mirrors createSessionManager's override). */
|
|
815
|
-
readonly sessionsDir?: string;
|
|
816
|
-
/** Injected storage instance (takes precedence over sessionsDir). */
|
|
817
|
-
readonly storage?: FileSessionStorage;
|
|
818
|
-
}
|
|
819
|
-
interface CompactSessionResult {
|
|
820
|
-
/** True when the session was actually rewritten. */
|
|
821
|
-
readonly compacted: boolean;
|
|
822
|
-
readonly tokensBefore: number;
|
|
823
|
-
readonly tokensAfter: number;
|
|
824
|
-
/** The rewritten (or unchanged) message list. */
|
|
825
|
-
readonly messages: KodaXMessage[];
|
|
826
|
-
/** Populated when `compacted` is false to explain why (not-found / no-op / error). */
|
|
827
|
-
readonly reason?: string;
|
|
828
|
-
}
|
|
829
|
-
/**
|
|
830
|
-
* Compact a session by id, writing the result (lineage + messages) back to
|
|
831
|
-
* storage. Never throws.
|
|
832
|
-
*/
|
|
833
|
-
declare function compactSession(sessionId: string, options?: CompactSessionOptions): Promise<CompactSessionResult>;
|
|
834
|
-
|
|
835
|
-
/**
|
|
836
|
-
* FEATURE_173 Part B (v0.7.42) — Session Management Public SDK.
|
|
837
|
-
*
|
|
838
|
-
* Thin facades over FileSessionStorage + discoverInstances. All methods
|
|
839
|
-
* NEVER throw — missing sessions return null, blocked operations return
|
|
840
|
-
* an error envelope, missing directories return empty arrays / no-op
|
|
841
|
-
* watchers.
|
|
842
|
-
*
|
|
843
|
-
* The `@kodax-ai/kodax/session` SDK subpath re-exports this module.
|
|
844
|
-
*/
|
|
845
|
-
|
|
846
|
-
interface SessionSummary {
|
|
847
|
-
readonly id: string;
|
|
848
|
-
readonly title: string;
|
|
849
|
-
readonly msgCount: number;
|
|
850
|
-
readonly tag?: string;
|
|
851
|
-
readonly createdAt?: string;
|
|
852
|
-
readonly runtimeInfo?: {
|
|
853
|
-
workspaceRoot?: string;
|
|
854
|
-
gitRoot?: string;
|
|
855
|
-
surface?: string;
|
|
856
|
-
profileId?: string;
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* FEATURE_219 (v0.7.46) — the per-project directory key this session lives
|
|
860
|
-
* under (ADR-038 §7). A backward-compatible hint: consumers may pass it back
|
|
861
|
-
* for precise disambiguation, but `loadSession(id)` works without it.
|
|
862
|
-
*/
|
|
863
|
-
readonly projectKey?: string;
|
|
864
|
-
/** FEATURE_219 — true when the session is whole-session archived (only ever
|
|
865
|
-
* surfaced when `includeArchived` is set). */
|
|
866
|
-
readonly archived?: boolean;
|
|
867
|
-
}
|
|
868
|
-
type SessionTranscriptEntryType = 'message' | 'compaction' | 'branch_summary'
|
|
869
|
-
/** Rewind audit marker; not included in `FullTranscriptSessionData.messages`. */
|
|
870
|
-
| 'rewind_marker' | 'client_notice'
|
|
871
|
-
/**
|
|
872
|
-
* Synthetic task/workflow completion entry derived from `_taskResult`,
|
|
873
|
-
* `_taskResults`, or legacy `<task-completed>` banners. The original
|
|
874
|
-
* `KodaXMessage` is still exposed on `message`, but consumers that want a
|
|
875
|
-
* complete transcript should not filter only `type === 'message'`.
|
|
876
|
-
*/
|
|
877
|
-
| 'task_result';
|
|
878
|
-
type SessionTranscriptEntrySource = 'user' | 'assistant' | 'workflow' | 'child_task' | 'system' | 'client';
|
|
879
|
-
interface SessionTranscriptEntry {
|
|
880
|
-
readonly entryId: string;
|
|
881
|
-
readonly parentId: string | null;
|
|
882
|
-
/** Stable logical identity shared by cloned/forked copies of the same entry. */
|
|
883
|
-
readonly logicalId: string;
|
|
884
|
-
/** Root source physical entry id when this transcript entry was cloned/forked. */
|
|
885
|
-
readonly sourceEntryId?: string;
|
|
886
|
-
readonly timestamp: string;
|
|
887
|
-
readonly type: SessionTranscriptEntryType;
|
|
888
|
-
readonly source?: SessionTranscriptEntrySource;
|
|
889
|
-
readonly turnId?: string;
|
|
890
|
-
readonly message: KodaXMessage;
|
|
891
|
-
readonly active: boolean;
|
|
892
|
-
readonly summary?: string;
|
|
893
|
-
readonly payload?: unknown;
|
|
894
|
-
readonly taskResults?: readonly KodaXTaskResultMetadata[];
|
|
895
|
-
}
|
|
896
|
-
interface FullTranscriptSessionData extends Omit<SessionData, 'messages'> {
|
|
897
|
-
readonly messages: KodaXMessage[];
|
|
898
|
-
readonly activeMessages: KodaXMessage[];
|
|
899
|
-
readonly transcriptEntries: SessionTranscriptEntry[];
|
|
900
|
-
}
|
|
901
|
-
interface AppendClientNoticeOptions {
|
|
902
|
-
readonly source?: string;
|
|
903
|
-
readonly content: string;
|
|
904
|
-
readonly timestamp?: string;
|
|
905
|
-
readonly turnId?: string;
|
|
906
|
-
readonly payload?: KodaXJsonValue;
|
|
907
|
-
}
|
|
908
|
-
interface ListSessionsOptions {
|
|
909
|
-
/**
|
|
910
|
-
* Alias for gitRoot; backwards-compat with KodaX Space terminology.
|
|
911
|
-
* When provided, list() is scoped to sessions from this project root.
|
|
912
|
-
*/
|
|
913
|
-
readonly projectRoot?: string;
|
|
914
|
-
/**
|
|
915
|
-
* Which session scopes to include.
|
|
916
|
-
* - 'user' (default): only user-initiated sessions.
|
|
917
|
-
* - 'managed-task-worker': only managed-task worker sessions.
|
|
918
|
-
* - 'all': no scope filter.
|
|
919
|
-
*/
|
|
920
|
-
readonly scope?: 'user' | 'managed-task-worker' | 'all';
|
|
921
|
-
/**
|
|
922
|
-
* Whether to include whole-session-archived sessions. FEATURE_219 (v0.7.46):
|
|
923
|
-
* archived sessions live in `<projectKey>/archived/` (see `archiveSession`);
|
|
924
|
-
* also still hides the legacy `archived-` filename prefix. Default false.
|
|
925
|
-
*/
|
|
926
|
-
readonly includeArchived?: boolean;
|
|
927
|
-
/** Maximum number of sessions to return. Default 50. */
|
|
928
|
-
readonly limit?: number;
|
|
929
|
-
/**
|
|
930
|
-
* ISO date string — return only sessions whose createdAt is before this
|
|
931
|
-
* timestamp. Applied after list + scope filtering.
|
|
932
|
-
*/
|
|
933
|
-
readonly before?: string;
|
|
934
|
-
/** Exact match. Omitted means no tag filter. */
|
|
935
|
-
readonly tag?: string;
|
|
936
|
-
}
|
|
937
|
-
type WatchSessionsCallback = (event: {
|
|
938
|
-
kind: 'change' | 'add' | 'remove';
|
|
939
|
-
sessionId: string;
|
|
940
|
-
}) => void;
|
|
941
|
-
interface SessionManager {
|
|
942
|
-
listSessions: typeof listSessions;
|
|
943
|
-
loadSession: typeof loadSession;
|
|
944
|
-
loadFullTranscript: typeof loadFullTranscript;
|
|
945
|
-
appendClientNotice: typeof appendClientNotice;
|
|
946
|
-
forkSession: typeof forkSession;
|
|
947
|
-
rewindSession: typeof rewindSession;
|
|
948
|
-
setActiveEntry: typeof setActiveEntry;
|
|
949
|
-
deleteSession: typeof deleteSession;
|
|
950
|
-
archiveSession: typeof archiveSession;
|
|
951
|
-
unarchiveSession: typeof unarchiveSession;
|
|
952
|
-
listRunningSessions: typeof listRunningSessions;
|
|
953
|
-
watchSessions: typeof watchSessions;
|
|
954
|
-
/** FEATURE_247 (R6) — imperatively compact a session by id (writes lineage + emits nothing; returns stats). */
|
|
955
|
-
compactSession: typeof compactSession;
|
|
956
|
-
/**
|
|
957
|
-
* v0.7.43 — the raw write-side storage instance. SDK embedders pass
|
|
958
|
-
* this into `runKodaX({ session: { id, scope, storage } })` so the
|
|
959
|
-
* SA / AMA loops write per-turn JSONL snapshots to disk. Without an
|
|
960
|
-
* injected storage, `saveSessionSnapshot` is a silent no-op and the
|
|
961
|
-
* sessions directory stays empty regardless of `session.id`.
|
|
962
|
-
*
|
|
963
|
-
* See {@link FileSessionStorage} for the concrete implementation and
|
|
964
|
-
* `docs/SDK_EMBEDDER_GUIDE.md` §6 for the end-to-end recipe.
|
|
965
|
-
*/
|
|
966
|
-
storage: FileSessionStorage;
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* List sessions, optionally filtered by scope, limit, and date.
|
|
970
|
-
* NEVER throws. Returns [] when the sessions directory is empty or missing.
|
|
971
|
-
*/
|
|
972
|
-
declare function listSessions(opts?: ListSessionsOptions): Promise<SessionSummary[]>;
|
|
973
|
-
/**
|
|
974
|
-
* Load full session data by ID.
|
|
975
|
-
* Returns null for a missing session. NEVER throws.
|
|
976
|
-
*/
|
|
977
|
-
declare function loadSession(id: string): Promise<SessionData | null>;
|
|
978
|
-
/**
|
|
979
|
-
* Load append-order transcript data by ID.
|
|
980
|
-
*
|
|
981
|
-
* `loadSession` remains the active model-context API. This helper is for UI
|
|
982
|
-
* scrollback: it returns every persisted transcript-bearing lineage entry in
|
|
983
|
-
* append order and keeps the active branch in `activeMessages`.
|
|
984
|
-
*/
|
|
985
|
-
declare function loadFullTranscript(id: string): Promise<FullTranscriptSessionData | null>;
|
|
986
|
-
/**
|
|
987
|
-
* Append a host-owned transcript notice that never enters model context.
|
|
988
|
-
*
|
|
989
|
-
* Use this for local slash-command output such as `/doctor`, `/mcp status`,
|
|
990
|
-
* or host-side status panes. It is visible through `loadFullTranscript()` but
|
|
991
|
-
* `loadSession()` keeps returning only the active model messages.
|
|
992
|
-
*/
|
|
993
|
-
declare function appendClientNotice(id: string, options: AppendClientNoticeOptions): Promise<SessionTranscriptEntry | null>;
|
|
994
|
-
/**
|
|
995
|
-
* Fork a session at an optional selector.
|
|
996
|
-
* Returns null for a missing session. NEVER throws.
|
|
997
|
-
*/
|
|
998
|
-
declare function forkSession(id: string, opts?: {
|
|
999
|
-
selector?: string;
|
|
1000
|
-
sessionId?: string;
|
|
1001
|
-
title?: string;
|
|
1002
|
-
}): Promise<{
|
|
1003
|
-
sessionId: string;
|
|
1004
|
-
data: SessionData;
|
|
1005
|
-
} | null>;
|
|
1006
|
-
/**
|
|
1007
|
-
* Rewind a session to a previous user entry.
|
|
1008
|
-
* Returns null for a missing session. NEVER throws.
|
|
1009
|
-
*/
|
|
1010
|
-
declare function rewindSession(id: string, opts?: {
|
|
1011
|
-
selector?: string;
|
|
1012
|
-
}): Promise<SessionData | null>;
|
|
1013
|
-
/**
|
|
1014
|
-
* Set the active lineage entry by selector.
|
|
1015
|
-
* Returns null for a missing session. NEVER throws.
|
|
1016
|
-
*/
|
|
1017
|
-
declare function setActiveEntry(id: string, selector: string): Promise<SessionData | null>;
|
|
1018
|
-
interface RunningSessionInfo {
|
|
1019
|
-
readonly pid: number;
|
|
1020
|
-
readonly startedAt: number;
|
|
1021
|
-
readonly cwd: string;
|
|
1022
|
-
/**
|
|
1023
|
-
* v0.7.43 — populated from `PersistedSessionState.sessionId`, published
|
|
1024
|
-
* by the REPL after `createInteractiveContext`. Remains `undefined` for
|
|
1025
|
-
* a brief window during a peer's bootstrap (before the first sessionId
|
|
1026
|
-
* is generated) and for peers running pre-v0.7.43 binaries; consumers
|
|
1027
|
-
* MUST handle `undefined`.
|
|
1028
|
-
*/
|
|
1029
|
-
readonly sessionId: string | undefined;
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Returns live KodaX sibling instances (excluding this process).
|
|
1033
|
-
* Uses discoverInstances() from @kodax-ai/agent (FEATURE_125 Team Mode).
|
|
1034
|
-
* NEVER throws. Returns [] when no instances directory exists.
|
|
1035
|
-
*/
|
|
1036
|
-
declare function listRunningSessions(): Promise<RunningSessionInfo[]>;
|
|
1037
|
-
type DeleteSessionResult = {
|
|
1038
|
-
ok: true;
|
|
1039
|
-
} | {
|
|
1040
|
-
error: {
|
|
1041
|
-
code: 'session_running';
|
|
1042
|
-
runningProcess: {
|
|
1043
|
-
pid: number;
|
|
1044
|
-
startedAt: number;
|
|
1045
|
-
};
|
|
1046
|
-
};
|
|
1047
|
-
};
|
|
1048
|
-
/**
|
|
1049
|
-
* Delete a session by ID.
|
|
1050
|
-
* Returns { ok: true } on success (including when the session doesn't exist).
|
|
1051
|
-
* Returns an error envelope when the session is currently running.
|
|
1052
|
-
* NEVER throws.
|
|
1053
|
-
*/
|
|
1054
|
-
declare function deleteSession(id: string): Promise<DeleteSessionResult>;
|
|
1055
|
-
/**
|
|
1056
|
-
* FEATURE_219 (v0.7.46) — whole-session archive. Moves the session (and its
|
|
1057
|
-
* island sidecar) into `<projectKey>/archived/`. Returns false for a missing
|
|
1058
|
-
* session. NEVER throws. Archived sessions are hidden from the default listing
|
|
1059
|
-
* and resurface only with `listSessions({ includeArchived: true })`.
|
|
1060
|
-
*/
|
|
1061
|
-
declare function archiveSession(id: string): Promise<boolean>;
|
|
1062
|
-
/** Restore an archived session back into its project directory. NEVER throws. */
|
|
1063
|
-
declare function unarchiveSession(id: string): Promise<boolean>;
|
|
1064
|
-
/**
|
|
1065
|
-
* Watch the sessions directory for changes.
|
|
1066
|
-
* Returns { close() } that stops the watcher / poll interval.
|
|
1067
|
-
*
|
|
1068
|
-
* Platform branches:
|
|
1069
|
-
* - POSIX: fs.watch() with 100ms debounce.
|
|
1070
|
-
* - Windows: readdir poll every 1000ms, diffed against a snapshot.
|
|
1071
|
-
*
|
|
1072
|
-
* NEVER throws — if the directory doesn't exist the watcher is a no-op
|
|
1073
|
-
* until the directory is created.
|
|
1074
|
-
*/
|
|
1075
|
-
declare function watchSessions(cb: WatchSessionsCallback): {
|
|
1076
|
-
close: () => void;
|
|
1077
|
-
};
|
|
1078
|
-
/**
|
|
1079
|
-
* Factory that returns an object with all session management methods bound.
|
|
1080
|
-
*
|
|
1081
|
-
* v0.7.43 (FEATURE_173 Part B follow-up) — the `sessionsDir` override is
|
|
1082
|
-
* now honored. When provided, all read/write/watch operations go through
|
|
1083
|
-
* that directory instead of the module-load-frozen `KODAX_SESSIONS_DIR`.
|
|
1084
|
-
* `listRunningSessions` still consults the agent-config-home instances
|
|
1085
|
-
* directory (sibling-process awareness is not scoped per sessions dir).
|
|
1086
|
-
*/
|
|
1087
|
-
declare function createSessionManager(opts?: {
|
|
1088
|
-
sessionsDir?: string;
|
|
1089
|
-
}): SessionManager;
|
|
1090
|
-
|
|
1091
|
-
export { DEFAULT_UI_STATE as D, StreamingState as U, TOOL_STATUS_ICONS as W, TextBuffer as X, ToolCallStatus as a1, appendClientNotice as a8, archiveSession as a9, compactSession as aa, createSessionManager as ab, deleteSession as ac, extractHistorySeedsFromMessage as ad, extractHistorySeedsFromMessages as ae, extractTextContent as af, extractTitle as ag, forkSession as ah, formatMessagePreview as ai, listRunningSessions as aj, listSessions as ak, loadFullTranscript as al, loadSession as am, restoreHistoryItemsFromSession as an, rewindSession as ao, seedToHistoryItem as ap, setActiveEntry as aq, toolCallSeedToHistoryToolCall as ar, trimPersistedUiHistorySnapshot as as, unarchiveSession as at, watchSessions as au, KeypressHandlerPriority as y };
|
|
1092
|
-
export type { ThemeSymbols as $, AppProps as A, PromptEditingMode as B, CompactSessionOptions as C, PromptSubmitPayload as E, FullTranscriptSessionData as F, RestoredHistorySeed as G, HistoryEntry as H, InputPromptProps as I, RunningSessionInfo as J, KeyInfo as K, LegacyMessageListProps as L, Message as M, SessionSummary as N, SessionTranscriptEntry as O, PastedContent as P, SessionTranscriptEntryType as Q, RestoreHistoryItemsFromSessionInput as R, SessionManager as S, StatusBarProps as T, Suggestion as V, TextBufferOptions as Y, Theme as Z, ThemeColors as _, AppState as a, ToolCall as a0, UIActions as a2, UIState as a3, UseTextBufferReturn as a4, VisualCursor as a5, VisualLayout as a6, WatchSessionsCallback as a7, AppendClientNoticeOptions as b, CompactSessionResult as c, Completer as d, Completion as e, CreatableHistoryItem as f, CursorPosition as g, DeleteSessionResult as h, HistoryItem as i, HistoryItemAssistant as j, HistoryItemBase as k, HistoryItemError as l, HistoryItemEvent as m, HistoryItemHint as n, HistoryItemInfo as o, HistoryItemSidecar as p, HistoryItemSystem as q, HistoryItemThinking as r, HistoryItemToolGroup as s, HistoryItemType as t, HistoryItemUser as u, HistorySeedSourceMessage as v, KeypressEvent as w, KeypressHandler as x, ListSessionsOptions as z };
|
|
793
|
+
export { extractTitle as $, TextBuffer as B, DEFAULT_UI_STATE as D, ToolCallStatus as O, TOOL_STATUS_ICONS as T, extractHistorySeedsFromMessage as Y, extractHistorySeedsFromMessages as Z, extractTextContent as _, formatMessagePreview as a0, restoreHistoryItemsFromSession as a1, seedToHistoryItem as a2, toolCallSeedToHistoryToolCall as a3, trimPersistedUiHistorySnapshot as a4, KeypressHandlerPriority as u, StreamingState as y };
|
|
794
|
+
export type { AppProps as A, Completer as C, TextBufferOptions as E, Theme as F, ThemeColors as G, HistoryEntry as H, InputPromptProps as I, ThemeSymbols as J, KeyInfo as K, LegacyMessageListProps as L, Message as M, ToolCall as N, PastedContent as P, UIState as Q, RestoreHistoryItemsFromSessionInput as R, StatusBarProps as S, UIActions as U, UseTextBufferReturn as V, VisualCursor as W, VisualLayout as X, AppState as a, Completion as b, CreatableHistoryItem as c, CursorPosition as d, HistoryItem as e, HistoryItemAssistant as f, HistoryItemBase as g, HistoryItemError as h, HistoryItemEvent as i, HistoryItemHint as j, HistoryItemInfo as k, HistoryItemSidecar as l, HistoryItemSystem as m, HistoryItemThinking as n, HistoryItemToolGroup as o, HistoryItemType as p, HistoryItemUser as q, HistorySeedSourceMessage as r, KeypressEvent as s, KeypressHandler as t, PromptEditingMode as v, PromptSubmitPayload as w, RestoredHistorySeed as x, Suggestion as z };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { a2 as KodaXInputArtifact } from './process.d-CY2g03Mb.js';
|
|
2
|
+
import { R as KodaXTaskResultMetadata } from './types.d-Bp4Lm1jv.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @kodax-ai/agent/messaging — Message queue types
|
|
6
|
+
*
|
|
7
|
+
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
8
|
+
*
|
|
9
|
+
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
10
|
+
* specific). Downstream consumers:
|
|
11
|
+
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
12
|
+
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
13
|
+
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
14
|
+
*
|
|
15
|
+
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
16
|
+
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
type MessagePriority = 'user' | 'background';
|
|
20
|
+
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
21
|
+
type QueuedInputArtifact = KodaXInputArtifact;
|
|
22
|
+
interface QueuedMessage {
|
|
23
|
+
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly priority: MessagePriority;
|
|
26
|
+
/**
|
|
27
|
+
* Routing key:
|
|
28
|
+
* undefined = main thread / coordinator agent
|
|
29
|
+
* 'agent-id-XYZ' = subagent / specific consumer
|
|
30
|
+
*
|
|
31
|
+
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
32
|
+
* undefined-agentId messages, not "any agent".
|
|
33
|
+
*/
|
|
34
|
+
readonly agentId?: string;
|
|
35
|
+
readonly mode: MessageMode;
|
|
36
|
+
readonly content: string;
|
|
37
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
38
|
+
readonly taskResult?: KodaXTaskResultMetadata;
|
|
39
|
+
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
40
|
+
readonly enqueuedAt: number;
|
|
41
|
+
}
|
|
42
|
+
interface DequeueFilter {
|
|
43
|
+
/**
|
|
44
|
+
* Only return messages with this agentId.
|
|
45
|
+
* undefined matches messages with no agentId (main-thread messages only).
|
|
46
|
+
*/
|
|
47
|
+
readonly agentId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Highest priority level included in the drain.
|
|
50
|
+
* 'user' → only user priority drained, background stays queued
|
|
51
|
+
* 'background' → both user + background drained (Sleep-gated case)
|
|
52
|
+
*/
|
|
53
|
+
readonly maxPriority: MessagePriority;
|
|
54
|
+
/**
|
|
55
|
+
* Optional cap on number of messages drained in this call.
|
|
56
|
+
* Defaults to unlimited (drains all matching).
|
|
57
|
+
*/
|
|
58
|
+
readonly limit?: number;
|
|
59
|
+
/**
|
|
60
|
+
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
61
|
+
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
62
|
+
* input vs `mode:'task-notification'` for child completion banners)
|
|
63
|
+
* without separate queues. When omitted, all modes match.
|
|
64
|
+
*/
|
|
65
|
+
readonly mode?: MessageMode;
|
|
66
|
+
/**
|
|
67
|
+
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
68
|
+
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
69
|
+
* other filters still apply (agentId / priority / mode mismatches still
|
|
70
|
+
* skip the message), so callers can't accidentally remove a message
|
|
71
|
+
* outside their scope.
|
|
72
|
+
*/
|
|
73
|
+
readonly id?: string;
|
|
74
|
+
/**
|
|
75
|
+
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
76
|
+
* the structured filters. Lets SDK consumers express conditions the
|
|
77
|
+
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
78
|
+
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
79
|
+
* code should prefer the typed fields for readability; this is the
|
|
80
|
+
* "data-driven main path + predicate escape" pattern.
|
|
81
|
+
*
|
|
82
|
+
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
83
|
+
* inspects `message.content` never runs on messages outside the
|
|
84
|
+
* caller's `agentId` / `mode` / `id` scope.
|
|
85
|
+
*/
|
|
86
|
+
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
90
|
+
*
|
|
91
|
+
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
92
|
+
* affected messages so SDK observability consumers (logging, tracing,
|
|
93
|
+
* metrics) can react per-event without re-diffing snapshots.
|
|
94
|
+
*
|
|
95
|
+
* Event granularity rules:
|
|
96
|
+
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
97
|
+
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
98
|
+
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
99
|
+
* (filter matched nothing) fire no event — quiet by design so the
|
|
100
|
+
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
101
|
+
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
102
|
+
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
103
|
+
*
|
|
104
|
+
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
105
|
+
* only needs the change signal); SDK / tracer consumers read the event.
|
|
106
|
+
*/
|
|
107
|
+
type QueueEvent = {
|
|
108
|
+
readonly kind: 'enqueued';
|
|
109
|
+
readonly message: QueuedMessage;
|
|
110
|
+
} | {
|
|
111
|
+
readonly kind: 'dequeued';
|
|
112
|
+
readonly messages: readonly QueuedMessage[];
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: 'cleared';
|
|
115
|
+
readonly messages: readonly QueuedMessage[];
|
|
116
|
+
};
|
|
117
|
+
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
118
|
+
type QueueEventListener = (event: QueueEvent) => void;
|
|
119
|
+
interface EnqueueInput {
|
|
120
|
+
readonly priority: MessagePriority;
|
|
121
|
+
readonly mode: MessageMode;
|
|
122
|
+
readonly content: string;
|
|
123
|
+
readonly agentId?: string;
|
|
124
|
+
readonly inputArtifacts?: readonly QueuedInputArtifact[];
|
|
125
|
+
readonly taskResult?: KodaXTaskResultMetadata;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type { DequeueFilter as D, EnqueueInput as E, MessageMode as M, QueueEventListener as Q, MessagePriority as a, QueuedInputArtifact as b, QueuedMessage as c };
|