tuna-agent 0.1.78 → 0.1.79

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,14 @@ 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, count?: number, ideasInstruction?: string, provider?: string): Promise<void>;
29
+ export interface AppContext {
30
+ appName: string;
31
+ appDesc: string;
32
+ features: string[];
33
+ isWholeApp: boolean;
34
+ allFeatures: string[];
35
+ }
36
+ export declare function handleGenerateIdeas(ws: AgentWebSocketClient, code: string, taskId: string, topic: string, styleName?: string, styleDesc?: string, language?: string, count?: number, ideasInstruction?: string, provider?: string, appContext?: AppContext): Promise<void>;
30
37
  export declare function handleGenerateScript(ws: AgentWebSocketClient, code: string, taskId: string, idea: string, topic: string, style?: string, duration?: number, language?: string, styleName?: string, styleGuidance?: string, provider?: string): Promise<void>;
31
38
  export declare function handleRetryVideo(ws: AgentWebSocketClient, code: string, taskId: string, videoId: string): void;
32
39
  export declare function handleGenerateScene(ws: AgentWebSocketClient, code: string, taskId: string, sceneIdx: number, prompt: string, aspectRatio: string): Promise<void>;
@@ -64,9 +64,8 @@ function hasContentCreator() {
64
64
  return false;
65
65
  }
66
66
  }
67
- // ─── Handler: generate_ideas ──────────────────────────────────────────────────
68
- export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, styleDesc, language, count, ideasInstruction, provider) {
69
- console.log(`[generate_ideas] Received: topic="${topic}" count=${count} provider=${provider || 'claude-cli'} ideasInstruction=${ideasInstruction ? ideasInstruction.length + ' chars' : '(none)'} styleName=${styleName || '(none)'}`);
67
+ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, styleDesc, language, count, ideasInstruction, provider, appContext) {
68
+ console.log(`[generate_ideas] Received: topic="${topic}" count=${count} provider=${provider || 'claude-cli'} ideasInstruction=${ideasInstruction ? ideasInstruction.length + ' chars' : '(none)'} styleName=${styleName || '(none)'} appContext=${appContext ? appContext.appName : '(none)'}`);
70
69
  if (provider !== 'openai' && !hasContentCreator()) {
71
70
  const error = 'content-creator agent not found on this machine';
72
71
  console.error(`[generate_ideas] ${error}`);
@@ -91,12 +90,30 @@ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, st
91
90
  if (ideasInstruction && ideasInstruction.trim()) {
92
91
  systemParts.push(`\n\nAdditional instructions for idea generation:\n${ideasInstruction.trim()}`);
93
92
  }
93
+ // Inject app context for UGC app promotion
94
+ if (appContext) {
95
+ const appParts = [`\n\nAPP PROMOTION CONTEXT:`];
96
+ appParts.push(`App: "${appContext.appName}"`);
97
+ if (appContext.appDesc)
98
+ appParts.push(`Description: ${appContext.appDesc}`);
99
+ if (appContext.isWholeApp) {
100
+ appParts.push(`Focus: promote the ENTIRE app (general awareness, not a specific feature)`);
101
+ if (appContext.allFeatures.length > 0) {
102
+ appParts.push(`Available features for reference: ${appContext.allFeatures.join(', ')}`);
103
+ }
104
+ }
105
+ else if (appContext.features.length > 0) {
106
+ appParts.push(`Focus on these specific features: ${appContext.features.join(', ')}`);
107
+ }
108
+ appParts.push(`Each idea must naturally integrate the app — frame as a personal discovery or problem-solved story, NOT a product pitch.`);
109
+ systemParts.push(appParts.join('\n'));
110
+ }
94
111
  const systemPrompt = systemParts.join(' ');
95
112
  const langReq = resolvedLang === 'vi'
96
113
  ? `- Titles must be in Vietnamese, natural and engaging`
97
114
  : `- Titles must be in English, natural and engaging`;
98
115
  const n = count && count > 0 ? count : 10;
99
- const prompt = [
116
+ const promptParts = [
100
117
  `Generate exactly ${n} viral YouTube Shorts video ideas for the topic: "${topic}".`,
101
118
  ``,
102
119
  `Requirements:`,
@@ -105,10 +122,15 @@ export async function handleGenerateIdeas(ws, code, taskId, topic, styleName, st
105
122
  langReq,
106
123
  `- Mix different angles/formats for variety`,
107
124
  ...(styleName ? [`- Ideas must fit the "${styleName}" video style${styleDesc ? ` (${styleDesc})` : ''}`] : []),
108
- ``,
109
- `Respond with ONLY a JSON array of ${n} strings. No explanation, no markdown, no wrapping.`,
110
- `Example format: ["title 1","title 2","title 3","title 4","title 5"]`,
111
- ].join('\n');
125
+ ];
126
+ if (appContext) {
127
+ promptParts.push(`- Each idea must naturally promote "${appContext.appName}" — feel like a real user sharing their experience`);
128
+ if (!appContext.isWholeApp && appContext.features.length > 0) {
129
+ promptParts.push(`- Focus ideas on: ${appContext.features.join(', ')}`);
130
+ }
131
+ }
132
+ promptParts.push(``, `Respond with ONLY a JSON array of ${n} strings. No explanation, no markdown, no wrapping.`, `Example format: ["title 1","title 2","title 3","title 4","title 5"]`);
133
+ const prompt = promptParts.join('\n');
112
134
  try {
113
135
  let resultText;
114
136
  if (provider === 'openai') {
@@ -511,7 +511,7 @@ ${skillContent.slice(0, 15000)}`;
511
511
  }
512
512
  if (extTask === 'generate_ideas') {
513
513
  (async () => {
514
- await handleGenerateIdeas(ws, extCode, extTaskId, msg.topic, msg.styleName, msg.styleDesc, msg.language, msg.count, msg.ideasInstruction, msg.provider);
514
+ await handleGenerateIdeas(ws, extCode, extTaskId, msg.topic, msg.styleName, msg.styleDesc, msg.language, msg.count, msg.ideasInstruction, msg.provider, msg.appContext);
515
515
  })();
516
516
  break;
517
517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"