@stigmer/react-ui 0.0.34

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 (100) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +70 -0
  3. package/execution/components/ApprovalControls.d.ts +10 -0
  4. package/execution/components/ApprovalControls.d.ts.map +1 -0
  5. package/execution/components/ApprovalControls.js +19 -0
  6. package/execution/components/ApprovalControls.js.map +1 -0
  7. package/execution/components/ExecutionStatus.d.ts +8 -0
  8. package/execution/components/ExecutionStatus.d.ts.map +1 -0
  9. package/execution/components/ExecutionStatus.js +13 -0
  10. package/execution/components/ExecutionStatus.js.map +1 -0
  11. package/execution/components/ExecutionStream.d.ts +16 -0
  12. package/execution/components/ExecutionStream.d.ts.map +1 -0
  13. package/execution/components/ExecutionStream.js +47 -0
  14. package/execution/components/ExecutionStream.js.map +1 -0
  15. package/execution/components/MessageEntry.d.ts +17 -0
  16. package/execution/components/MessageEntry.d.ts.map +1 -0
  17. package/execution/components/MessageEntry.js +44 -0
  18. package/execution/components/MessageEntry.js.map +1 -0
  19. package/execution/components/MessageInput.d.ts +10 -0
  20. package/execution/components/MessageInput.d.ts.map +1 -0
  21. package/execution/components/MessageInput.js +28 -0
  22. package/execution/components/MessageInput.js.map +1 -0
  23. package/execution/components/OutputBlock.d.ts +9 -0
  24. package/execution/components/OutputBlock.d.ts.map +1 -0
  25. package/execution/components/OutputBlock.js +15 -0
  26. package/execution/components/OutputBlock.js.map +1 -0
  27. package/execution/components/SubAgentCard.d.ts +11 -0
  28. package/execution/components/SubAgentCard.d.ts.map +1 -0
  29. package/execution/components/SubAgentCard.js +19 -0
  30. package/execution/components/SubAgentCard.js.map +1 -0
  31. package/execution/components/ToolCallCard.d.ts +12 -0
  32. package/execution/components/ToolCallCard.d.ts.map +1 -0
  33. package/execution/components/ToolCallCard.js +26 -0
  34. package/execution/components/ToolCallCard.js.map +1 -0
  35. package/execution/helpers.d.ts +34 -0
  36. package/execution/helpers.d.ts.map +1 -0
  37. package/execution/helpers.js +163 -0
  38. package/execution/helpers.js.map +1 -0
  39. package/execution/hooks/useAgentExecution.d.ts +24 -0
  40. package/execution/hooks/useAgentExecution.d.ts.map +1 -0
  41. package/execution/hooks/useAgentExecution.js +112 -0
  42. package/execution/hooks/useAgentExecution.js.map +1 -0
  43. package/execution/hooks/useApproval.d.ts +16 -0
  44. package/execution/hooks/useApproval.d.ts.map +1 -0
  45. package/execution/hooks/useApproval.js +25 -0
  46. package/execution/hooks/useApproval.js.map +1 -0
  47. package/execution/hooks/useExecutionService.d.ts +8 -0
  48. package/execution/hooks/useExecutionService.d.ts.map +1 -0
  49. package/execution/hooks/useExecutionService.js +14 -0
  50. package/execution/hooks/useExecutionService.js.map +1 -0
  51. package/execution/index.d.ts +17 -0
  52. package/execution/index.d.ts.map +1 -0
  53. package/execution/index.js +26 -0
  54. package/execution/index.js.map +1 -0
  55. package/execution/services/execution-service.d.ts +23 -0
  56. package/execution/services/execution-service.d.ts.map +1 -0
  57. package/execution/services/execution-service.js +70 -0
  58. package/execution/services/execution-service.js.map +1 -0
  59. package/index.d.ts +2 -0
  60. package/index.d.ts.map +1 -0
  61. package/index.js +2 -0
  62. package/index.js.map +1 -0
  63. package/internal/ui/badge.d.ts +8 -0
  64. package/internal/ui/badge.d.ts.map +1 -0
  65. package/internal/ui/badge.js +46 -0
  66. package/internal/ui/badge.js.map +1 -0
  67. package/internal/ui/button.d.ts +9 -0
  68. package/internal/ui/button.d.ts.map +1 -0
  69. package/internal/ui/button.js +48 -0
  70. package/internal/ui/button.js.map +1 -0
  71. package/internal/ui/collapsible.d.ts +6 -0
  72. package/internal/ui/collapsible.d.ts.map +1 -0
  73. package/internal/ui/collapsible.js +28 -0
  74. package/internal/ui/collapsible.js.map +1 -0
  75. package/internal/ui/textarea.d.ts +4 -0
  76. package/internal/ui/textarea.d.ts.map +1 -0
  77. package/internal/ui/textarea.js +19 -0
  78. package/internal/ui/textarea.js.map +1 -0
  79. package/package.json +54 -0
  80. package/src/execution/components/ApprovalControls.tsx +99 -0
  81. package/src/execution/components/ExecutionStatus.tsx +36 -0
  82. package/src/execution/components/ExecutionStream.tsx +167 -0
  83. package/src/execution/components/MessageEntry.tsx +143 -0
  84. package/src/execution/components/MessageInput.tsx +70 -0
  85. package/src/execution/components/OutputBlock.tsx +47 -0
  86. package/src/execution/components/SubAgentCard.tsx +135 -0
  87. package/src/execution/components/ToolCallCard.tsx +155 -0
  88. package/src/execution/helpers.ts +199 -0
  89. package/src/execution/hooks/useAgentExecution.ts +126 -0
  90. package/src/execution/hooks/useApproval.ts +55 -0
  91. package/src/execution/hooks/useExecutionService.ts +15 -0
  92. package/src/execution/index.ts +53 -0
  93. package/src/execution/services/execution-service.ts +125 -0
  94. package/src/index.ts +1 -0
  95. package/src/internal/ui/badge.tsx +52 -0
  96. package/src/internal/ui/button.tsx +60 -0
  97. package/src/internal/ui/collapsible.tsx +21 -0
  98. package/src/internal/ui/textarea.tsx +18 -0
  99. package/src/styles.css +43 -0
  100. package/styles.css +2 -0
