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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "translate-native",
3
- "version": "6.64.0",
4
- "sourceCommit": "d5d350ba61a5ea7fa4efb2244abcfc191452a33f",
3
+ "version": "6.155.0",
4
+ "sourceCommit": "21efc66da8f77992c8c63ac0f145a106c31e7eb2",
5
5
  "sourceRepository": "https://github.com/Maykbiletti/translate-native"
6
6
  }
@@ -24,7 +24,7 @@
24
24
  "blun-language-guard": {
25
25
  "owner": "user-mcp",
26
26
  "version": "host-provisioned",
27
- "skillVersion": "6.64.0",
27
+ "skillVersion": "6.155.0",
28
28
  "detectTokens": [
29
29
  "blun-language-guard",
30
30
  "blun_language_guard.py"
package/worker-host.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);
@@ -229582,7 +229582,7 @@ var FullCompaction = class {
229582
229582
  this.agent.log.error("failed to refresh system prompt after compaction", { error });
229583
229583
  }
229584
229584
  await this.agent.injection.injectAfterCompaction();
229585
- this.fitRetainedInput();
229585
+ this.fitRetainedInput({}, result.keptHeadUserMessageCount !== void 0);
229586
229586
  this.lastCompactedState = {
229587
229587
  tokenCount: this.tokenCountWithPending,
229588
229588
  modelAlias: this.agent.activeResponderModel ?? this.agent.config.modelAlias,
@@ -229618,17 +229618,18 @@ var FullCompaction = class {
229618
229618
  this.agent.turn.onCompactionFinished();
229619
229619
  }
229620
229620
  }
229621
- fitRetainedInput(context = {}) {
229621
+ fitRetainedInput(context = {}, freshBudgetedSelection = false) {
229622
229622
  const budget = this.getCompactionBudgetTokens();
229623
229623
  const window = this.getEffectiveMaxContextTokens();
229624
229624
  const limit = window > 0 ? window - 1 : Infinity;
229625
+ const hardContextLimit = window > 0 && !freshBudgetedSelection ? window : void 0;
229625
229626
  const estimate = (messages) => this.estimateProjectedRequestTokens({
229626
229627
  ...context,
229627
229628
  messages
229628
229629
  });
229629
229630
  const preserveLatestUser = this.agent.turn.hasActiveTurn;
229630
- if (budget === void 0) return this.agent.context.fitCompactionPrefix(limit, estimate, preserveLatestUser);
229631
- 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);
229631
+ if (budget === void 0) return this.agent.context.fitCompactionPrefix(limit, estimate, preserveLatestUser, hardContextLimit);
229632
+ 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);
229632
229633
  }
229633
229634
  buildInstruction(customInstruction) {
229634
229635
  return renderPrompt(compaction_instruction_default, { customInstruction: customInstruction?.trim() ?? "" }).trimEnd();
@@ -233588,7 +233589,7 @@ var ContextMemory = class {
233588
233589
  this.agent.microCompaction.reset();
233589
233590
  this.agent.emitStatusUpdated();
233590
233591
  }
233591
- fitCompactionPrefix(maxRequestTokens, estimateRequest, preserveLatestUser = false) {
233592
+ fitCompactionPrefix(maxRequestTokens, estimateRequest, preserveLatestUser = false, hardContextLimit) {
233592
233593
  const prefixLength = this._history.findIndex((message) => message.origin?.kind === "compaction_summary");
233593
233594
  if (prefixLength <= 0 || !Number.isSafeInteger(maxRequestTokens) || maxRequestTokens <= 0) return false;
233594
233595
  const suffix = this._history.slice(prefixLength);
@@ -233600,7 +233601,9 @@ var ContextMemory = class {
233600
233601
  ];
233601
233602
  return Math.max(estimateTokensForMessages(messages), estimateRequest(project(messages, { dropOrphanResults: true })));
233602
233603
  };
233603
- if (estimate(this._history.slice(0, prefixLength)) <= maxRequestTokens) return false;
233604
+ const requestTokens = estimate(this._history.slice(0, prefixLength));
233605
+ if (requestTokens <= maxRequestTokens) return false;
233606
+ if (hardContextLimit !== void 0 && requestTokens >= hardContextLimit) return false;
233604
233607
  const sourceKey = Symbol("compaction source");
233605
233608
  const sources = collectCompactableUserMessages(this._history.slice(0, prefixLength)).map((message) => ({
233606
233609
  ...message,
@@ -264056,10 +264059,70 @@ function rejectionMessage(value) {
264056
264059
  return `Response review rejected candidate: ${value.stage}/${value.reason}` + (findings?.length ? ` (${findings.join(", ")})` : "");
264057
264060
  }
264058
264061
  //#endregion
264062
+ //#region ../../packages/agent-core/src/agent/response-review-deadline.ts
264063
+ const IDLE_TIMEOUT_MS = 3e4;
264064
+ const NATIVE_FIRST_CONTENT_MS = 9e4;
264065
+ const ABSOLUTE_TIMEOUT_MS = 12e4;
264066
+ function createResponseReviewDeadline(source) {
264067
+ const absoluteExpiresAt = performance.now() + ABSOLUTE_TIMEOUT_MS;
264068
+ const absolute = createDeadlineAbortSignal(source, ABSOLUTE_TIMEOUT_MS);
264069
+ const controller = new AbortController();
264070
+ const unlink = linkAbortSignal(absolute.signal, controller);
264071
+ let stage = "setup";
264072
+ let didTimeout = false;
264073
+ let closed = false;
264074
+ let idle;
264075
+ let idleExpiresAt = 0;
264076
+ const expire = () => {
264077
+ didTimeout = true;
264078
+ controller.abort(abortError());
264079
+ };
264080
+ const expireIfDue = () => {
264081
+ if (closed || controller.signal.aborted) return;
264082
+ const now = performance.now();
264083
+ if (now >= absoluteExpiresAt || now >= idleExpiresAt) expire();
264084
+ };
264085
+ const refresh = (timeoutMs) => {
264086
+ idleExpiresAt = performance.now() + timeoutMs;
264087
+ if (idle !== void 0) clearTimeout(idle);
264088
+ idle = setTimeout(expire, timeoutMs);
264089
+ };
264090
+ refresh(IDLE_TIMEOUT_MS);
264091
+ return {
264092
+ signal: controller.signal,
264093
+ timedOut: () => didTimeout || absolute.timedOut(),
264094
+ throwIfAborted: () => {
264095
+ expireIfDue();
264096
+ controller.signal.throwIfAborted();
264097
+ },
264098
+ progress: (event) => {
264099
+ expireIfDue();
264100
+ if (closed || controller.signal.aborted) return;
264101
+ if (event === "native.start" && stage === "setup") {
264102
+ stage = "native";
264103
+ refresh(NATIVE_FIRST_CONTENT_MS);
264104
+ } else if (event === "native.text" && stage === "native") refresh(IDLE_TIMEOUT_MS);
264105
+ else if (event === "release.start" && stage === "native") {
264106
+ stage = "release";
264107
+ refresh(IDLE_TIMEOUT_MS);
264108
+ } else if (event === "verification.start" && stage === "release") {
264109
+ stage = "verification";
264110
+ refresh(IDLE_TIMEOUT_MS);
264111
+ }
264112
+ },
264113
+ clear: () => {
264114
+ closed = true;
264115
+ if (idle !== void 0) clearTimeout(idle);
264116
+ idle = void 0;
264117
+ unlink();
264118
+ absolute.clear();
264119
+ }
264120
+ };
264121
+ }
264122
+ //#endregion
264059
264123
  //#region ../../packages/agent-core/src/agent/response-review.ts
264060
264124
  const MAX_CANDIDATE_BYTES = 1048576;
264061
264125
  const MAX_CANDIDATE_PARTS = 4096;
264062
- const REVIEW_TIMEOUT_MS = 3e4;
264063
264126
  const REVIEW_CANCEL_SETTLE_MS = 1e3;
264064
264127
  const MAX_REVIEW_ATTEMPTS = 2;
264065
264128
  function createReviewedOutputDispatcher(options) {
@@ -264146,6 +264209,7 @@ function createReviewedOutputDispatcher(options) {
264146
264209
  if (pending.length === 0) return options.dispatch(event);
264147
264210
  if (event.uuid !== stepUuid) throw new Error("Response review step mismatch");
264148
264211
  const currentEpoch = epoch;
264212
+ const isCurrentCandidate = () => epoch === currentEpoch;
264149
264213
  const parts = [...pending];
264150
264214
  reviewing = true;
264151
264215
  const text = parts.map((part) => part.part.type === "text" ? part.part.text : "").join("");
@@ -264159,8 +264223,9 @@ function createReviewedOutputDispatcher(options) {
264159
264223
  for (let attempt = 1; attempt <= MAX_REVIEW_ATTEMPTS; attempt += 1) {
264160
264224
  options.signal.throwIfAborted();
264161
264225
  if (epoch !== currentEpoch) throw new Error("Response review candidate changed during verification");
264162
- const deadline = createDeadlineAbortSignal(options.signal, REVIEW_TIMEOUT_MS);
264226
+ const deadline = createResponseReviewDeadline(options.signal);
264163
264227
  let requested;
264228
+ const pendingOperations = [];
264164
264229
  let attemptRejection;
264165
264230
  let attemptNativeRejection = false;
264166
264231
  try {
@@ -264169,6 +264234,12 @@ function createReviewedOutputDispatcher(options) {
264169
264234
  turnId: event.turnId,
264170
264235
  step: event.step,
264171
264236
  signal: deadline.signal,
264237
+ onProgress: (progress) => {
264238
+ if (isCurrentCandidate()) deadline.progress(progress);
264239
+ },
264240
+ onPendingOperation: (operation) => {
264241
+ pendingOperations.push(operation.then(() => void 0, () => void 0));
264242
+ },
264172
264243
  onRejected: (decision) => {
264173
264244
  if (!deadline.signal.aborted) {
264174
264245
  const message = rejectionMessage(decision);
@@ -264178,13 +264249,14 @@ function createReviewedOutputDispatcher(options) {
264178
264249
  }
264179
264250
  });
264180
264251
  approval = await abortable(requested, deadline.signal);
264252
+ deadline.throwIfAborted();
264181
264253
  rejection = attemptRejection;
264182
264254
  nativeRejection = attemptNativeRejection;
264183
264255
  break;
264184
264256
  } catch {
264185
264257
  options.signal.throwIfAborted();
264186
264258
  if (attemptRejection !== void 0) throw new Error(attemptRejection);
264187
- if (deadline.timedOut() && attempt < MAX_REVIEW_ATTEMPTS && requested !== void 0 && epoch === currentEpoch && await waitForCancelledReview(requested)) continue;
264259
+ if (deadline.timedOut() && attempt < MAX_REVIEW_ATTEMPTS && requested !== void 0 && epoch === currentEpoch && await waitForCancelledReview(requested, pendingOperations)) continue;
264188
264260
  throw new Error(deadline.timedOut() ? "Response review timed out" : "Response review failed");
264189
264261
  } finally {
264190
264262
  deadline.clear();
@@ -264221,10 +264293,16 @@ function createReviewedOutputDispatcher(options) {
264221
264293
  if (epoch === currentEpoch) clear();
264222
264294
  }
264223
264295
  }
264224
- async function waitForCancelledReview(requested) {
264296
+ async function waitForCancelledReview(requested, pendingOperations) {
264225
264297
  const deadline = createDeadlineAbortSignal(options.signal, REVIEW_CANCEL_SETTLE_MS);
264226
264298
  try {
264227
264299
  await abortable(requested.then(() => void 0, () => void 0), deadline.signal);
264300
+ let observed = 0;
264301
+ while (observed < pendingOperations.length) {
264302
+ const batch = pendingOperations.slice(observed);
264303
+ observed = pendingOperations.length;
264304
+ await abortable(Promise.all(batch), deadline.signal);
264305
+ }
264228
264306
  options.signal.throwIfAborted();
264229
264307
  return true;
264230
264308
  } catch {
@@ -268209,12 +268287,14 @@ function readPayload(result, includeError = false) {
268209
268287
  /** Receipts never enter ordinary tool execution, hooks, replay or model history. */
268210
268288
  function createGuardResponseReviewer(host) {
268211
268289
  const { language, guardVersion } = host;
268212
- return async ({ text, turnId, step, signal, onRejected }) => {
268290
+ return async ({ text, turnId, step, signal, onRejected, onPendingOperation, onProgress }) => {
268213
268291
  const input = {
268214
268292
  text,
268215
268293
  turnId,
268216
268294
  step,
268217
- signal
268295
+ signal,
268296
+ onPendingOperation,
268297
+ onProgress
268218
268298
  };
268219
268299
  const targetSha256 = digest(text);
268220
268300
  let stage = "setup";
@@ -268241,6 +268321,10 @@ function createGuardResponseReviewer(host) {
268241
268321
  const blocked = (reason, findings) => {
268242
268322
  record(signal.aborted ? "cancelled" : reason, findings);
268243
268323
  };
268324
+ const track = (operation) => {
268325
+ onPendingOperation?.(operation.then(() => void 0, () => void 0));
268326
+ return operation;
268327
+ };
268244
268328
  try {
268245
268329
  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");
268246
268330
  const resolve = () => {
@@ -268253,13 +268337,14 @@ function createGuardResponseReviewer(host) {
268253
268337
  const current = () => !signal.aborted && resolve()?.client === connection.client;
268254
268338
  if (!current()) return blocked("connection_changed");
268255
268339
  stage = "native";
268256
- const native = await abortable(host.reviewNative({ ...input }), signal);
268340
+ onProgress?.("native.start");
268341
+ const native = await abortable(track(host.reviewNative({ ...input })), signal);
268257
268342
  if (!current()) return blocked("connection_changed");
268258
268343
  if (native === void 0) return blocked("native_unavailable");
268259
268344
  if (!passed(native.nativeness) || !passed(native.orthography)) return blocked("native_rejected");
268260
268345
  const authorized = async (name) => {
268261
268346
  if (!current()) return false;
268262
- return passed(await abortable(host.authorize({
268347
+ return passed(await abortable(track(host.authorize({
268263
268348
  toolName: qualifyMcpToolName(SERVER_NAME, name),
268264
268349
  targetSha256,
268265
268350
  language,
@@ -268268,11 +268353,12 @@ function createGuardResponseReviewer(host) {
268268
268353
  turnId,
268269
268354
  step,
268270
268355
  signal
268271
- }), signal)) && current();
268356
+ })), signal)) && current();
268272
268357
  };
268273
268358
  stage = "release";
268359
+ onProgress?.("release.start");
268274
268360
  if (!await authorized("release_response")) return blocked("release_denied");
268275
- const releaseResult = await abortable(connection.client.callTool("release_response", {
268361
+ const releaseResult = await abortable(track(connection.client.callTool("release_response", {
268276
268362
  target_text: text,
268277
268363
  language,
268278
268364
  content_type: "prose",
@@ -268281,7 +268367,7 @@ function createGuardResponseReviewer(host) {
268281
268367
  nativeness: true,
268282
268368
  orthography: true
268283
268369
  }
268284
- }, signal), signal);
268370
+ }, signal)), signal);
268285
268371
  if (!current()) return blocked("connection_changed");
268286
268372
  if (releaseResult.isError) return blocked("release_rejected", rejectionFindings(readPayload(releaseResult, true)));
268287
268373
  const released = readPayload(releaseResult);
@@ -268289,8 +268375,9 @@ function createGuardResponseReviewer(host) {
268289
268375
  if (!current()) return blocked("connection_changed");
268290
268376
  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));
268291
268377
  stage = "verification";
268378
+ onProgress?.("verification.start");
268292
268379
  if (!await authorized("verify_release_token")) return blocked("verification_denied");
268293
- const { status: verificationStatus, valid, checks, payload } = readPayload(await abortable(connection.client.callTool("verify_release_token", {
268380
+ const { status: verificationStatus, valid, checks, payload } = readPayload(await abortable(track(connection.client.callTool("verify_release_token", {
268294
268381
  release_token,
268295
268382
  source_text: "",
268296
268383
  target_text: text,
@@ -268298,7 +268385,7 @@ function createGuardResponseReviewer(host) {
268298
268385
  purpose: "response",
268299
268386
  content_type: "prose",
268300
268387
  short_text_reviewed: false
268301
- }, signal), signal)) ?? {};
268388
+ }, signal)), signal)) ?? {};
268302
268389
  if (!current()) return blocked("connection_changed");
268303
268390
  if (verificationStatus !== "PASS" || valid !== true || !isPlainRecord(checks) || !CHECK_NAMES.every((name) => checks[name] === true) || !isPlainRecord(payload)) return blocked("verification_rejected");
268304
268391
  const { v, source_sha256, target_sha256, language: verifiedLanguage, purpose, content_type, short_text_reviewed, exp, iat } = payload;
@@ -268378,6 +268465,9 @@ async function reviewNativeResponse(agent, language, input) {
268378
268465
  };
268379
268466
  const options = {
268380
268467
  signal,
268468
+ onExecution: (completion) => {
268469
+ input.onPendingOperation?.(completion.then(() => void 0, () => void 0));
268470
+ },
268381
268471
  requestLogFields: {
268382
268472
  turnStep: `review:${input.turnId}.${String(input.step)}`,
268383
268473
  attempt: `${attempt}/2`
@@ -268386,13 +268476,16 @@ async function reviewNativeResponse(agent, language, input) {
268386
268476
  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.`;
268387
268477
  try {
268388
268478
  signal.throwIfAborted();
268389
- const response = await abortable(agent.generate(provider, prompt, [], [createUserMessage(candidateMessage)], { onMessagePart: (part) => {
268479
+ const requested = agent.generate(provider, prompt, [], [createUserMessage(candidateMessage)], { onMessagePart: (part) => {
268390
268480
  if (part.type === "text") receivedBytes += Buffer.byteLength(part.text);
268391
268481
  if (receivedBytes > MAX_REVIEW_RESULT_BYTES) {
268392
268482
  outputLimitExceeded = true;
268393
268483
  throw new Error("Native review output exceeds limit");
268394
268484
  }
268395
- } }, options), signal);
268485
+ if (!signal.aborted && part.type === "text" && part.text.trim().length > 0) input.onProgress?.("native.text");
268486
+ } }, options);
268487
+ input.onPendingOperation?.(requested.then(() => void 0, () => void 0));
268488
+ const response = await abortable(requested, signal);
268396
268489
  if (response.usage !== null) agent.usage.record(modelAlias, response.usage, "turn");
268397
268490
  signal.throwIfAborted();
268398
268491
  if (response.message.toolCalls.length > 0) return invalid("tool_calls");
@@ -1,37 +0,0 @@
1
- import { mkdir, readFile, writeFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { invokeInstalledHook } from "./check-install-hook.js";
4
-
5
- export async function invokeInstalledKingInstructions(pluginRoot, workspace) {
6
- const results = [];
7
- for (const [name, projectBytes, userBytes, fill] of [
8
- ["large", 44000, 0, "x"], ["combined", 25000, 19000, "x"], ["escaped", 32768, 0, '"']
9
- ]) {
10
- const root = join(workspace, name, "project"), home = join(workspace, name, "home");
11
- await mkdir(join(root, ".git"), { recursive: true });
12
- await mkdir(home, { recursive: true });
13
- const sources = new Map();
14
- for (const [path, bytes] of [[join(root, "AGENTS.md"), projectBytes], [join(home, "AGENTS.md"), userBytes]]) {
15
- if (!bytes) continue;
16
- const header = "# Synthetic installed King instructions\n\n";
17
- const content = Buffer.from(header + fill.repeat(bytes - Buffer.byteLength(header)));
18
- await writeFile(path, content); sources.set(path, content);
19
- }
20
- const output = await invokeInstalledHook(pluginRoot, root, join(workspace, name, "state"), "blun", {
21
- hook_event_name: "UserPromptSubmit", host: "codex", cwd: root,
22
- session_id: `session:king-${name}`, event_id: `turn:king-${name}`,
23
- prompt: "Inspect the complete synthetic instructions."
24
- }, { requireBriefing: false, extraEnv: { BLUN_HOME: home, CODEX_HOME: home } });
25
- const bytes = Buffer.byteLength(output.additionalContext || "");
26
- if (output.decision || output.message || !bytes || bytes > 1200
27
- || JSON.stringify(output.hookSpecificKeys) !== JSON.stringify(["additionalContext", "hookEventName"])) {
28
- throw new Error(`installed King ${name} must accept full instructions through quiet bounded context: ${output.reason}`);
29
- }
30
- for (const [path, original] of sources) {
31
- if (!(await readFile(path)).equals(original)) throw new Error("installed King changed source instructions");
32
- }
33
- results.push({ name, instructionBytes: projectBytes + userBytes, contextBytes: bytes,
34
- contextField: "additionalContext", sourcePreserved: true });
35
- }
36
- return results;
37
- }