@blade-hq/agent-kit 0.4.23 → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "../../chunk-LKNU4NUC.js";
3
+ } from "../../chunk-C7VSMOXN.js";
4
4
  import "../../chunk-J3XVFPOV.js";
5
5
  import "../../chunk-ROGNJYST.js";
6
6
  import "../../chunk-JCJFFJ42.js";
@@ -16,13 +16,13 @@ import {
16
16
  isErrorMessage,
17
17
  isUserMessage,
18
18
  useWhatIfQuoteContext
19
- } from "../../../chunk-LKOBHTL7.js";
19
+ } from "../../../chunk-ZGM3H24C.js";
20
20
  import {
21
21
  AskUserQuestionBlock
22
- } from "../../../chunk-WZT2DOBJ.js";
22
+ } from "../../../chunk-2FTEBWEM.js";
23
23
  import "../../../chunk-2UP7MG3J.js";
24
- import "../../../chunk-47YVQZQ7.js";
25
- import "../../../chunk-LKNU4NUC.js";
24
+ import "../../../chunk-CFZDKYT3.js";
25
+ import "../../../chunk-C7VSMOXN.js";
26
26
  import "../../../chunk-J3XVFPOV.js";
27
27
  import "../../../chunk-ROGNJYST.js";
28
28
  import "../../../chunk-7LEKQI47.js";
@@ -3,9 +3,9 @@ import {
3
3
  PlanSummaryCard,
4
4
  extractLatestPlanMessages,
5
5
  parsePlanMessages
6
- } from "../../../chunk-WZT2DOBJ.js";
6
+ } from "../../../chunk-2FTEBWEM.js";
7
7
  import "../../../chunk-2UP7MG3J.js";
8
- import "../../../chunk-LKNU4NUC.js";
8
+ import "../../../chunk-C7VSMOXN.js";
9
9
  import "../../../chunk-J3XVFPOV.js";
10
10
  import "../../../chunk-ROGNJYST.js";
11
11
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useSession
3
- } from "../../../chunk-WQYDTSSV.js";
3
+ } from "../../../chunk-M2ZCTKY7.js";
4
4
  import {
5
5
  checkoutSession,
6
6
  getSessionCheckpoints,
7
7
  useChatStore,
8
8
  useSessionStore
9
- } from "../../../chunk-LKNU4NUC.js";
9
+ } from "../../../chunk-C7VSMOXN.js";
10
10
  import "../../../chunk-J3XVFPOV.js";
11
11
  import "../../../chunk-ROGNJYST.js";
12
12
  import {
@@ -3,7 +3,7 @@ import {
3
3
  CollapsibleContent,
4
4
  CollapsibleTrigger,
5
5
  resolveSessionFilePreviewTarget
6
- } from "../../../chunk-47YVQZQ7.js";
6
+ } from "../../../chunk-CFZDKYT3.js";
7
7
  import {
8
8
  apiFetchText,
9
9
  copyFile,
@@ -17,7 +17,7 @@ import {
17
17
  useChatStore,
18
18
  useSessionStore,
19
19
  useUiStore
20
- } from "../../../chunk-LKNU4NUC.js";
20
+ } from "../../../chunk-C7VSMOXN.js";
21
21
  import "../../../chunk-J3XVFPOV.js";
22
22
  import "../../../chunk-ROGNJYST.js";
