@opencode/schema 0.0.0-dev-1312 → 0.0.0-dev-1313
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 +15 -12
- package/package.json +1 -1
package/dist/tool.d.ts
CHANGED
|
@@ -30,25 +30,28 @@ export interface Context {
|
|
|
30
30
|
* has; a tool that does not is interrupted.
|
|
31
31
|
*/
|
|
32
32
|
readonly cancel?: Effect.Effect<void>;
|
|
33
|
+
/** True when the tool is invoked from inside Code Mode (`execute`). */
|
|
34
|
+
readonly codemode?: boolean;
|
|
33
35
|
}
|
|
34
36
|
export interface Namespace {
|
|
35
37
|
readonly name: string;
|
|
36
38
|
readonly description: string;
|
|
37
39
|
}
|
|
38
|
-
interface
|
|
40
|
+
export interface Options<CMInput extends ValueSchema<any> = ValueSchema<any>, CMOutput extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> {
|
|
39
41
|
readonly namespace?: string;
|
|
40
42
|
readonly permission?: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
readonly codemode?: boolean | {
|
|
44
|
+
readonly pinned?: boolean;
|
|
45
|
+
readonly description?: string;
|
|
46
|
+
readonly input?: CMInput;
|
|
47
|
+
readonly output?: CMOutput;
|
|
48
|
+
};
|
|
49
|
+
/** @deprecated Use `codemode.pinned` instead. Removed in the next minor. */
|
|
44
50
|
readonly pinned?: boolean;
|
|
45
|
-
}
|
|
46
|
-
readonly codemode: boolean;
|
|
47
|
-
readonly pinned?: never;
|
|
48
|
-
});
|
|
51
|
+
}
|
|
49
52
|
export type ValueSchema<A = unknown> = Schema.Codec<A, any> | StandardSchemaV1<any, A> | JsonSchema.JsonSchema;
|
|
50
53
|
type InputValue<S> = 0 extends 1 & S ? any : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<any, infer A> ? A : unknown;
|
|
51
|
-
type OutputValue<S> = S extends undefined ? never : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<infer A, any> ? A : any;
|
|
54
|
+
type OutputValue<S> = 0 extends 1 & S ? any : S extends undefined ? never : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<infer A, any> ? A : any;
|
|
52
55
|
declare const Error_base: Schema.Class<Error, Schema.TaggedStruct<"Tool.Error", {
|
|
53
56
|
readonly message: Schema.String;
|
|
54
57
|
readonly error: Schema.optional<Schema.Defect>;
|
|
@@ -85,12 +88,12 @@ export interface Result<Output extends ValueSchema<any> | undefined = ValueSchem
|
|
|
85
88
|
readonly content?: string | ReadonlyArray<Content>;
|
|
86
89
|
readonly metadata?: Metadata;
|
|
87
90
|
}
|
|
88
|
-
export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> = {
|
|
91
|
+
export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined, CMInput extends ValueSchema<any> = Input, CMOutput extends ValueSchema<any> | undefined = Output> = {
|
|
89
92
|
readonly name: string;
|
|
90
93
|
readonly input: Input;
|
|
91
94
|
readonly freeform?: Freeform;
|
|
92
95
|
readonly description: string;
|
|
93
|
-
readonly execute: (input: InputValue<Input>, context: Context) => Effect.Effect<Result<Output>, Error>;
|
|
96
|
+
readonly execute: (input: InputValue<Input> | InputValue<CMInput>, context: Context) => Effect.Effect<Result<Output | CMOutput>, Error>;
|
|
94
97
|
readonly output?: Output;
|
|
95
|
-
readonly options?: Options
|
|
98
|
+
readonly options?: Options<CMInput, CMOutput>;
|
|
96
99
|
};
|