@cydm/pie 2.7.0 → 2.7.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/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-65B6P5J5.js";
5
+ import "../../../chunks/chunk-GZDAIW6F.js";
6
+ import "../../../chunks/chunk-BRFP5WZ6.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-65B6P5J5.js";
11
+ import "../../../chunks/chunk-GZDAIW6F.js";
12
+ import "../../../chunks/chunk-BRFP5WZ6.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-GECAIKZL.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-65B6P5J5.js";
12
+ import "../../../chunks/chunk-GZDAIW6F.js";
13
+ import "../../../chunks/chunk-BRFP5WZ6.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-65B6P5J5.js";
12
+ import "../../../chunks/chunk-GZDAIW6F.js";
13
+ import "../../../chunks/chunk-BRFP5WZ6.js";
14
14
  import "../../../chunks/chunk-XXGYUYXI.js";
15
15
  import "../../../chunks/chunk-LZQXQOPJ.js";
16
16
 
@@ -15,7 +15,47 @@ node <baseDir>/computer-use-axi-cli.js <command> [options]
15
15
 
16
16
  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
- asks you to grant it Accessibility and Screen Recording permissions.
18
+ reports missing Accessibility and Screen Recording permissions. Use the real
19
+ non-TUI setup flow (the user grants toggles in macOS Settings):
20
+
21
+ ```bash
22
+ node <baseDir>/computer-use-axi-cli.js permissions setup
23
+ # User enables pie-computer-use.app in both Settings panes.
24
+ node <baseDir>/computer-use-axi-cli.js permissions recheck
25
+ ```
26
+
27
+ Setup registers the helper and opens missing panes; recheck restarts the helper
28
+ and probes permissions. Missing grants exit 1. Both require an idle broker;
29
+ recheck expires old observations, so run `roots`/`observe` again afterward.
30
+ Starting Pie in interactive mode is not a substitute for this flow.
31
+
32
+ ## How it runs
33
+
34
+ The CLI is a short-lived client. A local **broker** owns the execution engine,
35
+ native helper handles, observation state, resource scheduling, `@o` output
36
+ refs, and image artifacts. The broker starts on demand, is shared by every Pie
37
+ session on this desktop, and exits after 30 minutes with no in-flight or
38
+ unconfirmed work. It is not a system service and opens no network listener
39
+ (Unix socket on macOS/Linux, per-user named pipe on Windows).
40
+
41
+ ```bash
42
+ node <baseDir>/computer-use-axi-cli.js status # broker pid/generation/queues
43
+ node <baseDir>/computer-use-axi-cli.js stop # safe shutdown, owns only its processes
44
+ ```
45
+
46
+ A broker restart creates a new generation. State ids from the old generation
47
+ are reported as expired; they are never restored or replayed — run `roots` and
48
+ `observe` again. Request-ID deduplication is generation-scoped: retrieve a
49
+ result with `--request-id ID --generation G` using its original generation.
50
+ `request_id_expired` refuses replay after result eviction; `request_ledger_full`
51
+ refuses fresh work until a safe stop/new generation. Never replay old actions
52
+ to recover from either error.
53
+
54
+ `stop` is a safe drain, not a hard kill. While a native action is still
55
+ settling, the stopping broker keeps its endpoint bound and rejects new
56
+ connections with `broker_draining`; a bootstrapping broker waits for that
57
+ drain instead of starting a second execution authority. Retry shortly after a
58
+ `broker_draining` rejection rather than racing another broker.
19
59
 
20
60
  ## Current guidance lives in the CLI
21
61
 
@@ -50,10 +90,35 @@ node <baseDir>/computer-use-axi-cli.js act --state S1 --actions '[{"action":"pre
50
90
  - States are stale-checked by epoch: acting twice from one stateId fails the
51
91
  second time by design — consume the successor stateId the act output names.
52
92
  - `@oN` refs continue long truncated output: `read --ref @o1 --offset N`
53
- (byte offsets; no `--state` needed for `@o`).
93
+ (byte offsets; no `--state` needed for `@o`). The broker allocates these.
54
94
  - `pictureOnly` nodes have no semantic element: coordinate actions only, and
55
95
  only from an image-bearing (visual) state.
56
96
 
97
+ ## Image evidence
98
+
99
+ Visual observations do not print base64. The broker writes the original
100
+ screenshot to a private file (`0700` directory, `0600` file under the Pie
101
+ config directory) and the text result names its absolute path, dimensions,
102
+ sha256, broker generation, and owning `stateId`.
103
+
104
+ When the result includes an `Image evidence:` line, call the normal
105
+ `read_file` tool on that absolute path before using coordinates. The image
106
+ belongs only to the returned `stateId`: after acting, use the successor
107
+ image/state, not the old one. Artifacts are evicted with their state; if the
108
+ file is gone, observe again instead of guessing coordinates. The broker never
109
+ scales or transforms the bytes it stores.
110
+
111
+ ## Owners and concurrency
112
+
113
+ The Pie host passes an opaque owner identity into the shell; separate sessions
114
+ have separate observations, `@o` refs, and artifact directories. Manual CLI
115
+ use without that environment resolves to a stable `standalone` namespace.
116
+ Owners are **not** an OS security boundary — every client is the same local
117
+ user. Two owners acting on the same app/page share one resource lane and one
118
+ epoch counter, so the second write is rejected as stale rather than
119
+ overlapping. `status` reports only an owner **count** and non-reversible
120
+ fingerprints; it never prints another session's owner id.
121
+
57
122
  ## Acting and batching
58
123
 
59
124
  ```bash
@@ -82,6 +147,15 @@ node <baseDir>/computer-use-axi-cli.js act --state S1 --actions '[
82
147
  `node <baseDir>/scripts/setup-helper.mjs` once, grant the permissions, and
83
148
  retry.
84
149
 
150
+ ## Uncertain outcomes
151
+
152
+ If a command returns `Outcome unknown` (the client timed out or lost the
153
+ broker connection after dispatch), the native action may already have run.
154
+ Do **not** replay it. The broker keeps that resource lane occupied until the
155
+ native helper confirms completion; run `observe` to establish a successor
156
+ state and decide from there. Reusing the same `--request-id` retrieves the
157
+ original result (or `in-flight`/`outcome-unknown`); it never dispatches again.
158
+
85
159
  ## Browser pages
86
160
 
87
161
  ```bash
@@ -95,9 +169,20 @@ states. Native browser windows are ordinary desktop UI — use `roots`/
95
169
  `observe`/`act` on them. Browser control may need enabling via the
96
170
  computer-use config (`browser_use`).
97
171
 
172
+ ## Test-only backend
173
+
174
+ The deterministic fake desktop backend used by the broker test suite is not
175
+ shipped in release bundles. In a source checkout it activates only when both
176
+ `PIE_COMPUTER_USE_FAKE_BACKEND=1` and
177
+ `PIE_COMPUTER_USE_ENABLE_TEST_COMMANDS=1` are set; otherwise the setting is
178
+ ignored with a warning and the real platform backend is used. Never rely on it
179
+ for real UI work.
180
+
98
181
  ## Output bounds and exit codes
99
182
 
100
183
  Model-facing output is capped (~48 KiB / 2 000 lines); oversized results
101
184
  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.
185
+ or broker error (message on stderr), `2` usage error, `3` broker
186
+ version/generation mismatch (run `stop`, then retry). `--json` wraps
187
+ `{ content, details, isError }` for programmatic use; `--request-id` makes a
188
+ retry idempotent.