@nouter/platform 0.5.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
@@ -13,6 +13,7 @@ export { MeResource, type PlatformMe } from "./platform/me.js";
13
13
  export { ServiceAccountsResource, type PlatformServiceAccount, type PlatformServiceAccountCreateParams, type PlatformServiceAccountCreateResponse, type PlatformServiceAccountResponse, type PlatformServiceAccountsListParams, type PlatformServiceAccountsPage, } from "./platform/service-accounts.js";
14
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";
15
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";
16
17
  import type { PlatformBeta } from "./agents.js";
17
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";
18
19
  export type { PlatformEnvironment, PlatformEnvironmentCreateParams, PlatformEnvironmentUpdateParams, PlatformEnvironments, PlatformNoneEnvironmentConfig, } from "./environments.js";
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ export { MeResource } from "./platform/me.js";
14
14
  export { ServiceAccountsResource, } from "./platform/service-accounts.js";
15
15
  export { FederationResource, FederationIssuersResource, FederationRulesResource, } from "./platform/federation.js";
16
16
  export { SessionsResource, SessionOutputsResource, } from "./platform/sessions.js";
17
+ export { SkillsResource, SkillVersionsResource, SKILLS_BETA, } from "./platform/skills.js";
17
18
  export { PlatformModelsResource, PlatformModelCardsResource, PlatformHarnessesResource, PlatformResources, } from "./oma.js";
18
19
  export { EvalsResource, EvalBenchmarksResource, EvalCasesResource, EvalRunsResource, EVAL_RUN_TERMINAL_STATUSES, } from "./evals.js";
19
20
  export { Anthropic };
package/dist/oma.d.ts CHANGED
@@ -13,6 +13,7 @@ import { MeResource } from "./platform/me.js";
13
13
  import { ServiceAccountsResource } from "./platform/service-accounts.js";
14
14
  import { FederationResource } from "./platform/federation.js";
15
15
  import { SessionsResource } from "./platform/sessions.js";
16
+ import { SkillsResource } from "./platform/skills.js";
16
17
  export { PlatformModelCardsResource };
17
18
  export type { PlatformModelCard, PlatformModelCardCreateParams, PlatformModelCardCreateResponse, PlatformModelCardDeleted, PlatformModelCardListParams, PlatformModelCardListResponse, PlatformModelCardUpdateParams, } from "./platform/model-cards.js";
18
19
  /** Pi provider id. Built-ins and user-defined ids share this open shape. */
@@ -130,6 +131,8 @@ export declare class PlatformResources {
130
131
  readonly federation: FederationResource;
131
132
  /** Los outputs de una sesión; la ruta es `/v1/sessions/*`, no `/v1/oma/*`. */
132
133
  readonly sessions: SessionsResource;
134
+ /** Las skills custom de `/v1/skills`: la lista, el alta y las versiones. */
135
+ readonly skills: SkillsResource;
133
136
  constructor(client: Anthropic);
134
137
  request<Response>(params: PlatformRequestParams): import("@anthropic-ai/sdk").APIPromise<Response>;
135
138
  }
package/dist/oma.js CHANGED
@@ -12,6 +12,7 @@ import { MeResource } from "./platform/me.js";
12
12
  import { ServiceAccountsResource } from "./platform/service-accounts.js";
13
13
  import { FederationResource } from "./platform/federation.js";
14
14
  import { SessionsResource } from "./platform/sessions.js";
15
+ import { SkillsResource } from "./platform/skills.js";
15
16
  import { withRetryPolicy } from "./platform/http.js";
16
17
  export { PlatformModelCardsResource };
