@anthusai/papyrus 2.0.0-next.85 → 2.0.0-next.86

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.
@@ -15,6 +15,7 @@ import {
15
15
  statusText,
16
16
  storyHref,
17
17
  triggerText,
18
+ toolsText,
18
19
  whoText,
19
20
  type AutomationOutsideRun,
20
21
  type AutomationRecord,
@@ -46,8 +47,10 @@ function RunLine({ run, demo }: { run: AutomationRun; demo: boolean }) {
46
47
  {run.runRecord === "unavailable" ? " (the run record could not be read)" : ""}
47
48
  </span>
48
49
  <span>
49
- {run.storyId ? <>Story: <Link href={storyHref(run.storyId, demo)} data-automation-story-link>{run.storyTitle ?? run.storyId}</Link></> : "Story: none recorded"}
50
+ {run.storyId && run.storyExists === false ? <>Story: {run.storyTitle ?? run.storyId} (story deleted)</>
51
+ : run.storyId ? <>Story: <Link href={storyHref(run.storyId, demo)} data-automation-story-link>{run.storyTitle ?? run.storyId}</Link></> : "Story: none recorded"}
50
52
  </span>
53
+ <span data-automation-run-tools>{toolsText(run)}</span>
51
54
  <span data-automation-run-cost data-over-budget={run.overBudget || undefined}>
52
55
  <span aria-hidden="true">{run.overBudget ? "! " : ""}</span>{costText(run)}
53
56
  </span>
@@ -14,7 +14,9 @@ export type AutomationUsage = {
14
14
  };
15
15
 
16
16
  export type AutomationRun = {
17
- origin: "monitor" | "manual";
17
+ origin: "monitor" | "manual" | "stage";
18
+ /** The stage a story entered to start this run (origin "stage"). */
19
+ stage?: string | null;
18
20
  requestedBy: string | null;
19
21
  reason: string | null;
20
22
  sourceId: string | null;
@@ -28,6 +30,10 @@ export type AutomationRun = {
28
30
  error: string | null;
29
31
  runRecord: "found" | "missing" | "unavailable" | "none";
30
32
  storyId: string | null;
33
+ /** False when no version of the story remains (it was deleted); null when this was not looked up. */
34
+ storyExists?: boolean | null;
35
+ /** Tool name to number of calls the procedure made, when the run recorded them. */
36
+ toolsUsed?: Record<string, number> | null;
31
37
  storyVersionId: string | null;
32
38
  storyTitle: string | null;
33
39
  costUsd: number | null;
@@ -164,7 +170,13 @@ export function costText(run: Pick<AutomationRun, "costUsd" | "costNote" | "over
164
170
  return run.overBudget && run.budgetUsd != null ? `${base}. Over the budget of ${dollars(run.budgetUsd)} per run` : base;
165
171
  }
166
172
 
167
- export function whoText(run: Pick<AutomationRun, "origin" | "requestedBy" | "sourceId">): string {
173
+ export function toolsText(run: Pick<AutomationRun, "toolsUsed">): string {
174
+ const tools = Object.entries(run.toolsUsed ?? {}).sort(([a], [b]) => a.localeCompare(b));
175
+ return tools.length ? `Tools used: ${tools.map(([name, count]) => `${name} x${count}`).join(", ")}` : "Tools used: none recorded";
176
+ }
177
+
178
+ export function whoText(run: Pick<AutomationRun, "origin" | "requestedBy" | "sourceId"> & { stage?: string | null }): string {
179
+ if (run.origin === "stage") return `Story entered ${run.stage ?? "a stage"}`;
168
180
  return run.origin === "manual" ? `Run now by ${run.requestedBy ?? "someone"}` : `Item: ${run.sourceId ?? "unknown"}`;
169
181
  }
170
182
 
package/package.json CHANGED
@@ -448,7 +448,7 @@
448
448
  "optional": true
449
449
  }
450
450
  },
451
- "version": "2.0.0-next.85",
451
+ "version": "2.0.0-next.86",
452
452
  "dependencies": {
453
453
  "@aws-amplify/adapter-nextjs": "^1.7.3",
454
454
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-next.85",
2
+ "version": "2.0.0-next.86",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",