Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/en/tools-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ Apply non-destructive trims or queue a video extension job.
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `action` | `string` | Yes | `"trim"` (immediate RPC update) or `"extend"` (queues a `JobQueue` job returning `JobView`). |
| `match` | `string` | Yes | Video asset ID, exact name, or case-insensitive substring. |
| `match` | `string` | Yes | Stand-alone video ID, `<sceneId>:<wfId>` scene clip ID, exact name, or case-insensitive substring. |
| `start_seconds` | `number` | No | Trim start timestamp in seconds for `"trim"` (`null` clears start bound). |
| `end_seconds` | `number` | No | Trim end timestamp in seconds for `"trim"` (`null` clears end bound). |
| `prompt` | `string` | No | Continuation prompt for `"extend"`. |
| `scene_id` | `string` | No | Optional existing scene ID to extend inside. |

`"trim"` updates a stand-alone video tile or updates the matching `<sceneId>:<wfId>` clip inside its parent scene. For `"extend"`, `flow-mcp` opens `scene_id` when you set `scene_id` or pass `<sceneId>:<wfId>`. When you omit `scene_id` for a stand-alone video, `flow_video` returns to the project root first and creates a new scene for that clip. If a scene is open when `prepare_extend` runs (or `scene_id` names an existing scene), `prepare_extend` looks for the target clip in that scene and returns `scene_clip_not_found` when the clip is absent instead of reusing the open scene.

### `flow_scenes`

List, create, populate, rename, or trash Flow scene timelines.
Expand Down Expand Up @@ -352,7 +354,7 @@ Open the target project workspace before you upload. Upload works from the proje
}
```

The result gives `project_id`, `count`, and `assets`. Each asset gives its `id`, `name`, `kind`, and `primary_media_id` when available.
The result gives `project_id`, `count`, and `assets`. Each asset gives its `id`, `name`, `kind`, and `primary_media_id` when available. Stand-alone tiles use their tile `id`, and scenes have `kind: "scene"` with ID `<sceneId>`. Active clips in a scene timeline also appear with `kind: "video"` and ID `<sceneId>:<wfId>`.

If the batch stops, the error gives the assets that Flow confirms before the failure. It also gives `file` if the tool can identify the file in progress. If you get `outcome_unknown`, check the project before you retry.

Expand All @@ -364,7 +366,7 @@ Rename assets, characters, scenes, or collections in batches and confirm through
| :--- | :--- | :--- | :--- |
| `items` | `object[]` | Yes | Non-empty array of `{"id": "...", "name": "..."}` entries. |

For an image or video tile that the page shows, `flow-mcp` first uses the **Rename** item of the tile menu and types the new name into the rename control of the page. In all other cases it sends the store mutation. Each entry of `items` in the result has `method`: `menu:rename` or `mutation`. For collections, the tool confirms the result in a new read of the project store.
For an image or video tile that the page shows, `flow-mcp` first uses the **Rename** item of the tile menu and types the new name into the rename control of the page. In all other cases it sends the store mutation. For a `<sceneId>:<wfId>` scene clip ID, `flow-mcp` renames the underlying stand-alone video tile when one exists, and returns `scene_clip_has_no_tile_to_rename` if the clip exists only in the scene. Each entry of `items` in the result has `method`: `menu:rename` or `mutation`. For collections, the tool confirms the result in a new read of the project store.

### `flow_collections`

Expand Down Expand Up @@ -419,4 +421,4 @@ Move a matching asset, character, scene, or collection to trash in Google Flow.
| :--- | :--- | :--- | :--- |
| `match` | `string` | Yes | Case-insensitive asset or collection ID, name, or prompt substring. |

`flow-mcp` first uses **Move to trash** in the tile menu. It uses the project store if it cannot confirm the result from the menu. The store path requires a verified request format and confirms the result with a fresh read. On success, the result includes `method` and `confirmed`. For a collection, the tool uses the same deletion procedure as `flow_collections`.
`flow-mcp` first uses **Move to trash** in the tile menu. It uses the project store if it cannot confirm the result from the menu. The store path requires a verified request format and confirms the result with a fresh read. For a `<sceneId>:<wfId>` scene clip ID, the store removes that clip from `<sceneId>` and keeps any stand-alone video tile intact. On success, the result includes `method` and `confirmed`. For a collection, the tool uses the same deletion procedure as `flow_collections`.
10 changes: 6 additions & 4 deletions docs/ja/tools-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ UI 編集トリガーまたは `/edit/<id>` を通じて既存の画像または
| パラメータ | 型 | 必須 | 説明 |
| :--- | :--- | :--- | :--- |
| `action` | `string` | はい | `"trim"`(即時 RPC 更新)または `"extend"`(`JobQueue` ジョブを登録して `JobView` を返す)。 |
| `match` | `string` | はい | 動画アセット ID、完全一致名、または大文字小文字を区別しない部分文字列。 |
| `match` | `string` | はい | 単体動画 ID、`<sceneId>:<wfId>` シーンクリップ ID、完全一致名、または大文字小文字を区別しない部分文字列。 |
| `start_seconds` | `number` | いいえ | `"trim"` 用の開始タイムスタンプ秒(`null` で開始境界をクリア)。 |
| `end_seconds` | `number` | いいえ | `"trim"` 用の終了タイムスタンプ秒(`null` で終了境界をクリア)。 |
| `prompt` | `string` | いいえ | `"extend"` 用の延長プロンプト。 |
| `scene_id` | `string` | いいえ | 延長先とする任意の既存シーン ID。 |

`"trim"` は単体の動画タイル、または親シーン内の対応する `<sceneId>:<wfId>` クリップを更新します。`"extend"` では、`scene_id` を指定するか `<sceneId>:<wfId>` を渡すと該当シーンを開きます。単体動画で `scene_id` を省略した場合、`flow_video` はまずプロジェクトルートへ戻り、そのクリップ用の新しいシーンを作成します。`prepare_extend` の実行時にシーンが開いている場合(または既存の `scene_id` を指定した場合)、`prepare_extend` はそのシーン内で対象クリップを検索し、存在しない場合は開いているシーンを無関係な単体動画に再利用せず `scene_clip_not_found` を返します。

### `flow_scenes`

Flow シーンタイムラインの一覧表示、作成、クリップ追加、名前変更、またはゴミ箱移動を行います。
Expand Down Expand Up @@ -352,7 +354,7 @@ Flow シーンタイムラインの一覧表示、作成、クリップ追加、
}
```

