@nucleux/agent-steps 0.1.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.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.cjs +98 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nucleux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @nucleux/agent-steps
|
|
2
|
+
|
|
3
|
+
AgentSteps — a live tracker of an agent's multi-step plan — Nucleux agentic UI for React.
|
|
4
|
+
|
|
5
|
+
Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @nucleux/agent-steps @nucleux/tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` / `react-dom` are peer dependencies.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { AgentSteps } from "@nucleux/agent-steps";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
|
|
22
|
+
and the Tailwind preset from `@nucleux/tokens/preset`.
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT © Nucleux
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('@nucleux/utils');
|
|
6
|
+
var lucideReact = require('lucide-react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
|
+
|
|
29
|
+
// src/index.tsx
|
|
30
|
+
var marker = {
|
|
31
|
+
pending: "border-border bg-background text-muted-foreground",
|
|
32
|
+
active: "border-info bg-info/10 text-info",
|
|
33
|
+
done: "border-success bg-success text-success-foreground",
|
|
34
|
+
error: "border-destructive bg-destructive text-destructive-foreground"
|
|
35
|
+
};
|
|
36
|
+
function StatusGlyph({ status }) {
|
|
37
|
+
if (status === "done") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5", "aria-hidden": "true" });
|
|
38
|
+
if (status === "active") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3.5 animate-spin", "aria-hidden": "true" });
|
|
39
|
+
if (status === "error") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5", "aria-hidden": "true" });
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "size-2 fill-current", "aria-hidden": "true" });
|
|
41
|
+
}
|
|
42
|
+
var AgentStep = React__namespace.forwardRef(
|
|
43
|
+
({ status = "pending", icon, title, description, progress, className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
44
|
+
"li",
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
className: utils.cn(
|
|
48
|
+
"relative flex gap-3 pb-5 last:pb-0",
|
|
49
|
+
"before:absolute before:left-[0.6875rem] before:top-6 before:h-[calc(100%-1.25rem)] before:w-px before:-translate-x-1/2 before:bg-border last:before:hidden",
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
53
|
+
...props,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: utils.cn(
|
|
59
|
+
"relative z-10 mt-0.5 inline-flex size-[1.375rem] shrink-0 items-center justify-center rounded-full border [&_svg]:size-3.5",
|
|
60
|
+
marker[status]
|
|
61
|
+
),
|
|
62
|
+
children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(StatusGlyph, { status })
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
className: utils.cn(
|
|
70
|
+
"text-sm font-medium",
|
|
71
|
+
status === "pending" ? "text-muted-foreground" : "text-foreground"
|
|
72
|
+
),
|
|
73
|
+
children: title
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: description }),
|
|
77
|
+
progress != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-1 block h-1 w-full overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: "block h-full rounded-full bg-info transition-[width]",
|
|
81
|
+
style: { width: `${Math.max(0, Math.min(100, progress))}%` }
|
|
82
|
+
}
|
|
83
|
+
) })
|
|
84
|
+
] })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
AgentStep.displayName = "AgentStep";
|
|
90
|
+
var AgentSteps = React__namespace.forwardRef(
|
|
91
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ref, className: utils.cn("flex flex-col", className), ...props, children })
|
|
92
|
+
);
|
|
93
|
+
AgentSteps.displayName = "AgentSteps";
|
|
94
|
+
|
|
95
|
+
exports.AgentStep = AgentStep;
|
|
96
|
+
exports.AgentSteps = AgentSteps;
|
|
97
|
+
//# sourceMappingURL=index.cjs.map
|
|
98
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["jsx","Check","Loader2","X","Circle","React","jsxs","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAM,MAAA,GAA0C;AAAA,EAC9C,OAAA,EAAS,mDAAA;AAAA,EACT,MAAA,EAAQ,kCAAA;AAAA,EACR,IAAA,EAAM,mDAAA;AAAA,EACN,KAAA,EAAO;AACT,CAAA;AAEA,SAAS,WAAA,CAAY,EAAE,MAAA,EAAO,EAAgC;AAC5D,EAAA,IAAI,MAAA,KAAW,QAAQ,uBAAOA,cAAA,CAACC,qBAAM,SAAA,EAAU,UAAA,EAAW,eAAY,MAAA,EAAO,CAAA;AAC7E,EAAA,IAAI,MAAA,KAAW,UAAU,uBAAOD,cAAA,CAACE,uBAAQ,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAC9F,EAAA,IAAI,MAAA,KAAW,SAAS,uBAAOF,cAAA,CAACG,iBAAE,SAAA,EAAU,UAAA,EAAW,eAAY,MAAA,EAAO,CAAA;AAC1E,EAAA,uBAAOH,cAAA,CAACI,kBAAA,EAAA,EAAO,SAAA,EAAU,qBAAA,EAAsB,eAAY,MAAA,EAAO,CAAA;AACpE;AAGO,IAAM,SAAA,GAAkBC,gBAAA,CAAA,UAAA;AAAA,EAC7B,CAAC,EAAE,MAAA,GAAS,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,WAAA,EAAa,QAAA,EAAU,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,qBAChFC,eAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAWC,QAAA;AAAA,QACT,oCAAA;AAAA,QACA,4JAAA;AAAA,QACA;AAAA,OACF;AAAA,M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EAAW,UAAU,GAAG,KAAA,IAAS,GAAA,qBAClCL,cAAA,CAAC,IAAA,EAAA,EAAG,GAAA,EAAU,WAAWO,QAAA,CAAG,eAAA,EAAiB,SAAS,CAAA,EAAI,GAAG,OAC1D,QAAA,EACH;AAEJ;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport { Check, Loader2, Circle, X } from \"lucide-react\";\n\nexport type AgentStepStatus = \"pending\" | \"active\" | \"done\" | \"error\";\n\nexport interface AgentStepProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, \"title\"> {\n /** Execution status of the step. */\n status?: AgentStepStatus;\n /** Action-type icon (e.g. read, execute, search). Overrides the status glyph. */\n icon?: React.ReactNode;\n /** Step label. */\n title: React.ReactNode;\n /** Supporting detail under the title. */\n description?: React.ReactNode;\n /** Optional progress track, 0–100, shown under the step while active. */\n progress?: number;\n}\n\nconst marker: Record<AgentStepStatus, string> = {\n pending: \"border-border bg-background text-muted-foreground\",\n active: \"border-info bg-info/10 text-info\",\n done: \"border-success bg-success text-success-foreground\",\n error: \"border-destructive bg-destructive text-destructive-foreground\",\n};\n\nfunction StatusGlyph({ status }: { status: AgentStepStatus }) {\n if (status === \"done\") return <Check className=\"size-3.5\" aria-hidden=\"true\" />;\n if (status === \"active\") return <Loader2 className=\"size-3.5 animate-spin\" aria-hidden=\"true\" />;\n if (status === \"error\") return <X className=\"size-3.5\" aria-hidden=\"true\" />;\n return <Circle className=\"size-2 fill-current\" aria-hidden=\"true\" />;\n}\n\n/** A single step in an {@link AgentSteps} tracker. */\nexport const AgentStep = React.forwardRef<HTMLLIElement, AgentStepProps>(\n ({ status = \"pending\", icon, title, description, progress, className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\n \"relative flex gap-3 pb-5 last:pb-0\",\n \"before:absolute before:left-[0.6875rem] before:top-6 before:h-[calc(100%-1.25rem)] before:w-px before:-translate-x-1/2 before:bg-border last:before:hidden\",\n className,\n )}\n aria-current={status === \"active\" ? \"step\" : undefined}\n {...props}\n >\n <span\n className={cn(\n \"relative z-10 mt-0.5 inline-flex size-[1.375rem] shrink-0 items-center justify-center rounded-full border [&_svg]:size-3.5\",\n marker[status],\n )}\n >\n {icon ?? <StatusGlyph status={status} />}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span\n className={cn(\n \"text-sm font-medium\",\n status === \"pending\" ? \"text-muted-foreground\" : \"text-foreground\",\n )}\n >\n {title}\n </span>\n {description && <span className=\"text-xs text-muted-foreground\">{description}</span>}\n {progress != null && (\n <span className=\"mt-1 block h-1 w-full overflow-hidden rounded-full bg-muted\">\n <span\n className=\"block h-full rounded-full bg-info transition-[width]\"\n style={{ width: `${Math.max(0, Math.min(100, progress))}%` }}\n />\n </span>\n )}\n </span>\n </li>\n ),\n);\nAgentStep.displayName = \"AgentStep\";\n\nexport interface AgentStepsProps extends React.HTMLAttributes<HTMLOListElement> {}\n\n/**\n * A live tracker of an agent's multi-step plan — each {@link AgentStep} shows an\n * action-type icon, status and optional progress as the agent works.\n * Source: Figma \"During Interaction / Processing Steps · Footprints\".\n */\nexport const AgentSteps = React.forwardRef<HTMLOListElement, AgentStepsProps>(\n ({ className, children, ...props }, ref) => (\n <ol ref={ref} className={cn(\"flex flex-col\", className)} {...props}>\n {children}\n </ol>\n ),\n);\nAgentSteps.displayName = \"AgentSteps\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type AgentStepStatus = "pending" | "active" | "done" | "error";
|
|
4
|
+
interface AgentStepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
|
|
5
|
+
/** Execution status of the step. */
|
|
6
|
+
status?: AgentStepStatus;
|
|
7
|
+
/** Action-type icon (e.g. read, execute, search). Overrides the status glyph. */
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
/** Step label. */
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
/** Supporting detail under the title. */
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
/** Optional progress track, 0–100, shown under the step while active. */
|
|
14
|
+
progress?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A single step in an {@link AgentSteps} tracker. */
|
|
17
|
+
declare const AgentStep: React.ForwardRefExoticComponent<AgentStepProps & React.RefAttributes<HTMLLIElement>>;
|
|
18
|
+
interface AgentStepsProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A live tracker of an agent's multi-step plan — each {@link AgentStep} shows an
|
|
22
|
+
* action-type icon, status and optional progress as the agent works.
|
|
23
|
+
* Source: Figma "During Interaction / Processing Steps · Footprints".
|
|
24
|
+
*/
|
|
25
|
+
declare const AgentSteps: React.ForwardRefExoticComponent<AgentStepsProps & React.RefAttributes<HTMLOListElement>>;
|
|
26
|
+
|
|
27
|
+
export { AgentStep, type AgentStepProps, type AgentStepStatus, AgentSteps, type AgentStepsProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type AgentStepStatus = "pending" | "active" | "done" | "error";
|
|
4
|
+
interface AgentStepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
|
|
5
|
+
/** Execution status of the step. */
|
|
6
|
+
status?: AgentStepStatus;
|
|
7
|
+
/** Action-type icon (e.g. read, execute, search). Overrides the status glyph. */
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
/** Step label. */
|
|
10
|
+
title: React.ReactNode;
|
|
11
|
+
/** Supporting detail under the title. */
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
/** Optional progress track, 0–100, shown under the step while active. */
|
|
14
|
+
progress?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A single step in an {@link AgentSteps} tracker. */
|
|
17
|
+
declare const AgentStep: React.ForwardRefExoticComponent<AgentStepProps & React.RefAttributes<HTMLLIElement>>;
|
|
18
|
+
interface AgentStepsProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A live tracker of an agent's multi-step plan — each {@link AgentStep} shows an
|
|
22
|
+
* action-type icon, status and optional progress as the agent works.
|
|
23
|
+
* Source: Figma "During Interaction / Processing Steps · Footprints".
|
|
24
|
+
*/
|
|
25
|
+
declare const AgentSteps: React.ForwardRefExoticComponent<AgentStepsProps & React.RefAttributes<HTMLOListElement>>;
|
|
26
|
+
|
|
27
|
+
export { AgentStep, type AgentStepProps, type AgentStepStatus, AgentSteps, type AgentStepsProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '@nucleux/utils';
|
|
4
|
+
import { Check, Loader2, X, Circle } from 'lucide-react';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/index.tsx
|
|
8
|
+
var marker = {
|
|
9
|
+
pending: "border-border bg-background text-muted-foreground",
|
|
10
|
+
active: "border-info bg-info/10 text-info",
|
|
11
|
+
done: "border-success bg-success text-success-foreground",
|
|
12
|
+
error: "border-destructive bg-destructive text-destructive-foreground"
|
|
13
|
+
};
|
|
14
|
+
function StatusGlyph({ status }) {
|
|
15
|
+
if (status === "done") return /* @__PURE__ */ jsx(Check, { className: "size-3.5", "aria-hidden": "true" });
|
|
16
|
+
if (status === "active") return /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 animate-spin", "aria-hidden": "true" });
|
|
17
|
+
if (status === "error") return /* @__PURE__ */ jsx(X, { className: "size-3.5", "aria-hidden": "true" });
|
|
18
|
+
return /* @__PURE__ */ jsx(Circle, { className: "size-2 fill-current", "aria-hidden": "true" });
|
|
19
|
+
}
|
|
20
|
+
var AgentStep = React.forwardRef(
|
|
21
|
+
({ status = "pending", icon, title, description, progress, className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
22
|
+
"li",
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: cn(
|
|
26
|
+
"relative flex gap-3 pb-5 last:pb-0",
|
|
27
|
+
"before:absolute before:left-[0.6875rem] before:top-6 before:h-[calc(100%-1.25rem)] before:w-px before:-translate-x-1/2 before:bg-border last:before:hidden",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
31
|
+
...props,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: cn(
|
|
37
|
+
"relative z-10 mt-0.5 inline-flex size-[1.375rem] shrink-0 items-center justify-center rounded-full border [&_svg]:size-3.5",
|
|
38
|
+
marker[status]
|
|
39
|
+
),
|
|
40
|
+
children: icon ?? /* @__PURE__ */ jsx(StatusGlyph, { status })
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
className: cn(
|
|
48
|
+
"text-sm font-medium",
|
|
49
|
+
status === "pending" ? "text-muted-foreground" : "text-foreground"
|
|
50
|
+
),
|
|
51
|
+
children: title
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: description }),
|
|
55
|
+
progress != null && /* @__PURE__ */ jsx("span", { className: "mt-1 block h-1 w-full overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: "block h-full rounded-full bg-info transition-[width]",
|
|
59
|
+
style: { width: `${Math.max(0, Math.min(100, progress))}%` }
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
AgentStep.displayName = "AgentStep";
|
|
68
|
+
var AgentSteps = React.forwardRef(
|
|
69
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("ol", { ref, className: cn("flex flex-col", className), ...props, children })
|
|
70
|
+
);
|
|
71
|
+
AgentSteps.displayName = "AgentSteps";
|
|
72
|
+
|
|
73
|
+
export { AgentStep, AgentSteps };
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAoBA,IAAM,MAAA,GAA0C;AAAA,EAC9C,OAAA,EAAS,mDAAA;AAAA,EACT,MAAA,EAAQ,kCAAA;AAAA,EACR,IAAA,EAAM,mDAAA;AAAA,EACN,KAAA,EAAO;AACT,CAAA;AAEA,SAAS,WAAA,CAAY,EAAE,MAAA,EAAO,EAAgC;AAC5D,EAAA,IAAI,MAAA,KAAW,QAAQ,uBAAO,GAAA,CAAC,SAAM,SAAA,EAAU,UAAA,EAAW,eAAY,MAAA,EAAO,CAAA;AAC7E,EAAA,IAAI,MAAA,KAAW,UAAU,uBAAO,GAAA,CAAC,WAAQ,SAAA,EAAU,uBAAA,EAAwB,eAAY,MAAA,EAAO,CAAA;AAC9F,EAAA,IAAI,MAAA,KAAW,SAAS,uBAAO,GAAA,CAAC,KAAE,SAAA,EAAU,UAAA,EAAW,eAAY,MAAA,EAAO,CAAA;AAC1E,EAAA,uBAAO,GAAA,CAAC,MAAA,EAAA,EAAO,SAAA,EAAU,qBAAA,EAAsB,eAAY,MAAA,EAAO,CAAA;AACpE;AAGO,IAAM,SAAA,GAAkB,KAAA,CAAA,UAAA;AAAA,EAC7B,CAAC,EAAE,MAAA,GAAS,SAAA,EAAW,IAAA,EAAM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,EAAK,QAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAAI;AAAA,WAC7D,EACF;AAAA,SAAA,EAEJ;AAAA;AAAA;AAAA;AAGN;AACA,SAAA,CAAU,WAAA,GAAc,WAAA;AASjB,IAAM,UAAA,GAAmB,KAAA,CAAA,UAAA;AAAA,EAC9B,CAAC,EAAE,SAAA,EAAW,UAAU,GAAG,KAAA,IAAS,GAAA,qBAClC,GAAA,CAAC,IAAA,EAAA,EAAG,GAAA,EAAU,WAAW,EAAA,CAAG,eAAA,EAAiB,SAAS,CAAA,EAAI,GAAG,OAC1D,QAAA,EACH;AAEJ;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport { Check, Loader2, Circle, X } from \"lucide-react\";\n\nexport type AgentStepStatus = \"pending\" | \"active\" | \"done\" | \"error\";\n\nexport interface AgentStepProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, \"title\"> {\n /** Execution status of the step. */\n status?: AgentStepStatus;\n /** Action-type icon (e.g. read, execute, search). Overrides the status glyph. */\n icon?: React.ReactNode;\n /** Step label. */\n title: React.ReactNode;\n /** Supporting detail under the title. */\n description?: React.ReactNode;\n /** Optional progress track, 0–100, shown under the step while active. */\n progress?: number;\n}\n\nconst marker: Record<AgentStepStatus, string> = {\n pending: \"border-border bg-background text-muted-foreground\",\n active: \"border-info bg-info/10 text-info\",\n done: \"border-success bg-success text-success-foreground\",\n error: \"border-destructive bg-destructive text-destructive-foreground\",\n};\n\nfunction StatusGlyph({ status }: { status: AgentStepStatus }) {\n if (status === \"done\") return <Check className=\"size-3.5\" aria-hidden=\"true\" />;\n if (status === \"active\") return <Loader2 className=\"size-3.5 animate-spin\" aria-hidden=\"true\" />;\n if (status === \"error\") return <X className=\"size-3.5\" aria-hidden=\"true\" />;\n return <Circle className=\"size-2 fill-current\" aria-hidden=\"true\" />;\n}\n\n/** A single step in an {@link AgentSteps} tracker. */\nexport const AgentStep = React.forwardRef<HTMLLIElement, AgentStepProps>(\n ({ status = \"pending\", icon, title, description, progress, className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\n \"relative flex gap-3 pb-5 last:pb-0\",\n \"before:absolute before:left-[0.6875rem] before:top-6 before:h-[calc(100%-1.25rem)] before:w-px before:-translate-x-1/2 before:bg-border last:before:hidden\",\n className,\n )}\n aria-current={status === \"active\" ? \"step\" : undefined}\n {...props}\n >\n <span\n className={cn(\n \"relative z-10 mt-0.5 inline-flex size-[1.375rem] shrink-0 items-center justify-center rounded-full border [&_svg]:size-3.5\",\n marker[status],\n )}\n >\n {icon ?? <StatusGlyph status={status} />}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <span\n className={cn(\n \"text-sm font-medium\",\n status === \"pending\" ? \"text-muted-foreground\" : \"text-foreground\",\n )}\n >\n {title}\n </span>\n {description && <span className=\"text-xs text-muted-foreground\">{description}</span>}\n {progress != null && (\n <span className=\"mt-1 block h-1 w-full overflow-hidden rounded-full bg-muted\">\n <span\n className=\"block h-full rounded-full bg-info transition-[width]\"\n style={{ width: `${Math.max(0, Math.min(100, progress))}%` }}\n />\n </span>\n )}\n </span>\n </li>\n ),\n);\nAgentStep.displayName = \"AgentStep\";\n\nexport interface AgentStepsProps extends React.HTMLAttributes<HTMLOListElement> {}\n\n/**\n * A live tracker of an agent's multi-step plan — each {@link AgentStep} shows an\n * action-type icon, status and optional progress as the agent works.\n * Source: Figma \"During Interaction / Processing Steps · Footprints\".\n */\nexport const AgentSteps = React.forwardRef<HTMLOListElement, AgentStepsProps>(\n ({ className, children, ...props }, ref) => (\n <ol ref={ref} className={cn(\"flex flex-col\", className)} {...props}>\n {children}\n </ol>\n ),\n);\nAgentSteps.displayName = \"AgentSteps\";\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nucleux/agent-steps",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"description": "AgentSteps — a live tracker of an agent's multi-step plan — Nucleux agentic UI for React.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"nucleux",
|
|
9
|
+
"react",
|
|
10
|
+
"ui",
|
|
11
|
+
"components",
|
|
12
|
+
"agentic",
|
|
13
|
+
"ai",
|
|
14
|
+
"tailwind",
|
|
15
|
+
"agent-steps"
|
|
16
|
+
],
|
|
17
|
+
"main": "./dist/index.cjs",
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": ">=18",
|
|
33
|
+
"react-dom": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"lucide-react": "^0.469.0",
|
|
37
|
+
"@nucleux/utils": "0.1.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"tsup": "^8.3.5",
|
|
41
|
+
"typescript": "^5.7.2",
|
|
42
|
+
"@types/react": "^18.3.18",
|
|
43
|
+
"react": "^18.3.1"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
|
|
52
|
+
"directory": "packages/agent-steps"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup"
|
|
57
|
+
}
|
|
58
|
+
}
|