@phnx-labs/agents-cli 1.23.44 → 1.23.45

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.23.45
4
+
5
+ - **The Lead's own drafting turns no longer read as something you said.** When agents stop to ask, the Lead runs a turn on its own to draft their replies. History saved that turn's whole internal prompt ("[New asks] These agents in this project stopped …") as its `ask`, so the AGI extension's Lead tab drew it under "You" on every such turn. These turns are now saved with `trigger: "asks"` and an empty `ask`. Turns saved before this are read back the same way, and `agents lead history` prints "(on its own, for new asks)" for them. Source: `cli/src/lib/lead/store.ts` (`DRAFT_TURN_PREFIX`, `readHistory`), `cli/src/lib/lead/host.ts`.
6
+
3
7
  ## 1.23.44
4
8
 
5
9
  - **Phoenix ID's default host is now `id.phoenix.so` (PHNX-4424).** `agents auth login`, `whoami` and `logout`, and a session-backup Worker set up from now on, talk to `https://id.phoenix.so` unless `PHOENIX_ID_BASE` says otherwise; a Worker set up earlier keeps checking `id.byphoenix.com`, which still serves. `id.byphoenix.com` keeps serving, and a session signed in through either host is valid at both, so existing sign-ins keep working. Source: `cli/src/lib/identity/client.ts`.
@@ -291,7 +291,7 @@ export function registerLeadCommand(program) {
291
291
  return;
292
292
  }
293
293
  for (const t of turns) {
294
- console.log(`${chalk.gray(t.at)} ${chalk.cyan('>')} ${t.ask}`);
294
+ console.log(`${chalk.gray(t.at)} ${t.trigger === 'asks' ? chalk.gray('(on its own, for new asks)') : `${chalk.cyan('>')} ${t.ask}`}`);
295
295
  console.log(` ${t.text.split('\n').join('\n ')}\n`);
296
296
  }
297
297
  });
@@ -131,7 +131,7 @@ export declare class LeadHost {
131
131
  private attentionItem;
132
132
  status(): LeadStatus;
133
133
  private schedule;
134
- enqueue(text: string, voice: number | undefined, emit: (e: LeadEvent) => void, context?: EditorContext): Promise<void>;
134
+ enqueue(text: string, voice: number | undefined, emit: (e: LeadEvent) => void, context?: EditorContext, trigger?: 'asks'): Promise<void>;
135
135
  private spawnChild;
136
136
  private refreshRefData;
137
137
  private gatherBrief;
@@ -13,7 +13,7 @@ import { mintConfirm, sweepExpiredConfirms } from './confirm.js';
13
13
  import { writeLeadDraft } from './drafts.js';
14
14
  import { FeedRoster, filterProject, formatAttention, formatRosterRow, rosterDelta, } from './roster.js';
15
15
  import { LEAD_RULES_ID, agentsMdDigest, briefSummary, buildBrief, composeTurnMessage, fetchOpenTickets, fetchRecentPrs, fleetLine, linearTeamKey, projectRepo, } from './brief.js';
16
- import { appendHistory, clearSessionState, readMemory, readSessionState, writeMemory, writeSessionState, } from './store.js';
16
+ import { DRAFT_TURN_PREFIX, appendHistory, clearSessionState, readMemory, readSessionState, writeMemory, writeSessionState, } from './store.js';
17
17
  import { ensureLeadDir, leadRoot } from './paths.js';
18
18
  import { assertHeldArgv, editorContextLines } from './shapes.js';
19
19
  import { LEAD_ALLOWED_TOOLS, leadChildEnv, leadRunArgs, writeAgentsShim, writeLeadSettings, } from './harness.js';
@@ -379,7 +379,7 @@ export class LeadHost {
379
379
  void this.enqueue(draftTurnText(open.map((a) => formatAttention(a, rows[a.sessionId]))), undefined, (e) => {
380
380
  if (e.type === 'error')
381
381
  this.log(`draft turn failed: ${e.message}`);
382
- });
382
+ }, undefined, 'asks');
383
383
  }, DRAFT_BATCH_MS);
384
384
  this.draftTimer.unref?.();
385
385
  this.timers.push(this.draftTimer);