17
18
  export class PlatformHarnessesResource {
@@ -59,6 +60,8 @@ export class PlatformResources {
59
60
  federation;
60
61
  /** Los outputs de una sesión; la ruta es `/v1/sessions/*`, no `/v1/oma/*`. */
61
62
  sessions;
63
+ /** Las skills custom de `/v1/skills`: la lista, el alta y las versiones. */
64
+ skills;
62
65
  constructor(client) {
63
66
  this.client = client;
64
67
  this.models = new PlatformModelsResource(client);
@@ -77,6 +80,7 @@ export class PlatformResources {
77
80
  this.serviceAccounts = new ServiceAccountsResource(client);
78
81
  this.federation = new FederationResource(client);
79
82
  this.sessions = new SessionsResource(client);
83
+ this.skills = new SkillsResource(client);
80
84
  }
81
85
  request(params) {
82
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,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 {};
@@ -0,0 +1,76 @@
1
+ import { APIError, toFile } from "@anthropic-ai/sdk";
2
+ import { PlatformApiError } from "./errors.js";
3
+ import { withBeta, withRetryPolicy } from "./http.js";
4
+ /** El beta que exige toda la familia `/v1/skills` (`requireBeta(SKILLS_API_BETA)` en el servidor). */
5
+ export const SKILLS_BETA = "skills-2025-10-02";
6
+ /**
7
+ * Traduce el `APIError` del SDK oficial al error de `platform`. El recurso oficial de skills no pasa por
8
+ * `platformRequest`, así que cada método envuelve su promesa con esto.
9
+ */
10
+ async function translated(call) {
11
+ try {
12
+ return await call;
13
+ }
14
+ catch (error) {
15
+ if (error instanceof APIError)
16
+ throw PlatformApiError.fromAPIError(error);
17
+ throw error;
18
+ }
19
+ }
20
+ /** Cada archivo como `File` con su ruta relativa como nombre: es lo que el multipart manda en `filename`. */
21
+ function uploadables(files) {
22
+ return Promise.all(files.map((file) => toFile(file.content, file.path)));
23
+ }
24
+ /**
25
+ * Las versiones de una skill: `POST /v1/skills/{skillId}/versions` y la descarga del contenido.
26
+ *
27
+ * El SDK oficial 1.13.0 no tiene `content` en `client.skills.versions`; el binario solo existe como
28
+ * `client.beta.skills.versions.download`, que devuelve el `Response` crudo. El método público sigue siendo `content`.
29
+ */
30
+ export class SkillVersionsResource {
31
+ client;
32
+ constructor(client) {
33
+ this.client = client;
34
+ }
35
+ async create(skillId, params, options) {
36
+ const files = await uploadables(params.files);
37
+ const created = await translated(this.client.skills.versions.create(skillId, { files }, withRetryPolicy("post", withBeta(SKILLS_BETA, options))));
38
+ // El servidor contesta la forma del contrato; el tipo del SDK oficial no es la fuente.
39
+ return created;
40
+ }
41
+ /**
42
+ * Baja el contenido de una versión como el `Response` crudo del `fetch`, no como texto.
43
+ *
44
+ * **Leé o cancelá `body`**: `await response.arrayBuffer()`, `await response.text()` o
45
+ * `await response.body?.cancel()`; si no, la conexión queda tomada. Un no-`2xx` rechaza con `PlatformApiError`.
46
+ */
47
+ content(skillId, version, options) {
48
+ return translated(this.client.beta.skills.versions
49
+ .download(version, { skill_id: skillId }, withBeta(SKILLS_BETA, options))
50
+ .asResponse());
51
+ }
52
+ }
53
+ /**
54
+ * `client.platform.skills`: la lista, el alta y las versiones de `/v1/skills`, delegando en `client.skills.*` del
55
+ * SDK oficial. Todas las llamadas mandan `anthropic-beta: skills-2025-10-02` y los `POST` van sin reintentos.
56
+ */
57
+ export class SkillsResource {
58
+ client;
59
+ versions;
60
+ constructor(client) {
61
+ this.client = client;
62
+ this.versions = new SkillVersionsResource(client);
63
+ }
64
+ async list(params = {}, options) {
65
+ const page = await translated(this.client.skills.list(params, withBeta(SKILLS_BETA, options)));
66
+ // El SDK oficial devuelve un `PageCursor` con `options`, `response` y `body` propios; la superficie de la
67
+ // plataforma expone la página plana del contrato, `{ data, next_page }`. El cast de `data` es por el índice
68
+ // abierto de `source` en el tipo del contrato, que el `Skill` oficial no declara.
69
+ return { data: page.data, next_page: page.next_page };
70
+ }
71
+ async create(params, options) {
72
+ const files = await uploadables(params.files);
73
+ const created = await translated(this.client.skills.create({ files }, withRetryPolicy("post", withBeta(SKILLS_BETA, options))));
74
+ return created;
75
+ }
76
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PLATFORM_SDK_VERSION = "0.5.0";
1
+ export declare const PLATFORM_SDK_VERSION = "0.6.0";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  // (https://github.com/anthropics/anthropic-sdk-typescript/blob/main/src/version.ts, `export const VERSION = '…'`). Se
3
3
  // mantiene acá y no leyendo `package.json` para no meter `node:fs` en un paquete que hoy no depende de ningún builtin.
4
4
  // `test/user-agent.test.ts` falla si esta constante se separa del manifiesto.
5
- export const PLATFORM_SDK_VERSION = "0.5.0";
5
+ export const PLATFORM_SDK_VERSION = "0.6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nouter/platform",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Nouter platform SDK: the official Anthropic Managed Agents client plus typed Nouter platform extensions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,6 +14,7 @@
14
14
  "files": [
15
15
  "dist",
16
16
  "README.md",
17
+ "CHANGELOG.md",
17
18
  "LICENSE",
18
19
  "NOTICE"
19
20
  ],