@oiioii/cli 0.1.1 → 0.1.5

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 +81 -19
  2. package/dist/cli.js +43 -7627
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@ human-readable output and a stable JSON envelope for AI agents and automation.
12
12
 
13
13
  | Command | Capability | Status |
14
14
  |---|---|---|
15
- | `auth login` | Persist API Key and backend configuration | Implemented |
15
+ | `auth login` | Browser authorization for terminal/Codex/WorkBuddy/Kimi/Claude Code/DeepSeek, or explicit API Key persistence | Implemented |
16
16
  | `workspace create/set/current/rename` | Create, configure, inspect, and rename workspaces | Implemented |
17
17
  | `workspace assets list/download` | List workspace assets and download ready resources | Implemented |
18
18
  | `image text` | Text-to-image generation | Implemented |
@@ -44,7 +44,7 @@ Important current limitations:
44
44
  ## Requirements
45
45
 
46
46
  - Node.js 18.18 or newer when running from source or the npm package.
47
- - An existing Hogi MCP API Key.
47
+ - A Hogi account for browser authorization, or an existing Hogi MCP API Key.
48
48
  - A workspace ID for image/video/audio generation and resource upload. It can be
49
49
  created with `oiioii workspace create` or supplied from an existing project.
50
50
  - `npm` is the repository package manager.
@@ -123,20 +123,20 @@ rebuilt from the checkout.
123
123
 
124
124
  ## Build Environments
125
125
 
126
- The default backend URL is embedded into the generated bundle at build time.
126
+ The default backend URL and browser authorization page are embedded into the generated bundle at build time.
127
127
 
128
- | Build command | Environment | Embedded default backend |
129
- |---|---|---|
130
- | `npm run build:production` | production | `OIIOII_PRODUCTION_BASE_URL` from `.env` |
131
- | `npm run build:test` | test | `OIIOII_TEST_BASE_URL` from `.env` |
132
- | `npm run build:local` | local | `http://localhost:4000` |
128
+ | Build command | Environment | Embedded default backend | Authorization page |
129
+ |---|---|---|---|
130
+ | `npm run build:production` | production | `https://api.oiioii.ai` (optional `OIIOII_PRODUCTION_BASE_URL` override) | `https://oiioii.tv/auth/cli` |
131
+ | `npm run build:test` | test | `OIIOII_TEST_BASE_URL` from `.env` | Build-specific test authorization page |
132
+ | `npm run build:local` | local | `http://localhost:4000` | `http://localhost:3000/auth/cli` |
133
133
 
134
- Copy the environment template once, then use the environment-specific build
135
- entry points:
134
+ Use the environment-specific build entry points. Only test builds require a
135
+ URL in `.env`:
136
136
 
137
137
  ```bash
138
- cp .env.example .env
139
138
  npm run build:production
139
+ cp .env.example .env
140
140
  npm run build:test
141
141
  ```
142
142
 
@@ -168,8 +168,36 @@ The embedded URL is a fallback. Existing runtime overrides remain available:
168
168
 
169
169
  ## Authentication and Workspace
170
170
 
171
- Persist an existing MCP API Key. The CLI keeps the backend URL embedded for its
172
- build environment unless you explicitly override it:
171
+ Authorize through the Hogi browser page for the application that launched the CLI:
172
+
173
+ ```bash
174
+ oiioii auth login
175
+ oiioii auth login --codex
176
+ oiioii auth login --workbuddy
177
+ oiioii auth login --kimi
178
+ oiioii auth login --claude-code
179
+ oiioii auth login --deepseek
180
+ ```
181
+
182
+ Without an application option, `auth login` opens the browser authorization page
183
+ and asks the user to return to the terminal when authorization completes. The
184
+ application options label the authorization for the selected host. Codex and
185
+ WorkBuddy use verified macOS/Windows activation contracts; other targets print
186
+ the localized manual-return fallback when no verified OS activation contract is
187
+ available. The browser flow uses a loopback callback, state validation, and PKCE. It creates
188
+ an API Key through the current build's backend, stores it locally, and requests
189
+ that macOS or Windows return to the selected application after the hosted success
190
+ page acknowledges it is ready, with a bounded fallback if that acknowledgement is blocked. If the browser or app
191
+ cannot be opened, the CLI prints a localized manual fallback. Use `--no-browser`
192
+ to print the authorization URL for a headless environment.
193
+
194
+ Browser authorization only runs against the backend paired with the current CLI
195
+ build. Remove `OIIOII_BASE_URL` and use `--reset-base-url` when an older persisted
196
+ override is present. For a custom backend, use the explicit `--api-key` mode.
197
+
198
+ You can still persist an existing MCP API Key only through the explicit
199
+ `--api-key` mode. The CLI keeps the backend URL
200
+ embedded for its build environment unless you explicitly override it:
173
201
 
174
202
  ```bash
175
203
  oiioii auth login --api-key "oii_sk_..."
@@ -717,15 +745,43 @@ feature.started
717
745
  -> feature.completed | feature.failed
718
746
  ```
719
747
 
