@webiny/app-admin 6.6.0-alpha.11 → 6.6.0-alpha.12
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/base/Admin.js +2 -0
- package/base/Admin.js.map +1 -1
- package/base/createRootContainer.js +2 -0
- package/base/createRootContainer.js.map +1 -1
- package/base/resolveApiUrl.js +3 -2
- package/base/resolveApiUrl.js.map +1 -1
- package/components/SimpleForm/SimpleForm.js +2 -2
- package/components/SimpleForm/SimpleForm.js.map +1 -1
- package/features/accessManagement/roles/roleEvents/ApplyRoleChangeToCache.d.ts +17 -0
- package/features/accessManagement/roles/roleEvents/ApplyRoleChangeToCache.js +26 -0
- package/features/accessManagement/roles/roleEvents/ApplyRoleChangeToCache.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/abstractions.d.ts +0 -25
- package/features/accessManagement/roles/roleEvents/abstractions.js +1 -4
- package/features/accessManagement/roles/roleEvents/abstractions.js.map +1 -1
- package/features/accessManagement/roles/roleEvents/feature.js +2 -8
- package/features/accessManagement/roles/roleEvents/feature.js.map +1 -1
- package/features/accessManagement/teams/teamEvents/ApplyTeamChangeToCache.d.ts +17 -0
- package/features/accessManagement/teams/teamEvents/ApplyTeamChangeToCache.js +26 -0
- package/features/accessManagement/teams/teamEvents/ApplyTeamChangeToCache.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/abstractions.d.ts +0 -25
- package/features/accessManagement/teams/teamEvents/abstractions.js +1 -4
- package/features/accessManagement/teams/teamEvents/abstractions.js.map +1 -1
- package/features/accessManagement/teams/teamEvents/feature.js +2 -8
- package/features/accessManagement/teams/teamEvents/feature.js.map +1 -1
- package/features/adminAssistant/AdminAssistantGateway.js +1 -0
- package/features/adminAssistant/AdminAssistantGateway.js.map +1 -1
- package/features/adminAssistant/AdminAssistantPresenter.d.ts +8 -1
- package/features/adminAssistant/AdminAssistantPresenter.js +17 -9
- package/features/adminAssistant/AdminAssistantPresenter.js.map +1 -1
- package/features/adminAssistant/abstractions.d.ts +3 -0
- package/features/adminAssistant/abstractions.js.map +1 -1
- package/features/adminUsers/users/userEvents/MarkUsersChanged.d.ts +16 -0
- package/features/adminUsers/users/userEvents/MarkUsersChanged.js +23 -0
- package/features/adminUsers/users/userEvents/MarkUsersChanged.js.map +1 -0
- package/features/adminUsers/users/userEvents/UsersRevision.d.ts +13 -0
- package/features/adminUsers/users/userEvents/UsersRevision.js +25 -0
- package/features/adminUsers/users/userEvents/UsersRevision.js.map +1 -0
- package/features/adminUsers/users/userEvents/abstractions.d.ts +17 -0
- package/features/adminUsers/users/userEvents/abstractions.js +5 -0
- package/features/adminUsers/users/userEvents/abstractions.js.map +1 -0
- package/features/adminUsers/users/userEvents/feature.d.ts +4 -0
- package/features/adminUsers/users/userEvents/feature.js +19 -0
- package/features/adminUsers/users/userEvents/feature.js.map +1 -0
- package/features/adminUsers/users/userEvents/index.d.ts +1 -0
- package/features/adminUsers/users/userEvents/index.js +1 -0
- package/features/assistantPageContext/AssistantPageContext.d.ts +12 -0
- package/features/assistantPageContext/AssistantPageContext.js +32 -0
- package/features/assistantPageContext/AssistantPageContext.js.map +1 -0
- package/features/assistantPageContext/abstractions.d.ts +33 -0
- package/features/assistantPageContext/abstractions.js +5 -0
- package/features/assistantPageContext/abstractions.js.map +1 -0
- package/features/assistantPageContext/feature.d.ts +3 -0
- package/features/assistantPageContext/feature.js +17 -0
- package/features/assistantPageContext/feature.js.map +1 -0
- package/features/assistantPageContext/index.d.ts +2 -0
- package/features/assistantPageContext/index.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/package.json +20 -20
- package/presentation/accessManagement/apiKeys/ApiKeysDataSource.d.ts +5 -6
- package/presentation/accessManagement/apiKeys/ApiKeysDataSource.js +12 -13
- package/presentation/accessManagement/apiKeys/ApiKeysDataSource.js.map +1 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.d.ts +5 -0
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js +32 -2
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js.map +1 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.test.d.ts +1 -0
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.test.js +87 -0
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.test.js.map +1 -0
- package/presentation/accessManagement/apiKeys/abstractions.d.ts +2 -0
- package/presentation/accessManagement/apiKeys/abstractions.js.map +1 -1
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js +13 -37
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js.map +1 -1
- package/presentation/accessManagement/roles/RolesDataSource.d.ts +5 -6
- package/presentation/accessManagement/roles/RolesDataSource.js +12 -13
- package/presentation/accessManagement/roles/RolesDataSource.js.map +1 -1
- package/presentation/accessManagement/roles/RolesPresenter.d.ts +5 -0
- package/presentation/accessManagement/roles/RolesPresenter.js +32 -2
- package/presentation/accessManagement/roles/RolesPresenter.js.map +1 -1
- package/presentation/accessManagement/roles/RolesPresenter.test.d.ts +1 -0
- package/presentation/accessManagement/roles/RolesPresenter.test.js +168 -0
- package/presentation/accessManagement/roles/RolesPresenter.test.js.map +1 -0
- package/presentation/accessManagement/roles/abstractions.d.ts +2 -0
- package/presentation/accessManagement/roles/abstractions.js.map +1 -1
- package/presentation/accessManagement/roles/components/RolesDataList.js +12 -37
- package/presentation/accessManagement/roles/components/RolesDataList.js.map +1 -1
- package/presentation/accessManagement/roles/components/RolesView.js +1 -0
- package/presentation/accessManagement/roles/components/RolesView.js.map +1 -1
- package/presentation/accessManagement/teams/TeamsDataSource.d.ts +5 -6
- package/presentation/accessManagement/teams/TeamsDataSource.js +12 -13
- package/presentation/accessManagement/teams/TeamsDataSource.js.map +1 -1
- package/presentation/accessManagement/teams/TeamsPresenter.d.ts +5 -0
- package/presentation/accessManagement/teams/TeamsPresenter.js +33 -2
- package/presentation/accessManagement/teams/TeamsPresenter.js.map +1 -1
- package/presentation/accessManagement/teams/TeamsPresenter.test.d.ts +1 -0
- package/presentation/accessManagement/teams/TeamsPresenter.test.js +97 -0
- package/presentation/accessManagement/teams/TeamsPresenter.test.js.map +1 -0
- package/presentation/accessManagement/teams/abstractions.d.ts +2 -0
- package/presentation/accessManagement/teams/abstractions.js.map +1 -1
- package/presentation/accessManagement/teams/components/TeamsDataList.js +12 -37
- package/presentation/accessManagement/teams/components/TeamsDataList.js.map +1 -1
- package/presentation/accessManagement/teams/components/TeamsView.js +1 -0
- package/presentation/accessManagement/teams/components/TeamsView.js.map +1 -1
- package/presentation/adminUsers/AdminUsers.js +3 -0
- package/presentation/adminUsers/AdminUsers.js.map +1 -1
- package/presentation/adminUsers/views/Users/UsersDataList.js +22 -1
- package/presentation/adminUsers/views/Users/UsersDataList.js.map +1 -1
- package/presentation/adminUsers/views/Users/hooks/useUserForm.js +39 -9
- package/presentation/adminUsers/views/Users/hooks/useUserForm.js.map +1 -1
- package/presentation/adminUsers/views/Users/hooks/useUserForm.test.d.ts +1 -0
- package/presentation/adminUsers/views/Users/hooks/useUserForm.test.js +149 -0
- package/presentation/adminUsers/views/Users/hooks/useUserForm.test.js.map +1 -0
- package/presentation/listPresenter/ListPresenter.d.ts +12 -1
- package/presentation/listPresenter/ListPresenter.js +60 -4
- package/presentation/listPresenter/ListPresenter.js.map +1 -1
- package/presentation/listPresenter/ListPresenter.test.js +82 -0
- package/presentation/listPresenter/ListPresenter.test.js.map +1 -1
- package/presentation/listPresenter/LocalDataSource.d.ts +34 -0
- package/presentation/listPresenter/LocalDataSource.js +75 -0
- package/presentation/listPresenter/LocalDataSource.js.map +1 -0
- package/presentation/listPresenter/LocalDataSource.test.d.ts +1 -0
- package/presentation/listPresenter/LocalDataSource.test.js +124 -0
- package/presentation/listPresenter/LocalDataSource.test.js.map +1 -0
- package/presentation/listPresenter/QueryMatcher.js +1 -12
- package/presentation/listPresenter/QueryMatcher.js.map +1 -1
- package/presentation/listPresenter/abstractions.d.ts +21 -0
- package/presentation/listPresenter/abstractions.js.map +1 -1
- package/presentation/listPresenter/compareValues.d.ts +7 -0
- package/presentation/listPresenter/compareValues.js +15 -0
- package/presentation/listPresenter/compareValues.js.map +1 -0
- package/presentation/listPresenter/index.d.ts +2 -0
- package/presentation/listPresenter/index.js +2 -0
- package/presentation/listPresenter/sortOption.d.ts +7 -0
- package/presentation/listPresenter/sortOption.js +16 -0
- package/presentation/listPresenter/sortOption.js.map +1 -0
- package/presentation/listPresenter/sortOption.test.d.ts +1 -0
- package/presentation/listPresenter/sortOption.test.js +26 -0
- package/presentation/listPresenter/sortOption.test.js.map +1 -0
- package/presentation/trashBin/TrashBinPresenter.js +9 -0
- package/presentation/trashBin/TrashBinPresenter.js.map +1 -1
- package/presentation/trashBin/TrashBinPresenter.test.js +75 -0
- package/presentation/trashBin/TrashBinPresenter.test.js.map +1 -1
- package/presentation/trashBin/abstractions.d.ts +9 -0
- package/presentation/trashBin/abstractions.js.map +1 -1
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.d.ts +0 -12
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.js +0 -18
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.d.ts +0 -12
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.js +0 -18
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.d.ts +0 -12
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.js +0 -20
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.d.ts +0 -14
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.js +0 -13
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.d.ts +0 -9
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.js +0 -13
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.d.ts +0 -9
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.js +0 -13
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.js.map +0 -1
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.d.ts +0 -12
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.js +0 -49
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.d.ts +0 -12
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.js +0 -18
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.d.ts +0 -12
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.js +0 -18
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.d.ts +0 -12
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.js +0 -20
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.d.ts +0 -14
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.js +0 -13
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.d.ts +0 -9
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.js +0 -13
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.d.ts +0 -9
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.js +0 -13
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.js.map +0 -1
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.d.ts +0 -12
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.js +0 -48
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { makeAutoObservable } from "mobx";
|
|
2
2
|
import { AdminAssistantGateway, AdminAssistantPresenter } from "./abstractions.js";
|
|
3
3
|
import { AiChatsRepository } from "../aiChats/abstractions.js";
|
|
4
|
+
import { AssistantPageContext } from "../assistantPageContext/abstractions.js";
|
|
4
5
|
import { messageOf } from "../aiChats/messageOf.js";
|
|
5
6
|
import { turnsFromMessages } from "./turnsFromMessages.js";
|
|
6
7
|
const NOT_CONFIGURED = "AI_CAPABILITY_NOT_CONFIGURED";
|
|
@@ -17,9 +18,10 @@ const emptyTurn = (question)=>({
|
|
|
17
18
|
settled: false
|
|
18
19
|
});
|
|
19
20
|
class AdminAssistantPresenterImpl {
|
|
20
|
-
constructor(gateway, chats){
|
|
21
|
+
constructor(gateway, chats, pageContext){
|
|
21
22
|
this.gateway = gateway;
|
|
22
23
|
this.chats = chats;
|
|
24
|
+
this.pageContext = pageContext;
|
|
23
25
|
this.turns = [];
|
|
24
26
|
this.busy = false;
|
|
25
27
|
this.model = void 0;
|
|
@@ -32,7 +34,8 @@ class AdminAssistantPresenterImpl {
|
|
|
32
34
|
makeAutoObservable(this, {
|
|
33
35
|
controller: false,
|
|
34
36
|
generation: false,
|
|
35
|
-
chats: false
|
|
37
|
+
chats: false,
|
|
38
|
+
pageContext: false
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
get vm() {
|
|
@@ -71,9 +74,7 @@ class AdminAssistantPresenterImpl {
|
|
|
71
74
|
this.clearStorageError();
|
|
72
75
|
const index = this.turns.length;
|
|
73
76
|
this.addTurn(trimmed);
|
|
74
|
-
const request = this.
|
|
75
|
-
prompt: trimmed
|
|
76
|
-
});
|
|
77
|
+
const request = this.question(trimmed);
|
|
77
78
|
this.run(index, request);
|
|
78
79
|
}
|
|
79
80
|
decide(turnIndex, approved) {
|
|
@@ -109,9 +110,7 @@ class AdminAssistantPresenterImpl {
|
|
|
109
110
|
...fresh,
|
|
110
111
|
running: true
|
|
111
112
|
});
|
|
112
|
-
const request = this.
|
|
113
|
-
prompt: turn.question
|
|
114
|
-
});
|
|
113
|
+
const request = this.question(turn.question);
|
|
115
114
|
this.run(index, request);
|
|
116
115
|
}
|
|
117
116
|
get setupRequired() {
|
|
@@ -142,6 +141,14 @@ class AdminAssistantPresenterImpl {
|
|
|
142
141
|
if (generation === this.generation) this.setOpening(false);
|
|
143
142
|
}
|
|
144
143
|
}
|
|
144
|
+
question(prompt) {
|
|
145
|
+
const request = this.request({
|
|
146
|
+
prompt
|
|
147
|
+
});
|
|
148
|
+
const pageContext = this.pageContext.get();
|
|
149
|
+
if (pageContext) request.pageContext = pageContext;
|
|
150
|
+
return request;
|
|
151
|
+
}
|
|
145
152
|
request(rest) {
|
|
146
153
|
const request = {
|
|
147
154
|
...rest
|
|
@@ -327,7 +334,8 @@ const AdminAssistantPresenter_AdminAssistantPresenter = AdminAssistantPresenter.
|
|
|
327
334
|
implementation: AdminAssistantPresenterImpl,
|
|
328
335
|
dependencies: [
|
|
329
336
|
AdminAssistantGateway,
|
|
330
|
-
AiChatsRepository
|
|
337
|
+
AiChatsRepository,
|
|
338
|
+
AssistantPageContext
|
|
331
339
|
]
|
|
332
340
|
});
|
|
333
341
|
export { AdminAssistantPresenter_AdminAssistantPresenter as AdminAssistantPresenter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/adminAssistant/AdminAssistantPresenter.js","sources":["../../../src/features/adminAssistant/AdminAssistantPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { AdminAssistantGateway } from \"./abstractions.js\";\nimport type { AdminAssistantRequest } from \"./abstractions.js\";\nimport { AdminAssistantPresenter as Abstraction } from \"./abstractions.js\";\nimport type { AiTurnViewModel } from \"./abstractions.js\";\nimport { AiChatsRepository } from \"~/features/aiChats/abstractions.js\";\nimport type { AiChatSaveFailure } from \"~/features/aiChats/abstractions.js\";\nimport { messageOf } from \"~/features/aiChats/messageOf.js\";\nimport { turnsFromMessages } from \"./turnsFromMessages.js\";\n\n/** A turn plus the state the view never sees. `needsSetup` is derived from `errorCode`. */\ninterface Turn extends Omit<AiTurnViewModel, \"needsSetup\"> {\n /** The server's code for the failure, when it sent one. */\n errorCode?: string;\n}\n\n/** The code a run fails with when the project's AI settings give the assistant no model. */\nconst NOT_CONFIGURED = \"AI_CAPABILITY_NOT_CONFIGURED\";\n\nconst emptyTurn = (question: string): Turn => ({\n question,\n text: \"\",\n answerStart: 0,\n tools: [],\n completed: [],\n failed: [],\n running: false,\n pendingApprovals: [],\n followUps: [],\n settled: false\n});\n\n/**\n * Owns the palette's AI conversation.\n *\n * A presenter rather than component state: several pieces change together, a network stream drives\n * them, and an abort has to outlive any one render.\n *\n * Registered as a singleton, so `reset` genuinely clears rather than relying on unmount.\n *\n * The server keeps the conversation: a question sends only the chat id and the question, and the\n * assistant reads the history from the saved chat and saves the run when it ends. The turns here\n * are what is shown, never what is sent.\n */\nclass AdminAssistantPresenterImpl implements Abstraction.Interface {\n private turns: Turn[] = [];\n private busy = false;\n private model: string | undefined = undefined;\n private chatId: string | null = null;\n private opening = false;\n private storageError: string | null = null;\n private saveFailure: AiChatSaveFailure | null = null;\n private controller: AbortController | null = null;\n /*\n * Bumped whenever the conversation is replaced. An open that finishes after that belongs to a\n * conversation that is gone, and must not write its turns onto the new one.\n */\n private generation = 0;\n\n constructor(\n private gateway: AdminAssistantGateway.Interface,\n private chats: AiChatsRepository.Interface\n ) {\n // Machinery, not state anything renders, so keep them out of the map.\n makeAutoObservable<AdminAssistantPresenterImpl, \"controller\" | \"generation\" | \"chats\">(\n this,\n { controller: false, generation: false, chats: false }\n );\n }\n\n get vm(): Abstraction.ViewModel {\n const vm: Abstraction.ViewModel = {\n busy: this.busy,\n chatId: this.chatId,\n opening: this.opening,\n storageError: this.storageError,\n saveFailure: this.saveFailure,\n setupRequired: this.setupRequired,\n turns: this.turns.map(turn => {\n const view: AiTurnViewModel = {\n question: turn.question,\n text: turn.text,\n answerStart: turn.answerStart,\n tools: turn.tools,\n completed: turn.completed,\n failed: turn.failed,\n running: turn.running,\n pendingApprovals: turn.pendingApprovals,\n followUps: turn.followUps,\n settled: turn.settled,\n needsSetup: turn.errorCode === NOT_CONFIGURED\n };\n\n if (turn.error !== undefined) {\n view.error = turn.error;\n }\n\n return view;\n })\n };\n\n if (this.model !== undefined) {\n vm.model = this.model;\n }\n\n return vm;\n }\n\n ask(question: string): void {\n const trimmed = question.trim();\n\n /*\n * While a saved chat loads, a question would land in a conversation about to be replaced.\n * With no model set up it would fail the same way, so only \"Try again\" asks.\n */\n if (!trimmed || this.busy || this.opening || this.setupRequired) {\n return;\n }\n\n // Asking something else rejects a change still waiting; the server does the same.\n this.dropPendingApprovals();\n this.clearStorageError();\n\n const index = this.turns.length;\n this.addTurn(trimmed);\n const request = this.request({ prompt: trimmed });\n void this.run(index, request);\n }\n\n decide(turnIndex: number, approved: boolean): void {\n const turn = this.turns[turnIndex];\n\n if (!turn?.pendingApprovals.length || this.busy || this.opening) {\n return;\n }\n\n // The paused run is resumed from the saved chat, so a run that was not saved cannot be.\n if (!this.chatId || this.saveFailure) {\n this.patch(turnIndex, {\n pendingApprovals: [],\n error: \"This change can't run because the chat wasn't saved. Ask again to retry.\"\n });\n return;\n }\n\n const approvals = turn.pendingApprovals.map(approval => ({\n approvalId: approval.approvalId,\n approved\n }));\n\n // Clear the block immediately so the plan cannot be submitted twice.\n this.patch(turnIndex, {\n pendingApprovals: [],\n followUps: [],\n settled: false,\n running: true\n });\n\n const request = this.request({ approvals });\n void this.run(turnIndex, request, true);\n }\n\n /*\n * The newest turn asked again in place, from an empty answer: one that failed, or one that ran\n * but was not saved. Either way the saved chat does not have it, so the server answers it again\n * with the same history it had the first time.\n */\n retry(): void {\n const index = this.turns.length - 1;\n const turn = this.turns[index];\n\n if (!turn || this.busy || this.opening) {\n return;\n }\n // A run that cannot be saved by asking again is left for a new chat.\n if (!turn.error && this.saveFailure !== \"retryable\") {\n return;\n }\n\n this.clearStorageError();\n const fresh = emptyTurn(turn.question);\n this.replaceTurn(index, { ...fresh, running: true });\n const request = this.request({ prompt: turn.question });\n void this.run(index, request);\n }\n\n private get setupRequired(): boolean {\n const newest = this.turns[this.turns.length - 1];\n return newest?.errorCode === NOT_CONFIGURED;\n }\n\n reset(): void {\n this.controller?.abort();\n this.controller = null;\n this.generation++;\n this.clear();\n }\n\n async open(chatId: string): Promise<void> {\n this.reset();\n const generation = this.generation;\n this.setOpening(true);\n\n try {\n const chat = await this.chats.get(chatId);\n if (generation !== this.generation) {\n return;\n }\n const turns = turnsFromMessages(chat.messages);\n this.setConversation(chat.id, turns);\n } catch (error) {\n if (generation === this.generation) {\n const message = messageOf(error);\n this.setStorageError(message);\n }\n } finally {\n if (generation === this.generation) {\n this.setOpening(false);\n }\n }\n }\n\n /** A request for the chat on screen: the server reads its history from the saved chat. */\n private request(rest: Omit<AdminAssistantRequest, \"chatId\">): AdminAssistantRequest {\n const request: AdminAssistantRequest = { ...rest };\n if (this.chatId) {\n request.chatId = this.chatId;\n }\n return request;\n }\n\n private async run(\n index: number,\n request: AdminAssistantRequest,\n resuming = false\n ): Promise<void> {\n this.controller?.abort();\n const controller = new AbortController();\n this.controller = controller;\n\n this.setBusy(true);\n\n try {\n /*\n * Resuming continues the same turn: the tools already called, the text already shown and\n * the messages already collected all still belong to it. Starting from empty would strand\n * earlier chips as running and, worse, drop the assistant message carrying the `tool_use`\n * that the replayed `tool_result` refers to.\n */\n const existing = resuming ? this.turns[index] : undefined;\n let text = existing?.text ?? \"\";\n const tools: string[] = existing ? [...existing.tools] : [];\n const completed: string[] = existing ? [...existing.completed] : [];\n const failed: string[] = existing ? [...existing.failed] : [];\n /*\n * A resumed run writes on after the text shown before the approval pause. Without a\n * break, the two ran together (\"...a new folder:Understood, no folder was created.\").\n */\n let separateFromExisting = text.length > 0;\n\n for await (const event of this.gateway.stream(request, controller.signal)) {\n if (event.type === \"start\") {\n this.setModel(event.model);\n continue;\n }\n\n if (event.type === \"text\") {\n text += separateFromExisting ? `\\n\\n${event.text}` : event.text;\n separateFromExisting = false;\n this.patch(index, { text, running: false });\n continue;\n }\n\n if (event.type === \"tool-call\") {\n tools.push(event.name);\n this.patch(index, {\n tools: [...tools],\n running: true,\n answerStart: text.length\n });\n continue;\n }\n\n if (event.type === \"tool-result\") {\n completed.push(event.name);\n this.patch(index, { completed: [...completed] });\n continue;\n }\n\n if (event.type === \"tool-error\") {\n failed.push(event.name);\n this.patch(index, { failed: [...failed] });\n continue;\n }\n\n if (event.type === \"follow-ups\") {\n this.patch(index, { followUps: event.questions });\n continue;\n }\n\n if (event.type === \"approval\") {\n this.patch(index, { pendingApprovals: event.approvals, running: false });\n continue;\n }\n\n if (event.type === \"saved\") {\n this.setSaved(event.chat);\n continue;\n }\n\n /*\n * A resumed run may have carried out the change the user approved. Asking again\n * would start before that change, so the model proposes it again and approving\n * twice makes it twice. Only a new chat is offered then.\n */\n if (event.type === \"not-saved\") {\n const failure = event.retryable && !resuming ? \"retryable\" : \"final\";\n this.setSaveFailed(event.message, failure);\n continue;\n }\n\n if (event.type === \"done\") {\n this.patch(index, { settled: true, running: false });\n continue;\n }\n\n if (event.type === \"error\") {\n this.patch(index, {\n error: event.message,\n errorCode: event.code,\n settled: true,\n running: false\n });\n return;\n }\n }\n } catch (error) {\n // An abort is the palette closing, not a failure worth showing.\n if (!controller.signal.aborted) {\n this.patch(index, {\n error: error instanceof Error ? error.message : String(error),\n settled: true,\n running: false\n });\n }\n } finally {\n this.setBusy(false);\n }\n }\n\n /*\n * Every mutation below is its own method on purpose. `run` awaits, and a mutation after an await\n * has escaped the action it started in; `makeAutoObservable` makes these methods actions, so\n * calling them from there is correct.\n */\n private addTurn(question: string): void {\n this.turns = [...this.turns, { ...emptyTurn(question), running: true }];\n }\n\n private replaceTurn(index: number, turn: Turn): void {\n this.turns = this.turns.map((existing, i) => (i === index ? turn : existing));\n }\n\n private patch(index: number, change: Partial<Turn>): void {\n this.turns = this.turns.map((turn, i) => (i === index ? { ...turn, ...change } : turn));\n }\n\n private setBusy(busy: boolean): void {\n this.busy = busy;\n }\n\n private setModel(model: string): void {\n this.model = model;\n }\n\n private setOpening(opening: boolean): void {\n this.opening = opening;\n }\n\n private setConversation(chatId: string, turns: Turn[]): void {\n this.chatId = chatId;\n this.turns = turns;\n }\n\n // The chats list learns of the chat from here, so it shows up without being read again.\n private setSaved(chat: AiChatsRepository.Summary): void {\n this.chatId = chat.id;\n this.storageError = null;\n this.saveFailure = null;\n this.chats.remember(chat);\n }\n\n private dropPendingApprovals(): void {\n this.turns = this.turns.map(turn => {\n if (turn.pendingApprovals.length === 0) {\n return turn;\n }\n return { ...turn, pendingApprovals: [] };\n });\n }\n\n private setStorageError(message: string): void {\n this.storageError = message;\n this.saveFailure = null;\n }\n\n private setSaveFailed(message: string, failure: AiChatSaveFailure): void {\n this.storageError = message;\n this.saveFailure = failure;\n }\n\n private clearStorageError(): void {\n this.storageError = null;\n this.saveFailure = null;\n }\n\n private clear(): void {\n this.turns = [];\n this.busy = false;\n this.chatId = null;\n this.opening = false;\n this.storageError = null;\n this.saveFailure = null;\n }\n}\n\nexport const AdminAssistantPresenter = Abstraction.createImplementation({\n implementation: AdminAssistantPresenterImpl,\n dependencies: [AdminAssistantGateway, AiChatsRepository]\n});\n"],"names":["NOT_CONFIGURED","emptyTurn","question","AdminAssistantPresenterImpl","gateway","chats","undefined","makeAutoObservable","vm","turn","view","trimmed","index","request","turnIndex","approved","approvals","approval","fresh","newest","chatId","generation","chat","turns","turnsFromMessages","error","message","messageOf","rest","resuming","controller","AbortController","existing","text","tools","completed","failed","separateFromExisting","event","failure","Error","String","i","change","busy","model","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,gBAAgB1B,MAAc,EAAEG,KAAa,EAAQ;QACzD,IAAI,CAAC,MAAM,GAAGH;QACd,IAAI,CAAC,KAAK,GAAGG;IACjB;IAGQ,SAASD,IAA+B,EAAQ;QACpD,IAAI,CAAC,MAAM,GAAGA,KAAK,EAAE;QACrB,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAACA;IACxB;IAEQ,uBAA6B;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAACb,CAAAA;YACxB,IAAIA,AAAiC,MAAjCA,KAAK,gBAAgB,CAAC,MAAM,EAC5B,OAAOA;YAEX,OAAO;gBAAE,GAAGA,IAAI;gBAAE,kBAAkB,EAAE;YAAC;QAC3C;IACJ;IAEQ,gBAAgBiB,OAAe,EAAQ;QAC3C,IAAI,CAAC,YAAY,GAAGA;QACpB,IAAI,CAAC,WAAW,GAAG;IACvB;IAEQ,cAAcA,OAAe,EAAEa,OAA0B,EAAQ;QACrE,IAAI,CAAC,YAAY,GAAGb;QACpB,IAAI,CAAC,WAAW,GAAGa;IACvB;IAEQ,oBAA0B;QAC9B,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,WAAW,GAAG;IACvB;IAEQ,QAAc;QAClB,IAAI,CAAC,KAAK,GAAG,EAAE;QACf,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,WAAW,GAAG;IACvB;AACJ;AAEO,MAAMQ,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgB7C;IAChB,cAAc;QAAC8C;QAAuBC;KAAkB;AAC5D"}
|
|
1
|
+
{"version":3,"file":"features/adminAssistant/AdminAssistantPresenter.js","sources":["../../../src/features/adminAssistant/AdminAssistantPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { AdminAssistantGateway } from \"./abstractions.js\";\nimport type { AdminAssistantRequest } from \"./abstractions.js\";\nimport { AdminAssistantPresenter as Abstraction } from \"./abstractions.js\";\nimport type { AiTurnViewModel } from \"./abstractions.js\";\nimport { AiChatsRepository } from \"~/features/aiChats/abstractions.js\";\nimport { AssistantPageContext } from \"~/features/assistantPageContext/abstractions.js\";\nimport type { AiChatSaveFailure } from \"~/features/aiChats/abstractions.js\";\nimport { messageOf } from \"~/features/aiChats/messageOf.js\";\nimport { turnsFromMessages } from \"./turnsFromMessages.js\";\n\n/** A turn plus the state the view never sees. `needsSetup` is derived from `errorCode`. */\ninterface Turn extends Omit<AiTurnViewModel, \"needsSetup\"> {\n /** The server's code for the failure, when it sent one. */\n errorCode?: string;\n}\n\n/** The code a run fails with when the project's AI settings give the assistant no model. */\nconst NOT_CONFIGURED = \"AI_CAPABILITY_NOT_CONFIGURED\";\n\nconst emptyTurn = (question: string): Turn => ({\n question,\n text: \"\",\n answerStart: 0,\n tools: [],\n completed: [],\n failed: [],\n running: false,\n pendingApprovals: [],\n followUps: [],\n settled: false\n});\n\n/**\n * Owns the palette's AI conversation.\n *\n * A presenter rather than component state: several pieces change together, a network stream drives\n * them, and an abort has to outlive any one render.\n *\n * Registered as a singleton, so `reset` genuinely clears rather than relying on unmount.\n *\n * The server keeps the conversation: a question sends only the chat id and the question, and the\n * assistant reads the history from the saved chat and saves the run when it ends. The turns here\n * are what is shown, never what is sent.\n */\nclass AdminAssistantPresenterImpl implements Abstraction.Interface {\n private turns: Turn[] = [];\n private busy = false;\n private model: string | undefined = undefined;\n private chatId: string | null = null;\n private opening = false;\n private storageError: string | null = null;\n private saveFailure: AiChatSaveFailure | null = null;\n private controller: AbortController | null = null;\n /*\n * Bumped whenever the conversation is replaced. An open that finishes after that belongs to a\n * conversation that is gone, and must not write its turns onto the new one.\n */\n private generation = 0;\n\n constructor(\n private gateway: AdminAssistantGateway.Interface,\n private chats: AiChatsRepository.Interface,\n private pageContext: AssistantPageContext.Interface\n ) {\n // Machinery, not state anything renders, so keep them out of the map.\n makeAutoObservable<\n AdminAssistantPresenterImpl,\n \"controller\" | \"generation\" | \"chats\" | \"pageContext\"\n >(this, { controller: false, generation: false, chats: false, pageContext: false });\n }\n\n get vm(): Abstraction.ViewModel {\n const vm: Abstraction.ViewModel = {\n busy: this.busy,\n chatId: this.chatId,\n opening: this.opening,\n storageError: this.storageError,\n saveFailure: this.saveFailure,\n setupRequired: this.setupRequired,\n turns: this.turns.map(turn => {\n const view: AiTurnViewModel = {\n question: turn.question,\n text: turn.text,\n answerStart: turn.answerStart,\n tools: turn.tools,\n completed: turn.completed,\n failed: turn.failed,\n running: turn.running,\n pendingApprovals: turn.pendingApprovals,\n followUps: turn.followUps,\n settled: turn.settled,\n needsSetup: turn.errorCode === NOT_CONFIGURED\n };\n\n if (turn.error !== undefined) {\n view.error = turn.error;\n }\n\n return view;\n })\n };\n\n if (this.model !== undefined) {\n vm.model = this.model;\n }\n\n return vm;\n }\n\n ask(question: string): void {\n const trimmed = question.trim();\n\n /*\n * While a saved chat loads, a question would land in a conversation about to be replaced.\n * With no model set up it would fail the same way, so only \"Try again\" asks.\n */\n if (!trimmed || this.busy || this.opening || this.setupRequired) {\n return;\n }\n\n // Asking something else rejects a change still waiting; the server does the same.\n this.dropPendingApprovals();\n this.clearStorageError();\n\n const index = this.turns.length;\n this.addTurn(trimmed);\n const request = this.question(trimmed);\n void this.run(index, request);\n }\n\n decide(turnIndex: number, approved: boolean): void {\n const turn = this.turns[turnIndex];\n\n if (!turn?.pendingApprovals.length || this.busy || this.opening) {\n return;\n }\n\n // The paused run is resumed from the saved chat, so a run that was not saved cannot be.\n if (!this.chatId || this.saveFailure) {\n this.patch(turnIndex, {\n pendingApprovals: [],\n error: \"This change can't run because the chat wasn't saved. Ask again to retry.\"\n });\n return;\n }\n\n const approvals = turn.pendingApprovals.map(approval => ({\n approvalId: approval.approvalId,\n approved\n }));\n\n // Clear the block immediately so the plan cannot be submitted twice.\n this.patch(turnIndex, {\n pendingApprovals: [],\n followUps: [],\n settled: false,\n running: true\n });\n\n const request = this.request({ approvals });\n void this.run(turnIndex, request, true);\n }\n\n /*\n * The newest turn asked again in place, from an empty answer: one that failed, or one that ran\n * but was not saved. Either way the saved chat does not have it, so the server answers it again\n * with the same history it had the first time.\n */\n retry(): void {\n const index = this.turns.length - 1;\n const turn = this.turns[index];\n\n if (!turn || this.busy || this.opening) {\n return;\n }\n // A run that cannot be saved by asking again is left for a new chat.\n if (!turn.error && this.saveFailure !== \"retryable\") {\n return;\n }\n\n this.clearStorageError();\n const fresh = emptyTurn(turn.question);\n this.replaceTurn(index, { ...fresh, running: true });\n const request = this.question(turn.question);\n void this.run(index, request);\n }\n\n private get setupRequired(): boolean {\n const newest = this.turns[this.turns.length - 1];\n return newest?.errorCode === NOT_CONFIGURED;\n }\n\n reset(): void {\n this.controller?.abort();\n this.controller = null;\n this.generation++;\n this.clear();\n }\n\n async open(chatId: string): Promise<void> {\n this.reset();\n const generation = this.generation;\n this.setOpening(true);\n\n try {\n const chat = await this.chats.get(chatId);\n if (generation !== this.generation) {\n return;\n }\n const turns = turnsFromMessages(chat.messages);\n this.setConversation(chat.id, turns);\n } catch (error) {\n if (generation === this.generation) {\n const message = messageOf(error);\n this.setStorageError(message);\n }\n } finally {\n if (generation === this.generation) {\n this.setOpening(false);\n }\n }\n }\n\n /**\n * A question, with whatever the screen behind the palette says about itself. Read at the moment\n * of asking, so a retry describes the screen the user is on now.\n */\n private question(prompt: string): AdminAssistantRequest {\n const request = this.request({ prompt });\n const pageContext = this.pageContext.get();\n if (pageContext) {\n request.pageContext = pageContext;\n }\n return request;\n }\n\n /** A request for the chat on screen: the server reads its history from the saved chat. */\n private request(rest: Omit<AdminAssistantRequest, \"chatId\">): AdminAssistantRequest {\n const request: AdminAssistantRequest = { ...rest };\n if (this.chatId) {\n request.chatId = this.chatId;\n }\n return request;\n }\n\n private async run(\n index: number,\n request: AdminAssistantRequest,\n resuming = false\n ): Promise<void> {\n this.controller?.abort();\n const controller = new AbortController();\n this.controller = controller;\n\n this.setBusy(true);\n\n try {\n /*\n * Resuming continues the same turn: the tools already called, the text already shown and\n * the messages already collected all still belong to it. Starting from empty would strand\n * earlier chips as running and, worse, drop the assistant message carrying the `tool_use`\n * that the replayed `tool_result` refers to.\n */\n const existing = resuming ? this.turns[index] : undefined;\n let text = existing?.text ?? \"\";\n const tools: string[] = existing ? [...existing.tools] : [];\n const completed: string[] = existing ? [...existing.completed] : [];\n const failed: string[] = existing ? [...existing.failed] : [];\n /*\n * A resumed run writes on after the text shown before the approval pause. Without a\n * break, the two ran together (\"...a new folder:Understood, no folder was created.\").\n */\n let separateFromExisting = text.length > 0;\n\n for await (const event of this.gateway.stream(request, controller.signal)) {\n if (event.type === \"start\") {\n this.setModel(event.model);\n continue;\n }\n\n if (event.type === \"text\") {\n text += separateFromExisting ? `\\n\\n${event.text}` : event.text;\n separateFromExisting = false;\n this.patch(index, { text, running: false });\n continue;\n }\n\n if (event.type === \"tool-call\") {\n tools.push(event.name);\n this.patch(index, {\n tools: [...tools],\n running: true,\n answerStart: text.length\n });\n continue;\n }\n\n if (event.type === \"tool-result\") {\n completed.push(event.name);\n this.patch(index, { completed: [...completed] });\n continue;\n }\n\n if (event.type === \"tool-error\") {\n failed.push(event.name);\n this.patch(index, { failed: [...failed] });\n continue;\n }\n\n if (event.type === \"follow-ups\") {\n this.patch(index, { followUps: event.questions });\n continue;\n }\n\n if (event.type === \"approval\") {\n this.patch(index, { pendingApprovals: event.approvals, running: false });\n continue;\n }\n\n if (event.type === \"saved\") {\n this.setSaved(event.chat);\n continue;\n }\n\n /*\n * A resumed run may have carried out the change the user approved. Asking again\n * would start before that change, so the model proposes it again and approving\n * twice makes it twice. Only a new chat is offered then.\n */\n if (event.type === \"not-saved\") {\n const failure = event.retryable && !resuming ? \"retryable\" : \"final\";\n this.setSaveFailed(event.message, failure);\n continue;\n }\n\n if (event.type === \"done\") {\n this.patch(index, { settled: true, running: false });\n continue;\n }\n\n if (event.type === \"error\") {\n this.patch(index, {\n error: event.message,\n errorCode: event.code,\n settled: true,\n running: false\n });\n return;\n }\n }\n } catch (error) {\n // An abort is the palette closing, not a failure worth showing.\n if (!controller.signal.aborted) {\n this.patch(index, {\n error: error instanceof Error ? error.message : String(error),\n settled: true,\n running: false\n });\n }\n } finally {\n this.setBusy(false);\n }\n }\n\n /*\n * Every mutation below is its own method on purpose. `run` awaits, and a mutation after an await\n * has escaped the action it started in; `makeAutoObservable` makes these methods actions, so\n * calling them from there is correct.\n */\n private addTurn(question: string): void {\n this.turns = [...this.turns, { ...emptyTurn(question), running: true }];\n }\n\n private replaceTurn(index: number, turn: Turn): void {\n this.turns = this.turns.map((existing, i) => (i === index ? turn : existing));\n }\n\n private patch(index: number, change: Partial<Turn>): void {\n this.turns = this.turns.map((turn, i) => (i === index ? { ...turn, ...change } : turn));\n }\n\n private setBusy(busy: boolean): void {\n this.busy = busy;\n }\n\n private setModel(model: string): void {\n this.model = model;\n }\n\n private setOpening(opening: boolean): void {\n this.opening = opening;\n }\n\n private setConversation(chatId: string, turns: Turn[]): void {\n this.chatId = chatId;\n this.turns = turns;\n }\n\n // The chats list learns of the chat from here, so it shows up without being read again.\n private setSaved(chat: AiChatsRepository.Summary): void {\n this.chatId = chat.id;\n this.storageError = null;\n this.saveFailure = null;\n this.chats.remember(chat);\n }\n\n private dropPendingApprovals(): void {\n this.turns = this.turns.map(turn => {\n if (turn.pendingApprovals.length === 0) {\n return turn;\n }\n return { ...turn, pendingApprovals: [] };\n });\n }\n\n private setStorageError(message: string): void {\n this.storageError = message;\n this.saveFailure = null;\n }\n\n private setSaveFailed(message: string, failure: AiChatSaveFailure): void {\n this.storageError = message;\n this.saveFailure = failure;\n }\n\n private clearStorageError(): void {\n this.storageError = null;\n this.saveFailure = null;\n }\n\n private clear(): void {\n this.turns = [];\n this.busy = false;\n this.chatId = null;\n this.opening = false;\n this.storageError = null;\n this.saveFailure = null;\n }\n}\n\nexport const AdminAssistantPresenter = Abstraction.createImplementation({\n implementation: AdminAssistantPresenterImpl,\n dependencies: [AdminAssistantGateway, AiChatsRepository, AssistantPageContext]\n});\n"],"names":["NOT_CONFIGURED","emptyTurn","question","AdminAssistantPresenterImpl","gateway","chats","pageContext","undefined","makeAutoObservable","vm","turn","view","trimmed","index","request","turnIndex","approved","approvals","approval","fresh","newest","chatId","generation","chat","turns","turnsFromMessages","error","message","messageOf","prompt","rest","resuming","controller","AbortController","existing","text","tools","completed","failed","separateFromExisting","event","failure","Error","String","i","change","busy","model","opening","AdminAssistantPresenter","Abstraction","AdminAssistantGateway","AiChatsRepository","AssistantPageContext"],"mappings":";;;;;;AAkBA,MAAMA,iBAAiB;AAEvB,MAAMC,YAAY,CAACC,WAA4B;QAC3CA;QACA,MAAM;QACN,aAAa;QACb,OAAO,EAAE;QACT,WAAW,EAAE;QACb,QAAQ,EAAE;QACV,SAAS;QACT,kBAAkB,EAAE;QACpB,WAAW,EAAE;QACb,SAAS;IACb;AAcA,MAAMC;IAeF,YACYC,OAAwC,EACxCC,KAAkC,EAClCC,WAA2C,CACrD;aAHUF,OAAO,GAAPA;aACAC,KAAK,GAALA;aACAC,WAAW,GAAXA;aAjBJ,KAAK,GAAW,EAAE;aAClB,IAAI,GAAG;aACP,KAAK,GAAuBC;aAC5B,MAAM,GAAkB;aACxB,OAAO,GAAG;aACV,YAAY,GAAkB;aAC9B,WAAW,GAA6B;aACxC,UAAU,GAA2B;QAI5C,KACO,UAAU,GAAG;QAQjBC,mBAGE,IAAI,EAAE;YAAE,YAAY;YAAO,YAAY;YAAO,OAAO;YAAO,aAAa;QAAM;IACrF;IAEA,IAAI,KAA4B;QAC5B,MAAMC,KAA4B;YAC9B,MAAM,IAAI,CAAC,IAAI;YACf,QAAQ,IAAI,CAAC,MAAM;YACnB,SAAS,IAAI,CAAC,OAAO;YACrB,cAAc,IAAI,CAAC,YAAY;YAC/B,aAAa,IAAI,CAAC,WAAW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OAA0B,EAAQ;QACrE,IAAI,CAAC,YAAY,GAAGd;QACpB,IAAI,CAAC,WAAW,GAAGc;IACvB;IAEQ,oBAA0B;QAC9B,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,WAAW,GAAG;IACvB;IAEQ,QAAc;QAClB,IAAI,CAAC,KAAK,GAAG,EAAE;QACf,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,WAAW,GAAG;IACvB;AACJ;AAEO,MAAMQ,kDAA0BC,wBAAAA,oBAAgC,CAAC;IACpE,gBAAgB/C;IAChB,cAAc;QAACgD;QAAuBC;QAAmBC;KAAqB;AAClF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AiChatSaveFailure } from "../../features/aiChats/abstractions.js";
|
|
2
2
|
import type { AiChatsRepository } from "../../features/aiChats/abstractions.js";
|
|
3
|
+
import type { AssistantPageContext } from "../../features/assistantPageContext/abstractions.js";
|
|
3
4
|
/**
|
|
4
5
|
* A message of a saved chat. Opaque on purpose: the admin only reads them to show an opened chat,
|
|
5
6
|
* and the server is the one that sends them to the model.
|
|
@@ -36,6 +37,8 @@ export interface AdminAssistantRequest {
|
|
|
36
37
|
prompt?: string;
|
|
37
38
|
/** Approve or reject calls the server paused on. Needs the `chatId` of the paused run. */
|
|
38
39
|
approvals?: AdminAssistantDecision[];
|
|
40
|
+
/** What the user had on screen when they asked. Sent with questions only. */
|
|
41
|
+
pageContext?: AssistantPageContext.Data;
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
41
44
|
* What the assistant emits while it works. Mirrors the server's `AdminAssistantEvent`; declared here so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/adminAssistant/abstractions.js","sources":["../../../src/features/adminAssistant/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { AiChatSaveFailure } from \"~/features/aiChats/abstractions.js\";\nimport type { AiChatsRepository } from \"~/features/aiChats/abstractions.js\";\n\n/**\n * A message of a saved chat. Opaque on purpose: the admin only reads them to show an opened chat,\n * and the server is the one that sends them to the model.\n */\nexport type AdminAssistantMessage = { role: string; content: unknown };\n\n/** A tool the assistant invoked, so the UI can show its work rather than just an answer. */\nexport interface AdminAssistantToolCall {\n name: string;\n input: unknown;\n}\n\n/** A tool call the assistant wants to make but has not made, because it changes something. */\nexport interface AdminAssistantPendingApproval {\n approvalId: string;\n toolName: string;\n title?: string;\n input: unknown;\n /** The tool declared itself destructive — the UI should say so more loudly. */\n destructive: boolean;\n}\n\nexport interface AdminAssistantDecision {\n approvalId: string;\n approved: boolean;\n reason?: string;\n}\n\n/**\n * A question, or the decisions on the calls a run paused on. The server reads the rest of the\n * conversation from the saved chat, so only its id is sent; without one, a question starts a chat.\n */\nexport interface AdminAssistantRequest {\n chatId?: string;\n prompt?: string;\n /** Approve or reject calls the server paused on. Needs the `chatId` of the paused run. */\n approvals?: AdminAssistantDecision[];\n}\n\n/**\n * What the assistant emits while it works. Mirrors the server's `AdminAssistantEvent`; declared here so the\n * admin bundle carries no server or AI SDK code.\n */\nexport type AdminAssistantStreamEvent =\n // The run is going ahead, on this model (\"anthropic/claude-sonnet-4-5\").\n | { type: \"start\"; model: string }\n | { type: \"text\"; text: string }\n | { type: \"tool-call\"; name: string }\n | { type: \"tool-result\"; name: string }\n // A tool threw. Pairs with `tool-call` by name, and does not end the run.\n | { type: \"tool-error\"; name: string; message: string }\n | { type: \"follow-ups\"; questions: string[] }\n | { type: \"approval\"; approvals: AdminAssistantPendingApproval[] }\n // The run was saved, as a new chat or onto the one asked about.\n | { type: \"saved\"; chat: AiChatsRepository.Summary }\n // The run finished but the server could not save it. `retryable` says whether asking again could.\n | { type: \"not-saved\"; message: string; retryable: boolean }\n // Comes after `saved` or `not-saved`.\n | { type: \"done\"; steps: number }\n | { type: \"error\"; message: string; code?: \"AI_CAPABILITY_NOT_CONFIGURED\" };\n\nexport interface IAdminAssistantGateway {\n /**\n * Run and yield progress as it arrives. Preferred in the UI: a multi-tool question takes tens of\n * seconds, and an approval request is worth showing the moment it appears.\n */\n stream(\n request: AdminAssistantRequest,\n signal?: AbortSignal\n ): AsyncIterable<AdminAssistantStreamEvent>;\n}\n\n/** Sends a question to the server-side AI assistant (`POST /ai/chat`). */\nexport const AdminAssistantGateway =\n createAbstraction<IAdminAssistantGateway>(\"AdminAssistantGateway\");\n\nexport namespace AdminAssistantGateway {\n export type Interface = IAdminAssistantGateway;\n export type Message = AdminAssistantMessage;\n export type ToolCall = AdminAssistantToolCall;\n export type PendingApproval = AdminAssistantPendingApproval;\n export type Decision = AdminAssistantDecision;\n export type Request = AdminAssistantRequest;\n export type StreamEvent = AdminAssistantStreamEvent;\n}\n\n/** One question and the answer to it, as the view needs it. */\nexport interface AiTurnViewModel {\n question: string;\n /** Answer text so far. Grows as the stream arrives. */\n text: string;\n /**\n * Where the answer proper starts in `text`: after the last tool call. Text before it is the\n * model saying what it is about to look up, which is no summary of the answer.\n */\n answerStart: number;\n /** Tools called this turn, in call order. */\n tools: string[];\n /**\n * Tools that returned. A call pending approval still emits `tool-call`, so this is the only way\n * to tell a completed tool from one merely proposed.\n */\n completed: string[];\n /** Tools that threw. Settles the chip as a failure; the run continues. */\n failed: string[];\n /** Set while a tool is running and no answer text has arrived yet. */\n running: boolean;\n pendingApprovals: AdminAssistantPendingApproval[];\n /** Questions the assistant suggests asking next. Empty until the answer is in. */\n followUps: string[];\n settled: boolean;\n error?: string;\n /**\n * The turn failed because the project has no model set up. Shown as a setup screen rather\n * than an error; `error` holds the server's reason, which names the setting to fix.\n */\n needsSetup: boolean;\n}\n\nexport interface IAdminAssistantViewModel {\n turns: AiTurnViewModel[];\n /** A run is in flight. Asking again or deciding again is refused while true. */\n busy: boolean;\n /**\n * The model the last run used, fully qualified. Absent before the first run, since the admin\n * only learns it from the server.\n */\n model?: string;\n /** The saved chat this conversation is, once its first turn is saved or a chat is opened. */\n chatId: string | null;\n /** A saved chat is being read. */\n opening: boolean;\n /**\n * Why the last run was not saved, or the last open failed. The conversation on screen carries\n * on either way; this is only so the view can say it is not saved.\n */\n storageError: string | null;\n /**\n * Set when it was a run that was not saved, so the view can offer what fixes it. Null for an\n * open.\n */\n saveFailure: AiChatSaveFailure | null;\n /**\n * The newest turn needs a model set up first. No question is taken until \"Try again\" (`retry`)\n * succeeds, so the view can stop taking input.\n */\n setupRequired: boolean;\n}\n\nexport interface IAdminAssistantPresenter {\n readonly vm: IAdminAssistantViewModel;\n /**\n * Ask a question in the chat on screen. A change still waiting on a decision is rejected.\n * Refused while `setupRequired`.\n */\n ask(question: string): void;\n /** Approve or reject the calls a turn paused on, then resume it. */\n decide(turnIndex: number, approved: boolean): void;\n /** Drop the conversation and stop anything in flight. The saved chat is kept. */\n reset(): void;\n /** Replace the conversation with a saved chat, so asking again continues it. */\n open(chatId: string): Promise<void>;\n /** Ask the newest question again, when its run failed or was not saved. */\n retry(): void;\n}\n\nexport const AdminAssistantPresenter =\n createAbstraction<IAdminAssistantPresenter>(\"AdminAssistantPresenter\");\n\nexport namespace AdminAssistantPresenter {\n export type Interface = IAdminAssistantPresenter;\n export type ViewModel = IAdminAssistantViewModel;\n export type Turn = AiTurnViewModel;\n}\n"],"names":["AdminAssistantGateway","createAbstraction","AdminAssistantPresenter"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features/adminAssistant/abstractions.js","sources":["../../../src/features/adminAssistant/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { AiChatSaveFailure } from \"~/features/aiChats/abstractions.js\";\nimport type { AiChatsRepository } from \"~/features/aiChats/abstractions.js\";\nimport type { AssistantPageContext } from \"~/features/assistantPageContext/abstractions.js\";\n\n/**\n * A message of a saved chat. Opaque on purpose: the admin only reads them to show an opened chat,\n * and the server is the one that sends them to the model.\n */\nexport type AdminAssistantMessage = { role: string; content: unknown };\n\n/** A tool the assistant invoked, so the UI can show its work rather than just an answer. */\nexport interface AdminAssistantToolCall {\n name: string;\n input: unknown;\n}\n\n/** A tool call the assistant wants to make but has not made, because it changes something. */\nexport interface AdminAssistantPendingApproval {\n approvalId: string;\n toolName: string;\n title?: string;\n input: unknown;\n /** The tool declared itself destructive — the UI should say so more loudly. */\n destructive: boolean;\n}\n\nexport interface AdminAssistantDecision {\n approvalId: string;\n approved: boolean;\n reason?: string;\n}\n\n/**\n * A question, or the decisions on the calls a run paused on. The server reads the rest of the\n * conversation from the saved chat, so only its id is sent; without one, a question starts a chat.\n */\nexport interface AdminAssistantRequest {\n chatId?: string;\n prompt?: string;\n /** Approve or reject calls the server paused on. Needs the `chatId` of the paused run. */\n approvals?: AdminAssistantDecision[];\n /** What the user had on screen when they asked. Sent with questions only. */\n pageContext?: AssistantPageContext.Data;\n}\n\n/**\n * What the assistant emits while it works. Mirrors the server's `AdminAssistantEvent`; declared here so the\n * admin bundle carries no server or AI SDK code.\n */\nexport type AdminAssistantStreamEvent =\n // The run is going ahead, on this model (\"anthropic/claude-sonnet-4-5\").\n | { type: \"start\"; model: string }\n | { type: \"text\"; text: string }\n | { type: \"tool-call\"; name: string }\n | { type: \"tool-result\"; name: string }\n // A tool threw. Pairs with `tool-call` by name, and does not end the run.\n | { type: \"tool-error\"; name: string; message: string }\n | { type: \"follow-ups\"; questions: string[] }\n | { type: \"approval\"; approvals: AdminAssistantPendingApproval[] }\n // The run was saved, as a new chat or onto the one asked about.\n | { type: \"saved\"; chat: AiChatsRepository.Summary }\n // The run finished but the server could not save it. `retryable` says whether asking again could.\n | { type: \"not-saved\"; message: string; retryable: boolean }\n // Comes after `saved` or `not-saved`.\n | { type: \"done\"; steps: number }\n | { type: \"error\"; message: string; code?: \"AI_CAPABILITY_NOT_CONFIGURED\" };\n\nexport interface IAdminAssistantGateway {\n /**\n * Run and yield progress as it arrives. Preferred in the UI: a multi-tool question takes tens of\n * seconds, and an approval request is worth showing the moment it appears.\n */\n stream(\n request: AdminAssistantRequest,\n signal?: AbortSignal\n ): AsyncIterable<AdminAssistantStreamEvent>;\n}\n\n/** Sends a question to the server-side AI assistant (`POST /ai/chat`). */\nexport const AdminAssistantGateway =\n createAbstraction<IAdminAssistantGateway>(\"AdminAssistantGateway\");\n\nexport namespace AdminAssistantGateway {\n export type Interface = IAdminAssistantGateway;\n export type Message = AdminAssistantMessage;\n export type ToolCall = AdminAssistantToolCall;\n export type PendingApproval = AdminAssistantPendingApproval;\n export type Decision = AdminAssistantDecision;\n export type Request = AdminAssistantRequest;\n export type StreamEvent = AdminAssistantStreamEvent;\n}\n\n/** One question and the answer to it, as the view needs it. */\nexport interface AiTurnViewModel {\n question: string;\n /** Answer text so far. Grows as the stream arrives. */\n text: string;\n /**\n * Where the answer proper starts in `text`: after the last tool call. Text before it is the\n * model saying what it is about to look up, which is no summary of the answer.\n */\n answerStart: number;\n /** Tools called this turn, in call order. */\n tools: string[];\n /**\n * Tools that returned. A call pending approval still emits `tool-call`, so this is the only way\n * to tell a completed tool from one merely proposed.\n */\n completed: string[];\n /** Tools that threw. Settles the chip as a failure; the run continues. */\n failed: string[];\n /** Set while a tool is running and no answer text has arrived yet. */\n running: boolean;\n pendingApprovals: AdminAssistantPendingApproval[];\n /** Questions the assistant suggests asking next. Empty until the answer is in. */\n followUps: string[];\n settled: boolean;\n error?: string;\n /**\n * The turn failed because the project has no model set up. Shown as a setup screen rather\n * than an error; `error` holds the server's reason, which names the setting to fix.\n */\n needsSetup: boolean;\n}\n\nexport interface IAdminAssistantViewModel {\n turns: AiTurnViewModel[];\n /** A run is in flight. Asking again or deciding again is refused while true. */\n busy: boolean;\n /**\n * The model the last run used, fully qualified. Absent before the first run, since the admin\n * only learns it from the server.\n */\n model?: string;\n /** The saved chat this conversation is, once its first turn is saved or a chat is opened. */\n chatId: string | null;\n /** A saved chat is being read. */\n opening: boolean;\n /**\n * Why the last run was not saved, or the last open failed. The conversation on screen carries\n * on either way; this is only so the view can say it is not saved.\n */\n storageError: string | null;\n /**\n * Set when it was a run that was not saved, so the view can offer what fixes it. Null for an\n * open.\n */\n saveFailure: AiChatSaveFailure | null;\n /**\n * The newest turn needs a model set up first. No question is taken until \"Try again\" (`retry`)\n * succeeds, so the view can stop taking input.\n */\n setupRequired: boolean;\n}\n\nexport interface IAdminAssistantPresenter {\n readonly vm: IAdminAssistantViewModel;\n /**\n * Ask a question in the chat on screen. A change still waiting on a decision is rejected.\n * Refused while `setupRequired`.\n */\n ask(question: string): void;\n /** Approve or reject the calls a turn paused on, then resume it. */\n decide(turnIndex: number, approved: boolean): void;\n /** Drop the conversation and stop anything in flight. The saved chat is kept. */\n reset(): void;\n /** Replace the conversation with a saved chat, so asking again continues it. */\n open(chatId: string): Promise<void>;\n /** Ask the newest question again, when its run failed or was not saved. */\n retry(): void;\n}\n\nexport const AdminAssistantPresenter =\n createAbstraction<IAdminAssistantPresenter>(\"AdminAssistantPresenter\");\n\nexport namespace AdminAssistantPresenter {\n export type Interface = IAdminAssistantPresenter;\n export type ViewModel = IAdminAssistantViewModel;\n export type Turn = AiTurnViewModel;\n}\n"],"names":["AdminAssistantGateway","createAbstraction","AdminAssistantPresenter"],"mappings":";AAgFO,MAAMA,wBACTC,kBAA0C;AA4FvC,MAAMC,0BACTD,kBAA4C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RecordChangedEventHandler } from "@webiny/app/features/recordChanges/index.js";
|
|
2
|
+
import { UsersRevision } from "./abstractions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Every change moves the list. An update also moves the user, so an open form for it reads it again.
|
|
5
|
+
* A deleted user's open form is left alone: reading it back would fail, and the form already handles
|
|
6
|
+
* a failed read by going back to the list with an error.
|
|
7
|
+
*/
|
|
8
|
+
declare class MarkUsersChangedImpl implements RecordChangedEventHandler.Interface {
|
|
9
|
+
private revision;
|
|
10
|
+
constructor(revision: UsersRevision.Interface);
|
|
11
|
+
handle(event: RecordChangedEventHandler.Event): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const MarkUsersChanged: typeof MarkUsersChangedImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/app/features/recordChanges/RecordChangedEvent.js").RecordChangedEvent>>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RecordChangedEventHandler } from "@webiny/app/features/recordChanges/index.js";
|
|
2
|
+
import { UsersRevision } from "./abstractions.js";
|
|
3
|
+
const USER_RECORD_TYPE = "adminUsers.user";
|
|
4
|
+
class MarkUsersChangedImpl {
|
|
5
|
+
constructor(revision){
|
|
6
|
+
this.revision = revision;
|
|
7
|
+
}
|
|
8
|
+
async handle(event) {
|
|
9
|
+
const { type, id, change } = event.payload;
|
|
10
|
+
if (type !== USER_RECORD_TYPE) return;
|
|
11
|
+
this.revision.listChanged();
|
|
12
|
+
if ("updated" === change) this.revision.userChanged(id);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const MarkUsersChanged = RecordChangedEventHandler.createImplementation({
|
|
16
|
+
implementation: MarkUsersChangedImpl,
|
|
17
|
+
dependencies: [
|
|
18
|
+
UsersRevision
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
export { MarkUsersChanged };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=MarkUsersChanged.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/adminUsers/users/userEvents/MarkUsersChanged.js","sources":["../../../../../src/features/adminUsers/users/userEvents/MarkUsersChanged.ts"],"sourcesContent":["import { RecordChangedEventHandler } from \"@webiny/app/features/recordChanges/index.js\";\nimport { UsersRevision } from \"./abstractions.js\";\n\n// Sent by the api for admin users; see `USER_RECORD_TYPE` in @webiny/api-core.\nconst USER_RECORD_TYPE = \"adminUsers.user\";\n\n/**\n * Every change moves the list. An update also moves the user, so an open form for it reads it again.\n * A deleted user's open form is left alone: reading it back would fail, and the form already handles\n * a failed read by going back to the list with an error.\n */\nclass MarkUsersChangedImpl implements RecordChangedEventHandler.Interface {\n constructor(private revision: UsersRevision.Interface) {}\n\n async handle(event: RecordChangedEventHandler.Event): Promise<void> {\n const { type, id, change } = event.payload;\n if (type !== USER_RECORD_TYPE) {\n return;\n }\n\n this.revision.listChanged();\n if (change === \"updated\") {\n this.revision.userChanged(id);\n }\n }\n}\n\nexport const MarkUsersChanged = RecordChangedEventHandler.createImplementation({\n implementation: MarkUsersChangedImpl,\n dependencies: [UsersRevision]\n});\n"],"names":["USER_RECORD_TYPE","MarkUsersChangedImpl","revision","event","type","id","change","MarkUsersChanged","RecordChangedEventHandler","UsersRevision"],"mappings":";;AAIA,MAAMA,mBAAmB;AAOzB,MAAMC;IACF,YAAoBC,QAAiC,CAAE;aAAnCA,QAAQ,GAARA;IAAoC;IAExD,MAAM,OAAOC,KAAsC,EAAiB;QAChE,MAAM,EAAEC,IAAI,EAAEC,EAAE,EAAEC,MAAM,EAAE,GAAGH,MAAM,OAAO;QAC1C,IAAIC,SAASJ,kBACT;QAGJ,IAAI,CAAC,QAAQ,CAAC,WAAW;QACzB,IAAIM,AAAW,cAAXA,QACA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAACD;IAElC;AACJ;AAEO,MAAME,mBAAmBC,0BAA0B,oBAAoB,CAAC;IAC3E,gBAAgBP;IAChB,cAAc;QAACQ;KAAc;AACjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UsersRevision as Abstraction } from "./abstractions.js";
|
|
2
|
+
declare class UsersRevisionImpl implements Abstraction.Interface {
|
|
3
|
+
list: number;
|
|
4
|
+
private users;
|
|
5
|
+
constructor();
|
|
6
|
+
user(id: string): number;
|
|
7
|
+
listChanged(): void;
|
|
8
|
+
userChanged(id: string): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const UsersRevision: typeof UsersRevisionImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IUsersRevision>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { makeAutoObservable } from "mobx";
|
|
2
|
+
import { UsersRevision } from "./abstractions.js";
|
|
3
|
+
class UsersRevisionImpl {
|
|
4
|
+
constructor(){
|
|
5
|
+
this.list = 0;
|
|
6
|
+
this.users = new Map();
|
|
7
|
+
makeAutoObservable(this);
|
|
8
|
+
}
|
|
9
|
+
user(id) {
|
|
10
|
+
return this.users.get(id) ?? 0;
|
|
11
|
+
}
|
|
12
|
+
listChanged() {
|
|
13
|
+
this.list++;
|
|
14
|
+
}
|
|
15
|
+
userChanged(id) {
|
|
16
|
+
this.users.set(id, this.user(id) + 1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const UsersRevision_UsersRevision = UsersRevision.createImplementation({
|
|
20
|
+
implementation: UsersRevisionImpl,
|
|
21
|
+
dependencies: []
|
|
22
|
+
});
|
|
23
|
+
export { UsersRevision_UsersRevision as UsersRevision };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=UsersRevision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/adminUsers/users/userEvents/UsersRevision.js","sources":["../../../../../src/features/adminUsers/users/userEvents/UsersRevision.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { UsersRevision as Abstraction } from \"./abstractions.js\";\n\nclass UsersRevisionImpl implements Abstraction.Interface {\n list = 0;\n private users = new Map<string, number>();\n\n constructor() {\n makeAutoObservable(this);\n }\n\n user(id: string): number {\n return this.users.get(id) ?? 0;\n }\n\n listChanged(): void {\n this.list++;\n }\n\n userChanged(id: string): void {\n this.users.set(id, this.user(id) + 1);\n }\n}\n\nexport const UsersRevision = Abstraction.createImplementation({\n implementation: UsersRevisionImpl,\n dependencies: []\n});\n"],"names":["UsersRevisionImpl","Map","makeAutoObservable","id","UsersRevision","Abstraction"],"mappings":";;AAGA,MAAMA;IAIF,aAAc;aAHd,IAAI,GAAG;aACC,KAAK,GAAG,IAAIC;QAGhBC,mBAAmB,IAAI;IAC3B;IAEA,KAAKC,EAAU,EAAU;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,OAAO;IACjC;IAEA,cAAoB;QAChB,IAAI,CAAC,IAAI;IACb;IAEA,YAAYA,EAAU,EAAQ;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAACA,IAAI,IAAI,CAAC,IAAI,CAACA,MAAM;IACvC;AACJ;AAEO,MAAMC,8BAAgBC,cAAAA,oBAAgC,CAAC;IAC1D,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IUsersRevision {
|
|
2
|
+
/** Changes whenever a user is created, updated or deleted. */
|
|
3
|
+
readonly list: number;
|
|
4
|
+
/** Changes whenever the given user is updated. */
|
|
5
|
+
user(id: string): number;
|
|
6
|
+
listChanged(): void;
|
|
7
|
+
userChanged(id: string): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Tells the Users view when what it loaded is out of date. The view keeps the users list and the
|
|
11
|
+
* open user in component state rather than in a shared cache, so it watches these numbers and reads
|
|
12
|
+
* again when one moves.
|
|
13
|
+
*/
|
|
14
|
+
export declare const UsersRevision: import("@webiny/di").Abstraction<IUsersRevision>;
|
|
15
|
+
export declare namespace UsersRevision {
|
|
16
|
+
type Interface = IUsersRevision;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/adminUsers/users/userEvents/abstractions.js","sources":["../../../../../src/features/adminUsers/users/userEvents/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IUsersRevision {\n /** Changes whenever a user is created, updated or deleted. */\n readonly list: number;\n /** Changes whenever the given user is updated. */\n user(id: string): number;\n listChanged(): void;\n userChanged(id: string): void;\n}\n\n/**\n * Tells the Users view when what it loaded is out of date. The view keeps the users list and the\n * open user in component state rather than in a shared cache, so it watches these numbers and reads\n * again when one moves.\n */\nexport const UsersRevision = createAbstraction<IUsersRevision>(\"AdminUsers/UsersRevision\");\n\nexport namespace UsersRevision {\n export type Interface = IUsersRevision;\n}\n"],"names":["UsersRevision","createAbstraction"],"mappings":";AAgBO,MAAMA,gBAAgBC,kBAAkC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { UsersRevision } from "./abstractions.js";
|
|
3
|
+
import { UsersRevision as external_UsersRevision_js_UsersRevision } from "./UsersRevision.js";
|
|
4
|
+
import { MarkUsersChanged } from "./MarkUsersChanged.js";
|
|
5
|
+
const UserEventsFeature = createFeature({
|
|
6
|
+
name: "AdminUsers/UserEvents",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(external_UsersRevision_js_UsersRevision).inSingletonScope();
|
|
9
|
+
container.register(MarkUsersChanged);
|
|
10
|
+
},
|
|
11
|
+
resolve (container) {
|
|
12
|
+
return {
|
|
13
|
+
revision: container.resolve(UsersRevision)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { UserEventsFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/adminUsers/users/userEvents/feature.js","sources":["../../../../../src/features/adminUsers/users/userEvents/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { UsersRevision as RevisionAbstraction } from \"./abstractions.js\";\nimport { UsersRevision } from \"./UsersRevision.js\";\nimport { MarkUsersChanged } from \"./MarkUsersChanged.js\";\n\n/** Keeps the Users view current when admin users are created, updated or deleted on the server. */\nexport const UserEventsFeature = createFeature({\n name: \"AdminUsers/UserEvents\",\n register(container) {\n container.register(UsersRevision).inSingletonScope();\n container.register(MarkUsersChanged);\n },\n resolve(container) {\n return {\n revision: container.resolve(RevisionAbstraction)\n };\n }\n});\n"],"names":["UserEventsFeature","createFeature","container","UsersRevision","MarkUsersChanged","RevisionAbstraction"],"mappings":";;;;AAMO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,yCAAe,gBAAgB;QAClDD,UAAU,QAAQ,CAACE;IACvB;IACA,SAAQF,SAAS;QACb,OAAO;YACH,UAAUA,UAAU,OAAO,CAACG;QAChC;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserEventsFeature } from "./feature.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserEventsFeature } from "./feature.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AssistantPageContext as Abstraction } from "./abstractions.js";
|
|
2
|
+
declare class AssistantPageContextImpl implements Abstraction.Interface {
|
|
3
|
+
private entries;
|
|
4
|
+
set(context: Abstraction.Data): Abstraction.Owner;
|
|
5
|
+
update(owner: Abstraction.Owner, context: Abstraction.Data): void;
|
|
6
|
+
clear(owner: Abstraction.Owner): void;
|
|
7
|
+
get(): Abstraction.Data | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const AssistantPageContext: typeof AssistantPageContextImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IAssistantPageContext>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AssistantPageContext } from "./abstractions.js";
|
|
2
|
+
class AssistantPageContextImpl {
|
|
3
|
+
set(context) {
|
|
4
|
+
const owner = Symbol("AssistantPageContextOwner");
|
|
5
|
+
this.entries.push({
|
|
6
|
+
owner,
|
|
7
|
+
context
|
|
8
|
+
});
|
|
9
|
+
return owner;
|
|
10
|
+
}
|
|
11
|
+
update(owner, context) {
|
|
12
|
+
const entry = this.entries.find((entry)=>entry.owner === owner);
|
|
13
|
+
if (entry) entry.context = context;
|
|
14
|
+
}
|
|
15
|
+
clear(owner) {
|
|
16
|
+
this.entries = this.entries.filter((entry)=>entry.owner !== owner);
|
|
17
|
+
}
|
|
18
|
+
get() {
|
|
19
|
+
const newest = this.entries[this.entries.length - 1];
|
|
20
|
+
return newest?.context ?? null;
|
|
21
|
+
}
|
|
22
|
+
constructor(){
|
|
23
|
+
this.entries = [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const AssistantPageContext_AssistantPageContext = AssistantPageContext.createImplementation({
|
|
27
|
+
implementation: AssistantPageContextImpl,
|
|
28
|
+
dependencies: []
|
|
29
|
+
});
|
|
30
|
+
export { AssistantPageContext_AssistantPageContext as AssistantPageContext };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=AssistantPageContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assistantPageContext/AssistantPageContext.js","sources":["../../../src/features/assistantPageContext/AssistantPageContext.ts"],"sourcesContent":["import { AssistantPageContext as Abstraction } from \"./abstractions.js\";\n\ninterface Entry {\n owner: Abstraction.Owner;\n context: Abstraction.Data;\n}\n\n/*\n * A stack, newest last: a drawer that describes itself over a page that does too is what the user\n * is looking at, and closing it hands the page's context back. Not observable, since nothing renders\n * it; the assistant reads it at the moment a question is asked.\n */\nclass AssistantPageContextImpl implements Abstraction.Interface {\n private entries: Entry[] = [];\n\n set(context: Abstraction.Data): Abstraction.Owner {\n const owner = Symbol(\"AssistantPageContextOwner\");\n this.entries.push({ owner, context });\n return owner;\n }\n\n update(owner: Abstraction.Owner, context: Abstraction.Data): void {\n const entry = this.entries.find(entry => entry.owner === owner);\n if (entry) {\n entry.context = context;\n }\n }\n\n clear(owner: Abstraction.Owner): void {\n this.entries = this.entries.filter(entry => entry.owner !== owner);\n }\n\n get(): Abstraction.Data | null {\n const newest = this.entries[this.entries.length - 1];\n return newest?.context ?? null;\n }\n}\n\nexport const AssistantPageContext = Abstraction.createImplementation({\n implementation: AssistantPageContextImpl,\n dependencies: []\n});\n"],"names":["AssistantPageContextImpl","context","owner","Symbol","entry","newest","AssistantPageContext","Abstraction"],"mappings":";AAYA,MAAMA;IAGF,IAAIC,OAAyB,EAAqB;QAC9C,MAAMC,QAAQC,OAAO;QACrB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAAED;YAAOD;QAAQ;QACnC,OAAOC;IACX;IAEA,OAAOA,KAAwB,EAAED,OAAyB,EAAQ;QAC9D,MAAMG,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAACA,CAAAA,QAASA,MAAM,KAAK,KAAKF;QACzD,IAAIE,OACAA,MAAM,OAAO,GAAGH;IAExB;IAEA,MAAMC,KAAwB,EAAQ;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAACE,CAAAA,QAASA,MAAM,KAAK,KAAKF;IAChE;IAEA,MAA+B;QAC3B,MAAMG,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE;QACpD,OAAOA,QAAQ,WAAW;IAC9B;;aAtBQ,OAAO,GAAY,EAAE;;AAuBjC;AAEO,MAAMC,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the user has on screen, sent to the assistant with each question so it can resolve "this
|
|
3
|
+
* folder", "Archive" or "these entries" without searching for them. `view` says what the screen is
|
|
4
|
+
* ("Entries of the Product content model"); `details` holds the ids and titles a question might
|
|
5
|
+
* refer to. Keep it to ids, titles and types: never record contents. The server drops details over
|
|
6
|
+
* a few kilobytes.
|
|
7
|
+
*/
|
|
8
|
+
export interface AssistantPageContextData {
|
|
9
|
+
view: string;
|
|
10
|
+
details: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/** Identifies one `set`, so each view clears only the context it set. */
|
|
13
|
+
export type AssistantPageContextOwner = symbol;
|
|
14
|
+
export interface IAssistantPageContext {
|
|
15
|
+
/** Put a context in front of any earlier one. Returns the owner to pass to `clear`. */
|
|
16
|
+
set(context: AssistantPageContextData): AssistantPageContextOwner;
|
|
17
|
+
/** Replace what this owner set without moving it, so a context set over it stays on top. */
|
|
18
|
+
update(owner: AssistantPageContextOwner, context: AssistantPageContextData): void;
|
|
19
|
+
/** Remove the context this owner set. The one before it, if any, is current again. */
|
|
20
|
+
clear(owner: AssistantPageContextOwner): void;
|
|
21
|
+
/** The newest context still set. */
|
|
22
|
+
get(): AssistantPageContextData | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The screen the user is on, as the assistant should know it. A view's presenter sets it when the
|
|
26
|
+
* view starts and clears it when the view is disposed.
|
|
27
|
+
*/
|
|
28
|
+
export declare const AssistantPageContext: import("@webiny/di").Abstraction<IAssistantPageContext>;
|
|
29
|
+
export declare namespace AssistantPageContext {
|
|
30
|
+
type Interface = IAssistantPageContext;
|
|
31
|
+
type Data = AssistantPageContextData;
|
|
32
|
+
type Owner = AssistantPageContextOwner;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assistantPageContext/abstractions.js","sources":["../../../src/features/assistantPageContext/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\n/**\n * What the user has on screen, sent to the assistant with each question so it can resolve \"this\n * folder\", \"Archive\" or \"these entries\" without searching for them. `view` says what the screen is\n * (\"Entries of the Product content model\"); `details` holds the ids and titles a question might\n * refer to. Keep it to ids, titles and types: never record contents. The server drops details over\n * a few kilobytes.\n */\nexport interface AssistantPageContextData {\n view: string;\n details: Record<string, unknown>;\n}\n\n/** Identifies one `set`, so each view clears only the context it set. */\nexport type AssistantPageContextOwner = symbol;\n\nexport interface IAssistantPageContext {\n /** Put a context in front of any earlier one. Returns the owner to pass to `clear`. */\n set(context: AssistantPageContextData): AssistantPageContextOwner;\n /** Replace what this owner set without moving it, so a context set over it stays on top. */\n update(owner: AssistantPageContextOwner, context: AssistantPageContextData): void;\n /** Remove the context this owner set. The one before it, if any, is current again. */\n clear(owner: AssistantPageContextOwner): void;\n /** The newest context still set. */\n get(): AssistantPageContextData | null;\n}\n\n/**\n * The screen the user is on, as the assistant should know it. A view's presenter sets it when the\n * view starts and clears it when the view is disposed.\n */\nexport const AssistantPageContext =\n createAbstraction<IAssistantPageContext>(\"AssistantPageContext\");\n\nexport namespace AssistantPageContext {\n export type Interface = IAssistantPageContext;\n export type Data = AssistantPageContextData;\n export type Owner = AssistantPageContextOwner;\n}\n"],"names":["AssistantPageContext","createAbstraction"],"mappings":";AAgCO,MAAMA,uBACTC,kBAAyC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { AssistantPageContext } from "./AssistantPageContext.js";
|
|
3
|
+
import { AssistantPageContext as external_abstractions_js_AssistantPageContext } from "./abstractions.js";
|
|
4
|
+
const AssistantPageContextFeature = createFeature({
|
|
5
|
+
name: "AssistantPageContext",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(AssistantPageContext).inSingletonScope();
|
|
8
|
+
},
|
|
9
|
+
resolve (container) {
|
|
10
|
+
return {
|
|
11
|
+
pageContext: container.resolve(external_abstractions_js_AssistantPageContext)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export { AssistantPageContextFeature };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assistantPageContext/feature.js","sources":["../../../src/features/assistantPageContext/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AssistantPageContext } from \"./AssistantPageContext.js\";\nimport { AssistantPageContext as Abstraction } from \"./abstractions.js\";\n\nexport const AssistantPageContextFeature = createFeature({\n name: \"AssistantPageContext\",\n register(container) {\n // Singleton: the view that sets it and the assistant that reads it must share one.\n container.register(AssistantPageContext).inSingletonScope();\n },\n resolve(container) {\n return { pageContext: container.resolve(Abstraction) };\n }\n});\n"],"names":["AssistantPageContextFeature","createFeature","container","AssistantPageContext","Abstraction"],"mappings":";;;AAIO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAASC,SAAS;QAEdA,UAAU,QAAQ,CAACC,sBAAsB,gBAAgB;IAC7D;IACA,SAAQD,SAAS;QACb,OAAO;YAAE,aAAaA,UAAU,OAAO,CAACE;QAAa;IACzD;AACJ"}
|
package/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export { Command, CommandPaletteFeature, CommandPalettePresenter } from "./prese
|
|
|
64
64
|
export type { ICommand, CommandDetailProps, CommandItemVm, ActiveCommandVm, CommandPaletteViewModel } from "./presentation/commandPalette/index.js";
|
|
65
65
|
export { AdminAssistantGateway, AdminAssistantFeature, AdminAssistantPresenter } from "./features/adminAssistant/index.js";
|
|
66
66
|
export type { IAdminAssistantGateway, AdminAssistantMessage, AdminAssistantToolCall, AdminAssistantPendingApproval, AdminAssistantDecision, AdminAssistantRequest, AiTurnViewModel, IAdminAssistantPresenter, IAdminAssistantViewModel } from "./features/adminAssistant/index.js";
|
|
67
|
+
export { AssistantPageContext, AssistantPageContextFeature } from "./features/assistantPageContext/index.js";
|
|
67
68
|
export { AiChatsFeature, AiChatsRepository, AiChatsGateway } from "./features/aiChats/index.js";
|
|
68
69
|
export type { AiChat, AiChatSummary, AiChatsPage, AiChatSaveFailure } from "./features/aiChats/index.js";
|
|
69
70
|
export { AiChatsPanelFeature, AiChatsPanelPresenter } from "./presentation/aiChats/index.js";
|
package/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import "./base/Base/FieldRenderers/TextareaRenderer.js";
|
|
|
28
28
|
import "./base/Base/FieldRenderers/MultiSelectRenderer.js";
|
|
29
29
|
import "./base/Base/FieldRenderers/SelectRenderer.js";
|
|
30
30
|
import "./base/Base/FieldRenderers/InputRenderer.js";
|
|
31
|
+
import "./features/formModel/renderers.js";
|
|
31
32
|
import "./features/formModel/fieldTypes/TextFieldType.js";
|
|
32
33
|
import "./features/formModel/fieldTypes/NumberFieldType.js";
|
|
33
34
|
import "./features/formModel/fieldTypes/BooleanFieldType.js";
|
|
@@ -36,7 +37,6 @@ import "./features/formModel/fieldTypes/FileFieldType.js";
|
|
|
36
37
|
import "./features/formModel/fieldTypes/FileUrlFieldType.js";
|
|
37
38
|
import "./features/formModel/fieldTypes/ObjectFieldType.js";
|
|
38
39
|
import "./features/formModel/fieldTypes/LexicalFieldType.js";
|
|
39
|
-
import "./features/formModel/renderers.js";
|
|
40
40
|
export * from "@webiny/app";
|
|
41
41
|
export * from "./base/ui/Tags.js";
|
|
42
42
|
export * from "./base/ui/Layout.js";
|
|
@@ -87,6 +87,7 @@ export { useAuthentication } from "./presentation/security/hooks/useAuthenticati
|
|
|
87
87
|
export { useBuildParams } from "./presentation/buildParams/useBuildParams.js";
|
|
88
88
|
export { Command, CommandPaletteFeature, CommandPalettePresenter } from "./presentation/commandPalette/index.js";
|
|
89
89
|
export { AdminAssistantFeature, AdminAssistantGateway, AdminAssistantPresenter } from "./features/adminAssistant/index.js";
|
|
90
|
+
export { AssistantPageContext, AssistantPageContextFeature } from "./features/assistantPageContext/index.js";
|
|
90
91
|
export { AiChatsFeature, AiChatsGateway, AiChatsRepository } from "./features/aiChats/index.js";
|
|
91
92
|
export { AiChatsPanelFeature, AiChatsPanelPresenter } from "./presentation/aiChats/index.js";
|
|
92
93
|
export { AiSettingsLocation } from "./features/aiSettings/index.js";
|