@oiioii/cli 0.1.6 → 0.1.8

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.
Files changed (3) hide show
  1. package/README.md +193 -17
  2. package/dist/cli.js +35 -31
  3. package/package.json +8 -1
package/README.md CHANGED
@@ -17,13 +17,18 @@ human-readable output and a stable JSON envelope for AI agents and automation.
17
17
  | `auth logout` | Remove locally persisted authentication without exposing the API Key | Implemented |
18
18
  | `workspace create/set/current/rename` | Create, configure, inspect, and rename workspaces | Implemented |
19
19
  | `workspace assets list/download` | List workspace assets and download ready resources | Implemented |
20
+ | `workspace canvas create` | Create ordered blank nodes, prompts, references, and groups without client-side layout | Implemented |
21
+ | `workspace canvas node update` | Update prompt, generation parameters, and references on an empty canvas node | Implemented |
22
+ | `workspace canvas group create` | Group two or more existing canvas nodes without changing their layout | Implemented |
23
+ | `library create/list/search/members` | Create and query role, scene, item, and collection assets, including collection members | Implemented |
20
24
  | `image text` | Text-to-image generation | Implemented |
21
25
  | `image edit` | Image-to-image editing | Implemented |
22
26
  | `video text` | Text-to-video generation | Implemented |
23
27
  | `video image` | Image-to-video generation | Implemented |
24
28
  | `video generate` | Model-validated mixed image/video/audio reference generation | Implemented |
25
29
  | `audio generate` | Seed Audio and Suno audio/music generation | Implemented |
26
- | `upload file` | Upload local image/video/audio resources | Implemented |
30
+ | `upload resource` | Upload image/video/audio resources without a workspace | Implemented |
31
+ | `upload file` | Upload image/video/audio and attach it to a workspace | Implemented |
27
32
  | `record get/open` | Query generation metadata and download resources | Implemented |
28
33
  | `inspect capabilities/models` | Inspect declared capabilities and live backend models | Implemented |
29
34
  | `preview latest/bundle` | Read local preview bundles created by generation commands | Implemented |
@@ -34,21 +39,22 @@ human-readable output and a stable JSON envelope for AI agents and automation.
34
39
  Important current limitations:
35
40
 
36
41
  - API keys are stored in `~/.oiioii/config.json` after `oiioii auth login`; the file is owner-readable only (`0600`).
37
- - Generation submits `submit_async_media_generation` and returns immediately with the authoritative backend `task_id` plus a `local_task_id`.
42
+ - Generation submits `POST /v1/media/generations` by default and returns immediately with the authoritative backend `task_id` plus a `local_task_id`.
38
43
  - The backend task ID, workspace, media type, asset ID, progress, and terminal outputs are cached in the owner-only local task store.
39
- - `task status/wait` query `query_async_media_generation` for non-terminal cached tasks and accept either the backend or local task ID.
44
+ - `task status/wait` query the stored task transport for non-terminal cached tasks and accept either the backend or local task ID.
40
45
  - If submission times out or disconnects before the backend task ID is received, the task remains `submitting`; `task retry <local_task_id>` resends the saved request with the original idempotency key.
41
46
  - REST metadata requests time out after 30 seconds; raw resource uploads/downloads use a 5-minute transfer timeout, and VOD transcode polling has a 10-minute overall deadline.
42
47
  - Image, video, and audio generation create local preview bundles after a queried task reaches a terminal state.
43
48
  - `inspect capabilities` is local metadata; `inspect models` requires authentication and queries the active backend.
44
- - Asset search/update/delete and style-library commands are not available. Workspace-scoped asset listing and download are available.
49
+ - Style-library mutation commands are not available. Reusable asset creation, query, update, deletion, collection membership management, and workspace-scoped asset listing/download are available.
45
50
 
46
51
  ## Requirements
47
52
 
48
53
  - Node.js 18.18 or newer when running from source or the npm package.
