@ingram-cloud/sdk 1.10.0 → 1.12.0

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/dist/client.js CHANGED
@@ -354,7 +354,7 @@ export class IngramCloud {
354
354
  list: (aid, opts) => this.data("GET", `/agents/${enc(aid)}/ui`, opts),
355
355
  get: (aid, name, opts) => this.json("GET", `/agents/${enc(aid)}/ui/${enc(name)}`, opts),
356
356
  /** Upload/replace a template — `html` is the bundle, `meta` its
357
- * `{ name, csp?, permissions?, tool? }` sidecar. Replaces by name. */
357
+ * `UiResourceIn` sidecar. Replaces by name. */
358
358
  put: (aid, html, meta, opts) => {
359
359
  const form = new FormData();
360
360
  form.append("file", html instanceof Blob
@@ -23,8 +23,8 @@ export const AgentVariable = z
23
23
  required: z.boolean().optional(),
24
24
  })
25
25
  .meta({ id: "AgentVariable" });
26
- /** A predeclared UI-backed capability (Rung 2) bound to a UI template the MCP
27
- * host's model calls it as a typed tool and the template renders the result. */
26
+ /** A typed app-tool bound to a UI template: the MCP host's model (or the
27
+ * rendered panel) calls it and the template renders the result. */
28
28
  export const UiResourceTool = z
29
29
  .object({
30
30
  description: z.string(),
@@ -32,8 +32,12 @@ export const UiResourceTool = z
32
32
  input_schema: z.record(z.string(), z.unknown()).optional(),
33
33
  /** Scoped instruction the smith runs with when this tool is called. */
34
34
  instruction: z.string().nullish(),
35
- /** Writes gate through approval; reads flow freely (OpenUI Query/Mutation). */
35
+ /** Writes gate through approval; reads flow freely. */
36
36
  mutating: z.boolean().optional(),
37
+ /** Who may call the tool — the MCP Apps `_meta.ui.visibility` list. Omitted
38
+ * means both; `["app"]` hides it from the host's model so only the rendered
39
+ * panel can call it (a refresh or a paginated read). */
40
+ visibility: z.array(z.enum(["model", "app"])).optional(),
37
41
  })
38
42
  .meta({ id: "UiResourceTool" });
39
43
  /** CSP domain allowlists for the sandboxed iframe — the MCP Apps `_meta.ui.csp`
@@ -46,19 +50,30 @@ export const UiCsp = z
46
50
  baseUriDomains: z.array(z.string()).optional(),
47
51
  })
48
52
  .meta({ id: "UiCsp" });
53
+ /** The authored metadata of a UI template — one set of fields shared by the
54
+ * upload sidecar and the stored resource. `csp`, `permissions`, `prefers_border`
55
+ * and `domain` are the MCP Apps resource `_meta.ui`, echoed to the host verbatim. */
56
+ const uiTemplateMeta = {
57
+ csp: UiCsp.nullish(),
58
+ /** Host permissions the template requests, a Permissions-Policy-style map
59
+ * (e.g. `{ "camera": {}, "microphone": {} }`). */
60
+ permissions: z.record(z.string(), z.unknown()).nullish(),
61
+ /** Whether the host should draw its own border around the panel. Omitted
62
+ * leaves it to the host (Claude: borderless on web, bordered on mobile). */
63
+ prefers_border: z.boolean().nullish(),
64
+ /** A stable sandbox origin for the panel, in the host's own format — needed
65
+ * only when the panel runs its own OAuth flow or is CORS-allowlisted. */
66
+ domain: z.string().nullish(),
67
+ tool: UiResourceTool.nullish(),
68
+ };
49
69
  /** A tenant-authored interactive UI template (MCP Apps, SEP-1865) attached to an
50
70
  * agent. The HTML bundle lives in blob storage; this is its wire metadata (the
51
- * internal blob ref is never exposed). `csp`/`permissions` mirror the standard
52
- * `_meta.ui` shape and are echoed to the host on `resources/read`. */
71
+ * internal blob ref is never exposed). */
53
72
  export const UiResource = z
54
73
  .object({
55
74
  name: z.string(),
56
75
  content_hash: z.string(),
57
- csp: UiCsp.optional(),
58
- /** Host permissions the template requests, a Permissions-Policy-style map
59
- * (e.g. `{ "camera": {}, "microphone": {} }`). */
60
- permissions: z.record(z.string(), z.unknown()).optional(),
61
- tool: UiResourceTool.nullish(),
76
+ ...uiTemplateMeta,
62
77
  })
63
78
  .meta({ id: "UiResource" });
64
79
  /** The mutable draft head — what the next publish snapshots. */
