driverkit 0.0.0-stage → 0.1.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/CONTROLS.md +578 -0
- package/README.md +104 -2
- package/dist/agent/backend.d.ts +69 -0
- package/dist/agent/backend.d.ts.map +1 -0
- package/dist/agent/backend.js +130 -0
- package/dist/agent/backend.js.map +1 -0
- package/dist/agent/control.d.ts +148 -0
- package/dist/agent/control.d.ts.map +1 -0
- package/dist/agent/control.js +342 -0
- package/dist/agent/control.js.map +1 -0
- package/dist/agent/index.d.ts +9 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +6 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/loop.d.ts +136 -0
- package/dist/agent/loop.d.ts.map +1 -0
- package/dist/agent/loop.js +824 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/render.d.ts +173 -0
- package/dist/agent/render.d.ts.map +1 -0
- package/dist/agent/render.js +425 -0
- package/dist/agent/render.js.map +1 -0
- package/dist/agent/tools.d.ts +138 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +622 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agent/types.d.ts +566 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +32 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/browser/budget.d.ts +92 -0
- package/dist/browser/budget.d.ts.map +1 -0
- package/dist/browser/budget.js +151 -0
- package/dist/browser/budget.js.map +1 -0
- package/dist/browser/connect.d.ts +368 -0
- package/dist/browser/connect.d.ts.map +1 -0
- package/dist/browser/connect.js +1038 -0
- package/dist/browser/connect.js.map +1 -0
- package/dist/browser/elsewhere.d.ts +89 -0
- package/dist/browser/elsewhere.d.ts.map +1 -0
- package/dist/browser/elsewhere.js +91 -0
- package/dist/browser/elsewhere.js.map +1 -0
- package/dist/browser/frames.d.ts +85 -0
- package/dist/browser/frames.d.ts.map +1 -0
- package/dist/browser/frames.js +11 -0
- package/dist/browser/frames.js.map +1 -0
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +9 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/check/check.d.ts +171 -0
- package/dist/check/check.d.ts.map +1 -0
- package/dist/check/check.js +666 -0
- package/dist/check/check.js.map +1 -0
- package/dist/check/index.d.ts +3 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +2 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/types.d.ts +149 -0
- package/dist/check/types.d.ts.map +1 -0
- package/dist/check/types.js +29 -0
- package/dist/check/types.js.map +1 -0
- package/dist/controls/controls.d.ts +198 -0
- package/dist/controls/controls.d.ts.map +1 -0
- package/dist/controls/controls.js +742 -0
- package/dist/controls/controls.js.map +1 -0
- package/dist/controls/dom.d.ts +108 -0
- package/dist/controls/dom.d.ts.map +1 -0
- package/dist/controls/dom.js +56 -0
- package/dist/controls/dom.js.map +1 -0
- package/dist/controls/index.d.ts +26 -0
- package/dist/controls/index.d.ts.map +1 -0
- package/dist/controls/index.js +23 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/controls/rows.d.ts +66 -0
- package/dist/controls/rows.d.ts.map +1 -0
- package/dist/controls/rows.js +127 -0
- package/dist/controls/rows.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +15 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/registry.d.ts +192 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +2799 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/types.d.ts +2468 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +19 -0
- package/dist/core/types.js.map +1 -0
- package/dist/otel/index.d.ts +122 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +157 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/react/index.d.ts +191 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +547 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/runtime.d.ts +95 -0
- package/dist/react/runtime.d.ts.map +1 -0
- package/dist/react/runtime.js +54 -0
- package/dist/react/runtime.js.map +1 -0
- package/dist/react/store.d.ts +333 -0
- package/dist/react/store.d.ts.map +1 -0
- package/dist/react/store.js +695 -0
- package/dist/react/store.js.map +1 -0
- package/dist/relay/auth.d.ts +244 -0
- package/dist/relay/auth.d.ts.map +1 -0
- package/dist/relay/auth.js +391 -0
- package/dist/relay/auth.js.map +1 -0
- package/dist/relay/frames.d.ts +141 -0
- package/dist/relay/frames.d.ts.map +1 -0
- package/dist/relay/frames.js +20 -0
- package/dist/relay/frames.js.map +1 -0
- package/dist/relay/index.d.ts +8 -0
- package/dist/relay/index.d.ts.map +1 -0
- package/dist/relay/index.js +4 -0
- package/dist/relay/index.js.map +1 -0
- package/dist/relay/relay.d.ts +277 -0
- package/dist/relay/relay.d.ts.map +1 -0
- package/dist/relay/relay.js +1026 -0
- package/dist/relay/relay.js.map +1 -0
- package/dist/relay/serve.d.ts +33 -0
- package/dist/relay/serve.d.ts.map +1 -0
- package/dist/relay/serve.js +86 -0
- package/dist/relay/serve.js.map +1 -0
- package/dist/widget/chat.d.ts +290 -0
- package/dist/widget/chat.d.ts.map +1 -0
- package/dist/widget/chat.js +486 -0
- package/dist/widget/chat.js.map +1 -0
- package/dist/widget/css.d.ts +49 -0
- package/dist/widget/css.d.ts.map +1 -0
- package/dist/widget/css.js +532 -0
- package/dist/widget/css.js.map +1 -0
- package/dist/widget/dom.d.ts +143 -0
- package/dist/widget/dom.d.ts.map +1 -0
- package/dist/widget/dom.js +27 -0
- package/dist/widget/dom.js.map +1 -0
- package/dist/widget/highlight.d.ts +64 -0
- package/dist/widget/highlight.d.ts.map +1 -0
- package/dist/widget/highlight.js +136 -0
- package/dist/widget/highlight.js.map +1 -0
- package/dist/widget/index.d.ts +9 -0
- package/dist/widget/index.d.ts.map +1 -0
- package/dist/widget/index.js +20 -0
- package/dist/widget/index.js.map +1 -0
- package/dist/widget/position.d.ts +166 -0
- package/dist/widget/position.d.ts.map +1 -0
- package/dist/widget/position.js +497 -0
- package/dist/widget/position.js.map +1 -0
- package/dist/widget/settings.d.ts +116 -0
- package/dist/widget/settings.d.ts.map +1 -0
- package/dist/widget/settings.js +117 -0
- package/dist/widget/settings.js.map +1 -0
- package/dist/widget/widget.d.ts +442 -0
- package/dist/widget/widget.d.ts.map +1 -0
- package/dist/widget/widget.js +2005 -0
- package/dist/widget/widget.js.map +1 -0
- package/package.json +153 -4
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { mount, refusal, checkArg, RESERVED_REFUSALS, SIZE_LIMITS, selectionId, REDACTED, ASK, ASK_QUESTION_ARG, DEFAULT_ASK_TIMEOUT_MS, } from "./registry.ts";
|
|
2
|
+
export type { Approval, ApprovalHook, ApprovalPolicy, ApprovalRequest, AskAnswer, AskHook, AskQuestion, ArgSpec, AuditEvent, AuditHook, Budget, BudgetRecord, BudgetState, BudgetStore, CallOptions, Driver, DriverApproval, ElsewhereChannel, ElsewhereNotice, Manifest, MountOptions, FlowSpec, FlowStep, NavigateHook, NavigateTarget, Refusal, RelayRefusal, Report, Result, Row, Scalar, ScreenControl, ScreenSpec, Snapshot, TabFocus, TabInfo, Verb, VerbContext, VerbKind, WireResult, } from "./types.ts";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,iBAAiB,EACjB,WAAW,EAGX,WAAW,EAIX,QAAQ,EAMR,GAAG,EACH,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EACvD,SAAS,EAAE,OAAO,EAAE,WAAW,EAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAC9E,WAAW,EAAE,MAAM,EAAE,cAAc,EACnC,gBAAgB,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EACzD,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAChD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EACvF,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAC3D,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { mount, refusal, checkArg, RESERVED_REFUSALS, SIZE_LIMITS,
|
|
2
|
+
// Exported so an app does not hand-roll the one hash the plan token's
|
|
3
|
+
// strength rests on. See `selectionId` and `Snapshot.selectionId`.
|
|
4
|
+
selectionId,
|
|
5
|
+
// The marker an audit record carries where a `sensitive` argument's value
|
|
6
|
+
// would have been. Exported so a sink, a test or a redaction check can
|
|
7
|
+
// recognise it rather than spell it out and eventually spell it differently.
|
|
8
|
+
REDACTED,
|
|
9
|
+
// The reserved question verb's name and its one argument, and the default
|
|
10
|
+
// deadline on an answer. Exported so a host, a test or an eval harness can
|
|
11
|
+
// recognise the verb without spelling the string again -- and so the 45
|
|
12
|
+
// seconds is one number that `RelayOptions.timeoutMs` can be reasoned
|
|
13
|
+
// against rather than a literal buried in two files. See `MountOptions.ask`.
|
|
14
|
+
ASK, ASK_QUESTION_ARG, DEFAULT_ASK_TIMEOUT_MS, } from "./registry.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,iBAAiB,EACjB,WAAW;AACX,sEAAsE;AACtE,mEAAmE;AACnE,WAAW;AACX,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,QAAQ;AACR,0EAA0E;AAC1E,2EAA2E;AAC3E,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,GAAG,EACH,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,eAAe,CAAC","sourcesContent":["export {\n mount,\n refusal,\n checkArg,\n RESERVED_REFUSALS,\n SIZE_LIMITS,\n // Exported so an app does not hand-roll the one hash the plan token's\n // strength rests on. See `selectionId` and `Snapshot.selectionId`.\n selectionId,\n // The marker an audit record carries where a `sensitive` argument's value\n // would have been. Exported so a sink, a test or a redaction check can\n // recognise it rather than spell it out and eventually spell it differently.\n REDACTED,\n // The reserved question verb's name and its one argument, and the default\n // deadline on an answer. Exported so a host, a test or an eval harness can\n // recognise the verb without spelling the string again -- and so the 45\n // seconds is one number that `RelayOptions.timeoutMs` can be reasoned\n // against rather than a literal buried in two files. See `MountOptions.ask`.\n ASK,\n ASK_QUESTION_ARG,\n DEFAULT_ASK_TIMEOUT_MS,\n} from \"./registry.ts\";\nexport type {\n Approval, ApprovalHook, ApprovalPolicy, ApprovalRequest,\n AskAnswer, AskHook, AskQuestion,\n ArgSpec, AuditEvent, AuditHook, Budget, BudgetRecord, BudgetState, BudgetStore,\n CallOptions, Driver, DriverApproval,\n ElsewhereChannel, ElsewhereNotice, Manifest, MountOptions,\n FlowSpec, FlowStep, NavigateHook, NavigateTarget,\n Refusal, RelayRefusal, Report, Result, Row, Scalar, ScreenControl, ScreenSpec, Snapshot,\n TabFocus, TabInfo, Verb, VerbContext, VerbKind, WireResult,\n} from \"./types.ts\";\n"]}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* driverkit/core — the registry.
|
|
3
|
+
*
|
|
4
|
+
* One function, `mount`, and one invariant: every way of driving the app goes
|
|
5
|
+
* through `call`. The in-page chatbot calls it directly, the relay calls it
|
|
6
|
+
* after a websocket frame arrives, a test calls it with no transport at all.
|
|
7
|
+
* There is deliberately no second path, because a second path is a second set
|
|
8
|
+
* of validation and staleness rules and one of the two will be the wrong one.
|
|
9
|
+
*
|
|
10
|
+
* The core renders nothing and imports nothing. No React, no model SDK, no
|
|
11
|
+
* websocket. Those live in sibling packages so an app that only wants to be
|
|
12
|
+
* drivable from outside does not pull a UI into its bundle.
|
|
13
|
+
*/
|
|
14
|
+
import type { ArgSpec, Driver, MountOptions, Refusal, Scalar } from "./types.ts";
|
|
15
|
+
/**
|
|
16
|
+
* The slugs an app may not use as a refusal of its own, or as a verb name.
|
|
17
|
+
*
|
|
18
|
+
* PROTOCOL.md's reserved list, in code, because a list that lives only in prose
|
|
19
|
+
* is a list nothing checks. Seven come from the core itself, three from the
|
|
20
|
+
* relay and three from the approval gate, and they have one property in common:
|
|
21
|
+
* each says something about WHERE a call stopped, not about the app's rules. An
|
|
22
|
+
* app that refuses with `timeout` has taken away an agent's only way to tell
|
|
23
|
+
* "the app said no, phrase it differently" from "your call never landed,
|
|
24
|
+
* reconnect or pick another tab" — and an agent that cannot tell those apart
|
|
25
|
+
* will retry a commit that may already have run.
|
|
26
|
+
*
|
|
27
|
+
* `wrong-screen` is the newest, and the only one that was ever an app's own. An
|
|
28
|
+
* app with six screens wrote the check by hand and had to invent a word for it;
|
|
29
|
+
* the next app would have picked `not-on-this-screen`, and an agent that had
|
|
30
|
+
* learned one would not recognise the other. The slug says where a call
|
|
31
|
+
* stopped — you are not there — so it belongs here with the rest, and
|
|
32
|
+
* `Verb.screen` with `CallOptions.screen` is how an app now gets the check for
|
|
33
|
+
* nothing. An app that was refusing it by hand is told so at mount; see below.
|
|
34
|
+
*/
|
|
35
|
+
export declare const RESERVED_REFUSALS: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* What stands in for a `sensitive` argument's value in an audit record.
|
|
38
|
+
*
|
|
39
|
+
* Fixed rather than configurable, and exported rather than private. A marker
|
|
40
|
+
* an app can change is a marker that the person reading somebody else's log
|
|
41
|
+
* cannot recognise, and a marker nobody can import is one every test and every
|
|
42
|
+
* sink spells out by hand and eventually spells differently. See
|
|
43
|
+
* `ArgSpec.sensitive`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const REDACTED = "[redacted]";
|
|
46
|
+
/**
|
|
47
|
+
* The reserved question verb.
|
|
48
|
+
*
|
|
49
|
+
* Reserved in the same WEAK sense `goto` is, and the same rule decides it: an
|
|
50
|
+
* app that declares its own verb named `ask` keeps it and the core adds
|
|
51
|
+
* nothing, because the app's meaning wins over ours. What "reserved" buys is
|
|
52
|
+
* one name instead of one per app — `ask`, `ask-user`, `clarify`, `check-with-
|
|
53
|
+
* me`, none of which the next agent recognises — which is the argument that
|
|
54
|
+
* made `goto` reserved and `wrong-screen` a reserved refusal.
|
|
55
|
+
*
|
|
56
|
+
* It is NOT in `RESERVED_REFUSALS`, so a verb may be named this. The three
|
|
57
|
+
* slugs the mechanism added are, for the usual reason: an app that refused
|
|
58
|
+
* `nobody-to-ask` on a business rule would be telling an agent to stop asking
|
|
59
|
+
* for the rest of a run over something it could have phrased differently.
|
|
60
|
+
*/
|
|
61
|
+
declare const ASK = "ask";
|
|
62
|
+
/** The name of `ask`'s one argument. Spelled once: it is named in the schema,
|
|
63
|
+
* in two refusals and in the record. */
|
|
64
|
+
declare const ASK_QUESTION_ARG = "question";
|
|
65
|
+
/**
|
|
66
|
+
* How long a question waits for an answer when the app did not say.
|
|
67
|
+
*
|
|
68
|
+
* **45 seconds, and the number is chosen against the relay's 60.** See
|
|
69
|
+
* `MountOptions.askTimeout`: a question that outlives the transport's deadline
|
|
70
|
+
* converts "nobody answered", which is a fact the agent can act on, into the
|
|
71
|
+
* relay's `timeout`, which PROTOCOL.md defines as outcome unknown. Of the two
|
|
72
|
+
* errors, firing late is the expensive one here — the opposite way round from
|
|
73
|
+
* `approvalTimeout`, which waits forever because a lapsed approval DENIES a
|
|
74
|
+
* commit and a lapsed question denies nothing.
|
|
75
|
+
*
|
|
76
|
+
* Exported so the two numbers can be reasoned about together rather than being
|
|
77
|
+
* two literals in two packages.
|
|
78
|
+
*/
|
|
79
|
+
declare const DEFAULT_ASK_TIMEOUT_MS = 45000;
|
|
80
|
+
export { ASK, ASK_QUESTION_ARG, DEFAULT_ASK_TIMEOUT_MS };
|
|
81
|
+
/**
|
|
82
|
+
* The documented size budgets, in characters.
|
|
83
|
+
*
|
|
84
|
+
* NOT arbitrary, and not a limit for its own sake. Apple's app skills ship
|
|
85
|
+
* with exactly this pair — a description of at most 1024 characters on one
|
|
86
|
+
* line, and a body of at most 10,000 — and a budget is worth copying because
|
|
87
|
+
* of what the absence of one does: `instructions` had no documented bound, so
|
|
88
|
+
* the honest answer to "how much may I write?" was "nobody has said", and the
|
|
89
|
+
* field drifted toward being a README. Everything here is in the cached prefix
|
|
90
|
+
* of every session of every user, which is exactly why it is cheap and exactly
|
|
91
|
+
* why it is tempting: the cost is real, it is just paid once and invisibly, so
|
|
92
|
+
* a number is the only thing that makes anybody weigh it. The second cost is
|
|
93
|
+
* the one a budget really guards: text in the prefix competes with the verb
|
|
94
|
+
* list for a model's attention, and a thousand words about the app is a
|
|
95
|
+
* thousand words read instead of the tool that commits data.
|
|
96
|
+
*
|
|
97
|
+
* `describe` is one line because it is a label a model chooses on, not a
|
|
98
|
+
* paragraph it reasons from — selection between flows is made on the
|
|
99
|
+
* description and not on the individual steps, which is the finding this whole
|
|
100
|
+
* field is shaped by.
|
|
101
|
+
*
|
|
102
|
+
* New fields throw when they exceed these; `instructions`, which predates
|
|
103
|
+
* having a budget at all, warns. See `mount`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const SIZE_LIMITS: {
|
|
106
|
+
/** `FlowSpec.describe` and `ScreenSpec.describe`: one line, at most this.
|
|
107
|
+
* Also `FlowStep.skipWhen`, which is a one-line condition for the same
|
|
108
|
+
* reason — it is read beside the step, not reasoned from. */
|
|
109
|
+
readonly describe: 1024;
|
|
110
|
+
/** A whole flow's steps — every `section`, `verb`, `hint` and `skipWhen`
|
|
111
|
+
* together. Everything rendered into the prefix counts, so moving a sentence
|
|
112
|
+
* out of a `hint` and into a `skipWhen` buys no room. */
|
|
113
|
+
readonly body: 10000;
|
|
114
|
+
/** `MountOptions.instructions`. Warned about rather than refused. */
|
|
115
|
+
readonly instructions: 10000;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* An identity for a set of row ids, for `Snapshot.selectionId`.
|
|
119
|
+
*
|
|
120
|
+
* Exported, and that is the point of it existing rather than being left to
|
|
121
|
+
* each app. The core mints the plan token so an app cannot get the token's
|
|
122
|
+
* binding wrong; this is the other half of the same argument, because an app
|
|
123
|
+
* hand-rolling the identity can get it wrong in exactly the way that matters —
|
|
124
|
+
* a hash over `selected.join(",")` is order-DEPENDENT, so clicking two rows in
|
|
125
|
+
* the other order reads as a different selection and every commit is refused,
|
|
126
|
+
* and a hash over the count alone reads as the same selection when one row has
|
|
127
|
+
* been swapped for another, which is the failure the identity exists to catch.
|
|
128
|
+
*
|
|
129
|
+
* Order-independent, so the same membership gives the same string however it
|
|
130
|
+
* was built. The size is folded in as well, so an empty selection is distinct
|
|
131
|
+
* from one whose hashes happen to cancel.
|
|
132
|
+
*
|
|
133
|
+
* One pass over the ids, which is cheap for the hundreds an on-screen selection
|
|
134
|
+
* holds. An app whose selection runs to tens of thousands should keep a running
|
|
135
|
+
* value instead and not call this inside `visible()`, which runs on every call.
|
|
136
|
+
*/
|
|
137
|
+
export declare function selectionId(ids: Iterable<string>): string;
|
|
138
|
+
/** Build the value a verb returns to decline. Exported because app code
|
|
139
|
+
* sometimes wants to refuse from a helper rather than inline. */
|
|
140
|
+
export declare function refusal(reason: string, hint?: string): Refusal;
|
|
141
|
+
/**
|
|
142
|
+
* Validate one argument against its spec.
|
|
143
|
+
*
|
|
144
|
+
* Returns a reason string, or null when the value is acceptable. Kept separate
|
|
145
|
+
* from `call` so the failure messages can be unit-tested without mounting
|
|
146
|
+
* anything, and so they read the same whether the caller was a chatbot or a
|
|
147
|
+
* relay frame — a model that learns one phrasing of "bad argument" should not
|
|
148
|
+
* meet a different phrasing depending on how it connected.
|
|
149
|
+
*/
|
|
150
|
+
export declare function checkArg(name: string, spec: ArgSpec, value: Scalar | undefined): string | null;
|
|
151
|
+
/**
|
|
152
|
+
* Make an app drivable.
|
|
153
|
+
*
|
|
154
|
+
* ```ts
|
|
155
|
+
* const driver = mount({
|
|
156
|
+
* app: "Contacts",
|
|
157
|
+
* verbs: [
|
|
158
|
+
* { name: "open", kind: "read", describe: "open one contact",
|
|
159
|
+
* args: { id: { type: "string", describe: "contact id" } },
|
|
160
|
+
* run: ({ id }) => router.push(`/contacts/${id}`) },
|
|
161
|
+
*
|
|
162
|
+
* // A describe/commit pair. The predicate is resolved inside the app,
|
|
163
|
+
* // where the rows already are, so selecting a thousand contacts is one
|
|
164
|
+
* // call and not a thousand -- and the count comes back before anything
|
|
165
|
+
* // irreversible happens.
|
|
166
|
+
* { name: "select-where", kind: "describe", describe: "select every contact matching a filter",
|
|
167
|
+
* args: { where: { type: "string", describe: "e.g. company=Acme" } },
|
|
168
|
+
* run: ({ where }) => store.select(where) },
|
|
169
|
+
* // `consumes` is the half that makes the count a guarantee rather than
|
|
170
|
+
* // advice: this cannot be called bare, only with the `plan` token the
|
|
171
|
+
* // describe above handed back, so the set it touches is provably the set
|
|
172
|
+
* // that was counted. See `Verb.consumes`.
|
|
173
|
+
* { name: "accept-selected", kind: "commit", consumes: "plan",
|
|
174
|
+
* describe: "accept the current selection",
|
|
175
|
+
* refuses: ["nothing-selected"],
|
|
176
|
+
* run: (_, ctx) => store.selected.length ? api.accept(store.selected)
|
|
177
|
+
* : ctx.refuse("nothing-selected") },
|
|
178
|
+
* ],
|
|
179
|
+
* visible: () => ({ where: "contacts", rev: store.rev, rows: store.onScreen(),
|
|
180
|
+
* selectionId: selectionId(store.selected) }),
|
|
181
|
+
* });
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* Nothing above is specific to a framework or a kind of app. `run` bodies call
|
|
185
|
+
* whatever the app already has -- a store action, an API client, or, in an app
|
|
186
|
+
* with neither, a click on a button the author marked themselves. That last
|
|
187
|
+
* case is four lines the app writes -- the README shows them -- and the
|
|
188
|
+
* library ships no reader for it, because a reader is a guess at a data shape
|
|
189
|
+
* and guessing shapes is the thing this library exists not to do.
|
|
190
|
+
*/
|
|
191
|
+
export declare function mount(options: MountOptions): Driver;
|
|
192
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAIV,OAAO,EAKP,MAAM,EAKN,YAAY,EACZ,OAAO,EAGP,MAAM,EAKP,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EA6G9C,CAAC;AAoFF;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,eAAe,CAAC;AAyGrC;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,GAAG,QAAQ,CAAC;AAElB;yCACyC;AACzC,QAAA,MAAM,gBAAgB,aAAa,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,sBAAsB,QAAS,CAAC;AAEtC,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,CAAC;AA0CzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,WAAW;IACtB;;kEAE8D;;IAE9D;;8DAE0D;;IAE1D,qEAAqE;;CAE7D,CAAC;AAoDX;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAYzD;AAED;kEACkE;AAClE,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAE9D;AAMD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAc9F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAq0EnD"}
|