@cortexkit/opencode-magic-context 0.49.97 → 0.49.99

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 (207) hide show
  1. package/dist/{announcement-8nj2jd87.js → announcement-p2xjv6cp.js} +4 -5
  2. package/dist/auto-search-worker.js +5 -5
  3. package/dist/chunk-embedding-write-worker.js +15 -16
  4. package/dist/{compaction-marker-candidates-a4b0anvv.js → compaction-marker-candidates-2apg7ewt.js} +2 -3
  5. package/dist/compaction-marker-candidates-worker.js +1 -1
  6. package/dist/{compartment-chunk-embedding-re2cw7y3.js → compartment-chunk-embedding-gnemmf79.js} +7 -8
  7. package/dist/{conflict-warning-hook-wcq55y61.js → conflict-warning-hook-x1ynwzwz.js} +7 -8
  8. package/dist/{context-br04s0b6.js → context-z77a2jpx.js} +377 -60
  9. package/dist/{derive-budgets-g1sy72e8.js → derive-budgets-vbv0fwsd.js} +4 -5
  10. package/dist/embedding-backfill-79br4kk6.js +28 -0
  11. package/dist/embedding-worker-process.js +1 -2
  12. package/dist/embedding-worker.js +6 -7
  13. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  14. package/dist/features/magic-context/memory/embedding-probe.d.ts +10 -9
  15. package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
  16. package/dist/features/magic-context/memory/embedding-response-slots.d.ts +13 -0
  17. package/dist/features/magic-context/memory/embedding-response-slots.d.ts.map +1 -0
  18. package/dist/features/magic-context/storage-native-replay.d.ts +2 -0
  19. package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -1
  20. package/dist/{history-owner-74826t4n.js → history-owner-8dj31nyf.js} +2 -3
  21. package/dist/hooks/magic-context/apply-operations.d.ts +1 -1
  22. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/execute-flush.d.ts +1 -1
  24. package/dist/hooks/magic-context/execute-flush.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/tag-messages.d.ts +1 -1
  26. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/transform.d.ts +2 -0
  28. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  29. package/dist/{index-tbdy1hk0.js → index-0wj3jr8n.js} +6 -6
  30. package/dist/{index-j4dcjb8t.js → index-1vv1ka4a.js} +4 -4
  31. package/dist/{index-zfx7mtqa.js → index-2m3t73wk.js} +1 -1
  32. package/dist/{index-3fhb0j32.js → index-34xvre52.js} +223 -5
  33. package/dist/{index-pkxkeezb.js → index-4qc8d9by.js} +17 -17
  34. package/dist/{index-mmf6e740.js → index-507a56zb.js} +7 -7
  35. package/dist/{index-qdjxrbnr.js → index-5nf2a14a.js} +52 -45
  36. package/dist/{index-w9hxgntq.js → index-5xrj3zp4.js} +5 -5
  37. package/dist/{index-kj4bprep.js → index-61a853ky.js} +4 -4
  38. package/dist/{index-zmgp0tr6.js → index-74w347am.js} +3 -3
  39. package/dist/{index-hp46xe93.js → index-8hhmv0ff.js} +6 -6
  40. package/dist/{index-c205x7xd.js → index-8k9qpyjf.js} +1 -1
  41. package/dist/{index-tqtpgnhr.js → index-9awtk18w.js} +1 -1
  42. package/dist/{index-h7kta6cn.js → index-9eqt7755.js} +3 -3
  43. package/dist/{index-x49x59ar.js → index-9q7wzca8.js} +23 -25
  44. package/dist/{index-880a24vd.js → index-ab86c21b.js} +1 -1
  45. package/dist/{index-3n4j5rqc.js → index-abhmtj00.js} +1 -1
  46. package/dist/{index-tr4ep2ej.js → index-ajmy0v5j.js} +31 -0
  47. package/dist/{index-dj64gzg5.js → index-cayqdwf9.js} +2 -2
  48. package/dist/{index-0sqhg9nf.js → index-dnxnj42p.js} +12 -12
  49. package/dist/{index-0bjj9yf3.js → index-e6s2jpr8.js} +2 -2
  50. package/dist/{index-8v1brm5n.js → index-em72jhc0.js} +11 -11
  51. package/dist/{index-910gahfb.js → index-esym6cw4.js} +6 -8
  52. package/dist/{index-7sdns2ww.js → index-fd3hkyk1.js} +2 -2
  53. package/dist/{index-fgw241hh.js → index-gcf2x04k.js} +2 -2
  54. package/dist/{index-89xg64wb.js → index-geph2sa6.js} +2 -2
  55. package/dist/{index-45qgkg8j.js → index-h1qh9n8b.js} +2 -2
  56. package/dist/{index-9jvxq5rt.js → index-h1xvt8fw.js} +4 -4
  57. package/dist/{index-0ve29s6f.js → index-hbqxxb2n.js} +1 -1
  58. package/dist/{index-dnpcv1rg.js → index-hyvxmz3e.js} +4 -4
  59. package/dist/{index-hedgz8an.js → index-jsbgw33b.js} +1 -1
  60. package/dist/{index-mgy7g740.js → index-kjdys7e2.js} +1 -1
  61. package/dist/{index-e6ay1gez.js → index-mfx7hzyc.js} +2 -2
  62. package/dist/{index-7m2tnk8q.js → index-mhdavdd4.js} +31 -28
  63. package/dist/{index-r1d45dsr.js → index-nyjztqyj.js} +3 -3
  64. package/dist/{index-azkfw78y.js → index-qxzk5s30.js} +1 -1
  65. package/dist/{index-6mryx739.js → index-t7st85f5.js} +1 -1
  66. package/dist/{index-89bkkgcn.js → index-tyjx0dwz.js} +4 -4
  67. package/dist/{index-k34hc455.js → index-vdzd98ry.js} +2 -2
  68. package/dist/{index-hj78hvhm.js → index-vegw385y.js} +2 -2
  69. package/dist/{index-w7n7qkpf.js → index-w6kcwhhj.js} +4 -4
  70. package/dist/{index-xcej5kpt.js → index-xbna9akt.js} +5 -5
  71. package/dist/{index-cpbr0xvk.js → index-xtv4d4hv.js} +2 -2
  72. package/dist/{index-zkjx8gq3.js → index-xw608ytx.js} +11 -11
  73. package/dist/{index-jzrvdqb8.js → index-y5f5yg5a.js} +1 -1
  74. package/dist/index.js +55 -56
  75. package/dist/{logger-nmb2508f.js → logger-dgtrf43g.js} +1 -2
  76. package/dist/{message-fts-rowid-map-vcatdan0.js → message-fts-rowid-map-cfq59g6g.js} +4 -5
  77. package/dist/{message-index-bounded-abhwe610.js → message-index-bounded-6y7p974x.js} +10 -11
  78. package/dist/{message-time-backfill-zc5rsvhv.js → message-time-backfill-av870n4c.js} +2 -3
  79. package/dist/migration-worker.js +12 -13
  80. package/dist/plugin/rpc-handlers.d.ts +1 -0
  81. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  82. package/dist/{project-embedding-registry-e566q4bg.js → project-embedding-registry-xy8dcdys.js} +13 -14
  83. package/dist/raw-ordinal-warmup-worker.js +8 -8
  84. package/dist/{read-session-chunk-sde0wym3.js → read-session-chunk-9ejnbe07.js} +8 -9
  85. package/dist/{read-session-raw-trhdgc9z.js → read-session-raw-pgc9gxtn.js} +2 -3
  86. package/dist/{recomp-orchestrator-dapm3e4v.js → recomp-orchestrator-9k91tkyx.js} +32 -33
  87. package/dist/render-9712q3gp.js +42 -0
  88. package/dist/{safe-notification-target-54ns7dv9.js → safe-notification-target-01j8km9e.js} +2 -3
  89. package/dist/{search-archive-4bbn3ztv.js → search-archive-5jr011gc.js} +11 -12
  90. package/dist/{search-11aw8wpq.js → search-yhaxy3e6.js} +25 -26
  91. package/dist/{send-session-notification-gxrj4w1r.js → send-session-notification-tfhs4dbc.js} +5 -6
  92. package/dist/shared/rpc-types.d.ts +5 -0
  93. package/dist/shared/rpc-types.d.ts.map +1 -1
  94. package/dist/shared/status-view-check.d.ts.map +1 -1
  95. package/dist/shared/status-view.d.ts +8 -0
  96. package/dist/shared/status-view.d.ts.map +1 -1
  97. package/dist/shared/transcript.d.ts +1 -1
  98. package/dist/shared/transcript.d.ts.map +1 -1
  99. package/dist/{storage-tags-jq0c0zsn.js → storage-tags-vd3sgd4s.js} +5 -6
  100. package/dist/{store-29ksp6vy.js → store-235fjtsn.js} +6 -4
  101. package/dist/{store-reader-dgh3ssxx.js → store-reader-01e8t5j0.js} +4 -1
  102. package/dist/{transform-postprocess-phase-1xrjg6be.js → transform-postprocess-phase-mf5js6cs.js} +33 -34
  103. package/dist/v2/auto-search-worker.js +5 -5
  104. package/dist/v2/checkpoint-instruction-status.d.ts +13 -0
  105. package/dist/v2/checkpoint-instruction-status.d.ts.map +1 -0
  106. package/dist/v2/chunk-embedding-write-worker.js +15 -16
  107. package/dist/v2/{compaction-marker-candidates-6nypmsr3.js → compaction-marker-candidates-3rxg3f1e.js} +2 -3
  108. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  109. package/dist/v2/{compartment-chunk-embedding-jthtfhcd.js → compartment-chunk-embedding-6v74y2r3.js} +7 -8
  110. package/dist/v2/{context-43r0mzkp.js → context-4fej2dzv.js} +390 -69
  111. package/dist/v2/{derive-budgets-wj0q7s7d.js → derive-budgets-9237wmq5.js} +5 -6
  112. package/dist/v2/embedding-backfill-nhgp8znm.js +28 -0
  113. package/dist/v2/embedding-worker-process.js +1 -2
  114. package/dist/v2/embedding-worker.js +6 -7
  115. package/dist/v2/fold/idle.d.ts +11 -1
  116. package/dist/v2/fold/idle.d.ts.map +1 -1
  117. package/dist/v2/fold/instruction-supersession.d.ts +22 -1
  118. package/dist/v2/fold/instruction-supersession.d.ts.map +1 -1
  119. package/dist/v2/fold/native-replay-v3.d.ts +1 -0
  120. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -1
  121. package/dist/v2/fold/native-replay.d.ts +73 -0
  122. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  123. package/dist/v2/{history-owner-8pd5ax3n.js → history-owner-k4gx50a0.js} +2 -3
  124. package/dist/v2/hooks/context.d.ts.map +1 -1
  125. package/dist/v2/{logger-58jfese9.js → logger-0ys28353.js} +1 -2
  126. package/dist/v2/{message-fts-rowid-map-ax4vk78j.js → message-fts-rowid-map-88x2zbyj.js} +4 -5
  127. package/dist/v2/{message-index-bounded-qh794qxx.js → message-index-bounded-wj5rs9az.js} +10 -11
  128. package/dist/v2/{message-time-backfill-yj773saf.js → message-time-backfill-5p4vwd79.js} +2 -3
  129. package/dist/v2/migration-worker.js +12 -13
  130. package/dist/v2/{project-embedding-registry-z05xvckg.js → project-embedding-registry-qz9x79kn.js} +13 -14
  131. package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
  132. package/dist/v2/{read-session-chunk-8tn2dbn1.js → read-session-chunk-89ep8br4.js} +8 -9
  133. package/dist/v2/{read-session-raw-ywebck9q.js → read-session-raw-seh1kcvp.js} +2 -3
  134. package/dist/v2/recomp-orchestrator-9wap1z1d.js +68 -0
  135. package/dist/v2/render-bzzypsgy.js +42 -0
  136. package/dist/v2/{safe-notification-target-zrwbh6k7.js → safe-notification-target-3e2rq2ys.js} +2 -3
  137. package/dist/v2/{search-archive-8zqsf9e6.js → search-archive-4yr4hw2m.js} +11 -12
  138. package/dist/v2/{search-35cz80x0.js → search-ymm2crs3.js} +24 -25
  139. package/dist/v2/{send-session-notification-8x146x5y.js → send-session-notification-vtnk598k.js} +5 -6
  140. package/dist/v2/{server-vj0xbbrc.js → server-0b3ms151.js} +2 -2
  141. package/dist/v2/{server-r3h4fy4k.js → server-1bks09js.js} +5 -5
  142. package/dist/v2/{server-nnh81jqy.js → server-2ek9exbe.js} +6 -8
  143. package/dist/v2/{server-63ree5ns.js → server-2xng77ch.js} +1 -1
  144. package/dist/v2/{server-2sare4qg.js → server-3mb205v9.js} +4 -4
  145. package/dist/v2/{server-n34vzyfm.js → server-3qeqa3b6.js} +1 -1
  146. package/dist/v2/{server-av3p9c8k.js → server-54nc921b.js} +1 -1
  147. package/dist/v2/{server-2qvnr3t7.js → server-5zx51pm4.js} +1 -1
  148. package/dist/v2/{server-vsx9tsks.js → server-62t1852h.js} +11 -11
  149. package/dist/v2/{server-svccj9rd.js → server-6mq43ear.js} +4 -4
  150. package/dist/v2/{server-1fnsfm3a.js → server-6r3b0re0.js} +24 -26
  151. package/dist/v2/{server-db91dxwc.js → server-7861dnm3.js} +6 -6
  152. package/dist/v2/{server-6qax5pds.js → server-7c5p0bh1.js} +2 -2
  153. package/dist/v2/{server-z5cv5wm5.js → server-7wpw3wc6.js} +31 -28
  154. package/dist/v2/{server-11ra1pmx.js → server-8xgs110k.js} +4 -4
  155. package/dist/v2/{server-40vdz8sf.js → server-98xd6j4r.js} +2 -2
  156. package/dist/v2/{server-k3ntgf6n.js → server-b5eg9ct6.js} +2 -2
  157. package/dist/v2/{server-2cq3e1c1.js → server-b65sqz7y.js} +4 -4
  158. package/dist/v2/{server-ganavh75.js → server-bhr92yb4.js} +2 -2
  159. package/dist/v2/{server-4yrvbnnm.js → server-bzebqckc.js} +2 -2
  160. package/dist/v2/{server-rt8t6s2a.js → server-cc58mckk.js} +2 -2
  161. package/dist/v2/{server-xekyjy4w.js → server-d0h1gjz2.js} +6 -6
  162. package/dist/v2/{server-73bqw5c0.js → server-d46xewmt.js} +1 -1
  163. package/dist/v2/{server-rr5c0xcg.js → server-d4h86y7v.js} +2 -2
  164. package/dist/v2/{server-7tj8yzrv.js → server-e14d7ebh.js} +2 -2
  165. package/dist/v2/{server-gh2w75fn.js → server-e8ybwfv8.js} +3 -3
  166. package/dist/v2/{server-zemnpv92.js → server-ghk96d57.js} +4 -4
  167. package/dist/v2/{server-j1gxs1gj.js → server-h95cdc30.js} +1 -1
  168. package/dist/v2/{server-5t4nzfpt.js → server-j09jx1n9.js} +1 -1
  169. package/dist/v2/{server-n33hyq9t.js → server-jrs4gny6.js} +2 -2
  170. package/dist/v2/{server-7h4gwphm.js → server-pqgnjf38.js} +3 -3
  171. package/dist/v2/{server-379fd3n7.js → server-rbxtp4sm.js} +1 -1
  172. package/dist/v2/{server-2wz6y46g.js → server-sfffm587.js} +1 -1
  173. package/dist/v2/{server-bx5k66qc.js → server-vgy98kcd.js} +1 -1
  174. package/dist/v2/{server-kzrrdjp5.js → server-xc7t2r4k.js} +223 -5
  175. package/dist/v2/{server-z2nv8jdv.js → server-xn7fpv2b.js} +12 -12
  176. package/dist/v2/{server-tq523gj6.js → server-yacpgq4s.js} +1 -1
  177. package/dist/v2/{server-vtkbxzw1.js → server-ysg14rv1.js} +31 -0
  178. package/dist/v2/{server-qjjky07w.js → server-zedjjdc5.js} +11 -11
  179. package/dist/v2/server.js +8 -9
  180. package/dist/v2/{storage-tags-pcenytad.js → storage-tags-8kktww54.js} +5 -6
  181. package/dist/v2/{store-gx19qc3a.js → store-0kjfynwp.js} +6 -4
  182. package/dist/v2/{store-reader-qt2msa8z.js → store-reader-w0srb18d.js} +4 -1
  183. package/dist/v2/store-reader.d.ts +1 -0
  184. package/dist/v2/store-reader.d.ts.map +1 -1
  185. package/dist/v2/tui/index.d.ts +1 -1
  186. package/dist/v2/tui/index.d.ts.map +1 -1
  187. package/dist/v2/{v2-archive-reader-hvdyz30c.js → v2-archive-reader-veyqp15a.js} +1 -1
  188. package/dist/v2/{wrapup-orchestrator-0d4ceff3.js → wrapup-orchestrator-89cg7p41.js} +33 -34
  189. package/dist/{v2-archive-reader-qs24chs6.js → v2-archive-reader-3s332fn7.js} +1 -1
  190. package/dist/wrapup-orchestrator-41rt7etq.js +55 -0
  191. package/package.json +2 -2
  192. package/src/shared/rpc-types.ts +6 -0
  193. package/src/shared/status-view-check.ts +11 -0
  194. package/src/shared/status-view.ts +24 -1
  195. package/src/shared/tag-transcript.ts +5 -4
  196. package/src/shared/test-preload-leak-scan.test.ts +56 -0
  197. package/src/shared/transcript.ts +1 -1
  198. package/src/v2/tui/index.ts +8 -1
  199. package/src/v2/tui/status-dialog-fallback.test.ts +21 -0
  200. package/dist/embedding-backfill-pdymqbnh.js +0 -29
  201. package/dist/index-dt7cyqfe.js +0 -223
  202. package/dist/render-6vmqzcem.js +0 -43
  203. package/dist/v2/embedding-backfill-16b16m38.js +0 -29
  204. package/dist/v2/recomp-orchestrator-vzygyqwn.js +0 -69
  205. package/dist/v2/render-9b5dxp9e.js +0 -43
  206. package/dist/v2/server-dt7cyqfe.js +0 -223
  207. package/dist/wrapup-orchestrator-v1mhjw55.js +0 -56
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  getHarness2
3
3
  } from "./index-pavzsdc6.js";