49
54
  - A Hogi account for browser authorization, or an existing Hogi MCP API Key.
50
- - A workspace ID for image/video/audio generation and resource upload. It can be
55
+ - A workspace ID for image/video/audio generation and `upload file`. It can be
51
56
  created with `oiioii workspace create` or supplied from an existing project.
57
+ `upload resource` does not require a workspace.
52
58
  - `npm` is the repository package manager.
53
59
 
54
60
  The hosted installer uses Node.js 18.18 or newer when available. If no compatible
@@ -275,6 +281,138 @@ oiioii workspace assets download <asset_id> --output ./downloads --json
275
281
  identity to the asset's downloadable `uri`; loading, uploading, empty, failed,
276
282
  or URI-less assets fail before the download request.
277
283
 
284
+ Create blank canvas nodes and groups from a JSON file. The file contains only
285
+ composition data; select the workspace with the normal root option, environment
286
+ variable, local default, or the optional command argument:
287
+
288
+ ```json
289
+ {
290
+ "nodes": [
291
+ {
292
+ "client_id": "cover",
293
+ "type": "image",
294
+ "title": "Cover",
295
+ "prompt": "A cat based on @图片1 in a neon street",
296
+ "generation_config": {
297
+ "mcp_method_name": "generate_image_nanopro",
298
+ "model_version": "nano-banana-pro",
299
+ "ratio": "16:9",
300
+ "resolution": "2k",
301
+ "quality": "high"
302
+ },
303
+ "references": [
304
+ { "kind": "media", "media_type": "image", "uri": "hogi://image/cat.png" }
305
+ ]
306
+ },
307
+ { "client_id": "motion", "type": "video", "title": "Motion" }
308
+ ],
309
+ "groups": [
310
+ {
311
+ "client_id": "story",
312
+ "title": "Story",
313
+ "members": [
314
+ { "client_node_id": "motion" },
315
+ { "client_node_id": "cover" }
316
+ ]
317
+ }
318
+ ]
319
+ }
320
+ ```
321
+
322
+ ```bash
323
+ oiioii workspace canvas create --input ./composition.json --json
324
+ oiioii workspace canvas create <workspace_id> \
325
+ --input ./composition.json \
326
+ --idempotency-key canvas-request-1 \
327
+ --json
328
+ ```
329
+
330
+ Node order follows `nodes`; `groups[].members` controls group membership order.
331
+ The CLI does not accept coordinates or compute layout. Use the same explicit
332
+ idempotency key only when replaying the same uncertain request. Optional
333
+ `generation_config` caches the empty node's model selection and generation
334
+ parameters for the existing Web editor. It accepts `mcp_method_name`,
335
+ `model_version`, `ratio`, `duration`, `resolution`, and `quality`; a
336
+ `model_version` requires a matching `mcp_method_name`.
337
+ For create and node update, indexed prompt mentions are converted by the CLI to
338
+ the self-contained protocol used by the Web canvas before the request is sent.
339
+ `@图N` / `@图片N` address image and role/scene/item references, while
340
+ `@音频N` and `@视频N` address their own media reference sequences. For example,
341
+ `@图片1` with `hogi://image/cat.png` becomes `[Image:image/cat.png]`.
342
+ Unresolved indexes remain unchanged. OpenAPI/curl callers must send the
343
+ self-contained protocol directly; this shorthand is a CLI-only capability.
344
+
345
+ Group two or more existing canvas nodes by their asset IDs:
346
+
347
+ ```bash
348
+ oiioii workspace canvas group create <asset_id_1> <asset_id_2> \
349
+ --title "Story" \
350
+ --workspace-id <workspace_id> \
351
+ --idempotency-key group-request-1 \
352
+ --json
353
+ ```
354
+
355
+ The command rejects duplicate members and nodes that already belong to another
356
+ group. It changes group membership only: it does not move nodes, compute a
357
+ layout, or accept coordinates. Reuse an idempotency key only for the identical
358
+ workspace, member order, and title.
359
+
360
+ Update an existing empty node with explicit field options:
361
+
362
+ ```bash
363
+ oiioii workspace canvas node update <asset_id> \
364
+ --workspace-id <workspace_id> \
365
+ --prompt "Use @图片1: a cat looking through a rainy window" \
366
+ --model "Nano Pro" \
367
+ --variant "nano-banana-pro" \
368
+ --ratio "16:9" \
369
+ --quality high \
370
+ --reference 'hogi://image/<reference-id>' 'hogi://role_asset/<role-id>' \
371
+ --json
372
+ ```
373
+
374
+ `--model` and optional `--variant` resolve through the active model catalog;
375
+ `--model-id` selects the catalog row directly. Use `--clear-prompt`,
376
+ `--clear-model`, `--clear-ratio`, `--clear-duration`, `--clear-resolution`,
377
+ `--clear-quality`, or `--clear-references` for explicit clears. Omitted options
378
+ keep their existing values. The server accepts this operation only when the
379
+ global `enable_cli_empty_canvas_node_update` flag is enabled for the caller and
380
+ the current asset status is `empty`. URI, status, type, position, title, group,
381
+ and raw metadata updates are not accepted. Completed, loading, uploading, and
382
+ failed nodes are rejected.
383
+
384
+ Create, query, or search reusable library assets before generation:
385
+
386
+ ```bash
387
+ oiioii library create role --name "Hero" --emo-image 'hogi://image/<expression-id>' --json
388
+ oiioii library create collection --name "Cast" --member 'hogi://role_asset/<id>' 'group:<id>' --json
389
+ oiioii library create scene --input ./scene.json --idempotency-key scene-import-001 --json
390
+ oiioii library list role --limit 20 --json
391
+ oiioii library list collection --limit 20 --json
392
+ oiioii library search role "球球" --limit 20 --json
393
+ oiioii library search collection "主要角色" --limit 20 --json
394
+ oiioii library search scene "森林" --cursor '<next_cursor>' --json
395
+ oiioii library members <collection-id> --type role --keyword "主角" --limit 20 --json
396
+ oiioii library members <collection-id> --cursor '<next_cursor>' --json
397
+ oiioii library add-members <collection-id> 'hogi://role_asset/<id>' 'group:<id>' --json
398
+ oiioii library remove-members <collection-id> 'hogi://role_asset/<id>' 'group:<id>' --json
399
+ ```
400
+
401
+ Collection list items use their `asset_id` as the stable identity and return
402
+ `asset_uri: null`. They include `member_count` without expanding the complete
403
+ member list. Use `next_cursor` with `--cursor` to continue pagination.
404
+ `library members` returns normalized role, scene, item, and group entries. Each
405
+ entry includes an `asset_ref` that can be passed directly to collection member
406
+ commands (`hogi://<type>_asset/<id>` or `group:<id>`).
407
+ `library remove-members` is idempotent and applies removals against the latest
408
+ Backend collection state instead of fetching and replacing the full member list
409
+ from the CLI.
410
+
411
+ Use the returned `asset_uri` with `--asset`, or bind a prompt mention explicitly
412
+ with `--bind <name=asset-uri>`. Explicit bindings avoid silently selecting the
413
+ wrong asset when the library contains duplicate display names.
414
+ Reuse the returned `idempotency_key` when retrying an uncertain create request.
415
+
278
416
  Workspace resolution order is:
