@stigmer/react 3.1.7 → 3.1.8
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/agent/AgentDetailView.d.ts +9 -1
- package/agent/AgentDetailView.d.ts.map +1 -1
- package/agent/AgentDetailView.js +15 -4
- package/agent/AgentDetailView.js.map +1 -1
- package/environment/EnvironmentListPanel.d.ts.map +1 -1
- package/environment/EnvironmentListPanel.js +11 -3
- package/environment/EnvironmentListPanel.js.map +1 -1
- package/environment/EnvironmentVariableEditor.d.ts.map +1 -1
- package/environment/EnvironmentVariableEditor.js +9 -3
- package/environment/EnvironmentVariableEditor.js.map +1 -1
- package/environment/index.d.ts +1 -0
- package/environment/index.d.ts.map +1 -1
- package/environment/index.js +1 -0
- package/environment/index.js.map +1 -1
- package/environment/shareRestriction.d.ts +13 -0
- package/environment/shareRestriction.d.ts.map +1 -0
- package/environment/shareRestriction.js +15 -0
- package/environment/shareRestriction.js.map +1 -0
- package/execution/ToolCallItem.d.ts.map +1 -1
- package/execution/ToolCallItem.js +12 -0
- package/execution/ToolCallItem.js.map +1 -1
- package/execution/ToolRunGroup.js +4 -0
- package/execution/ToolRunGroup.js.map +1 -1
- package/execution/WriteBackCard.d.ts +14 -5
- package/execution/WriteBackCard.d.ts.map +1 -1
- package/execution/WriteBackCard.js +103 -32
- package/execution/WriteBackCard.js.map +1 -1
- package/execution/WriteBacksWidget.d.ts +1 -1
- package/execution/WriteBacksWidget.js +2 -2
- package/execution/WriteBacksWidget.js.map +1 -1
- package/execution/index.d.ts +2 -0
- package/execution/index.d.ts.map +1 -1
- package/execution/index.js +1 -0
- package/execution/index.js.map +1 -1
- package/execution/write-back-utils.d.ts +57 -0
- package/execution/write-back-utils.d.ts.map +1 -0
- package/execution/write-back-utils.js +81 -0
- package/execution/write-back-utils.js.map +1 -0
- package/index.d.ts +6 -2
- package/index.d.ts.map +1 -1
- package/index.js +6 -1
- package/index.js.map +1 -1
- package/internal/dev/dom-counter.d.ts.map +1 -1
- package/internal/dev/dom-counter.js +2 -2
- package/internal/dev/dom-counter.js.map +1 -1
- package/internal/dev/enabled.d.ts +7 -0
- package/internal/dev/enabled.d.ts.map +1 -0
- package/internal/dev/enabled.js +38 -0
- package/internal/dev/enabled.js.map +1 -0
- package/internal/dev/profiler-wrapper.d.ts +3 -3
- package/internal/dev/profiler-wrapper.d.ts.map +1 -1
- package/internal/dev/profiler-wrapper.js +5 -5
- package/internal/dev/profiler-wrapper.js.map +1 -1
- package/internal/dev/use-key-stability.d.ts.map +1 -1
- package/internal/dev/use-key-stability.js +2 -2
- package/internal/dev/use-key-stability.js.map +1 -1
- package/internal/dev/use-render-tracer.d.ts +2 -2
- package/internal/dev/use-render-tracer.d.ts.map +1 -1
- package/internal/dev/use-render-tracer.js +4 -4
- package/internal/dev/use-render-tracer.js.map +1 -1
- package/internal/dev/use-stream-rate.d.ts +2 -1
- package/internal/dev/use-stream-rate.d.ts.map +1 -1
- package/internal/dev/use-stream-rate.js +4 -3
- package/internal/dev/use-stream-rate.js.map +1 -1
- package/library/ResourceVisibilityControl.d.ts +3 -0
- package/library/ResourceVisibilityControl.d.ts.map +1 -1
- package/library/ResourceVisibilityControl.js +22 -8
- package/library/ResourceVisibilityControl.js.map +1 -1
- package/library/useUpdateVisibility.d.ts +5 -3
- package/library/useUpdateVisibility.d.ts.map +1 -1
- package/library/useUpdateVisibility.js +7 -2
- package/library/useUpdateVisibility.js.map +1 -1
- package/library/visibilityLevels.d.ts +17 -0
- package/library/visibilityLevels.d.ts.map +1 -1
- package/library/visibilityLevels.js +32 -0
- package/library/visibilityLevels.js.map +1 -1
- package/package.json +4 -4
- package/session/NewSessionViewer.d.ts +11 -1
- package/session/NewSessionViewer.d.ts.map +1 -1
- package/session/NewSessionViewer.js +28 -8
- package/session/NewSessionViewer.js.map +1 -1
- package/session/SessionViewer.d.ts +9 -2
- package/session/SessionViewer.d.ts.map +1 -1
- package/session/SessionViewer.js +26 -12
- package/session/SessionViewer.js.map +1 -1
- package/session/audience.d.ts +12 -4
- package/session/audience.d.ts.map +1 -1
- package/session/facets/ChangesTab.d.ts.map +1 -1
- package/session/facets/ChangesTab.js +3 -1
- package/session/facets/ChangesTab.js.map +1 -1
- package/session/useNewSessionFlow.d.ts +12 -0
- package/session/useNewSessionFlow.d.ts.map +1 -1
- package/session/useNewSessionFlow.js +13 -1
- package/session/useNewSessionFlow.js.map +1 -1
- package/session/useSessionPageFlow.d.ts +13 -0
- package/session/useSessionPageFlow.d.ts.map +1 -1
- package/session/useSessionPageFlow.js +7 -2
- package/session/useSessionPageFlow.js.map +1 -1
- package/sharing/ShareAgentDialog.d.ts +55 -0
- package/sharing/ShareAgentDialog.d.ts.map +1 -0
- package/sharing/ShareAgentDialog.js +393 -0
- package/sharing/ShareAgentDialog.js.map +1 -0
- package/sharing/SharedAgentChat.d.ts +84 -0
- package/sharing/SharedAgentChat.d.ts.map +1 -0
- package/sharing/SharedAgentChat.js +80 -0
- package/sharing/SharedAgentChat.js.map +1 -0
- package/sharing/index.d.ts +16 -0
- package/sharing/index.d.ts.map +1 -0
- package/sharing/index.js +11 -0
- package/sharing/index.js.map +1 -0
- package/sharing/useRotateShareLink.d.ts +42 -0
- package/sharing/useRotateShareLink.d.ts.map +1 -0
- package/sharing/useRotateShareLink.js +55 -0
- package/sharing/useRotateShareLink.js.map +1 -0
- package/sharing/useShareAgent.d.ts +68 -0
- package/sharing/useShareAgent.d.ts.map +1 -0
- package/sharing/useShareAgent.js +41 -0
- package/sharing/useShareAgent.js.map +1 -0
- package/sharing/useShareToolReadiness.d.ts +48 -0
- package/sharing/useShareToolReadiness.d.ts.map +1 -0
- package/sharing/useShareToolReadiness.js +93 -0
- package/sharing/useShareToolReadiness.js.map +1 -0
- package/sharing/useSharedAgentProfile.d.ts +84 -0
- package/sharing/useSharedAgentProfile.d.ts.map +1 -0
- package/sharing/useSharedAgentProfile.js +72 -0
- package/sharing/useSharedAgentProfile.js.map +1 -0
- package/sharing/useUpdateAgentSharing.d.ts +86 -0
- package/sharing/useUpdateAgentSharing.d.ts.map +1 -0
- package/sharing/useUpdateAgentSharing.js +81 -0
- package/sharing/useUpdateAgentSharing.js.map +1 -0
- package/src/agent/AgentDetailView.tsx +28 -3
- package/src/environment/EnvironmentListPanel.tsx +47 -18
- package/src/environment/EnvironmentVariableEditor.tsx +27 -17
- package/src/environment/__tests__/shareRestriction.test.ts +35 -0
- package/src/environment/index.ts +5 -0
- package/src/environment/shareRestriction.ts +22 -0
- package/src/execution/ToolCallItem.tsx +19 -1
- package/src/execution/ToolRunGroup.tsx +4 -0
- package/src/execution/WriteBackCard.tsx +285 -88
- package/src/execution/WriteBacksWidget.tsx +5 -5
- package/src/execution/__tests__/ToolCallItem.test.tsx +51 -0
- package/src/execution/__tests__/ToolRunGroup.test.tsx +22 -0
- package/src/execution/__tests__/WriteBackCard.test.tsx +64 -10
- package/src/execution/__tests__/write-back-utils.test.ts +135 -0
- package/src/execution/index.ts +7 -0
- package/src/execution/write-back-utils.ts +107 -0
- package/src/index.ts +34 -0
- package/src/internal/dev/__tests__/use-key-stability.test.ts +4 -0
- package/src/internal/dev/__tests__/use-render-tracer.test.ts +4 -0
- package/src/internal/dev/dom-counter.ts +2 -3
- package/src/internal/dev/enabled.ts +39 -0
- package/src/internal/dev/profiler-wrapper.tsx +5 -6
- package/src/internal/dev/use-key-stability.ts +2 -3
- package/src/internal/dev/use-render-tracer.ts +4 -5
- package/src/internal/dev/use-stream-rate.ts +4 -4
- package/src/library/ResourceVisibilityControl.tsx +23 -7
- package/src/library/__tests__/visibilityLevels.test.ts +33 -0
- package/src/library/useUpdateVisibility.ts +9 -3
- package/src/library/visibilityLevels.ts +36 -0
- package/src/session/NewSessionViewer.tsx +67 -31
- package/src/session/SessionViewer.tsx +67 -36
- package/src/session/__tests__/audienceWiring.test.tsx +99 -0
- package/src/session/__tests__/useNewSessionFlow.test.tsx +75 -1
- package/src/session/__tests__/useSessionPageFlow.guest.test.tsx +112 -0
- package/src/session/audience.ts +12 -4
- package/src/session/facets/ChangesTab.tsx +6 -4
- package/src/session/useNewSessionFlow.ts +26 -1
- package/src/session/useSessionPageFlow.ts +24 -2
- package/src/sharing/ShareAgentDialog.tsx +1255 -0
- package/src/sharing/SharedAgentChat.tsx +283 -0
- package/src/sharing/__tests__/ShareAgentDialog.test.tsx +745 -0
- package/src/sharing/__tests__/SharedAgentChat.test.tsx +222 -0
- package/src/sharing/__tests__/useRotateShareLink.test.tsx +96 -0
- package/src/sharing/__tests__/useShareAgent.test.tsx +127 -0
- package/src/sharing/__tests__/useShareToolReadiness.test.tsx +182 -0
- package/src/sharing/__tests__/useSharedAgentProfile.test.tsx +201 -0
- package/src/sharing/__tests__/useUpdateAgentSharing.test.tsx +200 -0
- package/src/sharing/index.ts +30 -0
- package/src/sharing/useRotateShareLink.ts +76 -0
- package/src/sharing/useShareAgent.tsx +106 -0
- package/src/sharing/useShareToolReadiness.ts +129 -0
- package/src/sharing/useSharedAgentProfile.ts +131 -0
- package/src/sharing/useUpdateAgentSharing.ts +151 -0
- package/src/switch/Switch.tsx +92 -0
- package/src/switch/__tests__/Switch.test.tsx +88 -0
- package/src/switch/index.ts +2 -0
- package/styles.css +1 -1
- package/switch/Switch.d.ts +47 -0
- package/switch/Switch.d.ts.map +1 -0
- package/switch/Switch.js +36 -0
- package/switch/Switch.js.map +1 -0
- package/switch/index.d.ts +3 -0
- package/switch/index.d.ts.map +1 -0
- package/switch/index.js +2 -0
- package/switch/index.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedAgentChat.js","sourceRoot":"","sources":["../../src/sharing/SharedAgentChat.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO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I,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,EAAE,CACX,uFAAuF,EACvF,2DAA2D,EAC3D,mBAAmB,CACpB,0BAGM,CACV,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { useSharedAgentProfile } from "./useSharedAgentProfile.js";
|
|
2
|
+
export type { UseSharedAgentProfileOptions, UseSharedAgentProfileReturn, } from "./useSharedAgentProfile.js";
|
|
3
|
+
export { SharedAgentChat } from "./SharedAgentChat.js";
|
|
4
|
+
export type { SharedAgentChatProps } from "./SharedAgentChat.js";
|
|
5
|
+
export { sharingAudienceFromProto, useUpdateAgentSharing, } from "./useUpdateAgentSharing.js";
|
|
6
|
+
export { useRotateShareLink } from "./useRotateShareLink.js";
|
|
7
|
+
export type { UseRotateShareLinkReturn } from "./useRotateShareLink.js";
|
|
8
|
+
export type { AgentSharingDraft, SharingAudience, UseUpdateAgentSharingReturn, } from "./useUpdateAgentSharing.js";
|
|
9
|
+
export { ShareAgentDialog } from "./ShareAgentDialog.js";
|
|
10
|
+
export type { ShareAgentDialogProps } from "./ShareAgentDialog.js";
|
|
11
|
+
export { useShareAgent } from "./useShareAgent.js";
|
|
12
|
+
export type { UseShareAgentArgs, UseShareAgentReturn, } from "./useShareAgent.js";
|
|
13
|
+
export { useShareToolReadiness } from "./useShareToolReadiness.js";
|
|
14
|
+
export type { ShareToolReadiness } from "./useShareToolReadiness.js";
|
|
15
|
+
export { validateOrigin, MAX_ALLOWED_ORIGINS } from "@stigmer/sdk";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sharing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
package/sharing/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { useSharedAgentProfile } from "./useSharedAgentProfile.js";
|
|
2
|
+
export { SharedAgentChat } from "./SharedAgentChat.js";
|
|
3
|
+
export { sharingAudienceFromProto, useUpdateAgentSharing, } from "./useUpdateAgentSharing.js";
|
|
4
|
+
export { useRotateShareLink } from "./useRotateShareLink.js";
|
|
5
|
+
export { ShareAgentDialog } from "./ShareAgentDialog.js";
|
|
6
|
+
export { useShareAgent } from "./useShareAgent.js";
|
|
7
|
+
export { useShareToolReadiness } from "./useShareToolReadiness.js";
|
|
8
|
+
// Origin validation moved to @stigmer/sdk (framework-free, shared with the
|
|
9
|
+
// CLI); re-exported here so existing @stigmer/react importers keep working.
|
|
10
|
+
export { validateOrigin, MAX_ALLOWED_ORIGINS } from "@stigmer/sdk";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sharing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,2EAA2E;AAC3E,4EAA4E;AAC5E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
2
|
+
/** Return value of {@link useRotateShareLink}. */
|
|
3
|
+
export interface UseRotateShareLinkReturn {
|
|
4
|
+
/**
|
|
5
|
+
* Rotate the agent's share-link token via the `rotateShareLink` RPC.
|
|
6
|
+
* Resolves with the updated agent, whose `status.shareLinkToken`
|
|
7
|
+
* carries the new token for building the fresh share URL.
|
|
8
|
+
*/
|
|
9
|
+
readonly rotateShareLink: () => Promise<Agent | undefined>;
|
|
10
|
+
/** `true` while the RPC is in flight. */
|
|
11
|
+
readonly isPending: boolean;
|
|
12
|
+
/** The last error from the RPC, or `null`. */
|
|
13
|
+
readonly error: Error | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Behavior hook that rotates an agent's share-link token.
|
|
17
|
+
*
|
|
18
|
+
* Wraps the `stigmer.agent.rotateShareLink()` RPC (authorized by
|
|
19
|
+
* `can_edit`) with loading and error state management. The server
|
|
20
|
+
* generates the token — there is nothing to supply — and the previous
|
|
21
|
+
* link stops working the moment the call resolves, including for
|
|
22
|
+
* visitors mid-conversation. The token lives in `status.shareLinkToken`
|
|
23
|
+
* (server-owned), so it is never part of a sharing draft and survives
|
|
24
|
+
* manifest applies.
|
|
25
|
+
*
|
|
26
|
+
* The hook is stateless with respect to the agent — adopt the returned
|
|
27
|
+
* agent (or refetch) so the UI shows the new tokened link, matching the
|
|
28
|
+
* {@link useUpdateAgentSharing} convention.
|
|
29
|
+
*
|
|
30
|
+
* Pass `null` for `agentId` to produce a stable no-op (useful while the
|
|
31
|
+
* agent is still loading).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const { rotateShareLink, isPending } = useRotateShareLink(agent.metadata.id);
|
|
36
|
+
*
|
|
37
|
+
* const updated = await rotateShareLink();
|
|
38
|
+
* // updated.status.shareLinkToken is the new token
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function useRotateShareLink(agentId: string | null): UseRotateShareLinkReturn;
|
|
42
|
+
//# sourceMappingURL=useRotateShareLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRotateShareLink.d.ts","sourceRoot":"","sources":["../../src/sharing/useRotateShareLink.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAKhF,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC3D,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,wBAAwB,CAwB1B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { create } from "@bufbuild/protobuf";
|
|
4
|
+
import { RotateShareLinkInputSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
|
|
5
|
+
import { useStigmer } from "../hooks.js";
|
|
6
|
+
import { toError } from "../internal/toError.js";
|
|
7
|
+
/**
|
|
8
|
+
* Behavior hook that rotates an agent's share-link token.
|
|
9
|
+
*
|
|
10
|
+
* Wraps the `stigmer.agent.rotateShareLink()` RPC (authorized by
|
|
11
|
+
* `can_edit`) with loading and error state management. The server
|
|
12
|
+
* generates the token — there is nothing to supply — and the previous
|
|
13
|
+
* link stops working the moment the call resolves, including for
|
|
14
|
+
* visitors mid-conversation. The token lives in `status.shareLinkToken`
|
|
15
|
+
* (server-owned), so it is never part of a sharing draft and survives
|
|
16
|
+
* manifest applies.
|
|
17
|
+
*
|
|
18
|
+
* The hook is stateless with respect to the agent — adopt the returned
|
|
19
|
+
* agent (or refetch) so the UI shows the new tokened link, matching the
|
|
20
|
+
* {@link useUpdateAgentSharing} convention.
|
|
21
|
+
*
|
|
22
|
+
* Pass `null` for `agentId` to produce a stable no-op (useful while the
|
|
23
|
+
* agent is still loading).
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { rotateShareLink, isPending } = useRotateShareLink(agent.metadata.id);
|
|
28
|
+
*
|
|
29
|
+
* const updated = await rotateShareLink();
|
|
30
|
+
* // updated.status.shareLinkToken is the new token
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function useRotateShareLink(agentId) {
|
|
34
|
+
const stigmer = useStigmer();
|
|
35
|
+
const [isPending, setIsPending] = useState(false);
|
|
36
|
+
const [error, setError] = useState(null);
|
|
37
|
+
const rotateShareLink = useCallback(async () => {
|
|
38
|
+
if (!agentId)
|
|
39
|
+
return undefined;
|
|
40
|
+
setIsPending(true);
|
|
41
|
+
setError(null);
|
|
42
|
+
try {
|
|
43
|
+
return await stigmer.agent.rotateShareLink(create(RotateShareLinkInputSchema, { resourceId: agentId }));
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
setError(toError(err));
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
setIsPending(false);
|
|
51
|
+
}
|
|
52
|
+
}, [agentId, stigmer]);
|
|
53
|
+
return { rotateShareLink, isPending, error };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=useRotateShareLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRotateShareLink.js","sourceRoot":"","sources":["../../src/sharing/useRotateShareLink.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAgBjD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAsB;IAEtB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,IAAgC,EAAE;QACzE,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,eAAe,CACxC,MAAM,CAAC,0BAA0B,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAC5D,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvB,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
3
|
+
import type { DetailAction } from "../resource-detail/types.js";
|
|
4
|
+
/** Arguments for {@link useShareAgent}. */
|
|
5
|
+
export interface UseShareAgentArgs {
|
|
6
|
+
/**
|
|
7
|
+
* The agent whose sharing is managed, or `null` while it is still
|
|
8
|
+
* loading. When `null`, {@link UseShareAgentReturn.action} is `null`
|
|
9
|
+
* and the dialog renders nothing — safe to call before the resource
|
|
10
|
+
* is ready.
|
|
11
|
+
*/
|
|
12
|
+
readonly agent: Agent | null;
|
|
13
|
+
/**
|
|
14
|
+
* Builds the absolute public chat URL for the shared agent. The host
|
|
15
|
+
* application owns URL construction (its configured public origin may
|
|
16
|
+
* differ from the rendering origin — e.g. the desktop app). When
|
|
17
|
+
* omitted, the dialog falls back to the relative `/chat/<org>/<slug>`.
|
|
18
|
+
*/
|
|
19
|
+
readonly buildShareUrl?: (org: string, slug: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Called after any sharing change is persisted. Hosts typically pass
|
|
22
|
+
* the agent data hook's `refetch`.
|
|
23
|
+
*/
|
|
24
|
+
readonly onSharingChanged?: () => void;
|
|
25
|
+
/** Menu-item label. @default "Share" */
|
|
26
|
+
readonly label?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Return value of {@link useShareAgent}. */
|
|
29
|
+
export interface UseShareAgentReturn {
|
|
30
|
+
/**
|
|
31
|
+
* A ready-to-spread {@link DetailAction} for a kebab/overflow menu, or
|
|
32
|
+
* `null` when the agent is unavailable or the user lacks `can_edit`.
|
|
33
|
+
* Lives in the `"sharing"` group, beside "Manage access".
|
|
34
|
+
*/
|
|
35
|
+
readonly action: DetailAction | null;
|
|
36
|
+
/** The {@link ShareAgentDialog} node — render it once in the host tree. */
|
|
37
|
+
readonly dialog: ReactNode;
|
|
38
|
+
/** Imperatively open the dialog. */
|
|
39
|
+
readonly open: () => void;
|
|
40
|
+
/** Whether the dialog is currently open. */
|
|
41
|
+
readonly isOpen: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wires the Share dialog to a kebab/overflow menu — the same trigger
|
|
45
|
+
* shape as {@link useManageAccess}, its conceptual sibling: Manage access
|
|
46
|
+
* governs who can *read* the blueprint; Share governs who can *chat* with
|
|
47
|
+
* the running agent (billed to the owning org).
|
|
48
|
+
*
|
|
49
|
+
* Owns the open-state and the `can_edit` gate — the same permission the
|
|
50
|
+
* `updateSharing` RPC enforces, so the action never appears to a user
|
|
51
|
+
* whose changes would be rejected. Returns a `null` action while the
|
|
52
|
+
* agent is loading or the user cannot edit, so the host can
|
|
53
|
+
* unconditionally fold `action` into its actions array.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* const share = useShareAgent({
|
|
58
|
+
* agent,
|
|
59
|
+
* buildShareUrl: (org, slug) => `${appOrigin}/chat/${org}/${slug}`,
|
|
60
|
+
* onSharingChanged: refetch,
|
|
61
|
+
* });
|
|
62
|
+
* // ...
|
|
63
|
+
* <ResourceDetailShell actions={share.action ? [...actions, share.action] : actions} ... />
|
|
64
|
+
* {share.dialog}
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function useShareAgent({ agent, buildShareUrl, onSharingChanged, label, }: UseShareAgentArgs): UseShareAgentReturn;
|
|
68
|
+
//# sourceMappingURL=useShareAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareAgent.d.ts","sourceRoot":"","sources":["../../src/sharing/useShareAgent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/D;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IACvC,wCAAwC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,KAAe,GAChB,EAAE,iBAAiB,GAAG,mBAAmB,CA2BzC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { useCheckPermission } from "../iam-policy/useCheckPermission.js";
|
|
5
|
+
import { ShareAgentDialog } from "./ShareAgentDialog.js";
|
|
6
|
+
/**
|
|
7
|
+
* Wires the Share dialog to a kebab/overflow menu — the same trigger
|
|
8
|
+
* shape as {@link useManageAccess}, its conceptual sibling: Manage access
|
|
9
|
+
* governs who can *read* the blueprint; Share governs who can *chat* with
|
|
10
|
+
* the running agent (billed to the owning org).
|
|
11
|
+
*
|
|
12
|
+
* Owns the open-state and the `can_edit` gate — the same permission the
|
|
13
|
+
* `updateSharing` RPC enforces, so the action never appears to a user
|
|
14
|
+
* whose changes would be rejected. Returns a `null` action while the
|
|
15
|
+
* agent is loading or the user cannot edit, so the host can
|
|
16
|
+
* unconditionally fold `action` into its actions array.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const share = useShareAgent({
|
|
21
|
+
* agent,
|
|
22
|
+
* buildShareUrl: (org, slug) => `${appOrigin}/chat/${org}/${slug}`,
|
|
23
|
+
* onSharingChanged: refetch,
|
|
24
|
+
* });
|
|
25
|
+
* // ...
|
|
26
|
+
* <ResourceDetailShell actions={share.action ? [...actions, share.action] : actions} ... />
|
|
27
|
+
* {share.dialog}
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function useShareAgent({ agent, buildShareUrl, onSharingChanged, label = "Share", }) {
|
|
31
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
32
|
+
const agentId = agent?.metadata?.id ?? null;
|
|
33
|
+
const { allowed: canEdit } = useCheckPermission(agentId ? { kind: "agent", id: agentId } : null, "can_edit");
|
|
34
|
+
const open = useCallback(() => setIsOpen(true), []);
|
|
35
|
+
const action = agent && canEdit
|
|
36
|
+
? { id: "share", label, group: "sharing", onAction: open }
|
|
37
|
+
: null;
|
|
38
|
+
const dialog = agent ? (_jsx(ShareAgentDialog, { open: isOpen, onOpenChange: setIsOpen, agent: agent, buildShareUrl: buildShareUrl, onSharingChanged: onSharingChanged })) : null;
|
|
39
|
+
return { action, dialog, open, isOpen };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=useShareAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareAgent.js","sourceRoot":"","sources":["../../src/sharing/useShareAgent.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA2CzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,GAAG,OAAO,GACG;IAClB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,IAAI,IAAI,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAC7C,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAC/C,UAAU,CACX,CAAC;IAEF,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEpD,MAAM,MAAM,GACV,KAAK,IAAI,OAAO;QACd,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1D,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CACrB,KAAC,gBAAgB,IACf,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,SAAS,EACvB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC,CAAC,CAAC,IAAI,CAAC;IAET,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
2
|
+
/**
|
|
3
|
+
* Readiness of a shared agent's tool credentials for visitor (and
|
|
4
|
+
* teammate) executions.
|
|
5
|
+
*
|
|
6
|
+
* - `na` — nothing to check: the agent uses no MCP tools, the check is
|
|
7
|
+
* disabled, or the deployment cannot serve guest chat (local mode).
|
|
8
|
+
* - `checking` — lookups in flight.
|
|
9
|
+
* - `ready` — every environment bound to the agent's default instance is
|
|
10
|
+
* shared with the organization.
|
|
11
|
+
* - `blocked` — one or more bound environments are private; their
|
|
12
|
+
* `org/slug` references are listed for the hint copy.
|
|
13
|
+
*/
|
|
14
|
+
export type ShareToolReadiness = {
|
|
15
|
+
readonly status: "na";
|
|
16
|
+
} | {
|
|
17
|
+
readonly status: "checking";
|
|
18
|
+
} | {
|
|
19
|
+
readonly status: "ready";
|
|
20
|
+
} | {
|
|
21
|
+
readonly status: "blocked";
|
|
22
|
+
readonly privateEnvironments: readonly string[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Data hook that checks whether a tool-using shared agent's credentials
|
|
26
|
+
* will work for visitors — i.e. whether the environments bound to its
|
|
27
|
+
* default instance are shared with the organization (`visibility_org`).
|
|
28
|
+
*
|
|
29
|
+
* Guest and teammate executions can only use org-shared environments;
|
|
30
|
+
* a private environment's secrets are creator-only and silently
|
|
31
|
+
* unavailable to them, so the agent's tools would fail at runtime. This
|
|
32
|
+
* hook powers the Share dialog's pre-flight hint, catching the
|
|
33
|
+
* misconfiguration at share time instead of at the visitor's first
|
|
34
|
+
* message.
|
|
35
|
+
*
|
|
36
|
+
* Scope note: environments bound via `environment_refs` are the
|
|
37
|
+
* supported credential path for shared agents. Credentials that only
|
|
38
|
+
* exist in the owner's personal environment are also invisible to
|
|
39
|
+
* guests, but are not detectable from the instance binding — the
|
|
40
|
+
* runtime's enriched FAILED_PRECONDITION error covers that case.
|
|
41
|
+
*
|
|
42
|
+
* The check runs only when `enabled` is true, the deployment is cloud
|
|
43
|
+
* (local mode has no guest runtime or secret gating), and the agent
|
|
44
|
+
* declares MCP server usages. All lookups run as the owner viewing the
|
|
45
|
+
* dialog, who can read the bound environments.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useShareToolReadiness(agent: Agent, enabled: boolean): ShareToolReadiness;
|
|
48
|
+
//# sourceMappingURL=useShareToolReadiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareToolReadiness.d.ts","sourceRoot":"","sources":["../../src/sharing/useShareToolReadiness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAKhF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAIpF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,GACf,kBAAkB,CA0EpB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
4
|
+
import { useStigmer } from "../hooks.js";
|
|
5
|
+
import { useDeploymentMode } from "../deployment-mode.js";
|
|
6
|
+
const NA = { status: "na" };
|
|
7
|
+
/**
|
|
8
|
+
* Data hook that checks whether a tool-using shared agent's credentials
|
|
9
|
+
* will work for visitors — i.e. whether the environments bound to its
|
|
10
|
+
* default instance are shared with the organization (`visibility_org`).
|
|
11
|
+
*
|
|
12
|
+
* Guest and teammate executions can only use org-shared environments;
|
|
13
|
+
* a private environment's secrets are creator-only and silently
|
|
14
|
+
* unavailable to them, so the agent's tools would fail at runtime. This
|
|
15
|
+
* hook powers the Share dialog's pre-flight hint, catching the
|
|
16
|
+
* misconfiguration at share time instead of at the visitor's first
|
|
17
|
+
* message.
|
|
18
|
+
*
|
|
19
|
+
* Scope note: environments bound via `environment_refs` are the
|
|
20
|
+
* supported credential path for shared agents. Credentials that only
|
|
21
|
+
* exist in the owner's personal environment are also invisible to
|
|
22
|
+
* guests, but are not detectable from the instance binding — the
|
|
23
|
+
* runtime's enriched FAILED_PRECONDITION error covers that case.
|
|
24
|
+
*
|
|
25
|
+
* The check runs only when `enabled` is true, the deployment is cloud
|
|
26
|
+
* (local mode has no guest runtime or secret gating), and the agent
|
|
27
|
+
* declares MCP server usages. All lookups run as the owner viewing the
|
|
28
|
+
* dialog, who can read the bound environments.
|
|
29
|
+
*/
|
|
30
|
+
export function useShareToolReadiness(agent, enabled) {
|
|
31
|
+
const stigmer = useStigmer();
|
|
32
|
+
const deploymentMode = useDeploymentMode();
|
|
33
|
+
const [readiness, setReadiness] = useState(NA);
|
|
34
|
+
const agentId = agent.metadata?.id ?? "";
|
|
35
|
+
const hasMcpTools = (agent.spec?.mcpServerUsages?.length ?? 0) > 0;
|
|
36
|
+
const defaultInstanceId = agent.status?.defaultInstanceId ?? "";
|
|
37
|
+
const shouldCheck = enabled &&
|
|
38
|
+
deploymentMode === "cloud" &&
|
|
39
|
+
hasMcpTools &&
|
|
40
|
+
defaultInstanceId !== "";
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!shouldCheck) {
|
|
43
|
+
setReadiness(NA);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
setReadiness({ status: "checking" });
|
|
48
|
+
(async () => {
|
|
49
|
+
const instance = await stigmer.agentInstance.get(defaultInstanceId);
|
|
50
|
+
const refs = instance.spec?.environmentRefs ?? [];
|
|
51
|
+
if (refs.length === 0) {
|
|
52
|
+
// No bound environments to assess. The tools may need no
|
|
53
|
+
// credentials at all — do not warn on a guess.
|
|
54
|
+
return NA;
|
|
55
|
+
}
|
|
56
|
+
const privateRefs = [];
|
|
57
|
+
for (const ref of refs) {
|
|
58
|
+
try {
|
|
59
|
+
const env = await stigmer.environment.getByReference({
|
|
60
|
+
org: ref.org,
|
|
61
|
+
slug: ref.slug,
|
|
62
|
+
});
|
|
63
|
+
if (env.metadata?.visibility !== ApiResourceVisibility.visibility_org) {
|
|
64
|
+
privateRefs.push(`${ref.org}/${ref.slug}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Unreadable ref (deleted, foreign): the runtime will skip it
|
|
69
|
+
// for visitors too — surface it as blocking.
|
|
70
|
+
privateRefs.push(`${ref.org}/${ref.slug}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return privateRefs.length === 0
|
|
74
|
+
? { status: "ready" }
|
|
75
|
+
: { status: "blocked", privateEnvironments: privateRefs };
|
|
76
|
+
})().then((result) => {
|
|
77
|
+
if (!cancelled)
|
|
78
|
+
setReadiness(result);
|
|
79
|
+
}, () => {
|
|
80
|
+
// The hint is best-effort pre-flight advice — a failed check must
|
|
81
|
+
// never block the dialog. The runtime error path still diagnoses.
|
|
82
|
+
if (!cancelled)
|
|
83
|
+
setReadiness(NA);
|
|
84
|
+
});
|
|
85
|
+
return () => {
|
|
86
|
+
cancelled = true;
|
|
87
|
+
};
|
|
88
|
+
// agentId stands in for the agent object identity: the inputs that
|
|
89
|
+
// matter (instance id, MCP usage presence) are covered explicitly.
|
|
90
|
+
}, [shouldCheck, defaultInstanceId, agentId, stigmer]);
|
|
91
|
+
return readiness;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=useShareToolReadiness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShareToolReadiness.js","sourceRoot":"","sources":["../../src/sharing/useShareToolReadiness.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoB1D,MAAM,EAAE,GAAuB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,OAAgB;IAEhB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,CAAC,SAAS,EAAE,Y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,EAAE,UAAU,KAAK,qBAAqB,CAAC,cAAc,EACjE,CAAC;wBACD,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC7C,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,8DAA8D;oBAC9D,6CAA6C;oBAC7C,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;YAED,OAAO,WAAW,CAAC,MAAM,KAAK,CAAC;gBAC7B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;gBACrB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC,IAAI,CACP,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,CAAC,SAAS;gBAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC,EACD,GAAG,EAAE;YACH,kEAAkE;YAClE,kEAAkE;YAClE,IAAI,CAAC,SAAS;gBAAE,YAAY,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;QACF,mEAAmE;QACnE,mEAAmE;IACrE,CAAC,EAAE,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type SharedAgentProfile } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
|
|
2
|
+
import type { SharingAudience } from "./useUpdateAgentSharing.js";
|
|
3
|
+
/** Options for {@link useSharedAgentProfile}. */
|
|
4
|
+
export interface UseSharedAgentProfileOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Which resolution path to use.
|
|
7
|
+
*
|
|
8
|
+
* - `"public"` (default) — the anonymous `getSharedProfile` RPC. An
|
|
9
|
+
* org-audience share answers NOT_FOUND here by design.
|
|
10
|
+
* - `"org"` — the authenticated `getSharedProfileForMember` RPC, which
|
|
11
|
+
* resolves org-audience shares for signed-in members of the owning
|
|
12
|
+
* organization (and public shares too). Requires a `StigmerProvider`
|
|
13
|
+
* whose client carries the member's token.
|
|
14
|
+
*/
|
|
15
|
+
readonly audience?: SharingAudience;
|
|
16
|
+
/**
|
|
17
|
+
* Share-link token from the URL's `?k=` parameter (public path only).
|
|
18
|
+
*
|
|
19
|
+
* Required when the share link has been locked with a rotatable token;
|
|
20
|
+
* harmless on plain links. On a locked link a missing or rotated-away
|
|
21
|
+
* token resolves to `profile === null`, indistinguishable from an
|
|
22
|
+
* agent that does not exist.
|
|
23
|
+
*/
|
|
24
|
+
readonly linkToken?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Return value of {@link useSharedAgentProfile}. */
|
|
27
|
+
export interface UseSharedAgentProfileReturn {
|
|
28
|
+
/**
|
|
29
|
+
* The shared agent's public profile, or `null` while loading, on
|
|
30
|
+
* error, or when the agent is not shared.
|
|
31
|
+
*/
|
|
32
|
+
readonly profile: SharedAgentProfile | null;
|
|
33
|
+
/** `true` while the initial fetch or a refetch is in flight. */
|
|
34
|
+
readonly isLoading: boolean;
|
|
35
|
+
/** `true` while a background refetch is in flight and stale data is shown. */
|
|
36
|
+
readonly isRefetching: boolean;
|
|
37
|
+
/** Error from the last failed request, or `null` when healthy. */
|
|
38
|
+
readonly error: Error | null;
|
|
39
|
+
/** Discard cached data and re-fetch the profile from the server. */
|
|
40
|
+
readonly refetch: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Data hook that fetches a shared agent's public profile by
|
|
44
|
+
* organization and agent slug.
|
|
45
|
+
*
|
|
46
|
+
* By default this hook calls the `getSharedProfile` endpoint, which is
|
|
47
|
+
* **public** — it requires no authentication. The server returns a
|
|
48
|
+
* trimmed projection safe for anonymous visitors: name, description,
|
|
49
|
+
* icon, and the default instance id needed to start a session
|
|
50
|
+
* (an identifier, not a capability — session creation still requires
|
|
51
|
+
* an authorized token, e.g. a guest token from `createGuestAuth`).
|
|
52
|
+
* With `{ audience: "org" }` it calls the authenticated
|
|
53
|
+
* `getSharedProfileForMember` endpoint instead, which resolves
|
|
54
|
+
* org-members-only shares for a signed-in member.
|
|
55
|
+
*
|
|
56
|
+
* **Not-shared handling:** the server answers NOT_FOUND for "this
|
|
57
|
+
* agent does not exist", "this agent is not shared", and (on the
|
|
58
|
+
* member path) "you are not a member of this organization" — all
|
|
59
|
+
* indistinguishable by design so a share URL leaks nothing. The hook
|
|
60
|
+
* maps that to `profile === null` without raising an error, matching
|
|
61
|
+
* `useAgent`'s not-found convention:
|
|
62
|
+
* `profile === null && !isLoading && !error` means unavailable.
|
|
63
|
+
*
|
|
64
|
+
* Pass `null` for either `org` or `slug` to skip fetching (stable
|
|
65
|
+
* no-op) — useful while route params are still resolving.
|
|
66
|
+
*
|
|
67
|
+
* **Note**: Although authentication is not required by the server,
|
|
68
|
+
* the hook still requires a `StigmerProvider` ancestor because it
|
|
69
|
+
* needs the transport configuration (API base URL) to make the
|
|
70
|
+
* request.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* const { profile, isLoading, error } = useSharedAgentProfile(org, slug);
|
|
75
|
+
*
|
|
76
|
+
* if (isLoading) return <Spinner />;
|
|
77
|
+
* if (error) return <ErrorCard error={error} />;
|
|
78
|
+
* if (!profile) return <AgentUnavailable />;
|
|
79
|
+
*
|
|
80
|
+
* return <h1>{profile.name}</h1>;
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function useSharedAgentProfile(org: string | null, slug: string | null, options?: UseSharedAgentProfileOptions): UseSharedAgentProfileReturn;
|
|
84
|
+
//# sourceMappingURL=useSharedAgentProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSharedAgentProfile.d.ts","sourceRoot":"","sources":["../../src/sharing/useSharedAgentProfile.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,mDAAmD,CAAC;AAI3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,iDAAiD;AACjD,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAEpC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qDAAqD;AACrD,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC5C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,OAAO,CAAC,EAAE,4BAA4B,GACrC,2BAA2B,CA+B7B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import { GetSharedProfileRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/io_pb";
|
|
4
|
+
import { isNotFound } from "@stigmer/sdk";
|
|
5
|
+
import { useStigmer } from "../hooks.js";
|
|
6
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
7
|
+
/**
|
|
8
|
+
* Data hook that fetches a shared agent's public profile by
|
|
9
|
+
* organization and agent slug.
|
|
10
|
+
*
|
|
11
|
+
* By default this hook calls the `getSharedProfile` endpoint, which is
|
|
12
|
+
* **public** — it requires no authentication. The server returns a
|
|
13
|
+
* trimmed projection safe for anonymous visitors: name, description,
|
|
14
|
+
* icon, and the default instance id needed to start a session
|
|
15
|
+
* (an identifier, not a capability — session creation still requires
|
|
16
|
+
* an authorized token, e.g. a guest token from `createGuestAuth`).
|
|
17
|
+
* With `{ audience: "org" }` it calls the authenticated
|
|
18
|
+
* `getSharedProfileForMember` endpoint instead, which resolves
|
|
19
|
+
* org-members-only shares for a signed-in member.
|
|
20
|
+
*
|
|
21
|
+
* **Not-shared handling:** the server answers NOT_FOUND for "this
|
|
22
|
+
* agent does not exist", "this agent is not shared", and (on the
|
|
23
|
+
* member path) "you are not a member of this organization" — all
|
|
24
|
+
* indistinguishable by design so a share URL leaks nothing. The hook
|
|
25
|
+
* maps that to `profile === null` without raising an error, matching
|
|
26
|
+
* `useAgent`'s not-found convention:
|
|
27
|
+
* `profile === null && !isLoading && !error` means unavailable.
|
|
28
|
+
*
|
|
29
|
+
* Pass `null` for either `org` or `slug` to skip fetching (stable
|
|
30
|
+
* no-op) — useful while route params are still resolving.
|
|
31
|
+
*
|
|
32
|
+
* **Note**: Although authentication is not required by the server,
|
|
33
|
+
* the hook still requires a `StigmerProvider` ancestor because it
|
|
34
|
+
* needs the transport configuration (API base URL) to make the
|
|
35
|
+
* request.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const { profile, isLoading, error } = useSharedAgentProfile(org, slug);
|
|
40
|
+
*
|
|
41
|
+
* if (isLoading) return <Spinner />;
|
|
42
|
+
* if (error) return <ErrorCard error={error} />;
|
|
43
|
+
* if (!profile) return <AgentUnavailable />;
|
|
44
|
+
*
|
|
45
|
+
* return <h1>{profile.name}</h1>;
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function useSharedAgentProfile(org, slug, options) {
|
|
49
|
+
const stigmer = useStigmer();
|
|
50
|
+
const audience = options?.audience ?? "public";
|
|
51
|
+
const linkToken = options?.linkToken ?? "";
|
|
52
|
+
const fetchFn = org && slug
|
|
53
|
+
? async () => {
|
|
54
|
+
try {
|
|
55
|
+
// The member path is tokenless by contract: org-audience access
|
|
56
|
+
// is gated by live membership, and token-locked public shares
|
|
57
|
+
// deliberately refuse there (see getSharedProfileForMember).
|
|
58
|
+
return audience === "org"
|
|
59
|
+
? await stigmer.agent.getSharedProfileForMember({ org, slug })
|
|
60
|
+
: await stigmer.agent.getSharedProfile(create(GetSharedProfileRequestSchema, { org, slug, linkToken }));
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (isNotFound(err))
|
|
64
|
+
return null;
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
: null;
|
|
69
|
+
const { data: profile, isLoading, isRefetching, error, refetch } = useFetch(fetchFn, [org, slug, audience, linkToken, stigmer], null);
|
|
70
|
+
return { profile, isLoading, isRefetching, error, refetch };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=useSharedAgentProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSharedAgentProfile.js","sourceRoot":"","sources":["../../src/sharing/useSharedAgentProfile.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,6BAA6B,GAE9B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;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