@carlonicora/nextjs-jsonapi 1.108.0 → 1.110.0

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 (144) hide show
  1. package/dist/{AssistantInterface-BYgI5z1-.d.mts → AssistantInterface-B1c8FhGA.d.mts} +2 -0
  2. package/dist/{AssistantInterface-DfDcz0gJ.d.ts → AssistantInterface-BBUHxOCd.d.ts} +2 -0
  3. package/dist/{AssistantMessageInterface-BpEhx2pC.d.ts → AssistantMessageInterface-BNzf1etU.d.ts} +16 -1
  4. package/dist/{AssistantMessageInterface-DJ3Me16Y.d.mts → AssistantMessageInterface-DrgHDjZ5.d.mts} +16 -1
  5. package/dist/{AuthComponent-B6DIk8Vf.d.ts → AuthComponent-Cd7lcYif.d.ts} +1 -1
  6. package/dist/{AuthComponent-BKI0ZbtD.d.mts → AuthComponent-DdxCFgUZ.d.mts} +1 -1
  7. package/dist/{BlockNoteEditor-2AXSTGGG.js → BlockNoteEditor-7OKW6HHN.js} +19 -19
  8. package/dist/{BlockNoteEditor-2AXSTGGG.js.map → BlockNoteEditor-7OKW6HHN.js.map} +1 -1
  9. package/dist/{BlockNoteEditor-XVIBGXHF.mjs → BlockNoteEditor-K7IIWM3S.mjs} +4 -4
  10. package/dist/BlockNoteViewer-OPSCTHKJ.mjs +31 -0
  11. package/dist/BlockNoteViewer-OPSCTHKJ.mjs.map +1 -0
  12. package/dist/BlockNoteViewer-UW5VZ5UF.js +31 -0
  13. package/dist/BlockNoteViewer-UW5VZ5UF.js.map +1 -0
  14. package/dist/{auth.interface-BBUgMZzs.d.ts → auth.interface-8b601idJ.d.ts} +1 -1
  15. package/dist/{auth.interface-XYEREOD6.d.mts → auth.interface-CXBF8Mhi.d.mts} +1 -1
  16. package/dist/billing/index.d.mts +41 -41
  17. package/dist/billing/index.d.ts +41 -41
  18. package/dist/billing/index.js +346 -346
  19. package/dist/billing/index.mjs +3 -3
  20. package/dist/{chunk-VLDLERJN.js → chunk-6XWW67F2.js} +29 -9
  21. package/dist/chunk-6XWW67F2.js.map +1 -0
  22. package/dist/{chunk-HC3JFN3C.js → chunk-AKXUNE3A.js} +1004 -862
  23. package/dist/chunk-AKXUNE3A.js.map +1 -0
  24. package/dist/{chunk-CFECWLHH.mjs → chunk-CWVYU4YZ.mjs} +23 -3
  25. package/dist/chunk-CWVYU4YZ.mjs.map +1 -0
  26. package/dist/{chunk-56XBGQGU.mjs → chunk-TXVVZLUQ.mjs} +1422 -1280
  27. package/dist/chunk-TXVVZLUQ.mjs.map +1 -0
  28. package/dist/{chunk-RXXZGPC3.js → chunk-U2HR57MY.js} +265 -113
  29. package/dist/chunk-U2HR57MY.js.map +1 -0
  30. package/dist/chunk-WPAQRB5Q.mjs +7 -0
  31. package/dist/chunk-WPAQRB5Q.mjs.map +1 -0
  32. package/dist/chunk-YBZVWLPH.js +7 -0
  33. package/dist/chunk-YBZVWLPH.js.map +1 -0
  34. package/dist/{chunk-N3NVIPSU.mjs → chunk-ZYPNVEHB.mjs} +235 -83
  35. package/dist/{chunk-N3NVIPSU.mjs.map → chunk-ZYPNVEHB.mjs.map} +1 -1
  36. package/dist/client/index.d.mts +9 -18
  37. package/dist/client/index.d.ts +9 -18
  38. package/dist/client/index.js +4 -4
  39. package/dist/client/index.mjs +3 -3
  40. package/dist/components/index.d.mts +421 -417
  41. package/dist/components/index.d.ts +421 -417
  42. package/dist/components/index.js +6 -4
  43. package/dist/components/index.js.map +1 -1
  44. package/dist/components/index.mjs +5 -3
  45. package/dist/{config-CLQynoaa.d.ts → config-BrkU_Ynz.d.ts} +4 -1
  46. package/dist/{config-k61pe_o2.d.mts → config-snd2ToEB.d.mts} +4 -1
  47. package/dist/contexts/index.d.mts +31 -20
  48. package/dist/contexts/index.d.ts +31 -20
  49. package/dist/contexts/index.js +4 -4
  50. package/dist/contexts/index.mjs +3 -3
  51. package/dist/core/index.d.mts +75 -11
  52. package/dist/core/index.d.ts +75 -11
  53. package/dist/core/index.js +2 -2
  54. package/dist/core/index.mjs +1 -1
  55. package/dist/features/help/index.css +29 -0
  56. package/dist/features/help/index.css.map +1 -0
  57. package/dist/features/help/index.d.mts +74 -0
  58. package/dist/features/help/index.d.ts +74 -0
  59. package/dist/features/help/index.js +522 -0
  60. package/dist/features/help/index.js.map +1 -0
  61. package/dist/features/help/index.mjs +522 -0
  62. package/dist/features/help/index.mjs.map +1 -0
  63. package/dist/features/help/server.d.mts +33 -0
  64. package/dist/features/help/server.d.ts +33 -0
  65. package/dist/features/help/server.js +8 -0
  66. package/dist/features/help/server.js.map +1 -0
  67. package/dist/features/help/server.mjs +8 -0
  68. package/dist/features/help/server.mjs.map +1 -0
  69. package/dist/help-content-config.interface-C5ESIod9.d.mts +13 -0
  70. package/dist/help-content-config.interface-C5ESIod9.d.ts +13 -0
  71. package/dist/index.d.mts +10 -8
  72. package/dist/index.d.ts +10 -8
  73. package/dist/index.js +3 -3
  74. package/dist/index.mjs +2 -2
  75. package/dist/{notification.interface-aLEJbA_g.d.ts → notification.interface-C1T1C2ee.d.ts} +1 -100
  76. package/dist/{notification.interface-DLZGtV7Z.d.mts → notification.interface-DIxR23eS.d.mts} +1 -100
  77. package/dist/{s3.service-CVgLWaDc.d.mts → s3.service-0BTClOYO.d.mts} +2 -2
  78. package/dist/{s3.service-SLlX0Zbz.d.ts → s3.service-CT27Fm1s.d.ts} +2 -2
  79. package/dist/server/index.d.mts +4 -3
  80. package/dist/server/index.d.ts +4 -3
  81. package/dist/server/index.js +3 -3
  82. package/dist/server/index.mjs +1 -1
  83. package/dist/testing/index.d.mts +1 -2
  84. package/dist/testing/index.d.ts +1 -2
  85. package/dist/types-CQSjy7et.d.mts +101 -0
  86. package/dist/types-DHOxe8rc.d.ts +101 -0
  87. package/dist/usePageUrlGenerator-tjq2mlDV.d.ts +14 -0
  88. package/dist/usePageUrlGenerator-uOnyJ6j2.d.mts +14 -0
  89. package/dist/{useSocket-BkxHHujj.d.mts → useSocket-B1fMIr17.d.mts} +1 -1
  90. package/dist/{useSocket-CMDjWFYm.d.ts → useSocket-BdJTBXKv.d.ts} +1 -1
  91. package/package.json +15 -1
  92. package/src/client/config.ts +9 -1
  93. package/src/components/index.ts +1 -0
  94. package/src/components/viewers/BlockNoteViewer.tsx +27 -0
  95. package/src/components/viewers/BlockNoteViewerContainer.tsx +10 -0
  96. package/src/core/registry/helpStore.ts +28 -0
  97. package/src/features/assistant/contexts/AssistantContext.tsx +35 -19
  98. package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +66 -6
  99. package/src/features/assistant/data/Assistant.ts +2 -0
  100. package/src/features/assistant/data/AssistantInterface.ts +2 -0
  101. package/src/features/assistant/data/AssistantService.ts +18 -8
  102. package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +4 -0
  103. package/src/features/assistant-message/components/parts/MessageSourcesPanel.tsx +6 -4
  104. package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +5 -1
  105. package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +3 -1
  106. package/src/features/assistant-message/data/AssistantMessage.ts +27 -1
  107. package/src/features/assistant-message/data/AssistantMessageInterface.ts +1 -0
  108. package/src/features/assistant-message/data/__tests__/AssistantMessage.spec.ts +7 -3
  109. package/src/features/help/components/HelpArticleBody.tsx +62 -0
  110. package/src/features/help/components/HelpAskAi.tsx +36 -0
  111. package/src/features/help/components/HelpAssistantSheet.tsx +53 -0
  112. package/src/features/help/components/HelpHeader.tsx +40 -0
  113. package/src/features/help/components/HelpHint.tsx +86 -0
  114. package/src/features/help/components/HelpSearchResultRow.tsx +61 -0
  115. package/src/features/help/components/HelpSideNav.tsx +119 -0
  116. package/src/features/help/components/HelpTOC.tsx +49 -0
  117. package/src/features/help/components/__tests__/HelpAskAi.spec.tsx +68 -0
  118. package/src/features/help/components/__tests__/HelpAssistantSheet.spec.tsx +36 -0
  119. package/src/features/help/components/__tests__/HelpHint.spec.tsx +50 -0
  120. package/src/features/help/components/__tests__/HelpSearchResultRow.spec.tsx +58 -0
  121. package/src/features/help/components/__tests__/HelpSideNav.spec.tsx +50 -0
  122. package/src/features/help/contexts/HelpContext.spec.tsx +26 -0
  123. package/src/features/help/contexts/HelpContext.tsx +24 -0
  124. package/src/features/help/hooks/useHelp.ts +1 -0
  125. package/src/features/help/hooks/useHelpFilter.ts +27 -0
  126. package/src/features/help/i18n-keys.ts +34 -0
  127. package/src/features/help/index.ts +24 -0
  128. package/src/features/help/interfaces/help-content-config.interface.ts +12 -0
  129. package/src/features/help/server-entry.ts +11 -0
  130. package/src/features/help/types/help-article.types.ts +35 -0
  131. package/src/features/help/utils/articleUrl.ts +13 -0
  132. package/src/features/how-to/HowToModule.ts +14 -1
  133. package/src/features/how-to/components/forms/HowToEditor.tsx +108 -4
  134. package/src/features/how-to/data/HowTo.spec.ts +43 -0
  135. package/src/features/how-to/data/HowTo.ts +64 -3
  136. package/src/features/how-to/data/HowToInterface.ts +14 -0
  137. package/src/features/how-to/data/HowToService.ts +61 -0
  138. package/src/index.ts +4 -0
  139. package/dist/chunk-56XBGQGU.mjs.map +0 -1
  140. package/dist/chunk-CFECWLHH.mjs.map +0 -1
  141. package/dist/chunk-HC3JFN3C.js.map +0 -1
  142. package/dist/chunk-RXXZGPC3.js.map +0 -1
  143. package/dist/chunk-VLDLERJN.js.map +0 -1
  144. /package/dist/{BlockNoteEditor-XVIBGXHF.mjs.map → BlockNoteEditor-K7IIWM3S.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ // src/features/help/types/help-article.types.ts
2
+ var HELP_MODES = ["tutorial", "how-to", "reference", "explanation"];
3
+
4
+ export {
5
+ HELP_MODES
6
+ };
7
+ //# sourceMappingURL=chunk-WPAQRB5Q.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/features/help/types/help-article.types.ts"],"sourcesContent":["/**\n * Help-article types for the frontend help feature. Self-contained — the\n * published frontend library stays decoupled from `@carlonicora/nestjs-neo4jsonapi`.\n */\n\nexport const HELP_MODES = [\"tutorial\", \"how-to\", \"reference\", \"explanation\"] as const;\nexport type HelpMode = (typeof HELP_MODES)[number];\n\nexport interface HelpHeading {\n depth: 2 | 3;\n slug: string;\n text: string;\n}\n\nexport interface HelpArticle {\n id: string;\n slug: string;\n mode: HelpMode;\n title: string;\n summary: string;\n order: number;\n tags: readonly string[];\n contextualKeys: readonly string[];\n aiIndexed: boolean;\n draft: boolean;\n path: string;\n headings: readonly HelpHeading[];\n relatedSlugs: readonly string[];\n lastUpdated: string;\n}\n\nexport interface HelpRedirect {\n from: string;\n to: string;\n}\n"],"mappings":";AAKO,IAAM,aAAa,CAAC,YAAY,UAAU,aAAa,aAAa;","names":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/features/help/types/help-article.types.ts
2
+ var HELP_MODES = ["tutorial", "how-to", "reference", "explanation"];
3
+
4
+
5
+
6
+ exports.HELP_MODES = HELP_MODES;
7
+ //# sourceMappingURL=chunk-YBZVWLPH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-YBZVWLPH.js","../src/features/help/types/help-article.types.ts"],"names":[],"mappings":"AAAA;ACKO,IAAM,WAAA,EAAa,CAAC,UAAA,EAAY,QAAA,EAAU,WAAA,EAAa,aAAa,CAAA;ADH3E;AACA;AACE;AACF,gCAAC","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-YBZVWLPH.js","sourcesContent":[null,"/**\n * Help-article types for the frontend help feature. Self-contained — the\n * published frontend library stays decoupled from `@carlonicora/nestjs-neo4jsonapi`.\n */\n\nexport const HELP_MODES = [\"tutorial\", \"how-to\", \"reference\", \"explanation\"] as const;\nexport type HelpMode = (typeof HELP_MODES)[number];\n\nexport interface HelpHeading {\n depth: 2 | 3;\n slug: string;\n text: string;\n}\n\nexport interface HelpArticle {\n id: string;\n slug: string;\n mode: HelpMode;\n title: string;\n summary: string;\n order: number;\n tags: readonly string[];\n contextualKeys: readonly string[];\n aiIndexed: boolean;\n draft: boolean;\n path: string;\n headings: readonly HelpHeading[];\n relatedSlugs: readonly string[];\n lastUpdated: string;\n}\n\nexport interface HelpRedirect {\n from: string;\n to: string;\n}\n"]}
@@ -5256,6 +5256,13 @@ var HowTo = class extends Content {
5256
5256
  }
5257
5257
  _description;
5258
5258
  _pages;
5259
+ _howToType;
5260
+ _slug;
5261
+ _order;
5262
+ _summary;
5263
+ _tags;
5264
+ _contextualKeys;
5265
+ _draft;
5259
5266
  /**
5260
5267
  * Parse pages from backend JSON string (handles legacy single string + JSON array)
5261
5268
  */
@@ -5281,10 +5288,49 @@ var HowTo = class extends Content {
5281
5288
  get pages() {
5282
5289
  return this._pages;
5283
5290
  }
5291
+ get howToType() {
5292
+ return this._howToType;
5293
+ }
5294
+ get slug() {
5295
+ return this._slug;
5296
+ }
5297
+ get order() {
5298
+ return this._order;
5299
+ }
5300
+ get summary() {
5301
+ return this._summary;
5302
+ }
5303
+ get tags() {
5304
+ return this._tags ?? [];
5305
+ }
5306
+ get contextualKeys() {
5307
+ return this._contextualKeys ?? [];
5308
+ }
5309
+ get draft() {
5310
+ return this._draft ?? false;
5311
+ }
5284
5312
  rehydrate(data) {
5285
5313
  super.rehydrate(data);
5286
- this._description = data.jsonApi.attributes.description ? JSON.parse(data.jsonApi.attributes.description) : void 0;
5314
+ const rawDescription = data.jsonApi.attributes.description;
5315
+ if (rawDescription === void 0 || rawDescription === null || rawDescription === "") {
5316
+ this._description = void 0;
5317
+ } else if (typeof rawDescription === "string") {
5318
+ try {
5319
+ this._description = JSON.parse(rawDescription);
5320
+ } catch {
5321
+ this._description = rawDescription;
5322
+ }
5323
+ } else {
5324
+ this._description = rawDescription;
5325
+ }
5287
5326
  this._pages = data.jsonApi.attributes.pages;
5327
+ this._howToType = data.jsonApi.attributes.howToType;
5328
+ this._slug = data.jsonApi.attributes.slug;
5329
+ this._order = data.jsonApi.attributes.order;
5330
+ this._summary = data.jsonApi.attributes.summary;
5331
+ this._tags = data.jsonApi.attributes.tags ?? [];
5332
+ this._contextualKeys = data.jsonApi.attributes.contextualKeys ?? [];
5333
+ this._draft = data.jsonApi.attributes.draft ?? false;
5288
5334
  return this;
5289
5335
  }
5290
5336
  createJsonApi(data) {
@@ -5301,6 +5347,13 @@ var HowTo = class extends Content {
5301
5347
  super.addContentInput(response, data);
5302
5348
  if (data.description !== void 0) response.data.attributes.description = JSON.stringify(data.description);
5303
5349
  if (data.pages !== void 0) response.data.attributes.pages = data.pages;
5350
+ if (data.howToType !== void 0) response.data.attributes.howToType = data.howToType;
5351
+ if (data.slug !== void 0) response.data.attributes.slug = data.slug;
5352
+ if (data.order !== void 0) response.data.attributes.order = data.order;
5353
+ if (data.summary !== void 0) response.data.attributes.summary = data.summary;
5354
+ if (data.tags !== void 0) response.data.attributes.tags = data.tags;
5355
+ if (data.contextualKeys !== void 0) response.data.attributes.contextualKeys = data.contextualKeys;
5356
+ if (data.draft !== void 0) response.data.attributes.draft = data.draft;
5304
5357
  return response;
5305
5358
  }
5306
5359
  };
@@ -5314,7 +5367,20 @@ var HowToModule = /* @__PURE__ */ __name((factory) => factory({
5314
5367
  icon: LifeBuoyIcon,
5315
5368
  inclusions: {
5316
5369
  lists: {
5317
- fields: [createJsonApiInclusion("howtos", [`name`, `description`, `pages`])]
5370
+ fields: [
5371
+ createJsonApiInclusion("howtos", [
5372
+ "name",
5373
+ "description",
5374
+ "pages",
5375
+ "howToType",
5376
+ "slug",
5377
+ "order",
5378
+ "summary",
5379
+ "tags",
5380
+ "contextualKeys",
5381
+ "draft"
5382
+ ])
5383
+ ]
5318
5384
  }
5319
5385
  }
5320
5386
  }), "HowToModule");
@@ -5378,6 +5444,62 @@ var HowToService = class extends AbstractService {
5378
5444
  endpoint: new EndpointCreator({ endpoint: Modules.HowTo, id: params.howToId }).generate()
5379
5445
  });
5380
5446
  }
5447
+ static async findPublished(params = {}) {
5448
+ const endpoint = new EndpointCreator({ endpoint: `public/${Modules.HowTo.name}` });
5449
+ if (params.howToType) endpoint.addAdditionalParam("type", params.howToType);
5450
+ return this.callApi({
5451
+ type: Modules.HowTo,
5452
+ method: "GET" /* GET */,
5453
+ endpoint: endpoint.generate()
5454
+ });
5455
+ }
5456
+ static async findPublishedArticle(params) {
5457
+ return this.callApi({
5458
+ type: Modules.HowTo,
5459
+ method: "GET" /* GET */,
5460
+ endpoint: new EndpointCreator({
5461
+ endpoint: `public/${Modules.HowTo.name}`,
5462
+ id: params.howToType,
5463
+ childEndpoint: params.slug
5464
+ }).generate()
5465
+ });
5466
+ }
5467
+ static async findRelated(params) {
5468
+ return this.callApi({
5469
+ type: Modules.HowTo,
5470
+ method: "GET" /* GET */,
5471
+ endpoint: new EndpointCreator({
5472
+ endpoint: `public/${Modules.HowTo.name}`,
5473
+ id: params.howToType,
5474
+ childEndpoint: params.slug,
5475
+ childId: "related"
5476
+ }).generate()
5477
+ });
5478
+ }
5479
+ static async addRelated(params) {
5480
+ return this.callApi({
5481
+ type: Modules.HowTo,
5482
+ method: "POST" /* POST */,
5483
+ endpoint: new EndpointCreator({
5484
+ endpoint: Modules.HowTo,
5485
+ id: params.howToId,
5486
+ childEndpoint: "related",
5487
+ childId: params.relatedId
5488
+ }).generate()
5489
+ });
5490
+ }
5491
+ static async removeRelated(params) {
5492
+ await this.callApi({
5493
+ type: Modules.HowTo,
5494
+ method: "DELETE" /* DELETE */,
5495
+ endpoint: new EndpointCreator({
5496
+ endpoint: Modules.HowTo,
5497
+ id: params.howToId,
5498
+ childEndpoint: "related",
5499
+ childId: params.relatedId
5500
+ }).generate()
5501
+ });
5502
+ }
5381
5503
  };
