@personaai/runtime 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -44,15 +44,20 @@ world — see `RunContext`/the design notes below for why this boundary is absol
44
44
  ## Quickstart (raw Node `http`, no framework adapter yet)
45
45
 
46
46
  There's no published `@personaai/node` adapter package yet, so this release ships a small,
47
- tested bridge in `examples/` for running the runtime directly against Node's `http` module —
48
- **not itself a published entry point**, just enough to demo/smoke-test the runtime end to end
49
- until `@personaai/node` ships. It parses multipart file uploads too, via Node's native
50
- `Request`/`FormData` (undici) — no extra dependency:
47
+ tested bridge at [`examples/node-handler.ts`](./examples/node-handler.ts) in this repo for
48
+ running the runtime directly against Node's `http` module, just enough to demo/smoke-test the
49
+ runtime end to end until `@personaai/node` ships. It parses multipart file uploads too, via
50
+ Node's native `Request`/`FormData` (undici) — no extra dependency.
51
+
52
+ **This file is not published to npm and has no `exports` entry** (`package.json`'s `files` only
53
+ ships `dist/`, and `exports` only maps `.`) — `import ... from '@personaai/runtime/examples/...'`
54
+ fails with `ERR_PACKAGE_PATH_NOT_EXPORTED` after a real `npm install`. Copy the file into your own
55
+ project instead (it's plain TypeScript with no runtime-internal dependencies):
51
56
 
52
57
  ```ts
53
58
  import { createServer } from 'node:http';
54
59
  import { createRuntime } from '@personaai/runtime';
55
- import { toNodeHandler } from '@personaai/runtime/examples/node-handler.js'; // not a stable public API
60
+ import { toNodeHandler } from './node-handler.js'; // copied from this repo's examples/ — not importable from the published package, see note below
56
61
 
57
62
  const runtime = createRuntime({
58
63
  baseUrl: process.env.PERSONA_BASE_URL!,
package/dist/index.cjs CHANGED
@@ -154,7 +154,7 @@ function evictStaleRuns(runs, now, graceMs = DEFAULT_RUN_GRACE_MS, maxTracked =
154
154
  }
155
155
 
156
156
  // src/version.ts
157
- var RUNTIME_VERSION = "0.5.0";
157
+ var RUNTIME_VERSION = "0.5.1";
158
158
 
159
159
  // src/routes/health.ts
160
160
  var alwaysOnCapabilities = {
@@ -322,7 +322,10 @@ var RunDriver = class {
322
322
  interrupted: acc.interrupted,
323
323
  erroredInBand: acc.erroredInBand
324
324
  };
325
- await hooks?.afterRun?.(this.runCtx, result);
325
+ try {
326
+ await hooks?.afterRun?.(this.runCtx, result);
327
+ } catch {
328
+ }
326
329
  } catch (err) {
327
330
  await hooks?.onError?.(
328
331
  {
@@ -1396,7 +1399,8 @@ function createRuntime(options) {
1396
1399
  let userId = null;
1397
1400
  if (match.route.requiresAuth !== false) {
1398
1401
  try {
1399
- userId = await options.resolveUser(request);
1402
+ const resolved = await options.resolveUser(request);
1403
+ userId = typeof resolved === "string" && resolved.length > 0 ? resolved : null;
1400
1404
  } catch {
1401
1405
  userId = null;
1402
1406
  }