279
417
 
280
418
  1. Root `--workspace <id>` option.
@@ -291,6 +429,11 @@ oiioii image text \
291
429
  --model seedream45 \
292
430
  --resolution 2K \
293
431
  --json
432
+
433
+ oiioii image text \
434
+ --prompt "让@球球坐在窗边" \
435
+ --bind 球球=hogi://role_asset/<role_id> \
436
+ --json
294
437
  ```
295
438
 
296
439
  Image editing:
@@ -304,15 +447,22 @@ oiioii image edit \
304
447
  --json
305
448
  ```
306
449
 
450
+ For GPT Image 2, add `--transparent` to either `image text` or `image edit`
451
+ to request a transparent-background PNG. Other models reject this option.
452
+
453
+ ```bash
454
+ oiioii image text --prompt "an isolated sticker" --model gpt-image2 --transparent --json
455
+ ```
456
+
307
457
  Current behavior:
308
458
 
309
459
  - Accepts `--model-id <id>` from `inspect models` for exact backend model
310
460
  selection, or `--model <key> --variant <variant>` as an alternative.
311
- - Calls `POST /mcp/genai/sse` with JSON-RPC `tools/call` and `submit_async_media_generation`.
461
+ - Calls `POST /v1/media/generations` with Bearer authentication and an idempotency header.
312
462
  - Authenticates with `x-hogi-api-key`.