@@ -0,0 +1,23 @@
1
+ import { type Transport } from "@connectrpc/connect";
2
+ import { type AgentExecutionList } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
3
+ import { type AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
4
+ import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
5
+ export interface CreateExecutionInput {
6
+ agentId?: string;
7
+ sessionId?: string;
8
+ message: string;
9
+ org: string;
10
+ }
11
+ export interface ListExecutionsBySessionOptions {
12
+ pageSize?: number;
13
+ pageToken?: string;
14
+ }
15
+ export interface ExecutionService {
16
+ createExecution(input: CreateExecutionInput): Promise<AgentExecution>;
17
+ subscribeToExecution(executionId: string, signal?: AbortSignal): AsyncIterable<AgentExecution>;
18
+ submitApproval(executionId: string, toolCallId: string, action: ApprovalAction, comment?: string): Promise<AgentExecution>;
19
+ cancelExecution(executionId: string, reason?: string): Promise<AgentExecution>;
20
+ listExecutionsBySession(sessionId: string, options?: ListExecutionsBySessionOptions): Promise<AgentExecutionList>;
21
+ }
22
+ export declare function createExecutionService(transport: Transport): ExecutionService;
23
+ //# sourceMappingURL=execution-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-service.d.ts","sourceRoot":"","sources":["../../../src/execution/services/execution-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQnE,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,6DAA6D,CAAC;AAIrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AASnG,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACtE,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;IAC/F,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3H,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/E,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnH;AAWD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,CA+D7E"}
@@ -0,0 +1,70 @@
1
+ import { create } from "@bufbuild/protobuf";
2
+ import { createClient } from "@connectrpc/connect";
3
+ import { AgentExecutionCommandController, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/command_pb";
4
+ import { AgentExecutionQueryController, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/query_pb";
5
+ import { AgentExecutionIdSchema, SubmitApprovalInputSchema, CancelAgentExecutionInputSchema, ListAgentExecutionsBySessionRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
6
+ import { AgentExecutionSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
7
+ import { AgentExecutionSpecSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
8
+ import { ApiResourceMetadataSchema, } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
9
+ // ---------------------------------------------------------------------------
10
+ // Factory
11
+ //
12
+ // protobuf-es codegenv1 descriptors cause generic inference loss with strict TS,
13
+ // so Connect-RPC clients type all inputs/outputs as Message<string>. The typed
14
+ // wrapper methods below restore the correct domain types at each call site —
15
+ // the underlying runtime behavior is identical.
16
+ // ---------------------------------------------------------------------------
17
+ export function createExecutionService(transport) {
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ const commandClient = createClient(AgentExecutionCommandController, transport);
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ const queryClient = createClient(AgentExecutionQueryController, transport);
22
+ return {
23
+ async createExecution(input) {
24
+ var _a, _b;
25
+ const execution = create(AgentExecutionSchema, {
26
+ apiVersion: "agentic.stigmer.ai/v1",
27
+ kind: "AgentExecution",
28
+ metadata: create(ApiResourceMetadataSchema, {
29
+ org: input.org,
30
+ }),
31
+ spec: create(AgentExecutionSpecSchema, {
32
+ agentId: (_a = input.agentId) !== null && _a !== void 0 ? _a : "",
33
+ sessionId: (_b = input.sessionId) !== null && _b !== void 0 ? _b : "",
34
+ message: input.message,
35
+ }),
36
+ });
37
+ return commandClient.create(execution);
38
+ },
39
+ subscribeToExecution(executionId, signal) {
40
+ const request = create(AgentExecutionIdSchema, { value: executionId });
41
+ return queryClient.subscribe(request, { signal });
42
+ },
43
+ async submitApproval(executionId, toolCallId, action, comment) {
44
+ const input = create(SubmitApprovalInputSchema, {
45
+ agentExecutionId: executionId,
46
+ toolCallId,
47
+ action,
48
+ comment: comment !== null && comment !== void 0 ? comment : "",
49
+ });
50
+ return commandClient.submitApproval(input);
51
+ },
52
+ async cancelExecution(executionId, reason) {
53
+ const input = create(CancelAgentExecutionInputSchema, {
54
+ id: executionId,
55
+ reason: reason !== null && reason !== void 0 ? reason : "",
56
+ });
57
+ return commandClient.cancel(input);
58
+ },
59
+ async listExecutionsBySession(sessionId, options) {
60
+ var _a, _b;
61
+ const request = create(ListAgentExecutionsBySessionRequestSchema, {
62
+ sessionId,
63
+ pageSize: (_a = options === null || options === void 0 ? void 0 : options.pageSize) !== null && _a !== void 0 ? _a : 50,
64
+ pageToken: (_b = options === null || options === void 0 ? void 0 : options.pageToken) !== null && _b !== void 0 ? _b : "",
65
+ });
66
+ return queryClient.listBySession(request);
67
+ },
68
+ };
69
+ }
70
+ //# sourceMappingURL=execution-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-service.js","sourceRoot":"","sources":["../../../src/execution/services/execution-service.ts"],"names":[],"mappings":"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"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./execution";
2
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./execution";
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const badgeVariants: (props?: ({
4
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
7
+ export { Badge, badgeVariants };
8
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa;;8EAqBlB,CAAA;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAmB,EACnB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,8FAevE;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,46 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { mergeProps } from "@base-ui/react/merge-props";
13
+ import { useRender } from "@base-ui/react/use-render";
14
+ import { cva } from "class-variance-authority";
15
+ import { cn } from "@stigmer/theme";
16
+ const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
20
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
21
+ destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
22
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
23
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
24
+ link: "text-primary underline-offset-4 hover:underline",
25
+ },
26
+ },
27
+ defaultVariants: {
28
+ variant: "default",
29
+ },
30
+ });
31
+ function Badge(_a) {
32
+ var { className, variant = "default", render } = _a, props = __rest(_a, ["className", "variant", "render"]);
33
+ return useRender({
34
+ defaultTagName: "span",
35
+ props: mergeProps({
36
+ className: cn(badgeVariants({ variant }), className),
37
+ }, props),
38
+ render,
39
+ state: {
40
+ slot: "badge",
41
+ variant,
42
+ },
43
+ });
44
+ }
45
+ export { Badge, badgeVariants };
46
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/internal/ui/badge.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,MAAM,aAAa,GAAG,GAAG,CACvB,4eAA4e,EAC5e;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,4DAA4D;YACrE,SAAS,EACP,kEAAkE;YACpE,WAAW,EACT,gKAAgK;YAClK,OAAO,EACL,kFAAkF;YACpF,KAAK,EACH,mEAAmE;YACrE,IAAI,EAAE,iDAAiD;SACxD;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;KACnB;CACF,CACF,CAAA;AAED,SAAS,KAAK,CAAC,EAKyD;QALzD,EACb,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,MAAM,OAEgE,EADnE,KAAK,cAJK,kCAKd,CADS;IAER,OAAO,SAAS,CAAC;QACf,cAAc,EAAE,MAAM;QACtB,KAAK,EAAE,UAAU,CACf;YACE,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC;SACrD,EACD,KAAK,CACN;QACD,MAAM;QACN,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,OAAO;SACR;KACF,CAAC,CAAA;AACJ,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
5
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react/jsx-runtime").JSX.Element;
8
+ export { Button, buttonVariants };
9
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,cAAc;;;8EAmCnB,CAAA;AAED,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,2CAQ7D;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
15
+ import { cva } from "class-variance-authority";
16
+ import { cn } from "@stigmer/theme";
17
+ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
18
+ variants: {
19
+ variant: {
20
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
21
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
22
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
23
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
24
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
25
+ link: "text-primary underline-offset-4 hover:underline",
26
+ },
27
+ size: {
28
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
29
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
30
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
31
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
32
+ icon: "size-8",
33
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
34
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
35
+ "icon-lg": "size-9",
36
+ },
37
+ },
38
+ defaultVariants: {
39
+ variant: "default",
40
+ size: "default",
41
+ },
42
+ });
43
+ function Button(_a) {
44
+ var { className, variant = "default", size = "default" } = _a, props = __rest(_a, ["className", "variant", "size"]);
45
+ return (_jsx(ButtonPrimitive, Object.assign({ "data-slot": "button", className: cn(buttonVariants({ variant, size, className })) }, props)));
46
+ }
47
+ export { Button, buttonVariants };
48
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/internal/ui/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;;AAEZ,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,MAAM,cAAc,GAAG,GAAG,CACxB,wkBAAwkB,EACxkB;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,4DAA4D;YACrE,OAAO,EACL,iLAAiL;YACnL,SAAS,EACP,iIAAiI;YACnI,KAAK,EACH,kHAAkH;YACpH,WAAW,EACT,6NAA6N;YAC/N,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EACL,sFAAsF;YACxF,EAAE,EAAE,+MAA+M;YACnN,EAAE,EAAE,yNAAyN;YAC7N,EAAE,EAAE,sFAAsF;YAC1F,IAAI,EAAE,QAAQ;YACd,SAAS,EACP,yHAAyH;YAC3H,SAAS,EACP,oFAAoF;YACtF,SAAS,EAAE,QAAQ;SACpB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAA;AAED,SAAS,MAAM,CAAC,EAK8C;QAL9C,EACd,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,SAAS,OAE4C,EADzD,KAAK,cAJM,gCAKf,CADS;IAER,OAAO,CACL,KAAC,eAAe,+BACJ,QAAQ,EAClB,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IACvD,KAAK,EACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
+ declare function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props): import("react/jsx-runtime").JSX.Element;
3
+ declare function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props): import("react/jsx-runtime").JSX.Element;
4
+ declare function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props): import("react/jsx-runtime").JSX.Element;
5
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };
6
+ //# sourceMappingURL=collapsible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEhF,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,2CAEjE;AAED,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,2CAI3E;AAED,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,2CAIzE;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
15
+ function Collapsible(_a) {
16
+ var props = __rest(_a, []);
17
+ return _jsx(CollapsiblePrimitive.Root, Object.assign({ "data-slot": "collapsible" }, props));
18
+ }
19
+ function CollapsibleTrigger(_a) {
20
+ var props = __rest(_a, []);
21
+ return (_jsx(CollapsiblePrimitive.Trigger, Object.assign({ "data-slot": "collapsible-trigger" }, props)));
22
+ }
23
+ function CollapsibleContent(_a) {
24
+ var props = __rest(_a, []);
25
+ return (_jsx(CollapsiblePrimitive.Panel, Object.assign({ "data-slot": "collapsible-content" }, props)));
26
+ }
27
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };
28
+ //# sourceMappingURL=collapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../../src/internal/ui/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;;AAEZ,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEhF,SAAS,WAAW,CAAC,EAA6C;QAAxC,KAAK,cAAV,EAAY,CAAF;IAC7B,OAAO,KAAC,oBAAoB,CAAC,IAAI,+BAAW,aAAa,IAAK,KAAK,EAAI,CAAA;AACzE,CAAC;AAED,SAAS,kBAAkB,CAAC,EAAgD;QAA3C,KAAK,cAAV,EAAY,CAAF;IACpC,OAAO,CACL,KAAC,oBAAoB,CAAC,OAAO,+BAAW,qBAAqB,IAAK,KAAK,EAAI,CAC5E,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,EAA8C;QAAzC,KAAK,cAAV,EAAY,CAAF;IACpC,OAAO,CACL,KAAC,oBAAoB,CAAC,KAAK,+BAAW,qBAAqB,IAAK,KAAK,EAAI,CAC1E,CAAA;AACH,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): import("react/jsx-runtime").JSX.Element;
3
+ export { Textarea };
4
+ //# sourceMappingURL=textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,2CAW1E;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,19 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { cn } from "@stigmer/theme";
14
+ function Textarea(_a) {
15
+ var { className } = _a, props = __rest(_a, ["className"]);
16
+ return (_jsx("textarea", Object.assign({ "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className) }, props)));
17
+ }
18
+ export { Textarea };
19
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/internal/ui/textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnC,SAAS,QAAQ,CAAC,EAAyD;QAAzD,EAAE,SAAS,OAA8C,EAAzC,KAAK,cAArB,aAAuB,CAAF;IACrC,OAAO,CACL,8CACY,UAAU,EACpB,SAAS,EAAE,EAAE,CACX,whBAAwhB,EACxhB,SAAS,CACV,IACG,KAAK,EACT,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@stigmer/react-ui",
3
+ "version": "0.0.34",
4
+ "description": "React components for Stigmer agent execution streaming, tool calls, and HITL approvals",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/stigmer/stigmer.git",
11
+ "directory": "client-apps/web/_libs/domain/react-ui"
12
+ },
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "keywords": [
17
+ "stigmer",
18
+ "react",
19
+ "ai-agents",
20
+ "execution-streaming",
21
+ "tool-calls",
22
+ "hitl",
23
+ "human-in-the-loop"
24
+ ],
25
+ "main": "./index.js",
26
+ "types": "./index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./index.d.ts",
30
+ "import": "./index.js"
31
+ },
32
+ "./execution": {
33
+ "types": "./execution/index.d.ts",
34
+ "import": "./execution/index.js"
35
+ },
36
+ "./styles.css": "./styles.css"
37
+ },
38
+ "dependencies": {
39
+ "@stigmer/rpc-client": "0.0.34",
40
+ "@stigmer/theme": "0.0.34"
41
+ },
42
+ "peerDependencies": {
43
+ "react": "^19.0.0",
44
+ "react-dom": "^19.0.0",
45
+ "@stigmer/protos": "0.0.34",
46
+ "@base-ui/react": "^1.0.0",
47
+ "@connectrpc/connect": "^2.0.0",
48
+ "@bufbuild/protobuf": "^2.0.0",
49
+ "class-variance-authority": "^0.7.0",
50
+ "lucide-react": ">=0.400.0",
51
+ "react-markdown": "^10.0.0",
52
+ "remark-gfm": "^4.0.0"
53
+ }
54
+ }
@@ -0,0 +1,99 @@
1
+ "use client";
2
+
3
+ import { useCallback, useState } from "react";
4
+ import { Button } from "../../internal/ui/button";
5
+ import { Textarea } from "../../internal/ui/textarea";
6
+ import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
7
+ import { cn } from "@stigmer/theme";
8
+ import { Check, X, SkipForward, Loader2 } from "lucide-react";
9
+
10
+ interface ApprovalControlsProps {
11
+ approvalMessage: string;
12
+ onSubmit: (action: ApprovalAction, comment?: string) => Promise<void>;
13
+ isSubmitting: boolean;
14
+ className?: string;
15
+ }
16
+
17
+ export function ApprovalControls({
18
+ approvalMessage,
19
+ onSubmit,
20
+ isSubmitting,
21
+ className,
22
+ }: ApprovalControlsProps) {
23
+ const [showComment, setShowComment] = useState(false);
24
+ const [comment, setComment] = useState("");
25
+
26
+ const handleAction = useCallback(
27
+ async (action: ApprovalAction) => {
28
+ await onSubmit(action, comment || undefined);
29
+ setComment("");
30
+ setShowComment(false);
31
+ },
32
+ [onSubmit, comment],
33
+ );
34
+
35
+ return (
36
+ <div
37
+ className={cn(
38
+ "rounded-lg border-2 border-primary/30 bg-primary/5 p-3 space-y-3",
39
+ className,
40
+ )}
41
+ >
42
+ <p className="text-sm font-medium">{approvalMessage}</p>
43
+
44
+ {showComment && (
45
+ <Textarea
46
+ value={comment}
47
+ onChange={(e) => setComment(e.target.value)}
48
+ placeholder="Optional comment..."
49
+ className="min-h-10 text-sm"
50
+ disabled={isSubmitting}
51
+ />
52
+ )}
53
+
54
+ <div className="flex items-center gap-2">
55
+ <Button
56
+ size="sm"
57
+ onClick={() => handleAction(ApprovalAction.APPROVE)}
58
+ disabled={isSubmitting}
59
+ >
60
+ {isSubmitting ? (
61
+ <Loader2 className="size-3.5 animate-spin" />
62
+ ) : (
63
+ <Check className="size-3.5" />
64
+ )}
65
+ Approve
66
+ </Button>
67
+ <Button
68
+ size="sm"
69
+ variant="secondary"
70
+ onClick={() => handleAction(ApprovalAction.SKIP)}
71
+ disabled={isSubmitting}
72
+ >
73
+ <SkipForward className="size-3.5" />
74
+ Skip
75
+ </Button>
76
+ <Button
77
+ size="sm"
78
+ variant="destructive"
79
+ onClick={() => handleAction(ApprovalAction.REJECT)}
80
+ disabled={isSubmitting}
81
+ >
82
+ <X className="size-3.5" />
83
+ Reject
84
+ </Button>
85
+ {!showComment && (
86
+ <Button
87
+ size="sm"
88
+ variant="ghost"
89
+ onClick={() => setShowComment(true)}
90
+ disabled={isSubmitting}
91
+ className="ml-auto text-xs text-muted-foreground"
92
+ >
93
+ Add comment
94
+ </Button>
95
+ )}
96
+ </div>
97
+ </div>
98
+ );
99
+ }
@@ -0,0 +1,36 @@
1
+ import { Badge } from "../../internal/ui/badge";
2
+ import { phaseLabel, phaseVariant, isTerminalPhase } from "../helpers";
3
+ import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
4
+ import { cn } from "@stigmer/theme";
5
+ import { Loader2 } from "lucide-react";
6
+
7
+ interface ExecutionStatusProps {
8
+ phase: ExecutionPhase;
9
+ className?: string;
10
+ }
11
+
12
+ export function ExecutionStatus({ phase, className }: ExecutionStatusProps) {
13
+ const isActive =
14
+ phase === ExecutionPhase.EXECUTION_IN_PROGRESS ||
15
+ phase === ExecutionPhase.EXECUTION_PENDING;
16
+ const isWaiting =
17
+ phase === ExecutionPhase.EXECUTION_WAITING_FOR_APPROVAL;
18
+
19
+ return (
20
+ <Badge
21
+ variant={phaseVariant(phase)}
22
+ className={cn(
23
+ isWaiting && "animate-pulse",
24
+ className,
25
+ )}
26
+ >
27
+ {isActive && (
28
+ <Loader2 className="size-3 animate-spin" data-icon="inline-start" />
29
+ )}
30
+ {phaseLabel(phase)}
31
+ {isTerminalPhase(phase) && phase === ExecutionPhase.EXECUTION_COMPLETED && (
32
+ <span data-icon="inline-end">✓</span>
33
+ )}
34
+ </Badge>
35
+ );
36
+ }