@everfir/az8-cli 0.3.0 → 0.5.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/README.md CHANGED
@@ -18,7 +18,7 @@ az8 guide
18
18
  For a supplied release artifact, install the exact immutable tarball instead:
19
19
 
20
20
  ```bash
21
- npm install --global ./everfir-az8-cli-0.3.0.tgz
21
+ npm install --global ./everfir-az8-cli-0.5.0.tgz
22
22
  az8 --version
23
23
  ```
24
24
 
@@ -40,27 +40,41 @@ az8 guide --format json
40
40
  ```
41
41
 
42
42
  The guide teaches discovery; it does not freeze dynamic product schemas. After selecting a Project,
43
- the agent must query `capabilities.summary` and `capabilities.detail` for the effective Operations,
44
- permissions, input schema, History, completion, and retry semantics of the installed version and
45
- current account. Workflow Definition queries and `planGeneration` remain authoritative for current
46
- generation inputs.
43
+ the agent must query `capabilities.summary`, then focused `capabilities.detail --operation-name`
44
+ responses for the effective Operations, permissions, input schema, History, completion, and retry
45
+ semantics of the installed version and current account. Workflow Definition queries and
46
+ `planGeneration` remain authoritative for current generation inputs.
47
47
 
48
- ## Credentials and environment
48
+ ## Credentials
49
49
 
50
- Credentials must be provisioned outside the agent's recorded interaction. Use an ignored
51
- `.env.local`, an explicit env-file path, or an inherited process environment:
50
+ Use browser authorization for the default local account:
51
+
52
+ ```bash
53
+ az8 login
54
+ az8 whoami
55
+ az8 logout
56
+ ```
57
+
58
+ `login` opens AZ8 Studio, waits for explicit approval, validates the issued account, and stores the
59
+ credential in the current operating-system user's private AZ8 CLI
60
+ state directory. `whoami` reports the active account and credential source without exposing the
61
+ token. `logout` closes daemon Sessions that depend on that local credential and removes it locally;
62
+ it does not revoke copies on other machines. Use `login --no-open` when the browser must be opened
63
+ manually; the verification URL is emitted as structured progress on stderr.
64
+
65
+ Externally provisioned credentials remain supported for automation. Use an ignored `.env.local`,
66
+ an explicit env-file path, or an inherited process environment:
52
67
 
53
68
  ```dotenv
54
69
  AZ8_TOKEN=<operator-provisioned-secret>
55
- AZ8_ENVIRONMENT=test
56
70
  ```
57
71
 
58
- `AZ8_ENVIRONMENT` accepts `test` or `production`. Command-line `--environment` overrides the env
59
- value. Without `--env-file`, the CLI searches from the working directory upward for `.env.local`.
72
+ Without `--env-file`, the CLI searches from the working directory upward for `.env.local`.
60
73
  An explicit file is selected by path, for example
61
- `--environment test --env-file /secure/path/.env.local`. Agents must not read, print, edit, or ask
62
- users to paste credential contents; verify authentication with a bounded `projects list` read.
63
- Tokens must not be passed through argv or stdio protocol payloads.
74
+ `--env-file /secure/path/.env.local`. Process-environment credentials take
75
+ precedence over env files, which take precedence over the locally saved login. The CLI never
76
+ rewrites an env file or inherited environment. Agents must not read, print, edit, or ask users to
77
+ paste credential contents. Tokens must not be passed through argv or stdio protocol payloads.
64
78
 
65
79
  ## CLI architecture
66
80
 
@@ -69,7 +83,8 @@ validation boundary. CLI-specific code is organized by responsibility:
69
83
 
70
84
  - `src/cli/` owns program assembly, runtime config, persistent stdio transport, output framing, and
71
85
  package version resolution.
72
- - `src/commands/` declares Project, Canvas, and guide commands.
86
+ - `src/auth/` owns browser authorization, account-service exchange, and private local credentials.
87
+ - `src/commands/` declares account, Project, Canvas, and guide commands.
73
88
  - `src/agent-session/` owns isolated daemon lifecycles, local Session discovery, the private RPC
74
89
  carrier, Watch delivery, and current-context selection.
75
90
  - `src/canvas/` owns collaboration sessions, one-shot execution, awareness, and the NDJSON
@@ -100,12 +115,13 @@ indeterminate.
100
115
 
101
116
  ## First agent loop
102
117
 
103
- A new agent needs only the installed package, a token, and this document. Start by creating its own
104
- Project, then open one daemon-backed Agent Collaboration Session:
118
+ A new agent needs only the installed package, an authorized account, and this document. Confirm the
119
+ active identity, then create its own Project and open one daemon-backed Agent Collaboration Session:
105
120
 
106
121
  ```bash
