@koalaauto/agentchannel 3.43.0 → 3.44.0

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.
@@ -30,8 +30,10 @@ export interface Agent {
30
30
  name: string;
31
31
  owner?: string;
32
32
  owner_name?: string;
33
- /** The team's system agent: owned by no one, the admins look after it (docs/specs/system-channels.md). */
34
- system?: boolean;
33
+ /** Who it belongs to (docs/mechanisms.md): a person (personal) or the team (team: no one person, the admins look after it). */
34
+ kind?: 'personal' | 'team';
35
+ /** system: the team's one system agent (a team agent that does the hub's own work). */
36
+ role?: '' | 'system';
35
37
  runtime?: string;
36
38
  description?: string;
37
39
  perm_level?: string;
@@ -69,7 +69,6 @@ export interface PlanPerson {
69
69
  is_admin?: boolean;
70
70
  self?: boolean;
71
71
  invite: boolean;
72
- role?: string;
73
72
  note?: string;
74
73
  channels?: string[];
75
74
  stats?: {
@@ -169,7 +168,7 @@ export declare function collectGithub(exec: Exec, org: string, since: string, o?
169
168
  * `maxChannels` channels besides #general. The plan is a starting point: edit it.
170
169
  */
171
170
  export declare function defaultChannels(repos: RepoData[], maxChannels?: number): PlanChannel[];
172
- /** People from commits, issues and PRs; roles inferred; bots excluded. */
171
+ /** People from commits, issues and PRs; bots excluded. */
173
172
  export declare function inferPeople(c: Collected, channels: PlanChannel[]): {
174
173
  people: PlanPerson[];
175
174
  bots: string[];
@@ -327,7 +327,7 @@ function chanOut(name, rs, desc) {
327
327
  },
328
328
  };
329
329
  }
330
- /** "(12 commits, 3 issues, 2 PRs, 5 assigned)" for the plan printout: what the role was inferred from. */
330
+ /** "(12 commits, 3 issues, 2 PRs, 5 assigned)" for the plan printout. */
331
331
  const personActivity = (p) => {
332
332
  const s = p.stats;
333
333
  if (!s)
@@ -335,7 +335,7 @@ const personActivity = (p) => {
335
335
  const parts = [[s.commits, 'commits'], [s.issues_opened, 'issues'], [s.prs_opened, 'PRs'], [s.assigned, 'assigned']].filter(([n]) => Number(n) > 0).map(([n, w]) => `${n} ${w}`);
336
336
  return parts.length ? ` (${parts.join(', ')})` : '';
337
337
  };
338
- /** People from commits, issues and PRs; roles inferred; bots excluded. */
338
+ /** People from commits, issues and PRs; bots excluded. */
339
339
  export function inferPeople(c, channels) {
340
340
  const chanOf = new Map();
341
341
  for (const ch of channels)
@@ -402,8 +402,6 @@ export function inferPeople(c, channels) {
402
402
  for (const a of acc.values()) {
403
403
  const total = a.commits + a.opened + a.prs + a.assigned;
404
404
  const self = !!c.self && a.login.toLowerCase() === c.self.toLowerCase();
405
- // a short label a person can read on their page; the counts stay in `stats` (admin is a permission, shown apart)
406
- const label = a.commits >= 10 ? 'maintainer' : a.opened >= 5 && a.commits < 3 ? 'reporter / tester' : 'contributor';
407
405
  const invite = self || total >= 3 || a.assigned > 0;
408
406
  const u = c.users[a.login];
409
407
  people.push({
@@ -413,7 +411,6 @@ export function inferPeople(c, channels) {
413
411
  is_admin: self,
414
412
  ...(self ? { self: true } : {}),
415
413
  invite,
416
- role: label,
417
414
  ...(invite ? {} : { note: 'occasional contributor: confirm who this is before inviting' }),
418
415
  channels: [...a.chans.entries()].sort((x, y) => y[1] - x[1]).map(([n]) => n),
419
416
  stats: { commits: a.commits, issues_opened: a.opened, prs_opened: a.prs, assigned: a.assigned, commits_by_repo: a.byRepo },
@@ -523,7 +520,6 @@ export async function pushToHub(admin, source, o) {
523
520
  })),
524
521
  people: o.plan.people.map((p) => ({
525
522
  github_login: p.github_login, name: p.name, email: p.email, is_admin: !!p.is_admin, self: !!p.self, invite: p.invite !== false,
526
- ...(p.role ? { role: p.role } : {}),
527
523
  ...(Array.isArray(p.channels) ? { channels: p.channels } : {}),
528
524
  ...(p.feishu_open_id ? { feishu_open_id: p.feishu_open_id } : {}),
529
525
  })),
@@ -596,7 +592,7 @@ export function planSummary(plan, file, sel) {
596
592
  L.push('');
597
593
  L.push('People:');
598
594
  for (const p of plan.people.filter((x) => x.invite !== false)) {
599
- L.push(` ${pad(p.github_login, 18)}${pad(p.name, 18)}${p.is_admin ? '[admin] ' : ''}${p.role ?? ''}${personActivity(p)}${p.channels?.length ? ` -> ${p.channels.map((c) => '#' + c).join(' ')}` : ''}`);
595
+ L.push(` ${pad(p.github_login, 18)}${pad(p.name, 18)}${p.is_admin ? '[admin] ' : ''}${personActivity(p).trim()}${p.channels?.length ? ` -> ${p.channels.map((c) => '#' + c).join(' ')}` : ''}`);
600
596
  }
601
597
  const later = plan.people.filter((x) => x.invite === false);
602
598
  if (later.length)
@@ -609,7 +605,7 @@ export function planSummary(plan, file, sel) {
609
605
  L.push('');
610
606
  L.push(`Plan written to ${file}. Nothing was changed on GitHub or the hub.`);
611
607
  L.push(`Edit it (channel names, which repos go where, "visibility": "private" for members-only channels,`);
612
- L.push(`people's "channels" (their membership) and "role", names, emails, invite true/false), then:`);
608
+ L.push(`people's "channels" (their membership), names, emails, invite true/false), then:`);
613
609
  L.push(`Note: the hub widens access compared with GitHub: every hub member can read a "team" channel even if`);
614
610
  L.push(`they cannot see that repo on GitHub. Mark channels of private repos "private" and list their members.`);
615
611
  L.push(` ach admin import github --org ${plan.source.org} --plan ${file}`);
@@ -2,8 +2,10 @@ import type { Judgment, Message, Post, Task, WikiContext } from './client.js';
2
2
  export interface PromptCtx {
3
3
  agentName: string;
4
4
  ownerName?: string;
5
- /** The team's system agent: no owner, no one's personal memory; the admins look after it. */
6
- system?: boolean;
5
+ /** Who it belongs to: a team agent has no owner and no one's personal memory; the admins look after it. */
6
+ kind?: 'personal' | 'team';
7
+ /** system: the team's one system agent. */
8
+ role?: '' | 'system';
7
9
  senderName?: string;
8
10
  task: Task;
9
11
  handoff: string;
@@ -274,7 +274,7 @@ function channelText(c) {
274
274
  function header(c) {
275
275
  const t = c.task;
276
276
  return [
277
- `You are agent "${c.agentName}"${c.system ? ", the team's system agent (owned by no one; the team's admins look after you)" : c.ownerName ? `, owned by ${c.ownerName}` : ''}. Agent "${c.senderName ?? t.from_agent ?? 'unknown'}" sent you task ${refOf(t)} via AgentChannel.`,
277
+ `You are agent "${c.agentName}"${c.role === 'system' ? ", the team's system agent (owned by no one; the team's admins look after you)" : c.kind === 'team' ? ", a team agent (owned by no one person; the team's admins look after you)" : c.ownerName ? `, owned by ${c.ownerName}` : ''}. Agent "${c.senderName ?? t.from_agent ?? 'unknown'}" sent you task ${refOf(t)} via AgentChannel.`,
278
278
  `Priority: ${t.priority ?? 'n/a'}. Handoff version: ${c.handoffVersion ?? t.handoff_version ?? 1}.`,
279
279
  ...(c.taskUrl ? [`Task page: ${c.taskUrl}`] : []),
280
280
  ].join('\n');
@@ -319,6 +319,8 @@ export declare class Runner {
319
319
  private postStructuredAnswer;
320
320
  /** Readable roots for the spawned agent besides its cwd (S4). */
321
321
  private readRoots;
322
+ /** Owned by no one person (the system agent, or a team agent such as one that does a channel mechanism for the team). */
323
+ private teamOwned;
322
324
  /** What a full task prompt carries besides the task: the owner's memory for this project and the project's instructions. */
323
325
  private runContext;
324
326
  /** Where a task's attachments are downloaded for its agents (readable, outside the worktree). */
@@ -371,7 +371,7 @@ export class Runner {
371
371
  this.meAt = Date.now();
372
372
  }
373
373
  const me = await this.ensureMe();
374
- if (me.system && (await this.systemInCheckout()))
374
+ if (me.role === 'system' && (await this.systemInCheckout()))
375
375
  return;
376
376
  // New tasks.
377
377
  const blocked = budgetBlocked(me);
@@ -776,7 +776,7 @@ export class Runner {
776
776
  /** Whether this runner reads new tasks ahead: a local runtime in a git checkout that delivers pull requests, and a hub that knows how. */
777
777
  readsAhead(me) {
778
778
  const { client, workspace, adapter } = this.o;
779
- return !!this.o.readAhead && !this.noReadAhead && !me.system && !adapter.remote && !!workspace.deliverable && !!client.prepareRun && !!client.prepared;
779
+ return !!this.o.readAhead && !this.noReadAhead && me.role !== 'system' && !adapter.remote && !!workspace.deliverable && !!client.prepareRun && !!client.prepared;
780
780
  }
781
781
  /**
782
782
  * The read-ahead (owner-pulls-tasks.md): a short read-only run on a task nobody took yet. It reports whether the task changes code,
@@ -945,7 +945,7 @@ export class Runner {
945
945
  const prompt = buildTaskPrompt({
946
946
  agentName: me.name,
947
947
  ownerName: me.owner_name,
948
- system: !!me.system,
948
+ kind: me.kind, role: me.role,
949
949
  senderName: claim.task.from_agent_name,
950
950
  task: claim.task,
951
951
  handoff: claim.handoff,
@@ -1045,7 +1045,7 @@ export class Runner {
1045
1045
  : buildTaskPrompt({
1046
1046
  agentName: me.name,
1047
1047
  ownerName: me.owner_name,
1048
- system: !!me.system,
1048
+ kind: me.kind, role: me.role,
1049
1049
  senderName: bundle.task.from_agent_name,
1050
1050
  task: bundle.task,
1051
1051
  handoff: bundle.handoff,
@@ -1487,16 +1487,20 @@ export class Runner {
1487
1487
  join(this.o.home, 'bin'),
1488
1488
  ...readRepos.flatMap((r) => r.roots),
1489
1489
  ...(taskId ? [this.filesDir(taskId)] : []),
1490
- // the owner's Claude Code memory for this project, read-only (docs/specs/agent-autonomy.md); the system agent has no owner
1491
- ...(this.me?.system ? [] : [ownerMemoryDir(cwd, home)].filter((d) => !!d)),
1490
+ // the owner's Claude Code memory for this project, read-only (docs/specs/agent-autonomy.md); a team agent has no owner
1491
+ ...(this.teamOwned() ? [] : [ownerMemoryDir(cwd, home)].filter((d) => !!d)),
1492
1492
  ];
1493
1493
  }
1494
+ /** Owned by no one person (the system agent, or a team agent such as one that does a channel mechanism for the team). */
1495
+ teamOwned() {
1496
+ return this.me?.kind === 'team';
1497
+ }
1494
1498
  /** What a full task prompt carries besides the task: the owner's memory for this project and the project's instructions. */
1495
1499
  runContext(workdir) {
1496
1500
  if (this.o.adapter.remote)
1497
1501
  return { project: [] };
1498
- // the system agent works for the team: no person's memory, whatever machine it runs on (docs/specs/system-channels.md)
1499
- const dir = this.me?.system ? undefined : ownerMemoryDir(workdir, realHomeOf(this.o.baseEnv ?? process.env));
1502
+ // a team agent (the system agent too) works for the team: no person's memory, whatever machine it runs on (docs/mechanisms.md)
1503
+ const dir = this.teamOwned() ? undefined : ownerMemoryDir(workdir, realHomeOf(this.o.baseEnv ?? process.env));
1500
1504
  // Claude Code shows the index itself (it keys memory by the repository); other runtimes get it in the prompt
1501
1505
  const ownerMemory = dir ? { dir, ...(this.o.adapter.name === 'claude' ? {} : { index: memoryIndex(dir) }) } : undefined;
1502
1506
  return { ownerMemory, project: projectInstructions(workdir, this.o.adapter.name) };
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.43.0";
1
+ export declare const VERSION = "3.44.0";
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export declare const PKG_NAME = "@koalaauto/agentchannel";
4
4
  /**
@@ -1,4 +1,4 @@
1
- export const VERSION = '3.43.0';
1
+ export const VERSION = '3.44.0';
2
2
  /** The npm package (scripts/release.mjs keeps it and VERSION in step with package.json). */
3
3
  export const PKG_NAME = '@koalaauto/agentchannel';
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalaauto/agentchannel",
3
- "version": "3.43.0",
3
+ "version": "3.44.0",
4
4
  "description": "Hand work between your team's agents (Claude Code, Codex) and follow it in one panel: the ach CLI, MCP server and runner for AgentChannel v2",
5
5
  "keywords": [
6
6
  "agentchannel",