maka-agent 0.2.0-dev.74.20261008 → 0.2.0-dev.75.20261008

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.
@@ -65,7 +65,9 @@ export const RUNTIME_HOST_REGISTRATION_SCHEMA_VERSION = 1;
65
65
  export const RUNTIME_HOST_PROTOCOL_VERSION = 0;
66
66
  // Increment when the same protocol version no longer guarantees safe Client-Host
67
67
  // interoperability. Mismatches are rejected before domain commands are admitted.
68
- export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 206;
68
+ export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 208;
69
+ // 208: Usage queries filter by model call kind. Epoch-207 peers reject the
70
+ // filter or ignore it.
69
71
  // 206: `storage.retention.query` and `storage.retention.set` read and change the
70
72
  // opt-in retention for archived tasks. An epoch-205 Client could not show or
71
73
  // turn off a Host that deletes archived tasks on its own, and an epoch-205 Host
@@ -44,6 +44,7 @@ const LLM_USAGE_QUERY_FIELDS = new Set([
44
44
  'providerId',
45
45
  'modelId',
46
46
  'status',
47
+ 'callKinds',
47
48
  ]);
48
49
  const TOOL_USAGE_QUERY_FIELDS = new Set(['range', 'toolName', 'status']);
49
50
  const USAGE_BUCKET_FIELDS = new Set([
@@ -457,8 +458,19 @@ function decodeLlmUsageQuery(value) {
457
458
  ...optionalQueryText(query, 'providerId'),
458
459
  ...optionalQueryText(query, 'modelId'),
459
460
  ...(query.status === undefined ? {} : { status: decodeUsageStatus(query.status) }),
461
+ ...(query.callKinds === undefined ? {} : { callKinds: decodeCallKinds(query.callKinds) }),
460
462
  };
461
463
  }
464
+ function decodeCallKinds(value) {
465
+ if (!Array.isArray(value))
466
+ throw invalidProtocolFrame('Invalid usage query callKinds');
467
+ return value.map((entry) => {
468
+ if (typeof entry !== 'string' || !MODEL_CALL_KINDS.includes(entry)) {
469
+ throw invalidProtocolFrame('Invalid usage query callKind');
470
+ }
471
+ return entry;
472
+ });
473
+ }
462
474
  function decodeToolUsageQuery(value) {
463
475
  const query = requireRecord(value, 'tool usage query');
464
476
  assertAllowedKeys(query, TOOL_USAGE_QUERY_FIELDS, 'tool usage query');
@@ -78,6 +78,21 @@ export function countableFilter(query, range) {
78
78
  equals('provider_id', query.providerId);
79
79
  equals('model_id', query.modelId);
80
80
  equals('connection_slug', query.connectionSlug);
81
+ if (query.callKinds !== undefined) {
82
+ if (query.callKinds.length === 0) {
83
+ // An empty allowlist addresses no rows at all; SQL has no `IN ()`, so
84
+ // the honest translation is a clause that is never true.
85
+ clauses.push('0');
86
+ }
87
+ else {
88
+ // Rows written before call_kind was recorded (call_kind IS NULL) are
89
+ // legacy and cannot be classified: a callKinds filter excludes them on
90
+ // purpose, so pre-callKind Sessions report only their newer calls
91
+ // (#5691 review).
92
+ clauses.push(`call_kind IN (${query.callKinds.map(() => '?').join(', ')})`);
93
+ parameters.push(...query.callKinds);
94
+ }
95
+ }
81
96
  if (query.status !== undefined && query.status !== 'all') {
82
97
  // `interrupted` joins `aborted`: both mean the call stopped short without
83
98
  // the provider reporting a failure.
@@ -232,6 +232,10 @@ class SqliteTelemetryRepo {
232
232
  return false;
233
233
  if (query.status && query.status !== 'all' && row.status !== query.status)
234
234
  return false;
235
+ if (query.callKinds !== undefined &&
236
+ (row.callKind === undefined || !query.callKinds.includes(row.callKind))) {
237
+ return false;
238
+ }
235
239
  return true;
236
240
  });
237
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maka-agent",
3
- "version": "0.2.0-dev.74.20261008",
3
+ "version": "0.2.0-dev.75.20261008",
4
4
  "description": "Apache Maka (Incubating) developer snapshot; not an Apache release.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",