@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,321 @@
1
+ "use strict";
2
+ /**
3
+ * Zod schemas for Dashboard Cards.
4
+ *
5
+ * Used at runtime by:
6
+ * - MCP tool input validation (apps/api-portal/src/modules/mcp/tools)
7
+ * - CLI `metrics.json` parser (packages/cli)
8
+ * - SDK `defineCard()` runtime guard (packages/sdk)
9
+ *
10
+ * The API DTOs in apps/api-portal use class-validator/class-transformer (not
11
+ * zod) — but the shapes mirror these schemas 1:1. If a field is added here,
12
+ * mirror it there too. The dashboard-cards.ts types remain the canonical TS
13
+ * source.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.GRID_CONSTRAINTS = exports.MetricsFileSchema = exports.ReorderTabsInputSchema = exports.ReorderCardsInputSchema = exports.DashboardTabInputSchema = exports.DashboardCardInputSchema = exports.GridLayoutItemSchema = exports.GaugeCardConfigSchema = exports.GaugeZoneColorsSchema = exports.GaugeThresholdsSchema = exports.FunnelCardConfigSchema = exports.FunnelStepValueSchema = exports.FunnelStepSchema = exports.TableCardConfigSchema = exports.TablePaginationSchema = exports.TableConditionSchema = exports.TableConditionRuleSchema = exports.TableFilterSchema = exports.TableMetricSchema = exports.TableColumnConfigSchema = exports.BaseCardConfigSchema = exports.CardTypeSchema = exports.FilterOperatorSchema = exports.CardFormatSchema = exports.DateGroupingSchema = exports.AggregationSchema = void 0;
17
+ exports.gridLayoutForCardType = gridLayoutForCardType;
18
+ const zod_1 = require("zod");
19
+ const dashboard_cards_1 = require("./dashboard-cards");
20
+ Object.defineProperty(exports, "GRID_CONSTRAINTS", { enumerable: true, get: function () { return dashboard_cards_1.GRID_CONSTRAINTS; } });
21
+ // -----------------------------------------------------------------------------
22
+ // Atom enums
23
+ // -----------------------------------------------------------------------------
24
+ exports.AggregationSchema = zod_1.z.enum([
25
+ "count",
26
+ "rate",
27
+ "sum",
28
+ "avg",
29
+ "distinct_count",
30
+ "group_by",
31
+ ]);
32
+ exports.DateGroupingSchema = zod_1.z.enum(["hour", "day", "week", "month"]);
33
+ exports.CardFormatSchema = zod_1.z.enum([
34
+ "number",
35
+ "percentage",
36
+ "currency",
37
+ "duration",
38
+ ]);
39
+ exports.FilterOperatorSchema = zod_1.z.enum([
40
+ "eq",
41
+ "neq",
42
+ "gt",
43
+ "lt",
44
+ "gte",
45
+ "lte",
46
+ "contains",
47
+ "in",
48
+ ]);
49
+ exports.CardTypeSchema = zod_1.z.enum(dashboard_cards_1.ALL_CARD_TYPES);
50
+ // -----------------------------------------------------------------------------
51
+ // Config shapes — each card type carries `cardType` for discriminator support.
52
+ // -----------------------------------------------------------------------------
53
+ const BaseConfigFields = {
54
+ eventName: zod_1.z.string().min(1).optional(),
55
+ aggregation: exports.AggregationSchema.optional(),
56
+ propertyKey: zod_1.z.string().optional(),
57
+ propertyValue: zod_1.z.string().optional(),
58
+ dateGrouping: exports.DateGroupingSchema.optional(),
59
+ format: exports.CardFormatSchema.optional(),
60
+ color: zod_1.z.string().optional(),
61
+ icon: zod_1.z.string().optional(),
62
+ };
63
+ exports.BaseCardConfigSchema = zod_1.z.object(BaseConfigFields).strict();
64
+ exports.TableColumnConfigSchema = zod_1.z
65
+ .object({
66
+ key: zod_1.z.string().min(1),
67
+ label: zod_1.z.string().optional(),
68
+ format: zod_1.z
69
+ .enum(["number", "percentage", "currency", "duration", "text"])
70
+ .optional(),
71
+ width: zod_1.z.number().positive().optional(),
72
+ })
73
+ .strict();
74
+ exports.TableMetricSchema = zod_1.z
75
+ .object({
76
+ aggregation: exports.AggregationSchema,
77
+ propertyKey: zod_1.z.string().optional(),
78
+ alias: zod_1.z.string().optional(),
79
+ })
80
+ .strict();
81
+ exports.TableFilterSchema = zod_1.z
82
+ .object({
83
+ key: zod_1.z.string().min(1),
84
+ operator: exports.FilterOperatorSchema,
85
+ value: zod_1.z.unknown(),
86
+ })
87
+ .strict();
88
+ exports.TableConditionRuleSchema = zod_1.z
89
+ .object({
90
+ operator: zod_1.z.enum(["eq", "neq", "gt", "lt", "gte", "lte"]),
91
+ value: zod_1.z.string(),
92
+ color: zod_1.z.string().min(1),
93
+ label: zod_1.z.string().optional(),
94
+ })
95
+ .strict();
96
+ exports.TableConditionSchema = zod_1.z
97
+ .object({
98
+ columnKey: zod_1.z.string().min(1),
99
+ type: zod_1.z.enum(["color", "badge"]),
100
+ rules: zod_1.z.array(exports.TableConditionRuleSchema).min(1),
101
+ })
102
+ .strict();
103
+ exports.TablePaginationSchema = zod_1.z
104
+ .object({
105
+ limit: zod_1.z.number().int().positive(),
106
+ offset: zod_1.z.number().int().nonnegative(),
107
+ })
108
+ .strict();
109
+ exports.TableCardConfigSchema = zod_1.z
110
+ .object({
111
+ ...BaseConfigFields,
112
+ mode: zod_1.z.enum(["raw", "aggregate"]),
113
+ columns: zod_1.z
114
+ .array(zod_1.z.union([zod_1.z.string().min(1), exports.TableColumnConfigSchema]))
115
+ .optional(),
116
+ groupByKey: zod_1.z.string().optional(),
117
+ metrics: zod_1.z.array(exports.TableMetricSchema).optional(),
118
+ filters: zod_1.z.array(exports.TableFilterSchema).optional(),
119
+ conditions: zod_1.z.array(exports.TableConditionSchema).optional(),
120
+ sortBy: zod_1.z.string().optional(),
121
+ sortOrder: zod_1.z.enum(["asc", "desc"]).optional(),
122
+ pagination: exports.TablePaginationSchema.optional(),
123
+ rowsPerPage: zod_1.z.number().int().positive().optional(),
124
+ })
125
+ .strict();
126
+ exports.FunnelStepSchema = zod_1.z
127
+ .object({
128
+ eventName: zod_1.z.string().min(1),
129
+ label: zod_1.z.string().optional(),
130
+ })
131
+ .strict();
132
+ exports.FunnelStepValueSchema = zod_1.z
133
+ .object({
134
+ value: zod_1.z.string().min(1),
135
+ label: zod_1.z.string().optional(),
136
+ })
137
+ .strict();
138
+ exports.FunnelCardConfigSchema = zod_1.z
139
+ .object({
140
+ ...BaseConfigFields,
141
+ funnelMode: zod_1.z.enum(["multi_event", "single_event"]),
142
+ layout: zod_1.z.enum(["vertical", "horizontal"]).optional(),
143
+ steps: zod_1.z.array(exports.FunnelStepSchema).optional(),
144
+ stepValues: zod_1.z.array(exports.FunnelStepValueSchema).optional(),
145
+ })
146
+ .strict()
147
+ .superRefine((cfg, ctx) => {
148
+ if (cfg.funnelMode === "multi_event" && (!cfg.steps || cfg.steps.length < 2)) {
149
+ ctx.addIssue({
150
+ code: zod_1.z.ZodIssueCode.custom,
151
+ message: "funnel.multi_event requires at least 2 steps",
152
+ path: ["steps"],
153
+ });
154
+ }
155
+ if (cfg.funnelMode === "single_event") {
156
+ if (!cfg.eventName) {
157
+ ctx.addIssue({
158
+ code: zod_1.z.ZodIssueCode.custom,
159
+ message: "funnel.single_event requires eventName",
160
+ path: ["eventName"],
161
+ });
162
+ }
163
+ if (!cfg.propertyKey) {
164
+ ctx.addIssue({
165
+ code: zod_1.z.ZodIssueCode.custom,
166
+ message: "funnel.single_event requires propertyKey",
167
+ path: ["propertyKey"],
168
+ });
169
+ }
170
+ if (!cfg.stepValues || cfg.stepValues.length < 2) {
171
+ ctx.addIssue({
172
+ code: zod_1.z.ZodIssueCode.custom,
173
+ message: "funnel.single_event requires at least 2 stepValues",
174
+ path: ["stepValues"],
175
+ });
176
+ }
177
+ }
178
+ });
179
+ exports.GaugeThresholdsSchema = zod_1.z
180
+ .object({
181
+ v1: zod_1.z.number(),
182
+ v2: zod_1.z.number(),
183
+ })
184
+ .strict();
185
+ exports.GaugeZoneColorsSchema = zod_1.z
186
+ .object({
187
+ low: zod_1.z.string().min(1),
188
+ mid: zod_1.z.string().min(1),
189
+ high: zod_1.z.string().min(1),
190
+ })
191
+ .strict();
192
+ exports.GaugeCardConfigSchema = zod_1.z
193
+ .object({
194
+ ...BaseConfigFields,
195
+ min: zod_1.z.number(),
196
+ max: zod_1.z.number(),
197
+ target: zod_1.z.number().optional(),
198
+ thresholds: exports.GaugeThresholdsSchema,
199
+ zoneColors: exports.GaugeZoneColorsSchema.optional(),
200
+ unit: zod_1.z.string().optional(),
201
+ })
202
+ .strict()
203
+ .superRefine((cfg, ctx) => {
204
+ if (cfg.min >= cfg.max) {
205
+ ctx.addIssue({
206
+ code: zod_1.z.ZodIssueCode.custom,
207
+ message: "gauge.min must be strictly less than gauge.max",
208
+ path: ["min"],
209
+ });
210
+ }
211
+ if (cfg.thresholds.v1 > cfg.thresholds.v2) {
212
+ ctx.addIssue({
213
+ code: zod_1.z.ZodIssueCode.custom,
214
+ message: "thresholds.v1 must be <= thresholds.v2",
215
+ path: ["thresholds", "v1"],
216
+ });
217
+ }
218
+ });
219
+ // -----------------------------------------------------------------------------
220
+ // Grid layout
221
+ // -----------------------------------------------------------------------------
222
+ exports.GridLayoutItemSchema = zod_1.z
223
+ .object({
224
+ x: zod_1.z.number().int().nonnegative(),
225
+ y: zod_1.z.number().int().nonnegative(),
226
+ w: zod_1.z.number().int().positive(),
227
+ h: zod_1.z.number().int().positive(),
228
+ })
229
+ .strict();
230
+ /** Returns a schema that enforces both the geometry AND the per-cardType constraints. */
231
+ function gridLayoutForCardType(cardType) {
232
+ return exports.GridLayoutItemSchema.superRefine((layout, ctx) => {
233
+ const res = (0, dashboard_cards_1.isValidGridLayout)(cardType, layout);
234
+ if (!res.ok) {
235
+ ctx.addIssue({
236
+ code: zod_1.z.ZodIssueCode.custom,
237
+ message: res.reason,
238
+ });
239
+ }
240
+ });
241
+ }
242
+ // -----------------------------------------------------------------------------
243
+ // DashboardCard — discriminated union on cardType
244
+ // -----------------------------------------------------------------------------
245
+ function cardSchema(cardType, configSchema) {
246
+ return zod_1.z
247
+ .object({
248
+ cardType: zod_1.z.literal(cardType),
249
+ title: zod_1.z.string().min(1),
250
+ config: configSchema,
251
+ tabId: zod_1.z.string().nullable().optional(),
252
+ gridLayout: gridLayoutForCardType(cardType).optional(),
253
+ sortOrder: zod_1.z.number().int().nonnegative().optional(),
254
+ })
255
+ .strict();
256
+ }
257
+ const numberCard = cardSchema("number", exports.BaseCardConfigSchema);
258
+ const rateCard = cardSchema("rate", exports.BaseCardConfigSchema);
259
+ const lineCard = cardSchema("line", exports.BaseCardConfigSchema);
260
+ const barCard = cardSchema("bar", exports.BaseCardConfigSchema);
261
+ const pieCard = cardSchema("pie", exports.BaseCardConfigSchema);
262
+ const tableCard = cardSchema("table", exports.TableCardConfigSchema);
263
+ const funnelCard = cardSchema("funnel", exports.FunnelCardConfigSchema);
264
+ const gaugeCard = cardSchema("gauge", exports.GaugeCardConfigSchema);
265
+ /** Discriminated union over `cardType`. */
266
+ exports.DashboardCardInputSchema = zod_1.z.discriminatedUnion("cardType", [
267
+ numberCard,
268
+ rateCard,
269
+ lineCard,
270
+ barCard,
271
+ pieCard,
272
+ tableCard,
273
+ funnelCard,
274
+ gaugeCard,
275
+ ]);
276
+ // -----------------------------------------------------------------------------
277
+ // Tabs + reorder + CLI metrics.json
278
+ // -----------------------------------------------------------------------------
279
+ exports.DashboardTabInputSchema = zod_1.z
280
+ .object({
281
+ name: zod_1.z.string().min(1).max(80),
282
+ sortOrder: zod_1.z.number().int().nonnegative().optional(),
283
+ })
284
+ .strict();
285
+ exports.ReorderCardsInputSchema = zod_1.z
286
+ .object({
287
+ cards: zod_1.z
288
+ .array(zod_1.z
289
+ .object({
290
+ id: zod_1.z.string().min(1),
291
+ sortOrder: zod_1.z.number().int().nonnegative(),
292
+ gridLayout: exports.GridLayoutItemSchema.optional(),
293
+ tabId: zod_1.z.string().nullable().optional(),
294
+ })
295
+ .strict())
296
+ .min(1),
297
+ })
298
+ .strict();
299
+ exports.ReorderTabsInputSchema = zod_1.z
300
+ .object({
301
+ tabs: zod_1.z
302
+ .array(zod_1.z
303
+ .object({
304
+ id: zod_1.z.string().min(1),
305
+ sortOrder: zod_1.z.number().int().nonnegative(),
306
+ })
307
+ .strict())
308
+ .min(1),
309
+ })
310
+ .strict();
311
+ /** Shape used by `rf metrics sync` / `pull`. The card's `tab` is the tab *name*. */
312
+ exports.MetricsFileSchema = zod_1.z
313
+ .object({
314
+ tabs: zod_1.z.array(exports.DashboardTabInputSchema).optional(),
315
+ cards: zod_1.z.array(exports.DashboardCardInputSchema.and(zod_1.z
316
+ .object({
317
+ tab: zod_1.z.string().optional(),
318
+ })
319
+ .strict())),
320
+ })
321
+ .strict();
@@ -0,0 +1,3 @@
1
+ export * from "./dashboard-cards";
2
+ export * from "./dashboard-cards.normalize";
3
+ export * from "./dashboard-cards.zod";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dashboard-cards"), exports);
18
+ __exportStar(require("./dashboard-cards.normalize"), exports);
19
+ __exportStar(require("./dashboard-cards.zod"), exports);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { ScheduleCreateConfig, ScheduleUpdateConfig, ScheduleResponse, } fr
7
7
  export { connector, createConnectorTool, loadConnector } from "./connectors";
