@opencode/schema 2.1.4 → 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.
@@ -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" });
package/dist/vcs.d.ts CHANGED
@@ -26,6 +26,9 @@ export interface Base extends Schema.Schema.Type<typeof Base> {
26
26
  }
27
27
  export declare const Mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
28
28
  export type Mode = typeof Mode.Type;
29
+ /** How a diff lists untracked files: one by one, or each untracked folder as one `dir/` entry. */
30
+ export declare const Untracked: Schema.Literals<readonly ["files", "folders"]>;
31
+ export type Untracked = typeof Untracked.Type;
29
32
  export declare const FileStatus: Schema.Struct<{
30
33
  readonly file: Schema.String;
31
34
  readonly additions: Schema.Int;
package/dist/vcs.js CHANGED
@@ -16,6 +16,8 @@ export const Base = Schema.Struct({
16
16
  source: Schema.Literals(["reflog", "default"]),
17
17
  }).annotate({ identifier: "Vcs.Base" });
18
18
  export const Mode = Schema.Literals(["working", "branch", "committed"]).annotate({ identifier: "Vcs.Mode" });
19
+ /** How a diff lists untracked files: one by one, or each untracked folder as one `dir/` entry. */
20
+ export const Untracked = Schema.Literals(["files", "folders"]).annotate({ identifier: "Vcs.Untracked" });
19
21
  export const FileStatus = Schema.Struct({
20
22
  file: Schema.String,
21
23
  additions: NonNegativeInt,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "2.1.4",
4
+ "version": "2.2.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "build": "bun run script/build.ts",
30
+ "pack": "bun run script/pack.ts",
30
31
  "test": "bun test --only-failures",
31
32
  "typecheck": "bun check --no-script",
32
33
  "typecheck:tsc": "tsc --noEmit"