@everfir/az8-cli 0.3.0-preview.1 → 0.3.0-preview.3

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.1",
3
+ "version": "0.3.0-preview.3",
4
4
  "description": "Semantic Project Canvas client for AZ8 Studio agents.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -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.
@@ -230,12 +245,20 @@ one-shot processes.
230
245
 
231
246
  1. Query `canvas.summary`; query selected details only as needed.
232
247
  2. Query `capabilities.detail` and validate the planned Operation input against its schema.
233
- 3. Pick explicit absolute Canvas coordinates. Public move positions remain absolute even for group
248
+ 3. When artifact type and placement are already clear, make the first meaningful Canvas state
249
+ visible before doing lengthy prompt refinement or generation planning:
250
+ - create the empty generation target first, then plan and edit its Draft;
251
+ - create an empty manual Text Resource with `text: ""`, then fill it with
252
+ `editTextContent`;
253
+ - create a Note with its useful content directly rather than creating an empty sticky.
254
+ Do not create a placeholder while its type or placement is still ambiguous. Watch and the
255
+ Session daemon never create placeholders automatically.
256
+ 4. Pick explicit absolute Canvas coordinates. Public move positions remain absolute even for group
234
257
  children.
235
- 4. Submit one Operation with a new request ID and wait for its terminal Receipt.
236
- 5. Confirm the Receipt outcome and affected IDs, then query the changed View Node when subsequent
258
+ 5. Submit one Operation with a new request ID and wait for its terminal Receipt.
259
+ 6. Confirm the Receipt outcome and affected IDs, then query the changed View Node when subsequent
237
260
  work depends on its exact state.
238
- 6. Only then plan the next interaction.
261
+ 7. Only then plan the next interaction.
239
262
 
240
263
  Common capabilities include notes, manual Text Resources, move/resize/rename, duplicate/remove,
241
264
  groups and stacking, Core Node placement, and generation targets. The runtime catalog is
@@ -270,11 +293,32 @@ Generation is an explicit sequence, never one transaction:
270
293
  plan.
271
294
  4. Execute `plan.operations` exactly in order, one Operation at a time. Each step revalidates
272
295
  current facts. Stop after the first non-success.
296
+ When a reference must also appear at a meaningful Prompt position, use
297
+ `insertPromptReference` with the target View Node and visible reference View Node. Use
298
+ `placement: "start"` or `"end"` for boundary placement, or anchor a named concept precisely:
299
+
300
+ ```json
301
+ {
302
+ "viewNodeId": "target_view_node",
303
+ "referenceViewNodeId": "character_view_node",
304
+ "placement": {
305
+ "kind": "after",
306
+ "anchor": { "text": "豆豆", "occurrence": 2 }
307
+ }
308
+ }
309
+ ```
310
+
311
+ `occurrence` is one-based and may be omitted only when the text occurs once. A missing or
312
+ ambiguous anchor fails without writing. The CLI creates and validates the binding and At token
313
+ atomically. Do not write `{{@...}}`, choose an input slot/index, or allocate a binding ID
314
+ yourself. `addVisualReference` remains the connection-only operation.
273
315
  5. `startGeneration` succeeds when the Workflow Run is accepted and immediate Canvas effects are
274
316
  acknowledged. This completes the start interaction; it does not mean generation finished.
275
- 6. Retain the Workflow Run ID. After the successful start Receipt, continue any work that does not
276
- require the generated output. Prefer `workflowChanged` observations while the persistent client
277
- is active, and use `getWorkflowRun` at a meaningful later checkpoint.
317
+ 6. Retain the Workflow Run ID. The Session automatically covers its terminal state through
318
+ `system.workflow-terminal`; call one foreground `az8 session watch` whenever completion is the
319
+ next useful event. The terminal summary contains the Run, target View Node, and output Core Node
320
+ identities supplied by Workflow Runtime. Continue other work first when it does not require the
321
+ output, and use `getWorkflowRun` at a meaningful authoritative checkpoint.
278
322
  7. Use `waitWorkflowRun` only when the next step actually requires terminal output and the current
279
323
  request lane can remain dedicated to waiting. Choose one intentional observation window; do not
280
324
  emulate polling with repeated short waits. An observation-window timeout while the authoritative
@@ -283,6 +327,19 @@ Generation is an explicit sequence, never one transaction:
283
327
  8. On terminal success, query the target detail and resolve its current output Core Node through
284
328
  Project Content before downloading or placing it elsewhere.
285
329
 
330
+ If `startGeneration` returns an indeterminate Receipt after the Workflow was accepted, retain
331
+ `receipt.result.workflowRunId` and `receipt.result.viewNodeId`, reconnect the Session, and invoke
332
+ `reconcileGenerationStart` with those two identities. Never call `startGeneration` again for that
333
+ intent. `running-insufficient` means the Run is still authoritative but does not yet expose enough
334
+ target evidence: wait and reconcile later. `repaired` means the CLI restored the missing Canvas
335
+ launch facts through the semantic Command path. `conflict` or `insufficient` requires inspection;
336
+ neither authorizes a retry.
337
+
338
+ The system Workflow Interest performs authoritative catch-up for Run IDs known to the Session and
339
+ delivers each unchanged terminal fact once. User Workflow Interests are additive and may narrow
340
+ progress observations, but cannot remove or narrow the system terminal stream. This is Session
341
+ discovery, not an account-wide or historical Workflow event log.
342
+
286
343
  Workflow Definitions change over time. Query `workflowDefinitions.summary`, then
287
344
  `workflowDefinition.detail` only when planning detail is insufficient. Never guess a Definition,
288
345
  configuration option, modality, cost, or media compatibility from its display name.
@@ -311,6 +368,9 @@ az8 canvas upload <project-id> \
311
368
  error. Replay only after inspecting and reconciling the prior attempt.
312
369
  - Let the CLI inspect bytes, MIME, size, and checksum and let the server create the Core Node and
313
370
  binding. Do not supply a claimed media type, upload URL, Core Node ID, or Project Content record.
371
+ - Treat `az8.operation-progress.v1` lines on stderr as provisional feedback. The stages are
372
+ `inspecting`, `requesting-upload`, `uploading`, `creating-content`, and `updating-canvas`; only the
373
+ terminal Receipt proves the Operation outcome. Progress never authorizes a retry.
314
374
  - A known failure may leave one inspectable `failed` View Node. An unknown response leaves it
315
375
  `pending` and isolates the context; do not create a replacement until reconciliation.
316
376
 
@@ -325,7 +385,10 @@ az8 canvas download <project-id> --view-node-id <view-node-id> --output ./result
325
385
 
326
386
  The destination must be explicit. Existing files are preserved unless `--overwrite` is explicitly
327
387
  chosen. Verify the returned absolute path, byte count, detected MIME, Core Node ID, and SHA-256.
328
- Never extract or reuse hidden media URLs as a general downloader.
388
+ The CLI may automatically retry only retryable read/transfer phases, at most three total attempts
389
+ under the original deadline. It re-resolves the source and removes every partial temporary file
390
+ before retrying. Inspect `error.phase`, `retryable`, `attempts`, sanitized `cause`, `localState`, and
391
+ `remoteState` after failure. Never extract or reuse hidden media URLs as a general downloader.
329
392
 
330
393
  ## Recovery
331
394