23
23
  import {
@@ -473,6 +473,7 @@ function FolderNode({
473
473
  const queryClient = useQueryClient();
474
474
  const isExpanded = expandedDirs.has(entry.path);
475
475
  const isSelected = selectedPath === entry.path;
476
+ const isCurrentSessionDir = entry.name === sessionId;
476
477
  const renameInputRef = useRef(null);
477
478
  const [isRenaming, setIsRenaming] = useState2(false);
478
479
  const [renamingValue, setRenamingValue] = useState2(entry.name);
@@ -591,7 +592,8 @@ function FolderNode({
591
592
  },
592
593
  children: [
593
594
  /* @__PURE__ */ jsx2(FileTreeIcon, { children: getFolderIcon() }),
594
- /* @__PURE__ */ jsx2(FileTreeName, { className: "min-w-0 flex-1", children: entry.name })
595
+ /* @__PURE__ */ jsx2(FileTreeName, { className: "min-w-0 flex-1", children: entry.name }),
596
+ isCurrentSessionDir ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 rounded-full bg-emerald-100 px-2 py-[2px] text-[11px] font-medium leading-[14px] text-emerald-700", children: "\u5F53\u524D\u5BF9\u8BDD" }) : null
595
597
  ]
596
598
  }
597
599
  ),
@@ -631,12 +633,11 @@ function FolderNode({
631
633
  children: activeAction === "copy" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Copy, { size: 12 })
632
634
  }
633
635
  ),
634
- /* @__PURE__ */ jsx2(
636
+ onShareFile ? /* @__PURE__ */ jsx2(
635
637
  TreeActionButton,
636
638
  {
637
- disabled: activeAction !== null || !onShareFile,
639
+ disabled: activeAction !== null,
638
640
  onClick: async () => {
639
- if (!onShareFile) return;
640
641
  setActiveAction("share");
641
642
  try {
642
643
  await onShareFile(entry.path, entry.name);
@@ -647,10 +648,10 @@ function FolderNode({
647
648
  setActiveAction(null);
648
649
  }
649
650
  },
650
- title: "\u5171\u4EAB\u5230 .share",
651
+ title: "\u5171\u4EAB\u5230\u4EA7\u7269\u533A",
651
652
  children: activeAction === "share" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Link2, { size: 12 })
652
653
  }
653
- ),
654
+ ) : null,
654
655
  /* @__PURE__ */ jsx2(
655
656
  TreeActionButton,
656
657
  {
@@ -857,12 +858,11 @@ function FileNode({
857
858
  children: activeAction === "copy" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Copy, { size: 12 })
858
859
  }
859
860
  ),
860
- /* @__PURE__ */ jsx2(
861
+ onShareFile ? /* @__PURE__ */ jsx2(
861
862
  TreeActionButton,
862
863
  {
863
- disabled: activeAction !== null || !onShareFile,
864
+ disabled: activeAction !== null,
864
865
  onClick: async () => {
865
- if (!onShareFile) return;
866
866
  setActiveAction("share");
867
867
  try {
868
868
  await onShareFile(entry.path, entry.name);
@@ -873,10 +873,10 @@ function FileNode({
873
873
  setActiveAction(null);
874
874
  }
875
875
  },
876
- title: "\u5171\u4EAB\u5230 .share",
876
+ title: "\u5171\u4EAB\u5230\u4EA7\u7269\u533A",
877
877
  children: activeAction === "share" ? /* @__PURE__ */ jsx2(Loader2, { size: 12, className: "animate-spin" }) : /* @__PURE__ */ jsx2(Link2, { size: 12 })
878
878
  }
879
- ),
879
+ ) : null,
880
880
  /* @__PURE__ */ jsx2(
881
881
  TreeActionButton,
882
882
  {
@@ -973,23 +973,39 @@ function LazyDirChildren({
973
973
  ) });
974
974
  }
975
975
  var TAG_STYLES = {
976
- "AI \u751F\u6210": "border-purple-500/30 bg-purple-500/10 text-purple-400",
977
- "\u7528\u6237\u4E0A\u4F20": "border-blue-500/30 bg-blue-500/10 text-blue-400",
978
- \u4EA7\u7269: "border-amber-500/30 bg-amber-500/10 text-amber-400"
976
+ "AI \u751F\u6210": "bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]",
977
+ "\u7528\u6237\u4E0A\u4F20": "bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]",
978
+ \u4EA7\u7269: "bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]"
979
979
  };
980
- var DEFAULT_TAG_STYLE = "border-[hsl(var(--border))] bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]";
980
+ var DEFAULT_TAG_STYLE = "bg-[hsl(var(--muted))] text-[hsl(var(--muted-foreground))]";
981
981
  function FileTagList({ tags }) {
982
- if (!tags || tags.length === 0) return null;
983
- return /* @__PURE__ */ jsx2("span", { className: "ml-1 flex min-w-0 shrink-0 items-center gap-1", children: tags.map((tag) => /* @__PURE__ */ jsx2(
982
+ const normalizedTags = normalizeDisplayTags(tags);
983
+ if (normalizedTags.length === 0) return null;
984
+ return /* @__PURE__ */ jsx2("span", { className: "ml-1 flex min-w-0 shrink-0 items-center gap-1", children: normalizedTags.map((tag) => /* @__PURE__ */ jsx2(
984
985
  "span",
985
986
  {
986
- className: `max-w-20 truncate rounded-full border px-1.5 py-0.5 text-[9px] font-medium leading-none ${TAG_STYLES[tag] ?? DEFAULT_TAG_STYLE}`,
987
+ className: `max-w-20 truncate rounded-full px-2 py-[2px] text-[11px] font-medium leading-[14px] ${TAG_STYLES[tag] ?? DEFAULT_TAG_STYLE}`,
987
988
  title: tag,
988
989
  children: tag
989
990
  },
990
991
  tag
991
992
  )) });
992
993
  }
994
+ function normalizeDisplayTags(tags) {
995
+ if (!tags) return [];
996
+ return tags.flatMap((tag) => {
997
+ const trimmed = tag.trim();
998
+ if (!trimmed.startsWith("[") || !trimmed.endsWith("]")) {
999
+ return trimmed ? [trimmed] : [];
1000
+ }
1001
+ try {
1002
+ const parsed = JSON.parse(trimmed);
1003
+ return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : [trimmed];
1004
+ } catch {
1005
+ return [trimmed];
1006
+ }
1007
+ });
1008
+ }
993
1009
  function TreeActionButton({
994
1010
  children,
995
1011
  disabled = false,
@@ -1203,16 +1219,25 @@ function WorkspaceFilesPanel({
1203
1219
  }
1204
1220
  }, [activeTab, inlineResources.length]);
1205
1221
  const uploadTargetDir = () => {
1206
- const candidates = Array.from(expandedDirs).filter((path) => path !== ".").filter((path) => {
1222
+ const candidates = Array.from(expandedDirs).filter((path) => path !== ".").filter((path) => path !== rootPath).filter((path) => {
1207
1223
  const parts = path.split("/").filter(Boolean);
1224
+ const rootParts = rootPath.split("/").filter(Boolean);
1225
+ const ancestorPrefix = path.startsWith("/") ? "/" : "";
1226
+ if (rootParts.length === 0 && path.startsWith("/")) {
1227
+ return false;
1228
+ }
1229
+ if (rootParts.length > 0 && !rootParts.every((part, index) => parts[index] === part)) {
1230
+ return false;
1231
+ }
1208
1232
  for (let index = 1; index < parts.length; index += 1) {
1209
- const ancestor = parts.slice(0, index).join("/");
1233
+ const ancestor = `${ancestorPrefix}${parts.slice(0, index).join("/")}`;
1234
+ if (rootParts.length > 0 && index < rootParts.length) continue;
1210
1235
  if (!expandedDirs.has(ancestor)) return false;
1211
1236
  }
1212
1237
  return true;
1213
1238
  });
1214
1239
  if (candidates.length === 0) {
1215
- return ".";
1240
+ return rootPath;
1216
1241
  }
1217
1242
  return candidates.reduce((deepestPath, currentPath) => {
1218
1243
  const deepestDepth = deepestPath.split("/").filter(Boolean).length;