@blade-hq/agent-kit 0.4.5 → 0.4.6

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.
Files changed (48) hide show
  1. package/README.md +5 -1
  2. package/dist/chunk-2UP7MG3J.js +66 -0
  3. package/dist/chunk-2UP7MG3J.js.map +1 -0
  4. package/dist/chunk-4VWLTG5L.js +2984 -0
  5. package/dist/chunk-4VWLTG5L.js.map +1 -0
  6. package/dist/chunk-7LEKQI47.js +32 -0
  7. package/dist/chunk-7LEKQI47.js.map +1 -0
  8. package/dist/chunk-DQCXSPHP.js +33 -0
  9. package/dist/chunk-DQCXSPHP.js.map +1 -0
  10. package/dist/chunk-I3FFV63W.js +30 -0
  11. package/dist/chunk-I3FFV63W.js.map +1 -0
  12. package/dist/chunk-J3XVFPOV.js +58 -0
  13. package/dist/chunk-J3XVFPOV.js.map +1 -0
  14. package/dist/chunk-JCJFFJ42.js +39 -0
  15. package/dist/chunk-JCJFFJ42.js.map +1 -0
  16. package/dist/chunk-LIL4FIZP.js +7992 -0
  17. package/dist/chunk-LIL4FIZP.js.map +1 -0
  18. package/dist/chunk-OKQWPNE3.js +1077 -0
  19. package/dist/chunk-OKQWPNE3.js.map +1 -0
  20. package/dist/chunk-PZ5AY32C.js +10 -0
  21. package/dist/chunk-PZ5AY32C.js.map +1 -0
  22. package/dist/chunk-TC5BBLWO.js +29 -0
  23. package/dist/chunk-TC5BBLWO.js.map +1 -0
  24. package/dist/chunk-VD4CKRMT.js +127 -0
  25. package/dist/chunk-VD4CKRMT.js.map +1 -0
  26. package/dist/chunk-X6MEYCU7.js +1401 -0
  27. package/dist/chunk-X6MEYCU7.js.map +1 -0
  28. package/dist/client/index.js +24 -1052
  29. package/dist/client/index.js.map +1 -1
  30. package/dist/react/api/licenses.js +11 -1470
  31. package/dist/react/api/licenses.js.map +1 -1
  32. package/dist/react/api/vibe-coding.js +25 -1481
  33. package/dist/react/api/vibe-coding.js.map +1 -1
  34. package/dist/react/cards/register.js +45 -138
  35. package/dist/react/cards/register.js.map +1 -1
  36. package/dist/react/components/chat/index.js +28 -11366
  37. package/dist/react/components/chat/index.js.map +1 -1
  38. package/dist/react/components/plan/index.js +135 -3054
  39. package/dist/react/components/plan/index.js.map +1 -1
  40. package/dist/react/components/session/index.js +21 -1499
  41. package/dist/react/components/session/index.js.map +1 -1
  42. package/dist/react/components/workspace/index.js +116 -1715
  43. package/dist/react/components/workspace/index.js.map +1 -1
  44. package/dist/react/devtools/bridge-devtools/index.js +8 -51
  45. package/dist/react/devtools/bridge-devtools/index.js.map +1 -1
  46. package/dist/react/index.js +625 -14035
  47. package/dist/react/index.js.map +1 -1
  48. package/package.json +1 -1
@@ -1,35 +1,14 @@
1
- // src/react/lib/card-registry.ts
2
- var CardComponentRegistry = class {
3
- components;
4
- constructor(initial) {
5
- if (initial instanceof Map) {
6
- this.components = new Map(initial);
7
- } else if (initial) {
8
- this.components = new Map(Object.entries(initial));
9
- } else {
10
- this.components = /* @__PURE__ */ new Map();
11
- }
12
- }
13
- register(type, component) {
14
- this.components.set(type, component);
15
- }
16
- get(type) {
17
- return this.components.get(type);
18
- }
19
- has(type) {
20
- return this.components.has(type);
21
- }
22
- keys() {
23
- return Array.from(this.components.keys());
24
- }
25
- clear() {
26
- this.components.clear();
27
- }
28
- get size() {
29
- return this.components.size;
30
- }
31
- };
32
- var cardRegistry = new CardComponentRegistry();
1
+ import {
2
+ useCardState
3
+ } from "../../chunk-DQCXSPHP.js";
4
+ import {
5
+ cardRegistry
6
+ } from "../../chunk-2UP7MG3J.js";
7
+ import {
8
+ cn
9
+ } from "../../chunk-7LEKQI47.js";
10
+ import "../../chunk-JCJFFJ42.js";
11
+ import "../../chunk-PZ5AY32C.js";
33
12
 
34
13
  // src/react/components/card/cards/attraction-card.tsx
35
14
  import { Clock, Info, Star, Ticket } from "lucide-react";
@@ -645,69 +624,6 @@ var ConflictDetectionCard = memo(ConflictDetectionCardComponent);
645
624
 
646
625
  // src/react/components/card/cards/counter.tsx
647
626
  import { useMemo as useMemo2 } from "react";
