@ingram-cloud/sdk 1.2.0 → 1.5.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.
Files changed (49) hide show
  1. package/dist/client.js +185 -14
  2. package/dist/index.js +4 -0
  3. package/dist/scopes.js +52 -0
  4. package/dist/zod/_actor.js +33 -0
  5. package/dist/zod/_page.js +18 -4
  6. package/dist/zod/agents.js +17 -3
  7. package/dist/zod/billing.js +136 -0
  8. package/dist/zod/budgets.js +2 -3
  9. package/dist/zod/connections.js +2 -3
  10. package/dist/zod/conversations.js +4 -11
  11. package/dist/zod/deployments.js +32 -0
  12. package/dist/zod/files.js +2 -9
  13. package/dist/zod/index.js +3 -0
  14. package/dist/zod/mcp.js +20 -14
  15. package/dist/zod/observability.js +39 -19
  16. package/dist/zod/projects.js +4 -4
  17. package/dist/zod/runs.js +16 -4
  18. package/dist/zod/schedules.js +2 -7
  19. package/dist/zod/skills.js +73 -0
  20. package/dist/zod/smith-revisions.js +7 -5
  21. package/dist/zod/smiths.js +14 -0
  22. package/dist/zod/tenant.js +41 -4
  23. package/dist/zod/vector-stores.js +36 -23
  24. package/package.json +6 -8
  25. package/ts/client.ts +431 -50
  26. package/ts/index.ts +4 -0
  27. package/ts/responses.ts +40 -2
  28. package/ts/scopes.ts +57 -0
  29. package/ts/zod/.impeccable/hook.cache.json +1 -0
  30. package/ts/zod/_actor.ts +36 -0
  31. package/ts/zod/_page.ts +19 -4
  32. package/ts/zod/agents.ts +17 -3
  33. package/ts/zod/billing.ts +168 -0
  34. package/ts/zod/budgets.ts +2 -3
  35. package/ts/zod/connections.ts +2 -3
  36. package/ts/zod/conversations.ts +7 -11
  37. package/ts/zod/deployments.ts +36 -0
  38. package/ts/zod/files.ts +2 -9
  39. package/ts/zod/index.ts +3 -0
  40. package/ts/zod/mcp.ts +20 -15
  41. package/ts/zod/observability.ts +75 -24
  42. package/ts/zod/projects.ts +4 -4
  43. package/ts/zod/runs.ts +18 -4
  44. package/ts/zod/schedules.ts +2 -7
  45. package/ts/zod/skills.ts +85 -0
  46. package/ts/zod/smith-revisions.ts +7 -5
  47. package/ts/zod/smiths.ts +14 -0
  48. package/ts/zod/tenant.ts +52 -5
  49. package/ts/zod/vector-stores.ts +41 -23
package/ts/zod/mcp.ts CHANGED
@@ -14,6 +14,7 @@
14
14
  * emit as `$ref` components rather than inlined objects.
15
15
  */
16
16
  import { z } from "zod";
17
+ import { pageOut } from "./_page.js";
17
18
 
18
19
  /** One approval-policy rule: a name glob that gates matching tools behind a
19
20
  * human approval. `require` is always `"approval"` today (the only supported
@@ -71,30 +72,32 @@ export const McpServerOut = z
71
72
  tool_allowlist: z.array(z.string()).nullish(),
72
73
  approval_policy: z.array(ApprovalRule).optional(),
73
74
  tools: z.array(McpTool),
75
+ /** How many tools this registration currently holds — what a run is offered,
76
+ * before the allow-list gate each tool's own `enabled` reports. Same number on
77
+ * a read as on the register/refresh response that produced it. */
78
+ tools_discovered: z.number().int(),
74
79
  tools_refreshed_at: z.string().nullable(),
75
- /** `degraded` when the edge failed discovery or its secret can't be decoded
76
- * at run time; otherwise the stored lifecycle status. */
80
+ /** `degraded` when the edge failed discovery, its secret can't be decoded at
81
+ * run time, or its last `tools/call` failed at the transport level;
82
+ * otherwise the stored lifecycle status. */
77
83
  status: z.string(),
