@302ai/media-studio-cli 0.1.0 → 0.1.1-beta.1

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 +36 -9
  2. package/dist/index.js +757 -211
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -42,10 +42,12 @@ name:
42
42
  ```bash
43
43
  msc chat "画一只猫" -r # -r/--show-reasoning = 展示模型推理过程
44
44
  msc chat "hi" --json # machine-readable output
45
- msc chat "hi" --session <id> # 切换到指定会话并设为默认
45
+ msc chat "hi" --session <id> # 切换到已有会话(先校验存在)并设为默认
46
+ msc chat "hi" --new # 新建会话并设为默认(id 不复用)
46
47
  msc sessions # 列出所有会话(标记当前默认 `(current)`)
47
48
  msc sessions --json # 机器可读的原始 JSON 数组
48
- msc sessions use <id> # 纯本地切换默认会话(零请求、不校验)
49
+ msc sessions use <id> # 校验存在后切换默认会话
50
+ msc sessions use --new # 新建会话并设为默认
49
51
  msc skills # 列出技能库(--plaza 浏览技能广场)
50
52
  msc skills add <slug> # 从广场安装技能(如 brainstorming,见 --plaza --json 的 slug)
51
53
  msc skills rm <command> # 从技能库移除(-y/--yes 跳过确认)
@@ -79,10 +81,20 @@ whose browser can reach the loopback callback.
79
81
  loses a live session.
80
82
  - **Later chats** continue that session — upstream remembers the
81
83
  conversation by session id, so no history is resent.
82
- - If the session was deleted elsewhere, the CLI transparently provisions a
83
- fresh one and continues — you are never stranded.
84
- - `--session <id>` switches to a specific session (including web-created
85
- ones) and makes it the default, without provisioning.
84
+ - If the current session is gone **before a turn produces any output**, the CLI
85
+ transparently provisions a fresh one and re-runs the turn — a first-turn
86
+ failure never strands you.
87
+ - Once a turn has started producing output, a session failure is reported
88
+ instead: the partial result stands, nothing is re-run, and no replacement
89
+ session is created (a retry would replay output and re-dispatch tool calls or
90
+ generation tasks the first attempt may already have started).
91
+ - `--session <id>` switches to an existing session (including web-created
92
+ ones) and makes it the default. The id is verified upstream first: a missing
93
+ id fails with a hint, it never provisions a different session behind your
94
+ back.
95
+ - `--new` creates a fresh session with a newly generated id and makes it the
96
+ default for later runs. Ids are never reused or adopted: the CLI either uses
97
+ the id it generated or reports the refusal.
86
98
 
87
99
  Manual proof of continuity:
88
100
 
@@ -103,9 +115,22 @@ The CLI stores credentials and local settings in:
103
115
  - **Override**: `MEDIA_STUDIO_CONFIG_DIR=/path/to/dir`
104
116
 
105
117
  Key files:
106
- - `auth.json`: stores active platform credentials and user session metadata (permissions `0600`)
118
+ - `auth.json`: stores active platform credentials and user session metadata (permissions `0600` on POSIX)
107
119
  - `config.json`: stores CLI client settings, including `lastSessionId` pointer
108
120
 
121
+ `auth.json`'s `apiUrl` is only accepted when its host is on the CLI allowlist:
122
+ the official hosts (which the rejection message lists) plus the local-dev
123
+ hosts `localhost` / `127.0.0.1` / `::1`. A hand-edited URL outside that list is
124
+ refused before any request is sent, and the CLI reports it as a rejected
125
+ credential naming the URL — not as "not logged in", since the token itself may
126
+ be fine. `msc login` rewrites the file with a server-supplied URL and is the
127
+ fix; the refused URL is never used, and base-URL resolution falls back to the
128
+ official default host.
129
+
130
+ In `--json` mode the two auth states are distinguishable without reading the
131
+ message: a rejected credential carries `"nextStep": "relogin"` (and its
132
+ `guidance`), while no credential at all reports `status` and `message` only.
133
+
109
134
  ### Skills
110
135
 
111
136
  Discover what your account can reference, then reference it — the reference
@@ -317,8 +342,10 @@ msc chat "刚才的数字是几?" # answers 42
317
342
 
318
343
  # Session management verification:
319
344
  msc sessions # shows session list with (current) marker
320
- msc chat "hi" --session <id> # switch to specific session
321
- msc sessions use <id> # switch default pointer locally
345
+ msc chat "hi" --session <id> # switch to an existing session
346
+ msc chat "hi" --new # start a new session
347
+ msc sessions use <id> # switch default pointer to an existing session
348
+ msc sessions use --new # create a new session and switch to it
322
349
  ```
323
350
 
324
351
  Without the local server, point at production with