{"version":3,"file":"ecmascript-B9Z2C24U.mjs","names":["#fileName","#scriptKind","#inferScriptKind","#typeScriptPromise","#loadTypeScript","#resolveSourceFile","#sourceFile","#getMembersFromNode","#getMembersFromInterfaceNode","#findTopLevelDeclaration","#findNestedMember","#extractSignatureText"],"sources":["../src/batteries/artifacts/ecmascript/exceptions.ts","../src/batteries/artifacts/ecmascript/index.ts"],"sourcesContent":["/**\n * Battery-scoped exceptions for the EcmaScript artifact battery.\n *\n * @remarks\n * Internal sibling of the `@nhtio/adk/batteries/artifacts/ecmascript` entry — re-exported from\n * the battery's own barrel per the battery-scoped-exceptions rule. These are the typed errors the\n * battery throws when loading or configuring its TypeScript compiler peer dependency.\n */\n\nimport { createException } from '@nhtio/adk/factories'\n\n/**\n * Thrown when the TypeScript peer dependency fails to load.\n *\n * @remarks\n * The battery requires typescript as an optional peer. This exception surfaces when the\n * dynamic import fails, typically because the package is not installed or cannot be resolved.\n * The message template includes the package name, a description of its purpose, the underlying\n * error, and the exact install command, so the consumer sees a complete, actionable message\n * regardless of call site.\n */\nexport const E_TYPESCRIPT_PEER_MISSING = createException<[string]>(\n  'E_TYPESCRIPT_PEER_MISSING',\n  'the ecmascript battery could not load its peer dependency \"typescript\" (needed for EcmaScript artifact queries): %s — install it (pnpm add typescript)',\n  'E_TYPESCRIPT_PEER_MISSING',\n  500\n)\n","/**\n * @module @nhtio/adk/batteries/artifacts/ecmascript\n *\n * Provides `SpooledEcmaScriptArtifact`, a structured query interface for JavaScript and\n * TypeScript source files.\n *\n * @remarks\n * Parse source code via the TypeScript compiler API to enable structural queries:\n * - `artifact_es_symbols` — top-level declarations (functions, classes, interfaces, types)\n * - `artifact_es_imports` — import declarations and their source modules\n * - `artifact_es_exports` — export declarations and re-exports\n * - `artifact_es_outline` — nested member index (class methods/properties, interface members)\n * - `artifact_es_signature` — declaration signature text (parameters, return types)\n * - `artifact_es_jsdoc` — JSDoc comments attached to declarations\n * - `artifact_es_references` — syntactic scan for identifier usage (not semantic)\n *\n * **Decoding note:** `decode()` on a `SpooledEcmaScriptArtifact` throws until\n * `registerArtifactEncodables()` has run. `encode()` requires no setup.\n */\n\nimport { validator } from '@nhtio/validation'\nimport { E_TYPESCRIPT_PEER_MISSING } from './exceptions'\nimport { isError, isInstanceOf } from '@nhtio/adk/guards'\nimport { ArtifactTool, ToolRegistry, resolveSpoolReader, ReaderDescriptor } from '@nhtio/adk/common'\nimport {\n  SpooledArtifact,\n  collectArtifactCompatibleIds,\n  defaultSerialise,\n  resolveArtifactById,\n} from '@nhtio/adk/spooled_artifact'\n\n/**\n * Well-known @nhtio/encoder contract keys, resolved via the global symbol registry\n * to avoid a hard dependency on the optional @nhtio/encoder peer.\n */\nconst ENCODE_METHOD: unique symbol = Symbol.for('@nhtio/encoder:toEncoded')\nconst DECODE_METHOD: unique symbol = Symbol.for('@nhtio/encoder:fromEncoded')\nimport type { SourceFile } from 'typescript'\nimport type { DispatchContext, SpoolReader, ToolMethodDescriptor } from '@nhtio/adk/types'\n\n/** Snapshot payload for the encoder contract; the encoder treats it as opaque. */\ntype AdkEncodableSnapshot = unknown\n\n/**\n * A top-level declaration (function, class, interface, type alias, enum, or binding).\n *\n * @remarks\n * Line numbers are 0-based. `startLine` is the line containing the declaration keyword or\n * identifier. `endLine` is the 0-based index of the last line belonging to this declaration\n * (inclusive).\n */\nexport interface EcmaScriptSymbol {\n  /** Declaration kind: `'function'`, `'class'`, `'interface'`, `'type'`, `'enum'`, or `'const'`/`'let'`/`'var'`. */\n  kind: string\n  /** The declared name. */\n  name: string\n  /** Whether this declaration is exported. */\n  exported: boolean\n  /** 0-based line of the first line of this declaration. */\n  startLine: number\n  /** 0-based line of the last line of this declaration (inclusive). */\n  endLine: number\n}\n\n/**\n * An import declaration.\n *\n * @remarks\n * Line numbers are 0-based. The `named` array contains all imported identifiers from a named\n * import; `default` contains the default import name (if any); `namespace` contains the\n * namespace import name (if `import * as`). `typeOnly` indicates whether this is a\n * `import type` declaration.\n */\nexport interface EcmaScriptImport {\n  /** The module specifier (e.g., `'@nhtio/adk/common'` or `'./utils'`). */\n  moduleSpecifier: string\n  /** Array of named imports (empty if none). */\n  named: string[]\n  /** The default import name, or undefined. */\n  default?: string\n  /** The namespace import name (for `import *`), or undefined. */\n  namespace?: string\n  /** True for `import type` declarations. */\n  typeOnly: boolean\n  /** 0-based line of this import statement. */\n  line: number\n}\n\n/**\n * An export declaration or re-export.\n *\n * @remarks\n * Includes named exports, default exports, re-exports (`export * from`), and re-export named\n * members. When `moduleSpecifier` is present, this is a re-export; otherwise it re-exports\n * locally-declared members.\n */\nexport interface EcmaScriptExport {\n  /** 0-based line of this export statement. */\n  line: number\n  /** The module specifier for re-exports (e.g., `'./utils'`), or undefined for local exports. */\n  moduleSpecifier?: string\n  /** Array of named exports (empty if this is `export default` or `export * from`). */\n  named: string[]\n  /** True for `export default`. */\n  isDefault: boolean\n  /** True for `export * from`. */\n  isNamespaceReExport: boolean\n  /** True for `export type` declarations. */\n  isTypeOnly: boolean\n}\n\n/**\n * A class or interface member in the outline.\n */\nexport interface OutlineMember {\n  /** The member name. */\n  name: string\n  /** The member kind: `'method'`, `'property'`, `'accessor'`, or `'signature'`. */\n  kind: string\n  /** 0-based line of this member. */\n  startLine: number\n  /** 0-based line of the last line of this member (inclusive). */\n  endLine: number\n}\n\n/**\n * An entry in the structural outline (class or interface with its members).\n */\nexport interface OutlineEntry {\n  /** The container kind: `'class'` or `'interface'`. */\n  kind: 'class' | 'interface'\n  /** The container name. */\n  name: string\n  /** 0-based line of the container declaration. */\n  startLine: number\n  /** 0-based line of the last line of this container (inclusive). */\n  endLine: number\n  /** Array of members (methods, properties, accessors). */\n  members: OutlineMember[]\n}\n\n/**\n * The location of an identifier reference.\n */\nexport interface IdentifierReference {\n  /** 0-based line where this identifier appears. */\n  line: number\n  /** 0-based column where this identifier starts. */\n  column: number\n}\n\n/**\n * A {@link @nhtio/adk!SpooledArtifact} specialisation for EcmaScript (JavaScript and TypeScript)\n * source files.\n *\n * @remarks\n * Parses source code syntactically (no type checker) using the TypeScript compiler API, enabling\n * structural queries without materialising the full file into memory.\n *\n * The parser automatically infers the script kind (`.js`, `.ts`, `.jsx`, `.tsx`) from the\n * `fileName` when provided; defaults to `ts` when omitted (it parses the widest grammar).\n *\n * All parsing errors are non-fatal — TypeScript's parser is error-tolerant and produces a\n * partial tree. Diagnostics are not surfaced by the query methods.\n */\nexport class SpooledEcmaScriptArtifact extends SpooledArtifact {\n  #sourceFile: SourceFile | undefined\n  #fileName: string | undefined\n  #scriptKind: 'js' | 'jsx' | 'ts' | 'tsx'\n\n  /**\n   * @param reader - The backing store to read from.\n   * @param options - Optional configuration.\n   * @param options.fileName - The source file name. When provided, script kind is inferred from\n   *   the extension (`.mts`/`.cts`/`.ts` → `'ts'`, `.mjs`/`.cjs`/`.js` → `'js'`, `.tsx` → `'tsx'`,\n   *   `.jsx` → `'jsx'`). Defaults to `undefined`.\n   * @param options.scriptKind - Explicit script kind override. Defaults to `'ts'` when not\n   *   provided and cannot be inferred from `fileName`.\n   */\n  constructor(\n    reader: SpoolReader,\n    options?: {\n      fileName?: string\n      scriptKind?: 'js' | 'jsx' | 'ts' | 'tsx'\n    }\n  ) {\n    super(reader)\n    this.#fileName = options?.fileName\n    this.#scriptKind = options?.scriptKind ?? this.#inferScriptKind(options?.fileName) ?? 'ts'\n  }\n\n  /**\n   * Returns `true` if `value` is a {@link SpooledEcmaScriptArtifact} instance.\n   *\n   * @remarks\n   * Uses the cross-realm-safe {@link @nhtio/adk!isInstanceOf} guard. Safe against the\n   * dual-module-copy case.\n   */\n  public static isSpooledEcmaScriptArtifact(value: unknown): value is SpooledEcmaScriptArtifact {\n    return isInstanceOf(value, 'SpooledEcmaScriptArtifact', SpooledEcmaScriptArtifact)\n  }\n\n  /**\n   * The EcmaScript-specific artifact-query descriptors this class adds.\n   *\n   * @remarks\n   * Lists seven descriptors; the base seven (`artifact_head`, etc.) are forged separately.\n   */\n  public static toolMethods: ReadonlyArray<ToolMethodDescriptor> = Object.freeze([\n    {\n      name: 'artifact_es_symbols',\n      method: 'es_symbols',\n      description:\n        'Return every top-level declaration (function, class, interface, type, enum, const/let/var) from an EcmaScript artifact produced earlier in this turn. Optionally filter by declaration kind.',\n      argsSchema: validator.object({\n        kind: validator\n          .string()\n          .optional()\n          .allow('')\n          .description(\n            'Optional declaration kind filter (e.g., \"function\", \"class\", \"interface\"). Empty string or omitted means no filter.'\n          ),\n      }),\n    },\n    {\n      name: 'artifact_es_imports',\n      method: 'es_imports',\n      description:\n        'Return every import declaration from an EcmaScript artifact produced earlier in this turn, including default imports, named imports, namespace imports, and type-only imports.',\n      argsSchema: validator.object({}),\n    },\n    {\n      name: 'artifact_es_exports',\n      method: 'es_exports',\n      description:\n        'Return every export declaration and re-export from an EcmaScript artifact produced earlier in this turn, including the export * form.',\n      argsSchema: validator.object({}),\n    },\n    {\n      name: 'artifact_es_outline',\n      method: 'es_outline',\n      description:\n        'Return a nested structural index from an EcmaScript artifact produced earlier in this turn: each class or interface with its methods, properties, and accessors, all with line ranges.',\n      argsSchema: validator.object({}),\n    },\n    {\n      name: 'artifact_es_signature',\n      method: 'es_signature',\n      description:\n        'Return the signature text (type parameters, parameters, return type) of a named declaration from an EcmaScript artifact produced earlier in this turn, without the body.',\n      argsSchema: validator.object({\n        name: validator\n          .string()\n          .required()\n          .description('The name of the declaration whose signature to retrieve.'),\n      }),\n    },\n    {\n      name: 'artifact_es_jsdoc',\n      method: 'es_jsdoc',\n      description:\n        'Return the JSDoc comment attached to a named declaration from an EcmaScript artifact produced earlier in this turn.',\n      argsSchema: validator.object({\n        name: validator\n          .string()\n          .required()\n          .description('The name of the declaration whose JSDoc to retrieve.'),\n      }),\n    },\n    {\n      name: 'artifact_es_references',\n      method: 'es_references',\n      description:\n        'Return every line (0-based) where an identifier appears in an EcmaScript artifact produced earlier in this turn. This is a syntactic scan only — without a type checker it cannot distinguish shadowed bindings or resolve ambiguous names. Do not treat this as a semantic find-references.',\n      argsSchema: validator.object({\n        name: validator.string().required().description('The identifier name to search for.'),\n      }),\n    },\n  ])\n\n  /**\n   * Forges base-class tools plus EcmaScript-specific tools narrowed to {@link SpooledEcmaScriptArtifact}.\n   */\n  public static override forgeTools(ctx: DispatchContext): ToolRegistry {\n    const registry = SpooledArtifact.forgeTools(ctx)\n    const requires = SpooledEcmaScriptArtifact\n    const compatibleIds = collectArtifactCompatibleIds(ctx, requires)\n    if (compatibleIds.length === 0) return registry\n\n    for (const descriptor of this.toolMethods) {\n      const callIdSchema = validator\n        .string()\n        .valid(...compatibleIds)\n        .required()\n        .description('ToolCall id of the artifact to query.')\n\n      const argsSchema = (\n        descriptor.argsSchema ?? validator.object<Record<string, never>>({})\n      ).append({\n        callId: callIdSchema,\n      })\n\n      const tool = new ArtifactTool({\n        name: descriptor.name,\n        description: descriptor.description,\n        inputSchema: argsSchema,\n        ephemeral: true,\n        onCollision: 'replace',\n        handler: async (rawArgs, ctxInner) => {\n          const args = rawArgs as Record<string, unknown> & { callId: string }\n          const resolved = resolveArtifactById(ctxInner, args.callId, requires)\n          if (!resolved) return `Error: no artifact with id ${args.callId} in this turn`\n          const artifact = resolved.artifact\n          const methodArgs: unknown[] = []\n          if (descriptor.method === 'es_symbols') {\n            methodArgs.push((args.kind as string) || '')\n          } else if (\n            descriptor.method === 'es_signature' ||\n            descriptor.method === 'es_jsdoc' ||\n            descriptor.method === 'es_references'\n          ) {\n            methodArgs.push(args.name as string)\n          }\n          const fn = (artifact as unknown as Record<string, (...a: unknown[]) => unknown>)[\n            descriptor.method\n          ]\n          if (typeof fn !== 'function') {\n            return `Error: artifact has no method ${descriptor.method}`\n          }\n          const result = await Promise.resolve(fn.apply(artifact, methodArgs))\n          const serialise = descriptor.serialise ?? defaultSerialise\n          return serialise(result)\n        },\n      })\n      registry.register(tool)\n    }\n    return registry\n  }\n\n  /**\n   * Infer script kind from file extension.\n   */\n  #inferScriptKind(fileName: string | undefined): 'js' | 'jsx' | 'ts' | 'tsx' | undefined {\n    if (!fileName) return undefined\n    const lower = fileName.toLowerCase()\n    if (lower.endsWith('.mts') || lower.endsWith('.cts') || lower.endsWith('.ts')) {\n      return 'ts'\n    }\n    if (lower.endsWith('.tsx')) {\n      return 'tsx'\n    }\n    if (lower.endsWith('.jsx')) {\n      return 'jsx'\n    }\n    if (lower.endsWith('.mjs') || lower.endsWith('.cjs') || lower.endsWith('.js')) {\n      return 'js'\n    }\n    return undefined\n  }\n\n  /**\n   * Lazy-load the TypeScript module once and cache the promise.\n   * All call sites route through this to ensure consistent error handling.\n   */\n  static #typeScriptPromise: Promise<any> | undefined\n\n  /**\n   * Load the TypeScript module, wrapping module-resolution errors in the battery exception.\n   * @internal\n   */\n  static async #loadTypeScript(): Promise<any> {\n    if (this.#typeScriptPromise !== undefined) {\n      return this.#typeScriptPromise\n    }\n\n    this.#typeScriptPromise = import('typescript').catch((err) => {\n      const detail = isError(err) ? err.message : String(err)\n      throw new E_TYPESCRIPT_PEER_MISSING([detail])\n    })\n\n    return this.#typeScriptPromise\n  }\n\n  /**\n   * Resolve and cache the parsed SourceFile.\n   */\n  async #resolveSourceFile(): Promise<SourceFile> {\n    if (this.#sourceFile !== undefined) {\n      return this.#sourceFile\n    }\n\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const text = await this.asString()\n    const fileName = this.#fileName ?? 'source.ts'\n\n    // Map script kind to ts.ScriptKind enum\n    const scriptKindMap: Record<string, number> = {\n      js: ts.ScriptKind.JS,\n      jsx: ts.ScriptKind.JSX,\n      ts: ts.ScriptKind.TS,\n      tsx: ts.ScriptKind.TSX,\n    }\n    const scriptKind = scriptKindMap[this.#scriptKind] ?? ts.ScriptKind.TS\n\n    this.#sourceFile = ts.createSourceFile(\n      fileName,\n      text,\n      ts.ScriptTarget.Latest,\n      /* setParentNodes */ true,\n      scriptKind\n    )\n\n    return this.#sourceFile!\n  }\n\n  /**\n   * Return every top-level declaration, optionally filtered by kind.\n   */\n  async es_symbols(kind?: string): Promise<EcmaScriptSymbol[]> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    const symbols: EcmaScriptSymbol[] = []\n    const filterKind = kind === '' ? undefined : kind\n\n    const visit = (node: any): void | undefined => {\n      // Only visit top-level declarations\n      if (node.parent !== sf) return\n\n      let symbolKind: string | undefined\n      let symbolName: string | undefined\n      let isExported = false\n\n      // Determine kind and name\n      if (ts.isFunctionDeclaration(node)) {\n        symbolKind = 'function'\n        symbolName = node.name?.text\n      } else if (ts.isClassDeclaration(node)) {\n        symbolKind = 'class'\n        symbolName = node.name?.text\n      } else if (ts.isInterfaceDeclaration(node)) {\n        symbolKind = 'interface'\n        symbolName = node.name.text\n      } else if (ts.isTypeAliasDeclaration(node)) {\n        symbolKind = 'type'\n        symbolName = node.name.text\n      } else if (ts.isEnumDeclaration(node)) {\n        symbolKind = 'enum'\n        symbolName = node.name.text\n      } else if (ts.isVariableStatement(node)) {\n        // Extract kind from variable declaration flags\n        const flags = node.declarationList.flags\n        let varKind: string\n        if (flags & ts.NodeFlags.Let) {\n          varKind = 'let'\n        } else if (flags & ts.NodeFlags.Const) {\n          varKind = 'const'\n        } else {\n          varKind = 'var'\n        }\n\n        // Check if exported\n        let varIsExported = false\n        if (node.modifiers) {\n          varIsExported = node.modifiers.some((m: any) => m.kind === ts.SyntaxKind.ExportKeyword)\n        }\n\n        // Emit one symbol per binding, not one per statement\n        const startLine = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n        const endLine = sf.getLineAndCharacterOfPosition(node.getEnd()).line\n\n        node.declarationList.declarations.forEach((decl: any) => {\n          if (ts.isIdentifier(decl.name)) {\n            const bindingName = decl.name.text\n\n            // Apply filter if provided\n            if (filterKind && varKind !== filterKind) return\n\n            symbols.push({\n              kind: varKind,\n              name: bindingName,\n              exported: varIsExported,\n              startLine,\n              endLine,\n            })\n          }\n        })\n        return\n      }\n\n      if (!symbolKind || !symbolName) return\n\n      // Check if exported\n      if (node.modifiers) {\n        isExported = node.modifiers.some((m: any) => m.kind === ts.SyntaxKind.ExportKeyword)\n      }\n\n      // Apply filter if provided\n      if (filterKind && symbolKind !== filterKind) return\n\n      const startLine = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n      const endLine = sf.getLineAndCharacterOfPosition(node.getEnd()).line\n\n      symbols.push({\n        kind: symbolKind,\n        name: symbolName,\n        exported: isExported,\n        startLine,\n        endLine,\n      })\n    }\n\n    ts.forEachChild(sf, visit)\n    return symbols\n  }\n\n  /**\n   * Return every import declaration.\n   */\n  async es_imports(): Promise<EcmaScriptImport[]> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    const imports: EcmaScriptImport[] = []\n\n    const visit = (node: any): void | undefined => {\n      if (!ts.isImportDeclaration(node)) return\n\n      const moduleSpecifier =\n        node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)\n          ? node.moduleSpecifier.text\n          : ''\n\n      const namedImports: string[] = []\n      let defaultImport: string | undefined\n      let namespaceImport: string | undefined\n      let typeOnly = false\n\n      if (node.importClause) {\n        typeOnly = node.importClause.isTypeOnly ?? false\n\n        // Default import\n        if (node.importClause.name) {\n          defaultImport = node.importClause.name.text\n        }\n\n        // Namespace import (import * as Foo)\n        if (node.importClause.namedBindings) {\n          if (ts.isNamespaceImport(node.importClause.namedBindings)) {\n            namespaceImport = node.importClause.namedBindings.name.text\n          } else if (ts.isNamedImports(node.importClause.namedBindings)) {\n            // Named imports\n            node.importClause.namedBindings.elements.forEach((elem: any) => {\n              namedImports.push(elem.name.text)\n            })\n          }\n        }\n      }\n\n      const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n      imports.push({\n        moduleSpecifier,\n        named: namedImports,\n        default: defaultImport,\n        namespace: namespaceImport,\n        typeOnly,\n        line,\n      })\n    }\n\n    ts.forEachChild(sf, visit)\n    return imports\n  }\n\n  /**\n   * Return every export declaration and re-export.\n   */\n  async es_exports(): Promise<EcmaScriptExport[]> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    const exports: EcmaScriptExport[] = []\n\n    const visit = (node: any): void | undefined => {\n      // Handle export declarations (named exports, export *, re-exports)\n      if (ts.isExportDeclaration(node)) {\n        const isTypeOnly = node.isTypeOnly ?? false\n        const moduleSpecifier =\n          node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)\n            ? node.moduleSpecifier.text\n            : undefined\n\n        const namedExports: string[] = []\n        let isNamespaceReExport = false\n\n        if (node.exportClause && ts.isNamedExports(node.exportClause)) {\n          node.exportClause.elements.forEach((elem: any) => {\n            namedExports.push(elem.name.text)\n          })\n        } else if (node.exportClause === undefined && moduleSpecifier) {\n          // export * from '...'\n          isNamespaceReExport = true\n        }\n\n        const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n        exports.push({\n          line,\n          moduleSpecifier,\n          named: namedExports,\n          isDefault: false,\n          isNamespaceReExport,\n          isTypeOnly,\n        })\n      }\n      // Handle export default (which is ExportAssignment, not ExportDeclaration)\n      else if (ts.isExportAssignment(node)) {\n        const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n        exports.push({\n          line,\n          moduleSpecifier: undefined,\n          named: [],\n          isDefault: true,\n          isNamespaceReExport: false,\n          isTypeOnly: false,\n        })\n      }\n      // Handle exported declarations with export modifier (export function, export class, etc.)\n      else if (node.parent === sf && node.modifiers) {\n        const hasExportModifier = node.modifiers.some(\n          (m: any) => m.kind === ts.SyntaxKind.ExportKeyword\n        )\n        if (!hasExportModifier) return\n\n        const hasDefaultModifier = node.modifiers.some(\n          (m: any) => m.kind === ts.SyntaxKind.DefaultKeyword\n        )\n\n        let declaredName: string | undefined\n\n        // Determine the name and isTypeOnly flag based on declaration kind\n        let isTypeOnly = false\n\n        if (ts.isFunctionDeclaration(node)) {\n          declaredName = node.name?.text\n        } else if (ts.isClassDeclaration(node)) {\n          declaredName = node.name?.text\n        } else if (ts.isInterfaceDeclaration(node)) {\n          declaredName = node.name.text\n          isTypeOnly = true\n        } else if (ts.isTypeAliasDeclaration(node)) {\n          declaredName = node.name.text\n          isTypeOnly = true\n        } else if (ts.isEnumDeclaration(node)) {\n          declaredName = node.name.text\n        } else if (ts.isVariableStatement(node)) {\n          // For variable statements, emit one export per binding\n          const flags = node.declarationList.flags\n          const varIsTypeOnly =\n            (flags & ts.NodeFlags.Const) !== 0 &&\n            node.declarationList.declarations.some(\n              (d: any) => d.type?.kind === ts.SyntaxKind.TypeKeyword\n            )\n\n          const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n\n          node.declarationList.declarations.forEach((decl: any) => {\n            if (ts.isIdentifier(decl.name)) {\n              const bindingName = decl.name.text\n              exports.push({\n                line,\n                moduleSpecifier: undefined,\n                named: hasDefaultModifier ? [] : [bindingName],\n                isDefault: hasDefaultModifier,\n                isNamespaceReExport: false,\n                isTypeOnly: varIsTypeOnly,\n              })\n            }\n          })\n          return\n        }\n\n        if (declaredName) {\n          const line = sf.getLineAndCharacterOfPosition(node.getStart(sf)).line\n          exports.push({\n            line,\n            moduleSpecifier: undefined,\n            named: hasDefaultModifier ? [] : [declaredName],\n            isDefault: hasDefaultModifier,\n            isNamespaceReExport: false,\n            isTypeOnly,\n          })\n        }\n      }\n    }\n\n    ts.forEachChild(sf, visit)\n    return exports\n  }\n\n  /**\n   * Return a structural outline of classes and interfaces with their members.\n   */\n  async es_outline(): Promise<OutlineEntry[]> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    const entries: OutlineEntry[] = []\n\n    const visit = (node: any): void | undefined => {\n      if (!node.parent || node.parent !== sf) return\n\n      let entry: OutlineEntry | undefined\n\n      if (ts.isClassDeclaration(node) && node.name) {\n        const members = this.#getMembersFromNode(ts, sf, node)\n        entry = {\n          kind: 'class',\n          name: node.name.text,\n          startLine: sf.getLineAndCharacterOfPosition(node.getStart(sf)).line,\n          endLine: sf.getLineAndCharacterOfPosition(node.getEnd()).line,\n          members,\n        }\n      } else if (ts.isInterfaceDeclaration(node)) {\n        const members = this.#getMembersFromInterfaceNode(ts, sf, node)\n        entry = {\n          kind: 'interface',\n          name: node.name.text,\n          startLine: sf.getLineAndCharacterOfPosition(node.getStart(sf)).line,\n          endLine: sf.getLineAndCharacterOfPosition(node.getEnd()).line,\n          members,\n        }\n      }\n\n      if (entry) {\n        entries.push(entry)\n      }\n    }\n\n    ts.forEachChild(sf, visit)\n    return entries\n  }\n\n  /**\n   * Extract members from a class node.\n   */\n  #getMembersFromNode(ts: any, sf: SourceFile, classNode: any): OutlineMember[] {\n    const members: OutlineMember[] = []\n\n    const visit = (node: any): void | undefined => {\n      if (node.parent !== classNode) return\n\n      let memberKind: string | undefined\n      let memberName: string | undefined\n\n      if (ts.isConstructorDeclaration(node)) {\n        memberKind = 'method'\n        memberName = 'constructor'\n      } else if (ts.isMethodDeclaration(node)) {\n        memberKind = 'method'\n        memberName = node.name?.text\n      } else if (ts.isPropertyDeclaration(node)) {\n        memberKind = 'property'\n        memberName = node.name?.text\n      } else if (ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node)) {\n        memberKind = 'accessor'\n        memberName = node.name?.text\n      }\n\n      if (memberKind && memberName) {\n        members.push({\n          name: memberName,\n          kind: memberKind,\n          startLine: sf.getLineAndCharacterOfPosition(node.getStart(sf)).line,\n          endLine: sf.getLineAndCharacterOfPosition(node.getEnd()).line,\n        })\n      }\n    }\n\n    ts.forEachChild(classNode, visit)\n    return members\n  }\n\n  /**\n   * Extract members from an interface node.\n   */\n  #getMembersFromInterfaceNode(ts: any, sf: SourceFile, interfaceNode: any): OutlineMember[] {\n    const members: OutlineMember[] = []\n\n    const visit = (node: any): void | undefined => {\n      if (node.parent !== interfaceNode) return\n\n      let memberKind: string | undefined\n      let memberName: string | undefined\n\n      if (ts.isMethodSignature(node)) {\n        memberKind = 'method'\n        memberName = node.name?.text\n      } else if (ts.isPropertySignature(node)) {\n        memberKind = 'property'\n        memberName = node.name?.text\n      } else if (ts.isCallSignatureDeclaration(node)) {\n        memberKind = 'signature'\n        memberName = 'call'\n      } else if (ts.isConstructSignatureDeclaration(node)) {\n        memberKind = 'signature'\n        memberName = 'constructor'\n      } else if (ts.isIndexSignatureDeclaration(node)) {\n        memberKind = 'signature'\n        memberName = 'index'\n      }\n\n      if (memberKind && memberName) {\n        members.push({\n          name: memberName,\n          kind: memberKind,\n          startLine: sf.getLineAndCharacterOfPosition(node.getStart(sf)).line,\n          endLine: sf.getLineAndCharacterOfPosition(node.getEnd()).line,\n        })\n      }\n    }\n\n    ts.forEachChild(interfaceNode, visit)\n    return members\n  }\n\n  /**\n   * Search for a named top-level declaration. Returns the matching node or undefined.\n   *\n   * @remarks\n   * Searches FunctionDeclaration, ClassDeclaration, InterfaceDeclaration, EnumDeclaration,\n   * TypeAliasDeclaration, and the individual VariableDeclaration bindings of a\n   * VariableStatement. This is the single lookup shared by {@link SpooledEcmaScriptArtifact.es_signature}\n   * and {@link SpooledEcmaScriptArtifact.es_jsdoc} so the two can never disagree about\n   * what a name resolves to. For a variable the VariableDeclaration is returned, not its\n   * enclosing statement — TypeScript attaches the JSDoc of a variable statement to both,\n   * so this is safe for either caller.\n   * @internal\n   */\n  #findTopLevelDeclaration(ts: any, sf: SourceFile, name: string): any | undefined {\n    for (const node of sf.statements as unknown as any[]) {\n      if (ts.isFunctionDeclaration(node) && node.name?.text === name) {\n        return node\n      } else if (ts.isClassDeclaration(node) && node.name?.text === name) {\n        return node\n      } else if (ts.isInterfaceDeclaration(node) && node.name.text === name) {\n        return node\n      } else if (ts.isEnumDeclaration(node) && node.name.text === name) {\n        return node\n      } else if (ts.isTypeAliasDeclaration(node) && node.name.text === name) {\n        return node\n      } else if (ts.isVariableStatement(node)) {\n        const decl = node.declarationList.declarations.find(\n          (d: any) => ts.isIdentifier(d.name) && d.name.text === name\n        )\n        if (decl) return decl\n      }\n    }\n    return undefined\n  }\n\n  /**\n   * Search for a named member (method, property, constructor, accessor, or signature)\n   * within class and interface declarations. Returns the matching node or undefined.\n   *\n   * @remarks\n   * Searches class members: MethodDeclaration, PropertyDeclaration, ConstructorDeclaration,\n   * GetAccessorDeclaration, SetAccessorDeclaration.\n   * Searches interface members: MethodSignature, PropertySignature.\n   * Returns the first matching node or undefined if not found.\n   * @internal\n   */\n  #findNestedMember(ts: any, sf: SourceFile, name: string): any | undefined {\n    let foundNode: any | undefined\n\n    const searchClasses = (node: any): void => {\n      if (foundNode) return\n      if (ts.isClassDeclaration(node)) {\n        const searchMember = (member: any): void => {\n          if (foundNode) return\n\n          if (ts.isMethodDeclaration(member) && member.name?.text === name) {\n            foundNode = member\n            return\n          } else if (ts.isConstructorDeclaration(member) && name === 'constructor') {\n            foundNode = member\n            return\n          } else if (ts.isPropertyDeclaration(member) && member.name?.text === name) {\n            foundNode = member\n            return\n          } else if (\n            (ts.isGetAccessorDeclaration(member) || ts.isSetAccessorDeclaration(member)) &&\n            member.name?.text === name\n          ) {\n            foundNode = member\n            return\n          }\n        }\n        ts.forEachChild(node, searchMember)\n      }\n\n      if (!foundNode) {\n        ts.forEachChild(node, searchClasses)\n      }\n    }\n\n    const searchInterfaces = (node: any): void => {\n      if (foundNode) return\n      if (ts.isInterfaceDeclaration(node)) {\n        const searchMember = (member: any): void => {\n          if (foundNode) return\n\n          if (ts.isMethodSignature(member) && member.name?.text === name) {\n            foundNode = member\n            return\n          } else if (ts.isPropertySignature(member) && member.name?.text === name) {\n            foundNode = member\n            return\n          }\n        }\n        ts.forEachChild(node, searchMember)\n      }\n\n      if (!foundNode) {\n        ts.forEachChild(node, searchInterfaces)\n      }\n    }\n\n    ts.forEachChild(sf, searchClasses)\n    if (!foundNode) {\n      ts.forEachChild(sf, searchInterfaces)\n    }\n\n    return foundNode\n  }\n\n  /**\n   * Extract the signature text of a declaration, excluding the body.\n   * For functions/methods: includes type parameters, parameters, and return type.\n   * For classes: includes the class keyword, name, type parameters, and heritage.\n   * For interfaces: includes the interface keyword, name, type parameters, and heritage.\n   * For enums: includes the enum keyword, modifiers, and name, excluding the member list.\n   * For type aliases: includes the type keyword, name, and RHS up to the semicolon.\n   * For variables: includes the variable declaration up to (but not including) the initializer.\n   * For properties/accessors: includes the declaration without the body.\n   * For method/property signatures: includes the signature without the body.\n   *\n   * @remarks\n   * Variables and function expressions are returned as the binding name only (parameters\n   * and return type are not surfaced for these cases).\n   * @internal\n   */\n  #extractSignatureText(ts: any, sf: SourceFile, node: any): string {\n    if (ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node)) {\n      // For functions/methods: extract from start to the end of return type (or param list if no return type)\n      const start = node.getStart(sf)\n      // The body (if present) starts after the closing paren of parameters and optional return type\n      const bodyStart = node.body ? node.body.getStart(sf) : node.getEnd()\n      return sf.text.substring(start, bodyStart).trim()\n    } else if (ts.isConstructorDeclaration(node)) {\n      // constructor(params): void { body }\n      const start = node.getStart(sf)\n      const bodyStart = node.body ? node.body.getStart(sf) : node.getEnd()\n      return sf.text.substring(start, bodyStart).trim()\n    } else if (ts.isClassDeclaration(node)) {\n      // class Name<T> extends Base { members }\n      // Find the opening brace that starts the body and stop before it.\n      const start = node.getStart(sf)\n      const children = node.getChildren(sf)\n      const openBrace = children.find((child: any) => child.kind === ts.SyntaxKind.OpenBraceToken)\n      if (openBrace) {\n        // Extract up to the opening brace and trim any trailing whitespace/brace\n        const bracePos = openBrace.getStart(sf)\n        let text = sf.text.substring(start, bracePos).trim()\n        // Remove trailing opening brace and any whitespace before it\n        text = text.replace(/\\s*\\{\\s*$/, '')\n        return text\n      }\n      return ''\n    } else if (ts.isInterfaceDeclaration(node)) {\n      // interface Name<T> extends Base { members }\n      // Find the opening brace that starts the body and stop before it.\n      const start = node.getStart(sf)\n      const children = node.getChildren(sf)\n      const openBrace = children.find((child: any) => child.kind === ts.SyntaxKind.OpenBraceToken)\n      if (openBrace) {\n        // Extract up to the opening brace and trim any trailing whitespace/brace\n        const bracePos = openBrace.getStart(sf)\n        let text = sf.text.substring(start, bracePos).trim()\n        // Remove trailing opening brace and any whitespace before it\n        text = text.replace(/\\s*\\{\\s*$/, '')\n        return text\n      }\n      return ''\n    } else if (ts.isEnumDeclaration(node)) {\n      // enum Name { members } or const enum Name { members } or declare enum Name { members }\n      // Find the opening brace that starts the member list and stop before it.\n      const start = node.getStart(sf)\n      const children = node.getChildren(sf)\n      const openBrace = children.find((child: any) => child.kind === ts.SyntaxKind.OpenBraceToken)\n      if (openBrace) {\n        // Extract up to the opening brace and trim any trailing whitespace/brace\n        const bracePos = openBrace.getStart(sf)\n        let text = sf.text.substring(start, bracePos).trim()\n        // Remove trailing opening brace and any whitespace before it\n        text = text.replace(/\\s*\\{\\s*$/, '')\n        return text\n      }\n      return ''\n    } else if (ts.isTypeAliasDeclaration(node)) {\n      // type Name<T> = ...\n      const start = node.getStart(sf)\n      const end = node.getEnd()\n      return sf.text.substring(start, end).trim()\n    } else if (ts.isVariableDeclaration(node)) {\n      // const x = 5 or let y: string\n      // Return up to the initializer or end if no initializer\n      const start = node.getStart(sf)\n      const initStart = node.initializer ? node.initializer.getStart(sf) : node.getEnd()\n      let text = sf.text.substring(start, initStart).trim()\n      // Remove trailing assignment operator and surrounding whitespace\n      text = text.replace(/\\s*=\\s*$/, '')\n      return text\n    } else if (ts.isPropertyDeclaration(node)) {\n      // class property: name: type = initializer;\n      // Return from start to initializer (if any) or end (without body)\n      const start = node.getStart(sf)\n      const initStart = node.initializer ? node.initializer.getStart(sf) : node.getEnd()\n      let text = sf.text.substring(start, initStart).trim()\n      // Remove trailing assignment operator and surrounding whitespace\n      text = text.replace(/\\s*=\\s*$/, '')\n      return text\n    } else if (ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node)) {\n      // getter/setter: get/set name(): type { body }\n      const start = node.getStart(sf)\n      const bodyStart = node.body ? node.body.getStart(sf) : node.getEnd()\n      return sf.text.substring(start, bodyStart).trim()\n    } else if (ts.isMethodSignature(node)) {\n      // interface method signature: name(params): returnType;\n      const start = node.getStart(sf)\n      const end = node.getEnd()\n      return sf.text.substring(start, end).trim()\n    } else if (ts.isPropertySignature(node)) {\n      // interface property: name: type;\n      const start = node.getStart(sf)\n      const end = node.getEnd()\n      return sf.text.substring(start, end).trim()\n    }\n    return ''\n  }\n\n  /**\n   * Return the signature text for a named declaration.\n   * Searches top-level declarations (functions, classes, interfaces, enums, type aliases,\n   * const/let/var bindings), class members (methods, properties, constructors, accessors),\n   * and interface members (method signatures, property signatures) — the same lookup\n   * {@link SpooledEcmaScriptArtifact.es_jsdoc} uses, so the two always agree on what a\n   * name resolves to.\n   */\n  async es_signature(name: string): Promise<string> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    // Top-level declarations first, then nested class/interface members.\n    const node = this.#findTopLevelDeclaration(ts, sf, name) ?? this.#findNestedMember(ts, sf, name)\n\n    return node ? this.#extractSignatureText(ts, sf, node) : ''\n  }\n\n  /**\n   * Return the JSDoc comment for a named declaration.\n   * Searches top-level declarations (functions, classes, interfaces, enums, type aliases,\n   * const/let/var bindings), class members (methods, properties, constructors, accessors),\n   * and interface members (method signatures, property signatures) — the same lookup\n   * {@link SpooledEcmaScriptArtifact.es_signature} uses, so the two always agree on what a\n   * name resolves to.\n   */\n  async es_jsdoc(name: string): Promise<string> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    // Helper to extract JSDoc from a node\n    const extractJSDoc = (target: any): string => {\n      // A JSDoc block sits above the whole `const a = 1, b = 2` statement, so for a\n      // variable binding read the comment off the enclosing VariableStatement — otherwise\n      // only the first declarator would carry it.\n      const node =\n        ts.isVariableDeclaration(target) && target.parent?.parent ? target.parent.parent : target\n      const comments = ts.getJSDocCommentsAndTags(node)\n      if (comments && comments.length > 0) {\n        const commentStrs: string[] = []\n        for (const comment of comments) {\n          const text = sf.text.substring(comment.getStart(sf), comment.getEnd())\n          commentStrs.push(text)\n        }\n        return commentStrs.join('\\n')\n      }\n      return ''\n    }\n\n    // Top-level declarations first, then nested class/interface members.\n    const node = this.#findTopLevelDeclaration(ts, sf, name) ?? this.#findNestedMember(ts, sf, name)\n\n    return node ? extractJSDoc(node) : ''\n  }\n\n  /**\n   * Return every line where an identifier appears (syntactic scan only).\n   */\n  async es_references(name: string): Promise<IdentifierReference[]> {\n    const ts = await SpooledEcmaScriptArtifact.#loadTypeScript()\n    const sf = await this.#resolveSourceFile()\n\n    const references: IdentifierReference[] = []\n\n    const visit = (node: any): void | undefined => {\n      if (ts.isIdentifier(node) && node.text === name) {\n        const pos = node.getStart(sf)\n        const lineChar = sf.getLineAndCharacterOfPosition(pos)\n        references.push({\n          line: lineChar.line,\n          column: lineChar.character,\n        })\n      }\n\n      ts.forEachChild(node, visit)\n    }\n\n    ts.forEachChild(sf, visit)\n    return references\n  }\n\n  /**\n   * Serialise this SpooledEcmaScriptArtifact into an encoder snapshot.\n   */\n  [ENCODE_METHOD](): AdkEncodableSnapshot {\n    return {\n      reader: this.readerDescriptor(),\n      fileName: this.#fileName,\n      scriptKind: this.#scriptKind,\n    }\n  }\n\n  /**\n   * Reconstruct a SpooledEcmaScriptArtifact from an encoder snapshot.\n   */\n  static [DECODE_METHOD](data: AdkEncodableSnapshot): SpooledEcmaScriptArtifact {\n    const snapshot = data as {\n      reader: ReaderDescriptor\n      fileName?: string\n      scriptKind?: 'js' | 'jsx' | 'ts' | 'tsx'\n    }\n    return new SpooledEcmaScriptArtifact(resolveSpoolReader(snapshot.reader), {\n      fileName: snapshot.fileName,\n      scriptKind: snapshot.scriptKind,\n    })\n  }\n}\n\n/**\n * Battery exception re-export.\n */\nexport { E_TYPESCRIPT_PEER_MISSING }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,4BAA4B,gBACvC,6BACA,4JACA,6BACA,GACF;;;;;;;;;;;;;;;;;;;;;;;;;;ACSA,IAAM,gBAA+B,OAAO,IAAI,0BAA0B;AAC1E,IAAM,gBAA+B,OAAO,I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