78
- /** Last discovery/runtime-load failure, or null when the edge is healthy. */
84
+ /** Last discovery/runtime-load failure, or null when discovery is healthy. */
79
85
  discovery_error: z.string().nullable(),
86
+ /** Last transport-level `tools/call` failure (network / HTTP status), or
87
+ * null. Discovery can succeed while calls fail — this catches that. Cleared
88
+ * by a successful call or a re-PUT. */
89
+ last_call_error: z.string().nullable(),
90
+ last_call_error_at: z.string().nullable(),
80
91
  created_at: z.string().nullable(),
81
92
  })
82
93
  .meta({ id: "McpServerOut" });
83
94
 
84
- export const McpServerListOut = z
85
- .object({ data: z.array(McpServerOut) })
86
- .meta({ id: "McpServerListOut" });
87
-
88
- /** Register/replace and refresh echo the server back plus the count of tools
89
- * discovered in the just-run `tools/list`. */
90
- export const McpServerWriteOut = McpServerOut.extend({
91
- tools_discovered: z.number().int(),
92
- }).meta({ id: "McpServerWriteOut" });
95
+ export const McpServerListOut = pageOut(McpServerOut, "McpServerListOut");
93
96
 
94
97
  // ── Request bodies ──────────────────────────────────────────────────────────
95
98
 
96
- /** Auth block on a register/replace body. `secret` is write-only (a static
97
- * bearer) — never echoed back. */
99
+ /** Auth block on a register/replace body. `kind` is `none` | `bearer` | `oauth`;
100
+ * `secret` (the shared bearer token) is write-only — never echoed back. */
98
101
  export const McpAuthIn = z
