@locusgraph/loop 0.1.0 → 0.2.1

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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +36 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +24 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +17 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +20 -1
  8. package/dist/agent/pulse/pulse.js +63 -35
  9. package/dist/agent/pulse/use-loop-animation.js +14 -16
  10. package/dist/agent/steps/step-icon.js +40 -24
  11. package/dist/agent/steps/steps.js +72 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +18 -11
  15. package/dist/agent/tool/tool-status.js +28 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +96 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +99 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +53 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +108 -17
  26. package/dist/approval/memory/memory-row.js +80 -19
  27. package/dist/approval/plan/plan-review.js +129 -28
  28. package/dist/approval/plan/plan-step-row.js +91 -44
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +73 -40
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +108 -27
  33. package/dist/approval/run/run-bar.js +94 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +32 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +7 -6
  38. package/dist/approval/spend/raise-cap-form.js +64 -19
  39. package/dist/approval/spend/spend-gate.js +124 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +136 -35
  42. package/dist/approval/tool/approval.js +113 -27
  43. package/dist/approval/tool/args/args-editor.js +104 -26
  44. package/dist/approval/tool/args/args-field.js +79 -22
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +43 -10
  47. package/dist/approval/tool/tool-inputs.js +62 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +71 -48
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +60 -0
  55. package/dist/chat/composer/composer-actions.js +69 -17
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +9 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +92 -29
  60. package/dist/chat/reply/fenced-code.js +23 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +30 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +87 -30
  65. package/dist/cost/context.js +104 -23
  66. package/dist/cost/cost-steps.js +67 -14
  67. package/dist/cost/cost.js +128 -23
  68. package/dist/cost/model-picker.js +51 -6
  69. package/dist/cost/shared/context-breakdown.js +83 -10
  70. package/dist/cost/shared/meter-marks.js +49 -9
  71. package/dist/cost/shared/model-option-row.js +56 -22
  72. package/dist/cost/shared/step-cost-row.js +65 -22
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +62 -12
  75. package/dist/memory/memorized.js +65 -11
  76. package/dist/memory/recall.js +101 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +11 -3
  79. package/dist/memory/sources.js +78 -14
  80. package/dist/shared/decision-summary.js +51 -14
  81. package/dist/shared/panel-empty.js +20 -3
  82. package/dist/shared/panel.js +69 -13
  83. package/dist/shared/status-dot.js +16 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +22 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +28 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +54 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +30 -14
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +58 -0
  100. package/dist/thread/history/row/thread-item-menu.js +31 -0
  101. package/dist/thread/history/row/thread-title-editor.js +38 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +71 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +33 -8
  108. package/dist/thread/use-copied.js +18 -16
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusgraph/loop",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
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.0",
32
+ "@locusgraph/components": "^0.2.2",
33
33
  "react": "^19.2.0",
34
34
  "react-dom": "^19.2.0"
35
35
  },
@@ -37,23 +37,25 @@
37
37
  "@carbon/icons-react": "11.89.0",
38
38
  "@locusgraph/brand": "0.2.0",
39
39
  "@locusgraph/utils": "0.1.1",
40
+ "@tanstack/react-virtual": "3.14.13",
40
41
  "react-markdown": "^10.1.0",
41
42
  "remark-gfm": "^4.0.1",
42
43
  "shiki": "^4.5.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@locusgraph/components": "0.2.0",
46
+ "@locusgraph/components": "0.2.2",
46
47
  "@locusgraph/config": "0.1.1",
47
48
  "@types/node": "^22.0.0",
48
49
  "@types/react": "^19.2.0",
49
50
  "@types/react-dom": "^19.2.0",
51
+ "happy-dom": "20.14.5",
50
52
  "react": "19.2.8",
51
53
  "react-dom": "19.2.8",
52
54
  "typescript": "^7.0.2",
53
55
  "vitest": "^5.0.3"
54
56
  },
