@stigmer/react 3.1.13 → 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.
Files changed (69) hide show
  1. package/agent/AgentDetailView.d.ts +7 -9
  2. package/agent/AgentDetailView.d.ts.map +1 -1
  3. package/agent/AgentDetailView.js +22 -30
  4. package/agent/AgentDetailView.js.map +1 -1
  5. package/index.d.ts +2 -2
  6. package/index.d.ts.map +1 -1
  7. package/index.js +2 -2
  8. package/index.js.map +1 -1
  9. package/package.json +4 -4
  10. package/sharing/AgentShareList.d.ts +44 -0
  11. package/sharing/AgentShareList.d.ts.map +1 -0
  12. package/sharing/AgentShareList.js +149 -0
  13. package/sharing/AgentShareList.js.map +1 -0
  14. package/sharing/ShareAgentDialog.d.ts +38 -25
  15. package/sharing/ShareAgentDialog.d.ts.map +1 -1
  16. package/sharing/ShareAgentDialog.js +131 -62
  17. package/sharing/ShareAgentDialog.js.map +1 -1
  18. package/sharing/index.d.ts +10 -8
  19. package/sharing/index.d.ts.map +1 -1
  20. package/sharing/index.js +5 -4
  21. package/sharing/index.js.map +1 -1
  22. package/sharing/useAgentShares.d.ts +42 -0
  23. package/sharing/useAgentShares.d.ts.map +1 -0
  24. package/sharing/useAgentShares.js +38 -0
  25. package/sharing/useAgentShares.js.map +1 -0
  26. package/sharing/useCanCreateAgentShare.d.ts +43 -0
  27. package/sharing/useCanCreateAgentShare.d.ts.map +1 -0
  28. package/sharing/useCanCreateAgentShare.js +44 -0
  29. package/sharing/useCanCreateAgentShare.js.map +1 -0
  30. package/sharing/useDeleteAgentShare.d.ts +42 -0
  31. package/sharing/useDeleteAgentShare.d.ts.map +1 -0
  32. package/sharing/useDeleteAgentShare.js +45 -0
  33. package/sharing/useDeleteAgentShare.js.map +1 -0
  34. package/sharing/useSaveAgentShare.d.ts +43 -18
  35. package/sharing/useSaveAgentShare.d.ts.map +1 -1
  36. package/sharing/useSaveAgentShare.js +55 -22
  37. package/sharing/useSaveAgentShare.js.map +1 -1
  38. package/src/agent/AgentDetailView.tsx +34 -43
  39. package/src/index.ts +11 -9
  40. package/src/sharing/AgentShareList.tsx +507 -0
  41. package/src/sharing/ShareAgentDialog.tsx +310 -112
  42. package/src/sharing/__tests__/AgentShareList.test.tsx +388 -0
  43. package/src/sharing/__tests__/ShareAgentDialog.test.tsx +311 -312
  44. package/src/sharing/__tests__/useAgentShares.test.tsx +145 -0
  45. package/src/sharing/__tests__/useCanCreateAgentShare.test.tsx +190 -0
  46. package/src/sharing/index.ts +10 -12
  47. package/src/sharing/useAgentShares.ts +68 -0
  48. package/src/sharing/useCanCreateAgentShare.ts +74 -0
  49. package/src/sharing/useDeleteAgentShare.ts +73 -0
  50. package/src/sharing/useSaveAgentShare.ts +73 -23
  51. package/styles.css +1 -1
  52. package/sharing/useAgentShare.d.ts +0 -49
  53. package/sharing/useAgentShare.d.ts.map +0 -1
  54. package/sharing/useAgentShare.js +0 -64
  55. package/sharing/useAgentShare.js.map +0 -1
  56. package/sharing/useCreateExternalShareLink.d.ts +0 -90
  57. package/sharing/useCreateExternalShareLink.d.ts.map +0 -1
  58. package/sharing/useCreateExternalShareLink.js +0 -65
  59. package/sharing/useCreateExternalShareLink.js.map +0 -1
  60. package/sharing/useShareAgent.d.ts +0 -69
  61. package/sharing/useShareAgent.d.ts.map +0 -1
  62. package/sharing/useShareAgent.js +0 -42
  63. package/sharing/useShareAgent.js.map +0 -1
  64. package/src/sharing/__tests__/useAgentShare.test.tsx +0 -210
  65. package/src/sharing/__tests__/useCreateExternalShareLink.test.tsx +0 -194
  66. package/src/sharing/__tests__/useShareAgent.test.tsx +0 -131
  67. package/src/sharing/useAgentShare.ts +0 -105
  68. package/src/sharing/useCreateExternalShareLink.tsx +0 -141
  69. package/src/sharing/useShareAgent.tsx +0 -107