122
+ az8 whoami
107
123
  az8 projects create --name "Agent preview workspace"
108
- az8 session open <project-id> --environment test
124
+ az8 session open <project-id>
109
125
  az8 session query capabilities.summary
110
126
  az8 session operation createNote --request-id preview-note-1 \
111
127
  --input-json '{"text":"Release smoke note","position":{"x":160,"y":160}}'
@@ -294,7 +310,7 @@ az8 canvas open <project-id> --write --format ndjson [--client-name codex]
294
310
  The process writes one `hello` frame, then waits for an `initialize` request on stdin:
295
311
 
296
312
  ```json
297
- {"protocolVersion":"1.0","requestId":"init-1","type":"initialize","payload":{"projectId":"<project-id>","client":{"name":"my-agent"},"observationPreset":"compact"}}
313
+ {"protocolVersion":"1.1","requestId":"init-1","type":"initialize","payload":{"projectId":"<project-id>","client":{"name":"my-agent"},"observationPreset":"compact"}}
298
314
  ```
299
315
 
300
316
  Before readiness the client hydrates the current authenticated account profile. Canvas Operations use
@@ -315,17 +331,25 @@ Node hierarchy operations, and the Stage 3 Core Node creative loop. Note operati
315
331
  `createGenerationTarget`, the compatible non-text `createMediaTarget`, `planGeneration`,
316
332
  `importExternalMedia`, `uploadMedia`, `editGenerationDraft`,
317
333
  `addVisualReference`, `removeVisualReference`, `startGeneration`, `getWorkflowRun`, and
318
- `waitWorkflowRun`. Capability detail is discoverable through `capabilities.detail`; callers should
319
- use it instead of hard-coding input schemas. Workflow Definitions are available through
320
- `workflowDefinitions.summary` and `workflowDefinition.detail` queries. Summary discovery, default
321
- Drafts, planning, and generation start use only Definitions available to the authenticated account.
322
- Detail may retain an unavailable historical Definition for diagnosis with
323
- `availableForAccount: false` and an `accessReason`.
334
+ `waitWorkflowRun`. Capability detail is discoverable through
335
+ `capabilities.detail --operation-name <operation-name>`; callers should select only the Operation
336
+ they plan to invoke instead of loading every schema or hard-coding inputs. Workflow Definitions are
337
+ available through `workflowDefinitions.summary` and `workflowDefinition.detail` queries.
338
+ `workflowDefinitions.summary` always returns a compact paginated catalog with a default page size of
339
+ 10, target counts, and an opaque next cursor; use `--workflow-target`, `--page-size`, and `--cursor`
340
+ to narrow or continue it. Summary discovery, default Drafts, planning, and generation start use only
341
+ Definitions available to the authenticated account. Detail may retain an unavailable historical
342
+ Definition for diagnosis with `availableForAccount: false` and an `accessReason`.
324
343
 
325
344
  Workflow tags describe classification, compatibility, access, and rollout rather than price.
326
345
  `available:free` means a free-tier account may select the Workflow; it does not mean zero-credit
327
346
  generation. Credit claims must come from planning/start estimates or terminal usage records.
328
347
 
