blun-king-cli 9.1.599 → 9.1.600

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 (106) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +13 -3
  3. package/agent-spine-plugin/CHANGELOG.md +1 -1
  4. package/agent-spine-plugin/docs/host-integration.md +1 -15
  5. package/agent-spine-plugin/docs/preflight-recall.md +1 -1
  6. package/agent-spine-plugin/scripts/check-install.js +1 -6
  7. package/agent-spine-plugin/scripts/hermetic-process.js +8 -0
  8. package/agent-spine-plugin/scripts/release-check.js +2 -3
  9. package/agent-spine-plugin/scripts/run-tests-hermetic.js +8 -11
  10. package/agent-spine-plugin/src/hook.js +40 -40
  11. package/agent-spine-plugin/src/lib/briefing.js +6 -3
  12. package/agent-spine-plugin/src/lib/hook-context.js +63 -64
  13. package/agent-spine-plugin/src/lib/hook-output.js +115 -94
  14. package/agent-spine-plugin/src/lib/hook-timeline.js +20 -11
  15. package/agent-spine-plugin/src/lib/host-instruction-budget.js +8 -14
  16. package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +0 -7
  17. package/agent-spine-plugin/src/lib/pre-answer-timeline-recall.js +104 -0
  18. package/agent-spine-plugin/src/lib/session-timeline-codex.js +0 -4
  19. package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +0 -3
  20. package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +0 -4
  21. package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +0 -2
  22. package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +0 -22
  23. package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +0 -4
  24. package/agent-spine-plugin/src/lib/session-timeline-prior.js +42 -50
  25. package/agent-spine-plugin/src/lib/session-timeline-provider.js +0 -3
  26. package/agent-spine-plugin/src/lib/session-timeline-query.js +0 -1
  27. package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +0 -4
  28. package/agent-spine-plugin/src/lib/session-timeline-source.js +0 -3
  29. package/agent-spine-plugin/src/lib/session-timeline-transport.js +0 -8
  30. package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +0 -3
  31. package/agent-spine-plugin/src/lib/session-timeline.js +370 -408
  32. package/agent-spine-plugin/src/lib/source-roots.js +26 -16
  33. package/agent-spine-plugin/src/lib/timeline-user-feedback.js +0 -1
  34. package/bin/core-bootstrap.js +18 -10
  35. package/bin/launcher-mode.js +5 -0
  36. package/bin/launcher-runtime.js +27 -0
  37. package/bin/verify-bundled-agent-sources.cjs +28 -2
  38. package/blun.mjs +127 -29
  39. package/bundled-agent-sources.json +192 -155
  40. package/package.json +1 -1
  41. package/standard-skills/translate-native/README.md +1334 -1
  42. package/standard-skills/translate-native/SKILL.md +1 -1
  43. package/standard-skills/translate-native/VERSION +1 -1
  44. package/standard-skills/translate-native/docs/PREMORTEM.md +901 -0
  45. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION.md +208 -41
  46. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_API.md +1319 -77
  47. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_EVIDENCE_HTTP.md +66 -11
  48. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_HTTP_PROVIDER.md +19 -1
  49. package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_RECEIPT_VERIFIER_HTTP.md +24 -6
  50. package/standard-skills/translate-native/integrations/commercial_localization_profile.py +23 -0
  51. package/standard-skills/translate-native/integrations/website_localization.py +234 -10
  52. package/standard-skills/translate-native/integrations/website_localization_benchmark.py +39 -3
  53. package/standard-skills/translate-native/integrations/website_localization_cms.py +512 -10
  54. package/standard-skills/translate-native/integrations/website_localization_cms_client.py +116 -0
  55. package/standard-skills/translate-native/integrations/website_localization_cms_receiver.py +101 -11
  56. package/standard-skills/translate-native/integrations/website_localization_cms_receiver_runtime.py +12 -1
  57. package/standard-skills/translate-native/integrations/website_localization_cms_receiver_store.py +186 -24
  58. package/standard-skills/translate-native/integrations/website_localization_cms_source_client.py +64 -1
  59. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery.py +528 -5
  60. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_auth.py +918 -0
  61. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_auth_runtime.py +609 -0
  62. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_client.py +885 -0
  63. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_http.py +1244 -0
  64. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_runtime.py +220 -0
  65. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_sidecar_adapter.py +331 -0
  66. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_capabilities_http.py +444 -0
  67. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_client.py +673 -0
  68. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch.py +1317 -0
  69. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_client.py +826 -0
  70. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_http.py +1152 -0
  71. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_openapi.py +896 -0
  72. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_dispatch_runtime.py +621 -0
  73. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_http.py +1180 -0
  74. package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_submission_runtime.py +1479 -0
  75. package/standard-skills/translate-native/integrations/website_localization_cms_source_http.py +133 -17
  76. package/standard-skills/translate-native/integrations/website_localization_cms_source_runtime.py +319 -4
  77. package/standard-skills/translate-native/integrations/website_localization_cms_source_service.py +72 -2
  78. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_http.py +13 -0
  79. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver.py +56 -13
  80. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver_openapi.py +335 -0
  81. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver_runtime.py +66 -1
  82. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_processing_monitor.py +73 -7
  83. package/standard-skills/translate-native/integrations/website_localization_cms_terminal_receiver_client.py +93 -9
  84. package/standard-skills/translate-native/integrations/website_localization_evidence_http.py +221 -11
  85. package/standard-skills/translate-native/integrations/website_localization_health.py +6 -0
  86. package/standard-skills/translate-native/integrations/website_localization_http_provider.py +1 -1
  87. package/standard-skills/translate-native/integrations/website_localization_quality_profiles.py +350 -0
  88. package/standard-skills/translate-native/integrations/website_localization_queue.py +126 -56
  89. package/standard-skills/translate-native/integrations/website_localization_receipt_verifier_http.py +166 -13
  90. package/standard-skills/translate-native/integrations/website_localization_release.py +423 -17
  91. package/standard-skills/translate-native/integrations/website_localization_release_coordinator.py +168 -13
  92. package/standard-skills/translate-native/integrations/website_localization_runner.py +10 -0
  93. package/standard-skills/translate-native/integrations/website_localization_worker.py +213 -9
  94. package/standard-skills/translate-native/provenance.json +2 -2
  95. package/standard-skills/translate-native/references/commercial-localization.md +96 -17
  96. package/standard-skills/translate-native/scripts/blun_language_guard.py +3 -1
  97. package/standard-skills/translate-native/scripts/check_commercial_review.py +69 -9
  98. package/standard-skills/translate-native/scripts/commercial_localization_profile.py +829 -31
  99. package/standard-tools/language-guard/VERSION +1 -1
  100. package/standard-tools/language-guard/blun_language_guard.py +3 -1
  101. package/standard-tools/language-guard/check_commercial_review.py +69 -9
  102. package/standard-tools/language-guard/commercial_localization_profile.py +829 -31
  103. package/standard-tools/language-guard/provenance.json +2 -2
  104. package/standard-tools/manifest.json +1 -1
  105. package/worker-host.mjs +115 -22
  106. package/agent-spine-plugin/scripts/check-install-king.js +0 -37
