@everfir/az8-cli 0.3.0-preview.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everfir/az8-cli",
3
- "version": "0.3.0-preview.3",
3
+ "version": "0.4.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",
@@ -22,9 +22,10 @@ capabilities instead of guessing operation names or input shapes.
22
22
  indeterminate result; do not execute later steps.
23
23
  - Never automatically retry a write. Retry only bounded reads when the returned error says doing so
24
24
  is safe. An idempotency key does not authorize blind replay.
25
- - Require the operator or agent host to provision credentials outside the recorded interaction.
26
- Keep tokens in the inherited process environment or an ignored env file. Never type, read, copy,
27
- print, or return a token through a shell tool call, argv, stdio frame, prompt, log, or output.
25
+ - Prefer `az8 login` browser authorization for the current operating-system user. Externally
26
+ provisioned inherited-environment and env-file credentials remain higher-priority automation
27
+ inputs. Never type, read, copy, print, or return a token through a shell tool call, argv, stdio
28
+ frame, prompt, log, or output.
28
29
 
29
30
  ## Concepts
30
31
 
@@ -57,23 +58,45 @@ capabilities instead of guessing operation names or input shapes.
57
58
  name is always `<authenticated display name> (<client suffix>)`; the default suffix is `cli`.
58
59
  CLI awareness does not publish selection bounds. Awareness never grants authority, changes
59
60
  persisted authorship, or proves a business result.
60
- - **Actor** is the authenticated account from `AZ8_TOKEN`. A client or awareness name cannot
61
- impersonate another author.
61
+ - **Actor** is the account selected by the active credential source. A client or awareness name
62
+ cannot impersonate another author.
62
63
 
63
64
  ## Bootstrap
64
65
 
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
+ 1. Report the canonical working directory and intended environment. Then verify the installed
67
+ client without credentials:
68
68
 
69
69
  ```bash
70
70
  az8 --version
71
71
  ```
72
72
 
73
- 2. Require credentials to be provisioned by the operator or agent host before authenticating. The
74
- CLI accepts `AZ8_TOKEN` from its inherited process environment or an env file. A provisioned env
75
- file has this shape, but the agent must not fill the placeholder with a real token in a recorded
76
- interaction:
73
+ 2. Check the active identity without inspecting credential material:
74
+
75
+ ```bash
76
+ az8 whoami --environment test
77
+ ```
78
+
79
+ If no credential is available, invoke browser authorization and ask the user to approve the
80
+ request in the opened AZ8 Studio page:
81
+
82
+ ```bash
83
+ az8 login --environment test
84
+ ```
85
+
86
+ `login` emits the verification URL and User Code as structured progress while it waits. Do not
87
+ create a polling loop around it. If the browser cannot be opened on the agent host, use
88
+ `az8 login --environment test --no-open`, give the emitted URL to the user, and keep that one
89
+ command running until it succeeds or fails. Authorization delivery is at-most-once: a lost
90
+ response, cancelled CLI, or failed local save requires a completely new `az8 login`; never retry
91
+ the consumed exchange yourself.
92
+
93
+ The CLI stores browser-authorized credentials privately by operating-system user and environment.
94
+ `az8 logout` removes only that local credential and closes daemon Sessions that depend on it; it
95
+ is not online revocation. Do not log out automatically at task completion.
96
+
97
+ The CLI also accepts `AZ8_TOKEN` from its inherited process environment or an env file for
98
+ externally managed automation. A provisioned env file has this shape, but the agent must not fill
99
+ the placeholder with a real token in a recorded interaction:
77
100
 
78
101
  ```dotenv
79
102
  AZ8_TOKEN=<operator-provisioned-secret>
@@ -88,15 +111,16 @@ capabilities instead of guessing operation names or input shapes.
88
111
  --environment test --env-file /secure/path/.env.local
89
112
  ```
90
113
 
91
- Use the authenticated read as the credential check. Never verify a token with `cat`, `sed`,
92
- `grep`, `env`, `printenv`, `echo`, shell tracing, or by reading the env file through another
93
- tool. Do not create, edit, move, or delete a credential file unless the operator explicitly asks
94
- through a secure provisioning workflow. Keep it outside version control with owner-only access.
114
+ Use `az8 whoami` as the credential check. Never verify a token with `cat`, `sed`, `grep`, `env`,
115
+ `printenv`, `echo`, shell tracing, or by reading the env file through another tool. Do not create,
116
+ edit, move, or delete a credential file unless the operator explicitly asks through a secure
117
+ provisioning workflow. Keep it outside version control with owner-only access.
95
118
 
96
- The inherited process environment overrides env-file values; `--environment` overrides
97
- `AZ8_ENVIRONMENT`. Always pass or provision the intended environment explicitly. If the CLI
98
- reports a missing token or authentication failure, stop and ask the operator to provision or
99
- replace it outside the conversation. Never ask them to paste the secret into chat.
119
+ The inherited process environment overrides env-file values, and env-file values override the
120
+ locally saved login; `--environment` overrides `AZ8_ENVIRONMENT`. `az8 login` can save a local
121
+ credential while an external credential remains active, so check the returned `credential.active`
122
+ field and use `az8 whoami` to confirm the effective Actor. Always pass or provision the intended
123
+ environment explicitly. Never ask the user to paste a secret into chat.
100
124
 
101
125
  3. Select an existing Project or create a bounded workspace:
102
126
 
@@ -114,7 +138,7 @@ capabilities instead of guessing operation names or input shapes.
114
138
  ```bash
115
139
  az8 session open <project-id> --environment test
116
140
  az8 session query capabilities.summary
117
- az8 session query capabilities.detail
141
+ az8 session query capabilities.detail --operation-name <operation-name>
118
142
  az8 session query canvas.summary
119
143
  ```
120
144
 
@@ -126,9 +150,11 @@ capabilities instead of guessing operation names or input shapes.
126
150
  az8 canvas query <project-id> canvas.summary --environment test
127
151
  ```
128
152
 
129
- `capabilities.summary` is the short menu. `capabilities.detail` is authoritative for exact JSON
130
- Schema, `effect`, `history`, `completion`, and `retry`. Availability is filtered by the current
131
- account, Project role, upstream services, and CLI version. Do not rely on remembered schemas.
153
+ `capabilities.summary` is the short menu. Select one Operation with `--operation-name` when
154
+ querying `capabilities.detail`; that focused response is authoritative for exact JSON Schema,
155
+ `effect`, `history`, `completion`, and `retry`. Availability is filtered by the current account,
156
+ Project role, upstream services, and CLI version. Do not load the full detail catalog or rely on
157
+ remembered schemas.
132
158
 
133
159
  5. Use `canvas.detail` only when exact node geometry, Draft, status, or bindings are needed:
134
160
 
@@ -244,10 +270,12 @@ one-shot processes.
244
270
  ## Canvas SOP
245
271
 
246
272
  1. Query `canvas.summary`; query selected details only as needed.
247
- 2. Query `capabilities.detail` and validate the planned Operation input against its schema.
273
+ 2. Query `capabilities.detail --operation-name <operation-name>` and validate the planned Operation
274
+ input against its schema.
248
275
  3. When artifact type and placement are already clear, make the first meaningful Canvas state
249
276
  visible before doing lengthy prompt refinement or generation planning:
250
- - create the empty generation target first, then plan and edit its Draft;
277
+ - create the generation target first, inspect whether its eligible default Draft was
278
+ initialized, then plan and edit;
251
279
  - create an empty manual Text Resource with `text: ""`, then fill it with
252
280
  `editTextContent`;
253
281
  - create a Note with its useful content directly rather than creating an empty sticky.
@@ -274,9 +302,14 @@ entries. Never use compensating low-level mutations to imitate undo.
274
302
 
275
303
  Generation is an explicit sequence, never one transaction:
276
304
 
305
+ `getCoreNode` requires a non-empty unique `coreNodeIds` batch and returns `coreNodes` in request
306
+ order. Treat any missing requested Core Node as a failed read.
307
+
277
308
  1. Create a target with `createGenerationTarget` and retain its View Node ID. It accepts `audio`,
278
309
  `image`, `text`, or `video`; `createMediaTarget` remains a compatibility capability for non-text
279
- targets when advertised.
310
+ targets when advertised. The same creation interaction initializes an account-eligible default
311
+ Draft when one exists; inspect `draftInitialized`, `definitionId`, and `selectionSource`. This is
312
+ convenience state only: it does not start or estimate generation.
280
313
  2. Call the read-only `planGeneration` Operation with the target, prompt, and any references. Use
281
314
  `detail: "detail"` when configuration fields or dynamic enum options are needed.
282
315
  Every reference must be `{ "viewNodeId": "..." }`. If the desired Core Node is not currently
@@ -293,6 +326,9 @@ Generation is an explicit sequence, never one transaction:
293
326
  plan.
294
327
  4. Execute `plan.operations` exactly in order, one Operation at a time. Each step revalidates
295
328
  current facts. Stop after the first non-success.
329
+ `addVisualReference` requires a non-empty unique `referenceViewNodeIds` batch, and
330
+ `removeVisualReference` requires a non-empty unique `referenceIds` batch. The runtime validates
331
+ the whole batch and writes the Draft once.
296
332
  When a reference must also appear at a meaningful Prompt position, use
297
333
  `insertPromptReference` with the target View Node and visible reference View Node. Use
298
334
  `placement: "start"` or `"end"` for boundary placement, or anchor a named concept precisely:
@@ -316,9 +352,11 @@ Generation is an explicit sequence, never one transaction:
316
352
  acknowledged. This completes the start interaction; it does not mean generation finished.
317
353
  6. Retain the Workflow Run ID. The Session automatically covers its terminal state through
318
354
  `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.
