@eigenpal/sdk 0.20.98 → 0.20.99

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @eigenpal/sdk
2
2
 
3
+ ## 0.20.99
4
+
5
+ ### Minor Changes
6
+
7
+ - 996d1ef: Run responses expose structured errors with a machine-readable code, message,
8
+ retryability, and the configured business status code and step for workflow
9
+ rejections. Update consumers of the previous string error to read error.message.
10
+ HTTP success remains independent of the processing outcome.
11
+
3
12
  ## 0.20.91
4
13
 
5
14
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/sdk",
3
- "version": "0.20.98",
3
+ "version": "0.20.99",
4
4
  "description": "Official TypeScript SDK for the EigenPal API",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1020,7 +1020,7 @@ export const runsList = <ThrowOnError extends boolean = false>(options?: Options
1020
1020
  *
1021
1021
  * Start a run. Send JSON or multipart/form-data.
1022
1022
  *
1023
- * How to read a run: the envelope is at the root. The automation business result is in `output` (per-automation, not this generic schema). Status is `execution.status` (`execution.retry.nextRun.status` is a later retry). `input`, `usage`, and `debug` appear only with `?expand=`. `eval` is present only on eval-scoped runs.
1023
+ * How to read a run: the envelope is at the root. The automation business result is in `output` (per-automation, not this generic schema). HTTP 200 can report a failed run. Inspect `execution.status` and the structured `error` (`code`, `message`, `retryable`, and optional business `statusCode` and `step`). Status is `execution.status` (`execution.retry.nextRun.status` is a later retry). `input`, `usage`, and `debug` appear only with `?expand=`. `eval` is present only on eval-scoped runs.
1024
1024
  */
1025
1025
  export const runsStart = <ThrowOnError extends boolean = false>(options: Options<RunsStartData, ThrowOnError>): RequestResult<RunsStartResponses, RunsStartErrors, ThrowOnError> => (options.client ?? client).post<RunsStartResponses, RunsStartErrors, ThrowOnError>({
1026
1026
  security: [{ scheme: 'bearer', type: 'http' }],
@@ -1037,7 +1037,7 @@ export const runsStart = <ThrowOnError extends boolean = false>(options: Options
1037
1037
  *
1038
1038
  * Fetch one run by id. By default this returns core metadata plus terminal output/error fields. Pass `?expand=input,usage,execution,debug` to include detailed sub-objects; `expand=execution` is also where embedded review and expected artifacts appear.
1039
1039
  *
1040
- * How to read a run: the envelope is at the root. The automation business result is in `output` (per-automation, not this generic schema). Status is `execution.status` (`execution.retry.nextRun.status` is a later retry). `input`, `usage`, and `debug` appear only with `?expand=`. `eval` is present only on eval-scoped runs.
1040
+ * How to read a run: the envelope is at the root. The automation business result is in `output` (per-automation, not this generic schema). HTTP 200 can report a failed run. Inspect `execution.status` and the structured `error` (`code`, `message`, `retryable`, and optional business `statusCode` and `step`). Status is `execution.status` (`execution.retry.nextRun.status` is a later retry). `input`, `usage`, and `debug` appear only with `?expand=`. `eval` is present only on eval-scoped runs.
1041
1041
  */
1042
1042
  export const runsGet = <ThrowOnError extends boolean = false>(options: Options<RunsGetData, ThrowOnError>): RequestResult<RunsGetResponses, RunsGetErrors, ThrowOnError> => (options.client ?? client).get<RunsGetResponses, RunsGetErrors, ThrowOnError>({
1043
1043
  security: [{ scheme: 'bearer', type: 'http' }],
@@ -1873,9 +1873,9 @@ export type RunListItem = {
1873
1873
  */
1874
1874
  eval?: RunEval;
1875
1875
  /**
1876
- * Terminal failure message. Present on terminal runs; null when the run succeeded. Absent while the run is still in flight.
1876
+ * Structured processing failure, independent of the HTTP response status. Includes control.fail statusCode and step when known. Present on terminal runs; null when no error is recorded. Absent while in flight.
1877
1877
  */
1878
- error?: RunError;
1878
+ error?: RunError | null;
1879
1879
  execution: RunExecutionMeta;
1880
1880
  };
1881
1881
 
@@ -1963,7 +1963,28 @@ export type RunEval = {
1963
1963
  passed: boolean | null;
1964
1964
  };
1965
1965
 
1966
- export type RunError = string | null;
1966
+ export type RunError = {
1967
+ /**
1968
+ * Machine-readable failure code. Do not branch on message text.
1969
+ */
1970
+ code: string;
1971
+ /**
1972
+ * Human-readable failure explanation.
1973
+ */
1974
+ message: string;
1975
+ /**
1976
+ * HTTP-style business code configured by control.fail, not the API response status. Absent for untyped failures.
1977
+ */
1978
+ statusCode?: number;
1979
+ /**
1980
+ * Name of the control.fail step that rejected the run, when known.
1981
+ */
1982
+ step?: string;
1983
+ /**
1984
+ * Whether another attempt might succeed. Does not schedule a retry.
1985
+ */
1986
+ retryable: boolean;
1987
+ };
1967
1988
 
1968
1989
  export type RunExecutionMeta = {
1969
1990
  /**
@@ -2066,9 +2087,9 @@ export type Run = {
2066
2087
  */
2067
2088
  files?: Array<RunArtifact>;
2068
2089
  /**
2069
- * Terminal failure message. Present on terminal runs; null when the run succeeded. Absent while the run is still in flight.
2090
+ * Structured processing failure, independent of the HTTP response status. Includes control.fail statusCode and step when known. Present on terminal runs; null when no error is recorded. Absent while in flight.
2070
2091
  */
2071
- error?: RunError;
2092
+ error?: RunError | null;
2072
2093
  /**
2073
2094
  * Present only with `expand=input`.
2074
2095
  */
@@ -7583,6 +7604,10 @@ export type RunsStartErrors = {
7583
7604
  * Resource not found
7584
7605
  */
7585
7606
  404: ApiErrorEnvelope;
7607
+ /**
7608
+ * Organization deletion is in progress (organization_deleting), or an inline subworkflow target is unavailable (inline_invoke_target_unavailable). No run was started.
7609
+ */
7610
+ 409: ApiErrorEnvelope;
7586
7611
  /**
7587
7612
  * Payload too large. Upload exceeded the per-request size cap.
7588
7613
  */
@@ -7605,7 +7630,7 @@ export type RunsStartError = RunsStartErrors[keyof RunsStartErrors];
7605
7630
 
7606
7631
  export type RunsStartResponses = {
7607
7632
  /**
7608
- * Run completed while waiting — same body as GET /api/v1/runs/:id
7633
+ * Run reached a terminal status while waiting, including failure. Inspect execution.status. Same body as GET /api/v1/runs/:id
7609
7634
  */
7610
7635
  200: Run;
7611
7636
  /**
@@ -8013,6 +8038,10 @@ export type RunsRerunErrors = {
8013
8038
  * Missing or invalid API key
8014
8039
  */
8015
8040
  401: ApiErrorEnvelope;
8041
+ /**
8042
+ * Credit quota exceeded. The organization has spent its allowance; nothing was processed.
8043
+ */
8044
+ 402: ApiErrorEnvelope;
8016
8045
  /**
8017
8046
  * API key lacks required scope
8018
8047
  */
@@ -8021,6 +8050,10 @@ export type RunsRerunErrors = {
8021
8050
  * Resource not found
8022
8051
  */
8023
8052
  404: ApiErrorEnvelope;
8053
+ /**
8054
+ * Conflict. The resource is in a state that forbids the request.
8055
+ */
8056
+ 409: ApiErrorEnvelope;
8024
8057
  /**
8025
8058
  * Payload too large. Upload exceeded the per-request size cap.
8026
8059
  */
@@ -8043,7 +8076,7 @@ export type RunsRerunError = RunsRerunErrors[keyof RunsRerunErrors];
8043
8076
 
8044
8077
  export type RunsRerunResponses = {
8045
8078
  /**
8046
- * Rerun completed while waiting
8079
+ * Rerun reached a terminal status while waiting, including failure. Inspect execution.status.
8047
8080
  */
8048
8081
  200: Run;
8049
8082
  /**
package/src/index.ts CHANGED
@@ -88,6 +88,7 @@ export type {
88
88
  RunAccepted,
89
89
  RunArtifact,
90
90
  RunArtifactsResponse,
91
+ RunError,
91
92
  RunEvent,
92
93
  RunEventsResponse,
93
94
  RunListItem,
package/src/telemetry.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  export const SDK_LANGUAGE = 'typescript';
20
20
  // Rewritten at publish time by scripts/release/platform/render-sdk-versions.sh.
21
21
  // Keep this string literal exactly stable — sed matches on it.
22
- export const SDK_VERSION = '0.20.98';
22
+ export const SDK_VERSION = '0.20.99';
23
23
 
24
24
  function detectRuntime(): string {
25
25
  const g = globalThis as unknown as {