@stigmer/cli 3.1.12 → 3.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/cli",
3
- "version": "3.1.12",
3
+ "version": "3.1.13",
4
4
  "description": "Stigmer command-line interface — manage agents, workflows, MCP servers, skills, and executions from the terminal",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,10 +35,10 @@
35
35
  "@connectrpc/connect": "^2.0.0",
36
36
  "@connectrpc/connect-node": "^2.1.1",
37
37
  "@modelcontextprotocol/sdk": "^1.26.0",
38
- "@stigmer/ink": "3.1.12",
39
- "@stigmer/mcp-server": "3.1.12",
40
- "@stigmer/protos": "3.1.12",
41
- "@stigmer/sdk": "3.1.12",
38
+ "@stigmer/ink": "3.1.13",
39
+ "@stigmer/mcp-server": "3.1.13",
40
+ "@stigmer/protos": "3.1.13",
41
+ "@stigmer/sdk": "3.1.13",
42
42
  "commander": "^12.1.0",
43
43
  "fflate": "^0.8.3",
44
44
  "ink": "^7.0.0",
@@ -1 +1 @@
1
- {"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/resources/share.ts"],"names":[],"mappings":"AA8BA,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7C,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,aAAa,CAAC,CAuExB"}
1
+ {"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/resources/share.ts"],"names":[],"mappings":"AA8BA,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7C,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,aAAa,CAAC,CA4FxB"}
@@ -43,10 +43,28 @@ export async function shareAgent(client, ref, org, options) {
43
43
  ` stigmer share agent ${ref} --org <org>`);
44
44
  }
45
45
  const agent = await resolveAgentRef(client, ref, org);
46
- let share = await resolveCanonicalShare(client, agent);
46
+ const agentOrg = agent.metadata?.org ?? "";
47
+ // The share lands in the CALLER's resolved org (decision 013 D8): when
48
+ // it differs from the agent's, this is a cross-org share — the caller
49
+ // org's own channel (URL, billing, credentials) of another org's
50
+ // marketplace-public agent. An empty org (ID ref without context)
51
+ // falls back to the agent's own — the Phase A same-org form.
52
+ const shareOrg = org || agentOrg;
53
+ const isCrossOrg = shareOrg !== agentOrg;
54
+ let share = await resolveCanonicalShare(client, agent, shareOrg);
47
55
  const current = share?.spec;
48
56
  const currentAudience = audienceFromProto(current?.audience);
49
57
  const targetAudience = options.audience ?? currentAudience;
58
+ // Cross-org shares are public-audience only (decision 013 D3). The
59
+ // server refuses this too; refusing here names the remedy instead of
60
+ // surfacing a bare FAILED_PRECONDITION — and mirrors the share dialog,
61
+ // which hides the audience selector in cross-org mode.
62
+ if (isCrossOrg && targetAudience === "org") {
63
+ throw new UsageError("--audience org is not available for another organization's agent\n\n" +
64
+ `A share of ${agentOrg}/${agent.metadata?.slug ?? ""} in your organization\n` +
65
+ "(" + shareOrg + ") serves anyone with the link. Org-members-only sharing\n" +
66
+ "is limited to the agent's own organization.");
67
+ }
50
68
  // Resetting the link is meaningless for org-members-only shares: their
51
69
  // access is gated by live membership, and the member link never carries
52
70
  // the token. Refuse rather than silently rotating an unused secret —
@@ -71,7 +89,7 @@ export async function shareAgent(client, ref, org, options) {
71
89
  // Apply the COMPLETE spec with only the requested fields changed, so a
72
90
  // CLI toggle can never wipe console-configured origins, visitor
73
91
  // messages, credential bindings, or an org-members-only audience.
74
- share = await client.agentShare.apply(preservingShareInput(agent, share, options.enabled, targetAudience));
92
+ share = await client.agentShare.apply(preservingShareInput(agent, share, shareOrg, options.enabled, targetAudience));
75
93
  }
76
94
  // The rotation is a separate targeted RPC (the token is server-owned
77
95
  // status, not part of the spec apply merges). The returned share carries
@@ -84,19 +102,22 @@ export async function shareAgent(client, ref, org, options) {
84
102
  return describeOutcome(agent, share, options, targetAudience, alreadyInState && options.resetLink !== true);
85
103
  }
