@runflow-ai/sdk 1.1.9 → 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.
Files changed (36) hide show
  1. package/dist/_runflow-shared/constants/index.d.ts +1 -0
  2. package/dist/_runflow-shared/constants/index.js +2 -0
  3. package/dist/_runflow-shared/index.d.ts +3 -0
  4. package/dist/_runflow-shared/index.js +21 -0
  5. package/dist/_runflow-shared/types/dashboard-cards.d.ts +226 -0
  6. package/dist/_runflow-shared/types/dashboard-cards.js +62 -0
  7. package/dist/_runflow-shared/types/dashboard-cards.normalize.d.ts +38 -0
  8. package/dist/_runflow-shared/types/dashboard-cards.normalize.js +152 -0
  9. package/dist/_runflow-shared/types/dashboard-cards.zod.d.ts +1894 -0
  10. package/dist/_runflow-shared/types/dashboard-cards.zod.js +321 -0
  11. package/dist/_runflow-shared/types/index.d.ts +3 -0
  12. package/dist/_runflow-shared/types/index.js +19 -0
  13. package/dist/_runflow-shared/utils/index.d.ts +1 -0
  14. package/dist/_runflow-shared/utils/index.js +2 -0
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +5 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/observability/index.d.ts +3 -2
  20. package/dist/observability/index.d.ts.map +1 -1
  21. package/dist/observability/index.js +6 -1
  22. package/dist/observability/index.js.map +1 -1
  23. package/dist/observability/logging.d.ts +35 -0
  24. package/dist/observability/logging.d.ts.map +1 -1
  25. package/dist/observability/logging.js +61 -0
  26. package/dist/observability/logging.js.map +1 -1
  27. package/dist/observability/metrics.d.ts +120 -0
  28. package/dist/observability/metrics.d.ts.map +1 -0
  29. package/dist/observability/metrics.js +279 -0
  30. package/dist/observability/metrics.js.map +1 -0
  31. package/dist/observability/trace-collector.d.ts.map +1 -1
  32. package/dist/observability/trace-collector.js +2 -0
  33. package/dist/observability/trace-collector.js.map +1 -1
  34. package/dist/types/all-types.d.ts +1 -1
  35. package/dist/types/all-types.d.ts.map +1 -1
  36. package/package.json +7 -3
@@ -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,8 +7,8 @@ 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, createSpan, withSpan, track, flushTrackEvents, } from "./observability";
11
- export type { IdentifyConfig, ExecutionConfig, ExecutionController, ExecutionContextConfig, ExecutionContextEndOptions, LogData, LogOptions, SpanHandle, LoggingConfig, TrackOptions, } from "./observability";
10
+ export { identify, detectIdentityType, startExecution, createExecutionContext, log, logEvent, logError, startSpan, configureLogging, message, createSpan, withSpan, track, flushTrackEvents, metrics, MetricsRegistry, } from "./observability";
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";
14
14
  export { createBrowserTool, BrowserSession, login, fillForm, clickButton, waitAndClick, extractTable, extractText, downloadFile, screenshotPage, waitForResponse, } from './rpa';
@@ -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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,SAAS,CAAC;AAC5C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,SAAS,GACV,MAAM,SAAS,CAAC;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.fillForm = exports.login = exports.BrowserSession = exports.createBrowserTool = exports.traced = exports.createTraceCollector = exports.RunflowTraceSpan = exports.RunflowTraceCollector = exports.flushTrackEvents = exports.track = exports.withSpan = exports.createSpan = 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 = 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; } });
@@ -58,10 +58,13 @@ Object.defineProperty(exports, "logEvent", { enumerable: true, get: function ()
58
58
  Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return observability_1.logError; } });
59
59
  Object.defineProperty(exports, "startSpan", { enumerable: true, get: function () { return observability_1.startSpan; } });
60
60
  Object.defineProperty(exports, "configureLogging", { enumerable: true, get: function () { return observability_1.configureLogging; } });
61
+ Object.defineProperty(exports, "message", { enumerable: true, get: function () { return observability_1.message; } });
61
62
  Object.defineProperty(exports, "createSpan", { enumerable: true, get: function () { return observability_1.createSpan; } });