55
57
  "scripts": {
56
- "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/sources.css dist/sources.css && node ../../scripts/esm-extensions.mjs dist",
58
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/sources.css dist/sources.css && node ../../scripts/react-compiler.mjs dist && node ../../scripts/esm-extensions.mjs dist",
57
59
  "typecheck": "tsc -p tsconfig.json --noEmit",
58
60
  "test": "vitest run"
59
61
  }
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "@locusgraph/components";
3
- import { useState } from "react";
4
- import { formatTimeOfDay } from "./thread-groups.js";
5
- import { ThreadItemMenu } from "./thread-item-menu.js";
6
- import { ThreadTitleEditor } from "./thread-title-editor.js";
7
- const timeHiddenByMenuClass = "max-sm:hidden sm:group-focus-within:invisible sm:group-hover:invisible sm:group-has-[[data-state=open]]:invisible";
8
- export function HistoryRow({ thread, active, onSelect, onRename, onArchive }) {
9
- const [editing, setEditing] = useState(false);
10
- const hasMenu = onRename !== undefined || onArchive !== undefined;
11
- return (_jsxs("li", { "data-slot": "history-item", "data-active": active || undefined, className: cn("group relative flex items-center motion-safe:transition-colors", active
12
- ? "bg-accent text-accent-foreground before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-foreground"
13
- : "text-foreground/85 hover:bg-accent/40"), children: [editing && onRename ? (_jsx("div", { className: "flex-1 px-1 py-0.5", children: _jsx(ThreadTitleEditor, { title: thread.title, onCommit: (title) => {
14
- onRename(thread.id, title);
15
- setEditing(false);
16
- }, onCancel: () => setEditing(false) }) })) : (_jsxs("button", { type: "button", "aria-current": active ? "page" : undefined, onClick: () => onSelect(thread.id), onDoubleClick: onRename ? () => setEditing(true) : undefined, className: cn("flex min-w-0 flex-1 items-center gap-3 py-1.5 pl-2 text-left text-sm outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring", hasMenu ? "pr-8 sm:pr-2" : "pr-2", active && "font-medium"), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: thread.title }), _jsx("time", { dateTime: thread.updatedAt, suppressHydrationWarning: true, className: cn("shrink-0 font-mono text-[11px] font-normal text-muted-foreground tabular-nums", hasMenu && timeHiddenByMenuClass), children: formatTimeOfDay(thread.updatedAt) })] })), hasMenu && !editing && (_jsx("div", { className: "absolute top-1/2 right-1 -translate-y-1/2", children: _jsx(ThreadItemMenu, { title: thread.title, onRename: onRename ? () => setEditing(true) : undefined, onArchive: onArchive ? () => onArchive(thread.id) : undefined }) }))] }));
17
- }
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Archive as ArchiveIcon, OverflowMenuHorizontal as EllipsisIcon, Edit as PencilIcon, } from "@carbon/icons-react";
3
- import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@locusgraph/components";
4
- export function ThreadItemMenu({ title, onRename, onArchive }) {
5
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": `Options for ${title}`, className: "shrink-0 text-muted-foreground sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100 sm:data-[state=open]:opacity-100", children: _jsx(EllipsisIcon, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [onRename && (_jsxs(DropdownMenuItem, { onSelect: onRename, children: [_jsx(PencilIcon, {}), "Rename"] })), onArchive && (_jsxs(DropdownMenuItem, { onSelect: onArchive, children: [_jsx(ArchiveIcon, {}), "Archive"] }))] })] }));
6
- }
@@ -1,25 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Input } from "@locusgraph/components";
3
- import { useState } from "react";
4
- export function ThreadTitleEditor({ title, onCommit, onCancel }) {
5
- const [draft, setDraft] = useState(title);
6
- const commit = () => {
7
- const trimmed = draft.trim();
8
- if (trimmed && trimmed !== title) {
9
- onCommit(trimmed);
10
- }
11
- else {
12
- onCancel();
13
- }
14
- };
15
- return (_jsx(Input, { "data-slot": "thread-title-editor", "aria-label": "Chat title", autoFocus: true, value: draft, className: "h-7 text-sm", onChange: (event) => setDraft(event.target.value), onFocus: (event) => event.target.select(), onBlur: commit, onKeyDown: (event) => {
16
- if (event.key === "Enter") {
17
- event.preventDefault();
18
- commit();
19
- }
20
- if (event.key === "Escape") {
21
- event.preventDefault();
22
- onCancel();
23
- }
24
- } }));
25
- }