omnius 1.0.667 → 1.0.669

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/dist/index.js CHANGED
@@ -173686,7 +173686,7 @@ var require_auto = __commonJS({
173686
173686
  // ../node_modules/acme-client/src/client.js
173687
173687
  var require_client = __commonJS({
173688
173688
  "../node_modules/acme-client/src/client.js"(exports, module) {
173689
- var { createHash: createHash80 } = __require("crypto");
173689
+ var { createHash: createHash81 } = __require("crypto");
173690
173690
  var { getPemBodyAsB64u } = require_crypto();
173691
173691
  var { log: log22 } = require_logger();
173692
173692
  var HttpClient = require_http();
@@ -173997,14 +173997,14 @@ var require_client = __commonJS({
173997
173997
  */
173998
173998
  async getChallengeKeyAuthorization(challenge) {
173999
173999
  const jwk = this.http.getJwk();
174000
- const keysum = createHash80("sha256").update(JSON.stringify(jwk));
174000
+ const keysum = createHash81("sha256").update(JSON.stringify(jwk));
174001
174001
  const thumbprint = keysum.digest("base64url");
174002
174002
  const result = `${challenge.token}.${thumbprint}`;
174003
174003
  if (challenge.type === "http-01") {
174004
174004
  return result;
174005
174005
  }
174006
174006
  if (challenge.type === "dns-01") {
174007
- return createHash80("sha256").update(result).digest("base64url");
174007
+ return createHash81("sha256").update(result).digest("base64url");
174008
174008
  }
174009
174009
  if (challenge.type === "tls-alpn-01") {
174010
174010
  return result;
@@ -316684,7 +316684,7 @@ var require_websocket2 = __commonJS({
316684
316684
  var http6 = __require("http");
316685
316685
  var net5 = __require("net");
316686
316686
  var tls2 = __require("tls");
316687
- var { randomBytes: randomBytes32, createHash: createHash80 } = __require("crypto");
316687
+ var { randomBytes: randomBytes32, createHash: createHash81 } = __require("crypto");
316688
316688
  var { Duplex: Duplex3, Readable: Readable2 } = __require("stream");
316689
316689
  var { URL: URL3 } = __require("url");
316690
316690
  var PerMessageDeflate3 = require_permessage_deflate2();
@@ -317344,7 +317344,7 @@ var require_websocket2 = __commonJS({
317344
317344
  abortHandshake(websocket, socket, "Invalid Upgrade header");
317345
317345
  return;
317346
317346
  }
317347
- const digest4 = createHash80("sha1").update(key + GUID).digest("base64");
317347
+ const digest4 = createHash81("sha1").update(key + GUID).digest("base64");
317348
317348
  if (res.headers["sec-websocket-accept"] !== digest4) {
317349
317349
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
317350
317350
  return;
@@ -317711,7 +317711,7 @@ var require_websocket_server = __commonJS({
317711
317711
  var EventEmitter15 = __require("events");
317712
317712
  var http6 = __require("http");
317713
317713
  var { Duplex: Duplex3 } = __require("stream");
317714
- var { createHash: createHash80 } = __require("crypto");
317714
+ var { createHash: createHash81 } = __require("crypto");
317715
317715
  var extension3 = require_extension2();
317716
317716
  var PerMessageDeflate3 = require_permessage_deflate2();
317717
317717
  var subprotocol3 = require_subprotocol();
@@ -318012,7 +318012,7 @@ var require_websocket_server = __commonJS({
318012
318012
  );
318013
318013
  }
318014
318014
  if (this._state > RUNNING) return abortHandshake(socket, 503);
318015
- const digest4 = createHash80("sha1").update(key + GUID).digest("base64");
318015
+ const digest4 = createHash81("sha1").update(key + GUID).digest("base64");
318016
318016
  const headers = [
318017
318017
  "HTTP/1.1 101 Switching Protocols",
318018
318018
  "Upgrade: websocket",
@@ -330819,13 +330819,13 @@ Justification: ${justification || "(none provided)"}`,
330819
330819
  }
330820
330820
  const snapshot = JSON.stringify(this.selfState, null, 2);
330821
330821
  try {
330822
- const { createHash: createHash80 } = await import("node:crypto");
330822
+ const { createHash: createHash81 } = await import("node:crypto");
330823
330823
  const snapshotDir = join52(this.cwd, ".omnius", "identity", "snapshots");
330824
330824
  await mkdir7(snapshotDir, { recursive: true });
330825
330825
  const version5 = this.selfState.version;
330826
330826
  const snapshotPath = join52(snapshotDir, `v${version5}.json`);
330827
330827
  await writeFile12(snapshotPath, snapshot, "utf8");
330828
- const hash2 = createHash80("sha256").update(snapshot).digest("hex");
330828
+ const hash2 = createHash81("sha256").update(snapshot).digest("hex");
330829
330829
  await writeFile12(join52(this.cwd, ".omnius", "identity", "latest-hash.txt"), hash2, "utf8");
330830
330830
  let ipfsCid = "";
330831
330831
  try {
@@ -330958,8 +330958,8 @@ New: ${newNarrative.slice(0, 200)}...`,
330958
330958
  }
330959
330959
  // ── Helpers ──────────────────────────────────────────────────────────────
330960
330960
  createDefaultState() {
330961
- const { createHash: createHash80 } = __require("node:crypto");
330962
- const machineId = createHash80("sha256").update(this.cwd).digest("hex").slice(0, 12);
330961
+ const { createHash: createHash81 } = __require("node:crypto");
330962
+ const machineId = createHash81("sha256").update(this.cwd).digest("hex").slice(0, 12);
330963
330963
  return {
330964
330964
  self_id: `omnius-${machineId}`,
330965
330965
  version: 1,
@@ -331041,9 +331041,9 @@ New: ${newNarrative.slice(0, 200)}...`,
331041
331041
  let cid;
331042
331042
  if (this.selfState.version > prevVersion) {
331043
331043
  try {
331044
- const { createHash: createHash80 } = await import("node:crypto");
331044
+ const { createHash: createHash81 } = await import("node:crypto");
331045
331045
  const stateJson = JSON.stringify(this.selfState);
331046
- const hash2 = createHash80("sha256").update(stateJson).digest("hex").slice(0, 32);
331046
+ const hash2 = createHash81("sha256").update(stateJson).digest("hex").slice(0, 32);
331047
331047
  const cidsPath = join52(this.cwd, ".omnius", "identity", "cids.json");
331048
331048
  const cidsData = { latest: "", hash: hash2, version: this.selfState.version };
331049
331049
  try {
@@ -624569,6 +624569,186 @@ var init_contextBudget = __esm({
624569
624569
  }
624570
624570
  });
624571
624571
 
624572
+ // packages/orchestrator/dist/tool-exposure-policy.js
624573
+ import { createHash as createHash35 } from "node:crypto";
624574
+ function normalizedName(value2) {
624575
+ return String(value2 ?? "").trim();
624576
+ }
624577
+ function sortedUnique(values) {
624578
+ return [...new Set([...values].map(normalizedName).filter(Boolean))].sort((left, right) => left.localeCompare(right));
624579
+ }
624580
+ function positiveLimit(value2, fallback) {
624581
+ return typeof value2 === "number" && Number.isFinite(value2) && value2 > 0 ? Math.floor(value2) : fallback;
624582
+ }
624583
+ function descriptorMap(descriptors2) {
624584
+ const result = /* @__PURE__ */ new Map();
624585
+ for (const raw of descriptors2) {
624586
+ const name10 = normalizedName(raw.name);
624587
+ if (!name10)
624588
+ throw new Error("Progressive tool descriptors require a name.");
624589
+ if (result.has(name10)) {
624590
+ throw new Error(`Duplicate progressive tool descriptor: ${name10}`);
624591
+ }
624592
+ result.set(name10, {
624593
+ name: name10,
624594
+ role: raw.role,
624595
+ requiresCapabilities: sortedUnique(raw.requiresCapabilities ?? [])
624596
+ });
624597
+ }
624598
+ return result;
624599
+ }
624600
+ function profileAllows(descriptor2, capabilities) {
624601
+ return (descriptor2.requiresCapabilities ?? []).every((capability) => capabilities.has(capability));
624602
+ }
624603
+ function compileProgressiveToolPolicy(input) {
624604
+ const descriptors2 = descriptorMap(input.tools);
624605
+ const capabilities = new Set(sortedUnique(input.profile.capabilities));
624606
+ const allowed = /* @__PURE__ */ new Set();
624607
+ const unavailable = /* @__PURE__ */ new Set();
624608
+ let dispatcherName = null;
624609
+ for (const descriptor2 of descriptors2.values()) {
624610
+ if (!profileAllows(descriptor2, capabilities)) {
624611
+ unavailable.add(descriptor2.name);
624612
+ continue;
624613
+ }
624614
+ allowed.add(descriptor2.name);
624615
+ if (descriptor2.role === "dispatcher") {
624616
+ if (dispatcherName !== null) {
624617
+ throw new Error(`Progressive tool policy permits only one dispatcher: ${dispatcherName}, ${descriptor2.name}`);
624618
+ }
624619
+ dispatcherName = descriptor2.name;
624620
+ }
624621
+ }
624622
+ const alwaysVisible = /* @__PURE__ */ new Set();
624623
+ const deferred = /* @__PURE__ */ new Set();
624624
+ for (const name10 of sortedUnique(allowed)) {
624625
+ const descriptor2 = descriptors2.get(name10);
624626
+ if (descriptor2.role === "dispatcher")
624627
+ continue;
624628
+ if (descriptor2.role === "specialized")
624629
+ deferred.add(name10);
624630
+ else
624631
+ alwaysVisible.add(name10);
624632
+ }
624633
+ const requestedPromotions = sortedUnique([...input.promotions ?? []].filter((promotion) => promotion.source === "tool_search").map((promotion) => promotion.toolName));
624634
+ const promoted = /* @__PURE__ */ new Set();
624635
+ const rejectedPromotions = [];
624636
+ const maximumPromotedTools = positiveLimit(input.profile.maximumPromotedTools, DEFAULT_MAXIMUM_PROMOTED_TOOLS);
624637
+ for (const name10 of requestedPromotions) {
624638
+ const descriptor2 = descriptors2.get(name10);
624639
+ if (!descriptor2) {
624640
+ rejectedPromotions.push({ toolName: name10, reason: "not-registered" });
624641
+ continue;
624642
+ }
624643
+ if (!allowed.has(name10)) {
624644
+ rejectedPromotions.push({
624645
+ toolName: name10,
624646
+ reason: "profile-capability-denied"
624647
+ });
624648
+ continue;
624649
+ }
624650
+ if (descriptor2.role !== "specialized") {
624651
+ rejectedPromotions.push({ toolName: name10, reason: "not-specialized" });
624652
+ continue;
624653
+ }
624654
+ if (promoted.size >= maximumPromotedTools) {
624655
+ rejectedPromotions.push({
624656
+ toolName: name10,
624657
+ reason: "promotion-budget-exceeded"
624658
+ });
624659
+ continue;
624660
+ }
624661
+ promoted.add(name10);
624662
+ deferred.delete(name10);
624663
+ }
624664
+ const dispatcherRequired = deferred.size > 0;
624665
+ if (dispatcherRequired) {
624666
+ if (!dispatcherName) {
624667
+ throw new Error("Deferred tools require an allowed tool_search dispatcher.");
624668
+ }
624669
+ alwaysVisible.add(dispatcherName);
624670
+ } else if (dispatcherName) {
624671
+ unavailable.add(dispatcherName);
624672
+ }
624673
+ const maximumAlwaysVisibleTools = positiveLimit(input.profile.maximumAlwaysVisibleTools, DEFAULT_MAXIMUM_ALWAYS_VISIBLE_TOOLS);
624674
+ if (alwaysVisible.size > maximumAlwaysVisibleTools) {
624675
+ throw new Error(`Progressive tool core exceeds profile budget (${alwaysVisible.size}/${maximumAlwaysVisibleTools}) for ${input.profile.id}.`);
624676
+ }
624677
+ const alwaysVisibleNames = sortedUnique(alwaysVisible);
624678
+ const promotedNames = sortedUnique(promoted);
624679
+ const deferredNames = sortedUnique(deferred);
624680
+ const unavailableNames = sortedUnique(unavailable);
624681
+ const inline = sortedUnique([...alwaysVisibleNames, ...promotedNames]);
624682
+ const identity3 = JSON.stringify({
624683
+ profileId: input.profile.id,
624684
+ capabilities: sortedUnique(capabilities),
624685
+ alwaysVisible: alwaysVisibleNames,
624686
+ promoted: promotedNames,
624687
+ deferred: deferredNames,
624688
+ unavailable: unavailableNames
624689
+ });
624690
+ return {
624691
+ schema: "omnius.progressive-tool-policy.v1",
624692
+ revision: createHash35("sha256").update(identity3).digest("hex").slice(0, 16),
624693
+ profileId: input.profile.id,
624694
+ alwaysVisible: alwaysVisibleNames,
624695
+ promoted: promotedNames,
624696
+ inline,
624697
+ deferred: deferredNames,
624698
+ unavailable: unavailableNames,
624699
+ rejectedPromotions,
624700
+ dispatcherRequired,
624701
+ dispatcher: dispatcherRequired ? dispatcherName : null,
624702
+ authority: "execution-enforced-separately"
624703
+ };
624704
+ }
624705
+ function progressiveToolExposureMap(plan) {
624706
+ const result = /* @__PURE__ */ new Map();
624707
+ const alwaysVisible = new Set(plan.alwaysVisible);
624708
+ for (const name10 of plan.inline) {
624709
+ result.set(name10, plan.dispatcherRequired && alwaysVisible.has(name10) && name10 === plan.dispatcher ? "dispatcher" : "inline");
624710
+ }
624711
+ for (const name10 of plan.deferred)
624712
+ result.set(name10, "deferred");
624713
+ return result;
624714
+ }
624715
+ function measureProgressiveToolSchemas(input) {
624716
+ const definitions = /* @__PURE__ */ new Map();
624717
+ for (const entry of input.definitions) {
624718
+ const name10 = normalizedName(entry.name);
624719
+ if (name10)
624720
+ definitions.set(name10, entry.definition);
624721
+ }
624722
+ const permitted = sortedUnique([...input.plan.inline, ...input.plan.deferred]);
624723
+ const baselineDefinitions = permitted.map((name10) => definitions.get(name10)).filter((definition) => definition !== void 0);
624724
+ const inlineDefinitions = input.plan.inline.map((name10) => definitions.get(name10)).filter((definition) => definition !== void 0);
624725
+ const deferredCatalog = input.deferredCatalog ?? { deferred_tools: input.plan.deferred };
624726
+ const baselineBytes = Buffer.byteLength(JSON.stringify({ tools: baselineDefinitions }), "utf8");
624727
+ const inlineSchemaBytes = Buffer.byteLength(JSON.stringify({ tools: inlineDefinitions }), "utf8");
624728
+ const deferredIndexBytes = input.plan.dispatcherRequired ? Buffer.byteLength(JSON.stringify(deferredCatalog), "utf8") : 0;
624729
+ const progressiveBytes = inlineSchemaBytes + deferredIndexBytes;
624730
+ const savedBytes = Math.max(0, baselineBytes - progressiveBytes);
624731
+ return {
624732
+ baselineBytes,
624733
+ progressiveBytes,
624734
+ inlineSchemaBytes,
624735
+ deferredIndexBytes,
624736
+ savedBytes,
624737
+ savedRatio: baselineBytes > 0 ? savedBytes / baselineBytes : 0,
624738
+ estimatedBaselineTokens: Math.ceil(baselineBytes / 2),
624739
+ estimatedProgressiveTokens: Math.ceil(progressiveBytes / 2),
624740
+ estimatedSavedTokens: Math.max(0, Math.ceil(baselineBytes / 2) - Math.ceil(progressiveBytes / 2))
624741
+ };
624742
+ }
624743
+ var DEFAULT_MAXIMUM_ALWAYS_VISIBLE_TOOLS, DEFAULT_MAXIMUM_PROMOTED_TOOLS;
624744
+ var init_tool_exposure_policy = __esm({
624745
+ "packages/orchestrator/dist/tool-exposure-policy.js"() {
624746
+ "use strict";
624747
+ DEFAULT_MAXIMUM_ALWAYS_VISIBLE_TOOLS = 8;
624748
+ DEFAULT_MAXIMUM_PROMOTED_TOOLS = 8;
624749
+ }
624750
+ });
624751
+
624572
624752
  // packages/orchestrator/dist/textSanitize.js
624573
624753
  function cleanScaffolding(text3) {
624574
624754
  if (text3 == null)
@@ -626608,7 +626788,7 @@ var init_integrationClosure = __esm({
626608
626788
  });
626609
626789
 
626610
626790
  // packages/orchestrator/dist/operational-world/reducer.js
626611
- import { createHash as createHash35 } from "node:crypto";
626791
+ import { createHash as createHash36 } from "node:crypto";
626612
626792
  function clone(value2) {
626613
626793
  return structuredClone(value2);
626614
626794
  }
@@ -626625,7 +626805,7 @@ function canonicalJson(value2) {
626625
626805
  return JSON.stringify(canonicalize(value2));
626626
626806
  }
626627
626807
  function sha2566(value2) {
626628
- return createHash35("sha256").update(canonicalJson(value2)).digest("hex");
626808
+ return createHash36("sha256").update(canonicalJson(value2)).digest("hex");
626629
626809
  }
626630
626810
  function graphHash(graph) {
626631
626811
  return sha2566(graph);
@@ -627398,9 +627578,9 @@ var init_persistence = __esm({
627398
627578
  });
627399
627579
 
627400
627580
  // packages/orchestrator/dist/operational-world/reasoningSlice.js
627401
- import { createHash as createHash36 } from "node:crypto";
627581
+ import { createHash as createHash37 } from "node:crypto";
627402
627582
  function stableSliceId(graph, focusNodeIds) {
627403
- const digest4 = createHash36("sha256").update(`${graph.graphId}
627583
+ const digest4 = createHash37("sha256").update(`${graph.graphId}
627404
627584
  ${graph.revision}
627405
627585
  ${[...focusNodeIds].sort().join("\n")}`).digest("hex").slice(0, 20);
627406
627586
  return `reasoning-slice:${digest4}`;
@@ -627730,10 +627910,10 @@ var init_reasoningSlice = __esm({
627730
627910
  });
627731
627911
 
627732
627912
  // packages/orchestrator/dist/operational-world/workGraphProjection.js
627733
- import { createHash as createHash37 } from "node:crypto";
627913
+ import { createHash as createHash38 } from "node:crypto";
627734
627914
  function compactId(prefix, value2) {
627735
627915
  const clean7 = String(value2 ?? "").trim().toLowerCase().replace(/[^a-z0-9_.:-]+/g, "-").replace(/-{2,}/g, "-").replace(/^[-.:]+|[-.:]+$/g, "").slice(0, 180);
627736
- const digest4 = createHash37("sha256").update(String(value2)).digest("hex").slice(0, 12);
627916
+ const digest4 = createHash38("sha256").update(String(value2)).digest("hex").slice(0, 12);
627737
627917
  return `${prefix}:${clean7 || "item"}:${digest4}`.slice(0, 256);
627738
627918
  }
627739
627919
  function edgeId2(kind, source, target) {
@@ -628641,9 +628821,9 @@ var init_workGraphProjection = __esm({
628641
628821
  });
628642
628822
 
628643
628823
  // packages/orchestrator/dist/operational-world/controller.js
628644
- import { createHash as createHash38 } from "node:crypto";
628824
+ import { createHash as createHash39 } from "node:crypto";
628645
628825
  function graphId(value2) {
628646
- const digest4 = createHash38("sha256").update(value2).digest("hex").slice(0, 20);
628826
+ const digest4 = createHash39("sha256").update(value2).digest("hex").slice(0, 20);
628647
628827
  return `work-graph:${digest4}`;
628648
628828
  }
628649
628829
  function validIso(value2) {
@@ -628884,7 +629064,7 @@ var init_run_frontier = __esm({
628884
629064
  });
628885
629065
 
628886
629066
  // packages/orchestrator/dist/capability-contract.js
628887
- import { createHash as createHash39 } from "node:crypto";
629067
+ import { createHash as createHash40 } from "node:crypto";
628888
629068
  function normalized2(value2) {
628889
629069
  return String(value2 ?? "").trim().toLowerCase();
628890
629070
  }
@@ -628917,7 +629097,7 @@ function buildRuntimeCapabilityContract(tools, groups = {}, exposureByName = /*
628917
629097
  });
628918
629098
  return {
628919
629099
  schema: "omnius.runtime-capability-contract.v1",
628920
- revision: createHash39("sha256").update(identity3).digest("hex").slice(0, 16),
629100
+ revision: createHash40("sha256").update(identity3).digest("hex").slice(0, 16),
628921
629101
  tools: entries2,
628922
629102
  groups: activeGroups
628923
629103
  };
@@ -629530,14 +629710,14 @@ var init_completionAutoFinalize = __esm({
629530
629710
  // packages/orchestrator/dist/completionFinalization.js
629531
629711
  import { existsSync as existsSync98, mkdirSync as mkdirSync60, readFileSync as readFileSync77, renameSync as renameSync16, unlinkSync as unlinkSync22, writeFileSync as writeFileSync52 } from "node:fs";
629532
629712
  import { dirname as dirname40, join as join109 } from "node:path";
629533
- import { createHash as createHash40 } from "node:crypto";
629713
+ import { createHash as createHash41 } from "node:crypto";
629534
629714
  import { fileURLToPath as fileURLToPath20 } from "node:url";
629535
629715
  function clean4(value2, max) {
629536
629716
  return String(value2 ?? "").replace(/\s+/g, " ").trim().slice(0, max);
629537
629717
  }
629538
629718
  function sha256File5(path16) {
629539
629719
  try {
629540
- return createHash40("sha256").update(readFileSync77(path16)).digest("hex");
629720
+ return createHash41("sha256").update(readFileSync77(path16)).digest("hex");
629541
629721
  } catch {
629542
629722
  return null;
629543
629723
  }
@@ -629653,7 +629833,7 @@ function buildCompletionFinalizationRecord(input) {
629653
629833
  return {
629654
629834
  schema: "omnius.completion-finalization.v1",
629655
629835
  phase: "prepared",
629656
- id: `terminal-${createHash40("sha256").update(identity3).digest("hex").slice(0, 20)}`,
629836
+ id: `terminal-${createHash41("sha256").update(identity3).digest("hex").slice(0, 20)}`,
629657
629837
  runId: input.runId,
629658
629838
  ...typeof input.taskEpoch === "number" ? { taskEpoch: input.taskEpoch } : {},
629659
629839
  status: input.status,
@@ -632503,7 +632683,7 @@ Do not claim certified ASD-STE100 conformance without a qualified human review.`
632503
632683
  });
632504
632684
 
632505
632685
  // packages/orchestrator/dist/reference-contracts.js
632506
- import { createHash as createHash41 } from "node:crypto";
632686
+ import { createHash as createHash42 } from "node:crypto";
632507
632687
  function compactSource(source, maxChars) {
632508
632688
  const normalized4 = source.replace(/\r\n/g, "\n").trim();
632509
632689
  if (normalized4.length <= maxChars)
@@ -632523,7 +632703,7 @@ function explicitContractIds(explicitModules = []) {
632523
632703
  }
632524
632704
  function renderContract(definition, phase, reason) {
632525
632705
  const source = loadPrompt(`reference-contracts/${definition.sourcePath}`);
632526
- const sourceHash = createHash41("sha256").update(source).digest("hex");
632706
+ const sourceHash = createHash42("sha256").update(source).digest("hex");
632527
632707
  const body = compactSource(source, definition.maxChars);
632528
632708
  const rendered = [
632529
632709
  "[REFERENCE CONTRACT v1]",
@@ -632735,7 +632915,7 @@ var init_phase_skill_guidance = __esm({
632735
632915
  });
632736
632916
 
632737
632917
  // packages/orchestrator/dist/deliveryCoverage.js
632738
- import { createHash as createHash42 } from "node:crypto";
632918
+ import { createHash as createHash43 } from "node:crypto";
632739
632919
  import { existsSync as existsSync100, readFileSync as readFileSync80 } from "node:fs";
632740
632920
  import { join as join112 } from "node:path";
632741
632921
  import { z as z18 } from "zod";
@@ -632753,7 +632933,7 @@ function duplicates(values) {
632753
632933
  return [...out];
632754
632934
  }
632755
632935
  function manifestHash(manifest) {
632756
- return createHash42("sha256").update(JSON.stringify(manifest)).digest("hex");
632936
+ return createHash43("sha256").update(JSON.stringify(manifest)).digest("hex");
632757
632937
  }
632758
632938
  function requiredLayers(state5) {
632759
632939
  if (state5 === "simulation_only")
@@ -633594,14 +633774,14 @@ var init_artifact_inspector = __esm({
633594
633774
  // packages/orchestrator/dist/lesson-bank.js
633595
633775
  import { existsSync as existsSync102, mkdirSync as mkdirSync61, appendFileSync as appendFileSync7, readFileSync as readFileSync81 } from "node:fs";
633596
633776
  import { join as join113, dirname as dirname41 } from "node:path";
633597
- import { createHash as createHash43 } from "node:crypto";
633777
+ import { createHash as createHash44 } from "node:crypto";
633598
633778
  function tokenize5(text3) {
633599
633779
  if (!text3)
633600
633780
  return [];
633601
633781
  return text3.toLowerCase().split(TOKENIZE_RE).filter((t2) => t2.length >= 3).slice(0, 80);
633602
633782
  }
633603
633783
  function shortHash(s2) {
633604
- return createHash43("sha256").update(s2).digest("hex").slice(0, 16);
633784
+ return createHash44("sha256").update(s2).digest("hex").slice(0, 16);
633605
633785
  }
633606
633786
  function solicit(args) {
633607
633787
  const { taskGoal, stem, reflections, successOutputPreview } = args;
@@ -633697,7 +633877,7 @@ var init_lesson_bank = __esm({
633697
633877
  // packages/orchestrator/dist/intervention-replay.js
633698
633878
  import { existsSync as existsSync103, mkdirSync as mkdirSync62, readFileSync as readFileSync82, writeFileSync as writeFileSync53, readdirSync as readdirSync32 } from "node:fs";
633699
633879
  import { join as join114, dirname as dirname42 } from "node:path";
633700
- import { createHash as createHash44 } from "node:crypto";
633880
+ import { createHash as createHash45 } from "node:crypto";
633701
633881
  function checkpointDir2(workingDir) {
633702
633882
  return workingDir ? join114(workingDir, ".omnius", "checkpoints") : join114(process.env["HOME"] || ".", ".omnius", "checkpoints");
633703
633883
  }
@@ -633731,7 +633911,7 @@ function sanitizeMessagesForCheckpoint(messages2) {
633731
633911
  deduped.push(m2);
633732
633912
  continue;
633733
633913
  }
633734
- const digest4 = createHash44("sha1").update(content).digest("hex");
633914
+ const digest4 = createHash45("sha1").update(content).digest("hex");
633735
633915
  if (seenSystemDigests.has(digest4))
633736
633916
  continue;
633737
633917
  seenSystemDigests.add(digest4);
@@ -637454,12 +637634,12 @@ var init_codeGraphLink = __esm({
637454
637634
  });
637455
637635
 
637456
637636
  // packages/orchestrator/dist/artifactContract.js
637457
- import { createHash as createHash45 } from "node:crypto";
637637
+ import { createHash as createHash46 } from "node:crypto";
637458
637638
  function shortHash3(content) {
637459
637639
  if (!content)
637460
637640
  return "empty";
637461
637641
  try {
637462
- return createHash45("sha256").update(content.slice(0, 4096)).digest("hex").slice(0, 8);
637642
+ return createHash46("sha256").update(content.slice(0, 4096)).digest("hex").slice(0, 8);
637463
637643
  } catch {
637464
637644
  let h = 2166136261;
637465
637645
  for (let i2 = 0; i2 < Math.min(content.length, 4096); i2++) {
@@ -642101,7 +642281,7 @@ ${body}
642101
642281
  });
642102
642282
 
642103
642283
  // packages/orchestrator/dist/contentAddressedArtifactStore.js
642104
- import { createHash as createHash46 } from "node:crypto";
642284
+ import { createHash as createHash47 } from "node:crypto";
642105
642285
  import { existsSync as existsSync112, mkdirSync as mkdirSync67, readFileSync as readFileSync89, readdirSync as readdirSync35, renameSync as renameSync18, statSync as statSync42, unlinkSync as unlinkSync23, writeFileSync as writeFileSync58 } from "node:fs";
642106
642286
  import { join as join122, resolve as resolve58, sep as sep7 } from "node:path";
642107
642287
  function contentAddressedArtifactStoreRoot(cwd4 = process.cwd(), stateDir) {
@@ -642126,7 +642306,7 @@ function parseArtifactReference(reference) {
642126
642306
  return hash2;
642127
642307
  }
642128
642308
  function sha2567(content) {
642129
- return createHash46("sha256").update(content, "utf8").digest("hex");
642309
+ return createHash47("sha256").update(content, "utf8").digest("hex");
642130
642310
  }
642131
642311
  function byteLength(content) {
642132
642312
  return Buffer.byteLength(content, "utf8");
@@ -642419,7 +642599,7 @@ var init_contentAddressedArtifactStore = __esm({
642419
642599
  });
642420
642600
 
642421
642601
  // packages/orchestrator/dist/request-budget.js
642422
- import { createHash as createHash47 } from "node:crypto";
642602
+ import { createHash as createHash48 } from "node:crypto";
642423
642603
  function canonical(value2) {
642424
642604
  if (value2 === null)
642425
642605
  return "null";
@@ -642488,7 +642668,7 @@ function compileOutboundRequestBudget(input) {
642488
642668
  const freeTokens = Math.max(0, modelContextTokens - projectedTotalTokens);
642489
642669
  const freeRatio = modelContextTokens > 0 ? freeTokens / modelContextTokens : 0;
642490
642670
  const requestPayloadFingerprint = payloadFingerprint(auditRequest);
642491
- const requestFingerprint = createHash47("sha256").update(canonical({ requestPayloadFingerprint, modelContextTokens, outputReservationTokens, safetyMarginTokens: safetyMarginTokens2 })).digest("hex");
642671
+ const requestFingerprint = createHash48("sha256").update(canonical({ requestPayloadFingerprint, modelContextTokens, outputReservationTokens, safetyMarginTokens: safetyMarginTokens2 })).digest("hex");
642492
642672
  return { schemaVersion: 1, requestFingerprint, requestPayloadFingerprint, modelContextTokens, serializedRequestBytes, serializedMessagesBytes, serializedToolSchemaBytes, ...totals, toolSchemaTokens, requestEnvelopeTokens, outputReservationTokens, safetyMarginTokens: safetyMarginTokens2, totalInputTokens, projectedTotalTokens, freeTokens, freeRatio, compactionEligible: modelContextTokens > 0 && freeRatio < 0.4 };
642493
642673
  }
642494
642674
  function snapshotOutboundRequest(request) {
@@ -642506,7 +642686,7 @@ var init_request_budget = __esm({
642506
642686
  contentText = (content) => typeof content === "string" ? content : canonical(content);
642507
642687
  estimateTokens3 = (value2) => value2 ? Math.ceil(value2.length / 4) + 4 : 0;
642508
642688
  serializedBytes = (value2) => Buffer.byteLength(JSON.stringify(value2 ?? null), "utf8");
642509
- payloadFingerprint = (value2) => createHash47("sha256").update(canonical(value2)).digest("hex");
642689
+ payloadFingerprint = (value2) => createHash48("sha256").update(canonical(value2)).digest("hex");
642510
642690
  RequestFingerprintCache = class {
642511
642691
  values = /* @__PURE__ */ new Map();
642512
642692
  get(fingerprint3) {
@@ -642579,7 +642759,7 @@ var init_context_dump_security = __esm({
642579
642759
  import { existsSync as existsSync113, mkdirSync as mkdirSync68, readdirSync as readdirSync36, readFileSync as readFileSync90, statSync as statSync43, unlinkSync as unlinkSync24, writeFileSync as writeFileSync59, appendFileSync as appendFileSync9, chmodSync as chmodSync5, closeSync as closeSync2, openSync as openSync2, readSync, renameSync as renameSync19 } from "node:fs";
642580
642760
  import { homedir as homedir36 } from "node:os";
642581
642761
  import { join as join123, resolve as resolve59 } from "node:path";
642582
- import { createHash as createHash48 } from "node:crypto";
642762
+ import { createHash as createHash49 } from "node:crypto";
642583
642763
  function contextWindowDumpDir(cwd4 = process.cwd()) {
642584
642764
  const envDir = process.env["OMNIUS_CONTEXT_WINDOW_DUMP_DIR"]?.trim();
642585
642765
  if (envDir)
@@ -643178,7 +643358,7 @@ function safeId(value2) {
643178
643358
  return String(value2 || "unknown").replace(/[^a-zA-Z0-9_.:-]/g, "_").slice(0, 160);
643179
643359
  }
643180
643360
  function shortHash4(value2) {
643181
- return createHash48("sha256").update(value2).digest("hex").slice(0, 10);
643361
+ return createHash49("sha256").update(value2).digest("hex").slice(0, 10);
643182
643362
  }
643183
643363
  function writePrivateFileAtomic(filePath, payload) {
643184
643364
  const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
@@ -643639,12 +643819,12 @@ var init_adversaryStream = __esm({
643639
643819
  });
643640
643820
 
643641
643821
  // packages/orchestrator/dist/context-admission.js
643642
- import { createHash as createHash49 } from "node:crypto";
643822
+ import { createHash as createHash50 } from "node:crypto";
643643
643823
  function canonical2(value2) {
643644
643824
  return JSON.stringify(value2 ?? null);
643645
643825
  }
643646
643826
  function fingerprint(request) {
643647
- return createHash49("sha256").update(canonical2(request)).digest("hex");
643827
+ return createHash50("sha256").update(canonical2(request)).digest("hex");
643648
643828
  }
643649
643829
  function deepClone(value2) {
643650
643830
  return JSON.parse(JSON.stringify(value2));
@@ -644499,7 +644679,7 @@ var init_memory_compiler = __esm({
644499
644679
 
644500
644680
  // packages/orchestrator/dist/debugArtifactLibrary.js
644501
644681
  import { appendFileSync as appendFileSync10, existsSync as existsSync114, mkdirSync as mkdirSync69, readFileSync as readFileSync91, statSync as statSync44, writeFileSync as writeFileSync60 } from "node:fs";
644502
- import { createHash as createHash50 } from "node:crypto";
644682
+ import { createHash as createHash51 } from "node:crypto";
644503
644683
  import { basename as basename24, join as join124, relative as relative15, resolve as resolve60 } from "node:path";
644504
644684
  function debugArtifactRoot(cwd4 = process.cwd(), stateDir) {
644505
644685
  const envDir = process.env["OMNIUS_DEBUG_ARTIFACT_DIR"]?.trim();
@@ -645342,7 +645522,7 @@ function safeId2(value2) {
645342
645522
  return String(value2 || "unknown").replace(/[^a-zA-Z0-9_.:-]/g, "_").slice(0, 160);
645343
645523
  }
645344
645524
  function shortHash5(value2) {
645345
- return createHash50("sha256").update(value2).digest("hex").slice(0, 10);
645525
+ return createHash51("sha256").update(value2).digest("hex").slice(0, 10);
645346
645526
  }
645347
645527
  var DEBUG_LIBRARY_DIR, RUN_EVENTS_LIMIT, PREVIEW_LIMIT;
645348
645528
  var init_debugArtifactLibrary = __esm({
@@ -647600,7 +647780,7 @@ var init_domainDetector = __esm({
647600
647780
  });
647601
647781
 
647602
647782
  // packages/orchestrator/dist/compile-error-fix-loop.js
647603
- import { createHash as createHash51 } from "node:crypto";
647783
+ import { createHash as createHash52 } from "node:crypto";
647604
647784
  import path7 from "node:path";
647605
647785
  function rankCompilerDiagnostics(diags) {
647606
647786
  const normalized4 = diags.map((diag, index) => ({
@@ -647881,7 +648061,7 @@ function isCompileFixDiagnostic(value2) {
647881
648061
  return Boolean(value2 && typeof value2.fingerprint === "string" && typeof value2.rank === "number");
647882
648062
  }
647883
648063
  function shortHash6(value2) {
647884
- return createHash51("sha256").update(value2).digest("hex").slice(0, 10);
648064
+ return createHash52("sha256").update(value2).digest("hex").slice(0, 10);
647885
648065
  }
647886
648066
  function fence(value2) {
647887
648067
  return ["```", value2.trim(), "```"].join("\n");
@@ -648761,7 +648941,7 @@ var init_completion_resolution_verifier = __esm({
648761
648941
  });
648762
648942
 
648763
648943
  // packages/orchestrator/dist/evidenceBranch.js
648764
- import { createHash as createHash52 } from "node:crypto";
648944
+ import { createHash as createHash53 } from "node:crypto";
648765
648945
  function buildBranchExtractionBrief(input) {
648766
648946
  const path16 = cleanBriefText(input.path, 320) || "the requested file";
648767
648947
  const intent = fileLocalDiscoveryQuestion(firstBriefText([
@@ -649013,7 +649193,7 @@ function parseExtraction(raw) {
649013
649193
  };
649014
649194
  }
649015
649195
  function sha2568(text3) {
649016
- return createHash52("sha256").update(text3).digest("hex");
649196
+ return createHash53("sha256").update(text3).digest("hex");
649017
649197
  }
649018
649198
  function lineNumberedExcerpt(lines, startIndex, endIndex, sourceLineOffset, maxLineChars = 240) {
649019
649199
  return lines.slice(startIndex, endIndex + 1).map((line, index) => {
@@ -649998,7 +650178,7 @@ var init_prompt_cache = __esm({
649998
650178
 
649999
650179
  // packages/orchestrator/dist/git-progress.js
650000
650180
  import { existsSync as existsSync115, readFileSync as readFileSync92, statSync as statSync45 } from "node:fs";
650001
- import { createHash as createHash53 } from "node:crypto";
650181
+ import { createHash as createHash54 } from "node:crypto";
650002
650182
  import { relative as relative16, resolve as resolve61, sep as sep8 } from "node:path";
650003
650183
  function isRunnerOwnedGitPath(path16) {
650004
650184
  const normalized4 = normalizeGitPath(path16);
@@ -650025,7 +650205,7 @@ function pathHash(repoRoot, relPath) {
650025
650205
  const st = statSync45(absolute);
650026
650206
  if (!st.isFile())
650027
650207
  return `non-file:${st.size}:${Math.floor(st.mtimeMs)}`;
650028
- return createHash53("sha256").update(readFileSync92(absolute)).digest("hex");
650208
+ return createHash54("sha256").update(readFileSync92(absolute)).digest("hex");
650029
650209
  } catch {
650030
650210
  return void 0;
650031
650211
  }
@@ -650417,7 +650597,7 @@ __export(preflightSnapshot_exports, {
650417
650597
  import { existsSync as existsSync116, readFileSync as readFileSync93, statSync as statSync46, statfsSync as statfsSync6 } from "node:fs";
650418
650598
  import { homedir as homedir37, platform as platform8, arch as arch7, totalmem as totalmem4, freemem as freemem3, hostname as hostname3 } from "node:os";
650419
650599
  import { join as join125 } from "node:path";
650420
- import { createHash as createHash54 } from "node:crypto";
650600
+ import { createHash as createHash55 } from "node:crypto";
650421
650601
  function capturePreflightSnapshot(workingDir) {
650422
650602
  const warnings = [];
650423
650603
  const configFingerprints = {};
@@ -650586,7 +650766,7 @@ function expandPath(p2) {
650586
650766
  return p2;
650587
650767
  }
650588
650768
  function sha2569(s2) {
650589
- return createHash54("sha256").update(s2).digest("hex").slice(0, 16);
650769
+ return createHash55("sha256").update(s2).digest("hex").slice(0, 16);
650590
650770
  }
650591
650771
  function freeDiskBytes(path16 = "/tmp") {
650592
650772
  try {
@@ -652394,13 +652574,25 @@ function brokerQueueDeadlineResponse(err) {
652394
652574
  return null;
652395
652575
  }
652396
652576
  const record = payload;
652397
- if (record["error"] !== "broker queue deadline expired" || typeof record["request_id"] !== "string" || !record["request_id"] || !record["queue"] || typeof record["queue"] !== "object" || Array.isArray(record["queue"])) {
652577
+ const error = record["error"];
652578
+ const isLegacyError = error === BROKER_QUEUE_DEADLINE_ERROR;
652579
+ const annotationPrefix = `${BROKER_QUEUE_DEADLINE_ERROR}:`;
652580
+ const isAnnotatedError = typeof error === "string" && error.startsWith(annotationPrefix);
652581
+ const retryable = record["retryable"];
652582
+ const reasonCode = record["reason_code"];
652583
+ if (!isLegacyError && !isAnnotatedError || typeof record["request_id"] !== "string" || !record["request_id"] || !record["queue"] || typeof record["queue"] !== "object" || Array.isArray(record["queue"]) || retryable !== void 0 && retryable !== true || reasonCode !== void 0 && typeof reasonCode !== "string") {
652398
652584
  return null;
652399
652585
  }
652586
+ const detail = isAnnotatedError ? error.slice(annotationPrefix.length).trim() : "";
652587
+ if (isAnnotatedError && !detail)
652588
+ return null;
652400
652589
  return {
652401
- error: "broker queue deadline expired",
652590
+ error: BROKER_QUEUE_DEADLINE_ERROR,
652402
652591
  request_id: record["request_id"],
652403
- queue: record["queue"]
652592
+ queue: record["queue"],
652593
+ ...detail ? { detail } : {},
652594
+ ...retryable === true ? { retryable: true } : {},
652595
+ ...typeof reasonCode === "string" ? { reason_code: reasonCode } : {}
652404
652596
  };
652405
652597
  }
652406
652598
  function brokerQueueRetryDelayMs(attempt, entropy = Math.random()) {
@@ -652686,11 +652878,12 @@ function classifyThinkOutcome(raw) {
652686
652878
  }
652687
652879
  return null;
652688
652880
  }
652689
- var PRESERVE_MODEL_VISIBLE_HISTORY, TOOL_SUBSETS, TOOL_AUTO_DEMOTE_TURNS, LEGACY_ACTION_REASON_KEYS, CLAIM_TASK_STOPWORDS, TASK_COMPLETE_CLOSEOUT_DESCRIPTION, SYSTEM_PROMPT_COMMON, SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, InferenceHttpError, OllamaAgenticBackend;
652881
+ var PRESERVE_MODEL_VISIBLE_HISTORY, TOOL_SUBSETS, TOOL_AUTO_DEMOTE_TURNS, LEGACY_ACTION_REASON_KEYS, CLAIM_TASK_STOPWORDS, TASK_COMPLETE_CLOSEOUT_DESCRIPTION, SYSTEM_PROMPT_COMMON, SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, BROKER_QUEUE_DEADLINE_ERROR, InferenceHttpError, OllamaAgenticBackend;
652690
652882
  var init_agenticRunner = __esm({
652691
652883
  "packages/orchestrator/dist/agenticRunner.js"() {
652692
652884
  "use strict";
652693
652885
  init_contextBudget();
652886
+ init_tool_exposure_policy();
652694
652887
  init_textSanitize();
652695
652888
  init_text_echo_guard();
652696
652889
  init_permissionRuleset();
@@ -654884,6 +655077,10 @@ runtime_module_sha256=${record.runtimeProvenance.module.sha256 ?? "unknown"}`
654884
655077
  compactionPercent: options2?.compactionPercent,
654885
655078
  deepContext: options2?.deepContext ?? false,
654886
655079
  dynamicContext: options2?.dynamicContext ?? "",
655080
+ progressiveToolPolicy: options2?.progressiveToolPolicy ?? {
655081
+ profile: { id: "legacy", capabilities: [] },
655082
+ descriptors: []
655083
+ },
654887
655084
  memoryPrefix: options2?.memoryPrefix ?? "",
654888
655085
  memoryPrefixHash: options2?.memoryPrefixHash ?? "",
654889
655086
  stateDir: options2?.stateDir ?? "",
@@ -663240,6 +663437,23 @@ Rewrite it now for ${ctx3.model}.`;
663240
663437
  this.registerTool(tool);
663241
663438
  }
663242
663439
  }
663440
+ /**
663441
+ * Replace turn-varying system context and the complete tool registry before
663442
+ * a sequential reuse of this runner. This prevents stale authorization,
663443
+ * relationship context, message-bound tool closures, and promoted schemas
663444
+ * from leaking across Telegram action turns.
663445
+ */
663446
+ prepareReusableRun(configuration) {
663447
+ this.options.dynamicContext = String(configuration.dynamicContext ?? "");
663448
+ this.tools.clear();
663449
+ this._activatedTools.clear();
663450
+ this._toolLastUsedTurn.clear();
663451
+ this._activeCapabilityContract = null;
663452
+ this.registerTools(configuration.tools);
663453
+ if (configuration.workingDirectory !== void 0) {
663454
+ this.setWorkingDirectory(configuration.workingDirectory);
663455
+ }
663456
+ }
663243
663457
  lookupRegisteredTool(name10) {
663244
663458
  const raw = String(name10 ?? "").trim();
663245
663459
  if (!raw)
@@ -668531,8 +668745,8 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
668531
668745
  if (process.env["OMNIUS_DISABLE_ADAPTIVE_RETRIEVAL"] !== "1") {
668532
668746
  const goalForSig = (this._taskState.goal || "").slice(0, 200);
668533
668747
  const recentTools = this._toolSequence.slice(-5).join("|");
668534
- const { createHash: createHash80 } = await import("node:crypto");
668535
- const sig = createHash80("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
668748
+ const { createHash: createHash81 } = await import("node:crypto");
668749
+ const sig = createHash81("sha256").update(`${goalForSig}::${recentTools}`).digest("hex").slice(0, 16);
668536
668750
  if (this._lastPprSig === sig && this._lastPprMemoryLines.length > 0) {
668537
668751
  compacted.push({
668538
668752
  role: "system",
@@ -672538,6 +672752,7 @@ ${sr.result.output}`;
672538
672752
  concurrencySafe: this.resolveToolConcurrencySafe(tc.name, tc.arguments)
672539
672753
  }));
672540
672754
  const batches = partitionToolCalls(batchToolCalls);
672755
+ let progressiveToolExposureChanged = false;
672541
672756
  for (const batch2 of batches) {
672542
672757
  if (this.aborted || this._pendingSteeringPreemption)
672543
672758
  break;
@@ -672575,6 +672790,9 @@ ${sr.result.output}`;
672575
672790
  }, 5);
672576
672791
  for (const r2 of results) {
672577
672792
  if (r2) {
672793
+ if (r2.success && r2.tc.name === "tool_search") {
672794
+ progressiveToolExposureChanged = true;
672795
+ }
672578
672796
  messages2.push(this.buildModelFacingToolMessage(r2.output, r2.tc.id, r2.tc.name, r2.tc.arguments, r2.success));
672579
672797
  void r2.systemGuidance;
672580
672798
  if (r2.tc.name === "task_complete") {
@@ -672641,6 +672859,9 @@ ${sr.result.output}`;
672641
672859
  if (completed || this._completionIncompleteVerification)
672642
672860
  break;
672643
672861
  }
672862
+ if (progressiveToolExposureChanged && !completed && !this._completionIncompleteVerification) {
672863
+ toolDefs = await this.buildToolDefinitions();
672864
+ }
672644
672865
  }
672645
672866
  if (completed || this._completionIncompleteVerification)
672646
672867
  break;
@@ -679100,7 +679321,7 @@ ${transcript}`
679100
679321
  async buildToolDefinitions() {
679101
679322
  const allTools = Array.from(this.tools.values()).filter((tool) => tool.name !== "tool_search");
679102
679323
  const capabilityContract = buildRuntimeCapabilityContract(allTools, TOOL_SUBSETS);
679103
- const activeSubsetCatalog = capabilityContract.groups;
679324
+ let activeSubsetCatalog = capabilityContract.groups;
679104
679325
  const tier = this.options.modelTier ?? "large";
679105
679326
  const taskGoal = this._taskState.goal || "";
679106
679327
  const STOPWORDS4 = /* @__PURE__ */ new Set([
@@ -679294,7 +679515,35 @@ Example: ${tool.name}(${JSON.stringify(meta.examples[0].args ?? {})})` : "";
679294
679515
  }
679295
679516
  scored.sort((a2, b) => b.score - a2.score);
679296
679517
  const maxInlineExtra = tier === "small" ? 4 : 8;
679297
- const inlineExtras = scored.slice(0, maxInlineExtra).filter((s2) => s2.score > 0);
679518
+ const progressiveConfiguration = this.options.progressiveToolPolicy.descriptors.length > 0 ? this.options.progressiveToolPolicy : null;
679519
+ const progressivePlan = progressiveConfiguration ? compileProgressiveToolPolicy({
679520
+ profile: progressiveConfiguration.profile,
679521
+ tools: [
679522
+ ...allTools.map((tool) => progressiveConfiguration.descriptors.find((descriptor2) => descriptor2.name === tool.name) ?? {
679523
+ name: tool.name,
679524
+ role: "specialized"
679525
+ }),
679526
+ progressiveConfiguration.descriptors.find((descriptor2) => descriptor2.name === "tool_search") ?? {
679527
+ name: "tool_search",
679528
+ role: "dispatcher"
679529
+ }
679530
+ ],
679531
+ promotions: [...this._activatedTools].map((toolName) => ({
679532
+ source: "tool_search",
679533
+ toolName
679534
+ }))
679535
+ }) : null;
679536
+ if (progressivePlan) {
679537
+ const permitted = /* @__PURE__ */ new Set([
679538
+ ...progressivePlan.inline,
679539
+ ...progressivePlan.deferred
679540
+ ]);
679541
+ activeSubsetCatalog = Object.fromEntries(Object.entries(activeSubsetCatalog).map(([name10, names]) => [
679542
+ name10,
679543
+ names.filter((toolName) => permitted.has(toolName))
679544
+ ]).filter(([, names]) => names.length > 0));
679545
+ }
679546
+ const inlineExtras = progressivePlan || this._isTelegramSurface() ? [] : scored.slice(0, maxInlineExtra).filter((s2) => s2.score > 0);
679298
679547
  const currentTurn = this._taskState.toolCallCount;
679299
679548
  let demoted = 0;
679300
679549
  for (const promoted of this._activatedTools) {
@@ -679311,12 +679560,12 @@ Example: ${tool.name}(${JSON.stringify(meta.examples[0].args ?? {})})` : "";
679311
679560
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
679312
679561
  });
679313
679562
  }
679314
- const inlineNames = /* @__PURE__ */ new Set([
679563
+ const inlineNames = progressivePlan ? new Set(progressivePlan.inline.filter((name10) => name10 !== "tool_search")) : /* @__PURE__ */ new Set([
679315
679564
  ...allTools.filter((t2) => CORE_TOOLS3.has(t2.name)).map((t2) => t2.name),
679316
679565
  ...inlineExtras.map((s2) => s2.tool.name),
679317
679566
  ...Array.from(this._activatedTools).filter((name10) => allTools.some((t2) => t2.name === name10))
679318
679567
  ]);
679319
- const deferred = allTools.filter((t2) => !inlineNames.has(t2.name));
679568
+ const deferred = progressivePlan ? allTools.filter((tool) => progressivePlan.deferred.includes(tool.name)) : allTools.filter((t2) => !inlineNames.has(t2.name));
679320
679569
  const inlineTools = allTools.filter((t2) => inlineNames.has(t2.name));
679321
679570
  const seen = /* @__PURE__ */ new Set();
679322
679571
  const dedupedInline = inlineTools.filter((t2) => {
@@ -680316,6 +680565,7 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
680316
680565
  });
680317
680566
  }
680318
680567
  };
680568
+ BROKER_QUEUE_DEADLINE_ERROR = "broker queue deadline expired";
680319
680569
  InferenceHttpError = class extends Error {
680320
680570
  transport;
680321
680571
  status;
@@ -681397,7 +681647,7 @@ var init_operational_world2 = __esm({
681397
681647
  });
681398
681648
 
681399
681649
  // packages/orchestrator/dist/memory-compiler-replay.js
681400
- import { createHash as createHash55 } from "node:crypto";
681650
+ import { createHash as createHash56 } from "node:crypto";
681401
681651
  function stableStringify3(value2) {
681402
681652
  if (value2 === null || typeof value2 !== "object")
681403
681653
  return JSON.stringify(value2);
@@ -681407,7 +681657,7 @@ function stableStringify3(value2) {
681407
681657
  return `{${Object.keys(object).sort().map((key) => `${JSON.stringify(key)}:${stableStringify3(object[key])}`).join(",")}}`;
681408
681658
  }
681409
681659
  function fingerprint2(value2) {
681410
- return createHash55("sha256").update(stableStringify3(value2)).digest("hex");
681660
+ return createHash56("sha256").update(stableStringify3(value2)).digest("hex");
681411
681661
  }
681412
681662
  function estimateTokens5(chars) {
681413
681663
  return chars > 0 ? Math.ceil(chars / 4) + 4 : 0;
@@ -683255,7 +683505,7 @@ var init_composite_scorer = __esm({
683255
683505
  });
683256
683506
 
683257
683507
  // packages/orchestrator/dist/memory/materialization-policy.js
683258
- import { createHash as createHash56 } from "node:crypto";
683508
+ import { createHash as createHash57 } from "node:crypto";
683259
683509
  function materializeMemoryItems(items, options2 = {}) {
683260
683510
  const config = options2.config ?? DEFAULT_WEIGHTING_CONFIG;
683261
683511
  const sorted = [...items].sort((a2, b) => b.weight - a2.weight || a2.id.localeCompare(b.id));
@@ -683493,7 +683743,7 @@ function estimateTokens6(text3) {
683493
683743
  return Math.max(1, Math.ceil(text3.length / 4));
683494
683744
  }
683495
683745
  function hashText2(text3) {
683496
- return createHash56("sha256").update(text3).digest("hex");
683746
+ return createHash57("sha256").update(text3).digest("hex");
683497
683747
  }
683498
683748
  var init_materialization_policy = __esm({
683499
683749
  "packages/orchestrator/dist/memory/materialization-policy.js"() {
@@ -683657,7 +683907,7 @@ var init_config_loader = __esm({
683657
683907
  });
683658
683908
 
683659
683909
  // packages/orchestrator/dist/memory/stability-tracker.js
683660
- import { createHash as createHash57 } from "node:crypto";
683910
+ import { createHash as createHash58 } from "node:crypto";
683661
683911
  import { existsSync as existsSync120, mkdirSync as mkdirSync70, readFileSync as readFileSync96, writeFileSync as writeFileSync62 } from "node:fs";
683662
683912
  import { dirname as dirname47, join as join129 } from "node:path";
683663
683913
  function stabilityFilePath(repoRoot) {
@@ -683721,7 +683971,7 @@ function computeStabilityHash(item) {
683721
683971
  item.scope.name,
683722
683972
  item.topicKey
683723
683973
  ].join("|");
683724
- return createHash57("sha256").update(normalized4).digest("hex");
683974
+ return createHash58("sha256").update(normalized4).digest("hex");
683725
683975
  }
683726
683976
  function normalizeContent2(content) {
683727
683977
  return content.replace(/\s+/g, " ").trim();
@@ -687756,10 +688006,10 @@ var init_project_arc = __esm({
687756
688006
  });
687757
688007
 
687758
688008
  // packages/orchestrator/dist/dedup-gate.js
687759
- import { createHash as createHash58 } from "node:crypto";
688009
+ import { createHash as createHash59 } from "node:crypto";
687760
688010
  function fingerprintCall(name10, args) {
687761
688011
  const canon = canonicalize2(args);
687762
- return createHash58("sha1").update(`${name10}\0${canon}`).digest("hex").slice(0, 16);
688012
+ return createHash59("sha1").update(`${name10}\0${canon}`).digest("hex").slice(0, 16);
687763
688013
  }
687764
688014
  function canonicalize2(value2) {
687765
688015
  if (value2 === null || typeof value2 !== "object")
@@ -688721,9 +688971,9 @@ var init_subagent_prompt = __esm({
688721
688971
  });
688722
688972
 
688723
688973
  // packages/orchestrator/dist/memory-compiler-trace-import.js
688724
- import { createHash as createHash59 } from "node:crypto";
688974
+ import { createHash as createHash60 } from "node:crypto";
688725
688975
  function digest3(value2) {
688726
- return createHash59("sha256").update(value2).digest("hex");
688976
+ return createHash60("sha256").update(value2).digest("hex");
688727
688977
  }
688728
688978
  function stable(value2) {
688729
688979
  if (value2 === null || typeof value2 !== "object")
@@ -689030,6 +689280,7 @@ __export(dist_exports3, {
689030
689280
  commitTerminalTrajectoryProjection: () => commitTerminalTrajectoryProjection,
689031
689281
  compileOutboundRequestBudget: () => compileOutboundRequestBudget,
689032
689282
  compilePersonalityPrompt: () => compilePersonalityPrompt,
689283
+ compileProgressiveToolPolicy: () => compileProgressiveToolPolicy,
689033
689284
  completionEvidenceDirective: () => completionEvidenceDirective,
689034
689285
  completionFinalizationPath: () => completionFinalizationPath,
689035
689286
  completionFinalizationPreparePath: () => completionFinalizationPreparePath,
@@ -689167,6 +689418,7 @@ __export(dist_exports3, {
689167
689418
  mapClaimsToSpans: () => mapClaimsToSpans,
689168
689419
  materializeMemoryItems: () => materializeMemoryItems,
689169
689420
  measureContextSNR: () => measureContextSNR,
689421
+ measureProgressiveToolSchemas: () => measureProgressiveToolSchemas,
689170
689422
  memoryCosine: () => cosine7,
689171
689423
  mergeDigests: () => mergeDigests,
689172
689424
  mintClaimScopeToken: () => mintClaimScopeToken,
@@ -689199,6 +689451,7 @@ __export(dist_exports3, {
689199
689451
  pressureCheck: () => pressureCheck,
689200
689452
  profileIntensity: () => profileIntensity,
689201
689453
  profileLabel: () => profileLabel,
689454
+ progressiveToolExposureMap: () => progressiveToolExposureMap,
689202
689455
  purgeOldSidecars: () => purgeOldSidecars,
689203
689456
  readContextWindowDump: () => readContextWindowDump,
689204
689457
  readFeaturesManifest: () => readFeaturesManifest,
@@ -689329,6 +689582,7 @@ var init_dist8 = __esm({
689329
689582
  init_mergeRunner();
689330
689583
  init_retryController();
689331
689584
  init_agenticRunner();
689585
+ init_tool_exposure_policy();
689332
689586
  init_ste_communication_policy();
689333
689587
  init_operational_world2();
689334
689588
  init_request_budget();
@@ -690976,7 +691230,7 @@ __export(tray_exports, {
690976
691230
  verifyTrayHelper: () => verifyTrayHelper
690977
691231
  });
690978
691232
  import { spawn as spawn34, spawnSync as spawnSync9 } from "node:child_process";
690979
- import { createHash as createHash60 } from "node:crypto";
691233
+ import { createHash as createHash61 } from "node:crypto";
690980
691234
  import {
690981
691235
  closeSync as closeSync5,
690982
691236
  chmodSync as chmodSync6,
@@ -691188,7 +691442,7 @@ function helperBinaryName(platform13 = process.platform) {
691188
691442
  return null;
691189
691443
  }
691190
691444
  function sha256File6(path16) {
691191
- return createHash60("sha256").update(readFileSync105(path16)).digest("hex");
691445
+ return createHash61("sha256").update(readFileSync105(path16)).digest("hex");
691192
691446
  }
691193
691447
  function verifyTrayHelper() {
691194
691448
  const binName = helperBinaryName();
@@ -703601,7 +703855,7 @@ var require_websocket3 = __commonJS({
703601
703855
  var http6 = __require("http");
703602
703856
  var net5 = __require("net");
703603
703857
  var tls2 = __require("tls");
703604
- var { randomBytes: randomBytes32, createHash: createHash80 } = __require("crypto");
703858
+ var { randomBytes: randomBytes32, createHash: createHash81 } = __require("crypto");
703605
703859
  var { Duplex: Duplex3, Readable: Readable2 } = __require("stream");
703606
703860
  var { URL: URL3 } = __require("url");
703607
703861
  var PerMessageDeflate3 = require_permessage_deflate3();
@@ -704261,7 +704515,7 @@ var require_websocket3 = __commonJS({
704261
704515
  abortHandshake(websocket, socket, "Invalid Upgrade header");
704262
704516
  return;
704263
704517
  }
704264
- const digest4 = createHash80("sha1").update(key + GUID).digest("base64");
704518
+ const digest4 = createHash81("sha1").update(key + GUID).digest("base64");
704265
704519
  if (res.headers["sec-websocket-accept"] !== digest4) {
704266
704520
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
704267
704521
  return;
@@ -704628,7 +704882,7 @@ var require_websocket_server2 = __commonJS({
704628
704882
  var EventEmitter15 = __require("events");
704629
704883
  var http6 = __require("http");
704630
704884
  var { Duplex: Duplex3 } = __require("stream");
704631
- var { createHash: createHash80 } = __require("crypto");
704885
+ var { createHash: createHash81 } = __require("crypto");
704632
704886
  var extension3 = require_extension3();
704633
704887
  var PerMessageDeflate3 = require_permessage_deflate3();
704634
704888
  var subprotocol3 = require_subprotocol2();
@@ -704929,7 +705183,7 @@ var require_websocket_server2 = __commonJS({
704929
705183
  );
704930
705184
  }
704931
705185
  if (this._state > RUNNING) return abortHandshake(socket, 503);
704932
- const digest4 = createHash80("sha1").update(key + GUID).digest("base64");
705186
+ const digest4 = createHash81("sha1").update(key + GUID).digest("base64");
704933
705187
  const headers = [
704934
705188
  "HTTP/1.1 101 Switching Protocols",
704935
705189
  "Upgrade: websocket",
@@ -712410,14 +712664,14 @@ var init_voice_session = __esm({
712410
712664
  });
712411
712665
 
712412
712666
  // packages/cli/src/tui/scoped-personality.ts
712413
- import { createHash as createHash61 } from "node:crypto";
712667
+ import { createHash as createHash62 } from "node:crypto";
712414
712668
  import { appendFileSync as appendFileSync14, existsSync as existsSync136, mkdirSync as mkdirSync85, readFileSync as readFileSync113, writeFileSync as writeFileSync75 } from "node:fs";
712415
712669
  import { join as join146, resolve as resolve68 } from "node:path";
712416
712670
  function safeName(input) {
712417
712671
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
712418
712672
  }
712419
712673
  function scopeHash(scope) {
712420
- return createHash61("sha1").update(`${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
712674
+ return createHash62("sha1").update(`${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
712421
712675
  }
712422
712676
  function scopedPersonalityDir(repoRoot, kind) {
712423
712677
  return resolve68(repoRoot, ".omnius", "scoped-personality", kind);
@@ -712788,7 +713042,7 @@ var init_scoped_personality = __esm({
712788
713042
  });
712789
713043
 
712790
713044
  // packages/cli/src/tui/voice-soul.ts
712791
- import { createHash as createHash62 } from "node:crypto";
713045
+ import { createHash as createHash63 } from "node:crypto";
712792
713046
  import { existsSync as existsSync137, readdirSync as readdirSync42, readFileSync as readFileSync114 } from "node:fs";
712793
713047
  import { basename as basename27, join as join147, resolve as resolve69 } from "node:path";
712794
713048
  function compactText(text3, limit2) {
@@ -712803,7 +713057,7 @@ function blockText(text3, limit2) {
712803
713057
  ... [truncated]`;
712804
713058
  }
712805
713059
  function scopeStateKey(scope, surface) {
712806
- return createHash62("sha1").update(`${surface}:${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
713060
+ return createHash63("sha1").update(`${surface}:${scope.kind}:${scope.id}`).digest("hex").slice(0, 16);
712807
713061
  }
712808
713062
  function safeName2(input) {
712809
713063
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
@@ -715463,7 +715717,7 @@ var init_types3 = __esm({
715463
715717
  });
715464
715718
 
715465
715719
  // packages/cli/src/tui/p2p/secret-vault.ts
715466
- import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash63 } from "node:crypto";
715720
+ import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash64 } from "node:crypto";
715467
715721
  import { readFileSync as readFileSync116, writeFileSync as writeFileSync77, existsSync as existsSync139, mkdirSync as mkdirSync87 } from "node:fs";
715468
715722
  import { dirname as dirname54 } from "node:path";
715469
715723
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
@@ -715707,7 +715961,7 @@ var init_secret_vault = __esm({
715707
715961
  /** Generate a deterministic fingerprint of vault contents (for sync verification) */
715708
715962
  fingerprint() {
715709
715963
  const names = Array.from(this.secrets.keys()).sort();
715710
- const hash2 = createHash63("sha256");
715964
+ const hash2 = createHash64("sha256");
715711
715965
  for (const name10 of names) {
715712
715966
  hash2.update(name10 + ":");
715713
715967
  hash2.update(this.secrets.get(name10).value);
@@ -715722,7 +715976,7 @@ var init_secret_vault = __esm({
715722
715976
  // packages/cli/src/tui/p2p/peer-mesh.ts
715723
715977
  import { EventEmitter as EventEmitter9 } from "node:events";
715724
715978
  import { createServer as createServer6 } from "node:http";
715725
- import { randomBytes as randomBytes24, createHash as createHash64, generateKeyPairSync } from "node:crypto";
715979
+ import { randomBytes as randomBytes24, createHash as createHash65, generateKeyPairSync } from "node:crypto";
715726
715980
  var PING_INTERVAL_MS, PEER_TIMEOUT_MS, GOSSIP_INTERVAL_MS, MAX_PEERS, PeerMesh;
715727
715981
  var init_peer_mesh = __esm({
715728
715982
  "packages/cli/src/tui/p2p/peer-mesh.ts"() {
@@ -715738,7 +715992,7 @@ var init_peer_mesh = __esm({
715738
715992
  const { publicKey: publicKey2, privateKey } = generateKeyPairSync("ed25519");
715739
715993
  this.publicKey = publicKey2.export({ type: "spki", format: "der" });
715740
715994
  this.privateKey = privateKey.export({ type: "pkcs8", format: "der" });
715741
- this.peerId = createHash64("sha256").update(this.publicKey).digest("base64url").slice(0, 22);
715995
+ this.peerId = createHash65("sha256").update(this.publicKey).digest("base64url").slice(0, 22);
715742
715996
  this.capabilities = options2.capabilities;
715743
715997
  this.displayName = options2.displayName;
715744
715998
  this._authKey = options2.authKey ?? randomBytes24(24).toString("base64url");
@@ -717348,7 +717602,7 @@ __export(omnius_directory_exports, {
717348
717602
  import { appendFileSync as appendFileSync15, cpSync as cpSync2, existsSync as existsSync141, mkdirSync as mkdirSync89, readFileSync as readFileSync118, writeFileSync as writeFileSync79, readdirSync as readdirSync45, statSync as statSync57, unlinkSync as unlinkSync33, openSync as openSync9, closeSync as closeSync9, renameSync as renameSync24, watch as fsWatch3 } from "node:fs";
717349
717603
  import { join as join151, relative as relative19, basename as basename28, dirname as dirname55, resolve as resolve70 } from "node:path";
717350
717604
  import { homedir as homedir48 } from "node:os";
717351
- import { createHash as createHash66 } from "node:crypto";
717605
+ import { createHash as createHash67 } from "node:crypto";
717352
717606
  function isGitRoot(dir) {
717353
717607
  const gitPath = join151(dir, ".git");
717354
717608
  if (!existsSync141(gitPath)) return false;
@@ -717581,7 +717835,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
717581
717835
  visited.add(dir);
717582
717836
  for (const name10 of CONTEXT_FILES) {
717583
717837
  const filePath = join151(dir, name10);
717584
- const normalizedName = name10.toLowerCase();
717838
+ const normalizedName2 = name10.toLowerCase();
717585
717839
  if (existsSync141(filePath) && !seen.has(filePath)) {
717586
717840
  seen.add(filePath);
717587
717841
  try {
@@ -717589,7 +717843,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
717589
717843
  if (content.length > maxContentLen) {
717590
717844
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
717591
717845
  }
717592
- const type = normalizedName.includes("agents") ? "agents" : normalizedName === "omnius.md" || normalizedName === ".omnius.md" ? "omnius" : normalizedName.includes("claude") ? "claude" : normalizedName.includes("readme") ? "readme" : normalizedName.includes("architect") ? "architecture" : normalizedName.includes("contribut") ? "contributing" : "other";
717846
+ const type = normalizedName2.includes("agents") ? "agents" : normalizedName2 === "omnius.md" || normalizedName2 === ".omnius.md" ? "omnius" : normalizedName2.includes("claude") ? "claude" : normalizedName2.includes("readme") ? "readme" : normalizedName2.includes("architect") ? "architecture" : normalizedName2.includes("contribut") ? "contributing" : "other";
717593
717847
  found.push({
717594
717848
  path: relative19(repoRoot, filePath) || name10,
717595
717849
  content,
@@ -717846,7 +718100,7 @@ function buildHandoffPrompt(repoRoot) {
717846
718100
  return lines.join("\n");
717847
718101
  }
717848
718102
  function computeDedupeHash(task, savedAt) {
717849
- return createHash66("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
718103
+ return createHash67("sha256").update(`${task}|${savedAt}`).digest("hex").slice(0, 16);
717850
718104
  }
717851
718105
  function generateSessionId() {
717852
718106
  const timestamp = Date.now().toString(36);
@@ -740907,7 +741161,7 @@ var init_voice_room_dsp = __esm({
740907
741161
 
740908
741162
  // packages/cli/src/tui/voicebox.ts
740909
741163
  import {
740910
- createHash as createHash67,
741164
+ createHash as createHash68,
740911
741165
  randomUUID as randomUUID31
740912
741166
  } from "node:crypto";
740913
741167
  import {
@@ -741067,7 +741321,7 @@ function packageAssetPath(...segments) {
741067
741321
  }
741068
741322
  function fileHash(path16) {
741069
741323
  try {
741070
- return createHash67("sha256").update(readFileSync133(path16)).digest("hex");
741324
+ return createHash68("sha256").update(readFileSync133(path16)).digest("hex");
741071
741325
  } catch {
741072
741326
  return null;
741073
741327
  }
@@ -741458,13 +741712,13 @@ async function resolveProfile(option, cloneRefPath, referenceTranscript, languag
741458
741712
  if (!stat10.isFile() || stat10.size < 64 || stat10.size > 32 * 1024 * 1024) {
741459
741713
  throw new Error("Voicebox clone reference must be a regular audio file between 64 bytes and 32 MiB");
741460
741714
  }
741461
- key = createHash67("sha256").update(`${option.id}
741715
+ key = createHash68("sha256").update(`${option.id}
741462
741716
  ${clonePath}
741463
741717
  ${stat10.size}
741464
741718
  ${stat10.mtimeMs}
741465
741719
  ${referenceTranscript}`).digest("hex");
741466
741720
  } else {
741467
- key = createHash67("sha256").update(`${option.id}
741721
+ key = createHash68("sha256").update(`${option.id}
741468
741722
  ${language}
741469
741723
  ${option.presetVoiceId ?? ""}`).digest("hex");
741470
741724
  }
@@ -746765,7 +747019,7 @@ __export(commands_exports, {
746765
747019
  });
746766
747020
  import * as nodeOs from "node:os";
746767
747021
  import { spawn as nodeSpawn2 } from "node:child_process";
746768
- import { createHash as createHash68 } from "node:crypto";
747022
+ import { createHash as createHash69 } from "node:crypto";
746769
747023
  import {
746770
747024
  existsSync as existsSync162,
746771
747025
  readFileSync as readFileSync135,
@@ -760610,7 +760864,7 @@ async function collectSponsorMediaStream(args) {
760610
760864
  };
760611
760865
  }
760612
760866
  if (artifact.sha256) {
760613
- const sha = createHash68("sha256").update(bytes2).digest("hex");
760867
+ const sha = createHash69("sha256").update(bytes2).digest("hex");
760614
760868
  if (sha !== artifact.sha256)
760615
760869
  return { ok: false, error: `Artifact hash mismatch for ${artifactId}` };
760616
760870
  }
@@ -775413,7 +775667,7 @@ var init_telegram_command_menu = __esm({
775413
775667
  });
775414
775668
 
775415
775669
  // packages/cli/src/tui/telegram-public-media.ts
775416
- import { createHash as createHash69, randomBytes as randomBytes27 } from "node:crypto";
775670
+ import { createHash as createHash70, randomBytes as randomBytes27 } from "node:crypto";
775417
775671
  import { lookup as dnsLookup2 } from "node:dns/promises";
775418
775672
  import { link, mkdir as mkdir23, unlink as unlink4, writeFile as writeFile27 } from "node:fs/promises";
775419
775673
  import { request as httpsRequest2 } from "node:https";
@@ -776034,7 +776288,7 @@ ${output2}`,
776034
776288
  responseContentType(response.headers),
776035
776289
  kind
776036
776290
  );
776037
- const sha25610 = createHash69("sha256").update(response.body).digest("hex");
776291
+ const sha25610 = createHash70("sha256").update(response.body).digest("hex");
776038
776292
  if (this.acquiredFiles >= MAX_ACQUIRED_FILES_PER_RUN) {
776039
776293
  throw new Error(
776040
776294
  `Rejected media: this run already acquired ${MAX_ACQUIRED_FILES_PER_RUN} files.`
@@ -777577,7 +777831,7 @@ import {
777577
777831
  unlinkSync as unlinkSync43
777578
777832
  } from "node:fs";
777579
777833
  import { join as join184 } from "node:path";
777580
- import { createHash as createHash70 } from "node:crypto";
777834
+ import { createHash as createHash71 } from "node:crypto";
777581
777835
  function safeFilePart(value2) {
777582
777836
  return value2.replace(/[^A-Za-z0-9_.-]+/g, "_").slice(0, 80) || "telegram";
777583
777837
  }
@@ -777585,7 +777839,7 @@ function daydreamRoot(repoRoot) {
777585
777839
  return join184(repoRoot, ".omnius", "telegram-daydreams");
777586
777840
  }
777587
777841
  function sessionDir(repoRoot, sessionKey) {
777588
- const hash2 = createHash70("sha1").update(sessionKey).digest("hex").slice(0, 20);
777842
+ const hash2 = createHash71("sha1").update(sessionKey).digest("hex").slice(0, 20);
777589
777843
  return join184(daydreamRoot(repoRoot), safeFilePart(hash2));
777590
777844
  }
777591
777845
  function compactLine2(value2, max = 220) {
@@ -777696,7 +777950,7 @@ function buildReplyOpportunities(input, openQuestions) {
777696
777950
  return opportunities;
777697
777951
  }
777698
777952
  function daydreamOpportunityId(input, trigger) {
777699
- return createHash70("sha1").update(`${input.sessionKey}:${input.generatedAtMs}:${trigger}`).digest("hex").slice(0, 16);
777953
+ return createHash71("sha1").update(`${input.sessionKey}:${input.generatedAtMs}:${trigger}`).digest("hex").slice(0, 16);
777700
777954
  }
777701
777955
  function clamp0116(value2) {
777702
777956
  if (!Number.isFinite(value2)) return 0;
@@ -778101,7 +778355,7 @@ function buildTelegramChannelDaydream(input, corpus, extraction, extractionCommi
778101
778355
  const seed = `${input.sessionKey}:${input.generatedAtMs}:${input.history.length}`;
778102
778356
  return {
778103
778357
  version: 3,
778104
- id: createHash70("sha1").update(seed).digest("hex").slice(0, 16),
778358
+ id: createHash71("sha1").update(seed).digest("hex").slice(0, 16),
778105
778359
  sessionKey: input.sessionKey,
778106
778360
  chatId: input.chatId,
778107
778361
  chatTitle: input.chatTitle,
@@ -778413,12 +778667,12 @@ var init_telegram_channel_dmn = __esm({
778413
778667
  });
778414
778668
 
778415
778669
  // packages/cli/src/tui/telegram-reflection-corpus.ts
778416
- import { createHash as createHash71 } from "node:crypto";
778670
+ import { createHash as createHash72 } from "node:crypto";
778417
778671
  function telegramReflectionMemoryDbPaths(repoRoot) {
778418
778672
  return omniusMemoryDbPaths(repoRoot);
778419
778673
  }
778420
778674
  function stableHash2(value2, length4 = 16) {
778421
- return createHash71("sha1").update(value2).digest("hex").slice(0, length4);
778675
+ return createHash72("sha1").update(value2).digest("hex").slice(0, length4);
778422
778676
  }
778423
778677
  function clean5(value2) {
778424
778678
  return String(value2 ?? "").replace(/\s+/g, " ").trim();
@@ -779231,7 +779485,7 @@ var init_telegram_reflection_extraction = __esm({
779231
779485
  });
779232
779486
 
779233
779487
  // packages/cli/src/tui/telegram-social-state-types.ts
779234
- import { createHash as createHash72 } from "node:crypto";
779488
+ import { createHash as createHash73 } from "node:crypto";
779235
779489
  function telegramSocialActorKey(actor) {
779236
779490
  if (!actor) return "unknown";
779237
779491
  if (typeof actor.userId === "number") return `user:${actor.userId}`;
@@ -779267,7 +779521,7 @@ function appendUnique(items, value2, max) {
779267
779521
  return next.slice(-max);
779268
779522
  }
779269
779523
  function hashTelegramSocialId(parts) {
779270
- return createHash72("sha1").update(parts.map((part) => String(part ?? "")).join(":")).digest("hex").slice(0, 16);
779524
+ return createHash73("sha1").update(parts.map((part) => String(part ?? "")).join(":")).digest("hex").slice(0, 16);
779271
779525
  }
779272
779526
  function cleanUsername(value2) {
779273
779527
  if (typeof value2 !== "string") return void 0;
@@ -780522,7 +780776,7 @@ var init_telegram_social_state = __esm({
780522
780776
  });
780523
780777
 
780524
780778
  // packages/cli/src/tui/telegram-social-event-log.ts
780525
- import { createHash as createHash73 } from "node:crypto";
780779
+ import { createHash as createHash74 } from "node:crypto";
780526
780780
  import {
780527
780781
  appendFileSync as appendFileSync21,
780528
780782
  existsSync as existsSync175,
@@ -780531,7 +780785,7 @@ import {
780531
780785
  } from "node:fs";
780532
780786
  import { join as join185, resolve as resolve82 } from "node:path";
780533
780787
  function stableEventId2(type, sessionKey, occurredAt, payload) {
780534
- return createHash73("sha256").update(JSON.stringify({ type, sessionKey, occurredAt, payload })).digest("hex").slice(0, 24);
780788
+ return createHash74("sha256").update(JSON.stringify({ type, sessionKey, occurredAt, payload })).digest("hex").slice(0, 24);
780535
780789
  }
780536
780790
  function createTelegramSocialEvent(type, payload, recordedAt = Date.now()) {
780537
780791
  const sessionKey = String(payload.sessionKey);
@@ -780547,7 +780801,7 @@ function createTelegramSocialEvent(type, payload, recordedAt = Date.now()) {
780547
780801
  };
780548
780802
  }
780549
780803
  function telegramSocialEventLogPath(repoRoot, sessionKey) {
780550
- const scope = createHash73("sha256").update(sessionKey).digest("hex").slice(0, 24);
780804
+ const scope = createHash74("sha256").update(sessionKey).digest("hex").slice(0, 24);
780551
780805
  return resolve82(repoRoot, ".omnius", "telegram-social-events", `${scope}.jsonl`);
780552
780806
  }
780553
780807
  function appendTelegramSocialEvent(repoRoot, event) {
@@ -781402,7 +781656,7 @@ import {
781402
781656
  mkdir as mkdirAsync,
781403
781657
  writeFile as writeFileAsync
781404
781658
  } from "node:fs/promises";
781405
- import { createHash as createHash74, randomBytes as randomBytes29, randomInt } from "node:crypto";
781659
+ import { createHash as createHash75, randomBytes as randomBytes29, randomInt } from "node:crypto";
781406
781660
  function formatModelBytes(bytes2) {
781407
781661
  if (!Number.isFinite(bytes2) || bytes2 <= 0) return "0 B";
781408
781662
  const units = ["B", "KB", "MB", "GB", "TB"];
@@ -782712,7 +782966,7 @@ function buildTelegramRuntimeContext(now2 = /* @__PURE__ */ new Date(), repoRoot
782712
782966
  return buildConversationRuntimeContext(now2, repoRoot);
782713
782967
  }
782714
782968
  function telegramSessionIdFromKey(sessionKey) {
782715
- return `telegram-${createHash74("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
782969
+ return `telegram-${createHash75("sha1").update(sessionKey).digest("hex").slice(0, 16)}`;
782716
782970
  }
782717
782971
  function normalizeTelegramSubAgentLimit(value2) {
782718
782972
  const parsed = typeof value2 === "number" ? value2 : typeof value2 === "string" && value2.trim() ? Number(value2.trim()) : TELEGRAM_SUB_AGENT_DEFAULT_LIMIT;
@@ -784975,6 +785229,12 @@ Telegram link integrity contract:
784975
785229
  telegramActiveWorkSessions = /* @__PURE__ */ new Set();
784976
785230
  telegramActiveWorkGenerations = /* @__PURE__ */ new Map();
784977
785231
  telegramActiveWorkStartedAtMs = /* @__PURE__ */ new Map();
785232
+ /**
785233
+ * Native Telegram typing heartbeats owned by the outer work lifecycle.
785234
+ * Group work starts one heartbeat before attention routing and keeps it
785235
+ * alive through the selected reply path and final delivery.
785236
+ */
785237
+ telegramWorkTypingIntervals = /* @__PURE__ */ new Map();
784978
785238
  /** Queued Telegram sessions waiting for a global work slot. */
784979
785239
  telegramQueuedSessionWork = /* @__PURE__ */ new Map();
784980
785240
  telegramQueuedSessionCompletions = /* @__PURE__ */ new Map();
@@ -785466,7 +785726,7 @@ Telegram link integrity contract:
785466
785726
  return !!this.adminAuthChallenge && this.adminAuthChallenge.expiresAtMs > Date.now();
785467
785727
  }
785468
785728
  hashAdminAuthCode(code8) {
785469
- return createHash74("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
785729
+ return createHash75("sha256").update(`omnius-telegram-admin:${code8.trim()}`).digest("hex");
785470
785730
  }
785471
785731
  viewIdForMessage(msg) {
785472
785732
  return `telegram-${this.sessionKeyForMessage(msg).replace(/[^A-Za-z0-9_-]/g, "-")}`;
@@ -785924,6 +786184,9 @@ No scoped reflection artifact exists yet for this chat. Use <code>/reflect</code
785924
786184
  if (idleMs <= maxIdleMs) continue;
785925
786185
  const generation = this.telegramActiveWorkGenerations.get(sessionKey) ?? 0;
785926
786186
  this.telegramActiveWorkGenerations.set(sessionKey, generation + 1);
786187
+ const typingInterval = this.telegramWorkTypingIntervals.get(sessionKey);
786188
+ if (typingInterval) clearInterval(typingInterval);
786189
+ this.telegramWorkTypingIntervals.delete(sessionKey);
785927
786190
  this.telegramActiveWorkSessions.delete(sessionKey);
785928
786191
  this.telegramActiveWorkStartedAtMs.delete(sessionKey);
785929
786192
  this.refreshActiveTelegramInteractionCount();
@@ -786058,6 +786321,18 @@ No scoped reflection artifact exists yet for this chat. Use <code>/reflect</code
786058
786321
  this.telegramActiveWorkSessions.add(work.sessionKey);
786059
786322
  this.telegramActiveWorkStartedAtMs.set(work.sessionKey, Date.now());
786060
786323
  const generation = this.nextTelegramWorkGeneration(work.sessionKey);
786324
+ let workTypingInterval = null;
786325
+ if (work.msg.chatType !== "private" && this.canUseChatActions(work.msg)) {
786326
+ const staleTypingInterval = this.telegramWorkTypingIntervals.get(
786327
+ work.sessionKey
786328
+ );
786329
+ if (staleTypingInterval) clearInterval(staleTypingInterval);
786330
+ workTypingInterval = this.startTypingIndicator(
786331
+ work.msg.chatId,
786332
+ work.msg.messageThreadId
786333
+ );
786334
+ this.telegramWorkTypingIntervals.set(work.sessionKey, workTypingInterval);
786335
+ }
786061
786336
  this.refreshActiveTelegramInteractionCount();
786062
786337
  const completion = this.telegramQueuedSessionCompletions.get(
786063
786338
  work.sessionKey
@@ -786072,6 +786347,10 @@ No scoped reflection artifact exists yet for this chat. Use <code>/reflect</code
786072
786347
  );
786073
786348
  completion?.reject(err);
786074
786349
  }).finally(() => {
786350
+ if (workTypingInterval && this.telegramWorkTypingIntervals.get(work.sessionKey) === workTypingInterval) {
786351
+ clearInterval(workTypingInterval);
786352
+ this.telegramWorkTypingIntervals.delete(work.sessionKey);
786353
+ }
786075
786354
  this.telegramQueuedSessionCompletions.delete(work.sessionKey);
786076
786355
  if (this.telegramWorkGenerationIsCurrent(work.sessionKey, generation)) {
786077
786356
  this.telegramActiveWorkSessions.delete(work.sessionKey);
@@ -786482,7 +786761,7 @@ ${context2}` : context2;
786482
786761
  };
786483
786762
  }
786484
786763
  telegramIntakePath(sessionKey) {
786485
- const digest4 = createHash74("sha256").update(sessionKey).digest("hex").slice(0, 20);
786764
+ const digest4 = createHash75("sha256").update(sessionKey).digest("hex").slice(0, 20);
786486
786765
  return join187(
786487
786766
  this.repoRoot ?? process.cwd(),
786488
786767
  ".omnius",
@@ -787977,11 +788256,11 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
787977
788256
  return payload;
787978
788257
  }
787979
788258
  telegramConversationPath(sessionKey) {
787980
- const safe = createHash74("sha1").update(sessionKey).digest("hex").slice(0, 20);
788259
+ const safe = createHash75("sha1").update(sessionKey).digest("hex").slice(0, 20);
787981
788260
  return join187(this.telegramConversationDir, `${safe}.json`);
787982
788261
  }
787983
788262
  telegramConversationLedgerPath(sessionKey) {
787984
- const safe = createHash74("sha1").update(sessionKey).digest("hex").slice(0, 20);
788263
+ const safe = createHash75("sha1").update(sessionKey).digest("hex").slice(0, 20);
787985
788264
  return join187(this.telegramConversationDir, `${safe}.events.jsonl`);
787986
788265
  }
787987
788266
  telegramDb() {
@@ -788214,7 +788493,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
788214
788493
  relationships: Array.isArray(raw.relationships) ? raw.relationships.slice(0, TELEGRAM_ASSOCIATIVE_RELATION_LIMIT).map((fact) => this.normalizeTelegramAssociativeFact(fact)) : [],
788215
788494
  actions: Array.isArray(raw.actions) ? raw.actions.slice(-TELEGRAM_ASSOCIATIVE_ACTION_LIMIT).map((action) => ({
788216
788495
  id: String(
788217
- action.id || createHash74("sha1").update(JSON.stringify(action)).digest("hex").slice(0, 12)
788496
+ action.id || createHash75("sha1").update(JSON.stringify(action)).digest("hex").slice(0, 12)
788218
788497
  ),
788219
788498
  ts: typeof action.ts === "number" ? action.ts : Date.now(),
788220
788499
  role: action.role === "assistant" ? "assistant" : "user",
@@ -788233,7 +788512,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
788233
788512
  const now2 = Date.now();
788234
788513
  return {
788235
788514
  id: String(
788236
- raw.id || createHash74("sha1").update(text3 || String(now2)).digest("hex").slice(0, 12)
788515
+ raw.id || createHash75("sha1").update(text3 || String(now2)).digest("hex").slice(0, 12)
788237
788516
  ),
788238
788517
  text: text3,
788239
788518
  tags: Array.isArray(raw.tags) ? raw.tags.map(String).slice(0, 16) : [],
@@ -788792,7 +789071,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
788792
789071
  telegramHistoryBackfillMessageId(sessionKey, entry, index) {
788793
789072
  if (typeof entry.messageId === "number" && Number.isFinite(entry.messageId))
788794
789073
  return entry.messageId;
788795
- const digest4 = createHash74("sha1").update(
789074
+ const digest4 = createHash75("sha1").update(
788796
789075
  `${sessionKey}:${index}:${entry.role}:${entry.ts ?? ""}:${entry.text}`
788797
789076
  ).digest("hex").slice(0, 8);
788798
789077
  return -Number.parseInt(digest4, 16);
@@ -790066,7 +790345,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
790066
790345
  const now2 = entry.ts ?? Date.now();
790067
790346
  memory.updatedAt = now2;
790068
790347
  const speaker = telegramHistorySpeaker(entry);
790069
- const actionId = createHash74("sha1").update(
790348
+ const actionId = createHash75("sha1").update(
790070
790349
  `${sessionKey}:${entry.role}:${entry.messageId ?? ""}:${now2}:${entry.text}`
790071
790350
  ).digest("hex").slice(0, 16);
790072
790351
  if (!memory.actions.some((action) => action.id === actionId)) {
@@ -790229,7 +790508,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
790229
790508
  let fact = facts.find((item) => item.text.toLowerCase() === key);
790230
790509
  if (!fact) {
790231
790510
  fact = {
790232
- id: createHash74("sha1").update(`${entry.chatId ?? ""}:${key}`).digest("hex").slice(0, 12),
790511
+ id: createHash75("sha1").update(`${entry.chatId ?? ""}:${key}`).digest("hex").slice(0, 12),
790233
790512
  text: clean7,
790234
790513
  tags: telegramMemoryTags(clean7, entry.mediaSummary),
790235
790514
  speakers: [],
@@ -790314,7 +790593,7 @@ ${antecedents.join("\n")}` : "Immediate antecedents: none.",
790314
790593
  const titleTags = tags.slice(0, 4);
790315
790594
  const title = titleTags.length > 0 ? `${speaker} / ${titleTags.join(" ")}` : `${speaker} / conversation`;
790316
790595
  const card = {
790317
- id: createHash74("sha1").update(`${sessionKey}:${now2}:${speaker}:${text3}`).digest("hex").slice(0, 12),
790596
+ id: createHash75("sha1").update(`${sessionKey}:${now2}:${speaker}:${text3}`).digest("hex").slice(0, 12),
790318
790597
  title,
790319
790598
  notes: [],
790320
790599
  tags: [],
@@ -792447,7 +792726,7 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
792447
792726
  }
792448
792727
  }
792449
792728
  if (issues.length > 0) return { decision: null, issues };
792450
- const decisionId = `tgdec-${createHash74("sha256").update(
792729
+ const decisionId = `tgdec-${createHash75("sha256").update(
792451
792730
  JSON.stringify({
792452
792731
  inputId: packet.inputId,
792453
792732
  route: decision2.route,
@@ -792463,26 +792742,6 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
792463
792742
  validateTelegramInteractionDecision(decision2, packet) {
792464
792743
  return this.validateTelegramInteractionDecisionDetailed(decision2, packet).decision;
792465
792744
  }
792466
- /**
792467
- * Materialize fields that are logical consequences of the model's chosen
792468
- * reply basis. The model still decides whether to reply and why. Once it
792469
- * chooses direct_turn, however, asking it to repeat "self is an addressee"
792470
- * in two additional fields creates three representations of one decision.
792471
- * A disagreement between those copies must not spend another inference.
792472
- */
792473
- normalizeTelegramInteractionDecisionImplications(decision2, packet) {
792474
- if (decision2.replyBasis !== "direct_turn") return decision2;
792475
- return {
792476
- ...decision2,
792477
- addressedActorKeys: [
792478
- .../* @__PURE__ */ new Set([
792479
- ...decision2.addressedActorKeys ?? [],
792480
- packet.selfActorKey
792481
- ])
792482
- ],
792483
- selfRole: "addressee"
792484
- };
792485
- }
792486
792745
  bindTrustedTelegramDecision(decision2, packet) {
792487
792746
  const bound = {
792488
792747
  ...decision2,
@@ -792547,14 +792806,10 @@ arguments=` : ""}` + (chunk.toolCallArgs ?? "");
792547
792806
  requireShouldReply: true
792548
792807
  });
792549
792808
  if (parsed && evidencePacket) parsed.inputId = evidencePacket.inputId;
792550
- const normalized4 = parsed && evidencePacket ? this.normalizeTelegramInteractionDecisionImplications(
792809
+ const validation = parsed && evidencePacket ? this.validateTelegramInteractionDecisionDetailed(
792551
792810
  parsed,
792552
792811
  evidencePacket
792553
- ) : parsed;
792554
- const validation = normalized4 && evidencePacket ? this.validateTelegramInteractionDecisionDetailed(
792555
- normalized4,
792556
- evidencePacket
792557
- ) : { decision: normalized4, issues: [] };
792812
+ ) : { decision: parsed, issues: [] };
792558
792813
  const validated = validation.decision;
792559
792814
  if (!validated) {
792560
792815
  if (diagnostics) {
@@ -792790,6 +793045,9 @@ ${retryText}`,
792790
793045
  agent.typingInterval = null;
792791
793046
  }
792792
793047
  this.stopTelegramPublicProgressMessage(agent);
793048
+ const workTypingInterval = this.telegramWorkTypingIntervals.get(sessionKey);
793049
+ if (workTypingInterval) clearInterval(workTypingInterval);
793050
+ this.telegramWorkTypingIntervals.delete(sessionKey);
792793
793051
  try {
792794
793052
  agent.runner?.abort?.();
792795
793053
  } catch {
@@ -793146,13 +793404,9 @@ ${this.quoteTelegramContextBlock(msg.text, 1200)}`
793146
793404
  requireShouldReply: true
793147
793405
  });
793148
793406
  if (parsed) parsed.inputId = evidencePacket.inputId;
793149
- const normalized4 = parsed ? this.normalizeTelegramInteractionDecisionImplications(
793407
+ const initialValidation = parsed ? this.validateTelegramInteractionDecisionDetailed(
793150
793408
  parsed,
793151
793409
  evidencePacket
793152
- ) : null;
793153
- const initialValidation = normalized4 ? this.validateTelegramInteractionDecisionDetailed(
793154
- normalized4,
793155
- evidencePacket
793156
793410
  ) : {
793157
793411
  decision: null,
793158
793412
  issues: []
@@ -793550,7 +793804,7 @@ ${list}` : "No shared group target is currently known for this sender. Ask in th
793550
793804
  }
793551
793805
  telegramRunnerStateDir(sessionKey) {
793552
793806
  if (!this.repoRoot) return void 0;
793553
- const safe = createHash74("sha1").update(sessionKey).digest("hex").slice(0, 20);
793807
+ const safe = createHash75("sha1").update(sessionKey).digest("hex").slice(0, 20);
793554
793808
  return join187(this.repoRoot, ".omnius", "telegram-runner-state", safe);
793555
793809
  }
793556
793810
  buildTelegramAdminOverviewContext(currentSessionKey) {
@@ -793995,6 +794249,10 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
793995
794249
  );
793996
794250
  }
793997
794251
  this.telegramQueuedSessionCompletions.clear();
794252
+ for (const interval of this.telegramWorkTypingIntervals.values()) {
794253
+ clearInterval(interval);
794254
+ }
794255
+ this.telegramWorkTypingIntervals.clear();
793998
794256
  this.telegramActiveWorkSessions.clear();
793999
794257
  this.telegramActiveWorkGenerations.clear();
794000
794258
  this.telegramActiveWorkStartedAtMs.clear();
@@ -794137,17 +794395,21 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
794137
794395
  }
794138
794396
  // ── Typing indicator ──────────────────────────────────────────────────
794139
794397
  /** Start sending "typing" indicator every 4 seconds */
794140
- startTypingIndicator(chatId) {
794141
- this.sendChatAction(chatId, "typing").catch(() => {
794398
+ startTypingIndicator(chatId, messageThreadId) {
794399
+ this.sendChatAction(chatId, "typing", messageThreadId).catch(() => {
794142
794400
  });
794143
794401
  return setInterval(() => {
794144
- this.sendChatAction(chatId, "typing").catch(() => {
794402
+ this.sendChatAction(chatId, "typing", messageThreadId).catch(() => {
794145
794403
  });
794146
794404
  }, 4e3);
794147
794405
  }
794148
794406
  /** Send a chat action (typing indicator) */
794149
- async sendChatAction(chatId, action) {
794150
- await this.apiCall("sendChatAction", { chat_id: chatId, action });
794407
+ async sendChatAction(chatId, action, messageThreadId) {
794408
+ await this.apiCall("sendChatAction", {
794409
+ chat_id: chatId,
794410
+ action,
794411
+ ...messageThreadId !== void 0 ? { message_thread_id: messageThreadId } : {}
794412
+ });
794151
794413
  }
794152
794414
  createTelegramGenerativeProgressBridge(chatId, msg) {
794153
794415
  if (chatId === void 0) return void 0;
@@ -795697,8 +795959,11 @@ Join: ${newUrl}`
795697
795959
  subAgent.viewId,
795698
795960
  `✈ Telegram message from @${msg.username}: ${msg.text}`
795699
795961
  );
795700
- if (this.canUseChatActions(msg)) {
795701
- subAgent.typingInterval = this.startTypingIndicator(msg.chatId);
795962
+ if (this.canUseChatActions(msg) && !this.telegramWorkTypingIntervals.has(sessionKey)) {
795963
+ subAgent.typingInterval = this.startTypingIndicator(
795964
+ msg.chatId,
795965
+ msg.messageThreadId
795966
+ );
795702
795967
  }
795703
795968
  this.tuiWrite(
795704
795969
  () => renderTelegramSubAgentStart(msg.username, msg.text, isAdminDM)
@@ -796058,8 +796323,11 @@ ${errMsg}`
796058
796323
  `route: chat (${this.interactionMode}) with admin tools`
796059
796324
  );
796060
796325
  this.subAgentViewCallbacks?.onStatus(subAgent.viewId, "running");
796061
- if (this.canUseChatActions(msg)) {
796062
- subAgent.typingInterval = this.startTypingIndicator(msg.chatId);
796326
+ if (this.canUseChatActions(msg) && !this.telegramWorkTypingIntervals.has(sessionKey)) {
796327
+ subAgent.typingInterval = this.startTypingIndicator(
796328
+ msg.chatId,
796329
+ msg.messageThreadId
796330
+ );
796063
796331
  }
796064
796332
  this.tuiWrite(
796065
796333
  () => renderTelegramSubAgentEvent(
@@ -796323,8 +796591,11 @@ ${errMsg}`
796323
796591
  `route: chat (${this.interactionMode})`
796324
796592
  );
796325
796593
  this.subAgentViewCallbacks?.onStatus(viewId, "running");
796326
- if (this.canUseChatActions(msg)) {
796327
- typingInterval = this.startTypingIndicator(msg.chatId);
796594
+ if (this.canUseChatActions(msg) && !this.telegramWorkTypingIntervals.has(sessionKey)) {
796595
+ typingInterval = this.startTypingIndicator(
796596
+ msg.chatId,
796597
+ msg.messageThreadId
796598
+ );
796328
796599
  }
796329
796600
  this.tuiWrite(
796330
796601
  () => renderTelegramSubAgentEvent(
@@ -799172,7 +799443,7 @@ Scoped workspace: ${scopedRoot}`,
799172
799443
  );
799173
799444
  }
799174
799445
  telegramModerationActionDigest(action) {
799175
- return createHash74("sha256").update(JSON.stringify(action)).digest("hex");
799446
+ return createHash75("sha256").update(JSON.stringify(action)).digest("hex");
799176
799447
  }
799177
799448
  async requireTelegramModerationGroup(chatId) {
799178
799449
  const result = await this.apiCall("getChat", { chat_id: chatId });
@@ -805907,7 +806178,7 @@ import { cwd } from "node:process";
805907
806178
  import { resolve as resolve85, join as join190, dirname as dirname69, extname as extname23, relative as relative24, sep as sep11 } from "node:path";
805908
806179
  import { createRequire as createRequire9 } from "node:module";
805909
806180
  import { fileURLToPath as fileURLToPath33 } from "node:url";
805910
- import { createHash as createHash75 } from "node:crypto";
806181
+ import { createHash as createHash76 } from "node:crypto";
805911
806182
  import {
805912
806183
  readFileSync as readFileSync152,
805913
806184
  writeFileSync as writeFileSync103,
@@ -806780,7 +807051,7 @@ function truncateSubAgentViewText(s2, n2) {
806780
807051
  return s2.length > n2 ? `${s2.slice(0, n2)}…` : s2;
806781
807052
  }
806782
807053
  function childAgentTaskHash(task) {
806783
- return createHash75("sha256").update(task).digest("hex").slice(0, 12);
807054
+ return createHash76("sha256").update(task).digest("hex").slice(0, 12);
806784
807055
  }
806785
807056
  function stripAnsiForParentContext(value2) {
806786
807057
  return value2.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, "");
@@ -816611,13 +816882,13 @@ ${taskInput}`;
816611
816882
  writeContent(() => renderError(errMsg));
816612
816883
  if (failureStore) {
816613
816884
  try {
816614
- const { createHash: createHash80 } = await import("node:crypto");
816885
+ const { createHash: createHash81 } = await import("node:crypto");
816615
816886
  failureStore.insert({
816616
816887
  taskId: "",
816617
816888
  sessionId: `${Date.now()}`,
816618
816889
  repoRoot,
816619
816890
  failureType: "runtime-error",
816620
- fingerprint: createHash80("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
816891
+ fingerprint: createHash81("sha256").update(errMsg.slice(0, 200)).digest("hex").slice(0, 16),
816621
816892
  filePath: null,
816622
816893
  errorMessage: errMsg.slice(0, 500),
816623
816894
  context: null,
@@ -818442,14 +818713,14 @@ var init_access_policy = __esm({
818442
818713
  });
818443
818714
 
818444
818715
  // packages/cli/src/api/project-preferences.ts
818445
- import { createHash as createHash76 } from "node:crypto";
818716
+ import { createHash as createHash77 } from "node:crypto";
818446
818717
  import { existsSync as existsSync182, mkdirSync as mkdirSync117, readFileSync as readFileSync154, renameSync as renameSync31, writeFileSync as writeFileSync105, unlinkSync as unlinkSync46 } from "node:fs";
818447
818718
  import { homedir as homedir65 } from "node:os";
818448
818719
  import { join as join193, resolve as resolve89 } from "node:path";
818449
818720
  import { randomUUID as randomUUID34 } from "node:crypto";
818450
818721
  function projectKey(root) {
818451
818722
  const canonical3 = resolve89(root);
818452
- return createHash76("sha256").update(canonical3).digest("hex").slice(0, 16);
818723
+ return createHash77("sha256").update(canonical3).digest("hex").slice(0, 16);
818453
818724
  }
818454
818725
  function projectDir(root) {
818455
818726
  return join193(PROJECTS_DIR, projectKey(root));
@@ -818540,7 +818811,7 @@ import { existsSync as existsSync183, mkdirSync as mkdirSync118, readFileSync as
818540
818811
  import { homedir as homedir66 } from "node:os";
818541
818812
  import { dirname as dirname70, join as join194 } from "node:path";
818542
818813
  import { fileURLToPath as fileURLToPath34 } from "node:url";
818543
- import { createHash as createHash77 } from "node:crypto";
818814
+ import { createHash as createHash78 } from "node:crypto";
818544
818815
  function home() {
818545
818816
  return process.env["OMNIUS_HOME"]?.trim() || join194(homedir66(), ".omnius");
818546
818817
  }
@@ -818724,7 +818995,7 @@ async function ensureJetPackTorchvision(python2) {
818724
818995
  "OpenCLIP requires CUDA-compatible torchvision. Install the JetPack vendor torchvision for OMNIUS_VISION_PYTHON, or set OMNIUS_VISION_TORCHVISION_WHEEL to a local wheel and OMNIUS_VISION_TORCHVISION_WHEEL_SHA256 to its SHA-256. Generic PyPI torchvision is intentionally blocked."
818725
818996
  );
818726
818997
  }
818727
- const actualSha256 = createHash77("sha256").update(readFileSync155(wheel)).digest("hex");
818998
+ const actualSha256 = createHash78("sha256").update(readFileSync155(wheel)).digest("hex");
818728
818999
  if (actualSha256 !== expectedSha256) {
818729
819000
  throw new VisionEmbeddingRuntimeError(
818730
819001
  "vision_runtime_not_ready",
@@ -819654,7 +819925,7 @@ var init_disk_task_output = __esm({
819654
819925
  });
819655
819926
 
819656
819927
  // packages/cli/src/api/http.ts
819657
- import { createHash as createHash78 } from "node:crypto";
819928
+ import { createHash as createHash79 } from "node:crypto";
819658
819929
  function problemDetails(opts) {
819659
819930
  const p2 = {
819660
819931
  type: opts.type ?? "about:blank",
@@ -819717,7 +819988,7 @@ function paginated(items, page2, total) {
819717
819988
  }
819718
819989
  function computeEtag(payload) {
819719
819990
  const json2 = typeof payload === "string" ? payload : JSON.stringify(payload);
819720
- const hash2 = createHash78("sha1").update(json2).digest("hex").slice(0, 16);
819991
+ const hash2 = createHash79("sha1").update(json2).digest("hex").slice(0, 16);
819721
819992
  return `W/"${hash2}"`;
819722
819993
  }
819723
819994
  function checkNotModified(req3, res, etag) {
@@ -843487,7 +843758,7 @@ import {
843487
843758
  readSync as readSync5,
843488
843759
  closeSync as closeSync12
843489
843760
  } from "node:fs";
843490
- import { createHash as createHash79, randomBytes as randomBytes31, randomUUID as randomUUID35, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
843761
+ import { createHash as createHash80, randomBytes as randomBytes31, randomUUID as randomUUID35, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
843491
843762
  function memoryDbPaths3(baseDir = process.cwd()) {
843492
843763
  const dir = join206(baseDir, ".omnius");
843493
843764
  return {
@@ -843513,7 +843784,7 @@ function readServerPackageIdentity() {
843513
843784
  return {
843514
843785
  version: pkg.version ?? "0.0.0",
843515
843786
  packagePath: pkgPath,
843516
- packageHash: createHash79("sha256").update(raw).digest("hex")
843787
+ packageHash: createHash80("sha256").update(raw).digest("hex")
843517
843788
  };
843518
843789
  }
843519
843790
  } catch {
@@ -853315,7 +853586,7 @@ function listScheduledTasks() {
853315
853586
  );
853316
853587
  const enabled2 = typeof t2?.enabled === "boolean" ? t2.enabled : true;
853317
853588
  const realId = typeof t2?.id === "string" && t2.id ? t2.id : null;
853318
- const fallbackId = createHash79("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
853589
+ const fallbackId = createHash80("sha1").update(`${file}#${i2}`).digest("hex").slice(0, 16);
853319
853590
  const uid = realId || fallbackId;
853320
853591
  const key = `${uid}`;
853321
853592
  if (seen.has(key)) return;
@@ -853453,8 +853724,8 @@ function deleteScheduledById(id2) {
853453
853724
  if (typeof entry?.id === "string" && entry.id && !candidates.includes(entry.id))
853454
853725
  candidates.push(entry.id);
853455
853726
  try {
853456
- const { createHash: createHash80 } = require4("node:crypto");
853457
- const fallback = createHash80("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
853727
+ const { createHash: createHash81 } = require4("node:crypto");
853728
+ const fallback = createHash81("sha1").update(`${target.file}#${target.index}`).digest("hex").slice(0, 16);
853458
853729
  if (!candidates.includes(fallback)) candidates.push(fallback);
853459
853730
  } catch {
853460
853731
  }