@cydm/pie 2.7.0 → 2.7.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
@@ -83,7 +83,7 @@ Required model fields:
83
83
 
84
84
  - `id`
85
85
  - `input`
86
- - `cost`
86
+ - `cost` (`input`, `output`, `cacheRead`, `cacheWrite`; optional `cacheWriteLong`)
87
87
  - `contextWindow`
88
88
  - `maxTokens`
89
89
 
@@ -104,6 +104,22 @@ pie models init --stdout
104
104
 
105
105
  For editor auto-complete and validation, you can also point the optional `"$schema"` field in your local `models.json` at your installed `@cydm/pie/models.schema.json` file.
106
106
 
107
+ `cost` may additionally carry `cacheWriteLong` — the per-million-token rate for 1h-TTL cache writes on providers that report a TTL breakdown (Anthropic-style routes). It is optional; legacy configs without it keep working. When it is absent, long writes are priced at the Anthropic 2x-input estimate and the calculated cost is marked `cacheWriteLongEstimated` so it is not presented as a precise provider bill.
108
+
109
+ ### Settings
110
+
111
+ `~/.pie/settings.json` (or `./.pie/settings.json` for project scope) holds CLI defaults. Relevant prompt-cache keys:
112
+
113
+ ```jsonc
114
+ {
115
+ // Explicit Anthropic prompt-cache TTL: "none" | "short" | "long".
116
+ // Absent keeps the provider default (Anthropic: short/5m).
117
+ "promptCacheRetention": "short"
118
+ }
119
+ ```
120
+
121
+ Priority is **per-request option > CLI setting > provider default**. The setting is forwarded only on Anthropic prompt-cache routes; it never forces OpenAI-compatible `store` or another provider's cache mode. Pie does not auto-switch TTL from observed hit rates — choose `long` explicitly when the 1h write premium is worth it.
122
+
107
123
  ### Remote model catalogs
108
124
 
109
125
  Pie can add centrally managed models without replacing local profiles or defaults. Add a catalog to `~/.pie/models.json` and keep the virtual key in an environment variable:
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createAskUserCapability
4
- } from "../../../chunks/chunk-6RBSTII7.js";
5
- import "../../../chunks/chunk-TWILEFLD.js";
6
- import "../../../chunks/chunk-R5I2QLF2.js";
4
+ } from "../../../chunks/chunk-M44CWVDZ.js";
5
+ import "../../../chunks/chunk-NJFPBU36.js";
6
+ import "../../../chunks/chunk-XUROMYTT.js";
7
7
  import "../../../chunks/chunk-XXGYUYXI.js";
8
8
  import "../../../chunks/chunk-LZQXQOPJ.js";
9
9
 
@@ -7,9 +7,9 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-6RBSTII7.js";
11
- import "../../../chunks/chunk-TWILEFLD.js";
12
- import "../../../chunks/chunk-R5I2QLF2.js";
10
+ } from "../../../chunks/chunk-M44CWVDZ.js";
11
+ import "../../../chunks/chunk-NJFPBU36.js";
12
+ import "../../../chunks/chunk-XUROMYTT.js";
13
13
  import {
14
14
  Type
15
15
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -1,14 +1,16 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
- createCliHostCapabilities
4
- } from "../../../chunks/chunk-IPNAFMOJ.js";
3
+ createCliHostCapabilities,
4
+ formatTransportLifecycle,
5
+ logTransportLifecycle
6
+ } from "../../../chunks/chunk-W74NRSRV.js";
5
7
  import {
6
8
  SUBAGENT_SESSION_RECORD_VERSION,
7
9
  createSharedFileSystemTools,
8
10
  createSubagentCapability
9
- } from "../../../chunks/chunk-6RBSTII7.js";
10
- import "../../../chunks/chunk-TWILEFLD.js";
11
- import "../../../chunks/chunk-R5I2QLF2.js";
11
+ } from "../../../chunks/chunk-M44CWVDZ.js";
12
+ import "../../../chunks/chunk-NJFPBU36.js";
13
+ import "../../../chunks/chunk-XUROMYTT.js";
12
14
  import "../../../chunks/chunk-XXGYUYXI.js";
13
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
14
16
 
@@ -392,6 +394,14 @@ function subagentExtension(ctx) {
392
394
  log: (message) => ctx.log(message),
393
395
  notify: ctx.hasUI ? (message, type) => ctx.ui.notify(message, type === "success" ? "info" : type) : void 0,
394
396
  debugLog: (module, message, data) => ctx.log(`[subagent:${module}] ${message}${data !== void 0 ? ` ${JSON.stringify(data)}` : ""}`),
397
+ // Body-free Responses transport timeline for CHILD agents: 5 of the 7
398
+ // incident failures happened inside subagents with no transport record.
399
+ onTransportLifecycle: (event) => {
400
+ logTransportLifecycle(event);
401
+ if (event.phase === "timeout" || event.cleanupOutcome === "request_abandoned") {
402
+ ctx.log(formatTransportLifecycle(event));
403
+ }
404
+ },
395
405
  resolveModelClass: (modelClass) => ctx.resolveModelClass?.(modelClass),
396
406
  resolveModelRef: (modelRef) => ctx.resolveModelRef?.(modelRef),
397
407
  createRuntimeTools: (mode) => {
@@ -8,9 +8,9 @@ import {
8
8
  executeManageTodoList,
9
9
  executionStateToTodos,
10
10
  restoreExecutionState
11
- } from "../../../chunks/chunk-6RBSTII7.js";
12
- import "../../../chunks/chunk-TWILEFLD.js";
13
- import "../../../chunks/chunk-R5I2QLF2.js";
11
+ } from "../../../chunks/chunk-M44CWVDZ.js";
12
+ import "../../../chunks/chunk-NJFPBU36.js";
13
+ import "../../../chunks/chunk-XUROMYTT.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
@@ -17,6 +17,30 @@ Desktop control is a last resort — prefer API/CLI/web tools when they suffice.
17
17
  First use on macOS installs the `pie-computer-use.app` helper; the CLI then
18
18
  asks you to grant it Accessibility and Screen Recording permissions.
19
19
 
20
+ ## How it runs
21
+
22
+ The CLI is a short-lived client. A local **broker** owns the execution engine,
23
+ native helper handles, observation state, resource scheduling, `@o` output
24
+ refs, and image artifacts. The broker starts on demand, is shared by every Pie
25
+ session on this desktop, and exits after 30 minutes with no in-flight or
26
+ unconfirmed work. It is not a system service and opens no network listener
27
+ (Unix socket on macOS/Linux, per-user named pipe on Windows).
28
+
29
+ ```bash
30
+ node <baseDir>/computer-use-axi-cli.js status # broker pid/generation/queues
31
+ node <baseDir>/computer-use-axi-cli.js stop # safe shutdown, owns only its processes
32
+ ```
33
+
34
+ A broker restart creates a new generation. State ids from the old generation
35
+ are reported as expired; they are never restored or replayed — run `roots` and
36
+ `observe` again.
37
+
38
+ `stop` is a safe drain, not a hard kill. While a native action is still
39
+ settling, the stopping broker keeps its endpoint bound and rejects new
40
+ connections with `broker_draining`; a bootstrapping broker waits for that
41
+ drain instead of starting a second execution authority. Retry shortly after a
42
+ `broker_draining` rejection rather than racing another broker.
43
+
20
44
  ## Current guidance lives in the CLI
21
45
 
22
46
  `--help` prints the full command surface; each command's output carries its
@@ -50,10 +74,35 @@ node <baseDir>/computer-use-axi-cli.js act --state S1 --actions '[{"action":"pre
50
74
  - States are stale-checked by epoch: acting twice from one stateId fails the
51
75
  second time by design — consume the successor stateId the act output names.
52
76
  - `@oN` refs continue long truncated output: `read --ref @o1 --offset N`
53
- (byte offsets; no `--state` needed for `@o`).
77
+ (byte offsets; no `--state` needed for `@o`). The broker allocates these.
54
78
  - `pictureOnly` nodes have no semantic element: coordinate actions only, and
55
79
  only from an image-bearing (visual) state.
56
80
 
81
+ ## Image evidence
82
+
83
+ Visual observations do not print base64. The broker writes the original
84
+ screenshot to a private file (`0700` directory, `0600` file under the Pie
85
+ config directory) and the text result names its absolute path, dimensions,
86
+ sha256, broker generation, and owning `stateId`.
87
+
88
+ When the result includes an `Image evidence:` line, call the normal
89
+ `read_file` tool on that absolute path before using coordinates. The image
90
+ belongs only to the returned `stateId`: after acting, use the successor
91
+ image/state, not the old one. Artifacts are evicted with their state; if the
92
+ file is gone, observe again instead of guessing coordinates. The broker never
93
+ scales or transforms the bytes it stores.
94
+
95
+ ## Owners and concurrency
96
+
97
+ The Pie host passes an opaque owner identity into the shell; separate sessions
98
+ have separate observations, `@o` refs, and artifact directories. Manual CLI
99
+ use without that environment resolves to a stable `standalone` namespace.
100
+ Owners are **not** an OS security boundary — every client is the same local
101
+ user. Two owners acting on the same app/page share one resource lane and one
102
+ epoch counter, so the second write is rejected as stale rather than
103
+ overlapping. `status` reports only an owner **count** and non-reversible
104
+ fingerprints; it never prints another session's owner id.
105
+
57
106
  ## Acting and batching
58
107
 
59
108
  ```bash
@@ -82,6 +131,15 @@ node <baseDir>/computer-use-axi-cli.js act --state S1 --actions '[
82
131
  `node <baseDir>/scripts/setup-helper.mjs` once, grant the permissions, and
83
132
  retry.
84
133
 
134
+ ## Uncertain outcomes
135
+
136
+ If a command returns `Outcome unknown` (the client timed out or lost the
137
+ broker connection after dispatch), the native action may already have run.
138
+ Do **not** replay it. The broker keeps that resource lane occupied until the
139
+ native helper confirms completion; run `observe` to establish a successor
140
+ state and decide from there. Reusing the same `--request-id` retrieves the
141
+ original result (or `in-flight`/`outcome-unknown`); it never dispatches again.
142
+
85
143
  ## Browser pages
86
144
 
87
145
  ```bash
@@ -95,9 +153,20 @@ states. Native browser windows are ordinary desktop UI — use `roots`/
95
153
  `observe`/`act` on them. Browser control may need enabling via the
96
154
  computer-use config (`browser_use`).
97
155
 
156
+ ## Test-only backend
157
+
158
+ The deterministic fake desktop backend used by the broker test suite is not
159
+ shipped in release bundles. In a source checkout it activates only when both
160
+ `PIE_COMPUTER_USE_FAKE_BACKEND=1` and
161
+ `PIE_COMPUTER_USE_ENABLE_TEST_COMMANDS=1` are set; otherwise the setting is
162
+ ignored with a warning and the real platform backend is used. Never rely on it
163
+ for real UI work.
164
+
98
165
  ## Output bounds and exit codes
99
166
 
100
167
  Model-facing output is capped (~48 KiB / 2 000 lines); oversized results
101
168
  return a preview plus an `@o` continuation ref. Exit codes: `0` ok, `1` tool
102
- error (message on stderr), `2` usage error. `--json` wraps
103
- `{ content, details, isError }` for programmatic use.
169
+ or broker error (message on stderr), `2` usage error, `3` broker
170
+ version/generation mismatch (run `stop`, then retry). `--json` wraps
171
+ `{ content, details, isError }` for programmatic use; `--request-id` makes a
172
+ retry idempotent.