348
+ `getCoreNode` requires a non-empty unique `coreNodeIds` batch and returns `coreNodes` in the same
349
+ order. If any requested Core Node does not exist, the whole read fails instead of returning an
350
+ ambiguous partial result. The CLI adapter uses the backend's batch endpoint and transparently chunks
351
+ large requests.
352
+
329
353
  Before editing a Draft, an agent can call the read-only `planGeneration` Operation for an existing
330
354
  generation target. It recommends a Definition from the target and resolved generation-reference modalities,
331
355
  constructs configuration defaults, validates required inputs, and returns compact alternatives plus
@@ -334,15 +358,18 @@ field metadata, including dynamic enum options. Planning never creates a Core No
334
358
  Canvas; returned Operations still execute independently and stop at the first failure.
335
359
 
336
360
  Generation references always identify visible Canvas placements. Public planning and
337
- `addVisualReference` accept only a View Node ID. If desired content exists only as a Core Node, call
361
+ `addVisualReference` accept only View Node IDs. `addVisualReference` requires a non-empty unique
362
+ `referenceViewNodeIds` batch; `removeVisualReference` requires a non-empty unique `referenceIds`
363
+ batch. Both Operations validate the complete batch before one atomic Draft write, so a failure never
364
+ leaves a partial batch. If desired content exists only as a Core Node, call
338
365
  `placeCoreNode` first, wait for its successful Receipt, and reference the returned View Node. This
339
366
  preserves the same visible inferred connection as Web and avoids guessing when one Core Node has
340
367
  multiple Canvas placements. Manual Text Resources are valid prompt references even though they do
341
368
  not have a Core Node before generation starts. Their View Node binding remains in the launch history
342
369
  for Web lineage and inferred-edge rendering; estimation uses the current text and materialization
343
370
  creates the Text Core Node only after the estimate succeeds. The published operation names
344
- `addVisualReference` and `removeVisualReference` are retained for compatibility and also carry these
345
- planned Text bindings.
371
+ `addVisualReference` and `removeVisualReference` cover these planned Text bindings as well as image
372
+ and video bindings.
346
373
 
347
374
  `insertPromptReference` additionally places the platform-owned At token at `start`, `end`, or
348
375
  before/after an exact text anchor such as
@@ -351,7 +378,7 @@ only for a unique anchor. Missing or ambiguous anchors fail without writing. Cal
351
378
  At syntax, binding IDs, or slot indexes.
352
379
 
353
380
  ```json
354
- {"protocolVersion":"1.0","requestId":"plan-1","type":"operation","payload":{"name":"planGeneration","input":{"targetViewNodeId":"<target-id>","prompt":"A quiet observatory","references":[{"viewNodeId":"<reference-id>"}],"detail":"detail"}}}
381
+ {"protocolVersion":"1.1","requestId":"plan-1","type":"operation","payload":{"name":"planGeneration","input":{"targetViewNodeId":"<target-id>","prompt":"A quiet observatory","references":[{"viewNodeId":"<reference-id>"}],"detail":"detail"}}}
355
382
  ```
356
383
 
357
384
  `editNoteContent`, `setNoteColor`, `editTextContent`, `renameViewNode`, and `resizeViewNodes` match
@@ -370,41 +397,41 @@ is scoped to siblings with the same parent. Decoration, Asset, and all World tar
370
397
  Example write:
371
398
 
372
399
  ```json
373
- {"protocolVersion":"1.0","requestId":"create-1","type":"operation","payload":{"name":"createNote","input":{"text":"idea","position":{"x":160,"y":160}}}}
400
+ {"protocolVersion":"1.1","requestId":"create-1","type":"operation","payload":{"name":"createNote","input":{"text":"idea","position":{"x":160,"y":160}}}}
374
401
  ```
375
402
 
376
403
  Example Stage 2 edits:
377
404
 
