An operation definition has a key (a DXN), metadata for people and agents, and schemas for its input and output. A
handler is an Effect that takes the input and returns the output. Definitions and handlers are separate values, so a
plugin can export a definition for other plugins to call without exposing how it runs.
Creates a new Operation definition.
Applies default executionMode of 'async' if not specified.
The returned type preserves the literal types of props (including services).
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Use when you need to model the return value of a function, RPC, or endpoint
whose result is intentionally ignored.
Details
Runtime parsing accepts any present value and discards it, producing
undefined. The public decoded and encoded TypeScript representation remains
void, so typed construction, decoding, and encoding APIs are still modeled
as void.
@stability ― stable
@category ― models
@since ― 3.10.0
@see ― Undefined for a schema that matches only the exact undefined value.
@stability ― stable
@category ― schemas
@since ― 3.10.0
Void,
27
});
28
Plugins contribute handlers in an operation handler set through the OperationHandler capability. The operation
invoker looks up the handler by the definition’s key and runs it. Any module, handler or graph action can invoke an
operation with Operation.invoke; a component uses useOperation.
Creates an Effect that always succeeds with a given value.
When to use
Use when an effect should complete successfully with a specific value without any errors
or external dependencies.
Example (Creating a successful effect)
import { Effect } from"effect"
// Creating an effect that represents a successful scenario
//
// ┌─── Effect<number, never, never>
// ▼
const success = Effect.succeed(42)
Effect.runSync(success) // => 42
@see ― fail to create an effect that represents a failure.
@stability ― stable
@category ― constructors
@since ― 2.0.0
succeed(
var undefined
undefined)),
11
);
12
A skill hands operations to the assistant. It is a name, instructions, and a list of operations that become the
assistant’s tools; a plugin contributes it through AppCapabilities.SkillDefinition.
Skill schema defines the structure for AI assistant skills.
Skills contain instructions, tools, and artifacts that guide the AI's behavior.
Skills may use tools to create and read artifacts, which are managed by the assistant.
Follows the Agent Skills spec (https://agentskills.io/specification) as closely as it can, so a skill
means the same here as in any other harness. Add a field the spec lacks only with a strong reason,
and say what it is. Credentials and MCP servers do not belong here: a server is a connection, which
the space owns and each conversation can turn off. Nor do hooks: a plugin contributes those beside its
skills (@dxos/compute/Hook).
The registry key and version are stored in the object meta — access them via
Obj.getMeta(skill).key and Obj.getMeta(skill).version.
Skill=>
13
import Skill
Skill.
constmake: <"com.example.skill.stash">(props: {
key: "com.example.skill.stash";
version?: string;
name: string;
mcpPrompt?: boolean;
} & Partial<Skill.Skill>) =>Skill.Skill
Create a new Skill.
The key (and optional version) are stored in the object meta.
key must be a valid DXN name (e.g. org.dxos.skill.mySkill).
One definition serves three callers. A button invokes it through a hook. The command palette lists it. A skill hands
it to the assistant as a tool, and the assistant reads the schema descriptions to fill in the input. None of the three
needs code of its own.
The invoker validates the input against the schema before the handler runs, and the output after.
Errors are typed. A handler fails with tagged errors that a caller catches by tag, and invoking an operation that no
plugin handles fails with NoHandlerError.
An operation can be undone. A plugin contributes an UndoMapping that names the operation’s inverse and derives the
inverse’s input from the forward input and output; the app records each undoable invocation and offers to undo it.
Creates a new Operation definition.
Applies default executionMode of 'async' if not specified.
The returned type preserves the literal types of props (including services).
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Schema for string values. Validates that the input is typeof"string".
@stability ― stable
@category ― models
@since ― 4.0.0
@stability ― stable
@category ― schemas
@since ― 4.0.0
String,
name: Schema.String
name:
import Schema
Schema.
const String: Schema.String
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof"string".
@stability ― stable
@category ― models
@since ― 4.0.0
@stability ― stable
@category ― schemas
@since ― 4.0.0
String }),
15
output: Schema.Struct<{
readonly previous: Schema.String;
}>
output:
import Schema
Schema.
functionStruct<{
readonly previous: Schema.String;
}>(fields: {
readonly previous: Schema.String;
}): Schema.Struct<{
readonly previous: Schema.String;
}>
Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Declared fields may be inherited and are copied to own properties in the
output. The __proto__ field is accepted only when it is an own property.
Parsing does not guarantee that output keys retain their input order.
Helper to define an eager module body with the same spec-carrying shape as
lazyModule
— for bodies that are plain values (translations, schema) or too small
to justify a chunk, so plugin definitions stay a uniform chain of spec-carrying modules.
@param ― name The module name — used to auto-compute module IDs.
Optional message to show in the undo toast.
Can be a static Label or a function that derives the message from input/output.
message: 'Renamed',
36
},
37
]),
38
),
39
);
40
Handlers load lazily. A lazy handler set names each handler’s module, and the framework imports it the first time the
operation is invoked.
The App Toolkit defines operations every plugin can call. LayoutOperation.Open opens items by path,
LayoutOperation.Close closes them, and SpaceOperation.AddObject adds an object to a space.
A handler runs with the services its definition declares, plus the operation service for invoking other operations.
It does not get the React tree.
An operation’s input must be serializable for the assistant to call it. Pass objects by reference where the caller is
an agent.
Undo replays the inverse operation; it does not restore a snapshot. An operation whose effect cannot be inverted
from its input and output is not undoable.