copilotz 1.0.0-rc.57 → 1.0.0-rc.59

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 (70) hide show
  1. package/AGENTS.md +4 -4
  2. package/CHANGELOG.md +77 -0
  3. package/README.md +2 -2
  4. package/hosts/web/pt-br/computers.d.ts +3 -2
  5. package/hosts/web/pt-br/computers.js +98 -0
  6. package/package.json +1 -1
  7. package/plugins/access/spaces/views/web/words.d.ts +1 -1
  8. package/plugins/agents/chat/actions/send.d.ts +1 -1
  9. package/plugins/agents/chat/actions/send.js +1 -1
  10. package/plugins/agents/chat/collections/message.d.ts +1 -1
  11. package/plugins/agents/chat/contract.d.ts +1 -1
  12. package/plugins/agents/chat/contract.js +1 -1
  13. package/plugins/agents/chat/processors/failed.d.ts +1 -1
  14. package/plugins/agents/chat/processors/failed.js +12 -2
  15. package/plugins/agents/chat/processors/turn.d.ts +15 -1
  16. package/plugins/agents/chat/processors/turn.js +5 -3
  17. package/plugins/agents/chat/views/message.js +9 -8
  18. package/plugins/billing/usage/views/web/words.d.ts +1 -1
  19. package/plugins/compute/computers/actions/upload.d.ts +1 -0
  20. package/plugins/compute/computers/actions/upload.js +35 -0
  21. package/plugins/compute/computers/actions/work.js +9 -23
  22. package/plugins/compute/computers/adapters/engine.js +4 -0
  23. package/plugins/compute/computers/collections/preview.d.ts +1 -1
  24. package/plugins/compute/computers/mod.d.ts +6 -0
  25. package/plugins/compute/computers/mod.js +10 -1
  26. package/plugins/compute/computers/program/agents/acp.js +30 -9
  27. package/plugins/compute/computers/program/agents/claude.js +9 -2
  28. package/plugins/compute/computers/program/agents/steps.d.ts +9 -2
  29. package/plugins/compute/computers/program/agents/steps.js +8 -8
  30. package/plugins/compute/computers/program/computer.js +5 -1
  31. package/plugins/compute/computers/program/version.d.ts +1 -1
  32. package/plugins/compute/computers/program/version.js +1 -1
  33. package/plugins/compute/computers/program/workloads/files.d.ts +16 -1
  34. package/plugins/compute/computers/program/workloads/files.js +159 -3
  35. package/plugins/compute/computers/program/workloads/search.d.ts +1 -1
  36. package/plugins/compute/computers/resources/downloads.js +1 -1
  37. package/plugins/compute/computers/resources/previews.js +2 -28
  38. package/plugins/compute/computers/resources/tools.d.ts +5 -0
  39. package/plugins/compute/computers/resources/tools.js +155 -1
  40. package/plugins/compute/computers/routes/upload.d.ts +30 -0
  41. package/plugins/compute/computers/routes/upload.js +169 -0
  42. package/plugins/compute/computers/shared/desks.d.ts +13 -1
  43. package/plugins/compute/computers/shared/desks.js +34 -0
  44. package/plugins/compute/computers/shared/streams.d.ts +13 -0
  45. package/plugins/compute/computers/shared/streams.js +36 -0
  46. package/plugins/compute/computers/shared/workloads.d.ts +44 -0
  47. package/plugins/compute/computers/shared/workloads.js +4 -0
  48. package/plugins/compute/computers/views/web/file-view.d.ts +5 -1
  49. package/plugins/compute/computers/views/web/file-view.js +4 -2
  50. package/plugins/compute/computers/views/web/files.d.ts +18 -1
  51. package/plugins/compute/computers/views/web/files.js +117 -16
  52. package/plugins/compute/computers/views/web/step.d.ts +6 -4
  53. package/plugins/compute/computers/views/web/step.js +43 -1
  54. package/plugins/compute/computers/views/web/style.d.ts +5 -5
  55. package/plugins/compute/computers/views/web/style.js +79 -8
  56. package/plugins/compute/computers/views/web/upload-tray.d.ts +70 -0
  57. package/plugins/compute/computers/views/web/upload-tray.js +249 -0
  58. package/plugins/compute/computers/views/web/uploads.d.ts +184 -0
  59. package/plugins/compute/computers/views/web/uploads.js +425 -0
  60. package/plugins/compute/computers/views/web/words.d.ts +1 -1
  61. package/plugins/compute/computers/views/web/words.js +98 -3
  62. package/plugins/compute/computers/views/web/workspace.js +3 -1
  63. package/plugins/compute/computers/web.js +2 -0
  64. package/plugins/models/shared/catalog.json +9279 -7578
  65. package/plugins/models/shared/generate.d.ts +4 -1
  66. package/plugins/models/shared/generate.js +44 -2
  67. package/runtime/executor.js +8 -3
  68. package/runtime/owner.js +5 -2
  69. package/runtime/wire.d.ts +11 -0
  70. package/runtime/wire.js +11 -0
package/AGENTS.md CHANGED
@@ -4,7 +4,7 @@ A guide for coding agents (Claude Code, Codex, Cursor, Gemini) building an app w
4
4
  it whole before you write code. The last section is for work on Copilotz itself.
5
5
 
6
6
  It ships in the package (`node_modules/copilotz/AGENTS.md`, and `@copilotz/copilotz` on JSR) and
7
- goes with `copilotz@1.0.0-rc.57`. Every docs page is Markdown at
7
+ goes with `copilotz@1.0.0-rc.59`. Every docs page is Markdown at
8
8
  `https://copilotz.com/docs/<slug>.md`, and https://copilotz.com/llms.txt lists them all. When you're
9
9
  unsure of a name, fetch its page or read the package's types (`node_modules/copilotz/**/*.d.ts`).
10
10
  Don't guess.
@@ -64,12 +64,12 @@ There's no project generator. Set a project up as the docs' courses do, on Node
64
64
  ```sh
65
65
  mkdir my-app && cd my-app
66
66
  npm init -y && npm pkg set type=module
67
- npm install copilotz@1.0.0-rc.57 react@19 react-dom@19
67
+ npm install copilotz@1.0.0-rc.59 react@19 react-dom@19
68
68
  npm install -D typescript @types/node @types/react @types/react-dom esbuild
69
69
  ```
70
70
 
71
71
  Pin the version: npm's `latest` tag still points at an early release candidate. On Deno, run
72
- `deno add jsr:@copilotz/copilotz` and map `"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.57"` in
72
+ `deno add jsr:@copilotz/copilotz` and map `"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.59"` in
73
73
  `deno.json`, so imports read the same.
74
74
 
75
75
  Node runs `.ts` files as they are, so there's no build step. It doesn't run `.tsx`: tests that load
