@ingram-cloud/sdk 1.4.0 → 1.6.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 (51) hide show
  1. package/README.md +34 -35
  2. package/dist/client.js +240 -23
  3. package/dist/index.js +4 -0
  4. package/dist/scopes.js +52 -0
  5. package/dist/zod/_actor.js +33 -0
  6. package/dist/zod/_page.js +18 -4
  7. package/dist/zod/agents.js +7 -3
  8. package/dist/zod/approvals.js +9 -0
  9. package/dist/zod/billing.js +136 -0
  10. package/dist/zod/budgets.js +2 -3
  11. package/dist/zod/connections.js +2 -3
  12. package/dist/zod/conversations.js +4 -11
  13. package/dist/zod/deployments.js +32 -0
  14. package/dist/zod/files.js +2 -9
  15. package/dist/zod/index.js +3 -0
  16. package/dist/zod/mcp.js +8 -10
  17. package/dist/zod/observability.js +38 -19
  18. package/dist/zod/projects.js +4 -4
  19. package/dist/zod/runs.js +19 -4
  20. package/dist/zod/schedules.js +2 -7
  21. package/dist/zod/skills.js +73 -0
  22. package/dist/zod/smith-revisions.js +2 -3
  23. package/dist/zod/smiths.js +6 -0
  24. package/dist/zod/tenant.js +24 -4
  25. package/dist/zod/vector-stores.js +6 -19
  26. package/package.json +25 -18
  27. package/ts/client.ts +456 -60
  28. package/ts/index.ts +4 -0
  29. package/ts/responses.ts +40 -2
  30. package/ts/scopes.ts +57 -0
  31. package/ts/zod/_actor.ts +36 -0
  32. package/ts/zod/_page.ts +19 -4
  33. package/ts/zod/agents.ts +7 -3
  34. package/ts/zod/approvals.ts +9 -0
  35. package/ts/zod/billing.ts +168 -0
  36. package/ts/zod/budgets.ts +2 -3
  37. package/ts/zod/connections.ts +2 -3
  38. package/ts/zod/conversations.ts +7 -11
  39. package/ts/zod/deployments.ts +36 -0
  40. package/ts/zod/files.ts +2 -9
  41. package/ts/zod/index.ts +3 -0
  42. package/ts/zod/mcp.ts +8 -11
  43. package/ts/zod/observability.ts +74 -24
  44. package/ts/zod/projects.ts +4 -4
  45. package/ts/zod/runs.ts +21 -4
  46. package/ts/zod/schedules.ts +2 -7
  47. package/ts/zod/skills.ts +85 -0
  48. package/ts/zod/smith-revisions.ts +2 -3
  49. package/ts/zod/smiths.ts +6 -0
  50. package/ts/zod/tenant.ts +33 -5
  51. package/ts/zod/vector-stores.ts +9 -19
@@ -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,7 +58,10 @@ 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(),
70
66
  run_id: z.string().nullable(),
71
67
  root_kind: ICSpanKindEnum,
@@ -89,25 +85,34 @@ export const TraceDetailOut = TraceOut.extend({
89
85
  export const TraceListOut = pageOut(TraceOut, "TraceListOut");
90
86
 
91
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
+
92
102
  export const UsageBreakdownOut = z
93
103
  .object({
94
104
  group_by: z.enum(["app", "smith", "model", "customer"]),
95
- totals: z.object({
96
- tokens: z.number(),
97
- cost: z.number(),
98
- run_count: z.number(),
99
- }),
105
+ totals: UsageAmounts,
100
106
  groups: z.array(
101
- z.object({
102
- app: z.string().nullable().optional(),
103
- smith: z.string().nullable().optional(),
104
- model: z.string().nullable().optional(),
105
- // Customer-grouped views label unassigned usage `principal:<smith id>`.
106
- customer: z.string().nullable().optional(),
107
- tokens: z.number(),
108
- cost: z.number(),
109
- run_count: z.number(),
110
- }),
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),
111
116
  ),
112
117
  /** Custom billable events aggregated per meter over the same filters. */
113
118
  meters: z
@@ -146,6 +151,51 @@ export const UsageEventListOut = z
146
151
  })
147
152
  .meta({ id: "UsageEventListOut" });
148
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
+
149
199
  // ── Inferred consumer-facing types (re-exported by ../responses) ─────────────
150
200
 
151
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
  })
