pi-durable-bot 0.8.1 → 0.8.3

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 (47) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +2 -1
  3. package/dist/agent/mcp.js +4 -2
  4. package/dist/agent/mcp.js.map +1 -1
  5. package/dist/agent/models.js +60 -0
  6. package/dist/agent/models.js.map +1 -1
  7. package/dist/agent/scopes.js +11 -2
  8. package/dist/agent/scopes.js.map +1 -1
  9. package/dist/bot/bot.js +8 -0
  10. package/dist/bot/bot.js.map +1 -1
  11. package/dist/bot/prompt.js +2 -0
  12. package/dist/bot/prompt.js.map +1 -1
  13. package/dist/channels/slack/index.js +65 -12
  14. package/dist/channels/slack/index.js.map +1 -1
  15. package/dist/cli/ai.js +6 -58
  16. package/dist/cli/ai.js.map +1 -1
  17. package/dist/cli/login-link.js +90 -0
  18. package/dist/cli/login-link.js.map +1 -0
  19. package/dist/cli/login.js +24 -2
  20. package/dist/cli/login.js.map +1 -1
  21. package/dist/cli/mcp.js +7 -2
  22. package/dist/cli/mcp.js.map +1 -1
  23. package/dist/cli/pages.js +21 -7
  24. package/dist/cli/pages.js.map +1 -1
  25. package/dist/pages/cloudflared.js +1 -1
  26. package/dist/pages/cloudflared.js.map +1 -1
  27. package/dist/pages/desktop-page.js +12 -7
  28. package/dist/pages/desktop-page.js.map +1 -1
  29. package/dist/pages/host.js +41 -2
  30. package/dist/pages/host.js.map +1 -1
  31. package/dist/pages/login-page.js +202 -0
  32. package/dist/pages/login-page.js.map +1 -0
  33. package/dist/pages/login.js +848 -0
  34. package/dist/pages/login.js.map +1 -0
  35. package/dist/pages/secret-page.js +3 -2
  36. package/dist/pages/secret-page.js.map +1 -1
  37. package/dist/pages/server.js +97 -5
  38. package/dist/pages/server.js.map +1 -1
  39. package/dist/pages/store.js +22 -4
  40. package/dist/pages/store.js.map +1 -1
  41. package/docs/for-agents.md +4 -1
  42. package/kit/login/login.css +498 -0
  43. package/kit/login/login.js +481 -0
  44. package/package.json +14 -14
  45. package/skills/desktop-page/SKILL.md +3 -1
  46. package/skills/pages/SKILL.md +32 -3
  47. package/skills/slack-channel/SKILL.md +2 -1
@@ -55,6 +55,8 @@ Do the setup yourself, in your own shell. Only one step is your person's: signin
55
55
  > Run `pots login` in your terminal. Choose "Sign in with a subscription", then ChatGPT, and sign in: that is the model your bot thinks with. Then choose "Use an API key", then TypeSafe, and paste your TypeSafe key: that is Jev, which decides which group messages wake your bot. Then choose "Done".
56
56
 
57
57
  `pots login` takes each key with hidden input and does not take an empty one. It tries each model and judge, says that it is ready or why not, and comes back to its menu, so both go in one run; "Done" lists what pi can use. On a computer without a browser, such as a server over SSH, a sign-in prints a link and asks for the code the page shows (choose "Copy code login (headless)" when it is offered). Then run `pots login --list` again.
58
+
59
+ When your person will not use a terminal on that computer, run `pots login --link` yourself and give them the link it prints. They open it on their phone or another computer, press Start, and sign in there: with a subscription (the page puts a device code or a copy code first), or with an API key, also TypeSafe's. They can add several, then press Done. It needs no bot yet. The command serves the page until they press Done, or 15 minutes after Start (an hour unopened), prints each login and then what pi can use, so wait for it to end. Without a `publicUrl` in `~/.pots/settings.json`, the link goes through a Cloudflare Quick Tunnel and the command says so: Cloudflare can see what is typed on the page. A device code is safe there. Tell them that a copy code or a pasted address, and an API key typed there, are not private: with them Cloudflare could finish the sign-in or use the key.
58
60
  5. **Make the bot:**
59
61
  ```sh
60
62
  pots init --yes --name "Ada" --model openai/gpt-6.1-sol --about "our team's research and ops assistant" --no-chat
@@ -71,11 +73,12 @@ Tell your person:
71
73
  - **Talk to the bot:** `pots chat`. Leave with Ctrl+C; the bot keeps working.
72
74
  - **Tell it where to work.** For example, "join our Slack". It sets the app up itself. Then invite it to the right channels (`/invite @its-name`). Like a new hire, it joins only the places it is invited to.
73
75
  - **Which models do which work is theirs to say.** The bot talks at `medium` thinking and hands longer work to children at `xhigh` or `max`, on its own model unless it chooses another one for a child. At its first start it asks your person which models they want for which work, and keeps the answer in its AGENTS.md.
76
+ - **Sign in from anywhere.** When a login expires, or they want another model or Jev, they ask the bot, for example "sign me in to Claude". It sends a one-time link to a login page of Pots' own, where they sign in from any device; the bot is told which models it can use, never the login. When the bot cannot think because its only login expired, `pots login --link` on its computer prints such a link.
74
77
  - **Change it by talking to it.** Its persona, responsibilities, model and judge live in its folder, `~/.pots/bots/<id>/`, and the bot edits them itself. People can edit them too; changes apply within seconds.
75
78
 
76
79
  | Command | What it does |
77
80
  |---|---|
78
- | `pots login` | Sign in to models and judges, or add API keys or local servers, one after another (in a terminal); `--list` shows what can be used |
81
+ | `pots login` | Sign in to models and judges, or add API keys or local servers, one after another (in a terminal); `--list` shows what can be used; `--link` prints a link to a login page for any device instead |
79
82
  | `pots mcp add` / `list` / `remove` | MCP servers for every bot and pi on this computer, in pi's `~/.pi/agent/mcp.json`, with the options of `pi mcp` (`pots mcp --help`); the bot calls their tools from code mode scripts: short JavaScript programs it writes to call its tools |
80
83
  | `pots mcp login <server>` | Sign in to an MCP server in the browser (in a terminal) |
81
84
  | `pots status` | The gateway, the service and each bot |
@@ -0,0 +1,498 @@
1
+ /*
2
+ * The login page of Pots: a person signs in to a model provider for the bot's computer. Phone first, also for
3
+ * computers. Pots' own page; bots do not use this file.
4
+ */
5
+
6
+ :root {
7
+ color-scheme: light dark;
8
+ --bg: #f6f6f3;
9
+ --card: #ffffff;
10
+ --text: #1d1d1f;
11
+ --muted: #5f6368;
12
+ --line: #dcdcd7;
13
+ --go: #1f9d6b;
14
+ --bad: #c0392b;
15
+ --sheet: #f4f4f2;
16
+ --tile: #ffffff;
17
+ --soft: #e6e6e3;
18
+ --warn-bg: #fff6e0;
19
+ --warn-fg: #6b4a00;
20
+ --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
21
+ }
22
+
23
+ @media (prefers-color-scheme: dark) {
24
+ :root {
25
+ --bg: #141516;
26
+ --card: #1f2022;
27
+ --text: #ececea;
28
+ --muted: #a2a6ab;
29
+ --line: #34373a;
30
+ --bad: #ff8a7e;
31
+ --sheet: #1f2022;
32
+ --tile: #2c2d30;
33
+ --soft: #2c2d30;
34
+ --warn-bg: #3a2f12;
35
+ --warn-fg: #f3d58a;
36
+ }
37
+ }
38
+
39
+ * {
40
+ box-sizing: border-box;
41
+ }
42
+
43
+ html,
44
+ body {
45
+ margin: 0;
46
+ height: 100%;
47
+ font: 15px/1.4 var(--font);
48
+ color: var(--text);
49
+ background: var(--bg);
50
+ -webkit-text-size-adjust: 100%;
51
+ text-size-adjust: 100%;
52
+ }
53
+
54
+ [hidden] {
55
+ display: none !important;
56
+ }
57
+
58
+ button {
59
+ font: inherit;
60
+ color: inherit;
61
+ border: 0;
62
+ background: none;
63
+ padding: 0;
64
+ cursor: pointer;
65
+ touch-action: manipulation;
66
+ -webkit-tap-highlight-color: transparent;
67
+ }
68
+
69
+ /* ---- Start and end pages ---- */
70
+
71
+ .page {
72
+ max-width: 520px;
73
+ min-height: 100%;
74
+ margin: 0 auto;
75
+ padding: calc(40px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
76
+ display: flex;
77
+ flex-direction: column;
78
+ }
79
+
80
+ .who {
81
+ display: flex;
82
+ align-items: center;
83
+ gap: 10px;
84
+ font-size: 14px;
85
+ color: var(--muted);
86
+ }
87
+
88
+ .ava {
89
+ width: 34px;
90
+ height: 34px;
91
+ border-radius: 50%;
92
+ flex: none;
93
+ background: linear-gradient(135deg, #4fb3a5, #1f7a70);
94
+ color: #fff;
95
+ display: grid;
96
+ place-items: center;
97
+ font-weight: 700;
98
+ }
99
+
100
+ .ask {
101
+ margin: 18px 0 14px;
102
+ background: var(--card);
103
+ border-radius: 18px;
104
+ padding: 16px;
105
+ font-size: 19px;
106
+ line-height: 1.45;
107
+ font-weight: 600;
108
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
109
+ }
110
+
111
+ /* Long text, or text of several lines, in the regular weight: easier to read than a big bold block. */
112
+ .ask.long {
113
+ font-size: 16.5px;
114
+ line-height: 1.6;
115
+ font-weight: 450;
116
+ padding: 16px 18px;
117
+ }
118
+
119
+ /* The bot's words: a paragraph per line, and a numbered or bulleted line hangs under its mark. */
120
+ .words p {
121
+ margin: 0;
122
+ white-space: pre-wrap;
123
+ overflow-wrap: anywhere;
124
+ }
125
+
126
+ .words p + p {
127
+ margin-top: 0.4em;
128
+ }
129
+
130
+ .words .gap {
131
+ height: 0.2em;
132
+ }
133
+
134
+ .words .step {
135
+ display: grid;
136
+ grid-template-columns: auto minmax(0, 1fr);
137
+ column-gap: 0.45em;
138
+ }
139
+
140
+ .words .n {
141
+ min-width: 1.1em;
142
+ font-weight: 650;
143
+ font-variant-numeric: tabular-nums;
144
+ }
145
+
146
+ .ask .n {
147
+ color: var(--go);
148
+ }
149
+
150
+ .meta {
151
+ font-size: 13px;
152
+ color: var(--muted);
153
+ line-height: 1.6;
154
+ }
155
+
156
+ .fold {
157
+ font-size: 13px;
158
+ margin-top: 12px;
159
+ color: var(--muted);
160
+ }
161
+
162
+ .fold summary {
163
+ cursor: pointer;
164
+ }
165
+
166
+ .fold p {
167
+ margin: 6px 0 0;
168
+ line-height: 1.5;
169
+ }
170
+
171
+ .msg {
172
+ color: var(--bad);
173
+ font-size: 14px;
174
+ min-height: 1.4em;
175
+ margin: 14px 0 0;
176
+ }
177
+
178
+ #start.page {
179
+ padding-bottom: 0;
180
+ }
181
+
182
+ /* Start stays in sight at the bottom while long text scrolls under it. */
183
+ .go {
184
+ margin-top: auto;
185
+ position: sticky;
186
+ bottom: 0;
187
+ padding: 18px 0 calc(16px + env(safe-area-inset-bottom));
188
+ background: linear-gradient(to bottom, color-mix(in srgb, var(--bg), transparent 100%), var(--bg) 18px);
189
+ }
190
+
191
+ .go .msg {
192
+ margin: 0 0 10px;
193
+ min-height: 0;
194
+ }
195
+
196
+ .go .msg:empty {
197
+ display: none;
198
+ }
199
+
200
+ .big {
201
+ width: 100%;
202
+ text-align: center;
203
+ background: var(--go);
204
+ color: #fff;
205
+ font-weight: 700;
206
+ font-size: 18px;
207
+ border-radius: 16px;
208
+ padding: 16px;
209
+ }
210
+
211
+ .big:disabled {
212
+ opacity: 0.55;
213
+ cursor: default;
214
+ }
215
+
216
+ .fine {
217
+ font-size: 12px;
218
+ color: var(--muted);
219
+ text-align: center;
220
+ margin: 10px 0 0;
221
+ line-height: 1.5;
222
+ }
223
+
224
+ .ended {
225
+ text-align: center;
226
+ }
227
+
228
+ .ended h1 {
229
+ font-size: 21px;
230
+ margin: 0 0 8px;
231
+ }
232
+
233
+ .check {
234
+ width: 64px;
235
+ height: 64px;
236
+ border-radius: 50%;
237
+ margin: 100px auto 18px;
238
+ display: grid;
239
+ place-items: center;
240
+ }
241
+
242
+ .check.good {
243
+ background: var(--go);
244
+ }
245
+
246
+ .check.gone {
247
+ background: var(--muted);
248
+ }
249
+
250
+ .check::after {
251
+ content: "";
252
+ width: 22px;
253
+ height: 12px;
254
+ border: solid #fff;
255
+ border-width: 0 0 3px 3px;
256
+ transform: translateY(-3px) rotate(-45deg);
257
+ }
258
+
259
+ .check.gone::after {
260
+ width: 26px;
261
+ height: 0;
262
+ border-width: 0 0 3px 0;
263
+ transform: none;
264
+ }
265
+
266
+ /* ---- The session ---- */
267
+
268
+ #session h1 {
269
+ font-size: 21px;
270
+ margin: 0 0 4px;
271
+ }
272
+
273
+ #session > p {
274
+ line-height: 1.5;
275
+ }
276
+
277
+ .tabs {
278
+ display: grid;
279
+ grid-auto-flow: column;
280
+ grid-auto-columns: 1fr;
281
+ gap: 8px;
282
+ margin: 16px 0 12px;
283
+ }
284
+
285
+ .tab {
286
+ text-align: left;
287
+ border-radius: 14px;
288
+ padding: 12px 14px;
289
+ background: var(--soft);
290
+ display: flex;
291
+ flex-direction: column;
292
+ gap: 2px;
293
+ }
294
+
295
+ .tab span {
296
+ font-size: 12px;
297
+ color: var(--muted);
298
+ }
299
+
300
+ .tab.on {
301
+ background: var(--card);
302
+ box-shadow: 0 0 0 2px var(--go);
303
+ }
304
+
305
+ .search,
306
+ .question input {
307
+ width: 100%;
308
+ font: inherit;
309
+ font-size: 16px;
310
+ padding: 12px 14px;
311
+ border: 1px solid var(--line);
312
+ border-radius: 12px;
313
+ background: var(--card);
314
+ color: var(--text);
315
+ margin: 0 0 10px;
316
+ }
317
+
318
+ .search:focus,
319
+ .question input:focus {
320
+ outline: 2px solid var(--go);
321
+ outline-offset: 1px;
322
+ }
323
+
324
+ .list {
325
+ display: flex;
326
+ flex-direction: column;
327
+ gap: 8px;
328
+ margin: 0 0 12px;
329
+ }
330
+
331
+ .item {
332
+ text-align: left;
333
+ background: var(--card);
334
+ border-radius: 14px;
335
+ padding: 13px 15px;
336
+ display: flex;
337
+ flex-wrap: wrap;
338
+ align-items: baseline;
339
+ gap: 2px 10px;
340
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
341
+ }
342
+
343
+ .item .name {
344
+ font-weight: 600;
345
+ }
346
+
347
+ .item .id {
348
+ font-size: 13px;
349
+ color: var(--muted);
350
+ }
351
+
352
+ .item.best {
353
+ box-shadow: 0 0 0 2px var(--go);
354
+ }
355
+
356
+ .badge {
357
+ font-size: 12px;
358
+ color: var(--go);
359
+ font-weight: 600;
360
+ flex-basis: 100%;
361
+ }
362
+
363
+ .foot {
364
+ margin-top: auto;
365
+ padding-top: 18px;
366
+ }
367
+
368
+ .plain {
369
+ display: block;
370
+ width: 100%;
371
+ text-align: center;
372
+ padding: 14px;
373
+ margin-top: 8px;
374
+ border-radius: 14px;
375
+ color: var(--muted);
376
+ font-weight: 600;
377
+ }
378
+
379
+ .plain.small {
380
+ display: inline-block;
381
+ width: auto;
382
+ padding: 8px 14px;
383
+ margin: 0;
384
+ background: var(--soft);
385
+ color: var(--text);
386
+ }
387
+
388
+ a.big {
389
+ display: block;
390
+ text-decoration: none;
391
+ margin: 10px 0 0;
392
+ }
393
+
394
+ .event {
395
+ background: var(--card);
396
+ border-radius: 16px;
397
+ padding: 14px 16px;
398
+ margin: 14px 0 0;
399
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
400
+ }
401
+
402
+ .event p {
403
+ margin: 0 0 8px;
404
+ line-height: 1.5;
405
+ overflow-wrap: anywhere;
406
+ }
407
+
408
+ .event a:not(.big) {
409
+ color: var(--go);
410
+ }
411
+
412
+ .coderow {
413
+ display: flex;
414
+ align-items: center;
415
+ justify-content: space-between;
416
+ gap: 12px;
417
+ margin: 4px 0 6px;
418
+ }
419
+
420
+ .code {
421
+ font: 700 28px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
422
+ letter-spacing: 0.08em;
423
+ overflow-wrap: anywhere;
424
+ user-select: all;
425
+ }
426
+
427
+ .progress {
428
+ display: flex;
429
+ align-items: center;
430
+ gap: 10px;
431
+ color: var(--muted);
432
+ margin: 14px 0 0;
433
+ }
434
+
435
+ .spin {
436
+ width: 16px;
437
+ height: 16px;
438
+ flex: none;
439
+ border-radius: 50%;
440
+ border: 2px solid var(--line);
441
+ border-top-color: var(--go);
442
+ animation: spin 0.9s linear infinite;
443
+ }
444
+
445
+ @keyframes spin {
446
+ to {
447
+ transform: rotate(360deg);
448
+ }
449
+ }
450
+
451
+ .question {
452
+ margin: 18px 0 0;
453
+ }
454
+
455
+ .q {
456
+ display: block;
457
+ font-weight: 600;
458
+ margin: 0 0 10px;
459
+ line-height: 1.45;
460
+ }
461
+
462
+ .question .fine,
463
+ #session .fine {
464
+ text-align: left;
465
+ }
466
+
467
+ .warn {
468
+ background: var(--warn-bg);
469
+ color: var(--warn-fg);
470
+ border-radius: 12px;
471
+ padding: 10px 12px;
472
+ font-size: 13px;
473
+ line-height: 1.5;
474
+ margin: 0 0 12px;
475
+ }
476
+
477
+ .result {
478
+ font-size: 16px;
479
+ margin: 8px 0 0;
480
+ overflow-wrap: anywhere;
481
+ }
482
+
483
+ #session .check {
484
+ margin: 40px auto 18px;
485
+ }
486
+
487
+ #session .check + h1,
488
+ #session .check + h1 + .meta {
489
+ text-align: center;
490
+ }
491
+
492
+ #session .big {
493
+ margin-top: 22px;
494
+ }
495
+
496
+ #session .msg:empty {
497
+ display: none;
498
+ }