@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.cjs CHANGED
@@ -159,7 +159,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
159
159
  }
160
160
 
161
161
  // src/version.ts
162
- var RUNTIME_VERSION = "0.16.0";
162
+ var RUNTIME_VERSION = "0.16.1";
163
163
 
164
164
  // src/routes/health.ts
165
165
  var alwaysOnCapabilities = {
@@ -1910,7 +1910,11 @@ function buildRoutes(capabilities) {
1910
1910
  { method: "PUT", pattern: ["workflows", ":id", "draft"], handler: saveWorkflowDraft },
1911
1911
  { method: "POST", pattern: ["workflows", ":id", "publish"], handler: publishWorkflow },
1912
1912
  { method: "GET", pattern: ["workflows", ":id", "versions"], handler: listWorkflowVersions },
1913
- { method: "GET", pattern: ["workflows", ":id", "versions", ":version"], handler: getWorkflowVersion },
1913
+ {
1914
+ method: "GET",
1915
+ pattern: ["workflows", ":id", "versions", ":version"],
1916
+ handler: getWorkflowVersion
1917
+ },
1914
1918
  { method: "GET", pattern: ["workflows", ":id", "mermaid"], handler: getWorkflowMermaid },
1915
1919
  { method: "GET", pattern: ["workflows", ":id", "runs"], handler: listWorkflowRuns },
1916
1920
  { method: "GET", pattern: ["workflows", "runs", ":runId"], handler: getWorkflowRun }
@@ -2144,17 +2148,19 @@ function createRuntime(options) {
2144
2148
  } catch (err) {
2145
2149
  const durationMs = Date.now() - startMs;
2146
2150
  const isHttpError = err instanceof RuntimeHttpError;
2151
+ const isApiError = !isHttpError && err instanceof import_sdk4.PersonaApiError;
2152
+ const failureStatus = isHttpError ? err.status : isApiError ? err.statusCode : void 0;
2147
2153
  const meta = {
2148
2154
  method: request.method,
2149
2155
  path: request.path,
2150
2156
  durationMs,
2151
2157
  error: err instanceof Error ? err.message : String(err),
2152
- code: isHttpError ? err.code : void 0,
2153
- status: isHttpError ? err.status : void 0
2158
+ code: isHttpError ? err.code : isApiError ? err.code : void 0,
2159
+ status: failureStatus
2154
2160
  };
2155
- if (isHttpError && err.status >= 500) {
2161
+ if (failureStatus !== void 0 && failureStatus >= 500) {
2156
2162
  logger.error("handle failed \u2014 server error", meta);
2157
- } else if (isHttpError && err.status >= 400) {
2163
+ } else if (failureStatus !== void 0 && failureStatus >= 400) {
2158
2164
  logger.warn("handle failed \u2014 client error", meta);
2159
2165
  } else {
2160
2166
  logger.error("handle failed \u2014 unexpected error", meta);