@makaio/framework 1.0.0-dev-1783705652236 → 1.0.0-dev-1783940945655
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/account-identity-BYfeWLe-.mjs +1 -0
- package/dist/adapter-auth-runtime-a4O7cSNP.mjs +1 -0
- package/dist/adapter-binding-DDUyv1JK.d.mts +254 -0
- package/dist/{adapter-CA8rPIUz.mjs → adapter-nl_xz9dz.mjs} +1 -1
- package/dist/adapter-subsystem/index.d.mts +110 -5
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/acp-client/index.d.mts +10 -0
- package/dist/adapters/acp-client/index.mjs +2 -2
- package/dist/adapters/config/index.d.mts +176 -153
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +1021 -1005
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/adapters/stream-session/index.d.mts +7 -5
- package/dist/adapters/stream-session/index.mjs +1 -1
- package/dist/auth-C3NOWqTU.mjs +1 -0
- package/dist/{base-orchestrator-J1WKAUkF.d.mts → base-orchestrator-BiShpVKL.d.mts} +6 -0
- package/dist/bus/index.d.mts +21 -21
- package/dist/bus/index.mjs +1 -1
- package/dist/{canonical-model-DV-Z8gsb.mjs → canonical-model-CVRCW9h7.mjs} +1 -1
- package/dist/client-BkpLM8Fx.mjs +1 -0
- package/dist/client-binary-version-verifier-BK_vIjIo.mjs +2 -0
- package/dist/client-binary-version-verifier-BwrMTAh2.d.mts +179 -0
- package/dist/clients/index.d.mts +74 -90
- package/dist/clients/index.mjs +1 -2
- package/dist/clients/managed-install.d.mts +2 -0
- package/dist/clients/managed-install.mjs +1 -0
- package/dist/{clients-namespace-Bt_VTkEU.d.mts → clients-namespace-B96QIJOs.d.mts} +224 -21
- package/dist/compression-CZ_6fYq8.mjs +1 -0
- package/dist/config-namespace-DTA6EQL8.mjs +1 -0
- package/dist/{config-namespace-DqdFE6zk.d.mts → config-namespace-x0fuhEXe.d.mts} +73 -1
- package/dist/contracts/adapter/index.d.mts +3 -3
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +1 -1
- package/dist/contracts/auth/index.d.mts +3 -0
- package/dist/contracts/auth/index.mjs +1 -0
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/client/index.d.mts +3 -3
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +20 -93
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/facet/index.mjs +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/harness/index.mjs +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/host/index.mjs +1 -1
- package/dist/contracts/index.d.mts +1214 -261
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/provider/index.mjs +1 -1
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +2 -2
- package/dist/contracts/shared/index.mjs +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/timeout/index.mjs +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{definition-s9PIua2B.d.mts → definition-Bj9Vr16H.d.mts} +1 -1
- package/dist/{definition-Cllhr9mi.d.mts → definition-BsTlOz99.d.mts} +36 -4
- package/dist/{definition-CuJvtYeG.d.mts → definition-Cbl0k6Fc.d.mts} +31 -1
- package/dist/definition-K3m51lgO.mjs +1 -0
- package/dist/definitions-C1pgx0Nq.mjs +1 -0
- package/dist/{detached-extension-handle-Cx6-0eqg.mjs → detached-extension-handle-CTaQoolf.mjs} +1 -1
- package/dist/execution-target-Bg2wpfML.mjs +1 -0
- package/dist/{extension-CJClssfp.mjs → extension-CjTu6mzW.mjs} +1 -1
- package/dist/extension-D4iKUUMG.mjs +1 -0
- package/dist/{filesystem-service-Bmyqo6po.mjs → filesystem-service-maY_P3yA.mjs} +1 -1
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-D4SANVoq.mjs → globby-CisClzat.mjs} +1 -1
- package/dist/handlers-RGs3eC9X.mjs +57 -0
- package/dist/{harness-DkUpbsuY.mjs → harness-DflvHAGV.mjs} +1 -1
- package/dist/{index-C23g_M_J2.d.mts → index-5s_dN3cg2.d.mts} +18 -1
- package/dist/index-9dISOTLT.d.mts +174 -0
- package/dist/{index-B9d_8_V2.d.mts → index-9g0agW_p.d.mts} +55 -55
- package/dist/{index-DoEF9LAc.d.mts → index-BcejR1Jc.d.mts} +3 -3
- package/dist/index-BsEvzFey.d.mts +1175 -0
- package/dist/{index-ntS1EXlf.d.mts → index-BtL7ONuM.d.mts} +1 -1
- package/dist/index-BxuiHVFi.d.mts +284 -0
- package/dist/{index-PIlYSC73.d.mts → index-C9Q1E8Y-.d.mts} +66 -53
- package/dist/{index-CaerrEDH.d.mts → index-CB2XTzvd.d.mts} +3 -3
- package/dist/{index-Cx1Bm6WD.d.mts → index-CVs0Qxks.d.mts} +8 -8
- package/dist/{index-WHUV7neB.d.mts → index-CW6-0k3Z.d.mts} +105 -105
- package/dist/index-CagRgpXI2.d.mts +84 -0
- package/dist/{index-DZPNuWMc.d.mts → index-Cw3cjGAT.d.mts} +7 -7
- package/dist/{index-DnnKUwHm.d.mts → index-D5IEq4_E.d.mts} +36 -32
- package/dist/{index-h5go5Dtd.d.mts → index-D75FnT0B.d.mts} +1 -1
- package/dist/{index-O08Q2ikz.d.mts → index-DNc1yLQs.d.mts} +8 -8
- package/dist/{index-FFVwQMad.d.mts → index-DlUPWOh4.d.mts} +737 -97
- package/dist/{index-DScUb-hF.d.mts → index-Do7Wgio_2.d.mts} +35 -12
- package/dist/{index-C9FCWOhp.d.mts → index-DxatNFz7.d.mts} +124 -22
- package/dist/{index-BvTd61i5.d.mts → index-T96ydgVk.d.mts} +260 -160
- package/dist/{index-DLNRgZPo2.d.mts → index-j2YlW_Fc.d.mts} +1 -1
- package/dist/{index-BcvG3wPv.d.mts → index-p6dWV52m.d.mts} +513 -373
- package/dist/{index-B2DjrVb8.d.mts → index-sCOlgPyj.d.mts} +1589 -482
- package/dist/kernel/cli/index.d.mts +2 -2
- package/dist/kernel/cli/index.mjs +1 -1
- package/dist/kernel/cli/register.d.mts +1 -1
- package/dist/kernel/cli/register.mjs +1 -1
- package/dist/kernel/cli/schemas.mjs +1 -1
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +5 -5
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +1 -1
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/{lib-BOmKyjWD.mjs → lib-DIVnpS8e.mjs} +1 -1
- package/dist/{lib-DLZYp5z3.mjs → lib-DymjnkAP.mjs} +1 -1
- package/dist/{load-extensions-Cze1RHcG.mjs → load-extensions-BtUrq2_t.mjs} +1 -1
- package/dist/{load-extensions-DNRIy4zC.d.mts → load-extensions-_EnedkUp.d.mts} +1 -1
- package/dist/{loop-gate-handlers-o2B5FPdF.mjs → loop-gate-handlers-0a3dIY8O.mjs} +1 -1
- package/dist/mcp-http-server/index.mjs +1 -1
- package/dist/model-uE5IyUFJ.mjs +1 -0
- package/dist/namespace-C05pkLbN.mjs +1 -0
- package/dist/{namespace-D8P8Sxce2.d.mts → namespace-CGgOLxiW2.d.mts} +2 -2
- package/dist/{namespace-BGIeqwfU.d.mts → namespace-CQBSXm1U.d.mts} +20 -20
- package/dist/{namespace-CfvtDD_U.d.mts → namespace-CfgtqUWS.d.mts} +156 -156
- package/dist/{namespace-D9PLFmPQ.d.mts → namespace-CpyL93kW.d.mts} +27 -27
- package/dist/{namespace-CZK2ff3B.d.mts → namespace-D3SQQgxa2.d.mts} +1 -1
- package/dist/namespace-D7pE2QWv.mjs +1 -0
- package/dist/{namespace-dFBD2ZmS.mjs → namespace-DwQtzlY-.mjs} +1 -1
- package/dist/namespace-HsI0Jbbr.mjs +1 -0
- package/dist/namespace-VmsT_tLJ.d.mts +3729 -0
- package/dist/namespace-Xp9-g_r-.mjs +1 -0
- package/dist/{native-session-supervisor-7ElwM6Is.mjs → native-session-supervisor-CdtVGWA9.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/node/transports/index.d.mts +36 -1
- package/dist/node/transports/index.mjs +2 -2
- package/dist/{orchestrator-shared-ChygCvR1.mjs → orchestrator-shared-DAkGOu9H.mjs} +1 -1
- package/dist/{orchestrator-shared-DFLb1otg.d.mts → orchestrator-shared-pxtyNu3W.d.mts} +13 -6
- package/dist/{package-Co_GO3UD.mjs → package-0gVhAVkO.mjs} +1 -1
- package/dist/package-BwvGaKwn.mjs +1 -0
- package/dist/package.json +1 -1
- package/dist/{profile-BMBXUqqh.mjs → profile-D2m94ZYD.mjs} +1 -1
- package/dist/provider-context-BYkMl--1.mjs +1 -0
- package/dist/provider-context-DOsjOjiR.mjs +1 -0
- package/dist/{providers-namespace-5GoTlHXz.d.mts → providers-namespace-O4de1tgO.d.mts} +161 -14
- package/dist/resolved-O2XXjTeu.mjs +1 -0
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/client-binary-strategy-dependencies.d.mts +34 -0
- package/dist/runtime-node/client-binary-strategy-dependencies.mjs +1 -0
- package/dist/runtime-node/extension-discovery.d.mts +1 -1
- package/dist/runtime-node/extension-validation.d.mts +1 -1
- package/dist/runtime-node/extension-validation.mjs +1 -1
- package/dist/runtime-node/index.d.mts +32 -6
- package/dist/runtime-node/index.mjs +24 -24
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-7aKBGB7S.mjs → schema-BI0aCHvV.mjs} +1 -1
- package/dist/{schema-B5vHi7Uu.d.mts → schema-BnTOFCdU.d.mts} +1 -1
- package/dist/{schemas-Br-rSxPE2.d.mts → schemas--uwN5dfK2.d.mts} +11 -11
- package/dist/schemas-C-J4W1ID.mjs +1 -0
- package/dist/{schemas-CoFCV42v.d.mts → schemas-C17AifUQ.d.mts} +156 -156
- package/dist/schemas-D6lj9NMg.mjs +1 -0
- package/dist/schemas-K3Td_WdR.d.mts +3175 -0
- package/dist/schemas-n9Ff6_RX.mjs +1 -0
- package/dist/selection-YRuVSdck.mjs +1 -0
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- 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 +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +4 -3
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/adapter-subsystem/namespace.mjs +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/capability/index.d.mts +1 -1
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +1 -1
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/definition/namespace.d.mts +1 -19
- package/dist/services/definition/schemas.d.mts +0 -9
- package/dist/services/definition/schemas.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +4 -4
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/namespace.mjs +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/execution-target/schemas.mjs +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.d.mts +6 -6
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +1671 -253
- 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 +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.mjs +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.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/provider-context/index.d.mts +2 -2
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.d.mts +18 -0
- package/dist/services/provider-runtime/index.mjs +1 -1
- 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 +10 -10
- 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/testing/index.d.mts +2 -2
- package/dist/services/session/testing/index.mjs +10 -10
- 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/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +18 -25
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +2 -2
- package/dist/services/subagent/index.mjs +1 -1
- 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.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- 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/session-CAjudDuJ.mjs +76 -0
- package/dist/{session-DBfQkgdy.mjs → session-lRd8HZNZ.mjs} +1 -1
- package/dist/{session-lineage-C1M7-O3C.d.mts → session-lineage-BLw8iWAj.d.mts} +1 -1
- package/dist/{shared-BVW-3Dhy.mjs → shared-RP_KARKF.mjs} +1 -1
- package/dist/{skill-N-ttlp1i.mjs → skill-CpNjWFuE.mjs} +1 -1
- package/dist/{src-Ck2sbaDa.mjs → src-Bo2eA51B.mjs} +1 -1
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/client.mjs +1 -1
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/{tool-approval-service-DEiMKTv9.mjs → tool-approval-service-Dh0XI21f.mjs} +1 -1
- package/dist/tools-C8vqn1KY.mjs +1 -0
- package/dist/{transition-OzGXyy3p.d.mts → transition-Bfe8VVc1.d.mts} +2 -2
- package/dist/{types-BWduCvRU.d.mts → types-B-xY9WW2.d.mts} +1 -1
- package/dist/{types-BrUOVfwe.d.mts → types-DvKaEOOn.d.mts} +252 -19
- package/dist/{types-CBLPaQXe.d.mts → types-q95p55BF.d.mts} +437 -287
- package/dist/ui-hooks/index.d.mts +103 -14
- package/dist/ui-hooks/index.mjs +1 -1
- package/dist/ui-kernel/index.d.mts +3 -3
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/utils/keychain.mjs +1 -1
- package/dist/{version-DoV_pSzT.mjs → version-C1-VD-XL.mjs} +1 -1
- package/dist/workflow-CvVAZ89A.mjs +1 -0
- package/dist/workflow-engine/index.d.mts +33 -33
- 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/dist/{workflow-worker-dH70EbjE.mjs → workflow-worker-CudfEstp.mjs} +1 -1
- package/package.json +5 -1
- package/dist/account-identity-C7Kx_ieU.mjs +0 -1
- package/dist/cleanEnvForAdapter-BooAgM2R.mjs +0 -1
- package/dist/client-DaR4mzqn.mjs +0 -1
- package/dist/compression-C5JAWdgZ.mjs +0 -1
- package/dist/config-namespace-CY9leBnE.mjs +0 -1
- package/dist/credential-ref-YWQQENEo.mjs +0 -1
- package/dist/definition-C-GVz7uw.mjs +0 -1
- package/dist/execution-target-BR8bLkCR.mjs +0 -1
- package/dist/extension-BS_4BOeO.mjs +0 -1
- package/dist/handlers-B74FvKlA.mjs +0 -57
- package/dist/index-BcwOnvUh.d.mts +0 -749
- package/dist/index-D6aAzr32.d.mts +0 -997
- package/dist/index-DtwGhFFQ.d.mts +0 -40
- package/dist/namespace-B4cV_pk3.d.mts +0 -1317
- package/dist/namespace-BO3tODGC.mjs +0 -1
- package/dist/namespace-CVMZVqB5.mjs +0 -1
- package/dist/namespace-DBHwyhME.mjs +0 -1
- package/dist/namespace-DibbhCPP.mjs +0 -1
- package/dist/package-CF_Zm2v4.mjs +0 -1
- package/dist/provider-context-CqMgPOWF.mjs +0 -1
- package/dist/provider-context-DC_eq7es.mjs +0 -1
- package/dist/schemas-CVo8qAK-.mjs +0 -1
- package/dist/schemas-CuG17U3L.mjs +0 -1
- package/dist/session-CX6QDhi2.mjs +0 -76
- package/dist/tools-CGFZkB7F.mjs +0 -1
- package/dist/workflow-C3dgVwTY.mjs +0 -1
- /package/dist/{ajv-B5dPIck0.mjs → ajv-DfHhgdS5.mjs} +0 -0
- /package/dist/{await-trigger-DwVldnMt.mjs → await-trigger-D623tvig.mjs} +0 -0
- /package/dist/{capability-service-XlymTzz1.mjs → capability-service-Dg2bU8qc.mjs} +0 -0
- /package/dist/{client-CebV_fZc.d.mts → client-DmJwprw1.d.mts} +0 -0
- /package/dist/{create-static-mount-DkK28kKW.mjs → create-static-mount-CBTXRtbN.mjs} +0 -0
- /package/dist/{cross-spawn-CDXy3BjE.mjs → cross-spawn-D9WWFl2a.mjs} +0 -0
- /package/dist/{cursor-storage-luQAg7E_.mjs → cursor-storage-Bw-7ROzx.mjs} +0 -0
- /package/dist/{descriptor-to-package-DdpjpT7n.mjs → descriptor-to-package-D5SWf6TL.mjs} +0 -0
- /package/dist/{drizzle-DVTAl7Us.mjs → drizzle-DYfaDzlO.mjs} +0 -0
- /package/dist/{esm-CQG9Pc7n.mjs → esm-oHhRYTEn.mjs} +0 -0
- /package/dist/{event-DguYjV6D.mjs → event-DTM0-qWP.mjs} +0 -0
- /package/dist/{extension-discovery-CIZn5bkq.d.mts → extension-discovery-APMf1Tes.d.mts} +0 -0
- /package/dist/{extension-namespace-v3K0qVry.mjs → extension-namespace-vrh4ERXR.mjs} +0 -0
- /package/dist/{facet-BM4y4aQP.mjs → facet-DqPBpqkl.mjs} +0 -0
- /package/dist/{filesystem-service-Cwp0sWNc.d.mts → filesystem-service-Bx0bR2Lb.d.mts} +0 -0
- /package/dist/{handler-BFNvtv5t.mjs → handler-4pKQi3eo.mjs} +0 -0
- /package/dist/{host-vY07gek-.mjs → host-BfgdjlII.mjs} +0 -0
- /package/dist/{identity-DC3Pk0ps.mjs → identity-2qUT1NME.mjs} +0 -0
- /package/dist/{index-COI1tjAf.d.mts → index-BZ_DSGnE.d.mts} +0 -0
- /package/dist/{index-D7rWAEY0.d.mts → index-Bd52mmj9.d.mts} +0 -0
- /package/dist/{index-Dfi8Rorw.d.mts → index-BkAKfh4d.d.mts} +0 -0
- /package/dist/{index-CuHqL95P.d.mts → index-Bv9lm0Kf.d.mts} +0 -0
- /package/dist/{index-C4nStEdA.d.mts → index-C18Pn3zP.d.mts} +0 -0
- /package/dist/{index-Cr9lh21j.d.mts → index-CarbJsC92.d.mts} +0 -0
- /package/dist/{index-BjoOSg95.d.mts → index-Ctw617Tj.d.mts} +0 -0
- /package/dist/{index-DUD7wikz2.d.mts → index-D0eUQjTU2.d.mts} +0 -0
- /package/dist/{index-DEzdNQum.d.mts → index-DfVSWBBp.d.mts} +0 -0
- /package/dist/{index-D3ahzHwb.d.mts → index-DnWZdG6C.d.mts} +0 -0
- /package/dist/{index-CpKikwK4.d.mts → index-DoLdETfR.d.mts} +0 -0
- /package/dist/{index-B92mToDo2.d.mts → index-DvaPrL6C.d.mts} +0 -0
- /package/dist/{index-D7Hkmrr3.d.mts → index-DwDBa2mb.d.mts} +0 -0
- /package/dist/{index-Y8rMeYYX.d.mts → index-FDyqQIt5.d.mts} +0 -0
- /package/dist/{index-BWIkf5oJ.d.mts → index-Lp0T_V1W.d.mts} +0 -0
- /package/dist/{index-OGIC4puQ.d.mts → index-Rhcr4YNA.d.mts} +0 -0
- /package/dist/{index-BvLXySoB2.d.mts → index-S-mAqWwq.d.mts} +0 -0
- /package/dist/{index-DOOrKin9.d.mts → index-_zsihEmk.d.mts} +0 -0
- /package/dist/{index-wq7XeqyG.d.mts → index-iJP-l15K.d.mts} +0 -0
- /package/dist/{json-value-DtIkQN7g.d.mts → json-value-C8duSh9X.d.mts} +0 -0
- /package/dist/{jsonl-transport-CGPgD8iU.mjs → jsonl-transport-l5NPcQ_2.mjs} +0 -0
- /package/dist/{lib-ZKtnbCqH.mjs → lib-ClRTNIuz.mjs} +0 -0
- /package/dist/{materialization-CUYxZCfk.mjs → materialization-BwTORtBr.mjs} +0 -0
- /package/dist/{model-registry-C2VXobZj.mjs → model-registry-BneK5SGo.mjs} +0 -0
- /package/dist/{model-registry-rYICIwyR.mjs → model-registry-C8MInDtX.mjs} +0 -0
- /package/dist/{namespace-65uwTpbg.d.mts → namespace-3YVLQ_bM.d.mts} +0 -0
- /package/dist/{namespace-CQ8uza7o.d.mts → namespace-BcDHt-ww.d.mts} +0 -0
- /package/dist/{namespace-BigVYQyx.d.mts → namespace-BhVlHfoO.d.mts} +0 -0
- /package/dist/{namespace-j7vFsmYL.d.mts → namespace-Bl1UhLnK.d.mts} +0 -0
- /package/dist/{namespace-Dk4OslmY.d.mts → namespace-BsEoWXV_.d.mts} +0 -0
- /package/dist/{namespace-DYSFDC2G.mjs → namespace-C238RqwB.mjs} +0 -0
- /package/dist/{namespace-BdO4e1Fm.mjs → namespace-CDO4rY11.mjs} +0 -0
- /package/dist/{namespace-wke7juzy.mjs → namespace-DDx4NVJm.mjs} +0 -0
- /package/dist/{namespace-D1_9WVCo.d.mts → namespace-Dar3O6iT.d.mts} +0 -0
- /package/dist/{namespace-DAj_riOn.d.mts → namespace-DoNigVgx.d.mts} +0 -0
- /package/dist/{namespace-D2s-4pyg.d.mts → namespace-Dvi66QS6.d.mts} +0 -0
- /package/dist/{out-BoEZjBNz.mjs → out-BB6Kb4Xu.mjs} +0 -0
- /package/dist/{package-DmVZxufT.d.mts → package-CdBiknf3.d.mts} +0 -0
- /package/dist/{platform-DnbSvm2u.mjs → platform-CWhGFQFX.mjs} +0 -0
- /package/dist/{providers-Bd7BOZs0.mjs → providers-CUnrif24.mjs} +0 -0
- /package/dist/{quick-lru-6e7I1Bgf.mjs → quick-lru-BLaSzINB.mjs} +0 -0
- /package/dist/{registry-U_3aYSin.mjs → registry-TJjQgTgp.mjs} +0 -0
- /package/dist/{schema-CHp6I33k.mjs → schema-cus0dJ81.mjs} +0 -0
- /package/dist/{schema-introspection-B7xODt4I.mjs → schema-introspection-BsWLmoFp.mjs} +0 -0
- /package/dist/{schemas-KlH1hB7u.d.mts → schemas-9QJf1FtS.d.mts} +0 -0
- /package/dist/{schemas-CJ2JvA7d.d.mts → schemas-BolSW7pQ.d.mts} +0 -0
- /package/dist/{schemas-D4zaFE2p.d.mts → schemas-CLsbsX1W.d.mts} +0 -0
- /package/dist/{schemas-XeIBqwvE.mjs → schemas-CMyv7l7-.mjs} +0 -0
- /package/dist/{schemas-CPI00yvh.mjs → schemas-CWxf_Yut.mjs} +0 -0
- /package/dist/{schemas-BemsLc_V.d.mts → schemas-D_9X_CRo.d.mts} +0 -0
- /package/dist/{schemas-DZGnr9Tl.mjs → schemas-DwfTUQIa.mjs} +0 -0
- /package/dist/{schemas-B6tEKf9T.d.mts → schemas-XRhqOgVE.d.mts} +0 -0
- /package/dist/{schemas-DKncXGnb.d.mts → schemas-fRLDhefF.d.mts} +0 -0
- /package/dist/{schemas-DWfo0wp4.d.mts → schemas-jDRSOXJL.d.mts} +0 -0
- /package/dist/{schemas-lnE9YoG7.d.mts → schemas-qpo1Goit.d.mts} +0 -0
- /package/dist/{schemas-t6h9oSct.d.mts → schemas-qt5QTjVc.d.mts} +0 -0
- /package/dist/{semver-CIhHqMkw.mjs → semver-BccS1s9R.mjs} +0 -0
- /package/dist/{server-lifecycle-C5Z5PSMD.mjs → server-lifecycle-D-jxVr_0.mjs} +0 -0
- /package/dist/{server-lifecycle-_AA6EfzL.d.mts → server-lifecycle-r5Tkk8bU.d.mts} +0 -0
- /package/dist/{shared-schemas-BEVG96xW.mjs → shared-schemas-BNCPgGYP.mjs} +0 -0
- /package/dist/{src-_VODAJnf.mjs → src-Ci_WY9uw.mjs} +0 -0
- /package/dist/{storage-namespace-D5q9CrBp.mjs → storage-namespace-BzE2M4Hq.mjs} +0 -0
- /package/dist/{storage-namespace-Di1A3DMm.d.mts → storage-namespace-DWKFqEW-.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-CzXPW45M.mjs → storage-namespace-definition-4UYuij1r.mjs} +0 -0
- /package/dist/{storage-namespace-definition-BffdI5Bz.d.mts → storage-namespace-definition-BZJGSaX3.d.mts} +0 -0
- /package/dist/{supports-color-DcXkvGDF.mjs → supports-color-Dzp6WuF5.mjs} +0 -0
- /package/dist/{telemetry-Cvi4rxiE.mjs → telemetry-B42EMbZt.mjs} +0 -0
- /package/dist/{timeout-XsYIOKrc.mjs → timeout-CvONPl0l.mjs} +0 -0
- /package/dist/{tray-menu-service-B2AxiQqL.mjs → tray-menu-service-Bonl2KXf.mjs} +0 -0
- /package/dist/{types-Bo78h9e3.d.mts → types-BCW9kr4L.d.mts} +0 -0
- /package/dist/{types-DCvp_swt.d.mts → types-CrJ7KEZ0.d.mts} +0 -0
- /package/dist/{types-BNW5n6qm.d.mts → types-DWNoZ3Sd.d.mts} +0 -0
- /package/dist/{ui-config-9bDRwFZr.mjs → ui-config-B2L3Xgqo.mjs} +0 -0
- /package/dist/{variant-5huHjUTm.mjs → variant-ByI-RZua.mjs} +0 -0
- /package/dist/{window-registry-PkrFIwX2.mjs → window-registry-DsWnCc8z.mjs} +0 -0
- /package/dist/{window-registry-ofIUQnfo.d.mts → window-registry-WsWu-rcK.d.mts} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
1
|
+
import { $ as NormalizedMessageInput, C as NormalizedCallUsage, D as AdapterAuthLeaseHandle, E as StartAgentOptions, J as IAdapterConfigFactory, K as AdapterProviderDefinition, O as AdapterAuthRuntimePreparer, Q as markCompletedWithFinalResult, S as GetCapabilitiesResponsePayload, T as SendMessageResponsePayload, X as MessageDeliveryMode, Y as AIAgentConnector, Z as MessageHandle, _ as BaseAgentConnectorConfig, a as AgentCredentialChangeResponsePayload, at as AIModel, b as ContextWindowInput, c as AgentIdentity, ct as ISessionToolLedger, d as AgentMcpServersSetRequestPayload, dt as ToolLedgerEntry, et as normalizeMessageInput, f as AgentMcpServersSetResponsePayload, g as AgentStartResult, h as AgentSendMessageOptions, i as AgentCredentialChangeRequestPayload, it as SendMessageOptions, j as ResolvedAdapterRuntimeConfig, k as BoundAdapterRuntimeConfig, l as AgentInterruptRequestPayload, lt as LedgerSessionContext, m as AgentModelChangeResponsePayload, n as AgentConnectorConfigOverrides, nt as MessageState, o as AgentCwdChangeRequestPayload, ot as AIReasoningLevel, p as AgentModelChangeRequestPayload, q as ConfigFactoryInput, r as AgentContext, rt as ProcessingState, s as AgentCwdChangeResponsePayload, st as ReasoningLevelMap, t as AIAgentConfig, tt as MessageResult, u as AgentInterruptResponsePayload, ut as SessionToolLedger, v as ConnectorSendMessageOptions, w as SendMessageRequestPayload, x as ExecutionContext, y as ConnectorStartOptions } from "../types-DvKaEOOn.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-BiShpVKL.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,
|
|
7
|
+
import { AIReasoningLevel as AIReasoningLevel$1, AdapterClientRef, AdapterDefinitionContract, AdapterProviderAuth, AdapterProviderRef, AdapterSubjects, AgentSchemas, AgentStarted, AgentSubjects, AgentToolApproveRequest, AgentToolApproveResponse, BlockData, HarnessDefinition, HarnessSubjects, JsonValue, McpResolvedServer, McpRuntimeSessionContext, McpSessionContext, McpToolState, Message, MessageInput, NativeForkDirective, ProtocolId, ProviderContext, ProviderDefinitionInput, ReasoningLevelMap as ReasoningLevelMap$1, RequestCorrelationContext, 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";
|
|
@@ -80,56 +80,6 @@ interface LogImportRegistration {
|
|
|
80
80
|
clientId?: string;
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
|
-
//#region adapters/core/src/types/provider-definition.d.ts
|
|
84
|
-
/**
|
|
85
|
-
* Runtime adapter provider definition pairing a serializable provider definition
|
|
86
|
-
* with optional runtime-only schemas.
|
|
87
|
-
*
|
|
88
|
-
* Extends {@link AdapterProviderDefinitionContract} from `@makaio/contracts` which
|
|
89
|
-
* is the single source of truth for the `definition`, `configSchema`, and
|
|
90
|
-
* `credentialSchema` fields. All fields are inherited from the contract — this
|
|
91
|
-
* type exists to give the shape a domain-specific name used throughout
|
|
92
|
-
* adapter implementation packages and to allow future additions specific to
|
|
93
|
-
* `ai-adapters-core`.
|
|
94
|
-
*
|
|
95
|
-
* Each adapter exports an array of these from its `definition.ts` (via `providers`).
|
|
96
|
-
* The `definition` field contains serializable data (models, endpoints, etc.).
|
|
97
|
-
* The schema fields are runtime-only — used for UI form generation, never serialized.
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* const anthropicProvider: AdapterProviderDefinition = {
|
|
101
|
-
* definition: {
|
|
102
|
-
* id: 'anthropic',
|
|
103
|
-
* name: 'Anthropic',
|
|
104
|
-
* endpoints: { anthropic: 'https://api.anthropic.com' },
|
|
105
|
-
* defaultModel: 'sonnet',
|
|
106
|
-
* availableModels: [...]
|
|
107
|
-
* },
|
|
108
|
-
* credentialSchema: z.object({
|
|
109
|
-
* apiKey: z.string().describe('Anthropic API Key')
|
|
110
|
-
* })
|
|
111
|
-
* };
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
interface AdapterProviderDefinition extends AdapterProviderDefinitionContract {
|
|
115
|
-
/**
|
|
116
|
-
* Provider-specific config schema for UI form generation (runtime-only).
|
|
117
|
-
*
|
|
118
|
-
* Defines provider-specific configuration fields like debugging flags,
|
|
119
|
-
* rate limiting options, or provider-specific features.
|
|
120
|
-
* Not serialized — used for dynamic form generation in the settings UI.
|
|
121
|
-
*/
|
|
122
|
-
readonly configSchema?: z.ZodObject<z.ZodRawShape>;
|
|
123
|
-
/**
|
|
124
|
-
* Provider-specific credential schema for secure credential capture (runtime-only).
|
|
125
|
-
*
|
|
126
|
-
* Defines credential fields (apiKey, apiSecret, etc.) for secure input.
|
|
127
|
-
* Credentials are stored separately via the credential service, never in plain config.
|
|
128
|
-
* Not serialized — used for dynamic form generation in the settings UI.
|
|
129
|
-
*/
|
|
130
|
-
readonly credentialSchema?: z.ZodObject<z.ZodRawShape>;
|
|
131
|
-
}
|
|
132
|
-
//#endregion
|
|
133
83
|
//#region adapters/core/src/types/ai-adapter-init-options.d.ts
|
|
134
84
|
/**
|
|
135
85
|
* Platform-provided defaults injected by the runtime.
|
|
@@ -147,7 +97,7 @@ interface PlatformDefaults {
|
|
|
147
97
|
* ```typescript
|
|
148
98
|
* await adapter.init({
|
|
149
99
|
* defaultModel: "claude-3.5-sonnet",
|
|
150
|
-
* providerOptions: {
|
|
100
|
+
* providerOptions: { baseUrl: "https://api.example.com" }
|
|
151
101
|
* });
|
|
152
102
|
* ```
|
|
153
103
|
* @see {@link AIAdapterPromptOptions} for per-message config
|
|
@@ -156,7 +106,7 @@ interface PlatformDefaults {
|
|
|
156
106
|
interface AIAdapterInitOptions {
|
|
157
107
|
/** Default model when not specified per-message. Provider-specific identifier. */
|
|
158
108
|
defaultModel?: string;
|
|
159
|
-
/** Provider-specific config (
|
|
109
|
+
/** Provider-specific non-secret config (base URLs, defaults, etc.). Type explicitly in adapter implementations. */
|
|
160
110
|
providerOptions?: unknown;
|
|
161
111
|
adapterId?: string;
|
|
162
112
|
/**
|
|
@@ -177,6 +127,8 @@ interface AIAdapterInitOptions {
|
|
|
177
127
|
definitionProviders?: AdapterProviderDefinition[];
|
|
178
128
|
/** Client identifier for the application this adapter belongs to (e.g., 'claude-code', 'codex'). Omit for API-only adapters. */
|
|
179
129
|
clientId?: string;
|
|
130
|
+
/** Trusted non-serializable normalized auth preparer injected by the host. */
|
|
131
|
+
prepareAuthRuntime?: AdapterAuthRuntimePreparer;
|
|
180
132
|
}
|
|
181
133
|
//#endregion
|
|
182
134
|
//#region adapters/core/src/utils/safeJsonStringify.d.ts
|
|
@@ -564,47 +516,43 @@ type InjectedTestFields<TBus extends ScopedBus<string>> = {
|
|
|
564
516
|
adapterName: string;
|
|
565
517
|
bus: TBus;
|
|
566
518
|
/**
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
* When a `testProviderDefinition` is supplied, credential refs are built
|
|
570
|
-
* from the definition's `credentialEnvVars` mapping using `env:VAR_NAME`
|
|
571
|
-
* format. Connectors resolve these refs locally via `resolveConnectorCredentials()`
|
|
572
|
-
* — which reads from `process.env` for `env:` refs — mirroring the full
|
|
573
|
-
* credential-resolution chain without requiring a database or bus handlers.
|
|
519
|
+
* Refs-only normalized provider context for conformance tests.
|
|
574
520
|
*
|
|
575
|
-
*
|
|
576
|
-
* is provided.
|
|
521
|
+
* A missing definition or auth method remains the closed unresolved state.
|
|
577
522
|
*/
|
|
578
|
-
providerContext: ProviderContext;
|
|
523
|
+
providerContext: ProviderContext; /** Exact selected adapter/provider protocol for endpoint resolution. */
|
|
524
|
+
providerProtocol?: ProtocolId; /** Exact selected adapter/provider auth declaration. */
|
|
525
|
+
adapterProviderAuth?: AdapterProviderAuth; /** Other compatible auth declarations contributing to environment scrubbing. */
|
|
526
|
+
compatibleProviderAuths: AdapterProviderAuth[];
|
|
579
527
|
};
|
|
580
528
|
/** Result type: options merged with injected fields (handles undefined options) */
|
|
581
|
-
type
|
|
529
|
+
type TestConfigOptionsInput = Omit<CreateTestAgentOptions, 'providerContext'> & {
|
|
530
|
+
providerContext?: unknown;
|
|
531
|
+
};
|
|
532
|
+
type ResolvedTestConfig<TBus extends ScopedBus<string>> = Omit<TestConfigOptionsInput, 'providerContext'> & InjectedTestFields<TBus>;
|
|
582
533
|
/**
|
|
583
|
-
* Build
|
|
534
|
+
* Build a normalized provider context for conformance tests.
|
|
584
535
|
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
536
|
+
* Explicit fields use their first declared environment source hint. Definitions
|
|
537
|
+
* without a selectable provider-owned method remain unresolved; tests for
|
|
538
|
+
* client-owned auth provide a context explicitly.
|
|
588
539
|
* @param definition - Optional provider definition to build credential refs from
|
|
589
|
-
* @
|
|
590
|
-
* env vars should be stripped from ambient subprocess environments
|
|
591
|
-
* @returns Fresh unresolved provider context per call to prevent cross-test mutation leaks
|
|
540
|
+
* @returns Fresh refs-only provider context per call.
|
|
592
541
|
*/
|
|
593
|
-
declare function createTestProviderContext(definition?: ProviderDefinitionInput
|
|
542
|
+
declare function createTestProviderContext(definition?: ProviderDefinitionInput): ProviderContext;
|
|
594
543
|
/**
|
|
595
544
|
* Resolves test configuration by adding required fields (bus, agentId, adapterId, adapterName, providerContext).
|
|
596
545
|
*
|
|
597
|
-
* When `testProviderDefinition` is supplied,
|
|
598
|
-
* are built from the definition's
|
|
546
|
+
* When `testProviderDefinition` is supplied, normalized auth refs and endpoint overrides
|
|
547
|
+
* are built from the definition's auth methods and endpoints — so
|
|
599
548
|
* conformance tests can run against real providers without the full orchestrator.
|
|
600
549
|
* @param options - Partial test agent options (undefined = empty config)
|
|
601
550
|
* @param bus - Scoped bus instance for the adapter
|
|
602
551
|
* @param testProviderDefinition - Optional provider definition for credential ref building
|
|
603
|
-
* @param
|
|
604
|
-
* env vars should be stripped from ambient subprocess environments
|
|
552
|
+
* @param adapterProviderRefs - Exact adapter/provider declarations under test
|
|
605
553
|
* @returns Complete test config with required fields injected
|
|
606
554
|
*/
|
|
607
|
-
declare function resolveTestConfig<
|
|
555
|
+
declare function resolveTestConfig<TBus extends ScopedBus<string>>(options: TestConfigOptionsInput | undefined, bus: TBus, testProviderDefinition?: ProviderDefinitionInput, adapterProviderRefs?: readonly AdapterProviderRef[]): ResolvedTestConfig<TBus>;
|
|
608
556
|
//#endregion
|
|
609
557
|
//#region adapters/core/src/utils/resolveConformanceTestPreset.d.ts
|
|
610
558
|
/** Default environment variable for selecting a conformance provider preset. */
|
|
@@ -623,8 +571,8 @@ type ConformanceEnvReader = (name: string) => string | undefined;
|
|
|
623
571
|
interface ResolveConformanceTestPresetOptions {
|
|
624
572
|
/** Adapter name used in configuration error messages. */
|
|
625
573
|
adapterName: string;
|
|
626
|
-
/**
|
|
627
|
-
|
|
574
|
+
/** Test provider definition ID used when no environment override is supplied. */
|
|
575
|
+
testProviderDefinitionId: string;
|
|
628
576
|
/** Provider IDs accepted by this adapter's conformance config. */
|
|
629
577
|
providerIds: readonly string[];
|
|
630
578
|
/** Full provider definitions supplied by the conformance harness. */
|
|
@@ -658,7 +606,7 @@ interface ResolvedConformanceTestPreset {
|
|
|
658
606
|
/**
|
|
659
607
|
* Resolve a conformance test provider preset from defaults plus MAKAIO_CONFORMANCE_* overrides.
|
|
660
608
|
*
|
|
661
|
-
* Provider, primary model, secondary model,
|
|
609
|
+
* Provider, primary model, secondary model, authentication, and endpoint overrides
|
|
662
610
|
* are resolved together so CI can swap test economics without changing local
|
|
663
611
|
* OAuth/default behavior.
|
|
664
612
|
* @param options - Resolver inputs and optional env variable names
|
|
@@ -751,6 +699,8 @@ interface ConnectorSessionConfig<TBus extends ScopedBus<string> = ScopedBus<stri
|
|
|
751
699
|
cwd: string;
|
|
752
700
|
model: string;
|
|
753
701
|
env: Record<string, string>;
|
|
702
|
+
/** Auth-free environment safe for bus-routable tool and MCP contexts. */
|
|
703
|
+
contextEnv?: Readonly<Record<string, string>>;
|
|
754
704
|
}
|
|
755
705
|
/**
|
|
756
706
|
* Interface for turn-like objects that support pause/abort operations.
|
|
@@ -1557,17 +1507,6 @@ declare function normalizeMimeType(mimeType: string | undefined | null): string;
|
|
|
1557
1507
|
*/
|
|
1558
1508
|
declare function isTextLikeMimeType(mimeType: string | undefined | null): boolean;
|
|
1559
1509
|
//#endregion
|
|
1560
|
-
//#region adapters/core/src/utils/resolvePresetCredentials.d.ts
|
|
1561
|
-
/**
|
|
1562
|
-
* Resolve credentials from environment variables using a provider definition's credential mapping.
|
|
1563
|
-
*
|
|
1564
|
-
* Reads `definition.credentialEnvVars` and checks `process.env` for each declared variable.
|
|
1565
|
-
* Only includes fields where the env var is actually set.
|
|
1566
|
-
* @param definition - Provider definition with optional credentialEnvVars mapping
|
|
1567
|
-
* @returns Object mapping credential field names to resolved values, or undefined if none resolved
|
|
1568
|
-
*/
|
|
1569
|
-
declare function resolvePresetCredentials(definition: ProviderDefinitionInput): Record<string, string> | undefined;
|
|
1570
|
-
//#endregion
|
|
1571
1510
|
//#region adapters/core/src/utils/createConnectorEventMapping.d.ts
|
|
1572
1511
|
/**
|
|
1573
1512
|
* Emit helper passed to handler functions for emitting to global subjects.
|
|
@@ -1694,6 +1633,19 @@ declare class MessageLifecycleTracker {
|
|
|
1694
1633
|
private readonly pendingTrackedHandles;
|
|
1695
1634
|
/** Current turnId from the session orchestrator (set at sendMessage entry, cleared on completion) */
|
|
1696
1635
|
private currentTurnId?;
|
|
1636
|
+
/**
|
|
1637
|
+
* Per-handle turnIds captured at {@link track} time. `currentTurnId` is a
|
|
1638
|
+
* shared field that a concurrent `sendMessage` overwrites while an earlier
|
|
1639
|
+
* turn is still streaming, so enrichment resolves the turnId from the
|
|
1640
|
+
* active handle; the shared field only covers the window between
|
|
1641
|
+
* `setCurrentTurnId` and `track`.
|
|
1642
|
+
*
|
|
1643
|
+
* Explicitly-undefined turnIds are recorded too (map presence, not value,
|
|
1644
|
+
* gates the fallback): a handle intentionally tracked without a turn
|
|
1645
|
+
* (e.g. `start()`) must keep its events turn-less instead of inheriting a
|
|
1646
|
+
* later queued turn's id from the shared field.
|
|
1647
|
+
*/
|
|
1648
|
+
private readonly handleTurnIds;
|
|
1697
1649
|
/** Emit function injected from AIAgent */
|
|
1698
1650
|
private readonly emitGlobal;
|
|
1699
1651
|
constructor(config: MessageLifecycleTrackerConfig);
|
|
@@ -1720,9 +1672,15 @@ declare class MessageLifecycleTracker {
|
|
|
1720
1672
|
*/
|
|
1721
1673
|
clearCurrentTurnId(): void;
|
|
1722
1674
|
/**
|
|
1723
|
-
* Get the
|
|
1675
|
+
* Get the turnId of the turn that is actually executing.
|
|
1724
1676
|
* Used by enrichPayload() to add turnId to intermediate events.
|
|
1725
|
-
*
|
|
1677
|
+
*
|
|
1678
|
+
* Resolves from the active handle's captured turnId so that a concurrent
|
|
1679
|
+
* `sendMessage` (which overwrites the shared `currentTurnId` before its
|
|
1680
|
+
* handle is promoted) cannot mislabel — or, downstream, drop — events of
|
|
1681
|
+
* the still-streaming turn. Falls back to the shared field for the window
|
|
1682
|
+
* between `setCurrentTurnId` and `track`, when no handle is active yet.
|
|
1683
|
+
* @returns The executing turn's turnId or undefined if not set
|
|
1726
1684
|
*/
|
|
1727
1685
|
getCurrentTurnId(): string | undefined;
|
|
1728
1686
|
/**
|
|
@@ -1821,28 +1779,38 @@ declare class ToolCallTracker {
|
|
|
1821
1779
|
/**
|
|
1822
1780
|
* Register a tool.use event. Returns correlation ID to use.
|
|
1823
1781
|
* If nativeId provided, uses that. Otherwise generates UUID.
|
|
1782
|
+
* @param messageId - Message that owns this pending call
|
|
1824
1783
|
* @param toolName - Name of the tool being invoked
|
|
1825
1784
|
* @param args - Tool arguments (optional, for future correlation strategies)
|
|
1826
1785
|
* @param nativeId - Native provider ID if available
|
|
1827
1786
|
* @returns Correlation ID to use for this tool call
|
|
1828
1787
|
*/
|
|
1829
|
-
register(toolName: string, args?: Record<string, unknown>, nativeId?: string): string;
|
|
1788
|
+
register(messageId: string, toolName: string, args?: Record<string, unknown>, nativeId?: string): string;
|
|
1830
1789
|
/**
|
|
1831
1790
|
* Find correlation ID for a tool output.
|
|
1832
1791
|
* Tries native ID first, then falls back to FIFO by tool name,
|
|
1833
1792
|
* and finally to the oldest pending tool call.
|
|
1793
|
+
* @param messageId - Message whose pending calls may be resolved
|
|
1834
1794
|
* @param hints - Available hints for correlation
|
|
1835
1795
|
* @returns Correlation result with strategy metadata
|
|
1836
1796
|
*/
|
|
1837
|
-
resolve(hints: ResolveHints): ResolveResult;
|
|
1797
|
+
resolve(messageId: string, hints: ResolveHints): ResolveResult;
|
|
1838
1798
|
/**
|
|
1839
1799
|
* Clear all pending entries.
|
|
1840
|
-
*
|
|
1800
|
+
* Reserved for fatal agent teardown; normal terminal messages use {@link clearMessage}.
|
|
1841
1801
|
*/
|
|
1842
|
-
|
|
1802
|
+
clearAll(): void;
|
|
1803
|
+
/**
|
|
1804
|
+
* Clear pending entries owned by one terminal message.
|
|
1805
|
+
* @param messageId - Message whose correlation state reached a terminal outcome
|
|
1806
|
+
*/
|
|
1807
|
+
clearMessage(messageId: string): void;
|
|
1843
1808
|
}
|
|
1844
1809
|
//#endregion
|
|
1845
1810
|
//#region adapters/core/src/agent/agent-event-bridge.d.ts
|
|
1811
|
+
type MessageOwnedPayload<T> = Omit<T, keyof AgentContext> & {
|
|
1812
|
+
messageId: string;
|
|
1813
|
+
};
|
|
1846
1814
|
/**
|
|
1847
1815
|
* Dependencies for AgentEventBridge.
|
|
1848
1816
|
*/
|
|
@@ -1852,15 +1820,15 @@ interface AgentEventBridgeConfig {
|
|
|
1852
1820
|
/** Emit context window status payload. */
|
|
1853
1821
|
emitContextWindowUpdated: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.contextWindow.updated>, keyof AgentContext>) => Promise<void>;
|
|
1854
1822
|
/** Emit tool.use payload. */
|
|
1855
|
-
emitToolUse: (payload:
|
|
1823
|
+
emitToolUse: (payload: MessageOwnedPayload<ExtractSubjectPayload<typeof AgentSubjects.tool.use>>) => Promise<void>;
|
|
1856
1824
|
/** Emit tool.output payload. */
|
|
1857
|
-
emitToolOutput: (payload:
|
|
1825
|
+
emitToolOutput: (payload: MessageOwnedPayload<ExtractSubjectPayload<typeof AgentSubjects.tool.output>>) => Promise<void>;
|
|
1858
1826
|
/** Emit adapter log payload. */
|
|
1859
1827
|
emitAdapterLog: (payload: Omit<ExtractSubjectPayload<typeof AdapterSubjects.log>, 'adapterId' | 'adapterName'>) => Promise<void>;
|
|
1860
1828
|
/** Emit step.started payload. */
|
|
1861
|
-
emitStepStarted: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.step.started>, keyof AgentContext>) => Promise<void>;
|
|
1829
|
+
emitStepStarted: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.step.started>, keyof AgentContext> | MessageOwnedPayload<ExtractSubjectPayload<typeof AgentSubjects.step.started>>) => Promise<void>;
|
|
1862
1830
|
/** Emit step.finished payload. */
|
|
1863
|
-
emitStepFinished: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.step.finished>, keyof AgentContext>) => Promise<void>;
|
|
1831
|
+
emitStepFinished: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.step.finished>, keyof AgentContext> | MessageOwnedPayload<ExtractSubjectPayload<typeof AgentSubjects.step.finished>>) => Promise<void>;
|
|
1864
1832
|
/** Correlation tracker for tool.use -\> tool.output. */
|
|
1865
1833
|
toolCallTracker: ToolCallTracker;
|
|
1866
1834
|
/** Current content block index getter. */
|
|
@@ -1916,19 +1884,21 @@ declare class AgentEventBridge {
|
|
|
1916
1884
|
emitContextWindowUpdate(input: ContextWindowInput): Promise<void>;
|
|
1917
1885
|
/**
|
|
1918
1886
|
* Emit tool.use event with correlation tracking.
|
|
1887
|
+
* @param messageId - Message that owns the tool call
|
|
1919
1888
|
* @param toolName - Tool identifier
|
|
1920
1889
|
* @param args - Tool arguments
|
|
1921
1890
|
* @param nativeId - Provider-native call ID
|
|
1922
1891
|
* @returns Correlation ID for the call
|
|
1923
1892
|
*/
|
|
1924
|
-
emitToolUse(toolName: string, args?: Record<string, unknown>, nativeId?: string): Promise<string>;
|
|
1893
|
+
emitToolUse(messageId: string, toolName: string, args?: Record<string, unknown>, nativeId?: string): Promise<string>;
|
|
1925
1894
|
/**
|
|
1926
1895
|
* Emit tool.output event with best-effort correlation resolution.
|
|
1896
|
+
* @param messageId - Message that owns the tool output
|
|
1927
1897
|
* @param output - Tool output text
|
|
1928
1898
|
* @param hints - Correlation hints from adapter events
|
|
1929
1899
|
* @returns Resolved toolCallId, toolName (falls back to 'unknown'), and args from the matched tool.use call
|
|
1930
1900
|
*/
|
|
1931
|
-
emitToolOutput(output: string, hints: ResolveHints): Promise<ToolOutputResult>;
|
|
1901
|
+
emitToolOutput(messageId: string, output: string, hints: ResolveHints): Promise<ToolOutputResult>;
|
|
1932
1902
|
/**
|
|
1933
1903
|
* Emit step.started for the current block index.
|
|
1934
1904
|
* @param stepType - Block step type
|
|
@@ -1936,603 +1906,611 @@ declare class AgentEventBridge {
|
|
|
1936
1906
|
* @param content - Optional immediate block content
|
|
1937
1907
|
*/
|
|
1938
1908
|
emitStepStarted(stepType: StepType, blockData?: BlockData, content?: SessionMessageBlock): Promise<void>;
|
|
1909
|
+
/**
|
|
1910
|
+
* Emit step.started with an explicit originating message identity.
|
|
1911
|
+
* @param messageId - Message that owns the step
|
|
1912
|
+
* @param stepType - Block step type
|
|
1913
|
+
* @param blockData - Optional step metadata
|
|
1914
|
+
* @param content - Optional immediate block content
|
|
1915
|
+
*/
|
|
1916
|
+
emitStepStartedForMessage(messageId: string, stepType: StepType, blockData?: BlockData, content?: SessionMessageBlock): Promise<void>;
|
|
1917
|
+
/**
|
|
1918
|
+
* Emit step.started with optional explicit message ownership.
|
|
1919
|
+
* @param messageId - Optional message that owns the step.
|
|
1920
|
+
* @param stepType - Semantic step kind.
|
|
1921
|
+
* @param blockData - Optional block metadata.
|
|
1922
|
+
* @param content - Optional initial block content.
|
|
1923
|
+
*/
|
|
1924
|
+
private emitOwnedStepStarted;
|
|
1939
1925
|
/**
|
|
1940
1926
|
* Emit step.finished and advance block index.
|
|
1941
1927
|
* @param stepType - Completed step type
|
|
1942
1928
|
* @param content - Final block content
|
|
1943
1929
|
*/
|
|
1944
1930
|
emitStepFinished(stepType: StepType, content: SessionMessageBlock): Promise<void>;
|
|
1931
|
+
/**
|
|
1932
|
+
* Emit step.finished with an explicit originating message identity and advance the block index.
|
|
1933
|
+
* @param messageId - Message that owns the step
|
|
1934
|
+
* @param stepType - Completed step type
|
|
1935
|
+
* @param content - Final block content
|
|
1936
|
+
*/
|
|
1937
|
+
emitStepFinishedForMessage(messageId: string, stepType: StepType, content: SessionMessageBlock): Promise<void>;
|
|
1938
|
+
/**
|
|
1939
|
+
* Emit step.finished with optional explicit message ownership and advance the block index.
|
|
1940
|
+
* @param messageId - Optional message that owns the step.
|
|
1941
|
+
* @param stepType - Semantic step kind.
|
|
1942
|
+
* @param content - Completed block content.
|
|
1943
|
+
*/
|
|
1944
|
+
private emitOwnedStepFinished;
|
|
1945
1945
|
}
|
|
1946
1946
|
//#endregion
|
|
1947
|
-
//#region adapters/core/src/
|
|
1947
|
+
//#region adapters/core/src/factory/create-adapter-namespace.d.ts
|
|
1948
1948
|
/**
|
|
1949
|
-
*
|
|
1949
|
+
* Adapter namespace extends BusNamespace with additional metadata for adapters.
|
|
1950
1950
|
*
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1951
|
+
* Provides:
|
|
1952
|
+
* - All BusNamespace features (subjects, scoped bus factory)
|
|
1953
|
+
* - Raw schema access for adapter factory internals
|
|
1954
|
+
* - Domain name for debugging/logging
|
|
1955
|
+
* @typeParam N - Namespace domain string
|
|
1954
1956
|
*/
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1957
|
+
type AdapterNamespace<Domain extends string = string> = Omit<BusNamespace<Domain>, 'subjects'> & {
|
|
1958
|
+
/** Original namespace definition for registration on host-provided bus instances. */readonly definition: RegistrableBusNamespaceDefinition;
|
|
1959
|
+
};
|
|
1960
|
+
/**
|
|
1961
|
+
* Creates an adapter namespace with typed subject definitions.
|
|
1962
|
+
*
|
|
1963
|
+
* **Seam:** Thin wrapper around MakaioBus.registerNamespace that:
|
|
1964
|
+
* - Delegates to bus-core for namespace registration
|
|
1965
|
+
* - Preserves FilterPayload type for type-safe withFilter()
|
|
1966
|
+
* - Provides extension point for future adapter-specific features
|
|
1967
|
+
* @param domain - Namespace domain (e.g., 'adapter:claudeCode')
|
|
1968
|
+
* @param schemas - Record of subject schemas (events and requests)
|
|
1969
|
+
* @param options - Registration and routing options (e.g., busValidationMode for Zod version conflicts)
|
|
1970
|
+
* @returns Adapter namespace with typed subjects and pre-computed FilterPayload
|
|
1971
|
+
* @example
|
|
1972
|
+
* ```typescript
|
|
1973
|
+
* const ClaudeCodeNamespace = createAdapterNamespace('adapter:claudeCode', {
|
|
1974
|
+
* thinking: z.object({ content: z.string() }),
|
|
1975
|
+
* getContext: {
|
|
1976
|
+
* request: z.object({ path: z.string() }),
|
|
1977
|
+
* response: z.object({ content: z.string() }),
|
|
1978
|
+
* },
|
|
1979
|
+
* });
|
|
1980
|
+
*
|
|
1981
|
+
* // Access typed subjects
|
|
1982
|
+
* ClaudeCodeNamespace.subjects.thinking;
|
|
1983
|
+
*
|
|
1984
|
+
* // Get scoped bus with type-safe filtering
|
|
1985
|
+
* const bus = await ClaudeCodeNamespace.scopedBus();
|
|
1986
|
+
* bus.withFilter({ content: 'test' }); // ✅ Type-checked
|
|
1987
|
+
*
|
|
1988
|
+
* // For adapters with bundled Zod v3 (e.g., @github/copilot-sdk):
|
|
1989
|
+
* const CopilotNamespace = createAdapterNamespace('adapter:copilot', schemas, {
|
|
1990
|
+
* busValidationMode: 'skip', // Skip validation due to Zod version conflict
|
|
1991
|
+
* });
|
|
1992
|
+
*
|
|
1993
|
+
* // For adapters with lenient validation (schema drift triggers warnings, not crashes):
|
|
1994
|
+
* const ClaudeNamespace = createAdapterNamespace('adapter:claude-code', schemas, {
|
|
1995
|
+
* busValidationMode: 'lenient',
|
|
1996
|
+
* onSchemaViolation: (report) => console.warn(report),
|
|
1997
|
+
* });
|
|
1998
|
+
* ```
|
|
1999
|
+
*/
|
|
2000
|
+
declare function createAdapterNamespace<N extends string, Schemas extends SchemaRecord>(domain: N, schemas: Schemas, options?: CreateBusNamespaceOptions): BusNamespace<N, SubjectRecordFromSchemaRecord<Schemas>, FilterablePayloadIntersection<SubjectRecordFromSchemaRecord<Schemas>>, Schemas> & {
|
|
2001
|
+
readonly definition: RegistrableBusNamespaceDefinition;
|
|
2002
|
+
};
|
|
2003
|
+
//#endregion
|
|
2004
|
+
//#region adapters/core/src/agent/agent-turn-executor.d.ts
|
|
2005
|
+
/**
|
|
2006
|
+
* Runtime dependencies for AgentTurnExecutor.
|
|
2007
|
+
*/
|
|
2008
|
+
type AgentMessageHandleCallback = (messageHandle: MessageHandle, turnId: string | undefined) => Promise<void>;
|
|
2009
|
+
interface AgentTurnExecutorConfig {
|
|
2010
|
+
/** Stable agent identifier. */
|
|
2011
|
+
agentId: string;
|
|
2012
|
+
/** Stable adapter identifier. */
|
|
2013
|
+
adapterId: string;
|
|
2014
|
+
/** Optional Makaio session identifier. */
|
|
2015
|
+
sessionId?: string;
|
|
2016
|
+
/** Capability tags reported by the adapter (e.g. `'structuredOutput'`). */
|
|
2017
|
+
adapterCapabilities?: string[];
|
|
2018
|
+
/** Global bus instance for hooks. */
|
|
2019
|
+
globalBus: IMakaioBus;
|
|
2020
|
+
/** Current connector reference resolver. */
|
|
2021
|
+
getConnector: () => AIAgentConnector;
|
|
2022
|
+
/** Native resume decision function. */
|
|
2023
|
+
shouldUseNativeResume: ShouldUseNativeResumeFn;
|
|
1990
2024
|
/**
|
|
1991
|
-
*
|
|
2025
|
+
* Whether the agent config carries a concrete resume target
|
|
2026
|
+
* (`resumeAdapterSessionId`).
|
|
1992
2027
|
*
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
1996
|
-
* every first-start path sets the mode before the connector fires.
|
|
2028
|
+
* Used by {@link AgentTurnExecutor.deriveStartMode} to distinguish
|
|
2029
|
+
* native-attach starts (resume target, no sessionContext) from
|
|
2030
|
+
* truly sessionless/ephemeral starts (no resume target, no context).
|
|
1997
2031
|
*/
|
|
1998
|
-
|
|
1999
|
-
/** Normalized config with defaults applied */
|
|
2000
|
-
protected readonly config: SetRequired<AIAgentConfig<TBus, TConnector>, 'globalBus'>;
|
|
2001
|
-
/** Available models for context window lookup */
|
|
2002
|
-
protected readonly availableModels?: AIModel[];
|
|
2032
|
+
hasResumeTarget: () => boolean;
|
|
2003
2033
|
/**
|
|
2004
|
-
*
|
|
2034
|
+
* Set the start mode on the owning agent before connector dispatch.
|
|
2005
2035
|
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2036
|
+
* The turn executor computes the mode from session context signals and
|
|
2037
|
+
* calls this so `emitStart()` can include it in the `agent.started`
|
|
2038
|
+
* payload when the connector fires its lifecycle event.
|
|
2039
|
+
* @param mode - Derived start mode for this turn
|
|
2008
2040
|
*/
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
/**
|
|
2013
|
-
|
|
2014
|
-
/**
|
|
2015
|
-
|
|
2016
|
-
/**
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2041
|
+
setPendingStartMode: (mode: StartMode) => void;
|
|
2042
|
+
/** Completion/lifecycle tracker hook. */
|
|
2043
|
+
onMessageHandle: AgentMessageHandleCallback;
|
|
2044
|
+
/** Side-effect callback to mark agent status active before dispatch. */
|
|
2045
|
+
onBeforeDispatch?: () => void | Promise<void>;
|
|
2046
|
+
/** Serialize the complete pre-hook-to-send boundary with credential mutations. */
|
|
2047
|
+
runDispatch?: <T>(dispatch: () => Promise<T>) => Promise<T>;
|
|
2048
|
+
/** When true, PreUserMessage hooks are skipped. */
|
|
2049
|
+
ephemeral?: boolean;
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Function type for native resume decision.
|
|
2053
|
+
*/
|
|
2054
|
+
type ShouldUseNativeResumeFn = (sessionContext?: StartAgentOptions['sessionContext']) => boolean;
|
|
2055
|
+
/**
|
|
2056
|
+
* Shared start/send-message execution pipeline for AIAgent.
|
|
2057
|
+
*/
|
|
2058
|
+
declare class AgentTurnExecutor {
|
|
2059
|
+
private readonly agentId;
|
|
2060
|
+
private readonly adapterId;
|
|
2061
|
+
private readonly sessionId?;
|
|
2062
|
+
private readonly adapterCapabilities;
|
|
2063
|
+
private readonly globalBus;
|
|
2064
|
+
private readonly getConnector;
|
|
2065
|
+
private readonly shouldUseNativeResume;
|
|
2066
|
+
private readonly hasResumeTarget;
|
|
2067
|
+
private readonly setPendingStartMode;
|
|
2068
|
+
private readonly onMessageHandle;
|
|
2069
|
+
private readonly onBeforeDispatch?;
|
|
2070
|
+
private readonly runDispatch;
|
|
2071
|
+
private readonly ephemeral;
|
|
2072
|
+
constructor(config: AgentTurnExecutorConfig);
|
|
2028
2073
|
/**
|
|
2029
|
-
*
|
|
2074
|
+
* Derive the {@link StartMode} from session context, resume decision, and
|
|
2075
|
+
* resume-target presence.
|
|
2030
2076
|
*
|
|
2031
|
-
*
|
|
2032
|
-
* and sets up handlers for agent.* subjects with agentId filtering.
|
|
2033
|
-
* @throws Error if already initialized
|
|
2034
|
-
*/
|
|
2035
|
-
init(): Promise<void>;
|
|
2036
|
-
/**
|
|
2037
|
-
* Emit `agent.started` with the pending start mode (consume-on-read).
|
|
2077
|
+
* Decision table (evaluated top-to-bottom, first match wins):
|
|
2038
2078
|
*
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
*
|
|
2079
|
+
* | sessionContext | nativeFork | hasResumeTarget | useNativeResume | isFirstTurn | Mode |
|
|
2080
|
+
* |----------------|------------|-----------------|-----------------|-------------|------------|
|
|
2081
|
+
* | present | yes | — | — | — | `fork` |
|
|
2082
|
+
* | absent | — | yes | — | — | `resume` |
|
|
2083
|
+
* | absent | — | no | — | — | `fresh` |
|
|
2084
|
+
* | present | no | — | true | — | `resume` |
|
|
2085
|
+
* | present | no | — | false | true | `fresh` |
|
|
2086
|
+
* | present | no | — | false | false | `rotation` |
|
|
2046
2087
|
*
|
|
2047
|
-
*
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
|
|
2052
|
-
setPendingStartMode(mode: StartMode): void;
|
|
2053
|
-
protected emitCompletion(result: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>): Promise<void>;
|
|
2054
|
-
/**
|
|
2055
|
-
* Stash error metadata for the next emitCompletion call.
|
|
2056
|
-
*
|
|
2057
|
-
* The lifecycle tracker emits `agent.complete` with `outcome: 'error'` when the
|
|
2058
|
-
* message handle completes. This method runs first (from the connector's errorHandler)
|
|
2059
|
-
* and stashes `errorCategory` so emitCompletion can include it in the complete payload.
|
|
2088
|
+
* The `hasResumeTarget` rule distinguishes native-attach starts (concrete
|
|
2089
|
+
* provider session to reconnect to, but no orchestrator session context) from
|
|
2090
|
+
* truly sessionless/ephemeral starts. Without this signal, both cases
|
|
2091
|
+
* collapsed to `'fresh'` — causing SDK SessionStart hooks to run
|
|
2092
|
+
* initialization logic on a resumed conversation.
|
|
2060
2093
|
*
|
|
2061
|
-
*
|
|
2062
|
-
*
|
|
2094
|
+
* `hasResumeTarget` fires only when sessionContext is absent. Once the
|
|
2095
|
+
* orchestrator supplies context (turn 2+), rules 4-6 take over and the
|
|
2096
|
+
* resume target on the config has no further effect on mode derivation.
|
|
2097
|
+
* @param sessionContext - Session context signals from the orchestrator
|
|
2098
|
+
* @param useNativeResume - Whether native resume was selected for this turn
|
|
2099
|
+
* @param hasResumeTarget - Whether a concrete resume target
|
|
2100
|
+
* (`resumeAdapterSessionId`) exists on the agent config
|
|
2101
|
+
* @returns The derived start mode
|
|
2063
2102
|
*/
|
|
2064
|
-
|
|
2103
|
+
static deriveStartMode(sessionContext: SessionContext | undefined, useNativeResume: boolean, hasResumeTarget?: boolean): StartMode;
|
|
2065
2104
|
/**
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2105
|
+
* Derive the start mode for the given resolved session context, stash it
|
|
2106
|
+
* as the pending mode for the next lifecycle start emission, and return
|
|
2107
|
+
* the native-resume decision shared by the dispatch that follows.
|
|
2108
|
+
* @param sessionContext - Session context after pre-user-message hooks
|
|
2109
|
+
* @returns Whether the connector should rely on native resume
|
|
2069
2110
|
*/
|
|
2070
|
-
|
|
2111
|
+
private deriveAndSetPendingStartMode;
|
|
2071
2112
|
/**
|
|
2072
|
-
*
|
|
2073
|
-
* @param payload -
|
|
2074
|
-
* @returns
|
|
2113
|
+
* Execute the turn pipeline for agent.sendMessage.
|
|
2114
|
+
* @param payload - agent.sendMessage request payload
|
|
2115
|
+
* @returns Resolved messageId from connector handle
|
|
2075
2116
|
*/
|
|
2076
|
-
|
|
2077
|
-
messageId
|
|
2117
|
+
executeSendMessage(payload: SendMessageRequestPayload): Promise<{
|
|
2118
|
+
messageId: string;
|
|
2078
2119
|
}>;
|
|
2079
2120
|
/**
|
|
2080
|
-
*
|
|
2081
|
-
* @param
|
|
2082
|
-
* @param
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
}): Promise<void>;
|
|
2087
|
-
/**
|
|
2088
|
-
* Track usage and emit to global bus.
|
|
2089
|
-
* AIAdapter aggregates session totals from per-call usage events.
|
|
2090
|
-
* @param normalized - Normalized usage metrics from adapter-specific normalizer
|
|
2091
|
-
*/
|
|
2092
|
-
protected trackUsage(normalized: NormalizedCallUsage): Promise<void>;
|
|
2093
|
-
/**
|
|
2094
|
-
* Get context window size for a model.
|
|
2095
|
-
*
|
|
2096
|
-
* Looks up the context window size from availableModels based on model name.
|
|
2097
|
-
* @param modelName - Model name to look up (defaults to confirmedModel or initialModel)
|
|
2098
|
-
* @returns Context window size in tokens, or undefined if not found
|
|
2099
|
-
*/
|
|
2100
|
-
protected getContextWindowSize(modelName?: string): number | undefined;
|
|
2101
|
-
/**
|
|
2102
|
-
* Emit context window status for compression trigger decisions.
|
|
2103
|
-
*
|
|
2104
|
-
* Calculates fill percentage and warning level from raw metrics.
|
|
2105
|
-
* Called by subclasses after usage tracking with provider-specific metrics.
|
|
2106
|
-
* @param input - Raw metrics: currentTokens, maxTokens, optional cachedTokens
|
|
2107
|
-
*/
|
|
2108
|
-
protected emitContextWindowUpdate(input: ContextWindowInput): Promise<void>;
|
|
2109
|
-
/**
|
|
2110
|
-
* Emit tool.use event with automatic correlation tracking.
|
|
2111
|
-
* Registers the tool call with ToolCallTracker and emits to global bus.
|
|
2112
|
-
* Use this instead of directly emitting to AgentSubjects.tool.use.
|
|
2113
|
-
* @param toolName - Name of the tool being invoked
|
|
2114
|
-
* @param args - Tool arguments
|
|
2115
|
-
* @param nativeId - Native provider ID if available (e.g., toolu_*, call_*)
|
|
2116
|
-
* @returns The correlation ID used (nativeId if provided, else generated UUID)
|
|
2117
|
-
*/
|
|
2118
|
-
protected emitToolUse(toolName: string, args?: Record<string, unknown>, nativeId?: string): Promise<string>;
|
|
2119
|
-
/**
|
|
2120
|
-
* Emit tool.output event with automatic correlation resolution.
|
|
2121
|
-
* Resolves the correlation ID from ToolCallTracker using provided hints.
|
|
2122
|
-
* Use this instead of directly emitting to AgentSubjects.tool.output.
|
|
2123
|
-
* @param output - Tool output content
|
|
2124
|
-
* @param hints - Hints for correlation (nativeId and/or toolName)
|
|
2125
|
-
* @returns Resolved toolCallId, toolName (falls back to 'unknown'), and args from the matched tool.use call
|
|
2126
|
-
*/
|
|
2127
|
-
protected emitToolOutput(output: string, hints: ResolveHints): Promise<ToolOutputResult>;
|
|
2128
|
-
/**
|
|
2129
|
-
* Emit step.started event with automatic block index management.
|
|
2130
|
-
* Call this when a content block begins processing.
|
|
2131
|
-
* @param stepType - The type of step (text, reasoning, tool_use)
|
|
2132
|
-
* @param blockData - Optional metadata for the block (e.g., toolName for tool_use)
|
|
2133
|
-
* @param content - Optional content for the step (e.g., tool_call block for tool_use)
|
|
2121
|
+
* Execute the turn pipeline for agent.start.
|
|
2122
|
+
* @param message - Initial message payload
|
|
2123
|
+
* @param options - Start options from caller
|
|
2124
|
+
* @param systemPrompt - Runtime system prompt chosen by AIAgent
|
|
2125
|
+
* @param responseSchema - Runtime structured output descriptor chosen by AIAgent
|
|
2126
|
+
* @returns Agent start result from connector
|
|
2134
2127
|
*/
|
|
2135
|
-
|
|
2128
|
+
executeStart(message: NormalizedMessageInput | MessageInput, options: StartAgentOptions | undefined, systemPrompt: StartAgentOptions['systemPrompt'], responseSchema?: ResponseSchemaDescriptor): Promise<AgentStartResult>;
|
|
2136
2129
|
/**
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2139
|
-
* @
|
|
2140
|
-
* @param content - The complete content of the step (text, reasoning, tool_call, or tool_output)
|
|
2130
|
+
* Resolve the pre-user hook result or preserve the caller payload for ephemeral turns.
|
|
2131
|
+
* @param input - Message and context for the outgoing user turn
|
|
2132
|
+
* @returns Message and session context to dispatch to the connector
|
|
2141
2133
|
*/
|
|
2142
|
-
|
|
2134
|
+
private resolvePreUserMessageTurn;
|
|
2143
2135
|
/**
|
|
2144
|
-
*
|
|
2145
|
-
* @
|
|
2136
|
+
* Fire PostUserMessage hooks without blocking the turn.
|
|
2137
|
+
* @param messageId - Message ID for correlation
|
|
2146
2138
|
*/
|
|
2147
|
-
|
|
2139
|
+
private firePostUserMessageHooks;
|
|
2148
2140
|
/**
|
|
2149
|
-
*
|
|
2150
|
-
*
|
|
2141
|
+
* Enforce the connector contract for an orchestrator-assigned message identity.
|
|
2142
|
+
* @param expectedMessageId - Canonical caller identity, when one was supplied.
|
|
2143
|
+
* @param handle - Connector handle returned for the dispatched message.
|
|
2144
|
+
* @param connector - Connector that owns fatal teardown for a violated dispatch contract.
|
|
2145
|
+
* @param operation - Connector operation that produced the handle.
|
|
2151
2146
|
*/
|
|
2152
|
-
|
|
2147
|
+
private assertCanonicalMessageId;
|
|
2148
|
+
}
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region adapters/core/src/agent/connector-runtime.d.ts
|
|
2151
|
+
/** Connector instance paired with its explicit client config lease. */
|
|
2152
|
+
interface ConnectorRuntimeHandle<TConnector extends Pick<AIAgentConnector, 'close'>> {
|
|
2153
|
+
/** Live connector instance. */
|
|
2154
|
+
readonly connector: TConnector;
|
|
2155
|
+
/** Lease whose lifetime exactly matches this connector. */
|
|
2156
|
+
readonly lease?: AdapterAuthLeaseHandle;
|
|
2157
|
+
}
|
|
2158
|
+
/** Dependencies for creating one managed connector runtime. */
|
|
2159
|
+
interface CreateConnectorRuntimeOptions<TBus extends ScopedBus<string>, TConnector extends AIAgentConnector<TBus>, TConfig extends BaseAgentConnectorConfig<TBus> = BaseAgentConnectorConfig<TBus>> {
|
|
2160
|
+
/** Refs-only config emitted by the common adapter factory. */
|
|
2161
|
+
readonly config: BoundAdapterRuntimeConfig<TBus, TConfig>;
|
|
2162
|
+
/** Adapter connector constructor. */
|
|
2163
|
+
readonly connectorFactory: (config: ResolvedAdapterRuntimeConfig<TBus, TConfig>) => TConnector | Promise<TConnector>;
|
|
2164
|
+
/** Optional user-message callback attached only after auth preparation. */
|
|
2165
|
+
readonly onMessageSent?: (handle: MessageHandle) => void;
|
|
2166
|
+
/** Trusted host-local auth preparer; defaults to DirectChannel + client lease. */
|
|
2167
|
+
readonly prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus, TConfig>;
|
|
2168
|
+
}
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region adapters/core/src/agent/agent-lifecycle-emitter.d.ts
|
|
2171
|
+
/**
|
|
2172
|
+
* Dependencies for AgentLifecycleEmitter.
|
|
2173
|
+
*/
|
|
2174
|
+
interface AgentLifecycleEmitterConfig {
|
|
2175
|
+
/** Stable agent identifier for persistence updates. */
|
|
2176
|
+
agentId: string;
|
|
2177
|
+
/** Global bus for best-effort status updates. */
|
|
2178
|
+
globalBus: IMakaioBus;
|
|
2179
|
+
/** Emit callback for `agent.started`. */
|
|
2180
|
+
emitStarted: (payload: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>) => Promise<void>;
|
|
2181
|
+
/** Emit callback for `agent.complete`. */
|
|
2182
|
+
emitComplete: (payload: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>) => Promise<void>;
|
|
2183
|
+
/** Emit callback for `agent.session.closed`. */
|
|
2184
|
+
emitSessionClosed: (payload: {
|
|
2185
|
+
reason?: string;
|
|
2186
|
+
}) => Promise<void>;
|
|
2187
|
+
/** Hook executed before terminal completion emission. */
|
|
2188
|
+
onBeforeEmitCompletion: () => Promise<void>;
|
|
2189
|
+
/** Clear tool-call tracker entries owned by one terminal message. */
|
|
2190
|
+
clearMessageToolCalls: (messageId: string) => void;
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Stateful lifecycle emitter for AIAgent terminal/start/session events.
|
|
2194
|
+
*/
|
|
2195
|
+
declare class AgentLifecycleEmitter {
|
|
2196
|
+
private static readonly COMPLETION_DEDUP_LIMIT;
|
|
2197
|
+
/** Tracks whether session.closed has been emitted (emit only once). */
|
|
2198
|
+
private sessionClosedEmitted;
|
|
2199
|
+
/** Terminal messages already emitted; overlapping handles must not share a mutable turn guard. */
|
|
2200
|
+
private readonly completedMessageIds;
|
|
2201
|
+
private readonly completedMessageOrder;
|
|
2202
|
+
private readonly config;
|
|
2203
|
+
constructor(config: AgentLifecycleEmitterConfig);
|
|
2153
2204
|
/**
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
* only receives messages intended for this agent.
|
|
2157
|
-
* Runs PreUserMessage hooks before delegating to the connector's sendMessage method.
|
|
2158
|
-
* Uses sessionContext signals to decide between native resume and fresh with history.
|
|
2159
|
-
* HookAbortError propagates to caller (session layer handles lifecycle).
|
|
2160
|
-
* Subclasses can override for custom handling.
|
|
2161
|
-
* @param ctx - Request context with payload and response methods
|
|
2205
|
+
* Emit `agent.started`.
|
|
2206
|
+
* @param event - Start payload without auto-enriched AgentContext fields
|
|
2162
2207
|
*/
|
|
2163
|
-
|
|
2208
|
+
emitStart(event: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>): Promise<void>;
|
|
2164
2209
|
/**
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
* @param ctx - Request context with interrupt payload
|
|
2210
|
+
* Emit a terminal completion event for one message handle.
|
|
2211
|
+
* @param result - Completion payload without AgentContext fields
|
|
2168
2212
|
*/
|
|
2169
|
-
|
|
2213
|
+
emitCompletion(result: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>): Promise<void>;
|
|
2170
2214
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
* @param cleanup - Cleanup function to register
|
|
2215
|
+
* Emit `agent.session.closed` once for this agent lifecycle.
|
|
2216
|
+
* @param reason - Optional closure reason
|
|
2174
2217
|
*/
|
|
2175
|
-
|
|
2218
|
+
emitSessionClosed(reason?: string): void;
|
|
2219
|
+
}
|
|
2220
|
+
//#endregion
|
|
2221
|
+
//#region adapters/core/src/agent/agent-payload-emitter.d.ts
|
|
2222
|
+
interface AgentPayloadEventMetadata {
|
|
2223
|
+
clientId?: string;
|
|
2224
|
+
providerConfigId?: string;
|
|
2225
|
+
occurredAt?: number;
|
|
2226
|
+
}
|
|
2227
|
+
interface AgentPayloadEventFields extends AgentPayloadEventMetadata {
|
|
2228
|
+
messageId?: string;
|
|
2229
|
+
turnId?: string;
|
|
2230
|
+
sessionId?: string;
|
|
2231
|
+
}
|
|
2232
|
+
interface EmitGlobalOptions {
|
|
2233
|
+
includeEventMetadata?: boolean;
|
|
2234
|
+
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Dependencies for AgentPayloadEmitter.
|
|
2237
|
+
*/
|
|
2238
|
+
interface AgentPayloadEmitterConfig {
|
|
2239
|
+
/** Global bus for outbound emissions. */
|
|
2240
|
+
globalBus: IMakaioBus;
|
|
2241
|
+
/** Stable agent identity fields. */
|
|
2242
|
+
getAgentContextBase: () => Pick<AgentContext, 'agentId' | 'adapterId' | 'adapterName'> & {
|
|
2243
|
+
sessionId?: string;
|
|
2244
|
+
};
|
|
2245
|
+
/** Current messageId from lifecycle tracker, if any. */
|
|
2246
|
+
getCurrentMessageId: () => string | undefined;
|
|
2247
|
+
/** Current turnId from lifecycle tracker, if any. */
|
|
2248
|
+
getCurrentTurnId: () => string | undefined;
|
|
2249
|
+
/** Connector adapterSessionId, if currently available. */
|
|
2250
|
+
getConnectorAdapterSessionId: () => string | undefined;
|
|
2251
|
+
/** Last known adapterSessionId cached across connector swaps. */
|
|
2252
|
+
getLastKnownAdapterSessionId: () => string | undefined;
|
|
2253
|
+
/** Persist latest adapterSessionId after resolution. */
|
|
2254
|
+
setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void;
|
|
2255
|
+
/** Live event metadata defaults resolved from current runtime state. */
|
|
2256
|
+
getEventMetadataDefaults: () => AgentPayloadEventMetadata;
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Handles agent context enrichment and global bus emissions.
|
|
2260
|
+
*/
|
|
2261
|
+
declare class AgentPayloadEmitter {
|
|
2262
|
+
private readonly config;
|
|
2176
2263
|
/**
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2179
|
-
* @param cleanup - Function to unsubscribe from the bus
|
|
2264
|
+
* Create a payload emitter with context resolution dependencies.
|
|
2265
|
+
* @param config - Config controlling agent-context enrichment and global emissions
|
|
2180
2266
|
*/
|
|
2181
|
-
|
|
2267
|
+
constructor(config: AgentPayloadEmitterConfig);
|
|
2182
2268
|
/**
|
|
2183
|
-
*
|
|
2269
|
+
* Resolve the confirmed adapter session ID from synchronous sources.
|
|
2184
2270
|
*
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2188
|
-
*
|
|
2189
|
-
*
|
|
2271
|
+
* `getConnectorAdapterSessionId` delegates to `getConfirmedAdapterSessionId()`
|
|
2272
|
+
* which returns `undefined` for unconfirmed fork sessions — the provider has
|
|
2273
|
+
* not yet assigned the child session ID. For non-fork sessions (fresh, resume,
|
|
2274
|
+
* non-Claude adapters) the locally-determined ID is authoritative and returned
|
|
2275
|
+
* immediately.
|
|
2190
2276
|
*
|
|
2191
|
-
*
|
|
2277
|
+
* The `lastKnownAdapterSessionId` bridges connector swaps: when the old
|
|
2278
|
+
* connector is gone and the new one is not yet wired, the cached value carries
|
|
2279
|
+
* the confirmed ID from the previous connector.
|
|
2192
2280
|
*
|
|
2193
|
-
*
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2281
|
+
* No async fallback is used. `connector.getAdapterSessionId()` may resolve
|
|
2282
|
+
* with a provisional placeholder for fork sessions. Enrichment must never
|
|
2283
|
+
* stamp unconfirmed IDs — omitting the field is safe since R8 schemas allow
|
|
2284
|
+
* it optional.
|
|
2285
|
+
* @returns Confirmed adapter session ID or `undefined`
|
|
2197
2286
|
*/
|
|
2198
|
-
|
|
2287
|
+
private resolveConfirmedAdapterSessionId;
|
|
2199
2288
|
/**
|
|
2200
|
-
*
|
|
2201
|
-
*
|
|
2202
|
-
*
|
|
2203
|
-
*
|
|
2204
|
-
* @param overrides - Optional field overrides (e.g., cwd, model, adapterSessionId)
|
|
2205
|
-
* @returns ConfigFactoryInput ready for config factory
|
|
2289
|
+
* Resolve event metadata fields, merging caller-provided values over live defaults.
|
|
2290
|
+
* @param payload - Payload fields that may carry metadata overrides
|
|
2291
|
+
* @param includeMetadata - Whether to include analytics metadata at all
|
|
2292
|
+
* @returns Resolved metadata fields
|
|
2206
2293
|
*/
|
|
2207
|
-
private
|
|
2294
|
+
private resolveEventMetadata;
|
|
2208
2295
|
/**
|
|
2209
|
-
*
|
|
2210
|
-
*
|
|
2211
|
-
*
|
|
2212
|
-
* @
|
|
2213
|
-
|
|
2214
|
-
private createOnMessageSent;
|
|
2215
|
-
/**
|
|
2216
|
-
* Wire adapter-specific connector events.
|
|
2217
|
-
* Called automatically during init() and connector swap.
|
|
2218
|
-
* Subclasses implement this to set up their event mappings.
|
|
2219
|
-
* @param connector - Connector instance to wire
|
|
2220
|
-
*/
|
|
2221
|
-
protected abstract wireEvents(connector: TConnector): void | Promise<void>;
|
|
2222
|
-
/**
|
|
2223
|
-
* Subscribe to a connector subject and register its cleanup as connector wiring.
|
|
2224
|
-
*
|
|
2225
|
-
* Use this in adapter `wireEvents()` implementations so connector swaps can
|
|
2226
|
-
* remove old listeners before rewiring the new connector.
|
|
2227
|
-
* @param connector - Connector instance to subscribe on
|
|
2228
|
-
* @param subject - Subject definition to subscribe to
|
|
2229
|
-
* @param handler - Subject handler
|
|
2230
|
-
* @param options - Optional bus subscription options
|
|
2231
|
-
*/
|
|
2232
|
-
protected subscribeConnector<Subject extends ScopedSubjectDefinition<TConnector extends AIAgentConnector<infer TBus> ? TBus['namespace'] : never>>(connector: TConnector, subject: Subject, handler: HandlerForSubjectDefinition<Subject>, options?: OnOptions): void;
|
|
2233
|
-
/**
|
|
2234
|
-
* Clean up resources and emit session closed event.
|
|
2235
|
-
*
|
|
2236
|
-
* Emits session.closed event (once per session) unless explicitly suppressed,
|
|
2237
|
-
* then unsubscribes from all bus handlers and aborts the connector if available.
|
|
2238
|
-
* @param options - Cleanup options; ephemeral agents suppress session-close lifecycle events because they never join a session.
|
|
2239
|
-
*/
|
|
2240
|
-
close(options?: {
|
|
2241
|
-
emitSessionClosed?: boolean;
|
|
2242
|
-
}): Promise<void>;
|
|
2243
|
-
/**
|
|
2244
|
-
* Ensure the connector is initialized, throwing if not.
|
|
2245
|
-
* @returns The initialized connector instance
|
|
2296
|
+
* Enrich payload with agent context fields.
|
|
2297
|
+
* @param payload - Base payload to enrich
|
|
2298
|
+
* @param overrideMessageId - Explicit messageId override from caller payload
|
|
2299
|
+
* @param options - Enrichment controls for optional analytics metadata defaults
|
|
2300
|
+
* @returns Enriched payload with agent context
|
|
2246
2301
|
*/
|
|
2247
|
-
|
|
2302
|
+
enrichPayload<T extends object>(payload: T, overrideMessageId?: string, options?: EmitGlobalOptions): Promise<T & AgentIdentity & AgentPayloadEventFields>;
|
|
2248
2303
|
/**
|
|
2249
|
-
*
|
|
2250
|
-
*
|
|
2251
|
-
* @param
|
|
2252
|
-
* @
|
|
2304
|
+
* Emit enriched payload to global bus.
|
|
2305
|
+
* @param subject - Subject definition to emit
|
|
2306
|
+
* @param payload - Payload without AgentContext fields
|
|
2307
|
+
* @param options - Enrichment controls for optional analytics metadata defaults
|
|
2253
2308
|
*/
|
|
2254
|
-
|
|
2309
|
+
emitGlobal<S extends SubjectDefinition>(subject: S, payload: Omit<ExtractSubjectPayload<S>, keyof AgentContext> & {
|
|
2310
|
+
messageId?: string;
|
|
2311
|
+
turnId?: string;
|
|
2312
|
+
}, options?: EmitGlobalOptions): Promise<void>;
|
|
2313
|
+
}
|
|
2314
|
+
//#endregion
|
|
2315
|
+
//#region adapters/core/src/agent/agent-bus-handler-registrar.d.ts
|
|
2316
|
+
/**
|
|
2317
|
+
* Handler bundle required to register all `agent.*` request handlers.
|
|
2318
|
+
*/
|
|
2319
|
+
interface AgentBusHandlerRegistrarConfig {
|
|
2320
|
+
/** Global bus instance where handlers are registered. */
|
|
2321
|
+
globalBus: IMakaioBus;
|
|
2322
|
+
/** Target agent identity for filter scoping. */
|
|
2323
|
+
agentId: string;
|
|
2324
|
+
/** Makaio session identity for canonical turn-number observation. */
|
|
2325
|
+
sessionId?: string;
|
|
2326
|
+
/** Handler for `agent.sendMessage`. */
|
|
2327
|
+
onSendMessage: (ctx: RequestContext<SendMessageRequestPayload, SendMessageResponsePayload>) => Promise<void>;
|
|
2328
|
+
/** Handler for `agent.interrupt`. */
|
|
2329
|
+
onInterrupt: (ctx: RequestContext<AgentInterruptRequestPayload, AgentInterruptResponsePayload>) => Promise<void>;
|
|
2330
|
+
/** Provider for `agent.getCapabilities` response payload. */
|
|
2331
|
+
getCapabilities: () => GetCapabilitiesResponsePayload;
|
|
2332
|
+
/** Apply an `agent.cwd.change` payload. */
|
|
2333
|
+
onCwdChange: (payload: AgentCwdChangeRequestPayload) => Promise<AgentCwdChangeResponsePayload>;
|
|
2334
|
+
/** Apply an `agent.model.change` payload. */
|
|
2335
|
+
onModelChange: (payload: AgentModelChangeRequestPayload) => Promise<AgentModelChangeResponsePayload>;
|
|
2336
|
+
/** Apply an `agent.mcp.servers.set` payload. */
|
|
2337
|
+
onMcpServersSet: (payload: AgentMcpServersSetRequestPayload) => Promise<AgentMcpServersSetResponsePayload>;
|
|
2338
|
+
/** Apply an `agent.credential.change` payload. */
|
|
2339
|
+
onCredentialChange: (payload: AgentCredentialChangeRequestPayload) => Promise<AgentCredentialChangeResponsePayload>;
|
|
2340
|
+
/** Observe the canonical session turn number. */
|
|
2341
|
+
onTurnStarted: (turnNumber: number) => void;
|
|
2342
|
+
/** Mark connector tools stale after an MCP catalog mutation. */
|
|
2343
|
+
onMcpToolsChanged: () => void;
|
|
2344
|
+
}
|
|
2345
|
+
/**
|
|
2346
|
+
* Register all stable `agent.*` bus handlers for a single agent instance.
|
|
2347
|
+
* @param config - Registration configuration with handlers
|
|
2348
|
+
* @returns Cleanup functions for all registrations
|
|
2349
|
+
*/
|
|
2350
|
+
declare function registerAgentBusHandlers(config: AgentBusHandlerRegistrarConfig): Array<() => void>;
|
|
2351
|
+
//#endregion
|
|
2352
|
+
//#region adapters/core/src/agent/agent-runtime-mutation-manager-config.d.ts
|
|
2353
|
+
/** Dependencies for runtime mutation handling. */
|
|
2354
|
+
interface AgentRuntimeMutationManagerConfig {
|
|
2355
|
+
/** Stable agent identifier. */
|
|
2356
|
+
agentId: string;
|
|
2357
|
+
/** Optional Makaio session identifier. */
|
|
2358
|
+
sessionId?: string;
|
|
2359
|
+
/** Global bus for persistence and events. */
|
|
2360
|
+
globalBus: IMakaioBus;
|
|
2361
|
+
/** Read current connector. */
|
|
2362
|
+
getConnector: () => AIAgentConnector;
|
|
2363
|
+
/** Agent-wide exclusivity boundary for connector-affecting operations. */
|
|
2364
|
+
runExclusive: <T>(action: () => Promise<T>) => Promise<T>;
|
|
2365
|
+
/** Swap connector while the caller already owns the agent-wide runtime barrier. */
|
|
2366
|
+
swapConnectorUnlocked: (configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard) => Promise<void>;
|
|
2367
|
+
/** Emit cwd.changed payload. */
|
|
2368
|
+
emitCwdChanged: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.cwd.changed>, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>) => Promise<void>;
|
|
2369
|
+
/** Emit model.changed payload. */
|
|
2370
|
+
emitModelChanged: (payload: Omit<ExtractSubjectPayload<typeof AgentSubjects.model.changed>, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>) => Promise<void>;
|
|
2371
|
+
/** Read the agent's current provider context for no-op detection. */
|
|
2372
|
+
getProviderContext: () => ProviderContext | undefined;
|
|
2373
|
+
/** Persist provider context changes on agent config for sequential swaps. */
|
|
2374
|
+
setProviderContext: (providerContext: ProviderContext) => void;
|
|
2375
|
+
/** Persist reasoning effort changes on agent config for sequential swaps. */
|
|
2376
|
+
setReasoningEffort: (reasoningEffort: AIReasoningLevel$1 | undefined) => void;
|
|
2377
|
+
/** Persist MCP session context changes on agent config for sequential swaps. */
|
|
2378
|
+
setMcpSessionContext: (mcpSessionContext: McpRuntimeSessionContext | McpSessionContext | LedgerSessionContext | undefined) => void;
|
|
2379
|
+
/** Resolve supported reasoning levels for a model from the agent's available models. */
|
|
2380
|
+
resolveSupportedReasoningLevels: (model: string) => ReasoningLevelMap$1 | undefined;
|
|
2381
|
+
}
|
|
2382
|
+
//#endregion
|
|
2383
|
+
//#region adapters/core/src/agent/agent-runtime-mutation-manager.d.ts
|
|
2384
|
+
/** Coordinate every runtime mutation through one agent-wide exclusivity seam. */
|
|
2385
|
+
declare class AgentRuntimeMutationManager {
|
|
2386
|
+
private readonly agentId;
|
|
2387
|
+
private readonly globalBus;
|
|
2388
|
+
private readonly getConnector;
|
|
2389
|
+
private readonly runExclusive;
|
|
2390
|
+
private readonly swapConnectorUnlocked;
|
|
2391
|
+
private readonly emitCwdChanged;
|
|
2392
|
+
private readonly mcpServersMutationManager;
|
|
2393
|
+
private readonly modelMutationManager;
|
|
2394
|
+
private readonly credentialChangeManager;
|
|
2395
|
+
private readonly credentialChangeSequencer;
|
|
2255
2396
|
/**
|
|
2256
|
-
*
|
|
2257
|
-
* @
|
|
2397
|
+
* Create the agent-level runtime mutation coordinator.
|
|
2398
|
+
* @param config - Runtime collaborators and the shared exclusivity function
|
|
2258
2399
|
*/
|
|
2259
|
-
|
|
2400
|
+
constructor(config: AgentRuntimeMutationManagerConfig);
|
|
2260
2401
|
/**
|
|
2261
|
-
*
|
|
2262
|
-
*
|
|
2263
|
-
* @returns
|
|
2402
|
+
* Handle `agent.cwd.change` through the shared runtime barrier.
|
|
2403
|
+
* @param payload - CWD change request payload
|
|
2404
|
+
* @returns CWD mutation response payload
|
|
2264
2405
|
*/
|
|
2265
|
-
|
|
2406
|
+
handleCwdChange(payload: AgentCwdChangeRequestPayload): Promise<AgentCwdChangeResponsePayload>;
|
|
2266
2407
|
/**
|
|
2267
|
-
*
|
|
2268
|
-
*
|
|
2269
|
-
*
|
|
2270
|
-
* and uses sessionContext signals to decide between native resume and fresh
|
|
2271
|
-
* with history. HookAbortError propagates to caller.
|
|
2272
|
-
* @param message - User message (normalized or unnormalized)
|
|
2273
|
-
* @param options - Optional start options (e.g., delivery mode, sessionContext)
|
|
2274
|
-
* @returns Session ID, agent ID, and message handle for tracking
|
|
2408
|
+
* Apply one CWD change while the agent-wide runtime barrier is held.
|
|
2409
|
+
* @param payload - CWD change request payload
|
|
2410
|
+
* @returns CWD mutation response payload
|
|
2275
2411
|
*/
|
|
2276
|
-
|
|
2412
|
+
private handleCwdChangeUnlocked;
|
|
2413
|
+
/** Apply all staged replacements while the enclosing turn barrier is held. */
|
|
2414
|
+
private applyStagedMutationsUnlocked;
|
|
2277
2415
|
/**
|
|
2278
|
-
*
|
|
2279
|
-
*
|
|
2280
|
-
* @
|
|
2281
|
-
* @returns Confirmed adapter session ID, or `undefined` for unconfirmed fork sessions.
|
|
2416
|
+
* Serialize staged mutations and the complete turn pre-hook-to-send boundary.
|
|
2417
|
+
* @param dispatch - Turn dispatch work that must observe one connector generation
|
|
2418
|
+
* @returns Dispatch result
|
|
2282
2419
|
*/
|
|
2283
|
-
|
|
2284
|
-
protected onBeforeEmitCompletion(): Promise<void>;
|
|
2285
|
-
protected onMessageHandle(messageHandle: MessageHandle, turnId?: string): Promise<void>;
|
|
2420
|
+
runTurnDispatch<T>(dispatch: () => Promise<T>): Promise<T>;
|
|
2286
2421
|
/**
|
|
2287
|
-
*
|
|
2288
|
-
*
|
|
2289
|
-
*
|
|
2290
|
-
*
|
|
2291
|
-
* Emits session.closed event (once per session) then delegates
|
|
2292
|
-
* to the underlying connector's abort method.
|
|
2293
|
-
* @throws Error if connector is not initialized
|
|
2422
|
+
* Handle `agent.mcp.servers.set` through the shared runtime barrier.
|
|
2423
|
+
* @param payload - MCP server replacement request payload
|
|
2424
|
+
* @returns MCP mutation response payload
|
|
2294
2425
|
*/
|
|
2295
|
-
|
|
2426
|
+
handleMcpServersSet(payload: AgentMcpServersSetRequestPayload): Promise<AgentMcpServersSetResponsePayload>;
|
|
2296
2427
|
/**
|
|
2297
|
-
*
|
|
2298
|
-
*
|
|
2299
|
-
*
|
|
2300
|
-
* @returns Session ID from provider
|
|
2301
|
-
* @throws Error if connector is not initialized
|
|
2428
|
+
* Handle `agent.model.change` through the shared runtime barrier.
|
|
2429
|
+
* @param payload - Model/provider/reasoning mutation request
|
|
2430
|
+
* @returns Model mutation response payload
|
|
2302
2431
|
*/
|
|
2303
|
-
|
|
2432
|
+
handleModelChange(payload: AgentModelChangeRequestPayload): Promise<AgentModelChangeResponsePayload>;
|
|
2304
2433
|
/**
|
|
2305
|
-
*
|
|
2306
|
-
*
|
|
2307
|
-
*
|
|
2308
|
-
* result so structured-output transforms are reflected in direct callers.
|
|
2309
|
-
* @returns Last message result or null if no messages processed
|
|
2310
|
-
* @throws Error if connector is not initialized
|
|
2434
|
+
* Handle credential rotation through the same turn/mutation barrier.
|
|
2435
|
+
* @param payload - Credential change request payload
|
|
2436
|
+
* @returns Credential mutation response payload
|
|
2311
2437
|
*/
|
|
2312
|
-
|
|
2438
|
+
handleCredentialChanged(payload: AgentCredentialChangeRequestPayload): Promise<AgentCredentialChangeResponsePayload>;
|
|
2313
2439
|
/**
|
|
2314
|
-
*
|
|
2315
|
-
* @param
|
|
2316
|
-
* @param discriminator - The discriminator key within the message (e.g., 'type')
|
|
2317
|
-
* @param handlers - Map of discriminator values to target subjects or handler functions
|
|
2318
|
-
* @param nestedMessageProp - Property containing the discriminated union (e.g., 'msg'), or undefined for top-level
|
|
2319
|
-
* @returns Unsubscribe function for the connector event mapping subscription
|
|
2440
|
+
* Persist committed runtime fields and require an affirmative storage result.
|
|
2441
|
+
* @param changes - CWD/model/provider mutations to persist
|
|
2320
2442
|
*/
|
|
2321
|
-
|
|
2443
|
+
private persistRuntimeMutation;
|
|
2322
2444
|
}
|
|
2323
2445
|
//#endregion
|
|
2324
|
-
//#region adapters/core/src/
|
|
2446
|
+
//#region adapters/core/src/agent/mcp-call-extractor.d.ts
|
|
2325
2447
|
/**
|
|
2326
|
-
*
|
|
2448
|
+
* Utilities for identifying and extracting target information from `mcp_call`
|
|
2449
|
+
* tool invocations.
|
|
2327
2450
|
*
|
|
2328
|
-
*
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
2332
|
-
* @typeParam N - Namespace domain string
|
|
2451
|
+
* The `mcp_call` meta-tool carries its real target as the `tool` field in the
|
|
2452
|
+
* parsed JSON arguments. These helpers centralise that extraction logic so
|
|
2453
|
+
* every consumer (ledger, event bridge, analytics) uses a single, tested path.
|
|
2454
|
+
* @packageDocumentation
|
|
2333
2455
|
*/
|
|
2334
|
-
type AdapterNamespace<Domain extends string = string> = Omit<BusNamespace<Domain>, 'subjects'> & {
|
|
2335
|
-
/** Original namespace definition for registration on host-provided bus instances. */readonly definition: RegistrableBusNamespaceDefinition;
|
|
2336
|
-
};
|
|
2337
2456
|
/**
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2340
|
-
* **Seam:** Thin wrapper around MakaioBus.registerNamespace that:
|
|
2341
|
-
* - Delegates to bus-core for namespace registration
|
|
2342
|
-
* - Preserves FilterPayload type for type-safe withFilter()
|
|
2343
|
-
* - Provides extension point for future adapter-specific features
|
|
2344
|
-
* @param domain - Namespace domain (e.g., 'adapter:claudeCode')
|
|
2345
|
-
* @param schemas - Record of subject schemas (events and requests)
|
|
2346
|
-
* @param options - Registration and routing options (e.g., busValidationMode for Zod version conflicts)
|
|
2347
|
-
* @returns Adapter namespace with typed subjects and pre-computed FilterPayload
|
|
2348
|
-
* @example
|
|
2349
|
-
* ```typescript
|
|
2350
|
-
* const ClaudeCodeNamespace = createAdapterNamespace('adapter:claudeCode', {
|
|
2351
|
-
* thinking: z.object({ content: z.string() }),
|
|
2352
|
-
* getContext: {
|
|
2353
|
-
* request: z.object({ path: z.string() }),
|
|
2354
|
-
* response: z.object({ content: z.string() }),
|
|
2355
|
-
* },
|
|
2356
|
-
* });
|
|
2357
|
-
*
|
|
2358
|
-
* // Access typed subjects
|
|
2359
|
-
* ClaudeCodeNamespace.subjects.thinking;
|
|
2457
|
+
* Extract the target MCP tool name from parsed `mcp_call` arguments.
|
|
2360
2458
|
*
|
|
2361
|
-
*
|
|
2362
|
-
*
|
|
2363
|
-
*
|
|
2459
|
+
* Conforms to the `mcp_call` input schema which defines `{ tool: z.string() }`.
|
|
2460
|
+
* Returns `undefined` for any non-conformant argument shape so callers can
|
|
2461
|
+
* skip processing without throwing.
|
|
2462
|
+
* @param args - Parsed JSON arguments object from the tool call
|
|
2463
|
+
* @returns The namespaced target tool name, or `undefined` if not conformant
|
|
2464
|
+
*/
|
|
2465
|
+
declare function extractMcpCallTarget(args: Record<string, unknown>): string | undefined;
|
|
2466
|
+
/**
|
|
2467
|
+
* Check whether a tool call name refers to the `mcp_call` meta-tool.
|
|
2364
2468
|
*
|
|
2365
|
-
*
|
|
2366
|
-
*
|
|
2367
|
-
* busValidationMode: 'skip', // Skip validation due to Zod version conflict
|
|
2368
|
-
* });
|
|
2469
|
+
* Uses the canonical {@link MCP_CALL_TOOL_NAME} constant so the comparison
|
|
2470
|
+
* stays in sync with the toolset definition automatically.
|
|
2369
2471
|
*
|
|
2370
|
-
*
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2375
|
-
* ```
|
|
2472
|
+
* Callers are responsible for stripping provider-specific prefixes before
|
|
2473
|
+
* calling this function (e.g., Gemini's `default_api.` prefix must be
|
|
2474
|
+
* removed at the call site — see `execute-tool-calls.ts` normalizedToolName).
|
|
2475
|
+
* @param toolName - Normalized tool name from the tool call
|
|
2476
|
+
* @returns `true` if this is an `mcp_call` invocation
|
|
2376
2477
|
*/
|
|
2377
|
-
declare function
|
|
2378
|
-
readonly definition: RegistrableBusNamespaceDefinition;
|
|
2379
|
-
};
|
|
2478
|
+
declare function isMcpCallTool(toolName: string): boolean;
|
|
2380
2479
|
//#endregion
|
|
2381
|
-
//#region adapters/core/src/
|
|
2382
|
-
/**
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
/** Adapter capabilities (unparsed). Use parseAIAdapterCapabilities() to parse. */
|
|
2395
|
-
capabilities: AIAdapterCapability[];
|
|
2396
|
-
/** Scoped bus for adapter-level events. */
|
|
2397
|
-
adapterBus: Scope;
|
|
2398
|
-
/** Global event bus. */
|
|
2399
|
-
globalBus: IMakaioBus;
|
|
2400
|
-
}
|
|
2401
|
-
//#endregion
|
|
2402
|
-
//#region adapters/core/src/agent/agent-turn-executor.d.ts
|
|
2480
|
+
//#region adapters/core/src/agent/request-correlation.d.ts
|
|
2481
|
+
/** Exact Factory Gateway headers accepted by its content-free usage boundary. */
|
|
2482
|
+
declare const FactoryUsageCorrelationHeaders: {
|
|
2483
|
+
readonly sessionId: "x-factory-session-id";
|
|
2484
|
+
readonly turnId: "x-factory-turn-id";
|
|
2485
|
+
readonly messageId: "x-factory-message-id";
|
|
2486
|
+
readonly llmCallId: "x-factory-llm-call-id";
|
|
2487
|
+
readonly executionId: "x-factory-execution-id";
|
|
2488
|
+
readonly frameId: "x-factory-frame-id";
|
|
2489
|
+
};
|
|
2490
|
+
type ProviderRequestCorrelation = RequestCorrelationContext & {
|
|
2491
|
+
llmCallId: string;
|
|
2492
|
+
};
|
|
2403
2493
|
/**
|
|
2404
|
-
*
|
|
2494
|
+
* Bind caller correlation to identifiers owned by the active runtime request.
|
|
2495
|
+
* Runtime values always win, preventing stale or spoofed session/message IDs.
|
|
2496
|
+
* @param context - Optional orchestrator-supplied workflow correlation
|
|
2497
|
+
* @param runtime - IDs known by the connector for this concrete API request
|
|
2498
|
+
* @returns Fully bound correlation including one LLM-call ID
|
|
2405
2499
|
*/
|
|
2406
|
-
|
|
2407
|
-
interface AgentTurnExecutorConfig {
|
|
2408
|
-
/** Stable agent identifier. */
|
|
2409
|
-
agentId: string;
|
|
2410
|
-
/** Stable adapter identifier. */
|
|
2411
|
-
adapterId: string;
|
|
2412
|
-
/** Optional Makaio session identifier. */
|
|
2500
|
+
declare function bindProviderRequestCorrelation(context: RequestCorrelationContext | undefined, runtime: {
|
|
2413
2501
|
sessionId?: string;
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
globalBus: IMakaioBus;
|
|
2418
|
-
/** Current connector reference resolver. */
|
|
2419
|
-
getConnector: () => AIAgentConnector;
|
|
2420
|
-
/** Native resume decision function. */
|
|
2421
|
-
shouldUseNativeResume: ShouldUseNativeResumeFn;
|
|
2422
|
-
/**
|
|
2423
|
-
* Whether the agent config carries a concrete resume target
|
|
2424
|
-
* (`resumeAdapterSessionId`).
|
|
2425
|
-
*
|
|
2426
|
-
* Used by {@link AgentTurnExecutor.deriveStartMode} to distinguish
|
|
2427
|
-
* native-attach starts (resume target, no sessionContext) from
|
|
2428
|
-
* truly sessionless/ephemeral starts (no resume target, no context).
|
|
2429
|
-
*/
|
|
2430
|
-
hasResumeTarget: () => boolean;
|
|
2431
|
-
/**
|
|
2432
|
-
* Set the start mode on the owning agent before connector dispatch.
|
|
2433
|
-
*
|
|
2434
|
-
* The turn executor computes the mode from session context signals and
|
|
2435
|
-
* calls this so `emitStart()` can include it in the `agent.started`
|
|
2436
|
-
* payload when the connector fires its lifecycle event.
|
|
2437
|
-
* @param mode - Derived start mode for this turn
|
|
2438
|
-
*/
|
|
2439
|
-
setPendingStartMode: (mode: StartMode) => void;
|
|
2440
|
-
/** Completion/lifecycle tracker hook. */
|
|
2441
|
-
onMessageHandle: AgentMessageHandleCallback;
|
|
2442
|
-
/** Side-effect callback to mark agent status active before dispatch. */
|
|
2443
|
-
onBeforeDispatch?: () => void | Promise<void>;
|
|
2444
|
-
/** When true, PreUserMessage hooks are skipped. */
|
|
2445
|
-
ephemeral?: boolean;
|
|
2446
|
-
}
|
|
2447
|
-
/**
|
|
2448
|
-
* Function type for native resume decision.
|
|
2449
|
-
*/
|
|
2450
|
-
type ShouldUseNativeResumeFn = (sessionContext?: StartAgentOptions['sessionContext']) => boolean;
|
|
2502
|
+
messageId: string;
|
|
2503
|
+
llmCallId: string;
|
|
2504
|
+
}): ProviderRequestCorrelation;
|
|
2451
2505
|
/**
|
|
2452
|
-
*
|
|
2506
|
+
* Project a validated correlation context to the Factory Gateway allowlist.
|
|
2507
|
+
*
|
|
2508
|
+
* No arbitrary metadata or headers can cross this boundary. Callers must also
|
|
2509
|
+
* explicitly opt into the `factory-v1` transport mode before using the result.
|
|
2510
|
+
* @param correlation - Content-free runtime and workflow identifiers
|
|
2511
|
+
* @returns Header record accepted by the Factory Gateway usage boundary
|
|
2453
2512
|
*/
|
|
2454
|
-
declare
|
|
2455
|
-
private readonly agentId;
|
|
2456
|
-
private readonly adapterId;
|
|
2457
|
-
private readonly sessionId?;
|
|
2458
|
-
private readonly adapterCapabilities;
|
|
2459
|
-
private readonly globalBus;
|
|
2460
|
-
private readonly getConnector;
|
|
2461
|
-
private readonly shouldUseNativeResume;
|
|
2462
|
-
private readonly hasResumeTarget;
|
|
2463
|
-
private readonly setPendingStartMode;
|
|
2464
|
-
private readonly onMessageHandle;
|
|
2465
|
-
private readonly onBeforeDispatch?;
|
|
2466
|
-
private readonly ephemeral;
|
|
2467
|
-
constructor(config: AgentTurnExecutorConfig);
|
|
2468
|
-
/**
|
|
2469
|
-
* Derive the {@link StartMode} from session context, resume decision, and
|
|
2470
|
-
* resume-target presence.
|
|
2471
|
-
*
|
|
2472
|
-
* Decision table (evaluated top-to-bottom, first match wins):
|
|
2473
|
-
*
|
|
2474
|
-
* | sessionContext | nativeFork | hasResumeTarget | useNativeResume | isFirstTurn | Mode |
|
|
2475
|
-
* |----------------|------------|-----------------|-----------------|-------------|------------|
|
|
2476
|
-
* | present | yes | — | — | — | `fork` |
|
|
2477
|
-
* | absent | — | yes | — | — | `resume` |
|
|
2478
|
-
* | absent | — | no | — | — | `fresh` |
|
|
2479
|
-
* | present | no | — | true | — | `resume` |
|
|
2480
|
-
* | present | no | — | false | true | `fresh` |
|
|
2481
|
-
* | present | no | — | false | false | `rotation` |
|
|
2482
|
-
*
|
|
2483
|
-
* The `hasResumeTarget` rule distinguishes native-attach starts (concrete
|
|
2484
|
-
* provider session to reconnect to, but no orchestrator session context) from
|
|
2485
|
-
* truly sessionless/ephemeral starts. Without this signal, both cases
|
|
2486
|
-
* collapsed to `'fresh'` — causing SDK SessionStart hooks to run
|
|
2487
|
-
* initialization logic on a resumed conversation.
|
|
2488
|
-
*
|
|
2489
|
-
* `hasResumeTarget` fires only when sessionContext is absent. Once the
|
|
2490
|
-
* orchestrator supplies context (turn 2+), rules 4-6 take over and the
|
|
2491
|
-
* resume target on the config has no further effect on mode derivation.
|
|
2492
|
-
* @param sessionContext - Session context signals from the orchestrator
|
|
2493
|
-
* @param useNativeResume - Whether native resume was selected for this turn
|
|
2494
|
-
* @param hasResumeTarget - Whether a concrete resume target
|
|
2495
|
-
* (`resumeAdapterSessionId`) exists on the agent config
|
|
2496
|
-
* @returns The derived start mode
|
|
2497
|
-
*/
|
|
2498
|
-
static deriveStartMode(sessionContext: SessionContext | undefined, useNativeResume: boolean, hasResumeTarget?: boolean): StartMode;
|
|
2499
|
-
/**
|
|
2500
|
-
* Derive the start mode for the given resolved session context, stash it
|
|
2501
|
-
* as the pending mode for the next lifecycle start emission, and return
|
|
2502
|
-
* the native-resume decision shared by the dispatch that follows.
|
|
2503
|
-
* @param sessionContext - Session context after pre-user-message hooks
|
|
2504
|
-
* @returns Whether the connector should rely on native resume
|
|
2505
|
-
*/
|
|
2506
|
-
private deriveAndSetPendingStartMode;
|
|
2507
|
-
/**
|
|
2508
|
-
* Execute the turn pipeline for agent.sendMessage.
|
|
2509
|
-
* @param payload - agent.sendMessage request payload
|
|
2510
|
-
* @returns Resolved messageId from connector handle
|
|
2511
|
-
*/
|
|
2512
|
-
executeSendMessage(payload: SendMessageRequestPayload): Promise<{
|
|
2513
|
-
messageId: string;
|
|
2514
|
-
}>;
|
|
2515
|
-
/**
|
|
2516
|
-
* Execute the turn pipeline for agent.start.
|
|
2517
|
-
* @param message - Initial message payload
|
|
2518
|
-
* @param options - Start options from caller
|
|
2519
|
-
* @param systemPrompt - Runtime system prompt chosen by AIAgent
|
|
2520
|
-
* @param responseSchema - Runtime structured output descriptor chosen by AIAgent
|
|
2521
|
-
* @returns Agent start result from connector
|
|
2522
|
-
*/
|
|
2523
|
-
executeStart(message: NormalizedMessageInput | MessageInput, options: StartAgentOptions | undefined, systemPrompt: StartAgentOptions['systemPrompt'], responseSchema?: ResponseSchemaDescriptor): Promise<AgentStartResult>;
|
|
2524
|
-
/**
|
|
2525
|
-
* Resolve the pre-user hook result or preserve the caller payload for ephemeral turns.
|
|
2526
|
-
* @param input - Message and context for the outgoing user turn
|
|
2527
|
-
* @returns Message and session context to dispatch to the connector
|
|
2528
|
-
*/
|
|
2529
|
-
private resolvePreUserMessageTurn;
|
|
2530
|
-
/**
|
|
2531
|
-
* Fire PostUserMessage hooks without blocking the turn.
|
|
2532
|
-
* @param messageId - Message ID for correlation
|
|
2533
|
-
*/
|
|
2534
|
-
private firePostUserMessageHooks;
|
|
2535
|
-
}
|
|
2513
|
+
declare function buildFactoryUsageCorrelationHeaders(correlation: ProviderRequestCorrelation): Record<string, string>;
|
|
2536
2514
|
//#endregion
|
|
2537
2515
|
//#region adapters/core/src/adapter/types.d.ts
|
|
2538
2516
|
/** Payload type for adapter.startAgent requests. */
|
|
@@ -2637,6 +2615,8 @@ interface AIAdapterConfig<TBus extends ScopedBus<string> = ScopedBus<string>> {
|
|
|
2637
2615
|
definitionProviders?: readonly AdapterProviderDefinition[];
|
|
2638
2616
|
/** Client identifier for the application this adapter belongs to (e.g., 'claude-code', 'codex'). Omit for API-only adapters. */
|
|
2639
2617
|
clientId?: string;
|
|
2618
|
+
/** Trusted non-serializable normalized auth preparer injected by the host. */
|
|
2619
|
+
prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus>;
|
|
2640
2620
|
}
|
|
2641
2621
|
/**
|
|
2642
2622
|
* Full constructor config including factory injections.
|
|
@@ -2665,6 +2645,17 @@ interface AIAdapterConstructorConfig<TBus extends ScopedBus<string>, TConnector
|
|
|
2665
2645
|
}
|
|
2666
2646
|
//#endregion
|
|
2667
2647
|
//#region adapters/core/src/agent/agent-connector-lifecycle-manager.d.ts
|
|
2648
|
+
/** Sanitized lifecycle diagnostic emitted after a replacement became primary. */
|
|
2649
|
+
interface ConnectorCleanupDiagnostic {
|
|
2650
|
+
/** Stable machine-readable failure category. */
|
|
2651
|
+
readonly code: 'previous-connector-cleanup-failed';
|
|
2652
|
+
/** Lifecycle stage whose cleanup failed. */
|
|
2653
|
+
readonly stage: 'swap-old-runtime';
|
|
2654
|
+
/** Agent owning the replacement connector. */
|
|
2655
|
+
readonly agentId: string;
|
|
2656
|
+
}
|
|
2657
|
+
/** Final async guard run after the replacement is ready but before it becomes primary. */
|
|
2658
|
+
type ConnectorSwapCommitGuard = () => void | Promise<void>;
|
|
2668
2659
|
/**
|
|
2669
2660
|
* Dependencies for connector lifecycle management.
|
|
2670
2661
|
*/
|
|
@@ -2681,20 +2672,24 @@ interface AgentConnectorLifecycleManagerConfig<TBus extends ScopedBus<string>, T
|
|
|
2681
2672
|
connectorFactory: (config: BaseAgentConnectorConfig<TBus> & {
|
|
2682
2673
|
adapterId: string;
|
|
2683
2674
|
}) => Promise<TConnector> | TConnector;
|
|
2675
|
+
/** Trusted host-local auth preparer shared by every connector generation. */
|
|
2676
|
+
prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus>;
|
|
2684
2677
|
/** Build onMessageSent callback for connector creation. */
|
|
2685
2678
|
createOnMessageSent: () => (handle: MessageHandle) => void;
|
|
2686
2679
|
/** Wire adapter-specific events on a connector instance. */
|
|
2687
2680
|
wireEvents: (connector: TConnector) => void | Promise<void>;
|
|
2688
2681
|
/** Emit idle lifecycle event on processing-state idle transitions. */
|
|
2689
2682
|
emitIdle: () => Promise<void>;
|
|
2690
|
-
/** Get current connector
|
|
2691
|
-
|
|
2692
|
-
/** Replace active connector
|
|
2693
|
-
|
|
2683
|
+
/** Get current connector plus its explicit client config lease. */
|
|
2684
|
+
getConnectorRuntime: () => ConnectorRuntimeHandle<TConnector>;
|
|
2685
|
+
/** Replace active connector and lease together on successful swap. */
|
|
2686
|
+
setConnectorRuntime: (runtime: ConnectorRuntimeHandle<TConnector>) => void;
|
|
2694
2687
|
/** Get runtime system prompt to preserve across swaps. */
|
|
2695
2688
|
getRuntimeSystemPrompt: () => SystemPrompt | undefined;
|
|
2696
2689
|
/** Store latest adapter session ID for enrichment after swaps. */
|
|
2697
2690
|
setLastKnownAdapterSessionId: (adapterSessionId: string | undefined) => void;
|
|
2691
|
+
/** Publish a sanitized cleanup diagnostic without exposing connector errors. */
|
|
2692
|
+
reportCleanupFailure: (diagnostic: ConnectorCleanupDiagnostic) => void | Promise<void>;
|
|
2698
2693
|
}
|
|
2699
2694
|
/**
|
|
2700
2695
|
* Manages connector lifecycle for AIAgent.
|
|
@@ -2725,448 +2720,432 @@ declare class AgentConnectorLifecycleManager<TBus extends ScopedBus<string>, TCo
|
|
|
2725
2720
|
*
|
|
2726
2721
|
* Uses create-before-close pattern with rollback to preserve availability.
|
|
2727
2722
|
* @param configOverrides - Optional runtime override fields
|
|
2723
|
+
* @param beforeCommit - Final guard after replacement initialization and before publication
|
|
2728
2724
|
*/
|
|
2729
|
-
swapConnector(configOverrides?: AgentConnectorConfigOverrides): Promise<void>;
|
|
2730
|
-
}
|
|
2731
|
-
//#endregion
|
|
2732
|
-
//#region adapters/core/src/agent/agent-lifecycle-emitter.d.ts
|
|
2733
|
-
/**
|
|
2734
|
-
* Dependencies for AgentLifecycleEmitter.
|
|
2735
|
-
*/
|
|
2736
|
-
interface AgentLifecycleEmitterConfig {
|
|
2737
|
-
/** Stable agent identifier for persistence updates. */
|
|
2738
|
-
agentId: string;
|
|
2739
|
-
/** Global bus for best-effort status updates. */
|
|
2740
|
-
globalBus: IMakaioBus;
|
|
2741
|
-
/** Emit callback for `agent.started`. */
|
|
2742
|
-
emitStarted: (payload: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>) => Promise<void>;
|
|
2743
|
-
/** Emit callback for `agent.complete`. */
|
|
2744
|
-
emitComplete: (payload: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>) => Promise<void>;
|
|
2745
|
-
/** Emit callback for `agent.session.closed`. */
|
|
2746
|
-
emitSessionClosed: (payload: {
|
|
2747
|
-
reason?: string;
|
|
2748
|
-
}) => Promise<void>;
|
|
2749
|
-
/** Hook executed before terminal completion emission. */
|
|
2750
|
-
onBeforeEmitCompletion: () => Promise<void>;
|
|
2751
|
-
/** Clear tool-call tracker entries on terminal outcomes. */
|
|
2752
|
-
clearToolCallTracker: () => void;
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* Stateful lifecycle emitter for AIAgent terminal/start/session events.
|
|
2756
|
-
*/
|
|
2757
|
-
declare class AgentLifecycleEmitter {
|
|
2758
|
-
/** Tracks whether session.closed has been emitted (emit only once). */
|
|
2759
|
-
private sessionClosedEmitted;
|
|
2760
|
-
/** Tracks whether agent.started has been emitted (lifecycle invariant). */
|
|
2761
|
-
private agentStartedEmitted;
|
|
2762
|
-
/** Tracks whether agent.complete has been emitted for the current turn. */
|
|
2763
|
-
private agentCompleteEmitted;
|
|
2764
|
-
/** Stashed error category consumed by the next emitCompletion call. */
|
|
2765
|
-
private pendingErrorCategory?;
|
|
2766
|
-
private readonly config;
|
|
2767
|
-
constructor(config: AgentLifecycleEmitterConfig);
|
|
2768
|
-
/**
|
|
2769
|
-
* Emit `agent.started` and reset per-turn lifecycle state.
|
|
2770
|
-
* @param event - Start payload without auto-enriched AgentContext fields
|
|
2771
|
-
*/
|
|
2772
|
-
emitStart(event: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId'>): Promise<void>;
|
|
2725
|
+
swapConnector(configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard): Promise<void>;
|
|
2773
2726
|
/**
|
|
2774
|
-
*
|
|
2775
|
-
*
|
|
2776
|
-
*
|
|
2777
|
-
*
|
|
2778
|
-
* on every turn (e.g., codex emits `thread_started` once per thread).
|
|
2727
|
+
* Build and materialize the replacement connector runtime.
|
|
2728
|
+
* @param currentConnector - Active connector whose runtime values provide defaults
|
|
2729
|
+
* @param configOverrides - Optional requested runtime changes
|
|
2730
|
+
* @returns Prepared replacement connector and auth lease
|
|
2779
2731
|
*/
|
|
2780
|
-
|
|
2732
|
+
private createReplacementRuntime;
|
|
2781
2733
|
/**
|
|
2782
|
-
*
|
|
2783
|
-
* @param
|
|
2734
|
+
* Wire and initialize a replacement, restoring the current wiring on failure.
|
|
2735
|
+
* @param newRuntime - Replacement connector and auth lease
|
|
2736
|
+
* @param oldWiringCleanups - Wiring still owned by the active connector
|
|
2737
|
+
* @param beforeCommit - Optional final publication guard
|
|
2738
|
+
* @returns Provider-confirmed session ID, when the replacement has one
|
|
2784
2739
|
*/
|
|
2785
|
-
|
|
2740
|
+
private initializeReplacement;
|
|
2786
2741
|
/**
|
|
2787
|
-
*
|
|
2788
|
-
* @param
|
|
2742
|
+
* Run superseded connector wiring cleanups without failing the committed swap.
|
|
2743
|
+
* @param cleanups - Previous connector wiring cleanups
|
|
2789
2744
|
*/
|
|
2790
|
-
|
|
2745
|
+
private runWiringCleanups;
|
|
2791
2746
|
/**
|
|
2792
|
-
*
|
|
2793
|
-
* @param
|
|
2747
|
+
* Close the superseded runtime and publish only a sanitized diagnostic on failure.
|
|
2748
|
+
* @param currentRuntime - Superseded connector and auth lease
|
|
2794
2749
|
*/
|
|
2795
|
-
|
|
2750
|
+
private closePreviousRuntime;
|
|
2796
2751
|
}
|
|
2797
2752
|
//#endregion
|
|
2798
|
-
//#region adapters/core/src/agent/agent
|
|
2799
|
-
interface AgentPayloadEventMetadata {
|
|
2800
|
-
clientId?: string;
|
|
2801
|
-
providerConfigId?: string;
|
|
2802
|
-
occurredAt?: number;
|
|
2803
|
-
}
|
|
2804
|
-
interface AgentPayloadEventFields extends AgentPayloadEventMetadata {
|
|
2805
|
-
messageId?: string;
|
|
2806
|
-
turnId?: string;
|
|
2807
|
-
sessionId?: string;
|
|
2808
|
-
}
|
|
2809
|
-
interface EmitGlobalOptions {
|
|
2810
|
-
includeEventMetadata?: boolean;
|
|
2811
|
-
}
|
|
2753
|
+
//#region adapters/core/src/agent/ai-agent.d.ts
|
|
2812
2754
|
/**
|
|
2813
|
-
*
|
|
2755
|
+
* Abstract base class for AI agents.
|
|
2756
|
+
*
|
|
2757
|
+
* Bridges adapter/agent bus subjects to connector sessions.
|
|
2758
|
+
* @typeParam TBus - The scoped bus type for this adapter
|
|
2759
|
+
* @typeParam TConnector - The connector type this agent wraps
|
|
2814
2760
|
*/
|
|
2815
|
-
|
|
2816
|
-
/**
|
|
2817
|
-
|
|
2818
|
-
/**
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
/**
|
|
2823
|
-
|
|
2824
|
-
/**
|
|
2825
|
-
|
|
2826
|
-
/**
|
|
2827
|
-
|
|
2828
|
-
/**
|
|
2829
|
-
|
|
2830
|
-
/**
|
|
2831
|
-
|
|
2832
|
-
/**
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
private readonly
|
|
2761
|
+
declare abstract class AIAgent<TBus extends ScopedBus<string> = ScopedBus<string>, TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>> {
|
|
2762
|
+
/** The underlying connector instance (created in init) */
|
|
2763
|
+
protected connector: TConnector;
|
|
2764
|
+
/** Connector and auth lease are replaced and released as one lifecycle unit. */
|
|
2765
|
+
private connectorRuntime;
|
|
2766
|
+
protected confirmedModel?: string;
|
|
2767
|
+
protected initialModel?: string;
|
|
2768
|
+
/** Cached adapterSessionId from the last connector that had a session — survives connector swaps. */
|
|
2769
|
+
private lastKnownAdapterSessionId?;
|
|
2770
|
+
/** Cleanup functions for bus subscriptions (stable, survive connector swap) */
|
|
2771
|
+
private busHandlerCleanups;
|
|
2772
|
+
/** Whether init() has been called */
|
|
2773
|
+
private initialized;
|
|
2774
|
+
/** Runtime system prompt captured from start/initialize, preserved across connector swaps. */
|
|
2775
|
+
private runtimeSystemPrompt?;
|
|
2776
|
+
/** Tracks message lifecycle and emits turn events (emission is lazy — safe as field initializer). */
|
|
2777
|
+
protected readonly lifecycleTracker: MessageLifecycleTracker;
|
|
2778
|
+
/** Tracks tool.use → tool.output correlation across adapters. */
|
|
2779
|
+
protected readonly toolCallTracker: ToolCallTracker;
|
|
2780
|
+
/** Event-focused helper for usage/tool/step emissions. */
|
|
2781
|
+
protected readonly eventBridge: AgentEventBridge;
|
|
2782
|
+
/** Shared turn pipeline for start/sendMessage paths. */
|
|
2783
|
+
private readonly turnExecutor;
|
|
2784
|
+
/** Runtime mutation helper for cwd/model change handlers. */
|
|
2785
|
+
private readonly runtimeMutationManager;
|
|
2786
|
+
/** Connector lifecycle helper for swap/wiring ownership. */
|
|
2787
|
+
private readonly connectorLifecycleManager;
|
|
2788
|
+
/** Serialized connector replacement and runtime-config publication owner. */
|
|
2789
|
+
private readonly connectorSwapCoordinator;
|
|
2790
|
+
/** Payload enrichment and global emission helper. */
|
|
2791
|
+
private readonly payloadEmitter;
|
|
2792
|
+
/** Stateful lifecycle emitter for start/complete/error/session.closed. */
|
|
2793
|
+
private readonly lifecycleEmitter;
|
|
2794
|
+
/** Validates structured output before public terminal results and lifecycle events resolve. */
|
|
2795
|
+
private readonly structuredOutputManager;
|
|
2796
|
+
/** Latest tracked message completion with agent-level terminal transforms applied. */
|
|
2797
|
+
private latestMessageCompletion?;
|
|
2798
|
+
/** Current content block index within the turn, reset on each turn start */
|
|
2799
|
+
private currentBlockIndex;
|
|
2840
2800
|
/**
|
|
2841
|
-
*
|
|
2842
|
-
*
|
|
2801
|
+
* Start mode for the next `emitStart()` call (consume-on-read).
|
|
2802
|
+
*
|
|
2803
|
+
* Set before dispatch; {@link emitStart} reads and clears the slot so
|
|
2804
|
+
* subsequent calls within the same dispatch (e.g. Copilot SDK sub-turns)
|
|
2805
|
+
* fall back to `'rotation'`. The `undefined` initial value is safe —
|
|
2806
|
+
* every first-start path sets the mode before the connector fires.
|
|
2843
2807
|
*/
|
|
2844
|
-
|
|
2808
|
+
private pendingStartMode;
|
|
2809
|
+
/** Normalized config with defaults applied */
|
|
2810
|
+
protected readonly config: SetRequired<AIAgentConfig<TBus, TConnector>, 'globalBus'>;
|
|
2811
|
+
/** Available models for context window lookup */
|
|
2812
|
+
protected readonly availableModels?: AIModel[];
|
|
2845
2813
|
/**
|
|
2846
|
-
*
|
|
2814
|
+
* Create an AIAgent instance.
|
|
2847
2815
|
*
|
|
2848
|
-
*
|
|
2849
|
-
*
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2816
|
+
* Note: Does NOT create the connector yet - call init() after construction.
|
|
2817
|
+
* @param config - Agent configuration
|
|
2818
|
+
*/
|
|
2819
|
+
constructor(config: AIAgentConfig<TBus, TConnector>);
|
|
2820
|
+
/**
|
|
2821
|
+
* Create the connector lifecycle collaborator bound to this agent instance.
|
|
2822
|
+
* @param emitGlobal - Enriched global event emitter
|
|
2823
|
+
* @param setLastKnownAdapterSessionId - Sink for the latest confirmed provider session
|
|
2824
|
+
* @returns Connector lifecycle manager for this agent
|
|
2825
|
+
*/
|
|
2826
|
+
private createConnectorLifecycleManager;
|
|
2827
|
+
private getEventMetadataDefaults;
|
|
2828
|
+
/** @returns Unique agent identifier */
|
|
2829
|
+
get agentId(): string;
|
|
2830
|
+
/** @returns Adapter instance identifier */
|
|
2831
|
+
get adapterId(): string;
|
|
2832
|
+
/** @returns Adapter type name (e.g., 'claude-code', 'gemini-sdk') */
|
|
2833
|
+
get adapterName(): string;
|
|
2834
|
+
/** @returns Adapter capabilities for runtime feature detection */
|
|
2835
|
+
get capabilities(): string[];
|
|
2836
|
+
/** @returns Native tools built into the adapter */
|
|
2837
|
+
get nativeTools(): string[];
|
|
2838
|
+
/** @returns Shared Makaio sessionId */
|
|
2839
|
+
get sessionId(): string | undefined;
|
|
2840
|
+
/** @returns Initial adapter session ID from config (may differ from connector's resolved session ID) */
|
|
2841
|
+
protected get adapterSessionId(): string | undefined;
|
|
2842
|
+
/** @returns Global bus for cross-namespace communication (defaulted in constructor) */
|
|
2843
|
+
protected get globalBus(): IMakaioBus;
|
|
2844
|
+
/**
|
|
2845
|
+
* Initialize the agent.
|
|
2853
2846
|
*
|
|
2854
|
-
*
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
2847
|
+
* Creates the connector via the abstract createConnector() method
|
|
2848
|
+
* and sets up handlers for agent.* subjects with agentId filtering.
|
|
2849
|
+
* @throws Error if already initialized
|
|
2850
|
+
*/
|
|
2851
|
+
init(): Promise<void>;
|
|
2852
|
+
/**
|
|
2853
|
+
* Emit `agent.started` with the pending start mode (consume-on-read).
|
|
2857
2854
|
*
|
|
2858
|
-
*
|
|
2859
|
-
*
|
|
2860
|
-
*
|
|
2861
|
-
* it optional.
|
|
2862
|
-
* @returns Confirmed adapter session ID or `undefined`
|
|
2855
|
+
* Reads and clears {@link pendingStartMode}; subsequent calls within
|
|
2856
|
+
* the same dispatch fall back to `'rotation'`.
|
|
2857
|
+
* @param event - Optional additional fields to merge into the payload
|
|
2863
2858
|
*/
|
|
2864
|
-
|
|
2859
|
+
protected emitStart(event?: Omit<AgentStarted, 'agentId' | 'adapterId' | 'adapterName' | 'adapterSessionId' | 'model' | 'cwd' | 'startMode'>): Promise<void>;
|
|
2865
2860
|
/**
|
|
2866
|
-
*
|
|
2867
|
-
*
|
|
2868
|
-
*
|
|
2869
|
-
*
|
|
2861
|
+
* Set the start mode for the next `emitStart()` invocation.
|
|
2862
|
+
*
|
|
2863
|
+
* Called by the turn executor or `initialize()` before dispatching to
|
|
2864
|
+
* the connector. The value is consumed (cleared) by the first
|
|
2865
|
+
* `emitStart()` call, enforcing the one-shot invariant.
|
|
2866
|
+
* @param mode - The start mode to embed in the next `agent.started` event
|
|
2870
2867
|
*/
|
|
2871
|
-
|
|
2868
|
+
setPendingStartMode(mode: StartMode): void;
|
|
2869
|
+
protected emitCompletion(result: Omit<z.infer<typeof AgentSchemas.complete>, keyof AgentContext>): Promise<void>;
|
|
2872
2870
|
/**
|
|
2873
|
-
*
|
|
2874
|
-
*
|
|
2875
|
-
* @param
|
|
2876
|
-
* @param options - Enrichment controls for optional analytics metadata defaults
|
|
2877
|
-
* @returns Enriched payload with agent context
|
|
2871
|
+
* Emit agent session closed event. Emits only once per session.
|
|
2872
|
+
* AIAdapter listens to cleanup agent and re-emit as AdapterSubjects.session.closed.
|
|
2873
|
+
* @param reason - Reason for session closure (e.g., 'aborted', 'closed')
|
|
2878
2874
|
*/
|
|
2879
|
-
|
|
2875
|
+
protected emitSessionClosed(reason?: string): void;
|
|
2880
2876
|
/**
|
|
2881
|
-
*
|
|
2882
|
-
* @param
|
|
2883
|
-
* @
|
|
2884
|
-
* @param options - Enrichment controls for optional analytics metadata defaults
|
|
2877
|
+
* Enrich a payload with agent context fields.
|
|
2878
|
+
* @param payload - The base payload to enrich
|
|
2879
|
+
* @returns Payload with AgentContext fields and optional messageId added
|
|
2885
2880
|
*/
|
|
2886
|
-
|
|
2881
|
+
protected enrichPayload<T extends object>(payload: T): Promise<T & AgentIdentity & {
|
|
2887
2882
|
messageId?: string;
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
/**
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
/**
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
/**
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
/** Persist provider context changes on agent config for sequential swaps. */
|
|
2952
|
-
setProviderContext: (providerContext: ProviderContext) => void;
|
|
2953
|
-
/** Persist reasoning effort changes on agent config for sequential swaps. */
|
|
2954
|
-
setReasoningEffort: (reasoningEffort: AIReasoningLevel$1 | undefined) => void;
|
|
2955
|
-
/** Persist MCP session context changes on agent config for sequential swaps. */
|
|
2956
|
-
setMcpSessionContext: (mcpSessionContext: McpRuntimeSessionContext | McpSessionContext | LedgerSessionContext | undefined) => void;
|
|
2957
|
-
/** Resolve supported reasoning levels for a model from the agent's available models. */
|
|
2958
|
-
resolveSupportedReasoningLevels: (model: string) => ReasoningLevelMap$1 | undefined;
|
|
2959
|
-
}
|
|
2960
|
-
//#endregion
|
|
2961
|
-
//#region adapters/core/src/agent/agent-runtime-mutation-manager.d.ts
|
|
2962
|
-
/**
|
|
2963
|
-
* Handles runtime mutation requests for AIAgent (cwd/model/credential changes).
|
|
2964
|
-
*/
|
|
2965
|
-
declare class AgentRuntimeMutationManager {
|
|
2966
|
-
private readonly agentId;
|
|
2967
|
-
private readonly sessionId?;
|
|
2968
|
-
private readonly globalBus;
|
|
2969
|
-
private readonly getConnector;
|
|
2970
|
-
private readonly swapConnector;
|
|
2971
|
-
private readonly emitCwdChanged;
|
|
2972
|
-
private readonly emitModelChanged;
|
|
2973
|
-
private readonly getProviderContext;
|
|
2974
|
-
private readonly setProviderContext;
|
|
2975
|
-
private readonly setReasoningEffort;
|
|
2976
|
-
private readonly setMcpSessionContext;
|
|
2977
|
-
private readonly resolveSupportedReasoningLevels;
|
|
2978
|
-
private readonly mcpServersMutationManager;
|
|
2979
|
-
private readonly credentialChangeSequencer;
|
|
2980
|
-
private stagedModelChange?;
|
|
2981
|
-
constructor(config: AgentRuntimeMutationManagerConfig);
|
|
2883
|
+
}>;
|
|
2884
|
+
/**
|
|
2885
|
+
* Emit to a global subject with automatic payload enrichment.
|
|
2886
|
+
* @param subject - The subject to emit to
|
|
2887
|
+
* @param payload - The payload (without AgentContext fields - they're added automatically)
|
|
2888
|
+
*/
|
|
2889
|
+
protected emitGlobal<S extends SubjectDefinition>(subject: S, payload: Omit<ExtractSubjectPayload<S>, keyof AgentContext> & {
|
|
2890
|
+
messageId?: string;
|
|
2891
|
+
}): Promise<void>;
|
|
2892
|
+
/**
|
|
2893
|
+
* Track usage and emit to global bus.
|
|
2894
|
+
* AIAdapter aggregates session totals from per-call usage events.
|
|
2895
|
+
* @param normalized - Normalized usage metrics from adapter-specific normalizer
|
|
2896
|
+
*/
|
|
2897
|
+
protected trackUsage(normalized: NormalizedCallUsage): Promise<void>;
|
|
2898
|
+
/**
|
|
2899
|
+
* Get context window size for a model.
|
|
2900
|
+
*
|
|
2901
|
+
* Looks up the context window size from availableModels based on model name.
|
|
2902
|
+
* @param modelName - Model name to look up (defaults to confirmedModel or initialModel)
|
|
2903
|
+
* @returns Context window size in tokens, or undefined if not found
|
|
2904
|
+
*/
|
|
2905
|
+
protected getContextWindowSize(modelName?: string): number | undefined;
|
|
2906
|
+
/**
|
|
2907
|
+
* Emit context window status for compression trigger decisions.
|
|
2908
|
+
*
|
|
2909
|
+
* Calculates fill percentage and warning level from raw metrics.
|
|
2910
|
+
* Called by subclasses after usage tracking with provider-specific metrics.
|
|
2911
|
+
* @param input - Raw metrics: currentTokens, maxTokens, optional cachedTokens
|
|
2912
|
+
*/
|
|
2913
|
+
protected emitContextWindowUpdate(input: ContextWindowInput): Promise<void>;
|
|
2914
|
+
/**
|
|
2915
|
+
* Emit a tool.use event for an explicitly identified originating message.
|
|
2916
|
+
* @param messageId - Message that owns the tool call
|
|
2917
|
+
* @param toolName - Name of the tool being invoked
|
|
2918
|
+
* @param args - Tool arguments
|
|
2919
|
+
* @param nativeId - Provider-native tool call identifier
|
|
2920
|
+
* @returns Correlation identifier used for the call
|
|
2921
|
+
*/
|
|
2922
|
+
protected emitToolUse(messageId: string, toolName: string, args?: Record<string, unknown>, nativeId?: string): Promise<string>;
|
|
2923
|
+
/**
|
|
2924
|
+
* Emit a tool.output event for an explicitly identified originating message.
|
|
2925
|
+
* @param messageId - Message that owns the tool call
|
|
2926
|
+
* @param output - Tool output content
|
|
2927
|
+
* @param hints - Provider correlation hints
|
|
2928
|
+
* @returns Resolved tool-call metadata
|
|
2929
|
+
*/
|
|
2930
|
+
protected emitToolOutput(messageId: string, output: string, hints: ResolveHints): Promise<ToolOutputResult>;
|
|
2931
|
+
/**
|
|
2932
|
+
* Emit step.started event with automatic block index management.
|
|
2933
|
+
* Call this when a content block begins processing.
|
|
2934
|
+
* @param stepType - The type of step (text, reasoning, tool_use)
|
|
2935
|
+
* @param blockData - Optional metadata for the block (e.g., toolName for tool_use)
|
|
2936
|
+
* @param content - Optional content for the step (e.g., tool_call block for tool_use)
|
|
2937
|
+
*/
|
|
2938
|
+
protected emitStepStarted(stepType: StepType, blockData?: BlockData, content?: SessionMessageBlock): Promise<void>;
|
|
2939
|
+
/**
|
|
2940
|
+
* Emit step.finished event with content and increment block index.
|
|
2941
|
+
* Call this when a content block completes processing.
|
|
2942
|
+
* @param stepType - The type of step that finished
|
|
2943
|
+
* @param content - The complete content of the step (text, reasoning, tool_call, or tool_output)
|
|
2944
|
+
*/
|
|
2945
|
+
protected emitStepFinished(stepType: StepType, content: SessionMessageBlock): Promise<void>;
|
|
2982
2946
|
/**
|
|
2983
|
-
*
|
|
2984
|
-
* @
|
|
2985
|
-
* @returns CWD mutation response payload
|
|
2947
|
+
* Get the current block index (for adapters that need to track it externally).
|
|
2948
|
+
* @returns Current block index within the turn
|
|
2986
2949
|
*/
|
|
2987
|
-
|
|
2950
|
+
protected getBlockIndex(): number;
|
|
2988
2951
|
/**
|
|
2989
|
-
*
|
|
2990
|
-
*
|
|
2991
|
-
* Staged changes are accepted while a turn is active, but they must not touch
|
|
2992
|
-
* the live connector until the next turn boundary. The turn executor calls
|
|
2993
|
-
* this before handing a new message to the connector, when the connector is
|
|
2994
|
-
* expected to be idle.
|
|
2952
|
+
* Increment block index (for adapters using SDK-provided indices).
|
|
2953
|
+
* Call after emitting step.finished if managing index externally.
|
|
2995
2954
|
*/
|
|
2996
|
-
|
|
2955
|
+
protected incrementBlockIndex(): void;
|
|
2997
2956
|
/**
|
|
2998
|
-
* Handle
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
2957
|
+
* Handle agent.sendMessage request.
|
|
2958
|
+
* The filter has already been applied at subscription time - this method
|
|
2959
|
+
* only receives messages intended for this agent.
|
|
2960
|
+
* Runs PreUserMessage hooks before delegating to the connector's sendMessage method.
|
|
2961
|
+
* Uses sessionContext signals to decide between native resume and fresh with history.
|
|
2962
|
+
* HookAbortError propagates to caller (session layer handles lifecycle).
|
|
2963
|
+
* Subclasses can override for custom handling.
|
|
2964
|
+
* @param ctx - Request context with payload and response methods
|
|
3001
2965
|
*/
|
|
3002
|
-
|
|
2966
|
+
protected sendMessage(ctx: RequestContext<SendMessageRequestPayload, SendMessageResponsePayload>): Promise<void>;
|
|
2967
|
+
/**
|
|
2968
|
+
* Handle agent.interrupt request.
|
|
2969
|
+
* Delegates to the connector's native interrupt behavior.
|
|
2970
|
+
* @param ctx - Request context with interrupt payload
|
|
2971
|
+
*/
|
|
2972
|
+
private handleInterrupt;
|
|
2973
|
+
/**
|
|
2974
|
+
* Register a cleanup function for connector wiring.
|
|
2975
|
+
* These cleanups are cleared on connector swap but preserved across bus handler changes.
|
|
2976
|
+
* @param cleanup - Cleanup function to register
|
|
2977
|
+
*/
|
|
2978
|
+
protected addConnectorWiringCleanup(cleanup: () => void): void;
|
|
2979
|
+
/**
|
|
2980
|
+
* Registers a cleanup function for a global bus subscription.
|
|
2981
|
+
* These survive connector swaps and are cleaned up in close().
|
|
2982
|
+
* @param cleanup - Function to unsubscribe from the bus
|
|
2983
|
+
*/
|
|
2984
|
+
protected addBusHandlerCleanup(cleanup: () => void): void;
|
|
3003
2985
|
/**
|
|
3004
|
-
*
|
|
2986
|
+
* Replace the current connector with a fresh one.
|
|
3005
2987
|
*
|
|
3006
|
-
*
|
|
3007
|
-
*
|
|
2988
|
+
* Serializes the complete create-before-close pattern with rollback for safety:
|
|
2989
|
+
* 1. Create new connector first (old connector still alive)
|
|
2990
|
+
* 2. Wire and initialize the replacement (accumulate cleanups separately)
|
|
2991
|
+
* 3. Run the final guard and commit any selected managed account
|
|
2992
|
+
* 4. Synchronously publish the ready replacement, then close the old runtime
|
|
2993
|
+
* 5. On any pre-publication failure: close the replacement, restore old wiring, and roll back account selection
|
|
3008
2994
|
*
|
|
3009
|
-
*
|
|
3010
|
-
*
|
|
3011
|
-
*
|
|
3012
|
-
*
|
|
3013
|
-
* @param
|
|
3014
|
-
* @
|
|
2995
|
+
* This ensures the agent always has a working connector, even if factory or wiring fails.
|
|
2996
|
+
*
|
|
2997
|
+
* Preserves runtime overrides across sequential swaps by using current connector values
|
|
2998
|
+
* as baseline for non-overridden fields.
|
|
2999
|
+
* @param configOverrides - Optional config overrides (e.g., new cwd, model)
|
|
3000
|
+
* @param beforeCommit - Optional guard executed before replacing the active connector
|
|
3001
|
+
* @throws Error if connector is currently processing a turn
|
|
3015
3002
|
*/
|
|
3016
|
-
|
|
3003
|
+
swapConnector(configOverrides?: AgentConnectorConfigOverrides, beforeCommit?: ConnectorSwapCommitGuard): Promise<void>;
|
|
3017
3004
|
/**
|
|
3018
|
-
*
|
|
3019
|
-
*
|
|
3020
|
-
* @
|
|
3021
|
-
*
|
|
3022
|
-
* @param
|
|
3023
|
-
* @returns
|
|
3005
|
+
* Build config factory input from agent config with optional overrides.
|
|
3006
|
+
*
|
|
3007
|
+
* Delegates to {@link buildConfigFactoryInput} with live connector-derived
|
|
3008
|
+
* values (reasoning effort) and the agent's error sink.
|
|
3009
|
+
* @param overrides - Optional field overrides (e.g., cwd, model, adapterSessionId)
|
|
3010
|
+
* @returns ConfigFactoryInput ready for config factory
|
|
3024
3011
|
*/
|
|
3025
|
-
private
|
|
3012
|
+
private buildConfigInput;
|
|
3026
3013
|
/**
|
|
3027
|
-
*
|
|
3014
|
+
* Create the onMessageSent callback for connector factories.
|
|
3028
3015
|
*
|
|
3029
|
-
*
|
|
3030
|
-
*
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
3016
|
+
* Returns a callback that emits user_message.sent events to the global bus.
|
|
3017
|
+
* @returns Callback function for connector config
|
|
3018
|
+
*/
|
|
3019
|
+
private createOnMessageSent;
|
|
3020
|
+
/**
|
|
3021
|
+
* Wire adapter-specific connector events.
|
|
3022
|
+
* Called automatically during init() and connector swap.
|
|
3023
|
+
* Subclasses implement this to set up their event mappings.
|
|
3024
|
+
* @param connector - Connector instance to wire
|
|
3025
|
+
*/
|
|
3026
|
+
protected abstract wireEvents(connector: TConnector): void | Promise<void>;
|
|
3027
|
+
/**
|
|
3028
|
+
* Subscribe to a connector subject and register its cleanup as connector wiring.
|
|
3029
|
+
*
|
|
3030
|
+
* Use this in adapter `wireEvents()` implementations so connector swaps can
|
|
3031
|
+
* remove old listeners before rewiring the new connector.
|
|
3032
|
+
* @param connector - Connector instance to subscribe on
|
|
3033
|
+
* @param subject - Subject definition to subscribe to
|
|
3034
|
+
* @param handler - Subject handler
|
|
3035
|
+
* @param options - Optional bus subscription options
|
|
3036
3036
|
*/
|
|
3037
|
-
|
|
3037
|
+
protected subscribeConnector<Subject extends ScopedSubjectDefinition<TConnector extends AIAgentConnector<infer TBus> ? TBus['namespace'] : never>>(connector: TConnector, subject: Subject, handler: HandlerForSubjectDefinition<Subject>, options?: OnOptions): void;
|
|
3038
3038
|
/**
|
|
3039
|
-
*
|
|
3039
|
+
* Clean up resources and emit session closed event.
|
|
3040
3040
|
*
|
|
3041
|
-
*
|
|
3042
|
-
*
|
|
3043
|
-
*
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
*
|
|
3050
|
-
* @returns The
|
|
3051
|
-
*/
|
|
3052
|
-
private
|
|
3053
|
-
/**
|
|
3054
|
-
*
|
|
3041
|
+
* Emits session.closed event (once per session) unless explicitly suppressed,
|
|
3042
|
+
* then unsubscribes from all bus handlers and aborts the connector if available.
|
|
3043
|
+
* @param options - Cleanup options; ephemeral agents suppress session-close lifecycle events because they never join a session.
|
|
3044
|
+
*/
|
|
3045
|
+
close(options?: {
|
|
3046
|
+
emitSessionClosed?: boolean;
|
|
3047
|
+
}): Promise<void>;
|
|
3048
|
+
/**
|
|
3049
|
+
* Ensure the connector is initialized, throwing if not.
|
|
3050
|
+
* @returns The initialized connector instance
|
|
3051
|
+
*/
|
|
3052
|
+
private ensureConnector;
|
|
3053
|
+
/**
|
|
3054
|
+
* Determine whether to use native session resume (SDK manages history) or
|
|
3055
|
+
* fresh-with-history (new session, injected messageHistory).
|
|
3056
|
+
* @param sessionContext - Context signals from SessionOrchestrator
|
|
3057
|
+
* @returns true if native resume should be used
|
|
3058
|
+
*/
|
|
3059
|
+
protected shouldUseNativeResume(sessionContext?: SessionContext): boolean;
|
|
3060
|
+
/**
|
|
3061
|
+
* Whether this adapter supports native session resume. Override in concrete agents.
|
|
3062
|
+
* @returns true if native resume is supported
|
|
3063
|
+
*/
|
|
3064
|
+
protected supportsNativeResume(): boolean;
|
|
3065
|
+
/**
|
|
3066
|
+
* Whether this adapter supports provider-native session fork.
|
|
3067
|
+
* Override in concrete agents that can branch from an existing provider session.
|
|
3068
|
+
* @returns true if native fork is supported
|
|
3069
|
+
*/
|
|
3070
|
+
protected supportsNativeFork(): boolean;
|
|
3071
|
+
/**
|
|
3072
|
+
* Start the agent with an initial message.
|
|
3055
3073
|
*
|
|
3056
|
-
*
|
|
3057
|
-
*
|
|
3058
|
-
*
|
|
3059
|
-
* @param
|
|
3060
|
-
* @param
|
|
3061
|
-
* @
|
|
3062
|
-
|
|
3074
|
+
* Ensures the agent is initialized (idempotent), runs PreUserMessage hooks,
|
|
3075
|
+
* and uses sessionContext signals to decide between native resume and fresh
|
|
3076
|
+
* with history. HookAbortError propagates to caller.
|
|
3077
|
+
* @param message - User message (normalized or unnormalized)
|
|
3078
|
+
* @param options - Optional start options (e.g., delivery mode, sessionContext)
|
|
3079
|
+
* @returns Session ID, agent ID, and message handle for tracking
|
|
3080
|
+
*/
|
|
3081
|
+
start(message: NormalizedMessageInput | MessageInput, options?: StartAgentOptions): Promise<AgentStartResult>;
|
|
3082
|
+
/**
|
|
3083
|
+
* Initialize idle (no message). Returns confirmed adapter session ID or `undefined`
|
|
3084
|
+
* when the provider has not yet confirmed (idle fork sessions).
|
|
3085
|
+
* @param options - Optional initialization options (system prompt, sessionContext)
|
|
3086
|
+
* @returns Confirmed adapter session ID, or `undefined` for unconfirmed fork sessions.
|
|
3063
3087
|
*/
|
|
3064
|
-
|
|
3088
|
+
initialize(options?: StartAgentOptions): Promise<string | undefined>;
|
|
3089
|
+
protected onBeforeEmitCompletion(): Promise<void>;
|
|
3090
|
+
protected onMessageHandle(messageHandle: MessageHandle, turnId?: string): Promise<void>;
|
|
3065
3091
|
/**
|
|
3066
|
-
*
|
|
3092
|
+
* Abort the agent immediately (panic mode).
|
|
3093
|
+
* Triggers AbortController which may cause provider errors.
|
|
3094
|
+
* Use close() for graceful shutdown instead.
|
|
3067
3095
|
*
|
|
3068
|
-
*
|
|
3069
|
-
*
|
|
3070
|
-
*
|
|
3071
|
-
* @param current - Persisted agent provider context
|
|
3072
|
-
* @param next - Incoming provider context from the mutation request
|
|
3073
|
-
* @returns True when the effective provider configuration changed
|
|
3096
|
+
* Emits session.closed event (once per session) then delegates
|
|
3097
|
+
* to the underlying connector's abort method.
|
|
3098
|
+
* @throws Error if connector is not initialized
|
|
3074
3099
|
*/
|
|
3075
|
-
|
|
3100
|
+
abort(): void;
|
|
3076
3101
|
/**
|
|
3077
|
-
*
|
|
3078
|
-
*
|
|
3079
|
-
*
|
|
3080
|
-
* @returns
|
|
3102
|
+
* Get session ID, waiting for provider to generate it if not yet available.
|
|
3103
|
+
*
|
|
3104
|
+
* Delegates to the underlying connector's getSessionId method.
|
|
3105
|
+
* @returns Session ID from provider
|
|
3106
|
+
* @throws Error if connector is not initialized
|
|
3081
3107
|
*/
|
|
3082
|
-
|
|
3108
|
+
getAdapterSessionId(): Promise<string>;
|
|
3083
3109
|
/**
|
|
3084
|
-
*
|
|
3110
|
+
* Complete the agent session by waiting for all messages to finish.
|
|
3085
3111
|
*
|
|
3086
|
-
*
|
|
3087
|
-
*
|
|
3088
|
-
*
|
|
3089
|
-
*
|
|
3090
|
-
* 3. Swaps the connector with updated providerContext (forces re-resolution)
|
|
3091
|
-
* @param payload - Credential change request payload
|
|
3092
|
-
* @returns Success/failure result
|
|
3112
|
+
* Waits for the connector to finish, then returns the agent-level terminal
|
|
3113
|
+
* result so structured-output transforms are reflected in direct callers.
|
|
3114
|
+
* @returns Last message result or null if no messages processed
|
|
3115
|
+
* @throws Error if connector is not initialized
|
|
3093
3116
|
*/
|
|
3094
|
-
|
|
3117
|
+
complete(): Promise<MessageResult | null>;
|
|
3095
3118
|
/**
|
|
3096
|
-
*
|
|
3097
|
-
* @param
|
|
3119
|
+
* Creates a type-safe event mapping from connector events to scoped subjects or handlers.
|
|
3120
|
+
* @param sourceSubject - The connector subject to subscribe to
|
|
3121
|
+
* @param discriminator - The discriminator key within the message (e.g., 'type')
|
|
3122
|
+
* @param handlers - Map of discriminator values to target subjects or handler functions
|
|
3123
|
+
* @param nestedMessageProp - Property containing the discriminated union (e.g., 'msg'), or undefined for top-level
|
|
3124
|
+
* @returns Unsubscribe function for the connector event mapping subscription
|
|
3098
3125
|
*/
|
|
3099
|
-
|
|
3126
|
+
protected createConnectorEventMapping<TSourceSubject extends ScopedSubjectDefinition<TConnector extends AIAgentConnector<infer TBus> ? TBus['namespace'] : never>, TNestedMessageProp extends keyof TSourceSubject['$meta']['payload'] | undefined = undefined, TMessage = (TNestedMessageProp extends keyof TSourceSubject['$meta']['payload'] ? TSourceSubject['$meta']['payload'][TNestedMessageProp] : TSourceSubject['$meta']['payload']), TDiscriminator extends DiscriminatorKeys<TMessage> = DiscriminatorKeys<TMessage>>(sourceSubject: TSourceSubject, discriminator: TDiscriminator, handlers: ConnectorEventHandlers<TMessage, TDiscriminator>, nestedMessageProp?: TNestedMessageProp): () => void;
|
|
3100
3127
|
}
|
|
3101
3128
|
//#endregion
|
|
3102
|
-
//#region adapters/core/src/
|
|
3103
|
-
/**
|
|
3104
|
-
* Utilities for identifying and extracting target information from `mcp_call`
|
|
3105
|
-
* tool invocations.
|
|
3106
|
-
*
|
|
3107
|
-
* The `mcp_call` meta-tool carries its real target as the `tool` field in the
|
|
3108
|
-
* parsed JSON arguments. These helpers centralise that extraction logic so
|
|
3109
|
-
* every consumer (ledger, event bridge, analytics) uses a single, tested path.
|
|
3110
|
-
* @packageDocumentation
|
|
3111
|
-
*/
|
|
3112
|
-
/**
|
|
3113
|
-
* Extract the target MCP tool name from parsed `mcp_call` arguments.
|
|
3114
|
-
*
|
|
3115
|
-
* Conforms to the `mcp_call` input schema which defines `{ tool: z.string() }`.
|
|
3116
|
-
* Returns `undefined` for any non-conformant argument shape so callers can
|
|
3117
|
-
* skip processing without throwing.
|
|
3118
|
-
* @param args - Parsed JSON arguments object from the tool call
|
|
3119
|
-
* @returns The namespaced target tool name, or `undefined` if not conformant
|
|
3120
|
-
*/
|
|
3121
|
-
declare function extractMcpCallTarget(args: Record<string, unknown>): string | undefined;
|
|
3122
|
-
/**
|
|
3123
|
-
* Check whether a tool call name refers to the `mcp_call` meta-tool.
|
|
3124
|
-
*
|
|
3125
|
-
* Uses the canonical {@link MCP_CALL_TOOL_NAME} constant so the comparison
|
|
3126
|
-
* stays in sync with the toolset definition automatically.
|
|
3127
|
-
*
|
|
3128
|
-
* Callers are responsible for stripping provider-specific prefixes before
|
|
3129
|
-
* calling this function (e.g., Gemini's `default_api.` prefix must be
|
|
3130
|
-
* removed at the call site — see `execute-tool-calls.ts` normalizedToolName).
|
|
3131
|
-
* @param toolName - Normalized tool name from the tool call
|
|
3132
|
-
* @returns `true` if this is an `mcp_call` invocation
|
|
3133
|
-
*/
|
|
3134
|
-
declare function isMcpCallTool(toolName: string): boolean;
|
|
3135
|
-
//#endregion
|
|
3136
|
-
//#region adapters/core/src/agent/request-correlation.d.ts
|
|
3137
|
-
/** Exact Factory Gateway headers accepted by its content-free usage boundary. */
|
|
3138
|
-
declare const FactoryUsageCorrelationHeaders: {
|
|
3139
|
-
readonly sessionId: "x-factory-session-id";
|
|
3140
|
-
readonly turnId: "x-factory-turn-id";
|
|
3141
|
-
readonly messageId: "x-factory-message-id";
|
|
3142
|
-
readonly llmCallId: "x-factory-llm-call-id";
|
|
3143
|
-
readonly executionId: "x-factory-execution-id";
|
|
3144
|
-
readonly frameId: "x-factory-frame-id";
|
|
3145
|
-
};
|
|
3146
|
-
type ProviderRequestCorrelation = RequestCorrelationContext & {
|
|
3147
|
-
llmCallId: string;
|
|
3148
|
-
};
|
|
3149
|
-
/**
|
|
3150
|
-
* Bind caller correlation to identifiers owned by the active runtime request.
|
|
3151
|
-
* Runtime values always win, preventing stale or spoofed session/message IDs.
|
|
3152
|
-
* @param context - Optional orchestrator-supplied workflow correlation
|
|
3153
|
-
* @param runtime - IDs known by the connector for this concrete API request
|
|
3154
|
-
* @returns Fully bound correlation including one LLM-call ID
|
|
3155
|
-
*/
|
|
3156
|
-
declare function bindProviderRequestCorrelation(context: RequestCorrelationContext | undefined, runtime: {
|
|
3157
|
-
sessionId?: string;
|
|
3158
|
-
messageId: string;
|
|
3159
|
-
llmCallId: string;
|
|
3160
|
-
}): ProviderRequestCorrelation;
|
|
3129
|
+
//#region adapters/core/src/factory/adapter-context.d.ts
|
|
3161
3130
|
/**
|
|
3162
|
-
*
|
|
3131
|
+
* Context provided to adapter implementations.
|
|
3163
3132
|
*
|
|
3164
|
-
*
|
|
3165
|
-
*
|
|
3166
|
-
*
|
|
3167
|
-
* @returns Header record accepted by the Factory Gateway usage boundary
|
|
3133
|
+
* Contains shared infrastructure and configuration that all adapters need:
|
|
3134
|
+
* - Adapter name and capabilities from config
|
|
3135
|
+
* - Local event bus for emitting events
|
|
3168
3136
|
*/
|
|
3169
|
-
|
|
3137
|
+
interface AIAdapterContext<Scope extends ScopedBus<string>> {
|
|
3138
|
+
/** Unique adapter instance identifier. */
|
|
3139
|
+
adapterId: string;
|
|
3140
|
+
/** Unique adapter name (kebab-case). */
|
|
3141
|
+
name: string;
|
|
3142
|
+
/** Adapter capabilities (unparsed). Use parseAIAdapterCapabilities() to parse. */
|
|
3143
|
+
capabilities: AIAdapterCapability[];
|
|
3144
|
+
/** Scoped bus for adapter-level events. */
|
|
3145
|
+
adapterBus: Scope;
|
|
3146
|
+
/** Global event bus. */
|
|
3147
|
+
globalBus: IMakaioBus;
|
|
3148
|
+
}
|
|
3170
3149
|
//#endregion
|
|
3171
3150
|
//#region adapters/core/src/adapter/ai-adapter.d.ts
|
|
3172
3151
|
/**
|
|
@@ -3219,6 +3198,8 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
|
|
|
3219
3198
|
protected platformDefaults?: PlatformDefaults;
|
|
3220
3199
|
/** Provider definitions for model lookup. Injected by runtime. */
|
|
3221
3200
|
protected readonly definitionProviders: readonly AdapterProviderDefinition[];
|
|
3201
|
+
/** Trusted host-local normalized auth preparation strategy. */
|
|
3202
|
+
protected readonly prepareAuthRuntime?: AdapterAuthRuntimePreparer<TBus>;
|
|
3222
3203
|
protected agentFactory: (agentConfig: AIAgentConfig<TBus, TConnector>) => TAgent;
|
|
3223
3204
|
/** Config factory - transforms partial input into full adapter-specific config (includes adapterId) */
|
|
3224
3205
|
protected configFactory: (input: ConfigFactoryInput<TBus>) => Promise<BaseAgentConnectorConfig<TBus> & {
|
|
@@ -3230,7 +3211,6 @@ declare abstract class AIAdapter<TBus extends ScopedBus<string> = ScopedBus<stri
|
|
|
3230
3211
|
}) => TConnector | Promise<TConnector>;
|
|
3231
3212
|
/**
|
|
3232
3213
|
* Create a new AIAdapter instance.
|
|
3233
|
-
* Constructor is synchronous - stores config only. Call init() to complete setup.
|
|
3234
3214
|
* @param config - Adapter configuration
|
|
3235
3215
|
*/
|
|
3236
3216
|
protected constructor(config: AIAdapterConstructorConfig<TBus, TConnector, TAgent>);
|
|
@@ -3510,9 +3490,11 @@ interface CreateConformanceTestConfigOptions {
|
|
|
3510
3490
|
* Options for creating test agent instances.
|
|
3511
3491
|
* Omits 'bus' (provided by test config) and makes 'adapterName'/'agentId' optional (factories provide defaults).
|
|
3512
3492
|
*/
|
|
3513
|
-
type CreateTestAgentOptions = Omit<BaseAgentConnectorConfig, 'bus' | 'adapterName' | 'model'> & {
|
|
3493
|
+
type CreateTestAgentOptions = Omit<BaseAgentConnectorConfig, 'bus' | 'agentId' | 'adapterName' | 'model' | 'cwd' | 'providerContext'> & {
|
|
3494
|
+
agentId?: string;
|
|
3514
3495
|
adapterName?: string;
|
|
3515
|
-
model?: string;
|
|
3496
|
+
model?: string;
|
|
3497
|
+
cwd?: string; /** Override the default test provider context when testing endpoint/credential behavior. */
|
|
3516
3498
|
providerContext?: ProviderContext;
|
|
3517
3499
|
};
|
|
3518
3500
|
interface ConformanceTestConfig<TBus extends ScopedBus<string> = ScopedBus<string>, TConnector extends AIAgentConnector<TBus> = AIAgentConnector<TBus>, TAgent extends AIAgent<TBus, TConnector> = AIAgent<TBus, TConnector>> {
|
|
@@ -3791,7 +3773,7 @@ interface ConformanceTestConfig<TBus extends ScopedBus<string> = ScopedBus<strin
|
|
|
3791
3773
|
* Unresolved provider context for the test provider.
|
|
3792
3774
|
*
|
|
3793
3775
|
* Contains credential refs (e.g. `env:ANTHROPIC_API_KEY`) built from the test
|
|
3794
|
-
* provider definition's
|
|
3776
|
+
* provider definition's explicit auth method source hints. Used by orchestration tests that
|
|
3795
3777
|
* call `startAgent` directly (bypassing the conformance `createConnector` path
|
|
3796
3778
|
* where `resolveTestConfig` handles credential ref building).
|
|
3797
3779
|
*
|
|
@@ -3809,6 +3791,40 @@ interface ConformanceTestConfig<TBus extends ScopedBus<string> = ScopedBus<strin
|
|
|
3809
3791
|
cleanup?: () => Promise<void> | void;
|
|
3810
3792
|
}
|
|
3811
3793
|
//#endregion
|
|
3794
|
+
//#region adapters/core/src/testing/conformance-connector-runtime-registry.d.ts
|
|
3795
|
+
/**
|
|
3796
|
+
* Own every connector runtime created by one conformance test configuration.
|
|
3797
|
+
*
|
|
3798
|
+
* The registry routes connector creation through the same normalized auth,
|
|
3799
|
+
* binary, and client-config lease path as production. It replaces the public
|
|
3800
|
+
* connector `close()` method with an idempotent managed close, so a test that
|
|
3801
|
+
* closes its connector releases the lease immediately while `closeAll()` can
|
|
3802
|
+
* still clean up abandoned connectors at suite teardown.
|
|
3803
|
+
*/
|
|
3804
|
+
declare class ConformanceConnectorRuntimeRegistry<TBus extends ScopedBus<string>, TConnector extends AIAgentConnector<TBus>> {
|
|
3805
|
+
private readonly runtimes;
|
|
3806
|
+
/**
|
|
3807
|
+
* Create a connector through the production runtime preparation seam.
|
|
3808
|
+
* @param options - Bound config and adapter connector factory
|
|
3809
|
+
* @returns Managed connector with lease-aware idempotent `close()`
|
|
3810
|
+
*/
|
|
3811
|
+
create<TConfig extends BaseAgentConnectorConfig<TBus>>(options: CreateConnectorRuntimeOptions<TBus, TConnector, TConfig>): Promise<TConnector>;
|
|
3812
|
+
/**
|
|
3813
|
+
* Close every connector still owned by this configuration.
|
|
3814
|
+
* @throws The single close failure, or an AggregateError containing all failures
|
|
3815
|
+
*/
|
|
3816
|
+
closeAll(): Promise<void>;
|
|
3817
|
+
}
|
|
3818
|
+
//#endregion
|
|
3819
|
+
//#region adapters/core/src/testing/provider-context.d.ts
|
|
3820
|
+
/**
|
|
3821
|
+
* Build a resolved provider context that deliberately requires no authentication.
|
|
3822
|
+
* @param providerConfigId - Provider config identity for the test
|
|
3823
|
+
* @param definitionId - Provider definition identity for the test
|
|
3824
|
+
* @returns Fresh normalized no-auth provider context
|
|
3825
|
+
*/
|
|
3826
|
+
declare function createNoAuthTestProviderContext(providerConfigId?: string, definitionId?: string): ProviderContext;
|
|
3827
|
+
//#endregion
|
|
3812
3828
|
//#region adapters/core/src/session/utilities.d.ts
|
|
3813
3829
|
/**
|
|
3814
3830
|
* Manages session lifecycle and abort handling.
|
|
@@ -4516,4 +4532,4 @@ declare const ToolCompletedEventSchema: z.ZodObject<{
|
|
|
4516
4532
|
type ToolStartedEvent = z.infer<typeof ToolStartedEventSchema>;
|
|
4517
4533
|
type ToolCompletedEvent = z.infer<typeof ToolCompletedEventSchema>;
|
|
4518
4534
|
//#endregion
|
|
4519
|
-
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, FactoryUsageCorrelationHeaders, 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 ProviderRequestCorrelation, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, SESSION_CLOSED_QUEUE_ERROR, 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, bindProviderRequestCorrelation, buildFactoryUsageCorrelationHeaders, cleanEnvForAdapter, createAdapterNamespace, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, rejectQueuedHandles, resolveConformanceTestPreset, resolveDisabledNativeTools,
|
|
4535
|
+
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, ConformanceConnectorRuntimeRegistry, 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, FactoryUsageCorrelationHeaders, 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 ProviderRequestCorrelation, type QueueableTurn, type ReasoningLevelMap, type ResolveConformanceTestPresetOptions, type ResolveHints, type ResolvedConformanceTestPreset, SESSION_CLOSED_QUEUE_ERROR, 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, bindProviderRequestCorrelation, buildFactoryUsageCorrelationHeaders, cleanEnvForAdapter, createAdapterNamespace, createNoAuthTestProviderContext, createTestProviderContext, createToolApprovalHandler, defineDiscriminatedHandlers, defineDiscriminatedHandlersSync, extractMcpCallTarget, formatContextBlockAsText, formatContextBlocksAsText, formatMessageHistoryAsTranscript, isMcpCallTool, isTextLikeMimeType, markCompletedWithFinalResult, mergeScopedToolApproval, normalizeEnvValue, normalizeMessageInput, normalizeMimeType, parseAIAdapterCapabilities, processDiscriminatedItems, processDiscriminatedItemsSync, processQueueMessages, registerAgentBusHandlers, registerMemoryImportCursorStorage, rejectQueuedHandles, resolveConformanceTestPreset, resolveDisabledNativeTools, resolveRequiredSessionId, resolveTestConfig, safeJsonStringify, serializeBlockToText, serializeTurnContext, toImportSegment };
|