@danypops/papyrus 0.53.1 → 0.53.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/papyrus",
3
- "version": "0.53.1",
3
+ "version": "0.53.2",
4
4
  "description": "Daemon-backed graph artifacts, evidence-bearing tasks, rules, skills, and native TUI workflows for Pi",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -42,6 +42,10 @@ const TASK_READ_ONLY_OPERATIONS = new Set([
42
42
  "tasks.show",
43
43
  ]);
44
44
 
45
+ /** Matches @danypops/vehicle-server's own STREAMING_IDLE_TIMEOUT_S (daemon.ts) -- see this file's
46
+ * own fetch handler for why Papyrus needs the identical fix applied directly, not inherited. */
47
+ const VEHICLE_INVOKE_IDLE_TIMEOUT_S = 3_600;
48
+
45
49
  /** Start the supervised, long-running Papyrus service. */
46
50
  export async function serveMain(): Promise<void> {
47
51
  const stateDir = daemonStateDir();
@@ -81,7 +85,19 @@ export async function serveMain(): Promise<void> {
81
85
  hostname: DAEMON_HOST,
82
86
  port: 0,
83
87
  fetch: (request, bunServer) => {
84
- if (new URL(request.url).pathname === "/push") return pushChannel.upgrade(request, bunServer) ?? undefined;
88
+ const pathname = new URL(request.url).pathname;
89
+ if (pathname === "/push") return pushChannel.upgrade(request, bunServer) ?? undefined;
90
+ // Bun.serve's own idleTimeout defaults to 10s and applies per-connection regardless of
91
+ // how long a given request is expected to take -- @danypops/vehicle-server's own daemon.ts
92
+ // (startBunListener) already fixed this for every Vehicle-backed daemon that goes through
93
+ // its shared startDaemon() substrate; Papyrus's own daemon.ts predates that substrate and
94
+ // has this separate, hand-rolled Bun.serve() call, so it needs the identical fix applied
95
+ // directly here. Real live incident (papyrus task d0eb81b7): tasks.run_gates/tasks.complete
96
+ // can legitimately take tens of seconds to actually run a caller's own gate command,
97
+ // sending zero response bytes the whole time -- just as exposed to Bun's 10s default as
98
+ // the streaming case, and neither gate.timeoutMs nor VehicleLimits.maxTimeoutMs ever gets a
99
+ // chance to apply if the raw TCP connection is already dead first.
100
+ if (pathname === "/vehicle/invoke") bunServer.timeout(request, VEHICLE_INVOKE_IDLE_TIMEOUT_S);
85
101
  return app.fetch(request);
86
102
  },
87
103
  // A no-op fallback when pushChannel never calls server.upgrade() is safe: Bun only