@gitroll/tacitt-cli 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{agent-setup-Cb_spmGb.mjs → agent-setup-Bpsi-BCv.mjs} +2 -2
  2. package/dist/agent-setup-worker.mjs +5 -5
  3. package/dist/cli.mjs +36 -10
  4. package/dist/codex-title-worker.mjs +1 -1
  5. package/dist/configured-preview-worker.mjs +5 -5
  6. package/dist/configured-session-worker.mjs +5 -5
  7. package/dist/{frame-waS5FnN5.mjs → frame-IeDOLy1o.mjs} +1 -1
  8. package/dist/{heap-eZTo0VYj.mjs → heap-DiOlSa8T.mjs} +6 -6
  9. package/dist/inspection-worker.mjs +4 -4
  10. package/dist/{job-Bi57uRU-.mjs → job-BII94L2c.mjs} +3 -3
  11. package/dist/{locate-U3-nkird.mjs → locate-CBiw-CJK.mjs} +5 -0
  12. package/dist/{model-BDrntocp.mjs → model-DGTsARtV.mjs} +1 -1
  13. package/dist/operation-executor.mjs +3 -3
  14. package/dist/preview-worker.mjs +1 -1
  15. package/dist/privacy-validator.mjs +1 -1
  16. package/dist/{query-7uY266qY.mjs → query-CVqWNFYf.mjs} +822 -244
  17. package/dist/{run-CV6Io7CS.mjs → run-BGlf-W0M.mjs} +4 -4
  18. package/dist/{src-BESjwh7X.mjs → src-37kIclGK.mjs} +5 -4
  19. package/dist/{src-DSDRF7i6.mjs → src-CBTvOa44.mjs} +45 -2
  20. package/dist/{src-DIuh0LHk.mjs → src-D4nrfC2S.mjs} +165 -5
  21. package/dist/store-database-worker.mjs +1 -1
  22. package/dist/web/assets/index-D3g_ATU-.js +69 -0
  23. package/dist/web/index.html +1 -1
  24. package/package.json +1 -1
  25. package/skills/tacitt/SKILL.md +2 -2
  26. package/skills/tacitt/references/INDEX.md +10 -10
  27. package/skills/tacitt/references/journey.md +3 -3
  28. package/skills/tacitt/references/send.md +38 -12
  29. package/skills/tacitt/scripts/INDEX.md +36 -36
  30. package/skills/tacitt/scripts/journey-card-consolidation.mjs +2 -4
  31. package/skills/tacitt/scripts/journey-state.d.mts +30 -0
  32. package/skills/tacitt/scripts/journey-state.mjs +56 -3
  33. package/skills/tacitt/scripts/journey-tasks.d.mts +8 -0
  34. package/skills/tacitt/scripts/journey-tasks.mjs +4 -1
  35. package/skills/tacitt/scripts/privacy-validator.mjs +2 -0
  36. package/skills/tacitt/scripts/review.mjs +36 -5
  37. package/dist/web/assets/index-Dh4iG6x2.js +0 -69
@@ -1,4 +1,11 @@
1
- import { cardBatchOpen, phaseOf, uncoveredPending } from './journey-state.mjs'
1
+ import {
2
+ cardBatch,
3
+ cardBatchDue,
4
+ cardBatchDueAt,
5
+ nextCardsWait,
6
+ phaseOf,
7
+ uncoveredPending,
8
+ } from './journey-state.mjs'
2
9
  import { startReviewStream } from './review-stream-client.mjs'
3
10
  import { createHash, randomUUID } from 'node:crypto'
4
11
  import {
@@ -1071,17 +1078,22 @@ async function outstandingPacks(ctx) {
1071
1078
  */
1072
1079
  async function autoRefill(ctx, options) {
1073
1080
  const until = Math.min(Date.now() + Number(options['wait-ms'] ?? 0), ctx.readDeadline)
1081
+ // ADR 0234: a card batch can come due on time alone; neither gathering slots nor waiting for a
1082
+ // child holds it back past that time.
1083
+ await progressOf(ctx)
1084
+ const wake = () => Math.min(until, ctx.cardsDueAt ?? until)
1074
1085
  // A slow pass can outlast the wait while a child publishes; ingest that answer once more
1075
1086
  // rather than returning idle and leaving its slot unused until the next call.
1076
1087
  let lastPass = false
1077
1088
  for (;;) {
1078
- if (!lastPass) await gatherSlots(ctx, until)
1089
+ if (!lastPass) await gatherSlots(ctx, wake())
1079
1090
  const result = await ingestAndRefill(ctx, options)
1080
1091
  const idle =
1081
1092
  !result.ingested.length &&
1082
1093
  !result.packs.length &&
1083
1094
  !result.paused &&
1084
1095
  !result.continue &&
1096
+ !result.cardBatch.ready &&
1085
1097
  (result.next === 'wait-for-children' || result.next.startsWith('next-packs'))
1086
1098
  if (!idle || lastPass) return result
1087
1099
  if (Date.now() >= until) {
@@ -1089,7 +1101,7 @@ async function autoRefill(ctx, options) {
1089
1101
  lastPass = true
1090
1102
  continue
1091
1103
  }
1092
- const recheck = Math.min(until, Date.now() + AUTO_RECHECK_MS)
1104
+ const recheck = Math.min(wake(), Date.now() + AUTO_RECHECK_MS)
1093
1105
  while (Date.now() < recheck && !(await answerPublished(ctx)))
1094
1106
  await new Promise((done) =>
1095
1107
  setTimeout(done, Math.max(1, Math.min(LOCK_POLL_MS, recheck - Date.now()))),
@@ -1411,11 +1423,30 @@ export function questionsReady(view) {
1411
1423
  async function progressOf(ctx) {
1412
1424
  const view = await call(ctx, 'journey.get', { journeyId: ctx.journeyId })
1413
1425
  const uncovered = uncoveredPending(view).length
1426
+ const { directory, open } = await cardBatch(ctx.run)
1427
+ const now = Date.now()
1428
+ // ADR 0234: the wait clock restarts after every batch, even one no call saw open.
1429
+ const wait = nextCardsWait(ctx.state.cardsWait, { uncovered, open, batch: directory, now })
1430
+ const previous = ctx.state.cardsWait
1431
+ if (wait.since !== previous?.since || wait.batch !== previous?.batch) {
1432
+ ctx.state.cardsWait = wait
1433
+ await saveState(ctx)
1434
+ }
1435
+ const input = {
1436
+ uncovered,
1437
+ open,
1438
+ readingComplete: view.readingComplete,
1439
+ cards: view.privacy.cards.length,
1440
+ waitingSince: wait.since,
1441
+ now,
1442
+ }
1443
+ const ready = cardBatchDue(input)
1444
+ // `--agents auto` ends its wait when the clock alone makes the batch due.
1445
+ ctx.cardsDueAt = cardBatchDueAt(input)
1414
1446
  return {
1415
1447
  readingComplete: view.readingComplete,
1416
1448
  questionsReady: questionsReady(view),
1417
- // E3: a card is raised as soon as a value needs one, unless a batch is still being drafted.
1418
- cardBatch: { uncovered, ready: uncovered > 0 && !(await cardBatchOpen(ctx.run)) },
1449
+ cardBatch: { uncovered, ready },
1419
1450
  works: workProgress(view),
1420
1451
  blockedWorks: blockedWorks(view),
1421
1452
  }