378
405
  ```json
379
- {"protocolVersion":"1.0","requestId":"edit-1","type":"operation","payload":{"name":"editNoteContent","input":{"viewNodeId":"view_node_1","text":"revised idea"}}}
380
- {"protocolVersion":"1.0","requestId":"color-1","type":"operation","payload":{"name":"setNoteColor","input":{"viewNodeId":"view_node_1","color":"purple"}}}
381
- {"protocolVersion":"1.0","requestId":"text-1","type":"operation","payload":{"name":"createTextNode","input":{"text":"A manual Text Resource","name":"Draft copy","position":{"x":520,"y":160}}}}}
382
- {"protocolVersion":"1.0","requestId":"resize-1","type":"operation","payload":{"name":"resizeViewNodes","input":{"resizes":[{"viewNodeId":"view_node_1","size":{"width":420,"height":360}}]}}}
383
- {"protocolVersion":"1.0","requestId":"duplicate-1","type":"operation","payload":{"name":"duplicateViewNodes","input":{"viewNodeIds":["view_node_1"]}}}
406
+ {"protocolVersion":"1.1","requestId":"edit-1","type":"operation","payload":{"name":"editNoteContent","input":{"viewNodeId":"view_node_1","text":"revised idea"}}}
407
+ {"protocolVersion":"1.1","requestId":"color-1","type":"operation","payload":{"name":"setNoteColor","input":{"viewNodeId":"view_node_1","color":"purple"}}}
408
+ {"protocolVersion":"1.1","requestId":"text-1","type":"operation","payload":{"name":"createTextNode","input":{"text":"A manual Text Resource","name":"Draft copy","position":{"x":520,"y":160}}}}}
409
+ {"protocolVersion":"1.1","requestId":"resize-1","type":"operation","payload":{"name":"resizeViewNodes","input":{"resizes":[{"viewNodeId":"view_node_1","size":{"width":420,"height":360}}]}}}
410
+ {"protocolVersion":"1.1","requestId":"duplicate-1","type":"operation","payload":{"name":"duplicateViewNodes","input":{"viewNodeIds":["view_node_1"]}}}
384
411
  ```
385
412
 
386
413
  Example hierarchy sequence (each successful write is one independent undoable interaction):
387
414
 
388
415
  ```json
389
- {"protocolVersion":"1.0","requestId":"group-1","type":"operation","payload":{"name":"groupViewNodes","input":{"viewNodeIds":["view_node_1","view_node_2"],"name":"References"}}}
390
- {"protocolVersion":"1.0","requestId":"reparent-1","type":"operation","payload":{"name":"moveViewNodes","input":{"moves":[{"id":"view_node_3","position":{"x":640,"y":360},"targetParentId":"<group-id>"}]}}}
391
- {"protocolVersion":"1.0","requestId":"front-1","type":"operation","payload":{"name":"updateViewNodeStacking","input":{"viewNodeId":"view_node_3","direction":"front"}}}
392
- {"protocolVersion":"1.0","requestId":"ungroup-1","type":"operation","payload":{"name":"ungroupViewNode","input":{"groupViewNodeId":"<group-id>"}}}
416
+ {"protocolVersion":"1.1","requestId":"group-1","type":"operation","payload":{"name":"groupViewNodes","input":{"viewNodeIds":["view_node_1","view_node_2"],"name":"References"}}}
417
+ {"protocolVersion":"1.1","requestId":"reparent-1","type":"operation","payload":{"name":"moveViewNodes","input":{"moves":[{"id":"view_node_3","position":{"x":640,"y":360},"targetParentId":"<group-id>"}]}}}
418
+ {"protocolVersion":"1.1","requestId":"front-1","type":"operation","payload":{"name":"updateViewNodeStacking","input":{"viewNodeId":"view_node_3","direction":"front"}}}
419
+ {"protocolVersion":"1.1","requestId":"ungroup-1","type":"operation","payload":{"name":"ungroupViewNode","input":{"groupViewNodeId":"<group-id>"}}}
393
420
  ```
394
421
 
395
422
  Example Stage 3 generation sequence (each line is a separate ordered interaction):