5382
5504
 
5383
5505
  // src/features/assistant/AssistantModule.ts
@@ -5410,7 +5532,9 @@ var Assistant = class extends AbstractApiData {
5410
5532
  type: Modules.Assistant.name,
5411
5533
  attributes: {
5412
5534
  content: data.firstMessage,
5413
- ...data.title !== void 0 ? { title: data.title } : {}
5535
+ ...data.title !== void 0 ? { title: data.title } : {},
5536
+ ...data.howToMode !== void 0 ? { howToMode: data.howToMode } : {},
5537
+ ...data.limitToHowToId !== void 0 ? { limitToHowToId: data.limitToHowToId } : {}
5414
5538
  }
5415
5539
  },
5416
5540
  included: []
@@ -5433,83 +5557,8 @@ var AssistantModule = /* @__PURE__ */ __name((factory) => factory({
5433
5557
  }
5434
5558
  }), "AssistantModule");
5435
5559
 
5436
- // src/features/assistant/data/AssistantService.ts
5437
- var AssistantService = class extends AbstractService {
5438
- static {
5439
- __name(this, "AssistantService");
5440
- }
5441
- static async findOne(params) {
5442
- return this.callApi({
5443
- type: Modules.Assistant,
5444
- method: "GET" /* GET */,
5445
- endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate()
5446
- });
5447
- }
5448
- static async findMany(params = {}) {
5449
- const endpoint = new EndpointCreator({ endpoint: Modules.Assistant });
5450
- if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
5451
- return this.callApi({
5452
- type: Modules.Assistant,
5453
- method: "GET" /* GET */,
5454
- endpoint: endpoint.generate()
5455
- });
5456
- }
5457
- static async create(params) {
5458
- return this.callApi({
5459
- type: Modules.Assistant,
5460
- method: "POST" /* POST */,
5461
- endpoint: new EndpointCreator({ endpoint: Modules.Assistant }).generate(),
5462
- input: params
5463
- });
5464
- }
5465
- /**
5466
- * Sends a new user message to an existing assistant thread. The agent turn
5467
- * runs synchronously; the response is a two-element list: [user, assistant].
5468
- */
5469
- static async appendMessage(params) {
5470
- return this.callApi({
5471
- type: Modules.AssistantMessage,
5472
- method: "POST" /* POST */,
5473
- endpoint: new EndpointCreator({
5474
- endpoint: Modules.Assistant,
5475
- id: params.assistantId,
5476
- childEndpoint: Modules.AssistantMessage
5477
- }).generate(),
5478
- input: {
5479
- data: {
5480
- type: Modules.AssistantMessage.name,
5481
- attributes: { content: params.content }
5482
- }
5483
- },
5484
- overridesJsonApiCreation: true
5485
- });
5486
- }
5487
- static async rename(params) {
5488
- await this.callApi({
5489
- type: Modules.Assistant,
5490
- method: "PATCH" /* PATCH */,
5491
- endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate(),
5492
- input: {
5493
- data: {
5494
- type: Modules.Assistant.name,
5495
- id: params.id,
5496
- attributes: { title: params.title }
5497
- }
5498
- },
5499
- overridesJsonApiCreation: true
5500
- });
5501
- }
5502
- static async delete(params) {
5503
- await this.callApi({
5504
- type: Modules.Assistant,
5505
- method: "DELETE" /* DELETE */,
5506
- endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate()
5507
- });
5508
- }
5509
- };
5510
-
5511
- // src/features/assistant-message/AssistantMessageModule.ts
5512
- import { MessageSquareIcon } from "lucide-react";
5560
+ // src/features/assistant-message/data/AssistantMessage.ts
5561
+ import { v4 as uuidv4 } from "uuid";
5513
5562
 