@@ -110,7 +110,7 @@ line `@AGENTS.md` (Claude Code reads `CLAUDE.md`, and follows the import). Keep
110
110
  ```markdown
111
111
  # AGENTS.md
112
112
 
113
- This app runs on Copilotz (copilotz@1.0.0-rc.57). Read node_modules/copilotz/AGENTS.md first;
113
+ This app runs on Copilotz (copilotz@1.0.0-rc.59). Read node_modules/copilotz/AGENTS.md first;
114
114
  https://copilotz.com/llms.txt lists the docs, as Markdown.
115
115
 
116
116
  - `npm test` runs every test offline, with a scripted model: run it after each change.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,80 @@
1
+ ## 1.0.0-rc.59 — 2026-11-21
2
+
3
+ A person's plan answers its agents' steps however long its model thinks, and an agent waiting on
4
+ another goes on for the same person when that one fails: two reasons plan steps went to an API key.
5
+
6
+ **Fixed:**
7
+
8
+ - **Work streamed from a plugin's worker isn't cut at 30 seconds.** A job's call to the owner ended
9
+ 30 seconds after it opened, however much it had streamed (Oxian's default for host calls). So a
10
+ model's step on a person's plan whose model thought longer than that before its first word (Claude
11
+ Fable, Opus) was cut, and handed over to the next model of its list, an API key, while the plan's
12
+ CLI went on with it; and a browser's actions past 30 seconds failed. Work sent on to a worker now
13
+ lasts up to an hour (`WORK_MS`, the most a request lasts on Cloud Run), on both ends; a storage op
14
+ keeps its 30 seconds (`OP_MS`).
15
+ - **An agent waiting on another goes on for the same person when that one fails.** A turn that
16
+ failed for good answered as the system, so the agent waiting on it went on as the system: on no
17
+ one's plan (a person's plan runs only for a person, so it went to an API key), past anyone's
18
+ reach. Its answer is now its agent's, for whom its turn worked, as an answer that came is; a final
19
+ `processor.failed` carries the failed event's `actor` for that.
20
+
21
+ ## 1.0.0-rc.58 — 2026-11-21
22
+
23
+ Files go between a chat and a computer both ways, and people put files on a computer from its page.
24
+ When a model hands over to the next in its list (a person's plan to an API key), the log and the
25
+ usage say why. A tool call held for a person's plan waits past Claude Code's 5-minute idle limit,
26
+ and the models catalog is refreshed.
27
+
28
+ **New:**
29
+
30
+ - **An agent saves a file sent in its chat on a computer** (`save_file`, the computers plugin): a
31
+ zip to unpack, a spreadsheet to work on, an image to edit, into the space's folder, where commands
32
+ and the other tools reach it. It's a write like `write_file`'s, asked first where writes are. Each
33
+ file a message carries now says its id to the agent
34
+ (`[file data.zip: application/zip, 3214000
35
+ bytes, id …]`, and `[image …, id …]`,
36
+ `[file notes.txt, id …]`), which the tool takes; it reads the file as the agent, so the rules
37
+ decide which it reaches.
38
+ - **An agent sends a file from a computer into its chat** (`send_file`): a report, a chart, a zip it
39
+ made, as its own message with the file (`chat.say`), up to a chat file's size (about 10 MB). Run
40
+ again as itself (a retried turn), it sends nothing more. Chat's contract exports `FILE_DATA`.
41
+ - **Uploads to a computer** (`PUT /computers/upload?desk=&path=[&replace=1]`, the Files view): a
42
+ person puts files in a space's folder on a computer, of up to 2 GiB each, streamed through to it
43
+ as they come and put in place once whole, so a broken upload leaves nothing. Past what one request
44
+ may carry on its way (Cloud Run's 32 MiB, a CDN's 100 MB), a file goes in parts, in order
45
+ (`&upload=&offset=&total=`), kept apart on the computer until the last; parts nobody finished go
46
+ after a day. Only where they may change the computer from its panel (`computer.upload`, on the
47
+ record: who put what where), a computer that sleeps woken first, and one between connections
48
+ waited for. A file there is kept unless replaced. The Files view takes files picked or dropped,
49
+ with each one's progress, and asks before replacing one.
50
+ - **The computer program says what it serves** (`Info.serves`), and takes a file streamed in
51
+ (`computer.files.put`). The app asks a computer what it serves before an upload, so one whose
52
+ program is older answers at once that it needs updating (501, `outdated`).
53
+
54
+ - **Why a model handed over, on the record.** A model of a list that doesn't answer and hands over
55
+ to the next (a person's plan falling back to an API key) is logged by the process
56
+ (`models: <model> didn't answer after 31.2 s, thinking (<code>: <words>); <next> answers instead
57
+ [thread=… agent=… turn=…]`),
58
+ and the model that answers instead says so on its usage (`fallback`, `fallbackWhy` tags). The
59
+ engine adapter logs a session it starts over. The computer program logs a plan's prompt that
60
+ failed, and a step the app stopped reading before it ended, with how long it ran (`computer.log`).
61
+
62
+ **Fixed:**
63
+
64
+ - **A tool call held for a person's plan no longer fails after 5 minutes.** Claude Code aborts a
65
+ tool that sends nothing for 5 minutes, and a call held for its answer is silent until it comes (a
66
+ person's yes, the app's next step). The computer program gives Claude Code's idle limit a day, as
67
+ its whole limit already was (`CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`, and the server's own `timeout`
68
+ in its MCP config).
69
+
70
+ **Changed:**
71
+
72
+ - **The models catalog**, refreshed from models.dev (2026-11-21): Google's Gemini 4 Carbon, Neon and
73
+ Hydrogen among what's new, with their prices and reasoning.
74
+ - `computer.work`'s rules for a person working on a computer (in its space, its owner's where they
75
+ answer for it, a computer that sleeps woken) are `personalDesk`, which uploads share. A desk that
76
+ isn't there is `not_found` (it was `invalid`).
77
+
1
78
  ## 1.0.0-rc.57 — 2026-11-20
2
79
 
3
80
  Agents can run on the plan of the person they work for: Claude, ChatGPT through Codex, or Google AI
package/README.md CHANGED
@@ -152,7 +152,7 @@ ana sees: Tue 10:00, Wed 15:00
152
152
  ```sh
153
153
  npm install copilotz@next # Node 24+ (npm, pnpm, yarn)
154
154
  bun add copilotz@next # Bun
155
- deno add jsr:@copilotz/copilotz@^1.0.0-rc.57 # Deno 2.9+ (or `deno add npm:copilotz@next`)
155
+ deno add jsr:@copilotz/copilotz@^1.0.0-rc.59 # Deno 2.9+ (or `deno add npm:copilotz@next`)
156
156
  ```
157
157
 
158
158
  Until 1.0, the release candidates are on npm's `next` tag, and a plain `npm install copilotz` or
@@ -166,7 +166,7 @@ OPENAI_API_KEY=sk-… node salon.ts # or bun salon.ts, or deno run -A salon.t
166
166
  ```
167
167
 
168
168
  On Deno, map the name `copilotz` in `deno.json`
169
- (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.57"`) so the imports read the same everywhere.
169
+ (`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.59"`) so the imports read the same everywhere.
170
170
  Copilotz runs on Node 24+, Deno 2.9+ and Bun, and it's built on web standards for Cloudflare Workers
171
171
  and the browser.
172
172
 
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Computers' words in Brazilian Portuguese (a person's plans on their own computers): the keys
3
- * `hosts/web/WORDS.md` lists, `computers.*`.
2
+ * Computers' words in Brazilian Portuguese (a person's plans on their own computers, a
3
+ * computer's Files tab and uploading to it, an agent's calls that move a file between a chat and
4
+ * a computer): the keys `hosts/web/WORDS.md` lists, `computers.*`.
4
5
  */
