@stigmer/react 0.0.52 → 0.0.54

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 (160) hide show
  1. package/deployment-mode.d.ts +35 -0
  2. package/deployment-mode.d.ts.map +1 -0
  3. package/deployment-mode.js +41 -0
  4. package/deployment-mode.js.map +1 -0
  5. package/execution/ApprovalCard.d.ts +8 -6
  6. package/execution/ApprovalCard.d.ts.map +1 -1
  7. package/execution/ApprovalCard.js +34 -96
  8. package/execution/ApprovalCard.js.map +1 -1
  9. package/execution/ArtifactCard.d.ts +11 -1
  10. package/execution/ArtifactCard.d.ts.map +1 -1
  11. package/execution/ArtifactCard.js +22 -3
  12. package/execution/ArtifactCard.js.map +1 -1
  13. package/execution/ArtifactPreviewModal.d.ts.map +1 -1
  14. package/execution/ArtifactPreviewModal.js +1 -1
  15. package/execution/ArtifactPreviewModal.js.map +1 -1
  16. package/execution/ArtifactsWidget.d.ts +26 -19
  17. package/execution/ArtifactsWidget.d.ts.map +1 -1
  18. package/execution/ArtifactsWidget.js +24 -26
  19. package/execution/ArtifactsWidget.js.map +1 -1
  20. package/execution/McpToolDetail.d.ts +48 -0
  21. package/execution/McpToolDetail.d.ts.map +1 -0
  22. package/execution/McpToolDetail.js +159 -0
  23. package/execution/McpToolDetail.js.map +1 -0
  24. package/execution/MessageThread.d.ts +10 -1
  25. package/execution/MessageThread.d.ts.map +1 -1
  26. package/execution/MessageThread.js +19 -17
  27. package/execution/MessageThread.js.map +1 -1
  28. package/execution/SandboxContext.d.ts +32 -0
  29. package/execution/SandboxContext.d.ts.map +1 -0
  30. package/execution/SandboxContext.js +26 -0
  31. package/execution/SandboxContext.js.map +1 -0
  32. package/execution/ToolArgsView.d.ts +41 -0
  33. package/execution/ToolArgsView.d.ts.map +1 -0
  34. package/execution/ToolArgsView.js +134 -0
  35. package/execution/ToolArgsView.js.map +1 -0
  36. package/execution/ToolCallDetail.d.ts +11 -4
  37. package/execution/ToolCallDetail.d.ts.map +1 -1
  38. package/execution/ToolCallDetail.js +32 -101
  39. package/execution/ToolCallDetail.js.map +1 -1
  40. package/execution/ToolCallGroup.d.ts.map +1 -1
  41. package/execution/ToolCallGroup.js +3 -2
  42. package/execution/ToolCallGroup.js.map +1 -1
  43. package/execution/ToolCallItem.d.ts +2 -0
  44. package/execution/ToolCallItem.d.ts.map +1 -1
  45. package/execution/ToolCallItem.js +13 -3
  46. package/execution/ToolCallItem.js.map +1 -1
  47. package/execution/WriteBackCard.d.ts +34 -0
  48. package/execution/WriteBackCard.d.ts.map +1 -0
  49. package/execution/WriteBackCard.js +75 -0
  50. package/execution/WriteBackCard.js.map +1 -0
  51. package/execution/WriteBacksWidget.d.ts +49 -0
  52. package/execution/WriteBacksWidget.d.ts.map +1 -0
  53. package/execution/WriteBacksWidget.js +44 -0
  54. package/execution/WriteBacksWidget.js.map +1 -0
  55. package/execution/__tests__/file-path-resolver.test.d.ts +2 -0
  56. package/execution/__tests__/file-path-resolver.test.d.ts.map +1 -0
  57. package/execution/__tests__/file-path-resolver.test.js +180 -0
  58. package/execution/__tests__/file-path-resolver.test.js.map +1 -0
  59. package/execution/file-path-resolver.d.ts +3 -3
  60. package/execution/file-path-resolver.d.ts.map +1 -1
  61. package/execution/file-path-resolver.js +23 -12
  62. package/execution/file-path-resolver.js.map +1 -1
  63. package/execution/index.d.ts +16 -1
  64. package/execution/index.d.ts.map +1 -1
  65. package/execution/index.js +9 -1
  66. package/execution/index.js.map +1 -1
  67. package/execution/sandbox-path-normalizer.d.ts +46 -0
  68. package/execution/sandbox-path-normalizer.d.ts.map +1 -0
  69. package/execution/sandbox-path-normalizer.js +73 -0
  70. package/execution/sandbox-path-normalizer.js.map +1 -0
  71. package/execution/tool-categories.d.ts +35 -8
  72. package/execution/tool-categories.d.ts.map +1 -1
  73. package/execution/tool-categories.js +76 -10
  74. package/execution/tool-categories.js.map +1 -1
  75. package/execution/tool-rendering-primitives.d.ts +61 -0
  76. package/execution/tool-rendering-primitives.d.ts.map +1 -0
  77. package/execution/tool-rendering-primitives.js +106 -0
  78. package/execution/tool-rendering-primitives.js.map +1 -0
  79. package/execution/useArtifactContent.d.ts +5 -1
  80. package/execution/useArtifactContent.d.ts.map +1 -1
  81. package/execution/useArtifactContent.js +6 -2
  82. package/execution/useArtifactContent.js.map +1 -1
  83. package/execution/useWorkspaceWriteBacks.d.ts +40 -0
  84. package/execution/useWorkspaceWriteBacks.d.ts.map +1 -0
  85. package/execution/useWorkspaceWriteBacks.js +41 -0
  86. package/execution/useWorkspaceWriteBacks.js.map +1 -0
  87. package/github/GitHubRepoPicker.d.ts +5 -2
  88. package/github/GitHubRepoPicker.d.ts.map +1 -1
  89. package/github/GitHubRepoPicker.js +133 -36
  90. package/github/GitHubRepoPicker.js.map +1 -1
  91. package/github/index.d.ts +1 -0
  92. package/github/index.d.ts.map +1 -1
  93. package/github/index.js +1 -0
  94. package/github/index.js.map +1 -1
  95. package/github/useGitHubSearch.d.ts +20 -0
  96. package/github/useGitHubSearch.d.ts.map +1 -0
  97. package/github/useGitHubSearch.js +127 -0
  98. package/github/useGitHubSearch.js.map +1 -0
  99. package/index.d.ts +9 -6
  100. package/index.d.ts.map +1 -1
  101. package/index.js +7 -3
  102. package/index.js.map +1 -1
  103. package/internal/CloudFeatureNotice.d.ts +19 -0
  104. package/internal/CloudFeatureNotice.d.ts.map +1 -0
  105. package/internal/CloudFeatureNotice.js +21 -0
  106. package/internal/CloudFeatureNotice.js.map +1 -0
  107. package/mcp-server/McpServerDetailView.d.ts +15 -1
  108. package/mcp-server/McpServerDetailView.d.ts.map +1 -1
  109. package/mcp-server/McpServerDetailView.js +11 -3
  110. package/mcp-server/McpServerDetailView.js.map +1 -1
  111. package/package.json +4 -4
  112. package/provider.d.ts +14 -2
  113. package/provider.d.ts.map +1 -1
  114. package/provider.js +3 -2
  115. package/provider.js.map +1 -1
  116. package/session/index.d.ts +4 -0
  117. package/session/index.d.ts.map +1 -1
  118. package/session/index.js +2 -0
  119. package/session/index.js.map +1 -1
  120. package/session/useSessionArtifacts.d.ts +73 -0
  121. package/session/useSessionArtifacts.d.ts.map +1 -0
  122. package/session/useSessionArtifacts.js +95 -0
  123. package/session/useSessionArtifacts.js.map +1 -0
  124. package/session/useSessionWriteBacks.d.ts +56 -0
  125. package/session/useSessionWriteBacks.d.ts.map +1 -0
  126. package/session/useSessionWriteBacks.js +56 -0
  127. package/session/useSessionWriteBacks.js.map +1 -0
  128. package/src/deployment-mode.ts +46 -0
  129. package/src/execution/ApprovalCard.tsx +130 -283
  130. package/src/execution/ArtifactCard.tsx +40 -0
  131. package/src/execution/ArtifactPreviewModal.tsx +2 -0
  132. package/src/execution/ArtifactsWidget.tsx +51 -43
  133. package/src/execution/McpToolDetail.tsx +283 -0
  134. package/src/execution/MessageThread.tsx +18 -0
  135. package/src/execution/SandboxContext.ts +47 -0
  136. package/src/execution/ToolArgsView.tsx +279 -0
  137. package/src/execution/ToolCallDetail.tsx +54 -220
  138. package/src/execution/ToolCallGroup.tsx +3 -2
  139. package/src/execution/ToolCallItem.tsx +21 -3
  140. package/src/execution/WriteBackCard.tsx +210 -0
  141. package/src/execution/WriteBacksWidget.tsx +82 -0
  142. package/src/execution/__tests__/file-path-resolver.test.ts +295 -0
  143. package/src/execution/file-path-resolver.ts +24 -12
  144. package/src/execution/index.ts +38 -0
  145. package/src/execution/sandbox-path-normalizer.ts +80 -0
  146. package/src/execution/tool-categories.ts +89 -9
  147. package/src/execution/tool-rendering-primitives.tsx +253 -0
  148. package/src/execution/useArtifactContent.ts +6 -1
  149. package/src/execution/useWorkspaceWriteBacks.ts +56 -0
  150. package/src/github/GitHubRepoPicker.tsx +413 -108
  151. package/src/github/index.ts +5 -0
  152. package/src/github/useGitHubSearch.ts +162 -0
  153. package/src/index.ts +27 -0
  154. package/src/internal/CloudFeatureNotice.tsx +60 -0
  155. package/src/mcp-server/McpServerDetailView.tsx +24 -2
  156. package/src/provider.tsx +18 -2
  157. package/src/session/index.ts +12 -0
  158. package/src/session/useSessionArtifacts.ts +143 -0
  159. package/src/session/useSessionWriteBacks.ts +94 -0
  160. package/styles.css +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/react",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "React provider and client hook for the Stigmer platform SDK",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "./styles.css": "./styles.css"
