@makaio/framework 1.0.0-dev-1784660886122 → 1.0.0-dev-1784707578477
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/dist/.makaio-build.json +2 -2
- package/dist/adapters/claude/index.mjs +2 -2
- package/dist/bus/index.d.mts +99 -4
- package/dist/bus/index.mjs +1 -1
- package/dist/bus-B6SAjgOC.mjs +2 -0
- package/dist/bus-C2l3K74u.mjs +1 -0
- package/dist/client-OYk0Ttck.mjs +1 -0
- package/dist/client-binary-version-verifier-Dv7TGFxh.mjs +2 -0
- package/dist/clients/index.d.mts +382 -12
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.mjs +1 -1
- package/dist/{context-resolution-BSqErWL9.d.mts → context-resolution-DsPuX5ox.d.mts} +2 -2
- package/dist/contracts/adapter/index.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +2 -2
- package/dist/contracts/client/index.d.mts +3 -3
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +4 -3
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +45 -45
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +2 -2
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/core/index.d.mts +78 -3
- package/dist/core/index.mjs +1 -1
- package/dist/{detached-extension-handle-4rqGo7gz.mjs → detached-extension-handle-BsywhHfk.mjs} +1 -1
- package/dist/hook-responses-mmqRa2Dq.d.mts +825 -0
- package/dist/{index-g36yJDge.d.mts → index-0Ju2i8gV.d.mts} +6 -6
- package/dist/{index-BJ9Lw82m.d.mts → index-B0N0tFS-.d.mts} +84 -84
- package/dist/{index-D53fZ-mw.d.mts → index-BHQXXd-O.d.mts} +4 -4
- package/dist/{index-B0gMeoVX.d.mts → index-BLwvcw5C.d.mts} +3 -3
- package/dist/{index-BhXCCgJV2.d.mts → index-C3XXcDNg2.d.mts} +1 -1
- package/dist/{index-CPprHGCU2.d.mts → index-C5vYc3m12.d.mts} +3 -3
- package/dist/{index-BFerQqP0.d.mts → index-CtZODNBo.d.mts} +25 -25
- package/dist/{index-9eiE_cqH.d.mts → index-D6gaVj-T.d.mts} +19 -19
- package/dist/{index-BnVgpKz0.d.mts → index-DK5z1A5p.d.mts} +20 -26
- package/dist/{index-BynPVPxZ.d.mts → index-DRTyhYK0.d.mts} +1 -1
- package/dist/{index-CHTq-cru.d.mts → index-DxDMF5CP.d.mts} +19 -5
- package/dist/{index-ddsI907b.d.mts → index-t9fTvyq6.d.mts} +11 -11
- package/dist/{index-DbrDKyUO.d.mts → index-vTBR3OFK.d.mts} +7 -7
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/index.d.mts +2 -2
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/{load-extensions-CDnrd0n9.mjs → load-extensions-CUmFCcYi.mjs} +1 -1
- package/dist/{namespace-d-FMrHlZ.d.mts → namespace-8-GrdcbF.d.mts} +22 -22
- package/dist/{namespace-C8ALWEzw2.d.mts → namespace-C_EIMKwg2.d.mts} +25 -25
- package/dist/{namespace-Db_PFX3v.d.mts → namespace-CwGeWIRG.d.mts} +9 -9
- package/dist/{namespace-BHliaabz.d.mts → namespace-DGORv0pz.d.mts} +6 -6
- package/dist/node/transports/index.d.mts +5 -3
- package/dist/node/transports/index.mjs +2 -2
- package/dist/package.json +1 -1
- package/dist/runtime-node/extension-validation.mjs +1 -1
- package/dist/runtime-node/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/{schema-nODf0dQF.d.mts → schema-CfMsufSb.d.mts} +1 -1
- package/dist/{schemas-B5tMYfhC.d.mts → schemas-Bu4ZEJAD.d.mts} +4 -4
- package/dist/scoped-bus-C9BdNwfM.mjs +1 -0
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +3 -3
- package/dist/services/execution-target/index.d.mts +1 -1
- package/dist/services/filesystem/namespace.d.mts +12 -12
- package/dist/services/filesystem/schemas.d.mts +6 -6
- package/dist/services/index.d.mts +17 -17
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/session/index.d.mts +6 -6
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/src-XihJcAQS.mjs +1 -0
- package/dist/{transition-tDx_mKNs.d.mts → transition-DWv5Abk6.d.mts} +1 -1
- package/dist/{types-DVLq657Y.d.mts → types-BwEQ9ucW.d.mts} +1 -1
- package/dist/{types-BxYs0waO.d.mts → types-CzTC6z8M.d.mts} +26 -26
- package/dist/ui-components/index.mjs +2 -2
- package/dist/{view-builder-B4PiWaSq.d.mts → view-builder-Drp9dB59.d.mts} +1 -1
- package/dist/workflow-engine/index.d.mts +23 -23
- package/dist/workflow-worker-DR9qYOFc.mjs +1 -0
- package/package.json +3 -3
- package/dist/bus-D-ioC0DE.mjs +0 -1
- package/dist/bus-rgUFuO2a.mjs +0 -2
- package/dist/client-CzPCSeyE.mjs +0 -1
- package/dist/client-binary-version-verifier-CmSosIgx.mjs +0 -2
- package/dist/definition-DbNDJBMC.d.mts +0 -413
- package/dist/scoped-bus-CZId-Df8.mjs +0 -1
- package/dist/src-BpPrDOA0.mjs +0 -1
- package/dist/workflow-worker-CDHsRo1N.mjs +0 -1
package/dist/.makaio-build.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"fingerprint": "
|
|
4
|
-
"builtAt": "2026-07-
|
|
3
|
+
"fingerprint": "35fa7437cc56ab5ecfadace653450d509418a87ae8bef732a16339481fb526a1",
|
|
4
|
+
"builtAt": "2026-07-22T08:07:32.761Z"
|
|
5
5
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{z as e}from"zod";import{AuthenticationError as t,InvalidModelError as n,ModelUnavailableError as r,QuotaExceededError as i,RateLimitError as a}from"@makaio/framework/core";import{AgentSubjects as o,JsonValueSchema as s,createClientDefinition as c}from"@makaio/framework/contracts";import{AIAgent as ee,BaseConnectorTurn as te,ScopedToolApprovalSchema as ne,createAdapterNamespace as re,createToolApprovalHandler as ie,defineDiscriminatedHandlers as ae,formatContextBlockAsText as oe,isTextLikeMimeType as se,mergeScopedToolApproval as l,normalizeMimeType as u,processDiscriminatedItems as ce,serializeBlockToText as d}from"@makaio/framework/adapters";import{DeferredPromise as le}from"@makaio/framework/utils";import{AbsolutePathSchema as f}from"@makaio/framework/clients";function p(e,t){return l(e,t,`claude-shared`)}function ue(e){return e.action===`allow`?{behavior:`allow`,updatedInput:e.updatedInput,updatedPermissions:e.updatedPermissions}:{behavior:`deny`,message:e.message,interrupt:e.shouldAbort??!1}}function m(e,t,n,r){return ie(t.can_use_tool,p,e=>e)(e,n,r)}async function de(e,t,n,r={}){let i=l(t,n??{},`claude-shared`,{allowPayloadSessionFallback:r.allowPayloadSessionFallback??!1,allowPayloadIdentityFallback:r.allowPayloadIdentityFallback??!1});return e.request(o.toolApprove,i)}const h=ae(`type`,{text:(e,t)=>t(o.message,{content:e.text}),thinking:(e,t)=>t(o.reasoning,{content:e.thinking}),tool_use:(e,t)=>t(o.tool.use,{toolName:e.name,args:e.input,toolCallId:e.id}),server_tool_use:(e,t)=>t(o.tool.started,{toolName:e.name,toolCallId:e.id}),web_search_tool_result:(e,t)=>{let n=!Array.isArray(e.content);return t(o.tool.completed,{toolName:`web_search`,result:e.content,success:!n,toolCallId:e.tool_use_id})},code_execution_tool_result:(e,t)=>{let n=e.content,r=n.type===`code_execution_result`&&n.return_code===0;return t(o.tool.completed,{toolName:`code_execution`,result:n,success:r,toolCallId:e.tool_use_id})},redacted_thinking:(e,t)=>{},mcp_tool_use:(e,t)=>{},mcp_tool_result:(e,t)=>{},container_upload:(e,t)=>{}});function fe(e,t){return{provider:`anthropic`,granularity:`query-aggregate`,inputTokens:e.input_tokens,inputCachedTokens:e.cache_read_input_tokens??0,cacheWriteTokens:e.cache_creation_input_tokens,outputTokens:e.output_tokens,reasoningTokens:0,totalTokens:e.input_tokens+(e.cache_read_input_tokens??0)+e.output_tokens,costUnits:1,costUnitType:`requests`,...t===void 0?{}:{cost:t,costProvenance:`provider-reported`},serviceTier:e.service_tier}}function pe(e){return e.input_tokens+(e.cache_creation_input_tokens??0)+(e.cache_read_input_tokens??0)+e.output_tokens}async function me(e){let{messageId:t}=e;if(t===void 0)return;let n=e.payload.message?.content,r=Array.isArray(n)?n:n?[n]:[];for(let n of r){if(!he(n))continue;let r=n.tool_use_id,i=ge(e.payload.tool_use_result),a=await e.resolveToolOutput(t,i,r);await e.emitToolCompleted({messageId:t,toolName:a.toolName,args:a.args,result:{content:n.content??{}},success:!n.is_error,toolCallId:a.toolCallId}),await e.emitToolStepFinished({blockIndex:e.consumeToolBlockIndex(r),toolCallId:a.toolCallId,output:i,isError:n.is_error??!1})}}function he(e){return typeof e==`object`&&!!e&&e.type===`tool_result`}function ge(e){return typeof e==`string`?e:[e?.stdout,e?.stderr].filter(Boolean).join(`
|
|
2
|
-
`)}function _e(e){return e.type!==`tool_use`||!e.id||!e.name?null:{toolCallId:e.id,toolName:e.name}}var ve=class extends ee{supportsNativeResume(){return!0}supportsNativeFork(){return!0}currentStepType=`text`;currentTextContent=``;currentReasoningContent=``;currentToolCall=null;toolBlockIndexMap=new Map;currentToolArgsJson=``;wireEvents(e){let t=e;this.wireConnectorEvents(t),this.wireToolApprovalRpc(e)}subscribeClaudeConnector(e,t,n,r){this.addConnectorWiringCleanup(e.on(t,n,r))}wireConnectorEvents(e){let t=this.getSubjects();this.subscribeClaudeConnector(e,t.sdk.event,async e=>{let t=e.payload,n=t.originatingMessageId;switch(t.type){case`system`:t.subtype===`init`&&await this.emitStart();break;case`assistant`:{let e=t.message?.content;if(!e)break;await ce(e,h,async(e,t)=>{if(e.subject===`tool.use`){if(n===void 0)return;let e=t;await this.emitToolUse(n,e.toolName,e.args,e.toolCallId)}else if(e.subject===`tool.started`||e.subject===`tool.completed`){if(n===void 0)return;await this.emitGlobal(e,{...t,messageId:n})}else await this.emitGlobal(e,t)});break}case`stream_event`:{let e=t.event;e.type===`content_block_start`?await this.handleContentBlockStart(e,n):e.type===`content_block_stop`?await this.handleContentBlockStop(e):e.type===`content_block_delta`&&await this.handleContentBlockDelta(e);break}case`result`:await this.handleResultEvent(t);break;case`user`:await this.handleUserEvent(t,n);break}})}async handleContentBlockStart(e,t){let n=e.content_block,r=_e(n),i=n.type===`thinking`?`reasoning`:n.type===`tool_use`?`tool_use`:`text`;this.currentStepType=i,this.currentTextContent=``,this.currentReasoningContent=``,this.currentToolArgsJson=``,this.currentToolCall=null;let a=r?{type:`tool_use`,toolName:r.toolName,toolCallId:r.toolCallId}:n.type===`tool_use`?void 0:{type:i},s;if(r&&(this.currentToolCall={toolCallId:r.toolCallId,name:r.toolName,args:{}},this.toolBlockIndexMap.set(r.toolCallId,e.index),s={type:`tool_call`,toolCallId:r.toolCallId,name:r.toolName,args:{}}),n.type===`tool_use`&&!r&&console.warn(`[ClaudeCodeAdapter] Received tool_use block without id or name; skipping tool correlation setup`),r&&t===void 0){console.warn(`[ClaudeCodeAdapter] Received tool_use block without originating message identity; skipping tool events`);return}await this.emitGlobal(o.step.started,{...t!==void 0&&{messageId:t},stepType:i,blockIndex:e.index,blockData:a,content:s}),r&&await this.emitGlobal(o.tool.started,{...t!==void 0&&{messageId:t},toolName:r.toolName,toolCallId:r.toolCallId})}async handleContentBlockStop(e){if(this.currentStepType!==`tool_use`){let t=this.currentStepType===`text`?{type:`text`,content:this.currentTextContent}:{type:`reasoning`,content:this.currentReasoningContent};await this.emitGlobal(o.step.finished,{stepType:this.currentStepType,blockIndex:e.index,content:t})}else if(this.currentToolCall&&this.currentToolArgsJson)try{this.currentToolCall.args=JSON.parse(this.currentToolArgsJson)}catch{}}async handleContentBlockDelta(e){let t=e.delta;switch(t.type){case`text_delta`:this.currentTextContent+=t.text,await this.emitGlobal(o.message_delta,{text:t.text});break;case`thinking_delta`:this.currentReasoningContent+=t.thinking,await this.emitGlobal(o.reasoning_delta,{content:t.thinking});break;case`input_json_delta`:`partial_json`in t&&(this.currentToolArgsJson+=t.partial_json);break}}async handleResultEvent(e){if(e.usage){let t=e.usage;await this.trackUsage(fe(t,e.total_cost_usd)),await this.emitContextWindowUpdate({currentTokens:pe(t),maxTokens:this.getContextWindowSize()??2e5,cachedTokens:t.cache_read_input_tokens})}}async handleUserEvent(e,t){await me({messageId:t,payload:e,resolveToolOutput:async(e,t,n)=>await this.emitToolOutput(e,t,{nativeId:n}),emitToolCompleted:async e=>await this.emitGlobal(o.tool.completed,e),emitToolStepFinished:async e=>await this.emitGlobal(o.step.finished,{stepType:`tool_use`,blockIndex:e.blockIndex,content:{type:`tool_output`,toolCallId:e.toolCallId,output:e.output,isError:e.isError}}),consumeToolBlockIndex:e=>this.consumeToolBlockIndex(e)})}consumeToolBlockIndex(e){if(e===void 0)return-1;let t=this.toolBlockIndexMap.get(e);return this.toolBlockIndexMap.delete(e),t===void 0&&console.warn(`[ClaudeCodeAdapter] toolCallId ${e} not found in toolBlockIndexMap - possible state mismatch`),t??-1}wireToolApprovalRpc(e){this.addConnectorWiringCleanup(m(e,this.getSubjects(),async()=>({adapterId:this.adapterId,adapterName:this.adapterName,agentId:this.agentId,adapterSessionId:await this.getAdapterSessionId(),sessionId:this.sessionId}),this.globalBus))}},ye=class{queue=[];resolvers=[];done=!1;async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else if(this.done)return;else yield await new Promise(e=>{this.resolvers.push(t=>{t.done||e(t.value)})})}push(e){if(this.done)throw Error(`Cannot push to completed source`);this.resolvers.length>0?this.resolvers.shift()({value:e,done:!1}):this.queue.push(e)}complete(){this.done=!0;for(let e of this.resolvers)e({value:void 0,done:!0});this.resolvers=[]}clear(){this.queue=[]}},be=class extends te{queryInstance;activeMessageHandle;pausedDeferred;isPausedFlag=!1;connectorBus;subjects;agentId;expectingInterruptResult=!1;constructor(e,t,n,r,i,a,o){super(e,n,r,`idle`),this.connectorBus=e,this.subjects=t,this.agentId=i,this.queryInstance=a,this.activeMessageHandle=o}setActiveMessageHandle(e){this.activeMessageHandle=e}async emitStateChange(e,t){let n={adapterId:this.adapterId,agentId:this.agentId,oldState:e,newState:t,timestamp:Date.now()};switch(await this.connectorBus.emit(this.subjects.turn.state_changed,n),t){case`turn_started`:await this.connectorBus.emit(this.subjects.turn.turn_started,n);break;case`step_started`:await this.connectorBus.emit(this.subjects.turn.step_started,n);break;case`step_finished`:await this.connectorBus.emit(this.subjects.turn.step_finished,n);break;case`turn_finished`:await this.connectorBus.emit(this.subjects.turn.turn_finished,n);break;case`paused`:await this.connectorBus.emit(this.subjects.turn.paused,n);break}}async start(){await this.transitionTo(`turn_started`)}async pause(){if(this.state===`turn_finished`)return{stateBeforePause:this.state,turnEnded:!0};if(this.isPausedFlag)return{stateBeforePause:this.state,turnEnded:!1};if(this.state!==`step_finished`&&(await this.waitForStepFinished(),this.getState()===`turn_finished`)||(await this.queryInstance.interrupt(),this.getState()===`turn_finished`))return{stateBeforePause:this.state,turnEnded:!0};this.expectingInterruptResult=!0,this.isPausedFlag=!0;let e=this.state;return await this.transitionTo(`paused`),{stateBeforePause:e,turnEnded:!1}}async resume(e){if(!this.isPausedFlag)throw Error(`Cannot resume - turn not paused`);this.isPausedFlag=!1,await this.transitionTo(`step_started`)}isPaused(){return this.isPausedFlag}async handleSdkEvent(e){if(e.type===`stream_event`)e.event.type===`content_block_start`?await this.transitionTo(`step_started`):e.event.type===`content_block_stop`&&(await this.transitionTo(`step_finished`),this.pausedDeferred?.resolve());else if(e.type===`result`){if(this.expectingInterruptResult){this.expectingInterruptResult=!1;return}await this.transitionTo(`turn_finished`)}}isExpectingInterruptResult(){return this.expectingInterruptResult}async finishOnError(){this.pausedDeferred?.resolve(),this.pausedDeferred=void 0,this.isPausedFlag=!1,this.expectingInterruptResult=!1,this.state!==`turn_finished`&&await this.transitionTo(`turn_finished`)}async waitForStepFinished(){if(this.state!==`step_finished`){this.pausedDeferred=new le;try{await this.pausedDeferred.getPromise()}finally{this.pausedDeferred=void 0}}}isCompleted(){return this.state===`turn_finished`}canAcceptImmediate(){return this.state!==`turn_finished`&&!this.isPausedFlag}};c({id:`claude-code`,name:`Claude Code`,version:`0.1.0`,description:`Anthropic Claude Code CLI — an agentic coding assistant`,binary:{name:`claude`,supportedVersions:`^2.1.143`},managedInstall:{type:`signed-binary-bucket`,version:`2.1.143`,config:{baseUrl:`https://downloads.claude.ai/claude-code-releases`,manifestPathTemplate:`{version}/manifest.json`,manifestSignaturePathTemplate:`{version}/manifest.json.sig`,publicKeyUrl:`https://downloads.claude.ai/keys/claude-code.asc`,publicKeyFingerprint:`31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`,binaryPathTemplate:`{version}/{platform}/{binary}`,platforms:{"darwin-arm64":`darwin-arm64`,"darwin-x64":`darwin-x64`,"linux-arm64":`linux-arm64`,"linux-x64":`linux-x64`,"linux-arm64-musl":`linux-arm64-musl`,"linux-x64-musl":`linux-x64-musl`,"win32-arm64":`win32-arm64`,"win32-x64":`win32-x64`}}},versionCommand:{executable:{default:`claude`,win32:`claude.exe`},args:[`--version`]},configIsolation:{envVar:`CLAUDE_CONFIG_DIR`,defaultPath:`~/.claude`},nativeTools:[{name:`bash`,friendlyName:`Terminal`,description:`Execute shell commands`,category:`System`,capabilities:[{tag:`shell.execute`},{tag:`file.read`},{tag:`file.write`},{tag:`file.delete`},{tag:`network.request`},{tag:`process.manage`}]},{name:`text_editor`,friendlyName:`Text Editor`,description:`View and edit files`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`file.write`}]},{name:`list_directory`,friendlyName:`List Directory`,description:`List directory contents`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`search.files`}]},{name:`read_file`,friendlyName:`Read File`,description:`Read file contents`,category:`Files`,capabilities:[{tag:`file.read`}]},{name:`write_file`,friendlyName:`Write File`,description:`Write content to a file`,category:`Files`,capabilities:[{tag:`file.write`}]}],defaultApprovalPolicy:`full-access`,authMethods:[{id:`native`,mode:`inferred`,label:`Native account`},{id:`oauth-token`,mode:`explicit`,label:`OAuth token`,fields:[{id:`oauthToken`,label:`OAuth token`,required:!0,secret:!0,sourceHints:[{kind:`environment`,variable:`CLAUDE_CODE_OAUTH_TOKEN`}]}]}],defaultAuth:{providerDefinitionId:`anthropic-oauth`,methodId:`native`},runtimeCapabilities:{supportsHooks:!0,supportsStatusline:!0,supportsSupervisorLaunch:!1,supportsManagedBinary:!0,hookEvents:[{name:`SessionStart`,frameworkSubject:`client.session.started`},{name:`UserPromptSubmit`,frameworkSubject:`client.session.userPrompt.submitted`},{name:`PreToolUse`,frameworkSubject:`client.session.tool.pre`,mode:`request`},{name:`PostToolUse`,frameworkSubject:`client.session.tool.post`},{name:`Stop`,frameworkSubject:`client.session.turn.completed`},{name:`SubagentStop`},{name:`Notification`},{name:`MCPServerStart`},{name:`MCPServerStop`}]}});const g=e.object({uuid:e.string(),session_id:e.string(),type:e.string(),correlation_id:e.string().optional(),agentId:e.string().optional(),timestamp:e.string().optional(),cwd:e.string().optional()}),_=g.extend({parent_tool_use_id:e.string().nullable().optional()});g.required({agentId:!0}).extend({parent_tool_use_id:e.string().nullable().optional()});const v=e.enum([`invalid_tool_input`,`unavailable`,`too_many_requests`,`execution_time_exceeded`]),y=e.object({web_search_requests:e.number()}),xe=e.object({ephemeral_1h_input_tokens:e.number(),ephemeral_5m_input_tokens:e.number()}),b=e.object({cache_creation:xe.nullable().optional(),cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number(),output_tokens:e.number(),server_tool_use:y.nullable().optional(),service_tier:e.enum([`standard`,`priority`,`batch`]).nullable().optional()});e.object({cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number().nullable().optional(),output_tokens:e.number(),server_tool_use:y.nullable().optional()});const x=e.object({type:e.literal(`ephemeral`),ttl:e.enum([`5m`,`1h`]).optional()}),Se=e.object({data:e.string(),media_type:e.enum([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),type:e.literal(`base64`)}),Ce=e.object({type:e.literal(`url`),url:e.string()}),we=e.object({file_id:e.string(),type:e.literal(`file`)}),Te=e.discriminatedUnion(`type`,[Se,Ce,we]),Ee=e.object({data:e.string(),media_type:e.literal(`application/pdf`),type:e.literal(`base64`)}),De=e.object({type:e.literal(`url`),url:e.string()}),Oe=e.object({file_id:e.string(),type:e.literal(`file`)}),ke=e.object({data:e.string(),media_type:e.literal(`text/plain`),type:e.literal(`text`)}),Ae=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),file_id:e.string().nullable().optional(),start_char_index:e.number(),type:e.literal(`char_location`)}),je=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),start_char_index:e.number(),type:e.literal(`char_location`)}),S=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),file_id:e.string().nullable().optional(),start_page_number:e.number(),type:e.literal(`page_location`)}),Me=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),start_page_number:e.number(),type:e.literal(`page_location`)}),Ne=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),file_id:e.string().nullable().optional(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Pe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Fe=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Ie=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Le=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),Re=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),C=e.discriminatedUnion(`type`,[Ae,S,Ne,Fe,Le]),ze=e.discriminatedUnion(`type`,[je,Me,Pe,Ie,Re]);e.object({citation:C,type:e.literal(`citations_delta`)});const w=e.object({enabled:e.boolean().optional()}),Be=e.object({id:e.string(),expires_at:e.string()}),Ve=e.enum([`end_turn`,`max_tokens`,`stop_sequence`,`tool_use`,`pause_turn`,`refusal`]),T=e.object({text:e.string(),type:e.literal(`text`),cache_control:x.nullable().optional(),citations:e.array(ze).nullable().optional()}),E=e.object({source:Te,type:e.literal(`image`),cache_control:x.nullable().optional()}),He=e.object({content:e.union([e.string(),e.array(e.union([T,E]))]),type:e.literal(`content`)}),Ue=e.object({source:e.union([Ee,ke,He,De,Oe]),type:e.literal(`document`),cache_control:x.nullable().optional(),citations:w.optional(),context:e.string().nullable().optional(),title:e.string().nullable().optional()}),D=e.object({content:e.array(T),source:e.string(),title:e.string(),type:e.literal(`search_result`),cache_control:x.nullable().optional(),citations:w.optional()}),O=e.object({citations:e.array(C).nullable().optional(),text:e.string(),type:e.literal(`text`)}),k=e.object({signature:e.string(),thinking:e.string(),type:e.literal(`thinking`)}),We=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),Ge=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),type:e.literal(`tool_use`)}),Ke=e.object({id:e.string(),input:e.looseObject({}),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`)}),qe=e.object({encrypted_content:e.string(),page_age:e.string().nullable().optional(),title:e.string(),type:e.literal(`web_search_result`),url:e.string()}),Je=e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),Ye=e.object({error_code:Je,type:e.literal(`web_search_tool_result_error`)}),Xe=e.union([Ye,e.array(qe)]),Ze=e.object({content:Xe,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`)}),Qe=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),$e=e.object({content:e.array(Qe),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),et=e.object({error_code:v,type:e.literal(`code_execution_tool_result_error`)}),tt=e.union([et,$e]),nt=e.object({content:tt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`)}),rt=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`)}),it=e.object({content:e.union([e.string(),e.array(O)]),is_error:e.boolean(),tool_use_id:e.string(),type:e.literal(`mcp_tool_result`)}),at=e.object({file_id:e.string(),type:e.literal(`container_upload`)}),A=e.discriminatedUnion(`type`,[O,k,We,Ge,Ke,Ze,nt,rt,it,at]),ot=k.extend({}),st=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),ct=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),type:e.literal(`tool_use`),cache_control:x.nullable().optional()}),lt=e.object({tool_use_id:e.string(),type:e.literal(`tool_result`),cache_control:x.nullable().optional(),content:e.union([e.string(),e.array(e.union([T,E,D]))]).optional(),is_error:e.boolean().optional()}),ut=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`),cache_control:x.nullable().optional()}),dt=e.object({encrypted_content:e.string(),title:e.string(),type:e.literal(`web_search_result`),url:e.string(),page_age:e.string().nullable().optional()}),ft=e.object({error_code:e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),type:e.literal(`web_search_tool_result_error`)}),pt=e.union([e.array(dt),ft]),mt=e.object({content:pt,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`),cache_control:x.nullable().optional()}),ht=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),gt=e.object({content:e.array(ht),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),_t=e.object({error_code:v,type:e.literal(`code_execution_tool_result_error`)}),vt=e.union([_t,gt]),yt=e.object({content:vt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`),cache_control:x.nullable().optional()}),bt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`),cache_control:x.nullable().optional()}),xt=e.object({tool_use_id:e.string(),type:e.literal(`mcp_tool_result`),cache_control:x.nullable().optional(),content:e.union([e.string(),e.array(T)]).optional(),is_error:e.boolean().optional()}),St=e.object({file_id:e.string(),type:e.literal(`container_upload`),cache_control:x.nullable().optional()}),Ct=e.discriminatedUnion(`type`,[T,E,Ue,D,ot,st,ct,lt,ut,mt,yt,bt,xt,St]),wt=e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`),model:e.string(),content:e.array(A),stop_reason:Ve.nullable().optional(),stop_sequence:e.string().nullable().optional(),usage:b,container:Be.nullable().optional()}),j=_.extend({type:e.literal(`assistant`),message:wt}),Tt=e.object({role:e.enum([`user`,`assistant`]),content:e.union([e.string(),e.array(Ct)])}),Et=b.extend({cache_creation:b.shape.cache_creation.unwrap(),cache_creation_input_tokens:e.number(),cache_read_input_tokens:e.number(),server_tool_use:b.shape.server_tool_use.unwrap(),service_tier:e.enum([`standard`,`priority`,`batch`])}),Dt=e.object({inputTokens:e.number(),outputTokens:e.number(),cacheReadInputTokens:e.number(),cacheCreationInputTokens:e.number(),webSearchRequests:e.number(),costUSD:e.number(),contextWindow:e.number()}),Ot=e.object({tool_name:e.string(),tool_use_id:e.string(),tool_input:e.unknown()}),M=g.extend({type:e.literal(`result`),duration_ms:e.number(),duration_api_ms:e.number(),is_error:e.boolean(),num_turns:e.number(),total_cost_usd:e.number(),usage:Et,modelUsage:e.record(e.string(),Dt),permission_denials:e.array(Ot)}),kt=M.extend({subtype:e.literal(`success`),result:e.string(),structured_output:s.optional()}),At=M.extend({subtype:e.enum([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),errors:e.array(e.string()),stop_reason:e.string().nullable()}),N=e.discriminatedUnion(`subtype`,[kt,At]),jt=e.object({type:e.literal(`message_start`),message:e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`)})}),Mt=e.object({type:e.literal(`message_delta`),delta:e.object({stop_reason:e.string().nullable().optional(),stop_sequence:e.string().nullable().optional(),container:e.object({id:e.string(),expires_at:e.string()}).nullable().optional()}),usage:b}),Nt=e.object({type:e.literal(`message_stop`)}),Pt=e.object({type:e.literal(`content_block_start`),index:e.number(),content_block:A}),Ft=e.object({type:e.literal(`content_block_delta`),index:e.number(),delta:e.discriminatedUnion(`type`,[e.object({type:e.literal(`text_delta`),text:e.string()}),e.object({type:e.literal(`thinking_delta`),thinking:e.string()}),e.object({type:e.literal(`input_json_delta`),partial_json:e.string()}),e.object({type:e.literal(`citations_delta`),citation:C}),e.object({type:e.literal(`signature_delta`),signature:e.string()})])}),It=e.object({type:e.literal(`content_block_stop`),index:e.number()}),Lt=e.discriminatedUnion(`type`,[jt,Mt,Nt,Pt,Ft,It]),P=_.extend({type:e.literal(`stream_event`),event:Lt}),Rt=[`init`,`compact_boundary`],zt=e.enum([`user`,`project`,`org`,`temporary`,`none`]),Bt=e.enum([`default`,`acceptEdits`,`bypassPermissions`,`plan`]),Vt=e.object({name:e.string(),status:e.string()}),Ht=e.object({trigger:e.enum([`manual`,`auto`]),pre_tokens:e.number()}),Ut=g.extend({type:e.literal(`system`),subtype:e.literal(`init`),agents:e.array(e.string()).optional(),apiKeySource:zt,cwd:e.string(),tools:e.array(e.string()),mcp_servers:e.array(Vt),model:e.string(),permissionMode:Bt,slash_commands:e.array(e.string()),output_style:e.string()}),Wt=g.extend({type:e.literal(`system`),subtype:e.literal(`compact_boundary`),compact_metadata:Ht}),Gt=e.discriminatedUnion(`subtype`,[Ut,Wt]),Kt=g.extend({type:e.literal(`system`),subtype:e.string().refine(e=>!Rt.some(t=>t===e))}).passthrough(),F=e.union([Gt,Kt]),I=_.extend({type:e.literal(`user`),message:Tt,isSynthetic:e.boolean().optional(),isCompactSummary:e.boolean().optional(),tool_use_result:e.object({stdout:e.string().optional(),stderr:e.string().optional(),interrupted:e.boolean().optional(),isImage:e.boolean().optional()}).or(e.string()).optional()}).refine(e=>!e.isCompactSummary||e.isSynthetic===!0,{message:`Compact summary messages must be synthetic`,path:[`isCompactSummary`]}),L=e.enum([`idle`,`turn_started`,`step_started`,`step_finished`,`turn_finished`,`paused`]),R=e.object({adapterId:e.string(),agentId:e.string(),oldState:L,newState:L,timestamp:e.number()}),z=e.union([F,j,I,N,P]);e.intersection(z,e.object({agentId:e.string()}));const B=e.object({used_percentage:e.number().optional(),resets_at:e.number().optional()}).passthrough(),qt=e.object({five_hour:B.optional(),seven_day:B.optional()}).passthrough(),Jt=e.object({input_tokens:e.number().optional(),output_tokens:e.number().optional(),cache_creation_input_tokens:e.number().optional(),cache_read_input_tokens:e.number().optional()}).passthrough();e.object({cwd:e.string().optional(),session_id:e.string().optional(),session_name:e.string().optional(),transcript_path:e.string().optional(),model:e.object({id:e.string().optional(),display_name:e.string().optional(),family:e.string().optional()}).passthrough().optional(),workspace:e.object({current_dir:e.string().optional(),project_dir:e.string().optional(),added_dirs:e.array(e.string()).optional(),git_worktree:e.string().optional()}).passthrough().optional(),version:e.string().optional(),output_style:e.object({name:e.string().optional(),variant:e.string().optional()}).passthrough().optional(),cost:e.object({total_cost_usd:e.number().optional(),total_duration_ms:e.number().optional(),total_api_duration_ms:e.number().optional(),total_lines_added:e.number().optional(),total_lines_removed:e.number().optional(),total_edits:e.number().optional()}).passthrough().optional(),context_window:e.object({total_input_tokens:e.number().optional(),total_output_tokens:e.number().optional(),context_window_size:e.number().optional(),used_percentage:e.number().nullable().optional(),remaining_percentage:e.number().nullable().optional(),current_usage:Jt.nullable().optional()}).passthrough().nullable().optional(),exceeds_200k_tokens:e.boolean().optional(),rate_limits:qt.optional(),vim:e.object({mode:e.string().optional()}).passthrough().optional(),agent:e.object({name:e.string().optional(),kind:e.string().optional()}).passthrough().optional(),worktree:e.object({name:e.string().optional(),path:e.string().optional(),branch:e.string().optional(),original_cwd:e.string().optional(),original_branch:e.string().optional(),provider:e.string().optional()}).passthrough().optional()}).passthrough();const V=e.enum([`user`,`project`,`local`]),H=e.object({type:e.literal(`command`),command:e.string().min(1),padding:e.number().optional()}),U=e.object({type:e.literal(`command`),command:e.string().min(1),timeout:e.number().optional()}),W=e.object({matcher:e.string().optional(),hooks:e.array(U)}),G=e.object({type:e.string().min(1),url:e.string().optional(),command:e.string().optional(),args:e.array(e.string()).optional(),env:e.record(e.string(),e.string()).optional()}).passthrough(),Yt=e.object({scope:V,path:e.string(),value:H.nullable()}),Xt=e.object({scope:V,path:e.string(),events:e.record(e.string(),e.array(W))}),Zt=e.object({name:e.string().min(1),enabled:e.boolean(),scope:V});e.object({projectDir:f.optional()}),e.object({effective:H.nullable(),perScope:e.array(Yt)}),e.object({scope:V,projectDir:f.optional(),value:H}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({previous:H.nullable(),applied:H}),e.object({eventName:e.string().optional(),projectDir:f.optional()}),e.object({effective:e.record(e.string(),e.array(W)),perScope:e.array(Xt)}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),matcher:e.string().min(1).optional(),hook:U}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({added:e.boolean()}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),match:e.object({commandContains:e.string().min(1)})}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({removed:e.number()}),e.object({projectDir:f.optional()}),e.object({plugins:e.array(Zt)}),e.object({projectDir:f}),e.object({servers:e.record(e.string(),G)}),e.object({projectDir:f,name:e.string().min(1),server:G}),e.object({added:e.boolean(),replaced:e.boolean()}),e.object({projectDir:f,name:e.string().min(1)}),e.object({removed:e.boolean()}),e.object({projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional()}),e.object({scope:V,projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional(),configDir:f.optional(),skipDangerousModePermissionPrompt:e.boolean().optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({scope:V,projectDir:f.optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]});const Qt={none:0,low:4e3,medium:8e3,high:16e3,"extra-high":32e3},$t=e.intersection(z,e.object({originatingMessageId:e.string().optional()})),en=/(?:api[_-]?key|authorization|bearer|credential|password|private[_-]?key|secret|token|(?:^|[_-])key(?:$|[_-])|(?:^|[_-])pat(?:$|[_-]))/i,tn=/^(?:message|content|prompt|text|output)$/i;function nn(e){return e.length>80?`${e.slice(0,80)}... [redacted-text]`:`[redacted-text]`}function K(e){return Array.isArray(e.errors)?e.errors.flatMap(e=>Array.isArray(e)?e.flatMap(e=>K(e)):[]):[`${e.path?.map(String).join(`.`)||`(root)`}: ${e.message??`Invalid input`}`]}function q(e,t){if(e&&e!==`apiKeySource`&&en.test(e))return`[redacted]`;if(typeof t==`string`&&(e&&tn.test(e)||t.length>80))return nn(t);if(Array.isArray(t))return t.map(e=>q(void 0,e));if(t&&typeof t==`object`){let e={};for(let[n,r]of Object.entries(t))e[n]=q(n,r);return e}return t}function rn(e){let t=q(void 0,e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function an(e){let t={subject:e.subject,issues:e.issues.flatMap(e=>K(e)),sample:rn(e.payload)};console.warn(`[BUS:VIOLATION] ${JSON.stringify(t)}`)}function on(e,t){return re(e,{"sdk.event":$t,can_use_tool:ne,system:F,assistant:j,user:I,result:N,stream_event:P,"turn.state_changed":R,"turn.turn_started":R,"turn.step_started":R,"turn.step_finished":R,"turn.turn_finished":R,"turn.paused":R},t??{busValidationMode:`lenient`,onSchemaViolation:an})}function J(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}catch{return``}}const Y=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];function sn(e,t,n){return e!==void 0&&t.includes(e)?e:n}function X(e,t){return e.type===`base64`?{type:`image`,source:{type:`base64`,data:e.data,media_type:sn(t??u(e.mimeType),Y,`image/jpeg`)}}:{type:`image`,source:{type:`url`,url:e.url}}}function Z(e){return{type:`text`,data:e,media_type:`text/plain`}}function cn(e){return e.type===`base64`?u(e.mimeType)===`text/plain`?{type:`document`,source:Z(J(e.data))}:{type:`document`,source:{type:`base64`,data:e.data,media_type:`application/pdf`}}:{type:`document`,source:{type:`url`,url:e.url}}}function Q(e){let{source:t}=e;if(t.type===`base64`){let e=u(t.mimeType);if(Y.includes(e))return X(t,e);if(e===`application/pdf`)return{type:`document`,source:{type:`base64`,data:t.data,media_type:`application/pdf`}};if(se(e))return{type:`document`,source:Z(J(t.data))}}return{type:`text`,text:d(e)}}function $(e){return e.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.content};case`image`:{let t=e.source.type===`base64`?u(e.source.mimeType):void 0;return X(e.source,t)}case`document`:return cn(e.source);case`attachment`:return Q(e);default:return{type:`text`,text:d(e)}}})}const ln=250;function un(e){if(e.type!==`assistant`)return``;let t=e.message.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&`text`in e).map(e=>e.text).join(``):``}function dn(e,o,s){let c=typeof o==`string`?o:``;switch(e){case`rate_limit_error`:return new a(c||`Rate limit exceeded`);case`authentication_error`:case`permission_error`:return new t(c||`Authentication failed`);case`overloaded_error`:return new i(c||`Service overloaded`);case`not_found_error`:{let e=typeof s==`string`?s.match(/model: ([^"]*)/)?.[1]:null;return e?new n(e):new r(c||`Model not found`)}default:return null}}function fn(e){return e.subtype!==`success`&&e.errors&&e.errors.length>0?e.errors.join(`
|
|
3
|
-
`):e.subtype===`success`&&e.is_error&&e.result?e.result:e.subtype}function
|
|
2
|
+
`)}function _e(e){return e.type!==`tool_use`||!e.id||!e.name?null:{toolCallId:e.id,toolName:e.name}}var ve=class extends ee{supportsNativeResume(){return!0}supportsNativeFork(){return!0}currentStepType=`text`;currentTextContent=``;currentReasoningContent=``;currentToolCall=null;toolBlockIndexMap=new Map;currentToolArgsJson=``;wireEvents(e){let t=e;this.wireConnectorEvents(t),this.wireToolApprovalRpc(e)}subscribeClaudeConnector(e,t,n,r){this.addConnectorWiringCleanup(e.on(t,n,r))}wireConnectorEvents(e){let t=this.getSubjects();this.subscribeClaudeConnector(e,t.sdk.event,async e=>{let t=e.payload,n=t.originatingMessageId;switch(t.type){case`system`:t.subtype===`init`&&await this.emitStart();break;case`assistant`:{let e=t.message?.content;if(!e)break;await ce(e,h,async(e,t)=>{if(e.subject===`tool.use`){if(n===void 0)return;let e=t;await this.emitToolUse(n,e.toolName,e.args,e.toolCallId)}else if(e.subject===`tool.started`||e.subject===`tool.completed`){if(n===void 0)return;await this.emitGlobal(e,{...t,messageId:n})}else await this.emitGlobal(e,t)});break}case`stream_event`:{let e=t.event;e.type===`content_block_start`?await this.handleContentBlockStart(e,n):e.type===`content_block_stop`?await this.handleContentBlockStop(e):e.type===`content_block_delta`&&await this.handleContentBlockDelta(e);break}case`result`:await this.handleResultEvent(t);break;case`user`:await this.handleUserEvent(t,n);break}})}async handleContentBlockStart(e,t){let n=e.content_block,r=_e(n),i=n.type===`thinking`?`reasoning`:n.type===`tool_use`?`tool_use`:`text`;this.currentStepType=i,this.currentTextContent=``,this.currentReasoningContent=``,this.currentToolArgsJson=``,this.currentToolCall=null;let a=r?{type:`tool_use`,toolName:r.toolName,toolCallId:r.toolCallId}:n.type===`tool_use`?void 0:{type:i},s;if(r&&(this.currentToolCall={toolCallId:r.toolCallId,name:r.toolName,args:{}},this.toolBlockIndexMap.set(r.toolCallId,e.index),s={type:`tool_call`,toolCallId:r.toolCallId,name:r.toolName,args:{}}),n.type===`tool_use`&&!r&&console.warn(`[ClaudeCodeAdapter] Received tool_use block without id or name; skipping tool correlation setup`),r&&t===void 0){console.warn(`[ClaudeCodeAdapter] Received tool_use block without originating message identity; skipping tool events`);return}await this.emitGlobal(o.step.started,{...t!==void 0&&{messageId:t},stepType:i,blockIndex:e.index,blockData:a,content:s}),r&&await this.emitGlobal(o.tool.started,{...t!==void 0&&{messageId:t},toolName:r.toolName,toolCallId:r.toolCallId})}async handleContentBlockStop(e){if(this.currentStepType!==`tool_use`){let t=this.currentStepType===`text`?{type:`text`,content:this.currentTextContent}:{type:`reasoning`,content:this.currentReasoningContent};await this.emitGlobal(o.step.finished,{stepType:this.currentStepType,blockIndex:e.index,content:t})}else if(this.currentToolCall&&this.currentToolArgsJson)try{this.currentToolCall.args=JSON.parse(this.currentToolArgsJson)}catch{}}async handleContentBlockDelta(e){let t=e.delta;switch(t.type){case`text_delta`:this.currentTextContent+=t.text,await this.emitGlobal(o.message_delta,{text:t.text});break;case`thinking_delta`:this.currentReasoningContent+=t.thinking,await this.emitGlobal(o.reasoning_delta,{content:t.thinking});break;case`input_json_delta`:`partial_json`in t&&(this.currentToolArgsJson+=t.partial_json);break}}async handleResultEvent(e){if(e.usage){let t=e.usage;await this.trackUsage(fe(t,e.total_cost_usd)),await this.emitContextWindowUpdate({currentTokens:pe(t),maxTokens:this.getContextWindowSize()??2e5,cachedTokens:t.cache_read_input_tokens})}}async handleUserEvent(e,t){await me({messageId:t,payload:e,resolveToolOutput:async(e,t,n)=>await this.emitToolOutput(e,t,{nativeId:n}),emitToolCompleted:async e=>await this.emitGlobal(o.tool.completed,e),emitToolStepFinished:async e=>await this.emitGlobal(o.step.finished,{stepType:`tool_use`,blockIndex:e.blockIndex,content:{type:`tool_output`,toolCallId:e.toolCallId,output:e.output,isError:e.isError}}),consumeToolBlockIndex:e=>this.consumeToolBlockIndex(e)})}consumeToolBlockIndex(e){if(e===void 0)return-1;let t=this.toolBlockIndexMap.get(e);return this.toolBlockIndexMap.delete(e),t===void 0&&console.warn(`[ClaudeCodeAdapter] toolCallId ${e} not found in toolBlockIndexMap - possible state mismatch`),t??-1}wireToolApprovalRpc(e){this.addConnectorWiringCleanup(m(e,this.getSubjects(),async()=>({adapterId:this.adapterId,adapterName:this.adapterName,agentId:this.agentId,adapterSessionId:await this.getAdapterSessionId(),sessionId:this.sessionId}),this.globalBus))}},ye=class{queue=[];resolvers=[];done=!1;async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else if(this.done)return;else yield await new Promise(e=>{this.resolvers.push(t=>{t.done||e(t.value)})})}push(e){if(this.done)throw Error(`Cannot push to completed source`);this.resolvers.length>0?this.resolvers.shift()({value:e,done:!1}):this.queue.push(e)}complete(){this.done=!0;for(let e of this.resolvers)e({value:void 0,done:!0});this.resolvers=[]}clear(){this.queue=[]}},be=class extends te{queryInstance;activeMessageHandle;pausedDeferred;isPausedFlag=!1;connectorBus;subjects;agentId;expectingInterruptResult=!1;constructor(e,t,n,r,i,a,o){super(e,n,r,`idle`),this.connectorBus=e,this.subjects=t,this.agentId=i,this.queryInstance=a,this.activeMessageHandle=o}setActiveMessageHandle(e){this.activeMessageHandle=e}async emitStateChange(e,t){let n={adapterId:this.adapterId,agentId:this.agentId,oldState:e,newState:t,timestamp:Date.now()};switch(await this.connectorBus.emit(this.subjects.turn.state_changed,n),t){case`turn_started`:await this.connectorBus.emit(this.subjects.turn.turn_started,n);break;case`step_started`:await this.connectorBus.emit(this.subjects.turn.step_started,n);break;case`step_finished`:await this.connectorBus.emit(this.subjects.turn.step_finished,n);break;case`turn_finished`:await this.connectorBus.emit(this.subjects.turn.turn_finished,n);break;case`paused`:await this.connectorBus.emit(this.subjects.turn.paused,n);break}}async start(){await this.transitionTo(`turn_started`)}async pause(){if(this.state===`turn_finished`)return{stateBeforePause:this.state,turnEnded:!0};if(this.isPausedFlag)return{stateBeforePause:this.state,turnEnded:!1};if(this.state!==`step_finished`&&(await this.waitForStepFinished(),this.getState()===`turn_finished`)||(await this.queryInstance.interrupt(),this.getState()===`turn_finished`))return{stateBeforePause:this.state,turnEnded:!0};this.expectingInterruptResult=!0,this.isPausedFlag=!0;let e=this.state;return await this.transitionTo(`paused`),{stateBeforePause:e,turnEnded:!1}}async resume(e){if(!this.isPausedFlag)throw Error(`Cannot resume - turn not paused`);this.isPausedFlag=!1,await this.transitionTo(`step_started`)}isPaused(){return this.isPausedFlag}async handleSdkEvent(e){if(e.type===`stream_event`)e.event.type===`content_block_start`?await this.transitionTo(`step_started`):e.event.type===`content_block_stop`&&(await this.transitionTo(`step_finished`),this.pausedDeferred?.resolve());else if(e.type===`result`){if(this.expectingInterruptResult){this.expectingInterruptResult=!1;return}await this.transitionTo(`turn_finished`)}}isExpectingInterruptResult(){return this.expectingInterruptResult}async finishOnError(){this.pausedDeferred?.resolve(),this.pausedDeferred=void 0,this.isPausedFlag=!1,this.expectingInterruptResult=!1,this.state!==`turn_finished`&&await this.transitionTo(`turn_finished`)}async waitForStepFinished(){if(this.state!==`step_finished`){this.pausedDeferred=new le;try{await this.pausedDeferred.getPromise()}finally{this.pausedDeferred=void 0}}}isCompleted(){return this.state===`turn_finished`}canAcceptImmediate(){return this.state!==`turn_finished`&&!this.isPausedFlag}};const g=Object.freeze({approve:`claude-code.tool-response.approve`,deny:`claude-code.tool-response.deny`});c({id:`claude-code`,name:`Claude Code`,version:`0.1.0`,description:`Anthropic Claude Code CLI — an agentic coding assistant`,binary:{name:`claude`,supportedVersions:`^2.1.143`},managedInstall:{type:`signed-binary-bucket`,version:`2.1.143`,config:{baseUrl:`https://downloads.claude.ai/claude-code-releases`,manifestPathTemplate:`{version}/manifest.json`,manifestSignaturePathTemplate:`{version}/manifest.json.sig`,publicKeyUrl:`https://downloads.claude.ai/keys/claude-code.asc`,publicKeyFingerprint:`31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`,binaryPathTemplate:`{version}/{platform}/{binary}`,platforms:{"darwin-arm64":`darwin-arm64`,"darwin-x64":`darwin-x64`,"linux-arm64":`linux-arm64`,"linux-x64":`linux-x64`,"linux-arm64-musl":`linux-arm64-musl`,"linux-x64-musl":`linux-x64-musl`,"win32-arm64":`win32-arm64`,"win32-x64":`win32-x64`}}},versionCommand:{executable:{default:`claude`,win32:`claude.exe`},args:[`--version`]},configIsolation:{envVar:`CLAUDE_CONFIG_DIR`,defaultPath:`~/.claude`},nativeTools:[{name:`bash`,friendlyName:`Terminal`,description:`Execute shell commands`,category:`System`,capabilities:[{tag:`shell.execute`},{tag:`file.read`},{tag:`file.write`},{tag:`file.delete`},{tag:`network.request`},{tag:`process.manage`}]},{name:`text_editor`,friendlyName:`Text Editor`,description:`View and edit files`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`file.write`}]},{name:`list_directory`,friendlyName:`List Directory`,description:`List directory contents`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`search.files`}]},{name:`read_file`,friendlyName:`Read File`,description:`Read file contents`,category:`Files`,capabilities:[{tag:`file.read`}]},{name:`write_file`,friendlyName:`Write File`,description:`Write content to a file`,category:`Files`,capabilities:[{tag:`file.write`}]}],defaultApprovalPolicy:`full-access`,authMethods:[{id:`native`,mode:`inferred`,label:`Native account`},{id:`oauth-token`,mode:`explicit`,label:`OAuth token`,fields:[{id:`oauthToken`,label:`OAuth token`,required:!0,secret:!0,sourceHints:[{kind:`environment`,variable:`CLAUDE_CODE_OAUTH_TOKEN`}]}]}],defaultAuth:{providerDefinitionId:`anthropic-oauth`,methodId:`native`},runtimeCapabilities:{supportsHooks:!0,supportsStatusline:!0,supportsSupervisorLaunch:!1,supportsManagedBinary:!0,hookEvents:[{name:`SessionStart`,frameworkSubject:`client.session.started`},{name:`UserPromptSubmit`,frameworkSubject:`client.session.userPrompt.submitted`},{name:`PreToolUse`,frameworkSubject:`client.session.tool.pre`,responseCapabilities:[g.approve,g.deny,`context.append`]},{name:`PostToolUse`,frameworkSubject:`client.session.tool.post`},{name:`Stop`,frameworkSubject:`client.session.turn.completed`},{name:`SubagentStop`},{name:`Notification`},{name:`MCPServerStart`},{name:`MCPServerStop`}]}});const _=e.object({uuid:e.string(),session_id:e.string(),type:e.string(),correlation_id:e.string().optional(),agentId:e.string().optional(),timestamp:e.string().optional(),cwd:e.string().optional()}),v=_.extend({parent_tool_use_id:e.string().nullable().optional()});_.required({agentId:!0}).extend({parent_tool_use_id:e.string().nullable().optional()});const y=e.enum([`invalid_tool_input`,`unavailable`,`too_many_requests`,`execution_time_exceeded`]),b=e.object({web_search_requests:e.number()}),xe=e.object({ephemeral_1h_input_tokens:e.number(),ephemeral_5m_input_tokens:e.number()}),x=e.object({cache_creation:xe.nullable().optional(),cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number(),output_tokens:e.number(),server_tool_use:b.nullable().optional(),service_tier:e.enum([`standard`,`priority`,`batch`]).nullable().optional()});e.object({cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number().nullable().optional(),output_tokens:e.number(),server_tool_use:b.nullable().optional()});const S=e.object({type:e.literal(`ephemeral`),ttl:e.enum([`5m`,`1h`]).optional()}),Se=e.object({data:e.string(),media_type:e.enum([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),type:e.literal(`base64`)}),Ce=e.object({type:e.literal(`url`),url:e.string()}),we=e.object({file_id:e.string(),type:e.literal(`file`)}),Te=e.discriminatedUnion(`type`,[Se,Ce,we]),Ee=e.object({data:e.string(),media_type:e.literal(`application/pdf`),type:e.literal(`base64`)}),De=e.object({type:e.literal(`url`),url:e.string()}),Oe=e.object({file_id:e.string(),type:e.literal(`file`)}),ke=e.object({data:e.string(),media_type:e.literal(`text/plain`),type:e.literal(`text`)}),Ae=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),file_id:e.string().nullable().optional(),start_char_index:e.number(),type:e.literal(`char_location`)}),je=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),start_char_index:e.number(),type:e.literal(`char_location`)}),Me=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),file_id:e.string().nullable().optional(),start_page_number:e.number(),type:e.literal(`page_location`)}),Ne=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),start_page_number:e.number(),type:e.literal(`page_location`)}),Pe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),file_id:e.string().nullable().optional(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Fe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Ie=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Le=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Re=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),ze=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),C=e.discriminatedUnion(`type`,[Ae,Me,Pe,Ie,Re]),Be=e.discriminatedUnion(`type`,[je,Ne,Fe,Le,ze]);e.object({citation:C,type:e.literal(`citations_delta`)});const w=e.object({enabled:e.boolean().optional()}),Ve=e.object({id:e.string(),expires_at:e.string()}),He=e.enum([`end_turn`,`max_tokens`,`stop_sequence`,`tool_use`,`pause_turn`,`refusal`]),T=e.object({text:e.string(),type:e.literal(`text`),cache_control:S.nullable().optional(),citations:e.array(Be).nullable().optional()}),E=e.object({source:Te,type:e.literal(`image`),cache_control:S.nullable().optional()}),Ue=e.object({content:e.union([e.string(),e.array(e.union([T,E]))]),type:e.literal(`content`)}),We=e.object({source:e.union([Ee,ke,Ue,De,Oe]),type:e.literal(`document`),cache_control:S.nullable().optional(),citations:w.optional(),context:e.string().nullable().optional(),title:e.string().nullable().optional()}),D=e.object({content:e.array(T),source:e.string(),title:e.string(),type:e.literal(`search_result`),cache_control:S.nullable().optional(),citations:w.optional()}),O=e.object({citations:e.array(C).nullable().optional(),text:e.string(),type:e.literal(`text`)}),k=e.object({signature:e.string(),thinking:e.string(),type:e.literal(`thinking`)}),Ge=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),Ke=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),type:e.literal(`tool_use`)}),qe=e.object({id:e.string(),input:e.looseObject({}),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`)}),Je=e.object({encrypted_content:e.string(),page_age:e.string().nullable().optional(),title:e.string(),type:e.literal(`web_search_result`),url:e.string()}),Ye=e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),Xe=e.object({error_code:Ye,type:e.literal(`web_search_tool_result_error`)}),Ze=e.union([Xe,e.array(Je)]),Qe=e.object({content:Ze,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`)}),$e=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),et=e.object({content:e.array($e),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),tt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),nt=e.union([tt,et]),rt=e.object({content:nt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`)}),it=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`)}),at=e.object({content:e.union([e.string(),e.array(O)]),is_error:e.boolean(),tool_use_id:e.string(),type:e.literal(`mcp_tool_result`)}),ot=e.object({file_id:e.string(),type:e.literal(`container_upload`)}),A=e.discriminatedUnion(`type`,[O,k,Ge,Ke,qe,Qe,rt,it,at,ot]),st=k.extend({}),ct=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),lt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),type:e.literal(`tool_use`),cache_control:S.nullable().optional()}),ut=e.object({tool_use_id:e.string(),type:e.literal(`tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(e.union([T,E,D]))]).optional(),is_error:e.boolean().optional()}),dt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`),cache_control:S.nullable().optional()}),ft=e.object({encrypted_content:e.string(),title:e.string(),type:e.literal(`web_search_result`),url:e.string(),page_age:e.string().nullable().optional()}),pt=e.object({error_code:e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),type:e.literal(`web_search_tool_result_error`)}),mt=e.union([e.array(ft),pt]),ht=e.object({content:mt,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`),cache_control:S.nullable().optional()}),gt=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),_t=e.object({content:e.array(gt),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),vt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),yt=e.union([vt,_t]),bt=e.object({content:yt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`),cache_control:S.nullable().optional()}),xt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`),cache_control:S.nullable().optional()}),St=e.object({tool_use_id:e.string(),type:e.literal(`mcp_tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(T)]).optional(),is_error:e.boolean().optional()}),Ct=e.object({file_id:e.string(),type:e.literal(`container_upload`),cache_control:S.nullable().optional()}),wt=e.discriminatedUnion(`type`,[T,E,We,D,st,ct,lt,ut,dt,ht,bt,xt,St,Ct]),Tt=e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`),model:e.string(),content:e.array(A),stop_reason:He.nullable().optional(),stop_sequence:e.string().nullable().optional(),usage:x,container:Ve.nullable().optional()}),j=v.extend({type:e.literal(`assistant`),message:Tt}),Et=e.object({role:e.enum([`user`,`assistant`]),content:e.union([e.string(),e.array(wt)])}),Dt=x.extend({cache_creation:x.shape.cache_creation.unwrap(),cache_creation_input_tokens:e.number(),cache_read_input_tokens:e.number(),server_tool_use:x.shape.server_tool_use.unwrap(),service_tier:e.enum([`standard`,`priority`,`batch`])}),Ot=e.object({inputTokens:e.number(),outputTokens:e.number(),cacheReadInputTokens:e.number(),cacheCreationInputTokens:e.number(),webSearchRequests:e.number(),costUSD:e.number(),contextWindow:e.number()}),kt=e.object({tool_name:e.string(),tool_use_id:e.string(),tool_input:e.unknown()}),M=_.extend({type:e.literal(`result`),duration_ms:e.number(),duration_api_ms:e.number(),is_error:e.boolean(),num_turns:e.number(),total_cost_usd:e.number(),usage:Dt,modelUsage:e.record(e.string(),Ot),permission_denials:e.array(kt)}),At=M.extend({subtype:e.literal(`success`),result:e.string(),structured_output:s.optional()}),jt=M.extend({subtype:e.enum([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),errors:e.array(e.string()),stop_reason:e.string().nullable()}),N=e.discriminatedUnion(`subtype`,[At,jt]),Mt=e.object({type:e.literal(`message_start`),message:e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`)})}),Nt=e.object({type:e.literal(`message_delta`),delta:e.object({stop_reason:e.string().nullable().optional(),stop_sequence:e.string().nullable().optional(),container:e.object({id:e.string(),expires_at:e.string()}).nullable().optional()}),usage:x}),Pt=e.object({type:e.literal(`message_stop`)}),Ft=e.object({type:e.literal(`content_block_start`),index:e.number(),content_block:A}),It=e.object({type:e.literal(`content_block_delta`),index:e.number(),delta:e.discriminatedUnion(`type`,[e.object({type:e.literal(`text_delta`),text:e.string()}),e.object({type:e.literal(`thinking_delta`),thinking:e.string()}),e.object({type:e.literal(`input_json_delta`),partial_json:e.string()}),e.object({type:e.literal(`citations_delta`),citation:C}),e.object({type:e.literal(`signature_delta`),signature:e.string()})])}),Lt=e.object({type:e.literal(`content_block_stop`),index:e.number()}),Rt=e.discriminatedUnion(`type`,[Mt,Nt,Pt,Ft,It,Lt]),P=v.extend({type:e.literal(`stream_event`),event:Rt}),zt=[`init`,`compact_boundary`],Bt=e.enum([`user`,`project`,`org`,`temporary`,`none`]),Vt=e.enum([`default`,`acceptEdits`,`bypassPermissions`,`plan`]),Ht=e.object({name:e.string(),status:e.string()}),Ut=e.object({trigger:e.enum([`manual`,`auto`]),pre_tokens:e.number()}),Wt=_.extend({type:e.literal(`system`),subtype:e.literal(`init`),agents:e.array(e.string()).optional(),apiKeySource:Bt,cwd:e.string(),tools:e.array(e.string()),mcp_servers:e.array(Ht),model:e.string(),permissionMode:Vt,slash_commands:e.array(e.string()),output_style:e.string()}),Gt=_.extend({type:e.literal(`system`),subtype:e.literal(`compact_boundary`),compact_metadata:Ut}),Kt=e.discriminatedUnion(`subtype`,[Wt,Gt]),qt=_.extend({type:e.literal(`system`),subtype:e.string().refine(e=>!zt.some(t=>t===e))}).passthrough(),F=e.union([Kt,qt]),I=v.extend({type:e.literal(`user`),message:Et,isSynthetic:e.boolean().optional(),isCompactSummary:e.boolean().optional(),tool_use_result:e.object({stdout:e.string().optional(),stderr:e.string().optional(),interrupted:e.boolean().optional(),isImage:e.boolean().optional()}).or(e.string()).optional()}).refine(e=>!e.isCompactSummary||e.isSynthetic===!0,{message:`Compact summary messages must be synthetic`,path:[`isCompactSummary`]}),L=e.enum([`idle`,`turn_started`,`step_started`,`step_finished`,`turn_finished`,`paused`]),R=e.object({adapterId:e.string(),agentId:e.string(),oldState:L,newState:L,timestamp:e.number()}),z=e.union([F,j,I,N,P]);e.intersection(z,e.object({agentId:e.string()}));const B=e.object({used_percentage:e.number().optional(),resets_at:e.number().optional()}).passthrough(),Jt=e.object({five_hour:B.optional(),seven_day:B.optional()}).passthrough(),Yt=e.object({input_tokens:e.number().optional(),output_tokens:e.number().optional(),cache_creation_input_tokens:e.number().optional(),cache_read_input_tokens:e.number().optional()}).passthrough();e.object({cwd:e.string().optional(),session_id:e.string().optional(),session_name:e.string().optional(),transcript_path:e.string().optional(),model:e.object({id:e.string().optional(),display_name:e.string().optional(),family:e.string().optional()}).passthrough().optional(),workspace:e.object({current_dir:e.string().optional(),project_dir:e.string().optional(),added_dirs:e.array(e.string()).optional(),git_worktree:e.string().optional()}).passthrough().optional(),version:e.string().optional(),output_style:e.object({name:e.string().optional(),variant:e.string().optional()}).passthrough().optional(),cost:e.object({total_cost_usd:e.number().optional(),total_duration_ms:e.number().optional(),total_api_duration_ms:e.number().optional(),total_lines_added:e.number().optional(),total_lines_removed:e.number().optional(),total_edits:e.number().optional()}).passthrough().optional(),context_window:e.object({total_input_tokens:e.number().optional(),total_output_tokens:e.number().optional(),context_window_size:e.number().optional(),used_percentage:e.number().nullable().optional(),remaining_percentage:e.number().nullable().optional(),current_usage:Yt.nullable().optional()}).passthrough().nullable().optional(),exceeds_200k_tokens:e.boolean().optional(),rate_limits:Jt.optional(),vim:e.object({mode:e.string().optional()}).passthrough().optional(),agent:e.object({name:e.string().optional(),kind:e.string().optional()}).passthrough().optional(),worktree:e.object({name:e.string().optional(),path:e.string().optional(),branch:e.string().optional(),original_cwd:e.string().optional(),original_branch:e.string().optional(),provider:e.string().optional()}).passthrough().optional()}).passthrough();const V=e.enum([`user`,`project`,`local`]),H=e.object({type:e.literal(`command`),command:e.string().min(1),padding:e.number().optional()}),U=e.object({type:e.literal(`command`),command:e.string().min(1),timeout:e.number().optional()}),W=e.object({matcher:e.string().optional(),hooks:e.array(U)}),G=e.object({type:e.string().min(1),url:e.string().optional(),command:e.string().optional(),args:e.array(e.string()).optional(),env:e.record(e.string(),e.string()).optional()}).passthrough(),Xt=e.object({scope:V,path:e.string(),value:H.nullable()}),Zt=e.object({scope:V,path:e.string(),events:e.record(e.string(),e.array(W))}),Qt=e.object({name:e.string().min(1),enabled:e.boolean(),scope:V});e.object({projectDir:f.optional()}),e.object({effective:H.nullable(),perScope:e.array(Xt)}),e.object({scope:V,projectDir:f.optional(),value:H}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({previous:H.nullable(),applied:H}),e.object({eventName:e.string().optional(),projectDir:f.optional()}),e.object({effective:e.record(e.string(),e.array(W)),perScope:e.array(Zt)}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),matcher:e.string().min(1).optional(),hook:U}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({added:e.boolean()}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),match:e.object({commandContains:e.string().min(1)})}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({removed:e.number()}),e.object({projectDir:f.optional()}),e.object({plugins:e.array(Qt)}),e.object({projectDir:f}),e.object({servers:e.record(e.string(),G)}),e.object({projectDir:f,name:e.string().min(1),server:G}),e.object({added:e.boolean(),replaced:e.boolean()}),e.object({projectDir:f,name:e.string().min(1)}),e.object({removed:e.boolean()}),e.object({projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional()}),e.object({scope:V,projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional(),configDir:f.optional(),skipDangerousModePermissionPrompt:e.boolean().optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({scope:V,projectDir:f.optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]});const $t={none:0,low:4e3,medium:8e3,high:16e3,"extra-high":32e3},en=e.intersection(z,e.object({originatingMessageId:e.string().optional()})),tn=/(?:api[_-]?key|authorization|bearer|credential|password|private[_-]?key|secret|token|(?:^|[_-])key(?:$|[_-])|(?:^|[_-])pat(?:$|[_-]))/i,nn=/^(?:message|content|prompt|text|output)$/i;function rn(e){return e.length>80?`${e.slice(0,80)}... [redacted-text]`:`[redacted-text]`}function K(e){return Array.isArray(e.errors)?e.errors.flatMap(e=>Array.isArray(e)?e.flatMap(e=>K(e)):[]):[`${e.path?.map(String).join(`.`)||`(root)`}: ${e.message??`Invalid input`}`]}function q(e,t){if(e&&e!==`apiKeySource`&&tn.test(e))return`[redacted]`;if(typeof t==`string`&&(e&&nn.test(e)||t.length>80))return rn(t);if(Array.isArray(t))return t.map(e=>q(void 0,e));if(t&&typeof t==`object`){let e={};for(let[n,r]of Object.entries(t))e[n]=q(n,r);return e}return t}function an(e){let t=q(void 0,e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function on(e){let t={subject:e.subject,issues:e.issues.flatMap(e=>K(e)),sample:an(e.payload)};console.warn(`[BUS:VIOLATION] ${JSON.stringify(t)}`)}function J(e,t){return re(e,{"sdk.event":en,can_use_tool:ne,system:F,assistant:j,user:I,result:N,stream_event:P,"turn.state_changed":R,"turn.turn_started":R,"turn.step_started":R,"turn.step_finished":R,"turn.turn_finished":R,"turn.paused":R},t??{busValidationMode:`lenient`,onSchemaViolation:on})}function Y(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}catch{return``}}const X=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];function sn(e,t,n){return e!==void 0&&t.includes(e)?e:n}function Z(e,t){return e.type===`base64`?{type:`image`,source:{type:`base64`,data:e.data,media_type:sn(t??u(e.mimeType),X,`image/jpeg`)}}:{type:`image`,source:{type:`url`,url:e.url}}}function Q(e){return{type:`text`,data:e,media_type:`text/plain`}}function cn(e){return e.type===`base64`?u(e.mimeType)===`text/plain`?{type:`document`,source:Q(Y(e.data))}:{type:`document`,source:{type:`base64`,data:e.data,media_type:`application/pdf`}}:{type:`document`,source:{type:`url`,url:e.url}}}function ln(e){let{source:t}=e;if(t.type===`base64`){let e=u(t.mimeType);if(X.includes(e))return Z(t,e);if(e===`application/pdf`)return{type:`document`,source:{type:`base64`,data:t.data,media_type:`application/pdf`}};if(se(e))return{type:`document`,source:Q(Y(t.data))}}return{type:`text`,text:d(e)}}function $(e){return e.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.content};case`image`:{let t=e.source.type===`base64`?u(e.source.mimeType):void 0;return Z(e.source,t)}case`document`:return cn(e.source);case`attachment`:return ln(e);default:return{type:`text`,text:d(e)}}})}const un=250;function dn(e){if(e.type!==`assistant`)return``;let t=e.message.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&`text`in e).map(e=>e.text).join(``):``}function fn(e,o,s){let c=typeof o==`string`?o:``;switch(e){case`rate_limit_error`:return new a(c||`Rate limit exceeded`);case`authentication_error`:case`permission_error`:return new t(c||`Authentication failed`);case`overloaded_error`:return new i(c||`Service overloaded`);case`not_found_error`:{let e=typeof s==`string`?s.match(/model: ([^"]*)/)?.[1]:null;return e?new n(e):new r(c||`Model not found`)}default:return null}}function pn(e){return e.subtype!==`success`&&e.errors&&e.errors.length>0?e.errors.join(`
|
|
3
|
+
`):e.subtype===`success`&&e.is_error&&e.result?e.result:e.subtype}function mn(e){let n=e.toLowerCase();return n.includes(`rate limit`)||n.includes(`rate_limit`)?new a(e):n.includes(`quota`)||n.includes(`overloaded`)?new i(e):n.includes(`authentication`)||n.includes(`unauthorized`)||n.includes(`permission`)?new t(e):n.includes(`model`)&&(n.includes(`not found`)||n.includes(`unavailable`))?new r(e):null}function hn(e){let t=e.subtype===`success`&&e.is_error,n=pn(e);return fn(e.subtype,n,e.result)||(t&&typeof e.result==`string`?mn(e.result)||e.result:n)}function gn(e,t,n){let r={type:`text`,text:oe(t,n)},i=e.message.content,a=Array.isArray(i)?i:[{type:`text`,text:i}];return{...e,isSynthetic:!0,message:{...e.message,content:[r,...a]}}}function _n(e,t,n,r){return{uuid:e,session_id:t,agentId:n,type:`user`,parent_tool_use_id:null,isSynthetic:!1,message:{role:`user`,content:typeof r.message==`string`?r.message:$(r.blocks)}}}function vn(e){return`structured_output`in e&&e.structured_output!==void 0?JSON.stringify(e.structured_output):e.result??``}function yn(e,t){return e}export{ye as AsyncQuerySource,h as CONTENT_BLOCK_HANDLERS,ve as ClaudeCodeAgent,be as ClaudeConnectorTurn,z as SDKMessageSchema,un as TERMINAL_RESULT_DRAIN_TIMEOUT_MS,$ as blocksToContentBlocks,$t as claudeReasoningLevels,J as createClaudeConnectorNamespace,Y as decodeBase64Text,dn as extractTextFromMessage,ue as fromGlobalToolApproval,hn as parseResultError,gn as prependContextBlock,m as registerToolApprovalHandler,de as requestToolApproval,vn as resolveResultMessage,_n as sdkUserMessageFromNormalized,p as toGlobalToolApproval,yn as unwrapBlockFromMessage};
|
package/dist/bus/index.d.mts
CHANGED
|
@@ -171,6 +171,17 @@ interface RequestContext<Payload, Response> extends BaseMessageContext {
|
|
|
171
171
|
payload: Payload;
|
|
172
172
|
/** AbortSignal supplied by the originating request, if any. */
|
|
173
173
|
signal?: AbortSignal;
|
|
174
|
+
/**
|
|
175
|
+
* Absolute Unix timestamp (ms) when this request expires.
|
|
176
|
+
*
|
|
177
|
+
* Computed once at the request entry point as `Date.now() + effectiveTimeout`
|
|
178
|
+
* and propagated unchanged through every local and remote handler in the
|
|
179
|
+
* dispatch chain. Handlers can compare `deadline` to `Date.now()` to determine
|
|
180
|
+
* their remaining time budget.
|
|
181
|
+
*
|
|
182
|
+
* Undefined when no deadline was set (timeout: 0).
|
|
183
|
+
*/
|
|
184
|
+
readonly deadline?: number;
|
|
174
185
|
/** Set the response value (ends the handler chain) */
|
|
175
186
|
setResult: (result: Response) => void;
|
|
176
187
|
/**
|
|
@@ -353,6 +364,20 @@ type ChannelSubjectSchema<T extends EventSchema | RequestSchema = EventSchema |
|
|
|
353
364
|
readonly __channel: true;
|
|
354
365
|
readonly schema: T;
|
|
355
366
|
};
|
|
367
|
+
/**
|
|
368
|
+
* Wrapper to mark a request subject as host-local.
|
|
369
|
+
*
|
|
370
|
+
* Host-local requests accept direct remote ingress (a transport may deliver
|
|
371
|
+
* the request to this host), but the receiving bus must never relay the
|
|
372
|
+
* request onward to other transports. Only request schemas are accepted;
|
|
373
|
+
* events are rejected at the type level.
|
|
374
|
+
*
|
|
375
|
+
* Use `hostLocalRequest()` from `@makaio/core` to create these.
|
|
376
|
+
*/
|
|
377
|
+
type HostLocalRequestSubjectSchema<T extends RequestSchema = RequestSchema> = {
|
|
378
|
+
readonly __hostLocalRequest: true;
|
|
379
|
+
readonly schema: T;
|
|
380
|
+
};
|
|
356
381
|
/**
|
|
357
382
|
* Wrapper to set a subject-level default transport routing policy.
|
|
358
383
|
*
|
|
@@ -370,7 +395,7 @@ type BaseSubjectSchema = EventSchema | RequestSchema;
|
|
|
370
395
|
/**
|
|
371
396
|
* Union of all subject schema types (including metadata wrappers).
|
|
372
397
|
*/
|
|
373
|
-
type SubjectSchema = BaseSubjectSchema | LocalSubjectSchema | CollectorOnlySubjectSchema | ChannelSubjectSchema | DefaultTransportsSubjectSchema;
|
|
398
|
+
type SubjectSchema = BaseSubjectSchema | LocalSubjectSchema | CollectorOnlySubjectSchema | ChannelSubjectSchema | HostLocalRequestSubjectSchema | DefaultTransportsSubjectSchema;
|
|
374
399
|
type SchemaRecord = Record<string, SubjectSchema>;
|
|
375
400
|
//#endregion
|
|
376
401
|
//#region core/makaio-core/src/types/type-helpers.d.ts
|
|
@@ -387,6 +412,9 @@ type UnwrapSchema<S> = S extends {
|
|
|
387
412
|
} ? Inner : S extends {
|
|
388
413
|
readonly __channel: true;
|
|
389
414
|
readonly schema: infer Inner;
|
|
415
|
+
} ? Inner : S extends {
|
|
416
|
+
readonly __hostLocalRequest: true;
|
|
417
|
+
readonly schema: infer Inner;
|
|
390
418
|
} ? Inner : S extends {
|
|
391
419
|
readonly __defaultTransports: TransportRoutingDefault;
|
|
392
420
|
readonly schema: infer Inner;
|
|
@@ -427,7 +455,14 @@ type InferSubjectMeta<S extends SubjectSchema, Ns extends string> = {
|
|
|
427
455
|
response: z.ZodType;
|
|
428
456
|
} ? true : false; /** True when the subject is wrapped with `localSubject()`. */
|
|
429
457
|
local: S extends LocalSubjectSchema ? true : false; /** True when the subject is wrapped with `channelSubject()`. */
|
|
430
|
-
channel: S extends ChannelSubjectSchema ? true : false;
|
|
458
|
+
channel: S extends ChannelSubjectSchema ? true : false;
|
|
459
|
+
/**
|
|
460
|
+
* True when the subject is wrapped with `hostLocalRequest()`.
|
|
461
|
+
*
|
|
462
|
+
* Host-local requests accept direct remote ingress but must never be
|
|
463
|
+
* relayed onward to other transports after ingress.
|
|
464
|
+
*/
|
|
465
|
+
hostLocalRequest: S extends HostLocalRequestSubjectSchema ? true : false; /** Inferred payload type (request/response pair or event payload). */
|
|
431
466
|
payload: InferSchemaPayload<S>; /** The namespace this subject belongs to. */
|
|
432
467
|
namespace: Ns;
|
|
433
468
|
} & (S extends DefaultTransportsSubjectSchema<EventSchema | RequestSchema, infer Default> ? {
|
|
@@ -462,6 +497,11 @@ type SubjectDefinitionMeta<Subject extends SubjectRecord = SubjectRecord<'defaul
|
|
|
462
497
|
* DirectChannel encrypted point-to-point transport.
|
|
463
498
|
*/
|
|
464
499
|
channel: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* If true, this subject accepts direct remote ingress but must never be
|
|
502
|
+
* relayed onward to other transports after ingress.
|
|
503
|
+
*/
|
|
504
|
+
hostLocalRequest?: boolean;
|
|
465
505
|
/**
|
|
466
506
|
* Default transport routing for bus calls on this subject when the caller
|
|
467
507
|
* does not provide an explicit `transports` option.
|
|
@@ -752,6 +792,35 @@ declare function collectorOnlySubject<T extends EventSchema>(schema: T): Collect
|
|
|
752
792
|
*/
|
|
753
793
|
declare function channelSubject<T extends EventSchema | RequestSchema>(schema: T): ChannelSubjectSchema<T>;
|
|
754
794
|
//#endregion
|
|
795
|
+
//#region core/makaio-core/src/subject-helpers/host-local-request-schema.d.ts
|
|
796
|
+
/**
|
|
797
|
+
* Create a host-local request subject schema wrapper.
|
|
798
|
+
*
|
|
799
|
+
* Host-local requests accept direct remote ingress — a transport may deliver
|
|
800
|
+
* the request to this host — but the receiving bus must never relay the
|
|
801
|
+
* request onward to other transports after ingress. This is the correct
|
|
802
|
+
* wrapper for request subjects that should be answerable only by the
|
|
803
|
+
* receiving host, not forwarded across the bus topology.
|
|
804
|
+
*
|
|
805
|
+
* Only request schemas (with `request` and `response` fields) are accepted;
|
|
806
|
+
* plain event schemas are rejected at the type level.
|
|
807
|
+
* @param schema - The request schema to mark as host-local
|
|
808
|
+
* @returns A HostLocalRequestSubjectSchema wrapper
|
|
809
|
+
* @example
|
|
810
|
+
* ```typescript
|
|
811
|
+
* import { hostLocalRequest } from '@makaio/core';
|
|
812
|
+
*
|
|
813
|
+
* const AgentSchemas = {
|
|
814
|
+
* // Host-local request — answered locally, never relayed
|
|
815
|
+
* resolveCapability: hostLocalRequest({
|
|
816
|
+
* request: z.object({ capabilityId: z.string() }),
|
|
817
|
+
* response: z.object({ available: z.boolean() }),
|
|
818
|
+
* }),
|
|
819
|
+
* };
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
declare function hostLocalRequest<T extends RequestSchema>(schema: T): HostLocalRequestSubjectSchema<T>;
|
|
823
|
+
//#endregion
|
|
755
824
|
//#region core/makaio-core/src/subject-helpers/default-transports-schema.d.ts
|
|
756
825
|
/**
|
|
757
826
|
* Create a subject schema wrapper with a subject-level default transport policy.
|
|
@@ -1274,6 +1343,8 @@ interface RegisteredSubjectSchema {
|
|
|
1274
1343
|
collectorOnly: boolean;
|
|
1275
1344
|
/** Whether the subject was registered through `channelSubject()`. */
|
|
1276
1345
|
channel: boolean;
|
|
1346
|
+
/** Whether the subject was registered through `hostLocalRequest()`. */
|
|
1347
|
+
hostLocalRequest: boolean;
|
|
1277
1348
|
}
|
|
1278
1349
|
/**
|
|
1279
1350
|
* Creates the namespace registry used by a bus context.
|
|
@@ -1351,6 +1422,16 @@ declare const createNamespaceRegistry: () => {
|
|
|
1351
1422
|
* @returns True if the subject was wrapped with `collectorOnlySubject()`
|
|
1352
1423
|
*/
|
|
1353
1424
|
isCollectorOnlySubject(subject: string): boolean;
|
|
1425
|
+
/**
|
|
1426
|
+
* Check if a subject was registered as a host-local request subject.
|
|
1427
|
+
*
|
|
1428
|
+
* Host-local request subjects accept direct remote ingress — a transport
|
|
1429
|
+
* may deliver the request to this host — but the receiving bus must never
|
|
1430
|
+
* relay the request onward to other transports after ingress.
|
|
1431
|
+
* @param subject - Full subject identifier (e.g., "agent.resolveCapability")
|
|
1432
|
+
* @returns True if the subject was wrapped with `hostLocalRequest()`
|
|
1433
|
+
*/
|
|
1434
|
+
isHostLocalRequestSubject(subject: string): boolean;
|
|
1354
1435
|
/**
|
|
1355
1436
|
* Get the default transport visibility for a subject.
|
|
1356
1437
|
*
|
|
@@ -1453,6 +1534,8 @@ declare const createTransportRegistry: (context: MakaioBusContext) => {
|
|
|
1453
1534
|
type TransportRegistry = ReturnType<typeof createTransportRegistry>;
|
|
1454
1535
|
//#endregion
|
|
1455
1536
|
//#region core/bus-core/src/types/transports.d.ts
|
|
1537
|
+
/** Controls whether a subscription may be advertised beyond its direct peer. */
|
|
1538
|
+
type SubscriptionDeliveryClass = 'relayable' | 'first-hop-only';
|
|
1456
1539
|
/**
|
|
1457
1540
|
* Subscribe message for client subscription management.
|
|
1458
1541
|
*
|
|
@@ -1487,6 +1570,13 @@ interface BusSubscribeMessage {
|
|
|
1487
1570
|
* An empty array indicates event-only handlers with no priority-based dispatch.
|
|
1488
1571
|
*/
|
|
1489
1572
|
subjects: Record<string, number[]>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Owner-derived delivery semantics for every advertised subject.
|
|
1575
|
+
*
|
|
1576
|
+
* Receivers must treat missing or unknown values as `first-hop-only` so an
|
|
1577
|
+
* incomplete control message cannot weaken a no-relay boundary.
|
|
1578
|
+
*/
|
|
1579
|
+
deliveryClasses: Record<string, SubscriptionDeliveryClass>;
|
|
1490
1580
|
/**
|
|
1491
1581
|
* Optional payload filters per subject.
|
|
1492
1582
|
* Key is the subject pattern, value is the filter to apply.
|
|
@@ -1892,8 +1982,9 @@ interface BusTransport {
|
|
|
1892
1982
|
* @param filter - Optional payload filter for fine-grained routing
|
|
1893
1983
|
* @param priorities - Handler priorities registered for this subject; an empty
|
|
1894
1984
|
* array signals event-only handlers that do not participate in priority dispatch
|
|
1985
|
+
* @param deliveryClass - Whether the remote peer may advertise this subscription onward
|
|
1895
1986
|
*/
|
|
1896
|
-
subscribe(subject: string, filter?: PayloadFilter, priorities?: number[]): Promise<void>;
|
|
1987
|
+
subscribe(subject: string, filter?: PayloadFilter, priorities?: number[], deliveryClass?: SubscriptionDeliveryClass): Promise<void>;
|
|
1897
1988
|
/**
|
|
1898
1989
|
* Unsubscribe from a subject.
|
|
1899
1990
|
*
|
|
@@ -2129,6 +2220,8 @@ interface MakaioBusContext {
|
|
|
2129
2220
|
* `subscribe` (with an empty priority array) rather than an `unsubscribe`.
|
|
2130
2221
|
*/
|
|
2131
2222
|
remoteEventHandlers: Map<string, Set<string>>;
|
|
2223
|
+
/** Owner-derived delivery semantics keyed by subject pattern and source transport. */
|
|
2224
|
+
remoteSubscriptionDeliveryClasses: Map<string, Map<string, SubscriptionDeliveryClass>>;
|
|
2132
2225
|
}
|
|
2133
2226
|
/**
|
|
2134
2227
|
* Result of registering a transport on the bus.
|
|
@@ -3549,6 +3642,8 @@ interface SubscriptionEntry {
|
|
|
3549
3642
|
filter?: PayloadFilter;
|
|
3550
3643
|
/** Handler priorities registered for this subject. Empty array = event-only. */
|
|
3551
3644
|
priorities: number[];
|
|
3645
|
+
/** Whether the subscription may be advertised beyond its direct peer. */
|
|
3646
|
+
deliveryClass?: SubscriptionDeliveryClass;
|
|
3552
3647
|
}
|
|
3553
3648
|
/**
|
|
3554
3649
|
* Build a BusSubscribeMessage from local subscription state.
|
|
@@ -4030,4 +4125,4 @@ interface ProjectedTelemetryTransportOptions {
|
|
|
4030
4125
|
*/
|
|
4031
4126
|
declare function createProjectedTelemetryTransport(options: ProjectedTelemetryTransportOptions): BusTransport;
|
|
4032
4127
|
//#endregion
|
|
4033
|
-
export { type BroadcastContext, type BroadcastResult, type BusBroadcastMessage, type BusBroadcastResponseMessage, BusError, type BusEventMessage, type BusHeartbeatMessage, BusLifecycle, type BusMessage, type BusMessageObserver, type BusNamespace, type BusReceiveHandler, type BusRequestMessage, type BusResponseMessage, type BusSubscribeMessage, type BusSubscribeSyncCompleteMessage, type BusSubscriptionAckMessage, type BusTransport, type BusTransportError, type BusTransportKeys, type BusTransportRegistry, type BusUnsubscribeMessage, type BusUrlConfig, type BusValidationMode, CONNECTION_LOST_ERROR_CODE, ChannelAuthError, ChannelClosedError, type ChannelEndpoint, type ChannelEndpointOptions, ChannelOnlyError, type ConnectOptions, type ConnectedPayload, ConnectionLostError, CorrelationTracker, DEFAULT_REQUEST_TIMEOUT_MS, type DefinedSubjectExtension, type DisconnectedPayload, type EventSubjectExtension, type ExtendedSubjectDefinition, type ExtensionNamespace, type ExtensionNamespaceConfig, type ExtensionNamespaceExtensions, type ExtensionNamespaceFromConfig, type IDirectChannel, type IFilteredBus, type IMakaioBus, type InterceptorContext, LOCAL_ORIGIN, LocalSubjectError, MakaioBus, type MakaioBusContext, NO_HANDLER_ERROR_CODE, type NamespaceRegistrationOptions, NoHandlerError, type ObservedBusMessage, type OnOptions, OnceAbortError, type OptionalResult, type ProjectableBusMessage, type ProjectedTelemetryTransportOptions, REMOTE_ORIGIN, RequestError, type RequestSubjectExtension, type SchemaViolationCallback, type SchemaViolationReport, type ScopedBus, type ScopedBusFor, type SubjectExtension, type SubjectTelemetryAttributes, type SubjectTelemetryProjectionInput, type SubjectTelemetryProjector, type SubjectTelemetryProjectorInput, type SubjectTelemetryProjectorRegistry, type SubscriptionEntry, SystemChannelSchemas, TimeoutError, type TransportRegistration, ValidationError, __resetWarnedSubjects, buildSubscribeMessage, buildUnsubscribeMessage, channelSubject, collectorOnlySubject, createBusContext, createBusInstance, createChannelEndpoint, createExtensionNamespace, createFilteredBus, createProjectedTelemetryTransport, createSubjectTelemetryProjectorRegistry, defaultTransports, defineSubjectExtension, deserializeTransportError, extendSubjectImpl as extendSubject, getFullSubjectForSubjectDefinition, getPath, getSubjectFromBusMessage, handleCorrelationResponse, isNoHandlerErrorForSubject, isRequestSchema, localSubject, matchesAnySubscription, matchesFilter, matchesSubscription, mergeFilters, openChannel, parseBusUrl, projectSubjectTelemetryFacts, serializeTransportError, shouldReceiveMessage, trackMessageCorrelation, waitForSubscriptionPropagation };
|
|
4128
|
+
export { type BroadcastContext, type BroadcastResult, type BusBroadcastMessage, type BusBroadcastResponseMessage, BusError, type BusEventMessage, type BusHeartbeatMessage, BusLifecycle, type BusMessage, type BusMessageObserver, type BusNamespace, type BusReceiveHandler, type BusRequestMessage, type BusResponseMessage, type BusSubscribeMessage, type BusSubscribeSyncCompleteMessage, type BusSubscriptionAckMessage, type BusTransport, type BusTransportError, type BusTransportKeys, type BusTransportRegistry, type BusUnsubscribeMessage, type BusUrlConfig, type BusValidationMode, CONNECTION_LOST_ERROR_CODE, ChannelAuthError, ChannelClosedError, type ChannelEndpoint, type ChannelEndpointOptions, ChannelOnlyError, type ConnectOptions, type ConnectedPayload, ConnectionLostError, CorrelationTracker, DEFAULT_REQUEST_TIMEOUT_MS, type DefinedSubjectExtension, type DisconnectedPayload, type EventSubjectExtension, type ExtendedSubjectDefinition, type ExtensionNamespace, type ExtensionNamespaceConfig, type ExtensionNamespaceExtensions, type ExtensionNamespaceFromConfig, type IDirectChannel, type IFilteredBus, type IMakaioBus, type InterceptorContext, LOCAL_ORIGIN, LocalSubjectError, MakaioBus, type MakaioBusContext, NO_HANDLER_ERROR_CODE, type NamespaceRegistrationOptions, NoHandlerError, type ObservedBusMessage, type OnOptions, OnceAbortError, type OptionalResult, type ProjectableBusMessage, type ProjectedTelemetryTransportOptions, REMOTE_ORIGIN, RequestError, type RequestSubjectExtension, type SchemaViolationCallback, type SchemaViolationReport, type ScopedBus, type ScopedBusFor, type SubjectExtension, type SubjectTelemetryAttributes, type SubjectTelemetryProjectionInput, type SubjectTelemetryProjector, type SubjectTelemetryProjectorInput, type SubjectTelemetryProjectorRegistry, type SubscriptionDeliveryClass, type SubscriptionEntry, SystemChannelSchemas, TimeoutError, type TransportRegistration, ValidationError, __resetWarnedSubjects, buildSubscribeMessage, buildUnsubscribeMessage, channelSubject, collectorOnlySubject, createBusContext, createBusInstance, createChannelEndpoint, createExtensionNamespace, createFilteredBus, createProjectedTelemetryTransport, createSubjectTelemetryProjectorRegistry, defaultTransports, defineSubjectExtension, deserializeTransportError, extendSubjectImpl as extendSubject, getFullSubjectForSubjectDefinition, getPath, getSubjectFromBusMessage, handleCorrelationResponse, hostLocalRequest, isNoHandlerErrorForSubject, isRequestSchema, localSubject, matchesAnySubscription, matchesFilter, matchesSubscription, mergeFilters, openChannel, parseBusUrl, projectSubjectTelemetryFacts, serializeTransportError, shouldReceiveMessage, trackMessageCorrelation, waitForSubscriptionPropagation };
|