stitchkit 0.76.2 → 0.78.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-coding-tools.js +1 -1
- package/dist/agent-runtime-harness.js +6 -6
- package/dist/agent-runtime.js +11 -11
- package/dist/application/decisions.d.ts +89 -0
- package/dist/application/decisions.d.ts.map +1 -0
- package/dist/application/kernel.d.ts +35 -1
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/keyspace.d.ts +11 -1
- package/dist/application/keyspace.d.ts.map +1 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/server-resource.d.ts.map +1 -1
- package/dist/application-diagnostic-journal.d.ts +21 -0
- package/dist/application-diagnostic-journal.d.ts.map +1 -0
- package/dist/application-diagnostic-journal.js +714 -0
- package/dist/application-opentelemetry.js +92 -5
- package/dist/application-schemas.d.ts +15 -0
- package/dist/application-schemas.d.ts.map +1 -0
- package/dist/application-schemas.js +26 -0
- package/dist/application.d.ts +3 -3
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +1832 -844
- package/dist/cli.js +7 -7
- package/dist/contract/index.js +9 -7
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files.js +1 -1
- package/dist/{index-3z73fh2c.js → index-1ckavx4h.js} +49 -1
- package/dist/{index-s2rchahr.js → index-31k1ns1s.js} +4 -4
- package/dist/{index-m668wzyc.js → index-4ntp63ps.js} +4 -4
- package/dist/{index-1rxswfbv.js → index-56fm73re.js} +1 -1
- package/dist/{index-ezmn6ac6.js → index-5r0ak8fr.js} +3 -3
- package/dist/{index-f6n5n7nz.js → index-7z69kyrh.js} +10 -87
- package/dist/{index-k2zczx1g.js → index-93xp5tgg.js} +1 -1
- package/dist/{index-bfcpjw20.js → index-actkayzn.js} +7 -3
- package/dist/index-anyqnqcv.js +79 -0
- package/dist/{index-7qy2ex0m.js → index-cwp38wxn.js} +1 -1
- package/dist/{index-35z5h2ty.js → index-dmfn9m4x.js} +125 -4
- package/dist/index-h4pj6fta.js +87 -0
- package/dist/{index-jqtsc9mj.js → index-j6mfaw26.js} +2 -2
- package/dist/{index-58jzmnn4.js → index-k45qqrdh.js} +513 -39
- package/dist/{index-8eywc9zv.js → index-kw12fsbc.js} +0 -1
- package/dist/index-n1g2xm6a.js +203 -0
- package/dist/{index-t8qyvrvg.js → index-n7apa6sy.js} +12 -12
- package/dist/{index-s4c8wy8m.js → index-qaajjfp6.js} +8 -8
- package/dist/{index-nemjkxjp.js → index-s5tn4kdv.js} +14 -10
- package/dist/index-wfq8zerm.js +92 -0
- package/dist/index.js +53 -1215
- package/dist/internal/deadline.d.ts +17 -0
- package/dist/internal/deadline.d.ts.map +1 -0
- package/dist/internal/decision.d.ts +31 -0
- package/dist/internal/decision.d.ts.map +1 -0
- package/dist/live/events.d.ts +8 -13
- package/dist/live/events.d.ts.map +1 -1
- package/dist/live.d.ts +1 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +12 -89
- package/dist/node.js +5 -6
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/index.js +3 -3
- package/dist/primitives.js +2 -1
- package/dist/remote.js +3 -6
- package/dist/server/event-bus.d.ts +3 -2
- package/dist/server/event-bus.d.ts.map +1 -1
- package/dist/server/index.js +31 -30
- package/dist/testing.js +1562 -87
- package/dist/tool-invoker.js +6 -6
- package/dist/tools.js +66 -23
- package/llms-full.txt +276 -6
- package/package.json +12 -4
- package/dist/index-3cwck0rm.js +0 -897
- package/dist/index-7b188kmz.js +0 -49
- package/dist/index-a916km3r.js +0 -45
- package/dist/index-hvftzz91.js +0 -721
- package/dist/{index-da1aqnhb.js → index-aewy3x5j.js} +3 -3
- package/dist/{index-nt1mp8km.js → index-efm026pw.js} +3 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve to `{ settled: false }` if the value has not settled in time.
|
|
3
|
+
*
|
|
4
|
+
* One implementation, because two places need exactly this and they need it to
|
|
5
|
+
* behave identically: an event bus asking listeners to vote, and a decision
|
|
6
|
+
* pipeline asking policies to. A second copy would be a second set of bugs.
|
|
7
|
+
*
|
|
8
|
+
* The timer is always cleared: a dispatch must not be the reason a process stays
|
|
9
|
+
* alive, and an uncleared timer on every announcement is exactly that.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withDeadline(value: unknown, timeoutMs: number): Promise<{
|
|
12
|
+
settled: true;
|
|
13
|
+
value: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
settled: false;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=deadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../src/internal/deadline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAcjE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One answer to "may this happen?", from one answerer.
|
|
4
|
+
*
|
|
5
|
+
* Three outcomes and no fourth, because the third is the one that gets left out
|
|
6
|
+
* and then invented: `defer` means *not my call*, which is a different statement
|
|
7
|
+
* from `allow`. Collapsing them makes every answerer that had no opinion into an
|
|
8
|
+
* answerer that approved, and nothing in the result says which happened.
|
|
9
|
+
*
|
|
10
|
+
* `deny` carries its reason as a required field. A refusal without one reaches a
|
|
11
|
+
* human as "denied" and sends them to read the policy source to find out what
|
|
12
|
+
* they did, which is the moment a policy engine stops being worth having.
|
|
13
|
+
*
|
|
14
|
+
* Browser-safe and shared on purpose: an event listener voting on a topic
|
|
15
|
+
* (`stitchkit/live`) and a policy in an ordered pipeline
|
|
16
|
+
* (`stitchkit/application`) are different mechanisms answering the same
|
|
17
|
+
* question, and one question with two vocabularies is a codebase where `grep`
|
|
18
|
+
* finds half the answerers.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PolicyDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
outcome: z.ZodLiteral<"allow">;
|
|
22
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
23
|
+
outcome: z.ZodLiteral<"deny">;
|
|
24
|
+
reason: z.ZodString;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
outcome: z.ZodLiteral<"defer">;
|
|
27
|
+
}, z.core.$strict>], "outcome">;
|
|
28
|
+
export type PolicyDecision = z.infer<typeof PolicyDecisionSchema>;
|
|
29
|
+
/** What is concluded when nobody claimed the question — see each mechanism for which it uses. */
|
|
30
|
+
export type UndecidedOutcome = 'allow' | 'deny';
|
|
31
|
+
//# sourceMappingURL=decision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/internal/decision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;+BAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,iGAAiG;AACjG,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAC"}
|
package/dist/live/events.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* → ADR 0150.
|
|
22
22
|
*/
|
|
23
23
|
import { z } from 'zod';
|
|
24
|
+
import type { UndecidedOutcome } from '../internal/decision.js';
|
|
24
25
|
import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contract.js';
|
|
25
26
|
/**
|
|
26
27
|
* How a topic reaches the listeners registered for it **in this process**.
|
|
@@ -38,23 +39,17 @@ import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contra
|
|
|
38
39
|
*/
|
|
39
40
|
export type EventDeliveryMode = 'emit' | 'serial' | 'decision';
|
|
40
41
|
/**
|
|
41
|
-
* One listener's vote on a `decision` topic
|
|
42
|
+
* One listener's vote on a `decision` topic — the framework's one decision
|
|
43
|
+
* vocabulary, shared with the policy pipeline in `stitchkit/application`.
|
|
42
44
|
*
|
|
43
45
|
* `defer` is a real answer — "not my call" — and it is distinct from `allow` on
|
|
44
46
|
* purpose: an event where every listener defers is one nobody claimed, and what
|
|
45
47
|
* should happen then is a policy the topic has to state rather than a default
|
|
46
|
-
* somebody guesses. See `whenAllDefer`.
|
|
48
|
+
* somebody guesses. See `whenAllDefer`. (A policy pipeline treats that ending
|
|
49
|
+
* as a defect instead, because an operation nothing decided cannot be answered
|
|
50
|
+
* either way; same words, different mechanisms, and each says which it is.)
|
|
47
51
|
*/
|
|
48
|
-
export type
|
|
49
|
-
readonly outcome: 'allow';
|
|
50
|
-
} | {
|
|
51
|
-
readonly outcome: 'deny';
|
|
52
|
-
readonly reason: string;
|
|
53
|
-
} | {
|
|
54
|
-
readonly outcome: 'defer';
|
|
55
|
-
};
|
|
56
|
-
/** What a `decision` topic concludes when every listener deferred, or there were none. */
|
|
57
|
-
export type EventUndecided = 'allow' | 'deny';
|
|
52
|
+
export type { PolicyDecision, UndecidedOutcome } from '../internal/decision.js';
|
|
58
53
|
export interface EventTopicDeclaration<TSchema extends z.ZodType = z.ZodType> {
|
|
59
54
|
/** The payload schema. One payload per topic — a topic is not a function call. */
|
|
60
55
|
readonly schema: TSchema;
|
|
@@ -67,7 +62,7 @@ export interface EventTopicDeclaration<TSchema extends z.ZodType = z.ZodType> {
|
|
|
67
62
|
* every topic whose author never thought about it. Both are decisions; a
|
|
68
63
|
* default makes them silently.
|
|
69
64
|
*/
|
|
70
|
-
readonly whenAllDefer?:
|
|
65
|
+
readonly whenAllDefer?: UndecidedOutcome;
|
|
71
66
|
/**
|
|
72
67
|
* How long one listener may take on a `serial` or `decision` topic before the
|
|
73
68
|
* dispatcher stops waiting for it, in milliseconds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/live/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/live/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEpF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO;IAC1E,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IACzC;;;;;;;;;OASG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AC,GAClE;KACG,MAAM,IAAI,MAAM,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS;QAC/E,IAAI,EAAE,KAAK,CAAC;KACb,GACG,MAAM,GACN,KAAK;CACV,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC,GAC7B,MAAM,GACR,KAAK,CAAC;AAcZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,KAAK,CAAC,OAAO,SAAS,YAAY,EAClC,KAAK,CAAC,OAAO,SAAS,kBAAkB,EAExC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,GACd,iBAAiB,CAClB,OAAO,SAAS;IAAE,MAAM,EAAE,MAAM,OAAO,SAAS,MAAM,CAAA;CAAE,GAAG,OAAO,GAAG,SAAS,EAC9E,OAAO,CACR,CAkDA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,SAAS,MAAM,GAAG,SAAS,EAClC,OAAO,SAAS,kBAAkB,EAElC,WAAW,EAAE,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,GAC/C,gBAAgB,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAShE"}
|
package/dist/live.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* delivery is `createEventBus` from `stitchkit/server`, and the server halves of
|
|
13
13
|
* a watched read live in `stitchkit/application`. → ADR 0150.
|
|
14
14
|
*/
|
|
15
|
-
export { defineEvents, type
|
|
15
|
+
export { defineEvents, type EventDeliveryMode, type EventPayloads, type EventsConfig, type EventsDeclaration, type EventTopicDeclaration, type EventTopicRegistry, type EventTopicsOfMode, type PolicyDecision, toRealtimeContract, type UndecidedOutcome, type WireTopic, } from './live/events.js';
|
|
16
16
|
export { createWatchClient, type RealtimeClientLike, type TypedWatchClient, type WatchClientConfig, type WatchHandle, type WatchInboundEvents, type WatchListeners, type WatchTransport, watchTransport, } from './live/watch-client.js';
|
|
17
17
|
export { WATCH_CLOSE, WATCH_OPEN, WATCH_STATE, WATCH_VALUE, type WatchKey, WatchKeySchema, type WatchStateFrame, WatchStateSchema, type WatchValueFrame, WatchValueSchema, watchContract, watchKeyString, } from './live/watch-contract.js';
|
|
18
18
|
//# sourceMappingURL=live.d.ts.map
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,YAAY,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,KAAK,QAAQ,EACb,cAAc,EACd,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,eAAe,EACpB,gBAAgB,EAChB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC"}
|
package/dist/live.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
WATCH_CLOSE,
|
|
3
|
+
WATCH_OPEN,
|
|
4
|
+
WATCH_STATE,
|
|
5
|
+
WATCH_VALUE,
|
|
6
|
+
WatchKeySchema,
|
|
7
|
+
WatchStateSchema,
|
|
8
|
+
WatchValueSchema,
|
|
9
|
+
argumentsDigest,
|
|
10
|
+
watchContract,
|
|
11
|
+
watchKeyString
|
|
12
|
+
} from "./index-wfq8zerm.js";
|
|
13
|
+
import"./index-dmfn9m4x.js";
|
|
5
14
|
|
|
6
15
|
// src/live/events.ts
|
|
7
16
|
import { z } from "zod";
|
|
@@ -53,92 +62,6 @@ function toRealtimeContract(declaration) {
|
|
|
53
62
|
}
|
|
54
63
|
return { serverToClient, clientToServer: {} };
|
|
55
64
|
}
|
|
56
|
-
// src/internal/stable-digest.ts
|
|
57
|
-
function stableValue(value) {
|
|
58
|
-
if (Array.isArray(value))
|
|
59
|
-
return value.map(stableValue);
|
|
60
|
-
if (value === null || typeof value !== "object")
|
|
61
|
-
return value;
|
|
62
|
-
const result = {};
|
|
63
|
-
for (const key of Object.keys(value).sort()) {
|
|
64
|
-
result[key] = stableValue(Reflect.get(value, key));
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
function mix128(input) {
|
|
69
|
-
let a = 2654435769;
|
|
70
|
-
let b = 2246822507;
|
|
71
|
-
let c = 3266489909;
|
|
72
|
-
let d = 668265263;
|
|
73
|
-
for (let index = 0;index < input.length; index += 1) {
|
|
74
|
-
const code = input.charCodeAt(index);
|
|
75
|
-
a = Math.imul(a ^ code, 2246822519);
|
|
76
|
-
b = Math.imul(b ^ code, 3266489917);
|
|
77
|
-
c = Math.imul(c ^ code, 668265263);
|
|
78
|
-
d = Math.imul(d ^ code, 374761393);
|
|
79
|
-
a = a << 13 | a >>> 19;
|
|
80
|
-
b = b << 17 | b >>> 15;
|
|
81
|
-
c = c << 7 | c >>> 25;
|
|
82
|
-
d = d << 11 | d >>> 21;
|
|
83
|
-
}
|
|
84
|
-
a ^= b >>> 15;
|
|
85
|
-
b ^= c >>> 13;
|
|
86
|
-
c ^= d >>> 11;
|
|
87
|
-
d ^= a >>> 9;
|
|
88
|
-
return [
|
|
89
|
-
Math.imul(a ^ a >>> 16, 575075507) >>> 0,
|
|
90
|
-
Math.imul(b ^ b >>> 13, 2654435761) >>> 0,
|
|
91
|
-
Math.imul(c ^ c >>> 16, 2246822507) >>> 0,
|
|
92
|
-
Math.imul(d ^ d >>> 15, 3266489909) >>> 0
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
function argumentsDigest(args) {
|
|
96
|
-
const lanes = mix128(JSON.stringify(stableValue(args)) ?? "undefined");
|
|
97
|
-
return lanes.map((lane) => lane.toString(16).padStart(8, "0")).join("");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/live/watch-contract.ts
|
|
101
|
-
import { z as z2 } from "zod";
|
|
102
|
-
var WatchKeySchema = z2.object({
|
|
103
|
-
service: z2.string().min(1),
|
|
104
|
-
action: z2.string().min(1),
|
|
105
|
-
digest: z2.string().min(1)
|
|
106
|
-
}).strict().readonly();
|
|
107
|
-
var WatchOpenSchema = z2.object({ key: WatchKeySchema, args: z2.unknown() }).readonly();
|
|
108
|
-
var WatchAcceptedSchema = z2.object({
|
|
109
|
-
accepted: z2.boolean(),
|
|
110
|
-
reason: z2.string().optional()
|
|
111
|
-
}).strict().readonly();
|
|
112
|
-
var WatchValueSchema = z2.object({
|
|
113
|
-
key: WatchKeySchema,
|
|
114
|
-
revision: z2.number().int().nonnegative(),
|
|
115
|
-
value: z2.unknown()
|
|
116
|
-
}).readonly();
|
|
117
|
-
var WatchStateSchema = z2.object({
|
|
118
|
-
key: WatchKeySchema,
|
|
119
|
-
phase: LiveStatePhaseSchema,
|
|
120
|
-
reason: LiveStateStopReasonSchema.optional(),
|
|
121
|
-
code: z2.string().optional(),
|
|
122
|
-
message: z2.string().optional()
|
|
123
|
-
}).readonly();
|
|
124
|
-
var WATCH_OPEN = "stitchkit.watch.open";
|
|
125
|
-
var WATCH_CLOSE = "stitchkit.watch.close";
|
|
126
|
-
var WATCH_VALUE = "stitchkit.watch.value";
|
|
127
|
-
var WATCH_STATE = "stitchkit.watch.state";
|
|
128
|
-
var watchContract = {
|
|
129
|
-
serverToClient: {
|
|
130
|
-
[WATCH_VALUE]: { args: z2.tuple([WatchValueSchema]) },
|
|
131
|
-
[WATCH_STATE]: { args: z2.tuple([WatchStateSchema]) }
|
|
132
|
-
},
|
|
133
|
-
clientToServer: {
|
|
134
|
-
[WATCH_OPEN]: { args: z2.tuple([WatchOpenSchema]), ack: WatchAcceptedSchema },
|
|
135
|
-
[WATCH_CLOSE]: { args: z2.tuple([z2.object({ key: WatchKeySchema }).readonly()]) }
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
function watchKeyString(key) {
|
|
139
|
-
return `${key.service}/${key.action}/${key.digest}`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
65
|
// src/live/watch-client.ts
|
|
143
66
|
function watchTransport(client) {
|
|
144
67
|
return client;
|
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-n7apa6sy.js";
|
|
9
9
|
import {
|
|
10
10
|
createImplement,
|
|
11
11
|
createImplementRegistry,
|
|
@@ -15,17 +15,17 @@ import {
|
|
|
15
15
|
implement,
|
|
16
16
|
implementRegistry
|
|
17
17
|
} from "./index-vbf2p6me.js";
|
|
18
|
-
import"./index-nemjkxjp.js";
|
|
19
|
-
import"./index-7b188kmz.js";
|
|
20
18
|
import {
|
|
21
19
|
ShutdownOptionsSchema,
|
|
22
20
|
ShutdownResultSchema,
|
|
23
21
|
ShutdownStateSchema,
|
|
24
22
|
ShutdownStatusSchema,
|
|
25
23
|
createServerLifecycle
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
24
|
+
} from "./index-1ckavx4h.js";
|
|
25
|
+
import"./index-s5tn4kdv.js";
|
|
26
|
+
import"./index-efm026pw.js";
|
|
28
27
|
import"./index-vj3vvpaa.js";
|
|
28
|
+
import"./index-qyrqwr4c.js";
|
|
29
29
|
import {
|
|
30
30
|
AppError,
|
|
31
31
|
appError,
|
|
@@ -36,7 +36,6 @@ import {
|
|
|
36
36
|
rateLimited,
|
|
37
37
|
unauthorized
|
|
38
38
|
} from "./index-0w9abg87.js";
|
|
39
|
-
import"./index-qyrqwr4c.js";
|
|
40
39
|
import"./index-6k1937bx.js";
|
|
41
40
|
// src/server/node.ts
|
|
42
41
|
import { serve } from "srvx/node";
|
|
@@ -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;AAEnD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjE,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,M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|
25
25
|
import {
|
|
26
26
|
childSpan,
|
|
27
27
|
createTraceContext,
|
|
@@ -30,12 +30,12 @@ import {
|
|
|
30
30
|
recordedErrorMessage,
|
|
31
31
|
resolvePropagationContext,
|
|
32
32
|
resolveTraceContext
|
|
33
|
-
} from "../index-
|
|
33
|
+
} from "../index-efm026pw.js";
|
|
34
34
|
import"../index-vj3vvpaa.js";
|
|
35
|
-
import"../index-0w9abg87.js";
|
|
36
35
|
import {
|
|
37
36
|
isRecord
|
|
38
37
|
} from "../index-qyrqwr4c.js";
|
|
38
|
+
import"../index-0w9abg87.js";
|
|
39
39
|
import"../index-6k1937bx.js";
|
|
40
40
|
|
|
41
41
|
// src/observability/audit.ts
|
package/dist/primitives.js
CHANGED
package/dist/remote.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
createClient
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-1rxswfbv.js";
|
|
6
|
-
import"./index-nt1mp8km.js";
|
|
4
|
+
} from "./index-k45qqrdh.js";
|
|
7
5
|
import {
|
|
8
6
|
mergeMeta
|
|
9
|
-
} from "./index-
|
|
7
|
+
} from "./index-7z69kyrh.js";
|
|
10
8
|
import {
|
|
11
9
|
AppError
|
|
12
10
|
} from "./index-0w9abg87.js";
|
|
13
11
|
import {
|
|
14
12
|
isRecord
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-6k1937bx.js";
|
|
13
|
+
} from "./index-ksp6e2ye.js";
|
|
17
14
|
|
|
18
15
|
// src/tools/remote.ts
|
|
19
16
|
var HTTP_ONLY = Object.freeze(["HTTP"]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PolicyDecision } from '../internal/decision.js';
|
|
2
|
+
import type { EventTopicDeclaration } from '../live/events.js';
|
|
2
3
|
/**
|
|
3
4
|
* A listener's return value.
|
|
4
5
|
*
|
|
@@ -50,7 +51,7 @@ export interface EventBus<M extends Record<string, unknown> = DefaultEventMap> {
|
|
|
50
51
|
* the same isolation would mean "counted as consent". A listener that was
|
|
51
52
|
* asked and did not answer has not agreed.
|
|
52
53
|
*/
|
|
53
|
-
decide<K extends keyof M & string>(event: K, data: M[K]): Promise<
|
|
54
|
+
decide<K extends keyof M & string>(event: K, data: M[K]): Promise<PolicyDecision>;
|
|
54
55
|
on<K extends keyof M & string>(event: K, handler: EventHandler<M[K]>): () => void;
|
|
55
56
|
once<K extends keyof M & string>(event: K, handler: EventHandler<M[K]>): () => void;
|
|
56
57
|
off<K extends keyof M & string>(event: K, handler: EventHandler<M[K]>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/server/event-bus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/server/event-bus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;AAE7D,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;IAC3E;;;OAGG;IACH,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7D;;;;;;OAMG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC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/server/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
sseRoute,
|
|
14
14
|
streamingRoute,
|
|
15
15
|
webSocketLane
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-n7apa6sy.js";
|
|
17
17
|
import {
|
|
18
18
|
composeAuthHooks,
|
|
19
19
|
createAuthHook,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
signJwt,
|
|
27
27
|
verifyJwt,
|
|
28
28
|
verifyPkce
|
|
29
|
-
} from "../index-
|
|
29
|
+
} from "../index-aewy3x5j.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_CORS_ALLOW_HEADERS,
|
|
32
32
|
DEFAULT_CORS_EXPOSE_HEADERS,
|
|
@@ -41,47 +41,49 @@ import {
|
|
|
41
41
|
implement,
|
|
42
42
|
implementRegistry
|
|
43
43
|
} from "../index-vbf2p6me.js";
|
|
44
|
-
import {
|
|
45
|
-
extractIp,
|
|
46
|
-
generateTraceId,
|
|
47
|
-
getClientInfo,
|
|
48
|
-
getTraceId,
|
|
49
|
-
isPublicIp,
|
|
50
|
-
resolveSocketIp,
|
|
51
|
-
resolveTraceId
|
|
52
|
-
} from "../index-nemjkxjp.js";
|
|
53
44
|
import {
|
|
54
45
|
isWithinDir,
|
|
55
46
|
realPathWithinDir
|
|
56
47
|
} from "../index-sbdmyz75.js";
|
|
57
|
-
import
|
|
48
|
+
import {
|
|
49
|
+
inputIsQuery,
|
|
50
|
+
parseSSE,
|
|
51
|
+
streamSSE
|
|
52
|
+
} from "../index-56fm73re.js";
|
|
58
53
|
import {
|
|
59
54
|
ShutdownOptionsSchema,
|
|
60
55
|
ShutdownResultSchema,
|
|
61
56
|
ShutdownStateSchema,
|
|
62
57
|
ShutdownStatusSchema,
|
|
63
58
|
createServerLifecycle
|
|
64
|
-
} from "../index-
|
|
59
|
+
} from "../index-1ckavx4h.js";
|
|
65
60
|
import {
|
|
66
61
|
jsonSchemaFields,
|
|
67
62
|
toJsonSchema
|
|
68
63
|
} from "../index-cby4ar3v.js";
|
|
69
64
|
import {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
extractIp,
|
|
66
|
+
generateTraceId,
|
|
67
|
+
getClientInfo,
|
|
68
|
+
getTraceId,
|
|
69
|
+
isPublicIp,
|
|
70
|
+
resolveSocketIp,
|
|
71
|
+
resolveTraceId
|
|
72
|
+
} from "../index-s5tn4kdv.js";
|
|
74
73
|
import {
|
|
75
74
|
errorCode,
|
|
76
75
|
formatZodError,
|
|
77
76
|
normalizeError,
|
|
78
77
|
zodIssues
|
|
79
|
-
} from "../index-
|
|
78
|
+
} from "../index-efm026pw.js";
|
|
80
79
|
import {
|
|
81
80
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
82
81
|
joinRoutePath,
|
|
83
82
|
parseTrailingWildcard
|
|
84
83
|
} from "../index-vj3vvpaa.js";
|
|
84
|
+
import {
|
|
85
|
+
isRecord
|
|
86
|
+
} from "../index-qyrqwr4c.js";
|
|
85
87
|
import {
|
|
86
88
|
AppError,
|
|
87
89
|
STITCH_ERROR_STATUS,
|
|
@@ -94,9 +96,6 @@ import {
|
|
|
94
96
|
rateLimited,
|
|
95
97
|
unauthorized
|
|
96
98
|
} from "../index-0w9abg87.js";
|
|
97
|
-
import {
|
|
98
|
-
isRecord
|
|
99
|
-
} from "../index-qyrqwr4c.js";
|
|
100
99
|
import"../index-6k1937bx.js";
|
|
101
100
|
// src/server/bun.ts
|
|
102
101
|
import { chmodSync, statSync, unlinkSync } from "node:fs";
|
|
@@ -405,15 +404,7 @@ function createErrorHook(config) {
|
|
|
405
404
|
});
|
|
406
405
|
};
|
|
407
406
|
}
|
|
408
|
-
// src/
|
|
409
|
-
function isDecision(value) {
|
|
410
|
-
if (typeof value !== "object" || value === null)
|
|
411
|
-
return false;
|
|
412
|
-
const outcome = Reflect.get(value, "outcome");
|
|
413
|
-
if (outcome === "allow" || outcome === "defer")
|
|
414
|
-
return true;
|
|
415
|
-
return outcome === "deny" && typeof Reflect.get(value, "reason") === "string";
|
|
416
|
-
}
|
|
407
|
+
// src/internal/deadline.ts
|
|
417
408
|
async function withDeadline(value, timeoutMs) {
|
|
418
409
|
if (!(value instanceof Promise))
|
|
419
410
|
return { settled: true, value };
|
|
@@ -431,6 +422,16 @@ async function withDeadline(value, timeoutMs) {
|
|
|
431
422
|
clearTimeout(timer);
|
|
432
423
|
}
|
|
433
424
|
}
|
|
425
|
+
|
|
426
|
+
// src/server/event-bus.ts
|
|
427
|
+
function isDecision(value) {
|
|
428
|
+
if (typeof value !== "object" || value === null)
|
|
429
|
+
return false;
|
|
430
|
+
const outcome = Reflect.get(value, "outcome");
|
|
431
|
+
if (outcome === "allow" || outcome === "defer")
|
|
432
|
+
return true;
|
|
433
|
+
return outcome === "deny" && typeof Reflect.get(value, "reason") === "string";
|
|
434
|
+
}
|
|
434
435
|
function createEventBus(options = {}) {
|
|
435
436
|
const subscriptions = new Map;
|
|
436
437
|
const declared = options.topics;
|