@solazah/solazah-runtime 0.2.57 → 0.2.59
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/package.json +1 -1
- package/types/CopilotThread.d.ts +1 -1
- package/types/Plugin.d.ts +20 -0
- package/types/PluginAccount.d.ts +43 -0
package/package.json
CHANGED
package/types/CopilotThread.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export default class CopilotThread {
|
|
|
7
7
|
*
|
|
8
8
|
* @param limit 返回条数上限,默认 15。
|
|
9
9
|
* @param offset 跳过的条数,默认 0,配合 limit 实现分页。
|
|
10
|
-
* @returns CopilotThread
|
|
10
|
+
* @returns CopilotThread 数组,置顶优先,false 与 NULL 同为未置顶,各组内按 updated_at 倒序。
|
|
11
11
|
*/
|
|
12
12
|
getThreads: (limit?: number, offset?: number) => Promise<any>;
|
|
13
13
|
/**
|
package/types/Plugin.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as IpcRenderer } from './IpcRenderer';
|
|
2
|
+
import { default as PluginAccount } from './PluginAccount';
|
|
2
3
|
/**
|
|
3
4
|
* 工具回执。只回文字就直接返回字符串;要让模型**看画面**才返回这个:
|
|
4
5
|
* images 是本机绝对路径,宿主读盘后附成一条带图的消息,插件不必再让模型调一次 view_image。
|
|
@@ -46,6 +47,8 @@ export default class Plugin {
|
|
|
46
47
|
private readonly onSearchHandlers;
|
|
47
48
|
private readonly onActionHandlers;
|
|
48
49
|
private readonly tools;
|
|
50
|
+
/** 用 Solazah 账号登录插件,见 PluginAccount */
|
|
51
|
+
readonly account: PluginAccount;
|
|
49
52
|
constructor(ipcRenderer?: IpcRenderer);
|
|
50
53
|
getTools: () => {
|
|
51
54
|
name: string;
|
|
@@ -202,6 +205,23 @@ export default class Plugin {
|
|
|
202
205
|
* @param ignore 开或关。
|
|
203
206
|
*/
|
|
204
207
|
setIgnoreMouseEvents: (ignore: boolean) => Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* 把本机文件或文件夹作为原生拖拽源拖出窗口,拖到资源管理器、微信、邮件客户端收到的是真实文件。
|
|
210
|
+
* 在 dragstart 回调里先 `event.preventDefault()` 再调用;拖拽结束后 resolve。
|
|
211
|
+
*
|
|
212
|
+
* 参数与 Electron `webContents.startDrag` 的 Item 一一对应。
|
|
213
|
+
*
|
|
214
|
+
* @param item.file 被拖的本机绝对路径,文件或文件夹。
|
|
215
|
+
* @param item.files 一次拖多个时的全部绝对路径;给了就覆盖 file。
|
|
216
|
+
* @param item.icon 拖动过程中跟随光标的那一张图(图片路径或 dataURL),与拖几个文件无关;
|
|
217
|
+
* 不给用第一个路径的系统图标。放下后接收方拿到的文件仍显示各自的系统图标。
|
|
218
|
+
* @throws 路径为空、不是绝对路径或不存在,或 icon 读不出图片时抛错,不开始拖拽。
|
|
219
|
+
*/
|
|
220
|
+
startDrag: (item: {
|
|
221
|
+
file: string;
|
|
222
|
+
files?: string[];
|
|
223
|
+
icon?: string;
|
|
224
|
+
}) => Promise<void>;
|
|
205
225
|
/**
|
|
206
226
|
* 取发起方插件自身的完整信息。
|
|
207
227
|
* 通过 webContents 逆向定位插件,返回插件实体字段 + 其全部命令(commands 数组)+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as IpcRenderer } from './IpcRenderer';
|
|
2
|
+
/** 插件的 Solazah 登录会话 */
|
|
3
|
+
export interface PluginAccountSession {
|
|
4
|
+
/** 受众为 `plugin:<插件包名>` 的短期 JWT,交给插件自己的后端按 JWKS 验签 */
|
|
5
|
+
token: string;
|
|
6
|
+
/** 到期时刻(毫秒时间戳)。不必自己续:快过期时 getSession() 会换一张 */
|
|
7
|
+
expiresAt: number;
|
|
8
|
+
user: {
|
|
9
|
+
/** 插件内用户标识:同一个人在同一插件里恒定,换个插件就不同 */
|
|
10
|
+
sub: string;
|
|
11
|
+
/** 账号 ID(与宿主设置页「账号 ID」相同)。展示用:有昵称显示昵称,没有显示它 */
|
|
12
|
+
username: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
picture?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `window.plugin.account`:用 Solazah 账号登录插件。
|
|
19
|
+
*/
|
|
20
|
+
export default class PluginAccount {
|
|
21
|
+
private transport;
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
private subscribed;
|
|
24
|
+
constructor(transport?: IpcRenderer);
|
|
25
|
+
/**
|
|
26
|
+
* 请求登录。已登录直接交回会话;第三方插件会先弹一次确认,宿主没登录时在系统浏览器里登录,登完才返回。
|
|
27
|
+
* 用户在浏览器里迟迟不登,可以再调一次:前一次让位交回 null,由这一次接着等。
|
|
28
|
+
*
|
|
29
|
+
* @returns 会话;用户取消、或被又一次 login() 顶替时为 null
|
|
30
|
+
* @throws 宿主登录失败(错误信息可直接展示)
|
|
31
|
+
*/
|
|
32
|
+
login: () => Promise<PluginAccountSession | null>;
|
|
33
|
+
/** 当前会话,不弹窗。没登录过或宿主没登录时为 null */
|
|
34
|
+
getSession: () => Promise<PluginAccountSession | null>;
|
|
35
|
+
/** 退出插件的登录,宿主账号不动 */
|
|
36
|
+
logout: () => Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* 登录态可能变了(宿主登录 / 登出、本插件登录 / 退出)就带着最新会话回调。
|
|
39
|
+
*
|
|
40
|
+
* @returns 取消订阅
|
|
41
|
+
*/
|
|
42
|
+
onChanged: (listener: (session: PluginAccountSession | null) => void) => (() => void);
|
|
43
|
+
}
|