結果には `project_id`、`count`、`assets` が含まれます。各アセットには `id`、`name`、`kind`、取得できる場合は `primary_media_id` が含まれます。
結果には `project_id`、`count`、`assets` が含まれます。各アセットには `id`、`name`、`kind`、取得できる場合は `primary_media_id` が含まれます。単体タイルは自身のタイル `id` を使い、シーンは `kind: "scene"`(ID は `<sceneId>`)を持ちます。シーンタイムライン内の有効なクリップも `kind: "video"`、ID `<sceneId>:<wfId>` として一覧に含まれます。

途中で失敗した場合、エラーには Flow が確認済みのアセットが含まれます。処理中のファイルを特定できる場合は `file` も返ります。`outcome_unknown` が返った場合は、再試行の前にプロジェクトを確認してください。

Expand All @@ -364,7 +366,7 @@ Flow シーンタイムラインの一覧表示、作成、クリップ追加、
| :--- | :--- | :--- | :--- |
| `items` | `object[]` | はい | `{"id": "...", "name": "..."}` エントリの空でない配列。 |

ページに表示されている画像または動画のタイルでは、`flow-mcp` はまずタイルメニューの **Rename** 項目を使い、ページのリネーム用コントロールに新しい名前を入力します。それ以外の場合は store mutation を送信します。結果の `items` の各エントリには `method`(`menu:rename` または `mutation`)が含まれます。 コレクションの名前変更は、プロジェクトのデータを再取得して確認します。
ページに表示されている画像または動画のタイルでは、`flow-mcp` はまずタイルメニューの **Rename** 項目を使い、ページのリネーム用コントロールに新しい名前を入力します。それ以外の場合は store mutation を送信します。`<sceneId>:<wfId>` シーンクリップ ID の場合、対応する単体動画タイルが存在すればそのタイルをリネームし、シーン内にのみ存在するクリップには `scene_clip_has_no_tile_to_rename` を返します。結果の `items` の各エントリには `method`(`menu:rename` または `mutation`)が含まれます。 コレクションの名前変更は、プロジェクトのデータを再取得して確認します。

