@everfir/az8-cli 0.3.0-preview.2 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everfir/az8-cli",
3
- "version": "0.3.0-preview.2",
3
+ "version": "0.3.0",
4
4
  "description": "Semantic Project Canvas client for AZ8 Studio agents.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  "main": "./dist/main.js",
17
17
  "publishConfig": {
18
18
  "access": "public",
19
- "tag": "preview"
19
+ "tag": "latest"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "pnpm build:dependencies && rm -rf dist && esbuild src/main.ts --bundle --platform=node --format=esm --target=node22.12 --banner:js='import { createRequire } from \"node:module\"; const require = createRequire(import.meta.url);' --outfile=dist/main.js",
@@ -62,7 +62,9 @@ capabilities instead of guessing operation names or input shapes.
62
62
 
63
63
  ## Bootstrap
64
64
 
65
- 1. Verify the installed client without credentials:
65
+ 1. Report the canonical working directory and intended environment before asking the operator to
66
+ provision an env file. This tells them where automatic `.env.local` discovery begins without
67
+ inspecting the file or secret. Then verify the installed client without credentials:
66
68
 
67
69
  ```bash
68
70
  az8 --version
@@ -162,15 +164,28 @@ Session resolution is explicit and discoverable. A command-level `--session <id>
162
164
  parallel Agents intentionally sharing one working directory. `session list`, `current`, `status`,
163
165
  and `use` must be used whenever the binding is uncertain; never guess a Session or Project.
164
166
 
165
- Configure named semantic Interests once, then use the singular blocking Watch instead of polling:
167
+ The Session always installs the visible, read-only `system.workflow-terminal` Interest. It retains
168
+ every terminal Workflow fact discoverable during this Project Session, including locally started
169
+ Runs and pending Runs introduced by Web or another client. Do not add or maintain Run ID filters
170
+ merely to receive completions. Configure only additional semantic Interests, then use the singular
171
+ blocking Watch:
166
172
 
167
173
  ```bash
168
- az8 session interests patch --input-json '{"upsert":[{"key":"canvas-ambient","patch":{"kind":"canvas"}},{"key":"workflow-terminal","patch":{"kind":"workflow"}}]}'
174
+ az8 session interests patch \
175
+ --input-json '{"upsert":[{"key":"canvas-ambient","patch":{"kind":"canvas"}}]}'
169
176
  az8 session watch --timeout-ms 30000
170
177
  ```
171
178
 
179
+ - Whenever waiting is the next useful action, invoke exactly one `az8 session watch` immediately in
180
+ the foreground. Process its result, act if needed, then invoke one new foreground Watch if waiting
181
+ is still useful. This is the fastest Agent response path because the daemon journals facts between
182
+ calls.
183
+ - Never wrap Watch in a `while`, `for`, recursive, timer, or repeated shell loop. Never launch it
184
+ with `&`, `nohup`, a detached terminal, or a background task. Such a process can consume the
185
+ readiness event before the Agent can reason about it.
172
186
  - Canvas Interests exclude the Session's own changes unless `includeOwn: true` is explicit.
173
- - Workflow Interests are terminal-only unless progress status is explicitly requested.
187
+ - The system Workflow Interest is terminal-only. Add a user Workflow Interest only when
188
+ pending/running progress affects a concrete decision.
174
189
  - `idle` ends one observation window normally. It does not indicate a failed connection or Run.
175
190
  - `resync-required` means bounded continuity was lost. Query authoritative summary/detail, then run
176
191
  `az8 session resynchronize`; never pretend the missing interval was observed.
@@ -232,7 +247,8 @@ one-shot processes.
232
247
  2. Query `capabilities.detail` and validate the planned Operation input against its schema.
233
248
  3. When artifact type and placement are already clear, make the first meaningful Canvas state
234
249
  visible before doing lengthy prompt refinement or generation planning:
235
- - create the empty generation target first, then plan and edit its Draft;
250
+ - create the generation target first, inspect whether its eligible default Draft was
251
+ initialized, then plan and edit;
236
252
  - create an empty manual Text Resource with `text: ""`, then fill it with
237
253
  `editTextContent`;
238
254
  - create a Note with its useful content directly rather than creating an empty sticky.
@@ -261,7 +277,9 @@ Generation is an explicit sequence, never one transaction:
261
277
 
262
278
  1. Create a target with `createGenerationTarget` and retain its View Node ID. It accepts `audio`,
263
279
  `image`, `text`, or `video`; `createMediaTarget` remains a compatibility capability for non-text
264
- targets when advertised.
280
+ targets when advertised. The same creation interaction initializes an account-eligible default
281
+ Draft when one exists; inspect `draftInitialized`, `definitionId`, and `selectionSource`. This is
282
+ convenience state only: it does not start or estimate generation.
265
283
  2. Call the read-only `planGeneration` Operation with the target, prompt, and any references. Use
266
284
  `detail: "detail"` when configuration fields or dynamic enum options are needed.
267
285
  Every reference must be `{ "viewNodeId": "..." }`. If the desired Core Node is not currently
@@ -279,15 +297,33 @@ Generation is an explicit sequence, never one transaction:
279
297
  4. Execute `plan.operations` exactly in order, one Operation at a time. Each step revalidates
280
298
  current facts. Stop after the first non-success.
281
299
  When a reference must also appear at a meaningful Prompt position, use
282
- `insertPromptReference` with the target View Node, visible reference View Node, and
283
- `placement: "start"` or `"end"`. The CLI creates and validates the binding and At token
300
+ `insertPromptReference` with the target View Node and visible reference View Node. Use
301
+ `placement: "start"` or `"end"` for boundary placement, or anchor a named concept precisely:
302
+
303
+ ```json
304
+ {
305
+ "viewNodeId": "target_view_node",
306
+ "referenceViewNodeId": "character_view_node",
307
+ "placement": {
308
+ "kind": "after",
309
+ "anchor": { "text": "豆豆", "occurrence": 2 }
310
+ }
311
+ }
312
+ ```
313
+
314
+ `occurrence` is one-based and may be omitted only when the text occurs once. A missing or
315
+ ambiguous anchor fails without writing. The CLI creates and validates the binding and At token
284
316
  atomically. Do not write `{{@...}}`, choose an input slot/index, or allocate a binding ID
285
317
  yourself. `addVisualReference` remains the connection-only operation.
286
318
  5. `startGeneration` succeeds when the Workflow Run is accepted and immediate Canvas effects are
287
319
  acknowledged. This completes the start interaction; it does not mean generation finished.
288
- 6. Retain the Workflow Run ID. After the successful start Receipt, continue any work that does not
289
- require the generated output. Prefer `workflowChanged` observations while the persistent client
290
- is active, and use `getWorkflowRun` at a meaningful later checkpoint.
320
+ 6. Retain the Workflow Run ID. The Session automatically covers its terminal state through
321
+ `system.workflow-terminal`; call one foreground `az8 session watch` whenever completion is the
322
+ next useful event. The terminal summary includes the target View Node only when the Session can
323
+ map it uniquely from authoritative launch or Canvas History facts. If `targetResolution` is
324
+ `unresolved` or `ambiguous`, query the Run and Canvas rather than guessing. Continue other work
325
+ first when it does not require the output, and use `getWorkflowRun` at a meaningful
326
+ authoritative checkpoint.
291
327
  7. Use `waitWorkflowRun` only when the next step actually requires terminal output and the current
292
328
  request lane can remain dedicated to waiting. Choose one intentional observation window; do not
293
329
  emulate polling with repeated short waits. An observation-window timeout while the authoritative
@@ -304,14 +340,21 @@ target evidence: wait and reconcile later. `repaired` means the CLI restored the
304
340
  launch facts through the semantic Command path. `conflict` or `insufficient` requires inspection;
305
341
  neither authorizes a retry.
306
342
 
307
- A Workflow Interest performs an authoritative status catch-up for Run IDs already known to the
308
- Session; explicit `filter.runIds` narrows or restores that set when needed. This closes
309
- missed-live-event races and delivers each unchanged terminal fact once. Keep explicit Run ID filters
310
- current across handoffs; the daemon does not scan unrelated Workflow Runs.
343
+ The system Workflow Interest performs authoritative catch-up for Run IDs known to the Session and
344
+ delivers each unchanged terminal fact once. User Workflow Interests are additive and may narrow
345
+ progress observations, but cannot remove or narrow the system terminal stream. This is Session
346
+ discovery, not an account-wide or historical Workflow event log.
311
347
 
312
348
  Workflow Definitions change over time. Query `workflowDefinitions.summary`, then
313
349
  `workflowDefinition.detail` only when planning detail is insufficient. Never guess a Definition,
314
350
  configuration option, modality, cost, or media compatibility from its display name.
351
+ Summary discovery, defaults, planning, and start are filtered to Definitions available to the
352
+ authenticated account. Detail may retain an unavailable historical Definition for diagnosis and
353
+ marks it with `availableForAccount` and `accessReason`.
354
+
355
+ Workflow tags classify compatibility, access, and rollout; they are not pricing evidence.
356
+ `available:free` means a free-tier account may select that Workflow. It does not mean generation
357
+ costs zero credits. Use planning/start estimates and terminal usage records for credit information.
315
358
 
316
359
  The start Receipt may report `usage.credits.status` as `estimated`, `not-consumed`, or `unknown`.
317
360
  Estimated cost is informational, not final charged usage. There is no second confirmation. Never
@@ -337,6 +380,9 @@ az8 canvas upload <project-id> \
337
380
  error. Replay only after inspecting and reconciling the prior attempt.
338
381
  - Let the CLI inspect bytes, MIME, size, and checksum and let the server create the Core Node and
339
382
  binding. Do not supply a claimed media type, upload URL, Core Node ID, or Project Content record.
383
+ - Treat `az8.operation-progress.v1` lines on stderr as provisional feedback. The stages are
384
+ `inspecting`, `requesting-upload`, `uploading`, `creating-content`, and `updating-canvas`; only the
385
+ terminal Receipt proves the Operation outcome. Progress never authorizes a retry.
340
386
  - A known failure may leave one inspectable `failed` View Node. An unknown response leaves it
341
387
  `pending` and isolates the context; do not create a replacement until reconciliation.
342
388
 
@@ -351,7 +397,10 @@ az8 canvas download <project-id> --view-node-id <view-node-id> --output ./result
351
397
 
352
398
  The destination must be explicit. Existing files are preserved unless `--overwrite` is explicitly
353
399
  chosen. Verify the returned absolute path, byte count, detected MIME, Core Node ID, and SHA-256.
354
- Never extract or reuse hidden media URLs as a general downloader.
400
+ The CLI may automatically retry only retryable read/transfer phases, at most three total attempts
401
+ under the original deadline. It re-resolves the source and removes every partial temporary file
402
+ before retrying. Inspect `error.phase`, `retryable`, `attempts`, sanitized `cause`, `localState`, and
403
+ `remoteState` after failure. Never extract or reuse hidden media URLs as a general downloader.
355
404
 
356
405
  ## Recovery
357
406