4
- import {
5
- sanitizeDiagnosticText,
6
- sanitizeConfigValue
7
- } from "./index-dt7cyqfe.js";
8
4
 
9
5
  // src/shared/logger.ts
10
6
  import * as fs from "node:fs";
@@ -159,6 +155,228 @@ function getLegacyOpenCodeMagicContextStorageDir() {
159
155
  return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
160
156
  }
161
157
 
158
+ // src/shared/redaction.ts
159
+ import { homedir as homedir2, userInfo } from "node:os";
160
+ function escapeRegex(value) {
161
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
162
+ }
163
+ var SECRET_WORDS = [
164
+ "key",
165
+ "token",
166
+ "secret",
167
+ "password",
168
+ "auth",
169
+ "authorization",
170
+ "bearer",
171
+ "credential"
172
+ ];
173
+ var SECRET_SEGMENT_PATTERN = new RegExp(`^(?:${SECRET_WORDS.map((w) => `${w}s?`).join("|")})$`, "i");
174
+ var TRAILING_DESCRIPTORS = new Set(["id", "ids", "value", "values", "header", "headers"]);
175
+ function redactionTypeForKey(key) {
176
+ const normalized = key.trim().toLowerCase().replace(/[^a-z0-9_.-]+/g, "_");
177
+ const suffix = normalized.split(".").filter(Boolean).at(-1) ?? normalized;
178
+ return suffix || "secret";
179
+ }
180
+ function isNonSecretScalarValue(value) {
181
+ const v = value.trim();
182
+ if (v === "true" || v === "false" || v === "null" || v === "undefined")
183
+ return true;
184
+ return /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(v);
185
+ }
186
+ var SECRET_QUALIFIERS = new Set([
187
+ "api",
188
+ "access",
189
+ "private",
190
+ "client",
191
+ "auth",
192
+ "authorization",
193
+ "secret",
194
+ "bearer",
195
+ "session",
196
+ "refresh",
197
+ "service",
198
+ "x",
199
+ "openai",
200
+ "anthropic",
201
+ "google",
202
+ "github",
203
+ "huggingface",
204
+ "aws",
205
+ "azure",
206
+ "id"
207
+ ]);
208
+ var UNQUALIFIED_SECRET_SEGMENT_PATTERN = /^(?:password|secret|credential|bearer|authorization)s?$/;
209
+ function isSecretKey(key) {
210
+ const segments = key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().split(/[._-]+/).filter(Boolean);
211
+ if (segments.length === 0)
212
+ return false;
213
+ if (segments.length === 1) {
214
+ const first = segments[0];
215
+ return Boolean(first && SECRET_SEGMENT_PATTERN.test(first));
216
+ }
217
+ for (let i = 0;i < segments.length; i++) {
218
+ const seg = segments[i];
219
+ if (!seg || !SECRET_SEGMENT_PATTERN.test(seg))
220
+ continue;
221
+ let trailingOk = true;
222
+ for (let j = i + 1;j < segments.length; j++) {
223
+ const tail = segments[j];
224
+ if (!tail)
225
+ continue;
226
+ if (TRAILING_DESCRIPTORS.has(tail))
227
+ continue;
228
+ if (SECRET_SEGMENT_PATTERN.test(tail))
229
+ continue;
230
+ trailingOk = false;
231
+ break;
232
+ }
233
+ if (!trailingOk)
234
+ continue;
235
+ if (UNQUALIFIED_SECRET_SEGMENT_PATTERN.test(seg))
236
+ return true;
237
+ for (let k = i - 1;k >= 0; k--) {
238
+ const lead = segments[k];
239
+ if (lead && SECRET_QUALIFIERS.has(lead))
240
+ return true;
241
+ }
242
+ }
243
+ return false;
244
+ }
245
+ function sanitizePathString(value) {
246
+ const home = process.env.HOME || process.env.USERPROFILE || homedir2();
247
+ const username = userInfo().username;
248
+ let sanitized = value;
249
+ if (home) {
250
+ sanitized = sanitized.replace(new RegExp(escapeRegex(home), "g"), "~");
251
+ }
252
+ sanitized = sanitized.replace(/\/Users\/[^/]+\//g, "/Users/<USER>/");
253
+ sanitized = sanitized.replace(/\/home\/[^/]+\//g, "/home/<USER>/");
254
+ sanitized = sanitized.replace(/C:\\Users\\[^\\]+\\/g, "C:\\Users\\<USER>\\");
255
+ if (username) {
256
+ const word = "[\\p{L}\\p{M}\\p{N}_]";
257
+ sanitized = sanitized.replace(new RegExp(`(?<!${word})${escapeRegex(username)}(?!${word})`, "gu"), "<USER>");
258
+ }
259
+ return sanitized;
260
+ }
261
+ var SECRET_TEXT_PATTERNS = [
262
+ {
263
+ pattern: /\bsk-ant-(?:api03-)?[A-Za-z0-9_-]{32,}/g,
264
+ replacement: "<ANTHROPIC_API_KEY_REDACTED>"
265
+ },
266
+ {
267
+ pattern: /\bsk-(?:proj-)?[A-Za-z0-9_-]{12,}/g,
268
+ replacement: "<OPENAI_API_KEY_REDACTED>"
269
+ },
270
+ {
271
+ pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
272
+ replacement: "<GITHUB_PAT_REDACTED>"
273
+ },
274
+ {
275
+ pattern: /\b(?:gh[opsu]|ghr)_[A-Za-z0-9_-]{30,}/g,
276
+ replacement: "<GITHUB_TOKEN_REDACTED>"
277
+ },
278
+ {
279
+ pattern: /\bhf_[A-Za-z0-9]{30,}/g,
280
+ replacement: "<HUGGINGFACE_TOKEN_REDACTED>"
281
+ },
282
+ {
283
+ pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
284
+ replacement: "<AWS_ACCESS_KEY_ID_REDACTED>"
285
+ },
286
+ {
287
+ pattern: /\bxox[abprsuvc]-[A-Za-z0-9-]{10,}/g,
288
+ replacement: "<SLACK_TOKEN_REDACTED>"
289
+ },
290
+ {
291
+ pattern: /\bAIza[A-Za-z0-9_-]{35}\b/g,
292
+ replacement: "<GOOGLE_API_KEY_REDACTED>"
293
+ },
294
+ {
295
+ pattern: /\b(Authorization\s*:\s*Bearer\s+)([A-Za-z0-9._~+/=-]{8,})/gi,
296
+ replacement: (_full, prefix) => `${prefix}<REDACTED:bearer>`
297
+ },
298
+ {
299
+ pattern: /\b((?:Proxy-)?Authorization\s*:\s*(?:Basic|Digest|Token|Negotiate|NTLM)\s+)([A-Za-z0-9._~+/=-]{4,})/gi,
300
+ replacement: (_full, prefix) => `${prefix}<REDACTED:authorization>`
301
+ },
302
+ {
303
+ pattern: /\b((?:x-)?(?:api-?key|api-?token|auth-?token|access-?token)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
304
+ replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:api_key>`
305
+ },
306
+ {
307
+ pattern: /\b((?:api[_-]?key|client[_-]?secret|access[_-]?token|token|secret|password|passwd|pwd)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
308
+ replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:credential>`
309
+ },
310
+ {
311
+ pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:)([^\s/@]+)(@)/gi,
312
+ replacement: (_full, prefix, _password, at) => `${prefix}<REDACTED:password>${at}`
313
+ },
314
+ {
315
+ pattern: /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
316
+ replacement: "<JWT_REDACTED>"
317
+ },
318
+ {
319
+ pattern: /(["'])([^"']*(?:key|token|secret|password|auth|bearer|credential)[^"']*)\1(\s*:\s*)(["'])([^"']*)\4/gi,
320
+ replacement: (full, quote, key, separator, valueQuote, value) => isNonSecretScalarValue(value) ? full : `${quote}${key}${quote}${separator}${valueQuote}<REDACTED:${redactionTypeForKey(key)}>${valueQuote}`
321
+ },
322
+ {
323
+ pattern: /\b([A-Za-z0-9_.-]*(?:key|token|secret|password|auth|bearer|credential)[A-Za-z0-9_.-]*)\s*=\s*([^\s'"`]+)/gi,
324
+ replacement: (full, key, value) => isNonSecretScalarValue(value) ? full : `${key}=<REDACTED:${redactionTypeForKey(key)}>`
325
+ }
326
+ ];
327
+ function redactSecretText(value) {
328
+ let redacted = value;
329
+ for (const { pattern, replacement } of SECRET_TEXT_PATTERNS) {
330
+ if (typeof replacement === "string") {
331
+ redacted = redacted.replace(pattern, replacement);
332
+ } else {
333
+ redacted = redacted.replace(pattern, replacement);
334
+ }
335
+ }
336
+ return redacted;
337
+ }
338
+ function sanitizeDiagnosticText(value) {
339
+ return redactSecretText(sanitizePathString(value));
340
+ }
341
+ var SHAREABILITY_SENSITIVE_PATTERNS = [
342
+ /\bC:\/Users\/[^/\s]+/i,
343
+ /(?:^|\s)~\/[^\s]+/,
344
+ /\b(?:api[_-]?key|secret|token|password|passwd|pwd|client[_-]?secret|access[_-]?key)\b\s*[:=]\s*\S+/i,
345
+ /\b(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d+)?\b/i,
346
+ /\b(?:10|127)\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/,
347
+ /\b192\.168\.\d{1,3}\.\d{1,3}\b/,
348
+ /\b172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}\b/
349
+ ];
350
+ function hasShareabilitySensitiveText(text) {
351
+ try {
352
+ if (sanitizeDiagnosticText(text) !== text)
353
+ return true;
354
+ return SHAREABILITY_SENSITIVE_PATTERNS.some((pattern) => pattern.test(text));
355
+ } catch {
356
+ return true;
357
+ }
358
+ }
359
+ function sanitizeConfigValue(value, keyPath = []) {
360
+ if (value === null || typeof value === "number" || typeof value === "boolean")
361
+ return value;
362
+ const key = keyPath.at(-1) ?? "";
363
+ if (key && isSecretKey(key)) {
364
+ return `<REDACTED:${redactionTypeForKey(key)}>`;
365
+ }
366
+ if (typeof value === "string")
367
+ return sanitizeDiagnosticText(value);
368
+ if (Array.isArray(value)) {
369
+ return value.map((entry, index) => sanitizeConfigValue(entry, [...keyPath, String(index)]));
370
+ }
371
+ if (value && typeof value === "object") {
372
+ return Object.fromEntries(Object.entries(value).map(([entryKey, entry]) => [
373
+ entryKey,
374
+ sanitizeConfigValue(entry, [...keyPath, entryKey])
375
+ ]));
376
+ }
377
+ return value;
378
+ }
379
+
162
380
  // src/shared/stale-plugin-build.ts
163
381
  import { posix } from "node:path";
164
382
  import { fileURLToPath } from "node:url";
@@ -487,4 +705,4 @@ if (!isTestEnv) {
487
705
  process.on("exit", flush);
488
706
  }
489
707
 
490
- export { getDataDir, getMagicContextHistorianSessionDir, ensureCortexKitArtifactGitignore, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder2, writeForwardedLogLine2, log2, sessionLog2, getLoggerDiagnostics2, flushLogger2, getLogFilePath2 };
708
+ export { getDataDir, getMagicContextHistorianSessionDir, ensureCortexKitArtifactGitignore, getOpenCodeStorageDir, getMagicContextStorageResolution, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder2, writeForwardedLogLine2, log2, sessionLog2, getLoggerDiagnostics2, flushLogger2, getLogFilePath2 };
@@ -164,7 +164,7 @@ import {
164
164
  adoptNullOwnerToolTag2,
165
165
  getCandidateToolOwners2,
166
166
  pickNearestPriorOwner2
167
- } from "./index-w7n7qkpf.js";
167
+ } from "./index-w6kcwhhj.js";
168
168
  import {
169
169
  getHarness2
170
170
  } from "./index-pavzsdc6.js";
@@ -172,12 +172,12 @@ import {
172
172
  getMagicContextStorageDir,
173
173
  log2,
174
174
  sessionLog2
175
- } from "./index-3fhb0j32.js";
175
+ } from "./index-34xvre52.js";
176
176
  import {
177
177
  textMentionsRecentCommit,
178
178
  hasMeaningfulUserText2,
179
179
  estimateTokens
180
- } from "./index-zfx7mtqa.js";
180
+ } from "./index-2m3t73wk.js";
181
181
  import {
182
182
  inRootAsyncContext2,
183
183
  getTagIdentityWriteGeneration2,
@@ -193,7 +193,7 @@ import {
193
193
  } from "./index-1d042x6w.js";
194
194
  import {
195
195
  runSessionWarmupWorker
196
- } from "./index-hedgz8an.js";
196
+ } from "./index-jsbgw33b.js";
197
197
  import {
198
198
  getMaxM0MutationId,
199
199
  getLastCompartmentEndMessage,
@@ -218,11 +218,11 @@ import {
218
218
  saveSourceContent,
219
219
  replaceSourceContent,
220
220
  getSourceContents
221
- } from "./index-8v1brm5n.js";
221
+ } from "./index-em72jhc0.js";
222
222
  import {
223
223
  cleanSearchText,
224
224
  matchedSearchSnippet
225
- } from "./index-89bkkgcn.js";
225
+ } from "./index-tyjx0dwz.js";
226
226
  import {
227
227
  BoundedSessionMap,
228
228
  tagRevisionKey,
@@ -230,7 +230,7 @@ import {
230
230
  getTemporalDecisions,
231
231
  freezeTemporalDecisions,
232
232
  stableStringify
233
- } from "./index-cpbr0xvk.js";
233
+ } from "./index-xtv4d4hv.js";
234
234
  import {
235
235
  isValidLanguageCode,
236
236
  resolveModelConfigValue,
@@ -242,7 +242,7 @@ import {
242
242
  withReadOnlySessionDb,
243
243
  getMessageTimesFromOpenCodeDb,
244
244
  findLastAssistantModelFromOpenCodeDb
245
- } from "./index-k34hc455.js";
245
+ } from "./index-vdzd98ry.js";
246
246
  import {
247
247
  stripSystemInjection,
248
248
  isTextPart,
@@ -255,30 +255,30 @@ import {
255
255
  extractToolCallObservation,
256
256
  ToolMutationBatch,
257
257
  createToolDropTarget
258
- } from "./index-hp46xe93.js";
258
+ } from "./index-8hhmv0ff.js";
259
259
  import {
260
260
  hasTrustedAbsoluteWall,
261
261
  applyProvenInputFloor,
262
262
  isSaneLimit,
263
263
  getSdkWindowGeometry,
264
264
  getSdkContextLimit
265
- } from "./index-45qgkg8j.js";
265
+ } from "./index-h1qh9n8b.js";
266
266
  import {
267
267
  getProjectEmbeddingSnapshot2,
268
268
  embedTextForProject2,
269
269
  embedBatchForProject2
270
- } from "./index-7m2tnk8q.js";
270
+ } from "./index-mhdavdd4.js";
271
271
  import {
272
272
  isEmbeddingHostBusy2
273
273
  } from "./index-qt1qqasc.js";
