@opencode/schema 0.0.0-dev-256 → 0.0.0-dev-261
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/dist/config/experimental.d.ts +13 -5
- package/dist/config/policy.d.ts +18 -3
- package/dist/config/policy.js +41 -3
- package/dist/config.d.ts +13 -5
- package/package.json +1 -1
|
@@ -45,15 +45,23 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
|
|
|
45
45
|
readonly schedules: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
46
46
|
readonly subagent_depth: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
47
47
|
readonly location_idle_timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.DurationFromString, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.DurationFromString, Schema.Literal<false>]>>, never, never>;
|
|
48
|
-
readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
49
|
-
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.use"]>;
|
|
48
|
+
readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.decodeTo<Schema.toType<Schema.Struct<{
|
|
49
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
50
50
|
readonly resource: Schema.String;
|
|
51
51
|
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
52
|
-
}
|
|
53
|
-
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.use"]>;
|
|
52
|
+
}>>, Schema.Struct<{
|
|
53
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
54
54
|
readonly resource: Schema.String;
|
|
55
55
|
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
56
|
-
}
|
|
56
|
+
}>, never, never>>>>, Schema.optionalKey<Schema.$Array<Schema.decodeTo<Schema.toType<Schema.Struct<{
|
|
57
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
58
|
+
readonly resource: Schema.String;
|
|
59
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
60
|
+
}>>, Schema.Struct<{
|
|
61
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
62
|
+
readonly resource: Schema.String;
|
|
63
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
64
|
+
}>, never, never>>>, never, never>;
|
|
57
65
|
}>, {}>;
|
|
58
66
|
export declare class Info extends Info_base {
|
|
59
67
|
}
|
package/dist/config/policy.d.ts
CHANGED
|
@@ -2,9 +2,24 @@ export * as ConfigPolicy from "./policy.js";
|
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
export declare const Effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
4
4
|
export type Effect = typeof Effect.Type;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* - `provider.use`: resource is a provider ID.
|
|
7
|
+
* - `tool.use`: resource is `<tool>:<input>`, such as `shell:git *`.
|
|
8
|
+
* - `integration.connect`: resource is an integration ID; controls which integrations can be listed and connected.
|
|
9
|
+
* - `integration.use`: resource is `<integration>#<account>`, or the bare integration ID when the providers, models,
|
|
10
|
+
* web search, MCP servers, or config an integration supplies come from no account (env keys, local config, the
|
|
11
|
+
* signed-out free tier).
|
|
12
|
+
* - `mcp.use`, `skill.use`, `plugin.use`: resource is an MCP server name, skill ID, or plugin target.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
15
|
+
export type Action = typeof Action.Type;
|
|
16
|
+
export declare const Info: Schema.decodeTo<Schema.toType<Schema.Struct<{
|
|
17
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
7
18
|
readonly resource: Schema.String;
|
|
8
19
|
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
9
|
-
}
|
|
20
|
+
}>>, Schema.Struct<{
|
|
21
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
22
|
+
readonly resource: Schema.String;
|
|
23
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
24
|
+
}>, never, never>;
|
|
10
25
|
export type Info = typeof Info.Type;
|
package/dist/config/policy.js
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
export * as ConfigPolicy from "./policy.js";
|
|
2
|
-
import { Schema } from "effect";
|
|
2
|
+
import { Schema, SchemaGetter } from "effect";
|
|
3
3
|
export const Effect = Schema.Literals(["allow", "deny"]);
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* - `provider.use`: resource is a provider ID.
|
|
6
|
+
* - `tool.use`: resource is `<tool>:<input>`, such as `shell:git *`.
|
|
7
|
+
* - `integration.connect`: resource is an integration ID; controls which integrations can be listed and connected.
|
|
8
|
+
* - `integration.use`: resource is `<integration>#<account>`, or the bare integration ID when the providers, models,
|
|
9
|
+
* web search, MCP servers, or config an integration supplies come from no account (env keys, local config, the
|
|
10
|
+
* signed-out free tier).
|
|
11
|
+
* - `mcp.use`, `skill.use`, `plugin.use`: resource is an MCP server name, skill ID, or plugin target.
|
|
12
|
+
*/
|
|
13
|
+
export const Action = Schema.Literals([
|
|
14
|
+
"provider.use",
|
|
15
|
+
"tool.use",
|
|
16
|
+
"integration.connect",
|
|
17
|
+
"integration.use",
|
|
18
|
+
"mcp.use",
|
|
19
|
+
"skill.use",
|
|
20
|
+
"plugin.use",
|
|
21
|
+
]);
|
|
22
|
+
const Statement = Schema.Struct({
|
|
23
|
+
action: Action,
|
|
6
24
|
resource: Schema.String,
|
|
7
25
|
effect: Effect,
|
|
8
26
|
});
|
|
27
|
+
// Before `mcp.use`, `skill.use` and `plugin.use` existed, `integration.use` covered them with a resource prefix.
|
|
28
|
+
// Every policy source decodes through this schema, so this is the only place that knows the legacy form. Only prefixed
|
|
29
|
+
// resources convert: a bare `integration.use` `*` keeps its action and now covers providers and accounts.
|
|
30
|
+
const legacy = new Map([
|
|
31
|
+
["mcp", "mcp.use"],
|
|
32
|
+
["skill", "skill.use"],
|
|
33
|
+
["plugin", "plugin.use"],
|
|
34
|
+
]);
|
|
35
|
+
export const Info = Statement.pipe(Schema.decodeTo(Schema.toType(Statement), {
|
|
36
|
+
decode: SchemaGetter.transform((policy) => {
|
|
37
|
+
if (policy.action !== "integration.use")
|
|
38
|
+
return policy;
|
|
39
|
+
const separator = policy.resource.indexOf(":");
|
|
40
|
+
const action = separator === -1 ? undefined : legacy.get(policy.resource.slice(0, separator));
|
|
41
|
+
if (!action)
|
|
42
|
+
return policy;
|
|
43
|
+
return { ...policy, action, resource: policy.resource.slice(separator + 1) };
|
|
44
|
+
}),
|
|
45
|
+
encode: SchemaGetter.passthrough(),
|
|
46
|
+
}));
|
package/dist/config.d.ts
CHANGED
|
@@ -54,15 +54,23 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
|
|
|
54
54
|
readonly resource: Schema.String;
|
|
55
55
|
readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
|
|
56
56
|
}>>>, never, never>;
|
|
57
|
-
readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
58
|
-
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.use"]>;
|
|
57
|
+
readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.decodeTo<Schema.toType<Schema.Struct<{
|
|
58
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
59
59
|
readonly resource: Schema.String;
|
|
60
60
|
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
61
|
-
}
|
|
62
|
-
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.use"]>;
|
|
61
|
+
}>>, Schema.Struct<{
|
|
62
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
63
63
|
readonly resource: Schema.String;
|
|
64
64
|
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
65
|
-
}
|
|
65
|
+
}>, never, never>>>>, Schema.optionalKey<Schema.$Array<Schema.decodeTo<Schema.toType<Schema.Struct<{
|
|
66
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
67
|
+
readonly resource: Schema.String;
|
|
68
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
69
|
+
}>>, Schema.Struct<{
|
|
70
|
+
readonly action: Schema.Literals<readonly ["provider.use", "tool.use", "integration.connect", "integration.use", "mcp.use", "skill.use", "plugin.use"]>;
|
|
71
|
+
readonly resource: Schema.String;
|
|
72
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
|
|
73
|
+
}>, never, never>>>, never, never>;
|
|
66
74
|
readonly agents: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, typeof ConfigAgent.Info>>>, Schema.optionalKey<Schema.$Record<Schema.String, typeof ConfigAgent.Info>>, never, never>;
|
|
67
75
|
readonly snapshots: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
68
76
|
readonly watcher: Schema.decodeTo<Schema.optional<Schema.toType<typeof ConfigWatcher.Info>>, Schema.optionalKey<typeof ConfigWatcher.Info>, never, never>;
|