@locusgraph/loop 0.3.0 → 0.4.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.
Files changed (130) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +70 -17
  3. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  4. package/dist/agent/pulse/marks/glyph-mark.js +57 -16
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -13
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  7. package/dist/agent/pulse/pulse.js +1 -1
  8. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  9. package/dist/agent/pulse/use-loop-animation.js +36 -15
  10. package/dist/agent/steps/step-icon.js +20 -13
  11. package/dist/agent/steps/steps.js +39 -37
  12. package/dist/agent/thinking/thinking.js +65 -62
  13. package/dist/agent/tool/json-block.js +10 -7
  14. package/dist/agent/tool/tool-status.d.ts +2 -0
  15. package/dist/agent/tool/tool-status.js +16 -13
  16. package/dist/agent/tool/tool.d.ts +8 -1
  17. package/dist/agent/tool/tool.js +238 -119
  18. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  19. package/dist/approval/inbox/inbox-row.js +248 -86
  20. package/dist/approval/inbox/inbox.d.ts +3 -3
  21. package/dist/approval/inbox/inbox.js +251 -57
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  23. package/dist/approval/inbox/virtual-inbox-list.js +107 -30
  24. package/dist/approval/memory/memory-review.js +228 -91
  25. package/dist/approval/memory/memory-row.js +192 -56
  26. package/dist/approval/plan/plan-review.js +241 -108
  27. package/dist/approval/plan/plan-step-row.js +184 -77
  28. package/dist/approval/plan/plan-steps.d.ts +1 -1
  29. package/dist/approval/plan/plan-steps.js +2 -2
  30. package/dist/approval/plan/question-choices.js +139 -48
  31. package/dist/approval/plan/question.js +189 -67
  32. package/dist/approval/run/run-bar.js +138 -49
  33. package/dist/approval/shared/approval-line.d.ts +27 -0
  34. package/dist/approval/shared/approval-line.js +85 -0
  35. package/dist/approval/shared/risk-badge.d.ts +3 -5
  36. package/dist/approval/shared/risk-badge.js +11 -19
  37. package/dist/approval/shared/time.d.ts +0 -1
  38. package/dist/approval/shared/time.js +0 -1
  39. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  40. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  41. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  42. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  43. package/dist/approval/spend/raise-cap-form.js +235 -52
  44. package/dist/approval/spend/spend-gate.js +200 -106
  45. package/dist/approval/spend/spend-math.d.ts +1 -0
  46. package/dist/approval/spend/spend-math.js +5 -2
  47. package/dist/approval/spend/spend-meter.js +5 -5
  48. package/dist/approval/tool/approval.js +157 -96
  49. package/dist/approval/tool/args/args-editor.js +232 -81
  50. package/dist/approval/tool/args/args-field.js +333 -60
  51. package/dist/approval/tool/deny-form.js +114 -32
  52. package/dist/approval/tool/tool-inputs.js +93 -33
  53. package/dist/chat/chat/chat.js +5 -4
  54. package/dist/chat/chat/use-stick-to-bottom.js +116 -63
  55. package/dist/chat/chat/virtual-chat-items.js +129 -34
  56. package/dist/chat/composer/composer-actions.d.ts +1 -2
  57. package/dist/chat/composer/composer-actions.js +136 -50
  58. package/dist/chat/composer/composer-status.d.ts +2 -0
  59. package/dist/chat/composer/composer-status.js +3 -0
  60. package/dist/chat/composer/composer.d.ts +1 -1
  61. package/dist/chat/composer/composer.js +6 -4
  62. package/dist/chat/composer/use-auto-grow.js +29 -8
  63. package/dist/chat/files/files.js +296 -67
  64. package/dist/chat/index.d.ts +1 -1
  65. package/dist/chat/index.js +1 -1
  66. package/dist/chat/reply/fenced-code.js +1 -1
  67. package/dist/chat/reply/markdown-components.js +9 -116
  68. package/dist/chat/reply/reply.js +2 -2
  69. package/dist/chat/turn/group-parts.d.ts +1 -0
  70. package/dist/chat/turn/group-parts.js +6 -3
  71. package/dist/chat/turn/turn.js +13 -4
  72. package/dist/cost/context.js +3 -3
  73. package/dist/cost/cost-steps.js +31 -30
  74. package/dist/cost/cost.js +39 -39
  75. package/dist/cost/model-picker.js +176 -43
  76. package/dist/cost/shared/context-breakdown.js +10 -11
  77. package/dist/cost/shared/model-option-row.js +4 -3
  78. package/dist/cost/shared/step-cost-row.js +11 -12
  79. package/dist/cost/shared/usage-totals.d.ts +1 -0
  80. package/dist/cost/shared/usage-totals.js +19 -1
  81. package/dist/memory/cite.js +190 -59
  82. package/dist/memory/memorized.js +231 -62
  83. package/dist/memory/recall.js +272 -85
  84. package/dist/memory/shared/host-label.d.ts +1 -1
  85. package/dist/memory/shared/host-label.js +2 -2
  86. package/dist/memory/shared/source-mark.js +1 -1
  87. package/dist/memory/sources.d.ts +2 -1
  88. package/dist/memory/sources.js +277 -62
  89. package/dist/shared/decision-summary.js +2 -1
  90. package/dist/shared/line.d.ts +10 -0
  91. package/dist/shared/line.js +11 -0
  92. package/dist/shared/live-status.d.ts +3 -0
  93. package/dist/shared/live-status.js +11 -0
  94. package/dist/shared/reduced-motion.d.ts +1 -0
  95. package/dist/shared/reduced-motion.js +3 -0
  96. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  97. package/dist/thread/actions/action-button.js +1 -1
  98. package/dist/thread/actions/actions.d.ts +3 -1
  99. package/dist/thread/actions/actions.js +100 -81
  100. package/dist/thread/actions/branch-switcher.js +129 -23
  101. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  102. package/dist/thread/canvas/canvas-meta.js +35 -0
  103. package/dist/thread/canvas/canvas.d.ts +1 -1
  104. package/dist/thread/canvas/canvas.js +64 -74
  105. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  106. package/dist/thread/canvas/version-switcher.js +161 -45
  107. package/dist/thread/code/code.js +4 -6
  108. package/dist/thread/code/copy-code-button.d.ts +2 -1
  109. package/dist/thread/code/copy-code-button.js +91 -26
  110. package/dist/thread/history/history.d.ts +1 -1
  111. package/dist/thread/history/history.js +104 -104
  112. package/dist/thread/history/row/history-row.js +106 -22
  113. package/dist/thread/history/row/thread-item-menu.js +84 -20
  114. package/dist/thread/history/row/thread-title-editor.js +74 -29
  115. package/dist/thread/history/virtual-history-list.js +83 -46
  116. package/dist/thread/index.d.ts +1 -0
  117. package/dist/thread/index.js +1 -0
  118. package/dist/thread/starters/starters.js +91 -28
  119. package/dist/thread/use-copied.js +40 -10
  120. package/package.json +6 -6
  121. package/dist/agent/shared/status-dot.d.ts +0 -1
  122. package/dist/agent/shared/status-dot.js +0 -1
  123. package/dist/approval/shared/decision-line.d.ts +0 -1
  124. package/dist/approval/shared/decision-line.js +0 -1
  125. package/dist/memory/shared/disclosure.d.ts +0 -6
  126. package/dist/memory/shared/disclosure.js +0 -6
  127. package/dist/shared/panel.d.ts +0 -19
  128. package/dist/shared/panel.js +0 -77
  129. package/dist/shared/status-dot.d.ts +0 -6
  130. package/dist/shared/status-dot.js +0 -20
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { Idea as BrainIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
5
4
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
5
+ import { Lightbulb as BrainIcon, CaretRight as ChevronRightIcon } from "@phosphor-icons/react/ssr";
6
6
  import { useEffect, useRef, useState } from "react";
7
+ import { lineChevronClass, lineDetailClass, lineIconClass, lineTriggerClass } from "../../shared/line.js";
7
8
  import { firstLineOf, thoughtDurationLabel } from "./thought-duration.js";
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  function useThinkingOpen(streaming, defaultOpen) {
@@ -58,7 +59,7 @@ function useThinkingOpen(streaming, defaultOpen) {
58
59
  return t3;
59
60
  }
60
61
  export function Thinking(t0) {
61
- const $ = _c(34);
62
+ const $ = _c(30);
62
63
  const {
63
64
  text,
64
65
  state,
@@ -80,7 +81,7 @@ export function Thinking(t0) {
80
81
  const t2 = streaming ? "streaming" : "done";
81
82
  let t3;
82
83
  if ($[2] !== className) {
83
- t3 = cn("flex min-w-0 flex-col gap-2 text-sm text-muted-foreground", className);
84
+ t3 = cn("flex min-w-0 flex-col", className);
84
85
  $[2] = className;
85
86
  $[3] = t3;
86
87
  } else {
@@ -88,9 +89,13 @@ export function Thinking(t0) {
88
89
  }
89
90
  let t4;
90
91
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
91
- t4 = /*#__PURE__*/_jsx(BrainIcon, {
92
- className: "size-3.5 shrink-0",
93
- "aria-hidden": true
92
+ t4 = /*#__PURE__*/_jsx("span", {
93
+ "aria-hidden": true,
94
+ className: lineIconClass,
95
+ children: /*#__PURE__*/_jsx(BrainIcon, {
96
+ weight: "bold",
97
+ "aria-hidden": true
98
+ })
94
99
  });
95
100
  $[4] = t4;
96
101
  } else {
@@ -99,7 +104,7 @@ export function Thinking(t0) {
99
104
  const t5 = streaming && "motion-safe:locus-shimmer";
100
105
  let t6;
101
106
  if ($[5] !== t5) {
102
- t6 = cn(t5);
107
+ t6 = cn("shrink-0", t5);
103
108
  $[5] = t5;
104
109
  $[6] = t6;
105
110
  } else {
@@ -127,85 +132,83 @@ export function Thinking(t0) {
127
132
  } else {
128
133
  t8 = $[12];
129
134
  }
130
- const t9 = open && "rotate-90";
135
+ let t9;
136
+ if ($[13] !== open || $[14] !== summary) {
137
+ t9 = !open && summary && /*#__PURE__*/_jsxs("span", {
138
+ "data-slot": "thinking-summary",
139
+ className: "min-w-0 truncate text-faint",
140
+ children: [/*#__PURE__*/_jsx("span", {
141
+ className: "sr-only",
142
+ children: ": "
143
+ }), summary]
144
+ });
145
+ $[13] = open;
146
+ $[14] = summary;
147
+ $[15] = t9;
148
+ } else {
149
+ t9 = $[15];
150
+ }
131
151
  let t10;
132
- if ($[13] !== t9) {
133
- t10 = cn("size-3.5 shrink-0 opacity-70 motion-safe:transition-transform", t9);
134
- $[13] = t9;
135
- $[14] = t10;
152
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
153
+ t10 = /*#__PURE__*/_jsx(ChevronRightIcon, {
154
+ weight: "bold",
155
+ "aria-hidden": true,
156
+ className: lineChevronClass
157
+ });
158
+ $[16] = t10;
136
159
  } else {
137
- t10 = $[14];
160
+ t10 = $[16];
138
161
  }
139
162
  let t11;
140
- if ($[15] !== t10) {
141
- t11 = /*#__PURE__*/_jsx(ChevronRightIcon, {
142
- "aria-hidden": true,
143
- className: t10
163
+ if ($[17] !== t8 || $[18] !== t9) {
164
+ t11 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
165
+ className: lineTriggerClass,
166
+ children: [t4, t8, t9, t10]
144
167
  });
145
- $[15] = t10;
146
- $[16] = t11;
168
+ $[17] = t8;
169
+ $[18] = t9;
170
+ $[19] = t11;
147
171
  } else {
148
- t11 = $[16];
172
+ t11 = $[19];
149
173
  }
150
174
  let t12;
151
- if ($[17] !== open || $[18] !== t11 || $[19] !== t8) {
152
- t12 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
153
- "aria-expanded": open,
154
- className: "group locus-eyebrow flex w-fit items-center gap-2 py-1 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",
155
- children: [t4, t8, t11]
156
- });
157
- $[17] = open;
158
- $[18] = t11;
159
- $[19] = t8;
175
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
176
+ t12 = cn(lineDetailClass, "pb-2 leading-relaxed whitespace-pre-wrap text-muted-foreground");
160
177
  $[20] = t12;
161
178
  } else {
162
179
  t12 = $[20];
163
180
  }
164
181
  let t13;
165
- if ($[21] !== open || $[22] !== summary) {
166
- t13 = !open && summary && /*#__PURE__*/_jsx("p", {
167
- "data-slot": "thinking-summary",
168
- className: "ml-[6.5px] truncate border-l border-border pl-4 text-muted-foreground/80",
169
- children: summary
170
- });
171
- $[21] = open;
172
- $[22] = summary;
173
- $[23] = t13;
174
- } else {
175
- t13 = $[23];
176
- }
177
- let t14;
178
- if ($[24] !== text) {
179
- t14 = /*#__PURE__*/_jsx(CollapsibleContent, {
182
+ if ($[21] !== text) {
183
+ t13 = /*#__PURE__*/_jsx(CollapsibleContent, {
180
184
  "data-slot": "thinking-content",
181
- className: "ml-[6.5px] border-l border-border pl-4 leading-relaxed whitespace-pre-wrap",
185
+ className: t12,
182
186
  children: text
183
187
  });
184
- $[24] = text;
185
- $[25] = t14;
188
+ $[21] = text;
189
+ $[22] = t13;
186
190
  } else {
187
- t14 = $[25];
191
+ t13 = $[22];
188
192
  }
189
- let t15;
190
- if ($[26] !== open || $[27] !== setOpen || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t2 || $[32] !== t3) {
191
- t15 = /*#__PURE__*/_jsxs(Collapsible, {
193
+ let t14;
194
+ if ($[23] !== open || $[24] !== setOpen || $[25] !== t11 || $[26] !== t13 || $[27] !== t2 || $[28] !== t3) {
195
+ t14 = /*#__PURE__*/_jsxs(Collapsible, {
192
196
  "data-slot": "thinking",
193
197
  "data-state": t2,
194
198
  open: open,
195
199
  onOpenChange: setOpen,
196
200
  className: t3,
197
- children: [t12, t13, t14]
201
+ children: [t11, t13]
198
202
  });
199
- $[26] = open;
200
- $[27] = setOpen;
201
- $[28] = t12;
202
- $[29] = t13;
203
- $[30] = t14;
204
- $[31] = t2;
205
- $[32] = t3;
206
- $[33] = t15;
203
+ $[23] = open;
204
+ $[24] = setOpen;
205
+ $[25] = t11;
206
+ $[26] = t13;
207
+ $[27] = t2;
208
+ $[28] = t3;
209
+ $[29] = t14;
207
210
  } else {
208
- t15 = $[33];
211
+ t14 = $[29];
209
212
  }
210
- return t15;
213
+ return t14;
211
214
  }
@@ -1,5 +1,4 @@
1
- import { Code } from "../../thread/code/code.js";
2
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  export function prettyJson(value) {
4
3
  if (typeof value === "string") return value;
5
4
  try {
@@ -12,11 +11,15 @@ export function JsonBlock({
12
11
  label,
13
12
  value
14
13
  }) {
15
- return /*#__PURE__*/_jsx(Code, {
14
+ return /*#__PURE__*/_jsxs("div", {
16
15
  "data-slot": "tool-json",
17
- code: prettyJson(value),
18
- language: "json",
19
- filename: label,
20
- className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto"
16
+ className: "flex min-w-0 flex-col gap-1",
17
+ children: [/*#__PURE__*/_jsx("span", {
18
+ className: "text-xs text-faint",
19
+ children: label
20
+ }), /*#__PURE__*/_jsx("pre", {
21
+ className: "max-h-72 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground",
22
+ children: prettyJson(value)
23
+ })]
21
24
  });
22
25
  }
@@ -1,6 +1,8 @@
1
1
  import type { ToolState } from "../../types.js";
2
2
  export declare const toolStateLabels: Record<ToolState, string>;
3
3
  export declare function isToolBusy(state: ToolState): state is "input-available" | "input-streaming";
4
+ export declare function showsStateWord(state: ToolState): boolean;
5
+ export declare function humanToolName(name: string): string;
4
6
  export declare function ToolStatus({ state }: {
5
7
  state: ToolState;
6
8
  }): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- import { StatusDot } from "../../shared/status-dot.js";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  export const toolStateLabels = {
4
3
  "input-streaming": "Preparing",
@@ -9,28 +8,32 @@ export const toolStateLabels = {
9
8
  "output-error": "Failed",
10
9
  "output-denied": "Denied"
11
10
  };
12
- const toolStateTones = {
13
- "input-streaming": "waiting",
14
- "input-available": "waiting",
15
- "approval-requested": "waiting",
16
- "approval-responded": "done",
17
- "output-available": "done",
18
- "output-error": "danger",
19
- "output-denied": "idle"
11
+ const visibleStateWordClasses = {
12
+ "approval-requested": "font-medium text-warn",
13
+ "output-error": "font-medium text-destructive",
14
+ "output-denied": "font-medium text-muted-foreground"
20
15
  };
21
16
  export function isToolBusy(state) {
22
17
  return state === "input-streaming" || state === "input-available";
23
18
  }
19
+ export function showsStateWord(state) {
20
+ return state in visibleStateWordClasses;
21
+ }
22
+ export function humanToolName(name) {
23
+ return name.replace(/[._-]+/g, " ").trim();
24
+ }
24
25
  export function ToolStatus({
25
26
  state
26
27
  }) {
28
+ const visibleClass = visibleStateWordClasses[state];
27
29
  return /*#__PURE__*/_jsxs("span", {
28
30
  "data-slot": "tool-status",
29
31
  "data-state": state,
30
32
  "aria-live": "polite",
31
- className: "locus-eyebrow flex shrink-0 items-center gap-1.5",
32
- children: [/*#__PURE__*/_jsx(StatusDot, {
33
- tone: toolStateTones[state]
34
- }), toolStateLabels[state]]
33
+ className: visibleClass ?? "sr-only",
34
+ children: [toolStateLabels[state], /*#__PURE__*/_jsx("span", {
35
+ className: "sr-only",
36
+ children: ": "
37
+ })]
35
38
  });
36
39
  }
@@ -1,7 +1,14 @@
1
+ import { type ReactNode } from "react";
1
2
  import { type ToolPart } from "../../types.js";
3
+ export type ToolTone = "default" | "memory";
2
4
  export type ToolProps = {
3
5
  part: ToolPart;
6
+ tone?: ToolTone;
7
+ verb?: string;
8
+ activeVerb?: string;
9
+ target?: ReactNode;
10
+ icon?: ReactNode;
4
11
  defaultOpen?: boolean;
5
12
  className?: string;
6
13
  };
7
- export declare function Tool({ part, defaultOpen, className }: ToolProps): import("react").JSX.Element;
14
+ export declare function Tool({ part, tone, verb, activeVerb, target, icon, defaultOpen, className, }: ToolProps): import("react").JSX.Element;