gcf-harness-aif-ext 0.18.1 → 0.18.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/extension.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/lee-to/ai-factory/2.x/schemas/extension.schema.json",
3
3
  "name": "gcf-harness-aif-ext",
4
- "version": "0.18.1",
4
+ "version": "0.18.2",
5
5
  "description": "GCF orchestration harness for Claude Code: one-command card pipeline, readset guard",
6
6
  "skills": [
7
7
  "skills/gcf-run",
@@ -15,6 +15,20 @@ export const clock = (now = new Date()) => now.toTimeString().slice(0, 8);
15
15
 
16
16
  const cut = (text, max) => (text.length > max ? `${text.slice(0, max - 1)}…` : text);
17
17
 
18
+ /**
19
+ * A text whole on one line: the board cuts what it shows (Tails 2026-10-25, the log cut it as
20
+ * it wrote). A failing test run's output is tens of kilobytes: past `LOG_MAX` it says how much
21
+ * more there was.
22
+ */
23
+ const whole = (text) => {
24
+ const line = firstLines(text, Infinity);
25
+
26
+ return line.length > LOG_MAX
27
+ ? `${line.slice(0, LOG_MAX)}… (${line.length - LOG_MAX} more characters)`
28
+ : line;
29
+ };
30
+ const LOG_MAX = 8000;
31
+
18
32
  /** The first `n` non-empty lines of a text, trimmed, on one line. */
19
33
  const firstLines = (text, n) =>
20
34
  String(text)
@@ -30,7 +44,7 @@ const TELLING = ['file_path', 'command', 'pattern', 'url', 'description'];
30
44
  function toolLine(use) {
31
45
  const key = TELLING.find((k) => typeof use.input?.[k] === 'string');
32
46
 
33
- return key ? `tool: ${use.name} ${cut(firstLines(use.input[key], 1), 120)}` : `tool: ${use.name}`;
47
+ return key ? `tool: ${use.name} ${whole(use.input[key])}` : `tool: ${use.name}`;
34
48
  }
35
49
 
36
50
  /** A tool result's text: a string, or a list of text blocks. */
@@ -115,7 +129,7 @@ function limitIn(text, whole = true) {
115
129
  * @returns {{lines: string[], events: Neutral[], cost?: Cost, session_id?: string,
116
130
  * limit?: {resets: string | null},
117
131
  * context?: number, turn?: string, model?: string, windows?: Record<string, number>,
118
- * compacted?: boolean, failed?: string[], quota?: Record<string, unknown>}}
132
+ * compacted?: boolean, failed?: string[], quota?: Record<string, unknown>, errored?: boolean}}
119
133
  */