274
274
  import {
275
275
  userFacingFailureCode
276
- } from "./index-910gahfb.js";
276
+ } from "./index-esym6cw4.js";
277
277
  import {
278
278
  getMessageIndexEpoch,
279
279
  isMessageIndexSearchable,
280
280
  createAutoSearchDiagnostics
281
- } from "./index-9jvxq5rt.js";
281
+ } from "./index-h1xvt8fw.js";
282
282
  import {
283
283
  compareOpenCodeMessagesByCanonicalOrder,
284
284
  startCompactionMarkerCandidatePreparation,
@@ -300,7 +300,7 @@ import {
300
300
  peekNoteNudgeText,
301
301
  markNoteNudgeDelivered,
302
302
  getActiveCompartmentRun
303
- } from "./index-x49x59ar.js";
303
+ } from "./index-9q7wzca8.js";
304
304
  import {
305
305
  canonicalModelIdentity,
306
306
  piModelRefToCanonical,
@@ -311,7 +311,7 @@ import {
311
311
  } from "./index-y8v6yerm.js";
312
312
  import {
313
313
  logSlowWriteTransaction
314
- } from "./index-tqtpgnhr.js";
314
+ } from "./index-9awtk18w.js";
315
315
 
316
316
  // src/shared/model-cache-ttl.ts
