agentfootprint 9.113.0 → 9.114.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/CLAUDE.md +1 -1
  3. package/dist/core/agent/coverage/read.js +3 -1
  4. package/dist/core/agent/coverage/read.js.map +1 -1
  5. package/dist/core/agent/findings/unsettled.js +11 -4
  6. package/dist/core/agent/findings/unsettled.js.map +1 -1
  7. package/dist/core/agent/stages/route.js +93 -55
  8. package/dist/core/agent/stages/route.js.map +1 -1
  9. package/dist/core/agent/stages/toolCalls.js +118 -37
  10. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  11. package/dist/core/agent/toolDispatch.js +4 -1
  12. package/dist/core/agent/toolDispatch.js.map +1 -1
  13. package/dist/core/inputRequest.js +32 -2
  14. package/dist/core/inputRequest.js.map +1 -1
  15. package/dist/core/pause.js +13 -1
  16. package/dist/core/pause.js.map +1 -1
  17. package/dist/esm/core/agent/coverage/read.d.ts +3 -1
  18. package/dist/esm/core/agent/coverage/read.js +3 -1
  19. package/dist/esm/core/agent/coverage/read.js.map +1 -1
  20. package/dist/esm/core/agent/findings/unsettled.d.ts +11 -4
  21. package/dist/esm/core/agent/findings/unsettled.js +11 -4
  22. package/dist/esm/core/agent/findings/unsettled.js.map +1 -1
  23. package/dist/esm/core/agent/stages/route.d.ts +6 -4
  24. package/dist/esm/core/agent/stages/route.js +93 -55
  25. package/dist/esm/core/agent/stages/route.js.map +1 -1
  26. package/dist/esm/core/agent/stages/toolCalls.js +118 -37
  27. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  28. package/dist/esm/core/agent/toolDispatch.d.ts +4 -1
  29. package/dist/esm/core/agent/toolDispatch.js +4 -1
  30. package/dist/esm/core/agent/toolDispatch.js.map +1 -1
  31. package/dist/esm/core/inputRequest.d.ts +20 -1
  32. package/dist/esm/core/inputRequest.js +32 -2
  33. package/dist/esm/core/inputRequest.js.map +1 -1
  34. package/dist/esm/core/pause.d.ts +13 -1
  35. package/dist/esm/core/pause.js +13 -1
  36. package/dist/esm/core/pause.js.map +1 -1
  37. package/dist/types/core/agent/coverage/read.d.ts +3 -1
  38. package/dist/types/core/agent/coverage/read.d.ts.map +1 -1
  39. package/dist/types/core/agent/findings/unsettled.d.ts +11 -4
  40. package/dist/types/core/agent/findings/unsettled.d.ts.map +1 -1
  41. package/dist/types/core/agent/stages/route.d.ts +6 -4
  42. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  43. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  44. package/dist/types/core/agent/toolDispatch.d.ts +4 -1
  45. package/dist/types/core/agent/toolDispatch.d.ts.map +1 -1
  46. package/dist/types/core/inputRequest.d.ts +20 -1
  47. package/dist/types/core/inputRequest.d.ts.map +1 -1
  48. package/dist/types/core/pause.d.ts +13 -1
  49. package/dist/types/core/pause.d.ts.map +1 -1
  50. package/package.json +1 -1
@@ -959,6 +959,45 @@ function buildToolCallsHandler(deps) {
959
959
  ledger?.note('empty-lookup', 'write', disposition, disposition === 'checked-fail' ? Date.now() : undefined);
960
960
  (0, integrityFindings_js_1.fileIntegrityFindings)(scope, findings, call.iteration);
961
961
  };
962
+ /**
963
+ * A lookup that pauses still declares what it looked at (9.114.0) — the
964
+ * RAISE-SITE reader of `InputRequestDeclaration.absence`.
965
+ *
966
+ * A tool that found nothing and raised `requestInput` about the miss used
967
+ * to leave no record of it: `declareCoverage` reads a RETURNED value, and
968
+ * the pause branch returns the checkpoint before any of its call sites.
969
+ * The app could not file it either — the declaration's `context` rides to
970
+ * the model on resume, never to the record. So the raise site files it,
971
+ * through the same two readers a returned absence meets: `declareCoverage`
972
+ * (the one recognizer, `tools.absent`, the `coverageDeclared` row — the
973
+ * bytes a returned `absent(…)` files) and the empty-lookup write seam, with
974
+ * the envelope as the tool's own answer — it ran, nothing errored, nothing
975
+ * denied it, and no ceiling judged a result the model was never served.
976
+ *
977
+ * The delivered status `declareCoverage` returns is dropped on purpose: a
978
+ * paused call is not settled, so there is no `tool_end` for it to ride.
979
+ * Nothing on resume reads the field (the served result there is the
980
+ * person's `InputResponseResult`), so the rows are filed once, here.
981
+ *
982
+ * CONTAINED the way the returned path contains it. The recognizer reads an
983
+ * envelope minted elsewhere without repairing it, so its lists can be
984
+ * something `declareCoverage` cannot copy (`checked: [null]`,
985
+ * `not_checked: 5`). Returned, that throw lands in the dispatch `try` and
986
+ * errors the call; here it would land in the `catch` and fail the run. So
987
+ * the copy is caught here instead, and the error text comes back: the
988
+ * caller errors the call with it and does not pause. That is what the same
989
+ * value returned would do. `undefined` means filed.
990
+ */
991
+ const declareRaisedAbsence = (scope, call, args, absence, history) => {
992
+ try {
993
+ declareCoverage(scope, call, absence);
994
+ }
995
+ catch (err) {
996
+ return err instanceof Error ? err.message : String(err);
997
+ }
998
+ noticeEmptyLookup(scope, call, args, absence, history, true);
999
+ return undefined;
1000
+ };
962
1001
  /**
963
1002
  * The semantic envelope (9.53.0) — recognized at the SAME execute
964
1003
  * boundaries as coverage and the ceiling (one implementation, every door),
@@ -3290,6 +3329,9 @@ function buildToolCallsHandler(deps) {
3290
3329
  await endCall(tc.id);
3291
3330
  }
3292
3331
  catch (err) {
3332
+ // Set when a raise declared a miss the door could not file:
3333
+ // the call then errors with this text and does not pause.
3334
+ let raisedMissError;
3293
3335
  if ((0, pause_js_1.isPauseRequest)(err)) {
3294
3336
  // The typed half of the question (9.24.0): a tool that raised
3295
3337
  // `askHuman({ question, component })` nominated a screen
@@ -3307,51 +3349,90 @@ function buildToolCallsHandler(deps) {
3307
3349
  await assertComponentDeliverable(scope, tc.name, rawComponent, `askHuman in tool '${tc.name}'`);
3308
3350
  }
3309
3351
  }
3310
- // A pause has NOT settled this call — it is waiting for a
3311
- // person, and the resources it opened are what the resume
3312
- // needs. No `'call'` teardown here, deliberately.
3313
- //
3314
- // Commit partial state so resume() can find history intact.
3315
- scope.history = newHistory;
3316
- scope.pausedToolCallId = tc.id;
3317
- scope.pausedToolName = tc.name;
3318
- scope.pausedToolStartMs = startMs;
3319
- // The args the tool WAS RUNNING WITH (post-transform), for the
3320
- // after-tool moment on the far side of the pause (8.13.0) —
3321
- // the same reason the three sibling pauses carry theirs.
3322
- scope.pausedToolArgs = callArgs;
3323
3352
  const declaration = typeof err.data === 'object' && err.data !== null
3324
3353
  ? err.data.inputRequest
3325
3354
  : undefined;
3326
- const awaitingInput = declaration === undefined
3327
- ? undefined
3328
- : (0, inputRequest_js_1.stampInputRequest)((0, inputRequest_js_1.validateInputDeclaration)(declaration), `${deps.currentRun?.().runId ?? scope.turnStartMs}:${tc.id}`, {
3329
- originalRequest: scope.userMessage,
3330
- toolCallId: tc.id,
3331
- ...(scope.currentSkillId !== undefined && {
3332
- skillId: scope.currentSkillId,
3333
- }),
3334
- ...(scope.turnRoute?.offered !== undefined && {
3335
- offeredSkillIds: [...scope.turnRoute.offered],
3336
- }),
3337
- });
3338
- // Returning a defined value triggers footprintjs pause —
3339
- // the returned object becomes the checkpoint's pauseData.
3340
- return {
3341
- toolCallId: tc.id,
3342
- toolName: tc.name,
3343
- ...(awaitingInput !== undefined
3344
- ? { question: awaitingInput.question, awaitingInput }
3345
- : typeof err.data === 'object' && err.data !== null
3346
- ? err.data
3347
- : { data: err.data }),
3355
+ // A lookup that pauses still declares what it looked at
3356
+ // (9.114.0): the miss it is asking about is filed HERE, the
3357
+ // raise site, FIRST — the one moment the declaration's
3358
+ // `absence` is read. So a declaration that CARRIES one is
3359
+ // judged before anything is written for the pause, and a miss
3360
+ // the door cannot file errors the call below, as the same value
3361
+ // returned would, with nothing written for a pause. A MALFORMED
3362
+ // declaration still leaves the committed record it always left,
3363
+ // whether or not it carried `absence`: its error leaves the
3364
+ // stage only after the pause writes are made, so a hand-raised
3365
+ // request (a `pauseHere`/`askHuman` that never went through
3366
+ // `requestInput`) fails with the in-flight batch on the record.
3367
+ // `null` is the field omitted (`inputRequest.ts` ·
3368
+ // `validateInputDeclaration`).
3369
+ //
3370
+ // The pause writes: partial state, so resume() can find the
3371
+ // history intact.
3372
+ const writePause = () => {
3373
+ scope.history = newHistory;
3374
+ scope.pausedToolCallId = tc.id;
3375
+ scope.pausedToolName = tc.name;
3376
+ scope.pausedToolStartMs = startMs;
3377
+ // The args the tool WAS RUNNING WITH (post-transform), for
3378
+ // the after-tool moment on the far side of the pause
3379
+ // (8.13.0) — the same reason the three sibling pauses carry
3380
+ // theirs.
3381
+ scope.pausedToolArgs = callArgs;
3348
3382
  };
3383
+ const carriesAbsence = typeof declaration === 'object' &&
3384
+ declaration !== null &&
3385
+ declaration.absence != null;
3386
+ let declared;
3387
+ if (carriesAbsence) {
3388
+ try {
3389
+ declared = (0, inputRequest_js_1.validateInputDeclaration)(declaration);
3390
+ }
3391
+ catch (invalid) {
3392
+ writePause();
3393
+ throw invalid;
3394
+ }
3395
+ }
3396
+ raisedMissError =
3397
+ declared?.absence === undefined
3398
+ ? undefined
3399
+ : declareRaisedAbsence(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, callArgs, declared.absence, newHistory);
3400
+ if (raisedMissError === undefined) {
3401
+ // A pause has NOT settled this call — it is waiting for a
3402
+ // person, and the resources it opened are what the resume
3403
+ // needs. No `'call'` teardown here, deliberately.
3404
+ writePause();
3405
+ const awaitingInput = declaration === undefined
3406
+ ? undefined
3407
+ : (0, inputRequest_js_1.stampInputRequest)(declared ?? (0, inputRequest_js_1.validateInputDeclaration)(declaration), `${deps.currentRun?.().runId ?? scope.turnStartMs}:${tc.id}`, {
3408
+ originalRequest: scope.userMessage,
3409
+ toolCallId: tc.id,
3410
+ ...(scope.currentSkillId !== undefined && {
3411
+ skillId: scope.currentSkillId,
3412
+ }),
3413
+ ...(scope.turnRoute?.offered !== undefined && {
3414
+ offeredSkillIds: [...scope.turnRoute.offered],
3415
+ }),
3416
+ });
3417
+ // Returning a defined value triggers footprintjs pause —
3418
+ // the returned object becomes the checkpoint's pauseData.
3419
+ return {
3420
+ toolCallId: tc.id,
3421
+ toolName: tc.name,
3422
+ ...(awaitingInput !== undefined
3423
+ ? { question: awaitingInput.question, awaitingInput }
3424
+ : typeof err.data === 'object' && err.data !== null
3425
+ ? err.data
3426
+ : { data: err.data }),
3427
+ };
3428
+ }
3349
3429
  }
3350
3430
  // A tool that threw still RAN, and may have opened the thing it
3351
- // was about to close.
3431
+ // was about to close. A raise whose miss could not be filed is
3432
+ // settled here too — the returned path's error, not a pause.
3352
3433
  await endCall(tc.id);
3353
3434
  error = true;
3354
- result = err instanceof Error ? err.message : String(err);
3435
+ result = raisedMissError ?? (err instanceof Error ? err.message : String(err));
3355
3436
  }
3356
3437
  }
3357
3438
  }