akari-video 0.1.89 → 0.1.90

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akari-video",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
4
4
  "description": "AKARI Video launcher CLI — start an AI-edited video project from any directory: scaffold, connection check, then hand over to Claude Code (or opencode). AKARI Video を opencode や Claude Code で、どのディレクトリからでも始めるための `akari` ランチャー CLI。接続確認(doctor)→ 未セットアップならプロジェクト雛形を作成 → AI エージェントを起動する。外部 npm 依存ゼロ(Node.js 組み込みモジュールのみ)。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akari-video",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
4
4
  "description": "AKARI Video launcher CLI — start an AI-edited video project from any directory: scaffold, connection check, then hand over to Claude Code (or opencode). AKARI Video を opencode や Claude Code で、どのディレクトリからでも始めるための `akari` ランチャー CLI。接続確認(doctor)→ 未セットアップならプロジェクト雛形を作成 → AI エージェントを起動する。外部 npm 依存ゼロ(Node.js 組み込みモジュールのみ)。 [akari-video npm vendor: bin/akari.mjs is reference-only. These CLI entrypoints are not included in the akari-video npm package. Use `akari doctor --json` and run the path reported in `render_cut.path`. Full installations provide it in a monorepo checkout, ~/.akari/app, /Applications/AKARI Video.app/Contents/Resources/packages, or %LOCALAPPDATA%\\Programs\\@akari-videoshell\\resources\\packages.]",
5
5
  "type": "module",
6
6
  "files": [
@@ -98,6 +98,16 @@ export declare function putPlacedCaptionIntoCanvas(edit: EditableEditV2, caption
98
98
  at: number;
99
99
  duration: number;
100
100
  }, canvasId: string): ProjectItemV2;
101
+ /** P-3 と同じ字幕袋の除外を使い、明示字幕 item を映像段へ置く。 */
102
+ export declare function putPlacedCaptionIntoTrack(edit: EditableEditV2, caption: {
103
+ id: string;
104
+ at: number;
105
+ duration: number;
106
+ }, target: {
107
+ track?: string;
108
+ insertIndex?: number;
109
+ }): ProjectItemV2;
110
+ export declare function returnPlacedCaptionToBag(edit: EditableEditV2, captionId: string): void;
101
111
  export declare function takeOutOfCanvas(edit: EditableEditV2, itemIds: readonly string[]): ProjectItemV2[];
102
112
  export declare function insertItem(edit: EditableEditV2, target: string, item: MutableItem, index?: number): ProjectItemV2;
103
113
  export declare function removeItem(edit: EditableEditV2, id: string): ProjectItemV2;
@@ -14,6 +14,8 @@ exports.moveItem = moveItem;
14
14
  exports.createCanvas = createCanvas;
15
15
  exports.putIntoCanvas = putIntoCanvas;
16
16
  exports.putPlacedCaptionIntoCanvas = putPlacedCaptionIntoCanvas;
17
+ exports.putPlacedCaptionIntoTrack = putPlacedCaptionIntoTrack;
18
+ exports.returnPlacedCaptionToBag = returnPlacedCaptionToBag;
17
19
  exports.takeOutOfCanvas = takeOutOfCanvas;
18
20
  exports.insertItem = insertItem;
19
21
  exports.removeItem = removeItem;
@@ -284,6 +286,20 @@ function putPlacedCaptionIntoCanvas(edit, caption, canvasId) {
284
286
  }
285
287
  if (caption.at < absoluteAt(canvas))
286
288
  throw new Error('キャンバスより前の字幕は入れられません。');
