@datalayer/agent-runtimes 1.6.28 → 1.6.30

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.
@@ -34,8 +34,9 @@ export declare const DEFAULT_EMOJI = "\uD83D\uDC40";
34
34
  export declare const APP_KINDS: AppKind[];
35
35
  export declare const APP_ACCENTS: AppAccent[];
36
36
  /**
37
- * The themes an application may run in: Appearance's, as
38
- * primer-addons lists them (`themeVariants`), in its order.
37
+ * The themes an application may run in: the Appspec's (`ThemeVariant` in
38
+ * agentspecs), each one of Appearance's as primer-addons lists them
39
+ * (`themeVariants`).
39
40
  */
40
41
  export declare const APP_THEME_VARIANTS: AppThemeVariant[];
41
42
  /** The colour modes a theme is worn in. */
@@ -23,8 +23,9 @@ export const APP_ACCENTS = [
23
23
  'violet',
24
24
  ];
25
25
  /**
26
- * The themes an application may run in: Appearance's, as
27
- * primer-addons lists them (`themeVariants`), in its order.
26
+ * The themes an application may run in: the Appspec's (`ThemeVariant` in
27
+ * agentspecs), each one of Appearance's as primer-addons lists them
28
+ * (`themeVariants`).
28
29
  */
29
30
  export const APP_THEME_VARIANTS = [
30
31
  'datalayer',
@@ -98,7 +98,7 @@ export { useToolApprovals, useToolApprovalsQuery, usePendingApprovalCount, useAp
98
98
  export { useNotifications, useFilteredNotifications, useUnreadNotificationCount, useMarkNotificationRead, useMarkAllNotificationsRead, useAllAgentEvents, useAgentEvents, useAgentEvent, useCreateAgentEvent, useUpdateAgentEvent, useDeleteAgentEvent, useMarkEventRead, useMarkEventUnread, } from './useNotifications';
99
99
  export { useAIAgentsWebSocket, type UseAIAgentsWebSocketOptions, type UseAIAgentsWebSocketResult, type AIAgentsWebSocketCloseInfo, type AIAgentsWebSocketConnectionState, } from './useAIAgentsWebSocket';
100
100
  export { useProjects, useProject, useUpdateProject, useDeleteProject, useRefreshProjects, useProjectDefaultItems, type ProjectData, } from './useProjects';
101
- export { useOtelTotalTokens, fetchOtelTotalTokens, fetchOtelMetricTotal, fetchOtelMetricRows, toMetricValue, } from './useMonitoring';
101
+ export { fetchOtelMetricRows, toMetricValue } from './useMonitoring';
102
102
  export { useProgressStore, type ProgressState } from './useProgressStore';
103
103
  export { useProgressTask } from './useProgressTask';
104
104
  export * from '@datalayer/core/lib/hooks';
@@ -123,7 +123,7 @@ export { useToolApprovals, useToolApprovalsQuery, usePendingApprovalCount, useAp
123
123
  export { useNotifications, useFilteredNotifications, useUnreadNotificationCount, useMarkNotificationRead, useMarkAllNotificationsRead, useAllAgentEvents, useAgentEvents, useAgentEvent, useCreateAgentEvent, useUpdateAgentEvent, useDeleteAgentEvent, useMarkEventRead, useMarkEventUnread, } from './useNotifications.js';
124
124
  export { useAIAgentsWebSocket, } from './useAIAgentsWebSocket.js';
125
125
  export { useProjects, useProject, useUpdateProject, useDeleteProject, useRefreshProjects, useProjectDefaultItems, } from './useProjects.js';
126
- export { useOtelTotalTokens, fetchOtelTotalTokens, fetchOtelMetricTotal, fetchOtelMetricRows, toMetricValue, } from './useMonitoring.js';
126
+ export { fetchOtelMetricRows, toMetricValue } from './useMonitoring.js';
127
127
  // Global top progress bar: a single shared store + a convenience hook so any
128
128
  // view can drive the one app-wide progress bar.
129
129
  export { useProgressStore } from './useProgressStore.js';
@@ -13,14 +13,4 @@ interface MetricValueRow {
13
13
  }
14
14
  export declare function toMetricValue(row: MetricValueRow): number;
15
15
  export declare function fetchOtelMetricRows({ metric, serviceName, otelUrl, apiKey, limit, accountUid, }: OtelQueryOptions): Promise<MetricValueRow[]>;
16
- export declare function fetchOtelMetricTotal(options: OtelQueryOptions): Promise<number>;
17
- export interface OtelTotalTokensOptions {
18
- serviceName?: string;
19
- otelUrl?: string;
20
- apiKey?: string;
21
- limit?: number;
22
- accountUid?: string;
23
- }
24
- export declare function fetchOtelTotalTokens({ serviceName, otelUrl, apiKey, limit, accountUid, }: OtelTotalTokensOptions): Promise<number>;
25
- export declare function useOtelTotalTokens({ serviceName, otelUrl, apiKey, limit, accountUid, }: OtelTotalTokensOptions): string;
26
16
  export {};
@@ -3,11 +3,15 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * Agent monitoring hooks.
6
+ * Agent monitoring: metric rows read from the OTEL service, for the charts.
7
+ *
8
+ * A total of tokens is not read here: listing the latest points of a running
9
+ * total and adding them up is neither bounded in time nor a total. It is the
10
+ * OTEL service's token route (`GET /api/otel/v1/metrics/tokens`), which
11
+ * reads each counter's increase over a window, per service.
7
12
  *
8
13
  * @module hooks/useMonitoring
9
14
  */
10
- import { useEffect, useState } from 'react';
11
15
  import { createOtelClient } from '@datalayer/core/lib/otel/index.js';
12
16
  export function toMetricValue(row) {
13
17
  const candidates = [row.value_double, row.value_int, row.value];
@@ -48,73 +52,3 @@ export async function fetchOtelMetricRows({ metric, serviceName, otelUrl, apiKey
48
52
  });
49
53
  return fallback.data;
50
54
  }
51
- export async function fetchOtelMetricTotal(options) {
52
- const rows = await fetchOtelMetricRows(options);
53
- return rows.reduce((sum, row) => sum + toMetricValue(row), 0);
54
- }
55
- export async function fetchOtelTotalTokens({ serviceName, otelUrl, apiKey, limit = 500, accountUid, }) {
56
- const total = await fetchOtelMetricTotal({
57
- metric: 'agent_runtimes.prompt.turn.total_tokens',
58
- serviceName,
59
- otelUrl,
60
- apiKey,
61
- limit,
62
- accountUid,
63
- });
64
- if (total > 0) {
65
- return total;
66
- }
67
- const prompt = await fetchOtelMetricTotal({
68
- metric: 'agent_runtimes.prompt.turn.prompt_tokens',
69
- serviceName,
70
- otelUrl,
71
- apiKey,
72
- limit,
73
- accountUid,
74
- });
75
- const completion = await fetchOtelMetricTotal({
76
- metric: 'agent_runtimes.prompt.turn.completion_tokens',
77
- serviceName,
78
- otelUrl,
79
- apiKey,
80
- limit,
81
- accountUid,
82
- });
83
- return prompt + completion;
84
- }
85
- export function useOtelTotalTokens({ serviceName, otelUrl, apiKey, limit = 500, accountUid, }) {
86
- const [tokensLabel, setTokensLabel] = useState('-');
87
- useEffect(() => {
88
- let cancelled = false;
89
- const load = async () => {
90
- try {
91
- const total = await fetchOtelTotalTokens({
92
- serviceName,
93
- otelUrl,
94
- apiKey,
95
- limit,
96
- accountUid,
97
- });
98
- if (cancelled) {
99
- return;
100
- }
101
- if (total > 0) {
102
- setTokensLabel(Math.round(total).toLocaleString());
103
- }
104
- else {
105
- setTokensLabel('-');
106
- }
107
- }
108
- catch {
109
- if (!cancelled) {
110
- setTokensLabel('-');
111
- }
112
- }
113
- };
114
- load();
115
- return () => {
116
- cancelled = true;
117
- };
118
- }, [apiKey, limit, otelUrl, serviceName, accountUid]);
119
- return tokensLabel;
120
- }
@@ -1,4 +1,4 @@
1
1
  export declare const PAP_PLUGIN = "agent-runtimes.protocols.pap";
2
2
  /** The PAP draft the SDK implements (its `PROTOCOL_PROFILE`; Python reads it from the SDK). */
3
- export declare const PAP_PROTOCOL_PROFILE = "0.3";
3
+ export declare const PAP_PROTOCOL_PROFILE = "0.4";
4
4
  export declare const PapPlugin: import("@datalayer/reactor").ReactorPlugin<Record<string, never>, unknown, unknown>;
@@ -18,7 +18,7 @@ import { contribution, definePlugin } from '@datalayer/reactor';
18
18
  import { DEFAULT_ORDER, ProtocolDescriptions } from '../core.js';
19
19
  export const PAP_PLUGIN = 'agent-runtimes.protocols.pap';
20
20
  /** The PAP draft the SDK implements (its `PROTOCOL_PROFILE`; Python reads it from the SDK). */
21
- export const PAP_PROTOCOL_PROFILE = '0.3';
21
+ export const PAP_PROTOCOL_PROFILE = '0.4';
22
22
  export const PapPlugin = definePlugin({
23
23
  name: PAP_PLUGIN,
24
24
  version: '1.0.0',
@@ -32,7 +32,7 @@ export const PapPlugin = definePlugin({
32
32
  version: PAP_PROTOCOL_PROFILE,
33
33
  roles: ['personal-agent', 'company'],
34
34
  status: 'implemented',
35
- specification: 'https://personalagentprotocol.org/docs/0.2/spec',
35
+ specification: 'https://personalagentprotocol.org/docs/0.4/spec',
36
36
  plugin: PAP_PLUGIN,
37
37
  catalogue: 'pap',
38
38
  points: [],
@@ -1036,6 +1036,7 @@ export const APP_BEHAVIOURS = {
1036
1036
  'odoo-accounting.odoo_accounting_update_vendor_payment': 'leave_to_me',
1037
1037
  'odoo-accounting.odoo_accounting_vat_close_check': 'do_it',
1038
1038
  },
1039
+ 'aws-steward-agent': {},
1039
1040
  'bookkeeping-desk': {},
1040
1041
  'change-detection': {
1041
1042
  'earthdata.download_earth_data_granules': 'leave_to_me',
@@ -1400,7 +1401,6 @@ export const APP_BEHAVIOURS = {
1400
1401
  'shopping-desk': {},
1401
1402
  'sign-in-desk': {},
1402
1403
  'signed-reader': {},
1403
- 'steward-aws': {},
1404
1404
  'supplier-comparison': {},
1405
1405
  'support-desk': {},
1406
1406
  'travel-desk': {},
@@ -1418,6 +1418,7 @@ export const APP_BEHAVIOURS = {
1418
1418
  */
1419
1419
  export const APP_ESCALATIONS = {
1420
1420
  accounting: {},
1421
+ 'aws-steward-agent': {},
1421
1422
  'bookkeeping-desk': {},
1422
1423
  'change-detection': {},
1423
1424
  'code-explainer': {},
@@ -1483,7 +1484,6 @@ export const APP_ESCALATIONS = {
1483
1484
  'shopping-desk': {},
1484
1485
  'sign-in-desk': {},
1485
1486
  'signed-reader': {},
1486
- 'steward-aws': {},
1487
1487
  'supplier-comparison': {},
1488
1488
  'support-desk': {},
1489
1489
  'travel-desk': {},
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import type { AppBuilt, AppKind, AppSpec } from '../types/agentspecs';
11
11
  export declare const ACCOUNTING_APP_0_0_2: AppSpec;
12
+ export declare const AWS_STEWARD_AGENT_APP_0_0_1: AppSpec;
12
13
  export declare const BOOKKEEPING_DESK_APP_0_0_3: AppSpec;
13
14
  export declare const CHANGE_DETECTION_APP_0_0_2: AppSpec;
14
15
  export declare const CODE_EXPLAINER_APP_0_0_1: AppSpec;
@@ -41,7 +42,6 @@ export declare const SHOP_CONCIERGE_APP_0_0_2: AppSpec;
41
42
  export declare const SHOPPING_DESK_APP_0_0_2: AppSpec;
42
43
  export declare const SIGN_IN_DESK_APP_0_0_2: AppSpec;
43
44
  export declare const SIGNED_READER_APP_0_0_2: AppSpec;
44
- export declare const STEWARD_AWS_APP_0_0_1: AppSpec;
45
45
  export declare const SUPPLIER_COMPARISON_APP_0_0_3: AppSpec;
46
46
  export declare const SUPPORT_DESK_APP_0_0_5: AppSpec;
47
47
  export declare const TRAVEL_DESK_APP_0_0_2: AppSpec;