{"version":3,"file":"server.cjs","names":["defineServiceContract","PO_SERVER_SCOPE_SERVICE","requirePoServerScope","defineRoot","HOST_SLOT_METADATA","DECLARATIONS","Type","defineTool","HELP_WHEN","HELP_WHEN","packageResourcePath","readPackageResource","defineMode","PO_CODEMODE_SERVICE","readPoCodemode","serverModes","PO_SERVER_SCOPE_SERVICE","requirePoServerScope","readPoPackageHealth","readPoSelfImprove","defineRoot","runtime","Type","defineApiContract","jsonApiResponses","Check","PO_SERVER_SCOPE_SERVICE","requirePoServerScope","defineRoute","defineRoute","defineRoute","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineRoutedContribution","defineServerPlugin","composeServerProviderOverrides","rootWorkspace","rootSession","composeRootInjects","apiRoute","composeRootHooks","apiRoute2","apiRoute3","commandPoHelp","resourceCodemodeHowToBrain","resourceCodemodeHowToSelfImprove","resourceHelpHowToCreateTemplate","resourceHelpHowToCustomiseTemplate","resourcePoDevelopCodemodePlugin","resourcePoDevelopDashboardExtension","resourcePoDevelopNativeExtension","resourcePoHelp","resourcePoUseChatgptInstructions","resourcePoUseHelp","toolHelpStatus"],"sources":["../../src/services/brainSimulation/index.ts","../../src/extensions/workspaces/(backend)/root.server.ts","../../src/types/brainGraph.ts","../../src/services/brain/index.ts","../../src/constants/help.ts","../../src/schemas/diagnostics.ts","../../src/services/helpStatus/index.ts","../../src/services/selfImproveNamespace/index.ts","../../src/services/helpServerSession/index.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/runtime.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/schemas/apiContracts.ts","../../src/types/apiRoutes.ts","../../src/services/brainApi/index.ts","../../src/extensions/(backend)/api/brain/route.server.ts","../../src/extensions/workspaces/(backend)/api/brain/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/brain/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/command/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-brain.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-create-template.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-customise-template.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server.ts","../../src/extensions/workspaces/sessions/(backend)/tool/help_status.server.ts","../../generated/server.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\nimport { PO_SERVER_SCOPE_SERVICE, requirePoServerScope } from '@agimon-ai/po-core/serverPlugin';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport type { BrainSimulation } from './type';\n\n// Private bindings, never published as package contracts.\nexport const brainSimulationContracts = {\n  workspace: defineServiceContract<BrainSimulation>('help/brain-simulation', { scope: 'workspace' }),\n  session: defineServiceContract<BrainSimulation>('help/brain-simulation', { scope: 'session' }),\n};\n\nexport function createBrainSimulation(scopeId: string): BrainSimulation {\n  let enabled = false;\n  let disposed = false;\n  const check = (signal?: AbortSignal) => {\n    signal?.throwIfAborted();\n    if (disposed) throw new Error('Brain simulation scope is disposed.');\n  };\n  return {\n    scopeId,\n    simulation(signal) {\n      check(signal);\n      return { enabled };\n    },\n    setSimulation(value, signal) {\n      check(signal);\n      if (typeof value?.enabled !== 'boolean') throw new Error('Simulation enabled must be a boolean.');\n      enabled = value.enabled;\n      return { enabled };\n    },\n    dispose() {\n      disposed = true;\n    },\n  };\n}\n\nexport async function brainSimulationProvider(context: Context): Promise<void> {\n  await context.inject([PO_SERVER_SCOPE_SERVICE], async (injected) => {\n    const scope = requirePoServerScope(injected);\n    if (scope.level === 'host') throw new Error('Brain simulation requires a workspace or session.');\n    const state = createBrainSimulation(scope.snapshot().scope.id);\n    try {\n      const release = await scope.provide(brainSimulationContracts[scope.level], state);\n      return async () => {\n        state.dispose();\n        await release();\n      };\n    } catch (error) {\n      state.dispose();\n      throw error;\n    }\n  });\n}\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { brainSimulationProvider } from '../../../services/brainSimulation';\n\nexport default defineRoot((context: PoServerPluginContext) => ({\n  value: undefined,\n  // Outer roots also run as fallbacks inside a standalone session.\n  services: context.host.scope === 'workspace' ? [brainSimulationProvider] : [],\n}));\n","import type { BrainPackage, BrainServicesSnapshot } from '@agimon-ai/po-core/web';\n\n/**\n * The essential Brain graphs, shared by the web map and the Help-mode `brain` code-mode namespace\n * so both answer the same question the same way. Pure functions over a detached snapshot.\n */\nexport type BrainGraphKind = 'backend' | 'web' | 'native';\n/** public: jade, codemode: blue, plugin: neutral, personal: rose, slot: cyan. */\nexport type BrainNodeRole = 'public' | 'codemode' | 'plugin' | 'personal' | 'slot';\nexport interface BrainNode {\n  id: string;\n  label: string;\n  role: BrainNodeRole;\n  detail: string;\n}\nexport interface BrainLink {\n  source: string;\n  target: string;\n  label: string;\n}\nexport interface BrainGraph {\n  nodes: BrainNode[];\n  links: BrainLink[];\n}\nexport interface BrainNodeView {\n  kind: BrainGraphKind;\n  node: BrainNode;\n  links: { label: string; direction: 'out' | 'in'; node: BrainNode }[];\n}\n/** The shape of HOST_SLOT_METADATA, passed in so this module stays host-neutral. */\nexport type BrainHostSlots = Readonly<Record<string, { readonly slot: string; readonly description: string }>>;\n\nexport const BRAIN_GRAPH_KINDS: readonly BrainGraphKind[] = ['backend', 'web', 'native'];\n\nconst CODEMODE_SERVICE = 'po/codemode';\n// ponytail: a fixed list of scope and host wiring that every plugin injects; it hides the hub\n// that buries real capabilities. Promote to contract metadata if packages need to opt out.\nconst PLUMBING_SERVICES = new Set(['po/server-scope', 'po/server-host', 'po/headless-host', 'po/host-services']);\n\nfunction graphOf(nodes: Map<string, BrainNode>, links: Map<string, BrainLink>): BrainGraph {\n  const linked = new Set([...links.values()].flatMap((link) => [link.source, link.target]));\n  return {\n    nodes: [...nodes.values()].filter((node) => linked.has(node.id)).sort((a, b) => a.id.localeCompare(b.id)),\n    links: [...links.values()].sort((a, b) => `${a.source}\\0${a.target}`.localeCompare(`${b.source}\\0${b.target}`)),\n  };\n}\n\n/**\n * Public services, services a code-mode contributor can call (every service a plugin that injects\n * po/codemode resolves), and the plugins that consume them. Nodes collapse by name across scopes.\n * A nested fiber is an intermediary, so its injections fold into the plugin that owns it; unowned\n * fibers, unresolved injections and scope plumbing are left out.\n */\nexport function backendGraph(snapshot: BrainServicesSnapshot): BrainGraph {\n  const plugins = new Map(\n    snapshot.consumers.flatMap((consumer) =>\n      consumer.owner.kind === 'package' && consumer.owner.packageName\n        ? [[consumer.id, { name: consumer.owner.packageName, origin: consumer.owner.origin }] as const]\n        : [],\n    ),\n  );\n  const services = new Map(snapshot.services.map((service) => [service.id, service]));\n  const uses = snapshot.edges.flatMap((edge) => {\n    const plugin = plugins.get(edge.consumer);\n    const service = edge.service === null ? undefined : services.get(edge.service);\n    return plugin && service && !PLUMBING_SERVICES.has(service.name) ? [{ plugin, service }] : [];\n  });\n  const contributors = new Set(\n    uses.filter((use) => use.service.name === CODEMODE_SERVICE).map((use) => use.plugin.name),\n  );\n  const reachable = new Set(uses.filter((use) => contributors.has(use.plugin.name)).map((use) => use.service.name));\n  const nodes = new Map<string, BrainNode>();\n  const links = new Map<string, BrainLink>();\n  for (const { plugin, service } of uses) {\n    if (!service.public && !reachable.has(service.name)) continue;\n    const serviceId = `service:${service.name}`;\n    const previous = nodes.get(serviceId);\n    if (!previous || (service.description && previous.detail.endsWith('No description.')))\n      nodes.set(serviceId, {\n        id: serviceId,\n        label: service.name,\n        role: reachable.has(service.name) ? 'codemode' : 'public',\n        detail: `${service.public ? 'Public' : 'Private'} service${reachable.has(service.name) ? ', callable from code mode' : ''}. Provided by ${service.owner.packageName ?? service.owner.kind}. ${service.description ?? 'No description.'}`,\n      });\n    const pluginId = `plugin:${plugin.name}`;\n    nodes.set(pluginId, {\n      id: pluginId,\n      label: plugin.name,\n      role: plugin.origin === 'personal' ? 'personal' : 'plugin',\n      detail: `Plugin${contributors.has(plugin.name) ? ' that contributes to code mode' : ''}.`,\n    });\n    links.set(`${pluginId}\\0${serviceId}`, { source: pluginId, target: serviceId, label: 'consumes' });\n  }\n  return graphOf(nodes, links);\n}\n\n/** Each plugin and the slots it fills or declares, for one client host. */\nexport function clientGraph(\n  packages: readonly BrainPackage[],\n  target: 'web' | 'native',\n  hostSlots: BrainHostSlots = {},\n): BrainGraph {\n  const hostDescriptions = new Map(Object.values(hostSlots).map((slot) => [slot.slot, slot.description]));\n  const nodes = new Map<string, BrainNode>();\n  const links = new Map<string, BrainLink>();\n  const slot = (name: string, description?: string) => {\n    const id = `slot:${name}`;\n    if (!nodes.has(id) || description)\n      nodes.set(id, {\n        id,\n        label: name,\n        role: 'slot',\n        detail: `Slot. ${description ?? hostDescriptions.get(name) ?? 'No description.'}`,\n      });\n    return id;\n  };\n  for (const pkg of packages) {\n    const metadata = target === 'web' ? pkg.web : pkg.native;\n    if (!metadata || !pkg.owner.packageName) continue;\n    const pluginId = `plugin:${pkg.owner.packageName}`;\n    nodes.set(pluginId, {\n      id: pluginId,\n      label: pkg.owner.packageName,\n      role: pkg.owner.origin === 'personal' ? 'personal' : 'plugin',\n      detail: `Plugin with a ${target} half.`,\n    });\n    for (const declared of metadata.slots) {\n      const slotId = slot(declared.name, declared.description);\n      links.set(`${pluginId}\\0${slotId}`, { source: pluginId, target: slotId, label: 'declares' });\n    }\n    for (const fill of metadata.fills) {\n      if (fill.slot === null) continue;\n      const slotId = slot(fill.slot);\n      links.set(`${pluginId}\\0${slotId}`, { source: pluginId, target: slotId, label: 'fills' });\n    }\n  }\n  return graphOf(nodes, links);\n}\n\n/** One essential graph. Web prefers the exact browser mount inventory; native reads installed packages. */\nexport function brainGraph(\n  snapshot: BrainServicesSnapshot,\n  kind: BrainGraphKind,\n  hostSlots?: BrainHostSlots,\n): BrainGraph {\n  if (kind === 'backend') return backendGraph(snapshot);\n  return clientGraph(\n    kind === 'web' ? (snapshot.clientPackages ?? snapshot.packages) : snapshot.packages,\n    kind,\n    hostSlots,\n  );\n}\n\n/** A node and its direct connections in one graph, or undefined when the graph lacks it. */\nexport function brainNodeView(graph: BrainGraph, kind: BrainGraphKind, id: string): BrainNodeView | undefined {\n  const byId = new Map(graph.nodes.map((node) => [node.id, node]));\n  const node = byId.get(id);\n  if (!node) return undefined;\n  return {\n    kind,\n    node,\n    links: graph.links.flatMap((link): BrainNodeView['links'] =>\n      link.source === id\n        ? [{ label: link.label, direction: 'out' as const, node: byId.get(link.target)! }]\n        : link.target === id\n          ? [{ label: link.label, direction: 'in' as const, node: byId.get(link.source)! }]\n          : [],\n    ),\n  };\n}\n","import type { PoCodemodeNamespace } from '@agimon-ai/po-core/codemode';\nimport {\n  HOST_SLOT_METADATA,\n  type BrainSlot,\n  type BrainFill,\n  type BrainSlotsSnapshot,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n  BRAIN_GRAPH_KINDS,\n  brainGraph,\n  brainNodeView,\n  type BrainGraphKind,\n  type BrainNodeView,\n} from '../../types/brainGraph';\nimport type { Brain, BrainOptions, BrainNamespaceOptions } from './type';\n\nexport function createBrain(options: BrainOptions): Brain {\n  const services: Brain['services'] = (signal) => {\n    signal?.throwIfAborted();\n    options.assertActive?.();\n    return structuredClone(options.scope.snapshot());\n  };\n  return {\n    services,\n    slots(signal) {\n      const snapshot = services(signal);\n      const diagnostics = [...snapshot.diagnostics];\n      const packages = snapshot.clientPackages ?? snapshot.packages;\n      if (snapshot.clientPackages === undefined)\n        diagnostics.push(\n          'Coverage gap: browser mount inventory unavailable; only matching server installations are described.',\n        );\n      const slots = new Map<string, BrainSlot>();\n      const fills = new Map<string, BrainFill>();\n      const globalScope = snapshot.scopes.find((scope) => scope.level === 'host');\n      if (globalScope)\n        for (const declaration of Object.values(HOST_SLOT_METADATA)) {\n          slots.set(`host\\0${declaration.slot}`, {\n            id: `host:${declaration.slot}`,\n            name: declaration.slot,\n            scope: globalScope,\n            owner: { kind: 'host', packageName: null, origin: 'unknown' },\n            description: declaration.description,\n            parent: 'parent' in declaration ? declaration.parent : null,\n            kind: declaration.kind,\n          });\n        }\n      // Apply outer mounts first. A manifest describes possible mounts, not admission.\n      // Only descriptors matching an actual installation at this scope are evidence.\n      for (const scope of [...snapshot.scopes].reverse()) {\n        for (const pkg of packages) {\n          if (pkg.scope.id !== scope.id) continue;\n          const name = pkg.owner.packageName ?? `${pkg.owner.kind}:${pkg.scope.id}`;\n          if (pkg.web === null) {\n            diagnostics.push(`${name}: web metadata unavailable.`);\n            continue;\n          }\n          diagnostics.push(...pkg.web.diagnostics.map((message) => `${name}: ${message}`));\n          for (const declaration of pkg.web.slots) {\n            if (declaration.scope !== scope.level) continue;\n            slots.set(`${name}\\0${declaration.name}`, {\n              id: `${name}:${declaration.name}`,\n              name: declaration.name,\n              scope,\n              owner: pkg.owner,\n              description: declaration.description ?? null,\n              parent: declaration.parent ?? null,\n              kind: declaration.kind,\n            });\n          }\n          for (const declaration of pkg.web.fills) {\n            if (declaration.scope !== scope.level) continue;\n            fills.set(`${name}\\0${declaration.slot}\\0${declaration.id}`, {\n              ...declaration,\n              scope,\n              owner: pkg.owner,\n            });\n          }\n        }\n      }\n      const values = [...slots.values()];\n      for (const slot of values) {\n        const visited = new Set<string>([slot.name]);\n        let parent = slot.parent;\n        while (parent !== null) {\n          if (visited.has(parent)) {\n            diagnostics.push(`Slot ${slot.name}: parent cycle at ${parent}.`);\n            break;\n          }\n          visited.add(parent);\n          const next =\n            values.find(\n              (candidate) => candidate.name === parent && candidate.owner.packageName === slot.owner.packageName,\n            ) ?? values.find((candidate) => candidate.name === parent);\n          if (!next) {\n            diagnostics.push(`Slot ${slot.name}: missing parent ${parent}.`);\n            break;\n          }\n          parent = next.parent;\n        }\n      }\n      const result: BrainSlotsSnapshot = {\n        scope: snapshot.scope,\n        scopes: snapshot.scopes,\n        slots: values,\n        fills: [...fills.values()],\n        diagnostics: [...new Set(diagnostics)],\n      };\n      return structuredClone(result);\n    },\n  };\n}\n\n// Explicit wire declarations, kept independent of service values and runtime objects.\nconst DECLARATIONS = `type Scope = { id: string; level: 'host' | 'workspace' | 'session' };\ntype Owner = { kind: 'host' | 'package' | 'unknown'; packageName: string | null; origin: 'po' | 'personal' | 'unknown' };\ninterface WebMetadata { version: 1; slots: { name: string; scope: Scope['level']; description?: string; parent?: string; kind: 'data' | 'component' }[]; fills: { id: string; slot: string | null; scope: Scope['level']; placement: 'verified' | 'unverified' }[]; diagnostics: string[] }\ninterface PackageMetadata { scope: Scope; owner: Owner; web: WebMetadata | null; native?: WebMetadata | null }\ninterface ServicesSnapshot { scope: Scope; scopes: Scope[]; packages: PackageMetadata[]; clientPackages?: PackageMetadata[]; services: { id: string; name: string; scope: Scope; visibleFrom: Scope; owner: Owner; public: boolean; description: string | null }[]; consumers: { id: string; name: string; scope: Scope; owner: Owner }[]; edges: { consumer: string; service: string | null; name: string; status: 'resolved' | 'waiting' }[]; diagnostics: string[] }\ninterface SlotsSnapshot { scope: Scope; scopes: Scope[]; slots: { id: string; name: string; scope: Scope; owner: Owner; description: string | null; parent: string | null; kind: 'data' | 'component' }[]; fills: { id: string; slot: string | null; scope: Scope; owner: Owner; placement: 'verified' | 'unverified' }[]; diagnostics: string[] }\ntype GraphKind = 'backend' | 'web' | 'native';\ntype Role = 'public' | 'codemode' | 'plugin' | 'personal' | 'slot';\ninterface GraphNode { id: string; label: string; role: Role; detail: string }\n/** backend: plugin -consumes-> service. web/native: plugin -fills|declares-> slot. */\ninterface Graph { kind: GraphKind; nodes: GraphNode[]; links: { source: string; target: string; label: string }[] }\ninterface NodeView { kind: GraphKind; node: GraphNode; links: { label: string; direction: 'out' | 'in'; node: GraphNode }[] }\ndeclare const brain: {\n  /** The essential map the Brain page draws. Ids look like 'plugin:@scope/name', 'service:po/fs', 'slot:page'. */\n  graph(input?: { kind?: GraphKind }): Promise<Graph>;\n  /** One node and its direct links in every graph that has it, or only in kind. Empty when absent. */\n  node(input: { id: string; kind?: GraphKind }): Promise<NodeView[]>;\n  /** Raw snapshot with fibers, private services, waiting injections and diagnostics. */\n  services(): Promise<ServicesSnapshot>;\n  /** Raw web slot declarations, parent links and fill placements. */\n  slots(): Promise<SlotsSnapshot>;\n};`;\n\nfunction graphKind(value: unknown): BrainGraphKind {\n  if (value === undefined) return 'backend';\n  if (BRAIN_GRAPH_KINDS.includes(value as BrainGraphKind)) return value as BrainGraphKind;\n  throw new Error(`kind must be one of ${BRAIN_GRAPH_KINDS.join(', ')}.`);\n}\n\nfunction input(value: unknown): Record<string, unknown> {\n  if (value === undefined) return {};\n  if (value !== null && typeof value === 'object' && !Array.isArray(value)) return value as Record<string, unknown>;\n  throw new Error('Expected an options object.');\n}\n\nexport function createBrainNamespace(options: BrainNamespaceOptions): PoCodemodeNamespace {\n  return {\n    name: 'brain',\n    summary:\n      'Explore the essential service and slot graphs (backend, web, native) and raw service and slot snapshots. Read-only, Help mode.',\n    declarations: DECLARATIONS,\n    bind(run) {\n      if (run.sessionId !== options.sessionId) throw new Error('The brain namespace belongs to another session.');\n      const check = () => {\n        run.signal.throwIfAborted();\n        options.assertActive();\n      };\n      return {\n        graph: async (options_?: unknown) => {\n          check();\n          const kind = graphKind(input(options_).kind);\n          return { kind, ...brainGraph(options.service.services(run.signal), kind, HOST_SLOT_METADATA) };\n        },\n        node: async (options_?: unknown) => {\n          check();\n          const { id, kind } = input(options_);\n          if (typeof id !== 'string' || !id.trim() || id.length > 1024) throw new Error('id must be a node id string.');\n          const snapshot = options.service.services(run.signal);\n          const kinds = kind === undefined ? BRAIN_GRAPH_KINDS : [graphKind(kind)];\n          return kinds.flatMap((each): BrainNodeView[] => {\n            const view = brainNodeView(brainGraph(snapshot, each, HOST_SLOT_METADATA), each, id);\n            return view ? [view] : [];\n          });\n        },\n        services: async () => {\n          check();\n          return options.service.services(run.signal);\n        },\n        slots: async () => {\n          check();\n          return options.service.slots(run.signal);\n        },\n      };\n    },\n  };\n}\n","export const HELP_COMMAND_NAME = 'po-help';\nexport const HELP_COMMAND_DESCRIPTION = 'Toggle Help guidance and read-only support diagnostics';\nexport const HELP_MODE_ID = 'help';\nexport const HELP_PACKAGE_SOURCE = '@agimon-ai/po-help';\nexport const HELP_SKILL = {\n  name: 'help-how-to-help',\n  description:\n    'Set up and debug Po agents using installed package guidance and scoped, read-only diagnostics. Diagnose missing capabilities before proposing authorized repairs.',\n} as const;\nexport const HELP_GUIDANCE =\n  'Help mode is active. Read help-how-to-help, inspect the available diagnostics, and use the narrowest package guidance for the task. Diagnose before proposing changes. Help does not grant additional permissions.';\nexport const HELP_STATUS_TOOL_NAME = 'help_status';\nexport const HELP_STATUS_TOOL_DESCRIPTION =\n  'Inspect active Help skills, diagnostic tools, contributor ownership, and unavailable contributions in this session. Read-only; does not change selection or permissions.';\nexport const HELP_STATUS_LIMIT = 128;\n\nexport const HELP_CHATGPT_SKILL = {\n  name: 'help-how-to-chatgpt-instructions',\n  description:\n    \"Print a paste-ready ChatGPT project instruction (at most 8,000 characters) that routes code-mode work through this session's MCP tools and condenses every AGENTS.md rule. Writes no files.\",\n} as const;\n\nexport const HELP_CODEMODE_SKILL = {\n  name: 'help-how-to-codemode-plugin',\n  description:\n    'Add code-mode support to a Po package: contribute a namespace to exec and discover, replace the direct tool it supersedes, and ship the skill that teaches agents to use it.',\n} as const;\n\nexport const HELP_NATIVE_SKILL = {\n  name: 'help-how-to-native-extension',\n  description:\n    \"Add or change a Po package's phone UI (.native files, native templates) so it mirrors the cockpit, passes the native build, and is approved and verified before it ships.\",\n} as const;\n\nexport const HELP_DASHBOARD_SKILL = {\n  name: 'help-how-to-dashboard-extension',\n  description:\n    'Add plugin sections to Home and Workspace pages with dashboard-tiles on web and native. Choose global or workspace scope, supply tile presentation and navigation, and migrate legacy home-apps cards.',\n} as const;\nexport const HELP_CUSTOMISE_TEMPLATE_SKILL = {\n  name: 'help-how-to-customise-template',\n  description:\n    \"Change how the template Po already uses looks, from the person's own package and without Po's source code. Add a backdrop, ambient sound, a composer or empty-state wrapper, a theme, or CSS; covers package setup, install, and checks.\",\n} as const;\nexport const HELP_CREATE_TEMPLATE_SKILL = {\n  name: 'help-how-to-create-template',\n  description:\n    \"Build a new Po layout (a web and optional phone template) in the person's own package, without Po's source code. Covers the template contract, the public building blocks, a complete starter, install, selection and checks.\",\n} as const;\n\nexport const HELP_SELF_IMPROVE_SKILL = {\n  name: 'codemode-how-to-self-improve',\n  description:\n    \"Reload Po's own packages after you edit them, without restarting Po or reopening the session. Use in Help mode after changing a plugin's source or build, or after adding or removing a package.\",\n} as const;\n\nexport const HELP_BRAIN_SKILL = {\n  name: 'codemode-how-to-brain',\n  description: 'Inspect scoped service ownership, declared dependencies and slot metadata in Help mode.',\n} as const;\n","import { Type } from 'typebox';\n\nexport const helpStatusParameters = Type.Object({}, { additionalProperties: false });\n","import type { PoHeadlessCapabilitySnapshot } from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord } from '@agimon-ai/po-core/help';\nimport { defineTool } from '@agimon-ai/po-core/serverPlugin';\n\nimport {\n  HELP_GUIDANCE,\n  HELP_MODE_ID,\n  HELP_STATUS_LIMIT,\n  HELP_STATUS_TOOL_DESCRIPTION,\n  HELP_STATUS_TOOL_NAME,\n} from '../../constants/help';\nimport { helpStatusParameters } from '../../schemas/diagnostics';\nimport type { HelpStatusReport } from './type';\n\n/** `packageFailures`: the host's failed global and workspace packages; they never degrade Help itself. */\nexport function serverHelpStatus(\n  snapshot: PoHeadlessCapabilitySnapshot,\n  enabled: boolean,\n  packageFailures: readonly PoPackageFailureRecord[] = [],\n): HelpStatusReport {\n  const entries = snapshot.capabilities.filter((entry) => entry.when?.state?.['mode'] === HELP_MODE_ID);\n  const skills = entries.filter((entry) => entry.kind === 'skill');\n  const tools = entries.filter((entry) => entry.kind === 'tool');\n  const diagnostics = entries\n    .filter((entry) => enabled && entry.reason && entry.reason !== 'inactive')\n    .map((entry) => ({ source: entry.source, code: `HELP_${entry.reason!.replaceAll('-', '_').toUpperCase()}` }));\n  const ready = snapshot.ready;\n  return {\n    activation: !enabled ? 'inactive' : !ready ? 'activating' : diagnostics.length ? 'degraded' : 'active',\n    ready,\n    revision: snapshot.revision,\n    counts: {\n      skills: ready ? skills.filter((entry) => entry.active && entry.discoverable).length : null,\n      tools: tools.filter((entry) => entry.active).length,\n    },\n    skills: skills.slice(0, HELP_STATUS_LIMIT).map(({ name, source, active, discoverable, reason }) => ({\n      name,\n      source,\n      active: active && discoverable,\n      ...(reason ? { reason } : {}),\n    })),\n    tools: tools\n      .slice(0, HELP_STATUS_LIMIT)\n      .map(({ name, source, active, reason }) => ({ name, source, active, ...(reason ? { reason } : {}) })),\n    diagnostics: diagnostics.slice(0, HELP_STATUS_LIMIT),\n    packages: enabled ? packageFailures.slice(-HELP_STATUS_LIMIT) : [],\n    truncated:\n      skills.length > HELP_STATUS_LIMIT ||\n      tools.length > HELP_STATUS_LIMIT ||\n      diagnostics.length > HELP_STATUS_LIMIT ||\n      (enabled && packageFailures.length > HELP_STATUS_LIMIT),\n  };\n}\n\nexport function helpStatusDetail(report: HelpStatusReport): string {\n  return `${report.counts.skills ?? 'pending'} Help skills, ${report.counts.tools} diagnostic tools${report.diagnostics.length ? ' (diagnostics available)' : ''}`;\n}\n\nexport function createHelpStatusTool(\n  inspect: () => HelpStatusReport | Promise<HelpStatusReport>,\n  authorize: (signal?: AbortSignal) => AbortSignal,\n) {\n  return defineTool({\n    name: HELP_STATUS_TOOL_NAME,\n    description: HELP_STATUS_TOOL_DESCRIPTION,\n    parameters: helpStatusParameters,\n    when: HELP_WHEN,\n    promptGuidelines: [HELP_GUIDANCE],\n    async execute(_input, execution) {\n      const signal = authorize(execution.signal);\n      const report = await inspect();\n      signal.throwIfAborted();\n      authorize(execution.signal);\n      return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }], details: report };\n    },\n  });\n}\n","import type { PoCodemodeNamespace } from '@agimon-ai/po-core/codemode';\nimport type { PoHeadlessRefreshAxis } from '@agimon-ai/po-core/headless';\n\nimport type { SelfImproveNamespaceOptions, SelfImproveOperation, SelfImproveScope } from './type';\n\n/** Finished operations kept for `operation(id)`; older ones are forgotten first. */\nconst MAX_OPERATIONS = 20;\nconst SCOPES: readonly SelfImproveScope[] = ['session', 'workspace', 'host'];\nconst AXES: readonly PoHeadlessRefreshAxis[] = ['preset', 'domains', 'profile'];\nconst OUTCOME_MESSAGE_TYPE = 'po-help/self-improve';\n\n/** One line the agent can pass on to the person without calling operation(). */\nfunction describeOutcome(operation: SelfImproveOperation): string {\n  const what = operation.axes\n    ? `Refresh ${operation.operationId} (${operation.axes.join(', ')})`\n    : `Reload ${operation.operationId} (${operation.scope} scope)`;\n  const tell = 'Tell the person the outcome.';\n  if (operation.state === 'failed')\n    return `${what} failed, nothing changed: ${(operation.error ?? 'unknown error').replace(/\\.$/u, '')}. ${tell}`;\n  const result = operation.result;\n  const parts = [\n    result?.installed.length ? `installed ${result.installed.join(', ')}` : '',\n    result?.removed.length ? `removed ${result.removed.join(', ')}` : '',\n    result?.failed.length\n      ? `failed ${result.failed.map((item) => `${item.packageName} (${item.reason})`).join(', ')}, which keep their previous build`\n      : '',\n  ].filter(Boolean);\n  return `${what} ${operation.state}${parts.length ? `: ${parts.join('; ')}` : ''}. ${tell}`;\n}\n\nconst DECLARATIONS = `type Scope = 'session' | 'workspace' | 'host';\ntype Axis = 'preset' | 'domains' | 'profile';\ninterface PackageFailure { scope: string; packageName: string; stage: string; reason: string; previous?: 'restored' | 'lost' | 'none'; at: string }\ninterface Operation {\n  operationId: string; scope: Scope; axes?: Axis[];\n  /** partial: applied, but some packages failed and keep their previous build when they had one. */\n  state: 'queued' | 'applied' | 'partial' | 'failed';\n  result?: { installed: string[]; removed: string[]; failed: { packageName: string; reason: string }[] };\n  error?: string;\n  /** Why the outcome follow-up could not reach you, when it did not. */\n  undelivered?: string;\n}\ndeclare const selfImprove: {\n  /** Packages whose current build failed to load or install, by scope. */\n  plugins(): Promise<{ failures: PackageFailure[] }>;\n  /** Queues a reload of one scope's packages from disk. When it finishes you get a follow-up message with the outcome; operation() returns it too. host needs confirm: true, after the person agreed. */\n  reload(input: { scope: Scope; confirm?: boolean }): Promise<Operation>;\n  /** Queues a re-apply of this session's current preset, domains or profile (default: all three) after editing their config; reports its outcome like reload. */\n  refresh(input?: { axes?: Axis[] }): Promise<Operation>;\n  operation(operationId: string): Promise<Operation>;\n};`;\n\nexport function createSelfImproveNamespace(options: SelfImproveNamespaceOptions): PoCodemodeNamespace {\n  const operations = new Map<string, SelfImproveOperation>();\n  let next = 0;\n  const remember = (operation: SelfImproveOperation): SelfImproveOperation => {\n    operations.set(operation.operationId, operation);\n    for (const id of operations.keys()) {\n      if (operations.size <= MAX_OPERATIONS) break;\n      if (operations.get(id)?.state !== 'queued') operations.delete(id);\n    }\n    return operation;\n  };\n  // The agent hears the outcome on its own instead of being asked whether a queued reload worked.\n  const finish = (operation: SelfImproveOperation) => {\n    remember(operation);\n    void Promise.resolve(\n      options.admitMessage?.(\n        { type: OUTCOME_MESSAGE_TYPE, text: describeOutcome(operation), display: true },\n        'followUp',\n      ),\n    ).catch((error: unknown) => {\n      // A session closed mid-reload cannot take the message; operation(id) reports the outcome and why it was not sent.\n      remember({ ...operation, undelivered: error instanceof Error ? error.message : String(error) });\n    });\n  };\n  return {\n    name: 'selfImprove',\n    summary:\n      \"Reload Po's own packages after editing them, or refresh this session's mode, domains and profile config, without restarting. Help mode, main agent only.\",\n    declarations: DECLARATIONS,\n    bind(run) {\n      if (run.sessionId !== options.sessionId) throw new Error('The selfImprove namespace belongs to another session.');\n      const check = () => {\n        run.signal.throwIfAborted();\n        options.assertActive();\n        if (run.caller !== 'main') throw new Error('Only the main agent may reload or refresh Po.');\n      };\n      return {\n        plugins: async () => {\n          check();\n          return { failures: JSON.parse(JSON.stringify(options.failures())) as unknown };\n        },\n        reload: async (input: unknown) => {\n          check();\n          const { scope: requested, confirm } = (input ?? {}) as { scope?: unknown; confirm?: unknown };\n          if (requested === 'global') throw new Error(\"The 'global' scope was renamed to 'host'. Update this client.\");\n          const scope = requested;\n          if (!SCOPES.includes(scope as SelfImproveScope))\n            throw new Error(\"reload needs scope 'session', 'workspace' or 'host'.\");\n          if (scope === 'host' && confirm !== true)\n            throw new Error('A host reload changes every session; ask the person, then pass confirm: true.');\n          const operationId = `reload-${String(++next)}`;\n          const queued = remember({ operationId, scope: scope as SelfImproveScope, state: 'queued' });\n          // Not awaited: a session reload waits for this tool round to end.\n          void options.service.reload({ scope: queued.scope, sessionId: options.sessionId }).then(\n            (result) =>\n              finish({\n                ...queued,\n                state: result.failed.length === 0 ? 'applied' : 'partial',\n                result: JSON.parse(JSON.stringify(result)) as SelfImproveOperation['result'],\n              }),\n            (error: unknown) =>\n              finish({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n          );\n          return { ...queued };\n        },\n        refresh: async (input: unknown) => {\n          check();\n          const { axes = AXES } = (input ?? {}) as { axes?: unknown };\n          if (\n            !Array.isArray(axes) ||\n            axes.length === 0 ||\n            !axes.every((axis) => AXES.includes(axis as PoHeadlessRefreshAxis))\n          )\n            throw new Error(\"refresh axes are 'preset', 'domains' and 'profile'.\");\n          const queued = remember({\n            operationId: `refresh-${String(++next)}`,\n            scope: 'session',\n            axes: [...new Set(axes as PoHeadlessRefreshAxis[])],\n            state: 'queued',\n          });\n          // Not awaited: the refresh waits for this tool round to end.\n          void options.service.refresh({ sessionId: options.sessionId, axes: queued.axes! }).then(\n            () => finish({ ...queued, state: 'applied' }),\n            (error: unknown) =>\n              finish({ ...queued, state: 'failed', error: error instanceof Error ? error.message : String(error) }),\n          );\n          return JSON.parse(JSON.stringify(queued)) as SelfImproveOperation;\n        },\n        operation: async (operationId: unknown) => {\n          check();\n          const operation = typeof operationId === 'string' ? operations.get(operationId) : undefined;\n          if (operation === undefined) throw new Error(`No operation '${String(operationId)}'.`);\n          return JSON.parse(JSON.stringify(operation)) as SelfImproveOperation;\n        },\n      };\n    },\n  };\n}\n","import { PO_CODEMODE_SERVICE, readPoCodemode } from '@agimon-ai/po-core/codemode';\nimport type {\n  PoHeadlessCommand,\n  PoHeadlessExecutionContext,\n  PoHeadlessHostService,\n  PoHeadlessResource,\n} from '@agimon-ai/po-core/headless';\nimport { PO_HELP_WHEN as HELP_WHEN, type PoPackageFailureRecord, type PoSelfImprove } from '@agimon-ai/po-core/help';\nimport {\n  type PoServerPluginContext,\n  type PoServerSessionPlugin,\n  packageResourcePath,\n  readPackageResource,\n} from '@agimon-ai/po-core/serverPlugin';\nimport { defineMode, serverModes, type ModeOwner, type ModeState } from '@agimon-ai/po-mode';\n\nimport {\n  HELP_COMMAND_DESCRIPTION,\n  HELP_COMMAND_NAME,\n  HELP_GUIDANCE,\n  HELP_MODE_ID,\n  HELP_PACKAGE_SOURCE,\n  HELP_CHATGPT_SKILL,\n  HELP_CODEMODE_SKILL,\n  HELP_NATIVE_SKILL,\n  HELP_DASHBOARD_SKILL,\n  HELP_CREATE_TEMPLATE_SKILL,\n  HELP_CUSTOMISE_TEMPLATE_SKILL,\n  HELP_SELF_IMPROVE_SKILL,\n  HELP_BRAIN_SKILL,\n  HELP_SKILL,\n} from '../../constants/help';\nimport { createBrainNamespace } from '../brain';\nimport type { Brain } from '../brain/type';\nimport { createHelpStatusTool, helpStatusDetail, serverHelpStatus } from '../helpStatus';\nimport { createSelfImproveNamespace } from '../selfImproveNamespace';\n\n/** Names the checkout and test home when the session runs under `po --test`; read only from the admitted session. */\nfunction testInstanceNote(text: string, environment: PoHeadlessExecutionContext['environment']): string {\n  if (environment.PO_TEST !== '1') return text;\n  return `${text.trimEnd()}\\n\\n## This instance\\n\\nThis is a \\`--test\\` instance running from a Po checkout.\\n\\n- Checkout: ${environment.PO_TEST_ROOT ?? 'unknown'}\\n- Test Po home: ${environment.PO_HOME ?? 'unknown'}\\n\\nBuild the edited package in this checkout first, then reload the scope that selects it. A host reload still needs the person's consent.\\n`;\n}\nexport function createHelpServerSession(\n  host: PoHeadlessHostService,\n  packageFailures: () => readonly PoPackageFailureRecord[] = () => [],\n  /** The host's package reload; without it (edge, tests) Help offers no selfImprove namespace. */\n  selfImprove?: PoSelfImprove,\n  brain?: Brain,\n): PoServerSessionPlugin {\n  let modeOwner: ModeOwner | undefined;\n  let pending: boolean | undefined;\n  let failure: string | undefined;\n  let generation = 0;\n  let disposed = false;\n  const active = () => (host.context.selection.state?.['mode'] ?? []).includes(HELP_MODE_ID);\n  const inspect = () => serverHelpStatus(host.inspectCapabilities(), active(), packageFailures());\n  const modeState = (): ModeState => {\n    const report = inspect();\n    return {\n      activation: pending === true ? 'activating' : active() ? 'active' : 'inactive',\n      condition:\n        pending !== undefined || !report.ready\n          ? 'queued'\n          : failure\n            ? 'failed'\n            : report.activation === 'degraded'\n              ? 'degraded'\n              : 'ready',\n      ...(pending !== undefined\n        ? { detail: 'applying Help capabilities' }\n        : failure\n          ? { detail: failure }\n          : active()\n            ? { detail: helpStatusDetail(report) }\n            : {}),\n      actions: [\n        {\n          id: 'activate',\n          enabled: !active() && pending === undefined,\n          ...(!active() && pending === undefined ? {} : { disabledReason: 'Help is active or changing.' }),\n        },\n        {\n          id: 'deactivate',\n          enabled: active() || pending === true,\n          ...(active() || pending === true ? {} : { disabledReason: 'Help mode is not active.' }),\n        },\n      ],\n    };\n  };\n  const resources: PoHeadlessResource[] = [\n    { when: HELP_WHEN, name: 'po-help', kind: 'context', read: () => HELP_GUIDANCE },\n    {\n      when: HELP_WHEN,\n      ...HELP_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-help/SKILL.md');\n        if (!text.trim()) throw new Error('The installed Help skill is missing or unreadable.');\n        return text;\n      },\n    },\n    {\n      when: HELP_WHEN,\n      ...HELP_CHATGPT_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-chatgpt-instructions/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(\n          import.meta.url,\n          'src/prompts/help-how-to-chatgpt-instructions/SKILL.md',\n        );\n        if (!text.trim()) throw new Error('The installed ChatGPT instruction skill is missing or unreadable.');\n        return text;\n      },\n    },\n    {\n      when: HELP_WHEN,\n      ...HELP_NATIVE_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-native-extension/SKILL.md');\n        if (!text.trim()) throw new Error('The installed native extension skill is missing or unreadable.');\n        return text;\n      },\n    },\n    {\n      when: HELP_WHEN,\n      ...HELP_CODEMODE_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-codemode-plugin/SKILL.md');\n        if (!text.trim()) throw new Error('The installed code-mode plugin skill is missing or unreadable.');\n        return text;\n      },\n    },\n    {\n      when: HELP_WHEN,\n      ...HELP_CUSTOMISE_TEMPLATE_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-customise-template/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-customise-template/SKILL.md');\n        if (!text.trim()) throw new Error('The installed template customisation skill is missing or unreadable.');\n        return text;\n      },\n    },\n    {\n      when: HELP_WHEN,\n      ...HELP_CREATE_TEMPLATE_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-create-template/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-create-template/SKILL.md');\n        if (!text.trim()) throw new Error('The installed template creation skill is missing or unreadable.');\n        return text;\n      },\n    },\n    ...(brain\n      ? [\n          {\n            when: HELP_WHEN,\n            ...HELP_BRAIN_SKILL,\n            kind: 'skill' as const,\n            pinned: true,\n            path: packageResourcePath(import.meta.url, 'src/prompts/codemode-how-to-brain/SKILL.md'),\n            read: () => readPackageResource(import.meta.url, 'src/prompts/codemode-how-to-brain/SKILL.md'),\n          },\n        ]\n      : []),\n    // Pinned like every code-mode guide, but listed only where the host can reload and Help is on.\n    ...(selfImprove === undefined\n      ? []\n      : [\n          {\n            when: HELP_WHEN,\n            ...HELP_SELF_IMPROVE_SKILL,\n            kind: 'skill' as const,\n            pinned: true,\n            path: packageResourcePath(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n            read: async (execution: PoHeadlessExecutionContext) =>\n              testInstanceNote(\n                await readPackageResource(import.meta.url, 'src/prompts/codemode-how-to-self-improve/SKILL.md'),\n                execution.environment,\n              ),\n          },\n        ]),\n    {\n      when: HELP_WHEN,\n      ...HELP_DASHBOARD_SKILL,\n      kind: 'skill',\n      path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md'),\n      read: async () => {\n        const text = await readPackageResource(import.meta.url, 'src/prompts/help-how-to-dashboard-extension/SKILL.md');\n        if (!text.trim()) throw new Error('The installed dashboard extension skill is missing or unreadable.');\n        return text;\n      },\n    },\n  ];\n  const selectMode = async (enabled: boolean, signal?: AbortSignal): Promise<void> => {\n    if (disposed) throw new Error('Help runtime is disposed.');\n    signal?.throwIfAborted();\n    const operation = ++generation;\n    pending = enabled;\n    failure = undefined;\n    modeOwner?.publish();\n    try {\n      if (enabled) await resources[1]!.read(host.context);\n      signal?.throwIfAborted();\n      if (operation !== generation || disposed) throw new Error('Help activation was cancelled.');\n      const modes = (host.context.selection.state?.['mode'] ?? []).filter((mode) => mode !== HELP_MODE_ID);\n      await host.changeSelection({\n        axis: 'state',\n        key: 'mode',\n        values: enabled ? [...modes, HELP_MODE_ID] : modes,\n      });\n    } catch (error) {\n      if (operation === generation) failure = (error instanceof Error ? error.message : String(error)).slice(0, 160);\n      throw error;\n    } finally {\n      if (operation === generation) {\n        pending = undefined;\n        modeOwner?.publish();\n      }\n    }\n  };\n  const command: PoHeadlessCommand = {\n    name: HELP_COMMAND_NAME,\n    description: HELP_COMMAND_DESCRIPTION,\n    async execute(_args, execution) {\n      await selectMode(!(pending ?? active()));\n      await execution.client.notify({\n        title: 'Po Help',\n        body: active() ? 'Help mode activated.' : 'Help mode deactivated.',\n        level: 'info',\n      });\n    },\n  };\n  modeOwner = defineMode({\n    descriptor: {\n      source: HELP_PACKAGE_SOURCE,\n      id: HELP_MODE_ID,\n      label: 'Help',\n      description: 'Package guidance and read-only diagnostics for agent setup and debugging.',\n      order: 50,\n      actions: [\n        {\n          id: 'activate',\n          label: 'Activate',\n          description: 'Expose Help guidance and diagnostic tools.',\n          contexts: ['headless'],\n          parameters: [],\n        },\n        {\n          id: 'deactivate',\n          label: 'Deactivate',\n          description: 'Withdraw Help-only guidance and diagnostic tools.',\n          contexts: ['headless'],\n          parameters: [],\n        },\n      ],\n    },\n    state: modeState,\n    async handleAction(_runtime, actionId, _argumentsValue, { signal }) {\n      if (actionId !== 'activate' && actionId !== 'deactivate')\n        throw new Error(`Unknown Help mode action: ${actionId}`);\n      await selectMode(actionId === 'activate', signal);\n      return { message: active() ? 'Help mode activated.' : 'Help mode deactivated.' };\n    },\n  }).createOwner(undefined);\n  const assertHelpActive = () => {\n    host.assertActive(HELP_PACKAGE_SOURCE);\n    if (disposed || !active()) throw new Error('Help mode is not active.');\n  };\n  // Registered only while Help is on: the activity starts with Help and stops when it is withdrawn.\n  const selfImproveService = (cordis: PoServerPluginContext['context']) => {\n    cordis.inject([PO_CODEMODE_SERVICE], (scoped) => {\n      const codemode = readPoCodemode(scoped);\n      if (!codemode || !selfImprove) return undefined;\n      const namespace = createSelfImproveNamespace({\n        sessionId: host.context.sessionId,\n        service: selfImprove,\n        failures: packageFailures,\n        assertActive: assertHelpActive,\n        admitMessage: host.context.session.admitMessage?.bind(host.context.session),\n      });\n      const activity = host.registerActivity({\n        when: HELP_WHEN,\n        name: 'selfImprove',\n        start: () => {\n          const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);\n          return () => registration.dispose();\n        },\n      });\n      return () => activity.dispose();\n    });\n  };\n  const brainService = (cordis: PoServerPluginContext['context']) => {\n    cordis.inject([PO_CODEMODE_SERVICE], (scoped) => {\n      const codemode = readPoCodemode(scoped);\n      if (!codemode || !brain) return undefined;\n      const namespace = createBrainNamespace({\n        sessionId: host.context.sessionId,\n        service: brain,\n        assertActive: assertHelpActive,\n      });\n      const activity = host.registerActivity({\n        when: HELP_WHEN,\n        name: 'brain',\n        start: () => {\n          const registration = codemode.register(HELP_PACKAGE_SOURCE, namespace);\n          return () => registration.dispose();\n        },\n      });\n      return () => activity.dispose();\n    });\n  };\n  return {\n    services: [\n      serverModes([modeOwner]),\n      ...(selfImprove ? [selfImproveService] : []),\n      ...(brain ? [brainService] : []),\n    ],\n    resources,\n    commands: [command],\n    tools: [\n      createHelpStatusTool(inspect, (signal) => {\n        signal?.throwIfAborted();\n        host.assertActive(HELP_PACKAGE_SOURCE);\n        if (disposed || !active()) throw new Error('Help mode is not active.');\n        return signal ?? new AbortController().signal;\n      }),\n    ],\n    onDispose() {\n      disposed = true;\n      generation += 1;\n    },\n  };\n}\n","import { readPoPackageHealth, readPoSelfImprove } from '@agimon-ai/po-core/help';\nimport {\n  PO_SERVER_SCOPE_SERVICE,\n  requirePoServerScope,\n  type PoServerPluginDefinition,\n  type PoServerSessionPlugin,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport { createBrain } from '../../../../../services/brain';\nimport type { Brain } from '../../../../../services/brain/type';\nimport { createHelpServerSession } from '../../../../../services/helpServerSession';\n\nexport default (async ({ agent, context }): Promise<Partial<PoServerSessionPlugin>> => {\n  if (!agent) return {};\n  let brain: Brain | undefined;\n  const provider = context.inject([PO_SERVER_SCOPE_SERVICE], (injected) => {\n    let disposed = false;\n    brain = createBrain({\n      scope: requirePoServerScope(injected),\n      assertActive() {\n        if (disposed) throw new Error('Brain scope is disposed.');\n      },\n    });\n    return () => {\n      disposed = true;\n      brain = undefined;\n    };\n  });\n  await provider.await();\n  if (!brain) throw new Error('Brain scope is unavailable.');\n  return createHelpServerSession(\n    agent,\n    () => readPoPackageHealth(context)?.failures() ?? [],\n    readPoSelfImprove(context),\n    brain,\n  );\n}) satisfies NonNullable<PoServerPluginDefinition['session']>;\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { brainSimulationProvider } from '../../../../services/brainSimulation';\nimport runtime from './_lib/runtime.server';\n\nexport default defineRoot(async (context: PoServerPluginContext) => {\n  const value = await runtime(context);\n  return {\n    value,\n    services: [brainSimulationProvider, ...(value.services ?? [])],\n    activities: value.activities,\n    onStart: value.onStart,\n    onStop: value.onStop,\n    onDispose: value.onDispose,\n  };\n});\n","import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst level = Type.Union([Type.Literal('host'), Type.Literal('workspace'), Type.Literal('session')]);\nconst scope = Type.Object({ id: Type.String(), level });\nconst nullableString = Type.Union([Type.String(), Type.Null()]);\nconst owner = Type.Object({\n  kind: Type.Union([Type.Literal('host'), Type.Literal('package'), Type.Literal('unknown')]),\n  packageName: nullableString,\n  origin: Type.Union([Type.Literal('po'), Type.Literal('personal'), Type.Literal('unknown')]),\n});\nconst kind = Type.Union([Type.Literal('data'), Type.Literal('component')]);\nconst placement = Type.Union([Type.Literal('verified'), Type.Literal('unverified')]);\nconst web = Type.Object({\n  version: Type.Literal(1),\n  slots: Type.Array(\n    Type.Object({\n      name: Type.String(),\n      scope: level,\n      description: Type.Optional(Type.String()),\n      parent: Type.Optional(Type.String()),\n      kind,\n    }),\n  ),\n  fills: Type.Array(Type.Object({ id: Type.String(), slot: nullableString, scope: level, placement })),\n  diagnostics: Type.Array(Type.String()),\n});\nconst base = { scope, scopes: Type.Array(scope), diagnostics: Type.Array(Type.String()) };\nconst services = Type.Object({\n  ...base,\n  packages: Type.Array(Type.Object({ scope, owner, web: Type.Union([web, Type.Null()]) })),\n  clientPackages: Type.Optional(Type.Array(Type.Object({ scope, owner, web: Type.Union([web, Type.Null()]) }))),\n  services: Type.Array(\n    Type.Object({\n      id: Type.String(),\n      name: Type.String(),\n      scope,\n      visibleFrom: scope,\n      owner,\n      public: Type.Boolean(),\n      description: nullableString,\n    }),\n  ),\n  consumers: Type.Array(Type.Object({ id: Type.String(), name: Type.String(), scope, owner })),\n  edges: Type.Array(\n    Type.Object({\n      consumer: Type.String(),\n      service: nullableString,\n      name: Type.String(),\n      status: Type.Union([Type.Literal('resolved'), Type.Literal('waiting')]),\n    }),\n  ),\n});\nconst slots = Type.Object({\n  ...base,\n  slots: Type.Array(\n    Type.Object({\n      id: Type.String(),\n      name: Type.String(),\n      scope,\n      owner,\n      description: nullableString,\n      parent: nullableString,\n      kind,\n    }),\n  ),\n  fills: Type.Array(Type.Object({ id: Type.String(), slot: nullableString, scope, owner, placement })),\n});\nexport const brainSimulationSchema = Type.Object({ enabled: Type.Boolean() }, { additionalProperties: false });\n\nexport const apiContracts = defineApiContract({\n  version: 1,\n  sockets: [],\n  dynamic: [],\n  http: [\n    ...(['workspace', 'session'] as const).flatMap((scope) => [\n      {\n        id: `brain.${scope}.simulation`,\n        scope,\n        basePath: 'brain',\n        path: '/simulation',\n        method: 'GET' as const,\n        authentication: 'owner' as const,\n        description: 'Read this exact scope simulation toggle.',\n        responses: jsonApiResponses(brainSimulationSchema),\n      },\n      {\n        id: `brain.${scope}.setSimulation`,\n        scope,\n        basePath: 'brain',\n        path: '/simulation',\n        method: 'PUT' as const,\n        authentication: 'owner' as const,\n        description: 'Set this exact scope simulation toggle without persistence or inheritance.',\n        body: { required: true, contentType: 'application/json' as const, schema: brainSimulationSchema },\n        responses: jsonApiResponses(brainSimulationSchema),\n      },\n    ]),\n    ...(['host', 'workspace', 'session'] as const).flatMap((scope) => [\n      {\n        id: `brain.${scope}.services`,\n        scope,\n        basePath: 'brain',\n        path: '/services',\n        method: 'GET' as const,\n        authentication: 'owner' as const,\n        description: 'Read this exact scope and its ancestry service graph.',\n        responses: jsonApiResponses(services),\n      },\n      {\n        id: `brain.${scope}.slots`,\n        scope,\n        basePath: 'brain',\n        path: '/slots',\n        method: 'GET' as const,\n        authentication: 'owner' as const,\n        description:\n          'Read host slots and metadata from this exact admitted browser mount and its ancestry, with explicit coverage diagnostics for older hosts.',\n        responses: jsonApiResponses(slots),\n      },\n    ]),\n  ],\n});\nexport default apiContracts;\n","import type { ApiResponseOf, ApiRoutes, BrainServicesSnapshot, BrainSlotsSnapshot } from '@agimon-ai/po-core/web';\n\nexport interface BrainSimulationState {\n  enabled: boolean;\n}\n\nexport const routes = {\n  simulation: {\n    method: 'GET',\n    path: '/simulation',\n    response: undefined as unknown as ApiResponseOf<BrainSimulationState>,\n  },\n  setSimulation: {\n    method: 'PUT',\n    path: '/simulation',\n    response: undefined as unknown as ApiResponseOf<BrainSimulationState>,\n  },\n  services: {\n    method: 'GET',\n    path: '/services',\n    response: undefined as unknown as ApiResponseOf<BrainServicesSnapshot>,\n  },\n  slots: { method: 'GET', path: '/slots', response: undefined as unknown as ApiResponseOf<BrainSlotsSnapshot> },\n} as const satisfies ApiRoutes;\n","import type { PoApi } from '@agimon-ai/po-core/packageApi';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\nimport { PO_SERVER_SCOPE_SERVICE, requirePoServerScope } from '@agimon-ai/po-core/serverPlugin';\nimport { Check } from 'typebox/value';\n\nimport { brainSimulationSchema } from '../../schemas/apiContracts';\nimport { routes } from '../../types/apiRoutes';\nimport { createBrain } from '../brain';\nimport type { Brain } from '../brain/type';\nimport { brainSimulationContracts } from '../brainSimulation';\nimport type { BrainSimulation } from '../brainSimulation/type';\n\nexport function createBrainApi(service: Brain, simulation?: () => BrainSimulation | undefined): PoApi {\n  return {\n    basePath: 'brain',\n    start() {\n      let closed = false;\n      return {\n        fetch(request) {\n          request.signal.throwIfAborted();\n          if (closed) throw new Error('Brain API is closed.');\n          if (new URL(request.url).pathname === routes.simulation.path) {\n            if (request.method !== 'GET' && request.method !== 'PUT') return new Response(null, { status: 405 });\n            const state = simulation?.();\n            if (!state) return new Response('Simulation is unavailable for this scope.', { status: 409 });\n            if (request.method === 'GET') return Response.json(state.simulation(request.signal));\n            return (async () => {\n              let body: unknown;\n              try {\n                body = await request.json();\n              } catch {\n                request.signal.throwIfAborted();\n                if (closed) throw new Error('Brain API is closed.');\n                return new Response('Invalid JSON body.', { status: 400 });\n              }\n              request.signal.throwIfAborted();\n              if (closed) throw new Error('Brain API is closed.');\n              // Resolve again after reading: disposal or replacement must not mutate a stale state.\n              if (simulation?.() !== state) throw new Error('Brain simulation scope is unavailable or disposed.');\n              if (!Check(brainSimulationSchema, body))\n                return new Response('Expected {enabled:boolean}.', { status: 400 });\n              return Response.json(state.setSimulation({ enabled: body.enabled }, request.signal));\n            })();\n          }\n          if (request.method !== 'GET') return new Response(null, { status: 405 });\n          switch (new URL(request.url).pathname) {\n            case routes.services.path:\n              return Response.json(service.services(request.signal));\n            case routes.slots.path:\n              return Response.json(service.slots(request.signal));\n            default:\n              return new Response(null, { status: 404 });\n          }\n        },\n        close() {\n          closed = true;\n        },\n      };\n    },\n  };\n}\n\n/** Each routed mount reads its own scope, never a captured session or a parent API root. */\nexport function brainApiForScope(context: PoServerPluginContext): PoApi {\n  let service: Brain | undefined;\n  let readSimulation: (() => BrainSimulation | undefined) | undefined;\n  context.context.inject([PO_SERVER_SCOPE_SERVICE], (injected) => {\n    const scope = requirePoServerScope(injected);\n    service = createBrain({ scope });\n    readSimulation = () => {\n      if (scope.level === 'host') return undefined;\n      const state = scope.resolve(brainSimulationContracts[scope.level]);\n      return state?.scopeId === scope.snapshot().scope.id ? state : undefined;\n    };\n    return () => {\n      service = undefined;\n      readSimulation = undefined;\n    };\n  });\n  return createBrainApi(\n    {\n      services(signal) {\n        if (!service) throw new Error('Brain scope is unavailable or disposed.');\n        return service.services(signal);\n      },\n      slots(signal) {\n        if (!service) throw new Error('Brain scope is unavailable or disposed.');\n        return service.slots(signal);\n      },\n    },\n    () => {\n      if (!service) throw new Error('Brain scope is unavailable or disposed.');\n      return readSimulation?.();\n    },\n  );\n}\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\n\nimport { brainApiForScope } from '../../../../services/brainApi';\n\nexport default defineRoute(brainApiForScope);\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\n\nimport { brainApiForScope } from '../../../../../services/brainApi';\n\nexport default defineRoute(brainApiForScope);\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\n\nimport { brainApiForScope } from '../../../../../../services/brainApi';\n\nexport default defineRoute(brainApiForScope);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.commands?.[0],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) =>\n    context.root.resources?.find((resource) => resource.name === 'codemode-how-to-brain'),\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\n// Present only where the host binds package reload; see createHelpServerSession.\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) =>\n    context.root.resources?.find((resource) => resource.name === 'codemode-how-to-self-improve'),\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) =>\n    context.root.resources?.find((resource) => resource.name === 'help-how-to-create-template'),\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) =>\n    context.root.resources?.find((resource) => resource.name === 'help-how-to-customise-template'),\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[4],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) =>\n    context.root.resources?.find((resource) => resource.name === 'help-how-to-dashboard-extension'),\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[3],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[0],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[2],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.resources?.[1],\n  { cardinality: 'optional' },\n);\n","import { defineRoutedContribution, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext, PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoutedContribution(\n  (context: WithRoot<PoServerPluginContext, Partial<PoServerSessionPlugin>>) => context.root.tools?.[0],\n  { cardinality: 'optional' },\n);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootWorkspace from '../src/extensions/workspaces/(backend)/root.server';\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/(backend)/api/brain/route.server';\nimport apiRoute2 from '../src/extensions/workspaces/(backend)/api/brain/route.server';\nimport apiRoute3 from '../src/extensions/workspaces/sessions/(backend)/api/brain/route.server';\nimport commandPoHelp from '../src/extensions/workspaces/sessions/(backend)/command/po-help.server';\nimport resourceCodemodeHowToBrain from '../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-brain.server';\nimport resourceCodemodeHowToSelfImprove from '../src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-self-improve.server';\nimport resourceHelpHowToCreateTemplate from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-create-template.server';\nimport resourceHelpHowToCustomiseTemplate from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-customise-template.server';\nimport resourcePoDevelopCodemodePlugin from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-codemode-plugin.server';\nimport resourcePoDevelopDashboardExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-dashboard-extension.server';\nimport resourcePoDevelopNativeExtension from '../src/extensions/workspaces/sessions/(backend)/resource/po-develop-native-extension.server';\nimport resourcePoHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-help.server';\nimport resourcePoUseChatgptInstructions from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-chatgpt-instructions.server';\nimport resourcePoUseHelp from '../src/extensions/workspaces/sessions/(backend)/resource/po-use-help.server';\nimport toolHelpStatus from '../src/extensions/workspaces/sessions/(backend)/tool/help_status.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/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n  values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n  (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n  name: '@agimon-ai/po-help',\n  providerOverrides: composeServerProviderOverrides(rootWorkspace, rootSession),\n  injects: composeRootInjects({ workspace: [rootWorkspace], session: [rootWorkspace, rootSession] }),\n  host: (context) => ({\n    get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, context)]; },\n  }),\n  workspace: async (context) => {\n    const scopeWorkspace = await context.scopeRoot('workspace', rootWorkspace, context);\n    const contextWorkspace = { ...context, root: scopeWorkspace.value };\n    return {\n      ...composeRootHooks(scopeWorkspace),\n      get api(): PoServerSessionPlugin['api'] { return [at(apiRoute2, contextWorkspace)]; },\n      services: [...(scopeWorkspace.services ?? [])],\n    };\n  },\n  session: async (context) => {\n    const scopeWorkspace = await context.scopeRoot('workspace', rootWorkspace, context);\n    const contextWorkspace = { ...context, root: scopeWorkspace.value };\n    const scopeSession = await context.scopeRoot('session', rootSession, contextWorkspace);\n    const contextSession = { ...contextWorkspace, root: scopeSession.value };\n    return {\n      ...composeRootHooks(scopeWorkspace, scopeSession),\n      get api(): PoServerSessionPlugin['api'] { return [at(apiRoute3, contextSession)]; },\n      get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'po-help' }, at(commandPoHelp, contextSession))]); },\n      get resources(): PoServerSessionPlugin['resources'] { return defined([at(resourceCodemodeHowToBrain, contextSession), at(resourceCodemodeHowToSelfImprove, contextSession), at(resourceHelpHowToCreateTemplate, contextSession), at(resourceHelpHowToCustomiseTemplate, contextSession), at(resourcePoDevelopCodemodePlugin, contextSession), at(resourcePoDevelopDashboardExtension, contextSession), at(resourcePoDevelopNativeExtension, contextSession), at(resourcePoHelp, contextSession), at(resourcePoUseChatgptInstructions, contextSession), at(resourcePoUseHelp, contextSession)]); },\n      get tools(): PoServerSessionPlugin['tools'] { return defined([via({ name: 'help_status' }, at(toolHelpStatus, contextSession))]); },\n      services: [...(scopeWorkspace.services ?? []), ...(scopeSession.services ?? [])],\n      get activities(): PoServerSessionPlugin['activities'] { return [...(scopeWorkspace.activities ?? []), ...(scopeSession.activities ?? [])]; },\n    };\n  },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAa,2BAA2B;CACtC,YAAA,GAAWA,iCAAAA,sBAAAA,CAAuC,yBAAyB,EAAE,OAAO,YAAY,CAAC;CACjG,UAAA,GAASA,iCAAAA,sBAAAA,CAAuC,yBAAyB,EAAE,OAAO,UAAU,CAAC;AAC/F;AAEA,SAAgB,sBAAsB,SAAkC;CACtE,IAAI,UAAU;CACd,IAAI,WAAW;CACf,MAAM,SAAS,WAAyB;EACtC,QAAQ,eAAe;EACvB,IAAI,UAAU,MAAM,IAAI,MAAM,qCAAqC;CACrE;CACA,OAAO;EACL;EACA,WAAW,QAAQ;GACjB,MAAM,MAAM;GACZ,OAAO,EAAE,QAAQ;EACnB;EACA,cAAc,OAAO,QAAQ;GAC3B,MAAM,MAAM;GACZ,IAAI,OAAO,OAAO,YAAY,WAAW,MAAM,IAAI,MAAM,uCAAuC;GAChG,UAAU,MAAM;GAChB,OAAO,EAAE,QAAQ;EACnB;EACA,UAAU;GACR,WAAW;EACb;CACF;AACF;AAEA,eAAsB,wBAAwB,SAAiC;CAC7E,MAAM,QAAQ,OAAO,CAACC,gCAAAA,uBAAuB,GAAG,OAAO,aAAa;EAClE,MAAM,SAAA,GAAQC,gCAAAA,qBAAAA,CAAqB,QAAQ;EAC3C,IAAI,MAAM,UAAU,QAAQ,MAAM,IAAI,MAAM,mDAAmD;EAC/F,MAAM,QAAQ,sBAAsB,MAAM,SAAS,CAAC,CAAC,MAAM,EAAE;EAC7D,IAAI;GACF,MAAM,UAAU,MAAM,MAAM,QAAQ,yBAAyB,MAAM,QAAQ,KAAK;GAChF,OAAO,YAAY;IACjB,MAAM,QAAQ;IACd,MAAM,QAAQ;GAChB;EACF,SAAS,OAAO;GACd,MAAM,QAAQ;GACd,MAAM;EACR;CACF,CAAC;AACH;;;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