@locusgraph/loop 0.2.0 → 0.3.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 (75) hide show
  1. package/dist/agent/pulse/gradient-label.js +12 -62
  2. package/dist/agent/pulse/marks/bars-mark.js +15 -37
  3. package/dist/agent/pulse/marks/glyph-mark.js +15 -54
  4. package/dist/agent/pulse/marks/locus-mark.js +12 -36
  5. package/dist/agent/pulse/marks/orb-mark.js +9 -19
  6. package/dist/agent/pulse/marks/spinner-mark.js +20 -29
  7. package/dist/agent/pulse/pulse.js +36 -123
  8. package/dist/agent/pulse/use-loop-animation.js +12 -33
  9. package/dist/agent/steps/step-icon.js +26 -96
  10. package/dist/agent/steps/steps.js +47 -210
  11. package/dist/agent/thinking/thinking.js +2 -2
  12. package/dist/agent/tool/json-block.js +11 -31
  13. package/dist/agent/tool/tool-status.js +12 -35
  14. package/dist/approval/inbox/inbox-row.js +76 -301
  15. package/dist/approval/inbox/inbox.js +39 -190
  16. package/dist/approval/inbox/virtual-inbox-list.js +26 -102
  17. package/dist/approval/memory/memory-review.js +36 -170
  18. package/dist/approval/memory/memory-row.js +50 -185
  19. package/dist/approval/plan/plan-review.js +73 -223
  20. package/dist/approval/plan/plan-step-row.js +76 -180
  21. package/dist/approval/plan/question-choices.js +44 -130
  22. package/dist/approval/plan/question.js +38 -154
  23. package/dist/approval/run/run-bar.js +39 -123
  24. package/dist/approval/shared/risk-badge.js +9 -24
  25. package/dist/approval/shared/use-focus-on-mount.js +5 -21
  26. package/dist/approval/spend/raise-cap-form.js +48 -221
  27. package/dist/approval/spend/spend-gate.js +40 -155
  28. package/dist/approval/spend/spend-meter.js +86 -313
  29. package/dist/approval/tool/approval.js +35 -194
  30. package/dist/approval/tool/args/args-editor.js +46 -204
  31. package/dist/approval/tool/args/args-field.js +55 -238
  32. package/dist/approval/tool/deny-form.js +36 -123
  33. package/dist/approval/tool/tool-inputs.js +24 -89
  34. package/dist/chat/chat/use-stick-to-bottom.js +60 -113
  35. package/dist/chat/chat/virtual-chat-items.js +34 -127
  36. package/dist/chat/composer/composer-actions.js +46 -129
  37. package/dist/chat/composer/use-auto-grow.js +8 -23
  38. package/dist/chat/files/files.js +66 -291
  39. package/dist/chat/reply/fenced-code.js +10 -32
  40. package/dist/chat/reply/markdown-components.js +2 -2
  41. package/dist/chat/reply/reply.js +24 -99
  42. package/dist/chat/turn/turn.js +46 -197
  43. package/dist/cost/context.js +65 -282
  44. package/dist/cost/cost-steps.js +42 -195
  45. package/dist/cost/cost.js +108 -497
  46. package/dist/cost/model-picker.js +42 -172
  47. package/dist/cost/shared/context-breakdown.js +65 -281
  48. package/dist/cost/shared/meter-marks.js +34 -92
  49. package/dist/cost/shared/model-option-row.js +35 -158
  50. package/dist/cost/shared/step-cost-row.js +37 -222
  51. package/dist/memory/cite.js +58 -179
  52. package/dist/memory/memorized.js +43 -195
  53. package/dist/memory/recall.js +68 -263
  54. package/dist/memory/shared/disclosure.d.ts +2 -2
  55. package/dist/memory/shared/disclosure.js +1 -1
  56. package/dist/memory/shared/source-mark.js +10 -38
  57. package/dist/memory/sources.js +52 -230
  58. package/dist/shared/decision-summary.js +35 -117
  59. package/dist/shared/panel-empty.js +15 -73
  60. package/dist/shared/panel.js +65 -239
  61. package/dist/shared/status-dot.js +10 -32
  62. package/dist/thread/actions/action-button.js +10 -53
  63. package/dist/thread/actions/branch-switcher.js +21 -95
  64. package/dist/thread/canvas/canvas.js +1 -1
  65. package/dist/thread/canvas/version-switcher.js +31 -126
  66. package/dist/thread/code/code.js +2 -2
  67. package/dist/thread/code/copy-code-button.js +24 -56
  68. package/dist/thread/history/history.js +1 -1
  69. package/dist/thread/history/row/history-row.js +18 -97
  70. package/dist/thread/history/row/thread-item-menu.js +19 -72
  71. package/dist/thread/history/row/thread-title-editor.js +29 -72
  72. package/dist/thread/history/virtual-history-list.js +46 -82
  73. package/dist/thread/starters/starters.js +27 -87
  74. package/dist/thread/use-copied.js +10 -38
  75. package/package.json +3 -3
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { cn } from "@locusgraph/components";
3
2
  import { useRef } from "react";
