shapewall 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/NOTICE +7 -0
  3. package/README.md +1 -1
  4. package/THIRD_PARTY.md +39 -0
  5. package/dist/agent/package-lock.json +2 -2
  6. package/dist/client/assets/BoardChat-DxehB761.js +27 -0
  7. package/dist/client/assets/BuzzDialog-Ix9qJvim.js +1 -0
  8. package/dist/client/assets/ChecksPanel-pA_ueIaJ.js +1 -0
  9. package/dist/client/assets/History-C9N32kCv.js +1 -0
  10. package/dist/client/assets/LocalSettings-DawtKnvi.js +1 -0
  11. package/dist/client/assets/{Management-DmTh1-tA.js → Management-NVFDtSZB.js} +1 -1
  12. package/dist/client/assets/QuickConnect-DO1TjS1t.js +1 -0
  13. package/dist/client/assets/ShareDialog-By0ETg6n.js +2 -0
  14. package/dist/client/assets/app-update-dialog-RGIw24iZ.js +1 -0
  15. package/dist/client/assets/{circle-x-3UxAvczM.js → circle-x-B6KfScOE.js} +1 -1
  16. package/dist/client/assets/index-CsqLdqGx.css +2 -0
  17. package/dist/client/assets/index-DnZarJ3U.js +37 -0
  18. package/dist/client/assets/{refresh-cw-BRHNyCnY.js → refresh-cw-vkgvCCfR.js} +1 -1
  19. package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  20. package/dist/client/assets/{shield-check-DMpniYP6.js → shield-check-QzwGhz0t.js} +1 -1
  21. package/dist/client/assets/ui-DI-FGWWK.js +41 -0
  22. package/dist/client/build-info.json +1 -1
  23. package/dist/client/index.html +4 -3
  24. package/dist/client/sw.js +2 -2
  25. package/dist/console/assets/{LocalAccountsApp-IvHd9zWN.js → LocalAccountsApp-VOCZg8dg.js} +1 -1
  26. package/dist/console/assets/{LocalConsole-DOyLou56.js → LocalConsole-CMwAW-mF.js} +1 -1
  27. package/dist/console/assets/{app-update-dialog-Da46CJpv.js → app-update-dialog-Cw6UDqNP.js} +1 -1
  28. package/dist/console/assets/console-DgfWmUEx.js +55 -0
  29. package/dist/console/assets/console-Lis0vvdL.css +2 -0
  30. package/dist/console/build-info.json +1 -1
  31. package/dist/console/console.html +2 -2
  32. package/docs/agents.md +62 -2
  33. package/docs/config.md +1 -1
  34. package/docs/deployment.md +2 -0
  35. package/docs/design-system.md +20 -15
  36. package/docs/hosted.md +19 -0
  37. package/docs/where-to-run.md +88 -0
  38. package/package.json +2 -1
  39. package/src/agent/agent-logos.js +81 -0
  40. package/src/agent/config.js +27 -2
  41. package/src/agent/icon-store.js +100 -0
  42. package/src/agent/identity.js +77 -0
  43. package/src/agent/owner-mcp.js +19 -3
  44. package/src/agent/routes.js +80 -20
  45. package/src/agent/run.js +3 -1
  46. package/src/agent/settings-routes.js +233 -14
  47. package/src/agent/test-timing.js +14 -0
  48. package/src/agent/tools.js +4 -2
  49. package/src/agent/user-settings.js +51 -3
  50. package/src/capture/element-map.js +61 -4
  51. package/src/hosted/agent-presence.js +40 -0
  52. package/src/hosted/app.js +6 -0
  53. package/src/hosted/board-routes.js +7 -0
  54. package/src/hosted/console-routes.js +47 -1
  55. package/src/hosted/events.js +6 -4
  56. package/src/hosted/presence.js +1 -1
  57. package/src/hosted/projects.js +32 -1
  58. package/src/hosted/token-api.js +5 -1
  59. package/src/hosted/token-events.js +5 -2
  60. package/src/hosted/tokens.js +3 -2
  61. package/src/mcp.js +10 -2
  62. package/src/store.js +5 -0
  63. package/dist/client/assets/BoardChat-BeRp6007.js +0 -27
  64. package/dist/client/assets/BuzzDialog-CrYy48hh.js +0 -1
  65. package/dist/client/assets/ChecksPanel-CB820mhj.js +0 -1
  66. package/dist/client/assets/History-Ba909bGJ.js +0 -1
  67. package/dist/client/assets/LocalSettings-ChMi9Zir.js +0 -1
  68. package/dist/client/assets/QuickConnect-CrVweWZB.js +0 -1
  69. package/dist/client/assets/ShareDialog-DO2HhY6g.js +0 -2
  70. package/dist/client/assets/app-update-dialog-C09ODdUQ.js +0 -1
  71. package/dist/client/assets/index-BIjfZKnp.js +0 -37
  72. package/dist/client/assets/index-CXtuJi1K.css +0 -2
  73. package/dist/client/assets/ui-mhL9gsne.js +0 -41
  74. package/dist/console/assets/console-CIBv7cXU.js +0 -55
  75. package/dist/console/assets/console-Fp4k9iyx.css +0 -2