@@ -180,9 +195,7 @@ export const UiResourceIn = z
180
195
  .string()
181
196
  .regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase letters, digits, - and _")
182
197
  .max(63),
183
- csp: UiCsp.nullish(),
184
- permissions: z.record(z.string(), z.unknown()).nullish(),
185
- tool: UiResourceTool.nullish(),
198
+ ...uiTemplateMeta,
186
199
  })
187
200
  .meta({ id: "UiResourceIn" });
188
201
  export const UiResourceListOut = z
@@ -285,11 +285,30 @@ export const AuthorizeRequestOut = z
285
285
  deployment_id: z.string(),
286
286
  })
287
287
  .meta({ id: "AuthorizeRequestOut" });
288
+ /** Who consented, for an `app` request that asked for `openid`.
289
+ *
290
+ * The consent page is the only party that ever sees the person — the API is
291
+ * handed an organization token and would otherwise learn nothing about them.
292
+ * So the page asserts the identity here, and the API signs it into an
293
+ * `id_token` the app can verify against the published JWKS. OIDC claim names,
294
+ * because that is what an app already knows how to read. */
295
+ export const AuthorizeUser = z
296
+ .object({
297
+ sub: z.string(),
298
+ email: z.string().nullish(),
299
+ email_verified: z.boolean().nullish(),
300
+ name: z.string().nullish(),
301
+ picture: z.string().nullish(),
302
+ })
303
+ .meta({ id: "AuthorizeUser" });
288
304
  /** Complete the delegated grant server-to-server. A `connector` request names
289
- * the smith the end-user authorized; an `app` request carries nothing — the
290
- * organization is the token's. */
305
+ * the smith the end-user authorized; an `app` request carries the organization
306
+ * implicitly (it is the token's) and `user` when `openid` was requested. */
291
307
  export const AuthorizeCompleteIn = z
292
- .object({ smith_id: z.string().nullish() })
308
+ .object({
309
+ smith_id: z.string().nullish(),
310
+ user: AuthorizeUser.nullish(),
311
+ })
293
312
  .meta({ id: "AuthorizeCompleteIn" });
294
313
  /** Where the tenant 302s the browser after completing or declining. */
295
314
  export const AuthorizeRedirectOut = z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingram-cloud/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Typed wire contract + management-plane client for the Ingram Cloud API: Zod schemas to validate request/response bodies, TypeScript types for the JSON you read back, SSE/webhook event types, and a typed REST client.",
5
5
  "keywords": [
6
6
  "api",
@@ -63,7 +63,7 @@
63
63
  "prepack": "bun run build"
64
64
  },
65
65
  "dependencies": {
66
- "zod": "^4.4.3"
66
+ "zod": "^4.5.4"
67
67
  },
68
68
  "devDependencies": {
69
69
  "vitest": "^4.1.10"
package/ts/client.ts CHANGED
@@ -832,7 +832,7 @@ export class IngramCloud {
832
832
  opts,
833
833
  ),
834
834
  /** Upload/replace a template — `html` is the bundle, `meta` its
835
- * `{ name, csp?, permissions?, tool? }` sidecar. Replaces by name. */
835
+ * `UiResourceIn` sidecar. Replaces by name. */
836
836
  put: (
837
837
  aid: string,
838
838
  html: string | Blob,
package/ts/zod/agents.ts CHANGED
@@ -25,8 +25,8 @@ export const AgentVariable = z
25
25
  })
26
26
  .meta({ id: "AgentVariable" });
27
27
 
28
- /** A predeclared UI-backed capability (Rung 2) bound to a UI template the MCP
29
- * host's model calls it as a typed tool and the template renders the result. */
28
+ /** A typed app-tool bound to a UI template: the MCP host's model (or the
29
+ * rendered panel) calls it and the template renders the result. */
30
30
  export const UiResourceTool = z
31
31
  .object({
32
32
  description: z.string(),
@@ -34,8 +34,12 @@ export const UiResourceTool = z
34
34
  input_schema: z.record(z.string(), z.unknown()).optional(),
35
35
  /** Scoped instruction the smith runs with when this tool is called. */
36
36
  instruction: z.string().nullish(),
37
- /** Writes gate through approval; reads flow freely (OpenUI Query/Mutation). */
37
+ /** Writes gate through approval; reads flow freely. */
38
38
  mutating: z.boolean().optional(),
39
+ /** Who may call the tool — the MCP Apps `_meta.ui.visibility` list. Omitted
40
+ * means both; `["app"]` hides it from the host's model so only the rendered
41
+ * panel can call it (a refresh or a paginated read). */
42
+ visibility: z.array(z.enum(["model", "app"])).optional(),
39
43
  })
40
44
  .meta({ id: "UiResourceTool" });
41
45
 
@@ -50,19 +54,31 @@ export const UiCsp = z
50
54
  })
