@runflow-ai/sdk 1.1.10 → 1.1.11

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.
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ /**
3
+ * ============================================================================
4
+ * METRICS - Code-first dashboard definitions for Runflow
5
+ * ============================================================================
6
+ *
7
+ * Lets agent code declare its own dashboard tabs and cards, then sync them
8
+ * to the platform with `runflow.metrics.sync()` (or auto-sync on first
9
+ * `track()`). Mirrors the same API surface used by the CLI `rf metrics
10
+ * sync` command — same canonical shape, same idempotency.
11
+ *
12
+ * Quick example:
13
+ *
14
+ * import { metrics } from '@runflow-ai/sdk/observability';
15
+ *
16
+ * metrics.defineTab({ name: 'Vendas' });
17
+ * metrics.defineCard({
18
+ * tab: 'Vendas',
19
+ * title: 'Funil de checkout',
20
+ * cardType: 'funnel',
21
+ * config: {
22
+ * funnelMode: 'multi_event',
23
+ * steps: [
24
+ * { eventName: 'cart_open', label: 'Carrinho aberto' },
25
+ * { eventName: 'checkout_started', label: 'Início checkout' },
26
+ * { eventName: 'sale', label: 'Pagamento' },
27
+ * ],
28
+ * },
29
+ * gridLayout: { x: 0, y: 0, w: 6, h: 5 },
30
+ * });
31
+ *
32
+ * await metrics.sync(); // POSTs to /api/v1/runtime/observability/...
33
+ *
34
+ * Validation happens at registration time using the shared zod schemas, so
35
+ * shape mistakes are caught before deploy. The registry is process-wide
36
+ * (mirrors how `track()` and `identify()` are stored).
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.metrics = exports.MetricsRegistry = void 0;
40
+ const shared_1 = require("../_runflow-shared");
41
+ // ---------------------------------------------------------------------------
42
+ // Registry
43
+ // ---------------------------------------------------------------------------
44
+ class MetricsRegistry {
45
+ constructor() {
46
+ this.tabs = new Map();
47
+ /** key = `${cardType}:${title}` — same dedup as the CLI uses. */
48
+ this.cards = new Map();
49
+ }
50
+ /**
51
+ * Register a dashboard tab. Idempotent on `name`. Re-registering with the
52
+ * same name updates `sortOrder`.
53
+ */
54
+ defineTab(input) {
55
+ const parsed = shared_1.DashboardTabInputSchema.parse(input);
56
+ const entry = {
57
+ name: parsed.name,
58
+ sortOrder: parsed.sortOrder ?? this.tabs.size,
59
+ };
60
+ this.tabs.set(entry.name, entry);
61
+ return entry;
62
+ }
63
+ /**
64
+ * Register a dashboard card. Throws (synchronously) if the config doesn't
65
+ * match the shape required by the chosen cardType. Legacy aliases are
66
+ * auto-normalized before validation.
67
+ */
68
+ defineCard(input) {
69
+ if (!shared_1.ALL_CARD_TYPES.includes(input.cardType)) {
70
+ throw new Error(`metrics.defineCard: invalid cardType "${input.cardType}". ` +
71
+ `Valid: ${shared_1.ALL_CARD_TYPES.join(", ")}`);
72
+ }
73
+ // Auto-normalize legacy alias shapes before validation.
74
+ const normalized = (0, shared_1.normalizeCardConfig)(input.cardType, input.config);
75
+ let gridLayout;
76
+ if (input.gridLayout) {
77
+ const gl = shared_1.GridLayoutItemSchema.safeParse(input.gridLayout);
78
+ if (!gl.success) {
79
+ throw new Error(`metrics.defineCard("${input.title}"): invalid gridLayout — ${gl.error.issues
80
+ .map((i) => i.message)
81
+ .join("; ")}`);
82
+ }
83
+ gridLayout = gl.data;
84
+ }
85
+ const parsed = shared_1.DashboardCardInputSchema.safeParse({
86
+ cardType: input.cardType,
87
+ title: input.title,
88
+ config: normalized.config,
89
+ gridLayout,
90
+ sortOrder: input.sortOrder,
91
+ });
92
+ if (!parsed.success) {
93
+ throw new Error(`metrics.defineCard("${input.title}"): ${parsed.error.issues
94
+ .map((i) => `${i.path.length ? i.path.join(".") : "<root>"}: ${i.message}`)
95
+ .join("; ")}`);
96
+ }
97
+ const key = `${input.cardType}:${input.title}`;
98
+ if (this.cards.has(key)) {
99
+ throw new Error(`metrics.defineCard: duplicate card (${key}). Each (cardType, title) ` +
100
+ `pair must be unique in the registry.`);
101
+ }
102
+ const entry = {
103
+ title: input.title,
104
+ cardType: input.cardType,
105
+ config: normalized.config,
106
+ tab: input.tab,
107
+ gridLayout,
108
+ sortOrder: input.sortOrder,
109
+ };
110
+ this.cards.set(key, entry);
111
+ return entry;
112
+ }
113
+ /** Inspect what's currently registered. Read-only. */
114
+ list() {
115
+ return {
116
+ tabs: [...this.tabs.values()],
117
+ cards: [...this.cards.values()],
118
+ };
119
+ }
120
+ /** Drop everything. Mostly useful in tests. */
121
+ reset() {
122
+ this.tabs.clear();
123
+ this.cards.clear();
124
+ }
125
+ /**
126
+ * Push the registered tabs and cards to the Runflow platform.
127
+ *
128
+ * Two-phase: upsert tabs first (matching by name → tabId), then upsert
129
+ * cards with their resolved tabId. Talks to the runtime endpoints used
130
+ * by the CLI:
131
+ *
132
+ * POST /api/v1/runtime/observability/dashboard-tabs (tabs)
133
+ * POST /api/v1/runtime/observability/dashboard-cards (cards)
134
+ *
135
+ * Per-card idempotency key = `hash(cardType + title + tab?)`. On the
136
+ * server, table/funnel/gauge cards (no eventName at root) dedupe via the
137
+ * idempotency key; KPI-shaped cards continue using the (event_name,
138
+ * card_type, aggregation, property_key) unique index.
139
+ */
140
+ async sync(options = {}) {
141
+ const baseUrl = options.baseUrl ?? readBaseUrl();
142
+ const apiKey = options.apiKey ?? readApiKey();
143
+ const agentId = options.agentId ?? readAgentId();
144
+ if (!baseUrl)
145
+ throw new Error("metrics.sync: missing baseUrl (set RUNFLOW_API_URL)");
146
+ if (!apiKey)
147
+ throw new Error("metrics.sync: missing apiKey (set RUNFLOW_API_KEY)");
148
+ if (!agentId)
149
+ throw new Error("metrics.sync: missing agentId (set RUNFLOW_AGENT_ID)");
150
+ const result = {
151
+ agentId,
152
+ tabs: { created: 0, updated: 0, total: this.tabs.size },
153
+ cards: { created: 0, updated: 0, failed: 0, total: this.cards.size },
154
+ };
155
+ // Phase 1 — tabs.
156
+ const nameToId = new Map();
157
+ for (const tab of this.tabs.values()) {
158
+ try {
159
+ const res = await postJson(`${baseUrl}/api/v1/runtime/observability/dashboard-tabs`, apiKey, { agentId, name: tab.name, sortOrder: tab.sortOrder });
160
+ const id = res?.id ?? res?.tab?.id;
161
+ if (id) {
162
+ nameToId.set(tab.name, id);
163
+ if (res?.created === false)
164
+ result.tabs.updated++;
165
+ else
166
+ result.tabs.created++;
167
+ }
168
+ }
169
+ catch (err) {
170
+ if (options.strict)
171
+ throw err;
172
+ // Non-strict: log and keep going. Without a tabId, cards that
173
+ // referenced this tab will be created tab-less.
174
+ console.warn(`[runflow] metrics.sync: failed to upsert tab "${tab.name}": ${err.message}`);
175
+ }
176
+ }
177
+ // Phase 2 — cards.
178
+ for (const card of this.cards.values()) {
179
+ const tabId = card.tab ? nameToId.get(card.tab) : undefined;
180
+ if (card.tab && !tabId) {
181
+ console.warn(`[runflow] metrics.sync: card "${card.title}" references tab "${card.tab}" ` +
182
+ `which couldn't be resolved — sending without tabId`);
183
+ }
184
+ try {
185
+ const res = await postJson(`${baseUrl}/api/v1/runtime/observability/dashboard-cards`, apiKey, {
186
+ agentId,
187
+ title: card.title,
188
+ cardType: card.cardType,
189
+ config: card.config,
190
+ tabId,
191
+ gridLayout: card.gridLayout,
192
+ sortOrder: card.sortOrder,
193
+ idempotencyKey: idempotencyKey(card),
194
+ });
195
+ if (res?.created)
196
+ result.cards.created++;
197
+ else
198
+ result.cards.updated++;
199
+ }
200
+ catch (err) {
201
+ if (options.strict)
202
+ throw err;
203
+ result.cards.failed++;
204
+ console.warn(`[runflow] metrics.sync: card "${card.title}" failed — ${err.message}`);
205
+ }
206
+ }
207
+ return result;
208
+ }
209
+ }
210
+ exports.MetricsRegistry = MetricsRegistry;
211
+ // ---------------------------------------------------------------------------
212
+ // Helpers
213
+ // ---------------------------------------------------------------------------
214
+ function idempotencyKey(card) {
215
+ // Stable, deterministic, short. The server doesn't need cryptographic
216
+ // collision resistance — just a key that's the same on every redeploy.
217
+ return `${card.cardType}:${card.title}:${card.tab ?? ""}`;
218
+ }
219
+ function readBaseUrl() {
220
+ const raw = process.env.RUNFLOW_API_URL ||
221
+ globalThis.__runflowAPIBaseUrl ||
222
+ undefined;
223
+ if (!raw)
224
+ return undefined;
225
+ // Strip any trailing slash and the /api/v1/runtime suffix if the caller
226
+ // configured the runtime URL instead of the host base.
227
+ return String(raw).replace(/\/api\/v1\/runtime\/?$/, "").replace(/\/$/, "");
228
+ }
229
+ function readApiKey() {
230
+ return (process.env.RUNFLOW_API_KEY ||
231
+ globalThis.__runflowAPIKey ||
232
+ undefined);
233
+ }
234
+ function readAgentId() {
235
+ return (process.env.RUNFLOW_AGENT_ID ||
236
+ globalThis.__runflowAgentId ||
237
+ undefined);
238
+ }
239
+ async function postJson(url, apiKey, body) {
240
+ const res = await fetch(url, {
241
+ method: "POST",
242
+ headers: {
243
+ "content-type": "application/json",
244
+ "x-api-key": apiKey,
245
+ authorization: `Bearer ${apiKey}`,
246
+ },
247
+ body: JSON.stringify(body),
248
+ });
249
+ if (!res.ok) {
250
+ let detail = `${res.status} ${res.statusText}`;
251
+ try {
252
+ const j = (await res.json());
253
+ detail = j?.message || j?.error || detail;
254
+ }
255
+ catch {
256
+ /* ignore */
257
+ }
258
+ throw new Error(detail);
259
+ }
260
+ return res.json();
261
+ }
262
+ // ---------------------------------------------------------------------------
263
+ // Singleton instance (mirrors `track()` pattern)
264
+ // ---------------------------------------------------------------------------
265
+ const GLOBAL_KEY = "__runflowMetricsRegistry";
266
+ function getRegistry() {
267
+ const existing = globalThis[GLOBAL_KEY];
268
+ if (existing)
269
+ return existing;
270
+ const reg = new MetricsRegistry();
271
+ globalThis[GLOBAL_KEY] = reg;
272
+ return reg;
273
+ }
274
+ /**
275
+ * Process-wide metrics registry. `import { metrics }` returns the same
276
+ * instance every time, so it can be safely required from multiple modules.
277
+ */
278
+ exports.metrics = getRegistry();
279
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/observability/metrics.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;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O,IAAI,CAAC,EAAE,KAAK,IAAI,MAAM,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,8EAA8E;AAC9E,iDAAiD;AACjD,8EAA8E;AAE9E,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAE9C,SAAS,WAAW;IAClB,MAAM,QAAQ,GAAI,UAAkB,CAAC,UAAU,CAAgC,CAAC;IAChF,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,UAAkB,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;IACtC,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACU,QAAA,OAAO,GAAoB,WAAW,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runflow-ai/sdk",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Runflow SDK - Multi-agent AI framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -83,12 +83,16 @@
83
83
  }
84
84
  },
85
85
  "scripts": {
86
- "build": "tsc",
86
+ "build": "tsc && npm run build:inline-shared",
87
87
  "dev": "tsc --watch",
88
88
  "prepublishOnly": "npm run build",
89
89
  "test": "jest",
90
90
  "validate": "./scripts/validate-before-publish.sh",
91
- "publish:safe": "npm run validate && npm publish"
91
+ "publish:safe": "npm run validate && npm publish",
92
+ "build:inline-shared": "node ../shared/scripts/inline-into.js ./dist",
93
+ "prepack": "node ../shared/scripts/inline-into.js --strip-dep .",
94
+ "postpack": "node ../shared/scripts/inline-into.js --restore-dep .",
95
+ "prebuild": "cd ../shared && tsc"
92
96
  },
93
97
  "dependencies": {
94
98
  "axios": "^1.13.2",