@personaai/runtime 0.16.0 → 0.16.2

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.cts CHANGED
@@ -337,6 +337,6 @@ declare class RuntimeHttpError extends Error {
337
337
  constructor(status: number, code: string, message: string);
338
338
  }
339
339
 
340
- declare const RUNTIME_VERSION = "0.16.0";
340
+ declare const RUNTIME_VERSION = "0.16.1";
341
341
 
342
342
  export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type RcpManifestOptions, type ResolveUser, type RestToolManifestEntry, type RestToolsManifestOptions, type RunContext, type RunResult, type Runtime, type RuntimeBinaryResponse, type RuntimeBufferedResponse, type RuntimeCapabilities, type RuntimeHooks, RuntimeHttpError, type RuntimeMethod, type RuntimeRequest, type RuntimeResponse, type RuntimeStreamResponse, type RuntimeUploadedFile, type ThreadCreateContext, type ToolCallContext, type VoiceSessionCreateContext, type WorkflowNodeContext, createRuntime };
package/dist/index.d.ts CHANGED
@@ -337,6 +337,6 @@ declare class RuntimeHttpError extends Error {
337
337
  constructor(status: number, code: string, message: string);
338
338
  }
339
339
 
340
- declare const RUNTIME_VERSION = "0.16.0";
340
+ declare const RUNTIME_VERSION = "0.16.1";
341
341
 
342
342
  export { type CreateRuntimeOptions, type ErrorContext, type FileUploadContext, type MemoryWriteContext, RUNTIME_VERSION, type RcpManifestOptions, type ResolveUser, type RestToolManifestEntry, type RestToolsManifestOptions, type RunContext, type RunResult, type Runtime, type RuntimeBinaryResponse, type RuntimeBufferedResponse, type RuntimeCapabilities, type RuntimeHooks, RuntimeHttpError, type RuntimeMethod, type RuntimeRequest, type RuntimeResponse, type RuntimeStreamResponse, type RuntimeUploadedFile, type ThreadCreateContext, type ToolCallContext, type VoiceSessionCreateContext, type WorkflowNodeContext, createRuntime };
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ function errorToResponse(err, mode) {
108
108
  }
109
109
 
110
110
  // src/runtime.ts
111
- import { createLogger } from "@personaai/sdk";
111
+ import { createLogger, PersonaApiError as PersonaApiError2 } from "@personaai/sdk";
112
112
 
113
113
  // src/runRegistry.ts
114
114
  var DEFAULT_RUN_GRACE_MS = 5 * 60 * 1e3;
@@ -131,7 +131,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
131
131
  }
132
132
 
133
133
  // src/version.ts
134
- var RUNTIME_VERSION = "0.16.0";
134
+ var RUNTIME_VERSION = "0.16.1";
135
135
 
136
136
  // src/routes/health.ts
137
137
  var alwaysOnCapabilities = {
@@ -1882,7 +1882,11 @@ function buildRoutes(capabilities) {
1882
1882
  { method: "PUT", pattern: ["workflows", ":id", "draft"], handler: saveWorkflowDraft },
1883
1883
  { method: "POST", pattern: ["workflows", ":id", "publish"], handler: publishWorkflow },
1884
1884
  { method: "GET", pattern: ["workflows", ":id", "versions"], handler: listWorkflowVersions },
1885
- { method: "GET", pattern: ["workflows", ":id", "versions", ":version"], handler: getWorkflowVersion },
1885
+ {
1886
+ method: "GET",
1887
+ pattern: ["workflows", ":id", "versions", ":version"],
1888
+ handler: getWorkflowVersion
1889
+ },
1886
1890
  { method: "GET", pattern: ["workflows", ":id", "mermaid"], handler: getWorkflowMermaid },
1887
1891
  { method: "GET", pattern: ["workflows", ":id", "runs"], handler: listWorkflowRuns },
1888
1892
  { method: "GET", pattern: ["workflows", "runs", ":runId"], handler: getWorkflowRun }
@@ -2116,17 +2120,19 @@ function createRuntime(options) {
2116
2120
  } catch (err) {
2117
2121
  const durationMs = Date.now() - startMs;
2118
2122
  const isHttpError = err instanceof RuntimeHttpError;
2123
+ const isApiError = !isHttpError && err instanceof PersonaApiError2;
2124
+ const failureStatus = isHttpError ? err.status : isApiError ? err.statusCode : void 0;
2119
2125
  const meta = {
2120
2126
  method: request.method,
2121
2127
  path: request.path,
2122
2128
  durationMs,
2123
2129
  error: err instanceof Error ? err.message : String(err),
2124
- code: isHttpError ? err.code : void 0,
2125
- status: isHttpError ? err.status : void 0
2130
+ code: isHttpError ? err.code : isApiError ? err.code : void 0,
2131
+ status: failureStatus
2126
2132
  };
2127
- if (isHttpError && err.status >= 500) {
2133
+ if (failureStatus !== void 0 && failureStatus >= 500) {
2128
2134
  logger.error("handle failed \u2014 server error", meta);
2129
- } else if (isHttpError && err.status >= 400) {
2135
+ } else if (failureStatus !== void 0 && failureStatus >= 400) {
2130
2136
  logger.warn("handle failed \u2014 client error", meta);
2131
2137
  } else {
2132
2138
  logger.error("handle failed \u2014 unexpected error", meta);