51
55
  .meta({ id: "UiCsp" });
52
56
 
57
+ /** The authored metadata of a UI template — one set of fields shared by the
58
+ * upload sidecar and the stored resource. `csp`, `permissions`, `prefers_border`
59
+ * and `domain` are the MCP Apps resource `_meta.ui`, echoed to the host verbatim. */
60
+ const uiTemplateMeta = {
61
+ csp: UiCsp.nullish(),
62
+ /** Host permissions the template requests, a Permissions-Policy-style map
63
+ * (e.g. `{ "camera": {}, "microphone": {} }`). */
64
+ permissions: z.record(z.string(), z.unknown()).nullish(),
65
+ /** Whether the host should draw its own border around the panel. Omitted
66
+ * leaves it to the host (Claude: borderless on web, bordered on mobile). */
67
+ prefers_border: z.boolean().nullish(),
68
+ /** A stable sandbox origin for the panel, in the host's own format — needed
69
+ * only when the panel runs its own OAuth flow or is CORS-allowlisted. */
70
+ domain: z.string().nullish(),
71
+ tool: UiResourceTool.nullish(),
72
+ };
73
+
53
74
  /** A tenant-authored interactive UI template (MCP Apps, SEP-1865) attached to an
54
75
  * agent. The HTML bundle lives in blob storage; this is its wire metadata (the
55
- * internal blob ref is never exposed). `csp`/`permissions` mirror the standard
56
- * `_meta.ui` shape and are echoed to the host on `resources/read`. */
76
+ * internal blob ref is never exposed). */
57
77
  export const UiResource = z
58
78
  .object({
59
79
  name: z.string(),
60
80
  content_hash: z.string(),
61
- csp: UiCsp.optional(),
62
- /** Host permissions the template requests, a Permissions-Policy-style map
63
- * (e.g. `{ "camera": {}, "microphone": {} }`). */
64
- permissions: z.record(z.string(), z.unknown()).optional(),
65
- tool: UiResourceTool.nullish(),
81
+ ...uiTemplateMeta,
66
82
  })
67
83
  .meta({ id: "UiResource" });
68
84
 
@@ -197,9 +213,7 @@ export const UiResourceIn = z
197
213
  .string()
198
214
  .regex(/^[a-z0-9][a-z0-9_-]*$/, "lowercase letters, digits, - and _")
199
215
  .max(63),
200
- csp: UiCsp.nullish(),
201
- permissions: z.record(z.string(), z.unknown()).nullish(),
202
- tool: UiResourceTool.nullish(),
216
+ ...uiTemplateMeta,
203
217
  })
204
218
  .meta({ id: "UiResourceIn" });
205
219
 
package/ts/zod/tenant.ts CHANGED
@@ -328,11 +328,31 @@ export const AuthorizeRequestOut = z
328
328
  })
329
329
  .meta({ id: "AuthorizeRequestOut" });
330
330
 
331
+ /** Who consented, for an `app` request that asked for `openid`.
332
+ *
333
+ * The consent page is the only party that ever sees the person — the API is
334
+ * handed an organization token and would otherwise learn nothing about them.
335
+ * So the page asserts the identity here, and the API signs it into an
336
+ * `id_token` the app can verify against the published JWKS. OIDC claim names,
337
+ * because that is what an app already knows how to read. */
338
+ export const AuthorizeUser = z
339
+ .object({
340
+ sub: z.string(),
341
+ email: z.string().nullish(),
342
+ email_verified: z.boolean().nullish(),
343
+ name: z.string().nullish(),
344
+ picture: z.string().nullish(),
345
+ })
346
+ .meta({ id: "AuthorizeUser" });
347
+
331
348
  /** Complete the delegated grant server-to-server. A `connector` request names
332
- * the smith the end-user authorized; an `app` request carries nothing — the
333
- * organization is the token's. */
349
+ * the smith the end-user authorized; an `app` request carries the organization
350
+ * implicitly (it is the token's) and `user` when `openid` was requested. */
334
351
  export const AuthorizeCompleteIn = z
335
- .object({ smith_id: z.string().nullish() })
352
+ .object({
353
+ smith_id: z.string().nullish(),
354
+ user: AuthorizeUser.nullish(),
355
+ })
336
356
  .meta({ id: "AuthorizeCompleteIn" });
337
357
 
338
358
  /** Where the tenant 302s the browser after completing or declining. */