@plume-canvas/server 0.1.29 → 0.1.31
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/builtin-manifest.json +2 -1
- package/dist/cli.js +44 -43
- package/dist/index.d.ts +98 -8
- package/dist/index.js +28 -27
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -161,6 +161,13 @@ declare interface ActionTextInput {
|
|
|
161
161
|
labels: Record<string, string>;
|
|
162
162
|
/** 已按「只显示改过默认值的」规则拼好的摘要(默认表现就是它) */
|
|
163
163
|
summary: string;
|
|
164
|
+
/**
|
|
165
|
+
* 用户当前输入的文字(用户 2026-12-02)。
|
|
166
|
+
*
|
|
167
|
+
* 按字数 / 秒数计价的音频模型要它才能报价(`sendLabel` 里算字符数)。
|
|
168
|
+
* 视频 / 图片用不到,但不传也不影响。
|
|
169
|
+
*/
|
|
170
|
+
promptText?: string;
|
|
164
171
|
/** 上游连进来的素材条数(按 kind 分) */
|
|
165
172
|
resources: {
|
|
166
173
|
image: number;
|
|
@@ -168,6 +175,21 @@ declare interface ActionTextInput {
|
|
|
168
175
|
audio: number;
|
|
169
176
|
text: number;
|
|
170
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* 上游素材的**真实尺寸**(后台读过字节再给,用来算 token)。
|
|
180
|
+
*
|
|
181
|
+
* 只有读得出的项才出现;取不到就是空数组 —— provider 不该按条数瞎猜分辨率。
|
|
182
|
+
* 用户 2026-12-02:拖入参考图 / 视频,价格必须跟着变。
|
|
183
|
+
*/
|
|
184
|
+
resourceDetails?: Array<{
|
|
185
|
+
kind: string;
|
|
186
|
+
width?: number;
|
|
187
|
+
height?: number;
|
|
188
|
+
/** 视频 / 音频时长(毫秒) */
|
|
189
|
+
durationMs?: number;
|
|
190
|
+
/** 素材字节数 */
|
|
191
|
+
bytes?: number;
|
|
192
|
+
}>;
|
|
171
193
|
}
|
|
172
194
|
|
|
173
195
|
/** 新增连线的入参 */
|
|
@@ -629,7 +651,7 @@ export declare class CanvasDocument {
|
|
|
629
651
|
/**
|
|
630
652
|
* 输出类型改过之后,把**已经不合规**的连线断掉。
|
|
631
653
|
*
|
|
632
|
-
* 用户 2026-11-17 的口径:可视化节点原来输出图片、下游连着图片节点;把
|
|
654
|
+
* 用户 2026-11-17 的口径:可视化节点原来输出图片、下游连着图片节点;把 outputType 改成
|
|
633
655
|
* 音频后,那条线就不成立了 —— 必须自动断开,不能留一条点不动的线。
|
|
634
656
|
*
|
|
635
657
|
* 为什么后台也要有一份:网页端在 GraphDocument 里做(updateNode 后自动 prune),
|
|
@@ -637,7 +659,7 @@ export declare class CanvasDocument {
|
|
|
637
659
|
* 「网页上连着的时候 AI 改了类型」会留下一条脏边,直到用户刷新才被前端清掉。
|
|
638
660
|
*
|
|
639
661
|
* 规则刻意只有一条、且与前端同一口径:只有 `type === 'ui'` 的节点,输出类型读
|
|
640
|
-
* `data.
|
|
662
|
+
* `data.outputType`(image / video / audio / text);空或认不出 = 没有输出口。
|
|
641
663
|
* 上游输入口收这些类型;下游输入口如果声明了能收哪些类型(这里没有类型注册表,
|
|
642
664
|
* 只能按已知的四类节点判断),不匹配就删边。
|
|
643
665
|
*/
|
|
@@ -2638,6 +2660,65 @@ declare interface ProviderAccount {
|
|
|
2638
2660
|
/** 动作自带的投递函数(返回服务端任务号 / 立即完成 / 失败) */
|
|
2639
2661
|
declare type ProviderActionSubmit = (ctx: ActionRunContext, signal?: AbortSignal) => Promise<ProviderSubmitResult>;
|
|
2640
2662
|
|
|
2663
|
+
/** 一次 HTTP 调用(请求 + 响应) */
|
|
2664
|
+
declare interface ProviderCall {
|
|
2665
|
+
seq: number;
|
|
2666
|
+
at: string;
|
|
2667
|
+
method: string;
|
|
2668
|
+
url: string;
|
|
2669
|
+
requestHeaders?: Record<string, string>;
|
|
2670
|
+
requestBody?: string;
|
|
2671
|
+
requestTruncated?: boolean;
|
|
2672
|
+
status?: number;
|
|
2673
|
+
responseHeaders?: Record<string, string>;
|
|
2674
|
+
responseBody?: string;
|
|
2675
|
+
responseTruncated?: boolean;
|
|
2676
|
+
durationMs?: number;
|
|
2677
|
+
error?: string;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
declare interface ProviderCallLog {
|
|
2681
|
+
dir: string;
|
|
2682
|
+
newRecord(input: Omit<ProviderCallRecord, 'startedAt' | 'calls'>): ProviderCallRecord;
|
|
2683
|
+
append(record: ProviderCallRecord, call: ProviderCall): Promise<void>;
|
|
2684
|
+
finish(record: ProviderCallRecord, status: 'done' | 'error', error?: string): Promise<void>;
|
|
2685
|
+
list(limit?: number): Promise<ProviderCallSummary[]>;
|
|
2686
|
+
read(jobId: string): Promise<ProviderCallRecord | undefined>;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
/** 一条任务的完整记录 */
|
|
2690
|
+
declare interface ProviderCallRecord {
|
|
2691
|
+
jobId: string;
|
|
2692
|
+
canvasId: string;
|
|
2693
|
+
nodeId: string;
|
|
2694
|
+
actionId: string;
|
|
2695
|
+
providerId: string;
|
|
2696
|
+
title?: string;
|
|
2697
|
+
startedAt: string;
|
|
2698
|
+
finishedAt?: string;
|
|
2699
|
+
/** 用户输入:提示词分段 / 可视化参数 / 素材元信息 */
|
|
2700
|
+
input?: unknown;
|
|
2701
|
+
calls: ProviderCall[];
|
|
2702
|
+
status?: 'running' | 'done' | 'error';
|
|
2703
|
+
error?: string;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
/** 列表项(不带大字段) */
|
|
2707
|
+
declare interface ProviderCallSummary {
|
|
2708
|
+
jobId: string;
|
|
2709
|
+
canvasId: string;
|
|
2710
|
+
nodeId: string;
|
|
2711
|
+
actionId: string;
|
|
2712
|
+
title?: string;
|
|
2713
|
+
providerId: string;
|
|
2714
|
+
startedAt: string;
|
|
2715
|
+
finishedAt?: string;
|
|
2716
|
+
status?: string;
|
|
2717
|
+
callCount: number;
|
|
2718
|
+
error?: string;
|
|
2719
|
+
hosts: string[];
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2641
2722
|
/**
|
|
2642
2723
|
* provider 声明的一个配置项(管理页据此动态渲染表单)。
|
|
2643
2724
|
*
|
|
@@ -3057,6 +3138,14 @@ declare interface Registry<T> {
|
|
|
3057
3138
|
activeJob?: (canvasId: string, nodeId: string) => {
|
|
3058
3139
|
id: string;
|
|
3059
3140
|
} | undefined;
|
|
3141
|
+
/**
|
|
3142
|
+
* provider 原始 HTTP 调用记录(可选)。
|
|
3143
|
+
*
|
|
3144
|
+
* 给了之后,provider 里发出的每一次 fetch 都会记进 <数据根>/provider-calls/<jobId>.json:
|
|
3145
|
+
* 原始请求体(参考素材只留摘要)、响应体、状态码、耗时。排障时不必再重复花钱打接口
|
|
3146
|
+
* (用户 2026-12-02)。省略 = 不记录。
|
|
3147
|
+
*/
|
|
3148
|
+
providerCalls?: ProviderCallLog;
|
|
3060
3149
|
onError?: (message: string, err?: unknown) => void;
|
|
3061
3150
|
}
|
|
3062
3151
|
|
|
@@ -3069,6 +3158,8 @@ declare interface Registry<T> {
|
|
|
3069
3158
|
private readonly settled;
|
|
3070
3159
|
/** 在跑的后台循环(dispose 要等它们退干净,否则关停后还有人在写盘) */
|
|
3071
3160
|
private readonly running;
|
|
3161
|
+
/** jobId → provider 调用记录(终态时收尾用;不记录时不放) */
|
|
3162
|
+
private readonly callRecords;
|
|
3072
3163
|
constructor(deps: TaskDeps);
|
|
3073
3164
|
/**
|
|
3074
3165
|
* 停掉所有在跑的任务(服务关停 / 测试收尾)。
|
|
@@ -3104,11 +3195,10 @@ declare interface Registry<T> {
|
|
|
3104
3195
|
/** 把节点里的资源地址换成 provider 能取的真实字节(data URL) */
|
|
3105
3196
|
private resolveInput;
|
|
3106
3197
|
/**
|
|
3107
|
-
*
|
|
3108
|
-
* 认不出类型时退回 imageUrl(图片是最常见的产物)。
|
|
3198
|
+
* 产物该写进节点的哪个字段。
|
|
3109
3199
|
*
|
|
3110
|
-
*
|
|
3111
|
-
|
|
3200
|
+
* 用户 2026-12-02:**所有类型统一写 `url`**,不再按节点类型查表 ——
|
|
3201
|
+
* 新增节点类型(3D / 新多媒体…)不用改这里。
|
|
3112
3202
|
*/
|
|
3113
3203
|
private mediaFieldFor;
|
|
3114
3204
|
/**
|
|
@@ -3122,7 +3212,7 @@ declare interface Registry<T> {
|
|
|
3122
3212
|
* 产物要落到**这个节点自己**的哪种地址字段。
|
|
3123
3213
|
*
|
|
3124
3214
|
* 为什么读节点而不是只看动作声明:同一个动作可以被不同节点类型接住 —— 比如可视化节点
|
|
3125
|
-
* (type=ui)也能接生成任务,它的产物地址统一存在 `
|
|
3215
|
+
* (type=ui)也能接生成任务,它的产物地址统一存在 `url`。只按动作的 nodeTypes 猜,
|
|
3126
3216
|
* 会把地址写进一个该节点根本不读的字段(表现就是「任务成功了,卡片还是空的」)。
|
|
3127
3217
|
* 读不到节点(已被删除 / 读盘失败)时退回动作声明。
|
|
3128
3218
|
*/
|
|
@@ -3133,7 +3223,7 @@ declare interface Registry<T> {
|
|
|
3133
3223
|
* 与前端 plugin-node-ui 的 outputTypeForName 同一套口径:按产物扩展名认,
|
|
3134
3224
|
* 认不出再看实测到的媒体类型(有些平台给 .bin,扩展名不可靠)。
|
|
3135
3225
|
*/
|
|
3136
|
-
private
|
|
3226
|
+
private outputTypeOf;
|
|
3137
3227
|
/**
|
|
3138
3228
|
* 把**一份**产物的字节收进本画布资源目录,返回要写进节点的那份数据。
|
|
3139
3229
|
*
|