@stigmer/react 3.1.12 → 3.1.14
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 +11 -3
- package/agent/AgentDetailView.d.ts.map +1 -1
- package/agent/AgentDetailView.js +22 -17
- package/agent/AgentDetailView.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/AgentShareList.d.ts +44 -0
- package/sharing/AgentShareList.d.ts.map +1 -0
- package/sharing/AgentShareList.js +149 -0
- package/sharing/AgentShareList.js.map +1 -0
- package/sharing/ShareAgentDialog.d.ts +38 -15
- package/sharing/ShareAgentDialog.d.ts.map +1 -1
- package/sharing/ShareAgentDialog.js +135 -57
- package/sharing/ShareAgentDialog.js.map +1 -1
- package/sharing/index.d.ts +10 -6
- package/sharing/index.d.ts.map +1 -1
- package/sharing/index.js +5 -3
- package/sharing/index.js.map +1 -1
- package/sharing/useAgentShares.d.ts +42 -0
- package/sharing/useAgentShares.d.ts.map +1 -0
- package/sharing/useAgentShares.js +38 -0
- package/sharing/useAgentShares.js.map +1 -0
- package/sharing/useCanCreateAgentShare.d.ts +43 -0
- package/sharing/useCanCreateAgentShare.d.ts.map +1 -0
- package/sharing/useCanCreateAgentShare.js +44 -0
- package/sharing/useCanCreateAgentShare.js.map +1 -0
- package/sharing/useDeleteAgentShare.d.ts +42 -0
- package/sharing/useDeleteAgentShare.d.ts.map +1 -0
- package/sharing/useDeleteAgentShare.js +45 -0
- package/sharing/useDeleteAgentShare.js.map +1 -0
- package/sharing/useSaveAgentShare.d.ts +45 -14
- package/sharing/useSaveAgentShare.d.ts.map +1 -1
- package/sharing/useSaveAgentShare.js +59 -19
- package/sharing/useSaveAgentShare.js.map +1 -1
- package/src/agent/AgentDetailView.tsx +37 -20
- package/src/index.ts +11 -6
- package/src/sharing/AgentShareList.tsx +507 -0
- package/src/sharing/ShareAgentDialog.tsx +325 -95
- package/src/sharing/__tests__/AgentShareList.test.tsx +388 -0
- package/src/sharing/__tests__/ShareAgentDialog.test.tsx +333 -286
- package/src/sharing/__tests__/{useAgentShare.test.tsx → useAgentShares.test.tsx} +47 -51
- package/src/sharing/__tests__/useCanCreateAgentShare.test.tsx +190 -0
- package/src/sharing/__tests__/useSaveAgentShare.test.tsx +48 -0
- package/src/sharing/index.ts +10 -7
- package/src/sharing/useAgentShares.ts +68 -0
- package/src/sharing/useCanCreateAgentShare.ts +74 -0
- package/src/sharing/useDeleteAgentShare.ts +73 -0
- package/src/sharing/useSaveAgentShare.ts +77 -19
- package/styles.css +1 -1
- package/sharing/useAgentShare.d.ts +0 -43
- package/sharing/useAgentShare.d.ts.map +0 -1
- package/sharing/useAgentShare.js +0 -54
- package/sharing/useAgentShare.js.map +0 -1
- package/sharing/useShareAgent.d.ts +0 -69
- package/sharing/useShareAgent.d.ts.map +0 -1
- package/sharing/useShareAgent.js +0 -42
- package/sharing/useShareAgent.js.map +0 -1
- package/src/sharing/__tests__/useShareAgent.test.tsx +0 -131
- package/src/sharing/useAgentShare.ts +0 -91
- package/src/sharing/useShareAgent.tsx +0 -107
|
@@ -17,41 +17,77 @@ function sharingAudienceToProto(audience) {
|
|
|
17
17
|
: AgentShareAudience.public;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Projects a share into the editable {@link AgentShareDraft} — the
|
|
21
|
+
* single constructor for the full-spec drafts every save requires.
|
|
22
|
+
* `null` (no share yet) seeds the same defaults the server would apply
|
|
23
|
+
* on first create.
|
|
24
|
+
*
|
|
25
|
+
* Shared by the Share dialog (draft seeding) and the share list's
|
|
26
|
+
* pause/resume toggle, so a toggle rebuilds the complete spec with only
|
|
27
|
+
* `enabled` flipped and can never wipe origins, messages, or credential
|
|
28
|
+
* bindings — the fails-closed posture {@link AgentShareDraft} exists to
|
|
29
|
+
* enforce.
|
|
30
|
+
*/
|
|
31
|
+
export function draftFromShare(share) {
|
|
32
|
+
const spec = share?.spec;
|
|
33
|
+
return {
|
|
34
|
+
enabled: spec?.enabled ?? false,
|
|
35
|
+
audience: sharingAudienceFromProto(spec?.audience),
|
|
36
|
+
allowedOrigins: spec?.allowedOrigins ?? [],
|
|
37
|
+
messages: {
|
|
38
|
+
rateLimited: spec?.messages?.rateLimited ?? "",
|
|
39
|
+
unavailable: spec?.messages?.unavailable ?? "",
|
|
40
|
+
conversationEnded: spec?.messages?.conversationEnded ?? "",
|
|
41
|
+
},
|
|
42
|
+
environmentRefs: (spec?.environmentRefs ?? []).map((ref) => ({
|
|
43
|
+
org: ref.org,
|
|
44
|
+
slug: ref.slug,
|
|
45
|
+
})),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Behavior hook that persists an agent share's configuration.
|
|
21
50
|
*
|
|
22
51
|
* Commits via `stigmer.agentShare.apply()` — an idempotent upsert keyed
|
|
23
52
|
* on the share's `(org, slug)` identity — so one code path serves both
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
53
|
+
* creation (the server authorizes on the referenced agent's `can_edit`)
|
|
54
|
+
* and every later edit. There is deliberately no create/update
|
|
55
|
+
* branching: the share slug is unique per org, which makes
|
|
56
|
+
* apply-by-identity exact, and the generated `AgentShareInput` carries
|
|
57
|
+
* no `metadata.id` for an update to route by anyway. A create that
|
|
58
|
+
* collides on `(org, slug)` rejects with an already-exists error rather
|
|
59
|
+
* than touching the existing share.
|
|
30
60
|
*
|
|
31
61
|
* Disabling is a save with `enabled: false` — a config-preserving pause
|
|
32
62
|
* (decision 011 D1). Deleting the share is a separate, destructive
|
|
33
|
-
* operation
|
|
63
|
+
* operation ({@link useDeleteAgentShare}).
|
|
64
|
+
*
|
|
65
|
+
* `shareOrg` selects which org owns a created share and defaults to the
|
|
66
|
+
* agent's own org. Pass the viewer's org to create a **cross-org
|
|
67
|
+
* share** (decision 013) — the server then authorizes on the public
|
|
68
|
+
* agent's `can_execute` plus `can_create_agent_share` in the sharing
|
|
69
|
+
* org, and bills that org.
|
|
34
70
|
*
|
|
35
71
|
* Pass `null` for `agent` to produce a stable no-op (useful while the
|
|
36
72
|
* agent is still loading).
|
|
37
73
|
*
|
|
38
74
|
* @example
|
|
39
75
|
* ```tsx
|
|
40
|
-
* const { share } = useAgentShare(agent);
|
|
41
76
|
* const { save, isPending } = useSaveAgentShare(agent);
|
|
42
77
|
*
|
|
43
|
-
* const persisted = await save({ ...
|
|
78
|
+
* const persisted = await save({ ...draftFromShare(share), enabled: true }, share);
|
|
44
79
|
* // persisted.status.shareLinkToken is the live link token
|
|
45
80
|
* ```
|
|
46
81
|
*/
|
|
47
|
-
export function useSaveAgentShare(agent) {
|
|
82
|
+
export function useSaveAgentShare(agent, shareOrg) {
|
|
48
83
|
const stigmer = useStigmer();
|
|
49
84
|
const [isPending, setIsPending] = useState(false);
|
|
50
85
|
const [error, setError] = useState(null);
|
|
51
86
|
const agentOrg = agent?.metadata?.org ?? "";
|
|
52
87
|
const agentSlug = agent?.metadata?.slug ?? "";
|
|
53
88
|
const agentName = agent?.metadata?.name ?? "";
|
|
54
|
-
const
|
|
89
|
+
const resolvedShareOrg = shareOrg || agentOrg;
|
|
90
|
+
const save = useCallback(async (draft, current, createIdentity) => {
|
|
55
91
|
if (!agentOrg || !agentSlug)
|
|
56
92
|
return undefined;
|
|
57
93
|
setIsPending(true);
|
|
@@ -59,13 +95,17 @@ export function useSaveAgentShare(agent) {
|
|
|
59
95
|
try {
|
|
60
96
|
return await stigmer.agentShare.apply({
|
|
61
97
|
// Identity: the existing share's org/slug when editing (a
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
98
|
+
// share may carry a non-default slug — apply with the agent's
|
|
99
|
+
// slug would create a SECOND share); when creating, the
|
|
100
|
+
// sharing org + the caller-chosen identity, falling back to
|
|
101
|
+
// the agent's own slug/name (the server's D2 default, made
|
|
65
102
|
// explicit).
|
|
66
|
-
org: current?.metadata?.org ||
|
|
67
|
-
slug: current?.metadata?.slug || agentSlug,
|
|
68
|
-
name: current?.metadata?.name ||
|
|
103
|
+
org: current?.metadata?.org || resolvedShareOrg,
|
|
104
|
+
slug: current?.metadata?.slug || createIdentity?.slug || agentSlug,
|
|
105
|
+
name: current?.metadata?.name ||
|
|
106
|
+
createIdentity?.name ||
|
|
107
|
+
agentName ||
|
|
108
|
+
agentSlug,
|
|
69
109
|
agentRef: { org: agentOrg, slug: agentSlug },
|
|
70
110
|
enabled: draft.enabled,
|
|
71
111
|
// Written as the explicit enum value, never left unspecified —
|
|
@@ -91,7 +131,7 @@ export function useSaveAgentShare(agent) {
|
|
|
91
131
|
finally {
|
|
92
132
|
setIsPending(false);
|
|
93
133
|
}
|
|
94
|
-
}, [agentOrg, agentSlug, agentName, stigmer]);
|
|
134
|
+
}, [agentOrg, agentSlug, agentName, resolvedShareOrg, stigmer]);
|
|
95
135
|
return { save, isPending, error };
|
|
96
136
|
}
|
|
97
137
|
//# sourceMappingURL=useSaveAgentShare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSaveAgentShare.js","sourceRoot":"","sources":["../../src/sharing/useSaveAgentShare.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAqDjD;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAwC;IAExC,OAAO,QAAQ,KAAK,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChE,CAAC;AAED,SAAS,sBAAsB,C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C,CAC5D,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -17,7 +17,7 @@ import { agentToInput } from "./internal/agentToInput.js";
|
|
|
17
17
|
import { ErrorMessage } from "../error/ErrorMessage.js";
|
|
18
18
|
import { VisibilityBadge } from "../library/VisibilitySelector.js";
|
|
19
19
|
import { useManageAccess } from "../access/useManageAccess.js";
|
|
20
|
-
import {
|
|
20
|
+
import { AgentShareList } from "../sharing/AgentShareList.js";
|
|
21
21
|
import { ResourceDetailShell } from "../resource-detail/ResourceDetailShell.js";
|
|
22
22
|
import { Section } from "../resource-detail/Section.js";
|
|
23
23
|
import { useDetailTabs } from "../resource-detail/useDetailTabs.js";
|
|
@@ -37,6 +37,7 @@ const INSTRUCTIONS_COLLAPSED_HEIGHT = "12rem";
|
|
|
37
37
|
|
|
38
38
|
const OVERVIEW_TAB: TabItem = { id: "overview", label: "Overview" };
|
|
39
39
|
const INSTANCES_TAB: TabItem = { id: "instances", label: "Instances" };
|
|
40
|
+
const SHARES_TAB: TabItem = { id: "shares", label: "Shares" };
|
|
40
41
|
const DEPENDENCIES_TAB: TabItem = { id: "dependencies", label: "Dependencies" };
|
|
41
42
|
|
|
42
43
|
/** Props for {@link AgentDetailView}. */
|
|
@@ -129,13 +130,21 @@ export interface AgentDetailViewProps {
|
|
|
129
130
|
*/
|
|
130
131
|
readonly onCreateInstanceClick?: () => void;
|
|
131
132
|
/**
|
|
132
|
-
* Builds the absolute public chat URL
|
|
133
|
+
* Builds the absolute public chat URL for shares in the Shares tab.
|
|
133
134
|
* The host application owns URL construction — its configured public
|
|
134
135
|
* origin may differ from the rendering origin (e.g. the desktop app).
|
|
135
|
-
* When omitted,
|
|
136
|
+
* When omitted, share links fall back to the relative
|
|
136
137
|
* `/chat/<org>/<slug>` path.
|
|
137
138
|
*/
|
|
138
139
|
readonly buildShareUrl?: (org: string, slug: string) => string;
|
|
140
|
+
/**
|
|
141
|
+
* The viewer's active organization slug, feeding the Shares tab: a
|
|
142
|
+
* share created there lands in this org — its URL, billing, and
|
|
143
|
+
* credentials — which for another org's marketplace-public agent is a
|
|
144
|
+
* **cross-org share** (decision 013). Omit to default share creation
|
|
145
|
+
* to the agent's own org.
|
|
146
|
+
*/
|
|
147
|
+
readonly viewerOrg?: string;
|
|
139
148
|
/**
|
|
140
149
|
* Called when the user clicks an instance row in the Instances tab.
|
|
141
150
|
* Typically opens an instance detail panel.
|
|
@@ -214,6 +223,7 @@ export function AgentDetailView({
|
|
|
214
223
|
editable = false,
|
|
215
224
|
onResourceUpdated,
|
|
216
225
|
buildShareUrl,
|
|
226
|
+
viewerOrg,
|
|
217
227
|
onCreateInstanceClick,
|
|
218
228
|
onInstanceClick,
|
|
219
229
|
onInstanceStartSessionClick,
|
|
@@ -253,8 +263,8 @@ export function AgentDetailView({
|
|
|
253
263
|
const builtInTabs = useMemo<readonly TabItem[]>(
|
|
254
264
|
() =>
|
|
255
265
|
noDeps
|
|
256
|
-
? [OVERVIEW_TAB, INSTANCES_TAB]
|
|
257
|
-
: [OVERVIEW_TAB, INSTANCES_TAB, DEPENDENCIES_TAB],
|
|
266
|
+
? [OVERVIEW_TAB, INSTANCES_TAB, SHARES_TAB]
|
|
267
|
+
: [OVERVIEW_TAB, INSTANCES_TAB, SHARES_TAB, DEPENDENCIES_TAB],
|
|
258
268
|
[noDeps],
|
|
259
269
|
);
|
|
260
270
|
|
|
@@ -316,15 +326,6 @@ export function AgentDetailView({
|
|
|
316
326
|
: undefined,
|
|
317
327
|
});
|
|
318
328
|
|
|
319
|
-
// Share — the sibling consent to Manage access: visibility governs who
|
|
320
|
-
// can read the blueprint; sharing governs who can chat with the running
|
|
321
|
-
// agent (billed to the owning org). Same null-until-ready contract.
|
|
322
|
-
const share = useShareAgent({
|
|
323
|
-
agent,
|
|
324
|
-
buildShareUrl,
|
|
325
|
-
onSharingChanged: refetch,
|
|
326
|
-
});
|
|
327
|
-
|
|
328
329
|
if (isLoading) return <LoadingSkeleton className={className} />;
|
|
329
330
|
if (error)
|
|
330
331
|
return <ErrorMessage error={error} retry={refetch} className={className} />;
|
|
@@ -363,14 +364,23 @@ export function AgentDetailView({
|
|
|
363
364
|
<VisibilityBadge visibility={meta.visibility} />
|
|
364
365
|
) : undefined;
|
|
365
366
|
|
|
367
|
+
// Share — the sibling consent to Manage access: visibility governs who
|
|
368
|
+
// can read the blueprint; sharing governs who can chat with the running
|
|
369
|
+
// agent (billed to the org that owns each share). Pure navigation to
|
|
370
|
+
// the Shares tab, so it renders unconditionally (like the tab itself);
|
|
371
|
+
// all capability gating lives in the tab, next to its affordances.
|
|
372
|
+
const shareAction: DetailAction = {
|
|
373
|
+
id: "share",
|
|
374
|
+
label: "Share",
|
|
375
|
+
group: "sharing",
|
|
376
|
+
onAction: () => effectiveOnTabChange(SHARES_TAB.id),
|
|
377
|
+
};
|
|
378
|
+
|
|
366
379
|
// Share precedes Manage access within the "sharing" group.
|
|
367
|
-
const injectedActions = [
|
|
380
|
+
const injectedActions = [shareAction, access.action].filter(
|
|
368
381
|
(a): a is NonNullable<typeof a> => a != null,
|
|
369
382
|
);
|
|
370
|
-
const mergedActions =
|
|
371
|
-
injectedActions.length > 0
|
|
372
|
-
? [...(actions ?? []), ...injectedActions]
|
|
373
|
-
: actions;
|
|
383
|
+
const mergedActions = [...(actions ?? []), ...injectedActions];
|
|
374
384
|
|
|
375
385
|
let tabContent: React.ReactNode;
|
|
376
386
|
if (activeAdditionalTab) {
|
|
@@ -388,6 +398,14 @@ export function AgentDetailView({
|
|
|
388
398
|
refreshKey={instancesRefreshKey}
|
|
389
399
|
/>
|
|
390
400
|
);
|
|
401
|
+
} else if (effectiveActiveTab === "shares") {
|
|
402
|
+
tabContent = (
|
|
403
|
+
<AgentShareList
|
|
404
|
+
agent={agent}
|
|
405
|
+
viewerOrg={viewerOrg}
|
|
406
|
+
buildShareUrl={buildShareUrl}
|
|
407
|
+
/>
|
|
408
|
+
);
|
|
391
409
|
} else if (effectiveActiveTab === "dependencies" && tree) {
|
|
392
410
|
tabContent = (
|
|
393
411
|
<DependencyGraph
|
|
@@ -426,7 +444,6 @@ export function AgentDetailView({
|
|
|
426
444
|
{tabContent}
|
|
427
445
|
</ResourceDetailShell>
|
|
428
446
|
{access.dialog}
|
|
429
|
-
{share.dialog}
|
|
430
447
|
</>
|
|
431
448
|
);
|
|
432
449
|
}
|
package/src/index.ts
CHANGED
|
@@ -985,16 +985,19 @@ 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 (
|
|
988
|
+
// and the owner-side Share experience (Shares tab list, dialog, AgentShare hooks).
|
|
989
989
|
export {
|
|
990
990
|
useSharedAgentProfile,
|
|
991
991
|
SharedAgentChat,
|
|
992
|
+
draftFromShare,
|
|
992
993
|
sharingAudienceFromProto,
|
|
993
|
-
|
|
994
|
+
useAgentShares,
|
|
995
|
+
useCanCreateAgentShare,
|
|
994
996
|
useSaveAgentShare,
|
|
997
|
+
useDeleteAgentShare,
|
|
995
998
|
useRotateShareLink,
|
|
996
999
|
ShareAgentDialog,
|
|
997
|
-
|
|
1000
|
+
AgentShareList,
|
|
998
1001
|
useShareToolReadiness,
|
|
999
1002
|
validateOrigin,
|
|
1000
1003
|
MAX_ALLOWED_ORIGINS,
|
|
@@ -1003,14 +1006,16 @@ export type {
|
|
|
1003
1006
|
UseSharedAgentProfileOptions,
|
|
1004
1007
|
UseSharedAgentProfileReturn,
|
|
1005
1008
|
SharedAgentChatProps,
|
|
1009
|
+
AgentShareCreateIdentity,
|
|
1006
1010
|
AgentShareDraft,
|
|
1007
1011
|
SharingAudience,
|
|
1008
|
-
|
|
1012
|
+
UseAgentSharesReturn,
|
|
1013
|
+
UseCanCreateAgentShareReturn,
|
|
1009
1014
|
UseSaveAgentShareReturn,
|
|
1015
|
+
UseDeleteAgentShareReturn,
|
|
1010
1016
|
UseRotateShareLinkReturn,
|
|
1011
1017
|
ShareAgentDialogProps,
|
|
1012
|
-
|
|
1013
|
-
UseShareAgentReturn,
|
|
1018
|
+
AgentShareListProps,
|
|
1014
1019
|
ShareToolReadiness,
|
|
1015
1020
|
} from "./sharing/index.js";
|
|
1016
1021
|
|