@stigmer/react 3.1.8 → 3.1.10
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/environment/EnvironmentPicker.d.ts +17 -1
- package/environment/EnvironmentPicker.d.ts.map +1 -1
- package/environment/EnvironmentPicker.js +3 -2
- package/environment/EnvironmentPicker.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/sharing/ShareAgentDialog.d.ts +10 -8
- package/sharing/ShareAgentDialog.d.ts.map +1 -1
- package/sharing/ShareAgentDialog.js +139 -54
- package/sharing/ShareAgentDialog.js.map +1 -1
- package/sharing/SharedAgentChat.d.ts +1 -1
- package/sharing/SharedAgentChat.d.ts.map +1 -1
- package/sharing/index.d.ts +4 -2
- package/sharing/index.d.ts.map +1 -1
- package/sharing/index.js +2 -1
- package/sharing/index.js.map +1 -1
- package/sharing/useAgentShare.d.ts +43 -0
- package/sharing/useAgentShare.d.ts.map +1 -0
- package/sharing/useAgentShare.js +54 -0
- package/sharing/useAgentShare.js.map +1 -0
- package/sharing/useRotateShareLink.d.ts +22 -19
- package/sharing/useRotateShareLink.d.ts.map +1 -1
- package/sharing/useRotateShareLink.js +22 -19
- package/sharing/useRotateShareLink.js.map +1 -1
- package/sharing/useSaveAgentShare.d.ts +105 -0
- package/sharing/useSaveAgentShare.d.ts.map +1 -0
- package/sharing/useSaveAgentShare.js +97 -0
- package/sharing/useSaveAgentShare.js.map +1 -0
- package/sharing/useShareAgent.d.ts +5 -4
- package/sharing/useShareAgent.d.ts.map +1 -1
- package/sharing/useShareAgent.js +5 -4
- package/sharing/useShareAgent.js.map +1 -1
- package/sharing/useShareToolReadiness.d.ts +29 -25
- package/sharing/useShareToolReadiness.d.ts.map +1 -1
- package/sharing/useShareToolReadiness.js +47 -51
- package/sharing/useShareToolReadiness.js.map +1 -1
- package/sharing/useSharedAgentProfile.d.ts +5 -4
- package/sharing/useSharedAgentProfile.d.ts.map +1 -1
- package/sharing/useSharedAgentProfile.js +6 -5
- package/sharing/useSharedAgentProfile.js.map +1 -1
- package/src/environment/EnvironmentPicker.tsx +23 -2
- package/src/index.ts +8 -4
- package/src/sharing/ShareAgentDialog.tsx +353 -119
- package/src/sharing/SharedAgentChat.tsx +1 -1
- package/src/sharing/__tests__/ShareAgentDialog.test.tsx +550 -369
- package/src/sharing/__tests__/useAgentShare.test.tsx +149 -0
- package/src/sharing/__tests__/useRotateShareLink.test.tsx +8 -8
- package/src/sharing/__tests__/useSaveAgentShare.test.tsx +241 -0
- package/src/sharing/__tests__/useShareAgent.test.tsx +6 -2
- package/src/sharing/__tests__/useShareToolReadiness.test.tsx +84 -47
- package/src/sharing/__tests__/useSharedAgentProfile.test.tsx +1 -1
- package/src/sharing/index.ts +9 -7
- package/src/sharing/useAgentShare.ts +91 -0
- package/src/sharing/useRotateShareLink.ts +30 -25
- package/src/sharing/useSaveAgentShare.ts +186 -0
- package/src/sharing/useShareAgent.tsx +5 -4
- package/src/sharing/useShareToolReadiness.ts +62 -60
- package/src/sharing/useSharedAgentProfile.ts +7 -6
- package/src/switch/Switch.tsx +6 -1
- package/src/switch/__tests__/Switch.test.tsx +19 -0
- package/switch/Switch.d.ts.map +1 -1
- package/switch/Switch.js +6 -1
- package/switch/Switch.js.map +1 -1
- package/sharing/useUpdateAgentSharing.d.ts +0 -86
- package/sharing/useUpdateAgentSharing.d.ts.map +0 -1
- package/sharing/useUpdateAgentSharing.js +0 -81
- package/sharing/useUpdateAgentSharing.js.map +0 -1
- package/src/sharing/__tests__/useUpdateAgentSharing.test.tsx +0 -200
- package/src/sharing/useUpdateAgentSharing.ts +0 -151
|
@@ -1,73 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
4
4
|
import { useStigmer } from "../hooks.js";
|
|
5
5
|
import { useDeploymentMode } from "../deployment-mode.js";
|
|
6
6
|
const NA = { status: "na" };
|
|
7
|
+
const NEEDS_CREDENTIALS = { status: "needs-credentials" };
|
|
7
8
|
/**
|
|
8
9
|
* Data hook that checks whether a tool-using shared agent's credentials
|
|
9
|
-
* will work for visitors — i.e. whether the
|
|
10
|
-
*
|
|
10
|
+
* will work for visitors — i.e. whether the share binds environments
|
|
11
|
+
* (`environment_refs`) and each one is shared with the organization
|
|
12
|
+
* (`visibility_org`).
|
|
11
13
|
*
|
|
12
|
-
* Guest
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* Guest executions receive credentials exclusively from the share's own
|
|
15
|
+
* `environment_refs`, resolved through the org-shared environment seam
|
|
16
|
+
* (decision 011 — the agent's default instance stays pristine and is
|
|
17
|
+
* never consulted). So a tool-using agent with an empty binding list is
|
|
18
|
+
* *guaranteed* broken for visitors, and this hook says so explicitly
|
|
19
|
+
* (`needs-credentials`) instead of staying silent — the gap that made
|
|
20
|
+
* session 12's misconfiguration invisible until a visitor's first
|
|
21
|
+
* message failed.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
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.
|
|
23
|
+
* The check runs only when the share is enabled with a public audience
|
|
24
|
+
* (org-audience shares reject bindings at the proto boundary), the
|
|
25
|
+
* deployment is cloud (local mode has no guest runtime or secret
|
|
26
|
+
* gating), and the agent declares MCP server usages. All lookups run as
|
|
27
|
+
* the owner viewing the dialog, who can read the bound environments.
|
|
29
28
|
*/
|
|
30
|
-
export function useShareToolReadiness(agent,
|
|
29
|
+
export function useShareToolReadiness(agent, draft) {
|
|
31
30
|
const stigmer = useStigmer();
|
|
32
31
|
const deploymentMode = useDeploymentMode();
|
|
33
|
-
const [
|
|
34
|
-
const agentId = agent.metadata?.id ?? "";
|
|
32
|
+
const [checked, setChecked] = useState(NA);
|
|
35
33
|
const hasMcpTools = (agent.spec?.mcpServerUsages?.length ?? 0) > 0;
|
|
36
|
-
const
|
|
37
|
-
|
|
34
|
+
const applicable = draft.enabled &&
|
|
35
|
+
draft.audience === "public" &&
|
|
38
36
|
deploymentMode === "cloud" &&
|
|
39
|
-
hasMcpTools
|
|
40
|
-
|
|
37
|
+
hasMcpTools;
|
|
38
|
+
// Stable key for the effect: the visibility lookups depend only on
|
|
39
|
+
// which environments are bound, not on the array's identity.
|
|
40
|
+
const refsKey = useMemo(() => draft.environmentRefs.map((ref) => `${ref.org}/${ref.slug}`).join(","), [draft.environmentRefs]);
|
|
41
|
+
const shouldFetch = applicable && refsKey !== "";
|
|
41
42
|
useEffect(() => {
|
|
42
|
-
if (!
|
|
43
|
-
|
|
43
|
+
if (!shouldFetch) {
|
|
44
|
+
setChecked(NA);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
let cancelled = false;
|
|
47
|
-
|
|
48
|
+
setChecked({ status: "checking" });
|
|
48
49
|
(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
50
|
const privateRefs = [];
|
|
57
|
-
for (const ref of
|
|
51
|
+
for (const ref of refsKey.split(",")) {
|
|
52
|
+
const [org, slug] = ref.split("/");
|
|
58
53
|
try {
|
|
59
|
-
const env = await stigmer.environment.getByReference({
|
|
60
|
-
org: ref.org,
|
|
61
|
-
slug: ref.slug,
|
|
62
|
-
});
|
|
54
|
+
const env = await stigmer.environment.getByReference({ org, slug });
|
|
63
55
|
if (env.metadata?.visibility !== ApiResourceVisibility.visibility_org) {
|
|
64
|
-
privateRefs.push(
|
|
56
|
+
privateRefs.push(ref);
|
|
65
57
|
}
|
|
66
58
|
}
|
|
67
59
|
catch {
|
|
68
|
-
// Unreadable ref (deleted, foreign): the runtime will
|
|
69
|
-
// for visitors too — surface it as blocking.
|
|
70
|
-
privateRefs.push(
|
|
60
|
+
// Unreadable ref (deleted, foreign): the runtime's merge will
|
|
61
|
+
// skip it for visitors too — surface it as blocking.
|
|
62
|
+
privateRefs.push(ref);
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
return privateRefs.length === 0
|
|
@@ -75,19 +67,23 @@ export function useShareToolReadiness(agent, enabled) {
|
|
|
75
67
|
: { status: "blocked", privateEnvironments: privateRefs };
|
|
76
68
|
})().then((result) => {
|
|
77
69
|
if (!cancelled)
|
|
78
|
-
|
|
70
|
+
setChecked(result);
|
|
79
71
|
}, () => {
|
|
80
72
|
// The hint is best-effort pre-flight advice — a failed check must
|
|
81
73
|
// never block the dialog. The runtime error path still diagnoses.
|
|
82
74
|
if (!cancelled)
|
|
83
|
-
|
|
75
|
+
setChecked(NA);
|
|
84
76
|
});
|
|
85
77
|
return () => {
|
|
86
78
|
cancelled = true;
|
|
87
79
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
}, [shouldFetch, refsKey, stigmer]);
|
|
81
|
+
if (!applicable)
|
|
82
|
+
return NA;
|
|
83
|
+
// Zero bindings needs no lookup: a tool-using agent without bound
|
|
84
|
+
// credentials is broken for visitors by construction.
|
|
85
|
+
if (refsKey === "")
|
|
86
|
+
return NEEDS_CREDENTIALS;
|
|
87
|
+
return checked;
|
|
92
88
|
}
|
|
93
89
|
//# sourceMappingURL=useShareToolReadiness.js.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"useShareToolReadiness.js","sourceRoot":"","sources":["../../src/sharing/useShareToolReadiness.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAyB1D,MAAM,EAAE,GAAuB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAChD,MAAM,iBAAiB,GAAuB,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,KAAsB;IAEtB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IAE/D,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACnE,MAAM,UAAU,GACd,KAAK,CAAC,OAAO;QACb,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAC3B,cAAc,KAAK,OAAO;QAC1B,WAAW,CAAC;IAEd,mEAAmE;IACnE,6DAA6D;IAC7D,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC,KAAK,CAAC,e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,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,UAAU,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC,EACD,GAAG,EAAE;YACH,kEAAkE;YAClE,kEAAkE;YAClE,IAAI,CAAC,SAAS;gBAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEpC,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAC3B,kEAAkE;IAClE,sDAAsD;IACtD,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,iBAAiB,CAAC;IAC7C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type SharedAgentProfile } from "@stigmer/protos/ai/stigmer/agentic/
|
|
2
|
-
import type { SharingAudience } from "./
|
|
1
|
+
import { type SharedAgentProfile } from "@stigmer/protos/ai/stigmer/agentic/agentshare/v1/io_pb";
|
|
2
|
+
import type { SharingAudience } from "./useSaveAgentShare.js";
|
|
3
3
|
/** Options for {@link useSharedAgentProfile}. */
|
|
4
4
|
export interface UseSharedAgentProfileOptions {
|
|
5
5
|
/**
|
|
@@ -40,8 +40,9 @@ export interface UseSharedAgentProfileReturn {
|
|
|
40
40
|
readonly refetch: () => void;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Data hook that fetches a shared agent's public profile by
|
|
44
|
-
*
|
|
43
|
+
* Data hook that fetches a shared agent's public profile by the org and
|
|
44
|
+
* slug from the share URL (the share's slug — it defaults to the
|
|
45
|
+
* agent's, so existing links resolve unchanged).
|
|
45
46
|
*
|
|
46
47
|
* By default this hook calls the `getSharedProfile` endpoint, which is
|
|
47
48
|
* **public** — it requires no authentication. The server returns a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSharedAgentProfile.d.ts","sourceRoot":"","sources":["../../src/sharing/useSharedAgentProfile.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"useSharedAgentProfile.d.ts","sourceRoot":"","sources":["../../src/sharing/useSharedAgentProfile.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,wDAAwD,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,OAAO,CAAC,EAAE,4BAA4B,GACrC,2BAA2B,CA+B7B"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { create } from "@bufbuild/protobuf";
|
|
3
|
-
import { GetSharedProfileRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/
|
|
3
|
+
import { GetSharedProfileRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentshare/v1/io_pb";
|
|
4
4
|
import { isNotFound } from "@stigmer/sdk";
|
|
5
5
|
import { useStigmer } from "../hooks.js";
|
|
6
6
|
import { useFetch } from "../internal/useFetch.js";
|
|
7
7
|
/**
|
|
8
|
-
* Data hook that fetches a shared agent's public profile by
|
|
9
|
-
*
|
|
8
|
+
* Data hook that fetches a shared agent's public profile by the org and
|
|
9
|
+
* slug from the share URL (the share's slug — it defaults to the
|
|
10
|
+
* agent's, so existing links resolve unchanged).
|
|
10
11
|
*
|
|
11
12
|
* By default this hook calls the `getSharedProfile` endpoint, which is
|
|
12
13
|
* **public** — it requires no authentication. The server returns a
|
|
@@ -56,8 +57,8 @@ export function useSharedAgentProfile(org, slug, options) {
|
|
|
56
57
|
// is gated by live membership, and token-locked public shares
|
|
57
58
|
// deliberately refuse there (see getSharedProfileForMember).
|
|
58
59
|
return audience === "org"
|
|
59
|
-
? await stigmer.
|
|
60
|
-
: await stigmer.
|
|
60
|
+
? await stigmer.agentShare.getSharedProfileForMember({ org, slug })
|
|
61
|
+
: await stigmer.agentShare.getSharedProfile(create(GetSharedProfileRequestSchema, { org, slug, linkToken }));
|
|
61
62
|
}
|
|
62
63
|
catch (err) {
|
|
63
64
|
if (isNotFound(err))
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3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C,CAAC,IAAI,CAAC;IAEX,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,CACzE,OAAO,EACP,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EACzC,IAAiC,CAClC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -16,6 +16,21 @@ export interface EnvironmentPickerProps {
|
|
|
16
16
|
readonly onChange: (refs: ResourceRef[]) => void;
|
|
17
17
|
/** Disable all interactions. */
|
|
18
18
|
readonly disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Restrict which environments are offered in the dropdown. Already
|
|
21
|
+
* selected references remain listed (and removable) even when they no
|
|
22
|
+
* longer pass the filter — hiding them would strand the binding.
|
|
23
|
+
* When omitted, every environment in the org is offered (the default
|
|
24
|
+
* behavior of every existing caller).
|
|
25
|
+
*
|
|
26
|
+
* @example Only org-shared environments (guest-usable credentials):
|
|
27
|
+
* ```tsx
|
|
28
|
+
* filterEnvironment={(env) =>
|
|
29
|
+
* env.metadata?.visibility === ApiResourceVisibility.visibility_org
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
readonly filterEnvironment?: (environment: Environment) => boolean;
|
|
19
34
|
/** Additional CSS class names for the root container. */
|
|
20
35
|
readonly className?: string;
|
|
21
36
|
}
|
|
@@ -44,6 +59,7 @@ export function EnvironmentPicker({
|
|
|
44
59
|
value,
|
|
45
60
|
onChange,
|
|
46
61
|
disabled = false,
|
|
62
|
+
filterEnvironment,
|
|
47
63
|
className,
|
|
48
64
|
}: EnvironmentPickerProps) {
|
|
49
65
|
const { environments, isLoading } = useEnvironmentList(org);
|
|
@@ -55,8 +71,13 @@ export function EnvironmentPicker({
|
|
|
55
71
|
);
|
|
56
72
|
|
|
57
73
|
const availableEnvironments = useMemo(
|
|
58
|
-
() =>
|
|
59
|
-
|
|
74
|
+
() =>
|
|
75
|
+
environments.filter(
|
|
76
|
+
(env) =>
|
|
77
|
+
!selectedSlugs.has(env.metadata?.slug ?? "") &&
|
|
78
|
+
(filterEnvironment?.(env) ?? true),
|
|
79
|
+
),
|
|
80
|
+
[environments, selectedSlugs, filterEnvironment],
|
|
60
81
|
);
|
|
61
82
|
|
|
62
83
|
const handleAdd = useCallback(
|
package/src/index.ts
CHANGED
|
@@ -985,15 +985,17 @@ export type {
|
|
|
985
985
|
} from "./invitation/index.js";
|
|
986
986
|
|
|
987
987
|
// Sharing — shared-agent public profile, the anonymous-visitor chat organism,
|
|
988
|
-
// and the owner-side Share experience (dialog, kebab hook,
|
|
988
|
+
// and the owner-side Share experience (dialog, kebab hook, AgentShare hooks).
|
|
989
989
|
export {
|
|
990
990
|
useSharedAgentProfile,
|
|
991
991
|
SharedAgentChat,
|
|
992
992
|
sharingAudienceFromProto,
|
|
993
|
-
|
|
993
|
+
useAgentShare,
|
|
994
|
+
useSaveAgentShare,
|
|
994
995
|
useRotateShareLink,
|
|
995
996
|
ShareAgentDialog,
|
|
996
997
|
useShareAgent,
|
|
998
|
+
useShareToolReadiness,
|
|
997
999
|
validateOrigin,
|
|
998
1000
|
MAX_ALLOWED_ORIGINS,
|
|
999
1001
|
} from "./sharing/index.js";
|
|
@@ -1001,13 +1003,15 @@ export type {
|
|
|
1001
1003
|
UseSharedAgentProfileOptions,
|
|
1002
1004
|
UseSharedAgentProfileReturn,
|
|
1003
1005
|
SharedAgentChatProps,
|
|
1004
|
-
|
|
1006
|
+
AgentShareDraft,
|
|
1005
1007
|
SharingAudience,
|
|
1006
|
-
|
|
1008
|
+
UseAgentShareReturn,
|
|
1009
|
+
UseSaveAgentShareReturn,
|
|
1007
1010
|
UseRotateShareLinkReturn,
|
|
1008
1011
|
ShareAgentDialogProps,
|
|
1009
1012
|
UseShareAgentArgs,
|
|
1010
1013
|
UseShareAgentReturn,
|
|
1014
|
+
ShareToolReadiness,
|
|
1011
1015
|
} from "./sharing/index.js";
|
|
1012
1016
|
|
|
1013
1017
|
// Error — structured error display with classification, retry, and contextual guidance
|