317
317
  var MODEL_CACHE_LIFETIMES = [
@@ -5067,7 +5067,7 @@ function applyPendingOperations(sessionId, db, targets, protectedTagIds, preload
5067
5067
  }
5068
5068
  return didMutateMessage;
5069
5069
  }
5070
- function applyFlushedStatuses(sessionId, db, targets, preloadedTags) {
5070
+ function applyFlushedStatuses(sessionId, db, targets, preloadedTags, keepRealArgumentsFor) {
5071
5071
  let didMutateMessage = false;
5072
5072
  const tags = preloadedTags ?? getDroppedTagsByNumbers2(db, sessionId, [...targets.keys()]);
5073
5073
  for (const tag of tags) {
@@ -5098,7 +5098,7 @@ function applyFlushedStatuses(sessionId, db, targets, preloadedTags) {
5098
5098
  didMutateMessage = true;
5099
5099
  }
5100
5100
  } else {
5101
- const dropResult = target?.drop?.() ?? "absent";
5101
+ const dropResult = target?.drop?.(keepRealArgumentsFor?.has(tag.tagNumber)) ?? "absent";
5102
5102
  if (dropResult === "removed" || dropResult === "truncated") {
5103
5103
  didMutateMessage = true;
5104
5104
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sessionLog2
3
- } from "./index-3fhb0j32.js";
3
+ } from "./index-34xvre52.js";
4
4
  import {
5
5
  COMPARTMENT_LEASE_RENEWAL_MS,
6
6
  acquireCompartmentLease,
@@ -9,7 +9,7 @@ import {
9
9
  getCompartments,
10
10
  getLastCompartmentEndMessage,
11
11
  requestPendingMaterialization
12
- } from "./index-8v1brm5n.js";
12
+ } from "./index-em72jhc0.js";
13
13
  import {
14
14
  inRootAsyncContext2
15
15
  } from "./index-gzy5w8ya.js";
@@ -20,10 +20,10 @@ import {
20
20
  releaseWrapupInProgress,
21
21
  getHistorianFailureState,
22
22
  clearEmergencyRecovery
23
- } from "./index-w7n7qkpf.js";
23
+ } from "./index-w6kcwhhj.js";
24
24
  import {
25
25
  prepareRawSessionOrdinals2
26
- } from "./index-hp46xe93.js";
26
+ } from "./index-8hhmv0ff.js";
27
27
  import {
28
28
  pushNotification2
29
29
  } from "./index-y14pawe1.js";
@@ -35,14 +35,14 @@ import {
35
35
  getActiveCompartmentRun,
36
36
  markActiveCompartmentRunPublished,
37
37
  registerActiveCompartmentRun
38
- } from "./index-x49x59ar.js";
38
+ } from "./index-9q7wzca8.js";
39
39
  import {
40
40
  sendStatusNotification2
41
- } from "./index-kj4bprep.js";
41
+ } from "./index-61a853ky.js";
42
42
  import {
43
43
  setRecompStarting2,
44
44
  setRecompTerminal2
45
- } from "./index-w9hxgntq.js";
45
+ } from "./index-5xrj3zp4.js";
46
46
 
47
47
  // src/hooks/magic-context/wrapup-orchestrator.ts
48
48
  import * as crypto from "node:crypto";