@@ -17,36 +17,65 @@ function sharingAudienceToProto(audience) {
17
17
  : AgentShareAudience.public;
18
18
  }
19
19
  /**
20
- * Behavior hook that persists an agent's canonical share configuration.
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
- * the first enable (creates the share; the server authorizes on the
25
- * referenced agent's `can_edit`) and every later edit. There is
26
- * deliberately no create/update branching: the share slug is unique per
27
- * org and defaults to the agent's slug, which makes apply-by-identity
28
- * exact, and the generated `AgentShareInput` carries no `metadata.id`
29
- * for an update to route by anyway.
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 this hook does not perform.
63
+ * operation ({@link useDeleteAgentShare}).
34
64
  *
35
- * `shareOrg` selects which org's channel a first save creates and
36
- * defaults to the agent's own org. Pass the viewer's org to create a
37
- * **cross-org share** (decision 013) — the server then authorizes on the
38
- * public agent's `can_execute` plus `can_create_agent_share` in the
39
- * sharing org, and bills that org.
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.
40
70
  *
41
71
  * Pass `null` for `agent` to produce a stable no-op (useful while the
42
72
  * agent is still loading).
43
73
  *
44
74
  * @example
45
75
  * ```tsx
46
- * const { share } = useAgentShare(agent);
47
76
  * const { save, isPending } = useSaveAgentShare(agent);
48
77
  *
49
- * const persisted = await save({ ...draft, enabled: true }, share);
78
+ * const persisted = await save({ ...draftFromShare(share), enabled: true }, share);
50
79
  * // persisted.status.shareLinkToken is the live link token
51
80
  * ```
52
81
  */
