stitchkit 0.45.0 → 0.46.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/README.md +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/socket-io.d.ts +3 -1
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/cli.js +3 -4
- package/dist/contract/errors.d.ts +1 -0
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/index.js +2 -2
- package/dist/{index-yh0p5ddn.js → index-5s8b7z6q.js} +31 -11
- package/dist/{index-mvjyq9h9.js → index-62pqb23z.js} +309 -144
- package/dist/index-c40tkxcd.js +181 -0
- package/dist/{index-r6czv7yt.js → index-pwyedf7b.js} +4 -3
- package/dist/{index-6jypn22c.js → index-r1qp4rve.js} +9 -1
- package/dist/{index-s4qsmgwe.js → index-tss6bk5c.js} +4 -1
- package/dist/{index-36f1xkdb.js → index-w1s873ng.js} +2 -2
- package/dist/index-yxpe3phd.js +63 -0
- package/dist/{index-w0mec79h.js → index-zwqty9zf.js} +261 -281
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -51
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts +23 -3
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +7 -0
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/internal/within-dir.d.ts +6 -0
- package/dist/internal/within-dir.d.ts.map +1 -1
- package/dist/logger.d.ts +8 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/node.js +3 -4
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/event.d.ts +7 -0
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/observability/index.js +54 -125
- package/dist/observability/sanitize.d.ts +8 -1
- package/dist/observability/sanitize.d.ts.map +1 -1
- package/dist/observability/trace.d.ts +3 -1
- package/dist/observability/trace.d.ts.map +1 -1
- package/dist/react/cache-bridge.d.ts +4 -0
- package/dist/react/cache-bridge.d.ts.map +1 -1
- package/dist/react.js +46 -5
- package/dist/realtime/contract.d.ts +4 -1
- package/dist/realtime/contract.d.ts.map +1 -1
- package/dist/realtime/rejection.d.ts +10 -0
- package/dist/realtime/rejection.d.ts.map +1 -0
- package/dist/realtime/socket.d.ts +14 -1
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/server/cache.d.ts +5 -1
- package/dist/server/cache.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +1 -0
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/file.d.ts +6 -0
- package/dist/server/file.d.ts.map +1 -1
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/index.d.ts +2 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +108 -11
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/realtime.d.ts +2 -0
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/router.d.ts +0 -8
- package/dist/server/router.d.ts.map +1 -1
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/types.d.ts +2 -7
- package/dist/server/types.d.ts.map +1 -1
- package/dist/tools/cli-args.d.ts +11 -3
- package/dist/tools/cli-args.d.ts.map +1 -1
- package/dist/tools/cli.d.ts +5 -0
- package/dist/tools/cli.d.ts.map +1 -1
- package/dist/tools/coerce.d.ts.map +1 -1
- package/dist/tools/json-schema.d.ts.map +1 -1
- package/dist/tools/mcp-handler.d.ts +4 -3
- package/dist/tools/mcp-handler.d.ts.map +1 -1
- package/dist/tools/mcp-prepare.d.ts +95 -0
- package/dist/tools/mcp-prepare.d.ts.map +1 -0
- package/dist/tools/mcp-round.d.ts +4 -0
- package/dist/tools/mcp-round.d.ts.map +1 -1
- package/dist/tools/mcp-stdio.d.ts +2 -1
- package/dist/tools/mcp-stdio.d.ts.map +1 -1
- package/dist/tools/mcp.d.ts +2 -78
- package/dist/tools/mcp.d.ts.map +1 -1
- package/dist/tools/mount-download.d.ts +5 -0
- package/dist/tools/mount-download.d.ts.map +1 -1
- package/dist/tools/native-mcp.d.ts +1 -1
- package/dist/tools/native-mcp.d.ts.map +1 -1
- package/dist/tools/oauth-provider.d.ts +20 -1
- package/dist/tools/oauth-provider.d.ts.map +1 -1
- package/dist/tools/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.d.ts.map +1 -1
- package/dist/tools/view-file.d.ts +9 -0
- package/dist/tools/view-file.d.ts.map +1 -1
- package/dist/tools.d.ts +2 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +342 -214
- package/llms-full.txt +107 -19
- package/llms.txt +1 -1
- package/package.json +2 -2
- package/dist/index-frfyw9fa.js +0 -33
- package/dist/index-x3fcszf8.js +0 -8
package/dist/index.js
CHANGED
|
@@ -17,12 +17,13 @@ import {
|
|
|
17
17
|
parseTrailingWildcard,
|
|
18
18
|
rateLimited,
|
|
19
19
|
unauthorized
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-pwyedf7b.js";
|
|
21
21
|
import {
|
|
22
22
|
isRecord,
|
|
23
23
|
mapObject,
|
|
24
|
+
transportResult,
|
|
24
25
|
typedEntries
|
|
25
|
-
} from "./index-
|
|
26
|
+
} from "./index-tss6bk5c.js";
|
|
26
27
|
|
|
27
28
|
// src/browser/client-multipart.ts
|
|
28
29
|
function isFileDescriptor(value) {
|
|
@@ -211,7 +212,7 @@ function joinClientBaseUrl(baseUrl, relativeUrl) {
|
|
|
211
212
|
import ky, { isHTTPError } from "ky";
|
|
212
213
|
|
|
213
214
|
// src/observability/trace.ts
|
|
214
|
-
var TRACEPARENT_RE = /^
|
|
215
|
+
var TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(.*)$/i;
|
|
215
216
|
function randomHex(bytes) {
|
|
216
217
|
const arr = new Uint8Array(bytes);
|
|
217
218
|
crypto.getRandomValues(arr);
|
|
@@ -227,16 +228,24 @@ function parseTraceparent(header) {
|
|
|
227
228
|
if (!header)
|
|
228
229
|
return null;
|
|
229
230
|
const match = TRACEPARENT_RE.exec(header.trim());
|
|
230
|
-
if (!match?.[1] || !match[2])
|
|
231
|
+
if (!match?.[1] || !match[2] || !match[3] || !match[4] || match[5] === undefined)
|
|
231
232
|
return null;
|
|
232
|
-
const
|
|
233
|
-
|
|
233
|
+
const version = match[1].toLowerCase();
|
|
234
|
+
if (version === "ff")
|
|
235
|
+
return null;
|
|
236
|
+
const suffix = match[5];
|
|
237
|
+
if (version === "00" ? suffix !== "" : suffix !== "" && !/^(?:-[0-9a-f]{2,})+$/i.test(suffix)) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
const traceId = match[2].toLowerCase();
|
|
241
|
+
const parentSpanId = match[3].toLowerCase();
|
|
242
|
+
const traceFlags = match[4].toLowerCase();
|
|
234
243
|
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId))
|
|
235
244
|
return null;
|
|
236
|
-
return { traceId, spanId: randomHex(8), parentSpanId };
|
|
245
|
+
return { traceId, spanId: randomHex(8), parentSpanId, traceFlags };
|
|
237
246
|
}
|
|
238
247
|
function formatTraceparent(ctx) {
|
|
239
|
-
return `00-${ctx.traceId}-${ctx.spanId}
|
|
248
|
+
return `00-${ctx.traceId}-${ctx.spanId}-${ctx.traceFlags ?? "01"}`;
|
|
240
249
|
}
|
|
241
250
|
function childSpan(parent) {
|
|
242
251
|
return {
|
|
@@ -244,7 +253,8 @@ function childSpan(parent) {
|
|
|
244
253
|
spanId: randomHex(8),
|
|
245
254
|
parentSpanId: parent.spanId,
|
|
246
255
|
...parent.tracestate !== undefined && { tracestate: parent.tracestate },
|
|
247
|
-
...parent.baggage !== undefined && { baggage: parent.baggage }
|
|
256
|
+
...parent.baggage !== undefined && { baggage: parent.baggage },
|
|
257
|
+
...parent.traceFlags !== undefined && { traceFlags: parent.traceFlags }
|
|
248
258
|
};
|
|
249
259
|
}
|
|
250
260
|
var encoder = new TextEncoder;
|
|
@@ -376,10 +386,10 @@ function createHttpClient(config) {
|
|
|
376
386
|
}
|
|
377
387
|
try {
|
|
378
388
|
if (options.responseType === "blob") {
|
|
379
|
-
return client[method](url, kyOptions).blob();
|
|
389
|
+
return transportResult(await client[method](url, kyOptions).blob());
|
|
380
390
|
}
|
|
381
391
|
if (options.responseType === "response") {
|
|
382
|
-
return await client[method](url, kyOptions);
|
|
392
|
+
return transportResult(await client[method](url, kyOptions));
|
|
383
393
|
}
|
|
384
394
|
const response = await client[method](url, kyOptions);
|
|
385
395
|
if (options.responseType === "void") {
|
|
@@ -389,9 +399,9 @@ function createHttpClient(config) {
|
|
|
389
399
|
}
|
|
390
400
|
}
|
|
391
401
|
if (options.responseType === "void" || response.status === 204 || response.headers.get("content-length") === "0") {
|
|
392
|
-
return;
|
|
402
|
+
return transportResult(undefined);
|
|
393
403
|
}
|
|
394
|
-
return response.json();
|
|
404
|
+
return await response.json();
|
|
395
405
|
} catch (error) {
|
|
396
406
|
if (ApiError.is(error))
|
|
397
407
|
throw error;
|
|
@@ -646,9 +656,40 @@ function createUrlBuilders(contracts, source, contractConfig) {
|
|
|
646
656
|
function createScopedUrlBuilders(contracts, source, scopeConfigs) {
|
|
647
657
|
return buildScopedRegistry(contracts, scopeConfigs, "URL builder", (contract, config) => createUrlBuilder(contract, source, config));
|
|
648
658
|
}
|
|
649
|
-
// src/realtime/
|
|
659
|
+
// src/realtime/rejection.ts
|
|
660
|
+
import { z as z2 } from "zod";
|
|
661
|
+
|
|
662
|
+
// src/internal/errors.ts
|
|
650
663
|
import { z } from "zod";
|
|
651
|
-
|
|
664
|
+
function issuePath(path) {
|
|
665
|
+
return path.length > 0 ? path.map(String).join(".") : "(root)";
|
|
666
|
+
}
|
|
667
|
+
function zodIssues(error) {
|
|
668
|
+
return error.issues.map((issue) => ({
|
|
669
|
+
path: issuePath(issue.path),
|
|
670
|
+
code: issue.code,
|
|
671
|
+
message: issue.message
|
|
672
|
+
}));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// src/realtime/rejection.ts
|
|
676
|
+
function realtimeContractViolation(options) {
|
|
677
|
+
const issues = options.cause instanceof z2.ZodError ? zodIssues(options.cause) : undefined;
|
|
678
|
+
const reason = options.reason.replaceAll("-", " ");
|
|
679
|
+
const error = new AppError("REALTIME_CONTRACT_VIOLATION", `Realtime event "${options.event}" (${options.direction}, ${options.phase}): ${reason}`, 500, {
|
|
680
|
+
event: options.event,
|
|
681
|
+
direction: options.direction,
|
|
682
|
+
phase: options.phase,
|
|
683
|
+
reason: options.reason,
|
|
684
|
+
fault: options.fault,
|
|
685
|
+
...issues !== undefined && { issues }
|
|
686
|
+
});
|
|
687
|
+
if (options.cause !== undefined)
|
|
688
|
+
error.cause = options.cause;
|
|
689
|
+
return { ...options, error };
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// src/realtime/socket.ts
|
|
652
693
|
function method(target, name) {
|
|
653
694
|
const value = Reflect.get(target, name);
|
|
654
695
|
if (typeof value !== "function") {
|
|
@@ -667,15 +708,26 @@ function splitWireArguments(definition, args) {
|
|
|
667
708
|
acknowledgement: (...callbackArgs) => Reflect.apply(acknowledgement, undefined, callbackArgs)
|
|
668
709
|
};
|
|
669
710
|
}
|
|
670
|
-
function eventDefinition(registry, event) {
|
|
711
|
+
function eventDefinition(registry, event, direction) {
|
|
671
712
|
const definition = registry[event];
|
|
672
|
-
if (!definition)
|
|
673
|
-
throw
|
|
713
|
+
if (!definition) {
|
|
714
|
+
throw realtimeContractViolation({
|
|
715
|
+
event,
|
|
716
|
+
direction,
|
|
717
|
+
phase: "arguments",
|
|
718
|
+
reason: "unknown-event",
|
|
719
|
+
fault: "local"
|
|
720
|
+
}).error;
|
|
721
|
+
}
|
|
674
722
|
return definition;
|
|
675
723
|
}
|
|
676
|
-
function reportRejected(rejected, hook) {
|
|
724
|
+
function reportRejected(rejected, hook, logger) {
|
|
677
725
|
if (!hook) {
|
|
678
|
-
|
|
726
|
+
if (logger) {
|
|
727
|
+
logger.warn(rejected.error.message, rejected.error.details);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
console.warn(`[stitchkit] rejected realtime ${rejected.direction} event "${rejected.event}" (${rejected.phase})`, rejected.error);
|
|
679
731
|
return;
|
|
680
732
|
}
|
|
681
733
|
Promise.resolve(hook(rejected)).catch((error) => {
|
|
@@ -689,36 +741,35 @@ function createValidatedRealtimeSocket({
|
|
|
689
741
|
inboundDirection,
|
|
690
742
|
outboundDirection,
|
|
691
743
|
onRejected,
|
|
744
|
+
logger,
|
|
692
745
|
subscribe
|
|
693
746
|
}) {
|
|
694
|
-
const onTarget = method(target, "on");
|
|
695
|
-
const offTarget = subscribe ? undefined : method(target, "off");
|
|
696
747
|
const emitTarget = method(target, "emit");
|
|
697
748
|
return {
|
|
698
749
|
on: (event, handler) => {
|
|
699
|
-
const definition = eventDefinition(inbound, event);
|
|
750
|
+
const definition = eventDefinition(inbound, event, inboundDirection);
|
|
700
751
|
const wrapped = (...wireArgs) => {
|
|
701
752
|
const { values, acknowledgement } = splitWireArguments(definition, wireArgs);
|
|
702
753
|
const parsed = definition.args.safeParse(values);
|
|
703
754
|
if (!parsed.success) {
|
|
704
|
-
reportRejected({
|
|
755
|
+
reportRejected(realtimeContractViolation({
|
|
705
756
|
event,
|
|
706
757
|
direction: inboundDirection,
|
|
707
758
|
phase: "arguments",
|
|
708
|
-
|
|
709
|
-
|
|
759
|
+
reason: "invalid-arguments",
|
|
760
|
+
fault: "peer",
|
|
761
|
+
cause: parsed.error
|
|
762
|
+
}), onRejected, logger);
|
|
710
763
|
return;
|
|
711
764
|
}
|
|
712
765
|
if (definition.ack && !acknowledgement) {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}, onRejected);
|
|
721
|
-
}
|
|
766
|
+
reportRejected(realtimeContractViolation({
|
|
767
|
+
event,
|
|
768
|
+
direction: inboundDirection,
|
|
769
|
+
phase: "acknowledgement",
|
|
770
|
+
reason: "missing-acknowledgement",
|
|
771
|
+
fault: "peer"
|
|
772
|
+
}), onRejected, logger);
|
|
722
773
|
return;
|
|
723
774
|
}
|
|
724
775
|
const applicationArgs = [...parsed.data];
|
|
@@ -727,12 +778,14 @@ function createValidatedRealtimeSocket({
|
|
|
727
778
|
const ack = definition.ack?.safeParse(value);
|
|
728
779
|
if (!ack?.success) {
|
|
729
780
|
if (ack) {
|
|
730
|
-
reportRejected({
|
|
781
|
+
reportRejected(realtimeContractViolation({
|
|
731
782
|
event,
|
|
732
783
|
direction: outboundDirection,
|
|
733
784
|
phase: "acknowledgement",
|
|
734
|
-
|
|
735
|
-
|
|
785
|
+
reason: "invalid-acknowledgement-value",
|
|
786
|
+
fault: "local",
|
|
787
|
+
cause: ack.error
|
|
788
|
+
}), onRejected, logger);
|
|
736
789
|
}
|
|
737
790
|
return;
|
|
738
791
|
}
|
|
@@ -743,30 +796,50 @@ function createValidatedRealtimeSocket({
|
|
|
743
796
|
};
|
|
744
797
|
if (subscribe)
|
|
745
798
|
return subscribe(event, wrapped);
|
|
799
|
+
const onTarget = method(target, "on");
|
|
800
|
+
const offTarget = method(target, "off");
|
|
746
801
|
onTarget(event, wrapped);
|
|
747
802
|
return () => {
|
|
748
|
-
offTarget
|
|
803
|
+
offTarget(event, wrapped);
|
|
749
804
|
};
|
|
750
805
|
},
|
|
751
806
|
emit: (event, ...args) => {
|
|
752
|
-
const definition = eventDefinition(outbound, event);
|
|
807
|
+
const definition = eventDefinition(outbound, event, outboundDirection);
|
|
753
808
|
const { values, acknowledgement } = splitWireArguments(definition, args);
|
|
754
|
-
const parsed = definition.args.
|
|
809
|
+
const parsed = definition.args.safeParse(values);
|
|
810
|
+
if (!parsed.success) {
|
|
811
|
+
throw realtimeContractViolation({
|
|
812
|
+
event,
|
|
813
|
+
direction: outboundDirection,
|
|
814
|
+
phase: "arguments",
|
|
815
|
+
reason: "invalid-arguments",
|
|
816
|
+
fault: "local",
|
|
817
|
+
cause: parsed.error
|
|
818
|
+
}).error;
|
|
819
|
+
}
|
|
755
820
|
if (definition.ack && !acknowledgement) {
|
|
756
|
-
|
|
821
|
+
throw realtimeContractViolation({
|
|
822
|
+
event,
|
|
823
|
+
direction: outboundDirection,
|
|
824
|
+
phase: "acknowledgement",
|
|
825
|
+
reason: "missing-acknowledgement",
|
|
826
|
+
fault: "local"
|
|
827
|
+
}).error;
|
|
757
828
|
}
|
|
758
|
-
const wireArgs = [...parsed];
|
|
829
|
+
const wireArgs = [...parsed.data];
|
|
759
830
|
if (definition.ack && acknowledgement) {
|
|
760
831
|
wireArgs.push((value) => {
|
|
761
832
|
const ack = definition.ack?.safeParse(value);
|
|
762
833
|
if (!ack?.success) {
|
|
763
834
|
if (ack) {
|
|
764
|
-
reportRejected({
|
|
835
|
+
reportRejected(realtimeContractViolation({
|
|
765
836
|
event,
|
|
766
837
|
direction: inboundDirection,
|
|
767
838
|
phase: "acknowledgement",
|
|
768
|
-
|
|
769
|
-
|
|
839
|
+
reason: "invalid-acknowledgement-value",
|
|
840
|
+
fault: "peer",
|
|
841
|
+
cause: ack.error
|
|
842
|
+
}), onRejected, logger);
|
|
770
843
|
}
|
|
771
844
|
return;
|
|
772
845
|
}
|
|
@@ -823,7 +896,7 @@ function toIoAuth(auth) {
|
|
|
823
896
|
Promise.resolve().then(auth).then(cb, () => cb({}));
|
|
824
897
|
};
|
|
825
898
|
}
|
|
826
|
-
function createRealtimeClient(contract, { onRejected, ...config }) {
|
|
899
|
+
function createRealtimeClient(contract, { onRejected, logger, ...config }) {
|
|
827
900
|
const transport = createSocketIOClient(config);
|
|
828
901
|
const events = createValidatedRealtimeSocket({
|
|
829
902
|
target: transport,
|
|
@@ -832,6 +905,7 @@ function createRealtimeClient(contract, { onRejected, ...config }) {
|
|
|
832
905
|
inboundDirection: "client-inbound",
|
|
833
906
|
outboundDirection: "client-outbound",
|
|
834
907
|
onRejected,
|
|
908
|
+
logger,
|
|
835
909
|
subscribe: (event, handler) => {
|
|
836
910
|
const subscribe = Reflect.get(transport, "on");
|
|
837
911
|
if (typeof subscribe !== "function") {
|
|
@@ -906,6 +980,9 @@ function createSocketIOClient(config) {
|
|
|
906
980
|
}, serverDisconnectDelay);
|
|
907
981
|
}
|
|
908
982
|
});
|
|
983
|
+
socket.io.on("reconnect_failed", () => {
|
|
984
|
+
desiredConnected = false;
|
|
985
|
+
});
|
|
909
986
|
if (retained) {
|
|
910
987
|
for (const name of retainNames) {
|
|
911
988
|
socket.on(name, (payload) => retained.record(name, payload));
|
|
@@ -920,9 +997,13 @@ function createSocketIOClient(config) {
|
|
|
920
997
|
return socket?.connected ?? false;
|
|
921
998
|
},
|
|
922
999
|
connect() {
|
|
923
|
-
if (socket || desiredConnected)
|
|
1000
|
+
if (socket?.connected || desiredConnected)
|
|
924
1001
|
return;
|
|
925
1002
|
desiredConnected = true;
|
|
1003
|
+
if (socket) {
|
|
1004
|
+
socket.connect();
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
926
1007
|
loadIo().then(openSocket);
|
|
927
1008
|
},
|
|
928
1009
|
disconnect() {
|
|
@@ -966,9 +1047,6 @@ function createSocketIOClient(config) {
|
|
|
966
1047
|
}
|
|
967
1048
|
};
|
|
968
1049
|
}
|
|
969
|
-
// src/internal/errors.ts
|
|
970
|
-
import { z as z2 } from "zod";
|
|
971
|
-
|
|
972
1050
|
// src/server/stream.ts
|
|
973
1051
|
async function* parseSSE(response, options) {
|
|
974
1052
|
const reader = response.body?.getReader();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,wBAAgB,cAAc,CAAC,KAAK,EAAE,CA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AgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAyBrD;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D"}
|
|
@@ -4,9 +4,13 @@ export declare function isPrivateIp(ip: string): boolean;
|
|
|
4
4
|
* Refuse a URL that is not `http(s)`, has no host, or whose host is — or
|
|
5
5
|
* resolves to — a private/internal address. Called on the initial URL and on
|
|
6
6
|
* every redirect hop, so a public host cannot `302` to an internal address or
|
|
7
|
-
* to a `file:` / `gopher:` / `data:` scheme.
|
|
7
|
+
* to a `file:` / `gopher:` / `data:` scheme. The DNS lookup honours `signal`,
|
|
8
|
+
* so a slow resolver cannot outlive the caller's deadline.
|
|
9
|
+
*
|
|
10
|
+
* This is the single host-validation implementation — `fetchGuarded` and
|
|
11
|
+
* `fetchPinnedDocument` both go through `resolvePublicAddress`.
|
|
8
12
|
*/
|
|
9
|
-
export declare function assertPublicUrl(url: URL): Promise<void>;
|
|
13
|
+
export declare function assertPublicUrl(url: URL, signal?: AbortSignal): Promise<void>;
|
|
10
14
|
/**
|
|
11
15
|
* Fetch a URL with the SSRF guard enforced on the initial URL and on every
|
|
12
16
|
* redirect hop — a public host can otherwise `302` to an internal address or a
|
|
@@ -17,7 +21,23 @@ export declare function assertPublicUrl(url: URL): Promise<void>;
|
|
|
17
21
|
* per-hop re-check is the larger and fully-closed hole; a static private DNS
|
|
18
22
|
* record is rejected outright.
|
|
19
23
|
*/
|
|
20
|
-
export
|
|
24
|
+
export interface GuardedFetchOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Deadline for producing the FINAL response headers — DNS, connects and every
|
|
27
|
+
* redirect hop share this single budget, so a redirect chain cannot multiply
|
|
28
|
+
* it. Default 15 seconds.
|
|
29
|
+
*/
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Separate deadline for consuming the body once headers have arrived — a slow
|
|
33
|
+
* LARGE download must not be killed by the connection budget, but a drip-feed
|
|
34
|
+
* body must still end. Default 120 seconds.
|
|
35
|
+
*/
|
|
36
|
+
bodyTimeoutMs?: number;
|
|
37
|
+
/** Optional caller cancellation, combined with both deadlines. */
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
}
|
|
40
|
+
export declare function fetchGuarded(start: URL, allowPrivate: boolean, options?: GuardedFetchOptions): Promise<Response>;
|
|
21
41
|
export interface PinnedDocumentFetchOptions {
|
|
22
42
|
maxBytes: number;
|
|
23
43
|
timeoutMs: number;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"secure-fetch.d.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GAAG,IAAI,CAAC,CAoBnF"}
|
package/dist/internal/typed.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ export declare function typedEntries<T extends object>(value: T): Array<{
|
|
|
3
3
|
}[keyof T]>;
|
|
4
4
|
/** Narrow an unknown value to a plain object — not `null`, not an array. */
|
|
5
5
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
6
|
+
/** Invoke a runtime-discovered handler after a fail-first function check. */
|
|
7
|
+
export declare function callRuntimeHandler(handler: unknown, context: unknown): unknown;
|
|
8
|
+
/**
|
|
9
|
+
* Isolated loose-to-typed adapter boundary for transports whose decoder is
|
|
10
|
+
* selected at runtime while the contract fixes the generic result type.
|
|
11
|
+
*/
|
|
12
|
+
export declare function transportResult<T>(value: unknown): T;
|
|
6
13
|
export declare function mapObject<TSource extends object, TResult extends {
|
|
7
14
|
[K in keyof TSource]?: unknown;
|
|
8
15
|
}>(source: TSource, mapper: <K extends keyof TSource>(key: K, value: TSource[K]) => TResult[K] | undefined): TResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src/internal/typed.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,KAAK,EAAE,CAAC,GACP,KAAK,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAE/C;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,SAAS,CACvB,OAAO,SAAS,MAAM,EACtB,OAAO,SAAS;KAAG,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,OAAO;CAAE,EAElD,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,CAAC,CA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OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,GACrF,OAAO,CAOT;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,SAAS,MAAM,EACtB,OAAO,SAAS;KAAG,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,OAAO;CAAE,EAElD,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,KAAK,OAAO,GACrE,OAAO,CAKT"}
|
|
@@ -4,4 +4,10 @@
|
|
|
4
4
|
* check behind `staticRoute` and `view_file`'s local-file branch.
|
|
5
5
|
*/
|
|
6
6
|
export declare function isWithinDir(root: string, target: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve both paths through the filesystem and return the real target only
|
|
9
|
+
* when it remains inside the real root. The lexical check must run first at a
|
|
10
|
+
* URL boundary; this second check closes symlink escapes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function realPathWithinDir(root: string, target: string): Promise<string | null>;
|
|
7
13
|
//# sourceMappingURL=within-dir.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within-dir.d.ts","sourceRoot":"","sources":["../../src/internal/within-dir.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"within-dir.d.ts","sourceRoot":"","sources":["../../src/internal/within-dir.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAQjE;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAO5F"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Minimal structured logger shared by browser-safe and server entrypoints. */
|
|
2
|
+
export interface StitchLogger {
|
|
3
|
+
info(msg: string, data?: Record<string, unknown>): void;
|
|
4
|
+
warn(msg: string, data?: Record<string, unknown>): void;
|
|
5
|
+
error(msg: string, data?: Record<string, unknown>): void;
|
|
6
|
+
debug(msg: string, data?: Record<string, unknown>): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D"}
|
package/dist/node.js
CHANGED
|
@@ -4,9 +4,8 @@ import {
|
|
|
4
4
|
createImplement,
|
|
5
5
|
createSocketIOServer,
|
|
6
6
|
implement
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-x3fcszf8.js";
|
|
7
|
+
} from "./index-zwqty9zf.js";
|
|
8
|
+
import"./index-r1qp4rve.js";
|
|
10
9
|
import {
|
|
11
10
|
AppError,
|
|
12
11
|
appError,
|
|
@@ -16,7 +15,7 @@ import {
|
|
|
16
15
|
notFound,
|
|
17
16
|
rateLimited,
|
|
18
17
|
unauthorized
|
|
19
|
-
} from "./index-
|
|
18
|
+
} from "./index-5s8b7z6q.js";
|
|
20
19
|
// src/server/node.ts
|
|
21
20
|
import { serve } from "srvx";
|
|
22
21
|
async function serveNode(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/observability/audit.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAe,KAAK,eAAe,EAAmB,MAAM,YAAY,CAAC;AAGhF,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;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,CAAC;CAC5B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,2DAA2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,KAAK,CAAC,EAAE,sBAAsB,CAAC;CAChC;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,0EAA0E;AAC1E,MAAM,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,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACnD;AAED,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAkFD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa,CAwH9E"}
|
|
@@ -36,6 +36,8 @@ export interface RequestEvent {
|
|
|
36
36
|
dimensions?: Record<string, string>;
|
|
37
37
|
/** Tool name — tool calls only. */
|
|
38
38
|
toolName?: string;
|
|
39
|
+
/** Distinguishes a completed operation from an MRTR input-gating round. */
|
|
40
|
+
toolPhase?: 'operation' | 'input-round';
|
|
39
41
|
/** Validated MCP transport attribution, available only on MCP tool calls. */
|
|
40
42
|
mcp?: {
|
|
41
43
|
era: 'modern' | 'legacy';
|
|
@@ -81,6 +83,11 @@ export interface RequestEvent {
|
|
|
81
83
|
resultSize: number | null;
|
|
82
84
|
/** Serialised byte length of the result. */
|
|
83
85
|
responseBytes: number;
|
|
86
|
+
/**
|
|
87
|
+
* Set when the result could not be serialised at all (bigint, a cycle) —
|
|
88
|
+
* distinguishes `responseBytes: 0` "nothing returned" from "unmeasurable".
|
|
89
|
+
*/
|
|
90
|
+
resultUnserializable?: boolean;
|
|
84
91
|
/** Resolved user id, when authenticated. */
|
|
85
92
|
userId?: string;
|
|
86
93
|
/** How the caller authenticated, when the app records it on the context. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/observability/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,M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