@ingram-cloud/sdk 1.6.0 → 1.8.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
@@ -709,5 +709,11 @@ export class IngramCloud {
709
709
  delete: (pid, tid, opts) => this.empty("DELETE", `/organization/projects/${enc(pid)}/tokens/${enc(tid)}`, opts),
710
710
  },
711
711
  },
712
+ /** Third-party apps linked through the authorization server. */
713
+ apps: {
714
+ list: (query, opts) => this.page("/organization/apps", query, opts),
715
+ /** Disconnect: revokes every token the app holds. */
716
+ delete: (id, opts) => this.empty("DELETE", `/organization/apps/${enc(id)}`, opts),
717
+ },
712
718
  };
713
719
  }
@@ -26,6 +26,27 @@ export const ProjectOut = z
26
26
  })
27
27
  .meta({ id: "ProjectOut" });
28
28
  export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
29
+ /**
30
+ * A third-party app linked to the organization through the authorization
31
+ * server (`GET /oauth/authorize` with no `resource`): one per `(organization,
32
+ * client_id)`, owning the project it runs in. Disconnecting revokes every
33
+ * token the app holds.
34
+ */
35
+ export const AppInstallOut = z
36
+ .object({
37
+ id: z.string(),
38
+ organization: z.string(),
39
+ /** The app's Client ID Metadata Document URL. */
40
+ client_id: z.string(),
41
+ client_name: z.string(),
42
+ project: z.string(),
43
+ /** The scopes the app's tokens carry, space-separated. */
44
+ scope: z.string(),
45
+ created_at: z.string(),
46
+ revoked_at: z.string().nullable(),
47
+ })
48
+ .meta({ id: "AppInstallOut" });
49
+ export const AppInstallListOut = pageOut(AppInstallOut, "AppInstallListOut");
29
50
  /**
30
51
  * The secret minted when an org mints a project (tenant-admin) token. Shape
31
52
  * matches `mintToken`'s return; the `tenant` module owns the canonical
@@ -12,11 +12,17 @@
12
12
  * operator can roll back. History is append-only — a *restore* re-applies an old
13
13
  * snapshot as a brand-new revision.
14
14
  *
15
+ * `snapshot` must carry every key the API snapshots, or Zod strips the missing
16
+ * one from the response: it is stored and re-applied on restore, but invisible
17
+ * to the operator deciding whether to roll back. `skills` was absent here and
18
+ * did exactly that.
19
+ *
15
20
  * `.meta({ id })` names the component so the emitted OpenAPI references it as
16
21
  * `#/components/schemas/<id>` rather than inlining it.
17
22
  */
18
23
  import { z } from "zod";
19
24
  import { pageOut } from "./_page.js";
25
+ import { SkillRef } from "./skills.js";
20
26
  /** An immutable snapshot of a smith's effective behaviour config at one revision. */
21
27
  export const SmithRevisionOut = z
22
28
  .object({
@@ -27,6 +33,8 @@ export const SmithRevisionOut = z
27
33
  enabled_hosted_tools: z.array(z.string()).optional(),
28
34
  vector_store_ids: z.array(z.string()).optional(),
29
35
  mcp_servers: z.array(z.string()).nullish(),
36
+ /** Skills the smith carried at this revision. */
37
+ skills: z.array(SkillRef).nullish(),
30
38
  // Nullish: a snapshot taken while the smith inherited a sparse agent
31
39
  // version carries null (= the default) for these.
32
40
  auto_memory: z.boolean().nullish(),
@@ -263,17 +263,27 @@ export const ProviderIn = z
263
263
  * `authorize_url`. */
264
264
  export const AuthorizeRequestOut = z
265
265
  .object({
266
+ /** `connector`: an MCP host connecting to a deployment (the tenant's page
267
+ * completes it naming a smith). `app`: a third-party app linking an
268
+ * organization (the console completes it with an organization token; the
269
+ * grant's subject is the app's project in that organization). */
270
+ kind: z.enum(["connector", "app"]),
271
+ client_id: z.string(),
266
272
  client_name: z.string(),
273
+ /** The scopes the client asked for, space-separated (`app` only). */
274
+ scope: z.string(),
267
275
  target_name: z.string(),
276
+ /** '' on an `app` request until it is completed. */
268
277
  tenant: z.string(),
269
278
  resource: z.string(),
270
279
  deployment_id: z.string(),
271
280
  })
272
281
  .meta({ id: "AuthorizeRequestOut" });
273
- /** Complete the delegated grant: the tenant asserts (server-to-server) which
274
- * smith the end-user authorized. */
282
+ /** Complete the delegated grant server-to-server. A `connector` request names
283
+ * the smith the end-user authorized; an `app` request carries nothing — the
284
+ * organization is the token's. */
275
285
  export const AuthorizeCompleteIn = z
276
- .object({ smith_id: z.string() })
286
+ .object({ smith_id: z.string().nullish() })
277
287
  .meta({ id: "AuthorizeCompleteIn" });
278
288
  /** Where the tenant 302s the browser after completing or declining. */
279
289
  export const AuthorizeRedirectOut = z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingram-cloud/sdk",
3
- "version": "1.6.0",
3
+ "version": "1.8.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",
package/ts/client.ts CHANGED
@@ -56,6 +56,7 @@ import type {
56
56
  ICOrgUsage,
57
57
  ICOrgUsageSeries,
58
58
  ICProject,
59
+ ICAppInstall,
59
60
  ICProvider,
60
61
  ICRecallHit,
61
62
  ICRun,
@@ -1690,5 +1691,14 @@ export class IngramCloud {
1690
1691
  ),
1691
1692
  },
1692
1693
  },
1694
+
1695
+ /** Third-party apps linked through the authorization server. */
1696
+ apps: {
1697
+ list: (query?: PageOpts, opts?: RequestOptions) =>
1698
+ this.page<ICAppInstall>("/organization/apps", query, opts),
1699
+ /** Disconnect: revokes every token the app holds. */
1700
+ delete: (id: string, opts?: RequestOptions) =>
1701
+ this.empty("DELETE", `/organization/apps/${enc(id)}`, opts),
1702
+ },
1693
1703
  };
1694
1704
  }
package/ts/responses.ts CHANGED
@@ -84,7 +84,7 @@ export type {
84
84
  ICUsageBreakdown,
85
85
  ICUsageEvent,
86
86
  } from "./zod/observability.js";
87
- export type { ICProject } from "./zod/projects.js";
87
+ export type { ICProject, ICAppInstall } from "./zod/projects.js";
88
88
  export type { ICActor } from "./zod/_actor.js";
89
89
  export type {
90
90
  ICRun,
@@ -29,6 +29,29 @@ export const ProjectOut = z
29
29
 
30
30
  export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
31
31
 
32
+ /**
33
+ * A third-party app linked to the organization through the authorization
34
+ * server (`GET /oauth/authorize` with no `resource`): one per `(organization,
35
+ * client_id)`, owning the project it runs in. Disconnecting revokes every
36
+ * token the app holds.
37
+ */
38
+ export const AppInstallOut = z
39
+ .object({
40
+ id: z.string(),
41
+ organization: z.string(),
42
+ /** The app's Client ID Metadata Document URL. */
43
+ client_id: z.string(),
44
+ client_name: z.string(),
45
+ project: z.string(),
46
+ /** The scopes the app's tokens carry, space-separated. */
47
+ scope: z.string(),
48
+ created_at: z.string(),
49
+ revoked_at: z.string().nullable(),
50
+ })
51
+ .meta({ id: "AppInstallOut" });
52
+
53
+ export const AppInstallListOut = pageOut(AppInstallOut, "AppInstallListOut");
54
+
32
55
  /**
33
56
  * The secret minted when an org mints a project (tenant-admin) token. Shape
34
57
  * matches `mintToken`'s return; the `tenant` module owns the canonical
@@ -66,3 +89,5 @@ export const ProjectTokenIn = z
66
89
  // ── Inferred consumer-facing type ────────────────────────────────────────────
67
90
 
68
91
  export type ICProject = z.infer<typeof ProjectOut>;
92
+
93
+ export type ICAppInstall = z.infer<typeof AppInstallOut>;
@@ -12,11 +12,17 @@
12
12
  * operator can roll back. History is append-only — a *restore* re-applies an old
13
13
  * snapshot as a brand-new revision.
14
14
  *
15
+ * `snapshot` must carry every key the API snapshots, or Zod strips the missing
16
+ * one from the response: it is stored and re-applied on restore, but invisible
17
+ * to the operator deciding whether to roll back. `skills` was absent here and
18
+ * did exactly that.
19
+ *
15
20
  * `.meta({ id })` names the component so the emitted OpenAPI references it as
16
21
  * `#/components/schemas/<id>` rather than inlining it.
17
22
  */
18
23
  import { z } from "zod";
19
24
  import { pageOut } from "./_page.js";
25
+ import { SkillRef } from "./skills.js";
20
26
 
21
27
  /** An immutable snapshot of a smith's effective behaviour config at one revision. */
22
28
  export const SmithRevisionOut = z
@@ -28,6 +34,8 @@ export const SmithRevisionOut = z
28
34
  enabled_hosted_tools: z.array(z.string()).optional(),
29
35
  vector_store_ids: z.array(z.string()).optional(),
30
36
  mcp_servers: z.array(z.string()).nullish(),
37
+ /** Skills the smith carried at this revision. */
38
+ skills: z.array(SkillRef).nullish(),
31
39
  // Nullish: a snapshot taken while the smith inherited a sparse agent
32
40
  // version carries null (= the default) for these.
33
41
  auto_memory: z.boolean().nullish(),
package/ts/zod/tenant.ts CHANGED
@@ -305,18 +305,28 @@ export const ProviderIn = z
305
305
  * `authorize_url`. */
306
306
  export const AuthorizeRequestOut = z
307
307
  .object({
308
+ /** `connector`: an MCP host connecting to a deployment (the tenant's page
309
+ * completes it naming a smith). `app`: a third-party app linking an
310
+ * organization (the console completes it with an organization token; the
311
+ * grant's subject is the app's project in that organization). */
312
+ kind: z.enum(["connector", "app"]),
313
+ client_id: z.string(),
308
314
  client_name: z.string(),
315
+ /** The scopes the client asked for, space-separated (`app` only). */
316
+ scope: z.string(),
309
317
  target_name: z.string(),
318
+ /** '' on an `app` request until it is completed. */
310
319
  tenant: z.string(),
311
320
  resource: z.string(),
312
321
  deployment_id: z.string(),
313
322
  })
314
323
  .meta({ id: "AuthorizeRequestOut" });
315
324
 
316
- /** Complete the delegated grant: the tenant asserts (server-to-server) which
317
- * smith the end-user authorized. */
325
+ /** Complete the delegated grant server-to-server. A `connector` request names
326
+ * the smith the end-user authorized; an `app` request carries nothing — the
327
+ * organization is the token's. */
318
328
  export const AuthorizeCompleteIn = z
319
- .object({ smith_id: z.string() })
329
+ .object({ smith_id: z.string().nullish() })
320
330
  .meta({ id: "AuthorizeCompleteIn" });
321
331
 
322
332
  /** Where the tenant 302s the browser after completing or declining. */