@opencode/schema 0.0.0-dev-1343 → 0.0.0-dev-1345

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/agent.d.ts CHANGED
@@ -107,6 +107,19 @@ export declare const Info: Schema.Struct<{
107
107
  readonly body: Schema.$Record<Schema.String, Schema.Any>;
108
108
  }>;
109
109
  readonly system: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
110
+ /**
111
+ * Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
112
+ * introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
113
+ * sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
114
+ * switches away.
115
+ */
116
+ readonly instructions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.String, Schema.Struct<{
117
+ readonly selected: Schema.String;
118
+ readonly unselected: Schema.String;
119
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
120
+ readonly selected: Schema.String;
121
+ readonly unselected: Schema.String;
122
+ }>]>>, never, never>;
110
123
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
111
124
  readonly mode: Schema.Literals<readonly ["subagent", "primary", "all"]>;
112
125
  readonly hidden: Schema.Boolean;
package/dist/agent.js CHANGED
@@ -16,6 +16,13 @@ export const Info = Schema.Struct({
16
16
  model: Model.Ref.pipe(optional),
17
17
  request: Provider.Request,
18
18
  system: Schema.String.pipe(optional),
19
+ /**
20
+ * Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
21
+ * introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
22
+ * sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
23
+ * switches away.
24
+ */
25
+ instructions: Schema.Union([Schema.String, Schema.Struct({ selected: Schema.String, unselected: Schema.String })]).pipe(optional),
19
26
  description: Schema.String.pipe(optional),
20
27
  mode: Schema.Literals(["subagent", "primary", "all"]),
21
28
  hidden: Schema.Boolean,
package/dist/tool.d.ts CHANGED
@@ -6,15 +6,23 @@ import type { Automation } from "./automation.js";
6
6
  import type { Session } from "./session.js";
7
7
  import type { SessionMessage } from "./session-message.js";
8
8
  export type Metadata = Readonly<Record<string, any>>;
9
- /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
9
+ /**
10
+ * Optional wire encoding of a tool's single required string field. Execution still receives the object.
11
+ *
12
+ * `field` names that required string field, so the tool can have other parameters. Models that take raw text then set
13
+ * those on an optional first line, which the AI package describes and parses; the format constrains the rest.
14
+ */
10
15
  export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
11
16
  readonly type: Schema.Literal<"text">;
17
+ readonly field: Schema.optionalKey<Schema.String>;
12
18
  }>, Schema.Struct<{
13
19
  readonly type: Schema.Literal<"regex">;
14
20
  readonly pattern: Schema.String;
21
+ readonly field: Schema.optionalKey<Schema.String>;
15
22
  }>, Schema.Struct<{
16
23
  readonly type: Schema.Literal<"lark">;
17
24
  readonly grammar: Schema.String;
25
+ readonly field: Schema.optionalKey<Schema.String>;
18
26
  }>]>;
19
27
  export type Freeform = typeof Freeform.Type;
20
28
  export declare const FreeformFormat: Schema.Literals<("lark" | "regex" | "text")[]>;
package/dist/tool.js CHANGED
@@ -1,10 +1,16 @@
1
1
  export * as Tool from "./tool.js";
2
2
  import { Effect, JsonSchema, Schema } from "effect";
3
- /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
3
+ const field = Schema.optionalKey(Schema.String);
4
+ /**
5
+ * Optional wire encoding of a tool's single required string field. Execution still receives the object.
6
+ *
7
+ * `field` names that required string field, so the tool can have other parameters. Models that take raw text then set
8
+ * those on an optional first line, which the AI package describes and parses; the format constrains the rest.
9
+ */
4
10
  export const Freeform = Schema.Union([
5
- Schema.Struct({ type: Schema.Literal("text") }),
6
- Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }),
7
- Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }),
11
+ Schema.Struct({ type: Schema.Literal("text"), field }),
12
+ Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String, field }),
13
+ Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String, field }),
8
14
  ]).annotate({ identifier: "Tool.Freeform" });
9
15
  export const FreeformFormat = Schema.Literals(Freeform.members.map((member) => member.fields.type.literal)).annotate({
10
16
  identifier: "Tool.FreeformFormat",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "0.0.0-dev-1343",
4
+ "version": "0.0.0-dev-1345",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {