@encoredigitalgroup/opencode 0.2.7 → 0.2.8

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 (76) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/Quota/core/errors.d.ts +21 -0
  3. package/dist/lib/Quota/core/pace.d.ts +14 -0
  4. package/dist/lib/Quota/core/persist.d.ts +55 -0
  5. package/dist/lib/Quota/core/provider-source.d.ts +43 -0
  6. package/dist/lib/Quota/core/redact.d.ts +30 -0
  7. package/dist/lib/Quota/core/rows.d.ts +19 -0
  8. package/dist/lib/Quota/core/selection.d.ts +14 -0
  9. package/dist/lib/Quota/core/store.d.ts +99 -0
  10. package/dist/lib/Quota/core/types.d.ts +167 -0
  11. package/dist/lib/Quota/core/validate.d.ts +11 -0
  12. package/dist/lib/Quota/core/windows.d.ts +23 -0
  13. package/dist/lib/Quota/lib/accounting-format.d.ts +3 -0
  14. package/dist/lib/Quota/lib/anthropic.d.ts +113 -0
  15. package/dist/lib/Quota/lib/api-key-resolver.d.ts +124 -0
  16. package/dist/lib/Quota/lib/atomic-json.d.ts +13 -0
  17. package/dist/lib/Quota/lib/calendar-date.d.ts +14 -0
  18. package/dist/lib/Quota/lib/config-file-utils.d.ts +6 -0
  19. package/dist/lib/Quota/lib/config-write-target.d.ts +23 -0
  20. package/dist/lib/Quota/lib/cursor-pricing.d.ts +107 -0
  21. package/dist/lib/Quota/lib/display-sanitize.d.ts +11 -0
  22. package/dist/lib/Quota/lib/entries.d.ts +87 -0
  23. package/dist/lib/Quota/lib/env-template.d.ts +25 -0
  24. package/dist/lib/Quota/lib/file-lock.d.ts +20 -0
  25. package/dist/lib/Quota/lib/format-utils.d.ts +8 -0
  26. package/dist/lib/Quota/lib/home-dir-display.d.ts +6 -0
  27. package/dist/lib/Quota/lib/http.d.ts +95 -0
  28. package/dist/lib/Quota/lib/json-guards.d.ts +10 -0
  29. package/dist/lib/Quota/lib/modelsdev-pricing.d.ts +85 -0
  30. package/dist/lib/Quota/lib/openai.d.ts +65 -0
  31. package/dist/lib/Quota/lib/opencode-auth.d.ts +154 -0
  32. package/dist/lib/Quota/lib/opencode-config-files.d.ts +33 -0
  33. package/dist/lib/Quota/lib/opencode-db-path.d.ts +8 -0
  34. package/dist/lib/Quota/lib/opencode-runtime-paths.d.ts +16 -0
  35. package/dist/lib/Quota/lib/pricing-key.d.ts +55 -0
  36. package/dist/lib/Quota/lib/provider-availability.d.ts +12 -0
  37. package/dist/lib/Quota/lib/provider-metadata.d.ts +25 -0
  38. package/dist/lib/Quota/lib/provider-model-matching.d.ts +12 -0
  39. package/dist/lib/Quota/lib/provider-registration.d.ts +222 -0
  40. package/dist/lib/Quota/lib/quota-export-types.d.ts +101 -0
  41. package/dist/lib/Quota/lib/quota-export.d.ts +33 -0
  42. package/dist/lib/Quota/lib/quota-providers.d.ts +201 -0
  43. package/dist/lib/Quota/lib/resolved-auth-identity.d.ts +52 -0
  44. package/dist/lib/Quota/lib/runtime-provider-ids.d.ts +3 -0
  45. package/dist/lib/Quota/lib/token-buckets.d.ts +22 -0
  46. package/dist/lib/Quota/lib/types.d.ts +208 -0
  47. package/dist/lib/Quota/plugin.d.ts +8 -0
  48. package/dist/lib/Quota/providers/anthropic.d.ts +6 -0
  49. package/dist/lib/Quota/providers/contract.d.ts +104 -0
  50. package/dist/lib/Quota/providers/openai.d.ts +5 -0
  51. package/dist/lib/Quota/providers/registry.d.ts +6 -0
  52. package/dist/lib/Quota/providers/result-helpers.d.ts +37 -0
  53. package/dist/lib/Quota/providers/xai.d.ts +8 -0
  54. package/dist/lib/Quota/rpc.d.ts +50 -0
  55. package/dist/lib/Quota/settings/convert.d.ts +59 -0
  56. package/dist/lib/Quota/settings/file.d.ts +89 -0
  57. package/dist/lib/Quota/settings/index.d.ts +10 -0
  58. package/dist/lib/Quota/settings/live.d.ts +42 -0
  59. package/dist/lib/Quota/settings/schema.d.ts +638 -0
  60. package/dist/lib/Quota/tui/client.d.ts +56 -0
  61. package/dist/lib/Quota/tui/index.d.ts +5 -0
  62. package/dist/lib/Quota/tui/sidebar.d.ts +42 -0
  63. package/dist/lib/Quota/tui/theme.d.ts +43 -0
  64. package/dist/lib/Quota/view/columns.d.ts +14 -0
  65. package/dist/lib/Quota/view/format.d.ts +80 -0
  66. package/dist/lib/Quota/view/row-facts.d.ts +52 -0
  67. package/dist/lib/Quota/view/select.d.ts +68 -0
  68. package/dist/lib/Quota/view/text.d.ts +160 -0
  69. package/dist/server/index.js +9125 -35
  70. package/dist/tui/index.js +5926 -213
  71. package/package.json +7 -3
  72. package/dist/lib/FilePickerCommands.test.d.ts +0 -1
  73. package/dist/lib/TodoTracker.test.d.ts +0 -1
  74. package/dist/package.integration.test.d.ts +0 -1
  75. package/dist/server/index.test.d.ts +0 -1
  76. package/dist/tui/index.test.d.ts +0 -1
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The row contract providers return: per account, its rows (keyed like `five_hour`) and its
3
+ * errors, plus debug details for /quota_status. `core/rows.ts` turns a result into v6 rows by
4
+ * adding each row's id, provider and account.
5
+ */
6
+ import type { ErrorFacts } from "../core/errors.js";
7
+ import type { DebugDetail, QuotaRow, QuotaWindow } from "../core/types.js";
8
+ import { type CredentialRow } from "../lib/opencode-auth.js";
9
+ /** One row as a provider reports it; `key` is the part of the row id after the provider id. */
10
+ export type ProviderRow = Omit<QuotaRow, "id" | "providerId" | "account"> & {
11
+ key: string;
12
+ };
13
+ /** One error: its words, and the facts of the request that failed when it gave them. */
14
+ export type FetchError = {
15
+ message: string;
16
+ facts?: ErrorFacts;
17
+ };
18
+ /**
19
+ * One account's rows and errors. `name` is its display name, for example
20
+ * "[Claude Work] (active)" or "Copilot (pro)": the rows take their account from it, and it
21
+ * labels the errors in debug details. `login` is the OpenCode login the rows came from.
22
+ */
23
+ export type AccountResult = {
24
+ name: string;
25
+ login?: string;
26
+ rows: ProviderRow[];
27
+ errors: FetchError[];
28
+ };
29
+ /** `attempted` is false when the provider had nothing to query (it is not set up). */
30
+ export type ProviderFetchResult = {
31
+ attempted: boolean;
32
+ accounts: AccountResult[];
33
+ debug: DebugDetail[];
34
+ };
35
+ /** A row key part from provider text: lower case, `_` for anything else ("Claude/GPT" → "claude_gpt"). */
36
+ export declare function keySlug(text: string): string;
37
+ /** The common windows: row key, default label and window. */
38
+ export declare const FIVE_HOUR: {
39
+ readonly key: "five_hour";
40
+ readonly label: "5h";
41
+ readonly window: "five_hour";
42
+ };
43
+ export declare const WEEKLY: {
44
+ readonly key: "weekly";
45
+ readonly label: "Weekly";
46
+ readonly window: "week";
47
+ };
48
+ export declare const MONTHLY: {
49
+ readonly key: "monthly";
50
+ readonly label: "Monthly";
51
+ readonly window: "month";
52
+ };
53
+ /** A remote, provider-reported quota row with the percent left: most providers' row. */
54
+ export declare function quotaRow(fields: {
55
+ key: string;
56
+ label: string;
57
+ window?: QuotaWindow;
58
+ percentRemaining: number;
59
+ resetsAt?: string;
60
+ windowStartedAt?: string;
61
+ }): ProviderRow;
62
+ /** One window of a provider reply: the percent left, when it resets, and when it started. */
63
+ type WindowValue = {
64
+ percentRemaining: number;
65
+ resetTimeIso?: string;
66
+ fixedWindow?: {
67
+ startedAtIso: string;
68
+ };
69
+ };
70
+ /** A quota row for each window the provider reported, in the given order. */
71
+ export declare function windowRows(windows: ReadonlyArray<{
72
+ slot: {
73
+ key: string;
74
+ label: string;
75
+ window: QuotaWindow;
76
+ };
77
+ value: WindowValue | undefined;
78
+ }>): ProviderRow[];
79
+ /** An account with one error and no rows. */
80
+ export declare function failedAccount(name: string, message: string, facts?: ErrorFacts): AccountResult;
81
+ /** An error with its request's facts, when there are some. */
82
+ export declare function fetchError(message: string, facts?: ErrorFacts): FetchError;
83
+ /** What one login gave: its rows and errors, or null when it had nothing to query. */
84
+ export type LoginFetch = {
85
+ rows: ProviderRow[];
86
+ errors: FetchError[];
87
+ /** The name of a login without an alias of its own, for example "Copilot (pro)". */
88
+ fallbackName?: string;
89
+ } | null;
90
+ /**
91
+ * Fetches every OpenCode login of a provider at once and names each account the way OpenCode
92
+ * lists the logins ("[Claude Work] (active)"). A login that gave nothing has no account but
93
+ * still counts when unnamed logins are numbered.
94
+ */
95
+ export declare function fetchEachLogin<Login extends {
96
+ row: CredentialRow;
97
+ }>(params: {
98
+ providerName: string;
99
+ logins: readonly Login[];
100
+ fetchLogin: (login: Login) => Promise<LoginFetch>;
101
+ /** Number unnamed logins ("[OpenAI 2]") instead of naming them after the fallback. */
102
+ numberUnnamed?: (row: CredentialRow) => boolean;
103
+ }): Promise<AccountResult[]>;
104
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * OpenAI (Plus/Pro) provider wrapper.
3
+ */
4
+ import type { QuotaProvider } from "../lib/entries.js";
5
+ export declare const openaiProvider: QuotaProvider;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Each provider in `provider-registration.ts` order (the display order), bound to its id.
3
+ * A provider's facts live there; its fetch and cache policy in `src/providers/<vendor>.ts`.
4
+ */
5
+ import type { QuotaProvider } from "../lib/entries.js";
6
+ export declare function getProviders(): QuotaProvider[];
@@ -0,0 +1,37 @@
1
+ import type { DebugDetail } from "../core/types.js";
2
+ import { type ApiKeySpec, type VendorKeys } from "../lib/api-key-resolver.js";
3
+ export declare function statusDetailsFromRecord(values: Readonly<Record<string, string | undefined>>): DebugDetail[];
4
+ export declare function configStatusDetails(diagnostics: {
5
+ state: string;
6
+ source: string | null;
7
+ checkedPaths: readonly string[];
8
+ }): DebugDetail[];
9
+ export declare function simpleApiKeyStatusDetails(diagnostics: {
10
+ configured: boolean;
11
+ source: string | null;
12
+ checkedPaths: readonly string[];
13
+ credentialDatabasePaths: readonly string[];
14
+ }): DebugDetail[];
15
+ type KeyState = {
16
+ state: "none";
17
+ source: null;
18
+ } | {
19
+ state: "configured";
20
+ source: string;
21
+ } | {
22
+ state: "invalid";
23
+ source: "opencode.db";
24
+ error: string;
25
+ };
26
+ /** The key the vendor uses first: the env or config key, else its first stored login. */
27
+ export declare function vendorKeyState(keys: VendorKeys): KeyState;
28
+ /** Where a vendor's API key was looked for, and what its first key holds. */
29
+ export declare function vendorKeyDetails(spec: ApiKeySpec, keys: VendorKeys, directory: string): DebugDetail[];
30
+ export declare function apiKeyStatusDetails(diagnostics: {
31
+ state: string;
32
+ source: string | null;
33
+ checkedPaths: readonly string[];
34
+ credentialDatabasePaths: readonly string[];
35
+ error?: string;
36
+ }): DebugDetail[];
37
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * xAI SuperGrok: the shared credits meter of each OpenCode xAI sign-in, the one Grok Build shows
3
+ * (GET https://cli-chat-proxy.grok.com/v1/billing?format=credits). Once it is read, the
4
+ * subscription (GET https://grok.com/rest/subscriptions) may refine the account name. A sign-in
5
+ * OpenCode could not return shows as its own error. OpenCode alone refreshes the OAuth tokens.
6
+ */
7
+ import type { QuotaProvider } from "../lib/entries.js";
8
+ export declare const xaiProvider: QuotaProvider;
@@ -0,0 +1,50 @@
1
+ /** The quota sidebar's server-to-TUI RPC contract. */
2
+ import type { Rpc } from "@opencode/plugin";
3
+ import type { QuotaSnapshot } from "./core/types.js";
4
+ export declare const QUOTA_RPC_ID = "slkiser.opencode-quota";
5
+ export type QuotaRpcSnapshotInput = {
6
+ sessionID?: string;
7
+ };
8
+ export type QuotaRpcRefreshReason = "poll" | "turn";
9
+ export type QuotaRpcRefreshInput = {
10
+ reason: QuotaRpcRefreshReason;
11
+ sessionID?: string;
12
+ };
13
+ export type QuotaRpcSnapshotOutput = {
14
+ snapshot: QuotaSnapshot;
15
+ };
16
+ type StandardValueSchema = Extract<Rpc.PortableValueSchema, {
17
+ "~standard": unknown;
18
+ }>;
19
+ type StandardEventSchema = Extract<Rpc.PortableEventDefinition["schema"], {
20
+ "~standard": unknown;
21
+ }>;
22
+ type Typed<T> = {
23
+ "~standard": {
24
+ types?: {
25
+ input: T;
26
+ output: T;
27
+ };
28
+ };
29
+ };
30
+ type QuotaRpcSchema<T> = StandardValueSchema & Typed<T>;
31
+ type QuotaRpcEventSchema<T> = StandardEventSchema & Typed<T>;
32
+ export declare const QuotaRpc: {
33
+ id: string;
34
+ events: {
35
+ changed: {
36
+ schema: QuotaRpcEventSchema<QuotaRpcSnapshotOutput>;
37
+ };
38
+ };
39
+ methods: {
40
+ snapshot: {
41
+ input: QuotaRpcSchema<QuotaRpcSnapshotInput>;
42
+ output: QuotaRpcSchema<QuotaRpcSnapshotOutput>;
43
+ };
44
+ refresh: {
45
+ input: QuotaRpcSchema<QuotaRpcRefreshInput>;
46
+ output: QuotaRpcSchema<QuotaRpcSnapshotOutput>;
47
+ };
48
+ };
49
+ };
50
+ export {};
@@ -0,0 +1,59 @@
1
+ import { type Settings } from "./schema.js";
2
+ /** A v5 key and its destination in settings.jsonc. */
3
+ export type ConvertedKey = {
4
+ key: string;
5
+ to: string;
6
+ where: "server";
7
+ note?: string;
8
+ };
9
+ export type SkippedKey = {
10
+ key: string;
11
+ reason: string;
12
+ };
13
+ export type V5Conversion = {
14
+ /** The v5 files the values came from, in the order v5 applied them. */
15
+ sources: string[];
16
+ /** An old file does not parse: `convertV5` waits (maybe mid-edit); a save converts the rest. */
17
+ malformed: boolean;
18
+ /** True when this call wrote settings.jsonc. */
19
+ written: boolean;
20
+ /** Why settings.jsonc was not written, when a write was tried. */
21
+ notWrittenReason?: string;
22
+ /** The converted server values by dotted key, in file order. */
23
+ values: Record<string, unknown>;
24
+ settings: Settings;
25
+ /** The server keys the conversion set; every other key has its default. */
26
+ fromFile: string[];
27
+ converted: ConvertedKey[];
28
+ dropped: SkippedKey[];
29
+ invalid: SkippedKey[];
30
+ notes: string[];
31
+ };
32
+ /**
33
+ * The folders that can hold old global settings, in the order v4 read them: OpenCode's global
34
+ * folder, then macOS's ~/.config and ~/Library/Application Support, Windows's %APPDATA% and
35
+ * %LOCALAPPDATA%, or ~/.config elsewhere. OPENCODE_CONFIG_DIR replaces them all, as in OpenCode 2.
36
+ */
37
+ export declare function oldSettingsFolders(configDir: string, params?: {
38
+ platform?: NodeJS.Platform;
39
+ env?: NodeJS.ProcessEnv;
40
+ homeDir?: string;
41
+ }): string[];
42
+ /**
43
+ * The old global settings converted in memory (nothing is written), or undefined when none: those
44
+ * of the first of `folders` that has quota settings. Old settings in a later folder are named in a
45
+ * note. An OpenCode config that does not parse is named too; with no quota settings anywhere, its
46
+ * folder is the one converted, so nothing is written until it is fixed.
47
+ */
48
+ export declare function planV5Conversion(configDir: string, folders?: readonly string[]): Promise<V5Conversion | undefined>;
49
+ /** True for a key v5 had: one v6 converts, drops, ignores, or a v5 group ("tuiSidebarPanel"). */
50
+ export declare function isV5SettingKey(key: string): boolean;
51
+ /**
52
+ * v5 settings files that exist but v6 does not read: the global sidecars (also in the older
53
+ * folders) once settings.jsonc exists, and every project-scope file (v6 has no project settings).
54
+ * A project in the global folder or an older one has no project files of its own.
55
+ */
56
+ export declare function findUnreadV5Files(configDir: string, options: {
57
+ includeGlobal: boolean;
58
+ projectDir?: string;
59
+ }): Promise<string[]>;
@@ -0,0 +1,89 @@
1
+ import { type V5Conversion } from "./convert.js";
2
+ import { type Settings, type SettingsIssue, type SettingsPatch } from "./schema.js";
3
+ export declare function settingsPath(): string;
4
+ export type LoadedSettings = {
5
+ path: string;
6
+ /** False while settings.jsonc does not exist. */
7
+ exists: boolean;
8
+ settings: Settings;
9
+ issues: SettingsIssue[];
10
+ /** The keys the user set (in the file, or in the v5 file converted in memory); the rest are defaults. */
11
+ fromFile: string[];
12
+ /** Only while settings.jsonc is missing: the v5 settings, converted in memory. */
13
+ conversion?: V5Conversion;
14
+ /** v5 settings files that exist but are not read. */
15
+ notRead: string[];
16
+ };
17
+ /** `providers.checking.requestTimeoutMs` is null while the file does not set it. */
18
+ export type SettingsChange = {
19
+ key: string;
20
+ before: unknown;
21
+ after: unknown;
22
+ };
23
+ export type SaveResult = {
24
+ ok: boolean;
25
+ issues: SettingsIssue[];
26
+ diff: SettingsChange[];
27
+ };
28
+ export type SettingsWatch = {
29
+ close(): void;
30
+ };
31
+ /**
32
+ * The settings now. Without settings.jsonc: the v5 settings converted in memory when there are
33
+ * any (this never writes; `convertV5` does), else the defaults.
34
+ */
35
+ export declare function loadSettings(options?: {
36
+ projectDir?: string;
37
+ }): Promise<LoadedSettings>;
38
+ /** One change at a JSONC path; a number is a list index (-1 appends). */
39
+ export type SettingsFileEdit = {
40
+ path: Array<string | number>;
41
+ value: unknown;
42
+ };
43
+ type SettingsEdit = (current: Settings) => SettingsPatch | undefined;
44
+ /** A custom provider switch: on or off, for the definition with this fingerprint. */
45
+ export type CustomSwitch = {
46
+ enabled: boolean;
47
+ fingerprint: string;
48
+ };
49
+ /**
50
+ * Merges a patch into settings.jsonc (JSON merge patch: objects merge, null resets). One unknown
51
+ * key or bad value and nothing is saved. Comments stay; a symlink keeps its link; the file is 0600.
52
+ * `customEnabled` switches custom providers on or off by id; only the quota window's own switch
53
+ * sends it (the agent tools never call this).
54
+ */
55
+ export declare function saveSettings(patch: unknown, options?: {
56
+ allowFileOnly?: boolean;
57
+ customEnabled?: Readonly<Record<string, CustomSwitch>>;
58
+ }): Promise<SaveResult>;
59
+ /**
60
+ * Like `saveSettings` (without switches), with the patch built from the settings it saves over:
61
+ * read, `edit`, check and write all hold the lock, so an edit made from the current value never
62
+ * loses a concurrent one. `edit` returns undefined to change nothing.
63
+ */
64
+ export declare function editSettings(edit: SettingsEdit, options?: {
65
+ allowFileOnly?: boolean;
66
+ }): Promise<SaveResult>;
67
+ /**
68
+ * Like `editSettings`, for a change a patch cannot make, such as one entry of a list (the other
69
+ * entries keep their comments). `edit` gets the settings and the problems read under the lock,
70
+ * and returns JSONC edits; file-only keys are allowed. Nothing is saved when the result has a
71
+ * problem the file did not have.
72
+ */
73
+ export declare function editSettingsFile(edit: (current: Settings, issues: readonly SettingsIssue[]) => SettingsFileEdit[] | undefined): Promise<SaveResult>;
74
+ /**
75
+ * Writes the v5 global settings into a missing settings.jsonc once (undefined: nothing to do).
76
+ * While an old file does not parse (maybe mid-edit) or the folder is read-only, nothing is
77
+ * written: the result says why, and `loadSettings` keeps converting in memory.
78
+ */
79
+ export declare function convertV5(): Promise<V5Conversion | undefined>;
80
+ /**
81
+ * Calls `onChange` once per change of settings.jsonc (v5 files are not watched), debounced, also
82
+ * for an atomic replace. A folder watch reacts at once; a stat poll catches what it misses (busy
83
+ * FSEvents, network drives, a symlink's target). Only changes after this resolves count.
84
+ */
85
+ export declare function watchSettings(onChange: (loaded: LoadedSettings) => void, options?: {
86
+ projectDir?: string;
87
+ debounceMs?: number;
88
+ }): Promise<SettingsWatch>;
89
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The server settings, one module: `loadSettings`, `saveSettings(patch)`, `editSettings`,
3
+ * `editSettingsFile`, `watchSettings`, `convertV5`, the settings a running server holds
4
+ * (`createLiveSettings`) and the schema the agent tools describe and check values with.
5
+ * Every client reads these settings from settings.jsonc through the quota RPC.
6
+ */
7
+ export type { ConvertedKey, SkippedKey, V5Conversion } from "./convert.js";
8
+ export { type CustomSwitch, convertV5, editSettings, editSettingsFile, type LoadedSettings, loadSettings, type SaveResult, type SettingsChange, type SettingsFileEdit, type SettingsWatch, saveSettings, settingsPath, watchSettings, } from "./file.js";
9
+ export { createLiveSettings, type LiveSettings } from "./live.js";
10
+ export { type ClientSettings, type CustomProviderSwitch, checkSetting, clientSettings, customProviderFingerprint, defaultSettings, describeRule, keysUnder, PROVIDER_IDS, SETTINGS_SCHEMA, type SettingRule, type Settings, type SettingsIssue, type SettingsPatch, } from "./schema.js";
@@ -0,0 +1,42 @@
1
+ import type { V5Conversion } from "./convert.js";
2
+ import { editSettings, editSettingsFile, type LoadedSettings, type SaveResult, type SettingsWatch, saveSettings } from "./file.js";
3
+ /**
4
+ * What a change of the held settings asks of the server. `recheck`: a checking or pricing setting
5
+ * changed, or which of them the file sets, so every provider is checked again. `oldCommands`:
6
+ * `system.oldCommands` changed, so the slash command list is built again.
7
+ */
8
+ type LiveSettingsChange = {
9
+ recheck: boolean;
10
+ oldCommands: boolean;
11
+ };
12
+ export type LiveSettings = {
13
+ /** What converting the v5 settings at the start did; undefined when it had nothing to do. */
14
+ readonly conversion: V5Conversion | undefined;
15
+ /** The settings held now. */
16
+ current(): LoadedSettings;
17
+ /** True once this server wrote the v5 settings into settings.jsonc, at the start or by a save. */
18
+ converted(): boolean;
19
+ /** `saveSettings`, then the file is read again and held, before this resolves. */
20
+ save(patch: unknown, options: Parameters<typeof saveSettings>[1]): Promise<SaveResult>;
21
+ /** `editSettings`, then the file is read again and held, before this resolves. */
22
+ edit(...args: Parameters<typeof editSettings>): Promise<SaveResult>;
23
+ /** `editSettingsFile`, then the file is read again and held, before this resolves. */
24
+ editFile(...args: Parameters<typeof editSettingsFile>): Promise<SaveResult>;
25
+ /**
26
+ * From now on, calls `onChange` once per change of the settings or of the keys the file sets:
27
+ * each save and each edit of the file (watched; close the returned watch to stop). A change
28
+ * made since the start is read once more right after the watch starts. Call it once.
29
+ */
30
+ follow(onChange: (change: LiveSettingsChange) => Promise<void>): Promise<SettingsWatch>;
31
+ /** Takes the pricing settings back; call it once no provider check can still read prices. */
32
+ dispose(): void;
33
+ };
34
+ /**
35
+ * `projectDir`: the folder whose v5 project files the status report lists as not read.
36
+ * `debounceMs`: the file watch's (see `watchSettings`).
37
+ */
38
+ export declare function createLiveSettings({ projectDir, debounceMs, }: {
39
+ projectDir: string;
40
+ debounceMs?: number;
41
+ }): Promise<LiveSettings>;
42
+ export {};