@xynogen/pix-runtime 0.3.1 → 0.4.0

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
@@ -10,7 +10,7 @@ See `DESIGN.md` for the full contract.
10
10
  ## What it does
11
11
 
12
12
  - Versioned, sparse `pix.json` (`$version: 1`) — defaults resolve in code.
13
- - Typed sections: `collapse`, `pretty`, `optimizer`, `gate`.
13
+ - Typed sections: `collapse`, `pretty`, `io`, `optimizer`, `gate`.
14
14
  - Atomic writes behind a serialized in-process queue and a short-lived
15
15
  cross-process lock. A failed write leaves the old file intact.
16
16
  - Immutable, deeply frozen config snapshots with a monotonic revision.
@@ -38,8 +38,17 @@ import { prettySection } from "@xynogen/pix-runtime/sections";
38
38
  const icons = config(prettySection).icons; // synchronous read
39
39
  await updateConfig(prettySection, { icons: "ascii" });
40
40
  const off = onConfigChange((c) => render(), { paths: ["pretty.icons"] });
41
+
42
+ import { ioTimeoutMs, ioTimeoutSignal } from "@xynogen/pix-runtime/io";
43
+ const timeoutMs = ioTimeoutMs(); // shared network timeout
44
+ const signal = ioTimeoutSignal(toolSignal); // timeout + cancellation
41
45
  ```
42
46
 
47
+ Set `io.timeoutSec` in `~/.pi/agent/pix.json`, or change **Network → timeout (sec)**
48
+ with `/pix`. The default is 30 seconds. It applies to Pix network operations,
49
+ including remote skills, web fetch/search/transcription, MCP requests and
50
+ connection bootstrap, background model-data refreshes, and update downloads.
51
+
43
52
  Collapse policy helpers:
44
53
 
45
54
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-runtime",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Pix shared runtime — versioned pix.json config, atomic persistence, typed change events",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -24,6 +24,7 @@
24
24
  "./config": "./src/runtime.ts",
25
25
  "./sections": "./src/sections/index.ts",
26
26
  "./collapse": "./src/collapse.ts",
27
+ "./io": "./src/io.ts",
27
28
  "./once": "./src/once.ts",
28
29
  "./testing": "./src/testing.ts"
29
30
  },
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export type {
7
7
  SubscribeOptions,
8
8
  } from "./events.ts";
9
9
  export { default } from "./extension.ts";
10
+ export { ioTimeoutMs, ioTimeoutSignal } from "./io.ts";
10
11
  export {
11
12
  config,
12
13
  createRuntime,
@@ -34,6 +35,8 @@ export {
34
35
  type GateConfig,
35
36
  type GateRuleConfig,
36
37
  gateSection,
38
+ type IoConfig,
39
+ ioSection,
37
40
  type OptimizerConfig,
38
41
  optimizerSection,
39
42
  type PrettyConfig,
package/src/io.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { config } from "./runtime.ts";
2
+ import { ioSection } from "./sections/io.ts";
3
+
4
+ export function ioTimeoutMs(): number {
5
+ return config(ioSection).timeoutSec * 1000;
6
+ }
7
+
8
+ export function ioTimeoutSignal(signal?: AbortSignal): AbortSignal {
9
+ const timeout = AbortSignal.timeout(ioTimeoutMs());
10
+ return signal ? AbortSignal.any([signal, timeout]) : timeout;
11
+ }
@@ -19,6 +19,7 @@ import type { PixRuntime } from "./runtime.ts";
19
19
  import type { DeepPartial, SectionHandle } from "./schema.ts";
20
20
  import { collapseSection } from "./sections/collapse.ts";
21
21
  import { gateSection } from "./sections/gate.ts";
22
+ import { ioSection } from "./sections/io.ts";
22
23
  import { prettySection } from "./sections/pretty.ts";
23
24
 
24
25
  interface SettingRow<T> {
@@ -68,6 +69,14 @@ const SETTINGS: SettingRow<unknown>[] = [
68
69
  read: (v) => String(v.delaySec),
69
70
  patch: (value) => ({ delaySec: Number(value) }),
70
71
  }),
72
+ row({
73
+ section: "Network",
74
+ label: "timeout (sec)",
75
+ handle: ioSection,
76
+ values: ["30", "10", "60", "120", "300"],
77
+ read: (v) => String(v.timeoutSec),
78
+ patch: (value) => ({ timeoutSec: Number(value) }),
79
+ }),
71
80
  row({
72
81
  section: "Gate",
73
82
  label: "Guardrails",
@@ -5,6 +5,7 @@ export {
5
5
  type GateSeverity,
6
6
  gateSection,
7
7
  } from "./gate.ts";
8
+ export { type IoConfig, ioSection } from "./io.ts";
8
9
  export {
9
10
  type CavemanLevel,
10
11
  type OptimizerConfig,
@@ -22,6 +23,7 @@ export {
22
23
 
23
24
  import { collapseSection } from "./collapse.ts";
24
25
  import { gateSection } from "./gate.ts";
26
+ import { ioSection } from "./io.ts";
25
27
  import { optimizerSection } from "./optimizer.ts";
26
28
  import { prettySection } from "./pretty.ts";
27
29
 
@@ -29,6 +31,7 @@ import { prettySection } from "./pretty.ts";
29
31
  export const builtinSections = [
30
32
  collapseSection,
31
33
  prettySection,
34
+ ioSection,
32
35
  optimizerSection,
33
36
  gateSection,
34
37
  ] as const;
@@ -0,0 +1,21 @@
1
+ import { defineSection, isObj, posNumOr } from "../schema.ts";
2
+
3
+ export interface IoConfig {
4
+ /** Default timeout in seconds for Pix network requests. */
5
+ timeoutSec: number;
6
+ }
7
+
8
+ const DEFAULTS: Readonly<IoConfig> = {
9
+ timeoutSec: 30,
10
+ };
11
+
12
+ export const ioSection = defineSection<"io", IoConfig>({
13
+ key: "io",
14
+ defaults: DEFAULTS,
15
+ parse(raw) {
16
+ if (!isObj(raw)) return { ...DEFAULTS };
17
+ return {
18
+ timeoutSec: posNumOr(raw.timeoutSec, DEFAULTS.timeoutSec),
19
+ };
20
+ },
21
+ });