@koalaauto/agentchannel 3.45.1 → 3.45.3
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/README.md +9 -6
- package/dist/src/adapters/claude.d.ts +1 -1
- package/dist/src/adapters/claude.js +1 -1
- package/dist/src/adapters/codex.d.ts +1 -1
- package/dist/src/adapters/codex.js +5 -1
- package/dist/src/adapters/types.d.ts +1 -1
- package/dist/src/args.d.ts +1 -1
- package/dist/src/args.js +9 -62
- package/dist/src/caps.d.ts +1 -1
- package/dist/src/caps.js +1 -1
- package/dist/src/cli-admin.d.ts +3 -0
- package/dist/src/cli-admin.js +307 -0
- package/dist/src/cli-memory.d.ts +3 -0
- package/dist/src/cli-memory.js +138 -0
- package/dist/src/cli-run.d.ts +28 -0
- package/dist/src/cli-run.js +429 -0
- package/dist/src/cli-shared.d.ts +73 -0
- package/dist/src/cli-shared.js +159 -0
- package/dist/src/cli.d.ts +9 -38
- package/dist/src/cli.js +23 -1184
- package/dist/src/client.d.ts +1 -23
- package/dist/src/client.js +1 -30
- package/dist/src/codexdaemon.d.ts +22 -0
- package/dist/src/codexdaemon.js +68 -0
- package/dist/src/desknotify.js +11 -7
- package/dist/src/doctor.js +1 -1
- package/dist/src/envcheck.js +1 -1
- package/dist/src/invite_people.d.ts +31 -0
- package/dist/src/invite_people.js +238 -0
- package/dist/src/invite_person.d.ts +1 -1
- package/dist/src/invite_person.js +1 -1
- package/dist/src/mcp.d.ts +1 -1
- package/dist/src/mcp.js +7 -47
- package/dist/src/onboard.d.ts +3 -6
- package/dist/src/onboard.js +6 -14
- package/dist/src/prompts.d.ts +2 -2
- package/dist/src/prompts.js +6 -17
- package/dist/src/runner/home.d.ts +45 -0
- package/dist/src/runner/home.js +150 -0
- package/dist/src/runner/runner.d.ts +9 -82
- package/dist/src/runner/runner.js +31 -333
- package/dist/src/runner/structured.d.ts +20 -0
- package/dist/src/runner/structured.js +64 -0
- package/dist/src/runner/traces.d.ts +29 -0
- package/dist/src/runner/traces.js +119 -0
- package/dist/src/sandboxcheck.d.ts +4 -1
- package/dist/src/sandboxcheck.js +16 -1
- package/dist/src/service.d.ts +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/dist/src/import.d.ts +0 -244
- package/dist/src/import.js +0 -998
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// The traces of runs (what each step did), queued for the hub: kept on disk so a run's trace survives a restart, sent a few at
|
|
2
|
+
// a time, and dropped when the hub will never take them. A trace never holds up a task.
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { HubError } from '../client.js';
|
|
7
|
+
import { summarizeRuntimeError } from '../envcheck.js';
|
|
8
|
+
import { redact } from '../redact.js';
|
|
9
|
+
export class TraceQueue {
|
|
10
|
+
o;
|
|
11
|
+
queue = new Map();
|
|
12
|
+
/** The trace of each task's last run (a commit made after it is added to it). */
|
|
13
|
+
last = new Map();
|
|
14
|
+
constructor(o) {
|
|
15
|
+
this.o = o;
|
|
16
|
+
}
|
|
17
|
+
dir() {
|
|
18
|
+
return join(this.o.home, 'traces');
|
|
19
|
+
}
|
|
20
|
+
/** Traces an earlier process could not upload are tried again. */
|
|
21
|
+
load() {
|
|
22
|
+
try {
|
|
23
|
+
for (const f of readdirSync(this.dir())) {
|
|
24
|
+
if (!f.endsWith('.json'))
|
|
25
|
+
continue;
|
|
26
|
+
const j = JSON.parse(readFileSync(join(this.dir(), f), 'utf8'));
|
|
27
|
+
if (j?.taskId && j?.traceId && j?.body)
|
|
28
|
+
this.queue.set(j.traceId, { taskId: j.taskId, body: j.body });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
/* none */
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Builds the trace of the run that just ended and queues it (sends it when `send`). Never throws. */
|
|
36
|
+
async add(taskId, runId, mode, startedAt, result, recorder, send) {
|
|
37
|
+
if (!this.o.client.putTrace)
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
const { steps, omitted } = recorder.finish();
|
|
41
|
+
if (!steps.length && result.ok)
|
|
42
|
+
return; // nothing happened worth auditing
|
|
43
|
+
const traceId = `tr_${randomBytes(9).toString('base64url')}`;
|
|
44
|
+
const body = {
|
|
45
|
+
run_id: runId, mode, started: startedAt.toISOString(), ended: new Date().toISOString(), ok: !!result.ok,
|
|
46
|
+
...(result.error ? { error: redact(summarizeRuntimeError(result.error), [...(this.o.secrets ?? [])]).slice(0, 600) } : {}),
|
|
47
|
+
steps, omitted,
|
|
48
|
+
};
|
|
49
|
+
this.last.set(taskId, traceId);
|
|
50
|
+
this.queue.set(traceId, { taskId, body });
|
|
51
|
+
this.persist(traceId);
|
|
52
|
+
if (send)
|
|
53
|
+
await this.flush();
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
this.o.log(taskId, `trace: ${e?.message ?? e}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** The commit a task's last run produced joins that run's trace, so the panel can name what the run made. */
|
|
60
|
+
async addCommit(taskId, sha) {
|
|
61
|
+
const id = this.last.get(taskId);
|
|
62
|
+
const q = id ? this.queue.get(id) : undefined;
|
|
63
|
+
if (id && q) {
|
|
64
|
+
q.body.commit = sha;
|
|
65
|
+
this.persist(id);
|
|
66
|
+
}
|
|
67
|
+
else if (id && this.o.client.putTrace)
|
|
68
|
+
await this.o.client.putTrace(taskId, id, { commit: sha }).catch((e) => this.o.log(taskId, `trace commit: ${e?.message ?? e}`));
|
|
69
|
+
await this.flush();
|
|
70
|
+
}
|
|
71
|
+
persist(traceId) {
|
|
72
|
+
const q = this.queue.get(traceId);
|
|
73
|
+
if (!q)
|
|
74
|
+
return;
|
|
75
|
+
try {
|
|
76
|
+
mkdirSync(this.dir(), { recursive: true, mode: 0o700 });
|
|
77
|
+
writeFileSync(join(this.dir(), `${traceId}.json`), JSON.stringify({ traceId, ...q }), { mode: 0o600 });
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
/* kept in memory */
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
drop(id) {
|
|
84
|
+
this.queue.delete(id);
|
|
85
|
+
try {
|
|
86
|
+
unlinkSync(join(this.dir(), `${id}.json`));
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
/* already gone */
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Sends what is waiting (a few at a time). Failures are logged and tried again on the next poll. */
|
|
93
|
+
async flush() {
|
|
94
|
+
const put = this.o.client.putTrace;
|
|
95
|
+
if (!put || !this.queue.size)
|
|
96
|
+
return;
|
|
97
|
+
let n = 0;
|
|
98
|
+
for (const [id, q] of [...this.queue]) {
|
|
99
|
+
if (n++ >= 5)
|
|
100
|
+
break;
|
|
101
|
+
try {
|
|
102
|
+
await put.call(this.o.client, q.taskId, id, q.body);
|
|
103
|
+
this.drop(id);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
const code = e instanceof HubError ? e.status : 0;
|
|
107
|
+
if (code === 401)
|
|
108
|
+
return this.o.unauthorized();
|
|
109
|
+
// an older hub (404), a task that is gone or not ours (403/404/409): not worth keeping
|
|
110
|
+
if (code === 404 || code === 403 || code === 409 || code === 400) {
|
|
111
|
+
this.drop(id);
|
|
112
|
+
this.o.log(q.taskId, `trace not taken (${code}): ${e?.message ?? e}`);
|
|
113
|
+
}
|
|
114
|
+
else
|
|
115
|
+
this.o.log(q.taskId, `trace upload failed, will retry: ${e?.message ?? e}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type CodexDaemonDir } from './codexdaemon.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* decisions §27: does the agent tool's sandbox work on this machine?
|
|
3
4
|
*
|
|
4
5
|
* Probe, do not guess: run the mechanism the tool uses (bubblewrap on Linux for Claude Code, Seatbelt on macOS, `codex
|
|
5
6
|
* sandbox` for Codex) on a throwaway directory, once with a command that must succeed (write inside it) and once with one
|
|
@@ -113,6 +114,8 @@ export interface ProbeOptions {
|
|
|
113
114
|
runEnv?: NodeJS.ProcessEnv;
|
|
114
115
|
/** the user's own Codex home (default: CODEX_HOME, else ~/.codex): where Windows keeps the elevated sandbox setup */
|
|
115
116
|
codexHome?: string;
|
|
117
|
+
/** puts Codex's socket folder right first (codexdaemon.ts). Default: the real one, unless `run` is a stand-in */
|
|
118
|
+
codexDaemon?: () => CodexDaemonDir | null;
|
|
116
119
|
}
|
|
117
120
|
/** Probe `tool`'s sandbox on this machine. Never throws. */
|
|
118
121
|
export declare function probeSandbox(tool: SandboxTool, o?: ProbeOptions): Promise<SandboxStatus>;
|
package/dist/src/sandboxcheck.js
CHANGED
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
8
8
|
import { codexSandboxOverrides } from './adapters/codex.js';
|
|
9
9
|
import { linkWindowsSandbox, unlinkWindowsSandbox, WINDOWS_ELEVATED_CONFIG } from './codexhome.js';
|
|
10
10
|
import { toolchainReadRoots } from './adapters/paths.js';
|
|
11
|
+
import { CODEX_DAEMON_PREFIX, ensureCodexDaemonDir } from './codexdaemon.js';
|
|
11
12
|
/**
|
|
12
13
|
* A program's output as text: UTF-8, else (Windows programs write in the console code page) GBK, the code page of the Chinese
|
|
13
14
|
* Windows machines this runs on (echo-duck-pr's check showed cmd's GBK message as U+FFFD), else UTF-8 with replacements.
|
|
@@ -199,7 +200,7 @@ export async function probeSandbox(tool, o = {}) {
|
|
|
199
200
|
const platform = o.platform ?? process.platform;
|
|
200
201
|
const host = o.host ?? detectHost(env, platform);
|
|
201
202
|
const run = o.run ?? defaultRun;
|
|
202
|
-
const st = await probe(tool, { env, platform, host, run, home: o.home ?? homedir(), codex: o.codex, hub: o.hub, runEnv: o.runEnv ?? env, codexHome: o.codexHome ?? (env.CODEX_HOME || join(o.home ?? homedir(), '.codex')) });
|
|
203
|
+
const st = await probe(tool, { env, platform, host, run, home: o.home ?? homedir(), codex: o.codex, hub: o.hub, runEnv: o.runEnv ?? env, codexHome: o.codexHome ?? (env.CODEX_HOME || join(o.home ?? homedir(), '.codex')), codexDaemon: o.codexDaemon ?? (o.run ? () => null : ensureCodexDaemonDir) });
|
|
203
204
|
if (!st.ok)
|
|
204
205
|
st.fix = sandboxFix(st, host);
|
|
205
206
|
return st;
|
|
@@ -249,6 +250,9 @@ async function probe(tool, o) {
|
|
|
249
250
|
codex = o.codex ?? codexCommand(env);
|
|
250
251
|
if (!codex)
|
|
251
252
|
return { tool, ok: true, unverified: true, detail: 'Codex was not found' };
|
|
253
|
+
const daemon = platform === 'win32' ? null : o.codexDaemon();
|
|
254
|
+
if (daemon?.problem)
|
|
255
|
+
return { tool, ok: false, problem: 'failed', detail: daemon.problem };
|
|
252
256
|
const cmd = platform === 'win32' ? [process.execPath, '-e', WIN_PROBE_SCRIPT, join(dir, 'ok'), outside] : sh;
|
|
253
257
|
if (canary)
|
|
254
258
|
writeFileSync(canary, 'probe\n', { mode: 0o600 });
|
|
@@ -376,6 +380,17 @@ export function sandboxFix(st, host) {
|
|
|
376
380
|
commands: [cmd],
|
|
377
381
|
};
|
|
378
382
|
}
|
|
383
|
+
// Codex's socket folder (codexdaemon.ts) that the runner could not put right itself
|
|
384
|
+
if (st.tool === 'codex' && st.detail?.includes(CODEX_DAEMON_PREFIX)) {
|
|
385
|
+
const dir = st.detail.split(' ')[0];
|
|
386
|
+
if (/ belongs to uid /.test(st.detail)) {
|
|
387
|
+
const cmd = `sudo rm -rf ${dir}`;
|
|
388
|
+
return { en: `${dir} belongs to another user; Codex's sandbox needs it as this user's own: remove it.`, zh: `${dir} 属于别的用户,Codex 的沙箱要求它归本用户所有:删掉它。`, commands: [cmd] };
|
|
389
|
+
}
|
|
390
|
+
if (/does not keep modes/.test(st.detail)) {
|
|
391
|
+
return { en: `This machine's /tmp does not keep file modes, which Codex's sandbox needs: give the runner a /tmp of its own (tmpfs).`, zh: `这台机器的 /tmp 不保留文件权限,Codex 的沙箱需要它:给 runner 一个独立的 /tmp(tmpfs)。`, commands: [] };
|
|
392
|
+
}
|
|
393
|
+
}
|
|
379
394
|
switch (st.problem) {
|
|
380
395
|
case 'not-logged-in': {
|
|
381
396
|
const cmd = st.tool === 'claude' ? 'claude auth login' : 'codex login';
|
package/dist/src/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* P4: `ach run --install-service` writes a macOS launchd agent or a Linux
|
|
3
3
|
* systemd user unit that starts this runner at login and restarts it, then
|
|
4
|
-
* loads it (startService).
|
|
4
|
+
* loads it (startService). decisions §27, Windows: a script in the user's Startup
|
|
5
5
|
* folder (no admin rights needed) that runs the runner hidden and restarts it.
|
|
6
6
|
*/
|
|
7
7
|
export interface ServiceSpec {
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.45.
|
|
3
|
+
"version": "3.45.3",
|
|
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",
|
package/dist/src/import.d.ts
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import type { Client } from './client.js';
|
|
2
|
-
export interface ExecResult {
|
|
3
|
-
code: number;
|
|
4
|
-
stdout: string;
|
|
5
|
-
stderr: string;
|
|
6
|
-
}
|
|
7
|
-
export type Exec = (cmd: string, args: string[]) => Promise<ExecResult>;
|
|
8
|
-
/** Runs `gh` / `lark-cli` (ACH_GH_CLI / ACH_LARK_CLI override the binaries). */
|
|
9
|
-
export declare function makeExec(env: NodeJS.ProcessEnv): Exec;
|
|
10
|
-
export declare class ImportError extends Error {
|
|
11
|
-
}
|
|
12
|
-
export interface GhItem {
|
|
13
|
-
kind: 'github_issue' | 'github_pr';
|
|
14
|
-
repo: string;
|
|
15
|
-
number: number;
|
|
16
|
-
url: string;
|
|
17
|
-
state: string;
|
|
18
|
-
title: string;
|
|
19
|
-
author: string;
|
|
20
|
-
author_bot: boolean;
|
|
21
|
-
assignees: string[];
|
|
22
|
-
created_at: string;
|
|
23
|
-
updated_at: string;
|
|
24
|
-
/** when it was closed or merged ('' while open) */
|
|
25
|
-
closed_at: string;
|
|
26
|
-
labels: string[];
|
|
27
|
-
excerpt: string;
|
|
28
|
-
}
|
|
29
|
-
export interface RepoData {
|
|
30
|
-
full: string;
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
pushedAt: string;
|
|
34
|
-
commits: {
|
|
35
|
-
login: string;
|
|
36
|
-
name: string;
|
|
37
|
-
bot: boolean;
|
|
38
|
-
}[];
|
|
39
|
-
issues: GhItem[];
|
|
40
|
-
prs: GhItem[];
|
|
41
|
-
}
|
|
42
|
-
export interface Collected {
|
|
43
|
-
org: string;
|
|
44
|
-
since: string;
|
|
45
|
-
self: string;
|
|
46
|
-
repos: RepoData[];
|
|
47
|
-
users: Record<string, {
|
|
48
|
-
name: string;
|
|
49
|
-
email: string;
|
|
50
|
-
bot: boolean;
|
|
51
|
-
}>;
|
|
52
|
-
}
|
|
53
|
-
export interface PlanChannel {
|
|
54
|
-
name: string;
|
|
55
|
-
title?: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
repos: string[];
|
|
58
|
-
visibility?: 'team' | 'private';
|
|
59
|
-
stats?: {
|
|
60
|
-
issues: number;
|
|
61
|
-
prs: number;
|
|
62
|
-
commits: number;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export interface PlanPerson {
|
|
66
|
-
github_login: string;
|
|
67
|
-
name: string;
|
|
68
|
-
email?: string;
|
|
69
|
-
is_admin?: boolean;
|
|
70
|
-
self?: boolean;
|
|
71
|
-
invite: boolean;
|
|
72
|
-
note?: string;
|
|
73
|
-
channels?: string[];
|
|
74
|
-
stats?: {
|
|
75
|
-
commits: number;
|
|
76
|
-
issues_opened: number;
|
|
77
|
-
prs_opened: number;
|
|
78
|
-
assigned: number;
|
|
79
|
-
commits_by_repo: Record<string, number>;
|
|
80
|
-
};
|
|
81
|
-
feishu_open_id?: string;
|
|
82
|
-
}
|
|
83
|
-
export interface Plan {
|
|
84
|
-
version: 1;
|
|
85
|
-
source: {
|
|
86
|
-
kind: 'github';
|
|
87
|
-
org: string;
|
|
88
|
-
};
|
|
89
|
-
since: string;
|
|
90
|
-
generated_at: string;
|
|
91
|
-
channels: PlanChannel[];
|
|
92
|
-
people: PlanPerson[];
|
|
93
|
-
bots: string[];
|
|
94
|
-
unlinked_commit_authors: string[];
|
|
95
|
-
counts: {
|
|
96
|
-
repos: number;
|
|
97
|
-
issues: number;
|
|
98
|
-
prs: number;
|
|
99
|
-
commits: number;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/** "60d", "8w", "3m" (months), or an ISO date -> ISO time. */
|
|
103
|
-
export declare function parseSince(s: string | undefined, now?: number): string;
|
|
104
|
-
/** Bots never become people: [bot] logins, GitHub type Bot, known agent names, *bot. */
|
|
105
|
-
export declare function isBot(login: string, flagged?: boolean): boolean;
|
|
106
|
-
export declare function excerptOf(body: string | undefined, max?: number): string;
|
|
107
|
-
/** Items whose labels or title name one of these are never sent to the hub (case-insensitive substring). */
|
|
108
|
-
export declare const DEFAULT_EXCLUDE: string[];
|
|
109
|
-
/** Closed/merged items newer than this become posts by default; older ones only seed the wiki. */
|
|
110
|
-
export declare const DEFAULT_CLOSED_DAYS = 7;
|
|
111
|
-
/** Closed/merged items used to seed Memory (links only): the last N months by default, or all (--seed-all). */
|
|
112
|
-
export declare const DEFAULT_SEED_MONTHS = 6;
|
|
113
|
-
export interface Selection {
|
|
114
|
-
items: GhItem[];
|
|
115
|
-
archive: GhItem[];
|
|
116
|
-
tooOld: GhItem[];
|
|
117
|
-
excluded: GhItem[];
|
|
118
|
-
closedCutoff: string;
|
|
119
|
-
seedCutoff?: string;
|
|
120
|
-
}
|
|
121
|
-
export declare function isExcluded(i: Pick<GhItem, 'title' | 'labels'>, terms: string[]): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* What gets posted. Sensitive items (labels/title match `exclude`) are dropped
|
|
124
|
-
* entirely. Open items are posted; closed/merged ones only when they closed
|
|
125
|
-
* after `closedCutoff` ('' = all of them); older closed ones go to `archive`.
|
|
126
|
-
*/
|
|
127
|
-
export declare function selectItems(all: GhItem[], o: {
|
|
128
|
-
exclude: string[];
|
|
129
|
-
closedCutoff: string;
|
|
130
|
-
seedCutoff?: string;
|
|
131
|
-
}): Selection;
|
|
132
|
-
/** --exclude a,b / --no-exclude -> the exclusion terms. */
|
|
133
|
-
export declare function excludeTerms(values: Record<string, unknown>): string[];
|
|
134
|
-
/** --seed-all / --seed-months N -> the Memory seed cutoff ('' = everything). */
|
|
135
|
-
export declare function seedCutoff(values: Record<string, unknown>, now: number): string;
|
|
136
|
-
/** The two import ranges as the hub stores them (wizard-ready API fields). */
|
|
137
|
-
export declare function importRanges(values: Record<string, unknown>): {
|
|
138
|
-
post_closed_days?: number;
|
|
139
|
-
seed_months?: number;
|
|
140
|
-
seed?: 'all';
|
|
141
|
-
};
|
|
142
|
-
/** --all / --closed-days N (alias --post-closed-days) -> the closed-item cutoff ('' = no cutoff). */
|
|
143
|
-
export declare function closedCutoff(values: Record<string, unknown>, now: number): string;
|
|
144
|
-
/** Issues and PRs of one repo updated since `since`. */
|
|
145
|
-
export declare function fetchItems(exec: Exec, full: string, since: string, log?: (s: string) => void): Promise<{
|
|
146
|
-
issues: GhItem[];
|
|
147
|
-
prs: GhItem[];
|
|
148
|
-
}>;
|
|
149
|
-
export interface GhRelease {
|
|
150
|
-
repo: string;
|
|
151
|
-
tag: string;
|
|
152
|
-
name: string;
|
|
153
|
-
url: string;
|
|
154
|
-
published_at: string;
|
|
155
|
-
}
|
|
156
|
-
/** Releases of one repo published since `since` (read-only; drafts skipped). Missing access -> none. */
|
|
157
|
-
export declare function fetchReleases(exec: Exec, full: string, since: string): Promise<GhRelease[]>;
|
|
158
|
-
/** Read the org from GitHub: active repos, commits, issues, PRs, people. Read-only. */
|
|
159
|
-
export declare function collectGithub(exec: Exec, org: string, since: string, o?: {
|
|
160
|
-
repos?: string[];
|
|
161
|
-
commits?: boolean;
|
|
162
|
-
log?: (s: string) => void;
|
|
163
|
-
}): Promise<Collected>;
|
|
164
|
-
/**
|
|
165
|
-
* Default channel mapping: repos grouped by name prefix (`myshow-room`,
|
|
166
|
-
* `myshow-video` -> #myshow); a repo that dominates a big group, or an active
|
|
167
|
-
* singleton, gets its own channel; quiet singletons go to #general; at most
|
|
168
|
-
* `maxChannels` channels besides #general. The plan is a starting point: edit it.
|
|
169
|
-
*/
|
|
170
|
-
export declare function defaultChannels(repos: RepoData[], maxChannels?: number): PlanChannel[];
|
|
171
|
-
/** People from commits, issues and PRs; bots excluded. */
|
|
172
|
-
export declare function inferPeople(c: Collected, channels: PlanChannel[]): {
|
|
173
|
-
people: PlanPerson[];
|
|
174
|
-
bots: string[];
|
|
175
|
-
unlinked: string[];
|
|
176
|
-
};
|
|
177
|
-
export declare function buildPlan(c: Collected, now?: Date): Plan;
|
|
178
|
-
export declare function readPlan(file: string): Plan;
|
|
179
|
-
/** {channel: {login: {commits}}} from the plan's per-person commits by repo (bots excluded). */
|
|
180
|
-
export declare function channelStats(plan: Plan): Record<string, Record<string, {
|
|
181
|
-
commits: number;
|
|
182
|
-
}>>;
|
|
183
|
-
type Counts = Record<string, number>;
|
|
184
|
-
/** Push plan + items to the hub in chunks; the last request records the sync time. */
|
|
185
|
-
export declare function pushToHub(admin: Client, source: string, o: {
|
|
186
|
-
plan?: Plan;
|
|
187
|
-
items: GhItem[];
|
|
188
|
-
archive?: GhItem[];
|
|
189
|
-
stats?: Record<string, unknown>;
|
|
190
|
-
syncAt: string;
|
|
191
|
-
since: string;
|
|
192
|
-
ranges?: Record<string, unknown>;
|
|
193
|
-
releases?: GhRelease[];
|
|
194
|
-
}): Promise<{
|
|
195
|
-
counts: Counts;
|
|
196
|
-
people: any[];
|
|
197
|
-
skipped: string[];
|
|
198
|
-
channels: any[];
|
|
199
|
-
}>;
|
|
200
|
-
/** One set of numbers for the dry-run header and the "Would import" line. */
|
|
201
|
-
export declare function selectionCounts(sel: Selection): {
|
|
202
|
-
read: number;
|
|
203
|
-
issues: number;
|
|
204
|
-
prs: number;
|
|
205
|
-
items: number;
|
|
206
|
-
open: number;
|
|
207
|
-
recently_closed: number;
|
|
208
|
-
archived: number;
|
|
209
|
-
too_old: number;
|
|
210
|
-
excluded: number;
|
|
211
|
-
};
|
|
212
|
-
export declare function selectionLine(sel: Selection, channels: number): string;
|
|
213
|
-
export declare function planSummary(plan: Plan, file?: string, sel?: Selection): string;
|
|
214
|
-
export interface CmdIo {
|
|
215
|
-
env: NodeJS.ProcessEnv;
|
|
216
|
-
cwd: string;
|
|
217
|
-
out: (s: string) => void;
|
|
218
|
-
err: (s: string) => void;
|
|
219
|
-
exec?: Exec;
|
|
220
|
-
fetch?: import('./client.js').FetchLike;
|
|
221
|
-
now?: () => number;
|
|
222
|
-
}
|
|
223
|
-
/** `ach admin import github` */
|
|
224
|
-
export declare function importGithub(values: Record<string, unknown>, positionals: string[], io: CmdIo, admin: () => Client): Promise<number>;
|
|
225
|
-
/** --every 5m / 30s / 1h -> milliseconds (at least 1 minute unless ACH_SYNC_MIN_MS allows less, for tests). */
|
|
226
|
-
export declare function parseEvery(v: string, env?: NodeJS.ProcessEnv): number;
|
|
227
|
-
/**
|
|
228
|
-
* `ach admin sync github [--every 5m [--runs N]]`: one sync, or a loop (a failed
|
|
229
|
-
* run is reported and the loop goes on). The hub dedupes events, so a repeated
|
|
230
|
-
* sync never notifies twice.
|
|
231
|
-
*/
|
|
232
|
-
export declare function syncGithub(values: Record<string, unknown>, positionals: string[], io: CmdIo, admin: () => Client): Promise<number>;
|
|
233
|
-
export declare function inviteMessage(name: string, link: string, workspace?: string, assigned?: number): string;
|
|
234
|
-
/** The exact login that grants missing user scopes (lark-cli's own syntax; scopes add up across logins). */
|
|
235
|
-
export declare function larkScopeHint(scopes?: string[]): string;
|
|
236
|
-
/** Missing scopes named in a lark-cli error (JSON `missing_scopes`, or the scope named in the text). */
|
|
237
|
-
export declare function larkMissingScopes(out: string): string[];
|
|
238
|
-
/**
|
|
239
|
-
* `ach admin invite --feishu [--people a,b] [--map login=ou_x ...] [--yes]`
|
|
240
|
-
* `ach admin invite --people a,b --yes` (no Feishu: print the links to copy)
|
|
241
|
-
* Without --yes nothing is minted or sent: the messages are previewed.
|
|
242
|
-
*/
|
|
243
|
-
export declare function invitePeople(values: Record<string, unknown>, io: CmdIo, admin: () => Client): Promise<number>;
|
|
244
|
-
export {};
|