gcf-harness-aif-ext 0.12.0 → 0.12.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.
package/commands/run.js
CHANGED
|
@@ -322,7 +322,9 @@ function recordFor(r) {
|
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
324
|
* The line of a session that ended with its item still ready: why, and what a rerun does. A
|
|
325
|
-
* usage limit pauses the item; `limit_resets` tells a board when it may go on.
|
|
325
|
+
* usage limit pauses the item; `limit_resets` tells a board when it may go on. A stop during
|
|
326
|
+
* the limit's wait pauses the item the same way, but it is the operator's: no `limit_resets`,
|
|
327
|
+
* so a board's queue goes on (PRD §3.2).
|
|
326
328
|
*/
|
|
327
329
|
function noResult(r, rerun) {
|
|
328
330
|
if (r.lost)
|
|
@@ -332,39 +334,36 @@ function noResult(r, rerun) {
|
|
|
332
334
|
`no result (its session could not be resumed, agent exit ${r.code}): ` +
|
|
333
335
|
`${r.id} stays ready, a rerun starts fresh`,
|
|
334
336
|
};
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
// The operator's stop during the wait leaves the item paused, with no reset for a board.
|
|
338
|
+
const resets = r.limit && !r.stopped ? { limit_resets: r.limit.resets } : {};
|
|
339
|
+
const limit = r.limit ? `usage limit${r.limit.resets ? `, resets ${r.limit.resets}` : ''}` : '';
|
|
340
|
+
if (r.handoffPending)
|
|
340
341
|
return {
|
|
341
342
|
id: r.id,
|
|
342
343
|
result:
|
|
343
|
-
`paused (${limit}context handoff): ${r.id} stays ready, ` +
|
|
344
|
-
|
|
344
|
+
`paused (${limit ? `${limit}; ` : ''}context handoff): ${r.id} stays ready, ` +
|
|
345
|
+
'a rerun goes on from the plan',
|
|
346
|
+
...resets,
|
|
345
347
|
};
|
|
346
|
-
}
|
|
347
348
|
|
|
348
349
|
const again = r.session_id ? 'a rerun resumes its session' : rerun;
|
|
349
350
|
if (r.limit) {
|
|
350
|
-
const
|
|
351
|
+
const stop = r.stopped ? ', stopped during the wait' : '';
|
|
351
352
|
|
|
352
353
|
return {
|
|
353
354
|
id: r.id,
|
|
354
|
-
result: `paused (
|
|
355
|
-
|
|
355
|
+
result: `paused (${limit}${stop}): ${r.id} stays ready, ${again}`,
|
|
356
|
+
...resets,
|
|
356
357
|
};
|
|
357
358
|
}
|
|
358
359
|
|
|
359
|
-
|
|
360
|
-
? 'stopped'
|
|
361
|
-
: r.code === 'timeout'
|
|
362
|
-
? 'the session timed out'
|
|
363
|
-
: `agent exit ${r.code}`;
|
|
364
|
-
|
|
365
|
-
return { id: r.id, result: `no result (${why}): ${r.id} stays ready, ${again}` };
|
|
360
|
+
return { id: r.id, result: `no result (${endWhy(r)}): ${r.id} stays ready, ${again}` };
|
|
366
361
|
}
|
|
367
362
|
|
|
363
|
+
/** Why a session with no result ended: stopped, timed out, or its agent's exit. */
|
|
364
|
+
const endWhy = (r) =>
|
|
365
|
+
r.stopped ? 'stopped' : r.code === 'timeout' ? 'the session timed out' : `agent exit ${r.code}`;
|
|
366
|
+
|
|
368
367
|
const STAYED = / stays ready, a rerun /;
|
|
369
368
|
|
|
370
369
|
// `--no-lessons`: the run asks the lessons itself, after the session (see `lessonsTurn`).
|
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.12.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"description": "GCF orchestration harness for Claude Code: one-command card pipeline, readset guard",
|
|
6
6
|
"skills": [
|
|
7
7
|
"skills/gcf-run",
|
|
@@ -453,12 +453,14 @@ async function decided(c, requestId, { allow, by = 'operator', always = false })
|
|
|
453
453
|
return post(c, { type: 'denied', request_id: requestId, tool: card.tool, by, title });
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
|
|
456
|
+
let rule = always ? card.always : null;
|
|
457
457
|
if (rule) {
|
|
458
458
|
try {
|
|
459
459
|
await c.saveAlways(rule);
|
|
460
460
|
} catch (e) {
|
|
461
461
|
post(c, { type: 'error', text: `the rule ${rule} was not saved: ${e.message}` });
|
|
462
|
+
// "Saved" is the event's word (chat-events.md): a rule not saved is an allow once.
|
|
463
|
+
rule = null;
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
466
|
|
|
@@ -305,6 +305,7 @@ export async function runJob(p) {
|
|
|
305
305
|
// A record whose handoff its own run already counted (`counted`) owes none.
|
|
306
306
|
if (kind === 'handoff' && !rec.counted && (await capped(j)))
|
|
307
307
|
return { code: 0, handoffs: j.handoffs, handoffLimit: true, handoffPending: false };
|
|
308
|
+
await noReset(j, kind, rec);
|
|
308
309
|
try {
|
|
309
310
|
return await chain(j, kind, rec);
|
|
310
311
|
} finally {
|
|
@@ -314,18 +315,37 @@ export async function runJob(p) {
|
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
|
|
318
|
+
/**
|
|
319
|
+
* A record a stopped wait left paused: limit names its reset: a run started on it (the
|
|
320
|
+
* operator's Run, before the reset or after) names none while it works (AD-32), so no board
|
|
321
|
+
* reads it as waiting for the limit.
|
|
322
|
+
*/
|
|
323
|
+
async function noReset(j, kind, rec) {
|
|
324
|
+
if (!rec?.resets) return;
|
|
325
|
+
// As the gate's: a session the run does not resume is named by none, so a handoff stays one.
|
|
326
|
+
const resumes = kind === 'resume';
|
|
327
|
+
await j.p.persist?.({
|
|
328
|
+
session_id: resumes ? rec.session_id : undefined,
|
|
329
|
+
handoffs: j.handoffs,
|
|
330
|
+
handoffPending: false,
|
|
331
|
+
total: resumes ? Number(rec.cost_usd) || undefined : undefined,
|
|
332
|
+
limit: { resets: null },
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
|
|
317
336
|
/**
|
|
318
337
|
* A session the usage limit cut (`s.ran`): the job waits for the reset, then goes on with it
|
|
319
338
|
* resumed; with a fresh one when it was told to hand over (a handoff, counted), or when it has
|
|
320
|
-
* no session to resume. No wait leaves it as it ended: paused. A stop during the wait
|
|
321
|
-
* the
|
|
339
|
+
* no session to resume. No wait leaves it as it ended: paused. A stop during the wait keeps
|
|
340
|
+
* the limit and its reset (PRD §3.2): the item is paused: limit, and a rerun resumes the
|
|
341
|
+
* session; the stop is the operator's, so it pauses no queue.
|
|
322
342
|
*/
|
|
323
343
|
async function overLimit(j, s) {
|
|
324
344
|
while (s.ran.limit && !s.ran.stopped && !(await j.p.done?.())) {
|
|
325
345
|
const { reset, handover, state } = limitState(j, s);
|
|
326
346
|
if (handover && (await pastCap(j))) return;
|
|
327
347
|
const waited = await limitWait(j, reset, state);
|
|
328
|
-
if (waited === 'stopped') s.ran = { ...s.ran,
|
|
348
|
+
if (waited === 'stopped') s.ran = { ...s.ran, stopped: true };
|
|
329
349
|
if (waited !== 'reset' || (handover && (await capped(j)))) return;
|
|
330
350
|
await afterReset(j, s, handover);
|
|
331
351
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gcf-session",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.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",
|