switchroom 0.18.11 → 0.18.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/agent-scheduler/index.js +37 -5
  2. package/dist/auth-broker/index.js +116 -78
  3. package/dist/cli/hindsight-mental-model-pretool.mjs +39 -0
  4. package/dist/cli/ms-365-write-pretool.mjs +31 -8
  5. package/dist/cli/notion-write-pretool.mjs +38 -6
  6. package/dist/cli/skill-validate-pretool.mjs +144 -2847
  7. package/dist/cli/switchroom.js +3529 -4543
  8. package/dist/cli/ui/index.html +163 -17
  9. package/dist/host-control/main.js +605 -2847
  10. package/dist/vault/approvals/kernel-server.js +120 -13
  11. package/dist/vault/broker/server.js +259 -157
  12. package/package.json +3 -4
  13. package/profiles/_base/start.sh.hbs +65 -0
  14. package/profiles/_shared/vault-protocol.md.hbs +3 -1
  15. package/profiles/coding/CLAUDE.md.hbs +1 -1
  16. package/profiles/default/CLAUDE.md.hbs +2 -2
  17. package/profiles/executive-assistant/CLAUDE.md.hbs +1 -1
  18. package/profiles/health-coach/CLAUDE.md.hbs +1 -1
  19. package/telegram-plugin/bridge/bridge.ts +37 -0
  20. package/telegram-plugin/bridge/inbound-dedup.ts +101 -0
  21. package/telegram-plugin/dist/bridge/bridge.js +122 -4
  22. package/telegram-plugin/dist/gateway/gateway.js +4213 -3288
  23. package/telegram-plugin/dist/server.js +139 -5
  24. package/telegram-plugin/flood-circuit-breaker.ts +493 -21
  25. package/telegram-plugin/format.ts +19 -0
  26. package/telegram-plugin/gateway/approval-hold.ts +602 -0
  27. package/telegram-plugin/gateway/auth-command.ts +92 -2
  28. package/telegram-plugin/gateway/auth-loopback-relay.ts +670 -0
  29. package/telegram-plugin/gateway/boot-card.ts +12 -5
  30. package/telegram-plugin/gateway/callback-query-handlers.ts +88 -1
  31. package/telegram-plugin/gateway/config-approval-handler.ts +6 -1
  32. package/telegram-plugin/gateway/disconnect-flush.ts +19 -0
  33. package/telegram-plugin/gateway/dm-pin-sweep.test.ts +251 -0
  34. package/telegram-plugin/gateway/dm-pin-sweep.ts +178 -0
  35. package/telegram-plugin/gateway/gateway.ts +1695 -230
  36. package/telegram-plugin/gateway/hostd-dispatch.ts +23 -0
  37. package/telegram-plugin/gateway/idle-clear.ts +90 -6
  38. package/telegram-plugin/gateway/inbound-delivery-machine-shadow.ts +26 -5
  39. package/telegram-plugin/gateway/inject-handler.ts +8 -0
  40. package/telegram-plugin/gateway/ipc-protocol.ts +46 -3
  41. package/telegram-plugin/gateway/ipc-server.ts +43 -0
  42. package/telegram-plugin/gateway/mental-model-propose-resolve.ts +145 -37
  43. package/telegram-plugin/gateway/model-command.ts +9 -3
  44. package/telegram-plugin/gateway/pending-session-command.ts +13 -1
  45. package/telegram-plugin/gateway/permission-ttl-sweep.ts +66 -0
  46. package/telegram-plugin/gateway/pre-approval-check.ts +74 -0
  47. package/telegram-plugin/gateway/queued-card-store.ts +217 -0
  48. package/telegram-plugin/gateway/session-model-file.ts +26 -1
  49. package/telegram-plugin/gateway/turn-end-gate-backstop.ts +59 -0
  50. package/telegram-plugin/gateway/turn-end-gate.ts +95 -0
  51. package/telegram-plugin/gateway/turn-typing-loop.ts +10 -2
  52. package/telegram-plugin/gateway/unhandled-rejection-policy.ts +13 -0
  53. package/telegram-plugin/history.ts +51 -0
  54. package/telegram-plugin/hooks/dispatch-claim-scan.mjs +259 -0
  55. package/telegram-plugin/hooks/dispatch-claim-stop.mjs +129 -0
  56. package/telegram-plugin/hooks/hooks.json +9 -0
  57. package/telegram-plugin/inline-keyboard-callbacks.ts +303 -2
  58. package/telegram-plugin/model-unavailable.ts +41 -11
  59. package/telegram-plugin/operator-events.ts +23 -0
  60. package/telegram-plugin/outbound-field-redact.ts +69 -0
  61. package/telegram-plugin/package.json +0 -1
  62. package/telegram-plugin/permission-rule.ts +1 -0
  63. package/telegram-plugin/permission-title.ts +1 -0
  64. package/telegram-plugin/render/render.ts +32 -14
  65. package/telegram-plugin/retry-api-call.ts +212 -2
  66. package/telegram-plugin/scoped-approval.ts +11 -2
  67. package/telegram-plugin/secret-detect/chunker.ts +18 -4
  68. package/telegram-plugin/secret-detect/index.ts +12 -56
  69. package/telegram-plugin/send-gate-degraded.test.ts +574 -0
  70. package/telegram-plugin/send-gate-observability.test.ts +470 -0
  71. package/telegram-plugin/send-gate-observability.ts +355 -0
  72. package/telegram-plugin/send-gate.test.ts +717 -0
  73. package/telegram-plugin/send-gate.ts +1056 -0
  74. package/telegram-plugin/session-tail.ts +82 -7
  75. package/telegram-plugin/shared/bot-runtime.ts +17 -5
  76. package/telegram-plugin/shared/gw-trace-gate.ts +105 -0
  77. package/telegram-plugin/status-pin-driver.ts +52 -7
  78. package/telegram-plugin/status-pin.ts +81 -0
  79. package/telegram-plugin/subagent-watcher.ts +173 -18
  80. package/telegram-plugin/tests/activity-card-wiring.test.ts +18 -5
  81. package/telegram-plugin/tests/approval-hold-harness.ts +425 -0
  82. package/telegram-plugin/tests/approval-hold-outcome.test.ts +327 -0
  83. package/telegram-plugin/tests/approval-hold-record.test.ts +531 -0
  84. package/telegram-plugin/tests/approval-hold-redeliver.test.ts +602 -0
  85. package/telegram-plugin/tests/auth-loopback-relay.test.ts +533 -0
  86. package/telegram-plugin/tests/boot-card-flood-suppress.test.ts +53 -7
  87. package/telegram-plugin/tests/busy-key-reaper.test.ts +1 -0
  88. package/telegram-plugin/tests/callback-query-handlers.test.ts +65 -0
  89. package/telegram-plugin/tests/dispatch-claim-scan.test.ts +250 -0
  90. package/telegram-plugin/tests/flood-breaker-blindness.test.ts +213 -0
  91. package/telegram-plugin/tests/flood-windows-persistence.test.ts +224 -0
  92. package/telegram-plugin/tests/gateway-boot-marker-clear.test.ts +3 -3
  93. package/telegram-plugin/tests/gateway-disconnect-flush.test.ts +29 -1
  94. package/telegram-plugin/tests/gateway-loopback-paste-redact.test.ts +66 -0
  95. package/telegram-plugin/tests/gateway-outbound-redact.test.ts +57 -0
  96. package/telegram-plugin/tests/gw-trace-gate.test.ts +105 -0
  97. package/telegram-plugin/tests/history.test.ts +115 -0
  98. package/telegram-plugin/tests/idle-clear.test.ts +233 -3
  99. package/telegram-plugin/tests/inbound-dedup.test.ts +93 -0
  100. package/telegram-plugin/tests/inbound-message-types.test.ts +5 -1
  101. package/telegram-plugin/tests/inline-keyboard-callbacks.test.ts +448 -0
  102. package/telegram-plugin/tests/ipc-server-check-pre-approved.test.ts +194 -0
  103. package/telegram-plugin/tests/mental-model-propose-resolve.test.ts +123 -0
  104. package/telegram-plugin/tests/missed-approvals-wiring.test.ts +1 -1
  105. package/telegram-plugin/tests/model-command.test.ts +14 -0
  106. package/telegram-plugin/tests/operator-events-session-tail.test.ts +74 -0
  107. package/telegram-plugin/tests/outbound-field-redact.test.ts +107 -0
  108. package/telegram-plugin/tests/pending-session-command.test.ts +21 -0
  109. package/telegram-plugin/tests/permission-card-routing.test.ts +30 -5
  110. package/telegram-plugin/tests/permission-no-repeat-wiring.test.ts +8 -7
  111. package/telegram-plugin/tests/permission-rearm-wiring.test.ts +1 -1
  112. package/telegram-plugin/tests/pre-approval-check.test.ts +148 -0
  113. package/telegram-plugin/tests/queued-card-store.test.ts +232 -0
  114. package/telegram-plugin/tests/reaction-flush-turn-gated.test.ts +100 -0
  115. package/telegram-plugin/tests/reaction-gate-routing.test.ts +173 -0
  116. package/telegram-plugin/tests/render/render.test.ts +88 -0
  117. package/telegram-plugin/tests/retry-api-call.test.ts +398 -0
  118. package/telegram-plugin/tests/scoped-approval.test.ts +27 -0
  119. package/telegram-plugin/tests/secret-detect-chunk-overlap.test.ts +65 -0
  120. package/telegram-plugin/tests/secret-detect-oauth-code.test.ts +5 -4
  121. package/telegram-plugin/tests/session-model-file.test.ts +50 -0
  122. package/telegram-plugin/tests/session-tail-sidecar-reap.test.ts +268 -0
  123. package/telegram-plugin/tests/status-pin-boot-recovery.test.ts +35 -14
  124. package/telegram-plugin/tests/status-pin.test.ts +275 -1
  125. package/telegram-plugin/tests/subagent-watcher-deferral-log-ratelimit.test.ts +316 -0
  126. package/telegram-plugin/tests/subagent-watcher-fd-leak.test.ts +275 -0
  127. package/telegram-plugin/tests/turn-end-gate-backstop.test.ts +92 -0
  128. package/telegram-plugin/tests/turn-end-gate.test.ts +137 -0
  129. package/telegram-plugin/tests/typing-emitter.test.ts +586 -0
  130. package/telegram-plugin/tests/unhandled-rejection-policy.test.ts +20 -0
  131. package/telegram-plugin/tests/worktree-watch-cwds.test.ts +215 -1
  132. package/telegram-plugin/typing-emitter.ts +224 -0
  133. package/telegram-plugin/uat/scenarios/jtbd-feel-like-a-colleague-dm.test.ts +136 -0
  134. package/telegram-plugin/welcome-text.ts +42 -0
  135. package/telegram-plugin/worktree-watch-cwds.ts +194 -5
  136. package/vendor/hindsight-memory/scripts/drain_pending.py +22 -6
  137. package/vendor/hindsight-memory/scripts/lib/client.py +12 -5
  138. package/vendor/hindsight-memory/scripts/lib/directives.py +38 -3
  139. package/vendor/hindsight-memory/scripts/lib/pending.py +36 -9
  140. package/vendor/hindsight-memory/scripts/session_end.py +14 -3
  141. package/vendor/hindsight-memory/scripts/session_start.py +21 -0
  142. package/vendor/hindsight-memory/scripts/tests/test_directives.py +38 -0
  143. package/vendor/hindsight-memory/tests/test_drain_pending.py +68 -0
  144. package/vendor/hindsight-memory/tests/test_pending.py +44 -0
  145. package/vendor/hindsight-memory/tests/test_session_end_pending.py +38 -0
  146. package/vendor/hindsight-memory/tests/test_session_start_drain.py +155 -0
  147. package/telegram-plugin/channel-envelope-safety.test.ts +0 -56
  148. package/telegram-plugin/channel-envelope-safety.ts +0 -56
  149. package/telegram-plugin/secret-detect/secretlint-source.ts +0 -95
  150. package/telegram-plugin/tests/secret-detect-secretlint.test.ts +0 -105
@@ -7010,6 +7010,13 @@ var require_dist = __commonJS((exports) => {
7010
7010
  exports.visitAsync = visit.visitAsync;
7011
7011
  });
7012
7012
 
7013
+ // src/util/atomic.ts
7014
+ import { closeSync, constants, fsyncSync, openSync, renameSync as renameSync2, rmSync, writeSync } from "node:fs";
7015
+ var TMP_OPEN_FLAGS;
7016
+ var init_atomic = __esm(() => {
7017
+ TMP_OPEN_FLAGS = constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0);
7018
+ });
7019
+
7013
7020
  // node_modules/.bun/handlebars@4.7.9/node_modules/handlebars/dist/cjs/handlebars/utils.js
