@makaio/framework 1.0.0-dev-1789404058608 → 1.0.0-dev-1789642522820

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.
Files changed (117) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/{adapter-C4v_gNTI.mjs → adapter-DSRgsh2d.mjs} +1 -1
  3. package/dist/adapters/claude/index.d.mts +24 -24
  4. package/dist/adapters/claude/index.mjs +3 -3
  5. package/dist/bus/index.mjs +1 -1
  6. package/dist/bus-BOGcnhgA.mjs +9 -0
  7. package/dist/client-DqfP7BeX.mjs +1 -0
  8. package/dist/clients/index.d.mts +152 -11
  9. package/dist/clients/index.mjs +1 -1
  10. package/dist/contracts/adapter/index.d.mts +2 -2
  11. package/dist/contracts/adapter/index.mjs +1 -1
  12. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  13. package/dist/contracts/artifact/index.d.mts +2 -2
  14. package/dist/contracts/capabilities/index.d.mts +1 -1
  15. package/dist/contracts/client/index.d.mts +3 -3
  16. package/dist/contracts/client/index.mjs +1 -1
  17. package/dist/contracts/extension/index.d.mts +4 -4
  18. package/dist/contracts/index.d.mts +35 -35
  19. package/dist/contracts/index.mjs +1 -1
  20. package/dist/contracts/materialization/index.d.mts +1 -1
  21. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  22. package/dist/contracts/session/index.d.mts +2 -2
  23. package/dist/contracts/session/index.mjs +1 -1
  24. package/dist/contracts/shared/index.d.mts +1 -1
  25. package/dist/contracts/variant/index.d.mts +1 -1
  26. package/dist/contracts/worker/index.d.mts +1 -1
  27. package/dist/contracts/workflow/index.d.mts +2 -2
  28. package/dist/drizzle/0040_session_generation.sql +1 -0
  29. package/dist/drizzle/meta/_journal.json +7 -0
  30. package/dist/{framework-packages-Bg4edkkM.mjs → framework-packages-BNFG51Td.mjs} +1 -1
  31. package/dist/{hook-responses-Dq16X3Cb.d.mts → hook-responses-CQ2q0aPE.d.mts} +47 -4
  32. package/dist/{index-DaAWCLe9.d.mts → index-B-u0Tu8X.d.mts} +24 -24
  33. package/dist/{index-C1nSuiG0.d.mts → index-B6WkHnCQ.d.mts} +1 -1
  34. package/dist/{index-Du4wUv9q.d.mts → index-BS-Fhlux.d.mts} +48 -13
  35. package/dist/{index-BArnbdj6.d.mts → index-Bh57xARQ.d.mts} +65 -65
  36. package/dist/{index-DH0m01hJ2.d.mts → index-CXpgL3gz2.d.mts} +3 -3
  37. package/dist/{index-n1hV8uFw2.d.mts → index-CdWxSwhQ2.d.mts} +11 -11
  38. package/dist/{index-DjQebquc.d.mts → index-ClKwF6LE.d.mts} +291 -291
  39. package/dist/{index-BUC9P6Q12.d.mts → index-CztxEJrG2.d.mts} +51 -8
  40. package/dist/{index-BEi6nx1S2.d.mts → index-De_oh9M-2.d.mts} +1 -1
  41. package/dist/{index-N3f65Z_S.d.mts → index-Dn23R_ck.d.mts} +9 -9
  42. package/dist/{index-gu4mzfTr.d.mts → index-Hnsy6XhM.d.mts} +1 -1
  43. package/dist/{index-CWlvL7GB.d.mts → index-nkix3hP7.d.mts} +6 -6
  44. package/dist/{index-CGxjX4fw.d.mts → index-p1l00SGS.d.mts} +320 -12
  45. package/dist/{index-T-aAKybB.d.mts → index-xsaaa85T.d.mts} +8 -8
  46. package/dist/{index-HMb0RcTG2.d.mts → index-zEkS2L862.d.mts} +18 -12
  47. package/dist/kernel/extension/index.d.mts +1 -1
  48. package/dist/kernel/index.d.mts +2 -2
  49. package/dist/kernel/observability/index.d.mts +1 -1
  50. package/dist/{namespace-DQpBf2CK.d.mts → namespace-B5IFLQc-.d.mts} +6 -6
  51. package/dist/{namespace-Cmu-5_P9.d.mts → namespace-BR03HE8G.d.mts} +42 -0
  52. package/dist/{namespace-uCaKZm89.d.mts → namespace-BqfzcRkL.d.mts} +3 -3
  53. package/dist/{namespace-CPGTaFqO.d.mts → namespace-Phxf0Lep.d.mts} +2 -2
  54. package/dist/{namespace-D2RZfl0a.d.mts → namespace-UFcDEBJB.d.mts} +2 -2
  55. package/dist/{namespace-DSRoDmT6.d.mts → namespace-rJ3ycPMg.d.mts} +2 -2
  56. package/dist/{orchestrator-shared-CtPB6PAr.mjs → orchestrator-shared-CxO1lfpP.mjs} +1 -1
  57. package/dist/ownership-memory-handler-BOhmmlJj.mjs +1 -0
  58. package/dist/{package-D-oIvXJD.d.mts → package-CDj3F-L3.d.mts} +1 -1
  59. package/dist/package.json +1 -1
  60. package/dist/{registry-DNMjJ-Oj.mjs → registry-DtaRGU8i.mjs} +1 -0
  61. package/dist/{schema-BA1cHBbc.d.mts → schema-DqKCg5Ec.d.mts} +30 -0
  62. package/dist/{schemas-CJKDu4Kt.d.mts → schemas-2_D4iVbb.d.mts} +1 -1
  63. package/dist/{schemas-BQsXr4FF.d.mts → schemas-CFciElld.d.mts} +7 -7
  64. package/dist/{schemas-BcynDWi-.d.mts → schemas-Cj6Gbqch.d.mts} +7 -7
  65. package/dist/schemas-CkxAK13D.mjs +1 -0
  66. package/dist/{schemas-e8o4JGBu.d.mts → schemas-Cq1d5tid.d.mts} +2 -2
  67. package/dist/services/adapter-runtime/index.d.mts +3 -3
  68. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  69. package/dist/services/adapter-runtime/schemas.d.mts +1 -1
  70. package/dist/services/agent-runtime/index.d.mts +2 -2
  71. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  72. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  73. package/dist/services/execution-target/index.d.mts +1 -1
  74. package/dist/services/filesystem/namespace.d.mts +6 -6
  75. package/dist/services/filesystem/schemas.d.mts +3 -3
  76. package/dist/services/index.d.mts +28 -28
  77. package/dist/services/index.mjs +1 -1
  78. package/dist/services/session/index.d.mts +4 -4
  79. package/dist/services/session/index.mjs +1 -1
  80. package/dist/services/session/messages/namespace.d.mts +1 -1
  81. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  82. package/dist/services/session/storage/namespace.d.mts +1 -1
  83. package/dist/services/session/storage/schema.d.mts +1 -1
  84. package/dist/services/session/storage/schema.mjs +1 -1
  85. package/dist/services/session/testing/index.mjs +2 -1
  86. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  87. package/dist/services/settings/namespace.d.mts +4 -4
  88. package/dist/services/subagent-template/index.d.mts +2 -2
  89. package/dist/services/subagent-template/namespace.d.mts +1 -1
  90. package/dist/services/subagent-template/schemas.d.mts +1 -1
  91. package/dist/services/tool-approval/index.mjs +1 -1
  92. package/dist/services/tools/index.mjs +1 -1
  93. package/dist/services/tray-menu/index.d.mts +2 -2
  94. package/dist/services/tray-menu/namespace.d.mts +1 -1
  95. package/dist/services/tray-menu/schemas.d.mts +1 -1
  96. package/dist/services/workflow-transitions/index.mjs +1 -1
  97. package/dist/session-BP5aq2kt.mjs +95 -0
  98. package/dist/{session-BB0s7c2B.mjs → session-BcArFp9M.mjs} +1 -1
  99. package/dist/{session-lineage-BQimcKsh.d.mts → session-lineage-C3myyt5x.d.mts} +1 -1
  100. package/dist/storage/drizzle/client.mjs +1 -1
  101. package/dist/storage/drizzle/index.mjs +1 -1
  102. package/dist/{tool-approval-service-pbkGcAV8.mjs → tool-approval-service-CXTklh3T.mjs} +1 -1
  103. package/dist/{tools-C5Gy0IQG.mjs → tools-hiFv-jJn.mjs} +1 -1
  104. package/dist/{transition-JmAdtcwW.d.mts → transition-D-Lgbp1j.d.mts} +1 -1
  105. package/dist/{types-C5MnkQv6.d.mts → types-D5kqrOad.d.mts} +18 -9
  106. package/dist/{view-builder-ByHQ4Oop.d.mts → view-builder-CHUTXJDl.d.mts} +2 -2
  107. package/dist/workflow-engine/index.d.mts +34 -34
  108. package/dist/workflow-engine/package.d.mts +1 -1
  109. package/dist/{workflow-transitions-C0sg3kar.mjs → workflow-transitions-BalNKTtE.mjs} +1 -1
  110. package/package.json +1 -1
  111. package/dist/bus-DlTN167w.mjs +0 -9
  112. package/dist/client-CgtNXGXg.mjs +0 -1
  113. package/dist/ownership-memory-handler-xex7sLiX.mjs +0 -1
  114. package/dist/schemas-ClkcU_N5.mjs +0 -1
  115. package/dist/session-6UG5udTX.mjs +0 -95
  116. package/dist/{index-CCH0Dnty2.d.mts → index-Htfr-K5U2.d.mts} +6 -6
  117. package/dist/{schemas-lAb9QH1A.d.mts → schemas-JjyFxrC0.d.mts} +8 -8
