@nyte-ai/schema 0.0.0-stage → 0.0.18

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD-PARTY-NOTICES.md +800 -0
  3. package/dist/chunks/browser-0byq2fja.js +50 -0
  4. package/dist/chunks/browser-0ebnhqs2.js +36 -0
  5. package/dist/chunks/browser-0g0z3617.js +47 -0
  6. package/dist/chunks/browser-0khex2b1.js +33 -0
  7. package/dist/chunks/browser-1sfp0bcx.js +73 -0
  8. package/dist/chunks/browser-40enyw9r.js +75 -0
  9. package/dist/chunks/browser-48g24pes.js +106 -0
  10. package/dist/chunks/browser-4et7qtz3.js +7 -0
  11. package/dist/chunks/browser-5n1dh580.js +66 -0
  12. package/dist/chunks/browser-5pvw8svn.js +243 -0
  13. package/dist/chunks/browser-6e1madxa.js +83 -0
  14. package/dist/chunks/browser-6yby604e.js +96 -0
  15. package/dist/chunks/browser-7195qf3t.js +14 -0
  16. package/dist/chunks/browser-7gjnxy9m.js +172 -0
  17. package/dist/chunks/browser-8t9anqfc.js +113 -0
  18. package/dist/chunks/browser-9ystjh78.js +0 -0
  19. package/dist/chunks/browser-ad9yebg7.js +101 -0
  20. package/dist/chunks/browser-b519jtez.js +102 -0
  21. package/dist/chunks/browser-bg1esaw0.js +82 -0
  22. package/dist/chunks/browser-bxz3z1v6.js +181 -0
  23. package/dist/chunks/browser-e5xgzd28.js +82 -0
  24. package/dist/chunks/browser-ebr6k189.js +120 -0
  25. package/dist/chunks/browser-ekbecx9r.js +73 -0
  26. package/dist/chunks/browser-fd3accdr.js +159 -0
  27. package/dist/chunks/browser-fth801bw.js +50 -0
  28. package/dist/chunks/browser-g5khdcap.js +170 -0
  29. package/dist/chunks/browser-gchr2880.js +135 -0
  30. package/dist/chunks/browser-h86zs54a.js +65 -0
  31. package/dist/chunks/browser-hq5q56sf.js +79 -0
  32. package/dist/chunks/browser-j629a6wa.js +17 -0
  33. package/dist/chunks/browser-k20f6cvv.js +0 -0
  34. package/dist/chunks/browser-m0wzr0g8.js +5 -0
  35. package/dist/chunks/browser-mnejgne0.js +125 -0
  36. package/dist/chunks/browser-mzfc0v5j.js +58 -0
  37. package/dist/chunks/browser-pdv675va.js +135 -0
  38. package/dist/chunks/browser-pdx38ng3.js +301 -0
  39. package/dist/chunks/browser-qkxe0fwp.js +6 -0
  40. package/dist/chunks/browser-r00v3vwv.js +238 -0
  41. package/dist/chunks/browser-r87w64mz.js +32 -0
  42. package/dist/chunks/browser-s7907azt.js +118 -0
  43. package/dist/chunks/browser-sgwxbek9.js +37 -0
  44. package/dist/chunks/browser-v70eq512.js +215 -0
  45. package/dist/chunks/browser-vapnjwp3.js +35 -0
  46. package/dist/chunks/browser-vkh2tpmf.js +283 -0
  47. package/dist/chunks/browser-vzc3r2r3.js +64 -0
  48. package/dist/chunks/browser-ypez6s7v.js +52 -0
  49. package/dist/src/browser.d.ts +64 -0
  50. package/dist/src/browser.js +26 -0
  51. package/dist/src/configuration.d.ts +26 -0
  52. package/dist/src/configuration.js +17 -0
  53. package/dist/src/connection.d.ts +189 -0
  54. package/dist/src/connection.js +35 -0
  55. package/dist/src/declaration.d.ts +12 -0
  56. package/dist/src/declaration.js +1 -0
  57. package/dist/src/errors.d.ts +56 -0
  58. package/dist/src/errors.js +23 -0
  59. package/dist/src/events.d.ts +1750 -0
  60. package/dist/src/events.js +36 -0
  61. package/dist/src/files.d.ts +130 -0
  62. package/dist/src/files.js +49 -0
  63. package/dist/src/git.d.ts +271 -0
  64. package/dist/src/git.js +64 -0
  65. package/dist/src/github.d.ts +174 -0
  66. package/dist/src/github.js +31 -0
  67. package/dist/src/heads.d.ts +255 -0
  68. package/dist/src/heads.js +48 -0
  69. package/dist/src/hooks.d.ts +201 -0
  70. package/dist/src/hooks.js +28 -0
  71. package/dist/src/host.d.ts +137 -0
  72. package/dist/src/host.js +49 -0
  73. package/dist/src/ids.d.ts +66 -0
  74. package/dist/src/ids.js +67 -0
  75. package/dist/src/index.d.ts +30 -0
  76. package/dist/src/index.js +779 -0
  77. package/dist/src/jobs.d.ts +152 -0
  78. package/dist/src/jobs.js +34 -0
  79. package/dist/src/json.d.ts +24 -0
  80. package/dist/src/json.js +21 -0
  81. package/dist/src/mcp.d.ts +212 -0
  82. package/dist/src/mcp.js +34 -0
  83. package/dist/src/messages.d.ts +114 -0
  84. package/dist/src/messages.js +28 -0
  85. package/dist/src/model/index.d.ts +6 -0
  86. package/dist/src/model/index.js +61 -0
  87. package/dist/src/model/message.d.ts +178 -0
  88. package/dist/src/model/message.js +7 -0
  89. package/dist/src/model/model.d.ts +154 -0
  90. package/dist/src/model/model.js +11 -0
  91. package/dist/src/model/text.d.ts +6 -0
  92. package/dist/src/model/text.js +10 -0
  93. package/dist/src/model/tool.d.ts +36 -0
  94. package/dist/src/model/tool.js +1 -0
  95. package/dist/src/model/transcript.d.ts +34 -0
  96. package/dist/src/model/transcript.js +37 -0
  97. package/dist/src/model/typed.d.ts +6 -0
  98. package/dist/src/model/typed.js +8 -0
  99. package/dist/src/models.d.ts +195 -0
  100. package/dist/src/models.js +45 -0
  101. package/dist/src/parts.d.ts +364 -0
  102. package/dist/src/parts.js +35 -0
  103. package/dist/src/patch.d.ts +21 -0
  104. package/dist/src/patch.js +11 -0
  105. package/dist/src/plugins.d.ts +36 -0
  106. package/dist/src/plugins.js +9 -0
  107. package/dist/src/primitives.d.ts +83 -0
  108. package/dist/src/primitives.js +26 -0
  109. package/dist/src/runs.d.ts +433 -0
  110. package/dist/src/runs.js +39 -0
  111. package/dist/src/schema.d.ts +14 -0
  112. package/dist/src/schema.js +8 -0
  113. package/dist/src/serial.d.ts +18 -0
  114. package/dist/src/serial.js +39 -0
  115. package/dist/src/sessions.d.ts +578 -0
  116. package/dist/src/sessions.js +74 -0
  117. package/dist/src/store.d.ts +831 -0
  118. package/dist/src/store.js +33 -0
  119. package/dist/src/tools.d.ts +76 -0
  120. package/dist/src/tools.js +24 -0
  121. package/dist/src/views.d.ts +2737 -0
  122. package/dist/src/views.js +50 -0
  123. package/dist/src/wire/base64.d.ts +2 -0
  124. package/dist/src/wire/base64.js +6 -0
  125. package/dist/src/wire/nullable.d.ts +2 -0
  126. package/dist/src/wire/nullable.js +6 -0
  127. package/dist/src/wire/operations/browser.d.ts +535 -0
  128. package/dist/src/wire/operations/browser.js +12 -0
  129. package/dist/src/wire/operations/fields.d.ts +54 -0
  130. package/dist/src/wire/operations/fields.js +30 -0
  131. package/dist/src/wire/operations/files.d.ts +244 -0
  132. package/dist/src/wire/operations/files.js +13 -0
  133. package/dist/src/wire/operations/git.d.ts +513 -0
  134. package/dist/src/wire/operations/git.js +15 -0
  135. package/dist/src/wire/operations/github.d.ts +172 -0
  136. package/dist/src/wire/operations/github.js +12 -0
  137. package/dist/src/wire/operations/host.d.ts +1011 -0
  138. package/dist/src/wire/operations/host.js +27 -0
  139. package/dist/src/wire/operations/index.d.ts +6703 -0
  140. package/dist/src/wire/operations/index.js +40 -0
  141. package/dist/src/wire/operations/session.d.ts +3411 -0
  142. package/dist/src/wire/operations/session.js +25 -0
  143. package/dist/src/wire/operations/workspace.d.ts +830 -0
  144. package/dist/src/wire/operations/workspace.js +24 -0
  145. package/dist/src/workspaces.d.ts +119 -0
  146. package/dist/src/workspaces.js +38 -0
  147. package/package.json +51 -3
  148. package/README.md +0 -3