355
+ next useful event. The terminal summary includes the target View Node only when the Session can
356
+ map it uniquely from authoritative launch or Canvas History facts. If `targetResolution` is
357
+ `unresolved` or `ambiguous`, query the Run and Canvas rather than guessing. Continue other work
358
+ first when it does not require the output, and use `getWorkflowRun` at a meaningful
359
+ authoritative checkpoint.
322
360
  7. Use `waitWorkflowRun` only when the next step actually requires terminal output and the current
323
361
  request lane can remain dedicated to waiting. Choose one intentional observation window; do not
324
362
  emulate polling with repeated short waits. An observation-window timeout while the authoritative
@@ -340,9 +378,24 @@ delivers each unchanged terminal fact once. User Workflow Interests are additive
340
378
  progress observations, but cannot remove or narrow the system terminal stream. This is Session
341
379
  discovery, not an account-wide or historical Workflow event log.
342
380
 
343
- Workflow Definitions change over time. Query `workflowDefinitions.summary`, then
381
+ Workflow Definitions change over time. Start with a bounded catalog page:
382
+
383
+ ```bash
384
+ az8 session query workflowDefinitions.summary --page-size 10
385
+ az8 session query workflowDefinitions.summary --workflow-target image --page-size 10
386
+ ```
387
+
388
+ The compact response reports `catalog.targetCounts`, filtered `pagination.total`, and an opaque
389
+ `pagination.nextCursor`. Continue only when more Definition identities are needed. Then query
344
390
  `workflowDefinition.detail` only when planning detail is insufficient. Never guess a Definition,
345
391
  configuration option, modality, cost, or media compatibility from its display name.
392
+ Summary discovery, defaults, planning, and start are filtered to Definitions available to the
393
+ authenticated account. Detail may retain an unavailable historical Definition for diagnosis and
394
+ marks it with `availableForAccount` and `accessReason`.
395
+
396
+ Workflow tags classify compatibility, access, and rollout; they are not pricing evidence.
397
+ `available:free` means a free-tier account may select that Workflow. It does not mean generation
398
+ costs zero credits. Use planning/start estimates and terminal usage records for credit information.
346
399
 
347
400
  The start Receipt may report `usage.credits.status` as `estimated`, `not-consumed`, or `unknown`.
348
401
  Estimated cost is informational, not final charged usage. There is no second confirmation. Never