99
102
  .object({
100
103
  kind: z.string().nullish(),
@@ -105,7 +108,9 @@ export const McpAuthIn = z
105
108
  .meta({ id: "McpAuthIn" });
106
109
 
107
110
  /** Register or replace a server: supply a raw `url` + `auth`, or a `catalog`
108
- * slug (catalog defaults are stamped down, body fields override). */
111
+ * slug (catalog defaults are stamped down, body fields override). PUT is a
112
+ * full replace and `auth.kind` is required unless a catalog preset supplies
113
+ * it — there is no implicit `none`. */
109
114
  export const McpServerIn = z
110
115
  .object({
111
116
  url: z.string().nullish(),
@@ -24,14 +24,7 @@ import { pageOut } from "./_page.js";
24
24
  /** Span kinds emitted by the observability backend. `retrieval` covers vector-store
25
25
  * search (the hosted `file_search` tool, and externally-pushed RAG spans). */
26
26
  export const ICSpanKindEnum = z
27
- .enum([
28
- "run",
29
- "model_call",
30
- "tool_call",
31
- "memory_op",
32
- "retrieval",
33
- "runtime_event",
34
- ])
27
+ .enum(["run", "model_call", "tool_call", "memory_op", "retrieval", "runtime_event"])
35
28
  .meta({ id: "SpanKind" });
36
29
 
37
30
  /** A single timed unit of work inside a trace. */
@@ -65,8 +58,12 @@ export const SpanNodeOut = SpanOut.extend({
65
58
  export const TraceOut = z
66
59
  .object({
67
60
  id: z.string(),
68
- smith_id: z.string(),
61
+ /** Null for a trace no smith owns — an external `/v1/traces:ingest` under a
62
+ * tenant token attributes to none. Such a trace is tenant-scope only: a
63
+ * smith-bound token cannot read it. */
64
+ smith_id: z.string().nullable(),
69
65
  app_id: z.string().nullable(),
66
+ run_id: z.string().nullable(),
70
67
  root_kind: ICSpanKindEnum,
71
68
  name: z.string(),
72
69
  status: z.string(),
@@ -88,25 +85,34 @@ export const TraceDetailOut = TraceOut.extend({
88
85
  export const TraceListOut = pageOut(TraceOut, "TraceListOut");
89
86
 
90
87
  /** Aggregated usage grouped by app, smith, model, or customer. */
88
+ /** The token/cost amounts a usage bucket reports. `tokens` is the grand total
89
+ * (input + output); `input_tokens` is the input slice, and `cache_read_tokens`
90
+ * / `cache_write_tokens` are sub-slices of input (reads served from the
91
+ * provider's prompt cache, writes billed at the cache-write premium). The cache
92
+ * hit rate is `cache_read_tokens / input_tokens`. */
93
+ const UsageAmounts = z.object({
94
+ tokens: z.number(),
95
+ input_tokens: z.number(),
96
+ cache_read_tokens: z.number(),
97
+ cache_write_tokens: z.number(),
98
+ cost: z.number(),
99
+ run_count: z.number(),
100
+ });
101
+
91
102
  export const UsageBreakdownOut = z
92
103
  .object({
93
104
  group_by: z.enum(["app", "smith", "model", "customer"]),
94
- totals: z.object({
95
- tokens: z.number(),
96
- cost: z.number(),
97
- run_count: z.number(),
98
- }),
105
+ totals: UsageAmounts,
99
106
  groups: z.array(
100
- z.object({
101
- app: z.string().nullable().optional(),
102
- smith: z.string().nullable().optional(),
103
- model: z.string().nullable().optional(),
104
- // Customer-grouped views label unassigned usage `principal:<smith id>`.
105
- customer: z.string().nullable().optional(),
106
- tokens: z.number(),
107
- cost: z.number(),
108
- run_count: z.number(),
109
- }),
107
+ z
108
+ .object({
109
+ app: z.string().nullable().optional(),
110
+ smith: z.string().nullable().optional(),
111
+ model: z.string().nullable().optional(),
112
+ // Customer-grouped views label unassigned usage `principal:<smith id>`.
113
+ customer: z.string().nullable().optional(),
114
+ })
115
+ .extend(UsageAmounts.shape),
110
116
  ),
111
117
  /** Custom billable events aggregated per meter over the same filters. */
112
118
  meters: z
@@ -145,6 +151,51 @@ export const UsageEventListOut = z
145
151
  })
146
152
  .meta({ id: "UsageEventListOut" });
147
153
 
154
+ // ── Span ingestion (POST /v1/traces:ingest) ─────────────────────────────────
155
+
156
+ /** The request body for span ingestion (externally-pushed spans / OTel).
157
+ *
158
+ * Deliberately permissive: the handler normalizes rather than rejects — an
159
+ * unrecognized `kind` degrades to `runtime_event`, missing ids and timestamps
160
+ * are generated. Validating {@link ICSpanIn} here would 422 exactly the sloppy
161
+ * exporter payloads the endpoint exists to absorb. `ICSpanIn` documents the
162
+ * shape for callers; the wire stays open. */
163
+ export const TraceIngestIn = z
164
+ .object({ spans: z.array(z.record(z.string(), z.unknown())).optional() })
165
+ .meta({ id: "TraceIngestIn" });
166
+
167
+ /** The 202 ack for span ingestion: how many spans were written. */
168
+ export const TraceIngestOut = z
169
+ .object({ accepted: z.number().int() })
170
+ .meta({ id: "TraceIngestOut" });
171
+
172
+ /** One span as pushed to `POST /v1/traces:ingest` — the caller-facing contract
173
+ * for {@link TraceIngestIn}'s open `spans` array. Every field is optional; the
174
+ * tenant is always taken from the token, never the body. A TS type rather than
175
+ * a schema precisely because the wire does not enforce it. */
176
+ export interface ICSpanIn {
177
+ trace_id?: string | null;
178
+ span_id?: string | null;
179
+ parent_span_id?: string | null;
180
+ /** One of {@link ICSpanKindEnum}; anything else lands as `runtime_event`. */
181
+ kind?: string;
182
+ name?: string | null;
183
+ status?: string;
184
+ started_at?: string | null;
185
+ ended_at?: string | null;
186
+ duration_ms?: number | null;
187
+ model?: string | null;
188
+ input_tokens?: number | null;
189
+ output_tokens?: number | null;
190
+ cache_read_tokens?: number | null;
191
+ cache_write_tokens?: number | null;
192
+ attributes?: Record<string, unknown> | null;
193
+ smith_id?: string | null;
194
+ app_id?: string | null;
195
+ run_id?: string | null;
196
+ open_trace?: boolean;
197
+ }
198
+
148
199
  // ── Inferred consumer-facing types (re-exported by ../responses) ─────────────
149
200
 
150
201
  export type ICSpanKind = z.infer<typeof ICSpanKindEnum>;
@@ -12,6 +12,7 @@
12
12
  * `#/components/schemas/<id>` rather than inlining it.
13
13
  */
14
14
  import { z } from "zod";
15
+ import { pageOut } from "./_page.js";
15
16
 
16
17
  export const ProjectOut = z
17
18
  .object({
@@ -26,9 +27,7 @@ export const ProjectOut = z
26
27
  })
27
28
  .meta({ id: "ProjectOut" });
28
29
 
29
- export const ProjectListOut = z
30
- .object({ data: z.array(ProjectOut) })
31
- .meta({ id: "ProjectListOut" });
30
+ export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
32
31
 
33
32
  /**
34
33
  * The secret minted when an org mints a project (tenant-admin) token. Shape
@@ -58,7 +57,8 @@ export const ProjectIn = z
58
57
 
59
58
  export const ProjectTokenIn = z
60
59
  .object({
61
- ttl_seconds: z.number().int().nullish(),
60
+ // Same bounds as `TokenIn.ttl_seconds` — this mints a `tenant:*` token too.
61
+ ttl_seconds: z.number().int().positive().max(315_360_000).nullish(),
62
62
  name: z.string().nullish(),
63
63
  })
64
64
  .meta({ id: "ProjectTokenIn" });
package/ts/zod/runs.ts CHANGED
@@ -20,6 +20,7 @@
20
20
  * are deliberately not modelled.
21
21
  */
22
22
  import { z } from "zod";
23
+ import { Actor } from "./_actor.js";
23
24
  import { pageOut } from "./_page.js";
24
25
 
25
26
  /** One message in a run's `input`. `content` is a plain string for a text-only
@@ -29,10 +30,7 @@ import { pageOut } from "./_page.js";
29
30
  export const InputMessage = z
30
31
  .object({
31
32
  role: z.string(),
32
- content: z.union([
33
- z.string(),
34
- z.array(z.record(z.string(), z.unknown())),
35
- ]),
33
+ content: z.union([z.string(), z.array(z.record(z.string(), z.unknown()))]),
36
34
  })
37
35
  .meta({ id: "InputMessage" });
38
36
 
@@ -52,6 +50,17 @@ export const RunUsage = z
52
50
  })
53
51
  .meta({ id: "RunUsage" });
54
52
 
53
+ /** One thing that went wrong during a run without ending it — today, a tool source
54
+ * the run could not reach. A run that lost its tools still answers, and the answer
55
+ * is shaped like a healthy one, so this rides the run's own summary fields rather
56
+ * than a nested metadata key nobody reads. */
57
+ export const RunWarning = z
58
+ .object({
59
+ code: z.string(),
60
+ message: z.string(),
61
+ })
62
+ .meta({ id: "RunWarning" });
63
+
55
64
  export const RunOut = z
56
65
  .object({
57
66
  id: z.string(),
@@ -78,8 +87,12 @@ export const RunOut = z
78
87
  })
79
88
  .nullable(),
80
89
  stop_reason: z.string().nullable(),
90
+ // Always present, `[]` on a clean run: absence must never read as "fine".
91
+ warnings: z.array(RunWarning),
81
92
  usage: RunUsage.nullable(),
82
93
  metadata: z.record(z.string(), z.unknown()).optional(),
94
+ /** Who started this run. Null on runs created before attribution shipped. */
95
+ actor: Actor.nullable(),
83
96
  created_at: z.string().nullable(),
84
97
  updated_at: z.string().nullable(),
85
98
  })
@@ -131,5 +144,6 @@ export const Submit = z
131
144
 
132
145
  export type ICInputMessage = z.infer<typeof InputMessage>;
133
146
  export type ICRunUsage = z.infer<typeof RunUsage>;
147
+ export type ICRunWarning = z.infer<typeof RunWarning>;
134
148
  export type ICRun = z.infer<typeof RunOut>;
135
149
  export type ICRunEvent = z.infer<typeof RunEventOut>;
@@ -13,6 +13,7 @@
13
13
  * `#/components/schemas/<id>` rather than inlining it.
14
14
  */
15
15
  import { z } from "zod";
16
+ import { pageOut } from "./_page.js";
16
17
 
17
18
  /** A schedule's stored input: messages replayed as the run input on each fire. */
18
19
  const ScheduleInput = z.array(z.record(z.string(), z.unknown()));
@@ -27,8 +28,6 @@ export const ScheduleOut = z
27
28
  input: ScheduleInput,
28
29
  /** Thread the fired runs append to; null mints a fresh thread per fire. */
29
30
  thread_id: z.string().nullable(),
30
- /** Max overlapping fired runs before new fires are skipped. */
31
- max_concurrent: z.number().int(),
32
31
  enabled: z.boolean(),
33
32
  next_fire_at: z.string().nullable(),
34
33
  last_fire_at: z.string().nullable(),
@@ -36,9 +35,7 @@ export const ScheduleOut = z
36
35
  })
37
36
  .meta({ id: "ScheduleOut" });
38
37
 
39
- export const ScheduleListOut = z
40
- .object({ data: z.array(ScheduleOut) })
41
- .meta({ id: "ScheduleListOut" });
38
+ export const ScheduleListOut = pageOut(ScheduleOut, "ScheduleListOut");
42
39
 
43
40
  /** `POST .../:sid/run_now` — the fire is enqueued onto the smith's serial delivery
44
41
  * lane (not run inline), so the response acknowledges the queued delivery rather
@@ -60,7 +57,6 @@ export const ScheduleIn = z
60
57
  timezone: z.string().default("UTC"),
61
58
  input: ScheduleInput.default([]),
62
59
  thread_id: z.string().nullish(),
63
- max_concurrent: z.number().int().default(1),
64
60
  enabled: z.boolean().default(true),
65
61
  })
66
62
  .meta({ id: "ScheduleIn" });
@@ -72,7 +68,6 @@ export const SchedulePatch = z
72
68
  timezone: z.string().nullish(),
73
69
  input: ScheduleInput.nullish(),
74
70
  thread_id: z.string().nullish(),
75
- max_concurrent: z.number().int().nullish(),
76
71
  enabled: z.boolean().nullish(),
77
72
  })
78
73
  .meta({ id: "SchedulePatch" });
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Agent Skills (#175) — a folder anchored by SKILL.md, per the Agent Skills
3
+ * specification, stored as an immutable version and attached to an agent.
4
+ *
5
+ * A version's bytes never appear on the wire: `files` lists each path with its
6
+ * size and content hash, so a tenant can see exactly what they installed.
7
+ */
8
+ import { z } from "zod";
9
+
10
+ /** One file in a skill version, as the caller uploaded it. */
11
+ export const SkillFile = z
12
+ .object({
13
+ path: z.string(),
14
+ size: z.number().int(),
15
+ sha256: z.string(),
16
+ media_type: z.string(),
17
+ })
18
+ .meta({ id: "SkillFile" });
19
+
20
+ /** One published agent version that froze a reference to this skill version.
21
+ * A frozen reference is the only kind that blocks a delete, so this is the
22
+ * list a `409 skill_in_use` would name. */
23
+ export const SkillReference = z
24
+ .object({ agent_id: z.string(), version: z.number().int() })
25
+ .meta({ id: "SkillReference" });
26
+
27
+ /** An immutable published version of a skill. */
28
+ export const SkillVersion = z
29
+ .object({
30
+ skill_id: z.string(),
31
+ version: z.number().int(),
32
+ description: z.string(),
33
+ license: z.string().nullable(),
34
+ compatibility: z.unknown().nullable(),
35
+ metadata: z.record(z.string(), z.unknown()).nullable(),
36
+ references: z.array(z.string()),
37
+ scripts: z.array(z.string()),
38
+ assets: z.array(z.string()),
39
+ files: z.array(SkillFile),
40
+ /** Published agent versions holding this one frozen. Always present, `[]`
41
+ * when nothing does. */
42
+ referenced_by: z.array(SkillReference),
43
+ bytes: z.number().int(),
44
+ created_at: z.string(),
45
+ })
46
+ .meta({ id: "SkillVersion" });
47
+
48
+ /** The skill resource. `default_version` is what an agent gets when it names none. */
49
+ export const Skill = z
50
+ .object({
51
+ id: z.string(),
52
+ object: z.literal("skill"),
53
+ name: z.string(),
54
+ description: z.string(),
55
+ default_version: z.number().int(),
56
+ created_at: z.string(),
57
+ updated_at: z.string(),
58
+ })
59
+ .meta({ id: "Skill" });
60
+
61
+ export const SkillListOut = z
62
+ .object({ object: z.literal("list"), data: z.array(Skill) })
63
+ .meta({ id: "SkillListOut" });
64
+
65
+ export const SkillVersionListOut = z
66
+ .object({ object: z.literal("list"), data: z.array(SkillVersion) })
67
+ .meta({ id: "SkillVersionListOut" });
68
+
69
+ /** Move the skill's `default_version` to an existing version. */
70
+ export const SkillUpdateIn = z
71
+ .object({ default_version: z.number().int().positive() })
72
+ .meta({ id: "SkillUpdateIn" });
73
+
74
+ /** One skill reference in an agent's `skills` config. Omitted `version` resolves
75
+ * to the skill's `default_version` and is frozen at publish. */
76
+ export const SkillRef = z
77
+ .object({
78
+ skill_id: z.string(),
79
+ version: z.number().int().positive().optional(),
80
+ })
81
+ .meta({ id: "SkillRef" });
82
+
83
+ export type ICSkill = z.infer<typeof Skill>;
84
+ export type ICSkillVersion = z.infer<typeof SkillVersion>;
85
+ export type ICSkillReference = z.infer<typeof SkillReference>;
@@ -16,6 +16,7 @@
16
16
  * `#/components/schemas/<id>` rather than inlining it.
17
17
  */
18
18
  import { z } from "zod";
19
+ import { pageOut } from "./_page.js";
19
20
 
20
21
  /** An immutable snapshot of a smith's effective behaviour config at one revision. */
21
22
  export const SmithRevisionOut = z
@@ -26,8 +27,11 @@ export const SmithRevisionOut = z
26
27
  model: z.string().nullish(),
27
28
  enabled_hosted_tools: z.array(z.string()).optional(),
28
29
  vector_store_ids: z.array(z.string()).optional(),
29
- auto_memory: z.boolean().optional(),
30
- memory_consolidation: z.boolean().optional(),
30
+ mcp_servers: z.array(z.string()).nullish(),
31
+ // Nullish: a snapshot taken while the smith inherited a sparse agent
32
+ // version carries null (= the default) for these.
33
+ auto_memory: z.boolean().nullish(),
34
+ memory_consolidation: z.boolean().nullish(),
31
35
  }),
32
36
  created_by: z.string().nullish(),
33
37
  note: z.string().nullish(),
@@ -35,9 +39,7 @@ export const SmithRevisionOut = z
35
39
  })
36
40
  .meta({ id: "SmithRevisionOut" });
37
41
 
38
- export const RevisionListOut = z
39
- .object({ data: z.array(SmithRevisionOut) })
40
- .meta({ id: "RevisionListOut" });
42
+ export const RevisionListOut = pageOut(SmithRevisionOut, "RevisionListOut");
41
43
 
42
44
  // ── Request bodies ──────────────────────────────────────────────────────────
43
45
 
package/ts/zod/smiths.ts CHANGED
@@ -17,6 +17,7 @@
17
17
  * `#/components/schemas/<id>` rather than inlining it.
18
18
  */
19
19
  import { z } from "zod";
20
+ import { SkillRef } from "./skills.js";
20
21
 
21
22
  // ── Smith response ───────────────────────────────────────────────────────────
22
23
 
@@ -38,6 +39,9 @@ export const SmithOut = z
38
39
  rendered_instructions: z.string().nullish(),
39
40
  enabled_hosted_tools: z.array(z.string()).optional(),
40
41
  vector_store_ids: z.array(z.string()).optional(),
42
+ /** Registered MCP servers this smith's runs load, by name. Null = all. */
43
+ mcp_servers: z.array(z.string()).nullish(),
44
+ skills: z.array(SkillRef).optional(),
41
45
  auto_memory: z.boolean().optional(),
42
46
  memory_consolidation: z.boolean().optional(),
43
47
  /** How the config resolved: by reference, with overrides, or embedded. */
@@ -57,6 +61,8 @@ export const SmithOut = z
57
61
  instructions: z.string().nullable(),
58
62
  enabled_hosted_tools: z.array(z.string()),
59
63
  vector_store_ids: z.array(z.string()),
64
+ mcp_servers: z.array(z.string()).nullable(),
65
+ skills: z.array(SkillRef),
60
66
  auto_memory: z.boolean().nullable(),
61
67
  memory_consolidation: z.boolean().nullable(),
62
68
  })
