@agimon-ai/doompi-extension-contracts 0.0.1-alpha.0
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/backgroundWork.cjs +2 -0
- package/dist/backgroundWork.cjs.map +1 -0
- package/dist/backgroundWork.d.cts +73 -0
- package/dist/backgroundWork.d.cts.map +1 -0
- package/dist/backgroundWork.d.mts +73 -0
- package/dist/backgroundWork.d.mts.map +1 -0
- package/dist/backgroundWork.mjs +2 -0
- package/dist/backgroundWork.mjs.map +1 -0
- package/dist/childProcess.cjs +2 -0
- package/dist/childProcess.cjs.map +1 -0
- package/dist/childProcess.d.cts +20 -0
- package/dist/childProcess.d.cts.map +1 -0
- package/dist/childProcess.d.mts +20 -0
- package/dist/childProcess.d.mts.map +1 -0
- package/dist/childProcess.mjs +2 -0
- package/dist/childProcess.mjs.map +1 -0
- package/dist/config.cjs +2 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +517 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +517 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +2 -0
- package/dist/config.mjs.map +1 -0
- package/dist/delegation.cjs +2 -0
- package/dist/delegation.cjs.map +1 -0
- package/dist/delegation.d.cts +114 -0
- package/dist/delegation.d.cts.map +1 -0
- package/dist/delegation.d.mts +114 -0
- package/dist/delegation.d.mts.map +1 -0
- package/dist/delegation.mjs +2 -0
- package/dist/delegation.mjs.map +1 -0
- package/dist/fablePlan.cjs +2 -0
- package/dist/fablePlan.cjs.map +1 -0
- package/dist/fablePlan.d.cts +143 -0
- package/dist/fablePlan.d.cts.map +1 -0
- package/dist/fablePlan.d.mts +143 -0
- package/dist/fablePlan.d.mts.map +1 -0
- package/dist/fablePlan.mjs +2 -0
- package/dist/fablePlan.mjs.map +1 -0
- package/dist/footer.cjs +2 -0
- package/dist/footer.cjs.map +1 -0
- package/dist/footer.d.cts +141 -0
- package/dist/footer.d.cts.map +1 -0
- package/dist/footer.d.mts +141 -0
- package/dist/footer.d.mts.map +1 -0
- package/dist/footer.mjs +2 -0
- package/dist/footer.mjs.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/leader.cjs +2 -0
- package/dist/leader.cjs.map +1 -0
- package/dist/leader.d.cts +171 -0
- package/dist/leader.d.cts.map +1 -0
- package/dist/leader.d.mts +171 -0
- package/dist/leader.d.mts.map +1 -0
- package/dist/leader.mjs +2 -0
- package/dist/leader.mjs.map +1 -0
- package/dist/mcpStatus.cjs +2 -0
- package/dist/mcpStatus.cjs.map +1 -0
- package/dist/mcpStatus.d.cts +79 -0
- package/dist/mcpStatus.d.cts.map +1 -0
- package/dist/mcpStatus.d.mts +79 -0
- package/dist/mcpStatus.d.mts.map +1 -0
- package/dist/mcpStatus.mjs +2 -0
- package/dist/mcpStatus.mjs.map +1 -0
- package/dist/mode.cjs +2 -0
- package/dist/mode.cjs.map +1 -0
- package/dist/mode.d.cts +132 -0
- package/dist/mode.d.cts.map +1 -0
- package/dist/mode.d.mts +132 -0
- package/dist/mode.d.mts.map +1 -0
- package/dist/mode.mjs +2 -0
- package/dist/mode.mjs.map +1 -0
- package/dist/protocol.cjs +2 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +83 -0
- package/dist/protocol.d.cts.map +1 -0
- package/dist/protocol.d.mts +83 -0
- package/dist/protocol.d.mts.map +1 -0
- package/dist/protocol.mjs +2 -0
- package/dist/protocol.mjs.map +1 -0
- package/dist/runnerPty.cjs +2 -0
- package/dist/runnerPty.cjs.map +1 -0
- package/dist/runnerPty.d.cts +39 -0
- package/dist/runnerPty.d.cts.map +1 -0
- package/dist/runnerPty.d.mts +39 -0
- package/dist/runnerPty.d.mts.map +1 -0
- package/dist/runnerPty.mjs +2 -0
- package/dist/runnerPty.mjs.map +1 -0
- package/dist/skills.cjs +2 -0
- package/dist/skills.cjs.map +1 -0
- package/dist/skills.d.cts +51 -0
- package/dist/skills.d.cts.map +1 -0
- package/dist/skills.d.mts +51 -0
- package/dist/skills.d.mts.map +1 -0
- package/dist/skills.mjs +2 -0
- package/dist/skills.mjs.map +1 -0
- package/dist/subagentPolicy.cjs +2 -0
- package/dist/subagentPolicy.cjs.map +1 -0
- package/dist/subagentPolicy.d.cts +47 -0
- package/dist/subagentPolicy.d.cts.map +1 -0
- package/dist/subagentPolicy.d.mts +47 -0
- package/dist/subagentPolicy.d.mts.map +1 -0
- package/dist/subagentPolicy.mjs +2 -0
- package/dist/subagentPolicy.mjs.map +1 -0
- package/dist/subagentTool.cjs +2 -0
- package/dist/subagentTool.cjs.map +1 -0
- package/dist/subagentTool.d.cts +78 -0
- package/dist/subagentTool.d.cts.map +1 -0
- package/dist/subagentTool.d.mts +78 -0
- package/dist/subagentTool.d.mts.map +1 -0
- package/dist/subagentTool.mjs +2 -0
- package/dist/subagentTool.mjs.map +1 -0
- package/dist/workflow.cjs +2 -0
- package/dist/workflow.cjs.map +1 -0
- package/dist/workflow.d.cts +15 -0
- package/dist/workflow.d.cts.map +1 -0
- package/dist/workflow.d.mts +15 -0
- package/dist/workflow.d.mts.map +1 -0
- package/dist/workflow.mjs +2 -0
- package/dist/workflow.mjs.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fablePlan.mjs","names":[],"sources":["../src/fablePlan.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport { Check, Errors } from 'typebox/value';\nimport { defineNotification } from './protocol.ts';\n\nexport const FABLE_PLAN_REQUESTER = '@agimon-ai/doompi-plan' as const;\nexport const FABLE_PLAN_RUNTIME = 'claude' as const;\nexport const FABLE_PLAN_MODEL = 'fable' as const;\nexport const FABLE_PLAN_PROFILE = 'claude/fable-plan-v1' as const;\n\nconst MAX_OPERATION_ID_LENGTH = 128;\nconst MAX_RUN_ID_LENGTH = 128;\nconst MAX_SOURCE_PATH_LENGTH = 512;\nconst MAX_ITEM_LENGTH = 4_096;\nconst MAX_GOAL_ITEMS = 8;\nconst MAX_CONSTRAINT_ITEMS = 16;\nconst MAX_DECISION_ITEMS = 16;\nconst MAX_FINDING_ITEMS = 24;\nconst MAX_QUESTION_ITEMS = 16;\nconst MAX_PLAN_LENGTH = 16_384;\nconst MAX_OUTPUT_LENGTH = 16_384;\nconst MAX_ERROR_CODE_LENGTH = 128;\nconst MAX_STATUS_LENGTH = 128;\n\nconst OperationIdSchema = Type.String({ minLength: 1, maxLength: MAX_OPERATION_ID_LENGTH });\nconst RunIdSchema = Type.String({ minLength: 1, maxLength: MAX_RUN_ID_LENGTH });\nconst ItemSchema = Type.String({ minLength: 1, maxLength: MAX_ITEM_LENGTH });\n\nexport const FablePlanFindingSchema = Type.Object(\n {\n path: Type.String({ minLength: 1, maxLength: MAX_SOURCE_PATH_LENGTH }),\n finding: ItemSchema,\n },\n { additionalProperties: false },\n);\nexport type FablePlanFinding = Static<typeof FablePlanFindingSchema>;\n\nexport const FablePlanPacketSchema = Type.Object(\n {\n goal: Type.Array(ItemSchema, { minItems: 1, maxItems: MAX_GOAL_ITEMS }),\n constraints: Type.Array(ItemSchema, { maxItems: MAX_CONSTRAINT_ITEMS }),\n decisions: Type.Array(ItemSchema, { maxItems: MAX_DECISION_ITEMS }),\n verifiedFindings: Type.Array(FablePlanFindingSchema, { maxItems: MAX_FINDING_ITEMS }),\n inferredFindings: Type.Array(ItemSchema, { maxItems: MAX_FINDING_ITEMS }),\n unresolvedQuestions: Type.Array(ItemSchema, { maxItems: MAX_QUESTION_ITEMS }),\n currentPlan: Type.Optional(Type.String({ maxLength: MAX_PLAN_LENGTH })),\n },\n { additionalProperties: false },\n);\nexport type FablePlanPacket = Static<typeof FablePlanPacketSchema>;\n\nexport const FablePlanStageSchema = Type.Union([\n Type.Literal('draft'),\n Type.Literal('review'),\n Type.Literal('completed'),\n Type.Literal('failed'),\n Type.Literal('cancelled'),\n Type.Literal('interrupted'),\n]);\nexport type FablePlanStage = Static<typeof FablePlanStageSchema>;\n\nexport const FablePlanStatusSchema = Type.Union([\n Type.Literal('completed'),\n Type.Literal('failed'),\n Type.Literal('timed_out'),\n Type.Literal('cancelled'),\n Type.Literal('interrupted'),\n]);\nexport type FablePlanStatus = Static<typeof FablePlanStatusSchema>;\n\nexport const FablePlanStartSchema = Type.Object(\n {\n requester: Type.Literal(FABLE_PLAN_REQUESTER),\n operationId: OperationIdSchema,\n runtime: Type.Literal(FABLE_PLAN_RUNTIME),\n model: Type.Literal(FABLE_PLAN_MODEL),\n profile: Type.Literal(FABLE_PLAN_PROFILE),\n packet: FablePlanPacketSchema,\n },\n { additionalProperties: false },\n);\nexport type FablePlanStartPayload = Static<typeof FablePlanStartSchema>;\n\nexport const FablePlanStartedSchema = Type.Object(\n {\n operationId: OperationIdSchema,\n runId: RunIdSchema,\n stage: Type.Union([Type.Literal('draft'), Type.Literal('review')]),\n },\n { additionalProperties: false },\n);\nexport type FablePlanStartedPayload = Static<typeof FablePlanStartedSchema>;\n\nexport const FablePlanProgressSchema = Type.Object(\n {\n operationId: OperationIdSchema,\n runId: RunIdSchema,\n stage: Type.Union([Type.Literal('draft'), Type.Literal('review')]),\n status: Type.String({ minLength: 1, maxLength: MAX_STATUS_LENGTH }),\n durationMs: Type.Integer({ minimum: 0 }),\n },\n { additionalProperties: false },\n);\nexport type FablePlanProgressPayload = Static<typeof FablePlanProgressSchema>;\n\nexport const FablePlanResultSchema = Type.Object(\n {\n operationId: OperationIdSchema,\n status: FablePlanStatusSchema,\n stage: FablePlanStageSchema,\n draft: Type.Optional(Type.String({ maxLength: MAX_OUTPUT_LENGTH })),\n review: Type.Optional(Type.String({ maxLength: MAX_OUTPUT_LENGTH })),\n draftRunId: Type.Optional(RunIdSchema),\n reviewRunId: Type.Optional(RunIdSchema),\n durationMs: Type.Integer({ minimum: 0 }),\n errorCode: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_ERROR_CODE_LENGTH })),\n },\n { additionalProperties: false },\n);\nexport type FablePlanResultPayload = Static<typeof FablePlanResultSchema>;\n\nexport const FablePlanCancelSchema = Type.Object(\n {\n requester: Type.Literal(FABLE_PLAN_REQUESTER),\n operationId: OperationIdSchema,\n reason: Type.String({ minLength: 1, maxLength: MAX_STATUS_LENGTH }),\n },\n { additionalProperties: false },\n);\nexport type FablePlanCancelPayload = Static<typeof FablePlanCancelSchema>;\n\nexport const FablePlanStart = defineNotification({\n channel: 'doom:team:fable-plan:v1:start',\n kind: 'fable-plan.start',\n payload: FablePlanStartSchema,\n});\n\nexport const FablePlanStarted = defineNotification({\n channel: 'doom:team:fable-plan:v1:started',\n kind: 'fable-plan.started',\n payload: FablePlanStartedSchema,\n});\n\nexport const FablePlanProgress = defineNotification({\n channel: 'doom:team:fable-plan:v1:progress',\n kind: 'fable-plan.progress',\n payload: FablePlanProgressSchema,\n});\n\nexport const FablePlanResult = defineNotification({\n channel: 'doom:team:fable-plan:v1:result',\n kind: 'fable-plan.result',\n payload: FablePlanResultSchema,\n});\n\nexport const FablePlanCancel = defineNotification({\n channel: 'doom:team:fable-plan:v1:cancel',\n kind: 'fable-plan.cancel',\n payload: FablePlanCancelSchema,\n});\n\nexport interface FablePlanBrokerProvider {\n start(request: FablePlanStartPayload, signal: AbortSignal): Promise<FablePlanResultPayload>;\n cancel(request: FablePlanCancelPayload): void;\n}\n\nexport interface FablePlanBrokerClient extends FablePlanBrokerProvider {\n isAvailable(): boolean;\n}\n\nexport interface FablePlanBrokerRegistration {\n dispose(): void;\n}\n\n// Keyed by session id alone, on `globalThis`. An earlier version also keyed on a\n// host object and took `pi.events` for it, which could never match: Pi builds a\n// separate extension API per extension and `events` is a fresh object literal in\n// each one, so the provider (doom-team) and the consumer (doom-plan) always looked\n// at different keys and the broker read as permanently unavailable. Session ids are\n// already unique per Pi session, so they are the whole key. `globalThis` is what\n// actually bridges the two extensions: Pi's jiti loader runs with `moduleCache:\n// false`, so this module may be instantiated once per extension.\nconst FABLE_BROKER_REGISTRY_KEY = Symbol.for('@agimon-ai/doompi-team.fable-plan-brokers.v2');\nconst LEGACY_FABLE_BROKER_REGISTRY_KEY = Symbol.for('@agimon-ai/doompi-team.fable-plan-brokers.v1');\nconst MAX_SESSION_ID_LENGTH = 256;\ntype BrokerRegistry = Map<string, FablePlanBrokerProvider>;\ntype BrokerRegistryRoot = typeof globalThis & {\n [FABLE_BROKER_REGISTRY_KEY]?: BrokerRegistry;\n [LEGACY_FABLE_BROKER_REGISTRY_KEY]?: BrokerRegistry;\n};\n\nfunction brokerRegistry(): BrokerRegistry {\n const root = globalThis as BrokerRegistryRoot;\n const registry = root[FABLE_BROKER_REGISTRY_KEY] ?? root[LEGACY_FABLE_BROKER_REGISTRY_KEY] ?? new Map();\n root[FABLE_BROKER_REGISTRY_KEY] = registry;\n root[LEGACY_FABLE_BROKER_REGISTRY_KEY] = registry;\n return registry;\n}\n\nfunction validSessionId(sessionId: string): string {\n const normalized = sessionId.trim();\n let hasControl = false;\n for (const character of normalized) {\n const code = character.codePointAt(0);\n if (code !== undefined && (code <= 0x1f || code === 0x7f)) {\n hasControl = true;\n break;\n }\n }\n if (!normalized || normalized.length > MAX_SESSION_ID_LENGTH || hasControl) {\n throw new Error('Invalid Fable broker session id.');\n }\n return normalized;\n}\n\nfunction assertPayload(schema: typeof FablePlanStartSchema | typeof FablePlanCancelSchema, value: unknown): void {\n if (Check(schema, value)) return;\n const details = Errors(schema, value)\n .slice(0, 3)\n .map((error) => `${error.instancePath || '/'} ${error.message}`)\n .join('; ');\n throw new Error(`Invalid Fable broker payload: ${details}`);\n}\n\nexport function registerFablePlanBroker(\n sessionId: string,\n provider: FablePlanBrokerProvider,\n): FablePlanBrokerRegistration {\n const key = validSessionId(sessionId);\n const registry = brokerRegistry();\n if (registry.has(key)) throw new Error(`A Fable broker is already registered for session '${key}'.`);\n registry.set(key, provider);\n let disposed = false;\n return {\n dispose() {\n if (disposed) return;\n disposed = true;\n // Re-read rather than close over `registry`: only ever retract this\n // registration's own entry, since a later session_start may already have\n // rebound the same id to a fresh provider.\n const current = brokerRegistry();\n if (current.get(key) === provider) current.delete(key);\n },\n };\n}\n\nexport function createFablePlanBrokerClient(sessionId: () => string | undefined): FablePlanBrokerClient {\n const provider = (): FablePlanBrokerProvider | undefined => {\n const current = sessionId();\n if (!current) return undefined;\n return brokerRegistry().get(validSessionId(current));\n };\n return {\n isAvailable: () => provider() !== undefined,\n async start(request, signal) {\n assertPayload(FablePlanStartSchema, request);\n const target = provider();\n if (!target) throw new Error('The session-bound Fable broker is unavailable.');\n return target.start(request, signal);\n },\n cancel(request) {\n assertPayload(FablePlanCancelSchema, request);\n const target = provider();\n if (!target) return;\n target.cancel(request);\n },\n };\n}\n"],"mappings":"qIAIA,MAAa,EAAuB,yBACvB,EAAqB,SACrB,EAAmB,QACnB,EAAqB,uBAY5B,EAAoB,MAIpB,EAAoB,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAwB,CAAC,EACpF,EAAc,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAkB,CAAC,EACxE,EAAa,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,IAAgB,CAAC,EAE9D,EAAyB,EAAK,OACzC,CACE,KAAM,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAuB,CAAC,EACrE,QAAS,CACX,EACA,CAAE,qBAAsB,EAAM,CAChC,EAGa,EAAwB,EAAK,OACxC,CACE,KAAM,EAAK,MAAM,EAAY,CAAE,SAAU,EAAG,SAAU,CAAe,CAAC,EACtE,YAAa,EAAK,MAAM,EAAY,CAAE,SAAU,EAAqB,CAAC,EACtE,UAAW,EAAK,MAAM,EAAY,CAAE,SAAU,EAAmB,CAAC,EAClE,iBAAkB,EAAK,MAAM,EAAwB,CAAE,SAAU,EAAkB,CAAC,EACpF,iBAAkB,EAAK,MAAM,EAAY,CAAE,SAAU,EAAkB,CAAC,EACxE,oBAAqB,EAAK,MAAM,EA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footer.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./protocol.cjs");let t=require("typebox");const n=t.Type.Union([t.Type.Literal(`accent`),t.Type.Literal(`mdCode`),t.Type.Literal(`toolDiffAdded`),t.Type.Literal(`warning`),t.Type.Literal(`mdHeading`),t.Type.Literal(`syntaxNumber`),t.Type.Literal(`muted`),t.Type.Literal(`dim`)]),r=t.Type.Union([t.Type.Literal(`modeline`),t.Type.Literal(`beforeModel`)]),i=t.Type.Object({text:t.Type.String({minLength:1,maxLength:80}),color:t.Type.Optional(n)},{additionalProperties:!1}),a=t.Type.Object({id:t.Type.String({minLength:1,maxLength:128}),fullText:t.Type.String({minLength:1,maxLength:80}),compactText:t.Type.String({minLength:1,maxLength:24}),fullSegments:t.Type.Optional(t.Type.Array(i,{maxItems:80})),compactSegments:t.Type.Optional(t.Type.Array(i,{maxItems:24})),placement:t.Type.Optional(r),order:t.Type.Integer({minimum:0,maximum:1e3})},{additionalProperties:!1}),o=t.Type.Object({source:t.Type.String({minLength:1,maxLength:128}),generation:t.Type.String({minLength:1})},{additionalProperties:!1}),s=t.Type.Object({...o.properties,items:t.Type.Array(a)},{additionalProperties:!1}),c=e.defineNotification({channel:`doom:ui:footer:v1:discover`,kind:`footer-status.discover`,payload:t.Type.Object({},{additionalProperties:!1})}),l=e.defineNotification({channel:`doom:ui:footer:v1:register`,kind:`footer-status.register`,payload:s}),u=e.defineNotification({channel:`doom:ui:footer:v1:changed`,kind:`footer-status.changed`,payload:s}),d=e.defineNotification({channel:`doom:ui:footer:v1:unregister`,kind:`footer-status.unregister`,payload:o});function f(e,t){let n=`${t.source}:${crypto.randomUUID()}`,r=!1,i=()=>({source:t.source,generation:n,items:t.listStatuses().map(e=>({...e}))}),a=()=>{r||e.notify(l,i())},o=e.onNotification(c,a);return a(),{update(){r||e.notify(u,i())},dispose(){r||(r=!0,o(),e.notify(d,{source:t.source,generation:n}))}}}var p=class{sources=new Map;listeners=new Set;bind(e){let t=[e.onNotification(l,e=>this.register(e)),e.onNotification(u,e=>this.update(e)),e.onNotification(d,e=>this.unregister(e))];e.notify(c,{});let n=!1;return()=>{if(!n){n=!0;for(let e of t)e()}}}getStatuses(){return[...this.sources.entries()].flatMap(([e,t])=>t.items.map(t=>({source:e,...t}))).toSorted((e,t)=>e.order-t.order||e.source.localeCompare(t.source)||e.id.localeCompare(t.id))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}reset(){this.sources.size!==0&&(this.sources.clear(),this.notify())}register(e){this.sources.set(e.source,{generation:e.generation,items:e.items.map(e=>({...e}))}),this.notify()}update(e){this.sources.get(e.source)?.generation===e.generation&&(this.sources.set(e.source,{generation:e.generation,items:e.items.map(e=>({...e}))}),this.notify())}unregister(e){this.sources.get(e.source)?.generation===e.generation&&(this.sources.delete(e.source),this.notify())}notify(){for(let e of this.listeners)e()}};function m(t,n){let r,i,a=!1,o=()=>{i?.dispose(),i=void 0};return t.on(`session_start`,(s,c)=>{a||(o(),i=f(e.createProtocolRuntime({bus:t.events,source:n.source,sessionId:c.sessionManager.getSessionId()}),{source:n.source,listStatuses:()=>r?[{id:n.id,fullText:r.fullText,compactText:r.compactText,...r.fullSegments?{fullSegments:r.fullSegments.map(e=>({...e}))}:{},...r.compactSegments?{compactSegments:r.compactSegments.map(e=>({...e}))}:{},...n.placement?{placement:n.placement}:{},order:n.order}]:[]}))}),t.on(`session_shutdown`,o),{update(e){a||(r=e?{...e}:void 0,i?.update())},dispose(){a||(a=!0,r=void 0,o())}}}exports.DoomFooterStatusRegistry=p,exports.FooterStatusChanged=u,exports.FooterStatusDiscovery=c,exports.FooterStatusItemSchema=a,exports.FooterStatusPlacementSchema=r,exports.FooterStatusRegistration=l,exports.FooterStatusUnregistration=d,exports.FooterTextColorSchema=n,exports.FooterTextSegmentSchema=i,exports.registerDoomFooterContribution=m,exports.registerFooterStatusProvider=f;
|
|
2
|
+
//# sourceMappingURL=footer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.cjs","names":["Type","defineNotification","createProtocolRuntime"],"sources":["../src/footer.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport type { DoomExtensionHost } from './config.ts';\nimport { createProtocolRuntime, defineNotification, type ProtocolRuntime } from './protocol.ts';\n\nconst FOOTER_STATUS_DISCOVERY_CHANNEL = 'doom:ui:footer:v1:discover';\nconst FOOTER_STATUS_DISCOVERY_KIND = 'footer-status.discover';\nconst FOOTER_STATUS_REGISTRATION_CHANNEL = 'doom:ui:footer:v1:register';\nconst FOOTER_STATUS_REGISTRATION_KIND = 'footer-status.register';\nconst FOOTER_STATUS_CHANGED_CHANNEL = 'doom:ui:footer:v1:changed';\nconst FOOTER_STATUS_CHANGED_KIND = 'footer-status.changed';\nconst FOOTER_STATUS_UNREGISTRATION_CHANNEL = 'doom:ui:footer:v1:unregister';\nconst FOOTER_STATUS_UNREGISTRATION_KIND = 'footer-status.unregister';\n\nexport const FooterTextColorSchema = Type.Union([\n Type.Literal('accent'),\n Type.Literal('mdCode'),\n Type.Literal('toolDiffAdded'),\n Type.Literal('warning'),\n Type.Literal('mdHeading'),\n Type.Literal('syntaxNumber'),\n Type.Literal('muted'),\n Type.Literal('dim'),\n]);\nexport type FooterTextColor = Static<typeof FooterTextColorSchema>;\n\nexport const FooterStatusPlacementSchema = Type.Union([Type.Literal('modeline'), Type.Literal('beforeModel')]);\nexport type FooterStatusPlacement = Static<typeof FooterStatusPlacementSchema>;\n\nexport const FooterTextSegmentSchema = Type.Object(\n {\n text: Type.String({ minLength: 1, maxLength: 80 }),\n color: Type.Optional(FooterTextColorSchema),\n },\n { additionalProperties: false },\n);\nexport type FooterTextSegment = Static<typeof FooterTextSegmentSchema>;\n\nexport const FooterStatusItemSchema = Type.Object(\n {\n id: Type.String({ minLength: 1, maxLength: 128 }),\n fullText: Type.String({ minLength: 1, maxLength: 80 }),\n compactText: Type.String({ minLength: 1, maxLength: 24 }),\n fullSegments: Type.Optional(Type.Array(FooterTextSegmentSchema, { maxItems: 80 })),\n compactSegments: Type.Optional(Type.Array(FooterTextSegmentSchema, { maxItems: 24 })),\n placement: Type.Optional(FooterStatusPlacementSchema),\n order: Type.Integer({ minimum: 0, maximum: 1000 }),\n },\n { additionalProperties: false },\n);\nexport type FooterStatusItem = Static<typeof FooterStatusItemSchema>;\n\nconst FooterStatusSourceSchema = Type.Object(\n {\n source: Type.String({ minLength: 1, maxLength: 128 }),\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst FooterStatusSnapshotSchema = Type.Object(\n {\n ...FooterStatusSourceSchema.properties,\n items: Type.Array(FooterStatusItemSchema),\n },\n { additionalProperties: false },\n);\nexport type FooterStatusSnapshot = Static<typeof FooterStatusSnapshotSchema>;\nexport type FooterStatusSource = Static<typeof FooterStatusSourceSchema>;\n\nexport const FooterStatusDiscovery = defineNotification({\n channel: FOOTER_STATUS_DISCOVERY_CHANNEL,\n kind: FOOTER_STATUS_DISCOVERY_KIND,\n payload: Type.Object({}, { additionalProperties: false }),\n});\n\nexport const FooterStatusRegistration = defineNotification({\n channel: FOOTER_STATUS_REGISTRATION_CHANNEL,\n kind: FOOTER_STATUS_REGISTRATION_KIND,\n payload: FooterStatusSnapshotSchema,\n});\n\nexport const FooterStatusChanged = defineNotification({\n channel: FOOTER_STATUS_CHANGED_CHANNEL,\n kind: FOOTER_STATUS_CHANGED_KIND,\n payload: FooterStatusSnapshotSchema,\n});\n\nexport const FooterStatusUnregistration = defineNotification({\n channel: FOOTER_STATUS_UNREGISTRATION_CHANNEL,\n kind: FOOTER_STATUS_UNREGISTRATION_KIND,\n payload: FooterStatusSourceSchema,\n});\n\nexport interface FooterStatusProvider {\n source: string;\n listStatuses(): readonly FooterStatusItem[];\n}\n\nexport interface FooterStatusProviderHandle {\n update(): void;\n dispose(): void;\n}\n\nexport function registerFooterStatusProvider(\n runtime: ProtocolRuntime,\n provider: FooterStatusProvider,\n): FooterStatusProviderHandle {\n const generation = `${provider.source}:${crypto.randomUUID()}`;\n let disposed = false;\n const snapshot = (): FooterStatusSnapshot => ({\n source: provider.source,\n generation,\n items: provider.listStatuses().map((item) => ({ ...item })),\n });\n const announce = (): void => {\n if (!disposed) runtime.notify(FooterStatusRegistration, snapshot());\n };\n const disposeDiscovery = runtime.onNotification(FooterStatusDiscovery, announce);\n announce();\n\n return {\n update() {\n if (!disposed) runtime.notify(FooterStatusChanged, snapshot());\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n disposeDiscovery();\n runtime.notify(FooterStatusUnregistration, { source: provider.source, generation });\n },\n };\n}\n\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\n\nexport interface DoomFooterContributionDefinition {\n source: string;\n id: string;\n order: number;\n placement?: FooterStatusPlacement;\n}\n\nexport interface DoomFooterContributionValue {\n fullText: string;\n compactText: string;\n fullSegments?: FooterTextSegment[];\n compactSegments?: FooterTextSegment[];\n}\n\nexport interface DoomFooterContributionHandle {\n update(value: DoomFooterContributionValue | undefined): void;\n dispose(): void;\n}\n\nexport interface DoomFooterStatus extends FooterStatusItem {\n source: string;\n}\n\ninterface ActiveFooterSource {\n generation: string;\n items: FooterStatusItem[];\n}\n\nexport class DoomFooterStatusRegistry {\n private readonly sources = new Map<string, ActiveFooterSource>();\n private readonly listeners = new Set<() => void>();\n\n bind(runtime: ProtocolRuntime): () => void {\n const disposers = [\n runtime.onNotification(FooterStatusRegistration, (snapshot) => this.register(snapshot)),\n runtime.onNotification(FooterStatusChanged, (snapshot) => this.update(snapshot)),\n runtime.onNotification(FooterStatusUnregistration, (source) => this.unregister(source)),\n ];\n runtime.notify(FooterStatusDiscovery, {});\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n for (const dispose of disposers) dispose();\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.sources.entries()]\n .flatMap(([source, snapshot]) => snapshot.items.map((item) => ({ source, ...item })))\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n reset(): void {\n if (this.sources.size === 0) return;\n this.sources.clear();\n this.notify();\n }\n\n private register(snapshot: FooterStatusSnapshot): void {\n this.sources.set(snapshot.source, {\n generation: snapshot.generation,\n items: snapshot.items.map((item) => ({ ...item })),\n });\n this.notify();\n }\n\n private update(snapshot: FooterStatusSnapshot): void {\n if (this.sources.get(snapshot.source)?.generation !== snapshot.generation) return;\n this.sources.set(snapshot.source, {\n generation: snapshot.generation,\n items: snapshot.items.map((item) => ({ ...item })),\n });\n this.notify();\n }\n\n private unregister(source: FooterStatusSource): void {\n if (this.sources.get(source.source)?.generation !== source.generation) return;\n this.sources.delete(source.source);\n this.notify();\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener();\n }\n}\n\nexport function registerDoomFooterContribution(\n pi: DoomExtensionHost,\n definition: DoomFooterContributionDefinition,\n): DoomFooterContributionHandle {\n let value: DoomFooterContributionValue | undefined;\n let provider: FooterStatusProviderHandle | undefined;\n let stopped = false;\n\n const disposeProvider = (): void => {\n provider?.dispose();\n provider = undefined;\n };\n\n pi.on(SESSION_START_EVENT, (_event, ctx) => {\n if (stopped) return;\n disposeProvider();\n const runtime = createProtocolRuntime({\n bus: pi.events,\n source: definition.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n provider = registerFooterStatusProvider(runtime, {\n source: definition.source,\n listStatuses: () =>\n value\n ? [\n {\n id: definition.id,\n fullText: value.fullText,\n compactText: value.compactText,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n ...(definition.placement ? { placement: definition.placement } : {}),\n order: definition.order,\n },\n ]\n : [],\n });\n });\n\n pi.on(SESSION_SHUTDOWN_EVENT, disposeProvider);\n\n return {\n update(nextValue) {\n if (stopped) return;\n value = nextValue ? { ...nextValue } : undefined;\n provider?.update();\n },\n dispose() {\n if (stopped) return;\n stopped = true;\n value = undefined;\n disposeProvider();\n },\n };\n}\n"],"mappings":"8HAIA,MASa,EAAwBA,EAAAA,KAAK,MAAM,CAC9CA,EAAAA,KAAK,QAAQ,QAAQ,EACrBA,EAAAA,KAAK,QAAQ,QAAQ,EACrBA,EAAAA,KAAK,QAAQ,eAAe,EAC5BA,EAAAA,KAAK,QAAQ,SAAS,EACtBA,EAAAA,KAAK,QAAQ,WAAW,EACxBA,EAAAA,KAAK,QAAQ,cAAc,EAC3BA,EAAAA,KAAK,QAAQ,OAAO,EACpBA,EAAAA,KAAK,QAAQ,KAAK,CACpB,CAAC,EAGY,EAA8BA,EAAAA,KAAK,MAAM,CAACA,EAAAA,KAAK,QAAQ,UAAU,EAAGA,EAAAA,KAAK,QAAQ,aAAa,CAAC,CAAC,EAGhG,EAA0BA,EAAAA,KAAK,OAC1C,CACE,KAAMA,EAAAA,KAAK,OAAO,CAAE,UAAW,EAAG,UAAW,EAAG,CAAC,EACjD,MAAOA,EAAAA,KAAK,SAAS,CAAqB,CAC5C,EACA,CAAE,qBAAsB,EAAM,CAChC,EAGa,EAAyBA,EAAAA,KAAK,OACzC,CACE,GAAIA,EAAAA,KAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAI,CAAC,EAChD,SAAUA,EAAAA,KAAK,OAAO,CAAE,UAAW,EAAG,UAAW,EAAG,CAAC,EACrD,YAAaA,EAAAA,KAAK,OAAO,CAAE,UAAW,EAAG,UAAW,EAAG,CAAC,EACxD,aAAcA,EAAAA,KAAK,SAASA,EAAAA,KAAK,MAAM,EAAyB,CAAE,SAAU,EAAG,CAAC,CAAC,EACjF,gBAAiBA,EAAAA,KAAK,SAASA,EAAAA,KAAK,MAAM,EAAyB,CAAE,SAAU,EAAG,CAAC,CAAC,EACpF,UAAWA,EAAAA,K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,GACvC,GAAU,OAAO,EACnB,EACA,SAAU,CACJ,IACJ,EAAU,GACV,EAAQ,IAAA,GACR,EAAgB,EAClB,CACF,CACF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { NotificationDefinition, ProtocolRuntime } from "./protocol.cjs";
|
|
2
|
+
import { DoomExtensionHost } from "./config.cjs";
|
|
3
|
+
import { Static, Type } from "typebox";
|
|
4
|
+
//#region src/footer.d.ts
|
|
5
|
+
declare const FooterTextColorSchema: Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>;
|
|
6
|
+
type FooterTextColor = Static<typeof FooterTextColorSchema>;
|
|
7
|
+
declare const FooterStatusPlacementSchema: Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>;
|
|
8
|
+
type FooterStatusPlacement = Static<typeof FooterStatusPlacementSchema>;
|
|
9
|
+
declare const FooterTextSegmentSchema: Type.TObject<{
|
|
10
|
+
text: Type.TString;
|
|
11
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
12
|
+
}>;
|
|
13
|
+
type FooterTextSegment = Static<typeof FooterTextSegmentSchema>;
|
|
14
|
+
declare const FooterStatusItemSchema: Type.TObject<{
|
|
15
|
+
id: Type.TString;
|
|
16
|
+
fullText: Type.TString;
|
|
17
|
+
compactText: Type.TString;
|
|
18
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
19
|
+
text: Type.TString;
|
|
20
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
21
|
+
}>>>;
|
|
22
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
23
|
+
text: Type.TString;
|
|
24
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
25
|
+
}>>>;
|
|
26
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
27
|
+
order: Type.TInteger;
|
|
28
|
+
}>;
|
|
29
|
+
type FooterStatusItem = Static<typeof FooterStatusItemSchema>;
|
|
30
|
+
declare const FooterStatusSourceSchema: Type.TObject<{
|
|
31
|
+
source: Type.TString;
|
|
32
|
+
generation: Type.TString;
|
|
33
|
+
}>;
|
|
34
|
+
declare const FooterStatusSnapshotSchema: Type.TObject<{
|
|
35
|
+
items: Type.TArray<Type.TObject<{
|
|
36
|
+
id: Type.TString;
|
|
37
|
+
fullText: Type.TString;
|
|
38
|
+
compactText: Type.TString;
|
|
39
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
40
|
+
text: Type.TString;
|
|
41
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
42
|
+
}>>>;
|
|
43
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
44
|
+
text: Type.TString;
|
|
45
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
46
|
+
}>>>;
|
|
47
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
48
|
+
order: Type.TInteger;
|
|
49
|
+
}>>;
|
|
50
|
+
source: Type.TString;
|
|
51
|
+
generation: Type.TString;
|
|
52
|
+
}>;
|
|
53
|
+
type FooterStatusSnapshot = Static<typeof FooterStatusSnapshotSchema>;
|
|
54
|
+
type FooterStatusSource = Static<typeof FooterStatusSourceSchema>;
|
|
55
|
+
declare const FooterStatusDiscovery: NotificationDefinition<Type.TObject<{}>>;
|
|
56
|
+
declare const FooterStatusRegistration: NotificationDefinition<Type.TObject<{
|
|
57
|
+
items: Type.TArray<Type.TObject<{
|
|
58
|
+
id: Type.TString;
|
|
59
|
+
fullText: Type.TString;
|
|
60
|
+
compactText: Type.TString;
|
|
61
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
62
|
+
text: Type.TString;
|
|
63
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
64
|
+
}>>>;
|
|
65
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
66
|
+
text: Type.TString;
|
|
67
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
68
|
+
}>>>;
|
|
69
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
70
|
+
order: Type.TInteger;
|
|
71
|
+
}>>;
|
|
72
|
+
source: Type.TString;
|
|
73
|
+
generation: Type.TString;
|
|
74
|
+
}>>;
|
|
75
|
+
declare const FooterStatusChanged: NotificationDefinition<Type.TObject<{
|
|
76
|
+
items: Type.TArray<Type.TObject<{
|
|
77
|
+
id: Type.TString;
|
|
78
|
+
fullText: Type.TString;
|
|
79
|
+
compactText: Type.TString;
|
|
80
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
81
|
+
text: Type.TString;
|
|
82
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
83
|
+
}>>>;
|
|
84
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
85
|
+
text: Type.TString;
|
|
86
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
87
|
+
}>>>;
|
|
88
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
89
|
+
order: Type.TInteger;
|
|
90
|
+
}>>;
|
|
91
|
+
source: Type.TString;
|
|
92
|
+
generation: Type.TString;
|
|
93
|
+
}>>;
|
|
94
|
+
declare const FooterStatusUnregistration: NotificationDefinition<Type.TObject<{
|
|
95
|
+
source: Type.TString;
|
|
96
|
+
generation: Type.TString;
|
|
97
|
+
}>>;
|
|
98
|
+
interface FooterStatusProvider {
|
|
99
|
+
source: string;
|
|
100
|
+
listStatuses(): readonly FooterStatusItem[];
|
|
101
|
+
}
|
|
102
|
+
interface FooterStatusProviderHandle {
|
|
103
|
+
update(): void;
|
|
104
|
+
dispose(): void;
|
|
105
|
+
}
|
|
106
|
+
declare function registerFooterStatusProvider(runtime: ProtocolRuntime, provider: FooterStatusProvider): FooterStatusProviderHandle;
|
|
107
|
+
interface DoomFooterContributionDefinition {
|
|
108
|
+
source: string;
|
|
109
|
+
id: string;
|
|
110
|
+
order: number;
|
|
111
|
+
placement?: FooterStatusPlacement;
|
|
112
|
+
}
|
|
113
|
+
interface DoomFooterContributionValue {
|
|
114
|
+
fullText: string;
|
|
115
|
+
compactText: string;
|
|
116
|
+
fullSegments?: FooterTextSegment[];
|
|
117
|
+
compactSegments?: FooterTextSegment[];
|
|
118
|
+
}
|
|
119
|
+
interface DoomFooterContributionHandle {
|
|
120
|
+
update(value: DoomFooterContributionValue | undefined): void;
|
|
121
|
+
dispose(): void;
|
|
122
|
+
}
|
|
123
|
+
interface DoomFooterStatus extends FooterStatusItem {
|
|
124
|
+
source: string;
|
|
125
|
+
}
|
|
126
|
+
declare class DoomFooterStatusRegistry {
|
|
127
|
+
private readonly sources;
|
|
128
|
+
private readonly listeners;
|
|
129
|
+
bind(runtime: ProtocolRuntime): () => void;
|
|
130
|
+
getStatuses(): DoomFooterStatus[];
|
|
131
|
+
subscribe(listener: () => void): () => void;
|
|
132
|
+
reset(): void;
|
|
133
|
+
private register;
|
|
134
|
+
private update;
|
|
135
|
+
private unregister;
|
|
136
|
+
private notify;
|
|
137
|
+
}
|
|
138
|
+
declare function registerDoomFooterContribution(pi: DoomExtensionHost, definition: DoomFooterContributionDefinition): DoomFooterContributionHandle;
|
|
139
|
+
//#endregion
|
|
140
|
+
export { DoomFooterContributionDefinition, DoomFooterContributionHandle, DoomFooterContributionValue, DoomFooterStatus, DoomFooterStatusRegistry, FooterStatusChanged, FooterStatusDiscovery, FooterStatusItem, FooterStatusItemSchema, FooterStatusPlacement, FooterStatusPlacementSchema, FooterStatusProvider, FooterStatusProviderHandle, FooterStatusRegistration, FooterStatusSnapshot, FooterStatusSource, FooterStatusUnregistration, FooterTextColor, FooterTextColorSchema, FooterTextSegment, FooterTextSegmentSchema, registerDoomFooterContribution, registerFooterStatusProvider };
|
|
141
|
+
//# sourceMappingURL=footer.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.d.cts","names":[],"sources":["../src/footer.ts"],"mappings":";;;;cAaa,uBAAqB,KAAA,QAAA,KAAA,oBAAA,KAAA,oBAAA,KAAA,2BAAA,KAAA,qBAAA,KAAA,uBAAA,KAAA,0BAAA,KAAA,mBAAA,KAAA;KAUtB,kBAAkB,cAAc;cAE/B,6BAA2B,KAAA,QAAA,KAAA,sBAAA,KAAA;KAC5B,wBAAwB,cAAc;cAErC,yBAAuB,KAAA;;;;KAOxB,oBAAoB,cAAc;cAEjC,wBAAsB,KAAA;;;;;;;;;;;;;;;KAYvB,mBAAmB,cAAc;cAEvC,0BAAwB,KAAA;;;;cAQxB,4BAA0B,KAAA;;;;;;;;;;;;;;;;;;;KAOpB,uBAAuB,cAAc;KACrC,qBAAqB,cAAc;cAElC,uBAAqB,uBAAA,KAAA;cAMrB,0BAAwB,uBAAA,KAAA;;;;;;;;;;;;;;;;;;;cAMxB,qBAAmB,uBAAA,KAAA;;;;;;;;;;;;;;;;;;;cAMnB,4BAA0B,uBAAA,KAAA;;;;UAMtB;EACf;EACA,yBAAyB;;UAGV;EACf;EACA;;iBAGc,6BACd,SAAS,iBACT,UAAU,uBACT;UA8Bc;EACf;EACA;EACA;EACA,YAAY;;UAGG;EACf;EACA;EACA,eAAe;EACf,kBAAkB;;UAGH;EACf,OAAO,OAAO;EACd;;UAGe,yBAAyB;EACxC;;cAQW;mBACM;mBACA;EAEjB,KAAK,SAAS;EAed,eAAe;EASf,UAAU;EAKV;UAMQ;UAQA;UASA;UAMA;;iBAKM,+BACd,IAAI,mBACJ,YAAY,mCACX"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { NotificationDefinition, ProtocolRuntime } from "./protocol.mjs";
|
|
2
|
+
import { DoomExtensionHost } from "./config.mjs";
|
|
3
|
+
import { Static, Type } from "typebox";
|
|
4
|
+
//#region src/footer.d.ts
|
|
5
|
+
declare const FooterTextColorSchema: Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>;
|
|
6
|
+
type FooterTextColor = Static<typeof FooterTextColorSchema>;
|
|
7
|
+
declare const FooterStatusPlacementSchema: Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>;
|
|
8
|
+
type FooterStatusPlacement = Static<typeof FooterStatusPlacementSchema>;
|
|
9
|
+
declare const FooterTextSegmentSchema: Type.TObject<{
|
|
10
|
+
text: Type.TString;
|
|
11
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
12
|
+
}>;
|
|
13
|
+
type FooterTextSegment = Static<typeof FooterTextSegmentSchema>;
|
|
14
|
+
declare const FooterStatusItemSchema: Type.TObject<{
|
|
15
|
+
id: Type.TString;
|
|
16
|
+
fullText: Type.TString;
|
|
17
|
+
compactText: Type.TString;
|
|
18
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
19
|
+
text: Type.TString;
|
|
20
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
21
|
+
}>>>;
|
|
22
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
23
|
+
text: Type.TString;
|
|
24
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
25
|
+
}>>>;
|
|
26
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
27
|
+
order: Type.TInteger;
|
|
28
|
+
}>;
|
|
29
|
+
type FooterStatusItem = Static<typeof FooterStatusItemSchema>;
|
|
30
|
+
declare const FooterStatusSourceSchema: Type.TObject<{
|
|
31
|
+
source: Type.TString;
|
|
32
|
+
generation: Type.TString;
|
|
33
|
+
}>;
|
|
34
|
+
declare const FooterStatusSnapshotSchema: Type.TObject<{
|
|
35
|
+
items: Type.TArray<Type.TObject<{
|
|
36
|
+
id: Type.TString;
|
|
37
|
+
fullText: Type.TString;
|
|
38
|
+
compactText: Type.TString;
|
|
39
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
40
|
+
text: Type.TString;
|
|
41
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
42
|
+
}>>>;
|
|
43
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
44
|
+
text: Type.TString;
|
|
45
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
46
|
+
}>>>;
|
|
47
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
48
|
+
order: Type.TInteger;
|
|
49
|
+
}>>;
|
|
50
|
+
source: Type.TString;
|
|
51
|
+
generation: Type.TString;
|
|
52
|
+
}>;
|
|
53
|
+
type FooterStatusSnapshot = Static<typeof FooterStatusSnapshotSchema>;
|
|
54
|
+
type FooterStatusSource = Static<typeof FooterStatusSourceSchema>;
|
|
55
|
+
declare const FooterStatusDiscovery: NotificationDefinition<Type.TObject<{}>>;
|
|
56
|
+
declare const FooterStatusRegistration: NotificationDefinition<Type.TObject<{
|
|
57
|
+
items: Type.TArray<Type.TObject<{
|
|
58
|
+
id: Type.TString;
|
|
59
|
+
fullText: Type.TString;
|
|
60
|
+
compactText: Type.TString;
|
|
61
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
62
|
+
text: Type.TString;
|
|
63
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
64
|
+
}>>>;
|
|
65
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
66
|
+
text: Type.TString;
|
|
67
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
68
|
+
}>>>;
|
|
69
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
70
|
+
order: Type.TInteger;
|
|
71
|
+
}>>;
|
|
72
|
+
source: Type.TString;
|
|
73
|
+
generation: Type.TString;
|
|
74
|
+
}>>;
|
|
75
|
+
declare const FooterStatusChanged: NotificationDefinition<Type.TObject<{
|
|
76
|
+
items: Type.TArray<Type.TObject<{
|
|
77
|
+
id: Type.TString;
|
|
78
|
+
fullText: Type.TString;
|
|
79
|
+
compactText: Type.TString;
|
|
80
|
+
fullSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
81
|
+
text: Type.TString;
|
|
82
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
83
|
+
}>>>;
|
|
84
|
+
compactSegments: Type.TOptional<Type.TArray<Type.TObject<{
|
|
85
|
+
text: Type.TString;
|
|
86
|
+
color: Type.TOptional<Type.TUnion<[Type.TLiteral<"accent">, Type.TLiteral<"mdCode">, Type.TLiteral<"toolDiffAdded">, Type.TLiteral<"warning">, Type.TLiteral<"mdHeading">, Type.TLiteral<"syntaxNumber">, Type.TLiteral<"muted">, Type.TLiteral<"dim">]>>;
|
|
87
|
+
}>>>;
|
|
88
|
+
placement: Type.TOptional<Type.TUnion<[Type.TLiteral<"modeline">, Type.TLiteral<"beforeModel">]>>;
|
|
89
|
+
order: Type.TInteger;
|
|
90
|
+
}>>;
|
|
91
|
+
source: Type.TString;
|
|
92
|
+
generation: Type.TString;
|
|
93
|
+
}>>;
|
|
94
|
+
declare const FooterStatusUnregistration: NotificationDefinition<Type.TObject<{
|
|
95
|
+
source: Type.TString;
|
|
96
|
+
generation: Type.TString;
|
|
97
|
+
}>>;
|
|
98
|
+
interface FooterStatusProvider {
|
|
99
|
+
source: string;
|
|
100
|
+
listStatuses(): readonly FooterStatusItem[];
|
|
101
|
+
}
|
|
102
|
+
interface FooterStatusProviderHandle {
|
|
103
|
+
update(): void;
|
|
104
|
+
dispose(): void;
|
|
105
|
+
}
|
|
106
|
+
declare function registerFooterStatusProvider(runtime: ProtocolRuntime, provider: FooterStatusProvider): FooterStatusProviderHandle;
|
|
107
|
+
interface DoomFooterContributionDefinition {
|
|
108
|
+
source: string;
|
|
109
|
+
id: string;
|
|
110
|
+
order: number;
|
|
111
|
+
placement?: FooterStatusPlacement;
|
|
112
|
+
}
|
|
113
|
+
interface DoomFooterContributionValue {
|
|
114
|
+
fullText: string;
|
|
115
|
+
compactText: string;
|
|
116
|
+
fullSegments?: FooterTextSegment[];
|
|
117
|
+
compactSegments?: FooterTextSegment[];
|
|
118
|
+
}
|
|
119
|
+
interface DoomFooterContributionHandle {
|
|
120
|
+
update(value: DoomFooterContributionValue | undefined): void;
|
|
121
|
+
dispose(): void;
|
|
122
|
+
}
|
|
123
|
+
interface DoomFooterStatus extends FooterStatusItem {
|
|
124
|
+
source: string;
|
|
125
|
+
}
|
|
126
|
+
declare class DoomFooterStatusRegistry {
|
|
127
|
+
private readonly sources;
|
|
128
|
+
private readonly listeners;
|
|
129
|
+
bind(runtime: ProtocolRuntime): () => void;
|
|
130
|
+
getStatuses(): DoomFooterStatus[];
|
|
131
|
+
subscribe(listener: () => void): () => void;
|
|
132
|
+
reset(): void;
|
|
133
|
+
private register;
|
|
134
|
+
private update;
|
|
135
|
+
private unregister;
|
|
136
|
+
private notify;
|
|
137
|
+
}
|
|
138
|
+
declare function registerDoomFooterContribution(pi: DoomExtensionHost, definition: DoomFooterContributionDefinition): DoomFooterContributionHandle;
|
|
139
|
+
//#endregion
|
|
140
|
+
export { DoomFooterContributionDefinition, DoomFooterContributionHandle, DoomFooterContributionValue, DoomFooterStatus, DoomFooterStatusRegistry, FooterStatusChanged, FooterStatusDiscovery, FooterStatusItem, FooterStatusItemSchema, FooterStatusPlacement, FooterStatusPlacementSchema, FooterStatusProvider, FooterStatusProviderHandle, FooterStatusRegistration, FooterStatusSnapshot, FooterStatusSource, FooterStatusUnregistration, FooterTextColor, FooterTextColorSchema, FooterTextSegment, FooterTextSegmentSchema, registerDoomFooterContribution, registerFooterStatusProvider };
|
|
141
|
+
//# sourceMappingURL=footer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.d.mts","names":[],"sources":["../src/footer.ts"],"mappings":";;;;cAaa,uBAAqB,KAAA,QAAA,KAAA,oBAAA,KAAA,oBAAA,KAAA,2BAAA,KAAA,qBAAA,KAAA,uBAAA,KAAA,0BAAA,KAAA,mBAAA,KAAA;KAUtB,kBAAkB,cAAc;cAE/B,6BAA2B,KAAA,QAAA,KAAA,sBAAA,KAAA;KAC5B,wBAAwB,cAAc;cAErC,yBAAuB,KAAA;;;;KAOxB,oBAAoB,cAAc;cAEjC,wBAAsB,KAAA;;;;;;;;;;;;;;;KAYvB,mBAAmB,cAAc;cAEvC,0BAAwB,KAAA;;;;cAQxB,4BAA0B,KAAA;;;;;;;;;;;;;;;;;;;KAOpB,uBAAuB,cAAc;KACrC,qBAAqB,cAAc;cAElC,uBAAqB,uBAAA,KAAA;cAMrB,0BAAwB,uBAAA,KAAA;;;;;;;;;;;;;;;;;;;cAMxB,qBAAmB,uBAAA,KAAA;;;;;;;;;;;;;;;;;;;cAMnB,4BAA0B,uBAAA,KAAA;;;;UAMtB;EACf;EACA,yBAAyB;;UAGV;EACf;EACA;;iBAGc,6BACd,SAAS,iBACT,UAAU,uBACT;UA8Bc;EACf;EACA;EACA;EACA,YAAY;;UAGG;EACf;EACA;EACA,eAAe;EACf,kBAAkB;;UAGH;EACf,OAAO,OAAO;EACd;;UAGe,yBAAyB;EACxC;;cAQW;mBACM;mBACA;EAEjB,KAAK,SAAS;EAed,eAAe;EASf,UAAU;EAKV;UAMQ;UAQA;UASA;UAMA;;iBAKM,+BACd,IAAI,mBACJ,YAAY,mCACX"}
|
package/dist/footer.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createProtocolRuntime as e,defineNotification as t}from"./protocol.mjs";import{Type as n}from"typebox";const r=n.Union([n.Literal(`accent`),n.Literal(`mdCode`),n.Literal(`toolDiffAdded`),n.Literal(`warning`),n.Literal(`mdHeading`),n.Literal(`syntaxNumber`),n.Literal(`muted`),n.Literal(`dim`)]),i=n.Union([n.Literal(`modeline`),n.Literal(`beforeModel`)]),a=n.Object({text:n.String({minLength:1,maxLength:80}),color:n.Optional(r)},{additionalProperties:!1}),o=n.Object({id:n.String({minLength:1,maxLength:128}),fullText:n.String({minLength:1,maxLength:80}),compactText:n.String({minLength:1,maxLength:24}),fullSegments:n.Optional(n.Array(a,{maxItems:80})),compactSegments:n.Optional(n.Array(a,{maxItems:24})),placement:n.Optional(i),order:n.Integer({minimum:0,maximum:1e3})},{additionalProperties:!1}),s=n.Object({source:n.String({minLength:1,maxLength:128}),generation:n.String({minLength:1})},{additionalProperties:!1}),c=n.Object({...s.properties,items:n.Array(o)},{additionalProperties:!1}),l=t({channel:`doom:ui:footer:v1:discover`,kind:`footer-status.discover`,payload:n.Object({},{additionalProperties:!1})}),u=t({channel:`doom:ui:footer:v1:register`,kind:`footer-status.register`,payload:c}),d=t({channel:`doom:ui:footer:v1:changed`,kind:`footer-status.changed`,payload:c}),f=t({channel:`doom:ui:footer:v1:unregister`,kind:`footer-status.unregister`,payload:s});function p(e,t){let n=`${t.source}:${crypto.randomUUID()}`,r=!1,i=()=>({source:t.source,generation:n,items:t.listStatuses().map(e=>({...e}))}),a=()=>{r||e.notify(u,i())},o=e.onNotification(l,a);return a(),{update(){r||e.notify(d,i())},dispose(){r||(r=!0,o(),e.notify(f,{source:t.source,generation:n}))}}}var m=class{sources=new Map;listeners=new Set;bind(e){let t=[e.onNotification(u,e=>this.register(e)),e.onNotification(d,e=>this.update(e)),e.onNotification(f,e=>this.unregister(e))];e.notify(l,{});let n=!1;return()=>{if(!n){n=!0;for(let e of t)e()}}}getStatuses(){return[...this.sources.entries()].flatMap(([e,t])=>t.items.map(t=>({source:e,...t}))).toSorted((e,t)=>e.order-t.order||e.source.localeCompare(t.source)||e.id.localeCompare(t.id))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}reset(){this.sources.size!==0&&(this.sources.clear(),this.notify())}register(e){this.sources.set(e.source,{generation:e.generation,items:e.items.map(e=>({...e}))}),this.notify()}update(e){this.sources.get(e.source)?.generation===e.generation&&(this.sources.set(e.source,{generation:e.generation,items:e.items.map(e=>({...e}))}),this.notify())}unregister(e){this.sources.get(e.source)?.generation===e.generation&&(this.sources.delete(e.source),this.notify())}notify(){for(let e of this.listeners)e()}};function h(t,n){let r,i,a=!1,o=()=>{i?.dispose(),i=void 0};return t.on(`session_start`,(s,c)=>{a||(o(),i=p(e({bus:t.events,source:n.source,sessionId:c.sessionManager.getSessionId()}),{source:n.source,listStatuses:()=>r?[{id:n.id,fullText:r.fullText,compactText:r.compactText,...r.fullSegments?{fullSegments:r.fullSegments.map(e=>({...e}))}:{},...r.compactSegments?{compactSegments:r.compactSegments.map(e=>({...e}))}:{},...n.placement?{placement:n.placement}:{},order:n.order}]:[]}))}),t.on(`session_shutdown`,o),{update(e){a||(r=e?{...e}:void 0,i?.update())},dispose(){a||(a=!0,r=void 0,o())}}}export{m as DoomFooterStatusRegistry,d as FooterStatusChanged,l as FooterStatusDiscovery,o as FooterStatusItemSchema,i as FooterStatusPlacementSchema,u as FooterStatusRegistration,f as FooterStatusUnregistration,r as FooterTextColorSchema,a as FooterTextSegmentSchema,h as registerDoomFooterContribution,p as registerFooterStatusProvider};
|
|
2
|
+
//# sourceMappingURL=footer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.mjs","names":[],"sources":["../src/footer.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport type { DoomExtensionHost } from './config.ts';\nimport { createProtocolRuntime, defineNotification, type ProtocolRuntime } from './protocol.ts';\n\nconst FOOTER_STATUS_DISCOVERY_CHANNEL = 'doom:ui:footer:v1:discover';\nconst FOOTER_STATUS_DISCOVERY_KIND = 'footer-status.discover';\nconst FOOTER_STATUS_REGISTRATION_CHANNEL = 'doom:ui:footer:v1:register';\nconst FOOTER_STATUS_REGISTRATION_KIND = 'footer-status.register';\nconst FOOTER_STATUS_CHANGED_CHANNEL = 'doom:ui:footer:v1:changed';\nconst FOOTER_STATUS_CHANGED_KIND = 'footer-status.changed';\nconst FOOTER_STATUS_UNREGISTRATION_CHANNEL = 'doom:ui:footer:v1:unregister';\nconst FOOTER_STATUS_UNREGISTRATION_KIND = 'footer-status.unregister';\n\nexport const FooterTextColorSchema = Type.Union([\n Type.Literal('accent'),\n Type.Literal('mdCode'),\n Type.Literal('toolDiffAdded'),\n Type.Literal('warning'),\n Type.Literal('mdHeading'),\n Type.Literal('syntaxNumber'),\n Type.Literal('muted'),\n Type.Literal('dim'),\n]);\nexport type FooterTextColor = Static<typeof FooterTextColorSchema>;\n\nexport const FooterStatusPlacementSchema = Type.Union([Type.Literal('modeline'), Type.Literal('beforeModel')]);\nexport type FooterStatusPlacement = Static<typeof FooterStatusPlacementSchema>;\n\nexport const FooterTextSegmentSchema = Type.Object(\n {\n text: Type.String({ minLength: 1, maxLength: 80 }),\n color: Type.Optional(FooterTextColorSchema),\n },\n { additionalProperties: false },\n);\nexport type FooterTextSegment = Static<typeof FooterTextSegmentSchema>;\n\nexport const FooterStatusItemSchema = Type.Object(\n {\n id: Type.String({ minLength: 1, maxLength: 128 }),\n fullText: Type.String({ minLength: 1, maxLength: 80 }),\n compactText: Type.String({ minLength: 1, maxLength: 24 }),\n fullSegments: Type.Optional(Type.Array(FooterTextSegmentSchema, { maxItems: 80 })),\n compactSegments: Type.Optional(Type.Array(FooterTextSegmentSchema, { maxItems: 24 })),\n placement: Type.Optional(FooterStatusPlacementSchema),\n order: Type.Integer({ minimum: 0, maximum: 1000 }),\n },\n { additionalProperties: false },\n);\nexport type FooterStatusItem = Static<typeof FooterStatusItemSchema>;\n\nconst FooterStatusSourceSchema = Type.Object(\n {\n source: Type.String({ minLength: 1, maxLength: 128 }),\n generation: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst FooterStatusSnapshotSchema = Type.Object(\n {\n ...FooterStatusSourceSchema.properties,\n items: Type.Array(FooterStatusItemSchema),\n },\n { additionalProperties: false },\n);\nexport type FooterStatusSnapshot = Static<typeof FooterStatusSnapshotSchema>;\nexport type FooterStatusSource = Static<typeof FooterStatusSourceSchema>;\n\nexport const FooterStatusDiscovery = defineNotification({\n channel: FOOTER_STATUS_DISCOVERY_CHANNEL,\n kind: FOOTER_STATUS_DISCOVERY_KIND,\n payload: Type.Object({}, { additionalProperties: false }),\n});\n\nexport const FooterStatusRegistration = defineNotification({\n channel: FOOTER_STATUS_REGISTRATION_CHANNEL,\n kind: FOOTER_STATUS_REGISTRATION_KIND,\n payload: FooterStatusSnapshotSchema,\n});\n\nexport const FooterStatusChanged = defineNotification({\n channel: FOOTER_STATUS_CHANGED_CHANNEL,\n kind: FOOTER_STATUS_CHANGED_KIND,\n payload: FooterStatusSnapshotSchema,\n});\n\nexport const FooterStatusUnregistration = defineNotification({\n channel: FOOTER_STATUS_UNREGISTRATION_CHANNEL,\n kind: FOOTER_STATUS_UNREGISTRATION_KIND,\n payload: FooterStatusSourceSchema,\n});\n\nexport interface FooterStatusProvider {\n source: string;\n listStatuses(): readonly FooterStatusItem[];\n}\n\nexport interface FooterStatusProviderHandle {\n update(): void;\n dispose(): void;\n}\n\nexport function registerFooterStatusProvider(\n runtime: ProtocolRuntime,\n provider: FooterStatusProvider,\n): FooterStatusProviderHandle {\n const generation = `${provider.source}:${crypto.randomUUID()}`;\n let disposed = false;\n const snapshot = (): FooterStatusSnapshot => ({\n source: provider.source,\n generation,\n items: provider.listStatuses().map((item) => ({ ...item })),\n });\n const announce = (): void => {\n if (!disposed) runtime.notify(FooterStatusRegistration, snapshot());\n };\n const disposeDiscovery = runtime.onNotification(FooterStatusDiscovery, announce);\n announce();\n\n return {\n update() {\n if (!disposed) runtime.notify(FooterStatusChanged, snapshot());\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n disposeDiscovery();\n runtime.notify(FooterStatusUnregistration, { source: provider.source, generation });\n },\n };\n}\n\nconst SESSION_START_EVENT = 'session_start';\nconst SESSION_SHUTDOWN_EVENT = 'session_shutdown';\n\nexport interface DoomFooterContributionDefinition {\n source: string;\n id: string;\n order: number;\n placement?: FooterStatusPlacement;\n}\n\nexport interface DoomFooterContributionValue {\n fullText: string;\n compactText: string;\n fullSegments?: FooterTextSegment[];\n compactSegments?: FooterTextSegment[];\n}\n\nexport interface DoomFooterContributionHandle {\n update(value: DoomFooterContributionValue | undefined): void;\n dispose(): void;\n}\n\nexport interface DoomFooterStatus extends FooterStatusItem {\n source: string;\n}\n\ninterface ActiveFooterSource {\n generation: string;\n items: FooterStatusItem[];\n}\n\nexport class DoomFooterStatusRegistry {\n private readonly sources = new Map<string, ActiveFooterSource>();\n private readonly listeners = new Set<() => void>();\n\n bind(runtime: ProtocolRuntime): () => void {\n const disposers = [\n runtime.onNotification(FooterStatusRegistration, (snapshot) => this.register(snapshot)),\n runtime.onNotification(FooterStatusChanged, (snapshot) => this.update(snapshot)),\n runtime.onNotification(FooterStatusUnregistration, (source) => this.unregister(source)),\n ];\n runtime.notify(FooterStatusDiscovery, {});\n let disposed = false;\n return () => {\n if (disposed) return;\n disposed = true;\n for (const dispose of disposers) dispose();\n };\n }\n\n getStatuses(): DoomFooterStatus[] {\n return [...this.sources.entries()]\n .flatMap(([source, snapshot]) => snapshot.items.map((item) => ({ source, ...item })))\n .toSorted(\n (left, right) =>\n left.order - right.order || left.source.localeCompare(right.source) || left.id.localeCompare(right.id),\n );\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n reset(): void {\n if (this.sources.size === 0) return;\n this.sources.clear();\n this.notify();\n }\n\n private register(snapshot: FooterStatusSnapshot): void {\n this.sources.set(snapshot.source, {\n generation: snapshot.generation,\n items: snapshot.items.map((item) => ({ ...item })),\n });\n this.notify();\n }\n\n private update(snapshot: FooterStatusSnapshot): void {\n if (this.sources.get(snapshot.source)?.generation !== snapshot.generation) return;\n this.sources.set(snapshot.source, {\n generation: snapshot.generation,\n items: snapshot.items.map((item) => ({ ...item })),\n });\n this.notify();\n }\n\n private unregister(source: FooterStatusSource): void {\n if (this.sources.get(source.source)?.generation !== source.generation) return;\n this.sources.delete(source.source);\n this.notify();\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener();\n }\n}\n\nexport function registerDoomFooterContribution(\n pi: DoomExtensionHost,\n definition: DoomFooterContributionDefinition,\n): DoomFooterContributionHandle {\n let value: DoomFooterContributionValue | undefined;\n let provider: FooterStatusProviderHandle | undefined;\n let stopped = false;\n\n const disposeProvider = (): void => {\n provider?.dispose();\n provider = undefined;\n };\n\n pi.on(SESSION_START_EVENT, (_event, ctx) => {\n if (stopped) return;\n disposeProvider();\n const runtime = createProtocolRuntime({\n bus: pi.events,\n source: definition.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n provider = registerFooterStatusProvider(runtime, {\n source: definition.source,\n listStatuses: () =>\n value\n ? [\n {\n id: definition.id,\n fullText: value.fullText,\n compactText: value.compactText,\n ...(value.fullSegments ? { fullSegments: value.fullSegments.map((segment) => ({ ...segment })) } : {}),\n ...(value.compactSegments\n ? { compactSegments: value.compactSegments.map((segment) => ({ ...segment })) }\n : {}),\n ...(definition.placement ? { placement: definition.placement } : {}),\n order: definition.order,\n },\n ]\n : [],\n });\n });\n\n pi.on(SESSION_SHUTDOWN_EVENT, disposeProvider);\n\n return {\n update(nextValue) {\n if (stopped) return;\n value = nextValue ? { ...nextValue } : undefined;\n provider?.update();\n },\n dispose() {\n if (stopped) return;\n stopped = true;\n value = undefined;\n disposeProvider();\n },\n };\n}\n"],"mappings":"8GAIA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AAU,QAAQ,EAClB,EAAW,IAAA,EACb,EAiCA,OA/BA,EAAG,GAAG,iBAAsB,EAAQ,IAAQ,CACtC,IACJ,EAAgB,EAMhB,EAAW,EALK,EAAsB,CACpC,IAAK,EAAG,OACR,OAAQ,EAAW,OACnB,UAAW,EAAI,eAAe,aAAa,CAC7C,CAC8C,EAAG,CAC/C,OAAQ,EAAW,OACnB,iBACE,EACI,CACE,CACE,GAAI,EAAW,GACf,SAAU,EAAM,SAChB,YAAa,EAAM,YACnB,GAAI,EAAM,aAAe,CAAE,aAAc,EAAM,aAAa,IAAK,IAAa,CAAE,GAAG,CAAQ,EAAE,CAAE,EAAI,CAAC,EACpG,GAAI,EAAM,gBACN,CAAE,gBAAiB,EAAM,gBAAgB,IAAK,IAAa,CAAE,GAAG,CAAQ,EAAE,CAAE,EAC5E,CAAC,EACL,GAAI,EAAW,UAAY,CAAE,UAAW,EAAW,SAAU,EAAI,CAAC,EAClE,MAAO,EAAW,KACpB,CACF,EACA,CAAC,CACT,CAAC,EACH,CAAC,EAED,EAAG,GAAG,mBAAwB,CAAe,EAEtC,CACL,OAAO,EAAW,CACZ,IACJ,EAAQ,EAAY,CAAE,GAAG,CAAU,EAAI,IAAA,GACvC,GAAU,OAAO,EACnB,EACA,SAAU,CACJ,IACJ,EAAU,GACV,EAAQ,IAAA,GACR,EAAgB,EAClB,CACF,CACF"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./protocol.cjs");exports.DoomProtocolError=e.DoomProtocolError,exports.DoomProtocolValidationError=e.DoomProtocolValidationError,exports.createProtocolRuntime=e.createProtocolRuntime;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DoomProtocolError, DoomProtocolValidationError, EventBusLike, ProtocolRuntime, ProtocolRuntimeOptions, RequestOptions, createProtocolRuntime } from "./protocol.cjs";
|
|
2
|
+
export { DoomProtocolError, DoomProtocolValidationError, type EventBusLike, type ProtocolRuntime, type ProtocolRuntimeOptions, type RequestOptions, createProtocolRuntime };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DoomProtocolError, DoomProtocolValidationError, EventBusLike, ProtocolRuntime, ProtocolRuntimeOptions, RequestOptions, createProtocolRuntime } from "./protocol.mjs";
|
|
2
|
+
export { DoomProtocolError, DoomProtocolValidationError, type EventBusLike, type ProtocolRuntime, type ProtocolRuntimeOptions, type RequestOptions, createProtocolRuntime };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DoomProtocolError as e,DoomProtocolValidationError as t,createProtocolRuntime as n}from"./protocol.mjs";export{e as DoomProtocolError,t as DoomProtocolValidationError,n as createProtocolRuntime};
|
package/dist/leader.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./protocol.cjs");let t=require("typebox");const n=t.Type.Object({key:t.Type.String({minLength:1,maxLength:1}),label:t.Type.String({minLength:1}),detail:t.Type.Optional(t.Type.String()),order:t.Type.Optional(t.Type.Integer())},{additionalProperties:!1}),r=t.Type.Object({name:t.Type.String({minLength:1}),args:t.Type.Optional(t.Type.String())},{additionalProperties:!1}),i=t.Type.Object({name:t.Type.String({minLength:1,maxLength:128,pattern:`^[a-z0-9][a-z0-9._:-]*$`})},{additionalProperties:!1}),a={id:t.Type.String({minLength:1}),path:t.Type.Array(n,{minItems:1})},o=t.Type.Union([t.Type.Object({...a,command:r},{additionalProperties:!1}),t.Type.Object({...a,action:i},{additionalProperties:!1})]),s=t.Type.String({minLength:1,maxLength:128,pattern:`^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$`}),c=t.Type.Object({source:s,bindings:t.Type.Array(o)},{additionalProperties:!1}),l=t.Type.Object({contribution:c,generation:t.Type.String({minLength:1})},{additionalProperties:!1}),u=e.defineNotification({channel:`doom:ui:leader:v1:action-invoked`,kind:`leader.action-invoked`,payload:t.Type.Object({source:s,action:i.properties.name},{additionalProperties:!1})}),d=e.defineRequestReply({channels:{request:`doom:ui:leader:v1:register`,response:`doom:ui:leader:v1:registered`,error:`doom:ui:leader:v1:error`},kinds:{request:`leader.register`,response:`leader.registered`},request:l,response:t.Type.Object({handleId:t.Type.String({minLength:1})},{additionalProperties:!1})}),f=e.defineRequestReply({channels:{request:`doom:ui:leader:v1:unregister`,response:`doom:ui:leader:v1:unregistered`,error:`doom:ui:leader:v1:unregister-error`},kinds:{request:`leader.unregister`,response:`leader.unregistered`},request:t.Type.Object({handleId:t.Type.String({minLength:1})},{additionalProperties:!1}),response:t.Type.Object({removed:t.Type.Boolean()},{additionalProperties:!1})});function p(t){t instanceof e.DoomProtocolError&&t.code===e.DOOM_PROTOCOL_ERROR_CODE.timeout||queueMicrotask(()=>{throw t instanceof Error?t:Error(String(t))})}function m(e){return e.map(e=>({id:e.id,path:e.path.map(e=>({...e})),...`command`in e?{command:{...e.command}}:{action:{...e.action}}}))}function h(t,n){let r,i,a=0,o=!1,s=m(n.bindings),c=JSON.stringify(s),l=Promise.resolve(),u=(e,t)=>e.request(f,{handleId:t},{timeoutMs:250}).then(()=>void 0).catch(p),h=()=>{let e=r,t=i;i=void 0,!(!e||!t)&&(l=l.then(()=>u(e,t)))},g=()=>{let e=r;if(!e)return;let t=a,c=s;l=l.then(async()=>{let s=i;i=void 0,s&&await u(e,s);let l=await e.request(d,{contribution:{source:n.source,bindings:c},generation:String(t)},{timeoutMs:250});if(o||a!==t||r!==e){await u(e,l.handleId);return}i=l.handleId}).catch(p)};return t.on(`session_start`,(i,s)=>{o||(h(),a+=1,r=e.createProtocolRuntime({bus:t.events,source:n.source,sessionId:s.sessionManager.getSessionId()}),g())}),t.on(`session_shutdown`,()=>{a+=1,h(),r=void 0}),{update(e){if(o)return;let t=m(e),n=JSON.stringify(t);n!==c&&(c=n,s=t,g())},dispose(){o=!0,a+=1,h(),r=void 0}}}function g(e,t){let n=h(e,t);return()=>n.dispose()}function _(t,n){let r,i=0,a=!1;return t.on(`session_start`,(o,s)=>{if(a)return;r?.();let c=++i;r=e.createProtocolRuntime({bus:t.events,source:n.source,sessionId:s.sessionManager.getSessionId()}).onNotification(u,async({source:e,action:t},r)=>{if(a||i!==c||r.source!==`@agimon-ai/doompi-ui`||e!==n.source)return;let o=n.handlers[t];if(o)try{await o(s)}catch(e){n.onError(e,t,s)}})}),t.on(`session_shutdown`,()=>{++i,r?.(),r=void 0}),()=>{a=!0,++i,r?.(),r=void 0}}exports.LeaderActionInvoked=u,exports.LeaderActionSchema=i,exports.LeaderBindingSchema=o,exports.LeaderCommandSchema=r,exports.LeaderContributionSchema=c,exports.LeaderRegistrationProtocol=d,exports.LeaderRegistrationSchema=l,exports.LeaderSegmentSchema=n,exports.LeaderSourceSchema=s,exports.LeaderUnregistrationProtocol=f,exports.createDoomLeaderContribution=h,exports.registerDoomLeaderActionHandlers=_,exports.registerDoomLeaderContribution=g;
|
|
2
|
+
//# sourceMappingURL=leader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leader.cjs","names":["Type","defineNotification","defineRequestReply","DoomProtocolError","DOOM_PROTOCOL_ERROR_CODE","createProtocolRuntime"],"sources":["../src/leader.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\nimport type { DoomExtensionContext, DoomExtensionHost } from './config.ts';\nimport {\n createProtocolRuntime,\n defineNotification,\n defineRequestReply,\n DOOM_PROTOCOL_ERROR_CODE,\n DoomProtocolError,\n type ProtocolRuntime,\n} from './protocol.ts';\n\nexport const LeaderSegmentSchema = Type.Object(\n {\n key: Type.String({ minLength: 1, maxLength: 1 }),\n label: Type.String({ minLength: 1 }),\n detail: Type.Optional(Type.String()),\n order: Type.Optional(Type.Integer()),\n },\n { additionalProperties: false },\n);\nexport type LeaderSegment = Static<typeof LeaderSegmentSchema>;\n\nexport const LeaderCommandSchema = Type.Object(\n { name: Type.String({ minLength: 1 }), args: Type.Optional(Type.String()) },\n { additionalProperties: false },\n);\nexport type LeaderCommand = Static<typeof LeaderCommandSchema>;\n\nexport const LeaderActionSchema = Type.Object(\n {\n name: Type.String({\n minLength: 1,\n maxLength: 128,\n pattern: '^[a-z0-9][a-z0-9._:-]*$',\n }),\n },\n { additionalProperties: false },\n);\nexport type LeaderAction = Static<typeof LeaderActionSchema>;\n\nconst LeaderBindingBase = {\n id: Type.String({ minLength: 1 }),\n path: Type.Array(LeaderSegmentSchema, { minItems: 1 }),\n};\n\nexport const LeaderBindingSchema = Type.Union([\n Type.Object({ ...LeaderBindingBase, command: LeaderCommandSchema }, { additionalProperties: false }),\n Type.Object({ ...LeaderBindingBase, action: LeaderActionSchema }, { additionalProperties: false }),\n]);\nexport type LeaderBinding =\n | {\n id: string;\n path: readonly [LeaderSegment, ...LeaderSegment[]];\n command: LeaderCommand;\n }\n | {\n id: string;\n path: readonly [LeaderSegment, ...LeaderSegment[]];\n action: LeaderAction;\n };\n\nexport const LeaderSourceSchema = Type.String({\n minLength: 1,\n maxLength: 128,\n pattern: '^[A-Za-z0-9@][A-Za-z0-9@/._:-]*$',\n});\n\nexport const LeaderContributionSchema = Type.Object(\n {\n source: LeaderSourceSchema,\n bindings: Type.Array(LeaderBindingSchema),\n },\n { additionalProperties: false },\n);\nexport interface LeaderContribution {\n source: string;\n bindings: readonly LeaderBinding[];\n}\n\nexport const LeaderRegistrationSchema = Type.Object(\n { contribution: LeaderContributionSchema, generation: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const LeaderActionInvoked = defineNotification({\n channel: 'doom:ui:leader:v1:action-invoked',\n kind: 'leader.action-invoked',\n payload: Type.Object(\n { source: LeaderSourceSchema, action: LeaderActionSchema.properties.name },\n { additionalProperties: false },\n ),\n});\n\nexport const LeaderRegistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:ui:leader:v1:register',\n response: 'doom:ui:leader:v1:registered',\n error: 'doom:ui:leader:v1:error',\n },\n kinds: { request: 'leader.register', response: 'leader.registered' },\n request: LeaderRegistrationSchema,\n response: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n});\n\nexport const LeaderUnregistrationProtocol = defineRequestReply({\n channels: {\n request: 'doom:ui:leader:v1:unregister',\n response: 'doom:ui:leader:v1:unregistered',\n error: 'doom:ui:leader:v1:unregister-error',\n },\n kinds: { request: 'leader.unregister', response: 'leader.unregistered' },\n request: Type.Object({ handleId: Type.String({ minLength: 1 }) }, { additionalProperties: false }),\n response: Type.Object({ removed: Type.Boolean() }, { additionalProperties: false }),\n});\n\nconst LEADER_PROVIDER_TIMEOUT_MS = 250;\nconst DOOM_UI_SOURCE = '@agimon-ai/doompi-ui';\n\nfunction handleOptionalLeaderFailure(error: unknown): void {\n if (error instanceof DoomProtocolError && error.code === DOOM_PROTOCOL_ERROR_CODE.timeout) return;\n queueMicrotask(() => {\n throw error instanceof Error ? error : new Error(String(error));\n });\n}\n\nexport interface DoomLeaderContributionHandle {\n update(bindings: readonly LeaderBinding[]): void;\n dispose(): void;\n}\n\nfunction copyBindings(bindings: readonly LeaderBinding[]) {\n return bindings.map((binding) => ({\n id: binding.id,\n path: binding.path.map((segment) => ({ ...segment })),\n ...('command' in binding ? { command: { ...binding.command } } : { action: { ...binding.action } }),\n }));\n}\n\nexport function createDoomLeaderContribution(\n pi: DoomExtensionHost,\n contribution: LeaderContribution,\n): DoomLeaderContributionHandle {\n let runtime: ProtocolRuntime | undefined;\n let handleId: string | undefined;\n let generation = 0;\n let stopped = false;\n let bindings = copyBindings(contribution.bindings);\n let fingerprint = JSON.stringify(bindings);\n let queue: Promise<void> = Promise.resolve();\n\n const drop = (activeRuntime: ProtocolRuntime, activeHandle: string): Promise<void> =>\n activeRuntime\n .request(LeaderUnregistrationProtocol, { handleId: activeHandle }, { timeoutMs: LEADER_PROVIDER_TIMEOUT_MS })\n .then(() => undefined)\n .catch(handleOptionalLeaderFailure);\n\n const unregister = (): void => {\n const activeRuntime = runtime;\n const activeHandle = handleId;\n handleId = undefined;\n if (!activeRuntime || !activeHandle) return;\n queue = queue.then(() => drop(activeRuntime, activeHandle));\n };\n\n const publish = (): void => {\n const activeRuntime = runtime;\n if (!activeRuntime) return;\n const activeGeneration = generation;\n const activeBindings = bindings;\n queue = queue\n .then(async () => {\n const previous = handleId;\n handleId = undefined;\n if (previous) await drop(activeRuntime, previous);\n const registration = await activeRuntime.request(\n LeaderRegistrationProtocol,\n {\n contribution: { source: contribution.source, bindings: activeBindings },\n generation: String(activeGeneration),\n },\n { timeoutMs: LEADER_PROVIDER_TIMEOUT_MS },\n );\n if (stopped || generation !== activeGeneration || runtime !== activeRuntime) {\n await drop(activeRuntime, registration.handleId);\n return;\n }\n handleId = registration.handleId;\n })\n .catch(handleOptionalLeaderFailure);\n };\n\n pi.on('session_start', (_event, ctx) => {\n if (stopped) return;\n unregister();\n generation += 1;\n runtime = createProtocolRuntime({\n bus: pi.events,\n source: contribution.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n publish();\n });\n pi.on('session_shutdown', () => {\n generation += 1;\n unregister();\n runtime = undefined;\n });\n\n return {\n update(nextBindings) {\n if (stopped) return;\n const next = copyBindings(nextBindings);\n const nextFingerprint = JSON.stringify(next);\n if (nextFingerprint === fingerprint) return;\n fingerprint = nextFingerprint;\n bindings = next;\n publish();\n },\n dispose() {\n stopped = true;\n generation += 1;\n unregister();\n runtime = undefined;\n },\n };\n}\n\nexport function registerDoomLeaderContribution(pi: DoomExtensionHost, contribution: LeaderContribution): () => void {\n const handle = createDoomLeaderContribution(pi, contribution);\n return () => handle.dispose();\n}\n\nexport interface DoomLeaderActionHandlerOptions {\n source: string;\n handlers: Readonly<Record<string, (ctx: DoomExtensionContext) => void | Promise<void>>>;\n onError: (error: unknown, actionName: string, ctx: DoomExtensionContext) => void;\n}\n\nexport function registerDoomLeaderActionHandlers(\n pi: DoomExtensionHost,\n options: DoomLeaderActionHandlerOptions,\n): () => void {\n let disposeNotification: (() => void) | undefined;\n let generation = 0;\n let stopped = false;\n\n pi.on('session_start', (_event, ctx) => {\n if (stopped) return;\n disposeNotification?.();\n const activeGeneration = ++generation;\n const runtime = createProtocolRuntime({\n bus: pi.events,\n source: options.source,\n sessionId: ctx.sessionManager.getSessionId(),\n });\n disposeNotification = runtime.onNotification(LeaderActionInvoked, async ({ source, action }, identity) => {\n if (stopped || generation !== activeGeneration) return;\n if (identity.source !== DOOM_UI_SOURCE || source !== options.source) return;\n const handler = options.handlers[action];\n if (!handler) return;\n try {\n await handler(ctx);\n } catch (error) {\n options.onError(error, action, ctx);\n }\n });\n });\n pi.on('session_shutdown', () => {\n ++generation;\n disposeNotification?.();\n disposeNotification = undefined;\n });\n return () => {\n stopped = true;\n ++generation;\n disposeNotification?.();\n disposeNotification = undefined;\n };\n}\n"],"mappings":"8HAWA,MAAa,EAAsBA,EAAAA,KAAK,OACtC,CACE,IAAKA,EAAAA,KAAK,OAAO,CAAE,UAAW,EAAG,UAAW,CAAE,CAAC,EAC/C,MAAOA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EACnC,OAAQA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAC,EACnC,MAAOA,EAAAA,KAAK,SAASA,EAAAA,KAAK,QAAQ,CAAC,CACrC,EACA,CAAE,qBAAsB,EAAM,CAChC,EAGa,EAAsBA,EAAAA,KAAK,OACtC,CAAE,KAAMA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EAAG,KAAMA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAC,CAAE,EAC1E,CAAE,qBAAsB,EAAM,CAChC,EAGa,EAAqBA,EAAAA,KAAK,OACrC,CACE,KAAMA,EAAAA,KAAK,OAAO,CAChB,UAAW,EACX,UAAW,IACX,QAAS,yBACX,CAAC,CACH,EACA,CAAE,qBAAsB,EAAM,CAChC,EAGM,EAAoB,CACxB,GAAIA,EAAAA,KAAK,OAAO,CAAE,UAAW,C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