5514
5563
  // src/features/assistant/utils/resolveReferenceableModules.ts
5515
5564
  function resolveReferenceableModules() {
@@ -5533,6 +5582,7 @@ var AssistantMessage = class _AssistantMessage extends AbstractApiData {
5533
5582
  _outputTokens;
5534
5583
  _references;
5535
5584
  _citations;
5585
+ _isOptimistic = false;
5536
5586
  get role() {
5537
5587
  return this._role ?? "assistant";
5538
5588
  }
@@ -5557,6 +5607,9 @@ var AssistantMessage = class _AssistantMessage extends AbstractApiData {
5557
5607
  get citations() {
5558
5608
  return this._citations ?? [];
5559
5609
  }
5610
+ get isOptimistic() {
5611
+ return this._isOptimistic;
5612
+ }
5560
5613
  rehydrate(data) {
5561
5614
  super.rehydrate(data);
5562
5615
  const attrs = data.jsonApi.attributes ?? {};
@@ -5599,10 +5652,28 @@ var AssistantMessage = class _AssistantMessage extends AbstractApiData {
5599
5652
  included: []
5600
5653
  };
5601
5654
  }
5655
+ /**
5656
+ * JSON:API envelope for POST /assistants/:id/assistant-messages.
5657
+ * Different from `createJsonApi` (which expects a full message with role/position/assistant ref);
5658
+ * the append-to-thread endpoint derives those server-side, so we only send `content` and
5659
+ * the optional retrieval-mode flags.
5660
+ */
5661
+ createAppendMessageJsonApi(params) {
5662
+ return {
5663
+ data: {
5664
+ type: Modules.AssistantMessage.name,
5665
+ attributes: {
5666
+ content: params.content,
5667
+ ...params.howToMode !== void 0 ? { howToMode: params.howToMode } : {},
5668
+ ...params.limitToHowToId !== void 0 ? { limitToHowToId: params.limitToHowToId } : {}
5669
+ }
5670
+ }
5671
+ };
5672
+ }
5602
5673
  static buildOptimistic(params) {
5603
5674
  const msg = new _AssistantMessage();
5604
5675
  const jsonApi = {
5605
- id: `tmp-${crypto.randomUUID()}`,
5676
+ id: uuidv4(),
5606
5677
  type: Modules.AssistantMessage.name,
5607
5678
  attributes: {
5608
5679
  role: "user",
@@ -5616,11 +5687,92 @@ var AssistantMessage = class _AssistantMessage extends AbstractApiData {
5616
5687
  };
5617
5688
  }
5618
5689
  msg.rehydrate({ jsonApi, included: [] });
5690
+ msg._isOptimistic = true;
5619
5691
  return msg;
5620
5692
  }
5621
5693
  };
5622
5694
 
5695
+ // src/features/assistant/data/AssistantService.ts
5696
+ var AssistantService = class extends AbstractService {
5697
+ static {
5698
+ __name(this, "AssistantService");
5699
+ }
5700
+ static async findOne(params) {
5701
+ return this.callApi({
5702
+ type: Modules.Assistant,
5703
+ method: "GET" /* GET */,
5704
+ endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate()
5705
+ });
5706
+ }
5707
+ static async findMany(params = {}) {
5708
+ const endpoint = new EndpointCreator({ endpoint: Modules.Assistant });
5709
+ if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
5710
+ return this.callApi({
5711
+ type: Modules.Assistant,
5712
+ method: "GET" /* GET */,
5713
+ endpoint: endpoint.generate()
5714
+ });
5715
+ }
5716
+ static async create(params) {
5717
+ return this.callApi({
5718
+ type: Modules.Assistant,
5719
+ method: "POST" /* POST */,
5720
+ endpoint: new EndpointCreator({ endpoint: Modules.Assistant }).generate(),
5721
+ input: params
5722
+ });
5723
+ }
5724
+ /**
5725
+ * Sends a new user message to an existing assistant thread. The agent turn
5726
+ * runs synchronously; the response is a two-element list: [user, assistant].
5727
+ *
5728
+ * Uses the dedicated AssistantMessage.createAppendMessageJsonApi method to
5729
+ * build the JSON:API envelope; this is the architecture-compliant pairing
5730
+ * with `overridesJsonApiCreation: true`.
5731
+ */
5732
+ static async appendMessage(params) {
5733
+ const message = new AssistantMessage();
5734
+ return this.callApi({
5735
+ type: Modules.AssistantMessage,
5736
+ method: "POST" /* POST */,
5737
+ endpoint: new EndpointCreator({
5738
+ endpoint: Modules.Assistant,
5739
+ id: params.assistantId,
5740
+ childEndpoint: Modules.AssistantMessage
5741
+ }).generate(),
5742
+ input: message.createAppendMessageJsonApi({
5743
+ content: params.content,
5744
+ howToMode: params.howToMode,
5745
+ limitToHowToId: params.limitToHowToId
5746
+ }),
5747
+ overridesJsonApiCreation: true
5748
+ });
5749
+ }
5750
+ static async rename(params) {
5751
+ await this.callApi({
5752
+ type: Modules.Assistant,
5753
+ method: "PATCH" /* PATCH */,
5754
+ endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate(),
5755
+ input: {
5756
+ data: {
5757
+ type: Modules.Assistant.name,
5758
+ id: params.id,
5759
+ attributes: { title: params.title }
5760
+ }
5761
+ },
5762
+ overridesJsonApiCreation: true
5763
+ });
5764
+ }
5765
+ static async delete(params) {
5766
+ await this.callApi({
5767
+ type: Modules.Assistant,
5768
+ method: "DELETE" /* DELETE */,
5769
+ endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate()
5770
+ });
5771
+ }
5772
+ };
5773
+
5623
5774
  // src/features/assistant-message/AssistantMessageModule.ts
5775
+ import { MessageSquareIcon } from "lucide-react";
5624
5776
  var AssistantMessageModule = /* @__PURE__ */ __name((factory) => factory({
5625
5777
  pageUrl: "/assistant-messages",
5626
5778
  name: "assistant-messages",
@@ -7564,8 +7716,8 @@ export {
7564
7716
  HowToService,
7565
7717
  Assistant,
7566
7718
  AssistantModule,
7567
- AssistantService,
7568
7719
  AssistantMessage,
7720
+ AssistantService,
7569
7721
  AssistantMessageModule,
7570
7722
  AssistantMessageService,
7571
7723
  Chunk,
@@ -7619,4 +7771,4 @@ export {
7619
7771
  AuditLogService,
7620
7772
  AuditLogModule
7621
7773
  };
7622
- //# sourceMappingURL=chunk-N3NVIPSU.mjs.map
7774
+ //# sourceMappingURL=chunk-ZYPNVEHB.mjs.map