@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.
- package/README.md +34 -35
- package/dist/client.js +240 -23
- package/dist/index.js +4 -0
- package/dist/scopes.js +52 -0
- package/dist/zod/_actor.js +33 -0
- package/dist/zod/_page.js +18 -4
- package/dist/zod/agents.js +7 -3
- package/dist/zod/approvals.js +9 -0
- package/dist/zod/billing.js +136 -0
- package/dist/zod/budgets.js +2 -3
- package/dist/zod/connections.js +2 -3
- package/dist/zod/conversations.js +4 -11
- package/dist/zod/deployments.js +32 -0
- package/dist/zod/files.js +2 -9
- package/dist/zod/index.js +3 -0
- package/dist/zod/mcp.js +8 -10
- package/dist/zod/observability.js +38 -19
- package/dist/zod/projects.js +4 -4
- package/dist/zod/runs.js +19 -4
- package/dist/zod/schedules.js +2 -7
- package/dist/zod/skills.js +73 -0
- package/dist/zod/smith-revisions.js +2 -3
- package/dist/zod/smiths.js +6 -0
- package/dist/zod/tenant.js +24 -4
- package/dist/zod/vector-stores.js +6 -19
- package/package.json +25 -18
- package/ts/client.ts +456 -60
- package/ts/index.ts +4 -0
- package/ts/responses.ts +40 -2
- package/ts/scopes.ts +57 -0
- package/ts/zod/_actor.ts +36 -0
- package/ts/zod/_page.ts +19 -4
- package/ts/zod/agents.ts +7 -3
- package/ts/zod/approvals.ts +9 -0
- package/ts/zod/billing.ts +168 -0
- package/ts/zod/budgets.ts +2 -3
- package/ts/zod/connections.ts +2 -3
- package/ts/zod/conversations.ts +7 -11
- package/ts/zod/deployments.ts +36 -0
- package/ts/zod/files.ts +2 -9
- package/ts/zod/index.ts +3 -0
- package/ts/zod/mcp.ts +8 -11
- package/ts/zod/observability.ts +74 -24
- package/ts/zod/projects.ts +4 -4
- package/ts/zod/runs.ts +21 -4
- package/ts/zod/schedules.ts +2 -7
- package/ts/zod/skills.ts +85 -0
- package/ts/zod/smith-revisions.ts +2 -3
- package/ts/zod/smiths.ts +6 -0
- package/ts/zod/tenant.ts +33 -5
- package/ts/zod/vector-stores.ts +9 -19
package/dist/zod/agents.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import { pageOut } from "./_page.js";
|
|
16
|
+
import { SkillRef } from "./skills.js";
|
|
16
17
|
/** A per-smith variable an agent declares; bound at run time. */
|
|
17
18
|
export const AgentVariable = z
|
|
18
19
|
.object({
|
|
@@ -69,6 +70,8 @@ export const AgentDraft = z
|
|
|
69
70
|
vector_store_ids: z.array(z.string()),
|
|
70
71
|
/** Registered MCP servers this agent's smiths load, by name. Null = all. */
|
|
71
72
|
mcp_servers: z.array(z.string()).nullable(),
|
|
73
|
+
/** Skills this agent's smiths carry. Frozen into the snapshot at publish. */
|
|
74
|
+
skills: z.array(SkillRef),
|
|
72
75
|
auto_memory: z.boolean().nullable(),
|
|
73
76
|
memory_consolidation: z.boolean().nullable(),
|
|
74
77
|
variables: z.array(AgentVariable),
|
|
@@ -106,6 +109,7 @@ export const AgentVersionOut = z
|
|
|
106
109
|
enabled_hosted_tools: z.array(z.string()).optional(),
|
|
107
110
|
vector_store_ids: z.array(z.string()).optional(),
|
|
108
111
|
mcp_servers: z.array(z.string()).nullish(),
|
|
112
|
+
skills: z.array(SkillRef).optional(),
|
|
109
113
|
auto_memory: z.boolean().nullish(),
|
|
110
114
|
memory_consolidation: z.boolean().nullish(),
|
|
111
115
|
variables: z.array(AgentVariable).optional(),
|
|
@@ -116,9 +120,7 @@ export const AgentVersionOut = z
|
|
|
116
120
|
created_at: z.string().nullable(),
|
|
117
121
|
})
|
|
118
122
|
.meta({ id: "AgentVersionOut" });
|
|
119
|
-
export const AgentVersionListOut =
|
|
120
|
-
.object({ data: z.array(AgentVersionOut) })
|
|
121
|
-
.meta({ id: "AgentVersionListOut" });
|
|
123
|
+
export const AgentVersionListOut = pageOut(AgentVersionOut, "AgentVersionListOut");
|
|
122
124
|
// ── Request bodies ──────────────────────────────────────────────────────────
|
|
123
125
|
export const AgentIn = z
|
|
124
126
|
.object({
|
|
@@ -130,6 +132,7 @@ export const AgentIn = z
|
|
|
130
132
|
vector_store_ids: z.array(z.string()).nullish(),
|
|
131
133
|
/** Scope runs to these registered MCP servers (by name). Null/omitted = all. */
|
|
132
134
|
mcp_servers: z.array(z.string()).nullish(),
|
|
135
|
+
skills: z.array(SkillRef).nullish(),
|
|
133
136
|
auto_memory: z.boolean().nullish(),
|
|
134
137
|
memory_consolidation: z.boolean().nullish(),
|
|
135
138
|
variables: z.array(AgentVariable).nullish(),
|
|
@@ -145,6 +148,7 @@ export const AgentPatch = z
|
|
|
145
148
|
/** Scope runs to these registered MCP servers (by name). An explicit null
|
|
146
149
|
* clears the restriction (= all); omitted leaves it unchanged. */
|
|
147
150
|
mcp_servers: z.array(z.string()).nullish(),
|
|
151
|
+
skills: z.array(SkillRef).nullish(),
|
|
148
152
|
auto_memory: z.boolean().nullish(),
|
|
149
153
|
memory_consolidation: z.boolean().nullish(),
|
|
150
154
|
variables: z.array(AgentVariable).nullish(),
|
package/dist/zod/approvals.js
CHANGED
|
@@ -27,6 +27,15 @@ export const ApprovalOut = z
|
|
|
27
27
|
tool: z.string().nullable(),
|
|
28
28
|
/** The tool-call arguments awaiting a decision; `{}` when none. */
|
|
29
29
|
args: z.record(z.string(), z.unknown()),
|
|
30
|
+
/** Set when the pause is a remote MCP tool asking the end-user for input
|
|
31
|
+
* (not a gate before a tool runs): the prompt and the JSON Schema the
|
|
32
|
+
* answer must match. Approve with `content` to answer it. */
|
|
33
|
+
elicitation: z
|
|
34
|
+
.object({
|
|
35
|
+
message: z.string(),
|
|
36
|
+
requested_schema: z.record(z.string(), z.unknown()),
|
|
37
|
+
})
|
|
38
|
+
.nullable(),
|
|
30
39
|
/** pending | approved | rejected. */
|
|
31
40
|
status: z.string(),
|
|
32
41
|
actor: z.string().nullable(),
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored Zod schemas for platform credits — the org wallet the tenant
|
|
3
|
+
* funds to pay *Ingram* (`/v1/organization/billing/*`). One wallet pools across
|
|
4
|
+
* all of the org's projects; every endpoint needs an organization-scoped token.
|
|
5
|
+
*
|
|
6
|
+
* Source of truth is the handler (`api/src/routes/billing.ts`), which imports
|
|
7
|
+
* these for request validation and response typing. Amounts are always integer
|
|
8
|
+
* **minor units** (cents) of `currency` (ISO-4217, lower-case) — never floats.
|
|
9
|
+
*
|
|
10
|
+
* The per-endpoint query schemas stay in the handler: they carry OpenAPI
|
|
11
|
+
* `param` metadata, and the client types query args as plain TS.
|
|
12
|
+
*
|
|
13
|
+
* `.meta({ id })` names the component so the emitted OpenAPI references it as
|
|
14
|
+
* `#/components/schemas/<id>` rather than inlining it.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
// ── Balance + ledger ────────────────────────────────────────────────────────
|
|
18
|
+
export const BalanceOut = z
|
|
19
|
+
.object({
|
|
20
|
+
/** ISO-4217, lower-case. Clients format `balance_cents` in this currency. */
|
|
21
|
+
currency: z.string(),
|
|
22
|
+
balance_cents: z.number().int(),
|
|
23
|
+
/** Whether the org has a Stripe Customer yet (materialized on first payment). */
|
|
24
|
+
stripe_customer: z.boolean(),
|
|
25
|
+
})
|
|
26
|
+
.meta({ id: "BalanceOut" });
|
|
27
|
+
/** One credit-ledger row. `amount_cents` is positive for money in (top-ups,
|
|
28
|
+
* grants, redeemed codes) and negative for usage debits. */
|
|
29
|
+
export const LedgerEntryOut = z
|
|
30
|
+
.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
amount_cents: z.number().int(),
|
|
33
|
+
currency: z.string(),
|
|
34
|
+
kind: z.string(),
|
|
35
|
+
description: z.string(),
|
|
36
|
+
created_at: z.string().nullable(),
|
|
37
|
+
})
|
|
38
|
+
.meta({ id: "LedgerEntryOut" });
|
|
39
|
+
/** A page of ledger rows (keyset pagination). */
|
|
40
|
+
export const LedgerListOut = z
|
|
41
|
+
.object({
|
|
42
|
+
data: z.array(LedgerEntryOut),
|
|
43
|
+
next_cursor: z.string().nullable(),
|
|
44
|
+
has_more: z.boolean(),
|
|
45
|
+
})
|
|
46
|
+
.meta({ id: "LedgerListOut" });
|
|
47
|
+
// ── Per-project draw from the wallet ────────────────────────────────────────
|
|
48
|
+
/** One project's draw for a calendar month — which project is spending the
|
|
49
|
+
* shared funds, and against what cap. */
|
|
50
|
+
export const OrgUsageProject = z
|
|
51
|
+
.object({
|
|
52
|
+
project_id: z.string(),
|
|
53
|
+
name: z.string(),
|
|
54
|
+
/** Credits drawn this period (sum of the project's debit rows). */
|
|
55
|
+
drawn_cents: z.number().int(),
|
|
56
|
+
/** Tokens the project's runs consumed this period (priced daily rollup). */
|
|
57
|
+
tokens: z.number().int(),
|
|
58
|
+
/** The project's tenant-scope budget limit (billing currency, major units),
|
|
59
|
+
* or null when it draws freely from the org wallet. */
|
|
60
|
+
budget_limit: z.number().nullable(),
|
|
61
|
+
budget_action: z.string().nullable(),
|
|
62
|
+
})
|
|
63
|
+
.meta({ id: "OrgUsageProject" });
|
|
64
|
+
export const OrgUsageOut = z
|
|
65
|
+
.object({
|
|
66
|
+
period: z.string(),
|
|
67
|
+
currency: z.string(),
|
|
68
|
+
total_drawn_cents: z.number().int(),
|
|
69
|
+
total_tokens: z.number().int(),
|
|
70
|
+
projects: z.array(OrgUsageProject),
|
|
71
|
+
})
|
|
72
|
+
.meta({ id: "OrgUsageOut" });
|
|
73
|
+
/** One day/project draw. Points are sparse — a day with no draw is absent, and
|
|
74
|
+
* the client fills the gaps with zero. */
|
|
75
|
+
export const OrgUsageSeriesPoint = z
|
|
76
|
+
.object({
|
|
77
|
+
day: z.string(),
|
|
78
|
+
project_id: z.string(),
|
|
79
|
+
drawn_cents: z.number().int(),
|
|
80
|
+
})
|
|
81
|
+
.meta({ id: "OrgUsageSeriesPoint" });
|
|
82
|
+
export const OrgUsageSeriesOut = z
|
|
83
|
+
.object({
|
|
84
|
+
currency: z.string(),
|
|
85
|
+
from: z.string(),
|
|
86
|
+
to: z.string(),
|
|
87
|
+
/** Projects with any draw in the window, ranked by total draw. */
|
|
88
|
+
projects: z.array(z.object({ project_id: z.string(), name: z.string() })),
|
|
89
|
+
points: z.array(OrgUsageSeriesPoint),
|
|
90
|
+
})
|
|
91
|
+
.meta({ id: "OrgUsageSeriesOut" });
|
|
92
|
+
// ── Money movement ──────────────────────────────────────────────────────────
|
|
93
|
+
export const CheckoutIn = z
|
|
94
|
+
.object({
|
|
95
|
+
amount_cents: z.number().int(),
|
|
96
|
+
/** The console's own origin URL to return to; must carry the Stripe session
|
|
97
|
+
* template so the page can reflect the result. */
|
|
98
|
+
return_url: z.string(),
|
|
99
|
+
})
|
|
100
|
+
.meta({ id: "CheckoutIn" });
|
|
101
|
+
export const CheckoutOut = z.object({ url: z.string() }).meta({ id: "CheckoutOut" });
|
|
102
|
+
export const ConfirmIn = z.object({ session_id: z.string() }).meta({ id: "ConfirmIn" });
|
|
103
|
+
export const ConfirmOut = z
|
|
104
|
+
.object({ credited: z.boolean(), payment_status: z.string() })
|
|
105
|
+
.meta({ id: "ConfirmOut" });
|
|
106
|
+
/** Add a card with no charge (Stripe setup-mode Checkout); on success it unlocks
|
|
107
|
+
* the one-time welcome credit. Same return-url contract as checkout. */
|
|
108
|
+
export const SetupIn = z.object({ return_url: z.string() }).meta({ id: "SetupIn" });
|
|
109
|
+
export const SetupOut = z.object({ url: z.string() }).meta({ id: "SetupOut" });
|
|
110
|
+
/** Redeem a one-time credit code, matched case-insensitively. */
|
|
111
|
+
export const RedeemIn = z.object({ code: z.string() }).meta({ id: "RedeemIn" });
|
|
112
|
+
export const RedeemOut = z
|
|
113
|
+
.object({
|
|
114
|
+
amount_cents: z.number().int(),
|
|
115
|
+
currency: z.string(),
|
|
116
|
+
})
|
|
117
|
+
.meta({ id: "RedeemOut" });
|
|
118
|
+
export const AutoreloadOut = z
|
|
119
|
+
.object({
|
|
120
|
+
enabled: z.boolean(),
|
|
121
|
+
/** When the balance drops below `threshold_cents`, the saved card is charged
|
|
122
|
+
* for `amount_cents`. Both are integer minor units of the billing currency. */
|
|
123
|
+
threshold_cents: z.number().int(),
|
|
124
|
+
amount_cents: z.number().int(),
|
|
125
|
+
})
|
|
126
|
+
.meta({ id: "AutoreloadOut" });
|
|
127
|
+
/** Set the same shape you read back. */
|
|
128
|
+
export const AutoreloadIn = AutoreloadOut;
|
|
129
|
+
/** `amount_cents` is optional — it defaults to the configured auto-reload amount. */
|
|
130
|
+
export const ReloadIn = z
|
|
131
|
+
.object({ amount_cents: z.number().int().optional() })
|
|
132
|
+
.meta({ id: "ReloadIn" });
|
|
133
|
+
export const ReloadOut = z
|
|
134
|
+
.object({ credited: z.boolean(), payment_status: z.string() })
|
|
135
|
+
.meta({ id: "ReloadOut" });
|
|
136
|
+
export const PortalOut = z.object({ url: z.string() }).meta({ id: "PortalOut" });
|
package/dist/zod/budgets.js
CHANGED
|
@@ -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
|
/** What a budget caps; `agent`/`smith`/`customer` budgets carry the id in
|
|
16
17
|
* `scope_id` (an agent design, a single smith, or one of your customers). */
|
|
17
18
|
export const BudgetScope = z.enum(["tenant", "agent", "smith", "customer"]);
|
|
@@ -40,9 +41,7 @@ export const BudgetStatusOut = BudgetOut.extend({
|
|
|
40
41
|
pct: z.number(),
|
|
41
42
|
over: z.boolean(),
|
|
42
43
|
}).meta({ id: "BudgetStatusOut" });
|
|
43
|
-
export const BudgetListOut =
|
|
44
|
-
.object({ data: z.array(BudgetOut) })
|
|
45
|
-
.meta({ id: "BudgetListOut" });
|
|
44
|
+
export const BudgetListOut = pageOut(BudgetOut, "BudgetListOut");
|
|
46
45
|
// ── Request bodies ──────────────────────────────────────────────────────────
|
|
47
46
|
export const BudgetIn = z
|
|
48
47
|
.object({
|
package/dist/zod/connections.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* `#/components/schemas/<id>` rather than inlining it.
|
|
19
19
|
*/
|
|
20
20
|
import { z } from "zod";
|
|
21
|
+
import { pageOut } from "./_page.js";
|
|
21
22
|
/** OAuth token material the tenant pushes in; IC stores it encrypted and never
|
|
22
23
|
* echoes it back. Only `kind: "oauth_tokens"` is accepted. */
|
|
23
24
|
export const Credential = z
|
|
@@ -41,9 +42,7 @@ export const ConnectionOut = z
|
|
|
41
42
|
created_at: z.string().nullable(),
|
|
42
43
|
})
|
|
43
44
|
.meta({ id: "ConnectionOut" });
|
|
44
|
-
export const ConnectionListOut =
|
|
45
|
-
.object({ data: z.array(ConnectionOut) })
|
|
46
|
-
.meta({ id: "ConnectionListOut" });
|
|
45
|
+
export const ConnectionListOut = pageOut(ConnectionOut, "ConnectionListOut");
|
|
47
46
|
// ── Request bodies ──────────────────────────────────────────────────────────
|
|
48
47
|
export const ConnectionIn = z
|
|
49
48
|
.object({
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* endpoint.
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import {
|
|
20
|
+
import { oaiListOut } from "./_page.js";
|
|
21
21
|
/** A conversation — the OpenAI Conversations object + IC extensions. */
|
|
22
22
|
export const ConversationOut = z
|
|
23
23
|
.object({
|
|
@@ -35,7 +35,8 @@ export const ConversationOut = z
|
|
|
35
35
|
metadata: z.record(z.string(), z.unknown()),
|
|
36
36
|
})
|
|
37
37
|
.meta({ id: "ConversationOut" });
|
|
38
|
-
|
|
38
|
+
/** The conversation list, in OpenAI's `list` envelope (page with `?after=`). */
|
|
39
|
+
export const ConversationListOut = oaiListOut(ConversationOut, "ConversationListOut");
|
|
39
40
|
/** The delete acknowledgement, in OpenAI's `*.deleted` shape. */
|
|
40
41
|
export const ConversationDeleted = z
|
|
41
42
|
.object({
|
|
@@ -66,15 +67,7 @@ export const ConversationItem = z
|
|
|
66
67
|
})
|
|
67
68
|
.meta({ id: "ConversationItem" });
|
|
68
69
|
/** A conversation's items, in OpenAI's `list` envelope (not the IC cursor page). */
|
|
69
|
-
export const ConversationItemListOut =
|
|
70
|
-
.object({
|
|
71
|
-
object: z.literal("list"),
|
|
72
|
-
data: z.array(ConversationItem),
|
|
73
|
-
first_id: z.string().nullable(),
|
|
74
|
-
last_id: z.string().nullable(),
|
|
75
|
-
has_more: z.boolean(),
|
|
76
|
-
})
|
|
77
|
-
.meta({ id: "ConversationItemListOut" });
|
|
70
|
+
export const ConversationItemListOut = oaiListOut(ConversationItem, "ConversationItemListOut");
|
|
78
71
|
/** Create body — OpenAI accepts `metadata`; `title` is the IC extension. */
|
|
79
72
|
export const ConversationCreate = z
|
|
80
73
|
.object({
|
package/dist/zod/deployments.js
CHANGED
|
@@ -103,3 +103,35 @@ export const DeploymentPatch = z
|
|
|
103
103
|
owner_email: z.string().nullish(),
|
|
104
104
|
})
|
|
105
105
|
.meta({ id: "DeploymentPatch" });
|
|
106
|
+
// ── Inbound events ───────────────────────────────────────────────────────────
|
|
107
|
+
/**
|
|
108
|
+
* One message as it arrived, before anything interpreted it — the immutable
|
|
109
|
+
* ingest record behind every channel-triggered run, in CloudEvents terms
|
|
110
|
+
* (`source` / `type` / `subject` / `data`).
|
|
111
|
+
*
|
|
112
|
+
* It is recorded before resolution, so an event that matched no smith is here
|
|
113
|
+
* too, with `smith_id: ""` — "the webhook fired and nothing happened" is a
|
|
114
|
+
* readable answer, not an absence. `idempotency_key` is the provider's own
|
|
115
|
+
* delivery id (`Message-Id`, `X-GitHub-Delivery`); a re-delivery of the same key
|
|
116
|
+
* records once, so this log is also the dedup ledger. `""` throughout means the
|
|
117
|
+
* source supplied nothing, never "unknown".
|
|
118
|
+
*/
|
|
119
|
+
export const InboundEventOut = z
|
|
120
|
+
.object({
|
|
121
|
+
id: z.string(),
|
|
122
|
+
/** The channel it arrived on: `email`, `telegram`, `slack`, `whatsapp`, … */
|
|
123
|
+
source: z.string(),
|
|
124
|
+
/** The provider's event name (`email.received`); `""` if it names none. */
|
|
125
|
+
type: z.string(),
|
|
126
|
+
/** The addressed resource — inbox address, channel, repo. */
|
|
127
|
+
subject: z.string(),
|
|
128
|
+
/** The provider's delivery id, and this log's dedup key. */
|
|
129
|
+
idempotency_key: z.string(),
|
|
130
|
+
/** The smith it woke; `""` when the sender resolved to none. */
|
|
131
|
+
smith_id: z.string(),
|
|
132
|
+
/** The provider payload as received. */
|
|
133
|
+
data: z.record(z.string(), z.unknown()),
|
|
134
|
+
created_at: z.string().nullable(),
|
|
135
|
+
})
|
|
136
|
+
.meta({ id: "InboundEventOut" });
|
|
137
|
+
export const InboundEventListOut = pageOut(InboundEventOut, "InboundEventListOut");
|
package/dist/zod/files.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* listed.
|
|
12
12
|
*/
|
|
13
13
|
import { z } from "zod";
|
|
14
|
+
import { oaiListOut } from "./_page.js";
|
|
14
15
|
/** OpenAI's upload purposes. Vector-store source files are `assistants`. */
|
|
15
16
|
export const FilePurpose = z.enum([
|
|
16
17
|
"assistants",
|
|
@@ -36,15 +37,7 @@ export const FileOut = z
|
|
|
36
37
|
})
|
|
37
38
|
.meta({ id: "FileOut" });
|
|
38
39
|
/** Files, in OpenAI's `list` envelope (not the IC cursor page). */
|
|
39
|
-
export const FileListOut =
|
|
40
|
-
.object({
|
|
41
|
-
object: z.literal("list"),
|
|
42
|
-
data: z.array(FileOut),
|
|
43
|
-
first_id: z.string().nullable(),
|
|
44
|
-
last_id: z.string().nullable(),
|
|
45
|
-
has_more: z.boolean(),
|
|
46
|
-
})
|
|
47
|
-
.meta({ id: "FileListOut" });
|
|
40
|
+
export const FileListOut = oaiListOut(FileOut, "FileListOut");
|
|
48
41
|
/** The delete acknowledgement, in OpenAI's `*.deleted` shape. */
|
|
49
42
|
export const FileDeleted = z
|
|
50
43
|
.object({
|
package/dist/zod/index.js
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* when the last one lands, the generated file and the `openapi-zod-client` step
|
|
9
9
|
* are deleted and this becomes the sole `schemas` source.
|
|
10
10
|
*/
|
|
11
|
+
export * from "./_actor.js";
|
|
11
12
|
export * from "./_page.js";
|
|
12
13
|
export * from "./agents.js";
|
|
13
14
|
export * from "./approvals.js";
|
|
15
|
+
export * from "./billing.js";
|
|
14
16
|
export * from "./budgets.js";
|
|
15
17
|
export * from "./catalog.js";
|
|
16
18
|
export * from "./connections.js";
|
|
@@ -26,6 +28,7 @@ export * from "./observability.js";
|
|
|
26
28
|
export * from "./projects.js";
|
|
27
29
|
export * from "./runs.js";
|
|
28
30
|
export * from "./schedules.js";
|
|
31
|
+
export * from "./skills.js";
|
|
29
32
|
export * from "./slack.js";
|
|
30
33
|
export * from "./smith-revisions.js";
|
|
31
34
|
export * from "./smiths.js";
|
package/dist/zod/mcp.js
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
|
/** One approval-policy rule: a name glob that gates matching tools behind a
|
|
18
19
|
* human approval. `require` is always `"approval"` today (the only supported
|
|
19
20
|
* value); arg-conditional (`when`) gating is rejected, not stored. */
|
|
@@ -66,6 +67,10 @@ export const McpServerOut = z
|
|
|
66
67
|
tool_allowlist: z.array(z.string()).nullish(),
|
|
67
68
|
approval_policy: z.array(ApprovalRule).optional(),
|
|
68
69
|
tools: z.array(McpTool),
|
|
70
|
+
/** How many tools this registration currently holds — what a run is offered,
|
|
71
|
+
* before the allow-list gate each tool's own `enabled` reports. Same number on
|
|
72
|
+
* a read as on the register/refresh response that produced it. */
|
|
73
|
+
tools_discovered: z.number().int(),
|
|
69
74
|
tools_refreshed_at: z.string().nullable(),
|
|
70
75
|
/** `degraded` when the edge failed discovery, its secret can't be decoded at
|
|
71
76
|
* run time, or its last `tools/call` failed at the transport level;
|
|
@@ -81,17 +86,10 @@ export const McpServerOut = z
|
|
|
81
86
|
created_at: z.string().nullable(),
|
|
82
87
|
})
|
|
83
88
|
.meta({ id: "McpServerOut" });
|
|
84
|
-
export const McpServerListOut =
|
|
85
|
-
.object({ data: z.array(McpServerOut) })
|
|
86
|
-
.meta({ id: "McpServerListOut" });
|
|
87
|
-
/** Register/replace and refresh echo the server back plus the count of tools
|
|
88
|
-
* discovered in the just-run `tools/list`. */
|
|
89
|
-
export const McpServerWriteOut = McpServerOut.extend({
|
|
90
|
-
tools_discovered: z.number().int(),
|
|
91
|
-
}).meta({ id: "McpServerWriteOut" });
|
|
89
|
+
export const McpServerListOut = pageOut(McpServerOut, "McpServerListOut");
|
|
92
90
|
// ── Request bodies ──────────────────────────────────────────────────────────
|
|
93
|
-
/** Auth block on a register/replace body. `
|
|
94
|
-
* bearer) — never echoed back. */
|
|
91
|
+
/** Auth block on a register/replace body. `kind` is `none` | `bearer` | `oauth`;
|
|
92
|
+
* `secret` (the shared bearer token) is write-only — never echoed back. */
|
|
95
93
|
export const McpAuthIn = z
|
|
96
94
|
.object({
|
|
97
95
|
kind: z.string().nullish(),
|
|
@@ -23,14 +23,7 @@ import { pageOut } from "./_page.js";
|
|
|
23
23
|
/** Span kinds emitted by the observability backend. `retrieval` covers vector-store
|
|
24
24
|
* search (the hosted `file_search` tool, and externally-pushed RAG spans). */
|
|
25
25
|
export const ICSpanKindEnum = z
|
|
26
|
-
.enum([
|
|
27
|
-
"run",
|
|
28
|
-
"model_call",
|
|
29
|
-
"tool_call",
|
|
30
|
-
"memory_op",
|
|
31
|
-
"retrieval",
|
|
32
|
-
"runtime_event",
|
|
33
|
-
])
|
|
26
|
+
.enum(["run", "model_call", "tool_call", "memory_op", "retrieval", "runtime_event"])
|
|
34
27
|
.meta({ id: "SpanKind" });
|
|
35
28
|
/** A single timed unit of work inside a trace. */
|
|
36
29
|
export const SpanOut = z
|
|
@@ -61,7 +54,10 @@ export const SpanNodeOut = SpanOut.extend({
|
|
|
61
54
|
export const TraceOut = z
|
|
62
55
|
.object({
|
|
63
56
|
id: z.string(),
|
|
64
|
-
|
|
57
|
+
/** Null for a trace no smith owns — an external `/v1/traces:ingest` under a
|
|
58
|
+
* tenant token attributes to none. Such a trace is tenant-scope only: a
|
|
59
|
+
* smith-bound token cannot read it. */
|
|
60
|
+
smith_id: z.string().nullable(),
|
|
65
61
|
app_id: z.string().nullable(),
|
|
66
62
|
run_id: z.string().nullable(),
|
|
67
63
|
root_kind: ICSpanKindEnum,
|
|
@@ -82,24 +78,32 @@ export const TraceDetailOut = TraceOut.extend({
|
|
|
82
78
|
}).meta({ id: "TraceDetailOut" });
|
|
83
79
|
export const TraceListOut = pageOut(TraceOut, "TraceListOut");
|
|
84
80
|
/** Aggregated usage grouped by app, smith, model, or customer. */
|
|
81
|
+
/** The token/cost amounts a usage bucket reports. `tokens` is the grand total
|
|
82
|
+
* (input + output); `input_tokens` is the input slice, and `cache_read_tokens`
|
|
83
|
+
* / `cache_write_tokens` are sub-slices of input (reads served from the
|
|
84
|
+
* provider's prompt cache, writes billed at the cache-write premium). The cache
|
|
85
|
+
* hit rate is `cache_read_tokens / input_tokens`. */
|
|
86
|
+
const UsageAmounts = z.object({
|
|
87
|
+
tokens: z.number(),
|
|
88
|
+
input_tokens: z.number(),
|
|
89
|
+
cache_read_tokens: z.number(),
|
|
90
|
+
cache_write_tokens: z.number(),
|
|
91
|
+
cost: z.number(),
|
|
92
|
+
run_count: z.number(),
|
|
93
|
+
});
|
|
85
94
|
export const UsageBreakdownOut = z
|
|
86
95
|
.object({
|
|
87
96
|
group_by: z.enum(["app", "smith", "model", "customer"]),
|
|
88
|
-
totals:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
run_count: z.number(),
|
|
92
|
-
}),
|
|
93
|
-
groups: z.array(z.object({
|
|
97
|
+
totals: UsageAmounts,
|
|
98
|
+
groups: z.array(z
|
|
99
|
+
.object({
|
|
94
100
|
app: z.string().nullable().optional(),
|
|
95
101
|
smith: z.string().nullable().optional(),
|
|
96
102
|
model: z.string().nullable().optional(),
|
|
97
103
|
// Customer-grouped views label unassigned usage `principal:<smith id>`.
|
|
98
104
|
customer: z.string().nullable().optional(),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
run_count: z.number(),
|
|
102
|
-
})),
|
|
105
|
+
})
|
|
106
|
+
.extend(UsageAmounts.shape)),
|
|
103
107
|
/** Custom billable events aggregated per meter over the same filters. */
|
|
104
108
|
meters: z
|
|
105
109
|
.array(z.object({
|
|
@@ -132,3 +136,18 @@ export const UsageEventListOut = z
|
|
|
132
136
|
has_more: z.boolean(),
|
|
133
137
|
})
|
|
134
138
|
.meta({ id: "UsageEventListOut" });
|
|
139
|
+
// ── Span ingestion (POST /v1/traces:ingest) ─────────────────────────────────
|
|
140
|
+
/** The request body for span ingestion (externally-pushed spans / OTel).
|
|
141
|
+
*
|
|
142
|
+
* Deliberately permissive: the handler normalizes rather than rejects — an
|
|
143
|
+
* unrecognized `kind` degrades to `runtime_event`, missing ids and timestamps
|
|
144
|
+
* are generated. Validating {@link ICSpanIn} here would 422 exactly the sloppy
|
|
145
|
+
* exporter payloads the endpoint exists to absorb. `ICSpanIn` documents the
|
|
146
|
+
* shape for callers; the wire stays open. */
|
|
147
|
+
export const TraceIngestIn = z
|
|
148
|
+
.object({ spans: z.array(z.record(z.string(), z.unknown())).optional() })
|
|
149
|
+
.meta({ id: "TraceIngestIn" });
|
|
150
|
+
/** The 202 ack for span ingestion: how many spans were written. */
|
|
151
|
+
export const TraceIngestOut = z
|
|
152
|
+
.object({ accepted: z.number().int() })
|
|
153
|
+
.meta({ id: "TraceIngestOut" });
|
package/dist/zod/projects.js
CHANGED
|
@@ -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
|
export const ProjectOut = z
|
|
16
17
|
.object({
|
|
17
18
|
id: z.string(),
|
|
@@ -24,9 +25,7 @@ export const ProjectOut = z
|
|
|
24
25
|
archived_at: z.string().nullable(),
|
|
25
26
|
})
|
|
26
27
|
.meta({ id: "ProjectOut" });
|
|
27
|
-
export const ProjectListOut =
|
|
28
|
-
.object({ data: z.array(ProjectOut) })
|
|
29
|
-
.meta({ id: "ProjectListOut" });
|
|
28
|
+
export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
|
|
30
29
|
/**
|
|
31
30
|
* The secret minted when an org mints a project (tenant-admin) token. Shape
|
|
32
31
|
* matches `mintToken`'s return; the `tenant` module owns the canonical
|
|
@@ -52,7 +51,8 @@ export const ProjectIn = z
|
|
|
52
51
|
.meta({ id: "ProjectIn" });
|
|
53
52
|
export const ProjectTokenIn = z
|
|
54
53
|
.object({
|
|
55
|
-
ttl_seconds
|
|
54
|
+
// Same bounds as `TokenIn.ttl_seconds` — this mints a `tenant:*` token too.
|
|
55
|
+
ttl_seconds: z.number().int().positive().max(315_360_000).nullish(),
|
|
56
56
|
name: z.string().nullish(),
|
|
57
57
|
})
|
|
58
58
|
.meta({ id: "ProjectTokenIn" });
|
package/dist/zod/runs.js
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
|
/** One message in a run's `input`. `content` is a plain string for a text-only
|
|
25
26
|
* turn, or an array of content parts (`{type:"text"|"file"|"image", …}`) for a
|
|
@@ -28,10 +29,7 @@ import { pageOut } from "./_page.js";
|
|
|
28
29
|
export const InputMessage = z
|
|
29
30
|
.object({
|
|
30
31
|
role: z.string(),
|
|
31
|
-
content: z.union([
|
|
32
|
-
z.string(),
|
|
33
|
-
z.array(z.record(z.string(), z.unknown())),
|
|
34
|
-
]),
|
|
32
|
+
content: z.union([z.string(), z.array(z.record(z.string(), z.unknown()))]),
|
|
35
33
|
})
|
|
36
34
|
.meta({ id: "InputMessage" });
|
|
37
35
|
/** One run's own token usage (the `usage` map on a run). Distinct from the
|
|
@@ -49,6 +47,16 @@ export const RunUsage = z
|
|
|
49
47
|
cost: z.number().optional(),
|
|
50
48
|
})
|
|
51
49
|
.meta({ id: "RunUsage" });
|
|
50
|
+
/** One thing that went wrong during a run without ending it — today, a tool source
|
|
51
|
+
* the run could not reach. A run that lost its tools still answers, and the answer
|
|
52
|
+
* is shaped like a healthy one, so this rides the run's own summary fields rather
|
|
53
|
+
* than a nested metadata key nobody reads. */
|
|
54
|
+
export const RunWarning = z
|
|
55
|
+
.object({
|
|
56
|
+
code: z.string(),
|
|
57
|
+
message: z.string(),
|
|
58
|
+
})
|
|
59
|
+
.meta({ id: "RunWarning" });
|
|
52
60
|
export const RunOut = z
|
|
53
61
|
.object({
|
|
54
62
|
id: z.string(),
|
|
@@ -75,8 +83,12 @@ export const RunOut = z
|
|
|
75
83
|
})
|
|
76
84
|
.nullable(),
|
|
77
85
|
stop_reason: z.string().nullable(),
|
|
86
|
+
// Always present, `[]` on a clean run: absence must never read as "fine".
|
|
87
|
+
warnings: z.array(RunWarning),
|
|
78
88
|
usage: RunUsage.nullable(),
|
|
79
89
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
90
|
+
/** Who started this run. Null on runs created before attribution shipped. */
|
|
91
|
+
actor: Actor.nullable(),
|
|
80
92
|
created_at: z.string().nullable(),
|
|
81
93
|
updated_at: z.string().nullable(),
|
|
82
94
|
})
|
|
@@ -112,6 +124,9 @@ export const Submit = z
|
|
|
112
124
|
result: z.record(z.string(), z.unknown()).nullish(),
|
|
113
125
|
approval_id: z.string().nullish(),
|
|
114
126
|
decision: z.string().nullish(),
|
|
127
|
+
/** The answer to an approval's `elicitation`, matching its
|
|
128
|
+
* `requested_schema`; with `decision: "approve"`. */
|
|
129
|
+
content: z.record(z.string(), z.unknown()).nullish(),
|
|
115
130
|
actor: z.string().nullish(),
|
|
116
131
|
reason: z.string().nullish(),
|
|
117
132
|
stream: z.boolean().optional(),
|
package/dist/zod/schedules.js
CHANGED
|
@@ -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
|
/** A schedule's stored input: messages replayed as the run input on each fire. */
|
|
17
18
|
const ScheduleInput = z.array(z.record(z.string(), z.unknown()));
|
|
18
19
|
export const ScheduleOut = z
|
|
@@ -25,17 +26,13 @@ export const ScheduleOut = z
|
|
|
25
26
|
input: ScheduleInput,
|
|
26
27
|
/** Thread the fired runs append to; null mints a fresh thread per fire. */
|
|
27
28
|
thread_id: z.string().nullable(),
|
|
28
|
-
/** Max overlapping fired runs before new fires are skipped. */
|
|
29
|
-
max_concurrent: z.number().int(),
|
|
30
29
|
enabled: z.boolean(),
|
|
31
30
|
next_fire_at: z.string().nullable(),
|
|
32
31
|
last_fire_at: z.string().nullable(),
|
|
33
32
|
created_at: z.string().nullable(),
|
|
34
33
|
})
|
|
35
34
|
.meta({ id: "ScheduleOut" });
|
|
36
|
-
export const ScheduleListOut =
|
|
37
|
-
.object({ data: z.array(ScheduleOut) })
|
|
38
|
-
.meta({ id: "ScheduleListOut" });
|
|
35
|
+
export const ScheduleListOut = pageOut(ScheduleOut, "ScheduleListOut");
|
|
39
36
|
/** `POST .../:sid/run_now` — the fire is enqueued onto the smith's serial delivery
|
|
40
37
|
* lane (not run inline), so the response acknowledges the queued delivery rather
|
|
41
38
|
* than a completed run. Poll `/v1/events` or the smith's runs for the outcome. */
|
|
@@ -54,7 +51,6 @@ export const ScheduleIn = z
|
|
|
54
51
|
timezone: z.string().default("UTC"),
|
|
55
52
|
input: ScheduleInput.default([]),
|
|
56
53
|
thread_id: z.string().nullish(),
|
|
57
|
-
max_concurrent: z.number().int().default(1),
|
|
58
54
|
enabled: z.boolean().default(true),
|
|
59
55
|
})
|
|
60
56
|
.meta({ id: "ScheduleIn" });
|
|
@@ -65,7 +61,6 @@ export const SchedulePatch = z
|
|
|
65
61
|
timezone: z.string().nullish(),
|
|
66
62
|
input: ScheduleInput.nullish(),
|
|
67
63
|
thread_id: z.string().nullish(),
|
|
68
|
-
max_concurrent: z.number().int().nullish(),
|
|
69
64
|
enabled: z.boolean().nullish(),
|
|
70
65
|
})
|
|
71
66
|
.meta({ id: "SchedulePatch" });
|