@prisflow/proactiveai-plugin-types 0.1.1 → 0.2.0
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/index.d.ts +20 -26
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface ContextCompactionConfig {
|
|
|
71
71
|
summarySlot?: string
|
|
72
72
|
/** 摘要头部标签文本(如 【剧情史】)。 */
|
|
73
73
|
summaryLabel?: string
|
|
74
|
-
/** 触发压缩的 token
|
|
74
|
+
/** 触发压缩的 token 预算。已弃用——触发改为 provider 真实 usage > 窗口-输出上限,不再读取该字段。 */
|
|
75
75
|
tokenBudget?: number
|
|
76
76
|
/** 压缩后保留的最近消息估算 token 数(缺省 8000)。 */
|
|
77
77
|
keepTokens?: number
|
|
@@ -97,10 +97,10 @@ export interface ContextDefinition {
|
|
|
97
97
|
compaction?: ContextCompactionConfig
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/** 工具调用上下文(调用方传入)。 */
|
|
100
|
+
/** 工具调用上下文(调用方传入)。conversationId/contextId 恒有值(工具都在会话+上下文内执行)。 */
|
|
101
101
|
export interface ToolCallMeta {
|
|
102
|
-
conversationId
|
|
103
|
-
contextId
|
|
102
|
+
conversationId: string
|
|
103
|
+
contextId: string
|
|
104
104
|
/** 触发本次工具调用的 LLM 轮次 runId(日志链路树)。 */
|
|
105
105
|
parentRunId?: string
|
|
106
106
|
}
|
|
@@ -140,11 +140,11 @@ export interface NonSilentToolDef {
|
|
|
140
140
|
/** 工具定义 —— 注册时需满足对应的 silent/transformPrompt 约束。 */
|
|
141
141
|
export type ToolDefinition = SilentToolDef | NonSilentToolDef
|
|
142
142
|
|
|
143
|
-
/** LLM API
|
|
143
|
+
/** LLM API 连接配置(与宿主对齐:baseURL 未配置为 null)。 */
|
|
144
144
|
export interface LlmConfig {
|
|
145
145
|
apiKey: string
|
|
146
146
|
model: string
|
|
147
|
-
baseURL
|
|
147
|
+
baseURL: string | null
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/** LLM 消息(OpenAI Chat Completion 单条)。 */
|
|
@@ -198,6 +198,7 @@ export interface LlmNode {
|
|
|
198
198
|
system: string
|
|
199
199
|
input: (ctx: FlowCtx) => string
|
|
200
200
|
schema?: Record<string, unknown>
|
|
201
|
+
/** 结果存入 ctx.data 的键(缺省为 system 前 16 字符,无稳定语义,建议显式指定)。 */
|
|
201
202
|
assign?: string
|
|
202
203
|
maxTries?: number
|
|
203
204
|
maxTokens?: number
|
|
@@ -255,12 +256,17 @@ export interface PluginSetupAPI {
|
|
|
255
256
|
/** 整体覆盖写入插件持久化数据。 */
|
|
256
257
|
set(data: unknown): void
|
|
257
258
|
}
|
|
258
|
-
/**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
/**
|
|
260
|
+
* 头部稳定层注入(三段式 system 稳定前缀)。
|
|
261
|
+
* 向当前会话+上下文的头部注入固定/慢变文本(如世界状态卡),
|
|
262
|
+
* 宿主组装 LLM 请求时自动读入稳定前缀(慢变 → 缓存恒命中)。
|
|
263
|
+
* 归属自动取自宿主执行上下文,插件无需传会话 ID。
|
|
264
|
+
*/
|
|
265
|
+
prompts: {
|
|
266
|
+
/** 注入/更新头部稳定层文本(覆盖该会话+上下文的注入位)。 */
|
|
267
|
+
set(text: string): void
|
|
268
|
+
/** 移除已注入的文本。 */
|
|
269
|
+
remove(text: string): void
|
|
264
270
|
}
|
|
265
271
|
/** 宿主 LLM 能力:结构化生成(schema 校验失败自动重试)。 */
|
|
266
272
|
llm: {
|
|
@@ -275,22 +281,10 @@ export interface PluginSetupAPI {
|
|
|
275
281
|
flow: {
|
|
276
282
|
/** 注册一张图(节点链)。 */
|
|
277
283
|
register(def: FlowDefinition): boolean
|
|
278
|
-
/** 执行一张图,渲染经 push
|
|
284
|
+
/** 执行一张图,渲染经 push 通道推送并落库。会话归属自动取自执行上下文。 */
|
|
279
285
|
run(
|
|
280
286
|
name: string,
|
|
281
|
-
input: unknown
|
|
282
|
-
opts?: { conversationId?: string; contextId?: string }
|
|
287
|
+
input: unknown
|
|
283
288
|
): Promise<FlowResult>
|
|
284
289
|
}
|
|
285
|
-
/** 三段式骨架提示词注入(优化缓存命中)。 */
|
|
286
|
-
prompts: {
|
|
287
|
-
/** inject(where, text):'prefix' 稳定前缀(system 内)|'suffix' 尾部指令前。 */
|
|
288
|
-
inject(where: 'prefix' | 'suffix', text: string, opts?: { contextId?: string }): void
|
|
289
|
-
/** 移除注入。 */
|
|
290
|
-
remove(where: 'prefix' | 'suffix', text: string, opts?: { contextId?: string }): void
|
|
291
|
-
}
|
|
292
|
-
/** 压缩层配置(覆盖 ContextDefinition.compaction 或全局默认)。 */
|
|
293
|
-
compaction: {
|
|
294
|
-
configure(cfg: Partial<ContextCompactionConfig>, opts?: { contextId?: string }): void
|
|
295
|
-
}
|
|
296
290
|
}
|
package/package.json
CHANGED