package/blun.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // BLUN_BUILD_INPUT_SHA256:25c271186c418490335e30ef395705d13d90d816c66cac47bb57835f2482f093
2
+ // BLUN_BUILD_INPUT_SHA256:c0b3db57102f82b976cc669375212221a4788318dbd6d1bfc28e943f7bf649db
3
3
  import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
4
4
  import { dirname as __cjsShimDirname } from 'node:path';
5
5
  const __filename = __cjsShimFileURLToPath(import.meta.url);
@@ -230341,7 +230341,7 @@ var init_full = __esmMin((() => {
230341
230341
  this.agent.log.error("failed to refresh system prompt after compaction", { error });
230342
230342
  }
230343
230343
  await this.agent.injection.injectAfterCompaction();
230344
- this.fitRetainedInput();
230344
+ this.fitRetainedInput({}, result.keptHeadUserMessageCount !== void 0);
230345
230345
  this.lastCompactedState = {
230346
230346
  tokenCount: this.tokenCountWithPending,
230347
230347
  modelAlias: this.agent.activeResponderModel ?? this.agent.config.modelAlias,
@@ -230377,17 +230377,18 @@ var init_full = __esmMin((() => {
230377
230377
  this.agent.turn.onCompactionFinished();
230378
230378
  }
230379
230379
  }
230380
- fitRetainedInput(context = {}) {
230380
+ fitRetainedInput(context = {}, freshBudgetedSelection = false) {
230381
230381
  const budget = this.getCompactionBudgetTokens();
230382
230382
  const window = this.getEffectiveMaxContextTokens();
230383
230383
  const limit = window > 0 ? window - 1 : Infinity;
230384
+ const hardContextLimit = window > 0 && !freshBudgetedSelection ? window : void 0;
230384
230385
  const estimate = (messages) => this.estimateProjectedRequestTokens({
230385
230386
  ...context,
230386
230387
  messages
230387
230388
  });
230388
230389
  const preserveLatestUser = this.agent.turn.hasActiveTurn;
230389
- if (budget === void 0) return this.agent.context.fitCompactionPrefix(limit, estimate, preserveLatestUser);
230390
- return this.agent.context.fitCompactionPrefix(Math.min(Math.floor(budget * .8), limit), estimate, preserveLatestUser) || this.agent.context.fitCompactionPrefix(Math.min(Math.floor(budget * .9) - 1, limit), estimate, preserveLatestUser);
230390
+ if (budget === void 0) return this.agent.context.fitCompactionPrefix(limit, estimate, preserveLatestUser, hardContextLimit);
230391
+ return this.agent.context.fitCompactionPrefix(Math.min(Math.floor(budget * .8), limit), estimate, preserveLatestUser, hardContextLimit) || this.agent.context.fitCompactionPrefix(Math.min(Math.floor(budget * .9) - 1, limit), estimate, preserveLatestUser, hardContextLimit);
230391
230392
  }
230392
230393
  buildInstruction(customInstruction) {
230393
230394
  return renderPrompt(compaction_instruction_default, { customInstruction: customInstruction?.trim() ?? "" }).trimEnd();
@@ -234338,7 +234339,7 @@ var init_context$2 = __esmMin((() => {
234338
234339
  this.agent.microCompaction.reset();
234339
234340
  this.agent.emitStatusUpdated();
234340
234341
  }
234341
- fitCompactionPrefix(maxRequestTokens, estimateRequest, preserveLatestUser = false) {
234342
+ fitCompactionPrefix(maxRequestTokens, estimateRequest, preserveLatestUser = false, hardContextLimit) {
234342
234343
  const prefixLength = this._history.findIndex((message) => message.origin?.kind === "compaction_summary");
234343
234344
  if (prefixLength <= 0 || !Number.isSafeInteger(maxRequestTokens) || maxRequestTokens <= 0) return false;
234344
234345
  const suffix = this._history.slice(prefixLength);
@@ -234350,7 +234351,9 @@ var init_context$2 = __esmMin((() => {
234350
234351
  ];
234351
234352
  return Math.max(estimateTokensForMessages(messages), estimateRequest(project(messages, { dropOrphanResults: true })));
234352
234353
  };
234353
- if (estimate(this._history.slice(0, prefixLength)) <= maxRequestTokens) return false;
234354
+ const requestTokens = estimate(this._history.slice(0, prefixLength));
234355
+ if (requestTokens <= maxRequestTokens) return false;
234356
+ if (hardContextLimit !== void 0 && requestTokens >= hardContextLimit) return false;
234354
234357
  const sourceKey = Symbol("compaction source");
234355
234358
  const sources = collectCompactableUserMessages(this._history.slice(0, prefixLength)).map((message) => ({
234356
234359
  ...message,
@@ -265018,6 +265021,71 @@ var init_response_review_decision = __esmMin((() => {
265018
265021
  ]);
265019
265022
  }));
265020
265023
  //#endregion
265024
+ //#region ../../packages/agent-core/src/agent/response-review-deadline.ts
265025
+ function createResponseReviewDeadline(source) {
265026
+ const absoluteExpiresAt = performance.now() + ABSOLUTE_TIMEOUT_MS;
265027
+ const absolute = createDeadlineAbortSignal(source, ABSOLUTE_TIMEOUT_MS);
265028
+ const controller = new AbortController();
265029
+ const unlink = linkAbortSignal(absolute.signal, controller);
265030
+ let stage = "setup";
265031
+ let didTimeout = false;
265032
+ let closed = false;
265033
+ let idle;
265034
+ let idleExpiresAt = 0;
265035
+ const expire = () => {
265036
+ didTimeout = true;
265037
+ controller.abort(abortError$1());
265038
+ };
265039
+ const expireIfDue = () => {
265040
+ if (closed || controller.signal.aborted) return;
265041
+ const now = performance.now();
265042
+ if (now >= absoluteExpiresAt || now >= idleExpiresAt) expire();
265043
+ };
265044
+ const refresh = (timeoutMs) => {
265045
+ idleExpiresAt = performance.now() + timeoutMs;
265046
+ if (idle !== void 0) clearTimeout(idle);
265047
+ idle = setTimeout(expire, timeoutMs);
265048
+ };
265049
+ refresh(IDLE_TIMEOUT_MS);
265050
+ return {
265051
+ signal: controller.signal,
265052
+ timedOut: () => didTimeout || absolute.timedOut(),
265053
+ throwIfAborted: () => {
265054
+ expireIfDue();
265055
+ controller.signal.throwIfAborted();
265056
+ },
265057
+ progress: (event) => {
265058
+ expireIfDue();
265059
+ if (closed || controller.signal.aborted) return;
265060
+ if (event === "native.start" && stage === "setup") {
265061
+ stage = "native";
265062
+ refresh(NATIVE_FIRST_CONTENT_MS);
265063
+ } else if (event === "native.text" && stage === "native") refresh(IDLE_TIMEOUT_MS);
265064
+ else if (event === "release.start" && stage === "native") {
265065
+ stage = "release";
265066
+ refresh(IDLE_TIMEOUT_MS);
265067
+ } else if (event === "verification.start" && stage === "release") {
265068
+ stage = "verification";
265069
+ refresh(IDLE_TIMEOUT_MS);
265070
+ }
265071
+ },
265072
+ clear: () => {
265073
+ closed = true;
265074
+ if (idle !== void 0) clearTimeout(idle);
265075
+ idle = void 0;
265076
+ unlink();
265077
+ absolute.clear();
265078
+ }
265079
+ };
265080
+ }
265081
+ var IDLE_TIMEOUT_MS, NATIVE_FIRST_CONTENT_MS, ABSOLUTE_TIMEOUT_MS;
265082
+ var init_response_review_deadline = __esmMin((() => {
265083
+ init_abort();
265084
+ IDLE_TIMEOUT_MS = 3e4;
265085
+ NATIVE_FIRST_CONTENT_MS = 9e4;
265086
+ ABSOLUTE_TIMEOUT_MS = 12e4;
265087
+ }));
265088
+ //#endregion
265021
265089
  //#region ../../packages/agent-core/src/agent/response-review.ts
265022
265090
  function createReviewedOutputDispatcher(options) {
265023
265091
  let pending = [];
@@ -265103,6 +265171,7 @@ function createReviewedOutputDispatcher(options) {
265103
265171
  if (pending.length === 0) return options.dispatch(event);
265104
265172
  if (event.uuid !== stepUuid) throw new Error("Response review step mismatch");
265105
265173
  const currentEpoch = epoch;
265174
+ const isCurrentCandidate = () => epoch === currentEpoch;
265106
265175
  const parts = [...pending];
265107
265176
  reviewing = true;
265108
265177
  const text = parts.map((part) => part.part.type === "text" ? part.part.text : "").join("");
@@ -265116,8 +265185,9 @@ function createReviewedOutputDispatcher(options) {
265116
265185
  for (let attempt = 1; attempt <= MAX_REVIEW_ATTEMPTS; attempt += 1) {
265117
265186
  options.signal.throwIfAborted();
265118
265187
  if (epoch !== currentEpoch) throw new Error("Response review candidate changed during verification");
265119
- const deadline = createDeadlineAbortSignal(options.signal, REVIEW_TIMEOUT_MS);
265188
+ const deadline = createResponseReviewDeadline(options.signal);
265120
265189
  let requested;
265190
+ const pendingOperations = [];
265121
265191
  let attemptRejection;
265122
265192
  let attemptNativeRejection = false;
265123
265193
  try {
@@ -265126,6 +265196,12 @@ function createReviewedOutputDispatcher(options) {
265126
265196
  turnId: event.turnId,
265127
265197
  step: event.step,
265128
265198
  signal: deadline.signal,
265199
+ onProgress: (progress) => {
265200
+ if (isCurrentCandidate()) deadline.progress(progress);
265201
+ },
265202
+ onPendingOperation: (operation) => {
265203
+ pendingOperations.push(operation.then(() => void 0, () => void 0));
265204
+ },
265129
265205
  onRejected: (decision) => {
265130
265206
  if (!deadline.signal.aborted) {
265131
265207
  const message = rejectionMessage(decision);
@@ -265135,13 +265211,14 @@ function createReviewedOutputDispatcher(options) {
265135
265211
  }
265136
265212
  });
265137
265213
  approval = await abortable(requested, deadline.signal);
265214
+ deadline.throwIfAborted();
265138
265215
  rejection = attemptRejection;
265139
265216
  nativeRejection = attemptNativeRejection;
265140
265217
  break;
265141
265218
  } catch {
265142
265219
  options.signal.throwIfAborted();
265143
265220
  if (attemptRejection !== void 0) throw new Error(attemptRejection);
265144
- if (deadline.timedOut() && attempt < MAX_REVIEW_ATTEMPTS && requested !== void 0 && epoch === currentEpoch && await waitForCancelledReview(requested)) continue;
265221
+ if (deadline.timedOut() && attempt < MAX_REVIEW_ATTEMPTS && requested !== void 0 && epoch === currentEpoch && await waitForCancelledReview(requested, pendingOperations)) continue;
265145
265222
  throw new Error(deadline.timedOut() ? "Response review timed out" : "Response review failed");
265146
265223
  } finally {
265147
265224
  deadline.clear();
@@ -265178,10 +265255,16 @@ function createReviewedOutputDispatcher(options) {
265178
265255
  if (epoch === currentEpoch) clear();
265179
265256
  }
265180
265257
  }
265181
- async function waitForCancelledReview(requested) {
265258
+ async function waitForCancelledReview(requested, pendingOperations) {
265182
265259
  const deadline = createDeadlineAbortSignal(options.signal, REVIEW_CANCEL_SETTLE_MS);
265183
265260
  try {
265184
265261
  await abortable(requested.then(() => void 0, () => void 0), deadline.signal);
265262
+ let observed = 0;
265263
+ while (observed < pendingOperations.length) {
265264
+ const batch = pendingOperations.slice(observed);
265265
+ observed = pendingOperations.length;
265266
+ await abortable(Promise.all(batch), deadline.signal);
265267
+ }
265185
265268
  options.signal.throwIfAborted();
265186
265269
  return true;
265187
265270
  } catch {
@@ -265193,13 +265276,13 @@ function createReviewedOutputDispatcher(options) {
265193
265276
  }
265194
265277
  return dispatch;
265195
265278
  }
265196
- var MAX_CANDIDATE_BYTES, MAX_CANDIDATE_PARTS, REVIEW_TIMEOUT_MS, REVIEW_CANCEL_SETTLE_MS, MAX_REVIEW_ATTEMPTS;
265279
+ var MAX_CANDIDATE_BYTES, MAX_CANDIDATE_PARTS, REVIEW_CANCEL_SETTLE_MS, MAX_REVIEW_ATTEMPTS;
265197
265280
  var init_response_review = __esmMin((() => {
265198
265281
  init_abort();
265199
265282
  init_response_review_decision();
265283
+ init_response_review_deadline();
265200
265284
  MAX_CANDIDATE_BYTES = 1048576;
265201
265285
  MAX_CANDIDATE_PARTS = 4096;
265202
- REVIEW_TIMEOUT_MS = 3e4;
265203
265286
  REVIEW_CANCEL_SETTLE_MS = 1e3;
265204
265287
  MAX_REVIEW_ATTEMPTS = 2;
265205
265288
  }));
@@ -269318,12 +269401,14 @@ function readPayload(result, includeError = false) {
269318
269401
  /** Receipts never enter ordinary tool execution, hooks, replay or model history. */
269319
269402
  function createGuardResponseReviewer(host) {
269320
269403
  const { language, guardVersion } = host;
269321
- return async ({ text, turnId, step, signal, onRejected }) => {
269404
+ return async ({ text, turnId, step, signal, onRejected, onPendingOperation, onProgress }) => {
269322
269405
  const input = {
269323
269406
  text,
269324
269407
  turnId,
269325
269408
  step,
269326
- signal
269409
+ signal,
269410
+ onPendingOperation,
269411
+ onProgress
269327
269412
  };
269328
269413
  const targetSha256 = digest(text);
269329
269414
  let stage = "setup";
@@ -269350,6 +269435,10 @@ function createGuardResponseReviewer(host) {
269350
269435
  const blocked = (reason, findings) => {
269351
269436
  record(signal.aborted ? "cancelled" : reason, findings);
269352
269437
  };
269438
+ const track = (operation) => {
269439
+ onPendingOperation?.(operation.then(() => void 0, () => void 0));
269440
+ return operation;
269441
+ };
269353
269442
  try {
269354
269443
  if (!/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(language) || /^(auto|all)$/i.test(language) || guardVersion.trim().length === 0) return blocked("invalid_settings");
269355
269444
  const resolve = () => {
@@ -269362,13 +269451,14 @@ function createGuardResponseReviewer(host) {
269362
269451
  const current = () => !signal.aborted && resolve()?.client === connection.client;
269363
269452
  if (!current()) return blocked("connection_changed");
269364
269453
  stage = "native";
269365
- const native = await abortable(host.reviewNative({ ...input }), signal);
269454
+ onProgress?.("native.start");
269455
+ const native = await abortable(track(host.reviewNative({ ...input })), signal);
269366
269456
  if (!current()) return blocked("connection_changed");
269367
269457
  if (native === void 0) return blocked("native_unavailable");
269368
269458
  if (!passed(native.nativeness) || !passed(native.orthography)) return blocked("native_rejected");
269369
269459
  const authorized = async (name) => {
269370
269460
  if (!current()) return false;
269371
- return passed(await abortable(host.authorize({
269461
+ return passed(await abortable(track(host.authorize({
269372
269462
  toolName: qualifyMcpToolName(SERVER_NAME, name),
269373
269463
  targetSha256,
269374
269464
  language,
@@ -269377,11 +269467,12 @@ function createGuardResponseReviewer(host) {
269377
269467
  turnId,
269378
269468
  step,
269379
269469
  signal
269380
- }), signal)) && current();
269470
+ })), signal)) && current();
269381
269471
  };
269382
269472
  stage = "release";
269473
+ onProgress?.("release.start");
269383
269474
  if (!await authorized("release_response")) return blocked("release_denied");
269384
- const releaseResult = await abortable(connection.client.callTool("release_response", {
269475
+ const releaseResult = await abortable(track(connection.client.callTool("release_response", {
269385
269476
  target_text: text,
269386
269477
  language,
269387
269478
  content_type: "prose",
@@ -269390,7 +269481,7 @@ function createGuardResponseReviewer(host) {
269390
269481
  nativeness: true,
269391
269482
  orthography: true
269392
269483
  }
269393
- }, signal), signal);
269484
+ }, signal)), signal);
269394
269485
  if (!current()) return blocked("connection_changed");
269395
269486
  if (releaseResult.isError) return blocked("release_rejected", rejectionFindings(readPayload(releaseResult, true)));
269396
269487
  const released = readPayload(releaseResult);
@@ -269398,8 +269489,9 @@ function createGuardResponseReviewer(host) {
269398
269489
  if (!current()) return blocked("connection_changed");
269399
269490
  if (status !== "PASS" || release_allowed !== true || blocking === true || typeof release_token !== "string" || release_token.length === 0 || release_token.length > 65536) return blocked("release_rejected", rejectionFindings(released));
269400
269491
  stage = "verification";
269492
+ onProgress?.("verification.start");
269401
269493
  if (!await authorized("verify_release_token")) return blocked("verification_denied");
269402
- const { status: verificationStatus, valid, checks, payload } = readPayload(await abortable(connection.client.callTool("verify_release_token", {
269494
+ const { status: verificationStatus, valid, checks, payload } = readPayload(await abortable(track(connection.client.callTool("verify_release_token", {
269403
269495
  release_token,
269404
269496
  source_text: "",
269405
269497
  target_text: text,
@@ -269407,7 +269499,7 @@ function createGuardResponseReviewer(host) {
269407
269499
  purpose: "response",
269408
269500
  content_type: "prose",
269409
269501
  short_text_reviewed: false
269410
- }, signal), signal)) ?? {};
269502
+ }, signal)), signal)) ?? {};
269411
269503
  if (!current()) return blocked("connection_changed");
269412
269504
  if (verificationStatus !== "PASS" || valid !== true || !isPlainRecord(checks) || !CHECK_NAMES.every((name) => checks[name] === true) || !isPlainRecord(payload)) return blocked("verification_rejected");
269413
269505
  const { v, source_sha256, target_sha256, language: verifiedLanguage, purpose, content_type, short_text_reviewed, exp, iat } = payload;
@@ -269497,6 +269589,9 @@ async function reviewNativeResponse(agent, language, input) {
269497
269589
  };
269498
269590
  const options = {
269499
269591
  signal,
269592
+ onExecution: (completion) => {
269593
+ input.onPendingOperation?.(completion.then(() => void 0, () => void 0));
269594
+ },
269500
269595
  requestLogFields: {
269501
269596
  turnStep: `review:${input.turnId}.${String(input.step)}`,
269502
269597
  attempt: `${attempt}/2`
@@ -269505,13 +269600,16 @@ async function reviewNativeResponse(agent, language, input) {
269505
269600
  const prompt = attempt === 1 ? NATIVE_REVIEW_PROMPT : `${NATIVE_REVIEW_PROMPT}\nThe previous review did not satisfy the required JSON format. Return exactly one object with the two required boolean keys nativeness and orthography, no wrapper or additional keys. Use true or false, not strings or null. Set a check to false if it fails or you are uncertain.`;
269506
269601
  try {
269507
269602
  signal.throwIfAborted();
269508
- const response = await abortable(agent.generate(provider, prompt, [], [createUserMessage(candidateMessage)], { onMessagePart: (part) => {
269603
+ const requested = agent.generate(provider, prompt, [], [createUserMessage(candidateMessage)], { onMessagePart: (part) => {
269509
269604
  if (part.type === "text") receivedBytes += Buffer.byteLength(part.text);
269510
269605
  if (receivedBytes > MAX_REVIEW_RESULT_BYTES) {
269511
269606
  outputLimitExceeded = true;
269512
269607
  throw new Error("Native review output exceeds limit");
269513
269608
  }
269514
- } }, options), signal);
269609
+ if (!signal.aborted && part.type === "text" && part.text.trim().length > 0) input.onProgress?.("native.text");
269610
+ } }, options);
269611
+ input.onPendingOperation?.(requested.then(() => void 0, () => void 0));
269612
+ const response = await abortable(requested, signal);
269515
269613
  if (response.usage !== null) agent.usage.record(modelAlias, response.usage, "turn");
269516
269614
  signal.throwIfAborted();
269517
269615
  if (response.message.toolCalls.length > 0) return invalid("tool_calls");
@@ -393762,7 +393860,7 @@ var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393762
393860
  };
393763
393861
  }));
393764
393862
  //#endregion
393765
- //#region ../../../../node_modules/node-gyp-build/node-gyp-build.js
393863
+ //#region ../../node_modules/node-gyp-build/node-gyp-build.js
393766
393864
  var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393767
393865
  var fs$4 = __require("fs");
393768
393866
  var path$6 = __require("path");
@@ -393918,14 +394016,14 @@ var require_node_gyp_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module)
393918
394016
  load.compareTuples = compareTuples;
393919
394017
  }));
393920
394018
  //#endregion
393921
- //#region ../../../../node_modules/node-gyp-build/index.js
394019
+ //#region ../../node_modules/node-gyp-build/index.js
393922
394020
  var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393923
394021
  const runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
393924
394022
  if (typeof runtimeRequire.addon === "function") module.exports = runtimeRequire.addon.bind(runtimeRequire);
393925
394023
  else module.exports = require_node_gyp_build$1();
393926
394024
  }));
393927
394025
  //#endregion
393928
- //#region ../../../../node_modules/bufferutil/fallback.js
394026
+ //#region ../../node_modules/bufferutil/fallback.js
393929
394027
  var require_fallback$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393930
394028
  /**
393931
394029
  * Masks a buffer using the given mask.
@@ -393957,7 +394055,7 @@ var require_fallback$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393957
394055
  };
393958
394056
  }));
393959
394057
  //#endregion
393960
- //#region ../../../../node_modules/bufferutil/index.js
394058
+ //#region ../../node_modules/bufferutil/index.js
393961
394059
  var require_bufferutil = /* @__PURE__ */ __commonJSMin(((exports, module) => {
393962
394060
  try {
393963
394061
  module.exports = require_node_gyp_build()(__dirname);
@@ -394450,7 +394548,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
394450
394548
  }
394451
394549
  }));
394452
394550
  //#endregion
394453
- //#region ../../../../node_modules/utf-8-validate/fallback.js
394551
+ //#region ../../node_modules/utf-8-validate/fallback.js
394454
394552
  var require_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
394455
394553
  /**
394456
394554
  * Checks if a given buffer contains only correct UTF-8.
@@ -394480,7 +394578,7 @@ var require_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
394480
394578
  module.exports = isValidUTF8;
394481
394579
  }));
394482
394580
  //#endregion
394483
- //#region ../../../../node_modules/utf-8-validate/index.js
394581
+ //#region ../../node_modules/utf-8-validate/index.js
394484
394582
  var require_utf_8_validate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
394485
394583
  try {
394486
394584
  module.exports = require_node_gyp_build()(__dirname);