32
32
  },
33
33
  "dependencies": {
34
- "@stigmer/theme": "0.0.52",
34
+ "@stigmer/theme": "0.0.54",
35
35
  "react-markdown": "^10.1.0",
36
36
  "remark-gfm": "^4.0.1",
37
37
  "yaml": "^2.8.2"
@@ -39,8 +39,8 @@
39
39
  "peerDependencies": {
40
40
  "@base-ui/react": "^1.0.0",
41
41
  "@bufbuild/protobuf": "^2.0.0",
42
- "@stigmer/protos": "0.0.52",
43
- "@stigmer/sdk": "0.0.52",
42
+ "@stigmer/protos": "0.0.54",
43
+ "@stigmer/sdk": "0.0.54",
44
44
  "react": "^19.0.0",
45
45
  "react-dom": "^19.0.0"
46
46
  }
package/provider.d.ts CHANGED
@@ -1,10 +1,22 @@
1
1
  import type { ReactNode } from "react";
2
- import type { Stigmer } from "@stigmer/sdk";
2
+ import type { Stigmer, DeploymentMode } from "@stigmer/sdk";
3
3
  import type { ThemePresetId } from "@stigmer/theme";
4
4
  export interface StigmerProviderProps {
5
5
  /** A configured {@link Stigmer} client instance. */
6
6
  readonly client: Stigmer;
7
7
  readonly children: ReactNode;
8
+ /**
9
+ * Deployment mode of the connected Stigmer backend.
10
+ *
11
+ * - `"local"` — local Go CLI server (OSS). Cloud-only resources
12
+ * (API keys, IAM, identity management) are unavailable.
13
+ * - `"cloud"` — Stigmer Cloud. All resources are available.
14
+ *
15
+ * Defaults to `"cloud"` so existing consumers see no change.
16
+ * The Stigmer Console derives this from the API URL hostname.
17
+ * Platform builders pass it based on their deployment context.
18
+ */
19
+ readonly deploymentMode?: DeploymentMode;
8
20
  /**
9
21
  * Built-in theme preset to apply.
10
22
  *
@@ -51,5 +63,5 @@ export interface StigmerProviderProps {
51
63
  * </StigmerProvider>
52
64
  * ```
53
65
  */
54
- export declare function StigmerProvider({ client, children, preset, className, }: StigmerProviderProps): import("react/jsx-runtime").JSX.Element;
66
+ export declare function StigmerProvider({ client, children, deploymentMode, preset, className, }: StigmerProviderProps): import("react/jsx-runtime").JSX.Element;
55
67
  //# sourceMappingURL=provider.d.ts.map
package/provider.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,2CAQtB"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,cAAwB,EACxB,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,2CAUtB"}
package/provider.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cn, resolvePresetClass } from "@stigmer/theme";
4
4
  import { StigmerContext } from "./context";