8
8
  export type { ConnectorParameters, ConnectorParameter, ConnectorToolOptions, ConnectorExecutionOptions, } from "./connectors";
9
9
  export { Workflow, WorkflowBuilder, createWorkflow, createStep, createAgentStep, createFunctionStep, createConnectorStep, FlowBuilder, flow, } from "./workflows";
10
- export { identify, detectIdentityType, startExecution, createExecutionContext, log, logEvent, logError, startSpan, configureLogging, message, createSpan, withSpan, track, flushTrackEvents, } from "./observability";
10
+ export { identify, detectIdentityType, startExecution, createExecutionContext, log, logEvent, logError, startSpan, configureLogging, message, createSpan, withSpan, track, flushTrackEvents, metrics, MetricsRegistry, } from "./observability";
11
11
  export type { IdentifyConfig, ExecutionConfig, ExecutionController, ExecutionContextConfig, ExecutionContextEndOptions, LogData, LogOptions, SpanHandle, LoggingConfig, MessageData, TrackOptions, } from "./observability";
12
12
  export { RunflowTraceCollector, RunflowTraceSpan, createTraceCollector, traced, } from "./observability";
13
13
  export type { AgentConfig, AgentInput, AgentOutput, AgentContext, ModelProvider, RunflowTool, ToolConfig, ToolContext, WorkflowConfig, WorkflowStep, WorkflowContext, WorkflowExecution, FlowContext, AgentStepResult, StepHandler, StepOpts, BranchOpts, SwitchOpts, SwitchStepConfig, ForeachStepConfig, WorkflowGraph, GraphNode, GraphEdge, WorkflowEvents, MemoryConfig, MemoryData, MemoryMessage, SearchResult, RerankConfig, RerankStrategy, StreamingConfig, ChatStreamChunk, TraceData, TraceMetadata, TraceCosts, TraceCollector, TraceSpan, EventData, EventsRequest, EventsResponse, RunflowAPIClient, ChatRequest, ChatResponse, VectorSearchOptions, VectorSearchResponse, RPAConfig, ExecutionContext, } from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,oBAAoB,EACpB,OAAO,EACP,IAAI,GACL,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpE,YAA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AC;AAOjB,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAO5E,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  // Version: 1.1.7 - URL-encode memoryId in runtime memory calls (fixes memory not saving when identify value contains @, +, etc.)