7014
7021
  var require_utils = __commonJS((exports) => {
7015
7022
  exports.__esModule = true;
@@ -8373,7 +8380,7 @@ var require_parser2 = __commonJS((exports, module) => {
8373
8380
  throw new Error(str);
8374
8381
  },
8375
8382
  parse: function parse(input) {
8376
- var self2 = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
8383
+ var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
8377
8384
  this.lexer.setInput(input);
8378
8385
  this.lexer.yy = this.yy;
8379
8386
  this.yy.lexer = this.lexer;
@@ -8392,9 +8399,9 @@ var require_parser2 = __commonJS((exports, module) => {
8392
8399
  }
8393
8400
  function lex() {
8394
8401
  var token;
8395
- token = self2.lexer.lex() || 1;
8402
+ token = self.lexer.lex() || 1;
8396
8403
  if (typeof token !== "number") {
8397
- token = self2.symbols_[token] || token;
8404
+ token = self.symbols_[token] || token;
8398
8405
  }
8399
8406
  return token;
8400
8407
  }
@@ -12545,2739 +12552,29 @@ var require_printer = __commonJS((exports) => {
12545
12552
  for (var i = 0, l = pairs.length;i < l; i++) {
12546
12553
  joinedPairs.push(this.accept(pairs[i]));
12547
12554
  }
12548
- return "HASH{" + joinedPairs.join(", ") + "}";
12549
- };
12550
- PrintVisitor.prototype.HashPair = function(pair) {
12551
- return pair.key + "=" + this.accept(pair.value);
12552
- };
12553
- });
12554
-
12555
- // node_modules/.bun/handlebars@4.7.9/node_modules/handlebars/lib/index.js
12556
- var require_lib = __commonJS((exports, module) => {
12557
- var handlebars = require_handlebars()["default"];
12558
- var printer = require_printer();
12559
- handlebars.PrintVisitor = printer.PrintVisitor;
12560
- handlebars.print = printer.print;
12561
- module.exports = handlebars;
12562
- function extension(module2, filename) {
12563
- var fs = __require("fs");
12564
- var templateString = fs.readFileSync(filename, "utf8");
12565
- module2.exports = handlebars.compile(templateString);
12566
- }
12567
- if (__require.extensions) {
12568
- __require.extensions[".handlebars"] = extension;
12569
- __require.extensions[".hbs"] = extension;
12570
- }
12571
- });
12572
-
12573
- // telegram-plugin/secret-detect/suppressor.ts
12574
- function isSuppressed(text, start, end) {
12575
- const left = Math.max(0, start - WINDOW);
12576
- const right = Math.min(text.length, end + WINDOW);
12577
- const context = text.slice(left, start) + text.slice(end, right);
12578
- return MARKER_RE.test(context);
12579
- }
12580
- var MARKERS, WINDOW = 40, MARKER_RE;
12581
- var init_suppressor = __esm(() => {
12582
- MARKERS = ["test", "mock", "example", "fixture", "dummy"];
12583
- MARKER_RE = new RegExp(`\\b(?:${MARKERS.join("|")})\\b`, "i");
12584
- });
12585
-
12586
- // telegram-plugin/secret-detect/slug.ts
12587
- function sanitizeKeyName(raw) {
12588
- const up = raw.toUpperCase();
12589
- const cleaned = up.replace(/[^A-Z0-9_]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
12590
- return cleaned.length > 0 ? cleaned : "SECRET";
12591
- }
12592
- function datePart(now = new Date) {
12593
- const y = now.getUTCFullYear();
12594
- const m = String(now.getUTCMonth() + 1).padStart(2, "0");
12595
- const d = String(now.getUTCDate()).padStart(2, "0");
12596
- return `${y}${m}${d}`;
12597
- }
12598
- function deriveSlug(inputs, existing) {
12599
- let base;
12600
- if (inputs.key_name && inputs.key_name.trim().length > 0) {
12601
- base = sanitizeKeyName(inputs.key_name);
12602
- } else {
12603
- base = `${inputs.rule_id}_${datePart(inputs.now)}`;
12604
- }
12605
- if (!existing.has(base))
12606
- return base;
12607
- let n = 2;
12608
- while (existing.has(`${base}_${n}`))
12609
- n++;
12610
- return `${base}_${n}`;
12611
- }
12612
-
12613
- // node_modules/.bun/boundary@2.0.0/node_modules/boundary/lib/index.js
12614
- var require_lib2 = __commonJS((exports2) => {
12615
- Object.defineProperty(exports2, "__esModule", { value: true });
12616
- exports2.binarySearch = exports2.upperBound = exports2.lowerBound = exports2.compare = undefined;
12617
- function compare(v1, v2) {
12618
- return v1 < v2;
12619
- }
12620
- exports2.compare = compare;
12621
- function upperBound(array, value, comp = compare) {
12622
- let len = array.length;
12623
- let i = 0;
12624
- while (len) {
12625
- let diff = len >>> 1;
12626
- let cursor = i + diff;
12627
- if (comp(value, array[cursor])) {
12628
- len = diff;
12629
- } else {
12630
- i = cursor + 1;
12631
- len -= diff + 1;
12632
- }
12633
- }
12634
- return i;
12635
- }
12636
- exports2.upperBound = upperBound;
12637
- function lowerBound(array, value, comp = compare) {
12638
- let len = array.length;
12639
- let i = 0;
12640
- while (len) {
12641
- let diff = len >>> 1;
12642
- let cursor = i + diff;
12643
- if (comp(array[cursor], value)) {
12644
- i = cursor + 1;
12645
- len -= diff + 1;
12646
- } else {
12647
- len = diff;
12648
- }
12649
- }
12650
- return i;
12651
- }
12652
- exports2.lowerBound = lowerBound;
12653
- function binarySearch(array, value, comp = compare) {
12654
- let cursor = lowerBound(array, value, comp);
12655
- return cursor !== array.length && !comp(value, array[cursor]);
12656
- }
12657
- exports2.binarySearch = binarySearch;
12658
- });
12659
-
12660
- // node_modules/.bun/structured-source@4.0.0/node_modules/structured-source/lib/structured-source.js
12661
- var require_structured_source = __commonJS((exports2) => {
12662
- Object.defineProperty(exports2, "__esModule", { value: true });
12663
- exports2.StructuredSource = undefined;
12664
- var boundary_1 = require_lib2();
12665
-
12666
- class StructuredSource {
12667
- constructor(source) {
12668
- this.indice = [0];
12669
- let regexp = /[\r\n\u2028\u2029]/g;
12670
- const length = source.length;
12671
- regexp.lastIndex = 0;
12672
- while (true) {
12673
- let result = regexp.exec(source);
12674
- if (!result) {
12675
- break;
12676
- }
12677
- let index = result.index;
12678
- if (source.charCodeAt(index) === 13 && source.charCodeAt(index + 1) === 10) {
12679
- index += 1;
12680
- }
12681
- let nextIndex = index + 1;
12682
- if (length < nextIndex) {
12683
- break;
12684
- }
12685
- this.indice.push(nextIndex);
12686
- regexp.lastIndex = nextIndex;
12687
- }
12688
- }
12689
- get line() {
12690
- return this.indice.length;
12691
- }
12692
- locationToRange(loc) {
12693
- return [this.positionToIndex(loc.start), this.positionToIndex(loc.end)];
12694
- }
12695
- rangeToLocation(range) {
12696
- return {
12697
- start: this.indexToPosition(range[0]),
12698
- end: this.indexToPosition(range[1])
12699
- };
12700
- }
12701
- positionToIndex(pos) {
12702
- let start = this.indice[pos.line - 1];
12703
- return start + pos.column;
12704
- }
12705
- indexToPosition(index) {
12706
- const startLine = (0, boundary_1.upperBound)(this.indice, index);
12707
- return {
12708
- line: startLine,
12709
- column: index - this.indice[startLine - 1]
12710
- };
12711
- }
12712
- }
12713
- exports2.StructuredSource = StructuredSource;
12714
- });
12715
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/SecretLintSourceCodeImpl.js
12716
- var import_structured_source;
12717
- var init_SecretLintSourceCodeImpl = __esm(() => {
12718
- import_structured_source = __toESM(require_structured_source(), 1);
12719
- });
12720
-
12721
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/helper/promise-event-emitter.js
12722
- class EventEmitter {
12723
- #listeners = new Map;
12724
- on(type, listener) {
12725
- const prevSet = this.#listeners.get(type);
12726
- const listenerSet = prevSet ?? new Set;
12727
- listenerSet?.add(listener);
12728
- this.#listeners.set(type, listenerSet);
12729
- }
12730
- emit(type, ...args) {
12731
- const listenerSet = this.#listeners.get(type);
12732
- if (!listenerSet) {
12733
- return;
12734
- }
12735
- for (const listenerSetElement of listenerSet) {
12736
- listenerSetElement(...args);
12737
- }
12738
- }
12739
- off(type, listener) {
12740
- const listenerSet = this.#listeners.get(type);
12741
- if (!listenerSet) {
12742
- return;
12743
- }
12744
- for (const listenerSetElement of listenerSet) {
12745
- if (listenerSetElement === listener) {
12746
- listenerSet.delete(listener);
12747
- }
12748
- }
12749
- }
12750
- removeAllListeners() {
12751
- this.#listeners.clear();
12752
- }
12753
- listenerCount(type) {
12754
- return this.#listeners.get(type)?.size ?? 0;
12755
- }
12756
- listeners(type) {
12757
- return Array.from(this.#listeners.get(type) ?? []);
12758
- }
12759
- }
12760
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RuleContext.js
12761
- var init_RuleContext = () => {};
12762
- // node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/index.js
12763
- class SecretLintProfiler {
12764
- perf;
12765
- entries = [];
12766
- measures = [];
12767
- executionPromises = [];
12768
- constructor(options) {
12769
- this.perf = options.perf;
12770
- const pattern = /(.*?)::end(\|\|.*)?/;
12771
- const observer = new options.PerformanceObserver((items) => {
12772
- const entries = items.getEntries();
12773
- entries.forEach((entry) => {
12774
- if (entry.entryType === "mark") {
12775
- const match = entry.name.match(pattern);
12776
- const endIdentifier = match ? match[1] : undefined;
12777
- const suffix = match && match[2] ? match[2] : "";
12778
- if (endIdentifier) {
12779
- const startIdentifier = `${endIdentifier}::start`;
12780
- this.entries.find((savedEntry) => {
12781
- return savedEntry.name === startIdentifier;
12782
- });
12783
- if (startIdentifier) {
12784
- this.executionPromises.push(Promise.resolve().then(() => {
12785
- this.perf.measure(endIdentifier + suffix, `${endIdentifier}::start${suffix}`, `${endIdentifier}::end${suffix}`);
12786
- }));
12787
- }
12788
- }
12789
- this.entries.push(entry);
12790
- } else if (entry.entryType === "measure") {
12791
- this.measures.push(entry);
12792
- }
12793
- });
12794
- });
12795
- observer.observe({ entryTypes: ["mark", "measure"] });
12796
- }
12797
- mark(marker) {
12798
- if ("id" in marker) {
12799
- this.perf.mark(`${marker.type}||${marker.id}`);
12800
- } else {
12801
- this.perf.mark(marker.type);
12802
- }
12803
- }
12804
- waifForExecutionPromises = () => {
12805
- return Promise.all(this.executionPromises).finally(() => {
12806
- this.executionPromises.length = 0;
12807
- });
12808
- };
12809
- async getEntries() {
12810
- await this.waifForExecutionPromises();
12811
- return this.entries;
12812
- }
12813
- async getMeasures() {
12814
- await this.waifForExecutionPromises();
12815
- return this.measures;
12816
- }
12817
- }
12818
-
12819
- // node_modules/.bun/@secretlint+profiler@12.2.0/node_modules/@secretlint/profiler/module/node.js
12820
- import perf_hooks from "node:perf_hooks";
12821
-
12822
- class NullPerformanceObserver {
12823
- disconnect() {}
12824
- observe(_options) {}
12825
- }
12826
- var secretLintProfiler;
12827
- var init_node = __esm(() => {
12828
- secretLintProfiler = new SecretLintProfiler({
12829
- perf: perf_hooks.performance,
12830
- PerformanceObserver: perf_hooks.PerformanceObserver ? perf_hooks.PerformanceObserver : NullPerformanceObserver
12831
- });
12832
- });
12833
-
12834
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RunningEvents.js
12835
- var init_RunningEvents = __esm(() => {
12836
- init_node();
12837
- });
12838
-
12839
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/RulePresetContext.js
12840
- var init_RulePresetContext = __esm(() => {
12841
- init_RuleContext();
12842
- });
12843
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/messages/index.js
12844
- var init_messages = () => {};
12845
-
12846
- // node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
12847
- var require_ms = __commonJS((exports2, module) => {
12848
- var s = 1000;
12849
- var m = s * 60;
12850
- var h = m * 60;
12851
- var d = h * 24;
12852
- var w = d * 7;
12853
- var y = d * 365.25;
12854
- module.exports = function(val, options) {
12855
- options = options || {};
12856
- var type = typeof val;
12857
- if (type === "string" && val.length > 0) {
12858
- return parse(val);
12859
- } else if (type === "number" && isFinite(val)) {
12860
- return options.long ? fmtLong(val) : fmtShort(val);
12861
- }
12862
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
12863
- };
12864
- function parse(str) {
12865
- str = String(str);
12866
- if (str.length > 100) {
12867
- return;
12868
- }
12869
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
12870
- if (!match) {
12871
- return;
12872
- }
12873
- var n = parseFloat(match[1]);
12874
- var type = (match[2] || "ms").toLowerCase();
12875
- switch (type) {
12876
- case "years":
12877
- case "year":
12878
- case "yrs":
12879
- case "yr":
12880
- case "y":
12881
- return n * y;
12882
- case "weeks":
12883
- case "week":
12884
- case "w":
12885
- return n * w;
12886
- case "days":
12887
- case "day":
12888
- case "d":
12889
- return n * d;
12890
- case "hours":
12891
- case "hour":
12892
- case "hrs":
12893
- case "hr":
12894
- case "h":
12895
- return n * h;
12896
- case "minutes":
12897
- case "minute":
12898
- case "mins":
12899
- case "min":
12900
- case "m":
12901
- return n * m;
12902
- case "seconds":
12903
- case "second":
12904
- case "secs":
12905
- case "sec":
12906
- case "s":
12907
- return n * s;
12908
- case "milliseconds":
12909
- case "millisecond":
12910
- case "msecs":
12911
- case "msec":
12912
- case "ms":
12913
- return n;
12914
- default:
12915
- return;
12916
- }
12917
- }
12918
- function fmtShort(ms) {
12919
- var msAbs = Math.abs(ms);
12920
- if (msAbs >= d) {
12921
- return Math.round(ms / d) + "d";
12922
- }
12923
- if (msAbs >= h) {
12924
- return Math.round(ms / h) + "h";
12925
- }
12926
- if (msAbs >= m) {
12927
- return Math.round(ms / m) + "m";
12928
- }
12929
- if (msAbs >= s) {
12930
- return Math.round(ms / s) + "s";
12931
- }
12932
- return ms + "ms";
12933
- }
12934
- function fmtLong(ms) {
12935
- var msAbs = Math.abs(ms);
12936
- if (msAbs >= d) {
12937
- return plural(ms, msAbs, d, "day");
12938
- }
12939
- if (msAbs >= h) {
12940
- return plural(ms, msAbs, h, "hour");
12941
- }
12942
- if (msAbs >= m) {
12943
- return plural(ms, msAbs, m, "minute");
12944
- }
12945
- if (msAbs >= s) {
12946
- return plural(ms, msAbs, s, "second");
12947
- }
12948
- return ms + " ms";
12949
- }
12950
- function plural(ms, msAbs, n, name) {
12951
- var isPlural = msAbs >= n * 1.5;
12952
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
12953
- }
12954
- });
12955
-
12956
- // node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js
12957
- var require_common = __commonJS((exports2, module) => {
12958
- function setup(env) {
12959
- createDebug.debug = createDebug;
12960
- createDebug.default = createDebug;
12961
- createDebug.coerce = coerce2;
12962
- createDebug.disable = disable;
12963
- createDebug.enable = enable;
12964
- createDebug.enabled = enabled;
12965
- createDebug.humanize = require_ms();
12966
- createDebug.destroy = destroy;
12967
- Object.keys(env).forEach((key) => {
12968
- createDebug[key] = env[key];
12969
- });
12970
- createDebug.names = [];
12971
- createDebug.skips = [];
12972
- createDebug.formatters = {};
12973
- function selectColor(namespace) {
12974
- let hash = 0;
12975
- for (let i = 0;i < namespace.length; i++) {
12976
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
12977
- hash |= 0;
12978
- }
12979
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12980
- }
12981
- createDebug.selectColor = selectColor;
12982
- function createDebug(namespace) {
12983
- let prevTime;
12984
- let enableOverride = null;
12985
- let namespacesCache;
12986
- let enabledCache;
12987
- function debug(...args) {
12988
- if (!debug.enabled) {
12989
- return;
12990
- }
12991
- const self2 = debug;
12992
- const curr = Number(new Date);
12993
- const ms = curr - (prevTime || curr);
12994
- self2.diff = ms;
12995
- self2.prev = prevTime;
12996
- self2.curr = curr;
12997
- prevTime = curr;
12998
- args[0] = createDebug.coerce(args[0]);
12999
- if (typeof args[0] !== "string") {
13000
- args.unshift("%O");
13001
- }
13002
- let index = 0;
13003
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
13004
- if (match === "%%") {
13005
- return "%";
13006
- }
13007
- index++;
13008
- const formatter = createDebug.formatters[format];
13009
- if (typeof formatter === "function") {
13010
- const val = args[index];
13011
- match = formatter.call(self2, val);
13012
- args.splice(index, 1);
13013
- index--;
13014
- }
13015
- return match;
13016
- });
13017
- createDebug.formatArgs.call(self2, args);
13018
- const logFn = self2.log || createDebug.log;
13019
- logFn.apply(self2, args);
13020
- }
13021
- debug.namespace = namespace;
13022
- debug.useColors = createDebug.useColors();
13023
- debug.color = createDebug.selectColor(namespace);
13024
- debug.extend = extend;
13025
- debug.destroy = createDebug.destroy;
13026
- Object.defineProperty(debug, "enabled", {
13027
- enumerable: true,
13028
- configurable: false,
13029
- get: () => {
13030
- if (enableOverride !== null) {
13031
- return enableOverride;
13032
- }
13033
- if (namespacesCache !== createDebug.namespaces) {
13034
- namespacesCache = createDebug.namespaces;
13035
- enabledCache = createDebug.enabled(namespace);
13036
- }
13037
- return enabledCache;
13038
- },
13039
- set: (v) => {
13040
- enableOverride = v;
13041
- }
13042
- });
13043
- if (typeof createDebug.init === "function") {
13044
- createDebug.init(debug);
13045
- }
13046
- return debug;
13047
- }
13048
- function extend(namespace, delimiter) {
13049
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
13050
- newDebug.log = this.log;
13051
- return newDebug;
13052
- }
13053
- function enable(namespaces) {
13054
- createDebug.save(namespaces);
13055
- createDebug.namespaces = namespaces;
13056
- createDebug.names = [];
13057
- createDebug.skips = [];
13058
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
13059
- for (const ns of split) {
13060
- if (ns[0] === "-") {
13061
- createDebug.skips.push(ns.slice(1));
13062
- } else {
13063
- createDebug.names.push(ns);
13064
- }
13065
- }
13066
- }
13067
- function matchesTemplate(search, template) {
13068
- let searchIndex = 0;
13069
- let templateIndex = 0;
13070
- let starIndex = -1;
13071
- let matchIndex = 0;
13072
- while (searchIndex < search.length) {
13073
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
13074
- if (template[templateIndex] === "*") {
13075
- starIndex = templateIndex;
13076
- matchIndex = searchIndex;
13077
- templateIndex++;
13078
- } else {
13079
- searchIndex++;
13080
- templateIndex++;
13081
- }
13082
- } else if (starIndex !== -1) {
13083
- templateIndex = starIndex + 1;
13084
- matchIndex++;
13085
- searchIndex = matchIndex;
13086
- } else {
13087
- return false;
13088
- }
13089
- }
13090
- while (templateIndex < template.length && template[templateIndex] === "*") {
13091
- templateIndex++;
13092
- }
13093
- return templateIndex === template.length;
13094
- }
13095
- function disable() {
13096
- const namespaces = [
13097
- ...createDebug.names,
13098
- ...createDebug.skips.map((namespace) => "-" + namespace)
13099
- ].join(",");
13100
- createDebug.enable("");
13101
- return namespaces;
13102
- }
13103
- function enabled(name) {
13104
- for (const skip of createDebug.skips) {
13105
- if (matchesTemplate(name, skip)) {
13106
- return false;
13107
- }
13108
- }
13109
- for (const ns of createDebug.names) {
13110
- if (matchesTemplate(name, ns)) {
13111
- return true;
13112
- }
13113
- }
13114
- return false;
13115
- }
13116
- function coerce2(val) {
13117
- if (val instanceof Error) {
13118
- return val.stack || val.message;
13119
- }
13120
- return val;
13121
- }
13122
- function destroy() {
13123
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
13124
- }
13125
- createDebug.enable(createDebug.load());
13126
- return createDebug;
13127
- }
13128
- module.exports = setup;
13129
- });
13130
-
13131
- // node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js
13132
- var require_browser = __commonJS((exports2, module) => {
13133
- exports2.formatArgs = formatArgs;
13134
- exports2.save = save;
13135
- exports2.load = load;
13136
- exports2.useColors = useColors;
13137
- exports2.storage = localstorage();
13138
- exports2.destroy = (() => {
13139
- let warned = false;
13140
- return () => {
13141
- if (!warned) {
13142
- warned = true;
13143
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
13144
- }
13145
- };
13146
- })();
13147
- exports2.colors = [
13148
- "#0000CC",
13149
- "#0000FF",
13150
- "#0033CC",
13151
- "#0033FF",
13152
- "#0066CC",
13153
- "#0066FF",
13154
- "#0099CC",
13155
- "#0099FF",
13156
- "#00CC00",
13157
- "#00CC33",
13158
- "#00CC66",
13159
- "#00CC99",
13160
- "#00CCCC",
13161
- "#00CCFF",
13162
- "#3300CC",
13163
- "#3300FF",
13164
- "#3333CC",
13165
- "#3333FF",
13166
- "#3366CC",
13167
- "#3366FF",
13168
- "#3399CC",
13169
- "#3399FF",
13170
- "#33CC00",
13171
- "#33CC33",
13172
- "#33CC66",
13173
- "#33CC99",
13174
- "#33CCCC",
13175
- "#33CCFF",
13176
- "#6600CC",
13177
- "#6600FF",
13178
- "#6633CC",
13179
- "#6633FF",
13180
- "#66CC00",
13181
- "#66CC33",
13182
- "#9900CC",
13183
- "#9900FF",
13184
- "#9933CC",
13185
- "#9933FF",
13186
- "#99CC00",
13187
- "#99CC33",
13188
- "#CC0000",
13189
- "#CC0033",
13190
- "#CC0066",
13191
- "#CC0099",
13192
- "#CC00CC",
13193
- "#CC00FF",
13194
- "#CC3300",
13195
- "#CC3333",
13196
- "#CC3366",
13197
- "#CC3399",
13198
- "#CC33CC",
13199
- "#CC33FF",
13200
- "#CC6600",
13201
- "#CC6633",
13202
- "#CC9900",
13203
- "#CC9933",
13204
- "#CCCC00",
13205
- "#CCCC33",
13206
- "#FF0000",
13207
- "#FF0033",
13208
- "#FF0066",
13209
- "#FF0099",
13210
- "#FF00CC",
13211
- "#FF00FF",
13212
- "#FF3300",
13213
- "#FF3333",
13214
- "#FF3366",
13215
- "#FF3399",
13216
- "#FF33CC",
13217
- "#FF33FF",
13218
- "#FF6600",
13219
- "#FF6633",
13220
- "#FF9900",
13221
- "#FF9933",
13222
- "#FFCC00",
13223
- "#FFCC33"
13224
- ];
13225
- function useColors() {
13226
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
13227
- return true;
13228
- }
13229
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
13230
- return false;
13231
- }
13232
- let m;
13233
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
13234
- }
13235
- function formatArgs(args) {
13236
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
13237
- if (!this.useColors) {
13238
- return;
13239
- }
13240
- const c = "color: " + this.color;
13241
- args.splice(1, 0, c, "color: inherit");
13242
- let index = 0;
13243
- let lastC = 0;
13244
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
13245
- if (match === "%%") {
13246
- return;
13247
- }
13248
- index++;
13249
- if (match === "%c") {
13250
- lastC = index;
13251
- }
13252
- });
13253
- args.splice(lastC, 0, c);
13254
- }
13255
- exports2.log = console.debug || console.log || (() => {});
13256
- function save(namespaces) {
13257
- try {
13258
- if (namespaces) {
13259
- exports2.storage.setItem("debug", namespaces);
13260
- } else {
13261
- exports2.storage.removeItem("debug");
13262
- }
13263
- } catch (error) {}
13264
- }
13265
- function load() {
13266
- let r;
13267
- try {
13268
- r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
13269
- } catch (error) {}
13270
- if (!r && typeof process !== "undefined" && "env" in process) {
13271
- r = process.env.DEBUG;
13272
- }
13273
- return r;
13274
- }
13275
- function localstorage() {
13276
- try {
13277
- return localStorage;
13278
- } catch (error) {}
13279
- }
13280
- module.exports = require_common()(exports2);
13281
- var { formatters } = module.exports;
13282
- formatters.j = function(v) {
13283
- try {
13284
- return JSON.stringify(v);
13285
- } catch (error) {
13286
- return "[UnexpectedJSONParseError]: " + error.message;
13287
- }
13288
- };
13289
- });
13290
-
13291
- // node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js
13292
- var require_has_flag = __commonJS((exports2, module) => {
13293
- module.exports = (flag, argv = process.argv) => {
13294
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
13295
- const position = argv.indexOf(prefix + flag);
13296
- const terminatorPosition = argv.indexOf("--");
13297
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
13298
- };
13299
- });
13300
-
13301
- // node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js
13302
- var require_supports_color = __commonJS((exports2, module) => {
13303
- var os = __require("os");
13304
- var tty = __require("tty");
13305
- var hasFlag = require_has_flag();
13306
- var { env } = process;
13307
- var forceColor;
13308
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
13309
- forceColor = 0;
13310
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
13311
- forceColor = 1;
13312
- }
13313
- if ("FORCE_COLOR" in env) {
13314
- if (env.FORCE_COLOR === "true") {
13315
- forceColor = 1;
13316
- } else if (env.FORCE_COLOR === "false") {
13317
- forceColor = 0;
13318
- } else {
13319
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
13320
- }
13321
- }
13322
- function translateLevel(level) {
13323
- if (level === 0) {
13324
- return false;
13325
- }
13326
- return {
13327
- level,
13328
- hasBasic: true,
13329
- has256: level >= 2,
13330
- has16m: level >= 3
13331
- };
13332
- }
13333
- function supportsColor(haveStream, streamIsTTY) {
13334
- if (forceColor === 0) {
13335
- return 0;
13336
- }
13337
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
13338
- return 3;
13339
- }
13340
- if (hasFlag("color=256")) {
13341
- return 2;
13342
- }
13343
- if (haveStream && !streamIsTTY && forceColor === undefined) {
13344
- return 0;
13345
- }
13346
- const min = forceColor || 0;
13347
- if (env.TERM === "dumb") {
13348
- return min;
13349
- }
13350
- if (process.platform === "win32") {
13351
- const osRelease = os.release().split(".");
13352
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
13353
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
13354
- }
13355
- return 1;
13356
- }
13357
- if ("CI" in env) {
13358
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
13359
- return 1;
13360
- }
13361
- return min;
13362
- }
13363
- if ("TEAMCITY_VERSION" in env) {
13364
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
13365
- }
13366
- if (env.COLORTERM === "truecolor") {
13367
- return 3;
13368
- }
13369
- if ("TERM_PROGRAM" in env) {
13370
- const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
13371
- switch (env.TERM_PROGRAM) {
13372
- case "iTerm.app":
13373
- return version2 >= 3 ? 3 : 2;
13374
- case "Apple_Terminal":
13375
- return 2;
13376
- }
13377
- }
13378
- if (/-256(color)?$/i.test(env.TERM)) {
13379
- return 2;
13380
- }
13381
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
13382
- return 1;
13383
- }
13384
- if ("COLORTERM" in env) {
13385
- return 1;
13386
- }
13387
- return min;
13388
- }
13389
- function getSupportLevel(stream) {
13390
- const level = supportsColor(stream, stream && stream.isTTY);
13391
- return translateLevel(level);
13392
- }
13393
- module.exports = {
13394
- supportsColor: getSupportLevel,
13395
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
13396
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
13397
- };
13398
- });
13399
-
13400
- // node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
13401
- var require_node = __commonJS((exports2, module) => {
13402
- var tty = __require("tty");
13403
- var util3 = __require("util");
13404
- exports2.init = init;
13405
- exports2.log = log;
13406
- exports2.formatArgs = formatArgs;
13407
- exports2.save = save;
13408
- exports2.load = load;
13409
- exports2.useColors = useColors;
13410
- exports2.destroy = util3.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
13411
- exports2.colors = [6, 2, 3, 4, 5, 1];
13412
- try {
13413
- const supportsColor = require_supports_color();
13414
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
13415
- exports2.colors = [
13416
- 20,
13417
- 21,
13418
- 26,
13419
- 27,
13420
- 32,
13421
- 33,
13422
- 38,
13423
- 39,
13424
- 40,
13425
- 41,
13426
- 42,
13427
- 43,
13428
- 44,
13429
- 45,
13430
- 56,
13431
- 57,
13432
- 62,
13433
- 63,
13434
- 68,
13435
- 69,
13436
- 74,
13437
- 75,
13438
- 76,
13439
- 77,
13440
- 78,
13441
- 79,
13442
- 80,
13443
- 81,
13444
- 92,
13445
- 93,
13446
- 98,
13447
- 99,
13448
- 112,
13449
- 113,
13450
- 128,
13451
- 129,
13452
- 134,
13453
- 135,
13454
- 148,
13455
- 149,
13456
- 160,
13457
- 161,
13458
- 162,
13459
- 163,
13460
- 164,
13461
- 165,
13462
- 166,
13463
- 167,
13464
- 168,
13465
- 169,
13466
- 170,
13467
- 171,
13468
- 172,
13469
- 173,
13470
- 178,
13471
- 179,
13472
- 184,
13473
- 185,
13474
- 196,
13475
- 197,
13476
- 198,
13477
- 199,
13478
- 200,
13479
- 201,
13480
- 202,
13481
- 203,
13482
- 204,
13483
- 205,
13484
- 206,
13485
- 207,
13486
- 208,
13487
- 209,
13488
- 214,
13489
- 215,
13490
- 220,
13491
- 221
13492
- ];
13493
- }
13494
- } catch (error) {}
13495
- exports2.inspectOpts = Object.keys(process.env).filter((key) => {
13496
- return /^debug_/i.test(key);
13497
- }).reduce((obj, key) => {
13498
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
13499
- return k.toUpperCase();
13500
- });
13501
- let val = process.env[key];
13502
- if (/^(yes|on|true|enabled)$/i.test(val)) {
13503
- val = true;
13504
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
13505
- val = false;
13506
- } else if (val === "null") {
13507
- val = null;
13508
- } else {
13509
- val = Number(val);
13510
- }
13511
- obj[prop] = val;
13512
- return obj;
13513
- }, {});
13514
- function useColors() {
13515
- return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
13516
- }
13517
- function formatArgs(args) {
13518
- const { namespace: name, useColors: useColors2 } = this;
13519
- if (useColors2) {
13520
- const c = this.color;
13521
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
13522
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
13523
- args[0] = prefix + args[0].split(`
13524
- `).join(`
13525
- ` + prefix);
13526
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
13527
- } else {
13528
- args[0] = getDate() + name + " " + args[0];
13529
- }
13530
- }
13531
- function getDate() {
13532
- if (exports2.inspectOpts.hideDate) {
13533
- return "";
13534
- }
13535
- return new Date().toISOString() + " ";
13536
- }
13537
- function log(...args) {
13538
- return process.stderr.write(util3.formatWithOptions(exports2.inspectOpts, ...args) + `
13539
- `);
13540
- }
13541
- function save(namespaces) {
13542
- if (namespaces) {
13543
- process.env.DEBUG = namespaces;
13544
- } else {
13545
- delete process.env.DEBUG;
13546
- }
13547
- }
13548
- function load() {
13549
- return process.env.DEBUG;
13550
- }
13551
- function init(debug) {
13552
- debug.inspectOpts = {};
13553
- const keys = Object.keys(exports2.inspectOpts);
13554
- for (let i = 0;i < keys.length; i++) {
13555
- debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
13556
- }
13557
- }
13558
- module.exports = require_common()(exports2);
13559
- var { formatters } = module.exports;
13560
- formatters.o = function(v) {
13561
- this.inspectOpts.colors = this.useColors;
13562
- return util3.inspect(v, this.inspectOpts).split(`
13563
- `).map((str) => str.trim()).join(" ");
13564
- };
13565
- formatters.O = function(v) {
13566
- this.inspectOpts.colors = this.useColors;
13567
- return util3.inspect(v, this.inspectOpts);
13568
- };
13569
- });
13570
-
13571
- // node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js
13572
- var require_src = __commonJS((exports2, module) => {
13573
- if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
13574
- module.exports = require_browser();
13575
- } else {
13576
- module.exports = require_node();
13577
- }
13578
- });
13579
-
13580
- // node_modules/.bun/@secretlint+core@12.2.0/node_modules/@secretlint/core/module/index.js
13581
- var import_debug, debug;
13582
- var init_module = __esm(() => {
13583
- init_SecretLintSourceCodeImpl();
13584
- init_RuleContext();
13585
- init_RunningEvents();
13586
- init_node();
13587
- init_RulePresetContext();
13588
- init_messages();
13589
- import_debug = __toESM(require_src(), 1);
13590
- debug = import_debug.default("@secretlint/core");
13591
- });
13592
-
13593
- // node_modules/.bun/@secretlint+secretlint-rule-preset-recommend@12.2.0/node_modules/@secretlint/secretlint-rule-preset-recommend/module/index.js
13594
- function requireLodash_uniq() {
13595
- if (hasRequiredLodash_uniq)
13596
- return lodash_uniq;
13597
- hasRequiredLodash_uniq = 1;
13598
- var LARGE_ARRAY_SIZE = 200;
13599
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
13600
- var INFINITY = 1 / 0;
13601
- var funcTag = "[object Function]", genTag = "[object GeneratorFunction]";
13602
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
13603
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
13604
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
13605
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
13606
- var root = freeGlobal || freeSelf || Function("return this")();
13607
- function arrayIncludes(array, value) {
13608
- var length = array ? array.length : 0;
13609
- return !!length && baseIndexOf(array, value, 0) > -1;
13610
- }
13611
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
13612
- var length = array.length, index = fromIndex + -1;
13613
- while (++index < length) {
13614
- if (predicate(array[index], index, array)) {
13615
- return index;
13616
- }
13617
- }
13618
- return -1;
13619
- }
13620
- function baseIndexOf(array, value, fromIndex) {
13621
- if (value !== value) {
13622
- return baseFindIndex(array, baseIsNaN, fromIndex);
13623
- }
13624
- var index = fromIndex - 1, length = array.length;
13625
- while (++index < length) {
13626
- if (array[index] === value) {
13627
- return index;
13628
- }
13629
- }
13630
- return -1;
13631
- }
13632
- function baseIsNaN(value) {
13633
- return value !== value;
13634
- }
13635
- function cacheHas(cache, key) {
13636
- return cache.has(key);
13637
- }
13638
- function getValue(object, key) {
13639
- return object == null ? undefined : object[key];
13640
- }
13641
- function isHostObject(value) {
13642
- var result = false;
13643
- if (value != null && typeof value.toString != "function") {
13644
- try {
13645
- result = !!(value + "");
13646
- } catch (e) {}
13647
- }
13648
- return result;
13649
- }
13650
- function setToArray(set) {
13651
- var index = -1, result = Array(set.size);
13652
- set.forEach(function(value) {
13653
- result[++index] = value;
13654
- });
13655
- return result;
13656
- }
13657
- var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
13658
- var coreJsData = root["__core-js_shared__"];
13659
- var maskSrcKey = function() {
13660
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
13661
- return uid ? "Symbol(src)_1." + uid : "";
13662
- }();
13663
- var funcToString = funcProto.toString;
13664
- var hasOwnProperty = objectProto.hasOwnProperty;
13665
- var objectToString = objectProto.toString;
13666
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
13667
- var splice = arrayProto.splice;
13668
- var Map2 = getNative(root, "Map"), Set2 = getNative(root, "Set"), nativeCreate = getNative(Object, "create");
13669
- function Hash(entries) {
13670
- var index = -1, length = entries ? entries.length : 0;
13671
- this.clear();
13672
- while (++index < length) {
13673
- var entry = entries[index];
13674
- this.set(entry[0], entry[1]);
13675
- }
13676
- }
13677
- function hashClear() {
13678
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
13679
- }
13680
- function hashDelete(key) {
13681
- return this.has(key) && delete this.__data__[key];
13682
- }
13683
- function hashGet(key) {
13684
- var data = this.__data__;
13685
- if (nativeCreate) {
13686
- var result = data[key];
13687
- return result === HASH_UNDEFINED ? undefined : result;
13688
- }
13689
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
13690
- }
13691
- function hashHas(key) {
13692
- var data = this.__data__;
13693
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
13694
- }
13695
- function hashSet(key, value) {
13696
- var data = this.__data__;
13697
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
13698
- return this;
13699
- }
13700
- Hash.prototype.clear = hashClear;
13701
- Hash.prototype["delete"] = hashDelete;
13702
- Hash.prototype.get = hashGet;
13703
- Hash.prototype.has = hashHas;
13704
- Hash.prototype.set = hashSet;
13705
- function ListCache(entries) {
13706
- var index = -1, length = entries ? entries.length : 0;
13707
- this.clear();
13708
- while (++index < length) {
13709
- var entry = entries[index];
13710
- this.set(entry[0], entry[1]);
13711
- }
13712
- }
13713
- function listCacheClear() {
13714
- this.__data__ = [];
13715
- }
13716
- function listCacheDelete(key) {
13717
- var data = this.__data__, index = assocIndexOf(data, key);
13718
- if (index < 0) {
13719
- return false;
13720
- }
13721
- var lastIndex = data.length - 1;
13722
- if (index == lastIndex) {
13723
- data.pop();
13724
- } else {
13725
- splice.call(data, index, 1);
13726
- }
13727
- return true;
13728
- }
13729
- function listCacheGet(key) {
13730
- var data = this.__data__, index = assocIndexOf(data, key);
13731
- return index < 0 ? undefined : data[index][1];
13732
- }
13733
- function listCacheHas(key) {
13734
- return assocIndexOf(this.__data__, key) > -1;
13735
- }
13736
- function listCacheSet(key, value) {
13737
- var data = this.__data__, index = assocIndexOf(data, key);
13738
- if (index < 0) {
13739
- data.push([key, value]);
13740
- } else {
13741
- data[index][1] = value;
13742
- }
13743
- return this;
13744
- }
13745
- ListCache.prototype.clear = listCacheClear;
13746
- ListCache.prototype["delete"] = listCacheDelete;
13747
- ListCache.prototype.get = listCacheGet;
13748
- ListCache.prototype.has = listCacheHas;
13749
- ListCache.prototype.set = listCacheSet;
13750
- function MapCache(entries) {
13751
- var index = -1, length = entries ? entries.length : 0;
13752
- this.clear();
13753
- while (++index < length) {
13754
- var entry = entries[index];
13755
- this.set(entry[0], entry[1]);
13756
- }
13757
- }
13758
- function mapCacheClear() {
13759
- this.__data__ = {
13760
- hash: new Hash,
13761
- map: new (Map2 || ListCache),
13762
- string: new Hash
13763
- };
13764
- }
13765
- function mapCacheDelete(key) {
13766
- return getMapData(this, key)["delete"](key);
13767
- }
13768
- function mapCacheGet(key) {
13769
- return getMapData(this, key).get(key);
13770
- }
13771
- function mapCacheHas(key) {
13772
- return getMapData(this, key).has(key);
13773
- }
13774
- function mapCacheSet(key, value) {
13775
- getMapData(this, key).set(key, value);
13776
- return this;
13777
- }
13778
- MapCache.prototype.clear = mapCacheClear;
13779
- MapCache.prototype["delete"] = mapCacheDelete;
13780
- MapCache.prototype.get = mapCacheGet;
13781
- MapCache.prototype.has = mapCacheHas;
13782
- MapCache.prototype.set = mapCacheSet;
13783
- function SetCache(values) {
13784
- var index = -1, length = values ? values.length : 0;
13785
- this.__data__ = new MapCache;
13786
- while (++index < length) {
13787
- this.add(values[index]);
13788
- }
13789
- }
13790
- function setCacheAdd(value) {
13791
- this.__data__.set(value, HASH_UNDEFINED);
13792
- return this;
13793
- }
13794
- function setCacheHas(value) {
13795
- return this.__data__.has(value);
13796
- }
13797
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
13798
- SetCache.prototype.has = setCacheHas;
13799
- function assocIndexOf(array, key) {
13800
- var length = array.length;
13801
- while (length--) {
13802
- if (eq(array[length][0], key)) {
13803
- return length;
13804
- }
13805
- }
13806
- return -1;
13807
- }
13808
- function baseIsNative(value) {
13809
- if (!isObject2(value) || isMasked(value)) {
13810
- return false;
13811
- }
13812
- var pattern = isFunction2(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
13813
- return pattern.test(toSource(value));
13814
- }
13815
- function baseUniq(array, iteratee, comparator) {
13816
- var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
13817
- if (length >= LARGE_ARRAY_SIZE) {
13818
- var set = createSet(array);
13819
- if (set) {
13820
- return setToArray(set);
13821
- }
13822
- isCommon = false;
13823
- includes2 = cacheHas;
13824
- seen = new SetCache;
13825
- } else {
13826
- seen = result;
13827
- }
13828
- outer:
13829
- while (++index < length) {
13830
- var value = array[index], computed = value;
13831
- value = value !== 0 ? value : 0;
13832
- if (isCommon && computed === computed) {
13833
- var seenIndex = seen.length;
13834
- while (seenIndex--) {
13835
- if (seen[seenIndex] === computed) {
13836
- continue outer;
13837
- }
13838
- }
13839
- result.push(value);
13840
- } else if (!includes2(seen, computed, comparator)) {
13841
- if (seen !== result) {
13842
- seen.push(computed);
13843
- }
13844
- result.push(value);
13845
- }
13846
- }
13847
- return result;
13848
- }
13849
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values) {
13850
- return new Set2(values);
13851
- };
13852
- function getMapData(map, key) {
13853
- var data = map.__data__;
13854
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
13855
- }
13856
- function getNative(object, key) {
13857
- var value = getValue(object, key);
13858
- return baseIsNative(value) ? value : undefined;
13859
- }
13860
- function isKeyable(value) {
13861
- var type = typeof value;
13862
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
13863
- }
13864
- function isMasked(func) {
13865
- return !!maskSrcKey && maskSrcKey in func;
13866
- }
13867
- function toSource(func) {
13868
- if (func != null) {
13869
- try {
13870
- return funcToString.call(func);
13871
- } catch (e) {}
13872
- try {
13873
- return func + "";
13874
- } catch (e) {}
13875
- }
13876
- return "";
13877
- }
13878
- function uniq(array) {
13879
- return array && array.length ? baseUniq(array) : [];
13880
- }
13881
- function eq(value, other) {
13882
- return value === other || value !== value && other !== other;
13883
- }
13884
- function isFunction2(value) {
13885
- var tag = isObject2(value) ? objectToString.call(value) : "";
13886
- return tag == funcTag || tag == genTag;
13887
- }
13888
- function isObject2(value) {
13889
- var type = typeof value;
13890
- return !!value && (type == "object" || type == "function");
13891
- }
13892
- function noop() {}
13893
- lodash_uniq = uniq;
13894
- return lodash_uniq;
13895
- }
13896
- function requireLodash_uniqwith() {
13897
- if (hasRequiredLodash_uniqwith)
13898
- return lodash_uniqwith;
13899
- hasRequiredLodash_uniqwith = 1;
13900
- var LARGE_ARRAY_SIZE = 200;
13901
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
13902
- var INFINITY = 1 / 0;
13903
- var funcTag = "[object Function]", genTag = "[object GeneratorFunction]";
13904
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
13905
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
13906
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
13907
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
13908
- var root = freeGlobal || freeSelf || Function("return this")();
13909
- function arrayIncludes(array, value) {
13910
- var length = array ? array.length : 0;
13911
- return !!length && baseIndexOf(array, value, 0) > -1;
13912
- }
13913
- function arrayIncludesWith(array, value, comparator) {
13914
- var index = -1, length = array ? array.length : 0;
13915
- while (++index < length) {
13916
- if (comparator(value, array[index])) {
13917
- return true;
13918
- }
13919
- }
13920
- return false;
13921
- }
13922
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
13923
- var length = array.length, index = fromIndex + -1;
13924
- while (++index < length) {
13925
- if (predicate(array[index], index, array)) {
13926
- return index;
13927
- }
13928
- }
13929
- return -1;
13930
- }
13931
- function baseIndexOf(array, value, fromIndex) {
13932
- if (value !== value) {
13933
- return baseFindIndex(array, baseIsNaN, fromIndex);
13934
- }
13935
- var index = fromIndex - 1, length = array.length;
13936
- while (++index < length) {
13937
- if (array[index] === value) {
13938
- return index;
13939
- }
13940
- }
13941
- return -1;
13942
- }
13943
- function baseIsNaN(value) {
13944
- return value !== value;
13945
- }
13946
- function cacheHas(cache, key) {
13947
- return cache.has(key);
13948
- }
13949
- function getValue(object, key) {
13950
- return object == null ? undefined : object[key];
13951
- }
13952
- function isHostObject(value) {
13953
- var result = false;
13954
- if (value != null && typeof value.toString != "function") {
13955
- try {
13956
- result = !!(value + "");
13957
- } catch (e) {}
13958
- }
13959
- return result;
13960
- }
13961
- function setToArray(set) {
13962
- var index = -1, result = Array(set.size);
13963
- set.forEach(function(value) {
13964
- result[++index] = value;
13965
- });
13966
- return result;
13967
- }
13968
- var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
13969
- var coreJsData = root["__core-js_shared__"];
13970
- var maskSrcKey = function() {
13971
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
13972
- return uid ? "Symbol(src)_1." + uid : "";
13973
- }();
13974
- var funcToString = funcProto.toString;
13975
- var hasOwnProperty = objectProto.hasOwnProperty;
13976
- var objectToString = objectProto.toString;
13977
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
13978
- var splice = arrayProto.splice;
13979
- var Map2 = getNative(root, "Map"), Set2 = getNative(root, "Set"), nativeCreate = getNative(Object, "create");
13980
- function Hash(entries) {
13981
- var index = -1, length = entries ? entries.length : 0;
13982
- this.clear();
13983
- while (++index < length) {
13984
- var entry = entries[index];
13985
- this.set(entry[0], entry[1]);
13986
- }
13987
- }
13988
- function hashClear() {
13989
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
13990
- }
13991
- function hashDelete(key) {
13992
- return this.has(key) && delete this.__data__[key];
13993
- }
13994
- function hashGet(key) {
13995
- var data = this.__data__;
13996
- if (nativeCreate) {
13997
- var result = data[key];
13998
- return result === HASH_UNDEFINED ? undefined : result;
13999
- }
14000
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
14001
- }
14002
- function hashHas(key) {
14003
- var data = this.__data__;
14004
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
14005
- }
14006
- function hashSet(key, value) {
14007
- var data = this.__data__;
14008
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
14009
- return this;
14010
- }
14011
- Hash.prototype.clear = hashClear;
14012
- Hash.prototype["delete"] = hashDelete;
14013
- Hash.prototype.get = hashGet;
14014
- Hash.prototype.has = hashHas;
14015
- Hash.prototype.set = hashSet;
14016
- function ListCache(entries) {
14017
- var index = -1, length = entries ? entries.length : 0;
14018
- this.clear();
14019
- while (++index < length) {
14020
- var entry = entries[index];
14021
- this.set(entry[0], entry[1]);
14022
- }
14023
- }
14024
- function listCacheClear() {
14025
- this.__data__ = [];
14026
- }
14027
- function listCacheDelete(key) {
14028
- var data = this.__data__, index = assocIndexOf(data, key);
14029
- if (index < 0) {
14030
- return false;
14031
- }
14032
- var lastIndex = data.length - 1;
14033
- if (index == lastIndex) {
14034
- data.pop();
14035
- } else {
14036
- splice.call(data, index, 1);
14037
- }
14038
- return true;
14039
- }
14040
- function listCacheGet(key) {
14041
- var data = this.__data__, index = assocIndexOf(data, key);
14042
- return index < 0 ? undefined : data[index][1];
14043
- }
14044
- function listCacheHas(key) {
14045
- return assocIndexOf(this.__data__, key) > -1;
14046
- }
14047
- function listCacheSet(key, value) {
14048
- var data = this.__data__, index = assocIndexOf(data, key);
14049
- if (index < 0) {
14050
- data.push([key, value]);
14051
- } else {
14052
- data[index][1] = value;
14053
- }
14054
- return this;
14055
- }
14056
- ListCache.prototype.clear = listCacheClear;
14057
- ListCache.prototype["delete"] = listCacheDelete;
14058
- ListCache.prototype.get = listCacheGet;
14059
- ListCache.prototype.has = listCacheHas;
14060
- ListCache.prototype.set = listCacheSet;
14061
- function MapCache(entries) {
14062
- var index = -1, length = entries ? entries.length : 0;
14063
- this.clear();
14064
- while (++index < length) {
14065
- var entry = entries[index];
14066
- this.set(entry[0], entry[1]);
14067
- }
14068
- }
14069
- function mapCacheClear() {
14070
- this.__data__ = {
14071
- hash: new Hash,
14072
- map: new (Map2 || ListCache),
14073
- string: new Hash
14074
- };
14075
- }
14076
- function mapCacheDelete(key) {
14077
- return getMapData(this, key)["delete"](key);
14078
- }
14079
- function mapCacheGet(key) {
14080
- return getMapData(this, key).get(key);
14081
- }
14082
- function mapCacheHas(key) {
14083
- return getMapData(this, key).has(key);
14084
- }
14085
- function mapCacheSet(key, value) {
14086
- getMapData(this, key).set(key, value);
14087
- return this;
14088
- }
14089
- MapCache.prototype.clear = mapCacheClear;
14090
- MapCache.prototype["delete"] = mapCacheDelete;
14091
- MapCache.prototype.get = mapCacheGet;
14092
- MapCache.prototype.has = mapCacheHas;
14093
- MapCache.prototype.set = mapCacheSet;
14094
- function SetCache(values) {
14095
- var index = -1, length = values ? values.length : 0;
14096
- this.__data__ = new MapCache;
14097
- while (++index < length) {
14098
- this.add(values[index]);
14099
- }
14100
- }
14101
- function setCacheAdd(value) {
14102
- this.__data__.set(value, HASH_UNDEFINED);
14103
- return this;
14104
- }
14105
- function setCacheHas(value) {
14106
- return this.__data__.has(value);
14107
- }
14108
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
14109
- SetCache.prototype.has = setCacheHas;
14110
- function assocIndexOf(array, key) {
14111
- var length = array.length;
14112
- while (length--) {
14113
- if (eq(array[length][0], key)) {
14114
- return length;
14115
- }
14116
- }
14117
- return -1;
14118
- }
14119
- function baseIsNative(value) {
14120
- if (!isObject2(value) || isMasked(value)) {
14121
- return false;
14122
- }
14123
- var pattern = isFunction2(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
14124
- return pattern.test(toSource(value));
14125
- }
14126
- function baseUniq(array, iteratee, comparator) {
14127
- var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
14128
- if (comparator) {
14129
- isCommon = false;
14130
- includes2 = arrayIncludesWith;
14131
- } else if (length >= LARGE_ARRAY_SIZE) {
14132
- var set = createSet(array);
14133
- if (set) {
14134
- return setToArray(set);
14135
- }
14136
- isCommon = false;
14137
- includes2 = cacheHas;
14138
- seen = new SetCache;
14139
- } else {
14140
- seen = result;
14141
- }
14142
- outer:
14143
- while (++index < length) {
14144
- var value = array[index], computed = value;
14145
- value = comparator || value !== 0 ? value : 0;
14146
- if (isCommon && computed === computed) {
14147
- var seenIndex = seen.length;
14148
- while (seenIndex--) {
14149
- if (seen[seenIndex] === computed) {
14150
- continue outer;
14151
- }
14152
- }
14153
- result.push(value);
14154
- } else if (!includes2(seen, computed, comparator)) {
14155
- if (seen !== result) {
14156
- seen.push(computed);
14157
- }
14158
- result.push(value);
14159
- }
14160
- }
14161
- return result;
14162
- }
14163
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values) {
14164
- return new Set2(values);
14165
- };
14166
- function getMapData(map, key) {
14167
- var data = map.__data__;
14168
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
14169
- }
14170
- function getNative(object, key) {
14171
- var value = getValue(object, key);
14172
- return baseIsNative(value) ? value : undefined;
14173
- }
14174
- function isKeyable(value) {
14175
- var type = typeof value;
14176
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
14177
- }
14178
- function isMasked(func) {
14179
- return !!maskSrcKey && maskSrcKey in func;
14180
- }
14181
- function toSource(func) {
14182
- if (func != null) {
14183
- try {
14184
- return funcToString.call(func);
14185
- } catch (e) {}
14186
- try {
14187
- return func + "";
14188
- } catch (e) {}
14189
- }
14190
- return "";
14191
- }
14192
- function uniqWith(array, comparator) {
14193
- return array && array.length ? baseUniq(array, undefined, comparator) : [];
14194
- }
14195
- function eq(value, other) {
14196
- return value === other || value !== value && other !== other;
14197
- }
14198
- function isFunction2(value) {
14199
- var tag = isObject2(value) ? objectToString.call(value) : "";
14200
- return tag == funcTag || tag == genTag;
14201
- }
14202
- function isObject2(value) {
14203
- var type = typeof value;
14204
- return !!value && (type == "object" || type == "function");
14205
- }
14206
- function noop() {}
14207
- lodash_uniqwith = uniqWith;
14208
- return lodash_uniqwith;
14209
- }
14210
- function requireLodash_sortby() {
14211
- if (hasRequiredLodash_sortby)
14212
- return lodash_sortby.exports;
14213
- hasRequiredLodash_sortby = 1;
14214
- (function(module, exports$1) {
14215
- var LARGE_ARRAY_SIZE = 200;
14216
- var FUNC_ERROR_TEXT = "Expected a function";
14217
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
14218
- var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2;
14219
- var MAX_SAFE_INTEGER = 9007199254740991;
14220
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
14221
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
14222
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
14223
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
14224
- var reEscapeChar = /\\(\\)?/g;
14225
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
14226
- var reIsUint = /^(?:0|[1-9]\d*)$/;
14227
- var typedArrayTags = {};
14228
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
14229
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
14230
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
14231
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
14232
- var root = freeGlobal || freeSelf || Function("return this")();
14233
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
14234
- var freeModule = freeExports && true && module && !module.nodeType && module;
14235
- var moduleExports = freeModule && freeModule.exports === freeExports;
14236
- var freeProcess = moduleExports && freeGlobal.process;
14237
- var nodeUtil = function() {
14238
- try {
14239
- return freeProcess && freeProcess.binding("util");
14240
- } catch (e) {}
14241
- }();
14242
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
14243
- function apply(func, thisArg, args) {
14244
- switch (args.length) {
14245
- case 0:
14246
- return func.call(thisArg);
14247
- case 1:
14248
- return func.call(thisArg, args[0]);
14249
- case 2:
14250
- return func.call(thisArg, args[0], args[1]);
14251
- case 3:
14252
- return func.call(thisArg, args[0], args[1], args[2]);
14253
- }
14254
- return func.apply(thisArg, args);
14255
- }
14256
- function arrayMap(array, iteratee) {
14257
- var index = -1, length = array ? array.length : 0, result = Array(length);
14258
- while (++index < length) {
14259
- result[index] = iteratee(array[index], index, array);
14260
- }
14261
- return result;
14262
- }
14263
- function arrayPush(array, values) {
14264
- var index = -1, length = values.length, offset = array.length;
14265
- while (++index < length) {
14266
- array[offset + index] = values[index];
14267
- }
14268
- return array;
14269
- }
14270
- function arraySome(array, predicate) {
14271
- var index = -1, length = array ? array.length : 0;
14272
- while (++index < length) {
14273
- if (predicate(array[index], index, array)) {
14274
- return true;
14275
- }
14276
- }
14277
- return false;
14278
- }
14279
- function baseProperty(key) {
14280
- return function(object) {
14281
- return object == null ? undefined : object[key];
14282
- };
14283
- }
14284
- function baseSortBy(array, comparer) {
14285
- var length = array.length;
14286
- array.sort(comparer);
14287
- while (length--) {
14288
- array[length] = array[length].value;
14289
- }
14290
- return array;
14291
- }
14292
- function baseTimes(n, iteratee) {
14293
- var index = -1, result = Array(n);
14294
- while (++index < n) {
14295
- result[index] = iteratee(index);
14296
- }
14297
- return result;
14298
- }
14299
- function baseUnary(func) {
14300
- return function(value) {
14301
- return func(value);
14302
- };
14303
- }
14304
- function getValue(object, key) {
14305
- return object == null ? undefined : object[key];
14306
- }
14307
- function isHostObject(value) {
14308
- var result = false;
14309
- if (value != null && typeof value.toString != "function") {
14310
- try {
14311
- result = !!(value + "");
14312
- } catch (e) {}
14313
- }
14314
- return result;
14315
- }
14316
- function mapToArray(map) {
14317
- var index = -1, result = Array(map.size);
14318
- map.forEach(function(value, key) {
14319
- result[++index] = [key, value];
14320
- });
14321
- return result;
14322
- }
14323
- function overArg(func, transform) {
14324
- return function(arg) {
14325
- return func(transform(arg));
14326
- };
14327
- }
14328
- function setToArray(set) {
14329
- var index = -1, result = Array(set.size);
14330
- set.forEach(function(value) {
14331
- result[++index] = value;
14332
- });
14333
- return result;
14334
- }
14335
- var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
14336
- var coreJsData = root["__core-js_shared__"];
14337
- var maskSrcKey = function() {
14338
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
14339
- return uid ? "Symbol(src)_1." + uid : "";
14340
- }();
14341
- var funcToString = funcProto.toString;
14342
- var hasOwnProperty = objectProto.hasOwnProperty;
14343
- var objectToString = objectProto.toString;
14344
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
14345
- var { Symbol: Symbol2, Uint8Array: Uint8Array2 } = root, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined;
14346
- var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max;
14347
- var DataView2 = getNative(root, "DataView"), Map2 = getNative(root, "Map"), Promise2 = getNative(root, "Promise"), Set2 = getNative(root, "Set"), WeakMap2 = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
14348
- var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
14349
- var symbolProto = Symbol2 ? Symbol2.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
14350
- function Hash(entries) {
14351
- var index = -1, length = entries ? entries.length : 0;
14352
- this.clear();
14353
- while (++index < length) {
14354
- var entry = entries[index];
14355
- this.set(entry[0], entry[1]);
14356
- }
14357
- }
14358
- function hashClear() {
14359
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
14360
- }
14361
- function hashDelete(key) {
14362
- return this.has(key) && delete this.__data__[key];
14363
- }
14364
- function hashGet(key) {
14365
- var data = this.__data__;
14366
- if (nativeCreate) {
14367
- var result = data[key];
14368
- return result === HASH_UNDEFINED ? undefined : result;
14369
- }
14370
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
14371
- }
14372
- function hashHas(key) {
14373
- var data = this.__data__;
14374
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
14375
- }
14376
- function hashSet(key, value) {
14377
- var data = this.__data__;
14378
- data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
14379
- return this;
14380
- }
14381
- Hash.prototype.clear = hashClear;
14382
- Hash.prototype["delete"] = hashDelete;
14383
- Hash.prototype.get = hashGet;
14384
- Hash.prototype.has = hashHas;
14385
- Hash.prototype.set = hashSet;
14386
- function ListCache(entries) {
14387
- var index = -1, length = entries ? entries.length : 0;
14388
- this.clear();
14389
- while (++index < length) {
14390
- var entry = entries[index];
14391
- this.set(entry[0], entry[1]);
14392
- }
14393
- }
14394
- function listCacheClear() {
14395
- this.__data__ = [];
14396
- }
14397
- function listCacheDelete(key) {
14398
- var data = this.__data__, index = assocIndexOf(data, key);
14399
- if (index < 0) {
14400
- return false;
14401
- }
14402
- var lastIndex = data.length - 1;
14403
- if (index == lastIndex) {
14404
- data.pop();
14405
- } else {
14406
- splice.call(data, index, 1);
14407
- }
14408
- return true;
14409
- }
14410
- function listCacheGet(key) {
14411
- var data = this.__data__, index = assocIndexOf(data, key);
14412
- return index < 0 ? undefined : data[index][1];
14413
- }
14414
- function listCacheHas(key) {
14415
- return assocIndexOf(this.__data__, key) > -1;
14416
- }
14417
- function listCacheSet(key, value) {
14418
- var data = this.__data__, index = assocIndexOf(data, key);
14419
- if (index < 0) {
14420
- data.push([key, value]);
14421
- } else {
14422
- data[index][1] = value;
14423
- }
14424
- return this;
14425
- }
14426
- ListCache.prototype.clear = listCacheClear;
14427
- ListCache.prototype["delete"] = listCacheDelete;
14428
- ListCache.prototype.get = listCacheGet;
14429
- ListCache.prototype.has = listCacheHas;
14430
- ListCache.prototype.set = listCacheSet;
14431
- function MapCache(entries) {
14432
- var index = -1, length = entries ? entries.length : 0;
14433
- this.clear();
14434
- while (++index < length) {
14435
- var entry = entries[index];
14436
- this.set(entry[0], entry[1]);
14437
- }
14438
- }
14439
- function mapCacheClear() {
14440
- this.__data__ = {
14441
- hash: new Hash,
14442
- map: new (Map2 || ListCache),
14443
- string: new Hash
14444
- };
14445
- }
14446
- function mapCacheDelete(key) {
14447
- return getMapData(this, key)["delete"](key);
14448
- }
14449
- function mapCacheGet(key) {
14450
- return getMapData(this, key).get(key);
14451
- }
14452
- function mapCacheHas(key) {
14453
- return getMapData(this, key).has(key);
14454
- }
14455
- function mapCacheSet(key, value) {
14456
- getMapData(this, key).set(key, value);
14457
- return this;
14458
- }
14459
- MapCache.prototype.clear = mapCacheClear;
14460
- MapCache.prototype["delete"] = mapCacheDelete;
14461
- MapCache.prototype.get = mapCacheGet;
14462
- MapCache.prototype.has = mapCacheHas;
14463
- MapCache.prototype.set = mapCacheSet;
14464
- function SetCache(values) {
14465
- var index = -1, length = values ? values.length : 0;
14466
- this.__data__ = new MapCache;
14467
- while (++index < length) {
14468
- this.add(values[index]);
14469
- }
14470
- }
14471
- function setCacheAdd(value) {
14472
- this.__data__.set(value, HASH_UNDEFINED);
14473
- return this;
14474
- }
14475
- function setCacheHas(value) {
14476
- return this.__data__.has(value);
14477
- }
14478
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
14479
- SetCache.prototype.has = setCacheHas;
14480
- function Stack(entries) {
14481
- this.__data__ = new ListCache(entries);
14482
- }
14483
- function stackClear() {
14484
- this.__data__ = new ListCache;
14485
- }
14486
- function stackDelete(key) {
14487
- return this.__data__["delete"](key);
14488
- }
14489
- function stackGet(key) {
14490
- return this.__data__.get(key);
14491
- }
14492
- function stackHas(key) {
14493
- return this.__data__.has(key);
14494
- }
14495
- function stackSet(key, value) {
14496
- var cache = this.__data__;
14497
- if (cache instanceof ListCache) {
14498
- var pairs = cache.__data__;
14499
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
14500
- pairs.push([key, value]);
14501
- return this;
14502
- }
14503
- cache = this.__data__ = new MapCache(pairs);
14504
- }
14505
- cache.set(key, value);
14506
- return this;
14507
- }
14508
- Stack.prototype.clear = stackClear;
14509
- Stack.prototype["delete"] = stackDelete;
14510
- Stack.prototype.get = stackGet;
14511
- Stack.prototype.has = stackHas;
14512
- Stack.prototype.set = stackSet;
14513
- function arrayLikeKeys(value, inherited) {
14514
- var result = isArray2(value) || isArguments(value) ? baseTimes(value.length, String) : [];
14515
- var length = result.length, skipIndexes = !!length;
14516
- for (var key in value) {
14517
- if (hasOwnProperty.call(value, key) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
14518
- result.push(key);
14519
- }
14520
- }
14521
- return result;
14522
- }
14523
- function assocIndexOf(array, key) {
14524
- var length = array.length;
14525
- while (length--) {
14526
- if (eq(array[length][0], key)) {
14527
- return length;
14528
- }
14529
- }
14530
- return -1;
14531
- }
14532
- var baseEach = createBaseEach(baseForOwn);
14533
- function baseFlatten(array, depth, predicate, isStrict, result) {
14534
- var index = -1, length = array.length;
14535
- predicate || (predicate = isFlattenable);
14536
- result || (result = []);
14537
- while (++index < length) {
14538
- var value = array[index];
14539
- if (predicate(value)) {
14540
- {
14541
- arrayPush(result, value);
14542
- }
14543
- } else {
14544
- result[result.length] = value;
14545
- }
14546
- }
14547
- return result;
14548
- }
14549
- var baseFor = createBaseFor();
14550
- function baseForOwn(object, iteratee) {
14551
- return object && baseFor(object, iteratee, keys);
14552
- }
14553
- function baseGet(object, path) {
14554
- path = isKey(path, object) ? [path] : castPath(path);
14555
- var index = 0, length = path.length;
14556
- while (object != null && index < length) {
14557
- object = object[toKey(path[index++])];
14558
- }
14559
- return index && index == length ? object : undefined;
14560
- }
14561
- function baseGetTag(value) {
14562
- return objectToString.call(value);
14563
- }
14564
- function baseHasIn(object, key) {
14565
- return object != null && key in Object(object);
14566
- }
14567
- function baseIsEqual(value, other, customizer, bitmask, stack) {
14568
- if (value === other) {
14569
- return true;
14570
- }
14571
- if (value == null || other == null || !isObject2(value) && !isObjectLike(other)) {
14572
- return value !== value && other !== other;
14573
- }
14574
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
14575
- }
14576
- function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
14577
- var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = arrayTag, othTag = arrayTag;
14578
- if (!objIsArr) {
14579
- objTag = getTag(object);
14580
- objTag = objTag == argsTag ? objectTag : objTag;
14581
- }
14582
- if (!othIsArr) {
14583
- othTag = getTag(other);
14584
- othTag = othTag == argsTag ? objectTag : othTag;
14585
- }
14586
- var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
14587
- if (isSameTag && !objIsObj) {
14588
- stack || (stack = new Stack);
14589
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
14590
- }
14591
- if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
14592
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
14593
- if (objIsWrapped || othIsWrapped) {
14594
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
14595
- stack || (stack = new Stack);
14596
- return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
14597
- }
14598
- }
14599
- if (!isSameTag) {
14600
- return false;
14601
- }
14602
- stack || (stack = new Stack);
14603
- return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
14604
- }
14605
- function baseIsMatch(object, source, matchData, customizer) {
14606
- var index = matchData.length, length = index;
14607
- if (object == null) {
14608
- return !length;
14609
- }
14610
- object = Object(object);
14611
- while (index--) {
14612
- var data = matchData[index];
14613
- if (data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
14614
- return false;
14615
- }
14616
- }
14617
- while (++index < length) {
14618
- data = matchData[index];
14619
- var key = data[0], objValue = object[key], srcValue = data[1];
14620
- if (data[2]) {
14621
- if (objValue === undefined && !(key in object)) {
14622
- return false;
14623
- }
14624
- } else {
14625
- var stack = new Stack;
14626
- var result;
14627
- if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) {
14628
- return false;
14629
- }
14630
- }
14631
- }
14632
- return true;
14633
- }
14634
- function baseIsNative(value) {
14635
- if (!isObject2(value) || isMasked(value)) {
14636
- return false;
14637
- }
14638
- var pattern = isFunction2(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
14639
- return pattern.test(toSource(value));
14640
- }
14641
- function baseIsTypedArray(value) {
14642
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
14643
- }
14644
- function baseIteratee(value) {
14645
- if (typeof value == "function") {
14646
- return value;
14647
- }
14648
- if (value == null) {
14649
- return identity;
14650
- }
14651
- if (typeof value == "object") {
14652
- return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
14653
- }
14654
- return property(value);
14655
- }
14656
- function baseKeys(object) {
14657
- if (!isPrototype(object)) {
14658
- return nativeKeys(object);
14659
- }
14660
- var result = [];
14661
- for (var key in Object(object)) {
14662
- if (hasOwnProperty.call(object, key) && key != "constructor") {
14663
- result.push(key);
14664
- }
14665
- }
14666
- return result;
14667
- }
14668
- function baseMap(collection, iteratee) {
14669
- var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
14670
- baseEach(collection, function(value, key, collection2) {
14671
- result[++index] = iteratee(value, key, collection2);
14672
- });
14673
- return result;
14674
- }
14675
- function baseMatches(source) {
14676
- var matchData = getMatchData(source);
14677
- if (matchData.length == 1 && matchData[0][2]) {
14678
- return matchesStrictComparable(matchData[0][0], matchData[0][1]);
14679
- }
14680
- return function(object) {
14681
- return object === source || baseIsMatch(object, source, matchData);
14682
- };
14683
- }
14684
- function baseMatchesProperty(path, srcValue) {
14685
- if (isKey(path) && isStrictComparable(srcValue)) {
14686
- return matchesStrictComparable(toKey(path), srcValue);
14687
- }
14688
- return function(object) {
14689
- var objValue = get(object, path);
14690
- return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
14691
- };
14692
- }
14693
- function baseOrderBy(collection, iteratees, orders) {
14694
- var index = -1;
14695
- iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
14696
- var result = baseMap(collection, function(value, key, collection2) {
14697
- var criteria = arrayMap(iteratees, function(iteratee) {
14698
- return iteratee(value);
14699
- });
14700
- return { criteria, index: ++index, value };
14701
- });
14702
- return baseSortBy(result, function(object, other) {
14703
- return compareMultiple(object, other, orders);
14704
- });
14705
- }
14706
- function basePropertyDeep(path) {
14707
- return function(object) {
14708
- return baseGet(object, path);
14709
- };
14710
- }
14711
- function baseRest(func, start) {
14712
- start = nativeMax(start === undefined ? func.length - 1 : start, 0);
14713
- return function() {
14714
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
14715
- while (++index < length) {
14716
- array[index] = args[start + index];
14717
- }
14718
- index = -1;
14719
- var otherArgs = Array(start + 1);
14720
- while (++index < start) {
14721
- otherArgs[index] = args[index];
14722
- }
14723
- otherArgs[start] = array;
14724
- return apply(func, this, otherArgs);
14725
- };
14726
- }
14727
- function baseToString(value) {
14728
- if (typeof value == "string") {
14729
- return value;
14730
- }
14731
- if (isSymbol(value)) {
14732
- return symbolToString ? symbolToString.call(value) : "";
14733
- }
14734
- var result = value + "";
14735
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
14736
- }
14737
- function castPath(value) {
14738
- return isArray2(value) ? value : stringToPath(value);
14739
- }
14740
- function compareAscending(value, other) {
14741
- if (value !== other) {
14742
- var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
14743
- var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
14744
- if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
14745
- return 1;
14746
- }
14747
- if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
14748
- return -1;
14749
- }
14750
- }
14751
- return 0;
14752
- }
14753
- function compareMultiple(object, other, orders) {
14754
- var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
14755
- while (++index < length) {
14756
- var result = compareAscending(objCriteria[index], othCriteria[index]);
14757
- if (result) {
14758
- if (index >= ordersLength) {
14759
- return result;
14760
- }
14761
- var order = orders[index];
14762
- return result * (order == "desc" ? -1 : 1);
14763
- }
14764
- }
14765
- return object.index - other.index;
14766
- }
14767
- function createBaseEach(eachFunc, fromRight) {
14768
- return function(collection, iteratee) {
14769
- if (collection == null) {
14770
- return collection;
14771
- }
14772
- if (!isArrayLike(collection)) {
14773
- return eachFunc(collection, iteratee);
14774
- }
14775
- var length = collection.length, index = -1, iterable = Object(collection);
14776
- while (++index < length) {
14777
- if (iteratee(iterable[index], index, iterable) === false) {
14778
- break;
14779
- }
14780
- }
14781
- return collection;
14782
- };
14783
- }
14784
- function createBaseFor(fromRight) {
14785
- return function(object, iteratee, keysFunc) {
14786
- var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
14787
- while (length--) {
14788
- var key = props[++index];
14789
- if (iteratee(iterable[key], key, iterable) === false) {
14790
- break;
14791
- }
14792
- }
14793
- return object;
14794
- };
14795
- }
14796
- function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
14797
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
14798
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
14799
- return false;
14800
- }
14801
- var stacked = stack.get(array);
14802
- if (stacked && stack.get(other)) {
14803
- return stacked == other;
14804
- }
14805
- var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache : undefined;
14806
- stack.set(array, other);
14807
- stack.set(other, array);
14808
- while (++index < arrLength) {
14809
- var arrValue = array[index], othValue = other[index];
14810
- if (customizer) {
14811
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
14812
- }
14813
- if (compared !== undefined) {
14814
- if (compared) {
14815
- continue;
14816
- }
14817
- result = false;
14818
- break;
14819
- }
14820
- if (seen) {
14821
- if (!arraySome(other, function(othValue2, othIndex) {
14822
- if (!seen.has(othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, customizer, bitmask, stack))) {
14823
- return seen.add(othIndex);
14824
- }
14825
- })) {
14826
- result = false;
14827
- break;
14828
- }
14829
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
14830
- result = false;
14831
- break;
14832
- }
14833
- }
14834
- stack["delete"](array);
14835
- stack["delete"](other);
14836
- return result;
14837
- }
14838
- function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
14839
- switch (tag) {
14840
- case dataViewTag:
14841
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
14842
- return false;
14843
- }
14844
- object = object.buffer;
14845
- other = other.buffer;
14846
- case arrayBufferTag:
14847
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
14848
- return false;
14849
- }
14850
- return true;
14851
- case boolTag:
14852
- case dateTag:
14853
- case numberTag:
14854
- return eq(+object, +other);
14855
- case errorTag:
14856
- return object.name == other.name && object.message == other.message;
14857
- case regexpTag:
14858
- case stringTag:
14859
- return object == other + "";
14860
- case mapTag:
14861
- var convert = mapToArray;
14862
- case setTag:
14863
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
14864
- convert || (convert = setToArray);
14865
- if (object.size != other.size && !isPartial) {
14866
- return false;
14867
- }
14868
- var stacked = stack.get(object);
14869
- if (stacked) {
14870
- return stacked == other;
14871
- }
14872
- bitmask |= UNORDERED_COMPARE_FLAG;
14873
- stack.set(object, other);
14874
- var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
14875
- stack["delete"](object);
14876
- return result;
14877
- case symbolTag:
14878
- if (symbolValueOf) {
14879
- return symbolValueOf.call(object) == symbolValueOf.call(other);
14880
- }
14881
- }
14882
- return false;
14883
- }
14884
- function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
14885
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
14886
- if (objLength != othLength && !isPartial) {
14887
- return false;
14888
- }
14889
- var index = objLength;
14890
- while (index--) {
14891
- var key = objProps[index];
14892
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
14893
- return false;
14894
- }
14895
- }
14896
- var stacked = stack.get(object);
14897
- if (stacked && stack.get(other)) {
14898
- return stacked == other;
14899
- }
14900
- var result = true;
14901
- stack.set(object, other);
14902
- stack.set(other, object);
14903
- var skipCtor = isPartial;
14904
- while (++index < objLength) {
14905
- key = objProps[index];
14906
- var objValue = object[key], othValue = other[key];
14907
- if (customizer) {
14908
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
14909
- }
14910
- if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
14911
- result = false;
14912
- break;
14913
- }
14914
- skipCtor || (skipCtor = key == "constructor");
14915
- }
14916
- if (result && !skipCtor) {
14917
- var objCtor = object.constructor, othCtor = other.constructor;
14918
- if (objCtor != othCtor && (("constructor" in object) && ("constructor" in other)) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
14919
- result = false;
14920
- }
14921
- }
14922
- stack["delete"](object);
14923
- stack["delete"](other);
14924
- return result;
14925
- }
14926
- function getMapData(map, key) {
14927
- var data = map.__data__;
14928
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
14929
- }
14930
- function getMatchData(object) {
14931
- var result = keys(object), length = result.length;
14932
- while (length--) {
14933
- var key = result[length], value = object[key];
14934
- result[length] = [key, value, isStrictComparable(value)];
14935
- }
14936
- return result;
14937
- }
14938
- function getNative(object, key) {
14939
- var value = getValue(object, key);
14940
- return baseIsNative(value) ? value : undefined;
14941
- }
14942
- var getTag = baseGetTag;
14943
- if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2) != setTag || WeakMap2 && getTag(new WeakMap2) != weakMapTag) {
14944
- getTag = function(value) {
14945
- var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined;
14946
- if (ctorString) {
14947
- switch (ctorString) {
14948
- case dataViewCtorString:
14949
- return dataViewTag;
14950
- case mapCtorString:
14951
- return mapTag;
14952
- case promiseCtorString:
14953
- return promiseTag;
14954
- case setCtorString:
14955
- return setTag;
14956
- case weakMapCtorString:
14957
- return weakMapTag;
14958
- }
14959
- }
14960
- return result;
14961
- };
14962
- }
14963
- function hasPath(object, path, hasFunc) {
14964
- path = isKey(path, object) ? [path] : castPath(path);
14965
- var result, index = -1, length = path.length;
14966
- while (++index < length) {
14967
- var key = toKey(path[index]);
14968
- if (!(result = object != null && hasFunc(object, key))) {
14969
- break;
14970
- }
14971
- object = object[key];
14972
- }
14973
- if (result) {
14974
- return result;
14975
- }
14976
- var length = object ? object.length : 0;
14977
- return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
14978
- }
14979
- function isFlattenable(value) {
14980
- return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
14981
- }
14982
- function isIndex(value, length) {
14983
- length = length == null ? MAX_SAFE_INTEGER : length;
14984
- return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
14985
- }
14986
- function isIterateeCall(value, index, object) {
14987
- if (!isObject2(object)) {
14988
- return false;
14989
- }
14990
- var type = typeof index;
14991
- if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && (index in object)) {
14992
- return eq(object[index], value);
14993
- }
14994
- return false;
14995
- }
14996
- function isKey(value, object) {
14997
- if (isArray2(value)) {
14998
- return false;
14999
- }
15000
- var type = typeof value;
15001
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
15002
- return true;
15003
- }
15004
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
15005
- }
15006
- function isKeyable(value) {
15007
- var type = typeof value;
15008
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
15009
- }
15010
- function isMasked(func) {
15011
- return !!maskSrcKey && maskSrcKey in func;
15012
- }
15013
- function isPrototype(value) {
15014
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
15015
- return value === proto;
15016
- }
15017
- function isStrictComparable(value) {
15018
- return value === value && !isObject2(value);
15019
- }
15020
- function matchesStrictComparable(key, srcValue) {
15021
- return function(object) {
15022
- if (object == null) {
15023
- return false;
15024
- }
15025
- return object[key] === srcValue && (srcValue !== undefined || (key in Object(object)));
15026
- };
15027
- }
15028
- var stringToPath = memoize(function(string) {
15029
- string = toString(string);
15030
- var result = [];
15031
- if (reLeadingDot.test(string)) {
15032
- result.push("");
15033
- }
15034
- string.replace(rePropName, function(match, number, quote, string2) {
15035
- result.push(quote ? string2.replace(reEscapeChar, "$1") : number || match);
15036
- });
15037
- return result;
15038
- });
15039
- function toKey(value) {
15040
- if (typeof value == "string" || isSymbol(value)) {
15041
- return value;
15042
- }
15043
- var result = value + "";
15044
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
15045
- }
15046
- function toSource(func) {
15047
- if (func != null) {
15048
- try {
15049
- return funcToString.call(func);
15050
- } catch (e) {}
15051
- try {
15052
- return func + "";
15053
- } catch (e) {}
15054
- }
15055
- return "";
15056
- }
15057
- var sortBy = baseRest(function(collection, iteratees) {
15058
- if (collection == null) {
15059
- return [];
15060
- }
15061
- var length = iteratees.length;
15062
- if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
15063
- iteratees = [];
15064
- } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
15065
- iteratees = [iteratees[0]];
15066
- }
15067
- return baseOrderBy(collection, baseFlatten(iteratees), []);
15068
- });
15069
- function memoize(func, resolver) {
15070
- if (typeof func != "function" || resolver && typeof resolver != "function") {
15071
- throw new TypeError(FUNC_ERROR_TEXT);
15072
- }
15073
- var memoized = function() {
15074
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
15075
- if (cache.has(key)) {
15076
- return cache.get(key);
15077
- }
15078
- var result = func.apply(this, args);
15079
- memoized.cache = cache.set(key, result);
15080
- return result;
15081
- };
15082
- memoized.cache = new (memoize.Cache || MapCache);
15083
- return memoized;
15084
- }
15085
- memoize.Cache = MapCache;
15086
- function eq(value, other) {
15087
- return value === other || value !== value && other !== other;
15088
- }
15089
- function isArguments(value) {
15090
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
15091
- }
15092
- var isArray2 = Array.isArray;
15093
- function isArrayLike(value) {
15094
- return value != null && isLength(value.length) && !isFunction2(value);
15095
- }
15096
- function isArrayLikeObject(value) {
15097
- return isObjectLike(value) && isArrayLike(value);
15098
- }
15099
- function isFunction2(value) {
15100
- var tag = isObject2(value) ? objectToString.call(value) : "";
15101
- return tag == funcTag || tag == genTag;
15102
- }
15103
- function isLength(value) {
15104
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
15105
- }
15106
- function isObject2(value) {
15107
- var type = typeof value;
15108
- return !!value && (type == "object" || type == "function");
15109
- }
15110
- function isObjectLike(value) {
15111
- return !!value && typeof value == "object";
15112
- }
15113
- function isSymbol(value) {
15114
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
15115
- }
15116
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
15117
- function toString(value) {
15118
- return value == null ? "" : baseToString(value);
15119
- }
15120
- function get(object, path, defaultValue) {
15121
- var result = object == null ? undefined : baseGet(object, path);
15122
- return result === undefined ? defaultValue : result;
15123
- }
15124
- function hasIn(object, path) {
15125
- return object != null && hasPath(object, path, baseHasIn);
15126
- }
15127
- function keys(object) {
15128
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
15129
- }
15130
- function identity(value) {
15131
- return value;
15132
- }
15133
- function property(path) {
15134
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
15135
- }
15136
- module.exports = sortBy;
15137
- })(lodash_sortby, lodash_sortby.exports);
15138
- return lodash_sortby.exports;
15139
- }
15140
- function requireEscapeStringRegexp() {
15141
- if (hasRequiredEscapeStringRegexp)
15142
- return escapeStringRegexp;
15143
- hasRequiredEscapeStringRegexp = 1;
15144
- escapeStringRegexp = (string) => {
15145
- if (typeof string !== "string") {
15146
- throw new TypeError("Expected a string");
15147
- }
15148
- return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
15149
- };
15150
- return escapeStringRegexp;
15151
- }
15152
- function requireRegexpParse() {
15153
- if (hasRequiredRegexpParse)
15154
- return regexpParse;
15155
- hasRequiredRegexpParse = 1;
15156
- Object.defineProperty(regexpParse, "__esModule", { value: true });
15157
- regexpParse.isRegExpString = regexpParse.parseRegExpString = undefined;
15158
- var REGEXP_LITERAL_PATTERN = /^\/(.+)\/([guimysd]*)$/;
15159
- var parseRegExpString = function(str) {
15160
- var result = str.match(REGEXP_LITERAL_PATTERN);
15161
- if (!result) {
15162
- return null;
15163
- }
15164
- return {
15165
- source: result[1],
15166
- flagString: result[2]
15167
- };
12555
+ return "HASH{" + joinedPairs.join(", ") + "}";
15168
12556
  };
15169
- regexpParse.parseRegExpString = parseRegExpString;
15170
- var isRegExpString = function(str) {
15171
- return REGEXP_LITERAL_PATTERN.test(str);
12557
+ PrintVisitor.prototype.HashPair = function(pair) {
12558
+ return pair.key + "=" + this.accept(pair.value);
15172
12559
  };
15173
- regexpParse.isRegExpString = isRegExpString;
15174
- return regexpParse;
15175
- }
15176
- function requireRegexpStringMatcher() {
15177
- if (hasRequiredRegexpStringMatcher)
15178
- return regexpStringMatcher;
15179
- hasRequiredRegexpStringMatcher = 1;
15180
- (function(exports$1) {
15181
- var __importDefault = regexpStringMatcher && regexpStringMatcher.__importDefault || function(mod) {
15182
- return mod && mod.__esModule ? mod : { default: mod };
15183
- };
15184
- Object.defineProperty(exports$1, "__esModule", { value: true });
15185
- exports$1.matchPatterns = exports$1.createRegExp = undefined;
15186
- var lodash_uniq_1 = __importDefault(requireLodash_uniq());
15187
- var lodash_uniqwith_1 = __importDefault(requireLodash_uniqwith());
15188
- var lodash_sortby_1 = __importDefault(requireLodash_sortby());
15189
- var escape_string_regexp_1 = __importDefault(requireEscapeStringRegexp());
15190
- var regexp_parse_1 = requireRegexpParse();
15191
- var DEFAULT_FLAGS = "ug";
15192
- var defaultFlags = function(flagsString) {
15193
- if (flagsString.length === 0) {
15194
- return DEFAULT_FLAGS;
15195
- }
15196
- return (0, lodash_uniq_1.default)((flagsString + DEFAULT_FLAGS).split("")).join("");
15197
- };
15198
- var createRegExp = function(patternString, defaultFlag) {
15199
- if (defaultFlag === undefined) {
15200
- defaultFlag = DEFAULT_FLAGS;
15201
- }
15202
- if (patternString.length === 0) {
15203
- throw new Error("Empty string can not handled");
15204
- }
15205
- if ((0, regexp_parse_1.isRegExpString)(patternString)) {
15206
- var regExpStructure = (0, regexp_parse_1.parseRegExpString)(patternString);
15207
- if (regExpStructure) {
15208
- return new RegExp(regExpStructure.source, defaultFlags(regExpStructure.flagString));
15209
- }
15210
- throw new Error('"'.concat(patternString, '" can not parse as RegExp.'));
15211
- } else {
15212
- return new RegExp((0, escape_string_regexp_1.default)(patternString), defaultFlag);
15213
- }
15214
- };
15215
- exports$1.createRegExp = createRegExp;
15216
- var isEqualMatchPatternResult = function(a, b) {
15217
- return a.startIndex === b.startIndex && a.endIndex === b.endIndex && a.match === b.match;
15218
- };
15219
- var matchPatterns = function(text, regExpLikeStrings) {
15220
- var matchPatternResults = [];
15221
- regExpLikeStrings.map(function(patternString) {
15222
- return (0, exports$1.createRegExp)(patternString);
15223
- }).forEach(function(regExp) {
15224
- var results = text.matchAll(regExp);
15225
- Array.from(results).forEach(function(result) {
15226
- if (result.index === undefined) {
15227
- return;
15228
- }
15229
- var match = result[0];
15230
- var index = result.index;
15231
- matchPatternResults.push({
15232
- match,
15233
- captures: result.slice(1),
15234
- startIndex: index,
15235
- endIndex: index + match.length
15236
- });
15237
- });
15238
- });
15239
- var uniqResults = (0, lodash_uniqwith_1.default)(matchPatternResults, isEqualMatchPatternResult);
15240
- return (0, lodash_sortby_1.default)(uniqResults, ["startIndex", "endIndex"]);
15241
- };
15242
- exports$1.matchPatterns = matchPatterns;
15243
- })(regexpStringMatcher);
15244
- return regexpStringMatcher;
15245
- }
15246
- var commonjsGlobal, regexpStringMatcher, lodash_uniq, hasRequiredLodash_uniq, lodash_uniqwith, hasRequiredLodash_uniqwith, lodash_sortby, hasRequiredLodash_sortby, escapeStringRegexp, hasRequiredEscapeStringRegexp, regexpParse, hasRequiredRegexpParse, hasRequiredRegexpStringMatcher, regexpStringMatcherExports, OID_DATA, OID_SHA1, OID_SHA256, OID_SHA384, OID_SHA512, typeMap;
15247
- var init_module2 = __esm(() => {
15248
- commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
15249
- regexpStringMatcher = {};
15250
- lodash_sortby = { exports: {} };
15251
- lodash_sortby.exports;
15252
- regexpParse = {};
15253
- regexpStringMatcherExports = requireRegexpStringMatcher();
15254
- OID_DATA = new Uint8Array([42, 134, 72, 134, 247, 13, 1, 7, 1]);
15255
- OID_SHA1 = new Uint8Array([43, 14, 3, 2, 26]);
15256
- OID_SHA256 = new Uint8Array([96, 134, 72, 1, 101, 3, 4, 2, 1]);
15257
- OID_SHA384 = new Uint8Array([96, 134, 72, 1, 101, 3, 4, 2, 2]);
15258
- OID_SHA512 = new Uint8Array([96, 134, 72, 1, 101, 3, 4, 2, 3]);
15259
- typeMap = new Map([
15260
- ["ghp", "GitHub personal access tokens"],
15261
- ["gho", "OAuth access tokens"],
15262
- ["ghu", "GitHub user-to-server tokens"],
15263
- ["ghs", "GitHub server-to-server tokens"],
15264
- ["ghr", "refresh tokens"],
15265
- ["github_pat", "fine-grained personal access tokens"]
15266
- ]);
15267
- });
15268
-
15269
- // telegram-plugin/secret-detect/secretlint-source.ts
15270
- var init_secretlint_source = __esm(() => {
15271
- init_module();
15272
- init_module2();
15273
- init_suppressor();
15274
12560
  });
15275
12561
 
15276
- // src/util/atomic.ts
15277
- import { closeSync as closeSync2, constants, fsyncSync, openSync as openSync2, renameSync as renameSync2, rmSync, writeSync } from "node:fs";
15278
- var TMP_OPEN_FLAGS;
15279
- var init_atomic = __esm(() => {
15280
- TMP_OPEN_FLAGS = constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0);
12562
+ // node_modules/.bun/handlebars@4.7.9/node_modules/handlebars/lib/index.js
12563
+ var require_lib = __commonJS((exports, module) => {
12564
+ var handlebars = require_handlebars()["default"];
12565
+ var printer = require_printer();
12566
+ handlebars.PrintVisitor = printer.PrintVisitor;
12567
+ handlebars.print = printer.print;
12568
+ module.exports = handlebars;
12569
+ function extension(module2, filename) {
12570
+ var fs = __require("fs");
12571
+ var templateString = fs.readFileSync(filename, "utf8");
12572
+ module2.exports = handlebars.compile(templateString);
12573
+ }
12574
+ if (__require.extensions) {
12575
+ __require.extensions[".handlebars"] = extension;
12576
+ __require.extensions[".hbs"] = extension;
12577
+ }
15281
12578
  });
15282
12579
 
15283
12580
  // node_modules/.bun/commander@13.1.0/node_modules/commander/lib/error.js
@@ -15986,10 +13283,10 @@ var require_suggestSimilar = __commonJS((exports2) => {
15986
13283
 
15987
13284
  // node_modules/.bun/commander@13.1.0/node_modules/commander/lib/command.js
15988
13285
  var require_command = __commonJS((exports2) => {
15989
- var EventEmitter2 = __require("node:events").EventEmitter;
13286
+ var EventEmitter = __require("node:events").EventEmitter;
15990
13287
  var childProcess = __require("node:child_process");
15991
13288
  var path2 = __require("node:path");
15992
- var fs2 = __require("node:fs");
13289
+ var fs3 = __require("node:fs");
15993
13290
  var process2 = __require("node:process");
15994
13291
  var { Argument, humanReadableArgName } = require_argument();
15995
13292
  var { CommanderError } = require_error();
@@ -15997,7 +13294,7 @@ var require_command = __commonJS((exports2) => {
15997
13294
  var { Option, DualOptions } = require_option();
15998
13295
  var { suggestSimilar } = require_suggestSimilar();
15999
13296
 
16000
- class Command extends EventEmitter2 {
13297
+ class Command extends EventEmitter {
16001
13298
  constructor(name) {
16002
13299
  super();
16003
13300
  this.commands = [];
@@ -16510,7 +13807,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
16510
13807
  this.processedArgs = [];
16511
13808
  }
16512
13809
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
16513
- if (fs2.existsSync(executableFile))
13810
+ if (fs3.existsSync(executableFile))
16514
13811
  return;
16515
13812
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
16516
13813
  const executableMissing = `'${executableFile}' does not exist
@@ -16525,11 +13822,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
16525
13822
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
16526
13823
  function findFile(baseDir, baseName) {
16527
13824
  const localBin = path2.resolve(baseDir, baseName);
16528
- if (fs2.existsSync(localBin))
13825
+ if (fs3.existsSync(localBin))
16529
13826
  return localBin;
16530
13827
  if (sourceExt.includes(path2.extname(baseName)))
16531
13828
  return;
16532
- const foundExt = sourceExt.find((ext) => fs2.existsSync(`${localBin}${ext}`));
13829
+ const foundExt = sourceExt.find((ext) => fs3.existsSync(`${localBin}${ext}`));
16533
13830
  if (foundExt)
16534
13831
  return `${localBin}${foundExt}`;
16535
13832
  return;
@@ -16541,7 +13838,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
16541
13838
  if (this._scriptPath) {
16542
13839
  let resolvedScriptPath;
16543
13840
  try {
16544
- resolvedScriptPath = fs2.realpathSync(this._scriptPath);
13841
+ resolvedScriptPath = fs3.realpathSync(this._scriptPath);
16545
13842
  } catch {
16546
13843
  resolvedScriptPath = this._scriptPath;
16547
13844
  }
@@ -17316,7 +14613,7 @@ var require_commander = __commonJS((exports2) => {
17316
14613
 
17317
14614
  // src/host-control/main.ts
17318
14615
  import { homedir as homedir6 } from "node:os";
17319
- import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
14616
+ import { existsSync as existsSync12, readdirSync as readdirSync4 } from "node:fs";
17320
14617
  import { join as join11, resolve as resolve9 } from "node:path";
17321
14618
 
17322
14619
  // src/config/loader.ts
@@ -21399,7 +18696,12 @@ var ScheduleEntrySchema = exports_external.object({
21399
18696
  var AgentSoulSchema = exports_external.object({
21400
18697
  name: exports_external.string().describe("Agent persona name (e.g., 'Coach', 'Sage')"),
21401
18698
  style: exports_external.string().describe("Communication style description"),
21402
- boundaries: exports_external.string().optional().describe("Behavioral boundaries and disclaimers")
18699
+ creature: exports_external.string().optional().describe("Persona creature/form (e.g., 'owl', 'octopus')"),
18700
+ vibe: exports_external.string().optional().describe("One-line personality vibe (e.g., 'calm, precise')"),
18701
+ expertise: exports_external.string().optional().describe("Domain expertise summary rendered into the persona"),
18702
+ emoji: exports_external.string().optional().describe("Signature emoji for the persona (e.g., '\uD83E\uDD89')"),
18703
+ boundaries: exports_external.string().optional().describe("Behavioral boundaries and disclaimers"),
18704
+ shape: exports_external.enum(["executive-assistant", "developer", "coach", "generalist"]).default("generalist").describe("Persona-shape discriminator the per-agent CLAUDE.md template can " + "branch on (e.g., 'you are an executive assistant' vs 'a senior " + "engineer'). No runtime behavior yet — template work lands in a " + "later issue. Cascade: override (per-agent wins over default).")
21403
18705
  }).optional();
21404
18706
  var AgentToolsSchema = exports_external.object({
21405
18707
  allow: exports_external.array(exports_external.string()).default([]).describe("Allowed tools (use ['all'] for unrestricted)"),
@@ -21564,6 +18866,11 @@ var TelegramChannelSchema = exports_external.object({
21564
18866
  safe_boundary: exports_external.boolean().optional().describe("When true (the default), a `!`-prefix interrupt that arrives while " + "the agent is mid-tool-call is DEFERRED: the SIGINT and the " + "replacement turn wait until the in-flight tool call finishes (a " + "clean boundary) instead of C-c'ing the agent mid-write/mid-bash. If " + "no tool is in flight the interrupt still fires immediately. Bounded " + "by max_wait_ms so a long tool never strands the user. Set false to " + "fire synchronously the moment `!` is received (historical " + "behaviour). Rapid repeated `!` while one is pending coalesce into a " + "single deferred interrupt carrying the latest body."),
21565
18867
  max_wait_ms: exports_external.number().int().positive().optional().describe("Upper bound (ms) the gateway waits for a safe boundary before firing " + "a deferred `!` interrupt anyway. Only consulted when safe_boundary is " + "true. Default 8000. Keep it short — the user explicitly asked to " + "interrupt, so a long in-flight tool shouldn't ghost them; the cap " + "trades a tiny risk of a mid-tool C-c for a guaranteed response.")
21566
18868
  }).optional().describe("Interrupt timing — how a `!`-prefix interrupt behaves when it lands " + "mid-tool-call. Off by default (fire immediately). Cascades from " + "defaults.channels.telegram.interrupt."),
18869
+ button_choice_confirmation: exports_external.object({
18870
+ enabled: exports_external.boolean().default(false).describe("When true, tapping an agent-emitted inline_keyboard button annotates " + "the source message body with a '✅ You chose: <label> · HH:MM' line so " + "the chat surface is self-documenting. Only applies to single-use " + "keyboards (re-tappable keyboards are never annotated). Requires the " + "agent's parseMode to be the default 'html'. Opt-in (default false). " + "Limitation: the annotated body is rebuilt from the message's plain " + "text, so any formatting entities (bold, links, code, ...) on the " + "original message are lost when the annotation is applied."),
18871
+ format: exports_external.string().default("✅ You chose: {label} · {time}").describe("Template for the annotation line. `{label}` is replaced with the " + "tapped button's text (newlines stripped, HTML-escaped, trimmed to 60 " + "chars) and `{time}` with HH:MM in the chosen timezone. Note: retap " + "dedup (replacing a prior annotation instead of appending another " + "line) only recognizes the DEFAULT format shape — a custom format " + "accumulates one line per retap."),
18872
+ timezone: exports_external.enum(["gateway", "utc"]).default("gateway").describe("Timezone for the {time} placeholder. 'gateway' uses the gateway " + "process's local time; 'utc' uses UTC. Per-user timezones are out of " + "scope for v1.")
18873
+ }).optional().describe("Auto-confirm 'You chose: X' annotation on inline_keyboard taps (#789). " + "Cascades from defaults.channels.telegram.button_choice_confirmation."),
21567
18874
  webhook_sources: exports_external.array(exports_external.enum(["github", "generic", "linear"])).optional().describe("External webhook sources allowed to ingest events into this agent's " + "log. POST /webhook/<agent>/<source> on the switchroom web server. " + "Each source has its own signature verification ('github' = " + "X-Hub-Signature-256 HMAC-SHA256, 'generic' = Bearer token, " + "'linear' = Linear-Signature bare-hex HMAC-SHA256 of the raw body). " + "Per-source secret read from ~/.switchroom/webhook-secrets.json " + "keyed by [agent][source]. Verified events append to " + "<agent>/telegram/webhook-events.jsonl for the agent to read on " + "demand. Off by default — webhook is the only untrusted-inbound " + "surface in the system, so opt-in is mandatory. " + "Cascades from defaults.channels.telegram.webhook_sources. " + "(Migrated from per-agent root in #596 — see #577.)"),
21568
18875
  webhook_dispatch: exports_external.object({
21569
18876
  github: exports_external.array(webhookDispatchRule).optional(),
@@ -21712,7 +19019,12 @@ var profileFields = {
21712
19019
  soul: exports_external.object({
21713
19020
  name: exports_external.string().optional(),
21714
19021
  style: exports_external.string().optional(),
21715
- boundaries: exports_external.string().optional()
19022
+ creature: exports_external.string().optional(),
19023
+ vibe: exports_external.string().optional(),
19024
+ expertise: exports_external.string().optional(),
19025
+ emoji: exports_external.string().optional(),
19026
+ boundaries: exports_external.string().optional(),
19027
+ shape: exports_external.enum(["executive-assistant", "developer", "coach", "generalist"]).optional()
21716
19028
  }).optional(),
21717
19029
  tools: exports_external.object({
21718
19030
  allow: exports_external.array(exports_external.string()).optional(),
@@ -21909,7 +19221,8 @@ var VaultConfigSchema = exports_external.object({
21909
19221
  autoUnlockCredentialPath: exports_external.string().default("~/.switchroom/vault-auto-unlock").describe("Path to the machine-bound auto-unlock blob (see " + "src/vault/auto-unlock.ts for the format). Default lives under " + "~/.switchroom so it can be bind-mounted into the vault-broker " + "container by docker compose. Tilde-expansion happens " + "at read time."),
21910
19222
  approvalAuth: exports_external.enum(["passphrase", "telegram-id"]).default("passphrase").describe("Posture for tap-to-Approve on vault grant cards. `passphrase` " + "(default) prompts the operator to type the vault passphrase on " + "every Approve — two-factor (Telegram ID + passphrase). " + "`telegram-id` mints immediately on Approve with no passphrase " + "prompt — single-factor (Telegram ID only); REQUIRES " + "`autoUnlock: true` so the broker already holds the passphrase. " + "Trades a factor of security for smoother UX; opt-in only."),
21911
19223
  postureMintAgents: exports_external.array(exports_external.string().min(1)).default([]).describe("Per-agent opt-in for posture-attested broker calls (`mint_grant` / " + "`list_grants` / `put` with `attest_via_posture: true`). Only agents " + "whose names are in this list can use the silent-mint path under " + "`approvalAuth: telegram-id`. Default `[]` — no agent can self-mint " + "until the operator explicitly opts it in. The request's `agent` " + "field must also equal the calling peer's resolved agent name " + "(broker rejects cross-agent posture mints). When `approvalAuth` is " + "`passphrase` this list is ignored — passphrase attestation still " + "works as before. Each entry is an agent slug exactly as it appears " + "under `agents:` in this config."),
21912
- adminOnlyKeys: exports_external.array(exports_external.string().min(1)).default([]).describe("Vault keys held to a higher approval bar: only the admin operator " + "(`access.allowFrom[0]`) may approve a grant for them, and they can " + "NEVER be minted via posture attestation — granting one requires the " + "operator passphrase (so an agent, even one on `postureMintAgents`, " + "cannot self-grant it). Entries are exact key names or `*` globs, " + "e.g. `stripe/*`, `*/oauth-token`, `microsoft/ken-tokens` (`*` matches " + "any run of characters incl. `/`; case-sensitive). Default `[]` — no " + "key is admin-only. Posture may RETAIN an admin-only key across a " + "union re-mint but never ADD one. Takes effect on broker + gateway " + "restart (broker has no ACL hot-reload).")
19224
+ adminOnlyKeys: exports_external.array(exports_external.string().min(1)).default([]).describe("Vault keys held to a higher approval bar: only the admin operator " + "(`access.allowFrom[0]`) may approve a grant for them, and they can " + "NEVER be minted via posture attestation — granting one requires the " + "operator passphrase (so an agent, even one on `postureMintAgents`, " + "cannot self-grant it). Entries are exact key names or `*` globs, " + "e.g. `stripe/*`, `*/oauth-token`, `microsoft/ken-tokens` (`*` matches " + "any run of characters incl. `/`; case-sensitive). Default `[]` — no " + "key is admin-only. Posture may RETAIN an admin-only key across a " + "union re-mint but never ADD one. Takes effect on broker + gateway " + "restart (broker has no ACL hot-reload)."),
19225
+ auditFailClosed: exports_external.boolean().default(false).describe("sec WS10-F3 (#1420) — fail-CLOSED on an audit-append failure. When " + "`false` (default, backward-compatible) the broker fails OPEN: if a " + "vault-audit.log append fails it logs to stderr, bumps the durable " + "fail-open counter, and STILL releases the secret. When `true`, a " + "failed audit append DENIES the secret release with " + "`AUDIT_UNAVAILABLE` — no secret leaves the broker without a durable " + "audit row. The env var `SWITCHROOM_VAULT_AUDIT_FAIL_CLOSED` " + "(`1`/`true` or `0`/`false`) overrides this at runtime. Either way " + "the fail-open counter is surfaced by `switchroom doctor`. Takes " + "effect on broker restart.")
21913
19226
  }).default({}).superRefine((broker, ctx) => {
21914
19227
  if (broker.approvalAuth === "telegram-id" && broker.autoUnlock !== true) {
21915
19228
  ctx.addIssue({
@@ -21948,7 +19261,9 @@ var FleetHealthConfigSchema = exports_external.object({
21948
19261
  });
21949
19262
  var HostdConfigSchema = exports_external.object({
21950
19263
  config_edit_enabled: exports_external.boolean().default(false).describe("Opt-in toggle for the `config_propose_edit` hostd verb (RFC " + "admin-agent-config-edit §3). Default false — the verb returns " + "`E_CONFIG_EDIT_DISABLED` until the operator explicitly flips " + "this to true. When true, admin agents can propose unified-diff " + "patches against " + "`/state/config/switchroom.yaml`, gated by an operator approval " + "card in the primary chat. Same trust posture as `update_apply` " + "and `agent_restart`: the human-in-the-loop tap is the security " + "boundary, not the agent's judgement."),
21951
- config_edit_rate_per_hour: exports_external.number().int().min(1).max(20).default(3).describe("Per-requesting-agent rate cap for `config_propose_edit` cards " + "(RFC admin-agent-config-edit §5). Default 3 cards/hour; min 1, " + "max 20. ENFORCED server-side: a caller exceeding this in a sliding " + "1-hour window is rejected with `E_RATE_LIMITED` (carrying a " + "`retry_after` fix) instead of posting another operator approval " + "card — so a looping agent is throttled rather than spamming the chat.")
19264
+ config_edit_rate_per_hour: exports_external.number().int().min(1).max(20).default(3).describe("Per-requesting-agent rate cap for `config_propose_edit` cards " + "(RFC admin-agent-config-edit §5). Default 3 cards/hour; min 1, " + "max 20. ENFORCED server-side: a caller exceeding this in a sliding " + "1-hour window is rejected with `E_RATE_LIMITED` (carrying a " + "`retry_after` fix) instead of posting another operator approval " + "card — so a looping agent is throttled rather than spamming the chat."),
19265
+ operator_attest_enabled: exports_external.boolean().default(false).describe("Opt-in toggle for the operator-passphrase 2nd factor on hostd's " + "mutating verbs (#1841, RFC host-control-daemon.md §5.4). Default " + "false — attestation is ACCEPTED-and-audited whenever present, but " + "no verb REQUIRES it (behaviour is byte-identical to today, so " + "existing fleets and the Telegram approval-card flow are unchanged). " + "When true, the verbs in `operator_attest_required_verbs` demand a " + "valid operator-passphrase attestation IN ADDITION to admin: hostd " + "forwards the passphrase to the vault broker over its own admin-client " + "connection (`/run/switchroom/broker/hostd/sock`) and treats a broker " + "DENIED as a gate failure. hostd never holds the passphrase. Leave " + "this off until BOTH the gateway passphrase-forward and the " + "cross-compose broker socket are deployed, or gated verbs will fail."),
19266
+ operator_attest_required_verbs: exports_external.array(exports_external.string().min(1)).default(["update_apply", "apply", "rollout"]).describe("Which mutating hostd verbs REQUIRE a valid operator-passphrase " + "attestation when `operator_attest_enabled` is true (#1841). Default " + "is the RFC §5.4 fleet-mutation set (`update_apply`, `apply`, " + "`rollout`). Verbs NOT in this list still accept-and-audit an " + "attestation when one is supplied, but never require it. Ignored " + "entirely when `operator_attest_enabled` is false.")
21952
19267
  });
21953
19268
  var CronEgressSchema = exports_external.object({
21954
19269
  allowed_hosts: exports_external.array(exports_external.string().min(1)).default([]).describe("Hosts a poll may reach (exact, https-only). loopback/private/IP-literal are always rejected."),
@@ -22371,6 +19686,11 @@ function mergeAgentConfig(defaultsIn, agentIn) {
22371
19686
  if (v !== undefined)
22372
19687
  combined[k] = v;
22373
19688
  }
19689
+ const baseSoul = base;
19690
+ const overrideSoul = override;
19691
+ if (baseSoul.shape !== undefined && (overrideSoul.shape === undefined || overrideSoul.shape === "generalist")) {
19692
+ combined.shape = baseSoul.shape;
19693
+ }
22374
19694
  merged.soul = combined;
22375
19695
  }
22376
19696
  if (defaults.memory || merged.memory) {
@@ -23182,6 +20502,7 @@ import { createHash } from "node:crypto";
23182
20502
 
23183
20503
  // src/agents/scaffold.ts
23184
20504
  import { join as join5, resolve as resolve5 } from "node:path";
20505
+ init_atomic();
23185
20506
 
23186
20507
  // src/config/timezone.ts
23187
20508
  var CONTAINER_DEFAULT_UTC_ZONES = new Set([
@@ -23230,18 +20551,22 @@ var tails = new Map;
23230
20551
 
23231
20552
  // src/agents/inject.ts
23232
20553
  var INJECT_COMMANDS = new Map([
23233
- ["/cost", { description: "Show session cost", expectsOutput: true, dialog: true }],
23234
- ["/status", { description: "Show session status", expectsOutput: true, dialog: true }],
23235
- ["/usage", { description: "Show plan quota", expectsOutput: true, dialog: true }],
23236
- ["/hooks", { description: "List configured hooks", expectsOutput: true, dialog: true }],
23237
- ["/memory", { description: "Open memory picker", expectsOutput: true, dialog: true }],
23238
- ["/model", { description: "Open model picker", expectsOutput: true }],
20554
+ ["/cost", { description: "Show session cost", expectsOutput: true, dialog: true, argsAllowed: false }],
20555
+ ["/status", { description: "Show session status", expectsOutput: true, dialog: true, argsAllowed: false }],
20556
+ ["/usage", { description: "Show plan quota", expectsOutput: true, dialog: true, argsAllowed: false }],
20557
+ ["/hooks", { description: "List configured hooks", expectsOutput: true, dialog: true, argsAllowed: false }],
20558
+ ["/memory", { description: "Open memory picker", expectsOutput: true, dialog: true, argsAllowed: false }],
20559
+ ["/help", { description: "Show help / command discovery", expectsOutput: true, dialog: true, argsAllowed: false }],
20560
+ ["/context", { description: "Show context window usage", expectsOutput: true, argsAllowed: false }],
20561
+ ["/release-notes", { description: "Show release-notes version list", expectsOutput: true, dialog: true, argsAllowed: false }],
20562
+ ["/model", { description: "Open model picker", expectsOutput: true, argsAllowed: true }],
23239
20563
  [
23240
20564
  "/clear",
23241
20565
  {
23242
20566
  description: "Clear session screen",
23243
20567
  expectsOutput: false,
23244
- silentNote: "context cleared — fresh slate"
20568
+ silentNote: "context cleared — fresh slate",
20569
+ argsAllowed: false
23245
20570
  }
23246
20571
  ],
23247
20572
  [
@@ -23249,7 +20574,8 @@ var INJECT_COMMANDS = new Map([
23249
20574
  {
23250
20575
  description: "Compact conversation history",
23251
20576
  expectsOutput: false,
23252
- silentNote: "compaction runs silently"
20577
+ silentNote: "compaction runs silently",
20578
+ argsAllowed: false
23253
20579
  }
23254
20580
  ]
23255
20581
  ]);
@@ -23259,6 +20585,15 @@ var INJECT_BLOCKED = new Map([
23259
20585
  ["/logout", { reason: "would terminate the agent's auth session" }],
23260
20586
  ["/exit", { reason: "would kill the agent process" }],
23261
20587
  ["/quit", { reason: "would kill the agent process" }],
20588
+ ["/upgrade", { reason: "mutates the Claude Code installation" }],
20589
+ ["/init", { reason: "generates/overwrites CLAUDE.md and runs a model turn" }],
20590
+ ["/mcp", { reason: "opens an interactive MCP server management dialog" }],
20591
+ ["/permissions", { reason: "opens an interactive permissions editor that mutates tool policy" }],
20592
+ ["/install-github-app", { reason: "runs a network/OAuth install flow" }],
20593
+ ["/add-dir", { reason: "mutates the session's working-directory set" }],
20594
+ ["/terminal-setup", { reason: "mutates terminal keybinding configuration" }],
20595
+ ["/privacy-settings", { reason: "opens an interactive privacy-settings dialog" }],
20596
+ ["/bug", { reason: "submits a bug report over the network" }],
23262
20597
  [
23263
20598
  "/effort",
23264
20599
  {
@@ -23276,6 +20611,7 @@ var HINDSIGHT_CONSUMER_NAME = "hindsight";
23276
20611
  var HINDSIGHT_IMAGE_REPO = "ghcr.io/switchroom/switchroom-hindsight";
23277
20612
  var HINDSIGHT_IMAGE = `${HINDSIGHT_IMAGE_REPO}:latest`;
23278
20613
  var HINDSIGHT_BROKER_SOCK_VOLUME = `auth-broker-${HINDSIGHT_CONSUMER_NAME}-sock`;
20614
+ var HINDSIGHT_CREDS_MIRROR_VOLUME = `consumer-creds-${HINDSIGHT_CONSUMER_NAME}`;
23279
20615
  var HINDSIGHT_HEALTHCHECK_PY = 'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8888/health",timeout=4).getcode()==200 else 1)';
23280
20616
  var HINDSIGHT_HEALTHCHECK_CMD = `python3 -c '${HINDSIGHT_HEALTHCHECK_PY}'`;
23281
20617
 
@@ -23308,6 +20644,8 @@ var KNOWN_VAULT_ARTIFACT_NAMES = new Set([
23308
20644
  var SCRYPT_MAXMEM = 128 * 1024 * 1024;
23309
20645
 
23310
20646
  // src/vault/broker/client.ts
20647
+ import * as net from "node:net";
20648
+ import * as fs from "node:fs";
23311
20649
  import { homedir as homedir3 } from "node:os";
23312
20650
  import { join as join4 } from "node:path";
23313
20651
 
@@ -23444,6 +20782,13 @@ var ApprovalLookupRequestSchema = exports_external.object({
23444
20782
  action: exports_external.string().min(1),
23445
20783
  current_approver_set: exports_external.array(exports_external.string())
23446
20784
  });
20785
+ var ApprovalLookupByRequestRequestSchema = exports_external.object({
20786
+ v: exports_external.literal(1),
20787
+ op: exports_external.literal("approval_lookup_by_request"),
20788
+ agent_unit: exports_external.string().min(1),
20789
+ request_id: exports_external.string().regex(/^[0-9a-f]{32}$/),
20790
+ current_approver_set: exports_external.array(exports_external.string())
20791
+ });
23447
20792
  var ApprovalConsumeRequestSchema = exports_external.object({
23448
20793
  v: exports_external.literal(1),
23449
20794
  op: exports_external.literal("approval_consume"),
@@ -23498,6 +20843,7 @@ var RequestSchema = exports_external.discriminatedUnion("op", [
23498
20843
  RevokeGrantRequestSchema,
23499
20844
  ApprovalRequestRequestSchema,
23500
20845
  ApprovalLookupRequestSchema,
20846
+ ApprovalLookupByRequestRequestSchema,
23501
20847
  ApprovalConsumeRequestSchema,
23502
20848
  ApprovalRevokeRequestSchema,
23503
20849
  ApprovalListRequestSchema,
@@ -23520,7 +20866,8 @@ var ErrorCode = exports_external.enum([
23520
20866
  "DENIED",
23521
20867
  "UNKNOWN_KEY",
23522
20868
  "BAD_REQUEST",
23523
- "INTERNAL"
20869
+ "INTERNAL",
20870
+ "AUDIT_UNAVAILABLE"
23524
20871
  ]);
23525
20872
  var OkEntryResponseSchema = exports_external.object({
23526
20873
  ok: exports_external.literal(true),
@@ -23657,16 +21004,123 @@ var ResponseSchema = exports_external.union([
23657
21004
  OkApprovalConsumeRecordResponseSchema,
23658
21005
  ErrorResponseSchema
23659
21006
  ]);
21007
+ function encodeRequest(req) {
21008
+ const json = JSON.stringify(req);
21009
+ if (Buffer.byteLength(json, "utf8") > MAX_FRAME_BYTES) {
21010
+ throw new Error(`Request frame too large (${Buffer.byteLength(json, "utf8")} bytes; max ${MAX_FRAME_BYTES})`);
21011
+ }
21012
+ return json + `
21013
+ `;
21014
+ }
21015
+ function decodeResponse(line) {
21016
+ if (Buffer.byteLength(line, "utf8") > MAX_FRAME_BYTES) {
21017
+ throw new RangeError(`Response frame too large (${Buffer.byteLength(line, "utf8")} bytes; max ${MAX_FRAME_BYTES})`);
21018
+ }
21019
+ const obj = JSON.parse(line);
21020
+ return ResponseSchema.parse(obj);
21021
+ }
21022
+
21023
+ // src/runtime-mode.ts
21024
+ function isDockerRuntime() {
21025
+ return process.env.SWITCHROOM_RUNTIME === "docker";
21026
+ }
23660
21027
 
23661
21028
  // src/vault/broker/client.ts
21029
+ var DEFAULT_TIMEOUT_MS = 2000;
23662
21030
  var LEGACY_SOCKET_PATH = join4(homedir3(), ".switchroom", "vault-broker.sock");
23663
21031
  var OPERATOR_SOCKET_PATH = join4(homedir3(), ".switchroom", "broker-operator", "sock");
21032
+ function defaultBrokerSocketPath() {
21033
+ if (fs.existsSync(OPERATOR_SOCKET_PATH))
21034
+ return OPERATOR_SOCKET_PATH;
21035
+ if (isDockerRuntime())
21036
+ return OPERATOR_SOCKET_PATH;
21037
+ return LEGACY_SOCKET_PATH;
21038
+ }
21039
+ function resolveBrokerSocketPath(opts) {
21040
+ if (opts?.socket)
21041
+ return opts.socket;
21042
+ const env = process.env.SWITCHROOM_VAULT_BROKER_SOCK;
21043
+ if (env)
21044
+ return env;
21045
+ if (opts?.vaultBrokerSocket)
21046
+ return opts.vaultBrokerSocket;
21047
+ return defaultBrokerSocketPath();
21048
+ }
21049
+ async function rpcRaw(req, opts) {
21050
+ return rpc(req, opts);
21051
+ }
21052
+ async function rpc(req, opts) {
21053
+ const socketPath = resolveBrokerSocketPath(opts);
21054
+ const timeoutMs = opts?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
21055
+ return new Promise((resolve5) => {
21056
+ let settled = false;
21057
+ const settle = (val) => {
21058
+ if (settled)
21059
+ return;
21060
+ settled = true;
21061
+ resolve5(val);
21062
+ };
21063
+ const client = new net.Socket;
21064
+ const timer = setTimeout(() => {
21065
+ client.destroy();
21066
+ settle({ kind: "unreachable", msg: `broker did not respond within ${timeoutMs}ms` });
21067
+ }, timeoutMs);
21068
+ client.on("error", (err) => {
21069
+ clearTimeout(timer);
21070
+ const code = err.code ?? "ERR";
21071
+ let msg;
21072
+ if (code === "ENOENT")
21073
+ msg = "broker socket not found (is the daemon running?)";
21074
+ else if (code === "ECONNREFUSED")
21075
+ msg = "broker socket exists but refused connection";
21076
+ else if (code === "EACCES")
21077
+ msg = "broker socket access denied (wrong UID?)";
21078
+ else
21079
+ msg = `broker connection failed: ${err.message}`;
21080
+ settle({ kind: "unreachable", msg });
21081
+ });
21082
+ let buffer = "";
21083
+ client.on("data", (chunk) => {
21084
+ buffer += chunk.toString("utf8");
21085
+ const newlineIdx = buffer.indexOf(`
21086
+ `);
21087
+ if (newlineIdx !== -1) {
21088
+ const line = buffer.slice(0, newlineIdx).trimEnd();
21089
+ clearTimeout(timer);
21090
+ client.destroy();
21091
+ try {
21092
+ const resp = decodeResponse(line);
21093
+ settle({ kind: "response", resp });
21094
+ } catch (err) {
21095
+ settle({
21096
+ kind: "unreachable",
21097
+ msg: `unparseable broker response: ${err instanceof Error ? err.message : String(err)}`
21098
+ });
21099
+ }
21100
+ }
21101
+ });
21102
+ client.on("connect", () => {
21103
+ try {
21104
+ client.write(encodeRequest(req));
21105
+ } catch (err) {
21106
+ clearTimeout(timer);
21107
+ client.destroy();
21108
+ settle({
21109
+ kind: "unreachable",
21110
+ msg: `failed to send request: ${err instanceof Error ? err.message : String(err)}`
21111
+ });
21112
+ }
21113
+ });
21114
+ client.connect({ path: socketPath });
21115
+ });
21116
+ }
23664
21117
 
23665
21118
  // src/vault/resolver.ts
23666
21119
  var materializedDirs = new Set;
23667
21120
 
23668
21121
  // src/agents/scaffold.ts
23669
21122
  var REPO_ROOT = resolve5(import.meta.dirname, "../..");
21123
+ var CLAUDE_MD_YOURS_PLACEHOLDER = "This space is yours. Add per-agent rules, exceptions, or context the " + "Switchroom template doesn't capture. Everything above the marker line is " + "regenerated on every apply; this section is preserved.";
23670
21124
  var SWITCHROOM_OWNED_SETTINGS_KEYS = new Set([
23671
21125
  "permissions",
23672
21126
  "mcpServers",
@@ -23697,8 +21151,8 @@ import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
23697
21151
  import { mkdir, chmod, chown, unlink, appendFile } from "node:fs/promises";
23698
21152
  import {
23699
21153
  readdirSync as readdirSync3,
23700
- existsSync as existsSync10,
23701
- readFileSync as readFileSync8,
21154
+ existsSync as existsSync11,
21155
+ readFileSync as readFileSync9,
23702
21156
  writeFileSync as writeFileSync5,
23703
21157
  renameSync as renameSync3,
23704
21158
  mkdirSync as mkdirSync4,
@@ -23719,7 +21173,8 @@ var IDEMPOTENCY_WINDOW_MS = 15000;
23719
21173
  var RequestEnvelope = {
23720
21174
  v: exports_external.literal(1),
23721
21175
  request_id: exports_external.string().min(1).max(128),
23722
- idempotency_key: exports_external.string().min(1).max(128).optional()
21176
+ idempotency_key: exports_external.string().min(1).max(128).optional(),
21177
+ operator_passphrase: exports_external.string().min(1).max(1024).optional()
23723
21178
  };
23724
21179
  var AgentRestartRequestSchema = exports_external.object({
23725
21180
  ...RequestEnvelope,
@@ -28399,9 +25854,9 @@ class PostHog extends PostHogBackendClient {
28399
25854
 
28400
25855
  // src/analytics/posthog.ts
28401
25856
  import {
28402
- existsSync as existsSync6,
25857
+ existsSync as existsSync7,
28403
25858
  mkdirSync as mkdirSync3,
28404
- readFileSync as readFileSync5,
25859
+ readFileSync as readFileSync6,
28405
25860
  writeFileSync as writeFileSync3
28406
25861
  } from "node:fs";
28407
25862
  import { dirname as dirname2 } from "node:path";
@@ -28420,8 +25875,8 @@ function getDistinctId() {
28420
25875
  return cachedDistinctId;
28421
25876
  const path = resolveStatePath("analytics-id");
28422
25877
  try {
28423
- if (existsSync6(path)) {
28424
- const existing = readFileSync5(path, "utf-8").trim();
25878
+ if (existsSync7(path)) {
25879
+ const existing = readFileSync6(path, "utf-8").trim();
28425
25880
  if (existing) {
28426
25881
  cachedDistinctId = existing;
28427
25882
  return existing;
@@ -28594,7 +26049,7 @@ function err(code, human) {
28594
26049
 
28595
26050
  // src/util/audit-hashchain.ts
28596
26051
  import { createHash as createHash3 } from "node:crypto";
28597
- import { openSync, readSync, fstatSync, closeSync } from "node:fs";
26052
+ import { openSync as openSync2, readSync, fstatSync, closeSync as closeSync2 } from "node:fs";
28598
26053
  var CHAIN_GENESIS = "GENESIS";
28599
26054
  var SEP = "\x00";
28600
26055
  function rowHash(prev, seq, rowJsonNoChain) {
@@ -28615,7 +26070,7 @@ function chainRow(state, entry) {
28615
26070
  function readTail(path, tailBytes = 64 * 1024) {
28616
26071
  let fd;
28617
26072
  try {
28618
- fd = openSync(path, "r");
26073
+ fd = openSync2(path, "r");
28619
26074
  } catch {
28620
26075
  return null;
28621
26076
  }
@@ -28631,7 +26086,7 @@ function readTail(path, tailBytes = 64 * 1024) {
28631
26086
  return null;
28632
26087
  } finally {
28633
26088
  try {
28634
- closeSync(fd);
26089
+ closeSync2(fd);
28635
26090
  } catch {}
28636
26091
  }
28637
26092
  }
@@ -28858,7 +26313,7 @@ function scanGenericSecrets(text) {
28858
26313
  // telegram-plugin/secret-detect/chunker.ts
28859
26314
  var CHUNK_THRESHOLD = 32 * 1024;
28860
26315
  var WINDOW_SIZE = 16 * 1024;
28861
- var OVERLAP = 1024;
26316
+ var OVERLAP = 8 * 1024;
28862
26317
  function chunk(text) {
28863
26318
  if (text.length <= CHUNK_THRESHOLD) {
28864
26319
  return [{ offset: 0, text }];
@@ -28875,9 +26330,43 @@ function chunk(text) {
28875
26330
  return out;
28876
26331
  }
28877
26332
 
28878
- // telegram-plugin/secret-detect/index.ts
28879
- init_suppressor();
26333
+ // telegram-plugin/secret-detect/suppressor.ts
26334
+ var MARKERS = ["test", "mock", "example", "fixture", "dummy"];
26335
+ var WINDOW = 40;
26336
+ var MARKER_RE = new RegExp(`\\b(?:${MARKERS.join("|")})\\b`, "i");
26337
+ function isSuppressed(text, start, end) {
26338
+ const left = Math.max(0, start - WINDOW);
26339
+ const right = Math.min(text.length, end + WINDOW);
26340
+ const context = text.slice(left, start) + text.slice(end, right);
26341
+ return MARKER_RE.test(context);
26342
+ }
28880
26343
 
26344
+ // telegram-plugin/secret-detect/slug.ts
26345
+ function sanitizeKeyName(raw) {
26346
+ const up = raw.toUpperCase();
26347
+ const cleaned = up.replace(/[^A-Z0-9_]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
26348
+ return cleaned.length > 0 ? cleaned : "SECRET";
26349
+ }
26350
+ function datePart(now = new Date) {
26351
+ const y = now.getUTCFullYear();
26352
+ const m = String(now.getUTCMonth() + 1).padStart(2, "0");
26353
+ const d = String(now.getUTCDate()).padStart(2, "0");
26354
+ return `${y}${m}${d}`;
26355
+ }
26356
+ function deriveSlug(inputs, existing) {
26357
+ let base;
26358
+ if (inputs.key_name && inputs.key_name.trim().length > 0) {
26359
+ base = sanitizeKeyName(inputs.key_name);
26360
+ } else {
26361
+ base = `${inputs.rule_id}_${datePart(inputs.now)}`;
26362
+ }
26363
+ if (!existing.has(base))
26364
+ return base;
26365
+ let n = 2;
26366
+ while (existing.has(`${base}_${n}`))
26367
+ n++;
26368
+ return `${base}_${n}`;
26369
+ }
28881
26370
  // telegram-plugin/secret-detect/url-redact.ts
28882
26371
  var SENSITIVE_PARAMS = new Set([
28883
26372
  "token",
@@ -28923,7 +26412,6 @@ function redactOne(raw) {
28923
26412
  }
28924
26413
 
28925
26414
  // telegram-plugin/secret-detect/index.ts
28926
- init_secretlint_source();
28927
26415
  function detectSecrets(text) {
28928
26416
  if (!text || text.length === 0)
28929
26417
  return [];
@@ -29040,7 +26528,7 @@ function redactedMarker(ruleId) {
29040
26528
  return `[REDACTED:${trimmed}]`;
29041
26529
  }
29042
26530
  // src/cli/install-detect.ts
29043
- import * as fs from "node:fs";
26531
+ import * as fs2 from "node:fs";
29044
26532
  import * as path from "node:path";
29045
26533
  import * as os from "node:os";
29046
26534
  var BIN_PATH = "/usr/local/bin/switchroom";
@@ -29054,12 +26542,12 @@ function detectInstallType() {
29054
26542
  try {
29055
26543
  const repoArtifact = sourceArtifactPath();
29056
26544
  const distPrefix = sourceDistPrefix();
29057
- const binExists = fs.existsSync(BIN_PATH);
29058
- const repoExists = fs.existsSync(repoArtifact);
26545
+ const binExists = fs2.existsSync(BIN_PATH);
26546
+ const repoExists = fs2.existsSync(repoArtifact);
29059
26547
  if (binExists) {
29060
- const lst = fs.lstatSync(BIN_PATH);
26548
+ const lst = fs2.lstatSync(BIN_PATH);
29061
26549
  if (lst.isSymbolicLink()) {
29062
- const target = fs.readlinkSync(BIN_PATH);
26550
+ const target = fs2.readlinkSync(BIN_PATH);
29063
26551
  const resolved = path.isAbsolute(target) ? target : path.resolve(path.dirname(BIN_PATH), target);
29064
26552
  if (resolved.startsWith(distPrefix)) {
29065
26553
  return {
@@ -29096,20 +26584,20 @@ var import_yaml3 = __toESM(require_dist(), 1);
29096
26584
  init_atomic();
29097
26585
 
29098
26586
  // src/cli/resolve-version.ts
29099
- import { existsSync as existsSync8, readFileSync as readFileSync6 } from "node:fs";
26587
+ import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
29100
26588
  import { dirname as dirname4, join as join7 } from "node:path";
29101
26589
 
29102
26590
  // src/build-info.ts
29103
- var VERSION = "0.18.11";
26591
+ var VERSION = "0.18.13";
29104
26592
 
29105
26593
  // src/cli/resolve-version.ts
29106
26594
  function readPackageVersion() {
29107
26595
  let dir = import.meta.dirname;
29108
26596
  for (let i = 0;i < 12 && dir && dir !== "/"; i++) {
29109
26597
  const p = join7(dir, "package.json");
29110
- if (existsSync8(p)) {
26598
+ if (existsSync9(p)) {
29111
26599
  try {
29112
- const pkg = JSON.parse(readFileSync6(p, "utf-8"));
26600
+ const pkg = JSON.parse(readFileSync7(p, "utf-8"));
29113
26601
  if (pkg?.name === "switchroom" && typeof pkg.version === "string") {
29114
26602
  return pkg.version;
29115
26603
  }
@@ -29170,6 +26658,8 @@ function parseAuditLine(line) {
29170
26658
  entry.error = o.error;
29171
26659
  if (typeof o.phase === "string")
29172
26660
  entry.phase = o.phase;
26661
+ if (typeof o.method === "string")
26662
+ entry.method = o.method;
29173
26663
  if (typeof o.stdout_tail === "string")
29174
26664
  entry.stdout_tail = o.stdout_tail;
29175
26665
  if (typeof o.stderr_tail === "string")
@@ -29295,7 +26785,7 @@ function parseRolloutResultLine(stdout) {
29295
26785
  }
29296
26786
 
29297
26787
  // node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
29298
- var import__3 = __toESM(require_commander(), 1);
26788
+ var import__2 = __toESM(require_commander(), 1);
29299
26789
 
29300
26790
  // src/cli/update.ts
29301
26791
  import { join as join8, dirname as dirname5, resolve as resolve7 } from "node:path";
@@ -29418,7 +26908,7 @@ function parseUpdateResultLine(stdout) {
29418
26908
 
29419
26909
  // src/host-control/config-edit-validator.ts
29420
26910
  var import_yaml5 = __toESM(require_dist(), 1);
29421
- import { mkdtempSync, writeFileSync as writeFileSync4, rmSync as rmSync2, existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
26911
+ import { mkdtempSync, writeFileSync as writeFileSync4, rmSync as rmSync2, existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
29422
26912
  import { tmpdir } from "node:os";
29423
26913
  import { join as join9, isAbsolute as isAbsolute2, normalize, basename as basename2 } from "node:path";
29424
26914
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -29530,17 +27020,44 @@ function validateShape(unifiedDiff, targetPath) {
29530
27020
  };
29531
27021
  }
29532
27022
  }
27023
+ {
27024
+ let inHunk = false;
27025
+ let hunkHasContext = false;
27026
+ const failZeroContext = {
27027
+ ok: false,
27028
+ code: "E_PATCH_INVALID_SHAPE",
27029
+ detail: "zero-context hunk not allowed; regenerate the diff with context " + "lines (git diff default of 3)"
27030
+ };
27031
+ const scanLines = lines.length > 0 && lines[lines.length - 1] === "" ? lines.slice(0, -1) : lines;
27032
+ for (const ln of scanLines) {
27033
+ if (ln.startsWith("@@")) {
27034
+ if (inHunk && !hunkHasContext)
27035
+ return failZeroContext;
27036
+ inHunk = true;
27037
+ hunkHasContext = false;
27038
+ } else if (ln.startsWith("--- ") || ln.startsWith("+++ ")) {
27039
+ if (inHunk && !hunkHasContext)
27040
+ return failZeroContext;
27041
+ inHunk = false;
27042
+ } else if (inHunk) {
27043
+ if (ln.startsWith(" ") || ln === "")
27044
+ hunkHasContext = true;
27045
+ }
27046
+ }
27047
+ if (inHunk && !hunkHasContext)
27048
+ return failZeroContext;
27049
+ }
29533
27050
  return null;
29534
27051
  }
29535
27052
  function applyPatch(unifiedDiff, configPath, gitBin) {
29536
- if (!existsSync9(configPath)) {
27053
+ if (!existsSync10(configPath)) {
29537
27054
  return {
29538
27055
  ok: false,
29539
27056
  code: "E_PATCH_APPLY_FAILED",
29540
27057
  detail: `target config not found at ${configPath}`
29541
27058
  };
29542
27059
  }
29543
- const liveContent = readFileSync7(configPath, "utf8");
27060
+ const liveContent = readFileSync8(configPath, "utf8");
29544
27061
  const scratchDir = mkdtempSync(join9(tmpdir(), "config-propose-edit-"));
29545
27062
  try {
29546
27063
  const targetBasename = configPath.split("/").pop() ?? "switchroom.yaml";
@@ -29553,8 +27070,7 @@ function applyPatch(unifiedDiff, configPath, gitBin) {
29553
27070
  const baseArgs = [
29554
27071
  "apply",
29555
27072
  "--whitespace=nowarn",
29556
- "--recount",
29557
- "--unidiff-zero"
27073
+ "--recount"
29558
27074
  ];
29559
27075
  const checkP1 = spawnSync2(bin, [...baseArgs.slice(0, 1), "--check", ...baseArgs.slice(1), "-p1", patchFile], { cwd: scratchDir, encoding: "utf8", timeout: 1e4 });
29560
27076
  let pStrip = "-p1";
@@ -29578,7 +27094,7 @@ function applyPatch(unifiedDiff, configPath, gitBin) {
29578
27094
  detail: `git apply failed: ${(real.stderr || "").trim().slice(0, 500)}`
29579
27095
  };
29580
27096
  }
29581
- const after = readFileSync7(scratchFile, "utf8");
27097
+ const after = readFileSync8(scratchFile, "utf8");
29582
27098
  return { ok: true, after };
29583
27099
  } finally {
29584
27100
  rmSync2(scratchDir, { recursive: true, force: true });
@@ -29776,7 +27292,7 @@ function validateConfigEdit(opts) {
29776
27292
  return schemaErr;
29777
27293
  let beforeData = {};
29778
27294
  try {
29779
- const beforeRaw = existsSync9(opts.configPath) ? readFileSync7(opts.configPath, "utf8") : "";
27295
+ const beforeRaw = existsSync10(opts.configPath) ? readFileSync8(opts.configPath, "utf8") : "";
29780
27296
  const beforeDoc = import_yaml5.parseDocument(beforeRaw, { merge: false, strict: false });
29781
27297
  beforeData = beforeDoc.toJS();
29782
27298
  } catch {
@@ -30225,12 +27741,12 @@ function collectScheduleEntries(config) {
30225
27741
  // src/agent-scheduler/replay.ts
30226
27742
  var STALE_LOOKBACK_MAX_MIN = 14 * 24 * 60;
30227
27743
  function readRecentFires(jsonlPath) {
30228
- const fs2 = __require("node:fs");
30229
- if (!fs2.existsSync(jsonlPath))
27744
+ const fs3 = __require("node:fs");
27745
+ if (!fs3.existsSync(jsonlPath))
30230
27746
  return [];
30231
27747
  let raw;
30232
27748
  try {
30233
- raw = fs2.readFileSync(jsonlPath, "utf8");
27749
+ raw = fs3.readFileSync(jsonlPath, "utf8");
30234
27750
  } catch {
30235
27751
  return [];
30236
27752
  }
@@ -30248,6 +27764,13 @@ function readRecentFires(jsonlPath) {
30248
27764
  }
30249
27765
 
30250
27766
  // src/host-control/server.ts
27767
+ var HOSTD_BROKER_SOCKET_PATH = "/run/switchroom/broker/hostd/sock";
27768
+ var DEFAULT_OPERATOR_ATTEST_VERBS = [
27769
+ "update_apply",
27770
+ "apply",
27771
+ "rollout"
27772
+ ];
27773
+ var ATTEST_AUDIT_METHOD = "passphrase-attest";
30251
27774
  function resolveDigests(imageRefs) {
30252
27775
  const out = new Map;
30253
27776
  for (const ref of imageRefs) {
@@ -30272,9 +27795,9 @@ function resolveDigests(imageRefs) {
30272
27795
  function readCachedInstallType(bindRoot) {
30273
27796
  const cacheDir = join10(bindRoot, ".switchroom");
30274
27797
  const cachePath = join10(cacheDir, "install-type.json");
30275
- if (existsSync10(cachePath)) {
27798
+ if (existsSync11(cachePath)) {
30276
27799
  try {
30277
- const raw = readFileSync8(cachePath, "utf-8");
27800
+ const raw = readFileSync9(cachePath, "utf-8");
30278
27801
  const parsed = JSON.parse(raw);
30279
27802
  if (parsed && typeof parsed.install_type === "string" && typeof parsed.detected_at === "string") {
30280
27803
  return parsed;
@@ -30302,6 +27825,9 @@ var CONFIG_APPROVAL_TIMEOUT_MS = 60 * 60 * 1000;
30302
27825
  function defaultApprovalId() {
30303
27826
  return randomBytes(4).toString("hex");
30304
27827
  }
27828
+ function idempotencyScope(caller) {
27829
+ return caller.kind === "agent" ? `agent:${caller.name}` : "operator";
27830
+ }
30305
27831
  function formatConfigApprovalDenyError(approval, approvalId) {
30306
27832
  if (approval.denySource === "dispatch_failure") {
30307
27833
  const detail = approval.reason ?? "card dispatch failed";
@@ -30323,7 +27849,7 @@ function writeFileInPlacePreservingInode(targetPath, content) {
30323
27849
  } finally {
30324
27850
  closeSync3(fd);
30325
27851
  }
30326
- const readBack = readFileSync8(targetPath);
27852
+ const readBack = readFileSync9(targetPath);
30327
27853
  if (readBack.length !== buf.length) {
30328
27854
  throw new Error(`in-place write short: wrote ${buf.length} bytes but read back ${readBack.length}`);
30329
27855
  }
@@ -30369,7 +27895,7 @@ class HostdServer {
30369
27895
  await chmod(dir, 493).catch(() => {
30370
27896
  return;
30371
27897
  });
30372
- if (existsSync10(sockPath))
27898
+ if (existsSync11(sockPath))
30373
27899
  await unlink(sockPath).catch(() => {
30374
27900
  return;
30375
27901
  });
@@ -30406,7 +27932,7 @@ class HostdServer {
30406
27932
  await chmod(dir, 493).catch(() => {
30407
27933
  return;
30408
27934
  });
30409
- if (existsSync10(sockPath))
27935
+ if (existsSync11(sockPath))
30410
27936
  await unlink(sockPath).catch(() => {
30411
27937
  return;
30412
27938
  });
@@ -30442,11 +27968,11 @@ class HostdServer {
30442
27968
  }
30443
27969
  async reconcileOrphanedFleetMutations() {
30444
27970
  const path2 = this.auditLogPath();
30445
- if (!existsSync10(path2))
27971
+ if (!existsSync11(path2))
30446
27972
  return;
30447
27973
  let raw;
30448
27974
  try {
30449
- raw = readFileSync8(path2, "utf-8");
27975
+ raw = readFileSync9(path2, "utf-8");
30450
27976
  } catch {
30451
27977
  return;
30452
27978
  }
@@ -30563,9 +28089,17 @@ class HostdServer {
30563
28089
  socket.end();
30564
28090
  return;
30565
28091
  }
30566
- const idempotencyKey = req.idempotency_key ?? req.request_id;
30567
28092
  const now = Date.now();
30568
28093
  this.evictExpiredIdempotency(now);
28094
+ const denied = this.checkGate(req, caller);
28095
+ if (denied) {
28096
+ const resp2 = deniedResponse(req.request_id, denied);
28097
+ await this.writeAudit({ caller, req, resp: resp2 });
28098
+ socket.write(encodeResponse(resp2));
28099
+ socket.end();
28100
+ return;
28101
+ }
28102
+ const idempotencyKey = `${idempotencyScope(caller)} ${req.idempotency_key ?? req.request_id}`;
30569
28103
  const prior = this.idempotencyKeys.get(idempotencyKey);
30570
28104
  if (prior && now - prior.ts < IDEMPOTENCY_WINDOW_MS) {
30571
28105
  const cached = this.statusByRequestId.get(prior.request_id);
@@ -30576,14 +28110,15 @@ class HostdServer {
30576
28110
  }
30577
28111
  }
30578
28112
  this.idempotencyKeys.set(idempotencyKey, { request_id: req.request_id, ts: now });
30579
- const denied = this.checkGate(req, caller);
30580
- if (denied) {
30581
- const resp2 = deniedResponse(req.request_id, denied);
30582
- await this.writeAudit({ caller, req, resp: resp2 });
28113
+ const attest = await this.checkOperatorAttest(req, caller);
28114
+ if (attest.denied !== null) {
28115
+ const resp2 = deniedResponse(req.request_id, attest.denied);
28116
+ await this.writeAudit({ caller, req, resp: resp2, method: attest.method });
30583
28117
  socket.write(encodeResponse(resp2));
30584
28118
  socket.end();
30585
28119
  return;
30586
28120
  }
28121
+ const attestMethod = attest.method;
30587
28122
  const started = Date.now();
30588
28123
  let resp;
30589
28124
  try {
@@ -30642,10 +28177,70 @@ class HostdServer {
30642
28177
  resp = err("E_DISPATCH_FAILED", "hostd dispatch failed").why(msg).op(req.op).caller(caller.kind === "agent" ? "agent" : "operator").agentName(caller.kind === "agent" ? caller.name : undefined).build(req.request_id, Date.now() - started);
30643
28178
  resp = { ...resp, error: `hostd dispatch failed: ${msg}` };
30644
28179
  }
30645
- await this.writeAudit({ caller, req, resp });
28180
+ await this.writeAudit({ caller, req, resp, method: attestMethod });
30646
28181
  socket.write(encodeResponse(resp));
30647
28182
  socket.end();
30648
28183
  }
28184
+ async checkOperatorAttest(req, caller) {
28185
+ const hostdCfg = this.opts.config.hostd;
28186
+ if (hostdCfg?.operator_attest_enabled !== true) {
28187
+ return { denied: null };
28188
+ }
28189
+ if (caller.kind === "operator")
28190
+ return { denied: null };
28191
+ const requiredVerbs = hostdCfg.operator_attest_required_verbs ?? DEFAULT_OPERATOR_ATTEST_VERBS;
28192
+ const required = requiredVerbs.includes(req.op);
28193
+ const passphrase = req.operator_passphrase;
28194
+ if (!required) {
28195
+ if (passphrase === undefined)
28196
+ return { denied: null };
28197
+ const v2 = await this.attestVerifier().verify(passphrase);
28198
+ return v2.ok ? { denied: null, method: ATTEST_AUDIT_METHOD } : {
28199
+ denied: `${req.op} operator-attest failed: ${v2.reason}`,
28200
+ method: ATTEST_AUDIT_METHOD
28201
+ };
28202
+ }
28203
+ if (passphrase === undefined) {
28204
+ return {
28205
+ denied: `${req.op} requires operator-passphrase attestation ` + `(hostd.operator_attest_enabled is on and ${req.op} is in ` + `operator_attest_required_verbs)`,
28206
+ method: ATTEST_AUDIT_METHOD
28207
+ };
28208
+ }
28209
+ const v = await this.attestVerifier().verify(passphrase);
28210
+ return v.ok ? { denied: null, method: ATTEST_AUDIT_METHOD } : {
28211
+ denied: `${req.op} operator-attest failed: ${v.reason}`,
28212
+ method: ATTEST_AUDIT_METHOD
28213
+ };
28214
+ }
28215
+ attestVerifier() {
28216
+ if (this.opts.attestVerifier)
28217
+ return this.opts.attestVerifier;
28218
+ if (!this._defaultAttestVerifier) {
28219
+ this._defaultAttestVerifier = {
28220
+ verify: (passphrase) => this.brokerAttestVerify(passphrase)
28221
+ };
28222
+ }
28223
+ return this._defaultAttestVerifier;
28224
+ }
28225
+ _defaultAttestVerifier;
28226
+ async brokerAttestVerify(passphrase) {
28227
+ const res = await rpcRaw({
28228
+ v: 1,
28229
+ op: "list_grants",
28230
+ agent: "hostd",
28231
+ passphrase
28232
+ }, { vaultBrokerSocket: HOSTD_BROKER_SOCKET_PATH, timeoutMs: 5000 });
28233
+ if (res.kind === "unreachable") {
28234
+ return { ok: false, reason: `broker unreachable: ${res.msg}` };
28235
+ }
28236
+ const resp = res.resp;
28237
+ if (resp.ok === true)
28238
+ return { ok: true };
28239
+ return {
28240
+ ok: false,
28241
+ reason: `broker denied attestation (${resp.code ?? "DENIED"})`
28242
+ };
28243
+ }
30649
28244
  checkGate(req, caller) {
30650
28245
  if (caller.kind === "operator")
30651
28246
  return null;
@@ -30779,7 +28374,7 @@ class HostdServer {
30779
28374
  join10(root, "profiles"),
30780
28375
  join10(root, "profiles", "default"),
30781
28376
  join10(root, "vendor", "hindsight-memory")
30782
- ].filter((p) => !existsSync10(p));
28377
+ ].filter((p) => !existsSync11(p));
30783
28378
  }
30784
28379
  applyAssetPreflight(request_id, started) {
30785
28380
  const missing = this.missingApplyAssets();
@@ -30889,6 +28484,26 @@ class HostdServer {
30889
28484
  const assetDenied = this.applyAssetPreflight(req.request_id, started);
30890
28485
  if (assetDenied)
30891
28486
  return assetDenied;
28487
+ if (req.args.agents !== undefined) {
28488
+ let validAgents = null;
28489
+ try {
28490
+ const cfg = loadConfig(this.opts.configPath);
28491
+ validAgents = Object.keys(cfg.agents ?? {});
28492
+ } catch {
28493
+ validAgents = null;
28494
+ }
28495
+ if (validAgents !== null) {
28496
+ const buildDenied = (human) => err("E_UNKNOWN_AGENT", human).fixBadInput("agents").op("rollout").caller(caller.kind).agentName(caller.kind === "agent" ? caller.name : undefined).asDenied().build(req.request_id, Date.now() - started);
28497
+ const requested = req.args.agents;
28498
+ if (requested.length === 0) {
28499
+ return buildDenied(`empty agents list — pass at least one agent, ` + `or omit "agents" to roll all. Valid agents: ${validAgents.join(", ")}`);
28500
+ }
28501
+ const unknown = requested.filter((a) => !validAgents.includes(a));
28502
+ if (unknown.length > 0) {
28503
+ return buildDenied(`unknown agent(s): ${unknown.join(", ")}. ` + `Valid agents: ${validAgents.join(", ")}`);
28504
+ }
28505
+ }
28506
+ }
30892
28507
  const entry = this.launchRollout(req.args, req.request_id, caller, started);
30893
28508
  return {
30894
28509
  v: 1,
@@ -30952,10 +28567,10 @@ class HostdServer {
30952
28567
  async beginSelfBump(req, caller, started) {
30953
28568
  const ownVersion = this.opts.selfVersion ?? SWITCHROOM_VERSION;
30954
28569
  const composePath = join10(this.hostdDirPath(), "docker-compose.yml");
30955
- if (!existsSync10(composePath)) {
28570
+ if (!existsSync11(composePath)) {
30956
28571
  return deniedResponse(req.request_id, `rollout: hostd's CLI (v${ownVersion}) is older than the target ` + `${req.args.pin} and needs a self-bump first, but its compose file ` + `is missing at ${composePath}. Run \`switchroom hostd install ` + `--tag ${req.args.pin}\` on the host, then re-run the roll. ` + `Nothing was changed.`, Date.now() - started);
30957
28572
  }
30958
- const before = readFileSync8(composePath, "utf8");
28573
+ const before = readFileSync9(composePath, "utf8");
30959
28574
  const bumped = bumpHostdComposeImageTag(before, req.args.pin);
30960
28575
  if (!bumped) {
30961
28576
  return deniedResponse(req.request_id, `rollout: hostd needs a self-bump to ${req.args.pin} but no ` + `switchroom-hostd image line was found in ${composePath} ` + `(hand-edited compose?). Run \`switchroom hostd install --tag ` + `${req.args.pin}\` on the host, then re-run the roll. Nothing ` + `was changed.`, Date.now() - started);
@@ -31086,11 +28701,11 @@ class HostdServer {
31086
28701
  }
31087
28702
  async resumePendingSelfBumpRollout() {
31088
28703
  const markerPath = join10(this.hostdDirPath(), SELF_BUMP_MARKER_FILENAME);
31089
- if (!existsSync10(markerPath))
28704
+ if (!existsSync11(markerPath))
31090
28705
  return;
31091
28706
  let raw;
31092
28707
  try {
31093
- raw = readFileSync8(markerPath, "utf8");
28708
+ raw = readFileSync9(markerPath, "utf8");
31094
28709
  } finally {
31095
28710
  try {
31096
28711
  unlinkSync2(markerPath);
@@ -31168,8 +28783,17 @@ class HostdServer {
31168
28783
  stderr_tail: tail(res.stderr)
31169
28784
  };
31170
28785
  }
28786
+ rejectUnconfiguredTarget(name, request_id, op, started) {
28787
+ if (Object.prototype.hasOwnProperty.call(this.opts.agentUids, name)) {
28788
+ return null;
28789
+ }
28790
+ return deniedResponse(request_id, `${op}: "${name}" is not a configured agent. ` + `${op} targets only peer agent containers (switchroom-<agent>); ` + `singleton service containers (vault-broker, approval-kernel, ` + `hostd, web) and unknown names are rejected. Configured agents: ` + `${Object.keys(this.opts.agentUids).sort().join(", ")}.`, Date.now() - started);
28791
+ }
31171
28792
  async handleAgentLogs(req, started) {
31172
28793
  const tailLines = req.args.tail ?? 100;
28794
+ const rejected = this.rejectUnconfiguredTarget(req.args.name, req.request_id, "agent_logs", started);
28795
+ if (rejected)
28796
+ return rejected;
31173
28797
  const container = `switchroom-${req.args.name}`;
31174
28798
  const res = await this.runDocker([
31175
28799
  "logs",
@@ -31195,6 +28819,9 @@ class HostdServer {
31195
28819
  if (!req.args.argv.every(isSafeExecArgvElement)) {
31196
28820
  return deniedResponse(req.request_id, `agent_exec: an argv element contains a control character ` + `(C0 / DEL) or exceeds ${MAX_EXEC_ARGV_ELEMENT_BYTES} bytes, ` + `which is not permitted (#1401 / #1400).`, Date.now() - started);
31197
28821
  }
28822
+ const rejected = this.rejectUnconfiguredTarget(req.args.name, req.request_id, "agent_exec", started);
28823
+ if (rejected)
28824
+ return rejected;
31198
28825
  const container = `switchroom-${req.args.name}`;
31199
28826
  const res = await this.runDocker(["exec", container, ...req.args.argv]);
31200
28827
  return {
@@ -31221,18 +28848,19 @@ class HostdServer {
31221
28848
  if (!verdict.ok) {
31222
28849
  return err(verdict.code, verdict.detail).fixBadInput("unified_diff").op("config_propose_edit").caller(caller.kind === "agent" ? "agent" : "operator").agentName(caller.kind === "agent" ? caller.name : undefined).build(req.request_id, Date.now() - started);
31223
28850
  }
28851
+ let beforeContent;
28852
+ try {
28853
+ beforeContent = readFileSync9(configPath, "utf-8");
28854
+ } catch {
28855
+ beforeContent = "";
28856
+ }
31224
28857
  if (caller.kind === "agent" && this.opts.config.agents[caller.name]?.admin !== true) {
31225
- let beforeContent;
31226
- try {
31227
- beforeContent = readFileSync8(configPath, "utf-8");
31228
- } catch {
31229
- beforeContent = "";
31230
- }
31231
28858
  const admission = admitSelfScopedNonAdminEdit(beforeContent, verdict.postApplyContent, caller.name);
31232
28859
  if (!admission.ok) {
31233
28860
  return err("E_NOT_SELF_SCOPED", admission.detail).why("non-admin agents may only add rules to their own " + "agents.<self>.tools.allow OR append their own " + "agents.<self>.memory.mental_models via config_propose_edit " + `(mental-model check: ${admission.mentalModelDetail})`).fixBadInput("unified_diff").op("config_propose_edit").caller("agent").agentName(caller.name).asDenied().build(req.request_id, Date.now() - started);
31234
28861
  }
31235
28862
  }
28863
+ const proposedChangedPaths = classifyBlastRadius(beforeContent, verdict.postApplyContent).changedPaths;
31236
28864
  if (!this.opts.approvalGateway) {
31237
28865
  return err("E_NO_APPROVAL_GATEWAY", "validation passed but hostd was started without an approval-gateway wiring; the operator build is missing the telegram-plugin link").fixOperatorAction("infra", [
31238
28866
  "ensure hostd was launched with --approval-gateway / telegram-plugin link"
@@ -31246,23 +28874,42 @@ class HostdServer {
31246
28874
  `);
31247
28875
  return await pending;
31248
28876
  }
31249
- const rate = this.checkConfigEditRate(callerName, Date.now());
31250
- if (!rate.ok) {
31251
- const retryAtIso = new Date(rate.retryAtMs).toISOString();
31252
- process.stderr.write(`hostd: config_propose_edit — RATE-LIMITED ${callerName} ` + `(>${rate.limit}/hour); next slot ${retryAtIso}
28877
+ const run = this.runConfigProposeRateThenApply(req, caller, callerName, configPath, started, proposedChangedPaths);
28878
+ this.inflightConfigProposals.set(dedupeKey, run);
28879
+ try {
28880
+ return await run;
28881
+ } finally {
28882
+ this.inflightConfigProposals.delete(dedupeKey);
28883
+ }
28884
+ }
28885
+ async runConfigProposeRateThenApply(req, caller, callerName, configPath, started, proposedChangedPaths) {
28886
+ let preApproved = false;
28887
+ try {
28888
+ if (this.opts.approvalGateway.checkPreApproved) {
28889
+ preApproved = await this.opts.approvalGateway.checkPreApproved(callerName, req.args.unified_diff);
28890
+ }
28891
+ } catch {
28892
+ preApproved = false;
28893
+ }
28894
+ if (!preApproved) {
28895
+ const rate = this.checkConfigEditRate(callerName, Date.now());
28896
+ if (!rate.ok) {
28897
+ const retryAtIso = new Date(rate.retryAtMs).toISOString();
28898
+ process.stderr.write(`hostd: config_propose_edit — RATE-LIMITED ${callerName} ` + `(>${rate.limit}/hour); next slot ${retryAtIso}
31253
28899
  `);
31254
- this.appendAuditRow({
31255
- ts: new Date().toISOString(),
31256
- op: "config_propose_edit",
31257
- phase: "rate_limited",
31258
- request_id: req.request_id,
31259
- caller: caller.kind === "agent" ? { kind: "agent", name: caller.name } : { kind: "operator" },
31260
- result: "denied",
31261
- exit_code: null,
31262
- duration_ms: Date.now() - started,
31263
- error: `E_RATE_LIMITED: >${rate.limit} config_propose_edit cards/hour`
31264
- });
31265
- return err("E_RATE_LIMITED", `config_propose_edit rate limit exceeded (max ${rate.limit}/hour for this agent)`).why(`next slot opens at ${retryAtIso}`).fixRetryAfter(retryAtIso).op("config_propose_edit").caller(caller.kind === "agent" ? "agent" : "operator").agentName(caller.kind === "agent" ? caller.name : undefined).asDenied().build(req.request_id, Date.now() - started);
28900
+ this.appendAuditRow({
28901
+ ts: new Date().toISOString(),
28902
+ op: "config_propose_edit",
28903
+ phase: "rate_limited",
28904
+ request_id: req.request_id,
28905
+ caller: caller.kind === "agent" ? { kind: "agent", name: caller.name } : { kind: "operator" },
28906
+ result: "denied",
28907
+ exit_code: null,
28908
+ duration_ms: Date.now() - started,
28909
+ error: `E_RATE_LIMITED: >${rate.limit} config_propose_edit cards/hour`
28910
+ });
28911
+ return err("E_RATE_LIMITED", `config_propose_edit rate limit exceeded (max ${rate.limit}/hour for this agent)`).why(`next slot opens at ${retryAtIso}`).fixRetryAfter(retryAtIso).op("config_propose_edit").caller(caller.kind === "agent" ? "agent" : "operator").agentName(caller.kind === "agent" ? caller.name : undefined).asDenied().build(req.request_id, Date.now() - started);
28912
+ }
31266
28913
  }
31267
28914
  this.appendAuditRow({
31268
28915
  ts: new Date().toISOString(),
@@ -31272,15 +28919,10 @@ class HostdServer {
31272
28919
  caller: caller.kind === "agent" ? { kind: "agent", name: caller.name } : { kind: "operator" },
31273
28920
  result: "started",
31274
28921
  exit_code: null,
31275
- duration_ms: Date.now() - started
28922
+ duration_ms: Date.now() - started,
28923
+ ...preApproved ? { pre_approved: true } : {}
31276
28924
  });
31277
- const run = this.runConfigProposeApprovalAndApply(req, caller, callerName, configPath, verdict.postApplyContent, started);
31278
- this.inflightConfigProposals.set(dedupeKey, run);
31279
- try {
31280
- return await run;
31281
- } finally {
31282
- this.inflightConfigProposals.delete(dedupeKey);
31283
- }
28925
+ return await this.runConfigProposeApprovalAndApply(req, caller, callerName, configPath, started, proposedChangedPaths);
31284
28926
  }
31285
28927
  inflightConfigProposals = new Map;
31286
28928
  configEditPostTimes = new Map;
@@ -31299,7 +28941,7 @@ class HostdServer {
31299
28941
  this.configEditPostTimes.set(callerName, prior);
31300
28942
  return { ok: true };
31301
28943
  }
31302
- async runConfigProposeApprovalAndApply(req, caller, callerName, configPath, postApply, started) {
28944
+ async runConfigProposeApprovalAndApply(req, caller, callerName, configPath, started, proposedChangedPaths) {
31303
28945
  const approvalId = (this.opts.generateApprovalId ?? defaultApprovalId)();
31304
28946
  const approval = await this.opts.approvalGateway.requestApproval({
31305
28947
  requestId: approvalId,
@@ -31328,7 +28970,7 @@ class HostdServer {
31328
28970
  try {
31329
28971
  let snapshot;
31330
28972
  try {
31331
- snapshot = readFileSync8(configPath, "utf-8");
28973
+ snapshot = readFileSync9(configPath, "utf-8");
31332
28974
  } catch (e) {
31333
28975
  await approval.finalize({
31334
28976
  outcome: "reconcile_failed_rolled_back",
@@ -31336,8 +28978,43 @@ class HostdServer {
31336
28978
  });
31337
28979
  return this.reconcileFailedRolledBack(`snapshot read failed: ${e.message}`, req, caller, started);
31338
28980
  }
28981
+ const reverdict = validateConfigEdit({
28982
+ configPath,
28983
+ targetPath: req.args.target_path,
28984
+ unifiedDiff: req.args.unified_diff
28985
+ });
28986
+ if (!reverdict.ok) {
28987
+ const why = `stored diff no longer applies against the current config` + `: ${reverdict.detail}`;
28988
+ await approval.finalize({
28989
+ outcome: "aborted_config_changed",
28990
+ detail: `config changed since proposal — re-propose (${why})`
28991
+ });
28992
+ return this.configChangedSinceProposal(why, req, caller, started);
28993
+ }
28994
+ const postApplyFresh = reverdict.postApplyContent;
28995
+ const applyChangedPaths = classifyBlastRadius(snapshot, postApplyFresh).changedPaths;
28996
+ const sameChangeSet = applyChangedPaths.length === proposedChangedPaths.length && applyChangedPaths.every((p, i) => p === proposedChangedPaths[i]);
28997
+ if (!sameChangeSet) {
28998
+ const why = `re-applied diff changes different config paths than approved ` + `(approved: [${proposedChangedPaths.join(", ")}]; ` + `would change: [${applyChangedPaths.join(", ")}])`;
28999
+ await approval.finalize({
29000
+ outcome: "aborted_config_changed",
29001
+ detail: `config changed since proposal — re-propose (${why})`
29002
+ });
29003
+ return this.configChangedSinceProposal(why, req, caller, started);
29004
+ }
29005
+ if (caller.kind === "agent" && this.opts.config.agents[caller.name]?.admin !== true) {
29006
+ const reAdmission = admitSelfScopedNonAdminEdit(snapshot, postApplyFresh, caller.name);
29007
+ if (!reAdmission.ok) {
29008
+ const why = `re-applied diff is no longer self-scoped for non-admin caller ` + `"${caller.name}": ${reAdmission.detail}`;
29009
+ await approval.finalize({
29010
+ outcome: "aborted_config_changed",
29011
+ detail: `config changed since proposal — re-propose (${why})`
29012
+ });
29013
+ return this.configChangedSinceProposal(why, req, caller, started);
29014
+ }
29015
+ }
31339
29016
  try {
31340
- writeFileInPlacePreservingInode(configPath, postApply);
29017
+ writeFileInPlacePreservingInode(configPath, postApplyFresh);
31341
29018
  } catch (e) {
31342
29019
  try {
31343
29020
  writeFileInPlacePreservingInode(configPath, snapshot);
@@ -31351,7 +29028,7 @@ class HostdServer {
31351
29028
  const runner = this.opts.runReconcile ?? (async () => this.runSwitchroom(caller.kind === "agent" ? ["apply", "--only", callerName, "--non-interactive"] : ["apply", "--non-interactive"]));
31352
29029
  const recRes = await runner({ requestId: approvalId });
31353
29030
  if (recRes.exit_code === 0) {
31354
- const blast = classifyBlastRadius(snapshot, postApply);
29031
+ const blast = classifyBlastRadius(snapshot, postApplyFresh);
31355
29032
  await approval.finalize({
31356
29033
  outcome: "applied",
31357
29034
  affectedAgents: blast.agents,
@@ -31389,6 +29066,11 @@ class HostdServer {
31389
29066
  release();
31390
29067
  }
31391
29068
  }
29069
+ configChangedSinceProposal(why, req, caller, started) {
29070
+ const legacy = `E_CONFIG_CHANGED: config changed since proposal — re-propose (${why})`;
29071
+ const built = err("E_CONFIG_CHANGED", "config changed since the proposal was validated; re-propose against the current config").why(why).fixBadInput("unified_diff").op("config_propose_edit").caller(caller.kind === "agent" ? "agent" : "operator").agentName(caller.kind === "agent" ? caller.name : undefined).asDenied().build(req.request_id, Date.now() - started);
29072
+ return { ...built, error: legacy };
29073
+ }
31392
29074
  reconcileFailedRolledBack(detail, req, caller, started, output) {
31393
29075
  const legacy = `E_RECONCILE_FAILED_ROLLED_BACK: ${detail}`;
31394
29076
  const built = err("E_RECONCILE_FAILED_ROLLED_BACK", "config write or reconcile failed; live file rolled back to snapshot").why(detail).fixOperatorAction("infra", [
@@ -31581,7 +29263,7 @@ ${output.recovery.stderr}` : "";
31581
29263
  return this.opts.imageRefsForDigests();
31582
29264
  try {
31583
29265
  const composePath = join10(this.opts.bindRoot ?? this.opts.homeDir, ".switchroom", "compose", "docker-compose.yml");
31584
- if (!existsSync10(composePath))
29266
+ if (!existsSync11(composePath))
31585
29267
  return [];
31586
29268
  const r = spawnSync3("docker", [
31587
29269
  "compose",
@@ -31720,10 +29402,10 @@ ${output.recovery.stderr}` : "";
31720
29402
  }
31721
29403
  rolloutRowExistsInLog(targetRequestId) {
31722
29404
  const path2 = this.auditLogPath();
31723
- if (!existsSync10(path2))
29405
+ if (!existsSync11(path2))
31724
29406
  return false;
31725
29407
  try {
31726
- const raw = readFileSync8(path2, "utf-8");
29408
+ const raw = readFileSync9(path2, "utf-8");
31727
29409
  return latestRolloutRowForRequest(raw, targetRequestId) !== null;
31728
29410
  } catch {
31729
29411
  return false;
@@ -31731,11 +29413,11 @@ ${output.recovery.stderr}` : "";
31731
29413
  }
31732
29414
  rolloutStatusFromLog(responseRequestId, targetRequestId, started) {
31733
29415
  const path2 = this.auditLogPath();
31734
- if (!existsSync10(path2))
29416
+ if (!existsSync11(path2))
31735
29417
  return null;
31736
29418
  let raw;
31737
29419
  try {
31738
- raw = readFileSync8(path2, "utf-8");
29420
+ raw = readFileSync9(path2, "utf-8");
31739
29421
  } catch {
31740
29422
  return null;
31741
29423
  }
@@ -31840,6 +29522,7 @@ ${output.recovery.stderr}` : "";
31840
29522
  await this.appendAuditRow({
31841
29523
  ts: new Date().toISOString(),
31842
29524
  op: args.req.op,
29525
+ ...args.method ? { method: args.method } : {},
31843
29526
  caller: args.caller.kind === "agent" ? { kind: "agent", name: args.caller.name } : { kind: "operator" },
31844
29527
  request_id: args.req.request_id,
31845
29528
  result: args.resp.result,
@@ -32068,12 +29751,83 @@ function isSafeExecArgvElement(s) {
32068
29751
 
32069
29752
  // src/host-control/approval-gateway.ts
32070
29753
  import { connect as connect2 } from "node:net";
29754
+ import { randomBytes as randomBytes2 } from "node:crypto";
29755
+ var PRE_APPROVED_QUERY_TIMEOUT_MS = 2000;
32071
29756
 
32072
29757
  class SocketApprovalGateway {
32073
29758
  opts;
32074
29759
  constructor(opts) {
32075
29760
  this.opts = opts;
32076
29761
  }
29762
+ async checkPreApproved(agentName, unifiedDiff) {
29763
+ const sockPath = this.opts.resolveGatewaySocket(agentName);
29764
+ if (sockPath === null)
29765
+ return false;
29766
+ const log = this.opts.log ?? (() => {});
29767
+ const correlationId = `preapp-${randomBytes2(8).toString("hex")}`;
29768
+ return await new Promise((resolve9) => {
29769
+ let settled = false;
29770
+ const client2 = connect2({ path: sockPath });
29771
+ let buffer = "";
29772
+ const done = (result) => {
29773
+ if (settled)
29774
+ return;
29775
+ settled = true;
29776
+ clearTimeout(timer);
29777
+ try {
29778
+ client2.destroy();
29779
+ } catch {}
29780
+ resolve9(result);
29781
+ };
29782
+ const timer = setTimeout(() => {
29783
+ log(`checkPreApproved timed out after ${PRE_APPROVED_QUERY_TIMEOUT_MS}ms (agent=${agentName}) — failing closed`);
29784
+ done(false);
29785
+ }, PRE_APPROVED_QUERY_TIMEOUT_MS);
29786
+ client2.on("connect", () => {
29787
+ try {
29788
+ client2.write(JSON.stringify({
29789
+ type: "check_pre_approved",
29790
+ agentName,
29791
+ correlationId,
29792
+ unifiedDiff
29793
+ }) + `
29794
+ `);
29795
+ } catch (err2) {
29796
+ log(`check_pre_approved write failed (agent=${agentName}): ${err2.message} — failing closed`);
29797
+ done(false);
29798
+ }
29799
+ });
29800
+ client2.on("data", (chunk2) => {
29801
+ buffer += chunk2.toString("utf8");
29802
+ const lines = buffer.split(`
29803
+ `);
29804
+ buffer = lines.pop() ?? "";
29805
+ for (const line of lines) {
29806
+ if (!line.trim())
29807
+ continue;
29808
+ let parsed;
29809
+ try {
29810
+ parsed = JSON.parse(line);
29811
+ } catch {
29812
+ done(false);
29813
+ return;
29814
+ }
29815
+ const obj = parsed;
29816
+ if (obj.type === "pre_approved_result" && obj.correlationId === correlationId) {
29817
+ done(obj.preApproved === true);
29818
+ return;
29819
+ }
29820
+ done(false);
29821
+ return;
29822
+ }
29823
+ });
29824
+ client2.on("error", (err2) => {
29825
+ log(`checkPreApproved socket error (agent=${agentName}): ${err2.message} — failing closed`);
29826
+ done(false);
29827
+ });
29828
+ client2.on("close", () => done(false));
29829
+ });
29830
+ }
32077
29831
  async requestApproval(req) {
32078
29832
  const sockPath = this.opts.resolveGatewaySocket(req.agentName);
32079
29833
  if (sockPath === null) {
@@ -32914,7 +30668,7 @@ async function loadConfigResilient() {
32914
30668
  try {
32915
30669
  for (const name of readdirSync4(agentsDir).sort()) {
32916
30670
  const sock = resolve9(agentsDir, name, "telegram", "gateway.sock");
32917
- if (existsSync11(sock))
30671
+ if (existsSync12(sock))
32918
30672
  out.push({ agent: name, sock });
32919
30673
  }
32920
30674
  } catch {}
@@ -32964,7 +30718,7 @@ async function main() {
32964
30718
  const agentsDir = process.env.SWITCHROOM_AGENTS_DIR ?? join11(homedir6(), ".switchroom", "agents");
32965
30719
  const resolveGatewaySocket = (agentName) => {
32966
30720
  const sock = resolve9(agentsDir, agentName, "telegram", "gateway.sock");
32967
- return existsSync11(sock) ? sock : null;
30721
+ return existsSync12(sock) ? sock : null;
32968
30722
  };
32969
30723
  const approvalGateway = new SocketApprovalGateway({
32970
30724
  resolveGatewaySocket,
@@ -32992,7 +30746,11 @@ async function main() {
32992
30746
  ])),
32993
30747
  ...config.hostd ? {
32994
30748
  hostd: {
32995
- ...config.hostd.config_edit_enabled !== undefined ? { config_edit_enabled: config.hostd.config_edit_enabled } : {}
30749
+ ...config.hostd.config_edit_enabled !== undefined ? { config_edit_enabled: config.hostd.config_edit_enabled } : {},
30750
+ ...config.hostd.operator_attest_enabled !== undefined ? { operator_attest_enabled: config.hostd.operator_attest_enabled } : {},
30751
+ ...config.hostd.operator_attest_required_verbs !== undefined ? {
30752
+ operator_attest_required_verbs: config.hostd.operator_attest_required_verbs
30753
+ } : {}
32996
30754
  }
32997
30755
  } : {}
32998
30756
  },