@molecule/api-ai-tools 1.16.5 → 1.16.6
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 +6 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-05T22:20:21.693Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-ai-tools
|
|
@@ -5655,6 +5655,11 @@ Peer dependencies:
|
|
|
5655
5655
|
- `@molecule/api-ai`
|
|
5656
5656
|
|
|
5657
5657
|
- **`yieldOnFirstFailureFor`** can yield one still-running deployed task's concrete diagnostic; callers opt out after a prior wait result or unknown history.
|
|
5658
|
+
- **`wait_for_task` state probes report current progress without guessing log growth.**
|
|
5659
|
+
A call shorter than one normal two-second poll omits both growth and no-growth
|
|
5660
|
+
claims; task age, log counters and time-left estimates remain available.
|
|
5661
|
+
Full waits still report whether the log grew. Hosts that cap a wait should
|
|
5662
|
+
allow its final result read to finish before replacing it with a state probe.
|
|
5658
5663
|
- **This package only defines the tools — it runs no model loop.** Hand them to
|
|
5659
5664
|
the bonded AI provider (`chat({ tools, … })`) or to an
|
|
5660
5665
|
`@molecule/api-ai-agents` run.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
15
|
* - **`yieldOnFirstFailureFor`** can yield one still-running deployed task's concrete diagnostic; callers opt out after a prior wait result or unknown history.
|
|
16
|
+
* - **`wait_for_task` state probes report current progress without guessing log growth.**
|
|
17
|
+
* A call shorter than one normal two-second poll omits both growth and no-growth
|
|
18
|
+
* claims; task age, log counters and time-left estimates remain available.
|
|
19
|
+
* Full waits still report whether the log grew. Hosts that cap a wait should
|
|
20
|
+
* allow its final result read to finish before replacing it with a state probe.
|
|
16
21
|
* - **This package only defines the tools — it runs no model loop.** Hand them to
|
|
17
22
|
* the bonded AI provider (`chat({ tools, … })`) or to an
|
|
18
23
|
* `@molecule/api-ai-agents` run.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6IG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
15
|
* - **`yieldOnFirstFailureFor`** can yield one still-running deployed task's concrete diagnostic; callers opt out after a prior wait result or unknown history.
|
|
16
|
+
* - **`wait_for_task` state probes report current progress without guessing log growth.**
|
|
17
|
+
* A call shorter than one normal two-second poll omits both growth and no-growth
|
|
18
|
+
* claims; task age, log counters and time-left estimates remain available.
|
|
19
|
+
* Full waits still report whether the log grew. Hosts that cap a wait should
|
|
20
|
+
* allow its final result read to finish before replacing it with a state probe.
|
|
16
21
|
* - **This package only defines the tools — it runs no model loop.** Hand them to
|
|
17
22
|
* the bonded AI provider (`chat({ tools, … })`) or to an
|
|
18
23
|
* `@molecule/api-ai-agents` run.
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AA2B9C,OAAO,EAIL,KAAK,mBAAmB,EAEzB,MAAM,wBAAwB,CAAA;AAsC/B;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,KAAK,CAAC,EACnD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAmB9B;AAuLD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,M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AAqB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAoBpF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GACxE,qBAAqB,CAkBvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiCxB;AA2GD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CA0pGxF"}
|
package/dist/tools.js
CHANGED
|
@@ -273,6 +273,8 @@ export async function taskStopCommand(backend, taskId) {
|
|
|
273
273
|
* ended in 20).
|
|
274
274
|
*/
|
|
275
275
|
const TASK_END_LOOK_MS = 3_000;
|
|
276
|
+
/** A normal task poll; shorter state probes cannot establish log growth during their wait. */
|
|
277
|
+
const TASK_POLL_MS = 2_000;
|
|
276
278
|
/** How much of a task's own output the end test reads — a runner's tally is its last lines. */
|
|
277
279
|
const TASK_OUTPUT_END_BYTES = 4_000;
|
|
278
280
|
/**
|
|
@@ -530,8 +532,11 @@ function secondSuiteWalk(slice) {
|
|
|
530
532
|
* @param o - The wait's facts: `taskId`, the `slice` of the log it read,
|
|
531
533
|
* `stillWriting` (the log grew during this wait), `bytes` (the log's size, null
|
|
532
534
|
* when unreadable), `ceilingMs` (this call's ceiling, for "one more wait"), and
|
|
533
|
-
* `waitedMs` (
|
|
534
|
-
*
|
|
535
|
+
* `waitedMs` (the elapsed floor when the id carries no start stamp), and
|
|
536
|
+
* `observationMs` (this call's own polling interval, excluding earlier waits).
|
|
537
|
+
* Growth clauses require at least one normal poll: a near-zero state probe
|
|
538
|
+
* observes the log's contents, not whether it grew during the preceding wait.
|
|
539
|
+
* Task age, progress counters and rate estimates remain valid for those probes.
|
|
535
540
|
* @returns The clauses in reading order. The first states the elapsed time, so a
|
|
536
541
|
* sentence built from them always says something.
|
|
537
542
|
*/
|
|
@@ -549,10 +554,12 @@ function waitProgressClauses(o) {
|
|
|
549
554
|
// A log that already finished one walk and started another says so instead of "slow, not
|
|
550
555
|
// stuck": the growth is the SECOND walk printing, and its counter is not this run's progress.
|
|
551
556
|
const secondWalk = secondSuiteWalk(o.slice);
|
|
552
|
-
if (o.
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
557
|
+
if (o.observationMs >= TASK_POLL_MS && !secondWalk) {
|
|
558
|
+
if (o.stillWriting)
|
|
559
|
+
clauses.push(`its output is still growing (${o.bytes} bytes) — slow, not stuck`);
|
|
560
|
+
else if (o.bytes !== null)
|
|
561
|
+
clauses.push(`its log has not grown during this wait (${o.bytes} bytes)`);
|
|
562
|
+
}
|
|
556
563
|
if (secondWalk)
|
|
557
564
|
clauses.push(`the first walk in this command has finished (${secondWalk.tally}); the command started a ` +
|
|
558
565
|
'SECOND walk of the same suite — stop it (it measures nothing new) and read the first tally');
|
|
@@ -680,6 +687,7 @@ async function backgroundTaskState(backend, command, seconds, ceilingMs) {
|
|
|
680
687
|
bytes: null,
|
|
681
688
|
ceilingMs,
|
|
682
689
|
waitedMs: 0,
|
|
690
|
+
observationMs: 0,
|
|
683
691
|
});
|
|
684
692
|
const failures = slice.trim() ? '; the failures already in its log are in outputSoFar' : '';
|
|
685
693
|
return {
|
|
@@ -3602,7 +3610,7 @@ export function buildTools(backend, config) {
|
|
|
3602
3610
|
let endedWithoutCode = false;
|
|
3603
3611
|
let exitCode = await readExit();
|
|
3604
3612
|
while (exitCode === null && Date.now() - startedAt < budgetMs) {
|
|
3605
|
-
await new Promise((r) => setTimeout(r, Math.min(
|
|
3613
|
+
await new Promise((r) => setTimeout(r, Math.min(TASK_POLL_MS, budgetMs - (Date.now() - startedAt))));
|
|
3606
3614
|
exitCode = await readExit();
|
|
3607
3615
|
// The exit file is read first, so a run that finishes between two looks still returns
|
|
3608
3616
|
// its real result instead of a note about it.
|
|
@@ -3794,6 +3802,7 @@ export function buildTools(backend, config) {
|
|
|
3794
3802
|
bytes: grownTo,
|
|
3795
3803
|
ceilingMs: ceiling,
|
|
3796
3804
|
waitedMs: waitedBefore + waitedMs,
|
|
3805
|
+
observationMs: Math.min(budgetMs, waitedMs),
|
|
3797
3806
|
}));
|
|
3798
3807
|
const sliceField = soFar.trim() ? { outputSoFar: sanitizeOutput(soFar) } : {};
|
|
3799
3808
|
// What this wait found mid-run, when it was not a reason to end early: it rides the result
|