@nouter/platform 0.4.0 → 0.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/dist/index.d.ts CHANGED
@@ -10,7 +10,10 @@ export { PrivacyErasureResource, PRIVACY_ERASURE_BETA, type PlatformErasureReque
10
10
  export { ApiKeysResource, KEY_PRESETS, type PlatformApiKey, type PlatformApiKeyCreateParams, type PlatformApiKeyCreateResponse, type PlatformApiKeyDeleted, type PlatformApiKeyRotateParams, type PlatformApiKeyRotateResponse, type PlatformApiKeyScope, type PlatformApiKeysPage, type PlatformApiKeyUpdateParams, type PlatformApiKeyUpdateResponse, } from "./platform/api-keys.js";
11
11
  export { AuditEventsResource, type PlatformAuditEvent, type PlatformAuditEventsPage, type PlatformAuditEventsParams, } from "./platform/audit-events.js";
12
12
  export { MeResource, type PlatformMe } from "./platform/me.js";
13
+ export { ServiceAccountsResource, type PlatformServiceAccount, type PlatformServiceAccountCreateParams, type PlatformServiceAccountCreateResponse, type PlatformServiceAccountResponse, type PlatformServiceAccountsListParams, type PlatformServiceAccountsPage, } from "./platform/service-accounts.js";
14
+ export { FederationResource, FederationIssuersResource, FederationRulesResource, type PlatformFederationIssuer, type PlatformFederationIssuerCreateParams, type PlatformFederationIssuerCreateResponse, type PlatformFederationIssuerResponse, type PlatformFederationIssuersListParams, type PlatformFederationIssuersPage, type PlatformFederationRule, type PlatformFederationRuleCreateParams, type PlatformFederationRuleCreateResponse, type PlatformFederationRuleResponse, type PlatformFederationRulesListParams, type PlatformFederationRulesPage, } from "./platform/federation.js";
13
15
  export { SessionsResource, SessionOutputsResource, type PlatformSessionOutput, type PlatformSessionOutputsPage, } from "./platform/sessions.js";
16
+ export { SkillsResource, SkillVersionsResource, SKILLS_BETA, type PlatformSkill, type PlatformSkillCreateParams, type PlatformSkillCreateResponse, type PlatformSkillFile, type PlatformSkillFilesParams, type PlatformSkillListPage, type PlatformSkillListParams, type PlatformSkillVersionCreateParams, type PlatformSkillVersionCreateResponse, } from "./platform/skills.js";
14
17
  import type { PlatformBeta } from "./agents.js";
15
18
  export type { PlatformAgentAcp, PlatformAgentAcpParams, PlatformAgentExtension, PlatformAgentExtensionParams, PlatformAgentModelParams, PlatformAgent, PlatformAgentCreateParams, PlatformAgentUpdateParams, PlatformAgentMultiagentParams, PlatformAgentMultiagent, PlatformMultiagent, PlatformSessionThreadAgent, PlatformSessionAgent, PlatformSession, PlatformSessionCreateParams, PlatformAgents, PlatformSessions, PlatformBeta, PlatformAgentPolicy, PlatformAgentRetention, PlatformMcpToolClass, PlatformMcpToolClassEntry, PlatformMcpServer, PlatformMcpServerParams, PlatformStdioMcpServer, PlatformStdioMcpServerParams, PlatformAgentRuntimeBindingParams, PlatformJsonValue, PlatformProviderOptions, } from "./agents.js";
16
19
  export type { PlatformEnvironment, PlatformEnvironmentCreateParams, PlatformEnvironmentUpdateParams, PlatformEnvironments, PlatformNoneEnvironmentConfig, } from "./environments.js";
package/dist/index.js CHANGED
@@ -11,7 +11,10 @@ export { PrivacyErasureResource, PRIVACY_ERASURE_BETA, } from "./platform/privac
11
11
  export { ApiKeysResource, KEY_PRESETS, } from "./platform/api-keys.js";
12
12
  export { AuditEventsResource, } from "./platform/audit-events.js";
13
13
  export { MeResource } from "./platform/me.js";
14
+ export { ServiceAccountsResource, } from "./platform/service-accounts.js";
15
+ export { FederationResource, FederationIssuersResource, FederationRulesResource, } from "./platform/federation.js";
14
16
  export { SessionsResource, SessionOutputsResource, } from "./platform/sessions.js";
17
+ export { SkillsResource, SkillVersionsResource, SKILLS_BETA, } from "./platform/skills.js";
15
18
  export { PlatformModelsResource, PlatformModelCardsResource, PlatformHarnessesResource, PlatformResources, } from "./oma.js";
16
19
  export { EvalsResource, EvalBenchmarksResource, EvalCasesResource, EvalRunsResource, EVAL_RUN_TERMINAL_STATUSES, } from "./evals.js";
17
20
  export { Anthropic };
package/dist/oma.d.ts CHANGED
@@ -10,7 +10,10 @@ import { PrivacyErasureResource } from "./platform/privacy-erasure.js";
10
10
  import { ApiKeysResource } from "./platform/api-keys.js";
11
11
  import { AuditEventsResource } from "./platform/audit-events.js";
12
12
  import { MeResource } from "./platform/me.js";
13
+ import { ServiceAccountsResource } from "./platform/service-accounts.js";
14
+ import { FederationResource } from "./platform/federation.js";
13
15
  import { SessionsResource } from "./platform/sessions.js";
16
+ import { SkillsResource } from "./platform/skills.js";
14
17
  export { PlatformModelCardsResource };
15
18
  export type { PlatformModelCard, PlatformModelCardCreateParams, PlatformModelCardCreateResponse, PlatformModelCardDeleted, PlatformModelCardListParams, PlatformModelCardListResponse, PlatformModelCardUpdateParams, } from "./platform/model-cards.js";
16
19
  /** Pi provider id. Built-ins and user-defined ids share this open shape. */
@@ -122,8 +125,14 @@ export declare class PlatformResources {
122
125
  readonly apiKeys: ApiKeysResource;
123
126
  readonly auditEvents: AuditEventsResource;
124
127
  readonly me: MeResource;
128
+ /** Las cuentas de servicio de `/v1/oma/service_accounts`: listar, crear, leer y archivar. */
129
+ readonly serviceAccounts: ServiceAccountsResource;
130
+ /** La federación de `/v1/oma`: los emisores (`issuers`) y las reglas (`rules`), con las mismas cuatro operaciones. */
131
+ readonly federation: FederationResource;
125
132
  /** Los outputs de una sesión; la ruta es `/v1/sessions/*`, no `/v1/oma/*`. */
126
133
  readonly sessions: SessionsResource;
134
+ /** Las skills custom de `/v1/skills`: la lista, el alta y las versiones. */
135
+ readonly skills: SkillsResource;
127
136
  constructor(client: Anthropic);
128
137
  request<Response>(params: PlatformRequestParams): import("@anthropic-ai/sdk").APIPromise<Response>;
129
138
  }
package/dist/oma.js CHANGED
@@ -9,7 +9,10 @@ import { PrivacyErasureResource } from "./platform/privacy-erasure.js";
9
9
  import { ApiKeysResource } from "./platform/api-keys.js";
10
10
  import { AuditEventsResource } from "./platform/audit-events.js";
11
11
  import { MeResource } from "./platform/me.js";
12
+ import { ServiceAccountsResource } from "./platform/service-accounts.js";
13
+ import { FederationResource } from "./platform/federation.js";
12
14
  import { SessionsResource } from "./platform/sessions.js";
15
+ import { SkillsResource } from "./platform/skills.js";
13
16
  import { withRetryPolicy } from "./platform/http.js";
14
17
  export { PlatformModelCardsResource };
15
18
  export class PlatformHarnessesResource {
@@ -51,8 +54,14 @@ export class PlatformResources {
51
54
  apiKeys;
52
55
  auditEvents;
53
56
  me;
57
+ /** Las cuentas de servicio de `/v1/oma/service_accounts`: listar, crear, leer y archivar. */
58
+ serviceAccounts;
59
+ /** La federación de `/v1/oma`: los emisores (`issuers`) y las reglas (`rules`), con las mismas cuatro operaciones. */
60
+ federation;
54
61
  /** Los outputs de una sesión; la ruta es `/v1/sessions/*`, no `/v1/oma/*`. */
55
62
  sessions;
63
+ /** Las skills custom de `/v1/skills`: la lista, el alta y las versiones. */
64
+ skills;
56
65
  constructor(client) {
57
66
  this.client = client;
58
67
  this.models = new PlatformModelsResource(client);
@@ -68,7 +77,10 @@ export class PlatformResources {
68
77
  this.apiKeys = new ApiKeysResource(client);
69
78
  this.auditEvents = new AuditEventsResource(client);
70
79
  this.me = new MeResource(client);
80
+ this.serviceAccounts = new ServiceAccountsResource(client);
81
+ this.federation = new FederationResource(client);
71
82
  this.sessions = new SessionsResource(client);
83
+ this.skills = new SkillsResource(client);
72
84
  }
73
85
  request(params) {
74
86
  const { method, path, ...options } = params;
@@ -17,6 +17,8 @@ export interface PlatformApiErrorFields {
17
17
  errorCode: string | null;
18
18
  retryable: boolean;
19
19
  requestId: string | null;
20
+ /** Los segundos del header `Retry-After` del `429` o el `503`, o `null` si no vino. */
21
+ retryAfterSeconds: number | null;
20
22
  }
21
23
  export declare class PlatformApiError extends Error implements PlatformApiErrorFields {
22
24
  readonly status: number;
@@ -24,6 +26,7 @@ export declare class PlatformApiError extends Error implements PlatformApiErrorF
24
26
  readonly errorCode: string | null;
25
27
  readonly retryable: boolean;
26
28
  readonly requestId: string | null;
29
+ readonly retryAfterSeconds: number | null;
27
30
  constructor(fields: PlatformApiErrorFields);
28
31
  /** Convierte el `APIError` del cliente oficial, que trae el cuerpo ya parseado, al error del SDK. */
29
32
  static fromAPIError(error: APIError): PlatformApiError;
@@ -5,6 +5,7 @@ export class PlatformApiError extends Error {
5
5
  errorCode;
6
6
  retryable;
7
7
  requestId;
8
+ retryAfterSeconds;
8
9
  constructor(fields) {
9
10
  super(fields.message);
10
11
  this.name = "PlatformApiError";
@@ -13,6 +14,7 @@ export class PlatformApiError extends Error {
13
14
  this.errorCode = fields.errorCode;
14
15
  this.retryable = fields.retryable;
15
16
  this.requestId = fields.requestId;
17
+ this.retryAfterSeconds = fields.retryAfterSeconds;
16
18
  }
17
19
  /** Convierte el `APIError` del cliente oficial, que trae el cuerpo ya parseado, al error del SDK. */
18
20
  static fromAPIError(error) {
@@ -28,6 +30,7 @@ export class PlatformApiError extends Error {
28
30
  errorCode: typeof details?.error_code === "string" ? details.error_code : null,
29
31
  retryable: inner.retryable === true,
30
32
  requestId: requestIdOf(body, error),
33
+ retryAfterSeconds: retryAfterSecondsOf(error),
31
34
  });
32
35
  }
33
36
  if (body !== undefined && typeof body.error === "string") {
@@ -40,6 +43,7 @@ export class PlatformApiError extends Error {
40
43
  // El sobre de texto no trae `retryable`: se deduce del estado, como el servidor.
41
44
  retryable: status === 429 || status >= 500,
42
45
  requestId: requestIdOf(body, error),
46
+ retryAfterSeconds: retryAfterSecondsOf(error),
43
47
  });
44
48
  }
45
49
  return new PlatformApiError({
@@ -51,9 +55,21 @@ export class PlatformApiError extends Error {
51
55
  // hereda de `APIConnectionError`, así que la misma comprobación lo cubre.
52
56
  retryable: error instanceof APIConnectionError || status === 429 || status >= 500,
53
57
  requestId: error.requestID ?? null,
58
+ retryAfterSeconds: retryAfterSecondsOf(error),
54
59
  });
55
60
  }
56
61
  }
62
+ /**
63
+ * El `Retry-After` del contrato son segundos enteros (el componente de `api/openapi.yaml`). Un header que no es un
64
+ * entero positivo se lee como ausente: el SDK no adivina una fecha HTTP ni un valor raro.
65
+ */
66
+ function retryAfterSecondsOf(error) {
67
+ const header = error.headers?.get("retry-after");
68
+ if (header === null || header === undefined)
69
+ return null;
70
+ const seconds = Number(header);
71
+ return Number.isInteger(seconds) && seconds >= 0 ? seconds : null;
72
+ }
57
73
  function requestIdOf(body, error) {
58
74
  if (typeof body.request_id === "string")
59
75
  return body.request_id;
@@ -0,0 +1,120 @@
1
+ import type Anthropic from "@anthropic-ai/sdk";
2
+ type RequestOptions = Anthropic.RequestOptions;
3
+ import type { operations } from "../generated/openapi.js";
4
+ import { type PlatformRequestOptions } from "./http.js";
5
+ import type { JsonContent } from "./types.js";
6
+ type FederationIssuersResponse = JsonContent<operations["getV1OmaFederationIssuers"]["responses"][200]>;
7
+ /** Una página de emisores de federación (`GET /v1/oma/federation_issuers`), con `has_more` y `next_page`. */
8
+ export type PlatformFederationIssuersPage = FederationIssuersResponse;
9
+ /** Un emisor de federación tal como lo devuelve el contrato: su proveedor, su emisor y sus claves. */
10
+ export type PlatformFederationIssuer = FederationIssuersResponse["data"][number];
11
+ type FederationIssuerCreateBody = JsonContent<operations["postV1OmaFederationIssuers"]["requestBody"]>;
12
+ /** El cuerpo de crear un emisor: el nombre, el proveedor y la URL del emisor; `jwks` es opcional. */
13
+ export type PlatformFederationIssuerCreateParams = FederationIssuerCreateBody;
14
+ /**
15
+ * El emisor que devuelven el detalle, el archivo y el alta (`GET /v1/oma/federation_issuers/{id}`): el tipo neutral
16
+ * del recurso, no el del alta en particular.
17
+ */
18
+ export type PlatformFederationIssuerResponse = JsonContent<operations["getV1OmaFederationIssuersId"]["responses"][200]>;
19
+ /** El alta devuelve la misma forma; el alias nombra la respuesta de `create`. */
20
+ export type PlatformFederationIssuerCreateResponse = PlatformFederationIssuerResponse;
21
+ /** La query de `list` de emisores tal como la declara el contrato (`limit`, `page`, `include_archived`). */
22
+ type FederationIssuersListQuery = NonNullable<operations["getV1OmaFederationIssuers"]["parameters"]["query"]>;
23
+ /**
24
+ * Las opciones de `list` de emisores: las del cliente oficial más la query del contrato, con `include_archived` como
25
+ * booleano (el SDK lo manda al wire como `"true"`/`"false"`).
26
+ */
27
+ export type PlatformFederationIssuersListParams = Omit<PlatformRequestOptions, "body" | "query"> & {
28
+ query?: Omit<FederationIssuersListQuery, "include_archived"> & {
29
+ include_archived?: boolean;
30
+ };
31
+ };
32
+ type FederationRulesResponse = JsonContent<operations["getV1OmaFederationRules"]["responses"][200]>;
33
+ /** Una página de reglas de federación (`GET /v1/oma/federation_rules`), con `has_more` y `next_page`. */
34
+ export type PlatformFederationRulesPage = FederationRulesResponse;
35
+ /** Una regla de federación tal como la devuelve el contrato: su emisor, el match, el destino y sus alcances. */
36
+ export type PlatformFederationRule = FederationRulesResponse["data"][number];
37
+ type FederationRuleCreateBody = JsonContent<operations["postV1OmaFederationRules"]["requestBody"]>;
38
+ /** El cuerpo de crear una regla: el emisor, el match, el destino y los alcances que se emiten. */
39
+ export type PlatformFederationRuleCreateParams = FederationRuleCreateBody;
40
+ /**
41
+ * La regla que devuelven el detalle, el archivo y el alta (`GET /v1/oma/federation_rules/{id}`): el tipo neutral del
42
+ * recurso, no el del alta en particular.
43
+ */
44
+ export type PlatformFederationRuleResponse = JsonContent<operations["getV1OmaFederationRulesId"]["responses"][200]>;
45
+ /** El alta devuelve la misma forma; el alias nombra la respuesta de `create`. */
46
+ export type PlatformFederationRuleCreateResponse = PlatformFederationRuleResponse;
47
+ /** La query de `list` de reglas tal como la declara el contrato: la página más `issuer_id`. */
48
+ type FederationRulesListQuery = NonNullable<operations["getV1OmaFederationRules"]["parameters"]["query"]>;
49
+ /**
50
+ * Las opciones de `list` de reglas: las del cliente oficial más la query del contrato (`issuer_id` y la página), con
51
+ * `include_archived` como booleano (el SDK lo manda al wire como `"true"`/`"false"`).
52
+ */
53
+ export type PlatformFederationRulesListParams = Omit<PlatformRequestOptions, "body" | "query"> & {
54
+ query?: Omit<FederationRulesListQuery, "include_archived"> & {
55
+ include_archived?: boolean;
56
+ };
57
+ };
58
+ /**
59
+ * `/v1/oma/federation_issuers`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
60
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
61
+ */
62
+ export declare class FederationIssuersResource {
63
+ private readonly client;
64
+ constructor(client: Anthropic);
65
+ /**
66
+ * Lista los emisores (`GET /v1/oma/federation_issuers`). La query es la del contrato: `limit` (de 1 a 100), `page`
67
+ * (el `next_page` de la página anterior) e `include_archived` (booleano; al wire va como `"true"`/`"false"`).
68
+ */
69
+ list(params?: PlatformFederationIssuersListParams): Promise<PlatformFederationIssuersPage>;
70
+ /**
71
+ * Crea un emisor (`POST /v1/oma/federation_issuers`). Pide la credencial de una persona: una clave de service
72
+ * account o un token federado reciben `403` con `errorCode: "admin_required"`. Los `400` traen el código en
73
+ * `errorCode`: `invalid_name`, `invalid_issuer_url`, `invalid_jwks`, `invalid_token_lifetime` y
74
+ * `federation_issuer_limit_reached`.
75
+ */
76
+ create(params: PlatformFederationIssuerCreateParams, options?: RequestOptions): Promise<PlatformFederationIssuerCreateResponse>;
77
+ retrieve(id: string, options?: RequestOptions): Promise<PlatformFederationIssuerResponse>;
78
+ /**
79
+ * Archiva el emisor (`POST /v1/oma/federation_issuers/:id/archive`); la ruta no es un `DELETE`. Es idempotente. Un
80
+ * `400` con `errorCode: "resource_in_use"` avisa que hay reglas de federación que lo usan: hay que archivarlas
81
+ * primero. Un id inexistente o de otra organización es el `404` `federation_issuer_not_found`.
82
+ */
83
+ archive(id: string, options?: RequestOptions): Promise<PlatformFederationIssuerResponse>;
84
+ }
85
+ /**
86
+ * `/v1/oma/federation_rules`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
87
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
88
+ */
89
+ export declare class FederationRulesResource {
90
+ private readonly client;
91
+ constructor(client: Anthropic);
92
+ /**
93
+ * Lista las reglas (`GET /v1/oma/federation_rules`). La query es la del contrato: `limit` (de 1 a 100), `page` (el
94
+ * `next_page` de la página anterior), `include_archived` (booleano; al wire va como `"true"`/`"false"`) e
95
+ * `issuer_id` para quedarse con las reglas de un emisor.
96
+ */
97
+ list(params?: PlatformFederationRulesListParams): Promise<PlatformFederationRulesPage>;
98
+ /**
99
+ * Crea una regla (`POST /v1/oma/federation_rules`). Pide la credencial de una persona: una clave de service
100
+ * account o un token federado reciben `403` con `errorCode: "admin_required"`. Los `400` traen el código en
101
+ * `errorCode`: `invalid_name`, `invalid_match`, `invalid_scope`, `invalid_token_lifetime`,
102
+ * `federation_rule_limit_reached`, `federation_issuer_archived` y `service_account_archived`; un emisor, un
103
+ * workspace o una cuenta de destino que no son de la organización son `404` con su código.
104
+ */
105
+ create(params: PlatformFederationRuleCreateParams, options?: RequestOptions): Promise<PlatformFederationRuleCreateResponse>;
106
+ retrieve(id: string, options?: RequestOptions): Promise<PlatformFederationRuleResponse>;
107
+ /**
108
+ * Archiva la regla (`POST /v1/oma/federation_rules/:id/archive`); la ruta no es un `DELETE`. Es idempotente y
109
+ * libera el `resource_in_use` de su cuenta y de su emisor. Un id inexistente o de otra organización es el `404`
110
+ * `federation_rule_not_found`.
111
+ */
112
+ archive(id: string, options?: RequestOptions): Promise<PlatformFederationRuleResponse>;
113
+ }
114
+ /** El namespace `federation` de `client.platform`: los emisores y las reglas. */
115
+ export declare class FederationResource {
116
+ readonly issuers: FederationIssuersResource;
117
+ readonly rules: FederationRulesResource;
118
+ constructor(client: Anthropic);
119
+ }
120
+ export {};
@@ -0,0 +1,100 @@
1
+ import { platformRequest, serializeListQuery } from "./http.js";
2
+ /**
3
+ * `/v1/oma/federation_issuers`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
4
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
5
+ */
6
+ export class FederationIssuersResource {
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * Lista los emisores (`GET /v1/oma/federation_issuers`). La query es la del contrato: `limit` (de 1 a 100), `page`
13
+ * (el `next_page` de la página anterior) e `include_archived` (booleano; al wire va como `"true"`/`"false"`).
14
+ */
15
+ list(params = {}) {
16
+ const { query, ...options } = params;
17
+ return platformRequest(this.client, "get", "/v1/oma/federation_issuers", {
18
+ ...options,
19
+ query: serializeListQuery(query),
20
+ });
21
+ }
22
+ /**
23
+ * Crea un emisor (`POST /v1/oma/federation_issuers`). Pide la credencial de una persona: una clave de service
24
+ * account o un token federado reciben `403` con `errorCode: "admin_required"`. Los `400` traen el código en
25
+ * `errorCode`: `invalid_name`, `invalid_issuer_url`, `invalid_jwks`, `invalid_token_lifetime` y
26
+ * `federation_issuer_limit_reached`.
27
+ */
28
+ create(params, options) {
29
+ return platformRequest(this.client, "post", "/v1/oma/federation_issuers", {
30
+ ...options,
31
+ body: params,
32
+ });
33
+ }
34
+ retrieve(id, options) {
35
+ return platformRequest(this.client, "get", `/v1/oma/federation_issuers/${encodeURIComponent(id)}`, options);
36
+ }
37
+ /**
38
+ * Archiva el emisor (`POST /v1/oma/federation_issuers/:id/archive`); la ruta no es un `DELETE`. Es idempotente. Un
39
+ * `400` con `errorCode: "resource_in_use"` avisa que hay reglas de federación que lo usan: hay que archivarlas
40
+ * primero. Un id inexistente o de otra organización es el `404` `federation_issuer_not_found`.
41
+ */
42
+ archive(id, options) {
43
+ return platformRequest(this.client, "post", `/v1/oma/federation_issuers/${encodeURIComponent(id)}/archive`, options);
44
+ }
45
+ }
46
+ /**
47
+ * `/v1/oma/federation_rules`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
48
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
49
+ */
50
+ export class FederationRulesResource {
51
+ client;
52
+ constructor(client) {
53
+ this.client = client;
54
+ }
55
+ /**
56
+ * Lista las reglas (`GET /v1/oma/federation_rules`). La query es la del contrato: `limit` (de 1 a 100), `page` (el
57
+ * `next_page` de la página anterior), `include_archived` (booleano; al wire va como `"true"`/`"false"`) e
58
+ * `issuer_id` para quedarse con las reglas de un emisor.
59
+ */
60
+ list(params = {}) {
61
+ const { query, ...options } = params;
62
+ return platformRequest(this.client, "get", "/v1/oma/federation_rules", {
63
+ ...options,
64
+ query: serializeListQuery(query),
65
+ });
66
+ }
67
+ /**
68
+ * Crea una regla (`POST /v1/oma/federation_rules`). Pide la credencial de una persona: una clave de service
69
+ * account o un token federado reciben `403` con `errorCode: "admin_required"`. Los `400` traen el código en
70
+ * `errorCode`: `invalid_name`, `invalid_match`, `invalid_scope`, `invalid_token_lifetime`,
71
+ * `federation_rule_limit_reached`, `federation_issuer_archived` y `service_account_archived`; un emisor, un
72
+ * workspace o una cuenta de destino que no son de la organización son `404` con su código.
73
+ */
74
+ create(params, options) {
75
+ return platformRequest(this.client, "post", "/v1/oma/federation_rules", {
76
+ ...options,
77
+ body: params,
78
+ });
79
+ }
80
+ retrieve(id, options) {
81
+ return platformRequest(this.client, "get", `/v1/oma/federation_rules/${encodeURIComponent(id)}`, options);
82
+ }
83
+ /**
84
+ * Archiva la regla (`POST /v1/oma/federation_rules/:id/archive`); la ruta no es un `DELETE`. Es idempotente y
85
+ * libera el `resource_in_use` de su cuenta y de su emisor. Un id inexistente o de otra organización es el `404`
86
+ * `federation_rule_not_found`.
87
+ */
88
+ archive(id, options) {
89
+ return platformRequest(this.client, "post", `/v1/oma/federation_rules/${encodeURIComponent(id)}/archive`, options);
90
+ }
91
+ }
92
+ /** El namespace `federation` de `client.platform`: los emisores y las reglas. */
93
+ export class FederationResource {
94
+ issuers;
95
+ rules;
96
+ constructor(client) {
97
+ this.issuers = new FederationIssuersResource(client);
98
+ this.rules = new FederationRulesResource(client);
99
+ }
100
+ }
@@ -6,6 +6,16 @@ export interface PlatformRequestOptions extends Omit<RequestOptions, "body" | "q
6
6
  body?: unknown;
7
7
  query?: object | null;
8
8
  }
9
+ /**
10
+ * La query de un `list` de platform tal como va al wire: el contrato declara `include_archived` como `"true"` |
11
+ * `"false"`, pero la superficie del SDK lo acepta booleano, así que acá se serializa. El resto de la query pasa tal
12
+ * cual; sin query, `undefined`.
13
+ */
14
+ export declare function serializeListQuery<Query extends {
15
+ include_archived?: boolean;
16
+ }>(query: Query | undefined): (Omit<Query, "include_archived"> & {
17
+ include_archived?: "true" | "false";
18
+ }) | undefined;
9
19
  /**
10
20
  * La política de reintentos de las rutas de platform: un `POST` no se reintenta salvo que el llamador pida
11
21
  * `maxRetries`. Las rutas de `client.platform` y las extensiones de `/v1/oma` (evals, modelos, `platform.request`) no
@@ -28,6 +38,10 @@ export declare function withHeaders(options: RequestOptions | undefined, additio
28
38
  * Suma el `anthropic-beta` de la ruta a los headers que pase el llamador **concatenando**: si el llamador ya trae
29
39
  * `anthropic-beta`, agrega `beta` a la lista separada por comas cuando falta; si no la trae, la pone sola. El servidor
30
40
  * lee la cabecera como un conjunto, así un beta del llamador convive con el de la ruta.
41
+ *
42
+ * **El límite del SDK base:** la concatenación solo cubre el `anthropic-beta` que venga en `options.headers`. Uno que
43
+ * venga en `defaultHeaders` del cliente lo pisa el de la petición, porque el cliente arma la cabecera con los headers
44
+ * de la llamada; para sumar un beta del cliente hay que pasarlo en `options.headers`.
31
45
  */
32
46
  export declare function withBeta(beta: string, options?: RequestOptions): RequestOptions;
33
47
  export {};
@@ -1,5 +1,18 @@
1
1
  import { APIError } from "@anthropic-ai/sdk";
2
2
  import { PlatformApiError } from "./errors.js";
3
+ /**
4
+ * La query de un `list` de platform tal como va al wire: el contrato declara `include_archived` como `"true"` |
5
+ * `"false"`, pero la superficie del SDK lo acepta booleano, así que acá se serializa. El resto de la query pasa tal
6
+ * cual; sin query, `undefined`.
7
+ */
8
+ export function serializeListQuery(query) {
9
+ if (query === undefined)
10
+ return undefined;
11
+ const { include_archived, ...rest } = query;
12
+ if (include_archived === undefined)
13
+ return rest;
14
+ return { ...rest, include_archived: include_archived ? "true" : "false" };
15
+ }
3
16
  /**
4
17
  * La política de reintentos de las rutas de platform: un `POST` no se reintenta salvo que el llamador pida
5
18
  * `maxRetries`. Las rutas de `client.platform` y las extensiones de `/v1/oma` (evals, modelos, `platform.request`) no
@@ -61,6 +74,10 @@ export function withHeaders(options, additions) {
61
74
  * Suma el `anthropic-beta` de la ruta a los headers que pase el llamador **concatenando**: si el llamador ya trae
62
75
  * `anthropic-beta`, agrega `beta` a la lista separada por comas cuando falta; si no la trae, la pone sola. El servidor
63
76
  * lee la cabecera como un conjunto, así un beta del llamador convive con el de la ruta.
77
+ *
78
+ * **El límite del SDK base:** la concatenación solo cubre el `anthropic-beta` que venga en `options.headers`. Uno que
79
+ * venga en `defaultHeaders` del cliente lo pisa el de la petición, porque el cliente arma la cabecera con los headers
80
+ * de la llamada; para sumar un beta del cliente hay que pasarlo en `options.headers`.
64
81
  */
65
82
  export function withBeta(beta, options) {
66
83
  const headers = mergedHeaders(options?.headers);
@@ -0,0 +1,61 @@
1
+ import type Anthropic from "@anthropic-ai/sdk";
2
+ type RequestOptions = Anthropic.RequestOptions;
3
+ import type { operations } from "../generated/openapi.js";
4
+ import { type PlatformRequestOptions } from "./http.js";
5
+ import type { JsonContent } from "./types.js";
6
+ type ServiceAccountsResponse = JsonContent<operations["getV1OmaServiceAccounts"]["responses"][200]>;
7
+ /** Una página de cuentas de servicio (`GET /v1/oma/service_accounts`), con `has_more` y `next_page`. */
8
+ export type PlatformServiceAccountsPage = ServiceAccountsResponse;
9
+ /** Una cuenta de servicio tal como la devuelve el contrato: su rol de organización y su archivo opcional. */
10
+ export type PlatformServiceAccount = ServiceAccountsResponse["data"][number];
11
+ type ServiceAccountCreateBody = JsonContent<operations["postV1OmaServiceAccounts"]["requestBody"]>;
12
+ /** El cuerpo de crear una cuenta de servicio: el nombre y `developer` o `admin`. */
13
+ export type PlatformServiceAccountCreateParams = ServiceAccountCreateBody;
14
+ /**
15
+ * La cuenta de servicio que devuelven el detalle, el archivo y el alta (`GET /v1/oma/service_accounts/{id}`): el tipo
16
+ * neutral del recurso, no el del alta en particular.
17
+ */
18
+ export type PlatformServiceAccountResponse = JsonContent<operations["getV1OmaServiceAccountsId"]["responses"][200]>;
19
+ /** El alta devuelve la misma forma; el alias nombra la respuesta de `create`. */
20
+ export type PlatformServiceAccountCreateResponse = PlatformServiceAccountResponse;
21
+ /** La query de `list` tal como la declara el contrato (`limit`, `page`, `include_archived`). */
22
+ type ServiceAccountsListQuery = NonNullable<operations["getV1OmaServiceAccounts"]["parameters"]["query"]>;
23
+ /**
24
+ * Las opciones de `list`: las del cliente oficial más la query del contrato, con `include_archived` como booleano (el
25
+ * SDK lo manda al wire como `"true"`/`"false"`).
26
+ */
27
+ export type PlatformServiceAccountsListParams = Omit<PlatformRequestOptions, "body" | "query"> & {
28
+ query?: Omit<ServiceAccountsListQuery, "include_archived"> & {
29
+ include_archived?: boolean;
30
+ };
31
+ };
32
+ /**
33
+ * `/v1/oma/service_accounts`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
34
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
35
+ */
36
+ export declare class ServiceAccountsResource {
37
+ private readonly client;
38
+ constructor(client: Anthropic);
39
+ /**
40
+ * Lista las cuentas (`GET /v1/oma/service_accounts`). La query es la del contrato: `limit` (de 1 a 100), `page` (el
41
+ * `next_page` de la página anterior) e `include_archived` (booleano; al wire va como `"true"`/`"false"`).
42
+ */
43
+ list(params?: PlatformServiceAccountsListParams): Promise<PlatformServiceAccountsPage>;
44
+ /**
45
+ * Crea una cuenta de servicio (`POST /v1/oma/service_accounts`). Es una escritura de gestión: pide la credencial de
46
+ * una persona, así que una clave de service account, una clave sin principal o un token federado reciben `403` con
47
+ * `errorCode: "admin_required"` aunque tengan el alcance (una identidad no humana no fabrica otras). Los `400` del
48
+ * contrato también traen el código en `errorCode`: `invalid_name` (nombre inválido o repetido) y
49
+ * `service_account_limit_reached` (la organización llegó a su tope).
50
+ */
51
+ create(params: PlatformServiceAccountCreateParams, options?: RequestOptions): Promise<PlatformServiceAccountCreateResponse>;
52
+ retrieve(id: string, options?: RequestOptions): Promise<PlatformServiceAccountResponse>;
53
+ /**
54
+ * Archiva la cuenta (`POST /v1/oma/service_accounts/:id/archive`); la ruta no es un `DELETE`. Es idempotente:
55
+ * archivar una cuenta ya archivada devuelve la misma cuenta. Un `400` con `errorCode: "resource_in_use"` avisa que
56
+ * hay reglas de federación que la usan como destino: hay que archivarlas primero. Un id inexistente o de otra
57
+ * organización es el `404` `service_account_not_found` (también si no tiene la forma `svac_<uuid>`).
58
+ */
59
+ archive(id: string, options?: RequestOptions): Promise<PlatformServiceAccountResponse>;
60
+ }
61
+ export {};
@@ -0,0 +1,47 @@
1
+ import { platformRequest, serializeListQuery } from "./http.js";
2
+ /**
3
+ * `/v1/oma/service_accounts`: las cuatro operaciones que la guía enseña — `list`, `create`, `retrieve` y `archive`.
4
+ * Los `POST` no se reintentan (`withRetryPolicy`) y los errores salen como `PlatformApiError`.
5
+ */
6
+ export class ServiceAccountsResource {
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * Lista las cuentas (`GET /v1/oma/service_accounts`). La query es la del contrato: `limit` (de 1 a 100), `page` (el
13
+ * `next_page` de la página anterior) e `include_archived` (booleano; al wire va como `"true"`/`"false"`).
14
+ */
15
+ list(params = {}) {
16
+ const { query, ...options } = params;
17
+ return platformRequest(this.client, "get", "/v1/oma/service_accounts", {
18
+ ...options,
19
+ query: serializeListQuery(query),
20
+ });
21
+ }
22
+ /**
23
+ * Crea una cuenta de servicio (`POST /v1/oma/service_accounts`). Es una escritura de gestión: pide la credencial de
24
+ * una persona, así que una clave de service account, una clave sin principal o un token federado reciben `403` con
25
+ * `errorCode: "admin_required"` aunque tengan el alcance (una identidad no humana no fabrica otras). Los `400` del
26
+ * contrato también traen el código en `errorCode`: `invalid_name` (nombre inválido o repetido) y
27
+ * `service_account_limit_reached` (la organización llegó a su tope).
28
+ */
29
+ create(params, options) {
30
+ return platformRequest(this.client, "post", "/v1/oma/service_accounts", {
31
+ ...options,
32
+ body: params,
33
+ });
34
+ }
35
+ retrieve(id, options) {
36
+ return platformRequest(this.client, "get", `/v1/oma/service_accounts/${encodeURIComponent(id)}`, options);
37
+ }
38
+ /**
39
+ * Archiva la cuenta (`POST /v1/oma/service_accounts/:id/archive`); la ruta no es un `DELETE`. Es idempotente:
40
+ * archivar una cuenta ya archivada devuelve la misma cuenta. Un `400` con `errorCode: "resource_in_use"` avisa que
41
+ * hay reglas de federación que la usan como destino: hay que archivarlas primero. Un id inexistente o de otra
42
+ * organización es el `404` `service_account_not_found` (también si no tiene la forma `svac_<uuid>`).
43
+ */
44
+ archive(id, options) {
45
+ return platformRequest(this.client, "post", `/v1/oma/service_accounts/${encodeURIComponent(id)}/archive`, options);
46
+ }
47
+ }
@@ -0,0 +1,63 @@
1
+ import type Anthropic from "@anthropic-ai/sdk";
2
+ type RequestOptions = Anthropic.RequestOptions;
3
+ import type { operations } from "../generated/openapi.js";
4
+ import type { JsonContent } from "./types.js";
5
+ /** El beta que exige toda la familia `/v1/skills` (`requireBeta(SKILLS_API_BETA)` en el servidor). */
6
+ export declare const SKILLS_BETA = "skills-2025-10-02";
7
+ type SkillListResponse = JsonContent<operations["getV1Skills"]["responses"][200]>;
8
+ type SkillCreateResponse = JsonContent<operations["postV1Skills"]["responses"][200]>;
9
+ type SkillVersionCreateResponse = JsonContent<operations["postV1SkillsSkillIdVersions"]["responses"][200]>;
10
+ /** Una skill de la lista del contrato (forma no beta: `display_name`, `latest_version_id`, `source.type`). */
11
+ export type PlatformSkill = SkillListResponse["data"][number];
12
+ /** La página de `GET /v1/skills`: `{ data, next_page }`. */
13
+ export type PlatformSkillListPage = SkillListResponse;
14
+ /** El alta de `POST /v1/skills`. */
15
+ export type PlatformSkillCreateResponse = SkillCreateResponse;
16
+ /** La versión nueva de `POST /v1/skills/{skillId}/versions`. */
17
+ export type PlatformSkillVersionCreateResponse = SkillVersionCreateResponse;
18
+ /** Un archivo del paquete: su ruta relativa POSIX y sus bytes. */
19
+ export interface PlatformSkillFile {
20
+ path: string;
21
+ content: Uint8Array;
22
+ }
23
+ /** Los archivos de un alta o de una versión; el multipart va sin `display_name`. */
24
+ export interface PlatformSkillFilesParams {
25
+ files: PlatformSkillFile[];
26
+ }
27
+ export type PlatformSkillCreateParams = PlatformSkillFilesParams;
28
+ export type PlatformSkillVersionCreateParams = PlatformSkillFilesParams;
29
+ export interface PlatformSkillListParams {
30
+ source?: string;
31
+ limit?: number;
32
+ page?: string;
33
+ }
34
+ /**
35
+ * Las versiones de una skill: `POST /v1/skills/{skillId}/versions` y la descarga del contenido.
36
+ *
37
+ * El SDK oficial 1.13.0 no tiene `content` en `client.skills.versions`; el binario solo existe como
38
+ * `client.beta.skills.versions.download`, que devuelve el `Response` crudo. El método público sigue siendo `content`.
39
+ */
40
+ export declare class SkillVersionsResource {
41
+ private readonly client;
42
+ constructor(client: Anthropic);
43
+ create(skillId: string, params: PlatformSkillVersionCreateParams, options?: RequestOptions): Promise<PlatformSkillVersionCreateResponse>;
44
+ /**
45
+ * Baja el contenido de una versión como el `Response` crudo del `fetch`, no como texto.
46
+ *
47
+ * **Leé o cancelá `body`**: `await response.arrayBuffer()`, `await response.text()` o
48
+ * `await response.body?.cancel()`; si no, la conexión queda tomada. Un no-`2xx` rechaza con `PlatformApiError`.
49
+ */
50
+ content(skillId: string, version: string, options?: RequestOptions): Promise<Response>;
51
+ }
52
+ /**
53
+ * `client.platform.skills`: la lista, el alta y las versiones de `/v1/skills`, delegando en `client.skills.*` del
54
+ * SDK oficial. Todas las llamadas mandan `anthropic-beta: skills-2025-10-02` y los `POST` van sin reintentos.
55
+ */
56
+ export declare class SkillsResource {
57
+ private readonly client;
58
+ readonly versions: SkillVersionsResource;
59
+ constructor(client: Anthropic);
60
+ list(params?: PlatformSkillListParams, options?: RequestOptions): Promise<PlatformSkillListPage>;
61
+ create(params: PlatformSkillCreateParams, options?: RequestOptions): Promise<PlatformSkillCreateResponse>;
62
+ }
63
+ export {};