shapewall 0.3.1 → 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 (98) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/NOTICE +7 -0
  3. package/README.md +4 -2
  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-BFcKFdbp.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-PRxj7kPi.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-aeOBDuGQ.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-DuPBJ6H_.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-lJjkhUcH.js → LocalAccountsApp-VOCZg8dg.js} +1 -1
  26. package/dist/console/assets/{LocalConsole-BZHqYKnt.js → LocalConsole-CMwAW-mF.js} +1 -1
  27. package/dist/console/assets/{app-update-dialog-DCM9sYE3.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/agent-workflow.md +19 -3
  33. package/docs/agents.md +62 -2
  34. package/docs/config.md +3 -3
  35. package/docs/deployment.md +2 -0
  36. package/docs/design-system.md +20 -15
  37. package/docs/hosted.md +19 -0
  38. package/docs/pull-requests.md +4 -1
  39. package/docs/where-to-run.md +88 -0
  40. package/package.json +2 -1
  41. package/src/agent/agent-logos.js +81 -0
  42. package/src/agent/composer.js +9 -5
  43. package/src/agent/config.js +27 -2
  44. package/src/agent/context.js +3 -1
  45. package/src/agent/icon-store.js +100 -0
  46. package/src/agent/identity.js +77 -0
  47. package/src/agent/owner-mcp.js +19 -3
  48. package/src/agent/routes.js +82 -21
  49. package/src/agent/run.js +3 -1
  50. package/src/agent/settings-routes.js +233 -14
  51. package/src/agent/test-timing.js +14 -0
  52. package/src/agent/tools.js +6 -3
  53. package/src/agent/user-settings.js +51 -3
  54. package/src/capture/capture.js +3 -1
  55. package/src/capture/element-map.js +73 -11
  56. package/src/ci/settings.js +3 -3
  57. package/src/ci/start.js +16 -0
  58. package/src/ci/summary.js +8 -1
  59. package/src/cli/args.js +1 -0
  60. package/src/cli/ci.js +2 -2
  61. package/src/cli/comments.js +5 -4
  62. package/src/cli/help.js +3 -1
  63. package/src/cli/init.js +2 -2
  64. package/src/comment-fields.js +45 -0
  65. package/src/comments-cli.js +100 -21
  66. package/src/discover.js +34 -1
  67. package/src/doctor.js +26 -1
  68. package/src/event-log.js +5 -2
  69. package/src/feedback.js +5 -2
  70. package/src/github.js +4 -2
  71. package/src/hosted/agent-presence.js +40 -0
  72. package/src/hosted/app.js +6 -0
  73. package/src/hosted/board-routes.js +9 -1
  74. package/src/hosted/comments.js +11 -11
  75. package/src/hosted/console-routes.js +47 -1
  76. package/src/hosted/events.js +6 -4
  77. package/src/hosted/import.js +7 -4
  78. package/src/hosted/presence.js +1 -1
  79. package/src/hosted/projects.js +32 -1
  80. package/src/hosted/token-api.js +5 -1
  81. package/src/hosted/token-events.js +5 -2
  82. package/src/hosted/tokens.js +3 -2
  83. package/src/mcp.js +10 -2
  84. package/src/notify/messages.js +6 -4
  85. package/src/store.js +19 -11
  86. package/dist/client/assets/BoardChat-V1BCXdDB.js +0 -27
  87. package/dist/client/assets/BuzzDialog-Ds7Thpfe.js +0 -1
  88. package/dist/client/assets/ChecksPanel-Cm22bCdQ.js +0 -1
  89. package/dist/client/assets/History-U0bD1BjA.js +0 -1
  90. package/dist/client/assets/LocalSettings-DOSuW7VC.js +0 -1
  91. package/dist/client/assets/QuickConnect-DyfPSWbV.js +0 -1
  92. package/dist/client/assets/ShareDialog-BouvNraR.js +0 -2
  93. package/dist/client/assets/app-update-dialog-DH2Mgby8.js +0 -1
  94. package/dist/client/assets/index-C9S7HL_o.js +0 -37
  95. package/dist/client/assets/index-CXtuJi1K.css +0 -2
  96. package/dist/client/assets/ui-Cg4TTrec.js +0 -41
  97. package/dist/console/assets/console-C2LsvEco.js +0 -55
  98. package/dist/console/assets/console-Fp4k9iyx.css +0 -2
@@ -6,6 +6,7 @@
6
6
  import { splitMentions } from '../mentions.js'
7
7
  import { DEFAULT_BOARD_URL, runningBoardUrl } from '../serve-state.js'
8
8
  import { boardViewports } from '../config.js'
9
+ import { commentText } from '../comment-fields.js'
9
10
 
10
11
  const QUOTE_MAX = 500
11
12
 
@@ -54,25 +55,26 @@ export function summarize(config, event, boardUrl) {
54
55
  const who = (name) => clip(name || 'Someone', 60)
55
56
  const n = `#${comment.id}`
56
57
  let title
57
- let quote = comment.body
58
+ // No text: what the comment has instead ("(drawing)", "(2 images)").
59
+ let quote = commentText(comment)
58
60
  switch (event.type) {
59
61
  case 'comment.created':
60
62
  title = `${who(comment.author)} commented on ${where}`
61
63
  break
62
64
  case 'comment.replied':
63
65
  title = `${who(event.reply?.author)} replied to ${n} on ${where}`
64
- quote = event.reply?.body
66
+ quote = commentText(event.reply)
65
67
  break
66
68
  case 'comment.mentioned':
67
69
  title = `@${event.handle}, you were mentioned on ${n}, ${where}`
68
- quote = event.reply ? event.reply.body : comment.body
70
+ quote = commentText(event.reply || comment)
69
71
  break
70
72
  case 'comment.status_changed':
71
73
  title = `Agent status of ${n} on ${where}: ${event.previous?.agentStatus || 'none'} -> ${event.agentStatus || 'none'}`
72
74
  break
73
75
  case 'comment.resolved':
74
76
  title = `${n} on ${where} was resolved`
75
- if (comment.resolution) quote = `${comment.body}\n\nResolution: ${comment.resolution}`
77
+ if (comment.resolution) quote = `${quote}\n\nResolution: ${comment.resolution}`
76
78
  if (comment.fixRef) quote = `${quote}\nFix: ${comment.fixRef}`
77
79
  break
78
80
  case 'comment.reopened':
package/src/store.js CHANGED
@@ -41,7 +41,10 @@ import {
41
41
  CommentError,
42
42
  FIX_REF_MAX,
43
43
  STORED_AGENT_STATUSES,
44
+ agentStatusOnResolve,
45
+ cleanCommentBody,
44
46
  cleanFixRef,
47
+ hasCommentMedia,
45
48
  readImages,
46
49
  validateAnchor,
47
50
  } from './comment-fields.js'
@@ -573,14 +576,6 @@ export function commentCounts(config, boardId) {
573
576
  return counts
574
577
  }
575
578
 
576
- function cleanBody(value) {
577
- const body = typeof value === 'string' ? value.replace(/\r\n/g, '\n').trim() : ''
578
- if (!body) throw new CommentError(400, 'empty_comment', 'Write something first.')
579
- if (body.length > COMMENT_BODY_MAX)
580
- throw new CommentError(400, 'comment_too_long', `Comments are limited to ${COMMENT_BODY_MAX} characters.`)
581
- return body
582
- }
583
-
584
579
  function cleanAuthor(value) {
585
580
  const author = typeof value === 'string' ? value.replace(/\s+/g, ' ').trim().slice(0, AUTHOR_MAX) : ''
586
581
  return author || 'anonymous'
@@ -617,7 +612,9 @@ export function validateCommentInput(config, board, input) {
617
612
  viewport,
618
613
  x: Math.round(x * 100) / 100,
619
614
  y: Math.round(y * 100) / 100,
620
- body: cleanBody(input?.body),
615
+ // No text is fine when an image or a drawing comes with it (checked by
616
+ // validateCommentMedia, which refuses anything it does not keep).
617
+ body: cleanCommentBody(input?.body, { media: hasCommentMedia(input) }),
621
618
  author: cleanAuthor(input?.author),
622
619
  anchor: validateAnchor(input?.anchor),
623
620
  }
@@ -686,7 +683,6 @@ export async function updateComment(config, boardId, commentId, changes, { now =
686
683
  const id = Number(commentId)
687
684
  if (!Number.isSafeInteger(id) || id <= 0) throw new CommentError(404, 'unknown_comment', 'That comment does not exist.')
688
685
  if (!changes || typeof changes !== 'object') throw new CommentError(400, 'invalid_change', 'Nothing to change.')
689
- const body = changes.body !== undefined ? cleanBody(changes.body) : undefined
690
686
  if (changes.status !== undefined && !['open', 'resolved'].includes(changes.status)) {
691
687
  throw new CommentError(400, 'invalid_status', 'Status must be open or resolved.')
692
688
  }
@@ -703,6 +699,8 @@ export async function updateComment(config, boardId, commentId, changes, { now =
703
699
  const comment = store.comments.find((item) => item.id === id)
704
700
  if (!comment) throw new CommentError(404, 'unknown_comment', 'That comment does not exist.')
705
701
  const before = withAgentFields(structuredClone(comment))
702
+ // The text may be emptied only on a comment that has an image or a drawing.
703
+ const body = changes.body !== undefined ? cleanCommentBody(changes.body, { media: hasCommentMedia(before) }) : undefined
706
704
  if (body !== undefined && body !== comment.body) {
707
705
  comment.body = body
708
706
  // Shown as "edited" beside the time.
@@ -721,6 +719,10 @@ export async function updateComment(config, boardId, commentId, changes, { now =
721
719
  comment.reopenCount = (Number.isSafeInteger(comment.reopenCount) ? comment.reopenCount : 0) + 1
722
720
  comment.reopenedAt = now.toISOString()
723
721
  if (agentStatus === undefined) setAgent(comment, null, now)
722
+ } else if (agentStatus === undefined && comment.agentStatus !== BRANCH_READY) {
723
+ // Resolved, however it happened (the board, the CLI, MCP): no agent
724
+ // is left "working" on it.
725
+ setAgent(comment, agentStatusOnResolve(before.agentStatus), now)
724
726
  }
725
727
  }
726
728
  if (agentStatus !== undefined) setAgent(comment, agentStatus, now)
@@ -823,8 +825,9 @@ export function getComment(config, boardId, commentId) {
823
825
 
824
826
  // Adds a reply. Returns { comment, reply }.
825
827
  // `images` and `drawing` as on a new comment (validateCommentMedia).
828
+ // `agent: true` marks a reply the board's agent wrote under its own name.
826
829
  export async function addReply(config, boardId, commentId, input, { now = new Date() } = {}) {
827
- const body = cleanBody(input?.body)
830
+ const body = cleanCommentBody(input?.body, { media: hasCommentMedia(input) })
828
831
  const author = cleanAuthor(input?.author)
829
832
  const media = validateCommentMedia(input)
830
833
  const images = saveCommentImages(boardDir(config, boardId), media.images)
@@ -844,6 +847,10 @@ export async function addReply(config, boardId, commentId, input, { now = new Da
844
847
  body,
845
848
  createdAt: now.toISOString(),
846
849
  }
850
+ // Written by the board's own agent under the name its owner gave it
851
+ // ("Harry"): the flag says it is an agent, since the name no longer
852
+ // does. Only the server's own agent tools set it, never a request body.
853
+ if (input?.agent === true) reply.agent = true
847
854
  if (images.length) reply.images = images
848
855
  if (media.drawing) {
849
856
  const version = String(target.pageId).startsWith('variant:')
@@ -1037,6 +1044,7 @@ export async function recordGithubPull(config, boardId, commentId, pull, { via =
1037
1044
  if (target.status === 'open') {
1038
1045
  target.status = 'resolved'
1039
1046
  target.resolvedAt = now.toISOString()
1047
+ if (target.agentStatus !== BRANCH_READY) setAgent(target, agentStatusOnResolve(before.agentStatus), now)
1040
1048
  target.resolution = `Merged in ${label}.`.slice(0, COMMENT_BODY_MAX)
1041
1049
  target.fixRef = next.url
1042
1050
  } else if (!target.fixRef) {