@happyvertical/smrt-cli 0.60.9 → 0.60.10

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.
Files changed (47) hide show
  1. package/AGENTS.md +17 -53
  2. package/agents/db-drop-framework-base-tables.md +49 -0
  3. package/agents/db-migrate-concurrency.md +11 -0
  4. package/dist/{AuditLogCollection-BBbvr8Qc-CoDs0BaX.js → AuditLogCollection-BBbvr8Qc-DU-QXhH5.js} +1 -1
  5. package/dist/{OidcIdentity-COeMidoC-B-cVovG3.js → OidcIdentity-COeMidoC-BDr8b6iW.js} +2 -2
  6. package/dist/{OidcIdentityCollection-D4DIZv0K-CexIL7No.js → OidcIdentityCollection-D4DIZv0K-BvsaDTZY.js} +1 -1
  7. package/dist/{PasswordCredentialService-DHJNKEeJ-DQlR62e-.js → PasswordCredentialService-BSSP_kyT-DlxlWy6b.js} +40 -22
  8. package/dist/{ProfileAssetCollection-D5-tG9Mm-Bmn4-Urc.js → ProfileAssetCollection-D5-tG9Mm-Be7hQJJq.js} +3 -3
  9. package/dist/{ProfileCollection-CmRaiE9U-52qjwbhJ.js → ProfileCollection-CmRaiE9U-n8apgXIh.js} +17 -17
  10. package/dist/{ProfileLinkCollection-pvPTsysg-ocN3hj_M.js → ProfileLinkCollection-pvPTsysg-DCmnAd7m.js} +2 -2
  11. package/dist/{ProfileMetadataCollection-CAgJyjze-FX20yKjY.js → ProfileMetadataCollection-CAgJyjze-BKpcvrnf.js} +1 -1
  12. package/dist/{ProfileMetafieldCollection-19ae6Lpf-qg7eMcJk.js → ProfileMetafieldCollection-19ae6Lpf-BuTJKzmz.js} +1 -1
  13. package/dist/{ProfileRelationshipCollection-BFSlTQ7J-DlDILj3m.js → ProfileRelationshipCollection-BFSlTQ7J-DBbNdauk.js} +1 -1
  14. package/dist/{ProfileTypeCollection-BRLK8cHS-QVwjfqe8.js → ProfileTypeCollection-BRLK8cHS-COCy6yqF.js} +2 -2
  15. package/dist/commands/docs-claude.d.ts +1 -0
  16. package/dist/commands/docs-claude.d.ts.map +1 -1
  17. package/dist/commands/docs-knowledge-bundle.d.ts +87 -0
  18. package/dist/commands/docs-knowledge-bundle.d.ts.map +1 -0
  19. package/dist/{commands-DNssH5Dv.js → commands-CGfM14Uj.js} +265 -6
  20. package/dist/{dist-BJABhykg.js → dist-B00KCyNE.js} +2 -2
  21. package/dist/{dist-D25iWIXX.js → dist-BGEMcSs-.js} +5 -5
  22. package/dist/dist-D7vejSNK.js +1854 -0
  23. package/dist/dist-DEKj_L2B.js +1908 -0
  24. package/dist/index.js +11 -11
  25. package/dist/knowledge/intents/audit-trail.md +63 -0
  26. package/dist/knowledge/intents/auth-and-users.md +67 -0
  27. package/dist/knowledge/intents/background-work.md +72 -0
  28. package/dist/knowledge/intents/feature-flags-and-entitlements.md +60 -0
  29. package/dist/knowledge/intents/file-and-asset-storage.md +71 -0
  30. package/dist/knowledge/intents/human-approvals.md +56 -0
  31. package/dist/knowledge/intents/index.md +41 -0
  32. package/dist/knowledge/intents/money-and-rates.md +65 -0
  33. package/dist/knowledge/intents/outbound-messages.md +67 -0
  34. package/dist/knowledge/intents/prompts-and-ai-operations.md +72 -0
  35. package/dist/knowledge/intents/relationships-and-trees.md +56 -0
  36. package/dist/knowledge/intents/scheduled-runs.md +61 -0
  37. package/dist/knowledge/intents/search-facts-knowledge.md +68 -0
  38. package/dist/knowledge/intents/secrets-and-config.md +66 -0
  39. package/dist/knowledge/intents/tenant-scoping.md +63 -0
  40. package/dist/knowledge/intents/webhooks-and-events.md +71 -0
  41. package/dist/{oidcProvisioningPrimitives-KpIiLmG4-CnRTofeV.js → oidcProvisioningPrimitives-KpIiLmG4-Csnh1ENp.js} +3 -3
  42. package/dist/{operator-fwao3Y1j.js → operator-DCwooIiI.js} +2 -2
  43. package/dist/{resolveIdentity-j2WFuKDT-C9XtigVZ.js → resolveIdentity-j2WFuKDT-DZTwcb-u.js} +14 -14
  44. package/dist/smrt-knowledge.okf.md +57 -0
  45. package/package.json +15 -15
  46. package/dist/dist-B3gpMpBj.js +0 -1908
  47. package/dist/dist-BQI8s_yA.js +0 -1854
