linkque-cli-v2 1.6.3 → 1.6.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EModelProvider
3
- } from "./chunk-4VLP3ODV.js";
3
+ } from "./chunk-UTJ7DVT7.js";
4
4
 
5
5
  // ../linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js
6
6
  var baked;
@@ -29808,6 +29808,41 @@ function resolveWebSearchResource(resources) {
29808
29808
  };
29809
29809
  }
29810
29810
 
29811
+ // ../linkque-agent-runtime/dist/esm/core/webSearchPresentation.js
29812
+ function projectWebSearchSources(result) {
29813
+ if (!isRecord2(result))
29814
+ return void 0;
29815
+ const value = result;
29816
+ if (value.error || typeof value.query !== "string" || !Array.isArray(value.items))
29817
+ return void 0;
29818
+ const items = value.items.slice(0, 10).flatMap((item) => {
29819
+ if (!isRecord2(item) || typeof item.id !== "string" || !item.id.trim() || typeof item.title !== "string" || !item.title.trim() || typeof item.content !== "string")
29820
+ return [];
29821
+ let url2;
29822
+ if (typeof item.url === "string") {
29823
+ try {
29824
+ const parsed = new URL(item.url);
29825
+ if (["http:", "https:"].includes(parsed.protocol) && !parsed.username && !parsed.password)
29826
+ url2 = parsed.href;
29827
+ } catch {
29828
+ }
29829
+ }
29830
+ return [
29831
+ {
29832
+ id: item.id.slice(0, 256),
29833
+ title: item.title.slice(0, 256),
29834
+ content: item.content.slice(0, 4e3),
29835
+ ...url2 ? { url: url2 } : {},
29836
+ ...typeof item.channel === "string" ? { channel: item.channel.slice(0, 64) } : {}
29837
+ }
29838
+ ];
29839
+ });
29840
+ return items.length ? { query: value.query.slice(0, 2048), items } : void 0;
29841
+ }
29842
+ function isRecord2(value) {
29843
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
29844
+ }
29845
+
29811
29846
  // ../linkque-agent-runtime/dist/esm/core/createWebSearchTool.js