@@ -90,6 +96,9 @@ export const SmithCreate = z
90
96
  instructions: z.string().nullish(),
91
97
  enabled_hosted_tools: z.array(z.string()).nullish(),
92
98
  vector_store_ids: z.array(z.string()).nullish(),
99
+ /** Scope this smith's runs to these registered MCP servers (by name). */
100
+ mcp_servers: z.array(z.string()).nullish(),
101
+ skills: z.array(SkillRef).nullish(),
93
102
  auto_memory: z.boolean().nullish(),
94
103
  memory_consolidation: z.boolean().nullish(),
95
104
  })
@@ -108,6 +117,11 @@ export const SmithPatch = z
108
117
  instructions: z.string().nullish(),
109
118
  enabled_hosted_tools: z.array(z.string()).nullish(),
110
119
  vector_store_ids: z.array(z.string()).nullish(),
120
+ /** Scope this smith's runs to these registered MCP servers (by name).
121
+ * Null clears the per-smith override (re-inherit the agent's value). */
122
+ mcp_servers: z.array(z.string()).nullish(),
123
+ /** Null clears the per-smith override (re-inherit the agent's value). */
124
+ skills: z.array(SkillRef).nullish(),
111
125
  auto_memory: z.boolean().nullish(),
112
126
  memory_consolidation: z.boolean().nullish(),
113
127
  })
package/ts/zod/tenant.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  * `#/components/schemas/<id>` rather than inlining it.
13
13
  */
14
14
  import { z } from "zod";
15
+ import { Actor } from "./_actor.js";
15
16
  import { pageOut } from "./_page.js";
16
17
 
17
18
  // ── Events (poll mirror of the webhook firehose) ─────────────────────────────
@@ -26,6 +27,8 @@ export const EventOut = z
26
27
  type: z.string(),
27
28
  smith_id: z.string().nullable(),
28
29
  data: z.record(z.string(), z.unknown()),
30
+ /** Who acted. Null on events recorded before attribution shipped. */
31
+ actor: Actor.nullable(),
29
32
  created_at: z.string().nullable(),
30
33
  })
31
34
  .meta({ id: "EventOut" });
@@ -58,9 +61,7 @@ export const WebhookCreateOut = z
58
61
  .meta({ id: "WebhookCreateOut" });
59
62
 
60
63
  /** The patch/delete-adjacent ack shape (just the id). */
61
- export const WebhookIdOut = z
62
- .object({ id: z.string() })
63
- .meta({ id: "WebhookIdOut" });
64
+ export const WebhookIdOut = z.object({ id: z.string() }).meta({ id: "WebhookIdOut" });
64
65
 
