videodraft 0.13.3 → 0.15.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
@@ -91,15 +91,25 @@ videodraft create "<idea>" --ar 9:16 # idea → script → visual ass
91
91
  videodraft shots <project> --grid --estimate # preview the cost…
92
92
  videodraft shots <project> --grid # …then batch-generate every shot image
93
93
  videodraft produce <project> # voiceovers + captions + production timeline
94
+ videodraft produce <project> --mode full_video --allow-real-people
94
95
  videodraft export <project> --download final.mp4
95
96
  ```
96
97
 
98
+ Seedance 2.x uses Byteplus only at the default lower price. If supplied visual
99
+ input media, including a start/end frame or image/video reference, visibly
100
+ contains a real identifiable person, pass
101
+ `--allow-real-people` on the first request. It keeps Byteplus first, permits a
102
+ submit-time Fal fallback, and uses Fal's higher tier-specific rate. If an
103
+ unflagged request returns `SEEDANCE_REAL_PERSON_OPT_IN_REQUIRED`, estimate the
104
+ higher rate and retry once with the flag. Do not loop if it was already set;
105
+ late Byteplus output refusals are refunded but cannot be rerouted.
106
+
97
107
  ## Commands
98
108
 
99
109
  | Group | Commands |
100
110
  | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
101
111
  | Auth | `login` `logout` `whoami` |
102
- | Account | `credits` `costs [model]` `models [image\|video\|audio\|voices\|styles]` `workspaces` `sessions list/create` `kling-voices list/create/delete` |
112
+ | Account | `credits` `costs [model]` `models [image\|video\|audio\|voices\|styles]` `workspaces` `sessions list/create/current/reset` `kling-voices list/create/delete` |
103
113
  | Projects | `projects list/get/delete/favorite/open` `checkpoint create/list/restore` |
104
114
  | Pipeline | `create` `shots` `produce` (`--mode full_video`) `attach` `finalize` `export` `export-status` `video-prompts` |
105
115
  | Generate | `generate image/video/audio/voiceover/music/sound-effect/dialogue/voice-changer/dub` `edit video/motion` `upscale image/video` `avatar script/create/render/get/list/fabric/lipsync` |
package/dist/client.d.ts CHANGED
@@ -1,3 +1,72 @@
1
+ /**
2
+ * Connection sessions for the CLI.
3
+ *
4
+ * The VideoDraft MCP server hands every connection an `Mcp-Session-Id` on
5
+ * `initialize` and files that connection's project-less generations into its
6
+ * own AI Studio session (named after the client and date). MCP hosts echo the
7
+ * header for free; the CLI is stateless per invocation, so it keeps the
8
+ * header in a small store and replays it on every request.
9
+ *
10
+ * Scope: one session per (profile, base URL, working directory), expiring
11
+ * after SESSION_IDLE_MS without use. A working directory is a good proxy for
12
+ * "one piece of work" — an agent's workspace, a project folder — and it is
13
+ * stable across the many short-lived shells agents spawn (parent PIDs are
14
+ * not). Override the scope with VIDEODRAFT_SESSION_SCOPE=<any label>, pin an
15
+ * explicit AI Studio session with --session / VIDEODRAFT_SESSION, or rotate
16
+ * with `videodraft sessions reset`.
17
+ *
18
+ * Runtime-agnostic: no console, no process.exit. Fails soft — a broken store
19
+ * just means the server falls back to the shared "Agent (MCP)" session.
20
+ */
21
+ declare const SESSION_IDLE_MS: number;
22
+ declare const MCP_SESSION_HEADER = "Mcp-Session-Id";
23
+ interface ConnectionSessionRecord {
24
+ token: string;
25
+ scope: string;
26
+ cwd: string;
27
+ baseUrl: string;
28
+ profile: string;
29
+ createdAt: string;
30
+ lastUsedAt: string;
31
+ }
32
+ interface ConnectionSessionStore {
33
+ /** Current token for this scope, or null when absent/expired. */
34
+ load(): string | null;
35
+ /**
36
+ * Persist a freshly minted token for this scope and return the token that
37
+ * now owns the scope. Two processes racing on an empty scope both mint;
38
+ * the first writer wins and the second gets the winner's token back, so
39
+ * one directory never ends up split across two sessions.
40
+ */
41
+ save(token: string): string;
42
+ /** Replace the scope's token unconditionally (server re-mint). */
43
+ replace(token: string): void;
44
+ /** Forget the current token; the next call re-initialises. */
45
+ reset(): void;
46
+ /** Where this scope's record lives (for `sessions current`). */
47
+ describe(): {
48
+ scope: string;
49
+ file: string;
50
+ record: ConnectionSessionRecord | null;
51
+ /** True when a record exists but is past the idle window. */
52
+ expired: boolean;
53
+ /** The AI Studio session id inside the token, when it parses. */
54
+ sessionId: string | null;
55
+ };
56
+ }
57
+ interface SessionScopeInput {
58
+ baseUrl: string;
59
+ profile: string;
60
+ cwd?: string;
61
+ env?: NodeJS.ProcessEnv;
62
+ now?: () => number;
63
+ }
64
+ /** Stable label for this scope; what the record is keyed by. */
65
+ declare function sessionScope(input: SessionScopeInput): string;
66
+ declare function createConnectionSessionStore(input: SessionScopeInput): ConnectionSessionStore;
67
+ /** Drop every stored connection session (all scopes) for this config dir. */
68
+ declare function resetAllConnectionSessions(env?: NodeJS.ProcessEnv): number;
69
+
1
70
  /**
2
71
  * JSON-RPC 2.0 client for the VideoDraft MCP endpoint (POST {base}/api/mcp).
3
72
  *
@@ -5,6 +74,7 @@
5
74
  * console — this file is part of the `videodraft/client` subpath export the
6
75
  * macOS app's sidecar consumes. Errors are thrown, never printed.
7
76
  */
77
+
8
78
  interface TokenProvider {
9
79
  /** Return a bearer token (vd_mcp_...). Throw AuthError when none is available. */
10
80
  getAccessToken(): Promise<string>;
@@ -21,6 +91,20 @@ interface VideoDraftClientOptions {
21
91
  userAgent?: string;
22
92
  /** Per-request timeout in ms. Generation submits can be slow; default 300s (server maxDuration). */
23
93
  requestTimeoutMs?: number;
94
+ /**
95
+ * Optional connection-session store. When present the client performs the
96
+ * MCP `initialize` handshake once per scope, keeps the server's
97
+ * Mcp-Session-Id, and replays it on every request — which files this
98
+ * scope's project-less generations into their own AI Studio session
99
+ * instead of the shared "Agent (MCP)" one. Omit for a stateless client.
100
+ */
101
+ session?: ConnectionSessionStore;
102
+ /**
103
+ * Name reported as MCP clientInfo.name during the session handshake; it
104
+ * becomes the label of the auto-created AI Studio session ("Claude Code ·
105
+ * Aug 22, 2026"). Defaults to the user-agent's product token.
106
+ */
107
+ clientName?: string;
24
108
  }
25
109
  interface McpToolInfo {
26
110
  name: string;
@@ -33,8 +117,30 @@ declare class VideoDraftClient {
33
117
  private readonly fetchImpl;
34
118
  private readonly userAgent;
35
119
  private readonly requestTimeoutMs;
120
+ private readonly session?;
121
+ private readonly clientName;
122
+ /** In-memory copy of the Mcp-Session-Id for this process; null = none. */
123
+ private sessionId;
124
+ private handshake?;
36
125
  private nextId;
37
126
  constructor(options: VideoDraftClientOptions);
127
+ /** The Mcp-Session-Id this client sends, after the handshake (null = none). */
128
+ get connectionSessionId(): string | null;
129
+ /**
130
+ * Ensure we hold a Mcp-Session-Id when a store is configured: reuse the
131
+ * stored one, else run `initialize` once and keep what the server minted.
132
+ * Fails soft — any error here leaves sessionId null and the call proceeds
133
+ * stateless (server falls back to the shared session).
134
+ */
135
+ private ensureSession;
136
+ private sessionHeaders;
137
+ /**
138
+ * The server re-mints a Mcp-Session-Id on any response whose request
139
+ * carried one it could not verify (rotated signing secret, a token minted
140
+ * for another account on this profile). Adopt it so the store self-heals
141
+ * instead of silently falling back to the shared session until the TTL.
142
+ */
143
+ private adoptSession;
38
144
  get endpoint(): string;
39
145
  rpc<T = any>(method: string, params?: unknown): Promise<T>;
40
146
  private post;
@@ -277,7 +383,9 @@ declare class CliError extends Error {
277
383
  exitCode: number;
278
384
  /** One-line remediation shown under the error (human mode only). */
279
385
  hint?: string;
280
- constructor(message: string, exitCode?: number, hint?: string);
386
+ /** Optional machine-readable server recovery contract. */
387
+ data?: unknown;
388
+ constructor(message: string, exitCode?: number, hint?: string, data?: unknown);
281
389
  }
282
390
  declare class AuthError extends CliError {
283
391
  constructor(message?: string);
@@ -291,7 +399,7 @@ declare class RpcError extends CliError {
291
399
  /** A tools/call result that came back isError:true. */
292
400
  declare class ToolError extends CliError {
293
401
  toolName: string;
294
- constructor(toolName: string, message: string);
402
+ constructor(toolName: string, message: string, data?: unknown);
295
403
  }
296
404
  declare class TimeoutError extends CliError {
297
405
  constructor(message: string);
@@ -373,4 +481,4 @@ declare function refreshAccessToken(params: {
373
481
  /** RFC 7009 revocation — best-effort, used by `videodraft logout`. */
374
482
  declare function revokeToken(baseUrl: string, token: string, fetchImpl?: typeof fetch): Promise<void>;
375
483
 
376
- export { AuthError, type CliConfig, CliError, DEFAULT_BASE_URL, type DownloadedFile, EXIT, type GenerationResult, type McpToolInfo, type PollOptions, type Profile, type ResolvedAuth, RpcError, STATIC_CLI_CLIENT_ID, TimeoutError, type TokenProvider, ToolError, type UploadResult, VideoDraftClient, type VideoDraftClientOptions, authorizeViaLoopback, buildAuthorizeUrl, configDir, configPath, createPkcePair, downloadOutputs, downloadUrl, exchangeCode, extFromUrl, extractOutputUrls, getProfile, guessContentType, nextPollDelay, pollExport, pollGeneration, pollGenerations, pollGenerationsBatch, probeClientId, profileTokenProvider, readConfig, refreshAccessToken, registerCliClient, renderTemplate, resolveAuth, revokeToken, staticTokenProvider, updateConfig, uploadFile, writeConfig };
484
+ export { AuthError, type CliConfig, CliError, type ConnectionSessionRecord, type ConnectionSessionStore, DEFAULT_BASE_URL, type DownloadedFile, EXIT, type GenerationResult, MCP_SESSION_HEADER, type McpToolInfo, type PollOptions, type Profile, type ResolvedAuth, RpcError, SESSION_IDLE_MS, STATIC_CLI_CLIENT_ID, TimeoutError, type TokenProvider, ToolError, type UploadResult, VideoDraftClient, type VideoDraftClientOptions, authorizeViaLoopback, buildAuthorizeUrl, configDir, configPath, createConnectionSessionStore, createPkcePair, downloadOutputs, downloadUrl, exchangeCode, extFromUrl, extractOutputUrls, getProfile, guessContentType, nextPollDelay, pollExport, pollGeneration, pollGenerations, pollGenerationsBatch, probeClientId, profileTokenProvider, readConfig, refreshAccessToken, registerCliClient, renderTemplate, resetAllConnectionSessions, resolveAuth, revokeToken, sessionScope, staticTokenProvider, updateConfig, uploadFile, writeConfig };