5
5
  // ============================================================================
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.login = exports.BrowserSession = exports.createBrowserTool = exports.traced = exports.createTraceCollector = exports.RunflowTraceSpan = exports.RunflowTraceCollector = exports.flushTrackEvents = exports.track = exports.withSpan = exports.createSpan = exports.message = exports.configureLogging = exports.startSpan = exports.logError = exports.logEvent = exports.log = exports.createExecutionContext = exports.startExecution = exports.detectIdentityType = exports.identify = exports.flow = exports.FlowBuilder = exports.createConnectorStep = exports.createFunctionStep = exports.createAgentStep = exports.createStep = exports.createWorkflow = exports.WorkflowBuilder = exports.Workflow = exports.loadConnector = exports.createConnectorTool = exports.connector = exports.createScheduleTools = exports.schedule = exports.createWebSearchTool = exports.webSearch = exports.createTool = exports.init = exports.Runflow = exports.RunflowAPIClientImpl = exports.createRunflowAPIClient = exports.custom = exports.xai = exports.gemini = exports.groq = exports.bedrock = exports.anthropic = exports.openai = exports.Agent = void 0;
8
- exports.SENSITIVE_TOKENS_COMPOUND = exports.SENSITIVE_TOKENS_ALWAYS = exports.DEFAULT_SENSITIVE_FIELDS = exports.getAllPatterns = exports.getPatterns = exports.composeTraceInterceptors = exports.buildPrivacyInterceptor = exports.createPIISanitizer = exports.PIISanitizer = exports.FileMemoryProvider = exports.RunflowMemoryProvider = exports.Media = exports.transcribe = exports.LLM = exports.getCredential = exports.Credentials = exports.isPromptRef = exports.loadPrompt = exports.Prompts = exports.RAG = exports.Knowledge = exports.Memory = exports.waitForResponse = exports.screenshotPage = exports.downloadFile = exports.extractText = exports.extractTable = exports.waitAndClick = exports.clickButton = exports.fillForm = void 0;
7
+ exports.createBrowserTool = exports.traced = exports.createTraceCollector = exports.RunflowTraceSpan = exports.RunflowTraceCollector = exports.MetricsRegistry = exports.metrics = exports.flushTrackEvents = exports.track = exports.withSpan = exports.createSpan = exports.message = exports.configureLogging = exports.startSpan = exports.logError = exports.logEvent = exports.log = exports.createExecutionContext = exports.startExecution = exports.detectIdentityType = exports.identify = exports.flow = exports.FlowBuilder = exports.createConnectorStep = exports.createFunctionStep = exports.createAgentStep = exports.createStep = exports.createWorkflow = exports.WorkflowBuilder = exports.Workflow = exports.loadConnector = exports.createConnectorTool = exports.connector = exports.createScheduleTools = exports.schedule = exports.createWebSearchTool = exports.webSearch = exports.createTool = exports.init = exports.Runflow = exports.RunflowAPIClientImpl = exports.createRunflowAPIClient = exports.custom = exports.xai = exports.gemini = exports.groq = exports.bedrock = exports.anthropic = exports.openai = exports.Agent = void 0;
8
+ exports.SENSITIVE_TOKENS_COMPOUND = exports.SENSITIVE_TOKENS_ALWAYS = exports.DEFAULT_SENSITIVE_FIELDS = exports.getAllPatterns = exports.getPatterns = exports.composeTraceInterceptors = exports.buildPrivacyInterceptor = exports.createPIISanitizer = exports.PIISanitizer = exports.FileMemoryProvider = exports.RunflowMemoryProvider = exports.Media = exports.transcribe = exports.LLM = exports.getCredential = exports.Credentials = exports.isPromptRef = exports.loadPrompt = exports.Prompts = exports.RAG = exports.Knowledge = exports.Memory = exports.waitForResponse = exports.screenshotPage = exports.downloadFile = exports.extractText = exports.extractTable = exports.waitAndClick = exports.clickButton = exports.fillForm = exports.login = exports.BrowserSession = void 0;
9
9
  // Core (Agent + Models + API Client + Context)
