@makaio/framework 1.0.0-dev-1783282710723 → 1.0.0-dev-1783439621927
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/adapter-Lx6K7yQS.mjs +1 -0
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/index.d.mts +229 -41
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/{base-orchestrator-Cw0vpNgB.d.mts → base-orchestrator-ODRyDBzu.d.mts} +79 -3
- package/dist/bus/index.mjs +1 -1
- package/dist/client-n0OJiTt1.mjs +1 -0
- package/dist/contracts/adapter/index.d.mts +2 -2
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.mjs +1 -1
- package/dist/contracts/artifact/index.d.mts +1 -1
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/config/index.d.mts +6 -6
- package/dist/contracts/extension/index.d.mts +2 -2
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +375 -197
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/provider/index.d.mts +1 -1
- package/dist/contracts/session/index.d.mts +3 -3
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{definition-DFcxkf2i.d.mts → definition-DpkfJi8v.d.mts} +1 -1
- package/dist/drizzle/0021_m_mr8e1j84.sql +3 -0
- package/dist/drizzle/0022_m_mr8i4ky3.sql +43 -0
- package/dist/drizzle/0023_m_mr9gc37m.sql +1 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/{handler-2bPhRn0u.mjs → handler-BFNvtv5t.mjs} +1 -1
- package/dist/handlers-B74FvKlA.mjs +57 -0
- package/dist/hooks/index.d.mts +27 -2
- package/dist/hooks/index.mjs +1 -1
- package/dist/{identity-BarL3JYI.mjs → identity-DC3Pk0ps.mjs} +1 -1
- package/dist/{index-4eP9DRL_.d.mts → index-B3fjN5HX.d.mts} +7 -7
- package/dist/{index-Bh6lHiW4.d.mts → index-B5Uczo3R.d.mts} +40 -40
- package/dist/{index-CL2T6LVv.d.mts → index-BIZeIA5k.d.mts} +8 -8
- package/dist/{index-gAFwNiJT.d.mts → index-BvTd61i5.d.mts} +212 -26
- package/dist/{index-Y2r0Zvcm.d.mts → index-BvjLe_w9.d.mts} +12 -12
- package/dist/{index-2fK9iSHI.d.mts → index-BwGfdbI0.d.mts} +9 -9
- package/dist/{index-CaOWqztb.d.mts → index-C8k2f_E0.d.mts} +1 -1
- package/dist/{index-DEzdNQum.d.mts → index-CYHWOXUm.d.mts} +1 -1
- package/dist/{index-9b2_jXxq.d.mts → index-CwHP8Jxs.d.mts} +514 -96
- package/dist/{index-D6aAzr32.d.mts → index-Cyi7y_aG.d.mts} +20 -20
- package/dist/{index-DdBRlm7m.d.mts → index-D7Fu3375.d.mts} +401 -21
- package/dist/{index-CfIW5biI.d.mts → index-D7rWAEY0.d.mts} +1 -0
- package/dist/{index-CTEsbp9H.d.mts → index-DFK3tpEY.d.mts} +83 -5
- package/dist/{index-Dg-y1mrq.d.mts → index-DS6kxiFl.d.mts} +28 -28
- package/dist/{index-BMbmoarE.d.mts → index-DTBQOCar.d.mts} +16 -16
- package/dist/{index-GD-i3DW7.d.mts → index-DmJ-OpTD.d.mts} +1275 -224
- package/dist/{index-DLy-tc0L.d.mts → index-Dtb2cVJz.d.mts} +260 -47
- package/dist/{index-D9-vOJvZ.d.mts → index-h5go5Dtd.d.mts} +1 -1
- 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/{lib-Ba55od_d.mjs → lib-BOmKyjWD.mjs} +1 -1
- package/dist/{lib-CM_BUxN8.mjs → lib-DLZYp5z3.mjs} +1 -1
- package/dist/{loop-gate-handlers-BLoGCWMQ.mjs → loop-gate-handlers-Bjmat-K3.mjs} +1 -1
- package/dist/{namespace-D8P8Sxce2.d.mts → namespace-6sIu5nBI2.d.mts} +2 -2
- package/dist/{namespace-CfvtDD_U.d.mts → namespace-BLER-Qom.d.mts} +2 -2
- package/dist/{namespace-B3ol3pc-.d.mts → namespace-BigVYQyx.d.mts} +12 -0
- package/dist/{namespace-j7vFsmYL.d.mts → namespace-C74bbsdZ.d.mts} +2 -2
- package/dist/{namespace-B4cV_pk3.d.mts → namespace-CGxFYDlK.d.mts} +32 -32
- package/dist/{namespace-LUNf8zo5.d.mts → namespace-D1_9WVCo.d.mts} +157 -0
- package/dist/{namespace-KMxsPJwm.d.mts → namespace-D4Uf5Mw_.d.mts} +432 -18
- package/dist/{namespace-BsYKEMd8.d.mts → namespace-DAj_riOn.d.mts} +138 -0
- package/dist/{namespace-DXW-voCe.d.mts → namespace-DRXQyBe0.d.mts} +204 -24
- package/dist/{namespace-DGAWYjbO.d.mts → namespace-JFzrlNs4.d.mts} +27 -27
- package/dist/namespace-dFBD2ZmS.mjs +1 -0
- package/dist/node/transports/index.mjs +1 -1
- package/dist/orchestrator-shared-ChygCvR1.mjs +1 -0
- package/dist/{orchestrator-shared-ChOdIgh6.d.mts → orchestrator-shared-DFLb1otg.d.mts} +9 -3
- package/dist/{package-MmQvNJ3u.d.mts → package-B6mEMD8r.d.mts} +5 -0
- package/dist/package-BQn_RTo7.mjs +1 -0
- package/dist/package.json +1 -1
- package/dist/runtime-node/index.mjs +1 -1
- package/dist/schema-7aKBGB7S.mjs +1 -0
- package/dist/{schema-D1HrnvT7.d.mts → schema-B9goOieO.d.mts} +50 -1
- package/dist/{schema-DHlTAy0N.mjs → schema-CHp6I33k.mjs} +1 -1
- package/dist/{schemas-D-9zNyAM2.d.mts → schemas-9S9Y9PHT2.d.mts} +7 -7
- package/dist/{schemas-CoFCV42v.d.mts → schemas-B_t6oOK-.d.mts} +2 -2
- package/dist/{schemas-lnE9YoG7.d.mts → schemas-CW6YsPT4.d.mts} +3 -3
- package/dist/schemas-CkOigLAT.mjs +1 -0
- package/dist/{schemas-BemsLc_V.d.mts → schemas-CurUbHy4.d.mts} +4 -4
- package/dist/{schemas-DMCGXlKa.d.mts → schemas-DXeGCbJ9.d.mts} +4 -4
- package/dist/schemas-DZGnr9Tl.mjs +1 -0
- package/dist/{schemas-DWfo0wp4.d.mts → schemas-DnmbwE_V.d.mts} +7 -7
- package/dist/{schemas-DmGRSeIq.d.mts → schemas-t6h9oSct.d.mts} +28 -1
- package/dist/services/adapter-runtime/index.d.mts +4 -4
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +2 -2
- package/dist/services/adapter-runtime/schemas.mjs +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +3 -3
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.d.mts +2 -2
- package/dist/services/git/schemas.d.mts +2 -2
- package/dist/services/harness/index.d.mts +4 -4
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +129 -53
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +86 -6
- package/dist/services/log-import/index.mjs +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.d.mts +54 -0
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.d.mts +44 -0
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +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/storage/schema.mjs +1 -1
- package/dist/services/session/testing/index.mjs +10 -4
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/settings/namespace.d.mts +7 -7
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +2 -2
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/turn/schemas.d.mts +89 -0
- package/dist/services/turn/schemas.mjs +1 -1
- package/dist/session-CZUrp7gC.mjs +69 -0
- package/dist/session-Dp7z5N1d.mjs +1 -0
- package/dist/{session-lineage-DR-9DU-U.d.mts → session-lineage-C1M7-O3C.d.mts} +3 -3
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/{storage-namespace-Di1A3DMm.d.mts → storage-namespace-BvRF22by.d.mts} +10 -10
- package/dist/{tool-approval-service-DEQiipxj.mjs → tool-approval-service-BIbUSuqg.mjs} +1 -1
- package/dist/tools-Yz8XyiwA.mjs +1 -0
- package/dist/{transition-DnXibkhX.d.mts → transition-DYorNHZu.d.mts} +1 -1
- package/dist/{types-Dur8EtpR.d.mts → types-9XCB1aPK.d.mts} +562 -107
- package/dist/{types-BMS6yfLS.d.mts → types-BNW5n6qm.d.mts} +1 -1
- package/dist/{types-BslClRkH.d.mts → types-BWduCvRU.d.mts} +22 -1
- package/dist/{types-Cse8s_cD.d.mts → types-N_BOtTqt.d.mts} +29 -18
- package/dist/ui-components/index.mjs +1 -1
- package/dist/ui-kernel/index.d.mts +4 -4
- package/dist/ui-kernel/pages/namespace.d.mts +4 -4
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/{workflow-BqH6ar-D.mjs → workflow-C1z7I5CI.mjs} +1 -1
- package/dist/workflow-engine/index.d.mts +45 -45
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/package.json +1 -1
- package/dist/adapter-DaQqmKOJ.mjs +0 -1
- package/dist/client-BcfR-LJC.mjs +0 -1
- package/dist/handlers-BAycjV02.mjs +0 -41
- package/dist/namespace-C-piH3w4.mjs +0 -1
- package/dist/orchestrator-shared-Cxk3x8Vs.mjs +0 -1
- package/dist/package-B1AXe-oz.mjs +0 -1
- package/dist/schema-D6WAI8OL.mjs +0 -1
- package/dist/schemas-ArqQTC0Q.mjs +0 -1
- package/dist/schemas-uID59wR8.mjs +0 -1
- package/dist/session-0nWT4st6.mjs +0 -39
- package/dist/session-DH-ja8Ka.mjs +0 -1
- package/dist/tools-DFOsOboy.mjs +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as MessageHandle, B as ReasoningLevelMap, C as SendMessageRequestPayload, D as IAdapterConfigFactory, E as ConfigFactoryInput, F as MessageState, H as LedgerSessionContext, I as ProcessingState, L as SendMessageOptions, M as NormalizedMessageInput, N as normalizeMessageInput, O as AIAgentConnector, P as MessageResult, R as AIModel, S as NormalizedCallUsage, T as StartAgentOptions, U as SessionToolLedger, V as ISessionToolLedger, W as ToolLedgerEntry, _ as ConnectorSendMessageOptions, a as AgentCwdChangeRequestPayload, b as ExecutionContext, c as AgentInterruptRequestPayload, d as AgentMcpServersSetResponsePayload, f as AgentModelChangeRequestPayload, g as BaseAgentConnectorConfig, h as AgentStartResult, i as AgentCredentialChangeResponsePayload, j as markCompletedWithFinalResult, k as MessageDeliveryMode, l as AgentInterruptResponsePayload, m as AgentSendMessageOptions, n as AgentContext, o as AgentCwdChangeResponsePayload, p as AgentModelChangeResponsePayload, r as AgentCredentialChangeRequestPayload, s as AgentIdentity, t as AIAgentConfig, u as AgentMcpServersSetRequestPayload, v as ConnectorStartOptions, w as SendMessageResponsePayload, x as GetCapabilitiesResponsePayload, y as ContextWindowInput, z as AIReasoningLevel } from "../types-
|
|
2
|
-
import { _ as
|
|
1
|
+
import { A as MessageHandle, B as ReasoningLevelMap, C as SendMessageRequestPayload, D as IAdapterConfigFactory, E as ConfigFactoryInput, F as MessageState, H as LedgerSessionContext, I as ProcessingState, L as SendMessageOptions, M as NormalizedMessageInput, N as normalizeMessageInput, O as AIAgentConnector, P as MessageResult, R as AIModel, S as NormalizedCallUsage, T as StartAgentOptions, U as SessionToolLedger, V as ISessionToolLedger, W as ToolLedgerEntry, _ as ConnectorSendMessageOptions, a as AgentCwdChangeRequestPayload, b as ExecutionContext, c as AgentInterruptRequestPayload, d as AgentMcpServersSetResponsePayload, f as AgentModelChangeRequestPayload, g as BaseAgentConnectorConfig, h as AgentStartResult, i as AgentCredentialChangeResponsePayload, j as markCompletedWithFinalResult, k as MessageDeliveryMode, l as AgentInterruptResponsePayload, m as AgentSendMessageOptions, n as AgentContext, o as AgentCwdChangeResponsePayload, p as AgentModelChangeResponsePayload, r as AgentCredentialChangeRequestPayload, s as AgentIdentity, t as AIAgentConfig, u as AgentMcpServersSetRequestPayload, v as ConnectorStartOptions, w as SendMessageResponsePayload, x as GetCapabilitiesResponsePayload, y as ContextWindowInput, z as AIReasoningLevel } from "../types-N_BOtTqt.mjs";
|
|
2
|
+
import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-ODRyDBzu.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as _$_makaio_core0 from "@makaio/framework/core";
|
|
5
5
|
import { CreateBusNamespaceOptions, ExtractSubjectPayload, FilterablePayloadIntersection, HandlerForSubjectDefinition, RegistrableBusNamespaceDefinition, RequestContext, SchemaRecord, ScopedSubjectDefinition, SubjectDefinition, SubjectRecordFromSchemaRecord } from "@makaio/framework/core";
|
|
6
6
|
import { BusNamespace, IMakaioBus, OnOptions, ScopedBus, ScopedBusFor } from "@makaio/framework/bus";
|
|
7
|
-
import { AIReasoningLevel as AIReasoningLevel$1, AdapterClientRef, AdapterDefinitionContract, AdapterProviderDefinitionContract, AdapterSubjects, AgentSchemas, AgentStarted, AgentSubjects, AgentToolApproveRequest, AgentToolApproveResponse, BlockData, HarnessDefinition, HarnessSubjects, JsonValue, McpResolvedServer, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageInput, ProviderContext, ProviderDefinitionInput, ReasoningLevelMap as ReasoningLevelMap$1, ResponseSchemaDescriptor, SendMessageRequest, SendMessageResponse, SessionContext, SessionMessageBlock, StartAgentRequest, StartAgentResponse, StepType, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
|
|
7
|
+
import { AIReasoningLevel as AIReasoningLevel$1, AdapterClientRef, AdapterDefinitionContract, AdapterProviderDefinitionContract, AdapterSubjects, AgentSchemas, AgentStarted, AgentSubjects, AgentToolApproveRequest, AgentToolApproveResponse, BlockData, HarnessDefinition, HarnessSubjects, JsonValue, McpResolvedServer, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageInput, NativeForkDirective, ProviderContext, ProviderDefinitionInput, ReasoningLevelMap as ReasoningLevelMap$1, ResponseSchemaDescriptor, SendMessageRequest, SendMessageResponse, SessionContext, SessionMessageBlock, StartAgentRequest, StartAgentResponse, StartMode, StepType, SystemPrompt, ToolListItem } from "@makaio/framework/contracts";
|
|
8
8
|
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
9
9
|
import * as _$_makaio_ai_adapters_core0 from "@makaio/framework/adapters";
|
|
10
10
|
import * as _$type_fest0 from "type-fest";
|
|
@@ -69,6 +69,15 @@ interface LogImportRegistration {
|
|
|
69
69
|
LogDiscoveryOrchestratorClass?: LogOrchestratorConstructor;
|
|
70
70
|
/** Glob pattern for log files. */
|
|
71
71
|
logFilePattern: string;
|
|
72
|
+
/**
|
|
73
|
+
* Stable client application id (e.g., `'claude-code'`) whose native hooks
|
|
74
|
+
* observe the sessions this importer ingests.
|
|
75
|
+
*
|
|
76
|
+
* Enables client-agnostic framework components to resolve the importer for
|
|
77
|
+
* a `client.session.*` event without hard-coding importer names. Any string
|
|
78
|
+
* is valid — framework logic never hard-codes specific client ids.
|
|
79
|
+
*/
|
|
80
|
+
clientId?: string;
|
|
72
81
|
}
|
|
73
82
|
//#endregion
|
|
74
83
|
//#region adapters/core/src/types/provider-definition.d.ts
|
|
@@ -257,6 +266,7 @@ interface AIAdapterCapabilityRegistry {
|
|
|
257
266
|
session: {
|
|
258
267
|
resume: boolean;
|
|
259
268
|
fork: boolean;
|
|
269
|
+
forkAtMessage: boolean;
|
|
260
270
|
};
|
|
261
271
|
chat: {
|
|
262
272
|
inTurnMessages: boolean;
|
|
@@ -1404,7 +1414,7 @@ declare const ScopedToolApprovalSchema: {
|
|
|
1404
1414
|
agentId: z.ZodString;
|
|
1405
1415
|
adapterId: z.ZodString;
|
|
1406
1416
|
adapterName: z.ZodString;
|
|
1407
|
-
adapterSessionId: z.ZodString
|
|
1417
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1408
1418
|
messageId: z.ZodOptional<z.ZodString>;
|
|
1409
1419
|
turnId: z.ZodOptional<z.ZodString>;
|
|
1410
1420
|
clientId: z.ZodOptional<z.ZodString>;
|
|
@@ -1541,7 +1551,9 @@ type ConnectorEventHandlers<TMessage, TDiscriminator extends string> = { [K in D
|
|
|
1541
1551
|
* Emit function type for global bus emissions.
|
|
1542
1552
|
* Matches the signature of AIAgent.emitGlobal.
|
|
1543
1553
|
*/
|
|
1544
|
-
type EmitGlobalFn = <S extends SubjectDefinition>(subject: S, payload: Omit<ExtractSubjectPayload<S>, keyof AgentContext>
|
|
1554
|
+
type EmitGlobalFn = <S extends SubjectDefinition>(subject: S, payload: Omit<ExtractSubjectPayload<S>, keyof AgentContext> & {
|
|
1555
|
+
turnId?: string;
|
|
1556
|
+
}) => Promise<void>;
|
|
1545
1557
|
/**
|
|
1546
1558
|
* Configuration for MessageLifecycleTracker.
|
|
1547
1559
|
*/
|
|
@@ -1549,6 +1561,11 @@ interface MessageLifecycleTrackerConfig {
|
|
|
1549
1561
|
/** Function to emit events to global bus with auto-enrichment */
|
|
1550
1562
|
emitGlobal: EmitGlobalFn;
|
|
1551
1563
|
}
|
|
1564
|
+
/** Options for tracking a connector message handle. */
|
|
1565
|
+
interface MessageLifecycleTrackOptions {
|
|
1566
|
+
/** Turn ID captured before connector dispatch, if the request belongs to a session turn. */
|
|
1567
|
+
turnId: string | undefined;
|
|
1568
|
+
}
|
|
1552
1569
|
/**
|
|
1553
1570
|
* Tracks message lifecycle and emits corresponding events.
|
|
1554
1571
|
*
|
|
@@ -1597,8 +1614,9 @@ declare class MessageLifecycleTracker {
|
|
|
1597
1614
|
* - user_message.acknowledged
|
|
1598
1615
|
* - agent.turn.started
|
|
1599
1616
|
* @param handle - The message handle being acknowledged
|
|
1617
|
+
* @param turnId - Turn ID captured when the handle was registered
|
|
1600
1618
|
*/
|
|
1601
|
-
acknowledge(handle: MessageHandle): void;
|
|
1619
|
+
acknowledge(handle: MessageHandle, turnId?: string): void;
|
|
1602
1620
|
/**
|
|
1603
1621
|
* Complete a message - marks turn end.
|
|
1604
1622
|
*
|
|
@@ -1607,8 +1625,9 @@ declare class MessageLifecycleTracker {
|
|
|
1607
1625
|
* - user_message.completed (always, with outcome)
|
|
1608
1626
|
* @param handle - The message handle being completed
|
|
1609
1627
|
* @param result - The completion result with outcome
|
|
1628
|
+
* @param turnId - Turn ID captured when the handle was registered
|
|
1610
1629
|
*/
|
|
1611
|
-
complete(handle: MessageHandle, result: MessageResult): void;
|
|
1630
|
+
complete(handle: MessageHandle, result: MessageResult, turnId?: string): void;
|
|
1612
1631
|
/**
|
|
1613
1632
|
* Wire up a message handle for lifecycle tracking.
|
|
1614
1633
|
*
|
|
@@ -1619,8 +1638,9 @@ declare class MessageLifecycleTracker {
|
|
|
1619
1638
|
* @param handle - The message handle to track
|
|
1620
1639
|
* @param onTerminal - Optional callback for any terminal outcome (emits agent.complete)
|
|
1621
1640
|
* @param transformTerminal - Optional async transform applied before public completion resolves
|
|
1641
|
+
* @param options - Optional tracking metadata captured before connector dispatch
|
|
1622
1642
|
*/
|
|
1623
|
-
track(handle: MessageHandle, onTerminal?: (messageId: string, result: MessageResult) => void, transformTerminal?: (result: MessageResult) => Promise<MessageResult
|
|
1643
|
+
track(handle: MessageHandle, onTerminal?: (messageId: string, result: MessageResult, turnId: string | undefined) => void, transformTerminal?: (result: MessageResult) => Promise<MessageResult>, options?: MessageLifecycleTrackOptions): void;
|
|
1624
1644
|
}
|
|
1625
1645
|
//#endregion
|
|
1626
1646
|
//#region adapters/core/src/agent/tool-call-tracker.d.ts
|
|
@@ -1730,6 +1750,15 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
|
|
|
1730
1750
|
private latestMessageCompletion?;
|
|
1731
1751
|
/** Current content block index within the turn, reset on each turn start */
|
|
1732
1752
|
private currentBlockIndex;
|
|
1753
|
+
/**
|
|
1754
|
+
* Start mode for the next `emitStart()` call (consume-on-read).
|
|
1755
|
+
*
|
|
1756
|
+
* Set before dispatch; {@link emitStart} reads and clears the slot so
|
|
1757
|
+
* subsequent calls within the same dispatch (e.g. Copilot SDK sub-turns)
|
|
1758
|
+
* fall back to `'rotation'`. The `undefined` initial value is safe —
|
|
1759
|
+
* every first-start path sets the mode before the connector fires.
|
|
1760
|
+
*/
|
|
1761
|
+
private pendingStartMode;
|
|
1733
1762
|
/** Normalized config with defaults applied */
|
|
1734
1763
|
protected readonly config: SetRequired<AIAgentConfig<TBus, TConnector>, 'globalBus'>;
|
|
1735
1764
|
/** Available models for context window lookup */
|
|
@@ -1772,7 +1801,23 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
|
|
|
1772
1801
|
* @throws Error if already initialized
|
|
1773
1802
|
*/
|
|
1774
1803
|
init(): Promise<void>;
|
|
1775
|
-
|
|
1804
|
+
/**
|
|
1805
|
+
* Emit `agent.started` with the pending start mode (consume-on-read).
|
|
1806
|
+
*
|
|
1807
|
+
* Reads and clears {@link pendingStartMode}; subsequent calls within
|
|
1808
|
+
* the same dispatch fall back to `'rotation'`.
|
|
1809
|
+
* @param event - Optional additional fields to merge into the payload
|
|
1810
|
+
*/
|
|
1811
|
+
protected emitStart(event?: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId' | 'model' | 'cwd' | 'startMode'>): Promise<void>;
|
|
1812
|
+
/**
|
|
1813
|
+
* Set the start mode for the next `emitStart()` invocation.
|
|
1814
|
+
*
|
|
1815
|
+
* Called by the turn executor or `initialize()` before dispatching to
|
|
1816
|
+
* the connector. The value is consumed (cleared) by the first
|
|
1817
|
+
* `emitStart()` call, enforcing the one-shot invariant.
|
|
1818
|
+
* @param mode - The start mode to embed in the next `agent.started` event
|
|
1819
|
+
*/
|
|
1820
|
+
setPendingStartMode(mode: StartMode): void;
|
|
1776
1821
|
protected emitCompletion(result: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>): Promise<void>;
|
|
1777
1822
|
/**
|
|
1778
1823
|
* Stash error metadata for the next emitCompletion call.
|
|
@@ -1796,7 +1841,7 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
|
|
|
1796
1841
|
* @param payload - The base payload to enrich
|
|
1797
1842
|
* @returns Payload with AgentContext fields and optional messageId added
|
|
1798
1843
|
*/
|
|
1799
|
-
protected enrichPayload<T extends object>(payload: T): Promise<T &
|
|
1844
|
+
protected enrichPayload<T extends object>(payload: T): Promise<T & AgentIdentity & {
|
|
1800
1845
|
messageId?: string;
|
|
1801
1846
|
}>;
|
|
1802
1847
|
/**
|
|
@@ -2003,46 +2048,46 @@ declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string
|
|
|
2003
2048
|
/**
|
|
2004
2049
|
* Ensure the connector is initialized, throwing if not.
|
|
2005
2050
|
* @returns The initialized connector instance
|
|
2006
|
-
* @throws Error if connector is not initialized
|
|
2007
2051
|
*/
|
|
2008
2052
|
private ensureConnector;
|
|
2009
2053
|
/**
|
|
2010
|
-
* Determine whether to use native session resume
|
|
2011
|
-
*
|
|
2012
|
-
* Native resume: SDK manages history, don't inject messageHistory, preserve cache.
|
|
2013
|
-
* Fresh with history: Create new session, inject messageHistory.
|
|
2014
|
-
*
|
|
2015
|
-
* Override in adapter-specific agents if needed.
|
|
2054
|
+
* Determine whether to use native session resume (SDK manages history) or
|
|
2055
|
+
* fresh-with-history (new session, injected messageHistory).
|
|
2016
2056
|
* @param sessionContext - Context signals from SessionOrchestrator
|
|
2017
2057
|
* @returns true if native resume should be used
|
|
2018
2058
|
*/
|
|
2019
2059
|
protected shouldUseNativeResume(sessionContext?: SessionContext): boolean;
|
|
2020
2060
|
/**
|
|
2021
|
-
* Whether this adapter supports native session resume.
|
|
2022
|
-
* Override in adapter-specific agents that can resume SDK sessions.
|
|
2061
|
+
* Whether this adapter supports native session resume. Override in concrete agents.
|
|
2023
2062
|
* @returns true if native resume is supported
|
|
2024
2063
|
*/
|
|
2025
2064
|
protected supportsNativeResume(): boolean;
|
|
2065
|
+
/**
|
|
2066
|
+
* Whether this adapter supports provider-native session fork.
|
|
2067
|
+
* Override in concrete agents that can branch from an existing provider session.
|
|
2068
|
+
* @returns true if native fork is supported
|
|
2069
|
+
*/
|
|
2070
|
+
protected supportsNativeFork(): boolean;
|
|
2026
2071
|
/**
|
|
2027
2072
|
* Start the agent with an initial message.
|
|
2028
2073
|
*
|
|
2029
|
-
* Ensures the agent is initialized (idempotent)
|
|
2030
|
-
*
|
|
2031
|
-
*
|
|
2032
|
-
* HookAbortError propagates to caller.
|
|
2074
|
+
* Ensures the agent is initialized (idempotent), runs PreUserMessage hooks,
|
|
2075
|
+
* and uses sessionContext signals to decide between native resume and fresh
|
|
2076
|
+
* with history. HookAbortError propagates to caller.
|
|
2033
2077
|
* @param message - User message (normalized or unnormalized)
|
|
2034
2078
|
* @param options - Optional start options (e.g., delivery mode, sessionContext)
|
|
2035
2079
|
* @returns Session ID, agent ID, and message handle for tracking
|
|
2036
2080
|
*/
|
|
2037
2081
|
start(message: NormalizedMessageInput | MessageInput, options?: StartAgentOptions): Promise<AgentStartResult>;
|
|
2038
2082
|
/**
|
|
2039
|
-
* Initialize
|
|
2040
|
-
*
|
|
2083
|
+
* Initialize idle (no message). Returns confirmed adapter session ID or `undefined`
|
|
2084
|
+
* when the provider has not yet confirmed (idle fork sessions).
|
|
2041
2085
|
* @param options - Optional initialization options (system prompt, sessionContext)
|
|
2086
|
+
* @returns Confirmed adapter session ID, or `undefined` for unconfirmed fork sessions.
|
|
2042
2087
|
*/
|
|
2043
|
-
initialize(options?: StartAgentOptions): Promise<
|
|
2088
|
+
initialize(options?: StartAgentOptions): Promise<string | undefined>;
|
|
2044
2089
|
protected onBeforeEmitCompletion(): Promise<void>;
|
|
2045
|
-
protected onMessageHandle(messageHandle: MessageHandle): Promise<void>;
|
|
2090
|
+
protected onMessageHandle(messageHandle: MessageHandle, turnId?: string): Promise<void>;
|
|
2046
2091
|
/**
|
|
2047
2092
|
* Abort the agent immediately (panic mode).
|
|
2048
2093
|
* Triggers AbortController which may cause provider errors.
|
|
@@ -2262,6 +2307,7 @@ declare class AgentEventBridge {
|
|
|
2262
2307
|
/**
|
|
2263
2308
|
* Runtime dependencies for AgentTurnExecutor.
|
|
2264
2309
|
*/
|
|
2310
|
+
type AgentMessageHandleCallback = (messageHandle: MessageHandle, turnId: string | undefined) => Promise<void>;
|
|
2265
2311
|
interface AgentTurnExecutorConfig {
|
|
2266
2312
|
/** Stable agent identifier. */
|
|
2267
2313
|
agentId: string;
|
|
@@ -2277,8 +2323,26 @@ interface AgentTurnExecutorConfig {
|
|
|
2277
2323
|
getConnector: () => AIAgentConnector;
|
|
2278
2324
|
/** Native resume decision function. */
|
|
2279
2325
|
shouldUseNativeResume: ShouldUseNativeResumeFn;
|
|
2326
|
+
/**
|
|
2327
|
+
* Whether the agent config carries a concrete resume target
|
|
2328
|
+
* (`resumeAdapterSessionId`).
|
|
2329
|
+
*
|
|
2330
|
+
* Used by {@link AgentTurnExecutor.deriveStartMode} to distinguish
|
|
2331
|
+
* native-attach starts (resume target, no sessionContext) from
|
|
2332
|
+
* truly sessionless/ephemeral starts (no resume target, no context).
|
|
2333
|
+
*/
|
|
2334
|
+
hasResumeTarget: () => boolean;
|
|
2335
|
+
/**
|
|
2336
|
+
* Set the start mode on the owning agent before connector dispatch.
|
|
2337
|
+
*
|
|
2338
|
+
* The turn executor computes the mode from session context signals and
|
|
2339
|
+
* calls this so `emitStart()` can include it in the `agent.started`
|
|
2340
|
+
* payload when the connector fires its lifecycle event.
|
|
2341
|
+
* @param mode - Derived start mode for this turn
|
|
2342
|
+
*/
|
|
2343
|
+
setPendingStartMode: (mode: StartMode) => void;
|
|
2280
2344
|
/** Completion/lifecycle tracker hook. */
|
|
2281
|
-
onMessageHandle:
|
|
2345
|
+
onMessageHandle: AgentMessageHandleCallback;
|
|
2282
2346
|
/** Side-effect callback to mark agent status active before dispatch. */
|
|
2283
2347
|
onBeforeDispatch?: () => void | Promise<void>;
|
|
2284
2348
|
/** When true, PreUserMessage hooks are skipped. */
|
|
@@ -2299,10 +2363,51 @@ declare class AgentTurnExecutor {
|
|
|
2299
2363
|
private readonly globalBus;
|
|
2300
2364
|
private readonly getConnector;
|
|
2301
2365
|
private readonly shouldUseNativeResume;
|
|
2366
|
+
private readonly hasResumeTarget;
|
|
2367
|
+
private readonly setPendingStartMode;
|
|
2302
2368
|
private readonly onMessageHandle;
|
|
2303
2369
|
private readonly onBeforeDispatch?;
|
|
2304
2370
|
private readonly ephemeral;
|
|
2305
2371
|
constructor(config: AgentTurnExecutorConfig);
|
|
2372
|
+
/**
|
|
2373
|
+
* Derive the {@link StartMode} from session context, resume decision, and
|
|
2374
|
+
* resume-target presence.
|
|
2375
|
+
*
|
|
2376
|
+
* Decision table (evaluated top-to-bottom, first match wins):
|
|
2377
|
+
*
|
|
2378
|
+
* | sessionContext | nativeFork | hasResumeTarget | useNativeResume | isFirstTurn | Mode |
|
|
2379
|
+
* |----------------|------------|-----------------|-----------------|-------------|------------|
|
|
2380
|
+
* | present | yes | — | — | — | `fork` |
|
|
2381
|
+
* | absent | — | yes | — | — | `resume` |
|
|
2382
|
+
* | absent | — | no | — | — | `fresh` |
|
|
2383
|
+
* | present | no | — | true | — | `resume` |
|
|
2384
|
+
* | present | no | — | false | true | `fresh` |
|
|
2385
|
+
* | present | no | — | false | false | `rotation` |
|
|
2386
|
+
*
|
|
2387
|
+
* The `hasResumeTarget` rule distinguishes native-attach starts (concrete
|
|
2388
|
+
* provider session to reconnect to, but no orchestrator session context) from
|
|
2389
|
+
* truly sessionless/ephemeral starts. Without this signal, both cases
|
|
2390
|
+
* collapsed to `'fresh'` — causing SDK SessionStart hooks to run
|
|
2391
|
+
* initialization logic on a resumed conversation.
|
|
2392
|
+
*
|
|
2393
|
+
* `hasResumeTarget` fires only when sessionContext is absent. Once the
|
|
2394
|
+
* orchestrator supplies context (turn 2+), rules 4-6 take over and the
|
|
2395
|
+
* resume target on the config has no further effect on mode derivation.
|
|
2396
|
+
* @param sessionContext - Session context signals from the orchestrator
|
|
2397
|
+
* @param useNativeResume - Whether native resume was selected for this turn
|
|
2398
|
+
* @param hasResumeTarget - Whether a concrete resume target
|
|
2399
|
+
* (`resumeAdapterSessionId`) exists on the agent config
|
|
2400
|
+
* @returns The derived start mode
|
|
2401
|
+
*/
|
|
2402
|
+
static deriveStartMode(sessionContext: SessionContext | undefined, useNativeResume: boolean, hasResumeTarget?: boolean): StartMode;
|
|
2403
|
+
/**
|
|
2404
|
+
* Derive the start mode for the given resolved session context, stash it
|
|
2405
|
+
* as the pending mode for the next lifecycle start emission, and return
|
|
2406
|
+
* the native-resume decision shared by the dispatch that follows.
|
|
2407
|
+
* @param sessionContext - Session context after pre-user-message hooks
|
|
2408
|
+
* @returns Whether the connector should rely on native resume
|
|
2409
|
+
*/
|
|
2410
|
+
private deriveAndSetPendingStartMode;
|
|
2306
2411
|
/**
|
|
2307
2412
|
* Execute the turn pipeline for agent.sendMessage.
|
|
2308
2413
|
* @param payload - agent.sendMessage request payload
|
|
@@ -2349,6 +2454,43 @@ type AgentCreationOptions = Omit<Partial<Pick<StartAgentRequestPayload, 'model'
|
|
|
2349
2454
|
adapterSessionId?: string;
|
|
2350
2455
|
resumeAdapterSessionId?: string; /** Unresolved provider context (credential refs, not plaintext). */
|
|
2351
2456
|
providerContext?: ProviderContext;
|
|
2457
|
+
/**
|
|
2458
|
+
* Source Makaio session ID when mode is 'fork'.
|
|
2459
|
+
* Forwarded verbatim from the fork-mode startAgent request.
|
|
2460
|
+
*/
|
|
2461
|
+
sourceSessionId?: string;
|
|
2462
|
+
/**
|
|
2463
|
+
* Provider-native source session ID when mode is 'fork'.
|
|
2464
|
+
* Forwarded verbatim from the fork-mode startAgent request.
|
|
2465
|
+
*/
|
|
2466
|
+
sourceAdapterSessionId?: string;
|
|
2467
|
+
/**
|
|
2468
|
+
* Optional provider-native checkpoint message ID for the fork point.
|
|
2469
|
+
* Forwarded verbatim from the fork-mode startAgent request.
|
|
2470
|
+
*/
|
|
2471
|
+
forkPointMessageId?: string;
|
|
2472
|
+
/**
|
|
2473
|
+
* Optional working directory override for the forked session.
|
|
2474
|
+
* Forwarded verbatim from the fork-mode startAgent request.
|
|
2475
|
+
*/
|
|
2476
|
+
targetWorkingDirectory?: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* Orchestrator-assembled session context carrying fork directives,
|
|
2479
|
+
* native-locality decisions, and other session-scoped metadata.
|
|
2480
|
+
*
|
|
2481
|
+
* Present when the session orchestrator attaches context to a startAgent
|
|
2482
|
+
* request (e.g. fork-mode locality evaluation).
|
|
2483
|
+
*/
|
|
2484
|
+
sessionContext?: SessionContext;
|
|
2485
|
+
/**
|
|
2486
|
+
* Provider-native fork directive assembled from the startAgent fork-mode fields.
|
|
2487
|
+
*
|
|
2488
|
+
* Present when the adapter is started in fork mode and a native fork is feasible.
|
|
2489
|
+
* When `mode` is 'fork', `buildNativeForkDirective()` constructs this from the
|
|
2490
|
+
* individual fork fields above. When pre-built (e.g. from rehydration), it is
|
|
2491
|
+
* passed through directly.
|
|
2492
|
+
*/
|
|
2493
|
+
nativeFork?: NativeForkDirective;
|
|
2352
2494
|
};
|
|
2353
2495
|
/**
|
|
2354
2496
|
* Cumulative usage totals tracked per agent.
|
|
@@ -2605,8 +2747,6 @@ interface AgentPayloadEmitterConfig {
|
|
|
2605
2747
|
getLastKnownAdapterSessionId: () => string | undefined;
|
|
2606
2748
|
/** Persist latest adapterSessionId after resolution. */
|
|
2607
2749
|
setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void;
|
|
2608
|
-
/** Async fallback to wait for adapter session ID. */
|
|
2609
|
-
getAdapterSessionId: () => Promise<string>;
|
|
2610
2750
|
/** Live event metadata defaults resolved from current runtime state. */
|
|
2611
2751
|
getEventMetadataDefaults: () => AgentPayloadEventMetadata;
|
|
2612
2752
|
}
|
|
@@ -2620,6 +2760,33 @@ declare class AgentPayloadEmitter {
|
|
|
2620
2760
|
* @param config - Config controlling agent-context enrichment and global emissions
|
|
2621
2761
|
*/
|
|
2622
2762
|
constructor(config: AgentPayloadEmitterConfig);
|
|
2763
|
+
/**
|
|
2764
|
+
* Resolve the confirmed adapter session ID from synchronous sources.
|
|
2765
|
+
*
|
|
2766
|
+
* `getConnectorAdapterSessionId` delegates to `getConfirmedAdapterSessionId()`
|
|
2767
|
+
* which returns `undefined` for unconfirmed fork sessions — the provider has
|
|
2768
|
+
* not yet assigned the child session ID. For non-fork sessions (fresh, resume,
|
|
2769
|
+
* non-Claude adapters) the locally-determined ID is authoritative and returned
|
|
2770
|
+
* immediately.
|
|
2771
|
+
*
|
|
2772
|
+
* The `lastKnownAdapterSessionId` bridges connector swaps: when the old
|
|
2773
|
+
* connector is gone and the new one is not yet wired, the cached value carries
|
|
2774
|
+
* the confirmed ID from the previous connector.
|
|
2775
|
+
*
|
|
2776
|
+
* No async fallback is used. `connector.getAdapterSessionId()` may resolve
|
|
2777
|
+
* with a provisional placeholder for fork sessions. Enrichment must never
|
|
2778
|
+
* stamp unconfirmed IDs — omitting the field is safe since R8 schemas allow
|
|
2779
|
+
* it optional.
|
|
2780
|
+
* @returns Confirmed adapter session ID or `undefined`
|
|
2781
|
+
*/
|
|
2782
|
+
private resolveConfirmedAdapterSessionId;
|
|
2783
|
+
/**
|
|
2784
|
+
* Resolve event metadata fields, merging caller-provided values over live defaults.
|
|
2785
|
+
* @param payload - Payload fields that may carry metadata overrides
|
|
2786
|
+
* @param includeMetadata - Whether to include analytics metadata at all
|
|
2787
|
+
* @returns Resolved metadata fields
|
|
2788
|
+
*/
|
|
2789
|
+
private resolveEventMetadata;
|
|
2623
2790
|
/**
|
|
2624
2791
|
* Enrich payload with agent context fields.
|
|
2625
2792
|
* @param payload - Base payload to enrich
|
|
@@ -2627,7 +2794,7 @@ declare class AgentPayloadEmitter {
|
|
|
2627
2794
|
* @param options - Enrichment controls for optional analytics metadata defaults
|
|
2628
2795
|
* @returns Enriched payload with agent context
|
|
2629
2796
|
*/
|
|
2630
|
-
enrichPayload<T extends object>(payload: T, overrideMessageId?: string, options?: EmitGlobalOptions): Promise<T &
|
|
2797
|
+
enrichPayload<T extends object>(payload: T, overrideMessageId?: string, options?: EmitGlobalOptions): Promise<T & AgentIdentity & AgentPayloadEventFields>;
|
|
2631
2798
|
/**
|
|
2632
2799
|
* Emit enriched payload to global bus.
|
|
2633
2800
|
* @param subject - Subject definition to emit
|
|
@@ -2636,6 +2803,7 @@ declare class AgentPayloadEmitter {
|
|
|
2636
2803
|
*/
|
|
2637
2804
|
emitGlobal<S extends SubjectDefinition>(subject: S, payload: Omit<ExtractSubjectPayload<S>, keyof AgentContext> & {
|
|
2638
2805
|
messageId?: string;
|
|
2806
|
+
turnId?: string;
|
|
2639
2807
|
}, options?: EmitGlobalOptions): Promise<void>;
|
|
2640
2808
|
}
|
|
2641
2809
|
//#endregion
|
|
@@ -2962,18 +3130,16 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
|
|
|
2962
3130
|
*/
|
|
2963
3131
|
private handleSessionClosedByService;
|
|
2964
3132
|
/**
|
|
2965
|
-
*
|
|
2966
|
-
* @param ctx - Event context with
|
|
3133
|
+
* Reconcile registry adapterSessionId on first confirmed agent.started (idle fork starts).
|
|
3134
|
+
* @param ctx - Event context with started payload
|
|
2967
3135
|
*/
|
|
2968
|
-
private
|
|
3136
|
+
private handleStartedReconcileRegistry;
|
|
2969
3137
|
/**
|
|
2970
|
-
*
|
|
2971
|
-
*
|
|
2972
|
-
* Safe to call multiple times - subsequent calls are no-ops.
|
|
2973
|
-
*
|
|
2974
|
-
* Note: Agents are NOT eagerly rehydrated on startup. They are rehydrated
|
|
2975
|
-
* on-demand when messages arrive (lazy rehydration via handleRehydrateAgent).
|
|
3138
|
+
* Handle agent.usage — aggregate and emit session totals.
|
|
3139
|
+
* @param ctx - Event context with usage payload
|
|
2976
3140
|
*/
|
|
3141
|
+
private handleUsage;
|
|
3142
|
+
/** Initialize adapter (idempotent). Creates scoped bus, sets up handlers, emits adapter.initialized. */
|
|
2977
3143
|
init(): Promise<void>;
|
|
2978
3144
|
/** Hook for subclass initialization. Override to perform async setup (connections, auth, etc.). */
|
|
2979
3145
|
protected onInit(): Promise<void>;
|
|
@@ -3342,6 +3508,28 @@ interface ConformanceTestConfig<TBus extends ScopedBus<string> = ScopedBus<strin
|
|
|
3342
3508
|
* **Free-Tier Adapters**: `false` (no usage tracking)
|
|
3343
3509
|
*/
|
|
3344
3510
|
supportsUsageMetrics?: boolean;
|
|
3511
|
+
/**
|
|
3512
|
+
* Supports provider-native session resume.
|
|
3513
|
+
*
|
|
3514
|
+
* When enabled, the adapter can resume a prior provider session by its
|
|
3515
|
+
* `adapterSessionId` without injecting the full message history. The SDK
|
|
3516
|
+
* manages conversation state natively.
|
|
3517
|
+
*
|
|
3518
|
+
* **Claude Code**: `true` (resumes via Claude Agent SDK session IDs)
|
|
3519
|
+
* **Stateless Adapters**: `false` (always replay history)
|
|
3520
|
+
*/
|
|
3521
|
+
nativeResume?: boolean;
|
|
3522
|
+
/**
|
|
3523
|
+
* Supports provider-native session fork.
|
|
3524
|
+
*
|
|
3525
|
+
* When enabled, the adapter can branch from an existing provider session
|
|
3526
|
+
* at an optional message checkpoint, creating a diverging conversation
|
|
3527
|
+
* without replaying history into a fresh session.
|
|
3528
|
+
*
|
|
3529
|
+
* **Claude Code**: `true` (forks via Claude Agent SDK branching API)
|
|
3530
|
+
* **Stateless Adapters**: `false` (always replay history for fork)
|
|
3531
|
+
*/
|
|
3532
|
+
nativeFork?: boolean;
|
|
3345
3533
|
};
|
|
3346
3534
|
/**
|
|
3347
3535
|
* Test configuration and environment options.
|
|
@@ -4211,4 +4399,4 @@ declare const ToolCompletedEventSchema: z.ZodObject<{
|
|
|
4211
4399
|
type ToolStartedEvent = z.infer<typeof ToolStartedEventSchema>;
|
|
4212
4400
|
type ToolCompletedEvent = z.infer<typeof ToolCompletedEventSchema>;
|
|
4213
4401
|
//#endregion
|
|
4214
|
-
export { AIAdapter, type AIAdapterCapabilities, type AIAdapterCapability, type AIAdapterCapabilityRegistry, type AIAdapterConfig, type AIAdapterConstructorConfig, type AIAdapterContext, type AIAdapterDefinition, type AIAdapterInitOptions, type AIAdapterPromptFailureResult, type AIAdapterPromptOptions, type AIAdapterPromptResult, type AIAdapterPromptSuccessResult, AIAgent, type AIAgentConfig, AIAgentConnector, type AIModel, type AIReasoningLevel, type AdapterNamespace, type AdapterProviderDefinition, type AgentBusHandlerRegistrarConfig, type AgentCompleteEvent, AgentCompleteEventSchema, AgentConnectorLifecycleManager, type AgentConnectorLifecycleManagerConfig, type AgentContext, AgentEventBridge, type AgentEventBridgeConfig, type AgentIdentity, AgentLifecycleEmitter, type AgentLifecycleEmitterConfig, AgentPayloadEmitter, type AgentPayloadEmitterConfig, type AgentRuntimeCreationResult, AgentRuntimeMutationManager, type AgentRuntimeMutationManagerConfig, type AgentSendMessageOptions, type AgentStartResult, type AgentStartedEvent, AgentStartedEventSchema, AgentTurnExecutor, type AgentTurnExecutorConfig, type AgentUsageTotals, type BaseAgentConnectorConfig, BaseConnectorSession, BaseConnectorTurn, BaseLogImporter, type CompactionMetadata, type ConfigFactoryInput, type ConformanceEnvReader, type ConformanceTestConfig, type ConnectorSendMessageOptions, type ConnectorSessionConfig, type ConnectorStartOptions, type CreateConformanceTestConfigOptions, type CreateTestAgentOptions, type DiscoveryMetadata, type DiscriminatedHandler, type DiscriminatedHandlersConfig, type DiscriminatedHandlersMap, type ErrorEvent, ErrorEventSchema, type ExecutionContext, type ExternalToolIdentifier, type ExternalToolIdentifiers, type ExternalToolMeta, type FromGlobalToolApprovalFn, type GeneratedCapabilityProperties, type HarnessRequester, type IAdapterConfigFactory, type ISessionToolLedger, type ImportCursorPosition, ImportCursorPositionSchema, ImportCursorStorageNamespace, ImportCursorStorageSubjects, type ImportMetadata, type ImportSegment, type ImportSegmentLineage, type LedgerSessionContext, type LogImportConfig, type LogImportOrchestrator, type LogImportRegistration, type LogImportSessionContext, type LogImportTestConfig, type LogImporter, type LogImporterConfig, type LogImporterConstructor, type LogOrchestratorConfig, type LogOrchestratorConstructor, MAKAIO_CONFORMANCE_PRIMARY_MODEL_ENV, MAKAIO_CONFORMANCE_PROVIDER_DEFINITIONS_ENV, MAKAIO_CONFORMANCE_PROVIDER_ENV, MAKAIO_CONFORMANCE_SECONDARY_MODEL_ENV, type McpIntegrationStrategy, type McpSessionResources, type McpToolChange, type MergeResult, type MergeScopedToolApprovalOptions, type MessageDeliveryMode, MessageHandle, MessageLifecycleTracker, type MessageResult, type MessageState, type NormalizedCallUsage, type NormalizedEvent, type NormalizedMessageInput, type ParseFileResult, type PauseResult, type PlatformDefaults, ProceduralAgentConnector, type ProceduralConnectorSession, ProceduralConnectorTurn, type ProceduralTurnConfig, type ProceduralTurnState, type ProcessLogFileResult, type ProcessQueueCallbacks, type ProcessingState, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, type ScopedBusFor, type ScopedToolApprovalRequest, type ScopedToolApprovalResponse, ScopedToolApprovalSchema, type SendMessageOptions, type SendMessageRequest, type SendMessageResponse, type SerializedContextBlock, SessionLifecycle, SessionToolLedger, type ShouldUseNativeResumeFn, type StartAgentOptions, type StartAgentRequest, type StartAgentResponse, type StorageMessagePayload, type SyncDiscriminatedHandler, type SyncDiscriminatedHandlersConfig, type SyncDiscriminatedHandlersMap, type SyncTypedEmitFn, type TestModelRef, type ToGlobalToolApprovalFn, type ToolApprovalContext, ToolCallTracker, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolLedgerEntry, type ToolStartedEvent, ToolStartedEventSchema, type TurnEvent, type TurnState, type TurnSubjects, TurnTracker, type TurnTrackerOptions, type TurnTrackerSerializedState, TurnTrackerSerializedStateSchema, type TypedEmitFn, UserMessageQueue, type ValidCapability, type WireSessionConfig, type WireSessionSubjects, cleanEnvForAdapter, createAdapterNamespace, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, resolveConformanceTestPreset, resolveDisabledNativeTools, resolvePresetCredentials, resolveRequiredSessionId, resolveTestConfig, safeJsonStringify, serializeBlockToText, serializeTurnContext, toImportSegment };
|
|
4402
|
+
export { AIAdapter, type AIAdapterCapabilities, type AIAdapterCapability, type AIAdapterCapabilityRegistry, type AIAdapterConfig, type AIAdapterConstructorConfig, type AIAdapterContext, type AIAdapterDefinition, type AIAdapterInitOptions, type AIAdapterPromptFailureResult, type AIAdapterPromptOptions, type AIAdapterPromptResult, type AIAdapterPromptSuccessResult, AIAgent, type AIAgentConfig, AIAgentConnector, type AIModel, type AIReasoningLevel, type AdapterNamespace, type AdapterProviderDefinition, type AgentBusHandlerRegistrarConfig, type AgentCompleteEvent, AgentCompleteEventSchema, AgentConnectorLifecycleManager, type AgentConnectorLifecycleManagerConfig, type AgentContext, AgentEventBridge, type AgentEventBridgeConfig, type AgentIdentity, AgentLifecycleEmitter, type AgentLifecycleEmitterConfig, AgentPayloadEmitter, type AgentPayloadEmitterConfig, type AgentRuntimeCreationResult, AgentRuntimeMutationManager, type AgentRuntimeMutationManagerConfig, type AgentSendMessageOptions, type AgentStartResult, type AgentStartedEvent, AgentStartedEventSchema, AgentTurnExecutor, type AgentTurnExecutorConfig, type AgentUsageTotals, type BaseAgentConnectorConfig, BaseConnectorSession, BaseConnectorTurn, BaseLogImporter, type CompactionMetadata, type ConfigFactoryInput, type ConformanceEnvReader, type ConformanceTestConfig, type ConnectorSendMessageOptions, type ConnectorSessionConfig, type ConnectorStartOptions, type CreateConformanceTestConfigOptions, type CreateTestAgentOptions, type DiscoveryMetadata, type DiscriminatedHandler, type DiscriminatedHandlersConfig, type DiscriminatedHandlersMap, type ErrorEvent, ErrorEventSchema, type ExecutionContext, type ExternalToolIdentifier, type ExternalToolIdentifiers, type ExternalToolMeta, type FromGlobalToolApprovalFn, type GeneratedCapabilityProperties, type HarnessRequester, type IAdapterConfigFactory, type ISessionToolLedger, type ImportCursorPosition, ImportCursorPositionSchema, ImportCursorStorageNamespace, ImportCursorStorageSubjects, type ImportMetadata, type ImportSegment, type ImportSegmentLineage, type ImportSegmentTurn, type LedgerSessionContext, type LogImportConfig, type LogImportOrchestrator, type LogImportRegistration, type LogImportSessionContext, type LogImportTestConfig, type LogImporter, type LogImporterConfig, type LogImporterConstructor, type LogOrchestratorConfig, type LogOrchestratorConstructor, MAKAIO_CONFORMANCE_PRIMARY_MODEL_ENV, MAKAIO_CONFORMANCE_PROVIDER_DEFINITIONS_ENV, MAKAIO_CONFORMANCE_PROVIDER_ENV, MAKAIO_CONFORMANCE_SECONDARY_MODEL_ENV, type McpIntegrationStrategy, type McpSessionResources, type McpToolChange, type MergeResult, type MergeScopedToolApprovalOptions, type MessageDeliveryMode, MessageHandle, MessageLifecycleTracker, type MessageResult, type MessageState, type NormalizedCallUsage, type NormalizedEvent, type NormalizedMessageInput, type ParseFileResult, type PauseResult, type PlatformDefaults, ProceduralAgentConnector, type ProceduralConnectorSession, ProceduralConnectorTurn, type ProceduralTurnConfig, type ProceduralTurnState, type ProcessLogFileResult, type ProcessQueueCallbacks, type ProcessingState, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, type ScopedBusFor, type ScopedToolApprovalRequest, type ScopedToolApprovalResponse, ScopedToolApprovalSchema, type SendMessageOptions, type SendMessageRequest, type SendMessageResponse, type SerializedContextBlock, SessionLifecycle, SessionToolLedger, type ShouldUseNativeResumeFn, type StartAgentOptions, type StartAgentRequest, type StartAgentResponse, type StorageMessagePayload, type SyncDiscriminatedHandler, type SyncDiscriminatedHandlersConfig, type SyncDiscriminatedHandlersMap, type SyncTypedEmitFn, type TestModelRef, type ToGlobalToolApprovalFn, type ToolApprovalContext, ToolCallTracker, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolLedgerEntry, type ToolStartedEvent, ToolStartedEventSchema, type TurnEvent, type TurnState, type TurnSubjects, TurnTracker, type TurnTrackerOptions, type TurnTrackerSerializedState, TurnTrackerSerializedStateSchema, type TypedEmitFn, UserMessageQueue, type ValidCapability, type WireSessionConfig, type WireSessionSubjects, cleanEnvForAdapter, createAdapterNamespace, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, resolveConformanceTestPreset, resolveDisabledNativeTools, resolvePresetCredentials, resolveRequiredSessionId, resolveTestConfig, safeJsonStringify, serializeBlockToText, serializeTurnContext, toImportSegment };
|