You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/codemode/README.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ const result =
60
60
`)
61
61
```
62
62
63
-
`result` is always an `ExecuteResult`. Program, validation, limit, and tool failures are returned as diagnostics rather than failing the Effect. Host interruption remains interruption.
63
+
`result` is always a `CodeMode.Result`. Program, validation, limit, and tool failures are returned as diagnostics rather than failing the Effect. Host interruption remains interruption.
64
64
65
65
Successful result values are JSON-safe data. A program that returns `undefined`, including by reaching the end without `return`, produces `null`; nested `undefined` values are normalized to `null` as well.
66
66
@@ -83,6 +83,8 @@ const tool = Tool.make({
83
83
84
84
The description and schemas are part of the model-visible tool contract. Keep descriptions concrete and put authorization in `run` or in the service it calls.
85
85
86
+
Public tool types are grouped under the same namespace: `Tool.Definition`, `Tool.Options`, `Tool.SchemaType`, and `Tool.JsonSchema`.
runtime.instructions() // model-facing syntax and tool guide
116
-
runtime.execute(source) //ExecuteResult
118
+
runtime.execute(source) //CodeMode.Result
117
119
```
118
120
119
-
`CodeMode.Input` and `CodeMode.Result` are Effect schemas for the execution request and result. Hosts can combine them with `runtime.instructions()` and `runtime.execute()` when constructing a framework-specific agent tool.
121
+
`CodeMode.Input`, `CodeMode.Result`, `CodeMode.Success`, `CodeMode.Failure`, `CodeMode.Diagnostic`, and `CodeMode.DiagnosticKind` are both Effect schemas and their inferred TypeScript types. Hosts can combine `CodeMode.Input` and `CodeMode.Result` with `runtime.instructions()` and `runtime.execute()` when constructing a framework-specific agent tool.
122
+
123
+
All other CodeMode types use the same namespace: `CodeMode.Options`, `CodeMode.ExecuteOptions`, `CodeMode.Runtime`, `CodeMode.ExecutionLimits`, `CodeMode.DiscoveryOptions`, `CodeMode.DataValue`, `CodeMode.ToolDescription`, and the `CodeMode.ToolCall*` observation types.
@@ -300,7 +304,7 @@ import { toolError } from "@opencode-ai/codemode"
300
304
run: ({ id }) => (authorized(id) ?loadOrder(id) :Effect.fail(toolError("Order is unavailable")))
301
305
```
302
306
303
-
Only the supplied message is model-visible. The optional cause is never returned in `ExecuteResult`; hosts should perform any required internal logging before crossing this boundary.
307
+
Only the supplied message is model-visible. The optional cause is never returned in `CodeMode.Result`; hosts should perform any required internal logging before crossing this boundary.
304
308
305
309
## Authority Boundary
306
310
@@ -332,7 +336,7 @@ The public contract is guided by these equivalences:
332
336
- A tool implementation is not invoked unless its input has decoded successfully.
333
337
- A tool result is not visible to the program unless its output has decoded and crossed the plain-data boundary successfully.
334
338
- Unknown host failures do not become model-visible diagnostics; `ToolError` is the explicit safe-message channel.
335
-
- Host interruption remains interruption rather than an `ExecuteFailure`.
339
+
- Host interruption remains interruption rather than a `CodeMode.Failure`.
0 commit comments