@@ -0,0 +1 @@
1
+ import{o as e,s as t}from"./definitions-Do7bP-u7.mjs";import{t as n}from"./schemas-BmoFWBdh.mjs";import{_ as r,a as i,g as a,h as o,m as s,n as ee,o as te}from"./profile-1fvMljlJ.mjs";import{n as ne,t as c}from"./version-PuU2KG3I.mjs";import{c as re,d as ie,n as ae,o as oe,s as se,t as ce,u as le}from"./account-identity-C-v4mHq3.mjs";import{z as l}from"zod";import{createBusNamespace as ue,observability as u}from"@makaio/framework/core";const d=l.object({tag:l.string(),description:l.string().optional()}),f=l.object({name:l.string(),friendlyName:l.string(),description:l.string().optional(),category:l.string().optional(),capabilities:l.array(d).default([])}),de=l.object({id:l.string(),name:l.string(),description:l.string().optional(),glob:l.string().optional()}),p=l.object({name:l.string().min(1),frameworkSubject:l.string().min(1).optional(),responseCapabilities:l.array(l.string().min(1)).readonly().default([]),minimumVersion:c.optional()}).strict();function fe(e){return e.responseCapabilities.length>0?`request`:`event`}const m=l.object({envVar:a.regex(/^[A-Za-z_][A-Za-z0-9_]*$/,{message:`envVar must be a valid environment variable name (letters, digits, underscores)`}),defaultPath:a.refine(e=>e===`~`||e.startsWith(`~/`)||r(e),{message:`defaultPath must be absolute, '~', or start with '~/'`}),pathKind:l.enum([`directory`,`file`]).default(`directory`)});function pe(e){if(!e.startsWith(`@`))return!e.includes(`@`);let t=e.indexOf(`/`);return t>1&&!e.slice(t+1).includes(`@`)}const h=l.object({type:l.literal(`npm`),package:l.string().min(1).refine(pe,{message:"package must not include an inline `@version` suffix; use the version field instead"}),version:c}),g=l.object({type:l.literal(`signed-binary-bucket`),version:c,config:l.object({baseUrl:l.string().url(),manifestPathTemplate:l.string().min(1),manifestSignaturePathTemplate:l.string().min(1),publicKeyUrl:l.string().url(),publicKeyFingerprint:l.string().min(1),binaryPathTemplate:l.string().min(1),platforms:l.record(l.string().min(1),l.string().min(1))})}),_=l.discriminatedUnion(`type`,[h,g]),v=l.object({executable:l.union([l.string().min(1),l.object({default:l.string().min(1),darwin:l.string().min(1).optional(),linux:l.string().min(1).optional(),win32:l.string().min(1).optional()}).strict()]),args:l.array(l.string()).default([])}).strict(),y=l.object({kind:l.string().min(1),payload:l.record(l.string(),l.unknown()).optional()}),b=l.object({supportsHooks:l.boolean().default(!1),supportsStatusline:l.boolean().default(!1),supportsSupervisorLaunch:l.boolean().default(!1),supportsManagedBinary:l.boolean().default(!1),hookEvents:l.array(p).default([])}).refine(e=>e.supportsHooks||e.hookEvents.length===0,{message:`hookEvents must be empty when supportsHooks is false`,path:[`hookEvents`]}),x=l.object({name:l.string().min(1),supportedVersions:ne}).strict(),S=l.object({id:l.string(),name:l.string(),version:c,description:l.string().optional(),binary:x.optional(),nativeTools:l.array(f).default([]),defaultApprovalPolicy:n,logSources:l.array(de).optional(),authMethods:e,defaultAuth:t.optional(),runtimeCapabilities:b.optional().transform(e=>b.parse(e??{})),managedInstall:_.optional(),versionCommand:v.optional(),postInstall:y.optional(),configIsolation:m.optional()}).strict().refine(e=>!e.runtimeCapabilities.supportsManagedBinary||e.managedInstall!==void 0,{message:`managedInstall is required when runtimeCapabilities.supportsManagedBinary is true`,path:[`managedInstall`]}).refine(e=>e.managedInstall===void 0||e.runtimeCapabilities.supportsManagedBinary,{message:`runtimeCapabilities.supportsManagedBinary must be true when managedInstall is provided`,path:[`runtimeCapabilities`,`supportsManagedBinary`]}).refine(e=>e.managedInstall===void 0||e.versionCommand!==void 0,{message:`versionCommand is required when managedInstall is provided`,path:[`versionCommand`]}).superRefine((e,t)=>{e.defaultAuth!==void 0&&e.authMethods.find(({id:t})=>t===e.defaultAuth?.methodId)?.mode!==`inferred`&&t.addIssue({code:l.ZodIssueCode.custom,message:`defaultAuth.methodId must reference an inferred method declared by this client.`,path:[`defaultAuth`,`methodId`]})}).superRefine((e,t)=>{if(e.managedInstall===void 0||e.versionCommand===void 0)return;let{executable:n}=e.versionCommand,r=typeof n==`string`?[{path:n,issuePath:[`versionCommand`,`executable`]}]:[{path:n.default,issuePath:[`versionCommand`,`executable`,`default`]},...n.darwin===void 0?[]:[{path:n.darwin,issuePath:[`versionCommand`,`executable`,`darwin`]}],...n.linux===void 0?[]:[{path:n.linux,issuePath:[`versionCommand`,`executable`,`linux`]}],...n.win32===void 0?[]:[{path:n.win32,issuePath:[`versionCommand`,`executable`,`win32`]}]];for(let{path:e,issuePath:n}of r){let r=e.startsWith(`/`),i=/^[A-Za-z]:/.test(e),a=e.startsWith(`\\`);if(r||i||a){t.addIssue({code:l.ZodIssueCode.custom,path:n,message:`${n.join(`.`)} must be a relative path within the install directory`});continue}e.split(/[/\\]/).some(e=>e===`..`)&&t.addIssue({code:l.ZodIssueCode.custom,path:n,message:`${n.join(`.`)} must be a relative path within the install directory`})}}),C=l.object({binaryPath:s.nullable(),env:l.record(l.string(),l.string()),configDir:s.nullable(),source:l.enum([`managed`,`global`]),version:a.nullable()}),w={request:l.object({clientId:a,sessionId:a.optional(),projectDir:s.optional(),preferSource:l.enum([`managed`,`global`]).optional(),harnessId:a.optional()}),response:C},T=l.enum([`npm`,`signed-binary-bucket`]),E=l.object({version:a,installPath:s,installedAt:o,isActive:l.boolean()}),D=l.object({clientId:a,installedVersions:l.array(E),activeVersion:a.nullable(),pinnedVersion:c,updateAvailable:l.boolean()}).strict(),O={request:l.object({forceRefresh:l.boolean().optional()}),response:l.object({clients:l.array(D)})},k={request:l.object({clientId:a,version:c.optional()}),response:l.object({jobId:a,requestedVersion:c.nullable(),resolvedVersion:c.nullable()})},A={request:l.object({clientId:a,version:a}),response:l.object({clientId:a,removedVersion:a,activeVersion:a.nullable()})},j={request:l.object({clientId:a}),response:l.object({jobId:a,resolvedVersion:c.nullable()})},M={request:l.object({clientId:a,version:a}),response:l.object({clientId:a,activeVersion:a})},N=l.enum([`resolving`,`downloading`,`verifying`,`extracting`,`installing`,`post-install`,`activating`]),P=l.object({jobId:a,clientId:a,version:a.optional(),strategy:T,stage:N,progress:l.number().min(0).max(100).nullable(),installPath:s.optional(),activeAfterCompletion:l.boolean().optional(),metadata:l.record(l.string(),l.unknown()).optional()}),F=l.object({message:l.string(),code:l.string().optional()}),I=l.object({jobId:a,clientId:a,version:a.optional(),strategy:T,status:l.enum([`success`,`error`]),installPath:s.optional(),activeVersion:a.nullable(),error:F.optional(),metadata:l.record(l.string(),l.unknown()).optional()}),L=l.object({clientId:a,previousActiveVersion:a.nullable(),activeVersion:a.nullable(),reason:l.enum([`install`,`update`,`set-active`,`uninstall`])}),R=l.enum([`supervisor`,`adapter`,`client-hook`,`statusline`,`cli-wrapper`]),z=l.object({layer:R,producer:a}),B=l.object({supervisorSessionId:a.optional(),pid:l.number().int().positive().optional(),parentPid:l.number().int().positive().optional(),adapterSessionId:a.optional(),sessionId:a.optional(),cwd:l.string().optional(),argv:l.array(l.string()).optional(),metadata:l.record(l.string(),l.unknown()).optional()}),V={request:l.object({clientId:a,source:z,observedAt:o}).merge(B).refine(e=>e.supervisorSessionId!==void 0||e.pid!==void 0||e.adapterSessionId!==void 0,{message:`At least one hard-evidence field is required (supervisorSessionId, pid, or adapterSessionId)`}),response:l.object({clientRuntimeId:a,created:l.boolean(),promoted:l.boolean()})},H=B.extend({clientRuntimeId:a,clientId:a,status:l.enum([`observed`,`started`]),source:z,observedAt:o}),U={request:l.object({adapterSessionId:a,clientId:a}),response:l.object({managed:l.boolean()})},W=l.object({clientId:u.attribute(a,`makaio.client.id`),source:u.attribute(a,`makaio.client.lifecycle.source`),observedAt:u.attribute(o,`event.observed_at`),sessionId:u.attribute(l.string(),`makaio.session.id`).optional(),adapterSessionId:u.attribute(l.string(),`makaio.adapter.session_id`).optional(),metadata:l.record(l.string(),l.unknown()).optional()}),G=[`fresh`,`fork`,`resume`,`clear`,`compact`],K=l.enum(G),q=W.extend({transcriptPath:l.string().optional(),cwd:l.string().optional(),machineId:u.attribute(l.string(),`makaio.machine.id`).optional(),startMode:u.attribute(K,`makaio.session.start_mode`).optional(),parentAdapterSessionId:u.attribute(l.string(),`makaio.session.parent_adapter_session_id`).optional()}),J=W.extend({prompt:a.optional()}),me=W.extend({}),he=W.extend({transcriptPath:l.string().optional()}),ge=W.extend({toolName:u.attribute(a,`tool.name`).optional(),toolCallId:u.attribute(a,`tool.call_id`).optional()}),_e=W.extend({toolName:u.attribute(a,`tool.name`).optional(),toolCallId:u.attribute(a,`tool.call_id`).optional(),success:u.attribute(l.boolean(),`tool.success`).optional()}),ve=[`manual`,`auto`],ye=l.enum(ve),be=W.extend({trigger:u.attribute(ye,`makaio.session.compaction_trigger`).optional(),transcriptPath:l.string().optional()}),Y=W.extend({agentId:u.attribute(a,`makaio.client.agent_id`),agentType:u.attribute(a,`makaio.client.agent_type`).optional(),turnId:u.attribute(a,`makaio.client.turn_id`).optional()}),xe=Y.extend({agentTranscriptPath:l.string().optional()}),Se=l.object({group:a,name:a,installed:l.boolean(),command:a}),Ce=l.enum([`provider-reported`,`client-reported`,`estimated`]),X=l.number().finite().nonnegative(),we=l.number().finite().min(0).max(100),Te=l.object({clientId:u.attribute(a,`makaio.client.id`),clientAccountId:u.attribute(a,`makaio.client.account_id`).optional(),sessionId:u.attribute(a,`makaio.session.id`).optional(),adapterSessionId:u.attribute(a,`makaio.adapter.session_id`).optional(),source:u.attribute(a,`makaio.client.usage.source`),observedAt:u.attribute(o,`event.observed_at`),clientVersion:u.attribute(a,`makaio.client.version`).optional(),modelId:u.attribute(a,`llm.model`).optional(),modelDisplayName:u.attribute(a,`llm.model.display_name`).optional(),modelFamily:u.attribute(a,`llm.model.family`).optional(),latestRequestInputTokens:u.attribute(X,`llm.tokens.latest_request.input`).optional(),latestRequestOutputTokens:u.attribute(X,`llm.tokens.latest_request.output`).optional(),latestRequestCacheReadTokens:u.attribute(X,`llm.tokens.latest_request.cache_read`).optional(),latestRequestCacheWriteTokens:u.attribute(X,`llm.tokens.latest_request.cache_write`).optional(),currentContextInputTokens:u.attribute(X,`llm.context.tokens.input`).optional(),currentContextOutputTokens:u.attribute(X,`llm.context.tokens.output`).optional(),contextWindowSizeTokens:u.attribute(X,`llm.context.window_size`).optional(),contextUsedPercentage:u.attribute(we,`llm.context.used_percentage`).optional(),contextRemainingPercentage:u.attribute(we,`llm.context.remaining_percentage`).optional(),contextThresholdExceeded:u.attribute(l.boolean(),`llm.context.threshold_exceeded`).optional(),totalCost:u.attribute(X,`llm.cost.total`).optional(),costCurrency:u.attribute(a,`llm.cost.currency`).optional(),costProvenance:u.attribute(Ce,`llm.cost.provenance`).optional(),totalDurationMs:u.attribute(X,`makaio.session.duration_ms`).optional(),totalApiDurationMs:u.attribute(X,`llm.duration.total_api_ms`).optional(),totalLinesAdded:u.attribute(X,`code.lines_added`).optional(),totalLinesRemoved:u.attribute(X,`code.lines_removed`).optional(),totalEdits:u.attribute(X,`code.edits`).optional()}).strict().superRefine((e,t)=>{let n=[`totalCost`,`costCurrency`,`costProvenance`],r=n.filter(t=>e[t]!==void 0).length;if(!(r===0||r===n.length))for(let r of n)e[r]===void 0&&t.addIssue({code:l.ZodIssueCode.custom,path:[r],message:`totalCost, costCurrency, and costProvenance must be supplied together`})}),Z=l.object({clientId:l.string().min(1),adapterSessionId:l.string().min(1),agentId:l.string().min(1).optional()}),Ee=Z,De=l.object({token:l.string().nullable()}),Oe={"runtime.observe":V,"runtime.started":H,"runtime.isAdapterManaged":U,scan:{request:l.object({targets:l.array(se).optional()}),response:l.object({results:l.array(oe)})},"session.account.observe":re,"account.observe":ae,"account.activate":{request:l.object({clientId:a,clientAccountId:a,identifiers:l.array(ce).min(1),displayLabel:l.string().optional()}),response:l.object({accepted:l.boolean()})},"account.getActive":{request:l.object({clientId:a}),response:l.object({identity:l.object({clientAccountId:a,identifiers:l.array(ce).min(1),displayLabel:l.string().optional()}).nullable()})},"usage.ingest":le,"usage.snapshot":ie,"session.usage.snapshot":Te,"session.started":q,"session.userPrompt.submitted":J,"session.turn.started":me,"session.turn.completed":he,"session.tool.pre":ge,"session.tool.post":_e,"session.compaction.pre":be,"session.subagent.started":Y,"session.subagent.completed":xe,"session.token.get":{request:Ee,response:De},"wiring.list":{request:l.object({clientId:a.optional(),projectDir:s.optional(),makaioCommand:a}),response:l.object({results:l.array(l.object({clientId:a,entries:l.array(Se)}))})},list:O,install:k,uninstall:A,update:j,setActive:M,"installJob.progress":P,"installJob.completed":I,"version.changed":L,resolveBinary:w,...i,...te,"config.prime":ee},Q=ue(`client`,Oe),ke=Q.subjects;function $(e){if(Array.isArray(e)){for(let t of e)$(t);return Object.freeze(e)}if(e&&typeof e==`object`){for(let t of Object.values(e))$(t);return Object.freeze(e)}return e}function Ae(e){return $(S.parse(e))}const je=Object.freeze({contextAppend:`context.append`,sessionToken:`session.token`});function Me(e){return Object.freeze({kind:`context.append`,value:e})}function Ne(e){return Object.freeze({kind:`session.token`,value:e})}const Pe=`open`;function Fe(e){return typeof e==`string`&&e.trim().length>0}function Ie(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Le(e,t){let n=[];for(let r of e){let e=r.kind===`event-name`?r.name:r.capability;if(!t.supportedInteractions.includes(e)){n.push(`Interaction '${e}' is not a supported interaction in contract '${t.contractId}'; failurePolicy 'closed' is not permitted`);continue}let i=t.blockability.find(t=>t.interaction===e);(!i||!i.blockable)&&n.push(`Interaction '${e}' is not blockable in contract '${t.contractId}'; failurePolicy 'closed' is not permitted`)}return n}export{x as $,J as A,P as B,q as C,ge as D,_e as E,R as F,j as G,O as H,z as I,N as J,L as K,H as L,B as M,U as N,he as O,V as P,w as Q,D as R,K as S,Y as T,M as U,k as V,A as W,T as X,E as Y,C as Z,ve as _,Fe as a,m as at,ye as b,Ae as c,h as ct,Oe as d,v as dt,S as et,Ee as f,fe as ft,Te as g,Ce as h,Ne as i,f as it,Se as j,me as k,Q as l,y as lt,Z as m,Pe as n,b as nt,Ie as o,de as ot,De as p,F as q,Me as r,d as rt,Le as s,_ as st,je as t,p as tt,ke as u,g as ut,G as v,xe as w,W as x,be as y,I as z};
@@ -13,7 +13,7 @@ import * as _$drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
13
13
  import * as _$_makaio_storage_drizzle0 from "@makaio/framework/storage/drizzle";
14
14
  import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
15
15
  import * as _$drizzle_orm0 from "drizzle-orm";
16
- import { ActivationValidationError, CanonicalEffect, ClientAccountIdentifier, ClientDefinition as ClientDefinition$1, ClientExecutionContext, ClientInstallCompleted, ClientInstallProgress, ClientRuntimeObserveRequest, ClientSessionObservedBase, ClientSubjects, ClientUsageSnapshot, ClientWiringEntry, ClientWiringEntrySchema, ContributorDefinition, ManagedInstallDescriptor, ManagedInstallStrategy, PostInstallDescriptor, ProviderContractCatalogEntry, ProviderContributionEnvelope, RuntimeOutcomeCode } from "@makaio/framework/contracts/client";
16
+ import { ActivationValidationError, CanonicalEffect, ClientAccountIdentifier, ClientDefinition as ClientDefinition$1, ClientExecutionContext, ClientInstallCompleted, ClientInstallProgress, ClientRuntimeObserveRequest, ClientSessionObservedBase, ClientSessionTokenScope, ClientSubjects, ClientUsageSnapshot, ClientWiringEntry, ClientWiringEntrySchema, ContributorDefinition, ManagedInstallDescriptor, ManagedInstallStrategy, PostInstallDescriptor, ProviderContractCatalogEntry, ProviderContributionEnvelope, RuntimeOutcomeCode } from "@makaio/framework/contracts/client";
17
17
  import * as _$zod_v4_core0 from "zod/v4/core";
18
18
 
19
19
  //#region subsystems/client/src/atomic-modify-file.d.ts
@@ -1270,6 +1270,103 @@ declare class ClientSessionConfigService extends BaseService {
1270
1270
  private listClientIds;
1271
1271
  }
1272
1272
  //#endregion
1273
+ //#region subsystems/client/src/client-session-token-service.d.ts
1274
+ /**
1275
+ * Narrow write-only interface for recording session correlation tokens.
1276
+ *
1277
+ * Client services receive this interface injected from clients-core and call
1278
+ * it directly — the token is never placed on the bus so the `MAKAIO_DEBUG`
1279
+ * bus logger never sees the token value.
1280
+ */
1281
+ interface ClientSessionTokenSink {
1282
+ /**
1283
+ * Upsert a correlation token for the given scope.
1284
+ *
1285
+ * A later call for the same scope overwrites the previous entry — the
1286
+ * intended compaction path when `SessionStart` fires again with
1287
+ * `startMode: 'compact'`.
1288
+ */
1289
+ record(scope: ClientSessionTokenScope, token: string): void;
1290
+ }
1291
+ /**
1292
+ * In-process token store for `client.session.token.*` subjects.
1293
+ *
1294
+ * Tokens are written via the public {@link record} method (called directly by
1295
+ * the client service that produced the token, never over the bus) and read via
1296
+ * the `client.session.token.get` bus handler (reachable by remote MCP servers
1297
+ * over the WebSocket bus).
1298
+ *
1299
+ * Keeps tokens in memory keyed by adapter session id and an optional agent id.
1300
+ * A later {@link record} call for the same key overwrites the previous entry —
1301
+ * the intended compaction path when `SessionStart` fires again with
1302
+ * `startMode: 'compact'`.
1303
+ *
1304
+ * Access (both {@link record} and `get`) refreshes `lastActivity` and reorders
1305
+ * the entry to the Map tail so Map insertion order always reflects recency: the
1306
+ * first Map entry is the least recently active (LRU) and is evicted first when
1307
+ * the store exceeds {@link MAX_SESSION_TOKEN_COUNT}.
1308
+ *
1309
+ * The `agentId` dimension in the key builder is retained even though no client
1310
+ * currently declares `session.token` on `SubagentStart`. A client whose MCP
1311
+ * consumers can learn an agent id may declare `SubagentStart` later without a
1312
+ * contract change; the completion-cleanup handler would come back with it.
1313
+ */
1314
+ declare class ClientSessionTokenService extends BaseService implements ClientSessionTokenSink {
1315
+ /**
1316
+ * In-memory token store.
1317
+ *
1318
+ * Key: output of {@link buildKey}.
1319
+ * Value: the stored token entry.
1320
+ *
1321
+ * Map insertion order is used as an LRU indicator: every access calls
1322
+ * {@link touchEntry}, which deletes and re-inserts the entry to move it to
1323
+ * the tail. The head of the Map is therefore always the LRU entry.
1324
+ */
1325
+ private readonly store;
1326
+ /**
1327
+ * @param bus - Bus instance used for handler registration
1328
+ */
1329
+ constructor(bus: IMakaioBus);
1330
+ /**
1331
+ * Upsert a correlation token for the given scope.
1332
+ *
1333
+ * Called in-process by the client service that received the hook — the token
1334
+ * is handed over directly so no bus payload (and no `MAKAIO_DEBUG` bus
1335
+ * logger) ever sees it.
1336
+ *
1337
+ * A later call for the same scope overwrites the previous entry — the
1338
+ * intended compaction path when `SessionStart` fires again with
1339
+ * `startMode: 'compact'`. Never log the token value.
1340
+ * @param scope - Scope identifying the session (or subagent) that produced
1341
+ * the token.
1342
+ * @param token - The opaque correlation token to store.
1343
+ */
1344
+ record(scope: ClientSessionTokenScope, token: string): void;
1345
+ /**
1346
+ * Register bus handlers and start the TTL sweep timer.
1347
+ */
1348
+ protected onInit(): void;
1349
+ /**
1350
+ * Clear the in-memory store on teardown.
1351
+ */
1352
+ protected onDestroy(): void;
1353
+ /**
1354
+ * Build the lookup key for the in-memory store.
1355
+ *
1356
+ * The key always includes the client id so that two client providers that
1357
+ * share the same provider-local session id cannot collide in the store, and
1358
+ * a subagent-completion event for one client cannot delete the entry of
1359
+ * another. When an agent id is present, it is appended so that a subagent
1360
+ * token does not collide with or shadow the parent-session token.
1361
+ * @param clientId - Stable client identity (e.g. `'claude-code'`, `'codex'`).
1362
+ * @param adapterSessionId - Hook payload `session_id` from the client runtime.
1363
+ * @param agentId - Present for SubagentStart events; absent for top-level
1364
+ * SessionStart events.
1365
+ * @returns Composite key string for use in {@link store}.
1366
+ */
1367
+ private buildKey;
1368
+ }
1369
+ //#endregion
1273
1370
  //#region subsystems/client/src/client-session-observed-semantics.d.ts
1274
1371
  /**
1275
1372
  * Canonical schema for the raw catch-all hook payload delivered on
@@ -1880,16 +1977,18 @@ declare class ClientHookResponseRegistry {
1880
1977
  /**
1881
1978
  * Composite service that initialises and destroys the
1882
1979
  * {@link ClientRuntimeService}, the {@link ClientBinaryManager}, the
1883
- * {@link ClientConfigPrimeService}, the {@link ClientProfileService}, and the
1884
- * {@link ClientSessionConfigService}
1980
+ * {@link ClientConfigPrimeService}, the {@link ClientProfileService}, the
1981
+ * {@link ClientSessionConfigService}, and the {@link ClientSessionTokenService}
1885
1982
  * under a single {@link ExtensionServiceLifecycle} handle.
1886
1983
  *
1887
- * Also exposes the client hook response pipeline registries so other
1888
- * subsystems (provider runtimes, contribution processors) can register
1889
- * and unregister provider contracts and query contributor snapshots.
1984
+ * Also exposes the client hook response pipeline registries and the
1985
+ * {@link ClientSessionTokenSink} so other subsystems (provider runtimes,
1986
+ * contribution processors) can register and unregister provider contracts,
1987
+ * query contributor snapshots, and record session correlation tokens
1988
+ * in-process without the token ever appearing on the bus.
1890
1989
  *
1891
1990
  * The host coordinator calls `init()` once and `destroy()` once; this class
1892
- * ensures all five services participate in the same lifecycle without any
1991
+ * ensures all six services participate in the same lifecycle without any
1893
1992
  * requiring knowledge of the others.
1894
1993
  */
1895
1994
  declare class ClientsCoreService implements ExtensionServiceLifecycle {
@@ -1898,22 +1997,34 @@ declare class ClientsCoreService implements ExtensionServiceLifecycle {
1898
1997
  private readonly configPrimeService;
1899
1998
  private readonly profileService;
1900
1999
  private readonly sessionConfigService;
2000
+ private readonly sessionTokenService;
1901
2001
  /** Provider contract catalog registry for the hook response pipeline. */
1902
2002
  readonly providerContractRegistry: ClientHookProviderContractRegistry;
1903
2003
  /** Contributor definition registry for the hook response pipeline. */
1904
2004
  readonly hookResponseRegistry: ClientHookResponseRegistry;
2005
+ /**
2006
+ * In-process sink for session correlation tokens.
2007
+ *
2008
+ * Client runtime services receive this and call {@link ClientSessionTokenSink.record}
2009
+ * directly — the token is never placed on the bus so the `MAKAIO_DEBUG`
2010
+ * bus logger never sees it. MCP servers retrieve the stored token via the
2011
+ * normal `client.session.token.get` bus request.
2012
+ */
2013
+ readonly sessionTokens: ClientSessionTokenSink;
1905
2014
  /**
1906
2015
  * @param runtimeService - Handles `client.*` runtime observation subjects
1907
2016
  * @param binaryManager - Handles `client.*` binary-management subjects
1908
2017
  * @param configPrimeService - Handles generic `client.config.prime` delegation
1909
2018
  * @param profileService - Handles `client.profile.*` CRUD subjects
1910
2019
  * @param sessionConfigService - Handles `client.sessionConfig.*` isolation subjects
2020
+ * @param sessionTokenService - Handles `client.session.token.get` and stores
2021
+ * tokens written via its {@link ClientSessionTokenSink} interface
1911
2022
  * @param providerContractRegistry - Provider contract catalog for activation-time validation
1912
2023
  * @param hookResponseRegistry - Contributor definition registry for the hook response pipeline
1913
2024
  */
1914
- constructor(runtimeService: ClientRuntimeService, binaryManager: ClientBinaryManager, configPrimeService: ClientConfigPrimeService, profileService: ClientProfileService, sessionConfigService: ClientSessionConfigService, providerContractRegistry: ClientHookProviderContractRegistry, hookResponseRegistry: ClientHookResponseRegistry);
2025
+ constructor(runtimeService: ClientRuntimeService, binaryManager: ClientBinaryManager, configPrimeService: ClientConfigPrimeService, profileService: ClientProfileService, sessionConfigService: ClientSessionConfigService, sessionTokenService: ClientSessionTokenService, providerContractRegistry: ClientHookProviderContractRegistry, hookResponseRegistry: ClientHookResponseRegistry);
1915
2026
  /**
1916
- * Initialize all five sub-services in parallel.
2027
+ * Initialize all six sub-services in parallel.
1917
2028
  *
1918
2029
  * Uses {@link Promise.allSettled} so every service always attempts
1919
2030
  * initialisation — matching the resilience pattern used by {@link destroy}.
@@ -1922,7 +2033,7 @@ declare class ClientsCoreService implements ExtensionServiceLifecycle {
1922
2033
  */
1923
2034
  init(): Promise<void>;
1924
2035
  /**
1925
- * Destroy all five sub-services in parallel.
2036
+ * Destroy all six sub-services in parallel.
1926
2037
  *
1927
2038
  * Uses {@link Promise.allSettled} to guarantee every cleanup runs even when
1928
2039
  * one rejects, then reports every rejection together. Reporting is not
@@ -2937,6 +3048,14 @@ interface SessionEventDescriptor {
2937
3048
  * - `'request'` — request/response: install `makaio hook handle ...`
2938
3049
  */
2939
3050
  readonly mode: 'event' | 'request';
3051
+ /**
3052
+ * Lowest client binary version that fires this event, as a semver literal.
3053
+ *
3054
+ * Absent when the event is available across the whole `supportedVersions`
3055
+ * range of the client. The wiring layer uses this to skip events whose
3056
+ * minimum lies above the detected binary version.
3057
+ */
3058
+ readonly minimumVersion?: string;
2940
3059
  }
2941
3060
  /**
2942
3061
  * Build a shell-safe client command string from an executable and argv tokens.
@@ -2985,6 +3104,28 @@ declare function buildHookCommand(makaioCommand: string, sentinel: string, event
2985
3104
  * @returns Read-only array of `{ eventName, mode }` descriptors in declaration order.
2986
3105
  */
2987
3106
  declare function deriveSessionEventDescriptors(clientDefinition: ClientDefinition$1): ReadonlyArray<SessionEventDescriptor>;
3107
+ /**
3108
+ * Determine whether a session event should be wired given the detected binary
3109
+ * version.
3110
+ *
3111
+ * Enforcement semantics:
3112
+ * - When `descriptor.minimumVersion` is absent the event is supported across
3113
+ * the whole `supportedVersions` range — always return `true`.
3114
+ * - When `binaryVersion` is `null`, `undefined`, or any non-semver string
3115
+ * (for example the literal `'unknown'` that the CLI version detector emits
3116
+ * on parse failure, or a partial version such as `'2.1'`) the installed
3117
+ * version is unknown; treat the event as supported — return `true`.
3118
+ * - Otherwise return `true` only when `binaryVersion >= minimumVersion`.
3119
+ * @param descriptor - Session-event descriptor to test. Only `eventName` and
3120
+ * `minimumVersion` are inspected; the full descriptor is accepted for
3121
+ * convenience so callers need not destructure.
3122
+ * @param binaryVersion - Detected binary version string, or `null`/`undefined`
3123
+ * when the version could not be determined. Any value that is not a valid
3124
+ * exact semver (no leading `v`, no range syntax) is treated as unknown.
3125
+ * @returns `true` when the event should be wired, `false` when it should be
3126
+ * skipped because the binary is too old.
3127
+ */
3128
+ declare function isSessionEventSupported(descriptor: Pick<SessionEventDescriptor, 'eventName' | 'minimumVersion'>, binaryVersion: string | null | undefined): boolean;
2988
3129
  //#endregion
2989
3130
  //#region subsystems/client/src/client-hook-response-contribution-processor.d.ts
2990
3131
  /**
@@ -3122,4 +3263,4 @@ interface RegisteredContributor {
3122
3263
  */
3123
3264
  declare function collectContributions(snapshot: ReadonlyArray<RegisteredContributor>, clientId: string, requestDeadline: number | undefined, requestSignal: AbortSignal | undefined, eventName: string, eventPayload: unknown, providerContract?: ProviderContractCatalogEntry): Promise<CollectionResult>;
3124
3265
  //#endregion
3125
- export { AbsolutePathSchema, type AtomicContentParser, type AtomicModifier, type AtomicModifyOutcome, BinaryNotFoundError, type BuildClientSessionBaseOpts, CLIENT_RUNTIME_STATUSES, ClientAccountRegistry, type ClientAccountUpsertResult, ClientBinaryJobRunner, ClientBinaryManager, type ClientBinaryManagerConfig, type ClientBinaryResolutionPolicy, type ClientBinaryStateRecord, ClientBinaryStateRecordSchema, ClientBinaryStorageNamespace, ClientBinaryStorageSubjects, type ClientBinaryVersionRecord, ClientBinaryVersionRecordSchema, ClientBinaryVersionResolver, ClientConfigPrimeService, type ClientDefinitionLookup, ClientDefinitionRegistry, type ClientHookHandleResponse, ClientHookHandleResponseSchema, ClientHookProviderContractRegistry, ClientHookResponseRegistry, type ClientNamespaceResult, type ClientProfileRecord, ClientProfileRecordSchema, ClientProfileService, ClientProfileStorageNamespace, ClientProfileStorageSubjects, type ClientRuntimeRecord, ClientRuntimeRegistry, ClientRuntimeService, type ClientRuntimeStatus, ClientRuntimeStorageNamespace, ClientRuntimeStorageSubjects, ClientSessionConfigService, ClientSubjects, type ClientWiringAggregatedResult, ClientWiringAggregatedResultSchema, type ClientWiringApplyResponse, ClientWiringApplyResponseSchema, type ClientWiringEntry, ClientWiringEntrySchema, type ClientWiringListResponse, ClientWiringListResponseSchema, type ClientWiringListSubjectDef, type ClientWiringRemoveResponse, ClientWiringRemoveResponseSchema, type ClientWiringSubjectDefBase, type ClientsCorePackageOptions, ClientsCoreService, ClientsCoreToken, type ClosedFailureResult, type CollectionDiagnostic, type CollectionResult, type ContributorInstallResult, type ContributorOutcome, DEFAULT_HOOK_HANDLE_TIMEOUT_MS, type DiagnosticSeverity, type InstallArtifact, type InstallJob, type InstallStrategy, type JobCompletedCallback, type JobCompletionCallback, type JobCompletionResult, type JobProgressCallback, NOOP_HOOK_HANDLE_RESPONSE, type PostInstallContext, type PostInstallHandler, type RawClientHookHandleSubject, type RawClientHookPayload, RawClientHookPayloadSchema, type RawClientHookReceivedSubject, type RegisteredContributor, type RegisteredContributor$1 as RegistryContributor, type ResolvedInstallVersion, RuntimeRecordSchema, type RuntimeUpsertResult, type SessionEventDescriptor, type StrategyDependencies, assertAbsoluteProjectDir, atomicModifyFile, buildClientCommand, buildClientSessionBase, buildHookCommand, canonicalizeClientId, clientRuntimesDual, collectContributions, createClientHookResponseContributionProcessor, createClientNamespace, createClientWiringListSubjectDef, createClientWiringSubjectDef, createClientsCorePackage, createRawClientHookHandleSubject, createRawClientHookReceivedSubject, createStrategy, deriveSessionEventDescriptors, emitBestEffort, isPathWithinBase, pickNonEmptyString, pickNonEmptyStringValue, registerDrizzleClientBinaryStorage, registerDrizzleProfileStorage, registerDrizzleRuntimeStorage, registerStorageHandlersWithRollback, resolveAndValidateBasePath, resolveClientBinary, verifyInstalledVersion };
3266
+ export { AbsolutePathSchema, type AtomicContentParser, type AtomicModifier, type AtomicModifyOutcome, BinaryNotFoundError, type BuildClientSessionBaseOpts, CLIENT_RUNTIME_STATUSES, ClientAccountRegistry, type ClientAccountUpsertResult, ClientBinaryJobRunner, ClientBinaryManager, type ClientBinaryManagerConfig, type ClientBinaryResolutionPolicy, type ClientBinaryStateRecord, ClientBinaryStateRecordSchema, ClientBinaryStorageNamespace, ClientBinaryStorageSubjects, type ClientBinaryVersionRecord, ClientBinaryVersionRecordSchema, ClientBinaryVersionResolver, ClientConfigPrimeService, type ClientDefinitionLookup, ClientDefinitionRegistry, type ClientHookHandleResponse, ClientHookHandleResponseSchema, ClientHookProviderContractRegistry, ClientHookResponseRegistry, type ClientNamespaceResult, type ClientProfileRecord, ClientProfileRecordSchema, ClientProfileService, ClientProfileStorageNamespace, ClientProfileStorageSubjects, type ClientRuntimeRecord, ClientRuntimeRegistry, ClientRuntimeService, type ClientRuntimeStatus, ClientRuntimeStorageNamespace, ClientRuntimeStorageSubjects, ClientSessionConfigService, ClientSessionTokenService, type ClientSessionTokenSink, ClientSubjects, type ClientWiringAggregatedResult, ClientWiringAggregatedResultSchema, type ClientWiringApplyResponse, ClientWiringApplyResponseSchema, type ClientWiringEntry, ClientWiringEntrySchema, type ClientWiringListResponse, ClientWiringListResponseSchema, type ClientWiringListSubjectDef, type ClientWiringRemoveResponse, ClientWiringRemoveResponseSchema, type ClientWiringSubjectDefBase, type ClientsCorePackageOptions, ClientsCoreService, ClientsCoreToken, type ClosedFailureResult, type CollectionDiagnostic, type CollectionResult, type ContributorInstallResult, type ContributorOutcome, DEFAULT_HOOK_HANDLE_TIMEOUT_MS, type DiagnosticSeverity, type InstallArtifact, type InstallJob, type InstallStrategy, type JobCompletedCallback, type JobCompletionCallback, type JobCompletionResult, type JobProgressCallback, NOOP_HOOK_HANDLE_RESPONSE, type PostInstallContext, type PostInstallHandler, type RawClientHookHandleSubject, type RawClientHookPayload, RawClientHookPayloadSchema, type RawClientHookReceivedSubject, type RegisteredContributor, type RegisteredContributor$1 as RegistryContributor, type ResolvedInstallVersion, RuntimeRecordSchema, type RuntimeUpsertResult, type SessionEventDescriptor, type StrategyDependencies, assertAbsoluteProjectDir, atomicModifyFile, buildClientCommand, buildClientSessionBase, buildHookCommand, canonicalizeClientId, clientRuntimesDual, collectContributions, createClientHookResponseContributionProcessor, createClientNamespace, createClientWiringListSubjectDef, createClientWiringSubjectDef, createClientsCorePackage, createRawClientHookHandleSubject, createRawClientHookReceivedSubject, createStrategy, deriveSessionEventDescriptors, emitBestEffort, isPathWithinBase, isSessionEventSupported, pickNonEmptyString, pickNonEmptyStringValue, registerDrizzleClientBinaryStorage, registerDrizzleProfileStorage, registerDrizzleRuntimeStorage, registerStorageHandlersWithRollback, resolveAndValidateBasePath, resolveClientBinary, verifyInstalledVersion };