720
- This is CLI-side observability only. It does not collect or depend on logs from
721
- inside the Hogi backend.
722
-
723
- Recorded API events use the same `request_id` for correlation:
748
+ Logs remain local; backend response IDs link them to server logs without
749
+ downloading server logs. Recorded API events use the same `clientRequestId`
750
+ (also stored as the backwards-compatible `request_id`) for local correlation:
724
751
 
725
752
  ```text
726
753
  api.request -> api.response | api.error
727
754
  ```
728
755
 
756
+ | Field | Meaning |
757
+ | --- | --- |
758
+ | `id` | Unique local log record ID, not a backend chain ID. |
759
+ | `trace_id` | One CLI command, including all of its HTTP calls. |
760
+ | `clientRequestId` / legacy `request_id` | One local API call, pairing its start and result/error. |
761
+ | `logid` | Backend chain ID read from response header `x-logid`. |
762
+ | `requestId` | Current gateway request ID read from response header `x-request-id`; never generated by CLI. |
763
+ | `uid` | Server request identity returned in `x-hogi-log-uid`, or already verified for the command's endpoint/credential. Public routes can return `anonymous_user`. |
764
+ | `workspaceId` | Explicit business target, command workspace, or `x-hogi-log-workspace-id` from the response. |
765
+
766
+ CLI sends an optional `x-workspace-id` diagnostic hint. Authentication still uses
767
+ the API Key; neither a client-provided uid nor a workspace hint authorizes access.
768
+ Incoming response fields are optional, including when talking to older servers.
769
+ Malformed/missing diagnostics and logging failures do not reject requests.
770
+
771
+ Before the response arrives, `api.request` cannot know its backend/gateway IDs.
772
+ They appear on `api.response` or `api.error` after receiving headers. Network
773
+ failures without a response legitimately have neither. Follow `clientRequestId`
774
+ back to the start event and `trace_id` to other steps of the command. Command
775
+ steps do not inherit the last HTTP request's `logid` or `requestId`: concurrent
776
+ calls, polling and follow-up requests retain their own IDs. The REST envelope's
777
+ legacy `request_id` is another API-generated ID, not the gateway `requestId`.
778
+
779
+ Resource downloads retain IDs from the backend's 302 redirect and emit
780
+ `api.redirect` before following the CDN URL. Cross-origin redirects strip
781
+ credentials and workspace hints; CDN request IDs do not replace backend IDs.
782
+ Public resource reads retain their existing anonymous access/watermark behavior;
783
+ an anonymous response does not erase the command's previously verified identity.
784
+
729
785
  Feature traces cover workspace, image/video/audio generation, upload, records,
730
786
  inspection, preview, task commands, and their local storage steps. API boundary
731
787
  events cover:
@@ -733,10 +789,12 @@ events cover:
733
789
  - GenAI and Asset MCP calls.
734
790
  - Resource upload and download.
735
791
  - Generation-record lookup.
792
+ - Workspace REST, debug APIs, model catalog and authorization exchange.
793
+ - Each VOD token, commit and polling HTTP request (third-party byte upload is separate).
736
794
 
737
795
  Logs contain safe operational fields such as source, operation, HTTP method,
738
796
  path, status, duration, and selected non-sensitive metadata. They do not record
739
- request headers, API Keys, bearer tokens, prompts, request bodies, or response
797
+ arbitrary request headers, API Keys, bearer tokens, prompts, request bodies, or response
740
798
  bodies. Sensitive key names and recognizable secret values are redacted again
741
799
  inside the central logger before persistence.
742
800
 
@@ -759,6 +817,9 @@ oiioii logs list --category api --level error --limit 20 --json
759
817
  oiioii logs list --source hogi_mcp_client --since 2026-08-14T00:00:00Z --json
760
818
  oiioii logs list --feature image.text --json
761
819
  oiioii logs list --trace trace_<id> --json
820
+ oiioii logs list --logid <backend-logid> --json
821
+ oiioii logs list --request-id <gateway-requestId> --json
822
+ oiioii logs list --uid <uid> --workspace-id <workspaceId> --json
762
823
  ```
763
824
 
764
825
  Export logs as JSONL or JSON:
@@ -838,8 +899,9 @@ Environment variables:
838
899
  | `OIIOII_BASE_URL` | Override the backend URL at runtime |
839
900
  | `OIIOII_WORKSPACE_ID` | Override the active workspace |
840
901
  | `OIIOII_BUILD_ENV` | Select `production`, `test`, or `local` while building |
841
- | `OIIOII_PRODUCTION_BASE_URL` | URL embedded by the production build |
902
+ | `OIIOII_PRODUCTION_BASE_URL` | Optional override for the production build's canonical backend URL |
842
903
  | `OIIOII_TEST_BASE_URL` | URL embedded by the test build |
904
+ | `OIIOII_TEST_AUTHORIZATION_PAGE_URL` | Browser authorization page embedded by the test build |
843
905
  | `OIIOII_BUILD_BASE_URL` | One-off URL override for a local/custom build; rejected by publish preparation |
844
906
  | `OIIOII_API_KEY` | Temporarily override the persisted API Key for the current process |
845
907
  | `OIIOII_E2E` | Explicit opt-in marker for credit-consuming E2E workflows |