648
-
649
- // src/react/hooks/use-card-state.ts
650
- import { useCallback, useEffect, useState as useState2 } from "react";
651
-
652
- // src/react/stores/card-state-store.ts
653
- import { create } from "zustand";
654
-
655
- // src/react/stores/client-aware.ts
656
- function createClientActions(set) {
657
- return {
658
- _client: null,
659
- setClient: (client) => set({ _client: client })
660
- };
661
- }
662
-
663
- // src/react/stores/card-state-store.ts
664
- var useCardStateStore = create((set, get) => ({
665
- ...createClientActions(set),
666
- states: {},
667
- getCardState: (cardId) => {
668
- return get().states[cardId];
669
- },
670
- setCardState: (cardId, state) => {
671
- set((prev) => ({
672
- states: { ...prev.states, [cardId]: state }
673
- }));
674
- },
675
- removeCardState: (cardId) => {
676
- set((prev) => {
677
- const { [cardId]: _, ...rest } = prev.states;
678
- return { states: rest };
679
- });
680
- },
681
- clearAllStates: () => {
682
- set({ states: {} });
683
- }
684
- }));
685
-
686
- // src/react/hooks/use-card-state.ts
687
- function useCardState(cardId, initialValue) {
688
- const getCardState = useCardStateStore((state2) => state2.getCardState);
689
- const setCardState = useCardStateStore((state2) => state2.setCardState);
690
- const storedValue = getCardState(cardId);
691
- const [state, setStateInternal] = useState2(storedValue ?? initialValue);
692
- useEffect(() => {
693
- if (storedValue === void 0) {
694
- setCardState(cardId, initialValue);
695
- }
696
- }, [cardId, initialValue, storedValue, setCardState]);
697
- const setState = useCallback(
698
- (value) => {
699
- setStateInternal((prevState) => {
700
- const newValue = typeof value === "function" ? value(prevState) : value;
701
- setCardState(cardId, newValue);
702
- return newValue;
703
- });
704
- },
705
- [cardId, setCardState]
706
- );
707
- return [state, setState];
708
- }
709
-
710
- // src/react/components/card/cards/counter.tsx
711
627
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
712
628
  function Counter(props) {
713
629
  const payload = props.card.payload;
@@ -743,7 +659,7 @@ function Counter(props) {
743
659
 
744
660
  // src/react/components/card/cards/damage-effect-card.tsx
745
661
  import { Download, Settings } from "lucide-react";
746
- import { memo as memo2, useCallback as useCallback2, useMemo as useMemo3 } from "react";
662
+ import { memo as memo2, useCallback, useMemo as useMemo3 } from "react";
747
663
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
748
664
  var calculateComprehensiveScore = (plan, weights) => {
749
665
  let score = 0;
@@ -787,10 +703,10 @@ var DamageEffectControlPanel = memo2(function DamageEffectControlPanel2({
787
703
  card
788
704
  }) {
789
705
  const [showLog, setShowLog] = useCardState(`${cardId}-showLog`, false);
790
- const toggleShowLog = useCallback2(() => {
706
+ const toggleShowLog = useCallback(() => {
791
707
  setShowLog(!showLog);
792
708
  }, [showLog, setShowLog]);
793
- const handleDownload = useCallback2(() => {
709
+ const handleDownload = useCallback(() => {
794
710
  try {
795
711
  const jsonContent = JSON.stringify(card, null, 2);
796
712
  const blob = new Blob([jsonContent], { type: "application/json" });
@@ -931,7 +847,7 @@ var WeightAdjustmentPanel = memo2(function WeightAdjustmentPanel2({
931
847
  const weightSum = useMemo3(() => {
932
848
  return Object.values(weights).reduce((sum, w) => sum + w, 0);
933
849
  }, [weights]);
934
- const handleWeightChange = useCallback2(
850
+ const handleWeightChange = useCallback(
935
851
  (key, newValue) => {
936
852
  const normalized = normalizeWeights(weights, key, newValue);
937
853
  setWeights(normalized);
@@ -1014,7 +930,7 @@ function DamageEffectCardComponent({ card }) {
1014
930
  ).plan;
1015
931
  }, [plans, currentWeights]);
1016
932
  const displayBestPlan = calculatedBestPlan?.name;
1017
- const handleWeightChange = useCallback2(
933
+ const handleWeightChange = useCallback(
1018
934
  (newWeights) => {
1019
935
  setCurrentWeights(newWeights);
1020
936
  },
@@ -1105,16 +1021,7 @@ function DestinationCard({ card }) {
1105
1021
  }
1106
1022
 
1107
1023
  // src/react/components/card/cards/diff-card.tsx
1108
- import { useState as useState3 } from "react";
1109
-
1110
- // src/react/lib/utils.ts
1111
- import { clsx } from "clsx";
1112
- import { twMerge } from "tailwind-merge";
1113
- function cn(...inputs) {
1114
- return twMerge(clsx(inputs));
1115
- }
1116
-
1117
- // src/react/components/card/cards/diff-card.tsx
1024
+ import { useState as useState2 } from "react";
1118
1025
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1119
1026
  function computeDiff(oldText, newText) {
1120
1027
  const oldLines = oldText.split("\n");
@@ -1151,7 +1058,7 @@ function computeDiff(oldText, newText) {
1151
1058
  return result;
1152
1059
  }
1153
1060
  function DiffCard({ card }) {
1154
- const [splitView, setSplitView] = useState3(true);
1061
+ const [splitView, setSplitView] = useState2(true);
1155
1062
  const payload = card.payload;
1156
1063
  const {
1157
1064
  oldContent = "",
@@ -1284,7 +1191,7 @@ function DiffCard({ card }) {
1284
1191
 
1285
1192
  // src/react/components/card/cards/execution-order-card.tsx
1286
1193
  import { Activity, Calendar, Clock as Clock2, Users } from "lucide-react";
1287
- import { useMemo as useMemo4, useState as useState4 } from "react";
1194
+ import { useMemo as useMemo4, useState as useState3 } from "react";
1288
1195
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1289
1196
  var getPlatformColor = (index) => {
1290
1197
  const colors = [
@@ -1301,7 +1208,7 @@ var getPlatformColor = (index) => {
1301
1208
  };
1302
1209
  function ExecutionOrderCard({ card }) {
1303
1210
  const data = card.payload || card.data;
1304
- const [activeTab, setActiveTab] = useState4("gantt");
1211
+ const [activeTab, setActiveTab] = useState3("gantt");
1305
1212
  if (!data || !Array.isArray(data)) {
1306
1213
  return /* @__PURE__ */ jsx9("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx9("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6267\u884C\u6570\u636E\u683C\u5F0F\u65E0\u6548" }) });
1307
1214
  }
@@ -1517,7 +1424,7 @@ function ExecutionOrderCard({ card }) {
1517
1424
  }
1518
1425
 
1519
1426
  // src/react/components/card/cards/experience-card-with-options.tsx
1520
- import { memo as memo3, useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo5, useRef } from "react";
1427
+ import { memo as memo3, useCallback as useCallback2, useEffect, useMemo as useMemo5, useRef } from "react";
1521
1428
  import { Check } from "lucide-react";
1522
1429
  import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1523
1430
  var sectionColors = [
@@ -1557,7 +1464,7 @@ function ExperienceCardWithOptionsInner({ card, sendMessage }) {
1557
1464
  const sendMessageRef = useRef(sendMessage);
1558
1465
  sendMessageRef.current = sendMessage;
1559
1466
  const processingTimerRef = useRef(null);
1560
- const handleOptionClick = useCallback3(
1467
+ const handleOptionClick = useCallback2(
1561
1468
  async (option) => {
1562
1469
  if (selectedOption || isSending) return;
1563
1470
  setSelectedOption(option.value);
@@ -1594,7 +1501,7 @@ function ExperienceCardWithOptionsInner({ card, sendMessage }) {
1594
1501
  },
1595
1502
  [selectedOption, isSending, setSelectedOption, setIsSending, setShowProcessing]
1596
1503
  );
1597
- useEffect2(() => {
1504
+ useEffect(() => {
1598
1505
  return () => {
1599
1506
  if (processingTimerRef.current) {
1600
1507
  clearTimeout(processingTimerRef.current);
@@ -1818,7 +1725,7 @@ import {
1818
1725
  Target as Target2,
1819
1726
  Zap
1820
1727
  } from "lucide-react";
1821
- import { Fragment, useState as useState5 } from "react";
1728
+ import { Fragment, useState as useState4 } from "react";
1822
1729
  import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1823
1730
  var getPriorityColor = (priority) => {
1824
1731
  switch (priority) {
@@ -2250,9 +2157,9 @@ function KillChainPhaseCard({
2250
2157
  }
2251
2158
  function KillChainCard({ card }) {
2252
2159
  const payload = card.payload;
2253
- const [expandedPhases, setExpandedPhases] = useState5(/* @__PURE__ */ new Set());
2254
- const [showRestrike, setShowRestrike] = useState5(false);
2255
- const [showRisk, setShowRisk] = useState5(false);
2160
+ const [expandedPhases, setExpandedPhases] = useState4(/* @__PURE__ */ new Set());
2161
+ const [showRestrike, setShowRestrike] = useState4(false);
2162
+ const [showRisk, setShowRisk] = useState4(false);
2256
2163
  if (!payload?.kill_chain) {
2257
2164
  return /* @__PURE__ */ jsx13("div", { className: "border border-red-500/50 rounded-md p-4 bg-red-500/10", children: /* @__PURE__ */ jsx13("p", { className: "text-red-400 text-sm", children: "\u6740\u4F24\u94FE\u5361\u7247\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF1A\u7F3A\u5C11\u5FC5\u8981\u7684 kill_chain \u6570\u636E" }) });
2258
2165
  }
@@ -2774,7 +2681,7 @@ function OrderStatusCard({ card }) {
2774
2681
 
2775
2682
  // src/react/components/card/cards/patch-card.tsx
2776
2683
  import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight3, FileEdit } from "lucide-react";
2777
- import { useState as useState6 } from "react";
2684
+ import { useState as useState5 } from "react";
2778
2685
  import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
2779
2686
  function getDiffLineClassName(line) {
2780
2687
  if (line.startsWith("+") && !line.startsWith("+++")) {
@@ -2799,7 +2706,7 @@ function SinglePatch({
2799
2706
  patch,
2800
2707
  defaultExpanded = false
2801
2708
  }) {
2802
- const [isExpanded, setIsExpanded] = useState6(defaultExpanded);
2709
+ const [isExpanded, setIsExpanded] = useState5(defaultExpanded);
2803
2710
  return /* @__PURE__ */ jsxs16("div", { className: "my-2 overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))]", children: [
2804
2711
  /* @__PURE__ */ jsxs16(
2805
2712
  "button",
@@ -2945,7 +2852,7 @@ function ProductRecommendationCard({ card }) {
2945
2852
 
2946
2853
  // src/react/components/card/cards/reflection-optimization-card.tsx
2947
2854
  import { AlertCircle as AlertCircle2, ArrowRight, ChevronDown as ChevronDown3, ChevronUp, Lightbulb, TrendingUp as TrendingUp2 } from "lucide-react";
2948
- import { useState as useState7 } from "react";
2855
+ import { useState as useState6 } from "react";
2949
2856
  import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
2950
2857
  var getRiskLevelColor = (level) => {
2951
2858
  switch (level) {
@@ -3073,7 +2980,7 @@ function MetricsComparison({
3073
2980
  ] });
3074
2981
  }
3075
2982
  function PlanOptimizationSection({ plan }) {
3076
- const [isOpen, setIsOpen] = useState7(false);
2983
+ const [isOpen, setIsOpen] = useState6(false);
3077
2984
  return /* @__PURE__ */ jsxs18("div", { className: "rounded-lg border border-[hsl(var(--border))] p-4 transition-colors hover:bg-[hsl(var(--accent))]/50", children: [
3078
2985
  /* @__PURE__ */ jsxs18(
3079
2986
  "button",
@@ -3213,7 +3120,7 @@ function ReflectionOptimizationCard({ card }) {
3213
3120
 
3214
3121
  // src/react/components/card/cards/resolution-modifications-card.tsx
3215
3122
  import { AlertCircle as AlertCircle3, CheckCircle as CheckCircle2, Clock as Clock6, MapPin as MapPin6, Navigation as Navigation2, Users as Users2 } from "lucide-react";
3216
- import { useState as useState8 } from "react";
3123
+ import { useState as useState7 } from "react";
3217
3124
  import { jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
3218
3125
  var getModificationIcon = (type) => {
3219
3126
  switch (type) {
@@ -3276,7 +3183,7 @@ var formatModificationDetail = (mod) => {
3276
3183
  };
3277
3184
  function ResolutionModificationsCard({ card }) {
3278
3185
  const data = card.payload || card.data;
3279
- const [activeTab, setActiveTab] = useState8("modified");
3186
+ const [activeTab, setActiveTab] = useState7("modified");
3280
3187
  if (!data || !Array.isArray(data)) {
3281
3188
  return /* @__PURE__ */ jsx19("div", { className: "w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4", children: /* @__PURE__ */ jsx19("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6570\u636E\u683C\u5F0F\u65E0\u6548" }) });
3282
3189
  }
@@ -3744,7 +3651,7 @@ import {
3744
3651
  Target as Target4,
3745
3652
  Zap as Zap2
3746
3653
  } from "lucide-react";
3747
- import { memo as memo4, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo7, useState as useState9 } from "react";
3654
+ import { memo as memo4, useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo7, useState as useState8 } from "react";
3748
3655
  import { jsx as jsx23, jsxs as jsxs23 } from "react/jsx-runtime";
3749
3656
  var eventStyles = {
3750
3657
  start: { Icon: Rocket, color: "#0284c7", bg: "bg-sky-950" },
@@ -3773,18 +3680,18 @@ var SimulationEventControlPanel = memo4(function SimulationEventControlPanel2({
3773
3680
  cardId,
3774
3681
  card
3775
3682
  }) {
3776
- const [showLog, setShowLogInternal] = useState9(() => showLogState.get(cardId) || false);
3777
- const setShowLog = useCallback4(
3683
+ const [showLog, setShowLogInternal] = useState8(() => showLogState.get(cardId) || false);
3684
+ const setShowLog = useCallback3(
3778
3685
  (value) => {
3779
3686
  showLogState.set(cardId, value);
3780
3687
  setShowLogInternal(value);
3781
3688
  },
3782
3689
  [cardId]
3783
3690
  );
3784
- const toggleShowLog = useCallback4(() => {
3691
+ const toggleShowLog = useCallback3(() => {
3785
3692
  setShowLog(!showLog);
3786
3693
  }, [showLog, setShowLog]);
3787
- const handleDownload = useCallback4(() => {
3694
+ const handleDownload = useCallback3(() => {
3788
3695
  try {
3789
3696
  const jsonContent = JSON.stringify(card, null, 2);
3790
3697
  const blob = new Blob([jsonContent], { type: "application/json" });
@@ -3834,8 +3741,8 @@ var SimulationEventControlPanel = memo4(function SimulationEventControlPanel2({
3834
3741
  function SimulationEventCardComponent({ card }) {
3835
3742
  const payload = card.payload;
3836
3743
  const title = card.title || "\u4EFF\u771F\u4E8B\u4EF6\u65F6\u95F4\u7EBF";
3837
- const [currentTime, setCurrentTime] = useState9(0);
3838
- const [isPlaying, setIsPlaying] = useState9(false);
3744
+ const [currentTime, setCurrentTime] = useState8(0);
3745
+ const [isPlaying, setIsPlaying] = useState8(false);
3839
3746
  const cardId = useMemo7(() => {
3840
3747
  return `simulation-event-card-${card.id || payload?.simulationId || "default"}`;
3841
3748
  }, [card.id, payload?.simulationId]);
@@ -3844,10 +3751,10 @@ function SimulationEventCardComponent({ card }) {
3844
3751
  const simulationTime = payload?.simulationTime || "\u672A\u77E5\u65F6\u95F4";
3845
3752
  const duration = payload?.duration || 0;
3846
3753
  const events = useMemo7(() => payload?.events || [], [payload?.events]);
3847
- const togglePlayback = useCallback4(() => {
3754
+ const togglePlayback = useCallback3(() => {
3848
3755
  setIsPlaying((prev) => !prev);
3849
3756
  }, []);
3850
- useEffect3(() => {
3757
+ useEffect2(() => {
3851
3758
  if (!isPlaying) return;
3852
3759
  const interval = setInterval(() => {
3853
3760
  setCurrentTime((prev) => {
@@ -4002,7 +3909,7 @@ function SimulationEventCardComponent({ card }) {
4002
3909
  var SimulationEventCard = memo4(SimulationEventCardComponent);
4003
3910
 
4004
3911
  // src/react/components/card/cards/survival-effect-card.tsx
4005
- import { memo as memo5, useCallback as useCallback5, useMemo as useMemo8 } from "react";
3912
+ import { memo as memo5, useCallback as useCallback4, useMemo as useMemo8 } from "react";
4006
3913
  import { jsx as jsx24, jsxs as jsxs24 } from "react/jsx-runtime";
4007
3914
  var planColors = {
4008
3915
  \u7A33\u5065\u578B: { primary: "#0284c7", bg: "bg-sky-600", light: "bg-sky-900" },
@@ -4020,10 +3927,10 @@ var SurvivalEffectControlPanel = memo5(function SurvivalEffectControlPanel2({
4020
3927
  card
4021
3928
  }) {
4022
3929
  const [showLog, setShowLog] = useCardState(`${cardId}-showLog`, false);
4023
- const toggleShowLog = useCallback5(() => {
3930
+ const toggleShowLog = useCallback4(() => {
4024
3931
  setShowLog(!showLog);
4025
3932
  }, [showLog, setShowLog]);
4026
- const handleDownload = useCallback5(() => {
3933
+ const handleDownload = useCallback4(() => {
4027
3934
  try {
4028
3935
  const jsonContent = JSON.stringify(card, null, 2);
4029
3936
  const blob = new Blob([jsonContent], { type: "application/json" });