@assistant-ui/react 0.7.23 → 0.7.25
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/AssistantRuntime.d.ts +1 -1
- package/dist/api/AssistantRuntime.d.ts.map +1 -1
- package/dist/api/AssistantRuntime.js +1 -1
- package/dist/api/AssistantRuntime.js.map +1 -1
- package/dist/api/AssistantRuntime.mjs +1 -1
- package/dist/api/AssistantRuntime.mjs.map +1 -1
- package/dist/api/ComposerRuntime.d.ts +4 -2
- package/dist/api/ComposerRuntime.d.ts.map +1 -1
- package/dist/api/ComposerRuntime.js +6 -1
- package/dist/api/ComposerRuntime.js.map +1 -1
- package/dist/api/ComposerRuntime.mjs +6 -1
- package/dist/api/ComposerRuntime.mjs.map +1 -1
- package/dist/api/ThreadListItemRuntime.d.ts +3 -1
- package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListItemRuntime.js.map +1 -1
- package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
- package/dist/api/ThreadListRuntime.d.ts +8 -8
- package/dist/api/ThreadListRuntime.d.ts.map +1 -1
- package/dist/api/ThreadListRuntime.js +7 -5
- package/dist/api/ThreadListRuntime.js.map +1 -1
- package/dist/api/ThreadListRuntime.mjs +7 -5
- package/dist/api/ThreadListRuntime.mjs.map +1 -1
- package/dist/api/ThreadRuntime.d.ts +59 -32
- package/dist/api/ThreadRuntime.d.ts.map +1 -1
- package/dist/api/ThreadRuntime.js +2 -2
- package/dist/api/ThreadRuntime.js.map +1 -1
- package/dist/api/ThreadRuntime.mjs +2 -2
- package/dist/api/ThreadRuntime.mjs.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.js +8 -3
- package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
- package/dist/context/providers/AssistantRuntimeProvider.mjs +8 -3
- package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +2 -4
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.mjs +2 -4
- package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts +6 -6
- package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js +29 -20
- package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +29 -20
- package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +2 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +2 -3
- package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.mjs +1 -1
- package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts +2 -0
- package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts +2 -1
- package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +4 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +1 -0
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +5 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +5 -1
- package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/index.d.ts +5 -4
- package/dist/runtimes/index.d.ts.map +1 -1
- package/dist/runtimes/index.js +11 -9
- package/dist/runtimes/index.js.map +1 -1
- package/dist/runtimes/index.mjs +5 -4
- package/dist/runtimes/index.mjs.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +2 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js +12 -8
- package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +12 -8
- package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
- package/dist/runtimes/remote-thread-list/BaseSubscribable.d.ts +8 -0
- package/dist/runtimes/remote-thread-list/BaseSubscribable.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js +62 -0
- package/dist/runtimes/remote-thread-list/BaseSubscribable.js.map +1 -0
- package/dist/runtimes/remote-thread-list/BaseSubscribable.mjs +37 -0
- package/dist/runtimes/remote-thread-list/BaseSubscribable.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.d.ts +3 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +150 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs +125 -0
- package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.d.ts +23 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.js +83 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.js.map +1 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.mjs +58 -0
- package/dist/runtimes/remote-thread-list/OptimisticState.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +75 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +127 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs +102 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +76 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +396 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +371 -0
- package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.d.ts +7 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.js +39 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.mjs +14 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloud.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.d.ts +19 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.js +79 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.mjs +57 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAPI.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.d.ts +20 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.js +95 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.mjs +69 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.d.ts +46 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.js +50 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.mjs +25 -0
- package/dist/runtimes/remote-thread-list/cloud/AssistantCloudThreads.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.d.ts +10 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.js +32 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.mjs +7 -0
- package/dist/runtimes/remote-thread-list/cloud/CloudContext.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/index.d.ts +4 -0
- package/dist/runtimes/remote-thread-list/cloud/index.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/index.js +37 -0
- package/dist/runtimes/remote-thread-list/cloud/index.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/index.mjs +10 -0
- package/dist/runtimes/remote-thread-list/cloud/index.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.d.ts +4 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.js +46 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.mjs +22 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts +14 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js +103 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.js.map +1 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs +79 -0
- package/dist/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/index.d.ts +2 -0
- package/dist/runtimes/remote-thread-list/index.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/index.js +25 -0
- package/dist/runtimes/remote-thread-list/index.js.map +1 -0
- package/dist/runtimes/remote-thread-list/index.mjs +3 -0
- package/dist/runtimes/remote-thread-list/index.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/types.d.ts +25 -0
- package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/types.js +19 -0
- package/dist/runtimes/remote-thread-list/types.js.map +1 -0
- package/dist/runtimes/remote-thread-list/types.mjs +1 -0
- package/dist/runtimes/remote-thread-list/types.mjs.map +1 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.d.ts +3 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +51 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +26 -0
- package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -0
- package/dist/styles/index.css +2 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +5 -1
- package/dist/styles/tailwindcss/thread.css.json +4 -1
- package/dist/ui/attachment-ui.d.ts.map +1 -1
- package/dist/ui/attachment-ui.js +12 -7
- package/dist/ui/attachment-ui.js.map +1 -1
- package/dist/ui/attachment-ui.mjs +12 -7
- package/dist/ui/attachment-ui.mjs.map +1 -1
- package/dist/utils/createActionButton.d.ts +2 -2
- package/dist/utils/createActionButton.d.ts.map +1 -1
- package/dist/utils/createActionButton.js +2 -4
- package/dist/utils/createActionButton.js.map +1 -1
- package/dist/utils/createActionButton.mjs +5 -5
- package/dist/utils/createActionButton.mjs.map +1 -1
- package/package.json +3 -3
- package/src/api/AssistantRuntime.ts +2 -6
- package/src/api/ComposerRuntime.ts +10 -2
- package/src/api/ThreadListItemRuntime.ts +3 -1
- package/src/api/ThreadListRuntime.ts +11 -9
- package/src/api/ThreadRuntime.ts +3 -3
- package/src/context/providers/AssistantRuntimeProvider.tsx +21 -6
- package/src/primitives/threadList/ThreadListItems.tsx +3 -5
- package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +43 -25
- package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +2 -3
- package/src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx +1 -1
- package/src/runtimes/core/AssistantRuntimeCore.tsx +3 -0
- package/src/runtimes/core/ComposerRuntimeCore.tsx +2 -1
- package/src/runtimes/core/ThreadListRuntimeCore.tsx +5 -2
- package/src/runtimes/external-store/ExternalStoreAdapter.tsx +1 -1
- package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +6 -1
- package/src/runtimes/index.ts +5 -4
- package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +14 -9
- package/src/runtimes/remote-thread-list/BaseSubscribable.tsx +38 -0
- package/src/runtimes/remote-thread-list/EMPTY_THREAD_CORE.tsx +158 -0
- package/src/runtimes/remote-thread-list/OptimisticState.ts +82 -0
- package/src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +132 -0
- package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +486 -0
- package/src/runtimes/remote-thread-list/cloud/AssistantCloud.tsx +11 -0
- package/src/runtimes/remote-thread-list/cloud/AssistantCloudAPI.tsx +81 -0
- package/src/runtimes/remote-thread-list/cloud/AssistantCloudAuthStrategy.tsx +95 -0
- package/src/runtimes/remote-thread-list/cloud/AssistantCloudThreads.tsx +72 -0
- package/src/runtimes/remote-thread-list/cloud/CloudContext.tsx +12 -0
- package/src/runtimes/remote-thread-list/cloud/index.ts +3 -0
- package/src/runtimes/remote-thread-list/cloud/useCloudGetOrCreateThread.tsx +19 -0
- package/src/runtimes/remote-thread-list/cloud/useCloudThreadListRuntime.tsx +100 -0
- package/src/runtimes/remote-thread-list/index.ts +2 -0
- package/src/runtimes/remote-thread-list/types.tsx +34 -0
- package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +28 -0
- package/src/styles/tailwindcss/thread.css +5 -1
- package/src/ui/attachment-ui.tsx +20 -14
- package/src/utils/createActionButton.tsx +11 -6
@@ -23,8 +23,9 @@ __export(BaseComposerRuntimeCore_exports, {
|
|
23
23
|
BaseComposerRuntimeCore: () => BaseComposerRuntimeCore
|
24
24
|
});
|
25
25
|
module.exports = __toCommonJS(BaseComposerRuntimeCore_exports);
|
26
|
+
var import_BaseSubscribable = require("../remote-thread-list/BaseSubscribable.js");
|
26
27
|
var isAttachmentComplete = (a) => a.status.type === "complete";
|
27
|
-
var BaseComposerRuntimeCore = class {
|
28
|
+
var BaseComposerRuntimeCore = class extends import_BaseSubscribable.BaseSubscribable {
|
28
29
|
isEditing = true;
|
29
30
|
getAttachmentAccept() {
|
30
31
|
return this.getAttachmentAdapter()?.accept ?? "*";
|
@@ -35,7 +36,7 @@ var BaseComposerRuntimeCore = class {
|
|
35
36
|
}
|
36
37
|
setAttachments(value) {
|
37
38
|
this._attachments = value;
|
38
|
-
this.
|
39
|
+
this._notifySubscribers();
|
39
40
|
}
|
40
41
|
get isEmpty() {
|
41
42
|
return !this.text.trim() && !this.attachments.length;
|
@@ -55,27 +56,43 @@ var BaseComposerRuntimeCore = class {
|
|
55
56
|
setText(value) {
|
56
57
|
if (this._text === value) return;
|
57
58
|
this._text = value;
|
58
|
-
this.
|
59
|
+
this._notifySubscribers();
|
59
60
|
}
|
60
61
|
setRole(role) {
|
61
62
|
if (this._role === role) return;
|
62
63
|
this._role = role;
|
63
|
-
this.
|
64
|
+
this._notifySubscribers();
|
64
65
|
}
|
65
66
|
setRunConfig(runConfig) {
|
66
67
|
if (this._runConfig === runConfig) return;
|
67
68
|
this._runConfig = runConfig;
|
68
|
-
this.
|
69
|
+
this._notifySubscribers();
|
69
70
|
}
|
70
|
-
|
71
|
+
_emptyTextAndAttachments() {
|
71
72
|
this._attachments = [];
|
72
73
|
this._text = "";
|
74
|
+
this._notifySubscribers();
|
75
|
+
}
|
76
|
+
async _onClearAttachments() {
|
77
|
+
const adapter = this.getAttachmentAdapter();
|
78
|
+
if (adapter) {
|
79
|
+
await Promise.all(this._attachments.map((a) => adapter.remove(a)));
|
80
|
+
}
|
81
|
+
}
|
82
|
+
async reset() {
|
83
|
+
if (this._attachments.length === 0 && this._text === "" && this._role === "user" && Object.keys(this._runConfig).length === 0) {
|
84
|
+
return;
|
85
|
+
}
|
73
86
|
this._role = "user";
|
74
87
|
this._runConfig = {};
|
75
|
-
this.
|
88
|
+
const task = this._onClearAttachments();
|
89
|
+
this._emptyTextAndAttachments();
|
90
|
+
await task;
|
76
91
|
}
|
77
|
-
async
|
78
|
-
|
92
|
+
async clearAttachments() {
|
93
|
+
const task = this._onClearAttachments();
|
94
|
+
this.setAttachments([]);
|
95
|
+
await task;
|
79
96
|
}
|
80
97
|
async send() {
|
81
98
|
const adapter = this.getAttachmentAdapter();
|
@@ -92,7 +109,7 @@ var BaseComposerRuntimeCore = class {
|
|
92
109
|
attachments,
|
93
110
|
runConfig: this.runConfig
|
94
111
|
};
|
95
|
-
this.
|
112
|
+
this._emptyTextAndAttachments();
|
96
113
|
this.handleSend(message);
|
97
114
|
this._notifyEventSubscribers("send");
|
98
115
|
}
|
@@ -104,7 +121,7 @@ var BaseComposerRuntimeCore = class {
|
|
104
121
|
if (!adapter) throw new Error("Attachments are not supported");
|
105
122
|
const attachment = await adapter.add({ file });
|
106
123
|
this._attachments = [...this._attachments, attachment];
|
107
|
-
this.
|
124
|
+
this._notifySubscribers();
|
108
125
|
}
|
109
126
|
async removeAttachment(attachmentId) {
|
110
127
|
const adapter = this.getAttachmentAdapter();
|
@@ -114,15 +131,7 @@ var BaseComposerRuntimeCore = class {
|
|
114
131
|
const attachment = this._attachments[index];
|
115
132
|
await adapter.remove(attachment);
|
116
133
|
this._attachments = this._attachments.toSpliced(index, 1);
|
117
|
-
this.
|
118
|
-
}
|
119
|
-
_subscriptions = /* @__PURE__ */ new Set();
|
120
|
-
notifySubscribers() {
|
121
|
-
for (const callback of this._subscriptions) callback();
|
122
|
-
}
|
123
|
-
subscribe(callback) {
|
124
|
-
this._subscriptions.add(callback);
|
125
|
-
return () => this._subscriptions.delete(callback);
|
134
|
+
this._notifySubscribers();
|
126
135
|
}
|
127
136
|
_eventSubscribers = /* @__PURE__ */ new Map();
|
128
137
|
_notifyEventSubscribers(event) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n} from \"../core/ComposerRuntimeCore\";\nimport { MessageRole, RunConfig } from \"../../types/AssistantTypes\";\nimport { BaseSubscribable } from \"../remote-thread-list/BaseSubscribable\";\n\nconst isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>\n a.status.type === \"complete\";\n\nexport abstract class BaseComposerRuntimeCore\n extends BaseSubscribable\n implements ComposerRuntimeCore\n{\n public readonly isEditing = true;\n\n protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;\n\n public getAttachmentAccept(): string {\n return this.getAttachmentAdapter()?.accept ?? \"*\";\n }\n\n private _attachments: readonly Attachment[] = [];\n public get attachments() {\n return this._attachments;\n }\n\n protected setAttachments(value: readonly Attachment[]) {\n this._attachments = value;\n this._notifySubscribers();\n }\n\n public abstract get canCancel(): boolean;\n\n public get isEmpty() {\n return !this.text.trim() && !this.attachments.length;\n }\n\n private _text = \"\";\n\n get text() {\n return this._text;\n }\n\n private _role: MessageRole = \"user\";\n\n get role() {\n return this._role;\n }\n\n private _runConfig: RunConfig = {};\n\n get runConfig() {\n return this._runConfig;\n }\n\n public setText(value: string) {\n if (this._text === value) return;\n\n this._text = value;\n this._notifySubscribers();\n }\n\n public setRole(role: MessageRole) {\n if (this._role === role) return;\n\n this._role = role;\n this._notifySubscribers();\n }\n\n public setRunConfig(runConfig: RunConfig) {\n if (this._runConfig === runConfig) return;\n\n this._runConfig = runConfig;\n this._notifySubscribers();\n }\n\n private _emptyTextAndAttachments() {\n this._attachments = [];\n this._text = \"\";\n this._notifySubscribers();\n }\n\n private async _onClearAttachments() {\n const adapter = this.getAttachmentAdapter();\n if (adapter) {\n await Promise.all(this._attachments.map((a) => adapter.remove(a)));\n }\n }\n\n public async reset() {\n if (\n this._attachments.length === 0 &&\n this._text === \"\" &&\n this._role === \"user\" &&\n Object.keys(this._runConfig).length === 0\n ) {\n return;\n }\n\n this._role = \"user\";\n this._runConfig = {};\n\n const task = this._onClearAttachments();\n this._emptyTextAndAttachments();\n await task;\n }\n\n public async clearAttachments() {\n const task = this._onClearAttachments();\n this.setAttachments([]);\n\n await task;\n }\n\n public async send() {\n const adapter = this.getAttachmentAdapter();\n const attachments =\n adapter && this.attachments.length > 0\n ? await Promise.all(\n this.attachments.map(async (a) => {\n if (isAttachmentComplete(a)) return a;\n const result = await adapter.send(a);\n return result as CompleteAttachment;\n }),\n )\n : [];\n\n const message: Omit<AppendMessage, \"parentId\"> = {\n role: this.role,\n content: this.text ? [{ type: \"text\", text: this.text }] : [],\n attachments,\n runConfig: this.runConfig,\n };\n this._emptyTextAndAttachments();\n\n this.handleSend(message);\n this._notifyEventSubscribers(\"send\");\n }\n\n public cancel() {\n this.handleCancel();\n }\n\n protected abstract handleSend(message: Omit<AppendMessage, \"parentId\">): void;\n protected abstract handleCancel(): void;\n\n async addAttachment(file: File) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const attachment = await adapter.add({ file });\n\n this._attachments = [...this._attachments, attachment as PendingAttachment];\n this._notifySubscribers();\n }\n\n async removeAttachment(attachmentId: string) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const index = this._attachments.findIndex((a) => a.id === attachmentId);\n if (index === -1) throw new Error(\"Attachment not found\");\n const attachment = this._attachments[index]!;\n\n await adapter.remove(attachment);\n\n this._attachments = this._attachments.toSpliced(index, 1);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<\n ComposerRuntimeEventType,\n Set<() => void>\n >();\n\n protected _notifyEventSubscribers(event: ComposerRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public unstable_on(event: ComposerRuntimeEventType, callback: () => void) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,8BAAiC;AAEjC,IAAM,uBAAuB,CAAC,MAC5B,EAAE,OAAO,SAAS;AAEb,IAAe,0BAAf,cACG,yCAEV;AAAA,EACkB,YAAY;AAAA,EAIrB,sBAA8B;AACnC,WAAO,KAAK,qBAAqB,GAAG,UAAU;AAAA,EAChD;AAAA,EAEQ,eAAsC,CAAC;AAAA,EAC/C,IAAW,cAAc;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEU,eAAe,OAA8B;AACrD,SAAK,eAAe;AACpB,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAIA,IAAW,UAAU;AACnB,WAAO,CAAC,KAAK,KAAK,KAAK,KAAK,CAAC,KAAK,YAAY;AAAA,EAChD;AAAA,EAEQ,QAAQ;AAAA,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,oBAAoB,oBAAI,IAG9B;AAAA,EAEQ,wBAAwB,OAAiC;AACjE,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,YAAa;AAElB,eAAW,YAAY,YAAa,UAAS;AAAA,EAC/C;AAAA,EAEO,YAAY,OAAiC,UAAsB;AACxE,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,aAAa;AAChB,WAAK,kBAAkB,IAAI,OAAO,oBAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;AAAA,IACvD,OAAO;AACL,kBAAY,IAAI,QAAQ;AAAA,IAC1B;AAEA,WAAO,MAAM;AACX,YAAMA,eAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,UAAI,CAACA,aAAa;AAClB,MAAAA,aAAY,OAAO,QAAQ;AAAA,IAC7B;AAAA,EACF;AACF;","names":["subscribers"]}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// src/runtimes/composer/BaseComposerRuntimeCore.tsx
|
2
|
+
import { BaseSubscribable } from "../remote-thread-list/BaseSubscribable.mjs";
|
2
3
|
var isAttachmentComplete = (a) => a.status.type === "complete";
|
3
|
-
var BaseComposerRuntimeCore = class {
|
4
|
+
var BaseComposerRuntimeCore = class extends BaseSubscribable {
|
4
5
|
isEditing = true;
|
5
6
|
getAttachmentAccept() {
|
6
7
|
return this.getAttachmentAdapter()?.accept ?? "*";
|
@@ -11,7 +12,7 @@ var BaseComposerRuntimeCore = class {
|
|
11
12
|
}
|
12
13
|
setAttachments(value) {
|
13
14
|
this._attachments = value;
|
14
|
-
this.
|
15
|
+
this._notifySubscribers();
|
15
16
|
}
|
16
17
|
get isEmpty() {
|
17
18
|
return !this.text.trim() && !this.attachments.length;
|
@@ -31,27 +32,43 @@ var BaseComposerRuntimeCore = class {
|
|
31
32
|
setText(value) {
|
32
33
|
if (this._text === value) return;
|
33
34
|
this._text = value;
|
34
|
-
this.
|
35
|
+
this._notifySubscribers();
|
35
36
|
}
|
36
37
|
setRole(role) {
|
37
38
|
if (this._role === role) return;
|
38
39
|
this._role = role;
|
39
|
-
this.
|
40
|
+
this._notifySubscribers();
|
40
41
|
}
|
41
42
|
setRunConfig(runConfig) {
|
42
43
|
if (this._runConfig === runConfig) return;
|
43
44
|
this._runConfig = runConfig;
|
44
|
-
this.
|
45
|
+
this._notifySubscribers();
|
45
46
|
}
|
46
|
-
|
47
|
+
_emptyTextAndAttachments() {
|
47
48
|
this._attachments = [];
|
48
49
|
this._text = "";
|
50
|
+
this._notifySubscribers();
|
51
|
+
}
|
52
|
+
async _onClearAttachments() {
|
53
|
+
const adapter = this.getAttachmentAdapter();
|
54
|
+
if (adapter) {
|
55
|
+
await Promise.all(this._attachments.map((a) => adapter.remove(a)));
|
56
|
+
}
|
57
|
+
}
|
58
|
+
async reset() {
|
59
|
+
if (this._attachments.length === 0 && this._text === "" && this._role === "user" && Object.keys(this._runConfig).length === 0) {
|
60
|
+
return;
|
61
|
+
}
|
49
62
|
this._role = "user";
|
50
63
|
this._runConfig = {};
|
51
|
-
this.
|
64
|
+
const task = this._onClearAttachments();
|
65
|
+
this._emptyTextAndAttachments();
|
66
|
+
await task;
|
52
67
|
}
|
53
|
-
async
|
54
|
-
|
68
|
+
async clearAttachments() {
|
69
|
+
const task = this._onClearAttachments();
|
70
|
+
this.setAttachments([]);
|
71
|
+
await task;
|
55
72
|
}
|
56
73
|
async send() {
|
57
74
|
const adapter = this.getAttachmentAdapter();
|
@@ -68,7 +85,7 @@ var BaseComposerRuntimeCore = class {
|
|
68
85
|
attachments,
|
69
86
|
runConfig: this.runConfig
|
70
87
|
};
|
71
|
-
this.
|
88
|
+
this._emptyTextAndAttachments();
|
72
89
|
this.handleSend(message);
|
73
90
|
this._notifyEventSubscribers("send");
|
74
91
|
}
|
@@ -80,7 +97,7 @@ var BaseComposerRuntimeCore = class {
|
|
80
97
|
if (!adapter) throw new Error("Attachments are not supported");
|
81
98
|
const attachment = await adapter.add({ file });
|
82
99
|
this._attachments = [...this._attachments, attachment];
|
83
|
-
this.
|
100
|
+
this._notifySubscribers();
|
84
101
|
}
|
85
102
|
async removeAttachment(attachmentId) {
|
86
103
|
const adapter = this.getAttachmentAdapter();
|
@@ -90,15 +107,7 @@ var BaseComposerRuntimeCore = class {
|
|
90
107
|
const attachment = this._attachments[index];
|
91
108
|
await adapter.remove(attachment);
|
92
109
|
this._attachments = this._attachments.toSpliced(index, 1);
|
93
|
-
this.
|
94
|
-
}
|
95
|
-
_subscriptions = /* @__PURE__ */ new Set();
|
96
|
-
notifySubscribers() {
|
97
|
-
for (const callback of this._subscriptions) callback();
|
98
|
-
}
|
99
|
-
subscribe(callback) {
|
100
|
-
this._subscriptions.add(callback);
|
101
|
-
return () => this._subscriptions.delete(callback);
|
110
|
+
this._notifySubscribers();
|
102
111
|
}
|
103
112
|
_eventSubscribers = /* @__PURE__ */ new Map();
|
104
113
|
_notifyEventSubscribers(event) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n ComposerRuntimeCore,\n ComposerRuntimeEventType,\n} from \"../core/ComposerRuntimeCore\";\nimport { MessageRole, RunConfig } from \"../../types/AssistantTypes\";\nimport { BaseSubscribable } from \"../remote-thread-list/BaseSubscribable\";\n\nconst isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>\n a.status.type === \"complete\";\n\nexport abstract class BaseComposerRuntimeCore\n extends BaseSubscribable\n implements ComposerRuntimeCore\n{\n public readonly isEditing = true;\n\n protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;\n\n public getAttachmentAccept(): string {\n return this.getAttachmentAdapter()?.accept ?? \"*\";\n }\n\n private _attachments: readonly Attachment[] = [];\n public get attachments() {\n return this._attachments;\n }\n\n protected setAttachments(value: readonly Attachment[]) {\n this._attachments = value;\n this._notifySubscribers();\n }\n\n public abstract get canCancel(): boolean;\n\n public get isEmpty() {\n return !this.text.trim() && !this.attachments.length;\n }\n\n private _text = \"\";\n\n get text() {\n return this._text;\n }\n\n private _role: MessageRole = \"user\";\n\n get role() {\n return this._role;\n }\n\n private _runConfig: RunConfig = {};\n\n get runConfig() {\n return this._runConfig;\n }\n\n public setText(value: string) {\n if (this._text === value) return;\n\n this._text = value;\n this._notifySubscribers();\n }\n\n public setRole(role: MessageRole) {\n if (this._role === role) return;\n\n this._role = role;\n this._notifySubscribers();\n }\n\n public setRunConfig(runConfig: RunConfig) {\n if (this._runConfig === runConfig) return;\n\n this._runConfig = runConfig;\n this._notifySubscribers();\n }\n\n private _emptyTextAndAttachments() {\n this._attachments = [];\n this._text = \"\";\n this._notifySubscribers();\n }\n\n private async _onClearAttachments() {\n const adapter = this.getAttachmentAdapter();\n if (adapter) {\n await Promise.all(this._attachments.map((a) => adapter.remove(a)));\n }\n }\n\n public async reset() {\n if (\n this._attachments.length === 0 &&\n this._text === \"\" &&\n this._role === \"user\" &&\n Object.keys(this._runConfig).length === 0\n ) {\n return;\n }\n\n this._role = \"user\";\n this._runConfig = {};\n\n const task = this._onClearAttachments();\n this._emptyTextAndAttachments();\n await task;\n }\n\n public async clearAttachments() {\n const task = this._onClearAttachments();\n this.setAttachments([]);\n\n await task;\n }\n\n public async send() {\n const adapter = this.getAttachmentAdapter();\n const attachments =\n adapter && this.attachments.length > 0\n ? await Promise.all(\n this.attachments.map(async (a) => {\n if (isAttachmentComplete(a)) return a;\n const result = await adapter.send(a);\n return result as CompleteAttachment;\n }),\n )\n : [];\n\n const message: Omit<AppendMessage, \"parentId\"> = {\n role: this.role,\n content: this.text ? [{ type: \"text\", text: this.text }] : [],\n attachments,\n runConfig: this.runConfig,\n };\n this._emptyTextAndAttachments();\n\n this.handleSend(message);\n this._notifyEventSubscribers(\"send\");\n }\n\n public cancel() {\n this.handleCancel();\n }\n\n protected abstract handleSend(message: Omit<AppendMessage, \"parentId\">): void;\n protected abstract handleCancel(): void;\n\n async addAttachment(file: File) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const attachment = await adapter.add({ file });\n\n this._attachments = [...this._attachments, attachment as PendingAttachment];\n this._notifySubscribers();\n }\n\n async removeAttachment(attachmentId: string) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const index = this._attachments.findIndex((a) => a.id === attachmentId);\n if (index === -1) throw new Error(\"Attachment not found\");\n const attachment = this._attachments[index]!;\n\n await adapter.remove(attachment);\n\n this._attachments = this._attachments.toSpliced(index, 1);\n this._notifySubscribers();\n }\n\n private _eventSubscribers = new Map<\n ComposerRuntimeEventType,\n Set<() => void>\n >();\n\n protected _notifyEventSubscribers(event: ComposerRuntimeEventType) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n\n for (const callback of subscribers) callback();\n }\n\n public unstable_on(event: ComposerRuntimeEventType, callback: () => void) {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) {\n this._eventSubscribers.set(event, new Set([callback]));\n } else {\n subscribers.add(callback);\n }\n\n return () => {\n const subscribers = this._eventSubscribers.get(event);\n if (!subscribers) return;\n subscribers.delete(callback);\n };\n }\n}\n"],"mappings":";AAYA,SAAS,wBAAwB;AAEjC,IAAM,uBAAuB,CAAC,MAC5B,EAAE,OAAO,SAAS;AAEb,IAAe,0BAAf,cACG,iBAEV;AAAA,EACkB,YAAY;AAAA,EAIrB,sBAA8B;AACnC,WAAO,KAAK,qBAAqB,GAAG,UAAU;AAAA,EAChD;AAAA,EAEQ,eAAsC,CAAC;AAAA,EAC/C,IAAW,cAAc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AE,OAAO,YAAY;AACtE,QAAI,UAAU,GAAI,OAAM,IAAI,MAAM,sBAAsB;AACxD,UAAM,aAAa,KAAK,aAAa,KAAK;AAE1C,UAAM,QAAQ,OAAO,UAAU;AAE/B,SAAK,eAAe,KAAK,aAAa,UAAU,OAAO,CAAC;AACxD,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEQ,oBAAoB,oBAAI,IAG9B;AAAA,EAEQ,wBAAwB,OAAiC;AACjE,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,YAAa;AAElB,eAAW,YAAY,YAAa,UAAS;AAAA,EAC/C;AAAA,EAEO,YAAY,OAAiC,UAAsB;AACxE,UAAM,cAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,QAAI,CAAC,aAAa;AAChB,WAAK,kBAAkB,IAAI,OAAO,oBAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;AAAA,IACvD,OAAO;AACL,kBAAY,IAAI,QAAQ;AAAA,IAC1B;AAEA,WAAO,MAAM;AACX,YAAMA,eAAc,KAAK,kBAAkB,IAAI,KAAK;AACpD,UAAI,CAACA,aAAa;AAClB,MAAAA,aAAY,OAAO,QAAQ;AAAA,IAC7B;AAAA,EACF;AACF;","names":["subscribers"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DefaultEditComposerRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,qBAAa,8BAA+B,SAAQ,uBAAuB;IAavE,OAAO,CAAC,OAAO;IAGf,OAAO,CAAC,eAAe;IA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AA;SAAE,GAAG,SAAS,CAAC;KACxE,EACO,eAAe,EAAE,MAAM,IAAI,EACnC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,aAAa,CAAA;KAAE;IAe/D,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IAazD,YAAY;CAIpB"}
|
@@ -57,12 +57,11 @@ var DefaultEditComposerRuntimeCore = class extends import_BaseComposerRuntimeCor
|
|
57
57
|
parentId: this._parentId
|
58
58
|
});
|
59
59
|
}
|
60
|
-
this.
|
61
|
-
this.notifySubscribers();
|
60
|
+
this.handleCancel();
|
62
61
|
}
|
63
62
|
handleCancel() {
|
64
63
|
this.endEditCallback();
|
65
|
-
this.
|
64
|
+
this._notifySubscribers();
|
66
65
|
}
|
67
66
|
};
|
68
67
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n private _nonTextParts;\n private _previousText;\n private _parentId;\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n private endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this._parentId = parentId;\n this._previousText = getThreadMessageText(message);\n this.setText(this._previousText);\n\n this.setRole(message.role);\n this.setAttachments(message.attachments ?? []);\n\n this._nonTextParts = message.content.filter(\n (part) => part.type !== \"text\" && part.type !== \"ui\",\n );\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n const text = getThreadMessageText(message as AppendMessage);\n if (text !== this._previousText) {\n this.runtime.append({\n ...(message as AppendMessage),\n content: [...message.content, ...this._nonTextParts] as any,\n parentId: this._parentId,\n });\n }\n\n this.
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n private _nonTextParts;\n private _previousText;\n private _parentId;\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n private endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this._parentId = parentId;\n this._previousText = getThreadMessageText(message);\n this.setText(this._previousText);\n\n this.setRole(message.role);\n this.setAttachments(message.attachments ?? []);\n\n this._nonTextParts = message.content.filter(\n (part) => part.type !== \"text\" && part.type !== \"ui\",\n );\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n const text = getThreadMessageText(message as AppendMessage);\n if (text !== this._previousText) {\n this.runtime.append({\n ...(message as AppendMessage),\n content: [...message.content, ...this._nonTextParts] as any,\n parentId: this._parentId,\n });\n }\n\n this.handleCancel();\n }\n\n public handleCancel() {\n this.endEditCallback();\n this._notifySubscribers();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kCAAqC;AAGrC,qCAAwC;AAEjC,IAAM,iCAAN,cAA6C,uDAAwB;AAAA,EAY1E,YACU,SAGA,iBACR,EAAE,UAAU,QAAQ,GACpB;AACA,UAAM;AANE;AAGA;AAIR,SAAK,YAAY;AACjB,SAAK,oBAAgB,kDAAqB,OAAO;AACjD,SAAK,QAAQ,KAAK,aAAa;AAE/B,SAAK,QAAQ,QAAQ,IAAI;AACzB,SAAK,eAAe,QAAQ,eAAe,CAAC,CAAC;AAE7C,SAAK,gBAAgB,QAAQ,QAAQ;AAAA,MACnC,CAAC,SAAS,KAAK,SAAS,UAAU,KAAK,SAAS;AAAA,IAClD;AAAA,EACF;AAAA,EA7BA,IAAW,YAAY;AACrB,WAAO;AAAA,EACT;AAAA,EAEU,uBAAuB;AAC/B,WAAO,KAAK,QAAQ,UAAU;AAAA,EAChC;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EAqBR,MAAa,WAAW,SAA0C;AAChE,UAAM,WAAO,kDAAqB,OAAwB;AAC1D,QAAI,SAAS,KAAK,eAAe;AAC/B,WAAK,QAAQ,OAAO;AAAA,QAClB,GAAI;AAAA,QACJ,SAAS,CAAC,GAAG,QAAQ,SAAS,GAAG,KAAK,aAAa;AAAA,QACnD,UAAU,KAAK;AAAA,MACjB,CAAC;AAAA,IACH;AAEA,SAAK,aAAa;AAAA,EACpB;AAAA,EAEO,eAAe;AACpB,SAAK,gBAAgB;AACrB,SAAK,mBAAmB;AAAA,EAC1B;AACF;","names":[]}
|
@@ -33,12 +33,11 @@ var DefaultEditComposerRuntimeCore = class extends BaseComposerRuntimeCore {
|
|
33
33
|
parentId: this._parentId
|
34
34
|
});
|
35
35
|
}
|
36
|
-
this.
|
37
|
-
this.notifySubscribers();
|
36
|
+
this.handleCancel();
|
38
37
|
}
|
39
38
|
handleCancel() {
|
40
39
|
this.endEditCallback();
|
41
|
-
this.
|
40
|
+
this._notifySubscribers();
|
42
41
|
}
|
43
42
|
};
|
44
43
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n private _nonTextParts;\n private _previousText;\n private _parentId;\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n private endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this._parentId = parentId;\n this._previousText = getThreadMessageText(message);\n this.setText(this._previousText);\n\n this.setRole(message.role);\n this.setAttachments(message.attachments ?? []);\n\n this._nonTextParts = message.content.filter(\n (part) => part.type !== \"text\" && part.type !== \"ui\",\n );\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n const text = getThreadMessageText(message as AppendMessage);\n if (text !== this._previousText) {\n this.runtime.append({\n ...(message as AppendMessage),\n content: [...message.content, ...this._nonTextParts] as any,\n parentId: this._parentId,\n });\n }\n\n this.
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { getThreadMessageText } from \"../../utils/getThreadMessageText\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {\n public get canCancel() {\n return true;\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n private _nonTextParts;\n private _previousText;\n private _parentId;\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n private endEditCallback: () => void,\n { parentId, message }: { parentId: string | null; message: ThreadMessage },\n ) {\n super();\n this._parentId = parentId;\n this._previousText = getThreadMessageText(message);\n this.setText(this._previousText);\n\n this.setRole(message.role);\n this.setAttachments(message.attachments ?? []);\n\n this._nonTextParts = message.content.filter(\n (part) => part.type !== \"text\" && part.type !== \"ui\",\n );\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n const text = getThreadMessageText(message as AppendMessage);\n if (text !== this._previousText) {\n this.runtime.append({\n ...(message as AppendMessage),\n content: [...message.content, ...this._nonTextParts] as any,\n parentId: this._parentId,\n });\n }\n\n this.handleCancel();\n }\n\n public handleCancel() {\n this.endEditCallback();\n this._notifySubscribers();\n }\n}\n"],"mappings":";AACA,SAAS,4BAA4B;AAGrC,SAAS,+BAA+B;AAEjC,IAAM,iCAAN,cAA6C,wBAAwB;AAAA,EAY1E,YACU,SAGA,iBACR,EAAE,UAAU,QAAQ,GACpB;AACA,UAAM;AANE;AAGA;AAIR,SAAK,YAAY;AACjB,SAAK,gBAAgB,qBAAqB,OAAO;AACjD,SAAK,QAAQ,KAAK,aAAa;AAE/B,SAAK,QAAQ,QAAQ,IAAI;AACzB,SAAK,eAAe,QAAQ,eAAe,CAAC,CAAC;AAE7C,SAAK,gBAAgB,QAAQ,QAAQ;AAAA,MACnC,CAAC,SAAS,KAAK,SAAS,UAAU,KAAK,SAAS;AAAA,IAClD;AAAA,EACF;AAAA,EA7BA,IAAW,YAAY;AACrB,WAAO;AAAA,EACT;AAAA,EAEU,uBAAuB;AAC/B,WAAO,KAAK,QAAQ,UAAU;AAAA,EAChC;AAAA,EAEQ;AAAA,EACA;AAAA,EACA;AAAA,EAqBR,MAAa,WAAW,SAA0C;AAChE,UAAM,OAAO,qBAAqB,OAAwB;AAC1D,QAAI,SAAS,KAAK,eAAe;AAC/B,WAAK,QAAQ,OAAO;AAAA,QAClB,GAAI;AAAA,QACJ,SAAS,CAAC,GAAG,QAAQ,SAAS,GAAG,KAAK,aAAa;AAAA,QACnD,UAAU,KAAK;AAAA,MACjB,CAAC;AAAA,IACH;AAEA,SAAK,aAAa;AAAA,EACpB;AAAA,EAEO,eAAe;AACpB,SAAK,gBAAgB;AACrB,SAAK,mBAAmB;AAAA,EAC1B;AACF;","names":[]}
|
@@ -44,7 +44,7 @@ var DefaultThreadComposerRuntimeCore = class extends import_BaseComposerRuntimeC
|
|
44
44
|
return this.runtime.subscribe(() => {
|
45
45
|
if (this.canCancel !== this.runtime.capabilities.cancel) {
|
46
46
|
this._canCancel = this.runtime.capabilities.cancel;
|
47
|
-
this.
|
47
|
+
this._notifySubscribers();
|
48
48
|
}
|
49
49
|
});
|
50
50
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, PendingAttachment } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n private _canCancel = false;\n public get canCancel() {\n return this._canCancel;\n }\n\n public override get attachments(): readonly PendingAttachment[] {\n return super.attachments as readonly PendingAttachment[];\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n ) {\n super();\n this.connect();\n }\n\n public connect() {\n return this.runtime.subscribe(() => {\n if (this.canCancel !== this.runtime.capabilities.cancel) {\n this._canCancel = this.runtime.capabilities.cancel;\n this.
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, PendingAttachment } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n private _canCancel = false;\n public get canCancel() {\n return this._canCancel;\n }\n\n public override get attachments(): readonly PendingAttachment[] {\n return super.attachments as readonly PendingAttachment[];\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n ) {\n super();\n this.connect();\n }\n\n public connect() {\n return this.runtime.subscribe(() => {\n if (this.canCancel !== this.runtime.capabilities.cancel) {\n this._canCancel = this.runtime.capabilities.cancel;\n this._notifySubscribers();\n }\n });\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n this.runtime.append({\n ...(message as AppendMessage),\n parentId: this.runtime.messages.at(-1)?.id ?? null,\n });\n }\n\n public async handleCancel() {\n this.runtime.cancelRun();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qCAAwC;AAEjC,IAAM,mCAAN,cACG,uDAEV;AAAA,EAcE,YACU,SAGR;AACA,UAAM;AAJE;AAKR,SAAK,QAAQ;AAAA,EACf;AAAA,EApBQ,aAAa;AAAA,EACrB,IAAW,YAAY;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAoB,cAA4C;AAC9D,WAAO,MAAM;AAAA,EACf;AAAA,EAEU,uBAAuB;AAC/B,WAAO,KAAK,QAAQ,UAAU;AAAA,EAChC;AAAA,EAWO,UAAU;AACf,WAAO,KAAK,QAAQ,UAAU,MAAM;AAClC,UAAI,KAAK,cAAc,KAAK,QAAQ,aAAa,QAAQ;AACvD,aAAK,aAAa,KAAK,QAAQ,aAAa;AAC5C,aAAK,mBAAmB;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,WAAW,SAA0C;AAChE,SAAK,QAAQ,OAAO;AAAA,MAClB,GAAI;AAAA,MACJ,UAAU,KAAK,QAAQ,SAAS,GAAG,EAAE,GAAG,MAAM;AAAA,IAChD,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,eAAe;AAC1B,SAAK,QAAQ,UAAU;AAAA,EACzB;AACF;","names":[]}
|
@@ -20,7 +20,7 @@ var DefaultThreadComposerRuntimeCore = class extends BaseComposerRuntimeCore {
|
|
20
20
|
return this.runtime.subscribe(() => {
|
21
21
|
if (this.canCancel !== this.runtime.capabilities.cancel) {
|
22
22
|
this._canCancel = this.runtime.capabilities.cancel;
|
23
|
-
this.
|
23
|
+
this._notifySubscribers();
|
24
24
|
}
|
25
25
|
});
|
26
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, PendingAttachment } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n private _canCancel = false;\n public get canCancel() {\n return this._canCancel;\n }\n\n public override get attachments(): readonly PendingAttachment[] {\n return super.attachments as readonly PendingAttachment[];\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n ) {\n super();\n this.connect();\n }\n\n public connect() {\n return this.runtime.subscribe(() => {\n if (this.canCancel !== this.runtime.capabilities.cancel) {\n this._canCancel = this.runtime.capabilities.cancel;\n this.
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/composer/DefaultThreadComposerRuntimeCore.tsx"],"sourcesContent":["import { AppendMessage, PendingAttachment } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ThreadComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\nimport { ThreadRuntimeCore } from \"../core/ThreadRuntimeCore\";\nimport { BaseComposerRuntimeCore } from \"./BaseComposerRuntimeCore\";\n\nexport class DefaultThreadComposerRuntimeCore\n extends BaseComposerRuntimeCore\n implements ThreadComposerRuntimeCore\n{\n private _canCancel = false;\n public get canCancel() {\n return this._canCancel;\n }\n\n public override get attachments(): readonly PendingAttachment[] {\n return super.attachments as readonly PendingAttachment[];\n }\n\n protected getAttachmentAdapter() {\n return this.runtime.adapters?.attachments;\n }\n\n constructor(\n private runtime: Omit<ThreadRuntimeCore, \"composer\"> & {\n adapters?: { attachments?: AttachmentAdapter | undefined } | undefined;\n },\n ) {\n super();\n this.connect();\n }\n\n public connect() {\n return this.runtime.subscribe(() => {\n if (this.canCancel !== this.runtime.capabilities.cancel) {\n this._canCancel = this.runtime.capabilities.cancel;\n this._notifySubscribers();\n }\n });\n }\n\n public async handleSend(message: Omit<AppendMessage, \"parentId\">) {\n this.runtime.append({\n ...(message as AppendMessage),\n parentId: this.runtime.messages.at(-1)?.id ?? null,\n });\n }\n\n public async handleCancel() {\n this.runtime.cancelRun();\n }\n}\n"],"mappings":";AAIA,SAAS,+BAA+B;AAEjC,IAAM,mCAAN,cACG,wBAEV;AAAA,EAcE,YACU,SAGR;AACA,UAAM;AAJE;AAKR,SAAK,QAAQ;AAAA,EACf;AAAA,EApBQ,aAAa;AAAA,EACrB,IAAW,YAAY;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAoB,cAA4C;AAC9D,WAAO,MAAM;AAAA,EACf;AAAA,EAEU,uBAAuB;AAC/B,WAAO,KAAK,QAAQ,UAAU;AAAA,EAChC;AAAA,EAWO,UAAU;AACf,WAAO,KAAK,QAAQ,UAAU,MAAM;AAClC,UAAI,KAAK,cAAc,KAAK,QAAQ,aAAa,QAAQ;AACvD,aAAK,aAAa,KAAK,QAAQ,aAAa;AAC5C,aAAK,mBAAmB;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,WAAW,SAA0C;AAChE,SAAK,QAAQ,OAAO;AAAA,MAClB,GAAI;AAAA,MACJ,UAAU,KAAK,QAAQ,SAAS,GAAG,EAAE,GAAG,MAAM;AAAA,IAChD,CAAC;AAAA,EACH;AAAA,EAEA,MAAa,eAAe;AAC1B,SAAK,QAAQ,UAAU;AAAA,EACzB;AACF;","names":[]}
|
@@ -1,8 +1,10 @@
|
|
1
|
+
import { PropsWithChildren } from "react";
|
1
2
|
import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
|
2
3
|
import type { Unsubscribe } from "../../types/Unsubscribe";
|
3
4
|
import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
|
4
5
|
export type AssistantRuntimeCore = {
|
5
6
|
readonly threadList: ThreadListRuntimeCore;
|
6
7
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
8
|
+
__internal_RenderComponent?: React.FC<PropsWithChildren>;
|
7
9
|
};
|
8
10
|
//# sourceMappingURL=AssistantRuntimeCore.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAE3C,2BAA2B,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"AssistantRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAE3C,2BAA2B,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,WAAW,CAAC;IAE5E,0BAA0B,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;CAC1D,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"sourcesContent":["import type { ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport type AssistantRuntimeCore = {\n readonly threadList: ThreadListRuntimeCore;\n\n registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/core/AssistantRuntimeCore.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport type { ModelConfigProvider } from \"../../types/ModelConfigTypes\";\nimport type { Unsubscribe } from \"../../types/Unsubscribe\";\nimport { ThreadListRuntimeCore } from \"./ThreadListRuntimeCore\";\n\nexport type AssistantRuntimeCore = {\n readonly threadList: ThreadListRuntimeCore;\n\n registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;\n\n __internal_RenderComponent?: React.FC<PropsWithChildren>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -15,7 +15,8 @@ export type ComposerRuntimeCore = Readonly<{
|
|
15
15
|
setRole: (role: MessageRole) => void;
|
16
16
|
runConfig: RunConfig;
|
17
17
|
setRunConfig: (runConfig: RunConfig) => void;
|
18
|
-
reset: () => void
|
18
|
+
reset: () => Promise<void>;
|
19
|
+
clearAttachments: () => Promise<void>;
|
19
20
|
send: () => void;
|
20
21
|
cancel: () => void;
|
21
22
|
subscribe: (callback: () => void) => Unsubscribe;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ComposerRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/ComposerRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IAEnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IAE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AAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAErC,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAE7C,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,WAAW,CAAC;IAEjD,WAAW,EAAE,CACX,KAAK,EAAE,wBAAwB,EAC/B,QAAQ,EAAE,MAAM,IAAI,KACjB,WAAW,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GACzD,QAAQ,CAAC;IACP,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC3C,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/ComposerRuntimeCore.tsx"],"sourcesContent":["import type { Attachment, PendingAttachment, Unsubscribe } from \"../../types\";\nimport { MessageRole, RunConfig } from \"../../types/AssistantTypes\";\n\nexport type ComposerRuntimeEventType = \"send\";\n\nexport type ComposerRuntimeCore = Readonly<{\n isEditing: boolean;\n\n canCancel: boolean;\n isEmpty: boolean;\n\n attachments: readonly Attachment[];\n\n getAttachmentAccept(): string;\n addAttachment: (file: File) => Promise<void>;\n removeAttachment: (attachmentId: string) => Promise<void>;\n\n text: string;\n setText: (value: string) => void;\n\n role: MessageRole;\n setRole: (role: MessageRole) => void;\n\n runConfig: RunConfig;\n setRunConfig: (runConfig: RunConfig) => void;\n\n reset: () => void
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/core/ComposerRuntimeCore.tsx"],"sourcesContent":["import type { Attachment, PendingAttachment, Unsubscribe } from \"../../types\";\nimport { MessageRole, RunConfig } from \"../../types/AssistantTypes\";\n\nexport type ComposerRuntimeEventType = \"send\";\n\nexport type ComposerRuntimeCore = Readonly<{\n isEditing: boolean;\n\n canCancel: boolean;\n isEmpty: boolean;\n\n attachments: readonly Attachment[];\n\n getAttachmentAccept(): string;\n addAttachment: (file: File) => Promise<void>;\n removeAttachment: (attachmentId: string) => Promise<void>;\n\n text: string;\n setText: (value: string) => void;\n\n role: MessageRole;\n setRole: (role: MessageRole) => void;\n\n runConfig: RunConfig;\n setRunConfig: (runConfig: RunConfig) => void;\n\n reset: () => Promise<void>;\n clearAttachments: () => Promise<void>;\n\n send: () => void;\n cancel: () => void;\n\n subscribe: (callback: () => void) => Unsubscribe;\n\n unstable_on: (\n event: ComposerRuntimeEventType,\n callback: () => void,\n ) => Unsubscribe;\n}>;\n\nexport type ThreadComposerRuntimeCore = ComposerRuntimeCore &\n Readonly<{\n attachments: readonly PendingAttachment[];\n }>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -2,7 +2,9 @@ import { Unsubscribe } from "../../types";
|
|
2
2
|
import { ThreadRuntimeCore } from "./ThreadRuntimeCore";
|
3
3
|
type ThreadListItemCoreState = {
|
4
4
|
readonly threadId: string;
|
5
|
-
readonly
|
5
|
+
readonly remoteId?: string | undefined;
|
6
|
+
readonly externalId?: string | undefined;
|
7
|
+
readonly status: "archived" | "regular" | "new" | "deleted";
|
6
8
|
readonly title?: string | undefined;
|
7
9
|
readonly runtime?: ThreadRuntimeCore | undefined;
|
8
10
|
};
|
@@ -15,6 +17,7 @@ export type ThreadListRuntimeCore = {
|
|
15
17
|
getItemById(threadId: string): ThreadListItemCoreState | undefined;
|
16
18
|
switchToThread(threadId: string): Promise<void>;
|
17
19
|
switchToNewThread(): Promise<void>;
|
20
|
+
getLoadThreadsPromise(): Promise<void>;
|
18
21
|
rename(threadId: string, newTitle: string): Promise<void>;
|
19
22
|
archive(threadId: string): Promise<void>;
|
20
23
|
unarchive(threadId: string): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThreadListRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/ThreadListRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,
|
1
|
+
{"version":3,"file":"ThreadListRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/core/ThreadListRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,wBAAwB,IAAI,iBAAiB,CAAC;IAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;IAEnE,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAGvC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;CAC9C,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/core/ThreadListRuntimeCore.tsx"],"sourcesContent":["import { Unsubscribe } from \"../../types\";\nimport { ThreadRuntimeCore } from \"./ThreadRuntimeCore\";\n\ntype ThreadListItemCoreState = {\n readonly threadId: string;\n readonly
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/core/ThreadListRuntimeCore.tsx"],"sourcesContent":["import { Unsubscribe } from \"../../types\";\nimport { ThreadRuntimeCore } from \"./ThreadRuntimeCore\";\n\ntype ThreadListItemCoreState = {\n readonly threadId: string;\n readonly remoteId?: string | undefined;\n readonly externalId?: string | undefined;\n\n readonly status: \"archived\" | \"regular\" | \"new\" | \"deleted\";\n readonly title?: string | undefined;\n\n readonly runtime?: ThreadRuntimeCore | undefined;\n};\n\nexport type ThreadListRuntimeCore = {\n mainThreadId: string;\n newThreadId: string | undefined;\n\n threadIds: readonly string[];\n archivedThreadIds: readonly string[];\n\n getMainThreadRuntimeCore(): ThreadRuntimeCore;\n getItemById(threadId: string): ThreadListItemCoreState | undefined;\n\n switchToThread(threadId: string): Promise<void>;\n switchToNewThread(): Promise<void>;\n\n getLoadThreadsPromise(): Promise<void>;\n // getLoadArchivedThreadsPromise(): Promise<void>;\n\n rename(threadId: string, newTitle: string): Promise<void>;\n archive(threadId: string): Promise<void>;\n unarchive(threadId: string): Promise<void>;\n delete(threadId: string): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -5,7 +5,7 @@ import { FeedbackAdapter } from "../feedback/FeedbackAdapter";
|
|
5
5
|
import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
|
6
6
|
import { ThreadMessageLike } from "./ThreadMessageLike";
|
7
7
|
export type ExternalStoreThreadData<TState extends "regular" | "archived"> = {
|
8
|
-
|
8
|
+
status: TState;
|
9
9
|
threadId: string;
|
10
10
|
title?: string | undefined;
|
11
11
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExternalStoreAdapter.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,u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AAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,EACP,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAClE,SAAS,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IAC7C,eAAe,CAAC,EACZ,CAAC,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GACzD,SAAS,CAAC;IACd,cAAc,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,EACL;QACE,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;QAC5C,MAAM,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;QAC5C,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;QACvC;;WAEG;QACH,UAAU,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;KACzD,GACD,SAAS,CAAC;IACd,qBAAqB,CAAC,EAClB;QACE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,aAAa,IAChD,wBAAwB,CAAC,CAAC,CAAC,GACzB,CAAC,CAAC,SAAS,aAAa,GACpB,MAAM,GACN,oCAAoC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n AddToolResultOptions,\n StartRunConfig,\n ThreadSuggestion,\n} from \"../core/ThreadRuntimeCore\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ThreadMessageLike } from \"./ThreadMessageLike\";\n\nexport type ExternalStoreThreadData<TState extends \"regular\" | \"archived\"> = {\n
|
1
|
+
{"version":3,"sources":["../../../src/runtimes/external-store/ExternalStoreAdapter.tsx"],"sourcesContent":["import { AppendMessage, ThreadMessage } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport {\n AddToolResultOptions,\n StartRunConfig,\n ThreadSuggestion,\n} from \"../core/ThreadRuntimeCore\";\nimport { FeedbackAdapter } from \"../feedback/FeedbackAdapter\";\nimport { SpeechSynthesisAdapter } from \"../speech/SpeechAdapterTypes\";\nimport { ThreadMessageLike } from \"./ThreadMessageLike\";\n\nexport type ExternalStoreThreadData<TState extends \"regular\" | \"archived\"> = {\n status: TState;\n threadId: string;\n title?: string | undefined;\n};\n\nexport type ExternalStoreThreadListAdapter = {\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadId?: string | undefined;\n threads?: readonly ExternalStoreThreadData<\"regular\">[] | undefined;\n archivedThreads?: readonly ExternalStoreThreadData<\"archived\">[] | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToNewThread?: (() => Promise<void> | void) | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;\n onRename?: (\n threadId: string,\n newTitle: string,\n ) => (Promise<void> | void) | undefined;\n onArchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onUnarchive?: ((threadId: string) => Promise<void> | void) | undefined;\n onDelete?: ((threadId: string) => Promise<void> | void) | undefined;\n};\n\nexport type ExternalStoreMessageConverter<T> = (\n message: T,\n idx: number,\n) => ThreadMessageLike;\n\ntype ExternalStoreMessageConverterAdapter<T> = {\n convertMessage: ExternalStoreMessageConverter<T>;\n};\n\ntype ExternalStoreAdapterBase<T> = {\n isDisabled?: boolean | undefined;\n isRunning?: boolean | undefined;\n messages: T[];\n suggestions?: readonly ThreadSuggestion[] | undefined;\n extras?: unknown;\n\n setMessages?: ((messages: T[]) => void) | undefined;\n onNew: (message: AppendMessage) => Promise<void>;\n onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;\n onReload?: // TODO: remove parentId in 0.8.0\n | ((parentId: string | null, config: StartRunConfig) => Promise<void>)\n | undefined;\n onCancel?: (() => Promise<void>) | undefined;\n onAddToolResult?:\n | ((options: AddToolResultOptions) => Promise<void> | void)\n | undefined;\n convertMessage?: ExternalStoreMessageConverter<T> | undefined;\n adapters?:\n | {\n attachments?: AttachmentAdapter | undefined;\n speech?: SpeechSynthesisAdapter | undefined;\n feedback?: FeedbackAdapter | undefined;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n threadList?: ExternalStoreThreadListAdapter | undefined;\n }\n | undefined;\n unstable_capabilities?:\n | {\n copy?: boolean | undefined;\n }\n | undefined;\n};\n\nexport type ExternalStoreAdapter<T = ThreadMessage> =\n ExternalStoreAdapterBase<T> &\n (T extends ThreadMessage\n ? object\n : ExternalStoreMessageConverterAdapter<T>);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -12,6 +12,7 @@ export declare class ExternalStoreThreadListRuntimeCore implements ThreadListRun
|
|
12
12
|
get newThreadId(): undefined;
|
13
13
|
get threadIds(): readonly string[];
|
14
14
|
get archivedThreadIds(): readonly string[];
|
15
|
+
getLoadThreadsPromise(): Promise<void>;
|
15
16
|
private _mainThread;
|
16
17
|
get mainThreadId(): string;
|
17
18
|
constructor(adapter: ExternalStoreThreadListAdapter | undefined, threadFactory: ExternalStoreThreadFactory);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExternalStoreThreadListRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,0BAA0B,GAAG,MAAM,8BAA8B,CAAC;
|
1
|
+
{"version":3,"file":"ExternalStoreThreadListRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,0BAA0B,GAAG,MAAM,8BAA8B,CAAC;AAW9E,qBAAa,kCACX,YAAW,qBAAqB;IA6B9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,aAAa;IA5BvB,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,gBAAgB,CAAkC;IAE1D,IAAW,WAAW,cAErB;IAED,IAAW,SAAS,sBAEnB;IAED,IAAW,iBAAiB,sBAE3B;IAEM,qBAAqB;IAI5B,OAAO,CAAC,WAAW,CAAiC;IAEpD,IAAW,YAAY,WAEtB;gBAGS,OAAO,EAAE,8BAA8B,YAAK,EAC5C,aAAa,EAAE,0BAA0B;IAK5C,wBAAwB;IAIxB,WAAW,CAAC,QAAQ,EAAE,MAAM;IAW5B,qBAAqB,CAAC,OAAO,EAAE,8BAA8B;IAuCvD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/C,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD,OAAO,CAAC,cAAc,CAAyB;IAExC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW;IAKnD,OAAO,CAAC,kBAAkB;CAG3B"}
|
@@ -28,8 +28,9 @@ var DEFAULT_THREAD_ID = "DEFAULT_THREAD_ID";
|
|
28
28
|
var DEFAULT_THREADS = Object.freeze([DEFAULT_THREAD_ID]);
|
29
29
|
var DEFAULT_THREAD = Object.freeze({
|
30
30
|
threadId: DEFAULT_THREAD_ID,
|
31
|
-
|
31
|
+
status: "regular"
|
32
32
|
});
|
33
|
+
var RESOLVED_PROMISE = Promise.resolve();
|
33
34
|
var ExternalStoreThreadListRuntimeCore = class {
|
34
35
|
constructor(adapter = {}, threadFactory) {
|
35
36
|
this.adapter = adapter;
|
@@ -48,6 +49,9 @@ var ExternalStoreThreadListRuntimeCore = class {
|
|
48
49
|
get archivedThreadIds() {
|
49
50
|
return this._archivedThreads;
|
50
51
|
}
|
52
|
+
getLoadThreadsPromise() {
|
53
|
+
return RESOLVED_PROMISE;
|
54
|
+
}
|
51
55
|
_mainThread;
|
52
56
|
get mainThreadId() {
|
53
57
|
return this._mainThreadId;
|