@happyvertical/smrt-profiles 0.62.3 → 0.62.5

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 (34) hide show
  1. package/dist/agent-profile.d.ts +2 -2
  2. package/dist/agent-profile.d.ts.map +1 -1
  3. package/dist/agent-type-guard.d.ts +30 -0
  4. package/dist/agent-type-guard.d.ts.map +1 -0
  5. package/dist/chunks/{OidcIdentity-uX-K-vHR.js → OidcIdentity-B06GwRj2.js} +3 -3
  6. package/dist/chunks/{OidcIdentity-uX-K-vHR.js.map → OidcIdentity-B06GwRj2.js.map} +1 -1
  7. package/dist/chunks/{OidcIdentityCollection-CwgUAk_O.js → OidcIdentityCollection-lHtQmTFB.js} +2 -2
  8. package/dist/chunks/{OidcIdentityCollection-CwgUAk_O.js.map → OidcIdentityCollection-lHtQmTFB.js.map} +1 -1
  9. package/dist/chunks/{ProfileAssetCollection-CkzuPlWl.js → ProfileAssetCollection-CijIwtKj.js} +2 -2
  10. package/dist/chunks/{ProfileAssetCollection-CkzuPlWl.js.map → ProfileAssetCollection-CijIwtKj.js.map} +1 -1
  11. package/dist/chunks/{ProfileCollection-5Ams2c-J.js → ProfileCollection-CSFLzcXp.js} +84 -8
  12. package/dist/chunks/ProfileCollection-CSFLzcXp.js.map +1 -0
  13. package/dist/chunks/{ProfileLinkCollection-Cl9rY_U_.js → ProfileLinkCollection-BHgVmkly.js} +2 -2
  14. package/dist/chunks/{ProfileLinkCollection-Cl9rY_U_.js.map → ProfileLinkCollection-BHgVmkly.js.map} +1 -1
  15. package/dist/chunks/{ProfileTypeCollection-2fjo--pR.js → ProfileTypeCollection-BYSvknkE.js} +2 -2
  16. package/dist/chunks/{ProfileTypeCollection-2fjo--pR.js.map → ProfileTypeCollection-BYSvknkE.js.map} +1 -1
  17. package/dist/chunks/{oidcProvisioningPrimitives-ChynZ3aX.js → oidcProvisioningPrimitives-ClLJDotp.js} +4 -4
  18. package/dist/chunks/{oidcProvisioningPrimitives-ChynZ3aX.js.map → oidcProvisioningPrimitives-ClLJDotp.js.map} +1 -1
  19. package/dist/chunks/{resolveIdentity-Bsjd2yDj.js → resolveIdentity-CBP8wpBI.js} +14 -14
  20. package/dist/chunks/{resolveIdentity-Bsjd2yDj.js.map → resolveIdentity-CBP8wpBI.js.map} +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +23 -22
  24. package/dist/index.js.map +1 -1
  25. package/dist/internal/oidc-provisioning.js +2 -2
  26. package/dist/manifest.json +16 -1
  27. package/dist/models/Profile.d.ts +6 -0
  28. package/dist/models/Profile.d.ts.map +1 -1
  29. package/dist/models/ProfileType.d.ts +5 -0
  30. package/dist/models/ProfileType.d.ts.map +1 -1
  31. package/dist/smrt-knowledge.json +20 -4
  32. package/dist/utils.js +1 -1
  33. package/package.json +6 -6
  34. package/dist/chunks/ProfileCollection-5Ams2c-J.js.map +0 -1
@@ -22,6 +22,7 @@
22
22
  *
23
23
  * @module
24
24
  */
25
+ import { AGENT_PROFILE_TYPE_SLUG } from "./agent-type-guard.js";
25
26
  import type { ProfileCollection } from "./collections/ProfileCollection.js";
26
27
  import type { Profile } from "./models/Profile.js";
27
28
  /**
@@ -32,8 +33,7 @@ import type { Profile } from "./models/Profile.js";
32
33
  * competing with person/organization slugs.
33
34
  */
34
35
  export declare const AGENT_PROFILE_CONTEXT = "smrt:agent";
35
- /** Slug of the {@link ProfileType} agent profiles are classified under. */
36
- export declare const AGENT_PROFILE_TYPE_SLUG = "bot";
36
+ export { AGENT_PROFILE_TYPE_SLUG };
37
37
  /** Inputs for {@link resolveAgentProfile}. */
