@rivus/agent 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,18 @@ declare class InvalidRivusPlugin extends Error {
79
79
  readonly name = "InvalidRivusPlugin";
80
80
  }
81
81
  //#endregion
82
+ //#region src/core/application/automation/presentation/automation-line-chart.d.ts
83
+ interface AutomationLineChart {
84
+ readonly title: string;
85
+ readonly labels: ReadonlyArray<string>;
86
+ readonly unit: string;
87
+ readonly seriesLayout?: "overlay" | "separate";
88
+ readonly series: ReadonlyArray<{
89
+ readonly name: string;
90
+ readonly values: ReadonlyArray<number>;
91
+ }>;
92
+ }
93
+ //#endregion
82
94
  //#region src/core/application/automation/presentation/automation-presentation.d.ts
83
95
  declare const AUTOMATION_PRESENTATION_SCHEMA_VERSION: 1;
84
96
  type AutomationPresentationKind = "daily-ai" | "generic" | "industry" | "news" | "subscriptions";
@@ -97,6 +109,7 @@ interface AutomationPresentationSection {
97
109
  readonly title: string;
98
110
  }
99
111
  interface AutomationPresentation {
112
+ readonly lineChart?: AutomationLineChart;
100
113
  readonly footnote?: string;
101
114
  readonly kind?: AutomationPresentationKind;
102
115
  readonly meta: ReadonlyArray<string>;
@@ -106,6 +119,7 @@ interface AutomationPresentation {
106
119
  readonly title: string;
107
120
  }
108
121
  interface AutomationPresentationInput {
122
+ readonly lineChart?: AutomationLineChart;
109
123
  readonly footnote?: string;
110
124
  readonly kind?: AutomationPresentationKind;
111
125
  readonly meta?: ReadonlyArray<string>;
@@ -8079,6 +8079,42 @@ function createPiSessionRegistry(options) {
8079
8079
  };
8080
8080
  }
8081
8081
  //#endregion
8082
+ //#region src/core/application/automation/presentation/automation-line-chart.ts
8083
+ function readAutomationLineChart(value) {
8084
+ if (!value || typeof value !== "object") throw new Error("Automation line chart must be an object");
8085
+ const chart = value;
8086
+ if (chart.seriesLayout !== void 0 && chart.seriesLayout !== "overlay" && chart.seriesLayout !== "separate") throw new Error("Automation line chart seriesLayout must be overlay or separate");
8087
+ const text = (value, limit) => {
8088
+ if (typeof value !== "string" || !value.trim() || value.length > limit) throw new Error("Automation line chart text is empty or exceeds its limit");
8089
+ return value.trim();
8090
+ };
8091
+ if (!Array.isArray(chart.labels) || chart.labels.length < 2 || chart.labels.length > 60) throw new Error("Automation line chart requires 2 to 60 labels");
8092
+ const labels = Array.from(chart.labels, (label) => text(label, 64));
8093
+ if (new Set(labels).size !== labels.length) throw new Error("Automation line chart labels must be unique");
8094
+ if (!Array.isArray(chart.series) || chart.series.length < 1 || chart.series.length > 6) throw new Error("Automation line chart requires 1 to 6 series");
8095
+ const series = Array.from(chart.series, (value) => {
8096
+ if (!value || typeof value !== "object") throw new Error("Automation line chart series must be an object");
8097
+ const row = value;
8098
+ if (!Array.isArray(row.values) || row.values.length !== labels.length) throw new Error("Automation line chart series must align with every label");
8099
+ const values = Array.from(row.values, (value) => {
8100
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new Error("Automation line chart values must be finite numbers");
8101
+ return value;
8102
+ });
8103
+ return Object.freeze({
8104
+ name: text(row.name, 80),
8105
+ values: Object.freeze(values)
8106
+ });
8107
+ });
8108
+ if (new Set(series.map(({ name }) => name)).size !== series.length) throw new Error("Automation line chart series names must be unique");
8109
+ return Object.freeze({
8110
+ title: text(chart.title, 120),
8111
+ labels: Object.freeze(labels),
8112
+ unit: text(chart.unit, 80),
8113
+ ...chart.seriesLayout === void 0 ? {} : { seriesLayout: chart.seriesLayout },
8114
+ series: Object.freeze(series)
8115
+ });
8116
+ }
8117
+ //#endregion
8082
8118
  //#region src/core/application/automation/presentation/automation-presentation.ts
8083
8119
  const AUTOMATION_PRESENTATION_SCHEMA_VERSION = 1;
8084
8120
  var InvalidAutomationPresentation = class extends Error {
@@ -8107,6 +8143,7 @@ function createAutomationPresentation(input) {
8107
8143
  });
8108
8144
  });
