@blade-hq/agent-react 2612.0.0-beta.26 → 2612.0.0-beta.27
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/dist/{chunk-GSKRNKEI.js → chunk-66V4EOSO.js} +3 -3
- package/dist/{chunk-GSKRNKEI.js.map → chunk-66V4EOSO.js.map} +1 -1
- package/dist/embed/entry.d.ts +0 -3
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/rich-input/FileCompletionMenu.d.ts +1 -2
- package/dist/rich-input/lib/user-home.d.ts +0 -17
- package/dist/rich-input.js +8 -37
- package/dist/rich-input.js.map +1 -1
- package/package.json +2 -2
package/dist/embed/entry.d.ts
CHANGED
|
@@ -50,9 +50,6 @@ declare const BladeAgent: {
|
|
|
50
50
|
is_example?: boolean | undefined;
|
|
51
51
|
ports?: unknown;
|
|
52
52
|
disable_tools?: string[] | undefined;
|
|
53
|
-
runtime_type?: string | null | undefined;
|
|
54
|
-
daemon_id?: string | null | undefined;
|
|
55
|
-
agent_runtime_id?: string | null | undefined;
|
|
56
53
|
workspace_path?: string | null | undefined;
|
|
57
54
|
ba_version?: string | null | undefined;
|
|
58
55
|
sandbox_version?: string | null | undefined;
|
package/dist/index.js
CHANGED
package/dist/internal.js
CHANGED
|
@@ -2,7 +2,6 @@ import { type PluginSuggestionItem, type PluginSuggestionError } from "./extensi
|
|
|
2
2
|
import { type TopicAssetSuggestionItem, type TopicAssetSuggestionError } from "./extensions/topic-asset-mention";
|
|
3
3
|
import type { SuggestionProps } from "@tiptap/suggestion";
|
|
4
4
|
import type { BladeClient, FileEntry } from "@blade-hq/agent-client";
|
|
5
|
-
import { type UserHomeRuntime } from "./lib/user-home";
|
|
6
5
|
import type { FileSuggestionItem } from "./extensions/file-mention";
|
|
7
6
|
/**
|
|
8
7
|
* `session` 浏览当前会话的工作空间(相对路径,需要会话);`userHome` 浏览用户
|
|
@@ -35,7 +34,7 @@ export declare function getFileSuggestionItems(client: BladeClient, sessionId: s
|
|
|
35
34
|
* 路径:选中目录后编辑器插入的是 `@/root/文档/`,下一次补全就从这个绝对
|
|
36
35
|
* 路径继续往下走。不在 HOME 之下的输入一律当成在 HOME 根目录里按名字过滤。
|
|
37
36
|
*/
|
|
38
|
-
export declare function parseUserHomeQuery(query: string
|
|
37
|
+
export declare function parseUserHomeQuery(query: string): ParsedQuery;
|
|
39
38
|
export declare function getUserHomeSuggestionItems(client: BladeClient, query: string): Promise<FileEntry[]>;
|
|
40
39
|
export declare const FileCompletionMenu: import("react").ForwardRefExoticComponent<FileCompletionMenuProps & import("react").RefAttributes<FileCompletionMenuRef>>;
|
|
41
40
|
export {};
|
|
@@ -4,23 +4,6 @@ export interface UserHomeEntry {
|
|
|
4
4
|
path: string;
|
|
5
5
|
is_dir: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface UserHomeRuntime {
|
|
8
|
-
/** 云电脑 HOME 的绝对路径。沙盒是 `/root`,daemon 是它自报的用户目录。 */
|
|
9
|
-
homePath: string;
|
|
10
|
-
/** Windows daemon 的路径用反斜杠,拼子目录时不能写死 `/`。 */
|
|
11
|
-
separator: "/" | "\\";
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 用户云电脑的 HOME 位置。不能假定是 `/root`:用户把某台 daemon 设成默认运行
|
|
15
|
-
* 环境时,HOME 是它自报的路径(`/home/alice`、`C:\Users\alice`),拿 `/root`
|
|
16
|
-
* 去问会被判为越界,补全菜单就会静默空掉。
|
|
17
|
-
*/
|
|
18
|
-
export declare function getUserHomeRuntime(client: BladeClient): Promise<UserHomeRuntime>;
|
|
19
|
-
/**
|
|
20
|
-
* 最近一次解析出的运行环境。补全菜单渲染时条目已经拉好了,此时运行环境必然
|
|
21
|
-
* 已解析——同步读一份,省得把 Promise 传进渲染路径。
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLastUserHomeRuntime(): UserHomeRuntime;
|
|
24
7
|
/**
|
|
25
8
|
* 列出用户云电脑 HOME 下某个目录的内容。不需要会话——首页在还没建会话时
|
|
26
9
|
* 就要能引用这些文件。后端已按统一规则跳过隐藏项、依赖目录和编译产物。
|
package/dist/rich-input.js
CHANGED
|
@@ -27118,45 +27118,18 @@ function getUnsupportedImageFiles(files, supportsImage) {
|
|
|
27118
27118
|
import { forwardRef as forwardRef2, useCallback as useCallback5, useImperativeHandle, useMemo as useMemo8, useState as useState9 } from "react";
|
|
27119
27119
|
|
|
27120
27120
|
// src/rich-input/lib/user-home.ts
|
|
27121
|
-
var SANDBOX_HOME_ROOT = "/root";
|
|
27122
|
-
var SANDBOX_RUNTIME = { homePath: SANDBOX_HOME_ROOT, separator: "/" };
|
|
27123
27121
|
var CACHE_TTL_MS2 = 15e3;
|
|
27124
27122
|
var cachesByClient2 = /* @__PURE__ */ new WeakMap();
|
|
27125
|
-
var lastResolvedRuntime = SANDBOX_RUNTIME;
|
|
27126
27123
|
function cachesFor2(client) {
|
|
27127
27124
|
const existing = cachesByClient2.get(client);
|
|
27128
27125
|
if (existing) return existing;
|
|
27129
|
-
const caches2 = {
|
|
27126
|
+
const caches2 = { dirs: /* @__PURE__ */ new Map() };
|
|
27130
27127
|
cachesByClient2.set(client, caches2);
|
|
27131
27128
|
onInputCachesReset(client, () => {
|
|
27132
27129
|
if (cachesByClient2.get(client) === caches2) cachesByClient2.delete(client);
|
|
27133
|
-
lastResolvedRuntime = SANDBOX_RUNTIME;
|
|
27134
27130
|
});
|
|
27135
27131
|
return caches2;
|
|
27136
27132
|
}
|
|
27137
|
-
function getUserHomeRuntime(client) {
|
|
27138
|
-
const caches2 = cachesFor2(client);
|
|
27139
|
-
if (caches2.runtime && Date.now() - caches2.runtime.at < CACHE_TTL_MS2) {
|
|
27140
|
-
return caches2.runtime.request;
|
|
27141
|
-
}
|
|
27142
|
-
const request = client.json("GET", "/api/agent-board/workspace-runtime").then((runtime) => {
|
|
27143
|
-
const homePath = (runtime.home_path ?? "").trim() || SANDBOX_HOME_ROOT;
|
|
27144
|
-
const resolved = {
|
|
27145
|
-
homePath,
|
|
27146
|
-
separator: (runtime.os ?? "").toLowerCase().startsWith("windows") ? "\\" : "/"
|
|
27147
|
-
};
|
|
27148
|
-
lastResolvedRuntime = resolved;
|
|
27149
|
-
return resolved;
|
|
27150
|
-
}).catch(() => {
|
|
27151
|
-
if (caches2.runtime?.request === request) caches2.runtime = null;
|
|
27152
|
-
return SANDBOX_RUNTIME;
|
|
27153
|
-
});
|
|
27154
|
-
caches2.runtime = { at: Date.now(), request };
|
|
27155
|
-
return request;
|
|
27156
|
-
}
|
|
27157
|
-
function getLastUserHomeRuntime() {
|
|
27158
|
-
return lastResolvedRuntime;
|
|
27159
|
-
}
|
|
27160
27133
|
function listUserHomeDir(client, dirPath) {
|
|
27161
27134
|
const { dirs } = cachesFor2(client);
|
|
27162
27135
|
const hit = dirs.get(dirPath);
|
|
@@ -27267,7 +27240,9 @@ async function getFileSuggestionItems(client, sessionId, query) {
|
|
|
27267
27240
|
const entries = await listDirectory(client, sessionId, dirPath);
|
|
27268
27241
|
return filterEntries(entries, filterQuery);
|
|
27269
27242
|
}
|
|
27270
|
-
function parseUserHomeQuery(query
|
|
27243
|
+
function parseUserHomeQuery(query) {
|
|
27244
|
+
const homePath = "/root";
|
|
27245
|
+
const separator = "/";
|
|
27271
27246
|
if (!query.startsWith(homePath)) {
|
|
27272
27247
|
return { dirPath: homePath, filterQuery: query };
|
|
27273
27248
|
}
|
|
@@ -27281,8 +27256,7 @@ function parseUserHomeQuery(query, { homePath, separator }) {
|
|
|
27281
27256
|
};
|
|
27282
27257
|
}
|
|
27283
27258
|
async function getUserHomeSuggestionItems(client, query) {
|
|
27284
|
-
const
|
|
27285
|
-
const { dirPath, filterQuery } = parseUserHomeQuery(query, runtime);
|
|
27259
|
+
const { dirPath, filterQuery } = parseUserHomeQuery(query);
|
|
27286
27260
|
let entries;
|
|
27287
27261
|
try {
|
|
27288
27262
|
entries = (await listUserHomeDir(client, dirPath)).map((entry) => ({
|
|
@@ -27352,8 +27326,7 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27352
27326
|
return;
|
|
27353
27327
|
}
|
|
27354
27328
|
if (entry.is_dir) {
|
|
27355
|
-
const
|
|
27356
|
-
const nextValue = entry.path === ROOT_DIR ? "@" : `@${entry.path}${separator}`;
|
|
27329
|
+
const nextValue = entry.path === ROOT_DIR ? "@" : `@${entry.path}/`;
|
|
27357
27330
|
editor.chain().focus().insertContentAt(range, nextValue).run();
|
|
27358
27331
|
return;
|
|
27359
27332
|
}
|
|
@@ -27363,7 +27336,7 @@ var FileCompletionMenuContent = forwardRef2(function FileCompletionMenuContent2(
|
|
|
27363
27336
|
path: entry.path
|
|
27364
27337
|
});
|
|
27365
27338
|
},
|
|
27366
|
-
[command2, editor, range
|
|
27339
|
+
[command2, editor, range]
|
|
27367
27340
|
);
|
|
27368
27341
|
useImperativeHandle(
|
|
27369
27342
|
ref,
|
|
@@ -28512,7 +28485,7 @@ function ChatInput({
|
|
|
28512
28485
|
if (!activeSessionId) return [];
|
|
28513
28486
|
try {
|
|
28514
28487
|
const detail = await client.sessions.getSession(activeSessionId);
|
|
28515
|
-
return
|
|
28488
|
+
return getTopicAssetSuggestionItems(client, detail.chat_group_id, query);
|
|
28516
28489
|
} catch {
|
|
28517
28490
|
return [{ kind: "topicAssetError", message: "\u4E3B\u9898\u8D44\u4EA7\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165 @ \u91CD\u8BD5" }];
|
|
28518
28491
|
}
|
|
@@ -29839,13 +29812,11 @@ export {
|
|
|
29839
29812
|
gateSendWhileModelLoading,
|
|
29840
29813
|
getFileSuggestionItems,
|
|
29841
29814
|
getInputModalities,
|
|
29842
|
-
getLastUserHomeRuntime,
|
|
29843
29815
|
getPluginSuggestionItems,
|
|
29844
29816
|
getSkillSuggestions,
|
|
29845
29817
|
getSlashSuggestions,
|
|
29846
29818
|
getTopicAssetSuggestionItems,
|
|
29847
29819
|
getUnsupportedImageFiles,
|
|
29848
|
-
getUserHomeRuntime,
|
|
29849
29820
|
getUserHomeSuggestionItems,
|
|
29850
29821
|
installSuggestionOutsideDismiss,
|
|
29851
29822
|
invalidateSlashSuggestions,
|