@@ -0,0 +1,81 @@
1
+ // The product marks of the agents Shapewall knows how to run: the default
2
+ // icon of a connected Claude Code, Codex, goose or Gemini CLI, until its owner
3
+ // picks an avatar or uploads a picture (identity.js). Data only, one entry per mark,
4
+ // so adding or removing one is one line here (and its row in THIRD_PARTY.md).
5
+ //
6
+ // Each mark is another company's trademark, shown only to identify the agent
7
+ // the owner connected, with no endorsement implied (NOTICE). They are used
8
+ // exactly as sourced: one path, one colour, never redrawn, recoloured into
9
+ // Shapewall's accent or combined with another shape. The board draws them in
10
+ // the text colour on a neutral tile (client/src/chat/agentIcons.jsx).
11
+ //
12
+ // Source: the Simple Icons project (https://simpleicons.org), npm package
13
+ // simple-icons, released under CC0 1.0. Simple Icons carries no separate
14
+ // licence entry for these marks; its disclaimer says a brand may still have
15
+ // its own terms, and CC0 waives no trademark rights. Claude and Google
16
+ // Gemini are from 16.37.0. OpenAI is from 15.22.0, the last release that has
17
+ // it: Simple Icons removed the icon in 16.0.0 (pull request 13944, "assuming
18
+ // no permissions are sought/obtained"), so it is here by the owner's
19
+ // decision, with that provenance said plainly in THIRD_PARTY.md.
20
+ //
21
+ // The goose mark is the project's own file, from its official repository
22
+ // (github.com/aaif-goose/goose, where github.com/block/goose now redirects;
23
+ // Apache 2.0). goose is a project of LF Projects, LLC, whose trademark policy
24
+ // (https://lfprojects.org/policies/trademark-policy/) covers its name and logo.
25
+ //
26
+ // A mark is only added from a source that may be redistributed, never drawn
27
+ // to look like one or copied from an unofficial site.
28
+ //
29
+ // No Node imports: the board and the demo share this file.
30
+
31
+ const SIMPLE_ICONS = 'Simple Icons 16.37.0 (https://simpleicons.org), CC0 1.0'
32
+ // The last release with the OpenAI icon (removed in 16.0.0).
33
+ const SIMPLE_ICONS_15 = 'Simple Icons 15.22.0 (https://simpleicons.org), CC0 1.0'
34
+
35
+ export const AGENT_LOGOS = [
36
+ {
37
+ id: 'claude',
38
+ name: 'Claude',
39
+ owner: 'Anthropic, PBC',
40
+ // The known agents (acp/detect.js KNOWN_AGENTS ids) it is the default icon of.
41
+ agents: ['claude'],
42
+ viewBox: '0 0 24 24',
43
+ path: 'm4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z',
44
+ source: `${SIMPLE_ICONS}, icons/claude.svg`,
45
+ },
46
+ {
47
+ id: 'openai',
48
+ name: 'OpenAI',
49
+ owner: 'OpenAI',
50
+ agents: ['codex'],
51
+ viewBox: '0 0 24 24',
52
+ path: 'M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z',
53
+ source: `${SIMPLE_ICONS_15}, icons/openai.svg`,
54
+ },
55
+ {
56
+ id: 'goose',
57
+ name: 'goose',
58
+ owner: 'LF Projects, LLC',
59
+ agents: ['goose'],
60
+ viewBox: '0 0 45 45',
61
+ path: 'M43.2098 39.2492L39.8118 36.4522C37.9646 34.9318 36.3923 33.1051 35.1631 31.0529C33.4647 28.2172 31.1178 25.8243 28.3164 24.071L26.9482 23.2744C26.4794 22.9485 26.1525 22.4405 26.106 21.8675C26.0762 21.4981 26.1647 21.1678 26.3712 20.8771C27.0837 19.873 30.9617 15.6995 31.6365 15.1411C32.5056 14.4228 33.4739 13.8253 34.3724 13.1412C34.5001 13.0438 34.6283 12.9469 34.7545 12.8481C34.7589 12.8437 34.7653 12.8403 34.7692 12.8363C35.0574 12.6088 35.3295 12.3671 35.5458 12.0803C36.5993 10.8604 36.5783 9.82938 36.5783 9.82938C36.5783 9.82938 36.5793 9.8284 36.5798 9.82791C36.4677 9.5534 36.0645 8.69902 35.2449 8.29825C35.9696 8.28406 36.7872 8.55564 37.1582 8.91873C37.6039 8.21947 37.8922 7.76585 38.3404 7.00347C38.4471 6.82241 38.5038 6.48771 38.2998 6.30029C38.2998 6.30029 38.2988 6.30029 38.2978 6.30029C38.2978 6.30029 38.2978 6.29931 38.2978 6.29833C38.2939 6.29442 38.289 6.29148 38.2851 6.28757C38.2812 6.28365 38.2787 6.27925 38.2743 6.27485C38.2743 6.27485 38.2734 6.27485 38.2724 6.27485C38.2724 6.27485 38.2724 6.27387 38.2724 6.27289C38.2641 6.26457 38.2548 6.25821 38.246 6.25038C38.2406 6.245 38.2362 6.23864 38.2313 6.23276C38.2254 6.22787 38.219 6.22347 38.2137 6.21808C38.2053 6.20977 38.2 6.19949 38.1911 6.19166C38.1911 6.19166 38.1897 6.19117 38.1892 6.19166C38.1892 6.19166 38.1892 6.19068 38.1892 6.1897C38.1853 6.18579 38.1804 6.18285 38.1765 6.17894C38.1726 6.17502 38.1696 6.17013 38.1657 6.16621C38.1657 6.16621 38.1642 6.16572 38.1637 6.16621C38.1637 6.16621 38.1637 6.16524 38.1637 6.16426C37.9763 5.9602 37.6416 6.01697 37.4606 6.12364C36.4692 6.70693 35.5047 7.33475 34.6351 7.88525C34.6351 7.88525 33.6046 7.86372 32.3842 8.91775C32.097 9.13452 31.8552 9.4066 31.6282 9.69433C31.6238 9.69873 31.6199 9.7046 31.6164 9.70901C31.5171 9.83476 31.4202 9.96297 31.3233 10.0912C30.6387 10.9901 30.0417 11.958 29.3234 12.8271C28.7656 13.5023 24.5915 17.3798 23.5874 18.0923C23.2967 18.2988 22.9669 18.3879 22.597 18.3575C22.0245 18.3115 21.5161 17.9842 21.1902 17.5154L20.3935 16.1472C18.6402 13.3448 16.2474 10.9989 13.4117 9.30041C11.3594 8.0712 9.5332 6.49847 8.01234 4.65172L5.2153 1.25377C5.0773 1.08642 4.81306 1.11382 4.71422 1.30662C4.39615 1.92612 3.78888 3.23411 3.32353 4.99327C3.31227 5.03487 3.32206 5.07891 3.34946 5.11218C3.92786 5.81095 5.26717 7.35089 6.8624 8.65351C6.97348 8.74403 6.88246 8.92313 6.74447 8.88496C5.36846 8.51013 4.03062 7.90825 3.02944 7.39542C2.94772 7.35383 2.84887 7.4057 2.83713 7.49672C2.68152 8.74354 2.64139 10.1127 2.80581 11.5562C2.8107 11.6032 2.84055 11.6438 2.8841 11.6629C4.02572 12.1596 5.85143 12.8804 7.76816 13.3389C7.90713 13.3722 7.90273 13.5723 7.76229 13.5992C6.26982 13.8801 4.70688 13.9427 3.43656 13.9261C3.3475 13.9251 3.28193 14.0093 3.30591 14.0949C3.56085 14.9958 3.90632 15.9118 4.3619 16.8342C4.55029 17.2487 4.75532 17.6553 4.97504 18.0532C5.01271 18.1212 5.08562 18.1618 5.16343 18.1584C6.21207 18.107 7.47946 17.9964 8.75369 17.7713C8.97095 17.7331 9.08741 18.0189 8.90391 18.1417C8.03877 18.7201 7.11588 19.2183 6.25758 19.6283C6.14259 19.6836 6.1054 19.8304 6.18125 19.9327C6.69114 20.6236 7.25191 21.2774 7.86114 21.8866C7.86114 21.8866 10.8608 24.9763 10.9425 25.2185C12.6928 23.4261 15.5701 21.4394 18.7474 19.7047C14.4921 23.1672 12.1198 25.7235 10.9258 27.1758L10.0935 28.3439C9.66091 28.9507 9.2856 29.5951 8.97193 30.2709C7.92231 32.5292 6.19201 37.0966 6.19201 37.0966C6.0594 37.4543 6.16755 37.8072 6.39753 38.0371C6.40292 38.0425 6.4083 38.0479 6.41417 38.0528C6.41955 38.0582 6.42445 38.0641 6.42983 38.0694C6.66031 38.2999 7.01263 38.4076 7.37033 38.275C7.37033 38.275 11.9368 36.5447 14.1961 35.495C14.8719 35.1814 15.5168 34.8056 16.1231 34.3735L17.4095 33.457C18.0907 32.9715 19.0234 33.0489 19.615 33.6405L22.5804 36.6058C23.1896 37.2151 23.8433 37.7758 24.5343 38.2857C24.637 38.3611 24.7833 38.3244 24.8386 38.2094C25.2492 37.3516 25.7473 36.4277 26.3252 35.5631C26.4481 35.3796 26.7343 35.4965 26.6957 35.7133C26.4701 36.988 26.3605 38.2554 26.3086 39.3035C26.3047 39.3809 26.3458 39.4543 26.4138 39.4919C26.8112 39.7121 27.2178 39.9172 27.6327 40.1051C28.5551 40.5606 29.4717 40.9066 30.3721 41.1611C30.4577 41.185 30.5419 41.1195 30.5409 41.0304C30.5237 39.7596 30.5864 38.1967 30.8677 36.7047C30.8942 36.5638 31.0943 36.5593 31.1281 36.6988C31.5861 38.616 32.3069 40.4417 32.8041 41.5829C32.8231 41.6264 32.8633 41.6558 32.9107 41.6612C34.3543 41.8256 35.7234 41.7855 36.9703 41.6298C37.0618 41.6186 37.1136 41.5197 37.0715 41.4375C36.5587 40.4364 35.9568 39.0975 35.582 37.7225C35.5443 37.584 35.7229 37.4935 35.8135 37.6046C37.1161 39.1998 38.656 40.5391 39.3548 41.1175C39.3881 41.1449 39.4326 41.1542 39.4737 41.1434C41.2333 40.6786 42.5413 40.0713 43.1604 39.7528C43.3532 39.6539 43.3806 39.3897 43.2132 39.2517L43.2098 39.2492Z',
62
+ source:
63
+ 'github.com/aaif-goose/goose at 0c5b5e2f2e7933fca4de5377d239645dcbe4cbb3, documentation/static/img/goose.svg (Apache 2.0; LF Projects trademark policy)',
64
+ },
65
+ {
66
+ id: 'gemini',
67
+ name: 'Google Gemini',
68
+ owner: 'Google LLC',
69
+ agents: ['gemini'],
70
+ viewBox: '0 0 24 24',
71
+ path: 'M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81',
72
+ source: `${SIMPLE_ICONS}, icons/googlegemini.svg`,
73
+ },
74
+ ]
75
+
76
+ // The mark by its id, or null.
77
+ export const agentLogo = (id) => AGENT_LOGOS.find((logo) => logo.id === id) || null
78
+
79
+ // The id of the mark a known agent shows by default, or null (an agent
80
+ // Shapewall does not know, one without a redistributable mark, an endpoint).
81
+ export const logoForAgent = (agentId) => AGENT_LOGOS.find((logo) => logo.agents.includes(agentId))?.id || null
@@ -10,7 +10,10 @@
10
10
  // thread or an API response.
11
11
 
12
12
  import { ACP_COMMAND_VAR, ACP_FLAG, SETTINGS_SOURCE, acpCommand, extraVarNames } from './acp/command.js'
13
- import { implicitDefault, userAgentEntry } from './user-settings.js'
13
+ import { implicitDefault, profileForDefault, userAgentEntry } from './user-settings.js'
14
+ import { identityOf } from './identity.js'
15
+ import { logoForAgent } from './agent-logos.js'
16
+ import { KNOWN_AGENTS } from './acp/detect.js'
14
17
  import { validateBranchConfig } from './branch-mode.js'
15
18
  import { validateBatchConfig } from './batch-fixes.js'
16
19
 
@@ -186,6 +189,7 @@ export function agentSettings(config, env = process.env, { acp = null, profileId
186
189
  {
187
190
  ...acpSettings(command, env),
188
191
  label: profile.label,
192
+ ...identityOf(profile),
189
193
  profileId,
190
194
  settingsFile: saved.file,
191
195
  sources: { backend: 'settings', acpCommand: 'settings' },
@@ -213,7 +217,14 @@ export function agentSettings(config, env = process.env, { acp = null, profileId
213
217
  backend: backendSource,
214
218
  acpCommand: command ? (command.source === SETTINGS_SOURCE ? 'settings' : backendSource) : null,
215
219
  }
216
- return withProblem({ ...acpSettings(command, env), vision: base.vision !== false, ...extra, sources }, saved.problem)
220
+ // What the owner called it (identity.js): the connected agent that runs
221
+ // this command, or, for a command a flag or the environment fixes, the
222
+ // name and icon saved for that (`fixedAgent`). Display only.
223
+ // A saved command that is no connected agent's takes the form's name field.
224
+ const typed = user.label ? { label: user.label } : null
225
+ const named = !command ? null : command.source === SETTINGS_SOURCE ? profileForDefault(user) || typed : user.fixedAgent || null
226
+ const identity = named ? { ...(named.label ? { label: named.label } : {}), ...identityOf(named) } : identityOf(null)
227
+ return withProblem({ ...acpSettings(command, env), ...identity, vision: base.vision !== false, ...extra, sources }, saved.problem)
217
228
  }
218
229
  const baseUrl = String(env.SHAPEWALL_AGENT_BASE_URL || base.baseUrl || '')
219
230
  .trim()
@@ -240,6 +251,8 @@ export function agentSettings(config, env = process.env, { acp = null, profileId
240
251
  baseUrl: baseUrl || null,
241
252
  model: model || null,
242
253
  label: base.label || model || null,
254
+ // The endpoint's icon and tint (identity.js), saved beside its label.
255
+ ...identityOf(user),
243
256
  keyVar,
244
257
  hasKey,
245
258
  // A key variable named on purpose (settings or config), not the default:
@@ -287,6 +300,11 @@ function acpSettings(command, env) {
287
300
  baseUrl: null,
288
301
  model: null,
289
302
  label: command?.label || 'ACP agent',
303
+ // The name the command itself gives it, which an emptied name goes back to.
304
+ builtInLabel: command?.label || null,
305
+ // The product mark of a known agent (agent-logos.js), told from the
306
+ // command as its built-in name is: its default icon. null: initials.
307
+ logo: logoForAgent(KNOWN_AGENTS.find((agent) => agent.label === command?.label)?.id),
290
308
  keyVar: null,
291
309
  hasKey: false,
292
310
  host: null,
@@ -332,6 +350,13 @@ export function publicAgentInfo(settings) {
332
350
  configured: settings.configured,
333
351
  backend: settings.backend,
334
352
  label: settings.configured ? settings.label : null,
353
+ // How its owner made it look (identity.js): a built-in icon's id or
354
+ // "upload:<hash>" (served by GET /api/agent/icons/<hash>), and a tint.
355
+ icon: settings.configured ? settings.icon || null : null,
356
+ tint: settings.configured ? settings.tint || null : null,
357
+ // The default icon while `icon` is null: a known agent's product mark
358
+ // (agent-logos.js), or null for initials.
359
+ logo: settings.configured ? settings.logo || null : null,
335
360
  model: settings.configured ? settings.model : null,
336
361
  host: settings.host,
337
362
  // An ACP agent: a process on the server's machine, not an endpoint.
@@ -0,0 +1,100 @@
1
+ // Uploaded agent icons, stored next to the agent settings file
2
+ // (user-settings.js): <settings folder>/agent-icons/<32 hex>.png, private
3
+ // like the settings (folder 0700, files 0600), named by the hash of their
4
+ // bytes. A settings entry refers to one as "upload:<hash>" (identity.js).
5
+ //
6
+ // The image goes through the profile photo pipeline (src/accounts/avatar.js
7
+ // cleanAvatar): the board crops the chosen PNG, JPEG or WebP to a square and
8
+ // sends a 256 by 256 PNG; the server checks its signature, size, chunks and
9
+ // CRCs, decodes it and writes the pixels out again, so nothing but pixels is
10
+ // stored (no metadata, no trailing data, never an SVG) and what is served is
11
+ // always a PNG this server encoded.
12
+
13
+ import crypto from 'node:crypto'
14
+ import fs from 'node:fs'
15
+ import path from 'node:path'
16
+ import { cleanAvatar } from '../accounts/avatar.js'
17
+ import { uploadHashes } from './identity.js'
18
+ import { readUserSettings, userSettingsFile } from './user-settings.js'
19
+
20
+ const HASH_RE = /^[0-9a-f]{32}$/
21
+
22
+ export class IconError extends Error {
23
+ constructor(status, code, message) {
24
+ super(message)
25
+ this.status = status
26
+ this.code = code
27
+ }
28
+ }
29
+
30
+ // The folder the icons live in, or null when there is no settings file.
31
+ export function iconDir(env = process.env) {
32
+ const file = userSettingsFile(env)
33
+ return file ? path.join(path.dirname(file), 'agent-icons') : null
34
+ }
35
+
36
+ const iconFile = (dir, hash) => path.join(dir, `${hash}.png`)
37
+
38
+ // Checks and re-encodes an upload ({ png: base64 }), stores it and returns
39
+ // its hash. The same picture twice is one file.
40
+ export function saveIcon(png, env = process.env) {
41
+ const dir = iconDir(env)
42
+ if (!dir) throw new IconError(500, 'no_settings_file', 'There is no home folder to save agent settings in (set XDG_CONFIG_HOME or HOME).')
43
+ let clean
44
+ try {
45
+ clean = cleanAvatar(png)
46
+ } catch (error) {
47
+ // cleanAvatar speaks of profile images: say what this upload needs.
48
+ if (error.code === 'avatar_too_large') throw new IconError(413, 'icon_too_large', 'The icon is too large. Choose a smaller image.')
49
+ throw new IconError(400, 'invalid_icon', 'The icon must be a PNG, JPEG or WebP image, cropped to a square by the board.')
50
+ }
51
+ const hash = crypto.createHash('sha256').update(clean).digest('hex').slice(0, 32)
52
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 })
53
+ const file = iconFile(dir, hash)
54
+ if (!fs.existsSync(file)) {
55
+ const temp = `${file}.${process.pid}.${crypto.randomBytes(4).toString('hex')}.tmp`
56
+ try {
57
+ fs.writeFileSync(temp, clean, { mode: 0o600, flag: 'wx' })
58
+ fs.renameSync(temp, file)
59
+ } catch (error) {
60
+ fs.rmSync(temp, { force: true })
61
+ throw error
62
+ }
63
+ }
64
+ return hash
65
+ }
66
+
67
+ // The stored PNG, or null. Only a hash is ever joined to the folder.
68
+ export function readIcon(hash, env = process.env) {
69
+ const dir = iconDir(env)
70
+ if (!dir || !HASH_RE.test(String(hash))) return null
71
+ try {
72
+ const file = iconFile(dir, hash)
73
+ // A link planted in the folder is not followed.
74
+ if (!fs.lstatSync(file).isFile()) return null
75
+ return fs.readFileSync(file)
76
+ } catch {
77
+ return null
78
+ }
79
+ }
80
+
81
+ // Removes the icons no project's settings refer to any more (after an icon
82
+ // was replaced or removed). Best effort: a file left behind is only a few
83
+ // kilobytes in a private folder.
84
+ export function pruneIcons(env = process.env) {
85
+ const dir = iconDir(env)
86
+ const { data } = readUserSettings(env)
87
+ if (!dir || !data) return
88
+ const used = new Set()
89
+ for (const entry of Object.values(data.projects)) for (const hash of uploadHashes(entry)) used.add(hash)
90
+ let names = []
91
+ try {
92
+ names = fs.readdirSync(dir)
93
+ } catch {
94
+ return
95
+ }
96
+ for (const name of names) {
97
+ const hash = /^([0-9a-f]{32})\.png$/.exec(name)?.[1]
98
+ if (hash && !used.has(hash)) fs.rmSync(path.join(dir, name), { force: true })
99
+ }
100
+ }
@@ -0,0 +1,77 @@
1
+ // An agent's identity on the board: the name its owner gives it, an icon and
2
+ // an accent tint. Display only: none of it changes which command runs or
3
+ // where a key goes, so it is saved without a confirmation, a restart or a
4
+ // connection test (settings-routes.js POST /identity).
5
+ //
6
+ // The name is untrusted text shown to every board viewer and written as the
7
+ // author of the agent's replies: plain text, one line, 1 to 40 characters,
8
+ // no control or text-direction characters. It is never read as Markdown or
9
+ // HTML, and reaches an agent prompt only inside quoted data.
10
+ //
11
+ // The icon is one of the built-in avatars (client/src/chat/agentIcons.jsx
12
+ // draws them; test/agent-identity.test.js checks the two lists match) or
13
+ // "upload:<hash>": an image the owner uploaded, stored by its content hash
14
+ // (icon-store.js). No Node imports here: the board and the demo share it.
15
+
16
+ export const AGENT_NAME_MAX = 40
17
+ export const AGENT_ICONS = ['boxy', 'dot', 'cyclops', 'ghost', 'cat', 'owl', 'bear', 'alien', 'cloud', 'planet', 'hex', 'drop']
18
+ // The accent tints, by name. The colours are the comment avatars' (white on
19
+ // each keeps AA contrast in light and dark, client/src/components/ui/avatar.jsx).
20
+ export const AGENT_TINTS = ['blue', 'violet', 'pink', 'amber', 'green', 'cyan', 'indigo', 'magenta']
21
+ export const UPLOAD_ICON_RE = /^upload:([0-9a-f]{32})$/
22
+ export const IDENTITY_KEYS = ['label', 'icon', 'tint']
23
+
24
+ // C0 and C1 controls, line and paragraph separators, and the characters that
25
+ // reorder or hide text (bidi marks, overrides and isolates, zero-width
26
+ // marks), as code point ranges.
27
+ const FORBIDDEN = [
28
+ [0x00, 0x1f],
29
+ [0x7f, 0x9f],
30
+ [0x200b, 0x200f],
31
+ [0x2028, 0x202e],
32
+ [0x2060, 0x2069],
33
+ [0xfeff, 0xfeff],
34
+ ]
35
+ const forbidden = (text) =>
36
+ [...text].some((char) => FORBIDDEN.some(([from, to]) => char.codePointAt(0) >= from && char.codePointAt(0) <= to))
37
+
38
+ // { name, problem }: the trimmed name, or why it is refused. `name` is null
39
+ // for an empty value (the caller falls back to the agent's built-in name).
40
+ export function cleanAgentName(value) {
41
+ if (value === undefined || value === null) return { name: null, problem: null }
42
+ if (typeof value !== 'string') return { name: null, problem: 'name: text, 1 to 40 characters' }
43
+ if (forbidden(value)) return { name: null, problem: 'name: one line of plain text, without control characters' }
44
+ const name = value.trim()
45
+ if (!name) return { name: null, problem: null }
46
+ // Counted in characters as a person sees them typed, not UTF-16 units.
47
+ if ([...name].length > AGENT_NAME_MAX) return { name: null, problem: `name: at most ${AGENT_NAME_MAX} characters` }
48
+ return { name, problem: null }
49
+ }
50
+
51
+ export const isBuiltInIcon = (value) => AGENT_ICONS.includes(value)
52
+ export const isUploadIcon = (value) => typeof value === 'string' && UPLOAD_ICON_RE.test(value)
53
+ export const isAgentIcon = (value) => isBuiltInIcon(value) || isUploadIcon(value)
54
+ export const isAgentTint = (value) => AGENT_TINTS.includes(value)
55
+
56
+ // The hash of an uploaded icon, or null for a built-in one or none.
57
+ export const uploadHash = (icon) => (typeof icon === 'string' ? UPLOAD_ICON_RE.exec(icon)?.[1] || null : null)
58
+
59
+ // The identity fields of a saved profile or entry, only the valid ones.
60
+ // A file edited by hand with an unknown icon or tint shows the default look.
61
+ export function identityOf(source) {
62
+ return {
63
+ icon: isAgentIcon(source?.icon) ? source.icon : null,
64
+ tint: isAgentTint(source?.tint) ? source.tint : null,
65
+ }
66
+ }
67
+
68
+ // Every uploaded icon a settings entry refers to (its endpoint, the agent a
69
+ // flag fixes, each profile).
70
+ export function uploadHashes(entry) {
71
+ const hashes = new Set()
72
+ for (const source of [entry, entry?.fixedAgent, ...(Array.isArray(entry?.profiles) ? entry.profiles : [])]) {
73
+ const hash = uploadHash(source?.icon)
74
+ if (hash) hashes.add(hash)
75
+ }
76
+ return hashes
77
+ }
@@ -3,24 +3,40 @@
3
3
  import { fileURLToPath } from 'node:url'
4
4
  import { loadConfig } from '../config.js'
5
5
  import { createMcpServer } from '../mcp.js'
6
+ import { SETTINGS_FILE_VAR, savedAgentName } from './user-settings.js'
6
7
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
7
8
 
8
- export function ownerMcpServers(config, boardId, { allowCapture = true } = {}) {
9
+ // `agent`: { which, name } (routes.js): which saved agent this session runs
10
+ // ("fixed", "default" or a profile id) and what it was called when the
11
+ // session started. Its replies are signed with the name it has when it
12
+ // replies (user-settings.js savedAgentName), so a rename shows on the next
13
+ // reply without restarting the agent; the starting name is the fallback.
14
+ export function ownerMcpServers(config, boardId, { allowCapture = true, agent = null, env = process.env } = {}) {
9
15
  if (!config.file) return []
16
+ const settingsFile = env[SETTINGS_FILE_VAR]
10
17
  return [
11
18
  {
12
19
  name: 'shapewall',
13
20
  command: process.execPath,
14
- args: [fileURLToPath(import.meta.url), config.file, boardId, allowCapture ? 'capture' : 'no-capture'],
15
- env: [],
21
+ args: [
22
+ fileURLToPath(import.meta.url),
23
+ config.file,
24
+ boardId,
25
+ allowCapture ? 'capture' : 'no-capture',
26
+ ...(agent?.name ? [agent.which || 'default', agent.name] : []),
27
+ ],
28
+ // The agent's small environment may not name the settings file.
29
+ env: settingsFile ? [{ name: SETTINGS_FILE_VAR, value: settingsFile }] : [],
16
30
  },
17
31
  ]
18
32
  }
19
33
 
20
34
  if (process.argv[1] === fileURLToPath(import.meta.url)) {
21
35
  const config = loadConfig(process.argv[2])
36
+ const [which, startName] = process.argv.slice(5)
22
37
  const server = createMcpServer({
23
38
  config,
39
+ agentAuthor: startName ? () => savedAgentName(config.dir, which) || startName : null,
24
40
  boardId: process.argv[3],
25
41
  allowCapture: process.argv[4] === 'capture',
26
42
  toolNames: [
@@ -73,6 +73,8 @@ import { createAgentHealth } from './agent-health.js'
73
73
  import { beginAgentOperation } from './control.js'
74
74
  import { validateFiles, validateMentions } from './composer.js'
75
75
  import { profileForDefault, userAgentEntry, userSettingsFile } from './user-settings.js'
76
+ import { uploadHashes } from './identity.js'
77
+ import { readIcon } from './icon-store.js'
76
78
  import { finishFix, projectChanged, projectSnapshot, stopReason } from './feedback-loop.js'
77
79
  import { ownerMcpServers } from './owner-mcp.js'
78
80
  import { RUN_MS_MAX, commentIdOf, runTurn } from './run.js'
@@ -110,6 +112,8 @@ import { commentText } from '../comment-fields.js'
110
112
  // body this big, and only once the message is allowed to run.
111
113
  export const BODY_LIMIT = '28mb'
112
114
  const SMALL_BODY_LIMIT = '4kb'
115
+ // An uploaded agent icon: 512 KiB of PNG at most (src/accounts/avatar.js), in base64.
116
+ const ICON_BODY_LIMIT = '700kb'
113
117
  // Open GET /events streams at once; a new one ends the oldest.
114
118
  export const EVENT_STREAMS_MAX = 32
115
119
 
@@ -242,7 +246,19 @@ export function agentRouter({
242
246
  }
243
247
  // How each agent is doing (agent-health.js): from the last turn or test.
244
248
  const health = createAgentHealth()
245
- const agentStatus = (current) => health.status(current, processPool)
249
+ // While an agent's connection test runs (settings-routes.js) its state is
250
+ // "testing": the chat header says so instead of "Ready".
251
+ const testedNow = (current) => {
252
+ const test = connectionTest()
253
+ if (!test) return false
254
+ if (current.profileId) return test.id === current.profileId
255
+ const runs = current.defaultProfile || profileForDefault(userAgentEntry(config.dir, env).entry)?.id || 'default'
256
+ return test.id === 'default' || test.id === runs
257
+ }
258
+ const agentStatus = (current) => {
259
+ const status = health.status(current, processPool)
260
+ return testedNow(current) ? { ...status, state: 'testing' } : status
261
+ }
246
262
  router.health = health
247
263
  const profiles = () => {
248
264
  const saved = userAgentEntry(config.dir, env)
@@ -284,9 +300,13 @@ export function agentRouter({
284
300
  'control_needs_owner',
285
301
  'This agent can run commands on this computer, so only its owner can use it. Open the private owner link from the terminal (or run shapewall serve --open), or use a paired device.',
286
302
  )
303
+ // What makes a backend the same one: everything but the agent's name,
304
+ // icon and tint (identity.js), which are display only. Renaming an agent
305
+ // must not stop its processes.
306
+ const fingerprintOf = (current) => JSON.stringify({ ...current, label: null, icon: null, tint: null })
287
307
  const backendFor = (current, ownerWrites = false) => {
288
308
  const key = JSON.stringify({ profileId: current.profileId || 'default', ownerWrites })
289
- const fingerprint = JSON.stringify(current)
309
+ const fingerprint = fingerprintOf(current)
290
310
  if (backends.has(key) && backends.get(key).fingerprint !== fingerprint) {
291
311
  backends.get(key).backend?.close?.()
292
312
  backends.delete(key)
@@ -294,32 +314,44 @@ export function agentRouter({
294
314
  if (!backends.has(key)) {
295
315
  // usage: an endpoint is asked for token counts (the composer's usage
296
316
  // ring); one that refuses stream_options is asked again without.
297
- const backend = createBackend(
298
- { ...current, usage: current.usage ?? true },
299
- {
300
- env,
301
- fetchImpl,
302
- processPool,
303
- root: config.dir,
304
- protect: [config.outputDir],
305
- // Files capture runs or logs in with: a write needs an approval card.
306
- sensitivePaths: () => authFiles(config),
307
- mcpServersFor: ownerWrites ? (thread) => ownerMcpServers(config, thread.split('/')[0], { allowCapture }) : null,
308
- // One agent process per thread, no more than answers at once.
309
- limits: { processesMax: limit.runsMax, ...limit.acp },
310
- log,
311
- },
312
- )
313
- backends.set(key, { key, fingerprint, backend })
317
+ const live = { ...current, usage: current.usage ?? true }
318
+ const backend = createBackend(live, {
319
+ env,
320
+ fetchImpl,
321
+ processPool,
322
+ root: config.dir,
323
+ protect: [config.outputDir],
324
+ // Files capture runs or logs in with: a write needs an approval card.
325
+ sensitivePaths: () => authFiles(config),
326
+ mcpServersFor: ownerWrites
327
+ ? (thread) =>
328
+ ownerMcpServers(config, thread.split('/')[0], {
329
+ allowCapture,
330
+ env,
331
+ // Whose replies these are, so they are signed with its name.
332
+ agent: {
333
+ which: live.profileId || (['flag', 'env'].includes(live.sources?.acpCommand) ? 'fixed' : 'default'),
334
+ name: live.label,
335
+ },
336
+ })
337
+ : null,
338
+ // One agent process per thread, no more than answers at once.
339
+ limits: { processesMax: limit.runsMax, ...limit.acp },
340
+ log,
341
+ })
342
+ backends.set(key, { key, fingerprint, backend, live })
314
343
  }
315
344
  cached = backends.get(key)
345
+ // A rename since the backend was made: what it says next ("Starting
346
+ // Harry") uses the new name. Nothing is restarted for it.
347
+ Object.assign(cached.live, { label: current.label, icon: current.icon, tint: current.tint })
316
348
  return cached.backend
317
349
  }
318
350
  // The owner backend already running for these settings, never a new one
319
351
  // (the composer's pickers read a live session's choices).
320
352
  const liveOwnerBackend = (current) => {
321
353
  const entry = backends.get(JSON.stringify({ profileId: current.profileId || 'default', ownerWrites: true }))
322
- return entry && entry.fingerprint === JSON.stringify(current) ? entry.backend : null
354
+ return entry && entry.fingerprint === fingerprintOf(current) ? entry.backend : null
323
355
  }
324
356
  // Server shutdown: stop agent processes (src/server/app.js stopChildren).
325
357
  router.close = () => {
@@ -396,6 +428,8 @@ export function agentRouter({
396
428
  const runs = new Map()
397
429
  const selecting = new Set()
398
430
  let connectionTesting = () => false
431
+ // { id } while a connection test runs, else null (settings-routes.js).
432
+ let connectionTest = () => null
399
433
  // Keep controls privileged for the lifetime of an owner thread/session,
400
434
  // including an idle ACP process. A tokenless turn cannot reset its memory.
401
435
  const ownerThreads = new Set()
@@ -863,6 +897,7 @@ export function agentRouter({
863
897
  requestedPages,
864
898
  // Branch mode: the agent's cwd, file sandbox and commands are the worktree.
865
899
  workdir: work ? worktreeWorkdir(work) : null,
900
+ agentName: current.label || null,
866
901
  })
867
902
  health.record(current, reply)
868
903
  // What the profile offers, as this turn's session saw it; a turn that
@@ -1195,8 +1230,32 @@ export function agentRouter({
1195
1230
 
1196
1231
  // ---- Everything else: small bodies only ------------------------------------
1197
1232
 
1233
+ // An uploaded agent icon (settings-routes.js POST /identity/icon) is a
1234
+ // 256 by 256 PNG in base64: larger than the small bodies below. Only a
1235
+ // request with the owner's settings token gets the larger parser.
1236
+ router.post('/settings/identity/icon', (req, res, next) =>
1237
+ settingsTokenOk(req, settingsToken) ? express.json({ limit: ICON_BODY_LIMIT })(req, res, next) : next(),
1238
+ )
1198
1239
  router.use(express.json({ limit: SMALL_BODY_LIMIT }))
1199
1240
 
1241
+ // An icon the owner uploaded for one of this project's agents
1242
+ // (icon-store.js), for everyone who can see the board: the agent info they
1243
+ // get names it by its content hash ("upload:<hash>"). Always a PNG this
1244
+ // server encoded itself, served as nothing but an image. A hash no agent
1245
+ // of this project uses is a 404, so the folder cannot be browsed.
1246
+ router.get('/icons/:hash', (req, res) => {
1247
+ const hash = String(req.params.hash)
1248
+ const used = uploadHashes(userAgentEntry(config.dir, env).entry)
1249
+ const png = used.has(hash) ? readIcon(hash, env) : null
1250
+ if (!png) return res.status(404).json({ error: { code: 'unknown_icon', message: 'No such agent icon.' } })
1251
+ // The name is the hash of the bytes: it never changes under one URL.
1252
+ res.setHeader('Cache-Control', 'private, max-age=31536000, immutable')
1253
+ res.setHeader('Content-Security-Policy', "default-src 'none'; sandbox")
1254
+ res.setHeader('Cross-Origin-Resource-Policy', 'same-origin')
1255
+ res.setHeader('X-Content-Type-Options', 'nosniff')
1256
+ res.type('png').send(png)
1257
+ })
1258
+
1200
1259
  // The agent settings changed (here, in another tab, or in the file): a
1201
1260
  // nudge only, no settings in it; each view refetches what it shows.
1202
1261
  // The owner only (the settings token in its header, a paired device or the
@@ -1276,6 +1335,7 @@ export function agentRouter({
1276
1335
  },
1277
1336
  })
1278
1337
  connectionTesting = settingsApi.isTesting
1338
+ connectionTest = settingsApi.testing
1279
1339
  router.use('/settings', settingsApi)
1280
1340
  router.get(
1281
1341
  '/boards/:id/threads',
package/src/agent/run.js CHANGED
@@ -117,6 +117,8 @@ export async function runTurn({
117
117
  choices = null,
118
118
  // Agent branch mode: the folder this turn's agent works in (acp.js stream).
119
119
  workdir = null,
120
+ // What the owner called this agent (identity.js): the author of its replies.
121
+ agentName = null,
120
122
  }) {
121
123
  const thread = `${board.id}/${threadId}`
122
124
  const runMs = backend.runMsMax || RUN_MS_MAX
@@ -279,7 +281,7 @@ export async function runTurn({
279
281
  for (const call of calls) {
280
282
  const id = call.id || newId('call')
281
283
  card({ id, kind: 'tool', name: call.name, label: call.name, state: 'running', detail: null })
282
- const result = await runTool({ config, board, ownerWrites, allowCapture, capture, requestedPages }, call)
284
+ const result = await runTool({ config, board, ownerWrites, allowCapture, capture, requestedPages, agentName }, call)
283
285
  card({ id, label: result.label, state: result.ok ? 'done' : 'error', detail: result.detail })
284
286
  if (result.ok) noteRefs(call.args)
285
287
  conversation.push({ role: 'tool', toolCallId: id, content: [{ type: 'text', text: result.text }] })