stitchkit 0.78.0 → 0.80.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/dist/agent-runtime-browser.js +53 -581
- package/dist/agent-runtime-coding-tools.js +6 -5
- package/dist/agent-runtime-harness.js +21 -94
- package/dist/agent-runtime-openrouter.js +1 -1
- package/dist/agent-runtime.js +68 -64
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/schemas.d.ts +2 -0
- package/dist/application/schemas.d.ts.map +1 -1
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/application-diagnostic-journal.js +14 -96
- package/dist/application-opentelemetry.js +6 -92
- package/dist/application-schemas.js +2 -1
- package/dist/application.js +158 -1802
- package/dist/cli.js +13 -11
- package/dist/contract/index.js +7 -4
- package/dist/index-2qzskm8h.js +63 -0
- package/dist/{index-93xp5tgg.js → index-2rwwmr7v.js} +3 -3
- package/dist/{index-kw12fsbc.js → index-3gye9wzb.js} +7 -3
- package/dist/{index-1ckavx4h.js → index-3z73fh2c.js} +1 -49
- package/dist/index-4fpa9dy2.js +51 -0
- package/dist/{index-cwp38wxn.js → index-5mtc969c.js} +2 -2
- package/dist/index-5s3zajp8.js +192 -0
- package/dist/index-6s7n2v50.js +583 -0
- package/dist/{index-qaajjfp6.js → index-758zx2ha.js} +15 -94
- package/dist/{index-qyrqwr4c.js → index-77fekveh.js} +4 -1
- package/dist/{index-k45qqrdh.js → index-7ag81v2f.js} +13 -166
- package/dist/{index-n1g2xm6a.js → index-7gnkny4z.js} +124 -1
- package/dist/index-7zbps32p.js +89 -0
- package/dist/index-85vfqd7m.js +135 -0
- package/dist/{index-4ntp63ps.js → index-9s6z8vgf.js} +18 -142
- package/dist/index-a916km3r.js +45 -0
- package/dist/index-b9aefrqd.js +20 -0
- package/dist/index-dre2ywck.js +48 -0
- package/dist/{index-s5tn4kdv.js → index-dwf1f2ap.js} +3 -3
- package/dist/{index-wwst0td5.js → index-dx9xehwt.js} +1 -1
- package/dist/{index-5r0ak8fr.js → index-dxesg10d.js} +4 -4
- package/dist/{index-aczggrty.js → index-dxjjv399.js} +2 -2
- package/dist/{index-j6mfaw26.js → index-egaabxkz.js} +3 -3
- package/dist/index-evcnmsc3.js +866 -0
- package/dist/{index-efm026pw.js → index-fxz0v7vg.js} +86 -86
- package/dist/{index-56fm73re.js → index-hb5pf3s4.js} +1 -1
- package/dist/{index-n7apa6sy.js → index-k9ay6v6d.js} +24 -275
- package/dist/index-kzfs85xp.js +9 -0
- package/dist/{index-vbf2p6me.js → index-m9kzax52.js} +91 -89
- package/dist/{index-22by16v6.js → index-mgtxfe6b.js} +1 -1
- package/dist/index-p7hgdyhb.js +22 -0
- package/dist/index-pq95qkbf.js +0 -0
- package/dist/index-t0z5p5w6.js +318 -0
- package/dist/{index-31k1ns1s.js → index-vwp69871.js} +13 -11
- package/dist/index-wc4x00bn.js +103 -0
- package/dist/{index-aewy3x5j.js → index-xcetq6j3.js} +10 -8
- package/dist/{index-7z69kyrh.js → index-y01f4223.js} +24 -40
- package/dist/{index-dmfn9m4x.js → index-ywd0y6m1.js} +20 -341
- package/dist/index.js +46 -407
- package/dist/live.js +6 -3
- package/dist/node.js +17 -14
- package/dist/observability/index.js +8 -7
- package/dist/primitives.js +4 -2
- package/dist/react.js +1 -1
- package/dist/remote.js +7 -3
- package/dist/server/index.js +32 -45
- package/dist/telegram.js +1 -1
- package/dist/testing.js +90 -1576
- package/dist/tool-invoker.js +11 -9
- package/dist/tools/async-operation-contract.d.ts +93 -0
- package/dist/tools/async-operation-contract.d.ts.map +1 -0
- package/dist/tools/async-operation.d.ts +2 -47
- package/dist/tools/async-operation.d.ts.map +1 -1
- package/dist/tools/view-file-contract.d.ts +98 -0
- package/dist/tools/view-file-contract.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +4 -83
- package/dist/tools/view-file.d.ts.map +1 -1
- package/dist/tools-contract.d.ts +29 -0
- package/dist/tools-contract.d.ts.map +1 -0
- package/dist/tools-contract.js +24 -0
- package/dist/tools.d.ts +3 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +61 -140
- package/llms-full.txt +86 -3
- package/package.json +9 -6
- package/dist/index-anyqnqcv.js +0 -79
- package/dist/index-ksp6e2ye.js +0 -24
- package/dist/index-vj3vvpaa.js +0 -307
- package/dist/index-wfq8zerm.js +0 -92
package/dist/index.js
CHANGED
|
@@ -1,47 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineRealtimeContract
|
|
3
|
+
} from "./index-p7hgdyhb.js";
|
|
4
|
+
import {
|
|
5
|
+
BackoffPolicySchema,
|
|
6
|
+
createBackoff,
|
|
7
|
+
resumableIterator
|
|
8
|
+
} from "./index-h4pj6fta.js";
|
|
9
|
+
import {
|
|
10
|
+
REALTIME_REJECTION_KEY,
|
|
11
|
+
asRealtimeRejection,
|
|
12
|
+
createValidatedRealtimeSocket,
|
|
13
|
+
isModuleNotFound,
|
|
14
|
+
parseRealtimeRequestAcknowledgement,
|
|
15
|
+
parseRealtimeRequestArguments
|
|
16
|
+
} from "./index-t0z5p5w6.js";
|
|
17
|
+
import {
|
|
18
|
+
RealtimeRequestDisconnectedError,
|
|
19
|
+
RealtimeRequestInvalidAcknowledgementError,
|
|
20
|
+
RealtimeRequestPhaseEventSchema,
|
|
21
|
+
RealtimeRequestPhaseSchema,
|
|
22
|
+
RealtimeRequestRejectedError,
|
|
23
|
+
RealtimeRequestTimeoutError
|
|
24
|
+
} from "./index-2qzskm8h.js";
|
|
25
|
+
import {
|
|
26
|
+
LiveStateControllerStatusSchema,
|
|
27
|
+
LiveStatePhaseSchema,
|
|
28
|
+
LiveStateStopReasonSchema,
|
|
29
|
+
createLiveStateController
|
|
30
|
+
} from "./index-ywd0y6m1.js";
|
|
31
|
+
import"./index-7gnkny4z.js";
|
|
1
32
|
import {
|
|
2
33
|
ApiError,
|
|
3
|
-
childSpan,
|
|
4
34
|
contractEndpointMatchers,
|
|
5
35
|
createClient,
|
|
6
36
|
createClients,
|
|
7
37
|
createHttpClient,
|
|
8
38
|
createScopedClients,
|
|
9
39
|
createScopedUrlBuilders,
|
|
10
|
-
createTraceContext,
|
|
11
40
|
createUrlBuilder,
|
|
12
41
|
createUrlBuilders,
|
|
42
|
+
parseNDJSON
|
|
43
|
+
} from "./index-7ag81v2f.js";
|
|
44
|
+
import {
|
|
45
|
+
parseSSE
|
|
46
|
+
} from "./index-hb5pf3s4.js";
|
|
47
|
+
import {
|
|
48
|
+
childSpan,
|
|
49
|
+
createTraceContext,
|
|
13
50
|
formatTraceparent,
|
|
14
51
|
formatZodError,
|
|
15
|
-
parseNDJSON,
|
|
16
|
-
parseSSE,
|
|
17
52
|
parseTraceparent,
|
|
18
53
|
randomHex,
|
|
19
54
|
zodIssues
|
|
20
|
-
} from "./index-
|
|
55
|
+
} from "./index-fxz0v7vg.js";
|
|
21
56
|
import {
|
|
22
57
|
ALL_TRANSPORTS,
|
|
23
58
|
ContractStreamFrameSchema,
|
|
24
59
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
25
|
-
ManagedFilePathSchema,
|
|
26
|
-
ManagedFileRefSchema,
|
|
27
60
|
createContractFactory,
|
|
28
61
|
decodeCursor,
|
|
29
62
|
defineContract,
|
|
30
63
|
defineErrors,
|
|
31
64
|
encodeCursor,
|
|
32
65
|
paginatedSchema
|
|
33
|
-
} from "./index-
|
|
34
|
-
import {
|
|
35
|
-
BackoffPolicySchema,
|
|
36
|
-
createBackoff,
|
|
37
|
-
resumableIterator
|
|
38
|
-
} from "./index-h4pj6fta.js";
|
|
66
|
+
} from "./index-y01f4223.js";
|
|
39
67
|
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
createLiveStateController
|
|
44
|
-
} from "./index-dmfn9m4x.js";
|
|
68
|
+
ManagedFilePathSchema,
|
|
69
|
+
ManagedFileRefSchema
|
|
70
|
+
} from "./index-6k1937bx.js";
|
|
45
71
|
import {
|
|
46
72
|
AppError,
|
|
47
73
|
STITCH_ERROR_STATUS,
|
|
@@ -54,375 +80,8 @@ import {
|
|
|
54
80
|
rateLimited,
|
|
55
81
|
unauthorized
|
|
56
82
|
} from "./index-0w9abg87.js";
|
|
57
|
-
import"./index-
|
|
58
|
-
|
|
59
|
-
function isModuleNotFound(error) {
|
|
60
|
-
if (typeof error !== "object" || error === null)
|
|
61
|
-
return false;
|
|
62
|
-
const code = "code" in error ? error.code : undefined;
|
|
63
|
-
const message = "message" in error && typeof error.message === "string" ? error.message : "";
|
|
64
|
-
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || message.includes("Cannot find module") || message.includes("Cannot find package");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// src/realtime/request.ts
|
|
68
|
-
import { z } from "zod";
|
|
69
|
-
var RealtimeRequestPhaseSchema = z.enum([
|
|
70
|
-
"engine-handoff",
|
|
71
|
-
"engine-ack-received",
|
|
72
|
-
"settled",
|
|
73
|
-
"timeout",
|
|
74
|
-
"disconnected"
|
|
75
|
-
]);
|
|
76
|
-
var RealtimeRequestPhaseEventSchema = z.object({
|
|
77
|
-
requestId: z.string().min(1),
|
|
78
|
-
event: z.string().min(1),
|
|
79
|
-
phase: RealtimeRequestPhaseSchema,
|
|
80
|
-
elapsedMs: z.number().finite().nonnegative()
|
|
81
|
-
}).strict();
|
|
82
|
-
|
|
83
|
-
class RealtimeRequestTimeoutError extends Error {
|
|
84
|
-
code = "REALTIME_REQUEST_TIMEOUT";
|
|
85
|
-
event;
|
|
86
|
-
timeoutMs;
|
|
87
|
-
constructor(event, timeoutMs) {
|
|
88
|
-
super(`Realtime request "${event}" timed out after ${timeoutMs}ms`);
|
|
89
|
-
this.name = "RealtimeRequestTimeoutError";
|
|
90
|
-
this.event = event;
|
|
91
|
-
this.timeoutMs = timeoutMs;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
class RealtimeRequestDisconnectedError extends Error {
|
|
96
|
-
code = "REALTIME_REQUEST_DISCONNECTED";
|
|
97
|
-
event;
|
|
98
|
-
constructor(event) {
|
|
99
|
-
super(`Realtime request "${event}" was interrupted by disconnect`);
|
|
100
|
-
this.name = "RealtimeRequestDisconnectedError";
|
|
101
|
-
this.event = event;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
class RealtimeRequestInvalidAcknowledgementError extends Error {
|
|
106
|
-
code = "REALTIME_REQUEST_INVALID_ACKNOWLEDGEMENT";
|
|
107
|
-
event;
|
|
108
|
-
constructor(event, cause) {
|
|
109
|
-
super(`Realtime request "${event}" received an invalid acknowledgement`, { cause });
|
|
110
|
-
this.name = "RealtimeRequestInvalidAcknowledgementError";
|
|
111
|
-
this.event = event;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
class RealtimeRequestRejectedError extends Error {
|
|
116
|
-
code = "REALTIME_REQUEST_REJECTED";
|
|
117
|
-
event;
|
|
118
|
-
reason;
|
|
119
|
-
issues;
|
|
120
|
-
constructor(event, reason, detail, issues) {
|
|
121
|
-
super(`Realtime request "${event}" was rejected by the peer (${reason}): ${detail}`);
|
|
122
|
-
this.name = "RealtimeRequestRejectedError";
|
|
123
|
-
this.event = event;
|
|
124
|
-
this.reason = reason;
|
|
125
|
-
this.issues = issues;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// src/realtime/rejected-frame.ts
|
|
130
|
-
var REALTIME_REJECTION_KEY = "@stitchkit/realtime-rejected";
|
|
131
|
-
var MAX_REJECTION_ISSUES = 20;
|
|
132
|
-
function realtimeRejectionEnvelope(report) {
|
|
133
|
-
return { [REALTIME_REJECTION_KEY]: report };
|
|
134
|
-
}
|
|
135
|
-
function asRealtimeRejection(value) {
|
|
136
|
-
if (typeof value !== "object" || value === null)
|
|
137
|
-
return null;
|
|
138
|
-
const report = Reflect.get(value, REALTIME_REJECTION_KEY);
|
|
139
|
-
if (typeof report !== "object" || report === null)
|
|
140
|
-
return null;
|
|
141
|
-
const event = Reflect.get(report, "event");
|
|
142
|
-
const reason = Reflect.get(report, "reason");
|
|
143
|
-
const message = Reflect.get(report, "message");
|
|
144
|
-
if (typeof event !== "string" || typeof reason !== "string" || typeof message !== "string") {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
if (reason.length === 0)
|
|
148
|
-
return null;
|
|
149
|
-
const issues = parseIssues(Reflect.get(report, "issues"));
|
|
150
|
-
return { event, reason, message, ...issues !== undefined && { issues } };
|
|
151
|
-
}
|
|
152
|
-
function parseIssues(value) {
|
|
153
|
-
if (!Array.isArray(value))
|
|
154
|
-
return;
|
|
155
|
-
const issues = [];
|
|
156
|
-
for (const entry of value.slice(0, MAX_REJECTION_ISSUES)) {
|
|
157
|
-
if (typeof entry !== "object" || entry === null)
|
|
158
|
-
continue;
|
|
159
|
-
const path = Reflect.get(entry, "path");
|
|
160
|
-
const code = Reflect.get(entry, "code");
|
|
161
|
-
const message = Reflect.get(entry, "message");
|
|
162
|
-
if (typeof path === "string" && typeof code === "string" && typeof message === "string") {
|
|
163
|
-
issues.push({ path, code, message });
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return issues.length > 0 ? issues : undefined;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/realtime/rejection.ts
|
|
170
|
-
import { z as z2 } from "zod";
|
|
171
|
-
function realtimeContractViolation(options) {
|
|
172
|
-
const issues = options.cause instanceof z2.ZodError ? zodIssues(options.cause) : undefined;
|
|
173
|
-
const reason = options.reason.replaceAll("-", " ");
|
|
174
|
-
const error = new AppError("REALTIME_CONTRACT_VIOLATION", `Realtime event "${options.event}" (${options.direction}, ${options.phase}): ${reason}`, 500, {
|
|
175
|
-
event: options.event,
|
|
176
|
-
direction: options.direction,
|
|
177
|
-
phase: options.phase,
|
|
178
|
-
reason: options.reason,
|
|
179
|
-
fault: options.fault,
|
|
180
|
-
...issues !== undefined && { issues }
|
|
181
|
-
});
|
|
182
|
-
if (options.cause !== undefined)
|
|
183
|
-
error.cause = options.cause;
|
|
184
|
-
return { ...options, error };
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// src/realtime/socket.ts
|
|
188
|
-
function method(target, name) {
|
|
189
|
-
const value = Reflect.get(target, name);
|
|
190
|
-
if (typeof value !== "function") {
|
|
191
|
-
throw new Error(`Realtime target does not implement ${name}()`);
|
|
192
|
-
}
|
|
193
|
-
return (...args) => Reflect.apply(value, target, args);
|
|
194
|
-
}
|
|
195
|
-
function splitWireArguments(definition, args) {
|
|
196
|
-
const trailing = args.at(-1);
|
|
197
|
-
const replyTo = typeof trailing === "function" ? (...callbackArgs) => Reflect.apply(trailing, undefined, callbackArgs) : undefined;
|
|
198
|
-
if (!definition.ack || !replyTo)
|
|
199
|
-
return { values: args, ...replyTo && { replyTo } };
|
|
200
|
-
return { values: args.slice(0, -1), acknowledgement: replyTo, replyTo };
|
|
201
|
-
}
|
|
202
|
-
function eventDefinition(registry, event, direction) {
|
|
203
|
-
const definition = registry[event];
|
|
204
|
-
if (!definition) {
|
|
205
|
-
throw realtimeContractViolation({
|
|
206
|
-
event,
|
|
207
|
-
direction,
|
|
208
|
-
phase: "arguments",
|
|
209
|
-
reason: "unknown-event",
|
|
210
|
-
fault: "local"
|
|
211
|
-
}).error;
|
|
212
|
-
}
|
|
213
|
-
return definition;
|
|
214
|
-
}
|
|
215
|
-
function reportRejected(rejected, hook, logger) {
|
|
216
|
-
if (!hook) {
|
|
217
|
-
if (logger) {
|
|
218
|
-
logger.warn(rejected.error.message, rejected.error.details);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
console.warn(`[stitchkit] rejected realtime ${rejected.direction} event "${rejected.event}" (${rejected.phase})`, rejected.error);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
Promise.resolve(hook(rejected)).catch((error) => {
|
|
225
|
-
console.error("[stitchkit] realtime rejection hook failed", error);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function answerWithRejection(acknowledgement, report, logger) {
|
|
229
|
-
if (!acknowledgement)
|
|
230
|
-
return;
|
|
231
|
-
try {
|
|
232
|
-
acknowledgement(realtimeRejectionEnvelope(report));
|
|
233
|
-
} catch (error) {
|
|
234
|
-
const message = "[stitchkit] could not answer a rejected realtime frame";
|
|
235
|
-
if (logger)
|
|
236
|
-
logger.warn(message, { error });
|
|
237
|
-
else
|
|
238
|
-
console.warn(message, error);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function parseRealtimeRequestArguments(registry, event, direction, args) {
|
|
242
|
-
const definition = eventDefinition(registry, event, direction);
|
|
243
|
-
const parsed = definition.args.safeParse(args);
|
|
244
|
-
if (!parsed.success) {
|
|
245
|
-
throw realtimeContractViolation({
|
|
246
|
-
event,
|
|
247
|
-
direction,
|
|
248
|
-
phase: "arguments",
|
|
249
|
-
reason: "invalid-arguments",
|
|
250
|
-
fault: "local",
|
|
251
|
-
cause: parsed.error
|
|
252
|
-
}).error;
|
|
253
|
-
}
|
|
254
|
-
if (!definition.ack) {
|
|
255
|
-
throw realtimeContractViolation({
|
|
256
|
-
event,
|
|
257
|
-
direction,
|
|
258
|
-
phase: "acknowledgement",
|
|
259
|
-
reason: "missing-acknowledgement",
|
|
260
|
-
fault: "local"
|
|
261
|
-
}).error;
|
|
262
|
-
}
|
|
263
|
-
return parsed.data;
|
|
264
|
-
}
|
|
265
|
-
function parseRealtimeRequestAcknowledgement(schema, event, direction, value, hook, logger) {
|
|
266
|
-
const refusal = asRealtimeRejection(value);
|
|
267
|
-
if (refusal) {
|
|
268
|
-
reportRejected(realtimeContractViolation({
|
|
269
|
-
event,
|
|
270
|
-
direction,
|
|
271
|
-
phase: "arguments",
|
|
272
|
-
reason: "rejected-by-peer",
|
|
273
|
-
fault: "local"
|
|
274
|
-
}), hook, logger);
|
|
275
|
-
throw new RealtimeRequestRejectedError(event, refusal.reason, refusal.message, refusal.issues);
|
|
276
|
-
}
|
|
277
|
-
const parsed = schema.safeParse(value);
|
|
278
|
-
if (parsed.success)
|
|
279
|
-
return parsed.data;
|
|
280
|
-
const rejected = realtimeContractViolation({
|
|
281
|
-
event,
|
|
282
|
-
direction,
|
|
283
|
-
phase: "acknowledgement",
|
|
284
|
-
reason: "invalid-acknowledgement-value",
|
|
285
|
-
fault: "peer",
|
|
286
|
-
cause: parsed.error
|
|
287
|
-
});
|
|
288
|
-
reportRejected(rejected, hook, logger);
|
|
289
|
-
throw new RealtimeRequestInvalidAcknowledgementError(event, rejected.error);
|
|
290
|
-
}
|
|
291
|
-
function createValidatedRealtimeSocket({
|
|
292
|
-
target,
|
|
293
|
-
inbound,
|
|
294
|
-
outbound,
|
|
295
|
-
inboundDirection,
|
|
296
|
-
outboundDirection,
|
|
297
|
-
onRejected,
|
|
298
|
-
logger,
|
|
299
|
-
subscribe
|
|
300
|
-
}) {
|
|
301
|
-
const emitTarget = method(target, "emit");
|
|
302
|
-
return {
|
|
303
|
-
on: (event, handler) => {
|
|
304
|
-
const definition = eventDefinition(inbound, event, inboundDirection);
|
|
305
|
-
const wrapped = (...wireArgs) => {
|
|
306
|
-
const { values, acknowledgement, replyTo } = splitWireArguments(definition, wireArgs);
|
|
307
|
-
const parsed = definition.args.safeParse(values);
|
|
308
|
-
if (!parsed.success) {
|
|
309
|
-
const rejected = realtimeContractViolation({
|
|
310
|
-
event,
|
|
311
|
-
direction: inboundDirection,
|
|
312
|
-
phase: "arguments",
|
|
313
|
-
reason: "invalid-arguments",
|
|
314
|
-
fault: "peer",
|
|
315
|
-
cause: parsed.error
|
|
316
|
-
});
|
|
317
|
-
reportRejected(rejected, onRejected, logger);
|
|
318
|
-
answerWithRejection(replyTo, {
|
|
319
|
-
event,
|
|
320
|
-
reason: "invalid-arguments",
|
|
321
|
-
message: rejected.error.message,
|
|
322
|
-
issues: zodIssues(parsed.error).slice(0, MAX_REJECTION_ISSUES)
|
|
323
|
-
}, logger);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
if (definition.ack && !acknowledgement) {
|
|
327
|
-
reportRejected(realtimeContractViolation({
|
|
328
|
-
event,
|
|
329
|
-
direction: inboundDirection,
|
|
330
|
-
phase: "acknowledgement",
|
|
331
|
-
reason: "missing-acknowledgement",
|
|
332
|
-
fault: "peer"
|
|
333
|
-
}), onRejected, logger);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
const applicationArgs = [...parsed.data];
|
|
337
|
-
if (definition.ack) {
|
|
338
|
-
applicationArgs.push((value) => {
|
|
339
|
-
const ack = definition.ack?.safeParse(value);
|
|
340
|
-
if (!ack?.success) {
|
|
341
|
-
if (ack) {
|
|
342
|
-
reportRejected(realtimeContractViolation({
|
|
343
|
-
event,
|
|
344
|
-
direction: outboundDirection,
|
|
345
|
-
phase: "acknowledgement",
|
|
346
|
-
reason: "invalid-acknowledgement-value",
|
|
347
|
-
fault: "local",
|
|
348
|
-
cause: ack.error
|
|
349
|
-
}), onRejected, logger);
|
|
350
|
-
}
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
acknowledgement?.(ack.data);
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
Reflect.apply(handler, undefined, applicationArgs);
|
|
357
|
-
};
|
|
358
|
-
if (subscribe)
|
|
359
|
-
return subscribe(event, wrapped);
|
|
360
|
-
const onTarget = method(target, "on");
|
|
361
|
-
const offTarget = method(target, "off");
|
|
362
|
-
onTarget(event, wrapped);
|
|
363
|
-
return () => {
|
|
364
|
-
offTarget(event, wrapped);
|
|
365
|
-
};
|
|
366
|
-
},
|
|
367
|
-
emit: (event, ...args) => {
|
|
368
|
-
const definition = eventDefinition(outbound, event, outboundDirection);
|
|
369
|
-
const { values, acknowledgement } = splitWireArguments(definition, args);
|
|
370
|
-
const parsed = definition.args.safeParse(values);
|
|
371
|
-
if (!parsed.success) {
|
|
372
|
-
throw realtimeContractViolation({
|
|
373
|
-
event,
|
|
374
|
-
direction: outboundDirection,
|
|
375
|
-
phase: "arguments",
|
|
376
|
-
reason: "invalid-arguments",
|
|
377
|
-
fault: "local",
|
|
378
|
-
cause: parsed.error
|
|
379
|
-
}).error;
|
|
380
|
-
}
|
|
381
|
-
if (definition.ack && !acknowledgement) {
|
|
382
|
-
throw realtimeContractViolation({
|
|
383
|
-
event,
|
|
384
|
-
direction: outboundDirection,
|
|
385
|
-
phase: "acknowledgement",
|
|
386
|
-
reason: "missing-acknowledgement",
|
|
387
|
-
fault: "local"
|
|
388
|
-
}).error;
|
|
389
|
-
}
|
|
390
|
-
const wireArgs = [...parsed.data];
|
|
391
|
-
if (definition.ack && acknowledgement) {
|
|
392
|
-
wireArgs.push((value) => {
|
|
393
|
-
const refusal = asRealtimeRejection(value);
|
|
394
|
-
if (refusal) {
|
|
395
|
-
reportRejected(realtimeContractViolation({
|
|
396
|
-
event,
|
|
397
|
-
direction: outboundDirection,
|
|
398
|
-
phase: "arguments",
|
|
399
|
-
reason: "rejected-by-peer",
|
|
400
|
-
fault: "local"
|
|
401
|
-
}), onRejected, logger);
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
const ack = definition.ack?.safeParse(value);
|
|
405
|
-
if (!ack?.success) {
|
|
406
|
-
if (ack) {
|
|
407
|
-
reportRejected(realtimeContractViolation({
|
|
408
|
-
event,
|
|
409
|
-
direction: inboundDirection,
|
|
410
|
-
phase: "acknowledgement",
|
|
411
|
-
reason: "invalid-acknowledgement-value",
|
|
412
|
-
fault: "peer",
|
|
413
|
-
cause: ack.error
|
|
414
|
-
}), onRejected, logger);
|
|
415
|
-
}
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
acknowledgement(ack.data);
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
return emitTarget(event, ...wireArgs) !== false;
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
|
|
83
|
+
import"./index-kzfs85xp.js";
|
|
84
|
+
import"./index-77fekveh.js";
|
|
426
85
|
// src/retained.ts
|
|
427
86
|
function createRetainedTopics() {
|
|
428
87
|
const last = {};
|
|
@@ -904,26 +563,6 @@ function createSocketIOClientInternal(config, onRequestPhase) {
|
|
|
904
563
|
}
|
|
905
564
|
};
|
|
906
565
|
}
|
|
907
|
-
// src/realtime/contract.ts
|
|
908
|
-
import { z as z3 } from "zod";
|
|
909
|
-
function defineRealtimeContract(contract) {
|
|
910
|
-
return contract;
|
|
911
|
-
}
|
|
912
|
-
var RealtimeRejectDirectionSchema = z3.enum([
|
|
913
|
-
"client-inbound",
|
|
914
|
-
"client-outbound",
|
|
915
|
-
"server-inbound",
|
|
916
|
-
"server-outbound"
|
|
917
|
-
]);
|
|
918
|
-
var RealtimeRejectPhaseSchema = z3.enum(["arguments", "acknowledgement"]);
|
|
919
|
-
var RealtimeRejectReasonSchema = z3.enum([
|
|
920
|
-
"unknown-event",
|
|
921
|
-
"invalid-arguments",
|
|
922
|
-
"invalid-acknowledgement-value",
|
|
923
|
-
"missing-acknowledgement",
|
|
924
|
-
"rejected-by-peer"
|
|
925
|
-
]);
|
|
926
|
-
var RealtimeRejectFaultSchema = z3.enum(["peer", "local"]);
|
|
927
566
|
export {
|
|
928
567
|
zodIssues,
|
|
929
568
|
unauthorized,
|
package/dist/live.js
CHANGED
|
@@ -6,11 +6,14 @@ import {
|
|
|
6
6
|
WatchKeySchema,
|
|
7
7
|
WatchStateSchema,
|
|
8
8
|
WatchValueSchema,
|
|
9
|
-
argumentsDigest,
|
|
10
9
|
watchContract,
|
|
11
10
|
watchKeyString
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-dre2ywck.js";
|
|
12
|
+
import"./index-ywd0y6m1.js";
|
|
13
|
+
import"./index-7gnkny4z.js";
|
|
14
|
+
import {
|
|
15
|
+
argumentsDigest
|
|
16
|
+
} from "./index-a916km3r.js";
|
|
14
17
|
|
|
15
18
|
// src/live/events.ts
|
|
16
19
|
import { z } from "zod";
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,16 @@ import {
|
|
|
5
5
|
createHandler,
|
|
6
6
|
createSocketIOServer,
|
|
7
7
|
createUnixClientTransport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-k9ay6v6d.js";
|
|
9
|
+
import {
|
|
10
|
+
ShutdownOptionsSchema,
|
|
11
|
+
ShutdownResultSchema,
|
|
12
|
+
ShutdownStateSchema,
|
|
13
|
+
ShutdownStatusSchema,
|
|
14
|
+
createServerLifecycle
|
|
15
|
+
} from "./index-3z73fh2c.js";
|
|
16
|
+
import"./index-t0z5p5w6.js";
|
|
17
|
+
import"./index-2qzskm8h.js";
|
|
9
18
|
import {
|
|
10
19
|
createImplement,
|
|
11
20
|
createImplementRegistry,
|
|
@@ -14,18 +23,11 @@ import {
|
|
|
14
23
|
createScopedImplementRegistry,
|
|
15
24
|
implement,
|
|
16
25
|
implementRegistry
|
|
17
|
-
} from "./index-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
ShutdownStatusSchema,
|
|
23
|
-
createServerLifecycle
|
|
24
|
-
} from "./index-1ckavx4h.js";
|
|
25
|
-
import"./index-s5tn4kdv.js";
|
|
26
|
-
import"./index-efm026pw.js";
|
|
27
|
-
import"./index-vj3vvpaa.js";
|
|
28
|
-
import"./index-qyrqwr4c.js";
|
|
26
|
+
} from "./index-m9kzax52.js";
|
|
27
|
+
import"./index-dwf1f2ap.js";
|
|
28
|
+
import"./index-fxz0v7vg.js";
|
|
29
|
+
import"./index-y01f4223.js";
|
|
30
|
+
import"./index-6k1937bx.js";
|
|
29
31
|
import {
|
|
30
32
|
AppError,
|
|
31
33
|
appError,
|
|
@@ -36,7 +38,8 @@ import {
|
|
|
36
38
|
rateLimited,
|
|
37
39
|
unauthorized
|
|
38
40
|
} from "./index-0w9abg87.js";
|
|
39
|
-
import"./index-
|
|
41
|
+
import"./index-kzfs85xp.js";
|
|
42
|
+
import"./index-77fekveh.js";
|
|
40
43
|
// src/server/node.ts
|
|
41
44
|
import { serve } from "srvx/node";
|
|
42
45
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
redact,
|
|
11
11
|
sanitizePayload,
|
|
12
12
|
truncatePreview
|
|
13
|
-
} from "../index-
|
|
13
|
+
} from "../index-dxjjv399.js";
|
|
14
14
|
import {
|
|
15
15
|
getRequestContext,
|
|
16
16
|
getTraceId,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
setRequestError,
|
|
22
22
|
setRequestUser,
|
|
23
23
|
wrapInRequestContext
|
|
24
|
-
} from "../index-
|
|
24
|
+
} from "../index-dwf1f2ap.js";
|
|
25
25
|
import {
|
|
26
26
|
childSpan,
|
|
27
27
|
createTraceContext,
|
|
@@ -30,13 +30,14 @@ import {
|
|
|
30
30
|
recordedErrorMessage,
|
|
31
31
|
resolvePropagationContext,
|
|
32
32
|
resolveTraceContext
|
|
33
|
-
} from "../index-
|
|
34
|
-
import"../index-
|
|
33
|
+
} from "../index-fxz0v7vg.js";
|
|
34
|
+
import"../index-y01f4223.js";
|
|
35
|
+
import"../index-6k1937bx.js";
|
|
36
|
+
import"../index-0w9abg87.js";
|
|
37
|
+
import"../index-kzfs85xp.js";
|
|
35
38
|
import {
|
|
36
39
|
isRecord
|
|
37
|
-
} from "../index-
|
|
38
|
-
import"../index-0w9abg87.js";
|
|
39
|
-
import"../index-6k1937bx.js";
|
|
40
|
+
} from "../index-77fekveh.js";
|
|
40
41
|
|
|
41
42
|
// src/observability/audit.ts
|
|
42
43
|
function toolErrorMessage(result) {
|
package/dist/primitives.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import"./index-y01f4223.js";
|
|
1
2
|
import {
|
|
2
3
|
ManagedFileRefSchema
|
|
3
|
-
} from "./index-
|
|
4
|
+
} from "./index-6k1937bx.js";
|
|
4
5
|
import"./index-0w9abg87.js";
|
|
5
|
-
import"./index-
|
|
6
|
+
import"./index-kzfs85xp.js";
|
|
7
|
+
import"./index-77fekveh.js";
|
|
6
8
|
|
|
7
9
|
// src/primitives/audit.ts
|
|
8
10
|
import { z as z2 } from "zod";
|
package/dist/react.js
CHANGED
package/dist/remote.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
createClient
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-7ag81v2f.js";
|
|
5
|
+
import"./index-hb5pf3s4.js";
|
|
6
|
+
import"./index-fxz0v7vg.js";
|
|
5
7
|
import {
|
|
6
8
|
mergeMeta
|
|
7
|
-
} from "./index-
|
|
9
|
+
} from "./index-y01f4223.js";
|
|
10
|
+
import"./index-6k1937bx.js";
|
|
8
11
|
import {
|
|
9
12
|
AppError
|
|
10
13
|
} from "./index-0w9abg87.js";
|
|
14
|
+
import"./index-kzfs85xp.js";
|
|
11
15
|
import {
|
|
12
16
|
isRecord
|
|
13
|
-
} from "./index-
|
|
17
|
+
} from "./index-77fekveh.js";
|
|
14
18
|
|
|
15
19
|
// src/tools/remote.ts
|
|
16
20
|
var HTTP_ONLY = Object.freeze(["HTTP"]);
|