@solazah/solazah-runtime 0.1.147 → 0.1.148

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solazah/solazah-runtime",
3
- "version": "0.1.147",
3
+ "version": "0.1.148",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -99,6 +99,16 @@ export interface CopilotOptions extends CopilotChatOptions {
99
99
  }[];
100
100
  }
101
101
  export type CopilotRunOptions = CopilotOptions;
102
+ /** 一行 = 某个模型某一天的 token 统计。model_name 是模型 id,显示名要另去模型清单里换。 */
103
+ export interface CopilotUsageStat {
104
+ model_name: string;
105
+ stat_date: string;
106
+ requests: number;
107
+ prompt_tokens: number;
108
+ cached_tokens: number;
109
+ completion_tokens: number;
110
+ history_rewrites: number;
111
+ }
102
112
  export default class Copilot {
103
113
  ipcRenderer: IpcRenderer;
104
114
  private seq;
@@ -124,6 +134,8 @@ export default class Copilot {
124
134
  * @returns 无返回;requestId 无对应在跑运行时静默无操作。
125
135
  */
126
136
  abort: (requestId: string) => Promise<any>;
137
+ /** 最近 days 天的 token 用量,按 (模型, 日期) 聚合,新到旧。用量看板用。 */
138
+ usage(days?: number): Promise<CopilotUsageStat[]>;
127
139
  /**
128
140
  * 生成途中插一句话:排进待注入队列,模型下一个决策点领走,不中止当前回合。
129
141
  *
package/types/Plugin.d.ts CHANGED
@@ -1,7 +1,16 @@
1
1
  import { default as IpcRenderer } from './IpcRenderer';
2
+ /**
3
+ * 工具回执。只回文字就直接返回字符串;要让模型**看画面**才返回这个:
4
+ * images 是本机绝对路径,宿主读盘后附成一条带图的消息,插件不必再让模型调一次 view_image。
5
+ */
6
+ export interface PluginToolReply {
7
+ text: string;
8
+ /** 本机绝对路径,png / jpg / webp / gif,最多 4 张 */
9
+ images?: string[];
10
+ }
2
11
  export interface PluginTool {
3
12
  name: string;
4
- cb: (args: any) => Promise<string> | string;
13
+ cb: (args: any) => Promise<string | PluginToolReply> | string | PluginToolReply;
5
14
  description: string;
6
15
  schema: object | null;
7
16
  timeoutMs?: number;