@lace-cloud/chat-core 0.20.0 → 0.21.1
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 +118 -333
- package/dist/index.cjs +508 -1478
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -214
- package/dist/index.d.ts +6 -214
- package/dist/index.mjs +502 -1461
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -9
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:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
and this package gives it the contract a tool is
|
|
8
|
-
tool sets for a module's canvas
|
|
9
|
-
|
|
10
|
-
|
|
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.
|
|
@@ -48,43 +47,28 @@ registry.getHandler(name); // what the host runs when the model calls one
|
|
|
48
47
|
|
|
49
48
|
## The ports a host fills
|
|
50
49
|
|
|
51
|
-
Capability is a port's presence. The
|
|
52
|
-
(`@lace-cloud/canvas/engine`); `openEngineSession` and
|
|
53
|
-
|
|
54
|
-
own is `Transport`: one POST to Lace's API under `/api/v1/candidates/*`,
|
|
55
|
-
with the developer's credential attached by the host per request. The
|
|
56
|
-
package never sees a credential. A host with none supplies no
|
|
57
|
-
`Transport`, and the tools then compose the model's reading alone and
|
|
58
|
-
report nothing. A host reads the credential per request, so a request it
|
|
59
|
-
finds none for (the developer signed out) it answers `{carried: false}`: it
|
|
60
|
-
carried nothing, and the change call that request was for composes from
|
|
61
|
-
then on exactly as with no `Transport` (below). Otherwise it answers with
|
|
62
|
-
Lace's `{status, body}` (`Answered`). Timing is the package's: each
|
|
63
|
-
request's `init` carries a `signal` (`AbortSignal`) the package aborts
|
|
64
|
-
when it gives the request up, and a host hands it to its request and adds
|
|
65
|
-
no timer of its own.
|
|
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.
|
|
66
53
|
|
|
67
54
|
```ts
|
|
68
55
|
import { canvasTools, createToolRegistry, moduleTools } from '@lace-cloud/chat-core';
|
|
69
56
|
|
|
70
57
|
const registry = createToolRegistry();
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
for (const tool of [
|
|
59
|
+
...canvasTools({ source, editor, commands }), // one authoring session
|
|
60
|
+
...moduleTools({ commands }),
|
|
61
|
+
]) {
|
|
73
62
|
registry.register(tool.schema, tool.handler);
|
|
74
63
|
}
|
|
75
|
-
|
|
76
|
-
// When the host drops the tools or the session closes:
|
|
77
|
-
canvas.dispose();
|
|
78
64
|
```
|
|
79
65
|
|
|
80
66
|
That is the whole of a host's composition. `canvasTools` returns its four
|
|
81
|
-
registrations, in the order below
|
|
82
|
-
the set reads the session's frames itself, for what happened next to each
|
|
83
|
-
change it reported, from its construction until `dispose`.
|
|
67
|
+
registrations as a plain tuple, in the order below; `moduleTools` its three.
|
|
84
68
|
|
|
85
69
|
| Tool set | Ports | Schemas | Tools |
|
|
86
70
|
|---|---|---|---|
|
|
87
|
-
| `canvasTools` | `source`, `editor`, `commands
|
|
71
|
+
| `canvasTools` | `source`, `editor`, `commands` | `canvasToolSchemas` | `lace_change_module_canvas`, `lace_describe_module_canvas`, `lace_save_module_canvas`, `lace_generate_module_terraform` |
|
|
88
72
|
| `moduleTools` | `commands` | `moduleToolSchemas` | `lace_validate_module_terraform`, `lace_search_module_registry`, `lace_describe_registry_module` |
|
|
89
73
|
|
|
90
74
|
Each set's schemas are data beside its constructor (`canvasToolSchemas`,
|
|
@@ -94,179 +78,21 @@ constructor registers exactly those, so a host that generates a manifest
|
|
|
94
78
|
of the tools reads them with no ports at all.
|
|
95
79
|
|
|
96
80
|
- `source` is the session's frames; `editor` is the session mapping's
|
|
97
|
-
`EditorPort` without `resolveConflict
|
|
98
|
-
`generate` and `wiringCandidates` (the engine matcher's scored
|
|
99
|
-
output → input pairs
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
`{changes: [{request, value?, modelReading, alternativeReading?}]}`:
|
|
103
|
-
`request` is one change in the developer's own words and never a
|
|
104
|
-
literal, `value` the literal the developer gave for it (the tool selects
|
|
105
|
-
and never writes a value of its own), one change and one value per
|
|
106
|
-
entry, `modelReading` the model's own reading of the change, required
|
|
107
|
-
on every call (its operation, and the names the developer gave as the
|
|
108
|
-
canvas lists them, never a value), and `alternativeReading` its other
|
|
109
|
-
reading of the words, where the words bear one. For each change the
|
|
110
|
-
tool enumerates what the canvas offers for every decision the change
|
|
111
|
-
needs (which operation, which instance, which input, which registry
|
|
112
|
-
module, which output → input pair) and resolves each in order: the one
|
|
113
|
-
candidate the request names exactly, the one it names when case is
|
|
114
|
-
ignored, otherwise the two systems. Each change is one `apply` of one
|
|
115
|
-
generated `Action`, whose instance-addressed sub-message carries
|
|
116
|
-
`scope`, the key of the module that owns the instance
|
|
117
|
-
(`resolveInstance` in `@lace-cloud/proto`), and on a `connect`
|
|
118
|
-
`source_scope` for the source end; the changes apply in the order
|
|
119
|
-
given, each resolved against the state the one before it left.
|
|
120
|
-
- **The operations** a change can be: `place` (a registry module, from
|
|
121
|
-
`registry list --axis module --limit 500`, narrowed by `--query` when
|
|
122
|
-
the request refers to a module as `author/name`; a truncated listing
|
|
123
|
-
is said in the result), `connect` (the pair picked among every output
|
|
124
|
-
of the source into every input of the target no wire feeds, each
|
|
125
|
-
candidate carrying the engine matcher's score for it where the matcher
|
|
126
|
-
scores it), `disconnect`, `set` (a literal), `bind` (an
|
|
127
|
-
input takes its value from a variable, `var.<name>`), `clear` (an
|
|
128
|
-
input is unset), `rename`, `delete` and `ungroup`. Each is one row of
|
|
129
|
-
`OPERATIONS`.
|
|
130
|
-
- **The longest span names.** A single word names a candidate only
|
|
131
|
-
where no other candidate's id, prose or references cover a longer run
|
|
132
|
-
of the request's words around it: in "store the orders database admin
|
|
133
|
-
password", `admin` is a word of the database's admin password (its
|
|
134
|
-
input's description), not the instance `admin`, so the instance goes
|
|
135
|
-
to the two systems. Function words ("the", "to", "in", …) name nothing: a run
|
|
136
|
-
holds them whoever covers them and a span does not count them, so in
|
|
137
|
-
"upgrade the cluster to Kubernetes" `cluster` names the instance
|
|
138
|
-
`cluster`, though a node group's description covers "the cluster to".
|
|
139
|
-
An instance's prose holds its inputs and outputs with what the module
|
|
140
|
-
says each is. A dotted or slashed reference is never outspanned.
|
|
141
|
-
- **An entry is one change.** A decision fills one slot of a change, so
|
|
142
|
-
words that name more of its candidates than that, each by a name of its
|
|
143
|
-
own ("delete net and delete db_replica"), say the entry holds
|
|
144
|
-
several: the candidate the model's reading names among them, else the
|
|
145
|
-
first named, is applied, and the result says the entry held more and
|
|
146
|
-
names what nothing was applied for, with no rank call. Where the names
|
|
147
|
-
cannot tell (a name two candidates share, or one named candidate inside
|
|
148
|
-
another) and the two systems read any decision of the entry, Lace's
|
|
149
|
-
ranking also reads whether the entry is one change or several
|
|
150
|
-
(`steps`), under the model's reading alone; the model's answer is `one`
|
|
151
|
-
by construction, since the tool asks one entry per change. An entry read
|
|
152
|
-
as several has the change read applied, and the result says the entry
|
|
153
|
-
held more. Either way it asks for the rest, one entry per change.
|
|
154
|
-
`steps` decides only what the result says; it never stops the change,
|
|
155
|
-
and it is never ranked under the alternative reading, so it never asks.
|
|
156
|
-
A `value` sent with an operation that
|
|
157
|
-
takes none (`place`, `connect`, `disconnect`, `clear`, `delete`,
|
|
158
|
-
`ungroup`) is said in the result to be unused.
|
|
159
|
-
- **The composition.** Per question the names leave open, two readings:
|
|
160
|
-
the model's answer is the candidate its stated slot names (none when it
|
|
161
|
-
states no slot of the question), and Lace's is its ranking's pick with
|
|
162
|
-
a rightness, the measured probability of being right. The answer is
|
|
163
|
-
Lace's where the ranking is sure (`sure`: the pick's rightness reaches
|
|
164
|
-
the threshold the reply carries for the kind, a reply with no threshold
|
|
165
|
-
for the kind being sure of nothing, and `(none)` ranked first never
|
|
166
|
-
sure), the model's own otherwise. The operation is Lace's only when the
|
|
167
|
-
ranking was sure of it, of every question asked under it, and the
|
|
168
|
-
change resolves under it. Where the model stated another operation, this
|
|
169
|
-
move rule is part of planning: a question under Lace's operation that
|
|
170
|
-
falls to the model (answered or not), or a change that does not resolve
|
|
171
|
-
under it (the canvas offers nothing for a question, the listing fails,
|
|
172
|
-
the value it needs is missing), means the operation is the model's, and
|
|
173
|
-
the change is resolved again under it; only that outcome is the
|
|
174
|
-
change's, and the result says why Lace's operation did not stand.
|
|
175
|
-
Where the ranking is sure and the reading named another candidate,
|
|
176
|
-
Lace's answer stands and the result says both, with a line for the
|
|
177
|
-
model to pass on: the decision is graded by what the developer does
|
|
178
|
-
next, not withheld. A change neither system resolves
|
|
179
|
-
is not applied, and the result names the part and its candidates,
|
|
180
|
-
asking for the reading to name one. Where the model gave an alternative
|
|
181
|
-
reading and the ranking is sure of a different answer under it,
|
|
182
|
-
nothing is applied and both decisions come back for the model to ask
|
|
183
|
-
the developer. Until a kind's threshold ships, the ranking is sure of
|
|
184
|
-
nothing of that kind and every question is the model's: a change then
|
|
185
|
-
applies exactly when the reading names a candidate, as it does with no
|
|
186
|
-
`Transport` or a ranking service that is down. The composition is
|
|
187
|
-
`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.
|
|
188
86
|
- **Every canvas tool's result ends with the current canvas**, written
|
|
189
87
|
by `renderCanvas`, a pure function of one frame: the instances with
|
|
190
88
|
their modules, inputs and outputs, the wires, the required inputs not
|
|
191
|
-
set, the groups, the diagnostics
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
cannot; the request is cut at a word so that it and the statement
|
|
199
|
-
together fit the request bound. The change tool gives it every form of
|
|
200
|
-
the change's own value (`forms`: each literal, and a `var.` value with
|
|
201
|
-
and without its prefix), always the placeholder, a form the canvas names
|
|
202
|
-
included, since the request's names are read from the rendered words and
|
|
203
|
-
the value must never name a candidate; and every other value of the
|
|
204
|
-
call that the canvas does not name when the change is ranked (`unnamed`
|
|
205
|
-
against `canvasNames`): a name the canvas holds is a canvas fact Lace's
|
|
206
|
-
ranking sees among the candidates, and is kept. A statement is a reading
|
|
207
|
-
as words, built from the stated slots that name a fact alone (an
|
|
208
|
-
operation, a name the canvas holds, a registry module as `author/name`)
|
|
209
|
-
and withheld the same way: the model's reading, and its alternative
|
|
210
|
-
reading where it gave one. The request is cut to the room the longer
|
|
211
|
-
statement leaves. Each rank call for the change carries that one request
|
|
212
|
-
and one of those statements: the model's reading for every question the
|
|
213
|
-
two systems read, and, where an alternative was given, the alternative
|
|
214
|
-
reading's for each of those but `steps`; the API captures each call as
|
|
215
|
-
sent. A change whose
|
|
216
|
-
request or either statement, with every canvas name withheld, still
|
|
217
|
-
holds any withheld text of the call inside a word (`holdsValue`) is not
|
|
218
|
-
ranked: no rank call is made for it, the names and the model's reading
|
|
219
|
-
decide it, and the result says Lace did not rank it. Its decision is still
|
|
220
|
-
reported once the call settles, with no capture on any question and every
|
|
221
|
-
value replaced.
|
|
222
|
-
- **The change tool's result is a `ChangeResult`**: the text the model
|
|
223
|
-
reads, and `applied`, one `ChangeRecord` per applied change:
|
|
224
|
-
`{id, target, before, after, revision?, questions, reported}`. `target`
|
|
225
|
-
is the instance, or the input of it, the change addressed; `before` and
|
|
226
|
-
`after` are that input's binding or that instance's presence;
|
|
227
|
-
`revision` is the frame its apply produced; `questions` are the
|
|
228
|
-
decision's questions in the order reported, each its kind and its
|
|
229
|
-
candidates' ids; `reported` says its decision report was sent, so its
|
|
230
|
-
outcomes are read: it is false where a request of the change call Lace
|
|
231
|
-
did not answer had already ended its requests, and true for a report
|
|
232
|
-
sent, settled or not, a cancelled call's included. `id` is the
|
|
233
|
-
decision's.
|
|
234
|
-
- **What happened next to a change.** `changeOutcomes(record, frames, own?)`
|
|
235
|
-
is a pure function from a `ChangeRecord`, the session's frames after
|
|
236
|
-
the change and the revisions the package's own applies produced to the
|
|
237
|
-
outcomes reached (`OutcomeReport`), each kind once in the order first
|
|
238
|
-
reached, and the record carried to the last frame. One predicate, what
|
|
239
|
-
the change decided (the answers of its closed questions as the canvas
|
|
240
|
-
holds them: an input's mode, which names the operation that writes it,
|
|
241
|
-
and the wire's source, which names the pair; an instance's module; the
|
|
242
|
-
target's presence), serves the edit outcomes: `reverted` when what the
|
|
243
|
-
change addressed is back to its state before it (an undo, a Reload);
|
|
244
|
-
`hand_edited` when a frame the package did not produce changes what the
|
|
245
|
-
change decided to another answer than its own (a canvas edit, an edit of
|
|
246
|
-
the text), the strongest label; `changed_again` when a later change
|
|
247
|
-
through the package does; `saved` and `generated` when a save or a
|
|
248
|
-
Generate moved the session while the change still stood as applied. A
|
|
249
|
-
new value of an input in the same mode (another literal, another
|
|
250
|
-
variable) changes no question: it reaches no outcome, and the change no
|
|
251
|
-
longer stands as applied, so no save or Generate after it is read. A
|
|
252
|
-
hand edit or a change again names, where the fold can tell, the
|
|
253
|
-
decision's question the edit answers and the candidate it names (a
|
|
254
|
-
binding in another mode names the operation that writes that mode; a
|
|
255
|
-
wire from another source names the connection). A rename, a group or an
|
|
256
|
-
ungroup moves an instance without changing it, so the record follows
|
|
257
|
-
its instance.
|
|
258
|
-
- **The canvas tool set reads the outcomes itself.** With a `transport`
|
|
259
|
-
it composes the outcome observer with the session's `source` at
|
|
260
|
-
construction: the observer follows the records of each change-tool
|
|
261
|
-
result whose decision was reported, reads the session frame by frame
|
|
262
|
-
and reports each outcome once. It is the one owner of which frames are
|
|
263
|
-
the package's own: the change tool runs every apply through it, the
|
|
264
|
-
frames that arrive while an apply is in flight are held until it
|
|
265
|
-
resolves, and a held frame at the revision the apply returned is the
|
|
266
|
-
package's own (every apply's, reported or not, a change the names
|
|
267
|
-
alone settled included); any other is read as usual. `dispose` ends
|
|
268
|
-
the reading. With no `transport` the set reads no frames and `dispose`
|
|
269
|
-
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.
|
|
270
96
|
- Save and Generate run only when their own tool is called, through the
|
|
271
97
|
operations the canvas's own buttons run. No tool asks for a
|
|
272
98
|
confirmation, and none reaches an operation the canvas confirms. The
|
|
@@ -278,19 +104,6 @@ of the tools reads them with no ports at all.
|
|
|
278
104
|
is cancelled before it is sent is not sent, and the result says nothing
|
|
279
105
|
was done; one cancelled after it was sent goes on in the engine, the
|
|
280
106
|
tool stops waiting for it, and the result says so.
|
|
281
|
-
- **A change call its host cancels applies nothing after the
|
|
282
|
-
cancellation.** The change tool checks the call's `signal` before each
|
|
283
|
-
change, before each decision, before each registry listing or wiring
|
|
284
|
-
read, and immediately before each apply. Once it aborts, nothing further
|
|
285
|
-
is started: a rank in flight is given up and its request aborted, a
|
|
286
|
-
listing or wiring read in progress is no longer waited on, and the
|
|
287
|
-
change in progress and every later one say "not applied. The call was
|
|
288
|
-
cancelled before it applied." An apply already sent is the engine's and
|
|
289
|
-
is not undone. If it stands, its decision is still reported, bounded,
|
|
290
|
-
though the call no longer waits on it, and its record says it was
|
|
291
|
-
reported, so what the developer does next to it is read. If the engine
|
|
292
|
-
refuses it after the cancel, the result gives the engine's reason, and
|
|
293
|
-
like every change the call did not apply, it is not reported.
|
|
294
107
|
- **One spelling of a reason.** A refused Save, Generate or apply names
|
|
295
108
|
the reason it carries as a failure document spells it (`reasonWire`:
|
|
296
109
|
`unsaved`, `source_refused`, …), or the API's own code when the API
|
|
@@ -309,123 +122,95 @@ of the tools reads them with no ports at all.
|
|
|
309
122
|
wrote to stderr. The change tool's place reads `registry list` the
|
|
310
123
|
same way and says the same text when that command fails.
|
|
311
124
|
|
|
312
|
-
##
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
a
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
the
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
names
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
`
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
`
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
over a larger set (a registry of more modules, say) is ranked part by
|
|
402
|
-
part, at most 255 real candidates and `(none)` a call, and the parts'
|
|
403
|
-
picks are ranked together, so no candidate is left out; a pick made across
|
|
404
|
-
parts was never scored against the whole set, so the ranking is never sure
|
|
405
|
-
of it, and no one capture holds every candidate of the question, so its
|
|
406
|
-
question is reported with no capture and no pick: every candidate a
|
|
407
|
-
reported question names is one of the capture it names.
|
|
408
|
-
|
|
409
|
-
## The rows a head trains on
|
|
410
|
-
|
|
411
|
-
The row format has one definition, `trainingRows`:
|
|
412
|
-
`trainingRows(turn, part)` is one row per question of a turn,
|
|
413
|
-
`{request, statement, candidates, label, part, origin, turn, chat}`:
|
|
414
|
-
exactly what the question's rank call carried, the id of the right
|
|
415
|
-
candidate, the part its caller gives, where the turn came from (`real`, a
|
|
416
|
-
developer's call; `synthetic`, the generator), the turn's id shared by every
|
|
417
|
-
row of the turn, and the model's candidate for the question (null when it
|
|
418
|
-
stated none), which the threshold fit's bar reads. The caller owns the
|
|
419
|
-
part, and each row is written once, in it: a real turn's part is
|
|
420
|
-
`partOf(turn)`, a pure function of the turn id (`hashFraction`, its FNV-1a
|
|
421
|
-
hash): 60% train, 20% calibration, 20% held out, the same part in every
|
|
422
|
-
corpus. A synthetic turn's part is the one its generator gives it. No
|
|
423
|
-
row holds a value the tools were given: the request and the statement are
|
|
424
|
-
the strings the rank call carried, every value the placeholder.
|
|
425
|
-
|
|
426
|
-
How rows are generated, reviewed and exported, and how the ranking is
|
|
427
|
-
measured, is offline tooling this package does not ship; it is documented
|
|
428
|
-
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.
|
|
429
214
|
|
|
430
215
|
## The boundary
|
|
431
216
|
|