@opencode/schema 2.1.3 → 2.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.
Files changed (50) hide show
  1. package/dist/agent.d.ts +5 -0
  2. package/dist/config/experimental.d.ts +2 -0
  3. package/dist/config/experimental.js +6 -0
  4. package/dist/config/provider.d.ts +73 -7
  5. package/dist/config/provider.js +10 -15
  6. package/dist/event-manifest.d.ts +128 -366
  7. package/dist/file-diff.d.ts +2 -0
  8. package/dist/file-diff.js +2 -0
  9. package/dist/generate.d.ts +355 -0
  10. package/dist/generate.js +134 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/mcp.d.ts +1 -0
  14. package/dist/mcp.js +2 -0
  15. package/dist/model-compatibility.d.ts +15 -4
  16. package/dist/model-compatibility.js +15 -4
  17. package/dist/model.d.ts +53 -2
  18. package/dist/model.js +9 -7
  19. package/dist/permission.d.ts +0 -9
  20. package/dist/persistent-pty.d.ts +0 -20
  21. package/dist/plugin.d.ts +15 -0
  22. package/dist/plugin.js +11 -1
  23. package/dist/prompt-input.d.ts +3 -36
  24. package/dist/prompt-input.js +2 -6
  25. package/dist/prompt.d.ts +96 -0
  26. package/dist/prompt.js +17 -1
  27. package/dist/provider.d.ts +40 -0
  28. package/dist/provider.js +14 -3
  29. package/dist/session-event.d.ts +320 -852
  30. package/dist/session-event.js +0 -7
  31. package/dist/session-fork.d.ts +2 -2
  32. package/dist/session-id.d.ts +0 -1
  33. package/dist/session-id.js +3 -7
  34. package/dist/session-inbox.d.ts +721 -101
  35. package/dist/session-inbox.js +10 -1
  36. package/dist/session-message.d.ts +998 -31
  37. package/dist/session-message.js +19 -2
  38. package/dist/session-revert.d.ts +64 -27
  39. package/dist/session-status-event.d.ts +0 -8
  40. package/dist/session-transfer.d.ts +23 -24
  41. package/dist/session.d.ts +12 -22
  42. package/dist/usage-limits.d.ts +227 -0
  43. package/dist/usage-limits.js +59 -0
  44. package/dist/v1/legacy-event.d.ts +0 -4
  45. package/dist/v1/permission.d.ts +0 -10
  46. package/dist/v1/session.d.ts +0 -177
  47. package/dist/vcs.d.ts +3 -0
  48. package/dist/vcs.js +2 -0
  49. package/dist/workspace-id.js +0 -2
  50. package/package.json +5 -3
@@ -0,0 +1,59 @@
1
+ export * as UsageLimits from "./usage-limits.js";
2
+ import { Schema } from "effect";
3
+ import { Model } from "./model.js";
4
+ import { Money } from "./money.js";
5
+ import { Provider } from "./provider.js";
6
+ import { optional } from "./schema.js";
7
+ const Percent = Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 100 }));
8
+ const Instant = Schema.Finite.annotate({ description: "Milliseconds since the Unix epoch" });
9
+ export const Meter = Schema.Struct({
10
+ /** How much of the window's allowance is used. */
11
+ percent: Percent,
12
+ /** Go refuses requests until the window resets. */
13
+ limited: Schema.Boolean,
14
+ resetsAt: Instant,
15
+ }).annotate({ identifier: "UsageLimits.Meter" });
16
+ export const Go = Schema.Struct({
17
+ rolling: Meter,
18
+ weekly: Meter,
19
+ monthly: Meter,
20
+ }).annotate({ identifier: "UsageLimits.Go" });
21
+ export const BudgetModel = Schema.Struct({
22
+ providerID: Provider.ID,
23
+ modelID: Model.ID,
24
+ name: Schema.String,
25
+ /** What a per-model budget's member has spent on this model this month. */
26
+ spent: Money.USD.pipe(optional),
27
+ }).annotate({ identifier: "UsageLimits.BudgetModel" });
28
+ export const Budget = Schema.Struct({
29
+ id: Schema.String,
30
+ limit: Money.USD,
31
+ /** The member's spend this month, or the pooled spend of a combined budget; per model, the most on one model. */
32
+ spent: Money.USD,
33
+ /** `each` limits every member separately; `combined` pools everyone's spend against one limit. */
34
+ scope: Schema.Literals(["each", "combined"]),
35
+ /** `set` counts spend across the budget's models; `model` limits each model separately. */
36
+ per: Schema.Literals(["set", "model"]),
37
+ /** `all` covers every model and billable service; `models` covers only `models`. */
38
+ coverage: Schema.Literals(["all", "models"]),
39
+ models: Schema.Array(BudgetModel),
40
+ /** The vendors whose models the budget counts, by name; empty when it doesn't count by vendor. */
41
+ vendors: Schema.Array(Schema.String),
42
+ /** The input price per 1M tokens from which the budget counts a model, when it sets one. */
43
+ inputPriceAtLeast: Money.USDPerMillionTokens.pipe(optional),
44
+ /** The budget counts models picked one by one, rather than by vendor or price. */
45
+ picked: Schema.Boolean,
46
+ /** Everyone in the workspace pools spend against it, so reaching it pauses model use for all of them. */
47
+ shared: Schema.Boolean,
48
+ resetsAt: Instant,
49
+ }).annotate({ identifier: "UsageLimits.Budget" });
50
+ export const Info = Schema.Struct({
51
+ workspace: Schema.Struct({
52
+ id: Schema.String,
53
+ name: Schema.String.pipe(optional),
54
+ /** The member's usage page in OpenCode Console. */
55
+ usageURL: Schema.String,
56
+ }),
57
+ go: Go.pipe(optional),
58
+ budgets: Schema.Array(Budget),
59
+ }).annotate({ identifier: "UsageLimits.Info" });
@@ -30,7 +30,6 @@ export declare const CommandExecuted: Schema.Struct<{
30
30
  readonly name: Schema.String;
31
31
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
32
32
  create: () => string & import("effect/Brand").Brand<"SessionID">;
33
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
34
33
  };
