@happyvertical/smrt-core 0.50.0 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -0
- package/dist/index.js +2 -1
- package/dist/knowledge-graph.d.ts +95 -0
- package/dist/knowledge-graph.d.ts.map +1 -0
- package/dist/knowledge-graph.js +268 -0
- package/dist/knowledge-graph.js.map +1 -0
- package/dist/knowledge.d.ts +1 -0
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +57 -4
- package/dist/knowledge.js.map +1 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/migrations/differ.d.ts +127 -21
- package/dist/migrations/differ.d.ts.map +1 -1
- package/dist/migrations/differ.js +379 -84
- package/dist/migrations/differ.js.map +1 -1
- package/dist/schema/column-data-probes.d.ts +38 -0
- package/dist/schema/column-data-probes.d.ts.map +1 -0
- package/dist/schema/column-data-probes.js +106 -0
- package/dist/schema/column-data-probes.js.map +1 -0
- package/dist/schema/live-parity.d.ts.map +1 -1
- package/dist/schema/live-parity.js +37 -46
- package/dist/schema/live-parity.js.map +1 -1
- package/dist/smrt-knowledge.json +12 -7
- package/package.json +4 -4
package/dist/knowledge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge.js","names":[],"sources":["../src/knowledge.ts"],"sourcesContent":["export {\n discoverScopedPackageDirectories,\n readPackageAgentDoc,\n type ScopedPackageDirectory,\n} from './knowledge-discovery.js';\n\nimport { createHash } from 'node:crypto';\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { basename, join, relative, resolve, sep } from 'node:path';\nimport type {\n DomainKnowledgeAgentSurface,\n DomainKnowledgeConfig,\n DomainKnowledgeField,\n DomainKnowledgeFieldConstraints,\n DomainKnowledgeManifest,\n DomainKnowledgeMethodSignature,\n DomainKnowledgeModuleDoc,\n DomainKnowledgeObject,\n DomainKnowledgeSurface,\n DomainKnowledgeTenant,\n DomainKnowledgeWithheldSurface,\n} from '@happyvertical/smrt-types';\nimport {\n type ApiMethodExposure,\n CRUD_OPERATIONS,\n createManifestClassNamePredicate,\n isCrudOperation,\n isCrudToolAction,\n isFrameworkLifecycleMethod,\n resolveApiMethodExposure,\n resolveCustomActionMetadata,\n resolveEffectiveActionMetadata,\n} from './generators/custom-action.js';\nimport { isFrameworkBaseClass } from './registry/framework-base-classes.js';\nimport type {\n SmartObjectDefinition,\n SmartObjectManifest,\n} from './scanner/types.js';\nimport { toSnakeCase } from './utils/naming.js';\n\n/**\n * Minimal package.json shape consumed by the knowledge builder.\n * `name`/`version` are typed concretely because they flow into the manifest's\n * string-typed metadata fields; everything else is read via `unknown`-accepting\n * helpers (`record()`, `exportKeys()`), so an index signature is sufficient.\n */\nexport interface PackageJsonLike {\n name?: string;\n version?: string;\n [key: string]: unknown;\n}\n\nexport interface BuildDomainKnowledgeOptions {\n manifest: SmartObjectManifest;\n rootDir: string;\n packageJson?: PackageJsonLike;\n manifestPath?: string;\n config?: DomainKnowledgeConfig;\n /**\n * The package's declared view intents and playbooks (#2591), produced by the\n * scanner's agent-surface matcher.\n *\n * Passed in rather than scanned here for one reason: the scanner carries a\n * native parser binary, and `smrt-core`'s main entry is browser-reachable.\n * The Vite plugin already imports the scanner lazily on the Node side and is\n * the one caller that writes this artifact, so it does the scan and hands the\n * result over.\n */\n agentSurface?: DomainKnowledgeAgentSurface;\n}\n\nconst SDK_PACKAGE_NAMES = new Set([\n '@happyvertical/ai',\n '@happyvertical/cache',\n '@happyvertical/documents',\n '@happyvertical/email',\n '@happyvertical/encryption',\n '@happyvertical/files',\n '@happyvertical/geo',\n '@happyvertical/images',\n '@happyvertical/jobs',\n '@happyvertical/json',\n '@happyvertical/logger',\n '@happyvertical/messages',\n '@happyvertical/ocr',\n '@happyvertical/pdf',\n '@happyvertical/projects',\n '@happyvertical/repos',\n '@happyvertical/secrets',\n '@happyvertical/spider',\n '@happyvertical/sql',\n '@happyvertical/utils',\n]);\n\nconst RELATIONSHIP_FIELD_TYPES = new Set([\n 'foreignKey',\n 'crossPackageRef',\n 'oneToMany',\n 'manyToMany',\n]);\n\n/**\n * The generated CRUD verbs, derived from the generators' own list so both\n * halves of this projection — which operations are ENUMERATED\n * (`resolveCrudOperations`) and which method names are RESERVED\n * (`reservesCrudName`) — move together. Reading one from `CRUD_OPERATIONS` and\n * the other from a local copy would let a new verb be suppressed as a custom\n * method while never being added as CRUD, dropping the surface entirely.\n */\nconst STANDARD_OPERATIONS: readonly string[] = CRUD_OPERATIONS;\n\n/**\n * Markdown inline links whose target is a `.md` file — `[label](agents/x.md)`,\n * tolerating an `#anchor` and a `\"title\"`. This is how a package registers a\n * sibling module doc (#2108): the link in `AGENTS.md` IS the registration, so\n * there is no separate index to drift out of sync.\n */\nconst MARKDOWN_MD_LINK =\n /\\[[^\\]]*\\]\\(\\s*([^)\\s#]+\\.md)(?:#[^)\\s]*)?(?:\\s+\"[^\"]*\")?\\s*\\)/g;\n\n/** `sourceHashes` key prefix for a linked module doc, e.g. `moduleDoc:agents/crm.md`. */\nexport const MODULE_DOC_HASH_PREFIX = 'moduleDoc:';\n\n/**\n * `sourceHashes` key prefix for a module declaring a view intent or playbook,\n * e.g. `agentSurface:src/lib/orders.intents.ts` (#2591).\n */\nexport const AGENT_SURFACE_HASH_PREFIX = 'agentSurface:';\n\n/**\n * Module doc paths linked from a package's `AGENTS.md`, relative to the package\n * root and in document order.\n *\n * Instruction chains are additive (see `scripts/check-agents-chain.mjs`), so an\n * oversized package doc is split into `packages/<pkg>/agents/<module>.md` siblings\n * instead of nested `AGENTS.md` files. Only links resolving to an existing file\n * INSIDE the package are accepted — a cross-package reference such as\n * `packages/affiliates/MIGRATION.md` belongs to that package's own chain and is\n * ignored here.\n */\nexport function resolveAgentModuleDocPaths(\n rootDir: string,\n agentDoc: string | undefined,\n): string[] {\n if (!agentDoc) return [];\n const root = resolve(rootDir);\n const paths: string[] = [];\n for (const match of agentDoc.matchAll(MARKDOWN_MD_LINK)) {\n const target = match[1];\n if (target.includes('://')) continue;\n const absolute = resolve(root, target);\n if (absolute !== root && !absolute.startsWith(root + sep)) continue;\n const relativePath = relative(root, absolute).split(sep).join('/');\n if (relativePath === 'AGENTS.md' || relativePath === 'CLAUDE.md') continue;\n if (paths.includes(relativePath)) continue;\n if (!existsSync(absolute) || !statSync(absolute).isFile()) continue;\n paths.push(relativePath);\n }\n return paths;\n}\n\n/** {@link resolveAgentModuleDocPaths}, with each doc's contents read. */\nexport function readAgentModuleDocs(\n rootDir: string,\n agentDoc: string | undefined,\n): DomainKnowledgeModuleDoc[] {\n return resolveAgentModuleDocPaths(rootDir, agentDoc).map((path) => ({\n path,\n module: basename(path, '.md'),\n content: readFileSync(join(rootDir, path), 'utf8'),\n }));\n}\n\nexport function buildDomainKnowledgeManifest(\n options: BuildDomainKnowledgeOptions,\n): DomainKnowledgeManifest {\n const rootDir = options.rootDir;\n const packageJson = options.packageJson ?? readPackageJson(rootDir) ?? {};\n const packageName = options.manifest.packageName ?? packageJson.name;\n const packageVersion = options.manifest.packageVersion ?? packageJson.version;\n const agentDocPath = existingPath(rootDir, 'AGENTS.md');\n const agentDocContent = agentDocPath\n ? readFileSync(agentDocPath, 'utf8')\n : undefined;\n const includeDocs = options.config?.includeDocs !== false;\n const agentDoc = includeDocs ? agentDocContent : undefined;\n // Module doc PATHS are always resolved so their hashes gate freshness even\n // when doc bodies are excluded from the artifact — same stance as `agents`.\n const moduleDocPaths = resolveAgentModuleDocPaths(rootDir, agentDocContent);\n const allDependencies = {\n ...record(packageJson.dependencies),\n ...record(packageJson.devDependencies),\n ...record(packageJson.peerDependencies),\n };\n const manifestObjects = Object.values(options.manifest.objects).filter(\n (object) => object.decoratorConfig?.knowledge !== false,\n );\n const objects = manifestObjects.map((object) =>\n buildKnowledgeObject(object, options.manifest),\n );\n const surfaces = objects.flatMap((object) => object.surfaces);\n const manifestJson = stableJson(normalizeManifestForHash(options.manifest));\n const agentSurface = normalizeAgentSurface(options.agentSurface);\n\n return {\n schemaVersion: 1,\n sensitiveFieldsExcluded: true,\n generatedAt: new Date().toISOString(),\n packageName,\n packageVersion,\n sourceManifestPath: options.manifestPath\n ? relative(rootDir, options.manifestPath)\n : undefined,\n agentDocPath: agentDocPath ? relative(rootDir, agentDocPath) : undefined,\n sourceHashes: sourceHashes({\n manifest: { content: manifestJson },\n packageJson: fileHashSource(existingPath(rootDir, 'package.json')),\n agents: fileHashSource(agentDocPath),\n ...Object.fromEntries(\n moduleDocPaths.map((path) => [\n `${MODULE_DOC_HASH_PREFIX}${path}`,\n fileHashSource(join(rootDir, path)),\n ]),\n ),\n // A module declaring an intent or a playbook is an authored source of\n // this artifact exactly like `AGENTS.md` is, so editing one must mark the\n // artifact stale (#2591).\n ...Object.fromEntries(\n agentSurfaceSourcePaths(agentSurface).map((path) => [\n `${AGENT_SURFACE_HASH_PREFIX}${path}`,\n fileHashSource(join(rootDir, path)),\n ]),\n ),\n }),\n exports: exportKeys(packageJson.exports),\n dependencies: allDependencies,\n smrtDependencies: Object.keys(allDependencies)\n .filter((dep) => dep.startsWith('@happyvertical/smrt-'))\n .sort(),\n sdkDependencies: Object.keys(allDependencies)\n .filter((dep) => SDK_PACKAGE_NAMES.has(dep))\n .sort(),\n tags: options.config?.tags ?? [],\n summary: options.config?.summary,\n risks: options.config?.risks ?? [],\n objects,\n surfaces,\n prompts:\n options.config?.includePrompts === false ? [] : readPrompts(rootDir),\n relationshipsV2: summarizeRelationships(objects, manifestObjects),\n agentDoc,\n moduleDocs:\n includeDocs && moduleDocPaths.length > 0\n ? readAgentModuleDocs(rootDir, agentDocContent)\n : undefined,\n agentSurface,\n };\n}\n\n/**\n * Drop an agent surface that carries nothing.\n *\n * Keeping the key absent for a package that declares no intent, no playbook,\n * and no diagnostic is what makes this field additive in practice: every\n * checked-in artifact for such a package stays byte-identical to what it\n * emitted before the field existed, so adding emission does not churn the\n * repository's knowledge artifacts.\n */\nfunction normalizeAgentSurface(\n surface: DomainKnowledgeAgentSurface | undefined,\n): DomainKnowledgeAgentSurface | undefined {\n if (!surface) return undefined;\n const empty =\n surface.intents.length === 0 &&\n surface.playbooks.length === 0 &&\n surface.diagnostics.length === 0;\n return empty ? undefined : surface;\n}\n\n/** Every package-relative module that contributed to the emitted surface. */\nfunction agentSurfaceSourcePaths(\n surface: DomainKnowledgeAgentSurface | undefined,\n): string[] {\n if (!surface) return [];\n const paths = new Set<string>();\n for (const intent of surface.intents) paths.add(intent.sourceFile);\n for (const playbook of surface.playbooks) paths.add(playbook.sourceFile);\n for (const diagnostic of surface.diagnostics)\n paths.add(diagnostic.sourceFile);\n return [...paths].sort();\n}\n\nfunction buildKnowledgeObject(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeObject {\n const knowledge =\n typeof object.decoratorConfig?.knowledge === 'object'\n ? object.decoratorConfig.knowledge\n : {};\n const fields = Object.entries(object.fields)\n .filter(([, field]) => !isSensitiveField(field))\n .map(([name, field]): DomainKnowledgeField => {\n const defaultValue = fieldValue(field, 'default');\n return {\n name,\n type: field.type,\n required: field.required,\n related: field.related,\n columnType: columnType(object, name),\n ...(defaultValue.present ? { default: defaultValue.value } : {}),\n constraints: fieldConstraints(field),\n readonly:\n field.readonly === true || field._meta?.readonly === true\n ? true\n : undefined,\n transient:\n field.transient === true || field._meta?.transient === true\n ? true\n : undefined,\n };\n });\n const sensitiveIdentifiers = sensitiveFieldIdentifiers(object.fields);\n const tenant = sanitizeTenantFacts(\n tenantFacts(object.decoratorConfig?.tenantScoped),\n sensitiveIdentifiers,\n );\n const conflictColumns = object.decoratorConfig?.conflictColumns?.filter(\n (column) => !sensitiveIdentifiers.has(column),\n );\n const relationships = fields\n .filter((field) => RELATIONSHIP_FIELD_TYPES.has(field.type))\n .map((field) => ({\n name: field.name,\n type: field.type,\n required: field.required,\n related: field.related,\n columnType: field.columnType,\n }));\n\n return {\n name: object.className,\n qualifiedName: object.qualifiedName,\n collection: object.collection,\n tableName: object.schema?.tableName,\n packageName: object.packageName,\n extends: object.extends,\n visibility: object.visibility,\n fields,\n relationships,\n methods: Object.keys(object.methods).sort(),\n methodSignatures: methodSignatures(object),\n tenant,\n tableStrategy: object.decoratorConfig?.tableStrategy,\n conflictColumns:\n conflictColumns && conflictColumns.length > 0\n ? conflictColumns\n : undefined,\n surfaces: objectSurfaces(object, manifest),\n ...withheldApiSurfaces(object, manifest),\n relationshipFeatures: relationshipFeatures(object, fields),\n tags: knowledge.tags ?? [],\n summary: knowledge.summary,\n risks: knowledge.risks ?? [],\n };\n}\n\nfunction isSensitiveField(field: SmartObjectDefinition['fields'][string]) {\n return field.sensitive === true || field._meta?.sensitive === true;\n}\n\nfunction sensitiveFieldIdentifiers(\n fields: SmartObjectDefinition['fields'],\n): Set<string> {\n return new Set(\n Object.entries(fields)\n .filter(([, field]) => isSensitiveField(field))\n .flatMap(([name]) => [name, toSnakeCase(name), camelToSnake(name)]),\n );\n}\n\nfunction fieldValue(\n field: SmartObjectDefinition['fields'][string],\n key: 'default' | 'min' | 'max' | 'minLength' | 'maxLength',\n): { present: boolean; value: unknown } {\n if (Object.hasOwn(field, key)) {\n return { present: field[key] !== undefined, value: field[key] };\n }\n const value = field._meta?.[key];\n return { present: value !== undefined, value };\n}\n\nfunction fieldConstraints(\n field: SmartObjectDefinition['fields'][string],\n): DomainKnowledgeFieldConstraints | undefined {\n const constraints: DomainKnowledgeFieldConstraints = {};\n for (const key of ['min', 'max', 'minLength', 'maxLength'] as const) {\n const value = fieldValue(field, key);\n if (value.present && typeof value.value === 'number') {\n constraints[key] = value.value;\n }\n }\n const pattern = normalizePattern(\n (field as { pattern?: unknown }).pattern ?? field._meta?.pattern,\n );\n if (pattern !== undefined) constraints.pattern = pattern;\n return Object.keys(constraints).length > 0 ? constraints : undefined;\n}\n\nfunction normalizePattern(pattern: unknown): string | undefined {\n if (typeof pattern === 'string') return pattern;\n if (pattern instanceof RegExp) return pattern.source;\n if (\n pattern &&\n typeof pattern === 'object' &&\n typeof (pattern as { source?: unknown }).source === 'string'\n ) {\n return (pattern as { source: string }).source;\n }\n return undefined;\n}\n\nfunction tenantFacts(\n tenantScoped: SmartObjectDefinition['decoratorConfig']['tenantScoped'],\n): DomainKnowledgeTenant | undefined {\n if (!tenantScoped) return undefined;\n if (tenantScoped === true) {\n return { scoped: true, mode: 'required', field: 'tenantId' };\n }\n return {\n scoped: true,\n mode: tenantScoped.mode ?? 'required',\n field: tenantScoped.field ?? 'tenantId',\n };\n}\n\nfunction sanitizeTenantFacts(\n tenant: DomainKnowledgeTenant | undefined,\n sensitiveIdentifiers: Set<string>,\n): DomainKnowledgeTenant | undefined {\n if (!tenant?.field || !sensitiveIdentifiers.has(tenant.field)) return tenant;\n return { scoped: tenant.scoped, mode: tenant.mode };\n}\n\nfunction methodSignatures(\n object: SmartObjectDefinition,\n): DomainKnowledgeMethodSignature[] | undefined {\n const signatures = Object.values(object.methods)\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((method) => ({\n name: method.name,\n async: method.async || undefined,\n static: method.isStatic || undefined,\n params:\n method.parameters.length > 0\n ? method.parameters.map(\n (parameter) =>\n `${parameter.name}${parameter.optional ? '?' : ''}: ${parameter.type}`,\n )\n : undefined,\n returns: method.returnType || undefined,\n }));\n return signatures.length > 0 ? signatures : undefined;\n}\n\nfunction objectSurfaces(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeSurface[] {\n return [\n ...configuredSurfaces('api', object, manifest),\n ...configuredSurfaces('cli', object, manifest),\n ...configuredSurfaces('mcp', object, manifest),\n ...aiSurfaces(object),\n ];\n}\n\n/**\n * Every API-exposure decision for one object's methods, from the shared\n * resolver the route emitters use — so a method reported here as exposed has a\n * route file, and one reported as withheld has none.\n *\n * The whole point of routing this through `resolveApiMethodExposure` rather\n * than a local mirror is that a fourth copy of the rule is a fourth chance to\n * disagree with the emitters (#2686).\n */\nfunction apiMethodDecisions(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): Array<[string, ApiMethodExposure]> {\n const apiConfig = object.decoratorConfig?.api;\n const isModelClassName = createManifestClassNamePredicate(manifest);\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n return Object.entries(object.methods).map(([name, method]) => [\n name,\n resolveApiMethodExposure({\n actionName: name,\n method,\n apiConfig,\n isCollectionClass: collectionClass,\n ...(isModelClassName ? { isModelClassName } : {}),\n }),\n ]);\n}\n\n/**\n * The `withheldSurfaces` half of the artifact: every public method the API\n * declined, with the reason.\n *\n * Reported for `api` only. `cli`/`mcp` gate on a much smaller, purely\n * name-based rule set that a reader can already infer from the config, while\n * the API's wire-ability heuristic rejects on a signature detail nothing else\n * in the artifact shows — which is exactly the silence #2686 set out to close.\n *\n * CRUD-reserved and non-public methods are excluded: neither was ever a\n * candidate custom action, so listing them would bury the actionable entries.\n */\nfunction withheldApiSurfaces(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): { withheldSurfaces?: DomainKnowledgeWithheldSurface[] } {\n if (isFrameworkBaseClass(object.className, object.packageName)) return {};\n const withheld = apiMethodDecisions(object, manifest)\n .filter(\n ([, decision]) =>\n !decision.exposed &&\n decision.code !== 'crud-reserved' &&\n decision.code !== 'not-public',\n )\n .map(([operation, decision]) => ({\n kind: 'api' as const,\n operation,\n code: decision.code ?? 'unknown',\n reason: decision.reason ?? '',\n objectName: object.qualifiedName ?? object.className,\n }))\n .sort((a, b) => a.operation.localeCompare(b.operation));\n return withheld.length > 0 ? { withheldSurfaces: withheld } : {};\n}\n\nfunction configuredSurfaces(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeSurface[] {\n const config = object.decoratorConfig?.[kind];\n // NOTE: the `cli` projection models the reservation rule core's\n // `CLIGenerator` used to apply (retired by #2664 -- see git history for\n // the deleted `packages/core/src/generators/cli.ts`), which reserves a\n // CRUD verb unconditionally.\n // That is NOT the shipped local CLI: `packages/cli/src/cli-generator.ts`'s\n // generator reserves one only where the CRUD command is emitted (each of\n // its commands carries its own handler), so with\n // `cli: { include: ['list', 'get'] }` a public `create()` is a reachable\n // `${object}:create` there that this projection does not report.\n //\n // Retargeting this projection at the shipped binary is tracked on #2692.\n // That is a CONTRACT CHANGE rather than a cleanup: the generators genuinely\n // disagree, so `smrt-knowledge.json` snapshots would move. Predates #2646.\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n const operations = configuredOperations(kind, object, config, manifest);\n return operations.map((operation) => {\n const route =\n kind === 'api' && !STANDARD_OPERATIONS.includes(operation)\n ? apiCustomRoute(object, operation, collectionClass)\n : undefined;\n return {\n kind,\n name: surfaceName(kind, object, operation),\n operation,\n objectName: object.qualifiedName ?? object.className,\n path: kind === 'api' ? apiPath(object, operation, route) : undefined,\n method: kind === 'api' ? apiMethod(operation, route) : undefined,\n };\n });\n}\n\n/**\n * `MCPGenerator.buildCustomActionTool()` registers a custom-action tool as\n * `` `${lowerName}_${methodName}`.toLowerCase() `` — lowercasing the WHOLE\n * joined string, not just the object-name prefix. A CRUD verb is already\n * lowercase so this is a no-op there, but a camelCase custom method name\n * (`findByDimensions`) would otherwise report a surface `name` the real tool\n * is never registered under. `packages/cli/src/cli-generator.ts`'s command\n * builder (`CLIGenerator`'s private `generateObjectCommands()`) does not\n * lowercase the method half of its command string, so `cli` keeps the\n * operation as-authored.\n *\n * Note the shapes differ from the transports' own: a `cli` surface `name`\n * here is `object_operation`, while the command a user types is\n * `object:operation`. `operation` is the field to correlate on.\n */\nfunction surfaceName(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n operation: string,\n): string {\n if (kind === 'api') return `${object.collection}.${operation}`;\n const name = `${object.className.toLowerCase()}_${operation}`;\n return kind === 'mcp' ? name.toLowerCase() : name;\n}\n\n/**\n * A hand-written `SmrtCollection` subclass (`class WidgetCollection extends\n * SmrtCollection<Widget>`) is discovered structurally by the scanner and\n * lands in the manifest even without its own `@smrt()` decorator, so it never\n * registers with `ObjectRegistry` by decoration. `MCPGenerator` (and,\n * historically, core's now-retired `CLIGenerator`, #2664) iterate the\n * decoration-populated `ObjectRegistry` directly, not the manifest, so such a\n * class never gets its own MCP tools there — only its collection-scoped\n * custom actions get REST routes. The shipped local CLI\n * (`packages/cli/src/cli-generator.ts`) is a documented exception: its\n * `ensureManifestLoaded()` pre-registers every manifest entry into\n * `ObjectRegistry` via `registerFromManifest()` before generating commands,\n * with no collection-class filter, so a manifest-only collection class IS\n * reachable there (e.g. `smrt itemcollection:list`) even though this\n * projection reports none. Reporting full CRUD for it here would over-report\n * the projection's own (registry-scoped) surface, trading the #2619\n * under-report for a new false positive there -- it does not claim the\n * shipped CLI binary lacks the surface too.\n *\n * A deeper subclass (`SpecialCollection extends WidgetCollection`) carries no\n * `extendsTypeArg` of its own, so this walks the extends chain through the\n * manifest — mirroring `isCollectionManifestClass` in\n * `vite-plugin/web-collections.ts` (kept as a separate, lean implementation\n * here rather than imported: that module pulls in the full SvelteKit route\n * generator transitively, which would balloon the standalone `./knowledge`\n * build entry for a ~15-line check).\n */\nfunction isSurfaceCollectionClass(\n manifest: SmartObjectManifest,\n object: SmartObjectDefinition,\n seen: Set<string> = new Set(),\n): boolean {\n // Truthy check (not `!== undefined`) mirrors the scanner: a non-generic\n // base emitting `extendsTypeArg: null` must not be misread as a collection.\n if (object.extends === 'SmrtCollection' || object.extendsTypeArg) {\n return true;\n }\n const parentName = object.extendsQualified || object.extends;\n if (!parentName || seen.has(parentName)) return false;\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, object);\n return parent ? isSurfaceCollectionClass(manifest, parent, seen) : false;\n}\n\nfunction findManifestObjectByName(\n manifest: SmartObjectManifest,\n name: string,\n owner: SmartObjectDefinition,\n): SmartObjectDefinition | undefined {\n const entries = Object.entries(manifest.objects);\n if (name.includes(':')) {\n const exact = entries.find(\n ([key, candidate]) => (candidate.qualifiedName ?? key) === name,\n );\n if (exact) return exact[1];\n }\n // Prefer a same-package parent before falling back to a bare simple name:\n // an aggregated manifest can carry several classes sharing one simple name,\n // and resolving the wrong one misclassifies the collection-class carve-out.\n const ownerKey = entries.find(([, candidate]) => candidate === owner)?.[0];\n const ownerPackage = manifestObjectPackage(owner, ownerKey);\n if (ownerPackage) {\n const packageLocal = entries.find(\n ([key, candidate]) =>\n manifestObjectPackage(candidate, key) === ownerPackage &&\n candidate.className === name,\n );\n if (packageLocal) return packageLocal[1];\n }\n return entries.find(([, candidate]) => candidate.className === name)?.[1];\n}\n\n/**\n * An object's owning package. `packageName` is optional on\n * `SmartObjectDefinition` (older manifests and hand-built fixtures omit it),\n * so fall back to the package half of the qualified name — and, when that is\n * absent too, of the manifest key, which is qualified for every entry the\n * scanner writes. Mirrors `manifestObjectPackage` in\n * `vite-plugin/web-collections.ts`, key fallback included: without it an\n * entry carrying only a qualified key resolves no package at all, the\n * same-package preference is skipped, and a duplicate simple name can pick\n * the wrong parent.\n */\nfunction manifestObjectPackage(\n object: SmartObjectDefinition,\n manifestKey?: string,\n): string | undefined {\n if (object.packageName) return object.packageName;\n const qualifiedName = object.qualifiedName ?? manifestKey;\n const separator = qualifiedName?.lastIndexOf(':') ?? -1;\n return separator > 0 ? qualifiedName?.slice(0, separator) : undefined;\n}\n\n/**\n * Operations exposed for one object's `api`/`cli`/`mcp` surface, derived from\n * the same defaults `APIGenerator`/core's retired `CLIGenerator`\n * (#2664)/`MCPGenerator` apply rather\n * than from the presence of a config key (#2619): an omitted config is full\n * CRUD, not a closed surface — an `include` list, when present, is the\n * COMPLETE allowlist for custom methods too; without one, every public\n * method not explicitly excluded is exposed by default. Only `config ===\n * false` closes the surface entirely.\n *\n * Custom (non-CRUD, public) method gating is NOT identical across the three\n * kinds. Core's retired `CLIGenerator.listCommands()`/`assertCommandExposed()`\n * (#2664) and\n * `MCPGenerator.generateTools()` both refuse a framework lifecycle method\n * (`save`, `initialize`, ...) even when a class declares its own override —\n * it is the mechanism behind generated CRUD, not a distinct action (#2638) —\n * and `resolveCustomMethodNames()` below mirrors that same\n * `isFrameworkLifecycleMethod()` check for `kind === 'cli'` and\n * `kind === 'mcp'` (#2657, #2638). `api` remains ungated on this: the\n * generator did not change in #2650/#2638, and the fix there is a PR #2651\n * recommendation, not yet implemented.\n *\n * `resolveCustomMethodNames()` also mirrors two more `mcp`-only behaviors\n * that follow from its case-folded tool-id namespace (#2638): an `exclude`\n * entry is compared case-insensitively (matching `MCPGenerator`'s own\n * asymmetry fix -- `exclude` used to fail open on a cased entry the way\n * `include` never did), and two method names that fold onto the same tool id\n * (e.g. `Refresh`/`refresh`) are reported once, keeping whichever was\n * declared first, mirroring `MCPGenerator`'s per-object dedup. `cli`/`api`\n * keep declared casing in their command/route names, so neither behavior\n * applies to them.\n *\n * This `cli` projection models the reservation rule core's `CLIGenerator`\n * used to apply (`generators/cli.ts`, retired by #2664), not the shipped\n * local CLI transport (`packages/cli/src/cli-generator.ts`, the\n * `smrt <object>:<action>` binary): that generator does not gate on\n * `isFrameworkLifecycleMethod()` today, so a locally overridden lifecycle\n * method the artifact now reports as absent can still be invoked there.\n * Retargeting this projection at the shipped binary is a contract change\n * tracked on #2692, not part of this fix.\n */\nfunction configuredOperations(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n config: unknown,\n manifest: SmartObjectManifest,\n): string[] {\n if (config === false) return [];\n // The framework's own abstract base classes (SmrtObject, SmrtCollection,\n // ...) are scaffolding, not resources: MCPGenerator/route generation and\n // packages/cli's CLIGenerator all skip them by class identity now (#2642),\n // independent of\n // their `decoratorConfig: {}` shape, so this mirrors the same shared\n // check rather than reporting a synthetic surface for them.\n if (isFrameworkBaseClass(object.className, object.packageName)) return [];\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n const crud = collectionClass ? [] : resolveCrudOperations(config);\n // `api` delegates custom-method eligibility wholesale to the emitters' own\n // resolver — CRUD reservation, framework lifecycle methods, include/exclude,\n // `@method()` overrides, the wire-ability heuristic, and the receiver check\n // are all decided there, once (#2686). `cli`/`mcp` keep their own projection\n // of `CLIGenerator`/`MCPGenerator`, whose rules genuinely differ (case-folded\n // tool ids, per-object dedup) and which #2692 owns.\n if (kind === 'api') {\n const custom = apiMethodDecisions(object, manifest)\n .filter(([, decision]) => decision.exposed)\n .map(([operation]) => operation);\n return [...crud, ...custom];\n }\n const custom = resolveCustomMethodNames(\n Object.entries(object.methods),\n config,\n kind,\n );\n return [...crud, ...custom];\n}\n\nfunction resolveCrudOperations(config: unknown): string[] {\n const { include, exclude } = includeExcludeConfig(config);\n const base = include\n ? STANDARD_OPERATIONS.filter((operation) => include.includes(operation))\n : [...STANDARD_OPERATIONS];\n if (!exclude || exclude.length === 0) return base;\n const excluded = new Set(exclude);\n return base.filter((operation) => !excluded.has(operation));\n}\n\nfunction resolveCustomMethodNames(\n methods: Iterable<[string, { isPublic?: boolean }]>,\n config: unknown,\n kind: 'api' | 'cli' | 'mcp',\n): string[] {\n const { include, exclude } = includeExcludeConfig(config);\n const excluded = new Set(exclude ?? []);\n // MCP tool ids are case-folded, so `MCPGenerator` compares `exclude`\n // case-insensitively too (`exclude: ['Refresh']` must suppress a method\n // declared `refresh`, and vice versa, #2638) -- mirror that here for\n // `kind === 'mcp'` only. `cli`/`api` keep the declared casing in their\n // command/route names (same asymmetry `reservesCrudName` documents below),\n // so an exact-match `exclude` stays correct for them.\n const excludedLower =\n kind === 'mcp'\n ? new Set([...excluded].map((entry) => entry.toLowerCase()))\n : undefined;\n // Tool ids already claimed for this object's `mcp` surface, so two\n // distinctly-cased method names (e.g. `Refresh`/`refresh`) that fold onto\n // the same MCP tool id are reported once, not twice -- mirroring\n // `MCPGenerator`'s per-object dedup (first declared wins, #2638). `cli`/\n // `api` need no such set: their command/route names keep declared casing,\n // so two cased method names never collide there.\n const emittedLower = kind === 'mcp' ? new Set<string>() : undefined;\n const names: string[] = [];\n for (const [name, method] of methods) {\n if (reservesCrudName(kind, name)) continue;\n // A framework lifecycle method (save/initialize/...) is never a custom\n // CLI or MCP action, even when a class declares its own override — it is\n // the mechanism behind generated CRUD, not a distinct operation, matching\n // core's retired CLIGenerator's (#2664) and MCPGenerator's own\n // isFrameworkLifecycleMethod() gate\n // (#2657, #2638). `api` is deliberately left alone — see\n // configuredOperations' doc comment above.\n if ((kind === 'cli' || kind === 'mcp') && isFrameworkLifecycleMethod(name))\n continue;\n if (!method.isPublic) continue;\n if (\n excludedLower ? excludedLower.has(name.toLowerCase()) : excluded.has(name)\n )\n continue;\n if (include !== undefined && !include.includes(name)) continue;\n if (emittedLower) {\n const lower = name.toLowerCase();\n if (emittedLower.has(lower)) continue;\n emittedLower.add(lower);\n }\n names.push(name);\n }\n return names;\n}\n\n/**\n * Whether `kind` reserves `name` for its generated CRUD operation, so the\n * method behind it is not reported as a distinct surface.\n *\n * MCP folds case: its tool ids are lowercased whole\n * (`` `${object}_${method}`.toLowerCase() ``), so a method named `List` lands on\n * the `${object}_list` identifier the CRUD tool already owns and\n * `MCPGenerator` emits no separate tool for it (#2646). REST and the CLI keep\n * the declared casing in their route/command names, so only an exact match is\n * reserved there.\n *\n * Reads the emitters' own predicates rather than re-testing the verb list, and\n * `STANDARD_OPERATIONS` derives from `CRUD_OPERATIONS`, so a change to the\n * shared list reaches both halves of this projection together.\n */\nfunction reservesCrudName(kind: 'api' | 'cli' | 'mcp', name: string): boolean {\n return kind === 'mcp' ? isCrudToolAction(name) : isCrudOperation(name);\n}\n\nfunction includeExcludeConfig(config: unknown): {\n include?: string[];\n exclude?: string[];\n} {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) {\n return {};\n }\n // A non-array `include`/`exclude` is treated as unset rather than\n // throwing later on `.includes()` — mirrors the same defensive stance\n // `shouldIncludeInApi` in `vite-plugin/sveltekit-generator.ts` takes for\n // a scanned decorator config that failed to resolve to an array.\n const record = config as { include?: unknown; exclude?: unknown };\n return {\n include: Array.isArray(record.include) ? record.include : undefined,\n exclude: Array.isArray(record.exclude) ? record.exclude : undefined,\n };\n}\n\nfunction aiSurfaces(object: SmartObjectDefinition): DomainKnowledgeSurface[] {\n return (object.tools ?? []).map((tool) => ({\n kind: 'ai',\n name: tool.function.name,\n operation: tool.function.name,\n description: tool.function.description,\n objectName: object.qualifiedName ?? object.className,\n }));\n}\n\n/** Route facts for one custom action, as `generateRoutesForObject` emits it. */\ninterface ApiCustomRoute {\n scope: 'item' | 'collection';\n segments: string[];\n method: string;\n}\n\n/**\n * Resolve a custom (non-CRUD) action's REST route the way the generator does,\n * or `undefined` when no route is emitted for it at all.\n *\n * A custom action's path is NOT `/collection/action`: `generateRoutesForObject`\n * nests an item-scoped action under `[id]`, and an instance method defaults to\n * item scope. Reporting the collection-shaped path for every public instance\n * method would advertise endpoints that do not exist — the exact failure this\n * projection exists to avoid. Scope comes from the shared\n * `resolveCustomActionMetadata`, the same resolver the REST, CLI, MCP, and\n * WebMCP paths use, so a `routes` override cannot drift between them.\n *\n * `kebabRoutes` is a Vite-plugin option rather than manifest data, so an\n * explicit `routes[action].path` is honored but the generator's optional\n * kebab-casing of a derived segment is not visible here.\n */\nfunction apiCustomRoute(\n object: SmartObjectDefinition,\n operation: string,\n collectionClass: boolean,\n): ApiCustomRoute | undefined {\n const method = object.methods[operation];\n const apiConfig = object.decoratorConfig?.api;\n const defaultScope: 'item' | 'collection' =\n collectionClass || method?.isStatic ? 'collection' : 'item';\n const scope = resolveActionScope(operation, method, apiConfig, defaultScope);\n\n // Mirrors the generator's own skips: a collection class emits only\n // collection-scoped routes, and a model class warns and skips a\n // collection-scoped non-static method (no receiver to bind).\n if (collectionClass) {\n if (scope !== 'collection') return undefined;\n } else if (scope === 'collection' && !method?.isStatic) {\n return undefined;\n }\n\n // `@method({ path, httpMethod })` wins field by field over the legacy\n // `api.routes[operation]` entry, exactly as `resolveApiActionRouteConfig`\n // resolves it for the emitter — otherwise the artifact would report the\n // pre-migration URL for a class that has moved to the decorator (#2686).\n const effective = resolveEffectiveActionMetadata({\n actionName: operation,\n ...(method ? { method } : {}),\n apiConfig,\n });\n const overridden =\n typeof effective.path === 'string'\n ? effective.path\n .split('/')\n .map((segment) => segment.trim())\n .filter(Boolean)\n : [];\n return {\n scope,\n segments: overridden.length > 0 ? overridden : [operation],\n method: normalizeApiMethod(effective.httpMethod),\n };\n}\n\n/**\n * The shared resolver validates as it resolves — a `routes` entry declaring\n * `effect: 'read'` on a PUT/PATCH/DELETE route throws by design. This\n * projection reads untrusted scanned config and must not fail the whole\n * knowledge build for one malformed action (same defensive stance as\n * {@link includeExcludeConfig}), so fall back to the receiver the method\n * itself dictates — which a route-only override cannot change anyway.\n */\nfunction resolveActionScope(\n operation: string,\n method: SmartObjectDefinition['methods'][string] | undefined,\n apiConfig: unknown,\n defaultScope: 'item' | 'collection',\n): 'item' | 'collection' {\n try {\n return resolveCustomActionMetadata({\n actionName: operation,\n method,\n apiConfig,\n defaultScope,\n }).scope;\n } catch {\n return defaultScope;\n }\n}\n\n/** Mirrors `normalizeApiHttpMethod` in `vite-plugin/sveltekit-generator.ts`. */\nfunction normalizeApiMethod(method: unknown): string {\n const normalized =\n typeof method === 'string' ? method.toUpperCase() : undefined;\n switch (normalized) {\n case 'GET':\n case 'POST':\n case 'PUT':\n case 'PATCH':\n case 'DELETE':\n return normalized;\n default:\n return 'POST';\n }\n}\n\n/**\n * The collection segment of a generated REST route.\n *\n * `generateRoutesForObject` builds its route directory from\n * `objectDef.collection` verbatim, and the runtime dispatcher in\n * `generators/rest.ts` matches the URL segment against `info.collection`\n * verbatim, so this reports that and nothing else (#2630).\n *\n * In particular it does NOT read `api.path`, which configures a different\n * surface: `@happyvertical/smrt-agents`' own agent-facing route map derives\n * `api.path ?? tableName.replace(/_/g, '-')`. Honoring it here produced a\n * hybrid — `api.path` over `collection` — that matched neither transport and\n * named endpoints that 404 on both.\n */\nfunction apiCollectionSegment(object: SmartObjectDefinition): string {\n return object.collection;\n}\n\nfunction apiPath(\n object: SmartObjectDefinition,\n operation: string,\n route?: ApiCustomRoute,\n): string {\n const configuredPath = apiCollectionSegment(object);\n if (route) {\n const base =\n route.scope === 'collection'\n ? `/${configuredPath}`\n : `/${configuredPath}/[id]`;\n return `${base}/${route.segments.join('/')}`;\n }\n if (operation === 'list' || operation === 'create') {\n return `/${configuredPath}`;\n }\n if (STANDARD_OPERATIONS.includes(operation)) {\n return `/${configuredPath}/[id]`;\n }\n return `/${configuredPath}/${operation}`;\n}\n\nfunction apiMethod(operation: string, route?: ApiCustomRoute): string {\n if (route) return route.method;\n switch (operation) {\n case 'list':\n case 'get':\n return 'GET';\n case 'create':\n return 'POST';\n case 'update':\n return 'PATCH';\n case 'delete':\n return 'DELETE';\n default:\n return 'POST';\n }\n}\n\nfunction relationshipFeatures(\n object: SmartObjectDefinition,\n fields: DomainKnowledgeField[],\n): string[] {\n const features = new Set<string>();\n for (const field of fields) {\n if (field.type === 'foreignKey') features.add('foreignKey');\n if (field.type === 'crossPackageRef') features.add('crossPackageRef');\n if (field.type === 'oneToMany') features.add('oneToMany');\n if (field.type === 'manyToMany') features.add('manyToMany');\n }\n if (object.extends === 'SmrtJunction') features.add('SmrtJunction');\n if (object.extends === 'SmrtHierarchical') features.add('SmrtHierarchical');\n if (\n object.extends === 'SmrtPolymorphicAssociation' ||\n fields.some((field) => field.name === 'metaType') ||\n fields.some((field) => field.name === 'metaId')\n ) {\n features.add('SmrtPolymorphicAssociation');\n }\n if (\n Object.keys(object.schema?.columns ?? {}).some(\n (name) => object.schema?.columns[name]?.type === 'UUID',\n )\n ) {\n features.add('uuidColumns');\n }\n return [...features].sort();\n}\n\nfunction summarizeRelationships(\n objects: DomainKnowledgeObject[],\n manifestObjects: SmartObjectDefinition[],\n) {\n const fields = objects.flatMap((object) => object.fields);\n return {\n foreignKeyFields: fields.filter((field) => field.type === 'foreignKey')\n .length,\n crossPackageRefFields: fields.filter(\n (field) => field.type === 'crossPackageRef',\n ).length,\n junctionCollections: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtJunction'),\n ).length,\n hierarchicalObjects: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtHierarchical'),\n ).length,\n polymorphicAssociations: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtPolymorphicAssociation'),\n ).length,\n uuidColumns: manifestObjects.reduce(\n (count, object) =>\n count +\n Object.values(object.schema?.columns ?? {}).filter(\n (column) => column.type === 'UUID',\n ).length,\n 0,\n ),\n };\n}\n\nfunction columnType(\n object: SmartObjectDefinition,\n fieldName: string,\n): string | undefined {\n const columnName = camelToSnake(fieldName);\n return object.schema?.columns[columnName]?.type;\n}\n\nfunction readPrompts(\n rootDir: string,\n): Array<{ filePath: string; key?: string }> {\n const srcDir = join(rootDir, 'src');\n if (!existsSync(srcDir)) return [];\n const prompts: Array<{ filePath: string; key?: string }> = [];\n for (const filePath of walkFiles(srcDir)) {\n if (!filePath.endsWith('.ts')) continue;\n const content = readFileSync(filePath, 'utf8');\n if (!content.includes('definePrompt')) continue;\n const keyMatch = content.match(/definePrompt\\s*\\(\\s*['\"`]([^'\"`]+)['\"`]/);\n prompts.push({\n filePath: relative(rootDir, filePath),\n key: keyMatch?.[1],\n });\n }\n return prompts;\n}\n\nfunction walkFiles(dir: string): string[] {\n const files: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (\n entry.name === 'node_modules' ||\n entry.name === 'dist' ||\n entry.name === '.svelte-kit'\n ) {\n continue;\n }\n const fullPath = join(dir, entry.name);\n if (entry.isDirectory()) {\n files.push(...walkFiles(fullPath));\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n return files;\n}\n\nfunction sourceHashes(sources: Record<string, HashSource | undefined>) {\n const hashes: Record<string, string> = {};\n for (const [name, source] of Object.entries(sources)) {\n if (!source) continue;\n const content =\n 'content' in source ? source.content : readFileSync(source.path, 'utf8');\n hashes[name] = createHash('sha256').update(content).digest('hex');\n }\n return hashes;\n}\n\ntype HashSource = { content: string } | { path: string };\n\nfunction fileHashSource(path: string | undefined): HashSource | undefined {\n return path ? { path } : undefined;\n}\n\nfunction existingPath(rootDir: string, path: string): string | undefined {\n const fullPath = join(rootDir, path);\n return existsSync(fullPath) ? fullPath : undefined;\n}\n\nfunction readPackageJson(rootDir: string): PackageJsonLike | null {\n const path = join(rootDir, 'package.json');\n if (!existsSync(path)) return null;\n return JSON.parse(readFileSync(path, 'utf8'));\n}\n\nfunction record(value: unknown): Record<string, string> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, string>)\n : {};\n}\n\nfunction exportKeys(exportsField: unknown): string[] {\n if (typeof exportsField === 'string') return ['.'];\n if (\n typeof exportsField !== 'object' ||\n exportsField === null ||\n Array.isArray(exportsField)\n ) {\n return [];\n }\n return Object.keys(exportsField).sort();\n}\n\nfunction camelToSnake(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[-\\s]+/g, '_')\n .toLowerCase();\n}\n\nfunction normalizeManifestForHash(manifest: SmartObjectManifest): unknown {\n const normalized = JSON.parse(JSON.stringify(manifest)) as Record<\n string,\n unknown\n >;\n delete normalized.timestamp;\n return normalized;\n}\n\nfunction stableJson(value: unknown): string {\n return JSON.stringify(sortJson(value), null, 2);\n}\n\nfunction sortJson(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(sortJson);\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, entry]) => [key, sortJson(entry)]),\n );\n }\n return value;\n}\n"],"mappings":";;;;;;;;AAuEA,IAAM,oCAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,IAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAUD,IAAM,sBAAyC;;;;;;;AAQ/C,IAAM,mBACJ;;AAGF,IAAa,yBAAyB;;;;;AA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M,CAAC;AAChD;AAEA,SAAS,SAAS,OAAyB;CACzC,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,QAAQ;CACnD,IAAI,SAAS,OAAO,UAAU,UAC5B,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAgC,CAAC,CAC7C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,SAAS,KAAK,CAAC,CAAC,CACjD;CAEF,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"knowledge.js","names":[],"sources":["../src/knowledge.ts"],"sourcesContent":["export {\n discoverScopedPackageDirectories,\n readPackageAgentDoc,\n type ScopedPackageDirectory,\n} from './knowledge-discovery.js';\nexport {\n buildKnowledgeGraph,\n checkKnowledgeGraphFreshness,\n discoverKnowledgeArtifactPaths,\n type KnowledgeGraphEdge,\n type KnowledgeGraphEdgeType,\n type KnowledgeGraphFreshnessIssue,\n type KnowledgeGraphInput,\n type KnowledgeGraphObjectNode,\n type KnowledgeGraphPackageNode,\n type SmrtKnowledgeGraph,\n stableStringify,\n} from './knowledge-graph.js';\n\nimport { createHash } from 'node:crypto';\nimport { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { basename, join, relative, resolve, sep } from 'node:path';\nimport type {\n DomainKnowledgeAgentSurface,\n DomainKnowledgeConfig,\n DomainKnowledgeField,\n DomainKnowledgeFieldConstraints,\n DomainKnowledgeManifest,\n DomainKnowledgeMethodSignature,\n DomainKnowledgeModuleDoc,\n DomainKnowledgeObject,\n DomainKnowledgeSurface,\n DomainKnowledgeTenant,\n DomainKnowledgeWithheldSurface,\n} from '@happyvertical/smrt-types';\nimport {\n type ApiMethodExposure,\n CRUD_OPERATIONS,\n createManifestClassNamePredicate,\n isCrudOperation,\n isCrudToolAction,\n isFrameworkLifecycleMethod,\n resolveApiMethodExposure,\n resolveCustomActionMetadata,\n resolveEffectiveActionMetadata,\n} from './generators/custom-action.js';\nimport { isFrameworkBaseClass } from './registry/framework-base-classes.js';\nimport type {\n SmartObjectDefinition,\n SmartObjectManifest,\n} from './scanner/types.js';\nimport { toSnakeCase } from './utils/naming.js';\n\n/**\n * Minimal package.json shape consumed by the knowledge builder.\n * `name`/`version` are typed concretely because they flow into the manifest's\n * string-typed metadata fields; everything else is read via `unknown`-accepting\n * helpers (`record()`, `exportKeys()`), so an index signature is sufficient.\n */\nexport interface PackageJsonLike {\n name?: string;\n version?: string;\n [key: string]: unknown;\n}\n\nexport interface BuildDomainKnowledgeOptions {\n manifest: SmartObjectManifest;\n rootDir: string;\n packageJson?: PackageJsonLike;\n manifestPath?: string;\n config?: DomainKnowledgeConfig;\n /**\n * The package's declared view intents and playbooks (#2591), produced by the\n * scanner's agent-surface matcher.\n *\n * Passed in rather than scanned here for one reason: the scanner carries a\n * native parser binary, and `smrt-core`'s main entry is browser-reachable.\n * The Vite plugin already imports the scanner lazily on the Node side and is\n * the one caller that writes this artifact, so it does the scan and hands the\n * result over.\n */\n agentSurface?: DomainKnowledgeAgentSurface;\n}\n\nconst SDK_PACKAGE_NAMES = new Set([\n '@happyvertical/ai',\n '@happyvertical/cache',\n '@happyvertical/documents',\n '@happyvertical/email',\n '@happyvertical/encryption',\n '@happyvertical/files',\n '@happyvertical/geo',\n '@happyvertical/images',\n '@happyvertical/jobs',\n '@happyvertical/json',\n '@happyvertical/logger',\n '@happyvertical/messages',\n '@happyvertical/ocr',\n '@happyvertical/pdf',\n '@happyvertical/projects',\n '@happyvertical/repos',\n '@happyvertical/secrets',\n '@happyvertical/spider',\n '@happyvertical/sql',\n '@happyvertical/utils',\n]);\n\nconst RELATIONSHIP_FIELD_TYPES = new Set([\n 'foreignKey',\n 'crossPackageRef',\n 'oneToMany',\n 'manyToMany',\n]);\n\n/**\n * The generated CRUD verbs, derived from the generators' own list so both\n * halves of this projection — which operations are ENUMERATED\n * (`resolveCrudOperations`) and which method names are RESERVED\n * (`reservesCrudName`) — move together. Reading one from `CRUD_OPERATIONS` and\n * the other from a local copy would let a new verb be suppressed as a custom\n * method while never being added as CRUD, dropping the surface entirely.\n */\nconst STANDARD_OPERATIONS: readonly string[] = CRUD_OPERATIONS;\n\n/**\n * Markdown inline links whose target is a `.md` file — `[label](agents/x.md)`,\n * tolerating an `#anchor` and a `\"title\"`. This is how a package registers a\n * sibling module doc (#2108): the link in `AGENTS.md` IS the registration, so\n * there is no separate index to drift out of sync.\n */\nconst MARKDOWN_MD_LINK =\n /\\[[^\\]]*\\]\\(\\s*([^)\\s#]+\\.md)(?:#[^)\\s]*)?(?:\\s+\"[^\"]*\")?\\s*\\)/g;\n\n/** `sourceHashes` key prefix for a linked module doc, e.g. `moduleDoc:agents/crm.md`. */\nexport const MODULE_DOC_HASH_PREFIX = 'moduleDoc:';\n\n/**\n * `sourceHashes` key prefix for a module declaring a view intent or playbook,\n * e.g. `agentSurface:src/lib/orders.intents.ts` (#2591).\n */\nexport const AGENT_SURFACE_HASH_PREFIX = 'agentSurface:';\n\n/**\n * Module doc paths linked from a package's `AGENTS.md`, relative to the package\n * root and in document order.\n *\n * Instruction chains are additive (see `scripts/check-agents-chain.mjs`), so an\n * oversized package doc is split into `packages/<pkg>/agents/<module>.md` siblings\n * instead of nested `AGENTS.md` files. Only links resolving to an existing file\n * INSIDE the package are accepted — a cross-package reference such as\n * `packages/affiliates/MIGRATION.md` belongs to that package's own chain and is\n * ignored here.\n */\nexport function resolveAgentModuleDocPaths(\n rootDir: string,\n agentDoc: string | undefined,\n): string[] {\n if (!agentDoc) return [];\n const root = resolve(rootDir);\n const paths: string[] = [];\n for (const match of agentDoc.matchAll(MARKDOWN_MD_LINK)) {\n const target = match[1];\n if (target.includes('://')) continue;\n const absolute = resolve(root, target);\n if (absolute !== root && !absolute.startsWith(root + sep)) continue;\n const relativePath = relative(root, absolute).split(sep).join('/');\n if (relativePath === 'AGENTS.md' || relativePath === 'CLAUDE.md') continue;\n if (paths.includes(relativePath)) continue;\n if (!existsSync(absolute) || !statSync(absolute).isFile()) continue;\n paths.push(relativePath);\n }\n return paths;\n}\n\n/** {@link resolveAgentModuleDocPaths}, with each doc's contents read. */\nexport function readAgentModuleDocs(\n rootDir: string,\n agentDoc: string | undefined,\n): DomainKnowledgeModuleDoc[] {\n return resolveAgentModuleDocPaths(rootDir, agentDoc).map((path) => ({\n path,\n module: basename(path, '.md'),\n content: readFileSync(join(rootDir, path), 'utf8'),\n }));\n}\n\nexport function buildDomainKnowledgeManifest(\n options: BuildDomainKnowledgeOptions,\n): DomainKnowledgeManifest {\n const rootDir = options.rootDir;\n const packageJson = options.packageJson ?? readPackageJson(rootDir) ?? {};\n const packageName = options.manifest.packageName ?? packageJson.name;\n const packageVersion = options.manifest.packageVersion ?? packageJson.version;\n const agentDocPath = existingPath(rootDir, 'AGENTS.md');\n const agentDocContent = agentDocPath\n ? readFileSync(agentDocPath, 'utf8')\n : undefined;\n const includeDocs = options.config?.includeDocs !== false;\n const agentDoc = includeDocs ? agentDocContent : undefined;\n // Module doc PATHS are always resolved so their hashes gate freshness even\n // when doc bodies are excluded from the artifact — same stance as `agents`.\n const moduleDocPaths = resolveAgentModuleDocPaths(rootDir, agentDocContent);\n const allDependencies = {\n ...record(packageJson.dependencies),\n ...record(packageJson.devDependencies),\n ...record(packageJson.peerDependencies),\n };\n const manifestObjects = Object.values(options.manifest.objects).filter(\n (object) => object.decoratorConfig?.knowledge !== false,\n );\n const objects = manifestObjects.map((object) =>\n buildKnowledgeObject(object, options.manifest),\n );\n const surfaces = objects.flatMap((object) => object.surfaces);\n const manifestJson = stableJson(normalizeManifestForHash(options.manifest));\n const agentSurface = normalizeAgentSurface(options.agentSurface);\n const relationshipsV2 = summarizeRelationships(objects, manifestObjects);\n\n return {\n schemaVersion: 1,\n sensitiveFieldsExcluded: true,\n generatedAt: new Date().toISOString(),\n packageName,\n packageVersion,\n sourceManifestPath: options.manifestPath\n ? relative(rootDir, options.manifestPath)\n : undefined,\n agentDocPath: agentDocPath ? relative(rootDir, agentDocPath) : undefined,\n sourceHashes: sourceHashes({\n manifest: { content: manifestJson },\n packageJson: fileHashSource(existingPath(rootDir, 'package.json')),\n agents: fileHashSource(agentDocPath),\n ...Object.fromEntries(\n moduleDocPaths.map((path) => [\n `${MODULE_DOC_HASH_PREFIX}${path}`,\n fileHashSource(join(rootDir, path)),\n ]),\n ),\n // A module declaring an intent or a playbook is an authored source of\n // this artifact exactly like `AGENTS.md` is, so editing one must mark the\n // artifact stale (#2591).\n ...Object.fromEntries(\n agentSurfaceSourcePaths(agentSurface).map((path) => [\n `${AGENT_SURFACE_HASH_PREFIX}${path}`,\n fileHashSource(join(rootDir, path)),\n ]),\n ),\n }),\n exports: exportKeys(packageJson.exports),\n dependencies: allDependencies,\n smrtDependencies: Object.keys(allDependencies)\n .filter((dep) => dep.startsWith('@happyvertical/smrt-'))\n .sort(),\n sdkDependencies: Object.keys(allDependencies)\n .filter((dep) => SDK_PACKAGE_NAMES.has(dep))\n .sort(),\n tags:\n options.config?.tags ?? deriveDefaultTags(packageJson, allDependencies),\n summary: options.config?.summary,\n risks:\n options.config?.risks ??\n deriveDefaultRisks({\n sensitiveFieldsExcluded: true,\n relationshipsV2,\n objects,\n }),\n objects,\n surfaces,\n prompts:\n options.config?.includePrompts === false ? [] : readPrompts(rootDir),\n relationshipsV2,\n agentDoc,\n moduleDocs:\n includeDocs && moduleDocPaths.length > 0\n ? readAgentModuleDocs(rootDir, agentDocContent)\n : undefined,\n agentSurface,\n };\n}\n\n/**\n * Drop an agent surface that carries nothing.\n *\n * Keeping the key absent for a package that declares no intent, no playbook,\n * and no diagnostic is what makes this field additive in practice: every\n * checked-in artifact for such a package stays byte-identical to what it\n * emitted before the field existed, so adding emission does not churn the\n * repository's knowledge artifacts.\n */\nfunction normalizeAgentSurface(\n surface: DomainKnowledgeAgentSurface | undefined,\n): DomainKnowledgeAgentSurface | undefined {\n if (!surface) return undefined;\n const empty =\n surface.intents.length === 0 &&\n surface.playbooks.length === 0 &&\n surface.diagnostics.length === 0;\n return empty ? undefined : surface;\n}\n\n/** Every package-relative module that contributed to the emitted surface. */\nfunction agentSurfaceSourcePaths(\n surface: DomainKnowledgeAgentSurface | undefined,\n): string[] {\n if (!surface) return [];\n const paths = new Set<string>();\n for (const intent of surface.intents) paths.add(intent.sourceFile);\n for (const playbook of surface.playbooks) paths.add(playbook.sourceFile);\n for (const diagnostic of surface.diagnostics)\n paths.add(diagnostic.sourceFile);\n return [...paths].sort();\n}\n\nfunction buildKnowledgeObject(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeObject {\n const knowledge =\n typeof object.decoratorConfig?.knowledge === 'object'\n ? object.decoratorConfig.knowledge\n : {};\n const fields = Object.entries(object.fields)\n .filter(([, field]) => !isSensitiveField(field))\n .map(([name, field]): DomainKnowledgeField => {\n const defaultValue = fieldValue(field, 'default');\n return {\n name,\n type: field.type,\n required: field.required,\n related: field.related,\n columnType: columnType(object, name),\n ...(defaultValue.present ? { default: defaultValue.value } : {}),\n constraints: fieldConstraints(field),\n readonly:\n field.readonly === true || field._meta?.readonly === true\n ? true\n : undefined,\n transient:\n field.transient === true || field._meta?.transient === true\n ? true\n : undefined,\n };\n });\n const sensitiveIdentifiers = sensitiveFieldIdentifiers(object.fields);\n const tenant = sanitizeTenantFacts(\n tenantFacts(object.decoratorConfig?.tenantScoped),\n sensitiveIdentifiers,\n );\n const conflictColumns = object.decoratorConfig?.conflictColumns?.filter(\n (column) => !sensitiveIdentifiers.has(column),\n );\n const relationships = fields\n .filter((field) => RELATIONSHIP_FIELD_TYPES.has(field.type))\n .map((field) => ({\n name: field.name,\n type: field.type,\n required: field.required,\n related: field.related,\n columnType: field.columnType,\n }));\n\n return {\n name: object.className,\n qualifiedName: object.qualifiedName,\n collection: object.collection,\n tableName: object.schema?.tableName,\n packageName: object.packageName,\n extends: object.extends,\n visibility: object.visibility,\n fields,\n relationships,\n methods: Object.keys(object.methods).sort(),\n methodSignatures: methodSignatures(object),\n tenant,\n tableStrategy: object.decoratorConfig?.tableStrategy,\n conflictColumns:\n conflictColumns && conflictColumns.length > 0\n ? conflictColumns\n : undefined,\n surfaces: objectSurfaces(object, manifest),\n ...withheldApiSurfaces(object, manifest),\n relationshipFeatures: relationshipFeatures(object, fields),\n tags: knowledge.tags ?? [],\n summary: knowledge.summary,\n risks: knowledge.risks ?? [],\n };\n}\n\nfunction isSensitiveField(field: SmartObjectDefinition['fields'][string]) {\n return field.sensitive === true || field._meta?.sensitive === true;\n}\n\nfunction sensitiveFieldIdentifiers(\n fields: SmartObjectDefinition['fields'],\n): Set<string> {\n return new Set(\n Object.entries(fields)\n .filter(([, field]) => isSensitiveField(field))\n .flatMap(([name]) => [name, toSnakeCase(name), camelToSnake(name)]),\n );\n}\n\nfunction fieldValue(\n field: SmartObjectDefinition['fields'][string],\n key: 'default' | 'min' | 'max' | 'minLength' | 'maxLength',\n): { present: boolean; value: unknown } {\n if (Object.hasOwn(field, key)) {\n return { present: field[key] !== undefined, value: field[key] };\n }\n const value = field._meta?.[key];\n return { present: value !== undefined, value };\n}\n\nfunction fieldConstraints(\n field: SmartObjectDefinition['fields'][string],\n): DomainKnowledgeFieldConstraints | undefined {\n const constraints: DomainKnowledgeFieldConstraints = {};\n for (const key of ['min', 'max', 'minLength', 'maxLength'] as const) {\n const value = fieldValue(field, key);\n if (value.present && typeof value.value === 'number') {\n constraints[key] = value.value;\n }\n }\n const pattern = normalizePattern(\n (field as { pattern?: unknown }).pattern ?? field._meta?.pattern,\n );\n if (pattern !== undefined) constraints.pattern = pattern;\n return Object.keys(constraints).length > 0 ? constraints : undefined;\n}\n\nfunction normalizePattern(pattern: unknown): string | undefined {\n if (typeof pattern === 'string') return pattern;\n if (pattern instanceof RegExp) return pattern.source;\n if (\n pattern &&\n typeof pattern === 'object' &&\n typeof (pattern as { source?: unknown }).source === 'string'\n ) {\n return (pattern as { source: string }).source;\n }\n return undefined;\n}\n\nfunction tenantFacts(\n tenantScoped: SmartObjectDefinition['decoratorConfig']['tenantScoped'],\n): DomainKnowledgeTenant | undefined {\n if (!tenantScoped) return undefined;\n if (tenantScoped === true) {\n return { scoped: true, mode: 'required', field: 'tenantId' };\n }\n return {\n scoped: true,\n mode: tenantScoped.mode ?? 'required',\n field: tenantScoped.field ?? 'tenantId',\n };\n}\n\nfunction sanitizeTenantFacts(\n tenant: DomainKnowledgeTenant | undefined,\n sensitiveIdentifiers: Set<string>,\n): DomainKnowledgeTenant | undefined {\n if (!tenant?.field || !sensitiveIdentifiers.has(tenant.field)) return tenant;\n return { scoped: tenant.scoped, mode: tenant.mode };\n}\n\nfunction methodSignatures(\n object: SmartObjectDefinition,\n): DomainKnowledgeMethodSignature[] | undefined {\n const signatures = Object.values(object.methods)\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((method) => ({\n name: method.name,\n async: method.async || undefined,\n static: method.isStatic || undefined,\n params:\n method.parameters.length > 0\n ? method.parameters.map(\n (parameter) =>\n `${parameter.name}${parameter.optional ? '?' : ''}: ${parameter.type}`,\n )\n : undefined,\n returns: method.returnType || undefined,\n }));\n return signatures.length > 0 ? signatures : undefined;\n}\n\nfunction objectSurfaces(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeSurface[] {\n return [\n ...configuredSurfaces('api', object, manifest),\n ...configuredSurfaces('cli', object, manifest),\n ...configuredSurfaces('mcp', object, manifest),\n ...aiSurfaces(object),\n ];\n}\n\n/**\n * Every API-exposure decision for one object's methods, from the shared\n * resolver the route emitters use — so a method reported here as exposed has a\n * route file, and one reported as withheld has none.\n *\n * The whole point of routing this through `resolveApiMethodExposure` rather\n * than a local mirror is that a fourth copy of the rule is a fourth chance to\n * disagree with the emitters (#2686).\n */\nfunction apiMethodDecisions(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): Array<[string, ApiMethodExposure]> {\n const apiConfig = object.decoratorConfig?.api;\n const isModelClassName = createManifestClassNamePredicate(manifest);\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n return Object.entries(object.methods).map(([name, method]) => [\n name,\n resolveApiMethodExposure({\n actionName: name,\n method,\n apiConfig,\n isCollectionClass: collectionClass,\n ...(isModelClassName ? { isModelClassName } : {}),\n }),\n ]);\n}\n\n/**\n * The `withheldSurfaces` half of the artifact: every public method the API\n * declined, with the reason.\n *\n * Reported for `api` only. `cli`/`mcp` gate on a much smaller, purely\n * name-based rule set that a reader can already infer from the config, while\n * the API's wire-ability heuristic rejects on a signature detail nothing else\n * in the artifact shows — which is exactly the silence #2686 set out to close.\n *\n * CRUD-reserved and non-public methods are excluded: neither was ever a\n * candidate custom action, so listing them would bury the actionable entries.\n */\nfunction withheldApiSurfaces(\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): { withheldSurfaces?: DomainKnowledgeWithheldSurface[] } {\n if (isFrameworkBaseClass(object.className, object.packageName)) return {};\n const withheld = apiMethodDecisions(object, manifest)\n .filter(\n ([, decision]) =>\n !decision.exposed &&\n decision.code !== 'crud-reserved' &&\n decision.code !== 'not-public',\n )\n .map(([operation, decision]) => ({\n kind: 'api' as const,\n operation,\n code: decision.code ?? 'unknown',\n reason: decision.reason ?? '',\n objectName: object.qualifiedName ?? object.className,\n }))\n .sort((a, b) => a.operation.localeCompare(b.operation));\n return withheld.length > 0 ? { withheldSurfaces: withheld } : {};\n}\n\nfunction configuredSurfaces(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n manifest: SmartObjectManifest,\n): DomainKnowledgeSurface[] {\n const config = object.decoratorConfig?.[kind];\n // NOTE: the `cli` projection models the reservation rule core's\n // `CLIGenerator` used to apply (retired by #2664 -- see git history for\n // the deleted `packages/core/src/generators/cli.ts`), which reserves a\n // CRUD verb unconditionally.\n // That is NOT the shipped local CLI: `packages/cli/src/cli-generator.ts`'s\n // generator reserves one only where the CRUD command is emitted (each of\n // its commands carries its own handler), so with\n // `cli: { include: ['list', 'get'] }` a public `create()` is a reachable\n // `${object}:create` there that this projection does not report.\n //\n // Retargeting this projection at the shipped binary is tracked on #2692.\n // That is a CONTRACT CHANGE rather than a cleanup: the generators genuinely\n // disagree, so `smrt-knowledge.json` snapshots would move. Predates #2646.\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n const operations = configuredOperations(kind, object, config, manifest);\n return operations.map((operation) => {\n const route =\n kind === 'api' && !STANDARD_OPERATIONS.includes(operation)\n ? apiCustomRoute(object, operation, collectionClass)\n : undefined;\n return {\n kind,\n name: surfaceName(kind, object, operation),\n operation,\n objectName: object.qualifiedName ?? object.className,\n path: kind === 'api' ? apiPath(object, operation, route) : undefined,\n method: kind === 'api' ? apiMethod(operation, route) : undefined,\n };\n });\n}\n\n/**\n * `MCPGenerator.buildCustomActionTool()` registers a custom-action tool as\n * `` `${lowerName}_${methodName}`.toLowerCase() `` — lowercasing the WHOLE\n * joined string, not just the object-name prefix. A CRUD verb is already\n * lowercase so this is a no-op there, but a camelCase custom method name\n * (`findByDimensions`) would otherwise report a surface `name` the real tool\n * is never registered under. `packages/cli/src/cli-generator.ts`'s command\n * builder (`CLIGenerator`'s private `generateObjectCommands()`) does not\n * lowercase the method half of its command string, so `cli` keeps the\n * operation as-authored.\n *\n * Note the shapes differ from the transports' own: a `cli` surface `name`\n * here is `object_operation`, while the command a user types is\n * `object:operation`. `operation` is the field to correlate on.\n */\nfunction surfaceName(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n operation: string,\n): string {\n if (kind === 'api') return `${object.collection}.${operation}`;\n const name = `${object.className.toLowerCase()}_${operation}`;\n return kind === 'mcp' ? name.toLowerCase() : name;\n}\n\n/**\n * A hand-written `SmrtCollection` subclass (`class WidgetCollection extends\n * SmrtCollection<Widget>`) is discovered structurally by the scanner and\n * lands in the manifest even without its own `@smrt()` decorator, so it never\n * registers with `ObjectRegistry` by decoration. `MCPGenerator` (and,\n * historically, core's now-retired `CLIGenerator`, #2664) iterate the\n * decoration-populated `ObjectRegistry` directly, not the manifest, so such a\n * class never gets its own MCP tools there — only its collection-scoped\n * custom actions get REST routes. The shipped local CLI\n * (`packages/cli/src/cli-generator.ts`) is a documented exception: its\n * `ensureManifestLoaded()` pre-registers every manifest entry into\n * `ObjectRegistry` via `registerFromManifest()` before generating commands,\n * with no collection-class filter, so a manifest-only collection class IS\n * reachable there (e.g. `smrt itemcollection:list`) even though this\n * projection reports none. Reporting full CRUD for it here would over-report\n * the projection's own (registry-scoped) surface, trading the #2619\n * under-report for a new false positive there -- it does not claim the\n * shipped CLI binary lacks the surface too.\n *\n * A deeper subclass (`SpecialCollection extends WidgetCollection`) carries no\n * `extendsTypeArg` of its own, so this walks the extends chain through the\n * manifest — mirroring `isCollectionManifestClass` in\n * `vite-plugin/web-collections.ts` (kept as a separate, lean implementation\n * here rather than imported: that module pulls in the full SvelteKit route\n * generator transitively, which would balloon the standalone `./knowledge`\n * build entry for a ~15-line check).\n */\nfunction isSurfaceCollectionClass(\n manifest: SmartObjectManifest,\n object: SmartObjectDefinition,\n seen: Set<string> = new Set(),\n): boolean {\n // Truthy check (not `!== undefined`) mirrors the scanner: a non-generic\n // base emitting `extendsTypeArg: null` must not be misread as a collection.\n if (object.extends === 'SmrtCollection' || object.extendsTypeArg) {\n return true;\n }\n const parentName = object.extendsQualified || object.extends;\n if (!parentName || seen.has(parentName)) return false;\n seen.add(parentName);\n const parent = findManifestObjectByName(manifest, parentName, object);\n return parent ? isSurfaceCollectionClass(manifest, parent, seen) : false;\n}\n\nfunction findManifestObjectByName(\n manifest: SmartObjectManifest,\n name: string,\n owner: SmartObjectDefinition,\n): SmartObjectDefinition | undefined {\n const entries = Object.entries(manifest.objects);\n if (name.includes(':')) {\n const exact = entries.find(\n ([key, candidate]) => (candidate.qualifiedName ?? key) === name,\n );\n if (exact) return exact[1];\n }\n // Prefer a same-package parent before falling back to a bare simple name:\n // an aggregated manifest can carry several classes sharing one simple name,\n // and resolving the wrong one misclassifies the collection-class carve-out.\n const ownerKey = entries.find(([, candidate]) => candidate === owner)?.[0];\n const ownerPackage = manifestObjectPackage(owner, ownerKey);\n if (ownerPackage) {\n const packageLocal = entries.find(\n ([key, candidate]) =>\n manifestObjectPackage(candidate, key) === ownerPackage &&\n candidate.className === name,\n );\n if (packageLocal) return packageLocal[1];\n }\n return entries.find(([, candidate]) => candidate.className === name)?.[1];\n}\n\n/**\n * An object's owning package. `packageName` is optional on\n * `SmartObjectDefinition` (older manifests and hand-built fixtures omit it),\n * so fall back to the package half of the qualified name — and, when that is\n * absent too, of the manifest key, which is qualified for every entry the\n * scanner writes. Mirrors `manifestObjectPackage` in\n * `vite-plugin/web-collections.ts`, key fallback included: without it an\n * entry carrying only a qualified key resolves no package at all, the\n * same-package preference is skipped, and a duplicate simple name can pick\n * the wrong parent.\n */\nfunction manifestObjectPackage(\n object: SmartObjectDefinition,\n manifestKey?: string,\n): string | undefined {\n if (object.packageName) return object.packageName;\n const qualifiedName = object.qualifiedName ?? manifestKey;\n const separator = qualifiedName?.lastIndexOf(':') ?? -1;\n return separator > 0 ? qualifiedName?.slice(0, separator) : undefined;\n}\n\n/**\n * Operations exposed for one object's `api`/`cli`/`mcp` surface, derived from\n * the same defaults `APIGenerator`/core's retired `CLIGenerator`\n * (#2664)/`MCPGenerator` apply rather\n * than from the presence of a config key (#2619): an omitted config is full\n * CRUD, not a closed surface — an `include` list, when present, is the\n * COMPLETE allowlist for custom methods too; without one, every public\n * method not explicitly excluded is exposed by default. Only `config ===\n * false` closes the surface entirely.\n *\n * Custom (non-CRUD, public) method gating is NOT identical across the three\n * kinds. Core's retired `CLIGenerator.listCommands()`/`assertCommandExposed()`\n * (#2664) and\n * `MCPGenerator.generateTools()` both refuse a framework lifecycle method\n * (`save`, `initialize`, ...) even when a class declares its own override —\n * it is the mechanism behind generated CRUD, not a distinct action (#2638) —\n * and `resolveCustomMethodNames()` below mirrors that same\n * `isFrameworkLifecycleMethod()` check for `kind === 'cli'` and\n * `kind === 'mcp'` (#2657, #2638). `api` remains ungated on this: the\n * generator did not change in #2650/#2638, and the fix there is a PR #2651\n * recommendation, not yet implemented.\n *\n * `resolveCustomMethodNames()` also mirrors two more `mcp`-only behaviors\n * that follow from its case-folded tool-id namespace (#2638): an `exclude`\n * entry is compared case-insensitively (matching `MCPGenerator`'s own\n * asymmetry fix -- `exclude` used to fail open on a cased entry the way\n * `include` never did), and two method names that fold onto the same tool id\n * (e.g. `Refresh`/`refresh`) are reported once, keeping whichever was\n * declared first, mirroring `MCPGenerator`'s per-object dedup. `cli`/`api`\n * keep declared casing in their command/route names, so neither behavior\n * applies to them.\n *\n * This `cli` projection models the reservation rule core's `CLIGenerator`\n * used to apply (`generators/cli.ts`, retired by #2664), not the shipped\n * local CLI transport (`packages/cli/src/cli-generator.ts`, the\n * `smrt <object>:<action>` binary): that generator does not gate on\n * `isFrameworkLifecycleMethod()` today, so a locally overridden lifecycle\n * method the artifact now reports as absent can still be invoked there.\n * Retargeting this projection at the shipped binary is a contract change\n * tracked on #2692, not part of this fix.\n */\nfunction configuredOperations(\n kind: 'api' | 'cli' | 'mcp',\n object: SmartObjectDefinition,\n config: unknown,\n manifest: SmartObjectManifest,\n): string[] {\n if (config === false) return [];\n // The framework's own abstract base classes (SmrtObject, SmrtCollection,\n // ...) are scaffolding, not resources: MCPGenerator/route generation and\n // packages/cli's CLIGenerator all skip them by class identity now (#2642),\n // independent of\n // their `decoratorConfig: {}` shape, so this mirrors the same shared\n // check rather than reporting a synthetic surface for them.\n if (isFrameworkBaseClass(object.className, object.packageName)) return [];\n const collectionClass = isSurfaceCollectionClass(manifest, object);\n const crud = collectionClass ? [] : resolveCrudOperations(config);\n // `api` delegates custom-method eligibility wholesale to the emitters' own\n // resolver — CRUD reservation, framework lifecycle methods, include/exclude,\n // `@method()` overrides, the wire-ability heuristic, and the receiver check\n // are all decided there, once (#2686). `cli`/`mcp` keep their own projection\n // of `CLIGenerator`/`MCPGenerator`, whose rules genuinely differ (case-folded\n // tool ids, per-object dedup) and which #2692 owns.\n if (kind === 'api') {\n const custom = apiMethodDecisions(object, manifest)\n .filter(([, decision]) => decision.exposed)\n .map(([operation]) => operation);\n return [...crud, ...custom];\n }\n const custom = resolveCustomMethodNames(\n Object.entries(object.methods),\n config,\n kind,\n );\n return [...crud, ...custom];\n}\n\nfunction resolveCrudOperations(config: unknown): string[] {\n const { include, exclude } = includeExcludeConfig(config);\n const base = include\n ? STANDARD_OPERATIONS.filter((operation) => include.includes(operation))\n : [...STANDARD_OPERATIONS];\n if (!exclude || exclude.length === 0) return base;\n const excluded = new Set(exclude);\n return base.filter((operation) => !excluded.has(operation));\n}\n\nfunction resolveCustomMethodNames(\n methods: Iterable<[string, { isPublic?: boolean }]>,\n config: unknown,\n kind: 'api' | 'cli' | 'mcp',\n): string[] {\n const { include, exclude } = includeExcludeConfig(config);\n const excluded = new Set(exclude ?? []);\n // MCP tool ids are case-folded, so `MCPGenerator` compares `exclude`\n // case-insensitively too (`exclude: ['Refresh']` must suppress a method\n // declared `refresh`, and vice versa, #2638) -- mirror that here for\n // `kind === 'mcp'` only. `cli`/`api` keep the declared casing in their\n // command/route names (same asymmetry `reservesCrudName` documents below),\n // so an exact-match `exclude` stays correct for them.\n const excludedLower =\n kind === 'mcp'\n ? new Set([...excluded].map((entry) => entry.toLowerCase()))\n : undefined;\n // Tool ids already claimed for this object's `mcp` surface, so two\n // distinctly-cased method names (e.g. `Refresh`/`refresh`) that fold onto\n // the same MCP tool id are reported once, not twice -- mirroring\n // `MCPGenerator`'s per-object dedup (first declared wins, #2638). `cli`/\n // `api` need no such set: their command/route names keep declared casing,\n // so two cased method names never collide there.\n const emittedLower = kind === 'mcp' ? new Set<string>() : undefined;\n const names: string[] = [];\n for (const [name, method] of methods) {\n if (reservesCrudName(kind, name)) continue;\n // A framework lifecycle method (save/initialize/...) is never a custom\n // CLI or MCP action, even when a class declares its own override — it is\n // the mechanism behind generated CRUD, not a distinct operation, matching\n // core's retired CLIGenerator's (#2664) and MCPGenerator's own\n // isFrameworkLifecycleMethod() gate\n // (#2657, #2638). `api` is deliberately left alone — see\n // configuredOperations' doc comment above.\n if ((kind === 'cli' || kind === 'mcp') && isFrameworkLifecycleMethod(name))\n continue;\n if (!method.isPublic) continue;\n if (\n excludedLower ? excludedLower.has(name.toLowerCase()) : excluded.has(name)\n )\n continue;\n if (include !== undefined && !include.includes(name)) continue;\n if (emittedLower) {\n const lower = name.toLowerCase();\n if (emittedLower.has(lower)) continue;\n emittedLower.add(lower);\n }\n names.push(name);\n }\n return names;\n}\n\n/**\n * Whether `kind` reserves `name` for its generated CRUD operation, so the\n * method behind it is not reported as a distinct surface.\n *\n * MCP folds case: its tool ids are lowercased whole\n * (`` `${object}_${method}`.toLowerCase() ``), so a method named `List` lands on\n * the `${object}_list` identifier the CRUD tool already owns and\n * `MCPGenerator` emits no separate tool for it (#2646). REST and the CLI keep\n * the declared casing in their route/command names, so only an exact match is\n * reserved there.\n *\n * Reads the emitters' own predicates rather than re-testing the verb list, and\n * `STANDARD_OPERATIONS` derives from `CRUD_OPERATIONS`, so a change to the\n * shared list reaches both halves of this projection together.\n */\nfunction reservesCrudName(kind: 'api' | 'cli' | 'mcp', name: string): boolean {\n return kind === 'mcp' ? isCrudToolAction(name) : isCrudOperation(name);\n}\n\nfunction includeExcludeConfig(config: unknown): {\n include?: string[];\n exclude?: string[];\n} {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) {\n return {};\n }\n // A non-array `include`/`exclude` is treated as unset rather than\n // throwing later on `.includes()` — mirrors the same defensive stance\n // `shouldIncludeInApi` in `vite-plugin/sveltekit-generator.ts` takes for\n // a scanned decorator config that failed to resolve to an array.\n const record = config as { include?: unknown; exclude?: unknown };\n return {\n include: Array.isArray(record.include) ? record.include : undefined,\n exclude: Array.isArray(record.exclude) ? record.exclude : undefined,\n };\n}\n\nfunction aiSurfaces(object: SmartObjectDefinition): DomainKnowledgeSurface[] {\n return (object.tools ?? []).map((tool) => ({\n kind: 'ai',\n name: tool.function.name,\n operation: tool.function.name,\n description: tool.function.description,\n objectName: object.qualifiedName ?? object.className,\n }));\n}\n\n/** Route facts for one custom action, as `generateRoutesForObject` emits it. */\ninterface ApiCustomRoute {\n scope: 'item' | 'collection';\n segments: string[];\n method: string;\n}\n\n/**\n * Resolve a custom (non-CRUD) action's REST route the way the generator does,\n * or `undefined` when no route is emitted for it at all.\n *\n * A custom action's path is NOT `/collection/action`: `generateRoutesForObject`\n * nests an item-scoped action under `[id]`, and an instance method defaults to\n * item scope. Reporting the collection-shaped path for every public instance\n * method would advertise endpoints that do not exist — the exact failure this\n * projection exists to avoid. Scope comes from the shared\n * `resolveCustomActionMetadata`, the same resolver the REST, CLI, MCP, and\n * WebMCP paths use, so a `routes` override cannot drift between them.\n *\n * `kebabRoutes` is a Vite-plugin option rather than manifest data, so an\n * explicit `routes[action].path` is honored but the generator's optional\n * kebab-casing of a derived segment is not visible here.\n */\nfunction apiCustomRoute(\n object: SmartObjectDefinition,\n operation: string,\n collectionClass: boolean,\n): ApiCustomRoute | undefined {\n const method = object.methods[operation];\n const apiConfig = object.decoratorConfig?.api;\n const defaultScope: 'item' | 'collection' =\n collectionClass || method?.isStatic ? 'collection' : 'item';\n const scope = resolveActionScope(operation, method, apiConfig, defaultScope);\n\n // Mirrors the generator's own skips: a collection class emits only\n // collection-scoped routes, and a model class warns and skips a\n // collection-scoped non-static method (no receiver to bind).\n if (collectionClass) {\n if (scope !== 'collection') return undefined;\n } else if (scope === 'collection' && !method?.isStatic) {\n return undefined;\n }\n\n // `@method({ path, httpMethod })` wins field by field over the legacy\n // `api.routes[operation]` entry, exactly as `resolveApiActionRouteConfig`\n // resolves it for the emitter — otherwise the artifact would report the\n // pre-migration URL for a class that has moved to the decorator (#2686).\n const effective = resolveEffectiveActionMetadata({\n actionName: operation,\n ...(method ? { method } : {}),\n apiConfig,\n });\n const overridden =\n typeof effective.path === 'string'\n ? effective.path\n .split('/')\n .map((segment) => segment.trim())\n .filter(Boolean)\n : [];\n return {\n scope,\n segments: overridden.length > 0 ? overridden : [operation],\n method: normalizeApiMethod(effective.httpMethod),\n };\n}\n\n/**\n * The shared resolver validates as it resolves — a `routes` entry declaring\n * `effect: 'read'` on a PUT/PATCH/DELETE route throws by design. This\n * projection reads untrusted scanned config and must not fail the whole\n * knowledge build for one malformed action (same defensive stance as\n * {@link includeExcludeConfig}), so fall back to the receiver the method\n * itself dictates — which a route-only override cannot change anyway.\n */\nfunction resolveActionScope(\n operation: string,\n method: SmartObjectDefinition['methods'][string] | undefined,\n apiConfig: unknown,\n defaultScope: 'item' | 'collection',\n): 'item' | 'collection' {\n try {\n return resolveCustomActionMetadata({\n actionName: operation,\n method,\n apiConfig,\n defaultScope,\n }).scope;\n } catch {\n return defaultScope;\n }\n}\n\n/** Mirrors `normalizeApiHttpMethod` in `vite-plugin/sveltekit-generator.ts`. */\nfunction normalizeApiMethod(method: unknown): string {\n const normalized =\n typeof method === 'string' ? method.toUpperCase() : undefined;\n switch (normalized) {\n case 'GET':\n case 'POST':\n case 'PUT':\n case 'PATCH':\n case 'DELETE':\n return normalized;\n default:\n return 'POST';\n }\n}\n\n/**\n * The collection segment of a generated REST route.\n *\n * `generateRoutesForObject` builds its route directory from\n * `objectDef.collection` verbatim, and the runtime dispatcher in\n * `generators/rest.ts` matches the URL segment against `info.collection`\n * verbatim, so this reports that and nothing else (#2630).\n *\n * In particular it does NOT read `api.path`, which configures a different\n * surface: `@happyvertical/smrt-agents`' own agent-facing route map derives\n * `api.path ?? tableName.replace(/_/g, '-')`. Honoring it here produced a\n * hybrid — `api.path` over `collection` — that matched neither transport and\n * named endpoints that 404 on both.\n */\nfunction apiCollectionSegment(object: SmartObjectDefinition): string {\n return object.collection;\n}\n\nfunction apiPath(\n object: SmartObjectDefinition,\n operation: string,\n route?: ApiCustomRoute,\n): string {\n const configuredPath = apiCollectionSegment(object);\n if (route) {\n const base =\n route.scope === 'collection'\n ? `/${configuredPath}`\n : `/${configuredPath}/[id]`;\n return `${base}/${route.segments.join('/')}`;\n }\n if (operation === 'list' || operation === 'create') {\n return `/${configuredPath}`;\n }\n if (STANDARD_OPERATIONS.includes(operation)) {\n return `/${configuredPath}/[id]`;\n }\n return `/${configuredPath}/${operation}`;\n}\n\nfunction apiMethod(operation: string, route?: ApiCustomRoute): string {\n if (route) return route.method;\n switch (operation) {\n case 'list':\n case 'get':\n return 'GET';\n case 'create':\n return 'POST';\n case 'update':\n return 'PATCH';\n case 'delete':\n return 'DELETE';\n default:\n return 'POST';\n }\n}\n\nfunction relationshipFeatures(\n object: SmartObjectDefinition,\n fields: DomainKnowledgeField[],\n): string[] {\n const features = new Set<string>();\n for (const field of fields) {\n if (field.type === 'foreignKey') features.add('foreignKey');\n if (field.type === 'crossPackageRef') features.add('crossPackageRef');\n if (field.type === 'oneToMany') features.add('oneToMany');\n if (field.type === 'manyToMany') features.add('manyToMany');\n }\n if (object.extends === 'SmrtJunction') features.add('SmrtJunction');\n if (object.extends === 'SmrtHierarchical') features.add('SmrtHierarchical');\n if (\n object.extends === 'SmrtPolymorphicAssociation' ||\n fields.some((field) => field.name === 'metaType') ||\n fields.some((field) => field.name === 'metaId')\n ) {\n features.add('SmrtPolymorphicAssociation');\n }\n if (\n Object.keys(object.schema?.columns ?? {}).some(\n (name) => object.schema?.columns[name]?.type === 'UUID',\n )\n ) {\n features.add('uuidColumns');\n }\n return [...features].sort();\n}\n\nfunction summarizeRelationships(\n objects: DomainKnowledgeObject[],\n manifestObjects: SmartObjectDefinition[],\n) {\n const fields = objects.flatMap((object) => object.fields);\n return {\n foreignKeyFields: fields.filter((field) => field.type === 'foreignKey')\n .length,\n crossPackageRefFields: fields.filter(\n (field) => field.type === 'crossPackageRef',\n ).length,\n junctionCollections: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtJunction'),\n ).length,\n hierarchicalObjects: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtHierarchical'),\n ).length,\n polymorphicAssociations: objects.filter((object) =>\n object.relationshipFeatures.includes('SmrtPolymorphicAssociation'),\n ).length,\n uuidColumns: manifestObjects.reduce(\n (count, object) =>\n count +\n Object.values(object.schema?.columns ?? {}).filter(\n (column) => column.type === 'UUID',\n ).length,\n 0,\n ),\n };\n}\n\n/**\n * Documented default `tags` derivation for a package's domain-knowledge\n * artifact when `@smrt({ knowledge: { tags } })` is not set (#2863).\n *\n * Never invents taxonomy: tags come only from `package.json#keywords`\n * (authored by the package owner) plus a `cross-package` tag when the\n * package declares a `@happyvertical/smrt-*` dependency. This keeps the\n * derivation deterministic and traceable to an authored source, matching\n * the \"populate tags/risks from scanner output where the manifest carries\n * the data\" scope — a package that wants richer tags still sets\n * `knowledge.tags` explicitly.\n */\nfunction deriveDefaultTags(\n packageJson: PackageJsonLike,\n allDependencies: Record<string, string>,\n): string[] {\n const tags = new Set<string>();\n const keywords = packageJson.keywords;\n if (Array.isArray(keywords)) {\n for (const keyword of keywords) {\n if (typeof keyword === 'string' && keyword.trim()) {\n tags.add(keyword.trim());\n }\n }\n }\n if (\n Object.keys(allDependencies).some((dep) =>\n dep.startsWith('@happyvertical/smrt-'),\n )\n ) {\n tags.add('cross-package');\n }\n return [...tags].sort();\n}\n\n/**\n * Documented default `risks` derivation (#2863). Each entry names a\n * structural fact the manifest already carries — never freeform prose — so\n * it stays deterministic and regenerable:\n *\n * - `sensitive-fields-excluded`: generation always strips sensitive fields\n * before projecting objects (`sensitiveFieldsExcluded` is unconditionally\n * `true`), so a reviewer relying on this artifact must not treat it as a\n * complete field inventory.\n * - `cross-package-refs:<n>`: the package reads or writes another package's\n * rows through `@crossPackageRef`; a reviewer must check that package's\n * tenancy and lifecycle guarantees too.\n * - `sti-inheritance`: at least one object shares a table via\n * `tableStrategy: 'sti'`; a schema change must consider every sibling.\n * - `polymorphic-associations:<n>`: at least one\n * `SmrtPolymorphicAssociation`, whose target type is resolved at read time\n * rather than by a foreign key constraint.\n */\nfunction deriveDefaultRisks(options: {\n sensitiveFieldsExcluded: true;\n relationshipsV2: ReturnType<typeof summarizeRelationships>;\n objects: DomainKnowledgeObject[];\n}): string[] {\n const risks = new Set<string>();\n if (options.sensitiveFieldsExcluded) {\n risks.add('sensitive-fields-excluded');\n }\n if (options.relationshipsV2.crossPackageRefFields > 0) {\n risks.add(\n `cross-package-refs:${options.relationshipsV2.crossPackageRefFields}`,\n );\n }\n if (options.objects.some((object) => object.tableStrategy === 'sti')) {\n risks.add('sti-inheritance');\n }\n if (options.relationshipsV2.polymorphicAssociations > 0) {\n risks.add(\n `polymorphic-associations:${options.relationshipsV2.polymorphicAssociations}`,\n );\n }\n return [...risks].sort();\n}\n\nfunction columnType(\n object: SmartObjectDefinition,\n fieldName: string,\n): string | undefined {\n const columnName = camelToSnake(fieldName);\n return object.schema?.columns[columnName]?.type;\n}\n\nfunction readPrompts(\n rootDir: string,\n): Array<{ filePath: string; key?: string }> {\n const srcDir = join(rootDir, 'src');\n if (!existsSync(srcDir)) return [];\n const prompts: Array<{ filePath: string; key?: string }> = [];\n for (const filePath of walkFiles(srcDir)) {\n if (!filePath.endsWith('.ts')) continue;\n const content = readFileSync(filePath, 'utf8');\n if (!content.includes('definePrompt')) continue;\n const keyMatch = content.match(/definePrompt\\s*\\(\\s*['\"`]([^'\"`]+)['\"`]/);\n prompts.push({\n filePath: relative(rootDir, filePath),\n key: keyMatch?.[1],\n });\n }\n return prompts;\n}\n\nfunction walkFiles(dir: string): string[] {\n const files: string[] = [];\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (\n entry.name === 'node_modules' ||\n entry.name === 'dist' ||\n entry.name === '.svelte-kit'\n ) {\n continue;\n }\n const fullPath = join(dir, entry.name);\n if (entry.isDirectory()) {\n files.push(...walkFiles(fullPath));\n } else if (entry.isFile()) {\n files.push(fullPath);\n }\n }\n return files;\n}\n\nfunction sourceHashes(sources: Record<string, HashSource | undefined>) {\n const hashes: Record<string, string> = {};\n for (const [name, source] of Object.entries(sources)) {\n if (!source) continue;\n const content =\n 'content' in source ? source.content : readFileSync(source.path, 'utf8');\n hashes[name] = createHash('sha256').update(content).digest('hex');\n }\n return hashes;\n}\n\ntype HashSource = { content: string } | { path: string };\n\nfunction fileHashSource(path: string | undefined): HashSource | undefined {\n return path ? { path } : undefined;\n}\n\nfunction existingPath(rootDir: string, path: string): string | undefined {\n const fullPath = join(rootDir, path);\n return existsSync(fullPath) ? fullPath : undefined;\n}\n\nfunction readPackageJson(rootDir: string): PackageJsonLike | null {\n const path = join(rootDir, 'package.json');\n if (!existsSync(path)) return null;\n return JSON.parse(readFileSync(path, 'utf8'));\n}\n\nfunction record(value: unknown): Record<string, string> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, string>)\n : {};\n}\n\nfunction exportKeys(exportsField: unknown): string[] {\n if (typeof exportsField === 'string') return ['.'];\n if (\n typeof exportsField !== 'object' ||\n exportsField === null ||\n Array.isArray(exportsField)\n ) {\n return [];\n }\n return Object.keys(exportsField).sort();\n}\n\nfunction camelToSnake(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[-\\s]+/g, '_')\n .toLowerCase();\n}\n\nfunction normalizeManifestForHash(manifest: SmartObjectManifest): unknown {\n const normalized = JSON.parse(JSON.stringify(manifest)) as Record<\n string,\n unknown\n >;\n delete normalized.timestamp;\n return normalized;\n}\n\nfunction stableJson(value: unknown): string {\n return JSON.stringify(sortJson(value), null, 2);\n}\n\nfunction sortJson(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(sortJson);\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, entry]) => [key, sortJson(entry)]),\n );\n }\n return value;\n}\n"],"mappings":";;;;;;;;;AAoFA,IAAM,oCAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,IAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAUD,IAAM,sBAAyC;;;;;;;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