62
63
  Object.defineProperty(exports, "withSpan", { enumerable: true, get: function () { return observability_1.withSpan; } });
63
64
  Object.defineProperty(exports, "track", { enumerable: true, get: function () { return observability_1.track; } });
64
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; } });
65
68
  // Observability (advanced tracing)
66
69
  var observability_2 = require("./observability");
67
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,+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GZ,iCAAiC;AACjC,iCAA4C;AAAnC,mGAAA,UAAU,OAAA;AAAE,8FAAA,KAAK,OAAA;AAoB1B,8BAA8B;AAC9B,uEAA4E;AAAnE,wHAAA,qBAAqB,OAAA;AAE9B,oCAAoC;AACpC,+EAA4E;AAAnE,0HAAA,kBAAkB,OAAA;AAE3B,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E,iBAAiB;AACjB,qCAUmB;AATjB,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,kHAAA,uBAAuB,OAAA;AACvB,mHAAA,wBAAwB,OAAA;AACxB,sGAAA,WAAW,OAAA;AACX,yGAAA,cAAc,OAAA;AACd,mHAAA,wBAAwB,OAAA;AACxB,kHAAA,uBAAuB,OAAA;AACvB,oHAAA,yBAAyB,OAAA"}
@@ -4,10 +4,11 @@ export { startExecution } from './execution';
4
4
  export type { ExecutionConfig, ExecutionController } from './execution';
5
5
  export { createExecutionContext } from './execution-context';
6
6
  export type { ExecutionContext, ExecutionContextConfig, ExecutionContextEndOptions } from './execution-context';
7
- export { log, logEvent, logError, startSpan, configureLogging } from './logging';
8
- export type { LogData, LogOptions, SpanHandle, LoggingConfig } from './logging';
7
+ export { log, logEvent, logError, startSpan, configureLogging, message } from './logging';
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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M,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,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGjD,OAAO,EACL,qBAAqB,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.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; } });
@@ -21,10 +21,15 @@ Object.defineProperty(exports, "logEvent", { enumerable: true, get: function ()
21
21
  Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return logging_1.logError; } });
22
22
  Object.defineProperty(exports, "startSpan", { enumerable: true, get: function () { return logging_1.startSpan; } });
23
23
  Object.defineProperty(exports, "configureLogging", { enumerable: true, get: function () { return logging_1.configureLogging; } });
24
+ Object.defineProperty(exports, "message", { enumerable: true, get: function () { return logging_1.message; } });
24
25
  // Business Events Tracking
25
26
  var tracking_1 = require("./tracking");
26
27
  Object.defineProperty(exports, "track", { enumerable: true, get: function () { return tracking_1.track; } });
27
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; } });
28
33
  // Span Helpers
29
34
  var helpers_1 = require("./helpers");
30
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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f,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"}
@@ -24,6 +24,12 @@ export interface SpanHandle {
24
24
  error?: string;
25
25
  }) => void;
26
26
  }
27
+ export interface MessageData {
28
+ role: "user" | "assistant" | "system" | "tool" | string;
29
+ content: string | Record<string, any>;
30
+ metadata?: Record<string, any>;
31
+ parentId?: string;
32
+ }
27
33
  export interface LoggingConfig {
28
34
  onTrace?: (trace: TraceData) => TraceData | null | void;
29
35
  /** PII sanitization for custom logs. Same formats as Agent privacy config. */
@@ -55,6 +61,35 @@ export declare function log(name: string, data?: any, options?: LogOptions): voi
55
61
  * });
56
62
  */
57
63
  export declare function logEvent(name: string, data: LogData, options?: LogOptions): void;
