@sealant/api-contracts-next 0.0.0-next.0 → 0.39.0-next.682

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.
Files changed (40) hide show
  1. package/LICENSE +202 -0
  2. package/dist/core-api/access-tokens.d.ts +126 -0
  3. package/dist/core-api/access-tokens.js +72 -0
  4. package/dist/core-api/budgets.d.ts +15 -0
  5. package/dist/core-api/budgets.js +13 -0
  6. package/dist/core-api/connected-accounts.d.ts +226 -0
  7. package/dist/core-api/connected-accounts.js +128 -0
  8. package/dist/core-api/control-plane.d.ts +1318 -0
  9. package/dist/core-api/control-plane.js +31 -0
  10. package/dist/core-api/github.d.ts +261 -0
  11. package/dist/core-api/github.js +153 -0
  12. package/dist/core-api/inference.d.ts +223 -0
  13. package/dist/core-api/inference.js +139 -0
  14. package/dist/core-api/oci-names.d.ts +21 -0
  15. package/dist/core-api/oci-names.js +44 -0
  16. package/dist/core-api/packages.d.ts +179 -0
  17. package/dist/core-api/packages.js +60 -0
  18. package/dist/core-api/profiles.d.ts +188 -0
  19. package/dist/core-api/profiles.js +88 -0
  20. package/dist/core-api/record-events.d.ts +209 -0
  21. package/dist/core-api/record-events.js +193 -0
  22. package/dist/core-api/registries.d.ts +106 -0
  23. package/dist/core-api/registries.js +85 -0
  24. package/dist/core-api/runs.d.ts +516 -0
  25. package/dist/core-api/runs.js +284 -0
  26. package/dist/core-api/sessions.d.ts +390 -0
  27. package/dist/core-api/sessions.js +264 -0
  28. package/dist/core-api/ssh-keys.d.ts +120 -0
  29. package/dist/core-api/ssh-keys.js +108 -0
  30. package/dist/core-api/system.d.ts +51 -0
  31. package/dist/core-api/system.js +41 -0
  32. package/dist/core-api/users.d.ts +71 -0
  33. package/dist/core-api/users.js +48 -0
  34. package/dist/core-api/workspaces.d.ts +1880 -0
  35. package/dist/core-api/workspaces.js +980 -0
  36. package/dist/index.d.ts +18 -0
  37. package/dist/index.js +18 -0
  38. package/dist/workspace-environment.d.ts +124 -0
  39. package/dist/workspace-environment.js +259 -0
  40. package/package.json +31 -9
