@makaio/framework 1.0.0-dev-1783355411417 → 1.0.0-dev-1783477169057

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 (153) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapter-Lx6K7yQS.mjs +1 -0
  3. package/dist/adapter-subsystem/index.mjs +1 -1
  4. package/dist/adapters/config/index.d.mts +1 -1
  5. package/dist/adapters/index.d.mts +219 -40
  6. package/dist/adapters/index.mjs +6 -6
  7. package/dist/adapters/node.d.mts +1 -1
  8. package/dist/adapters/node.mjs +4 -4
  9. package/dist/{base-orchestrator-BNysGvaM.d.mts → base-orchestrator-J1WKAUkF.d.mts} +32 -3
  10. package/dist/bus/index.d.mts +22 -22
  11. package/dist/bus/index.mjs +1 -1
  12. package/dist/client-l1Rq5p6X.mjs +1 -0
  13. package/dist/clients/index.d.mts +30 -0
  14. package/dist/clients/index.mjs +2 -2
  15. package/dist/contracts/adapter/index.d.mts +2 -2
  16. package/dist/contracts/adapter/index.mjs +1 -1
  17. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  18. package/dist/contracts/adapter/schemas/session-lineage.mjs +1 -1
  19. package/dist/contracts/artifact/index.d.mts +1 -1
  20. package/dist/contracts/canonical-model/index.d.mts +1 -1
  21. package/dist/contracts/client/index.d.mts +2 -2
  22. package/dist/contracts/client/index.mjs +1 -1
  23. package/dist/contracts/config/index.d.mts +12 -12
  24. package/dist/contracts/extension/index.d.mts +3 -3
  25. package/dist/contracts/facet/index.d.mts +1 -1
  26. package/dist/contracts/harness/index.d.mts +1 -1
  27. package/dist/contracts/index.d.mts +454 -276
  28. package/dist/contracts/index.mjs +1 -1
  29. package/dist/contracts/materialization/index.d.mts +3 -3
  30. package/dist/contracts/provider/index.d.mts +1 -1
  31. package/dist/contracts/session/index.d.mts +3 -3
  32. package/dist/contracts/session/index.mjs +1 -1
  33. package/dist/contracts/shared/index.d.mts +1 -1
  34. package/dist/contracts/skill/index.d.mts +1 -1
  35. package/dist/contracts/variant/index.d.mts +1 -1
  36. package/dist/contracts/workflow/index.d.mts +2 -2
  37. package/dist/{definition-b9jyJqPD.d.mts → definition-DePb3ke-.d.mts} +1 -1
  38. package/dist/drizzle/0023_m_mr9gc37m.sql +1 -0
  39. package/dist/drizzle/meta/_journal.json +7 -0
  40. package/dist/handlers-B74FvKlA.mjs +57 -0
  41. package/dist/hooks/index.d.mts +19 -2
  42. package/dist/{identity-BarL3JYI.mjs → identity-DC3Pk0ps.mjs} +1 -1
  43. package/dist/{index-BwGfdbI0.d.mts → index-2fK9iSHI.d.mts} +9 -9
  44. package/dist/{index-D7rWAEY0.d.mts → index-B-6DtLLz.d.mts} +1 -1
  45. package/dist/{index-4eP9DRL_.d.mts → index-B3fjN5HX.d.mts} +7 -7
  46. package/dist/{index-O08Q2ikz.d.mts → index-BMbmoarE.d.mts} +8 -8
  47. package/dist/{index-DV4nRk0h.d.mts → index-BX1MxwFr.d.mts} +28 -28
  48. package/dist/{index-CqCe7Phc.d.mts → index-BcwOnvUh.d.mts} +6 -6
  49. package/dist/{index-D6aAzr32.d.mts → index-BeouVICp.d.mts} +36 -36
  50. package/dist/{index-DQYj8-53.d.mts → index-BjO4Zkap.d.mts} +1 -1
  51. package/dist/{index-B5w-0Gg9.d.mts → index-Bl42SCEI.d.mts} +8 -8
  52. package/dist/{index-BYfSAJRC.d.mts → index-BvTd61i5.d.mts} +151 -29
  53. package/dist/{index-3X0368CL.d.mts → index-CA-AJbq6.d.mts} +4 -4
  54. package/dist/{index-C5C1tk9f.d.mts → index-CQQcnpev.d.mts} +41 -41
  55. package/dist/{index-BKZhnb2B.d.mts → index-C_xQM96Y.d.mts} +802 -422
  56. package/dist/{index-31vR1sxk.d.mts → index-CwFSL4xI.d.mts} +144 -21
  57. package/dist/{index-WHUV7neB.d.mts → index-DMz-2ACU.d.mts} +105 -105
  58. package/dist/{index-3J0HZlPH.d.mts → index-DScUb-hF.d.mts} +334 -13
  59. package/dist/{index-DEzdNQum.d.mts → index-Di84JjS0.d.mts} +2 -2
  60. package/dist/{index-DvHYpi-J.d.mts → index-Dv4oGVZK.d.mts} +1246 -397
  61. package/dist/{index-CaerrEDH.d.mts → index-NkNbYFud.d.mts} +1 -1
  62. package/dist/{index-D9-vOJvZ.d.mts → index-h5go5Dtd.d.mts} +1 -1
  63. package/dist/{index-DLNRgZPo2.d.mts → index-j_X5xefv2.d.mts} +26 -26
  64. package/dist/{index-C6Ys8pxt.d.mts → index-uM4KZopE.d.mts} +9 -9
  65. package/dist/kernel/extension/index.d.mts +1 -1
  66. package/dist/kernel/index.d.mts +2 -2
  67. package/dist/kernel/observability/index.d.mts +1 -1
  68. package/dist/{namespace-j7vFsmYL.d.mts → namespace-3yGm4WF9.d.mts} +2 -2
  69. package/dist/{namespace-D8P8Sxce2.d.mts → namespace-6sIu5nBI2.d.mts} +2 -2
  70. package/dist/{namespace-B3ol3pc-.d.mts → namespace-BigVYQyx.d.mts} +12 -0
  71. package/dist/{namespace-DmqoDDRD.d.mts → namespace-Boh42UoL.d.mts} +66 -22
  72. package/dist/{namespace-CfvtDD_U.d.mts → namespace-COEUMuHL.d.mts} +156 -156
  73. package/dist/{namespace-B4cV_pk3.d.mts → namespace-D94HrTtq.d.mts} +58 -58
  74. package/dist/{namespace-DhDY0juT.d.mts → namespace-OLAh9wHU.d.mts} +375 -27
  75. package/dist/{namespace-Bm77p82L.d.mts → namespace-TPbegIMi.d.mts} +27 -27
  76. package/dist/{package-MmQvNJ3u.d.mts → package-B6mEMD8r.d.mts} +5 -0
  77. package/dist/{package-BmRhhi-3.mjs → package-BQn_RTo7.mjs} +1 -1
  78. package/dist/package.json +1 -1
  79. package/dist/{schema-DLNBajAV.d.mts → schema-B5vHi7Uu.d.mts} +28 -1
  80. package/dist/{schemas-CoFCV42v.d.mts → schemas-CDBn9MTz.d.mts} +156 -156
  81. package/dist/schemas-CkOigLAT.mjs +1 -0
  82. package/dist/{schemas-lnE9YoG7.d.mts → schemas-CscdPqCt.d.mts} +3 -3
  83. package/dist/{schemas-DMMWmWjq.d.mts → schemas-D512XweP.d.mts} +4 -4
  84. package/dist/{schemas-DuuVuhHX2.d.mts → schemas-DOV4UouN2.d.mts} +13 -13
  85. package/dist/{schemas-DmGRSeIq.d.mts → schemas-t6h9oSct.d.mts} +28 -1
  86. package/dist/services/adapter-runtime/index.d.mts +4 -4
  87. package/dist/services/adapter-runtime/index.mjs +1 -1
  88. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  89. package/dist/services/adapter-runtime/schemas.d.mts +2 -2
  90. package/dist/services/adapter-runtime/schemas.mjs +1 -1
  91. package/dist/services/adapter-subsystem/index.d.mts +2 -2
  92. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  93. package/dist/services/agent-runtime/index.d.mts +2 -2
  94. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  95. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  96. package/dist/services/context-rules/index.d.mts +8 -8
  97. package/dist/services/execution-target/index.d.mts +1 -1
  98. package/dist/services/filesystem/namespace.d.mts +12 -12
  99. package/dist/services/filesystem/schemas.d.mts +6 -6
  100. package/dist/services/git/namespace.d.mts +2 -2
  101. package/dist/services/git/schemas.d.mts +1 -1
  102. package/dist/services/harness/index.d.mts +3 -3
  103. package/dist/services/index.d.mts +147 -140
  104. package/dist/services/index.mjs +1 -1
  105. package/dist/services/log-import/browser.d.mts +2 -2
  106. package/dist/services/log-import/index.d.mts +15 -2
  107. package/dist/services/log-import/index.mjs +2 -2
  108. package/dist/services/log-import/log-import.d.mts +1 -1
  109. package/dist/services/log-import/namespace.d.mts +2 -2
  110. package/dist/services/log-import/schemas.d.mts +1 -1
  111. package/dist/services/session/handlers/index.d.mts +1 -1
  112. package/dist/services/session/handlers/index.mjs +1 -1
  113. package/dist/services/session/index.d.mts +7 -7
  114. package/dist/services/session/index.mjs +1 -1
  115. package/dist/services/session/messages/namespace.d.mts +1 -1
  116. package/dist/services/session/session-events/namespace.d.mts +1 -1
  117. package/dist/services/session/storage/namespace.d.mts +1 -1
  118. package/dist/services/session/storage/schema.d.mts +1 -1
  119. package/dist/services/session/storage/schema.mjs +1 -1
  120. package/dist/services/session/testing/index.mjs +3 -2
  121. package/dist/services/session-editor/index.d.mts +1 -1
  122. package/dist/services/settings/namespace.d.mts +10 -10
  123. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  124. package/dist/services/subagent-template/index.d.mts +2 -2
  125. package/dist/services/subagent-template/namespace.d.mts +1 -1
  126. package/dist/services/subagent-template/schemas.d.mts +1 -1
  127. package/dist/services/tool-approval/index.mjs +1 -1
  128. package/dist/services/tools/index.mjs +1 -1
  129. package/dist/services/tray-menu/index.d.mts +2 -2
  130. package/dist/services/tray-menu/namespace.d.mts +1 -1
  131. package/dist/services/tray-menu/schemas.d.mts +1 -1
  132. package/dist/session-CoGaTin6.mjs +69 -0
  133. package/dist/session-Dp7z5N1d.mjs +1 -0
  134. package/dist/{session-lineage-DR-9DU-U.d.mts → session-lineage-C1M7-O3C.d.mts} +3 -3
  135. package/dist/{tool-approval-service-MU_DmJsf.mjs → tool-approval-service-BNXgr-az.mjs} +1 -1
  136. package/dist/tools-BaO4GYj0.mjs +1 -0
  137. package/dist/{transition-Dq41YCkc.d.mts → transition-Bbjlwv5K.d.mts} +1 -1
  138. package/dist/{types-BMS6yfLS.d.mts → types-BNW5n6qm.d.mts} +1 -1
  139. package/dist/{types-BMlzmWp6.d.mts → types-CNkx2awa.d.mts} +12 -1
  140. package/dist/{types-Cse8s_cD.d.mts → types-D7W0ntGr.d.mts} +45 -18
  141. package/dist/{types-C76EP81O.d.mts → types-jruUn6oW.d.mts} +694 -282
  142. package/dist/workflow-engine/index.d.mts +41 -41
  143. package/dist/workflow-engine/index.mjs +1 -1
  144. package/dist/workflow-engine/package.d.mts +1 -1
  145. package/dist/workflow-engine/package.mjs +1 -1
  146. package/package.json +1 -1
  147. package/dist/adapter-BRxCc72E.mjs +0 -1
  148. package/dist/client-BgUjVbXX.mjs +0 -1
  149. package/dist/handlers-v47Gbsr1.mjs +0 -57
  150. package/dist/schemas-ftgVeWIG.mjs +0 -1
  151. package/dist/session-CKWfn3oc.mjs +0 -1
  152. package/dist/session-DCbJwYEU.mjs +0 -69
  153. package/dist/tools-BrNm-een.mjs +0 -1
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ExtractSubjectPayload, ExtractSubjectResponse, HandlerForSubjectDefinition, ScopedSubjectDefinition, SubjectRecord } from "@makaio/framework/core";
3
3
  import { IFilteredBus, IMakaioBus, OnOptions, ScopedBus } from "@makaio/framework/bus";
4
- import { AIModel, AIReasoningLevel, AIReasoningLevel as AIReasoningLevel$1, AgentSchemas, AgentSubjects, CacheStrategy, JsonValue, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageBlock, MessageDeliveryMode, MessageDeliveryMode as MessageDeliveryMode$1, MessageInput, MessageOutcome, ProviderContext, ReasoningLevelMap as ReasoningLevelMap$1, ResponseSchemaDescriptor, SendMessageResultInnerResult, SessionContext, StructuredOutputValidation, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
4
+ import { AIModel, AIReasoningLevel, AIReasoningLevel as AIReasoningLevel$1, AgentSchemas, AgentSubjects, CacheStrategy, JsonValue, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageBlock, MessageDeliveryMode, MessageDeliveryMode as MessageDeliveryMode$1, MessageInput, MessageOutcome, NativeForkDirective, ProviderContext, ReasoningLevelMap as ReasoningLevelMap$1, ResponseSchemaDescriptor, SendMessageResultInnerResult, SessionContext, StructuredOutputValidation, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
5
5
  import { DeferredPromise, TimeoutConfig, TrackedTimeoutConfig } from "@makaio/framework/utils";
6
6
  import { SetRequired } from "type-fest";
7
7
 
@@ -563,33 +563,26 @@ declare abstract class AIAgentConnector<TBus extends ScopedBus<string> = ScopedB
563
563
  * @returns Session ID from provider
564
564
  */
565
565
  abstract getAdapterSessionId(): Promise<string>;
566
+ /**
567
+ * Provider-confirmed adapter session ID, or `undefined` when unconfirmed.
568
+ * Default returns `this.adapterSessionId`; Claude connectors override to
569
+ * defer until `system.init` confirms the provider-side session.
570
+ * @returns Confirmed ID or `undefined`
571
+ */
572
+ getConfirmedAdapterSessionId(): string | undefined;
566
573
  /**
567
574
  * Complete the agent session by waiting for all messages to finish.
568
575
  * @returns Last message result or null if no messages processed
569
576
  */
570
577
  abstract complete(): Promise<MessageResult | null>;
571
578
  /**
572
- * Create a MessageHandle with standard initialization.
573
- *
574
- * Centralizes the pattern used by all connectors:
575
- * 1. Generate messageId (use provided or generate UUID)
576
- * 2. Create MessageHandle instance
577
- * 3. Set adapterSessionId
578
- * 4. Call onMessageSent callback
579
+ * Create a MessageHandle with standard initialization (messageId, adapterSessionId, onMessageSent).
579
580
  * @param message - Normalized user message
580
581
  * @param options - Optional message options (id, delivery mode, history, and turn context)
581
- * @returns Initialized MessageHandle ready for enqueueing
582
+ * @returns Initialized MessageHandle instance
582
583
  */
583
584
  protected createMessageHandle(message: NormalizedMessageInput, options?: MessageHandleOptions): MessageHandle;
584
- /**
585
- * Signal that MCP tools have changed and should be refreshed at the next turn boundary.
586
- *
587
- * Called by the AIAgent layer when receiving MCP bus events (`mcp.tools.updated`,
588
- * `mcp.tools.enabled`). Connectors that support direct-inject tool refresh (e.g.,
589
- * `BaseStreamConnector`) override this to set an internal pending-refresh flag.
590
- * The default implementation is a no-op so connectors that do not manage MCP tools
591
- * directly are unaffected.
592
- */
585
+ /** Signal MCP tools changed; connectors with direct-inject refresh override this. */
593
586
  markToolRefreshPending(): void;
594
587
  /**
595
588
  * Stage the canonical orchestrator-assigned turn number for consumption by the next
@@ -802,6 +795,14 @@ interface ConfigFactoryInput<TBus extends ScopedBus<string> = ScopedBus<string>>
802
795
  * Passed through unchanged so connectors can track injection and mcp_call usage.
803
796
  */
804
797
  toolLedger?: ISessionToolLedger;
798
+ /**
799
+ * When true, the agent is ephemeral (one-shot, not a resume/fork target).
800
+ *
801
+ * Ephemeral agents skip PreUserMessage hooks and are never resumed or forked
802
+ * natively. Connectors should disable session persistence for ephemeral agents
803
+ * so no transcript is written to the provider's session store.
804
+ */
805
+ ephemeral?: boolean;
805
806
  }
806
807
  /**
807
808
  * Interface for adapter-specific configuration factories.
@@ -909,6 +910,12 @@ interface BaseAgentConnectorConfig<TBus extends ScopedBus<string> = ScopedBus<st
909
910
  supportedReasoningLevels?: ReasoningLevelMap$1;
910
911
  /** Previous adapter session ID for resume attempts. */
911
912
  resumeAdapterSessionId?: string;
913
+ /**
914
+ * Provider-native fork directive approved by session orchestration.
915
+ * When present, native-fork capable connectors should branch from the source
916
+ * provider session instead of starting fresh with replayed history.
917
+ */
918
+ nativeFork?: NativeForkDirective;
912
919
  /** Resolved harness ID for tool policy lookup. */
913
920
  harnessId?: string;
914
921
  /** Client identifier for the application this adapter belongs to (e.g., 'claude-code', 'gemini'). */
@@ -939,6 +946,14 @@ interface BaseAgentConnectorConfig<TBus extends ScopedBus<string> = ScopedBus<st
939
946
  * When present, the connector records tool events into this ledger.
940
947
  */
941
948
  toolLedger?: ISessionToolLedger;
949
+ /**
950
+ * When true, the connector is handling an ephemeral one-shot agent.
951
+ *
952
+ * Ephemeral agents are by contract never resume or fork targets. Connectors
953
+ * that support session persistence should disable it for ephemeral agents so
954
+ * no transcript is written to the provider's session store.
955
+ */
956
+ ephemeral?: boolean;
942
957
  }
943
958
  /**
944
959
  * Configuration for creating an AIAgent instance.
@@ -1001,6 +1016,18 @@ interface AIAgentConfig<TBus extends ScopedBus<string> = ScopedBus<string>, TCon
1001
1016
  * are not needed and would be actively harmful.
1002
1017
  */
1003
1018
  ephemeral?: boolean;
1019
+ /**
1020
+ * Native fork directive from the orchestrator.
1021
+ *
1022
+ * When present, the adapter should use the provider's branching API
1023
+ * rather than replaying history into a fresh session.
1024
+ * Populated by AIAdapter.createAgent when the startAgent mode is 'fork'.
1025
+ *
1026
+ * AIAgent forwards this through config-factory input so standardized adapter
1027
+ * config factories can carry it into connector config. Adapter code must not
1028
+ * derive this from raw fork-mode request fields.
1029
+ */
1030
+ nativeFork?: NativeForkDirective;
1004
1031
  /**
1005
1032
  * Config factory - transforms partial input into full adapter-specific config.
1006
1033
  * This is the seam where adapters inject their defaults (especially model).