dawlad-paperclip-direction 0.2.0 → 0.2.1

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/manifest.js CHANGED
@@ -11,7 +11,7 @@ var route = (routeKey, method, path) => ({
11
11
  var manifest = {
12
12
  id: "dawlad.direction",
13
13
  apiVersion: 1,
14
- version: "0.2.0",
14
+ version: "0.2.1",
15
15
  displayName: "Direction",
16
16
  description: "Horizon, campaigns, milestones and one queue of decisions: where Dawlad is heading and what's in the way.",
17
17
  author: "Aly Solamon",
package/dist/worker.js CHANGED
@@ -31382,14 +31382,25 @@ async function listDecisions(ctx, companyId, b) {
31382
31382
  const issueId = links.find((l) => l.approval_id === a.id)?.issue_id ?? (p.issueIds?.[0] ?? null);
31383
31383
  const issue2 = issueId ? b.issueById.get(issueId) : void 0;
31384
31384
  const created = iso(a.createdAt);
31385
- const summary = p.summary ?? null;
31385
+ const usd = (c) => `$${(Number(c ?? 0) / 100).toFixed(2)}`;
31386
+ const budget = a.type === "budget_override_required" ? {
31387
+ title: `${p.scopeName ?? "An agent"} is paused by its budget`,
31388
+ summary: [
31389
+ `Why this is yours: ${p.scopeName ?? "the agent"} cannot run until you decide, and budgets are money.`,
31390
+ "",
31391
+ `Spent this month: ${usd(p.observedAmount)} of ${usd(p.budgetAmount)} (hard limit).`,
31392
+ Number(p.observedAmount ?? 0) === 0 ? "Nothing priced has been spent. Runs on a subscription have no per-run price; Paperclip counts them as unpriced and stops." : "",
31393
+ "Approve lets it run again this month. Reject keeps it paused."
31394
+ ].filter((x) => x !== null).join("\n")
31395
+ } : null;
31396
+ const summary = budget?.summary ?? p.summary ?? null;
31386
31397
  out.push(finishItem({
31387
31398
  key: `approval:${a.id}`,
31388
31399
  source: "approval",
31389
31400
  id: a.id,
31390
31401
  kind: a.type,
31391
31402
  kindLabel: KIND_LABEL[a.type] ?? "Approval",
31392
- title: p.title ?? a.type.replaceAll("_", " "),
31403
+ title: budget?.title ?? p.title ?? a.type.replaceAll("_", " "),
31393
31404
  summary,
31394
31405
  recommended: p.recommendedAction ?? null,
31395
31406
  issueId: issueId ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dawlad-paperclip-direction",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Paperclip plugin: Horizon, campaigns and milestones (Direction page) for Da Applied AI Lab.",
6
6
  "paperclipPlugin": {