10
10
  var core_1 = require("./core");
11
11
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return core_1.Agent; } });
@@ -63,6 +63,8 @@ Object.defineProperty(exports, "createSpan", { enumerable: true, get: function (
63
63
  Object.defineProperty(exports, "withSpan", { enumerable: true, get: function () { return observability_1.withSpan; } });
64
64
  Object.defineProperty(exports, "track", { enumerable: true, get: function () { return observability_1.track; } });
65
65
  Object.defineProperty(exports, "flushTrackEvents", { enumerable: true, get: function () { return observability_1.flushTrackEvents; } });
66
+ Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return observability_1.metrics; } });
67
+ Object.defineProperty(exports, "MetricsRegistry", { enumerable: true, get: function () { return observability_1.MetricsRegistry; } });
66
68
  // Observability (advanced tracing)
67
69
  var observability_2 = require("./observability");
68
70
  Object.defineProperty(exports, "RunflowTraceCollector", { enumerable: true, get: function () { return observability_2.RunflowTraceCollector; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,iIAAiI;AACjI,+EAA+E;;;;AAE/E,+CAA+C;AAC/C,+BAagB;AAZd,6FAAA,KAAK,OAAA;AACL,8FAAA,MAAM,OAAA;AACN,iGAAA,SAAS,OAAA;AACT,+FAAA,OAAO,OAAA;AACP,4FAAA,IAAI,OAAA;AACJ,8FAAA,MAAM,OAAA;AACN,2FAAA,GAAG,OAAA;AACH,8FAAA,MAAM,OAAA;AACN,8GAAA,sBAAsB,OAAA;AACtB,4GAAA,oBAAoB,OAAA;AACpB,+FAAA,OAAO,OAAA;AACP,4FAAA,IAAI,OAAA;AAGN,QAAQ;AACR,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AAEnB,aAAa;AACb,iDAAoE;AAA3D,uGAA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BAAwB,OAAA;AACxB,sGAAA,WAAW,OAAA;AACX,yGAAA,cAAc,OAAA;AACd,mHAAA,wBAAwB,OAAA;AACxB,kHAAA,uBAAuB,OAAA;AACvB,oHAAA,yBAAyB,OAAA"}
@@ -8,6 +8,7 @@ export { log, logEvent, logError, startSpan, configureLogging, message } from '.
8
8
  export type { LogData, LogOptions, SpanHandle, LoggingConfig, MessageData } from './logging';
9
9
  export { track, flushTrackEvents } from './tracking';
10
10
  export type { TrackOptions } from './tracking';
11
+ export { metrics, MetricsRegistry } from './metrics';
11
12
  export { createSpan, withSpan } from './helpers';
12
13
  export { RunflowTraceCollector, RunflowTraceSpan, createTraceCollector, traced, } from './trace-collector';
13
14
  export type { TraceData, TraceMetadata, TraceCosts, TraceCollector, TraceSpan } from '../types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAGhH,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1F,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7F,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,YAA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,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,GACP,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,SAAS,EACV,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
@@ -3,7 +3,7 @@
3
3
  // OBSERVABILITY API - Public Exports
4
4
  // ============================================================================
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Runflow = exports.traced = exports.createTraceCollector = exports.RunflowTraceSpan = exports.RunflowTraceCollector = exports.withSpan = exports.createSpan = exports.flushTrackEvents = exports.track = exports.message = exports.configureLogging = exports.startSpan = exports.logError = exports.logEvent = exports.log = exports.createExecutionContext = exports.startExecution = exports.detectIdentityType = exports.identify = void 0;
6
+ exports.Runflow = exports.traced = exports.createTraceCollector = exports.RunflowTraceSpan = exports.RunflowTraceCollector = exports.withSpan = exports.createSpan = exports.MetricsRegistry = exports.metrics = exports.flushTrackEvents = exports.track = exports.message = exports.configureLogging = exports.startSpan = exports.logError = exports.logEvent = exports.log = exports.createExecutionContext = exports.startExecution = exports.detectIdentityType = exports.identify = void 0;
7
7
  // Identification (smart identify with auto-detection)
8
8
  var identify_1 = require("./identify");
9
9
  Object.defineProperty(exports, "identify", { enumerable: true, get: function () { return identify_1.identify; } });
@@ -26,6 +26,10 @@ Object.defineProperty(exports, "message", { enumerable: true, get: function () {
26
26
  var tracking_1 = require("./tracking");
27
27
  Object.defineProperty(exports, "track", { enumerable: true, get: function () { return tracking_1.track; } });
28
28
  Object.defineProperty(exports, "flushTrackEvents", { enumerable: true, get: function () { return tracking_1.flushTrackEvents; } });
29
+ // Code-first Metrics (dashboard tabs + cards + layout)
30
+ var metrics_1 = require("./metrics");
31
+ Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return metrics_1.metrics; } });
32
+ Object.defineProperty(exports, "MetricsRegistry", { enumerable: true, get: function () { return metrics_1.MetricsRegistry; } });
29
33
  // Span Helpers
30
34
  var helpers_1 = require("./helpers");
31
35
  Object.defineProperty(exports, "createSpan", { enumerable: true, get: function () { return helpers_1.createSpan; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qCAAqC;AACrC,+EAA+E;;;AAE/E,sDAAsD;AACtD,uCAA0D;AAAjD,oGAAA,QAAQ,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AAGrC,0CAA0C;AAC1C,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AAGvB,wCAAwC;AACxC,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAG/B,iBAAiB;AACjB,qCAA0F;AAAjF,8FAAA,GAAG,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,kGAAA,OAAO,OAAA;AAGtE,2BAA2B;AAC3B,uCAAqD;AAA5C,iGAAA,KAAK,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAGhC,eAAe;AACf,qCAAiD;AAAxC,qGAAA,UAAU,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAE7B,8CAA8C;AAC9C,qDAK2B;AAJzB,wHAAA,qBAAqB,OAAA;AACrB,mHAAA,gBAAgB,OAAA;AAChB,uHAAA,oBAAoB,OAAA;AACpB,yGAAA,MAAM,OAAA;AAYR,uDAAuD;AACvD,2CAA0C;AAAjC,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qCAAqC;AACrC,+EAA+E;;;AAE/E,sDAAsD;AACtD,uCAA0D;AAAjD,oGAAA,QAAQ,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AAGrC,0CAA0C;AAC1C,yCAA6C;AAApC,2GAAA,cAAc,OAAA;AAGvB,wCAAwC;AACxC,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA;AAG/B,iBAAiB;AACjB,qCAA0F;AAAjF,8FAAA,GAAG,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,kGAAA,OAAO,OAAA;AAGtE,2BAA2B;AAC3B,uCAAqD;AAA5C,iGAAA,KAAK,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAGhC,uDAAuD;AACvD,qCAAqD;AAA5C,kGAAA,OAAO,OAAA;AAAE,0GAAA,eAAe,OAAA;AAEjC,eAAe;AACf,qCAAiD;AAAxC,qGAAA,UAAU,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAE7B,8CAA8C;AAC9C,qDAK2B;AAJzB,wHAAA,qBAAqB,OAAA;AACrB,mHAAA,gBAAgB,OAAA;AAChB,uHAAA,oBAAoB,OAAA;AACpB,yGAAA,MAAM,OAAA;AAYR,uDAAuD;AACvD,2CAA0C;AAAjC,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * ============================================================================
3
+ * METRICS - Code-first dashboard definitions for Runflow
4
+ * ============================================================================
5
+ *
6
+ * Lets agent code declare its own dashboard tabs and cards, then sync them
7
+ * to the platform with `runflow.metrics.sync()` (or auto-sync on first
8
+ * `track()`). Mirrors the same API surface used by the CLI `rf metrics
9
+ * sync` command — same canonical shape, same idempotency.
10
+ *
11
+ * Quick example:
12
+ *
13
+ * import { metrics } from '@runflow-ai/sdk/observability';
14
+ *
15
+ * metrics.defineTab({ name: 'Vendas' });
16
+ * metrics.defineCard({
17
+ * tab: 'Vendas',
18
+ * title: 'Funil de checkout',
19
+ * cardType: 'funnel',
20
+ * config: {
21
+ * funnelMode: 'multi_event',
22
+ * steps: [
23
+ * { eventName: 'cart_open', label: 'Carrinho aberto' },
24
+ * { eventName: 'checkout_started', label: 'Início checkout' },
25
+ * { eventName: 'sale', label: 'Pagamento' },
26
+ * ],
27
+ * },
28
+ * gridLayout: { x: 0, y: 0, w: 6, h: 5 },
29
+ * });
30
+ *
31
+ * await metrics.sync(); // POSTs to /api/v1/runtime/observability/...
32
+ *
33
+ * Validation happens at registration time using the shared zod schemas, so
34
+ * shape mistakes are caught before deploy. The registry is process-wide
35
+ * (mirrors how `track()` and `identify()` are stored).
36
+ */
37
+ import { type CardType, type DashboardCardConfig, type GridLayoutItem, type DefineCardInput, type DefineTabInput } from "../_runflow-shared";
38
+ interface RegisteredTab {
39
+ name: string;
40
+ sortOrder?: number;
41
+ }
42
+ interface RegisteredCard {
43
+ title: string;
44
+ cardType: CardType;
45
+ config: DashboardCardConfig;
46
+ /** Tab name — resolved to tabId at sync time. */
47
+ tab?: string;
48
+ gridLayout?: GridLayoutItem;
49
+ sortOrder?: number;
50
+ }
51
+ interface SyncResult {
52
+ agentId: string;
53
+ tabs: {
54
+ created: number;
55
+ updated: number;
56
+ total: number;
57
+ };
58
+ cards: {
59
+ created: number;
60
+ updated: number;
61
+ failed: number;
62
+ total: number;
63
+ };
64
+ }
65
+ interface SyncOptions {
66
+ /** Override the agent id (default: SDK runtime context). */
67
+ agentId?: string;
68
+ /** Override the base URL (default: SDK runtime context). */
69
+ baseUrl?: string;
70
+ /** Override the API key (default: SDK runtime context). */
71
+ apiKey?: string;
72
+ /** Throw on any validation/network error instead of returning a tally. */
73
+ strict?: boolean;
74
+ }
75
+ export declare class MetricsRegistry {
76
+ private tabs;
77
+ /** key = `${cardType}:${title}` — same dedup as the CLI uses. */
78
+ private cards;
79
+ /**
80
+ * Register a dashboard tab. Idempotent on `name`. Re-registering with the
81
+ * same name updates `sortOrder`.
82
+ */
83
+ defineTab(input: DefineTabInput): RegisteredTab;
84
+ /**
85
+ * Register a dashboard card. Throws (synchronously) if the config doesn't
86
+ * match the shape required by the chosen cardType. Legacy aliases are
87
+ * auto-normalized before validation.
88
+ */
89
+ defineCard<T extends CardType>(input: DefineCardInput<T>): RegisteredCard;
90
+ /** Inspect what's currently registered. Read-only. */
91
+ list(): {
92
+ tabs: RegisteredTab[];
93
+ cards: RegisteredCard[];
94
+ };
95
+ /** Drop everything. Mostly useful in tests. */
96
+ reset(): void;
97
+ /**
98
+ * Push the registered tabs and cards to the Runflow platform.
99
+ *
100
+ * Two-phase: upsert tabs first (matching by name → tabId), then upsert
101
+ * cards with their resolved tabId. Talks to the runtime endpoints used
102
+ * by the CLI:
103
+ *
104
+ * POST /api/v1/runtime/observability/dashboard-tabs (tabs)
105
+ * POST /api/v1/runtime/observability/dashboard-cards (cards)
106
+ *
107
+ * Per-card idempotency key = `hash(cardType + title + tab?)`. On the
108
+ * server, table/funnel/gauge cards (no eventName at root) dedupe via the
109
+ * idempotency key; KPI-shaped cards continue using the (event_name,
110
+ * card_type, aggregation, property_key) unique index.
111
+ */
112
+ sync(options?: SyncOptions): Promise<SyncResult>;
113
+ }
114
+ /**
115
+ * Process-wide metrics registry. `import { metrics }` returns the same
116
+ * instance every time, so it can be safely required from multiple modules.
117
+ */
118
+ export declare const metrics: MetricsRegistry;
119
+ export {};
120
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/observability/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAMzB,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iDAAiD;IAC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