### `flow_collections`

Expand Down Expand Up @@ -419,4 +421,4 @@ Google Flow 内で一致するアセット、キャラクター、シーン、
| :--- | :--- | :--- | :--- |
| `match` | `string` | はい | アセットまたはコレクションの ID、名前、またはプロンプトに一致する大文字小文字を区別しない部分文字列。 |

`flow-mcp` はまずタイルメニューの **Move to trash** を使います。メニューから結果を確認できない場合は、プロジェクトの store を使います。store には検証済みのリクエスト形式が必要です。結果はプロジェクトを再読み込みして確認し、成功時に `method` と `confirmed` を返します。コレクションの場合は `flow_collections` と同じ手順で削除します。
`flow-mcp` はまずタイルメニューの **Move to trash** を使います。メニューから結果を確認できない場合は、プロジェクトの store を使います。store には検証済みのリクエスト形式が必要です。`<sceneId>:<wfId>` シーンクリップ ID を指定した場合、store は `<sceneId>` からそのクリップのみを削除し、単体動画タイルは維持します。結果はプロジェクトを再読み込みして確認し、成功時に `method` と `confirmed` を返します。コレクションの場合は `flow_collections` と同じ手順で削除します。
10 changes: 6 additions & 4 deletions docs/zh-CN/tools-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ flow-mcp [OPTIONS] <COMMAND>
| 参数 | 类型 | 必填 | 说明 |
| :--- | :--- | :--- | :--- |
| `action` | `string` | 是 | `"trim"`(即时 RPC 更新)或 `"extend"`(在 `JobQueue` 入队任务并返回 `JobView`)。 |
| `match` | `string` | 是 | 视频资产 ID、精确名称或忽略大小写子串。 |
| `match` | `string` | 是 | 独立视频 ID、`<sceneId>:<wfId>` 场景片段 ID、精确名称或忽略大小写子串。 |
| `start_seconds` | `number` | 否 | `"trim"` 的起始时间戳(秒;`null` 清除起点边界)。 |
| `end_seconds` | `number` | 否 | `"trim"` 的结束时间戳(秒;`null` 清除终点边界)。 |
| `prompt` | `string` | 否 | `"extend"` 的续写提示词。 |
| `scene_id` | `string` | 否 | 要在其中进行续写的可选既有场景 ID。 |

`"trim"` 会更新独立视频 tile,或在所属场景中更新匹配的 `<sceneId>:<wfId>` 片段。对于 `"extend"`,指定 `scene_id` 或传入 `<sceneId>:<wfId>` 时,`flow-mcp` 会打开对应场景;对独立视频省略 `scene_id` 时,`flow_video` 会先回到项目主页并为该片段创建新场景。若调用 `prepare_extend` 时已打开某个场景(或指定了既有 `scene_id`),`prepare_extend` 会在该场景中查找目标片段,找不到时返回 `scene_clip_not_found`,而不会将当前打开的场景复用于无关的独立视频。

### `flow_scenes`

