patchrelay 0.51.5 → 0.52.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "service": "patchrelay",
3
- "version": "0.51.5",
4
- "commit": "fa598553f4b9",
5
- "builtAt": "2026-04-22T13:58:38.906Z"
3
+ "version": "0.52.0",
4
+ "commit": "818b35cc9b05",
5
+ "builtAt": "2026-04-22T14:41:18.426Z"
6
6
  }
@@ -26,21 +26,24 @@ function deriveProgressFactFromCompletedItem(rawItem, issue) {
26
26
  return {
27
27
  kind: "verification_started",
28
28
  meaningKey: `verification:${normalizeMeaningKey(body)}`,
29
- content: { type: "thought", body },
29
+ ephemeralContent: { type: "thought", body },
30
+ historyContent: { type: "thought", body },
30
31
  };
31
32
  }
32
33
  if (looksLikePublishing(body)) {
33
34
  return {
34
35
  kind: "publishing_started",
35
36
  meaningKey: `publishing:${normalizeMeaningKey(body)}`,
36
- content: { type: "thought", body },
37
+ ephemeralContent: { type: "thought", body },
38
+ historyContent: { type: "thought", body },
37
39
  };
38
40
  }
39
41
  if (looksLikeRootCause(body)) {
40
42
  return {
41
43
  kind: "root_cause_found",
42
44
  meaningKey: `finding:${normalizeMeaningKey(body)}`,
43
- content: { type: "thought", body },
45
+ ephemeralContent: { type: "thought", body },
46
+ historyContent: { type: "thought", body },
44
47
  };
45
48
  }
46
49
  return undefined;
@@ -59,7 +62,12 @@ function deriveProgressFactFromPlan(rawPlan, issue) {
59
62
  return {
60
63
  kind: "verification_started",
61
64
  meaningKey: `verification:${normalizeMeaningKey(activeStep.step)}`,
62
- content: {
65
+ ephemeralContent: {
66
+ type: "action",
67
+ action: "Verifying",
68
+ parameter: summarizePlanStep(activeStep.step, "latest changes before publishing"),
69
+ },
70
+ historyContent: {
63
71
  type: "action",
64
72
  action: "Verifying",
65
73
  parameter: summarizePlanStep(activeStep.step, "latest changes before publishing"),
@@ -71,7 +79,12 @@ function deriveProgressFactFromPlan(rawPlan, issue) {
71
79
  return {
72
80
  kind: "publishing_started",
73
81
  meaningKey: `publishing:${normalizeMeaningKey(activeStep.step)}`,
74
- content: {
82
+ ephemeralContent: {
83
+ type: "action",
84
+ action: "Publishing",
85
+ parameter,
86
+ },
87
+ historyContent: {
75
88
  type: "action",
76
89
  action: "Publishing",
77
90
  parameter,
@@ -17,22 +17,79 @@ export class LinearProgressReporter {
17
17
  return;
18
18
  }
19
19
  const previous = this.publicationsByRun.get(run.id);
20
- if (previous?.meaningKey === fact.meaningKey) {
20
+ const shouldEmitEphemeral = previous?.ephemeralMeaningKey !== fact.meaningKey;
21
+ const shouldEmitHistory = previous?.historyMeaningKey !== fact.meaningKey;
22
+ if (!shouldEmitEphemeral && !shouldEmitHistory) {
21
23
  return;
22
24
  }
25
+ const now = Date.now();
23
26
  const publication = {
24
- meaningKey: fact.meaningKey,
25
- publishedAtMs: Date.now(),
27
+ ...previous,
28
+ ...(shouldEmitEphemeral
29
+ ? {
30
+ ephemeralMeaningKey: fact.meaningKey,
31
+ ephemeralPublishedAtMs: now,
32
+ }
33
+ : {}),
34
+ ...(shouldEmitHistory
35
+ ? {
36
+ historyMeaningKey: fact.meaningKey,
37
+ historyPublishedAtMs: now,
38
+ }
39
+ : {}),
26
40
  };
27
41
  this.publicationsByRun.set(run.id, publication);
28
- void this.emitActivity(issue, fact.content, { ephemeral: true }).catch(() => {
29
- const current = this.publicationsByRun.get(run.id);
30
- if (current?.publishedAtMs === publication.publishedAtMs && current.meaningKey === publication.meaningKey) {
31
- this.publicationsByRun.delete(run.id);
32
- }
33
- });
42
+ if (shouldEmitEphemeral) {
43
+ void this.emitActivity(issue, fact.ephemeralContent, { ephemeral: true }).catch(() => {
44
+ this.clearFailedPublication(run.id, "ephemeral", fact.meaningKey, now);
45
+ });
46
+ }
47
+ if (shouldEmitHistory) {
48
+ void this.emitActivity(issue, fact.historyContent).catch(() => {
49
+ this.clearFailedPublication(run.id, "history", fact.meaningKey, now);
50
+ });
51
+ }
34
52
  }
35
53
  clearProgress(runId) {
36
54
  this.publicationsByRun.delete(runId);
37
55
  }
56
+ clearFailedPublication(runId, channel, meaningKey, publishedAtMs) {
57
+ const current = this.publicationsByRun.get(runId);
58
+ if (!current) {
59
+ return;
60
+ }
61
+ if (channel === "ephemeral") {
62
+ if (current.ephemeralMeaningKey !== meaningKey || current.ephemeralPublishedAtMs !== publishedAtMs) {
63
+ return;
64
+ }
65
+ const next = {};
66
+ if (current.historyMeaningKey !== undefined) {
67
+ next.historyMeaningKey = current.historyMeaningKey;
68
+ }
69
+ if (current.historyPublishedAtMs !== undefined) {
70
+ next.historyPublishedAtMs = current.historyPublishedAtMs;
71
+ }
72
+ if (!next.historyMeaningKey) {
73
+ this.publicationsByRun.delete(runId);
74
+ return;
75
+ }
76
+ this.publicationsByRun.set(runId, next);
77
+ return;
78
+ }
79
+ if (current.historyMeaningKey !== meaningKey || current.historyPublishedAtMs !== publishedAtMs) {
80
+ return;
81
+ }
82
+ const next = {};
83
+ if (current.ephemeralMeaningKey !== undefined) {
84
+ next.ephemeralMeaningKey = current.ephemeralMeaningKey;
85
+ }
86
+ if (current.ephemeralPublishedAtMs !== undefined) {
87
+ next.ephemeralPublishedAtMs = current.ephemeralPublishedAtMs;
88
+ }
89
+ if (!next.ephemeralMeaningKey) {
90
+ this.publicationsByRun.delete(runId);
91
+ return;
92
+ }
93
+ this.publicationsByRun.set(runId, next);
94
+ }
38
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchrelay",
3
- "version": "0.51.5",
3
+ "version": "0.52.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {