tuna-agent 0.1.35 → 0.1.36

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.
@@ -26,7 +26,7 @@ export interface VideoRecord {
26
26
  aspectRatio?: string;
27
27
  }
28
28
  export declare function handleGetHistory(ws: AgentWebSocketClient, code: string, taskId: string): void;
29
- export declare function handleGenerateIdeas(ws: AgentWebSocketClient, code: string, taskId: string, topic: string, styleName?: string, styleDesc?: string, language?: string): Promise<void>;
29
+ export declare function handleGenerateIdeas(ws: AgentWebSocketClient, code: string, taskId: string, topic: string, styleName?: string, styleDesc?: string, language?: string, count?: number, ideasInstruction?: string): Promise<void>;
30
30
  export declare function handleGenerateScript(ws: AgentWebSocketClient, code: string, taskId: string, idea: string, topic: string, style?: string, duration?: number, language?: string, styleName?: string, styleGuidance?: string): Promise<void>;
31
31
  export declare function handleRetryVideo(ws: AgentWebSocketClient, code: string, taskId: string, videoId: string): void;
32
32
  export declare function handleGenerateScene(ws: AgentWebSocketClient, code: string, taskId: string, sceneIdx: number, prompt: string, aspectRatio: string): Promise<void>;
@@ -64,7 +64,7 @@ function hasContentCreator() {
64
64
  }
65
65
  }
66
66
  // ─── Handler: generate_ideas ──────────────────────────────────────────────────
67
- export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, styleDesc, language) {
67
+ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, styleDesc, language, count, ideasInstruction) {
68
68
  if (!hasContentCreator()) {
69
69
  const error = 'content-creator agent not found on this machine';
70
70
  console.error(`[generate_ideas] ${error}`);
@@ -86,12 +86,16 @@ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, st
86
86
  systemParts.push(`The video style is "${styleName}"${styleDesc ? `: ${styleDesc}` : ''}.`);
87
87
  systemParts.push(`Generate ideas that are specifically suited for this style.`);
88
88
  }
89
+ if (ideasInstruction && ideasInstruction.trim()) {
90
+ systemParts.push(`\n\nAdditional instructions for idea generation:\n${ideasInstruction.trim()}`);
91
+ }
89
92
  const systemPrompt = systemParts.join(' ');
90
93
  const langReq = resolvedLang === 'vi'
91
94
  ? `- Titles must be in Vietnamese, natural and engaging`
92
95
  : `- Titles must be in English, natural and engaging`;
96
+ const n = count && count > 0 ? count : 10;
93
97
  const prompt = [
94
- `Generate exactly 5 viral YouTube Shorts video ideas for the topic: "${topic}".`,
98
+ `Generate exactly ${n} viral YouTube Shorts video ideas for the topic: "${topic}".`,
95
99
  ``,
96
100
  `Requirements:`,
97
101
  `- Each idea is a catchy, scroll-stopping video title`,
@@ -100,7 +104,7 @@ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, st
100
104
  `- Mix different angles/formats for variety`,
101
105
  ...(styleName ? [`- Ideas must fit the "${styleName}" video style${styleDesc ? ` (${styleDesc})` : ''}`] : []),
102
106
  ``,
103
- `Respond with ONLY a JSON array of 5 strings. No explanation, no markdown, no wrapping.`,
107
+ `Respond with ONLY a JSON array of ${n} strings. No explanation, no markdown, no wrapping.`,
104
108
  `Example format: ["title 1","title 2","title 3","title 4","title 5"]`,
105
109
  ].join('\n');
106
110
  try {
@@ -127,9 +131,9 @@ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, st
127
131
  }
128
132
  catch { /* skip non-JSON matches */ }
129
133
  }
130
- // Prefer the array closest to 5 items
134
+ // Prefer the array closest to n items
131
135
  if (arrays.length > 0) {
132
- ideas = arrays.reduce((best, cur) => Math.abs(cur.length - 5) < Math.abs(best.length - 5) ? cur : best);
136
+ ideas = arrays.reduce((best, cur) => Math.abs(cur.length - n) < Math.abs(best.length - n) ? cur : best);
133
137
  }
134
138
  }
135
139
  catch { /* fall through to fallback */ }
@@ -367,13 +367,13 @@ ${skillContent.slice(0, 15000)}`;
367
367
  }
368
368
  if (extTask === 'generate_ideas') {
369
369
  (async () => {
370
- await handleGenerateIdeas(ws, extCode, extTaskId, msg.topic, msg.styleName, msg.styleDesc, msg.language);
370
+ await handleGenerateIdeas(ws, extCode, extTaskId, msg.topic, msg.styleName, msg.styleDesc, msg.language, msg.count, msg.ideasInstruction);
371
371
  })();
372
372
  break;
373
373
  }
374
374
  if (extTask === 'generate_script') {
375
375
  (async () => {
376
- await handleGenerateScript(ws, extCode, extTaskId, msg.idea, msg.topic, msg.style, msg.duration, msg.language, msg.styleName, msg.styleGuidance);
376
+ await handleGenerateScript(ws, extCode, extTaskId, msg.idea, msg.topic, msg.style, msg.duration, msg.language, msg.styleName, (msg.scriptInstruction || msg.styleGuidance));
377
377
  })();
378
378
  break;
379
379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"