5
6
  import type { Words } from "../words.js";
6
7
  export declare const computers: Words;
@@ -30,9 +30,31 @@ export const computers = {
30
30
  "computers.doneNext": "Seus agentes rodam nele a partir de agora, em todas as conversas e espaços daqui.",
31
31
  "computers.doneOn": "Em {computer}, pelo {cli}",
32
32
  "computers.doneTitle": "Seu {plan} está conectado",
33
+ "computers.dropTitle": "Solte para enviar",
34
+ "computers.dropTo": "Para {folder} em {computer}",
33
35
  "computers.failedEnded": "Ele parou sem entrar. Tente de novo, ou leia abaixo o que ele disse.",
34
36
  "computers.failedStart": "Não deu para entrar: {why}",
35
37
  "computers.failedTitle": "O {cli} não entrou",
38
+ "computers.filesDownload": "Baixar {name}",
39
+ "computers.filesEmpty": "Nada aqui ainda",
40
+ "computers.filesEmptyDrop": "Solte arquivos aqui para enviá-los. O que você e seus agentes fizerem nesta pasta também aparece aqui.",
41
+ "computers.filesEmptyText": "O que você e seus agentes fizerem nesta pasta aparece aqui.",
42
+ "computers.filesFilter": "Filtrar",
43
+ "computers.filesFilterLabel": "Filtrar esta pasta",
44
+ "computers.filesIn": "Em {folder}",
45
+ "computers.filesItsOwner": "o dono dele",
46
+ "computers.filesJustUploaded": "enviado",
47
+ "computers.filesNoMatch": "Nada aqui corresponde a “{filter}”.",
48
+ "computers.filesOn": "{folder}, em {computer}",
49
+ "computers.filesRefresh": "Atualizar",
50
+ "computers.filesUpTo": "Voltar para {folder}",
51
+ "computers.filesViewOnly": "Só {owner} muda arquivos em {computer} aqui. Você pode abri-los e baixá-los.",
52
+ "computers.filesWhere": "Onde, na pasta",
53
+ "computers.folderDropped": "“{name}” é uma pasta, e pastas não podem ser enviadas. Solte os arquivos dela, ou um zip dela.",
54
+ "computers.foldersDropped": {
55
+ one: "{count} pasta não foi enviada: pastas não podem ser. Solte os arquivos dela, ou um zip dela.",
56
+ other: "{count} pastas não foram enviadas: pastas não podem ser. Solte os arquivos delas, ou um zip de cada uma.",
57
+ },
36
58
  "computers.gotCode": "A página deu um código?",
37
59
  "computers.hideInstall": "Ocultar",
38
60
  "computers.howToFix": "Como usar",
@@ -43,9 +65,14 @@ export const computers = {
43
65
  "computers.installMissing": "O {cli} ainda não está instalado em {computer}. Num terminal lá, rode:",
44
66
  "computers.installThen": "Depois verifique de novo aqui. É a instalação oficial do {cli}.",
45
67
  "computers.keepAsIs": "Deixar como está",
68
+ "computers.keepBoth": "Manter os dois",
46
69
  "computers.listMore": "{rest} e {last}",
47
70
  "computers.listPair": "{first} e {second}",
48
71
  "computers.moreOn": "Mais de {computer}",
72
+ "computers.newFile": "Novo arquivo",
73
+ "computers.newFileMake": "Criar o arquivo",
74
+ "computers.newFileName": "O nome do novo arquivo",
75
+ "computers.newFilePlaceholder": "notas.md, ou src/novo.ts",
49
76
  "computers.noComputerText": "Os planos rodam pelos apps deles num computador seu, um Mac, um PC com Linux ou Windows, " +
50
77
  "enquanto ele estiver ligado. Conecte um, e entre aqui.",
51
78
  "computers.noComputerTitle": "Conecte um computador seu primeiro",
@@ -72,6 +99,18 @@ export const computers = {
72
99
  "vez, pelo app dele num computador seu, e ele vale em todas as conversas e espaços daqui.",
73
100
  "computers.plansPrivate": "Nada é cobrado aqui por essas chamadas. O login fica no seu computador: este app nunca o vê.",
74
101
  "computers.plansTitle": "Planos nos seus computadores",
102
+ "computers.replace": "Substituir",
103
+ "computers.replaceAll": {
104
+ one: "Fazer o mesmo com o outro arquivo que já está lá",
105
+ other: "Fazer o mesmo com os outros {count} arquivos que já estão lá",
106
+ },
107
+ "computers.replaceFolderText": "Um arquivo não substitui uma pasta. Envie o seu ao lado dela com outro nome, ou pule.",
108
+ "computers.replaceFolderTitle": "Já tem uma pasta chamada “{name}”",
109
+ "computers.replaceKeepAs": "Manter os dois envia o seu como “{name}”.",
110
+ "computers.replaceText": "{folder} já tem um arquivo chamado “{name}”. Substituir põe o seu no lugar dele.",
111
+ "computers.replaceThere": "O que está lá: {size}, alterado {time}",
112
+ "computers.replaceTitle": "Substituir “{name}”?",
113
+ "computers.replaceYours": "O seu: {size}, alterado {time}",
75
114
  "computers.rowInstalled": "Instalado, sem login",
76
115
  "computers.rowMissing": "O {cli} não está instalado",
77
116
  "computers.rowOld": "Não respondeu: o programa do computador talvez precise de atualização",
@@ -97,9 +136,16 @@ export const computers = {
97
136
  "computers.signInThrough": "Pelo {cli}, num computador seu.",
98
137
  "computers.signInTitle": "Entrar no seu {plan}",
99
138
  "computers.signedIn": "Conectado",
139
+ "computers.skip": "Pular",
100
140
  "computers.start": "Começar o login",
101
141
  "computers.stepCode": "Cole o código que ela der",
102
142
  "computers.stepEnterCode": "Abra a página de login, entre com a conta que tem o seu plano, e digite este código lá:",
143
+ "computers.stepSaved": "Salvou {file} em {path}",
144
+ "computers.stepSaves": "Salva {file} em {path}",
145
+ "computers.stepSavesFile": "Salva um arquivo desta conversa em {path}",
146
+ "computers.stepSavesFolder": "Salva um arquivo desta conversa na pasta do espaço",
147
+ "computers.stepSends": "Envia {path} para esta conversa",
148
+ "computers.stepSent": "Enviou {file}",
103
149
  "computers.stepSignIn": "Entre no seu {plan}",
104
150
  "computers.stepSignInHere": "Abra a página de login, e entre com a conta que tem o seu plano.",
105
151
  "computers.stepSignInThere": "Uma página de login abre no navegador de {computer}. Entre lá, com a conta que tem o seu plano.",
@@ -107,6 +153,58 @@ export const computers = {
107
153
  "computers.stepStart": "Abrindo o {cli} em {computer}",
108
154
  "computers.stepWake": "Acordando {computer}",
109
155
  "computers.tryAgain": "Tentar de novo",
156
+ "computers.upload": "Enviar",
157
+ "computers.uploadAsking": "Já tem um com este nome",
158
+ "computers.uploadCancel": "Cancelar o envio de {name}",
159
+ "computers.uploadCancelled": "Cancelado",
160
+ "computers.uploadDone": "Enviado",
161
+ "computers.uploadDoneAs": "Enviado como {name}",
162
+ "computers.uploadFailed": "Não foi enviado. Tente de novo.",
163
+ "computers.uploadFinishing": "Salvando em {computer}…",
164
+ "computers.uploadFolderThere": "Já tem uma pasta com esse nome, e um arquivo não a substitui.",
165
+ "computers.uploadForbidden": "Você não pode mudar arquivos neste computador.",
166
+ "computers.uploadFull": "Não tem mais espaço no disco de {computer}.",
167
+ "computers.uploadIn": "em {folder}",
168
+ "computers.uploadInvalid": "Esse nome não pode ser usado aqui.",
169
+ "computers.uploadNetwork": "A conexão caiu. Tente de novo.",
170
+ "computers.uploadNoLength": "O navegador não disse o tamanho dele. Tente de novo.",
171
+ "computers.uploadNoWake": "{computer} não acordou a tempo. Tente de novo.",
172
+ "computers.uploadNotFound": "Este computador não está mais neste espaço.",
173
+ "computers.uploadOffline": "{computer} está offline. Tente de novo quando ele estiver ligado.",
174
+ "computers.uploadOpen": "Abrir {name}",
175
+ "computers.uploadOutdated": "O programa do computador de {computer} é antigo demais para receber envios. Ele se atualiza sozinho, ou o dono dele o atualiza: depois tente de novo.",
176
+ "computers.uploadProgress": "{done} de {total}",
177
+ "computers.uploadProgressLabel": "Enviando {name}",
178
+ "computers.uploadQueued": "Esperando para enviar",
179
+ "computers.uploadReplaced": "Enviado no lugar do que estava lá",
180
+ "computers.uploadRestart": "Este envio foi interrompido e precisa começar de novo.",
181
+ "computers.uploadSignedOut": "Você saiu da sua conta. Entre de novo, e tente de novo.",
182
+ "computers.uploadSkipped": "Pulado: o que está lá fica",
183
+ "computers.uploadTooLarge": "Ele tem {size}: um arquivo pode ter no máximo {most}.",
184
+ "computers.uploadTooLargeHere": "Ele tem {size}: grande demais para enviar por este app.",
185
+ "computers.uploadUnavailable": "{computer} não conseguiu acordar. Tente de novo daqui a pouco.",
186
+ "computers.uploadWaiting": "Esperando {computer}…",
187
+ "computers.uploadWaking": "Acordando {computer}…",
188
+ "computers.uploading": {
189
+ one: "Enviando {count} arquivo",
190
+ other: "Enviando {count} arquivos",
191
+ },
192
+ "computers.uploads": "Envios",
193
+ "computers.uploadsAsking": {
194
+ one: "{count} espera por você",
195
+ other: "{count} esperam por você",
196
+ },
197
+ "computers.uploadsCancelAll": "Cancelar todos",
198
+ "computers.uploadsDone": {
199
+ one: "{count} arquivo enviado",
200
+ other: "{count} arquivos enviados",
201
+ },
202
+ "computers.uploadsFailed": {
203
+ one: "{count} não foi enviado",
204
+ other: "{count} não foram enviados",
205
+ },
206
+ "computers.uploadsHide": "Ocultar envios",
207
+ "computers.uploadsLeft": "faltam {size}",
110
208
  "computers.version": "versão {version}",
111
209
  "computers.waiting": "Esperando o login terminar…",
112
210
  "computers.wakeNote": "{computer} acorda primeiro: leva um momento.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilotz",
3
- "version": "1.0.0-rc.57",
3
+ "version": "1.0.0-rc.59",
4
4
  "description": "The open-source runtime that makes your app usable by people, your own agents and their assistants.",
5
5
  "keywords": [
6
6
  "agents",
@@ -1 +1 @@
1
- export declare const say: import("../../../../../hosts/web/words.js").Say<"cancel" | "done" | "join" | "kind" | "id" | "person" | "view" | "name" | "ok" | "settings" | "people" | "invite" | "restore" | "space" | "details" | "save" | "emailPlaceholder" | "inviteTitle" | "personal" | "staff" | "archived" | "shared" | "roles" | "agents" | "theirPersonal" | "roleViewer" | "roleViewerLets" | "roleEditor" | "roleEditorLets" | "roleManager" | "roleManagerLets" | "agentEditorLets" | "agentViewerLets" | "aRole" | "anRole" | "listPair" | "listMore" | "invitedOne" | "invitedMany" | "kindPeople" | "newSpace" | "nameIt" | "newSpaceNote" | "createNamed" | "atMost" | "renameTitle" | "newName" | "renameNote" | "renameTo" | "archiveTitle" | "archiveNote" | "archiveNamed" | "keepIt" | "leaveTitle" | "leaveNote" | "leaveNamed" | "stay" | "peopleCount" | "agentsCount" | "workBoth" | "workPeopleOnly" | "rename" | "archiveMenu" | "leaveMenu" | "spaceNameLabel" | "renameSpace" | "justYou" | "personalAbout" | "membersNamed" | "inviteSomeone" | "newChat" | "newChatHere" | "moreOf" | "addAgent" | "agentsAboutPersonal" | "agentsAboutShared" | "noAgents" | "madeIn" | "madeElsewhere" | "appAgent" | "anAgent" | "makeAnswer" | "edit" | "removeFromSpace" | "answersNew" | "roleOf" | "joinNamed" | "decline" | "invitationTo" | "invitedTo" | "invitedYou" | "byAs" | "invitedAt" | "invitations" | "moreInvitations" | "invitationsWaiting" | "inviteAbout" | "addAgentTitle" | "addAgentAbout" | "theirEmail" | "theirRole" | "inviteHint" | "inviteHintMany" | "personalAlone" | "managersAdd" | "managersAddThis" | "whoToAdd" | "membersPersonal" | "waitingToJoin" | "invitePeople" | "spacesDrawing" | "spaceMembersIn" | "you" | "leaveThisSpace" | "takeOut" | "askedBy" | "askedByWhy" | "asked" | "askedWhy" | "letIn" | "turnDown" | "nameNewSpace" | "nameSpace" | "makeSpace" | "nothingSent" | "onlyReadsTitle" | "notWorkingTitle" | "notNow" | "makeEditorsSend" | "addSend" | "waitingReads" | "waitingAdd" | "askManagersEditor" | "askManagersAdd" | "aboutLabel" | "orgNamePersonal" | "orgNameOwner" | "orgNameOthers" | "orgNameLabel" | "yourRole" | "staffRole" | "kindPersonal" | "kindTeam" | "orgRoleLine" | "copyOrgId" | "seesYou" | "seesOwners" | "seesAsOwner" | "seesAsAdmin" | "seesTheirs" | "orgSaved" | "orgPersonalAlone" | "invitedHeading" | "removedHanded" | "removedPlain" | "onlyOwner" | "removeFromOrg" | "orgInvited" | "invitedTime" | "takeBackTo" | "takeBack" | "removeTitle" | "removeNamed" | "removeMeansOut" | "removeMeansPersonal" | "heirLabel" | "heirHint" | "youNamed" | "invitedYouAs" | "declineInvitation" | "inviteToNamed" | "renameNamed" | "restoreNamed" | "archiveNamedMore" | "leaveNamedMore" | "tabIn" | "thisSpace" | "spacesGroup" | "youreHere" | "createGroup" | "newSpaceMore" | "newSpaceNamed" | "keysAcceptInvitation" | "keysInvitation" | "keysInvite" | "keysRestore" | "keysPersonal" | "keysNewSpace" | "keysPick" | "keysCreate" | "panelMissing" | "panelLabel" | "sharedSpace" | "openPage" | "tabsOf" | "invitedNotJoined" | "invitedByYou" | "invitedBy" | "partsOf" | "notYourSpace" | "notInSpace" | "goHome" | "notInSpaceAbout" | "nothingHere" | "nothingHereAbout" | "isArchived" | "archivedNote" | "general" | "members" | "managersChange" | "nameSettingPersonal" | "nameSettingShared" | "copySpaceId" | "leave" | "leaveAbout" | "archiveSetting" | "archivedAt" | "archiveAbout" | "archiveReadableLead" | "archiveReadableRest" | "archiveApartLead" | "archiveApartRest" | "archiveBackLead" | "archiveBackRest" | "saved" | "answersAbout" | "answersViewersOnly" | "answersNone" | "answersLabel" | "answersNow" | "acrossOrg" | "acrossOrgHint" | "spacesUnder" | "nameArchived" | "personalHint" | "showWhat" | "hideWhat" | "showIn" | "hideIn">;
1
+ export declare const say: import("../../../../../hosts/web/words.js").Say<"cancel" | "done" | "join" | "kind" | "id" | "person" | "view" | "name" | "ok" | "settings" | "space" | "people" | "invite" | "restore" | "details" | "save" | "emailPlaceholder" | "inviteTitle" | "personal" | "staff" | "archived" | "shared" | "roles" | "agents" | "theirPersonal" | "roleViewer" | "roleViewerLets" | "roleEditor" | "roleEditorLets" | "roleManager" | "roleManagerLets" | "agentEditorLets" | "agentViewerLets" | "aRole" | "anRole" | "listPair" | "listMore" | "invitedOne" | "invitedMany" | "kindPeople" | "newSpace" | "nameIt" | "newSpaceNote" | "createNamed" | "atMost" | "renameTitle" | "newName" | "renameNote" | "renameTo" | "archiveTitle" | "archiveNote" | "archiveNamed" | "keepIt" | "leaveTitle" | "leaveNote" | "leaveNamed" | "stay" | "peopleCount" | "agentsCount" | "workBoth" | "workPeopleOnly" | "rename" | "archiveMenu" | "leaveMenu" | "spaceNameLabel" | "renameSpace" | "justYou" | "personalAbout" | "membersNamed" | "inviteSomeone" | "newChat" | "newChatHere" | "moreOf" | "addAgent" | "agentsAboutPersonal" | "agentsAboutShared" | "noAgents" | "madeIn" | "madeElsewhere" | "appAgent" | "anAgent" | "makeAnswer" | "edit" | "removeFromSpace" | "answersNew" | "roleOf" | "joinNamed" | "decline" | "invitationTo" | "invitedTo" | "invitedYou" | "byAs" | "invitedAt" | "invitations" | "moreInvitations" | "invitationsWaiting" | "inviteAbout" | "addAgentTitle" | "addAgentAbout" | "theirEmail" | "theirRole" | "inviteHint" | "inviteHintMany" | "personalAlone" | "managersAdd" | "managersAddThis" | "whoToAdd" | "membersPersonal" | "waitingToJoin" | "invitePeople" | "spacesDrawing" | "spaceMembersIn" | "you" | "leaveThisSpace" | "takeOut" | "askedBy" | "askedByWhy" | "asked" | "askedWhy" | "letIn" | "turnDown" | "nameNewSpace" | "nameSpace" | "makeSpace" | "nothingSent" | "onlyReadsTitle" | "notWorkingTitle" | "notNow" | "makeEditorsSend" | "addSend" | "waitingReads" | "waitingAdd" | "askManagersEditor" | "askManagersAdd" | "aboutLabel" | "orgNamePersonal" | "orgNameOwner" | "orgNameOthers" | "orgNameLabel" | "yourRole" | "staffRole" | "kindPersonal" | "kindTeam" | "orgRoleLine" | "copyOrgId" | "seesYou" | "seesOwners" | "seesAsOwner" | "seesAsAdmin" | "seesTheirs" | "orgSaved" | "orgPersonalAlone" | "invitedHeading" | "removedHanded" | "removedPlain" | "onlyOwner" | "removeFromOrg" | "orgInvited" | "invitedTime" | "takeBackTo" | "takeBack" | "removeTitle" | "removeNamed" | "removeMeansOut" | "removeMeansPersonal" | "heirLabel" | "heirHint" | "youNamed" | "invitedYouAs" | "declineInvitation" | "inviteToNamed" | "renameNamed" | "restoreNamed" | "archiveNamedMore" | "leaveNamedMore" | "tabIn" | "thisSpace" | "spacesGroup" | "youreHere" | "createGroup" | "newSpaceMore" | "newSpaceNamed" | "keysAcceptInvitation" | "keysInvitation" | "keysInvite" | "keysRestore" | "keysPersonal" | "keysNewSpace" | "keysPick" | "keysCreate" | "panelMissing" | "panelLabel" | "sharedSpace" | "openPage" | "tabsOf" | "invitedNotJoined" | "invitedByYou" | "invitedBy" | "partsOf" | "notYourSpace" | "notInSpace" | "goHome" | "notInSpaceAbout" | "nothingHere" | "nothingHereAbout" | "isArchived" | "archivedNote" | "general" | "members" | "managersChange" | "nameSettingPersonal" | "nameSettingShared" | "copySpaceId" | "leave" | "leaveAbout" | "archiveSetting" | "archivedAt" | "archiveAbout" | "archiveReadableLead" | "archiveReadableRest" | "archiveApartLead" | "archiveApartRest" | "archiveBackLead" | "archiveBackRest" | "saved" | "answersAbout" | "answersViewersOnly" | "answersNone" | "answersLabel" | "answersNow" | "acrossOrg" | "acrossOrgHint" | "spacesUnder" | "nameArchived" | "personalHint" | "showWhat" | "hideWhat" | "showIn" | "hideIn">;
@@ -5,7 +5,7 @@ export declare const MEDIA_TYPE_LENGTH = 127;
5
5
  /**
6
6
  * What a file's media type looks like: `type/subtype`, then parameters
7
7
  * (`audio/ogg; codecs=opus`, as WhatsApp sends voice notes), on one line:
8
- * an agent is told it (`[file a.bin: <type>, …]`).
8
+ * an agent is told it (`[file a.bin: <type>, …, id …]`).
9
9
  */
10
10
  export declare const MEDIA_TYPE: RegExp;
11
11
  export declare const sendAction: import("../../../../runtime/define.js").ActionDef;
@@ -49,7 +49,7 @@ export const MEDIA_TYPE_LENGTH = 127;
49
49
  /**
50
50
  * What a file's media type looks like: `type/subtype`, then parameters
51
51
  * (`audio/ogg; codecs=opus`, as WhatsApp sends voice notes), on one line:
52
- * an agent is told it (`[file a.bin: <type>, …]`).
52
+ * an agent is told it (`[file a.bin: <type>, …, id …]`).
53
53
  */
54
54
  export const MEDIA_TYPE = /^[A-Za-z0-9][\w!#$&^.+-]*\/[A-Za-z0-9][\w!#$&^.+-]*(?: *; *[\w!#$&^.+-]+=(?:[\w!#$&^.+-]+|"[ !#-\[\]-~]*"))* *$/;
55
55
  /**
@@ -508,6 +508,7 @@ export declare const message: {
508
508
  name: string;
509
509
  size: number;
510
510
  }[] | undefined;
511
+ turn?: string | undefined;
511
512
  toolCalls?: unknown[] | undefined;
512
513
  back?: {
513
514
  [x: string]: unknown;
@@ -518,7 +519,6 @@ export declare const message: {
518
519
  replyTo?: string | undefined;
519
520
  expectReply?: boolean | undefined;
520
521
  subthread?: string | undefined;
521
- turn?: string | undefined;
522
522
  drew?: string[] | undefined;
523
523
  tap?: {
524
524
  [x: string]: unknown;
@@ -16,7 +16,7 @@
16
16
  * `turn.requested`), its Actions (`chat.send`, `chat.stop`, `chat.move`…).
17
17
  */
18
18
  export type { File, FileAbout } from "./collections/file.js";
19
- export { FILE_CHARS, textual } from "./collections/file.js";
19
+ export { FILE_CHARS, FILE_DATA, textual } from "./collections/file.js";
20
20
  export type { Live, LiveCall } from "./collections/live.js";
21
21
  export { heldTold, isAnswer, type Message } from "./collections/message.js";
22
22
  export type { AdditionShown } from "./collections/shown.js";
@@ -1,4 +1,4 @@
1
- export { FILE_CHARS, textual } from "./collections/file.js";
1
+ export { FILE_CHARS, FILE_DATA, textual } from "./collections/file.js";
2
2
  export { heldTold, isAnswer } from "./collections/message.js";
3
3
  /** A chat's notes, by its id (`<chat>:notes`, see `chat.notes`). */
4
4
  export { notesOf } from "./shared/notes.js";
@@ -1,3 +1,3 @@
1
1
  /** A turn that failed for good, or was stopped, still answers, so whoever waits on it resumes. */
2
- import type { ProcessorDef } from "../../../../runtime/mod.js";
2
+ import { type ProcessorDef } from "../../../../runtime/mod.js";
3
3
  export declare const failedProcessor: ProcessorDef;
@@ -1,5 +1,8 @@
1
+ /** A turn that failed for good, or was stopped, still answers, so whoever waits on it resumes. */
2
+ import { principalOf, } from "../../../../runtime/mod.js";
1
3
  import { turnOf } from "../shared/agents.js";
2
4
  import { answer } from "../shared/delivery.js";
5
+ import { asAgent, spaceOf } from "./turn.js";
3
6
  export const failedProcessor = {
4
7
  on: "processor.failed",
5
8
  where: { processor: "chat.turn" },
@@ -11,10 +14,17 @@ export const failedProcessor = {
11
14
  * when that was surely an answer (its turn offered no tools). A refusal
12
15
  * written for people (a failure made public: the org's spending check, a
13
16
  * web line's budget) answers in its own words.
17
+ *
18
+ * Its answer is its agent's, working for whom its turn did (the failed
19
+ * event's actor), as an answer that came is: an agent waiting on it goes on
20
+ * for that person, with what's theirs (their plan, their reach), never as
21
+ * the system.
14
22
  */
15
- const failed = async (ctx, event) => {
16
- const { event: run, type, data, error } = event.data;
23
+ const failed = async (system, event) => {
24
+ const { event: run, type, data, error, actor } = event.data;
17
25
  const t = turnOf({ type, data });
26
+ const where = principalOf(actor) ? await spaceOf(system, t.thread) : undefined;
27
+ const ctx = asAgent(system, t.agent, t.thread, where, [], actor);
18
28
  const messages = ctx.db.collection("message");
19
29
  if (await messages.findOne({ _id: `${run}:reply` }))
20
30
  return;
@@ -1,3 +1,17 @@
1
1
  /** An agent's turn: model calls and tool steps until it answers, or waits for replies. */
2
- import { type ProcessorDef } from "../../../../runtime/mod.js";
2
+ import { type Context, type ProcessorDef } from "../../../../runtime/mod.js";
3
+ /**
4
+ * A turn someone started (a person, or a contact in its chat) acts as its
5
+ * agent, for them, where its conversation is (`in`, the thread's space) and
6
+ * in it (`thread`): with the access plugin, it reaches only what both reach
7
+ * there, and what everyone the conversation is shared with reaches (an agent
8
+ * is a member of spaces, like a person), and its tools know where they are
9
+ * (`ctx.in`). The places its person said yes to sharing into, for one call,
10
+ * it carries (`approved`). Without anyone, it runs as the system.
11
+ */
12
+ export declare const asAgent: (ctx: Context, agent: string, thread: string, where?: string, approved?: string[],
13
+ /** Whose writing set the turn going: by default, the event's (`ctx.actor`). */
14
+ by?: import("../../../../runtime/store.js").Actor | undefined) => Context;
15
+ /** The space a thread is in, where its turns work: what they write elsewhere needs a person. */
16
+ export declare const spaceOf: (ctx: Context, thread: string) => Promise<string | undefined>;
3
17
  export declare const turnProcessor: ProcessorDef;
@@ -20,8 +20,10 @@ import { settingsOf, } from "../shared/types.js";
20
20
  * (`ctx.in`). The places its person said yes to sharing into, for one call,
21
21
  * it carries (`approved`). Without anyone, it runs as the system.
22
22
  */
23
- const asAgent = (ctx, agent, thread, where, approved = []) => {
24
- const principal = principalOf(ctx.actor);
23
+ export const asAgent = (ctx, agent, thread, where, approved = [],
24
+ /** Whose writing set the turn going: by default, the event's (`ctx.actor`). */
25
+ by = ctx.actor) => {
26
+ const principal = principalOf(by);
25
27
  return principal
26
28
  ? ctx.as({
27
29
  kind: "agent",
@@ -34,7 +36,7 @@ const asAgent = (ctx, agent, thread, where, approved = []) => {
34
36
  : ctx;
35
37
  };
36
38
  /** The space a thread is in, where its turns work: what they write elsewhere needs a person. */
37
- const spaceOf = async (ctx, thread) => (await ctx.as().db.collection("thread").findOne({ _id: thread }))?.in;
39
+ export const spaceOf = async (ctx, thread) => (await ctx.as().db.collection("thread").findOne({ _id: thread }))?.in;
38
40
  /**
39
41
  * The model it thinks with this turn: what the `agentModel` resource says for
40
42
  * it in this conversation and space (with the kind it works `like`, else its
@@ -7,9 +7,10 @@ const viewable = (type) => /^image\/(png|jpeg|gif|webp)$/.test(type) || type ===
7
7
  /**
8
8
  * Its files, as an agent reads them: text files' content, what audio says,
9
9
  * images and PDFs as they are (named in the text too), the rest by name.
10
- * Each file's content is read on its own, all in the same pass: one answer
11
- * from the owner carries one file, never a message's files together, which
12
- * could pass the most one answer carries (16 MiB).
10
+ * Each says its id, which a tool takes to use the file itself (a computer's
11
+ * `save_file`). Each file's content is read on its own, all in the same
12
+ * pass: one answer from the owner carries one file, never a message's files
13
+ * together, which could pass the most one answer carries (16 MiB).
13
14
  */
14
15
  function attached(m, ctx) {
15
16
  if (!m.files?.length)
@@ -20,19 +21,19 @@ function attached(m, ctx) {
20
21
  ? ctx.db.collection("file").findOne({ _id: f.id }).value?.data
21
22
  : undefined;
22
23
  if (f.transcript !== undefined) {
23
- return `\n[${f.voice ? "voice message" : `audio ${f.name}`}, transcribed]\n${f.transcript}` +
24
- `\n[end of ${f.voice ? "voice message" : f.name}]`;
24
+ return `\n[${f.voice ? "voice message" : `audio ${f.name}`}, transcribed, id ${f.id}]\n` +
25
+ `${f.transcript}\n[end of ${f.voice ? "voice message" : f.name}]`;
25
26
  }
26
27
  if (data !== undefined && viewable(f.type)) {
27
28
  files.push({ name: f.name, type: f.type, data });
28
- return `\n[${f.type === "application/pdf" ? "pdf" : "image"} ${f.name}]`;
29
+ return `\n[${f.type === "application/pdf" ? "pdf" : "image"} ${f.name}, id ${f.id}]`;
29
30
  }
30
31
  if (data === undefined || !textual(f.type)) {
31
- return `\n[file ${f.name}: ${f.type}, ${f.size} bytes]`;
32
+ return `\n[file ${f.name}: ${f.type}, ${f.size} bytes, id ${f.id}]`;
32
33
  }
33
34
  const content = text(data);
34
35
  const cut = content.length > FILE_CHARS ? `${content.slice(0, FILE_CHARS)}\n[…cut]` : content;
35
- return `\n[file ${f.name}]\n${cut}\n[end of ${f.name}]`;
36
+ return `\n[file ${f.name}, id ${f.id}]\n${cut}\n[end of ${f.name}]`;
36
37
  });
37
38
  return { text: lines.join(""), files };
38
39
  }
@@ -1 +1 @@
1
- export declare const say: import("../../../../../hosts/web/words.js").Say<"kind" | "agent" | "person" | "time" | "seconds" | "model" | "tokens" | "activity" | "space" | "tryAgain" | "thisMonth" | "billing" | "month" | "day" | "onDay" | "justYou" | "anAgent" | "you" | "saved" | "calls" | "everyone" | "hours" | "plan" | "aConversation" | "yourPersonalSpace" | "minutes" | "uses" | "requests" | "unpriced" | "gbHours" | "notTiedToAnyone" | "spaceNotRecorded" | "spaceNotReached" | "personalSpaceOf" | "quoted" | "readError" | "whoseUsage" | "readAgain" | "ownUsage" | "keptTo" | "showingOnly" | "chipWhat" | "showAllNotOnly" | "showEverything" | "nothingUsedThisMonth" | "nothingUsedIn" | "emptyEveryone" | "emptyOwn" | "spentThisMonth" | "spentIn" | "spentByYouThisMonth" | "spentByYouIn" | "shareOfAll" | "shareOfBudget" | "budgetUsedUp" | "outOfCredits" | "creditsLeft" | "creditsLeftLasts" | "budgetLeft" | "budgetLeftLasts" | "budgetLeftEnough" | "meterLabel" | "meterValue" | "meterNow" | "versus" | "pointLastMonth" | "nothingByPoint" | "nothingIn" | "cachingSaved" | "cachingCost" | "staffOnly" | "costOf" | "marginOf" | "underCost" | "overCost" | "lastsLessThanDay" | "lastsDay" | "lastsDays" | "lastsWeeks" | "lastsMonths" | "lastsYear" | "savedNothing" | "savedNegative" | "hoursMinutes" | "byKind" | "bySpace" | "byPerson" | "byAgent" | "byModel" | "kindAgents" | "kindComputers" | "kindApps" | "purposeHistory" | "purposeMemory" | "purposeTranscription" | "purposeDraft" | "conversationUpkeep" | "otherModelUse" | "upkeepDetail" | "beforeSpaces" | "spendBy" | "theRest" | "chartLabel" | "rowsLabel" | "showAllAgain" | "seeOnly" | "rowCost" | "rowCostMargin" | "showFewer" | "showAll" | "fromInputCache" | "chartKeys" | "stillToCome" | "hideNumbers" | "showNumbers" | "spend" | "dayAnnounced" | "seriesAnnounced" | "yourKey" | "yourKeyTitle" | "planTitle" | "noKnownCost" | "staffCostMargin" | "activityEveryone" | "activityEveryoneFiltered" | "activityYours" | "activityYoursFiltered" | "nothingMatches" | "showOlder" | "aComputer" | "anApp" | "turnTitle" | "upkeepOf" | "modelCalls" | "fromCache" | "diskOf" | "snapshotOf" | "computerTitle" | "woke" | "appTitle" | "buildMinutes" | "meterTitle" | "hideModelCalls" | "showModelCalls" | "inColumn" | "fromCacheColumn" | "outColumn" | "costColumn">;
1
+ export declare const say: import("../../../../../hosts/web/words.js").Say<"kind" | "agent" | "person" | "time" | "seconds" | "model" | "space" | "tokens" | "activity" | "tryAgain" | "thisMonth" | "billing" | "month" | "day" | "onDay" | "justYou" | "anAgent" | "you" | "saved" | "calls" | "everyone" | "hours" | "plan" | "aConversation" | "yourPersonalSpace" | "minutes" | "uses" | "requests" | "unpriced" | "gbHours" | "notTiedToAnyone" | "spaceNotRecorded" | "spaceNotReached" | "personalSpaceOf" | "quoted" | "readError" | "whoseUsage" | "readAgain" | "ownUsage" | "keptTo" | "showingOnly" | "chipWhat" | "showAllNotOnly" | "showEverything" | "nothingUsedThisMonth" | "nothingUsedIn" | "emptyEveryone" | "emptyOwn" | "spentThisMonth" | "spentIn" | "spentByYouThisMonth" | "spentByYouIn" | "shareOfAll" | "shareOfBudget" | "budgetUsedUp" | "outOfCredits" | "creditsLeft" | "creditsLeftLasts" | "budgetLeft" | "budgetLeftLasts" | "budgetLeftEnough" | "meterLabel" | "meterValue" | "meterNow" | "versus" | "pointLastMonth" | "nothingByPoint" | "nothingIn" | "cachingSaved" | "cachingCost" | "staffOnly" | "costOf" | "marginOf" | "underCost" | "overCost" | "lastsLessThanDay" | "lastsDay" | "lastsDays" | "lastsWeeks" | "lastsMonths" | "lastsYear" | "savedNothing" | "savedNegative" | "hoursMinutes" | "byKind" | "bySpace" | "byPerson" | "byAgent" | "byModel" | "kindAgents" | "kindComputers" | "kindApps" | "purposeHistory" | "purposeMemory" | "purposeTranscription" | "purposeDraft" | "conversationUpkeep" | "otherModelUse" | "upkeepDetail" | "beforeSpaces" | "spendBy" | "theRest" | "chartLabel" | "rowsLabel" | "showAllAgain" | "seeOnly" | "rowCost" | "rowCostMargin" | "showFewer" | "showAll" | "fromInputCache" | "chartKeys" | "stillToCome" | "hideNumbers" | "showNumbers" | "spend" | "dayAnnounced" | "seriesAnnounced" | "yourKey" | "yourKeyTitle" | "planTitle" | "noKnownCost" | "staffCostMargin" | "activityEveryone" | "activityEveryoneFiltered" | "activityYours" | "activityYoursFiltered" | "nothingMatches" | "showOlder" | "aComputer" | "anApp" | "turnTitle" | "upkeepOf" | "modelCalls" | "fromCache" | "diskOf" | "snapshotOf" | "computerTitle" | "woke" | "appTitle" | "buildMinutes" | "meterTitle" | "hideModelCalls" | "showModelCalls" | "inColumn" | "fromCacheColumn" | "outColumn" | "costColumn">;
@@ -0,0 +1 @@
1
+ export declare const uploadAction: import("../../../../runtime/define.js").ActionDef;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `computer.upload` `{ desk, path }`: a person putting a file on a space's
3
+ * computer (its desk there), at `path` in the space's folder: only where
4
+ * they may change it from its panel (`computer.work`'s rules), a computer
5
+ * that sleeps woken, and said to be in use. It answers where the bytes go,
6
+ * `{ computer, scope }`, for the upload route (routes/upload.ts) to stream
7
+ * them there: an Action is given JSON, never a stream. On the record: who
8
+ * put what where, never its content.
9
+ */
10
+ import { defineAction, inPerson } from "../../../../runtime/mod.js";
11
+ import { personalDesk } from "../shared/desks.js";
12
+ import { touch } from "../shared/wake.js";
13
+ export const uploadAction = defineAction({
14
+ description: "Puts a file on a space's computer, in its folder there: where its bytes go",
15
+ input: {
16
+ type: "object",
17
+ properties: {
18
+ desk: { type: "string" },
19
+ /** Where in the space's folder, relative to it. */
20
+ path: { type: "string", minLength: 1, maxLength: 4096 },
21
+ },
22
+ required: ["desk", "path"],
23
+ additionalProperties: false,
24
+ },
25
+ allow: inPerson,
26
+ run: async (ctx, input) => {
27
+ const { desk, woke } = await personalDesk(ctx, input.desk, true);
28
+ await touch(ctx, desk.computer);
29
+ return {
30
+ computer: desk.computer,
31
+ scope: { space: desk.in, folder: desk.folder, who: `person:${ctx.actor.id}` },
32
+ ...(woke !== undefined ? { woke } : {}),
33
+ };
34
+ },
35
+ });
@@ -9,12 +9,12 @@
9
9
  * a while by it; what only reads (a panel polling its jobs) neither wakes it
10
10
  * nor keeps it awake, so a page left open lets it sleep.
11
11
  */
12
- import { defineAction, forbidden, inPerson } from "../../../../runtime/mod.js";
12
+ import { defineAction, inPerson } from "../../../../runtime/mod.js";
13
+ import { personalDesk } from "../shared/desks.js";
13
14
  import { failed } from "../shared/failed.js";
14
15
  import { jobEnv } from "../shared/env.js";
15
- import { touch, wake } from "../shared/wake.js";
16
+ import { touch } from "../shared/wake.js";
16
17
  import { WORK } from "../shared/workloads.js";
17
- import { must } from "../../../access/spaces/contract.js";
18
18
  /** What a person may do on their computer from its panel. */
19
19
  const PANEL = {
20
20
  terminal: WORK.terminal,
@@ -49,27 +49,13 @@ export const workAction = defineAction({
49
49
  },
50
50
  allow: inPerson,
51
51
  run: async (ctx, input) => {
52
- // The rules reach only the desks of spaces the person is in; working there takes more.
53
- const desk = await ctx.db.collection("desk").findOne({ _id: input.desk });
54
- if (!desk)
55
- throw Object.assign(new Error("No such computer here"), { code: "invalid" });
56
- await must(ctx, "write", desk.in, "You can't work in this space.");
57
- // Where its owner answers for it, nobody else changes anything on it without them.
58
- if (desk.answers === "owner" && desk.owner !== ctx.actor.id && !READS.has(input.work)) {
59
- throw forbidden("Its owner keeps this computer's answers: only they work on it directly.");
60
- }
61
- const who = input.as && input.work.startsWith("jobs.") ? input.as : `person:${ctx.actor.id}`;
62
52
  // A computer that sleeps (a cloud computer) is woken first; used, it stays awake a while.
63
- if (!desk.online && !READS.has(input.work)) {
64
- const woke = await wake(ctx, desk.computer);
65
- if (typeof woke === "string") {
66
- throw Object.assign(new Error(woke), { code: "unavailable" });
67
- }
68
- if (!woke && input.work === "wake") {
69
- throw Object.assign(new Error("The computer is offline: its owner starts it again."), {
70
- code: "offline",
71
- });
72
- }
53
+ const { desk, woke } = await personalDesk(ctx, input.desk, !READS.has(input.work));
54
+ const who = input.as && input.work.startsWith("jobs.") ? input.as : `person:${ctx.actor.id}`;
55
+ if (woke === false && input.work === "wake") {
56
+ throw Object.assign(new Error("The computer is offline: its owner starts it again."), {
57
+ code: "offline",
58
+ });
73
59
  }
74
60
  // What changes something keeps it awake a while; reading (a panel polling its jobs) doesn't:
75
61
  // a person with it open keeps it awake with computer.view, up to the app's limit.
@@ -188,6 +188,10 @@ export const engineAdapter = {
188
188
  if ((event.code === "stale" || event.code === "lost" || event.code === "busy") &&
189
189
  !wrote && !tries) {
190
190
  stale = event.code;
191
+ // On the log, so a plan that keeps starting over (its whole history again) shows.
192
+ const where = request.tags?.thread ? ` [thread=${request.tags.thread}]` : "";
193
+ console.warn(`computers: ${engine} session ${session ?? "(new)"} ${event.code} ` +
194
+ `(${event.message}): starting afresh${where}`);
191
195
  break;
192
196
  }
193
197
  throw engineFailure(`engine_${event.code}`, event.message);