@odigos/ui-kit 0.0.304 → 0.0.306

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 (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/chunks/{helpers-YkbGOGt5.js → helpers-Cnnu6nDZ.js} +1 -1
  3. package/lib/chunks/{index-BJ98y5gR.js → index-qLBXdBIN.js} +1 -1
  4. package/lib/chunks/source-instrument-form-context-CB8LQMmT.js +5 -0
  5. package/lib/chunks/ui-components-DRnj62bc.js +2298 -0
  6. package/lib/components/_cards/data-card/index.d.ts +2 -0
  7. package/lib/components.js +1 -1
  8. package/lib/constants/index.d.ts +1 -0
  9. package/lib/constants/insights/index.d.ts +1 -0
  10. package/lib/constants/insights/recommendations.d.ts +78 -0
  11. package/lib/constants/instrumentation-agents/index.d.ts +58 -0
  12. package/lib/constants.js +1 -1
  13. package/lib/containers/_drawers/index.d.ts +1 -0
  14. package/lib/containers/_drawers/instrumentation-agent-drawer/index.d.ts +7 -0
  15. package/lib/containers/_drawers/instrumentation-agent-drawer/offsets.d.ts +7 -0
  16. package/lib/containers/_drawers/instrumentation-agent-drawer/overview.d.ts +6 -0
  17. package/lib/containers/_drawers/instrumentation-agent-drawer/tabs.d.ts +4 -0
  18. package/lib/containers/_forms/insights/learning-policy-form/types.d.ts +1 -1
  19. package/lib/containers/index.d.ts +1 -0
  20. package/lib/containers/insights/consts.d.ts +1 -0
  21. package/lib/containers/insights/recommendations/card-primitives.d.ts +69 -0
  22. package/lib/containers/insights/recommendations/drawer.d.ts +12 -0
  23. package/lib/containers/insights/recommendations/edit-apply-drawer.d.ts +8 -0
  24. package/lib/containers/insights/recommendations/grouped.d.ts +11 -0
  25. package/lib/containers/insights/recommendations/guardrail-card.d.ts +22 -0
  26. package/lib/containers/insights/recommendations/helpers.d.ts +200 -0
  27. package/lib/containers/insights/recommendations/index.d.ts +2 -0
  28. package/lib/containers/insights/recommendations/rule-card.d.ts +11 -0
  29. package/lib/containers/instrumentation-agents/agents-table.d.ts +8 -0
  30. package/lib/containers/instrumentation-agents/helpers.d.ts +4 -0
  31. package/lib/containers/instrumentation-agents/index.d.ts +4 -0
  32. package/lib/containers/instrumentation-agents/types.d.ts +3 -0
  33. package/lib/containers.js +669 -566
  34. package/lib/contexts/odigos-api/capabilities.d.ts +2 -0
  35. package/lib/contexts/odigos-api/hooks/use-insights-api.d.ts +42 -2
  36. package/lib/contexts/odigos-api/hooks/use-instrumentation-agents-api.d.ts +31 -0
  37. package/lib/contexts/odigos-api/types.d.ts +64 -1
  38. package/lib/contexts/odigos-api/use-odigos-api.d.ts +2 -0
  39. package/lib/contexts.js +1 -1
  40. package/lib/functions/agent-supports-offsets/index.d.ts +7 -0
  41. package/lib/functions/get-agent-badge-colors/index.d.ts +8 -0
  42. package/lib/functions/get-containers-counts/index.d.ts +1 -0
  43. package/lib/functions/index.d.ts +2 -0
  44. package/lib/functions.js +1 -1
  45. package/lib/hooks.js +1 -1
  46. package/lib/snippets.js +1 -1
  47. package/lib/store.js +1 -1
  48. package/lib/theme.js +1 -1
  49. package/lib/types/common/index.d.ts +2 -1
  50. package/lib/types/index.d.ts +1 -0
  51. package/lib/types/insights/index.d.ts +296 -5
  52. package/lib/types/instrumentation-agents/index.d.ts +71 -0
  53. package/lib/types.js +1 -1
  54. package/lib/visuals.js +1 -1
  55. package/package.json +1 -1
  56. package/lib/chunks/source-instrument-form-context-RwsR5XPB.js +0 -5
  57. package/lib/chunks/ui-components-CM2SQ_TO.js +0 -2298
@@ -0,0 +1,200 @@
1
+ import type { DefaultTheme } from 'styled-components';
2
+ import type { HoverAction } from '../../../components/hover-actions';
3
+ import { InsightsRecommendationConfidenceLevel, StatusType, type InsightsCorrelationSelector, type InsightsCorrelationSpec, type InsightsRecommendation, type InsightsRecommendationRule, type InsightsTransactionKind } from '../../../types';
4
+ import { type NoDataProps, type TableColumn, type TableRow } from '../../../components';
5
+ export declare enum RecommendationsFilterMode {
6
+ Open = "open",
7
+ Applied = "applied",
8
+ Dismissed = "dismissed"
9
+ }
10
+ export declare enum RecommendationsColumnKeys {
11
+ Confidence = "confidence",
12
+ Recommendation = "recommendation",
13
+ /**
14
+ * What the row covers. Named for the guardrail scope it would extend, not for
15
+ * a transaction: only `attribute_correlation` has one, and a column headed
16
+ * "Transaction" holding the word "Service-wide" contradicts its own header.
17
+ */
18
+ Scope = "scope",
19
+ Evidence = "evidence",
20
+ Tags = "tags"
21
+ }
22
+ export declare const RECOMMENDATIONS_TABLE_COLUMNS: TableColumn[];
23
+ export interface RecommendationCounts {
24
+ total: number;
25
+ open: number;
26
+ applied: number;
27
+ dismissed: number;
28
+ highConfidence: number;
29
+ }
30
+ export declare const getRecommendationCounts: (items: InsightsRecommendation[]) => RecommendationCounts;
31
+ export declare const filterRecommendationsByState: (items: InsightsRecommendation[], filter: RecommendationsFilterMode) => InsightsRecommendation[];
32
+ /**
33
+ * Runs on first render for every row, so it must survive both kinds. `spec` and
34
+ * `operation` belong to `attribute_correlation` and are simply absent on a
35
+ * service card; `rules` is the other way round, and its labels and items are
36
+ * what someone searching for "stripe" or "ledger-service" is actually after.
37
+ */
38
+ export declare const searchRecommendations: (items: InsightsRecommendation[], search: string) => InsightsRecommendation[];
39
+ export declare const isServiceGuardrail: (recommendation: InsightsRecommendation) => boolean;
40
+ export declare const sortRecommendations: (items: InsightsRecommendation[]) => InsightsRecommendation[];
41
+ export declare const CONFIDENCE_STATUS: Record<InsightsRecommendationConfidenceLevel, StatusType>;
42
+ /** "service · span · attr" plus the extract regex when the rule narrows the value. */
43
+ export declare const formatSelector: (selector: InsightsCorrelationSelector) => string;
44
+ /** "<namespace>/<service>", the service every row is scoped under. */
45
+ export declare const formatRecommendationScope: (recommendation: InsightsRecommendation) => string;
46
+ /**
47
+ * What inside that service the row covers: every operation for a service
48
+ * guardrail, one transaction's operation for a correlation. A correlation with
49
+ * no `operation` falls back to its transaction id rather than borrowing the
50
+ * guardrail's "Service-wide", which would be a lie about its blast radius.
51
+ */
52
+ export declare const formatRecommendationScopeDetail: (recommendation: InsightsRecommendation) => string;
53
+ /**
54
+ * `liveSince` / `liveLast` are documented as omitted until the first live check,
55
+ * but the server declares them as Go `time.Time` with `omitempty` — which is a
56
+ * no-op on structs — so it emits the Go zero value `"0001-01-01T00:00:00Z"`
57
+ * instead. Four fields carry the bug: the two on the confidence block and the
58
+ * two on every rule. Every read of them goes through here rather than trusting
59
+ * the field's presence.
60
+ *
61
+ * A ClickHouse left-join miss would surface as the epoch instead, which the
62
+ * repo layer already guards, but both sentinels are rejected here anyway.
63
+ */
64
+ export declare const isLiveTimestamp: (value?: string | null) => value is string;
65
+ /** The timestamp if it is real, `null` for absent, blank, the Go zero time or the epoch. */
66
+ export declare const liveTimestamp: (value?: string | null) => string | null;
67
+ /**
68
+ * Catalog order — the order the engine emits `rules[]` in and the order the UI
69
+ * renders them. Rules the service already enforces (or switched off) are left
70
+ * out by the engine, so a card commonly carries fewer than four.
71
+ */
72
+ export declare const RECOMMENDATION_RULE_ORDER: string[];
73
+ /**
74
+ * The server sends `label` and `description` on every rule, so these are only a
75
+ * fallback for a rule that arrives without them. `rule` is an open string on
76
+ * the wire, so an unknown key falls back to itself rather than rendering blank.
77
+ */
78
+ export declare const RULE_KEY_LABEL: Record<string, string>;
79
+ export declare const RULE_KEY_DESCRIPTION: Record<string, string>;
80
+ export declare const getRuleLabel: (rule: InsightsRecommendationRule) => string;
81
+ export declare const getRuleDescription: (rule: InsightsRecommendationRule) => string;
82
+ /** Defensive: the engine already emits catalog order, unknown keys keep their relative place at the end. */
83
+ export declare const sortRecommendationRules: (rules: InsightsRecommendationRule[]) => InsightsRecommendationRule[];
84
+ /**
85
+ * `allowed_transactions` items are `"<KIND>\toperation"` — a real TAB, matched
86
+ * exactly and case-sensitively at enforcement. Splitting on a space would be
87
+ * wrong: operations contain spaces ("GET /accounts"). Every other rule's items
88
+ * are plain strings and come back with no kind.
89
+ */
90
+ export declare const splitRuleItem: (item: string) => {
91
+ kind?: string;
92
+ value: string;
93
+ };
94
+ /** One-line rendering of an item — the tab becomes a space, never a literal tab. */
95
+ export declare const formatRuleItem: (item: string) => string;
96
+ /**
97
+ * What live traffic has said about one rule while the card sat open. `liveChecked === 0`
98
+ * is the "never shadow-checked" case — the same state the zero timestamps mark.
99
+ */
100
+ export declare const formatRuleLive: (rule: InsightsRecommendationRule) => {
101
+ text: string;
102
+ violated: boolean;
103
+ };
104
+ /** `${label} (${count})`-style coverage line, mirroring the server's own summary. */
105
+ export declare const formatRuleCoverage: (rules: InsightsRecommendationRule[]) => string;
106
+ /**
107
+ * The evidence summary for a row, per kind — the two kinds count different
108
+ * things under the same keys and must not borrow each other's wording.
109
+ *
110
+ * `attribute_correlation`: the stored-sample hit rate plus what live traffic
111
+ * has said since; a relation live traffic already broke is the one case where
112
+ * applying fires violations immediately, so it is called out.
113
+ *
114
+ * `service_guardrail`: `sampleCount` is promoted transactions, not samples, and
115
+ * the live counters sum **rule-checks** across up to four rules — one trace can
116
+ * contribute several — so they are never labelled "traces" here.
117
+ */
118
+ export declare const formatEvidence: (recommendation: InsightsRecommendation) => {
119
+ samples: string;
120
+ live: string;
121
+ liveBroken: boolean;
122
+ };
123
+ export declare const getTableRowsForRecommendations: (theme: DefaultTheme, recommendations: InsightsRecommendation[], onRowClick?: (recommendation: InsightsRecommendation) => void, selected?: InsightsRecommendation[], toggleSelection?: (recommendation: InsightsRecommendation, isSelected: boolean) => void) => TableRow[];
124
+ export interface RecommendationRowActionHandlers {
125
+ onApply: (recommendation: InsightsRecommendation) => void;
126
+ onEdit: (recommendation: InsightsRecommendation) => void;
127
+ onDismiss: (recommendation: InsightsRecommendation) => void;
128
+ onRestore: (recommendation: InsightsRecommendation) => void;
129
+ onRevert: (recommendation: InsightsRecommendation) => void;
130
+ }
131
+ /** Actions follow the row's state: an applied row can only be reverted, a dismissed one restored. */
132
+ export declare const getRecommendationRowActions: (row: TableRow, recommendations: InsightsRecommendation[], handlers: RecommendationRowActionHandlers) => HoverAction[];
133
+ /**
134
+ * The empty state does triple duty, and the error case matters most: an older
135
+ * odigos-insights build has no /api/v1/recommendations route and answers 404,
136
+ * which would otherwise read as "you simply have none". Surface the service's
137
+ * own message so the cause is visible rather than guessed at.
138
+ */
139
+ export declare const getNoDataProps: ({ error, search, hasAny }: {
140
+ error?: Error;
141
+ search: string;
142
+ hasAny: boolean;
143
+ }) => NoDataProps;
144
+ /** How many rules of one transaction render before the rest fold away. */
145
+ export declare const RULES_SHOWN_PER_TRANSACTION = 5;
146
+ export interface RecommendationTxnGroup {
147
+ transactionId: string;
148
+ operation: string;
149
+ /** Absent only if a correlation ever arrives without its transaction kind. */
150
+ kind?: InsightsTransactionKind | null;
151
+ items: InsightsRecommendation[];
152
+ highCount: number;
153
+ }
154
+ export interface RecommendationServiceCard {
155
+ key: string;
156
+ namespace: string;
157
+ service: string;
158
+ /**
159
+ * The service's own `service_guardrail` recommendation, rendered above the
160
+ * transaction groups. At most one per service per lifecycle state — the id is
161
+ * derived from `namespace/service`, so a service can never have two.
162
+ */
163
+ guardrail?: InsightsRecommendation;
164
+ transactions: RecommendationTxnGroup[];
165
+ count: number;
166
+ highCount: number;
167
+ }
168
+ /**
169
+ * Mirrors buildRecommendationCards in the insights debug UI: services ordered
170
+ * by how much is waiting and how confident the engine is, transactions in the
171
+ * order they were seen, and rules by the engine's own rank.
172
+ */
173
+ export declare const buildRecommendationCards: (items: InsightsRecommendation[]) => RecommendationServiceCard[];
174
+ export declare enum RuleColumnKeys {
175
+ Rule = "rule",
176
+ Confidence = "confidence",
177
+ Tags = "tags"
178
+ }
179
+ /** Columns for the rules inside a transaction — no service/transaction column, the group says it. */
180
+ export declare const RULE_TABLE_COLUMNS: TableColumn[];
181
+ export declare const getTableRowsForRules: (theme: DefaultTheme, recommendations: InsightsRecommendation[], onRowClick: (recommendation: InsightsRecommendation) => void, selected: InsightsRecommendation[], toggleSelection: (recommendation: InsightsRecommendation, isSelected: boolean) => void) => TableRow[];
182
+ /**
183
+ * The heading of the consequence block — what "broken" means for this relation.
184
+ * Correlation-only: a service guardrail has no spec, so callers pass `null` and
185
+ * get the allowlist wording instead.
186
+ */
187
+ export declare const formatBreakCondition: (spec?: InsightsCorrelationSpec | null) => "If anything falls outside the lists" | "If they differ" | "If they match";
188
+ /**
189
+ * What a violation would mean. Mirrors the two consequences `relationWhy` writes
190
+ * in the engine, rather than parsing them back out of the generated `spec.why`.
191
+ */
192
+ export declare const formatConsequence: (recommendation: InsightsRecommendation) => string;
193
+ export declare const CONFIDENCE_LABEL: Record<InsightsRecommendationConfidenceLevel, string>;
194
+ /** `transform` is an open string on the wire, so unknown kinds fall back to themselves. */
195
+ export declare const TRANSFORM_LABEL: Record<string, string>;
196
+ export interface EvidenceLine {
197
+ text: string;
198
+ ok: boolean;
199
+ }
200
+ export declare const getEvidenceLines: (recommendation: InsightsRecommendation) => EvidenceLine[];
@@ -0,0 +1,2 @@
1
+ import { type FC } from 'react';
2
+ export declare const Recommendations: FC;
@@ -0,0 +1,11 @@
1
+ import { type FC } from 'react';
2
+ import { type InsightsRecommendation } from '../../../types';
3
+ export interface RuleCardProps {
4
+ recommendation: InsightsRecommendation;
5
+ onApply: (recommendation: InsightsRecommendation) => void;
6
+ onEdit: (recommendation: InsightsRecommendation) => void;
7
+ onDismiss: (recommendation: InsightsRecommendation) => void;
8
+ onRestore: (recommendation: InsightsRecommendation) => void;
9
+ onRevert: (recommendation: InsightsRecommendation) => void;
10
+ }
11
+ export declare const RuleCard: FC<RuleCardProps>;
@@ -0,0 +1,8 @@
1
+ import { type FC } from 'react';
2
+ import type { InstrumentationAgent } from '../../types';
3
+ export interface AgentsTableProps {
4
+ agents: InstrumentationAgent[];
5
+ isLoading: boolean;
6
+ onAgentClick?: (agent: InstrumentationAgent) => void;
7
+ }
8
+ export declare const AgentsTable: FC<AgentsTableProps>;
@@ -0,0 +1,4 @@
1
+ import type { InstrumentationAgent } from '../../types';
2
+ /** Sources holding at least one container of this language. */
3
+ export declare const getAgentSourcesLabel: (sources: number) => string;
4
+ export declare const filterAgentsBySearch: (agents: InstrumentationAgent[], search: string) => InstrumentationAgent[];
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import type { InstrumentationAgentsProps } from './types';
3
+ export * from './types';
4
+ export declare const InstrumentationAgents: FC<InstrumentationAgentsProps>;
@@ -0,0 +1,3 @@
1
+ export interface InstrumentationAgentsProps {
2
+ docsUrl?: string;
3
+ }