313
463
  - Requires an active workspace.
314
464
  - Returns after submission; use `task status` or `task wait` to query progress and terminal `hogi://image/...` output.
315
- - Image editing adapts the source URI to the async service's `referenceImages` contract.
465
+ - Image editing sends the source URI through the structured `references` contract.
316
466
  - When image shape options are omitted, the CLI uses the exact selected model
317
467
  catalog row's first aspect ratio and resolution (falling back only when the
318
468
  catalog leaves those fields empty).
@@ -359,6 +509,13 @@ oiioii video generate \
359
509
  --duration 8 \
360
510
  --resolution 720p \
361
511
  --json
512
+
513
+ oiioii video generate \
514
+ --prompt "小猫跳舞@球球" \
515
+ --bind 球球=hogi://role_asset/<role_id> \
516
+ --asset hogi://scene_asset/<scene_id> \
517
+ --model seedance25 \
518
+ --json
362
519
  ```
363
520
 
364
521
  When video duration, aspect ratio, or resolution is omitted, the CLI resolves
@@ -370,15 +527,20 @@ Current behavior:
370
527
 
371
528
  - Accepts `--model-id <id>` from `inspect models` for exact backend model
372
529
  selection, or `--model <key> --variant <variant>` as an alternative.
373
- - Calls `submit_async_media_generation` through `/mcp/genai/sse` with `x-hogi-api-key` authentication.
530
+ - Calls `POST /v1/media/generations` with Bearer authentication.
374
531
  - Returns after submission; terminal video URI validation happens during `task status/wait`.
375
532
  - Text-to-video sends `prompt`, `duration`, `aspectRatio`, `resolution`, and
376
533
  `workspace_id`.
377
- - Model-specific `imageUrl`/`images` fields are validated locally, then adapted
378
- to the async service's `referenceImages` field with `generateMode` preserved.
534
+ - Model-specific reference fields are validated locally, then sent through the
535
+ structured OpenAPI `references` list with `generateMode` preserved.
379
536
  - `video generate` accepts zero or more `--image`, `--video`, and `--audio`
380
537
  references in the same request. `--mode auto` derives `text2Video` or
381
538
  `omni2Video`; frame semantics can be selected explicitly with `--mode`.
539
+ - Seedance 2.5 omni requests accept `--task-type reference|edit|extend`.
540
+ - `--asset` adds role/scene/item assets as visual references. `--bind` also
541
+ rewrites an exact `@name` occurrence to `[Role:<id>]`, `[Scene:<id>]`, or
542
+ `[Item:<id>]`. Workspace-asset references use OpenAPI so the backend can apply
543
+ visibility checks, main-image resolution, and Seedance role head-combo selection.
382
544
  - Reference fields, combinations, and limits are validated against an exact
383
545
  backend-tool contract before MCP submission. The current mixed-input matrix is:
384
546
  Seedance 2.0/2.5 (image + video + audio), MiniMax H3
@@ -433,17 +595,16 @@ unbounded automated loops, and do not retry failures blindly.
433
595
 
434
596
  ## Async Generation and Workspace Assets
435
597
 
436
- Image, video, and audio commands submit through:
598
+ Image, video, and audio commands submit through OpenAPI by default:
437
599
 
438
600
  ```text
