@stigmer/react 0.4.2 → 0.4.4
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/composer/ComposerToolbar.d.ts.map +1 -1
- package/composer/ComposerToolbar.js +1 -2
- package/composer/ComposerToolbar.js.map +1 -1
- package/composer/ConfigureMenu.d.ts.map +1 -1
- package/composer/ConfigureMenu.js +3 -1
- package/composer/ConfigureMenu.js.map +1 -1
- package/composer/ContextPopover.d.ts.map +1 -1
- package/composer/ContextPopover.js +3 -1
- package/composer/ContextPopover.js.map +1 -1
- package/github/useGitHubConnection.d.ts.map +1 -1
- package/github/useGitHubConnection.js +2 -4
- package/github/useGitHubConnection.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/internal/menu.d.ts.map +1 -1
- package/internal/menu.js +3 -1
- package/internal/menu.js.map +1 -1
- package/models/ModelSelector.d.ts.map +1 -1
- package/models/ModelSelector.js +24 -2
- package/models/ModelSelector.js.map +1 -1
- package/organization/OrgSwitcher.d.ts.map +1 -1
- package/organization/OrgSwitcher.js +3 -1
- package/organization/OrgSwitcher.js.map +1 -1
- package/package.json +4 -4
- package/portal-container.d.ts +54 -0
- package/portal-container.d.ts.map +1 -0
- package/portal-container.js +58 -0
- package/portal-container.js.map +1 -0
- package/provider.d.ts +1 -1
- package/provider.d.ts.map +1 -1
- package/provider.js +47 -1
- package/provider.js.map +1 -1
- package/runner/RunnerPicker.d.ts.map +1 -1
- package/runner/RunnerPicker.js +3 -1
- package/runner/RunnerPicker.js.map +1 -1
- package/src/composer/ComposerToolbar.tsx +2 -3
- package/src/composer/ConfigureMenu.tsx +4 -1
- package/src/composer/ContextPopover.tsx +4 -1
- package/src/github/useGitHubConnection.ts +2 -4
- package/src/index.ts +3 -0
- package/src/internal/menu.tsx +4 -1
- package/src/models/ModelSelector.tsx +76 -32
- package/src/organization/OrgSwitcher.tsx +3 -1
- package/src/portal-container.ts +60 -0
- package/src/provider.tsx +62 -7
- package/src/runner/RunnerPicker.tsx +3 -1
- package/src/workspace/WorkspaceEditor.tsx +37 -11
- package/styles.css +1 -1
- package/workspace/WorkspaceEditor.js +18 -4
- package/workspace/WorkspaceEditor.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "React provider and client hook for the Stigmer platform SDK",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@stigmer/theme": "0.4.
|
|
38
|
+
"@stigmer/theme": "0.4.4",
|
|
39
39
|
"react-markdown": "^10.1.0",
|
|
40
40
|
"remark-gfm": "^4.0.1",
|
|
41
41
|
"streamdown": "^2.5.0",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@base-ui/react": "^1.0.0",
|
|
46
46
|
"@bufbuild/protobuf": "^2.0.0",
|
|
47
|
-
"@stigmer/protos": "0.4.
|
|
48
|
-
"@stigmer/sdk": "0.4.
|
|
47
|
+
"@stigmer/protos": "0.4.4",
|
|
48
|
+
"@stigmer/sdk": "0.4.4",
|
|
49
49
|
"lucide-react": ">=0.400.0",
|
|
50
50
|
"react": "^19.0.0",
|
|
51
51
|
"react-dom": "^19.0.0",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React context that holds a reference to the managed portal container.
|
|
3
|
+
*
|
|
4
|
+
* `StigmerProvider` creates a `<div>` appended to `document.body` with
|
|
5
|
+
* the same scoping attributes (`class="stgm [preset]"`,
|
|
6
|
+
* `data-stgm-color-mode`) as the main provider container. This ensures
|
|
7
|
+
* that portaled content (popovers, dialogs, menus) inherits the correct
|
|
8
|
+
* design token values — including dark-mode overrides — even though it
|
|
9
|
+
* lives outside the provider's DOM subtree.
|
|
10
|
+
*
|
|
11
|
+
* Defaults to `null` so components rendered outside a `StigmerProvider`
|
|
12
|
+
* fall back to the browser's default portal target (`document.body`).
|
|
13
|
+
*
|
|
14
|
+
* @internal Consumed by SDK components; not part of the public API.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PortalContainerContext: import("react").Context<HTMLElement | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the managed portal container for the nearest `StigmerProvider`.
|
|
19
|
+
*
|
|
20
|
+
* SDK components that use `Popover.Portal`, `Dialog.Portal`,
|
|
21
|
+
* `Select.Portal`, or `Menu.Portal` pass the returned element as the
|
|
22
|
+
* `container` prop so that portaled content inherits `--stgm-*` design
|
|
23
|
+
* tokens (including dark-mode values).
|
|
24
|
+
*
|
|
25
|
+
* Returns `null` when called outside a `StigmerProvider`, which makes
|
|
26
|
+
* Base UI portals fall back to `document.body`. This keeps components
|
|
27
|
+
* functional (though un-themed) when used standalone.
|
|
28
|
+
*
|
|
29
|
+
* Platform builders who create custom portaled components should use
|
|
30
|
+
* this hook to target the same container as the built-in SDK components.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* import { Popover } from "@base-ui/react/popover";
|
|
35
|
+
* import { useStigmerPortalContainer } from "@stigmer/react";
|
|
36
|
+
*
|
|
37
|
+
* function MyPopover() {
|
|
38
|
+
* const portalContainer = useStigmerPortalContainer();
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <Popover.Root>
|
|
42
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
43
|
+
* <Popover.Portal container={portalContainer}>
|
|
44
|
+
* <Popover.Positioner>
|
|
45
|
+
* <Popover.Popup>Content</Popover.Popup>
|
|
46
|
+
* </Popover.Positioner>
|
|
47
|
+
* </Popover.Portal>
|
|
48
|
+
* </Popover.Root>
|
|
49
|
+
* );
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function useStigmerPortalContainer(): HTMLElement | null;
|
|
54
|
+
//# sourceMappingURL=portal-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-container.d.ts","sourceRoot":"","sources":["../src/portal-container.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,6CAA0C,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,yBAAyB,IAAI,WAAW,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* React context that holds a reference to the managed portal container.
|
|
5
|
+
*
|
|
6
|
+
* `StigmerProvider` creates a `<div>` appended to `document.body` with
|
|
7
|
+
* the same scoping attributes (`class="stgm [preset]"`,
|
|
8
|
+
* `data-stgm-color-mode`) as the main provider container. This ensures
|
|
9
|
+
* that portaled content (popovers, dialogs, menus) inherits the correct
|
|
10
|
+
* design token values — including dark-mode overrides — even though it
|
|
11
|
+
* lives outside the provider's DOM subtree.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `null` so components rendered outside a `StigmerProvider`
|
|
14
|
+
* fall back to the browser's default portal target (`document.body`).
|
|
15
|
+
*
|
|
16
|
+
* @internal Consumed by SDK components; not part of the public API.
|
|
17
|
+
*/
|
|
18
|
+
export const PortalContainerContext = createContext(null);
|
|
19
|
+
/**
|
|
20
|
+
* Returns the managed portal container for the nearest `StigmerProvider`.
|
|
21
|
+
*
|
|
22
|
+
* SDK components that use `Popover.Portal`, `Dialog.Portal`,
|
|
23
|
+
* `Select.Portal`, or `Menu.Portal` pass the returned element as the
|
|
24
|
+
* `container` prop so that portaled content inherits `--stgm-*` design
|
|
25
|
+
* tokens (including dark-mode values).
|
|
26
|
+
*
|
|
27
|
+
* Returns `null` when called outside a `StigmerProvider`, which makes
|
|
28
|
+
* Base UI portals fall back to `document.body`. This keeps components
|
|
29
|
+
* functional (though un-themed) when used standalone.
|
|
30
|
+
*
|
|
31
|
+
* Platform builders who create custom portaled components should use
|
|
32
|
+
* this hook to target the same container as the built-in SDK components.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { Popover } from "@base-ui/react/popover";
|
|
37
|
+
* import { useStigmerPortalContainer } from "@stigmer/react";
|
|
38
|
+
*
|
|
39
|
+
* function MyPopover() {
|
|
40
|
+
* const portalContainer = useStigmerPortalContainer();
|
|
41
|
+
*
|
|
42
|
+
* return (
|
|
43
|
+
* <Popover.Root>
|
|
44
|
+
* <Popover.Trigger>Open</Popover.Trigger>
|
|
45
|
+
* <Popover.Portal container={portalContainer}>
|
|
46
|
+
* <Popover.Positioner>
|
|
47
|
+
* <Popover.Popup>Content</Popover.Popup>
|
|
48
|
+
* </Popover.Positioner>
|
|
49
|
+
* </Popover.Portal>
|
|
50
|
+
* </Popover.Root>
|
|
51
|
+
* );
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function useStigmerPortalContainer() {
|
|
56
|
+
return useContext(PortalContainerContext);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=portal-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-container.js","sourceRoot":"","sources":["../src/portal-container.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC"}
|
package/provider.d.ts
CHANGED
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,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,cAAc,CAAC;AAIjE,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,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;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,EACR,cAAwB,EACxB,MAAM,EACN,SAAS,EACT,SAAmB,GACpB,EAAE,oBAAoB,2CAyBtB"}
|
package/provider.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
4
|
import { cn, resolvePresetClass } from "@stigmer/theme";
|
|
4
5
|
import { StigmerContext } from "./context";
|
|
5
6
|
import { DeploymentModeContext } from "./deployment-mode";
|
|
6
7
|
import { ColorModeContext, useSystemColorMode } from "./color-mode";
|
|
8
|
+
import { PortalContainerContext } from "./portal-container";
|
|
7
9
|
/**
|
|
8
10
|
* React provider that distributes a {@link Stigmer} SDK client to
|
|
9
11
|
* descendant components via {@link StigmerContext}.
|
|
@@ -38,6 +40,50 @@ export function StigmerProvider({ client, children, deploymentMode = "cloud", pr
|
|
|
38
40
|
const systemMode = useSystemColorMode();
|
|
39
41
|
const resolvedMode = colorMode === "system" ? systemMode : colorMode;
|
|
40
42
|
const presetClass = preset ? resolvePresetClass(preset) : "";
|
|
41
|
-
|
|
43
|
+
const portalContainer = usePortalContainer(resolvedMode, presetClass);
|
|
44
|
+
return (_jsx(StigmerContext.Provider, { value: client, children: _jsx(DeploymentModeContext.Provider, { value: deploymentMode, children: _jsx(ColorModeContext.Provider, { value: resolvedMode, children: _jsx(PortalContainerContext.Provider, { value: portalContainer, children: _jsx("div", { className: cn("stgm", presetClass, className), "data-stgm-color-mode": resolvedMode, children: children }) }) }) }) }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates and manages a portal container `<div>` appended to
|
|
48
|
+
* `document.body` that mirrors the scoping attributes of the main
|
|
49
|
+
* provider container.
|
|
50
|
+
*
|
|
51
|
+
* Portaled content (popovers, dialogs, menus) that targets this
|
|
52
|
+
* element will inherit the correct `--stgm-*` token values —
|
|
53
|
+
* including dark-mode overrides — because the container carries
|
|
54
|
+
* `data-stgm-color-mode` and the preset class.
|
|
55
|
+
*
|
|
56
|
+
* The element is created once on mount and removed on unmount.
|
|
57
|
+
* Attribute values are kept in sync with prop changes via a
|
|
58
|
+
* separate effect.
|
|
59
|
+
*
|
|
60
|
+
* Returns `null` during SSR (no `document`).
|
|
61
|
+
*/
|
|
62
|
+
function usePortalContainer(colorMode, presetClass) {
|
|
63
|
+
const elRef = useRef(null);
|
|
64
|
+
const [container, setContainer] = useState(null);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const el = document.createElement("div");
|
|
67
|
+
el.className = cn("stgm", presetClass);
|
|
68
|
+
el.setAttribute("data-stgm-color-mode", colorMode);
|
|
69
|
+
el.setAttribute("data-stgm-portal", "");
|
|
70
|
+
document.body.appendChild(el);
|
|
71
|
+
elRef.current = el;
|
|
72
|
+
setContainer(el);
|
|
73
|
+
return () => {
|
|
74
|
+
document.body.removeChild(el);
|
|
75
|
+
elRef.current = null;
|
|
76
|
+
};
|
|
77
|
+
// Intentionally empty deps: create once on mount, remove on unmount.
|
|
78
|
+
// Attribute syncing is handled by the effect below.
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const el = elRef.current;
|
|
82
|
+
if (!el)
|
|
83
|
+
return;
|
|
84
|
+
el.className = cn("stgm", presetClass);
|
|
85
|
+
el.setAttribute("data-stgm-color-mode", colorMode);
|
|
86
|
+
}, [colorMode, presetClass]);
|
|
87
|
+
return container;
|
|
42
88
|
}
|
|
43
89
|
//# sourceMappingURL=provider.js.map
|
package/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,qBAAq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,CAAC,CAAC;IAErE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzC,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACvC,EAAE,CAAC,YAAY,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;QACnD,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;QACxC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9B,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;QACnB,YAAY,CAAC,EAAE,CAAC,CAAC;QAEjB,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC9B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC;QACJ,qEAAqE;QACrE,oDAAoD;IACpD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QACzB,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACvC,EAAE,CAAC,YAAY,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAE7B,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunnerPicker.d.ts","sourceRoot":"","sources":["../../src/runner/RunnerPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RunnerPicker.d.ts","sourceRoot":"","sources":["../../src/runner/RunnerPicker.tsx"],"names":[],"mappings":"AAwBA,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,KAAK,EACL,QAAQ,EACR,cAAqB,EACrB,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,2CAwHnB"}
|
package/runner/RunnerPicker.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { Select } from "@base-ui/react/select";
|
|
5
5
|
import { RunnerPhase } from "@stigmer/protos/ai/stigmer/agentic/runner/v1/enum_pb";
|
|
6
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
6
7
|
import { useRunnerList } from "./useRunnerList";
|
|
7
8
|
import { isActivePhase, phaseLabel, phaseDotColor, PHASE_SORT_ORDER, } from "./phase";
|
|
8
9
|
/**
|
|
@@ -43,6 +44,7 @@ const AUTO_VALUE = "__auto__";
|
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
46
|
export function RunnerPicker({ org, value, onChange, showAutoOption = true, className, disabled, }) {
|
|
47
|
+
const portalContainer = useStigmerPortalContainer();
|
|
46
48
|
const { runners, isLoading } = useRunnerList(org);
|
|
47
49
|
const { active, inactive } = useMemo(() => {
|
|
48
50
|
const act = [];
|
|
@@ -80,7 +82,7 @@ export function RunnerPicker({ org, value, onChange, showAutoOption = true, clas
|
|
|
80
82
|
className,
|
|
81
83
|
]
|
|
82
84
|
.filter(Boolean)
|
|
83
|
-
.join(" "), children: [_jsx(RunnerIcon, {}), _jsx("span", { className: "max-w-[10rem] max-sm:max-w-[5rem] truncate", children: triggerLabel }), _jsx(ChevronIcon, {})] }), _jsx(Select.Portal, { children: _jsx(Select.Positioner, { sideOffset: 4, children: _jsxs(Select.Popup, { className: [
|
|
85
|
+
.join(" "), children: [_jsx(RunnerIcon, {}), _jsx("span", { className: "max-w-[10rem] max-sm:max-w-[5rem] truncate", children: triggerLabel }), _jsx(ChevronIcon, {})] }), _jsx(Select.Portal, { container: portalContainer, children: _jsx(Select.Positioner, { sideOffset: 4, children: _jsxs(Select.Popup, { className: [
|
|
84
86
|
"z-popover max-h-72 min-w-[var(--anchor-width)] overflow-auto",
|
|
85
87
|
"rounded-lg border border-border bg-popover p-1 shadow-md",
|
|
86
88
|
"text-popover-foreground",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunnerPicker.js","sourceRoot":"","sources":["../../src/runner/RunnerPicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,UAAU,CAAC;AA0B9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,GAA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uBAAuB,YAEjC,eAAM,CAAC,EAAC,2BAA2B,GAAG,GAClC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -97,7 +97,6 @@ export function ComposerToolbar({
|
|
|
97
97
|
const hasTier2 = configureItems.length > 0;
|
|
98
98
|
const showHarnessSeparate = showHarnessSelector && !showModelSelector;
|
|
99
99
|
const hasExecParams = showHarnessSeparate || showModelSelector;
|
|
100
|
-
const harnessLocked = harness !== undefined;
|
|
101
100
|
|
|
102
101
|
return (
|
|
103
102
|
<div className="flex items-center justify-between gap-2 border-t border-border-muted px-3 py-2">
|
|
@@ -174,8 +173,8 @@ export function ComposerToolbar({
|
|
|
174
173
|
<ModelSelector
|
|
175
174
|
value={modelId}
|
|
176
175
|
onValueChange={onModelChange}
|
|
177
|
-
harness={
|
|
178
|
-
|
|
176
|
+
harness={showHarnessSelector ? undefined : harness}
|
|
177
|
+
onHarnessChange={showHarnessSelector ? onHarnessChange : undefined}
|
|
179
178
|
disabled={disabled}
|
|
180
179
|
/>
|
|
181
180
|
)}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "@stigmer/theme";
|
|
4
4
|
import { Popover } from "@base-ui/react/popover";
|
|
5
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
5
6
|
import { ConfigureIcon } from "./icons";
|
|
6
7
|
|
|
7
8
|
export interface ConfigureMenuItem {
|
|
@@ -60,6 +61,8 @@ export function ConfigureMenu({
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
const portalContainer = useStigmerPortalContainer();
|
|
65
|
+
|
|
63
66
|
if (items.length === 0) return null;
|
|
64
67
|
|
|
65
68
|
const activePanelItem = activePanel
|
|
@@ -91,7 +94,7 @@ export function ConfigureMenu({
|
|
|
91
94
|
/>
|
|
92
95
|
)}
|
|
93
96
|
</Popover.Trigger>
|
|
94
|
-
<Popover.Portal>
|
|
97
|
+
<Popover.Portal container={portalContainer}>
|
|
95
98
|
<Popover.Positioner sideOffset={8} align="start">
|
|
96
99
|
<Popover.Popup
|
|
97
100
|
className={cn(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cn } from "@stigmer/theme";
|
|
2
2
|
import { Popover } from "@base-ui/react/popover";
|
|
3
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
3
4
|
|
|
4
5
|
export function ContextPopover({
|
|
5
6
|
icon,
|
|
@@ -21,6 +22,8 @@ export function ContextPopover({
|
|
|
21
22
|
/** When true, hides the text label on small viewports (icon-only). */
|
|
22
23
|
hideLabel?: boolean;
|
|
23
24
|
}) {
|
|
25
|
+
const portalContainer = useStigmerPortalContainer();
|
|
26
|
+
|
|
24
27
|
return (
|
|
25
28
|
<Popover.Root open={open} onOpenChange={onOpenChange}>
|
|
26
29
|
<Popover.Trigger
|
|
@@ -39,7 +42,7 @@ export function ContextPopover({
|
|
|
39
42
|
</span>
|
|
40
43
|
)}
|
|
41
44
|
</Popover.Trigger>
|
|
42
|
-
<Popover.Portal>
|
|
45
|
+
<Popover.Portal container={portalContainer}>
|
|
43
46
|
<Popover.Positioner sideOffset={8} align="start">
|
|
44
47
|
<Popover.Popup
|
|
45
48
|
className={[
|
|
@@ -480,10 +480,8 @@ export function useGitHubConnection(
|
|
|
480
480
|
const tokenVar = {
|
|
481
481
|
[GITHUB_TOKEN_KEY]: { value: accessToken, isSecret: true },
|
|
482
482
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
await personalEnvRef.current.addVariables(tokenVar);
|
|
486
|
-
}
|
|
483
|
+
await personalEnvRef.current.getOrCreate();
|
|
484
|
+
await personalEnvRef.current.addVariables(tokenVar);
|
|
487
485
|
|
|
488
486
|
setToken(accessToken);
|
|
489
487
|
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,9 @@ export { useStigmer } from "./hooks";
|
|
|
13
13
|
export { ColorModeContext, useColorMode } from "./color-mode";
|
|
14
14
|
export type { ColorMode, ResolvedColorMode } from "./color-mode";
|
|
15
15
|
|
|
16
|
+
// Portal container
|
|
17
|
+
export { useStigmerPortalContainer } from "./portal-container";
|
|
18
|
+
|
|
16
19
|
// Deployment mode and resource availability
|
|
17
20
|
export {
|
|
18
21
|
DeploymentModeContext,
|
package/src/internal/menu.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
5
5
|
import { cn } from "@stigmer/theme";
|
|
6
6
|
import { CheckIcon } from "lucide-react";
|
|
7
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
7
8
|
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
9
10
|
// SDK-internal styled Menu primitives over @base-ui/react.
|
|
@@ -35,8 +36,10 @@ function MenuContent({
|
|
|
35
36
|
MenuPrimitive.Positioner.Props,
|
|
36
37
|
"align" | "alignOffset" | "side" | "sideOffset"
|
|
37
38
|
>) {
|
|
39
|
+
const portalContainer = useStigmerPortalContainer();
|
|
40
|
+
|
|
38
41
|
return (
|
|
39
|
-
<MenuPrimitive.Portal>
|
|
42
|
+
<MenuPrimitive.Portal container={portalContainer}>
|
|
40
43
|
<MenuPrimitive.Positioner
|
|
41
44
|
className="isolate z-50 outline-none"
|
|
42
45
|
align={align}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { Popover } from "@base-ui/react/popover";
|
|
5
5
|
import { cn } from "@stigmer/theme";
|
|
6
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
6
7
|
import { useModelRegistry } from "./useModelRegistry";
|
|
7
8
|
import type { ModelInfo, CostTier, SpeedTier } from "./registry";
|
|
8
9
|
import { HARNESS_META, HARNESS_OPTIONS, type HarnessOption } from "./harness";
|
|
@@ -95,6 +96,8 @@ export function ModelSelector({
|
|
|
95
96
|
className,
|
|
96
97
|
disabled,
|
|
97
98
|
}: ModelSelectorProps) {
|
|
99
|
+
const portalContainer = useStigmerPortalContainer();
|
|
100
|
+
|
|
98
101
|
const isHarnessLocked = harness !== undefined;
|
|
99
102
|
const [internalHarness, setInternalHarness] = useState<HarnessOption>(harness ?? "native");
|
|
100
103
|
const activeHarness = harness ?? internalHarness;
|
|
@@ -104,6 +107,7 @@ export function ModelSelector({
|
|
|
104
107
|
);
|
|
105
108
|
|
|
106
109
|
const [open, setOpen] = useState(false);
|
|
110
|
+
const [harnessOpen, setHarnessOpen] = useState(false);
|
|
107
111
|
const [searchQuery, setSearchQuery] = useState("");
|
|
108
112
|
const [showAll, setShowAll] = useState(false);
|
|
109
113
|
const [highlightIdx, setHighlightIdx] = useState(-1);
|
|
@@ -171,6 +175,7 @@ export function ModelSelector({
|
|
|
171
175
|
setSearchQuery("");
|
|
172
176
|
setShowAll(false);
|
|
173
177
|
setHighlightIdx(-1);
|
|
178
|
+
setHarnessOpen(false);
|
|
174
179
|
}
|
|
175
180
|
}, [open]);
|
|
176
181
|
|
|
@@ -269,39 +274,83 @@ export function ModelSelector({
|
|
|
269
274
|
<ChevronIcon />
|
|
270
275
|
</Popover.Trigger>
|
|
271
276
|
|
|
272
|
-
<Popover.Portal>
|
|
277
|
+
<Popover.Portal container={portalContainer}>
|
|
273
278
|
<Popover.Positioner sideOffset={4}>
|
|
274
279
|
<Popover.Popup
|
|
275
280
|
role="dialog"
|
|
276
281
|
aria-label="Model selector"
|
|
277
282
|
className={cn(
|
|
278
|
-
"z-popover w-
|
|
283
|
+
"z-popover w-72 rounded-lg border border-border bg-popover shadow-md",
|
|
279
284
|
"text-popover-foreground",
|
|
280
285
|
)}
|
|
281
286
|
>
|
|
282
|
-
{/* Harness dropdown
|
|
283
|
-
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
{/* Harness selector — inline label + compact dropdown; disabled when locked */}
|
|
288
|
+
<div className="relative flex items-center justify-between border-b border-border px-3 py-2">
|
|
289
|
+
<span className="text-xs text-muted-foreground">Harness</span>
|
|
290
|
+
<button
|
|
291
|
+
type="button"
|
|
292
|
+
aria-haspopup="listbox"
|
|
293
|
+
aria-expanded={harnessOpen}
|
|
294
|
+
aria-label="Select harness"
|
|
295
|
+
disabled={isHarnessLocked}
|
|
296
|
+
className={cn(
|
|
297
|
+
"inline-flex items-center gap-1.5 rounded-md border border-border",
|
|
298
|
+
"bg-background px-2.5 py-1.5 text-xs text-foreground",
|
|
299
|
+
"transition-colors",
|
|
300
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
301
|
+
isHarnessLocked
|
|
302
|
+
? "cursor-not-allowed opacity-50"
|
|
303
|
+
: "hover:bg-accent-hover",
|
|
304
|
+
)}
|
|
305
|
+
onClick={() => {
|
|
306
|
+
if (!isHarnessLocked) setHarnessOpen(!harnessOpen);
|
|
307
|
+
}}
|
|
308
|
+
onKeyDown={(e) => {
|
|
309
|
+
if (e.key === "Escape" && harnessOpen) {
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
setHarnessOpen(false);
|
|
312
|
+
}
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
<span>{HARNESS_META[activeHarness].label}</span>
|
|
316
|
+
{!isHarnessLocked && <ChevronIcon />}
|
|
317
|
+
</button>
|
|
318
|
+
|
|
319
|
+
{!isHarnessLocked && harnessOpen && (
|
|
320
|
+
<div
|
|
321
|
+
role="listbox"
|
|
322
|
+
aria-label="Available harnesses"
|
|
291
323
|
className={cn(
|
|
292
|
-
"
|
|
293
|
-
"
|
|
324
|
+
"absolute right-3 top-full z-10 mt-1 overflow-hidden rounded-md border border-border",
|
|
325
|
+
"bg-popover shadow-md",
|
|
294
326
|
)}
|
|
295
|
-
aria-label="Select harness"
|
|
296
327
|
>
|
|
297
|
-
{resolvedHarnesses.map((h) =>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
328
|
+
{resolvedHarnesses.map((h) => {
|
|
329
|
+
const isActive = h === activeHarness;
|
|
330
|
+
return (
|
|
331
|
+
<button
|
|
332
|
+
key={h}
|
|
333
|
+
type="button"
|
|
334
|
+
role="option"
|
|
335
|
+
aria-selected={isActive}
|
|
336
|
+
className={cn(
|
|
337
|
+
"flex w-full items-center gap-2 px-2.5 py-1.5 text-xs transition-colors",
|
|
338
|
+
"hover:bg-accent-hover",
|
|
339
|
+
isActive && "font-medium",
|
|
340
|
+
)}
|
|
341
|
+
onClick={() => {
|
|
342
|
+
handleHarnessChange(h);
|
|
343
|
+
setHarnessOpen(false);
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
<span className="flex-1 text-left">{HARNESS_META[h].label}</span>
|
|
347
|
+
{isActive && <CheckIcon className="shrink-0 text-primary" />}
|
|
348
|
+
</button>
|
|
349
|
+
);
|
|
350
|
+
})}
|
|
351
|
+
</div>
|
|
352
|
+
)}
|
|
353
|
+
</div>
|
|
305
354
|
|
|
306
355
|
{/* Search input */}
|
|
307
356
|
<div className="border-b border-border px-3 py-1.5">
|
|
@@ -419,29 +468,24 @@ function ModelRow({
|
|
|
419
468
|
"transition-colors",
|
|
420
469
|
isHighlighted && "bg-accent text-accent-foreground",
|
|
421
470
|
!isHighlighted && "hover:bg-accent-hover",
|
|
422
|
-
isSelected && "font-medium",
|
|
423
471
|
)}
|
|
424
472
|
onClick={onClick}
|
|
425
473
|
onMouseEnter={onMouseEnter}
|
|
426
474
|
>
|
|
427
475
|
<div className="flex w-full items-center gap-2">
|
|
428
|
-
<span className="flex-1 truncate text-left">{model.displayName}</span>
|
|
429
|
-
|
|
430
|
-
{showSpeedBadge && (
|
|
431
|
-
<span className="shrink-0 text-[0.6rem] text-muted-foreground">
|
|
432
|
-
{SPEED_TIER_LABEL[model.speedTier]}
|
|
433
|
-
</span>
|
|
434
|
-
)}
|
|
476
|
+
<span className="flex-1 truncate text-left font-medium">{model.displayName}</span>
|
|
435
477
|
|
|
436
478
|
<span className="shrink-0 text-[0.6rem] text-muted-foreground">
|
|
437
|
-
{
|
|
479
|
+
{showSpeedBadge
|
|
480
|
+
? `${SPEED_TIER_LABEL[model.speedTier]} ${COST_TIER_LABEL[model.costTier]}`
|
|
481
|
+
: COST_TIER_LABEL[model.costTier]}
|
|
438
482
|
</span>
|
|
439
483
|
|
|
440
484
|
{isSelected && <CheckIcon className="shrink-0 text-primary" />}
|
|
441
485
|
</div>
|
|
442
486
|
|
|
443
487
|
{showDescription && model.shortDescription && (
|
|
444
|
-
<span className="mt-0.5 block text-left text-[0.
|
|
488
|
+
<span className="mt-0.5 block text-left text-[0.65rem] text-muted-foreground">
|
|
445
489
|
{model.shortDescription}
|
|
446
490
|
</span>
|
|
447
491
|
)}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
13
13
|
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
14
14
|
import { cn } from "@stigmer/theme";
|
|
15
|
+
import { useStigmerPortalContainer } from "../portal-container";
|
|
15
16
|
import {
|
|
16
17
|
Menu,
|
|
17
18
|
MenuContent,
|
|
@@ -66,6 +67,7 @@ export function OrgSwitcher({ onOrgChanged, className }: OrgSwitcherProps) {
|
|
|
66
67
|
const { orgs, activeOrg, setActiveOrg, isLoading, error, retry, refresh } =
|
|
67
68
|
useOrg();
|
|
68
69
|
const [createOpen, setCreateOpen] = useState(false);
|
|
70
|
+
const portalContainer = useStigmerPortalContainer();
|
|
69
71
|
|
|
70
72
|
const handleOrgSwitch = useCallback(
|
|
71
73
|
(slug: string) => {
|
|
@@ -188,7 +190,7 @@ export function OrgSwitcher({ onOrgChanged, className }: OrgSwitcherProps) {
|
|
|
188
190
|
open={createOpen}
|
|
189
191
|
onOpenChange={(open) => setCreateOpen(open)}
|
|
190
192
|
>
|
|
191
|
-
<DialogPrimitive.Portal>
|
|
193
|
+
<DialogPrimitive.Portal container={portalContainer}>
|
|
192
194
|
<DialogPrimitive.Backdrop
|
|
193
195
|
className={cn(
|
|
194
196
|
"fixed inset-0 z-50 bg-black/50",
|