@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,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as Vb,$a as Vc,$b as Vd,$c as Ve,$d as Wf,A as ub,Aa as uc,Ab as ud,Ac as ue,Ad as vf,B as vb,Ba as vc,Bb as vd,Bc as ve,Bd as wf,C as wb,Ca as wc,Cb as wd,Cc as we,Cd as xf,D as xb,Da as xc,Db as xd,Dc as xe,Dd as yf,E as yb,Ea as yc,Eb as yd,Ec as ye,Ed as zf,F as zb,Fa as zc,Fb as zd,Fc as ze,Fd as Af,G as Ab,Ga as Ac,Gb as Ad,Gc as Ae,Gd as Bf,H as Bb,Ha as Bc,Hb as Bd,Hc as Be,Hd as Cf,I as Cb,Ia as Cc,Ib as Cd,Ic as Ce,Id as Df,J as Db,Ja as Dc,Jb as Dd,Jc as De,Jd as Ef,K as Eb,Ka as Ec,Kb as Ed,Kc as Ee,Kd as Ff,L as Fb,La as Fc,Lb as Fd,Lc as Fe,Ld as Gf,M as Gb,Ma as Gc,Mb as Gd,Mc as Ge,Md as Hf,N as Hb,Na as Hc,Nb as Hd,Nc as He,Nd as If,O as Ib,Oa as Ic,Ob as Id,Oc as Ie,Od as Jf,P as Jb,Pa as Jc,Pb as Jd,Pc as Je,Pd as Kf,Q as Kb,Qa as Kc,Qb as Kd,Qc as Ke,Qd as Lf,R as Lb,Ra as Lc,Rb as Ld,Rc as Le,Rd as Mf,S as Mb,Sa as Mc,Sb as Md,Sc as Me,Sd as Nf,T as Nb,Ta as Nc,Tb as Nd,Tc as Ne,Td as Of,U as Ob,Ua as Oc,Ub as Od,Uc as Oe,Ud as Pf,V as Pb,Va as Pc,Vb as Pd,Vc as Pe,Vd as Qf,W as Qb,Wa as Qc,Wb as Qd,Wc as Qe,Wd as Rf,X as Rb,Xa as Rc,Xb as Rd,Xc as Re,Xd as Sf,Y as Sb,Ya as Sc,Yb as Sd,Yc as Se,Yd as Tf,Z as Tb,Za as Tc,Zb as Td,Zc as Te,Zd as Uf,_ as Ub,_a as Uc,_b as Ud,_c as Ue,_d as Vf,a as X,aa as Wb,ab as Wc,ac as Wd,ad as We,ae as Xf,b as Y,ba as Xb,bb as Xc,bc as Xd,bd as Xe,be as Yf,c as Z,ca as Yb,cb as Yc,cc as Yd,cd as Ye,ce as Zf,d as _,da as Zb,db as Zc,dc as Zd,dd as Ze,de as _f,e as $,ea as _b,eb as _c,ec as _d,ed as _e,ee as $f,f as $a,fa as $b,fb as $c,fc as $d,fd as $e,fe as ag,g as ab,ga as ac,gb as ad,gc as ae,gd as af,ge as bg,h as bb,ha as bc,hb as bd,hc as be,hd as bf,he as cg,i as cb,ia as cc,ib as cd,ic as ce,id as cf,ie as dg,j as db,ja as dc,jb as dd,jc as de,jd as df,k as eb,ka as ec,kb as ed,kc as ee,kd as ef,l as fb,la as fc,lb as fd,lc as fe,ld as ff,m as gb,ma as gc,mb as gd,mc as ge,md as gf,n as hb,na as hc,nb as hd,nc as he,nd as hf,o as ib,oa as ic,ob as id,oc as ie,od as jf,p as jb,pa as jc,pb as jd,pc as je,pd as kf,q as kb,qa as kc,qb as kd,qc as ke,qd as lf,r as lb,ra as lc,rb as ld,rc as le,rd as mf,s as mb,sa as mc,sb as md,sc as me,sd as nf,t as nb,ta as nc,tb as nd,tc as ne,td as of,u as ob,ua as oc,ub as od,uc as oe,ud as pf,v as pb,va as pc,vb as pd,vc as pe,vd as qf,w as qb,wa as qc,wb as qd,wc as qe,wd as rf,x as rb,xa as rc,xb as rd,xc as re,xd as sf,y as sb,ya as sc,yb as sd,yc as se,yd as tf,z as tb,za as tc,zb as td,zc as te,zd as uf}from"./chunk-VGRG2F6H.js";import{$ as y,C as k,K as l,L as m,Q as n,R as o,S as p,T as q,U as r,V as s,W as t,X as u,Y as v,Z as w,_ as x,a,aa as z,b,ba as A,c,ca as B,da as C,ea as D,fa as E,ga as F,ha as G,ia as H,j as d,ja as I,ka as J,la as K,ma as L,na as M,oa as N,pa as O,qa as P,ra as Q,sa as R,t as e,ta as S,u as f,ua as T,v as g,va as U,w as h,wa as V,x as i,xa as W,y as j}from"./chunk-66B6ZOU7.js";import{Ab as Ba,Bb as Ca,Bc as Ta,Cb as Da,Cc as Ua,Db as Ea,Dc as Va,Eb as Fa,Ec as Wa,Fb as Ga,Fc as Xa,Gc as Ya,Nc as Za,Oc as _a,a as aa,b as ba,c as ca,d as da,e as ea,f as fa,h as ga,hb as va,i as ha,ib as wa,ic as Ha,j as ia,jc as Ia,k as ja,ka as pa,kc as Ja,l as ka,lc as Ka,m as la,mc as La,n as ma,na as qa,o as na,p as oa,tc as Ma,ua as ra,uc as Na,va as sa,vc as Oa,wa as ta,wb as xa,wc as Pa,xa as ua,xb as ya,xc as Qa,yb as za,yc as Ra,zb as Aa,zc as Sa}from"./chunk-VX6HN3JP.js";import"./chunk-V4WSBIXB.js";export{Gf as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Hf as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,$f as BASH_POLICY_SPEC,Ye as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,Mf as BREAKER_ERROR_THRESHOLD,Nf as BREAKER_WINDOW_MS,ab as CANCELLED_TOOL_RESULT_MESSAGE,$a as CANCELLED_TOOL_RESULT_PREFIX,wf as CODING_AGENT_MARKER,Je as CODING_INVARIANTS,ye as CODING_SUMMARY_PROMPT,ze as CODING_UPDATE_SUMMARY_PROMPT,Nc as CapabilityDeniedError,Le as Client,Oc as ConstructionManifestError,Ae as DEFAULT_CODING_AGENT_NAME,lf as DEFAULT_DANGEROUS_PATTERNS,Lc as DEFAULT_HANDLER_TIMEOUT_MS,ae as DEFAULT_RESILIENCE_CONFIG,kf as DEFAULT_SAFE_PATTERNS,Yc as DEFAULT_SELF_MODIFY_BUDGET,Xf as DEFAULT_SPECULATIVE_WINDOW_MS,cb as DEFAULT_TOOL_OUTPUT_MAX_BYTES,bb as DEFAULT_TOOL_OUTPUT_MAX_LINES,oa as DefaultSummaryCompaction,tf as EMIT_VERDICT_TOOL_NAME,_ as ErrorCategory,rc as GENERATOR_AGENT_NAME,ha as KODAX_API_MIN_INTERVAL,p as KODAX_DEFAULT_PROVIDER,ba as KODAX_DEFAULT_TIMEOUT,ca as KODAX_HARD_TIMEOUT,fa as KODAX_MAX_INCOMPLETE_RETRIES,da as KODAX_MAX_RETRIES,aa as KODAX_MAX_TOKENS,o as KODAX_PROVIDERS,n as KODAX_PROVIDER_SNAPSHOTS,d as KODAX_REASONING_MODE_SEQUENCE,ea as KODAX_RETRY_BASE_DELAY,ga as KODAX_STAGGER_DELAY,vd as KODAX_TOOLS,l as KodaXAnthropicCompatProvider,k as KodaXBaseProvider,Le as KodaXClient,a as KodaXError,rd as KodaXExtensionRuntime,m as KodaXOpenAICompatProvider,b as KodaXProviderError,c as KodaXRateLimitError,Y as KodaXSessionError,Z as KodaXTerminalError,X as KodaXToolError,Ha as LINEAGE_ENTRY_TYPES,ue as LSP_SERVERS,Ja as LineageCompaction,Ia as LineageExtension,ve as LspService,mb as MANUAL_TOPIC_IDS,Ea as McpCapabilityProvider,Fa as McpManager,Da as McpServerRuntime,qc as PLANNER_AGENT_NAME,ia as PROMISE_PATTERN,Od as PROMPT_SECTION_REGISTRY,vf as PROTOCOL_EMITTER_TOOLS,fe as ProviderRecoveryCoordinator,db as READ_DEFAULT_LIMIT,fb as READ_MAX_LINE_CHARS,eb as READ_PREFLIGHT_SIZE_BYTES,Lb as REPOINTEL_DEFAULT_ENDPOINT,qa as Runner,pc as SCOUT_AGENT_NAME,Ud as SELF_KNOWLEDGE_ROUTING_RULE,Nd as SYSTEM_PROMPT,de as StableBoundaryTracker,uc as TASK_ENGINE_ROLE_AGENTS,Ue as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,cg as TRACING_ENV,sc as WORKER_AGENT_NAME,dd as _resetRuntimeForTesting,gd as activate,Cb as analyzeChangedScope,Wc as appendAuditEntry,Ra as appendSessionLineageLabel,Dc as applyAccountingDelta,Qe as applyFanoutBranchTransition,Sa as applySessionCompaction,bc as applyToolResultGuardrail,Ya as archiveOldIslands,Re as assignFanoutBranchWorker,Lf as autoModeDenialShouldFallback,Uf as bashSignalCollector,dg as bootstrapTracing,Fe as boundedRevise,Qf as breakerShouldFallback,Ge as budgetCeiling,oe as buildAmaControllerDecision,Gc as buildBlockedGoal,Vd as buildCapabilityContextSections,xf as buildClassifierPrompt,Hc as buildCompleteGoal,Cc as buildCreatedGoal,me as buildFallbackRoutingDecision,Ne as buildFanoutSchedulerPlan,af as buildGoalRuntimeBinding,Tc as buildLlmReviewPrompt,Ec as buildPausedGoal,Zd as buildPromptMessageContent,pe as buildPromptOverlay,Sd as buildPromptSnapshot,ge as buildProviderCapabilitySnapshot,ne as buildProviderPolicyHintsForDecision,he as buildProviderPolicyPromptNotes,g as buildReasoningOverrideKey,Bb as buildRepoIntelligenceContext,Qb as buildRepoIntelligenceIndex,yb as buildRepoOverview,Fc as buildResumedGoal,Td as buildSelfKnowledgeRoutingRule,Wa as buildSessionTree,Xd as buildSystemPrompt,Wd as buildSystemPromptSnapshot,Tf as checkAbsoluteDeny,Yd as checkIncompleteToolCalls,re as checkPromiseSignal,zf as classify,nf as classifyBashCommand,$ as classifyError,ce as classifyResilienceError,wa as cleanupIncompleteToolCalls,j as clearReasoningOverride,Q as clearRuntimeModelProviders,Wf as collectAllSignals,pf as computeInputSignature,Af as computeRulesFingerprint,cd as configureRuntime,fc as convertCapabilityReadResult,ec as convertProviderSearchResults,Pe as countActiveFanoutBranches,Xa as countActiveLineageMessages,ka as countTokens,la as createAgent,If as createAutoModeDenialTracker,_f as createAutoModeToolGuardrail,mf as createBashClassifierConfig,bg as createBashPrefixExtractor,Dd as createBuiltinToolDefinition,Of as createCircuitBreaker,Pc as createCtxProxy,C as createCustomProvider,Be as createDefaultCodingAgent,of as createDenialTracker,sd as createExtensionRuntime,Me as createFanoutSchedulerInput,ma as createHandoff,na as createInMemorySession,ff as createKodaXTaskRunner,ya as createMcpCapabilityId,Ga as createMcpManager,Ca as createMcpTransport,Pd as createPromptSection,qe as createReasoningPlan,De as createSessionControl,Ma as createSessionLineage,Ve as createToolResultTruncationGuardrail,xa as defaultMcpCacheDir,Mc as defaultPolicy,bd as disableSelfModify,pd as discoverMarkdownAgents,xc as drainPendingSwaps,uf as emitVerdict,ja as estimateTokens,ie as evaluateProviderPolicy,Jc as exec,Md as executeTool,Za as extractArtifactLedger,ag as extractCommandPrefix,$d as extractComparableUserMessageText,dc as extractHtmlTitle,_d as extractPromptComparableText,La as extractTitleFromMessages,Vf as fileSignalCollector,hc as finalizeRetrievalResult,md as findByVersion,Ta as findPreviousUserEntryId,Va as forkSessionLineage,oc as formatAgentsForPrompt,hf as formatParallelDispatchResult,gb as formatSize,Ka as generateSessionId,ud as getActiveExtensionRuntime,sa as getAgentConfigHome,ta as getAgentConfigPath,Fd as getAllRegisteredTools,ua as getAppDataDir,T as getAvailableProviderNames,Cd as getBuiltinRegisteredToolDefinition,Bd as getBuiltinToolDefinition,K as getCustomModelCapabilities,E as getCustomProvider,H as getCustomProviderList,J as getCustomProviderModelDescriptors,I as getCustomProviderModels,G as getCustomProviderNames,we as getDefaultLspService,sf as getDenialContext,Oe as getFanoutBranch,Vb as getImpactEstimate,mc as getKodaxGlobalDir,Ba as getMcpCachePaths,z as getModelCapabilities,Sb as getModuleContext,Ub as getProcessContext,q as getProvider,u as getProviderConfiguredCapabilityProfile,t as getProviderConfiguredReasoningCapability,v as getProviderList,s as getProviderModel,y as getProviderModelDescriptors,w as getProviderModels,zd as getRegisteredToolDefinition,Rb as getRepoIntelligenceIndex,zb as getRepoOverview,Wb as getRepoRoutingSignals,Jd as getRequiredToolParams,N as getRuntimeModelProvider,P as getRuntimeModelProviderNames,Na as getSessionLineagePath,Oa as getSessionMessagesFromLineage,Tb as getSymbolContext,xd as getTool,yd as getToolDefinition,Ad as getToolRegistrations,ac as getToolResultPolicy,zc as goalTokenDelta,wc as hasPendingSwap,le as inferTaskType,rb as inspectEditFailure,Ob as inspectRepoIntelligenceRuntime,F as isCustomProviderName,rf as isDeniedRecently,S as isKnownProvider,gf as isParallelDispatchDirective,r as isProviderConfigured,x as isProviderName,O as isRuntimeModelProviderName,Hd as isToolFileMutation,Id as isToolMutation,Gd as isToolPlanModeAllowed,Ic as isValidTokenBudget,se as languageIdForPath,nd as listAll,W as listAllModelCapabilities,jd as listArtifacts,A as listBuiltinModelCapabilities,Ed as listBuiltinToolDefinitions,ld as listConstructed,L as listCustomProviderModelCapabilities,Ld as listToolDefinitions,Kd as listTools,nc as loadAgentsFiles,od as loadAgentsFromMarkdown,Ef as loadAutoRules,Qc as loadHandler,h as loadReasoningOverride,yc as makeDisabledGoalToolsContext,Te as markFanoutBranchCancelled,Se as markFanoutBranchCompleted,_a as mergeArtifactLedger,Qd as orderPromptSections,Df as parseAutoRules,yf as parseClassifierOutput,qb as parseEditToolError,Uc as parseLlmReviewVerdict,za as parseMcpCapabilityId,Rf as parseModelSpec,kb as persistToolOutput,Xb as prewarmRepoIntelligenceCaches,kd as readArtifact,Xc as readAuditEntries,Zc as readBudget,ad as readDisableState,Yf as readSpeculativeWindowFromEnv,Bf as readTrustState,e as reasoningCapabilityToOverride,ke as reasoningModeToDepth,f as reasoningOverrideToCapability,ee as reconstructMessagesWithToolGuard,Kf as recordAutoModeAllow,Jf as recordAutoModeBlock,We as recordBlockerAttempt,Pf as recordBreakerError,qf as recordDenial,Ke as registerCodingInvariants,cf as registerConfiguredMcpCapabilityProvider,D as registerCustomProviders,M as registerModelProvider,df as registerOfficialSandboxExtension,pa as registerPresetDispatcher,wd as registerTool,hd as rehydrateActiveArtifacts,_c as remainingSelfModifyBudget,Db as renderChangedScope,Kb as renderImpactEstimate,Hb as renderModuleContext,Jb as renderProcessContext,Rd as renderPromptSections,Ab as renderRepoOverview,gc as renderRetrievalResult,Ib as renderSymbolContext,te as reportLspDiagnostics,Xe as resetBlockerCounter,$c as resetBudget,Sf as resolveClassifierModel,vc as resolveConstructedAgent,nb as resolveKodaXManual,V as resolveModelCapabilities,R as resolveProvider,U as resolveProviderModelDescriptors,je as resolveReasoningMode,Nb as resolveRepoIntelligenceMode,Mb as resolveRepoIntelligenceRuntimeConfig,be as resolveResilienceConfig,Pa as resolveSessionLineageTarget,He as resolveToolCapability,id as revoke,Ua as rewindSessionLineage,qd as rollbackSelfModify,Rc as runAstRules,Ce as runKodaX,Vc as runLlmReview,bf as runManagedTask,ef as runOrchestration,i as saveReasoningOverride,Aa as searchMcpCatalog,td as setActiveExtensionRuntime,ra as setAgentConfigHome,Qa as setSessionLineageActiveEntry,Bc as shouldFlipBudgetLimited,xe as shutdownDefaultLspService,Zf as speculativeRace,ed as stage,Ee as startKodaX,Ff as stripAssistantText,cc as stripHtmlToText,fd as testArtifact,xb as toolAskUserQuestion,tb as toolBash,Gb as toolChangedDiff,Fb as toolChangedScope,kc as toolCodeSearch,pb as toolEdit,ub as toolGlob,vb as toolGrep,$b as toolImpactEstimate,sb as toolInsertAfterAnchor,Yb as toolModuleContext,Ie as toolPermission,_b as toolProcessContext,lb as toolRead,Eb as toolRepoOverview,lc as toolSemanticLookup,Zb as toolSymbolContext,wb as toolUndo,jc as toolWebFetch,ic as toolWebSearch,ob as toolWrite,hb as truncateHead,jb as truncateLine,ib as truncateTail,Cf as trustProjectRules,Ac as turnWallTimeDelta,va as validateAndFixToolHistory,B as validateCustomProviderConfig,jf as validateSubtaskIndependence,Sc as validateToolSchemaForProvider,$e as verifyGoalCompletion,Pb as warmRepoIntelligenceRuntime,Kc as webhook,Ze as withGoalBeforeNextTurn,_e as withGoalStopHook,tc as workerAgent};
|
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { a as McpServerConfig, b as McpServersConfig, M as McpConnectMode } from './config.d-BfJUXxC0.js';
|
|
2
|
-
import { a as CapabilityProvider, C as CapabilityKind, b as CapabilityResult } from './capability.d-3C62G8Eq.js';
|
|
3
|
-
|
|
4
|
-
type McpCapabilityKind = 'tool' | 'resource' | 'prompt';
|
|
5
|
-
type McpCapabilityRisk = 'read' | 'write' | 'network' | 'exec';
|
|
6
|
-
/** Per-tool task-augmentation support (2025-11-25 `execution.taskSupport`). */
|
|
7
|
-
type McpToolTaskSupport = 'forbidden' | 'optional' | 'required';
|
|
8
|
-
/** Icon metadata (2025-11-25) attached to tools / resources / prompts. */
|
|
9
|
-
interface McpIcon {
|
|
10
|
-
src: string;
|
|
11
|
-
mimeType?: string;
|
|
12
|
-
sizes?: string[];
|
|
13
|
-
theme?: 'light' | 'dark';
|
|
14
|
-
}
|
|
15
|
-
interface McpCatalogItem {
|
|
16
|
-
id: string;
|
|
17
|
-
serverId: string;
|
|
18
|
-
kind: McpCapabilityKind;
|
|
19
|
-
name: string;
|
|
20
|
-
title?: string;
|
|
21
|
-
summary: string;
|
|
22
|
-
tags?: string[];
|
|
23
|
-
risk?: McpCapabilityRisk;
|
|
24
|
-
annotations?: Record<string, unknown>;
|
|
25
|
-
cachedAt: string;
|
|
26
|
-
}
|
|
27
|
-
interface McpCapabilityDescriptor extends McpCatalogItem {
|
|
28
|
-
inputSchema?: unknown;
|
|
29
|
-
outputSchema?: unknown;
|
|
30
|
-
promptArgsSchema?: unknown;
|
|
31
|
-
uri?: string;
|
|
32
|
-
mimeType?: string;
|
|
33
|
-
/** Sanitized icon metadata (unsafe-scheme icons dropped). */
|
|
34
|
-
icons?: McpIcon[];
|
|
35
|
-
/** Tool only — `execution.taskSupport`. Absent is treated as 'forbidden'. */
|
|
36
|
-
taskSupport?: McpToolTaskSupport;
|
|
37
|
-
}
|
|
38
|
-
interface McpServerCatalogSnapshot {
|
|
39
|
-
serverId: string;
|
|
40
|
-
items: McpCatalogItem[];
|
|
41
|
-
descriptors: McpCapabilityDescriptor[];
|
|
42
|
-
updatedAt: string;
|
|
43
|
-
}
|
|
44
|
-
interface McpCatalogSearchOptions {
|
|
45
|
-
kind?: McpCapabilityKind;
|
|
46
|
-
limit?: number;
|
|
47
|
-
}
|
|
48
|
-
declare function defaultMcpCacheDir(): string;
|
|
49
|
-
declare function createMcpCapabilityId(serverId: string, kind: McpCapabilityKind, name: string): string;
|
|
50
|
-
declare function parseMcpCapabilityId(id: string): {
|
|
51
|
-
serverId: string;
|
|
52
|
-
kind: McpCapabilityKind;
|
|
53
|
-
name: string;
|
|
54
|
-
};
|
|
55
|
-
declare function searchMcpCatalog(items: readonly McpCatalogItem[], query: string, options?: McpCatalogSearchOptions): McpCatalogItem[];
|
|
56
|
-
declare function getMcpCachePaths(cacheDir: string, serverId: string): {
|
|
57
|
-
catalogDir: string;
|
|
58
|
-
indexPath: string;
|
|
59
|
-
itemsPath: string;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
interface McpServerRuntimeDiagnostics {
|
|
63
|
-
serverId: string;
|
|
64
|
-
connect: 'lazy' | 'prewarm' | 'disabled';
|
|
65
|
-
status: 'idle' | 'connecting' | 'ready' | 'error' | 'disabled';
|
|
66
|
-
dirty: boolean;
|
|
67
|
-
lastError?: string;
|
|
68
|
-
cachedAt?: string;
|
|
69
|
-
tools: number;
|
|
70
|
-
resources: number;
|
|
71
|
-
prompts: number;
|
|
72
|
-
}
|
|
73
|
-
declare class McpServerRuntime {
|
|
74
|
-
private readonly serverId;
|
|
75
|
-
private readonly config;
|
|
76
|
-
private readonly cacheDir;
|
|
77
|
-
private transport?;
|
|
78
|
-
private readonly pending;
|
|
79
|
-
private nextRequestId;
|
|
80
|
-
private initialized;
|
|
81
|
-
private connectPromise?;
|
|
82
|
-
private catalog?;
|
|
83
|
-
private diagnostics;
|
|
84
|
-
constructor(serverId: string, config: McpServerConfig, cacheDir: string);
|
|
85
|
-
getDiagnostics(): McpServerRuntimeDiagnostics;
|
|
86
|
-
prewarmIfNeeded(): Promise<void>;
|
|
87
|
-
/** Load catalog from memory or disk only — never triggers a lazy connection. */
|
|
88
|
-
getCachedCatalog(): Promise<McpServerCatalogSnapshot | undefined>;
|
|
89
|
-
getCatalog(forceRefresh?: boolean): Promise<McpServerCatalogSnapshot>;
|
|
90
|
-
describeCapability(capabilityId: string): Promise<McpCapabilityDescriptor | undefined>;
|
|
91
|
-
callTool(name: string, args: Record<string, unknown>): Promise<{
|
|
92
|
-
content?: string;
|
|
93
|
-
structuredContent?: unknown;
|
|
94
|
-
metadata?: Record<string, unknown>;
|
|
95
|
-
}>;
|
|
96
|
-
readResource(name: string, options: Record<string, unknown>): Promise<{
|
|
97
|
-
content?: string;
|
|
98
|
-
structuredContent?: unknown;
|
|
99
|
-
metadata?: Record<string, unknown>;
|
|
100
|
-
}>;
|
|
101
|
-
getPrompt(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
102
|
-
refreshCatalog(forceReconnect?: boolean): Promise<void>;
|
|
103
|
-
/** Public teardown — clears everything including the connect lock. */
|
|
104
|
-
dispose(): Promise<void>;
|
|
105
|
-
/** Internal transport teardown — does NOT clear connectPromise so the
|
|
106
|
-
* retry loop inside doConnect() can safely call it between attempts. */
|
|
107
|
-
private resetTransport;
|
|
108
|
-
private connect;
|
|
109
|
-
private doConnect;
|
|
110
|
-
private listDescriptors;
|
|
111
|
-
private request;
|
|
112
|
-
private sendRequest;
|
|
113
|
-
private notify;
|
|
114
|
-
private handleMessage;
|
|
115
|
-
private failPending;
|
|
116
|
-
private applyCatalogSnapshot;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* `McpCapabilityProvider` — implements the Layer A `CapabilityProvider`
|
|
121
|
-
* contract for an MCP server fleet.
|
|
122
|
-
*
|
|
123
|
-
* FEATURE_082 (v0.7.24): moved from
|
|
124
|
-
* `@kodax-ai/coding/src/capabilities/providers/mcp/provider.ts` to this package.
|
|
125
|
-
* The coding-specific `registerConfiguredMcpCapabilityProvider` adapter (which
|
|
126
|
-
* pulls in `KodaXExtensionRuntime`) lives in
|
|
127
|
-
* `@kodax-ai/coding/src/capabilities/providers/mcp-adapter.ts`.
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
interface McpProviderOptions {
|
|
131
|
-
cacheDir?: string;
|
|
132
|
-
}
|
|
133
|
-
declare class McpCapabilityProvider implements CapabilityProvider {
|
|
134
|
-
readonly id = "mcp";
|
|
135
|
-
readonly kinds: CapabilityProvider['kinds'];
|
|
136
|
-
private readonly runtimes;
|
|
137
|
-
private readonly cacheDir;
|
|
138
|
-
/**
|
|
139
|
-
* Construct an MCP capability provider.
|
|
140
|
-
*
|
|
141
|
-
* **Cache-dir capture warning (v0.7.35.1 FEATURE_145)** — when
|
|
142
|
-
* `options.cacheDir` is omitted, this constructor resolves
|
|
143
|
-
* `defaultMcpCacheDir()` ONCE at instantiation time and threads the
|
|
144
|
-
* result into every `McpServerRuntime` it spawns. If a substrate
|
|
145
|
-
* consumer plans to redirect the agent config home via
|
|
146
|
-
* `setAgentConfigHome()` from `@kodax-ai/agent`, that call MUST happen
|
|
147
|
-
* BEFORE constructing this provider. Late calls have no effect on
|
|
148
|
-
* already-constructed runtimes.
|
|
149
|
-
*
|
|
150
|
-
* To bypass the agent-home resolver entirely, pass
|
|
151
|
-
* `options.cacheDir` explicitly — that path wins unconditionally.
|
|
152
|
-
*/
|
|
153
|
-
constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
|
|
154
|
-
hasActiveServers(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* v0.7.42 — read-only accessor for the enabled server id list.
|
|
157
|
-
* Used by {@link McpManager} to drive popout-shape `listServers /
|
|
158
|
-
* startServer / stopServer / logs / tools` operations without
|
|
159
|
-
* exposing the internal runtimes Map.
|
|
160
|
-
*/
|
|
161
|
-
getServerIds(): readonly string[];
|
|
162
|
-
/**
|
|
163
|
-
* v0.7.42 — single-server runtime accessor. Returns `undefined`
|
|
164
|
-
* for unknown / disabled servers. Use {@link McpManager} for
|
|
165
|
-
* higher-level lifecycle control.
|
|
166
|
-
*/
|
|
167
|
-
getRuntime(serverId: string): McpServerRuntime | undefined;
|
|
168
|
-
prewarm(): Promise<void>;
|
|
169
|
-
search(query: string, options?: {
|
|
170
|
-
kind?: CapabilityKind;
|
|
171
|
-
limit?: number;
|
|
172
|
-
server?: string;
|
|
173
|
-
}): Promise<unknown[]>;
|
|
174
|
-
describe(id: string): Promise<unknown>;
|
|
175
|
-
execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
176
|
-
read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
177
|
-
getPrompt(id: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
178
|
-
getPromptContext(): Promise<string | undefined>;
|
|
179
|
-
getDiagnostics(): Record<string, unknown> | undefined;
|
|
180
|
-
refresh(): Promise<void>;
|
|
181
|
-
dispose(): Promise<void>;
|
|
182
|
-
private collectCatalogItems;
|
|
183
|
-
private listServerDiagnostics;
|
|
184
|
-
private requireRuntime;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
interface McpTransportEvents {
|
|
188
|
-
/** Called with a complete JSON-RPC message (raw JSON string). */
|
|
189
|
-
onMessage(raw: string): void;
|
|
190
|
-
onError(error: Error): void;
|
|
191
|
-
onClose(reason: string): void;
|
|
192
|
-
}
|
|
193
|
-
interface McpTransport {
|
|
194
|
-
open(events: McpTransportEvents): Promise<void>;
|
|
195
|
-
/** Send a JSON string. The transport handles framing. */
|
|
196
|
-
send(json: string): Promise<void>;
|
|
197
|
-
setProtocolVersion?(version: string | undefined): void;
|
|
198
|
-
close(): Promise<void>;
|
|
199
|
-
readonly connected: boolean;
|
|
200
|
-
}
|
|
201
|
-
type StdioFraming = 'content-length' | 'ndjson';
|
|
202
|
-
interface McpTransportOptions {
|
|
203
|
-
stdioFraming?: StdioFraming;
|
|
204
|
-
}
|
|
205
|
-
declare function createMcpTransport(config: McpServerConfig, options?: McpTransportOptions): McpTransport;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* McpManager — v0.7.42 (extends FEATURE_186 MCP popout surface).
|
|
209
|
-
*
|
|
210
|
-
* `McpCapabilityProvider` (`./provider.ts`) is the capability-provider-
|
|
211
|
-
* shaped object KodaX uses internally to plug MCP into the agent runtime
|
|
212
|
-
* — its public methods are `search` / `describe` / `execute` / `read` /
|
|
213
|
-
* `getPrompt` / `getDiagnostics` / `refresh` / `dispose`, which is the
|
|
214
|
-
* shape the substrate consumes but NOT the shape a popout UI wants.
|
|
215
|
-
*
|
|
216
|
-
* KodaX Space reported that `@kodax-ai/kodax/mcp` only exposed "types +
|
|
217
|
-
* helpers, no manager-shape API" — concretely they wanted a thin
|
|
218
|
-
* `listServers / startServer / stopServer / getServerLogs / listTools`
|
|
219
|
-
* surface to drive a popout panel:
|
|
220
|
-
*
|
|
221
|
-
* - One row per configured MCP server with live status
|
|
222
|
-
* - "Start" / "Stop" buttons that map to refreshCatalog(true) / dispose
|
|
223
|
-
* - Server logs (last error + status) so users can debug failures
|
|
224
|
-
* - Per-server tool list (filtered descriptors) for the "what does
|
|
225
|
-
* this MCP server expose" pane
|
|
226
|
-
*
|
|
227
|
-
* `McpManager` is the thin wrapper. It owns one `McpCapabilityProvider`
|
|
228
|
-
* instance internally, so all the existing lifecycle invariants
|
|
229
|
-
* (cache-dir capture, refresh, dispose, server-config validation) are
|
|
230
|
-
* preserved verbatim. The capability-provider-shaped methods stay
|
|
231
|
-
* available via `manager.provider()` as an escape hatch.
|
|
232
|
-
*
|
|
233
|
-
* Trust boundary: same as the rest of FEATURE_186 — KodaX is a
|
|
234
|
-
* single-user CLI, last-write-wins on the server-config-vs-active-
|
|
235
|
-
* runtime path; a Space popout that swaps configs hot would still need
|
|
236
|
-
* to construct a fresh `McpManager` (or call `dispose()` then
|
|
237
|
-
* `createMcpManager` again) to pick up the new wire.
|
|
238
|
-
*/
|
|
239
|
-
|
|
240
|
-
interface McpServerStatus {
|
|
241
|
-
readonly serverId: string;
|
|
242
|
-
readonly config: McpServerConfig;
|
|
243
|
-
readonly connect: McpConnectMode;
|
|
244
|
-
readonly status: McpServerRuntimeDiagnostics['status'];
|
|
245
|
-
readonly tools: number;
|
|
246
|
-
readonly resources: number;
|
|
247
|
-
readonly prompts: number;
|
|
248
|
-
readonly dirty: boolean;
|
|
249
|
-
readonly cachedAt?: string;
|
|
250
|
-
readonly lastError?: string;
|
|
251
|
-
}
|
|
252
|
-
interface McpServerLogs {
|
|
253
|
-
readonly serverId: string;
|
|
254
|
-
readonly status: McpServerRuntimeDiagnostics['status'];
|
|
255
|
-
readonly connect: McpConnectMode;
|
|
256
|
-
readonly lastError?: string;
|
|
257
|
-
readonly cachedAt?: string;
|
|
258
|
-
}
|
|
259
|
-
interface McpServerToolList {
|
|
260
|
-
readonly serverId: string;
|
|
261
|
-
readonly tools: readonly McpCapabilityDescriptor[];
|
|
262
|
-
readonly cachedAt?: string;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Full catalog snapshot for a server — tools + resources + prompts.
|
|
266
|
-
* Use {@link McpManager.getCatalog} when the popout needs to render
|
|
267
|
-
* all three capability kinds (not just tools).
|
|
268
|
-
*
|
|
269
|
-
* `cachedAt` matches the naming used by {@link McpServerStatus},
|
|
270
|
-
* {@link McpServerLogs}, and {@link McpServerToolList} for consistency
|
|
271
|
-
* across the manager surface (all are renames of the underlying
|
|
272
|
-
* `McpServerCatalogSnapshot.updatedAt` field).
|
|
273
|
-
*/
|
|
274
|
-
interface McpServerCatalog {
|
|
275
|
-
readonly serverId: string;
|
|
276
|
-
readonly items: readonly McpCatalogItem[];
|
|
277
|
-
readonly descriptors: readonly McpCapabilityDescriptor[];
|
|
278
|
-
readonly cachedAt: string;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Manager-shape facade over {@link McpCapabilityProvider}. Construct
|
|
282
|
-
* via the {@link createMcpManager} factory or `new McpManager(...)`
|
|
283
|
-
* directly.
|
|
284
|
-
*/
|
|
285
|
-
declare class McpManager {
|
|
286
|
-
private readonly capabilityProvider;
|
|
287
|
-
private readonly serversConfig;
|
|
288
|
-
constructor(servers: McpServersConfig | undefined, options?: McpProviderOptions);
|
|
289
|
-
/**
|
|
290
|
-
* Escape hatch — returns the underlying {@link McpCapabilityProvider}
|
|
291
|
-
* for callers that need the search / describe / execute / read /
|
|
292
|
-
* getPrompt API (e.g. embedding into a custom agent runtime).
|
|
293
|
-
*/
|
|
294
|
-
provider(): McpCapabilityProvider;
|
|
295
|
-
/**
|
|
296
|
-
* One status row per configured server (lazy / prewarm / disabled
|
|
297
|
-
* all included). Returned objects are plain readonly snapshots —
|
|
298
|
-
* mutating them does NOT affect runtime state.
|
|
299
|
-
*/
|
|
300
|
-
listServers(): McpServerStatus[];
|
|
301
|
-
/**
|
|
302
|
-
* Force a connection + catalog refresh for `serverId`. Returns the
|
|
303
|
-
* post-start status row. Throws if `serverId` is not configured.
|
|
304
|
-
*
|
|
305
|
-
* For lazy servers, this is the explicit "connect now" trigger —
|
|
306
|
-
* useful when a popout user clicks "Start" before any tool call has
|
|
307
|
-
* forced the lazy connection.
|
|
308
|
-
*/
|
|
309
|
-
startServer(serverId: string): Promise<McpServerStatus>;
|
|
310
|
-
/**
|
|
311
|
-
* Disconnect `serverId` — closes the transport, drops the pending
|
|
312
|
-
* request queue, but keeps the server in the config so a subsequent
|
|
313
|
-
* `startServer` / `listTools` can reconnect. Returns the post-stop
|
|
314
|
-
* status (`status: 'idle'`).
|
|
315
|
-
*/
|
|
316
|
-
stopServer(serverId: string): Promise<McpServerStatus>;
|
|
317
|
-
/**
|
|
318
|
-
* Return the most recent runtime diagnostic envelope for `serverId`
|
|
319
|
-
* — status, last error, last cached timestamp. Designed as the data
|
|
320
|
-
* source for a popout "Logs" pane.
|
|
321
|
-
*
|
|
322
|
-
* Logs API is intentionally conservative in v0.7.42: only the last
|
|
323
|
-
* error message + status are exposed. A future iteration may add a
|
|
324
|
-
* ring buffer of recent events; the field shape will extend (add
|
|
325
|
-
* fields), never break (rename / remove).
|
|
326
|
-
*/
|
|
327
|
-
getServerLogs(serverId: string): McpServerLogs;
|
|
328
|
-
/**
|
|
329
|
-
* Return the tool descriptors for `serverId`. Triggers a lazy
|
|
330
|
-
* connect + catalog fetch if the catalog has not yet been built;
|
|
331
|
-
* pass `{ forceRefresh: true }` to force a fresh catalog regardless
|
|
332
|
-
* of cache state.
|
|
333
|
-
*
|
|
334
|
-
* Only `kind === 'tool'` descriptors are returned (filters out
|
|
335
|
-
* resources + prompts so popout consumers can render a clean
|
|
336
|
-
* "tools" table). Use the underlying `provider().describe(id)` for
|
|
337
|
-
* full descriptor introspection including resources + prompts.
|
|
338
|
-
*/
|
|
339
|
-
listTools(serverId: string, options?: {
|
|
340
|
-
forceRefresh?: boolean;
|
|
341
|
-
}): Promise<McpServerToolList>;
|
|
342
|
-
/**
|
|
343
|
-
* Return the full catalog snapshot for `serverId` — every tool,
|
|
344
|
-
* resource, and prompt the server exposes — plus lightweight catalog
|
|
345
|
-
* items for menu rendering. `listTools` is the tools-only fast path;
|
|
346
|
-
* use this when the popout needs to render resources / prompts panes
|
|
347
|
-
* alongside tools.
|
|
348
|
-
*
|
|
349
|
-
* Triggers a lazy connect + catalog fetch if the catalog has not yet
|
|
350
|
-
* been built; pass `{ forceRefresh: true }` to force a fresh catalog
|
|
351
|
-
* regardless of cache state.
|
|
352
|
-
*/
|
|
353
|
-
getCatalog(serverId: string, options?: {
|
|
354
|
-
forceRefresh?: boolean;
|
|
355
|
-
}): Promise<McpServerCatalog>;
|
|
356
|
-
/**
|
|
357
|
-
* Dispose all runtimes. After calling, the manager is no longer
|
|
358
|
-
* usable for `startServer` / `listTools` (they would reconnect, but
|
|
359
|
-
* the consumer should construct a fresh manager instead).
|
|
360
|
-
*/
|
|
361
|
-
dispose(): Promise<void>;
|
|
362
|
-
/** v0.7.42 — escape hatch for advanced uses; usually consumers use the typed methods above. */
|
|
363
|
-
search(query: string, options?: {
|
|
364
|
-
kind?: CapabilityKind;
|
|
365
|
-
limit?: number;
|
|
366
|
-
server?: string;
|
|
367
|
-
}): Promise<readonly McpCatalogItem[]>;
|
|
368
|
-
/** v0.7.42 — escape hatch for advanced uses; usually consumers use {@link listTools}. */
|
|
369
|
-
describe(id: string): Promise<McpCapabilityDescriptor | undefined>;
|
|
370
|
-
/** v0.7.42 — invoke a tool by capability id (`mcp://<serverId>/<kind>/<name>`). */
|
|
371
|
-
execute(id: string, input: Record<string, unknown>): Promise<CapabilityResult>;
|
|
372
|
-
/** v0.7.42 — read a resource by capability id. */
|
|
373
|
-
read(id: string, options?: Record<string, unknown>): Promise<CapabilityResult>;
|
|
374
|
-
private requireRuntime;
|
|
375
|
-
private buildStatus;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Convenience factory matching the rest of the FEATURE_186 surface
|
|
379
|
-
* naming (`createSessionControl`, etc.). Equivalent to
|
|
380
|
-
* `new McpManager(servers, options)`.
|
|
381
|
-
*/
|
|
382
|
-
declare function createMcpManager(servers: McpServersConfig | undefined, options?: McpProviderOptions): McpManager;
|
|
383
|
-
|
|
384
|
-
export { McpCapabilityProvider as b, McpManager as e, McpServerRuntime as j, createMcpCapabilityId as p, createMcpManager as q, createMcpTransport as r, defaultMcpCacheDir as s, getMcpCachePaths as t, parseMcpCapabilityId as u, searchMcpCatalog as v };
|
|
385
|
-
export type { McpCapabilityDescriptor as M, McpCapabilityKind as a, McpCapabilityRisk as c, McpCatalogItem as d, McpProviderOptions as f, McpServerCatalog as g, McpServerCatalogSnapshot as h, McpServerLogs as i, McpServerRuntimeDiagnostics as k, McpServerStatus as l, McpServerToolList as m, McpTransport as n, McpTransportEvents as o };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @kodax-ai/agent/messaging — Message queue types
|
|
3
|
-
*
|
|
4
|
-
* FEATURE_115 (v0.7.36): agentId-scoped 2-tier priority queue infrastructure.
|
|
5
|
-
*
|
|
6
|
-
* Per ADR-021: messaging is a generic agent-platform primitive (not coding-
|
|
7
|
-
* specific). Downstream consumers:
|
|
8
|
-
* - @kodax-ai/coding runner-driven mid-turn drain
|
|
9
|
-
* - @kodax-ai/repl InkREPL ESC soft-pause + text injection (FEATURE_111 absorbed)
|
|
10
|
-
* - subagent task-notification routing (FEATURE_155 idle-yield wakeup)
|
|
11
|
-
*
|
|
12
|
-
* Phase 0.6 study (`c:/tmp/claude-code-actual-usage.md`): Claude Code's
|
|
13
|
-
* `'now'` priority has zero production usage; KodaX simplifies to 2 tiers.
|
|
14
|
-
*/
|
|
15
|
-
type MessagePriority = 'user' | 'background';
|
|
16
|
-
type MessageMode = 'prompt' | 'task-notification' | 'system-reminder';
|
|
17
|
-
interface QueuedMessage {
|
|
18
|
-
/** Stable id for tracing / dedup. Format: `msg-<sequence>`. */
|
|
19
|
-
readonly id: string;
|
|
20
|
-
readonly priority: MessagePriority;
|
|
21
|
-
/**
|
|
22
|
-
* Routing key:
|
|
23
|
-
* undefined = main thread / coordinator agent
|
|
24
|
-
* 'agent-id-XYZ' = subagent / specific consumer
|
|
25
|
-
*
|
|
26
|
-
* Drain consumers MUST filter by agentId match — undefined matches only
|
|
27
|
-
* undefined-agentId messages, not "any agent".
|
|
28
|
-
*/
|
|
29
|
-
readonly agentId?: string;
|
|
30
|
-
readonly mode: MessageMode;
|
|
31
|
-
readonly content: string;
|
|
32
|
-
/** Wall-clock timestamp (`Date.now()`) for tracing only — not used for ordering. */
|
|
33
|
-
readonly enqueuedAt: number;
|
|
34
|
-
}
|
|
35
|
-
interface DequeueFilter {
|
|
36
|
-
/**
|
|
37
|
-
* Only return messages with this agentId.
|
|
38
|
-
* undefined matches messages with no agentId (main-thread messages only).
|
|
39
|
-
*/
|
|
40
|
-
readonly agentId?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Highest priority level included in the drain.
|
|
43
|
-
* 'user' → only user priority drained, background stays queued
|
|
44
|
-
* 'background' → both user + background drained (Sleep-gated case)
|
|
45
|
-
*/
|
|
46
|
-
readonly maxPriority: MessagePriority;
|
|
47
|
-
/**
|
|
48
|
-
* Optional cap on number of messages drained in this call.
|
|
49
|
-
* Defaults to unlimited (drains all matching).
|
|
50
|
-
*/
|
|
51
|
-
readonly limit?: number;
|
|
52
|
-
/**
|
|
53
|
-
* FEATURE_159 (v0.7.40) — optional mode filter. Lets REPL split the
|
|
54
|
-
* single queue into mode-typed views (e.g. `mode:'prompt'` for user
|
|
55
|
-
* input vs `mode:'task-notification'` for child completion banners)
|
|
56
|
-
* without separate queues. When omitted, all modes match.
|
|
57
|
-
*/
|
|
58
|
-
readonly mode?: MessageMode;
|
|
59
|
-
/**
|
|
60
|
-
* FEATURE_159 (v0.7.40) — optional precise-id filter. Single-message
|
|
61
|
-
* targeted removal — drives Esc-pop-this-uuid in REPL. When set, all
|
|
62
|
-
* other filters still apply (agentId / priority / mode mismatches still
|
|
63
|
-
* skip the message), so callers can't accidentally remove a message
|
|
64
|
-
* outside their scope.
|
|
65
|
-
*/
|
|
66
|
-
readonly id?: string;
|
|
67
|
-
/**
|
|
68
|
-
* FEATURE_159 (v0.7.40) — optional escape-hatch predicate, AND-ed with
|
|
69
|
-
* the structured filters. Lets SDK consumers express conditions the
|
|
70
|
-
* typed fields don't cover (e.g. timestamp ranges, content-match) without
|
|
71
|
-
* forcing every new use case to extend `DequeueFilter`. KodaX-internal
|
|
72
|
-
* code should prefer the typed fields for readability; this is the
|
|
73
|
-
* "data-driven main path + predicate escape" pattern.
|
|
74
|
-
*
|
|
75
|
-
* Evaluated AFTER the typed filters succeed — so a `predicate` that
|
|
76
|
-
* inspects `message.content` never runs on messages outside the
|
|
77
|
-
* caller's `agentId` / `mode` / `id` scope.
|
|
78
|
-
*/
|
|
79
|
-
readonly predicate?: (message: QueuedMessage) => boolean;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* FEATURE_159 (v0.7.40) — structured queue event emitted to subscribers.
|
|
83
|
-
*
|
|
84
|
-
* Replaces the prior `() => void` bare-notify signal. Carries the kind +
|
|
85
|
-
* affected messages so SDK observability consumers (logging, tracing,
|
|
86
|
-
* metrics) can react per-event without re-diffing snapshots.
|
|
87
|
-
*
|
|
88
|
-
* Event granularity rules:
|
|
89
|
-
* - `enqueued` fires ONCE per `enqueue()` call (always 1 message).
|
|
90
|
-
* - `dequeued` fires ONCE per `dequeue()` call that removed ≥1 message,
|
|
91
|
-
* carrying ALL drained messages in priority+FIFO order. No-op drains
|
|
92
|
-
* (filter matched nothing) fire no event — quiet by design so the
|
|
93
|
-
* `waitForWakeEvent` 100ms poll doesn't spam idle subscribers.
|
|
94
|
-
* - `cleared` fires ONCE per `clear()` call that removed ≥1 message,
|
|
95
|
-
* carrying the pre-clear messages. Empty-queue clear fires nothing.
|
|
96
|
-
*
|
|
97
|
-
* The `useSyncExternalStore` React hook ignores the event payload (it
|
|
98
|
-
* only needs the change signal); SDK / tracer consumers read the event.
|
|
99
|
-
*/
|
|
100
|
-
type QueueEvent = {
|
|
101
|
-
readonly kind: 'enqueued';
|
|
102
|
-
readonly message: QueuedMessage;
|
|
103
|
-
} | {
|
|
104
|
-
readonly kind: 'dequeued';
|
|
105
|
-
readonly messages: readonly QueuedMessage[];
|
|
106
|
-
} | {
|
|
107
|
-
readonly kind: 'cleared';
|
|
108
|
-
readonly messages: readonly QueuedMessage[];
|
|
109
|
-
};
|
|
110
|
-
/** FEATURE_159 — `MessageQueue.subscribe` listener signature. */
|
|
111
|
-
type QueueEventListener = (event: QueueEvent) => void;
|
|
112
|
-
interface EnqueueInput {
|
|
113
|
-
readonly priority: MessagePriority;
|
|
114
|
-
readonly mode: MessageMode;
|
|
115
|
-
readonly content: string;
|
|
116
|
-
readonly agentId?: string;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export type { DequeueFilter as D, EnqueueInput as E, MessageMode as M, QueueEventListener as Q, MessagePriority as a, QueuedMessage as b };
|