@@ -121,6 +134,9 @@ export const Submit = z
121
134
  result: z.record(z.string(), z.unknown()).nullish(),
122
135
  approval_id: z.string().nullish(),
123
136
  decision: z.string().nullish(),
137
+ /** The answer to an approval's `elicitation`, matching its
138
+ * `requested_schema`; with `decision: "approve"`. */
139
+ content: z.record(z.string(), z.unknown()).nullish(),
124
140
  actor: z.string().nullish(),
125
141
  reason: z.string().nullish(),
126
142
  stream: z.boolean().optional(),
@@ -131,5 +147,6 @@ export const Submit = z
131
147
 
132
148
  export type ICInputMessage = z.infer<typeof InputMessage>;
133
149
  export type ICRunUsage = z.infer<typeof RunUsage>;
150
+ export type ICRunWarning = z.infer<typeof RunWarning>;
134
151
  export type ICRun = z.infer<typeof RunOut>;
135
152
  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
@@ -38,9 +39,7 @@ export const SmithRevisionOut = z
38
39
  })
39
40
  .meta({ id: "SmithRevisionOut" });
40
41
 
41
- export const RevisionListOut = z
42
- .object({ data: z.array(SmithRevisionOut) })
43
- .meta({ id: "RevisionListOut" });
42
+ export const RevisionListOut = pageOut(SmithRevisionOut, "RevisionListOut");
44
43
 
45
44
  // ── Request bodies ──────────────────────────────────────────────────────────
46
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
 
@@ -40,6 +41,7 @@ export const SmithOut = z
40
41
  vector_store_ids: z.array(z.string()).optional(),
41
42
  /** Registered MCP servers this smith's runs load, by name. Null = all. */
42
43
  mcp_servers: z.array(z.string()).nullish(),
44
+ skills: z.array(SkillRef).optional(),
43
45
  auto_memory: z.boolean().optional(),
44
46
  memory_consolidation: z.boolean().optional(),
45
47
  /** How the config resolved: by reference, with overrides, or embedded. */
@@ -60,6 +62,7 @@ export const SmithOut = z
60
62
  enabled_hosted_tools: z.array(z.string()),
61
63
  vector_store_ids: z.array(z.string()),
62
64
  mcp_servers: z.array(z.string()).nullable(),
65
+ skills: z.array(SkillRef),
63
66
  auto_memory: z.boolean().nullable(),
64
67
  memory_consolidation: z.boolean().nullable(),
65
68
  })
@@ -95,6 +98,7 @@ export const SmithCreate = z
95
98
  vector_store_ids: z.array(z.string()).nullish(),
96
99
  /** Scope this smith's runs to these registered MCP servers (by name). */
97
100
  mcp_servers: z.array(z.string()).nullish(),
101
+ skills: z.array(SkillRef).nullish(),
98
102
  auto_memory: z.boolean().nullish(),
99
103
  memory_consolidation: z.boolean().nullish(),
100
104
  })
@@ -116,6 +120,8 @@ export const SmithPatch = z
116
120
  /** Scope this smith's runs to these registered MCP servers (by name).
117
121
  * Null clears the per-smith override (re-inherit the agent's value). */
118
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(),
119
125
  auto_memory: z.boolean().nullish(),
120
126
  memory_consolidation: z.boolean().nullish(),
121
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({
@@ -115,7 +116,10 @@ export const WebhookDeliveryOut = z
115
116
  })
116
117
  .meta({ id: "WebhookDeliveryOut" });
