@zyro-sec/schema 1.0.2 → 1.0.3
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.
- package/AGENTS.md +95 -95
- package/package.json +1 -1
- package/script/build.ts +9 -9
- package/script/config-schema.ts +86 -86
- package/script/config-v1.json +1311 -1311
- package/script/pack.ts +5 -5
- package/src/agent.ts +68 -68
- package/src/artifact.ts +81 -81
- package/src/automation.ts +224 -224
- package/src/blob-store.ts +25 -25
- package/src/command.ts +18 -18
- package/src/config/agent.ts +26 -26
- package/src/config/command.ts +14 -14
- package/src/config/compaction.ts +27 -27
- package/src/config/experimental.ts +72 -72
- package/src/config/flag.ts +39 -39
- package/src/config/formatter.ts +13 -13
- package/src/config/lsp.ts +19 -19
- package/src/config/mcp.ts +22 -22
- package/src/config/media.ts +15 -15
- package/src/config/model.ts +37 -37
- package/src/config/plugin.ts +14 -14
- package/src/config/policy.ts +57 -57
- package/src/config/provider.ts +122 -122
- package/src/config/reference.ts +23 -23
- package/src/config/shell.ts +10 -10
- package/src/config/tool-output.ts +9 -9
- package/src/config/warming.ts +21 -21
- package/src/config/watcher.ts +8 -8
- package/src/config/websearch.ts +17 -17
- package/src/config/worktree.ts +10 -10
- package/src/config.ts +149 -149
- package/src/connection.ts +38 -38
- package/src/credential-legacy.ts +29 -29
- package/src/credential.ts +78 -78
- package/src/durable-event-manifest.ts +7 -7
- package/src/event-log.ts +21 -21
- package/src/event-manifest.ts +108 -108
- package/src/event.ts +205 -205
- package/src/file-diff.ts +25 -25
- package/src/filesystem-v1.ts +1 -1
- package/src/filesystem.ts +48 -48
- package/src/form.ts +177 -177
- package/src/generate.ts +292 -292
- package/src/goal.ts +46 -46
- package/src/identifier.ts +32 -32
- package/src/index.ts +51 -51
- package/src/installation-event.ts +20 -20
- package/src/instruction-entry.ts +40 -40
- package/src/instruction.ts +25 -25
- package/src/integration-id.ts +13 -13
- package/src/integration.ts +129 -129
- package/src/job.ts +79 -79
- package/src/legacy-event.ts +1 -1
- package/src/llm.ts +6 -6
- package/src/location-event.ts +8 -8
- package/src/location.ts +36 -36
- package/src/lsp-event.ts +7 -7
- package/src/mcp-event.ts +63 -63
- package/src/mcp.ts +171 -171
- package/src/model-compatibility.ts +55 -55
- package/src/model.ts +176 -176
- package/src/models-dev.ts +9 -9
- package/src/money.ts +18 -18
- package/src/permission-saved.ts +25 -25
- package/src/permission-v1.ts +1 -1
- package/src/permission.ts +67 -67
- package/src/persistent-pty.ts +73 -73
- package/src/plugin.ts +62 -62
- package/src/project-id.ts +9 -9
- package/src/project.ts +62 -62
- package/src/prompt-input.ts +33 -33
- package/src/prompt.ts +117 -117
- package/src/provider.ts +136 -136
- package/src/pty-ticket.ts +10 -10
- package/src/pty.ts +61 -61
- package/src/push.ts +86 -86
- package/src/question.ts +22 -22
- package/src/reference.ts +40 -40
- package/src/rpc.ts +167 -167
- package/src/schema.ts +41 -41
- package/src/server-event.ts +8 -8
- package/src/session-error.ts +14 -14
- package/src/session-event.ts +739 -739
- package/src/session-fork.ts +10 -10
- package/src/session-id.ts +12 -12
- package/src/session-inbox.ts +102 -102
- package/src/session-legacy.ts +117 -117
- package/src/session-message.ts +352 -352
- package/src/session-metadata.ts +11 -11
- package/src/session-revert.ts +86 -86
- package/src/session-stats.ts +68 -68
- package/src/session-status-event.ts +53 -53
- package/src/session-transfer.ts +11 -11
- package/src/session-v1.ts +1 -1
- package/src/session.ts +147 -147
- package/src/shell.ts +90 -90
- package/src/skill.ts +68 -68
- package/src/snapshot.ts +6 -6
- package/src/token-usage.ts +18 -18
- package/src/tool.ts +143 -143
- package/src/tui-event.ts +59 -59
- package/src/usage-limits.ts +76 -76
- package/src/v1/filesystem.ts +11 -11
- package/src/v1/legacy-event.ts +18 -18
- package/src/v1/permission.ts +66 -66
- package/src/v1/session.ts +667 -667
- package/src/vcs-event.ts +14 -14
- package/src/vcs.ts +41 -41
- package/src/websearch.ts +44 -44
- package/src/workspace-event.ts +32 -32
- package/src/workspace-id.ts +19 -19
- package/src/workspace.ts +20 -20
- package/src/worktree-event.ts +22 -22
- package/src/worktree.ts +109 -109
- package/tsconfig.build.json +11 -11
- package/tsconfig.json +14 -14
- package/test/agent.test.ts +0 -10
- package/test/automation.test.ts +0 -48
- package/test/compatibility.test.ts +0 -10
- package/test/config.test.ts +0 -194
- package/test/contract-hygiene.test.ts +0 -352
- package/test/credential-legacy.test.ts +0 -55
- package/test/event-manifest.test.ts +0 -228
- package/test/event.test.ts +0 -52
- package/test/legacy-event.test.ts +0 -46
- package/test/mcp.test.ts +0 -37
- package/test/model.test.ts +0 -104
- package/test/session-cursor.test.ts +0 -16
- package/test/session-error.test.ts +0 -51
- package/test/session-legacy.test.ts +0 -178
- package/test/session-terminal.test.ts +0 -50
- package/test/token-usage.test.ts +0 -18
- package/test/v1-isolation.test.ts +0 -26
- package/test/vcs.test.ts +0 -23
- package/test/worktree.test.ts +0 -45
package/src/config/policy.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
export * as ConfigPolicy from "./policy.js"
|
|
2
|
-
|
|
3
|
-
import { Schema, SchemaGetter } from "effect"
|
|
4
|
-
|
|
5
|
-
export const Effect = Schema.Literals(["allow", "deny"])
|
|
6
|
-
export type Effect = typeof Effect.Type
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* - `provider.use`: resource is a provider ID.
|
|
10
|
-
* - `tool.use`: resource is `<tool>:<input>`, such as `shell:git *`.
|
|
11
|
-
* - `integration.connect`: resource is an integration ID; controls which integrations can be listed and connected.
|
|
12
|
-
* - `integration.use`: resource is `<integration>#<account>`, or the bare integration ID when the providers, models,
|
|
13
|
-
* web search, MCP servers, or config an integration supplies come from no account (env keys, local config, the
|
|
14
|
-
* signed-out free tier).
|
|
15
|
-
* - `mcp.use`, `skill.use`, `plugin.use`: resource is an MCP server name, skill ID, or plugin target.
|
|
16
|
-
* - `websearch.use`: resource is a web search provider ID, such as `opencode` or `exa`.
|
|
17
|
-
*/
|
|
18
|
-
export const Action = Schema.Literals([
|
|
19
|
-
"provider.use",
|
|
20
|
-
"tool.use",
|
|
21
|
-
"integration.connect",
|
|
22
|
-
"integration.use",
|
|
23
|
-
"mcp.use",
|
|
24
|
-
"skill.use",
|
|
25
|
-
"plugin.use",
|
|
26
|
-
"websearch.use",
|
|
27
|
-
])
|
|
28
|
-
export type Action = typeof Action.Type
|
|
29
|
-
|
|
30
|
-
const Statement = Schema.Struct({
|
|
31
|
-
action: Action,
|
|
32
|
-
resource: Schema.String,
|
|
33
|
-
effect: Effect,
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
// Before `mcp.use`, `skill.use` and `plugin.use` existed, `integration.use` covered them with a resource prefix.
|
|
37
|
-
// Every policy source decodes through this schema, so this is the only place that knows the legacy form. Only prefixed
|
|
38
|
-
// resources convert: a bare `integration.use` `*` keeps its action and now covers providers and accounts.
|
|
39
|
-
const legacy = new Map<string, Action>([
|
|
40
|
-
["mcp", "mcp.use"],
|
|
41
|
-
["skill", "skill.use"],
|
|
42
|
-
["plugin", "plugin.use"],
|
|
43
|
-
])
|
|
44
|
-
|
|
45
|
-
export const Info = Statement.pipe(
|
|
46
|
-
Schema.decodeTo(Schema.toType(Statement), {
|
|
47
|
-
decode: SchemaGetter.transform((policy) => {
|
|
48
|
-
if (policy.action !== "integration.use") return policy
|
|
49
|
-
const separator = policy.resource.indexOf(":")
|
|
50
|
-
const action = separator === -1 ? undefined : legacy.get(policy.resource.slice(0, separator))
|
|
51
|
-
if (!action) return policy
|
|
52
|
-
return { ...policy, action, resource: policy.resource.slice(separator + 1) }
|
|
53
|
-
}),
|
|
54
|
-
encode: SchemaGetter.passthrough(),
|
|
55
|
-
}),
|
|
56
|
-
)
|
|
57
|
-
export type Info = typeof Info.Type
|
|
1
|
+
export * as ConfigPolicy from "./policy.js"
|
|
2
|
+
|
|
3
|
+
import { Schema, SchemaGetter } from "effect"
|
|
4
|
+
|
|
5
|
+
export const Effect = Schema.Literals(["allow", "deny"])
|
|
6
|
+
export type Effect = typeof Effect.Type
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* - `provider.use`: resource is a provider ID.
|
|
10
|
+
* - `tool.use`: resource is `<tool>:<input>`, such as `shell:git *`.
|
|
11
|
+
* - `integration.connect`: resource is an integration ID; controls which integrations can be listed and connected.
|
|
12
|
+
* - `integration.use`: resource is `<integration>#<account>`, or the bare integration ID when the providers, models,
|
|
13
|
+
* web search, MCP servers, or config an integration supplies come from no account (env keys, local config, the
|
|
14
|
+
* signed-out free tier).
|
|
15
|
+
* - `mcp.use`, `skill.use`, `plugin.use`: resource is an MCP server name, skill ID, or plugin target.
|
|
16
|
+
* - `websearch.use`: resource is a web search provider ID, such as `opencode` or `exa`.
|
|
17
|
+
*/
|
|
18
|
+
export const Action = Schema.Literals([
|
|
19
|
+
"provider.use",
|
|
20
|
+
"tool.use",
|
|
21
|
+
"integration.connect",
|
|
22
|
+
"integration.use",
|
|
23
|
+
"mcp.use",
|
|
24
|
+
"skill.use",
|
|
25
|
+
"plugin.use",
|
|
26
|
+
"websearch.use",
|
|
27
|
+
])
|
|
28
|
+
export type Action = typeof Action.Type
|
|
29
|
+
|
|
30
|
+
const Statement = Schema.Struct({
|
|
31
|
+
action: Action,
|
|
32
|
+
resource: Schema.String,
|
|
33
|
+
effect: Effect,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Before `mcp.use`, `skill.use` and `plugin.use` existed, `integration.use` covered them with a resource prefix.
|
|
37
|
+
// Every policy source decodes through this schema, so this is the only place that knows the legacy form. Only prefixed
|
|
38
|
+
// resources convert: a bare `integration.use` `*` keeps its action and now covers providers and accounts.
|
|
39
|
+
const legacy = new Map<string, Action>([
|
|
40
|
+
["mcp", "mcp.use"],
|
|
41
|
+
["skill", "skill.use"],
|
|
42
|
+
["plugin", "plugin.use"],
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
export const Info = Statement.pipe(
|
|
46
|
+
Schema.decodeTo(Schema.toType(Statement), {
|
|
47
|
+
decode: SchemaGetter.transform((policy) => {
|
|
48
|
+
if (policy.action !== "integration.use") return policy
|
|
49
|
+
const separator = policy.resource.indexOf(":")
|
|
50
|
+
const action = separator === -1 ? undefined : legacy.get(policy.resource.slice(0, separator))
|
|
51
|
+
if (!action) return policy
|
|
52
|
+
return { ...policy, action, resource: policy.resource.slice(separator + 1) }
|
|
53
|
+
}),
|
|
54
|
+
encode: SchemaGetter.passthrough(),
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
export type Info = typeof Info.Type
|
package/src/config/provider.ts
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
export * as ConfigProvider from "./provider.js"
|
|
2
|
-
|
|
3
|
-
import { Schema, Struct } from "effect"
|
|
4
|
-
import { Money } from "../money.js"
|
|
5
|
-
import { Capabilities, Compatibility, Family, ID, Model, Type, VariantID } from "../model.js"
|
|
6
|
-
import { ProviderCompatibility } from "../model-compatibility.js"
|
|
7
|
-
import { Provider } from "../provider.js"
|
|
8
|
-
import { optional } from "../schema.js"
|
|
9
|
-
|
|
10
|
-
export const Settings = Schema.StructWithRest(Schema.Struct(Provider.Settings.schema.fields), [
|
|
11
|
-
Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
|
|
12
|
-
]).annotate({ identifier: "Config.Provider.Settings" })
|
|
13
|
-
export type Settings = typeof Settings.Type
|
|
14
|
-
|
|
15
|
-
export const ModelSettings = Schema.StructWithRest(Schema.Struct(Model.Settings.schema.fields), [
|
|
16
|
-
Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
|
|
17
|
-
]).annotate({ identifier: "Config.Model.Settings" })
|
|
18
|
-
export type ModelSettings = typeof ModelSettings.Type
|
|
19
|
-
|
|
20
|
-
const JsonRecord = Schema.Record(Schema.String, Schema.Json)
|
|
21
|
-
|
|
22
|
-
export const Overlays = {
|
|
23
|
-
settings: Settings.pipe(optional),
|
|
24
|
-
headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
25
|
-
body: JsonRecord.pipe(optional),
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const ModelOverlays = {
|
|
29
|
-
settings: ModelSettings.pipe(optional),
|
|
30
|
-
headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
31
|
-
body: JsonRecord.pipe(optional),
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class Request extends Schema.Class<Request>("Config.Provider.Request")({
|
|
35
|
-
headers: Overlays.headers,
|
|
36
|
-
body: Overlays.body,
|
|
37
|
-
}) {}
|
|
38
|
-
|
|
39
|
-
class Cache extends Schema.Class<Cache>("Config.Model.Cost.Cache")({
|
|
40
|
-
read: Money.USDPerMillionTokens.pipe(optional),
|
|
41
|
-
write: Money.USDPerMillionTokens.pipe(optional),
|
|
42
|
-
}) {}
|
|
43
|
-
|
|
44
|
-
class Cost extends Schema.Class<Cost>("Config.Model.Cost")({
|
|
45
|
-
tier: Schema.Struct({
|
|
46
|
-
type: Schema.Literal("context"),
|
|
47
|
-
size: Schema.Int,
|
|
48
|
-
}).pipe(optional),
|
|
49
|
-
input: Money.USDPerMillionTokens,
|
|
50
|
-
output: Money.USDPerMillionTokens,
|
|
51
|
-
cache: Cache.pipe(optional),
|
|
52
|
-
}) {}
|
|
53
|
-
|
|
54
|
-
class Limit extends Schema.Class<Limit>("Config.Model.Limit")({
|
|
55
|
-
context: Schema.Int.pipe(optional),
|
|
56
|
-
input: Schema.Int.pipe(optional),
|
|
57
|
-
output: Schema.Int.pipe(optional),
|
|
58
|
-
}) {}
|
|
59
|
-
|
|
60
|
-
// models.dev v2's `capabilities.reasoning`. OpenCode builds the model's variants from it; no control means none.
|
|
61
|
-
export const Reasoning = Schema.Union([
|
|
62
|
-
Schema.Struct({ supported: Schema.Literal(false) }),
|
|
63
|
-
Schema.Struct({
|
|
64
|
-
supported: Schema.Literal(true),
|
|
65
|
-
toggle: Schema.Boolean.pipe(optional),
|
|
66
|
-
effort: Schema.String.pipe(Schema.Array, optional),
|
|
67
|
-
budget: Schema.Struct({
|
|
68
|
-
min: Schema.Int.pipe(optional),
|
|
69
|
-
max: Schema.Int.pipe(optional),
|
|
70
|
-
}).pipe(optional),
|
|
71
|
-
}),
|
|
72
|
-
]).annotate({ identifier: "Config.Model.Reasoning" })
|
|
73
|
-
export type Reasoning = typeof Reasoning.Type
|
|
74
|
-
|
|
75
|
-
class ModelConfig extends Schema.Class<ModelConfig>("Config.Model")({
|
|
76
|
-
modelID: ID.pipe(optional),
|
|
77
|
-
type: Type.pipe(optional),
|
|
78
|
-
family: Family.pipe(optional),
|
|
79
|
-
name: Schema.String.pipe(optional),
|
|
80
|
-
releaseDate: Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}(-\d{2})?$/u))
|
|
81
|
-
.annotate({ description: "Release date as YYYY-MM-DD or YYYY-MM" })
|
|
82
|
-
.pipe(optional),
|
|
83
|
-
compatibility: Compatibility.pipe(optional),
|
|
84
|
-
package: Schema.String.pipe(optional),
|
|
85
|
-
...ModelOverlays,
|
|
86
|
-
// Partial: unset fields fall back to the base model's capabilities, then the defaults.
|
|
87
|
-
capabilities: Capabilities.mapFields((fields) => ({
|
|
88
|
-
tools: optional(fields.tools),
|
|
89
|
-
freeform: fields.freeform,
|
|
90
|
-
input: optional(fields.input),
|
|
91
|
-
output: optional(fields.output),
|
|
92
|
-
temperature: fields.temperature,
|
|
93
|
-
reasoning: Reasoning.pipe(optional),
|
|
94
|
-
}))
|
|
95
|
-
.annotate({ identifier: "Config.Model.Capabilities" })
|
|
96
|
-
.pipe(optional),
|
|
97
|
-
variants: Schema.Struct({
|
|
98
|
-
id: VariantID,
|
|
99
|
-
...ModelOverlays,
|
|
100
|
-
// The prompt cache belongs to the model, so a variant can't change it.
|
|
101
|
-
settings: Schema.StructWithRest(
|
|
102
|
-
Schema.Struct(Struct.omit(ModelSettings.schema.fields, ["cache"])),
|
|
103
|
-
ModelSettings.records,
|
|
104
|
-
)
|
|
105
|
-
.annotate({ identifier: "Config.Model.VariantSettings" })
|
|
106
|
-
.pipe(optional),
|
|
107
|
-
}).pipe(Schema.Array, optional),
|
|
108
|
-
cost: Schema.Union([Cost, Cost.pipe(Schema.Array)]).pipe(optional),
|
|
109
|
-
disabled: Schema.Boolean.pipe(optional),
|
|
110
|
-
limit: Limit.pipe(optional),
|
|
111
|
-
}) {}
|
|
112
|
-
|
|
113
|
-
export class Info extends Schema.Class<Info>("Config.Provider")({
|
|
114
|
-
canonical: Provider.ID.pipe(optional),
|
|
115
|
-
name: Schema.String.pipe(optional),
|
|
116
|
-
env: Schema.String.pipe(Schema.Array, optional),
|
|
117
|
-
package: Schema.String.pipe(optional),
|
|
118
|
-
// Defaults for every model of this provider; model compatibility overrides individual fields.
|
|
119
|
-
compatibility: ProviderCompatibility.pipe(optional),
|
|
120
|
-
...Overlays,
|
|
121
|
-
models: Schema.Record(Schema.String, ModelConfig).pipe(optional),
|
|
122
|
-
}) {}
|
|
1
|
+
export * as ConfigProvider from "./provider.js"
|
|
2
|
+
|
|
3
|
+
import { Schema, Struct } from "effect"
|
|
4
|
+
import { Money } from "../money.js"
|
|
5
|
+
import { Capabilities, Compatibility, Family, ID, Model, Type, VariantID } from "../model.js"
|
|
6
|
+
import { ProviderCompatibility } from "../model-compatibility.js"
|
|
7
|
+
import { Provider } from "../provider.js"
|
|
8
|
+
import { optional } from "../schema.js"
|
|
9
|
+
|
|
10
|
+
export const Settings = Schema.StructWithRest(Schema.Struct(Provider.Settings.schema.fields), [
|
|
11
|
+
Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
|
|
12
|
+
]).annotate({ identifier: "Config.Provider.Settings" })
|
|
13
|
+
export type Settings = typeof Settings.Type
|
|
14
|
+
|
|
15
|
+
export const ModelSettings = Schema.StructWithRest(Schema.Struct(Model.Settings.schema.fields), [
|
|
16
|
+
Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
|
|
17
|
+
]).annotate({ identifier: "Config.Model.Settings" })
|
|
18
|
+
export type ModelSettings = typeof ModelSettings.Type
|
|
19
|
+
|
|
20
|
+
const JsonRecord = Schema.Record(Schema.String, Schema.Json)
|
|
21
|
+
|
|
22
|
+
export const Overlays = {
|
|
23
|
+
settings: Settings.pipe(optional),
|
|
24
|
+
headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
25
|
+
body: JsonRecord.pipe(optional),
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ModelOverlays = {
|
|
29
|
+
settings: ModelSettings.pipe(optional),
|
|
30
|
+
headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
31
|
+
body: JsonRecord.pipe(optional),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class Request extends Schema.Class<Request>("Config.Provider.Request")({
|
|
35
|
+
headers: Overlays.headers,
|
|
36
|
+
body: Overlays.body,
|
|
37
|
+
}) {}
|
|
38
|
+
|
|
39
|
+
class Cache extends Schema.Class<Cache>("Config.Model.Cost.Cache")({
|
|
40
|
+
read: Money.USDPerMillionTokens.pipe(optional),
|
|
41
|
+
write: Money.USDPerMillionTokens.pipe(optional),
|
|
42
|
+
}) {}
|
|
43
|
+
|
|
44
|
+
class Cost extends Schema.Class<Cost>("Config.Model.Cost")({
|
|
45
|
+
tier: Schema.Struct({
|
|
46
|
+
type: Schema.Literal("context"),
|
|
47
|
+
size: Schema.Int,
|
|
48
|
+
}).pipe(optional),
|
|
49
|
+
input: Money.USDPerMillionTokens,
|
|
50
|
+
output: Money.USDPerMillionTokens,
|
|
51
|
+
cache: Cache.pipe(optional),
|
|
52
|
+
}) {}
|
|
53
|
+
|
|
54
|
+
class Limit extends Schema.Class<Limit>("Config.Model.Limit")({
|
|
55
|
+
context: Schema.Int.pipe(optional),
|
|
56
|
+
input: Schema.Int.pipe(optional),
|
|
57
|
+
output: Schema.Int.pipe(optional),
|
|
58
|
+
}) {}
|
|
59
|
+
|
|
60
|
+
// models.dev v2's `capabilities.reasoning`. OpenCode builds the model's variants from it; no control means none.
|
|
61
|
+
export const Reasoning = Schema.Union([
|
|
62
|
+
Schema.Struct({ supported: Schema.Literal(false) }),
|
|
63
|
+
Schema.Struct({
|
|
64
|
+
supported: Schema.Literal(true),
|
|
65
|
+
toggle: Schema.Boolean.pipe(optional),
|
|
66
|
+
effort: Schema.String.pipe(Schema.Array, optional),
|
|
67
|
+
budget: Schema.Struct({
|
|
68
|
+
min: Schema.Int.pipe(optional),
|
|
69
|
+
max: Schema.Int.pipe(optional),
|
|
70
|
+
}).pipe(optional),
|
|
71
|
+
}),
|
|
72
|
+
]).annotate({ identifier: "Config.Model.Reasoning" })
|
|
73
|
+
export type Reasoning = typeof Reasoning.Type
|
|
74
|
+
|
|
75
|
+
class ModelConfig extends Schema.Class<ModelConfig>("Config.Model")({
|
|
76
|
+
modelID: ID.pipe(optional),
|
|
77
|
+
type: Type.pipe(optional),
|
|
78
|
+
family: Family.pipe(optional),
|
|
79
|
+
name: Schema.String.pipe(optional),
|
|
80
|
+
releaseDate: Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}(-\d{2})?$/u))
|
|
81
|
+
.annotate({ description: "Release date as YYYY-MM-DD or YYYY-MM" })
|
|
82
|
+
.pipe(optional),
|
|
83
|
+
compatibility: Compatibility.pipe(optional),
|
|
84
|
+
package: Schema.String.pipe(optional),
|
|
85
|
+
...ModelOverlays,
|
|
86
|
+
// Partial: unset fields fall back to the base model's capabilities, then the defaults.
|
|
87
|
+
capabilities: Capabilities.mapFields((fields) => ({
|
|
88
|
+
tools: optional(fields.tools),
|
|
89
|
+
freeform: fields.freeform,
|
|
90
|
+
input: optional(fields.input),
|
|
91
|
+
output: optional(fields.output),
|
|
92
|
+
temperature: fields.temperature,
|
|
93
|
+
reasoning: Reasoning.pipe(optional),
|
|
94
|
+
}))
|
|
95
|
+
.annotate({ identifier: "Config.Model.Capabilities" })
|
|
96
|
+
.pipe(optional),
|
|
97
|
+
variants: Schema.Struct({
|
|
98
|
+
id: VariantID,
|
|
99
|
+
...ModelOverlays,
|
|
100
|
+
// The prompt cache belongs to the model, so a variant can't change it.
|
|
101
|
+
settings: Schema.StructWithRest(
|
|
102
|
+
Schema.Struct(Struct.omit(ModelSettings.schema.fields, ["cache"])),
|
|
103
|
+
ModelSettings.records,
|
|
104
|
+
)
|
|
105
|
+
.annotate({ identifier: "Config.Model.VariantSettings" })
|
|
106
|
+
.pipe(optional),
|
|
107
|
+
}).pipe(Schema.Array, optional),
|
|
108
|
+
cost: Schema.Union([Cost, Cost.pipe(Schema.Array)]).pipe(optional),
|
|
109
|
+
disabled: Schema.Boolean.pipe(optional),
|
|
110
|
+
limit: Limit.pipe(optional),
|
|
111
|
+
}) {}
|
|
112
|
+
|
|
113
|
+
export class Info extends Schema.Class<Info>("Config.Provider")({
|
|
114
|
+
canonical: Provider.ID.pipe(optional),
|
|
115
|
+
name: Schema.String.pipe(optional),
|
|
116
|
+
env: Schema.String.pipe(Schema.Array, optional),
|
|
117
|
+
package: Schema.String.pipe(optional),
|
|
118
|
+
// Defaults for every model of this provider; model compatibility overrides individual fields.
|
|
119
|
+
compatibility: ProviderCompatibility.pipe(optional),
|
|
120
|
+
...Overlays,
|
|
121
|
+
models: Schema.Record(Schema.String, ModelConfig).pipe(optional),
|
|
122
|
+
}) {}
|
package/src/config/reference.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * as ConfigReference from "./reference.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Git extends Schema.Class<Git>("Config.Reference.Git")({
|
|
7
|
-
repository: Schema.String,
|
|
8
|
-
branch: Schema.String.pipe(optional),
|
|
9
|
-
description: Schema.String.pipe(optional),
|
|
10
|
-
hidden: Schema.Boolean.pipe(optional),
|
|
11
|
-
}) {}
|
|
12
|
-
|
|
13
|
-
export class Local extends Schema.Class<Local>("Config.Reference.Local")({
|
|
14
|
-
path: Schema.String,
|
|
15
|
-
description: Schema.String.pipe(optional),
|
|
16
|
-
hidden: Schema.Boolean.pipe(optional),
|
|
17
|
-
}) {}
|
|
18
|
-
|
|
19
|
-
export const Entry = Schema.Union([Schema.String, Git, Local])
|
|
20
|
-
export type Entry = typeof Entry.Type
|
|
21
|
-
|
|
22
|
-
export const Info = Schema.Record(Schema.String, Entry)
|
|
23
|
-
export type Info = typeof Info.Type
|
|
1
|
+
export * as ConfigReference from "./reference.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Git extends Schema.Class<Git>("Config.Reference.Git")({
|
|
7
|
+
repository: Schema.String,
|
|
8
|
+
branch: Schema.String.pipe(optional),
|
|
9
|
+
description: Schema.String.pipe(optional),
|
|
10
|
+
hidden: Schema.Boolean.pipe(optional),
|
|
11
|
+
}) {}
|
|
12
|
+
|
|
13
|
+
export class Local extends Schema.Class<Local>("Config.Reference.Local")({
|
|
14
|
+
path: Schema.String,
|
|
15
|
+
description: Schema.String.pipe(optional),
|
|
16
|
+
hidden: Schema.Boolean.pipe(optional),
|
|
17
|
+
}) {}
|
|
18
|
+
|
|
19
|
+
export const Entry = Schema.Union([Schema.String, Git, Local])
|
|
20
|
+
export type Entry = typeof Entry.Type
|
|
21
|
+
|
|
22
|
+
export const Info = Schema.Record(Schema.String, Entry)
|
|
23
|
+
export type Info = typeof Info.Type
|
package/src/config/shell.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as ConfigShell from "./shell.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
|
|
5
|
-
export const Option = Schema.Struct({
|
|
6
|
-
path: Schema.String,
|
|
7
|
-
name: Schema.String,
|
|
8
|
-
acceptable: Schema.Boolean,
|
|
9
|
-
}).annotate({ identifier: "ConfigShell.Option" })
|
|
10
|
-
export interface Option extends Schema.Schema.Type<typeof Option> {}
|
|
1
|
+
export * as ConfigShell from "./shell.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
|
|
5
|
+
export const Option = Schema.Struct({
|
|
6
|
+
path: Schema.String,
|
|
7
|
+
name: Schema.String,
|
|
8
|
+
acceptable: Schema.Boolean,
|
|
9
|
+
}).annotate({ identifier: "ConfigShell.Option" })
|
|
10
|
+
export interface Option extends Schema.Schema.Type<typeof Option> {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * as ConfigToolOutput from "./tool-output.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional, PositiveInt } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Info extends Schema.Class<Info>("Config.ToolOutput")({
|
|
7
|
-
max_lines: PositiveInt.pipe(optional),
|
|
8
|
-
max_bytes: PositiveInt.pipe(optional),
|
|
9
|
-
}) {}
|
|
1
|
+
export * as ConfigToolOutput from "./tool-output.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional, PositiveInt } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Info extends Schema.Class<Info>("Config.ToolOutput")({
|
|
7
|
+
max_lines: PositiveInt.pipe(optional),
|
|
8
|
+
max_bytes: PositiveInt.pipe(optional),
|
|
9
|
+
}) {}
|
package/src/config/warming.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export * as ConfigWarming from "./warming.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Info extends Schema.Class<Info>("Config.Warming")({
|
|
7
|
-
prompt: Schema.String.pipe(optional).annotate({
|
|
8
|
-
description: "Prompt sent for keep-alive requests",
|
|
9
|
-
}),
|
|
10
|
-
interval: Schema.Union([Schema.Literal("auto"), Schema.DurationFromString])
|
|
11
|
-
.pipe(optional)
|
|
12
|
-
.annotate({
|
|
13
|
-
description:
|
|
14
|
-
'Idle time between keep-alive requests (default: "auto"). "auto" uses 90% of the model\'s cache.ttl, or 4 minutes when it has none.',
|
|
15
|
-
}),
|
|
16
|
-
duration: Schema.DurationFromString.pipe(optional).annotate({
|
|
17
|
-
description: 'Time after the last active request to keep a session warm (default: "30 minutes")',
|
|
18
|
-
}),
|
|
19
|
-
}) {}
|
|
20
|
-
|
|
21
|
-
export const Warming = Schema.Union([Schema.Boolean, Info])
|
|
1
|
+
export * as ConfigWarming from "./warming.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Info extends Schema.Class<Info>("Config.Warming")({
|
|
7
|
+
prompt: Schema.String.pipe(optional).annotate({
|
|
8
|
+
description: "Prompt sent for keep-alive requests",
|
|
9
|
+
}),
|
|
10
|
+
interval: Schema.Union([Schema.Literal("auto"), Schema.DurationFromString])
|
|
11
|
+
.pipe(optional)
|
|
12
|
+
.annotate({
|
|
13
|
+
description:
|
|
14
|
+
'Idle time between keep-alive requests (default: "auto"). "auto" uses 90% of the model\'s cache.ttl, or 4 minutes when it has none.',
|
|
15
|
+
}),
|
|
16
|
+
duration: Schema.DurationFromString.pipe(optional).annotate({
|
|
17
|
+
description: 'Time after the last active request to keep a session warm (default: "30 minutes")',
|
|
18
|
+
}),
|
|
19
|
+
}) {}
|
|
20
|
+
|
|
21
|
+
export const Warming = Schema.Union([Schema.Boolean, Info])
|
package/src/config/watcher.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * as ConfigWatcher from "./watcher.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Info extends Schema.Class<Info>("Config.Watcher")({
|
|
7
|
-
ignore: Schema.String.pipe(Schema.Array, optional),
|
|
8
|
-
}) {}
|
|
1
|
+
export * as ConfigWatcher from "./watcher.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Info extends Schema.Class<Info>("Config.Watcher")({
|
|
7
|
+
ignore: Schema.String.pipe(Schema.Array, optional),
|
|
8
|
+
}) {}
|
package/src/config/websearch.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * as ConfigWebSearch from "./websearch.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { WebSearch } from "../websearch.js"
|
|
5
|
-
|
|
6
|
-
export class Info extends Schema.Class<Info>("ConfigWebSearch.Info")({
|
|
7
|
-
provider: Schema.Union([
|
|
8
|
-
Schema.Literal("random").annotate({
|
|
9
|
-
description:
|
|
10
|
-
"Reuse a randomly selected provider until it is rate limited, then switch to another available provider.",
|
|
11
|
-
}),
|
|
12
|
-
WebSearch.ID,
|
|
13
|
-
]),
|
|
14
|
-
}) {}
|
|
15
|
-
|
|
16
|
-
export const Selection = Schema.Union([Schema.Literal(false), Info])
|
|
17
|
-
export type Selection = typeof Selection.Type
|
|
1
|
+
export * as ConfigWebSearch from "./websearch.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { WebSearch } from "../websearch.js"
|
|
5
|
+
|
|
6
|
+
export class Info extends Schema.Class<Info>("ConfigWebSearch.Info")({
|
|
7
|
+
provider: Schema.Union([
|
|
8
|
+
Schema.Literal("random").annotate({
|
|
9
|
+
description:
|
|
10
|
+
"Reuse a randomly selected provider until it is rate limited, then switch to another available provider.",
|
|
11
|
+
}),
|
|
12
|
+
WebSearch.ID,
|
|
13
|
+
]),
|
|
14
|
+
}) {}
|
|
15
|
+
|
|
16
|
+
export const Selection = Schema.Union([Schema.Literal(false), Info])
|
|
17
|
+
export type Selection = typeof Selection.Type
|
package/src/config/worktree.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as ConfigWorktree from "./worktree.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
|
|
5
|
-
export const Info = Schema.Struct({
|
|
6
|
-
directory: Schema.Trim.pipe(Schema.check(Schema.isNonEmpty())).annotate({
|
|
7
|
-
description: "Parent directory for new worktrees, relative to the project's primary checkout when not absolute",
|
|
8
|
-
}),
|
|
9
|
-
}).annotate({ identifier: "Config.Worktree" })
|
|
10
|
-
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
1
|
+
export * as ConfigWorktree from "./worktree.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
|
|
5
|
+
export const Info = Schema.Struct({
|
|
6
|
+
directory: Schema.Trim.pipe(Schema.check(Schema.isNonEmpty())).annotate({
|
|
7
|
+
description: "Parent directory for new worktrees, relative to the project's primary checkout when not absolute",
|
|
8
|
+
}),
|
|
9
|
+
}).annotate({ identifier: "Config.Worktree" })
|
|
10
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {}
|