@pinecall/dot 0.0.0-stage → 0.11.21

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.
Files changed (115) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +316 -2
  3. package/dist/agent/index.d.ts +4 -0
  4. package/dist/agent/index.d.ts.map +1 -0
  5. package/dist/agent/index.js +3 -0
  6. package/dist/agent/index.js.map +1 -0
  7. package/dist/agent/tutor.d.ts +67 -0
  8. package/dist/agent/tutor.d.ts.map +1 -0
  9. package/dist/agent/tutor.js +351 -0
  10. package/dist/agent/tutor.js.map +1 -0
  11. package/dist/face/draw.d.ts +43 -0
  12. package/dist/face/draw.d.ts.map +1 -0
  13. package/dist/face/draw.js +74 -0
  14. package/dist/face/draw.js.map +1 -0
  15. package/dist/face/ear.d.ts +23 -0
  16. package/dist/face/ear.d.ts.map +1 -0
  17. package/dist/face/ear.js +111 -0
  18. package/dist/face/ear.js.map +1 -0
  19. package/dist/face/index.d.ts +23 -0
  20. package/dist/face/index.d.ts.map +1 -0
  21. package/dist/face/index.js +138 -0
  22. package/dist/face/index.js.map +1 -0
  23. package/dist/face/motion.d.ts +25 -0
  24. package/dist/face/motion.d.ts.map +1 -0
  25. package/dist/face/motion.js +58 -0
  26. package/dist/face/motion.js.map +1 -0
  27. package/dist/face/mouth.d.ts +45 -0
  28. package/dist/face/mouth.d.ts.map +1 -0
  29. package/dist/face/mouth.js +61 -0
  30. package/dist/face/mouth.js.map +1 -0
  31. package/dist/face/shape.d.ts +15 -0
  32. package/dist/face/shape.d.ts.map +1 -0
  33. package/dist/face/shape.js +50 -0
  34. package/dist/face/shape.js.map +1 -0
  35. package/dist/index.d.ts +8 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/page/page.d.ts +34 -0
  40. package/dist/page/page.d.ts.map +1 -0
  41. package/dist/page/page.js +218 -0
  42. package/dist/page/page.js.map +1 -0
  43. package/dist/page/roles.d.ts +10 -0
  44. package/dist/page/roles.d.ts.map +1 -0
  45. package/dist/page/roles.js +87 -0
  46. package/dist/page/roles.js.map +1 -0
  47. package/dist/pointer/card.d.ts +13 -0
  48. package/dist/pointer/card.d.ts.map +1 -0
  49. package/dist/pointer/card.js +75 -0
  50. package/dist/pointer/card.js.map +1 -0
  51. package/dist/pointer/code.d.ts +21 -0
  52. package/dist/pointer/code.d.ts.map +1 -0
  53. package/dist/pointer/code.js +147 -0
  54. package/dist/pointer/code.js.map +1 -0
  55. package/dist/pointer/flight.d.ts +21 -0
  56. package/dist/pointer/flight.d.ts.map +1 -0
  57. package/dist/pointer/flight.js +80 -0
  58. package/dist/pointer/flight.js.map +1 -0
  59. package/dist/pointer/hover.d.ts +20 -0
  60. package/dist/pointer/hover.d.ts.map +1 -0
  61. package/dist/pointer/hover.js +96 -0
  62. package/dist/pointer/hover.js.map +1 -0
  63. package/dist/pointer/menu.d.ts +48 -0
  64. package/dist/pointer/menu.d.ts.map +1 -0
  65. package/dist/pointer/menu.js +252 -0
  66. package/dist/pointer/menu.js.map +1 -0
  67. package/dist/pointer/person.d.ts +91 -0
  68. package/dist/pointer/person.d.ts.map +1 -0
  69. package/dist/pointer/person.js +345 -0
  70. package/dist/pointer/person.js.map +1 -0
  71. package/dist/pointer/sections.d.ts +24 -0
  72. package/dist/pointer/sections.d.ts.map +1 -0
  73. package/dist/pointer/sections.js +64 -0
  74. package/dist/pointer/sections.js.map +1 -0
  75. package/dist/pointer/syntax.d.ts +10 -0
  76. package/dist/pointer/syntax.d.ts.map +1 -0
  77. package/dist/pointer/syntax.js +61 -0
  78. package/dist/pointer/syntax.js.map +1 -0
  79. package/dist/pointer/typing.d.ts +6 -0
  80. package/dist/pointer/typing.d.ts.map +1 -0
  81. package/dist/pointer/typing.js +62 -0
  82. package/dist/pointer/typing.js.map +1 -0
  83. package/dist/tutor/captions.d.ts +22 -0
  84. package/dist/tutor/captions.d.ts.map +1 -0
  85. package/dist/tutor/captions.js +62 -0
  86. package/dist/tutor/captions.js.map +1 -0
  87. package/dist/tutor/macro.d.ts +19 -0
  88. package/dist/tutor/macro.d.ts.map +1 -0
  89. package/dist/tutor/macro.js +67 -0
  90. package/dist/tutor/macro.js.map +1 -0
  91. package/dist/tutor/options.d.ts +42 -0
  92. package/dist/tutor/options.d.ts.map +1 -0
  93. package/dist/tutor/options.js +3 -0
  94. package/dist/tutor/options.js.map +1 -0
  95. package/dist/tutor/tutor.d.ts +14 -0
  96. package/dist/tutor/tutor.d.ts.map +1 -0
  97. package/dist/tutor/tutor.js +388 -0
  98. package/dist/tutor/tutor.js.map +1 -0
  99. package/dist/tutor/views.d.ts +27 -0
  100. package/dist/tutor/views.d.ts.map +1 -0
  101. package/dist/tutor/views.js +63 -0
  102. package/dist/tutor/views.js.map +1 -0
  103. package/dist/tutor/walking.d.ts +44 -0
  104. package/dist/tutor/walking.d.ts.map +1 -0
  105. package/dist/tutor/walking.js +142 -0
  106. package/dist/tutor/walking.js.map +1 -0
  107. package/dist/tutor/walks.d.ts +46 -0
  108. package/dist/tutor/walks.d.ts.map +1 -0
  109. package/dist/tutor/walks.js +112 -0
  110. package/dist/tutor/walks.js.map +1 -0
  111. package/dist/wire/index.d.ts +133 -0
  112. package/dist/wire/index.d.ts.map +1 -0
  113. package/dist/wire/index.js +204 -0
  114. package/dist/wire/index.js.map +1 -0
  115. package/package.json +53 -3
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Pinecall
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,317 @@
1
- # Temporary Holding Version
1
+ # @pinecall/dot
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **An experiment.** The dot and its tutor are an add-on of Pinecall, not part of its core: their
4
+ > API may change in any release.
5
+
6
+ The talking dot. A small face, a dot with eyes and a mouth, speaks with your agent's voice, moving
7
+ its mouth with the sound frame by frame. As a tutor it becomes one more person on the page, with a
8
+ pointer of its own: it walks the visitor through the site, hovers and highlights what it talks
9
+ about, and the agent's prompt reads the page as it is now.
10
+
11
+ It stands on [`@pinecall/room`](../room/README.md), which joins the call. The pinecall widget
12
+ draws it with `<pinecall-widget look="dot">`, and with `look="dot" tutor` the tutor too.
13
+
14
+ | import | where it runs | what it gives you |
15
+ |---|---|---|
16
+ | `@pinecall/dot` | the page | `face()`, `tutor()`, and `Page`, the page as the agent reads it |
17
+ | `@pinecall/dot/agent` | the agent's process | `Tutor`, the class an agent extends to be a tutor, and `macros()` |
18
+
19
+ ```bash
20
+ pnpm add @pinecall/dot @pinecall/room livekit-client # the page
21
+ pnpm add @pinecall/dot @pinecall/agents # the agent
22
+ ```
23
+
24
+ ## The face
25
+
26
+ ```ts
27
+ import { room } from "@pinecall/room";
28
+ import { face } from "@pinecall/dot";
29
+
30
+ const call = room({ tokens });
31
+ const pip = face(document.querySelector("#pip"), call); // the element sets the size
32
+
33
+ talkButton.onclick = () => {
34
+ pip.wake(); // inside the click: a browser starts audio only here
35
+ void call.start("talk");
36
+ };
37
+ // pip.close() takes it off the page.
38
+ ```
39
+
40
+ The face fills its element with one SVG: 64 px is a launcher, 240 px a hero. Two faces on one page
41
+ are fine.
42
+
43
+ **Its shape and colour.** `face(host, call, { shape, color })`: `shape` is `circle` (the default),
44
+ `squircle` or `blob`, and `color` any CSS colour (else the page's `--pc-face`). `reshape(shape)`
45
+ changes it later, the body easing from one into the other. The body moves whole with the mood, its
46
+ outline never bent: it bobs and leans in while it listens, more slowly while it thinks, and squashes
47
+ with the voice while it speaks; still under `prefers-reduced-motion`. Nothing is drawn outside the
48
+ body, no halo and no shadow, so it sits on any background. `tutor()` takes the same `shape` and `color`, which
49
+ tints its pointer too.
50
+
51
+ **How the mouth is read.** Everything happens in the browser, from the element the agent's voice
52
+ plays in (`state.voice`):
53
+
54
+ | step | what |
55
+ |---|---|
56
+ | the ear | an analyser on that element's stream, never connected to the speakers: the element already plays it |
57
+ | how open | the frame's loudness, against the loudest recent frame, so a quiet voice opens fully too |
58
+ | what shape | where the energy is. Highs over 4 kHz are S or T (teeth, little opening). 1.5–3.5 kHz is EE or EH (wide). Energy under 500 Hz with no highs is OO or O (round) |
59
+ | motion | every number eases toward its target, quick to open and slower to close |
60
+
61
+ Because it measures the sound as it plays, the mouth is in time with the voice by construction,
62
+ whatever the voice vendor. Until `wake()` is called, or without Web Audio, the mouth opens with
63
+ `state.speaking.level`, in no particular shape.
64
+
65
+ | the room | the face |
66
+ |---|---|
67
+ | `idle`, `ended`, `failed` | rests: a smile, breathing, a blink every few seconds |
68
+ | `opening` | thinks: eyes up, looking from side to side, a small round mouth sliding with them |
69
+ | `live`, the agent `listening` | waits: head tilted, eyes a little wider, bobbing slowly |
70
+ | `live`, the caller speaking (`speaking.user`, or their words coming in) | hears: head cocked further, eyes wide on the caller, nodding |
71
+ | `live`, the agent `thinking` | thinks |
72
+ | `live`, the voice sounding | speaks: the mouth from the voice, the body with its loudness |
73
+
74
+ With `prefers-reduced-motion`, breathing, tilting and glances stop, and the mouth still speaks.
75
+ Colours are custom properties on any ancestor: `--pc-face` (the dot), `--pc-face-eye`,
76
+ `--pc-face-mouth`, `--pc-face-teeth`, `--pc-face-tongue`.
77
+
78
+ ## The tutor, on the page
79
+
80
+ ```ts
81
+ import { room } from "@pinecall/room";
82
+ import { tutor } from "@pinecall/dot";
83
+
84
+ let pip = null;
85
+ const call = room({ tokens, onUi: (data) => pip?.take(data) || drawCard(data) });
86
+ pip = tutor(call, { label: "Talk to Pip", onClick: () => { pip.wake(); void call.start("talk"); } });
87
+ ```
88
+
89
+ `tutor()` puts the person on the page: resting, its face in the bottom-right corner (`dock: "left"`
90
+ for the other); touring, a pointer in its colour with the face beside the tip and what it says
91
+ beside the face. It moves the way a hand moves a mouse:
92
+
93
+ - **It aims at an element the way a person does.** It lands on the middle of the element's first
94
+ words, not of its box, and flies there on a minimum-jerk path with a slight arc, timed by the
95
+ distance.
96
+ - **The pointer looks like the one the element asks for**: a hand on a link, an I-beam in a field.
97
+ - **Hover looks real.** Every `:hover` rule of the site's own style sheets is mirrored onto
98
+ `[data-pc-hover]`, set on the element under the tip and its ancestors, and `pointerenter` and
99
+ `mouseenter` are sent for the site's code. A style sheet from another origin cannot be read and
100
+ keeps no hover.
101
+ - **It scrolls the page eased**, until the element sits a little above the middle of the screen.
102
+ - **A highlight dims the rest of the page** and follows the element as the page scrolls. "Here" is a
103
+ ring at the tip.
104
+
105
+ **It never clicks, sends a form or opens another page for the visitor.** It shows where, and they do
106
+ it. A form's fields it fills with what the visitor told it, typed letter by letter with the `input`
107
+ and `change` events the site's code listens for, a list by the option that says it; the visitor
108
+ presses its button. It never touches a password, a card number, a file or a hidden field.
109
+
110
+ **The conversation in writing, and the call's buttons.** The agent's words show beside the face,
111
+ lit as its voice says them; the visitor's, what the agent heard, show in the corner as they speak
112
+ and for `linger` ms after (2600 by default), one side at a time. `captions` chooses whose may show:
113
+ `both` (default), `agent`, `caller` or `none`. During a call two buttons sit beside the corner:
114
+ **CC**, which turns the words on and off for this visitor: off until they turn them on (kept in
115
+ their browser's `localStorage`, and absent with `captions: "none"`), and **✕**, which hangs up (`call.leave()`). While a walk plays,
116
+ CC sits there with **■**, which stops it. The buttons slide into the face's corner while it tours, and
117
+ aside as it comes home. No words show while a
118
+ window of code or a card is open: they would cover it. `words: { hangUp, captions, stop }` names them for a
119
+ screen reader.
120
+
121
+ `take(data)` returns `true` for a message that was the tutor's (a cursor move, a macro step) and
122
+ `false` for anything else, which stays the page's to draw.
123
+
124
+ ### The page as the agent reads it
125
+
126
+ `Page` reads the page the way Playwright's aria snapshot does: roles and names, not markup.
127
+
128
+ ```
129
+ - page "Brightside Dental" (scrolled 1180–2080 of 3460px)
130
+ - banner
131
+ - link "Brightside Dental" [ref=e1]
132
+ - navigation "Main"
133
+ - link "Services" [ref=e2]
134
+ - main
135
+ - region "Services" [ref=e6] (above)
136
+ - region "Pricing" [ref=e9]
137
+ - heading "Pricing" [level=2] [ref=e10]
138
+ - article "Family Care plan" [ref=e14]
139
+ - text "$39 / month"
140
+ - button "Choose Family Care" [ref=e16]
141
+ - region "Book your first visit" [ref=e18] (below)
142
+ ```
143
+
144
+ - **What is on the screen is there in full. A section out of view is one line**, its name and
145
+ `above` or `below`.
146
+ - **Words in a box that is only layout are a line of text**, as a price in a `<div>`, as Playwright
147
+ says them.
148
+ - **A ref is stable for the page's life**, and still names its element after a scroll took it off
149
+ the screen.
150
+ - **A field is its label and what it holds now**: `[value="Jordan Lee"]` or `[empty]`, a list's
151
+ choice and its `(options …)`, `[checked]` or `[unchecked]`, so the agent sees what the visitor
152
+ typed. Passwords, card numbers, and anything under `[data-pinecall-skip]` or `aria-hidden` are
153
+ left out.
154
+ - **What the site wrote for the agent to say is marked `[has a line]`** ([below](#lines-on-the-page)).
155
+
156
+ The tutor sends it as `page.seen` when the call goes live, when a scroll stops, on a resize, when
157
+ the DOM changes (a question opened, a tab), on a click, and before each of the agent's moves. It
158
+ is sent only when it changed, but for one answer: when a move onto a thing ends, the page is sent
159
+ again with `why: "moved"` and the ref it moved to, and why a field could not be filled (`refused`).
160
+ What the visitor types in a field reaches the agent the same way, a moment after.
161
+
162
+ ## The tutor, in the agent
163
+
164
+ ```ts
165
+ import { macros, Tutor } from "@pinecall/dot/agent";
166
+ import tour from "./macros/tour.json" with { type: "json" };
167
+
168
+ /** You are Pip, Brightside Dental's front desk, on the visitor's screen. Short sentences. */
169
+ export default class Pip extends Tutor {
170
+ static override macros = macros({ tour });
171
+ }
172
+ ```
173
+
174
+ A class that extends `Tutor` gets these:
175
+
176
+ - **The page's events**, from the visitor's browser only: `page.seen`, `page.clicked`, `page.missing`.
177
+ - **`page` and `clicked` in its state.**
178
+ - **A view that prints the screen.** A class with a `render()` of its own ends it with `this.seeing()`.
179
+ The site's words are fenced there as data, never as instructions to the model.
180
+ - **The pointer's tools**: `point`, `highlight`, `unhighlight`, `scrollTo`, `here`, `home`, `fill`,
181
+ `explain` and `runMacro`.
182
+ There is none to open a page: the tutor never leaves the page the visitor is on. They show once the page has been seen. The pointer's moves are `quiet`: they run as the
183
+ model calls them, while the words that name them play, and the model answers one only when it made
184
+ it without a word; `runMacro` too, which starts on its own first words and ends on its own last ones.
185
+ - **A move onto a thing waits for the page to say it ended** (`point`, `highlight`, `scrollTo`, three
186
+ seconds at most), and its result is that thing as the visitor now sees it, fenced as data: a
187
+ section that was one line below the fold comes back in full, its prices with it, for the model to
188
+ talk about.
189
+ - **`fill(field, text)` writes what the visitor said into a field**, after the agent asked for it,
190
+ one field at a time; its result is the field as it now shows, and a field the page refused (a
191
+ password, a list with no such option) is a tool error naming why. It never sends the form.
192
+ - **The pointer only where a tutor's page is.** A call no tutor's page joined (the phone, a page with
193
+ no dot, a chat) is the agent's alone: its view says nothing of a screen and the pointer's tools stay
194
+ hidden. So an agent that answers the phone too can extend `Tutor` and lose nothing there.
195
+ - **The page asked for as the call opens**, on the web: `onCall` sends `{ type: "look" }`, and the page answers with
196
+ `page.seen`. LiveKit keeps no data for a participant who joins after it was sent, so the agent asks
197
+ once it is there. A page that joins a call already under way (a reload) tells it at once.
198
+
199
+ A class that overrides `onCall` or `onEvent` calls `super.onCall(call)` or
200
+ `super.onEvent(name, data, meta)` first.
201
+
202
+ ### Macros
203
+
204
+ A macro is a guided walk, saved in the agent's folder as `macros/<name>.json`. Each step is a
205
+ sentence the agent says as written, and each beat is a move run as its word is said:
206
+
207
+ ```json
208
+ {
209
+ "name": "tour",
210
+ "when": "the visitor asks to be shown around",
211
+ "steps": [
212
+ { "say": "Up here are our services. Whitening is the one most people ask about.",
213
+ "beats": [
214
+ { "word": "Up", "do": "point", "find": ["link", "Services"] },
215
+ { "word": "Whitening", "do": "point", "find": ["article", "Whitening"] },
216
+ { "word": "is", "do": "highlight", "find": ["article", "Whitening"] }
217
+ ] }
218
+ ]
219
+ }
220
+ ```
221
+
222
+ - **`find` names the element as the snapshot does**, by role and a part of its name, so a macro
223
+ survives a change of the markup.
224
+ - **A step can show code beside the page**: `"code": { "title": "agent.ts", "text": "…" }` opens a
225
+ window with it, `"lines": [4, 5]` lights the lines the sentence is about and dims the rest, and a
226
+ later step lights others in the same window; `"code": null` closes it, as does the walk's end.
227
+ - **`nth` picks which time a word is said**, from 1.
228
+ - **`macros()` checks every file when the class loads**, and refuses a beat on a word its sentence
229
+ never says.
230
+ - **A model names a walk the way it heard it**: `runMacro("site tour")` runs `tour`, and an agent with one
231
+ walk runs it whatever it is called (`walkNamed`).
232
+
233
+ How a macro runs. `runMacro("tour")` sends each step on `pinecall.ui`, then says it. The page binds
234
+ the step to the reply that follows and counts its words as the voice says them, the same word
235
+ timings room's karaoke lights words with. Each beat runs as its word starts. When the visitor
236
+ speaks, the walk stops and the agent answers them.
237
+
238
+ ### Walks the visitor plays with no call
239
+
240
+ A macro is also a **walk the visitor plays on their own**, with no call and nothing spent. As the
241
+ agent starts (`static onServe`, run by `pinecall start` and by a deployed app), `Tutor` records each
242
+ sentence of each macro once in the agent's own voice, with when each word is said, and publishes
243
+ them as the agent's `walks` document; the terminal says `walk tour · 5 sentences · 0:38 · cartesia
244
+ sonic-3 …`. A sentence recorded before, in the same voice, costs nothing; a sentence edited, a voice
245
+ or a lexicon changed is recorded again at the next start. A macro's `"title"` is its button.
246
+
247
+ On the page, `tutor(call, { walks: "https://<gateway>/v1/agents/<slug>/public/walks" })` (the
248
+ widget's `walks` attribute) puts a small button beside the resting face. A click fans the walks out
249
+ round it, four at a time (a small ⌄ under them shows the next ones), each a pill with its title and length; a pick plays it: the voice, the mouth moving with
250
+ it, the words lit as said, each beat on its word, a ring round the face for how far it is. While it
251
+ plays, the corner holds captions, pause and stop; a click on the face stops it too. No microphone is
252
+ asked for. A section can offer its own walk: with `data-pinecall-walk="<macro>"` on it, as the page is
253
+ scrolled to it that walk's pill shows alone beside the face for a few seconds, then goes; not during
254
+ a call or a walk. The site can also draw its own button, `hidden`, and mark it
255
+ `data-pinecall-play="<macro>"`: the tutor shows it while that walk can play, and a click plays it. A call opened afterwards tells the agent which walk
256
+ was played and how far (`page.walked`), so it goes on from there rather than give it again.
257
+ `onWalk` hears each start and end, for the page's own analytics.
258
+
259
+ ### The views of a project's own tools
260
+
261
+ A project's agent has tools of its own: the free times, a booking, a piece of code. Their results are
262
+ already on the call's log, so the page says how to draw each, by the tool's name, and the tutor puts it
263
+ on a card above the face's corner when the tool finishes:
264
+
265
+ ```ts
266
+ tutor(call, {
267
+ views: {
268
+ freeSlots: (host, result, tools) => {
269
+ host.innerHTML = (result as { times: string[] }).times.map((time) => `<button>${time}</button>`).join("");
270
+ host.addEventListener("click", (event) => tools.send((event.target as HTMLElement).textContent ?? ""));
271
+ },
272
+ },
273
+ });
274
+ ```
275
+
276
+ A view draws into `host` and may answer a function that takes it down. `tools.send(text)` says
277
+ something to the agent in writing, as the visitor: a time picked, a name and an email typed instead of
278
+ spelled out; `tools.hide()` puts the card away; `tools.state()` reads the call, to mark what the agent
279
+ chose. The card holds the last tool that finished with a view, until it is replaced, closed with its
280
+ ×, or the call ends; a page that joins a call under way shows none of what ran before. It is the
281
+ visitor's way to say something, never a way round the agent: nothing on it books or sends for them.
282
+ With the widget, set `widget.views = { … }` on the element. Colours: `--pc-card` and `--pc-card-ink`.
283
+
284
+ ### Lines on the page
285
+
286
+ A walk can also live in the site's own markup, beside what it is about, so the HTML and what is
287
+ said never drift apart:
288
+
289
+ ```html
290
+ <section id="pricing" data-pinecall-say="Pricing is simple: three plans, and most families pick Family Care." data-pinecall-do="highlight">
291
+ <article data-pinecall-say="Family Care covers up to four people for thirty-nine dollars a month." data-pinecall-order="2">
292
+ ```
293
+
294
+ - **`data-pinecall-say` is said as written**, with the move `data-pinecall-do` names (`point`
295
+ unless `highlight` or `scroll_to`), in `data-pinecall-order` and then in the page's order.
296
+ - **One at a time**: `explain(what)` says the line of a thing marked `[has a line]`, the pointer on
297
+ it, when the visitor asks what it is; and during a call a ▶ shows at the top right of a marked
298
+ element under the visitor's mouse, which says it at once (`page.explain`).
299
+ - **All of them**: the walk `page`, listed with the agent's macros, says every line in order.
300
+ - **Said once.** The agent says a line through `say()`, so it is the turn's answer, in the history:
301
+ the model is not asked to answer it again, and the tool's result tells it the line is said.
302
+
303
+ Only the site's markup is read: a line under `[data-pinecall-skip]` or `aria-hidden` is not.
304
+
305
+ ## What the page and the agent say to each other
306
+
307
+ | way | what |
308
+ |---|---|
309
+ | page → agent | `page.walked { walk, step, of, done }`, as a call opens after a walk played with no call |
310
+ | page → agent | `call.event("page.seen", { text, why, lines, at?, refused? })`, `lines` the site's `[{ at, say, do }]`, `at` the ref a move ended on when `why` is `moved`, `refused` why a field was not filled · `page.clicked { role, name }` · `page.missing { target }` · `page.explain { at }`, the ▶ pressed |
311
+ | agent → page | `pinecall.ui` `{ type: "cursor", action, target?, text? }`: a ref (`e22`) or a name as the screen shows it (`Questions`). The actions are `point`, `highlight`, `unhighlight`, `scroll_to`, `here`, `home`, and `type`, which writes `text` into the field |
312
+ | agent → page | `pinecall.ui` `{ type: "macro.step", macro, step, say, beats }` |
313
+ | agent → page | `pinecall.ui` `{ type: "look" }`: what the page shows now, answered with `page.seen` |
314
+
315
+ **Anybody can send what a browser sends.** The agent reads the page as the visitor's own words, and
316
+ a site that shows other people's words (reviews, comments) puts them under `data-pinecall-skip`
317
+ when the agent should not read them.
@@ -0,0 +1,4 @@
1
+ /** @pinecall/dot/agent: the agent's side of the dot tutor, for a class written with @pinecall/agents. */
2
+ export { Tutor, macros, walkNamed } from "./tutor.js";
3
+ export type { Action, Beat, Macro, MacroStep } from "../wire/index.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** @pinecall/dot/agent: the agent's side of the dot tutor, for a class written with @pinecall/agents. */
2
+ export { Tutor, macros, walkNamed } from "./tutor.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,67 @@
1
+ /** The agent's side of the dot tutor: the visitor's page in its prompt, the pointer's tools, and the macros it was given. */
2
+ import { Agent, type Call, type Child, type EventDeclarations, type EventMeta, type Serve } from "@pinecall/agents";
3
+ import { type Line, type Macro } from "../wire/index.js";
4
+ /**
5
+ * The walk a model means by `asked`: the one so named, else the one whose name it says among its words
6
+ * ("site tour" for `tour`), else the only one there is. A model names a walk the way it heard it.
7
+ */
8
+ export declare function walkNamed(walks: Record<string, Macro>, asked: string): Macro | undefined;
9
+ /** Each macro file, checked: `macros({ tour })` with `import tour from "./macros/tour.json" with { type: "json" }`. */
10
+ export declare function macros(files: Record<string, unknown>): Record<string, Macro>;
11
+ export declare class Tutor extends Agent {
12
+ static events: EventDeclarations;
13
+ /** The guided walks this agent can give, by name. */
14
+ static macros: Record<string, Macro>;
15
+ /** The visitor's page as they see it now, as the page last sent it. */
16
+ page: string;
17
+ /** What the visitor clicked last: `button "Book now"`. */
18
+ clicked: string;
19
+ /** The macro being said, while one is. */
20
+ walking?: string | undefined;
21
+ /** What the site wrote for the agent to say, beside the element each is about, as the page last sent it. */
22
+ lines: Line[];
23
+ /** The walk the visitor played with no call before this one, and how far: `"tour", all 5 sentences`. */
24
+ walked: string;
25
+ /**
26
+ * Before any call: each macro recorded in the agent's voice and published as `walks`, for the
27
+ * page to play with no call. A sentence recorded before costs nothing, so this runs as it is again.
28
+ */
29
+ static onServe(serve: Serve): Promise<void>;
30
+ /** The call opens: the page is asked what it shows. A class with an onCall of its own calls `super.onCall(call)`. */
31
+ onCall(_call: Call): unknown;
32
+ onEvent(name: string, data: Record<string, unknown>, _meta: EventMeta): unknown;
33
+ /** The prompt's last block: the screen. A class with a render() of its own puts `this.seeing()` at its end. */
34
+ render(): Child;
35
+ /** What the visitor sees now, and how to move on it, as the view says it. */
36
+ seeing(): string;
37
+ /** Move your pointer onto an element of the visitor's page, just before you talk about it. */
38
+ point(what: string): Promise<string>;
39
+ /** Light up an element of the visitor's page and dim the rest, while you talk about it. */
40
+ highlight(what: string): Promise<string>;
41
+ /** Turn the highlight off. */
42
+ unhighlight(): string;
43
+ /** Scroll the visitor's page to an element that is off their screen. */
44
+ scrollTo(what: string): Promise<string>;
45
+ /** Tell the visitor about a thing marked [has a line]: your pointer goes to it and the site's line about it is said, as written. */
46
+ explain(what: string): Promise<string>;
47
+ /** Write what the visitor told you into a field of a form, after asking them for it; a list takes one of its options. You never send the form. */
48
+ fill(field: string, text: string): Promise<string>;
49
+ /** Show where to click: a ring at your pointer. You never click for them. */
50
+ here(): string;
51
+ /** Take your pointer back to your corner, when you are done showing. */
52
+ home(): string;
53
+ /** Give one of your walks, by its name: each sentence said as written, your pointer moving on its words. */
54
+ runMacro(name: string): Promise<string>;
55
+ /** The site's lines, one by one: the pointer onto each element, then its line said as written. */
56
+ private walkThePage;
57
+ /** The pointer onto a line's element, then the line said: the turn's answer, kept in the history. */
58
+ private sayLine;
59
+ /** `what`, when the visitor's page shows it: a ref of the snapshot, or a name among its quoted ones. */
60
+ private shown;
61
+ /** Move onto `what`, wait for the page to say the move ended, and say what the visitor sees there. */
62
+ private show;
63
+ /** Send a move and wait for the page to say it ended, three seconds at most; a move never answered ends with nothing known. */
64
+ private moved;
65
+ private move;
66
+ }
67
+ //# sourceMappingURL=tutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tutor.d.ts","sourceRoot":"","sources":["../../src/agent/tutor.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAgB7H,OAAO,EAAE,KAAK,EAAiC,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,KAAK,KAAK,EAAoB,MAAM,kBAAkB,CAAC;AAErK,OAAO,EAAmH,KAAK,IAAI,EAAE,KAAK,KAAK,EAAiC,MAAM,kBAAkB,CAAC;AAgDzM;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAKxF;AAcD,uHAAuH;AACvH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAE5E;AAED,qBAAa,KAAM,SAAQ,KAAK;IAC9B,OAAgB,MAAM,EAAE,iBAAiB,CAMvC;IAEF,qDAAqD;IACrD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAM;IAE1C,uEAAuE;IACvE,IAAI,SAAM;IACV,0DAA0D;IAC1D,OAAO,SAAM;IACb,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,4GAA4G;IAC5G,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,wGAAwG;IACxG,MAAM,SAAM;IAEZ;;;OAGG;IACH,OAAsB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzD;IAED,qHAAqH;IAC5G,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAGpC;IAEQ,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAavF;IAED,+GAA+G;IACtG,MAAM,IAAI,KAAK,CAEvB;IAED,6EAA6E;IAC7E,MAAM,IAAI,MAAM,CAuBf;IAED,8FAA8F;IAC9F,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnC;IAED,2FAA2F;IAC3F,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvC;IAED,8BAA8B;IAC9B,WAAW,IAAI,MAAM,CAEpB;IAED,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtC;IAED,oIAAoI;IAC9H,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO3C;IAED,kJAAkJ;IAC5I,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASvD;IAED,6EAA6E;IAC7E,IAAI,IAAI,MAAM,CAEb;IAED,wEAAwE;IACxE,IAAI,IAAI,MAAM,CAEb;IAED,4GAA4G;IACtG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB5C;IAED,kGAAkG;YACpF,WAAW;IAgBzB,qGAAqG;YACvF,OAAO;IAQrB,wGAAwG;IACxG,OAAO,CAAC,KAAK;IAYb,sGAAsG;YACxF,IAAI;IAUlB,+HAA+H;IAC/H,OAAO,CAAC,KAAK;IAkBb,OAAO,CAAC,IAAI;CAIb"}