@blade-hq/agent-client 2612.0.0-beta.8 → 2612.0.0-beta.80
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/README.md +405 -34
- package/dist/application-client.d.ts +19 -0
- package/dist/blade-client.d.ts +28 -9
- package/dist/{chunk-ZTHGY4OX.js → chunk-RI7ZYTYK.js} +1889 -391
- package/dist/chunk-RI7ZYTYK.js.map +1 -0
- package/dist/index.d.ts +24 -6
- package/dist/index.js +23 -1
- package/dist/internal.d.ts +13 -4
- package/dist/internal.js +39 -3
- package/dist/internal.js.map +1 -1
- package/dist/pack-page-bridge.d.ts +11 -0
- package/dist/resources/auth.d.ts +25 -1
- package/dist/resources/computers.d.ts +2 -7
- package/dist/resources/connectors.d.ts +385 -0
- package/dist/resources/headless.d.ts +1 -1
- package/dist/resources/llm.d.ts +64 -0
- package/dist/resources/models.d.ts +6 -1
- package/dist/resources/pack-records.d.ts +26 -0
- package/dist/resources/phones.d.ts +106 -0
- package/dist/resources/plugins.d.ts +22 -0
- package/dist/resources/profile.d.ts +100 -0
- package/dist/resources/sandbox.d.ts +22 -0
- package/dist/resources/sessions.d.ts +126 -11
- package/dist/schemas/ask-user-question.d.ts +21 -0
- package/dist/schemas/context-attachments.d.ts +20 -0
- package/dist/schemas/message-utils.d.ts +3 -9
- package/dist/schemas/message.d.ts +16 -2
- package/dist/schemas/plugin-refs.d.ts +7 -0
- package/dist/schemas/projection.d.ts +14 -1
- package/dist/schemas/session.d.ts +3 -48
- package/dist/server-clock.d.ts +2 -0
- package/dist/session/agent-session.d.ts +45 -95
- package/dist/session/definition.d.ts +4 -0
- package/dist/session/events.d.ts +0 -1
- package/dist/session/hub.d.ts +0 -24
- package/dist/session/queue.d.ts +2 -0
- package/dist/session/state.d.ts +8 -1
- package/dist/session/workflow.d.ts +10 -3
- package/dist/shared/pack-events.d.ts +4 -0
- package/dist/shared/projection/builder.d.ts +0 -2
- package/dist/shared/projection/index.d.ts +1 -0
- package/dist/shared/projection/workflow.d.ts +24 -0
- package/dist/tool-provider.d.ts +60 -0
- package/dist/types/sdk-profile.d.ts +1 -0
- package/dist/types/socket-events.d.ts +191 -11
- package/dist/version.d.ts +0 -1
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/cjs/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/cjs/index.js +1 -4
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/cjs/socket.js +151 -218
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +17 -7
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +17 -7
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/esm/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/esm/index.js +1 -2
- package/node_modules/engine.io-client/build/esm/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/esm/socket.js +141 -206
- package/node_modules/engine.io-client/build/esm/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/esm-debug/index.js +1 -2
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/esm-debug/socket.js +150 -215
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +3 -3
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -1
- package/node_modules/engine.io-client/dist/engine.io.js +164 -239
- package/node_modules/engine.io-client/dist/engine.io.js.map +1 -1
- package/node_modules/engine.io-client/dist/engine.io.min.js +3 -3
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -1
- package/node_modules/engine.io-client/package.json +2 -2
- package/node_modules/socket.io-parser/build/cjs/binary.js +4 -1
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/cjs/index.js +18 -11
- package/node_modules/socket.io-parser/build/esm/binary.js +4 -1
- package/node_modules/socket.io-parser/build/esm/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/esm/index.js +14 -10
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +4 -1
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/esm-debug/index.js +14 -10
- package/node_modules/socket.io-parser/package.json +1 -1
- package/node_modules/ws/index.js +15 -6
- package/node_modules/ws/lib/constants.js +1 -0
- package/node_modules/ws/lib/permessage-deflate.js +9 -7
- package/node_modules/ws/lib/receiver.js +37 -0
- package/node_modules/ws/lib/sender.js +6 -1
- package/node_modules/ws/lib/websocket-server.js +18 -6
- package/node_modules/ws/lib/websocket.js +50 -17
- package/node_modules/ws/package.json +8 -3
- package/node_modules/ws/wrapper.mjs +14 -1
- package/package.json +4 -4
- package/public-api.md +851 -36
- package/dist/chunk-ZTHGY4OX.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { BladeClient } from "../blade-client";
|
|
2
|
+
import { PackRecordsResource } from "./pack-records";
|
|
3
|
+
export interface ProfileComponent {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
regions: string[];
|
|
7
|
+
kind?: "iframe";
|
|
8
|
+
entry?: string;
|
|
9
|
+
pack?: string;
|
|
10
|
+
reserved?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface PackLayoutOperation {
|
|
13
|
+
op: "hide" | "show" | "add" | "move";
|
|
14
|
+
target?: string;
|
|
15
|
+
region?: string;
|
|
16
|
+
component?: string;
|
|
17
|
+
after?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PackManifest {
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
title: string;
|
|
23
|
+
layout?: PackLayoutOperation[];
|
|
24
|
+
components?: ProfileComponent[];
|
|
25
|
+
persona?: string;
|
|
26
|
+
hooks?: Record<string, unknown[]>;
|
|
27
|
+
collections?: {
|
|
28
|
+
name: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
fields: Record<string, string>;
|
|
31
|
+
}[];
|
|
32
|
+
triggers?: {
|
|
33
|
+
id: string;
|
|
34
|
+
on: string;
|
|
35
|
+
function: string;
|
|
36
|
+
deliver: Record<string, unknown>;
|
|
37
|
+
}[];
|
|
38
|
+
limits?: {
|
|
39
|
+
daily_wakeups: number;
|
|
40
|
+
consecutive_event_turns: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface InstalledPack {
|
|
44
|
+
manifest: PackManifest;
|
|
45
|
+
files: Record<string, string>;
|
|
46
|
+
source: "builtin" | "fixture" | "user";
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
digest: string;
|
|
49
|
+
}
|
|
50
|
+
/** The server computes composition. Hosts only select available renderers. */
|
|
51
|
+
export interface PackProfile {
|
|
52
|
+
version: string;
|
|
53
|
+
regions: Record<string, ProfileComponent[]>;
|
|
54
|
+
hidden: string[];
|
|
55
|
+
packs: {
|
|
56
|
+
name: string;
|
|
57
|
+
version: string;
|
|
58
|
+
title: string;
|
|
59
|
+
}[];
|
|
60
|
+
agent: {
|
|
61
|
+
hooks: {
|
|
62
|
+
pack: string;
|
|
63
|
+
hooks: Record<string, unknown[]>;
|
|
64
|
+
}[];
|
|
65
|
+
persona: {
|
|
66
|
+
pack: string;
|
|
67
|
+
text: string;
|
|
68
|
+
}[];
|
|
69
|
+
collections: {
|
|
70
|
+
pack: string;
|
|
71
|
+
name: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
fields: Record<string, string>;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
warnings: string[];
|
|
77
|
+
}
|
|
78
|
+
export declare class ProfileResource {
|
|
79
|
+
private readonly client;
|
|
80
|
+
constructor(client: BladeClient);
|
|
81
|
+
get(init?: RequestInit): Promise<PackProfile>;
|
|
82
|
+
/** Also refresh after reconnect, since changes may have happened offline. */
|
|
83
|
+
onChanged(listener: () => void): () => void;
|
|
84
|
+
}
|
|
85
|
+
export declare class PacksResource {
|
|
86
|
+
private readonly client;
|
|
87
|
+
readonly records: PackRecordsResource;
|
|
88
|
+
constructor(client: BladeClient);
|
|
89
|
+
sessionByTag(name: string, tag: string, init?: RequestInit): Promise<{
|
|
90
|
+
session_id: string;
|
|
91
|
+
}>;
|
|
92
|
+
list(): Promise<{
|
|
93
|
+
items: InstalledPack[];
|
|
94
|
+
}>;
|
|
95
|
+
save(manifest: PackManifest, files?: Record<string, string>): Promise<PackProfile>;
|
|
96
|
+
enable(name: string): Promise<PackProfile>;
|
|
97
|
+
disable(name: string): Promise<PackProfile>;
|
|
98
|
+
reset(): Promise<PackProfile>;
|
|
99
|
+
file(name: string, path: string, init?: RequestInit): Promise<string>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BladeClient } from "../blade-client";
|
|
2
|
+
export interface SandboxScriptRequest {
|
|
3
|
+
script: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
/** Seconds, up to 120; defaults to 120. */
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SandboxScriptResult {
|
|
9
|
+
/** Combined stdout and stderr for diagnostics. */
|
|
10
|
+
output: string;
|
|
11
|
+
stdout: string;
|
|
12
|
+
stdout_truncated: boolean;
|
|
13
|
+
exit_code: number | null;
|
|
14
|
+
timed_out: boolean;
|
|
15
|
+
error: string | null;
|
|
16
|
+
}
|
|
17
|
+
/** Model-free execution in the authenticated user's sandbox. */
|
|
18
|
+
export declare class SandboxResource {
|
|
19
|
+
private client;
|
|
20
|
+
constructor(client: BladeClient);
|
|
21
|
+
execute(input: SandboxScriptRequest): Promise<SandboxScriptResult>;
|
|
22
|
+
}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import type { BackgroundTask, BackgroundTaskStopResult } from "../schemas/background";
|
|
2
2
|
import type { TurnProjection } from "../schemas/projection";
|
|
3
3
|
import type { McpAppArchive } from "../schemas/mcp-app";
|
|
4
|
-
import type { PublishedSolutionRef, ReplayPreview, ReplaySpeed, SessionDetail, SessionInfo
|
|
4
|
+
import type { PublishedSolutionRef, ReplayPreview, ReplaySpeed, SessionDetail, SessionInfo } from "../schemas/session";
|
|
5
5
|
import type { McpAppContextState, McpAppContextUpdate } from "../schemas/mcp-app";
|
|
6
6
|
import type { Task } from "../schemas/task";
|
|
7
7
|
import type { BladeClient, UploadProgress } from "../blade-client";
|
|
8
8
|
import type { AgentSession } from "../session/agent-session";
|
|
9
9
|
import { type SessionDefinition } from "../session/definition";
|
|
10
10
|
import type { SessionProfile } from "../types/sdk-profile";
|
|
11
|
+
export interface FileOpenerInstance {
|
|
12
|
+
token: string;
|
|
13
|
+
title: string;
|
|
14
|
+
html: string;
|
|
15
|
+
resourceMeta: Record<string, unknown>;
|
|
16
|
+
appToolNames: string[];
|
|
17
|
+
file: {
|
|
18
|
+
path: string;
|
|
19
|
+
name: string;
|
|
20
|
+
revision: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
11
23
|
export interface SessionPlugin {
|
|
12
24
|
/** Technical ID: always used for paths, authorization, caching and calls. */
|
|
13
25
|
name: string;
|
|
@@ -87,8 +99,11 @@ export interface SessionPluginConfigUpdate {
|
|
|
87
99
|
remove?: string[];
|
|
88
100
|
}
|
|
89
101
|
export interface CreateSessionRequest {
|
|
102
|
+
/** Notification owner. Built-in Web declares ui; external applications default to sdk. */
|
|
103
|
+
initiator?: "ui" | "sdk";
|
|
104
|
+
/** 认证创建独立匿名沙盒;链接持有者可继续聊天,不继承个人资源。 */
|
|
105
|
+
anonymous?: boolean;
|
|
90
106
|
intent?: string;
|
|
91
|
-
template_id?: TemplateId;
|
|
92
107
|
/** 正式 Solution 来源。Hub 使用 { source: "hub", org, name }。 */
|
|
93
108
|
solution_ref?: PublishedSolutionRef;
|
|
94
109
|
/** @deprecated 请使用结构化的 solution_ref;继续支持以保证现有 SDK 调用无感升级。 */
|
|
@@ -96,24 +111,26 @@ export interface CreateSessionRequest {
|
|
|
96
111
|
/** 从已有会话复制其不可变 Solution 与 Skill 运行快照。 */
|
|
97
112
|
solution_snapshot_session_id?: string;
|
|
98
113
|
biz_role_id?: string | null;
|
|
99
|
-
primary_skill_id?: string | null;
|
|
100
114
|
model?: string | null;
|
|
101
115
|
enable_thinking?: boolean | null;
|
|
102
116
|
memory_enabled?: boolean | null;
|
|
103
117
|
env?: Record<string, string>;
|
|
118
|
+
/** Pass ["platform:schedule"] to disable BA scheduled work for this session. */
|
|
104
119
|
disable_tools?: string[] | null;
|
|
105
120
|
mcp_sources?: McpSourceConfig[];
|
|
106
121
|
/** 此会话的所有普通轮次直接执行工具,不弹审批。 */
|
|
107
122
|
skip_confirmations?: boolean;
|
|
123
|
+
session_solution_files?: {
|
|
124
|
+
path: string;
|
|
125
|
+
content: string;
|
|
126
|
+
}[];
|
|
108
127
|
session_solution_asset_id?: string | null;
|
|
109
128
|
compaction_ratio?: number | null;
|
|
110
|
-
runtime_type?: "sandbox" | "daemon" | "native" | null;
|
|
111
|
-
daemon_id?: string | null;
|
|
112
|
-
/** runtime_type 为 "native" 时必填:daemon 上要用哪个原生智能体(如 rt_codex)。 */
|
|
113
|
-
agent_runtime_id?: string | null;
|
|
114
129
|
chat_group_id?: string | null;
|
|
115
130
|
}
|
|
116
131
|
export interface McpSourceConfig {
|
|
132
|
+
/** Source summary shown before lazy tool discovery. */
|
|
133
|
+
description?: string;
|
|
117
134
|
id: string;
|
|
118
135
|
url: string;
|
|
119
136
|
bearer_token?: string | null;
|
|
@@ -121,6 +138,46 @@ export interface McpSourceConfig {
|
|
|
121
138
|
include_tools?: string[] | null;
|
|
122
139
|
eager_tools?: string[];
|
|
123
140
|
}
|
|
141
|
+
/** Sandbox only. Omitted fields are retained; lists/maps replace their previous value. */
|
|
142
|
+
export interface UpdateSessionConfigurationRequest {
|
|
143
|
+
version: string;
|
|
144
|
+
expected_revision?: number;
|
|
145
|
+
solution_ref?: PublishedSolutionRef;
|
|
146
|
+
solution_id?: string;
|
|
147
|
+
session_solution_files?: {
|
|
148
|
+
path: string;
|
|
149
|
+
content: string;
|
|
150
|
+
}[];
|
|
151
|
+
session_solution_asset_id?: string;
|
|
152
|
+
biz_role_id?: string;
|
|
153
|
+
model?: string;
|
|
154
|
+
enable_thinking?: boolean | null;
|
|
155
|
+
memory_enabled?: boolean;
|
|
156
|
+
env?: Record<string, string>;
|
|
157
|
+
disable_tools?: string[];
|
|
158
|
+
mcp_sources?: McpSourceConfig[];
|
|
159
|
+
skip_confirmations?: boolean;
|
|
160
|
+
compaction_ratio?: number | null;
|
|
161
|
+
}
|
|
162
|
+
export interface SessionConfiguration {
|
|
163
|
+
session_id: string;
|
|
164
|
+
version: string | null;
|
|
165
|
+
revision: number;
|
|
166
|
+
configuration: {
|
|
167
|
+
solution_identity: Record<string, unknown> | null;
|
|
168
|
+
solution_version: string | null;
|
|
169
|
+
biz_role_id: string | null;
|
|
170
|
+
biz_role_version: string | null;
|
|
171
|
+
model: string | null;
|
|
172
|
+
enable_thinking: boolean | null;
|
|
173
|
+
memory_enabled: boolean;
|
|
174
|
+
env: Record<string, string>;
|
|
175
|
+
disable_tools: string[];
|
|
176
|
+
mcp_sources: Omit<McpSourceConfig, "bearer_token">[];
|
|
177
|
+
skip_confirmations: boolean;
|
|
178
|
+
compaction_ratio: number | null;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
124
181
|
export interface CheckpointNode {
|
|
125
182
|
id: string;
|
|
126
183
|
parent_id: string | null;
|
|
@@ -241,11 +298,30 @@ export interface SessionTurnsQuery {
|
|
|
241
298
|
* 和"这次没取到"(网络 / 5xx / 鉴权)分开:前者说明这个定位目标已经没了,后者只说明这次失败。
|
|
242
299
|
*/
|
|
243
300
|
export declare function isEntryGoneError(error: unknown): boolean;
|
|
244
|
-
/**
|
|
301
|
+
/** 分段里的一次用户发言(脉络展开后的一项)。 */
|
|
302
|
+
export interface SessionTurnIndexEntry {
|
|
303
|
+
entryId: string;
|
|
304
|
+
preview: string;
|
|
305
|
+
createdAt: string | null;
|
|
306
|
+
/** AskUserQuestion 的应答:消息列表里没有独立行,点它定位不到。 */
|
|
307
|
+
answer?: boolean;
|
|
308
|
+
}
|
|
309
|
+
/** 这一段交付的产物(文件 / 链接),与 post_chat_followup.final_artifacts 同形。 */
|
|
310
|
+
export interface SessionTurnIndexArtifact {
|
|
311
|
+
kind: "file" | "link";
|
|
312
|
+
target: string;
|
|
313
|
+
label: string;
|
|
314
|
+
}
|
|
315
|
+
/** 侧栏「消息历史」的一条:一个小结分段的头。 */
|
|
245
316
|
export interface SessionTurnIndexItem {
|
|
246
317
|
entryId: string;
|
|
247
318
|
preview: string;
|
|
319
|
+
recaption?: string;
|
|
320
|
+
/** 这一段交付的产物,脉络卡片上直接列出来。 */
|
|
321
|
+
artifacts?: SessionTurnIndexArtifact[];
|
|
248
322
|
createdAt: string | null;
|
|
323
|
+
/** 这一段(从上一个小结之后到本小结)里的每一次用户发言。 */
|
|
324
|
+
entries?: SessionTurnIndexEntry[];
|
|
249
325
|
}
|
|
250
326
|
export interface SessionTurnIndex {
|
|
251
327
|
sessionId: string;
|
|
@@ -334,6 +410,24 @@ export declare class SessionsResource {
|
|
|
334
410
|
fetchSharedImage(token: string, assetId: string, preview?: boolean): Promise<Blob>;
|
|
335
411
|
private fetchImagePath;
|
|
336
412
|
constructor(client: BladeClient);
|
|
413
|
+
openFileOpener(sessionId: string, body: {
|
|
414
|
+
plugin: string;
|
|
415
|
+
opener: string;
|
|
416
|
+
path: string;
|
|
417
|
+
}, init?: RequestInit): Promise<FileOpenerInstance>;
|
|
418
|
+
callFileOpener(sessionId: string, body: {
|
|
419
|
+
token: string;
|
|
420
|
+
request_id: string;
|
|
421
|
+
name: string;
|
|
422
|
+
arguments: Record<string, unknown>;
|
|
423
|
+
file?: "read" | "save";
|
|
424
|
+
base_revision?: string;
|
|
425
|
+
}, init?: RequestInit): Promise<{
|
|
426
|
+
response: Record<string, unknown>;
|
|
427
|
+
file?: {
|
|
428
|
+
revision: string;
|
|
429
|
+
};
|
|
430
|
+
}>;
|
|
337
431
|
getMcpApp(sessionId: string, sourceId: string, init?: RequestInit): Promise<McpAppArchive>;
|
|
338
432
|
onMcpAppChanged(sessionId: string, sourceId: string, listener: () => void): () => void;
|
|
339
433
|
callMcpApp(sessionId: string, sourceId: string, request: {
|
|
@@ -409,11 +503,10 @@ export declare class SessionsResource {
|
|
|
409
503
|
private prepareSolution;
|
|
410
504
|
private cleanupSolutionAsset;
|
|
411
505
|
private fetchSessionsPage;
|
|
412
|
-
listSessions(
|
|
506
|
+
listSessions(solution_id?: string): Promise<SessionInfo[]>;
|
|
413
507
|
listSessionsPaginated(params: {
|
|
414
508
|
limit: number;
|
|
415
509
|
offset: number;
|
|
416
|
-
template_id_prefix?: string;
|
|
417
510
|
solution_id?: string;
|
|
418
511
|
solution_registry_id?: string;
|
|
419
512
|
q?: string;
|
|
@@ -424,7 +517,7 @@ export declare class SessionsResource {
|
|
|
424
517
|
q: string;
|
|
425
518
|
limit?: number;
|
|
426
519
|
}): Promise<GlobalSearchResult>;
|
|
427
|
-
createSession(intent?: string
|
|
520
|
+
createSession(intent?: string): Promise<{
|
|
428
521
|
session_id: string;
|
|
429
522
|
}>;
|
|
430
523
|
createSessionWithRequest(request: CreateSessionRequest): Promise<{
|
|
@@ -441,6 +534,9 @@ export declare class SessionsResource {
|
|
|
441
534
|
intent?: string;
|
|
442
535
|
chat_group_id?: string | null;
|
|
443
536
|
}): Promise<SessionDetail>;
|
|
537
|
+
getSessionConfiguration(sessionId: string, init?: RequestInit): Promise<SessionConfiguration>;
|
|
538
|
+
/** Updates atomically between turns. A running/handoff session returns HTTP 409. */
|
|
539
|
+
updateSessionConfiguration(sessionId: string, request: UpdateSessionConfigurationRequest): Promise<SessionConfiguration>;
|
|
444
540
|
setSessionEnv(sessionId: string, env: Record<string, string>): Promise<SessionDetail>;
|
|
445
541
|
pinSession(sessionId: string, pinned: boolean): Promise<SessionInfo>;
|
|
446
542
|
startReplaySession(sourceSessionId: string, speed?: ReplaySpeed): Promise<{
|
|
@@ -466,6 +562,8 @@ export declare class SessionsResource {
|
|
|
466
562
|
}>;
|
|
467
563
|
getSharedSession(token: string): Promise<TurnProjection[]>;
|
|
468
564
|
getSessionTasks(sessionId: string): Promise<Task[]>;
|
|
565
|
+
/** Durable result for this execution; null until its run_end is committed. Owner only. */
|
|
566
|
+
getRunResult<T = unknown>(sessionId: string, runId: string): Promise<SessionRunResult<T> | null>;
|
|
469
567
|
getSessionTurns(sessionId: string): Promise<TurnProjection[]>;
|
|
470
568
|
getSessionTurnsPage(sessionId: string, options?: SessionTurnsQuery, init?: RequestInit): Promise<SessionTurnsPage>;
|
|
471
569
|
/**
|
|
@@ -521,6 +619,15 @@ export declare class SessionsResource {
|
|
|
521
619
|
id: string;
|
|
522
620
|
leaf_id: string;
|
|
523
621
|
}>;
|
|
622
|
+
listAnonymousSessions(): Promise<Array<{
|
|
623
|
+
id: string;
|
|
624
|
+
intent: string;
|
|
625
|
+
created_at: string;
|
|
626
|
+
status: string;
|
|
627
|
+
}>>;
|
|
628
|
+
deleteAnonymousSession(sessionId: string): Promise<{
|
|
629
|
+
deleted: boolean;
|
|
630
|
+
}>;
|
|
524
631
|
deleteSession(sessionId: string, options?: {
|
|
525
632
|
deleteWorkspace?: boolean;
|
|
526
633
|
}): Promise<{
|
|
@@ -570,3 +677,11 @@ export declare class SessionsResource {
|
|
|
570
677
|
session_id: string;
|
|
571
678
|
}>;
|
|
572
679
|
}
|
|
680
|
+
export interface SessionRunResult<T = unknown> {
|
|
681
|
+
kind: "run_end";
|
|
682
|
+
run_id: string;
|
|
683
|
+
status: "completed" | "failed" | "interrupted" | "waiting_for_input";
|
|
684
|
+
output?: string;
|
|
685
|
+
error?: string;
|
|
686
|
+
structured_result?: T;
|
|
687
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AskUserAnswerData } from "../session/state";
|
|
2
|
+
export interface AskUserQuestionOption {
|
|
3
|
+
label: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AskUserQuestionItem {
|
|
7
|
+
question: string;
|
|
8
|
+
options: AskUserQuestionOption[];
|
|
9
|
+
multiSelect?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AskUserQuestionData {
|
|
12
|
+
questions: AskUserQuestionItem[];
|
|
13
|
+
source_loop?: {
|
|
14
|
+
loop_name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
} | null;
|
|
17
|
+
}
|
|
18
|
+
/** Normalize the question payload returned by AskUserQuestion or stored in its arguments. */
|
|
19
|
+
export declare function parseAskUserQuestion(toolResult: string | null | undefined): AskUserQuestionData | null;
|
|
20
|
+
/** Build the user message accompanying a structured AskUserQuestion answer. */
|
|
21
|
+
export declare function formatAskUserAnswer(data: AskUserQuestionData, answer: AskUserAnswerData): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Frozen application data belonging to one message. The server does not interpret business types. */
|
|
2
|
+
export interface ContextAttachment {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
content: string;
|
|
6
|
+
/** Explicitly remove or restore a named Context. Ordinary updates cannot revive a removed source. */
|
|
7
|
+
action?: "remove" | "restore";
|
|
8
|
+
/** Project plain text as a named session Context; the producer supplies full state. */
|
|
9
|
+
update_format?: "snapshot" | "diff";
|
|
10
|
+
data?: Record<string, unknown> | null;
|
|
11
|
+
files?: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
session_id?: string;
|
|
14
|
+
path?: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/** Validate before persisting a reliable request. JSON cloning also rejects cycles. */
|
|
18
|
+
export declare function snapshotContextAttachments(value: ContextAttachment[]): ContextAttachment[];
|
|
19
|
+
/** Server-owned snapshots travel unchanged through stream and history projections. */
|
|
20
|
+
export declare function normalizeContextAttachments(value: unknown): ContextAttachment[];
|
|
@@ -24,21 +24,15 @@ export declare function buildMessageContent(text: string, attachments: Array<{
|
|
|
24
24
|
mimeType?: string;
|
|
25
25
|
}>): MessageContent;
|
|
26
26
|
export declare function contentPreview(content: MessageContent, maxLen?: number): string;
|
|
27
|
-
/**
|
|
27
|
+
/** @deprecated 技能可用状态由运行时解析,发送身份请使用 SkillRef。 */
|
|
28
28
|
export interface SkillMentionAvailability {
|
|
29
29
|
/** 本地已有(内置 / 技能目录 / 会话已加载),直接可用。 */
|
|
30
30
|
local?: boolean;
|
|
31
31
|
/** Blade Hub 上该账号是否已安装。本地技能恒为 true。 */
|
|
32
32
|
installed?: boolean;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
* Strips the `<skill>name</skill>` tag from the raw input and prepends the instruction.
|
|
37
|
-
*
|
|
38
|
-
* Hub 技能装没装、加载没加载,用户不需要知道,但智能体需要——所以把状态翻译
|
|
39
|
-
* 成它能直接照做的 CLI 步骤。不传 availability 时按本地技能处理,与旧行为一致。
|
|
40
|
-
*/
|
|
41
|
-
export declare function transformSlashCommand(skillName: string, rawInput: string, { local, installed }?: SkillMentionAvailability): string;
|
|
34
|
+
/** Serialize a skill marker as user text. Send its identity separately in refs. */
|
|
35
|
+
export declare function transformSlashCommand(skillName: string, rawInput: string, _availability?: SkillMentionAvailability): string;
|
|
42
36
|
export interface ParsedTextAttachment {
|
|
43
37
|
name: string;
|
|
44
38
|
uploadedPath?: string;
|
|
@@ -20,6 +20,17 @@ export interface FileContentPart {
|
|
|
20
20
|
}
|
|
21
21
|
export type MessageContentPart = TextContentPart | ImageUrlContentPart | FileContentPart;
|
|
22
22
|
export type MessageContent = string | MessageContentPart[];
|
|
23
|
+
/** 固定流程解释执行落史的一步(workflow:run 专用):刷新后时间线从这里重建。 */
|
|
24
|
+
export interface WorkflowStepInfo {
|
|
25
|
+
step_id: string;
|
|
26
|
+
desc?: string;
|
|
27
|
+
step_kind?: string;
|
|
28
|
+
status?: string;
|
|
29
|
+
output?: string;
|
|
30
|
+
/** 直播时的先后:步骤宣告与它的输出/失败行(条目按终态落盘,重建按这两个值排回去) */
|
|
31
|
+
seq?: number;
|
|
32
|
+
log_seq?: number;
|
|
33
|
+
}
|
|
23
34
|
export interface ToolCallInfo {
|
|
24
35
|
evidence?: ToolEvidence[];
|
|
25
36
|
id: string;
|
|
@@ -30,9 +41,10 @@ export interface ToolCallInfo {
|
|
|
30
41
|
status?: "pending" | "done" | "error" | "cancelled" | "awaiting_answer";
|
|
31
42
|
duration_ms?: number | null;
|
|
32
43
|
pending_question_ref?: PendingQuestionRef | null;
|
|
44
|
+
workflow_steps?: WorkflowStepInfo[] | null;
|
|
33
45
|
}
|
|
34
46
|
export type { ToolBridgeContent };
|
|
35
|
-
/**
|
|
47
|
+
/** Only the cancellation marker is content-based; errors come from protocol fields. */
|
|
36
48
|
export declare function inferToolStatus(resultStr: string): "done" | "error" | "cancelled";
|
|
37
49
|
export interface MemoryRefInfo {
|
|
38
50
|
id: number;
|
|
@@ -75,6 +87,7 @@ export interface ChatMessage {
|
|
|
75
87
|
duration_ms?: number;
|
|
76
88
|
timestamp?: string;
|
|
77
89
|
entry_id?: string;
|
|
90
|
+
client_request_id?: string;
|
|
78
91
|
/** Stable React key retained when an optimistic user message is confirmed. */
|
|
79
92
|
render_id?: string;
|
|
80
93
|
parent_id?: string | null;
|
|
@@ -82,7 +95,8 @@ export interface ChatMessage {
|
|
|
82
95
|
/** Entry kind from backend -- present for non-message entries like mode changes. */
|
|
83
96
|
kind?: string;
|
|
84
97
|
/** Memory references injected into this turn's context */
|
|
85
|
-
refs?: import("./plugin-refs").
|
|
98
|
+
refs?: import("./plugin-refs").MessageRef[];
|
|
99
|
+
context_attachments?: import("./context-attachments").ContextAttachment[];
|
|
86
100
|
topic_asset_refs?: import("./topic-assets").TopicAssetRef[];
|
|
87
101
|
memory_refs?: MemoryRefInfo[];
|
|
88
102
|
/** Raw projection blocks for block-level UI rendering. */
|
|
@@ -6,3 +6,10 @@ export interface PluginRef {
|
|
|
6
6
|
label: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function normalizePluginRefs(value: unknown): PluginRef[];
|
|
9
|
+
export interface SkillRef {
|
|
10
|
+
provider: "skill";
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export type MessageRef = PluginRef | SkillRef;
|
|
15
|
+
export declare function normalizeMessageRefs(value: unknown): MessageRef[];
|
|
@@ -25,6 +25,17 @@ export interface RunTiming {
|
|
|
25
25
|
duration_ms?: number | null;
|
|
26
26
|
status: "completed" | "failed" | "cancelled" | "paused" | "incomplete";
|
|
27
27
|
}
|
|
28
|
+
/** 固定流程解释执行时落史的一步:刷新/重启后时间线的真相源。 */
|
|
29
|
+
export interface WorkflowStepProjection {
|
|
30
|
+
step_id: string;
|
|
31
|
+
desc?: string;
|
|
32
|
+
step_kind?: string;
|
|
33
|
+
status?: string;
|
|
34
|
+
output?: string;
|
|
35
|
+
/** 直播时的先后:步骤宣告与它的输出/失败行(条目按终态落盘,重建按这两个值排回去) */
|
|
36
|
+
seq?: number;
|
|
37
|
+
log_seq?: number;
|
|
38
|
+
}
|
|
28
39
|
export interface ToolEvidence {
|
|
29
40
|
n: number;
|
|
30
41
|
id: string;
|
|
@@ -55,6 +66,7 @@ export interface ToolCallProjection {
|
|
|
55
66
|
/** 该工具派生的子智能体运行区间,仅作外层展示。 */
|
|
56
67
|
subagent_runs?: RunTiming[];
|
|
57
68
|
pending_question_ref?: PendingQuestionRef | null;
|
|
69
|
+
workflow_steps?: WorkflowStepProjection[] | null;
|
|
58
70
|
}
|
|
59
71
|
export interface MemoryRef {
|
|
60
72
|
id: number;
|
|
@@ -96,7 +108,8 @@ export interface TurnProjection {
|
|
|
96
108
|
/** started_at 是否来自生产者上报(而非旧会话的落盘回落)。瀑布只承认前者。 */
|
|
97
109
|
has_reported_timing?: boolean;
|
|
98
110
|
context_window?: number;
|
|
99
|
-
refs?: import("./plugin-refs").
|
|
111
|
+
refs?: import("./plugin-refs").MessageRef[] | null;
|
|
112
|
+
context_attachments?: import("./context-attachments").ContextAttachment[];
|
|
100
113
|
topic_asset_refs?: import("./topic-assets").TopicAssetRef[] | null;
|
|
101
114
|
memory_refs?: MemoryRef[] | null;
|
|
102
115
|
parent_fork_tool_call_id?: string | null;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Solution } from "./solution";
|
|
2
2
|
export declare const SessionStatus: import("arktype/internal/variants/string.ts").StringType<"completed" | "created" | "failed" | "interrupted" | "running" | "waiting_for_input", {}>;
|
|
3
3
|
export type SessionStatus = typeof SessionStatus.infer;
|
|
4
|
-
export type TemplateId = "default" | "skill_editor" | "ship_attack";
|
|
5
|
-
export type SkillEditorTemplateId = "skill_editor";
|
|
6
4
|
export type ModeId = "planning" | "executing";
|
|
7
5
|
export type PublishedSolutionRef = {
|
|
8
6
|
source: "builtin";
|
|
@@ -60,12 +58,13 @@ export declare const SessionInfo: import("arktype/internal/variants/object.ts").
|
|
|
60
58
|
created_at: string;
|
|
61
59
|
updated_at: string;
|
|
62
60
|
shared?: boolean | undefined;
|
|
61
|
+
anonymous?: boolean | undefined;
|
|
63
62
|
memory_enabled?: boolean | undefined;
|
|
64
63
|
is_persistent?: boolean | undefined;
|
|
65
64
|
initiator?: "sdk" | "ui" | "unknown" | null | undefined;
|
|
66
65
|
is_headless?: boolean | undefined;
|
|
66
|
+
scheduled_task_id?: string | undefined;
|
|
67
67
|
viewer_role?: "owner" | "viewer" | undefined;
|
|
68
|
-
template_id?: string | null | undefined;
|
|
69
68
|
model?: string | null | undefined;
|
|
70
69
|
enable_thinking?: boolean | null | undefined;
|
|
71
70
|
solution_id?: string | null | undefined;
|
|
@@ -73,47 +72,36 @@ export declare const SessionInfo: import("arktype/internal/variants/object.ts").
|
|
|
73
72
|
biz_role_id?: string | null | undefined;
|
|
74
73
|
solution?: unknown;
|
|
75
74
|
plan_summary?: string | null | undefined;
|
|
76
|
-
primary_skill_id?: string | null | undefined;
|
|
77
|
-
bound_skill_id?: string | null | undefined;
|
|
78
75
|
replay_state?: unknown;
|
|
79
76
|
is_pinned?: boolean | undefined;
|
|
80
77
|
pinned_at?: string | null | undefined;
|
|
81
78
|
is_example?: boolean | undefined;
|
|
82
79
|
ports?: unknown;
|
|
83
80
|
disable_tools?: string[] | undefined;
|
|
84
|
-
runtime_type?: string | null | undefined;
|
|
85
|
-
daemon_id?: string | null | undefined;
|
|
86
|
-
agent_runtime_id?: string | null | undefined;
|
|
87
81
|
workspace_path?: string | null | undefined;
|
|
88
82
|
ba_version?: string | null | undefined;
|
|
89
83
|
sandbox_version?: string | null | undefined;
|
|
90
84
|
chat_group_id?: string | null | undefined;
|
|
91
85
|
match?: unknown;
|
|
92
86
|
}, {}>;
|
|
93
|
-
export type SessionInfo = Omit<typeof SessionInfo.infer, "
|
|
87
|
+
export type SessionInfo = Omit<typeof SessionInfo.infer, "solution" | "ports" | "match"> & {
|
|
94
88
|
shared?: boolean;
|
|
95
89
|
memory_enabled?: boolean;
|
|
96
90
|
is_persistent?: boolean;
|
|
97
91
|
is_headless?: boolean;
|
|
98
92
|
viewer_role?: "owner" | "viewer";
|
|
99
|
-
template_id?: TemplateId | null;
|
|
100
93
|
model?: string | null;
|
|
101
94
|
enable_thinking?: boolean | null;
|
|
102
95
|
solution_id?: string | null;
|
|
103
96
|
solution_ref?: PublishedSolutionRef | null;
|
|
104
97
|
biz_role_id?: string | null;
|
|
105
98
|
solution?: Solution | null;
|
|
106
|
-
primary_skill_id?: string | null;
|
|
107
|
-
bound_skill_id?: string | null;
|
|
108
99
|
replay_state?: ReplayState | null;
|
|
109
100
|
is_pinned?: boolean;
|
|
110
101
|
pinned_at?: string | null;
|
|
111
102
|
is_example?: boolean;
|
|
112
103
|
ports?: SessionPortMapping[];
|
|
113
104
|
disable_tools?: string[];
|
|
114
|
-
runtime_type?: "sandbox" | "daemon" | "native" | string | null;
|
|
115
|
-
daemon_id?: string | null;
|
|
116
|
-
agent_runtime_id?: string | null;
|
|
117
105
|
workspace_path?: string | null;
|
|
118
106
|
ba_version?: string | null;
|
|
119
107
|
sandbox_version?: string | null;
|
|
@@ -121,40 +109,7 @@ export type SessionInfo = Omit<typeof SessionInfo.infer, "template_id" | "soluti
|
|
|
121
109
|
/** 仅在带 q 搜索的列表响应中出现;普通列表里此字段缺省。 */
|
|
122
110
|
match?: SessionSearchMatch | null;
|
|
123
111
|
};
|
|
124
|
-
/**
|
|
125
|
-
* 主 skill 配置快照(v2)。创建 session 时从 SKILL.md frontmatter 抽出并
|
|
126
|
-
* 固化到 session_root/.blade/primary-skill.json;ship-attack 页面骨架的唯
|
|
127
|
-
* 一数据源。
|
|
128
|
-
*/
|
|
129
|
-
export interface PrimarySkillStepSpec {
|
|
130
|
-
n: number;
|
|
131
|
-
label: string;
|
|
132
|
-
}
|
|
133
|
-
export interface PrimarySkillStageSpec {
|
|
134
|
-
id: string;
|
|
135
|
-
name: string;
|
|
136
|
-
steps: PrimarySkillStepSpec[];
|
|
137
|
-
}
|
|
138
|
-
export interface PrimarySkillParallelMode {
|
|
139
|
-
id: string;
|
|
140
|
-
name: string;
|
|
141
|
-
prompt_hint: string;
|
|
142
|
-
}
|
|
143
|
-
export interface PrimarySkillSnapshot {
|
|
144
|
-
version: number;
|
|
145
|
-
skill_id: string;
|
|
146
|
-
title: string;
|
|
147
|
-
description: string;
|
|
148
|
-
stages: PrimarySkillStageSpec[];
|
|
149
|
-
parallel_modes: PrimarySkillParallelMode[];
|
|
150
|
-
captured_at: string;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* 单 session detail(GET /api/sessions/:id)。列表接口返回 SessionInfo,
|
|
154
|
-
* detail 在此基础上附加 primary_skill_snapshot。
|
|
155
|
-
*/
|
|
156
112
|
export interface SessionDetail extends SessionInfo {
|
|
157
|
-
primary_skill_snapshot?: PrimarySkillSnapshot | null;
|
|
158
113
|
preview_url?: string | null;
|
|
159
114
|
/**
|
|
160
115
|
* 会话级环境变量(owner-only)。后端仅在 GET detail 和 PUT /env 响应中返回,
|