列出、创建、填充、重命名或将 Flow 场景时间线移入回收站。
Expand Down Expand Up @@ -352,7 +354,7 @@ flow-mcp [OPTIONS] <COMMAND>
}
```

返回 `project_id`、`count` 和 `assets`。每项包含 `id`、`name`、`kind`,并在可用时返回 `primary_media_id`。
返回 `project_id`、`count` 和 `assets`。每项包含 `id`、`name`、`kind`,并在可用时返回 `primary_media_id`。独立 tile 使用其自身 `id`,场景条目为 `kind: "scene"`(ID 为 `<sceneId>`),场景时间线中的活动片段也会以 `kind: "video"`、ID `<sceneId>:<wfId>` 列出。

批次中途失败时,错误包含 Flow 已确认的资源。若能确定处理到哪个文件,也会返回 `file`。收到 `outcome_unknown` 时,请检查项目后再重试。

Expand All @@ -364,7 +366,7 @@ flow-mcp [OPTIONS] <COMMAND>
| :--- | :--- | :--- | :--- |
| `items` | `object[]` | 是 | 非空的 `{"id": "...", "name": "..."}` 对象数组。 |

对于页面上显示的图像或视频 tile,`flow-mcp` 先使用 tile 菜单的 **Rename** 项,并在页面的重命名控件中输入新名称。其他情况下发送 store mutation。结果中 `items` 的每一项都带有 `method`:`menu:rename` 或 `mutation`。 集合重命名通过重新读取项目 store 来核验。
对于页面上显示的图像或视频 tile,`flow-mcp` 先使用 tile 菜单的 **Rename** 项,并在页面的重命名控件中输入新名称。其他情况下发送 store mutation。对于 `<sceneId>:<wfId>` 场景片段 ID,若存在对应的独立视频 tile 则重命名该视频 tile;若片段仅存在于场景内则返回 `scene_clip_has_no_tile_to_rename`。结果中 `items` 的每一项都带有 `method`:`menu:rename` 或 `mutation`。 集合重命名通过重新读取项目 store 来核验。

### `flow_collections`

Expand Down Expand Up @@ -419,4 +421,4 @@ flow-mcp [OPTIONS] <COMMAND>
| :--- | :--- | :--- | :--- |
| `match` | `string` | 是 | 匹配资产或集合 ID、名称或提示词的忽略大小写子串。 |

`flow-mcp` 先尝试使用素材菜单的 **Move to trash**。无法通过菜单确认结果时,工具使用项目存储。直接写入需要已验证的请求格式,并通过重新读取项目确认结果。成功结果包含 `method` 和 `confirmed`。收藏夹使用与 `flow_collections` 相同的删除流程。
`flow-mcp` 先尝试使用素材菜单的 **Move to trash**。无法通过菜单确认结果时,工具使用项目存储。直接写入需要已验证的请求格式,并通过重新读取项目确认结果。传入 `<sceneId>:<wfId>` 场景片段 ID 时,项目存储仅从 `<sceneId>` 移除该片段,保留独立视频 tile。成功结果包含 `method` 和 `confirmed`。收藏夹使用与 `flow_collections` 相同的删除流程。
51 changes: 44 additions & 7 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,26 +280,63 @@ pub(crate) fn match_asset<'a>(
return None;
}
let lower = raw.to_lowercase();
let has_colon = raw.contains(':');

assets
.iter()
.find(|a| a.id == raw)
.or_else(|| {
(!has_colon).then(|| {
assets.iter().find(|a| {
crate::scenes::split_scene_clip_id(&a.id).is_some_and(|(_, wf)| wf == raw)
})
})?
})
.or_else(|| {
assets
.iter()
.find(|a| !a.id.contains(':') && a.name.eq_ignore_ascii_case(raw))
})
.or_else(|| assets.iter().find(|a| a.name.eq_ignore_ascii_case(raw)))
.or_else(|| {
assets
.iter()
.find(|a| !a.id.contains(':') && a.name.to_lowercase().contains(&lower))
})
.or_else(|| {
assets
.iter()
.find(|a| a.name.to_lowercase().contains(&lower))
})
.or_else(|| {
(!has_colon).then(|| {
assets
.iter()
.find(|a| !a.id.contains(':') && a.id.to_lowercase().contains(&lower))
})?
})
.or_else(|| assets.iter().find(|a| a.id.to_lowercase().contains(&lower)))
.or_else(|| {
if include_prompt {
assets.iter().find(|a| {
a.prompt
.as_deref()
.unwrap_or("")
.to_lowercase()
.contains(&lower)
})
assets
.iter()
.find(|a| {
!a.id.contains(':')
&& a.prompt
.as_deref()
.unwrap_or("")
.to_lowercase()
.contains(&lower)
})
.or_else(|| {
assets.iter().find(|a| {
a.prompt
.as_deref()
.unwrap_or("")
.to_lowercase()
.contains(&lower)
})
})
} else {
None
}
Expand Down
Loading
Loading