@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 { E as KodaXReasoningMode, V as KodaXThinkingBudgetMap, W as KodaXThinkingDepth, s as KodaXProviderConfig, D as KodaXReasoningCapability, G as KodaXReasoningRequest, R as KodaXTaskType, F as KodaXReasoningOverride, a2 as KodaXVerifyCredentialResult, Y as KodaXToolDefinition, n as KodaXMessage, A as KodaXProviderStreamOptions, L as KodaXStreamResult, o as KodaXModelDescriptor, r as KodaXProviderCapabilityProfile, a3 as KodaXVerifyStrategy, h as KodaXCustomProviderConfig, m as KodaXListModelsResult } from './types.d-
|
|
1
|
+
import { E as KodaXReasoningMode, V as KodaXThinkingBudgetMap, W as KodaXThinkingDepth, s as KodaXProviderConfig, D as KodaXReasoningCapability, G as KodaXReasoningRequest, R as KodaXTaskType, F as KodaXReasoningOverride, a2 as KodaXVerifyCredentialResult, Y as KodaXToolDefinition, n as KodaXMessage, A as KodaXProviderStreamOptions, L as KodaXStreamResult, o as KodaXModelDescriptor, r as KodaXProviderCapabilityProfile, a3 as KodaXVerifyStrategy, h as KodaXCustomProviderConfig, m as KodaXListModelsResult } from './types.d-rPRl2LSB.js';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
-
import { K as KodaXBaseProvider } from './base.d-
|
|
3
|
+
import { K as KodaXBaseProvider } from './base.d-C4jYVjJh.js';
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-
|
|
1
|
+
import { n as KodaXSessionData, s as KodaXSessionLineage, v as KodaXSessionNavigationOptions, w as KodaXSessionRuntimeInfo, y as KodaXSessionStorage } from './types.d-BnjX2Gn4.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Session Storage - Session storage abstraction layer
|
|
@@ -31,6 +31,7 @@ interface SessionStorage {
|
|
|
31
31
|
id: string;
|
|
32
32
|
title: string;
|
|
33
33
|
msgCount: number;
|
|
34
|
+
tag?: string;
|
|
34
35
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
35
36
|
}>>;
|
|
36
37
|
delete?(id: string): Promise<void>;
|
|
@@ -58,6 +59,7 @@ declare class MemorySessionStorage implements SessionStorage {
|
|
|
58
59
|
id: string;
|
|
59
60
|
title: string;
|
|
60
61
|
msgCount: number;
|
|
62
|
+
tag?: string;
|
|
61
63
|
}>>;
|
|
62
64
|
delete(id: string): Promise<void>;
|
|
63
65
|
deleteAll(_gitRoot?: string): Promise<void>;
|
|
@@ -164,6 +166,7 @@ declare class FileSessionStorage implements KodaXSessionStorage {
|
|
|
164
166
|
id: string;
|
|
165
167
|
title: string;
|
|
166
168
|
msgCount: number;
|
|
169
|
+
tag?: string;
|
|
167
170
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
168
171
|
archived?: boolean;
|
|
169
172
|
createdAt?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y as KodaXToolDefinition, n as KodaXMessage, E as KodaXReasoningMode, _ as KodaXToolResultContentItem, U as KodaXThinkingBlock, H as KodaXRedactedThinkingBlock } from './types.d-
|
|
2
|
-
import { a as KodaXCompactMemorySeed, k as KodaXSessionArtifactLedgerEntry } from './types.d-
|
|
1
|
+
import { Y as KodaXToolDefinition, n as KodaXMessage, E as KodaXReasoningMode, _ as KodaXToolResultContentItem, U as KodaXThinkingBlock, H as KodaXRedactedThinkingBlock } from './types.d-rPRl2LSB.js';
|
|
2
|
+
import { a as KodaXCompactMemorySeed, k as KodaXSessionArtifactLedgerEntry } from './types.d-BnjX2Gn4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Layer A Primitive: Agent / Handoff / Guardrail / AgentReasoningProfile
|
|
@@ -1535,6 +1535,8 @@ interface StopHookContext {
|
|
|
1535
1535
|
/** Total reanimate budget for this run (`stopHookReanimateBudget`
|
|
1536
1536
|
* or default 2). Exposed for transparency. */
|
|
1537
1537
|
readonly reanimateBudget: number;
|
|
1538
|
+
/** Caller cancellation signal, forwarded so stop hooks can cancel I/O. */
|
|
1539
|
+
readonly abortSignal?: AbortSignal;
|
|
1538
1540
|
}
|
|
1539
1541
|
/**
|
|
1540
1542
|
* FEATURE_184 (v0.7.45) — Stop hook return surface.
|
|
@@ -1816,6 +1818,190 @@ declare function runToolBeforeGuardrails(call: RunnerToolCall, guardrails: reado
|
|
|
1816
1818
|
*/
|
|
1817
1819
|
declare function runToolAfterGuardrails(call: RunnerToolCall, result: RunnerToolResult, guardrails: readonly ToolGuardrail[], ctx: GuardrailContext, agentSpan: Span | null): Promise<RunnerToolResult>;
|
|
1818
1820
|
|
|
1821
|
+
/**
|
|
1822
|
+
* FEATURE_222 — user-interaction primitive (agent layer).
|
|
1823
|
+
*
|
|
1824
|
+
* "Ask the user a question" is needed at BOTH layers: the coding `ask_user_*`
|
|
1825
|
+
* tools (LLM-initiated) AND the MCP elicitation reverse capability
|
|
1826
|
+
* (server-initiated). The capability historically lived only in
|
|
1827
|
+
* `@kodax-ai/coding`, but the MCP runtime lives one layer below in
|
|
1828
|
+
* `@kodax-ai/agent` and cannot reach up to it. So the primitive is owned here,
|
|
1829
|
+
* at the agent layer, and the host injects ONE implementation that both layers
|
|
1830
|
+
* share — coding re-exports these types for backward compatibility.
|
|
1831
|
+
*
|
|
1832
|
+
* The agent layer is UI-less by design: these are the contract the host
|
|
1833
|
+
* (REPL / ACP / SDK) fulfils with its real interaction surface. A headless host
|
|
1834
|
+
* leaves them undefined and consumers degrade gracefully (cancel / decline).
|
|
1835
|
+
*/
|
|
1836
|
+
/** A single question item used in multi-question mode. */
|
|
1837
|
+
interface AskUserQuestionItem {
|
|
1838
|
+
question: string;
|
|
1839
|
+
header?: string;
|
|
1840
|
+
options: Array<{
|
|
1841
|
+
label: string;
|
|
1842
|
+
description?: string;
|
|
1843
|
+
value: string;
|
|
1844
|
+
}>;
|
|
1845
|
+
multiSelect?: boolean;
|
|
1846
|
+
}
|
|
1847
|
+
/** Options for multi-question mode — multiple independent questions in one call. */
|
|
1848
|
+
interface AskUserMultiOptions {
|
|
1849
|
+
questions: AskUserQuestionItem[];
|
|
1850
|
+
}
|
|
1851
|
+
/** Options for a single question (select or free-text input). */
|
|
1852
|
+
interface AskUserQuestionOptions {
|
|
1853
|
+
question: string;
|
|
1854
|
+
kind?: 'select' | 'input';
|
|
1855
|
+
/** Required for kind="select", ignored for kind="input". */
|
|
1856
|
+
options?: Array<{
|
|
1857
|
+
label: string;
|
|
1858
|
+
description?: string;
|
|
1859
|
+
value: string;
|
|
1860
|
+
}>;
|
|
1861
|
+
multiSelect?: boolean;
|
|
1862
|
+
default?: string;
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* The host-provided user-interaction surface. Each method is optional — a
|
|
1866
|
+
* headless host omits them and callers degrade gracefully. This is the single
|
|
1867
|
+
* primitive shared by the coding `ask_user_*` tools and the agent's MCP
|
|
1868
|
+
* elicitation reverse capability.
|
|
1869
|
+
*/
|
|
1870
|
+
interface UserInteraction {
|
|
1871
|
+
/** Ask one question (select mode by default). Resolves the chosen value. */
|
|
1872
|
+
askUser?: (options: AskUserQuestionOptions) => Promise<string>;
|
|
1873
|
+
/** Ask several independent questions sequentially. Resolves a value map, or
|
|
1874
|
+
* undefined when the user cancels. */
|
|
1875
|
+
askUserMulti?: (options: AskUserMultiOptions) => Promise<Record<string, string> | undefined>;
|
|
1876
|
+
/** Ask for free-text input. Resolves the text, or undefined when cancelled. */
|
|
1877
|
+
askUserInput?: (options: {
|
|
1878
|
+
question: string;
|
|
1879
|
+
default?: string;
|
|
1880
|
+
}) => Promise<string | undefined>;
|
|
1881
|
+
}
|
|
1882
|
+
/** Register the live user-interaction surface (host calls this when interactive). */
|
|
1883
|
+
declare function setActiveUserInteraction(interaction: UserInteraction | undefined): void;
|
|
1884
|
+
/** The live user-interaction surface, or undefined when none is active. */
|
|
1885
|
+
declare function getActiveUserInteraction(): UserInteraction | undefined;
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* @kodax-ai/agent/messaging — Message queue types
|
|
1889
|
+
*
|
|
1890
|
+
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
1891
|
+
*
|
|
1892
|
+
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
1893
|
+
* specific). Downstream consumers:
|
|
1894
|
+
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
1895
|
+
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
1896
|
+
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
1897
|
+
*
|
|
1898
|
+
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
1899
|
+
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
1900
|
+
*/
|
|
1901
|
+
type MessagePriority = 'user' | 'background';
|
|
1902
|
+
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
1903
|
+
interface QueuedMessage {
|
|
1904
|
+
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
1905
|
+
readonly id: string;
|
|
1906
|
+
readonly priority: MessagePriority;
|
|
1907
|
+
/**
|
|
1908
|
+
* Routing key:
|
|
1909
|
+
* undefined = main thread / coordinator agent
|
|
1910
|
+
* 'agent-id-XYZ' = subagent / specific consumer
|
|
1911
|
+
*
|
|
1912
|
+
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
1913
|
+
* undefined-agentId messages, not "any agent".
|
|
1914
|
+
*/
|
|
1915
|
+
readonly agentId?: string;
|
|
1916
|
+
readonly mode: MessageMode;
|
|
1917
|
+
readonly content: string;
|
|
1918
|
+
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
1919
|
+
readonly enqueuedAt: number;
|
|
1920
|
+
}
|
|
1921
|
+
interface DequeueFilter {
|
|
1922
|
+
/**
|
|
1923
|
+
* Only return messages with this agentId.
|
|
1924
|
+
* undefined matches messages with no agentId (main-thread messages only).
|
|
1925
|
+
*/
|
|
1926
|
+
readonly agentId?: string;
|
|
1927
|
+
/**
|
|
1928
|
+
* Highest priority level included in the drain.
|
|
1929
|
+
* 'user' → only user priority drained, background stays queued
|
|
1930
|
+
* 'background' → both user + background drained (Sleep-gated case)
|
|
1931
|
+
*/
|
|
1932
|
+
readonly maxPriority: MessagePriority;
|
|
1933
|
+
/**
|
|
1934
|
+
* Optional cap on number of messages drained in this call.
|
|
1935
|
+
* Defaults to unlimited (drains all matching).
|
|
1936
|
+
*/
|
|
1937
|
+
readonly limit?: number;
|
|
1938
|
+
/**
|
|
1939
|
+
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
1940
|
+
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
1941
|
+
* input vs `mode:'task-notification'` for child completion banners)
|
|
1942
|
+
* without separate queues. When omitted, all modes match.
|
|
1943
|
+
*/
|
|
1944
|
+
readonly mode?: MessageMode;
|
|
1945
|
+
/**
|
|
1946
|
+
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
1947
|
+
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
1948
|
+
* other filters still apply (agentId / priority / mode mismatches still
|
|
1949
|
+
* skip the message), so callers can't accidentally remove a message
|
|
1950
|
+
* outside their scope.
|
|
1951
|
+
*/
|
|
1952
|
+
readonly id?: string;
|
|
1953
|
+
/**
|
|
1954
|
+
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
1955
|
+
* the structured filters. Lets SDK consumers express conditions the
|
|
1956
|
+
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
1957
|
+
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
1958
|
+
* code should prefer the typed fields for readability; this is the
|
|
1959
|
+
* "data-driven main path + predicate escape" pattern.
|
|
1960
|
+
*
|
|
1961
|
+
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
1962
|
+
* inspects `message.content` never runs on messages outside the
|
|
1963
|
+
* caller's `agentId` / `mode` / `id` scope.
|
|
1964
|
+
*/
|
|
1965
|
+
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
1969
|
+
*
|
|
1970
|
+
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
1971
|
+
* affected messages so SDK observability consumers (logging, tracing,
|
|
1972
|
+
* metrics) can react per-event without re-diffing snapshots.
|
|
1973
|
+
*
|
|
1974
|
+
* Event granularity rules:
|
|
1975
|
+
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
1976
|
+
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
1977
|
+
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
1978
|
+
* (filter matched nothing) fire no event — quiet by design so the
|
|
1979
|
+
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
1980
|
+
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
1981
|
+
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
1982
|
+
*
|
|
1983
|
+
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
1984
|
+
* only needs the change signal); SDK / tracer consumers read the event.
|
|
1985
|
+
*/
|
|
1986
|
+
type QueueEvent = {
|
|
1987
|
+
readonly kind: 'enqueued';
|
|
1988
|
+
readonly message: QueuedMessage;
|
|
1989
|
+
} | {
|
|
1990
|
+
readonly kind: 'dequeued';
|
|
1991
|
+
readonly messages: readonly QueuedMessage[];
|
|
1992
|
+
} | {
|
|
1993
|
+
readonly kind: 'cleared';
|
|
1994
|
+
readonly messages: readonly QueuedMessage[];
|
|
1995
|
+
};
|
|
1996
|
+
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
1997
|
+
type QueueEventListener = (event: QueueEvent) => void;
|
|
1998
|
+
interface EnqueueInput {
|
|
1999
|
+
readonly priority: MessagePriority;
|
|
2000
|
+
readonly mode: MessageMode;
|
|
2001
|
+
readonly content: string;
|
|
2002
|
+
readonly agentId?: string;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1819
2005
|
/**
|
|
1820
2006
|
* Child task registry primitive — generic fan-out tracking.
|
|
1821
2007
|
*
|
|
@@ -2273,5 +2459,244 @@ interface FileOperations {
|
|
|
2273
2459
|
modifiedFiles: string[];
|
|
2274
2460
|
}
|
|
2275
2461
|
|
|
2276
|
-
|
|
2277
|
-
|
|
2462
|
+
/**
|
|
2463
|
+
* FEATURE_217 (v0.7.49) — Workflow run-graph events.
|
|
2464
|
+
*
|
|
2465
|
+
* Append-only event stream for a workflow run. Each event carries a
|
|
2466
|
+
* monotonic `seq` so ordering is stable and verifiable regardless of
|
|
2467
|
+
* wall-clock (the durable writer in Phase D adds timestamps via an
|
|
2468
|
+
* injected clock). The run graph models agent relationships as a
|
|
2469
|
+
* thread/edge/event stream, not just a final summary blob.
|
|
2470
|
+
*/
|
|
2471
|
+
type WorkflowEventType = 'workflow_started' | 'phase_started' | 'phase_finished' | 'agent_spawned' | 'agent_message_sent' | 'agent_completed' | 'agent_stopped' | 'artifact_written' | 'synthesis_completed' | 'workflow_completed' | 'workflow_stopped' | 'workflow_failed';
|
|
2472
|
+
interface WorkflowEvent {
|
|
2473
|
+
/** Monotonic sequence number — stable append ordering. */
|
|
2474
|
+
readonly seq: number;
|
|
2475
|
+
readonly type: WorkflowEventType;
|
|
2476
|
+
/** Structured payload (agent name/id, phase name, error message, …). */
|
|
2477
|
+
readonly data?: Record<string, unknown>;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Append-only event recorder. Assigns sequential `seq` and fans each
|
|
2481
|
+
* event out to an optional sink (the durable JSONL writer / UI consumer
|
|
2482
|
+
* subscribes here in Phase D).
|
|
2483
|
+
*/
|
|
2484
|
+
declare class WorkflowEventRecorder {
|
|
2485
|
+
private readonly sink?;
|
|
2486
|
+
private seq;
|
|
2487
|
+
private readonly events;
|
|
2488
|
+
constructor(sink?: ((event: WorkflowEvent) => void) | undefined);
|
|
2489
|
+
/** Append an event, returning the materialized record. */
|
|
2490
|
+
emit(type: WorkflowEventType, data?: Record<string, unknown>): WorkflowEvent;
|
|
2491
|
+
/** Immutable snapshot of all events emitted so far. */
|
|
2492
|
+
snapshot(): readonly WorkflowEvent[];
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
/**
|
|
2496
|
+
* FEATURE_217 (v0.7.49) — Dynamic Workflow Harness Runtime: public types.
|
|
2497
|
+
*
|
|
2498
|
+
* Domain-neutral workflow orchestration surface. A workflow *script*
|
|
2499
|
+
* coordinates (decompose / fan-out / loop / wait / stop / verify /
|
|
2500
|
+
* synthesize); it never touches files or shell directly. The actual
|
|
2501
|
+
* agent execution is delegated to an injected `WorkflowAgentBackend`
|
|
2502
|
+
* (the coding layer provides the real one in Phase B; tests inject a
|
|
2503
|
+
* fake). This keeps `@kodax-ai/agent` free of any `@kodax-ai/coding`
|
|
2504
|
+
* dependency (ADR-021 layer independence).
|
|
2505
|
+
*/
|
|
2506
|
+
/** Lifecycle status of a single workflow-spawned agent. */
|
|
2507
|
+
type WorkflowTaskStatus = 'running' | 'completed' | 'failed' | 'stopped';
|
|
2508
|
+
/** Routing hint for which provider/model tier the child should use. */
|
|
2509
|
+
type WorkflowModelHint = 'fast' | 'balanced' | 'deep';
|
|
2510
|
+
/** Isolation policy for a spawned agent. `shared-cwd` is the default
|
|
2511
|
+
* (FEATURE_188); `worktree` is opt-in for high-risk parallel writes. */
|
|
2512
|
+
type WorkflowIsolation = 'shared-cwd' | 'worktree';
|
|
2513
|
+
interface WorkflowSpawnAgentInput {
|
|
2514
|
+
/** Human-readable label for the agent — surfaces in events / UI. */
|
|
2515
|
+
readonly name: string;
|
|
2516
|
+
/** The task prompt handed to the child agent. */
|
|
2517
|
+
readonly prompt: string;
|
|
2518
|
+
/** When true, the child runs with a read-only tool whitelist. */
|
|
2519
|
+
readonly readOnly?: boolean;
|
|
2520
|
+
/** Route to a registered specialist agent (FEATURE_191). */
|
|
2521
|
+
readonly subagentType?: string;
|
|
2522
|
+
/** Provider/model tier hint (FEATURE_120 model_hint → env tier). */
|
|
2523
|
+
readonly modelHint?: WorkflowModelHint;
|
|
2524
|
+
/** Isolation policy; defaults to `shared-cwd`. */
|
|
2525
|
+
readonly isolation?: WorkflowIsolation;
|
|
2526
|
+
/** Evidence refs (`task_id:<id>` etc.) seeded into the child context. */
|
|
2527
|
+
readonly evidenceRefs?: readonly string[];
|
|
2528
|
+
}
|
|
2529
|
+
/** Returned by `spawnAgent` — the child is in-flight, not yet complete. */
|
|
2530
|
+
interface WorkflowTaskHandle {
|
|
2531
|
+
readonly taskId: string;
|
|
2532
|
+
readonly name: string;
|
|
2533
|
+
}
|
|
2534
|
+
interface WorkflowTaskUsage {
|
|
2535
|
+
readonly inputTokens?: number;
|
|
2536
|
+
readonly outputTokens?: number;
|
|
2537
|
+
readonly totalTokens?: number;
|
|
2538
|
+
}
|
|
2539
|
+
/** Terminal result of a spawned agent (from `wait` / `runAgent`). */
|
|
2540
|
+
interface WorkflowTaskResult {
|
|
2541
|
+
readonly taskId: string;
|
|
2542
|
+
readonly name: string;
|
|
2543
|
+
readonly status: WorkflowTaskStatus;
|
|
2544
|
+
readonly finalText: string;
|
|
2545
|
+
/** Short user-facing digest, separate from the full finalText used for synthesis/audit. */
|
|
2546
|
+
readonly digest?: string;
|
|
2547
|
+
/** True when a digest was attempted but failed (error/timeout/empty); the UI then labels the excerpt fallback. */
|
|
2548
|
+
readonly digestFailed?: boolean;
|
|
2549
|
+
readonly usage?: WorkflowTaskUsage;
|
|
2550
|
+
}
|
|
2551
|
+
/** Point-in-time snapshot of a (possibly still-running) agent. */
|
|
2552
|
+
interface WorkflowTaskSnapshot {
|
|
2553
|
+
readonly taskId: string;
|
|
2554
|
+
readonly name: string;
|
|
2555
|
+
readonly status: WorkflowTaskStatus;
|
|
2556
|
+
readonly lastText?: string;
|
|
2557
|
+
}
|
|
2558
|
+
interface WorkflowWaitOptions {
|
|
2559
|
+
readonly timeoutMs?: number;
|
|
2560
|
+
}
|
|
2561
|
+
interface WorkflowParallelOptions {
|
|
2562
|
+
/** In-flight cap for this parallel block; clamped by workflow
|
|
2563
|
+
* maxConcurrency. */
|
|
2564
|
+
readonly concurrency?: number;
|
|
2565
|
+
}
|
|
2566
|
+
interface WorkflowSynthesizeInput {
|
|
2567
|
+
readonly inputs: readonly unknown[] | string | Record<string, unknown>;
|
|
2568
|
+
readonly rubric: string;
|
|
2569
|
+
}
|
|
2570
|
+
interface WorkflowSynthesis {
|
|
2571
|
+
readonly text: string;
|
|
2572
|
+
}
|
|
2573
|
+
interface WorkflowArtifactRef {
|
|
2574
|
+
readonly name: string;
|
|
2575
|
+
readonly path?: string;
|
|
2576
|
+
}
|
|
2577
|
+
interface WorkflowLogEvent {
|
|
2578
|
+
readonly message: string;
|
|
2579
|
+
readonly data?: unknown;
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Token budget accounting. The runtime hard-stops before launching a new
|
|
2583
|
+
* agent once completed children have exhausted the configured budget.
|
|
2584
|
+
*/
|
|
2585
|
+
interface WorkflowBudget {
|
|
2586
|
+
/** Configured token budget, or null when unbounded. */
|
|
2587
|
+
readonly total: number | null;
|
|
2588
|
+
/** Tokens accounted across completed agents so far. */
|
|
2589
|
+
spent(): number;
|
|
2590
|
+
/** `max(0, total - spent())`, or Infinity when unbounded. */
|
|
2591
|
+
remaining(): number;
|
|
2592
|
+
}
|
|
2593
|
+
interface WorkflowLimits {
|
|
2594
|
+
/** Total agents spawnable across the whole run lifetime. */
|
|
2595
|
+
readonly maxAgents?: number;
|
|
2596
|
+
/** Maximum simultaneously in-flight agents (via runAgent / parallel). */
|
|
2597
|
+
readonly maxConcurrency?: number;
|
|
2598
|
+
/** Token budget. New spawns stop once completed usage exhausts it. */
|
|
2599
|
+
readonly tokenBudget?: number;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* The surface a workflow script consumes. The script never gets raw
|
|
2603
|
+
* fs/shell — all effects route through agent tools behind the backend.
|
|
2604
|
+
*/
|
|
2605
|
+
interface WorkflowApi {
|
|
2606
|
+
readonly runId: string;
|
|
2607
|
+
readonly args: unknown;
|
|
2608
|
+
readonly budget: WorkflowBudget;
|
|
2609
|
+
/** Group operations under a named phase (emits phase_started/finished). */
|
|
2610
|
+
phase<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
2611
|
+
/** Start a child agent; returns immediately with a handle. */
|
|
2612
|
+
spawnAgent(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskHandle>;
|
|
2613
|
+
/** spawnAgent + wait convenience; returns the terminal result. */
|
|
2614
|
+
runAgent(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskResult>;
|
|
2615
|
+
/** Await a spawned agent's terminal result. */
|
|
2616
|
+
wait(taskId: string, opts?: WorkflowWaitOptions): Promise<WorkflowTaskResult>;
|
|
2617
|
+
/** Snapshot a (possibly running) agent. */
|
|
2618
|
+
output(taskId: string): Promise<WorkflowTaskSnapshot>;
|
|
2619
|
+
/** Send a message to a running agent (via MessageQueue routing). */
|
|
2620
|
+
send(taskId: string, content: string): Promise<void>;
|
|
2621
|
+
/** Stop a running agent (graceful abort). */
|
|
2622
|
+
stop(taskId: string, reason: string): Promise<void>;
|
|
2623
|
+
/** Run lazy thunks concurrently under the concurrency gate. Thunks
|
|
2624
|
+
* MUST be `() => Promise<T>` (not already-started promises) so the
|
|
2625
|
+
* runtime can bound concurrency. */
|
|
2626
|
+
parallel<T>(items: readonly (() => Promise<T>)[], opts?: WorkflowParallelOptions): Promise<T[]>;
|
|
2627
|
+
/** Synthesize across inputs. Runs as a gated agent through the runtime
|
|
2628
|
+
* (spawn → wait), so it counts toward maxAgents / concurrency / budget
|
|
2629
|
+
* and emits run-graph events — it is NOT a backend side-channel. */
|
|
2630
|
+
synthesize(input: WorkflowSynthesizeInput): Promise<WorkflowSynthesis>;
|
|
2631
|
+
/** Persist a named artifact. */
|
|
2632
|
+
artifact(name: string, value: unknown): Promise<WorkflowArtifactRef>;
|
|
2633
|
+
/** Emit a free-text progress log event. */
|
|
2634
|
+
log(event: WorkflowLogEvent): void;
|
|
2635
|
+
}
|
|
2636
|
+
/** Metadata a workflow declares (name, description, default caps). */
|
|
2637
|
+
interface WorkflowMeta {
|
|
2638
|
+
readonly name: string;
|
|
2639
|
+
readonly description: string;
|
|
2640
|
+
/** Best-effort expected child-agent count for progress UI; not a hard cap. */
|
|
2641
|
+
readonly plannedAgents?: number;
|
|
2642
|
+
readonly maxAgents?: number;
|
|
2643
|
+
readonly maxConcurrency?: number;
|
|
2644
|
+
readonly tokenBudget?: number;
|
|
2645
|
+
/** True when the workflow only ever spawns read-only agents (no file
|
|
2646
|
+
* writes) — surfaced in the approval prompt. */
|
|
2647
|
+
readonly readOnly?: boolean;
|
|
2648
|
+
/** Declared phase names, for the approval prompt preview. */
|
|
2649
|
+
readonly phases?: readonly string[];
|
|
2650
|
+
}
|
|
2651
|
+
/** Summary shown to the user before a workflow's first run. */
|
|
2652
|
+
interface WorkflowApprovalSummary {
|
|
2653
|
+
readonly name: string;
|
|
2654
|
+
readonly description: string;
|
|
2655
|
+
readonly phases: readonly string[];
|
|
2656
|
+
readonly plannedAgents?: number;
|
|
2657
|
+
readonly maxAgents: number | null;
|
|
2658
|
+
readonly maxConcurrency: number | null;
|
|
2659
|
+
readonly tokenBudget: number | null;
|
|
2660
|
+
/** Whether the workflow may write files (false for read-only workflows). */
|
|
2661
|
+
readonly writesFiles: boolean;
|
|
2662
|
+
}
|
|
2663
|
+
/** Approval gate — returns true to proceed, false to cancel the run. */
|
|
2664
|
+
type WorkflowApproval = (summary: WorkflowApprovalSummary) => boolean | Promise<boolean>;
|
|
2665
|
+
/** A workflow's entry function: coordinates agents via the `WorkflowApi`. */
|
|
2666
|
+
type WorkflowRun<TArgs = unknown, TResult = unknown> = (wf: WorkflowApi, args: TArgs) => Promise<TResult>;
|
|
2667
|
+
/** A self-contained workflow: metadata + entry function. Built-in
|
|
2668
|
+
* workflows (Phase C) and saved `.kodax/workflows/*.ts` (Phase E) both
|
|
2669
|
+
* materialize to this shape. */
|
|
2670
|
+
interface WorkflowModule<TArgs = unknown, TResult = unknown> {
|
|
2671
|
+
readonly meta: WorkflowMeta;
|
|
2672
|
+
readonly run: WorkflowRun<TArgs, TResult>;
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* Injected execution backend. The coding layer implements this over its
|
|
2676
|
+
* child-dispatch substrate (ChildTaskRegistry / childProgressSnapshots /
|
|
2677
|
+
* MessageQueue / executeChildAgents); tests inject a fake. The agent
|
|
2678
|
+
* runtime depends ONLY on this interface — never on coding.
|
|
2679
|
+
*/
|
|
2680
|
+
interface WorkflowAgentBackend {
|
|
2681
|
+
spawn(input: WorkflowSpawnAgentInput): Promise<WorkflowTaskHandle>;
|
|
2682
|
+
wait(taskId: string, opts?: WorkflowWaitOptions): Promise<WorkflowTaskResult>;
|
|
2683
|
+
output(taskId: string): Promise<WorkflowTaskSnapshot>;
|
|
2684
|
+
send(taskId: string, content: string): Promise<void>;
|
|
2685
|
+
stop(taskId: string, reason: string): Promise<void>;
|
|
2686
|
+
/** Optional durable artifact writer (Phase D wires the run graph).
|
|
2687
|
+
* `wf.synthesize` is NOT a backend method — it runs as a gated agent
|
|
2688
|
+
* through `spawn`/`wait` so it counts toward the runtime's caps. */
|
|
2689
|
+
writeArtifact?(name: string, value: unknown): Promise<WorkflowArtifactRef>;
|
|
2690
|
+
}
|
|
2691
|
+
type WorkflowRunStatus = 'running' | 'completed' | 'failed' | 'stopped';
|
|
2692
|
+
/** Immutable snapshot of a workflow run's accumulated state. */
|
|
2693
|
+
interface WorkflowRunState {
|
|
2694
|
+
readonly runId: string;
|
|
2695
|
+
readonly status: WorkflowRunStatus;
|
|
2696
|
+
readonly totalSpawned: number;
|
|
2697
|
+
readonly events: readonly WorkflowEvent[];
|
|
2698
|
+
readonly artifacts: readonly WorkflowArtifactRef[];
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
export { DEFAULT_SYSTEM_CAP as D, GuardrailBlockedError as H, GuardrailEscalateError as J, InvariantSession as T, MAX_TOOL_LOOP_ITERATIONS as U, WorkflowEventRecorder as a$, Tracer as aR, Runner as af, SpanImpl as ax, extractAssistantTextFromMessage as bA, getActiveUserInteraction as bB, getAdmittedAgentBindings as bC, isRunnableTool as bD, isRunnerLlmResult as bE, registerChildTask as bF, registerPresetDispatcher as bG, requestTaskStop as bH, runAdmissionAudit as bI, runInputGuardrails as bJ, runOutputGuardrails as bK, runToolAfterGuardrails as bL, runToolBeforeGuardrails as bM, setActiveUserInteraction as bN, setAdmittedAgentBindings as bO, _resetAdmittedAgentBindings as bk, _resetPresetDispatchers as bl, buildAssistantMessageFromLlmResult as bm, buildSystemPrompt as bn, buildToolResultMessage as bo, collectGuardrails as bp, createAgent as bq, createHandoff as br, createInMemorySession as bs, createInvariantSessionForAgent as bt, createStateWriter as bu, createTrace as bv, defaultTracer as bw, detectInstructionsInjection as bx, discoverInstances as by, executeRunnerToolCall as bz };
|
|
2702
|
+
export type { PersistedSessionState as $, AdmissionAuditOptions as A, Guardrail as B, ChildTaskRegistry as C, EnqueueInput as E, FanoutSpanData as F, GenerationSpanData as G, GuardrailContext as I, GuardrailSpanData as K, GuardrailVerdict as L, Handoff as M, HandoffSpanData as N, InMemorySessionOptions as O, InputGuardrail as P, InstanceDiscoveryFs as Q, InvariantId as R, InvariantResult as S, ManifestPatch as V, MessageEntry as W, MessageMode as X, MessagePriority as Y, ObserveCtx as Z, OutputGuardrail as _, AdmissionCtx as a, PresetDispatcher as a0, PresetTracingContext as a1, QualityInvariant as a2, QueueEventListener as a3, QueuedMessage as a4, ReadonlyMutationTracker as a5, ReadonlyRecorder as a6, ReasoningDepth as a7, RecentlyModifiedFile as a8, RequestTaskStopOptions as a9, StateWriter as aA, StateWriterFs as aB, StateWriterOptions as aC, StopHookContext as aD, StopHookFn as aE, StopHookResult as aF, StopHookSpanData as aG, SystemCap as aH, TaskAbortRegistry as aI, TerminalCtx as aJ, ToolBeforeOutcome as aK, ToolCallSpanData as aL, ToolCapability as aM, ToolGuardrail as aN, ToolPermission as aO, Trace as aP, TraceOptions as aQ, TracerOptions as aS, UserInteraction as aT, WorkflowAgentBackend as aU, WorkflowApi as aV, WorkflowApproval as aW, WorkflowApprovalSummary as aX, WorkflowArtifactRef as aY, WorkflowBudget as aZ, WorkflowEvent as a_, RequestTaskStopResult as aa, RunEvent as ab, RunOptions as ac, RunResult as ad, RunnableTool as ae, RunnerEvent as ag, RunnerLlmResult as ah, RunnerLlmReturn as ai, RunnerToolCall as aj, RunnerToolContext as ak, RunnerToolObserver as al, RunnerToolResult as am, Session as an, SessionDispatchResult as ao, SessionEntry as ap, SessionExtension as aq, SessionForkOptions as ar, SessionMeta as as, SessionStateSnapshot as at, Span as au, SpanData as av, SpanError as aw, SpanImplOptions as ay, StartTraceOptions as az, AdmissionVerdict as b, WorkflowEventType as b0, WorkflowIsolation as b1, WorkflowLimits as b2, WorkflowLogEvent as b3, WorkflowMeta as b4, WorkflowModelHint as b5, WorkflowModule as b6, WorkflowParallelOptions as b7, WorkflowRun as b8, WorkflowRunState as b9, WorkflowRunStatus as ba, WorkflowSpawnAgentInput as bb, WorkflowSynthesis as bc, WorkflowSynthesizeInput as bd, WorkflowTaskHandle as be, WorkflowTaskResult as bf, WorkflowTaskSnapshot as bg, WorkflowTaskStatus as bh, WorkflowTaskUsage as bi, WorkflowWaitOptions as bj, AdmittedHandle as c, Agent as d, AgentManifest as e, AgentMessage as f, AgentMiddlewareDeclaration as g, AgentReasoningProfile as h, AgentSpanData as i, AgentTool as j, AskUserMultiOptions as k, AskUserQuestionItem as l, AskUserQuestionOptions as m, CompactionAnchor as n, CompactionConfig as o, CompactionDetails as p, CompactionResult as q, CompactionSpanData as r, CompactionUpdate as s, CurrentTodoSummary as t, Deliverable as u, DequeueFilter as v, DiscoveredInstance as w, DiscoveryOptions as x, EvidenceSpanData as y, FileOperations as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as KodaXMessage } from './types.d-
|
|
1
|
+
import { n as KodaXMessage } from './types.d-rPRl2LSB.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @kodax-ai/agent Types
|
|
@@ -182,6 +182,8 @@ interface KodaXSessionData {
|
|
|
182
182
|
messages: KodaXMessage[];
|
|
183
183
|
title: string;
|
|
184
184
|
gitRoot: string;
|
|
185
|
+
/** Consumer-owned private string persisted with the session. */
|
|
186
|
+
tag?: string;
|
|
185
187
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
186
188
|
scope?: KodaXSessionScope;
|
|
187
189
|
uiHistory?: KodaXSessionUiHistoryItem[];
|
|
@@ -196,6 +198,8 @@ interface KodaXSessionMeta {
|
|
|
196
198
|
title: string;
|
|
197
199
|
id: string;
|
|
198
200
|
gitRoot: string;
|
|
201
|
+
/** Consumer-owned private string persisted with the session. */
|
|
202
|
+
tag?: string;
|
|
199
203
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
200
204
|
createdAt: string;
|
|
201
205
|
scope?: KodaXSessionScope;
|
|
@@ -283,6 +287,7 @@ interface KodaXSessionStorage {
|
|
|
283
287
|
id: string;
|
|
284
288
|
title: string;
|
|
285
289
|
msgCount: number;
|
|
290
|
+
tag?: string;
|
|
286
291
|
runtimeInfo?: KodaXSessionRuntimeInfo;
|
|
287
292
|
}>>;
|
|
288
293
|
delete?(id: string): Promise<void>;
|
|
@@ -474,6 +474,10 @@ interface KodaXProviderStreamOptions {
|
|
|
474
474
|
sessionId?: string;
|
|
475
475
|
/** Override the provider's default model for a single request */
|
|
476
476
|
modelOverride?: string;
|
|
477
|
+
/** Force a single tool call for one-shot judge/sidecar requests. */
|
|
478
|
+
forcedToolName?: string;
|
|
479
|
+
/** Per-request output budget override for short structured calls. */
|
|
480
|
+
maxOutputTokensOverride?: number;
|
|
477
481
|
/** AbortSignal for cancelling the stream request */
|
|
478
482
|
signal?: AbortSignal;
|
|
479
483
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as SessionStorage$1 } from './storage.d-
|
|
3
|
-
import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-
|
|
4
|
-
import { n as KodaXMessage, E as KodaXReasoningMode, r as KodaXProviderCapabilityProfile, F as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-
|
|
1
|
+
import { i as BashPrefixExtractor, a4 as KodaXOptions, M as KodaXContextTokenSnapshot, K as KodaXAgentMode, a9 as KodaXRepoIntelligenceMode, A as AgentsFile, f as AutoModeStats, al as KodaXSkillInvocationContext, a1 as KodaXMcpServersConfig } from './bash-prefix-extractor.d-CI_xcPhn.js';
|
|
2
|
+
import { a as SessionStorage$1 } from './storage.d-J2GqOgaX.js';
|
|
3
|
+
import { y as KodaXSessionStorage, n as KodaXSessionData, A as KodaXSessionUiHistoryItem, s as KodaXSessionLineage, k as KodaXSessionArtifactLedgerEntry, w as KodaXSessionRuntimeInfo } from './types.d-BnjX2Gn4.js';
|
|
4
|
+
import { n as KodaXMessage, E as KodaXReasoningMode, r as KodaXProviderCapabilityProfile, F as KodaXReasoningOverride, h as KodaXCustomProviderConfig } from './types.d-rPRl2LSB.js';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
6
|
import { SpawnSyncReturns } from 'child_process';
|
|
7
7
|
|
|
@@ -100,15 +100,12 @@ interface InkREPLOptions extends KodaXOptions {
|
|
|
100
100
|
*/
|
|
101
101
|
declare function runInkInteractiveMode(options: InkREPLOptions): Promise<void>;
|
|
102
102
|
|
|
103
|
-
/**
|
|
104
|
-
* KodaX Interactive REPL Mode - 交互式 REPL 模式
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
103
|
interface SessionStorage extends KodaXSessionStorage {
|
|
108
104
|
list(gitRoot?: string): Promise<Array<{
|
|
109
105
|
id: string;
|
|
110
106
|
title: string;
|
|
111
107
|
msgCount: number;
|
|
108
|
+
tag?: string;
|
|
112
109
|
runtimeInfo?: KodaXSessionData['runtimeInfo'];
|
|
113
110
|
}>>;
|
|
114
111
|
}
|
|
@@ -265,6 +262,36 @@ interface CommandCallbacks {
|
|
|
265
262
|
reloadAgentsFiles?: () => Promise<AgentsFile[]>;
|
|
266
263
|
confirm?: (message: string) => Promise<boolean>;
|
|
267
264
|
readline?: readline.Interface;
|
|
265
|
+
onWorkflowBuilderEvent?: (event: {
|
|
266
|
+
readonly stage: string;
|
|
267
|
+
readonly message: string;
|
|
268
|
+
}) => void;
|
|
269
|
+
onWorkflowRunMessage?: (event: {
|
|
270
|
+
readonly type: 'info' | 'success' | 'error' | 'event' | 'assistant';
|
|
271
|
+
readonly text: string;
|
|
272
|
+
readonly final?: boolean;
|
|
273
|
+
}) => void;
|
|
274
|
+
onWorkflowRunUpdate?: (event: {
|
|
275
|
+
readonly runId: string;
|
|
276
|
+
readonly workflow: string;
|
|
277
|
+
readonly status: 'running' | 'completed' | 'failed' | 'stopped';
|
|
278
|
+
readonly phase?: string;
|
|
279
|
+
readonly phaseIndex?: number;
|
|
280
|
+
readonly phaseTotal?: number;
|
|
281
|
+
readonly startedAt?: number;
|
|
282
|
+
readonly elapsedMs?: number;
|
|
283
|
+
readonly activeAgents: readonly string[];
|
|
284
|
+
readonly totalSpawned: number;
|
|
285
|
+
readonly plannedAgents?: number;
|
|
286
|
+
readonly agentCap?: number;
|
|
287
|
+
readonly tokenBudgetSpent?: number;
|
|
288
|
+
readonly tokenBudgetTotal?: number;
|
|
289
|
+
readonly completedAgents: number;
|
|
290
|
+
readonly failedAgents: number;
|
|
291
|
+
readonly stoppedAgents: number;
|
|
292
|
+
readonly message?: string;
|
|
293
|
+
readonly locale?: 'en' | 'zh';
|
|
294
|
+
}) => void;
|
|
268
295
|
startCompacting?: () => void;
|
|
269
296
|
stopCompacting?: () => void;
|
|
270
297
|
/**
|
|
@@ -307,6 +334,7 @@ interface CommandResultData {
|
|
|
307
334
|
data?: unknown;
|
|
308
335
|
skillContent?: string;
|
|
309
336
|
invocation?: CommandInvocationRequest;
|
|
337
|
+
workflow?: CommandWorkflowInvocationRequest;
|
|
310
338
|
}
|
|
311
339
|
interface CommandInvocationRequest extends CommandExecutionMetadata {
|
|
312
340
|
prompt: string;
|
|
@@ -315,6 +343,11 @@ interface CommandInvocationRequest extends CommandExecutionMetadata {
|
|
|
315
343
|
path?: string;
|
|
316
344
|
skillInvocation?: KodaXSkillInvocationContext;
|
|
317
345
|
}
|
|
346
|
+
interface CommandWorkflowInvocationRequest {
|
|
347
|
+
request: string;
|
|
348
|
+
source: 'command' | 'natural-language';
|
|
349
|
+
displayName: string;
|
|
350
|
+
}
|
|
318
351
|
type CommandResult$1 = boolean | CommandResultData;
|
|
319
352
|
type CommandHandler = (args: string[], context: InteractiveContext, callbacks: CommandCallbacks, currentConfig: CurrentConfig) => Promise<CommandResult$1 | void>;
|
|
320
353
|
/**
|
|
@@ -358,6 +391,7 @@ declare function parseCommand(input: string): {
|
|
|
358
391
|
type CommandResult = boolean | {
|
|
359
392
|
skillContent?: string;
|
|
360
393
|
invocation?: CommandInvocationRequest;
|
|
394
|
+
workflow?: CommandWorkflowInvocationRequest;
|
|
361
395
|
};
|
|
362
396
|
declare function executeCommand(parsed: {
|
|
363
397
|
command: string;
|