396
423
 
397
424
  ```json
398
- {"protocolVersion":"1.0","requestId":"target-1","type":"operation","payload":{"name":"createGenerationTarget","input":{"contentType":"image"}}}
399
- {"protocolVersion":"1.0","requestId":"draft-1","type":"operation","payload":{"name":"editGenerationDraft","input":{"viewNodeId":"<target-id>","definitionId":"<definition-id>","prompt":"A quiet observatory","config":{"aspect_ratio":"16:9"}}}}
400
- {"protocolVersion":"1.0","requestId":"start-1","type":"operation","payload":{"name":"startGeneration","input":{"viewNodeId":"<target-id>"}}}
401
- {"protocolVersion":"1.0","requestId":"wait-1","type":"operation","payload":{"name":"waitWorkflowRun","input":{"workflowRunId":"<run-id>"},"timeoutMs":120000}}
425
+ {"protocolVersion":"1.1","requestId":"target-1","type":"operation","payload":{"name":"createGenerationTarget","input":{"contentType":"image"}}}
426
+ {"protocolVersion":"1.1","requestId":"draft-1","type":"operation","payload":{"name":"editGenerationDraft","input":{"viewNodeId":"<target-id>","definitionId":"<definition-id>","prompt":"A quiet observatory","config":{"aspect_ratio":"16:9"}}}}
427
+ {"protocolVersion":"1.1","requestId":"start-1","type":"operation","payload":{"name":"startGeneration","input":{"viewNodeId":"<target-id>"}}}
428
+ {"protocolVersion":"1.1","requestId":"wait-1","type":"operation","payload":{"name":"waitWorkflowRun","input":{"workflowRunId":"<run-id>"},"timeoutMs":120000}}
402
429
  ```
403
430
 
404
431
  Example public media URL import:
405
432
 
406
433
  ```json
407
- {"protocolVersion":"1.0","requestId":"import-1","type":"operation","payload":{"name":"importExternalMedia","input":{"contentType":"image","idempotencyKey":"reference-image-1","url":"https://example.com/reference.png","name":"Reference image","position":{"x":640,"y":160}}}}
434
+ {"protocolVersion":"1.1","requestId":"import-1","type":"operation","payload":{"name":"importExternalMedia","input":{"contentType":"image","idempotencyKey":"reference-image-1","url":"https://example.com/reference.png","name":"Reference image","position":{"x":640,"y":160}}}}
408
435
  ```
409
436
 
410
437
  `idempotencyKey` is required. Repeating the same normalized input returns the existing View Node and
@@ -459,7 +486,7 @@ from TypeScript source:
459
486
  Project, Session, persistent Canvas, one-shot, upload, and download entry points; and `az8 guide`
460
487
  plus its JSON form work without credentials or network access.
461
488
  2. With no credential, an authenticated command fails without connecting and without printing a
462
- token. With the test token, `projects create` returns a new Project owned by the authenticated
489
+ token. With the acceptance credential, `projects create` returns a new Project owned by the authenticated
463
490
  account.
464
491
  3. A daemon-backed Session opens, becomes current, accepts a summary query and one semantic write,
465
492
  reports healthy status, delivers an interested external change through `watch`, returns `idle`
@@ -472,7 +499,7 @@ from TypeScript source:
472
499
  6. Upload one small local media file, confirm immediate detail resolution to its Core Node, replay
473
500
  the same idempotency key without another transfer, and download the resolved media to a fresh
474
501
  destination whose SHA-256 is reported.
475
- 7. Run repository `pnpm verify`, retain the tarball SHA-512, and record the tested environment. Never
476
- perform these acceptance writes against production.
502
+ 7. Run repository `pnpm verify`, retain the tarball SHA-512, and record the internal acceptance
503
+ target. Follow the repository-only release instructions for that target.
477
504
 
478
505
  Release and rollback commands are in `RELEASE.md`; package changes are in `CHANGELOG.md`.