reactor-effect-client 0.0.0-reserved.0 → 0.2.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/LICENSE +201 -0
- package/NOTICE +29 -0
- package/README.md +124 -2
- package/dist/FetchHttp.d.ts +9 -0
- package/dist/FetchHttp.d.ts.map +1 -0
- package/dist/FetchHttp.js +63 -0
- package/dist/FetchHttp.js.map +1 -0
- package/dist/PeerFactory.d.ts +15 -0
- package/dist/PeerFactory.d.ts.map +1 -0
- package/dist/PeerFactory.js +4 -0
- package/dist/PeerFactory.js.map +1 -0
- package/dist/PeerTypes.d.ts +64 -0
- package/dist/PeerTypes.d.ts.map +1 -0
- package/dist/PeerTypes.js +2 -0
- package/dist/PeerTypes.js.map +1 -0
- package/dist/Sequence.d.ts +81 -0
- package/dist/Sequence.d.ts.map +1 -0
- package/dist/Sequence.js +215 -0
- package/dist/Sequence.js.map +1 -0
- package/dist/SessionTypes.d.ts +164 -0
- package/dist/SessionTypes.d.ts.map +1 -0
- package/dist/SessionTypes.js +2 -0
- package/dist/SessionTypes.js.map +1 -0
- package/dist/Submission.d.ts +42 -0
- package/dist/Submission.d.ts.map +1 -0
- package/dist/Submission.js +52 -0
- package/dist/Submission.js.map +1 -0
- package/dist/bytes.d.ts +6 -0
- package/dist/bytes.d.ts.map +1 -0
- package/dist/bytes.js +32 -0
- package/dist/bytes.js.map +1 -0
- package/dist/contract.d.ts +58 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +87 -0
- package/dist/contract.js.map +1 -0
- package/dist/coordinator/_internal/client.d.ts +127 -0
- package/dist/coordinator/_internal/client.d.ts.map +1 -0
- package/dist/coordinator/_internal/client.js +450 -0
- package/dist/coordinator/_internal/client.js.map +1 -0
- package/dist/coordinator/_internal/response.d.ts +15 -0
- package/dist/coordinator/_internal/response.d.ts.map +1 -0
- package/dist/coordinator/_internal/response.js +57 -0
- package/dist/coordinator/_internal/response.js.map +1 -0
- package/dist/coordinator/_internal/schemas.d.ts +51 -0
- package/dist/coordinator/_internal/schemas.d.ts.map +1 -0
- package/dist/coordinator/_internal/schemas.js +170 -0
- package/dist/coordinator/_internal/schemas.js.map +1 -0
- package/dist/coordinator/index.d.ts +28 -0
- package/dist/coordinator/index.d.ts.map +1 -0
- package/dist/coordinator/index.js +25 -0
- package/dist/coordinator/index.js.map +1 -0
- package/dist/correlation.d.ts +32 -0
- package/dist/correlation.d.ts.map +1 -0
- package/dist/correlation.js +113 -0
- package/dist/correlation.js.map +1 -0
- package/dist/errors.d.ts +88 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +93 -0
- package/dist/errors.js.map +1 -0
- package/dist/h3/_internal/client.d.ts +9 -0
- package/dist/h3/_internal/client.d.ts.map +1 -0
- package/dist/h3/_internal/client.js +510 -0
- package/dist/h3/_internal/client.js.map +1 -0
- package/dist/h3/_internal/contracts.d.ts +123 -0
- package/dist/h3/_internal/contracts.d.ts.map +1 -0
- package/dist/h3/_internal/contracts.js +113 -0
- package/dist/h3/_internal/contracts.js.map +1 -0
- package/dist/h3/_internal/deployment.d.ts +8 -0
- package/dist/h3/_internal/deployment.d.ts.map +1 -0
- package/dist/h3/_internal/deployment.js +132 -0
- package/dist/h3/_internal/deployment.js.map +1 -0
- package/dist/h3/_internal/evidence.d.ts +17 -0
- package/dist/h3/_internal/evidence.d.ts.map +1 -0
- package/dist/h3/_internal/evidence.js +48 -0
- package/dist/h3/_internal/evidence.js.map +1 -0
- package/dist/h3/_internal/references.d.ts +18 -0
- package/dist/h3/_internal/references.d.ts.map +1 -0
- package/dist/h3/_internal/references.js +186 -0
- package/dist/h3/_internal/references.js.map +1 -0
- package/dist/h3/_internal/request.d.ts +16 -0
- package/dist/h3/_internal/request.d.ts.map +1 -0
- package/dist/h3/_internal/request.js +79 -0
- package/dist/h3/_internal/request.js.map +1 -0
- package/dist/h3/_internal/state.d.ts +30 -0
- package/dist/h3/_internal/state.d.ts.map +1 -0
- package/dist/h3/_internal/state.js +243 -0
- package/dist/h3/_internal/state.js.map +1 -0
- package/dist/h3/index.d.ts +10 -0
- package/dist/h3/index.d.ts.map +1 -0
- package/dist/h3/index.js +7 -0
- package/dist/h3/index.js.map +1 -0
- package/dist/h3/messages.d.ts +310 -0
- package/dist/h3/messages.d.ts.map +1 -0
- package/dist/h3/messages.js +114 -0
- package/dist/h3/messages.js.map +1 -0
- package/dist/h3/profile.d.ts +109 -0
- package/dist/h3/profile.d.ts.map +1 -0
- package/dist/h3/profile.js +70 -0
- package/dist/h3/profile.js.map +1 -0
- package/dist/h3/types.d.ts +173 -0
- package/dist/h3/types.d.ts.map +1 -0
- package/dist/h3/types.js +2 -0
- package/dist/h3/types.js.map +1 -0
- package/dist/host.d.ts +25 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +20 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +18 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +123 -0
- package/dist/json.js.map +1 -0
- package/dist/media-stream.d.ts +10 -0
- package/dist/media-stream.d.ts.map +1 -0
- package/dist/media-stream.js +20 -0
- package/dist/media-stream.js.map +1 -0
- package/dist/observation.d.ts +26 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +106 -0
- package/dist/observation.js.map +1 -0
- package/dist/orchestration/h3-source.d.ts +30 -0
- package/dist/orchestration/h3-source.d.ts.map +1 -0
- package/dist/orchestration/h3-source.js +303 -0
- package/dist/orchestration/h3-source.js.map +1 -0
- package/dist/orchestration/index.d.ts +12 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +9 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/media-buffer.d.ts +23 -0
- package/dist/orchestration/media-buffer.d.ts.map +1 -0
- package/dist/orchestration/media-buffer.js +73 -0
- package/dist/orchestration/media-buffer.js.map +1 -0
- package/dist/orchestration/queries.d.ts +10 -0
- package/dist/orchestration/queries.d.ts.map +1 -0
- package/dist/orchestration/queries.js +40 -0
- package/dist/orchestration/queries.js.map +1 -0
- package/dist/orchestration/references.d.ts +16 -0
- package/dist/orchestration/references.d.ts.map +1 -0
- package/dist/orchestration/references.js +76 -0
- package/dist/orchestration/references.js.map +1 -0
- package/dist/orchestration/renewal-state.d.ts +58 -0
- package/dist/orchestration/renewal-state.d.ts.map +1 -0
- package/dist/orchestration/renewal-state.js +60 -0
- package/dist/orchestration/renewal-state.js.map +1 -0
- package/dist/orchestration/renewal.d.ts +76 -0
- package/dist/orchestration/renewal.d.ts.map +1 -0
- package/dist/orchestration/renewal.js +633 -0
- package/dist/orchestration/renewal.js.map +1 -0
- package/dist/orchestration/request.d.ts +53 -0
- package/dist/orchestration/request.d.ts.map +1 -0
- package/dist/orchestration/request.js +122 -0
- package/dist/orchestration/request.js.map +1 -0
- package/dist/orchestration/routing.d.ts +21 -0
- package/dist/orchestration/routing.d.ts.map +1 -0
- package/dist/orchestration/routing.js +90 -0
- package/dist/orchestration/routing.js.map +1 -0
- package/dist/orchestration/source-slot.d.ts +99 -0
- package/dist/orchestration/source-slot.d.ts.map +1 -0
- package/dist/orchestration/source-slot.js +206 -0
- package/dist/orchestration/source-slot.js.map +1 -0
- package/dist/orchestration/types.d.ts +334 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +11 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/protobuf.d.ts +63 -0
- package/dist/protobuf.d.ts.map +1 -0
- package/dist/protobuf.js +252 -0
- package/dist/protobuf.js.map +1 -0
- package/dist/session/_internal/acquire.d.ts +23 -0
- package/dist/session/_internal/acquire.d.ts.map +1 -0
- package/dist/session/_internal/acquire.js +167 -0
- package/dist/session/_internal/acquire.js.map +1 -0
- package/dist/session/_internal/cleanup.d.ts +18 -0
- package/dist/session/_internal/cleanup.d.ts.map +1 -0
- package/dist/session/_internal/cleanup.js +94 -0
- package/dist/session/_internal/cleanup.js.map +1 -0
- package/dist/session/_internal/lifecycle.d.ts +62 -0
- package/dist/session/_internal/lifecycle.d.ts.map +1 -0
- package/dist/session/_internal/lifecycle.js +132 -0
- package/dist/session/_internal/lifecycle.js.map +1 -0
- package/dist/session/_internal/remote.d.ts +28 -0
- package/dist/session/_internal/remote.d.ts.map +1 -0
- package/dist/session/_internal/remote.js +61 -0
- package/dist/session/_internal/remote.js.map +1 -0
- package/dist/session/_internal/uploads.d.ts +4 -0
- package/dist/session/_internal/uploads.d.ts.map +1 -0
- package/dist/session/_internal/uploads.js +33 -0
- package/dist/session/_internal/uploads.js.map +1 -0
- package/dist/session/commands.d.ts +22 -0
- package/dist/session/commands.d.ts.map +1 -0
- package/dist/session/commands.js +13 -0
- package/dist/session/commands.js.map +1 -0
- package/dist/session/files.d.ts +15 -0
- package/dist/session/files.d.ts.map +1 -0
- package/dist/session/files.js +54 -0
- package/dist/session/files.js.map +1 -0
- package/dist/session/index.d.ts +76 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +16 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/media.d.ts +67 -0
- package/dist/session/media.d.ts.map +1 -0
- package/dist/session/media.js +2 -0
- package/dist/session/media.js.map +1 -0
- package/dist/session.d.ts +104 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +872 -0
- package/dist/session.js.map +1 -0
- package/dist/simulation/_internal/source.d.ts +12 -0
- package/dist/simulation/_internal/source.d.ts.map +1 -0
- package/dist/simulation/_internal/source.js +477 -0
- package/dist/simulation/_internal/source.js.map +1 -0
- package/dist/simulation/index.d.ts +14 -0
- package/dist/simulation/index.d.ts.map +1 -0
- package/dist/simulation/index.js +13 -0
- package/dist/simulation/index.js.map +1 -0
- package/dist/simulation/types.d.ts +29 -0
- package/dist/simulation/types.d.ts.map +1 -0
- package/dist/simulation/types.js +2 -0
- package/dist/simulation/types.js.map +1 -0
- package/dist/stats.d.ts +33 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +134 -0
- package/dist/stats.js.map +1 -0
- package/dist/testing/Faults.d.ts +4 -0
- package/dist/testing/Faults.d.ts.map +1 -0
- package/dist/testing/Faults.js +7 -0
- package/dist/testing/Faults.js.map +1 -0
- package/dist/testing/Png.d.ts +3 -0
- package/dist/testing/Png.d.ts.map +1 -0
- package/dist/testing/Png.js +68 -0
- package/dist/testing/Png.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/wire.d.ts +7 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.generated.d.ts +305 -0
- package/dist/wire.generated.d.ts.map +1 -0
- package/dist/wire.generated.js +1257 -0
- package/dist/wire.generated.js.map +1 -0
- package/dist/wire.js +5 -0
- package/dist/wire.js.map +1 -0
- package/notices/effect-LICENSE +21 -0
- package/notices/google-protobuf-LICENSE +32 -0
- package/notices/owned-webrtc/Effect-MIT.txt +21 -0
- package/notices/owned-webrtc/IETF.txt +43 -0
- package/notices/owned-webrtc/LICENSE +21 -0
- package/notices/owned-webrtc/UPSTREAM.md +20 -0
- package/notices/owned-webrtc/VP8-ADAPTATION.md +32 -0
- package/notices/owned-webrtc/VP8-AUTHORS.txt +42 -0
- package/notices/owned-webrtc/VP8-LICENSE.txt +25 -0
- package/notices/owned-webrtc/VP8-PATENTS.txt +21 -0
- package/notices/owned-webrtc/Werift-MIT.txt +21 -0
- package/notices/owned-webrtc/libvpx-v1.12.0-LICENSE.txt +28 -0
- package/notices/owned-webrtc/libvpx-v1.12.0-PATENTS.txt +22 -0
- package/notices/owned-webrtc/rfc3711.txt +3139 -0
- package/notices/owned-webrtc/str0m-MIT.txt +7 -0
- package/notices/owned-webrtc-LICENSE +21 -0
- package/notices/reactor-runtime-LICENSE +201 -0
- package/notices/reactor-runtime-NOTICE +5 -0
- package/notices/reactor-sdk-LICENSE +201 -0
- package/package.json +62 -4
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import type { MessageType } from "../messages.js";
|
|
3
|
+
/**
|
|
4
|
+
* One command-to-reply authority for deployment admission and client calls.
|
|
5
|
+
* Required keys describe what this adapter always supplies, not what a server
|
|
6
|
+
* must require. Nullable parameters describe the documented deployment shape;
|
|
7
|
+
* the adapter's outgoing arguments omit null and retain its existing validators.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Commands: {
|
|
10
|
+
readonly enqueue: {
|
|
11
|
+
readonly args: Schema.Struct<{
|
|
12
|
+
readonly prompt: Schema.String;
|
|
13
|
+
readonly reference_images: Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
14
|
+
readonly upload_id: Schema.String;
|
|
15
|
+
readonly name: Schema.String;
|
|
16
|
+
readonly mime_type: Schema.String;
|
|
17
|
+
readonly size: Schema.Int;
|
|
18
|
+
}>>>;
|
|
19
|
+
readonly seconds: Schema.optionalKey<Schema.NullOr<Schema.Number>>;
|
|
20
|
+
readonly seed: Schema.optionalKey<Schema.NullOr<Schema.Int>>;
|
|
21
|
+
readonly position: Schema.optionalKey<Schema.NullOr<Schema.Int>>;
|
|
22
|
+
readonly metadata: Schema.String;
|
|
23
|
+
readonly continue_from_clip_id: Schema.optionalKey<Schema.String>;
|
|
24
|
+
}>;
|
|
25
|
+
readonly reply: "clip_queued";
|
|
26
|
+
};
|
|
27
|
+
readonly move: {
|
|
28
|
+
readonly args: Schema.Struct<{
|
|
29
|
+
readonly clip_id: Schema.String;
|
|
30
|
+
readonly position: Schema.Int;
|
|
31
|
+
}>;
|
|
32
|
+
readonly reply: "clip_moved";
|
|
33
|
+
};
|
|
34
|
+
readonly pop: {
|
|
35
|
+
readonly args: Schema.Struct<{
|
|
36
|
+
readonly clip_id: Schema.String;
|
|
37
|
+
}>;
|
|
38
|
+
readonly reply: "clip_popped";
|
|
39
|
+
};
|
|
40
|
+
readonly play: {
|
|
41
|
+
readonly args: Schema.Struct<{
|
|
42
|
+
readonly clip_id: Schema.String;
|
|
43
|
+
}>;
|
|
44
|
+
readonly reply: null;
|
|
45
|
+
};
|
|
46
|
+
readonly stop: {
|
|
47
|
+
readonly args: Schema.$Record<Schema.String, Schema.Never>;
|
|
48
|
+
readonly reply: null;
|
|
49
|
+
};
|
|
50
|
+
readonly set_seed: {
|
|
51
|
+
readonly args: Schema.Struct<{
|
|
52
|
+
readonly seed: Schema.Int;
|
|
53
|
+
}>;
|
|
54
|
+
readonly reply: "seed_accepted";
|
|
55
|
+
};
|
|
56
|
+
readonly set_clip_seconds: {
|
|
57
|
+
readonly args: Schema.Struct<{
|
|
58
|
+
readonly seconds: Schema.Number;
|
|
59
|
+
}>;
|
|
60
|
+
readonly reply: "clip_length_accepted";
|
|
61
|
+
};
|
|
62
|
+
readonly set_canvas: {
|
|
63
|
+
readonly args: Schema.Struct<{
|
|
64
|
+
readonly aspect: Schema.String;
|
|
65
|
+
}>;
|
|
66
|
+
readonly reply: "canvas_accepted";
|
|
67
|
+
};
|
|
68
|
+
readonly set_autoplay: {
|
|
69
|
+
readonly args: Schema.Struct<{
|
|
70
|
+
readonly enabled: Schema.Boolean;
|
|
71
|
+
}>;
|
|
72
|
+
readonly reply: "autoplay_accepted";
|
|
73
|
+
};
|
|
74
|
+
readonly set_flush_on_clip_end: {
|
|
75
|
+
readonly args: Schema.Struct<{
|
|
76
|
+
readonly enabled: Schema.Boolean;
|
|
77
|
+
}>;
|
|
78
|
+
readonly reply: "flush_accepted";
|
|
79
|
+
};
|
|
80
|
+
readonly get_queue: {
|
|
81
|
+
readonly args: Schema.$Record<Schema.String, Schema.Never>;
|
|
82
|
+
readonly reply: "queue_update";
|
|
83
|
+
};
|
|
84
|
+
readonly get_state: {
|
|
85
|
+
readonly args: Schema.$Record<Schema.String, Schema.Never>;
|
|
86
|
+
readonly reply: "state_update";
|
|
87
|
+
};
|
|
88
|
+
readonly reset: {
|
|
89
|
+
readonly args: Schema.$Record<Schema.String, Schema.Never>;
|
|
90
|
+
readonly reply: "session_reset";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export type CommandName = keyof typeof Commands;
|
|
94
|
+
export type CommandArgs<K extends CommandName> = {
|
|
95
|
+
readonly [F in keyof (typeof Commands)[K]["args"]["Type"]]: Exclude<(typeof Commands)[K]["args"]["Type"][F], null>;
|
|
96
|
+
};
|
|
97
|
+
export type ReplyCommand = {
|
|
98
|
+
[K in CommandName]: (typeof Commands)[K]["reply"] extends MessageType ? K : never;
|
|
99
|
+
}[CommandName];
|
|
100
|
+
export type ReplyType<K extends ReplyCommand> = (typeof Commands)[K]["reply"];
|
|
101
|
+
export type ControlCommand = Exclude<CommandName, ReplyCommand>;
|
|
102
|
+
/** Only the structural subset already required by H3 deployment admission. */
|
|
103
|
+
export interface Shape {
|
|
104
|
+
readonly type: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
105
|
+
readonly nullable?: boolean;
|
|
106
|
+
readonly fields?: Readonly<Record<string, Shape>>;
|
|
107
|
+
readonly required?: readonly string[];
|
|
108
|
+
readonly items?: Shape;
|
|
109
|
+
}
|
|
110
|
+
export declare const messageShapes: Readonly<Record<MessageType, Shape>>;
|
|
111
|
+
export declare const deploymentCommands: {
|
|
112
|
+
name: string;
|
|
113
|
+
args: {
|
|
114
|
+
type: "string" | "number" | "integer" | "boolean" | "object" | "array";
|
|
115
|
+
nullable?: boolean;
|
|
116
|
+
fields?: Readonly<Record<string, Shape>>;
|
|
117
|
+
items?: Shape;
|
|
118
|
+
required: never[];
|
|
119
|
+
};
|
|
120
|
+
supplied: readonly string[];
|
|
121
|
+
reply: "autoplay_accepted" | "canvas_accepted" | "clip_length_accepted" | "clip_moved" | "clip_popped" | "clip_queued" | "flush_accepted" | "queue_update" | "seed_accepted" | "session_reset" | "state_update" | null;
|
|
122
|
+
}[];
|
|
123
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,WAAW,GAAG,CAAC,GAAG,KAAK;CAClF,CAAC,WAAW,CAAC,CAAC;AACf,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,YAAY,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC9E,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAChF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAuDD,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAEtB,CAAC;AAE1C,eAAO,MAAM,kBAAkB;;;cAhEd,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO;mBAC3D,OAAO;iBACT,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAEhC,KAAK;;;;;GAoEtB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { isRecord } from "../../json.js";
|
|
3
|
+
import { Payloads } from "../messages.js";
|
|
4
|
+
const NumberArgument = Schema.Number.check(Schema.isFinite());
|
|
5
|
+
const NoArguments = Schema.Record(Schema.String, Schema.Never);
|
|
6
|
+
const Upload = Schema.Struct({
|
|
7
|
+
upload_id: Schema.String,
|
|
8
|
+
name: Schema.String,
|
|
9
|
+
mime_type: Schema.String,
|
|
10
|
+
size: Schema.Int,
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* One command-to-reply authority for deployment admission and client calls.
|
|
14
|
+
* Required keys describe what this adapter always supplies, not what a server
|
|
15
|
+
* must require. Nullable parameters describe the documented deployment shape;
|
|
16
|
+
* the adapter's outgoing arguments omit null and retain its existing validators.
|
|
17
|
+
*/
|
|
18
|
+
export const Commands = {
|
|
19
|
+
enqueue: {
|
|
20
|
+
args: Schema.Struct({
|
|
21
|
+
prompt: Schema.String,
|
|
22
|
+
reference_images: Schema.NullOr(Schema.Array(Upload)),
|
|
23
|
+
seconds: Schema.optionalKey(Schema.NullOr(NumberArgument)),
|
|
24
|
+
seed: Schema.optionalKey(Schema.NullOr(Schema.Int)),
|
|
25
|
+
position: Schema.optionalKey(Schema.NullOr(Schema.Int)),
|
|
26
|
+
metadata: Schema.String,
|
|
27
|
+
continue_from_clip_id: Schema.optionalKey(Schema.String),
|
|
28
|
+
}),
|
|
29
|
+
reply: "clip_queued",
|
|
30
|
+
},
|
|
31
|
+
move: {
|
|
32
|
+
args: Schema.Struct({ clip_id: Schema.String, position: Schema.Int }),
|
|
33
|
+
reply: "clip_moved",
|
|
34
|
+
},
|
|
35
|
+
pop: { args: Schema.Struct({ clip_id: Schema.String }), reply: "clip_popped" },
|
|
36
|
+
play: { args: Schema.Struct({ clip_id: Schema.String }), reply: null },
|
|
37
|
+
stop: { args: NoArguments, reply: null },
|
|
38
|
+
set_seed: { args: Schema.Struct({ seed: Schema.Int }), reply: "seed_accepted" },
|
|
39
|
+
set_clip_seconds: {
|
|
40
|
+
args: Schema.Struct({ seconds: NumberArgument }),
|
|
41
|
+
reply: "clip_length_accepted",
|
|
42
|
+
},
|
|
43
|
+
set_canvas: { args: Schema.Struct({ aspect: Schema.String }), reply: "canvas_accepted" },
|
|
44
|
+
set_autoplay: { args: Schema.Struct({ enabled: Schema.Boolean }), reply: "autoplay_accepted" },
|
|
45
|
+
set_flush_on_clip_end: {
|
|
46
|
+
args: Schema.Struct({ enabled: Schema.Boolean }),
|
|
47
|
+
reply: "flush_accepted",
|
|
48
|
+
},
|
|
49
|
+
get_queue: { args: NoArguments, reply: "queue_update" },
|
|
50
|
+
get_state: { args: NoArguments, reply: "state_update" },
|
|
51
|
+
reset: { args: NoArguments, reply: "session_reset" },
|
|
52
|
+
};
|
|
53
|
+
const internalShapeError = () => {
|
|
54
|
+
throw new Error("H3 contract schemas must have concrete inline JSON shapes");
|
|
55
|
+
};
|
|
56
|
+
const schemaObject = (value) => isRecord(value) ? value : internalShapeError();
|
|
57
|
+
/**
|
|
58
|
+
* Project the pinned Effect schema's JSON representation once. This is not a
|
|
59
|
+
* second payload decoder: numeric/string refinements still belong exclusively
|
|
60
|
+
* to messages.ts. Optional observations do not become deployment requirements.
|
|
61
|
+
*/
|
|
62
|
+
const structuralShape = (schema, includeOptional = false) => {
|
|
63
|
+
const document = Schema.toJsonSchemaDocument(schema);
|
|
64
|
+
if (Object.keys(document.definitions).length !== 0)
|
|
65
|
+
return internalShapeError();
|
|
66
|
+
const visit = (input, allFields = false) => {
|
|
67
|
+
let node = schemaObject(input);
|
|
68
|
+
let nullable = false;
|
|
69
|
+
if (Array.isArray(node.anyOf)) {
|
|
70
|
+
const nonNull = node.anyOf.filter((choice) => schemaObject(choice).type !== "null");
|
|
71
|
+
if (nonNull.length !== 1 || nonNull.length === node.anyOf.length)
|
|
72
|
+
return internalShapeError();
|
|
73
|
+
nullable = true;
|
|
74
|
+
node = schemaObject(nonNull[0]);
|
|
75
|
+
}
|
|
76
|
+
const type = node.type;
|
|
77
|
+
if (type !== "string" &&
|
|
78
|
+
type !== "number" &&
|
|
79
|
+
type !== "integer" &&
|
|
80
|
+
type !== "boolean" &&
|
|
81
|
+
type !== "object" &&
|
|
82
|
+
type !== "array")
|
|
83
|
+
return internalShapeError();
|
|
84
|
+
const base = { type, ...(nullable ? { nullable } : {}) };
|
|
85
|
+
if (type === "array")
|
|
86
|
+
return { ...base, items: visit(node.items) };
|
|
87
|
+
if (type !== "object")
|
|
88
|
+
return base;
|
|
89
|
+
const properties = schemaObject(node.properties ?? {});
|
|
90
|
+
const required = node.required ?? [];
|
|
91
|
+
if (!Array.isArray(required) || required.some((key) => typeof key !== "string"))
|
|
92
|
+
return internalShapeError();
|
|
93
|
+
return {
|
|
94
|
+
...base,
|
|
95
|
+
required,
|
|
96
|
+
fields: Object.fromEntries(Object.entries(properties)
|
|
97
|
+
.filter(([name]) => allFields || required.includes(name))
|
|
98
|
+
.map(([name, field]) => [name, visit(field)])),
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
return visit(document.schema, includeOptional);
|
|
102
|
+
};
|
|
103
|
+
export const messageShapes = Object.fromEntries(Object.entries(Payloads).map(([name, schema]) => [name, structuralShape(schema)]));
|
|
104
|
+
export const deploymentCommands = Object.entries(Commands).map(([name, command]) => {
|
|
105
|
+
const shape = structuralShape(command.args, true);
|
|
106
|
+
return {
|
|
107
|
+
name,
|
|
108
|
+
args: { ...shape, required: [] },
|
|
109
|
+
supplied: shape.required ?? [],
|
|
110
|
+
reply: command.reply,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/h3/_internal/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CA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CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAyC,MAAM,CAAC,WAAW,CACnF,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1C,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;IACjF,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClD,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Contract } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Matches the pinned reactor-runtime ModelSchema.to_openapi representation:
|
|
4
|
+
* https://github.com/reactor-team/reactor-runtime/blob/8e98536c6daedca298700dc45cbb5fd9e3676f16/src/reactor_runtime/interface/model/schema.py
|
|
5
|
+
* No network references are followed, and prose/name mentions cannot establish compatibility.
|
|
6
|
+
*/
|
|
7
|
+
export declare const validateDeployment: (input: unknown) => Contract;
|
|
8
|
+
//# sourceMappingURL=deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../../src/h3/_internal/deployment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAc5C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAAW,OAAO,KAAG,QA0HnD,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ReactorError } from "../../errors.js";
|
|
2
|
+
import { isRecord, jsonObject } from "../../json.js";
|
|
3
|
+
import { documentedVersion, modelName, referenceLimits, source } from "../profile.js";
|
|
4
|
+
import { deploymentCommands, messageShapes } from "./contracts.js";
|
|
5
|
+
const incompatible = (location) => {
|
|
6
|
+
throw new ReactorError("UnsupportedCapability", `Deployment does not structurally support H3 ${documentedVersion}: ${location}`, { operation: "H3 schema", outcome: "not-submitted" });
|
|
7
|
+
};
|
|
8
|
+
const record = (input, path) => isRecord(input) ? input : incompatible(path);
|
|
9
|
+
/**
|
|
10
|
+
* Matches the pinned reactor-runtime ModelSchema.to_openapi representation:
|
|
11
|
+
* https://github.com/reactor-team/reactor-runtime/blob/8e98536c6daedca298700dc45cbb5fd9e3676f16/src/reactor_runtime/interface/model/schema.py
|
|
12
|
+
* No network references are followed, and prose/name mentions cannot establish compatibility.
|
|
13
|
+
*/
|
|
14
|
+
export const validateDeployment = (input) => {
|
|
15
|
+
const doc = jsonObject(input);
|
|
16
|
+
if (typeof doc.openapi !== "string" || !/^3\.(0|1)\./.test(doc.openapi))
|
|
17
|
+
return incompatible("OpenAPI version");
|
|
18
|
+
let checks = 0;
|
|
19
|
+
const resolve = (input, location) => {
|
|
20
|
+
let value = record(input, location);
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
while (typeof value.$ref === "string") {
|
|
23
|
+
const ref = value.$ref;
|
|
24
|
+
if (!ref.startsWith("#/components/schemas/") || seen.has(ref) || seen.size >= 32)
|
|
25
|
+
return incompatible(`${location} reference`);
|
|
26
|
+
seen.add(ref);
|
|
27
|
+
let current = doc;
|
|
28
|
+
for (const part of ref.slice(2).split("/"))
|
|
29
|
+
current = record(current, location)[part.replace(/~1/g, "/").replace(/~0/g, "~")];
|
|
30
|
+
value = record(current, location);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
const check = (input, expected, location, depth = 0) => {
|
|
35
|
+
if (++checks > 10000 || depth > 32)
|
|
36
|
+
return incompatible("schema complexity bound");
|
|
37
|
+
let actual = resolve(input, location);
|
|
38
|
+
const choices = actual.anyOf ?? actual.oneOf;
|
|
39
|
+
let nullable = actual.nullable === true;
|
|
40
|
+
if (Array.isArray(choices)) {
|
|
41
|
+
const nonNull = choices.filter((choice) => resolve(choice, location).type !== "null");
|
|
42
|
+
nullable = nonNull.length !== choices.length;
|
|
43
|
+
if (nonNull.length !== 1)
|
|
44
|
+
return incompatible(`${location} union`);
|
|
45
|
+
actual = resolve(nonNull[0], location);
|
|
46
|
+
}
|
|
47
|
+
const types = Array.isArray(actual.type) ? actual.type : [actual.type];
|
|
48
|
+
nullable ||= types.includes("null");
|
|
49
|
+
const nonNullTypes = types.filter((type) => type !== "null");
|
|
50
|
+
if (nonNullTypes.length !== 1 ||
|
|
51
|
+
!(nonNullTypes[0] === expected.type ||
|
|
52
|
+
(location.startsWith("message ") &&
|
|
53
|
+
expected.type === "number" &&
|
|
54
|
+
nonNullTypes[0] === "integer")))
|
|
55
|
+
return incompatible(`${location} type`);
|
|
56
|
+
// Nullable outputs must declare the null alternative; nullable request
|
|
57
|
+
// parameters may also be a narrower non-null type because this client omits null.
|
|
58
|
+
if (location.startsWith("message ") && expected.nullable === true && !nullable)
|
|
59
|
+
return incompatible(`${location} nullability`);
|
|
60
|
+
if (expected.nullable !== true && nullable)
|
|
61
|
+
return incompatible(`${location} nullability`);
|
|
62
|
+
if (expected.type === "array") {
|
|
63
|
+
if (location === "command enqueue.reference_images" &&
|
|
64
|
+
((typeof actual.minItems === "number" && actual.minItems > 0) ||
|
|
65
|
+
(typeof actual.maxItems === "number" && actual.maxItems < referenceLimits.maxImages)))
|
|
66
|
+
return incompatible("command enqueue.reference_images count bounds");
|
|
67
|
+
if (expected.items !== undefined)
|
|
68
|
+
check(actual.items, expected.items, `${location} items`, depth + 1);
|
|
69
|
+
}
|
|
70
|
+
else if (expected.type === "object") {
|
|
71
|
+
const properties = actual.properties === undefined ? {} : record(actual.properties, `${location} properties`);
|
|
72
|
+
const required = actual.required ?? [];
|
|
73
|
+
if (!Array.isArray(required) || required.some((key) => typeof key !== "string"))
|
|
74
|
+
return incompatible(`${location} required fields`);
|
|
75
|
+
for (const name of expected.required ?? [])
|
|
76
|
+
if (!required.includes(name))
|
|
77
|
+
return incompatible(`${location}.${name} required`);
|
|
78
|
+
for (const [name, shape] of Object.entries(expected.fields ?? {}))
|
|
79
|
+
check(properties[name], shape, `${location}.${name}`, depth + 1);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const bodySchema = (input, location) => {
|
|
83
|
+
const body = record(input, location), content = record(body.content, location);
|
|
84
|
+
return record(content["application/json"], location).schema;
|
|
85
|
+
};
|
|
86
|
+
const paths = record(doc.paths, "command paths"), webhooks = record(doc.webhooks, "message webhooks");
|
|
87
|
+
const messageSchemas = new Map();
|
|
88
|
+
for (const [name, shape] of Object.entries(messageShapes)) {
|
|
89
|
+
const post = record(record(webhooks[name], `message ${name}`).post, `message ${name}`);
|
|
90
|
+
if (post.operationId !== name)
|
|
91
|
+
return incompatible(`message ${name} operationId`);
|
|
92
|
+
const schema = bodySchema(post.requestBody, `message ${name}`);
|
|
93
|
+
check(schema, shape, `message ${name}`);
|
|
94
|
+
messageSchemas.set(name, schema);
|
|
95
|
+
}
|
|
96
|
+
for (const command of deploymentCommands) {
|
|
97
|
+
const { name } = command;
|
|
98
|
+
const post = record(record(paths[`/events/${name}`], `command ${name}`).post, `command ${name}`);
|
|
99
|
+
if (post.operationId !== name)
|
|
100
|
+
return incompatible(`command ${name} operationId`);
|
|
101
|
+
const args = bodySchema(post.requestBody, `command ${name}`);
|
|
102
|
+
check(args, command.args, `command ${name}`);
|
|
103
|
+
const required = resolve(args, `command ${name}`).required ?? [];
|
|
104
|
+
if (!Array.isArray(required) || required.some((key) => !command.supplied.includes(String(key))))
|
|
105
|
+
return incompatible(`command ${name} unsupported required argument`);
|
|
106
|
+
const responses = record(post.responses, `command ${name} responses`);
|
|
107
|
+
if (command.reply === null) {
|
|
108
|
+
const accepted = record(responses["202"], `command ${name} acceptance`);
|
|
109
|
+
if (accepted.content !== undefined)
|
|
110
|
+
return incompatible(`command ${name} bodyless acceptance`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const schema = bodySchema(responses["200"], `command ${name} response`);
|
|
114
|
+
check(schema, messageShapes[command.reply], `message ${command.reply}`);
|
|
115
|
+
const expected = record(messageSchemas.get(command.reply), `message ${command.reply}`), response = record(schema, `command ${name}`);
|
|
116
|
+
if (typeof expected.$ref === "string" && response.$ref !== expected.$ref)
|
|
117
|
+
return incompatible(`command ${name} response identity`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const info = isRecord(doc.info) ? doc.info : {};
|
|
121
|
+
return Object.freeze({
|
|
122
|
+
modelName,
|
|
123
|
+
documentedVersion,
|
|
124
|
+
source,
|
|
125
|
+
subset: "prompt-and-images",
|
|
126
|
+
deployment: Object.freeze({
|
|
127
|
+
title: typeof info.title === "string" ? info.title : null,
|
|
128
|
+
version: typeof info.version === "string" ? info.version : null,
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../../src/h3/_internal/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;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IAAI,WAAW,CAAC,CAAC;YACxE,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;YACxE,MAAM,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,OAAO,CAAC,KAAK,EAAE,CAAC,EACpF,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;YAC/C,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;gBACtE,OAAO,YAAY,CAAC,WAAW,IAAI,oBAAoB,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS;QACT,iBAAiB;QACjB,MAAM;QACN,MAAM,EAAE,mBAAmB;QAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;YACxB,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzD,OAAO,EAAE,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SAChE,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CommandReply } from "../../session/index.js";
|
|
2
|
+
import type { Clip } from "../messages.js";
|
|
3
|
+
import type { Acceptance } from "../types.js";
|
|
4
|
+
/** Captured once for a submission; pending registration and retirement belong to the client. */
|
|
5
|
+
export interface AcceptanceIdentity {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly metadata: string;
|
|
8
|
+
readonly prompt: string;
|
|
9
|
+
readonly generation: bigint;
|
|
10
|
+
}
|
|
11
|
+
/** Namespaced acceptance metadata is not a claim about the provider's own state. */
|
|
12
|
+
export declare const encodeMetadata: (namespace: string, submission: string, caller?: string) => string;
|
|
13
|
+
/** Foreign, malformed and extended annotations cannot identify a local pending submission. */
|
|
14
|
+
export declare const submissionFromMetadata: (namespace: string, value: string) => string | undefined;
|
|
15
|
+
/** Only exact captured data in its generation proves acceptance; an ACK has no clip to supply. */
|
|
16
|
+
export declare const acceptanceFor: (identity: AcceptanceIdentity, clip: Clip, source: CommandReply) => Acceptance | undefined;
|
|
17
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../../src/h3/_internal/evidence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,gGAAgG;AAChG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,oFAAoF;AACpF,eAAO,MAAM,cAAc,cAAe,MAAM,cAAc,MAAM,sBAAgB,MASnF,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,sBAAsB,cAAe,MAAM,SAAS,MAAM,KAAG,MAAM,GAAG,SAgBlF,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,aAAa,aACd,kBAAkB,QACtB,IAAI,UACF,YAAY,KACnB,UAAU,GAAG,SAoBf,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactorError } from "../../errors.js";
|
|
2
|
+
import { metadataMaxChars } from "../profile.js";
|
|
3
|
+
import { Commands } from "./contracts.js";
|
|
4
|
+
import { plain } from "./references.js";
|
|
5
|
+
/** Namespaced acceptance metadata is not a claim about the provider's own state. */
|
|
6
|
+
export const encodeMetadata = (namespace, submission, caller = "") => {
|
|
7
|
+
const value = JSON.stringify({ reactor_effect_h3: 1, namespace, submission, caller });
|
|
8
|
+
if (Array.from(value).length > metadataMaxChars)
|
|
9
|
+
throw new ReactorError("InvalidInput", `Metadata including acceptance identity exceeds ${metadataMaxChars} characters`, { operation: "enqueue", outcome: "not-submitted" });
|
|
10
|
+
return value;
|
|
11
|
+
};
|
|
12
|
+
/** Foreign, malformed and extended annotations cannot identify a local pending submission. */
|
|
13
|
+
export const submissionFromMetadata = (namespace, value) => {
|
|
14
|
+
try {
|
|
15
|
+
const object = JSON.parse(value);
|
|
16
|
+
const fields = plain(object, ["reactor_effect_h3", "namespace", "submission", "caller"]);
|
|
17
|
+
if (fields.reactor_effect_h3 !== 1 ||
|
|
18
|
+
typeof fields.namespace !== "string" ||
|
|
19
|
+
fields.namespace !== namespace ||
|
|
20
|
+
typeof fields.submission !== "string" ||
|
|
21
|
+
typeof fields.caller !== "string")
|
|
22
|
+
return undefined;
|
|
23
|
+
return fields.submission;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** Only exact captured data in its generation proves acceptance; an ACK has no clip to supply. */
|
|
30
|
+
export const acceptanceFor = (identity, clip, source) => {
|
|
31
|
+
if (identity.generation !== source.generation ||
|
|
32
|
+
identity.metadata !== clip.metadata ||
|
|
33
|
+
identity.prompt !== clip.prompt)
|
|
34
|
+
return undefined;
|
|
35
|
+
return Object.freeze({
|
|
36
|
+
submissionId: identity.id,
|
|
37
|
+
clip,
|
|
38
|
+
evidence: Object.freeze({
|
|
39
|
+
kind: source.kind === "message" &&
|
|
40
|
+
source.type === Commands.enqueue.reply &&
|
|
41
|
+
source.correlation === "matched"
|
|
42
|
+
? "correlated"
|
|
43
|
+
: "metadata",
|
|
44
|
+
source,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../../src/h3/_internal/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAUxC,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAiB,EAAE,UAAkB,EAAE,MAAM,GAAG,EAAE,EAAU,EAAE;IAC3F,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACtF,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,gBAAgB;QAC7C,MAAM,IAAI,YAAY,CACpB,cAAc,EACd,kDAAkD,gBAAgB,aAAa,EAC/E,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,CACnD,CAAC;IACJ,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAE,KAAa,EAAsB,EAAE;IAC7F,IAAI,CAAC;QACH,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|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { ReactorError } from "../../errors.js";
|
|
3
|
+
import type { UploadReference } from "../../wire.generated.js";
|
|
4
|
+
import type { Reference, ValidatedReference } from "../types.js";
|
|
5
|
+
export type Material = {
|
|
6
|
+
readonly _tag: "Bytes";
|
|
7
|
+
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
8
|
+
} | {
|
|
9
|
+
readonly _tag: "Uploaded";
|
|
10
|
+
readonly file: UploadReference;
|
|
11
|
+
};
|
|
12
|
+
export declare const plain: (input: unknown, allowed: readonly string[]) => Record<string, unknown>;
|
|
13
|
+
/** Validates wire identity and a safe JSON size projection without inventing upload provenance. */
|
|
14
|
+
export declare const checkedUpload: (input: unknown) => UploadReference;
|
|
15
|
+
export declare const captureReference: (input: Reference | ValidatedReference) => ValidatedReference;
|
|
16
|
+
export declare const referenceMaterial: (reference: ValidatedReference) => Material;
|
|
17
|
+
export declare const validateReference: (input: Reference) => Effect.Effect<ValidatedReference, ReactorError>;
|
|
18
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/h3/_internal/references.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOjE,MAAM,MAAM,QAAQ,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AA+GlE,eAAO,MAAM,KAAK,UAAW,OAAO,WAAW,SAAS,MAAM,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAgBxF,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,eAqB9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,SAAS,GAAG,kBAAkB,KAAG,kBAoCxE,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,kBAAkB,KAAG,QACE,CAAC;AACrE,eAAO,MAAM,iBAAiB,UACrB,SAAS,KACf,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAO7C,CAAC"}
|