@carlonicora/nextjs-jsonapi 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssistantInterface-DMh-zApr.d.mts +34 -0
- package/dist/AssistantInterface-DwdBzS9f.d.ts +34 -0
- package/dist/{BlockNoteEditor-QMZLV62B.js → BlockNoteEditor-DTW2BWIU.js} +22 -20
- package/dist/BlockNoteEditor-DTW2BWIU.js.map +1 -0
- package/dist/{BlockNoteEditor-QGEOVS3T.mjs → BlockNoteEditor-T7TIA5KG.mjs} +7 -5
- package/dist/BlockNoteEditor-T7TIA5KG.mjs.map +1 -0
- package/dist/{BlockNoteViewer-UW5VZ5UF.js → BlockNoteViewer-6N2GQWTI.js} +4 -2
- package/dist/BlockNoteViewer-6N2GQWTI.js.map +1 -0
- package/dist/{BlockNoteViewer-OPSCTHKJ.mjs → BlockNoteViewer-IBQRJ3WM.mjs} +4 -2
- package/dist/BlockNoteViewer-IBQRJ3WM.mjs.map +1 -0
- package/dist/billing/index.js +357 -357
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-DS4IBFWA.js → chunk-6YIZX26T.js} +185 -33
- package/dist/chunk-6YIZX26T.js.map +1 -0
- package/dist/{chunk-PBKZYJRJ.js → chunk-C5SETS2R.js} +1258 -895
- package/dist/chunk-C5SETS2R.js.map +1 -0
- package/dist/{chunk-UXJAS6C5.js → chunk-JG7MCYCW.js} +7 -7
- package/dist/{chunk-UXJAS6C5.js.map → chunk-JG7MCYCW.js.map} +1 -1
- package/dist/{chunk-HN5ED7OF.mjs → chunk-MAWTFEY3.mjs} +2 -2
- package/dist/{chunk-QHGSBZCL.mjs → chunk-MOMRJHT3.mjs} +1100 -737
- package/dist/chunk-MOMRJHT3.mjs.map +1 -0
- package/dist/{chunk-BIL2WQEV.mjs → chunk-P5TMD7GK.mjs} +158 -6
- package/dist/chunk-P5TMD7GK.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +102 -11
- package/dist/components/index.d.ts +102 -11
- package/dist/components/index.js +12 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -3
- package/dist/contexts/index.d.mts +29 -3
- package/dist/contexts/index.d.ts +29 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +99 -2
- package/dist/core/index.d.ts +99 -2
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +71 -71
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +5 -1
- package/src/components/editors/BlockNoteEditorSuggestionMenuController.tsx +14 -2
- package/src/components/index.ts +1 -0
- package/src/components/viewers/BlockNoteViewer.tsx +5 -1
- package/src/core/index.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +1 -0
- package/src/features/assistant/components/containers/AssistantPageContainer.tsx +123 -0
- package/src/features/assistant/components/index.ts +2 -0
- package/src/features/assistant/components/parts/AssistantBlockNoteComposer.tsx +135 -0
- package/src/features/assistant/components/parts/AssistantThread.tsx +4 -1
- package/src/features/assistant/contexts/AssistantContext.tsx +60 -13
- package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +81 -0
- package/src/features/assistant/data/Assistant.ts +29 -1
- package/src/features/assistant/data/AssistantInterface.ts +15 -0
- package/src/features/assistant/data/AssistantService.ts +19 -2
- package/src/features/assistant/data/__tests__/Assistant.scope.spec.ts +64 -0
- package/src/features/assistant-action/AssistantActionModule.ts +13 -0
- package/src/features/assistant-action/components/ApprovalActionCard.tsx +127 -0
- package/src/features/assistant-action/components/AssistantContainerWithApprovals.tsx +34 -0
- package/src/features/assistant-action/components/index.ts +2 -0
- package/src/features/assistant-action/data/AssistantAction.ts +58 -0
- package/src/features/assistant-action/data/AssistantActionInterface.ts +24 -0
- package/src/features/assistant-action/data/AssistantActionService.ts +51 -0
- package/src/features/assistant-action/data/__tests__/AssistantAction.spec.ts +171 -0
- package/src/features/assistant-action/data/index.ts +3 -0
- package/src/features/assistant-action/index.ts +2 -0
- package/src/features/assistant-message/components/MessageItem.tsx +57 -6
- package/src/features/assistant-message/components/MessageList.tsx +11 -2
- package/src/features/assistant-message/components/__tests__/MessageItem.mentions.spec.tsx +34 -0
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +30 -13
- package/src/features/assistant-message/components/parts/tabs/CitationsTab.tsx +23 -5
- package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +3 -1
- package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +4 -1
- package/src/features/assistant-message/components/parts/tabs/useEntityLabel.ts +35 -0
- package/src/features/assistant-message/data/AssistantMessage.ts +11 -2
- package/src/features/company/components/details/TokenStatusIndicator.tsx +18 -4
- package/src/features/index.ts +1 -0
- package/dist/AssistantInterface-B56qznuH.d.mts +0 -16
- package/dist/AssistantInterface-CHiJIYDY.d.ts +0 -16
- package/dist/BlockNoteEditor-QGEOVS3T.mjs.map +0 -1
- package/dist/BlockNoteEditor-QMZLV62B.js.map +0 -1
- package/dist/BlockNoteViewer-OPSCTHKJ.mjs.map +0 -1
- package/dist/BlockNoteViewer-UW5VZ5UF.js.map +0 -1
- package/dist/chunk-BIL2WQEV.mjs.map +0 -1
- package/dist/chunk-DS4IBFWA.js.map +0 -1
- package/dist/chunk-PBKZYJRJ.js.map +0 -1
- package/dist/chunk-QHGSBZCL.mjs.map +0 -1
- /package/dist/{chunk-HN5ED7OF.mjs.map → chunk-MAWTFEY3.mjs.map} +0 -0
|
@@ -5637,6 +5637,8 @@ var Assistant = class extends AbstractApiData {
|
|
|
5637
5637
|
_title;
|
|
5638
5638
|
_messageCount;
|
|
5639
5639
|
_engine;
|
|
5640
|
+
_boundContentType;
|
|
5641
|
+
_boundContentId;
|
|
5640
5642
|
get title() {
|
|
5641
5643
|
return this._title ?? "";
|
|
5642
5644
|
}
|
|
@@ -5646,6 +5648,12 @@ var Assistant = class extends AbstractApiData {
|
|
|
5646
5648
|
get engine() {
|
|
5647
5649
|
return this._engine;
|
|
5648
5650
|
}
|
|
5651
|
+
get boundContentType() {
|
|
5652
|
+
return this._boundContentType;
|
|
5653
|
+
}
|
|
5654
|
+
get boundContentId() {
|
|
5655
|
+
return this._boundContentId;
|
|
5656
|
+
}
|
|
5649
5657
|
rehydrate(data) {
|
|
5650
5658
|
super.rehydrate(data);
|
|
5651
5659
|
this._title = data.jsonApi.attributes?.title;
|
|
@@ -5653,6 +5661,10 @@ var Assistant = class extends AbstractApiData {
|
|
|
5653
5661
|
const fromMeta = data.jsonApi.meta?.messageCount;
|
|
5654
5662
|
const fromAttrs = data.jsonApi.attributes?.messageCount;
|
|
5655
5663
|
this._messageCount = typeof fromMeta === "number" ? fromMeta : typeof fromAttrs === "number" ? fromAttrs : 0;
|
|
5664
|
+
const contentLinkage = data.jsonApi.relationships?.content?.data;
|
|
5665
|
+
const boundContent = Array.isArray(contentLinkage) ? contentLinkage[0] : contentLinkage;
|
|
5666
|
+
this._boundContentType = boundContent?.type;
|
|
5667
|
+
this._boundContentId = boundContent?.id;
|
|
5656
5668
|
return this;
|
|
5657
5669
|
}
|
|
5658
5670
|
createJsonApi(data) {
|
|
@@ -5660,11 +5672,20 @@ var Assistant = class extends AbstractApiData {
|
|
|
5660
5672
|
data: {
|
|
5661
5673
|
type: Modules.Assistant.name,
|
|
5662
5674
|
attributes: {
|
|
5663
|
-
|
|
5675
|
+
// narr8 convention for BlockNote-backed fields: the document travels
|
|
5676
|
+
// as a JSON string in the entity's own string attribute, exactly as
|
|
5677
|
+
// Npc.description does (`JSON.stringify` out, `JSON.parse` back).
|
|
5678
|
+
// The server detects the shape and derives the stored markdown.
|
|
5679
|
+
content: data.contentBlocks !== void 0 ? JSON.stringify(data.contentBlocks) : data.firstMessage,
|
|
5664
5680
|
...data.title !== void 0 ? { title: data.title } : {},
|
|
5665
5681
|
...data.howToMode !== void 0 ? { howToMode: data.howToMode } : {},
|
|
5666
5682
|
...data.limitToHowToId !== void 0 ? { limitToHowToId: data.limitToHowToId } : {}
|
|
5667
|
-
}
|
|
5683
|
+
},
|
|
5684
|
+
...data.boundContent !== void 0 ? {
|
|
5685
|
+
relationships: {
|
|
5686
|
+
content: { data: { type: data.boundContent.type, id: data.boundContent.id } }
|
|
5687
|
+
}
|
|
5688
|
+
} : {}
|
|
5668
5689
|
},
|
|
5669
5690
|
included: []
|
|
5670
5691
|
};
|
|
@@ -5803,7 +5824,11 @@ var AssistantMessage = class _AssistantMessage extends AbstractApiData {
|
|
|
5803
5824
|
data: {
|
|
5804
5825
|
type: Modules.AssistantMessage.name,
|
|
5805
5826
|
attributes: {
|
|
5806
|
-
|
|
5827
|
+
// narr8 convention for BlockNote-backed fields: the document travels
|
|
5828
|
+
// as a JSON string in the field's own string attribute (see
|
|
5829
|
+
// Npc.description). The server detects the shape and derives the
|
|
5830
|
+
// stored markdown from it.
|
|
5831
|
+
content: params.contentBlocks !== void 0 ? JSON.stringify(params.contentBlocks) : params.content,
|
|
5807
5832
|
...params.howToMode !== void 0 ? { howToMode: params.howToMode } : {},
|
|
5808
5833
|
...params.limitToHowToId !== void 0 ? { limitToHowToId: params.limitToHowToId } : {}
|
|
5809
5834
|
}
|
|
@@ -5844,9 +5869,16 @@ var AssistantService = class extends AbstractService {
|
|
|
5844
5869
|
endpoint: new EndpointCreator({ endpoint: Modules.Assistant, id: params.id }).generate()
|
|
5845
5870
|
});
|
|
5846
5871
|
}
|
|
5872
|
+
/**
|
|
5873
|
+
* Lists threads. `boundType`/`boundId` narrow the list to the threads bound
|
|
5874
|
+
* to one resource (e.g. a campaign), so a scoped surface never shows the
|
|
5875
|
+
* user's unrelated threads.
|
|
5876
|
+
*/
|
|
5847
5877
|
static async findMany(params = {}) {
|
|
5848
5878
|
const endpoint = new EndpointCreator({ endpoint: Modules.Assistant });
|
|
5849
5879
|
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
5880
|
+
if (params.boundType) endpoint.addAdditionalParam("boundType", params.boundType);
|
|
5881
|
+
if (params.boundId) endpoint.addAdditionalParam("boundId", params.boundId);
|
|
5850
5882
|
return this.callApi({
|
|
5851
5883
|
type: Modules.Assistant,
|
|
5852
5884
|
method: "GET" /* GET */,
|
|
@@ -5895,7 +5927,8 @@ var AssistantService = class extends AbstractService {
|
|
|
5895
5927
|
input: message.createAppendMessageJsonApi({
|
|
5896
5928
|
content: params.content,
|
|
5897
5929
|
howToMode: params.howToMode,
|
|
5898
|
-
limitToHowToId: params.limitToHowToId
|
|
5930
|
+
limitToHowToId: params.limitToHowToId,
|
|
5931
|
+
contentBlocks: params.contentBlocks
|
|
5899
5932
|
}),
|
|
5900
5933
|
overridesJsonApiCreation: true
|
|
5901
5934
|
});
|
|
@@ -5916,7 +5949,10 @@ var AssistantService = class extends AbstractService {
|
|
|
5916
5949
|
id: params.assistantId,
|
|
5917
5950
|
childEndpoint: Modules.AssistantMessage
|
|
5918
5951
|
}).generate(),
|
|
5919
|
-
input: message.createAppendMessageJsonApi({
|
|
5952
|
+
input: message.createAppendMessageJsonApi({
|
|
5953
|
+
content: params.content,
|
|
5954
|
+
contentBlocks: params.contentBlocks
|
|
5955
|
+
}),
|
|
5920
5956
|
overridesJsonApiCreation: true
|
|
5921
5957
|
});
|
|
5922
5958
|
}
|
|
@@ -6024,6 +6060,119 @@ var AssistantMessageService = class extends AbstractService {
|
|
|
6024
6060
|
}
|
|
6025
6061
|
};
|
|
6026
6062
|
|
|
6063
|
+
// src/features/assistant-action/AssistantActionModule.ts
|
|
6064
|
+
import { ShieldCheckIcon } from "lucide-react";
|
|
6065
|
+
|
|
6066
|
+
// src/features/assistant-action/data/AssistantAction.ts
|
|
6067
|
+
var AssistantAction = class extends AbstractApiData {
|
|
6068
|
+
static {
|
|
6069
|
+
__name(this, "AssistantAction");
|
|
6070
|
+
}
|
|
6071
|
+
_status;
|
|
6072
|
+
_toolName;
|
|
6073
|
+
_summary;
|
|
6074
|
+
_resolvedAt;
|
|
6075
|
+
_expiresAt;
|
|
6076
|
+
get status() {
|
|
6077
|
+
return this._status ?? "expired";
|
|
6078
|
+
}
|
|
6079
|
+
get toolName() {
|
|
6080
|
+
return this._toolName ?? "";
|
|
6081
|
+
}
|
|
6082
|
+
get summary() {
|
|
6083
|
+
return this._summary ?? "";
|
|
6084
|
+
}
|
|
6085
|
+
get resolvedAt() {
|
|
6086
|
+
return this._resolvedAt;
|
|
6087
|
+
}
|
|
6088
|
+
get expiresAt() {
|
|
6089
|
+
return this._expiresAt;
|
|
6090
|
+
}
|
|
6091
|
+
rehydrate(data) {
|
|
6092
|
+
super.rehydrate(data);
|
|
6093
|
+
this._status = data.jsonApi.attributes.status;
|
|
6094
|
+
this._toolName = data.jsonApi.attributes.toolName;
|
|
6095
|
+
this._summary = data.jsonApi.attributes.summary;
|
|
6096
|
+
this._resolvedAt = data.jsonApi.attributes.resolvedAt ? new Date(data.jsonApi.attributes.resolvedAt) : void 0;
|
|
6097
|
+
this._expiresAt = data.jsonApi.attributes.expiresAt ? new Date(data.jsonApi.attributes.expiresAt) : void 0;
|
|
6098
|
+
return this;
|
|
6099
|
+
}
|
|
6100
|
+
/**
|
|
6101
|
+
* Minimal payload (id only): the frontend never POSTs assistant actions —
|
|
6102
|
+
* approve/deny are body-less POSTs handled by AssistantActionService.
|
|
6103
|
+
*/
|
|
6104
|
+
createJsonApi(data) {
|
|
6105
|
+
return {
|
|
6106
|
+
data: {
|
|
6107
|
+
type: Modules.AssistantAction.name,
|
|
6108
|
+
id: data.id,
|
|
6109
|
+
attributes: {}
|
|
6110
|
+
},
|
|
6111
|
+
included: []
|
|
6112
|
+
};
|
|
6113
|
+
}
|
|
6114
|
+
};
|
|
6115
|
+
|
|
6116
|
+
// src/features/assistant-action/AssistantActionModule.ts
|
|
6117
|
+
var AssistantActionModule = /* @__PURE__ */ __name((factory) => factory({
|
|
6118
|
+
pageUrl: "/assistant-actions",
|
|
6119
|
+
name: "assistant-actions",
|
|
6120
|
+
model: AssistantAction,
|
|
6121
|
+
identifier: ["summary"],
|
|
6122
|
+
moduleId: "e3c27517-bac0-43cb-adff-cc20c4210c12",
|
|
6123
|
+
icon: ShieldCheckIcon
|
|
6124
|
+
}), "AssistantActionModule");
|
|
6125
|
+
|
|
6126
|
+
// src/features/assistant-action/data/AssistantActionService.ts
|
|
6127
|
+
var AssistantActionService = class extends AbstractService {
|
|
6128
|
+
static {
|
|
6129
|
+
__name(this, "AssistantActionService");
|
|
6130
|
+
}
|
|
6131
|
+
/**
|
|
6132
|
+
* GET single assistant action by ID
|
|
6133
|
+
*/
|
|
6134
|
+
static async findOne(params) {
|
|
6135
|
+
return this.callApi({
|
|
6136
|
+
type: Modules.AssistantAction,
|
|
6137
|
+
method: "GET" /* GET */,
|
|
6138
|
+
endpoint: new EndpointCreator({
|
|
6139
|
+
endpoint: Modules.AssistantAction,
|
|
6140
|
+
id: params.id
|
|
6141
|
+
}).generate()
|
|
6142
|
+
});
|
|
6143
|
+
}
|
|
6144
|
+
/**
|
|
6145
|
+
* POST (body-less) approve action — resumes the paused run and
|
|
6146
|
+
* returns the resumed assistant message.
|
|
6147
|
+
*/
|
|
6148
|
+
static async approve(params) {
|
|
6149
|
+
return this.callApi({
|
|
6150
|
+
type: Modules.AssistantMessage,
|
|
6151
|
+
method: "POST" /* POST */,
|
|
6152
|
+
endpoint: new EndpointCreator({
|
|
6153
|
+
endpoint: Modules.AssistantAction,
|
|
6154
|
+
id: params.id,
|
|
6155
|
+
childEndpoint: "approve"
|
|
6156
|
+
}).generate()
|
|
6157
|
+
});
|
|
6158
|
+
}
|
|
6159
|
+
/**
|
|
6160
|
+
* POST (body-less) deny action — resumes the paused run with a denial and
|
|
6161
|
+
* returns the resumed assistant message.
|
|
6162
|
+
*/
|
|
6163
|
+
static async deny(params) {
|
|
6164
|
+
return this.callApi({
|
|
6165
|
+
type: Modules.AssistantMessage,
|
|
6166
|
+
method: "POST" /* POST */,
|
|
6167
|
+
endpoint: new EndpointCreator({
|
|
6168
|
+
endpoint: Modules.AssistantAction,
|
|
6169
|
+
id: params.id,
|
|
6170
|
+
childEndpoint: "deny"
|
|
6171
|
+
}).generate()
|
|
6172
|
+
});
|
|
6173
|
+
}
|
|
6174
|
+
};
|
|
6175
|
+
|
|
6027
6176
|
// src/features/chunk/ChunkModule.ts
|
|
6028
6177
|
import { FileTextIcon } from "lucide-react";
|
|
6029
6178
|
|
|
@@ -8158,6 +8307,9 @@ export {
|
|
|
8158
8307
|
AssistantService,
|
|
8159
8308
|
AssistantMessageModule,
|
|
8160
8309
|
AssistantMessageService,
|
|
8310
|
+
AssistantAction,
|
|
8311
|
+
AssistantActionModule,
|
|
8312
|
+
AssistantActionService,
|
|
8161
8313
|
Chunk,
|
|
8162
8314
|
ChunkModule,
|
|
8163
8315
|
Feature,
|
|
@@ -8215,4 +8367,4 @@ export {
|
|
|
8215
8367
|
AuditLogService,
|
|
8216
8368
|
AuditLogModule
|
|
8217
8369
|
};
|
|
8218
|
-
//# sourceMappingURL=chunk-
|
|
8370
|
+
//# sourceMappingURL=chunk-P5TMD7GK.mjs.map
|