@@ -5,7 +5,7 @@ import { t as DEFAULT_CLI_CONFIG } from "./config-CdJRSMRi.js";
5
5
  import { addMcpAppsRuntime, assertMcpAppsPluginName, configureMcpAppsConsumerRegistry, mcpAppsCommands, scaffoldMcpAppsPackage, validateMcpAppsPackage } from "./mcp-apps-packaging-CixRnxz_.js";
6
6
  import { createRequire } from "node:module";
7
7
  import * as fs from "node:fs";
8
- import { constants, createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
8
+ import { constants, createReadStream, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
9
9
  import * as path from "node:path";
10
10
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
11
11
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -21,6 +21,7 @@ import { glob } from "tinyglobby";
21
21
  import { getPackageConfig, loadConfig, toAIClientOptions, tryResolveConfiguredAIProvider } from "@happyvertical/smrt-config";
22
22
  import { toSnakeCase as toSnakeCase$1 } from "@happyvertical/smrt-core/utils";
23
23
  import { checkKnowledgeGraphFreshness, discoverScopedPackageDirectories, readAgentModuleDocs, readPackageAgentDoc, resolveAgentModuleDocPaths } from "@happyvertical/smrt-core/knowledge";
24
+ import { OKF_BUNDLE_DIR_NAME, OKF_BUNDLE_FORMAT, OKF_BUNDLE_MANIFEST, OKF_SHIPPED_COMPONENT_PAGE, OKF_SHIPPED_INTENTS_DIR, buildArchitectureContext, buildKnowledgeIndex, buildReviewContext, checkKnowledgeFreshness, compactContextResult, diffKnowledgeIndex, readOkfBundleManifest, renderFreshnessResult, renderKnowledgeIndexMarkdown, stampPackageVersion } from "@happyvertical/smrt-dev-mcp/knowledge";
24
25
  import { MCPGenerator } from "@happyvertical/smrt-core/generators";
25
26
  import { generateDeclarationsFromCLI } from "@happyvertical/smrt-core/prebuild";
26
27
  import https from "node:https";
@@ -28,7 +29,6 @@ import { createServer } from "node:http";
28
29
  import { importWorkspaceModule } from "@happyvertical/smrt-core/utils/import-workspace-module";
29
30
  import { renderForeignKeyAddStatements } from "@happyvertical/smrt-core/schema";
30
31
  import { FRAMEWORK_BASE_TABLE_NAMES, SYSTEM_TABLE_TENANT_UUID_COLUMNS, backfillLegacyQualifiedNames, buildIntegerWidthTableStatements, collectIntegerWidthTargets, collectNullEqualIndexTargets, countLegacyQualifiedNameReferences, dropFrameworkBaseTables, ensurePostgresChangeFeedAppendFunction, migrateNullEqualIndexes, nullEqualIndexStatements, parsePostgresTimeoutMs, planFrameworkBaseTableDrop, preflightIntegerWidthWidening, preflightNullEqualIndexes, widenIntegerColumnsToBigInt } from "@happyvertical/smrt-core/migrations";
31
- import { buildArchitectureContext, buildKnowledgeIndex, buildReviewContext, checkKnowledgeFreshness, compactContextResult, diffKnowledgeIndex, renderFreshnessResult, renderKnowledgeIndexMarkdown } from "@happyvertical/smrt-dev-mcp/knowledge";
32
32
  import { RUNTIME_TOOLS } from "@happyvertical/smrt-dev-mcp/runtime";
33
33
  //#region src/commands/config-export.ts
34
34
  /**
@@ -4201,6 +4201,241 @@ var dispatchCommands = {
4201
4201
  }
4202
4202
  };
4203
4203
  //#endregion
4204
+ //#region src/commands/docs-knowledge-bundle.ts
4205
+ /**
4206
+ * Knowledge-bundle half of `smrt docs:agents` (#4689).
4207
+ *
4208
+ * Renders the "Find it by intent" section of `.agents/smrt-framework.md` from
4209
+ * the OKF intent index and exports the OKF pages for the installed packages
4210
+ * into `<output dir>/smrt-knowledge/`. The on-disk contract (layout,
4211
+ * `bundle.json`, version stamping) lives in `@happyvertical/smrt-dev-mcp/knowledge`
4212
+ * (`okf-bundle.ts`) so the freshness gate reads exactly what this writes.
4213
+ *
4214
+ * Where the pages come from — never the monorepo checkout in a consumer:
4215
+ * - component page: `<package>/dist/smrt-knowledge.okf.md`, shipped by every
4216
+ * published package; inside the monorepo the committed
4217
+ * `docs/knowledge/components/<name>.md` is the fallback.
4218
+ * - intent pages: `dist/knowledge/intents/` of the installed `smrt-cli` (or
4219
+ * of the running CLI when it is not a project dependency); inside the
4220
+ * monorepo the committed `docs/knowledge/intents/`.
4221
+ */
4222
+ var ROW = /^\| (.+?) \| \[[^\]]+\]\(\/intents\/([a-z0-9-]+)\.md\) \| (.+?) \| (.+?) \| .* \|$/;
4223
+ /** Strict npm package name: optional lowercase scope, no path segments. */
4224
+ var PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
4225
+ function isValidPackageName(name) {
4226
+ return typeof name === "string" && PACKAGE_NAME.test(name);
4227
+ }
4228
+ /**
4229
+ * `target` resolved under `root`, or a thrown error when it escapes (`..`,
4230
+ * absolute segments). Every bundle write and delete goes through this.
4231
+ */
4232
+ function containedPath(root, target) {
4233
+ const base = resolve(root);
4234
+ const full = resolve(base, target);
4235
+ if (full !== base && !full.startsWith(base + sep)) throw new Error(`Refusing to write outside ${base}: ${target}`);
4236
+ return full;
4237
+ }
4238
+ /**
4239
+ * Throws when `path` exists as a symlink. `containedPath` is lexical, so a
4240
+ * checkout that ships `.agents/smrt-knowledge` as a link would otherwise have
4241
+ * the bundle's wholesale directory replacement land wherever the link points.
4242
+ */
4243
+ function assertNotSymlink(path) {
4244
+ let link = false;
4245
+ try {
4246
+ link = lstatSync(path).isSymbolicLink();
4247
+ } catch {
4248
+ return;
4249
+ }
4250
+ if (link) throw new Error(`Refusing to write through a symlink: ${path}`);
4251
+ }
4252
+ /**
4253
+ * Whether a package may supply bundle file names: a plain npm name that equals
4254
+ * the identity its directory was discovered under (a mismatching name could
4255
+ * claim another package's page or point the target elsewhere).
4256
+ */
4257
+ function isBundleSafePackage(pkg) {
4258
+ if (isValidPackageName(pkg.name) && !(pkg.specifier && pkg.name !== pkg.specifier)) return true;
4259
+ console.warn(` ⚠️ Skipping ${JSON.stringify(pkg.name)} in the knowledge bundle: invalid package name or it does not match its directory`);
4260
+ return false;
4261
+ }
4262
+ function unscopedName(name) {
4263
+ return name.replace(/^@[^/]+\//, "");
4264
+ }
4265
+ /** Parses the intent index table; the rows are the only structure relied on. */
4266
+ function parseIntentIndex(markdown) {
4267
+ const rows = [];
4268
+ for (const line of markdown.split(/\r?\n/)) {
4269
+ const match = ROW.exec(line);
4270
+ if (!match) continue;
4271
+ const homes = [...match[3].matchAll(/\(\/components\/([^)]+)\.md\)/g)].map((home) => home[1]);
4272
+ rows.push({
4273
+ intent: match[1],
4274
+ slug: match[2],
4275
+ homes,
4276
+ entryPoint: match[4],
4277
+ raw: line
4278
+ });
4279
+ }
4280
+ return rows;
4281
+ }
4282
+ /** Intents with at least one installed home package, in index order. */
4283
+ function filterInstalledIntents(rows, installed) {
4284
+ return rows.filter((row) => row.homes.some((home) => installed.has(home)));
4285
+ }
4286
+ /** The intent index with rows for intents without an installed home removed. */
4287
+ function filterIntentIndexMarkdown(markdown, keptSlugs) {
4288
+ return markdown.split("\n").filter((line) => {
4289
+ const match = ROW.exec(line.replace(/\r$/, ""));
4290
+ return !match || keptSlugs.has(match[2]);
4291
+ }).join("\n");
4292
+ }
4293
+ /**
4294
+ * The leading "Find it by intent" section, or [] when no intent has an
4295
+ * installed home. `pagesDir` is the bundle directory relative to the file the
4296
+ * section is written into.
4297
+ */
4298
+ function renderIntentSection(rows, installed, pagesDir = OKF_BUNDLE_DIR_NAME) {
4299
+ const kept = filterInstalledIntents(rows, installed);
4300
+ if (kept.length === 0) return [];
4301
+ const lines = [
4302
+ "## Find it by intent",
4303
+ "",
4304
+ `Before hand-rolling infrastructure, check whether an installed SMRT package already provides it. Each page names the entry point and the reason not to roll your own; they live in \`${pagesDir}/\` next to this file, where a concept ID such as \`/intents/background-work.md\` resolves against that directory. Only intents with an installed home package are listed.`,
4305
+ "",
4306
+ "| Intent | Reach for | Installed package(s) | Page |",
4307
+ "| --- | --- | --- | --- |"
4308
+ ];
4309
+ for (const row of kept) {
4310
+ const homes = row.homes.filter((home) => installed.has(home)).map((home) => `${home}@${installed.get(home)}`).join(", ");
4311
+ lines.push(`| ${row.intent} | ${row.entryPoint} | ${homes} | [${row.slug}](${pagesDir}/intents/${row.slug}.md) |`);
4312
+ }
4313
+ lines.push("");
4314
+ return lines;
4315
+ }
4316
+ function findOwnPackageRoot() {
4317
+ let current = dirname(fileURLToPath(import.meta.url));
4318
+ for (;;) {
4319
+ const manifest = join(current, "package.json");
4320
+ if (existsSync(manifest)) try {
4321
+ if (JSON.parse(readFileSync(manifest, "utf8")).name === "@happyvertical/smrt-cli") return current;
4322
+ } catch {}
4323
+ const parent = dirname(current);
4324
+ if (parent === current) return null;
4325
+ current = parent;
4326
+ }
4327
+ }
4328
+ function packageVersion(dir) {
4329
+ try {
4330
+ return JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).version;
4331
+ } catch {
4332
+ return;
4333
+ }
4334
+ }
4335
+ /** Finds the intent pages; null when none are reachable (the section is then omitted). */
4336
+ function resolveIntentSource(options) {
4337
+ const candidates = [];
4338
+ if (options.monorepoRoot) candidates.push({ dir: join(options.monorepoRoot, "docs", "knowledge", "intents") });
4339
+ for (const root of [options.installedCliDirectory, findOwnPackageRoot()]) {
4340
+ if (!root) continue;
4341
+ candidates.push({
4342
+ dir: join(root, "dist", OKF_SHIPPED_INTENTS_DIR),
4343
+ version: packageVersion(root)
4344
+ });
4345
+ }
4346
+ return candidates.find((candidate) => existsSync(join(candidate.dir, "index.md"))) ?? null;
4347
+ }
4348
+ function loadIntentRows(source) {
4349
+ return parseIntentIndex(readFileSync(join(source.dir, "index.md"), "utf8"));
4350
+ }
4351
+ function componentPageSource(pkg, monorepoRoot) {
4352
+ const candidates = [];
4353
+ if (pkg.directory) candidates.push(join(pkg.directory, "dist", OKF_SHIPPED_COMPONENT_PAGE));
4354
+ if (monorepoRoot) candidates.push(join(monorepoRoot, "docs", "knowledge", "components", `${unscopedName(pkg.name)}.md`));
4355
+ return candidates.find((path) => existsSync(path)) ?? null;
4356
+ }
4357
+ /**
4358
+ * Writes `<bundleDir>/{components,intents}/` and `bundle.json`. The two page
4359
+ * directories are replaced wholesale so uninstalled packages and retired
4360
+ * intents never linger; nothing else under `bundleDir` is touched. Returns null
4361
+ * (writing nothing) when no page is reachable.
4362
+ */
4363
+ function exportKnowledgeBundle(options) {
4364
+ const safePackages = options.packages.filter(isBundleSafePackage);
4365
+ const installed = new Map(safePackages.map((pkg) => [unscopedName(pkg.name), pkg.version]));
4366
+ const pages = /* @__PURE__ */ new Map();
4367
+ const manifestPackages = [];
4368
+ const withoutPages = [];
4369
+ for (const pkg of [...safePackages].sort((a, b) => a.name.localeCompare(b.name))) {
4370
+ const source = componentPageSource(pkg, options.monorepoRoot);
4371
+ if (!source) {
4372
+ withoutPages.push(pkg.name);
4373
+ continue;
4374
+ }
4375
+ const concept = `/components/${unscopedName(pkg.name)}.md`;
4376
+ pages.set(concept, stampPackageVersion(readFileSync(source, "utf8"), pkg.version));
4377
+ manifestPackages.push({
4378
+ name: pkg.name,
4379
+ version: pkg.version,
4380
+ concept
4381
+ });
4382
+ }
4383
+ const intentSlugs = [];
4384
+ if (options.intentSource) {
4385
+ const kept = filterInstalledIntents(options.intentRows, installed);
4386
+ const keptSlugs = new Set(kept.map((row) => row.slug));
4387
+ const stamp = (text) => options.intentSource?.version ? stampPackageVersion(text, options.intentSource.version) : text;
4388
+ for (const row of kept) {
4389
+ const path = join(options.intentSource.dir, `${row.slug}.md`);
4390
+ if (!existsSync(path)) continue;
4391
+ pages.set(`/intents/${row.slug}.md`, stamp(readFileSync(path, "utf8")));
4392
+ intentSlugs.push(row.slug);
4393
+ }
4394
+ if (intentSlugs.length > 0) pages.set("/intents/index.md", stamp(filterIntentIndexMarkdown(readFileSync(join(options.intentSource.dir, "index.md"), "utf8"), keptSlugs)));
4395
+ }
4396
+ if (pages.size === 0) return null;
4397
+ const hash = createHash("sha256");
4398
+ for (const concept of [...pages.keys()].sort()) hash.update(`${concept}\0${pages.get(concept)}\0`);
4399
+ const contentHash = `sha256:${hash.digest("hex")}`;
4400
+ let previous = null;
4401
+ try {
4402
+ previous = readOkfBundleManifest(options.bundleDir);
4403
+ } catch {}
4404
+ const exportedAt = previous?.contentHash === contentHash ? previous.exportedAt : (options.now ?? /* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
4405
+ const writes = [...pages].map(([concept, text]) => [containedPath(options.bundleDir, concept.replace(/^\/+/, "")), text]);
4406
+ const manifestPath = containedPath(options.bundleDir, OKF_BUNDLE_MANIFEST);
4407
+ const pageDirs = ["components", "intents"].map((dir) => containedPath(options.bundleDir, dir));
4408
+ for (const path of [
4409
+ resolve(options.bundleDir),
4410
+ ...pageDirs,
4411
+ manifestPath
4412
+ ]) assertNotSymlink(path);
4413
+ for (const dir of pageDirs) rmSync(dir, {
4414
+ recursive: true,
4415
+ force: true
4416
+ });
4417
+ for (const [target, text] of writes) {
4418
+ mkdirSync(dirname(target), { recursive: true });
4419
+ writeFileSync(target, text, "utf8");
4420
+ }
4421
+ const manifest = {
4422
+ format: OKF_BUNDLE_FORMAT,
4423
+ exportedBy: options.exportedBy,
4424
+ exportedAt,
4425
+ contentHash,
4426
+ packages: manifestPackages,
4427
+ intents: intentSlugs
4428
+ };
4429
+ writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
4430
+ return {
4431
+ bundleDir: options.bundleDir,
4432
+ components: manifestPackages.length,
4433
+ intents: intentSlugs.length,
4434
+ withoutPages,
4435
+ exportedAt
4436
+ };
4437
+ }
4438
+ //#endregion
4204
4439
  //#region src/commands/docs-claude.ts
4205
4440
  /**
4206
4441
  * docs:agents / docs:claude commands
@@ -4248,7 +4483,18 @@ function createDocsCommand(config) {
4248
4483
  console.log(" Make sure packages are installed before running this command.\n");
4249
4484
  process.exit(1);
4250
4485
  }
4251
- const content = generateMarkdown(packages, rootDocs.length > 0 ? rootDocs : void 0, sdkPackages.length > 0 ? sdkPackages : void 0, config.generatedBy, { complete: options.complete });
4486
+ const bundlePackages = packages.filter(isBundleSafePackage);
4487
+ const installedVersions = new Map(bundlePackages.map((pkg) => [unscopedName(pkg.name), pkg.version]));
4488
+ const intentSource = resolveIntentSource({
4489
+ monorepoRoot,
4490
+ installedCliDirectory: installedDirectories.find((entry) => entry.name === "smrt-cli")?.realDirectory
4491
+ });
4492
+ const intentRows = intentSource ? loadIntentRows(intentSource) : [];
4493
+ const bundleDirName = "smrt-knowledge";
4494
+ const content = generateMarkdown(packages, rootDocs.length > 0 ? rootDocs : void 0, sdkPackages.length > 0 ? sdkPackages : void 0, config.generatedBy, {
4495
+ complete: options.complete,
4496
+ intentSection: renderIntentSection(intentRows, installedVersions, bundleDirName)
4497
+ });
4252
4498
  if (dryRun) {
4253
4499
  console.log(content);
4254
4500
  return;
@@ -4256,6 +4502,14 @@ function createDocsCommand(config) {
4256
4502
  const outputDir = dirname(outputPath);
4257
4503
  if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true });
4258
4504
  writeFileSync(outputPath, content, "utf-8");
4505
+ const bundle = exportKnowledgeBundle({
4506
+ bundleDir: join(outputDir, bundleDirName),
4507
+ packages: bundlePackages,
4508
+ monorepoRoot,
4509
+ intentSource,
4510
+ intentRows,
4511
+ exportedBy: config.generatedBy
4512
+ });
4259
4513
  let graphExported = false;
4260
4514
  if (monorepoRoot) {
4261
4515
  const graphPath = join(monorepoRoot, ".smrt", "smrt-knowledge-graph.json");
@@ -4282,6 +4536,10 @@ function createDocsCommand(config) {
4282
4536
  if (moduleDocCount > 0) console.log(` ${moduleDocCount} linked module docs`);
4283
4537
  if (rootDocs.length > 0) console.log(` ${rootDocs.length} framework documents included`);
4284
4538
  if (graphExported) console.log(" cross-package knowledge graph exported");
4539
+ if (bundle) {
4540
+ console.log(` knowledge bundle exported to ${bundle.bundleDir} (${bundle.components} component pages, ${bundle.intents} intent pages)`);
4541
+ if (bundle.withoutPages.length > 0) console.log(` ${bundle.withoutPages.length} installed packages ship no knowledge page`);
4542
+ }
4285
4543
  console.log("");
4286
4544
  } catch (error) {
4287
4545
  console.error("\n❌ Failed to generate agent documentation:");
@@ -4452,6 +4710,7 @@ function generateMarkdown(packages, rootDocs, sdkPackages, generatedBy = "smrt d
4452
4710
  lines.push("");
4453
4711
  lines.push("This project uses the SMRT framework. Below are the conventions and patterns for the installed packages.");
4454
4712
  lines.push("");
4713
+ if (options.intentSection && options.intentSection.length > 0) lines.push(...options.intentSection);
4455
4714
  if (rootDocs && rootDocs.length > 0) {
4456
4715
  lines.push("## Framework Documentation");
4457
4716
  lines.push("");
@@ -8425,7 +8684,7 @@ var dbMaterializeTenantHierarchyCommand = {
8425
8684
  if (!config.database?.url || config.database.url === ":memory:") throw new Error("Database configuration required for db:materialize-tenant-hierarchy. Configure database.url in smrt.config.ts (or DATABASE_URL).");
8426
8685
  const dbType = config.database.type || "sqlite";
8427
8686
  const { getDatabase } = await import("@happyvertical/sql");
8428
- const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-BQI8s_yA.js");
8687
+ const { materializeTenantHierarchy, TenantHierarchyMaterializationError } = await import("./dist-D7vejSNK.js");
8429
8688
  db = await getDatabase({
8430
8689
  type: dbType,
8431
8690
  url: config.database.url
@@ -8634,7 +8893,7 @@ var dbMigrateLedgerAccountsCommand = {
8634
8893
  if (dbType !== "postgres") throw new Error("db:migrate-ledger-accounts currently supports PostgreSQL only; no changes were made. See the smrt-ledgers README for SQLite.");
8635
8894
  await autoDiscoverAndLoad();
8636
8895
  const { getDatabase } = await import("@happyvertical/sql");
8637
- const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-D25iWIXX.js");
8896
+ const { migrateLedgerAccountsTable, planLedgerAccountsTableMove } = await import("./dist-BGEMcSs-.js");
8638
8897
  db = await getDatabase({
8639
8898
  type: dbType,
8640
8899
  url: config.database.url
@@ -10860,7 +11119,7 @@ var usersProvisionOwnerCommand = {
10860
11119
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
10861
11120
  if (config.database?.type !== "postgres" || !config.database.url) throw new Error(FAILURE);
10862
11121
  const { getDatabase } = await import("@happyvertical/sql");
10863
- const { provisionPasswordOwner } = await import("./operator-fwao3Y1j.js");
11122
+ const { provisionPasswordOwner } = await import("./operator-DCwooIiI.js");
10864
11123
  db = await getDatabase({
10865
11124
  type: "postgres",
10866
11125
  url: config.database.url
@@ -283,7 +283,7 @@ async function runTenantHierarchyReadScope(scope, callback) {
283
283
  createLogger({ level: "info" });
284
284
  //#endregion
285
285
  //#region ../tenancy/dist/index.js
286
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tenancy","packageVersion":"0.60.9","objects":{"@happyvertical/smrt-tenancy:BillingRelationship":{"name":"billingrelationship","className":"BillingRelationship","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationship","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{"childTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"resellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingOwnerMode":{"type":"text","required":false,"default":"self","enum":["self","reseller"]}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","conflictColumns":["child_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingRelationship","collectionExportName":"BillingRelationshipCollection","validationRules":[{"field":"childTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"resellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"},"@happyvertical/smrt-tenancy:BillingRelationshipCollection":{"name":"billingrelationshipcollection","className":"BillingRelationshipCollection","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationshipCollection","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingRelationship","exportName":"BillingRelationshipCollection","collectionExportName":"BillingRelationshipCollectionCollection","collectionOf":"@happyvertical/smrt-tenancy:BillingRelationship","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"4d7f410a"},"importPath":"@happyvertical/smrt-tenancy"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core"],"browser":{"status":"server-only","issues":["#3624"],"reason":"node:async_hooks"},"stampsConstructors":true}`));
286
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-tenancy","packageVersion":"0.60.10","objects":{"@happyvertical/smrt-tenancy:BillingRelationship":{"name":"billingrelationship","className":"BillingRelationship","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationship","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{"childTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"resellerTenantId":{"type":"crossPackageRef","required":true,"related":"@happyvertical/smrt-users:Tenant","_meta":{"required":true}},"billingOwnerMode":{"type":"text","required":false,"default":"self","enum":["self","reseller"]}},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","conflictColumns":["child_tenant_id"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"BillingRelationship","collectionExportName":"BillingRelationshipCollection","validationRules":[{"field":"childTenantId","rule":"required","fieldType":"crossPackageRef"},{"field":"resellerTenantId","rule":"required","fieldType":"crossPackageRef"}],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"549503f6"},"importPath":"@happyvertical/smrt-tenancy"},"@happyvertical/smrt-tenancy:BillingRelationshipCollection":{"name":"billingrelationshipcollection","className":"BillingRelationshipCollection","qualifiedName":"@happyvertical/smrt-tenancy:BillingRelationshipCollection","collection":"billingrelationships","filePath":"/home/runner/work/smrt/smrt/packages/tenancy/src/billing-relationship.ts","packageName":"@happyvertical/smrt-tenancy","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_billing_relationships","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"BillingRelationship","exportName":"BillingRelationshipCollection","collectionExportName":"BillingRelationshipCollectionCollection","collectionOf":"@happyvertical/smrt-tenancy:BillingRelationship","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_billing_relationships","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_billing_relationships\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"child_tenant_id\\" UUID NOT NULL,\\n \\"reseller_tenant_id\\" UUID NOT NULL,\\n \\"billing_owner_mode\\" TEXT DEFAULT 'self'\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"child_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"reseller_tenant_id":{"type":"UUID","referenceKind":"crossPackageRef","notNull":true,"unique":false},"billing_owner_mode":{"type":"TEXT","notNull":false,"unique":false,"default":"self"}},"indexes":[{"name":"_smrt_billing_relationships_child_tenant_id_idx","columns":["child_tenant_id"],"unique":true},{"name":"_smrt_billing_relationships_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_billing_relationships_created_at_idx","columns":["created_at"]},{"name":"_smrt_billing_relationships_reseller_tenant_id_idx","columns":["reseller_tenant_id"]}],"version":"549503f6"},"importPath":"@happyvertical/smrt-tenancy"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core"],"browser":{"status":"server-only","issues":["#3624"],"reason":"node:async_hooks"},"stampsConstructors":true}`));
287
287
  var __defProp$2 = Object.defineProperty;
288
288
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
289
289
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
@@ -398,7 +398,7 @@ var __exportAll = (all, no_symbols) => {
398
398
  if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
399
399
  return target;
400
400
  };
401
- ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-prompts","packageVersion":"0.60.9","objects":{"@happyvertical/smrt-prompts:PromptOverrideCollection":{"name":"promptoverridecollection","className":"PromptOverrideCollection","qualifiedName":"@happyvertical/smrt-prompts:PromptOverrideCollection","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/collections/PromptOverrideCollection.ts","packageName":"@happyvertical/smrt-prompts","fields":{},"methods":{"getAppOverride":{"name":"getAppOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getTenantOverride":{"name":"getTenantOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getResolutionLayers":{"name":"getResolutionLayers","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"getOverrideMapForKeys":{"name":"getOverrideMapForKeys","async":true,"parameters":[{"name":"keys","type":"string[]","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<Map<string, PromptOverride>>","isStatic":false,"isPublic":true},"findByScope":{"name":"findByScope","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"setTemplateOverride":{"name":"setTemplateOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false},{"name":"template","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<PromptOverride>","isStatic":false,"isPublic":true},"removeOverride":{"name":"removeOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PromptOverride","exportName":"PromptOverrideCollection","collectionExportName":"PromptOverrideCollectionCollection","collectionOf":"@happyvertical/smrt-prompts:PromptOverride","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"},"@happyvertical/smrt-prompts:PromptOverride":{"name":"promptoverride","className":"PromptOverride","qualifiedName":"@happyvertical/smrt-prompts:PromptOverride","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/models/PromptOverride.ts","packageName":"@happyvertical/smrt-prompts","fields":{"key":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true}},"template":{"type":"text","required":false,"_meta":{"nullable":true}},"profile":{"type":"text","required":false,"_meta":{"nullable":true}},"model":{"type":"text","required":false,"_meta":{"nullable":true}},"params":{"type":"text","required":false,"_meta":{"nullable":true}}},"methods":{"getParams":{"name":"getParams","async":false,"parameters":[],"returnType":"PromptParams","isStatic":false,"isPublic":true},"setParams":{"name":"setParams","async":false,"parameters":[{"name":"params","type":"PromptParams | null","optional":false,"unionBranches":[{"type":"PromptParams"},{"type":"null"}]}],"returnType":"void","isStatic":false,"isPublic":true},"toPromptLayer":{"name":"toPromptLayer","async":false,"parameters":[],"returnType":"PromptLayer","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","conflictColumns":["key","context"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"PromptOverride","collectionExportName":"PromptOverrideCollection","validationRules":[{"field":"key","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"38f505e7"},"importPath":"@happyvertical/smrt-prompts"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
401
+ ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-prompts","packageVersion":"0.60.10","objects":{"@happyvertical/smrt-prompts:PromptOverrideCollection":{"name":"promptoverridecollection","className":"PromptOverrideCollection","qualifiedName":"@happyvertical/smrt-prompts:PromptOverrideCollection","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/collections/PromptOverrideCollection.ts","packageName":"@happyvertical/smrt-prompts","fields":{},"methods":{"getAppOverride":{"name":"getAppOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getTenantOverride":{"name":"getTenantOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string","optional":false},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"getResolutionLayers":{"name":"getResolutionLayers","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"tenantId","type":"string | null","optional":true,"unionBranches":[{"type":"string"},{"type":"null"}]},{"name":"options","type":"object","optional":true,"memberTypes":["string"]}],"returnType":"Promise<object>","isStatic":false,"isPublic":true},"getOverrideMapForKeys":{"name":"getOverrideMapForKeys","async":true,"parameters":[{"name":"keys","type":"string[]","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<Map<string, PromptOverride>>","isStatic":false,"isPublic":true},"findByScope":{"name":"findByScope","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<PromptOverride | null>","isStatic":false,"isPublic":true},"setTemplateOverride":{"name":"setTemplateOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false},{"name":"template","type":"string | null","optional":false,"unionBranches":[{"type":"string"},{"type":"null"}]}],"returnType":"Promise<PromptOverride>","isStatic":false,"isPublic":true},"removeOverride":{"name":"removeOverride","async":true,"parameters":[{"name":"key","type":"string","optional":false},{"name":"scopeType","type":"PromptOverrideScopeType","optional":false},{"name":"scopeId","type":"string","optional":false}],"returnType":"Promise<boolean>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"PromptOverride","exportName":"PromptOverrideCollection","collectionExportName":"PromptOverrideCollectionCollection","collectionOf":"@happyvertical/smrt-prompts:PromptOverride","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"3fcceb69"},"importPath":"@happyvertical/smrt-prompts"},"@happyvertical/smrt-prompts:PromptOverride":{"name":"promptoverride","className":"PromptOverride","qualifiedName":"@happyvertical/smrt-prompts:PromptOverride","collection":"promptoverrides","filePath":"/home/runner/work/smrt/smrt/packages/prompts/src/models/PromptOverride.ts","packageName":"@happyvertical/smrt-prompts","fields":{"key":{"type":"text","required":true,"default":"","_meta":{"required":true}},"tenantId":{"type":"text","required":false,"_meta":{"sqlType":"UUID","nullable":true}},"template":{"type":"text","required":false,"_meta":{"nullable":true}},"profile":{"type":"text","required":false,"_meta":{"nullable":true}},"model":{"type":"text","required":false,"_meta":{"nullable":true}},"params":{"type":"text","required":false,"_meta":{"nullable":true}}},"methods":{"getParams":{"name":"getParams","async":false,"parameters":[],"returnType":"PromptParams","isStatic":false,"isPublic":true},"setParams":{"name":"setParams","async":false,"parameters":[{"name":"params","type":"PromptParams | null","optional":false,"unionBranches":[{"type":"PromptParams"},{"type":"null"}]}],"returnType":"void","isStatic":false,"isPublic":true},"toPromptLayer":{"name":"toPromptLayer","async":false,"parameters":[],"returnType":"PromptLayer","isStatic":false,"isPublic":true},"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true},"delete":{"name":"delete","async":true,"parameters":[],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_prompt_overrides","conflictColumns":["key","context"],"api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"PromptOverride","collectionExportName":"PromptOverrideCollection","validationRules":[{"field":"key","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_prompt_overrides","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_prompt_overrides\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"key\\" TEXT NOT NULL DEFAULT '',\\n \\"tenant_id\\" UUID,\\n \\"template\\" TEXT,\\n \\"profile\\" TEXT,\\n \\"model\\" TEXT,\\n \\"params\\" TEXT\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"key":{"type":"TEXT","notNull":true,"unique":false,"default":""},"tenant_id":{"type":"UUID","notNull":false,"unique":false},"template":{"type":"TEXT","notNull":false,"unique":false},"profile":{"type":"TEXT","notNull":false,"unique":false},"model":{"type":"TEXT","notNull":false,"unique":false},"params":{"type":"TEXT","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_prompt_overrides_key_context_idx","columns":["key","context"],"unique":true},{"name":"_smrt_prompt_overrides_slug_context_idx","columns":["slug","context"]},{"name":"_smrt_prompt_overrides_created_at_idx","columns":["created_at"]}],"version":"3fcceb69"},"importPath":"@happyvertical/smrt-prompts"}},"moduleType":"smrt","smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3624"],"via":["@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
402
402
  var PROMPT_CACHE_TTL_MS = 3e4;
403
403
  var promptCache = /* @__PURE__ */ new Map();
404
404
  var cacheGenerations = /* @__PURE__ */ new Map();