@@ -58,7 +87,7 @@ export function useSaveAgentShare(agent, shareOrg) {
58
87
  const agentSlug = agent?.metadata?.slug ?? "";
59
88
  const agentName = agent?.metadata?.name ?? "";
60
89
  const resolvedShareOrg = shareOrg || agentOrg;
61
- const save = useCallback(async (draft, current) => {
90
+ const save = useCallback(async (draft, current, createIdentity) => {
62
91
  if (!agentOrg || !agentSlug)
63
92
  return undefined;
64
93
  setIsPending(true);
@@ -66,13 +95,17 @@ export function useSaveAgentShare(agent, shareOrg) {
66
95
  try {
67
96
  return await stigmer.agentShare.apply({
68
97
  // Identity: the existing share's org/slug when editing (a
69
- // manifest-created share may carry a non-default slug — apply
70
- // with the agent's slug would create a SECOND share), the
71
- // sharing org + the agent's slug when creating (the server's
72
- // own D2 default, made explicit).
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
102
+ // explicit).
73
103
  org: current?.metadata?.org || resolvedShareOrg,
74
- slug: current?.metadata?.slug || agentSlug,
75
- name: current?.metadata?.name || agentName || agentSlug,
104
+ slug: current?.metadata?.slug || createIdentity?.slug || agentSlug,
105
+ name: current?.metadata?.name ||
106
+ createIdentity?.name ||
107
+ agentName ||
108
+ agentSlug,
76
109
  agentRef: { org: agentOrg, slug: agentSlug },
77
110
  enabled: draft.enabled,
78
111
  // Written as the explicit enum value, never left unspecified —
@@ -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,CAAC,QAAyB;IACvD,OAAO,QAAQ,KAAK,KAAK;QACvB,CAAC,CAAC,kBAAkB,CAAC,GAAG;QACxB,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC;AAChC,CAAC;AAsBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAmB,EACnB,QAAiB;IAEjB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAA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AAC,QAAQ,CAAC,WAAW;oBACvC,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,iBAAiB;iBACpD;gBACD,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACnD,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,IAAI,EAAE,GAAG,CAAC,IAAI;iBACf,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,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,EACD,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAC5D,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC"}
@@ -17,8 +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 { useShareAgent } from "../sharing/useShareAgent.js";
21
- import { useCreateExternalShareLink } from "../sharing/useCreateExternalShareLink.js";
20
+ import { AgentShareList } from "../sharing/AgentShareList.js";
22
21
  import { ResourceDetailShell } from "../resource-detail/ResourceDetailShell.js";
23
22
  import { Section } from "../resource-detail/Section.js";
24
23
  import { useDetailTabs } from "../resource-detail/useDetailTabs.js";
@@ -38,6 +37,7 @@ const INSTRUCTIONS_COLLAPSED_HEIGHT = "12rem";
38
37
 
39
38
  const OVERVIEW_TAB: TabItem = { id: "overview", label: "Overview" };
40
39
  const INSTANCES_TAB: TabItem = { id: "instances", label: "Instances" };
40
+ const SHARES_TAB: TabItem = { id: "shares", label: "Shares" };
41
41
  const DEPENDENCIES_TAB: TabItem = { id: "dependencies", label: "Dependencies" };
42
42
 
43
43
  /** Props for {@link AgentDetailView}. */
@@ -130,21 +130,19 @@ export interface AgentDetailViewProps {
130
130
  */
131
131
  readonly onCreateInstanceClick?: () => void;
132
132
  /**
133
- * Builds the absolute public chat URL shown in the Share dialog.
133
+ * Builds the absolute public chat URL for shares in the Shares tab.
134
134
  * The host application owns URL construction — its configured public
135
135
  * origin may differ from the rendering origin (e.g. the desktop app).
136
- * When omitted, the dialog falls back to the relative
136
+ * When omitted, share links fall back to the relative
137
137
  * `/chat/<org>/<slug>` path.
138
138
  */
139
139
  readonly buildShareUrl?: (org: string, slug: string) => string;
140
140
  /**
141
- * The viewer's active organization slug. When it differs from the
142
- * agent's org and the agent is marketplace-public, the kebab gains a
143
- * "Create share link" action the viewer org's own share of this
144
- * agent (decision 013): its URL, billing, and credentials, against the
145
- * agent org's live blueprint. Omit to disable the cross-org entry
146
- * (the same-org Share action is unaffected — it gates on agent
147
- * `can_edit`, not on this prop).
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.
148
146
  */
149
147
  readonly viewerOrg?: string;
150
148
  /**
@@ -265,8 +263,8 @@ export function AgentDetailView({
265
263
  const builtInTabs = useMemo<readonly TabItem[]>(
266
264
  () =>
267
265
  noDeps
268
- ? [OVERVIEW_TAB, INSTANCES_TAB]
269
- : [OVERVIEW_TAB, INSTANCES_TAB, DEPENDENCIES_TAB],
266
+ ? [OVERVIEW_TAB, INSTANCES_TAB, SHARES_TAB]
267
+ : [OVERVIEW_TAB, INSTANCES_TAB, SHARES_TAB, DEPENDENCIES_TAB],
270
268
  [noDeps],
271
269
  );
272
270
 
@@ -328,27 +326,6 @@ export function AgentDetailView({
328
326
  : undefined,
329
327
  });
330
328
 
331
- // Share — the sibling consent to Manage access: visibility governs who
332
- // can read the blueprint; sharing governs who can chat with the running
333
- // agent (billed to the owning org). Same null-until-ready contract.
334
- const share = useShareAgent({
335
- agent,
336
- buildShareUrl,
337
- onSharingChanged: refetch,
338
- });
339
-
340
- // Cross-org "Create share link" (decision 013) — the marketplace entry
341
- // for another org's public agent. Mutually exclusive with the Share
342
- // action above by construction (same-org gates on can_edit; this one
343
- // requires viewerOrg != agent org), so both fold into the actions
344
- // array unconditionally.
345
- const externalShare = useCreateExternalShareLink({
346
- agent,
347
- viewerOrg: viewerOrg ?? "",
348
- buildShareUrl,
349
- onSharingChanged: refetch,
350
- });
351
-
352
329
  if (isLoading) return <LoadingSkeleton className={className} />;
353
330
  if (error)
354
331
  return <ErrorMessage error={error} retry={refetch} className={className} />;
@@ -387,15 +364,23 @@ export function AgentDetailView({
387
364
  <VisibilityBadge visibility={meta.visibility} />
388
365
  ) : undefined;
389
366
 
390
- // Share (or its cross-org sibling) precedes Manage access within the
391
- // "sharing" group.
392
- const injectedActions = [share.action, externalShare.action, access.action].filter(
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
+
379
+ // Share precedes Manage access within the "sharing" group.
380
+ const injectedActions = [shareAction, access.action].filter(
393
381
  (a): a is NonNullable<typeof a> => a != null,
394
382
  );
395
- const mergedActions =
396
- injectedActions.length > 0
397
- ? [...(actions ?? []), ...injectedActions]
398
- : actions;
383
+ const mergedActions = [...(actions ?? []), ...injectedActions];
399
384
 
400
385
  let tabContent: React.ReactNode;
401
386
  if (activeAdditionalTab) {
@@ -413,6 +398,14 @@ export function AgentDetailView({
413
398
  refreshKey={instancesRefreshKey}
414
399
  />
415
400
  );
401
+ } else if (effectiveActiveTab === "shares") {
402
+ tabContent = (
403
+ <AgentShareList
404
+ agent={agent}
405
+ viewerOrg={viewerOrg}
406
+ buildShareUrl={buildShareUrl}
407
+ />
408
+ );
416
409
  } else if (effectiveActiveTab === "dependencies" && tree) {
417
410
  tabContent = (
418
411
  <DependencyGraph
@@ -451,8 +444,6 @@ export function AgentDetailView({
451
444
  {tabContent}
452
445
  </ResourceDetailShell>
453
446
  {access.dialog}
454
- {share.dialog}
455
- {externalShare.dialog}
456
447
  </>
457
448
  );
458
449
  }
package/src/index.ts CHANGED
@@ -985,17 +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 (dialog, kebab hook, AgentShare hooks).
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
- useAgentShare,
994
+ useAgentShares,
995
+ useCanCreateAgentShare,
994
996
  useSaveAgentShare,
997
+ useDeleteAgentShare,
995
998
  useRotateShareLink,
996
999
  ShareAgentDialog,
997
- useShareAgent,
998
- useCreateExternalShareLink,
1000
+ AgentShareList,
999
1001
  useShareToolReadiness,
1000
1002
  validateOrigin,
1001
1003
  MAX_ALLOWED_ORIGINS,
@@ -1004,16 +1006,16 @@ export type {
1004
1006
  UseSharedAgentProfileOptions,
1005
1007
  UseSharedAgentProfileReturn,
1006
1008
  SharedAgentChatProps,
1009
+ AgentShareCreateIdentity,
1007
1010
  AgentShareDraft,
1008
1011
  SharingAudience,
1009
- UseAgentShareReturn,
1012
+ UseAgentSharesReturn,
1013
+ UseCanCreateAgentShareReturn,
1010
1014
  UseSaveAgentShareReturn,
1015
+ UseDeleteAgentShareReturn,
1011
1016
  UseRotateShareLinkReturn,
1012
1017
  ShareAgentDialogProps,
1013
- UseShareAgentArgs,
1014
- UseShareAgentReturn,
1015
- UseCreateExternalShareLinkArgs,
1016
- UseCreateExternalShareLinkReturn,
1018
+ AgentShareListProps,
1017
1019
  ShareToolReadiness,
1018
1020
  } from "./sharing/index.js";
1019
1021