@veryfront/ext-content-mdx 0.1.1186 → 0.1.1189
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/esm/_dnt.polyfills.d.ts +6 -6
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/deno.d.ts +18 -0
- package/esm/deno.js +30 -9
- package/esm/src/config/defaults.d.ts +31 -24
- package/esm/src/config/defaults.d.ts.map +1 -1
- package/esm/src/config/defaults.js +25 -18
- package/esm/src/errors/diagnostic-policy.d.ts +35 -0
- package/esm/src/errors/diagnostic-policy.d.ts.map +1 -0
- package/esm/src/errors/diagnostic-policy.js +100 -0
- package/esm/src/errors/error-registry/boundary.d.ts +2 -0
- package/esm/src/errors/error-registry/boundary.d.ts.map +1 -1
- package/esm/src/errors/error-registry/boundary.js +8 -0
- package/esm/src/errors/error-registry/config.d.ts.map +1 -1
- package/esm/src/errors/error-registry/config.js +3 -3
- package/esm/src/errors/error-registry/deploy.js +1 -1
- package/esm/src/errors/error-registry/server.d.ts +2 -0
- package/esm/src/errors/error-registry/server.d.ts.map +1 -1
- package/esm/src/errors/error-registry/server.js +8 -0
- package/esm/src/errors/error-registry-helpers.d.ts +11 -2
- package/esm/src/errors/error-registry-helpers.d.ts.map +1 -1
- package/esm/src/errors/error-registry-helpers.js +70 -1
- package/esm/src/errors/error-registry.d.ts +85 -73
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/error-registry.js +2 -14
- package/esm/src/errors/types.d.ts +44 -5
- package/esm/src/errors/types.d.ts.map +1 -1
- package/esm/src/errors/types.js +148 -24
- package/esm/src/errors/veryfront-error.d.ts +25 -2
- package/esm/src/errors/veryfront-error.d.ts.map +1 -1
- package/esm/src/errors/veryfront-error.js +638 -28
- package/esm/src/observability/limits.d.ts +20 -0
- package/esm/src/observability/limits.d.ts.map +1 -0
- package/esm/src/observability/limits.js +19 -0
- package/esm/src/observability/telemetry-error.d.ts +22 -0
- package/esm/src/observability/telemetry-error.d.ts.map +1 -0
- package/esm/src/observability/telemetry-error.js +377 -0
- package/esm/src/observability/tracing/api-shim.d.ts +39 -0
- package/esm/src/observability/tracing/api-shim.d.ts.map +1 -1
- package/esm/src/observability/tracing/api-shim.js +196 -69
- package/esm/src/observability/tracing/context-callback.d.ts +14 -0
- package/esm/src/observability/tracing/context-callback.d.ts.map +1 -0
- package/esm/src/observability/tracing/context-callback.js +111 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
- package/esm/src/observability/tracing/otlp-setup.js +190 -46
- package/esm/src/platform/adapters/base.d.ts +51 -7
- package/esm/src/platform/adapters/base.d.ts.map +1 -1
- package/esm/src/platform/adapters/base.js +4 -2
- package/esm/src/platform/adapters/bounded-file-read.d.ts +9 -0
- package/esm/src/platform/adapters/bounded-file-read.d.ts.map +1 -1
- package/esm/src/platform/adapters/bounded-file-read.js +11 -5
- package/esm/src/platform/adapters/file-snapshot-error.d.ts +2 -0
- package/esm/src/platform/adapters/file-snapshot-error.d.ts.map +1 -1
- package/esm/src/platform/adapters/file-snapshot-error.js +2 -0
- package/esm/src/platform/adapters/file-system-capabilities.d.ts +74 -0
- package/esm/src/platform/adapters/file-system-capabilities.d.ts.map +1 -0
- package/esm/src/platform/adapters/file-system-capabilities.js +508 -0
- package/esm/src/platform/adapters/native-file-system-provenance.d.ts +6 -0
- package/esm/src/platform/adapters/native-file-system-provenance.d.ts.map +1 -0
- package/esm/src/platform/adapters/native-file-system-provenance.js +15 -0
- package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts +45 -0
- package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.js +291 -0
- package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts +71 -0
- package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.js +471 -0
- package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts +16 -0
- package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts.map +1 -0
- package/esm/src/platform/adapters/runtime/shared/shared-watcher.js +140 -0
- package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts +2 -0
- package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts.map +1 -0
- package/esm/src/platform/adapters/runtime/shared/temp-dir.js +10 -0
- package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts +5 -0
- package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts.map +1 -0
- package/esm/src/platform/adapters/runtime/shared/watcher-queue.js +75 -0
- package/esm/src/platform/compat/abort-signal.d.ts +20 -0
- package/esm/src/platform/compat/abort-signal.d.ts.map +1 -0
- package/esm/src/platform/compat/abort-signal.js +64 -0
- package/esm/src/platform/compat/constants.d.ts +2 -2
- package/esm/src/platform/compat/constants.d.ts.map +1 -1
- package/esm/src/platform/compat/constants.js +2 -2
- package/esm/src/platform/compat/error-introspection.d.ts +37 -0
- package/esm/src/platform/compat/error-introspection.d.ts.map +1 -0
- package/esm/src/platform/compat/error-introspection.js +258 -0
- package/esm/src/platform/compat/fs.d.ts +29 -8
- package/esm/src/platform/compat/fs.d.ts.map +1 -1
- package/esm/src/platform/compat/fs.js +123 -57
- package/esm/src/platform/compat/native-brand-checks.d.ts +14 -0
- package/esm/src/platform/compat/native-brand-checks.d.ts.map +1 -0
- package/esm/src/platform/compat/native-brand-checks.js +68 -0
- package/esm/src/platform/compat/not-found-error.d.ts +8 -3
- package/esm/src/platform/compat/not-found-error.d.ts.map +1 -1
- package/esm/src/platform/compat/not-found-error.js +164 -31
- package/esm/src/platform/compat/path/security.d.ts.map +1 -1
- package/esm/src/platform/compat/path/security.js +3 -5
- package/esm/src/platform/compat/process/command.d.ts +24 -1
- package/esm/src/platform/compat/process/command.d.ts.map +1 -1
- package/esm/src/platform/compat/process/command.js +393 -78
- package/esm/src/platform/compat/process/env.d.ts +11 -0
- package/esm/src/platform/compat/process/env.d.ts.map +1 -1
- package/esm/src/platform/compat/process/env.js +28 -38
- package/esm/src/platform/compat/process/global-error.d.ts +19 -0
- package/esm/src/platform/compat/process/global-error.d.ts.map +1 -0
- package/esm/src/platform/compat/process/global-error.js +57 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts +10 -3
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -1
- package/esm/src/platform/compat/process/lifecycle.js +74 -23
- package/esm/src/platform/compat/process/project-env-contract.d.ts +19 -0
- package/esm/src/platform/compat/process/project-env-contract.d.ts.map +1 -0
- package/esm/src/platform/compat/process/project-env-contract.js +19 -0
- package/esm/src/platform/compat/runtime.d.ts +14 -5
- package/esm/src/platform/compat/runtime.d.ts.map +1 -1
- package/esm/src/platform/compat/runtime.js +34 -9
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts +12 -0
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -1
- package/esm/src/platform/compat/std/front-matter-yaml.js +35 -3
- package/esm/src/platform/compat/temp-directory-prefix.d.ts +8 -0
- package/esm/src/platform/compat/temp-directory-prefix.d.ts.map +1 -0
- package/esm/src/platform/compat/temp-directory-prefix.js +15 -0
- package/esm/src/utils/abort.d.ts +10 -0
- package/esm/src/utils/abort.d.ts.map +1 -0
- package/esm/src/utils/abort.js +35 -0
- package/esm/src/utils/constants/build.d.ts +3 -0
- package/esm/src/utils/constants/build.d.ts.map +1 -1
- package/esm/src/utils/constants/build.js +5 -1
- package/esm/src/utils/constants/cache.d.ts +21 -0
- package/esm/src/utils/constants/cache.d.ts.map +1 -1
- package/esm/src/utils/constants/cache.js +101 -39
- package/esm/src/utils/constants/css.d.ts +20 -0
- package/esm/src/utils/constants/css.d.ts.map +1 -0
- package/esm/src/utils/constants/css.js +19 -0
- package/esm/src/utils/constants/limits.d.ts +4 -0
- package/esm/src/utils/constants/limits.d.ts.map +1 -1
- package/esm/src/utils/constants/limits.js +4 -0
- package/esm/src/utils/constants/project-identity.d.ts +5 -0
- package/esm/src/utils/constants/project-identity.d.ts.map +1 -0
- package/esm/src/utils/constants/project-identity.js +4 -0
- package/esm/src/utils/constants/retry.d.ts +18 -0
- package/esm/src/utils/constants/retry.d.ts.map +1 -1
- package/esm/src/utils/constants/retry.js +18 -0
- package/esm/src/utils/constants/security.d.ts +4 -0
- package/esm/src/utils/constants/security.d.ts.map +1 -1
- package/esm/src/utils/constants/security.js +4 -0
- package/esm/src/utils/index.d.ts +3 -1
- package/esm/src/utils/index.d.ts.map +1 -1
- package/esm/src/utils/index.js +3 -1
- package/esm/src/utils/logger/core.d.ts +5 -0
- package/esm/src/utils/logger/core.d.ts.map +1 -1
- package/esm/src/utils/logger/core.js +67 -2
- package/esm/src/utils/logger/redact.d.ts +36 -13
- package/esm/src/utils/logger/redact.d.ts.map +1 -1
- package/esm/src/utils/logger/redact.js +573 -83
- package/esm/src/utils/parallel.d.ts.map +1 -1
- package/esm/src/utils/parallel.js +11 -1
- package/esm/src/utils/project-identity.d.ts +11 -0
- package/esm/src/utils/project-identity.d.ts.map +1 -0
- package/esm/src/utils/project-identity.js +69 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +3 -3
- package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.d.ts +0 -33
- package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.d.ts.map +0 -1
- package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.js +0 -205
|
@@ -12,9 +12,13 @@
|
|
|
12
12
|
* - OTEL_EXPORTER_OTLP_HEADERS: Auth headers
|
|
13
13
|
**************************/
|
|
14
14
|
import { isTruthyEnvValue } from "../../utils/constants/env.js";
|
|
15
|
-
import {
|
|
15
|
+
import { MAX_SPAN_NAME_LENGTH } from "../../utils/constants/index.js";
|
|
16
|
+
import { __registerTraceContextGetter, serverLogger } from "../../utils/logger/logger.js";
|
|
17
|
+
import { sanitizeUrlForSpan } from "../../utils/logger/redact.js";
|
|
16
18
|
import { context as shimContext, defaultTextMapGetter, defaultTextMapSetter, getTracer, getTracerProviderRevision, propagation as shimPropagation, SpanKind, SpanStatusCode, trace as shimTrace, } from "./api-shim.js";
|
|
17
19
|
import { getHostTelemetryEnv } from "./telemetry-env.js";
|
|
20
|
+
import { sanitizeErrorForTelemetry, sanitizeTelemetryAttributes, sanitizeTelemetryAttributeValue, sanitizeTelemetryText, } from "../telemetry-error.js";
|
|
21
|
+
import { runAsyncWithContextFallback, runSyncWithContextFallback } from "./context-callback.js";
|
|
18
22
|
const logger = serverLogger.component("otel");
|
|
19
23
|
function parseHeaders(headerString) {
|
|
20
24
|
if (!headerString)
|
|
@@ -89,22 +93,123 @@ export async function initializeOTLPWithApis() {
|
|
|
89
93
|
// ---------------------------------------------------------------------------
|
|
90
94
|
// Span helpers — delegate to shim (which delegates to SDK if wired)
|
|
91
95
|
// ---------------------------------------------------------------------------
|
|
96
|
+
function reportTelemetryFailure(failureMessage, error) {
|
|
97
|
+
try {
|
|
98
|
+
logger.debug(failureMessage, error);
|
|
99
|
+
}
|
|
100
|
+
catch (_) {
|
|
101
|
+
/* expected: telemetry and logging failures must not affect application work */
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function runTelemetryOperation(operation, failureMessage) {
|
|
105
|
+
try {
|
|
106
|
+
operation();
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
reportTelemetryFailure(failureMessage, error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function createInertContext(entries = new Map()) {
|
|
113
|
+
const values = new Map(entries);
|
|
114
|
+
return Object.freeze({
|
|
115
|
+
getValue: (key) => values.get(key),
|
|
116
|
+
setValue(key, value) {
|
|
117
|
+
const next = new Map(values);
|
|
118
|
+
next.set(key, value);
|
|
119
|
+
return createInertContext(next);
|
|
120
|
+
},
|
|
121
|
+
deleteValue(key) {
|
|
122
|
+
const next = new Map(values);
|
|
123
|
+
next.delete(key);
|
|
124
|
+
return createInertContext(next);
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function createInertSpan() {
|
|
129
|
+
const spanContext = Object.freeze({
|
|
130
|
+
traceId: "00000000000000000000000000000000",
|
|
131
|
+
spanId: "0000000000000000",
|
|
132
|
+
traceFlags: 0,
|
|
133
|
+
});
|
|
134
|
+
const span = Object.freeze({
|
|
135
|
+
setAttribute: () => span,
|
|
136
|
+
setAttributes: () => span,
|
|
137
|
+
setStatus: () => span,
|
|
138
|
+
recordException: () => { },
|
|
139
|
+
addEvent: () => span,
|
|
140
|
+
end: () => { },
|
|
141
|
+
spanContext: () => spanContext,
|
|
142
|
+
updateName: () => { },
|
|
143
|
+
});
|
|
144
|
+
return span;
|
|
145
|
+
}
|
|
146
|
+
function isUsableSpan(value) {
|
|
147
|
+
if ((typeof value !== "object" && typeof value !== "function") || value === null)
|
|
148
|
+
return false;
|
|
149
|
+
try {
|
|
150
|
+
const candidate = value;
|
|
151
|
+
return typeof candidate.setAttribute === "function" &&
|
|
152
|
+
typeof candidate.setAttributes === "function" &&
|
|
153
|
+
typeof candidate.setStatus === "function" &&
|
|
154
|
+
typeof candidate.recordException === "function" &&
|
|
155
|
+
typeof candidate.addEvent === "function" &&
|
|
156
|
+
typeof candidate.end === "function" &&
|
|
157
|
+
typeof candidate.spanContext === "function" &&
|
|
158
|
+
typeof candidate.updateName === "function";
|
|
159
|
+
}
|
|
160
|
+
catch (_) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function getActiveContextSafely() {
|
|
165
|
+
try {
|
|
166
|
+
const activeContext = shimContext.active();
|
|
167
|
+
if (activeContext)
|
|
168
|
+
return activeContext;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
reportTelemetryFailure("Failed to read active tracing context", error);
|
|
172
|
+
}
|
|
173
|
+
return createInertContext();
|
|
174
|
+
}
|
|
175
|
+
function startSpanWithFallback(name, attributes, options) {
|
|
176
|
+
const parentContext = getActiveContextSafely();
|
|
177
|
+
let span = createInertSpan();
|
|
178
|
+
try {
|
|
179
|
+
const candidate = getTracingRuntime().tracer.startSpan(sanitizeTelemetryText(name, MAX_SPAN_NAME_LENGTH), {
|
|
180
|
+
kind: options?.kind ?? SpanKind.INTERNAL,
|
|
181
|
+
attributes: sanitizeTelemetryAttributes(attributes),
|
|
182
|
+
}, parentContext);
|
|
183
|
+
if (!isUsableSpan(candidate)) {
|
|
184
|
+
throw new TypeError("Tracer returned an invalid span");
|
|
185
|
+
}
|
|
186
|
+
span = candidate;
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
reportTelemetryFailure("Failed to start span; using inert span", error);
|
|
190
|
+
}
|
|
191
|
+
let spanContext = parentContext;
|
|
192
|
+
try {
|
|
193
|
+
spanContext = shimTrace.setSpan(parentContext, span);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
reportTelemetryFailure("Failed to associate span with context", error);
|
|
197
|
+
}
|
|
198
|
+
return { span, context: spanContext };
|
|
199
|
+
}
|
|
92
200
|
function setSpanErrorStatus(span, error) {
|
|
93
|
-
|
|
201
|
+
const telemetryError = sanitizeErrorForTelemetry(error);
|
|
202
|
+
runTelemetryOperation(() => span.setStatus({
|
|
94
203
|
code: SpanStatusCode.ERROR,
|
|
95
|
-
message:
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
span.recordException(error);
|
|
204
|
+
message: telemetryError.message,
|
|
205
|
+
}), "Failed to set span error status");
|
|
206
|
+
runTelemetryOperation(() => span.recordException(telemetryError), "Failed to record span exception");
|
|
99
207
|
}
|
|
100
208
|
/** Applies span. */
|
|
101
209
|
export async function withSpan(name, fn, attributes, options) {
|
|
102
|
-
const {
|
|
103
|
-
const parentContext = shimContext.active();
|
|
104
|
-
const span = tracer.startSpan(name, { kind: options?.kind ?? SpanKind.INTERNAL, attributes }, parentContext);
|
|
105
|
-
const spanContext = shimTrace.setSpan(parentContext, span);
|
|
210
|
+
const { span, context: spanContext } = startSpanWithFallback(name, attributes, options);
|
|
106
211
|
try {
|
|
107
|
-
const result = await shimContext.with(spanContext, () => fn(span));
|
|
212
|
+
const result = await runAsyncWithContextFallback((callback) => shimContext.with(spanContext, callback), () => fn(span), (error) => reportTelemetryFailure("Failed to activate span context", error));
|
|
108
213
|
return result;
|
|
109
214
|
}
|
|
110
215
|
catch (error) {
|
|
@@ -112,17 +217,15 @@ export async function withSpan(name, fn, attributes, options) {
|
|
|
112
217
|
throw error;
|
|
113
218
|
}
|
|
114
219
|
finally {
|
|
115
|
-
span.end();
|
|
220
|
+
runTelemetryOperation(() => span.end(), "Failed to end span");
|
|
116
221
|
}
|
|
117
222
|
}
|
|
118
223
|
/** Applies span sync. */
|
|
119
224
|
export function withSpanSync(name, fn, attributes, options) {
|
|
120
|
-
const {
|
|
121
|
-
const parentContext = shimContext.active();
|
|
122
|
-
const span = tracer.startSpan(name, { kind: options?.kind ?? SpanKind.INTERNAL, attributes }, parentContext);
|
|
225
|
+
const { span, context: spanContext } = startSpanWithFallback(name, attributes, options);
|
|
123
226
|
try {
|
|
124
|
-
const result = fn();
|
|
125
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
227
|
+
const result = runSyncWithContextFallback((callback) => shimContext.with(spanContext, callback), fn, (error) => reportTelemetryFailure("Failed to activate span context", error));
|
|
228
|
+
runTelemetryOperation(() => span.setStatus({ code: SpanStatusCode.OK }), "Failed to set span success status");
|
|
126
229
|
return result;
|
|
127
230
|
}
|
|
128
231
|
catch (error) {
|
|
@@ -130,73 +233,105 @@ export function withSpanSync(name, fn, attributes, options) {
|
|
|
130
233
|
throw error;
|
|
131
234
|
}
|
|
132
235
|
finally {
|
|
133
|
-
span.end();
|
|
236
|
+
runTelemetryOperation(() => span.end(), "Failed to end span");
|
|
134
237
|
}
|
|
135
238
|
}
|
|
136
239
|
/** Context for extract. */
|
|
137
240
|
export function extractContext(headers) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
241
|
+
try {
|
|
242
|
+
const carrier = {};
|
|
243
|
+
for (const [k, v] of headers)
|
|
244
|
+
carrier[k.toLowerCase()] = v;
|
|
245
|
+
return shimPropagation.extract(getActiveContextSafely(), carrier, defaultTextMapGetter);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
reportTelemetryFailure("Failed to extract tracing context", error);
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
142
251
|
}
|
|
143
252
|
/** Context for inject. */
|
|
144
253
|
export function injectContext(headers) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
254
|
+
try {
|
|
255
|
+
const carrier = {};
|
|
256
|
+
shimPropagation.inject(getActiveContextSafely(), carrier, defaultTextMapSetter);
|
|
257
|
+
for (const [k, v] of Object.entries(carrier))
|
|
258
|
+
headers.set(k, v);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
reportTelemetryFailure("Failed to inject tracing context", error);
|
|
262
|
+
}
|
|
149
263
|
}
|
|
150
264
|
/** Starts server span. */
|
|
151
265
|
export function startServerSpan(method, path, parentContext) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
266
|
+
let ctx;
|
|
267
|
+
let spanPath;
|
|
268
|
+
let span;
|
|
269
|
+
try {
|
|
270
|
+
ctx = (parentContext ?? getActiveContextSafely());
|
|
271
|
+
spanPath = sanitizeUrlForSpan(path);
|
|
272
|
+
const candidate = getTracingRuntime().tracer.startSpan(sanitizeTelemetryText(`${method} ${spanPath}`, MAX_SPAN_NAME_LENGTH), { kind: SpanKind.SERVER }, ctx);
|
|
273
|
+
if (!isUsableSpan(candidate))
|
|
274
|
+
throw new TypeError("Tracer returned an invalid server span");
|
|
275
|
+
span = candidate;
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
reportTelemetryFailure("Failed to start server span", error);
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
runTelemetryOperation(() => span.setAttribute("http.method", sanitizeTelemetryAttributeValue("http.method", method)), "Failed to set server span method");
|
|
282
|
+
runTelemetryOperation(() => span.setAttribute("http.target", sanitizeTelemetryAttributeValue("http.target", spanPath)), "Failed to set server span target");
|
|
283
|
+
let spanContext = ctx;
|
|
284
|
+
try {
|
|
285
|
+
spanContext = shimTrace.setSpan(ctx, span);
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
reportTelemetryFailure("Failed to associate server span with context", error);
|
|
289
|
+
}
|
|
290
|
+
return { span, context: spanContext };
|
|
158
291
|
}
|
|
159
292
|
/** End an active server tracing span. */
|
|
160
293
|
export function endServerSpan(span, statusCode, error) {
|
|
161
294
|
if (!span)
|
|
162
295
|
return;
|
|
163
296
|
const otelSpan = span;
|
|
164
|
-
otelSpan.setAttribute("http.status_code", statusCode);
|
|
297
|
+
runTelemetryOperation(() => otelSpan.setAttribute("http.status_code", statusCode), "Failed to set server span status code");
|
|
165
298
|
if (error) {
|
|
166
299
|
setSpanErrorStatus(otelSpan, error);
|
|
167
|
-
otelSpan.end();
|
|
300
|
+
runTelemetryOperation(() => otelSpan.end(), "Failed to end server span");
|
|
168
301
|
return;
|
|
169
302
|
}
|
|
170
303
|
if (statusCode >= 400) {
|
|
171
|
-
otelSpan.setStatus({ code: SpanStatusCode.ERROR });
|
|
172
|
-
otelSpan.end();
|
|
304
|
+
runTelemetryOperation(() => otelSpan.setStatus({ code: SpanStatusCode.ERROR }), "Failed to set server span error status");
|
|
305
|
+
runTelemetryOperation(() => otelSpan.end(), "Failed to end server span");
|
|
173
306
|
return;
|
|
174
307
|
}
|
|
175
|
-
otelSpan.setStatus({ code: SpanStatusCode.OK });
|
|
176
|
-
otelSpan.end();
|
|
308
|
+
runTelemetryOperation(() => otelSpan.setStatus({ code: SpanStatusCode.OK }), "Failed to set server span success status");
|
|
309
|
+
runTelemetryOperation(() => otelSpan.end(), "Failed to end server span");
|
|
177
310
|
}
|
|
178
311
|
/** Sets span attributes. */
|
|
179
312
|
export function setSpanAttributes(span, attributes) {
|
|
180
313
|
if (!span)
|
|
181
314
|
return;
|
|
182
315
|
const otelSpan = span;
|
|
183
|
-
for (const [key, value] of Object.entries(attributes))
|
|
184
|
-
otelSpan.setAttribute(key, value);
|
|
316
|
+
for (const [key, value] of Object.entries(sanitizeTelemetryAttributes(attributes))) {
|
|
317
|
+
runTelemetryOperation(() => otelSpan.setAttribute(key, value), "Failed to set span attribute");
|
|
318
|
+
}
|
|
185
319
|
}
|
|
186
320
|
/** Adds an event to a span. */
|
|
187
321
|
export function addSpanEvent(span, name, attributes) {
|
|
188
322
|
if (!span)
|
|
189
323
|
return;
|
|
190
324
|
const otelSpan = span;
|
|
191
|
-
otelSpan.addEvent(name, attributes);
|
|
325
|
+
runTelemetryOperation(() => otelSpan.addEvent(sanitizeTelemetryText(name, MAX_SPAN_NAME_LENGTH), sanitizeTelemetryAttributes(attributes)), "Failed to add span event");
|
|
192
326
|
}
|
|
193
327
|
/** Sets active span attributes. */
|
|
194
328
|
export function setActiveSpanAttributes(attributes) {
|
|
195
329
|
const span = shimTrace.getActiveSpan?.();
|
|
196
330
|
if (!span)
|
|
197
331
|
return;
|
|
198
|
-
for (const [key, value] of Object.entries(attributes))
|
|
199
|
-
span.setAttribute(key, value);
|
|
332
|
+
for (const [key, value] of Object.entries(sanitizeTelemetryAttributes(attributes))) {
|
|
333
|
+
runTelemetryOperation(() => span.setAttribute(key, value), "Failed to set active span attribute");
|
|
334
|
+
}
|
|
200
335
|
}
|
|
201
336
|
/** Marks the active span as failed. */
|
|
202
337
|
export function setActiveSpanErrorStatus(error) {
|
|
@@ -207,13 +342,22 @@ export function setActiveSpanErrorStatus(error) {
|
|
|
207
342
|
}
|
|
208
343
|
/** Context for with. */
|
|
209
344
|
export async function withContext(spanContext, fn) {
|
|
210
|
-
return shimContext.with(spanContext, fn);
|
|
345
|
+
return await runAsyncWithContextFallback((callback) => shimContext.with(spanContext, callback), fn, (error) => logger.debug("Failed to activate explicit span context", error));
|
|
211
346
|
}
|
|
212
347
|
/** Context for get trace. */
|
|
213
348
|
export function getTraceContext() {
|
|
214
349
|
const span = shimTrace.getActiveSpan?.();
|
|
215
350
|
if (!span)
|
|
216
351
|
return {};
|
|
217
|
-
|
|
218
|
-
|
|
352
|
+
try {
|
|
353
|
+
const ctx = span.spanContext();
|
|
354
|
+
return { traceId: ctx.traceId, spanId: ctx.spanId };
|
|
355
|
+
}
|
|
356
|
+
catch (_) {
|
|
357
|
+
return {};
|
|
358
|
+
}
|
|
219
359
|
}
|
|
360
|
+
// The higher observability layer owns this adapter registration. Keeping the
|
|
361
|
+
// dependency direction here prevents generic logging utilities from importing
|
|
362
|
+
// OpenTelemetry implementation code.
|
|
363
|
+
__registerTraceContextGetter(getTraceContext);
|
|
@@ -122,23 +122,58 @@ export interface Server {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
export interface FileSystemAdapter {
|
|
125
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Explicitly declares that paths in this adapter cannot traverse symbolic
|
|
127
|
+
* links. The backing store may reject links or expose them only as inert
|
|
128
|
+
* entries, but it must never resolve a path through one. Native/local
|
|
129
|
+
* adapters must omit this marker and provide lstat and realPath instead.
|
|
130
|
+
*/
|
|
126
131
|
readonly symlinkSemantics?: "none";
|
|
132
|
+
/** Adapter is immutably bound to one project and needs no request scope. */
|
|
133
|
+
readonly projectContextSemantics?: "fixed";
|
|
127
134
|
readFile(path: string): Promise<string>;
|
|
128
135
|
/** Read raw bytes when binary-safe access is required */
|
|
129
136
|
readFileBytes?(path: string): Promise<Uint8Array>;
|
|
130
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* Fixed whole-object ceiling enforced by the backing store or transport
|
|
139
|
+
* before a complete response can be materialized.
|
|
140
|
+
*
|
|
141
|
+
* This capability is distinct from `readFileBytesBounded`: the caller does
|
|
142
|
+
* not choose the read size, and the implementation may materialize up to
|
|
143
|
+
* this advertised ceiling even for a smaller file. It may be advertised
|
|
144
|
+
* only alongside `readFileBytes` and only when the upstream boundary itself
|
|
145
|
+
* rejects larger objects before returning them.
|
|
146
|
+
*/
|
|
131
147
|
readonly maxWholeFileReadBytes?: number;
|
|
132
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Read a prefix without materializing more than `byteLimit` bytes.
|
|
150
|
+
*
|
|
151
|
+
* Implementations must enforce the limit while reading from their backing
|
|
152
|
+
* store and continue until EOF or `byteLimit`; reading the complete object
|
|
153
|
+
* and slicing afterward does not satisfy this capability. Callers can
|
|
154
|
+
* request their accepted maximum plus one byte to distinguish an exact-size
|
|
155
|
+
* file from an oversized file. Non-native adapters used for bounded Skill
|
|
156
|
+
* discovery or strict Skill runtime reads must implement this capability.
|
|
157
|
+
*/
|
|
133
158
|
readFileBytesBounded?(path: string, byteLimit: number): Promise<Uint8Array>;
|
|
134
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Read the complete file only when it is no larger than `byteLimit`.
|
|
161
|
+
*
|
|
162
|
+
* Implementations must enforce the limit while reading and reject when the
|
|
163
|
+
* source has even one additional byte. They must not implement this by
|
|
164
|
+
* materializing the whole object or by retaining a `byteLimit + 1` prefix.
|
|
165
|
+
* Oversized sources reject with `RangeError`; other I/O failures propagate.
|
|
166
|
+
*/
|
|
135
167
|
readFileBytesWithinLimit?(path: string, byteLimit: number): Promise<Uint8Array>;
|
|
136
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* Read one stable file snapshot beneath `containmentRoot` without following
|
|
170
|
+
* links and only when its complete contents fit within `byteLimit`.
|
|
171
|
+
*/
|
|
137
172
|
readFileSnapshotWithinLimit?(path: string, containmentRoot: string, byteLimit: number): Promise<Uint8Array>;
|
|
138
173
|
writeFile(path: string, content: string): Promise<void>;
|
|
139
174
|
/** Write raw bytes when binary-safe output is required. */
|
|
140
175
|
writeFileBytes?(path: string, content: Uint8Array): Promise<void>;
|
|
141
|
-
/** Create a new file
|
|
176
|
+
/** Create a new byte file without replacing an existing path. */
|
|
142
177
|
createFileBytesExclusive?(path: string, content: Uint8Array): Promise<void>;
|
|
143
178
|
/** Atomically replace a path when the runtime supports same-filesystem rename. */
|
|
144
179
|
rename?(from: string, to: string): Promise<void>;
|
|
@@ -184,7 +219,9 @@ export interface FileSystemAdapter {
|
|
|
184
219
|
*/
|
|
185
220
|
getSourceSnapshotVersion?(): number | undefined | Promise<number | undefined>;
|
|
186
221
|
}
|
|
222
|
+
/** A filesystem adapter that advertises genuine bounded byte reads. */
|
|
187
223
|
export type BoundedFileSystemAdapter = FileSystemAdapter & Required<Pick<FileSystemAdapter, "readFileBytesBounded">>;
|
|
224
|
+
/** A filesystem adapter that can return only complete, size-admitted files. */
|
|
188
225
|
export type ExactBoundedFileSystemAdapter = FileSystemAdapter & Required<Pick<FileSystemAdapter, "readFileBytesWithinLimit">>;
|
|
189
226
|
export interface ResolveFileOptions {
|
|
190
227
|
allowPagesPrefix?: boolean;
|
|
@@ -218,11 +255,18 @@ export interface FileChangeEvent {
|
|
|
218
255
|
}
|
|
219
256
|
export interface FileWatcher extends AsyncIterable<FileChangeEvent> {
|
|
220
257
|
close(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Resolves once the underlying watcher has been installed and can observe
|
|
260
|
+
* subsequent filesystem changes. Rejects when any requested watch root
|
|
261
|
+
* cannot be acquired; callers must not advertise watching before it resolves.
|
|
262
|
+
*/
|
|
263
|
+
ready?: Promise<void>;
|
|
221
264
|
/**
|
|
222
265
|
* Resolves once the watcher's internal loop has fully stopped, including
|
|
223
266
|
* any in-flight filesystem operations. close() only signals shutdown;
|
|
224
267
|
* await this to guarantee no pending async ops remain (e.g. before test
|
|
225
|
-
* sanitizer checks or process exit).
|
|
268
|
+
* sanitizer checks or process exit). Rejects when the native watcher fails
|
|
269
|
+
* or teardown cannot complete cleanly.
|
|
226
270
|
*/
|
|
227
271
|
done?: Promise<void>;
|
|
228
272
|
}
|
|
@@ -1 +1 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CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACtE"}
|
|
@@ -52,8 +52,10 @@ export function isWebSocketUpgradeResponse(value) {
|
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
try {
|
|
55
|
-
//
|
|
56
|
-
//
|
|
55
|
+
// A structural object with a `get()` method is not a Headers instance and
|
|
56
|
+
// can run arbitrary code when the transport clones it. Invoke a captured
|
|
57
|
+
// Web IDL primordial to verify the native internal slot without consulting
|
|
58
|
+
// attacker-controlled properties or Symbol.hasInstance hooks.
|
|
57
59
|
Reflect.apply(headersGet, headers.value, ["upgrade"]);
|
|
58
60
|
}
|
|
59
61
|
catch {
|
|
@@ -10,6 +10,15 @@ export interface BoundedFileReader {
|
|
|
10
10
|
export interface BoundedFileReadHandle extends BoundedFileReader {
|
|
11
11
|
close(): void | Promise<void>;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Run one operation against one opened file handle, then close it exactly once.
|
|
15
|
+
*
|
|
16
|
+
* When the operation and cleanup both fail, the aggregate retains the primary
|
|
17
|
+
* operation failure first and the cleanup failure second.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withFileHandle<THandle extends {
|
|
20
|
+
close(): void | Promise<void>;
|
|
21
|
+
}, TResult>(openHandle: () => Promise<THandle>, operation: (handle: THandle) => Promise<TResult>, aggregateFailureMessage: string): Promise<TResult>;
|
|
13
22
|
export declare function requireBoundedFileReadLimit(byteLimit: unknown): number;
|
|
14
23
|
/**
|
|
15
24
|
* Read at most `byteLimit` bytes without first materializing the whole file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounded-file-read.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/bounded-file-read.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"bounded-file-read.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/bounded-file-read.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAwED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,SAAS;IAAE,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,EACjD,OAAO,EAEP,UAAU,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAClC,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,EAChD,uBAAuB,EAAE,MAAM,GAC9B,OAAO,CAAC,OAAO,CAAC,CA0BlB;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAKtE;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,EAChD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,EAChD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED,sFAAsF;AACtF,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC,CAoDrB;AAED,wFAAwF;AACxF,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC,CAuBrB"}
|
|
@@ -49,13 +49,19 @@ function viewBytes(value, start, byteLength) {
|
|
|
49
49
|
// allocation when the source is small. The aggregate returned data remains
|
|
50
50
|
// bounded by the caller's limit.
|
|
51
51
|
const BOUNDED_FILE_READ_CHUNK_BYTES = 64 * 1024;
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Run one operation against one opened file handle, then close it exactly once.
|
|
54
|
+
*
|
|
55
|
+
* When the operation and cleanup both fail, the aggregate retains the primary
|
|
56
|
+
* operation failure first and the cleanup failure second.
|
|
57
|
+
*/
|
|
58
|
+
export async function withFileHandle(openHandle, operation, aggregateFailureMessage) {
|
|
53
59
|
const handle = await openHandle();
|
|
54
60
|
let result;
|
|
55
61
|
let primaryFailure;
|
|
56
62
|
let primaryFailed = false;
|
|
57
63
|
try {
|
|
58
|
-
result = await
|
|
64
|
+
result = await operation(handle);
|
|
59
65
|
}
|
|
60
66
|
catch (error) {
|
|
61
67
|
primaryFailed = true;
|
|
@@ -66,7 +72,7 @@ async function readAndCloseHandle(openHandle, read) {
|
|
|
66
72
|
}
|
|
67
73
|
catch (cleanupFailure) {
|
|
68
74
|
if (primaryFailed) {
|
|
69
|
-
throw new AggregateError([primaryFailure, cleanupFailure],
|
|
75
|
+
throw new AggregateError([primaryFailure, cleanupFailure], aggregateFailureMessage);
|
|
70
76
|
}
|
|
71
77
|
throw cleanupFailure;
|
|
72
78
|
}
|
|
@@ -89,7 +95,7 @@ export function requireBoundedFileReadLimit(byteLimit) {
|
|
|
89
95
|
*/
|
|
90
96
|
export async function readBoundedFilePrefix(openHandle, byteLimit) {
|
|
91
97
|
const boundedLimit = requireBoundedFileReadLimit(byteLimit);
|
|
92
|
-
return await
|
|
98
|
+
return await withFileHandle(openHandle, (handle) => readBoundedFileHandlePrefix(handle, boundedLimit), "Filesystem read and handle cleanup both failed");
|
|
93
99
|
}
|
|
94
100
|
/**
|
|
95
101
|
* Read the complete file only when it fits within `byteLimit`.
|
|
@@ -100,7 +106,7 @@ export async function readBoundedFilePrefix(openHandle, byteLimit) {
|
|
|
100
106
|
*/
|
|
101
107
|
export async function readFileWithinLimit(openHandle, byteLimit) {
|
|
102
108
|
const boundedLimit = requireBoundedFileReadLimit(byteLimit);
|
|
103
|
-
return await
|
|
109
|
+
return await withFileHandle(openHandle, (handle) => readFileHandleWithinLimit(handle, boundedLimit), "Filesystem read and handle cleanup both failed");
|
|
104
110
|
}
|
|
105
111
|
/** Read a bounded prefix while leaving ownership of the open handle to the caller. */
|
|
106
112
|
export async function readBoundedFileHandlePrefix(reader, byteLimit) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/** Error raised when a file changes while a stable snapshot is being read. */
|
|
1
2
|
export declare class FileSnapshotChangedError extends Error {
|
|
2
3
|
readonly name = "FileSnapshotChangedError";
|
|
3
4
|
constructor(message?: string);
|
|
4
5
|
}
|
|
6
|
+
/** Return whether a value is a framework-created file snapshot change error. */
|
|
5
7
|
export declare function isFileSnapshotChangedError(value: unknown): value is FileSnapshotChangedError;
|
|
6
8
|
//# sourceMappingURL=file-snapshot-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-snapshot-error.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/file-snapshot-error.ts"],"names":[],"mappings":"AAEA,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,IAAI,8BAA8B;gBAExC,OAAO,SAA0C;CAI9D;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAEnC"}
|
|
1
|
+
{"version":3,"file":"file-snapshot-error.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/file-snapshot-error.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,IAAI,8BAA8B;gBAExC,OAAO,SAA0C;CAI9D;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAEnC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const changedErrors = new WeakSet();
|
|
2
|
+
/** Error raised when a file changes while a stable snapshot is being read. */
|
|
2
3
|
export class FileSnapshotChangedError extends Error {
|
|
3
4
|
name = "FileSnapshotChangedError";
|
|
4
5
|
constructor(message = "File snapshot changed during the read") {
|
|
@@ -6,6 +7,7 @@ export class FileSnapshotChangedError extends Error {
|
|
|
6
7
|
changedErrors.add(this);
|
|
7
8
|
}
|
|
8
9
|
}
|
|
10
|
+
/** Return whether a value is a framework-created file snapshot change error. */
|
|
9
11
|
export function isFileSnapshotChangedError(value) {
|
|
10
12
|
return typeof value === "object" && value !== null && changedErrors.has(value);
|
|
11
13
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
type ByteReader = (path: string) => Promise<Uint8Array>;
|
|
2
|
+
type BoundedByteReader = (path: string, byteLimit: number) => Promise<Uint8Array>;
|
|
3
|
+
type ByteWriter = (path: string, content: Uint8Array) => Promise<void>;
|
|
4
|
+
export interface CapturedWholeFileReader {
|
|
5
|
+
readonly maximumBytes: number;
|
|
6
|
+
readonly read: ByteReader;
|
|
7
|
+
}
|
|
8
|
+
export interface CapturedFileSystemCapabilities {
|
|
9
|
+
readonly readFileBytes?: ByteReader;
|
|
10
|
+
readonly readFileBytesBounded?: BoundedByteReader;
|
|
11
|
+
readonly readFileBytesWithinLimit?: BoundedByteReader;
|
|
12
|
+
readonly writeFileBytes?: ByteWriter;
|
|
13
|
+
readonly wholeFileReader?: CapturedWholeFileReader;
|
|
14
|
+
}
|
|
15
|
+
/** Compatibility view used by existing filesystem wrappers and adapters. */
|
|
16
|
+
export interface CapturedByteReaders {
|
|
17
|
+
readonly unbounded?: ByteReader;
|
|
18
|
+
readonly whole?: CapturedWholeFileReader;
|
|
19
|
+
readonly prefix?: BoundedByteReader;
|
|
20
|
+
readonly exact?: BoundedByteReader;
|
|
21
|
+
}
|
|
22
|
+
export interface CapturedSnapshotReader {
|
|
23
|
+
read(path: string, containmentRoot: string, byteLimit: number): Promise<Uint8Array>;
|
|
24
|
+
}
|
|
25
|
+
export interface CapturedExclusiveCreator {
|
|
26
|
+
create(path: string, content: Uint8Array): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface CapturedStaticReaders {
|
|
29
|
+
snapshot?: CapturedSnapshotReader;
|
|
30
|
+
virtual?: {
|
|
31
|
+
generation(): Promise<number>;
|
|
32
|
+
exact?: (path: string, byteLimit: number) => Promise<Uint8Array>;
|
|
33
|
+
whole?: {
|
|
34
|
+
maximumBytes: number;
|
|
35
|
+
read(path: string): Promise<Uint8Array>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Admit an untrusted byte result before copying it into an immutable-size,
|
|
41
|
+
* tightly allocated ArrayBuffer. The maximum is checked from the intrinsic
|
|
42
|
+
* Uint8Array byte length before allocating the defensive copy.
|
|
43
|
+
*/
|
|
44
|
+
export declare function copyFixedUint8ArrayWithinLimit(value: unknown, maximumBytes: number, label: string): Uint8Array;
|
|
45
|
+
/**
|
|
46
|
+
* Extract the ArrayBuffer from an admitted tight fixed Uint8Array without
|
|
47
|
+
* consulting mutable global constructors or configurable typed-array getters.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getFixedUint8ArrayBuffer(value: unknown, label: string): ArrayBuffer;
|
|
50
|
+
/** Read the intrinsic byte length only after verifying a tight fixed buffer. */
|
|
51
|
+
export declare function getFixedUint8ArrayByteLength(value: unknown, label: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Preserve the broad legacy capture temporarily for its scheduled consumers.
|
|
54
|
+
* Bounded text passes the narrow purpose so writer and prefix fields are never
|
|
55
|
+
* inspected.
|
|
56
|
+
*/
|
|
57
|
+
export declare function captureFileSystemCapabilities(value: unknown, label?: string, purpose?: "legacy" | "bounded-text" | "byte-read"): CapturedFileSystemCapabilities;
|
|
58
|
+
/**
|
|
59
|
+
* Capture the established byte-reader surface while defensively admitting
|
|
60
|
+
* every result. New purpose-specific code should prefer the narrower capture
|
|
61
|
+
* functions above.
|
|
62
|
+
*/
|
|
63
|
+
export declare function captureByteReadCapabilities(value: unknown, label?: string): CapturedByteReaders;
|
|
64
|
+
/**
|
|
65
|
+
* Capture legacy byte capabilities after genuine snapshot authority has been
|
|
66
|
+
* proven independently. Malformed optional fields are omitted one at a time;
|
|
67
|
+
* unsafe object or prototype provenance still rejects the adapter.
|
|
68
|
+
*/
|
|
69
|
+
export declare function captureLegacyFileSystemCapabilitiesForSnapshot(value: unknown, label?: string): CapturedFileSystemCapabilities;
|
|
70
|
+
export declare function captureSnapshotReadCapability(value: unknown, label?: string, allowExplicitUndefined?: boolean): CapturedSnapshotReader | undefined;
|
|
71
|
+
export declare function captureExclusiveCreateCapability(value: unknown, label?: string): CapturedExclusiveCreator | undefined;
|
|
72
|
+
export declare function captureStaticReadCapabilities(value: unknown, label?: string): CapturedStaticReaders;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=file-system-capabilities.d.ts.map
|