@koalaauto/agentchannel 3.59.0 → 3.59.1

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.
@@ -1,7 +1,7 @@
1
1
  // `ach remember`, `ach recall`, `ach decide-draft` and `ach memory ...`: the team Memory from the command line.
2
2
  import { isAbsolute, resolve } from 'node:path';
3
3
  import { UsageError } from './args.js';
4
- import { HubError } from './client.js';
4
+ import { lintProblemLines } from './client.js';
5
5
  import { loadConfig } from './config.js';
6
6
  import { untrustedBlock as wrapUntrusted } from './prompts.js';
7
7
  import { MEMORY_NOTE, absUrl, channelFile, noAgentHint, str, text } from './cli-shared.js';
@@ -108,11 +108,11 @@ export async function memoryCommand(ctx) {
108
108
  }
109
109
  catch (e) {
110
110
  // lint: list every problem line with its reason, then fail
111
- const body = e instanceof HubError ? e.body : undefined;
112
- if (e instanceof HubError && e.code === 'lint' && Array.isArray(body?.problems)) {
113
- io.err(`not pushed: ${body.problems.length} problem(s). Fix each line and push again:`);
114
- for (const x of body.problems)
115
- io.err(` ${x.slug}.md${x.line ? ` line ${x.line}` : ''}: ${x.problem}${x.text ? `\n ${x.text}` : ''}`);
111
+ const lines = lintProblemLines(e, '.md');
112
+ if (lines) {
113
+ io.err(`not pushed: ${lines.length} problem(s). Fix each line and push again:`);
114
+ for (const l of lines)
115
+ io.err(l);
116
116
  return 1;
117
117
  }
118
118
  throw e;
@@ -408,6 +408,11 @@ export declare class HubError extends Error {
408
408
  body?: unknown | undefined;
409
409
  constructor(status: number, message: string, code?: string | undefined, body?: unknown | undefined);
410
410
  }
411
+ /**
412
+ * A Memory push the hub refused (`lint`): one line per problem, `<page><ext> line N: <why>` and the offending text under it. The
413
+ * hub's message only counts them. `ext` is '.md' where the pages are files (`ach memory push`). Undefined for any other error.
414
+ */
415
+ export declare function lintProblemLines(e: unknown, ext?: string): string[] | undefined;
411
416
  /** A one-time login link: open `<hub><path>` (the token is in the URL fragment). */
412
417
  export interface LoginLink {
413
418
  token: string;
@@ -74,6 +74,16 @@ export class HubError extends Error {
74
74
  this.name = 'HubError';
75
75
  }
76
76
  }
77
+ /**
78
+ * A Memory push the hub refused (`lint`): one line per problem, `<page><ext> line N: <why>` and the offending text under it. The
79
+ * hub's message only counts them. `ext` is '.md' where the pages are files (`ach memory push`). Undefined for any other error.
80
+ */
81
+ export function lintProblemLines(e, ext = '') {
82
+ const problems = e instanceof HubError && e.code === 'lint' ? e.body?.problems : undefined;
83
+ if (!Array.isArray(problems))
84
+ return undefined;
85
+ return problems.map((x) => ` ${x.slug}${ext}${x.line ? ` line ${x.line}` : ''}: ${x.problem}${x.text ? `\n ${x.text}` : ''}`);
86
+ }
77
87
  /** Round 2: human-facing CLI text in Chinese when LANG/LC_ALL starts with zh. */
78
88
  export function isZh(env) {
79
89
  return /^zh/i.test(env.LC_ALL || env.LC_MESSAGES || env.LANG || '');
package/dist/src/mcp.js CHANGED
@@ -11,7 +11,7 @@ import { AttentionNotifier, ChangeFeed, codexQueue, defaultExec, fetchAttention,
11
11
  import { isZh } from './client.js';
12
12
  import { startStaleNotice } from './selfupdate.js';
13
13
  import { decisionTo, explainToUser, mentionNames, unknownMentions } from './names.js';
14
- import { HubError } from './client.js';
14
+ import { HubError, lintProblemLines } from './client.js';
15
15
  export const HANDOFF_TEMPLATE = `## Goal
16
16
  <one or two sentences: what done looks like>
17
17
 
@@ -36,7 +36,10 @@ async function wrap(fn) {
36
36
  return { content: [{ type: 'text', text: typeof r === 'string' ? r : JSON.stringify(r, null, 2) }] };
37
37
  }
38
38
  catch (e) {
39
- return { content: [{ type: 'text', text: `error: ${e?.message ?? e}` }], isError: true };
39
+ // a refused Memory push: which lines and why (the hub's message only counts them)
40
+ const lines = lintProblemLines(e);
41
+ const more = lines ? `\nnot written; fix each line and write again:\n${lines.join('\n')}` : '';
42
+ return { content: [{ type: 'text', text: `error: ${e?.message ?? e}${more}` }], isError: true };
40
43
  }
41
44
  }
42
45
  /**
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "3.59.0";
1
+ export declare const VERSION = "3.59.1";
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.59.0';
1
+ export const VERSION = '3.59.1';
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.59.0",
3
+ "version": "3.59.1",
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",