@makaio/framework 1.0.0-dev-1783282710723 → 1.0.0-dev-1783355411417
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.makaio-build.json +2 -2
- package/dist/adapter-BRxCc72E.mjs +1 -0
- package/dist/adapters/index.d.mts +11 -2
- package/dist/adapters/index.mjs +1 -1
- package/dist/adapters/node.d.mts +1 -1
- package/dist/{base-orchestrator-Cw0vpNgB.d.mts → base-orchestrator-BNysGvaM.d.mts} +70 -2
- package/dist/bus/index.mjs +1 -1
- package/dist/{client-BcfR-LJC.mjs → client-BgUjVbXX.mjs} +1 -1
- package/dist/contracts/adapter/index.d.mts +1 -1
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/artifact/index.d.mts +1 -1
- package/dist/contracts/client/index.d.mts +1 -1
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +24 -24
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/session/index.d.mts +3 -3
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{definition-DFcxkf2i.d.mts → definition-b9jyJqPD.d.mts} +1 -1
- package/dist/drizzle/0021_m_mr8e1j84.sql +3 -0
- package/dist/drizzle/0022_m_mr8i4ky3.sql +43 -0
- package/dist/drizzle/meta/_journal.json +14 -0
- package/dist/{handler-2bPhRn0u.mjs → handler-BFNvtv5t.mjs} +1 -1
- package/dist/handlers-v47Gbsr1.mjs +57 -0
- package/dist/hooks/index.d.mts +8 -0
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-CTEsbp9H.d.mts → index-31vR1sxk.d.mts} +31 -13
- package/dist/{index-9b2_jXxq.d.mts → index-3J0HZlPH.d.mts} +372 -87
- package/dist/{index-Bh6lHiW4.d.mts → index-3X0368CL.d.mts} +16 -16
- package/dist/{index-Y2r0Zvcm.d.mts → index-B5w-0Gg9.d.mts} +4 -4
- package/dist/{index-DdBRlm7m.d.mts → index-BKZhnb2B.d.mts} +3 -3
- package/dist/{index-gAFwNiJT.d.mts → index-BYfSAJRC.d.mts} +64 -0
- package/dist/{index-2fK9iSHI.d.mts → index-BwGfdbI0.d.mts} +9 -9
- package/dist/{index-DLy-tc0L.d.mts → index-C5C1tk9f.d.mts} +214 -1
- package/dist/{index-CL2T6LVv.d.mts → index-C6Ys8pxt.d.mts} +9 -9
- package/dist/{index-NkNbYFud.d.mts → index-CaerrEDH.d.mts} +1 -1
- package/dist/{index-CfIW5biI.d.mts → index-D7rWAEY0.d.mts} +1 -0
- package/dist/{index-CaOWqztb.d.mts → index-DQYj8-53.d.mts} +1 -1
- package/dist/{index-Dg-y1mrq.d.mts → index-DV4nRk0h.d.mts} +14 -14
- package/dist/{index-GD-i3DW7.d.mts → index-DvHYpi-J.d.mts} +365 -163
- package/dist/{index-BMbmoarE.d.mts → index-O08Q2ikz.d.mts} +8 -8
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/index.d.mts +2 -2
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/{lib-Ba55od_d.mjs → lib-BOmKyjWD.mjs} +1 -1
- package/dist/{lib-CM_BUxN8.mjs → lib-DLZYp5z3.mjs} +1 -1
- package/dist/{loop-gate-handlers-BLoGCWMQ.mjs → loop-gate-handlers-Bjmat-K3.mjs} +1 -1
- package/dist/{namespace-DGAWYjbO.d.mts → namespace-Bm77p82L.d.mts} +5 -5
- package/dist/{namespace-LUNf8zo5.d.mts → namespace-D1_9WVCo.d.mts} +157 -0
- package/dist/{namespace-BsYKEMd8.d.mts → namespace-DAj_riOn.d.mts} +138 -0
- package/dist/{namespace-KMxsPJwm.d.mts → namespace-DhDY0juT.d.mts} +66 -0
- package/dist/{namespace-DXW-voCe.d.mts → namespace-DmqoDDRD.d.mts} +158 -22
- package/dist/namespace-dFBD2ZmS.mjs +1 -0
- package/dist/node/transports/index.mjs +1 -1
- package/dist/orchestrator-shared-ChygCvR1.mjs +1 -0
- package/dist/{orchestrator-shared-ChOdIgh6.d.mts → orchestrator-shared-DFLb1otg.d.mts} +9 -3
- package/dist/package-BmRhhi-3.mjs +1 -0
- package/dist/package.json +1 -1
- package/dist/runtime-node/index.mjs +1 -1
- package/dist/schema-7aKBGB7S.mjs +1 -0
- package/dist/{schema-DHlTAy0N.mjs → schema-CHp6I33k.mjs} +1 -1
- package/dist/{schema-D1HrnvT7.d.mts → schema-DLNBajAV.d.mts} +23 -1
- package/dist/{schemas-DMCGXlKa.d.mts → schemas-DMMWmWjq.d.mts} +3 -3
- package/dist/schemas-DZGnr9Tl.mjs +1 -0
- package/dist/{schemas-D-9zNyAM2.d.mts → schemas-DuuVuhHX2.d.mts} +2 -2
- package/dist/schemas-ftgVeWIG.mjs +1 -0
- package/dist/services/context-rules/index.d.mts +6 -6
- package/dist/services/filesystem/namespace.d.mts +12 -12
- package/dist/services/filesystem/schemas.d.mts +6 -6
- package/dist/services/git/namespace.d.mts +4 -4
- package/dist/services/git/schemas.d.mts +3 -3
- package/dist/services/harness/index.d.mts +1 -1
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +87 -18
- 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 +73 -6
- package/dist/services/log-import/index.mjs +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.d.mts +54 -0
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.d.mts +44 -0
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/storage/schema.mjs +1 -1
- package/dist/services/session/testing/index.mjs +9 -4
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +2 -2
- package/dist/services/subagent-template/index.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/turn/schemas.d.mts +89 -0
- package/dist/services/turn/schemas.mjs +1 -1
- package/dist/session-CKWfn3oc.mjs +1 -0
- package/dist/session-DCbJwYEU.mjs +69 -0
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/{tool-approval-service-DEQiipxj.mjs → tool-approval-service-MU_DmJsf.mjs} +1 -1
- package/dist/tools-BrNm-een.mjs +1 -0
- package/dist/{transition-DnXibkhX.d.mts → transition-Dq41YCkc.d.mts} +1 -1
- package/dist/{types-BslClRkH.d.mts → types-BMlzmWp6.d.mts} +11 -1
- package/dist/{types-Dur8EtpR.d.mts → types-C76EP81O.d.mts} +125 -82
- package/dist/ui-components/index.mjs +1 -1
- package/dist/{workflow-BqH6ar-D.mjs → workflow-C1z7I5CI.mjs} +1 -1
- package/dist/workflow-engine/index.d.mts +1 -1
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/package.json +1 -1
- package/dist/adapter-DaQqmKOJ.mjs +0 -1
- package/dist/handlers-BAycjV02.mjs +0 -41
- package/dist/namespace-C-piH3w4.mjs +0 -1
- package/dist/orchestrator-shared-Cxk3x8Vs.mjs +0 -1
- package/dist/package-B1AXe-oz.mjs +0 -1
- package/dist/schema-D6WAI8OL.mjs +0 -1
- package/dist/schemas-ArqQTC0Q.mjs +0 -1
- package/dist/schemas-uID59wR8.mjs +0 -1
- package/dist/session-0nWT4st6.mjs +0 -39
- package/dist/session-DH-ja8Ka.mjs +0 -1
- package/dist/tools-DFOsOboy.mjs +0 -1
|
@@ -2,9 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import * as _$_makaio_core0 from "@makaio/framework/core";
|
|
3
3
|
import { IMakaioBus } from "@makaio/framework/bus";
|
|
4
4
|
import { HarnessDefinition } from "@makaio/framework/contracts";
|
|
5
|
-
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
6
5
|
import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
7
6
|
import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
|
|
7
|
+
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
8
8
|
|
|
9
9
|
//#region services/core/src/harness/storage/namespace.d.ts
|
|
10
10
|
declare const HarnessInputSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"../../handler-
|
|
1
|
+
import{n as e,r as t,t as n}from"../../handler-BFNvtv5t.mjs";export{e as HarnessStorageNamespace,t as HarnessStorageSubjects,n as registerDrizzleHarnessStorage};
|
|
@@ -13,15 +13,15 @@ import { a as ContextRuleInput, n as ContextRuleAction, t as ContextRule } from
|
|
|
13
13
|
import { a as ExecutionTargetInputSchema, c as ExecutionTargetResolveRequest, d as ExecutionTargetSchemas, f as ExecutionTargetType, i as ExecutionTargetInput, l as ExecutionTargetResolveRequestSchema, m as LocalExecutionTargetSchema, n as ContainerLocalExecutionTargetSchema, o as ExecutionTargetListQuery, p as ExecutionTargetTypeSchema, r as ExecutionTarget, s as ExecutionTargetListQuerySchema, t as ContainerIsolatedExecutionTargetSchema, u as ExecutionTargetSchema } from "../schemas-D4zaFE2p.mjs";
|
|
14
14
|
import { n as ExecutionTargetSubjects, t as ExecutionTargetNamespace } from "../namespace-65uwTpbg.mjs";
|
|
15
15
|
import { A as StatusResponseSchema, C as SpawnRequest, D as StatusRequest, E as SpawnResponseSchema, M as StopRequestSchema, N as StopResponse, O as StatusRequestSchema, P as StopResponseSchema, S as ContainerStoppedSchema, T as SpawnResponse, _ as ContainerStarted, b as ContainerStateSchema, c as ContainerCreatedSchema, d as ContainerIsolatedSpawnRequest, f as ContainerIsolatedSpawnRequestSchema, g as ContainerRuntimeSchema, h as ContainerRuntime, i as DockerSubjects, j as StopRequest, k as StatusResponse, l as ContainerDestroyed, m as ContainerLocalSpawnRequestSchema, n as ContainerSpawnSubjects, p as ContainerLocalSpawnRequest, r as DockerNamespace, s as ContainerCreated, t as ContainerSpawnNamespace, u as ContainerDestroyedSchema, v as ContainerStartedSchema, w as SpawnRequestSchema, x as ContainerStopped, y as ContainerState } from "../index-CqCe7Phc.mjs";
|
|
16
|
-
import { $ as
|
|
17
|
-
import { a as registerCompressHandler, c as SessionTurnManager, d as Turn, f as TurnConfig, h as TurnStateChange, i as registerForkHandler, l as TurnCompleteCallback, m as TurnResult, n as routeToAgents, o as registerAttachHandler, p as TurnContext, r as registerMergeHandler, s as registerAbandonHandler, t as routeToAgentsCore, u as TurnCompletionResult } from "../index-
|
|
16
|
+
import { $t as resolveAdapterId, A as registerMemoryTurnStorage, At as FallbackRuntimeOptions, Bt as registerResumeHandler, C as messages, Ct as registerMemorySessionStorage, D as SelectTurn, Dt as createSessionExtensionContext, E as InsertTurn, Et as SessionExtensionContextImpl, F as importCursorsDual, Ft as registerListActionsHandler, Gt as buildTurnInitiator, Ht as AgentContextState, It as registerBuiltInActions, Jt as ensureAgentCwd, Kt as RecoveryConfig, Lt as resetBuiltInActionsRegistration, M as EmbeddingIndexManager, Mt as CONNECTOR_SWAP_DEFAULT_PIPELINE, N as registerDrizzleImportCursorStorage, Nt as normalizeSelectionString, O as turns, Ot as SessionBridge, P as importCursors, Pt as resolveAdapterNameById, Qt as buildRecoveryContext, Rt as actionRegistry, S as SelectMessage, St as registerDrizzleSessionStorage, T as registerDrizzleMessageStorage, Tt as AgentStorageSubjects, Ut as ContextWindowTrackerConfig, Vt as ContextWindowTracker, Wt as SessionContextWindowState, Xt as recoverAgent, Y as EventTransform, Yt as ensureAgentModel, Zt as verifyAndRecoverAgents, _ as messageRoutingDual, _t as mapRowToSession, a as kindToBranchKind, an as extractTextContent, at as sessionEvents, b as MessageRoutingSubjects, bt as registerDrizzleAgentStorage, c as registerSpawningToolCallResolver, cn as AdapterRegistry, ct as SessionPreviewMaps, d as MakaioSession, dn as registerCoreSessionServiceHandlers, dt as mapToSession, en as resolveExecutionTarget, f as MakaioSessionConfig, fn as MakaioSessionService, ft as SearchFilters, g as messageRouting, gt as fetchPreviewBySession, h as SelectMessageRouting, ht as fetchMessageCountsBySession, i as ContextAssemblyResult, in as resolveTargetAgents, it as SelectSessionEvent, j as registerDrizzleTurnStorage, jt as pickFallbackRuntimeOptions, k as turnsDual, kt as assembleForkContext, l as registerCompressLineageResolver, ln as ISessionOrchestrator, lt as fetchSessionPreviewMaps, m as InsertMessageRouting, mt as fetchAgentsBySession, n as buildSessionContext, nn as findTurnByAgent, nt as registerMemorySessionEventStorage, on as normalizeToBlocks, ot as sessionEventsDual, p as StartTurnOptions, pt as SearchSessionRow, qt as buildRecoveryContextWithPipeline, r as BuildContextOptions, rn as getOrCreateSession, rt as InsertSessionEvent, sn as TurnContextEnricher, t as getFullConversation, tn as resolveModelCapabilities, tt as registerDrizzleSessionEventStorage, u as registerParentResolver, un as SessionOrchestrator, ut as mapAgentsBySession, v as registerDrizzleMessageRoutingStorage, vt as parseForkTransforms, w as registerMemoryMessageStorage, wt as AgentStorageNamespace, x as InsertMessage, xt as registerMemoryAgentStorage, y as MessageRoutingNamespace, yt as registerFtsSearchHandler, zt as registerGetStatusCountsHandler } from "../index-3J0HZlPH.mjs";
|
|
17
|
+
import { a as registerCompressHandler, c as SessionTurnManager, d as Turn, f as TurnConfig, h as TurnStateChange, i as registerForkHandler, l as TurnCompleteCallback, m as TurnResult, n as routeToAgents, o as registerAttachHandler, p as TurnContext, r as registerMergeHandler, s as registerAbandonHandler, t as routeToAgentsCore, u as TurnCompletionResult } from "../index-BYfSAJRC.mjs";
|
|
18
18
|
import { n as activateProviderContextStrict, r as buildProviderContext, t as activateProviderContext } from "../index-DtwGhFFQ.mjs";
|
|
19
|
-
import { i as SessionStorageSubjects, r as SessionStorageNamespace } from "../namespace-
|
|
20
|
-
import { a as agents, s as sessions } from "../schema-
|
|
21
|
-
import { n as SessionEventStorageSubjects, t as SessionEventStorageNamespace } from "../namespace-
|
|
22
|
-
import { t as TurnStorageNamespace } from "../namespace-
|
|
23
|
-
import { n as TurnStorageSubjects } from "../namespace-
|
|
24
|
-
import { i as MessageStorageSubjects, r as MessageStorageNamespace } from "../namespace-
|
|
19
|
+
import { i as SessionStorageSubjects, r as SessionStorageNamespace } from "../namespace-DmqoDDRD.mjs";
|
|
20
|
+
import { a as agents, s as sessions } from "../schema-DLNBajAV.mjs";
|
|
21
|
+
import { n as SessionEventStorageSubjects, t as SessionEventStorageNamespace } from "../namespace-DhDY0juT.mjs";
|
|
22
|
+
import { t as TurnStorageNamespace } from "../namespace-D1_9WVCo.mjs";
|
|
23
|
+
import { n as TurnStorageSubjects } from "../namespace-DAj_riOn.mjs";
|
|
24
|
+
import { i as MessageStorageSubjects, r as MessageStorageNamespace } from "../namespace-Bm77p82L.mjs";
|
|
25
25
|
import { a as createToolContributionProcessor, c as ToolRegistryOptions, d as ToolsetPolicy, f as ToolsetPolicyProvider, l as ToolsWithToolsetsResult, o as ToolRegistry, s as ListToolsFilter, u as ToolsetInfo } from "../index-Cr9lh21j.mjs";
|
|
26
26
|
import { t as ToolApprovalService } from "../index-BvLXySoB2.mjs";
|
|
27
27
|
import { t as TrayMenuService } from "../index-DUD7wikz2.mjs";
|
|
@@ -31,7 +31,7 @@ import { C as ModelRegistrySchemas, S as ModelRegistrySchema, T as ProviderModel
|
|
|
31
31
|
import { a as InternalPendingRequest, c as SubagentServiceToken, i as InputResolver, l as subagentServicePackage, n as TrackOptions, o as SpawnOptions, r as AwaitResult, s as TrackedSubagent, t as SubagentManager, u as SubagentService } from "../index-C23g_M_J2.mjs";
|
|
32
32
|
import { a as PreferenceValueSchema, i as PreferenceKeySchema, n as PreferenceItemSchema, o as PreferencesSchemas, r as PreferenceKey, t as PreferenceItem } from "../schemas-DWfo0wp4.mjs";
|
|
33
33
|
import { n as PreferencesSubjects, t as PreferencesNamespace } from "../storage-namespace-Di1A3DMm.mjs";
|
|
34
|
-
import { _ as SubagentTemplateUpdate, a as SubagentTemplateInstance, c as SubagentTemplateInstanceStatusSchema, d as SubagentTemplateSettingsSchemas, f as SubagentTemplateSpawnRequest, g as SubagentTemplateSummarySchema, h as SubagentTemplateSummary, i as SubagentTemplateCreateSchema, l as SubagentTemplateKernelSchemas, m as SubagentTemplateSpawnedEventSchema, n as SubagentTemplateCompletedEventSchema, o as SubagentTemplateInstanceSchema, p as SubagentTemplateSpawnRequestSchema, r as SubagentTemplateCreate, s as SubagentTemplateInstanceStatus, t as SubagentTemplate, u as SubagentTemplateSchema, v as SubagentTemplateUpdateSchema } from "../schemas-
|
|
34
|
+
import { _ as SubagentTemplateUpdate, a as SubagentTemplateInstance, c as SubagentTemplateInstanceStatusSchema, d as SubagentTemplateSettingsSchemas, f as SubagentTemplateSpawnRequest, g as SubagentTemplateSummarySchema, h as SubagentTemplateSummary, i as SubagentTemplateCreateSchema, l as SubagentTemplateKernelSchemas, m as SubagentTemplateSpawnedEventSchema, n as SubagentTemplateCompletedEventSchema, o as SubagentTemplateInstanceSchema, p as SubagentTemplateSpawnRequestSchema, r as SubagentTemplateCreate, s as SubagentTemplateInstanceStatus, t as SubagentTemplate, u as SubagentTemplateSchema, v as SubagentTemplateUpdateSchema } from "../schemas-DuuVuhHX2.mjs";
|
|
35
35
|
import { n as SubagentTemplateSubjects, t as SubagentTemplateKernelNamespace } from "../namespace-D8P8Sxce2.mjs";
|
|
36
36
|
import * as _$zod from "zod";
|
|
37
37
|
import { z } from "zod";
|
|
@@ -41,8 +41,8 @@ import { IMakaioBus } from "@makaio/framework/bus";
|
|
|
41
41
|
import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
|
|
42
42
|
import { AgentResolutionContext, ArtifactContextSelector, ArtifactKindRegistration, ArtifactLifecycleHookRegistration, ArtifactObservation, ArtifactProjectionPolicy, ArtifactRef, ArtifactRevision, CanonicalModelResolvedSelection, MakaioNodeExtension, ProviderDefinition, RegisteredStepBlock, RegisteredTriggerBlock, RelationTypeRegistration, ResolvableCanonicalModel, ResolvedArtifactContextWire, TransitionActionFactory, TransitionActionInvocation, TransitionEvaluationContext, TransitionEventType, TransitionRuleDefinition, TransitionRuleDefinitionSchema, WorkflowBlockCollection } from "@makaio/framework/contracts";
|
|
43
43
|
import { BaseService } from "@makaio/framework/service-base";
|
|
44
|
-
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
45
44
|
import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
45
|
+
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
46
46
|
import * as _$_makaio_ai_adapters_core0 from "@makaio/framework/adapters";
|
|
47
47
|
import { FacetNamespaceRegistration } from "@makaio/framework/contracts/facet";
|
|
48
48
|
import { SurfaceBindingRegistration } from "@makaio/framework/contracts/materialization";
|
|
@@ -3256,9 +3256,9 @@ declare const FrameworkServicesCoreNamespaces: readonly [_$_makaio_core0.BusName
|
|
|
3256
3256
|
changed: _$zod.ZodObject<{
|
|
3257
3257
|
ruleId: _$zod.ZodString;
|
|
3258
3258
|
changeType: _$zod.ZodEnum<{
|
|
3259
|
-
created: "created";
|
|
3260
|
-
deleted: "deleted";
|
|
3261
3259
|
updated: "updated";
|
|
3260
|
+
deleted: "deleted";
|
|
3261
|
+
created: "created";
|
|
3262
3262
|
}>;
|
|
3263
3263
|
previous: _$zod.ZodNullable<_$zod.ZodObject<{
|
|
3264
3264
|
scope: _$zod.ZodEnum<{
|
|
@@ -3856,18 +3856,18 @@ declare const FrameworkServicesCoreNamespaces: readonly [_$_makaio_core0.BusName
|
|
|
3856
3856
|
changed: _$zod.ZodObject<{
|
|
3857
3857
|
path: _$zod.ZodString;
|
|
3858
3858
|
kind: _$zod.ZodEnum<{
|
|
3859
|
-
create: "create";
|
|
3860
|
-
delete: "delete";
|
|
3861
3859
|
change: "change";
|
|
3860
|
+
delete: "delete";
|
|
3861
|
+
create: "create";
|
|
3862
3862
|
}>;
|
|
3863
3863
|
}, _$zod_v4_core0.$strip>;
|
|
3864
3864
|
batch: _$zod.ZodObject<{
|
|
3865
3865
|
changes: _$zod.ZodArray<_$zod.ZodObject<{
|
|
3866
3866
|
path: _$zod.ZodString;
|
|
3867
3867
|
kind: _$zod.ZodEnum<{
|
|
3868
|
-
create: "create";
|
|
3869
|
-
delete: "delete";
|
|
3870
3868
|
change: "change";
|
|
3869
|
+
delete: "delete";
|
|
3870
|
+
create: "create";
|
|
3871
3871
|
}>;
|
|
3872
3872
|
}, _$zod_v4_core0.$strip>>;
|
|
3873
3873
|
}, _$zod_v4_core0.$strip>;
|
|
@@ -6014,6 +6014,75 @@ declare const FrameworkServicesCoreNamespaces: readonly [_$_makaio_core0.BusName
|
|
|
6014
6014
|
}, _$zod_v4_core0.$strip>;
|
|
6015
6015
|
}, _$zod_v4_core0.$strip>;
|
|
6016
6016
|
};
|
|
6017
|
+
ingestCompleted: {
|
|
6018
|
+
request: _$zod.ZodObject<{
|
|
6019
|
+
sessionId: _$zod.ZodString;
|
|
6020
|
+
turnAnchorId: _$zod.ZodString;
|
|
6021
|
+
startedAt: _$zod.ZodNumber;
|
|
6022
|
+
completedAt: _$zod.ZodNumber;
|
|
6023
|
+
status: _$zod.ZodEnum<{
|
|
6024
|
+
error: "error";
|
|
6025
|
+
completed: "completed";
|
|
6026
|
+
}>;
|
|
6027
|
+
error: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6028
|
+
usage: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
6029
|
+
total: _$zod.ZodObject<{
|
|
6030
|
+
inputTokens: _$zod.ZodNumber;
|
|
6031
|
+
outputTokens: _$zod.ZodNumber;
|
|
6032
|
+
cost: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
6033
|
+
}, _$zod_v4_core0.$strip>;
|
|
6034
|
+
byAgent: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodObject<{
|
|
6035
|
+
inputTokens: _$zod.ZodNumber;
|
|
6036
|
+
outputTokens: _$zod.ZodNumber;
|
|
6037
|
+
cost: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
6038
|
+
}, _$zod_v4_core0.$strip>>>;
|
|
6039
|
+
}, _$zod_v4_core0.$strip>>;
|
|
6040
|
+
initiator: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
6041
|
+
source: _$zod.ZodEnum<{
|
|
6042
|
+
user: "user";
|
|
6043
|
+
system: "system";
|
|
6044
|
+
extension: "extension";
|
|
6045
|
+
}>;
|
|
6046
|
+
sourceId: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6047
|
+
}, _$zod_v4_core0.$strip>>;
|
|
6048
|
+
}, _$zod_v4_core0.$strip>;
|
|
6049
|
+
response: _$zod.ZodObject<{
|
|
6050
|
+
turn: _$zod.ZodObject<{
|
|
6051
|
+
turnId: _$zod.ZodString;
|
|
6052
|
+
sessionId: _$zod.ZodString;
|
|
6053
|
+
turnNumber: _$zod.ZodNumber;
|
|
6054
|
+
startedAt: _$zod.ZodNumber;
|
|
6055
|
+
completedAt: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
6056
|
+
status: _$zod.ZodEnum<{
|
|
6057
|
+
error: "error";
|
|
6058
|
+
completed: "completed";
|
|
6059
|
+
active: "active";
|
|
6060
|
+
}>;
|
|
6061
|
+
error: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6062
|
+
usage: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
6063
|
+
total: _$zod.ZodObject<{
|
|
6064
|
+
inputTokens: _$zod.ZodNumber;
|
|
6065
|
+
outputTokens: _$zod.ZodNumber;
|
|
6066
|
+
cost: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
6067
|
+
}, _$zod_v4_core0.$strip>;
|
|
6068
|
+
byAgent: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodObject<{
|
|
6069
|
+
inputTokens: _$zod.ZodNumber;
|
|
6070
|
+
outputTokens: _$zod.ZodNumber;
|
|
6071
|
+
cost: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
6072
|
+
}, _$zod_v4_core0.$strip>>>;
|
|
6073
|
+
}, _$zod_v4_core0.$strip>>;
|
|
6074
|
+
initiator: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
6075
|
+
source: _$zod.ZodEnum<{
|
|
6076
|
+
user: "user";
|
|
6077
|
+
system: "system";
|
|
6078
|
+
extension: "extension";
|
|
6079
|
+
}>;
|
|
6080
|
+
sourceId: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6081
|
+
}, _$zod_v4_core0.$strip>>;
|
|
6082
|
+
}, _$zod_v4_core0.$strip>;
|
|
6083
|
+
created: _$zod.ZodBoolean;
|
|
6084
|
+
}, _$zod_v4_core0.$strip>;
|
|
6085
|
+
};
|
|
6017
6086
|
get: {
|
|
6018
6087
|
request: _$zod.ZodObject<{
|
|
6019
6088
|
turnId: _$zod.ZodString;
|
|
@@ -6284,9 +6353,9 @@ declare const FrameworkServicesCoreNamespaces: readonly [_$_makaio_core0.BusName
|
|
|
6284
6353
|
name: _$zod.ZodString;
|
|
6285
6354
|
enabled: _$zod.ZodDefault<_$zod.ZodBoolean>;
|
|
6286
6355
|
adapterName: _$zod.ZodString;
|
|
6356
|
+
providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6287
6357
|
model: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6288
6358
|
systemPrompt: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6289
|
-
providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
|
|
6290
6359
|
allowedTools: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
6291
6360
|
disallowedTools: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
6292
6361
|
allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
@@ -6333,4 +6402,4 @@ declare const FrameworkServicesCoreNamespaces: readonly [_$_makaio_core0.BusName
|
|
|
6333
6402
|
};
|
|
6334
6403
|
}>];
|
|
6335
6404
|
//#endregion
|
|
6336
|
-
export { AdapterIdentityRegistry, AdapterRegistry, AdapterRuntimeNamespace, AdapterRuntimeSchemas, AdapterRuntimeSubjects, type AgentContextState, type AgentInstanceStatus, AgentInstanceStatusSchema, AgentRuntimeNamespace, AgentRuntimeSchemas, type AgentRuntimeSelection, AgentRuntimeSelectionSchema, AgentRuntimeSubjects, AgentStorageNamespace, AgentStorageSubjects, type AmbiguousMatch, type ArtifactContextKindRegistry, ArtifactLifecycleHookRegistry, ArtifactLifecycleHookRegistryToken, ArtifactLifecycleHookRejectedError, ArtifactSchemaRegistry, ArtifactSchemaRegistryToken, type AwaitResult, type BugEntry, BugEntrySchema, type BuildContextOptions, CONNECTOR_SWAP_DEFAULT_PIPELINE, CachedRegistryFetcher, CanonicalModelResolutionError, type CanonicalModelResolutionErrorCode, CanonicalModelResolver, type CanonicalModelResolverDeps, CanonicalModelService, CapabilityService, CapabilityToken, type CodebaseChangedEvent, CodebaseChangedEventSchema, CodebaseNamespace, CodebaseSchemas, CodebaseSubjects, type CompressRequest, CompressRequestSchema, type CompressResponse, CompressResponseSchema, type CompressionEvent, CompressionEventSchema, CompressionNamespace, CompressionSchemas, CompressionSubjects, type ContainerCreated, ContainerCreatedSchema, type ContainerDestroyed, ContainerDestroyedSchema, ContainerIsolatedExecutionTargetSchema, type ContainerIsolatedSpawnRequest, ContainerIsolatedSpawnRequestSchema, ContainerLocalExecutionTargetSchema, type ContainerLocalSpawnRequest, ContainerLocalSpawnRequestSchema, type ContainerRuntime, ContainerRuntimeSchema, ContainerSpawnNamespace, ContainerSpawnSubjects, type ContainerStarted, ContainerStartedSchema, type ContainerState, ContainerStateSchema, type ContainerStopped, ContainerStoppedSchema, type ContextAssemblyResult, ContextWindowTracker, type ContextWindowTrackerConfig, type DefaultModelResolution, DockerNamespace, DockerSubjects, EmbeddingIndexManager, type EventTransform, type ExecutionTarget, type ExecutionTargetInput, ExecutionTargetInputSchema, type ExecutionTargetListQuery, ExecutionTargetListQuerySchema, ExecutionTargetNamespace, type ExecutionTargetResolveRequest, ExecutionTargetResolveRequestSchema, ExecutionTargetSchema, ExecutionTargetSchemas, ExecutionTargetSubjects, type ExecutionTargetType, ExecutionTargetTypeSchema, type ExtractedContext, ExtractedContextSchema, FacetNamespaceRegistry, FacetNamespaceRegistryToken, FallbackRegistryFetcher, type FallbackRuntimeOptions, FrameworkServicesCoreNamespaces, type IModelRegistryCache, type IModelRegistryFetcher, type ISessionOrchestrator, type InputResolver, type InsertMessage, type InsertMessageRouting, type InsertSessionEvent, type InsertTurn, type InternalPendingRequest, type ListToolsFilter, LocalExecutionTargetSchema, MakaioSession, type MakaioSessionConfig, MakaioSessionService, MessageRoutingNamespace, MessageRoutingSubjects, MessageStorageNamespace, MessageStorageSubjects, type ModelRegistry, type ModelRegistryCheckModelInProvidersRequest, type ModelRegistryCheckModelInProvidersResponse, type ModelRegistryGetForProviderRequest, type ModelRegistryGetForProviderResponse, type ModelRegistryGetLabModelsRequest, type ModelRegistryGetLabModelsResponse, type ModelRegistryGetProviderModelsRequest, type ModelRegistryGetProviderModelsResponse, ModelRegistryNamespace, ModelRegistryProviderNotFoundError, type ModelRegistryRefreshRequest, type ModelRegistryRefreshResponse, ModelRegistrySchema, ModelRegistrySchemas, ModelRegistryService, type ModelRegistryServiceOptions, ModelRegistrySubjects, ModelRegistryToken, type PreferenceItem, PreferenceItemSchema, type PreferenceKey, PreferenceKeySchema, PreferenceValueSchema, PreferencesNamespace, PreferencesSchemas, PreferencesSubjects, type ProviderModelOverride, ProviderModelOverrideSchema, type RecoveryConfig, type RegisteredAdapterRuntimeIdentityHandlers, type ResolveArtifactContextOptions, type ResolveIdRequest, ResolveIdRequestSchema, type ResolveIdResponse, ResolveIdResponseSchema, type ResolveNameRequest, ResolveNameRequestSchema, type ResolveNameResponse, ResolveNameResponseSchema, type ResolvedDefaultTarget, type ResolvedSelection, type RunAfterInput, type RunBeforeInput, type RunBeforeResult, type SearchFilters, type SearchSessionRow, type SelectMessage, type SelectMessageRouting, type SelectSessionEvent, type SelectTurn, SessionBridge, SessionBridgeToken, type SessionContextWindowState, SessionEventStorageNamespace, SessionEventStorageSubjects, SessionExtensionContextImpl,
|
|
6405
|
+
export { AdapterIdentityRegistry, AdapterRegistry, AdapterRuntimeNamespace, AdapterRuntimeSchemas, AdapterRuntimeSubjects, type AgentContextState, type AgentInstanceStatus, AgentInstanceStatusSchema, AgentRuntimeNamespace, AgentRuntimeSchemas, type AgentRuntimeSelection, AgentRuntimeSelectionSchema, AgentRuntimeSubjects, AgentStorageNamespace, AgentStorageSubjects, type AmbiguousMatch, type ArtifactContextKindRegistry, ArtifactLifecycleHookRegistry, ArtifactLifecycleHookRegistryToken, ArtifactLifecycleHookRejectedError, ArtifactSchemaRegistry, ArtifactSchemaRegistryToken, type AwaitResult, type BugEntry, BugEntrySchema, type BuildContextOptions, CONNECTOR_SWAP_DEFAULT_PIPELINE, CachedRegistryFetcher, CanonicalModelResolutionError, type CanonicalModelResolutionErrorCode, CanonicalModelResolver, type CanonicalModelResolverDeps, CanonicalModelService, CapabilityService, CapabilityToken, type CodebaseChangedEvent, CodebaseChangedEventSchema, CodebaseNamespace, CodebaseSchemas, CodebaseSubjects, type CompressRequest, CompressRequestSchema, type CompressResponse, CompressResponseSchema, type CompressionEvent, CompressionEventSchema, CompressionNamespace, CompressionSchemas, CompressionSubjects, type ContainerCreated, ContainerCreatedSchema, type ContainerDestroyed, ContainerDestroyedSchema, ContainerIsolatedExecutionTargetSchema, type ContainerIsolatedSpawnRequest, ContainerIsolatedSpawnRequestSchema, ContainerLocalExecutionTargetSchema, type ContainerLocalSpawnRequest, ContainerLocalSpawnRequestSchema, type ContainerRuntime, ContainerRuntimeSchema, ContainerSpawnNamespace, ContainerSpawnSubjects, type ContainerStarted, ContainerStartedSchema, type ContainerState, ContainerStateSchema, type ContainerStopped, ContainerStoppedSchema, type ContextAssemblyResult, ContextWindowTracker, type ContextWindowTrackerConfig, type DefaultModelResolution, DockerNamespace, DockerSubjects, EmbeddingIndexManager, type EventTransform, type ExecutionTarget, type ExecutionTargetInput, ExecutionTargetInputSchema, type ExecutionTargetListQuery, ExecutionTargetListQuerySchema, ExecutionTargetNamespace, type ExecutionTargetResolveRequest, ExecutionTargetResolveRequestSchema, ExecutionTargetSchema, ExecutionTargetSchemas, ExecutionTargetSubjects, type ExecutionTargetType, ExecutionTargetTypeSchema, type ExtractedContext, ExtractedContextSchema, FacetNamespaceRegistry, FacetNamespaceRegistryToken, FallbackRegistryFetcher, type FallbackRuntimeOptions, FrameworkServicesCoreNamespaces, type IModelRegistryCache, type IModelRegistryFetcher, type ISessionOrchestrator, type InputResolver, type InsertMessage, type InsertMessageRouting, type InsertSessionEvent, type InsertTurn, type InternalPendingRequest, type ListToolsFilter, LocalExecutionTargetSchema, MakaioSession, type MakaioSessionConfig, MakaioSessionService, MessageRoutingNamespace, MessageRoutingSubjects, MessageStorageNamespace, MessageStorageSubjects, type ModelRegistry, type ModelRegistryCheckModelInProvidersRequest, type ModelRegistryCheckModelInProvidersResponse, type ModelRegistryGetForProviderRequest, type ModelRegistryGetForProviderResponse, type ModelRegistryGetLabModelsRequest, type ModelRegistryGetLabModelsResponse, type ModelRegistryGetProviderModelsRequest, type ModelRegistryGetProviderModelsResponse, ModelRegistryNamespace, ModelRegistryProviderNotFoundError, type ModelRegistryRefreshRequest, type ModelRegistryRefreshResponse, ModelRegistrySchema, ModelRegistrySchemas, ModelRegistryService, type ModelRegistryServiceOptions, ModelRegistrySubjects, ModelRegistryToken, type PreferenceItem, PreferenceItemSchema, type PreferenceKey, PreferenceKeySchema, PreferenceValueSchema, PreferencesNamespace, PreferencesSchemas, PreferencesSubjects, type ProviderModelOverride, ProviderModelOverrideSchema, type RecoveryConfig, type RegisteredAdapterRuntimeIdentityHandlers, type ResolveArtifactContextOptions, type ResolveIdRequest, ResolveIdRequestSchema, type ResolveIdResponse, ResolveIdResponseSchema, type ResolveNameRequest, ResolveNameRequestSchema, type ResolveNameResponse, ResolveNameResponseSchema, type ResolvedDefaultTarget, type ResolvedSelection, type RunAfterInput, type RunBeforeInput, type RunBeforeResult, type SearchFilters, type SearchSessionRow, type SelectMessage, type SelectMessageRouting, type SelectSessionEvent, type SelectTurn, SessionBridge, SessionBridgeToken, type SessionContextWindowState, SessionEventStorageNamespace, SessionEventStorageSubjects, SessionExtensionContextImpl, SessionOrchestrator, SessionOrchestratorToken, type SessionPreviewMaps, SessionStorageNamespace, SessionStorageSubjects, SessionStorageToken, SessionToken, SessionTurnManager, type SpawnOptions, type SpawnRequest, SpawnRequestSchema, type SpawnResponse, SpawnResponseSchema, type StartTurnOptions, type StatusRequest, StatusRequestSchema, type StatusResponse, StatusResponseSchema, type StopRequest, StopRequestSchema, type StopResponse, StopResponseSchema, SubagentManager, SubagentService, SubagentServiceToken, type SubagentTemplate, SubagentTemplateCompletedEventSchema, type SubagentTemplateCreate, SubagentTemplateCreateSchema, type SubagentTemplateInstance, SubagentTemplateInstanceSchema, type SubagentTemplateInstanceStatus, SubagentTemplateInstanceStatusSchema, SubagentTemplateKernelNamespace, SubagentTemplateKernelSchemas, SubagentTemplateSchema, SubagentTemplateSettingsSchemas, type SubagentTemplateSpawnRequest, SubagentTemplateSpawnRequestSchema, SubagentTemplateSpawnedEventSchema, SubagentTemplateSubjects, type SubagentTemplateSummary, SubagentTemplateSummarySchema, type SubagentTemplateUpdate, SubagentTemplateUpdateSchema, SurfaceBindingRegistry, SurfaceBindingRegistryToken, type TechnicalDetails, TechnicalDetailsSchema, type TodoEntry, TodoEntrySchema, ToolApprovalService, ToolApprovalToken, ToolRegistry, type ToolRegistryOptions, ToolRegistryToken, type ToolsWithToolsetsResult, type ToolsetInfo, type ToolsetPolicy, type ToolsetPolicyProvider, type TrackOptions, type TrackedSubagent, TransitionActionRegistry, TransitionPipelineService, TransitionPipelineToken, TransitionRuleRegistry, type TrayMenuEntry, TrayMenuEntrySchema, type TrayMenuGroup, TrayMenuGroupEntrySchema, TrayMenuGroupSchema, type TrayMenuItemClicked, TrayMenuItemClickedSchema, type TrayMenuListEntry, TrayMenuListEntrySchema, TrayMenuMetadataSchema, TrayMenuNamespace, TrayMenuSchemas, TrayMenuSectionSchema, TrayMenuService, TrayMenuSubjects, TrayMenuToken, Turn, type TurnCompleteCallback, type TurnCompletionResult, type TurnConfig, type TurnContext, TurnContextEnricher, type TurnResult, type TurnStateChange, TurnStorageNamespace, TurnStorageSubjects, WORKFLOW_START_ACTION_TYPE, WorkflowBlockRegistry, WorkflowBlockRegistryToken, actionRegistry, activateProviderContext, activateProviderContextStrict, agents, artifactLifecycleHookRegistryPackage, artifactSchemaRegistryPackage, assembleForkContext, buildDeterministicAdapterId, buildProviderContext, buildRecoveryContext, buildRecoveryContextWithPipeline, buildSessionContext, buildTurnInitiator, canonicalModelPackage, capabilityPackage, createArtifactKindContributionProcessor, createArtifactLifecycleHookContributionProcessor, createFacetNamespaceContributionProcessor, createModelRegistryPackage, createSessionExtensionContext, createSurfaceBindingContributionProcessor, createToolContributionProcessor, createTransitionContributionProcessor, createWorkflowBlockContributionProcessor, ensureAgentCwd, ensureAgentModel, extractTextContent, facetNamespaceRegistryPackage, fetchAgentsBySession, fetchMessageCountsBySession, fetchPreviewBySession, fetchSessionPreviewMaps, findTurnByAgent, frameworkCorePackages, getFullConversation, getOrCreateSession, importCursors, importCursorsDual, kindToBranchKind, mapAgentsBySession, mapRowToSession, mapToSession, mergeModelMetadata, messageRouting, messageRoutingDual, messages, normalizeSelectionString, normalizeToBlocks, parseForkTransforms, pickFallbackRuntimeOptions, recoverAgent, registerAbandonHandler, registerAdapterRuntimeIdentityHandlers, registerAttachHandler, registerBuiltInActions, registerCompressHandler, registerCompressLineageResolver, registerCoreSessionServiceHandlers, registerDrizzleAgentStorage, registerDrizzleImportCursorStorage, registerDrizzleMessageRoutingStorage, registerDrizzleMessageStorage, registerDrizzleSessionEventStorage, registerDrizzleSessionStorage, registerDrizzleTurnStorage, registerForkHandler, registerFtsSearchHandler, registerGetStatusCountsHandler, registerListActionsHandler, registerMemoryAgentStorage, registerMemoryMessageStorage, registerMemorySessionEventStorage, registerMemorySessionStorage, registerMemoryTurnStorage, registerMergeHandler, registerParentResolver, registerResumeHandler, registerSpawningToolCallResolver, resetBuiltInActionsRegistration, resolveAdapterId, resolveAdapterNameById, resolveArtifactContext, resolveDeterministicAdapterId, resolveExecutionTarget, resolveModelCapabilities, resolveTargetAgents, routeToAgents, routeToAgentsCore, sessionBridgePackage, sessionEvents, sessionEventsDual, sessionOrchestratorPackage, sessionPackage, sessionStoragePackage, sessions, subagentServicePackage, surfaceBindingRegistryPackage, toolApprovalPackage, toolRegistryPackage, transitionPipelinePackage, trayMenuPackage, turns, turnsDual, verifyAndRecoverAgents, workflowBlockRegistryPackage };
|
package/dist/services/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TurnStorageNamespace as e,TurnStorageSubjects as t}from"./turn/namespace.mjs";import{agents as n,sessions as r}from"./session/storage/schema.mjs";import{n as i,t as a}from"../schema-DHlTAy0N.mjs";import{t as o}from"../schema-D6WAI8OL.mjs";import{i as s,n as c,r as l,t as u}from"../namespace-C-piH3w4.mjs";import{SessionStorageNamespace as d,SessionStorageSubjects as f}from"./session/storage/namespace.mjs";import{A as p,C as m,D as h,E as ee,F as g,M as te,N as ne,O as re,P as _,S as ie,T as ae,_ as oe,a as se,b as ce,c as le,d as ue,f as de,g as fe,h as pe,i as me,j as he,k as ge,l as _e,m as ve,n as ye,o as be,p as xe,r as Se,s as Ce,t as we,u as Te,v as Ee,w as v,x as y,y as b}from"../handlers-BAycjV02.mjs";import{A as x,B as S,C,E as w,F as T,G as E,H as D,I as De,J as Oe,K as ke,L as Ae,M as je,N as Me,O as Ne,P as Pe,R as Fe,S as Ie,T as Le,U as Re,V as ze,W as Be,X as Ve,Y as He,_ as Ue,a as We,b as Ge,c as Ke,d as qe,g as Je,h as Ye,i as Xe,j as Ze,k as Qe,l as $e,m as et,o as tt,p as nt,q as rt,r as it,s as at,t as ot,u as st,v as ct,w as lt,x as ut,y as dt,z as ft}from"../session-0nWT4st6.mjs";import{t as pt}from"../namespace-DBHwyhME.mjs";import{n as mt,r as ht,t as gt}from"../provider-context-DC_eq7es.mjs";import{AdapterRuntimeSchemas as _t,ResolveIdRequestSchema as vt,ResolveIdResponseSchema as yt,ResolveNameRequestSchema as bt,ResolveNameResponseSchema as xt}from"./adapter-runtime/schemas.mjs";import{AdapterRuntimeNamespace as O,AdapterRuntimeSubjects as St}from"./adapter-runtime/namespace.mjs";import{ProviderStorageNamespace as Ct}from"./settings/storage/providers-namespace.mjs";import{ContainerIsolatedExecutionTargetSchema as wt,ContainerLocalExecutionTargetSchema as Tt,ExecutionTargetInputSchema as Et,ExecutionTargetListQuerySchema as Dt,ExecutionTargetResolveRequestSchema as Ot,ExecutionTargetSchema as kt,ExecutionTargetSchemas as At,ExecutionTargetTypeSchema as jt,LocalExecutionTargetSchema as Mt}from"./execution-target/schemas.mjs";import{ExecutionTargetNamespace as k,ExecutionTargetSubjects as Nt}from"./execution-target/namespace.mjs";import{MessageStorageNamespace as Pt,MessageStorageSubjects as Ft}from"./session/messages/namespace.mjs";import{TurnStorageNamespace as It}from"./session/turns/namespace.mjs";import{BugEntrySchema as Lt,CompressRequestSchema as Rt,CompressResponseSchema as zt,CompressionEventSchema as Bt,CompressionSchemas as Vt,ExtractedContextSchema as Ht,TechnicalDetailsSchema as Ut,TodoEntrySchema as Wt}from"./compression/schemas.mjs";import{PreferenceItemSchema as Gt,PreferenceKeySchema as Kt,PreferenceValueSchema as qt,PreferencesSchemas as Jt}from"./preferences/schemas.mjs";import{PreferencesNamespace as A,PreferencesSubjects as Yt}from"./preferences/storage-namespace.mjs";import{t as Xt}from"../namespace-wke7juzy.mjs";import{A as Zt,B as Qt,C as $t,D as en,E as tn,F as nn,G as rn,H as an,I as on,J as sn,K as cn,L as ln,M as un,N as dn,O as fn,P as pn,R as mn,S as hn,T as gn,U as _n,V as vn,W as yn,Y as bn,_ as xn,a as j,b as Sn,c as Cn,d as wn,f as M,g as N,h as Tn,i as P,j as En,k as Dn,l as On,m as kn,o as An,p as F,q as jn,r as Mn,s as I,u as Nn,v as L,w as Pn,x as Fn,y as In,z as Ln}from"../tools-DFOsOboy.mjs";import{t as Rn}from"../capability-service-XlymTzz1.mjs";import{a as zn,c as Bn,i as Vn,l as Hn,n as Un,o as R,r as Wn,s as Gn,t as Kn,u as qn}from"../model-registry-rYICIwyR.mjs";import{t as Jn}from"../tool-approval-service-DEQiipxj.mjs";import{TrayMenuEntrySchema as Yn,TrayMenuGroupEntrySchema as Xn,TrayMenuGroupSchema as Zn,TrayMenuItemClickedSchema as Qn,TrayMenuListEntrySchema as $n,TrayMenuMetadataSchema as er,TrayMenuSchemas as tr,TrayMenuSectionSchema as nr}from"./tray-menu/schemas.mjs";import{TrayMenuNamespace as z,TrayMenuSubjects as rr}from"./tray-menu/namespace.mjs";import{t as ir}from"../tray-menu-service-B2AxiQqL.mjs";import{n as ar}from"../handler-2bPhRn0u.mjs";import{i as or,n as sr,r as cr,t as lr}from"../package-CF_Zm2v4.mjs";import{FsNamespace as ur}from"./filesystem/namespace.mjs";import"./capability/index.mjs";import"./tool-approval/index.mjs";import"./tray-menu/index.mjs";import"./subagent/index.mjs";import{AgentInstanceStatusSchema as dr,AgentRuntimeSchemas as fr,AgentRuntimeSelectionSchema as pr}from"./agent-runtime/schemas.mjs";import{AgentRuntimeNamespace as B,AgentRuntimeSubjects as mr}from"./agent-runtime/namespace.mjs";import{CodebaseChangedEventSchema as hr,CodebaseSchemas as gr}from"./codebase/schemas.mjs";import{CodebaseNamespace as V,CodebaseSubjects as _r}from"./codebase/namespace.mjs";import{CompressionNamespace as H,CompressionSubjects as vr}from"./compression/namespace.mjs";import{r as yr,t as br}from"../storage-namespace-D5q9CrBp.mjs";import{DefinitionNamespace as xr}from"./definition/namespace.mjs";import{DialogNamespace as Sr}from"./dialog/namespace.mjs";import{_ as Cr,c as wr,d as Tr,f as Er,g as Dr,h as Or,i as kr,l as Ar,m as jr,n as Mr,o as Nr,p as Pr,r as U,s as Fr,t as Ir,u as Lr,v as Rr,y as zr}from"../execution-target-BR8bLkCR.mjs";import{CLIDetectionNamespace as Br}from"./cli-detection/namespace.mjs";import{LocalNotificationNamespace as Vr}from"./local-notification/namespace.mjs";import{t as Hr}from"../namespace-CVMZVqB5.mjs";import{ExtensionConfigStorageNamespace as Ur}from"./settings/storage/extension-configs/namespace.mjs";import{ClientStorageNamespace as Wr}from"./settings/storage/clients-namespace.mjs";import{SubagentTemplateCompletedEventSchema as Gr,SubagentTemplateCreateSchema as Kr,SubagentTemplateInstanceSchema as qr,SubagentTemplateInstanceStatusSchema as Jr,SubagentTemplateKernelSchemas as Yr,SubagentTemplateSchema as Xr,SubagentTemplateSettingsSchemas as Zr,SubagentTemplateSpawnRequestSchema as Qr,SubagentTemplateSpawnedEventSchema as $r,SubagentTemplateSummarySchema as ei,SubagentTemplateUpdateSchema as ti}from"./subagent-template/schemas.mjs";import{r as ni,t as ri}from"../namespace-BO3tODGC.mjs";import{SubagentTemplateKernelNamespace as W,SubagentTemplateSubjects as ii}from"./subagent-template/namespace.mjs";import{i as ai,n as oi,r as si,t as ci}from"../identity-BarL3JYI.mjs";import"./adapter-runtime/index.mjs";import"./agent-runtime/index.mjs";import"./codebase/index.mjs";import"./compression/index.mjs";import"./preferences/index.mjs";import"./subagent-template/index.mjs";import{ArtifactSubjects as li}from"@makaio/framework/contracts";import{ImportCursorStorageNamespace as ui}from"@makaio/framework/adapters";import{ModelRegistryPublicNamespace as di}from"@makaio/framework/contracts/model-registry";function fi(e){return{source:`extension`,ownerKey:`extension:${e}`}}function pi(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerKind(e,n.owner)}function mi(){let e=new Map,t=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterKind(t.kind,t.schemaVersion,n.owner)}pi(e,n.registry)}};return{filter:e=>(e.artifactKinds?.kinds?.length??0)>0,async processActivated(n,r,i){let a=i.getService(j);if(!a)throw Error(`ArtifactSchemaRegistry is not available — ensure artifact-schema-registry is started before extensions with artifactKinds.`);let o=(r.artifactKinds?.kinds??[]).map(e=>e.toRegistration()),s=fi(n);t(n);for(let e of o)a.registerKind(e,s);e.set(n,{registry:a,owner:s,registrations:o})},async processStopped(e){try{t(e)}catch(t){console.error(`[ArtifactContributionProcessor] Deregister error for "${e}":`,t)}}}}function hi(e,t,n){return{...n,filter:{...n.filter,kind:e,schemaVersion:t}}}function gi(){let e=new Map,t=t=>{let n=e.get(t);n&&(e.delete(t),n.cleanup())};return{filter:e=>{let t=e.artifactLifecycleHooks!=null,n=(e.artifactKinds?.kinds??[]).some(e=>(e.hooks?.hooks.length??0)>0);return t||n},async processActivated(n,r,i){let a=i.getService(P);if(!a)throw Error(`ArtifactLifecycleHookRegistry is not available — ensure artifact-lifecycle-hook-registry is started before extensions with artifact lifecycle hooks.`);let o=r.artifactLifecycleHooks?[...await r.artifactLifecycleHooks.createHooks({bus:i.bus,extensionName:n})]:[],s=[];for(let e of r.artifactKinds?.kinds??[])if(e.hooks)for(let t of e.hooks.hooks)s.push(hi(e.kind,e.schemaVersion,t));let c=[...o,...s];t(n);let l=a.registerHooks(n,c);e.set(n,{cleanup:l})},async processStopped(e){try{t(e)}catch(t){console.error(`[ArtifactLifecycleHookContributionProcessor] Deregister error for "${e}":`,t)}}}}async function _i(e){let t=e.maxDepth??5,n={bus:e.bus,kindRegistry:e.kindRegistry,maxDepth:t,resolvedByKey:new Map,kindDefaultsCache:new Map,walkedByKey:new Set,refIndexByKey:new Map,resolved:[],refs:[]},r=await K(n,e.ref);if(!r)throw Error(`artifact.resolveContext: root artifact '${e.ref.kind}:${e.ref.id}:${e.ref.revision}' not found`);return n.resolved.push(r),await G(n,r,J(await q(n,r),e.selectors),0,new Set([Z(e.ref)])),{rootRef:e.ref,refs:n.refs,resolved:n.resolved}}async function G(e,t,n,r,i){let a=wi(t,n,r,i);if(e.walkedByKey.has(a))return;e.walkedByKey.add(a);let o=xi(t);for(let a of t.relations)await vi(e,o,a,n,r,i)}async function vi(e,t,n,r,i,a){let o=r?.[n.type];if(o?.hint===`omit`)return;let s=o?.hint??`link`;if(!yi(o,n.target)){X(e,Y(t,n,s,`not-selected`));return}if(n.target.refClass!==`artifact`){X(e,Y(t,n,s,`unsupported-ref-class`));return}let c=Z(n.target),l=a.has(c);if(i>=e.maxDepth&&!l){X(e,Y(t,n,s,`depth-exceeded`));return}let u=e.resolvedByKey.has(c),d=await K(e,n.target);if(!d){X(e,Y(t,n,s,`not-found`));return}if(X(e,{sourceRef:t,target:n.target,relationType:n.type,hint:s,status:`resolved`}),u||e.resolved.push(d),l)return;let f=(o.depth??1)-1,p=f>0?{[n.type]:{...o,depth:f}}:void 0,m=J(J(await q(e,d),p),o.nested),h=new Set(a);h.add(c),await G(e,d,m,i+1,h)}async function K(e,t){let n=Z(t);if(e.resolvedByKey.has(n))return e.resolvedByKey.get(n)??null;let{artifact:r}=await e.bus.request(li.resolve,{ref:t});return e.resolvedByKey.set(n,r),r}async function q(e,t){let n=JSON.stringify([t.kind,t.schemaVersion]);if(e.kindDefaultsCache.has(n))return e.kindDefaultsCache.get(n);let r=(await e.kindRegistry.getKind(t.kind,t.schemaVersion))?.defaultContext;return e.kindDefaultsCache.set(n,r),r}function J(e,t){if(!t)return e;if(!e)return t;let n={...e};for(let[e,r]of Object.entries(t))n[e]=r;return n}function yi(e,t){return e?e.kinds?e.kinds.includes(bi(t)):!0:!1}function bi(e){return e.refClass===`local`?e.artifact.kind:e.kind}function Y(e,t,n,r){return{sourceRef:e,target:t.target,relationType:t.type,hint:n,status:`unresolved`,reason:r}}function X(e,t){let n=Si(t),r=e.refIndexByKey.get(n);if(r===void 0){e.refIndexByKey.set(n,e.refs.length),e.refs.push(t);return}t.status===`resolved`&&e.refs[r]?.status===`unresolved`&&(e.refs[r]=t)}function xi(e){return{refClass:`artifact`,kind:e.kind,id:e.id,revision:e.revision}}function Z(e){return JSON.stringify([e.kind,e.id,e.revision])}function Si(e){return JSON.stringify([Z(e.sourceRef),e.relationType,Ci(e.target)])}function Ci(e){return e.refClass===`artifact`?JSON.stringify([`artifact`,e.kind,e.id,e.revision]):e.refClass===`local`?JSON.stringify([`local`,Z(e.artifact),e.localId]):JSON.stringify([`evidence`,e.kind,e.id,e.revision??null,e.locator??null])}function wi(e,t,n,r){return JSON.stringify([e.kind,e.id,e.revision,n,t??null,[...r].sort()])}function Q(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerNamespace(e)}function Ti(){let e=new Map,t=(t,n)=>{if(n){for(let e of n.registrations)n.registry.registerNamespace(e);e.set(t,n)}},n=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterNamespace(t.namespace)}Q(e,n.registry)}};return{filter:e=>(e.facetNamespaces?.namespaces?.length??0)>0,async processActivated(r,i,a){let o=a.getService(I);if(!o)throw Error(`FacetNamespaceRegistry is not available — ensure facet-namespace-registry is started before extensions with facetNamespaces.`);let s=(i.facetNamespaces?.namespaces??[]).map(e=>e.toRegistration()),c=e.get(r);n(r);let l=[];try{for(let e of s)o.registerNamespace(e),l.push(e)}catch(n){for(let e=l.length-1;e>=0;--e)o.deregisterNamespace(l[e].namespace);throw Q(e,o),t(r,c),n}e.set(r,{registry:o,registrations:s})},async processStopped(e){try{n(e)}catch(t){console.error(`[FacetNamespaceContributionProcessor] Deregister error for "${e}":`,t)}}}}function $(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerBinding(e)}function Ei(){let e=new Map,t=(t,n)=>{if(n){for(let e of n.registrations)n.registry.registerBinding(e);e.set(t,n)}},n=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterBinding(t.id)}$(e,n.registry)}};return{filter:e=>(e.surfaceBindings?.bindings?.length??0)>0,async processActivated(r,i,a){let o=a.getService(F);if(!o)throw Error(`SurfaceBindingRegistry is not available — ensure surface-binding-registry is started before extensions with surfaceBindings.`);let s=(i.surfaceBindings?.bindings??[]).map(e=>e.toRegistration()),c=e.get(r);n(r);let l=[];try{for(let e of s)o.registerBinding(e),l.push(e)}catch(n){for(let e=l.length-1;e>=0;--e)o.deregisterBinding(l[e].id);throw $(e,o),t(r,c),n}e.set(r,{registry:o,registrations:s})},async processStopped(e){try{n(e)}catch(t){console.error(`[SurfaceBindingContributionProcessor] Deregister error for "${e}":`,t)}}}}function Di(){let e=new Map;return{filter:e=>!!e.workflowBlocks?.blocks,async processActivated(t,n,r){let i=r.getService(L);if(!i)throw Error(`WorkflowBlockRegistry is not available — ensure workflow-block-registry is started before extensions with workflowBlocks.`);await i.register(t,n.workflowBlocks.blocks),e.set(t,()=>i.deregister(t))},async processStopped(t){let n=e.get(t);if(n){try{await n()}catch(e){console.error(`[WorkflowBlockContributionProcessor] Deregister error for "${t}":`,e)}e.delete(t)}}}}function Oi(){let e=new Map;return{filter:e=>!!(e.transitionRules?.rules?.length||e.transitionActions?.actions),async processActivated(t,n,r){let i=r.getService(N);if(!i)throw Error(`TransitionContributionProcessor: TransitionPipelineService is not available — ensure '${N.name}' is started before extensions with transitionRules or transitionActions.`);let a=n.transitionRules?.rules??[],o=n.transitionActions?.actions,s=a.length>0,c=o!==void 0;s&&ki(t,a),c&&Ai(t,o);let l=!1,u=!1;try{s&&(i.ruleRegistry.register(t,a),l=!0),c&&(i.actionRegistry.register(t,o),u=!0)}catch(e){throw l&&i.ruleRegistry.deregister(t),u&&i.actionRegistry.deregister(t),e}e.set(t,()=>{s&&i.ruleRegistry.deregister(t),c&&i.actionRegistry.deregister(t)})},async processStopped(t){let n=e.get(t);if(n){try{n()}catch(e){console.error(`[TransitionContributionProcessor] Deregister error for "${t}":`,e)}e.delete(t)}}}}function ki(e,t){let n=`${e}.`;for(let e of t)if(!e.id.startsWith(n))throw Error(`TransitionContributionProcessor: rule '${e.id}' must be namespaced by extension '${n}'`)}function Ai(e,t){let n=`${e}.`;for(let e of Object.keys(t))if(!e.startsWith(n))throw Error(`TransitionContributionProcessor: action type '${e}' must be namespaced by extension '${n}'`)}const ji=[O,pt,B,_,Br,Wr,V,H,yr,br,xr,Sr,U,k,Ur,ur,ar,ui,Vr,S,R,di,A,Hr,Ct,Xt,ri,z,e,W,ni];export{ci as AdapterIdentityRegistry,Oe as AdapterRegistry,O as AdapterRuntimeNamespace,_t as AdapterRuntimeSchemas,St as AdapterRuntimeSubjects,dr as AgentInstanceStatusSchema,B as AgentRuntimeNamespace,fr as AgentRuntimeSchemas,pr as AgentRuntimeSelectionSchema,mr as AgentRuntimeSubjects,_ as AgentStorageNamespace,g as AgentStorageSubjects,jn as ArtifactLifecycleHookRegistry,P as ArtifactLifecycleHookRegistryToken,sn as ArtifactLifecycleHookRejectedError,bn as ArtifactSchemaRegistry,j as ArtifactSchemaRegistryToken,Lt as BugEntrySchema,je as CONNECTOR_SWAP_DEFAULT_PIPELINE,Kn as CachedRegistryFetcher,yn as CanonicalModelResolutionError,_n as CanonicalModelResolver,an as CanonicalModelService,Rn as CapabilityService,An as CapabilityToken,hr as CodebaseChangedEventSchema,V as CodebaseNamespace,gr as CodebaseSchemas,_r as CodebaseSubjects,Rt as CompressRequestSchema,zt as CompressResponseSchema,Bt as CompressionEventSchema,H as CompressionNamespace,Vt as CompressionSchemas,vr as CompressionSubjects,Nr as ContainerCreatedSchema,Fr as ContainerDestroyedSchema,wt as ContainerIsolatedExecutionTargetSchema,wr as ContainerIsolatedSpawnRequestSchema,Tt as ContainerLocalExecutionTargetSchema,Ar as ContainerLocalSpawnRequestSchema,Lr as ContainerRuntimeSchema,Ir as ContainerSpawnNamespace,Mr as ContainerSpawnSubjects,Tr as ContainerStartedSchema,Er as ContainerStateSchema,Pr as ContainerStoppedSchema,ot as ContextWindowTracker,U as DockerNamespace,kr as DockerSubjects,at as EmbeddingIndexManager,Et as ExecutionTargetInputSchema,Dt as ExecutionTargetListQuerySchema,k as ExecutionTargetNamespace,Ot as ExecutionTargetResolveRequestSchema,kt as ExecutionTargetSchema,At as ExecutionTargetSchemas,Nt as ExecutionTargetSubjects,jt as ExecutionTargetTypeSchema,Ht as ExtractedContextSchema,cn as FacetNamespaceRegistry,I as FacetNamespaceRegistryToken,Un as FallbackRegistryFetcher,ji as FrameworkServicesCoreNamespaces,Mt as LocalExecutionTargetSchema,tt as MakaioSession,He as MakaioSessionService,S as MessageRoutingNamespace,ze as MessageRoutingSubjects,Pt as MessageStorageNamespace,Ft as MessageStorageSubjects,R as ModelRegistryNamespace,Wn as ModelRegistryProviderNotFoundError,Bn as ModelRegistrySchema,Hn as ModelRegistrySchemas,Vn as ModelRegistryService,Gn as ModelRegistrySubjects,Cn as ModelRegistryToken,Gt as PreferenceItemSchema,Kt as PreferenceKeySchema,qt as PreferenceValueSchema,A as PreferencesNamespace,Jt as PreferencesSchemas,Yt as PreferencesSubjects,qn as ProviderModelOverrideSchema,vt as ResolveIdRequestSchema,yt as ResolveIdResponseSchema,bt as ResolveNameRequestSchema,xt as ResolveNameResponseSchema,x as SessionBridge,On as SessionBridgeToken,u as SessionEventStorageNamespace,c as SessionEventStorageSubjects,Ne as SessionExtensionContextImpl,qe as SessionLogger,Ae as SessionOrchestrator,Nn as SessionOrchestratorToken,d as SessionStorageNamespace,f as SessionStorageSubjects,wn as SessionStorageToken,M as SessionToken,Fe as SessionTurnManager,jr as SpawnRequestSchema,Or as SpawnResponseSchema,Dr as StatusRequestSchema,Cr as StatusResponseSchema,Rr as StopRequestSchema,zr as StopResponseSchema,or as SubagentManager,cr as SubagentService,lr as SubagentServiceToken,Gr as SubagentTemplateCompletedEventSchema,Kr as SubagentTemplateCreateSchema,qr as SubagentTemplateInstanceSchema,Jr as SubagentTemplateInstanceStatusSchema,W as SubagentTemplateKernelNamespace,Yr as SubagentTemplateKernelSchemas,Xr as SubagentTemplateSchema,Zr as SubagentTemplateSettingsSchemas,Qr as SubagentTemplateSpawnRequestSchema,$r as SubagentTemplateSpawnedEventSchema,ii as SubagentTemplateSubjects,ei as SubagentTemplateSummarySchema,ti as SubagentTemplateUpdateSchema,rn as SurfaceBindingRegistry,F as SurfaceBindingRegistryToken,Ut as TechnicalDetailsSchema,Wt as TodoEntrySchema,Jn as ToolApprovalService,kn as ToolApprovalToken,Qt as ToolRegistry,Tn as ToolRegistryToken,ln as TransitionActionRegistry,nn as TransitionPipelineService,N as TransitionPipelineToken,on as TransitionRuleRegistry,Yn as TrayMenuEntrySchema,Xn as TrayMenuGroupEntrySchema,Zn as TrayMenuGroupSchema,Qn as TrayMenuItemClickedSchema,$n as TrayMenuListEntrySchema,er as TrayMenuMetadataSchema,z as TrayMenuNamespace,tr as TrayMenuSchemas,nr as TrayMenuSectionSchema,ir as TrayMenuService,rr as TrayMenuSubjects,xn as TrayMenuToken,b as Turn,De as TurnContextEnricher,It as TurnStorageNamespace,t as TurnStorageSubjects,mn as WORKFLOW_START_ACTION_TYPE,Ln as WorkflowBlockRegistry,L as WorkflowBlockRegistryToken,ge as actionRegistry,gt as activateProviderContext,mt as activateProviderContextStrict,n as agents,In as artifactLifecycleHookRegistryPackage,Sn as artifactSchemaRegistryPackage,ye as assembleForkContext,oi as buildDeterministicAdapterId,ht as buildProviderContext,h as buildRecoveryContext,ie as buildRecoveryContextWithPipeline,p as buildSessionContext,xe as buildTurnInitiator,vn as canonicalModelPackage,Fn as capabilityPackage,mi as createArtifactKindContributionProcessor,gi as createArtifactLifecycleHookContributionProcessor,Ti as createFacetNamespaceContributionProcessor,hn as createModelRegistryPackage,Qe as createSessionExtensionContext,Ei as createSurfaceBindingContributionProcessor,Mn as createToolContributionProcessor,Oi as createTransitionContributionProcessor,Di as createWorkflowBlockContributionProcessor,m as ensureAgentCwd,v as ensureAgentModel,oe as extractTextContent,$t as facetNamespaceRegistryPackage,et as fetchAgentsBySession,Ye as fetchMessageCountsBySession,Je as fetchPreviewBySession,ut as fetchSessionPreviewMaps,ve as findTurnByAgent,Pn as frameworkCorePackages,re as getFullConversation,pe as getOrCreateSession,$e as importCursors,st as importCursorsDual,w as kindToBranchKind,Ie as mapAgentsBySession,Ue as mapRowToSession,C as mapToSession,zn as mergeModelMetadata,D as messageRouting,Re as messageRoutingDual,o as messages,ue as normalizeSelectionString,Ee as normalizeToBlocks,ct as parseForkTransforms,Ze as pickFallbackRuntimeOptions,ae as recoverAgent,le as registerAbandonHandler,si as registerAdapterRuntimeIdentityHandlers,Te as registerAttachHandler,be as registerBuiltInActions,se as registerCompressHandler,Xe as registerCompressLineageResolver,Ve as registerCoreSessionServiceHandlers,lt as registerDrizzleAgentStorage,Ke as registerDrizzleImportCursorStorage,ft as registerDrizzleMessageRoutingStorage,E as registerDrizzleMessageStorage,ke as registerDrizzleSessionEventStorage,Ge as registerDrizzleSessionStorage,y as registerDrizzleTurnStorage,me as registerForkHandler,nt as registerFtsSearchHandler,Pe as registerGetStatusCountsHandler,Me as registerListActionsHandler,dt as registerMemoryAgentStorage,Be as registerMemoryMessageStorage,rt as registerMemorySessionEventStorage,Le as registerMemorySessionStorage,ce as registerMemoryTurnStorage,Se as registerMergeHandler,We as registerParentResolver,T as registerResumeHandler,it as registerSpawningToolCallResolver,Ce as resetBuiltInActionsRegistration,he as resolveAdapterId,de as resolveAdapterNameById,_i as resolveArtifactContext,ai as resolveDeterministicAdapterId,te as resolveExecutionTarget,ne as resolveModelCapabilities,fe as resolveTargetAgents,we as routeToAgents,_e as routeToAgentsCore,gn as sessionBridgePackage,l as sessionEvents,s as sessionEventsDual,tn as sessionOrchestratorPackage,en as sessionPackage,fn as sessionStoragePackage,r as sessions,sr as subagentServicePackage,Dn as surfaceBindingRegistryPackage,Zt as toolApprovalPackage,En as toolRegistryPackage,un as transitionPipelinePackage,dn as trayMenuPackage,a as turns,i as turnsDual,ee as verifyAndRecoverAgents,pn as workflowBlockRegistryPackage};
|
|
1
|
+
import{agents as e,sessions as t}from"./session/storage/schema.mjs";import{n,t as r}from"../schema-CHp6I33k.mjs";import{t as i}from"../schema-7aKBGB7S.mjs";import{i as a,n as o,r as s,t as c}from"../namespace-dFBD2ZmS.mjs";import{A as l,B as u,C as d,D as f,E as p,F as m,M as h,N as ee,O as te,P as g,S as ne,T as re,_ as ie,a as ae,b as oe,c as se,d as ce,f as le,g as ue,h as de,i as fe,j as pe,k as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De,z as _}from"../handlers-v47Gbsr1.mjs";import{TurnStorageNamespace as v,TurnStorageSubjects as y}from"./turn/namespace.mjs";import{SessionStorageNamespace as b,SessionStorageSubjects as x}from"./session/storage/namespace.mjs";import{$ as S,A as C,B as w,C as T,D as E,E as Oe,F as ke,G as Ae,H as je,I as Me,J as Ne,K as D,L as Pe,M as Fe,O as Ie,P as Le,Q as Re,R as ze,S as Be,T as Ve,U as He,V as Ue,W as We,X as Ge,Y as Ke,Z as qe,a as Je,b as Ye,c as Xe,et as Ze,i as Qe,j as $e,k as et,l as tt,o as nt,q as rt,r as it,s as at,t as ot,u as st,w as ct,x as lt,y as ut,z as dt}from"../session-DCbJwYEU.mjs";import{t as ft}from"../namespace-DBHwyhME.mjs";import{n as pt,r as mt,t as ht}from"../provider-context-DC_eq7es.mjs";import{AdapterRuntimeSchemas as gt,ResolveIdRequestSchema as _t,ResolveIdResponseSchema as vt,ResolveNameRequestSchema as yt,ResolveNameResponseSchema as bt}from"./adapter-runtime/schemas.mjs";import{AdapterRuntimeNamespace as O,AdapterRuntimeSubjects as xt}from"./adapter-runtime/namespace.mjs";import{ProviderStorageNamespace as St}from"./settings/storage/providers-namespace.mjs";import{ContainerIsolatedExecutionTargetSchema as Ct,ContainerLocalExecutionTargetSchema as wt,ExecutionTargetInputSchema as Tt,ExecutionTargetListQuerySchema as Et,ExecutionTargetResolveRequestSchema as Dt,ExecutionTargetSchema as Ot,ExecutionTargetSchemas as kt,ExecutionTargetTypeSchema as At,LocalExecutionTargetSchema as jt}from"./execution-target/schemas.mjs";import{ExecutionTargetNamespace as k,ExecutionTargetSubjects as Mt}from"./execution-target/namespace.mjs";import{MessageStorageNamespace as Nt,MessageStorageSubjects as Pt}from"./session/messages/namespace.mjs";import{TurnStorageNamespace as Ft}from"./session/turns/namespace.mjs";import{BugEntrySchema as It,CompressRequestSchema as Lt,CompressResponseSchema as Rt,CompressionEventSchema as zt,CompressionSchemas as Bt,ExtractedContextSchema as Vt,TechnicalDetailsSchema as Ht,TodoEntrySchema as Ut}from"./compression/schemas.mjs";import{PreferenceItemSchema as Wt,PreferenceKeySchema as Gt,PreferenceValueSchema as Kt,PreferencesSchemas as qt}from"./preferences/schemas.mjs";import{PreferencesNamespace as A,PreferencesSubjects as Jt}from"./preferences/storage-namespace.mjs";import{t as Yt}from"../namespace-wke7juzy.mjs";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,G as nn,H as rn,I as an,J as on,K as sn,L as cn,M as ln,N as un,O as dn,P as fn,R as pn,S as mn,T as hn,U as gn,V as _n,W as vn,Y as yn,_ as bn,a as j,b as xn,c as Sn,d as Cn,f as wn,g as M,h as Tn,i as N,j as En,k as Dn,l as On,m as kn,o as An,p as P,q as jn,r as Mn,s as F,u as I,v as L,w as Nn,x as Pn,y as Fn,z as In}from"../tools-BrNm-een.mjs";import{t as Ln}from"../capability-service-XlymTzz1.mjs";import{a as Rn,c as zn,i as Bn,l as Vn,n as Hn,o as R,r as Un,s as Wn,t as Gn,u as Kn}from"../model-registry-rYICIwyR.mjs";import{t as qn}from"../tool-approval-service-MU_DmJsf.mjs";import{TrayMenuEntrySchema as Jn,TrayMenuGroupEntrySchema as Yn,TrayMenuGroupSchema as Xn,TrayMenuItemClickedSchema as Zn,TrayMenuListEntrySchema as Qn,TrayMenuMetadataSchema as $n,TrayMenuSchemas as er,TrayMenuSectionSchema as tr}from"./tray-menu/schemas.mjs";import{TrayMenuNamespace as z,TrayMenuSubjects as nr}from"./tray-menu/namespace.mjs";import{t as rr}from"../tray-menu-service-B2AxiQqL.mjs";import{n as ir}from"../handler-BFNvtv5t.mjs";import{i as ar,n as or,r as sr,t as cr}from"../package-CF_Zm2v4.mjs";import{FsNamespace as lr}from"./filesystem/namespace.mjs";import"./capability/index.mjs";import"./tool-approval/index.mjs";import"./tray-menu/index.mjs";import"./subagent/index.mjs";import{AgentInstanceStatusSchema as ur,AgentRuntimeSchemas as dr,AgentRuntimeSelectionSchema as fr}from"./agent-runtime/schemas.mjs";import{AgentRuntimeNamespace as B,AgentRuntimeSubjects as pr}from"./agent-runtime/namespace.mjs";import{CodebaseChangedEventSchema as mr,CodebaseSchemas as hr}from"./codebase/schemas.mjs";import{CodebaseNamespace as V,CodebaseSubjects as gr}from"./codebase/namespace.mjs";import{CompressionNamespace as H,CompressionSubjects as _r}from"./compression/namespace.mjs";import{r as vr,t as yr}from"../storage-namespace-D5q9CrBp.mjs";import{DefinitionNamespace as br}from"./definition/namespace.mjs";import{DialogNamespace as xr}from"./dialog/namespace.mjs";import{_ as Sr,c as Cr,d as wr,f as Tr,g as Er,h as Dr,i as Or,l as kr,m as Ar,n as jr,o as Mr,p as Nr,r as U,s as Pr,t as Fr,u as Ir,v as Lr,y as Rr}from"../execution-target-BR8bLkCR.mjs";import{CLIDetectionNamespace as zr}from"./cli-detection/namespace.mjs";import{LocalNotificationNamespace as Br}from"./local-notification/namespace.mjs";import{t as Vr}from"../namespace-CVMZVqB5.mjs";import{ExtensionConfigStorageNamespace as Hr}from"./settings/storage/extension-configs/namespace.mjs";import{ClientStorageNamespace as Ur}from"./settings/storage/clients-namespace.mjs";import{SubagentTemplateCompletedEventSchema as Wr,SubagentTemplateCreateSchema as Gr,SubagentTemplateInstanceSchema as Kr,SubagentTemplateInstanceStatusSchema as qr,SubagentTemplateKernelSchemas as Jr,SubagentTemplateSchema as Yr,SubagentTemplateSettingsSchemas as Xr,SubagentTemplateSpawnRequestSchema as Zr,SubagentTemplateSpawnedEventSchema as Qr,SubagentTemplateSummarySchema as $r,SubagentTemplateUpdateSchema as ei}from"./subagent-template/schemas.mjs";import{r as ti,t as ni}from"../namespace-BO3tODGC.mjs";import{SubagentTemplateKernelNamespace as W,SubagentTemplateSubjects as ri}from"./subagent-template/namespace.mjs";import{i as ii,n as ai,r as oi,t as si}from"../identity-BarL3JYI.mjs";import"./adapter-runtime/index.mjs";import"./agent-runtime/index.mjs";import"./codebase/index.mjs";import"./compression/index.mjs";import"./preferences/index.mjs";import"./subagent-template/index.mjs";import{ArtifactSubjects as ci}from"@makaio/framework/contracts";import{ImportCursorStorageNamespace as li}from"@makaio/framework/adapters";import{ModelRegistryPublicNamespace as ui}from"@makaio/framework/contracts/model-registry";function di(e){return{source:`extension`,ownerKey:`extension:${e}`}}function fi(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerKind(e,n.owner)}function pi(){let e=new Map,t=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterKind(t.kind,t.schemaVersion,n.owner)}fi(e,n.registry)}};return{filter:e=>(e.artifactKinds?.kinds?.length??0)>0,async processActivated(n,r,i){let a=i.getService(j);if(!a)throw Error(`ArtifactSchemaRegistry is not available — ensure artifact-schema-registry is started before extensions with artifactKinds.`);let o=(r.artifactKinds?.kinds??[]).map(e=>e.toRegistration()),s=di(n);t(n);for(let e of o)a.registerKind(e,s);e.set(n,{registry:a,owner:s,registrations:o})},async processStopped(e){try{t(e)}catch(t){console.error(`[ArtifactContributionProcessor] Deregister error for "${e}":`,t)}}}}function mi(e,t,n){return{...n,filter:{...n.filter,kind:e,schemaVersion:t}}}function hi(){let e=new Map,t=t=>{let n=e.get(t);n&&(e.delete(t),n.cleanup())};return{filter:e=>{let t=e.artifactLifecycleHooks!=null,n=(e.artifactKinds?.kinds??[]).some(e=>(e.hooks?.hooks.length??0)>0);return t||n},async processActivated(n,r,i){let a=i.getService(N);if(!a)throw Error(`ArtifactLifecycleHookRegistry is not available — ensure artifact-lifecycle-hook-registry is started before extensions with artifact lifecycle hooks.`);let o=r.artifactLifecycleHooks?[...await r.artifactLifecycleHooks.createHooks({bus:i.bus,extensionName:n})]:[],s=[];for(let e of r.artifactKinds?.kinds??[])if(e.hooks)for(let t of e.hooks.hooks)s.push(mi(e.kind,e.schemaVersion,t));let c=[...o,...s];t(n);let l=a.registerHooks(n,c);e.set(n,{cleanup:l})},async processStopped(e){try{t(e)}catch(t){console.error(`[ArtifactLifecycleHookContributionProcessor] Deregister error for "${e}":`,t)}}}}async function gi(e){let t=e.maxDepth??5,n={bus:e.bus,kindRegistry:e.kindRegistry,maxDepth:t,resolvedByKey:new Map,kindDefaultsCache:new Map,walkedByKey:new Set,refIndexByKey:new Map,resolved:[],refs:[]},r=await K(n,e.ref);if(!r)throw Error(`artifact.resolveContext: root artifact '${e.ref.kind}:${e.ref.id}:${e.ref.revision}' not found`);return n.resolved.push(r),await G(n,r,J(await q(n,r),e.selectors),0,new Set([Z(e.ref)])),{rootRef:e.ref,refs:n.refs,resolved:n.resolved}}async function G(e,t,n,r,i){let a=Ci(t,n,r,i);if(e.walkedByKey.has(a))return;e.walkedByKey.add(a);let o=bi(t);for(let a of t.relations)await _i(e,o,a,n,r,i)}async function _i(e,t,n,r,i,a){let o=r?.[n.type];if(o?.hint===`omit`)return;let s=o?.hint??`link`;if(!vi(o,n.target)){X(e,Y(t,n,s,`not-selected`));return}if(n.target.refClass!==`artifact`){X(e,Y(t,n,s,`unsupported-ref-class`));return}let c=Z(n.target),l=a.has(c);if(i>=e.maxDepth&&!l){X(e,Y(t,n,s,`depth-exceeded`));return}let u=e.resolvedByKey.has(c),d=await K(e,n.target);if(!d){X(e,Y(t,n,s,`not-found`));return}if(X(e,{sourceRef:t,target:n.target,relationType:n.type,hint:s,status:`resolved`}),u||e.resolved.push(d),l)return;let f=(o.depth??1)-1,p=f>0?{[n.type]:{...o,depth:f}}:void 0,m=J(J(await q(e,d),p),o.nested),h=new Set(a);h.add(c),await G(e,d,m,i+1,h)}async function K(e,t){let n=Z(t);if(e.resolvedByKey.has(n))return e.resolvedByKey.get(n)??null;let{artifact:r}=await e.bus.request(ci.resolve,{ref:t});return e.resolvedByKey.set(n,r),r}async function q(e,t){let n=JSON.stringify([t.kind,t.schemaVersion]);if(e.kindDefaultsCache.has(n))return e.kindDefaultsCache.get(n);let r=(await e.kindRegistry.getKind(t.kind,t.schemaVersion))?.defaultContext;return e.kindDefaultsCache.set(n,r),r}function J(e,t){if(!t)return e;if(!e)return t;let n={...e};for(let[e,r]of Object.entries(t))n[e]=r;return n}function vi(e,t){return e?e.kinds?e.kinds.includes(yi(t)):!0:!1}function yi(e){return e.refClass===`local`?e.artifact.kind:e.kind}function Y(e,t,n,r){return{sourceRef:e,target:t.target,relationType:t.type,hint:n,status:`unresolved`,reason:r}}function X(e,t){let n=xi(t),r=e.refIndexByKey.get(n);if(r===void 0){e.refIndexByKey.set(n,e.refs.length),e.refs.push(t);return}t.status===`resolved`&&e.refs[r]?.status===`unresolved`&&(e.refs[r]=t)}function bi(e){return{refClass:`artifact`,kind:e.kind,id:e.id,revision:e.revision}}function Z(e){return JSON.stringify([e.kind,e.id,e.revision])}function xi(e){return JSON.stringify([Z(e.sourceRef),e.relationType,Si(e.target)])}function Si(e){return e.refClass===`artifact`?JSON.stringify([`artifact`,e.kind,e.id,e.revision]):e.refClass===`local`?JSON.stringify([`local`,Z(e.artifact),e.localId]):JSON.stringify([`evidence`,e.kind,e.id,e.revision??null,e.locator??null])}function Ci(e,t,n,r){return JSON.stringify([e.kind,e.id,e.revision,n,t??null,[...r].sort()])}function Q(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerNamespace(e)}function wi(){let e=new Map,t=(t,n)=>{if(n){for(let e of n.registrations)n.registry.registerNamespace(e);e.set(t,n)}},n=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterNamespace(t.namespace)}Q(e,n.registry)}};return{filter:e=>(e.facetNamespaces?.namespaces?.length??0)>0,async processActivated(r,i,a){let o=a.getService(F);if(!o)throw Error(`FacetNamespaceRegistry is not available — ensure facet-namespace-registry is started before extensions with facetNamespaces.`);let s=(i.facetNamespaces?.namespaces??[]).map(e=>e.toRegistration()),c=e.get(r);n(r);let l=[];try{for(let e of s)o.registerNamespace(e),l.push(e)}catch(n){for(let e=l.length-1;e>=0;--e)o.deregisterNamespace(l[e].namespace);throw Q(e,o),t(r,c),n}e.set(r,{registry:o,registrations:s})},async processStopped(e){try{n(e)}catch(t){console.error(`[FacetNamespaceContributionProcessor] Deregister error for "${e}":`,t)}}}}function $(e,t){for(let n of e.values())if(n.registry===t)for(let e of n.registrations)t.registerBinding(e)}function Ti(){let e=new Map,t=(t,n)=>{if(n){for(let e of n.registrations)n.registry.registerBinding(e);e.set(t,n)}},n=t=>{let n=e.get(t);if(n){e.delete(t);for(let e=n.registrations.length-1;e>=0;--e){let t=n.registrations[e];n.registry.deregisterBinding(t.id)}$(e,n.registry)}};return{filter:e=>(e.surfaceBindings?.bindings?.length??0)>0,async processActivated(r,i,a){let o=a.getService(P);if(!o)throw Error(`SurfaceBindingRegistry is not available — ensure surface-binding-registry is started before extensions with surfaceBindings.`);let s=(i.surfaceBindings?.bindings??[]).map(e=>e.toRegistration()),c=e.get(r);n(r);let l=[];try{for(let e of s)o.registerBinding(e),l.push(e)}catch(n){for(let e=l.length-1;e>=0;--e)o.deregisterBinding(l[e].id);throw $(e,o),t(r,c),n}e.set(r,{registry:o,registrations:s})},async processStopped(e){try{n(e)}catch(t){console.error(`[SurfaceBindingContributionProcessor] Deregister error for "${e}":`,t)}}}}function Ei(){let e=new Map;return{filter:e=>!!e.workflowBlocks?.blocks,async processActivated(t,n,r){let i=r.getService(L);if(!i)throw Error(`WorkflowBlockRegistry is not available — ensure workflow-block-registry is started before extensions with workflowBlocks.`);await i.register(t,n.workflowBlocks.blocks),e.set(t,()=>i.deregister(t))},async processStopped(t){let n=e.get(t);if(n){try{await n()}catch(e){console.error(`[WorkflowBlockContributionProcessor] Deregister error for "${t}":`,e)}e.delete(t)}}}}function Di(){let e=new Map;return{filter:e=>!!(e.transitionRules?.rules?.length||e.transitionActions?.actions),async processActivated(t,n,r){let i=r.getService(M);if(!i)throw Error(`TransitionContributionProcessor: TransitionPipelineService is not available — ensure '${M.name}' is started before extensions with transitionRules or transitionActions.`);let a=n.transitionRules?.rules??[],o=n.transitionActions?.actions,s=a.length>0,c=o!==void 0;s&&Oi(t,a),c&&ki(t,o);let l=!1,u=!1;try{s&&(i.ruleRegistry.register(t,a),l=!0),c&&(i.actionRegistry.register(t,o),u=!0)}catch(e){throw l&&i.ruleRegistry.deregister(t),u&&i.actionRegistry.deregister(t),e}e.set(t,()=>{s&&i.ruleRegistry.deregister(t),c&&i.actionRegistry.deregister(t)})},async processStopped(t){let n=e.get(t);if(n){try{n()}catch(e){console.error(`[TransitionContributionProcessor] Deregister error for "${t}":`,e)}e.delete(t)}}}}function Oi(e,t){let n=`${e}.`;for(let e of t)if(!e.id.startsWith(n))throw Error(`TransitionContributionProcessor: rule '${e.id}' must be namespaced by extension '${n}'`)}function ki(e,t){let n=`${e}.`;for(let e of Object.keys(t))if(!e.startsWith(n))throw Error(`TransitionContributionProcessor: action type '${e}' must be namespaced by extension '${n}'`)}const Ai=[O,ft,B,g,zr,Ur,V,H,vr,yr,br,xr,U,k,Hr,lr,ir,li,Br,D,R,ui,A,Vr,St,Yt,ni,z,v,W,ti];export{si as AdapterIdentityRegistry,Re as AdapterRegistry,O as AdapterRuntimeNamespace,gt as AdapterRuntimeSchemas,xt as AdapterRuntimeSubjects,ur as AgentInstanceStatusSchema,B as AgentRuntimeNamespace,dr as AgentRuntimeSchemas,fr as AgentRuntimeSelectionSchema,pr as AgentRuntimeSubjects,g as AgentStorageNamespace,m as AgentStorageSubjects,jn as ArtifactLifecycleHookRegistry,N as ArtifactLifecycleHookRegistryToken,on as ArtifactLifecycleHookRejectedError,yn as ArtifactSchemaRegistry,j as ArtifactSchemaRegistryToken,It as BugEntrySchema,ze as CONNECTOR_SWAP_DEFAULT_PIPELINE,Gn as CachedRegistryFetcher,vn as CanonicalModelResolutionError,gn as CanonicalModelResolver,rn as CanonicalModelService,Ln as CapabilityService,An as CapabilityToken,mr as CodebaseChangedEventSchema,V as CodebaseNamespace,hr as CodebaseSchemas,gr as CodebaseSubjects,Lt as CompressRequestSchema,Rt as CompressResponseSchema,zt as CompressionEventSchema,H as CompressionNamespace,Bt as CompressionSchemas,_r as CompressionSubjects,Mr as ContainerCreatedSchema,Pr as ContainerDestroyedSchema,Ct as ContainerIsolatedExecutionTargetSchema,Cr as ContainerIsolatedSpawnRequestSchema,wt as ContainerLocalExecutionTargetSchema,kr as ContainerLocalSpawnRequestSchema,Ir as ContainerRuntimeSchema,Fr as ContainerSpawnNamespace,jr as ContainerSpawnSubjects,wr as ContainerStartedSchema,Tr as ContainerStateSchema,Nr as ContainerStoppedSchema,ot as ContextWindowTracker,U as DockerNamespace,Or as DockerSubjects,at as EmbeddingIndexManager,Tt as ExecutionTargetInputSchema,Et as ExecutionTargetListQuerySchema,k as ExecutionTargetNamespace,Dt as ExecutionTargetResolveRequestSchema,Ot as ExecutionTargetSchema,kt as ExecutionTargetSchemas,Mt as ExecutionTargetSubjects,At as ExecutionTargetTypeSchema,Vt as ExtractedContextSchema,sn as FacetNamespaceRegistry,F as FacetNamespaceRegistryToken,Hn as FallbackRegistryFetcher,Ai as FrameworkServicesCoreNamespaces,jt as LocalExecutionTargetSchema,nt as MakaioSession,S as MakaioSessionService,D as MessageRoutingNamespace,rt as MessageRoutingSubjects,Nt as MessageStorageNamespace,Pt as MessageStorageSubjects,R as ModelRegistryNamespace,Un as ModelRegistryProviderNotFoundError,zn as ModelRegistrySchema,Vn as ModelRegistrySchemas,Bn as ModelRegistryService,Wn as ModelRegistrySubjects,Sn as ModelRegistryToken,Wt as PreferenceItemSchema,Gt as PreferenceKeySchema,Kt as PreferenceValueSchema,A as PreferencesNamespace,qt as PreferencesSchemas,Jt as PreferencesSubjects,Kn as ProviderModelOverrideSchema,_t as ResolveIdRequestSchema,vt as ResolveIdResponseSchema,yt as ResolveNameRequestSchema,bt as ResolveNameResponseSchema,Me as SessionBridge,On as SessionBridgeToken,c as SessionEventStorageNamespace,o as SessionEventStorageSubjects,Le as SessionExtensionContextImpl,He as SessionOrchestrator,I as SessionOrchestratorToken,b as SessionStorageNamespace,x as SessionStorageSubjects,Cn as SessionStorageToken,wn as SessionToken,We as SessionTurnManager,Ar as SpawnRequestSchema,Dr as SpawnResponseSchema,Er as StatusRequestSchema,Sr as StatusResponseSchema,Lr as StopRequestSchema,Rr as StopResponseSchema,ar as SubagentManager,sr as SubagentService,cr as SubagentServiceToken,Wr as SubagentTemplateCompletedEventSchema,Gr as SubagentTemplateCreateSchema,Kr as SubagentTemplateInstanceSchema,qr as SubagentTemplateInstanceStatusSchema,W as SubagentTemplateKernelNamespace,Jr as SubagentTemplateKernelSchemas,Yr as SubagentTemplateSchema,Xr as SubagentTemplateSettingsSchemas,Zr as SubagentTemplateSpawnRequestSchema,Qr as SubagentTemplateSpawnedEventSchema,ri as SubagentTemplateSubjects,$r as SubagentTemplateSummarySchema,ei as SubagentTemplateUpdateSchema,nn as SurfaceBindingRegistry,P as SurfaceBindingRegistryToken,Ht as TechnicalDetailsSchema,Ut as TodoEntrySchema,qn as ToolApprovalService,kn as ToolApprovalToken,Zt as ToolRegistry,Tn as ToolRegistryToken,cn as TransitionActionRegistry,tn as TransitionPipelineService,M as TransitionPipelineToken,an as TransitionRuleRegistry,Jn as TrayMenuEntrySchema,Yn as TrayMenuGroupEntrySchema,Xn as TrayMenuGroupSchema,Zn as TrayMenuItemClickedSchema,Qn as TrayMenuListEntrySchema,$n as TrayMenuMetadataSchema,z as TrayMenuNamespace,er as TrayMenuSchemas,tr as TrayMenuSectionSchema,rr as TrayMenuService,nr as TrayMenuSubjects,bn as TrayMenuToken,De as Turn,je as TurnContextEnricher,Ft as TurnStorageNamespace,y as TurnStorageSubjects,pn as WORKFLOW_START_ACTION_TYPE,In as WorkflowBlockRegistry,L as WorkflowBlockRegistryToken,me as actionRegistry,ht as activateProviderContext,pt as activateProviderContextStrict,e as agents,Fn as artifactLifecycleHookRegistryPackage,xn as artifactSchemaRegistryPackage,_e as assembleForkContext,ai as buildDeterministicAdapterId,mt as buildProviderContext,f as buildRecoveryContext,ne as buildRecoveryContextWithPipeline,l as buildSessionContext,ye as buildTurnInitiator,_n as canonicalModelPackage,Pn as capabilityPackage,pi as createArtifactKindContributionProcessor,hi as createArtifactLifecycleHookContributionProcessor,wi as createFacetNamespaceContributionProcessor,mn as createModelRegistryPackage,ke as createSessionExtensionContext,Ti as createSurfaceBindingContributionProcessor,Mn as createToolContributionProcessor,Di as createTransitionContributionProcessor,Ei as createWorkflowBlockContributionProcessor,d as ensureAgentCwd,Te as ensureAgentModel,ie as extractTextContent,Qt as facetNamespaceRegistryPackage,Ye as fetchAgentsBySession,lt as fetchMessageCountsBySession,Be as fetchPreviewBySession,E as fetchSessionPreviewMaps,ge as findTurnByAgent,Nn as frameworkCorePackages,te as getFullConversation,de as getOrCreateSession,tt as importCursors,st as importCursorsDual,Fe as kindToBranchKind,Ie as mapAgentsBySession,T as mapRowToSession,et as mapToSession,Rn as mergeModelMetadata,Ne as messageRouting,Ke as messageRoutingDual,i as messages,ce as normalizeSelectionString,we as normalizeToBlocks,ct as parseForkTransforms,Pe as pickFallbackRuntimeOptions,re as recoverAgent,se as registerAbandonHandler,oi as registerAdapterRuntimeIdentityHandlers,Ce as registerAttachHandler,ve as registerBuiltInActions,ae as registerCompressHandler,Qe as registerCompressLineageResolver,Ze as registerCoreSessionServiceHandlers,C as registerDrizzleAgentStorage,Xe as registerDrizzleImportCursorStorage,Ae as registerDrizzleMessageRoutingStorage,qe as registerDrizzleMessageStorage,_ as registerDrizzleSessionEventStorage,Oe as registerDrizzleSessionStorage,Ee as registerDrizzleTurnStorage,fe as registerForkHandler,ut as registerFtsSearchHandler,w as registerGetStatusCountsHandler,dt as registerListActionsHandler,Ve as registerMemoryAgentStorage,Ge as registerMemoryMessageStorage,u as registerMemorySessionEventStorage,$e as registerMemorySessionStorage,oe as registerMemoryTurnStorage,be as registerMergeHandler,Je as registerParentResolver,Ue as registerResumeHandler,it as registerSpawningToolCallResolver,xe as resetBuiltInActionsRegistration,pe as resolveAdapterId,le as resolveAdapterNameById,gi as resolveArtifactContext,ii as resolveDeterministicAdapterId,h as resolveExecutionTarget,ee as resolveModelCapabilities,ue as resolveTargetAgents,Se as routeToAgents,he as routeToAgentsCore,hn as sessionBridgePackage,s as sessionEvents,a as sessionEventsDual,en as sessionOrchestratorPackage,$t as sessionPackage,dn as sessionStoragePackage,t as sessions,or as subagentServicePackage,Dn as surfaceBindingRegistryPackage,Xt as toolApprovalPackage,En as toolRegistryPackage,ln as transitionPipelinePackage,un as trayMenuPackage,r as turns,n as turnsDual,p as verifyAndRecoverAgents,fn as workflowBlockRegistryPackage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as LogImporterInfo } from "../../index-
|
|
2
|
-
import { a as OrchestratorFactory, i as OrchestratorEntry, r as LogImporterRegistration, t as LogImportRegistryOptions } from "../../types-
|
|
1
|
+
import { t as LogImporterInfo } from "../../index-D7rWAEY0.mjs";
|
|
2
|
+
import { a as OrchestratorFactory, i as OrchestratorEntry, r as LogImporterRegistration, t as LogImportRegistryOptions } from "../../types-BMlzmWp6.mjs";
|
|
3
3
|
export { type LogImportRegistryOptions, type LogImporterInfo, type LogImporterRegistration, type OrchestratorEntry, type OrchestratorFactory };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as LogImportSettings, t as LogImporterInfo } from "../../index-
|
|
2
|
-
import { a as OrchestratorFactory, i as OrchestratorEntry, n as LogImportServiceInstance, o as LogImportRegistry, r as LogImporterRegistration, t as LogImportRegistryOptions } from "../../types-
|
|
1
|
+
import { i as LogImportSettings, t as LogImporterInfo } from "../../index-D7rWAEY0.mjs";
|
|
2
|
+
import { a as OrchestratorFactory, i as OrchestratorEntry, n as LogImportServiceInstance, o as LogImportRegistry, r as LogImporterRegistration, t as LogImportRegistryOptions } from "../../types-BMlzmWp6.mjs";
|
|
3
3
|
import { LogImportNamespace, LogImportSubjects } from "./namespace.mjs";
|
|
4
4
|
import { IMakaioBus } from "@makaio/framework/bus";
|
|
5
5
|
import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
|
|
6
|
-
import { MakaioNodeExtension } from "@makaio/framework/contracts";
|
|
6
|
+
import { MakaioNodeExtension, TurnIngestionMarker } from "@makaio/framework/contracts";
|
|
7
7
|
import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
8
8
|
import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
|
|
9
9
|
import { LogImporter, ProcessLogFileResult } from "@makaio/framework/adapters";
|
|
@@ -60,12 +60,29 @@ interface SessionCompactedEventInput {
|
|
|
60
60
|
declare function appendSessionCompactedEvent(bus: IMakaioBus, event: SessionCompactedEventInput): Promise<void>;
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region services/log-import/src/import-types.d.ts
|
|
63
|
+
/** Result of a file import operation. */
|
|
64
|
+
interface ImportFromFileContentResult {
|
|
65
|
+
/** Makaio session ID that was populated. */
|
|
66
|
+
sessionId: string;
|
|
67
|
+
/** Number of messages written (created + already-present). */
|
|
68
|
+
messageCount: number;
|
|
69
|
+
/**
|
|
70
|
+
* Number of NEWLY created turns across the segment tree in this call.
|
|
71
|
+
* Re-imported turns (anchor already present) do not count.
|
|
72
|
+
*/
|
|
73
|
+
turnCount: number;
|
|
74
|
+
}
|
|
63
75
|
/** Result returned after persisting an imported segment subtree. */
|
|
64
76
|
interface ImportSegmentTreeResult {
|
|
65
77
|
/** Makaio session ID created or reused for the imported segment. */
|
|
66
78
|
sessionId: string;
|
|
67
79
|
/** Total messages persisted across the segment subtree. */
|
|
68
80
|
messageCount: number;
|
|
81
|
+
/**
|
|
82
|
+
* Number of NEWLY created turns across the segment subtree in this call.
|
|
83
|
+
* Re-imported turns (anchor already present) do not count.
|
|
84
|
+
*/
|
|
85
|
+
turnCount: number;
|
|
69
86
|
}
|
|
70
87
|
/** Minimal caller context required to persist a processed import result tree. */
|
|
71
88
|
interface PersistImportResultContext {
|
|
@@ -75,6 +92,12 @@ interface PersistImportResultContext {
|
|
|
75
92
|
adapterName: string;
|
|
76
93
|
/** Log file path on disk; only the root segment owns it. */
|
|
77
94
|
logFilePath?: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Marker stamped on the `session.turn.*` events emitted for ingested turns.
|
|
97
|
+
* Defaults to `'backfill'` (historical/watcher imports); hook-triggered
|
|
98
|
+
* live ingestion passes `'live'`.
|
|
99
|
+
*/
|
|
100
|
+
ingestionMarker?: TurnIngestionMarker;
|
|
78
101
|
}
|
|
79
102
|
//#endregion
|
|
80
103
|
//#region services/log-import/src/generic-import-handlers.d.ts
|
|
@@ -85,10 +108,54 @@ interface PersistImportResultContext {
|
|
|
85
108
|
* session creation, message persistence, compaction events, and status finalization.
|
|
86
109
|
* @param bus - Bus instance
|
|
87
110
|
* @param result - Fully processed importer result for one log file
|
|
88
|
-
* @param ctx - Adapter identity
|
|
89
|
-
* @returns Makaio session ID
|
|
111
|
+
* @param ctx - Adapter identity, optional root log file path, and optional ingestion marker
|
|
112
|
+
* @returns Makaio session ID, total persisted message count, and newly created turn count
|
|
90
113
|
*/
|
|
91
114
|
declare function persistImportResultTree(bus: IMakaioBus, result: ProcessLogFileResult, ctx: PersistImportResultContext): Promise<ImportSegmentTreeResult>;
|
|
115
|
+
/**
|
|
116
|
+
* Parse, extract, and store all messages from log file content.
|
|
117
|
+
*
|
|
118
|
+
* Core reusable import logic shared by the upload and lazy-load handlers.
|
|
119
|
+
* This function marks the session import status as `'imported'` after subtree persistence succeeds.
|
|
120
|
+
*
|
|
121
|
+
* When the importer produces `compressChildren` (from compaction boundary
|
|
122
|
+
* detection), each child is processed in order after the parent. Children
|
|
123
|
+
* use `logFilePath: null` — only the parent session owns the file reference.
|
|
124
|
+
* @param params - Import parameters
|
|
125
|
+
* @returns The Makaio session ID and total message count
|
|
126
|
+
* @throws Error if no valid records are found in the content
|
|
127
|
+
*/
|
|
128
|
+
declare function importFromFileContent(params: {
|
|
129
|
+
bus: IMakaioBus;
|
|
130
|
+
importer: LogImporter<unknown>;
|
|
131
|
+
content: string;
|
|
132
|
+
isJsonl: boolean;
|
|
133
|
+
adapterName: string;
|
|
134
|
+
adapterId: string;
|
|
135
|
+
sourceFilePath?: string;
|
|
136
|
+
persistedLogFilePath?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Marker stamped on `session.turn.*` events emitted for ingested turns.
|
|
139
|
+
* Defaults to `'backfill'` (applied at the {@link importSegmentTree} boundary).
|
|
140
|
+
*/
|
|
141
|
+
ingestionMarker?: TurnIngestionMarker;
|
|
142
|
+
}): Promise<ImportFromFileContentResult>;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region services/log-import/src/import-file-handler.d.ts
|
|
145
|
+
/**
|
|
146
|
+
* Register the importFile handler.
|
|
147
|
+
*
|
|
148
|
+
* Responds to `log-import.importFile` by parsing the given transcript file
|
|
149
|
+
* with the registered importer for `adapterName` and persisting the resulting
|
|
150
|
+
* segment tree (sessions, messages, turns). Per the subject's
|
|
151
|
+
* graceful-absence contract, a missing importer registration or a missing
|
|
152
|
+
* file yields a `skipped` result instead of an error; genuine importer or
|
|
153
|
+
* storage failures propagate.
|
|
154
|
+
* @param bus - Bus instance for communication
|
|
155
|
+
* @param getRegistration - Function to look up a registration by adapter name
|
|
156
|
+
* @returns Cleanup function to unsubscribe the handler
|
|
157
|
+
*/
|
|
158
|
+
declare function registerImportFileHandler(bus: IMakaioBus, getRegistration: (adapterName: string) => LogImporterRegistration | undefined): () => void;
|
|
92
159
|
//#endregion
|
|
93
160
|
//#region services/log-import/src/import-phase.d.ts
|
|
94
161
|
/**
|
|
@@ -265,4 +332,4 @@ declare function rowToSettings(row: SelectLogImportSettings): LogImportSettings;
|
|
|
265
332
|
*/
|
|
266
333
|
declare function registerDrizzleLogImportStorage(bus: IMakaioBus, db: MakaioDatabase): () => void;
|
|
267
334
|
//#endregion
|
|
268
|
-
export { ImportPhase, type ImportPhaseValue, LogImportNamespace, LogImportRegistry, type LogImportRegistryOptions, LogImportRegistryToken, type LogImportServiceInstance, LogImportSubjects, type LogImporterInfo, type LogImporterRegistration, type OrchestratorEntry, type OrchestratorFactory, type PersistImportResultContext, type SessionCompactedEventInput, appendSessionCompactedEvent, createLogImportContributionProcessor, logImportRegistryPackage, persistImportResultTree, registerDrizzleLogImportStorage, rowToSettings };
|
|
335
|
+
export { ImportPhase, type ImportPhaseValue, LogImportNamespace, LogImportRegistry, type LogImportRegistryOptions, LogImportRegistryToken, type LogImportServiceInstance, LogImportSubjects, type LogImporterInfo, type LogImporterRegistration, type OrchestratorEntry, type OrchestratorFactory, type PersistImportResultContext, type SessionCompactedEventInput, appendSessionCompactedEvent, createLogImportContributionProcessor, importFromFileContent, logImportRegistryPackage, persistImportResultTree, registerDrizzleLogImportStorage, registerImportFileHandler, rowToSettings };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{LogImportNamespace as e,LogImportSubjects as t}from"./namespace.mjs";import{z as n}from"zod";import*as r from"node:fs/promises";import{basename as i,dirname as a,isAbsolute as o,join as s,relative as c,resolve as l,sep as u}from"node:path";import{MakaioBus as d}from"@makaio/framework/bus";import{COMPRESS_SESSION_LINEAGE_KIND as f,CapabilitySubjects as p,FORK_SESSION_LINEAGE_KIND as m,ROOT_SESSION_LINEAGE_KIND as
|
|
2
|
-
`).filter(e=>e.trim());for(let e of n){let n=t.parseRecord(e,r);n&&i.push(n)}}else{let n=t.parseRecord(e,r);n&&i.push(n)}return i}function N(e,n){return e.on(t.scan,async t=>{let{adapterName:i}=t.payload,a=n(i);if(!a){t.setResult({adapterName:i,sessionsFound:0,newSessions:0});return}let{importer:o,logFilePattern:s,adapterName:c}=a,l=o.getLogDirectory();try{await r.access(l)}catch{t.setResult({adapterName:i,sessionsFound:0,newSessions:0});return}let u=s.endsWith(`.jsonl`),d=await j(l,s),f=0,p=0;for(let t of d)try{let n=M(await r.readFile(t,`utf8`),o,u,t);if(n.length===0)continue;let i=C(o.extractSessionContext(n).sessionEvent);f++;let{created:a}=await e.request(b.importUpsert,w(i,c,i.cwd,t,i.startedAt));a&&p++}catch(e){console.warn(`[LogImportRegistry] Failed to process ${t}:`,e instanceof Error?e.message:e)}t.setResult({adapterName:i,sessionsFound:f,newSessions:p})})}async function P(e,t,n,i,a,o){try{let a=await r.stat(i),s=t.extractSessionContext(n),c={adapterSessionId:o,model:s.model,cwd:s.cwd,sessionEvent:s.sessionEvent,startedEvent:s.startedEvent,state:t.serializeState(s.state)};await e.request(re.set,{filePath:i,bytesRead:a.size,lastModified:a.mtime.toISOString(),sessionContext:c})}catch(e){console.warn(`[importFromFileContent] Failed to persist import cursor`,{adapterName:a,adapterSessionId:o,filePath:i,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0})}}async function F(e,t,n,r,i){let a=i.find(e=>e.origin===`compact`),o=a?.contentText??null,s=r.timestamp??a?.timestamp??Date.now();await T(e,{sessionId:t,eventId:`session-compacted:${t}:${n}`,timestamp:s,trigger:r.trigger,preTokens:r.preTokens,summary:o,compressChildSessionId:n})}async function I(e,t,n){for(let r of n)await e.request(ae.upsertByAdapterMessageId,{sessionId:t,turnId:null,adapterMessageId:r.adapterMessageId,role:r.role,contentText:r.contentText,blocks:r.blocks,agentId:r.agentId,adapterSessionId:r.adapterSessionId,timestamp:r.timestamp,...r.origin!==void 0&&{origin:r.origin}})}async function L(e,t,n,r){let i=oe(t,n.model,n.cwd),a=t.messages.length>0?t.messages.reduce((e,t)=>Math.min(e,t.timestamp),1/0):void 0,{sessionId:o}=await e.request(b.importUpsert,w(i,n.adapterName,n.cwd,n.logFilePath,a,n.adapterId));await I(e,o,t.messages),r!==void 0&&t.compaction!==void 0&&await F(e,r,o,t.compaction,t.messages);let s=t.messages.length,c={adapterId:n.adapterId,adapterName:n.adapterName,model:n.model,cwd:n.cwd,logFilePath:null};for(let n of t.children??[]){let t=await L(e,n,c,o);s+=t.messageCount}return await e.request(b.updateImportStatus,{sessionId:o,importStatus:`imported`}),{sessionId:o,messageCount:s}}async function R(e,t,n){let r=C(t.sessionEvent);return L(e,ie(t),{adapterId:n.adapterId,adapterName:n.adapterName,model:r.model,cwd:r.cwd,logFilePath:n.logFilePath})}async function z(e){let{bus:t,importer:n,content:r,isJsonl:i,adapterName:a,adapterId:o,sourceFilePath:s,persistedLogFilePath:c}=e,l=M(r,n,i,s);if(l.length===0)throw Error(`No valid records found`);let u=n.processLogFile(l),d=ce(c,s,C(u.sessionEvent).cwd),{sessionId:f,messageCount:p}=await R(t,u,{adapterId:o,adapterName:a,logFilePath:d});return d!==void 0&&await P(t,n,l,d,a,u.adapterSessionId),{sessionId:f,messageCount:p}}function B(e,n){return e.on(t.uploadFiles,async t=>{let{adapterName:r,files:i}=t.payload,a=n(r);if(!a){t.setResult({adapterName:r,filesProcessed:i.length,sessionsImported:0,errors:i.map(e=>({filename:e.filename,error:`No importer registered for this adapter`}))});return}let{importer:o,logFilePattern:s,adapterName:c,id:l}=a,u=s.endsWith(`.jsonl`),d=0,f=[];for(let t of i)try{await z({bus:e,importer:o,content:Buffer.from(t.contentBase64,`base64`).toString(`utf8`),isJsonl:u,adapterName:c,adapterId:l,sourceFilePath:t.filename}),d++}catch(e){f.push({filename:t.filename,error:e instanceof Error?e.message:String(e)})}t.setResult({adapterName:r,filesProcessed:i.length,sessionsImported:d,errors:f})})}function V(e,n){return e.on(t.importSession,async t=>{let{adapterSessionId:i,adapterName:a}=t.payload,{session:o}=await e.request(b.getByAdapterSessionId,{adapterSessionId:i,source:a});if(!o)throw Error(`Session not found for external ID: ${i}`);if(o.source!==a)throw Error(`Session '${i}' belongs to adapter '${o.source}', not '${a}'`);if(!o.logFilePath)throw Error(`No log file path recorded for session with external ID '${i}'. Re-run a discovery scan to populate the file path.`);let s=n(a);if(!s)throw Error(`No importer registered for adapter '${a}'`);let{importer:c,logFilePattern:l,adapterName:u,id:d}=s,f=l.endsWith(`.jsonl`),{sessionId:p,messageCount:m}=await z({bus:e,importer:c,content:await r.readFile(o.logFilePath,`utf8`),isJsonl:f,adapterName:u,adapterId:d,sourceFilePath:o.logFilePath,persistedLogFilePath:o.logFilePath});t.setResult({sessionId:p,messageCount:m})})}function H(e){return e.hasAdapterContribution?`adapter`:`extension`}function U(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.registration;return typeof t.id==`string`&&typeof t.displayName==`string`&&typeof t.adapterName==`string`&&!!n&&typeof n==`object`&&typeof n.LogImporterClass==`function`&&typeof n.logFilePattern==`string`&&(n.LogOrchestratorClass===void 0||typeof n.LogOrchestratorClass==`function`)&&(n.LogDiscoveryOrchestratorClass===void 0||typeof n.LogDiscoveryOrchestratorClass==`function`)}function W(e,t,n){return{enabled:n?.enabled??!0,pollIntervalMs:n?.pollIntervalMs,eventsPerSecond:n?.eventsPerSecond,adapterId:e,adapterName:t,checkMakaioManaged:n?.checkMakaioManaged}}function G(e,t,n,r,i){if(!r&&!i)return null;let a=W(e,t,n);return e=>a.enabled?e===`discover`&&i?new i(a):e===`import`&&r?new r(a):null:null}async function le(e,n,r,i){try{let a=await r.requestOptional(t.getMode,{adapterName:n});if(!a.handled)return;let{mode:o}=a.data;if(o===`disabled`)return;await i(e,o)}catch(e){console.warn(`[LogImport] Failed to restore persisted mode for '${n}':`,e)}}async function K(e,t,n){if(!U(e)||n.getImporter(e.id)!==void 0)return;await n.register({id:e.id,adapterName:e.adapterName,displayName:e.displayName,source:H({hasAdapterContribution:!0}),importer:new e.registration.LogImporterClass({adapterId:e.id,adapterName:e.adapterName}),logFilePattern:e.registration.logFilePattern});let r=G(e.id,e.adapterName,e.logImportConfig,e.registration.LogOrchestratorClass,e.registration.LogDiscoveryOrchestratorClass);r&&n.setOrchestratorFactory(e.id,r),await le(e.id,e.adapterName,t,(e,t)=>n.switchMode(e,t))}async function ue(e,t,n){let r=e.on(p.register,async t=>{await K(t.payload.provider,e,n)},{filter:{capabilityId:`log-import`}});for(let r of t?.getProviders(`log-import`)??[])await K(r,e,n);return r}async function q(e,t){let n=e.get(t);if(n)try{n.orchestrator.isRunning()&&await n.orchestrator.stop()}finally{try{await n.orchestrator.dispose()}finally{e.delete(t)}}}async function de(e,t){try{await e.start()}catch(n){try{try{e.isRunning()&&await e.stop()}finally{await e.dispose()}}catch(e){console.warn(`[LogImportRegistry] Failed to clean up orchestrator after start failure for '${t}'.`,e instanceof Error?e.message:String(e))}throw n}}var J=class{bus;capabilityService;registrations=new Map;orchestrators=new Map;cleanupHandlers=[];initialized=!1;constructor(e){this.bus=e?.bus??d,this.capabilityService=e?.capabilityService}async init(){if(this.initialized)return;let e=this.bus.on(t.listImporters,e=>{let t=this.listImporters();e.setResult({importers:t})});this.cleanupHandlers.push(e);let n=N(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(n);let r=B(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(r);let i=V(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(i);let a=await ue(this.bus,this.capabilityService,this);this.cleanupHandlers.push(a),this.initialized=!0}async register(e){if(this.registrations.has(e.id))throw Error(`Log importer '${e.id}' is already registered`);this.registrations.set(e.id,e)}async unregister(e){if(!this.registrations.has(e))throw Error(`Log importer '${e}' is not registered`);await q(this.orchestrators,e),this.registrations.delete(e)}async startImporter(e){if(!this.registrations.get(e))throw Error(`Log importer '${e}' is not registered`);let t=this.orchestrators.get(e);if(!t)throw Error(`No orchestrator available for '${e}'. Orchestrators must be created and provided by the adapter or extension before starting.`);t.orchestrator.isRunning()||(await t.orchestrator.start(),t.isManaged=!0)}async stopImporter(e){let t=this.orchestrators.get(e);t&&(t.orchestrator.isRunning()&&await t.orchestrator.stop(),t.isManaged=!1)}async switchMode(e,t){let n=this.registrations.get(e);if(!n)throw Error(`Log importer '${e}' is not registered`);if(await q(this.orchestrators,e),t===`disabled`||!n.orchestratorFactory)return;let r=n.orchestratorFactory(t);r&&(await de(r,e),this.orchestrators.set(e,{orchestrator:r,isManaged:!0}))}async startDiscovery(e){return this.switchMode(e,`discover`)}setOrchestratorFactory(e,t){let n=this.registrations.get(e);if(!n)throw Error(`Cannot set orchestrator factory for unregistered importer '${e}'`);this.registrations.set(e,{...n,orchestratorFactory:t})}listImporters(){let e=[];for(let[,t]of this.registrations){let n=this.orchestrators.get(t.id)?.orchestrator.isRunning()??!1;e.push({id:t.id,adapterName:t.adapterName,displayName:t.displayName,source:t.source,logFilePattern:t.logFilePattern,isRunning:n,supportsManualImport:t.supportsManualImport??!0})}return e}getImporter(e){let t=this.registrations.get(e);return t?{...t}:void 0}getImporterByAdapterName(e){for(let t of this.registrations.values())if(t.adapterName===e)return{...t}}detectImporter(e){let t,n=0;for(let r of this.registrations.values()){let i=r.importer.canHandle(e);if(i===!1)continue;let a=i===!0?1:i.confidence;a>n&&(n=a,t=r)}return t}async registerOrchestrator(e,t){if(!this.registrations.has(e))throw Error(`Cannot register orchestrator for unregistered importer '${e}'`);await q(this.orchestrators,e),this.orchestrators.set(e,{orchestrator:t,isManaged:!1})}async destroy(){if(!(!this.initialized&&this.orchestrators.size===0&&this.cleanupHandlers.length===0)){for(let[e]of this.orchestrators)await q(this.orchestrators,e);for(let e of this.cleanupHandlers)e();this.cleanupHandlers.length=0,this.initialized=!1}}};const Y=g(`log-import-registry`),fe={name:Y.name,displayName:`Log Import Registry`,version:`0.1.0`,critical:!0,namespaces:[e],create:e=>new J({bus:e.bus})};function pe(e,t,n){return{enabled:n?.enabled??!0,pollIntervalMs:n?.pollIntervalMs,eventsPerSecond:n?.eventsPerSecond,adapterId:e,adapterName:t,checkMakaioManaged:n?.checkMakaioManaged}}function me(e,t,n){if(!n.LogOrchestratorClass&&!n.LogDiscoveryOrchestratorClass)return null;let r=pe(e,t,n.logImportConfig);return e=>r.enabled?e===`discover`&&n.LogDiscoveryOrchestratorClass?new n.LogDiscoveryOrchestratorClass(r):e===`import`&&n.LogOrchestratorClass?new n.LogOrchestratorClass(r):null:null}function X(){let e=new Map;return{filter:e=>!!e.logImport,processActivated:async(t,n,r)=>{let{logImport:i}=n;if(!i)return;let a=r.getService(Y);if(!a)throw Error(`[LogImportContributionProcessor] LogImportRegistry is not available. Ensure '${Y.name}' is listed as a dependency before activating '${t}'.`);let{adapterName:o,displayName:s,config:c}=i,l=c,u=`package:${t}`,d=H({hasAdapterContribution:!!n.adapters?.length}),f=new l.LogImporterClass({adapterId:u,adapterName:o});await a.register({id:u,adapterName:o,displayName:s,source:d,importer:f,logFilePattern:l.logFilePattern??``,supportsManualImport:l.supportsManualImport});try{let e=me(u,o,l);e&&a.setOrchestratorFactory(u,e)}catch(e){try{await a.unregister(u)}catch(e){console.error(`[LogImportContributionProcessor] Rollback of log importer '${u}' failed:`,e)}throw e}console.info(`[LogImportContributionProcessor] Registered log importer '${o}' from package: ${t}`),e.set(u,async()=>{try{await a.unregister(u)}catch(e){console.error(`[LogImportContributionProcessor] Failed to unregister log importer '${u}' during cleanup:`,e)}})},processStopped:async t=>{let n=`package:${t}`,r=e.get(n);r&&(e.delete(n),await r())}}}const he={linked:`linked`,persisted:`persisted`,finalized:`finalized`},Z=te(`log_import_settings`,e=>({adapterName:e.text(`adapter_name`).primaryKey(),mode:e.textEnum(`mode`,{enum:[`disabled`,`discover`,`import`]}).notNull().default(`disabled`),createdAt:e.epochMs(`created_at`).notNull(),updatedAt:e.epochMs(`updated_at`).notNull()})),ge=Z.sqlite,_e=Z.postgres,Q=_({logImportSettings:ge},{logImportSettings:_e});function $(e){return{adapterName:e.adapterName,mode:e.mode,createdAt:e.createdAt,updatedAt:e.updatedAt}}function ve(e){let{bus:n,db:r}=e,{logImportSettings:i}=v(r,Q);return n.on(t.getMode,async e=>{let{adapterName:t}=e.payload,[n]=await r.select().from(i).where(ne(i.adapterName,t)).limit(1);e.setResult({mode:n?.mode??`disabled`})})}function ye(e){let{bus:n,db:r}=e,{logImportSettings:i}=v(r,Q);return n.on(t.setMode,async e=>{let{adapterName:t,mode:n}=e.payload,a=Date.now();await r.insert(i).values({adapterName:t,mode:n,createdAt:a,updatedAt:a}).onConflictDoUpdate({target:i.adapterName,set:{mode:n,updatedAt:a}}),e.setResult({success:!0})})}function be(e){let{bus:n,db:r}=e,{logImportSettings:i}=v(r,Q);return n.on(t.listSettings,async e=>{let t=await r.select().from(i);e.setResult({settings:t.map($)})})}function xe(e,t){let n={bus:e,db:t},r=[ve(n),ye(n),be(n)];return()=>r.forEach(e=>e())}export{he as ImportPhase,e as LogImportNamespace,J as LogImportRegistry,Y as LogImportRegistryToken,t as LogImportSubjects,T as appendSessionCompactedEvent,X as createLogImportContributionProcessor,fe as logImportRegistryPackage,R as persistImportResultTree,xe as registerDrizzleLogImportStorage,$ as rowToSettings};
|
|
1
|
+
import{LogImportNamespace as e,LogImportSubjects as t}from"./namespace.mjs";import{z as n}from"zod";import*as r from"node:fs/promises";import{basename as i,dirname as a,isAbsolute as o,join as s,relative as c,resolve as l,sep as u}from"node:path";import{MakaioBus as d}from"@makaio/framework/bus";import{COMPRESS_SESSION_LINEAGE_KIND as f,CapabilitySubjects as p,FORK_SESSION_LINEAGE_KIND as m,ROOT_SESSION_LINEAGE_KIND as h,SUBAGENT_SESSION_LINEAGE_KIND as ee,extensionToken as te}from"@makaio/framework/contracts";import{defineDialectSchema as ne,defineDualTable as g,resolveSchema as _}from"@makaio/framework/storage/drizzle";import{eq as re}from"drizzle-orm";import{ImportCursorStorageSubjects as v,toImportSegment as ie}from"@makaio/framework/adapters";import{MessageStorageSubjects as ae,SessionEventStorageSubjects as y,SessionStorageSubjects as b,ingestCompletedTurn as oe,isPolicyDiscoveredObservedSession as se,toSessionLineage as x}from"@makaio/framework/services/session";function S(e,t){return t===void 0?{}:{[e]:t}}const ce=n.discriminatedUnion(`kind`,[n.object({adapterSessionId:n.string(),kind:n.literal(h),parentAdapterSessionId:n.null().default(null),forkPointMessageId:n.null().default(null),model:n.string().nullable().default(null),cwd:n.string().nullable().default(null),startedAt:n.number().finite().optional()}),n.object({adapterSessionId:n.string(),kind:n.literal(m),parentAdapterSessionId:n.string(),forkPointMessageId:n.string(),model:n.string().nullable().default(null),cwd:n.string().nullable().default(null),startedAt:n.number().finite().optional()}),n.object({adapterSessionId:n.string(),kind:n.literal(ee),parentAdapterSessionId:n.string(),forkPointMessageId:n.null().default(null),model:n.string().nullable().default(null),cwd:n.string().nullable().default(null),startedAt:n.number().finite().optional()}),n.object({adapterSessionId:n.string(),kind:n.literal(f),parentAdapterSessionId:n.string(),forkPointMessageId:n.null().default(null),model:n.string().nullable().default(null),cwd:n.string().nullable().default(null),startedAt:n.number().finite().optional()})]);function C(e){return ce.parse(e.payload)}function w(e,t,n,r,i,a,o,s){let c=x(e);return{externalSessionId:e.adapterSessionId,source:t,cwd:n,...S(`logFilePath`,r),...S(`startedAt`,i),...S(`adapterId`,a),...S(`clientId`,o),...S(`isSidechain`,s),...c}}function T(e,t,n){let r={adapterSessionId:e.adapterSessionId,model:t,cwd:n};switch(e.lineage.kind){case`root`:return{...r,kind:`root`,parentAdapterSessionId:null,forkPointMessageId:null};case`fork`:if(e.lineage.parentAdapterSessionId==null)throw Error(`Fork segment ${e.adapterSessionId} missing parentAdapterSessionId`);if(e.lineage.forkPointMessageId==null)throw Error(`Fork segment ${e.adapterSessionId} missing forkPointMessageId`);return{...r,kind:`fork`,parentAdapterSessionId:e.lineage.parentAdapterSessionId,forkPointMessageId:e.lineage.forkPointMessageId};case`subagent`:if(e.lineage.parentAdapterSessionId==null)throw Error(`Subagent segment ${e.adapterSessionId} missing parentAdapterSessionId`);return{...r,kind:`subagent`,parentAdapterSessionId:e.lineage.parentAdapterSessionId,forkPointMessageId:null};case`compress`:if(e.lineage.parentAdapterSessionId==null)throw Error(`Compress segment ${e.adapterSessionId} missing parentAdapterSessionId`);return{...r,kind:`compress`,parentAdapterSessionId:e.lineage.parentAdapterSessionId,forkPointMessageId:null};default:{let t=e.lineage.kind;throw Error(`Unknown lineage kind: ${String(t)}`)}}}async function E(e,t){let{events:n}=await e.request(y.getByIds,{sessionId:t.sessionId,eventIds:[t.eventId]});if(!(n.length>0))try{await e.request(y.append,{event:{sessionId:t.sessionId,eventId:t.eventId,timestamp:t.timestamp,type:`session.compacted`,payload:{trigger:t.trigger,preTokens:t.preTokens,summary:t.summary,compressChildSessionId:t.compressChildSessionId}}})}catch(n){let{events:r}=await e.request(y.getByIds,{sessionId:t.sessionId,eventIds:[t.eventId]});if(r.length>0)return;throw n}}const D=new Map,O=`MAKAIO_GLOBSTAR_DIR`,k=`MAKAIO_GLOBSTAR`,A=`MAKAIO_STAR`;function j(e){return e.replace(/[\\/]+/g,`/`).replace(/^\.\/+/,``)}function le(e,t){let n=j(e),r=j(t),a=r.includes(`/`)?n:i(n);if(r.length>200)return!1;if(!r.includes(`*`))return a===r;let o=0;for(let e of r)if(e===`*`&&(o+=1,o>64))return!1;let s=D.get(r);if(s)return D.delete(r),D.set(r,s),s.test(a);let c=r.replace(/\*\*\//g,O).replace(/\*\*/g,k).replace(/\*/g,A).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replaceAll(O,`(?:.*/)?`).replaceAll(k,`.*`).replaceAll(A,`[^/]*`),l=RegExp(`^${c}$`);if(D.size>=512){let e=D.keys().next();e.done||D.delete(e.value)}return D.set(r,l),l.test(a)}async function M(e,t,n=e){let i=[];try{let a=await r.readdir(e,{withFileTypes:!0});for(let r of a){let a=s(e,r.name);if(r.isDirectory()){let e=await M(a,t,n);i.push(...e)}else if(r.isFile()){if(!le(c(n,a).split(u).join(`/`),t))continue;i.push(a)}}}catch{}return i}function ue(e,t,n){if(e!==void 0){if(o(e))return e;if(t&&o(t))return l(a(t),e);if(n&&o(n))return l(n,e)}}function N(e,t,n=!0,r){let i=[];if(n){let n=e.split(`
|
|
2
|
+
`).filter(e=>e.trim());for(let e of n){let n=t.parseRecord(e,r);n&&i.push(n)}}else{let n=t.parseRecord(e,r);n&&i.push(n)}return i}function de(e,n){return e.on(t.scan,async t=>{let{adapterName:i}=t.payload,a=n(i);if(!a){t.setResult({adapterName:i,sessionsFound:0,newSessions:0});return}let{importer:o,logFilePattern:s,adapterName:c}=a,l=o.getLogDirectory();try{await r.access(l)}catch{t.setResult({adapterName:i,sessionsFound:0,newSessions:0});return}let u=s.endsWith(`.jsonl`),d=await M(l,s),f=0,p=0;for(let t of d)try{let n=N(await r.readFile(t,`utf8`),o,u,t);if(n.length===0)continue;let i=C(o.extractSessionContext(n).sessionEvent);f++;let{created:a}=await e.request(b.importUpsert,w(i,c,i.cwd,t,i.startedAt));a&&p++}catch(e){console.warn(`[LogImportRegistry] Failed to process ${t}:`,e instanceof Error?e.message:e)}t.setResult({adapterName:i,sessionsFound:f,newSessions:p})})}async function P(e,t,n,i,a,o,s){try{let o=await r.stat(a),c=o.size===i,l=t.extractSessionContext(n);t.processRecords(n,l);let u={adapterSessionId:s,model:l.model,cwd:l.cwd,sessionEvent:l.sessionEvent,startedEvent:l.startedEvent,state:t.serializeState(l.state)};await e.request(v.set,{filePath:a,bytesRead:i,lastModified:c?o.mtime.toISOString():new Date(0).toISOString(),sessionContext:u})}catch(e){console.warn(`[importFromFileContent] Failed to persist import cursor`,{adapterName:o,adapterSessionId:s,filePath:a,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0})}}async function F(e,t,n,r,i){let a=i.find(e=>e.origin===`compact`),o=a?.contentText??null,s=r.timestamp??a?.timestamp??Date.now();await E(e,{sessionId:t,eventId:`session-compacted:${t}:${n}`,timestamp:s,trigger:r.trigger,preTokens:r.preTokens,summary:o,compressChildSessionId:n})}async function I(e,t,n){for(let r of n)await e.request(ae.upsertByAdapterMessageId,{sessionId:t,turnId:null,adapterMessageId:r.adapterMessageId,role:r.role,contentText:r.contentText,blocks:r.blocks,agentId:r.agentId,adapterSessionId:r.adapterSessionId,timestamp:r.timestamp,...r.origin!==void 0&&{origin:r.origin}})}function L(e){return{adapterMessageId:e.adapterMessageId,role:e.role,contentText:e.contentText,blocks:e.blocks,agentId:e.agentId,adapterSessionId:e.adapterSessionId,timestamp:e.timestamp,...e.origin!==void 0&&{origin:e.origin}}}async function R(e,t,n,r,i){let a=new Map(n.messages.map(e=>[e.adapterMessageId,e])),o=new Set,s=0;for(let[n,c]of r.entries()){let l=[],u=new Set;for(let e of c.adapterMessageIds){let t=a.get(e);if(t===void 0){console.warn(`[importSegmentTree] Turn ${n+1}/${r.length} references an unknown member; skipping it`);continue}u.add(e),l.push(L(t))}if(!u.has(c.turnAnchorId)){console.warn(`[importSegmentTree] Turn ${n+1}/${r.length} is missing its anchor; skipping turn`);continue}(await oe(e,{sessionId:t,turnAnchorId:c.turnAnchorId,startedAt:c.startedAt,completedAt:c.completedAt,status:c.status??`completed`,ingestionMarker:i,messages:l})).created&&(s+=1);for(let e of u)o.add(e)}return{turnMemberIds:o,createdTurnCount:s}}async function z(e,t,n,r){let i=n.ingestionMarker??`backfill`,a=T(t,n.model,n.cwd),o=t.messages.length>0?t.messages.reduce((e,t)=>Math.min(e,t.timestamp),1/0):void 0,s=await e.requestOptional(b.getByAdapterSessionId,{adapterSessionId:a.adapterSessionId,source:n.adapterName});if(s.handled&&s.data.session!==null){let e=s.data.session;if(se(e))return{sessionId:e.sessionId,messageCount:0,turnCount:0}}let{sessionId:c}=await e.request(b.importUpsert,w(a,n.adapterName,n.cwd,n.logFilePath,o,n.adapterId,void 0,t.isSidechain)),l=0;if(t.turns!==void 0&&t.turns.length>0){let{turnMemberIds:n,createdTurnCount:r}=await R(e,c,t,t.turns,i);l+=r,await I(e,c,t.messages.filter(e=>!n.has(e.adapterMessageId)))}else await I(e,c,t.messages);r!==void 0&&t.compaction!==void 0&&await F(e,r,c,t.compaction,t.messages);let u=t.messages.length,d={adapterId:n.adapterId,adapterName:n.adapterName,model:n.model,cwd:n.cwd,logFilePath:null,ingestionMarker:i};for(let n of t.children??[]){let t=await z(e,n,d,c);u+=t.messageCount,l+=t.turnCount}return await e.request(b.updateImportStatus,{sessionId:c,importStatus:`imported`}),{sessionId:c,messageCount:u,turnCount:l}}async function B(e,t,n){let r=C(t.sessionEvent);return z(e,ie(t),{adapterId:n.adapterId,adapterName:n.adapterName,model:r.model,cwd:r.cwd,logFilePath:n.logFilePath,ingestionMarker:n.ingestionMarker})}async function V(e){let{bus:t,importer:n,content:r,isJsonl:i,adapterName:a,adapterId:o,sourceFilePath:s,persistedLogFilePath:c}=e,l=N(r,n,i,s);if(l.length===0)throw Error(`No valid records found`);let u=n.processLogFile(l),d=ue(c,s,C(u.sessionEvent).cwd),{sessionId:f,messageCount:p,turnCount:m}=await B(t,u,{adapterId:o,adapterName:a,logFilePath:d,ingestionMarker:e.ingestionMarker});return d!==void 0&&await P(t,n,l,Buffer.byteLength(r,`utf8`),d,a,u.adapterSessionId),{sessionId:f,messageCount:p,turnCount:m}}function H(e,n){return e.on(t.uploadFiles,async t=>{let{adapterName:r,files:i}=t.payload,a=n(r);if(!a){t.setResult({adapterName:r,filesProcessed:i.length,sessionsImported:0,errors:i.map(e=>({filename:e.filename,error:`No importer registered for this adapter`}))});return}let{importer:o,logFilePattern:s,adapterName:c,id:l}=a,u=s.endsWith(`.jsonl`),d=0,f=[];for(let t of i)try{await V({bus:e,importer:o,content:Buffer.from(t.contentBase64,`base64`).toString(`utf8`),isJsonl:u,adapterName:c,adapterId:l,sourceFilePath:t.filename}),d++}catch(e){f.push({filename:t.filename,error:e instanceof Error?e.message:String(e)})}t.setResult({adapterName:r,filesProcessed:i.length,sessionsImported:d,errors:f})})}function U(e,n){return e.on(t.importSession,async t=>{let{adapterSessionId:i,adapterName:a,ingestionMarker:o}=t.payload,{session:s}=await e.request(b.getByAdapterSessionId,{adapterSessionId:i,source:a});if(!s)throw Error(`Session not found for external ID: ${i}`);if(s.source!==a)throw Error(`Session '${i}' belongs to adapter '${s.source}', not '${a}'`);if(!s.logFilePath)throw Error(`No log file path recorded for session with external ID '${i}'. Re-run a discovery scan to populate the file path.`);let c=n(a);if(!c)throw Error(`No importer registered for adapter '${a}'`);let{importer:l,logFilePattern:u,adapterName:d,id:f}=c,p=u.endsWith(`.jsonl`),{sessionId:m,messageCount:h}=await V({bus:e,importer:l,content:await r.readFile(s.logFilePath,`utf8`),isJsonl:p,adapterName:d,adapterId:f,sourceFilePath:s.logFilePath,persistedLogFilePath:s.logFilePath,ingestionMarker:o??`backfill`});t.setResult({sessionId:m,messageCount:h})})}const W=new Map;async function fe(e,t,n){let{filePath:i,adapterName:a}=n,o=t(a);if(o===void 0)return{status:`skipped`,reason:`no-importer`};try{await r.stat(i)}catch{return{status:`skipped`,reason:`file-missing`}}let s=await r.readFile(i,`utf8`),c=o.logFilePattern.endsWith(`.jsonl`),{sessionId:l,messageCount:u,turnCount:d}=await V({bus:e,importer:o.importer,content:s,isJsonl:c,adapterName:o.adapterName,adapterId:o.id,sourceFilePath:i,persistedLogFilePath:i,ingestionMarker:n.ingestionMarker??`live`});return{status:`imported`,sessionId:l,messageCount:u,turnCount:d}}function G(e,n){return e.on(t.importFile,async t=>{let{filePath:r}=t.payload,i=(W.get(r)??Promise.resolve()).then(()=>fe(e,n,t.payload)),a=i.then(()=>void 0,()=>void 0);W.set(r,a),a.then(()=>{W.get(r)===a&&W.delete(r)}),t.setResult(await i)})}function K(e){return e.hasAdapterContribution?`adapter`:`extension`}function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.registration;return typeof t.id==`string`&&typeof t.displayName==`string`&&typeof t.adapterName==`string`&&!!n&&typeof n==`object`&&typeof n.LogImporterClass==`function`&&typeof n.logFilePattern==`string`&&(n.LogOrchestratorClass===void 0||typeof n.LogOrchestratorClass==`function`)&&(n.LogDiscoveryOrchestratorClass===void 0||typeof n.LogDiscoveryOrchestratorClass==`function`)}function me(e,t,n){return{enabled:n?.enabled??!0,pollIntervalMs:n?.pollIntervalMs,eventsPerSecond:n?.eventsPerSecond,adapterId:e,adapterName:t,checkMakaioManaged:n?.checkMakaioManaged}}function he(e,t,n,r,i){if(!r&&!i)return null;let a=me(e,t,n);return e=>a.enabled?e===`discover`&&i?new i(a):e===`import`&&r?new r(a):null:null}async function ge(e,n,r,i){try{let a=await r.requestOptional(t.getMode,{adapterName:n});if(!a.handled)return;let{mode:o}=a.data;if(o===`disabled`)return;await i(e,o)}catch(e){console.warn(`[LogImport] Failed to restore persisted mode for '${n}':`,e)}}async function q(e,t,n){if(!pe(e)||n.getImporter(e.id)!==void 0)return;await n.register({id:e.id,adapterName:e.adapterName,displayName:e.displayName,source:K({hasAdapterContribution:!0}),importer:new e.registration.LogImporterClass({adapterId:e.id,adapterName:e.adapterName}),logFilePattern:e.registration.logFilePattern,clientId:e.registration.clientId});let r=he(e.id,e.adapterName,e.logImportConfig,e.registration.LogOrchestratorClass,e.registration.LogDiscoveryOrchestratorClass);r&&n.setOrchestratorFactory(e.id,r),await ge(e.id,e.adapterName,t,(e,t)=>n.switchMode(e,t))}async function _e(e,t,n){let r=e.on(p.register,async t=>{await q(t.payload.provider,e,n)},{filter:{capabilityId:`log-import`}});for(let r of t?.getProviders(`log-import`)??[])await q(r,e,n);return r}async function J(e,t){let n=e.get(t);if(n)try{n.orchestrator.isRunning()&&await n.orchestrator.stop()}finally{try{await n.orchestrator.dispose()}finally{e.delete(t)}}}async function ve(e,t){try{await e.start()}catch(n){try{try{e.isRunning()&&await e.stop()}finally{await e.dispose()}}catch(e){console.warn(`[LogImportRegistry] Failed to clean up orchestrator after start failure for '${t}'.`,e instanceof Error?e.message:String(e))}throw n}}var Y=class{bus;capabilityService;registrations=new Map;orchestrators=new Map;cleanupHandlers=[];initialized=!1;constructor(e){this.bus=e?.bus??d,this.capabilityService=e?.capabilityService}async init(){if(this.initialized)return;let e=this.bus.on(t.listImporters,e=>{let t=this.listImporters();e.setResult({importers:t})});this.cleanupHandlers.push(e);let n=de(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(n);let r=H(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(r);let i=U(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(i);let a=G(this.bus,e=>this.getImporterByAdapterName(e));this.cleanupHandlers.push(a);let o=await _e(this.bus,this.capabilityService,this);this.cleanupHandlers.push(o),this.initialized=!0}async register(e){if(this.registrations.has(e.id))throw Error(`Log importer '${e.id}' is already registered`);this.registrations.set(e.id,e)}async unregister(e){if(!this.registrations.has(e))throw Error(`Log importer '${e}' is not registered`);await J(this.orchestrators,e),this.registrations.delete(e)}async startImporter(e){if(!this.registrations.get(e))throw Error(`Log importer '${e}' is not registered`);let t=this.orchestrators.get(e);if(!t)throw Error(`No orchestrator available for '${e}'. Orchestrators must be created and provided by the adapter or extension before starting.`);t.orchestrator.isRunning()||(await t.orchestrator.start(),t.isManaged=!0)}async stopImporter(e){let t=this.orchestrators.get(e);t&&(t.orchestrator.isRunning()&&await t.orchestrator.stop(),t.isManaged=!1)}async switchMode(e,t){let n=this.registrations.get(e);if(!n)throw Error(`Log importer '${e}' is not registered`);if(await J(this.orchestrators,e),t===`disabled`||!n.orchestratorFactory)return;let r=n.orchestratorFactory(t);r&&(await ve(r,e),this.orchestrators.set(e,{orchestrator:r,isManaged:!0}))}async startDiscovery(e){return this.switchMode(e,`discover`)}setOrchestratorFactory(e,t){let n=this.registrations.get(e);if(!n)throw Error(`Cannot set orchestrator factory for unregistered importer '${e}'`);this.registrations.set(e,{...n,orchestratorFactory:t})}listImporters(){let e=[];for(let[,t]of this.registrations){let n=this.orchestrators.get(t.id)?.orchestrator.isRunning()??!1;e.push({id:t.id,adapterName:t.adapterName,displayName:t.displayName,source:t.source,logFilePattern:t.logFilePattern,isRunning:n,supportsManualImport:t.supportsManualImport??!0,...t.clientId!==void 0&&{clientId:t.clientId}})}return e}getImporter(e){let t=this.registrations.get(e);return t?{...t}:void 0}getImporterByAdapterName(e){for(let t of this.registrations.values())if(t.adapterName===e)return{...t}}detectImporter(e){let t,n=0;for(let r of this.registrations.values()){let i=r.importer.canHandle(e);if(i===!1)continue;let a=i===!0?1:i.confidence;a>n&&(n=a,t=r)}return t}async registerOrchestrator(e,t){if(!this.registrations.has(e))throw Error(`Cannot register orchestrator for unregistered importer '${e}'`);await J(this.orchestrators,e),this.orchestrators.set(e,{orchestrator:t,isManaged:!1})}async destroy(){if(!(!this.initialized&&this.orchestrators.size===0&&this.cleanupHandlers.length===0)){for(let[e]of this.orchestrators)await J(this.orchestrators,e);for(let e of this.cleanupHandlers)e();this.cleanupHandlers.length=0,this.initialized=!1}}};const X=te(`log-import-registry`),ye={name:X.name,displayName:`Log Import Registry`,version:`0.1.0`,critical:!0,namespaces:[e],create:e=>new Y({bus:e.bus})};function be(e,t,n){return{enabled:n?.enabled??!0,pollIntervalMs:n?.pollIntervalMs,eventsPerSecond:n?.eventsPerSecond,adapterId:e,adapterName:t,checkMakaioManaged:n?.checkMakaioManaged}}function xe(e,t,n){if(!n.LogOrchestratorClass&&!n.LogDiscoveryOrchestratorClass)return null;let r=be(e,t,n.logImportConfig);return e=>r.enabled?e===`discover`&&n.LogDiscoveryOrchestratorClass?new n.LogDiscoveryOrchestratorClass(r):e===`import`&&n.LogOrchestratorClass?new n.LogOrchestratorClass(r):null:null}function Se(){let e=new Map;return{filter:e=>!!e.logImport,processActivated:async(t,n,r)=>{let{logImport:i}=n;if(!i)return;let a=r.getService(X);if(!a)throw Error(`[LogImportContributionProcessor] LogImportRegistry is not available. Ensure '${X.name}' is listed as a dependency before activating '${t}'.`);let{adapterName:o,displayName:s,config:c}=i,l=c,u=`package:${t}`,d=K({hasAdapterContribution:!!n.adapters?.length}),f=new l.LogImporterClass({adapterId:u,adapterName:o});await a.register({id:u,adapterName:o,displayName:s,source:d,importer:f,logFilePattern:l.logFilePattern??``,clientId:l.clientId,supportsManualImport:l.supportsManualImport});try{let e=xe(u,o,l);e&&a.setOrchestratorFactory(u,e)}catch(e){try{await a.unregister(u)}catch(e){console.error(`[LogImportContributionProcessor] Rollback of log importer '${u}' failed:`,e)}throw e}console.info(`[LogImportContributionProcessor] Registered log importer '${o}' from package: ${t}`),e.set(u,async()=>{try{await a.unregister(u)}catch(e){console.error(`[LogImportContributionProcessor] Failed to unregister log importer '${u}' during cleanup:`,e)}})},processStopped:async t=>{let n=`package:${t}`,r=e.get(n);r&&(e.delete(n),await r())}}}const Ce={linked:`linked`,persisted:`persisted`,finalized:`finalized`},Z=g(`log_import_settings`,e=>({adapterName:e.text(`adapter_name`).primaryKey(),mode:e.textEnum(`mode`,{enum:[`disabled`,`discover`,`import`]}).notNull().default(`disabled`),createdAt:e.epochMs(`created_at`).notNull(),updatedAt:e.epochMs(`updated_at`).notNull()})),we=Z.sqlite,Te=Z.postgres,Q=ne({logImportSettings:we},{logImportSettings:Te});function $(e){return{adapterName:e.adapterName,mode:e.mode,createdAt:e.createdAt,updatedAt:e.updatedAt}}function Ee(e){let{bus:n,db:r}=e,{logImportSettings:i}=_(r,Q);return n.on(t.getMode,async e=>{let{adapterName:t}=e.payload,[n]=await r.select().from(i).where(re(i.adapterName,t)).limit(1);e.setResult({mode:n?.mode??`disabled`})})}function De(e){let{bus:n,db:r}=e,{logImportSettings:i}=_(r,Q);return n.on(t.setMode,async e=>{let{adapterName:t,mode:n}=e.payload,a=Date.now();await r.insert(i).values({adapterName:t,mode:n,createdAt:a,updatedAt:a}).onConflictDoUpdate({target:i.adapterName,set:{mode:n,updatedAt:a}}),e.setResult({success:!0})})}function Oe(e){let{bus:n,db:r}=e,{logImportSettings:i}=_(r,Q);return n.on(t.listSettings,async e=>{let t=await r.select().from(i);e.setResult({settings:t.map($)})})}function ke(e,t){let n={bus:e,db:t},r=[Ee(n),De(n),Oe(n)];return()=>r.forEach(e=>e())}export{Ce as ImportPhase,e as LogImportNamespace,Y as LogImportRegistry,X as LogImportRegistryToken,t as LogImportSubjects,E as appendSessionCompactedEvent,Se as createLogImportContributionProcessor,V as importFromFileContent,ye as logImportRegistryPackage,B as persistImportResultTree,ke as registerDrizzleLogImportStorage,G as registerImportFileHandler,$ as rowToSettings};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as IMPORT_LAST_SCAN_CATEGORY, r as LogImportMode, t as LogImporterInfo } from "../../index-
|
|
1
|
+
import { n as IMPORT_LAST_SCAN_CATEGORY, r as LogImportMode, t as LogImporterInfo } from "../../index-D7rWAEY0.mjs";
|
|
2
2
|
import { LogImportSubjects } from "./namespace.mjs";
|
|
3
3
|
export { IMPORT_LAST_SCAN_CATEGORY, type LogImportMode, LogImportSubjects, type LogImporterInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../schemas-
|
|
1
|
+
import{n as e}from"../../schemas-DZGnr9Tl.mjs";import{LogImportSubjects as t}from"./namespace.mjs";export{e as IMPORT_LAST_SCAN_CATEGORY,t as LogImportSubjects};
|