toolmark-monorepo / @toolmark/core / Toolmark
Interface: Toolmark
Defined in: packages/core/src/registry.ts:152
The tool registry (spec §5).
Properties
clientId
readonlyclientId:string
Defined in: packages/core/src/registry.ts:154
Random id of this page load (D17).
events
readonlyevents:object
Defined in: packages/core/src/registry.ts:232
Registry events.
on()
on<
K>(type,fn): () =>void
Type Parameters
K
K extends keyof ToolmarkEventMap
Parameters
type
K
fn
(e) => void
Returns
() => void
rev
readonlyrev:number
Defined in: packages/core/src/registry.ts:156
Current manifest revision.
Methods
anchor()
anchor(
tool,param?):Element|null
Defined in: packages/core/src/registry.ts:197
The element a tool (or one of its params) is anchored to, for tours (spec §13). Precedence with param: Toolmark.setAnchor override → anchors.params[param]() → anchors.resolve(param) → null; without param: override → anchors.element() → null. null for unknown tools. Never throws: a throwing anchor function gives null (and a development error event tool_threw).
Parameters
tool
string
Full tool name.
param?
string
Input path, e.g. email or items.0.qty.
Returns
Element | null
call()
call(
name,input,opts):Promise<ToolResult<unknown>>
Defined in: packages/core/src/registry.ts:214
Calls a tool. Never throws; every outcome is a ToolResult.
Parameters
name
string
input
unknown
opts
caller
rev?
number
signal?
AbortSignal
Returns
Promise<ToolResult<unknown>>
confirmPending()
confirmPending(
confirmId,outcome):Promise<ToolResult<unknown>>
Defined in: packages/core/src/registry.ts:226
Completes a needs_confirmation call (single use). Approval runs the tool as caller human (with re-validated edited input, if given); rejection → cancelled operator. The approved run has no caller signal; it is bounded by callTimeoutMs (default 120000).
Parameters
confirmId
string
outcome
Returns
Promise<ToolResult<unknown>>
describe()
describe(
name,opts?):ToolManifest|undefined
Defined in: packages/core/src/registry.ts:180
Full manifest entry of one tool, or undefined when unknown/hidden for caller.
Parameters
name
string
opts?
caller?
Returns
ToolManifest | undefined
info()
info(
name):ToolInfo|undefined
Defined in: packages/core/src/registry.ts:187
Registry-only facts about a registered tool (including one hidden by when), or undefined when no tool has that full name. Not policy-filtered and never part of manifest(), describe() or protocol messages.
Parameters
name
string
Full tool name.
Returns
ToolInfo | undefined
manifest()
Call Signature
manifest(
opts?):object
Defined in: packages/core/src/registry.ts:173
Summary manifest, sorted by name; filtered by policy when caller is given.
Parameters
opts?
caller?
detail?
"summary"
Returns
object
rev
rev:
number
tools
tools:
ToolManifestSummary[]
Call Signature
manifest(
opts):object
Defined in: packages/core/src/registry.ts:178
Full manifest (with schemas).
Parameters
opts
caller?
detail
"full"
Returns
object
rev
rev:
number
tools
tools:
ToolManifest[]
pendingConfirmations()
pendingConfirmations():
PendingConfirmation[]
Defined in: packages/core/src/registry.ts:220
Deferred confirmations waiting for Toolmark.confirmPending.
Returns
register()
register<
I,O>(tool,opts?):Registration
Defined in: packages/core/src/registry.ts:162
Registers a tool.
Type Parameters
I
I
O
O
Parameters
tool
ToolDefinition<I, O>
The tool declaration.
opts?
Target scope and an optional signal whose abort unregisters the tool.
scope?
signal?
AbortSignal
Returns
scope()
scope(
name,opts?):Scope
Defined in: packages/core/src/registry.ts:171
Creates a root-level scope (nest with scope.scope()).
Parameters
name
string
Scope name (the path segment its tools are prefixed with).
opts?
when: false hides its tools; transparent: true adds no name segment.
Returns
setAnchor()
setAnchor(
tool,param,el):void
Defined in: packages/core/src/registry.ts:205
Overrides the anchor of (tool, param) (param undefined = the tool's own element), e.g. for custom widgets. null clears the override. Overrides are dropped when the tool is disposed.
Parameters
tool
string
Full tool name.
param
string | undefined
Input path, or undefined for the tool itself.
el
Element | null
The element, or null to clear.
Returns
void
state()
state(
tool):ToolState<unknown> |undefined
Defined in: packages/core/src/registry.ts:212
The tool's current state from its state() hook, or undefined for unknown tools and tools without one. Synchronous and side-effect free; never throws (a throwing hook gives undefined and a development error event tool_threw).
Parameters
tool
string
Full tool name.
Returns
ToolState<unknown> | undefined
subscribe()
subscribe(
listener): () =>void
Defined in: packages/core/src/registry.ts:230
Subscribes to revision changes (once per microtask). Returns an unsubscribe function.
Parameters
listener
(rev) => void
Returns
() => void
undo()
undo(
callId):Promise<ToolResult<{changes:FieldChange[]; }>>
Defined in: packages/core/src/registry.ts:228
Runs the undo restorer a call registered (once); otherwise refused undo_unavailable.
Parameters
callId
string
Returns
Promise<ToolResult<{ changes: FieldChange[]; }>>
use()
use(
consumer): () =>void
Defined in: packages/core/src/registry.ts:236
Attaches a consumer (e.g. the bridge); returns its idempotent disposer.
Parameters
consumer
(tm) => () => void
Returns
() => void