@kodax-ai/kodax 0.7.47 → 0.7.49
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 +1741 -1702
- package/README.md +80 -27
- package/README_CN.md +60 -15
- package/dist/builtin/code-review/SKILL.md +1 -1
- package/dist/chunks/argument-completer-GDG5OHN7.js +2 -0
- package/dist/chunks/{chunk-VGRG2F6H.js → chunk-67SWUEEN.js} +424 -276
- package/dist/chunks/chunk-C5PKZX5Z.js +291 -0
- package/dist/chunks/chunk-ISGHUKRY.js +428 -0
- package/dist/chunks/chunk-JTHMWRXM.js +566 -0
- package/dist/chunks/chunk-TYZAH3YP.js +2 -0
- package/dist/chunks/chunk-YACQ4OST.js +31 -0
- package/dist/chunks/{chunk-2SMCCP44.js → chunk-YW4RQV7U.js} +1 -1
- package/dist/chunks/{compaction-config-YU7SI6L6.js → compaction-config-BQBYOWX2.js} +1 -1
- package/dist/chunks/{construction-bootstrap-6UN3OY7X.js → construction-bootstrap-5TFGMSWQ.js} +1 -1
- package/dist/chunks/{dist-IDNOAB4M.js → dist-BL7IBQHD.js} +1 -1
- package/dist/chunks/dist-D7HOETCE.js +2 -0
- package/dist/chunks/{utils-3ISOUEFC.js → utils-XWDT3W5X.js} +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +5 -5
- package/dist/kodax_cli.js +1337 -888
- package/dist/provider-capabilities.json +193 -190
- package/dist/sdk-agent.d.ts +207 -105
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +569 -37
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-llm.d.ts +5 -5
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.d.ts +3 -3
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.d.ts +16 -15
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-session.d.ts +6 -3
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/types-chunks/{base.d-BdJKSPO2.d.ts → base.d-C4jYVjJh.d.ts} +2 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-D6hL0Cuv.d.ts → bash-prefix-extractor.d-CI_xcPhn.d.ts} +70 -35
- package/dist/types-chunks/{file-tracker.d-BNTIvsdb.d.ts → capsule.d-DaPuhyyK.d.ts} +170 -5
- package/dist/types-chunks/{config.d-BfJUXxC0.d.ts → config.d-CJy1WENT.d.ts} +17 -7
- package/dist/types-chunks/manager.d-DLmDhX3i.d.ts +696 -0
- package/dist/types-chunks/{resolver.d-DkgJlEzr.d.ts → resolver.d-B_wm409c.d.ts} +2 -2
- package/dist/types-chunks/{storage.d-B1Jk6ryM.d.ts → storage.d-J2GqOgaX.d.ts} +4 -1
- package/dist/types-chunks/{types.d-D2RNa5Y7.d.ts → types.d-BR9oNWup.d.ts} +429 -4
- package/dist/types-chunks/{types.d-B_MIIApc.d.ts → types.d-BnjX2Gn4.d.ts} +6 -1
- package/dist/types-chunks/{types.d-Cf-GCzac.d.ts → types.d-rPRl2LSB.d.ts} +4 -0
- package/dist/types-chunks/{utils.d-umRKgMAu.d.ts → utils.d-BJ_-y8gC.d.ts} +42 -8
- package/package.json +1 -1
- package/dist/chunks/chunk-66B6ZOU7.js +0 -31
- package/dist/chunks/chunk-KRHAO2T3.js +0 -567
- package/dist/chunks/chunk-QZFZIGPF.js +0 -2
- package/dist/chunks/chunk-VX6HN3JP.js +0 -415
- package/dist/chunks/dist-DS2KIZQG.js +0 -2
- package/dist/types-chunks/manager.d-U3UEwY1P.d.ts +0 -385
- package/dist/types-chunks/types.d-C5mHR87z.d.ts +0 -119
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as KodaXMessage } from './types.d-
|
|
2
|
-
import { f as AgentMessage,
|
|
3
|
-
import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-
|
|
1
|
+
import { n as KodaXMessage } from './types.d-rPRl2LSB.js';
|
|
2
|
+
import { f as AgentMessage, ap as SessionEntry, an as Session, a3 as QueueEventListener, a4 as QueuedMessage, E as EnqueueInput, v as DequeueFilter, aq as SessionExtension, p as CompactionDetails, z as FileOperations, b4 as WorkflowMeta, b5 as WorkflowModelHint, b6 as WorkflowModule } from './types.d-BR9oNWup.js';
|
|
3
|
+
import { s as KodaXSessionLineage, i as KodaXJsonValue, a as KodaXCompactMemorySeed, o as KodaXSessionEntry, z as KodaXSessionTreeNode, r as KodaXSessionLabelEntry, q as KodaXSessionGoalEntry, v as KodaXSessionNavigationOptions, k as KodaXSessionArtifactLedgerEntry } from './types.d-BnjX2Gn4.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @kodax-ai/agent Constants
|
|
@@ -271,6 +271,98 @@ declare function getAgentConfigPath(...segments: string[]): string;
|
|
|
271
271
|
*/
|
|
272
272
|
declare function getAppDataDir(appId: string): string;
|
|
273
273
|
|
|
274
|
+
/**
|
|
275
|
+
* @kodax-ai/agent/messaging/queue — 2-tier agentId-scoped FIFO message queue.
|
|
276
|
+
*
|
|
277
|
+
* FEATURE_115 (v0.7.36).
|
|
278
|
+
*
|
|
279
|
+
* Invariants:
|
|
280
|
+
* - In-priority FIFO: messages of the same priority drain in enqueue order.
|
|
281
|
+
* - Cross-priority precedence: 'user' drains before 'background', regardless
|
|
282
|
+
* of enqueue order.
|
|
283
|
+
* - agentId routing: messages addressed to agentId X are only visible to
|
|
284
|
+
* consumers filtering for that exact agentId. undefined ≠ "any agent" —
|
|
285
|
+
* it specifically matches main-thread messages.
|
|
286
|
+
* - Not persistent: process restart loses queue state, by design (matches
|
|
287
|
+
* TodoStore semantics).
|
|
288
|
+
*
|
|
289
|
+
* The queue is process-global by default (`getMessageQueue()`); the class is
|
|
290
|
+
* also exported for tests / isolated downstream use.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
declare class MessageQueue {
|
|
294
|
+
private messages;
|
|
295
|
+
private nextSeq;
|
|
296
|
+
/**
|
|
297
|
+
* FEATURE_159 (v0.7.40) — observable subscription set. Same pattern as
|
|
298
|
+
* Claude Code's `messageQueueManager.ts` `createSignal()` substrate,
|
|
299
|
+
* but the listener carries a structured `QueueEvent` so SDK
|
|
300
|
+
* observability consumers (logger, tracer, metrics) can react per-
|
|
301
|
+
* event without re-diffing snapshots. `useSyncExternalStore` consumers
|
|
302
|
+
* still work — they ignore the event argument.
|
|
303
|
+
*
|
|
304
|
+
* Cached `snapshotRef` keeps reference identity stable across reads
|
|
305
|
+
* when nothing changed — required by React 18's `useSyncExternalStore`
|
|
306
|
+
* to avoid render loops.
|
|
307
|
+
*/
|
|
308
|
+
private listeners;
|
|
309
|
+
private snapshotRef;
|
|
310
|
+
private notify;
|
|
311
|
+
/**
|
|
312
|
+
* Subscribe to queue mutations. Compatible with React 18's
|
|
313
|
+
* `useSyncExternalStore(subscribe, getSnapshot)` — the hook passes a
|
|
314
|
+
* `() => void` callback, which is structurally assignable to the
|
|
315
|
+
* `QueueEventListener` parameter because TypeScript treats
|
|
316
|
+
* callback parameter discards as compatible. SDK consumers that
|
|
317
|
+
* declare a typed `(event: QueueEvent) => void` listener see the
|
|
318
|
+
* structured event.
|
|
319
|
+
*
|
|
320
|
+
* Listener is called synchronously after every mutation; returns an
|
|
321
|
+
* unsubscribe function.
|
|
322
|
+
*/
|
|
323
|
+
subscribe: (listener: QueueEventListener) => (() => void);
|
|
324
|
+
/**
|
|
325
|
+
* Returns the current frozen queue snapshot. Reference identity is
|
|
326
|
+
* stable across reads when the queue has not mutated, which is the
|
|
327
|
+
* contract React's `useSyncExternalStore` relies on.
|
|
328
|
+
*/
|
|
329
|
+
getSnapshot: () => readonly QueuedMessage[];
|
|
330
|
+
/** Returns the assigned id of the enqueued message. */
|
|
331
|
+
enqueue(input: EnqueueInput): string;
|
|
332
|
+
/**
|
|
333
|
+
* Drain matching messages, ordered by priority (user > background) then
|
|
334
|
+
* FIFO within each priority. Removes drained messages from the queue.
|
|
335
|
+
*/
|
|
336
|
+
dequeue(filter: DequeueFilter): QueuedMessage[];
|
|
337
|
+
/**
|
|
338
|
+
* Peek at matching messages without removing them. Returns messages in
|
|
339
|
+
* the same priority + FIFO order that `dequeue(filter)` would return,
|
|
340
|
+
* so callers can inspect what the next drain would yield.
|
|
341
|
+
*/
|
|
342
|
+
peek(filter: DequeueFilter): QueuedMessage[];
|
|
343
|
+
/** Total queue size across all priorities / agents. */
|
|
344
|
+
size(): number;
|
|
345
|
+
/** Count of messages matching the filter. */
|
|
346
|
+
count(filter: DequeueFilter): number;
|
|
347
|
+
/** True iff at least one message matches the filter. */
|
|
348
|
+
has(filter: DequeueFilter): boolean;
|
|
349
|
+
/** Remove all queued messages — used in tests / process abort scenarios. */
|
|
350
|
+
clear(): void;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Returns the process-global MessageQueue singleton, creating it lazily on
|
|
354
|
+
* first call. Use this for production wiring; instantiate `MessageQueue`
|
|
355
|
+
* directly in tests / isolated subsystems where a shared instance would
|
|
356
|
+
* cause cross-test pollution.
|
|
357
|
+
*/
|
|
358
|
+
declare function getMessageQueue(): MessageQueue;
|
|
359
|
+
/**
|
|
360
|
+
* Test-only reset hook. Production code MUST NOT call this. Underscored
|
|
361
|
+
* prefix follows the same convention as `_resetInvariantRegistry` /
|
|
362
|
+
* `_resetAdmittedAgentBindings` / `_resetAdmissionMetrics`.
|
|
363
|
+
*/
|
|
364
|
+
declare function _resetMessageQueueForTests(): void;
|
|
365
|
+
|
|
274
366
|
/**
|
|
275
367
|
* History cleanup middleware — CAP-002
|
|
276
368
|
*
|
|
@@ -636,5 +728,78 @@ declare function mergeFileOps(ops1: FileOperations, ops2: FileOperations): FileO
|
|
|
636
728
|
declare function extractArtifactLedger(messages: KodaXMessage[]): KodaXSessionArtifactLedgerEntry[];
|
|
637
729
|
declare function mergeArtifactLedger(existing: KodaXSessionArtifactLedgerEntry[], next: KodaXSessionArtifactLedgerEntry[]): KodaXSessionArtifactLedgerEntry[];
|
|
638
730
|
|
|
639
|
-
|
|
640
|
-
|
|
731
|
+
declare const WORKFLOW_PATTERN_IDS: readonly ["classify-and-act", "fan-out-and-synthesize", "adversarial-verification", "generate-and-filter", "tournament", "loop-until-done"];
|
|
732
|
+
type WorkflowPatternId = (typeof WORKFLOW_PATTERN_IDS)[number];
|
|
733
|
+
interface WorkflowScriptManifest extends WorkflowMeta {
|
|
734
|
+
readonly phases: readonly string[];
|
|
735
|
+
readonly readOnly: boolean;
|
|
736
|
+
readonly plannedAgents?: number;
|
|
737
|
+
readonly maxAgents: number;
|
|
738
|
+
readonly maxConcurrency: number;
|
|
739
|
+
readonly tokenBudget?: number;
|
|
740
|
+
readonly mayUseWorktree?: boolean;
|
|
741
|
+
readonly patterns: readonly WorkflowPatternId[];
|
|
742
|
+
}
|
|
743
|
+
declare function validateWorkflowScriptManifest(value: unknown): WorkflowScriptManifest;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* FEATURE_217 (v0.7.49) Phase M — reusable generated workflow capsule.
|
|
747
|
+
*
|
|
748
|
+
* Agent owns only the domain-neutral capsule contract. Persistence,
|
|
749
|
+
* environment preflight, skills, MCP, and REPL UX live in higher layers.
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
declare const WORKFLOW_CAPSULE_FORMAT: "kodax.workflow";
|
|
753
|
+
declare const WORKFLOW_CAPSULE_VERSION: 1;
|
|
754
|
+
declare const WORKFLOW_CAPSULE_API_VERSION: 1;
|
|
755
|
+
type WorkflowCapsuleEnvironmentRequirement = 'git-repo' | 'worktree-capable';
|
|
756
|
+
interface WorkflowCapsuleIntent {
|
|
757
|
+
readonly taskClass: string;
|
|
758
|
+
readonly originalRequest?: string;
|
|
759
|
+
readonly reusableFor?: readonly string[];
|
|
760
|
+
readonly notFor?: readonly string[];
|
|
761
|
+
}
|
|
762
|
+
interface WorkflowCapsuleInputs {
|
|
763
|
+
readonly description: string;
|
|
764
|
+
readonly examples?: readonly unknown[];
|
|
765
|
+
}
|
|
766
|
+
interface WorkflowCapsuleRequirements {
|
|
767
|
+
readonly environment?: readonly WorkflowCapsuleEnvironmentRequirement[];
|
|
768
|
+
readonly tools?: readonly string[];
|
|
769
|
+
readonly mcp?: readonly string[];
|
|
770
|
+
readonly skills?: readonly string[];
|
|
771
|
+
readonly modelTiers?: readonly WorkflowModelHint[];
|
|
772
|
+
readonly userInteraction?: boolean;
|
|
773
|
+
}
|
|
774
|
+
interface WorkflowCapsuleProvenance {
|
|
775
|
+
readonly fromRunId?: string;
|
|
776
|
+
readonly createdAt: string;
|
|
777
|
+
readonly kodaxVersion: string;
|
|
778
|
+
}
|
|
779
|
+
interface WorkflowCapsule {
|
|
780
|
+
readonly format: typeof WORKFLOW_CAPSULE_FORMAT;
|
|
781
|
+
readonly version: typeof WORKFLOW_CAPSULE_VERSION;
|
|
782
|
+
readonly workflowApiVersion: typeof WORKFLOW_CAPSULE_API_VERSION;
|
|
783
|
+
readonly minKodaxVersion: string;
|
|
784
|
+
readonly manifest: WorkflowScriptManifest;
|
|
785
|
+
readonly source: string;
|
|
786
|
+
readonly intent?: WorkflowCapsuleIntent;
|
|
787
|
+
readonly inputs?: WorkflowCapsuleInputs;
|
|
788
|
+
readonly requires?: WorkflowCapsuleRequirements;
|
|
789
|
+
readonly provenance?: WorkflowCapsuleProvenance;
|
|
790
|
+
}
|
|
791
|
+
interface CreateWorkflowCapsuleInput {
|
|
792
|
+
readonly minKodaxVersion: string;
|
|
793
|
+
readonly manifest: WorkflowScriptManifest;
|
|
794
|
+
readonly source: string;
|
|
795
|
+
readonly intent?: WorkflowCapsuleIntent;
|
|
796
|
+
readonly inputs?: WorkflowCapsuleInputs;
|
|
797
|
+
readonly requires?: WorkflowCapsuleRequirements;
|
|
798
|
+
readonly provenance?: WorkflowCapsuleProvenance;
|
|
799
|
+
}
|
|
800
|
+
declare function validateWorkflowCapsule(value: unknown): WorkflowCapsule;
|
|
801
|
+
declare function createWorkflowCapsule(input: CreateWorkflowCapsuleInput): WorkflowCapsule;
|
|
802
|
+
declare function createWorkflowModuleFromCapsule(capsule: WorkflowCapsule): WorkflowModule;
|
|
803
|
+
|
|
804
|
+
export { extractFileOps as $, DefaultSummaryCompaction as D, appendSessionLineageLabel as I, applyLineageTruncation as J, KODAX_API_MIN_INTERVAL as K, LINEAGE_ENTRY_TYPES as L, MessageQueue as M, applySessionCompaction as N, archiveOldIslands as O, PROMISE_PATTERN as P, buildSessionTree as Q, cleanupIncompleteToolCalls as R, countActiveLineageMessages as S, countTokens as T, createSessionLineage as U, createWorkflowCapsule as V, WORKFLOW_CAPSULE_API_VERSION as W, createWorkflowModuleFromCapsule as X, estimateTokens as Y, extractArtifactLedger as Z, _resetMessageQueueForTests as _, extractTitleFromMessages as a0, findPreviousUserEntryId as a1, forkSessionLineage as a2, generateSessionId as a3, getAgentConfigHome as a4, getAgentConfigPath as a5, getAppDataDir as a6, getMessageQueue as a7, getSessionLineagePath as a8, getSessionMessagesFromLineage as a9, mergeArtifactLedger as aa, mergeFileOps as ab, resolveSessionLineageTarget as ac, rewindSessionLineage as ad, setAgentConfigHome as ae, setSessionLineageActiveEntry as af, validateAndFixToolHistory as ag, validateWorkflowCapsule as ah, validateWorkflowScriptManifest as ai, KODAX_DEFAULT_TIMEOUT as f, KODAX_HARD_TIMEOUT as g, KODAX_MAX_INCOMPLETE_RETRIES as h, KODAX_MAX_MAXTOKENS_RETRIES as i, KODAX_MAX_RETRIES as j, KODAX_MAX_TOKENS as k, KODAX_RETRY_BASE_DELAY as l, KODAX_STAGGER_DELAY as m, LineageCompaction as o, LineageExtension as r, WORKFLOW_CAPSULE_FORMAT as v, WORKFLOW_CAPSULE_VERSION as w, WORKFLOW_PATTERN_IDS as x };
|
|
805
|
+
export type { WorkflowCapsuleInputs as A, WorkflowCapsuleIntent as B, CompactionContext as C, WorkflowCapsuleProvenance as E, WorkflowCapsuleRequirements as F, WorkflowPatternId as G, WorkflowScriptManifest as H, CompactionEntry as a, CompactionEntryPayload as b, CompactionPolicy as c, CreateWorkflowCapsuleInput as d, DefaultSummaryCompactionOptions as e, LineageArtifactLedgerPayload as n, LineageCompactionDelegates as p, LineageEntryType as q, LineageLabelPayload as s, LineageTreeNode as t, PolicyCompactionResult as u, WorkflowCapsule as y, WorkflowCapsuleEnvironmentRequirement as z };
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* `Mcp*` names here; the `KodaXMcp*` aliases continue to re-export from
|
|
6
6
|
* `@kodax-ai/coding` for backward compatibility.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Transport config kind. `http` is a compatibility alias used by other MCP
|
|
10
|
+
* clients' config files; KodaX auto-detects Streamable HTTP first, then falls
|
|
11
|
+
* back to the legacy HTTP+SSE transport. It is not a distinct wire protocol.
|
|
12
|
+
*/
|
|
13
|
+
type McpTransportKind = 'stdio' | 'sse' | 'streamable-http' | 'http';
|
|
9
14
|
type McpConnectMode = 'lazy' | 'prewarm' | 'disabled';
|
|
10
15
|
interface McpServerConfig {
|
|
11
16
|
/** Transport type. Defaults to 'stdio' when omitted. */
|
|
@@ -18,19 +23,24 @@ interface McpServerConfig {
|
|
|
18
23
|
cwd?: string;
|
|
19
24
|
/** stdio: extra environment variables for the spawned process. */
|
|
20
25
|
env?: Record<string, string>;
|
|
21
|
-
/** sse / streamable-http: server endpoint URL. */
|
|
26
|
+
/** sse / streamable-http / http(auto): server endpoint URL. */
|
|
22
27
|
url?: string;
|
|
23
|
-
/** sse / streamable-http: extra HTTP headers (e.g. Authorization). */
|
|
28
|
+
/** sse / streamable-http / http(auto): extra HTTP headers (e.g. Authorization). */
|
|
24
29
|
headers?: Record<string, string>;
|
|
25
30
|
connect?: McpConnectMode;
|
|
26
31
|
startupTimeoutMs?: number;
|
|
27
32
|
requestTimeoutMs?: number;
|
|
28
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* OAuth 2.0 for authenticated MCP servers. All endpoint fields are optional:
|
|
35
|
+
* when omitted, KodaX discovers them at runtime (RFC 9728 → RFC 8414) and
|
|
36
|
+
* dynamically registers a client (RFC 7591). Provide them only to pin a
|
|
37
|
+
* pre-registered client / static endpoints.
|
|
38
|
+
*/
|
|
29
39
|
auth?: {
|
|
30
40
|
readonly type: 'oauth2';
|
|
31
|
-
readonly clientId
|
|
32
|
-
readonly authorizationUrl
|
|
33
|
-
readonly tokenUrl
|
|
41
|
+
readonly clientId?: string;
|
|
42
|
+
readonly authorizationUrl?: string;
|
|
43
|
+
readonly tokenUrl?: string;
|
|
34
44
|
readonly scopes?: readonly string[];
|
|
35
45
|
readonly redirectPort?: number;
|
|
36
46
|
};
|