35
34
  readonly arguments: Schema.String;
36
35
  readonly messageID: Schema.brand<Schema.String, "SessionV1.MessageID"> & {
@@ -45,7 +44,6 @@ export declare const CommandExecuted: Schema.Struct<{
45
44
  readonly name: Schema.String;
46
45
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
47
46
  create: () => string & import("effect/Brand").Brand<"SessionID">;
48
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
49
47
  };
50
48
  readonly arguments: Schema.String;
51
49
  readonly messageID: Schema.brand<Schema.String, "SessionV1.MessageID"> & {
@@ -83,7 +81,6 @@ export declare const Definitions: readonly [Schema.Struct<{
83
81
  readonly name: Schema.String;
84
82
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
85
83
  create: () => string & import("effect/Brand").Brand<"SessionID">;
86
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
87
84
  };
88
85
  readonly arguments: Schema.String;
89
86
  readonly messageID: Schema.brand<Schema.String, "SessionV1.MessageID"> & {
@@ -98,7 +95,6 @@ export declare const Definitions: readonly [Schema.Struct<{
98
95
  readonly name: Schema.String;
99
96
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
100
97
  create: () => string & import("effect/Brand").Brand<"SessionID">;
101
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
102
98
  };
103
99
  readonly arguments: Schema.String;
104
100
  readonly messageID: Schema.brand<Schema.String, "SessionV1.MessageID"> & {
@@ -24,7 +24,6 @@ export declare const Request: Schema.Struct<{
24
24
  };
25
25
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
26
26
  create: () => string & import("effect/Brand").Brand<"SessionID">;
27
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
28
27
  };
29
28
  readonly permission: Schema.String;
30
29
  readonly patterns: Schema.$Array<Schema.String>;
@@ -53,7 +52,6 @@ export type Approval = typeof Approval.Type;
53
52
  export declare const AskInput: Schema.Struct<{
54
53
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
55
54
  create: () => string & import("effect/Brand").Brand<"SessionID">;
56
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
57
55
  };
58
56
  readonly permission: Schema.String;
59
57
  readonly patterns: Schema.$Array<Schema.String>;
@@ -114,7 +112,6 @@ export declare const Event: {
114
112
  };
115
113
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
116
114
  create: () => string & import("effect/Brand").Brand<"SessionID">;
117
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
118
115
  };
119
116
  readonly permission: Schema.String;
120
117
  readonly patterns: Schema.$Array<Schema.String>;
@@ -135,7 +132,6 @@ export declare const Event: {
135
132
  };
136
133
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
137
134
  create: () => string & import("effect/Brand").Brand<"SessionID">;
138
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
139
135
  };
140
136
  readonly permission: Schema.String;
141
137
  readonly patterns: Schema.$Array<Schema.String>;
@@ -176,7 +172,6 @@ export declare const Event: {
176
172
  readonly data: Schema.Struct<{
177
173
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
178
174
  create: () => string & import("effect/Brand").Brand<"SessionID">;
179
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
180
175
  };
181
176
  readonly requestID: Schema.brand<Schema.String, "PermissionV1.ID"> & {
182
177
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PermissionV1.ID">;
@@ -190,7 +185,6 @@ export declare const Event: {
190
185
  data: Schema.Struct<{
191
186
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
192
187
  create: () => string & import("effect/Brand").Brand<"SessionID">;
193
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
194
188
  };
195
189
  readonly requestID: Schema.brand<Schema.String, "PermissionV1.ID"> & {
196
190
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PermissionV1.ID">;
@@ -230,7 +224,6 @@ export declare const Event: {
230
224
  };
231
225
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
232
226
  create: () => string & import("effect/Brand").Brand<"SessionID">;
233
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
234
227
  };
235
228
  readonly permission: Schema.String;
236
229
  readonly patterns: Schema.$Array<Schema.String>;
@@ -251,7 +244,6 @@ export declare const Event: {
251
244
  };
252
245
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
253
246
  create: () => string & import("effect/Brand").Brand<"SessionID">;
254
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
255
247
  };
256
248
  readonly permission: Schema.String;
257
249
  readonly patterns: Schema.$Array<Schema.String>;
@@ -291,7 +283,6 @@ export declare const Event: {
291
283
  readonly data: Schema.Struct<{
292
284
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
293
285
  create: () => string & import("effect/Brand").Brand<"SessionID">;
294
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
295
286
  };
296
287
  readonly requestID: Schema.brand<Schema.String, "PermissionV1.ID"> & {
297
288
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PermissionV1.ID">;
@@ -305,7 +296,6 @@ export declare const Event: {
305
296
  data: Schema.Struct<{
306
297
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
307
298
  create: () => string & import("effect/Brand").Brand<"SessionID">;
308
- descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
309
299
  };
310
300
  readonly requestID: Schema.brand<Schema.String, "PermissionV1.ID"> & {
311
301
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PermissionV1.ID">;