65
66
  export const WebhookIn = z
66
67
  .object({
@@ -78,6 +79,25 @@ export const WebhookPatch = z
78
79
  })
79
80
  .meta({ id: "WebhookPatch" });
80
81
 
82
+ /** Rotate a webhook's signing secret. `grace_seconds` keeps the outgoing secret
83
+ * valid for an overlap window (default 24h, 0 = cut over immediately, max 7d);
84
+ * during it every delivery is signed with both the new and old secret. */
85
+ export const WebhookRotateIn = z
86
+ .object({
87
+ grace_seconds: z.number().int().min(0).max(604800).default(86400),
88
+ })
89
+ .meta({ id: "WebhookRotateIn" });
90
+
91
+ /** The rotate response — the new signing `secret` is returned EXACTLY ONCE, here.
92
+ * `previous_secret_expires_at` is when the old secret stops being accepted. */
93
+ export const WebhookRotateOut = z
94
+ .object({
95
+ id: z.string(),
96
+ secret: z.string(),
97
+ previous_secret_expires_at: z.string().nullable(),
98
+ })
99
+ .meta({ id: "WebhookRotateOut" });
100
+
81
101
  /** One persisted delivery attempt record for a webhook — the audit trail behind
82
102
  * durable, retried delivery. `status` is `pending` | `succeeded` | `dead`. */
