stitchkit 0.91.2 → 0.93.0
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/CHANGELOG.md +137 -0
- package/dist/agent-runtime-coding-tools.js +3 -3
- package/dist/agent-runtime-harness.js +5 -5
- package/dist/agent-runtime-sandbox.js +3 -3
- package/dist/agent-runtime.js +8 -8
- package/dist/cli.d.ts +6 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +377 -49
- package/dist/contract/define.d.ts +84 -2
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/{index-a2nzz56k.js → index-2c2bjw3s.js} +3 -3
- package/dist/{index-seyy8dvn.js → index-3bmnp41g.js} +245 -116
- package/dist/{index-axvavfr4.js → index-bx75zwt7.js} +3 -3
- package/dist/{index-709nh7z7.js → index-cxqhvq21.js} +2 -1
- package/dist/{index-pena034b.js → index-e42wzzz5.js} +3 -3
- package/dist/{index-qjeyx5t2.js → index-fq77yfzc.js} +1 -1
- package/dist/{index-fenaekmk.js → index-h9etkkyk.js} +37 -27
- package/dist/{index-4x809vqd.js → index-mzvgxp0n.js} +2 -2
- package/dist/{index-jpfqfg5c.js → index-n0f51dfn.js} +2 -2
- package/dist/{index-bv7mytab.js → index-sr93cwf9.js} +1 -1
- package/dist/{index-vsbzgd7b.js → index-tmwcrptx.js} +1 -0
- package/dist/{index-8z9we758.js → index-vjpvjqpn.js} +1 -1
- package/dist/{index-7hz88dy8.js → index-vk3kq9sb.js} +1 -1
- package/dist/{index-s3dssqxp.js → index-yn8remb1.js} +60 -56
- package/dist/internal/atomic-file.d.ts +21 -0
- package/dist/internal/atomic-file.d.ts.map +1 -0
- package/dist/internal/secure-fetch.d.ts +12 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/node.js +3 -3
- package/dist/observability/audit.d.ts +5 -1
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/changes.d.ts.map +1 -1
- package/dist/observability/context.d.ts +27 -6
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/event.d.ts +34 -6
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/observability/index.d.ts +2 -1
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +50 -6
- package/dist/observability/work.d.ts +55 -0
- package/dist/observability/work.d.ts.map +1 -0
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/index.js +4 -4
- package/dist/server/types.d.ts +20 -6
- package/dist/server/types.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +34 -1
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +31 -9
- package/dist/tool-invoker.js +5 -5
- package/dist/tools/cli-checkpoint.d.ts +24 -0
- package/dist/tools/cli-checkpoint.d.ts.map +1 -0
- package/dist/tools/cli-command.d.ts +18 -0
- package/dist/tools/cli-command.d.ts.map +1 -1
- package/dist/tools/cli-format.d.ts +10 -0
- package/dist/tools/cli-format.d.ts.map +1 -1
- package/dist/tools/cli-invoke.d.ts +143 -0
- package/dist/tools/cli-invoke.d.ts.map +1 -0
- package/dist/tools/cli-manifest.d.ts +6 -9
- package/dist/tools/cli-manifest.d.ts.map +1 -1
- package/dist/tools/cli-signature.d.ts +81 -0
- package/dist/tools/cli-signature.d.ts.map +1 -0
- package/dist/tools/cli-stream.d.ts +93 -0
- package/dist/tools/cli-stream.d.ts.map +1 -0
- package/dist/tools/cli-update.d.ts +62 -0
- package/dist/tools/cli-update.d.ts.map +1 -1
- package/dist/tools/cli.d.ts +4 -16
- package/dist/tools/cli.d.ts.map +1 -1
- package/dist/tools/connections/index.js +2 -2
- package/dist/tools/execute.d.ts +21 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/mcp-progress.d.ts +46 -0
- package/dist/tools/mcp-progress.d.ts.map +1 -0
- package/dist/tools/mcp-round-policy.d.ts +25 -1
- package/dist/tools/mcp-round-policy.d.ts.map +1 -1
- package/dist/tools/mcp-round.d.ts +20 -1
- package/dist/tools/mcp-round.d.ts.map +1 -1
- package/dist/tools/mcp-trace.d.ts +9 -1
- package/dist/tools/mcp-trace.d.ts.map +1 -1
- package/dist/tools/mount-wait.d.ts.map +1 -1
- package/dist/tools.js +159 -50
- package/llms-full.txt +449 -8
- package/package.json +1 -1
|
@@ -600,6 +600,42 @@ function mergeSchemas(paramsSchema, inputSchema) {
|
|
|
600
600
|
return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
+
// src/tools/mcp-round-policy.ts
|
|
604
|
+
function staticInputRounds(policy) {
|
|
605
|
+
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
606
|
+
}
|
|
607
|
+
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
608
|
+
if (!runtime?.stateConfigured) {
|
|
609
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
610
|
+
}
|
|
611
|
+
const { maxRounds } = runtime;
|
|
612
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
613
|
+
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
614
|
+
}
|
|
615
|
+
const declared = staticInputRounds(policy);
|
|
616
|
+
if (!declared)
|
|
617
|
+
return;
|
|
618
|
+
if (declared.length === 0) {
|
|
619
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
620
|
+
}
|
|
621
|
+
assertRoundShape(tool, declared, maxRounds);
|
|
622
|
+
}
|
|
623
|
+
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
624
|
+
assertRoundShape(tool, resolved, maxRounds);
|
|
625
|
+
}
|
|
626
|
+
function assertRoundShape(tool, rounds, maxRounds) {
|
|
627
|
+
if (rounds.length > maxRounds) {
|
|
628
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
629
|
+
}
|
|
630
|
+
const keys = new Set;
|
|
631
|
+
for (const request of rounds) {
|
|
632
|
+
if (keys.has(request.key)) {
|
|
633
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
634
|
+
}
|
|
635
|
+
keys.add(request.key);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
603
639
|
// src/tools/names.ts
|
|
604
640
|
var SINGULAR_EXCEPTIONS = new Set([
|
|
605
641
|
"analytics",
|
|
@@ -868,32 +904,6 @@ function presentationMetadata(schema) {
|
|
|
868
904
|
|
|
869
905
|
// src/tools/internal/surface-projector.ts
|
|
870
906
|
import { z as z3 } from "zod";
|
|
871
|
-
|
|
872
|
-
// src/tools/mcp-round-policy.ts
|
|
873
|
-
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
874
|
-
if (!runtime?.stateConfigured) {
|
|
875
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
876
|
-
}
|
|
877
|
-
const { maxRounds } = runtime;
|
|
878
|
-
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
879
|
-
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
880
|
-
}
|
|
881
|
-
if (policy.inputRequired.length === 0) {
|
|
882
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
883
|
-
}
|
|
884
|
-
if (policy.inputRequired.length > maxRounds) {
|
|
885
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${policy.inputRequired.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
886
|
-
}
|
|
887
|
-
const keys = new Set;
|
|
888
|
-
for (const request of policy.inputRequired) {
|
|
889
|
-
if (keys.has(request.key)) {
|
|
890
|
-
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
891
|
-
}
|
|
892
|
-
keys.add(request.key);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// src/tools/internal/surface-projector.ts
|
|
897
907
|
function assertToolExtensionCompatible(base, extra) {
|
|
898
908
|
if (!(base instanceof z3.ZodObject))
|
|
899
909
|
return;
|
|
@@ -1113,4 +1123,4 @@ function prepareProjectedMcpTools(tools, config = {}) {
|
|
|
1113
1123
|
return prepared;
|
|
1114
1124
|
}
|
|
1115
1125
|
|
|
1116
|
-
export { objectShapeKeys, rebuildObject, mergeSchemas, validateMcpRoundPolicy, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, declaresDraft07, withDefsDialect, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
|
|
1126
|
+
export { objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, flattenToolJsonSchema, declaresDraft07, withDefsDialect, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executeToolMethod,
|
|
3
3
|
toolErrorFromResult
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-yn8remb1.js";
|
|
5
5
|
import {
|
|
6
6
|
assertToolExtensionCompatible,
|
|
7
7
|
mergeSchemas,
|
|
8
8
|
projectToolSurface,
|
|
9
9
|
rebuildObject
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-h9etkkyk.js";
|
|
11
11
|
import {
|
|
12
12
|
isRetryableStatus
|
|
13
13
|
} from "./index-2vtcmrj9.js";
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
isOriginAllowed,
|
|
23
23
|
mediaTypeEssence,
|
|
24
24
|
reportSignalError
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-cxqhvq21.js";
|
|
26
26
|
import {
|
|
27
27
|
getRequestContext,
|
|
28
28
|
runWithRequestContext,
|
|
29
29
|
setRequestEndpoint,
|
|
30
30
|
setRequestError
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-tmwcrptx.js";
|
|
32
32
|
import {
|
|
33
33
|
extractIp,
|
|
34
34
|
getClientInfo,
|
|
@@ -69,6 +69,7 @@ function wrapInRequestContext(handler, options = {}) {
|
|
|
69
69
|
const ctx = {
|
|
70
70
|
trace: resolveTraceContext(req),
|
|
71
71
|
source: "http",
|
|
72
|
+
kind: "request",
|
|
72
73
|
method: req.method,
|
|
73
74
|
path: new URL(req.url, "http://localhost").pathname,
|
|
74
75
|
startedAt: process.hrtime.bigint(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRequestContext,
|
|
3
3
|
runWithRequestContext
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-tmwcrptx.js";
|
|
5
5
|
import {
|
|
6
6
|
formatZodError,
|
|
7
7
|
normalizeError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./index-7zbps32p.js";
|
|
13
13
|
import {
|
|
14
14
|
objectShapeKeys
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-h9etkkyk.js";
|
|
16
16
|
import {
|
|
17
17
|
AppError,
|
|
18
18
|
STITCH_ERROR_STATUS,
|
|
@@ -45,6 +45,53 @@ function isToolExecutionControlError(value) {
|
|
|
45
45
|
return value instanceof ToolExecutionControlError;
|
|
46
46
|
}
|
|
47
47
|
var normalizedToolErrors = new WeakMap;
|
|
48
|
+
function parseToolCallArguments(method, callArgs, coerceJson) {
|
|
49
|
+
const paramKeys = new Set(objectShapeKeys(method.paramsSchema));
|
|
50
|
+
let paramArgs = {};
|
|
51
|
+
let inputArgs = {};
|
|
52
|
+
for (const [key, value] of Object.entries(callArgs)) {
|
|
53
|
+
if (isUnsafeKey(key))
|
|
54
|
+
continue;
|
|
55
|
+
if (paramKeys.has(key))
|
|
56
|
+
paramArgs[key] = value;
|
|
57
|
+
else
|
|
58
|
+
inputArgs[key] = value;
|
|
59
|
+
}
|
|
60
|
+
if (coerceJson) {
|
|
61
|
+
paramArgs = coerceJsonArgs(paramArgs, method.paramsSchema);
|
|
62
|
+
inputArgs = coerceJsonArgs(inputArgs, method.inputSchema);
|
|
63
|
+
}
|
|
64
|
+
let params;
|
|
65
|
+
if (method.paramsSchema) {
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = method.paramsSchema.safeParse(paramArgs);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
return { ok: false, message: "Invalid params", thrown: err };
|
|
71
|
+
}
|
|
72
|
+
if (!result.success) {
|
|
73
|
+
return { ok: false, message: `Invalid params: ${formatZodError(result.error)}` };
|
|
74
|
+
}
|
|
75
|
+
params = result.data;
|
|
76
|
+
}
|
|
77
|
+
let input;
|
|
78
|
+
if (method.inputSchema) {
|
|
79
|
+
let result;
|
|
80
|
+
try {
|
|
81
|
+
result = method.inputSchema.safeParse(inputArgs);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
return { ok: false, message: "Invalid input", thrown: err };
|
|
84
|
+
}
|
|
85
|
+
if (!result.success) {
|
|
86
|
+
return { ok: false, message: `Invalid input: ${formatZodError(result.error)}` };
|
|
87
|
+
}
|
|
88
|
+
input = result.data;
|
|
89
|
+
}
|
|
90
|
+
return { ok: true, params, input };
|
|
91
|
+
}
|
|
92
|
+
var noProgress = async () => {
|
|
93
|
+
return;
|
|
94
|
+
};
|
|
48
95
|
function toolResultFromError(err) {
|
|
49
96
|
const appErr = normalizeError(err);
|
|
50
97
|
const result = {
|
|
@@ -160,24 +207,24 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
|
|
|
160
207
|
const keys = new Set(Object.keys(extension.schema.shape));
|
|
161
208
|
extensionKeys = keys;
|
|
162
209
|
const extensionArgs = Object.fromEntries(Object.entries(rawArgs).filter(([key]) => keys.has(key)));
|
|
163
|
-
let
|
|
210
|
+
let parsed2;
|
|
164
211
|
try {
|
|
165
|
-
|
|
212
|
+
parsed2 = extension.schema.safeParse(extensionArgs);
|
|
166
213
|
} catch (err) {
|
|
167
214
|
return finishThrown(err);
|
|
168
215
|
}
|
|
169
|
-
if (!
|
|
216
|
+
if (!parsed2.success) {
|
|
170
217
|
const before2 = await runBefore();
|
|
171
218
|
if (before2?.kind === "failure")
|
|
172
219
|
return before2.result;
|
|
173
220
|
return finish({
|
|
174
221
|
ok: false,
|
|
175
222
|
code: "VALIDATION_ERROR",
|
|
176
|
-
details: { message: `Invalid tool extension: ${formatZodError(
|
|
223
|
+
details: { message: `Invalid tool extension: ${formatZodError(parsed2.error)}` }
|
|
177
224
|
});
|
|
178
225
|
}
|
|
179
226
|
try {
|
|
180
|
-
const resolved = await extension.resolve({ ...rawArgs, ...
|
|
227
|
+
const resolved = await extension.resolve({ ...rawArgs, ...parsed2.data });
|
|
181
228
|
callContext = {
|
|
182
229
|
...context,
|
|
183
230
|
...resolved,
|
|
@@ -198,57 +245,14 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
|
|
|
198
245
|
callArgs = extensionKeys ? Object.fromEntries(Object.entries(rewrittenArgs).filter(([key]) => !extensionKeys.has(key))) : rewrittenArgs;
|
|
199
246
|
rewrittenArgsApplied = true;
|
|
200
247
|
}
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
for (const [key, value] of Object.entries(callArgs)) {
|
|
205
|
-
if (isUnsafeKey(key))
|
|
206
|
-
continue;
|
|
207
|
-
if (paramKeys.has(key))
|
|
208
|
-
paramArgs[key] = value;
|
|
209
|
-
else
|
|
210
|
-
inputArgs[key] = value;
|
|
211
|
-
}
|
|
212
|
-
if (coerceJson) {
|
|
213
|
-
paramArgs = coerceJsonArgs(paramArgs, method.paramsSchema);
|
|
214
|
-
inputArgs = coerceJsonArgs(inputArgs, method.inputSchema);
|
|
215
|
-
}
|
|
216
|
-
let params;
|
|
217
|
-
if (method.paramsSchema) {
|
|
218
|
-
let result;
|
|
219
|
-
try {
|
|
220
|
-
result = method.paramsSchema.safeParse(paramArgs);
|
|
221
|
-
} catch (err) {
|
|
222
|
-
return finishThrown(err);
|
|
223
|
-
}
|
|
224
|
-
if (!result.success) {
|
|
225
|
-
return finish({
|
|
226
|
-
ok: false,
|
|
227
|
-
code: "VALIDATION_ERROR",
|
|
228
|
-
details: { message: `Invalid params: ${formatZodError(result.error)}` }
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
params = result.data;
|
|
232
|
-
}
|
|
233
|
-
let input;
|
|
234
|
-
if (method.inputSchema) {
|
|
235
|
-
let result;
|
|
236
|
-
try {
|
|
237
|
-
result = method.inputSchema.safeParse(inputArgs);
|
|
238
|
-
} catch (err) {
|
|
239
|
-
return finishThrown(err);
|
|
240
|
-
}
|
|
241
|
-
if (!result.success) {
|
|
242
|
-
return finish({
|
|
243
|
-
ok: false,
|
|
244
|
-
code: "VALIDATION_ERROR",
|
|
245
|
-
details: { message: `Invalid input: ${formatZodError(result.error)}` }
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
input = result.data;
|
|
248
|
+
const parsed = parseToolCallArguments(method, callArgs, coerceJson);
|
|
249
|
+
if (!parsed.ok) {
|
|
250
|
+
return parsed.thrown !== undefined ? finishThrown(parsed.thrown) : finish({ ok: false, code: "VALIDATION_ERROR", details: { message: parsed.message } });
|
|
249
251
|
}
|
|
252
|
+
const { params, input } = parsed;
|
|
250
253
|
try {
|
|
251
254
|
const ctx = {
|
|
255
|
+
reportProgress: noProgress,
|
|
252
256
|
...callContext,
|
|
253
257
|
params,
|
|
254
258
|
input,
|
|
@@ -283,4 +287,4 @@ async function runToolMethod(method, toolName, rawArgs, context, hooks, lifecycl
|
|
|
283
287
|
}
|
|
284
288
|
}
|
|
285
289
|
|
|
286
|
-
export { ToolExecutionControlError, isToolExecutionControlError, toolResultFromError, toolErrorFromResult, toolCauseFromResult, executeToolMethod };
|
|
290
|
+
export { ToolExecutionControlError, isToolExecutionControlError, parseToolCallArguments, toolResultFromError, toolErrorFromResult, toolCauseFromResult, executeToolMethod };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace a file without ever leaving half of one behind, and without handing
|
|
3
|
+
* a writable directory to whoever guessed the staging name.
|
|
4
|
+
*
|
|
5
|
+
* Write beside the target, then rename onto it: the rename is atomic within a
|
|
6
|
+
* filesystem, so a reader sees the old bytes or the new ones and never a
|
|
7
|
+
* partial write. The staging path has to be in the target's own directory for
|
|
8
|
+
* that to hold — a rename across filesystems is a copy, and a copy is exactly
|
|
9
|
+
* the window this avoids.
|
|
10
|
+
*
|
|
11
|
+
* The staging name is random and the file is created exclusively. A name built
|
|
12
|
+
* from pid and clock is guessable, and `writeFileSync` follows a symlink: an
|
|
13
|
+
* attacker who can write to the directory plants `.app.1234.1700000000000` →
|
|
14
|
+
* `/etc/something`, and the update writes its bytes through the link, chmods
|
|
15
|
+
* the target 0o755 and then renames the link itself into place, so every later
|
|
16
|
+
* write goes there too. `wx` refuses to open anything that already exists,
|
|
17
|
+
* link or file, which closes it.
|
|
18
|
+
*/
|
|
19
|
+
/** Write `bytes` to `target` atomically, with an explicit mode. */
|
|
20
|
+
export declare function writeFileAtomic(target: string, bytes: Uint8Array, mode: number): void;
|
|
21
|
+
//# sourceMappingURL=atomic-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-file.d.ts","sourceRoot":"","sources":["../../src/internal/atomic-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAmBrF"}
|
|
@@ -52,6 +52,18 @@ export interface PinnedDocumentResponse {
|
|
|
52
52
|
body: Uint8Array;
|
|
53
53
|
url: URL;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* The network boundary refused this address — as opposed to the network failing.
|
|
57
|
+
*
|
|
58
|
+
* A caller that offers a way through the boundary has to be able to tell the two
|
|
59
|
+
* apart, and matching on a message is not telling them apart: the wording is
|
|
60
|
+
* ours to change and a match on it breaks silently the moment it does. The class
|
|
61
|
+
* is the distinction, so a caller can name its own remedy instead of relaying a
|
|
62
|
+
* sentence that reads like a timeout.
|
|
63
|
+
*/
|
|
64
|
+
export declare class PrivateAddressRefusal extends Error {
|
|
65
|
+
readonly name = "PrivateAddressRefusal";
|
|
66
|
+
}
|
|
55
67
|
/**
|
|
56
68
|
* Fetch a small public document while pinning the TCP connection to the exact
|
|
57
69
|
* public DNS answer that passed validation. This closes the check/use DNS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-fetch.d.ts","sourceRoot":"","sources":["../../src/internal/secure-fetch.ts"],"names":[],"mappings":"AAiEA,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CA8D/C;AA4BD;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,YAAY,CAChC,KAA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AY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;CACV;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,2BAA2B;CACzC;AA6CD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAkFjC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBnF"}
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createHandler,
|
|
6
6
|
createSocketIOServer,
|
|
7
7
|
createUnixClientTransport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-n0f51dfn.js";
|
|
9
9
|
import"./index-y91ry9h2.js";
|
|
10
10
|
import {
|
|
11
11
|
ShutdownOptionsSchema,
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
createScopedImplementRegistry,
|
|
25
25
|
implement,
|
|
26
26
|
implementRegistry
|
|
27
|
-
} from "./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
} from "./index-cxqhvq21.js";
|
|
28
|
+
import"./index-tmwcrptx.js";
|
|
29
29
|
import"./index-f9mb610r.js";
|
|
30
30
|
import"./index-e0znv5gn.js";
|
|
31
31
|
import"./index-0a349c33.js";
|
|
@@ -52,7 +52,11 @@ export interface ObservabilityConfig {
|
|
|
52
52
|
/** The one HTTP completion snapshot produced by the handler. */
|
|
53
53
|
export interface HttpRequestCompletion {
|
|
54
54
|
context: RequestContext;
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The transport's status, when there is a transport. Absent for a unit of
|
|
57
|
+
* work that never had one — `ok` and `errorCode` carry its outcome instead.
|
|
58
|
+
*/
|
|
59
|
+
statusCode?: number;
|
|
56
60
|
durationMs: number;
|
|
57
61
|
payload?: Promise<unknown>;
|
|
58
62
|
/** Framework-owned neutral cancellation; currently paired with HTTP 499. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/observability/audit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,uBAAuB,EAE7B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,cAAc,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAe,KAAK,eAAe,EAAmB,MAAM,YAAY,CAAC;AAChF,OAAO,EAEL,KAAK,wBAAwB,EAG7B,KAAK,mBAAmB,EAEzB,MAAM,UAAU,CAAC;AAGlB,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,iFAAiF;IACjF,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;IAC1C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,eAAe,CAA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AO,
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/observability/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CASzD"}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
import type { TransportSource } from '../contract/index.js';
|
|
2
2
|
import { type TraceContext } from './trace.js';
|
|
3
|
-
/**
|
|
3
|
+
/** What a unit of work is: a call that arrived, or work that runs on its own. */
|
|
4
|
+
export type RequestContextKind = 'request' | 'job';
|
|
5
|
+
/** Everything known about the unit of work in flight. */
|
|
4
6
|
export interface RequestContext {
|
|
5
|
-
/** W3C trace ids for this
|
|
7
|
+
/** W3C trace ids for this unit of work. */
|
|
6
8
|
trace: TraceContext;
|
|
7
9
|
/** Which surface the request arrived on. */
|
|
8
10
|
source: TransportSource;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* What this is. Absent means `request`, so every context written before this
|
|
13
|
+
* existed still reads correctly and no caller has to start declaring it.
|
|
14
|
+
*/
|
|
15
|
+
kind?: RequestContextKind;
|
|
16
|
+
/**
|
|
17
|
+
* What the work is, for work that has no route to name it — `agent-loop`,
|
|
18
|
+
* `broadcast-send`. A request is named by its method and path; a job is named
|
|
19
|
+
* by what it does.
|
|
20
|
+
*/
|
|
21
|
+
name?: string;
|
|
22
|
+
/**
|
|
23
|
+
* HTTP verb — absent for work that did not arrive over a transport.
|
|
24
|
+
*
|
|
25
|
+
* It was required, and work without a transport therefore had to invent one:
|
|
26
|
+
* a background loop wrote `method: 'AGENT'`, which is not a verb, it is the
|
|
27
|
+
* absence of one recorded in the field for verbs. An absent field says the
|
|
28
|
+
* same thing and says it truthfully, which is the difference between a filter
|
|
29
|
+
* that can exclude jobs and a filter that silently counts them as writes.
|
|
30
|
+
*/
|
|
31
|
+
method?: string;
|
|
32
|
+
/** Request path — absent for work that did not arrive over a transport. */
|
|
33
|
+
path?: string;
|
|
13
34
|
/** Monotonic start, for duration — `process.hrtime.bigint()`. */
|
|
14
35
|
startedAt: bigint;
|
|
15
36
|
/** Client IP, when resolvable. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/observability/context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/observability/context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,iFAAiF;AACjF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,KAAK,CAAC;AAEnD,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,KAAK,EAAE,YAAY,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD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AAC,KAAK,EAAE;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAGP;AAED,0CAA0C;AAC1C,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,EACvD,OAAO,GAAE,yBAA8B,GACtC,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAkBhD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HttpMethod, McpCallContext, TransportSource } from '../contract/index.js';
|
|
2
|
+
import type { RequestContextKind } from './context.js';
|
|
2
3
|
import type { JsonValue } from './sanitize.js';
|
|
3
4
|
/**
|
|
4
5
|
* A normalised audit event — one shape for a completed call on any surface
|
|
@@ -9,8 +10,24 @@ import type { JsonValue } from './sanitize.js';
|
|
|
9
10
|
export interface RequestEvent {
|
|
10
11
|
/** Surface the call arrived on. */
|
|
11
12
|
source: TransportSource;
|
|
12
|
-
/**
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A call that arrived, or work that ran on its own. Always written, including
|
|
15
|
+
* on requests: a filter that has to read "the absence of `method` means a
|
|
16
|
+
* job" is carrying the same implicit knowledge this field exists to remove.
|
|
17
|
+
*/
|
|
18
|
+
kind: RequestContextKind;
|
|
19
|
+
/**
|
|
20
|
+
* What the work is, for work no route names — `agent-loop`, `broadcast-send`.
|
|
21
|
+
* Absent on requests, which are named by method and path.
|
|
22
|
+
*/
|
|
23
|
+
name?: string;
|
|
24
|
+
/**
|
|
25
|
+
* HTTP verb, `TOOL` for a tool call, and **absent** for work that did not
|
|
26
|
+
* arrive over a transport. It was required, so a background loop had to write
|
|
27
|
+
* something, and what it wrote was `AGENT` — not a verb, but the absence of
|
|
28
|
+
* one recorded in the field for verbs.
|
|
29
|
+
*/
|
|
30
|
+
method?: string;
|
|
14
31
|
/**
|
|
15
32
|
* The operation's contract verb (`GET` / `POST` / …). Set on **tool** events
|
|
16
33
|
* (whose `method` is `TOOL`) so a single filter can tell a read from a write
|
|
@@ -18,8 +35,11 @@ export interface RequestEvent {
|
|
|
18
35
|
* Omitted on HTTP events, where `method` already is the verb. → ADR 0030.
|
|
19
36
|
*/
|
|
20
37
|
httpMethod?: HttpMethod;
|
|
21
|
-
/**
|
|
22
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Request path — `/api/...` for HTTP, `/{source}/{tool}` for a tool call, and
|
|
40
|
+
* absent for work with no transport to have a path on.
|
|
41
|
+
*/
|
|
42
|
+
path?: string;
|
|
23
43
|
/**
|
|
24
44
|
* Stable owning-contract identity of the matched operation — the "service"
|
|
25
45
|
* (contract prefix) and "action" (endpoint key) halves. Set on every surface
|
|
@@ -53,8 +73,16 @@ export interface RequestEvent {
|
|
|
53
73
|
* into; ordinary success/failure rows retain their released shape.
|
|
54
74
|
*/
|
|
55
75
|
outcome?: 'cancelled';
|
|
56
|
-
/**
|
|
57
|
-
|
|
76
|
+
/**
|
|
77
|
+
* HTTP status — the real status for HTTP, `200` / `400` for a tool call, and
|
|
78
|
+
* absent for work that has no transport to have a status on.
|
|
79
|
+
*
|
|
80
|
+
* This one is the trap the rest of this change would otherwise have walked
|
|
81
|
+
* into. Dropping `method: 'AGENT'` while still demanding a status would have
|
|
82
|
+
* replaced one fabricated transport field with another, in the same row, for
|
|
83
|
+
* the same reason. A job's outcome is `ok`, and `errorCode` when it failed.
|
|
84
|
+
*/
|
|
85
|
+
statusCode?: number;
|
|
58
86
|
/** Wall-clock duration. */
|
|
59
87
|
durationMs: number;
|
|
60
88
|
/** Error code — failures only. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/observability/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/observability/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC;IACxC,6EAA6E;IAC7E,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,uEAAuE;IACvE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAC1B,mDAAmD;IACnD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
export { createDimensionsProjector, createObservability, type DimensionsProjector, type DimensionsProjectorConfig, type HttpRequestCompletion, type HttpRequestObserver, type Observability, type ObservabilityConfig, type ObservabilityDrainBound, type ProjectedDimensions, type RequestEventSinkConfig, type RequestObservabilityConfig, type SinkDrop, type SinkDropReason, type SinkError, } from './audit.js';
|
|
10
10
|
export { type BoundedLoggerBounds, type BoundedLoggerOptions, createBoundedLogger, DEFAULT_REDACT_PATHS, } from './bounded-logger.js';
|
|
11
11
|
export { auditChanges } from './changes.js';
|
|
12
|
-
export { type DimensionCollision, getRequestContext, getTraceId, getUserId, type RequestContext, runWithRequestContext, type SetRequestDimensionsOptions, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context.js';
|
|
12
|
+
export { type DimensionCollision, getRequestContext, getTraceId, getUserId, type RequestContext, type RequestContextKind, runWithRequestContext, type SetRequestDimensionsOptions, setRequestDimensions, setRequestEndpoint, setRequestError, setRequestUser, type WrapRequestContextOptions, wrapInRequestContext, } from './context.js';
|
|
13
13
|
export type { RequestEvent } from './event.js';
|
|
14
14
|
export { type JsonValue, measureSize, redact, type SanitizeOptions, type SizeMeasure, sanitizePayload, truncatePreview, } from './sanitize.js';
|
|
15
15
|
export { createSpooledSink, type SpooledSink, type SpooledSinkConfig, type SpoolRecovery, } from './spool.js';
|
|
16
16
|
export { type ObservabilityDrainReport, ObservabilityDrainReportSchema, type ObservabilitySinkStatus, ObservabilitySinkStatusSchema, type ObservabilityStatus, ObservabilityStatusSchema, } from './status.js';
|
|
17
17
|
export { childSpan, createTraceContext, formatTraceparent, parseTraceparent, resolvePropagationContext, resolveTraceContext, type TraceContext, } from './trace.js';
|
|
18
|
+
export { type RunUnitOfWorkOptions, runUnitOfWork } from './work.js';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,KAAK,kBAAkB,EACvB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,KAAK,yBAAyB,EAC9B,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,KAAK,SAAS,EACd,WAAW,EACX,MAAM,EACN,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings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