@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/compaction.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export * as ConfigCompaction from "./compaction.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { NonNegativeInt, optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Keep extends Schema.Class<Keep>("Config.Compaction.Keep")({
|
|
7
|
-
tokens: NonNegativeInt.pipe(optional),
|
|
8
|
-
}) {}
|
|
9
|
-
|
|
10
|
-
/** A share of the model's window such as "20%" or "12.5%", from 1% up to but not including 100%. */
|
|
11
|
-
export const Percent = Schema.String.check(Schema.isPattern(/^([1-9]\d?(\.\d+)?)%$/u)).annotate({
|
|
12
|
-
identifier: "Config.Compaction.Percent",
|
|
13
|
-
})
|
|
14
|
-
export type Percent = typeof Percent.Type
|
|
15
|
-
|
|
16
|
-
export class Info extends Schema.Class<Info>("Config.Compaction")({
|
|
17
|
-
auto: Schema.Boolean.pipe(optional),
|
|
18
|
-
background: Schema.Boolean.pipe(optional).annotate({
|
|
19
|
-
description:
|
|
20
|
-
"Write the summary in the background as the session nears automatic compaction, so it does not wait for one (default: true). A summary that is never used still costs tokens.",
|
|
21
|
-
}),
|
|
22
|
-
keep: Keep.pipe(optional),
|
|
23
|
-
buffer: Schema.Union([Percent, NonNegativeInt]).pipe(optional).annotate({
|
|
24
|
-
description:
|
|
25
|
-
'Room kept free below the model\'s context window before automatic compaction, as a share of the window from "1%" to "99%", such as "20%" to compact at 80% full. A token count is also accepted.',
|
|
26
|
-
}),
|
|
27
|
-
}) {}
|
|
1
|
+
export * as ConfigCompaction from "./compaction.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { NonNegativeInt, optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Keep extends Schema.Class<Keep>("Config.Compaction.Keep")({
|
|
7
|
+
tokens: NonNegativeInt.pipe(optional),
|
|
8
|
+
}) {}
|
|
9
|
+
|
|
10
|
+
/** A share of the model's window such as "20%" or "12.5%", from 1% up to but not including 100%. */
|
|
11
|
+
export const Percent = Schema.String.check(Schema.isPattern(/^([1-9]\d?(\.\d+)?)%$/u)).annotate({
|
|
12
|
+
identifier: "Config.Compaction.Percent",
|
|
13
|
+
})
|
|
14
|
+
export type Percent = typeof Percent.Type
|
|
15
|
+
|
|
16
|
+
export class Info extends Schema.Class<Info>("Config.Compaction")({
|
|
17
|
+
auto: Schema.Boolean.pipe(optional),
|
|
18
|
+
background: Schema.Boolean.pipe(optional).annotate({
|
|
19
|
+
description:
|
|
20
|
+
"Write the summary in the background as the session nears automatic compaction, so it does not wait for one (default: true). A summary that is never used still costs tokens.",
|
|
21
|
+
}),
|
|
22
|
+
keep: Keep.pipe(optional),
|
|
23
|
+
buffer: Schema.Union([Percent, NonNegativeInt]).pipe(optional).annotate({
|
|
24
|
+
description:
|
|
25
|
+
'Room kept free below the model\'s context window before automatic compaction, as a share of the window from "1%" to "99%", such as "20%" to compact at 80% full. A token count is also accepted.',
|
|
26
|
+
}),
|
|
27
|
+
}) {}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
export * as ConfigExperimental from "./experimental.js"
|
|
2
|
-
|
|
3
|
-
import { Record, Schema } from "effect"
|
|
4
|
-
import { NonNegativeInt, optional } from "../schema.js"
|
|
5
|
-
import { ConfigFlag } from "./flag.js"
|
|
6
|
-
import { ConfigModel } from "./model.js"
|
|
7
|
-
import { ConfigPolicy } from "./policy.js"
|
|
8
|
-
|
|
9
|
-
export class Info extends Schema.Class<Info>("ConfigExperimental.Info")({
|
|
10
|
-
portable_shell_scanner: Schema.Boolean.pipe(optional).annotate({
|
|
11
|
-
description: "Deprecated: the built-in shell permission scanner is now always enabled.",
|
|
12
|
-
}),
|
|
13
|
-
codemode_vm: Schema.Boolean.pipe(optional).annotate({
|
|
14
|
-
description: "Deprecated: ignored because Code Mode always runs on the VM.",
|
|
15
|
-
}),
|
|
16
|
-
all_flags: Schema.Boolean.pipe(optional).annotate({
|
|
17
|
-
description:
|
|
18
|
-
"Enable all flags except opt-in-only flags on any build channel, like OPENCODE_FLAGS=all. Per-flag config settings take precedence over all_flags; false leaves the build defaults in effect.",
|
|
19
|
-
}),
|
|
20
|
-
...Record.map(ConfigFlag.registry, (description, key) =>
|
|
21
|
-
Schema.Boolean.pipe(optional).annotate({
|
|
22
|
-
description:
|
|
23
|
-
ConfigFlag.optInOnly.has(key) || ConfigFlag.localOnly.has(key)
|
|
24
|
-
? description
|
|
25
|
-
: `${description} Defaults to on in local and dev builds and off in releases.`,
|
|
26
|
-
}),
|
|
27
|
-
),
|
|
28
|
-
video_generate: Schema.Union([
|
|
29
|
-
Schema.Boolean,
|
|
30
|
-
Schema.Struct({
|
|
31
|
-
model: ConfigModel.Selection.pipe(optional).annotate({
|
|
32
|
-
description:
|
|
33
|
-
"Default model for the generate_video tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
])
|
|
37
|
-
.pipe(optional)
|
|
38
|
-
.annotate({
|
|
39
|
-
description:
|
|
40
|
-
"Settings for the generate_video tool, which is offered while a connected provider has a video model.",
|
|
41
|
-
}),
|
|
42
|
-
part_rows: Schema.Boolean.pipe(optional).annotate({
|
|
43
|
-
description:
|
|
44
|
-
"Write each assistant part as its own session_part row instead of rewriting the whole message on every event. Defaults to true; set false to fall back to whole-message writes.",
|
|
45
|
-
}),
|
|
46
|
-
image_generate: Schema.Union([
|
|
47
|
-
Schema.Boolean,
|
|
48
|
-
Schema.Struct({
|
|
49
|
-
model: ConfigModel.Selection.pipe(optional).annotate({
|
|
50
|
-
description:
|
|
51
|
-
"Default model for the generate_image tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
|
|
52
|
-
}),
|
|
53
|
-
}),
|
|
54
|
-
])
|
|
55
|
-
.pipe(optional)
|
|
56
|
-
.annotate({
|
|
57
|
-
description:
|
|
58
|
-
"Settings for the generate_image tool, which is offered while a connected provider has an image model.",
|
|
59
|
-
}),
|
|
60
|
-
subagent_depth: NonNegativeInt.pipe(optional).annotate({
|
|
61
|
-
description: "Maximum subagent nesting depth. Defaults to 1.",
|
|
62
|
-
}),
|
|
63
|
-
location_idle_timeout: Schema.Union([Schema.DurationFromString, Schema.Literal(false)])
|
|
64
|
-
.pipe(optional)
|
|
65
|
-
.annotate({
|
|
66
|
-
description:
|
|
67
|
-
'How long a location can go without session activity before its services are unloaded. Running sessions and background jobs keep a location loaded. Set to false to never unload (default: "60 minutes")',
|
|
68
|
-
}),
|
|
69
|
-
policies: ConfigPolicy.Info.pipe(Schema.Array, optional).annotate({
|
|
70
|
-
description: "Deprecated: use top-level policies. Ordered policies controlling access to configured resources",
|
|
71
|
-
}),
|
|
72
|
-
}) {}
|
|
1
|
+
export * as ConfigExperimental from "./experimental.js"
|
|
2
|
+
|
|
3
|
+
import { Record, Schema } from "effect"
|
|
4
|
+
import { NonNegativeInt, optional } from "../schema.js"
|
|
5
|
+
import { ConfigFlag } from "./flag.js"
|
|
6
|
+
import { ConfigModel } from "./model.js"
|
|
7
|
+
import { ConfigPolicy } from "./policy.js"
|
|
8
|
+
|
|
9
|
+
export class Info extends Schema.Class<Info>("ConfigExperimental.Info")({
|
|
10
|
+
portable_shell_scanner: Schema.Boolean.pipe(optional).annotate({
|
|
11
|
+
description: "Deprecated: the built-in shell permission scanner is now always enabled.",
|
|
12
|
+
}),
|
|
13
|
+
codemode_vm: Schema.Boolean.pipe(optional).annotate({
|
|
14
|
+
description: "Deprecated: ignored because Code Mode always runs on the VM.",
|
|
15
|
+
}),
|
|
16
|
+
all_flags: Schema.Boolean.pipe(optional).annotate({
|
|
17
|
+
description:
|
|
18
|
+
"Enable all flags except opt-in-only flags on any build channel, like OPENCODE_FLAGS=all. Per-flag config settings take precedence over all_flags; false leaves the build defaults in effect.",
|
|
19
|
+
}),
|
|
20
|
+
...Record.map(ConfigFlag.registry, (description, key) =>
|
|
21
|
+
Schema.Boolean.pipe(optional).annotate({
|
|
22
|
+
description:
|
|
23
|
+
ConfigFlag.optInOnly.has(key) || ConfigFlag.localOnly.has(key)
|
|
24
|
+
? description
|
|
25
|
+
: `${description} Defaults to on in local and dev builds and off in releases.`,
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
video_generate: Schema.Union([
|
|
29
|
+
Schema.Boolean,
|
|
30
|
+
Schema.Struct({
|
|
31
|
+
model: ConfigModel.Selection.pipe(optional).annotate({
|
|
32
|
+
description:
|
|
33
|
+
"Default model for the generate_video tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
])
|
|
37
|
+
.pipe(optional)
|
|
38
|
+
.annotate({
|
|
39
|
+
description:
|
|
40
|
+
"Settings for the generate_video tool, which is offered while a connected provider has a video model.",
|
|
41
|
+
}),
|
|
42
|
+
part_rows: Schema.Boolean.pipe(optional).annotate({
|
|
43
|
+
description:
|
|
44
|
+
"Write each assistant part as its own session_part row instead of rewriting the whole message on every event. Defaults to true; set false to fall back to whole-message writes.",
|
|
45
|
+
}),
|
|
46
|
+
image_generate: Schema.Union([
|
|
47
|
+
Schema.Boolean,
|
|
48
|
+
Schema.Struct({
|
|
49
|
+
model: ConfigModel.Selection.pipe(optional).annotate({
|
|
50
|
+
description:
|
|
51
|
+
"Default model for the generate_image tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
|
|
52
|
+
}),
|
|
53
|
+
}),
|
|
54
|
+
])
|
|
55
|
+
.pipe(optional)
|
|
56
|
+
.annotate({
|
|
57
|
+
description:
|
|
58
|
+
"Settings for the generate_image tool, which is offered while a connected provider has an image model.",
|
|
59
|
+
}),
|
|
60
|
+
subagent_depth: NonNegativeInt.pipe(optional).annotate({
|
|
61
|
+
description: "Maximum subagent nesting depth. Defaults to 1.",
|
|
62
|
+
}),
|
|
63
|
+
location_idle_timeout: Schema.Union([Schema.DurationFromString, Schema.Literal(false)])
|
|
64
|
+
.pipe(optional)
|
|
65
|
+
.annotate({
|
|
66
|
+
description:
|
|
67
|
+
'How long a location can go without session activity before its services are unloaded. Running sessions and background jobs keep a location loaded. Set to false to never unload (default: "60 minutes")',
|
|
68
|
+
}),
|
|
69
|
+
policies: ConfigPolicy.Info.pipe(Schema.Array, optional).annotate({
|
|
70
|
+
description: "Deprecated: use top-level policies. Ordered policies controlling access to configured resources",
|
|
71
|
+
}),
|
|
72
|
+
}) {}
|
package/src/config/flag.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
export * as ConfigFlag from "./flag.js"
|
|
2
|
-
|
|
3
|
-
/** The `OPENCODE_FLAGS` entry that enables all flags except opt-in-only flags, as in `all,-media_blob`. */
|
|
4
|
-
export const wildcard = "all"
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Flags default to on in local and dev builds and off in releases, except for `optInOnly` flags, which must be
|
|
8
|
-
* named explicitly in `experimental.<key>` or `OPENCODE_FLAGS`. Read a flag with Core's `Flag.enabled("<key>")`.
|
|
9
|
-
*/
|
|
10
|
-
export const registry = {
|
|
11
|
-
todo: "Enable the experimental todowrite tool. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=todo or experimental.todo: true.",
|
|
12
|
-
media_blob: "Store new session media once in a deduplicated blob table instead of inline in every message row.",
|
|
13
|
-
artifacts: "Enable experimental artifacts backed by pluggable providers.",
|
|
14
|
-
console_watches:
|
|
15
|
-
"Watch Slack threads, GitHub pull requests, issues, commits and Actions runs, and the workspace's MCP servers' events through OpenCode Console, and wake sessions when they change.",
|
|
16
|
-
recommended_api: "Use each model's recommended API from models.dev instead of the first API it lists.",
|
|
17
|
-
model_speeds:
|
|
18
|
-
"Offer a model's faster and slower service tiers (fast, flex…) as speeds of that model: one entry in the model picker with a speed selector, instead of a separate entry per tier such as gpt-5.5-fast.",
|
|
19
|
-
full_codemode: "Enable the full Code Mode work in progress.",
|
|
20
|
-
machines: "Let a tool path name a machine, as in gpu:/work/train.py, and act on that machine's files and processes.",
|
|
21
|
-
home_memory:
|
|
22
|
-
"Give sessions in the home folder a persistent memory/, docs/ and scripts/ workspace the agent can use freely, tidied by a daily maintenance session that reads the day's home-folder conversations.",
|
|
23
|
-
project_overlay:
|
|
24
|
-
"Load a personal config dir for each project from ~/.config/opencode/project/<project-id>/, read like an extra .opencode dir that ranks above the repo's own, and let home memory keep the skills it builds for the user there.",
|
|
25
|
-
opencode_api:
|
|
26
|
-
'Let Code Mode scripts call the OpenCode HTTP API with fetch("opencode:///api/..."), in-process and already signed in, with no permission checks. Only in local and dev builds, and off there until you opt in with OPENCODE_FLAGS=opencode_api or experimental.opencode_api: true.',
|
|
27
|
-
mcp_skills:
|
|
28
|
-
"Load skills from MCP servers that offer them (the io.modelcontextprotocol/skills extension), named <server>:<skill>. A server that offers skills no longer has its instructions included.",
|
|
29
|
-
compaction_jobs:
|
|
30
|
-
"List a session's subagents, with their session IDs, and its running background jobs in its compaction checkpoints, so the agent can still continue or account for them after compacting.",
|
|
31
|
-
sqlite_fts:
|
|
32
|
-
"Build an SQLite full-text index of session titles and message text in the background, and enable the opencode.session.search and opencode.session.read tools. The index covers every session in the database and starts while any loaded location enables it; SQLite keeps it current from then on, also after this is turned off.",
|
|
33
|
-
} as const satisfies Record<string, string>
|
|
34
|
-
export type Key = keyof typeof registry
|
|
35
|
-
|
|
36
|
-
export const optInOnly: ReadonlySet<Key> = new Set(["todo", "opencode_api"])
|
|
37
|
-
|
|
38
|
-
/** Flags that stay off outside local and dev builds, whatever `OPENCODE_FLAGS` or config say. */
|
|
39
|
-
export const localOnly: ReadonlySet<Key> = new Set(["opencode_api"])
|
|
1
|
+
export * as ConfigFlag from "./flag.js"
|
|
2
|
+
|
|
3
|
+
/** The `OPENCODE_FLAGS` entry that enables all flags except opt-in-only flags, as in `all,-media_blob`. */
|
|
4
|
+
export const wildcard = "all"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Flags default to on in local and dev builds and off in releases, except for `optInOnly` flags, which must be
|
|
8
|
+
* named explicitly in `experimental.<key>` or `OPENCODE_FLAGS`. Read a flag with Core's `Flag.enabled("<key>")`.
|
|
9
|
+
*/
|
|
10
|
+
export const registry = {
|
|
11
|
+
todo: "Enable the experimental todowrite tool. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=todo or experimental.todo: true.",
|
|
12
|
+
media_blob: "Store new session media once in a deduplicated blob table instead of inline in every message row.",
|
|
13
|
+
artifacts: "Enable experimental artifacts backed by pluggable providers.",
|
|
14
|
+
console_watches:
|
|
15
|
+
"Watch Slack threads, GitHub pull requests, issues, commits and Actions runs, and the workspace's MCP servers' events through OpenCode Console, and wake sessions when they change.",
|
|
16
|
+
recommended_api: "Use each model's recommended API from models.dev instead of the first API it lists.",
|
|
17
|
+
model_speeds:
|
|
18
|
+
"Offer a model's faster and slower service tiers (fast, flex…) as speeds of that model: one entry in the model picker with a speed selector, instead of a separate entry per tier such as gpt-5.5-fast.",
|
|
19
|
+
full_codemode: "Enable the full Code Mode work in progress.",
|
|
20
|
+
machines: "Let a tool path name a machine, as in gpu:/work/train.py, and act on that machine's files and processes.",
|
|
21
|
+
home_memory:
|
|
22
|
+
"Give sessions in the home folder a persistent memory/, docs/ and scripts/ workspace the agent can use freely, tidied by a daily maintenance session that reads the day's home-folder conversations.",
|
|
23
|
+
project_overlay:
|
|
24
|
+
"Load a personal config dir for each project from ~/.config/opencode/project/<project-id>/, read like an extra .opencode dir that ranks above the repo's own, and let home memory keep the skills it builds for the user there.",
|
|
25
|
+
opencode_api:
|
|
26
|
+
'Let Code Mode scripts call the OpenCode HTTP API with fetch("opencode:///api/..."), in-process and already signed in, with no permission checks. Only in local and dev builds, and off there until you opt in with OPENCODE_FLAGS=opencode_api or experimental.opencode_api: true.',
|
|
27
|
+
mcp_skills:
|
|
28
|
+
"Load skills from MCP servers that offer them (the io.modelcontextprotocol/skills extension), named <server>:<skill>. A server that offers skills no longer has its instructions included.",
|
|
29
|
+
compaction_jobs:
|
|
30
|
+
"List a session's subagents, with their session IDs, and its running background jobs in its compaction checkpoints, so the agent can still continue or account for them after compacting.",
|
|
31
|
+
sqlite_fts:
|
|
32
|
+
"Build an SQLite full-text index of session titles and message text in the background, and enable the opencode.session.search and opencode.session.read tools. The index covers every session in the database and starts while any loaded location enables it; SQLite keeps it current from then on, also after this is turned off.",
|
|
33
|
+
} as const satisfies Record<string, string>
|
|
34
|
+
export type Key = keyof typeof registry
|
|
35
|
+
|
|
36
|
+
export const optInOnly: ReadonlySet<Key> = new Set(["todo", "opencode_api"])
|
|
37
|
+
|
|
38
|
+
/** Flags that stay off outside local and dev builds, whatever `OPENCODE_FLAGS` or config say. */
|
|
39
|
+
export const localOnly: ReadonlySet<Key> = new Set(["opencode_api"])
|
package/src/config/formatter.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export * as ConfigFormatter from "./formatter.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Entry extends Schema.Class<Entry>("Config.Formatter.Entry")({
|
|
7
|
-
disabled: Schema.Boolean.pipe(optional),
|
|
8
|
-
command: Schema.String.pipe(Schema.Array, optional),
|
|
9
|
-
environment: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
10
|
-
extensions: Schema.String.pipe(Schema.Array, optional),
|
|
11
|
-
}) {}
|
|
12
|
-
|
|
13
|
-
export const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])
|
|
1
|
+
export * as ConfigFormatter from "./formatter.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Entry extends Schema.Class<Entry>("Config.Formatter.Entry")({
|
|
7
|
+
disabled: Schema.Boolean.pipe(optional),
|
|
8
|
+
command: Schema.String.pipe(Schema.Array, optional),
|
|
9
|
+
environment: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
10
|
+
extensions: Schema.String.pipe(Schema.Array, optional),
|
|
11
|
+
}) {}
|
|
12
|
+
|
|
13
|
+
export const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])
|
package/src/config/lsp.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export * as ConfigLSP from "./lsp.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export const Disabled = Schema.Struct({
|
|
7
|
-
disabled: Schema.Literal(true),
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export class Server extends Schema.Class<Server>("Config.LSP.Server")({
|
|
11
|
-
command: Schema.String.pipe(Schema.Array),
|
|
12
|
-
extensions: Schema.String.pipe(Schema.Array, optional),
|
|
13
|
-
disabled: Schema.Boolean.pipe(optional),
|
|
14
|
-
env: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
15
|
-
initialization: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
16
|
-
}) {}
|
|
17
|
-
|
|
18
|
-
export const Entry = Schema.Union([Disabled, Server])
|
|
19
|
-
export const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])
|
|
1
|
+
export * as ConfigLSP from "./lsp.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export const Disabled = Schema.Struct({
|
|
7
|
+
disabled: Schema.Literal(true),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export class Server extends Schema.Class<Server>("Config.LSP.Server")({
|
|
11
|
+
command: Schema.String.pipe(Schema.Array),
|
|
12
|
+
extensions: Schema.String.pipe(Schema.Array, optional),
|
|
13
|
+
disabled: Schema.Boolean.pipe(optional),
|
|
14
|
+
env: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
15
|
+
initialization: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
16
|
+
}) {}
|
|
17
|
+
|
|
18
|
+
export const Entry = Schema.Union([Disabled, Server])
|
|
19
|
+
export const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])
|
package/src/config/mcp.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export * as ConfigMCP from "./mcp.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { Mcp } from "../mcp.js"
|
|
5
|
-
import { optional } from "../schema.js"
|
|
6
|
-
|
|
7
|
-
export const Timeout = Mcp.TimeoutConfig
|
|
8
|
-
export type Timeout = Mcp.TimeoutConfig
|
|
9
|
-
export const Local = Mcp.LocalConfig
|
|
10
|
-
export type Local = Mcp.LocalConfig
|
|
11
|
-
export const OAuth = Mcp.OAuthConfig
|
|
12
|
-
export type OAuth = Mcp.OAuthConfig
|
|
13
|
-
export const Remote = Mcp.RemoteConfig
|
|
14
|
-
export type Remote = Mcp.RemoteConfig
|
|
15
|
-
export const Server = Mcp.ServerConfig
|
|
16
|
-
export const Protocol = Mcp.Protocol
|
|
17
|
-
export type Protocol = Mcp.Protocol
|
|
18
|
-
|
|
19
|
-
export class Info extends Schema.Class<Info>("Config.MCP")({
|
|
20
|
-
timeout: Timeout.pipe(optional),
|
|
21
|
-
servers: Schema.Record(Schema.String, Server).pipe(optional),
|
|
22
|
-
}) {}
|
|
1
|
+
export * as ConfigMCP from "./mcp.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { Mcp } from "../mcp.js"
|
|
5
|
+
import { optional } from "../schema.js"
|
|
6
|
+
|
|
7
|
+
export const Timeout = Mcp.TimeoutConfig
|
|
8
|
+
export type Timeout = Mcp.TimeoutConfig
|
|
9
|
+
export const Local = Mcp.LocalConfig
|
|
10
|
+
export type Local = Mcp.LocalConfig
|
|
11
|
+
export const OAuth = Mcp.OAuthConfig
|
|
12
|
+
export type OAuth = Mcp.OAuthConfig
|
|
13
|
+
export const Remote = Mcp.RemoteConfig
|
|
14
|
+
export type Remote = Mcp.RemoteConfig
|
|
15
|
+
export const Server = Mcp.ServerConfig
|
|
16
|
+
export const Protocol = Mcp.Protocol
|
|
17
|
+
export type Protocol = Mcp.Protocol
|
|
18
|
+
|
|
19
|
+
export class Info extends Schema.Class<Info>("Config.MCP")({
|
|
20
|
+
timeout: Timeout.pipe(optional),
|
|
21
|
+
servers: Schema.Record(Schema.String, Server).pipe(optional),
|
|
22
|
+
}) {}
|
package/src/config/media.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export * as ConfigMedia from "./media.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional, PositiveInt } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Image extends Schema.Class<Image>("Config.Media.Image")({
|
|
7
|
-
auto_resize: Schema.Boolean.pipe(optional),
|
|
8
|
-
max_width: PositiveInt.pipe(optional),
|
|
9
|
-
max_height: PositiveInt.pipe(optional),
|
|
10
|
-
max_base64_bytes: PositiveInt.pipe(optional),
|
|
11
|
-
}) {}
|
|
12
|
-
|
|
13
|
-
export class Info extends Schema.Class<Info>("Config.Media")({
|
|
14
|
-
image: Image.pipe(optional),
|
|
15
|
-
}) {}
|
|
1
|
+
export * as ConfigMedia from "./media.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional, PositiveInt } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Image extends Schema.Class<Image>("Config.Media.Image")({
|
|
7
|
+
auto_resize: Schema.Boolean.pipe(optional),
|
|
8
|
+
max_width: PositiveInt.pipe(optional),
|
|
9
|
+
max_height: PositiveInt.pipe(optional),
|
|
10
|
+
max_base64_bytes: PositiveInt.pipe(optional),
|
|
11
|
+
}) {}
|
|
12
|
+
|
|
13
|
+
export class Info extends Schema.Class<Info>("Config.Media")({
|
|
14
|
+
image: Image.pipe(optional),
|
|
15
|
+
}) {}
|
package/src/config/model.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export * as ConfigModel from "./model.js"
|
|
2
|
-
|
|
3
|
-
import { Schema, SchemaGetter } from "effect"
|
|
4
|
-
import { Model } from "../model.js"
|
|
5
|
-
import { Provider } from "../provider.js"
|
|
6
|
-
import { optional } from "../schema.js"
|
|
7
|
-
|
|
8
|
-
const ProviderID = Provider.ID.check(Schema.isPattern(/^[^/#]+$/u))
|
|
9
|
-
const ModelID = Model.ID.check(Schema.isPattern(/^[^#]+$/u))
|
|
10
|
-
const VariantID = Model.VariantID.check(Schema.isPattern(/^[^#]+$/u))
|
|
11
|
-
|
|
12
|
-
const Explicit = Schema.Struct({
|
|
13
|
-
providerID: ProviderID,
|
|
14
|
-
model: ModelID,
|
|
15
|
-
variant: VariantID.pipe(optional),
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const Short = Schema.String.check(Schema.isPattern(/^[^/#]+\/[^#]+(?:#[^#]+)?$/u))
|
|
19
|
-
|
|
20
|
-
export interface Selection extends Schema.Schema.Type<typeof Explicit> {}
|
|
21
|
-
export const Selection = Schema.Union([Short, Explicit])
|
|
22
|
-
.pipe(
|
|
23
|
-
Schema.decodeTo(Explicit, {
|
|
24
|
-
decode: SchemaGetter.transform((input) => (typeof input === "string" ? parse(input) : input)),
|
|
25
|
-
encode: SchemaGetter.passthrough({ strict: false }),
|
|
26
|
-
}),
|
|
27
|
-
)
|
|
28
|
-
.annotate({ identifier: "Config.ModelSelection" })
|
|
29
|
-
|
|
30
|
-
function parse(input: string): Selection {
|
|
31
|
-
const ref = Model.Ref.parse(input)
|
|
32
|
-
return {
|
|
33
|
-
providerID: ref.providerID,
|
|
34
|
-
model: ref.id,
|
|
35
|
-
...(ref.variant ? { variant: ref.variant } : {}),
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
export * as ConfigModel from "./model.js"
|
|
2
|
+
|
|
3
|
+
import { Schema, SchemaGetter } from "effect"
|
|
4
|
+
import { Model } from "../model.js"
|
|
5
|
+
import { Provider } from "../provider.js"
|
|
6
|
+
import { optional } from "../schema.js"
|
|
7
|
+
|
|
8
|
+
const ProviderID = Provider.ID.check(Schema.isPattern(/^[^/#]+$/u))
|
|
9
|
+
const ModelID = Model.ID.check(Schema.isPattern(/^[^#]+$/u))
|
|
10
|
+
const VariantID = Model.VariantID.check(Schema.isPattern(/^[^#]+$/u))
|
|
11
|
+
|
|
12
|
+
const Explicit = Schema.Struct({
|
|
13
|
+
providerID: ProviderID,
|
|
14
|
+
model: ModelID,
|
|
15
|
+
variant: VariantID.pipe(optional),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const Short = Schema.String.check(Schema.isPattern(/^[^/#]+\/[^#]+(?:#[^#]+)?$/u))
|
|
19
|
+
|
|
20
|
+
export interface Selection extends Schema.Schema.Type<typeof Explicit> {}
|
|
21
|
+
export const Selection = Schema.Union([Short, Explicit])
|
|
22
|
+
.pipe(
|
|
23
|
+
Schema.decodeTo(Explicit, {
|
|
24
|
+
decode: SchemaGetter.transform((input) => (typeof input === "string" ? parse(input) : input)),
|
|
25
|
+
encode: SchemaGetter.passthrough({ strict: false }),
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
.annotate({ identifier: "Config.ModelSelection" })
|
|
29
|
+
|
|
30
|
+
function parse(input: string): Selection {
|
|
31
|
+
const ref = Model.Ref.parse(input)
|
|
32
|
+
return {
|
|
33
|
+
providerID: ref.providerID,
|
|
34
|
+
model: ref.id,
|
|
35
|
+
...(ref.variant ? { variant: ref.variant } : {}),
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/config/plugin.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * as ConfigPlugin from "./plugin.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "../schema.js"
|
|
5
|
-
|
|
6
|
-
export class Entry extends Schema.Class<Entry>("Config.Plugin.Entry")({
|
|
7
|
-
package: Schema.String,
|
|
8
|
-
options: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
9
|
-
}) {}
|
|
10
|
-
|
|
11
|
-
export const Plugin = Schema.Union([Schema.String, Entry])
|
|
12
|
-
export type Plugin = typeof Plugin.Type
|
|
13
|
-
|
|
14
|
-
export const Plugins = Plugin.pipe(Schema.Array)
|
|
1
|
+
export * as ConfigPlugin from "./plugin.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "../schema.js"
|
|
5
|
+
|
|
6
|
+
export class Entry extends Schema.Class<Entry>("Config.Plugin.Entry")({
|
|
7
|
+
package: Schema.String,
|
|
8
|
+
options: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
9
|
+
}) {}
|
|
10
|
+
|
|
11
|
+
export const Plugin = Schema.Union([Schema.String, Entry])
|
|
12
|
+
export type Plugin = typeof Plugin.Type
|
|
13
|
+
|
|
14
|
+
export const Plugins = Plugin.pipe(Schema.Array)
|