@sjawhar/pi-envoy 8.1.0 → 8.2.0

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.
package/dist/envoy.js CHANGED
@@ -29700,6 +29700,12 @@ var askEventPayloadFields = {
29700
29700
  question: exports_external.string().optional(),
29701
29701
  options: exports_external.array(exports_external.object({ label: exports_external.string().optional() })).optional(),
29702
29702
  answer: exports_external.object({ selected: exports_external.array(exports_external.string()).nullish(), text: exports_external.string().nullish() }).nullish(),
29703
+ previous_answer: exports_external.object({
29704
+ user: exports_external.string().optional(),
29705
+ selected: exports_external.array(exports_external.string()).nullish(),
29706
+ text: exports_external.string().nullish(),
29707
+ at: exports_external.string().optional()
29708
+ }).nullish(),
29703
29709
  anchor: exports_external.object({
29704
29710
  quote: exports_external.string().optional(),
29705
29711
  mark_id: exports_external.string().optional(),
@@ -31616,9 +31622,15 @@ function dispatchCompact(event, comment) {
31616
31622
  };
31617
31623
  break;
31618
31624
  }
31619
- case "ask.answered":
31620
- record2 = { ...record2, answer: askAnswerText(ask.data.answer) };
31625
+ case "ask.answered": {
31626
+ const previousAnswer = ask.data.previous_answer;
31627
+ record2 = {
31628
+ ...record2,
31629
+ answer: askAnswerText(ask.data.answer),
31630
+ ...previousAnswer === null || previousAnswer === undefined ? {} : { previous_answer: askAnswerText(previousAnswer) }
31631
+ };
31621
31632
  break;
31633
+ }
31622
31634
  case "ask.resolved": {
31623
31635
  const resolved = askResolutionText(ask.data.resolution);
31624
31636
  record2 = resolved === undefined ? record2 : { ...record2, resolved };
@@ -33908,8 +33920,10 @@ function eventHead(event) {
33908
33920
  case "ask.handed_back":
33909
33921
  case "ask.resolved":
33910
33922
  return textHead(event.payload.question);
33911
- case "ask.answered":
33912
- return `${textHead(event.payload.question)} -> ${textHead(askAnswerText(event.payload.answer))}`;
33923
+ case "ask.answered": {
33924
+ const previousAnswer = event.payload.previous_answer;
33925
+ return `${textHead(event.payload.question)} -> ${textHead(askAnswerText(event.payload.answer))}${previousAnswer === undefined ? "" : ` (was: ${textHead(askAnswerText(previousAnswer))})`}`;
33926
+ }
33913
33927
  case "comment.created":
33914
33928
  case "comment.answered":
33915
33929
  case "comment.anchor_refreshed":
@@ -33950,8 +33964,9 @@ function childrenSummary(issue2) {
33950
33964
  ].join(`
33951
33965
  `);
33952
33966
  }
33953
- function askSummary({ ask, replies }, graph) {
33967
+ function askSummary({ ask, replies, answers }, graph) {
33954
33968
  const answer = ask.answer;
33969
+ const earlierAnswers = answers.slice(0, -1);
33955
33970
  const chain = replies.flatMap((reply) => [
33956
33971
  `${reply.id} \xB7 ${actorText(reply.author)}`,
33957
33972
  `Body: ${reply.body}`
@@ -33968,6 +33983,10 @@ function askSummary({ ask, replies }, graph) {
33968
33983
  `- Selected: ${answer.selected.length === 0 ? "none" : answer.selected.join(", ")}`,
33969
33984
  ...answer.text === null ? [] : [`- Text: ${answer.text}`]
33970
33985
  ],
33986
+ ...earlierAnswers.length === 0 ? [] : [
33987
+ "Earlier answers:",
33988
+ ...earlierAnswers.map((earlier) => `- ${earlier.at} \xB7 ${earlier.user} \xB7 ${askAnswerText(earlier)}`)
33989
+ ],
33971
33990
  ...ask.resolution === undefined ? [] : [
33972
33991
  "Resolution:",
33973
33992
  `- By: ${ask.resolution.actor.id}`,
@@ -338,7 +338,7 @@ permission you already hold, an API that replaces the click. One ask per item, `
338
338
  when work is stopped on it; while it is open, keep working on everything that is not.
339
339
 
340
340
  Once an ask is open (who answers it, handing a human a to-do, editing, retracting or resolving it,
341
- answering a clarification, whose turn a reply gives), see
341
+ answering a clarification, whose turn a reply gives, an answer the human changes), see
342
342
  [Asks after they open](skill://dispatch/references/asks.md).
343
343
 
344
344
  ## Architecture components
@@ -45,6 +45,9 @@ dispatch_edit_ask({
45
45
  At least one field besides `ask` is required. Use this only while the same decision remains open: it keeps the prior text in the event
46
46
  log and invalidates any answer draft against the prior `edited_at` revision, so the human sees the new wording and explicitly reconfirms.
47
47
  An answered or resolved ask cannot be edited. If the decision is moot or superseded, retract the old ask and open a new one.
48
+ A human can change an answer they gave. The change arrives as another `ask.answered` frame whose
49
+ `previous_answer` names the answer it replaced, through the same route the first answer took, and
50
+ `dispatch_read` of the ask lists every earlier answer. Act on the newest answer.
48
51
 
49
52
  An ask that lives as an `ask` block in a document keeps its question and options in the block, and `dispatch_edit_ask` writes the
50
53
  block along with the row, so the edit stands and the document reads the same. It changes only the fields you name: pass `urgency`
@@ -197,6 +197,6 @@ an existing paragraph is the question that should become a decision.
197
197
 
198
198
  An ask block has two ids: the block id, shown as `:::ask{#<id> …}` in the rendered document and
199
199
  taken bare by `move`/`delete` in `block` (the `block:<id>` form is only for `before`/`after`
200
- anchors), and the ask id, which `dispatch_open_asks`, the dashboard's `?ask=` link, `dispatch_read`
201
- and `dispatch_comment({ reply_to_ask })` use. They differ; `dispatch://KEY/ask/<block-id>` answers
202
- `not found`.
200
+ anchors), and the ask id, which `dispatch_open_asks`, the dashboard's ask links (`/asks/<id>`,
201
+ `?ask=`), `dispatch_read` and `dispatch_comment({ reply_to_ask })` use. They differ;
202
+ `dispatch://KEY/ask/<block-id>` answers `not found`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-envoy",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {