cortico-world-agent-speed 0.2.0 → 0.2.1

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 (188) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +0 -14
  3. package/README.md +29 -11
  4. package/THIRD_PARTY_NOTICES.md +69 -0
  5. package/activity.d.ts +15 -0
  6. package/activity.js +88 -3
  7. package/describe.json +806 -0
  8. package/dist/webui.css +2 -0
  9. package/dist/webui.css.map +7 -0
  10. package/dist/webui.js +2 -0
  11. package/dist/webui.js.map +7 -0
  12. package/host/app-store.cjs +68 -0
  13. package/host/cursor.cjs +67 -0
  14. package/host/electron-main.cjs +666 -0
  15. package/host/input-shape.cjs +63 -0
  16. package/host/mouse-lease.cjs +77 -0
  17. package/host/overlay.cjs +139 -0
  18. package/host/portrait.cjs +52 -0
  19. package/host/preload.cjs +60 -14
  20. package/host/renderer-gone.cjs +24 -0
  21. package/host/windows.cjs +251 -0
  22. package/package.json +27 -7
  23. package/scripts/build-webui.mjs +40 -0
  24. package/scripts/speech-bank/build.py +166 -0
  25. package/scripts/speech-bank/dicts.py +76 -0
  26. package/src/ENV_PROMPT.en.md +51 -0
  27. package/src/ENV_PROMPT.md +51 -0
  28. package/src/asr/address.ts +25 -0
  29. package/src/asr/hotkey.ts +335 -0
  30. package/src/asr/result.ts +51 -0
  31. package/src/asr/segmenter.ts +269 -0
  32. package/src/asr/sherpa.ts +280 -0
  33. package/src/asr/simplify.ts +38 -0
  34. package/src/asr/system-recognizer.ts +292 -0
  35. package/src/asr/system-sapi.ps1 +173 -0
  36. package/src/asr/transcription-api.ts +176 -0
  37. package/src/chat.ts +212 -0
  38. package/src/config.ts +481 -0
  39. package/src/cua/ENV_PROMPT.en.md +29 -0
  40. package/src/cua/ENV_PROMPT.md +29 -0
  41. package/src/cua/config.ts +88 -0
  42. package/src/cua/cua.ts +712 -0
  43. package/src/cua/engine/darwin.ts +410 -0
  44. package/src/cua/engine/display.ts +55 -0
  45. package/src/cua/engine/fail.ts +15 -0
  46. package/src/cua/engine/foreground.ts +8 -0
  47. package/src/cua/engine/image.ts +57 -0
  48. package/src/cua/engine/keys.ts +70 -0
  49. package/src/cua/engine/linux-keys.ts +29 -0
  50. package/src/cua/engine/linux.ts +343 -0
  51. package/src/cua/engine/mac-keys.ts +57 -0
  52. package/src/cua/engine/user-activity.ts +54 -0
  53. package/src/cua/engine/wait-idle.ts +31 -0
  54. package/src/cua/engine/win32.ts +299 -0
  55. package/src/cua/engine-child.ts +274 -0
  56. package/src/cua/engine-ipc.ts +140 -0
  57. package/src/cua/i18n/de.ts +53 -0
  58. package/src/cua/i18n/en.ts +63 -0
  59. package/src/cua/i18n/es-419.ts +53 -0
  60. package/src/cua/i18n/fr.ts +53 -0
  61. package/src/cua/i18n/index.ts +26 -0
  62. package/src/cua/i18n/it.ts +53 -0
  63. package/src/cua/i18n/ja.ts +53 -0
  64. package/src/cua/i18n/ko.ts +53 -0
  65. package/src/cua/i18n/pt-BR.ts +53 -0
  66. package/src/cua/i18n/ru.ts +59 -0
  67. package/src/cua/i18n/zh-Hant.ts +53 -0
  68. package/src/cua/i18n/zh.ts +59 -0
  69. package/src/cua/model-text.ts +252 -0
  70. package/src/cua/terminal.ts +31 -0
  71. package/src/cua/tools.ts +153 -0
  72. package/src/definition.ts +146 -0
  73. package/src/host-reason.ts +32 -0
  74. package/src/i18n/de.ts +409 -0
  75. package/src/i18n/en.ts +443 -0
  76. package/src/i18n/es-419.ts +409 -0
  77. package/src/i18n/fr.ts +409 -0
  78. package/src/i18n/index.ts +56 -0
  79. package/src/i18n/it.ts +409 -0
  80. package/src/i18n/ja.ts +409 -0
  81. package/src/i18n/ko.ts +409 -0
  82. package/src/i18n/pt-BR.ts +409 -0
  83. package/src/i18n/ru.ts +415 -0
  84. package/src/i18n/zh-Hant.ts +409 -0
  85. package/src/i18n/zh.ts +440 -0
  86. package/src/index.ts +15 -0
  87. package/src/model-text.ts +344 -0
  88. package/src/moves.ts +101 -0
  89. package/src/pack-import.ts +236 -0
  90. package/src/packs.ts +449 -0
  91. package/src/runtime/download.ts +29 -0
  92. package/src/runtime/store.ts +293 -0
  93. package/src/script.ts +202 -0
  94. package/src/self.ts +247 -0
  95. package/src/server.ts +479 -0
  96. package/src/speech/data/CMUDICT-LICENSE +33 -0
  97. package/src/speech/data/IPADIC-COPYING +71 -0
  98. package/src/speech/data/UNICODE-LICENSE +39 -0
  99. package/src/speech/data/en.tsv.gz +0 -0
  100. package/src/speech/data/ja-ipadic.tsv.gz +0 -0
  101. package/src/speech/data/ja-unihan.tsv.gz +0 -0
  102. package/src/speech/data/zh.json +1 -0
  103. package/src/speech/index.ts +204 -0
  104. package/src/speech/ipa.ts +83 -0
  105. package/src/speech/japanese.ts +105 -0
  106. package/src/speech/jukujikun.ts +22 -0
  107. package/src/speech/korean.ts +35 -0
  108. package/src/speech/lang.ts +151 -0
  109. package/src/speech/rules.ts +72 -0
  110. package/src/speech/syllable.ts +76 -0
  111. package/src/status.ts +164 -0
  112. package/src/tools.ts +110 -0
  113. package/src/webui/api-rows.css +2 -0
  114. package/src/webui/api-rows.ts +44 -0
  115. package/src/webui/client.ts +462 -0
  116. package/src/webui/dress-dialog.css +14 -0
  117. package/src/webui/dress-dialog.ts +117 -0
  118. package/src/webui/key-capture.ts +60 -0
  119. package/src/webui/shared/modal.css +13 -0
  120. package/src/webui/shared/modal.ts +77 -0
  121. package/src/webui/shared/problem.css +15 -0
  122. package/src/webui/shared/problem.ts +217 -0
  123. package/src/webui/shared/strings.ts +5 -0
  124. package/src/webui/style.css +39 -0
  125. package/src/window-host.ts +116 -0
  126. package/src/world.ts +2838 -0
  127. package/web/activity-motion.js +54 -0
  128. package/web/appearance.js +60 -0
  129. package/web/body-host.js +257 -0
  130. package/web/coo/coo.js +384 -0
  131. package/web/coo/figure.js +15 -0
  132. package/web/coo/figure.json +1224 -0
  133. package/web/dist/dress-dialog.css +1 -0
  134. package/web/dist/dress-dialog.js +1 -0
  135. package/web/drag-row.js +49 -0
  136. package/web/drag.js +149 -0
  137. package/web/dress.css +170 -0
  138. package/web/dress.html +37 -0
  139. package/web/dress.js +786 -0
  140. package/web/figure-frame.html +16 -0
  141. package/web/figure-frame.js +127 -0
  142. package/web/frame-loop.js +55 -0
  143. package/web/hints.js +77 -0
  144. package/web/i18n/de.js +170 -0
  145. package/web/i18n/en.js +177 -0
  146. package/web/i18n/es-419.js +170 -0
  147. package/web/i18n/fr.js +170 -0
  148. package/web/i18n/it.js +170 -0
  149. package/web/i18n/ja.js +170 -0
  150. package/web/i18n/ko.js +170 -0
  151. package/web/i18n/pt-BR.js +170 -0
  152. package/web/i18n/ru.js +170 -0
  153. package/web/i18n/zh-Hant.js +170 -0
  154. package/web/i18n/zh.js +175 -0
  155. package/web/i18n.js +54 -0
  156. package/{renderer/vendor → web}/kit/body.js +9 -53
  157. package/web/looks.js +70 -0
  158. package/web/mic-worklet.js +36 -0
  159. package/web/mic.js +117 -0
  160. package/web/motion-frames.js +80 -0
  161. package/web/motion-level.js +40 -0
  162. package/web/new-year-2027.svg +238 -0
  163. package/web/overlay.html +16 -0
  164. package/web/overlay.js +100 -0
  165. package/web/pet-app.js +2992 -0
  166. package/web/pet.css +642 -0
  167. package/web/pet.html +21 -0
  168. package/web/scale-slider.js +259 -0
  169. package/web/show-hide.js +49 -0
  170. package/web/sound.js +245 -0
  171. package/web/speech/zh.json +1 -0
  172. package/web/speech/zh.ogg +0 -0
  173. package/web/speech.js +197 -0
  174. package/web/stage.js +160 -0
  175. package/web/swap-motion.js +119 -0
  176. package/web/ui.js +195 -0
  177. package/host/launch.js +0 -187
  178. package/host/library.cjs +0 -638
  179. package/host/main.cjs +0 -389
  180. package/index.js +0 -93
  181. package/renderer/index.html +0 -22
  182. package/renderer/pet-sandbox.html +0 -11
  183. package/renderer/pet.css +0 -38
  184. package/renderer/pet.js +0 -251
  185. package/renderer/vendor/activity-motion.js +0 -101
  186. package/renderer/vendor/figure-frame.js +0 -115
  187. package/renderer/vendor/pack.css +0 -2
  188. /package/{renderer/vendor → web}/kit/rig.js +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,62 @@
1
+ # Agent Speed fork
2
+
3
+ - Replaced the separate renderer with the pinned Coopanion Desktop Pet World and official Coo figure. The extension has independent settings, runtime, storage, tool names and window lifecycle.
4
+ - Agent Speed activity animates the figure locally through the official window's connection. Supported desktop releases use either the live IPC feed or the v1 local snapshot.
5
+ - DeepSeek Chan artwork is not redistributed; the official dressing page can import separately licensed figure packs.
6
+
7
+ # Upstream Desktop Pet change history
8
+
9
+ ## Unreleased
10
+
11
+ - Each end of the pet window's and the dressing window's renderer is logged at WARN with its reason and exit code (in hex on Windows), noting when its page had not finished loading (`host/renderer-gone.cjs` `watchRenderer`, which an app can use for its own windows). Until the page loads again, the host stops sending it the cursor and the other windows' positions. Lines of the window process starting with `[warn] ` are logged at WARN, the rest at debug as before.
12
+ - The description of `window.electronFile` says it is used only while `CORTICO_DESKTOP_PET_HOST` is not set.
13
+ - Windows: after the scale of the pet window's display changes while the app runs, the window covers the work area again; it used to come out sized by the ratio of the old and new scales.
14
+ - Config `asr.serviceEnabled` (on by default): off, the recognition service does not start while voice input is on; the voice panel's `start` and `stop` methods write it, and `state` carries it. With `asr.recording.transcript` off and the endpoint taking `audio/wav`, a batch goes as its recording once captured, without waiting for recognition; a transcript recognized afterwards is stored as a `desktop-pet.self` `transcript` record and sent to chat pages as `transcript { cursor, text }`, never delivered.
15
+ - Config `cua.risksConfirmed` (off by default): the person confirmed computer use's risks in the settings window. While it is on, the pet's `cua` hover button turns computer use on as well as off (`prefs` `cua: true`, which the World refuses otherwise); the page's `prefs.cua` carries `confirmed`.
16
+ - The 「语音输入」 panel shows the explanations of the engine, how to talk, opening on press, the recording, the transcript and the recording limit whole, in the page's text font; status details (paths, the window, the runtime) keep to two lines.
17
+ - Config `window.fade` (0–95, in steps of 5, 0 by default): how transparent the body is, in percent, whatever it does (talking, asking, held, the typing box open); no bubble fades with it, nor the hover buttons, the menu and the sliders. On Windows, `window.fadeWhenFullscreen` (off by default) takes `window.fullscreenFade` (40 by default) in its place while a fullscreen window covers the pet's display. The change fades over 0.2 s.
18
+ - Hover buttons `fade` and `cua`. `fade` shows a transparency slider over the head, in the size slider's place and as it opens and pins; it sets the transparency in force. `cua` shows whether computer use is on: a click switches it off (`prefs` `cua: false`), or, while off, opens the settings window's switch through `controls.openCuaSettings`. The page's `prefs` carry `fade`, `fadeWhenFullscreen`, `fullscreenFade` and `cua: { on, canOpen }`; each slider over the head is its own `.head-slider[data-kind]` element (was `#sizer`).
19
+ - Text past its cap stays in the field and is not sent; the field's border turns red and the count shows beside the send button: the typing box (500 characters, with a line under it pointing to the Chat page while the text is within that page's cap; the expand button is disabled past it), a written answer (200) and a dialog's text field (its `maxLength`, 200 when absent). Before, the fields' `maxlength` cut pasted text without a word. The chat stream's `init` carries `textMax` and `answerMax`, and the page's `prefs.bot` carries `textMax: { box, chat }`; the World still cuts text past them.
20
+ - Every bubble with a close button (a question, a confirmation, an app's dialog that can be closed, the typing box) has it outside the bubble on its right, a small round button drawn as the hover buttons are; the bubble keeps its usual right padding, and a question's choices take its whole width. The × is drawn in the button's middle. Placed by the screen's right side, the bubble moves over so the button stays on the screen; the cursor on the button holds the bubble as it does on the bubble, and the OBS overlay's capture and `pet_see_self`'s picture count the button with the bubble. Before, the × sat in the bubble's top right corner.
21
+ - Once its text runs past one row, the typing box's text takes the field's whole width, with the expand and send buttons under it, until the box is cleared; its close button and scrollbar sit outside the bubble on its right: a small round button drawn as the hover buttons are, and under it, centred, a thumb on a faint track while the text scrolls (dragged, it scrolls the text; a press on the track pages; the wheel over it scrolls), and text cut off at the field's top or bottom fades out there; the textarea's own scrollbar is not shown, and the bubble keeps its usual right padding. The empty box's hint keeps to one row in every language (the field is as wide as the hint, and the bubble goes past its usual widest when the hint needs it, fitted again when `bubbleSize` or `fontSize` changes), so the box no longer shrinks by a row at the first key. Before, the text kept to the part of the field the buttons left and scrolled with the system's scrollbar inside it.
22
+ - An automatic input bubble fades 0.5 s after the reply's last line is written out, before the reply's bubble closes (or 0.5 s after the reply closes, if that comes first); it faded 1 s after the reply closed.
23
+ - A line of Coo's or of the person's that wraps takes the narrowest bubble that holds it in as many lines (`balancedWidth` in `web/ui.js`): its lines come out about as long as each other and the bubble no longer stays at its widest with blank space after them. Bubbles up are fitted again when `bubbleSize`, `fontSize` or the window's width changes, so a line does not wrap into one more row.
24
+ - A bubble's tail keeps its base on the bubble's straight bottom edge at any `bubbleSize`: its tip stays 29px times the size from the bubble's sides (`tailAt` and `TAIL_EDGE` in `web/ui.js`), and the narrowest bubble is 58px times the size wide (it was 46px). By a bubble's side, and on a bubble of a word or two, the tail used to reach into the rounded corners and break the outline there, more so at larger sizes.
25
+ - A bubble's tail draws its line as wide as the bubble's border is drawn, at any `bubbleSize` and display scale; enlarged, the line grew thicker with the tail, and it stayed 2.5px where the border is drawn 2px.
26
+ - Config `window.sayBubbleHoldSec` and `saidBubbleHoldSec` (integer seconds, 0–60, 0 by default): 1–60 holds each part of a line that long once typed out, or an input bubble that long from when it was sent or recognized; 0 keeps the automatic holds. `pet_say` receipts count a fixed speech hold, for the line and for those queued ahead of it.
27
+ - Config `asr.recording` (`enabled` and `transcript` on, `maxMinutes` 5 by default, 1–7): while `enabled` is on and the endpoint takes `audio/wav`, a `desktop-pet.speech` event carries the batch's recording as a WAV attachment; with `transcript` off its text leaves out what was recognized. A batch whose recording runs past `maxMinutes` goes as text alone. The voice panel has a row for each, and its `state` carries `recording` with `range` and `endpointTakesAudio`; panel method `setRecording`.
28
+ - The managed Electron runtime that hosts the pet window outside an app has a Windows arm64 build (`win32-arm64`).
29
+ - Config `window.hideFromCapture` (Windows, off by default): on, the pet window is left out of screenshots and screen recordings (`setContentProtection`), those of `pet_cua_screenshot` included.
30
+ - Config `window.overTaskbar` (Windows, on by default): off, the pet window ends at the work area's bottom and no longer reaches down over the taskbar.
31
+ - A pack the pet page could not run is logged at WARN with its id and the reason, and listed in `GET /api/figures/status` `problems` until the page shows it. The `desktop-pet.figure` event of the failure carries the reason in `meta.figure.reason`, which the chat page shows.
32
+ - A kit body walks up to the screen edges as far as its figure's `extent` allows, each side by what `extent` reaches on that side as the body faces now (`extent` mirrored about x=128 facing left): a lopsided body that turns round at an edge moves in with the turn. Its hover buttons sit by the wider side of `extent` (`side.reach`). A figure without `extent` keeps the 104-unit margin. The `bounds` a pack's `moves` receive carry in `minX` and `maxX` where a walk to that side ends. `createPet` takes `opts.startFacing` (1 or -1).
33
+ - The right-click menu shows only the actions picked as hover buttons (`hoverButtons`), beside the run controls the app lends; the actions not picked are no longer listed there. `hoverButtons` may be empty (0–6, it was 1–6), from the settings window and from `pet_set`: no buttons on hover, and a menu of the run controls alone, or none without them.
34
+ - A pet dialog takes `{ kind: 'pick', options, value?, min?, max, confirm }`: cards of which `min` (1 when absent) to `max` are picked, answered as `{ picked: [index, …] }` in the cards' order, holding only indices of its own cards.
35
+ - `PET_ACTIONS`, `MAX_HOVER_BUTTONS`, `hoverButtonList` and the type `PetAction` are exported.
36
+ - Tool `pet_see_self` (no arguments): a PNG of the body as the pet window draws it at the moment of the call, over a grey backdrop, without the page's bubbles and buttons, with a line naming the figure and its dress. The World sends the page a `portrait` order; the page answers `portrait` with `{ png, width, height }` (from `petHost.portrait(rect)`, `host/portrait.cjs`) or `{ failed }` (`tab`, `hidden`, `no-body`, `capture`). Figure packs take no part in it.
37
+ - Each figure keeps its own size: the config's `figureScales` holds, per pack id, the `window.scale` a figure had when another replaced it, and a figure put on takes its own back unless the size changed with it. `POST /api/prefs` takes `scale`, and `POST /api/skin` an optional `scale` to put the look on at. Saved looks keep an optional `scale` (`SavedLook.scale`); one without it goes on at its figure's own size, or at the size on screen when the figure has none.
38
+ - `size` is a pet action (`PET_ACTIONS`, `hoverButtons`): hovering its button shows a size slider over the body. The dressing page has a size row under the figures. Both draw the slider of `web/scale-slider.js`.
39
+ - A describer's `PetStatus` may carry `countdown`, the seconds a call lasts. When that call starts running (RunPhase `running`), `StatusTracker` sends `endsAt` in its place, the Date.now() milliseconds the countdown ends, and only while the call runs; the page shows the whole seconds left after `text`, out of what screen readers read. A describer that sets no `countdown` behaves as before. `waitSeconds(seconds)` is exported: how long `pet_cua_wait` waits for an argument, 0–30, 1 when absent.
40
+ - Sound kind `alert` (`worlds.desktop-pet.sounds.alert`, on by default) plays once as a confirmation bubble shows. Packs cannot file sounds under it.
41
+ - A click on a line's bubble, away from its links, ends the whole line and the page reports `skipped` with the line's id; questions and confirmations still close only by their × or an answer.
42
+ - While the pet window is hidden the page ticks the body with `draw` false (`tick { dt, draw }`, `step(dt, draw)`): the body moves on without drawing, so walks still arrive. `kit.createBody` honours it; a pack that ignores it draws as before.
43
+ - `kit.createBody(host, { ground: 'free' })` builds a body that stands anywhere on the stage above the floor, seen from above: it walks to any point, is set down where it is let go of, and a throw tosses it across the stage. Such a body reports `y` (the stage y its feet stand on) in `layout()`, in `arrived` and `interrupted`; the World keeps it with the remembered position (`petY`, hands it back as `start.y` and `init.startY`) and names it in `pet_move_to`'s receipt. `place(x, facing, y)` takes an optional `y`. Bodies without `y` behave as before.
44
+ - `kit.createBody` answers the pack's own targets through `opts.moves`: `{ id: (params, bounds) => ({ x, y? }) | null }`.
45
+ - Every body hears `set({ status })`, the kind of work the status bubble shows (or null); the kit hands it to the figure as `frame.status`.
46
+ - figure.json may add `voice` (`{ pitch }`, 0.5–2), sounds of kind `talk` (played letter by letter in place of the synthesized babble), `effects` (`{ reach }`, how far past its box a pack draws, in 256-unit squares, 0–2: the halo's window and the OBS overlay's capture grow by it) and `bubble` (`{ light, dark }` of `{ fill, text, line }`, on the pack or a preset) for the bot's bubbles. Older apps skip all of them; `/api/figures` lists `voice`, `effects` and `bubble`.
47
+ - A sound in figure.json may set `repeat`, what happens when it is asked for while its last play has not ended: `restart` fades that play out over 30 ms and plays from the start, `finish` leaves this one out, `overlap` (the default) plays over it. `talk` sounds ignore it; a value this version does not know is named in the scan's problems and plays as `overlap`. Older apps play every sound as `overlap`.
48
+
49
+ - `HOST_ENV` and `HOST_MAIN` are internal to the window host and no longer exported. Embedding apps configure the command with `CORTICO_DESKTOP_PET_HOST`.
50
+ - An app can lend the bot's name as `botName()` in `desktopPetDefinition`'s assembly; it is read at each use, so the menu header, the chat page (a `bot` frame) and computer use's question follow a rename without a World restart. Without it the World keeps the name it was mounted with. `DesktopPetWorldOptions.botName` and `CuaOptions.botName` are functions now.
51
+ - `pet_walk_to` is now `pet_move_to`, with the same `to` and `run` and an optional `params`. A bot that names the old tool has to use the new name.
52
+ - Figure packs may declare targets of their own for it (`moves` in figure.json): the World checks the call's params against the pack and the body does the move (`move(args, id)`), reporting `arrived` or `interrupted` as walks do. The bot reads the targets in `{{pet.moves}}` and hears of added and removed ones on a figure switch. Packs without `moves`, Coo and the whale among them, behave as before.
53
+ - A pack that `needs` `windows` gets the visible top edges of the other windows on the pet's display in `host.bounds().ledges`, and those windows whole in `host.bounds().windows` (front first, each with an opaque id and, except on macOS, whether it is the foreground window), on Windows, macOS and Linux under X11 (the last two not yet tried on a machine); the window process reads none for other packs. `petHost.onWindows` hands the page `{ ledges, windows }`.
54
+ - The window host's `--pet-url` is `http://127.0.0.1:<port>/pet#key=<credential>`, the credential random. A host set by `CORTICO_DESKTOP_PET_HOST` passes the URL on and loads it unchanged, the part after `#` included. `petUrl`, `petState().url` and the panel's links carry no credential.
55
+ - The pet window's socket (`host=window`) and the OBS overlay source (`role=overlay-source`) put that credential in the `/socket` query as `key`; a socket without it or with another one is answered 403.
56
+ - Browser writes (every method but GET and HEAD) and the WebSocket are accepted only with the service's own HTTP origin, port included (`http://127.0.0.1:<port>` or `http://localhost:<port>`); any other Origin is answered 421. A client that sends no Origin is accepted.
57
+ - `POST /api/figures/import/install` answers 409 with `{ conflicts: [id, …] }` when a chosen pack's id is installed or `figures/<id>/` exists, and then changes no file and keeps the staged import. The same request with the same `token` and `replace: [id, …]` naming every conflicting id replaces them. An install without conflicts takes no new field. Once an install passes these checks its token is spent.
58
+
59
+ ## 0.2.0
60
+
61
+ - Needs Cortico 0.2.0 (world contract 6): the panels are declared by `webUi()`, and the panel bundle is `dist/webui.js` and `dist/webui.css`.
62
+ - Self-description: `describe` on the definition lists every tool, computer use included, and every event; written out to `describe.json`.
package/LICENSE CHANGED
@@ -1,17 +1,3 @@
1
- Coopanion is licensed under the GNU Affero General Public License, version 3 or (at
2
- your option) any later version, whose text follows, with the additional permission
3
- below. The permission covers every part of this repository, its packages included.
4
-
5
- Additional permission under GNU AGPL version 3 section 7
6
-
7
- If you modify this Program, or any covered work, by linking or combining it with the
8
- Steamworks API redistributable libraries of Valve Corporation's Steamworks SDK
9
- (steam_api, steam_api64, libsteam_api), or a modified version of those libraries,
10
- containing parts covered by the terms of the Steamworks SDK Access Agreement, the
11
- licensors of this Program grant you additional permission to convey the resulting work.
12
-
13
- --------------------------------------------------------------------------------------
14
-
15
1
  GNU AFFERO GENERAL PUBLIC LICENSE
16
2
  Version 3, 19 November 2007
17
3
 
package/README.md CHANGED
@@ -1,21 +1,39 @@
1
1
  # Agent Speed Pet for Coopanion / Cortico
2
2
 
3
- `cortico-world-agent-speed` 0.2 replaces the event-based 0.1 World. It runs its own desktop pet window and reads Agent Speed's local activity stream directly. It neither sends Bot events nor calls a model. No Coopanion patch, collector configuration, or additional SSH connection is required.
3
+ `cortico-world-agent-speed` is a fork of Coopanion's official Desktop Pet World. It keeps the transparent desktop window, built-in **Coo** figure, dressing screen, and World settings panel. Local Agent Speed activity drives the figure without sending activity to the bot or calling a model.
4
4
 
5
- ## Setup
5
+ ## Install and run
6
6
 
7
- 1. Use Coopanion v0.2.24 (World API 6) on macOS or Windows. Install or update `cortico-world-agent-speed` in the extension market, restart Coopanion, then enable **Agent Speed** in **My Worlds**. For development, link this directory through **Manual install → Local directory** after running `npm install` here. The first launch may download the pinned Electron runtime from Electron's release distribution.
8
- 2. In the new pet window, choose **Import figure pack**. Select a Coopanion manifest 2 / API 2 figure folder or ZIP that you have permission to use. No figures or textures are included. A raw Live2D model without a Coopanion figure manifest and entry module is not a supported pack. Imported packs live in this World's own profile; the native window menu lets you select or remove them.
9
- 3. In Agent Speed, open **Settings → General → Share activity with local extensions**. Use a desktop build that provides the activity socket on macOS or the named pipe on Windows, and run both apps as the same user. The older snapshot-file transport is not supported. **My Worlds** shows connection and window status separately.
7
+ Use **Coopanion v0.2.24** / Cortico World API 6 on **macOS or Windows**. For a registry release that contains this fork, install `cortico-world-agent-speed` from **Extensions → Worlds**. To try this checkout before a release, follow the local-link instructions below instead.
10
8
 
11
- The official pet is independent: hide it if you only want the Agent Speed pet. If you close the new window, disable and re-enable the Agent Speed World to reopen it. Disabling the World closes the window and the activity connection.
9
+ 1. Restart Coopanion after installation, then enable **Agent Speed** in **My Worlds**. The built-in Desktop Pet is a separate World; hide or disable it if you only want one figure.
10
+ 2. In the **Agent Speed** World page, install the **window runtime** if needed. This downloads upstream Electron **44.4.4** separately on first setup. Once it is ready, choose **Open window**. Alternatively, point `worlds.agent-speed.window.electronFile` at a standalone Electron executable, not the Coopanion application. The extension always runs its own copy of the upstream pet host.
11
+ 3. Run Agent Speed as the same user and turn on **Settings → General → Share activity with local extensions**. Builds with the Unix socket (macOS) or named pipe (Windows) use that live feed. Released desktop builds such as **Agent Speed v2.1.0** use the local `activity-v1.json` snapshot instead and do not need a desktop update. With no fresh feed, the window still works as a regular pet.
12
+ 4. Use the panel or the pet's **Dress up** menu to change Coo's appearance or import a figure folder or ZIP you have rights to use. A raw Live2D model is not a pack: it needs a Coopanion `figure.json` (manifest v2, figure API v2) and a compatible entry module. A pack previously added to the old plugin or the built-in Desktop Pet must be imported here separately.
12
13
 
13
- ## Animation
14
+ Closing the window leaves the World enabled; use **Open window** to reopen it. Disabling the World stops both the window process and the activity connection.
14
15
 
15
- Each sample replaces the current target. The renderer smooths changes in output speed rather than queueing one action per sample. With compatible packs, speed changes affect gait rhythm, body posture, gaze, and gestures. Tool-only activity selects a separate focus behavior. Pack capabilities vary; dragging takes priority, and disconnecting returns to idle without a completion gesture. The stream carries aggregate counts, rate, freshness and completeness, not prompts or transcripts.
16
+ ## Behavior and limits
16
17
 
17
- ## Source and license
18
+ - Only aggregate counts, output rate, freshness, and completeness are read from Agent Speed; the extension does not read prompts or transcripts from the activity feed. Output intensity and tool-only activity use different motions where the figure supports them. Stale or disconnected activity goes idle without playing a completion gesture.
19
+ - On top of activity animation, the World retains the upstream interactive pet. Actions such as typing to the pet or enabling voice can still involve the configured bot; **activity itself does not**. Voice input and computer use are off by default. If you deliberately assign the same global hotkey in both pets, use different keys or disable one binding.
20
+ - The built-in pet's Coopanion-specific tray, chat page, and first-run settings remain tied to the built-in World. The extension has its own tray, window, settings, figure storage, and tools (`speed_pet_*`), independent of `desktop-pet`. Linux is not an advertised target for this extension. Native Windows and macOS GUI operation has not been verified in this checkout.
18
21
 
19
- This npm package includes its editable source. It is licensed under AGPL-3.0-or-later; see [LICENSE](LICENSE). It is separate from the Agent Speed application and communicates with it only over local IPC. The original MIT notice for the reused Agent Speed adapter code is preserved in [LICENSE-MIT](LICENSE-MIT).
22
+ ## Develop and package
20
23
 
21
- The rendering runtime is derived from [Pal-AI-Lab/Coopanion v0.2.24](https://github.com/Pal-AI-Lab/Coopanion/tree/66f2155728e3563de75f112e1e6cbf723f3014e3/packages/cortico-world-desktop-pet/web): `figure-frame.js` and `kit/body.js` adapted in 2026 for an independent window and live activity input, and `kit/rig.js` reused unchanged. Upstream character art, sounds and textures are not included or covered by this package's license. Imported packs remain subject to their own terms.
24
+ From `coopanion_plugin/`, using Node.js 22+ and npm:
25
+
26
+ ```sh
27
+ npm install
28
+ npm run build
29
+ ```
30
+
31
+ Choose **Extensions → Worlds → Manual install → From a local directory** and select `coopanion_plugin/`, then restart Coopanion. Rebuild after changing `src/webui/` and restart to reload the extension. For a local tarball, run `npm pack` **after** building. The pack includes the editable TypeScript entry point, stock host and web files, `dist/webui.js` and `dist/webui.css` for the World panel, and `web/dist/dress-dialog.*` for the desktop dressing page. The compatible Cortico host supplies the `cortico/*` runtime imports; no framework checkout is needed for building the panel.
32
+
33
+ ## Source and asset rights
34
+
35
+ Based on [Pal-AI-Lab/Coopanion v0.2.24, commit `66f2155728e3563de75f112e1e6cbf723f3014e3`](https://github.com/Pal-AI-Lab/Coopanion/tree/66f2155728e3563de75f112e1e6cbf723f3014e3/packages/cortico-world-desktop-pet) and its shared panel components. See [LICENSE](LICENSE) (AGPL-3.0-or-later), [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), and the [upstream figure-pack documentation](https://github.com/Pal-AI-Lab/Coopanion/blob/66f2155728e3563de75f112e1e6cbf723f3014e3/packages/cortico-world-desktop-pet/README.md). The separately licensed Agent Speed activity adapter retains its [MIT notice](LICENSE-MIT).
36
+
37
+ `src/asr/address.ts` comes from the same upstream commit's Coo provider package.
38
+
39
+ The default Coo figure is shipped as upstream procedural source. DeepSeek Chan/whale artwork is excluded: upstream explicitly excludes it from the AGPL and documents the character and trademark rights. Import it separately only if you have permission. Other imported packs remain subject to their own terms.
@@ -0,0 +1,69 @@
1
+ # Agent Speed extension
2
+
3
+ The following are the original Coopanion Desktop Pet notices from Pal AI Lab. In this fork the window runtime is installed separately (the bundled Coopanion executable is not used), downloaded ASR models are stored under `agent-speed` rather than `desktop-pet`, and the DeepSeek Chan artwork described below is not included. The local activity client retains its [MIT notice](LICENSE-MIT).
4
+
5
+ # 第三方声明
6
+
7
+ 这个包依赖 sherpa-onnx 的 Node 插件,不带模型和 Electron。下面是随包安装的原生组件、运行时会去取的东西,以及各自的许可。
8
+
9
+ ## 识别运行库
10
+
11
+ [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) 的 Node 插件 `sherpa-onnx-node` 1.13.8 与各平台的
12
+ 预编译包(`sherpa-onnx-win-x64`、`sherpa-onnx-darwin-arm64`、`sherpa-onnx-darwin-x64`、`sherpa-onnx-linux-x64` 等),随 npm 依赖安装。
13
+ Apache-2.0;其中的 onnxruntime 为 MIT。
14
+
15
+ ## 模型
16
+
17
+ FunASR 的 SenseVoiceSmall(FunAudioLLM,通义实验室)与 OpenAI 的 Whisper small,都经 k2-fsa 转成 sherpa-onnx 用的 int8 ONNX,
18
+ 分别放在 `<模型根>/desktop-pet/sensevoice-small-int8-2024-07-17/` 与 `<模型根>/desktop-pet/whisper-small-int8-2024-07-13/`,按固定的 SHA-256 校验。
19
+
20
+ | 文件 | 来源(按顺序尝试) | 许可 |
21
+ |---|---|---|
22
+ | `model.int8.onnx`、`tokens.txt` | [ModelScope pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue](https://modelscope.cn/models/pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue),再 [Hugging Face csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17](https://huggingface.co/csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17) | [FunASR 模型开源协议](https://github.com/modelscope/FunASR/blob/main/MODEL_LICENSE) |
23
+ | `small-encoder.int8.onnx`、`small-decoder.int8.onnx`、`small-tokens.txt` | [ModelScope pengzhendong/sherpa-onnx-whisper-small](https://modelscope.cn/models/pengzhendong/sherpa-onnx-whisper-small),再 [Hugging Face csukuangfj/sherpa-onnx-whisper-small](https://huggingface.co/csukuangfj/sherpa-onnx-whisper-small) | [MIT](https://github.com/openai/whisper/blob/main/LICENSE) |
24
+
25
+ ## 桌宠窗口
26
+
27
+ Electron 44.4.4,从 [electron/electron releases](https://github.com/electron/electron/releases/tag/v44.4.4)
28
+ 取到 `<运行时根>/electron/44.4.4/`,或使用内嵌应用自带的那份。MIT;其中 Chromium 与依赖各随其许可。
29
+
30
+ ## DeepSeek 大肥鱼形象
31
+
32
+ `web/whale/` 的贴图由 ChatGPT(OpenAI 的图像模型)按参考图生成后拆件:角色原设为「溟月」(上善无形),
33
+ DeepSeek 女仆装二创参考 ZipZipPipe。围裙上的标志是 DeepSeek、OpenAI、Anthropic(Claude)、Google(Gemini)、
34
+ 阿里云(通义千问)、月之暗面(Kimi)、MiniMax 的商标图形,归各自的公司所有,只用来标明配色对应哪一家,
35
+ 与这些公司没有关联,也不代表其认可。
36
+
37
+ 这些贴图不在本包的 AGPL 授权范围内。它们随 Coopanion 分发,想在别处使用请自行确认原设与各家标志的权利。
38
+
39
+ ## 说话声
40
+
41
+ `web/speech/zh.ogg` 与 `zh.json` 的音节由 Microsoft Edge 的朗读服务以 `zh-CN-XiaoyiNeural` 声音逐个念出,
42
+ 再由 `scripts/speech-bank/build.py` 切短、定调、均衡后拼成。
43
+
44
+ `src/speech/data/en.tsv.gz` 取自 [CMU Pronouncing Dictionary](https://github.com/cmusphinx/cmudict)(经 Python 包 cmudict 1.1.3),
45
+ Copyright (C) 1993-2015 Carnegie Mellon University,BSD 式许可,全文见 [`src/speech/data/CMUDICT-LICENSE`](src/speech/data/CMUDICT-LICENSE)。
46
+
47
+ `src/speech/data/ja-ipadic.tsv.gz` 由 `scripts/speech-bank/dicts.py` 从 [mecab-ipadic](https://taku910.github.io/mecab/) 2.7.0-20070801 导出(含汉字的词条及其发音)。
48
+ Copyright 2000, 2001, 2002, 2003 Nara Institute of Science and Technology,许可允许使用、复制、修改和分发,条件是附上版权声明与许可条款(含 ICOT 的条款与免责声明),
49
+ 全文见 [`src/speech/data/IPADIC-COPYING`](src/speech/data/IPADIC-COPYING)。
50
+
51
+ `src/speech/data/ja-unihan.tsv.gz` 由同一脚本从 Unicode 18.0.0 Unihan 数据库的 `kJapanese` 字段导出。Copyright © 1991-2026 Unicode, Inc.,
52
+ UNICODE LICENSE V3,全文见 [`src/speech/data/UNICODE-LICENSE`](src/speech/data/UNICODE-LICENSE)。
53
+
54
+ `src/speech/jukujikun.ts` 是常用漢字表(平成 22 年内阁告示第 2 号)付表里的熟字训与读音;告示不受日本著作权法保护(第 13 条)。
55
+
56
+ `src/speech/data/zh.json` 由 `scripts/speech-bank/build.py` 用 [pypinyin](https://github.com/mozillazg/python-pinyin) 0.55.0 生成
57
+ (MIT),读音数据来自 [pinyin-data](https://github.com/mozillazg/pinyin-data)(MIT),源自 Unicode 的 Unihan 数据库([Unicode 许可](https://www.unicode.org/license.txt))。
58
+
59
+ ## 其他运行时依赖
60
+
61
+ - `ws`:MIT
62
+ - `opencc-js`(繁简转换):MIT AND Apache-2.0
63
+ - [koffi](https://koffi.dev/)(电脑操作调 Win32 API 与 macOS CoreGraphics 的 FFI):MIT
64
+ - [jpeg-js](https://github.com/jpeg-js/jpeg-js)(电脑操作截图的 JPEG 编码与解码):BSD-3-Clause
65
+
66
+ ## 本包的许可
67
+
68
+ AGPL-3.0-or-later,见 [`LICENSE`](LICENSE);`web/whale/` 的贴图除外,见上。
69
+ 并入 Coopanion 之前的版本(独立仓库 `Pal-AI-Lab/cortico-world-desktop-pet` 里的历史)是 MIT。
package/activity.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export interface ActivitySnapshot {
2
+ version: 1;
3
+ updatedAtMs: number;
4
+ generating: number;
5
+ tools: number;
6
+ outputPerSecond: number;
7
+ complete: boolean;
8
+ }
9
+
10
+ export function connectActivity(options: {
11
+ socketPath?: string;
12
+ snapshotPath?: string;
13
+ onSnapshot: (snapshot: ActivitySnapshot | null) => void;
14
+ onConnection?: (connected: boolean) => void;
15
+ }): () => void;
package/activity.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { lstat } from 'node:fs/promises';
2
+ import { constants } from 'node:fs';
3
+ import { lstat, open } from 'node:fs/promises';
3
4
  import { createConnection } from 'node:net';
5
+ import { homedir } from 'node:os';
6
+ import { isAbsolute, join } from 'node:path';
4
7
 
5
8
  const RETRY_MS = 1_000;
6
9
  const HANDSHAKE_MS = 5_000;
@@ -35,8 +38,7 @@ function parseSnapshot(value, now) {
35
38
  return { version, updatedAtMs, generating, tools, outputPerSecond, complete };
36
39
  }
37
40
 
38
- export function connectActivity({ socketPath, onSnapshot, onConnection }) {
39
- const endpoint = socketPath === undefined ? defaultEndpoint() : { path: socketPath };
41
+ function connectSocket(endpoint, { onSnapshot, onConnection }) {
40
42
  if (!endpoint) return () => {};
41
43
  const { path, directory, uid } = endpoint;
42
44
  if (typeof path !== 'string' || !path || path.includes('\0')) throw new TypeError('Expected a local socket path.');
@@ -149,3 +151,86 @@ export function connectActivity({ socketPath, onSnapshot, onConnection }) {
149
151
  peer?.destroy();
150
152
  };
151
153
  }
154
+
155
+ function defaultSnapshotPath() {
156
+ if (process.platform === 'darwin') {
157
+ return join(homedir(), 'Library', 'Application Support', 'AgentSpeed', 'activity-v1.json');
158
+ }
159
+ if (process.platform === 'win32') {
160
+ const local = process.env.LOCALAPPDATA;
161
+ return join(local && isAbsolute(local) ? local : join(homedir(), 'AppData', 'Local'), 'AgentSpeed', 'activity-v1.json');
162
+ }
163
+ return null;
164
+ }
165
+
166
+ async function readSnapshotFile(path) {
167
+ // Read at most one frame and never poll a symlink, pipe or device as a snapshot.
168
+ try {
169
+ const info = await lstat(path);
170
+ if (!info.isFile() || info.size > MAX_FRAME_BYTES) return null;
171
+ const file = await open(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
172
+ try {
173
+ const stat = await file.stat();
174
+ if (!stat.isFile() || stat.dev !== info.dev || stat.ino !== info.ino || stat.size > MAX_FRAME_BYTES) return null;
175
+ const buffer = Buffer.allocUnsafe(MAX_FRAME_BYTES + 1);
176
+ const { bytesRead } = await file.read(buffer);
177
+ if (bytesRead !== stat.size) return null;
178
+ return parseSnapshot(JSON.parse(buffer.toString('utf8', 0, bytesRead)), Date.now());
179
+ } finally {
180
+ await file.close();
181
+ }
182
+ } catch {
183
+ return null;
184
+ }
185
+ }
186
+
187
+ export function connectActivity({ socketPath, snapshotPath, onSnapshot, onConnection }) {
188
+ const endpoint = socketPath === undefined ? defaultEndpoint() : { path: socketPath };
189
+ const fallback = snapshotPath === undefined ? (socketPath === undefined ? defaultSnapshotPath() : null) : snapshotPath;
190
+ let running = true;
191
+ let stream = false;
192
+ let connected = false;
193
+ let latest = null;
194
+ let timer;
195
+ let sourceRevision = 0;
196
+
197
+ function publish(value, online) {
198
+ if (latest?.updatedAtMs !== value?.updatedAtMs) {
199
+ latest = value;
200
+ onSnapshot(value);
201
+ }
202
+ if (connected !== online) {
203
+ connected = online;
204
+ onConnection?.(online);
205
+ }
206
+ }
207
+
208
+ async function poll() {
209
+ if (!running) return;
210
+ if (!stream) {
211
+ const revision = sourceRevision;
212
+ const snapshot = await readSnapshotFile(fallback);
213
+ if (!running) return;
214
+ if (revision === sourceRevision) publish(snapshot, snapshot !== null);
215
+ }
216
+ timer = setTimeout(poll, RETRY_MS).unref();
217
+ }
218
+
219
+ const stopSocket = endpoint && connectSocket(endpoint, {
220
+ onSnapshot: (snapshot) => { if (stream) publish(snapshot, true); },
221
+ onConnection: (online) => {
222
+ if (!running || stream === online) return;
223
+ stream = online;
224
+ sourceRevision++;
225
+ publish(null, stream);
226
+ },
227
+ });
228
+ if (fallback) void poll();
229
+ return () => {
230
+ running = false;
231
+ stream = false;
232
+ clearTimeout(timer);
233
+ stopSocket?.();
234
+ publish(null, false);
235
+ };
236
+ }