@remnic/core 10.0.190 → 10.0.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-admin-ops-surface.js +45 -44
- package/dist/access-cli.js +45 -44
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush-preempt.js +45 -44
- package/dist/access-extraction-force-flush.js +45 -44
- package/dist/access-http-briefing.js +45 -44
- package/dist/access-http-query.js +45 -44
- package/dist/access-http.js +45 -44
- package/dist/access-identity-continuity-surface.js +45 -44
- package/dist/access-lcm-surface.js +45 -44
- package/dist/access-mcp.js +45 -44
- package/dist/access-observe-write-surface.js +45 -44
- package/dist/access-operations-batch.js +45 -44
- package/dist/access-operations.js +45 -44
- package/dist/access-recall-concurrency.js +45 -44
- package/dist/access-recall-response.js +45 -44
- package/dist/access-recall-surface.js +45 -44
- package/dist/access-service.js +45 -44
- package/dist/active-recall.js +8 -8
- package/dist/admin/admin-surfaces.d.ts +11 -0
- package/dist/admin/admin-surfaces.d.ts.map +1 -1
- package/dist/admin/admin-surfaces.js +43 -0
- package/dist/admin/admin-surfaces.js.map +1 -0
- package/dist/briefing.js +9 -9
- package/dist/causal-consolidation.js +10 -10
- package/dist/{chunk-OA7YDB6A.js → chunk-2CWCJYT3.js} +2 -2
- package/dist/{chunk-C6Y2YHJL.js → chunk-2DFXIJPZ.js} +2 -2
- package/dist/{chunk-YVXR7CPS.js → chunk-2S6PPGIR.js} +2 -2
- package/dist/{chunk-RVODERA5.js → chunk-3XJITLZQ.js} +2 -2
- package/dist/{chunk-56BNHKZM.js → chunk-4SUNBSPD.js} +7 -7
- package/dist/{chunk-VQQZJ6KJ.js → chunk-6YAQ3AJ5.js} +3 -3
- package/dist/{chunk-K3JGILZC.js → chunk-7BIGO6ZL.js} +3 -3
- package/dist/{chunk-RPOG6HLI.js → chunk-7GMOB4FF.js} +2 -2
- package/dist/{chunk-CIAQK2OU.js → chunk-7MAMRCZ7.js} +2 -2
- package/dist/{chunk-ABPOW3SX.js → chunk-AIS7RLTG.js} +61 -464
- package/dist/chunk-AIS7RLTG.js.map +1 -0
- package/dist/{chunk-B7GZL7PR.js → chunk-ARD2TEY2.js} +4 -4
- package/dist/{chunk-X3ERYOLO.js → chunk-BZ5VO7KO.js} +2 -2
- package/dist/{chunk-ATPY63F5.js → chunk-C2UN2CY7.js} +2 -2
- package/dist/{chunk-QXHWOUS6.js → chunk-C6YKKH73.js} +3 -3
- package/dist/{chunk-2VNMSEZR.js → chunk-CJYVVVOG.js} +3 -3
- package/dist/{chunk-K6BS5RB4.js → chunk-CP6MUXNI.js} +2 -2
- package/dist/{chunk-2I3ETW3G.js → chunk-FFTGLWHI.js} +2 -2
- package/dist/{chunk-D3FP4JQI.js → chunk-FZPZML67.js} +2 -2
- package/dist/{chunk-XWPYK5T4.js → chunk-ICA5SCIT.js} +2 -2
- package/dist/{chunk-7X6EZ2QB.js → chunk-JGVW6F3Q.js} +3 -3
- package/dist/{chunk-6OHCNTKU.js → chunk-JIB3UUYV.js} +2 -2
- package/dist/{chunk-QGT5KNQT.js → chunk-JOR4Y326.js} +2 -2
- package/dist/{chunk-65DWWJKI.js → chunk-JQCEG54G.js} +2 -2
- package/dist/{chunk-TAPF7T26.js → chunk-NL5KFA5N.js} +2 -2
- package/dist/{chunk-PCGBESAN.js → chunk-NSFHMGOF.js} +2 -2
- package/dist/{chunk-ZG4GNPRE.js → chunk-PBE7NFB5.js} +5 -5
- package/dist/{chunk-H442UKDV.js → chunk-QTHFGP5F.js} +7 -7
- package/dist/{chunk-KVTUUU7H.js → chunk-RC2TVYY2.js} +2 -2
- package/dist/{chunk-AXSQGJSG.js → chunk-RQOUKIFS.js} +10 -10
- package/dist/{chunk-DLPS5YP3.js → chunk-TJV5HGSC.js} +4 -4
- package/dist/{chunk-6MDHK6NO.js → chunk-U6JZGQXC.js} +2 -2
- package/dist/{chunk-TQODBIMW.js → chunk-U6OQ7GWU.js} +2 -2
- package/dist/{chunk-A32EBVCZ.js → chunk-W7FZ7ZZE.js} +2 -2
- package/dist/{chunk-XQF2KLV5.js → chunk-X5XK6WWV.js} +2 -2
- package/dist/chunk-XC4PRJWM.js +593 -0
- package/dist/chunk-XC4PRJWM.js.map +1 -0
- package/dist/{chunk-GGQ3CJVH.js → chunk-YTT6XJNX.js} +4 -4
- package/dist/cli.js +45 -44
- package/dist/coding/export-okf-codegraph.js +8 -8
- package/dist/compounding/engine.js +10 -10
- package/dist/config.js +8 -8
- package/dist/connectors/codex-materialize-runner.js +9 -9
- package/dist/connectors/index.js +9 -9
- package/dist/convergence-refresh.js +11 -11
- package/dist/corpus-watermark.js +11 -11
- package/dist/entity-retrieval.js +9 -9
- package/dist/explicit-capture.js +45 -44
- package/dist/extraction.js +9 -9
- package/dist/harmonic-retrieval.js +9 -9
- package/dist/index.js +66 -65
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +5 -5
- package/dist/location/index.js +10 -10
- package/dist/maintenance/memory-governance.js +9 -9
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +9 -9
- package/dist/maintenance/rebuild-memory-projection-runner.js +11 -11
- package/dist/maintenance/rebuild-memory-projection.js +10 -10
- package/dist/namespaces/migrate.js +10 -10
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.js +9 -9
- package/dist/operator-doctor-corpus.js +12 -12
- package/dist/operator-toolkit.js +15 -15
- package/dist/orchestration/backlog-scheduler.js +46 -45
- package/dist/orchestration/backlog-scheduler.js.map +1 -1
- package/dist/orchestration/buffer-drain-runner.js +46 -45
- package/dist/orchestration/maintenance.js +17 -17
- package/dist/orchestrator.js +45 -44
- package/dist/recall-navigation.js +45 -44
- package/dist/resume-bundles.js +8 -8
- package/dist/search/factory.js +6 -6
- package/dist/search/index.js +11 -11
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/orama-backend.js +2 -2
- package/dist/semantic-consolidation.js +10 -10
- package/dist/semantic-rule-promotion.js +9 -9
- package/dist/semantic-rule-verifier.js +9 -9
- package/dist/source-agent-qualifier.js +9 -9
- package/dist/standup/build.js +9 -9
- package/dist/storage.js +8 -8
- package/dist/transfer/export-okf.js +9 -9
- package/dist/verified-recall.js +9 -9
- package/dist/who-knows-cli.js +10 -10
- package/dist/who-knows.js +9 -9
- package/package.json +12 -2
- package/src/admin/admin-surfaces.test.ts +171 -0
- package/src/admin/admin-surfaces.ts +215 -2
- package/dist/chunk-ABPOW3SX.js.map +0 -1
- /package/dist/{chunk-OA7YDB6A.js.map → chunk-2CWCJYT3.js.map} +0 -0
- /package/dist/{chunk-C6Y2YHJL.js.map → chunk-2DFXIJPZ.js.map} +0 -0
- /package/dist/{chunk-YVXR7CPS.js.map → chunk-2S6PPGIR.js.map} +0 -0
- /package/dist/{chunk-RVODERA5.js.map → chunk-3XJITLZQ.js.map} +0 -0
- /package/dist/{chunk-56BNHKZM.js.map → chunk-4SUNBSPD.js.map} +0 -0
- /package/dist/{chunk-VQQZJ6KJ.js.map → chunk-6YAQ3AJ5.js.map} +0 -0
- /package/dist/{chunk-K3JGILZC.js.map → chunk-7BIGO6ZL.js.map} +0 -0
- /package/dist/{chunk-RPOG6HLI.js.map → chunk-7GMOB4FF.js.map} +0 -0
- /package/dist/{chunk-CIAQK2OU.js.map → chunk-7MAMRCZ7.js.map} +0 -0
- /package/dist/{chunk-B7GZL7PR.js.map → chunk-ARD2TEY2.js.map} +0 -0
- /package/dist/{chunk-X3ERYOLO.js.map → chunk-BZ5VO7KO.js.map} +0 -0
- /package/dist/{chunk-ATPY63F5.js.map → chunk-C2UN2CY7.js.map} +0 -0
- /package/dist/{chunk-QXHWOUS6.js.map → chunk-C6YKKH73.js.map} +0 -0
- /package/dist/{chunk-2VNMSEZR.js.map → chunk-CJYVVVOG.js.map} +0 -0
- /package/dist/{chunk-K6BS5RB4.js.map → chunk-CP6MUXNI.js.map} +0 -0
- /package/dist/{chunk-2I3ETW3G.js.map → chunk-FFTGLWHI.js.map} +0 -0
- /package/dist/{chunk-D3FP4JQI.js.map → chunk-FZPZML67.js.map} +0 -0
- /package/dist/{chunk-XWPYK5T4.js.map → chunk-ICA5SCIT.js.map} +0 -0
- /package/dist/{chunk-7X6EZ2QB.js.map → chunk-JGVW6F3Q.js.map} +0 -0
- /package/dist/{chunk-6OHCNTKU.js.map → chunk-JIB3UUYV.js.map} +0 -0
- /package/dist/{chunk-QGT5KNQT.js.map → chunk-JOR4Y326.js.map} +0 -0
- /package/dist/{chunk-65DWWJKI.js.map → chunk-JQCEG54G.js.map} +0 -0
- /package/dist/{chunk-TAPF7T26.js.map → chunk-NL5KFA5N.js.map} +0 -0
- /package/dist/{chunk-PCGBESAN.js.map → chunk-NSFHMGOF.js.map} +0 -0
- /package/dist/{chunk-ZG4GNPRE.js.map → chunk-PBE7NFB5.js.map} +0 -0
- /package/dist/{chunk-H442UKDV.js.map → chunk-QTHFGP5F.js.map} +0 -0
- /package/dist/{chunk-KVTUUU7H.js.map → chunk-RC2TVYY2.js.map} +0 -0
- /package/dist/{chunk-AXSQGJSG.js.map → chunk-RQOUKIFS.js.map} +0 -0
- /package/dist/{chunk-DLPS5YP3.js.map → chunk-TJV5HGSC.js.map} +0 -0
- /package/dist/{chunk-6MDHK6NO.js.map → chunk-U6JZGQXC.js.map} +0 -0
- /package/dist/{chunk-TQODBIMW.js.map → chunk-U6OQ7GWU.js.map} +0 -0
- /package/dist/{chunk-A32EBVCZ.js.map → chunk-W7FZ7ZZE.js.map} +0 -0
- /package/dist/{chunk-XQF2KLV5.js.map → chunk-X5XK6WWV.js.map} +0 -0
- /package/dist/{chunk-GGQ3CJVH.js.map → chunk-YTT6XJNX.js.map} +0 -0
|
@@ -43,7 +43,8 @@ import type { CodingContext, MemoryCategory, MemoryFrontmatter, PluginConfig } f
|
|
|
43
43
|
*/
|
|
44
44
|
export const REDACTED = "<redacted>";
|
|
45
45
|
|
|
46
|
-
const
|
|
46
|
+
const SENSITIVE_KEY_SOURCE = "(?:token|secret|password|api[_-]?key|bearer|authorization|credential|private[_-]?key)";
|
|
47
|
+
const SENSITIVE_KEY_RE = new RegExp(SENSITIVE_KEY_SOURCE, "i");
|
|
47
48
|
const BEARER_VALUE_RE = /^(bearer|sk-|pk-|xox[bp]-|AKIA)/i;
|
|
48
49
|
const LONG_OPAQUE_RE = /^[A-Za-z0-9_\-]{32,}$/;
|
|
49
50
|
|
|
@@ -93,13 +94,225 @@ function walkRedact(value: unknown, key: string | undefined): unknown {
|
|
|
93
94
|
const record = value as Record<string, unknown>;
|
|
94
95
|
const out: Record<string, unknown> = {};
|
|
95
96
|
for (const [k, v] of Object.entries(record)) {
|
|
96
|
-
|
|
97
|
+
// A sensitive name redacts the COMPLETE value regardless of type: arrays
|
|
98
|
+
// and objects under e.g. `apiKeys` / `credentials` carry credentials just
|
|
99
|
+
// as strings do (recursing dropped the key and leaked short members).
|
|
100
|
+
out[k] = SENSITIVE_KEY_RE.test(k) && !SAFE_DIAGNOSTIC_KEYS.has(k) ? REDACTED : walkRedact(v, k);
|
|
97
101
|
}
|
|
98
102
|
return out;
|
|
99
103
|
}
|
|
100
104
|
return value;
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Remove `/* *\/` and `//` comments outside JSON strings and drop trailing
|
|
109
|
+
* commas, so JSONC-style configs can take the structured redaction path
|
|
110
|
+
* (JSON.parse rejects both). A trailing comma is a comma whose next
|
|
111
|
+
* non-whitespace character is a closing `}` or `]`. Unterminated constructs
|
|
112
|
+
* truncate the remainder, keeping the conservative regex fallback in charge.
|
|
113
|
+
* Linear scan: tracks string state with escape handling, so comments and
|
|
114
|
+
* commas inside string values (e.g. URLs) are never touched.
|
|
115
|
+
*/
|
|
116
|
+
function stripJsonComments(text: string): string {
|
|
117
|
+
let out = "";
|
|
118
|
+
let inString = false;
|
|
119
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
120
|
+
const ch = text[i];
|
|
121
|
+
if (inString) {
|
|
122
|
+
out += ch;
|
|
123
|
+
if (ch === "\\" && i + 1 < text.length) {
|
|
124
|
+
out += text[i + 1];
|
|
125
|
+
i += 1;
|
|
126
|
+
} else if (ch === '"') {
|
|
127
|
+
inString = false;
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (ch === '"') {
|
|
132
|
+
inString = true;
|
|
133
|
+
out += ch;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (ch === "/" && text[i + 1] === "*") {
|
|
137
|
+
const end = text.indexOf("*/", i + 2);
|
|
138
|
+
if (end === -1) break;
|
|
139
|
+
i = end + 1;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (ch === "/" && text[i + 1] === "/") {
|
|
143
|
+
const end = text.indexOf("\n", i + 2);
|
|
144
|
+
if (end === -1) break;
|
|
145
|
+
i = end;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (ch === ",") {
|
|
149
|
+
let j = i + 1;
|
|
150
|
+
while (j < text.length && (text[j] === " " || text[j] === "\t" || text[j] === "\n" || text[j] === "\r")) j += 1;
|
|
151
|
+
if (text[j] === "}" || text[j] === "]") continue;
|
|
152
|
+
out += ch;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
out += ch;
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Redact a raw config-file text dump for display (COS-825). Parses JSON and
|
|
162
|
+
* walks it with `redactSensitive`, so nested credentials (e.g. replica peer
|
|
163
|
+
* tokens) get the same key/value rules the admin surfaces use. JSONC-style
|
|
164
|
+
* comments are stripped first (outside strings), so files humans edit by hand
|
|
165
|
+
* still take the structured path. Files that still do not parse keep their
|
|
166
|
+
* comment-stripped text under a conservative regex: every
|
|
167
|
+
* `"<sensitive-key>": "<value>"` pair at any depth has its value replaced
|
|
168
|
+
* with the redaction marker.
|
|
169
|
+
*/
|
|
170
|
+
export function redactConfigText(raw: string): string {
|
|
171
|
+
const withoutComments = stripJsonComments(raw);
|
|
172
|
+
try {
|
|
173
|
+
const parsed: unknown = JSON.parse(withoutComments);
|
|
174
|
+
return JSON.stringify(redactSensitive(parsed), null, 2);
|
|
175
|
+
} catch {
|
|
176
|
+
return redactFallbackPairs(withoutComments);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Last-resort redaction for text JSON.parse still refuses (real syntax
|
|
182
|
+
* errors): walk the text linearly, decode each property name
|
|
183
|
+
* (`"auth\u0054oken"` names `authToken`), and replace the whole string value
|
|
184
|
+
* of a sensitive property with the redaction marker. Unterminated string
|
|
185
|
+
* values under a sensitive property are cut at end of line. Non-string
|
|
186
|
+
* values stay visible: anything JSONC-tolerant already took the structured
|
|
187
|
+
* path above, so this only sees genuinely broken files. Scanner, not regex —
|
|
188
|
+
* the pair shape is unbounded and check:regex-safety rejects such patterns.
|
|
189
|
+
*/
|
|
190
|
+
function redactFallbackPairs(text: string): string {
|
|
191
|
+
const out: string[] = [];
|
|
192
|
+
const n = text.length;
|
|
193
|
+
let i = 0;
|
|
194
|
+
while (i < n) {
|
|
195
|
+
if (text[i] !== '"') {
|
|
196
|
+
out.push(text[i]);
|
|
197
|
+
i += 1;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const keyStart = i;
|
|
201
|
+
const keyEnd = scanJsonString(text, i);
|
|
202
|
+
if (keyEnd === -1) {
|
|
203
|
+
out.push(text.slice(i));
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
if (text[keyEnd] !== '"') {
|
|
207
|
+
// A raw CR/LF cut the key: the fragment cannot pair safely, and the
|
|
208
|
+
// following line's leading quote would open a phantom string that
|
|
209
|
+
// detaches later credentials from their pairs. Drop through the end of
|
|
210
|
+
// that line instead of exposing them.
|
|
211
|
+
const nl = text.indexOf("\n", keyEnd);
|
|
212
|
+
out.push(text.slice(i, keyEnd));
|
|
213
|
+
i = nl === -1 ? n : nl + 1;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
let k = skipJsonWhitespace(text, keyEnd + 1);
|
|
217
|
+
if (text[k] !== ":") {
|
|
218
|
+
// Orphan string (no colon follows): pairing in this broken text is not
|
|
219
|
+
// trustworthy, so suppress through the rest of the line instead of
|
|
220
|
+
// risking a later credential pairing past its key.
|
|
221
|
+
out.push(text.slice(i, keyEnd + 1));
|
|
222
|
+
const nl = text.indexOf("\n", keyEnd + 1);
|
|
223
|
+
i = nl === -1 ? n : nl + 1;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
k = skipJsonWhitespace(text, k + 1);
|
|
227
|
+
out.push(text.slice(i, k));
|
|
228
|
+
i = k;
|
|
229
|
+
const decodedKey = decodeJsonKeyName(text.slice(keyStart + 1, keyEnd));
|
|
230
|
+
if (text[i] !== '"') {
|
|
231
|
+
// Non-string value: `{` / `[` are transparent — pairs nested inside are
|
|
232
|
+
// processed by the main loop, so sensitive keys never hide under a
|
|
233
|
+
// non-sensitive parent. Scalars stop at the next quote so a missing
|
|
234
|
+
// comma never swallows a following property (old regex redacted those).
|
|
235
|
+
// Anything JSONC-tolerant already took the structured path above.
|
|
236
|
+
if (text[i] === "{" || text[i] === "[") {
|
|
237
|
+
out.push(text[i]);
|
|
238
|
+
i += 1;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const valueEnd = scanToValueEnd(text, i);
|
|
242
|
+
out.push(text.slice(i, valueEnd));
|
|
243
|
+
i = valueEnd;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const valueEnd = scanJsonString(text, i);
|
|
247
|
+
if (valueEnd === -1) {
|
|
248
|
+
// Unterminated at EOF under a sensitive key: nothing after is
|
|
249
|
+
// trustworthy, redact to end of input.
|
|
250
|
+
if (SENSITIVE_KEY_RE.test(decodedKey)) {
|
|
251
|
+
out.push(REDACTED);
|
|
252
|
+
i = n;
|
|
253
|
+
} else {
|
|
254
|
+
const stop = text.indexOf("\n", i);
|
|
255
|
+
const stopAt = stop === -1 ? n : stop + 1;
|
|
256
|
+
out.push(text.slice(i, stopAt));
|
|
257
|
+
i = stopAt;
|
|
258
|
+
}
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (SENSITIVE_KEY_RE.test(decodedKey)) {
|
|
262
|
+
out.push(REDACTED);
|
|
263
|
+
// A raw CR/LF ended the string: the credential spans a broken line and
|
|
264
|
+
// its real end is unknowable, so redact everything after it too.
|
|
265
|
+
if (text[valueEnd] !== '"') {
|
|
266
|
+
i = n;
|
|
267
|
+
} else {
|
|
268
|
+
i = valueEnd + 1;
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
out.push(text.slice(i, valueEnd + 1));
|
|
272
|
+
i = valueEnd + 1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return out.join("");
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Index just past the JSON string opening at `start`, or -1 if unterminated. Raw CR/LF terminate the scan (invalid JSON recovery). */
|
|
279
|
+
function scanJsonString(text: string, start: number): number {
|
|
280
|
+
let i = start + 1;
|
|
281
|
+
const n = text.length;
|
|
282
|
+
while (i < n) {
|
|
283
|
+
const ch = text[i];
|
|
284
|
+
if (ch === "\\") {
|
|
285
|
+
i += 2;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (ch === '"' || ch === "\n" || ch === "\r") return i;
|
|
289
|
+
i += 1;
|
|
290
|
+
}
|
|
291
|
+
return -1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function skipJsonWhitespace(text: string, start: number): number {
|
|
295
|
+
let i = start;
|
|
296
|
+
while (i < text.length && (text[i] === " " || text[i] === "\t" || text[i] === "\n" || text[i] === "\r")) i += 1;
|
|
297
|
+
return i;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function scanToValueEnd(text: string, start: number): number {
|
|
301
|
+
let i = start;
|
|
302
|
+
while (i < text.length && text[i] !== "," && text[i] !== "}" && text[i] !== "]" && text[i] !== "\n" && text[i] !== '"') i += 1;
|
|
303
|
+
return i;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function decodeJsonKeyName(rawKey: string): string {
|
|
307
|
+
try {
|
|
308
|
+
// SAFETY: JSON.parse of a double-quoted string literal always yields a
|
|
309
|
+
// string; malformed escapes throw and the raw key is used instead.
|
|
310
|
+
return JSON.parse(`"${rawKey}"`) as string;
|
|
311
|
+
} catch {
|
|
312
|
+
return rawKey;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
103
316
|
// ---------------------------------------------------------------------------
|
|
104
317
|
// Effective scope inspector
|
|
105
318
|
// ---------------------------------------------------------------------------
|