29812
29847
  function createWebSearchTool(resource, searchPort, agentId, debugLog) {
29813
29848
  return {
@@ -29844,6 +29879,15 @@ function createWebSearchTool(resource, searchPort, agentId, debugLog) {
29844
29879
  const result = await waitWithSignal(() => searchPort.search({ agentId, ...parsed }, signal, context2?.observation), signal);
29845
29880
  throwIfWebSearchAborted(signal);
29846
29881
  count = result.items.length;
29882
+ const presentation = context2 ? projectWebSearchSources(result) : void 0;
29883
+ if (context2 && presentation) {
29884
+ context2.emit({
29885
+ type: "tool_result",
29886
+ toolCallId: context2.toolCallId,
29887
+ messageId: `${context2.toolCallId}:web-search-result`,
29888
+ content: JSON.stringify(presentation)
29889
+ });
29890
+ }
29847
29891
  return result;
29848
29892
  } catch (error) {
29849
29893
  if (signal?.aborted || error instanceof Error && error.name === "AbortError") {
@@ -30075,7 +30119,7 @@ var ConversationControlValidationError = class extends Error {
30075
30119
  };
30076
30120
  function parseCancelConversationRunRequest(value) {
30077
30121
  const issues = [];
30078
- if (!isRecord2(value)) {
30122
+ if (!isRecord3(value)) {
30079
30123
  throw new ConversationControlValidationError([
30080
30124
  "control request must be an object"
30081
30125
  ]);
@@ -30095,7 +30139,7 @@ function parseCancelConversationRunRequest(value) {
30095
30139
  }
30096
30140
  function parseMarkConversationRunsReadRequest(value) {
30097
30141
  const issues = [];
30098
- if (!isRecord2(value)) {
30142
+ if (!isRecord3(value)) {
30099
30143
  throw new ConversationControlValidationError([
30100
30144
  "control request must be an object"
30101
30145
  ]);
@@ -30129,7 +30173,7 @@ function parseMarkConversationRunsReadRequest(value) {
30129
30173
  function isNonEmptyString(value) {
30130
30174
  return typeof value === "string" && Boolean(value.trim());
30131
30175
  }
30132
- function isRecord2(value) {
30176
+ function isRecord3(value) {
30133
30177
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
30134
30178
  }
30135
30179
 
@@ -30765,12 +30809,12 @@ var CONVERSATION_CUSTOM_EVENT_NAMES = Object.freeze({
30765
30809
  var MAX_CONVERSATION_FOLLOW_UP_QUESTIONS = 3;
30766
30810
  var MAX_CONVERSATION_FOLLOW_UP_QUESTION_LENGTH = 20;
30767
30811
  function parseConversationFollowUpQuestions(value) {
30768
- if (!isRecord3(value) || !Array.isArray(value.questions))
30812
+ if (!isRecord4(value) || !Array.isArray(value.questions))
30769
30813
  return void 0;
30770
30814
  const seen = /* @__PURE__ */ new Set();
30771
30815
  const questions = [];
30772
30816
  for (const candidate of value.questions) {
30773
- if (!isRecord3(candidate))
30817
+ if (!isRecord4(candidate))
30774
30818
  continue;
30775
30819
  const label = normalizeFollowUpText(candidate.label);
30776
30820
  const prompt = normalizeFollowUpText(candidate.prompt);
@@ -30795,7 +30839,7 @@ function normalizeFollowUpText(value) {
30795
30839
  const normalized = value.replace(/\s+/gu, " ").trim();
30796
30840
  return normalized || void 0;
30797
30841
  }
30798
- function isRecord3(value) {
30842
+ function isRecord4(value) {
30799
30843
  return typeof value === "object" && value !== null && !Array.isArray(value);
30800
30844
  }
30801
30845
  function createConversationCustomEvent(name, value, fields = {}) {
@@ -30824,7 +30868,7 @@ function parseConversationRunRequest(value) {
30824
30868
  return value;
30825
30869
  }
30826
30870
  function getConversationRunRequestIssues(value) {
30827
- if (!isRecord4(value))
30871
+ if (!isRecord5(value))
30828
30872
  return ["request must be an object"];
30829
30873
  const issues = [];
30830
30874
  if (!isSupportedConversationProtocolVersion(value.protocolVersion)) {
@@ -30847,7 +30891,7 @@ function getConversationRunRequestIssues(value) {
30847
30891
  } else {
30848
30892
  value.attachments.forEach((attachment, index) => validateAttachment(attachment, index, issues));
30849
30893
  }
30850
- if (!isRecord4(value.metadata))
30894
+ if (!isRecord5(value.metadata))
30851
30895
  issues.push("metadata must be an object");
30852
30896
  if (value.clientCapabilities !== void 0) {
30853
30897
  if (!Array.isArray(value.clientCapabilities)) {
@@ -30865,7 +30909,7 @@ function getConversationRunRequestIssues(value) {
30865
30909
  return issues;
30866
30910
  }
30867
30911
  function validateMessage(value, index, issues) {
30868
- if (!isRecord4(value)) {
30912
+ if (!isRecord5(value)) {
30869
30913
  issues.push(`messages[${index}] must be an object`);
30870
30914
  return;
30871
30915
  }
@@ -30876,7 +30920,7 @@ function validateMessage(value, index, issues) {
30876
30920
  }
30877
30921
  if (value.content !== void 0) {
30878
30922
  if (typeof value.content === "string") {
30879
- } else if (isRecord4(value.content) && value.content.type === "a2ui.event") {
30923
+ } else if (isRecord5(value.content) && value.content.type === "a2ui.event") {
30880
30924
  if (value.role !== "user") {
30881
30925
  issues.push(`messages[${index}].content a2ui.event requires the user role`);
30882
30926
  }
@@ -30900,21 +30944,21 @@ function validateA2UIEventContent(value, path2, issues) {
30900
30944
  validateA2UIEventSource(value.source, `${path2}.source`, issues);
30901
30945
  }
30902
30946
  function validateA2UIEvent(value, path2, issues) {
30903
- if (!isRecord4(value)) {
30947
+ if (!isRecord5(value)) {
30904
30948
  issues.push(`${path2} must be an object`);
30905
30949
  return;
30906
30950
  }
30907
30951
  if (!isSafeEventName(value.name)) {
30908
30952
  issues.push(`${path2}.name must be a safe event name up to 96 characters`);
30909
30953
  }
30910
- if (!isRecord4(value.payload)) {
30954
+ if (!isRecord5(value.payload)) {
30911
30955
  issues.push(`${path2}.payload must be an object`);
30912
30956
  return;
30913
30957
  }
30914
30958
  validateJsonValue(value.payload, `${path2}.payload`, issues);
30915
30959
  }
30916
30960
  function validateA2UIEventSource(value, path2, issues) {
30917
- if (!isRecord4(value)) {
30961
+ if (!isRecord5(value)) {
30918
30962
  issues.push(`${path2} must be an object`);
30919
30963
  return;
30920
30964
  }
@@ -30955,7 +30999,7 @@ function validateJsonValue(value, path2, issues) {
30955
30999
  value.forEach((entry, index) => validateJsonValue(entry, `${path2}[${index}]`, issues));
30956
31000
  return;
30957
31001
  }
30958
- if (!isRecord4(value)) {
31002
+ if (!isRecord5(value)) {
30959
31003
  issues.push(`${path2} must be JSON-safe`);
30960
31004
  return;
30961
31005
  }
@@ -30968,7 +31012,7 @@ function validateJsonValue(value, path2, issues) {
30968
31012
  }
30969
31013
  }
30970
31014
  function validateAttachment(value, index, issues) {
30971
- if (!isRecord4(value)) {
31015
+ if (!isRecord5(value)) {
30972
31016
  issues.push(`attachments[${index}] must be an object`);
30973
31017
  return;
30974
31018
  }
@@ -30986,11 +31030,11 @@ function validateAttachment(value, index, issues) {
30986
31030
  if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
30987
31031
  issues.push(`attachments[${index}].size must be a non-negative safe integer when provided`);
30988
31032
  }
30989
- if (value.metadata !== void 0 && !isRecord4(value.metadata)) {
31033
+ if (value.metadata !== void 0 && !isRecord5(value.metadata)) {
30990
31034
  issues.push(`attachments[${index}].metadata must be an object when provided`);
30991
31035
  }
30992
31036
  }
30993
- function isRecord4(value) {
31037
+ function isRecord5(value) {
30994
31038
  return typeof value === "object" && value !== null && !Array.isArray(value);
30995
31039
  }
30996
31040
  function isNonEmptyString2(value) {
@@ -31032,7 +31076,7 @@ function parseConversationHistoryRequest(value) {
31032
31076
  return value;
31033
31077
  }
31034
31078
  function getConversationHistoryRequestIssues(value) {
31035
- if (!isRecord5(value))
31079
+ if (!isRecord6(value))
31036
31080
  return ["history request must be an object"];
31037
31081
  const issues = [];
31038
31082
  if (!isSupportedConversationProtocolVersion(value.protocolVersion)) {
@@ -31130,7 +31174,7 @@ var HISTORY_OPERATIONS = /* @__PURE__ */ new Set([
31130
31174
  function isNonEmptyString3(value) {
31131
31175
  return typeof value === "string" && Boolean(value.trim());
31132
31176
  }
31133
- function isRecord5(value) {
31177
+ function isRecord6(value) {
31134
31178
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
31135
31179
  }
31136
31180
 
@@ -38130,6 +38174,17 @@ function mapAgentEventToBaseEvents(event, messageId, thinkingId) {
38130
38174
  }
38131
38175
  return events;
38132
38176
  }
38177
+ case "tool_result": {
38178
+ return [
38179
+ {
38180
+ type: EventType.TOOL_CALL_RESULT,
38181
+ toolCallId: event.toolCallId,
38182
+ messageId: event.messageId,
38183
+ role: "tool",
38184
+ content: event.content
38185
+ }
38186
+ ];
38187
+ }
38133
38188
  case "tool_end": {
38134
38189
  return [{ type: EventType.TOOL_CALL_END, toolCallId: event.toolCallId }];
38135
38190
  }
@@ -22,7 +22,7 @@ import {
22
22
  RUNTIME_CONFIG_DEFAULTS,
23
23
  RuntimeConfigProvider,
24
24
  isDebugLoggingEnabled
25
- } from "./chunk-4VLP3ODV.js";
25
+ } from "./chunk-UTJ7DVT7.js";
26
26
  import {
27
27
  __commonJS,
28
28
  __require,
@@ -39,13 +39,13 @@ import {
39
39
  resolveRunStorage,
40
40
  toAgentRunMessages,
41
41
  withIsoTimestamp
42
- } from "../../chunk-ZRFVXCIT.js";
42
+ } from "../../chunk-YZLXAZFT.js";
43
43
  import "../../chunk-IWOFD643.js";
44
44
  import "../../chunk-PXCGFBV5.js";
45
45
  import "../../chunk-ETG6PNHQ.js";
46
46
  import {
47
47
  getBakedProtocol
48
- } from "../../chunk-MK4MI4S5.js";
48
+ } from "../../chunk-IATVK6CO.js";
49
49
  import {
50
50
  ACTIVATE_SKILL_TOOL_NAME,
51
51
  CANCEL_CONVERSATION_RUN_OPERATION,
@@ -182,7 +182,7 @@ import {
182
182
  warnLogFailure,
183
183
  wrapToolWithHooks,
184
184
  writeJsonPointer
185
- } from "../../chunk-4VLP3ODV.js";
185
+ } from "../../chunk-UTJ7DVT7.js";
186
186
  import "../../chunk-EAODRPW4.js";
187
187
  import "../../chunk-XUFLSZM4.js";
188
188
  import "../../chunk-GAYNLDWK.js";
@@ -3,11 +3,11 @@ import {
3
3
  runClientCapability,
4
4
  runClientCapabilityCleanup,
5
5
  runClientCapabilityResult
6
- } from "../../chunk-ZRFVXCIT.js";
6
+ } from "../../chunk-YZLXAZFT.js";
7
7
  import "../../chunk-IWOFD643.js";
8
8
  import "../../chunk-PXCGFBV5.js";
9
9
  import "../../chunk-ETG6PNHQ.js";
10
- import "../../chunk-4VLP3ODV.js";
10
+ import "../../chunk-UTJ7DVT7.js";
11
11
  import "../../chunk-EAODRPW4.js";
12
12
  import "../../chunk-XUFLSZM4.js";
13
13
  import "../../chunk-GAYNLDWK.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getBakedProtocol,
3
3
  setBakedProtocol
4
- } from "../chunk-MK4MI4S5.js";
5
- import "../chunk-4VLP3ODV.js";
4
+ } from "../chunk-IATVK6CO.js";
5
+ import "../chunk-UTJ7DVT7.js";
6
6
  import "../chunk-EAODRPW4.js";
7
7
  import "../chunk-XUFLSZM4.js";
8
8
  import "../chunk-GAYNLDWK.js";
package/worker.js CHANGED
@@ -15790,6 +15790,46 @@ var init_webSearchResource = __esm({
15790
15790
  }
15791
15791
  });
15792
15792
 
15793
+ // ../linkque-agent-runtime/dist/esm/core/webSearchPresentation.js
15794
+ function projectWebSearchSources(result) {
15795
+ if (!isRecord2(result))
15796
+ return void 0;
15797
+ const value = result;
15798
+ if (value.error || typeof value.query !== "string" || !Array.isArray(value.items))
15799
+ return void 0;
15800
+ const items = value.items.slice(0, 10).flatMap((item) => {
15801
+ if (!isRecord2(item) || typeof item.id !== "string" || !item.id.trim() || typeof item.title !== "string" || !item.title.trim() || typeof item.content !== "string")
15802
+ return [];
15803
+ let url2;
15804
+ if (typeof item.url === "string") {
15805
+ try {
15806
+ const parsed = new URL(item.url);
15807
+ if (["http:", "https:"].includes(parsed.protocol) && !parsed.username && !parsed.password)
15808
+ url2 = parsed.href;
15809
+ } catch {
15810
+ }
15811
+ }
15812
+ return [
15813
+ {
15814
+ id: item.id.slice(0, 256),
15815
+ title: item.title.slice(0, 256),
15816
+ content: item.content.slice(0, 4e3),
15817
+ ...url2 ? { url: url2 } : {},
15818
+ ...typeof item.channel === "string" ? { channel: item.channel.slice(0, 64) } : {}
15819
+ }
15820
+ ];
15821
+ });
15822
+ return items.length ? { query: value.query.slice(0, 2048), items } : void 0;
15823
+ }
15824
+ function isRecord2(value) {
15825
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15826
+ }
15827
+ var init_webSearchPresentation = __esm({
15828
+ "../linkque-agent-runtime/dist/esm/core/webSearchPresentation.js"() {
15829
+ "use strict";
15830
+ }
15831
+ });
15832
+
15793
15833
  // ../linkque-agent-runtime/dist/esm/core/createWebSearchTool.js
15794
15834
  function createWebSearchTool(resource, searchPort, agentId, debugLog) {
15795
15835
  return {
@@ -15826,6 +15866,15 @@ function createWebSearchTool(resource, searchPort, agentId, debugLog) {
15826
15866
  const result = await waitWithSignal(() => searchPort.search({ agentId, ...parsed }, signal, context2?.observation), signal);
15827
15867
  throwIfWebSearchAborted(signal);
15828
15868
  count = result.items.length;
15869
+ const presentation = context2 ? projectWebSearchSources(result) : void 0;
15870
+ if (context2 && presentation) {
15871
+ context2.emit({
15872
+ type: "tool_result",
15873
+ toolCallId: context2.toolCallId,
15874
+ messageId: `${context2.toolCallId}:web-search-result`,
15875
+ content: JSON.stringify(presentation)
15876
+ });
15877
+ }
15829
15878
  return result;
15830
15879
  } catch (error40) {
15831
15880
  if (signal?.aborted || error40 instanceof Error && error40.name === "AbortError") {
@@ -15850,6 +15899,7 @@ function createWebSearchTool(resource, searchPort, agentId, debugLog) {
15850
15899
  var init_createWebSearchTool = __esm({
15851
15900
  "../linkque-agent-runtime/dist/esm/core/createWebSearchTool.js"() {
15852
15901
  "use strict";
15902
+ init_webSearchPresentation();
15853
15903
  init_types();
15854
15904
  init_webSearchTools();
15855
15905
  init_abort();
@@ -34211,7 +34261,7 @@ function parseConversationRunRequest(value) {
34211
34261
  return value;
34212
34262
  }
34213
34263
  function getConversationRunRequestIssues(value) {
34214
- if (!isRecord3(value))
34264
+ if (!isRecord4(value))
34215
34265
  return ["request must be an object"];
34216
34266
  const issues = [];
34217
34267
  if (!isSupportedConversationProtocolVersion(value.protocolVersion)) {
@@ -34234,7 +34284,7 @@ function getConversationRunRequestIssues(value) {
34234
34284
  } else {
34235
34285
  value.attachments.forEach((attachment, index2) => validateAttachment(attachment, index2, issues));
34236
34286
  }
34237
- if (!isRecord3(value.metadata))
34287
+ if (!isRecord4(value.metadata))
34238
34288
  issues.push("metadata must be an object");
34239
34289
  if (value.clientCapabilities !== void 0) {
34240
34290
  if (!Array.isArray(value.clientCapabilities)) {
@@ -34252,7 +34302,7 @@ function getConversationRunRequestIssues(value) {
34252
34302
  return issues;
34253
34303
  }
34254
34304
  function validateMessage(value, index2, issues) {
34255
- if (!isRecord3(value)) {
34305
+ if (!isRecord4(value)) {
34256
34306
  issues.push(`messages[${index2}] must be an object`);
34257
34307
  return;
34258
34308
  }
@@ -34263,7 +34313,7 @@ function validateMessage(value, index2, issues) {
34263
34313
  }
34264
34314
  if (value.content !== void 0) {
34265
34315
  if (typeof value.content === "string") {
34266
- } else if (isRecord3(value.content) && value.content.type === "a2ui.event") {
34316
+ } else if (isRecord4(value.content) && value.content.type === "a2ui.event") {
34267
34317
  if (value.role !== "user") {
34268
34318
  issues.push(`messages[${index2}].content a2ui.event requires the user role`);
34269
34319
  }
@@ -34287,21 +34337,21 @@ function validateA2UIEventContent(value, path9, issues) {
34287
34337
  validateA2UIEventSource(value.source, `${path9}.source`, issues);
34288
34338
  }
34289
34339
  function validateA2UIEvent(value, path9, issues) {
34290
- if (!isRecord3(value)) {
34340
+ if (!isRecord4(value)) {
34291
34341
  issues.push(`${path9} must be an object`);
34292
34342
  return;
34293
34343
  }
34294
34344
  if (!isSafeEventName(value.name)) {
34295
34345
  issues.push(`${path9}.name must be a safe event name up to 96 characters`);
34296
34346
  }
34297
- if (!isRecord3(value.payload)) {
34347
+ if (!isRecord4(value.payload)) {
34298
34348
  issues.push(`${path9}.payload must be an object`);
34299
34349
  return;
34300
34350
  }
34301
34351
  validateJsonValue(value.payload, `${path9}.payload`, issues);
34302
34352
  }
34303
34353
  function validateA2UIEventSource(value, path9, issues) {
34304
- if (!isRecord3(value)) {
34354
+ if (!isRecord4(value)) {
34305
34355
  issues.push(`${path9} must be an object`);
34306
34356
  return;
34307
34357
  }
@@ -34342,7 +34392,7 @@ function validateJsonValue(value, path9, issues) {
34342
34392
  value.forEach((entry, index2) => validateJsonValue(entry, `${path9}[${index2}]`, issues));
34343
34393
  return;
34344
34394
  }
34345
- if (!isRecord3(value)) {
34395
+ if (!isRecord4(value)) {
34346
34396
  issues.push(`${path9} must be JSON-safe`);
34347
34397
  return;
34348
34398
  }
@@ -34355,7 +34405,7 @@ function validateJsonValue(value, path9, issues) {
34355
34405
  }
34356
34406
  }
34357
34407
  function validateAttachment(value, index2, issues) {
34358
- if (!isRecord3(value)) {
34408
+ if (!isRecord4(value)) {
34359
34409
  issues.push(`attachments[${index2}] must be an object`);
34360
34410
  return;
34361
34411
  }
@@ -34373,11 +34423,11 @@ function validateAttachment(value, index2, issues) {
34373
34423
  if (value.size !== void 0 && (!Number.isSafeInteger(value.size) || Number(value.size) < 0)) {
34374
34424
  issues.push(`attachments[${index2}].size must be a non-negative safe integer when provided`);
34375
34425
  }
34376
- if (value.metadata !== void 0 && !isRecord3(value.metadata)) {
34426
+ if (value.metadata !== void 0 && !isRecord4(value.metadata)) {
34377
34427
  issues.push(`attachments[${index2}].metadata must be an object when provided`);
34378
34428
  }
34379
34429
  }
34380
- function isRecord3(value) {
34430
+ function isRecord4(value) {
34381
34431
  return typeof value === "object" && value !== null && !Array.isArray(value);
34382
34432
  }
34383
34433
  function isNonEmptyString(value) {
@@ -34549,6 +34599,17 @@ function mapAgentEventToBaseEvents(event, messageId, thinkingId) {
34549
34599
  }
34550
34600
  return events;
34551
34601
  }
34602
+ case "tool_result": {
34603
+ return [
34604
+ {
34605
+ type: EventType.TOOL_CALL_RESULT,
34606
+ toolCallId: event.toolCallId,
34607
+ messageId: event.messageId,
34608
+ role: "tool",
34609
+ content: event.content
34610
+ }
34611
+ ];
34612
+ }
34552
34613
  case "tool_end": {
34553
34614
  return [{ type: EventType.TOOL_CALL_END, toolCallId: event.toolCallId }];
34554
34615
  }
@@ -159917,13 +159978,13 @@ __export(pi_messages_exports, {
159917
159978
  stream: () => stream10,
159918
159979
  streamSimple: () => streamSimple9
159919
159980
  });
159920
- function isRecord4(value) {
159981
+ function isRecord5(value) {
159921
159982
  return typeof value === "object" && value !== null && !Array.isArray(value);
159922
159983
  }
159923
159984
  function parsePiMessagesErrorBody(body) {
159924
159985
  try {
159925
159986
  const parsed = JSON.parse(body);
159926
- return isRecord4(parsed) && isRecord4(parsed.error) ? parsed : void 0;
159987
+ return isRecord5(parsed) && isRecord5(parsed.error) ? parsed : void 0;
159927
159988
  } catch {
159928
159989
  return void 0;
159929
159990
  }
@@ -196938,14 +196999,14 @@ var init_openrouter = __esm({
196938
196999
  });
196939
197000
 
196940
197001
  // ../../node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js
196941
- function isRecord5(value) {
197002
+ function isRecord6(value) {
196942
197003
  return typeof value === "object" && value !== null && !Array.isArray(value);
196943
197004
  }
196944
197005
  function isRadiusGatewayModel(value) {
196945
- return isRecord5(value) && typeof value.id === "string" && typeof value.name === "string" && typeof value.reasoning === "boolean" && Array.isArray(value.input) && isRecord5(value.cost) && typeof value.contextWindow === "number" && typeof value.maxTokens === "number";
197006
+ return isRecord6(value) && typeof value.id === "string" && typeof value.name === "string" && typeof value.reasoning === "boolean" && Array.isArray(value.input) && isRecord6(value.cost) && typeof value.contextWindow === "number" && typeof value.maxTokens === "number";
196946
197007
  }
196947
197008
  function sanitizeRadiusGatewayConfig(config2) {
196948
- if (!isRecord5(config2) || typeof config2.baseUrl !== "string" || !Array.isArray(config2.models))
197009
+ if (!isRecord6(config2) || typeof config2.baseUrl !== "string" || !Array.isArray(config2.models))
196949
197010
  return void 0;
196950
197011
  return {
196951
197012
  baseUrl: config2.baseUrl,
@@ -206639,14 +206700,14 @@ function getToolUiStatusEnabledNames(descriptors) {
206639
206700
  }
206640
206701
  function decorateToolParametersWithUiStatus(value) {
206641
206702
  const parameters = normalizeParameters(value);
206642
- if (!isRecord6(parameters) || parameters.type !== "object") {
206703
+ if (!isRecord7(parameters) || parameters.type !== "object") {
206643
206704
  return { parameters, enabled: false };
206644
206705
  }
206645
206706
  if ([...UNSAFE_TOOL_SCHEMA_KEYS].some((key) => key in parameters)) {
206646
206707
  return { parameters, enabled: false };
206647
206708
  }
206648
206709
  const properties = parameters.properties;
206649
- if (properties !== void 0 && !isRecord6(properties)) {
206710
+ if (properties !== void 0 && !isRecord7(properties)) {
206650
206711
  return { parameters, enabled: false };
206651
206712
  }
206652
206713
  const required2 = parameters.required;
@@ -206665,12 +206726,12 @@ function decorateToolParametersWithUiStatus(value) {
206665
206726
  };
206666
206727
  }
206667
206728
  function stripToolUiStatusArgument(value) {
206668
- if (!isRecord6(value) || !(TOOL_UI_STATUS_ARGUMENT in value))
206729
+ if (!isRecord7(value) || !(TOOL_UI_STATUS_ARGUMENT in value))
206669
206730
  return value;
206670
206731
  const { [TOOL_UI_STATUS_ARGUMENT]: _status, ...args } = value;
206671
206732
  return args;
206672
206733
  }
206673
- function isRecord6(value) {
206734
+ function isRecord7(value) {
206674
206735
  return typeof value === "object" && value !== null && !Array.isArray(value);
206675
206736
  }
206676
206737
  function normalizeParameters(value) {
@@ -217282,7 +217343,7 @@ var LocalHttpMcpServerProvider = class {
217282
217343
  listTools: async (signal) => {
217283
217344
  const response = await this.fetchImpl(toolsUrl, { signal });
217284
217345
  const body = await readJsonResponse(response);
217285
- if (!isRecord2(body) || !Array.isArray(body.tools)) {
217346
+ if (!isRecord3(body) || !Array.isArray(body.tools)) {
217286
217347
  throw new Error(`Invalid local MCP tool catalog for ${resource.resourceId}`);
217287
217348
  }
217288
217349
  return body.tools.map((value) => this.createDescriptor(resource.resourceId, value));
@@ -217291,16 +217352,16 @@ var LocalHttpMcpServerProvider = class {
217291
217352
  };
217292
217353
  }
217293
217354
  createDescriptor(resourceId, value) {
217294
- if (!isRecord2(value) || typeof value.name !== "string") {
217355
+ if (!isRecord3(value) || typeof value.name !== "string") {
217295
217356
  throw new Error(`Invalid local MCP tool descriptor for ${resourceId}`);
217296
217357
  }
217297
217358
  return {
217298
217359
  name: value.name,
217299
217360
  resourceId,
217300
217361
  ...typeof value.description === "string" ? { description: value.description } : {},
217301
- ...isRecord2(value.inputSchema) ? { inputSchema: value.inputSchema } : {},
217302
- ...isRecord2(value.outputSchema) ? { outputSchema: value.outputSchema } : {},
217303
- ...isRecord2(value.annotations) ? { annotations: value.annotations } : {},
217362
+ ...isRecord3(value.inputSchema) ? { inputSchema: value.inputSchema } : {},
217363
+ ...isRecord3(value.outputSchema) ? { outputSchema: value.outputSchema } : {},
217364
+ ...isRecord3(value.annotations) ? { annotations: value.annotations } : {},
217304
217365
  execute: (args, signal, context2) => this.callTool(resourceId, value.name, args, signal, {
217305
217366
  context: context2,
217306
217367
  toolSchema: {
@@ -217332,7 +217393,7 @@ async function readJsonResponse(response) {
217332
217393
  const raw = await response.json().catch(() => void 0);
217333
217394
  const value = raw === void 0 ? void 0 : JSON.parse(JSON.stringify(raw));
217334
217395
  if (!response.ok) {
217335
- const message = isRecord2(value) && typeof value.message === "string" ? value.message : `Local MCP fixture request failed with ${response.status}`;
217396
+ const message = isRecord3(value) && typeof value.message === "string" ? value.message : `Local MCP fixture request failed with ${response.status}`;
217336
217397
  throw new Error(message);
217337
217398
  }
217338
217399
  return value;
@@ -217343,7 +217404,7 @@ function ensureTrailingSlash(url2) {
217343
217404
  next.pathname += "/";
217344
217405
  return next;
217345
217406
  }
217346
- function isRecord2(value) {
217407
+ function isRecord3(value) {
217347
217408
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
217348
217409
  }
217349
217410
 
@@ -220026,10 +220087,10 @@ var handleFunctionActionMcp = async (req, res, input) => {
220026
220087
  }
220027
220088
  };
220028
220089
  var parseHomeDataProxyInput = (value) => {
220029
- const trustedContext = isRecord7(value) ? value[HOME_DATA_TRUSTED_CONTEXT_FIELD] : void 0;
220030
- const trustedUserId = isRecord7(trustedContext) ? trustedContext.userId : void 0;
220090
+ const trustedContext = isRecord8(value) ? value[HOME_DATA_TRUSTED_CONTEXT_FIELD] : void 0;
220091
+ const trustedUserId = isRecord8(trustedContext) ? trustedContext.userId : void 0;
220031
220092
  const normalizedUserId = typeof trustedUserId === "string" ? trustedUserId.trim() : "";
220032
- if (!isRecord7(value) || !normalizedUserId) {
220093
+ if (!isRecord8(value) || !normalizedUserId) {
220033
220094
  throw new Error("home-data trusted user is invalid");
220034
220095
  }
220035
220096
  const request = { ...value };
@@ -220037,9 +220098,9 @@ var parseHomeDataProxyInput = (value) => {
220037
220098
  return { request, userId: normalizedUserId };
220038
220099
  };
220039
220100
  var parseFunctionActionMcpProxyInput = (value) => {
220040
- if (!isRecord7(value)) throw new Error("function action request is invalid");
220101
+ if (!isRecord8(value)) throw new Error("function action request is invalid");
220041
220102
  const trustedContext = value._trustedContext_;
220042
- const userId = isRecord7(trustedContext) && typeof trustedContext.userId === "string" ? trustedContext.userId.trim() : "";
220103
+ const userId = isRecord8(trustedContext) && typeof trustedContext.userId === "string" ? trustedContext.userId.trim() : "";
220043
220104
  if (!userId) {
220044
220105
  throw new Error("function action trusted context is invalid");
220045
220106
  }
@@ -220051,7 +220112,7 @@ var writeJson = (res, status, value) => {
220051
220112
  res.writeHead(status, { "content-type": "application/json; charset=utf-8" });
220052
220113
  res.end(JSON.stringify(value));
220053
220114
  };
220054
- var isRecord7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
220115
+ var isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
220055
220116
  var errorMessage3 = (error40) => error40 instanceof Error ? error40.message : "unknown agent error";
220056
220117
  var main = async () => {
220057
220118
  const input = decodeInput();