64
+ /**
65
+ * Record a conversation message (user, assistant, system, tool, or any custom role).
66
+ *
67
+ * Emits a `conversation_message` trace that the Runflow portal renders as a chat
68
+ * bubble. Multiple calls per execution are expected (one user inbound, N assistant
69
+ * outbounds, etc.). The portal switches to chat view when an execution has at least
70
+ * one of these traces.
71
+ *
72
+ * @example
73
+ * // text exchange
74
+ * message({ role: 'user', content: 'Quais acomodações?' });
75
+ * message({ role: 'assistant', content: 'Oferecemos duas opções...' });
76
+ *
77
+ * @example
78
+ * // structured content (buttons, audio, image, template)
79
+ * message({
80
+ * role: 'assistant',
81
+ * content: { type: 'buttons', text: 'O que deseja?', items: [...] },
82
+ * });
83
+ *
84
+ * @example
85
+ * // grouped under a span
86
+ * const turn = startSpan('turn');
87
+ * message({ role: 'user', content: text, parentId: turn.traceId });
88
+ * // ...work...
89
+ * message({ role: 'assistant', content: reply, parentId: turn.traceId });
90
+ * turn.end();
91
+ */
92
+ export declare function message(data: MessageData, options?: LogOptions): void;
58
93
  /**
59
94
  * Log an error
60
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/observability/logging.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAkB,SAAS,EAAE,MAAM,UAAU,CAAC;AAOrD,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7D;AA8ED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAmExE;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,UAAU,GACnB,IAAI,CAEN;AAED;;;;;;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AC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7D;AA8ED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAmExE;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,UAAU,GACnB,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CA2CrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,OAAO,CAAC,EAAE,UAAU,GACnB,IAAI,CAuCN;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,UAAU,CAqDZ;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAkB5D"}
@@ -10,6 +10,7 @@
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.log = log;
12
12
  exports.logEvent = logEvent;
13
+ exports.message = message;
13
14
  exports.logError = logError;
14
15
  exports.startSpan = startSpan;
15
16
  exports.configureLogging = configureLogging;
@@ -148,6 +149,66 @@ function log(name, data, options) {
148
149
  function logEvent(name, data, options) {
149
150
  log(name, data, { parentId: options?.parentId || data.parentId });
150
151
  }
152
+ /**
153
+ * Record a conversation message (user, assistant, system, tool, or any custom role).
154
+ *
155
+ * Emits a `conversation_message` trace that the Runflow portal renders as a chat
156
+ * bubble. Multiple calls per execution are expected (one user inbound, N assistant
157
+ * outbounds, etc.). The portal switches to chat view when an execution has at least
158
+ * one of these traces.
159
+ *
160
+ * @example
161
+ * // text exchange
162
+ * message({ role: 'user', content: 'Quais acomodações?' });
163
+ * message({ role: 'assistant', content: 'Oferecemos duas opções...' });
164
+ *
165
+ * @example
166
+ * // structured content (buttons, audio, image, template)
167
+ * message({
168
+ * role: 'assistant',
169
+ * content: { type: 'buttons', text: 'O que deseja?', items: [...] },
170
+ * });
171
+ *
172
+ * @example
173
+ * // grouped under a span
174
+ * const turn = startSpan('turn');
175
+ * message({ role: 'user', content: text, parentId: turn.traceId });
176
+ * // ...work...
177
+ * message({ role: 'assistant', content: reply, parentId: turn.traceId });
178
+ * turn.end();
179
+ */
180
+ function message(data, options) {
181
+ const state = context_1.Runflow.getState();
182
+ const traceCollector = getTraceCollector();
183
+ if (!traceCollector) {
184
+ console.warn("⚠️ TraceCollector not available, message will not be tracked");
185
+ return;
186
+ }
187
+ const executionId = state.executionId || generateExecutionId();
188
+ const parentTraceId = options?.parentId ||
189
+ data.parentId ||
190
+ global.__runflow_current_span_id;
191
+ const span = traceCollector.startSpan("conversation_message", {
192
+ executionId,
193
+ operation: "conversation_message",
194
+ custom: {
195
+ ...(data.metadata || {}),
196
+ role: data.role,
197
+ },
198
+ threadId: state.threadId,
199
+ userId: state.userId,
200
+ sessionId: state.sessionId,
201
+ entityType: state.entityType,
202
+ entityValue: state.entityValue,
203
+ }, parentTraceId);
204
+ // role + content go into output for portal extraction
205
+ span?.setOutput({
206
+ role: data.role,
207
+ content: data.content,
208
+ });
209
+ span?.finish();
210
+ scheduleAutoFlush();
211
+ }
151
212
  /**
152
213
  * Log an error
153
214
  *