5
+ import { DeploymentModeContext } from "./deployment-mode";
5
6
  /**
6
7
  * React provider that distributes a {@link Stigmer} SDK client to
7
8
  * descendant components via {@link StigmerContext}.
@@ -27,8 +28,8 @@ import { StigmerContext } from "./context";
27
28
  * </StigmerProvider>
28
29
  * ```
29
30
  */
30
- export function StigmerProvider({ client, children, preset, className, }) {
31
+ export function StigmerProvider({ client, children, deploymentMode = "cloud", preset, className, }) {
31
32
  const presetClass = preset ? resolvePresetClass(preset) : "";
32
- return (_jsx(StigmerContext.Provider, { value: client, children: _jsx("div", { className: cn("stgm", presetClass, className), children: children }) }));
33
+ return (_jsx(StigmerContext.Provider, { value: client, children: _jsx(DeploymentModeContext.Provider, { value: deploymentMode, children: _jsx("div", { className: cn("stgm", presetClass, className), children: children }) }) }));
33
34
  }
34
35
  //# sourceMappingURL=provider.js.map
package/provider.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["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E,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,YAAG,QAAQ,GAAO,GACrC,GACT,CAC3B,CAAC;AACJ,CAAC"}
@@ -10,6 +10,10 @@ export { useSessionExecutions } from "./useSessionExecutions";
10
10
  export type { UseSessionExecutionsReturn } from "./useSessionExecutions";
11
11
  export { useSessionConversation } from "./useSessionConversation";
12
12
  export type { SendFollowUpOptions, UseSessionConversationReturn, } from "./useSessionConversation";
13
+ export { useSessionArtifacts } from "./useSessionArtifacts";
14
+ export type { SessionArtifactEntry, UseSessionArtifactsReturn, } from "./useSessionArtifacts";
15
+ export { useSessionWriteBacks } from "./useSessionWriteBacks";
16
+ export type { SessionWriteBackEntry, UseSessionWriteBacksReturn, } from "./useSessionWriteBacks";
13
17
  export { useAgentRefFromSession } from "./useAgentRefFromSession";
14
18
  export type { UseAgentRefFromSessionReturn } from "./useAgentRefFromSession";
15
19
  export { groupSessionsByTime } from "./group-sessions";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,0BAA0B,EAAE,MAAM,wBA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V,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
package/session/index.js CHANGED
@@ -4,6 +4,8 @@ export { useSession } from "./useSession";
4
4
  export { useSessionList } from "./useSessionList";
5
5
  export { useSessionExecutions } from "./useSessionExecutions";
6
6
  export { useSessionConversation } from "./useSessionConversation";
7
+ export { useSessionArtifacts } from "./useSessionArtifacts";
8
+ export { useSessionWriteBacks } from "./useSessionWriteBacks";
7
9
  export { useAgentRefFromSession } from "./useAgentRefFromSession";
8
10
  export { groupSessionsByTime } from "./group-sessions";
9
11
  // Session utilities (re-exported from @stigmer/sdk)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,oDAAoD;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,oDAAoD;AACpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,73 @@
1
+ import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
2
+ import type { ExecutionArtifact } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/artifact_pb";
3
+ /**
4
+ * A single artifact entry enriched with the execution context needed
5
+ * for content fetching and Apply/Push gating.
6
+ *
7
+ * The `executionId` identifies which execution produced (or last
8
+ * updated) this artifact — required by {@link useArtifactContent} and
9
+ * {@link ArtifactPreviewModal}. `isTerminal` controls whether the
10
+ * Apply CTA is enabled in the preview modal.
11
+ */
12
+ export interface SessionArtifactEntry {
13
+ readonly artifact: ExecutionArtifact;
14
+ /** ID of the execution that produced this artifact version. */
15
+ readonly executionId: string;
16
+ /** Whether the producing execution is in a terminal phase. */
17
+ readonly isTerminal: boolean;
18
+ /**
19
+ * `true` when another artifact in the deduplicated list shares the
20
+ * same display `name` but has a different `sandbox_path`. Consumers
21
+ * use this to render path context for disambiguation.
22
+ */
23
+ readonly hasNameCollision: boolean;
24
+ }
25
+ export interface UseSessionArtifactsReturn {
26
+ /** Deduplicated, alphabetically-sorted artifacts from all executions. */
27
+ readonly artifacts: readonly SessionArtifactEntry[];
28
+ /** `true` when there is at least one artifact across all executions. */
29
+ readonly hasArtifacts: boolean;
30
+ /** Total number of deduplicated artifacts. */
31
+ readonly artifactCount: number;
32
+ }
33
+ /**
34
+ * Pure derivation hook that aggregates artifacts across all executions
35
+ * in a session into a unified, deduplicated, alphabetically-sorted
36
+ * list — like a file explorer showing the conversation's output.
37
+ *
38
+ * Follows the same `useMemo`-based pattern as
39
+ * {@link useExecutionArtifacts}: no side effects, no data fetching.
40
+ *
41
+ * **Dedup semantics:** Artifacts are keyed by `sandbox_path` (the
42
+ * original filesystem path in the agent sandbox). When multiple
43
+ * executions produce an artifact at the same path, the latest
44
+ * execution's version wins — matching filesystem overwrite semantics.
45
+ *
46
+ * **Sorting:** Entries are sorted alphabetically by display `name`
47
+ * (case-insensitive). This matches the file-explorer mental model
48
+ * where users scan by filename, not by creation order.
49
+ *
50
+ * **Name collision detection:** When two artifacts share the same
51
+ * display `name` but differ in `sandbox_path`, both entries are
52
+ * flagged with `hasNameCollision: true` so consumers can render path
53
+ * context for disambiguation.
54
+ *
55
+ * @param executions - All executions for a session, in chronological
56
+ * order (as returned by `listBySession`). Pass both completed and
57
+ * active-stream executions.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * const conv = useSessionConversation(sessionId, org);
62
+ * const allExecutions = [
63
+ * ...conv.completedExecutions,
64
+ * ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
65
+ * ];
66
+ * const { artifacts, hasArtifacts } = useSessionArtifacts(allExecutions);
67
+ * ```
68
+ *
69
+ * @see useExecutionArtifacts — single-execution artifact derivation
70
+ * @see ArtifactsWidget — styled component that renders this data
71
+ */
72
+ export declare function useSessionArtifacts(executions: readonly AgentExecution[]): UseSessionArtifactsReturn;
73
+ //# sourceMappingURL=useSessionArtifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionArtifacts.d.ts","sourceRoot":"","sources":["../../src/session/useSessionArtifacts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAI1G;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,yBAAyB;IACxC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACpD,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,yBAAyB,CAoD3B"}
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
4
+ import { isTerminalPhase } from "../execution/execution-phases";
5
+ /**
6
+ * Returns the dedup key for an artifact. Uses `sandbox_path` when
7
+ * available (stable filesystem identity within the session sandbox),
8
+ * falling back to `name` for older artifacts that predate the field.
9
+ */
10
+ function dedupKey(artifact) {
11
+ return artifact.sandboxPath || artifact.name;
12
+ }
13
+ /**
14
+ * Pure derivation hook that aggregates artifacts across all executions
15
+ * in a session into a unified, deduplicated, alphabetically-sorted
16
+ * list — like a file explorer showing the conversation's output.
17
+ *
18
+ * Follows the same `useMemo`-based pattern as
19
+ * {@link useExecutionArtifacts}: no side effects, no data fetching.
20
+ *
21
+ * **Dedup semantics:** Artifacts are keyed by `sandbox_path` (the
22
+ * original filesystem path in the agent sandbox). When multiple
23
+ * executions produce an artifact at the same path, the latest
24
+ * execution's version wins — matching filesystem overwrite semantics.
25
+ *
26
+ * **Sorting:** Entries are sorted alphabetically by display `name`
27
+ * (case-insensitive). This matches the file-explorer mental model
28
+ * where users scan by filename, not by creation order.
29
+ *
30
+ * **Name collision detection:** When two artifacts share the same
31
+ * display `name` but differ in `sandbox_path`, both entries are
32
+ * flagged with `hasNameCollision: true` so consumers can render path
33
+ * context for disambiguation.
34
+ *
35
+ * @param executions - All executions for a session, in chronological
36
+ * order (as returned by `listBySession`). Pass both completed and
37
+ * active-stream executions.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * const conv = useSessionConversation(sessionId, org);
42
+ * const allExecutions = [
43
+ * ...conv.completedExecutions,
44
+ * ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
45
+ * ];
46
+ * const { artifacts, hasArtifacts } = useSessionArtifacts(allExecutions);
47
+ * ```
48
+ *
49
+ * @see useExecutionArtifacts — single-execution artifact derivation
50
+ * @see ArtifactsWidget — styled component that renders this data
51
+ */
52
+ export function useSessionArtifacts(executions) {
53
+ return useMemo(() => {
54
+ const entryMap = new Map();
55
+ for (const execution of executions) {
56
+ const executionId = execution.metadata?.id ?? "";
57
+ const phase = execution.status?.phase ??
58
+ ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED;
59
+ const terminal = isTerminalPhase(phase);
60
+ for (const artifact of execution.status?.artifacts ?? []) {
61
+ const key = dedupKey(artifact);
62
+ entryMap.set(key, {
63
+ artifact,
64
+ executionId,
65
+ isTerminal: terminal,
66
+ hasNameCollision: false,
67
+ });
68
+ }
69
+ }
70
+ const entries = Array.from(entryMap.values());
71
+ entries.sort((a, b) => a.artifact.name.localeCompare(b.artifact.name, undefined, {
72
+ sensitivity: "base",
73
+ }));
74
+ // Detect name collisions: entries that share a display name but
75
+ // have different sandbox paths need path context for disambiguation.
76
+ const nameCount = new Map();
77
+ for (const entry of entries) {
78
+ const lower = entry.artifact.name.toLowerCase();
79
+ nameCount.set(lower, (nameCount.get(lower) ?? 0) + 1);
80
+ }
81
+ const result = entries.map((entry) => {
82
+ const lower = entry.artifact.name.toLowerCase();
83
+ if ((nameCount.get(lower) ?? 0) > 1) {
84
+ return { ...entry, hasNameCollision: true };
85
+ }
86
+ return entry;
87
+ });
88
+ return {
89
+ artifacts: result,
90
+ hasArtifacts: result.length > 0,
91
+ artifactCount: result.length,
92
+ };
93
+ }, [executions]);
94
+ }
95
+ //# sourceMappingURL=useSessionArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionArtifacts.js","sourceRoot":"","sources":["../../src/session/useSessionArtifacts.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAkChE;;;;GAIG;AACH,SAAS,QAAQ,CAAC,QAA2B;IAC3C,OAAO,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAqC;IAErC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MA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AAG,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,MAAM,GAA2B,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpC,OAAO,EAAE,GAAG,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;YAC9C,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,SAAS,EAAE,MAAM;YACjB,YAAY,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC;YAC/B,aAAa,EAAE,MAAM,CAAC,MAAM;SAC7B,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
2
+ import type { WorkspaceWriteBack } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/writeback_pb";
3
+ /**
4
+ * A single write-back entry enriched with the execution context that
5
+ * produced it.
6
+ *
7
+ * The `executionId` links the write-back to its originating execution
8
+ * for traceability in the UI (e.g., tooltip or detail view).
9
+ */
10
+ export interface SessionWriteBackEntry {
11
+ readonly writeBack: WorkspaceWriteBack;
12
+ /** ID of the execution that produced this write-back. */
13
+ readonly executionId: string;
14
+ }
15
+ export interface UseSessionWriteBacksReturn {
16
+ /** All write-backs from the session, ordered by workspace entry name. */
17
+ readonly writeBacks: readonly SessionWriteBackEntry[];
18
+ /** `true` when there is at least one write-back across all executions. */
19
+ readonly hasWriteBacks: boolean;
20
+ /** Total number of write-backs. */
21
+ readonly writeBackCount: number;
22
+ }
23
+ /**
24
+ * Pure derivation hook that aggregates workspace write-backs across all
25
+ * executions in a session into a flat, deduplicated list.
26
+ *
27
+ * Follows the same pattern as {@link useSessionArtifacts}: `useMemo`-based
28
+ * derivation, no side effects, no data fetching. Takes the same
29
+ * `executions` array input.
30
+ *
31
+ * **Dedup semantics:** Write-backs are keyed by `workspace_entry_name`.
32
+ * When multiple executions write back to the same workspace entry (e.g.,
33
+ * a follow-up execution on the same git repo), the latest execution's
34
+ * write-back wins — each execution creates its own branch/PR, and the
35
+ * most recent one is the one users care about.
36
+ *
37
+ * **Sorting:** Entries are sorted alphabetically by workspace entry name.
38
+ *
39
+ * @param executions - All executions for a session, in chronological
40
+ * order. Pass both completed and active-stream executions.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * const conv = useSessionConversation(sessionId, org);
45
+ * const allExecutions = [
46
+ * ...conv.completedExecutions,
47
+ * ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
48
+ * ];
49
+ * const { writeBacks, hasWriteBacks } = useSessionWriteBacks(allExecutions);
50
+ * ```
51
+ *
52
+ * @see useWorkspaceWriteBacks — single-execution write-back derivation
53
+ * @see WriteBackCard — component that renders a single write-back
54
+ */
55
+ export declare function useSessionWriteBacks(executions: readonly AgentExecution[]): UseSessionWriteBacksReturn;
56
+ //# sourceMappingURL=useSessionWriteBacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionWriteBacks.d.ts","sourceRoot":"","sources":["../../src/session/useSessionWriteBacks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AAE5G;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,yDAAyD;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACtD,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,mCAAmC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,0BAA0B,CA+B5B"}
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ /**
4
+ * Pure derivation hook that aggregates workspace write-backs across all
5
+ * executions in a session into a flat, deduplicated list.
6
+ *
7
+ * Follows the same pattern as {@link useSessionArtifacts}: `useMemo`-based
8
+ * derivation, no side effects, no data fetching. Takes the same
9
+ * `executions` array input.
10
+ *
11
+ * **Dedup semantics:** Write-backs are keyed by `workspace_entry_name`.
12
+ * When multiple executions write back to the same workspace entry (e.g.,
13
+ * a follow-up execution on the same git repo), the latest execution's
14
+ * write-back wins — each execution creates its own branch/PR, and the
15
+ * most recent one is the one users care about.
16
+ *
17
+ * **Sorting:** Entries are sorted alphabetically by workspace entry name.
18
+ *
19
+ * @param executions - All executions for a session, in chronological
20
+ * order. Pass both completed and active-stream executions.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const conv = useSessionConversation(sessionId, org);
25
+ * const allExecutions = [
26
+ * ...conv.completedExecutions,
27
+ * ...(conv.activeStreamExecution ? [conv.activeStreamExecution] : []),
28
+ * ];
29
+ * const { writeBacks, hasWriteBacks } = useSessionWriteBacks(allExecutions);
30
+ * ```
31
+ *
32
+ * @see useWorkspaceWriteBacks — single-execution write-back derivation
33
+ * @see WriteBackCard — component that renders a single write-back
34
+ */
35
+ export function useSessionWriteBacks(executions) {
36
+ return useMemo(() => {
37
+ const entryMap = new Map();
38
+ for (const execution of executions) {
39
+ const executionId = execution.metadata?.id ?? "";
40
+ for (const wb of execution.status?.workspaceWriteBacks ?? []) {
41
+ entryMap.set(wb.workspaceEntryName, {
42
+ writeBack: wb,
43
+ executionId,
44
+ });
45
+ }
46
+ }
47
+ const entries = Array.from(entryMap.values());
48
+ entries.sort((a, b) => a.writeBack.workspaceEntryName.localeCompare(b.writeBack.workspaceEntryName, undefined, { sensitivity: "base" }));
49
+ return {
50
+ writeBacks: entries,
51
+ hasWriteBacks: entries.length > 0,
52
+ writeBackCount: entries.length,
53
+ };
54
+ }, [executions]);
55
+ }
56
+ //# sourceMappingURL=useSessionWriteBacks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionWriteBacks.js","sourceRoot":"","sources":["../../src/session/useSessionWriteBacks.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AA0BhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAqC;IAErC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiC,CAAC;QAE1D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;YAEjD,KAAK,MAAM,EAAE,IAAI,SAAS,CAAC,MAAM,EAAE,mBAAmB,IAAI,EAAE,EAAE,CAAC;gBAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,EAAE;oBAClC,SAAS,EAAE,EAAE;oBACb,WAAW;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACpB,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,aAAa,CAC1C,CAAC,CAAC,SAAS,CAAC,kBAAkB,EAC9B,SAAS,EACT,EAAE,WAAW,EAAE,MAAM,EAAE,CACxB,CACF,CAAC;QAEF,OAAO;YACL,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;YACjC,cAAc,EAAE,OAAO,CAAC,MAAM;SAC/B,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { createContext, useContext } from "react";
4
+ import type { DeploymentMode } from "@stigmer/sdk";
5
+ import { isResourceAvailable, ApiResourceKind } from "@stigmer/sdk";
6
+
7
+ /**
8
+ * React context for the current deployment mode.
9
+ *
10
+ * Separated from the provider to mirror the `StigmerContext` / `context.ts`
11
+ * pattern and avoid circular imports.
12
+ *
13
+ * Defaults to `"cloud"` so existing consumers who don't pass
14
+ * `deploymentMode` to `StigmerProvider` see all features enabled.
15
+ */
16
+ export const DeploymentModeContext = createContext<DeploymentMode>("cloud");
17
+
18
+ /**
19
+ * Read the deployment mode from the nearest `StigmerProvider`.
20
+ *
21
+ * Returns `"local"` when connected to the local Go CLI server (OSS)
22
+ * and `"cloud"` when connected to Stigmer Cloud.
23
+ */
24
+ export function useDeploymentMode(): DeploymentMode {
25
+ return useContext(DeploymentModeContext);
26
+ }
27
+
28
+ /**
29
+ * Check whether a given {@link ApiResourceKind} is available in the
30
+ * current deployment mode.
31
+ *
32
+ * Combines the deployment mode from context with the proto-derived
33
+ * tier metadata via {@link isResourceAvailable}.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const available = useResourceAvailable(ApiResourceKind.api_key);
38
+ * if (!available) return <CloudFeatureNotice>...</CloudFeatureNotice>;
39
+ * ```
40
+ */
41
+ export function useResourceAvailable(kind: ApiResourceKind): boolean {
42
+ const mode = useDeploymentMode();
43
+ return isResourceAvailable(kind, mode);
44
+ }
45
+
46
+ export { type DeploymentMode, ApiResourceKind };