38
38
  export interface ResolveAgentProfileParams {
39
39
  /** Stable agent identifier (e.g. `anytown_site_assistant`). */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-profile.d.ts","sourceRoot":"","sources":["../src/agent-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,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AAC;IACzB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,OAAO,CAAC,CAoDlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,MAAM,CAAC,CASjB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Guard for the `bot` profile type (#5086).
3
+ *
4
+ * The MCP principal kind is classified from the user's profile type, so a
5
+ * principal that could move its own profile off the `bot` type (or rename the
6
+ * `bot` type) would escape every kind-based control. Inside a request
7
+ * principal context, a save that changes whether a profile is `bot` typed
8
+ * (including one that adopts an existing row by natural key, and a create),
9
+ * or that creates or renames a type to the `bot` slug, is refused unless the context is a
10
+ * system or super-admin one. Code running with no principal context
11
+ * (migrations, CLI, provisioning) is trusted as before.
12
+ *
13
+ * @module
14
+ */
15
+ /** Slug of the profile type agent profiles are classified under. */
16
+ export declare const AGENT_PROFILE_TYPE_SLUG = "bot";
17
+ /**
18
+ * Run framework agent provisioning (`resolveAgentProfile`) as trusted: it
19
+ * creates `bot` profiles and the `bot` type on behalf of any caller, which
20
+ * only ever yields the more restricted agent kind. Internal; not exported
21
+ * from the package entry.
22
+ */
23
+ export declare function withTrustedAgentProvisioning<T>(run: () => Promise<T>): Promise<T>;
24
+ /** True when a non-privileged request principal is acting. */
25
+ export declare function isUnprivilegedPrincipalContext(): boolean;
26
+ /** Error thrown when a guarded `bot` type change is refused. */
27
+ export declare class AgentTypeChangeError extends Error {
28
+ constructor();
29
+ }
30
+ //# sourceMappingURL=agent-type-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-type-guard.d.ts","sourceRoot":"","sources":["../src/agent-type-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAqB7C;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED,8DAA8D;AAC9D,wBAAgB,8BAA8B,IAAI,OAAO,CASxD;AAED,gEAAgE;AAChE,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C"}
@@ -42,7 +42,7 @@ var OidcIdentity = class extends SmrtObject {
42
42
  * Find identity by issuer and subject
43
43
  */
44
44
  static async findBySubject(issuer, subject, options = {}) {
45
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-CwgUAk_O.js").then((n) => n.r);
45
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-lHtQmTFB.js").then((n) => n.r);
46
46
  return await (await OidcIdentityCollection.create(options)).findBySubject(issuer, subject);
47
47
  }
48
48
  /** Build the collision-free natural key for one OIDC issuer subject. */
@@ -65,7 +65,7 @@ var OidcIdentity = class extends SmrtObject {
65
65
  static async findOrCreate(profile, oidcData, options = {}) {
66
66
  const profileId = profile.id;
67
67
  if (typeof profileId !== "string" || !profileId) throw new Error("OidcIdentity.findOrCreate() requires a saved Profile.");
68
- const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-Bsjd2yDj.js").then((n) => n.i);
68
+ const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CBP8wpBI.js").then((n) => n.i);
69
69
  const profileOptions = profile.options ?? {};
70
70
  return (await reuseExistingOidcIdentityForProfile(profileId, {
71
71
  email: oidcData.email,
@@ -127,4 +127,4 @@ OidcIdentity = __decorateClass([smrt({
127
127
  //#endregion
128
128
  export { OidcIdentity as t };
129
129
 
130
- //# sourceMappingURL=OidcIdentity-uX-K-vHR.js.map
130
+ //# sourceMappingURL=OidcIdentity-B06GwRj2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OidcIdentity-uX-K-vHR.js","names":[],"sources":["../../src/models/OidcIdentity.ts"],"sourcesContent":["/**\n * OidcIdentity - Links OIDC provider identities to Profile\n *\n * Stores the mapping between external OIDC providers (Keycloak, Google, GitHub)\n * and internal Profile records. Multiple identities can link to a single profile.\n */\n\nimport {\n field,\n foreignKey,\n SmrtObject,\n type SmrtObjectOptions,\n type SmrtSaveOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport type { Profile } from './Profile';\n\nexport interface OidcIdentityOptions extends SmrtObjectOptions {\n profileId?: string;\n provider?: string;\n issuer?: string;\n subject?: string;\n email?: string;\n lastUsedAt?: Date | null;\n}\n\n@smrt({\n tableName: 'oidc_identities',\n // Identity linking is an authentication authority change. Generated routes\n // authenticate callers but do not authorize Profile ownership, so mutations\n // must stay behind the trusted provisioning APIs below.\n api: { include: ['list', 'get'] },\n mcp: { include: ['list', 'get'] },\n cli: { include: ['list', 'get'] },\n})\nexport class OidcIdentity extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n /**\n * Link to the Profile (Person, Organization, Bot)\n */\n @foreignKey('Profile', { required: true, requiredFor: 'identity' })\n profileId?: string;\n\n /**\n * Provider name (e.g., 'keycloak', 'google', 'github')\n */\n @field({ type: 'text' })\n provider: string = '';\n\n /**\n * OIDC issuer URL (e.g., https://keycloak.example.com/realms/bmp)\n */\n @field({ type: 'text', indexed: true })\n issuer: string = '';\n\n /**\n * OIDC subject claim - unique identifier from the provider\n */\n @field({ type: 'text', indexed: true })\n subject: string = '';\n\n /**\n * Stable issuer+subject key used as the database race arbiter.\n *\n * Nullable for legacy rows; every newly linked or reused identity backfills\n * it. A separate unique constraint makes concurrent first login fail with a\n * retryable conflict instead of creating two identities.\n */\n @field({ type: 'text', nullable: true, unique: true, readonly: true })\n identityKey: string | null = null;\n\n /**\n * Cached email from the IdP (for display/lookup)\n */\n @field({ type: 'text' })\n email: string = '';\n\n /**\n * Last time this identity was used for authentication\n */\n @field({ type: 'datetime', nullable: true })\n lastUsedAt: Date | null = null;\n\n constructor(options: OidcIdentityOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.provider) this.provider = options.provider;\n if (options.issuer) this.issuer = options.issuer;\n if (options.subject) this.subject = options.subject;\n if (options.email) this.email = options.email;\n if (options.lastUsedAt !== undefined) this.lastUsedAt = options.lastUsedAt;\n }\n\n /**\n * Get the linked Profile\n */\n async getProfile(): Promise<Profile | null> {\n return (await this.getRelated('profileId')) as Profile | null;\n }\n\n /**\n * Find identity by issuer and subject\n */\n static async findBySubject(\n issuer: string,\n subject: string,\n options: SmrtObjectOptions = {},\n ): Promise<OidcIdentity | null> {\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n const collection = await OidcIdentityCollection.create(options);\n return await collection.findBySubject(issuer, subject);\n }\n\n /** Build the collision-free natural key for one OIDC issuer subject. */\n static buildIdentityKey(issuer: string, subject: string): string {\n return JSON.stringify([issuer, subject]);\n }\n\n /** Keep the durable key derived from its natural-key source fields. */\n override async save(options?: SmrtSaveOptions): Promise<this> {\n this.identityKey =\n this.issuer.trim() && this.subject.trim()\n ? OidcIdentity.buildIdentityKey(this.issuer, this.subject)\n : null;\n return super.save(options);\n }\n\n /**\n * Reuse an existing exact identity for its unchanged Profile.\n *\n * @deprecated Authentication links must be created through transactional\n * provisioning. This compatibility method only refreshes a unique mapping\n * that already belongs to the supplied Profile, including legacy Profile\n * types, and deliberately refuses to create or rebind authority.\n */\n static async findOrCreate(\n profile: Profile,\n oidcData: {\n provider: string;\n issuer: string;\n subject: string;\n email?: string;\n },\n options: SmrtObjectOptions = {},\n ): Promise<OidcIdentity> {\n const profileId = profile.id;\n if (typeof profileId !== 'string' || !profileId) {\n throw new Error('OidcIdentity.findOrCreate() requires a saved Profile.');\n }\n const { reuseExistingOidcIdentityForProfile } = await import(\n '../auth/resolveIdentity'\n );\n const profileOptions = profile.options ?? {};\n const result = await reuseExistingOidcIdentityForProfile(\n profileId,\n {\n email: oidcData.email,\n iss: oidcData.issuer,\n sub: oidcData.subject,\n },\n oidcData.provider,\n {\n ...profileOptions,\n ...options,\n db: options.db ?? profileOptions.db,\n },\n );\n return result.oidcIdentity;\n }\n\n /**\n * Record usage of this identity\n */\n async recordUsage(): Promise<void> {\n // Trusted provisioning or another authentication may refresh this exact\n // identity through a second instance. Rehydrate before each bounded attempt\n // so this usage-only write preserves those changes while retaining CAS.\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await this.loadFromId();\n this.lastUsedAt = new Date();\n try {\n await this.save();\n return;\n } catch (error) {\n if (\n attempt === 3 ||\n !(\n error instanceof Error &&\n 'code' in error &&\n error.code === 'RUNTIME_REVISION_CONFLICT'\n )\n ) {\n throw error;\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,IAAM,eAAN,cAA2B,WAAW;CAK3C;CAMA,WAAmB;CAMnB,SAAiB;CAMjB,UAAkB;CAUlB,cAA6B;CAM7B,QAAgB;CAMhB,aAA0B;CAE1B,YAAY,UAA+B,CAAC,GAAG;EAC7C,MAAM,OAAO;EACb,IAAI,QAAQ,WAAW,KAAK,YAAY,QAAQ;EAChD,IAAI,QAAQ,UAAU,KAAK,WAAW,QAAQ;EAC9C,IAAI,QAAQ,QAAQ,KAAK,SAAS,QAAQ;EAC1C,IAAI,QAAQ,SAAS,KAAK,UAAU,QAAQ;EAC5C,IAAI,QAAQ,OAAO,KAAK,QAAQ,QAAQ;EACxC,IAAI,QAAQ,eAAe,KAAA,GAAW,KAAK,aAAa,QAAQ;CAClE;;;;CAKA,MAAM,aAAsC;EAC1C,OAAQ,MAAM,KAAK,WAAW,WAAW;CAC3C;;;;CAKA,aAAa,cACX,QACA,SACA,UAA6B,CAAC,GACA;EAC9B,MAAM,EAAE,2BAA2B,MAAM,OACvC,uCAAA,CAAA,MAAA,MAAA,EAAA,CAAA;EAGF,OAAO,OAAM,MADY,uBAAuB,OAAO,OAAO,EAAA,CACtC,c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,GAVZ,aAWX,WAAA,YAAA,CAAA;AAMA,gBAAA,CADC,MAAM;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAhB3B,aAiBX,WAAA,UAAA,CAAA;AAMA,gBAAA,CADC,MAAM;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAtB3B,aAuBX,WAAA,WAAA,CAAA;AAUA,gBAAA,CADC,MAAM;CAAE,MAAM;CAAQ,UAAU;CAAM,QAAQ;CAAM,UAAU;AAAK,CAAC,CAAA,GAhC1D,aAiCX,WAAA,eAAA,CAAA;AAMA,gBAAA,CADC,MAAM,EAAE,MAAM,OAAO,CAAC,CAAA,GAtCZ,aAuCX,WAAA,SAAA,CAAA;AAMA,gBAAA,CADC,MAAM;CAAE,MAAM;CAAY,UAAU;AAAK,CAAC,CAAA,GA5ChC,aA6CX,WAAA,cAAA,CAAA;AA7CW,eAAN,gBAAA,CATN,KAAK;CACJ,WAAW;CAIX,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;AAClC,CAAC,CAAA,GACY,YAAA"}
1
+ {"version":3,"file":"OidcIdentity-B06GwRj2.js","names":[],"sources":["../../src/models/OidcIdentity.ts"],"sourcesContent":["/**\n * OidcIdentity - Links OIDC provider identities to Profile\n *\n * Stores the mapping between external OIDC providers (Keycloak, Google, GitHub)\n * and internal Profile records. Multiple identities can link to a single profile.\n */\n\nimport {\n field,\n foreignKey,\n SmrtObject,\n type SmrtObjectOptions,\n type SmrtSaveOptions,\n smrt,\n} from '@happyvertical/smrt-core';\nimport type { Profile } from './Profile';\n\nexport interface OidcIdentityOptions extends SmrtObjectOptions {\n profileId?: string;\n provider?: string;\n issuer?: string;\n subject?: string;\n email?: string;\n lastUsedAt?: Date | null;\n}\n\n@smrt({\n tableName: 'oidc_identities',\n // Identity linking is an authentication authority change. Generated routes\n // authenticate callers but do not authorize Profile ownership, so mutations\n // must stay behind the trusted provisioning APIs below.\n api: { include: ['list', 'get'] },\n mcp: { include: ['list', 'get'] },\n cli: { include: ['list', 'get'] },\n})\nexport class OidcIdentity extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n /**\n * Link to the Profile (Person, Organization, Bot)\n */\n @foreignKey('Profile', { required: true, requiredFor: 'identity' })\n profileId?: string;\n\n /**\n * Provider name (e.g., 'keycloak', 'google', 'github')\n */\n @field({ type: 'text' })\n provider: string = '';\n\n /**\n * OIDC issuer URL (e.g., https://keycloak.example.com/realms/bmp)\n */\n @field({ type: 'text', indexed: true })\n issuer: string = '';\n\n /**\n * OIDC subject claim - unique identifier from the provider\n */\n @field({ type: 'text', indexed: true })\n subject: string = '';\n\n /**\n * Stable issuer+subject key used as the database race arbiter.\n *\n * Nullable for legacy rows; every newly linked or reused identity backfills\n * it. A separate unique constraint makes concurrent first login fail with a\n * retryable conflict instead of creating two identities.\n */\n @field({ type: 'text', nullable: true, unique: true, readonly: true })\n identityKey: string | null = null;\n\n /**\n * Cached email from the IdP (for display/lookup)\n */\n @field({ type: 'text' })\n email: string = '';\n\n /**\n * Last time this identity was used for authentication\n */\n @field({ type: 'datetime', nullable: true })\n lastUsedAt: Date | null = null;\n\n constructor(options: OidcIdentityOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.provider) this.provider = options.provider;\n if (options.issuer) this.issuer = options.issuer;\n if (options.subject) this.subject = options.subject;\n if (options.email) this.email = options.email;\n if (options.lastUsedAt !== undefined) this.lastUsedAt = options.lastUsedAt;\n }\n\n /**\n * Get the linked Profile\n */\n async getProfile(): Promise<Profile | null> {\n return (await this.getRelated('profileId')) as Profile | null;\n }\n\n /**\n * Find identity by issuer and subject\n */\n static async findBySubject(\n issuer: string,\n subject: string,\n options: SmrtObjectOptions = {},\n ): Promise<OidcIdentity | null> {\n const { OidcIdentityCollection } = await import(\n '../collections/OidcIdentityCollection'\n );\n const collection = await OidcIdentityCollection.create(options);\n return await collection.findBySubject(issuer, subject);\n }\n\n /** Build the collision-free natural key for one OIDC issuer subject. */\n static buildIdentityKey(issuer: string, subject: string): string {\n return JSON.stringify([issuer, subject]);\n }\n\n /** Keep the durable key derived from its natural-key source fields. */\n override async save(options?: SmrtSaveOptions): Promise<this> {\n this.identityKey =\n this.issuer.trim() && this.subject.trim()\n ? OidcIdentity.buildIdentityKey(this.issuer, this.subject)\n : null;\n return super.save(options);\n }\n\n /**\n * Reuse an existing exact identity for its unchanged Profile.\n *\n * @deprecated Authentication links must be created through transactional\n * provisioning. This compatibility method only refreshes a unique mapping\n * that already belongs to the supplied Profile, including legacy Profile\n * types, and deliberately refuses to create or rebind authority.\n */\n static async findOrCreate(\n profile: Profile,\n oidcData: {\n provider: string;\n issuer: string;\n subject: string;\n email?: string;\n },\n options: SmrtObjectOptions = {},\n ): Promise<OidcIdentity> {\n const profileId = profile.id;\n if (typeof profileId !== 'string' || !profileId) {\n throw new Error('OidcIdentity.findOrCreate() requires a saved Profile.');\n }\n const { reuseExistingOidcIdentityForProfile } = await import(\n '../auth/resolveIdentity'\n );\n const profileOptions = profile.options ?? {};\n const result = await reuseExistingOidcIdentityForProfile(\n profileId,\n {\n email: oidcData.email,\n iss: oidcData.issuer,\n sub: oidcData.subject,\n },\n oidcData.provider,\n {\n ...profileOptions,\n ...options,\n db: options.db ?? profileOptions.db,\n },\n );\n return result.oidcIdentity;\n }\n\n /**\n * Record usage of this identity\n */\n async recordUsage(): Promise<void> {\n // Trusted provisioning or another authentication may refresh this exact\n // identity through a second instance. Rehydrate before each bounded attempt\n // so this usage-only write preserves those changes while retaining CAS.\n for (let attempt = 0; attempt < 4; attempt += 1) {\n await this.loadFromId();\n this.lastUsedAt = new Date();\n try {\n await this.save();\n return;\n } catch (error) {\n if (\n attempt === 3 ||\n !(\n error instanceof Error &&\n 'code' in error &&\n error.code === 'RUNTIME_REVISION_CONFLICT'\n )\n )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AAA,CADC,MAAM;CAAE,MAAM;CAAY,UAAU;AAAK,CAAC,CAAA,GA5ChC,aA6CX,WAAA,cAAA,CAAA;AA7CW,eAAN,gBAAA,CATN,KAAK;CACJ,WAAW;CAIX,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;CAChC,KAAK,EAAE,SAAS,CAAC,QAAQ,KAAK,EAAE;AAClC,CAAC,CAAA,GACY,YAAA"}
@@ -1,5 +1,5 @@
1
1
  import { y as __exportAll } from "./NostrIdentity-joAS5ZlD.js";
2
- import { t as OidcIdentity } from "./OidcIdentity-uX-K-vHR.js";
2
+ import { t as OidcIdentity } from "./OidcIdentity-B06GwRj2.js";
3
3
  import { SmrtCollection } from "@happyvertical/smrt-core";
4
4
  //#region src/collections/OidcIdentityCollection.ts
5
5
  var OidcIdentityCollection_exports = /* @__PURE__ */ __exportAll({
@@ -79,4 +79,4 @@ var OidcIdentityCollection = class extends SmrtCollection {
79
79
  //#endregion
80
80
  export { OidcIdentityCollection as n, OidcIdentityCollection_exports as r, AmbiguousOidcIdentityError as t };
81
81
 
82
- //# sourceMappingURL=OidcIdentityCollection-CwgUAk_O.js.map
82
+ //# sourceMappingURL=OidcIdentityCollection-lHtQmTFB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OidcIdentityCollection-CwgUAk_O.js","names":[],"sources":["../../src/collections/OidcIdentityCollection.ts"],"sourcesContent":["/**\n * OidcIdentityCollection - Collection for managing OIDC identity records\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { OidcIdentity } from '../models/OidcIdentity';\nimport type { Profile } from '../models/Profile';\n\n/** More than one legacy row maps the same opaque OIDC issuer and subject. */\nexport class AmbiguousOidcIdentityError extends Error {\n constructor(\n readonly issuer: string,\n readonly subject: string,\n ) {\n super('Multiple OIDC identities match the same issuer and subject.');\n this.name = 'AmbiguousOidcIdentityError';\n }\n}\n\nexport class OidcIdentityCollection extends SmrtCollection<OidcIdentity> {\n static readonly _itemClass = OidcIdentity;\n\n /**\n * Find identities for a profile\n */\n async findByProfile(profileId: string): Promise<OidcIdentity[]> {\n return await this.list({\n where: { profileId },\n });\n }\n\n /**\n * Find identity by issuer and subject\n */\n async findBySubject(\n issuer: string,\n subject: string,\n ): Promise<OidcIdentity | null> {\n const result = await this.db.query(\n `SELECT CAST(id AS VARCHAR) AS id,\n CAST(profile_id AS VARCHAR) AS profile_id\n FROM oidc_identities\n WHERE issuer = ? AND subject = ?\n LIMIT 2`,\n issuer,\n subject,\n );\n if (result.rows.length > 1) {\n throw new AmbiguousOidcIdentityError(issuer, subject);\n }\n const row = result.rows[0];\n const id = row?.id;\n const profileId = row?.profile_id;\n if (typeof id !== 'string' || typeof profileId !== 'string') return null;\n const identity = await this.get({ id });\n if (!identity) return null;\n // Preserve portable identities at this authentication boundary when\n // native DuckDB exposes UUID results through internal objects.\n identity.id = id;\n identity.profileId = profileId;\n return identity;\n }\n\n /**\n * Find identities by provider\n */\n async findByProvider(provider: string): Promise<OidcIdentity[]> {\n return await this.list({\n where: { provider },\n });\n }\n\n /**\n * Reuse an existing exact OIDC identity for its unchanged Profile.\n *\n * @deprecated New authentication links require the owner-aware,\n * transactional provisioning APIs. This compatibility helper may refresh a\n * legacy Profile type, but refuses to create or rebind authority.\n */\n async linkToProfile(\n profile: Profile,\n oidcData: {\n provider: string;\n issuer: string;\n subject: string;\n email?: string;\n },\n ): Promise<OidcIdentity> {\n return OidcIdentity.findOrCreate(profile, oidcData, this.options);\n }\n\n /**\n * Unlink an OIDC identity from a profile\n */\n async unlinkFromProfile(\n profileId: string,\n issuer: string,\n subject: string,\n ): Promise<boolean> {\n const identity = await this.findOne({\n where: { profileId, issuer, subject },\n });\n\n if (identity) {\n await identity.delete();\n return true;\n }\n return false;\n }\n}\n"],"mappings":";;;;;;;;AASO,IAAM,6BAAN,cAAyC,MAAM;CACpD,YACW,QACA,SACT;EACA,MAAM,6DAA6D;EAH1D,KAAA,SAAA;EACA,KAAA,UAAA;EAGT,KAAK,OAAO;CACd;CALW;CACA;AAKb;AAEO,IAAM,yBAAN,cAAqC,eAA6B;CACvE,OAAgB,aAAa;;;;CAK7B,MAAM,cAAc,WAA4C;EAC9D,OAAO,MAAM,KAAK,KAAK,EACrB,OAAO,EAAE,UAAU,EACrB,CAAC;CACH;;;;CAKA,MAAM,cACJ,QACA,SAC8B;EAC9B,MAAM,SAAS,MAAM,KAAK,GAAG,MAC3B;;;;kBAKA,QACA,OACF;EACA,IAAI,OAAO,KAAK,SAAS,GACvB,MAAM,IAAI,2BAA2B,QAAQ,OAAO;EAEtD,MAAM,MAAM,OAAO,KAAK;EACxB,MAAM,KAAK,KAAK;EAChB,MAAM,YAAY,KAAK;EACvB,IAAI,OAAO,OAAO,YAAY,OAAO,cAAc,UAAU,OAAO;EACpE,MAAM,WAAW,MAAM,KAAK,IAAI,EAAE,GAAG,CAAC;EACtC,IAAI,CAAC,UAAU,OAAO;EAGtB,SAAS,KAAK;EACd,SAAS,YAAY;EACrB,OAAO;CACT;;;;CAKA,MAAM,eAAe,UAA2C;EAC9D,OAAO,MAAM,KAAK,KAAK,EACrB,OAAO,EAAE,SAAS,EACpB,CAAC;CACH;;;;;;;;CASA,MAAM,cACJ,SACA,UAMuB;EACvB,OAAO,aAAa,aAAa,SAAS,UAAU,KAAK,OAAO;CAClE;;;;CAKA,MAAM,kBACJ,WACA,QACA,SACkB;EAClB,MAAM,WAAW,MAAM,KAAK,QAAQ,EAClC,OAAO;GAAE;GAAW;GAAQ;EAAQ,EACtC,CAAC;EAED,IAAI,UAAU;GACZ,MAAM,SAAS,OAAO;GACtB,OAAO;EACT;EACA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"OidcIdentityCollection-lHtQmTFB.js","names":[],"sources":["../../src/collections/OidcIdentityCollection.ts"],"sourcesContent":["/**\n * OidcIdentityCollection - Collection for managing OIDC identity records\n */\n\nimport { SmrtCollection } from '@happyvertical/smrt-core';\nimport { OidcIdentity } from '../models/OidcIdentity';\nimport type { Profile } from '../models/Profile';\n\n/** More than one legacy row maps the same opaque OIDC issuer and subject. */\nexport class AmbiguousOidcIdentityError extends Error {\n constructor(\n readonly issuer: string,\n readonly subject: string,\n ) {\n super('Multiple OIDC identities match the same issuer and subject.');\n this.name = 'AmbiguousOidcIdentityError';\n }\n}\n\nexport class OidcIdentityCollection extends SmrtCollection<OidcIdentity> {\n static readonly _itemClass = OidcIdentity;\n\n /**\n * Find identities for a profile\n */\n async findByProfile(profileId: string): Promise<OidcIdentity[]> {\n return await this.list({\n where: { profileId },\n });\n }\n\n /**\n * Find identity by issuer and subject\n */\n async findBySubject(\n issuer: string,\n subject: string,\n ): Promise<OidcIdentity | null> {\n const result = await this.db.query(\n `SELECT CAST(id AS VARCHAR) AS id,\n CAST(profile_id AS VARCHAR) AS profile_id\n FROM oidc_identities\n WHERE issuer = ? AND subject = ?\n LIMIT 2`,\n issuer,\n subject,\n );\n if (result.rows.length > 1) {\n throw new AmbiguousOidcIdentityError(issuer, subject);\n }\n const row = result.rows[0];\n const id = row?.id;\n const profileId = row?.profile_id;\n if (typeof id !== 'string' || typeof profileId !== 'string') return null;\n const identity = await this.get({ id });\n if (!identity) return null;\n // Preserve portable identities at this authentication boundary when\n // native DuckDB exposes UUID results through internal objects.\n identity.id = id;\n identity.profileId = profileId;\n return identity;\n }\n\n /**\n * Find identities by provider\n */\n async findByProvider(provider: string): Promise<OidcIdentity[]> {\n return await this.list({\n where: { provider },\n });\n }\n\n /**\n * Reuse an existing exact OIDC identity for its unchanged Profile.\n *\n * @deprecated New authentication links require the owner-aware,\n * transactional provisioning APIs. This compatibility helper may refresh a\n * legacy Profile type, but refuses to create or rebind authority.\n */\n async linkToProfile(\n profile: Profile,\n oidcData: {\n provider: string;\n issuer: string;\n subject: string;\n email?: string;\n },\n ): Promise<OidcIdentity> {\n return OidcIdentity.findOrCreate(profile, oidcData, this.options);\n }\n\n /**\n * Unlink an OIDC identity from a profile\n */\n async unlinkFromProfile(\n profileId: string,\n issuer: string,\n subject: string,\n ): Promise<boolean> {\n const identity = await this.findOne({\n where: { profileId, issuer, subject },\n });\n\n if (identity) {\n await identity.delete();\n return true;\n }\n return false;\n }\n}\n"],"mappings":";;;;;;;;AASO,IAAM,6BAAN,cAAyC,MAAM;CACpD,YACW,QACA,SACT;EACA,MAAM,6DAA6D;EAH1D,KAAA,SAAA;EACA,KAAA,UAAA;EAGT,KAAK,OAAO;CACd;CALW;CACA;AAKb;AAEO,IAAM,yBAAN,cAAqC,eAA6B;CACvE,OAAgB,aAAa;;;;CAK7B,MAAM,cAAc,WAA4C;EAC9D,OAAO,MAAM,KAAK,KAAK,EACrB,OAAO,EAAE,UAAU,EACrB,CAAC;CACH;;;;CAKA,MAAM,cACJ,QACA,SAC8B;EAC9B,MAAM,SAAS,MAAM,KAAK,GAAG,MAC3B;;;;kBAKA,QACA,OACF;EACA,IAAI,OAAO,KAAK,SAAS,GACvB,MAAM,IAAI,2BAA2B,QAAQ,OAAO;EAEtD,MAAM,MAAM,OAAO,KAAK;EACxB,MAAM,KAAK,KAAK;EAChB,MAAM,YAAY,KAAK;EACvB,IAAI,OAAO,OAAO,YAAY,OAAO,cAAc,UAAU,OAAO;EACpE,MAAM,WAAW,MAAM,KAAK,IAAI,EAAE,GAAG,CAAC;EACtC,IAAI,CAAC,UAAU,OAAO;EAGtB,SAAS,KAAK;EACd,SAAS,YAAY;EACrB,OAAO;CACT;;;;CAKA,MAAM,eAAe,UAA2C;EAC9D,OAAO,MAAM,KAAK,KAAK,EACrB,OAAO,EAAE,SAAS,EACpB,CAAC;CACH;;;;;;;;CASA,MAAM,cACJ,SACA,UAMuB;EACvB,OAAO,aAAa,aAAa,SAAS,UAAU,KAAK,OAAO;CAClE;;;;CAKA,MAAM,kBACJ,WACA,QACA,SACkB;EAClB,MAAM,WAAW,MAAM,KAAK,QAAQ,EAClC,OAAO;GAAE;GAAW;GAAQ;EAAQ,EACtC,CAAC;EAED,IAAI,UAAU;GACZ,MAAM,SAAS,OAAO;GACtB,OAAO;EACT;EACA,OAAO;CACT;AACF"}
@@ -82,7 +82,7 @@ var ProfileAssetCollection = class extends SmrtJunction {
82
82
  profileCollectionPromise = null;
83
83
  async getProfileCollection() {
84
84
  if (!this.profileCollectionPromise) {
85
- const { ProfileCollection } = await import("./ProfileCollection-5Ams2c-J.js").then((n) => n.r);
85
+ const { ProfileCollection } = await import("./ProfileCollection-CSFLzcXp.js").then((n) => n.r);
86
86
  this.profileCollectionPromise = ProfileCollection.create({ db: this.db });
87
87
  }
88
88
  return this.profileCollectionPromise;
@@ -107,4 +107,4 @@ ProfileAssetCollection = __decorateClass([smrt({
107
107
  //#endregion
108
108
  export { ProfileAssetCollection_exports as n, ProfileAsset as r, ProfileAssetCollection as t };
109
109
 
110
- //# sourceMappingURL=ProfileAssetCollection-CkzuPlWl.js.map
110
+ //# sourceMappingURL=ProfileAssetCollection-CijIwtKj.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileAssetCollection-CkzuPlWl.js","names":[],"sources":["../../src/models/ProfileAsset.ts","../../src/collections/ProfileAssetCollection.ts"],"sourcesContent":["import type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n field,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\n\nexport interface ProfileAssetOptions extends SmrtObjectOptions {\n profileId?: string;\n assetId?: string;\n relationship?: string;\n sortOrder?: number;\n tenantId?: string | null;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableName: 'profile_assets',\n conflictColumns: ['profile_id', 'asset_id', 'relationship'],\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAsset extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n @foreignKey('Profile', {\n required: true,\n requiredFor: 'identity',\n onDelete: 'CASCADE',\n })\n profileId = '';\n\n @crossPackageRef('@happyvertical/smrt-assets:Asset', {\n required: true,\n requiredFor: 'identity',\n onDelete: 'CASCADE',\n })\n assetId = '';\n\n @field({ required: true })\n relationship = 'attachment';\n\n @field()\n sortOrder = 0;\n\n constructor(options: ProfileAssetOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.assetId) this.assetId = options.assetId;\n if (options.relationship) this.relationship = options.relationship;\n if (options.sortOrder !== undefined) this.sortOrder = options.sortOrder;\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n }\n}\n","import type { Asset } from '@happyvertical/smrt-assets';\nimport {\n addOwnedAssetFromCollection,\n getOwnedAssetsFromCollection,\n removeOwnedAssetFromCollection,\n} from '@happyvertical/smrt-assets';\nimport type { SmrtCollectionOptions } from '@happyvertical/smrt-core';\nimport { SmrtJunction, smrt } from '@happyvertical/smrt-core';\nimport { ProfileAsset } from '../models/ProfileAsset';\nimport type { ProfileCollection } from './ProfileCollection';\n\nexport interface ProfileAssetCollectionOptions extends SmrtCollectionOptions {}\n\n@smrt({\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAssetCollection extends SmrtJunction<ProfileAsset> { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n static readonly _itemClass = ProfileAsset;\n protected leftField = 'profileId';\n protected rightField = 'assetId';\n\n private profileCollectionPromise: Promise<ProfileCollection> | null = null;\n\n private async getProfileCollection(): Promise<ProfileCollection> {\n if (!this.profileCollectionPromise) {\n const { ProfileCollection } = await import('./ProfileCollection');\n this.profileCollectionPromise = ProfileCollection.create({ db: this.db });\n }\n\n return this.profileCollectionPromise;\n }\n\n async getAssets(profileId: string, relationship?: string): Promise<Asset[]> {\n return getOwnedAssetsFromCollection(\n await this.getProfileCollection(),\n profileId,\n relationship,\n );\n }\n\n async addAsset(\n profileId: string,\n asset: Asset,\n relationship = 'attachment',\n sortOrder = 0,\n ): Promise<void> {\n await addOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n asset,\n relationship,\n sortOrder,\n );\n }\n\n async removeAsset(\n profileId: string,\n assetId: string,\n relationship?: string,\n ): Promise<void> {\n await removeOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n assetId,\n relationship,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BO,IAAM,eAAN,cAA2B,WAAW;CAE3C,WAA0B;CAO1B,YAAY;CAOZ,UAAU;CAGV,eAAe;CAGf,YAAY;CAEZ,YAAY,UAA+B,CAAC,GAAG;EAC7C,MAAM,OAAO;EACb,IAAI,QAAQ,WAAW,KAAK,YAAY,QAAQ;EAChD,IAAI,QAAQ,SAAS,KAAK,UAAU,QAAQ;EAC5C,IAAI,QAAQ,cAAc,KAAK,eAAe,QAAQ;EACtD,IAAI,QAAQ,cAAc,KAAA,GAAW,KAAK,YAAY,QAAQ;EAC9D,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;CAC9D;AACF;AAhC+C,gBAAlC,cAAyC,mBAAkB,8BAAA;AAEtE,kBAAA,CADC,SAAS,EAAE,UAAU,KAAK,CAAC,CAAA,GADjB,aAEX,WAAA,YAAA,CAAA;AAOA,kBAAA,CALC,WAAW,WAAW;CACrB,UAAU;CACV,aAAa;CACb,UAAU;AACZ,CAAC,CAAA,GARU,aASX,WAAA,aAAA,CAAA;AAOA,kBAAA,CALC,gBAAgB,oCAAoC;CACnD,UAAU;CACV,aAAa;CACb,UAAU;AACZ,CAAC,CAAA,GAfU,aAgBX,WAAA,WAAA,CAAA;AAGA,kBAAA,CADC,MAAM,EAAE,UAAU,KAAK,CAAC,CAAA,GAlBd,aAmBX,WAAA,gBAAA,CAAA;AAGA,kBAAA,CADC,MAAM,CAAA,GArBI,aAsBX,WAAA,aAAA,CAAA;AAtBW,eAAN,kBAAA,CARN,aAAa,EAAE,MAAM,WAAW,CAAC,GACjC,KAAK;CACJ,WAAW;CACX,iBAAiB;EAAC;EAAc;EAAY;CAAc;CAC1D,KAAK;CACL,KAAK;CACL,KAAK;AACP,CAAC,CAAA,GACY,YAAA;;;;;;;;;;;;;;;;;;;ACRN,IAAM,yBAAN,cAAqC,aAA2B;CAE3D,YAAY;CACZ,aAAa;CAEf,2BAA8D;CAEtE,MAAc,uBAAmD;EAC/D,IAAI,CAAC,KAAK,0BAA0B;GAClC,MAAM,EAAE,sBAAsB,MAAM,OAAO,kCAAA,CAAA,MAAA,MAAA,EAAA,CAAA;GAC3C,KAAK,2BAA2B,kBAAkB,OAAO,EAAE,IAAI,KAAK,GAAG,CAAC;EAC1E;EAEA,OAAO,KAAK;CACd;CAEA,MAAM,UAAU,WAAmB,cAAyC;EAC1E,OAAO,6BACL,MAAM,KAAK,qBAAqB,GAChC,WACA,YACF;CACF;CAEA,MAAM,SACJ,WACA,OACA,eAAe,cACf,YAAY,GACG;EACf,MAAM,4BACJ,MAAM,KAAK,qBAAqB,GAChC,WACA,WACA,OACA,cACA,SACF;CACF;CAEA,MAAM,YACJ,WACA,SACA,cACe;EACf,MAAM,+BACJ,MAAM,KAAK,qBAAqB,GAChC,WACA,WACA,SACA,YACF;CACF;AACF;AArDyE,cAA5D,wBAAmE,mBAAkB,8BAAA;AAChG,cADW,wBACK,cAAa,YAAA;AADlB,yBAAN,gBAAA,CALN,KAAK;CACJ,KAAK;CACL,KAAK;CACL,KAAK;AACP,CAAC,CAAA,GACY,sBAAA"}
1
+ {"version":3,"file":"ProfileAssetCollection-CijIwtKj.js","names":[],"sources":["../../src/models/ProfileAsset.ts","../../src/collections/ProfileAssetCollection.ts"],"sourcesContent":["import type { SmrtObjectOptions } from '@happyvertical/smrt-core';\nimport {\n crossPackageRef,\n field,\n foreignKey,\n SmrtObject,\n smrt,\n} from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\n\nexport interface ProfileAssetOptions extends SmrtObjectOptions {\n profileId?: string;\n assetId?: string;\n relationship?: string;\n sortOrder?: number;\n tenantId?: string | null;\n}\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n tableName: 'profile_assets',\n conflictColumns: ['profile_id', 'asset_id', 'relationship'],\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAsset extends SmrtObject { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n @foreignKey('Profile', {\n required: true,\n requiredFor: 'identity',\n onDelete: 'CASCADE',\n })\n profileId = '';\n\n @crossPackageRef('@happyvertical/smrt-assets:Asset', {\n required: true,\n requiredFor: 'identity',\n onDelete: 'CASCADE',\n })\n assetId = '';\n\n @field({ required: true })\n relationship = 'attachment';\n\n @field()\n sortOrder = 0;\n\n constructor(options: ProfileAssetOptions = {}) {\n super(options);\n if (options.profileId) this.profileId = options.profileId;\n if (options.assetId) this.assetId = options.assetId;\n if (options.relationship) this.relationship = options.relationship;\n if (options.sortOrder !== undefined) this.sortOrder = options.sortOrder;\n if (options.tenantId !== undefined) this.tenantId = options.tenantId;\n }\n}\n","import type { Asset } from '@happyvertical/smrt-assets';\nimport {\n addOwnedAssetFromCollection,\n getOwnedAssetsFromCollection,\n removeOwnedAssetFromCollection,\n} from '@happyvertical/smrt-assets';\nimport type { SmrtCollectionOptions } from '@happyvertical/smrt-core';\nimport { SmrtJunction, smrt } from '@happyvertical/smrt-core';\nimport { ProfileAsset } from '../models/ProfileAsset';\nimport type { ProfileCollection } from './ProfileCollection';\n\nexport interface ProfileAssetCollectionOptions extends SmrtCollectionOptions {}\n\n@smrt({\n api: false,\n mcp: false,\n cli: false,\n})\nexport class ProfileAssetCollection extends SmrtJunction<ProfileAsset> { static __smrtPackage__ = \"@happyvertical/smrt-profiles\";\n static readonly _itemClass = ProfileAsset;\n protected leftField = 'profileId';\n protected rightField = 'assetId';\n\n private profileCollectionPromise: Promise<ProfileCollection> | null = null;\n\n private async getProfileCollection(): Promise<ProfileCollection> {\n if (!this.profileCollectionPromise) {\n const { ProfileCollection } = await import('./ProfileCollection');\n this.profileCollectionPromise = ProfileCollection.create({ db: this.db });\n }\n\n return this.profileCollectionPromise;\n }\n\n async getAssets(profileId: string, relationship?: string): Promise<Asset[]> {\n return getOwnedAssetsFromCollection(\n await this.getProfileCollection(),\n profileId,\n relationship,\n );\n }\n\n async addAsset(\n profileId: string,\n asset: Asset,\n relationship = 'attachment',\n sortOrder = 0,\n ): Promise<void> {\n await addOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n asset,\n relationship,\n sortOrder,\n );\n }\n\n async removeAsset(\n profileId: string,\n assetId: string,\n relationship?: string,\n ): Promise<void> {\n await removeOwnedAssetFromCollection(\n await this.getProfileCollection(),\n 'Profile',\n profileId,\n assetId,\n relationship,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BO,IAAM,eAAN,cAA2B,WAAW;CAE3C,WAA0B;CAO1B,YAAY;CAOZ,UAAU;CAGV,eAAe;CAGf,YAAY;CAEZ,YAAY,UAA+B,CAAC,GAAG;EAC7C,MAAM,OAAO;EACb,IAAI,QAAQ,WAAW,KAAK,YAAY,QAAQ;EAChD,IAAI,QAAQ,SAAS,KAAK,UAAU,QAAQ;EAC5C,IAAI,QAAQ,cAAc,KAAK,eAAe,QAAQ;EACtD,IAAI,QAAQ,cAAc,KAAA,GAAW,KAAK,YAAY,QAAQ;EAC9D,IAAI,QAAQ,aAAa,KAAA,GAAW,KAAK,WAAW,QAAQ;CAC9D;AACF;AAhC+C,gBAAlC,cAAyC,mBAAkB,8BAAA;AAEtE,kBAAA,CADC,SAAS,EAAE,UAAU,KAAK,CAAC,CAAA,GADjB,aAEX,WAAA,YAAA,CAAA;AAOA,kBAAA,CALC,WAAW,WAAW;CACrB,UAAU;CACV,aAAa;CACb,UAAU;AACZ,CAAC,CAAA,GARU,aASX,WAAA,aAAA,CAAA;AAOA,kBAAA,CALC,gBAAgB,oCAAoC;CACnD,UAAU;CACV,aAAa;CACb,UAAU;AACZ,CAAC,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D.js";
2
2
  import { ObjectRegistry, RuntimeError, SmrtCollection, SmrtObject, ValidationError, field, foreignKey, isAbortedTransactionError, oneToMany, smrt } from "@happyvertical/smrt-core";
3
3
  import { definePrompt, promptMessageOptions, resolvePrompt } from "@happyvertical/smrt-prompts";
4
- import { TenantScoped, getTenantId, queryGlobal, queryWithGlobals, tenantId, withSystemContext } from "@happyvertical/smrt-tenancy";
4
+ import { AsyncLocalStorage } from "node:async_hooks";
5
+ import { TenantScoped, getTenantId, isSystemContext, queryGlobal, queryWithGlobals, tenantId, withSystemContext } from "@happyvertical/smrt-tenancy";
5
6
  import { BackfillTableUnavailableError, BackfillTracker } from "@happyvertical/smrt-core/migrations";
6
7
  import { addOwnedAssetFromCollection, assertAssetLinkable, assertValidOwnedAssetRelationship, assertValidOwnedAssetSortOrder, getOwnedAssetsFromCollection, removeOwnedAssetFromCollection, resolveOwnedAssetsById } from "@happyvertical/smrt-assets";
7
8
  //#region src/prompts.ts
@@ -22,6 +23,29 @@ Return only the bio text, with no commentary or surrounding quotation marks.`,
22
23
  }
23
24
  });
24
25
  //#endregion
26
+ //#region src/agent-type-guard.ts
27
+ var AGENT_PROFILE_TYPE_SLUG = "bot";
28
+ function principalContext() {
29
+ const getter = globalThis.__smrtGetRequestPermissionContext;
30
+ return typeof getter === "function" ? getter() : void 0;
31
+ }
32
+ var trustedProvisioning = new AsyncLocalStorage();
33
+ function withTrustedAgentProvisioning(run) {
34
+ return trustedProvisioning.run(true, run);
35
+ }
36
+ function isUnprivilegedPrincipalContext() {
37
+ if (trustedProvisioning.getStore()) return false;
38
+ const context = principalContext();
39
+ if (!context) return false;
40
+ return !(context.systemContext === true || context.superAdminBypass === true || isSystemContext());
41
+ }
42
+ var AgentTypeChangeError = class extends Error {
43
+ constructor() {
44
+ super("The agent profile type cannot be changed by this principal.");
45
+ this.name = "AgentTypeChangeError";
46
+ }
47
+ };
48
+ //#endregion
25
49
  //#region src/models/ProfileType.ts
26
50
  var ProfileType_exports = /* @__PURE__ */ __exportAll({ ProfileType: () => ProfileType });
27
51
  var __defProp$2 = Object.defineProperty;
@@ -49,6 +73,24 @@ var ProfileType = class extends SmrtObject {
49
73
  if (options.description !== void 0) this.description = options.description;
50
74
  }
51
75
  /**
76
+ * An unprivileged principal cannot rename the `bot` type away or rename
77
+ * another type to `bot` (#5086): the MCP principal kind is read from it.
78
+ */
79
+ async save(options) {
80
+ if (isUnprivilegedPrincipalContext()) {
81
+ const slug = this.slug || await this.getSlug();
82
+ let storedSlug;
83
+ if (this.isPersisted && this.id) {
84
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-BYSvknkE.js").then((n) => n.n);
85
+ const stored = await (await ProfileTypeCollection.create(this.options)).get(this.id);
86
+ if (!stored) throw new AgentTypeChangeError();
87
+ storedSlug = stored.slug ?? void 0;
88
+ }
89
+ if (slug === "bot" && storedSlug !== slug || storedSlug === "bot" && slug !== storedSlug) throw new AgentTypeChangeError();
90
+ }
91
+ return super.save(options);
92
+ }
93
+ /**
52
94
  * Convenience method for slug-based lookup
53
95
  *
54
96
  * @param slug - The slug to search for
@@ -439,10 +481,44 @@ var Profile = class extends SmrtObject {
439
481
  }
440
482
  /** Keep the durable identity key derived from the public email field. */
441
483
  async save(options) {
484
+ await this.assertAgentTypeUnchanged();
442
485
  this.emailKey = this.email?.trim() ? normalizeIdentityEmail(this.email) : null;
443
486
  return super.save(options);
444
487
  }
445
488
  /**
489
+ * Refuse an unprivileged principal moving an existing profile to or from
490
+ * the `bot` type (#5086): the MCP principal kind is read from it. Fails
491
+ * closed when either side cannot be resolved.
492
+ */
493
+ async assertAgentTypeUnchanged() {
494
+ if (!isUnprivilegedPrincipalContext()) return;
495
+ const { ProfileCollection } = await Promise.resolve().then(() => ProfileCollection_exports);
496
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-BYSvknkE.js").then((n) => n.n);
497
+ const profiles = await ProfileCollection.create(this.options);
498
+ const tenantId2 = this.tenantId || getTenantId() || null;
499
+ let stored = null;
500
+ if (this.isPersisted && this.id) {
501
+ stored = await profiles.get(this.id);
502
+ if (!stored) throw new AgentTypeChangeError();
503
+ } else {
504
+ const slug = this.slug || await this.getSlug();
505
+ if (slug) stored = await profiles.get({
506
+ slug,
507
+ context: this.context,
508
+ tenantId: tenantId2
509
+ });
510
+ }
511
+ if (stored && (stored.typeId ?? null) === (this.typeId ?? null)) return;
512
+ const types = await ProfileTypeCollection.create(this.options);
513
+ const isBot = async (id) => {
514
+ if (!id) return false;
515
+ const type = tenantId2 ? await types.getAvailableById(id, tenantId2) : await types.get(id);
516
+ if (!type) throw new AgentTypeChangeError();
517
+ return type.slug === "bot";
518
+ };
519
+ if (await isBot(stored?.typeId) !== await isBot(this.typeId)) throw new AgentTypeChangeError();
520
+ }
521
+ /**
446
522
  * Get the profile type slug for this profile
447
523
  *
448
524
  * @returns The slug of the profile type
@@ -450,7 +526,7 @@ var Profile = class extends SmrtObject {
450
526
  async getTypeSlug() {
451
527
  const tenantId2 = this.tenantId || getTenantId();
452
528
  if (this.typeId && tenantId2) {
453
- const { ProfileTypeCollection } = await import("./ProfileTypeCollection-2fjo--pR.js").then((n) => n.n);
529
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-BYSvknkE.js").then((n) => n.n);
454
530
  return (await (await ProfileTypeCollection.create(this.options)).getAvailableById(this.typeId, tenantId2))?.slug ?? "";
455
531
  }
456
532
  return (await this.loadRelated("typeId"))?.slug || "";
@@ -550,7 +626,7 @@ var Profile = class extends SmrtObject {
550
626
  return candidates.find((candidate) => ownerTenantId && candidate.tenantId === ownerTenantId) ?? candidates.find((candidate) => !candidate.tenantId) ?? null;
551
627
  }
552
628
  async getProfileLinkCollection() {
553
- const { ProfileLinkCollection } = await import("./ProfileLinkCollection-Cl9rY_U_.js").then((n) => n.r);
629
+ const { ProfileLinkCollection } = await import("./ProfileLinkCollection-BHgVmkly.js").then((n) => n.r);
554
630
  return ProfileLinkCollection.create({ db: this.db });
555
631
  }
556
632
  /** This profile's web links in display order. */
@@ -567,7 +643,7 @@ var Profile = class extends SmrtObject {
567
643
  return (await this.getProfileLinkCollection()).replaceForProfile(this.id, links);
568
644
  }
569
645
  async getProfileAssetCollection() {
570
- const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CkzuPlWl.js").then((n) => n.n);
646
+ const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CijIwtKj.js").then((n) => n.n);
571
647
  return ProfileAssetCollection.create({ db: this.db });
572
648
  }
573
649
  async getAssets(relationship) {
@@ -794,7 +870,7 @@ var Profile = class extends SmrtObject {
794
870
  * @returns Array of OIDC identity records
795
871
  */
796
872
  async getOidcIdentities() {
797
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-CwgUAk_O.js").then((n) => n.r);
873
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-lHtQmTFB.js").then((n) => n.r);
798
874
  return await (await OidcIdentityCollection.create(this.options)).findByProfile(this.id);
799
875
  }
800
876
  /**
@@ -807,7 +883,7 @@ var Profile = class extends SmrtObject {
807
883
  * type, but refuses to create or rebind authority.
808
884
  */
809
885
  async linkOidcIdentity(oidcData) {
810
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-CwgUAk_O.js").then((n) => n.r);
886
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-lHtQmTFB.js").then((n) => n.r);
811
887
  return await (await OidcIdentityCollection.create(this.options)).linkToProfile(this, oidcData);
812
888
  }
813
889
  /**
@@ -1217,6 +1293,6 @@ function readRequiredString(row, key) {
1217
1293
  return value;
1218
1294
  }
1219
1295
  //#endregion
1220
- export { smrtProfilesGenerateBioPrompt as _, Profile as a, backfillProfileEmailKeys as c, isOidcProvisioningRaceConflict as d, saveOidcRaceArbiter as f, promptMessageOptions as g, ProfileType_exports as h, OidcProfileEmailReservationCollection as i, coordinateOidcProvisioning as l, ProfileType as m, ProfileCollection as n, OidcProfileEmailReservation as o, normalizeIdentityEmail as p, ProfileCollection_exports as r, PROFILE_EMAIL_KEY_BACKFILL_NAME as s, CanonicalPersonProfileError as t, isOidcAbortedTransactionError as u };
1296
+ export { AgentTypeChangeError as _, Profile as a, smrtProfilesGenerateBioPrompt as b, backfillProfileEmailKeys as c, isOidcProvisioningRaceConflict as d, saveOidcRaceArbiter as f, AGENT_PROFILE_TYPE_SLUG as g, ProfileType_exports as h, OidcProfileEmailReservationCollection as i, coordinateOidcProvisioning as l, ProfileType as m, ProfileCollection as n, OidcProfileEmailReservation as o, normalizeIdentityEmail as p, ProfileCollection_exports as r, PROFILE_EMAIL_KEY_BACKFILL_NAME as s, CanonicalPersonProfileError as t, isOidcAbortedTransactionError as u, withTrustedAgentProvisioning as v, promptMessageOptions as y };
1221
1297
 
1222
- //# sourceMappingURL=ProfileCollection-5Ams2c-J.js.map
1298
+ //# sourceMappingURL=ProfileCollection-CSFLzcXp.js.map