@blade-hq/agent-client 1.2.1-alpha.2 → 1.2.1-alpha.4
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/dist/resources/sessions.d.ts +14 -2
- package/dist/schemas/session.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.md +22 -3
package/README.md
CHANGED
|
@@ -385,10 +385,10 @@ function Message({ message }: { message: ChatMessage }) {
|
|
|
385
385
|
- **SDK 身份**:`SDK_NAME`、`SDK_VERSION`
|
|
386
386
|
- **声明式会话**:`SessionDefinition`、`SolutionDefinition`、`SkillDefinition`、`SessionConfig`、`TextFile`、`SessionSetupError`、`SessionSetupStage`
|
|
387
387
|
- **模型目录**:`ModelsResource`、`ModelCatalog`、`ModelOption`
|
|
388
|
-
- **会话资源(REST)**:`SessionsResource`、`CreateSessionRequest`、`AppCliDefinition`、`AppCliAttachment`、`AttachAppOptions`、`PaginatedSessionsResult`、`SessionHistory`、`SessionContextStats`、`ShareLinkResult`、`FileEntry`、`UploadFileEntry`、`UploadFilesOptions`、`SessionProfile`、`SessionDetail`、`SessionInfo`、`SessionStatus`、`SessionPortMapping`、`ModeId`、`TemplateId`、`PrimarySkillSnapshot`、`PrimarySkillParallelMode`
|
|
388
|
+
- **会话资源(REST)**:`SessionsResource`、`CreateSessionRequest`、`ImportSessionOptions`、`AppCliDefinition`、`AppCliAttachment`、`AttachAppOptions`、`PaginatedSessionsResult`、`SessionHistory`、`SessionContextStats`、`ShareLinkResult`、`FileEntry`、`UploadFileEntry`、`UploadFilesOptions`、`SessionProfile`、`SessionDetail`、`SessionInfo`、`SessionStatus`、`SessionPortMapping`、`ModeId`、`TemplateId`、`PrimarySkillSnapshot`、`PrimarySkillParallelMode`
|
|
389
389
|
- **会话状态机**:`SessionHub`、`SessionState`、`SendOptions`、`ConnectionStatus`、`AskUserAnswerData`、`AgentLoopInfo`、`ActiveCompactionState`、`createInitialSessionState`、`AgentSessionEventName`
|
|
390
390
|
- **页面协作**:`EmbeddedChat`、`EmbeddedChatOptions`、`CommandHandler`、`CommandEnvelope`、`InboundAction`、`InboundEnvelope`、`isCommandEnvelope`、`isInboundEnvelope`
|
|
391
391
|
- **消息与投影协议**:`MessageContent`、`MessageContentPart`、`TextContentPart`、`ImageUrlContentPart`、`FileContentPart`、`ToolCallInfo`、`ToolBridgeContent`、`CompactionInfo`、`MemoryRefInfo`、`ArchivedFileInfo`、`ArchivedToolCallInfo`、`TurnProjection`、`ContentBlock`、`PatchEnvelope`、`MemoryRef`、`buildMessageContent`、`normalizeMessageContent`、`isHiddenInternalMessage`、`transformSlashCommand`、`extractTextAttachments`、`ParsedTextAttachment`、`ParsedTextContext`
|
|
392
|
-
- **Solution / 任务协议**:`Solution`、`SolutionAppField`、`SolutionAppState`、`SolutionAppUiConfig`、`SolutionRef`、`ExistingSolutionRef`、`PreparedSolution`、`PreparedSolutionAsset`、`LayoutType`、`BizRole`、`TaskStatus`、`BackgroundTask`
|
|
392
|
+
- **Solution / 任务协议**:`Solution`、`SolutionAppField`、`SolutionAppState`、`SolutionAppUiConfig`、`SolutionRef`、`PublishedSolutionRef`、`ExistingSolutionRef`、`PreparedSolution`、`PreparedSolutionAsset`、`LayoutType`、`BizRole`、`TaskStatus`、`BackgroundTask`
|
|
393
393
|
- **Headless**:`HeadlessResource`、`RunOptions`、`RunResult`、`RunTrace`
|
|
394
394
|
- **低层通道(apps/web 等高级集成)**:`createSocket`、`CreateSocketOptions`、`TypedSocket`、`AsrAudioPayload`、`ClientProjectionBuilder`、`RawEvent`
|
package/dist/index.d.ts
CHANGED
|
@@ -21,13 +21,13 @@ export type { HeadlessResource } from "./resources/headless";
|
|
|
21
21
|
export { ModelsResource } from "./resources/models";
|
|
22
22
|
export type { ModelCatalog, ModelOption } from "./resources/models";
|
|
23
23
|
export type { SessionsResource } from "./resources/sessions";
|
|
24
|
-
export type { CreateSessionRequest, AppCliAttachment, AppCliDefinition, FileEntry, PaginatedSessionsResult, SessionContextStats, SessionHistory, ShareLinkResult, UploadFileEntry, UploadFilesOptions, } from "./resources/sessions";
|
|
24
|
+
export type { CreateSessionRequest, AppCliAttachment, AppCliDefinition, FileEntry, ImportSessionOptions, PaginatedSessionsResult, SessionContextStats, SessionHistory, ShareLinkResult, UploadFileEntry, UploadFilesOptions, } from "./resources/sessions";
|
|
25
25
|
export type { ArchivedFileInfo, ArchivedToolCallInfo, ChatMessage, CompactionInfo, FileContentPart, ImageUrlContentPart, MemoryRefInfo, MessageContent, MessageContentPart, TextContentPart, ToolBridgeContent, ToolCallInfo, } from "./schemas/message";
|
|
26
26
|
export { buildMessageContent, contentPreview, extractTextAttachments, getFileParts, getImageParts, getTextContent, groupMessagesByLoop, isHiddenInternalMessage, normalizeMessageContent, transformSlashCommand, } from "./schemas/message-utils";
|
|
27
27
|
export type { ParsedTextAttachment, ParsedTextContext } from "./schemas/message-utils";
|
|
28
28
|
export type { ContentBlock, MemoryRef, PatchEnvelope, TurnProjection } from "./schemas/projection";
|
|
29
29
|
export { SessionInfo, SessionStatus } from "./schemas/session";
|
|
30
|
-
export type { ModeId, PrimarySkillParallelMode, PrimarySkillSnapshot, SessionDetail, SessionPortMapping, TemplateId, } from "./schemas/session";
|
|
30
|
+
export type { ModeId, PrimarySkillParallelMode, PrimarySkillSnapshot, SessionDetail, SessionPortMapping, PublishedSolutionRef, TemplateId, } from "./schemas/session";
|
|
31
31
|
export { LayoutType } from "./schemas/solution";
|
|
32
32
|
export type { BizRole, Solution, SolutionAppField, SolutionAppState, SolutionAppUiConfig, } from "./schemas/solution";
|
|
33
33
|
export { Task, TaskStatus } from "./schemas/task";
|
package/dist/index.js
CHANGED
|
@@ -1841,10 +1841,12 @@ function findLatestAssistant(turns, loopId) {
|
|
|
1841
1841
|
|
|
1842
1842
|
// src/resources/sessions.ts
|
|
1843
1843
|
function toCreateSessionPayload(request) {
|
|
1844
|
+
const solutionRef = request.solution_ref ?? externalSolutionRef(request.solution_id);
|
|
1844
1845
|
return {
|
|
1845
1846
|
intent: request.intent ?? "",
|
|
1846
1847
|
template_id: request.template_id,
|
|
1847
|
-
solution_id: request.solution_id,
|
|
1848
|
+
solution_id: solutionRef ? void 0 : request.solution_id,
|
|
1849
|
+
solution_ref: solutionRef,
|
|
1848
1850
|
biz_role_id: request.biz_role_id ?? null,
|
|
1849
1851
|
model: request.model ?? null,
|
|
1850
1852
|
enable_thinking: request.enable_thinking ?? null,
|
|
@@ -1853,11 +1855,33 @@ function toCreateSessionPayload(request) {
|
|
|
1853
1855
|
env: request.env,
|
|
1854
1856
|
disable_tools: request.disable_tools ?? null,
|
|
1855
1857
|
session_solution_asset_id: request.session_solution_asset_id ?? null,
|
|
1858
|
+
solution_snapshot_session_id: request.solution_snapshot_session_id ?? null,
|
|
1856
1859
|
compaction_ratio: request.compaction_ratio ?? null,
|
|
1857
1860
|
...request.runtime_type ? { runtime_type: request.runtime_type } : {},
|
|
1858
1861
|
...request.daemon_id ? { daemon_id: request.daemon_id } : {}
|
|
1859
1862
|
};
|
|
1860
1863
|
}
|
|
1864
|
+
var builtinSolutionIds = /* @__PURE__ */ new Set([
|
|
1865
|
+
"app-dev",
|
|
1866
|
+
"general_chat",
|
|
1867
|
+
"multica",
|
|
1868
|
+
"night_build",
|
|
1869
|
+
"skill_editor",
|
|
1870
|
+
"smart_bid",
|
|
1871
|
+
"solution_generate"
|
|
1872
|
+
]);
|
|
1873
|
+
function externalSolutionRef(solutionId) {
|
|
1874
|
+
if (!solutionId) return void 0;
|
|
1875
|
+
const normalized = solutionId === "default" ? "general_chat" : solutionId.trim();
|
|
1876
|
+
if (builtinSolutionIds.has(normalized)) {
|
|
1877
|
+
return { source: "builtin", name: normalized };
|
|
1878
|
+
}
|
|
1879
|
+
const parts = normalized.split("/");
|
|
1880
|
+
if (parts.length === 2 && parts.every(Boolean)) {
|
|
1881
|
+
return { source: "hub", org: parts[0], name: parts[1] };
|
|
1882
|
+
}
|
|
1883
|
+
return void 0;
|
|
1884
|
+
}
|
|
1861
1885
|
var SessionsResource = class {
|
|
1862
1886
|
constructor(client) {
|
|
1863
1887
|
this.client = client;
|
|
@@ -1965,13 +1989,18 @@ var SessionsResource = class {
|
|
|
1965
1989
|
offset,
|
|
1966
1990
|
template_id_prefix,
|
|
1967
1991
|
solution_id,
|
|
1992
|
+
solution_registry_id,
|
|
1968
1993
|
q
|
|
1969
1994
|
}) {
|
|
1970
1995
|
const searchParams = new URLSearchParams();
|
|
1971
1996
|
searchParams.set("limit", String(limit));
|
|
1972
1997
|
searchParams.set("offset", String(offset));
|
|
1973
1998
|
if (template_id_prefix) searchParams.set("template_id_prefix", template_id_prefix);
|
|
1974
|
-
if (
|
|
1999
|
+
if (solution_registry_id) {
|
|
2000
|
+
searchParams.set("solution_registry_id", solution_registry_id);
|
|
2001
|
+
} else if (solution_id) {
|
|
2002
|
+
searchParams.set("solution_id", solution_id);
|
|
2003
|
+
}
|
|
1975
2004
|
const trimmedQuery = q?.trim();
|
|
1976
2005
|
if (trimmedQuery) searchParams.set("q", trimmedQuery);
|
|
1977
2006
|
return this.client.json("GET", `/api/sessions?${searchParams.toString()}`);
|
|
@@ -2227,11 +2256,23 @@ var SessionsResource = class {
|
|
|
2227
2256
|
const res = await this.client.formData("POST", "/api/sessions/preview-import", form);
|
|
2228
2257
|
return res.json();
|
|
2229
2258
|
}
|
|
2230
|
-
async importSession(file, name,
|
|
2259
|
+
async importSession(file, name, solutionOverride) {
|
|
2231
2260
|
const form = new FormData();
|
|
2232
2261
|
form.append("file", file);
|
|
2233
2262
|
if (name) form.append("name", name);
|
|
2234
|
-
if (
|
|
2263
|
+
if (typeof solutionOverride === "string") {
|
|
2264
|
+
if (solutionOverride) form.append("solution_id", solutionOverride);
|
|
2265
|
+
} else if (solutionOverride) {
|
|
2266
|
+
if (solutionOverride.solution_ref) {
|
|
2267
|
+
form.append("solution_ref", JSON.stringify(solutionOverride.solution_ref));
|
|
2268
|
+
}
|
|
2269
|
+
if (solutionOverride.solution_snapshot_session_id) {
|
|
2270
|
+
form.append(
|
|
2271
|
+
"solution_snapshot_session_id",
|
|
2272
|
+
solutionOverride.solution_snapshot_session_id
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2235
2276
|
const res = await this.client.formData("POST", "/api/sessions/import", form);
|
|
2236
2277
|
return res.json();
|
|
2237
2278
|
}
|
|
@@ -3953,7 +3994,7 @@ function resolveAuthToken(options) {
|
|
|
3953
3994
|
|
|
3954
3995
|
// src/version.ts
|
|
3955
3996
|
var SDK_NAME = "agent-client";
|
|
3956
|
-
var SDK_VERSION = true ? "1.2.1-alpha.
|
|
3997
|
+
var SDK_VERSION = true ? "1.2.1-alpha.4" : "1.1.1";
|
|
3957
3998
|
|
|
3958
3999
|
// src/socket.ts
|
|
3959
4000
|
function withSdkIdentity(auth) {
|
|
@@ -4406,6 +4447,7 @@ var SessionInfo = type({
|
|
|
4406
4447
|
"model?": "string | null",
|
|
4407
4448
|
"enable_thinking?": "boolean | null",
|
|
4408
4449
|
"solution_id?": "string | null",
|
|
4450
|
+
"solution_ref?": "unknown",
|
|
4409
4451
|
"biz_role_id?": "string | null",
|
|
4410
4452
|
"solution?": "unknown",
|
|
4411
4453
|
"plan_summary?": "string | null",
|