83
103
  export const WebhookDeliveryOut = z
@@ -96,7 +116,10 @@ export const WebhookDeliveryOut = z
96
116
  })
97
117
  .meta({ id: "WebhookDeliveryOut" });
98
118
 
99
- export const WebhookDeliveryListOut = pageOut(WebhookDeliveryOut, "WebhookDeliveryListOut");
119
+ export const WebhookDeliveryListOut = pageOut(
120
+ WebhookDeliveryOut,
121
+ "WebhookDeliveryListOut",
122
+ );
100
123
 
101
124
  /** The redeliver ack — the outcome of the forced re-attempt. */
102
125
  export const WebhookRedeliverOut = z
@@ -143,7 +166,9 @@ export const TokenIn = z
143
166
  scope: z.string().default("smith"),
144
167
  smith_id: z.string().nullish(),
145
168
  permissions: z.array(z.string()).nullish(),
146
- ttl_seconds: z.number().int().nullish(),
169
+ // Positive and bounded: `0` used to read as "no expiry" and mint a permanent
170
+ // admin token, and a ttl past year 275760 overflows the `Date` we serialize.
171
+ ttl_seconds: z.number().int().positive().max(315_360_000).nullish(),
147
172
  name: z.string().nullish(),
148
173
  })
149
174
  .meta({ id: "TokenIn" });