86
104
  /**
87
- * The agent's canonical share: the one whose slug equals the agent's (the
88
- * server's default on create), else the first entry, else null when the
89
- * agent has never been shared. Mirrors the web dialog's selection so both
90
- * surfaces manage the same row (decision 011 D3: one canonical share in
91
- * Phase A).
105
+ * The agent's canonical share **within one sharing org**: the one whose
106
+ * slug equals the agent's (the server's default on create), else the
107
+ * first entry in that org, else null when the agent has never been shared
108
+ * there. Mirrors the web dialog's selection so both surfaces manage the
109
+ * same row. The org filter is what keeps each org on its own channel
110
+ * (decision 013): an agent may be shared in N orgs, and toggling here
111
+ * must never edit another org's share.
92
112
  */
93
- async function resolveCanonicalShare(client, agent) {
113
+ async function resolveCanonicalShare(client, agent, shareOrg) {
94
114
  const result = await client.agentShare.getByAgent(create(GetAgentSharesByAgentRequestSchema, {
95
115
  agentId: agent.metadata?.id ?? "",
96
116
  }));
97
117
  const agentSlug = agent.metadata?.slug ?? "";
98
- return (result.items.find((share) => share.metadata?.slug === agentSlug) ??
99
- result.items[0] ??
118
+ const inOrg = result.items.filter((share) => share.metadata?.org === shareOrg);
119
+ return (inOrg.find((share) => share.metadata?.slug === agentSlug) ??
120
+ inOrg[0] ??
100
121
  null);
101
122
  }
102
123
  // Unspecified means public by contract (a share created without an explicit
@@ -109,15 +130,16 @@ function audienceFromProto(audience) {
109
130
  // was never shared before). Identity comes from the existing share when one
110
131
  // exists — a manifest-created share may carry a non-default slug, and
111
132
  // applying with the agent's slug would create a SECOND share — and from the
112
- // agent otherwise (the server's own D2 default, made explicit). The audience
113
- // is written explicitly — never left unspecified — so a console-managed org
114
- // share can't drift back to public.
115
- function preservingShareInput(agent, share, enabled, audience) {
133
+ // sharing org + the agent's slug otherwise (the server's own D2 default,
134
+ // made explicit; for a cross-org share the org is the CALLER's, not the
135
+ // agent's — decision 013). The audience is written explicitly — never left
136
+ // unspecified — so a console-managed org share can't drift back to public.
137
+ function preservingShareInput(agent, share, shareOrg, enabled, audience) {
116
138
  const agentOrg = agent.metadata?.org ?? "";
117
139
  const agentSlug = agent.metadata?.slug ?? "";
118
140
  const current = share?.spec;
119
141
  return {
120
- org: share?.metadata?.org || agentOrg,
142
+ org: share?.metadata?.org || shareOrg,
121
143
  slug: share?.metadata?.slug || agentSlug,
122
144
  name: share?.metadata?.name || agent.metadata?.name || agentSlug,
123
145
  agentRef: { org: agentOrg, slug: agentSlug },
@@ -1 +1 @@
1
- {"version":3,"file":"share.js","sourceRoot":"","sources":["../../src/resources/share.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wCAAwC;AACxC,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,oCAAoC;AACpC,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAC/E,4EAA4E;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EACL,kCAAkC,EAClC,0BAA0B,GAC3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAC9F,OAAO,EACL,YAAY,EACZ,iBAAiB,GAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAgCnD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAe,EACf,GAAW,EACX,GAAW,EACX,OAA0B;IAE1B,sEAAsE;IACtE,yEAAyE;IACzE,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,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,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAChG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAC5E,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -467,6 +467,79 @@ describe("shareAgent --reset-link (rotatable share token)", () => {
467
467
  });
468
468
  });
469
469
 
470
+ describe("shareAgent cross-org (decision 013)", () => {
471
+ it("lands the share in the CALLER's org, agent_ref keeps the provider's", async () => {
472
+ const { client, applies } = fakeClient(makeAgent(), null);
473
+
474
+ const result = await shareAgent(client, "acme/support-agent", "consumer-org", {
475
+ enabled: true,
476
+ ...CLOUD,
477
+ });
478
+
479
+ expect(applies).toHaveLength(1);
480
+ // The share is the caller org's channel: its URL, billing, and
481
+ // credentials — while the blueprint reference stays the provider's.
482
+ expect(applies[0].org).toBe("consumer-org");
483
+ expect(applies[0].slug).toBe("support-agent");
484
+ expect(applies[0].agentRef).toEqual({ org: "acme", slug: "support-agent" });
485
+
486
+ const link = result.sections.find((s) => s.title === "Public chat link");
487
+ expect(link?.items).toEqual(["https://app.stigmer.ai/chat/consumer-org/support-agent"]);
488
+ expect(result.hints.some((h) => h.includes("consumer-org's credits"))).toBe(true);
489
+ });
490
+
491
+ it("never edits the provider org's own share (canonical resolution is org-scoped)", async () => {
492
+ // The provider already shares this agent with its own config; the
493
+ // caller's toggle must create the CALLER org's share, not flip (or
494
+ // inherit the config of) the provider's row.
495
+ const providerShare = makeShare({
496
+ enabled: true,
497
+ allowedOrigins: ["https://provider.example.com"],
498
+ });
499
+ const { client, applies } = fakeClient(makeAgent(), providerShare);
500
+
501
+ await shareAgent(client, "acme/support-agent", "consumer-org", {
502
+ enabled: true,
503
+ ...CLOUD,
504
+ });
505
+
506
+ expect(applies).toHaveLength(1);
507
+ expect(applies[0].org).toBe("consumer-org");
508
+ // Fresh channel, fresh config: the provider's origins must not leak
509
+ // into the caller org's share.
510
+ expect(applies[0].allowedOrigins).toEqual([]);
511
+ });
512
+
513
+ it("refuses --audience org with guidance (cross-org shares are public only)", async () => {
514
+ const { client, applies } = fakeClient(makeAgent(), null);
515
+
516
+ const err = await shareAgent(client, "acme/support-agent", "consumer-org", {
517
+ enabled: true,
518
+ audience: "org",
519
+ ...CLOUD,
520
+ }).catch((e: unknown) => e);
521
+
522
+ expect(err).toBeInstanceOf(UsageError);
523
+ expect((err as Error).message).toContain("agent's own organization");
524
+ expect(classify(err)?.exitCode).toBe(ExitCode.Usage);
525
+ expect(applies).toHaveLength(0);
526
+ });
527
+
528
+ it("passes the server's fail-loud dependency refusal through unchanged", async () => {
529
+ // The D5 sweep names every non-public dependency; the CLI must
530
+ // surface that message verbatim — it tells the caller exactly what
531
+ // to ask the provider org to publish.
532
+ const refusal = new Error(
533
+ "cannot share acme/support-agent across organizations: it references resources that are not public: skill acme/private-skill",
534
+ );
535
+ const { client } = fakeClient(makeAgent(), null, { failWith: refusal });
536
+
537
+ await expect(
538
+ shareAgent(client, "acme/support-agent", "consumer-org", { enabled: true, ...CLOUD }),
539
+ ).rejects.toThrow(/skill acme\/private-skill/);
540
+ });
541
+ });
542
+
470
543
  describe("shareAgent errors", () => {
471
544
  it("fails fast with org guidance for a bare slug and no org", async () => {
472
545
  const { client, applies } = fakeClient(makeAgent(), null);
@@ -93,12 +93,33 @@ export async function shareAgent(
93
93
  }
94
94
 
95
95
  const agent = await resolveAgentRef(client, ref, org);
96
- let share = await resolveCanonicalShare(client, agent);
96
+ const agentOrg = agent.metadata?.org ?? "";
97
+ // The share lands in the CALLER's resolved org (decision 013 D8): when
98
+ // it differs from the agent's, this is a cross-org share — the caller
99
+ // org's own channel (URL, billing, credentials) of another org's
100
+ // marketplace-public agent. An empty org (ID ref without context)
101
+ // falls back to the agent's own — the Phase A same-org form.
102
+ const shareOrg = org || agentOrg;
103
+ const isCrossOrg = shareOrg !== agentOrg;
104
+ let share = await resolveCanonicalShare(client, agent, shareOrg);
97
105
  const current = share?.spec;
98
106
 
99
107
  const currentAudience = audienceFromProto(current?.audience);
100
108
  const targetAudience = options.audience ?? currentAudience;
101
109
 
110
+ // Cross-org shares are public-audience only (decision 013 D3). The
111
+ // server refuses this too; refusing here names the remedy instead of
112
+ // surfacing a bare FAILED_PRECONDITION — and mirrors the share dialog,
113
+ // which hides the audience selector in cross-org mode.
114
+ if (isCrossOrg && targetAudience === "org") {
115
+ throw new UsageError(
116
+ "--audience org is not available for another organization's agent\n\n" +
117
+ `A share of ${agentOrg}/${agent.metadata?.slug ?? ""} in your organization\n` +
118
+ "(" + shareOrg + ") serves anyone with the link. Org-members-only sharing\n" +
119
+ "is limited to the agent's own organization.",
120
+ );
121
+ }
122
+
102
123
  // Resetting the link is meaningless for org-members-only shares: their
103
124
  // access is gated by live membership, and the member link never carries
104
125
  // the token. Refuse rather than silently rotating an unused secret —
@@ -129,7 +150,7 @@ export async function shareAgent(
129
150
  // CLI toggle can never wipe console-configured origins, visitor
130
151
  // messages, credential bindings, or an org-members-only audience.
131
152
  share = await client.agentShare.apply(
132
- preservingShareInput(agent, share, options.enabled, targetAudience),
153
+ preservingShareInput(agent, share, shareOrg, options.enabled, targetAudience),
133
154
  );
134
155
  }
135
156
 
@@ -154,15 +175,18 @@ export async function shareAgent(
154
175
  }
155
176
 
156
177
  /**
157
- * The agent's canonical share: the one whose slug equals the agent's (the
158
- * server's default on create), else the first entry, else null when the
159
- * agent has never been shared. Mirrors the web dialog's selection so both
160
- * surfaces manage the same row (decision 011 D3: one canonical share in
161
- * Phase A).
178
+ * The agent's canonical share **within one sharing org**: the one whose
179
+ * slug equals the agent's (the server's default on create), else the
180
+ * first entry in that org, else null when the agent has never been shared
181
+ * there. Mirrors the web dialog's selection so both surfaces manage the
182
+ * same row. The org filter is what keeps each org on its own channel
183
+ * (decision 013): an agent may be shared in N orgs, and toggling here
184
+ * must never edit another org's share.
162
185
  */
163
186
  async function resolveCanonicalShare(
164
187
  client: Stigmer,
165
188
  agent: Agent,
189
+ shareOrg: string,
166
190
  ): Promise<AgentShare | null> {
167
191
  const result = await client.agentShare.getByAgent(
168
192
  create(GetAgentSharesByAgentRequestSchema, {
@@ -170,9 +194,12 @@ async function resolveCanonicalShare(
170
194
  }),
171
195
  );
172
196
  const agentSlug = agent.metadata?.slug ?? "";
197
+ const inOrg = result.items.filter(
198
+ (share) => share.metadata?.org === shareOrg,
199
+ );
173
200
  return (
174
- result.items.find((share) => share.metadata?.slug === agentSlug) ??
175
- result.items[0] ??
201
+ inOrg.find((share) => share.metadata?.slug === agentSlug) ??
202
+ inOrg[0] ??
176
203
  null
177
204
  );
178
205
  }
@@ -188,12 +215,14 @@ function audienceFromProto(audience: AgentShareAudience | undefined): ShareAudie
188
215
  // was never shared before). Identity comes from the existing share when one
189
216
  // exists — a manifest-created share may carry a non-default slug, and
190
217
  // applying with the agent's slug would create a SECOND share — and from the
191
- // agent otherwise (the server's own D2 default, made explicit). The audience
192
- // is written explicitly — never left unspecified — so a console-managed org
193
- // share can't drift back to public.
218
+ // sharing org + the agent's slug otherwise (the server's own D2 default,
219
+ // made explicit; for a cross-org share the org is the CALLER's, not the
220
+ // agent's — decision 013). The audience is written explicitly — never left
221
+ // unspecified — so a console-managed org share can't drift back to public.
194
222
  function preservingShareInput(
195
223
  agent: Agent,
196
224
  share: AgentShare | null,
225
+ shareOrg: string,
197
226
  enabled: boolean,
198
227
  audience: ShareAudience,
199
228
  ): AgentShareInput {
@@ -201,7 +230,7 @@ function preservingShareInput(
201
230
  const agentSlug = agent.metadata?.slug ?? "";
202
231
  const current = share?.spec;
203
232
  return {
204
- org: share?.metadata?.org || agentOrg,
233
+ org: share?.metadata?.org || shareOrg,
205
234
  slug: share?.metadata?.slug || agentSlug,
206
235
  name: share?.metadata?.name || agent.metadata?.name || agentSlug,
207
236
  agentRef: { org: agentOrg, slug: agentSlug },