@@ -0,0 +1,36 @@
1
+ import { Type } from "typebox";
2
+ import type { Failure } from "./errors.ts";
3
+ import type { Message as ModelMessage } from "./model/message.ts";
4
+ import type { ModelRef, Thinking, Usage } from "./models.ts";
5
+ import type { Decoded, Schema } from "./schema.ts";
6
+ export declare const PromptOverrideType: Type.TUnion<[Type.TObject<{
7
+ kind: Type.TLiteral<"layer">;
8
+ text: Type.TString;
9
+ order: Type.TOptional<Type.TNumber>;
10
+ }>, Type.TObject<{
11
+ kind: Type.TLiteral<"replace">;
12
+ text: Type.TString;
13
+ }>]>;
14
+ export type PromptOverride = Decoded<typeof PromptOverrideType>;
15
+ export declare const PromptOverrideSchema: Schema<PromptOverride>;
16
+ export type ModelRequestInput<T = string> = {
17
+ readonly model: ModelRef;
18
+ readonly system?: string;
19
+ readonly messages: readonly ModelMessage[];
20
+ readonly thinking?: Thinking;
21
+ readonly output?: Schema<T>;
22
+ readonly maxOutput?: number;
23
+ readonly signal?: AbortSignal;
24
+ };
25
+ export type ModelRequestOutcome<T = string> = {
26
+ readonly kind: "ok";
27
+ readonly value: T;
28
+ readonly usage: Usage;
29
+ readonly stop: "end" | "length";
30
+ } | {
31
+ readonly kind: "refused";
32
+ readonly reason: string;
33
+ } | {
34
+ readonly kind: "failed";
35
+ readonly failure: Failure;
36
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ PromptOverrideType2,
3
+ PromptOverrideSchema2
4
+ } from "../chunks/browser-j629a6wa.js";
5
+ import"../chunks/browser-vzc3r2r3.js";
6
+ export {
7
+ PromptOverrideSchema2 as PromptOverrideSchema,
8
+ PromptOverrideType2 as PromptOverrideType
9
+ };
@@ -0,0 +1,83 @@
1
+ import { Type } from "typebox";
2
+ import type { TSchema } from "typebox";
3
+ import type { Cursor } from "./ids.ts";
4
+ import type { Decoded, Schema } from "./schema.ts";
5
+ export declare function pagedSchema<T extends TSchema>(item: T): Schema<{
6
+ items: import("typebox").StaticType<["Root"], "Decode", {
7
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
8
+ } & {
9
+ Root: Type.TObject<{
10
+ items: Type.TArray<T>;
11
+ next: Type.TUnion<[Type.TUnsafe<import("./ids.ts").Id<"cursor">>, Type.TNull]>;
12
+ }>;
13
+ }, {
14
+ items: Type.TArray<T>;
15
+ next: Type.TUnion<[Type.TUnsafe<import("./ids.ts").Id<"cursor">>, Type.TNull]>;
16
+ }, T>[];
17
+ next: import("./ids.ts").Id<"cursor"> | null;
18
+ }>;
19
+ export declare const ParentFilterType: Type.TUnion<[Type.TObject<{
20
+ kind: Type.TLiteral<"all">;
21
+ }>, Type.TObject<{
22
+ kind: Type.TLiteral<"roots">;
23
+ }>, Type.TObject<{
24
+ kind: Type.TLiteral<"children">;
25
+ session: Type.TUnsafe<import("./ids.ts").Id<"session">>;
26
+ }>]>;
27
+ export type ParentFilter = Decoded<typeof ParentFilterType>;
28
+ export declare const CapabilityWireType: Type.TUnion<[Type.TObject<{
29
+ kind: Type.TLiteral<"available">;
30
+ }>, Type.TObject<{
31
+ kind: Type.TLiteral<"unsupported">;
32
+ reason: Type.TString;
33
+ }>, Type.TObject<{
34
+ kind: Type.TLiteral<"denied">;
35
+ reason: Type.TString;
36
+ }>, Type.TObject<{
37
+ kind: Type.TLiteral<"unavailable">;
38
+ retry: Type.TEnum<["allowed", "manual"]>;
39
+ reason: Type.TString;
40
+ }>]>;
41
+ export type CapabilityWire = Decoded<typeof CapabilityWireType>;
42
+ export declare const IdentityChallengeType: Type.TObject<{
43
+ hostId: Type.TUnsafe<import("./ids.ts").Id<"host">>;
44
+ nonce: Type.TString;
45
+ signature: Type.TString;
46
+ publicKey: Type.TString;
47
+ }>;
48
+ export type IdentityChallenge = Decoded<typeof IdentityChallengeType>;
49
+ export declare const HostDescriptionType: Type.TObject<{
50
+ name: Type.TString;
51
+ platform: Type.TString;
52
+ version: Type.TString;
53
+ }>;
54
+ export type HostDescription = Decoded<typeof HostDescriptionType>;
55
+ export declare const ParentFilterSchema: Schema<ParentFilter>;
56
+ export declare const CapabilityWireSchema: Schema<CapabilityWire>;
57
+ export declare const IdentityChallengeSchema: Schema<IdentityChallenge>;
58
+ export declare const HostDescriptionSchema: Schema<HostDescription>;
59
+ export type Disposer = () => void;
60
+ export type Owned = {
61
+ close(): Promise<void>;
62
+ [Symbol.asyncDispose](): Promise<void>;
63
+ };
64
+ export type RequestOptions = {
65
+ readonly signal?: AbortSignal;
66
+ };
67
+ export type Paged<T> = {
68
+ readonly items: readonly T[];
69
+ readonly next: Cursor | null;
70
+ };
71
+ /** A capability as the client holds it: the wire's answer, with the API itself when it is available. */
72
+ export type Capability<T> = Exclude<CapabilityWire, {
73
+ readonly kind: "available";
74
+ }> | {
75
+ readonly kind: "available";
76
+ readonly api: T;
77
+ };
78
+ export type ByteReader = Owned & {
79
+ readonly size: number | null;
80
+ readonly mime: string | null;
81
+ chunks(): AsyncIterable<Uint8Array>;
82
+ };
83
+ export type Awaitable<T> = T | Promise<T>;
@@ -0,0 +1,26 @@
1
+ import {
2
+ pagedSchema2,
3
+ ParentFilterType2,
4
+ CapabilityWireType2,
5
+ IdentityChallengeType2,
6
+ HostDescriptionType2,
7
+ ParentFilterSchema2,
8
+ CapabilityWireSchema2,
9
+ IdentityChallengeSchema2,
10
+ HostDescriptionSchema2
11
+ } from "../chunks/browser-0byq2fja.js";
12
+ import"../chunks/browser-sgwxbek9.js";
13
+ import"../chunks/browser-4et7qtz3.js";
14
+ import"../chunks/browser-ypez6s7v.js";
15
+ import"../chunks/browser-vzc3r2r3.js";
16
+ export {
17
+ CapabilityWireSchema2 as CapabilityWireSchema,
18
+ CapabilityWireType2 as CapabilityWireType,
19
+ HostDescriptionSchema2 as HostDescriptionSchema,
20
+ HostDescriptionType2 as HostDescriptionType,
21
+ IdentityChallengeSchema2 as IdentityChallengeSchema,
22
+ IdentityChallengeType2 as IdentityChallengeType,
23
+ ParentFilterSchema2 as ParentFilterSchema,
24
+ ParentFilterType2 as ParentFilterType,
25
+ pagedSchema2 as pagedSchema
26
+ };
@@ -0,0 +1,433 @@
1
+ import { Type } from "typebox";
2
+ import type { TSchema } from "typebox";
3
+ import type { Decoded, Schema } from "./schema.ts";
4
+ export declare const RunViewType: Type.TObject<{
5
+ id: Type.TUnsafe<import("./ids.ts").Id<"run">>;
6
+ head: Type.TUnsafe<import("./ids.ts").Id<"head">>;
7
+ startedAt: Type.TNumber;
8
+ attempt: Type.TNumber;
9
+ configuration: Type.TObject<{
10
+ kind: Type.TLiteral<"exact">;
11
+ model: Type.TObject<{
12
+ provider: Type.TString;
13
+ id: Type.TString;
14
+ }>;
15
+ thinking: Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
16
+ agent: Type.TUnion<[Type.TString, Type.TNull]>;
17
+ settings: Type.TRecord<"^.*$", Type.TUnsafe<import("./json.ts").Json>>;
18
+ settingsVersion: Type.TString;
19
+ }>;
20
+ origin: Type.TUnion<[Type.TObject<{
21
+ kind: Type.TLiteral<"input">;
22
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
23
+ }>, Type.TObject<{
24
+ kind: Type.TLiteral<"continuation">;
25
+ from: Type.TEnum<["child", "job", "wake"]>;
26
+ }>]>;
27
+ }>;
28
+ export type RunView = Decoded<typeof RunViewType>;
29
+ export declare const RunEndType: Type.TUnion<[Type.TObject<{
30
+ kind: Type.TLiteral<"completed">;
31
+ usage: Type.TObject<{
32
+ input: Type.TNumber;
33
+ output: Type.TNumber;
34
+ cacheRead: Type.TNumber;
35
+ cacheWrite: Type.TNumber;
36
+ reasoning: Type.TUnion<[Type.TNumber, Type.TNull]>;
37
+ total: Type.TNumber;
38
+ cost: Type.TObject<{
39
+ input: Type.TNumber;
40
+ output: Type.TNumber;
41
+ cacheRead: Type.TNumber;
42
+ cacheWrite: Type.TNumber;
43
+ total: Type.TNumber;
44
+ }>;
45
+ }>;
46
+ }>, Type.TObject<{
47
+ kind: Type.TLiteral<"stopped">;
48
+ }>, Type.TObject<{
49
+ kind: Type.TLiteral<"failed">;
50
+ failure: Type.TObject<{
51
+ class: Type.TEnum<["rate_limit", "auth", "quota", "context_window", "overloaded", "network", "aborted", "provider", "runner"]>;
52
+ message: Type.TString;
53
+ retryAfterMs: Type.TOptional<Type.TNumber>;
54
+ }>;
55
+ }>]>;
56
+ export type RunEnd = Decoded<typeof RunEndType>;
57
+ export declare const WaitTargetType: Type.TUnion<[Type.TObject<{
58
+ kind: Type.TLiteral<"run">;
59
+ session: Type.TUnsafe<import("./ids.ts").Id<"session">>;
60
+ run: Type.TUnsafe<import("./ids.ts").Id<"run">>;
61
+ deadline: Type.TOptional<Type.TNumber>;
62
+ }>, Type.TObject<{
63
+ kind: Type.TLiteral<"job">;
64
+ job: Type.TUnsafe<import("./ids.ts").Id<"job">>;
65
+ deadline: Type.TOptional<Type.TNumber>;
66
+ }>, Type.TObject<{
67
+ kind: Type.TLiteral<"part">;
68
+ part: Type.TUnsafe<import("./ids.ts").Id<"part">>;
69
+ deadline: Type.TOptional<Type.TNumber>;
70
+ }>, Type.TObject<{
71
+ kind: Type.TLiteral<"timer">;
72
+ until: Type.TNumber;
73
+ deadline: Type.TOptional<Type.TNumber>;
74
+ }>]>;
75
+ export type WaitTarget = Decoded<typeof WaitTargetType>;
76
+ export declare const ExecutionType: Type.TUnion<[Type.TObject<{
77
+ kind: Type.TLiteral<"idle">;
78
+ lastRun: Type.TUnion<[Type.TObject<{
79
+ id: Type.TUnsafe<import("./ids.ts").Id<"run">>;
80
+ end: Type.TUnion<[Type.TObject<{
81
+ kind: Type.TLiteral<"completed">;
82
+ usage: Type.TObject<{
83
+ input: Type.TNumber;
84
+ output: Type.TNumber;
85
+ cacheRead: Type.TNumber;
86
+ cacheWrite: Type.TNumber;
87
+ reasoning: Type.TUnion<[Type.TNumber, Type.TNull]>;
88
+ total: Type.TNumber;
89
+ cost: Type.TObject<{
90
+ input: Type.TNumber;
91
+ output: Type.TNumber;
92
+ cacheRead: Type.TNumber;
93
+ cacheWrite: Type.TNumber;
94
+ total: Type.TNumber;
95
+ }>;
96
+ }>;
97
+ }>, Type.TObject<{
98
+ kind: Type.TLiteral<"stopped">;
99
+ }>, Type.TObject<{
100
+ kind: Type.TLiteral<"failed">;
101
+ failure: Type.TObject<{
102
+ class: Type.TEnum<["rate_limit", "auth", "quota", "context_window", "overloaded", "network", "aborted", "provider", "runner"]>;
103
+ message: Type.TString;
104
+ retryAfterMs: Type.TOptional<Type.TNumber>;
105
+ }>;
106
+ }>]>;
107
+ endedAt: Type.TNumber;
108
+ }>, Type.TNull]>;
109
+ }>, Type.TObject<{
110
+ kind: Type.TLiteral<"live">;
111
+ run: Type.TObject<{
112
+ id: Type.TUnsafe<import("./ids.ts").Id<"run">>;
113
+ head: Type.TUnsafe<import("./ids.ts").Id<"head">>;
114
+ startedAt: Type.TNumber;
115
+ attempt: Type.TNumber;
116
+ configuration: Type.TObject<{
117
+ kind: Type.TLiteral<"exact">;
118
+ model: Type.TObject<{
119
+ provider: Type.TString;
120
+ id: Type.TString;
121
+ }>;
122
+ thinking: Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
123
+ agent: Type.TUnion<[Type.TString, Type.TNull]>;
124
+ settings: Type.TRecord<"^.*$", Type.TUnsafe<import("./json.ts").Json>>;
125
+ settingsVersion: Type.TString;
126
+ }>;
127
+ origin: Type.TUnion<[Type.TObject<{
128
+ kind: Type.TLiteral<"input">;
129
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
130
+ }>, Type.TObject<{
131
+ kind: Type.TLiteral<"continuation">;
132
+ from: Type.TEnum<["child", "job", "wake"]>;
133
+ }>]>;
134
+ }>;
135
+ phase: Type.TEnum<["responding", "executing"]>;
136
+ stopping: Type.TBoolean;
137
+ }>, Type.TObject<{
138
+ kind: Type.TLiteral<"waiting">;
139
+ run: Type.TObject<{
140
+ id: Type.TUnsafe<import("./ids.ts").Id<"run">>;
141
+ head: Type.TUnsafe<import("./ids.ts").Id<"head">>;
142
+ startedAt: Type.TNumber;
143
+ attempt: Type.TNumber;
144
+ configuration: Type.TObject<{
145
+ kind: Type.TLiteral<"exact">;
146
+ model: Type.TObject<{
147
+ provider: Type.TString;
148
+ id: Type.TString;
149
+ }>;
150
+ thinking: Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
151
+ agent: Type.TUnion<[Type.TString, Type.TNull]>;
152
+ settings: Type.TRecord<"^.*$", Type.TUnsafe<import("./json.ts").Json>>;
153
+ settingsVersion: Type.TString;
154
+ }>;
155
+ origin: Type.TUnion<[Type.TObject<{
156
+ kind: Type.TLiteral<"input">;
157
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
158
+ }>, Type.TObject<{
159
+ kind: Type.TLiteral<"continuation">;
160
+ from: Type.TEnum<["child", "job", "wake"]>;
161
+ }>]>;
162
+ }>;
163
+ on: Type.TUnion<[Type.TObject<{
164
+ kind: Type.TLiteral<"run">;
165
+ session: Type.TUnsafe<import("./ids.ts").Id<"session">>;
166
+ run: Type.TUnsafe<import("./ids.ts").Id<"run">>;
167
+ deadline: Type.TOptional<Type.TNumber>;
168
+ }>, Type.TObject<{
169
+ kind: Type.TLiteral<"job">;
170
+ job: Type.TUnsafe<import("./ids.ts").Id<"job">>;
171
+ deadline: Type.TOptional<Type.TNumber>;
172
+ }>, Type.TObject<{
173
+ kind: Type.TLiteral<"part">;
174
+ part: Type.TUnsafe<import("./ids.ts").Id<"part">>;
175
+ deadline: Type.TOptional<Type.TNumber>;
176
+ }>, Type.TObject<{
177
+ kind: Type.TLiteral<"timer">;
178
+ until: Type.TNumber;
179
+ deadline: Type.TOptional<Type.TNumber>;
180
+ }>]>;
181
+ }>, Type.TObject<{
182
+ kind: Type.TLiteral<"retrying">;
183
+ run: Type.TObject<{
184
+ id: Type.TUnsafe<import("./ids.ts").Id<"run">>;
185
+ head: Type.TUnsafe<import("./ids.ts").Id<"head">>;
186
+ startedAt: Type.TNumber;
187
+ attempt: Type.TNumber;
188
+ configuration: Type.TObject<{
189
+ kind: Type.TLiteral<"exact">;
190
+ model: Type.TObject<{
191
+ provider: Type.TString;
192
+ id: Type.TString;
193
+ }>;
194
+ thinking: Type.TEnum<["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
195
+ agent: Type.TUnion<[Type.TString, Type.TNull]>;
196
+ settings: Type.TRecord<"^.*$", Type.TUnsafe<import("./json.ts").Json>>;
197
+ settingsVersion: Type.TString;
198
+ }>;
199
+ origin: Type.TUnion<[Type.TObject<{
200
+ kind: Type.TLiteral<"input">;
201
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
202
+ }>, Type.TObject<{
203
+ kind: Type.TLiteral<"continuation">;
204
+ from: Type.TEnum<["child", "job", "wake"]>;
205
+ }>]>;
206
+ }>;
207
+ until: Type.TNumber;
208
+ reason: Type.TString;
209
+ }>]>;
210
+ export type Execution = Decoded<typeof ExecutionType>;
211
+ export declare const BackgroundItemType: Type.TObject<{
212
+ kind: Type.TEnum<["child", "job", "page"]>;
213
+ id: Type.TString;
214
+ title: Type.TString;
215
+ state: Type.TEnum<["working", "waiting", "done", "failed"]>;
216
+ startedBy: Type.TUnion<[Type.TUnsafe<import("./ids.ts").Id<"call">>, Type.TNull]>;
217
+ }>;
218
+ export type BackgroundItem = Decoded<typeof BackgroundItemType>;
219
+ export declare const WaitOutcomeType: Type.TUnion<[Type.TObject<{
220
+ kind: Type.TLiteral<"run">;
221
+ session: Type.TUnsafe<import("./ids.ts").Id<"session">>;
222
+ run: Type.TUnsafe<import("./ids.ts").Id<"run">>;
223
+ end: Type.TUnion<[Type.TObject<{
224
+ kind: Type.TLiteral<"completed">;
225
+ usage: Type.TObject<{
226
+ input: Type.TNumber;
227
+ output: Type.TNumber;
228
+ cacheRead: Type.TNumber;
229
+ cacheWrite: Type.TNumber;
230
+ reasoning: Type.TUnion<[Type.TNumber, Type.TNull]>;
231
+ total: Type.TNumber;
232
+ cost: Type.TObject<{
233
+ input: Type.TNumber;
234
+ output: Type.TNumber;
235
+ cacheRead: Type.TNumber;
236
+ cacheWrite: Type.TNumber;
237
+ total: Type.TNumber;
238
+ }>;
239
+ }>;
240
+ }>, Type.TObject<{
241
+ kind: Type.TLiteral<"stopped">;
242
+ }>, Type.TObject<{
243
+ kind: Type.TLiteral<"failed">;
244
+ failure: Type.TObject<{
245
+ class: Type.TEnum<["rate_limit", "auth", "quota", "context_window", "overloaded", "network", "aborted", "provider", "runner"]>;
246
+ message: Type.TString;
247
+ retryAfterMs: Type.TOptional<Type.TNumber>;
248
+ }>;
249
+ }>]>;
250
+ }>, Type.TObject<{
251
+ kind: Type.TLiteral<"job">;
252
+ job: Type.TUnsafe<import("./ids.ts").Id<"job">>;
253
+ end: Type.TUnion<[Type.TObject<{
254
+ kind: Type.TLiteral<"exited">;
255
+ code: Type.TUnion<[Type.TNumber, Type.TNull]>;
256
+ reason: Type.TEnum<["exited", "terminated", "expired", "host-lost"]>;
257
+ }>, Type.TObject<{
258
+ kind: Type.TLiteral<"lost">;
259
+ }>]>;
260
+ }>, Type.TObject<{
261
+ kind: Type.TLiteral<"part">;
262
+ part: Type.TUnsafe<import("./ids.ts").Id<"part">>;
263
+ answer: Type.TUnion<[Type.TObject<{
264
+ action: Type.TString;
265
+ input: Type.TUnsafe<import("./json.ts").Json>;
266
+ }>, Type.TNull]>;
267
+ }>, Type.TObject<{
268
+ kind: Type.TLiteral<"timer">;
269
+ }>, Type.TObject<{
270
+ kind: Type.TLiteral<"deadline">;
271
+ }>, Type.TObject<{
272
+ kind: Type.TLiteral<"input">;
273
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
274
+ }>, Type.TObject<{
275
+ kind: Type.TLiteral<"all">;
276
+ outcomes: Type.TArray<Type.TRef<"WaitOutcome">>;
277
+ }>, Type.TObject<{
278
+ kind: Type.TLiteral<"stopped">;
279
+ }>]>;
280
+ declare const WAIT_OUTCOME: Type.TCyclic<{
281
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
282
+ } & {
283
+ WaitOutcome: Type.TUnion<[Type.TObject<{
284
+ kind: Type.TLiteral<"run">;
285
+ session: Type.TUnsafe<import("./ids.ts").Id<"session">>;
286
+ run: Type.TUnsafe<import("./ids.ts").Id<"run">>;
287
+ end: Type.TUnion<[Type.TObject<{
288
+ kind: Type.TLiteral<"completed">;
289
+ usage: Type.TObject<{
290
+ input: Type.TNumber;
291
+ output: Type.TNumber;
292
+ cacheRead: Type.TNumber;
293
+ cacheWrite: Type.TNumber;
294
+ reasoning: Type.TUnion<[Type.TNumber, Type.TNull]>;
295
+ total: Type.TNumber;
296
+ cost: Type.TObject<{
297
+ input: Type.TNumber;
298
+ output: Type.TNumber;
299
+ cacheRead: Type.TNumber;
300
+ cacheWrite: Type.TNumber;
301
+ total: Type.TNumber;
302
+ }>;
303
+ }>;
304
+ }>, Type.TObject<{
305
+ kind: Type.TLiteral<"stopped">;
306
+ }>, Type.TObject<{
307
+ kind: Type.TLiteral<"failed">;
308
+ failure: Type.TObject<{
309
+ class: Type.TEnum<["rate_limit", "auth", "quota", "context_window", "overloaded", "network", "aborted", "provider", "runner"]>;
310
+ message: Type.TString;
311
+ retryAfterMs: Type.TOptional<Type.TNumber>;
312
+ }>;
313
+ }>]>;
314
+ }>, Type.TObject<{
315
+ kind: Type.TLiteral<"job">;
316
+ job: Type.TUnsafe<import("./ids.ts").Id<"job">>;
317
+ end: Type.TUnion<[Type.TObject<{
318
+ kind: Type.TLiteral<"exited">;
319
+ code: Type.TUnion<[Type.TNumber, Type.TNull]>;
320
+ reason: Type.TEnum<["exited", "terminated", "expired", "host-lost"]>;
321
+ }>, Type.TObject<{
322
+ kind: Type.TLiteral<"lost">;
323
+ }>]>;
324
+ }>, Type.TObject<{
325
+ kind: Type.TLiteral<"part">;
326
+ part: Type.TUnsafe<import("./ids.ts").Id<"part">>;
327
+ answer: Type.TUnion<[Type.TObject<{
328
+ action: Type.TString;
329
+ input: Type.TUnsafe<import("./json.ts").Json>;
330
+ }>, Type.TNull]>;
331
+ }>, Type.TObject<{
332
+ kind: Type.TLiteral<"timer">;
333
+ }>, Type.TObject<{
334
+ kind: Type.TLiteral<"deadline">;
335
+ }>, Type.TObject<{
336
+ kind: Type.TLiteral<"input">;
337
+ message: Type.TUnsafe<import("./ids.ts").Id<"message">>;
338
+ }>, Type.TObject<{
339
+ kind: Type.TLiteral<"all">;
340
+ outcomes: Type.TArray<Type.TRef<"WaitOutcome">>;
341
+ }>, Type.TObject<{
342
+ kind: Type.TLiteral<"stopped">;
343
+ }>]>;
344
+ }, "WaitOutcome">;
345
+ export type WaitOutcome = Decoded<typeof WAIT_OUTCOME>;
346
+ export declare function stopOutcomeSchema<T extends TSchema>(outcome: T): Schema<{
347
+ kind: "requested";
348
+ } | ((Readonly<Partial<Pick<{
349
+ kind: "settled";
350
+ outcome: import("typebox").StaticType<["Root"], "Decode", {
351
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
352
+ } & {
353
+ Root: Type.TUnion<[Type.TObject<{
354
+ kind: Type.TLiteral<"requested">;
355
+ }>, Type.TObject<{
356
+ kind: Type.TLiteral<"settled">;
357
+ outcome: T;
358
+ }>, Type.TObject<{
359
+ kind: Type.TLiteral<"missing">;
360
+ }>]>;
361
+ }, {
362
+ kind: Type.TLiteral<"settled">;
363
+ outcome: T;
364
+ }, T>;
365
+ }, T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? "outcome" : never : never>>> & Readonly<Pick<{
366
+ kind: "settled";
367
+ outcome: import("typebox").StaticType<["Root"], "Decode", {
368
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
369
+ } & {
370
+ Root: Type.TUnion<[Type.TObject<{
371
+ kind: Type.TLiteral<"requested">;
372
+ }>, Type.TObject<{
373
+ kind: Type.TLiteral<"settled">;
374
+ outcome: T;
375
+ }>, Type.TObject<{
376
+ kind: Type.TLiteral<"missing">;
377
+ }>]>;
378
+ }, {
379
+ kind: Type.TLiteral<"settled">;
380
+ outcome: T;
381
+ }, T>;
382
+ }, T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? never : "outcome" : never>> & Partial<Pick<{
383
+ kind: "settled";
384
+ outcome: import("typebox").StaticType<["Root"], "Decode", {
385
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
386
+ } & {
387
+ Root: Type.TUnion<[Type.TObject<{
388
+ kind: Type.TLiteral<"requested">;
389
+ }>, Type.TObject<{
390
+ kind: Type.TLiteral<"settled">;
391
+ outcome: T;
392
+ }>, Type.TObject<{
393
+ kind: Type.TLiteral<"missing">;
394
+ }>]>;
395
+ }, {
396
+ kind: Type.TLiteral<"settled">;
397
+ outcome: T;
398
+ }, T>;
399
+ }, T extends Type.TOptional<Type.TSchema> ? T extends Type.TReadonly<T> ? never : "outcome" : never>> & Required<Pick<{
400
+ kind: "settled";
401
+ outcome: import("typebox").StaticType<["Root"], "Decode", {
402
+ Json: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"Json">>, Type.TRecord<"^.*$", Type.TRef<"Json">>]>;
403
+ } & {
404
+ Root: Type.TUnion<[Type.TObject<{
405
+ kind: Type.TLiteral<"requested">;
406
+ }>, Type.TObject<{
407
+ kind: Type.TLiteral<"settled">;
408
+ outcome: T;
409
+ }>, Type.TObject<{
410
+ kind: Type.TLiteral<"missing">;
411
+ }>]>;
412
+ }, {
413
+ kind: Type.TLiteral<"settled">;
414
+ outcome: T;
415
+ }, T>;
416
+ }, Exclude<"kind", (T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? "outcome" : never : never) | (T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? never : "outcome" : never) | (T extends Type.TOptional<Type.TSchema> ? T extends Type.TReadonly<T> ? never : "outcome" : never)> | Exclude<"outcome", (T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? "outcome" : never : never) | (T extends Type.TReadonly<Type.TSchema> ? T extends Type.TOptional<T> ? never : "outcome" : never) | (T extends Type.TOptional<Type.TSchema> ? T extends Type.TReadonly<T> ? never : "outcome" : never)>>> extends infer T_2 ? { [K in keyof T_2]: T_2[K]; } : never) extends infer T_1 extends Record<PropertyKey, unknown> ? { [Key in keyof T_1]: T_1[Key]; } : never) | {
417
+ kind: "missing";
418
+ }>;
419
+ export declare const RunViewSchema: Schema<RunView>;
420
+ export declare const RunEndSchema: Schema<RunEnd>;
421
+ export declare const WaitTargetSchema: Schema<WaitTarget>;
422
+ export declare const ExecutionSchema: Schema<Execution>;
423
+ export declare const BackgroundItemSchema: Schema<BackgroundItem>;
424
+ export declare const WaitOutcomeSchema: Schema<WaitOutcome>;
425
+ export type StopOutcome<O> = {
426
+ readonly kind: "requested";
427
+ } | {
428
+ readonly kind: "settled";
429
+ readonly outcome: O;
430
+ } | {
431
+ readonly kind: "missing";
432
+ };
433
+ export {};
@@ -0,0 +1,39 @@
1
+ import {
2
+ RunViewType2,
3
+ RunEndType2,
4
+ WaitTargetType2,
5
+ ExecutionType2,
6
+ BackgroundItemType2,
7
+ WaitOutcomeType2,
8
+ stopOutcomeSchema2,
9
+ RunViewSchema2,
10
+ RunEndSchema2,
11
+ WaitTargetSchema2,
12
+ ExecutionSchema2,
13
+ BackgroundItemSchema2,
14
+ WaitOutcomeSchema2
15
+ } from "../chunks/browser-s7907azt.js";
16
+ import"../chunks/browser-40enyw9r.js";
17
+ import"../chunks/browser-m0wzr0g8.js";
18
+ import"../chunks/browser-vapnjwp3.js";
19
+ import"../chunks/browser-8t9anqfc.js";
20
+ import"../chunks/browser-sgwxbek9.js";
21
+ import"../chunks/browser-1sfp0bcx.js";
22
+ import"../chunks/browser-4et7qtz3.js";
23
+ import"../chunks/browser-ypez6s7v.js";
24
+ import"../chunks/browser-vzc3r2r3.js";
25
+ export {
26
+ BackgroundItemSchema2 as BackgroundItemSchema,
27
+ BackgroundItemType2 as BackgroundItemType,
28
+ ExecutionSchema2 as ExecutionSchema,
29
+ ExecutionType2 as ExecutionType,
30
+ RunEndSchema2 as RunEndSchema,
31
+ RunEndType2 as RunEndType,
32
+ RunViewSchema2 as RunViewSchema,
33
+ RunViewType2 as RunViewType,
34
+ WaitOutcomeSchema2 as WaitOutcomeSchema,
35
+ WaitOutcomeType2 as WaitOutcomeType,
36
+ WaitTargetSchema2 as WaitTargetSchema,
37
+ WaitTargetType2 as WaitTargetType,
38
+ stopOutcomeSchema2 as stopOutcomeSchema
39
+ };
@@ -0,0 +1,14 @@
1
+ import type { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
2
+ import type { StaticDecode, TSchema } from "typebox";
3
+ import type { Validator } from "typebox/compile";
4
+ import type { Json } from "./json.ts";
5
+ export type Schema<T> = StandardSchemaV1<unknown, T> & StandardJSONSchemaV1<unknown, T>;
6
+ export type Infer<S extends StandardSchemaV1> = StandardSchemaV1.InferOutput<S>;
7
+ type Frozen<T> = [Json] extends [T] ? T : T extends string | number | boolean | bigint | symbol | null | undefined | Uint8Array ? T : {
8
+ readonly [K in keyof T]: Frozen<T[K]>;
9
+ };
10
+ /** The value a TypeBox schema decodes to, read-only all the way down: every concept's TypeScript type is this of its schema. */
11
+ export type Decoded<S extends TSchema> = Frozen<StaticDecode<S>>;
12
+ export declare function compile<T extends TSchema>(schema: T): Validator<{}, T>;
13
+ export declare function standard<T extends TSchema>(schema: T): Schema<StaticDecode<T>>;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import {
2
+ compile2,
3
+ standard2
4
+ } from "../chunks/browser-vzc3r2r3.js";
5
+ export {
6
+ compile2 as compile,
7
+ standard2 as standard
8
+ };
@@ -0,0 +1,18 @@
1
+ /** Tasks that run one at a time, in the order they were queued. */
2
+ export interface Serial {
3
+ /** Runs `task` once every task queued before it has settled. An earlier failure neither skips `task` nor rejects its result. */
4
+ run<T>(task: () => Promise<T>): Promise<T>;
5
+ /** Resolves, never rejects, once every task queued so far has settled. */
6
+ settled(): Promise<void>;
7
+ /** Whether a queued task has not settled yet. */
8
+ readonly busy: boolean;
9
+ }
10
+ /** Tasks that run one at a time per key; tasks under different keys run independently. */
11
+ export interface KeyedSerial<K> {
12
+ /** Runs `task` once every task queued under `key` before it has settled, as {@link Serial.run} does. */
13
+ run<T>(key: K, task: () => Promise<T>): Promise<T>;
14
+ }
15
+ /** Returns an empty {@link Serial}. */
16
+ export declare function serial(): Serial;
17
+ /** Returns an empty {@link KeyedSerial}. It holds a key only while that key has tasks queued. */
18
+ export declare function keyedSerial<K>(): KeyedSerial<K>;