8109
8145
  return Object.freeze({
8146
+ ...input.lineChart === void 0 ? {} : { lineChart: readAutomationLineChart(input.lineChart) },
8110
8147
  ...input.footnote ? { footnote: requiredText(input.footnote, "footnote", 240) } : {},
8111
8148
  ...input.kind === void 0 ? {} : { kind: input.kind },
8112
8149
  meta: Object.freeze(meta),
@@ -8142,6 +8179,7 @@ function readAutomationPresentation(value) {
8142
8179
  };
8143
8180
  });
8144
8181
  return createAutomationPresentation({
8182
+ ...record.lineChart === void 0 ? {} : { lineChart: readAutomationLineChart(record.lineChart) },
8145
8183
  ...record.footnote === void 0 ? {} : { footnote: stringValue(record.footnote, "Automation presentation footnote") },
8146
8184
  meta,
8147
8185
  ...record.kind === void 0 ? {} : { kind: automationPresentationKind(record.kind) },
@@ -14573,6 +14611,39 @@ function createRoutedHumanInteractionToolApprovalService(registry) {
14573
14611
  } };
14574
14612
  }
14575
14613
  //#endregion
14614
+ //#region src/adapters/feishu/automation/automation-line-chart-renderer.ts
14615
+ function renderAutomationLineCharts(chart) {
14616
+ const separate = chart.seriesLayout === "separate";
14617
+ return (separate ? chart.series.map((series) => [series]) : [chart.series]).map((series) => ({
14618
+ tag: "chart",
14619
+ aspect_ratio: "4:3",
14620
+ color_theme: "complementary",
14621
+ chart_spec: {
14622
+ type: "line",
14623
+ title: {
14624
+ text: separate ? series[0].name : chart.title,
14625
+ subtext: separate ? `${chart.title} · ${chart.unit}` : chart.unit
14626
+ },
14627
+ data: { values: series.flatMap((row) => chart.labels.map((label, index) => ({
14628
+ date: label,
14629
+ value: row.values[index],
14630
+ series: row.name
14631
+ }))) },
14632
+ xField: "date",
14633
+ yField: "value",
14634
+ seriesField: "series",
14635
+ legends: {
14636
+ visible: !separate,
14637
+ orient: "bottom"
14638
+ },
14639
+ axes: [{
14640
+ orient: "left",
14641
+ zero: false
14642
+ }]
14643
+ }
14644
+ }));
14645
+ }
14646
+ //#endregion
14576
14647
  //#region src/adapters/feishu/automation/automation-card-sender.ts
14577
14648
  function createConfiguredFeishuAutomationCardSender(options) {
14578
14649
  const baseUrl = options.config.feishu.baseUrl.replace(/\/$/, "");
@@ -14620,6 +14691,7 @@ function createStructuredAutomationCard(presentation) {
14620
14691
  text_size: "normal"
14621
14692
  });
14622
14693
  }
14694
+ if (presentation.lineChart) elements.push(...renderAutomationLineCharts(presentation.lineChart));
14623
14695
  presentation.sections.forEach((section, index) => {
14624
14696
  if (presentation.summary || index > 0) elements.push({ tag: "hr" });
14625
14697
  elements.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivus/agent",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "A local agent daemon core built around a usable agent harness and domain events.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -93,10 +93,10 @@
93
93
  "@earendil-works/pi-coding-agent": "0.84.4",
94
94
  "@larksuiteoapi/node-sdk": "1.71.1",
95
95
  "@opentelemetry/api": "^1.9.1",
96
- "@opentelemetry/exporter-trace-otlp-proto": "^0.221.0",
97
- "@opentelemetry/resources": "^2.9.0",
98
- "@opentelemetry/sdk-trace-base": "^2.9.0",
99
- "@opentelemetry/sdk-trace-node": "^2.9.0",
96
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.222.0",
97
+ "@opentelemetry/resources": "^2.11.0",
98
+ "@opentelemetry/sdk-trace-base": "^2.11.0",
99
+ "@opentelemetry/sdk-trace-node": "^2.11.0",
100
100
  "axios": "1.18.0",
101
101
  "effect": "^3.21.4",
102
102
  "typebox": "^1.1.38"
@@ -114,7 +114,7 @@
114
114
  "@changesets/cli": "^2.31.1",
115
115
  "@types/node": "24.13.3",
116
116
  "@vitest/coverage-v8": "4.1.10",
117
- "jscpd": "4.2.5",
117
+ "jscpd": "4.3.0",
118
118
  "typescript": "6.0.3",
119
119
  "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
120
120
  "vite-plus": "0.2.4"