117
118
 
118
- export const WebhookDeliveryListOut = pageOut(WebhookDeliveryOut, "WebhookDeliveryListOut");
119
+ export const WebhookDeliveryListOut = pageOut(
120
+ WebhookDeliveryOut,
121
+ "WebhookDeliveryListOut",
122
+ );
119
123
 
120
124
  /** The redeliver ack — the outcome of the forced re-attempt. */
121
125
  export const WebhookRedeliverOut = z
@@ -162,7 +166,9 @@ export const TokenIn = z
162
166
  scope: z.string().default("smith"),
163
167
  smith_id: z.string().nullish(),
164
168
  permissions: z.array(z.string()).nullish(),
165
- 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(),
166
172
  name: z.string().nullish(),
167
173
  })
168
174
  .meta({ id: "TokenIn" });
@@ -346,3 +352,25 @@ export type ICModelCatalog = z.infer<typeof ModelsListOut>;
346
352
  export type ICModelKey = z.infer<typeof ModelKeyOut>;
347
353
  export type ICProvider = z.infer<typeof ProviderOut>;
348
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" });
@@ -16,6 +16,7 @@
16
16
  * rather than being accepted and ignored.
17
17
  */
18
18
  import { z } from "zod";
19
+ import { oaiListOut } from "./_page.js";
19
20
 
20
21
  // ── Chunking ─────────────────────────────────────────────────────────────────
21
22
 
@@ -53,7 +54,9 @@ export const ChunkingStrategyOut = z
53
54
  /** File attributes: ≤16 keys, key ≤64 chars, value string(≤512)|number|bool. */
54
55
  export const VectorStoreAttributes = z
55
56
  .record(z.string().max(64), z.union([z.string().max(512), z.number(), z.boolean()]))
56
- .refine((v) => Object.keys(v).length <= 16, { message: "at most 16 attribute keys" });
57
+ .refine((v) => Object.keys(v).length <= 16, {
58
+ message: "at most 16 attribute keys",
59
+ });
57
60
 
58
61
  /** A filter node: a comparison (`type` eq/ne/gt/gte/lt/lte/in/nin over `key`/
59
62
  * `value`) or a compound (`type` and/or over nested `filters`). The grammar is
@@ -138,15 +141,7 @@ export const VectorStoreOut = z
138
141
  .meta({ id: "VectorStoreOut" });
139
142
 
140
143
  /** Vector stores, in OpenAI's `list` envelope. */
141
- export const VectorStoreListOut = z
142
- .object({
143
- object: z.literal("list"),
144
- data: z.array(VectorStoreOut),
145
- first_id: z.string().nullable(),
146
- last_id: z.string().nullable(),
147
- has_more: z.boolean(),
148
- })
149
- .meta({ id: "VectorStoreListOut" });
144
+ export const VectorStoreListOut = oaiListOut(VectorStoreOut, "VectorStoreListOut");
150
145
 
151
146
  /** Modify body (OpenAI uses `POST`, not `PATCH`). */
152
147
  export const VectorStorePatch = z
@@ -200,15 +195,10 @@ export const VectorStoreFileOut = z
200
195
  })
201
196
  .meta({ id: "VectorStoreFileOut" });
202
197
 
203
- export const VectorStoreFileListOut = z
204
- .object({
205
- object: z.literal("list"),
206
- data: z.array(VectorStoreFileOut),
207
- first_id: z.string().nullable(),
208
- last_id: z.string().nullable(),
209
- has_more: z.boolean(),
210
- })
211
- .meta({ id: "VectorStoreFileListOut" });
198
+ export const VectorStoreFileListOut = oaiListOut(
199
+ VectorStoreFileOut,
200
+ "VectorStoreFileListOut",
201
+ );
212
202
 
213
203
  /** Update body: attributes only (chunking is frozen once indexed). */
214
204
  export const VectorStoreFileUpdate = z