@datalayer/agent-runtimes 1.5.95 → 1.5.96

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.
@@ -51,6 +51,13 @@ export type A2ASpansOptions = {
51
51
  };
52
52
  /** The text of an A2A 1.0 message's or artifact's parts, as JSON carries them. */
53
53
  export declare function partsText(parts: unknown): string;
54
+ /** The step a status message carries: a tool call or its end. */
55
+ /**
56
+ * A harness's step as a line says it: *Read README.md*, its kind then its
57
+ * title (the runtime's `{kind, title, status}` in the status message's
58
+ * metadata).
59
+ */
60
+ export declare function harnessStepName(kind: string, title: string): string;
54
61
  /** Whether a message carries a pressed button's action: `metadata.loop.action`. */
55
62
  export declare function pressedAction(message: unknown): boolean;
56
63
  /**
@@ -26,6 +26,26 @@ function rpcOf(body) {
26
26
  }
27
27
  }
28
28
  /** The step a status message carries: a tool call or its end. */
29
+ /**
30
+ * A harness's step as a line says it: *Read README.md*, its kind then its
31
+ * title (the runtime's `{kind, title, status}` in the status message's
32
+ * metadata).
33
+ */
34
+ export function harnessStepName(kind, title) {
35
+ const word = kind.trim() && kind !== 'other' ? kind.trim() : '';
36
+ const named = title.trim();
37
+ const capital = (text) => text.charAt(0).toUpperCase() + text.slice(1);
38
+ if (!word) {
39
+ return named;
40
+ }
41
+ if (!named || named.toLowerCase() === word.toLowerCase()) {
42
+ return capital(word);
43
+ }
44
+ if (named.toLowerCase().startsWith(`${word.toLowerCase()} `)) {
45
+ return capital(named);
46
+ }
47
+ return `${capital(word)} ${named}`;
48
+ }
29
49
  function stepOf(message) {
30
50
  if (!isObject(message) || !Array.isArray(message.parts)) {
31
51
  return undefined;
@@ -39,9 +59,15 @@ function stepOf(message) {
39
59
  const done = isObject(data.tool_result) ? data.tool_result : undefined;
40
60
  const told = call ?? done;
41
61
  if (told && typeof told.name === 'string') {
62
+ // A harness says its kind and title in the message's metadata: the step
63
+ // is named by both, and drawn on its workspace.
64
+ const meta = isObject(message.metadata) ? message.metadata : undefined;
65
+ const kind = meta && typeof meta.kind === 'string' ? meta.kind : '';
66
+ const title = meta && typeof meta.title === 'string' ? meta.title : '';
42
67
  return {
43
68
  ...(typeof told.id === 'string' ? { toolId: told.id } : {}),
44
- name: told.name,
69
+ name: kind ? harnessStepName(kind, title || told.name) : told.name,
70
+ ...(kind ? { harness: kind } : {}),
45
71
  ended: !call,
46
72
  ...(call && isObject(call.arguments)
47
73
  ? { args: call.arguments }
@@ -171,7 +197,9 @@ class ResponseRecorder {
171
197
  name: step.name,
172
198
  id: step.toolId,
173
199
  args: step.args ?? {},
174
- tool: classifyTool?.(step.name, step.args) ?? { kind: 'runtime' },
200
+ tool: step.harness
201
+ ? { kind: 'harness' }
202
+ : (classifyTool?.(step.name, step.args) ?? { kind: 'runtime' }),
175
203
  parent: this.span.context,
176
204
  origin: 'a2a.status',
177
205
  }));
@@ -180,6 +208,10 @@ class ResponseRecorder {
180
208
  const call = this.calls.get(key);
181
209
  if (call) {
182
210
  this.calls.delete(key);
211
+ if (step.harness) {
212
+ // Its end names it as it was done: *Read README.md*, not *Read*.
213
+ call.setAttribute('gen_ai.tool.name', step.name);
214
+ }
183
215
  endToolCall(call, { result: step.result, error: step.error });
184
216
  }
185
217
  }
@@ -45,7 +45,7 @@ export declare const AGENT_SPAN_ATTRIBUTES: {
45
45
  readonly errorType: "error.type";
46
46
  };
47
47
  /** Where a tool call comes from. */
48
- export type AgentToolKind = 'mcp' | 'frontend' | 'skill' | 'codemode' | 'runtime';
48
+ export type AgentToolKind = 'mcp' | 'frontend' | 'skill' | 'codemode' | 'runtime' | 'harness';
49
49
  /** Every kind, in the order the filters list them. */
50
50
  export declare const AGENT_TOOL_KINDS: readonly AgentToolKind[];
51
51
  /** What a tool call is: where it comes from, and its marks. */
@@ -55,6 +55,7 @@ export const AGENT_TOOL_KINDS = [
55
55
  'skill',
56
56
  'codemode',
57
57
  'runtime',
58
+ 'harness',
58
59
  ];
59
60
  /** A value as an attribute carries it: JSON text. */
60
61
  export function jsonAttribute(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.5.95",
3
+ "version": "1.5.96",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",