289
+ const bag = ensurePlacedCaptionBag(edit, caption);
290
+ const exclude = bag.source.kind === 'captions' ? bag.source.exclude ?? [] : [];
291
+ if (bag.source.kind === 'captions' && !exclude.includes(caption.id))
292
+ bag.source.exclude = [...exclude, caption.id];
293
+ let id = `cap-${caption.id}`;
294
+ let serial = 1;
295
+ while (locate(edit, id))
296
+ id = `cap-${caption.id}-${serial++}`;
297
+ const item = { id, at: caption.at - absoluteAt(canvas), duration: caption.duration,
298
+ source: { kind: 'caption', path: 'captions.json', id: caption.id } };
299
+ ensureChildren(canvas.item).push(item);
300
+ return item;
301
+ }
302
+ function ensurePlacedCaptionBag(edit, caption) {
287
303
  let bag = allLocations(edit).find(location => location.item.source.kind === 'captions'
288
304
  && location.item.source.path === 'captions.json')?.item;
289
305
  if (!bag) {
@@ -300,6 +316,32 @@ function putPlacedCaptionIntoCanvas(edit, caption, canvasId) {
300
316
  }
301
317
  if (bag.duration < caption.at + caption.duration)
302
318
  bag.duration = caption.at + caption.duration;
319
+ return bag;
320
+ }
321
+ /** P-3 と同じ字幕袋の除外を使い、明示字幕 item を映像段へ置く。 */
322
+ function putPlacedCaptionIntoTrack(edit, caption, target) {
323
+ if (!Number.isInteger(caption.at) || caption.at < 0
324
+ || !Number.isInteger(caption.duration) || caption.duration <= 0)
325
+ throw new Error('字幕の時刻が不正です。');
326
+ const existing = allLocations(edit).find(location => location.item.source.kind === 'caption'
327
+ && location.item.source.id === caption.id);
328
+ if (existing) {
329
+ const track = target.insertIndex === undefined ? target.track
330
+ : createTrackAt(edit, 'visual', target.insertIndex).id;
331
+ if (!track)
332
+ throw new Error('置き先の段がありません。');
333
+ if (requireTrack(edit, track).lane !== 'visual')
334
+ throw new Error('置き先は映像トラックにしてください。');
335
+ updateItem(edit, existing.item.id, {
336
+ at: existing.item.at + caption.at - absoluteAt(existing), duration: caption.duration
337
+ });
338
+ return moveItem(edit, existing.item.id, { track });
339
+ }
340
+ const track = target.insertIndex === undefined ? tracksOf(edit).find(candidate => candidate.id === target.track)
341
+ : createTrackAt(edit, 'visual', target.insertIndex);
342
+ if (!track || track.lane !== 'visual')
343
+ throw new Error('置き先は映像トラックにしてください。');
344
+ const bag = ensurePlacedCaptionBag(edit, caption);
303
345
  const exclude = bag.source.kind === 'captions' ? bag.source.exclude ?? [] : [];
304
346
  if (bag.source.kind === 'captions' && !exclude.includes(caption.id))
305
347
  bag.source.exclude = [...exclude, caption.id];
@@ -307,10 +349,22 @@ function putPlacedCaptionIntoCanvas(edit, caption, canvasId) {
307
349
  let serial = 1;
308
350
  while (locate(edit, id))
309
351
  id = `cap-${caption.id}-${serial++}`;
310
- const item = { id, at: caption.at - absoluteAt(canvas), duration: caption.duration,
352
+ const item = { id, at: caption.at, duration: caption.duration,
311
353
  source: { kind: 'caption', path: 'captions.json', id: caption.id } };
312
- ensureChildren(canvas.item).push(item);
313
- return item;
354
+ return insertItem(edit, track.id, item);
355
+ }
356
+ function returnPlacedCaptionToBag(edit, captionId) {
357
+ const item = allLocations(edit).find(location => location.item.source.kind === 'caption'
358
+ && location.item.source.id === captionId);
359
+ if (item)
360
+ removeItem(edit, item.item.id);
361
+ for (const location of allLocations(edit)) {
362
+ if (location.item.source.kind !== 'captions')
363
+ continue;
364
+ const exclude = location.item.source.exclude ?? [];
365
+ if (exclude.includes(captionId))
366
+ location.item.source.exclude = exclude.filter(id => id !== captionId);
367
+ }
314
368
  }
315
369
  function takeOutOfCanvas(edit, itemIds) {
316
370
  return [...new Set(itemIds)].map(id => {