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

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/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-1344",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {