@lace-cloud/chat-core 0.19.0 → 0.21.0

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/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # @lace-cloud/chat-core
2
2
 
3
- What a host's chat calls Lace through: Lace's ranking of the closed
4
- questions a canvas change asks, beside the reading of the developer's own
5
- model in the host's chat. Lace publishes no chat of its own: the host has
6
- a chat that can call tools (VS Code's native chat, a portal's own loop),
7
- and this package gives it the contract a tool is written against, the
8
- tool sets for a module's canvas, the composition of the two readings, and
9
- the client that reports each decision to Lace. No model port, no loop and
10
- no UI live here; a host adapts the tools to whatever its chat is and
11
- supplies the ports.
3
+ What a host's chat calls Lace through: the tools that change and read a
4
+ module's canvas, save and generate it, validate a module and search the
5
+ registry. Lace publishes no chat of its own: the host has a chat that can
6
+ call tools (VS Code's native chat, a portal's own loop) and a model good
7
+ enough to drive them, and this package gives it the contract a tool is
8
+ written against and the tool sets for a module's canvas. No model port, no
9
+ loop and no UI live here; a host adapts the tools to whatever its chat is
10
+ and supplies the ports.
12
11
 
13
12
  **Zero `vscode` imports.** The adapter from this contract to an editor's
14
13
  tool API lives with that editor.
@@ -25,12 +24,16 @@ A tool is a schema and a handler. `ToolSchema` is
25
24
  `{name, title, description, inputSchema}`: the name the model calls the
26
25
  tool by, the short label a host shows a person, the description that
27
26
  carries the tool's guidance to any host, and the JSON schema of its
28
- input. `ToolHandler` is `(input) → Promise<ToolResult>`, with
27
+ input. `ToolHandler` is `(input, signal?) → Promise<ToolResult>`, with
29
28
  `ToolResult` `{content, isError?}`; a tool whose result carries data for
30
29
  its host beside the text states that result as the handler's type
31
- parameter (`ToolHandler<R>`, `ToolRegistration<R>`). A `ToolRegistry`
32
- holds the pairs; every host constructs its own with
33
- `createToolRegistry()` and registers the tools its environment provides.
30
+ parameter (`ToolHandler<R>`, `ToolRegistration<R>`). `signal` is the
31
+ host's cancellation of the call (an `AbortSignal`), where its chat has
32
+ one: once it aborts, a tool starts nothing further and stops waiting, and
33
+ what it already sent stands. A host with none calls a handler with the
34
+ input alone. A `ToolRegistry` holds the pairs; every host constructs its
35
+ own with `createToolRegistry()` and registers the tools its environment
36
+ provides.
34
37
 
35
38
  ```ts
36
39
  import { createToolRegistry, type ToolSchema } from '@lace-cloud/chat-core';
@@ -44,35 +47,28 @@ registry.getHandler(name); // what the host runs when the model calls one
44
47
 
45
48
  ## The ports a host fills
46
49
 
47
- Capability is a port's presence. The surface's ports are the canvas's own
48
- (`@lace-cloud/canvas/engine`); `openEngineSession` and
49
- `openEngineCommands` there hand them out. The one port of this package's
50
- own is `Transport`: one POST to Lace's API under `/api/v1/candidates/*`,
51
- with the developer's credential attached by the host per request. The
52
- package never sees a credential. A host with none supplies no `Transport`,
53
- and the tools then compose the model's reading alone and report nothing.
50
+ Capability is a port's presence. The ports are the canvas's own
51
+ (`@lace-cloud/canvas/engine`); `openEngineSession` and `openEngineCommands`
52
+ there hand them out.
54
53
 
55
54
  ```ts
56
55
  import { canvasTools, createToolRegistry, moduleTools } from '@lace-cloud/chat-core';
57
56
 
58
57
  const registry = createToolRegistry();
59
- const canvas = canvasTools({ source, editor, commands, transport }); // one authoring session
60
- for (const tool of [...canvas, ...moduleTools({ commands })]) {
58
+ for (const tool of [
59
+ ...canvasTools({ source, editor, commands }), // one authoring session
60
+ ...moduleTools({ commands }),
61
+ ]) {
61
62
  registry.register(tool.schema, tool.handler);
62
63
  }
63
-
64
- // When the host drops the tools or the session closes:
65
- canvas.dispose();
66
64
  ```
67
65
 
68
66
  That is the whole of a host's composition. `canvasTools` returns its four
69
- registrations, in the order below, carrying `dispose`. With a `transport`
70
- the set reads the session's frames itself, for what happened next to each
71
- change it reported, from its construction until `dispose`.
67
+ registrations as a plain tuple, in the order below; `moduleTools` its three.
72
68
 
73
69
  | Tool set | Ports | Schemas | Tools |
74
70
  |---|---|---|---|
75
- | `canvasTools` | `source`, `editor`, `commands`, `transport?` | `canvasToolSchemas` | `lace_change_module_canvas`, `lace_describe_module_canvas`, `lace_save_module_canvas`, `lace_generate_module_terraform` |
71
+ | `canvasTools` | `source`, `editor`, `commands` | `canvasToolSchemas` | `lace_change_module_canvas`, `lace_describe_module_canvas`, `lace_save_module_canvas`, `lace_generate_module_terraform` |
76
72
  | `moduleTools` | `commands` | `moduleToolSchemas` | `lace_validate_module_terraform`, `lace_search_module_registry`, `lace_describe_registry_module` |
77
73
 
78
74
  Each set's schemas are data beside its constructor (`canvasToolSchemas`,
@@ -82,176 +78,21 @@ constructor registers exactly those, so a host that generates a manifest
82
78
  of the tools reads them with no ports at all.
83
79
 
84
80
  - `source` is the session's frames; `editor` is the session mapping's
85
- `EditorPort` without `resolveConflict`: its `apply`, `save`,
86
- `generate` and `wiringCandidates` (the engine matcher's scored
87
- output → input pairs); `commands` runs a CLI command; `transport` is
88
- the port to Lace's API.
89
- - **The change tool is intent-first.** It takes
90
- `{changes: [{request, value?, modelReading, alternativeReading?}]}`:
91
- `request` is one change in the developer's own words and never a
92
- literal, `value` the literal the developer gave for it (the tool selects
93
- and never writes a value of its own), one change and one value per
94
- entry, `modelReading` the model's own reading of the change, required
95
- on every call (its operation, and the names the developer gave as the
96
- canvas lists them, never a value), and `alternativeReading` its other
97
- reading of the words, where the words bear one. For each change the
98
- tool enumerates what the canvas offers for every decision the change
99
- needs (which operation, which instance, which input, which registry
100
- module, which output → input pair) and resolves each in order: the one
101
- candidate the request names exactly, the one it names when case is
102
- ignored, otherwise the two systems. Each change is one `apply` of one
103
- generated `Action`, whose instance-addressed sub-message carries
104
- `scope`, the key of the module that owns the instance
105
- (`resolveInstance` in `@lace-cloud/proto`), and on a `connect`
106
- `source_scope` for the source end; the changes apply in the order
107
- given, each resolved against the state the one before it left.
108
- - **The operations** a change can be: `place` (a registry module, from
109
- `registry list --axis module --limit 500`, narrowed by `--query` when
110
- the request refers to a module as `author/name`; a truncated listing
111
- is said in the result), `connect` (the pair picked among every output
112
- of the source into every input of the target no wire feeds, each
113
- candidate carrying the engine matcher's score for it where the matcher
114
- scores it), `disconnect`, `set` (a literal), `bind` (an
115
- input takes its value from a variable, `var.<name>`), `clear` (an
116
- input is unset), `rename`, `delete` and `ungroup`. Each is one row of
117
- `OPERATIONS`.
118
- - **The longest span names.** A single word names a candidate only
119
- where no other candidate's id, prose or references cover a longer run
120
- of the request's words around it: in "store the orders database admin
121
- password", `admin` is a word of the database's admin password (its
122
- input's description), not the instance `admin`, so the instance goes
123
- to the two systems. Function words ("the", "to", "in", …) name nothing: a run
124
- holds them whoever covers them and a span does not count them, so in
125
- "upgrade the cluster to Kubernetes" `cluster` names the instance
126
- `cluster`, though a node group's description covers "the cluster to".
127
- An instance's prose holds its inputs and outputs with what the module
128
- says each is. A dotted or slashed reference is never outspanned.
129
- - **An entry is one change.** A decision fills one slot of a change, so
130
- words that name more of its candidates than that, each by a name of its
131
- own ("delete net and delete db_replica"), say the entry holds
132
- several: the candidate the model's reading names among them, else the
133
- first named, is applied, and the result says the entry held more and
134
- names what nothing was applied for, with no rank call. Where the names
135
- cannot tell (a name two candidates share, or one named candidate inside
136
- another) and the two systems read any decision of the entry, Lace's
137
- ranking also reads whether the entry is one change or several
138
- (`steps`), under the model's reading alone; the model's answer is `one`
139
- by construction, since the tool asks one entry per change. An entry read
140
- as several has the change read applied, and the result says the entry
141
- held more. Either way it asks for the rest, one entry per change.
142
- `steps` decides only what the result says; it never stops the change,
143
- and it is never ranked under the alternative reading, so it never asks.
144
- A `value` sent with an operation that
145
- takes none (`place`, `connect`, `disconnect`, `clear`, `delete`,
146
- `ungroup`) is said in the result to be unused.
147
- - **The composition.** Per question the names leave open, two readings:
148
- the model's answer is the candidate its stated slot names (none when it
149
- states no slot of the question), and Lace's is its ranking's pick with
150
- a rightness, the measured probability of being right. The answer is
151
- Lace's where the ranking is sure (`sure`: the pick's rightness reaches
152
- the threshold the reply carries for the kind, a reply with no threshold
153
- for the kind being sure of nothing, and `(none)` ranked first never
154
- sure), the model's own otherwise. The operation is Lace's only when the
155
- ranking was sure of it, of every question asked under it, and the
156
- change resolves under it. Where the model stated another operation, this
157
- move rule is part of planning: a question under Lace's operation that
158
- falls to the model (answered or not), or a change that does not resolve
159
- under it (the canvas offers nothing for a question, the listing fails,
160
- the value it needs is missing), means the operation is the model's, and
161
- the change is resolved again under it; only that outcome is the
162
- change's, and the result says why Lace's operation did not stand.
163
- Where the ranking is sure and the reading named another candidate,
164
- Lace's answer stands and the result says both, with a line for the
165
- model to pass on: the decision is graded by what the developer does
166
- next, not withheld. A change neither system resolves
167
- is not applied, and the result names the part and its candidates,
168
- asking for the reading to name one. Where the model gave an alternative
169
- reading and the ranking is sure of a different answer under it,
170
- nothing is applied and both decisions come back for the model to ask
171
- the developer. Until a kind's threshold ships, the ranking is sure of
172
- nothing of that kind and every question is the model's: a change then
173
- applies exactly when the reading names a candidate, as it does with no
174
- `Transport` or a ranking service that is down. The composition is
175
- `compose(readings)`, a pure function.
81
+ `EditorPort` without `resolveConflict` (`CanvasEditor`): its `apply`,
82
+ `save`, `generate` and `wiringCandidates` (the engine matcher's scored
83
+ output → input pairs between the instances of one module, read with the
84
+ target's scope and the source's as a wire names them); `commands` runs
85
+ a CLI command.
176
86
  - **Every canvas tool's result ends with the current canvas**, written
177
87
  by `renderCanvas`, a pure function of one frame: the instances with
178
88
  their modules, inputs and outputs, the wires, the required inputs not
179
- set, the groups, the diagnostics, and the standing (unsaved,
180
- ungenerated, conflict, refused). An input the module marks sensitive
181
- shows that it is set and never its value.
182
- - **One rendered request per change, and no value the call carries in
183
- what is sent.** `renderRequest(request, values, statement)` replaces
184
- each text in `values` with `VALUE_PLACEHOLDER`: where it stands as a
185
- token of its own, and everywhere when it holds a character a name
186
- cannot; the request is cut at a word so that it and the statement
187
- together fit the request bound. The change tool gives it every form of
188
- the change's own value (`forms`: each literal, and a `var.` value with
189
- and without its prefix), always the placeholder, a form the canvas names
190
- included, since the request's names are read from the rendered words and
191
- the value must never name a candidate; and every other value of the
192
- call that the canvas does not name when the change is ranked (`unnamed`
193
- against `canvasNames`): a name the canvas holds is a canvas fact Lace's
194
- ranking sees among the candidates, and is kept. A statement is a reading
195
- as words, built from the stated slots that name a fact alone (an
196
- operation, a name the canvas holds, a registry module as `author/name`)
197
- and withheld the same way: the model's reading, and its alternative
198
- reading where it gave one. The request is cut to the room the longer
199
- statement leaves. Each rank call for the change carries that one request
200
- and one of those statements: the model's reading for every question the
201
- two systems read, and, where an alternative was given, the alternative
202
- reading's for each of those but `steps`; the API captures each call as
203
- sent. A change whose
204
- request or either statement, with every canvas name withheld, still
205
- holds any withheld text of the call inside a word (`holdsValue`) is not
206
- ranked: no rank call is made for it, the names and the model's reading
207
- decide it, and the result says Lace did not rank it. Its decision is still
208
- reported once the call settles, with no capture on any question and every
209
- value replaced.
210
- - **The change tool's result is a `ChangeResult`**: the text the model
211
- reads, and `applied`, one `ChangeRecord` per applied change:
212
- `{id, target, before, after, revision?, questions, reported}`. `target`
213
- is the instance, or the input of it, the change addressed; `before` and
214
- `after` are that input's binding or that instance's presence;
215
- `revision` is the frame its apply produced; `questions` are the
216
- decision's questions in the order reported, each its kind and its
217
- candidates' ids; `reported` says the decision was reported to Lace, so
218
- its outcomes are. `id` is the decision's.
219
- - **What happened next to a change.** `changeOutcomes(record, frames, own?)`
220
- is a pure function from a `ChangeRecord`, the session's frames after
221
- the change and the revisions the package's own applies produced to the
222
- outcomes reached (`OutcomeReport`), each kind once in the order first
223
- reached, and the record carried to the last frame. One predicate, what
224
- the change decided (the answers of its closed questions as the canvas
225
- holds them: an input's mode, which names the operation that writes it,
226
- and the wire's source, which names the pair; an instance's module; the
227
- target's presence), serves the edit outcomes: `reverted` when what the
228
- change addressed is back to its state before it (an undo, a Reload);
229
- `hand_edited` when a frame the package did not produce changes what the
230
- change decided to another answer than its own (a canvas edit, an edit of
231
- the text), the strongest label; `changed_again` when a later change
232
- through the package does; `saved` and `generated` when a save or a
233
- Generate moved the session while the change still stood as applied. A
234
- new value of an input in the same mode (another literal, another
235
- variable) changes no question: it reaches no outcome, and the change no
236
- longer stands as applied, so no save or Generate after it is read. A
237
- hand edit or a change again names, where the fold can tell, the
238
- decision's question the edit answers and the candidate it names (a
239
- binding in another mode names the operation that writes that mode; a
240
- wire from another source names the connection). A rename, a group or an
241
- ungroup moves an instance without changing it, so the record follows
242
- its instance.
243
- - **The canvas tool set reads the outcomes itself.** With a `transport`
244
- it composes the outcome observer with the session's `source` at
245
- construction: the observer follows the records of each change-tool
246
- result whose decision was reported, reads the session frame by frame
247
- and reports each outcome once. It is the one owner of which frames are
248
- the package's own: the change tool runs every apply through it, the
249
- frames that arrive while an apply is in flight are held until it
250
- resolves, and a held frame at the revision the apply returned is the
251
- package's own (every apply's, reported or not, a change the names
252
- alone settled included); any other is read as usual. `dispose` ends
253
- the reading. With no `transport` the set reads no frames and `dispose`
254
- does nothing.
89
+ set, the groups, the diagnostics (each naming its instance by its
90
+ canvas path, through `@lace-cloud/proto`'s `nodeIdForDiagnostic`), and
91
+ the standing (unsaved, ungenerated, conflict, refused). An input the
92
+ module marks sensitive
93
+ shows that it is set and never its value. The describe tool returns it
94
+ alone; a model reads it before a change when it does not know the names
95
+ the canvas gives.
255
96
  - Save and Generate run only when their own tool is called, through the
256
97
  operations the canvas's own buttons run. No tool asks for a
257
98
  confirmation, and none reaches an operation the canvas confirms. The
@@ -259,14 +100,18 @@ of the tools reads them with no ports at all.
259
100
  the source has delivered the frame that carries the call, so the
260
101
  canvas their result ends with shows the save or the generate; when the
261
102
  session's stream ends first, the result says what the engine did and
262
- that the canvas below is from before it.
103
+ that the canvas below is from before it. A Save or a Generate whose call
104
+ is cancelled before it is sent is not sent, and the result says nothing
105
+ was done; one cancelled after it was sent goes on in the engine, the
106
+ tool stops waiting for it, and the result says so.
263
107
  - **One spelling of a reason.** A refused Save, Generate or apply names
264
108
  the reason it carries as a failure document spells it (`reasonWire`:
265
109
  `unsaved`, `source_refused`, …), or the API's own code when the API
266
110
  decided it, so a model reads one vocabulary from every tool.
267
111
  - The module tools each run one command (`module validate`,
268
112
  `registry list`, `registry describe`) and return its document trimmed
269
- to what a model needs.
113
+ to what a model needs. Each hands the call's `signal` to the command,
114
+ so a cancelled call stops waiting on it.
270
115
  - **A module tool's result is a `ModuleToolResult`**: the text the model
271
116
  reads, and `failure`, the failure document of a command that failed
272
117
  and wrote one (`CommandFailure`, from `CommandExitError.failure`). The
@@ -277,91 +122,95 @@ of the tools reads them with no ports at all.
277
122
  wrote to stderr. The change tool's place reads `registry list` the
278
123
  same way and says the same text when that command fails.
279
124
 
280
- ## Lace's ranking: the service and what it collects
281
-
282
- The package is the client of Lace's ranking service, through the API,
283
- over the host's `Transport`.
284
-
285
- - **A rank call** is `POST /api/v1/candidates/rank` with
286
- `{request, statement, candidates}` (`RankRequest`): the request as
287
- rendered, the statement as rendered, and the question's candidates as
288
- `{id, kind, text}`, one kind per set, `(none)` last in every kind but
289
- `steps` (`NONE_CANDIDATE_ID`: none of the others, in the words of its
290
- kind, ranked like any candidate and never applied). The reply
291
- (`Ranked`) is `{capture_id, head, scores, thresholds}`: the id the API
292
- minted for the question as asked, the head's content hash, the scores
293
- in rank order each with its `rightness`, and the head's thresholds, one
294
- `{from}` per kind a threshold shipped for. A question is read against
295
- the thresholds of the reply it came from, never against a value held
296
- from elsewhere. A 503 (`ranking_unavailable`), a transport that throws
297
- or a body that is not a reply is one failed call: the question is
298
- the model's alone and is reported with no capture.
299
- - **Collection is the service's side effect of being asked.** At the rank
300
- call the API stores the question as asked (the request and statement as
301
- rendered, the candidates as sent, both arms' scores, the head) under
302
- the `capture_id`, keyed to the developer's account. Nothing in it is a
303
- value the tools were given: the package renders before it sends, every
304
- value of the call withheld as above, and a change whose words or
305
- readings still hold one inside a word is not sent. A literal the model
306
- left in `request` instead of passing it in `value` is no value the tools
307
- were given, and is sent as written.
308
- - **The decision is reported once**, when the call settles, for every
309
- change a question of which went to the two systems:
310
- `POST /api/v1/candidates/decisions` with a `DecisionReport`
311
- `{id, surface: 'canvas', questions, applied, asked}`. Per question
312
- (`Question`): its kind, the `capture_id` (null where the words settled
313
- it by name, the rank failed, or the set was ranked in parts), the
314
- model's candidate `chat` (null where its statement named none), the
315
- ranking's pick `clm` with its rightness (null where not ranked, or
316
- ranked in parts), whose answer was taken (`took`:
317
- `named`, `chat` or `clm`) and the candidate the decision holds
318
- (`taken`, null where neither resolved). `applied` is what the change
319
- did in words, every value of the call the canvas did not name when the
320
- change was ranked withheld; null when nothing applied. A change the
321
- names alone settled is reported to nothing: nothing was captured.
322
- - **Each outcome is reported once**, by the canvas tool set's observer, to
323
- `POST /api/v1/candidates/decisions/:id/outcomes` as an `OutcomeReport`
324
- `{event, question?, candidate?}`.
325
- - The API derives each question's label from the outcomes alone; nobody
326
- reviews by default. A report the API refuses or the transport drops is
327
- one failed call: nothing retries it and nothing in the UI says so.
328
-
329
- No rank call carries more than `RANK_CANDIDATES_MAX` (256) candidates, a
330
- request and statement together over `RANK_REQUEST_MAX_CHARS` (4,000
331
- characters) or a candidate's prose over `RANK_CANDIDATE_TEXT_MAX_CHARS`
332
- (2,000), each at most the ranking route's own bound. `renderCandidate`
333
- fits a candidate's prose to its bound, the same facts always alike: names
334
- come first, so what the module or the registry says a thing is is
335
- shortened at a word before any name is dropped, and a name is dropped
336
- whole, from the end of its list, with how many more there are. A decision
337
- over a larger set (a registry of more modules, say) is ranked part by
338
- part, at most 255 real candidates and `(none)` a call, and the parts'
339
- picks are ranked together, so no candidate is left out; a pick made across
340
- parts was never scored against the whole set, so the ranking is never sure
341
- of it, and no one capture holds every candidate of the question, so its
342
- question is reported with no capture and no pick: every candidate a
343
- reported question names is one of the capture it names.
344
-
345
- ## The rows a head trains on
346
-
347
- The row format has one definition, `trainingRows`:
348
- `trainingRows(turn, part)` is one row per question of a turn,
349
- `{request, statement, candidates, label, part, origin, turn, chat}`:
350
- exactly what the question's rank call carried, the id of the right
351
- candidate, the part its caller gives, where the turn came from (`real`, a
352
- developer's call; `synthetic`, the generator), the turn's id shared by every
353
- row of the turn, and the model's candidate for the question (null when it
354
- stated none), which the threshold fit's bar reads. The caller owns the
355
- part, and each row is written once, in it: a real turn's part is
356
- `partOf(turn)`, a pure function of the turn id (`hashFraction`, its FNV-1a
357
- hash): 60% train, 20% calibration, 20% held out, the same part in every
358
- corpus. A synthetic turn's part is the one its generator gives it. No
359
- row holds a value the tools were given: the request and the statement are
360
- the strings the rank call carried, every value the placeholder.
361
-
362
- How rows are generated, reviewed and exported, and how the ranking is
363
- measured, is offline tooling this package does not ship; it is documented
364
- with its source.
125
+ ## The change tool
126
+
127
+ `lace_change_module_canvas` takes
128
+ `{changes: [{operation, instance?, input?, sourceInstance?, output?, targetInstance?, module?, value?}]}`:
129
+ one entry per change, at least one, each stating its `operation` and the
130
+ names it works on as the canvas lists them, and the literal the developer
131
+ gave in `value`. The changes apply in the order given, each resolved
132
+ against the state the one before it left, and each as one `apply` of one
133
+ generated `Action`, whose instance-addressed sub-message carries `scope`,
134
+ the key of the module that owns the instance (`resolveInstance` in
135
+ `@lace-cloud/proto`), and on a wire `source_scope` for the source end.
136
+
137
+ - **The operations**: `place` (a registry module), `connect`,
138
+ `disconnect`, `set` (a literal), `bind` (an input takes its value from
139
+ a variable, `var.<name>`), `clear` (an input is unset), `rename`,
140
+ `delete` and `ungroup`. A `set`, `bind` and `rename` write the literal
141
+ in `value` and never one of the tool's own; a `value` sent with an
142
+ operation that takes none is said in the result to be unused, and so is
143
+ a stated slot the operation does not use. An empty name states
144
+ nothing, in every slot, as an absent one does.
145
+ - **Names, slot by slot.** An instance slot (`instance`,
146
+ `sourceInstance`, `targetInstance`) is named by the instance's canvas
147
+ path (`group.child`) or its own id; `module` as `author/name` or by its
148
+ name; `output` and `input` by the pin's name. A slot resolves in four
149
+ steps: exactly on the first name (the canvas path, the `author/name`),
150
+ exactly on any name, then each again ignoring case, both sides compared
151
+ in one Unicode form (NFC). The first step with any hit decides: one hit
152
+ is the slot's, several are ambiguous, and no later step is tried, so
153
+ `vpc` is the root's `vpc` even where grouped instances have it as their
154
+ own id. A name decided ignoring case is said in the result with the
155
+ spelling the canvas, or for a module the registry, gives it.
156
+ - **A change that names nothing or several things is not applied.** A
157
+ name no step matches, a name that fits several things, or a slot the
158
+ operation needs and the change does not state leaves the change
159
+ unapplied; the result names each such slot and lists its candidates as
160
+ the canvas lists them, at most twelve and how many more, so the model
161
+ can ask the developer or send the change again. The call's other
162
+ changes still run. An input operation is offered the inputs it can act on: a
163
+ `disconnect` the wired ones, a `clear` those that hold a value; an
164
+ `ungroup` is offered the groups.
165
+ - **A connect matches the canvas.** Its two instance slots resolve among
166
+ the same instances, and one that names one instance twice is refused
167
+ with its own reason. One that names no `output` and no `input` is sent
168
+ as `auto_connect`, as the canvas sends a drag of one instance onto
169
+ another: the engine's matcher wires the pairs it chooses, the result
170
+ names them, and the pairs it leaves tied come back for the developer to
171
+ choose between. One that names both pins is a `connect` of them, into
172
+ any input of the target, wired or not: the engine's connect replaces the
173
+ binding, as a pin drag does. A pin that fits nothing or several lists
174
+ the pins the instance offers. One that names a single pin lists the
175
+ pairs the engine's matcher scores for it, best first with their scores,
176
+ from the engine's own read of the two instances (`wiringCandidates`,
177
+ with each end's scope), so a connect across a group's boundary comes
178
+ back with the engine's refusal of that read.
179
+ - **A place** lists the registry with `registry list --axis module
180
+ --limit 500 --query <name>`, the name part of `module`, and resolves
181
+ `module` among what it lists; a truncated listing is said in the result.
182
+ `module` may name a version, `author/name@version`, which is placed in
183
+ place of the version the registry lists; an `@` with no version after it
184
+ is not placed. A module the listing does not
185
+ hold, or a `module` that names no name, points to
186
+ `lace_search_module_registry` rather than listing the registry.
187
+ - **What a result withholds.** The change's `value` is withheld where
188
+ text the package did not write enters a result: the engine's refusal, a
189
+ thrown failure (a command's, a read's, an apply's), the account of a
190
+ session's stream ending, and each name the change stated that the result
191
+ says back. There, each text the value holds, in each form it is written
192
+ in (itself, quoted with JSON's escapes, quoted as Go's `%q` writes it, as
193
+ the engine quotes, and each quoted form's escapes unquoted), matched in
194
+ any case, is replaced by `<value>`: such text may hold the value, and the
195
+ input the value was meant for may be one the module marks sensitive. The
196
+ tool's own sentences and the names the canvas or the registry lists,
197
+ candidates and tied pairs among them, are said as they are. The summary
198
+ of an applied change shows the value it wrote unless the input is
199
+ sensitive: a `set` of a sensitive input says that it was set and never
200
+ what to.
201
+ - **A change whose apply goes unobserved stops the call.** When the
202
+ session's stream ends before the frame that carries an apply, the
203
+ result says the engine answered it and that whether it applied cannot
204
+ be read; no later change is sent, and each says "not run".
205
+ - **A change call its host cancels applies nothing after the
206
+ cancellation.** The change tool checks the call's `signal` before each
207
+ change, before each registry listing or wiring read, and immediately
208
+ before each apply. Once it aborts, nothing further is started, a
209
+ listing or wiring read in progress is no longer waited on, and the
210
+ change in progress and every later one say "not applied. The call was
211
+ cancelled before it applied." An apply already sent is the engine's and
212
+ is not undone; if the engine refuses it, the result gives the engine's
213
+ reason.
365
214
 
366
215
  ## The boundary
367
216