@@ -327,3 +352,25 @@ export type ICModelCatalog = z.infer<typeof ModelsListOut>;
327
352
  export type ICModelKey = z.infer<typeof ModelKeyOut>;
328
353
  export type ICProvider = z.infer<typeof ProviderOut>;
329
354
  export type ICAuthorizeRequest = z.infer<typeof AuthorizeRequestOut>;
355
+
356
+ // ── Sandbox secrets (env a tenant's sandboxes carry) ─────────────────────────
357
+
358
+ /** One secret by name. The value is NEVER echoed — only that it is set. */
359
+ export const SandboxSecretOut = z
360
+ .object({
361
+ name: z.string(),
362
+ updated_at: z.string().nullable(),
363
+ })
364
+ .meta({ id: "SandboxSecretOut" });
365
+
366
+ export const SandboxSecretListOut = z
367
+ .object({ data: z.array(SandboxSecretOut) })
368
+ .meta({ id: "SandboxSecretListOut" });
369
+
370
+ export const SandboxSecretIn = z
371
+ .object({ value: z.string() })
372
+ .meta({ id: "SandboxSecretIn" });
373
+
374
+ export const SandboxSecretConfiguredOut = z
375
+ .object({ name: z.string(), configured: z.boolean() })
376
+ .meta({ id: "SandboxSecretConfiguredOut" });