@koalaauto/agentchannel 3.98.0 → 3.98.2
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/dist/src/client.d.ts +1 -0
- package/dist/src/mcp.d.ts +4 -2
- package/dist/src/mcp.js +18 -11
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -673,6 +673,7 @@ export declare class Client {
|
|
|
673
673
|
text: string;
|
|
674
674
|
url?: string;
|
|
675
675
|
act?: string;
|
|
676
|
+
undoable?: boolean;
|
|
676
677
|
}>;
|
|
677
678
|
/** The person's own word on a card, chosen in their client's question box (never a model's argument): docs/specs/mcp-client.md §4.2. */
|
|
678
679
|
yodaDecide(act: string, decision: 'confirm' | 'decline'): Promise<{
|
package/dist/src/mcp.d.ts
CHANGED
|
@@ -73,8 +73,10 @@ export declare const toolHints: (name: string) => {
|
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* Ask the person, in their client's own question box (MCP elicitation), whether something waiting on a card goes out
|
|
76
|
-
* (docs/specs/mcp-client.md §4.2).
|
|
77
|
-
*
|
|
76
|
+
* (docs/specs/mcp-client.md §4.2). One step: the box has no field, so the client's own two buttons are the answer: accept
|
|
77
|
+
* sends it, decline does not. Null when there is no answer: the client has no question box, they dismissed it (Esc), or it
|
|
78
|
+
* timed out; the card then stays where it is, on the Yoda page. Nothing a model writes reaches this answer.
|
|
79
|
+
* In Chinese when the machine is, or when what is to be sent is written in Chinese.
|
|
78
80
|
*/
|
|
79
81
|
export declare function askToConfirm(server: McpServer, what: string, env?: NodeJS.ProcessEnv): Promise<'confirm' | 'decline' | null>;
|
|
80
82
|
/** Which tool settles a waiting item of the person's Inbox (hub: api/person-inbox.ts), in one line; '' when none of ours does. */
|
package/dist/src/mcp.js
CHANGED
|
@@ -253,23 +253,21 @@ const TASK_ACTS = {
|
|
|
253
253
|
const oneLine = (s) => { const t = String(s ?? '').replace(/\s+/g, ' ').trim(); return t.length > 120 ? `${t.slice(0, 120)}…` : t; };
|
|
254
254
|
/**
|
|
255
255
|
* Ask the person, in their client's own question box (MCP elicitation), whether something waiting on a card goes out
|
|
256
|
-
* (docs/specs/mcp-client.md §4.2).
|
|
257
|
-
*
|
|
256
|
+
* (docs/specs/mcp-client.md §4.2). One step: the box has no field, so the client's own two buttons are the answer: accept
|
|
257
|
+
* sends it, decline does not. Null when there is no answer: the client has no question box, they dismissed it (Esc), or it
|
|
258
|
+
* timed out; the card then stays where it is, on the Yoda page. Nothing a model writes reaches this answer.
|
|
259
|
+
* In Chinese when the machine is, or when what is to be sent is written in Chinese.
|
|
258
260
|
*/
|
|
259
261
|
export async function askToConfirm(server, what, env = process.env) {
|
|
260
262
|
if (!server.server.getClientCapabilities()?.elicitation)
|
|
261
263
|
return null;
|
|
262
|
-
const zh = isZh(env);
|
|
263
|
-
const [yes, no] = zh ? ['发出', '不发'] : ['Send', 'Do not send'];
|
|
264
|
+
const zh = isZh(env) || /[\u3400-\u9fff]/.test(what);
|
|
264
265
|
try {
|
|
265
266
|
const r = await server.server.elicitInput({
|
|
266
|
-
message: zh ? `以你的名义发出?\n${what}
|
|
267
|
-
requestedSchema: { type: 'object', properties: {
|
|
267
|
+
message: zh ? `以你的名义发出?\n${what}\n\n接受:发出。拒绝:不发。` : `Send this in your name?\n${what}\n\nAccept: it is sent. Decline: it is not.`,
|
|
268
|
+
requestedSchema: { type: 'object', properties: {} },
|
|
268
269
|
}, { timeout: 10 * 60_000 });
|
|
269
|
-
|
|
270
|
-
return null;
|
|
271
|
-
const d = r.content?.decision;
|
|
272
|
-
return d === yes ? 'confirm' : d === no ? 'decline' : null;
|
|
270
|
+
return r.action === 'accept' ? 'confirm' : r.action === 'decline' ? 'decline' : null;
|
|
273
271
|
}
|
|
274
272
|
catch {
|
|
275
273
|
return null;
|
|
@@ -371,8 +369,11 @@ export function buildMcpServer(client, o = {}) {
|
|
|
371
369
|
const sent = async (tool, args, label) => wrap(async () => {
|
|
372
370
|
const r = await client.yodaAct(tool, args);
|
|
373
371
|
const text = r.text || `(${r.status || 'the hub said nothing'})`;
|
|
372
|
+
// not done is an error to the client (and counted as one), with the hub's reason
|
|
373
|
+
if (r.status === 'failed')
|
|
374
|
+
throw new Error(text);
|
|
374
375
|
if (r.status !== 'waiting')
|
|
375
|
-
return r.act && r.
|
|
376
|
+
return r.act && r.undoable ? `${text}\nact: ${r.act} (take_back undoes it)` : text;
|
|
376
377
|
// it waits on a card: the person is asked here, in their client's own question box, when it has one
|
|
377
378
|
const word = r.act ? await askToConfirm(server, label) : null;
|
|
378
379
|
if (word && r.act)
|
|
@@ -933,6 +934,12 @@ export async function startMcp(client, where = { cwd: process.cwd() }) {
|
|
|
933
934
|
// this machine's runner, when it stopped and should not have (watchdog.ts): started again from here
|
|
934
935
|
// (a session connected as a person has no runner to look after)
|
|
935
936
|
const watchdog = linked && !hand ? { stop() { } } : startRunnerWatchdog({ me: () => (hand ? hand.client : client).me(), log: (s) => process.stderr.write(`[ach mcp] ${s}\n`) });
|
|
937
|
+
// the client ends a session by closing the pipe and then killing the process: what was counted since the last report is
|
|
938
|
+
// told first (a session shorter than a minute would otherwise leave no trace), within a second and a half
|
|
939
|
+
const lastWord = () => Promise.race([server.toolUse?.flush(), new Promise((r) => setTimeout(r, 1500))]).catch(() => { });
|
|
940
|
+
process.stdin.once('end', () => void lastWord());
|
|
941
|
+
for (const sig of ['SIGTERM', 'SIGINT', 'SIGHUP'])
|
|
942
|
+
process.once(sig, () => void lastWord().finally(() => process.exit(0)));
|
|
936
943
|
server.server.onclose = () => {
|
|
937
944
|
void server.toolUse?.flush();
|
|
938
945
|
notices?.stop();
|
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.98.
|
|
3
|
+
"version": "3.98.2",
|
|
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",
|