tycono 0.1.96-beta.31 → 0.1.96-beta.33
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
|
@@ -149,7 +149,15 @@ class SupervisorHeartbeat {
|
|
|
149
149
|
state.directive = text;
|
|
150
150
|
}
|
|
151
151
|
state.crashCount = 0;
|
|
152
|
-
|
|
152
|
+
|
|
153
|
+
// Dual Mode: Conversation vs Dispatch (code-level enforcement)
|
|
154
|
+
// If directive looks like a question/status check → spawn conversation mode
|
|
155
|
+
// If directive looks like a task → spawn full supervisor with dispatch tools
|
|
156
|
+
if (this.isConversationDirective(text)) {
|
|
157
|
+
this.spawnConversation(state, text);
|
|
158
|
+
} else {
|
|
159
|
+
this.scheduleRestart(state, 0);
|
|
160
|
+
}
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
return directive;
|
|
@@ -234,6 +242,93 @@ class SupervisorHeartbeat {
|
|
|
234
242
|
.filter(s => s.status === 'running' || s.status === 'starting' || s.status === 'restarting');
|
|
235
243
|
}
|
|
236
244
|
|
|
245
|
+
/* ─── Internal: Dual Mode ─────────────────── */
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Heuristic: is this directive a question/status check (conversation)
|
|
249
|
+
* or a work task (needs dispatch)?
|
|
250
|
+
*
|
|
251
|
+
* Conversation signals: question marks, status keywords, short length
|
|
252
|
+
* Dispatch signals: imperative verbs (만들어, 수정해, 구현해), long directives
|
|
253
|
+
*/
|
|
254
|
+
private isConversationDirective(text: string): boolean {
|
|
255
|
+
const t = text.trim();
|
|
256
|
+
|
|
257
|
+
// Short messages with question marks → conversation
|
|
258
|
+
if (t.includes('?') && t.length < 100) return true;
|
|
259
|
+
|
|
260
|
+
// Korean question patterns
|
|
261
|
+
const questionPatterns = [
|
|
262
|
+
/확인해/, /알려줘/, /보여줘/, /어때/, /뭐야/, /뭐지/, /뭘까/,
|
|
263
|
+
/상태/, /상황/, /진행/, /현재/, /어디/, /얼마/,
|
|
264
|
+
/what/i, /how.*going/i, /status/i, /check/i, /show/i, /tell/i,
|
|
265
|
+
];
|
|
266
|
+
if (questionPatterns.some(p => p.test(t))) return true;
|
|
267
|
+
|
|
268
|
+
// Long directives with action verbs → dispatch
|
|
269
|
+
const taskPatterns = [
|
|
270
|
+
/만들어/, /구현해/, /개발해/, /수정해/, /변경해/, /리팩토링/,
|
|
271
|
+
/설계해/, /작성해/, /배포해/, /테스트해/, /고쳐/,
|
|
272
|
+
/build/i, /create/i, /implement/i, /develop/i, /fix/i, /deploy/i, /refactor/i,
|
|
273
|
+
];
|
|
274
|
+
if (taskPatterns.some(p => p.test(t))) return false;
|
|
275
|
+
|
|
276
|
+
// Default: short → conversation, long → dispatch
|
|
277
|
+
return t.length < 60;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Spawn a lightweight conversation session (no dispatch tools).
|
|
282
|
+
* CEO reads files and answers directly.
|
|
283
|
+
*/
|
|
284
|
+
private spawnConversation(state: SupervisorState, directive: string): void {
|
|
285
|
+
// Build conversation context from previous directives
|
|
286
|
+
const deliveredDirectives = state.pendingDirectives.filter(d => d.delivered);
|
|
287
|
+
const history = deliveredDirectives.length > 0
|
|
288
|
+
? `\n[Previous conversation]\n${deliveredDirectives.map(d => `CEO: "${d.text}"`).join('\n')}\n`
|
|
289
|
+
: '';
|
|
290
|
+
|
|
291
|
+
const task = `${history}[CEO Question] ${directive}
|
|
292
|
+
|
|
293
|
+
You are the CEO's AI assistant. Answer this question directly by reading relevant files.
|
|
294
|
+
Do NOT dispatch anyone. Do NOT start any work. Just read, analyze, and answer.
|
|
295
|
+
Keep your response concise and informative.`;
|
|
296
|
+
|
|
297
|
+
// Reuse session
|
|
298
|
+
let sessionId = state.supervisorSessionId;
|
|
299
|
+
if (!sessionId || !getSession(sessionId)) {
|
|
300
|
+
const session = createSession('ceo', {
|
|
301
|
+
mode: 'do',
|
|
302
|
+
source: 'wave',
|
|
303
|
+
waveId: state.waveId,
|
|
304
|
+
});
|
|
305
|
+
sessionId = session.id;
|
|
306
|
+
state.supervisorSessionId = sessionId;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
state.status = 'running';
|
|
310
|
+
|
|
311
|
+
try {
|
|
312
|
+
const exec = executionManager.startExecution({
|
|
313
|
+
type: 'assign', // assign = no supervisor tools (dispatch/watch/amend)
|
|
314
|
+
roleId: 'ceo',
|
|
315
|
+
task,
|
|
316
|
+
sourceRole: 'ceo',
|
|
317
|
+
readOnly: true, // readOnly = no code changes, conversation only
|
|
318
|
+
sessionId,
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
state.executionId = exec.id;
|
|
322
|
+
this.watchExecution(state, exec);
|
|
323
|
+
|
|
324
|
+
console.log(`[Supervisor] Conversation mode for wave ${state.waveId} | directive: ${directive.slice(0, 60)}`);
|
|
325
|
+
} catch (err) {
|
|
326
|
+
console.error(`[Supervisor] Conversation spawn failed:`, err);
|
|
327
|
+
// Fallback to full supervisor
|
|
328
|
+
this.scheduleRestart(state, 0);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
237
332
|
/* ─── Internal: Spawn / Restart ────────────── */
|
|
238
333
|
|
|
239
334
|
private spawnSupervisor(state: SupervisorState): void {
|
|
@@ -264,12 +359,45 @@ class SupervisorHeartbeat {
|
|
|
264
359
|
? `\n\n⚠️ [RECOVERY] This is a restart after crash #${state.crashCount}. Check all session states via supervision watch.`
|
|
265
360
|
: '';
|
|
266
361
|
|
|
267
|
-
|
|
362
|
+
// Build conversation context from previous directives
|
|
363
|
+
const deliveredDirectives = state.pendingDirectives.filter(d => d.delivered);
|
|
364
|
+
const conversationHistory = deliveredDirectives.length > 0
|
|
365
|
+
? `\n## Previous Conversation in This Wave
|
|
366
|
+
${deliveredDirectives.map((d, i) => `${i + 1}. CEO said: "${d.text}"`).join('\n')}
|
|
268
367
|
|
|
368
|
+
You are continuing this conversation. The CEO's latest message builds on the above context.
|
|
369
|
+
Do NOT re-analyze from scratch — reference your previous findings.\n`
|
|
370
|
+
: '';
|
|
371
|
+
|
|
372
|
+
const supervisorTask = `[CEO Supervisor] ${state.directive}
|
|
373
|
+
${conversationHistory}
|
|
269
374
|
## Your Role
|
|
270
|
-
You are the CEO Supervisor — the
|
|
271
|
-
|
|
272
|
-
|
|
375
|
+
You are the CEO Supervisor — the CEO's AI proxy.
|
|
376
|
+
You can answer questions directly OR dispatch C-Level roles for complex work.
|
|
377
|
+
|
|
378
|
+
## Response Mode Decision (BEFORE dispatching)
|
|
379
|
+
|
|
380
|
+
⛔ Dispatch is expensive (spawns entire teams). Judge first:
|
|
381
|
+
|
|
382
|
+
**1. Direct Answer** — Can YOU handle this without dispatching?
|
|
383
|
+
- Status check, progress report → Read files/docs yourself, answer directly
|
|
384
|
+
- Simple question → Answer directly
|
|
385
|
+
- Opinion request → Answer directly
|
|
386
|
+
- Clarification on previous work → Answer from context
|
|
387
|
+
→ **Do NOT dispatch. Just answer.**
|
|
388
|
+
|
|
389
|
+
**2. Selective Dispatch** — Only specific C-Level(s) needed?
|
|
390
|
+
- "코드 수정해" → CTO only
|
|
391
|
+
- "디자인 개선해" → CBO only
|
|
392
|
+
- "테스트해봐" → CTO only (who dispatches QA)
|
|
393
|
+
→ **Dispatch only the relevant C-Level(s).**
|
|
394
|
+
|
|
395
|
+
**3. Full Dispatch** — Multi-team collaboration required?
|
|
396
|
+
- "새 기능 만들어" → CTO + CBO
|
|
397
|
+
- "출시 준비해" → All C-Levels
|
|
398
|
+
→ **Dispatch multiple C-Levels with clear tasks.**
|
|
399
|
+
|
|
400
|
+
**Default: Direct Answer first. Dispatch only when code changes or creative work is needed.**
|
|
273
401
|
|
|
274
402
|
## Available C-Level Roles
|
|
275
403
|
${cLevelList}
|
|
@@ -352,13 +480,14 @@ ${state.continuous ? `## Continuous Improvement Mode (ON)
|
|
|
352
480
|
5. 사용자가 Stop을 누를 때까지 계속한다. 스스로 done 선언하지 마라.
|
|
353
481
|
|
|
354
482
|
` : ''}## Instructions
|
|
355
|
-
1.
|
|
356
|
-
2.
|
|
357
|
-
3.
|
|
358
|
-
4.
|
|
359
|
-
5.
|
|
360
|
-
6.
|
|
361
|
-
7.
|
|
483
|
+
1. **First: Apply Response Mode Decision** — Can you answer directly? If yes, answer and report done.
|
|
484
|
+
2. If dispatch is needed: decide which C-Level roles (not necessarily all)
|
|
485
|
+
3. Dispatch with clear, specific tasks
|
|
486
|
+
4. Enter supervision watch loop
|
|
487
|
+
5. Monitor, **actively relay results between teams**, course-correct
|
|
488
|
+
6. When subordinates report done → **verify deliverables against requirements (G-09)**
|
|
489
|
+
7. If gaps exist → re-dispatch with specific feedback. Repeat 4-6.
|
|
490
|
+
8. Only when ALL requirements are met → compile results and report`;
|
|
362
491
|
|
|
363
492
|
// BUG-008 fix: Wave:Supervisor:Session = 1:1:1 invariant.
|
|
364
493
|
// Reuse existing session on restart instead of creating a new one.
|