fwdloop 0.35.2 → 0.37.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 +1 -1
- package/bin/fwdloop +5 -2
- package/package.json +3 -3
- package/src/action-stop.js +1 -1
- package/src/auditchecks.js +41 -9
- package/src/authoring.js +78 -20
- package/src/blockasks.js +10 -12
- package/src/blockassemble.js +49 -43
- package/src/blockdraft.js +4 -2
- package/src/blockpick.js +10 -0
- package/src/canrun.js +2 -1
- package/src/cardlist.js +28 -5
- package/src/checkblock.js +610 -64
- package/src/checked.js +28 -33
- package/src/checklistsign.js +2 -1
- package/src/checklook.js +45 -0
- package/src/checkrows.js +202 -0
- package/src/cited-record.js +2 -2
- package/src/citedcheck.js +53 -12
- package/src/citedwords.js +7 -4
- package/src/closers.js +49 -2
- package/src/declaration.js +26 -4
- package/src/drafter.js +86 -62
- package/src/factwords.js +7 -4
- package/src/globprefix.js +26 -0
- package/src/model-step.js +22 -4
- package/src/pageask.js +6 -4
- package/src/pagedropwords.js +3 -11
- package/src/pagedry.js +75 -1
- package/src/pagefetch.js +11 -6
- package/src/pagelook.js +2 -1
- package/src/pagerules.js +8 -2
- package/src/panel/author.js +20 -8
- package/src/panel/authorcard.js +3 -3
- package/src/panel/data.js +3 -2
- package/src/panel/index.html +176 -41
- package/src/panel/result.js +40 -3
- package/src/pickrecord.js +14 -0
- package/src/planrebuild.js +55 -19
- package/src/ratelimit.js +117 -0
- package/src/report.js +216 -0
- package/src/rowresults.js +111 -0
- package/src/rubricstep.js +65 -2
- package/src/runner.js +61 -9
- package/src/send.js +19 -82
- package/src/shapebuild.js +281 -0
- package/src/shapelook.js +91 -0
- package/src/shapemenu.js +64 -0
- package/src/shaperesult.js +104 -0
- package/src/shaperows.js +263 -0
- package/src/shapewords.js +140 -0
- package/src/sheetbuild.js +41 -29
- package/src/sheetclaims.js +49 -1
- package/src/sheetfind.js +8 -0
- package/src/sheetlook.js +11 -1
- package/src/sheetrows.js +10 -64
- package/src/ticketrows.js +1 -1
- package/src/try-checks.js +39 -6
- package/src/types.js +1 -0
- package/src/whole-job.js +108 -16
- package/types/action-stop.d.ts +1 -1
- package/types/auditchecks.d.ts +13 -2
- package/types/authoring.d.ts +24 -4
- package/types/blockasks.d.ts +6 -10
- package/types/blockassemble.d.ts +13 -13
- package/types/blockdraft.d.ts +3 -2
- package/types/blockpick.d.ts +4 -0
- package/types/cardlist.d.ts +18 -2
- package/types/checkblock.d.ts +278 -28
- package/types/checked.d.ts +15 -6
- package/types/checklook.d.ts +36 -0
- package/types/checkrows.d.ts +119 -0
- package/types/citedcheck.d.ts +4 -2
- package/types/closers.d.ts +10 -1
- package/types/drafter.d.ts +8 -4
- package/types/globprefix.d.ts +5 -0
- package/types/model-step.d.ts +43 -2
- package/types/pageask.d.ts +5 -3
- package/types/pagedropwords.d.ts +0 -1
- package/types/pagedry.d.ts +27 -0
- package/types/pagefetch.d.ts +3 -2
- package/types/pagerules.d.ts +4 -0
- package/types/panel/result.d.ts +19 -2
- package/types/pickrecord.d.ts +10 -0
- package/types/ratelimit.d.ts +59 -0
- package/types/report.d.ts +46 -0
- package/types/rowresults.d.ts +28 -0
- package/types/rubricstep.d.ts +21 -0
- package/types/runner.d.ts +3 -1
- package/types/send.d.ts +13 -12
- package/types/shapebuild.d.ts +97 -0
- package/types/shapelook.d.ts +76 -0
- package/types/shapemenu.d.ts +40 -0
- package/types/shaperesult.d.ts +40 -0
- package/types/shaperows.d.ts +102 -0
- package/types/shapewords.d.ts +43 -0
- package/types/sheetbuild.d.ts +31 -13
- package/types/sheetclaims.d.ts +16 -0
- package/types/sheetfind.d.ts +1 -0
- package/types/sheetrows.d.ts +5 -36
- package/types/ticketrows.d.ts +1 -1
- package/types/try-checks.d.ts +2 -1
- package/types/types.d.ts +4 -0
- package/types/whole-job.d.ts +69 -3
package/src/rubricstep.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
// and the default cited text. The rest of the rubric step (building, grading and reading a step file) is not wanted here.
|
|
4
4
|
import { lineRules } from './pagebits.js';
|
|
5
5
|
import { factShapeReds } from './citedcheck.js';
|
|
6
|
+
import { shapeShapeReds, shapeFieldSentence, shapeExampleItem } from './shaperows.js';
|
|
7
|
+
import { plainShapeGap } from './shapewords.js';
|
|
8
|
+
|
|
9
|
+
// borrowed-from: bareloop src/rubricstep.js@v0.60.0 (the one spelling of the keys of a repo job's stage row, of a job-level guard row and of the write-fence row; fwd has no repo job, so only the block's repo rows read them)
|
|
10
|
+
export const stageKeyOf = (/** @type {string} */ name) => `S.${name}`;
|
|
11
|
+
export const guardKeyOf = (/** @type {string} */ name) => `J.$guard.${name}`;
|
|
12
|
+
export const FENCE_KEY = 'J.$fence';
|
|
6
13
|
|
|
7
14
|
// ── the `rubric-step` stage: its parameters, and the rubric they build ───────────────────────────────────────────────
|
|
8
15
|
//
|
|
@@ -17,7 +24,7 @@ import { factShapeReds } from './citedcheck.js';
|
|
|
17
24
|
// (src/authoring.js `checkRubricParts`) so no signed stage ever carries one.
|
|
18
25
|
|
|
19
26
|
/** the closed set of classes a part is sorted into; `none` = "I could not sort this one" (a red, in plain words, never a guess) */
|
|
20
|
-
export const PART_CLASSES = Object.freeze(['countable', 'fact', 'judged', 'guard', 'none']);
|
|
27
|
+
export const PART_CLASSES = Object.freeze(['countable', 'fact', 'shape', 'judged', 'guard', 'none']);
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* The counted/quoted checks a `countable` part may name, with the fields each needs — read off bareguard's own rule table
|
|
@@ -49,7 +56,7 @@ export const COUNT_CHECKS = Object.freeze({
|
|
|
49
56
|
});
|
|
50
57
|
|
|
51
58
|
/** every field a part may carry, whatever its class */
|
|
52
|
-
const PART_FIELDS = Object.freeze(['text', 'class', 'check', 'value', 'names', 'wordsPerSection', 'source', 'domains', 'phrases', 'size', 'covers', 'rules', 'from', 'record', 'facts', 'count', 'tested', 'sample']);
|
|
59
|
+
const PART_FIELDS = Object.freeze(['text', 'class', 'check', 'value', 'names', 'wordsPerSection', 'source', 'domains', 'phrases', 'size', 'covers', 'rules', 'from', 'record', 'facts', 'count', 'tested', 'sample', 'asSeen', 'fields', 'minItems', 'maxItems']);
|
|
53
60
|
|
|
54
61
|
/** @typedef {{code: string, path: string, detail: string}} ShapeRed */
|
|
55
62
|
|
|
@@ -92,6 +99,9 @@ export function rubricStepShapeReds(p, at) {
|
|
|
92
99
|
&& part.rules.every((/** @type {unknown} */ x) => Number.isInteger(x) && /** @type {number} */ (x) >= 1))) {
|
|
93
100
|
red('invalid-value', `${w}.rules`, 'the numbers of the line\'s ~ rules this part carries out (distinct integers, 1 or more)');
|
|
94
101
|
}
|
|
102
|
+
if (Object.hasOwn(part, 'asSeen') && part.class !== 'fact') red('invalid-value', `${w}.asSeen`, 'only a fact part carries the as-seen example');
|
|
103
|
+
for (const k of ['fields', 'minItems', 'maxItems']) if (Object.hasOwn(part, k) && part.class !== 'shape') red('invalid-value', `${w}.${k}`, 'only a shape part carries the fields and the item count of a list of items');
|
|
104
|
+
if (part.class === 'shape') { shapeShapeReds(part, w, (c, path, d) => red(c, path, d), p.parts.find((/** @type {any} */ x) => isRec(x) && x.class === 'fact') ?? null); return; }
|
|
95
105
|
if (part.class === 'fact') { factShapeReds(part, w, (c, path, d) => red(c, path, d)); return; }
|
|
96
106
|
if (part.class === 'guard') {
|
|
97
107
|
if (!nameList(part.domains)) red('invalid-value', `${w}.domains`, 'a non-empty array of web domains the rule is about');
|
|
@@ -113,6 +123,10 @@ export function rubricStepShapeReds(p, at) {
|
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
});
|
|
126
|
+
// shape jobs: a line is a shape line, a sheet line or a facts line, never two of them, and a shape part holds its place beside the line's fact part (facts+shape: one `results` list) and its picks
|
|
127
|
+
const shapeParts = p.parts.filter((/** @type {any} */ x) => isRec(x) && x.class === 'shape');
|
|
128
|
+
if (shapeParts.length > 1) red('invalid-value', `${at}.parts`, 'one shape part per step: the fields of a list of items all go in one');
|
|
129
|
+
if (p.parts.some((/** @type {any} */ x) => isRec(x) && x.class === 'sheet') && shapeParts.length > 0) red('invalid-value', `${at}.parts`, 'a sheet line holds sheet checks: a shape part is not allowed beside them');
|
|
116
130
|
return reds;
|
|
117
131
|
}
|
|
118
132
|
|
|
@@ -270,3 +284,52 @@ export function listMatchesClose(closeDecl) {
|
|
|
270
284
|
if (bare.length) parts.push(`a check in the close has no row: line ${bare.map(({ n, i }) => `${n} part ${i + 1}`).join('; ')}`);
|
|
271
285
|
return { ok: false, error: `The list of checks does not match the signed close (${parts.join(' | ')}). Nothing was signed — draft again.` };
|
|
272
286
|
}
|
|
287
|
+
|
|
288
|
+
// borrowed-from: bareloop src/rubricstep.js@v0.61.0 (fc56e1f3) (shapeBriefOf and the LIST-line brief of lineBriefs: the lines are the tag's, written by code from the signed shape; the first line of a shape-only or text+list line is fwd's adapted
|
|
289
|
+
// line, docs/wiki/the-module-ladder.md M19 section 3.6, because fwd's step answers through emit_artifact with done and blocker, not a step file)
|
|
290
|
+
/**
|
|
291
|
+
* FACTS + SHAPE: the extra lines of a fact line's brief when its close also carries an itemShape part (code-written, never model-written): each result also carries the shape fields, in plain words, with ONE example result
|
|
292
|
+
* built by code (the quote and values placeholders, then a legal value for each shape field). Nothing is added for a line with no shape part.
|
|
293
|
+
* @param {any} shape the line's shape part ({fields, minItems?, maxItems?}) @param {any} fp the fact part @returns {string[]}
|
|
294
|
+
*/
|
|
295
|
+
export function shapeBriefOf(shape, fp) {
|
|
296
|
+
if (!isRec(shape) || !Array.isArray(shape.fields)) return [];
|
|
297
|
+
const fields = shape.fields.filter(isRec);
|
|
298
|
+
const values = Object.fromEntries(fp.facts.map((/** @type {any} */ f) => [f.name, '<as the quote writes it>']));
|
|
299
|
+
return [
|
|
300
|
+
' Each result ALSO carries these fields (named exactly as written; a field marked optional may be left out when it does not apply):',
|
|
301
|
+
...fields.map((/** @type {any} */ f) => ` - ${f.name}: ${shapeFieldSentence(f.spec)}${f.spec.required === true ? '' : ' (optional)'}`),
|
|
302
|
+
` One example result: ${JSON.stringify({ quote: '<words copied from the page>', values, ...shapeExampleItem(/** @type {any} */ (fields)) })}`,
|
|
303
|
+
];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* A SHAPE line's brief (no fact part): the answer is a list of items, each field in plain words (the signed bounds, in the person's own form) and ONE worked example item, all written by code from the signed shape.
|
|
308
|
+
* `alsoText` = the line also carries the person's picks (its answer has `text` too).
|
|
309
|
+
* @param {number} n the job line @param {any} shape the line's shape part @param {boolean} [alsoText] @returns {string}
|
|
310
|
+
*/
|
|
311
|
+
export function shapeLineBrief(n, shape, alsoText = false) {
|
|
312
|
+
const fields = shape.fields.filter(isRec);
|
|
313
|
+
// M19 am11 item 3: the count as it is signed (`exactly N items`, `at least N items`, `at most N items`)
|
|
314
|
+
const lo = Number.isInteger(shape.minItems) ? shape.minItems : null; const hi = Number.isInteger(shape.maxItems) ? shape.maxItems : null;
|
|
315
|
+
const s = (/** @type {number} */ k) => `${k} item${k === 1 ? '' : 's'}`;
|
|
316
|
+
const count = lo !== null && lo === hi ? `exactly ${s(lo)}` : lo !== null || hi !== null ? [...(lo !== null ? [`at least ${s(lo)}`] : []), ...(hi !== null ? [`at most ${s(hi)}`] : [])].join(' and ') : 'one item for every one you find';
|
|
317
|
+
return [
|
|
318
|
+
alsoText
|
|
319
|
+
? `Job line ${n} is a TEXT line AND a LIST line. Call emit_artifact exactly once with this step's result: {"text": "...", "results": [{...}, {...}]}: "text" as for any text line, and "results" is the list of items. One object per item: ${count}.`
|
|
320
|
+
: `Job line ${n} is a LIST line. Call emit_artifact exactly once with this step's result: {"results": [{...}, {...}]} — no "text", no "cites". One object per item: ${count}.`,
|
|
321
|
+
' Every item has these fields, named exactly as written (a field marked optional may be left out when it does not apply):',
|
|
322
|
+
...fields.map((/** @type {any} */ f) => ` - ${f.name}: ${shapeFieldSentence(f.spec)}${f.spec.required === true ? '' : ' (optional)'}`),
|
|
323
|
+
` One example item: ${JSON.stringify(shapeExampleItem(fields))}`,
|
|
324
|
+
' Write each value as plain text or a plain number or yes/no (true or false) as the field says, never as a sentence about the value.',
|
|
325
|
+
].join('\n');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The plain sentence of a bareguard gap of one line's answer, as the tag's `plainStepGap` takes it (step, why, gap, params). fwd's step has no file, so an itemShape gap's file is `the answer` (src/closers.js); only an itemShape gap
|
|
330
|
+
* is worded here (fwd's other gaps keep their own words in src/closers.js and src/citedcheck.js).
|
|
331
|
+
* @param {number} step the job line @param {string} _why @param {any} g a bareguard gap @param {any} [_params] @returns {string}
|
|
332
|
+
*/
|
|
333
|
+
export function plainStepGap(step, _why, g, _params = null) {
|
|
334
|
+
return plainShapeGap({ at: `line ${step}`, file: 'the answer' }, g);
|
|
335
|
+
}
|
package/src/runner.js
CHANGED
|
@@ -79,7 +79,8 @@ import { readRunInputs, readRunRecord, writeRunStart } from './runfile.js';
|
|
|
79
79
|
// borrowed-from: bareloop src/userrun.js@v0.56.0 (3383cce) (the place-rule read at run start and its stop words; fwd keeps the read value in run.json, not a spine)
|
|
80
80
|
import { citedPlaceFactsOf, bindCitedPlaceValues, readPlaceRules, valueInWords, stopWords, placeValuesOfEvents, lastRunPlaceRead, PLACE_EVENT, NO_PLACE_RECORD_WORDS } from './placerule.js';
|
|
81
81
|
import { buildMemo } from './memo.js';
|
|
82
|
-
import { wholeJobAskIndex, wholeJobText } from './whole-job.js';
|
|
82
|
+
import { wholeJobAskIndex, wholeJobText, reportContextOf, sendBodyOf } from './whole-job.js';
|
|
83
|
+
import { runNumberOf } from './report.js';
|
|
83
84
|
import { ACTION_STOP_KIND, decideAction, lastAcceptedSha, stopWaitMs } from './action-stop.js';
|
|
84
85
|
import { fetchPageText, isWebUrl } from './pagefetch.js';
|
|
85
86
|
import { readTicketMcp, configForServer, remoteRefusal, mcpStartOpts, startRefusal, firstLine } from './ticket-mcp.js';
|
|
@@ -858,6 +859,8 @@ function makeAuditRow({
|
|
|
858
859
|
memoText = /** @type {string|undefined} */ (undefined),
|
|
859
860
|
badCalls = /** @type {any[]|undefined} */ (undefined),
|
|
860
861
|
sentSha256 = /** @type {string|undefined} */ (undefined),
|
|
862
|
+
sentName = /** @type {string|undefined} */ (undefined),
|
|
863
|
+
sentTaken = /** @type {string|undefined} */ (undefined),
|
|
861
864
|
savedBy = /** @type {string|undefined} */ (undefined),
|
|
862
865
|
forcedRefused = /** @type {string|undefined} */ (undefined),
|
|
863
866
|
}) {
|
|
@@ -891,6 +894,9 @@ function makeAuditRow({
|
|
|
891
894
|
if (Array.isArray(badCalls) && badCalls.length > 0) row.badCalls = badCalls;
|
|
892
895
|
// M15 item 4: the sha256 of the plain-text file a send wrote; the key is only on a green send row. The ONE writer; the Result tab reads it to tell the file changed.
|
|
893
896
|
if (typeof sentSha256 === 'string') row.sentSha256 = sentSha256;
|
|
897
|
+
// M15 am3 item 1: the name the report was written under, and (only when its first choice was taken) that taken name, so the Result tab can say it. The ONE writer.
|
|
898
|
+
if (typeof sentName === 'string') row.sentName = sentName;
|
|
899
|
+
if (typeof sentTaken === 'string') row.sentTaken = sentTaken;
|
|
894
900
|
// M4d am37 item 5: which way the model step saved its artifact - `first` (round 1), `forced` (the forced call after the fixed line), `fallback` (the unforced call); absent when it did not save. The ONE writer.
|
|
895
901
|
if (savedBy === 'first' || savedBy === 'forced' || savedBy === 'fallback') row.savedBy = savedBy;
|
|
896
902
|
// M4d am37, ruling A: the fixed say of a try whose forced call the provider refused with no usage returned (it booked $0); absent otherwise. The ONE writer.
|
|
@@ -927,6 +933,7 @@ function makeAuditRow({
|
|
|
927
933
|
* @param {number} [opts.triesDone] - tries a Stop already closed on this step (they count against its limit)
|
|
928
934
|
* @param {string|null} [opts.runDir] - M4d am29 item 2: the run's folder, where each try saves its checks
|
|
929
935
|
* @param {any[]} [opts.checkList] - M16 item 5: the plan's signed list; a list line's checks carry the row's `by`
|
|
936
|
+
* @param {any[]} [opts.jobLines] - M19 am11 item 4: the signed job lines; the words of a list line's rows read the person's rule
|
|
930
937
|
* @param {Record<string, any>} [opts.mcpGranted] - M13 item 5: this step's signed MCP tools, already bound to its bridge (`runStepRalph` builds them); handed to the model with the verbs
|
|
931
938
|
* @returns {Promise<{ok:true, artifact:any, attempts:number, hitl?:boolean} | {ok:false, outcome:string, red:string, stop?:{where:string, book:Record<string, any>, step?:string|null}}>}
|
|
932
939
|
*/
|
|
@@ -953,6 +960,8 @@ async function runStepTries({
|
|
|
953
960
|
mcpGranted = {},
|
|
954
961
|
// M16 item 5: the signed list (declaration.checkList), so a check of a list line is tagged by its row in the Audit
|
|
955
962
|
checkList = undefined,
|
|
963
|
+
// M19 am11 item 4: the signed job lines (the words of a list line's rows)
|
|
964
|
+
jobLines = undefined,
|
|
956
965
|
}) {
|
|
957
966
|
/** @type {string|null} */
|
|
958
967
|
let gap = initialGap ?? null;
|
|
@@ -1041,7 +1050,7 @@ async function runStepTries({
|
|
|
1041
1050
|
// M4d am25: `thinkingMode` is the ONE decision of what this try asks of thinking (`stepThinkingMode`); the model step only passes it on.
|
|
1042
1051
|
// M10 am7 item 3: `cited` is the fact part of a green step that quotes a saved page - the form of its ANSWER ({results: [{quote, values}]}) and the facts it must hold,
|
|
1043
1052
|
// told to the step in plain words by the model step. It is not the check: the quotes are checked by `closeCited` against the run's own copy.
|
|
1044
|
-
const stepMeta = Object.freeze({ class: step.close?.class ?? null, cited: step.close?.class === 'green' && step.close.cited ? step.close.cited : null, sheet: step.close?.class === 'green' && Array.isArray(step.close.sheet) ? step.close.sheet : null, withText: step.close?.class === 'green' && Array.isArray(step.close.picked) && step.close.picked.length > 0, picked: step.close?.class === 'green' && Array.isArray(step.close.picked) ? step.close.picked : null, attempt, step: step?.emits ?? step?.goal ?? null, thinkingMode: stepThinkingMode({ boxOn: thinkingBox, attempt }) });
|
|
1053
|
+
const stepMeta = Object.freeze({ class: step.close?.class ?? null, cited: step.close?.class === 'green' && step.close.cited ? step.close.cited : null, sheet: step.close?.class === 'green' && Array.isArray(step.close.sheet) ? step.close.sheet : null, withText: step.close?.class === 'green' && Array.isArray(step.close.picked) && step.close.picked.length > 0, picked: step.close?.class === 'green' && Array.isArray(step.close.picked) ? step.close.picked : null, attempt, itemShape: step.close?.itemShape && typeof step.close.itemShape === 'object' ? step.close.itemShape : null, line: step.fromLine ?? null, step: step?.emits ?? step?.goal ?? null, thinkingMode: stepThinkingMode({ boxOn: thinkingBox, attempt }) });
|
|
1045
1054
|
|
|
1046
1055
|
const stopSeam = readStop ? Object.freeze({ stopRequested: readStop }) : undefined;
|
|
1047
1056
|
|
|
@@ -1204,7 +1213,7 @@ async function runStepTries({
|
|
|
1204
1213
|
n: step.fromLine, part: closed.cited.part, results: closed.cited.results, check: closed.cited.check,
|
|
1205
1214
|
}));
|
|
1206
1215
|
}
|
|
1207
|
-
tryChecks.push(...closeRecords(step, artifact, closed, checkList));
|
|
1216
|
+
tryChecks.push(...closeRecords(step, artifact, closed, checkList, jobLines));
|
|
1208
1217
|
saveTry();
|
|
1209
1218
|
|
|
1210
1219
|
if (closed.verdict === 'green' || closed.verdict === 'hitl') {
|
|
@@ -1520,6 +1529,7 @@ export async function runFlow({
|
|
|
1520
1529
|
const result = await foldFromStep({
|
|
1521
1530
|
mcpServer: declaration.mcp?.server ?? null,
|
|
1522
1531
|
checkList: declaration.checkList,
|
|
1532
|
+
jobLines: read.lines,
|
|
1523
1533
|
i0: 0,
|
|
1524
1534
|
steps,
|
|
1525
1535
|
askLines,
|
|
@@ -1656,6 +1666,8 @@ async function runAskSlot({
|
|
|
1656
1666
|
rebuildPrior = /** @type {null | (() => ({ok:true,value:any}|{ok:false,red:string}))} */ (null),
|
|
1657
1667
|
// M16 item 5: the signed list, handed on to a redo's tries
|
|
1658
1668
|
checkList = /** @type {any[]|undefined} */ (undefined),
|
|
1669
|
+
// M19 am11 item 4: the signed job lines, handed on to a redo's tries with the list
|
|
1670
|
+
jobLines = /** @type {any[]|undefined} */ (undefined),
|
|
1659
1671
|
}) {
|
|
1660
1672
|
let redone = initialRedone;
|
|
1661
1673
|
let currentPrior = priorArtifact;
|
|
@@ -1832,7 +1844,7 @@ async function runAskSlot({
|
|
|
1832
1844
|
}
|
|
1833
1845
|
// eslint-disable-next-line no-await-in-loop
|
|
1834
1846
|
const redoResult = await runStepRalph({
|
|
1835
|
-
step: priorStep, primitivesMap: primitives, readsMap: priorReadsResult.map, businessDate, modelStep, spent, capUsd, ceilingUsd: effectiveCeilingUsd, recordAudit, mcpServer, checkList, initialGap: reason, attemptOffset: lastTryNumber(runDir, priorStep.emits ?? priorStep.goal ?? null), thinkingBox: readJobThinking(flowDir, runDir), learnHints: stepHintsReader({ flowName, source: inputsManifest?.[0]?.source ?? null, now }), now, runDir,
|
|
1847
|
+
step: priorStep, primitivesMap: primitives, readsMap: priorReadsResult.map, businessDate, modelStep, spent, capUsd, ceilingUsd: effectiveCeilingUsd, recordAudit, mcpServer, checkList, jobLines, initialGap: reason, attemptOffset: lastTryNumber(runDir, priorStep.emits ?? priorStep.goal ?? null), thinkingBox: readJobThinking(flowDir, runDir), learnHints: stepHintsReader({ flowName, source: inputsManifest?.[0]?.source ?? null, now }), now, runDir,
|
|
1836
1848
|
readStop: () => stopPending(runDir), stepNo: priorStepNo, prevStepId: priorPrevStepId,
|
|
1837
1849
|
});
|
|
1838
1850
|
if (!redoResult.ok) {
|
|
@@ -1901,12 +1913,14 @@ async function foldFromStep({
|
|
|
1901
1913
|
mcpServer = /** @type {string|null} */ (null),
|
|
1902
1914
|
// M16 item 5: the signed list (declaration.checkList): a list line's checks are tagged by their row in the Audit
|
|
1903
1915
|
checkList = /** @type {any[]|undefined} */ (undefined),
|
|
1916
|
+
// M15 am3: the signed job lines (their `~` rules are written in the report)
|
|
1917
|
+
jobLines = /** @type {any[]|undefined} */ (undefined),
|
|
1904
1918
|
}) {
|
|
1905
1919
|
let runAcceptedThisRun = acceptedThisRun;
|
|
1906
1920
|
let runUnjudged = unjudgedSinceLastAsk;
|
|
1907
1921
|
// M13 am9: the Ask that shows the whole job (-1 = none: a job signed before am8 is unchanged)
|
|
1908
1922
|
const wholeIdx = wholeJobAskIndex({ steps, askLines, sendLines });
|
|
1909
|
-
const rebuildWhole = () => wholeJobText({ steps, askLines, lastAskIndex: wholeIdx, readResult: (id) => readArtifactResult(runDir, id) });
|
|
1923
|
+
const rebuildWhole = () => wholeJobText({ steps, askLines, lastAskIndex: wholeIdx, readResult: (id) => readArtifactResult(runDir, id), context: reportContextOf({ runDir, steps, jobLines, checkList }) });
|
|
1910
1924
|
|
|
1911
1925
|
for (let i = i0; i < steps.length; i += 1) {
|
|
1912
1926
|
const step = steps[i];
|
|
@@ -1960,6 +1974,19 @@ async function foldFromStep({
|
|
|
1960
1974
|
});
|
|
1961
1975
|
}
|
|
1962
1976
|
let content = contentResult.value;
|
|
1977
|
+
// M15 am4: a job with no signed Ask shows and binds the WHOLE body (every work line, in line order) at the stop, so what is accepted is what is written. It is built before the stop, from the saved outputs.
|
|
1978
|
+
const noAsk = askLines.size === 0 && wholeIdx < 0;
|
|
1979
|
+
let noAskBody = /** @type {{ ok: true, body: string } | null} */ (null);
|
|
1980
|
+
if (noAsk) {
|
|
1981
|
+
const built = sendBodyOf({ content, wholeIdx, steps, sendIndex: i, askLines, context: reportContextOf({ runDir, steps, jobLines, checkList }), readResult: (id) => readArtifactResult(runDir, id) });
|
|
1982
|
+
if (!built.ok) {
|
|
1983
|
+
return haltRun({
|
|
1984
|
+
flowDir, runDir, runId, capUsd, startedAt: runStartedAt, now, nowMs, signatureHash, spent, priorSpendComplete: spendComplete.value, attempts: attemptsLog, artifacts, outcome: 'red', red: built.red,
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
noAskBody = built;
|
|
1988
|
+
content = { text: built.body };
|
|
1989
|
+
}
|
|
1963
1990
|
const decided = decideAction({ acceptedSha: lastAcceptedSha(steps, i, acceptedAskEmitsThisRun), outgoing: content });
|
|
1964
1991
|
let shaToSend = decided.outgoingSha;
|
|
1965
1992
|
if (!decided.go) {
|
|
@@ -1971,6 +1998,7 @@ async function foldFromStep({
|
|
|
1971
1998
|
const stop = await runAskSlot({
|
|
1972
1999
|
mcpServer,
|
|
1973
2000
|
checkList,
|
|
2001
|
+
jobLines,
|
|
1974
2002
|
step,
|
|
1975
2003
|
stepIndex: i,
|
|
1976
2004
|
askSlot: { question: decided.question, ttlMs: stopWaitMs(steps, i, askLines, sendSlot.waitMs), kind: ACTION_STOP_KIND },
|
|
@@ -2017,12 +2045,20 @@ async function foldFromStep({
|
|
|
2017
2045
|
shaToSend = typeof stop.acceptedSha256 === 'string' ? stop.acceptedSha256 : decided.outgoingSha;
|
|
2018
2046
|
}
|
|
2019
2047
|
}
|
|
2020
|
-
|
|
2048
|
+
// M15 am3 item 6: what is written is the accepted body (the whole-job text built at the last Ask) under the title and the Passed line the send adds; the hash check stays on `content`
|
|
2049
|
+
const sendBody = noAskBody ?? sendBodyOf({ content, wholeIdx, steps, sendIndex: i, askLines, context: reportContextOf({ runDir, steps, jobLines, checkList }) });
|
|
2050
|
+
if (!sendBody.ok) {
|
|
2051
|
+
return haltRun({
|
|
2052
|
+
flowDir, runDir, runId, capUsd, startedAt: runStartedAt, now, nowMs, signatureHash, spent, priorSpendComplete: spendComplete.value, attempts: attemptsLog, artifacts, outcome: 'red', red: sendBody.red,
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2021
2055
|
// eslint-disable-next-line no-await-in-loop
|
|
2022
|
-
const sendResult = await sendStep(target,
|
|
2056
|
+
const sendResult = await sendStep(target, flowName, content, shaToSend, { root: flowRoot, runDir, report: { runNo: runNumberOf(runId), now: new Date(), body: sendBody.body } });
|
|
2023
2057
|
const sendRow = makeAuditRow({
|
|
2024
2058
|
step, attempt: 1, verdict: sendResult.ok ? 'green' : 'red', gap: sendResult.ok ? null : sendResult.red, usd: 0, spendComplete: true, wallMs: 0, strike: false, at: now(),
|
|
2025
2059
|
...(sendResult.ok && typeof sendResult.sha256 === 'string' ? { sentSha256: sendResult.sha256 } : {}),
|
|
2060
|
+
...(sendResult.ok && typeof sendResult.name === 'string' ? { sentName: sendResult.name } : {}),
|
|
2061
|
+
...(sendResult.ok && typeof sendResult.taken === 'string' ? { sentTaken: sendResult.taken } : {}),
|
|
2026
2062
|
});
|
|
2027
2063
|
recordAudit(sendRow);
|
|
2028
2064
|
if (!sendResult.ok) {
|
|
@@ -2080,6 +2116,7 @@ async function foldFromStep({
|
|
|
2080
2116
|
const askResult = await runAskSlot({
|
|
2081
2117
|
mcpServer,
|
|
2082
2118
|
checkList,
|
|
2119
|
+
jobLines,
|
|
2083
2120
|
step,
|
|
2084
2121
|
stepIndex: i,
|
|
2085
2122
|
askSlot,
|
|
@@ -2153,7 +2190,7 @@ async function foldFromStep({
|
|
|
2153
2190
|
// redo's `initialGap` above.
|
|
2154
2191
|
// eslint-disable-next-line no-await-in-loop
|
|
2155
2192
|
const stepResult = await runStepRalph({
|
|
2156
|
-
step, primitivesMap: primitives, readsMap, businessDate, modelStep, spent, capUsd, ceilingUsd: effectiveCeilingUsd, recordAudit, mcpServer, checkList, initialGap: i === i0 ? firstStepGap : null, thinkingBox: readJobThinking(flowDir, runDir), learnHints: stepHintsReader({ flowName, source: inputsManifest?.[0]?.source ?? null, now }), now, runDir,
|
|
2193
|
+
step, primitivesMap: primitives, readsMap, businessDate, modelStep, spent, capUsd, ceilingUsd: effectiveCeilingUsd, recordAudit, mcpServer, checkList, jobLines, initialGap: i === i0 ? firstStepGap : null, thinkingBox: readJobThinking(flowDir, runDir), learnHints: stepHintsReader({ flowName, source: inputsManifest?.[0]?.source ?? null, now }), now, runDir,
|
|
2157
2194
|
readStop: () => stopPending(runDir), stepNo: i + 1, prevStepId: i > 0 ? (steps[i - 1].emits ?? steps[i - 1].goal ?? null) : null, attemptOffset: i === i0 ? resumeTries.numbered : 0, triesDone: i === i0 ? resumeTries.done : 0,
|
|
2158
2195
|
});
|
|
2159
2196
|
if (!stepResult.ok) {
|
|
@@ -2756,7 +2793,19 @@ export async function resumeRun({
|
|
|
2756
2793
|
let priorArtifact = readArtifact(runDir, priorId);
|
|
2757
2794
|
// M13 am9: the Ask that shows the whole job rebuilds `{text}` from the saved outputs, as the first pass did
|
|
2758
2795
|
const wholeIdx = wholeJobAskIndex({ steps, askLines, sendLines });
|
|
2759
|
-
|
|
2796
|
+
if (isStop && askLines.size === 0 && wholeIdx < 0) {
|
|
2797
|
+
// M15 am4: the stop of a job with no Ask shows the whole body, rebuilt as the first pass built it (the answer's hash is of this text)
|
|
2798
|
+
const built = sendBodyOf({ content: priorArtifact, wholeIdx, steps, sendIndex: state.stepIndex, askLines, context: reportContextOf({ runDir, steps, jobLines: read.lines, checkList: declaration.checkList }), readResult: (id) => readArtifactResult(runDir, id) });
|
|
2799
|
+
if (!built.ok) {
|
|
2800
|
+
return haltRun({
|
|
2801
|
+
flowDir, runDir, runId, capUsd, startedAt: runStartedAt, now, nowMs: getNowMs, signatureHash: state.signatureHash, spent, priorSpendComplete: spendComplete.value, attempts: attemptsLog, artifacts,
|
|
2802
|
+
outcome: 'red', red: built.red,
|
|
2803
|
+
resumeAt: { stepIndex: state.stepIndex, flowRoot: root, flowName: name, inputsManifest: state.inputsManifest, unjudged: state.evidenceUnjudged ?? [], redone: typeof state.redone === 'number' ? state.redone : 0 },
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
priorArtifact = { text: built.body };
|
|
2807
|
+
}
|
|
2808
|
+
const rebuildWhole = () => wholeJobText({ steps, askLines, lastAskIndex: wholeIdx, readResult: (id) => readArtifactResult(runDir, id), context: reportContextOf({ runDir, steps, jobLines: read.lines, checkList: declaration.checkList }) });
|
|
2760
2809
|
if (state.stepIndex === wholeIdx) {
|
|
2761
2810
|
const whole = rebuildWhole();
|
|
2762
2811
|
if (!whole.ok) {
|
|
@@ -2774,6 +2823,7 @@ export async function resumeRun({
|
|
|
2774
2823
|
const askResult = await runAskSlot({
|
|
2775
2824
|
mcpServer: declaration.mcp?.server ?? null,
|
|
2776
2825
|
checkList: declaration.checkList,
|
|
2826
|
+
jobLines: read.lines,
|
|
2777
2827
|
step,
|
|
2778
2828
|
stepIndex: state.stepIndex,
|
|
2779
2829
|
askSlot,
|
|
@@ -2833,6 +2883,7 @@ export async function resumeRun({
|
|
|
2833
2883
|
const result = await foldFromStep({
|
|
2834
2884
|
mcpServer: declaration.mcp?.server ?? null,
|
|
2835
2885
|
checkList: declaration.checkList,
|
|
2886
|
+
jobLines: read.lines,
|
|
2836
2887
|
i0: isStop ? state.stepIndex : state.stepIndex + 1,
|
|
2837
2888
|
...(isStop ? { stopAcceptedSha: typeof askResult.acceptedSha256 === 'string' ? askResult.acceptedSha256 : null } : {}),
|
|
2838
2889
|
steps,
|
|
@@ -3043,6 +3094,7 @@ export async function continueRun({
|
|
|
3043
3094
|
const result = await foldFromStep({
|
|
3044
3095
|
mcpServer: declaration.mcp?.server ?? null,
|
|
3045
3096
|
checkList: declaration.checkList,
|
|
3097
|
+
jobLines: read.lines,
|
|
3046
3098
|
i0: halt.stepIndex,
|
|
3047
3099
|
resumeTries,
|
|
3048
3100
|
steps,
|
package/src/send.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// M2 piece 2 (docs/wiki/the-module-ladder.md, "M2 — scope, exit, negative —
|
|
2
|
-
// SIGNED"): the live `sendStep(target,
|
|
2
|
+
// SIGNED"): the live `sendStep(target, jobName, content, sha, ctx)` `src/runner.js`'s
|
|
3
3
|
// `runFlow` expects. `checkSendDestination` — the containment check
|
|
4
4
|
// (lexical AND realpath, write-time re-check) — is owned by `src/runner.js`
|
|
5
5
|
// (piece 1 already wrote it); this module imports it rather than growing a
|
|
@@ -12,95 +12,31 @@
|
|
|
12
12
|
// bytes reds here, not upstream).
|
|
13
13
|
|
|
14
14
|
import { createHash } from 'node:crypto';
|
|
15
|
-
import {
|
|
15
|
+
import { readFileSync } from 'node:fs';
|
|
16
16
|
import { join } from 'node:path';
|
|
17
17
|
import { createShellTools } from 'bare-agent/tools';
|
|
18
18
|
|
|
19
19
|
import { checkSendDestination } from './runner.js';
|
|
20
20
|
import { serializeArtifact, sha256Hex } from './ask.js';
|
|
21
|
+
import { nextFreeName, reportFileText, MAX_SAME_DAY } from './report.js';
|
|
21
22
|
|
|
22
23
|
const { tools: SHELL_TOOLS } = createShellTools();
|
|
23
24
|
const FOUND_WRITE_TOOL = SHELL_TOOLS.find((t) => t.name === 'shell_write');
|
|
24
25
|
if (!FOUND_WRITE_TOOL) throw new Error('send: bare-agent/tools does not export a "shell_write" tool');
|
|
25
26
|
const WRITE_TOOL = FOUND_WRITE_TOOL;
|
|
26
27
|
|
|
27
|
-
const SCALAR = ['string', 'number', 'boolean'];
|
|
28
|
-
|
|
29
|
-
/** one value as leaf lines `{parts, text}`: parts are the names on the way in; text is a string as it is, a number or boolean written out; a list of plain values joined by ", "; null as empty */
|
|
30
|
-
/** @param {string[]} parts @param {any} v @returns {{parts: string[], text: string}[]} */
|
|
31
|
-
function leaves(parts, v) {
|
|
32
|
-
if (v === null || v === undefined) return [{ parts, text: '' }];
|
|
33
|
-
if (SCALAR.includes(typeof v)) return [{ parts, text: `${v}` }];
|
|
34
|
-
if (Array.isArray(v) && v.every((x) => x === null || SCALAR.includes(typeof x))) return [{ parts, text: v.join(', ') }];
|
|
35
|
-
if (Array.isArray(v)) return v.flatMap((x, i) => leaves([...parts, `${i + 1}`], x));
|
|
36
|
-
return Object.entries(v).flatMap(([k, x]) => leaves([...parts, k], x));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @param {string} name split only at a lowercase-to-capital boundary, `_` and `-`, so `ID` stays one word */
|
|
40
|
-
const words = (name) => name.replace(/([a-z0-9])([A-Z])/g, '$1 $2').split(/[_\-\s]+/).filter(Boolean);
|
|
41
|
-
|
|
42
|
-
/** M15 am2 (1): the names as plain words; a last name of `value` or `rows` is left out; the first letter capital, the later words lowercase */
|
|
43
|
-
/** @param {string[]} parts */
|
|
44
|
-
function friendlyName(parts) {
|
|
45
|
-
const p = parts.length > 1 && (parts[parts.length - 1] === 'value' || parts[parts.length - 1] === 'rows') ? parts.slice(0, -1) : parts;
|
|
46
|
-
const w = p.flatMap(words).map((x) => x.toLowerCase());
|
|
47
|
-
if (!w.length) return parts.join('.');
|
|
48
|
-
return w[0][0].toUpperCase() + w[0].slice(1) + (w.length > 1 ? ` ${w.slice(1).join(' ')}` : '');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** the lines of one block (the flat part, or one result); two lines with the same words both keep today's `a.b` form */
|
|
52
|
-
/** @param {{parts: string[], text: string}[]} ls */
|
|
53
|
-
function blockLines(ls) {
|
|
54
|
-
const f = ls.map((l) => friendlyName(l.parts));
|
|
55
|
-
/** @type {Record<string, number>} */
|
|
56
|
-
const n = {};
|
|
57
|
-
for (const x of f) n[x] = (n[x] || 0) + 1;
|
|
58
|
-
return ls.map((l, i) => `${n[f[i]] > 1 ? l.parts.join('.') : f[i]}: ${l.text}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** a list of results: every item an object holding a `values` object (flights' `results`, with a `quote` written as its last line) */
|
|
62
|
-
/** @param {any} v */
|
|
63
|
-
const isResultList = (v) => Array.isArray(v) && v.length > 0 && v.every((r) => r && typeof r === 'object' && !Array.isArray(r) && r.values && typeof r.values === 'object' && !Array.isArray(r.values));
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* M15 items 3 and am1, am2: the accepted answer as the plain-text file the send writes. `{text}` alone is the text exactly; any other flat object is one
|
|
67
|
-
* `Name words: value` line per field; a list of results is one `## Result k` block per result with one line per value, in the order the answer holds
|
|
68
|
-
* them, then `from the page: "<quote>"`. Never JSON braces, never check marks. What it throws away: a result's keys other than `quote` and `values`.
|
|
69
|
-
* @param {Record<string, any>} content @returns {string}
|
|
70
|
-
*/
|
|
71
|
-
export function renderSentMd(content) {
|
|
72
|
-
const keys = Object.keys(content);
|
|
73
|
-
if (keys.length === 1 && keys[0] === 'text' && typeof content.text === 'string') return content.text;
|
|
74
|
-
/** @type {string[]} */
|
|
75
|
-
const parts = [];
|
|
76
|
-
/** @type {{parts: string[], text: string}[]} */
|
|
77
|
-
let flat = [];
|
|
78
|
-
const flush = () => { if (flat.length) parts.push(blockLines(flat).join('\n')); flat = []; };
|
|
79
|
-
for (const [k, v] of Object.entries(content)) {
|
|
80
|
-
if (isResultList(v)) {
|
|
81
|
-
flush();
|
|
82
|
-
v.forEach((r, i) => {
|
|
83
|
-
const lines = blockLines(Object.entries(r.values).flatMap(([n, x]) => leaves([n], x)));
|
|
84
|
-
if (typeof r.quote === 'string') lines.push(`from the page: "${r.quote}"`);
|
|
85
|
-
parts.push([`## Result ${i + 1}`, ...lines].join('\n'));
|
|
86
|
-
});
|
|
87
|
-
} else flat.push(...leaves([k], v));
|
|
88
|
-
}
|
|
89
|
-
flush();
|
|
90
|
-
return parts.join('\n\n');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
28
|
/**
|
|
29
|
+
* M15 am3: the send writes ONE markdown report per run, `<job name>-YYYY-MM-DD.md` (then `-2`, `-3`, ... when that name is taken, never over a taken file): the title, the `Passed` line and the accepted
|
|
94
30
|
* @param {string} target - a signed arbiter target, e.g. `file:poc/m0/out`.
|
|
95
|
-
* @param {string}
|
|
96
|
-
* @param {unknown} content - the accepted artifact; hash-checked as its JSON
|
|
31
|
+
* @param {string} jobName - the job's name: the file's name starts with it
|
|
32
|
+
* @param {unknown} content - the accepted artifact; hash-checked as its JSON (M4b item 4).
|
|
97
33
|
* @param {string|null} [acceptedSha256] - the sha256 the human's accept recorded
|
|
98
34
|
* (`answerAsk`, M4b piece 3). Required: none recorded (an answer written by an
|
|
99
35
|
* older version, or no accept in this process) refuses by name.
|
|
100
|
-
* @param {{root?: string, runDir?: string}} [ctx] the flow root and this run's folder, for the destination refusals
|
|
101
|
-
* @returns {Promise<{ok:true, path:string, bytes:number, sha256:string} | {ok:false, red:string}>}
|
|
36
|
+
* @param {{root?: string, runDir?: string, report?: {runNo: number|null, now?: Date, body: string}}} [ctx] the flow root and this run's folder, for the destination refusals; the report's body, run number and day
|
|
37
|
+
* @returns {Promise<{ok:true, path:string, name:string, bytes:number, sha256:string, taken:string|null} | {ok:false, red:string}>}
|
|
102
38
|
*/
|
|
103
|
-
export async function sendViaPrimitive(target,
|
|
39
|
+
export async function sendViaPrimitive(target, jobName, content, acceptedSha256, ctx = {}) {
|
|
104
40
|
const destination = checkSendDestination(target, ctx);
|
|
105
41
|
if (!destination.ok) return { ok: false, red: destination.red };
|
|
106
42
|
|
|
@@ -137,18 +73,19 @@ export async function sendViaPrimitive(target, filename, content, acceptedSha256
|
|
|
137
73
|
return { ok: false, red: `send: the artifact changed after it was accepted (accepted sha256 ${acceptedSha256}, about to send ${actualSha256}) — refused (nothing shipped)` };
|
|
138
74
|
}
|
|
139
75
|
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
// present)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
76
|
+
const report = ctx.report;
|
|
77
|
+
if (!report || typeof report.body !== 'string') return { ok: false, red: 'send: no report body was given for this send — refused (nothing shipped)' };
|
|
78
|
+
// M15 am3 item 1 (replaces M4e amendment 1's refusal for this file): a taken name is never written over; the report lands under the next free same-day name. `shell_write` has no exclusive-create
|
|
79
|
+
// mode, so this is an existence check immediately before the write (a dangling symlink at the name counts as present); a file created in the instants between the check and the write is still overwritten.
|
|
80
|
+
const now = report.now ?? new Date();
|
|
81
|
+
const pick = nextFreeName(destination.dir, jobName, now);
|
|
82
|
+
if (pick.name === null) return { ok: false, red: `send: every same-day name for "${jobName}" is taken (up to -${MAX_SAME_DAY}) — never overwritten (nothing shipped)` };
|
|
83
|
+
const path = join(destination.dir, pick.name);
|
|
84
|
+
await WRITE_TOOL.execute({ path, content: reportFileText(jobName, report.runNo, now, report.body) });
|
|
148
85
|
|
|
149
86
|
const bytes = readFileSync(path);
|
|
150
87
|
if (bytes.byteLength === 0) {
|
|
151
88
|
return { ok: false, red: `send: "${path}" wrote 0 bytes` };
|
|
152
89
|
}
|
|
153
|
-
return { ok: true, path, bytes: bytes.byteLength, sha256: createHash('sha256').update(bytes).digest('hex') };
|
|
90
|
+
return { ok: true, path, name: pick.name, bytes: bytes.byteLength, sha256: createHash('sha256').update(bytes).digest('hex'), taken: pick.taken };
|
|
154
91
|
}
|