@ngockhoale/ckit 0.2.9 → 0.2.10

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.
@@ -368,10 +368,17 @@ export function startTeamRun(opts) {
368
368
  if (modelDirector()) {
369
369
  const answered = qaRounds.length ? `\nYOUR EARLIER QUESTIONS AND THE OWNER'S ANSWERS:\n${qaRounds.map((q, i) => `Round ${i + 1} questions:\n${q.questions}\nOwner's answer:\n${q.answer}`).join('\n\n')}\n` : '';
370
370
  const limitNote = forced ? '\nThe owner chose to proceed with your stated assumptions: answer "DECISION: PROCEED" now.' : needRounds >= 3 ? '\nYou already asked 3 times: you must not use NEED INFO again. Choose PROCEED with stated assumptions, or CANNOT DO.' : '';
371
- const t = await directorAsk('intake brief', `${role(config.director, `You are the Director. First triage the owner request, then (only on PROCEED) split it between your teams.\nYour reply must contain exactly one decision line on its own line: "DECISION: PROCEED", "DECISION: NEED INFO" or "DECISION: CANNOT DO".\n- PROCEED: write a short overall summary (scope), an "ASSUMPTIONS:" list when you assumed anything, then one section per listed team, each starting with a line exactly "### TEAM <team id>" followed by: what this team must do for this goal, the expected deliverable, and what is out of scope for it. Assign every part of the goal to exactly one listed team and assign nothing to a team that is not listed.\n- NEED INFO: no team starts. Write a numbered list of at most 5 specific questions, each with why you need it; when sensible add a line "ASSUMPTIONS IF NO ANSWER:" followed by what you would assume.\n- CANNOT DO: write "REASON:" and then "WHAT WOULD WORK:" with 1 to 3 alternatives.\nRules: prefer PROCEED with stated assumptions when the gap is small and a wrong guess is cheap. Use NEED INFO only when a wrong guess wastes work or risks damage. Use CANNOT DO only when no reasonable reading of the request can be achieved with the configured teams, their access and this workspace. Never invent requirements. Never start teams on a request you do not understand. Answer in the owner's language. You may read project files (read only) to decide. Check the work is assignable: changing files needs a team with a write agent.${limitNote}`, true)}\n${accessFacts()}\n${lanes.length ? `LANES (choose exactly one; you may not invent lanes or teams):\n${laneRosterText()}\n${ownerLane ? `The owner FIXED the lane: "${ownerLane.id}". Brief only its teams. You may still answer NEED INFO or CANNOT DO.` : 'On PROCEED you MUST include a line "LANE: <lane id>" and a line "LANE REASON: <one sentence>", and write sections only for the teams of that lane. If no lane fits, answer DECISION: CANNOT DO with the reason "no lane fits" and say which lane would be needed; if the request is unclear between lanes, use NEED INFO.'}` : `TEAM ROSTER (pipeline order):\n${rosterText()}`}\n${common()}${answered}`);
372
- if (t?.trim())
373
- return t;
374
- return `DECISION: PROCEED\n${ruleBrief()}`; // the Director could not answer: carry on with the rule-based brief
371
+ const ask = () => directorAsk('intake brief', `${role(config.director, `You are the Director. First triage the owner request, then (only on PROCEED) split it between your teams.\nYour reply must contain exactly one decision line on its own line: "DECISION: PROCEED", "DECISION: NEED INFO" or "DECISION: CANNOT DO".\n- PROCEED: write a short overall summary (scope), an "ASSUMPTIONS:" list when you assumed anything, then one section per listed team, each starting with a line exactly "### TEAM <team id>" followed by: what this team must do for this goal, the expected deliverable, and what is out of scope for it. Assign every part of the goal to exactly one listed team and assign nothing to a team that is not listed.\n- NEED INFO: no team starts. Write a numbered list of at most 5 specific questions, each with why you need it; when sensible add a line "ASSUMPTIONS IF NO ANSWER:" followed by what you would assume.\n- CANNOT DO: write "REASON:" and then "WHAT WOULD WORK:" with 1 to 3 alternatives.\nRules: prefer PROCEED with stated assumptions when the gap is small and a wrong guess is cheap. Use NEED INFO only when a wrong guess wastes work or risks damage. Use CANNOT DO only when no reasonable reading of the request can be achieved with the configured teams, their access and this workspace. Never invent requirements. Never start teams on a request you do not understand. Answer in the owner's language. You may read project files (read only) to decide. Check the work is assignable: changing files needs a team with a write agent.${limitNote}`, true)}\n${accessFacts()}\n${lanes.length ? `LANES (choose exactly one; you may not invent lanes or teams):\n${laneRosterText()}\n${ownerLane ? `The owner FIXED the lane: "${ownerLane.id}". Brief only its teams. You may still answer NEED INFO or CANNOT DO.` : 'On PROCEED you MUST include a line "LANE: <lane id>" and a line "LANE REASON: <one sentence>", and write sections only for the teams of that lane. If no lane fits, answer DECISION: CANNOT DO with the reason "no lane fits" and say which lane would be needed; if the request is unclear between lanes, use NEED INFO.'}` : `TEAM ROSTER (pipeline order):\n${rosterText()}`}\n${common()}${answered}`);
372
+ for (let attempt = 0; attempt < 2; attempt++) {
373
+ const t = await ask();
374
+ if (t?.trim())
375
+ return t;
376
+ }
377
+ // the Director gave no decision twice: no team may start on a request nobody triaged
378
+ const why = 'The Director could not triage this request (no answer after 2 attempts), so no team was started. Check the Director CLI login and model in Config, then start the run again.';
379
+ directorSay('all', why);
380
+ finish('failed', why);
381
+ throw new Halt();
375
382
  }
376
383
  emit({ type: 'agent.started', agentId: config.director.id, task: 'intake brief' });
377
384
  if (/\[sim-cannot\]/i.test(goal))
@@ -622,7 +629,7 @@ export function startTeamRun(opts) {
622
629
  return { out: [...lastMsg.values()].at(-1) ?? '', back: backOf() };
623
630
  };
624
631
  if (!multi) {
625
- raw = await run(lead, 'single', 1, `${workWhat(id)}\n${handoffInstr(id, k)}`, name, to, false);
632
+ raw = await run(lead, 'single', 1, `${workWhat(id)}\n${handoffInstr(id, k)}`, name, 'director', false); // the team's result goes to the Director, never straight to the next team
626
633
  const r = returnedEarly();
627
634
  if (r)
628
635
  return r;
@@ -647,7 +654,7 @@ export function startTeamRun(opts) {
647
654
  break;
648
655
  }
649
656
  if (qcReturn === null && writer) {
650
- const t = await run(writer, 'work', 1, `The discussion is over. You are the ONLY member of the ${name} team who changes files in this pass: do the work following the team discussion. ${workWhat(id)}${writer === lead ? `\n${handoffInstr(id, k)}` : ''}`, `${name} work`, to, false);
657
+ const t = await run(writer, 'work', 1, `The discussion is over. You are the ONLY member of the ${name} team who changes files in this pass: do the work following the team discussion. ${workWhat(id)}${writer === lead ? `\n${handoffInstr(id, k)}` : ''}`, `${name} work`, writer === lead ? 'director' : lead.id, false); // a non-lead writer reports inside the team; the lead's handoff is what reaches the Director
651
658
  const rr = returnedEarly();
652
659
  if (rr)
653
660
  return rr;
@@ -657,7 +664,7 @@ export function startTeamRun(opts) {
657
664
  log.push(`[work] ${writer.name}: ${clip(t ?? '', 2500)}`);
658
665
  }
659
666
  if (qcReturn === null && raw === null) {
660
- raw = await run(lead, 'handoff', 1, `The discussion is over. You are the team lead: write the team's single result. ${isQc ? 'State the merged result: "VERDICT: FAIL" when any reviewer failed it, else "VERDICT: PASS". ' : ''}${handoffInstr(id, k)}`, `${name} handoff`, to, true);
667
+ raw = await run(lead, 'handoff', 1, `The discussion is over. You are the team lead: write the team's single result. ${isQc ? 'State the merged result: "VERDICT: FAIL" when any reviewer failed it, else "VERDICT: PASS". ' : ''}${handoffInstr(id, k)}`, `${name} handoff`, 'director', true);
661
668
  const rr = returnedEarly();
662
669
  if (rr)
663
670
  return rr;
package/gui/app.js CHANGED
@@ -268,7 +268,7 @@
268
268
  break;
269
269
  }
270
270
  case 'agent.started':
271
- if (a) { a.state = 'thinking'; a.task = e.task; a.t0 = now; a.step = 0; a.label = ''; a.total = null; a.activity = ''; net.setState(e.agentId, 'thinking'); net.setStep(e.agentId, null); if (S.config && e.agentId !== S.config.director.id && !S.history) net.pulse(S.config.director.id, e.agentId); }
271
+ if (a) { a.state = 'thinking'; a.task = e.task; a.t0 = now; a.step = 0; a.label = ''; a.total = null; a.activity = ''; net.setState(e.agentId, 'thinking'); net.setStep(e.agentId, null); if (S.config && e.agentId !== S.config.director.id && !S.history) net.pulse(S.config.director.id, e.agentId, undefined, e.task ? plain(String(e.task)).slice(0, 26) : undefined); }
272
272
  break;
273
273
  case 'agent.activity': if (a) { a.activity = e.text; bump(a); } break;
274
274
  case 'agent.step': if (a) { a.step = e.step; a.total = e.total; a.label = e.label; a.activity = e.label; net.setStep(e.agentId, {step: e.step, total: e.total, label: e.label}); bump(a); } break;
@@ -288,6 +288,7 @@
288
288
  case 'flow.back': {
289
289
  var fb = e.kind === 'ask' ? '? ' + teamLbl(e.from) + ' asked ' + teamLbl(e.to) + ': ' + e.reason : '↩ ' + teamLbl(e.from) + ' returned to ' + teamLbl(e.to) + ': ' + e.reason;
290
290
  S.flowBacks.push(e); feedBanner(e.kind === 'ask' ? 'ask' : 'ret', fb);
291
+ if (!S.history) net.pulse(e.from, e.to, e.kind === 'ask' ? undefined : 'fail', (e.kind === 'ask' ? '? ' : '↩ ') + plain(e.reason || '').slice(0, 24));
291
292
  break;
292
293
  }
293
294
  case 'qc.verdict': S.verdicts.push(e); if (!S.history) net.verdict(e.verdict);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ckit",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "CKit — local Agent Company: a Director plus BA / Implement / QC teams running your own codex, claude and omp CLIs, with a web Mission Control (ckit gui).",
5
5
  "type": "module",
6
6
  "bin": {