@@ -422,14 +422,14 @@ export class LeadHost {
422
422
  this.queue = next.catch(() => { });
423
423
  return next;
424
424
  }
425
- enqueue(text, voice, emit, context) {
425
+ enqueue(text, voice, emit, context, trigger) {
426
426
  this.queued++;
427
427
  return this.schedule(async () => {
428
428
  this.queued--;
429
429
  this.busy = true;
430
430
  let rotate = null;
431
431
  try {
432
- rotate = await this.runTurn(text, voice, emit, context);
432
+ rotate = await this.runTurn(text, voice, emit, context, trigger);
433
433
  }
434
434
  catch (err) {
435
435
  emit({ type: 'error', message: err instanceof Error ? err.message : String(err) });
@@ -568,7 +568,7 @@ export class LeadHost {
568
568
  }).finally(() => { this.active = null; });
569
569
  return { result, parser, initAtMs, tools: [...tools.values()] };
570
570
  }
571
- async runTurn(text, voice, emit, context) {
571
+ async runTurn(text, voice, emit, context, trigger) {
572
572
  const turnId = newTurnId();
573
573
  const startedAt = Date.now();
574
574
  let state = readSessionState(this.opts.paths);
@@ -687,7 +687,8 @@ export class LeadHost {
687
687
  appendHistory(this.opts.paths, {
688
688
  turn: turnId,
689
689
  at: new Date(startedAt).toISOString(),
690
- ask: text,
690
+ ask: trigger ? '' : text,
691
+ ...(trigger ? { trigger } : {}),
691
692
  ...(voice !== undefined ? { voice } : {}),
692
693
  text: result.text,
693
694
  summary,
@@ -743,7 +744,7 @@ export class LeadHost {
743
744
  }
744
745
  export function draftTurnText(asks) {
745
746
  return [
746
- '[New asks] These agents in this project stopped and are waiting on the owner. For each one, draft the reply the owner would most likely send, from the goals, the project rules, your memory and what the agent said (`agents lead tool roster --session <id>` shows its last turns when you need more).',
747
+ DRAFT_TURN_PREFIX + ' These agents in this project stopped and are waiting on the owner. For each one, draft the reply the owner would most likely send, from the goals, the project rules, your memory and what the agent said (`agents lead tool roster --session <id>` shows its last turns when you need more).',
747
748
  '- Draft with `agents lead tool answer --key <key> --text "<one line>"` (or `--choice <id>`). It is shown on that agent\'s card for the owner to send; nothing is delivered until they do.',
748
749
  '- An agent that stopped before finishing ("Not done") gets the specific next step, never a bare "continue".',
749
750
  '- Draft nothing when the decision is the owner\'s: spending or cancelling money, publishing or releasing, deleting, credentials, or a taste call you cannot infer. Say why in one line instead.',
@@ -22,10 +22,12 @@ export interface LeadHistoryTool {
22
22
  state: 'ok' | 'fail' | 'run';
23
23
  secs: number;
24
24
  }
25
+ export declare const DRAFT_TURN_PREFIX = "[New asks]";
25
26
  export interface LeadHistoryTurn {
26
27
  turn: string;
27
28
  at: string;
28
29
  ask: string;
30
+ trigger?: 'asks';
29
31
  voice?: number;
30
32
  text: string;
31
33
  summary: string;
@@ -1,5 +1,6 @@
1
1
  import * as fs from 'node:fs';
2
2
  import { atomicWriteFileSync, atomicWriteJsonSync } from '../fs-atomic.js';
3
+ export const DRAFT_TURN_PREFIX = '[New asks]';
3
4
  export function readSessionState(paths) {
4
5
  try {
5
6
  return JSON.parse(fs.readFileSync(paths.session, 'utf-8'));
@@ -67,7 +68,8 @@ export function readHistory(paths, limit) {
67
68
  if (!line.trim())
68
69
  continue;
69
70
  try {
70
- turns.push(JSON.parse(line));
71
+ const turn = JSON.parse(line);
72
+ turns.push(!turn.trigger && turn.ask.startsWith(DRAFT_TURN_PREFIX) ? { ...turn, ask: '', trigger: 'asks' } : turn);
71
73
  }
72
74
  catch {
73
75
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.44",
3
+ "version": "1.23.45",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",