@koalaauto/agentchannel 3.35.2 → 3.35.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.
|
@@ -50,6 +50,8 @@ export declare class KiroOutput {
|
|
|
50
50
|
private buf;
|
|
51
51
|
private message;
|
|
52
52
|
private messages;
|
|
53
|
+
/** kiro-cli 3.x ends a run with `runFinished` carrying the run's final text: it wins over the streamed messages. */
|
|
54
|
+
private runFinal;
|
|
53
55
|
private text;
|
|
54
56
|
constructor(onEvent: (e: AdapterEvent) => void);
|
|
55
57
|
push(chunk: string): void;
|
|
@@ -96,6 +96,8 @@ export class KiroOutput {
|
|
|
96
96
|
buf = '';
|
|
97
97
|
message = '';
|
|
98
98
|
messages = [];
|
|
99
|
+
/** kiro-cli 3.x ends a run with `runFinished` carrying the run's final text: it wins over the streamed messages. */
|
|
100
|
+
runFinal = '';
|
|
99
101
|
text = [];
|
|
100
102
|
constructor(onEvent) {
|
|
101
103
|
this.onEvent = onEvent;
|
|
@@ -116,6 +118,8 @@ export class KiroOutput {
|
|
|
116
118
|
}
|
|
117
119
|
/** The agent's last message (stream-json), else the text transcript's tail. */
|
|
118
120
|
finalText() {
|
|
121
|
+
if (this.runFinal.trim())
|
|
122
|
+
return this.runFinal.trim();
|
|
119
123
|
const last = [...this.messages].reverse().find((m) => m.trim());
|
|
120
124
|
if (last)
|
|
121
125
|
return last.trim();
|
|
@@ -156,7 +160,8 @@ export class KiroOutput {
|
|
|
156
160
|
return;
|
|
157
161
|
}
|
|
158
162
|
this.jsonLines++;
|
|
159
|
-
|
|
163
|
+
// kiro-cli 2.x: JSON-RPC `{method, params: {sessionId, update}}`; 3.x: `{type, data: {sessionId, update}}`
|
|
164
|
+
const p = j.params ?? (j.data && typeof j.data === 'object' ? j.data : undefined) ?? j;
|
|
160
165
|
this.setSession(p.sessionId ?? p.session_id ?? j.sessionId ?? j.session_id);
|
|
161
166
|
const credits = findCredits(j);
|
|
162
167
|
if (credits !== undefined) {
|
|
@@ -181,6 +186,15 @@ export class KiroOutput {
|
|
|
181
186
|
if (u.status === 'completed' || u.status === 'failed')
|
|
182
187
|
this.onEvent({ type: 'tool_end', data: { id: String(u.toolCallId ?? u.id ?? ''), is_error: u.status === 'failed' } });
|
|
183
188
|
break;
|
|
189
|
+
case 'runFinished':
|
|
190
|
+
this.flushMessage();
|
|
191
|
+
if (typeof p.finalText === 'string')
|
|
192
|
+
this.runFinal = p.finalText;
|
|
193
|
+
if (p.status && p.status !== 'success')
|
|
194
|
+
this.onEvent({ type: 'error', data: `kiro run ${String(p.status)}${p.stopReason ? ` (${String(p.stopReason)})` : ''}` });
|
|
195
|
+
else
|
|
196
|
+
this.onEvent({ type: 'tool', data: { type: kind } });
|
|
197
|
+
break;
|
|
184
198
|
case 'tool_call_update':
|
|
185
199
|
if (u.status === 'completed' || u.status === 'failed') {
|
|
186
200
|
this.onEvent({ type: 'tool_end', data: { id: String(u.toolCallId ?? u.id ?? ''), is_error: u.status === 'failed', output: contentText(u.content) || (u.rawOutput ? JSON.stringify(u.rawOutput) : '') } });
|
|
@@ -217,6 +231,9 @@ function findCredits(o, depth = 0) {
|
|
|
217
231
|
for (const [k, v] of Object.entries(o)) {
|
|
218
232
|
if (/^credits?(_?used)?$/i.test(k) && typeof v === 'number' && Number.isFinite(v))
|
|
219
233
|
return v;
|
|
234
|
+
// kiro-cli 3.x: `_meta.kiro.credits: [{usage, unit: "credit"}]`
|
|
235
|
+
if (/^credits?$/i.test(k) && Array.isArray(v) && v.length && v.every((x) => x && typeof x.usage === 'number' && Number.isFinite(x.usage)))
|
|
236
|
+
return v.reduce((a, x) => a + x.usage, 0);
|
|
220
237
|
const inner = findCredits(v, depth + 1);
|
|
221
238
|
if (inner !== undefined)
|
|
222
239
|
return inner;
|
package/dist/src/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { tmpdir } from 'node:os';
|
|
7
8
|
import { developerDir } from './adapters/scope.js';
|
|
8
9
|
import { acquireRunnerLock, RunnerLockedError } from './runner/lock.js';
|
|
9
10
|
import { helpFor, HELP, parseCli, UsageError } from './args.js';
|
|
@@ -1579,7 +1580,7 @@ async function runCommand(p, io) {
|
|
|
1579
1580
|
const home = achHome(env);
|
|
1580
1581
|
const dir = resolve(io.cwd ?? process.cwd(), str(v.dir) ?? '.');
|
|
1581
1582
|
const { GitWorkspace, parseRepoFlags } = await import('./runner/workspace.js');
|
|
1582
|
-
const { Runner, gcWorktrees } = await import('./runner/runner.js');
|
|
1583
|
+
const { Runner, gcWorktrees, prepareAgentHome, realHomeOf } = await import('./runner/runner.js');
|
|
1583
1584
|
let repoFlags;
|
|
1584
1585
|
try {
|
|
1585
1586
|
repoFlags = parseRepoFlags(Array.isArray(v.repo) ? v.repo : [], io.cwd ?? process.cwd());
|
|
@@ -1676,8 +1677,10 @@ async function runCommand(p, io) {
|
|
|
1676
1677
|
if (runtime === 'kiro')
|
|
1677
1678
|
return (await import('./kirocheck.js')).probeKiro({ env });
|
|
1678
1679
|
const { probeEnvironment } = await import('./envcheck.js');
|
|
1679
|
-
// the sandboxed command gets the
|
|
1680
|
-
|
|
1680
|
+
// the sandboxed command gets the env a run gets (inherited vars and a scratch home like a task's), so what a run cannot start
|
|
1681
|
+
// without shows here, not in the first task (TASK-59)
|
|
1682
|
+
const { env: homeEnv } = prepareAgentHome(join(tmpdir(), 'ach-homes'), me.name, 'startup-check', realHomeOf(baseEnv), baseEnv.CODEX_HOME || undefined);
|
|
1683
|
+
return probeEnvironment(runtime === 'codex' ? 'codex' : 'claude', { env, hub: cfg.hub, runEnv: { ...inheritedEnv(baseEnv, passEnv), ...homeEnv } });
|
|
1681
1684
|
},
|
|
1682
1685
|
});
|
|
1683
1686
|
io.err(`ach run: agent ${me.name}, runtime ${runtime}, perm min(${me.perm_level}, ${perm}), dir ${dir}` +
|
package/dist/src/sandboxcheck.js
CHANGED
|
@@ -86,8 +86,13 @@ export function classify(stderr, host) {
|
|
|
86
86
|
return 'userns-blocked';
|
|
87
87
|
return 'failed';
|
|
88
88
|
}
|
|
89
|
+
/** Warnings a tool prints before it fails (Codex on Windows: "proceeding, even though we could not create PATH aliases"). */
|
|
90
|
+
const PROBE_NOISE = /^warning\b|proceeding, even though/i;
|
|
91
|
+
/** The line that says why: the first error-looking line that is not a warning, else the first line that is not one, else the first. */
|
|
89
92
|
function firstLine(s) {
|
|
90
|
-
|
|
93
|
+
const lines = s.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
94
|
+
const real = lines.filter((l) => !PROBE_NOISE.test(l));
|
|
95
|
+
return (real.find((l) => /error|fail|denied|refus|cannot|not (found|permitted|allowed)|requires/i.test(l)) ?? real[0] ?? lines[0] ?? '').slice(0, 300);
|
|
91
96
|
}
|
|
92
97
|
/**
|
|
93
98
|
* The two writes: inside the sandbox's directory (must work) and in the home directory (must be refused). With a third
|
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.35.
|
|
3
|
+
"version": "3.35.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",
|