439
- POST /mcp/genai/sse
440
- method: tools/call
441
- name: submit_async_media_generation
601
+ POST /v1/media/generations
602
+ GET /v1/media/generations/:task_id
442
603
  ```
443
604
 
444
605
  The backend creates the loading workspace asset and returns its `assetId` and
445
- authoritative `taskId`. The CLI caches both IDs. `task status/wait` calls
446
- `query_async_media_generation`, reconciles progress/error/output into the local
606
+ authoritative `taskId`. The CLI caches both IDs and the selected transport.
607
+ `task status/wait` queries the same transport, reconciles progress/error/output into the local
447
608
  record, and creates the terminal preview bundle. The CLI does not issue a second
448
609
  `create_asset` call, which avoids duplicate workspace assets.
449
610
 
@@ -452,6 +613,12 @@ record, and creates the terminal preview bundle. The CLI does not issue a second
452
613
  Upload image, video, or audio bytes:
453
614
 
454
615
  ```bash
616
+ # Pure resource upload for library/collection inputs; no workspace required
617
+ oiioii upload resource ./image.png --json
618
+ oiioii upload resource ./clip.mp4 --json
619
+ oiioii upload resource ./voice.mp3 --json
620
+
621
+ # Upload and attach to the active workspace
455
622
  oiioii upload file ./image.png --json
456
623
  oiioii upload file ./clip.mp4 --json
457
624
  oiioii upload file ./voice.mp3 --json
@@ -474,6 +641,11 @@ oiioii upload file ./voice.mp3 --after-asset-id <asset_id> --json
474
641
 
475
642
  Upload behavior:
476
643
 
644
+ - `upload resource` uploads small media through `POST /v1/res/uploadFile` and returns
645
+ only the reusable resource URI; it does not read or update a workspace.
646
+ - MOV files and videos of 10 MB or larger use the standalone VOD flow for
647
+ `upload resource`: `media_uploads/prepare` -> direct VOD upload -> `commit` -> `status`.
648
+ - `upload file` preserves the original workspace-bound behavior below.
477
649
  - Images, audio, and videos smaller than 10 MB use raw `application/octet-stream` bytes at
478
650
  `POST /v1/workspace/uploadAsset` with `workspace_id`, `file_type`, and optional
479
651
  `file_name` / `after_asset_id` query parameters.
@@ -494,7 +666,7 @@ Upload behavior:
494
666
  - `--attach` is retained as a no-op compatibility flag because uploads are now
495
667
  always attached.
496
668
  - A storage or workspace-write failure fails the upload command.
497
- - Arbitrary documents and URL uploads are outside the current scope.
669
+ - Arbitrary URL uploads are outside the current scope.
498
670
 
499
671
  Supported extensions:
500
672
 
@@ -916,6 +1088,10 @@ Environment variables:
916
1088
  |---|---|
917
1089
  | `OIIOII_CONFIG_DIR` | Override the local configuration directory |
918
1090
  | `OIIOII_BASE_URL` | Override the backend URL at runtime |
1091
+ | `OIIOII_GENERATION_TRANSPORT` | Select `openapi` (default) or the `mcp` rollback transport |
1092
+
1093
+ The MCP rollback transport preserves the legacy media-reference payload. Prompt
1094
+ references to role, scene, or item workspace assets require the default OpenAPI transport.
919
1095
  | `OIIOII_WORKSPACE_ID` | Override the active workspace |
920
1096
  | `OIIOII_BUILD_ENV` | Select `production`, `test`, or `local` while building |
921
1097
  | `OIIOII_PRODUCTION_BASE_URL` | Optional override for the production build's canonical backend URL |