@agimon-ai/doompi-session 0.0.1-alpha.2 → 0.0.1-alpha.20
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/{src/schemas/apiContracts.cjs → apiContracts.cjs} +7 -3
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/{src/schemas/apiContracts.d.mts.map → apiContracts.d.mts.map} +1 -1
- package/dist/{src/schemas/apiContracts.mjs → apiContracts.mjs} +1 -1
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/{src/services/backgroundWorkService/index.cjs → backgroundWorkService-BC0743Nn.cjs} +17 -7
- package/dist/backgroundWorkService-BC0743Nn.cjs.map +1 -0
- package/dist/{src/services/backgroundWorkService/index.mjs → backgroundWorkService-ChVXCzxj.mjs} +3 -3
- package/dist/backgroundWorkService-ChVXCzxj.mjs.map +1 -0
- package/dist/extensions/pi.cjs +12 -6
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.mts +1 -1
- package/dist/extensions/pi.d.mts.map +1 -1
- package/dist/extensions/pi.mjs +9 -3
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +154 -10
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +146 -4
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.cjs +24 -31
- package/dist/index.d.mts +295 -11
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -9
- package/dist/sessionDelivery-C_2qtUoE.cjs +954 -0
- package/dist/sessionDelivery-C_2qtUoE.cjs.map +1 -0
- package/dist/sessionDelivery-DNq4a8LB.mjs +799 -0
- package/dist/sessionDelivery-DNq4a8LB.mjs.map +1 -0
- package/package.json +16 -16
- package/dist/_virtual/_rolldown/runtime.cjs +0 -23
- package/dist/api-contracts.cjs +0 -7
- package/dist/api-contracts.d.cts +0 -2
- package/dist/api-contracts.d.mts +0 -2
- package/dist/api-contracts.mjs +0 -2
- package/dist/extensions/pi.d.cts +0 -5
- package/dist/extensions/pi.d.cts.map +0 -1
- package/dist/extensions/server.d.cts +0 -5
- package/dist/extensions/server.d.cts.map +0 -1
- package/dist/index.d.cts +0 -11
- package/dist/src/extensions/(backend)/api/session-peer/route.server.cjs +0 -7
- package/dist/src/extensions/(backend)/api/session-peer/route.server.cjs.map +0 -1
- package/dist/src/extensions/(backend)/api/session-peer/route.server.mjs +0 -8
- package/dist/src/extensions/(backend)/api/session-peer/route.server.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +0 -10
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +0 -11
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs +0 -101
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs.map +0 -1
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs +0 -99
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs.map +0 -1
- package/dist/src/schemas/apiContracts.cjs.map +0 -1
- package/dist/src/schemas/apiContracts.d.cts +0 -52
- package/dist/src/schemas/apiContracts.d.cts.map +0 -1
- package/dist/src/schemas/apiContracts.mjs.map +0 -1
- package/dist/src/services/backgroundWorkService/index.cjs.map +0 -1
- package/dist/src/services/backgroundWorkService/index.d.cts +0 -9
- package/dist/src/services/backgroundWorkService/index.d.cts.map +0 -1
- package/dist/src/services/backgroundWorkService/index.d.mts +0 -9
- package/dist/src/services/backgroundWorkService/index.d.mts.map +0 -1
- package/dist/src/services/backgroundWorkService/index.mjs.map +0 -1
- package/dist/src/services/peerInbox/index.cjs +0 -18
- package/dist/src/services/peerInbox/index.cjs.map +0 -1
- package/dist/src/services/peerInbox/index.mjs +0 -17
- package/dist/src/services/peerInbox/index.mjs.map +0 -1
- package/dist/src/services/peerInboxApi/index.cjs +0 -48
- package/dist/src/services/peerInboxApi/index.cjs.map +0 -1
- package/dist/src/services/peerInboxApi/index.mjs +0 -48
- package/dist/src/services/peerInboxApi/index.mjs.map +0 -1
- package/dist/src/services/peerTransport/index.cjs +0 -206
- package/dist/src/services/peerTransport/index.cjs.map +0 -1
- package/dist/src/services/peerTransport/index.d.cts +0 -49
- package/dist/src/services/peerTransport/index.d.cts.map +0 -1
- package/dist/src/services/peerTransport/index.d.mts +0 -49
- package/dist/src/services/peerTransport/index.d.mts.map +0 -1
- package/dist/src/services/peerTransport/index.mjs +0 -195
- package/dist/src/services/peerTransport/index.mjs.map +0 -1
- package/dist/src/services/sessionDelivery/index.cjs +0 -277
- package/dist/src/services/sessionDelivery/index.cjs.map +0 -1
- package/dist/src/services/sessionDelivery/index.d.cts +0 -10
- package/dist/src/services/sessionDelivery/index.d.cts.map +0 -1
- package/dist/src/services/sessionDelivery/index.d.mts +0 -10
- package/dist/src/services/sessionDelivery/index.d.mts.map +0 -1
- package/dist/src/services/sessionDelivery/index.mjs +0 -274
- package/dist/src/services/sessionDelivery/index.mjs.map +0 -1
- package/dist/src/services/sessionDelivery/type.cjs +0 -11
- package/dist/src/services/sessionDelivery/type.cjs.map +0 -1
- package/dist/src/services/sessionDelivery/type.d.cts +0 -73
- package/dist/src/services/sessionDelivery/type.d.cts.map +0 -1
- package/dist/src/services/sessionDelivery/type.d.mts +0 -73
- package/dist/src/services/sessionDelivery/type.d.mts.map +0 -1
- package/dist/src/services/sessionDelivery/type.mjs +0 -10
- package/dist/src/services/sessionDelivery/type.mjs.map +0 -1
- package/dist/src/services/sessionDirectory/index.cjs +0 -120
- package/dist/src/services/sessionDirectory/index.cjs.map +0 -1
- package/dist/src/services/sessionDirectory/index.d.cts +0 -7
- package/dist/src/services/sessionDirectory/index.d.cts.map +0 -1
- package/dist/src/services/sessionDirectory/index.d.mts +0 -7
- package/dist/src/services/sessionDirectory/index.d.mts.map +0 -1
- package/dist/src/services/sessionDirectory/index.mjs +0 -120
- package/dist/src/services/sessionDirectory/index.mjs.map +0 -1
- package/dist/src/services/sessionDirectory/type.d.cts +0 -54
- package/dist/src/services/sessionDirectory/type.d.cts.map +0 -1
- package/dist/src/services/sessionDirectory/type.d.mts +0 -54
- package/dist/src/services/sessionDirectory/type.d.mts.map +0 -1
- package/dist/src/services/sessionGroups/index.cjs +0 -105
- package/dist/src/services/sessionGroups/index.cjs.map +0 -1
- package/dist/src/services/sessionGroups/index.d.cts +0 -7
- package/dist/src/services/sessionGroups/index.d.cts.map +0 -1
- package/dist/src/services/sessionGroups/index.d.mts +0 -7
- package/dist/src/services/sessionGroups/index.d.mts.map +0 -1
- package/dist/src/services/sessionGroups/index.mjs +0 -104
- package/dist/src/services/sessionGroups/index.mjs.map +0 -1
- package/dist/src/services/sessionGroups/type.cjs +0 -11
- package/dist/src/services/sessionGroups/type.cjs.map +0 -1
- package/dist/src/services/sessionGroups/type.d.cts +0 -32
- package/dist/src/services/sessionGroups/type.d.cts.map +0 -1
- package/dist/src/services/sessionGroups/type.d.mts +0 -32
- package/dist/src/services/sessionGroups/type.d.mts.map +0 -1
- package/dist/src/services/sessionGroups/type.mjs +0 -11
- package/dist/src/services/sessionGroups/type.mjs.map +0 -1
- package/dist/src/services/sessionIntercom/index.cjs +0 -89
- package/dist/src/services/sessionIntercom/index.cjs.map +0 -1
- package/dist/src/services/sessionIntercom/index.d.cts +0 -11
- package/dist/src/services/sessionIntercom/index.d.cts.map +0 -1
- package/dist/src/services/sessionIntercom/index.d.mts +0 -11
- package/dist/src/services/sessionIntercom/index.d.mts.map +0 -1
- package/dist/src/services/sessionIntercom/index.mjs +0 -85
- package/dist/src/services/sessionIntercom/index.mjs.map +0 -1
- package/dist/src/services/sessionIntercom/type.cjs +0 -16
- package/dist/src/services/sessionIntercom/type.cjs.map +0 -1
- package/dist/src/services/sessionIntercom/type.d.cts +0 -60
- package/dist/src/services/sessionIntercom/type.d.cts.map +0 -1
- package/dist/src/services/sessionIntercom/type.d.mts +0 -60
- package/dist/src/services/sessionIntercom/type.d.mts.map +0 -1
- package/dist/src/services/sessionIntercom/type.mjs +0 -14
- package/dist/src/services/sessionIntercom/type.mjs.map +0 -1
- /package/dist/{src/schemas/apiContracts.d.mts → apiContracts.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["apiRoute","rootSession"],"sources":["../../generated/server.ts"],"sourcesContent":["// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/server-facet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extension-file';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/(backend)/api/session-peer/route.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-session',\n global: (context) => ({\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n }),\n workspace: (context) => ({\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n }),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n return {\n ...composeRootHooks(scopeSession),\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;AAQA,MAAM,MAAY,OAA0B,YAC1C,OAAO,UAAU,aAAc,MAAwB,OAAO,IAAI;AAEpE,MAAa,QAAQ,mBAAmB;CACtC,MAAM;CACN,SAAS,aAAa,EACpB,IAAI,MAAsC;EAAE,OAAO,CAAC,GAAGA,sBAAU,OAAO,CAAC;CAAG,EAC9E;CACA,YAAY,aAAa,EACvB,IAAI,MAAsC;EAAE,OAAO,CAAC,GAAGA,sBAAU,OAAO,CAAC;CAAG,EAC9E;CACA,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAMC,oBAAY,OAAO;EAC9C,OAAO;GACL,GAAG,iBAAiB,YAAY;GAChC,IAAI,MAAsC;IAAE,OAAO,CAAC,GAAGD,sBAAU,OAAO,CAAC;GAAG;GAC5E,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["apiRoute","rootSession"],"sources":["../../src/services/peerInbox/index.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/services/peerInboxApi/index.ts","../../src/extensions/(backend)/api/session-peer/route.server.ts","../../generated/server.ts"],"sourcesContent":["import type { DoomSessionDeliveryInboxState } from '../sessionDelivery';\n\nexport type SessionPeerInbox = (\n sourceKey: string,\n type: string,\n payload: unknown,\n) => DoomSessionDeliveryInboxState | undefined;\n\nconst inboxes = new Map<string, SessionPeerInbox>();\n\n/** Registers one live session-owned peer inbox. This registry is reachable only by the Session route. */\nexport function registerSessionPeerInbox(sessionId: string, inbox: SessionPeerInbox): () => void {\n if (inboxes.has(sessionId)) throw new Error(`Session peer inbox '${sessionId}' is already registered.`);\n inboxes.set(sessionId, inbox);\n return () => {\n if (inboxes.get(sessionId) === inbox) inboxes.delete(sessionId);\n };\n}\n\nexport function deliverSessionPeerEnvelope(\n targetSessionId: string,\n sourceKey: string,\n type: string,\n payload: unknown,\n): DoomSessionDeliveryInboxState | undefined {\n return inboxes.get(targetSessionId)?.(sourceKey, type, payload);\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { defineRoot } from '@agimon-ai/doompi-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/doompi-core/serverFacet';\n\nimport { provideBackgroundWorkService } from '../../../../services/backgroundWorkService';\nimport { registerSessionPeerInbox } from '../../../../services/peerInbox';\nimport {\n createPeerCommunication,\n parseRemoteSessionReference,\n peerSessionReference,\n readSessionPeerConfig,\n} from '../../../../services/peerTransport';\nimport { provideSessionDeliveryService } from '../../../../services/sessionDelivery';\nimport { createSessionDirectory } from '../../../../services/sessionDirectory';\nimport { createSessionGroupStore } from '../../../../services/sessionGroups';\nimport {\n DOOM_SESSION_INTERCOM_SERVICE,\n createSessionGroupDeliveryAuthorizer,\n createSessionIntercom,\n} from '../../../../services/sessionIntercom';\n\nexport default defineRoot((pluginContext: DoomServerPluginContext) => ({\n value: undefined,\n services: [\n provideBackgroundWorkService,\n (context) => {\n const agent = pluginContext.agent;\n const session = agent?.context.session;\n const communication = pluginContext.host.context.sessionCommunication;\n const homeDirectory = pluginContext.host.context.homeDirectory;\n const sessionService = pluginContext.host.context.sessionService;\n if (!agent || !session?.admitPrompt || !communication || !homeDirectory || !sessionService?.canCommunicate) {\n throw new Error(\n 'Session delivery requires the headless agent, authenticated session communication, host home directory, and communication policy.',\n );\n }\n const sessionDirectory = path.join(homeDirectory, '.pi', '.doom', 'session');\n const deliveryDirectory = path.join(sessionDirectory, 'delivery');\n fs.mkdirSync(deliveryDirectory, { recursive: true, mode: 0o700 });\n const peerCommunication = createPeerCommunication({ local: communication, homeDirectory });\n const peerConfig = readSessionPeerConfig(homeDirectory);\n const remotePeerIsGranted = (peerKey: string): boolean => {\n const peer = parseRemoteSessionReference(peerKey);\n return (\n peer !== undefined &&\n peerConfig?.peers.some(\n (candidate) =>\n candidate.hostId === peer.hostId && candidate.allowedSessionIds.includes(agent.context.sessionId),\n ) === true\n );\n };\n const fallbackAuthorization = (peerKey: string): boolean =>\n sessionService.canCommunicate?.(agent.context.sessionId, peerKey) === true || remotePeerIsGranted(peerKey);\n const groups = peerConfig\n ? createSessionGroupStore({ databasePath: path.join(sessionDirectory, 'groups.sqlite') })\n : undefined;\n const localHostId = peerConfig?.hostId;\n const selfReference = localHostId ? peerSessionReference(localHostId, agent.context.sessionId) : undefined;\n const groupAuthorization =\n groups && selfReference && localHostId\n ? createSessionGroupDeliveryAuthorizer({\n selfReference,\n groups,\n peerReference: (peerKey) =>\n parseRemoteSessionReference(peerKey) === undefined\n ? peerSessionReference(localHostId, peerKey)\n : peerKey,\n fallback: fallbackAuthorization,\n })\n : undefined;\n const { service, close: closeDelivery } = provideSessionDeliveryService(context, {\n databasePath: path.join(deliveryDirectory, `${agent.context.sessionId}.sqlite`),\n recipientKey: agent.context.sessionId,\n communication: peerCommunication,\n authorizePeer: (peerKey, metadata) => groupAuthorization?.(peerKey, metadata) ?? fallbackAuthorization(peerKey),\n admitPrompt: (prompt, delivery) => session.admitPrompt!(prompt, delivery),\n });\n const unprovide: (() => void)[] = [];\n if (groups && selfReference && peerConfig) {\n const directory = createSessionDirectory({\n authorizeDiscovery: (caller, subject) => {\n const reference = peerSessionReference(subject.hostId, subject.sessionId);\n const permitted = groups.groupsFor(caller).some((group) => group.members.includes(reference));\n return permitted ? { capabilities: ['message'] } : undefined;\n },\n });\n for (const peer of peerConfig.peers)\n for (const sessionId of peer.allowedSessionIds)\n directory.observe({\n hostId: peer.hostId,\n sessionId,\n hostIncarnation: 'unknown',\n sessionIncarnation: 'unknown',\n sequence: 0,\n observedAt: 0,\n staleAfterMs: 0,\n deliveryTarget: peerSessionReference(peer.hostId, sessionId),\n reachability: 'unknown',\n runtime: 'unknown',\n activity: 'unknown',\n voice: { eligible: 'unknown', readiness: 'unknown' },\n });\n unprovide.push(\n context.provide(\n DOOM_SESSION_INTERCOM_SERVICE,\n createSessionIntercom({ selfReference, directory, groups, delivery: service }),\n ),\n );\n }\n const unregister = registerSessionPeerInbox(agent.context.sessionId, (sourceKey, kind, payload) =>\n service.receive?.(sourceKey, kind, payload),\n );\n return async () => {\n unregister();\n for (const release of unprovide.reverse()) release();\n await closeDelivery();\n groups?.close();\n };\n },\n ],\n}));\n","import type { DoomApi, DoomApiHandler } from '@agimon-ai/doompi-core/packageApi';\n\nimport { deliverSessionPeerEnvelope } from '../peerInbox';\nimport {\n createPeerReplayGuard,\n parseSessionPeerEnvelope,\n peerSessionReference,\n readSessionPeerConfig,\n verifyPeerRequest,\n} from '../peerTransport';\n\nconst MAX_BODY_BYTES = 64 * 1024;\nconst DELIVERY_TYPES = new Set(['doom/session-delivery/envelope', 'doom/session-delivery/ack']);\n\nfunction response(status: number, error: string): Response {\n return Response.json({ error }, { status });\n}\n\n/** Narrow HMAC-authenticated endpoint that a trusted tunnel may forward without device authentication. */\nexport const peerInboxApi: DoomApi = {\n basePath: 'session-peer',\n start(context): DoomApiHandler {\n const config = context.homeDirectory === undefined ? undefined : readSessionPeerConfig(context.homeDirectory);\n const replay = context.homeDirectory === undefined ? undefined : createPeerReplayGuard(context.homeDirectory);\n return {\n async fetch(request) {\n if (request.method !== 'POST' || new URL(request.url).pathname !== '/inbox') return response(404, 'Not found.');\n if (!config) return response(503, 'Paired Session delivery is not configured.');\n const length = request.headers.get('content-length');\n if (length !== null && (!/^\\d+$/u.test(length) || Number(length) > MAX_BODY_BYTES))\n return response(413, 'Request body is too large.');\n const body = await request.text();\n if (Buffer.byteLength(body) > MAX_BODY_BYTES) return response(413, 'Request body is too large.');\n const peer = verifyPeerRequest(config, request, body);\n if (!peer) return response(401, 'Paired Session request is unauthorized.');\n if (!replay?.admit(request)) return response(409, 'Paired Session request was already received.');\n let parsed: unknown;\n try {\n parsed = JSON.parse(body) as unknown;\n } catch {\n return response(400, 'Paired Session request is malformed.');\n }\n const envelope = parseSessionPeerEnvelope(parsed);\n if (!envelope || !DELIVERY_TYPES.has(envelope.type))\n return response(400, 'Paired Session envelope is invalid.');\n if (!peer.allowedSessionIds.includes(envelope.targetSessionId))\n return response(403, 'Peer is not granted this session.');\n const state = deliverSessionPeerEnvelope(\n envelope.targetSessionId,\n peerSessionReference(peer.hostId, envelope.sourceSessionId),\n envelope.type,\n envelope.payload,\n );\n return state === undefined\n ? response(404, 'Target Session is unavailable.')\n : Response.json({ accepted: true, state }, { status: 202 });\n },\n close: () => replay?.close(),\n };\n },\n};\n","import { defineRoute } from '@agimon-ai/doompi-core/extensionFile';\n\nimport { peerInboxApi } from '../../../../services/peerInboxApi';\n\nexport default defineRoute(peerInboxApi);\n","// Generated by @agimon-ai/doompi-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/doompi-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/doompi-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/(backend)/api/session-peer/route.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n\nexport const facet = defineServerPlugin({\n name: '@agimon-ai/doompi-session',\n global: (context) => ({\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n }),\n workspace: (context) => ({\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n }),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n return {\n ...composeRootHooks(scopeSession),\n get api(): DoomServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;AAQA,MAAM,0BAAU,IAAI,IAA8B;;AAGlD,SAAgB,yBAAyB,WAAmB,OAAqC;CAC/F,IAAI,QAAQ,IAAI,SAAS,GAAG,MAAM,IAAI,MAAM,uBAAuB,UAAU,yBAAyB;CACtG,QAAQ,IAAI,WAAW,KAAK;CAC5B,aAAa;EACX,IAAI,QAAQ,IAAI,SAAS,MAAM,OAAO,QAAQ,OAAO,SAAS;CAChE;AACF;AAEA,SAAgB,2BACd,iBACA,WACA,MACA,SAC2C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StringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.provideSessionDeliveryService = require_index$5.provideSessionDeliveryService;
|
|
27
|
-
exports.readDoomSessionDelivery = require_type$2.readDoomSessionDelivery;
|
|
28
|
-
exports.readSessionIntercom = require_type$1.readSessionIntercom;
|
|
29
|
-
exports.readSessionPeerConfig = require_index$1.readSessionPeerConfig;
|
|
30
|
-
exports.requireSessionIntercom = require_type$1.requireSessionIntercom;
|
|
31
|
-
exports.sessionPeerConfigPath = require_index$1.sessionPeerConfigPath;
|
|
32
|
-
exports.verifyPeerRequest = require_index$1.verifyPeerRequest;
|
|
2
|
+
const require_sessionDelivery = require("./sessionDelivery-C_2qtUoE.cjs");
|
|
3
|
+
const require_backgroundWorkService = require("./backgroundWorkService-BC0743Nn.cjs");
|
|
4
|
+
exports.DOOM_SESSION_DELIVERY_SERVICE = require_sessionDelivery.DOOM_SESSION_DELIVERY_SERVICE;
|
|
5
|
+
exports.DOOM_SESSION_INTERCOM_SERVICE = require_sessionDelivery.DOOM_SESSION_INTERCOM_SERVICE;
|
|
6
|
+
exports.SessionGroupRevisionError = require_sessionDelivery.SessionGroupRevisionError;
|
|
7
|
+
exports.createBackgroundWorkService = require_backgroundWorkService.createBackgroundWorkService;
|
|
8
|
+
exports.createPeerCommunication = require_sessionDelivery.createPeerCommunication;
|
|
9
|
+
exports.createPeerReplayGuard = require_sessionDelivery.createPeerReplayGuard;
|
|
10
|
+
exports.createSessionDeliveryService = require_sessionDelivery.createSessionDeliveryService;
|
|
11
|
+
exports.createSessionDirectory = require_sessionDelivery.createSessionDirectory;
|
|
12
|
+
exports.createSessionGroupDeliveryAuthorizer = require_sessionDelivery.createSessionGroupDeliveryAuthorizer;
|
|
13
|
+
exports.createSessionGroupStore = require_sessionDelivery.createSessionGroupStore;
|
|
14
|
+
exports.createSessionIntercom = require_sessionDelivery.createSessionIntercom;
|
|
15
|
+
exports.parseRemoteSessionReference = require_sessionDelivery.parseRemoteSessionReference;
|
|
16
|
+
exports.peerRequestHeaders = require_sessionDelivery.peerRequestHeaders;
|
|
17
|
+
exports.peerSessionReference = require_sessionDelivery.peerSessionReference;
|
|
18
|
+
exports.provideBackgroundWorkService = require_backgroundWorkService.provideBackgroundWorkService;
|
|
19
|
+
exports.provideSessionDeliveryService = require_sessionDelivery.provideSessionDeliveryService;
|
|
20
|
+
exports.readDoomSessionDelivery = require_sessionDelivery.readDoomSessionDelivery;
|
|
21
|
+
exports.readSessionIntercom = require_sessionDelivery.readSessionIntercom;
|
|
22
|
+
exports.readSessionPeerConfig = require_sessionDelivery.readSessionPeerConfig;
|
|
23
|
+
exports.requireSessionIntercom = require_sessionDelivery.requireSessionIntercom;
|
|
24
|
+
exports.sessionPeerConfigPath = require_sessionDelivery.sessionPeerConfigPath;
|
|
25
|
+
exports.verifyPeerRequest = require_sessionDelivery.verifyPeerRequest;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,295 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { DoomBackgroundWorkService } from "@agimon-ai/doompi-core/backgroundWork";
|
|
2
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import { DoomSessionCommunicationEndpoint } from "@agimon-ai/doompi-core/hubChannel";
|
|
4
|
+
//#region src/services/backgroundWorkService/index.d.ts
|
|
5
|
+
/** Creates the generation-bound, pull-based coordinator shared by session extensions. */
|
|
6
|
+
export declare function createBackgroundWorkService(ctx: Context): DoomBackgroundWorkService;
|
|
7
|
+
/** Installs one coordinator in the current session service context. */
|
|
8
|
+
export declare function provideBackgroundWorkService(context: Context): void;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/services/peerTransport/index.d.ts
|
|
11
|
+
declare const PEER_CONFIG_VERSION = 1;
|
|
12
|
+
interface SessionPeer {
|
|
13
|
+
readonly hostId: string;
|
|
14
|
+
readonly url: string;
|
|
15
|
+
readonly secret: string;
|
|
16
|
+
/** Explicit remote durable-message targets. Empty means no delivery grant. */
|
|
17
|
+
readonly allowedSessionIds: readonly string[];
|
|
18
|
+
/** Explicit remote Voice media targets. Empty means no media grant. */
|
|
19
|
+
readonly allowedVoiceSessionIds: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
interface SessionPeerConfig {
|
|
22
|
+
readonly version: typeof PEER_CONFIG_VERSION;
|
|
23
|
+
readonly hostId: string;
|
|
24
|
+
readonly peers: readonly SessionPeer[];
|
|
25
|
+
}
|
|
26
|
+
interface RemoteSessionReference {
|
|
27
|
+
readonly hostId: string;
|
|
28
|
+
readonly sessionId: string;
|
|
29
|
+
}
|
|
30
|
+
interface SessionPeerEnvelope {
|
|
31
|
+
readonly sourceSessionId: string;
|
|
32
|
+
readonly targetSessionId: string;
|
|
33
|
+
readonly type: string;
|
|
34
|
+
readonly payload: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface SessionPeerReplayGuard {
|
|
37
|
+
admit(request: Request, now?: number): boolean;
|
|
38
|
+
close(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare function sessionPeerConfigPath(homeDirectory: string): string;
|
|
41
|
+
/** Reads operator-provisioned peers. Invalid or unreadable config fails closed. */
|
|
42
|
+
export declare function readSessionPeerConfig(homeDirectory: string): SessionPeerConfig | undefined;
|
|
43
|
+
/** `peer/<host-id>/<session-id>` is the only remote target spelling. */
|
|
44
|
+
export declare function parseRemoteSessionReference(value: string): RemoteSessionReference | undefined;
|
|
45
|
+
export declare function peerSessionReference(hostId: string, sessionId: string): string;
|
|
46
|
+
export declare function peerRequestHeaders(sourceHostId: string, peer: SessionPeer, method: string, pathname: string, body: string, now?: number): Headers;
|
|
47
|
+
/** Persists accepted peer signatures so a valid request cannot be replayed within its clock-skew window. */
|
|
48
|
+
export declare function createPeerReplayGuard(homeDirectory: string): SessionPeerReplayGuard;
|
|
49
|
+
export declare function verifyPeerRequest(config: SessionPeerConfig, request: Request, body: string, now?: number): SessionPeer | undefined;
|
|
50
|
+
/** Adds asynchronous tunnel publication to a host-bound local communication endpoint. */
|
|
51
|
+
export declare function createPeerCommunication(options: {
|
|
52
|
+
readonly local: DoomSessionCommunicationEndpoint;
|
|
53
|
+
readonly homeDirectory: string;
|
|
54
|
+
readonly fetch?: typeof fetch;
|
|
55
|
+
}): DoomSessionCommunicationEndpoint;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/services/sessionDirectory/type.d.ts
|
|
58
|
+
type SessionHostReachability = 'reachable' | 'unreachable' | 'unknown';
|
|
59
|
+
type SessionRuntimeState = 'starting' | 'ready' | 'dormant' | 'closing' | 'closed' | 'unknown';
|
|
60
|
+
type SessionActivityState = 'busy' | 'awaiting_input' | 'fully_idle' | 'unknown';
|
|
61
|
+
type SessionVoiceReadiness = 'ready' | 'not_ready' | 'unknown';
|
|
62
|
+
interface SessionPresenceFacts {
|
|
63
|
+
readonly reachability: SessionHostReachability;
|
|
64
|
+
readonly runtime: SessionRuntimeState;
|
|
65
|
+
readonly activity: SessionActivityState;
|
|
66
|
+
readonly voice: {
|
|
67
|
+
readonly eligible: boolean | 'unknown';
|
|
68
|
+
readonly readiness: SessionVoiceReadiness;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface SessionPresenceObservation extends SessionPresenceFacts {
|
|
72
|
+
readonly hostId: string;
|
|
73
|
+
readonly sessionId: string;
|
|
74
|
+
readonly hostIncarnation: string;
|
|
75
|
+
readonly sessionIncarnation: string;
|
|
76
|
+
readonly sequence: number;
|
|
77
|
+
readonly observedAt: number;
|
|
78
|
+
readonly staleAfterMs: number;
|
|
79
|
+
readonly label?: string;
|
|
80
|
+
readonly deliveryTarget: string;
|
|
81
|
+
}
|
|
82
|
+
interface SessionDiscoveryGrant {
|
|
83
|
+
readonly label?: string;
|
|
84
|
+
readonly capabilities: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
interface DiscoveredSession extends SessionPresenceFacts {
|
|
87
|
+
readonly reference: string;
|
|
88
|
+
readonly label?: string;
|
|
89
|
+
readonly capabilities: readonly string[];
|
|
90
|
+
readonly hostIncarnation: string;
|
|
91
|
+
readonly sessionIncarnation: string;
|
|
92
|
+
readonly sequence: number;
|
|
93
|
+
readonly observedAt: number;
|
|
94
|
+
readonly freshUntil: number;
|
|
95
|
+
readonly fresh: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface SessionDirectoryOptions {
|
|
98
|
+
readonly now?: () => number;
|
|
99
|
+
readonly authorizeDiscovery: (callerReference: string, subject: Readonly<Pick<SessionPresenceObservation, 'hostId' | 'sessionId' | 'label'>>) => SessionDiscoveryGrant | undefined;
|
|
100
|
+
}
|
|
101
|
+
interface SessionDirectory {
|
|
102
|
+
observe(observation: SessionPresenceObservation): boolean;
|
|
103
|
+
replaceHostSnapshot(hostId: string, hostIncarnation: string, observations: readonly SessionPresenceObservation[]): void;
|
|
104
|
+
hostDisconnected(hostId: string): void;
|
|
105
|
+
discover(callerReference: string, allowedReferences?: ReadonlySet<string>): readonly DiscoveredSession[];
|
|
106
|
+
resolveDeliveryTarget(callerReference: string, reference: string): string | undefined;
|
|
107
|
+
subscribe(callerReference: string, listener: (sessions: readonly DiscoveredSession[]) => void): () => void;
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/services/sessionDirectory/index.d.ts
|
|
111
|
+
/** In-memory authenticated presence cache. Restart deliberately forgets every observation. */
|
|
112
|
+
export declare function createSessionDirectory(options: SessionDirectoryOptions): SessionDirectory;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/services/sessionGroups/type.d.ts
|
|
115
|
+
interface SessionCommunicationGroup {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly ownerAuthority: string;
|
|
118
|
+
readonly revision: number;
|
|
119
|
+
readonly members: readonly string[];
|
|
120
|
+
}
|
|
121
|
+
interface SessionGroupMutation {
|
|
122
|
+
readonly groupId: string;
|
|
123
|
+
readonly authority: string;
|
|
124
|
+
readonly expectedRevision: number;
|
|
125
|
+
readonly add?: readonly string[];
|
|
126
|
+
readonly remove?: readonly string[];
|
|
127
|
+
}
|
|
128
|
+
interface SessionGroupStoreOptions {
|
|
129
|
+
readonly databasePath: string;
|
|
130
|
+
readonly authorizeManagement?: (authority: string, group: SessionCommunicationGroup) => boolean;
|
|
131
|
+
readonly validateEnrollment?: (groupId: string, memberReference: string) => boolean;
|
|
132
|
+
}
|
|
133
|
+
interface SessionGroupStore {
|
|
134
|
+
create(groupId: string, ownerAuthority: string, members: readonly string[]): SessionCommunicationGroup;
|
|
135
|
+
mutate(mutation: SessionGroupMutation): SessionCommunicationGroup;
|
|
136
|
+
get(groupId: string): SessionCommunicationGroup | undefined;
|
|
137
|
+
groupsFor(memberReference: string): readonly SessionCommunicationGroup[];
|
|
138
|
+
canMessage(groupId: string, sourceReference: string, targetReference: string): boolean;
|
|
139
|
+
close(): void;
|
|
140
|
+
}
|
|
141
|
+
export declare class SessionGroupRevisionError extends Error {
|
|
142
|
+
constructor(groupId: string, expected: number, actual: number);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/services/sessionGroups/index.d.ts
|
|
146
|
+
/** Opens a revisioned SQLite registry for communication-only group membership. */
|
|
147
|
+
export declare function createSessionGroupStore(options: SessionGroupStoreOptions): SessionGroupStore;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/services/sessionDelivery/type.d.ts
|
|
150
|
+
export declare const DOOM_SESSION_DELIVERY_SERVICE = "doom/session-delivery";
|
|
151
|
+
type DoomSessionDeliveryInboxState = 'accepted' | 'admitting' | 'admitted' | 'recovery_required';
|
|
152
|
+
type DoomSessionDeliveryMode = 'prompt' | 'steer' | 'followUp';
|
|
153
|
+
interface DoomSessionDeliveryMetadata extends Readonly<Record<string, string | undefined>> {
|
|
154
|
+
readonly worktreeId?: string;
|
|
155
|
+
readonly fromRole?: string;
|
|
156
|
+
}
|
|
157
|
+
interface DoomSessionDeliveryRequest {
|
|
158
|
+
readonly deliveryId?: string;
|
|
159
|
+
readonly recipientKey: string;
|
|
160
|
+
readonly kind: string;
|
|
161
|
+
readonly prompt: string;
|
|
162
|
+
readonly delivery?: DoomSessionDeliveryMode;
|
|
163
|
+
readonly metadata?: DoomSessionDeliveryMetadata;
|
|
164
|
+
}
|
|
165
|
+
interface DoomSessionInboxQuery {
|
|
166
|
+
readonly kind?: string;
|
|
167
|
+
readonly metadata?: DoomSessionDeliveryMetadata;
|
|
168
|
+
readonly state?: DoomSessionDeliveryInboxState;
|
|
169
|
+
readonly consumed?: boolean;
|
|
170
|
+
}
|
|
171
|
+
interface DoomSessionInboxEntry {
|
|
172
|
+
readonly deliveryId: string;
|
|
173
|
+
readonly senderKey: string;
|
|
174
|
+
readonly recipientKey: string;
|
|
175
|
+
readonly kind: string;
|
|
176
|
+
readonly prompt: string;
|
|
177
|
+
readonly delivery: DoomSessionDeliveryMode;
|
|
178
|
+
readonly metadata: DoomSessionDeliveryMetadata;
|
|
179
|
+
readonly state: DoomSessionDeliveryInboxState;
|
|
180
|
+
readonly consumed: boolean;
|
|
181
|
+
}
|
|
182
|
+
interface DoomSessionOutboxEntry {
|
|
183
|
+
readonly deliveryId: string;
|
|
184
|
+
readonly recipientKey: string;
|
|
185
|
+
readonly kind: string;
|
|
186
|
+
readonly metadata: DoomSessionDeliveryMetadata;
|
|
187
|
+
readonly state: 'queued' | 'acknowledged';
|
|
188
|
+
readonly recipientState?: DoomSessionDeliveryInboxState;
|
|
189
|
+
}
|
|
190
|
+
interface DoomSessionDeliveryService {
|
|
191
|
+
readonly recipientKey: string;
|
|
192
|
+
deliver(request: DoomSessionDeliveryRequest): Promise<{
|
|
193
|
+
deliveryId: string;
|
|
194
|
+
}>;
|
|
195
|
+
waitForAdmission(deliveryId: string, timeoutMs?: number): Promise<DoomSessionDeliveryInboxState | undefined>;
|
|
196
|
+
inbox(query?: DoomSessionInboxQuery): readonly DoomSessionInboxEntry[];
|
|
197
|
+
/** Optional host-routed peer envelope admission. Local-only consumers need no transport receiver. */
|
|
198
|
+
receive?(senderKey: string, kind: string, payload: unknown): DoomSessionDeliveryInboxState | undefined;
|
|
199
|
+
consume(deliveryId: string): boolean;
|
|
200
|
+
outbox(deliveryId: string): DoomSessionOutboxEntry | undefined;
|
|
201
|
+
close(): Promise<void>;
|
|
202
|
+
}
|
|
203
|
+
interface SessionDeliveryServiceOptions {
|
|
204
|
+
readonly databasePath: string;
|
|
205
|
+
readonly recipientKey: string;
|
|
206
|
+
readonly communication: DoomSessionCommunicationEndpoint;
|
|
207
|
+
/** Host-owned relationship check applied before sends, retries, and recipient acceptance. */
|
|
208
|
+
readonly authorizePeer: (peerKey: string, metadata?: DoomSessionDeliveryMetadata) => boolean;
|
|
209
|
+
readonly admitPrompt: (prompt: string, delivery?: DoomSessionDeliveryMode) => Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
declare module '@deepseek-ai/cordis' {
|
|
212
|
+
interface Context {
|
|
213
|
+
'doom/session-delivery': DoomSessionDeliveryService;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** Reads the currently active provider each time, without retaining a stale binding. */
|
|
217
|
+
export declare function readDoomSessionDelivery(context: Context): DoomSessionDeliveryService | undefined;
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/services/sessionDelivery/index.d.ts
|
|
220
|
+
/** Opens and starts one durable delivery endpoint. */
|
|
221
|
+
export declare function createSessionDeliveryService(options: SessionDeliveryServiceOptions): DoomSessionDeliveryService;
|
|
222
|
+
/**
|
|
223
|
+
* Installs a provider-owned endpoint in the current Cordis context.
|
|
224
|
+
*
|
|
225
|
+
* Returns the instance because a provider cannot read its own service back out:
|
|
226
|
+
* `ctx.get` is strict and hides an implementation while its providing fiber is
|
|
227
|
+
* LOADING, which is the whole of that fiber's own callback.
|
|
228
|
+
*/
|
|
229
|
+
export declare function provideSessionDeliveryService(context: Context, options: SessionDeliveryServiceOptions): {
|
|
230
|
+
readonly service: DoomSessionDeliveryService;
|
|
231
|
+
readonly close: () => Promise<void>;
|
|
232
|
+
};
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/services/sessionIntercom/type.d.ts
|
|
235
|
+
export declare const DOOM_SESSION_INTERCOM_SERVICE = "doom/session-intercom";
|
|
236
|
+
type SessionReportStatus = 'done' | 'blocked' | 'failed';
|
|
237
|
+
interface SessionIntercomMessage {
|
|
238
|
+
readonly deliveryId: string;
|
|
239
|
+
readonly sourceReference: string;
|
|
240
|
+
readonly targetReference: string;
|
|
241
|
+
readonly groupId: string;
|
|
242
|
+
readonly correlationId?: string;
|
|
243
|
+
readonly text: string;
|
|
244
|
+
readonly reportStatus?: SessionReportStatus;
|
|
245
|
+
readonly state: DoomSessionInboxEntry['state'];
|
|
246
|
+
readonly consumed: boolean;
|
|
247
|
+
}
|
|
248
|
+
interface SessionIntercomSendRequest {
|
|
249
|
+
readonly targetReference: string;
|
|
250
|
+
readonly groupId: string;
|
|
251
|
+
readonly text: string;
|
|
252
|
+
readonly correlationId?: string;
|
|
253
|
+
readonly deliveryId?: string;
|
|
254
|
+
}
|
|
255
|
+
interface SessionIntercomOptions {
|
|
256
|
+
readonly selfReference: string;
|
|
257
|
+
readonly directory: SessionDirectory;
|
|
258
|
+
readonly groups: SessionGroupStore;
|
|
259
|
+
readonly delivery: DoomSessionDeliveryService;
|
|
260
|
+
}
|
|
261
|
+
interface SessionIntercom {
|
|
262
|
+
discover(): readonly DiscoveredSession[];
|
|
263
|
+
send(request: SessionIntercomSendRequest): Promise<{
|
|
264
|
+
deliveryId: string;
|
|
265
|
+
}>;
|
|
266
|
+
report(request: SessionIntercomSendRequest & {
|
|
267
|
+
readonly status: SessionReportStatus;
|
|
268
|
+
}): Promise<{
|
|
269
|
+
deliveryId: string;
|
|
270
|
+
}>;
|
|
271
|
+
messages(): readonly SessionIntercomMessage[];
|
|
272
|
+
delivery(deliveryId: string): DoomSessionOutboxEntry | undefined;
|
|
273
|
+
}
|
|
274
|
+
interface SessionGroupDeliveryAuthorizationOptions {
|
|
275
|
+
readonly selfReference: string;
|
|
276
|
+
readonly groups: SessionGroupStore;
|
|
277
|
+
readonly peerReference: (peerKey: string) => string | undefined;
|
|
278
|
+
readonly fallback?: (peerKey: string, metadata: DoomSessionDeliveryMetadata | undefined) => boolean;
|
|
279
|
+
}
|
|
280
|
+
declare module '@deepseek-ai/cordis' {
|
|
281
|
+
interface Context {
|
|
282
|
+
'doom/session-intercom': SessionIntercom;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
export declare function readSessionIntercom(context: Context): SessionIntercom | undefined;
|
|
286
|
+
export declare function requireSessionIntercom(context: Context): SessionIntercom;
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/services/sessionIntercom/index.d.ts
|
|
289
|
+
/** Agent-facing intercom operations. A composition may acquire this service without gaining session controls. */
|
|
290
|
+
export declare function createSessionIntercom(options: SessionIntercomOptions): SessionIntercom;
|
|
291
|
+
/** Builds the dynamic delivery check used before every send, retry, and recipient acceptance. */
|
|
292
|
+
export declare function createSessionGroupDeliveryAuthorizer(options: SessionGroupDeliveryAuthorizationOptions): (peerKey: string, metadata: DoomSessionDeliveryMetadata | undefined) => boolean;
|
|
293
|
+
//#endregion
|
|
294
|
+
export type { DiscoveredSession, DoomSessionDeliveryInboxState, DoomSessionDeliveryMetadata, DoomSessionDeliveryMode, DoomSessionDeliveryRequest, DoomSessionDeliveryService, DoomSessionInboxEntry, DoomSessionInboxQuery, DoomSessionOutboxEntry, RemoteSessionReference, SessionActivityState, SessionCommunicationGroup, SessionDeliveryServiceOptions, SessionDirectory, SessionDirectoryOptions, SessionDiscoveryGrant, SessionGroupDeliveryAuthorizationOptions, SessionGroupMutation, SessionGroupStore, SessionGroupStoreOptions, SessionHostReachability, SessionIntercom, SessionIntercomMessage, SessionIntercomOptions, SessionIntercomSendRequest, SessionPeer, SessionPeerConfig, SessionPeerEnvelope, SessionPeerReplayGuard, SessionPresenceFacts, SessionPresenceObservation, SessionReportStatus, SessionRuntimeState, SessionVoiceReadiness };
|
|
295
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/services/backgroundWorkService/index.ts","../src/services/peerTransport/index.ts","../src/services/sessionDirectory/type.ts","../src/services/sessionDirectory/index.ts","../src/services/sessionGroups/type.ts","../src/services/sessionGroups/index.ts","../src/services/sessionDelivery/type.ts","../src/services/sessionDelivery/index.ts","../src/services/sessionIntercom/type.ts","../src/services/sessionIntercom/index.ts"],"mappings":";;;;;wBAmBgB,4BAA4B,KAAK,UAAU;;wBAoE3C,6BAA6B,SAAS;;;cChFhD;UAUW;WACN;WACA;WACA;;WAEA;;WAEA;;UAGM;WACN,gBAAgB;WAChB;WACA,gBAAgB;;UAGV;WACN;WACA;;UAGM;WACN;WACA;WACA;WACA;;UAGM;EACf,MAAM,SAAS,SAAS;EACxB;;wBAqCc,sBAAsB;;wBAKtB,sBAAsB,wBAAwB;;wBAyB9C,4BAA4B,gBAAgB;wBAK5C,qBAAqB,gBAAgB;wBAWrC,mBACd,sBACA,MAAM,aACN,gBACA,kBACA,cACA,eACC;;wBAYa,sBAAsB,wBAAwB;wBAyC9C,kBACd,QAAQ,mBACR,SAAS,SACT,cACA,eACC;;wBAmCa,wBAAwB;WAC7B,OAAO;WACP;WACA,eAAe;IACtB;;;KC1OQ;KACA;KAC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C7D,QAAQ;EACR,OAAO,qBAAqB;EAC5B,SAAS;;UAGM;WACN;WACA;WACA,eAAe;;WAEf,gBAAgB,iBAAiB,WAAW;WAC5C,cAAc,gBAAgB,WAAW,4BAA4B;;;YAIpE;IACR,yBAAyB;;;;wBAKb,wBAAwB,SAAS,UAAU;;;;wBCkD3C,6BAA6B,SAAS,gCAAgC;;;;;;;;wBAgWtE,8BACd,SAAS,SACT,SAAS;WACG,SAAS;WAAqC,aAAa;;;;qBCxd5D;KAED;UAEK;WACN;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;WACf,OAAO;WACP;;UAGM;WACN;WACA;WACA;WACA;WACA;;UAGM;WACN;WACA,WAAW;WACX,QAAQ;WACR,UAAU;;UAGJ;EACf,qBAAqB;EACrB,KAAK,SAAS,6BAA6B;IAAU;;EACrD,OACE,SAAS;aAAwC,QAAQ;MACxD;IAAU;;EACb,qBAAqB;EACrB,SAAS,qBAAqB;;UAGf;WACN;WACA,QAAQ;WACR,gBAAgB;WAChB,YAAY,iBAAiB,UAAU;;;YAItC;IACR,yBAAyB;;;wBAIb,oBAAoB,SAAS,UAAU;wBAIvC,uBAAuB,SAAS,UAAU;;;;wBCrC1C,sBAAsB,SAAS,yBAAyB;;wBA2ExD,qCACd,SAAS,4CACP,iBAAiB,UAAU"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createSessionDirectory } from "./src/services/sessionDirectory/index.mjs";
|
|
4
|
-
import { SessionGroupRevisionError } from "./src/services/sessionGroups/type.mjs";
|
|
5
|
-
import { createSessionGroupStore } from "./src/services/sessionGroups/index.mjs";
|
|
6
|
-
import { DOOM_SESSION_INTERCOM_SERVICE, readSessionIntercom, requireSessionIntercom } from "./src/services/sessionIntercom/type.mjs";
|
|
7
|
-
import { createSessionGroupDeliveryAuthorizer, createSessionIntercom } from "./src/services/sessionIntercom/index.mjs";
|
|
8
|
-
import { DOOM_SESSION_DELIVERY_SERVICE, readDoomSessionDelivery } from "./src/services/sessionDelivery/type.mjs";
|
|
9
|
-
import { createSessionDeliveryService, provideSessionDeliveryService } from "./src/services/sessionDelivery/index.mjs";
|
|
1
|
+
import { n as provideBackgroundWorkService, t as createBackgroundWorkService } from "./backgroundWorkService-ChVXCzxj.mjs";
|
|
2
|
+
import { _ as peerRequestHeaders, a as createSessionGroupDeliveryAuthorizer, b as sessionPeerConfigPath, c as readSessionIntercom, d as SessionGroupRevisionError, f as createSessionDirectory, h as parseRemoteSessionReference, i as readDoomSessionDelivery, l as requireSessionIntercom, m as createPeerReplayGuard, n as provideSessionDeliveryService, o as createSessionIntercom, p as createPeerCommunication, r as DOOM_SESSION_DELIVERY_SERVICE, s as DOOM_SESSION_INTERCOM_SERVICE, t as createSessionDeliveryService, u as createSessionGroupStore, v as peerSessionReference, x as verifyPeerRequest, y as readSessionPeerConfig } from "./sessionDelivery-DNq4a8LB.mjs";
|
|
10
3
|
export { DOOM_SESSION_DELIVERY_SERVICE, DOOM_SESSION_INTERCOM_SERVICE, SessionGroupRevisionError, createBackgroundWorkService, createPeerCommunication, createPeerReplayGuard, createSessionDeliveryService, createSessionDirectory, createSessionGroupDeliveryAuthorizer, createSessionGroupStore, createSessionIntercom, parseRemoteSessionReference, peerRequestHeaders, peerSessionReference, provideBackgroundWorkService, provideSessionDeliveryService, readDoomSessionDelivery, readSessionIntercom, readSessionPeerConfig, requireSessionIntercom, sessionPeerConfigPath, verifyPeerRequest };
|