@agent-factory-platform/notify-react 0.5.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/README.md +19 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +74 -0
- package/dist/workbench.d.ts +19 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @agent-factory-platform/notify-react
|
|
2
|
+
|
|
3
|
+
Product-neutral notification operations UI for Agent Factory.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @agent-factory-platform/notify-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Use the exact Agent Factory version across packages in one application.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
This package owns reusable, business-free infrastructure and lifecycle contracts. Product prompts, domain tools, policies, credentials, data, and deployment configuration remain in the consuming application.
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
API and package documentation: [https://www.npmjs.com/package/@agent-factory-platform/notify-react](https://www.npmjs.com/package/@agent-factory-platform/notify-react)
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.af-notify-workbench{min-height:100%;padding:2rem;color:var(--color-ink);background:var(--color-surface-canvas)}.af-notify-workbench>header{max-width:42rem}.af-notify-workbench>header,.af-notify-workbench section{margin-bottom:2rem}.af-notify-compose{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) auto;gap:.75rem;align-items:end;margin-bottom:2rem}.af-notify-compose label{display:grid;gap:.25rem;color:var(--color-graphite);font-size:.75rem}.af-notify-compose input{min-height:2.5rem;border:1px solid var(--color-border);border-radius:var(--radius-control);padding:0 .75rem;color:var(--color-ink);background:var(--color-surface-card)}.af-notify-workbench h1{margin:.25rem 0;font-family:var(--font-product);font-size:2rem;font-weight:650}.af-notify-workbench h2{margin:0 0 .75rem;font-family:var(--font-product);font-size:1.25rem;font-weight:600}.af-notify-workbench p,.af-notify-workbench small{color:var(--color-graphite);font-size:.875rem}.af-notify-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(20rem,100%),1fr));gap:.75rem}.af-notify-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;margin-bottom:.5rem}.af-notify-card-heading+p{margin-bottom:.5rem}.af-notify-workbench article>button{margin-top:.75rem}@media(max-width:48rem){.af-notify-workbench{padding:1rem}.af-notify-compose{grid-template-columns:1fr}}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { StateView as N, CardLabel as b, Button as g, Card as v, CardTitle as m, Tag as S } from "@agent-factory-platform/ui-kit";
|
|
3
|
+
import { notifyV1 as l } from "@agent-factory-platform/client";
|
|
4
|
+
import { useState as D } from "react";
|
|
5
|
+
const E = {
|
|
6
|
+
[l.NotificationStatus.UNSPECIFIED]: "Unknown",
|
|
7
|
+
[l.NotificationStatus.PENDING]: "Pending",
|
|
8
|
+
[l.NotificationStatus.SENDING]: "Sending",
|
|
9
|
+
[l.NotificationStatus.RETRY_SCHEDULED]: "Retry scheduled",
|
|
10
|
+
[l.NotificationStatus.SENT]: "Sent",
|
|
11
|
+
[l.NotificationStatus.DEAD_LETTER]: "Dead letter"
|
|
12
|
+
};
|
|
13
|
+
function x({ notifications: a, deadLetters: r, loading: d = !1, error: s, actionError: h, enqueueing: f = !1, retryingId: u, onRetry: c, onEnqueue: p }) {
|
|
14
|
+
const [n, o] = D({ channel: "log", recipient: "operator", title: "" });
|
|
15
|
+
return d ? /* @__PURE__ */ e(N, { title: "Loading notifications", description: "Reading the durable delivery log." }) : s ? /* @__PURE__ */ e(N, { variant: "error", title: "Notifications unavailable", description: s }) : /* @__PURE__ */ i("main", { className: "af-notify-workbench", "data-testid": "notify-workbench", children: [
|
|
16
|
+
/* @__PURE__ */ i("header", { children: [
|
|
17
|
+
/* @__PURE__ */ e(b, { children: "Delivery operations" }),
|
|
18
|
+
/* @__PURE__ */ e("h1", { children: "Notifications" }),
|
|
19
|
+
/* @__PURE__ */ e("p", { children: "Inspect current state and the append-only attempt history." })
|
|
20
|
+
] }),
|
|
21
|
+
h && /* @__PURE__ */ e("p", { role: "alert", children: h }),
|
|
22
|
+
p && /* @__PURE__ */ i("form", { className: "af-notify-compose", onSubmit: async (t) => {
|
|
23
|
+
t.preventDefault(), await p(n);
|
|
24
|
+
}, children: [
|
|
25
|
+
/* @__PURE__ */ i("label", { children: [
|
|
26
|
+
"Channel",
|
|
27
|
+
/* @__PURE__ */ e("input", { required: !0, value: n.channel, onChange: (t) => o({ ...n, channel: t.target.value }) })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ i("label", { children: [
|
|
30
|
+
"Recipient",
|
|
31
|
+
/* @__PURE__ */ e("input", { required: !0, value: n.recipient, onChange: (t) => o({ ...n, recipient: t.target.value }) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ i("label", { children: [
|
|
34
|
+
"Title",
|
|
35
|
+
/* @__PURE__ */ e("input", { required: !0, value: n.title, onChange: (t) => o({ ...n, title: t.target.value }) })
|
|
36
|
+
] }),
|
|
37
|
+
/* @__PURE__ */ e(g, { type: "submit", disabled: f, children: f ? "Enqueueing…" : "Enqueue notification" })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ i("section", { "aria-labelledby": "delivery-heading", children: [
|
|
40
|
+
/* @__PURE__ */ e("h2", { id: "delivery-heading", children: "Delivery status" }),
|
|
41
|
+
/* @__PURE__ */ e("div", { className: "af-notify-grid", children: a.map((t) => /* @__PURE__ */ e(y, { item: t }, t.id)) }),
|
|
42
|
+
a.length === 0 && /* @__PURE__ */ e("p", { children: "No notifications yet." })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ i("section", { "aria-labelledby": "dead-letter-heading", children: [
|
|
45
|
+
/* @__PURE__ */ e("h2", { id: "dead-letter-heading", children: "Dead letters" }),
|
|
46
|
+
r.length === 0 ? /* @__PURE__ */ e("p", { children: "No dead letters." }) : /* @__PURE__ */ e("div", { className: "af-notify-grid", children: r.map((t) => /* @__PURE__ */ e(y, { item: t, children: /* @__PURE__ */ e(g, { disabled: !c || u === t.id, onClick: () => c == null ? void 0 : c(t.id), children: u === t.id ? "Retrying…" : "Retry delivery" }) }, t.id)) })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
function y({ item: a, children: r }) {
|
|
51
|
+
var d;
|
|
52
|
+
return /* @__PURE__ */ i(v, { as: "article", density: "compact", children: [
|
|
53
|
+
/* @__PURE__ */ i("div", { className: "af-notify-card-heading", children: [
|
|
54
|
+
/* @__PURE__ */ e(m, { children: ((d = a.content) == null ? void 0 : d.title) || "Untitled notification" }),
|
|
55
|
+
/* @__PURE__ */ e(S, { children: E[a.status] })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ i("p", { children: [
|
|
58
|
+
a.channel,
|
|
59
|
+
" · ",
|
|
60
|
+
a.recipient
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ i("small", { children: [
|
|
63
|
+
a.attempts,
|
|
64
|
+
" of ",
|
|
65
|
+
a.maxAttempts,
|
|
66
|
+
" attempts"
|
|
67
|
+
] }),
|
|
68
|
+
a.lastError && /* @__PURE__ */ e("p", { role: "status", children: a.lastError }),
|
|
69
|
+
r
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
x as NotifyWorkbench
|
|
74
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { notifyV1 } from "@agent-factory-platform/client";
|
|
2
|
+
/** Values accepted by the enqueue control. */
|
|
3
|
+
export interface NotifyDraft {
|
|
4
|
+
channel: string;
|
|
5
|
+
recipient: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NotifyWorkbenchProps {
|
|
9
|
+
notifications: readonly notifyV1.NotificationRecord[];
|
|
10
|
+
deadLetters: readonly notifyV1.NotificationRecord[];
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
actionError?: string;
|
|
14
|
+
enqueueing?: boolean;
|
|
15
|
+
retryingId?: string;
|
|
16
|
+
onRetry?: (notificationId: string) => void;
|
|
17
|
+
onEnqueue?: (draft: NotifyDraft) => void | Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function NotifyWorkbench({ notifications, deadLetters, loading, error, actionError, enqueueing, retryingId, onRetry, onEnqueue }: NotifyWorkbenchProps): import("react").JSX.Element;
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-factory-platform/notify-react",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Product-neutral notification operations UI for Agent Factory.",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/JingYeoh/agent-factory.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"provenance": true
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./dist/index.css"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./styles.css": "./dist/index.css"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "^19.0.0",
|
|
30
|
+
"react-dom": "^19.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@agent-factory-platform/client": "0.5.0",
|
|
34
|
+
"@agent-factory-platform/ui-kit": "0.5.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
38
|
+
"@types/react": "^19.0.0",
|
|
39
|
+
"@types/react-dom": "^19.0.0",
|
|
40
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
41
|
+
"jsdom": "^29.0.0",
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0",
|
|
44
|
+
"tailwindcss": "^4.3.3",
|
|
45
|
+
"typescript": "^5.7.2",
|
|
46
|
+
"vite": "^6.0.7",
|
|
47
|
+
"vitest": "^4.1.9"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"lint": "tsc -p tsconfig.json --noEmit",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"build": "node ../../scripts/clean-package-dist.mjs . && vite build && tsc -p tsconfig.build.json"
|
|
53
|
+
}
|
|
54
|
+
}
|