@kodax-ai/kodax 0.7.48 → 0.7.50
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 +1773 -1720
- package/README.md +91 -35
- package/README_CN.md +70 -23
- package/dist/builtin/code-review/SKILL.md +1 -1
- package/dist/chunks/argument-completer-3WX5B42G.js +2 -0
- package/dist/chunks/chunk-5UJQ2GKJ.js +574 -0
- package/dist/chunks/chunk-HR64F32V.js +2 -0
- package/dist/chunks/chunk-MFOMFMSK.js +1056 -0
- package/dist/chunks/{chunk-DEODZG6Q.js → chunk-SK4HOYT2.js} +1 -1
- package/dist/chunks/chunk-UB5IAZHF.js +476 -0
- package/dist/chunks/chunk-XZY4CIDV.js +31 -0
- package/dist/chunks/chunk-YJLRBIEW.js +301 -0
- package/dist/chunks/{compaction-config-YWCHOP2U.js → compaction-config-DDJSQ4OT.js} +1 -1
- package/dist/chunks/{construction-bootstrap-AIWATBWW.js → construction-bootstrap-4QNM2BVM.js} +1 -1
- package/dist/chunks/{dist-IDNOAB4M.js → dist-OJSNNI7P.js} +1 -1
- package/dist/chunks/dist-T256OSDI.js +2 -0
- package/dist/chunks/{utils-OG57XTPC.js → utils-JHIEOX6Z.js} +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +2 -2
- package/dist/kodax_cli.js +1406 -892
- package/dist/provider-capabilities.json +193 -190
- package/dist/sdk-agent.d.ts +213 -103
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +644 -33
- 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.js +1 -1
- package/dist/sdk-repl.d.ts +36 -13
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-session.d.ts +32 -5
- 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-DNO2-ycp.d.ts → bash-prefix-extractor.d-B0CIb0N3.d.ts} +137 -23
- package/dist/types-chunks/{file-tracker.d-D7L_SbRm.d.ts → capsule.d-CwBEm6M-.d.ts} +173 -5
- package/dist/types-chunks/{types.d-BCnbYG_A.d.ts → process.d-BbiXD24v.d.ts} +502 -4
- package/dist/types-chunks/{resolver.d-DkgJlEzr.d.ts → resolver.d-CQfaJbht.d.ts} +24 -6
- package/dist/types-chunks/{storage.d-B1Jk6ryM.d.ts → storage.d-J2GqOgaX.d.ts} +4 -1
- 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-Dgy5SVrq.d.ts → utils.d-D_-jrRku.d.ts} +44 -8
- package/package.json +1 -1
- package/dist/chunks/chunk-66B6ZOU7.js +0 -31
- package/dist/chunks/chunk-6Z75SHX3.js +0 -2
- package/dist/chunks/chunk-EP46H5P3.js +0 -415
- package/dist/chunks/chunk-LNJNRREL.js +0 -903
- package/dist/chunks/chunk-UHAP234X.js +0 -567
- package/dist/chunks/dist-4WABQRJU.js +0 -2
- 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 ec,$a as ed,$b as ee,$c as ef,$d as fg,A as Fb,Aa as Fc,Ab as Fd,Ac as Fe,Ad as Gf,B as Gb,Ba as Gc,Bb as Gd,Bc as Ge,Bd as Hf,C as Hb,Ca as Hc,Cb as Hd,Cc as He,Cd as If,D as Ib,Da as Ic,Db as Id,Dc as Ie,Dd as Jf,E as Jb,Ea as Jc,Eb as Jd,Ec as Je,Ed as Kf,F as Kb,Fa as Kc,Fb as Kd,Fc as Ke,Fd as Lf,G as Lb,Ga as Lc,Gb as Ld,Gc as Le,Gd as Mf,H as Mb,Ha as Mc,Hb as Md,Hc as Me,Hd as Nf,I as Nb,Ia as Nc,Ib as Nd,Ic as Ne,Id as Of,J as Ob,Ja as Oc,Jb as Od,Jc as Oe,Jd as Pf,K as Pb,Ka as Pc,Kb as Pd,Kc as Pe,Kd as Qf,L as Qb,La as Qc,Lb as Qd,Lc as Qe,Ld as Rf,M as Rb,Ma as Rc,Mb as Rd,Mc as Re,Md as Sf,N as Sb,Na as Sc,Nb as Sd,Nc as Se,Nd as Tf,O as Tb,Oa as Tc,Ob as Td,Oc as Te,Od as Uf,P as Ub,Pa as Uc,Pb as Ud,Pc as Ue,Pd as Vf,Q as Vb,Qa as Vc,Qb as Vd,Qc as Ve,Qd as Wf,R as Wb,Ra as Wc,Rb as Wd,Rc as We,Rd as Xf,S as Xb,Sa as Xc,Sb as Xd,Sc as Xe,Sd as Yf,T as Yb,Ta as Yc,Tb as Yd,Tc as Ye,Td as Zf,U as Zb,Ua as Zc,Ub as Zd,Uc as Ze,Ud as _f,V as _b,Va as _c,Vb as _d,Vc as _e,Vd as $f,W as $b,Wa as $c,Wb as $d,Wc as $e,Wd as ag,X as ac,Xa as ad,Xb as ae,Xc as af,Xd as bg,Y as bc,Ya as bd,Yb as be,Yc as bf,Yd as cg,Z as cc,Za as cd,Zb as ce,Zc as cf,Zd as dg,_ as dc,_a as dd,_b as de,_c as df,_d as eg,a as X,aa as fc,ab as fd,ac as fe,ad as ff,ae as gg,b as Y,ba as gc,bb as gd,bc as ge,bd as gf,be as hg,c as Z,ca as hc,cb as hd,cc as he,cd as hf,ce as ig,d as _,da as ic,db as id,dc as ie,dd as jf,de as jg,e as $,ea as jc,eb as jd,ec as je,ed as kf,ee as kg,f as kb,fa as kc,fb as kd,fc as ke,fd as lf,fe as lg,g as lb,ga as lc,gb as ld,gc as le,gd as mf,ge as mg,h as mb,ha as mc,hb as md,hc as me,hd as nf,he as ng,i as nb,ia as nc,ib as nd,ic as ne,id as of,ie as og,j as ob,ja as oc,jb as od,jc as oe,jd as pf,je as pg,k as pb,ka as pc,kb as pd,kc as pe,kd as qf,ke as qg,l as qb,la as qc,lb as qd,lc as qe,ld as rf,m as rb,ma as rc,mb as rd,mc as re,md as sf,n as sb,na as sc,nb as sd,nc as se,nd as tf,o as tb,oa as tc,ob as td,oc as te,od as uf,p as ub,pa as uc,pb as ud,pc as ue,pd as vf,q as vb,qa as vc,qb as vd,qc as ve,qd as wf,r as wb,ra as wc,rb as wd,rc as we,rd as xf,s as xb,sa as xc,sb as xd,sc as xe,sd as yf,t as yb,ta as yc,tb as yd,tc as ye,td as zf,u as zb,ua as zc,ub as zd,uc as ze,ud as Af,v as Ab,va as Ac,vb as Ad,vc as Ae,vd as Bf,w as Bb,wa as Bc,wb as Bd,wc as Be,wd as Cf,x as Cb,xa as Cc,xb as Cd,xc as Ce,xd as Df,y as Db,ya as Dc,yb as Dd,yc as De,yd as Ef,z as Eb,za as Ec,zb as Ed,zc as Ee,zd as Ff}from"./chunk-LNJNRREL.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{$c as jb,Ab as za,Bb as Aa,Cb as Ba,Db as Ca,Eb as Da,Fb as Ea,Gb as Fa,Gc as Xa,Hb as Ga,Hc as Ya,Ib as Ha,Ic as Za,Jb as Ia,Jc as _a,Kb as Ja,Kc as $a,Lb as Ka,Lc as ab,Mb as La,Mc as bb,Nb as Ma,Ob as Na,Oc as cb,Pb as Oa,Pc as db,Qb as Pa,Qc as eb,Rb as Qa,Rc as fb,Sb as Ra,Sc as gb,Tc as hb,_c as ib,a as aa,b as ba,c as ca,d as da,e as ea,f as fa,h as ga,i as ha,j as ia,jb as va,k as ja,ka as pa,kb as wa,l as ka,m as la,n as ma,na as qa,o as na,p as oa,ua as ra,va as sa,vc as Sa,wa as ta,wc as Ta,xa as ua,xc as Ua,yb as xa,yc as Va,zb as ya,zc as Wa}from"./chunk-EP46H5P3.js";import"./chunk-V4WSBIXB.js";export{Tf as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Uf as AUTO_MODE_DENIAL_CUMULATIVE_THRESHOLD,mg as BASH_POLICY_SPEC,hf as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,Zf as BREAKER_ERROR_THRESHOLD,_f as BREAKER_WINDOW_MS,lb as CANCELLED_TOOL_RESULT_MESSAGE,kb as CANCELLED_TOOL_RESULT_PREFIX,Jf as CODING_AGENT_MARKER,Ue as CODING_INVARIANTS,Je as CODING_SUMMARY_PROMPT,Ke as CODING_UPDATE_SUMMARY_PROMPT,Yc as CapabilityDeniedError,We as Client,Zc as ConstructionManifestError,Le as DEFAULT_CODING_AGENT_NAME,yf as DEFAULT_DANGEROUS_PATTERNS,Wc as DEFAULT_HANDLER_TIMEOUT_MS,le as DEFAULT_RESILIENCE_CONFIG,xf as DEFAULT_SAFE_PATTERNS,hd as DEFAULT_SELF_MODIFY_BUDGET,ig as DEFAULT_SPECULATIVE_WINDOW_MS,nb as DEFAULT_TOOL_OUTPUT_MAX_BYTES,mb as DEFAULT_TOOL_OUTPUT_MAX_LINES,oa as DefaultSummaryCompaction,Gf as EMIT_VERDICT_TOOL_NAME,_ as ErrorCategory,Cc 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,Gd as KODAX_TOOLS,l as KodaXAnthropicCompatProvider,k as KodaXBaseProvider,We as KodaXClient,a as KodaXError,Cd as KodaXExtensionRuntime,m as KodaXOpenAICompatProvider,b as KodaXProviderError,c as KodaXRateLimitError,Y as KodaXSessionError,Z as KodaXTerminalError,X as KodaXToolError,Sa as LINEAGE_ENTRY_TYPES,Fe as LSP_SERVERS,Ua as LineageCompaction,Ta as LineageExtension,Ge as LspService,xb as MANUAL_TOPIC_IDS,Da as McpAuthRequiredError,Pa as McpCapabilityProvider,Ca as McpExpiredSessionError,Qa as McpManager,Oa as McpServerRuntime,Bc as PLANNER_AGENT_NAME,ia as PROMISE_PATTERN,Zd as PROMPT_SECTION_REGISTRY,If as PROTOCOL_EMITTER_TOOLS,qe as ProviderRecoveryCoordinator,ob as READ_DEFAULT_LIMIT,qb as READ_MAX_LINE_CHARS,pb as READ_PREFLIGHT_SIZE_BYTES,Wb as REPOINTEL_DEFAULT_ENDPOINT,qa as Runner,Ac as SCOUT_AGENT_NAME,de as SELF_KNOWLEDGE_ROUTING_RULE,Yd as SYSTEM_PROMPT,oe as StableBoundaryTracker,Fc as TASK_ENGINE_ROLE_AGENTS,df as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,pg as TRACING_ENV,Dc as WORKER_AGENT_NAME,od as _resetRuntimeForTesting,rd as activate,Nb as analyzeChangedScope,fd as appendAuditEntry,ab as appendSessionLineageLabel,Oc as applyAccountingDelta,$e as applyFanoutBranchTransition,bb as applySessionCompaction,mc as applyToolResultGuardrail,hb as archiveOldIslands,af as assignFanoutBranchWorker,Yf as autoModeDenialShouldFallback,fg as bashSignalCollector,qg as bootstrapTracing,Qe as boundedRevise,bg as breakerShouldFallback,Re as budgetCeiling,ze as buildAmaControllerDecision,Rc as buildBlockedGoal,ee as buildCapabilityContextSections,Kf as buildClassifierPrompt,Sc as buildCompleteGoal,Nc as buildCreatedGoal,xe as buildFallbackRoutingDecision,Ye as buildFanoutSchedulerPlan,mf as buildGoalRuntimeBinding,Na as buildInitializeCapabilities,cd as buildLlmReviewPrompt,qf as buildMcpReverseCapabilities,Pc as buildPausedGoal,ie as buildPromptMessageContent,Ae as buildPromptOverlay,be as buildPromptSnapshot,re as buildProviderCapabilitySnapshot,ye as buildProviderPolicyHintsForDecision,se as buildProviderPolicyPromptNotes,g as buildReasoningOverrideKey,Mb as buildRepoIntelligenceContext,$b as buildRepoIntelligenceIndex,Jb as buildRepoOverview,Qc as buildResumedGoal,ce as buildSelfKnowledgeRoutingRule,fb as buildSessionTree,ge as buildSystemPrompt,fe as buildSystemPromptSnapshot,eg as checkAbsoluteDeny,he as checkIncompleteToolCalls,Ce as checkPromiseSignal,Mf as classify,Af as classifyBashCommand,$ as classifyError,ne as classifyResilienceError,wa as cleanupIncompleteToolCalls,j as clearReasoningOverride,Q as clearRuntimeModelProviders,hg as collectAllSignals,Cf as computeInputSignature,Nf as computeRulesFingerprint,nd as configureRuntime,qc as convertCapabilityReadResult,pc as convertProviderSearchResults,_e as countActiveFanoutBranches,gb as countActiveLineageMessages,ka as countTokens,la as createAgent,Vf as createAutoModeDenialTracker,lg as createAutoModeToolGuardrail,zf as createBashClassifierConfig,og as createBashPrefixExtractor,Od as createBuiltinToolDefinition,$f as createCircuitBreaker,_c as createCtxProxy,C as createCustomProvider,Me as createDefaultCodingAgent,Bf as createDenialTracker,Dd as createExtensionRuntime,Xe as createFanoutSchedulerInput,ma as createHandoff,na as createInMemorySession,tf as createKodaXTaskRunner,ya as createMcpCapabilityId,Ra as createMcpManager,Ea as createMcpTransport,_d as createPromptSection,Be as createReasoningPlan,Oe as createSessionControl,Xa as createSessionLineage,ef as createToolResultTruncationGuardrail,xa as defaultMcpCacheDir,Xc as defaultPolicy,md as disableSelfModify,Ia as discoverAuthorizationServerMetadata,Ad as discoverMarkdownAgents,Ja as discoverOAuthEndpoints,Ha as discoverProtectedResourceMetadata,Ic as drainPendingSwaps,Hf as emitVerdict,ja as estimateTokens,te as evaluateProviderPolicy,Uc as exec,Xd as executeTool,ib as extractArtifactLedger,ng as extractCommandPrefix,ke as extractComparableUserMessageText,oc as extractHtmlTitle,Ga as extractInsufficientScope,je as extractPromptComparableText,Fa as extractResourceMetadataUrl,Wa as extractTitleFromMessages,gg as fileSignalCollector,sc as finalizeRetrievalResult,xd as findByVersion,cb as findPreviousUserEntryId,eb as forkSessionLineage,zc as formatAgentsForPrompt,vf as formatParallelDispatchResult,rb as formatSize,Va as generateSessionId,Fd as getActiveExtensionRuntime,sa as getAgentConfigHome,ta as getAgentConfigPath,Qd as getAllRegisteredTools,ua as getAppDataDir,T as getAvailableProviderNames,Nd as getBuiltinRegisteredToolDefinition,Md as getBuiltinToolDefinition,K as getCustomModelCapabilities,E as getCustomProvider,H as getCustomProviderList,J as getCustomProviderModelDescriptors,I as getCustomProviderModels,G as getCustomProviderNames,He as getDefaultLspService,Ff as getDenialContext,Ze as getFanoutBranch,ec as getImpactEstimate,xc as getKodaxGlobalDir,Ba as getMcpCachePaths,z as getModelCapabilities,bc as getModuleContext,dc as getProcessContext,q as getProvider,u as getProviderConfiguredCapabilityProfile,t as getProviderConfiguredReasoningCapability,v as getProviderList,s as getProviderModel,y as getProviderModelDescriptors,w as getProviderModels,Kd as getRegisteredToolDefinition,ac as getRepoIntelligenceIndex,Kb as getRepoOverview,fc as getRepoRoutingSignals,Ud as getRequiredToolParams,N as getRuntimeModelProvider,P as getRuntimeModelProviderNames,Ya as getSessionLineagePath,Za as getSessionMessagesFromLineage,cc as getSymbolContext,Id as getTool,Jd as getToolDefinition,Ld as getToolRegistrations,lc as getToolResultPolicy,Kc as goalTokenDelta,Hc as hasPendingSwap,we as inferTaskType,Cb as inspectEditFailure,Zb as inspectRepoIntelligenceRuntime,F as isCustomProviderName,Ef as isDeniedRecently,S as isKnownProvider,uf as isParallelDispatchDirective,r as isProviderConfigured,x as isProviderName,O as isRuntimeModelProviderName,Sd as isToolFileMutation,Td as isToolMutation,Rd as isToolPlanModeAllowed,Tc as isValidTokenBudget,De as languageIdForPath,yd as listAll,W as listAllModelCapabilities,ud as listArtifacts,A as listBuiltinModelCapabilities,Pd as listBuiltinToolDefinitions,wd as listConstructed,L as listCustomProviderModelCapabilities,Wd as listToolDefinitions,Vd as listTools,yc as loadAgentsFiles,zd as loadAgentsFromMarkdown,Rf as loadAutoRules,$c as loadHandler,h as loadReasoningOverride,Ma as loadValidToken,Jc as makeDisabledGoalToolsContext,cf as markFanoutBranchCancelled,bf as markFanoutBranchCompleted,pf as mcpRootsFromWorkspace,jb as mergeArtifactLedger,$d as orderPromptSections,Qf as parseAutoRules,Lf as parseClassifierOutput,Bb as parseEditToolError,dd as parseLlmReviewVerdict,za as parseMcpCapabilityId,cg as parseModelSpec,La as performOAuthLogin,vb as persistToolOutput,gc as prewarmRepoIntelligenceCaches,vd as readArtifact,gd as readAuditEntries,id as readBudget,ld as readDisableState,jg as readSpeculativeWindowFromEnv,Of as readTrustState,e as reasoningCapabilityToOverride,ve as reasoningModeToDepth,f as reasoningOverrideToCapability,pe as reconstructMessagesWithToolGuard,Xf as recordAutoModeAllow,Wf as recordAutoModeBlock,ff as recordBlockerAttempt,ag as recordBreakerError,Df as recordDenial,Ve as registerCodingInvariants,of as registerConfiguredMcpCapabilityProvider,D as registerCustomProviders,M as registerModelProvider,Ka as registerOAuthClient,rf as registerOfficialSandboxExtension,pa as registerPresetDispatcher,Hd as registerTool,sd as rehydrateActiveArtifacts,jd as remainingSelfModifyBudget,Ob as renderChangedScope,Vb as renderImpactEstimate,Sb as renderModuleContext,Ub as renderProcessContext,ae as renderPromptSections,Lb as renderRepoOverview,rc as renderRetrievalResult,Tb as renderSymbolContext,Ee as reportLspDiagnostics,gf as resetBlockerCounter,kd as resetBudget,dg as resolveClassifierModel,Gc as resolveConstructedAgent,yb as resolveKodaXManual,V as resolveModelCapabilities,R as resolveProvider,U as resolveProviderModelDescriptors,ue as resolveReasoningMode,Yb as resolveRepoIntelligenceMode,Xb as resolveRepoIntelligenceRuntimeConfig,me as resolveResilienceConfig,_a as resolveSessionLineageTarget,Se as resolveToolCapability,td as revoke,db as rewindSessionLineage,Bd as rollbackSelfModify,ad as runAstRules,Ne as runKodaX,ed as runLlmReview,nf as runManagedTask,sf as runOrchestration,i as saveReasoningOverride,Aa as searchMcpCatalog,Ed as setActiveExtensionRuntime,ra as setAgentConfigHome,$a as setSessionLineageActiveEntry,Mc as shouldFlipBudgetLimited,Ie as shutdownDefaultLspService,kg as speculativeRace,pd as stage,Pe as startKodaX,Sf as stripAssistantText,nc as stripHtmlToText,qd as testArtifact,Ib as toolAskUserQuestion,Eb as toolBash,Rb as toolChangedDiff,Qb as toolChangedScope,vc as toolCodeSearch,Ab as toolEdit,Fb as toolGlob,Gb as toolGrep,kc as toolImpactEstimate,Db as toolInsertAfterAnchor,hc as toolModuleContext,Te as toolPermission,jc as toolProcessContext,wb as toolRead,Pb as toolRepoOverview,wc as toolSemanticLookup,ic as toolSymbolContext,Hb as toolUndo,uc as toolWebFetch,tc as toolWebSearch,zb as toolWrite,sb as truncateHead,ub as truncateLine,tb as truncateTail,Pf as trustProjectRules,Lc as turnWallTimeDelta,va as validateAndFixToolHistory,B as validateCustomProviderConfig,wf as validateSubtaskIndependence,bd as validateToolSchemaForProvider,lf as verifyGoalCompletion,_b as warmRepoIntelligenceRuntime,Vc as webhook,jf as withGoalBeforeNextTurn,kf as withGoalStopHook,Ec as workerAgent};
|
|
@@ -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 };
|