@@ -0,0 +1,60 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
3
+ const NonEmptyString = Schema.String.check(Schema.isNonEmpty(), Schema.isTrimmed());
4
+ export const packageTargetOsSchema = Schema.Literals(["arch", "fedora", "nix", "ubuntu"]);
5
+ export const packageResolutionStatusSchema = Schema.Literals([
6
+ "resolved",
7
+ "ambiguous",
8
+ "unsupported",
9
+ "not-found",
10
+ "invalid",
11
+ ]);
12
+ export const packageResolutionSourceSchema = Schema.Literals(["cache", "repology", "override"]);
13
+ export const packageOsSupportSchema = Schema.Struct({
14
+ supported: Schema.Boolean,
15
+ repo: Schema.optional(NonEmptyString),
16
+ packageName: Schema.optional(NonEmptyString),
17
+ projectName: Schema.optional(NonEmptyString),
18
+ version: Schema.optional(NonEmptyString),
19
+ status: Schema.optional(NonEmptyString),
20
+ });
21
+ export const packageResolutionAlternativeSchema = Schema.Struct({
22
+ projectName: NonEmptyString,
23
+ });
24
+ export const packageResolutionSchema = Schema.Struct({
25
+ requested: NonEmptyString,
26
+ normalized: NonEmptyString,
27
+ status: packageResolutionStatusSchema,
28
+ source: packageResolutionSourceSchema,
29
+ canonicalId: Schema.optional(NonEmptyString),
30
+ selectedProject: Schema.optional(NonEmptyString),
31
+ osSupport: Schema.Struct({
32
+ arch: packageOsSupportSchema,
33
+ fedora: packageOsSupportSchema,
34
+ nix: packageOsSupportSchema,
35
+ ubuntu: packageOsSupportSchema,
36
+ }),
37
+ alternatives: Schema.Array(packageResolutionAlternativeSchema),
38
+ fetchedAt: Schema.String,
39
+ expiresAt: Schema.String,
40
+ });
41
+ export const resolvePackageQuerySchema = Schema.Struct({
42
+ query: NonEmptyString,
43
+ targetOs: Schema.optional(packageTargetOsSchema),
44
+ });
45
+ export const resolvePackageResponseSchema = packageResolutionSchema;
46
+ export class PackagesBadGatewayError extends Schema.TaggedErrorClass()("PackagesBadGatewayError", {
47
+ message: Schema.String,
48
+ }, { httpApiStatus: 502 }) {
49
+ }
50
+ export class PackagesInternalServerError extends Schema.TaggedErrorClass()("PackagesInternalServerError", {
51
+ message: Schema.String,
52
+ }, { httpApiStatus: 500 }) {
53
+ }
54
+ export const PackagesGroup = HttpApiGroup.make("packages")
55
+ .add(HttpApiEndpoint.get("resolvePackage", "/resolve", {
56
+ query: resolvePackageQuerySchema,
57
+ success: resolvePackageResponseSchema,
58
+ error: [PackagesBadGatewayError, PackagesInternalServerError],
59
+ }))
60
+ .annotate(OpenApi.Description, "Package normalization and distro resolution operations.");
@@ -0,0 +1,188 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
+ export declare const profileStatusSchema: Schema.Literals<readonly ["active", "archived"]>;
4
+ export type ProfileStatus = typeof profileStatusSchema.Type;
5
+ export declare const profileSummarySchema: Schema.Struct<{
6
+ readonly profileId: Schema.String;
7
+ readonly ownerUserId: Schema.String;
8
+ readonly slug: Schema.String;
9
+ readonly name: Schema.String;
10
+ readonly description: Schema.NullOr<Schema.String>;
11
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
12
+ readonly activeRevisionId: Schema.NullOr<Schema.String>;
13
+ readonly createdAt: Schema.String;
14
+ readonly updatedAt: Schema.String;
15
+ }>;
16
+ export type ProfileSummary = typeof profileSummarySchema.Type;
17
+ export declare const listProfilesQuerySchema: Schema.Struct<{
18
+ readonly ownerUserId: Schema.String;
19
+ }>;
20
+ export type ListProfilesQuery = typeof listProfilesQuerySchema.Type;
21
+ export declare const listProfilesResponseSchema: Schema.Struct<{
22
+ readonly items: Schema.$Array<Schema.Struct<{
23
+ readonly profileId: Schema.String;
24
+ readonly ownerUserId: Schema.String;
25
+ readonly slug: Schema.String;
26
+ readonly name: Schema.String;
27
+ readonly description: Schema.NullOr<Schema.String>;
28
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
29
+ readonly activeRevisionId: Schema.NullOr<Schema.String>;
30
+ readonly createdAt: Schema.String;
31
+ readonly updatedAt: Schema.String;
32
+ }>>;
33
+ }>;
34
+ export type ListProfilesResponse = typeof listProfilesResponseSchema.Type;
35
+ export declare const profileCredentialBindingWithAccountSchema: Schema.Struct<{
36
+ readonly profileId: Schema.String;
37
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
38
+ readonly connectedAccountId: Schema.String;
39
+ readonly account: Schema.Struct<{
40
+ readonly connectedAccountId: Schema.String;
41
+ readonly ownerUserId: Schema.String;
42
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
43
+ readonly name: Schema.String;
44
+ readonly kind: Schema.String;
45
+ readonly status: Schema.Literals<readonly ["active", "invalid", "archived"]>;
46
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
47
+ readonly connectedAt: Schema.String;
48
+ readonly updatedAt: Schema.String;
49
+ readonly lastUsedAt: Schema.NullOr<Schema.String>;
50
+ readonly lastSyncedAt: Schema.NullOr<Schema.String>;
51
+ readonly credential: Schema.Struct<{
52
+ readonly accessExpiresAt: Schema.NullOr<Schema.String>;
53
+ readonly refreshExpiresAt: Schema.NullOr<Schema.String>;
54
+ readonly lastRefreshAt: Schema.NullOr<Schema.String>;
55
+ readonly lastRefreshOutcome: Schema.NullOr<Schema.Literals<readonly ["refreshed", "fresh", "failed"]>>;
56
+ }>;
57
+ }>;
58
+ }>;
59
+ export type ProfileCredentialBindingWithAccount = typeof profileCredentialBindingWithAccountSchema.Type;
60
+ export declare const listProfileCredentialBindingsResponseSchema: Schema.Struct<{
61
+ readonly items: Schema.$Array<Schema.Struct<{
62
+ readonly profileId: Schema.String;
63
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
64
+ readonly connectedAccountId: Schema.String;
65
+ readonly account: Schema.Struct<{
66
+ readonly connectedAccountId: Schema.String;
67
+ readonly ownerUserId: Schema.String;
68
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
69
+ readonly name: Schema.String;
70
+ readonly kind: Schema.String;
71
+ readonly status: Schema.Literals<readonly ["active", "invalid", "archived"]>;
72
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
73
+ readonly connectedAt: Schema.String;
74
+ readonly updatedAt: Schema.String;
75
+ readonly lastUsedAt: Schema.NullOr<Schema.String>;
76
+ readonly lastSyncedAt: Schema.NullOr<Schema.String>;
77
+ readonly credential: Schema.Struct<{
78
+ readonly accessExpiresAt: Schema.NullOr<Schema.String>;
79
+ readonly refreshExpiresAt: Schema.NullOr<Schema.String>;
80
+ readonly lastRefreshAt: Schema.NullOr<Schema.String>;
81
+ readonly lastRefreshOutcome: Schema.NullOr<Schema.Literals<readonly ["refreshed", "fresh", "failed"]>>;
82
+ }>;
83
+ }>;
84
+ }>>;
85
+ }>;
86
+ export type ListProfileCredentialBindingsResponse = typeof listProfileCredentialBindingsResponseSchema.Type;
87
+ export declare const setProfileCredentialBindingRequestSchema: Schema.Struct<{
88
+ readonly ownerUserId: Schema.String;
89
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
90
+ readonly connectedAccountId: Schema.NullOr<Schema.String>;
91
+ }>;
92
+ export type SetProfileCredentialBindingRequest = typeof setProfileCredentialBindingRequestSchema.Type;
93
+ declare const ProfileBadRequestError_base: Schema.Class<ProfileBadRequestError, Schema.TaggedStruct<"ProfileBadRequestError", {
94
+ readonly message: Schema.String;
95
+ }>, import("effect/Cause").YieldableError>;
96
+ export declare class ProfileBadRequestError extends ProfileBadRequestError_base {
97
+ }
98
+ declare const ProfileNotFoundError_base: Schema.Class<ProfileNotFoundError, Schema.TaggedStruct<"ProfileNotFoundError", {
99
+ readonly message: Schema.String;
100
+ }>, import("effect/Cause").YieldableError>;
101
+ export declare class ProfileNotFoundError extends ProfileNotFoundError_base {
102
+ }
103
+ declare const ProfileConflictError_base: Schema.Class<ProfileConflictError, Schema.TaggedStruct<"ProfileConflictError", {
104
+ readonly message: Schema.String;
105
+ }>, import("effect/Cause").YieldableError>;
106
+ export declare class ProfileConflictError extends ProfileConflictError_base {
107
+ }
108
+ declare const ProfileInternalServerError_base: Schema.Class<ProfileInternalServerError, Schema.TaggedStruct<"ProfileInternalServerError", {
109
+ readonly message: Schema.String;
110
+ }>, import("effect/Cause").YieldableError>;
111
+ export declare class ProfileInternalServerError extends ProfileInternalServerError_base {
112
+ }
113
+ export declare const ProfilesGroup: HttpApiGroup.HttpApiGroup<"profiles", HttpApiEndpoint.HttpApiEndpoint<"listProfileCredentialBindings", "GET", "/:profileId/credential-bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
114
+ readonly profileId: Schema.String;
115
+ }>>, HttpApiEndpoint.StringTree<Schema.Struct<{
116
+ readonly ownerUserId: Schema.String;
117
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
118
+ readonly items: Schema.$Array<Schema.Struct<{
119
+ readonly profileId: Schema.String;
120
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
121
+ readonly connectedAccountId: Schema.String;
122
+ readonly account: Schema.Struct<{
123
+ readonly connectedAccountId: Schema.String;
124
+ readonly ownerUserId: Schema.String;
125
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
126
+ readonly name: Schema.String;
127
+ readonly kind: Schema.String;
128
+ readonly status: Schema.Literals<readonly ["active", "invalid", "archived"]>;
129
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
130
+ readonly connectedAt: Schema.String;
131
+ readonly updatedAt: Schema.String;
132
+ readonly lastUsedAt: Schema.NullOr<Schema.String>;
133
+ readonly lastSyncedAt: Schema.NullOr<Schema.String>;
134
+ readonly credential: Schema.Struct<{
135
+ readonly accessExpiresAt: Schema.NullOr<Schema.String>;
136
+ readonly refreshExpiresAt: Schema.NullOr<Schema.String>;
137
+ readonly lastRefreshAt: Schema.NullOr<Schema.String>;
138
+ readonly lastRefreshOutcome: Schema.NullOr<Schema.Literals<readonly ["refreshed", "fresh", "failed"]>>;
139
+ }>;
140
+ }>;
141
+ }>>;
142
+ }>>, HttpApiEndpoint.Json<typeof ProfileNotFoundError | typeof ProfileInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listProfiles", "GET", "/", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<Schema.Struct<{
143
+ readonly ownerUserId: Schema.String;
144
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
145
+ readonly items: Schema.$Array<Schema.Struct<{
146
+ readonly profileId: Schema.String;
147
+ readonly ownerUserId: Schema.String;
148
+ readonly slug: Schema.String;
149
+ readonly name: Schema.String;
150
+ readonly description: Schema.NullOr<Schema.String>;
151
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
152
+ readonly activeRevisionId: Schema.NullOr<Schema.String>;
153
+ readonly createdAt: Schema.String;
154
+ readonly updatedAt: Schema.String;
155
+ }>>;
156
+ }>>, HttpApiEndpoint.Json<typeof ProfileInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"setProfileCredentialBinding", "PUT", "/:profileId/credential-bindings", HttpApiEndpoint.StringTree<Schema.Struct<{
157
+ readonly profileId: Schema.String;
158
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
159
+ readonly ownerUserId: Schema.String;
160
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
161
+ readonly connectedAccountId: Schema.NullOr<Schema.String>;
162
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
163
+ readonly items: Schema.$Array<Schema.Struct<{
164
+ readonly profileId: Schema.String;
165
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
166
+ readonly connectedAccountId: Schema.String;
167
+ readonly account: Schema.Struct<{
168
+ readonly connectedAccountId: Schema.String;
169
+ readonly ownerUserId: Schema.String;
170
+ readonly provider: Schema.Literals<readonly ["claude", "codex", "github"]>;
171
+ readonly name: Schema.String;
172
+ readonly kind: Schema.String;
173
+ readonly status: Schema.Literals<readonly ["active", "invalid", "archived"]>;
174
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
175
+ readonly connectedAt: Schema.String;
176
+ readonly updatedAt: Schema.String;
177
+ readonly lastUsedAt: Schema.NullOr<Schema.String>;
178
+ readonly lastSyncedAt: Schema.NullOr<Schema.String>;
179
+ readonly credential: Schema.Struct<{
180
+ readonly accessExpiresAt: Schema.NullOr<Schema.String>;
181
+ readonly refreshExpiresAt: Schema.NullOr<Schema.String>;
182
+ readonly lastRefreshAt: Schema.NullOr<Schema.String>;
183
+ readonly lastRefreshOutcome: Schema.NullOr<Schema.Literals<readonly ["refreshed", "fresh", "failed"]>>;
184
+ }>;
185
+ }>;
186
+ }>>;
187
+ }>>, HttpApiEndpoint.Json<typeof ProfileBadRequestError | typeof ProfileNotFoundError | typeof ProfileConflictError | typeof ProfileInternalServerError>, never, never>, false>;
188
+ export {};
@@ -0,0 +1,88 @@
1
+ import { Schema } from "effect";
2
+ import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
3
+ import { connectedAccountProviderSchema, connectedAccountSummarySchema, } from "./connected-accounts.js";
4
+ const NonEmptyString = Schema.String.check(Schema.isNonEmpty(), Schema.isTrimmed());
5
+ /*
6
+ Minimal profiles surface: list a user's profiles and manage the per-provider connected-account
7
+ bindings that bundle credentials into a profile. Same trust model as ssh-keys/connected-accounts:
8
+ the internal API trusts the caller-supplied `ownerUserId` (web tRPC proxy and CLI inject it).
9
+ Bindings embed account summaries only — never secret material.
10
+ */
11
+ export const profileStatusSchema = Schema.Literals(["active", "archived"]);
12
+ export const profileSummarySchema = Schema.Struct({
13
+ profileId: NonEmptyString,
14
+ ownerUserId: NonEmptyString,
15
+ slug: NonEmptyString,
16
+ name: NonEmptyString,
17
+ description: Schema.NullOr(Schema.String),
18
+ status: profileStatusSchema,
19
+ activeRevisionId: Schema.NullOr(Schema.String),
20
+ createdAt: Schema.String,
21
+ updatedAt: Schema.String,
22
+ });
23
+ export const listProfilesQuerySchema = Schema.Struct({
24
+ ownerUserId: NonEmptyString,
25
+ });
26
+ export const listProfilesResponseSchema = Schema.Struct({
27
+ items: Schema.Array(profileSummarySchema),
28
+ });
29
+ export const profileCredentialBindingWithAccountSchema = Schema.Struct({
30
+ profileId: NonEmptyString,
31
+ provider: connectedAccountProviderSchema,
32
+ connectedAccountId: NonEmptyString,
33
+ account: connectedAccountSummarySchema,
34
+ });
35
+ export const listProfileCredentialBindingsResponseSchema = Schema.Struct({
36
+ items: Schema.Array(profileCredentialBindingWithAccountSchema),
37
+ });
38
+ export const setProfileCredentialBindingRequestSchema = Schema.Struct({
39
+ ownerUserId: NonEmptyString,
40
+ provider: connectedAccountProviderSchema,
41
+ // null clears the binding for that provider; the profile id travels in the URL.
42
+ connectedAccountId: Schema.NullOr(NonEmptyString),
43
+ });
44
+ export class ProfileBadRequestError extends Schema.TaggedErrorClass()("ProfileBadRequestError", {
45
+ message: Schema.String,
46
+ }, { httpApiStatus: 400 }) {
47
+ }
48
+ export class ProfileNotFoundError extends Schema.TaggedErrorClass()("ProfileNotFoundError", {
49
+ message: Schema.String,
50
+ }, { httpApiStatus: 404 }) {
51
+ }
52
+ export class ProfileConflictError extends Schema.TaggedErrorClass()("ProfileConflictError", {
53
+ message: Schema.String,
54
+ }, { httpApiStatus: 409 }) {
55
+ }
56
+ export class ProfileInternalServerError extends Schema.TaggedErrorClass()("ProfileInternalServerError", {
57
+ message: Schema.String,
58
+ }, { httpApiStatus: 500 }) {
59
+ }
60
+ const profileIdParams = Schema.Struct({ profileId: NonEmptyString });
61
+ export const ProfilesGroup = HttpApiGroup.make("profiles")
62
+ .add(HttpApiEndpoint.get("listProfiles", "/", {
63
+ query: listProfilesQuerySchema,
64
+ success: listProfilesResponseSchema,
65
+ error: [ProfileInternalServerError],
66
+ }))
67
+ .add(
68
+ // Uniform 404 for "profile does not exist" and "profile is not yours".
69
+ HttpApiEndpoint.get("listProfileCredentialBindings", "/:profileId/credential-bindings", {
70
+ params: profileIdParams,
71
+ query: listProfilesQuerySchema,
72
+ success: listProfileCredentialBindingsResponseSchema,
73
+ error: [ProfileNotFoundError, ProfileInternalServerError],
74
+ }))
75
+ .add(
76
+ // Upserts the (profile, provider) binding (null clears it) and returns the updated list.
77
+ HttpApiEndpoint.put("setProfileCredentialBinding", "/:profileId/credential-bindings", {
78
+ params: profileIdParams,
79
+ payload: setProfileCredentialBindingRequestSchema,
80
+ success: listProfileCredentialBindingsResponseSchema,
81
+ error: [
82
+ ProfileBadRequestError,
83
+ ProfileNotFoundError,
84
+ ProfileConflictError,
85
+ ProfileInternalServerError,
86
+ ],
87
+ }))
88
+ .annotate(OpenApi.Description, "Profiles and their per-provider connected-account credential bindings.");
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Record-event taxonomy — the TYPED payload schemas behind `TimelineEntry.kind`/`ref` and
3
+ * `RunEvent.payloadCase`/`payload`.
4
+ *
5
+ * The execution record's event kinds come from the sealantd protocol (`@sealant/runtime-protocol`
6
+ * `EventEnvelope.payload` oneof); ingest stores each payload as jsonb with the oneof case name as
7
+ * the `kind`. These schemas describe that STORED/SERVED shape exactly:
8
+ *
9
+ * - uint64/int64 protobuf fields are DECIMAL STRINGS (bigints are stringified at ingest so values
10
+ * past 2^53 survive jsonb);
11
+ * - protobuf enum fields are NUMBERS (`RuntimeState`, `ExitReason`, `StreamKind`, `FileChangeKind`,
12
+ * `FileType`, `NetworkScheme`, `EventPriority` — same convention as the envelope's
13
+ * `captureMethod`/`confidence`);
14
+ * - proto3 `optional` fields are absent when unset; implicit scalars are always present;
15
+ * - decode strips ingest artifacts (e.g. the protobuf `$typeName` marker).
16
+ *
17
+ * `decodeRecordEventPayload` folds a `(kind, ref)` pair into the discriminated union, degrading to
18
+ * the `unknown` case (with the raw kind + payload preserved) for kinds this contract version does
19
+ * not model or payloads that fail their schema — forward compatibility is a case, not an error.
20
+ *
21
+ * The kind list deliberately mirrors `payloadCaseValues` in `@sealant/telemetry` (guarded by a test
22
+ * there); this contract does not depend on the telemetry package.
23
+ */
24
+ import { Schema } from "effect";
25
+ /** Every event kind the platform records today, plus `unknown` for an unmodeled/absent oneof. */
26
+ export declare const recordEventKindValues: readonly ["runtimeStateChanged", "runtimeHeartbeat", "processStarted", "processExited", "ioChunk", "telemetryDropped", "fileChange", "fileWatchOverflow", "fileSnapshotCompleted", "fileDiffAvailable", "networkRequest", "networkSourceObserved", "unknown"];
27
+ export declare const recordEventKindSchema: Schema.Literals<readonly ["runtimeStateChanged", "runtimeHeartbeat", "processStarted", "processExited", "ioChunk", "telemetryDropped", "fileChange", "fileWatchOverflow", "fileSnapshotCompleted", "fileDiffAvailable", "networkRequest", "networkSourceObserved", "unknown"]>;
28
+ export type RecordEventKind = typeof recordEventKindSchema.Type;
29
+ /** `sealant.v1.RuntimeStateChanged` — `state` is a numeric `RuntimeState`. */
30
+ export declare const runtimeStateChangedEventSchema: Schema.Struct<{
31
+ readonly state: Schema.Number;
32
+ readonly reason: Schema.optional<Schema.String>;
33
+ }>;
34
+ export type RuntimeStateChangedEvent = typeof runtimeStateChangedEventSchema.Type;
35
+ /** `sealant.v1.RuntimeHeartbeat` — `state` is a numeric `RuntimeState`. */
36
+ export declare const runtimeHeartbeatEventSchema: Schema.Struct<{
37
+ readonly state: Schema.Number;
38
+ }>;
39
+ export type RuntimeHeartbeatEvent = typeof runtimeHeartbeatEventSchema.Type;
40
+ /** `sealant.v1.ProcessStarted` — a supervised process began executing. */
41
+ export declare const processStartedEventSchema: Schema.Struct<{
42
+ readonly pid: Schema.Number;
43
+ readonly pgid: Schema.Number;
44
+ readonly pidfd: Schema.Boolean;
45
+ readonly executable: Schema.String;
46
+ readonly args: Schema.$Array<Schema.String>;
47
+ readonly cwd: Schema.String;
48
+ /** Wall clock at start, microseconds (decimal-string int64). */
49
+ readonly startedAt: Schema.String;
50
+ }>;
51
+ export type ProcessStartedEvent = typeof processStartedEventSchema.Type;
52
+ /** `sealant.v1.ProcessExited` — `reason` is a numeric `ExitReason`. */
53
+ export declare const processExitedEventSchema: Schema.Struct<{
54
+ readonly exitCode: Schema.optional<Schema.Number>;
55
+ readonly signal: Schema.optional<Schema.Number>;
56
+ readonly reason: Schema.Number;
57
+ /** Wall-clock duration, microseconds (decimal-string uint64). */
58
+ readonly durationMicros: Schema.String;
59
+ }>;
60
+ export type ProcessExitedEvent = typeof processExitedEventSchema.Type;
61
+ /**
62
+ * `sealant.v1.IoChunk`, as ingest stores it: raw bytes are offloaded to the artifact store and
63
+ * replaced by a content hash; byte-exact text is served by the scrollback endpoint, not the record.
64
+ * `stream` is a numeric `StreamKind` (stdout = 2, stderr = 3).
65
+ */
66
+ export declare const ioChunkEventSchema: Schema.Struct<{
67
+ readonly stream: Schema.Number;
68
+ readonly byteCount: Schema.String;
69
+ readonly streamOffset: Schema.String;
70
+ readonly contentAlgo: Schema.optional<Schema.String>;
71
+ readonly contentHash: Schema.optional<Schema.String>;
72
+ readonly transform: Schema.optional<Schema.Struct<{
73
+ readonly redacted: Schema.Boolean;
74
+ readonly truncated: Schema.Boolean;
75
+ readonly coalesced: Schema.Boolean;
76
+ readonly originalByteCount: Schema.optional<Schema.String>;
77
+ }>>;
78
+ }>;
79
+ export type IoChunkEvent = typeof ioChunkEventSchema.Type;
80
+ /** `sealant.v1.TelemetryDropped` — `priority` is a numeric `EventPriority`. */
81
+ export declare const telemetryDroppedEventSchema: Schema.Struct<{
82
+ readonly reason: Schema.String;
83
+ readonly count: Schema.String;
84
+ readonly priority: Schema.Number;
85
+ }>;
86
+ export type TelemetryDroppedEvent = typeof telemetryDroppedEventSchema.Type;
87
+ /** `sealant.v1.FileEntry` — `fileType` is a numeric `FileType`. */
88
+ export declare const fileEntrySchema: Schema.Struct<{
89
+ readonly path: Schema.String;
90
+ readonly fileType: Schema.Number;
91
+ readonly size: Schema.String;
92
+ readonly mtimeMicros: Schema.String;
93
+ readonly mode: Schema.Number;
94
+ readonly hash: Schema.optional<Schema.String>;
95
+ readonly symlinkTarget: Schema.optional<Schema.String>;
96
+ }>;
97
+ export type FileEntryRef = typeof fileEntrySchema.Type;
98
+ /** `sealant.v1.FileChange` — `kind` is a numeric `FileChangeKind`. */
99
+ export declare const fileChangeEventSchema: Schema.Struct<{
100
+ readonly kind: Schema.Number;
101
+ readonly path: Schema.String;
102
+ readonly renameFrom: Schema.optional<Schema.String>;
103
+ readonly entry: Schema.optional<Schema.Struct<{
104
+ readonly path: Schema.String;
105
+ readonly fileType: Schema.Number;
106
+ readonly size: Schema.String;
107
+ readonly mtimeMicros: Schema.String;
108
+ readonly mode: Schema.Number;
109
+ readonly hash: Schema.optional<Schema.String>;
110
+ readonly symlinkTarget: Schema.optional<Schema.String>;
111
+ }>>;
112
+ readonly certain: Schema.Boolean;
113
+ }>;
114
+ export type FileChangeEvent = typeof fileChangeEventSchema.Type;
115
+ /** `sealant.v1.FileWatchOverflow` — changes under `root` may have been missed. */
116
+ export declare const fileWatchOverflowEventSchema: Schema.Struct<{
117
+ readonly root: Schema.String;
118
+ }>;
119
+ export type FileWatchOverflowEvent = typeof fileWatchOverflowEventSchema.Type;
120
+ /** `sealant.v1.FileSnapshotCompleted` */
121
+ export declare const fileSnapshotCompletedEventSchema: Schema.Struct<{
122
+ readonly root: Schema.String;
123
+ readonly fileCount: Schema.String;
124
+ }>;
125
+ export type FileSnapshotCompletedEvent = typeof fileSnapshotCompletedEventSchema.Type;
126
+ /** `sealant.v1.FileDiffAvailable` — per-kind counts as decimal-string uint64. */
127
+ export declare const fileDiffAvailableEventSchema: Schema.Struct<{
128
+ readonly added: Schema.String;
129
+ readonly modified: Schema.String;
130
+ readonly deleted: Schema.String;
131
+ readonly renamed: Schema.String;
132
+ }>;
133
+ export type FileDiffAvailableEvent = typeof fileDiffAvailableEventSchema.Type;
134
+ /** `sealant.v1.NetworkRequest` — `scheme` is a numeric `NetworkScheme`. */
135
+ export declare const networkRequestEventSchema: Schema.Struct<{
136
+ readonly scheme: Schema.Number;
137
+ readonly method: Schema.optional<Schema.String>;
138
+ readonly host: Schema.String;
139
+ readonly port: Schema.Number;
140
+ readonly path: Schema.optional<Schema.String>;
141
+ readonly status: Schema.optional<Schema.Number>;
142
+ readonly bytesSent: Schema.String;
143
+ readonly bytesReceived: Schema.String;
144
+ readonly durationMicros: Schema.String;
145
+ }>;
146
+ export type NetworkRequestEvent = typeof networkRequestEventSchema.Type;
147
+ /** `sealant.v1.NetworkSourceObserved` — a network source the run touched (the "sources" trail). */
148
+ export declare const networkSourceObservedEventSchema: Schema.Struct<{
149
+ readonly host: Schema.String;
150
+ readonly resolvedIps: Schema.$Array<Schema.String>;
151
+ readonly port: Schema.Number;
152
+ readonly scheme: Schema.optional<Schema.Number>;
153
+ readonly method: Schema.optional<Schema.String>;
154
+ readonly path: Schema.optional<Schema.String>;
155
+ readonly status: Schema.optional<Schema.Number>;
156
+ }>;
157
+ export type NetworkSourceObservedEvent = typeof networkSourceObservedEventSchema.Type;
158
+ /**
159
+ * A record-event payload discriminated by `kind`. The `unknown` case carries the raw kind and
160
+ * payload verbatim — it is the forward-compatibility path for kinds newer than this contract AND
161
+ * the honest path for payloads that fail their schema.
162
+ */
163
+ export type RecordEventPayload = {
164
+ readonly kind: "runtimeStateChanged";
165
+ readonly data: RuntimeStateChangedEvent;
166
+ } | {
167
+ readonly kind: "runtimeHeartbeat";
168
+ readonly data: RuntimeHeartbeatEvent;
169
+ } | {
170
+ readonly kind: "processStarted";
171
+ readonly data: ProcessStartedEvent;
172
+ } | {
173
+ readonly kind: "processExited";
174
+ readonly data: ProcessExitedEvent;
175
+ } | {
176
+ readonly kind: "ioChunk";
177
+ readonly data: IoChunkEvent;
178
+ } | {
179
+ readonly kind: "telemetryDropped";
180
+ readonly data: TelemetryDroppedEvent;
181
+ } | {
182
+ readonly kind: "fileChange";
183
+ readonly data: FileChangeEvent;
184
+ } | {
185
+ readonly kind: "fileWatchOverflow";
186
+ readonly data: FileWatchOverflowEvent;
187
+ } | {
188
+ readonly kind: "fileSnapshotCompleted";
189
+ readonly data: FileSnapshotCompletedEvent;
190
+ } | {
191
+ readonly kind: "fileDiffAvailable";
192
+ readonly data: FileDiffAvailableEvent;
193
+ } | {
194
+ readonly kind: "networkRequest";
195
+ readonly data: NetworkRequestEvent;
196
+ } | {
197
+ readonly kind: "networkSourceObserved";
198
+ readonly data: NetworkSourceObservedEvent;
199
+ } | {
200
+ readonly kind: "unknown";
201
+ readonly rawKind: string;
202
+ readonly data: unknown;
203
+ };
204
+ /**
205
+ * Folds a wire `(kind, ref)` pair — `TimelineEntry.kind`/`ref` or `RunEvent.payloadCase`/`payload` —
206
+ * into the discriminated {@link RecordEventPayload}. NEVER throws: unmodeled kinds and non-conforming
207
+ * payloads come back as the `unknown` case with the raw data preserved.
208
+ */
209
+ export declare const decodeRecordEventPayload: (kind: string, ref: unknown) => RecordEventPayload;