fwdloop 0.15.0 → 0.17.0
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/README.md +2 -0
- package/bin/fwdloop +113 -36
- package/package.json +2 -2
- package/src/authoring.js +27 -15
- package/src/catalogue.json +9 -3
- package/src/closers.js +5 -0
- package/src/config.js +66 -4
- package/src/ctx-tools.js +245 -0
- package/src/declaration.js +25 -1
- package/src/draft-steps.js +138 -0
- package/src/drafter.js +81 -18
- package/src/draftspend.js +109 -3
- package/src/flowmodel.js +30 -0
- package/src/input-facts.js +12 -3
- package/src/keysfile.js +51 -16
- package/src/liveness.js +34 -10
- package/src/model-step.js +13 -11
- package/src/monthly.js +9 -1
- package/src/panel/author.js +170 -43
- package/src/panel/authorcard.js +32 -20
- package/src/panel/authorflows.js +34 -19
- package/src/panel/authorresume.js +11 -9
- package/src/panel/authorstart.js +11 -9
- package/src/panel/authorvalues.js +5 -3
- package/src/panel/data.js +20 -8
- package/src/panel/index.html +584 -182
- package/src/panel/resume.js +3 -3
- package/src/panel/server.js +12 -6
- package/src/panel/settings.js +138 -80
- package/src/panel/spawn.js +15 -9
- package/src/plain-checks.js +51 -0
- package/src/primitives.js +34 -3
- package/src/provider.js +148 -181
- package/src/providershapes.js +7 -7
- package/src/run-store.js +47 -0
- package/src/runner.js +40 -22
- package/src/setup.js +3 -0
- package/src/thinking.js +55 -0
- package/src/version.js +13 -0
- package/types/authoring.d.ts +11 -6
- package/types/closers.d.ts +2 -0
- package/types/config.d.ts +9 -1
- package/types/ctx-tools.d.ts +18 -0
- package/types/draft-steps.d.ts +47 -0
- package/types/drafter.d.ts +15 -12
- package/types/draftspend.d.ts +56 -0
- package/types/flowmodel.d.ts +16 -0
- package/types/input-facts.d.ts +6 -1
- package/types/keysfile.d.ts +23 -6
- package/types/liveness.d.ts +7 -1
- package/types/model-step.d.ts +1 -1
- package/types/monthly.d.ts +1 -0
- package/types/panel/author.d.ts +47 -9
- package/types/panel/authorcard.d.ts +33 -10
- package/types/panel/authorflows.d.ts +32 -9
- package/types/panel/authorresume.d.ts +2 -1
- package/types/panel/authorstart.d.ts +16 -6
- package/types/panel/authorvalues.d.ts +3 -1
- package/types/panel/data.d.ts +2 -2
- package/types/panel/resume.d.ts +2 -1
- package/types/panel/server.d.ts +6 -2
- package/types/panel/settings.d.ts +3 -1
- package/types/panel/spawn.d.ts +13 -4
- package/types/plain-checks.d.ts +22 -0
- package/types/primitives.d.ts +0 -6
- package/types/provider.d.ts +100 -284
- package/types/providershapes.d.ts +3 -4
- package/types/run-store.d.ts +11 -0
- package/types/runner.d.ts +2 -4
- package/types/setup.d.ts +8 -0
- package/types/thinking.d.ts +25 -0
- package/types/version.d.ts +2 -0
package/src/runner.js
CHANGED
|
@@ -41,8 +41,10 @@ import {
|
|
|
41
41
|
} from 'node:fs';
|
|
42
42
|
import { createHash, randomUUID } from 'node:crypto';
|
|
43
43
|
import {
|
|
44
|
-
dirname, extname, isAbsolute, join, resolve, sep,
|
|
44
|
+
basename, dirname, extname, isAbsolute, join, resolve, sep,
|
|
45
45
|
} from 'node:path';
|
|
46
|
+
import { parseCsv } from './csv.js';
|
|
47
|
+
import { resetRunStore } from './run-store.js';
|
|
46
48
|
import { fileURLToPath } from 'node:url';
|
|
47
49
|
|
|
48
50
|
import {
|
|
@@ -55,7 +57,7 @@ import {
|
|
|
55
57
|
findUnwiredVerbStep, unwiredRed, findUnbuildableCheckStep, unbuildableRed,
|
|
56
58
|
} from './canrun.js'; // M4e am7 item 7: the ONE decider (F46 refusal lives there)
|
|
57
59
|
import { configHome, configDoorHome } from './config.js';
|
|
58
|
-
import { closeByClass } from './closers.js';
|
|
60
|
+
import { closeByClass, isCellsPath } from './closers.js';
|
|
59
61
|
import {
|
|
60
62
|
appendAudit, appendHistory, readAudit, readHistory, endRow, HALT_OUTCOMES,
|
|
61
63
|
} from './books.js';
|
|
@@ -83,7 +85,7 @@ export const MAX_ATTEMPTS = 4;
|
|
|
83
85
|
* (audit.jsonl) stay the source of truth; this tolerance only absorbs
|
|
84
86
|
* summation-order noise, not a real gap. A billionth of a dollar is ~6
|
|
85
87
|
* orders of magnitude below the cheapest real round (audit rows here run
|
|
86
|
-
*
|
|
88
|
+
* a few hundredths of a cent and up), so nothing a real tamper produces can hide inside it. */
|
|
87
89
|
export const SPEND_TOLERANCE_USD = 1e-9;
|
|
88
90
|
|
|
89
91
|
// ---------------------------------------------------------------------------
|
|
@@ -188,23 +190,17 @@ export function readHaltRecord(runDir) {
|
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
// ---------------------------------------------------------------------------
|
|
191
|
-
// Money
|
|
192
|
-
//
|
|
193
|
-
//
|
|
193
|
+
// Money - the per-attempt hold is injected data: the caller works it out from the
|
|
194
|
+
// picked model's own Settings prices (`ceilingCostUsd(rates)`, src/provider.js) and passes
|
|
195
|
+
// it as `ceilingUsd`. No model name or price lives here (M4d amendment 5 item 4).
|
|
194
196
|
// ---------------------------------------------------------------------------
|
|
195
197
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/** @
|
|
202
|
-
export function resolveCeilingUsd(modelId) {
|
|
203
|
-
if (typeof modelId === 'string' && Object.prototype.hasOwnProperty.call(CEILING_TABLE_USD, modelId)) {
|
|
204
|
-
return CEILING_TABLE_USD[modelId];
|
|
205
|
-
}
|
|
206
|
-
return Math.max(...Object.values(CEILING_TABLE_USD));
|
|
207
|
-
}
|
|
198
|
+
/**
|
|
199
|
+
* The hold one model round must fit under the cap. A caller with a model passes the number from Settings prices;
|
|
200
|
+
* a caller with no model prices (a test double) holds nothing.
|
|
201
|
+
* @param {number|undefined} ceilingUsd
|
|
202
|
+
*/
|
|
203
|
+
const holdOf = (ceilingUsd) => (Number.isFinite(ceilingUsd) && /** @type {number} */ (ceilingUsd) >= 0 ? /** @type {number} */ (ceilingUsd) : 0);
|
|
208
204
|
|
|
209
205
|
// ---------------------------------------------------------------------------
|
|
210
206
|
// The executor — "goal in, gap back", constructed WITHOUT its close and
|
|
@@ -574,11 +570,32 @@ function readArtifactsMapChecked(runDir, ids) {
|
|
|
574
570
|
if (!result.ok && !result.missing) {
|
|
575
571
|
return { ok: false, red: `artifact "${id}" — ${result.red}` };
|
|
576
572
|
}
|
|
573
|
+
if (!result.ok && result.missing) {
|
|
574
|
+
// M4d amendment 8: an id no step wrote may name a frozen CSV input; a step reads it as cells, so a green check can cite it.
|
|
575
|
+
const input = readInputCells(runDir, id);
|
|
576
|
+
if (!input.ok && !input.missing) return { ok: false, red: `input "${id}" — ${input.red}` };
|
|
577
|
+
if (input.ok) { map[id] = input.value; continue; }
|
|
578
|
+
}
|
|
577
579
|
map[id] = result.ok ? result.value : undefined;
|
|
578
580
|
}
|
|
579
581
|
return { ok: true, map };
|
|
580
582
|
}
|
|
581
583
|
|
|
584
|
+
/** A frozen CSV input as `{kind:'cells', header, rows}` (the shape `addressCells` gives), checked against the sha256 recorded at freeze.
|
|
585
|
+
* Same three outcomes as `readArtifactResult`: not an input of this run (`missing`), refused (`red`), or the cells. */
|
|
586
|
+
function readInputCells(runDir, id) {
|
|
587
|
+
const manifest = readFileInside(runDir, 'inputs.json');
|
|
588
|
+
if (!manifest.ok) return manifest.missing ? { ok: false, missing: true } : { ok: false, missing: false, red: manifest.red };
|
|
589
|
+
let entries;
|
|
590
|
+
try { entries = JSON.parse(manifest.text); } catch (err) { return { ok: false, missing: false, red: `inputs.json is not valid JSON — ${err.message}` }; }
|
|
591
|
+
const entry = Array.isArray(entries) ? entries.find((e) => e?.id === id) : undefined;
|
|
592
|
+
if (!entry || !isCellsPath(entry.frozen)) return { ok: false, missing: true };
|
|
593
|
+
const file = readFileInside(runDir, `inputs/${basename(entry.frozen)}`);
|
|
594
|
+
if (!file.ok) return file.missing ? { ok: false, missing: false, red: 'the frozen copy is missing' } : { ok: false, missing: false, red: file.red };
|
|
595
|
+
if (createHash('sha256').update(file.text).digest('hex') !== entry.sha256) return { ok: false, missing: false, red: 'the frozen copy changed since it was frozen' };
|
|
596
|
+
return { ok: true, value: { kind: 'cells', ...parseCsv(file.text) } };
|
|
597
|
+
}
|
|
598
|
+
|
|
582
599
|
// ---------------------------------------------------------------------------
|
|
583
600
|
// Item 4 (small): an `answer.json` still on disk, unconsumed, at run end —
|
|
584
601
|
// a late human answer that arrived after the run already moved on. One
|
|
@@ -940,7 +957,7 @@ async function runStepRalph({
|
|
|
940
957
|
* @param {string[]} [opts.primitiveReds] - `resolvePrimitives`'s own `reds` (e.g. bareguard refusing a symlinked file scope); any entry refuses the run at $0 like an unwired verb, before the run dir exists.
|
|
941
958
|
* @param {() => string} [opts.clock] - returns the current ISO timestamp; defaults to the wall clock.
|
|
942
959
|
* @param {string} opts.businessDate - the run's explicit "as of today", never the wall clock.
|
|
943
|
-
* @param {number} [opts.ceilingUsd] - per-attempt ceiling override;
|
|
960
|
+
* @param {number} [opts.ceilingUsd] - per-attempt ceiling override; the model's hold from Settings prices (`ceilingCostUsd`); absent = no hold.
|
|
944
961
|
* @param {string|null} [opts.initialGap] - M3 scope item 7 (rerun as a fresh
|
|
945
962
|
* run): a human's rerun reason, carried as the FIRST ordinary step's
|
|
946
963
|
* starting gap. Never used by a plain `runFlow` call outside `resumeRun`'s
|
|
@@ -1003,7 +1020,7 @@ export async function runFlow({
|
|
|
1003
1020
|
const { arbiter } = applied;
|
|
1004
1021
|
const capUsd = arbiter.capUsd;
|
|
1005
1022
|
const redoCap = arbiter.redoCap ?? 3;
|
|
1006
|
-
const effectiveCeilingUsd = ceilingUsd
|
|
1023
|
+
const effectiveCeilingUsd = holdOf(ceilingUsd);
|
|
1007
1024
|
const askLines = new Map((arbiter.asks ?? []).map((a) => [a.line, a]));
|
|
1008
1025
|
const sendLines = new Map((arbiter.sends ?? []).map((s) => [s.line, s]));
|
|
1009
1026
|
|
|
@@ -1044,6 +1061,7 @@ export async function runFlow({
|
|
|
1044
1061
|
flowDir, runDir, runId, capUsd, startedAt, now, nowMs: getNowMs, signatureHash: signature.flow, outcome: 'preflight-red', red: fresh.red, spent: { value: 0 },
|
|
1045
1062
|
});
|
|
1046
1063
|
}
|
|
1064
|
+
resetRunStore(runDir); // M7: a fresh run never inherits a store left by an earlier run of the same id
|
|
1047
1065
|
mkdirSync(runDir, { recursive: true });
|
|
1048
1066
|
|
|
1049
1067
|
// M6: the run keeps a write-once copy of the job it runs, from before its first step (its Job tab shows this, not the flow's later versions)
|
|
@@ -2234,7 +2252,7 @@ export async function resumeRun({
|
|
|
2234
2252
|
|
|
2235
2253
|
const capUsd = arbiter.capUsd;
|
|
2236
2254
|
const redoCap = arbiter.redoCap ?? 3;
|
|
2237
|
-
const effectiveCeilingUsd = ceilingUsd
|
|
2255
|
+
const effectiveCeilingUsd = holdOf(ceilingUsd);
|
|
2238
2256
|
|
|
2239
2257
|
const step = steps[state.stepIndex];
|
|
2240
2258
|
const askSlot = askLines.get(step.fromLine);
|
|
@@ -2518,7 +2536,7 @@ export async function continueRun({
|
|
|
2518
2536
|
inputsManifest: halt.inputsManifest,
|
|
2519
2537
|
capUsd,
|
|
2520
2538
|
redoCap: arbiter.redoCap ?? 3,
|
|
2521
|
-
effectiveCeilingUsd: ceilingUsd
|
|
2539
|
+
effectiveCeilingUsd: holdOf(ceilingUsd),
|
|
2522
2540
|
primitives,
|
|
2523
2541
|
businessDate,
|
|
2524
2542
|
modelStep,
|
package/src/setup.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// carry `note` / `change` kinds; they are only ever READ back, from the flow's own setup.jsonl.
|
|
9
9
|
// Third outcomes: a draft with no result is `stopped`; a cost nobody booked is `null` (shown "unknown", never $0).
|
|
10
10
|
import { lstatSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { triesOf } from './draft-steps.js';
|
|
11
12
|
import { join } from 'node:path';
|
|
12
13
|
|
|
13
14
|
import { scrub } from './authoring.js';
|
|
@@ -52,6 +53,8 @@ function planRow(sessionDir, rel, kind, n) {
|
|
|
52
53
|
// retries the drafter spent on structure (log.json); null = not recorded (a plan from before it), never 0
|
|
53
54
|
structureRetries: Number.isInteger(log?.structureRetries) ? log.structureRetries : null,
|
|
54
55
|
verdict, hash, gap,
|
|
56
|
+
// M4d am15: every try of this plan (label, passed, the checker's raw refusals, the round's words), for the Audit Draft group; only when a retry happened
|
|
57
|
+
...(Array.isArray(log?.log) && log.log.length > 1 ? { tries: triesOf(log.log) } : {}),
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
|
package/src/thinking.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// M4d amendment 7: bareagent decides whether a model's thinking can be changed - not our code, not a table of ours.
|
|
2
|
+
// ONE function wraps bareagent's `thinkingSupport(provider, model, { baseUrl })` (bare-agent >= 0.52, 'bare-agent/providers'): a pure lookup that returns
|
|
3
|
+
// `{ switchable: true | false | 'unverified', off, on, note }`. We return just `switchable`. Its first argument is bareagent's own provider KIND,
|
|
4
|
+
// not our row's API shape id, so a shape id is mapped to its kind here. A shape with no kind, or an answer that is not that object, is 'unverified'
|
|
5
|
+
// (the Chat "Thinking on" box then works and bareagent errors loudly at the call).
|
|
6
|
+
// The row's Base URL is the 3rd argument: bareagent picks the specific kind from the model id / Base URL host exactly as its request path does (0.52).
|
|
7
|
+
// A call whose model can't switch no longer throws: bareagent runs it and reports `thinkingStatus`; the sentences for that are `thinkingSay` below.
|
|
8
|
+
import * as providers from 'bare-agent/providers';
|
|
9
|
+
|
|
10
|
+
/** The sentence under a greyed "Thinking on" box (amendment 7 item 2). */
|
|
11
|
+
export const THINKING_FIXED_SAY = "can't change this for this model";
|
|
12
|
+
|
|
13
|
+
/** Our API shape id -> bareagent's provider kind. */
|
|
14
|
+
const KIND_OF_SHAPE = Object.freeze({ 'anthropic-api': 'anthropic', 'openai-api': 'openai', 'gemini-api': 'gemini' });
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} shape the row's API shape @param {string} model
|
|
18
|
+
* @param {{ impl?: unknown, baseUrl?: string }} [opts] `impl` is a test seam: the function standing in for bareagent's export (default: the installed export); `baseUrl` is the row's Base URL
|
|
19
|
+
* @returns {true|false|'unverified'}
|
|
20
|
+
*/
|
|
21
|
+
export function thinkingSupport(shape, model, { impl = /** @type {any} */ (providers).thinkingSupport, baseUrl } = {}) {
|
|
22
|
+
const kind = /** @type {Record<string, string>} */ (KIND_OF_SHAPE)[shape];
|
|
23
|
+
if (typeof impl !== 'function' || kind === undefined) return 'unverified';
|
|
24
|
+
let answer;
|
|
25
|
+
try { answer = impl(kind, model, baseUrl === undefined || baseUrl === '' ? undefined : { baseUrl }); } catch { return 'unverified'; }
|
|
26
|
+
const s = answer !== null && typeof answer === 'object' ? answer.switchable : undefined;
|
|
27
|
+
return s === true || s === false ? s : 'unverified';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** bareagent's `thinkingStatus` values, worst first (its own order: ignored > unsupported > unknown > applied). */
|
|
31
|
+
const WORST_FIRST = Object.freeze(['ignored', 'unsupported', 'unknown', 'applied']);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The worst of a draft's per-round statuses; `null` when no round carried one.
|
|
35
|
+
* @param {Array<string|null|undefined>} statuses @returns {string|null}
|
|
36
|
+
*/
|
|
37
|
+
export function worstThinkingStatus(statuses) {
|
|
38
|
+
return WORST_FIRST.find((s) => statuses.includes(s)) ?? null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The note beside the Chat "Thinking on" box, before any draft, for a model bareagent has not checked (M4d am11 item 2). */
|
|
42
|
+
export const THINKING_UNVERIFIED_SAY = 'thinking off (not verified for this model)';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The ONE place the thinking words live (M4d am11: bareloop's words). The ✗ line shown in the Chat list when thinking did not go as asked.
|
|
46
|
+
* The words are fixed strings, never built from what was asked: they say what the model did (bareloop's code-owned words).
|
|
47
|
+
* 'applied' (and no status) says nothing here (the list's own "thinking on ✓" / "thinking off ✓" covers it).
|
|
48
|
+
* @param {string|null} status @returns {string|null}
|
|
49
|
+
*/
|
|
50
|
+
export function thinkingSay(status) {
|
|
51
|
+
if (status === 'ignored') return 'thinking on (the model thought anyway)';
|
|
52
|
+
if (status === 'unsupported') return "thinking on (this model can't change it)";
|
|
53
|
+
if (status === 'unknown') return 'thinking off (not confirmed)';
|
|
54
|
+
return null;
|
|
55
|
+
}
|
package/src/version.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// M4d amendment 17: fwdloop's own version, for the panel header. The ONE reader: the server calls it when it serves the page, so the number is always the one in
|
|
2
|
+
// the package.json of the code that is running (never typed into the page). An unreadable file is "unknown", never a made-up number.
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const OWN_PACKAGE = new URL('../package.json', import.meta.url);
|
|
6
|
+
|
|
7
|
+
/** @param {string|URL} [file] a package.json (a test passes a copy) @returns {string|null} */
|
|
8
|
+
export function readOwnVersion(file = OWN_PACKAGE) {
|
|
9
|
+
try {
|
|
10
|
+
const v = JSON.parse(readFileSync(file, 'utf8'))?.version;
|
|
11
|
+
return typeof v === 'string' && /^[0-9A-Za-z.+-]{1,40}$/.test(v) ? v : null;
|
|
12
|
+
} catch { return null; }
|
|
13
|
+
}
|
package/types/authoring.d.ts
CHANGED
|
@@ -86,14 +86,15 @@ export function draftKeyRefusal(slot: string, env: Record<string, string | undef
|
|
|
86
86
|
*
|
|
87
87
|
* Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
|
|
88
88
|
*/
|
|
89
|
-
export function draftToDir({ proseFile, dir, root, name, slot, model,
|
|
89
|
+
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, }: {
|
|
90
90
|
proseFile: any;
|
|
91
91
|
dir: any;
|
|
92
92
|
root: any;
|
|
93
93
|
name: any;
|
|
94
|
-
slot
|
|
94
|
+
slot: any;
|
|
95
95
|
model: any;
|
|
96
|
-
|
|
96
|
+
draftThinking?: "on" | "off" | undefined;
|
|
97
|
+
keyNames: any;
|
|
97
98
|
env?: NodeJS.ProcessEnv | undefined;
|
|
98
99
|
provider: any;
|
|
99
100
|
rates: any;
|
|
@@ -148,14 +149,15 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, budgetUsd,
|
|
|
148
149
|
* `sessionDir` (the panel's draft folder: card, notes, every change) widens the setup record; the CLI has none, so its record is the one plan folder.
|
|
149
150
|
* M6: `replaces: {flowHash}` (a draft opened from an existing signed job, carrying that job's signature hash) makes this sign REPLACE that job
|
|
150
151
|
* (`writeFlow` checks the hash is still the job's); without it a taken name is refused as ever.
|
|
151
|
-
* @param {{dir: any, approve?: any, signedBy: any, signedAt?: string, env?: Record<string, string|undefined>, sessionDir?: string, replaces?: {flowHash: string}}} a
|
|
152
|
+
* @param {{dir: any, approve?: any, signedBy: any, signedAt?: string, env?: Record<string, string|undefined>, keyNames?: string[], sessionDir?: string, replaces?: {flowHash: string}}} a
|
|
152
153
|
*/
|
|
153
|
-
export function signDraft({ dir, approve, signedBy, signedAt, env, sessionDir, replaces, }: {
|
|
154
|
+
export function signDraft({ dir, approve, signedBy, signedAt, env, keyNames, sessionDir, replaces, }: {
|
|
154
155
|
dir: any;
|
|
155
156
|
approve?: any;
|
|
156
157
|
signedBy: any;
|
|
157
158
|
signedAt?: string;
|
|
158
159
|
env?: Record<string, string | undefined>;
|
|
160
|
+
keyNames?: string[];
|
|
159
161
|
sessionDir?: string;
|
|
160
162
|
replaces?: {
|
|
161
163
|
flowHash: string;
|
|
@@ -175,8 +177,11 @@ export function signDraft({ dir, approve, signedBy, signedAt, env, sessionDir, r
|
|
|
175
177
|
ok: false;
|
|
176
178
|
red: string;
|
|
177
179
|
};
|
|
180
|
+
modelRecord: {
|
|
181
|
+
ok: boolean;
|
|
182
|
+
recorded: boolean;
|
|
183
|
+
};
|
|
178
184
|
};
|
|
179
|
-
export const DRAFT_BUDGET_USD: 0.1;
|
|
180
185
|
export const SPEC_HASH_FILE: "spec.hash";
|
|
181
186
|
/** The one folder under the flows root where the panel keeps its draft folders (M4e). Starts with a dot, so it is never a flow name. */
|
|
182
187
|
export const PANEL_DRAFTS_DIR: ".drafts";
|
package/types/closers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** An input with cells (M4d amendment 8): a file whose name ends `.csv`. The one decider for "this input can be cited". */
|
|
2
|
+
export function isCellsPath(p: any): boolean;
|
|
1
3
|
/**
|
|
2
4
|
* `green` close: every field in `artifact.fields`, in declared order,
|
|
3
5
|
* resolves and matches its cite. First red wins.
|
package/types/config.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ export function configDoorHome(): {
|
|
|
22
22
|
};
|
|
23
23
|
/** One provider field's value problem in plain words, or null when fine. Shared by validateDoc and the route. */
|
|
24
24
|
export function providerFieldProblem(field: any, v: any): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* THE one rule for a slot's model lines (M4d amendment 3 items 7-8), used by config validation and the Settings
|
|
27
|
+
* route. A price is a PAIR (`inPerM` and `outPerM`, each a finite number >= 0 — 0 / 0 typed is a chosen price,
|
|
28
|
+
* recorded so it is never unknown) or neither (null / absent). A ticked line (`use`) needs both. Plain words, or null.
|
|
29
|
+
* @param {any} list
|
|
30
|
+
* @returns {string|null}
|
|
31
|
+
*/
|
|
32
|
+
export function modelsProblem(list: any): string | null;
|
|
25
33
|
/**
|
|
26
34
|
* The parsed, validated document. `{}` when the file is missing. THROWS ConfigError when the file is
|
|
27
35
|
* there but unreadable, not a JSON object, or holds an invalid known field — never `{}` for those.
|
|
@@ -33,7 +41,7 @@ export function readConfig(opts?: {
|
|
|
33
41
|
}): Record<string, any>;
|
|
34
42
|
/**
|
|
35
43
|
* Apply a patch and write. `null` deletes a field. Top-level fields shallow-merge; `prices` merges
|
|
36
|
-
* per slot, then per field (`prices.<slot> = null` clears the slot, `prices.<slot>.<field> = null`
|
|
44
|
+
* per slot, then per field; `models.<slot>` is replaced whole (`prices.<slot> = null` clears the slot, `prices.<slot>.<field> = null`
|
|
37
45
|
* clears the field). Everything is validated before anything is written; a refusal leaves the file
|
|
38
46
|
* untouched.
|
|
39
47
|
* @param {Record<string, any>} patch
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} o
|
|
3
|
+
* @param {string} o.runDir
|
|
4
|
+
* @param {(verb: string, rawPath: unknown) => Promise<string>} o.gatePath - the read gate; resolves a model-given path to the absolute path it judged, or throws GateRefusal.
|
|
5
|
+
* @returns {Record<string, {name: string, description: string, parameters: object, execute: (args: any) => Promise<string>}>}
|
|
6
|
+
*/
|
|
7
|
+
export function makeCtxTools({ runDir, gatePath }: {
|
|
8
|
+
runDir: string;
|
|
9
|
+
gatePath: (verb: string, rawPath: unknown) => Promise<string>;
|
|
10
|
+
}): Record<string, {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
parameters: object;
|
|
14
|
+
execute: (args: any) => Promise<string>;
|
|
15
|
+
}>;
|
|
16
|
+
/** One stashed item holds at most this many bytes (measured after secrets are masked,
|
|
17
|
+
* because that is what enters the store). Bareloop's number, signed in M7 item 3. */
|
|
18
|
+
export const ISOLATE_MAX_BYTES: 65536;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tries of a draft, one per round, oldest first. The free retry after a broken reply (a `structure-retry` round) keeps the number of the try it
|
|
3
|
+
* retries: "try N again", never a new number. `reds` are the checker's raw refusals; `outcome` is a non-validator round's plain words, `rawOutcome` its own raw words.
|
|
4
|
+
* @param {any[]} rounds the draft's log.json `log`
|
|
5
|
+
* @returns {Array<{ label: string, passed: boolean, reds: string[], outcome: string, rawOutcome: string, again: boolean }>}
|
|
6
|
+
*/
|
|
7
|
+
export function triesOf(rounds: any[]): Array<{
|
|
8
|
+
label: string;
|
|
9
|
+
passed: boolean;
|
|
10
|
+
reds: string[];
|
|
11
|
+
outcome: string;
|
|
12
|
+
rawOutcome: string;
|
|
13
|
+
again: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* `questionOpen` (am15 item 3): the plan asked a question and the draft has NOT ended: its plan-checks line is not red and has no Fix ("red appears only on a draft that ended red").
|
|
17
|
+
* @param {{ log: any, declaration: any, questionOpen?: boolean }} p `log` = the draft's log.json (parsed), `declaration` = declaration.json or declaration.rejected.json (parsed)
|
|
18
|
+
* @returns {Array<{ id: string, label: string, status: 'done'|'failed'|'waiting', details: string[], note?: boolean }> | null}
|
|
19
|
+
*/
|
|
20
|
+
export function draftStepList({ log, declaration, questionOpen }: {
|
|
21
|
+
log: any;
|
|
22
|
+
declaration: any;
|
|
23
|
+
questionOpen?: boolean;
|
|
24
|
+
}): Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
status: "done" | "failed" | "waiting";
|
|
28
|
+
details: string[];
|
|
29
|
+
note?: boolean;
|
|
30
|
+
}> | null;
|
|
31
|
+
/**
|
|
32
|
+
* M4d amendment 15, every line of the list: the line of ONE revise (or the redraft after answers), from that plan folder's own log.json. Same rules as `draftStepList`:
|
|
33
|
+
* one line, `<name> · <model> · <n rounds> · <cost>` and, for a plan that passed after refused tries, `fixed by the AI after N tries`; a red one carries one plain
|
|
34
|
+
* reason (and the Fix line under it), never details, folds or raw checker text. The try-by-try history is `triesOf` (the Audit Draft group). `null` = no log.
|
|
35
|
+
* @param {{ log: any, name: string }} p
|
|
36
|
+
* @returns {Array<{ id: string, label: string, status: 'done'|'failed'|'waiting', details: string[], note?: boolean }> | null}
|
|
37
|
+
*/
|
|
38
|
+
export function reviseStepList({ log, name }: {
|
|
39
|
+
log: any;
|
|
40
|
+
name: string;
|
|
41
|
+
}): Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
label: string;
|
|
44
|
+
status: "done" | "failed" | "waiting";
|
|
45
|
+
details: string[];
|
|
46
|
+
note?: boolean;
|
|
47
|
+
}> | null;
|
package/types/drafter.d.ts
CHANGED
|
@@ -244,7 +244,7 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
244
244
|
/**
|
|
245
245
|
* Draft one declaration. `provider`/`rates`/`modelId` may be injected (tests,
|
|
246
246
|
* the batch); otherwise a live provider is built from `slot` (throws on a bad
|
|
247
|
-
* key — the batch preflights first). `
|
|
247
|
+
* key — the batch preflights first). The draft's hard cap is the cap signed in the prose (M4d am13); `priorSpend(ceilingUsd)` (am16) is what this job's earlier drafting already spent, so every round must fit what is LEFT of the cap.
|
|
248
248
|
* `makeProviderFn` is a test seam: the live-provider factory (default `makeProvider`).
|
|
249
249
|
* `onBook` (M4e piece 2a, scope 13): called right BEFORE each provider call (`inFlight: true`, the call counted in
|
|
250
250
|
* `calls`) and right AFTER it (`inFlight: false`), with what is known so far, so the caller can book spend per call
|
|
@@ -253,21 +253,22 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
253
253
|
*
|
|
254
254
|
* @returns {Promise<{ok:boolean, declaration:object|null, reds:string[], rounds:number, calls:number, spendComplete:boolean,
|
|
255
255
|
* costUsd:number|null, modelReturned:string|null, modelId?:string, price?:object|null, tokens?:object|null, structureRetries:number, revisions:number, stop:string|null, log:object[],
|
|
256
|
-
* questions?:{line:number, question:string}[], droppedQuestions?:object[], notChecked?:string[]}>}
|
|
256
|
+
* questions?:{line:number, question:string}[], droppedQuestions?:object[], notChecked?:string[], thinking?:{asked:string, status:string|null, say:string|null}, inputs?:{role:string, detail:string}[]}>}
|
|
257
257
|
*/
|
|
258
|
-
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env,
|
|
258
|
+
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, }: {
|
|
259
259
|
proseText: any;
|
|
260
|
-
slot
|
|
260
|
+
slot: any;
|
|
261
261
|
model: any;
|
|
262
262
|
provider: any;
|
|
263
263
|
rates: any;
|
|
264
264
|
modelId: any;
|
|
265
265
|
env: any;
|
|
266
|
-
|
|
266
|
+
priorSpend?: ((ceilingUsd: number) => number) | null | undefined;
|
|
267
267
|
skills?: readonly string[] | undefined;
|
|
268
268
|
makeProviderFn?: typeof makeProvider | undefined;
|
|
269
269
|
onBook: any;
|
|
270
270
|
offerQuestions?: boolean | undefined;
|
|
271
|
+
draftThinking?: "on" | "off" | undefined;
|
|
271
272
|
}): Promise<{
|
|
272
273
|
ok: boolean;
|
|
273
274
|
declaration: object | null;
|
|
@@ -290,6 +291,15 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
290
291
|
}[];
|
|
291
292
|
droppedQuestions?: object[];
|
|
292
293
|
notChecked?: string[];
|
|
294
|
+
thinking?: {
|
|
295
|
+
asked: string;
|
|
296
|
+
status: string | null;
|
|
297
|
+
say: string | null;
|
|
298
|
+
};
|
|
299
|
+
inputs?: {
|
|
300
|
+
role: string;
|
|
301
|
+
detail: string;
|
|
302
|
+
}[];
|
|
293
303
|
}>;
|
|
294
304
|
export const MAX_STRUCTURE_RETRIES: 2;
|
|
295
305
|
export const MAX_REVISIONS: 2;
|
|
@@ -305,11 +315,4 @@ export const CHECKABLE: readonly string[];
|
|
|
305
315
|
export const NOTCHECKED_PROMPT: string;
|
|
306
316
|
/** Try 3 only, and only after tries 1 and 2 both failed validation. No digit and no number word anywhere (a test greps this): the machine, not the prompt, bounds the count. */
|
|
307
317
|
export const QUESTIONS_PROMPT: string;
|
|
308
|
-
export const DRAFT_PROVIDER_OPTIONS: Readonly<{
|
|
309
|
-
thinking: Readonly<{
|
|
310
|
-
type: "disabled";
|
|
311
|
-
}>;
|
|
312
|
-
timeoutMs: 300000;
|
|
313
|
-
deadlineMs: 240000;
|
|
314
|
-
}>;
|
|
315
318
|
import { makeProvider } from './provider.js';
|
package/types/draftspend.d.ts
CHANGED
|
@@ -18,4 +18,60 @@ export function readDraftSpend(dir: string): Record<string, any> | null;
|
|
|
18
18
|
* @returns {Record<string, any>[]}
|
|
19
19
|
*/
|
|
20
20
|
export function readDirSpendRows(dir: string): Record<string, any>[];
|
|
21
|
+
/**
|
|
22
|
+
* M4d amendment 16 item 1: what ALL of a job's drafting spent — the one writer of that total. A panel draft's session folder holds one plan
|
|
23
|
+
* folder per draft (`draft/`, `draft-<n>/` for each revise and the redraft after answers); each is read by `readDirSpendRows` and priced by
|
|
24
|
+
* `spendRowCost`, the one cost rule. A round whose cost is not known counts at its WORST CASE (item 5): its own booked price's ceiling, else
|
|
25
|
+
* `ceilingUsd` (Settings prices x the fixed token limits), never $0; `notPriced` counts those rounds and `complete` is false.
|
|
26
|
+
* @param {string} sessionDir the panel's draft folder
|
|
27
|
+
* @param {{ ceilingUsd?: number, exclude?: string }} [o] `exclude` = a plan folder name to leave out (the one being written now)
|
|
28
|
+
* @returns {{ usd: number, notPriced: number, complete: boolean, missingEarlier: boolean }}
|
|
29
|
+
*/
|
|
30
|
+
export function draftingSpent(sessionDir: string, { ceilingUsd, exclude }?: {
|
|
31
|
+
ceilingUsd?: number;
|
|
32
|
+
exclude?: string;
|
|
33
|
+
}, seen?: Set<any>): {
|
|
34
|
+
usd: number;
|
|
35
|
+
notPriced: number;
|
|
36
|
+
complete: boolean;
|
|
37
|
+
missingEarlier: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* M4d amendment 16 items 1, 3, 5: the split of the card's Cap $ at Sign & run. `leftUsd` is what the first run may spend, rounded DOWN to 4 places (never
|
|
41
|
+
* more than is left). `line` is the sentence the page shows.
|
|
42
|
+
* @param {number} capUsd @param {{ usd: number, notPriced: number }} spent
|
|
43
|
+
*/
|
|
44
|
+
export function potSplit(capUsd: number, spent: {
|
|
45
|
+
usd: number;
|
|
46
|
+
notPriced: number;
|
|
47
|
+
}): {
|
|
48
|
+
capUsd: number;
|
|
49
|
+
spentUsd: number;
|
|
50
|
+
notPriced: number;
|
|
51
|
+
leftUsd: number;
|
|
52
|
+
line: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The drafter's `priorSpend` for the plan folder `dir`: when it sits in a panel session folder (a `card.json` beside it), what the session's earlier plans spent;
|
|
56
|
+
* null for a plain CLI draft (no session, nothing earlier). The folder being written is left out.
|
|
57
|
+
* @param {string} dir @returns {((ceilingUsd: number) => number)|null}
|
|
58
|
+
*/
|
|
59
|
+
export function sessionPriorSpend(dir: string): ((ceilingUsd: number) => number) | null;
|
|
60
|
+
/**
|
|
61
|
+
* M4d amendment 19 item 1: what a draft reserves against the monthly limit: what is LEFT of the cap in its prose (cap minus what this job's drafting already
|
|
62
|
+
* spent, `sessionPriorSpend`), not one round. A prose that does not parse falls back to one round: the draft itself refuses it at $0.
|
|
63
|
+
* @param {string} proseText @param {string} outDir the plan folder the draft will write @param {number} ceilingUsd one round at its worst case
|
|
64
|
+
*/
|
|
65
|
+
export function draftHoldUsd(proseText: string, outDir: string, ceilingUsd: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* M4d amendment 19 item 5 / amendment 20: the ONE sentence for a cap that cannot pay for one round. `kind` is "drafting" (the Chat card, the drafter) or "run"
|
|
68
|
+
* (Run a signed flow, Resume); nothing else differs. `modelId` is the model the minimum was computed for, `minUsd` its worst-case round.
|
|
69
|
+
* @param {'drafting'|'run'} kind @param {number} capUsd @param {number} minUsd @param {string} modelId
|
|
70
|
+
*/
|
|
71
|
+
export function capTooSmallText(kind: "drafting" | "run", capUsd: number, minUsd: number, modelId: string): string;
|
|
21
72
|
export const DRAFT_SPEND_FILE: "draft-spend.json";
|
|
73
|
+
/** M4d am21 item 2: the one sentence for a Start over (or revise, or sign) whose chain names an earlier draft that is gone. */
|
|
74
|
+
export const EARLIER_MISSING_SAY: "An earlier draft of this job is missing, so its spend can't be counted.";
|
|
75
|
+
/** The file a Start over's session folder carries to name the session it started over from (written once by src/panel/author.js). */
|
|
76
|
+
export const STARTED_OVER_FILE: "started-over-from.json";
|
|
77
|
+
export function usdText(n: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} dir a draft folder or a flow folder
|
|
3
|
+
* @returns {{ slot: string, model: string }|null} null when there is no usable record (missing, unreadable, or not a name and a model id)
|
|
4
|
+
*/
|
|
5
|
+
export function readModelRecord(dir: string): {
|
|
6
|
+
slot: string;
|
|
7
|
+
model: string;
|
|
8
|
+
} | null;
|
|
9
|
+
/**
|
|
10
|
+
* Write the record once (never over an existing one). @param {string} dir @param {{ slot: string, model: string }} pick
|
|
11
|
+
*/
|
|
12
|
+
export function writeModelRecord(dir: string, { slot, model }: {
|
|
13
|
+
slot: string;
|
|
14
|
+
model: string;
|
|
15
|
+
}): void;
|
|
16
|
+
export const MODEL_FILE: "model.json";
|
package/types/input-facts.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {Array<{kind?:string, role:string, path:string}>} sources arbiter.sources
|
|
3
|
-
*
|
|
3
|
+
* `list` (M4d am10) is one `{role, detail}` per readable input for the Chat card's list (a CSV: its columns; text: its headings); never hashed.
|
|
4
|
+
* @returns {{ok:boolean, inputFacts:Record<string,string[]>, info:string[], list:Array<{role:string, detail:string}>, reds:string[]}}
|
|
4
5
|
*/
|
|
5
6
|
export function readInputFacts(sources: Array<{
|
|
6
7
|
kind?: string;
|
|
@@ -10,5 +11,9 @@ export function readInputFacts(sources: Array<{
|
|
|
10
11
|
ok: boolean;
|
|
11
12
|
inputFacts: Record<string, string[]>;
|
|
12
13
|
info: string[];
|
|
14
|
+
list: Array<{
|
|
15
|
+
role: string;
|
|
16
|
+
detail: string;
|
|
17
|
+
}>;
|
|
13
18
|
reds: string[];
|
|
14
19
|
};
|
package/types/keysfile.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE rule for what may be a key name (hamr's ruling, branch-review): it looks like an API key, `…_KEY` in capitals. Used at every gate:
|
|
3
|
+
* the `names` Settings lists, the env pass-through, and the routes that take a slot name. A `NODE_OPTIONS` line is not a key.
|
|
4
|
+
* @param {unknown} name @returns {name is string}
|
|
5
|
+
*/
|
|
6
|
+
export function isKeyName(name: unknown): name is string;
|
|
1
7
|
/**
|
|
2
8
|
* `~/.config/fwdloop`, or an injected override. The CLI/panel door honors the test-only
|
|
3
9
|
* `FWDLOOP_CONFIG_HOME` through `keysForDoor` (two gates, like the other test seams).
|
|
@@ -25,20 +31,29 @@ export function parseKeysText(text: string): Record<string, string>;
|
|
|
25
31
|
* @property {string} path the keys file's path as shown to people
|
|
26
32
|
* @property {boolean} exists the file is there (true after a create)
|
|
27
33
|
* @property {string[]} names the NAMES the file defines with a value (sorted; never values)
|
|
28
|
-
* @property {string[]} shellOnly the
|
|
34
|
+
* @property {string[]} shellOnly the configured key names that only the shell sets (file empty/absent)
|
|
35
|
+
* @property {string[]} keyNames the NAMES of the keys that are set up in Settings and hold a value in `env` (the scrub list's names; never values)
|
|
29
36
|
* @property {string|null} refusal a plain sentence when `ok` is false, else null
|
|
30
37
|
* @property {Record<string,string|undefined>} env shell env with the file filling the names the
|
|
31
38
|
* shell does not set; on a refusal just a copy of the shell env (no file value). THE ONLY
|
|
32
39
|
* place file values leave this module.
|
|
33
40
|
*/
|
|
34
41
|
/**
|
|
35
|
-
*
|
|
36
|
-
* @param {
|
|
42
|
+
* The key VALUES of the named keys in an env: the scrub list. The names come from a load's `keyNames`.
|
|
43
|
+
* @param {Record<string,string|undefined>} env @param {readonly string[]|undefined} names
|
|
44
|
+
* @returns {string[]}
|
|
45
|
+
*/
|
|
46
|
+
export function keyValues(env: Record<string, string | undefined>, names: readonly string[] | undefined): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Load the keys file over an env. A missing file is created (0600) and is not a refusal. `configured` = the key names that have a row
|
|
49
|
+
* set up in Settings (`config.providers`): only those file values reach `env`.
|
|
50
|
+
* @param {{ env?: Record<string,string|undefined>, home?: string, configured?: string[] }} [opts]
|
|
37
51
|
* @returns {KeysLoad}
|
|
38
52
|
*/
|
|
39
53
|
export function loadKeysEnv(opts?: {
|
|
40
54
|
env?: Record<string, string | undefined>;
|
|
41
55
|
home?: string;
|
|
56
|
+
configured?: string[];
|
|
42
57
|
}): KeysLoad;
|
|
43
58
|
/**
|
|
44
59
|
* The door helper the CLI and the panel call. Loads the file only when the caller is on the
|
|
@@ -54,8 +69,6 @@ export function keysForDoor(deps?: {
|
|
|
54
69
|
}): KeysLoad & {
|
|
55
70
|
skipped: boolean;
|
|
56
71
|
};
|
|
57
|
-
/** The key names fwdloop knows (one per provider slot). */
|
|
58
|
-
export const KEY_NAMES: readonly ("SYNTHETIC_API_KEY" | "DEEPSEEK_API_KEY")[];
|
|
59
72
|
export type KeysLoad = {
|
|
60
73
|
/**
|
|
61
74
|
* false = refused: nothing that needs a key may run
|
|
@@ -74,9 +87,13 @@ export type KeysLoad = {
|
|
|
74
87
|
*/
|
|
75
88
|
names: string[];
|
|
76
89
|
/**
|
|
77
|
-
* the
|
|
90
|
+
* the configured key names that only the shell sets (file empty/absent)
|
|
78
91
|
*/
|
|
79
92
|
shellOnly: string[];
|
|
93
|
+
/**
|
|
94
|
+
* the NAMES of the keys that are set up in Settings and hold a value in `env` (the scrub list's names; never values)
|
|
95
|
+
*/
|
|
96
|
+
keyNames: string[];
|
|
80
97
|
/**
|
|
81
98
|
* a plain sentence when `ok` is false, else null
|
|
82
99
|
*/
|
package/types/liveness.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export function procStartOf(pid: number | "self"): string | null;
|
|
|
14
14
|
* null - cannot tell (no /proc, or not ours to read): caller falls back to the 10-minute rule
|
|
15
15
|
* @param {number} pid
|
|
16
16
|
* @param {string|null} [procStart] the starttime recorded by the process itself; absent/null = not compared
|
|
17
|
+
* @param {typeof REAL_PROC} [proc] where /proc is read from (tests pass a snapshot)
|
|
17
18
|
* @returns {boolean|null}
|
|
18
19
|
*/
|
|
19
|
-
export function isFwdloopAlive(pid: number, procStart?: string | null): boolean | null;
|
|
20
|
+
export function isFwdloopAlive(pid: number, procStart?: string | null, proc?: typeof REAL_PROC): boolean | null;
|
|
20
21
|
/**
|
|
21
22
|
* The one writer call: this process records itself in the run dir's
|
|
22
23
|
* `pids.jsonl`, before its first step.
|
|
@@ -68,3 +69,8 @@ export function readResumeLock(runDir: string): {
|
|
|
68
69
|
export function booksFresh(runDir: string, nowMs?: number): boolean;
|
|
69
70
|
/** The words the runner's refusal uses for a lock it cannot clear; the panel reads the same constant (M4c amendment 3 (e)). */
|
|
70
71
|
export const LOCK_NO_HOLDER: "with no recorded holder";
|
|
72
|
+
declare namespace REAL_PROC {
|
|
73
|
+
function cmdline(pid: number): string;
|
|
74
|
+
function stat(pid: number): string;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
package/types/model-step.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export function buildEmitArtifactSchema(stepClass: any): Readonly<{
|
|
|
80
80
|
}>;
|
|
81
81
|
/**
|
|
82
82
|
* @param {object} opts
|
|
83
|
-
* @param {string} [opts.slot] - a
|
|
83
|
+
* @param {string} [opts.slot] - a provider row (the name of a key in the keys file); required when `provider` isn't injected.
|
|
84
84
|
* @param {string} [opts.model] - overrides the slot's default model.
|
|
85
85
|
* @param {string} opts.spendPath - the run's spend.jsonl (never a second ledger).
|
|
86
86
|
* @param {any} [opts.provider] - an injected provider (tests only; production always builds live via `slot`).
|