@locusgraph/loop 0.6.1 → 0.7.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.
- package/dist/approval/inbox/inbox-row.js +1 -1
- package/dist/approval/log/decision-log.js +1 -1
- package/dist/approval/memory/memory-review.js +1 -1
- package/dist/approval/plan/plan-review.js +1 -1
- package/dist/approval/plan/question.js +1 -1
- package/dist/approval/shared/time.js +1 -1
- package/dist/approval/spend/spend-gate.js +1 -1
- package/dist/approval/tool/approval.js +1 -1
- package/dist/approval/tool/args/args-editor.js +1 -1
- package/dist/shared/decision/decided-time.d.ts +5 -0
- package/dist/shared/decision/decided-time.js +90 -0
- package/dist/shared/{decision-summary.d.ts → decision/decision-summary.d.ts} +3 -4
- package/dist/shared/{decision-summary.js → decision/decision-summary.js} +7 -23
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { Checkbox, cn } from "@locusgraph/components";
|
|
5
5
|
import { Lock as LockIcon } from "@phosphor-icons/react/ssr";
|
|
6
|
-
import { isoOf } from "../../shared/decision-summary.js";
|
|
6
|
+
import { isoOf } from "../../shared/decision/decision-summary.js";
|
|
7
7
|
import { riskLabels } from "../shared/risk-badge.js";
|
|
8
8
|
import { formatWaiting } from "../shared/time.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from "@locusgraph/components";
|
|
2
|
-
import { DecisionSummary, isoOf } from "../../shared/decision-summary.js";
|
|
2
|
+
import { DecisionSummary, isoOf } from "../../shared/decision/decision-summary.js";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
const kindVerbs = {
|
|
5
5
|
approval: {
|
|
@@ -5,7 +5,7 @@ import { Button, cn } from "@locusgraph/components";
|
|
|
5
5
|
import { pluralize } from "@locusgraph/utils";
|
|
6
6
|
import { Lightbulb as BrainIcon } from "@phosphor-icons/react/ssr";
|
|
7
7
|
import { useMemo, useState } from "react";
|
|
8
|
-
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
8
|
+
import { DecisionSummary } from "../../shared/decision/decision-summary.js";
|
|
9
9
|
import { lineMemoryIconClass, lineMemoryObjectClass, lineRowClass } from "../../shared/line.js";
|
|
10
10
|
import { LiveStatus } from "../../shared/live-status.js";
|
|
11
11
|
import { PendingLine } from "../shared/approval-line.js";
|
|
@@ -5,7 +5,7 @@ import { Button, cn } from "@locusgraph/components";
|
|
|
5
5
|
import { pluralize } from "@locusgraph/utils";
|
|
6
6
|
import { ArrowRight as ArrowRightIcon, ListChecks as ListChecksIcon } from "@phosphor-icons/react/ssr";
|
|
7
7
|
import { useEffect, useId, useState } from "react";
|
|
8
|
-
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
8
|
+
import { DecisionSummary } from "../../shared/decision/decision-summary.js";
|
|
9
9
|
import { LiveStatus } from "../../shared/live-status.js";
|
|
10
10
|
import { ApprovalHeadline, SettledLine } from "../shared/approval-line.js";
|
|
11
11
|
import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
|
|
@@ -4,7 +4,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { Button, cn, Input, Textarea } from "@locusgraph/components";
|
|
5
5
|
import { ArrowRight as ArrowRightIcon, Question as MessageCircleQuestionIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useId, useState } from "react";
|
|
7
|
-
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
7
|
+
import { DecisionSummary } from "../../shared/decision/decision-summary.js";
|
|
8
8
|
import { lineObjectClass } from "../../shared/line.js";
|
|
9
9
|
import { LiveStatus } from "../../shared/live-status.js";
|
|
10
10
|
import { PendingLine, SettledLine } from "../shared/approval-line.js";
|
|
@@ -4,7 +4,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { Button, cn } from "@locusgraph/components";
|
|
5
5
|
import { formatMicroUsd } from "@locusgraph/utils";
|
|
6
6
|
import { CurrencyCircleDollar as CircleDollarSignIcon } from "@phosphor-icons/react/ssr";
|
|
7
|
-
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
7
|
+
import { DecisionSummary } from "../../shared/decision/decision-summary.js";
|
|
8
8
|
import { lineObjectClass } from "../../shared/line.js";
|
|
9
9
|
import { LiveStatus } from "../../shared/live-status.js";
|
|
10
10
|
import { PendingLine, SettledLine } from "../shared/approval-line.js";
|
|
@@ -4,7 +4,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { Button, cn } from "@locusgraph/components";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { humanToolName } from "../../agent/tool/tool-status.js";
|
|
7
|
-
import { DecisionSummary } from "../../shared/decision-summary.js";
|
|
7
|
+
import { DecisionSummary } from "../../shared/decision/decision-summary.js";
|
|
8
8
|
import { LiveStatus } from "../../shared/live-status.js";
|
|
9
9
|
import { toolNameOf } from "../../types.js";
|
|
10
10
|
import { ApprovalHeadline, SettledLine } from "../shared/approval-line.js";
|
|
@@ -5,7 +5,7 @@ import { Button, cn } from "@locusgraph/components";
|
|
|
5
5
|
import { PencilSimple as SquarePenIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { humanToolName } from "../../../agent/tool/tool-status.js";
|
|
8
|
-
import { DecisionSummary } from "../../../shared/decision-summary.js";
|
|
8
|
+
import { DecisionSummary } from "../../../shared/decision/decision-summary.js";
|
|
9
9
|
import { LiveStatus } from "../../../shared/live-status.js";
|
|
10
10
|
import { ApprovalHeadline, SettledLine } from "../../shared/approval-line.js";
|
|
11
11
|
import { riskCopy } from "../../shared/risk-badge.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { useSyncExternalStore } from "react";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const utcFull = new Intl.DateTimeFormat("en-US", {
|
|
7
|
+
dateStyle: "medium",
|
|
8
|
+
timeStyle: "short",
|
|
9
|
+
timeZone: "UTC"
|
|
10
|
+
});
|
|
11
|
+
const utcClock = new Intl.DateTimeFormat("en-US", {
|
|
12
|
+
timeStyle: "short",
|
|
13
|
+
timeZone: "UTC"
|
|
14
|
+
});
|
|
15
|
+
const localFull = new Intl.DateTimeFormat("en-US", {
|
|
16
|
+
dateStyle: "medium",
|
|
17
|
+
timeStyle: "short"
|
|
18
|
+
});
|
|
19
|
+
const localClock = new Intl.DateTimeFormat("en-US", {
|
|
20
|
+
timeStyle: "short"
|
|
21
|
+
});
|
|
22
|
+
function serverText(date, style) {
|
|
23
|
+
return style === "time" ? `${utcClock.format(date)} UTC` : `${utcFull.format(date)} UTC`;
|
|
24
|
+
}
|
|
25
|
+
function viewerText(date, style) {
|
|
26
|
+
return style === "time" ? localClock.format(date) : localFull.format(date);
|
|
27
|
+
}
|
|
28
|
+
function subscribeToNothing() {
|
|
29
|
+
return () => {};
|
|
30
|
+
}
|
|
31
|
+
function useIsClient() {
|
|
32
|
+
return useSyncExternalStore(subscribeToNothing, _temp, _temp2);
|
|
33
|
+
}
|
|
34
|
+
function _temp2() {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
function _temp() {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
export function DecidedTime(t0) {
|
|
41
|
+
const $ = _c(13);
|
|
42
|
+
const {
|
|
43
|
+
date,
|
|
44
|
+
style
|
|
45
|
+
} = t0;
|
|
46
|
+
const onClient = useIsClient();
|
|
47
|
+
let t1;
|
|
48
|
+
if ($[0] !== date) {
|
|
49
|
+
t1 = date.toISOString();
|
|
50
|
+
$[0] = date;
|
|
51
|
+
$[1] = t1;
|
|
52
|
+
} else {
|
|
53
|
+
t1 = $[1];
|
|
54
|
+
}
|
|
55
|
+
let t2;
|
|
56
|
+
if ($[2] !== date || $[3] !== onClient) {
|
|
57
|
+
t2 = onClient ? localFull.format(date) : serverText(date, "full");
|
|
58
|
+
$[2] = date;
|
|
59
|
+
$[3] = onClient;
|
|
60
|
+
$[4] = t2;
|
|
61
|
+
} else {
|
|
62
|
+
t2 = $[4];
|
|
63
|
+
}
|
|
64
|
+
let t3;
|
|
65
|
+
if ($[5] !== date || $[6] !== onClient || $[7] !== style) {
|
|
66
|
+
t3 = onClient ? viewerText(date, style) : serverText(date, style);
|
|
67
|
+
$[5] = date;
|
|
68
|
+
$[6] = onClient;
|
|
69
|
+
$[7] = style;
|
|
70
|
+
$[8] = t3;
|
|
71
|
+
} else {
|
|
72
|
+
t3 = $[8];
|
|
73
|
+
}
|
|
74
|
+
let t4;
|
|
75
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
|
|
76
|
+
t4 = /*#__PURE__*/_jsx("time", {
|
|
77
|
+
dateTime: t1,
|
|
78
|
+
title: t2,
|
|
79
|
+
className: "tabular-nums",
|
|
80
|
+
children: t3
|
|
81
|
+
});
|
|
82
|
+
$[9] = t1;
|
|
83
|
+
$[10] = t2;
|
|
84
|
+
$[11] = t3;
|
|
85
|
+
$[12] = t4;
|
|
86
|
+
} else {
|
|
87
|
+
t4 = $[12];
|
|
88
|
+
}
|
|
89
|
+
return t4;
|
|
90
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { DecidedAt } from "
|
|
2
|
+
import type { DecidedAt } from "../../approval/types.js";
|
|
3
|
+
import { type DecisionTimeStyle } from "./decided-time.js";
|
|
4
|
+
export type { DecisionTimeStyle } from "./decided-time.js";
|
|
3
5
|
export declare function toDate(value: DecidedAt): Date;
|
|
4
6
|
export declare function isoOf(value: DecidedAt): string | undefined;
|
|
5
|
-
export type DecisionTimeStyle = "full" | "time";
|
|
6
|
-
export declare function formatDecidedTime(value: DecidedAt): string;
|
|
7
|
-
export declare function formatDecidedAt(value: DecidedAt): string;
|
|
8
7
|
export type DecisionOutcome = {
|
|
9
8
|
approved: boolean;
|
|
10
9
|
by?: string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Check as CheckIcon, X as XIcon } from "@phosphor-icons/react/ssr";
|
|
2
|
+
import { DecidedTime } from "./decided-time.js";
|
|
2
3
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
const decisionTimeFormat = new Intl.DateTimeFormat("en-US", {
|
|
4
|
-
dateStyle: "medium",
|
|
5
|
-
timeStyle: "short",
|
|
6
|
-
timeZone: "UTC"
|
|
7
|
-
});
|
|
8
4
|
export function toDate(value) {
|
|
9
5
|
return value instanceof Date ? value : new Date(value);
|
|
10
6
|
}
|
|
@@ -12,31 +8,19 @@ export function isoOf(value) {
|
|
|
12
8
|
const date = toDate(value);
|
|
13
9
|
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
14
10
|
}
|
|
15
|
-
const decisionClockFormat = new Intl.DateTimeFormat("en-US", {
|
|
16
|
-
timeStyle: "short",
|
|
17
|
-
timeZone: "UTC"
|
|
18
|
-
});
|
|
19
|
-
export function formatDecidedTime(value) {
|
|
20
|
-
const date = toDate(value);
|
|
21
|
-
return Number.isNaN(date.getTime()) ? "" : decisionClockFormat.format(date);
|
|
22
|
-
}
|
|
23
|
-
export function formatDecidedAt(value) {
|
|
24
|
-
const date = toDate(value);
|
|
25
|
-
return Number.isNaN(date.getTime()) ? "" : `${decisionTimeFormat.format(date)} UTC`;
|
|
26
|
-
}
|
|
27
11
|
function DecisionMeta({
|
|
28
12
|
decision,
|
|
29
13
|
verb,
|
|
30
14
|
timeStyle
|
|
31
15
|
}) {
|
|
16
|
+
const date = decision.at === undefined ? undefined : toDate(decision.at);
|
|
17
|
+
const hasTime = date !== undefined && !Number.isNaN(date.getTime());
|
|
32
18
|
return /*#__PURE__*/_jsxs("p", {
|
|
33
19
|
className: "text-xs text-muted-foreground",
|
|
34
|
-
children: [verb, decision.by && ` by ${decision.by}`,
|
|
35
|
-
children: [" · ", /*#__PURE__*/_jsx(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
className: "tabular-nums",
|
|
39
|
-
children: timeStyle === "time" ? formatDecidedTime(decision.at) : formatDecidedAt(decision.at)
|
|
20
|
+
children: [verb, decision.by && ` by ${decision.by}`, hasTime && /*#__PURE__*/_jsxs(_Fragment, {
|
|
21
|
+
children: [" · ", /*#__PURE__*/_jsx(DecidedTime, {
|
|
22
|
+
date: date,
|
|
23
|
+
style: timeStyle
|
|
40
24
|
})]
|
|
41
25
|
})]
|
|
42
26
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusgraph/loop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@phosphor-icons/react": "2.1.10",
|
|
38
|
-
"@locusgraph/brand": "0.
|
|
38
|
+
"@locusgraph/brand": "0.4.0",
|
|
39
39
|
"@locusgraph/utils": "0.1.3",
|
|
40
40
|
"@tanstack/react-virtual": "3.14.13",
|
|
41
41
|
"react-markdown": "^10.1.0",
|