120
134
  export function activity(line, now = new Date()) {
121
135
  let e;
@@ -140,9 +154,7 @@ function logged(e, now) {
140
154
  const errors = content.filter((b) => b.type === 'tool_result' && b.is_error);
141
155
 
142
156
  return {
143
- lines: errors.map(
144
- (b) => `${at} tool error: ${cut(firstLines(resultText(b.content), 1), 300)}`,
145
- ),
157
+ lines: errors.map((b) => `${at} tool error: ${whole(resultText(b.content))}`),
146
158
  // A refused or failed call wrote nothing: its write does not count.
147
159
  ...(errors.length ? { failed: errors.map((b) => String(b.tool_use_id)) } : {}),
148
160
  };
@@ -317,6 +329,11 @@ const quotaOf = (e) =>
317
329
  * agent's context summarized; the rest (hooks, thinking) give nothing.
318
330
  */
319
331
  function system(e, at) {
332
+ // A deny rule of the settings refused a call: a line of its own, not one tool error among many.
333
+ if (e.subtype === 'permission_denied')
334
+ return {
335
+ lines: [`${at} denied: ${[e.tool_name, whole(e.message ?? '')].filter(Boolean).join(' ')}`],
336
+ };
320
337
  if (e.subtype === 'compact_boundary')
321
338
  return { lines: [`${at} compacted: the agent's context was summarized`], compacted: true };
322
339
  if (e.subtype !== 'init' || typeof e.session_id !== 'string') return { lines: [] };
@@ -372,6 +389,7 @@ function ended(e, at) {
372
389
  lines: [...text, `${at} ${summary(e, cost, Boolean(limit.limit))}`],
373
390
  // The reply itself: a lessons turn answers with its JSON here.
374
391
  ...(typeof e.result === 'string' ? { result: e.result } : {}),
392
+ ...(e.is_error ? { errored: true } : {}),
375
393
  cost,
376
394
  ...limit,
377
395
  ...(windows.length ? { windows: Object.fromEntries(windows) } : {}),
@@ -258,7 +258,8 @@ async function after(j, ran, base) {
258
258
  prompt,
259
259
  resume: ran.session_id,
260
260
  timeoutMs,
261
- // One reply, past the work: no handoff watch, no quota, no chat.
261
+ // One reply, past the work: no handoff watch, no quota, no chat; the policy logs the reply.
262
+ ownReply: true,
262
263
  handoff: null,
263
264
  quota: null,
264
265
  chat: null,
@@ -17,6 +17,13 @@ const HALT_POLL_MS = 1000;
17
17
  /**
18
18
  * Keep what a session's activity told: the last of each, and the model's window from the result.
19
19
  */
20
+ /**
21
+ * A log line of the reply a caller reads (`ownReply`): the agent's words and the result's text,
22
+ * but an error's: it is why the turn gave no reply.
23
+ */
24
+ const replyLine = (l, a) =>
25
+ /^\[[\d:]+\] agent: /.test(l) || (!a.errored && a.result && l.endsWith(`result:\n${a.result}`));
26
+
20
27
  function absorb(seen, a) {
21
28
  seen.cost = a.cost ?? seen.cost;
22
29
  seen.result = a.result ?? seen.result;
@@ -234,6 +241,8 @@ function sessionTimeout(ms, onTimeout, onHalt) {
234
241
  * @property {any} [chat] the chat's options (chat.js `openChat`)
235
242
  * @property {() => boolean} [halt] the operator stopped the work: the session ends at once
236
243
  * @property {((events: import('./activity.js').Neutral[]) => void) | null} [observe]
244
+ * @property {boolean} [ownReply] the caller reads the reply and logs what it made of it: the log
245
+ * does not get the reply's text (a lessons turn's JSON)
237
246
  */
238
247
 
239
248
  /**
@@ -258,7 +267,7 @@ function sessionTimeout(ms, onTimeout, onHalt) {
258
267
  * handedOver: boolean, model?: string, window?: number, result?: string, waited: number}>}
259
268
  */
260
269
  export function runSession(s) {
261
- const { adapter, fd, timeoutMs, id, onSpawn, handoff, quota, chat, observe, halt } = s;
270
+ const { adapter, fd, timeoutMs, id, onSpawn, handoff, quota, chat, observe, halt, ownReply } = s;
262
271
 
263
272
  return new Promise((resolve) => {
264
273
  const child = launchSession(s);
@@ -301,7 +310,7 @@ export function runSession(s) {
301
310
  if (talk && open) talk.see(a.events);
302
311
  if (a.quota && quota) keepQuota(quota, a.quota);
303
312
  observe?.(a.events);
304
- write(a.lines);
313
+ write(ownReply ? a.lines.filter((l) => !replyLine(l, a)) : a.lines);
305
314
  if (open && a.context !== undefined) shown?.(a.context, seen.model);
306
315
  if (open) watch.see(a, seen.model);
307
316
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gcf-session",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "private": true,
5
5
  "description": "The session engine of GCF: one agent session and a run as a chain of them, the chat protocol, the provider adapters. Bundled by gcf-harness-aif-ext and gcf-board, never published.",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gcf-harness-aif-ext",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "GCF orchestration harness for Claude Code: one-command card pipeline, readset guard",
5
5
  "type": "module",
6
6
  "license": "MIT",