copilotz 1.0.0-rc.5 → 1.0.0-rc.7

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 (215) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +2 -2
  3. package/hosts/web/toolkit/time.js +2 -1
  4. package/package.json +1 -1
  5. package/plugins/access/accounts/collections/account.d.ts +1 -1
  6. package/plugins/access/directory/collections/org.d.ts +3 -3
  7. package/plugins/access/spaces/actions/invitation.js +4 -1
  8. package/plugins/access/spaces/actions/org.js +7 -2
  9. package/plugins/access/spaces/actions/personal.js +3 -0
  10. package/plugins/access/spaces/collections/profile.d.ts +61 -0
  11. package/plugins/access/spaces/collections/profile.js +41 -0
  12. package/plugins/access/spaces/contract.d.ts +6 -2
  13. package/plugins/access/spaces/contract.js +1 -0
  14. package/plugins/access/spaces/mod.d.ts +5 -0
  15. package/plugins/access/spaces/mod.js +13 -2
  16. package/plugins/access/spaces/processors/profile.d.ts +7 -0
  17. package/plugins/access/spaces/processors/profile.js +10 -0
  18. package/plugins/access/spaces/resources/commands.js +14 -4
  19. package/plugins/access/spaces/resources/tools.js +3 -1
  20. package/plugins/access/spaces/shared/labels.js +23 -3
  21. package/plugins/access/spaces/shared/names.d.ts +61 -0
  22. package/plugins/access/spaces/shared/names.js +77 -0
  23. package/plugins/access/spaces/shared/profile.d.ts +21 -0
  24. package/plugins/access/spaces/shared/profile.js +27 -0
  25. package/plugins/access/spaces/views/elsewhere.js +7 -3
  26. package/plugins/access/spaces/views/web/header.d.ts +3 -1
  27. package/plugins/access/spaces/views/web/header.js +5 -5
  28. package/plugins/access/spaces/views/web/invitation.d.ts +3 -1
  29. package/plugins/access/spaces/views/web/invitation.js +2 -2
  30. package/plugins/access/spaces/views/web/invitations.js +3 -1
  31. package/plugins/access/spaces/views/web/invited.js +3 -1
  32. package/plugins/access/spaces/views/web/inviting.js +5 -3
  33. package/plugins/access/spaces/views/web/members.js +25 -15
  34. package/plugins/access/spaces/views/web/org-members.d.ts +1 -1
  35. package/plugins/access/spaces/views/web/org-members.js +8 -7
  36. package/plugins/access/spaces/views/web/palette.js +8 -3
  37. package/plugins/access/spaces/views/web/panel.js +5 -4
  38. package/plugins/access/spaces/views/web/pending.d.ts +3 -1
  39. package/plugins/access/spaces/views/web/pending.js +5 -5
  40. package/plugins/access/spaces/views/web/space.js +9 -3
  41. package/plugins/access/spaces/views/web/spaces.js +3 -2
  42. package/plugins/access/spaces/views/web/tree.d.ts +3 -1
  43. package/plugins/access/spaces/views/web/tree.js +10 -9
  44. package/plugins/access/spaces/views/web/who.d.ts +14 -5
  45. package/plugins/access/spaces/views/web/who.js +25 -10
  46. package/plugins/access/spaces/views/where.js +9 -3
  47. package/plugins/agents/chat/views/message.js +7 -2
  48. package/plugins/agents/chat/views/participants.js +7 -1
  49. package/plugins/agents/chat/views/terminal/author.js +5 -1
  50. package/plugins/agents/chat/views/web/conversation.js +10 -2
  51. package/plugins/agents/chat/views/web/message.d.ts +1 -1
  52. package/plugins/agents/chat/views/web/message.js +4 -2
  53. package/plugins/agents/history/collections/summary.d.ts +1 -1
  54. package/plugins/agents/history/processors/compact.js +3 -1
  55. package/plugins/agents/history/resources/tools.js +4 -1
  56. package/plugins/agents/history/shared/lines.d.ts +5 -2
  57. package/plugins/agents/history/shared/lines.js +9 -2
  58. package/plugins/agents/history/views/history.js +5 -1
  59. package/plugins/agents/memory/processors/extract.js +7 -3
  60. package/plugins/agents/memory/resources/tools.js +11 -8
  61. package/plugins/agents/memory/shared/scope.d.ts +12 -3
  62. package/plugins/agents/memory/shared/scope.js +25 -6
  63. package/plugins/agents/memory/views/memory.d.ts +1 -0
  64. package/plugins/agents/memory/views/memory.js +4 -2
  65. package/plugins/agents/memory/views/terminal/memory.d.ts +4 -1
  66. package/plugins/agents/memory/views/terminal/memory.js +7 -2
  67. package/plugins/agents/memory/views/web/card.d.ts +4 -2
  68. package/plugins/agents/memory/views/web/card.js +4 -3
  69. package/plugins/agents/memory/views/web/list.d.ts +3 -1
  70. package/plugins/agents/memory/views/web/list.js +20 -9
  71. package/plugins/agents/memory/views/web/memories.js +5 -1
  72. package/plugins/agents/memory/views/web/pick.js +8 -5
  73. package/plugins/agents/routines/resources/tools.js +8 -5
  74. package/plugins/agents/routines/shared/fire.js +3 -1
  75. package/plugins/agents/routines/shared/routines.js +3 -1
  76. package/plugins/agents/routines/views/web/page.js +7 -4
  77. package/plugins/agents/routines/views/web/step.js +3 -1
  78. package/plugins/agents/skills/views/web/page.js +7 -3
  79. package/plugins/billing/usage/collections/rollup.d.ts +1 -1
  80. package/plugins/billing/usage/views/web/org.js +5 -4
  81. package/plugins/compute/apps/actions/build.js +7 -1
  82. package/plugins/compute/apps/actions/configure.d.ts +1 -0
  83. package/plugins/compute/apps/actions/configure.js +74 -0
  84. package/plugins/compute/apps/actions/publish.js +4 -0
  85. package/plugins/compute/apps/actions/remove.js +3 -1
  86. package/plugins/compute/apps/adapters/cloudrun.d.ts +5 -5
  87. package/plugins/compute/apps/adapters/cloudrun.js +28 -16
  88. package/plugins/compute/apps/adapters/front.d.ts +24 -0
  89. package/plugins/compute/apps/adapters/front.js +131 -0
  90. package/plugins/compute/apps/collections/app.d.ts +8 -1
  91. package/plugins/compute/apps/collections/app.js +2 -0
  92. package/plugins/compute/apps/contract.d.ts +4 -2
  93. package/plugins/compute/apps/mod.js +2 -0
  94. package/plugins/compute/apps/resources/tools.js +25 -5
  95. package/plugins/compute/apps/shared/environment.d.ts +8 -0
  96. package/plugins/compute/apps/shared/environment.js +15 -0
  97. package/plugins/compute/apps/shared/publish.d.ts +10 -0
  98. package/plugins/compute/apps/shared/publish.js +26 -2
  99. package/plugins/compute/apps/views/web/apps.d.ts +2 -0
  100. package/plugins/compute/apps/views/web/env.d.ts +54 -0
  101. package/plugins/compute/apps/views/web/env.js +195 -0
  102. package/plugins/compute/apps/views/web/publish.js +2 -0
  103. package/plugins/compute/apps/views/web/space.d.ts +5 -4
  104. package/plugins/compute/apps/views/web/space.js +22 -10
  105. package/plugins/compute/apps/views/web/style.d.ts +4 -3
  106. package/plugins/compute/apps/views/web/style.js +55 -2
  107. package/plugins/compute/apps/web.d.ts +3 -2
  108. package/plugins/compute/apps/web.js +6 -2
  109. package/plugins/compute/cloud/actions/create.js +9 -21
  110. package/plugins/compute/cloud/actions/may.d.ts +1 -0
  111. package/plugins/compute/cloud/actions/may.js +15 -0
  112. package/plugins/compute/cloud/actions/pool-tick.js +9 -4
  113. package/plugins/compute/cloud/actions/vms.d.ts +2 -0
  114. package/plugins/compute/cloud/actions/vms.js +17 -5
  115. package/plugins/compute/cloud/adapters/local.js +10 -1
  116. package/plugins/compute/cloud/collections/cloud-computer.d.ts +1 -1
  117. package/plugins/compute/cloud/collections/cloud-computer.js +8 -1
  118. package/plugins/compute/cloud/collections/pool-want.d.ts +94 -0
  119. package/plugins/compute/cloud/collections/pool-want.js +27 -0
  120. package/plugins/compute/cloud/mod.d.ts +5 -2
  121. package/plugins/compute/cloud/mod.js +13 -4
  122. package/plugins/compute/cloud/processors/mark.d.ts +9 -0
  123. package/plugins/compute/cloud/processors/mark.js +13 -0
  124. package/plugins/compute/cloud/shared/may.d.ts +13 -0
  125. package/plugins/compute/cloud/shared/may.js +23 -0
  126. package/plugins/compute/cloud/shared/records.d.ts +7 -0
  127. package/plugins/compute/cloud/shared/records.js +2 -0
  128. package/plugins/compute/cloud/views/web/cloud.d.ts +7 -1
  129. package/plugins/compute/cloud/views/web/cloud.js +10 -1
  130. package/plugins/compute/cloud/views/web/computer.d.ts +7 -1
  131. package/plugins/compute/cloud/views/web/computer.js +14 -4
  132. package/plugins/compute/cloud/views/web/new.d.ts +2 -0
  133. package/plugins/compute/cloud/views/web/new.js +9 -4
  134. package/plugins/compute/cloud/web.js +6 -0
  135. package/plugins/compute/computers/actions/allowed.js +3 -1
  136. package/plugins/compute/computers/actions/env.d.ts +3 -0
  137. package/plugins/compute/computers/actions/env.js +134 -0
  138. package/plugins/compute/computers/actions/mark.d.ts +1 -0
  139. package/plugins/compute/computers/actions/mark.js +36 -0
  140. package/plugins/compute/computers/actions/preview.d.ts +1 -4
  141. package/plugins/compute/computers/actions/preview.js +44 -15
  142. package/plugins/compute/computers/actions/provision.js +3 -1
  143. package/plugins/compute/computers/actions/scope.js +30 -10
  144. package/plugins/compute/computers/actions/work.js +6 -0
  145. package/plugins/compute/computers/collections/computer.d.ts +47 -1
  146. package/plugins/compute/computers/collections/computer.js +10 -0
  147. package/plugins/compute/computers/collections/desk.d.ts +38 -0
  148. package/plugins/compute/computers/collections/desk.js +6 -0
  149. package/plugins/compute/computers/collections/env-var.d.ts +122 -0
  150. package/plugins/compute/computers/collections/env-var.js +51 -0
  151. package/plugins/compute/computers/collections/preview.d.ts +3 -1
  152. package/plugins/compute/computers/collections/preview.js +8 -2
  153. package/plugins/compute/computers/contract.d.ts +14 -3
  154. package/plugins/compute/computers/contract.js +4 -3
  155. package/plugins/compute/computers/mod.d.ts +4 -1
  156. package/plugins/compute/computers/mod.js +13 -3
  157. package/plugins/compute/computers/program/version.d.ts +1 -1
  158. package/plugins/compute/computers/program/version.js +1 -1
  159. package/plugins/compute/computers/resources/commands.js +15 -8
  160. package/plugins/compute/computers/resources/downloads.js +1 -1
  161. package/plugins/compute/computers/resources/tools.d.ts +11 -5
  162. package/plugins/compute/computers/resources/tools.js +62 -16
  163. package/plugins/compute/computers/shared/ask.js +7 -3
  164. package/plugins/compute/computers/shared/asks.d.ts +2 -2
  165. package/plugins/compute/computers/shared/asks.js +3 -2
  166. package/plugins/compute/computers/shared/desks.d.ts +1 -1
  167. package/plugins/compute/computers/shared/desks.js +1 -0
  168. package/plugins/compute/computers/shared/env.d.ts +20 -0
  169. package/plugins/compute/computers/shared/env.js +50 -0
  170. package/plugins/compute/computers/shared/jobs.d.ts +13 -0
  171. package/plugins/compute/computers/shared/jobs.js +16 -0
  172. package/plugins/compute/computers/shared/preview-url.d.ts +5 -0
  173. package/plugins/compute/computers/shared/preview-url.js +5 -0
  174. package/plugins/compute/computers/shared/seal.d.ts +4 -0
  175. package/plugins/compute/computers/shared/seal.js +60 -0
  176. package/plugins/compute/computers/shared/settings.d.ts +5 -1
  177. package/plugins/compute/computers/shared/settings.js +1 -0
  178. package/plugins/compute/computers/shared/wake.d.ts +4 -4
  179. package/plugins/compute/computers/shared/wake.js +12 -10
  180. package/plugins/compute/computers/shared/where.d.ts +28 -7
  181. package/plugins/compute/computers/shared/where.js +76 -10
  182. package/plugins/compute/computers/shared/workloads.d.ts +4 -0
  183. package/plugins/compute/computers/views/context.d.ts +6 -3
  184. package/plugins/compute/computers/views/context.js +74 -6
  185. package/plugins/compute/computers/views/terminal/approvals.js +3 -1
  186. package/plugins/compute/computers/views/web/add.js +3 -1
  187. package/plugins/compute/computers/views/web/calls.js +2 -1
  188. package/plugins/compute/computers/views/web/computer.js +9 -1
  189. package/plugins/compute/computers/views/web/desks.d.ts +6 -3
  190. package/plugins/compute/computers/views/web/desks.js +22 -15
  191. package/plugins/compute/computers/views/web/env.d.ts +32 -0
  192. package/plugins/compute/computers/views/web/env.js +154 -0
  193. package/plugins/compute/computers/views/web/environment.d.ts +23 -0
  194. package/plugins/compute/computers/views/web/environment.js +47 -0
  195. package/plugins/compute/computers/views/web/jobs.d.ts +7 -4
  196. package/plugins/compute/computers/views/web/jobs.js +28 -13
  197. package/plugins/compute/computers/views/web/kinds.d.ts +24 -2
  198. package/plugins/compute/computers/views/web/kinds.js +10 -0
  199. package/plugins/compute/computers/views/web/names.d.ts +3 -2
  200. package/plugins/compute/computers/views/web/names.js +5 -3
  201. package/plugins/compute/computers/views/web/page.d.ts +3 -1
  202. package/plugins/compute/computers/views/web/page.js +2 -2
  203. package/plugins/compute/computers/views/web/previews.d.ts +2 -7
  204. package/plugins/compute/computers/views/web/previews.js +0 -14
  205. package/plugins/compute/computers/views/web/serve.d.ts +6 -4
  206. package/plugins/compute/computers/views/web/serve.js +12 -48
  207. package/plugins/compute/computers/views/web/space-tab.d.ts +1 -1
  208. package/plugins/compute/computers/views/web/space-tab.js +23 -7
  209. package/plugins/compute/computers/views/web/step.js +7 -1
  210. package/plugins/compute/computers/views/web/style.d.ts +1 -1
  211. package/plugins/compute/computers/views/web/style.js +58 -0
  212. package/plugins/compute/computers/views/web/workspace.d.ts +4 -2
  213. package/plugins/compute/computers/views/web/workspace.js +3 -2
  214. package/plugins/compute/computers/web.d.ts +6 -4
  215. package/plugins/compute/computers/web.js +9 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,108 @@
1
+ ## 1.0.0-rc.7 — 2026-10-30
2
+
3
+ - **Agents choose among a space's computers.** Every computer tool (the terminal, jobs, files, the
4
+ browser, web search, `preview`, and the apps' `publish`) takes `computer`: one of the space's
5
+ computers by its name (any case, or part of it when only one has it) or its id; the space's
6
+ default otherwise. An unknown or ambiguous name, or a computer that's offline, is told with the
7
+ ones to choose from; naming a cloud computer that's asleep wakes it. Each turn, an agent's context
8
+ lists the space's computers (whose, a cloud computer or a machine, how it is now, its system, what
9
+ it asks first, the default marked) when there are several; one stays as it was. In a space with
10
+ several, an answer says the computer it came from (`computer`), and the web's tool steps show it.
11
+ - **A job is found on whichever computer runs it:** `computer.preview` and `computer.scope` (and so
12
+ `app.publish` and the agents' `preview` and `publish`) take a job without a computer and look for
13
+ it on the space's computers that are online, the default first. `computer.preview`,
14
+ `computer.scope`, `computer.allowed` and `app.publish` take `computer` (a name or an id).
15
+ - **The default computer** is named so on the web (a "Default" badge, "Make it the default") and in
16
+ `/computers`.
17
+ - **Apps: what serves a preview serves the app.** A folder with no Dockerfile is built into an image
18
+ made for it (no more buildpacks, which found nothing to build in a plain folder): the computer's
19
+ system (Debian 12) with Node.js 24 and Python, the folder as it was sent, its dependencies
20
+ installed again (npm, pnpm, yarn; `requirements.txt`) and its `build` script run, then its job's
21
+ command behind a front that passes the platform's port on to the job's port on localhost,
22
+ WebSockets included. A job bound to `127.0.0.1` (as previews allow) is served all the same; the
23
+ job is given its own port as `PORT`. `AppHost.build` answers the port its image serves on. Without
24
+ a Dockerfile, an app is published from its job (its command).
25
+ - **A space's environment: variables and secrets.** Each space has its own (collection `envVar`,
26
+ `{ name, value, secret, computers, by, at }`, names like `API_URL`). Its managers change it
27
+ (`env.set` `{ in, name, value?, secret?, computers? }`, `env.unset`); its members read names and
28
+ the values of variables. A secret is sealed at rest (AES-GCM, with the new `computers: { key }`
29
+ resource, else kept as given) and never read back by anyone: people see only that it's there (and
30
+ a long one's last 4 characters), agents only its name. Every job and shell started in the space,
31
+ from the web or by an agent, gets the variables with `computers` (true unless said), under its own
32
+ `env` (`jobs.start` and `terminal` take `env`; the `start_job` tool too); a job kept running keeps
33
+ its env on the computer's disk and starts again with it. A secret given to computers can be read
34
+ by any process there, and the web says so where it's given. Agents' computer context lists the
35
+ names they have (`$NAME`), never a value.
36
+ - **Apps get the space's environment.** An app is deployed with all of its space's variables and
37
+ secrets, and its own over them (`envVar` with `app`; queries `here` and `apps`), passed to Cloud
38
+ Run as its env. `app.configure` `{ app, env? }` (its publisher, or the space's managers) changes
39
+ its own and deploys its image again with them, without a build (the port the image serves is kept
40
+ as `served`). A change to the space's environment doesn't redeploy anything: it reaches an app
41
+ when it's published again, or at once with "Apply to apps". Taking an app down removes its own
42
+ environment (`env.unset` `{ in, app }`).
43
+ - **Web: Environment.** A space's Environment tab lists its variables (a secret masked, whether its
44
+ computers get it, who set it and when); its managers add, change and remove them, with the honest
45
+ limit shown beside a secret given to computers. Under it, its live apps and "Apply to apps"
46
+ (through computers' new `envActions` resource). An app's row opens its environment: the space's
47
+ shown, its own edited, saved with a redeploy. The job start form takes its own environment
48
+ (`NAME=value` lines). The toolkit's `Time` also draws on a server.
49
+ - **People by name, everywhere:** agents' prompts, notes, the terminal and the web show a person's
50
+ name where they showed their id (`google:1139…`). The spaces plugin keeps each person's profile
51
+ (collection `profile`: their name as sign-in verified it, else their email's name, and picture;
52
+ never their email), from the identity plugin's `person` as it changes, at `org.join`, and on
53
+ `space.personal` (each page load), so people known before it get one the next time they come.
54
+ Anyone in the org reads names through the query `profile.names` `{ ids }` (a browser reads
55
+ profiles only through it); two people of one name stay apart ("Ana (2762)"). The new `names`
56
+ resource says where names are (`{ collection: "profile" }`), and the spaces contract (and
57
+ `copilotz/plugins/access`) gives `nameOf`, `namesOf`, `namesIn` (Views), `namesFor` (Actions,
58
+ Processors, tools), `withNames`, `idsIn` and `PROFILE`. A sign-in's id is never shown as a name:
59
+ without a profile, it's "someone".
60
+ - **Agents' prompts:** others' messages read "Ana Lima: …", "People here:" names people, a
61
+ conversation's space is "Ana Lima's Personal space", the computers context says whose computer it
62
+ is and who says yes by name, as do waiting asks, routines (who made one, whom it runs as), history
63
+ summaries and zoom, and recall. Memory extraction writes names, and `remember`'s `about` takes a
64
+ person by name.
65
+ - **Notes and summaries written before names:** a memory or a summary that says someone's id
66
+ (`google:1139…'s cloud computer…`) reads with their name wherever it shows (prompts, recall, the
67
+ Memories page, the terminal), substituted when it's shown: nothing stored is changed, and nothing
68
+ needs migrating.
69
+ - **The web:** the Members tab (people, requests to join, invitations), the space header's faces,
70
+ other people's Personal spaces ("Ana Lima's Personal"), invitations ("Ana Lima invited you"), chat
71
+ messages and the conversation's people, memories (grouped, by whom, search), routines, skills
72
+ ("Made by"), apps ("by"), computers (whose each is, who asks first, who started a job or made a
73
+ preview), usage and the org's people show names. **The terminal:** `/computers`, `/approvals`,
74
+ `/requests`, `/grant`, `/invitations`, memories and messages, likewise; `/remove` takes a person's
75
+ id with a colon (`google:1139…`).
76
+ - **Share refusals** name the spaces a write would reveal ("Ana Lima's Personal space"), not their
77
+ ids. An org invitation made by a space invitation says who invited them.
78
+
79
+ ## 1.0.0-rc.6 — 2026-10-30
80
+
81
+ - **Computer program:** an app on another machine over plain `ws:` (an `http://` address that isn't
82
+ localhost) fails at once, saying to use https, instead of waiting to connect forever: Oxian
83
+ refuses plain `ws:` but to this machine.
84
+ - **Cloud pools:** a pool grown for a wake isn't shrunk while its VM boots. `pool.take` records what
85
+ it waits for (`poolWant`), and `pool.tick` sizes each pool to its floor, the takes of the last 2
86
+ minutes and the wakes still waiting. Before, the next minute's sizing set the pool back to its
87
+ floor, deleting the VM a wake had grown it for before it connected.
88
+ - **Cloud computers:** `cloudComputer.sizes` also says whether the person asking may make one now
89
+ (`create`, and `why` not: `admins`, `budget`), and the warm and view minutes; `cloud.may` says
90
+ just that. The web's "Use a cloud computer" choice shows why it can't be picked, and the copy says
91
+ the app's minutes.
92
+ - **Cloud computers shared into a space:** each computer's state is kept on it and its desks
93
+ (`status`: `{ kind: "cloud", state, size }`, set with the new system Action `computer.mark`, as
94
+ the cloud plugin sees it change), so the space's members see how anyone's is (asleep, waking,
95
+ awake), not "offline".
96
+ - **Previews:** `preview.here` records carry their address (`url`); the web no longer works it out.
97
+ `computer.preview` and `computer.scope` take a `desk` (one of the space's), and so does
98
+ `app.publish`: the web makes previews and publishes apps from the computer it's on, not the
99
+ space's default.
100
+ - **Apps:** an agent's `publish` asks its person with where the app will be ("wants to publish Shop
101
+ at https://shop.copilotz.app").
102
+ - **`org.me`** isn't recorded (it only reads), so reads (queries, Views) ask it too.
103
+ - **The local cloud host** is one per app and account, whichever executor asks: with several
104
+ executors, a VM one started was turned away by another.
105
+
1
106
  ## 1.0.0-rc.5 — 2026-10-30
2
107
 
3
108
  - **Cloud computers** (plugin `cloud`, see design/cloud-computers.md): computers the app hosts for
package/README.md CHANGED
@@ -22,7 +22,7 @@ bun add copilotz # Bun
22
22
  deno add jsr:@copilotz/copilotz # Deno (or `deno add npm:copilotz`)
23
23
  ```
24
24
 
25
- On Deno, name it `copilotz` in `deno.json` (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.5"`), and
25
+ On Deno, name it `copilotz` in `deno.json` (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.7"`), and
26
26
  the imports below are the same everywhere. Some pieces need a package of their own, installed beside
27
27
  it: `esbuild` to bundle the web host on Node, `@electric-sql/pglite` for PostgreSQL in the process,
28
28
  and `@types/react` for the front ends' types.
@@ -204,7 +204,7 @@ and an app serves it from there by default:
204
204
  import { computerDownloads } from "copilotz/plugins/compute/downloads";
205
205
 
206
206
  plugins: [...plugins, await computerDownloads()], // this Copilotz's release
207
- plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.5" })], // its own: /computer/download/
207
+ plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.7" })], // its own: /computer/download/
208
208
  plugins: [...plugins, await computerDownloads({ url: "https://downloads.example.com/computer/" })], // or elsewhere
209
209
  ```
210
210
 
@@ -29,7 +29,8 @@ const subscribe = (listener) => {
29
29
  };
30
30
  };
31
31
  export function Time({ at, long, className }) {
32
- useSyncExternalStore(subscribe, () => tick);
32
+ // Drawn on a server too (the time as it is then).
33
+ useSyncExternalStore(subscribe, () => tick, () => tick);
33
34
  const date = new Date(at);
34
35
  if (Number.isNaN(date.getTime()))
35
36
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilotz",
3
- "version": "1.0.0-rc.5",
3
+ "version": "1.0.0-rc.7",
4
4
  "description": "Copilotz: one runtime for Node, Deno, Bun, Cloudflare Workers and the browser.",
5
5
  "keywords": [
6
6
  "agents",
@@ -93,8 +93,8 @@ export declare const account: {
93
93
  private?: string[];
94
94
  queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
95
95
  [x: string]: unknown;
96
- problem?: string | undefined;
97
96
  rev?: number | undefined;
97
+ problem?: string | undefined;
98
98
  expires?: string | undefined;
99
99
  plan?: string | undefined;
100
100
  refreshed?: string | undefined;
@@ -114,16 +114,16 @@ export declare const org: {
114
114
  private?: string[];
115
115
  queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
116
116
  [x: string]: unknown;
117
+ suspended?: boolean | undefined;
117
118
  summary?: {
118
119
  [x: string]: unknown;
119
120
  at?: string | undefined;
120
- people?: number | undefined;
121
121
  spaces?: number | undefined;
122
122
  active?: string | undefined;
123
+ people?: number | undefined;
123
124
  } | undefined;
124
- suspended?: boolean | undefined;
125
125
  at: string;
126
- kind: "team" | "personal";
126
+ kind: "personal" | "team";
127
127
  by: string;
128
128
  name: string;
129
129
  placement: {
@@ -8,6 +8,7 @@
8
8
  import { defineAction } from "../../../../runtime/mod.js";
9
9
  import { joinable } from "../shared/personal.js";
10
10
  import { memberKey, orgRoleOf, reachOf, ROLES } from "../shared/reach.js";
11
+ import { namesFor } from "../shared/names.js";
11
12
  /** An email address, as invitations hold it. */
12
13
  const EMAIL = /^[^\s@]+@[^\s@]+$/;
13
14
  const refused = (code, message) => Object.assign(new Error(message), { code });
@@ -79,7 +80,9 @@ async function joinsTheOrg(ctx, email) {
79
80
  return;
80
81
  if ((await directory.invites()).some((waiting) => waiting.email === email))
81
82
  return;
82
- await directory.invite({ email, role: "guest", by: ctx.actor.id });
83
+ // Who invited them, by name: what the org's invitation says.
84
+ const [from] = Object.values(await namesFor(ctx, [ctx.actor.id]));
85
+ await directory.invite({ email, role: "guest", by: ctx.actor.id, ...(from ? { from } : {}) });
83
86
  }
84
87
  export const acceptInvitationAction = defineAction({
85
88
  description: "Joins the space an invitation to your email is for",
@@ -10,6 +10,7 @@
10
10
  import { defineAction } from "../../../../runtime/mod.js";
11
11
  import { ORG, ORG_ROLES, orgRoleOf } from "../shared/reach.js";
12
12
  import { ROLES } from "../shared/reach.js";
13
+ import { keepProfileOf } from "../shared/profile.js";
13
14
  const forbidden = (message) => Object.assign(new Error(message), { code: "forbidden" });
14
15
  const invalid = (message) => Object.assign(new Error(message), { code: "invalid" });
15
16
  const role = { type: "string", enum: [...ORG_ROLES] };
@@ -45,6 +46,8 @@ export const joinOrgAction = defineAction({
45
46
  run: async (ctx, input) => {
46
47
  const held = await orgRoleOf({ kind: "person", id: input.person }, ctx.as());
47
48
  // The role given is for joining: coming back keeps the role they have (`org.role` changes it).
49
+ // How they show, kept (people from before profiles, too).
50
+ await keepProfileOf(ctx, input.person);
48
51
  if (held)
49
52
  return { role: held };
50
53
  await join(ctx, input.person, input.role ?? "member");
@@ -64,7 +67,7 @@ export const orgRoleAction = defineAction({
64
67
  const mine = await runs(ctx);
65
68
  const theirs = await orgRoleOf({ kind: "person", id: input.person }, ctx.as());
66
69
  if (!theirs)
67
- throw invalid(`${input.person} isn't in this org.`);
70
+ throw invalid("They aren't in this org.");
68
71
  if ((input.role === "owner" || theirs === "owner") && mine !== "owner" && mine !== "staff") {
69
72
  throw forbidden("Only owners make or unmake owners.");
70
73
  }
@@ -87,7 +90,7 @@ export const removeFromOrgAction = defineAction({
87
90
  const mine = await runs(ctx);
88
91
  const theirs = await orgRoleOf({ kind: "person", id: input.person }, ctx.as());
89
92
  if (!theirs)
90
- throw invalid(`${input.person} isn't in this org.`);
93
+ throw invalid("They aren't in this org.");
91
94
  if (theirs === "owner" && mine !== "owner" && mine !== "staff") {
92
95
  throw forbidden("Only owners take an owner out.");
93
96
  }
@@ -124,6 +127,8 @@ export const removeFromOrgAction = defineAction({
124
127
  export const orgMeAction = defineAction({
125
128
  description: "Your standing in the org: your role, whether you're platform staff, and the org (in an app " +
126
129
  "serving many)",
130
+ // Only reads: not recorded, so reads (a query, a View) ask it too.
131
+ record: false,
127
132
  input: { type: "object", additionalProperties: false },
128
133
  allow: (actor) => actor.kind === "person",
129
134
  run: async (ctx) => ({
@@ -3,6 +3,7 @@ import { defineAction } from "../../../../runtime/mod.js";
3
3
  import { PERSONAL } from "../shared/personal.js";
4
4
  import { seat } from "../shared/agents.js";
5
5
  import { memberKey } from "../shared/reach.js";
6
+ import { keepProfileOf } from "../shared/profile.js";
6
7
  export const personalAction = defineAction({
7
8
  description: "Your Personal space, where what you make alone lives",
8
9
  input: { type: "object", additionalProperties: false },
@@ -29,6 +30,8 @@ export const personalAction = defineAction({
29
30
  });
30
31
  });
31
32
  }
33
+ // Pages ask this as they open: how they show is kept (from before profiles, too).
34
+ await keepProfileOf(ctx, ctx.actor.id);
32
35
  return { space: id };
33
36
  },
34
37
  });
@@ -0,0 +1,61 @@
1
+ /**
2
+ * How people show, to everyone in the org (people and agents alike): their
3
+ * name, and picture (collection `profile`, its `_id` the person's id). Kept
4
+ * from what sign-in verified (the identity plugin's `person`, whose emails
5
+ * stay their own): a person's id is what everything they do records, and
6
+ * this is what's shown in its place, in pages and in agents' prompts. Only
7
+ * the system writes it.
8
+ */
9
+ import { type Infer } from "../../../../runtime/mod.js";
10
+ declare const profileSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ /** Their name as they signed in; else their email's name (before the `@`). */
14
+ readonly name: {
15
+ readonly type: "string";
16
+ };
17
+ readonly picture: {
18
+ readonly type: "string";
19
+ };
20
+ readonly at: {
21
+ readonly type: "string";
22
+ };
23
+ };
24
+ readonly required: readonly ["at"];
25
+ };
26
+ export declare const profile: {
27
+ schema: {
28
+ readonly type: "object";
29
+ readonly properties: {
30
+ /** Their name as they signed in; else their email's name (before the `@`). */
31
+ readonly name: {
32
+ readonly type: "string";
33
+ };
34
+ readonly picture: {
35
+ readonly type: "string";
36
+ };
37
+ readonly at: {
38
+ readonly type: "string";
39
+ };
40
+ };
41
+ readonly required: readonly ["at"];
42
+ };
43
+ events?: boolean;
44
+ records?: boolean;
45
+ durable?: false;
46
+ indexes?: string[][];
47
+ private?: string[];
48
+ queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
49
+ [x: string]: unknown;
50
+ name?: string | undefined;
51
+ picture?: string | undefined;
52
+ at: string;
53
+ } & {
54
+ _id: string;
55
+ }>> | undefined;
56
+ vectors?: string[];
57
+ };
58
+ export type Profile = Infer<typeof profileSchema> & {
59
+ _id: string;
60
+ };
61
+ export {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * How people show, to everyone in the org (people and agents alike): their
3
+ * name, and picture (collection `profile`, its `_id` the person's id). Kept
4
+ * from what sign-in verified (the identity plugin's `person`, whose emails
5
+ * stay their own): a person's id is what everything they do records, and
6
+ * this is what's shown in its place, in pages and in agents' prompts. Only
7
+ * the system writes it.
8
+ */
9
+ import { defineCollection } from "../../../../runtime/mod.js";
10
+ import { namesOf, peopleIn } from "../shared/names.js";
11
+ const profileSchema = {
12
+ type: "object",
13
+ properties: {
14
+ /** Their name as they signed in; else their email's name (before the `@`). */
15
+ name: { type: "string" },
16
+ picture: { type: "string" },
17
+ at: { type: "string" },
18
+ },
19
+ required: ["at"],
20
+ };
21
+ export const profile = defineCollection({
22
+ schema: profileSchema,
23
+ queries: {
24
+ /**
25
+ * Names by id (`{ ids }`, a member key `person:<id>` too): what shows
26
+ * people, wherever (Views, pages, a terminal's commands); a browser reads
27
+ * profiles only through it.
28
+ */
29
+ names: {
30
+ allow: (actor) => actor.kind === "person" || actor.kind === "agent",
31
+ run: async (profiles, params) => {
32
+ const given = Array.isArray(params?.ids) ? params.ids : [];
33
+ const ids = peopleIn(given.filter((id) => typeof id === "string"))
34
+ .slice(0, 500);
35
+ if (!ids.length)
36
+ return {};
37
+ return namesOf(await profiles.find({ _id: { $in: ids } }));
38
+ },
39
+ },
40
+ },
41
+ });
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * The spaces plugin's contract: what plugins built on spaces may import from
3
3
  * it: the shapes of its documents (a space, a membership, a request to join,
4
- * an invitation) and of the resource kinds its web front end reads. They
4
+ * an invitation, a person's profile) and of the resource kinds its web front
5
+ * end reads, and how people show by name (`PROFILE`, `nameOf`, `namesOf`,
6
+ * `withNames`: wherever a person's id would show, their name does). They
5
7
  * reach the rest by name: its collections (`space`, `member`, `request`,
6
- * `invitation`), its queries `space.reached` (each space with what the asker
8
+ * `invitation`, `profile`), its queries `space.reached` (each space with what the asker
7
9
  * may do there) and `invitation.mine` (those to the asker's email), and its
8
10
  * Actions (`space.create`, `space.personal`, `space.rename`, `space.can`,
9
11
  * `space.leave`, `space.archive`, `space.agent`, `member.set`,
@@ -43,6 +45,8 @@ export type { Member } from "./collections/member.js";
43
45
  export type { Invitation } from "./collections/invitation.js";
44
46
  export type { Request } from "./collections/request.js";
45
47
  export type { Verb } from "./shared/reach.js";
48
+ export type { Profile } from "./collections/profile.js";
49
+ export { idsIn, nameOf, namesFor, namesIn, namesOf, type NamesResource, PROFILE, withNames, } from "./shared/names.js";
46
50
  export { PERSONAL } from "./shared/personal.js";
47
51
  export { AGENT_ROLES } from "./views/web/who.js";
48
52
  /** A `spaceTabs` resource: a tab on a space's page and in its side panel. */
@@ -1,2 +1,3 @@
1
+ export { idsIn, nameOf, namesFor, namesIn, namesOf, PROFILE, withNames, } from "./shared/names.js";
1
2
  export { PERSONAL } from "./shared/personal.js";
2
3
  export { AGENT_ROLES } from "./views/web/who.js";
@@ -27,6 +27,10 @@
27
27
  * a collection with `labels: true`), and only those who reach them all
28
28
  * read it until someone who does `share`s it. An agent writing it
29
29
  * anywhere else is refused (`needs_share`).
30
+ * - **People by name:** each person's profile (collection `profile`: their
31
+ * name and picture, as sign-in verified them, kept as it changes), which
32
+ * anyone in the org reads; wherever an id would show, the name does
33
+ * (`nameOf`, `withNames` in the contract).
30
34
  * - **Where you are:** with the chat plugin, agents are told the space a
31
35
  * conversation is in, its members and what it draws on (`where` context),
32
36
  * and each turn, the other spaces they can read for their person
@@ -47,6 +51,7 @@ export type { Member } from "./collections/member.js";
47
51
  export type { Reached, Space } from "./collections/space.js";
48
52
  export type { SpaceInvite, SpaceSidebar, SpaceTab } from "./contract.js";
49
53
  export type { Request } from "./collections/request.js";
54
+ export { idsIn, nameOf, namesFor, namesIn, namesOf, type NamesResource, PROFILE, withNames, } from "./shared/names.js";
50
55
  export { memberKey, ORG, ORG_ROLES, type OrgRole, orgRoleOf, type Reach, reachOf, ROLES, type Verb, } from "./shared/reach.js";
51
56
  export type { Shared } from "./shared/rules.js";
52
57
  export declare const spaces: Plugin;
@@ -27,6 +27,10 @@
27
27
  * a collection with `labels: true`), and only those who reach them all
28
28
  * read it until someone who does `share`s it. An agent writing it
29
29
  * anywhere else is refused (`needs_share`).
30
+ * - **People by name:** each person's profile (collection `profile`: their
31
+ * name and picture, as sign-in verified them, kept as it changes), which
32
+ * anyone in the org reads; wherever an id would show, the name does
33
+ * (`nameOf`, `withNames` in the contract).
30
34
  * - **Where you are:** with the chat plugin, agents are told the space a
31
35
  * conversation is in, its members and what it draws on (`where` context),
32
36
  * and each turn, the other spaces they can read for their person
@@ -61,14 +65,19 @@ import { tools } from "./resources/tools.js";
61
65
  import { space } from "./collections/space.js";
62
66
  import { rules } from "./shared/rules.js";
63
67
  import { agentGoneProcessor } from "./processors/agent-gone.js";
68
+ import { profileProcessor } from "./processors/profile.js";
69
+ import { profile } from "./collections/profile.js";
70
+ import { PROFILE } from "./shared/names.js";
64
71
  import { elsewhereView } from "./views/elsewhere.js";
65
72
  import { whereView } from "./views/where.js";
73
+ // People by name, wherever an id would show (see shared/names.ts).
74
+ export { idsIn, nameOf, namesFor, namesIn, namesOf, PROFILE, withNames, } from "./shared/names.js";
66
75
  export { memberKey, ORG, ORG_ROLES, orgRoleOf, reachOf, ROLES, } from "./shared/reach.js";
67
76
  export const spaces = definePlugin({
68
77
  name: "spaces",
69
78
  // Invitations match people by the email they signed in with.
70
79
  requires: ["identity"],
71
- collections: { space, member, request, invitation },
80
+ collections: { space, member, request, invitation, profile },
72
81
  actions: {
73
82
  "space.create": createAction,
74
83
  "space.personal": personalAction,
@@ -110,7 +119,9 @@ export const spaces = definePlugin({
110
119
  tools,
111
120
  // Who works in a space, for chat: its agents.
112
121
  roster: { spaces: { action: "space.roster" } },
122
+ // Where people's names are, for whatever shows a person (pages, agents' prompts).
123
+ names: { collection: PROFILE },
113
124
  },
114
- processors: { "spaces.agentGone": agentGoneProcessor },
125
+ processors: { "spaces.agentGone": agentGoneProcessor, "spaces.profile": profileProcessor },
115
126
  });
116
127
  export default spaces;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A person's profile follows what sign-in verified about them (the identity
3
+ * plugin's `person`, as a sign-in or an org's door sets it): their name,
4
+ * their picture. In order, per person.
5
+ */
6
+ import type { ProcessorDef } from "../../../../runtime/mod.js";
7
+ export declare const profileProcessor: ProcessorDef;
@@ -0,0 +1,10 @@
1
+ import { keepProfile } from "../shared/profile.js";
2
+ export const profileProcessor = {
3
+ on: ["person.created", "person.updated"],
4
+ key: (event) => String(event.data._id),
5
+ run: async (ctx, event) => {
6
+ const doc = event.data.doc;
7
+ if (doc?._id)
8
+ await keepProfile(ctx, doc);
9
+ },
10
+ };
@@ -8,6 +8,11 @@
8
8
  * Maya: what it does` makes one here, `/default maya` has it answer new chats.
9
9
  */
10
10
  import { command, dim } from "../../../../hosts/terminal/mod.js";
11
+ import { nameOf } from "../shared/names.js";
12
+ /** People by name, as their profiles say. */
13
+ const namesOf = (term, ids) => ids.length
14
+ ? term.runtime.query("profile.names", { ids })
15
+ : Promise.resolve({});
11
16
  export const commands = {
12
17
  "/spaces": command({
13
18
  description: "The spaces you reach (● where you work)",
@@ -53,7 +58,8 @@ export const commands = {
53
58
  await term.set({ listed: open.map((r) => r._id) });
54
59
  if (!open.length)
55
60
  return await term.print(dim("No requests."));
56
- await term.print(open.map((r, i) => `${dim(`[${i + 1}]`)} ${r.member.split(":")[1]} → ${r.space} ${dim(`(${r.by ?? "themselves"}: ${r.reason ?? "no reason given"})`)}`).join("\n") + `\n${dim("/grant <n> [role] lets them in; /deny <n> doesn't.")}`);
61
+ const names = await namesOf(term, open.flatMap((r) => [r.member, ...(r.by ? [r.by] : [])]));
62
+ await term.print(open.map((r, i) => `${dim(`[${i + 1}]`)} ${nameOf(r.member, names)} → ${r.space} ${dim(`(${r.by ? nameOf(r.by, names) : "themselves"}: ${r.reason ?? "no reason given"})`)}`).join("\n") + `\n${dim("/grant <n> [role] lets them in; /deny <n> doesn't.")}`);
57
63
  },
58
64
  }),
59
65
  "/grant": command({
@@ -68,7 +74,7 @@ export const commands = {
68
74
  id,
69
75
  ...(role ? { role } : {}),
70
76
  });
71
- await term.print(dim(`${granted.split(":")[1]} is in.`));
77
+ await term.print(dim(`${nameOf(granted, await namesOf(term, [granted]))} is in.`));
72
78
  },
73
79
  }),
74
80
  "/deny": command({
@@ -108,7 +114,10 @@ export const commands = {
108
114
  const who = rest.trim();
109
115
  if (!who || !space)
110
116
  return await term.print(dim("Usage: /remove agent:<name>, in a space."));
111
- const [kind, id] = who.includes(":") ? who.split(":", 2) : ["person", who];
117
+ // A person's own id may have a colon too (`google:1139…`).
118
+ const [kind, id] = who.startsWith("agent:") || who.startsWith("person:")
119
+ ? [who.slice(0, who.indexOf(":")), who.slice(who.indexOf(":") + 1)]
120
+ : ["person", who];
112
121
  await term.runtime.call("member.remove", { space, member: { kind, id } });
113
122
  await term.print(dim(`${id} is out of this space.`));
114
123
  },
@@ -171,7 +180,8 @@ export const commands = {
171
180
  await term.set({ listed: mine.map((i) => i._id) });
172
181
  if (!mine.length)
173
182
  return await term.print(dim("No invitations."));
174
- await term.print(mine.map((i, n) => `${dim(`[${n + 1}]`)} ${i.name} ${dim(`(${i.role}, from ${i.by.split(":")[1]})`)}`).join("\n") + `\n${dim("/accept <n> joins; /decline <n> doesn't.")}`);
183
+ const names = await namesOf(term, mine.map((i) => i.by));
184
+ await term.print(mine.map((i, n) => `${dim(`[${n + 1}]`)} ${i.name} ${dim(`(${i.role}, from ${nameOf(i.by, names)})`)}`).join("\n") + `\n${dim("/accept <n> joins; /decline <n> doesn't.")}`);
175
185
  },
176
186
  }),
177
187
  "/accept": command({
@@ -1,5 +1,6 @@
1
1
  import { PERSONAL } from "../shared/personal.js";
2
2
  import { memberKey } from "../shared/reach.js";
3
+ import { nameOf, namesFor } from "../shared/names.js";
3
4
  export const tools = {
4
5
  request_access: {
5
6
  offer: true,
@@ -31,7 +32,8 @@ export const tools = {
31
32
  at: new Date().toISOString(),
32
33
  },
33
34
  }, { upsert: true });
34
- return `Asked ${found.name}'s managers to let ${who.id} in. They'll decide; nothing ` +
35
+ const named = who.kind === "person" ? nameOf(who.id, await namesFor(ctx, [who.id])) : who.id;
36
+ return `Asked ${found.name}'s managers to let ${named} in. They'll decide; nothing ` +
35
37
  "changes until they do.";
36
38
  },
37
39
  },
@@ -1,7 +1,26 @@
1
1
  import { reachOf } from "./reach.js";
2
+ import { nameOf, namesOf, PROFILE } from "./names.js";
2
3
  const sharedOf = (ctx) => (ctx.resources.shared ?? {});
3
- const needsShare = (from) => Object.assign(new Error(`That would show what came from ${from.join(", ")} to people who can't see it: ` +
4
+ const needsShare = (from, named) => Object.assign(new Error(`That would show what came from ${named.join(", ")} to people who can't see it: ` +
4
5
  "a person who can has to share it."), { code: "needs_share", sources: from });
6
+ /** Spaces as people say them: by name; a Personal space as its owner's (by their name). */
7
+ async function described(ids, ctx) {
8
+ const spaces = await ctx.db.collection("space").find({ _id: { $in: ids } });
9
+ const owners = spaces.flatMap((s) => s.kind === "personal" && s.owner ? [s.owner] : []);
10
+ const names = owners.length
11
+ ? namesOf(await ctx.db.collection(PROFILE).find({
12
+ _id: { $in: owners },
13
+ }))
14
+ : {};
15
+ return ids.map((id) => {
16
+ const space = spaces.find((s) => s._id === id);
17
+ if (!space)
18
+ return "another space";
19
+ return space.kind === "personal" && space.owner
20
+ ? `${nameOf(space.owner, names)}'s Personal space`
21
+ : space.name;
22
+ });
23
+ }
5
24
  /** What a space's members all see, besides it: the spaces it draws on. */
6
25
  const covered = async (space, ctx) => new Set([space, ...(await reachOf({ kind: "space", id: space }, ctx)).keys()]);
7
26
  export const labels = {
@@ -26,8 +45,9 @@ export const labels = {
26
45
  if (!foreign.length)
27
46
  return doc;
28
47
  const elsewhere = typeof actor.at === "string" && actor.at !== space;
29
- if (actor.kind === "agent" && (elsewhere || !shared.labels))
30
- throw needsShare(foreign);
48
+ if (actor.kind === "agent" && (elsewhere || !shared.labels)) {
49
+ throw needsShare(foreign, await described(foreign, ctx));
50
+ }
31
51
  if (!shared.labels)
32
52
  return doc;
33
53
  const sources = [...new Set([...(doc.sources ?? []), ...foreign])].sort();