4
3
  import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
@@ -8,16 +7,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
7
  function scrollAreaViewportOf(element) {
9
8
  return element?.closest("[data-slot=scroll-area-viewport]") ?? null;
10
9
  }
11
- export function VirtualHistoryList(t0) {
12
- const $ = _c(12);
13
- const {
14
- groups,
15
- label,
16
- activeId,
17
- onSelect,
18
- onRename,
19
- onArchive
20
- } = t0;
10
+ export function VirtualHistoryList({
11
+ groups,
12
+ label,
13
+ activeId,
14
+ onSelect,
15
+ onRename,
16
+ onArchive
17
+ }) {
21
18
  const listRef = useRef(null);
22
19
  const rows = historyListRows(groups);
23
20
  const {
@@ -28,80 +25,47 @@ export function VirtualHistoryList(t0) {
28
25
  count: rows.length,
29
26
  getScrollElement: () => scrollAreaViewportOf(listRef.current),
30
27
  estimateSize: index => estimatedRowHeight(rows[index], index),
31
- getItemKey: index_0 => rows[index_0].key
28
+ getItemKey: index => rows[index].key
29
+ });
30
+ const threadRowProps = thread => ({
31
+ thread,
32
+ active: thread.id === activeId,
33
+ onSelect,
34
+ onRename,
35
+ onArchive
32
36
  });
33
- let t1;
34
- if ($[0] !== activeId || $[1] !== onArchive || $[2] !== onRename || $[3] !== onSelect) {
35
- t1 = thread => ({
36
- thread,
37
- active: thread.id === activeId,
38
- onSelect,
39
- onRename,
40
- onArchive
41
- });
42
- $[0] = activeId;
43
- $[1] = onArchive;
44
- $[2] = onRename;
45
- $[3] = onSelect;
46
- $[4] = t1;
47
- } else {
48
- t1 = $[4];
49
- }
50
- const threadRowProps = t1;
51
- const t2 = "history-list";
52
- const t3 = "relative";
53
- let t4;
54
- if ($[5] !== totalSize) {
55
- t4 = {
37
+ return /*#__PURE__*/_jsx("ul", {
38
+ ref: listRef,
39
+ "data-slot": "history-list",
40
+ "aria-label": label,
41
+ className: "relative",
42
+ style: {
56
43
  height: totalSize
57
- };
58
- $[5] = totalSize;
59
- $[6] = t4;
60
- } else {
61
- t4 = $[6];
62
- }
63
- const t5 = visibleRows.map(virtualRow => {
64
- const row = rows[virtualRow.index];
65
- if (row.kind === "group") {
66
- return /*#__PURE__*/_jsx("li", {
67
- role: "presentation",
44
+ },
45
+ children: visibleRows.map(virtualRow => {
46
+ const row = rows[virtualRow.index];
47
+ if (row.kind === "group") {
48
+ return /*#__PURE__*/_jsx("li", {
49
+ role: "presentation",
50
+ ...itemProps(virtualRow.index),
51
+ className: cn(virtualRowClassName, virtualRow.index > 0 && "pt-4"),
52
+ style: rowOffsetStyle(virtualRow.start),
53
+ children: /*#__PURE__*/_jsx("h3", {
54
+ id: `thread-group-${row.groupKey}`,
55
+ className: "locus-eyebrow px-2 pb-1",
56
+ suppressHydrationWarning: true,
57
+ children: row.label
58
+ })
59
+ }, virtualRow.key);
60
+ }
61
+ return /*#__PURE__*/_jsx(HistoryRow, {
62
+ ...threadRowProps(row.thread),
68
63
  ...itemProps(virtualRow.index),
69
- className: cn(virtualRowClassName, virtualRow.index > 0 && "pt-4"),
70
- style: rowOffsetStyle(virtualRow.start),
71
- children: /*#__PURE__*/_jsx("h3", {
72
- id: `thread-group-${row.groupKey}`,
73
- className: "eyebrow px-2 pb-1",
74
- suppressHydrationWarning: true,
75
- children: row.label
76
- })
64
+ "aria-posinset": row.position,
65
+ "aria-setsize": row.groupSize,
66
+ className: virtualRowClassName,
67
+ style: rowOffsetStyle(virtualRow.start)
77
68
  }, virtualRow.key);
78
- }
79
- return /*#__PURE__*/_jsx(HistoryRow, {
80
- ...threadRowProps(row.thread),
81
- ...itemProps(virtualRow.index),
82
- "aria-posinset": row.position,
83
- "aria-setsize": row.groupSize,
84
- className: virtualRowClassName,
85
- style: rowOffsetStyle(virtualRow.start)
86
- }, virtualRow.key);
69
+ })
87
70
  });
88
- let t6;
89
- if ($[7] !== label || $[8] !== listRef || $[9] !== t4 || $[10] !== t5) {
90
- t6 = /*#__PURE__*/_jsx("ul", {
91
- ref: listRef,
92
- "data-slot": t2,
93
- "aria-label": label,
94
- className: t3,
95
- style: t4,
96
- children: t5
97
- });
98
- $[7] = label;
99
- $[8] = listRef;
100
- $[9] = t4;
101
- $[10] = t5;
102
- $[11] = t6;
103
- } else {
104
- t6 = $[11];
105
- }
106
- return t6;
107
71
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { ArrowUpRight as ArrowUpRightIcon } from "@carbon/icons-react";
3
2
  import { cn } from "@locusgraph/components";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -8,93 +7,34 @@ function textOf(suggestion) {
8
7
  function labelOf(suggestion) {
9
8
  return typeof suggestion === "string" ? suggestion : suggestion.label ?? suggestion.text;
10
9
  }
11
- export function Starters(t0) {
12
- const $ = _c(19);
13
- let className;
14
- let onSelect;
15
- let props;
16
- let suggestions;
17
- let t1;
18
- if ($[0] !== t0) {
19
- ({
20
- suggestions,
21
- onSelect,
22
- disabled: t1,
23
- className,
24
- ...props
25
- } = t0);
26
- $[0] = t0;
27
- $[1] = className;
28
- $[2] = onSelect;
29
- $[3] = props;
30
- $[4] = suggestions;
31
- $[5] = t1;
32
- } else {
33
- className = $[1];
34
- onSelect = $[2];
35
- props = $[3];
36
- suggestions = $[4];
37
- t1 = $[5];
38
- }
39
- const disabled = t1 === undefined ? false : t1;
10
+ export function Starters({
11
+ suggestions,
12
+ onSelect,
13
+ disabled = false,
14
+ className,
15
+ ...props
16
+ }) {
40
17
  if (suggestions.length === 0) {
41
18
  return null;
42
19
  }
43
- let t2;
44
- if ($[6] !== className) {
45
- t2 = cn("flex flex-col divide-y bg-card ring-1 ring-border", className);
46
- $[6] = className;
47
- $[7] = t2;
48
- } else {
49
- t2 = $[7];
50
- }
51
- let t3;
52
- if ($[8] !== disabled || $[9] !== onSelect || $[10] !== suggestions) {
53
- let t4;
54
- if ($[12] !== disabled || $[13] !== onSelect) {
55
- t4 = suggestion => /*#__PURE__*/_jsxs("button", {
56
- type: "button",
57
- disabled: disabled,
58
- onClick: () => onSelect(textOf(suggestion)),
59
- className: "group flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm outline-none hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 motion-safe:transition-colors",
60
- children: [/*#__PURE__*/_jsx("span", {
61
- className: "min-w-0 flex-1 text-pretty",
62
- children: labelOf(suggestion)
63
- }), /*#__PURE__*/_jsx(ArrowUpRightIcon, {
64
- "aria-hidden": true,
65
- className: "size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity"
66
- })]
67
- }, textOf(suggestion));
68
- $[12] = disabled;
69
- $[13] = onSelect;
70
- $[14] = t4;
71
- } else {
72
- t4 = $[14];
73
- }
74
- t3 = suggestions.map(t4);
75
- $[8] = disabled;
76
- $[9] = onSelect;
77
- $[10] = suggestions;
78
- $[11] = t3;
79
- } else {
80
- t3 = $[11];
81
- }
82
- let t4;
83
- if ($[15] !== props || $[16] !== t2 || $[17] !== t3) {
84
- t4 = /*#__PURE__*/_jsx("div", {
85
- "data-slot": "starters",
86
- role: "group",
87
- "aria-label": "Suggested prompts",
88
- className: t2,
89
- ...props,
90
- children: t3
91
- });
92
- $[15] = props;
93
- $[16] = t2;
94
- $[17] = t3;
95
- $[18] = t4;
96
- } else {
97
- t4 = $[18];
98
- }
99
- return t4;
20
+ return /*#__PURE__*/_jsx("div", {
21
+ "data-slot": "starters",
22
+ role: "group",
23
+ "aria-label": "Suggested prompts",
24
+ className: cn("flex flex-col divide-y bg-card ring-1 ring-border", className),
25
+ ...props,
26
+ children: suggestions.map(suggestion => /*#__PURE__*/_jsxs("button", {
27
+ type: "button",
28
+ disabled: disabled,
29
+ onClick: () => onSelect(textOf(suggestion)),
30
+ className: "group flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm outline-none hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 motion-safe:transition-colors",
31
+ children: [/*#__PURE__*/_jsx("span", {
32
+ className: "min-w-0 flex-1 text-pretty",
33
+ children: labelOf(suggestion)
34
+ }), /*#__PURE__*/_jsx(ArrowUpRightIcon, {
35
+ "aria-hidden": true,
36
+ className: "size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity"
37
+ })]
38
+ }, textOf(suggestion)))
39
+ });
100
40
  }
@@ -1,46 +1,18 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { useEffect, useRef, useState } from "react";
3
2
  const copiedDurationMs = 1500;
4
3
  export function useCopied() {
5
- const $ = _c(5);
6
4
  const [copied, setCopied] = useState(false);
7
5
  const timer = useRef(undefined);
8
- let t0;
9
- let t1;
10
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
- t0 = () => () => clearTimeout(timer.current);
12
- t1 = [];
13
- $[0] = t0;
14
- $[1] = t1;
15
- } else {
16
- t0 = $[0];
17
- t1 = $[1];
18
- }
19
- useEffect(t0, t1);
20
- let t2;
21
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
22
- t2 = () => {
23
- setCopied(true);
24
- clearTimeout(timer.current);
25
- timer.current = setTimeout(() => setCopied(false), copiedDurationMs);
26
- };
27
- $[2] = t2;
28
- } else {
29
- t2 = $[2];
30
- }
31
- const markCopied = t2;
32
- let t3;
33
- if ($[3] !== copied) {
34
- t3 = {
35
- copied,
36
- markCopied
37
- };
38
- $[3] = copied;
39
- $[4] = t3;
40
- } else {
41
- t3 = $[4];
42
- }
43
- return t3;
6
+ useEffect(() => () => clearTimeout(timer.current), []);
7
+ const markCopied = () => {
8
+ setCopied(true);
9
+ clearTimeout(timer.current);
10
+ timer.current = setTimeout(() => setCopied(false), copiedDurationMs);
11
+ };
12
+ return {
13
+ copied,
14
+ markCopied
15
+ };
44
16
  }
45
17
  export async function writeToClipboard(text) {
46
18
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusgraph/loop",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Agent components for LocusGraph apps: chat, agent steps, human-in-the-loop approvals, memory and cost. Takes Vercel AI SDK UIMessage parts; never calls a model.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "provenance": true
30
30
  },
31
31
  "peerDependencies": {
32
- "@locusgraph/components": "^0.2.1",
32
+ "@locusgraph/components": "^0.3.0",
33
33
  "react": "^19.2.0",
34
34
  "react-dom": "^19.2.0"
35
35
  },
@@ -43,7 +43,7 @@
43
43
  "shiki": "^4.5.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@locusgraph/components": "0.2.1",
46
+ "@locusgraph/components": "0.3.0",
47
47
  "@locusgraph/config": "0.1.1",
48
48
  "@types/node": "^22.0.0",
49
49
  "@types/react": "^19.2.0",