@koalaauto/agentchannel 3.44.0 → 3.45.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.
@@ -47,8 +47,10 @@ export interface Agent {
47
47
  net_allow?: string[];
48
48
  /** The repo names its runner can work in, as the runner reported them (empty: never reported). */
49
49
  repos?: string[];
50
- /** GitHub repositories ("owner/name", "owner/*") that limit what the agent's runs may read; empty: every repository the hub's GitHub App sees. */
50
+ /** GitHub repositories ("owner/name", "owner/*") an admin picked for the agent's runs; empty: none picked. */
51
51
  github_repos?: string[];
52
+ /** What its runs may read on GitHub: github_repos, else the repositories its runner works in (one owner); empty: nothing. */
53
+ github_scope?: string[];
52
54
  }
53
55
  /** A read-only GitHub token the hub issued for one run, valid an hour. `repos`: the repository names it covers, or ["*"]. */
54
56
  export interface GithubToken {
@@ -432,7 +434,7 @@ export declare class Client {
432
434
  /** Download one attachment into `dir`; returns the local path. */
433
435
  download(a: Attachment, dir: string): Promise<string>;
434
436
  me(): Promise<Agent>;
435
- /** A read-only GitHub token for one run (every repository the hub's App sees, or the agent's list); `runId` names a live run (the runner's key needs it). */
437
+ /** A read-only GitHub token for one run (the agent's github_scope); `runId` names a live run (the runner's key needs it). */
436
438
  githubToken(runId: string): Promise<GithubToken>;
437
439
  /** A one-hour token that pushes to one repository, for delivering a task's branch (the runner's key, the task's run). */
438
440
  pushToken(taskId: string, runId: string, github: string): Promise<GithubToken>;
@@ -265,7 +265,7 @@ export class Client {
265
265
  a.owner_name = r.owner_name;
266
266
  return a;
267
267
  }
268
- /** A read-only GitHub token for one run (every repository the hub's App sees, or the agent's list); `runId` names a live run (the runner's key needs it). */
268
+ /** A read-only GitHub token for one run (the agent's github_scope); `runId` names a live run (the runner's key needs it). */
269
269
  async githubToken(runId) {
270
270
  return this.ach('POST', '/github/token', { run_id: runId });
271
271
  }
@@ -108,6 +108,7 @@ export async function runDoctor(o) {
108
108
  let runtime;
109
109
  let agentName;
110
110
  let githubRepos = [];
111
+ let githubScope = null;
111
112
  if (cfg.hub) {
112
113
  const fetchFn = o.fetch ?? ((u, i) => fetch(u, i));
113
114
  let host = cfg.hub;
@@ -170,6 +171,7 @@ export async function runDoctor(o) {
170
171
  runtime = typeof me.runtime === 'string' ? me.runtime : undefined;
171
172
  agentName = me.name;
172
173
  githubRepos = Array.isArray(me.github_repos) ? me.github_repos : [];
174
+ githubScope = Array.isArray(me.github_scope) ? me.github_scope : null;
173
175
  add('hub login', 'ok', `agent ${me.name}${me.owner_name ? ` (owner ${me.owner_name})` : ''}, runtime ${me.runtime ?? '?'}`, 'key');
174
176
  }
175
177
  catch (e) {
@@ -189,10 +191,15 @@ export async function runDoctor(o) {
189
191
  hubLatest = c.latest_client;
190
192
  if (c && Number.isInteger(c.min_client_proto))
191
193
  hubMinProto = c.min_client_proto;
192
- // a run's GitHub token comes from the hub's GitHub App; repositories an admin listed on this agent narrow it
194
+ // a run's GitHub token comes from the hub's GitHub App, for the agent's scope: the repositories an admin picked, else the
195
+ // ones this runner works in (an older hub without github_scope: the picked ones, else every repository the App sees)
193
196
  if (c && typeof c.github_app === 'boolean') {
194
- if (c.github_app)
195
- add('github', 'ok', githubRepos.length ? `a read-only token for ${githubRepos.join(', ')}, issued for each run` : 'a read-only token for every repository the hub\'s GitHub App sees, issued for each run', 'key');
197
+ if (c.github_app && githubScope && !githubScope.length)
198
+ add('github', 'warn', 'no GitHub repository: this runner works in no GitHub checkout and no admin picked any', 'key', 'start the runner in a checkout, or ask your admin to pick repositories for this agent');
199
+ else if (c.github_app) {
200
+ const s = githubScope ?? githubRepos;
201
+ add('github', 'ok', s.length ? `a read-only token for ${s.join(', ')}, issued for each run` : 'a read-only token for every repository the hub\'s GitHub App sees, issued for each run', 'key');
202
+ }
196
203
  else if (githubRepos.length)
197
204
  add('github', 'warn', `${githubRepos.join(', ')} are listed for this agent, but the hub has no GitHub App`, 'key', 'ask your admin to set ACH_GITHUB_APP_ID and ACH_GITHUB_APP_KEY on the hub');
198
205
  }
@@ -328,8 +328,8 @@ export declare class Runner {
328
328
  /** The task's attachments, downloaded into filesDir (best effort: a failed download is listed without a path). */
329
329
  private fetchFiles;
330
330
  /**
331
- * The GitHub token of a run: read-only, issued by the hub from its GitHub App for this one run and valid an hour (every
332
- * repository the App sees, or the ones an admin listed on this agent). A hub that cannot issue one does not fail the run: the
331
+ * The GitHub token of a run: read-only, issued by the hub from its GitHub App for this one run and valid an hour (the
332
+ * repositories an admin picked for this agent, else the ones this runner works in). A hub that cannot issue one does not fail the run: the
333
333
  * agent finds `gh` without a login, and the runner's log for the task says why. After a failure the hub is not asked again
334
334
  * for a minute (ten when it has no GitHub App).
335
335
  */
@@ -1527,8 +1527,8 @@ export class Runner {
1527
1527
  return out;
1528
1528
  }
1529
1529
  /**
1530
- * The GitHub token of a run: read-only, issued by the hub from its GitHub App for this one run and valid an hour (every
1531
- * repository the App sees, or the ones an admin listed on this agent). A hub that cannot issue one does not fail the run: the
1530
+ * The GitHub token of a run: read-only, issued by the hub from its GitHub App for this one run and valid an hour (the
1531
+ * repositories an admin picked for this agent, else the ones this runner works in). A hub that cannot issue one does not fail the run: the
1532
1532
  * agent finds `gh` without a login, and the runner's log for the task says why. After a failure the hub is not asked again
1533
1533
  * for a minute (ten when it has no GitHub App).
1534
1534
  */
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.44.0";
1
+ export declare const VERSION = "3.45.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.44.0';
1
+ export const VERSION = '3.45.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.44.0",
3
+ "version": "3.45.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",