linkque-cli-v2 1.6.21 → 1.6.23

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/linkquejs.js CHANGED
@@ -34500,9 +34500,19 @@ function splitAgentCards(input) {
34500
34500
  for (const resource of config3.agent.resources ?? []) {
34501
34501
  if (resource.resourceType !== "CARD")
34502
34502
  continue;
34503
+ const { config: inline } = resource;
34504
+ const directory = `cards/${encodeURIComponent(resource.resourceId)}/${contentChecksum(inline)}`;
34505
+ const definitionRef = `${directory}/card.json`;
34506
+ const bindingRef = `${directory}/binding.json`;
34507
+ if (inline.format === "alipay-a2ui") {
34508
+ const { protocol, ...binding2 } = inline;
34509
+ files[definitionRef] = { format: inline.format, protocol };
34510
+ files[bindingRef] = { ...binding2, definitionRef };
34511
+ resource.config = { format: inline.format, bindingRef };
34512
+ continue;
34513
+ }
34503
34514
  if (resource.config.schemaVersion !== "4")
34504
34515
  throw new Error("\u5361\u7247\u5B58\u50A8\u53EA\u652F\u6301 V4");
34505
- const directory = `cards/${encodeURIComponent(resource.resourceId)}/${contentChecksum(resource.config)}`;
34506
34516
  const template = resource.config.a2uiTemplate;
34507
34517
  const definition = {
34508
34518
  format: "linkque-a2ui",
@@ -34510,12 +34520,12 @@ function splitAgentCards(input) {
34510
34520
  };
34511
34521
  const binding = {
34512
34522
  ...resource.config,
34513
- definitionRef: `${directory}/card.json`,
34523
+ definitionRef,
34514
34524
  a2uiTemplate: { argsSchema: template.argsSchema }
34515
34525
  };
34516
- files[`${directory}/card.json`] = definition;
34517
- files[`${directory}/binding.json`] = binding;
34518
- resource.config = { bindingRef: `${directory}/binding.json` };
34526
+ files[definitionRef] = definition;
34527
+ files[bindingRef] = binding;
34528
+ resource.config = { bindingRef };
34519
34529
  }
34520
34530
  return { config: config3, files };
34521
34531
  }
@@ -34525,6 +34535,8 @@ async function hydrateAgentCards(input, readJson) {
34525
34535
  if (resource.resourceType !== "CARD")
34526
34536
  continue;
34527
34537
  if (!("bindingRef" in resource.config)) {
34538
+ if (resource.config.format === "alipay-a2ui")
34539
+ continue;
34528
34540
  if (resource.config.schemaVersion !== "4")
34529
34541
  throw new Error("\u5361\u7247\u5B58\u50A8\u53EA\u652F\u6301 V4");
34530
34542
  const template = resource.config.a2uiTemplate;
@@ -34536,16 +34548,26 @@ async function hydrateAgentCards(input, readJson) {
34536
34548
  assertCardPath(binding.definitionRef);
34537
34549
  const definition = await readJson(binding.definitionRef);
34538
34550
  const { definitionRef: _ref, ...execution } = binding;
34539
- resource.config = {
34540
- ...execution,
34541
- a2uiTemplate: {
34542
- ...execution.a2uiTemplate,
34543
- content: canonicalJson(definition.protocol)
34544
- }
34545
- };
34551
+ resource.config = inlineCard(execution, definition);
34546
34552
  }
34547
34553
  return config3;
34548
34554
  }
34555
+ function inlineCard(binding, definition) {
34556
+ if (definition.format === "alipay-a2ui") {
34557
+ return {
34558
+ ...binding,
34559
+ format: definition.format,
34560
+ protocol: definition.protocol
34561
+ };
34562
+ }
34563
+ return {
34564
+ ...binding,
34565
+ a2uiTemplate: {
34566
+ ...binding.a2uiTemplate,
34567
+ content: canonicalJson(definition.protocol)
34568
+ }
34569
+ };
34570
+ }
34549
34571
 
34550
34572
  // src/utils/files.ts
34551
34573
  var import_crypto = require("crypto");
@@ -38011,6 +38033,15 @@ var loadAgentProtocol = async (rawConfigPath, cwd) => {
38011
38033
  return root;
38012
38034
  };
38013
38035
 
38036
+ // ../linkque-agent-runtime/dist/esm/core/executionScene.js
38037
+ var EExecutionScene;
38038
+ (function(EExecutionScene2) {
38039
+ EExecutionScene2["DEVICE_PREVIEW"] = "DEVICE_PREVIEW";
38040
+ EExecutionScene2["SANDBOX_PREVIEW"] = "SANDBOX_PREVIEW";
38041
+ EExecutionScene2["LIVE"] = "LIVE";
38042
+ EExecutionScene2["UNKNOWN"] = "UNKNOWN";
38043
+ })(EExecutionScene || (EExecutionScene = {}));
38044
+
38014
38045
  // ../linkque-agent-runtime/dist/esm/core/mcpExecutionResult.js
38015
38046
  var EMcpErrorCode;
38016
38047
  (function(EMcpErrorCode2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.6.21",
3
+ "version": "1.6.23",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -42633,6 +42633,16 @@ function truncateToEstimatedTokens(text, budget) {
42633
42633
  return text.slice(0, low).trim();
42634
42634
  }
42635
42635
 
42636
+ // ../linkque-agent-runtime/dist/esm/core/executionScene.js
42637
+ var EExecutionScene;
42638
+ (function(EExecutionScene2) {
42639
+ EExecutionScene2["DEVICE_PREVIEW"] = "DEVICE_PREVIEW";
42640
+ EExecutionScene2["SANDBOX_PREVIEW"] = "SANDBOX_PREVIEW";
42641
+ EExecutionScene2["LIVE"] = "LIVE";
42642
+ EExecutionScene2["UNKNOWN"] = "UNKNOWN";
42643
+ })(EExecutionScene || (EExecutionScene = {}));
42644
+ var EXECUTION_SCENE_HEADER = "x-linkque-execution-scene";
42645
+
42636
42646
  // ../linkque-agent-runtime/dist/esm/core/mcpExecutionResult.js
42637
42647
  var EMcpErrorCode;
42638
42648
  (function(EMcpErrorCode2) {
@@ -46147,7 +46157,7 @@ function projectPresentationReceiptForModel(receipt) {
46147
46157
  };
46148
46158
  }
46149
46159
  function parseCardConfig(resource) {
46150
- if ("definitionRef" in resource.config)
46160
+ if ("definitionRef" in resource.config && resource.config.schemaVersion === "4")
46151
46161
  return resource.config;
46152
46162
  const parsed = parseA2UICardResourceConfig(resource.config);
46153
46163
  if (!parsed.success) {
@@ -59180,6 +59190,7 @@ function validContext(value) {
59180
59190
  }
59181
59191
 
59182
59192
  export {
59193
+ EXECUTION_SCENE_HEADER,
59183
59194
  EModelRequestSource,
59184
59195
  DataTransformExecutor,
59185
59196
  EDebugLogScope,
@@ -23,7 +23,7 @@ import {
23
23
  RuntimeConfigProvider,
24
24
  getRunEmbeddedQuery,
25
25
  isDebugLoggingEnabled
26
- } from "./chunk-6G25V7QM.js";
26
+ } from "./chunk-55VHSCSE.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __require,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EModelProvider
3
- } from "./chunk-6G25V7QM.js";
3
+ } from "./chunk-55VHSCSE.js";
4
4
 
5
5
  // ../linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js
6
6
  var baked;
@@ -59,13 +59,13 @@ import {
59
59
  resolveRunStorage,
60
60
  toAgentRunMessages,
61
61
  withIsoTimestamp
62
- } from "../../chunk-JTSY7FS5.js";
62
+ } from "../../chunk-FB6H4CGZ.js";
63
63
  import "../../chunk-IWOFD643.js";
64
64
  import "../../chunk-PXCGFBV5.js";
65
65
  import "../../chunk-ETG6PNHQ.js";
66
66
  import {
67
67
  getBakedProtocol
68
- } from "../../chunk-7PXOEKVE.js";
68
+ } from "../../chunk-NOCU2PBJ.js";
69
69
  import {
70
70
  ACTIVATE_SKILL_TOOL_NAME,
71
71
  AUTHORIZATION_CONFIRM_EVENT,
@@ -126,6 +126,7 @@ import {
126
126
  ETelemetryTerminalSource,
127
127
  ETelemetryToolFailureStage,
128
128
  ETelemetryUsageSource,
129
+ EXECUTION_SCENE_HEADER,
129
130
  EventObservationRegistry,
130
131
  EventType,
131
132
  FOLLOW_UP_CONTEXT_MAX_HISTORY_RUNS,
@@ -235,7 +236,7 @@ import {
235
236
  warnLogFailure,
236
237
  wrapToolWithHooks,
237
238
  writeJsonPointer
238
- } from "../../chunk-6G25V7QM.js";
239
+ } from "../../chunk-55VHSCSE.js";
239
240
  import "../../chunk-XUFLSZM4.js";
240
241
  import "../../chunk-GAYNLDWK.js";
241
242
  import "../../chunk-SICWMO5Y.js";
@@ -40924,11 +40925,14 @@ var StreamBridge = class {
40924
40925
  const allModels = models.getModels(providerId);
40925
40926
  model = allModels[0];
40926
40927
  }
40927
- if (this.auth.provider === EModelProvider.LINKQUE && model && (this.options.agentId || this.options.runId || this.options.chatId || this.options.userId || this.options.requestSource)) {
40928
+ if (this.auth.provider === EModelProvider.LINKQUE && model && (this.options.agentId || this.options.runId || this.options.chatId || this.options.userId || this.options.requestSource || this.options.executionScene)) {
40928
40929
  model = {
40929
40930
  ...model,
40930
40931
  headers: {
40931
40932
  ...model.headers,
40933
+ ...this.options.executionScene && {
40934
+ [EXECUTION_SCENE_HEADER]: this.options.executionScene
40935
+ },
40932
40936
  ...this.options.requestSource && {
40933
40937
  [LINKQUE_REQUEST_SOURCE_HEADER]: this.options.requestSource
40934
40938
  },
@@ -41124,6 +41128,7 @@ var PiFollowUpQuestionGenerator = class {
41124
41128
  ...model,
41125
41129
  headers: {
41126
41130
  ...model.headers,
41131
+ ...input.executionScene ? { [EXECUTION_SCENE_HEADER]: input.executionScene } : {},
41127
41132
  ...input.requestSource ? { [LINKQUE_REQUEST_SOURCE_HEADER]: input.requestSource } : {},
41128
41133
  ...input.runtimeContext?.agentId ? { [LINKQUE_AGENT_ID_HEADER]: input.runtimeContext.agentId } : {},
41129
41134
  [LINKQUE_RUN_ID_HEADER]: input.runId,
@@ -41263,6 +41268,7 @@ var PiAgentLoop = class {
41263
41268
  // chatId/userId 透传:注入 x-chat-id / x-user-id 请求头,供网关会话/用户归因。
41264
41269
  ...req.chatId !== void 0 && { chatId: req.chatId },
41265
41270
  ...req.userId !== void 0 && { userId: req.userId },
41271
+ executionScene: req.executionScene,
41266
41272
  ...req.requestSource !== void 0 && {
41267
41273
  requestSource: req.requestSource
41268
41274
  },
@@ -43451,6 +43457,7 @@ var AgentRuntime = class _AgentRuntime {
43451
43457
  observation,
43452
43458
  runtimeContext: input.runtimeContext,
43453
43459
  requestSource: input.requestSource,
43460
+ executionScene: input.executionScene,
43454
43461
  debugLog: this.portsDebugLog
43455
43462
  }));
43456
43463
  }
@@ -43797,6 +43804,8 @@ var AgentRuntime = class _AgentRuntime {
43797
43804
  historyTurns: structuredClone(history),
43798
43805
  currentTurns: structuredClone(newTurns),
43799
43806
  effectiveModel: model,
43807
+ executionScene: options.executionScene,
43808
+ requestSource: options.requestSource,
43800
43809
  agentConfig: structuredClone(this.effectiveAgentConfig),
43801
43810
  agentId: options.runtimeContext?.agentId ?? this.agentId,
43802
43811
  userId: options.runtimeContext?.userId,
@@ -43899,6 +43908,9 @@ var AgentRuntime = class _AgentRuntime {
43899
43908
  agentReq.runId = request.runId;
43900
43909
  if (options.requestSource)
43901
43910
  agentReq.requestSource = options.requestSource;
43911
+ if (options.executionScene) {
43912
+ agentReq.executionScene = options.executionScene;
43913
+ }
43902
43914
  if (options.runtimeContext?.threadId)
43903
43915
  agentReq.chatId = options.runtimeContext.threadId;
43904
43916
  if (options.runtimeContext?.userId)
@@ -44326,6 +44338,12 @@ function createImageTool(image, input, options, rules) {
44326
44338
  headers: {
44327
44339
  "content-type": "application/json",
44328
44340
  "x-api-key": key2,
44341
+ ...input.executionScene && {
44342
+ [EXECUTION_SCENE_HEADER]: input.executionScene
44343
+ },
44344
+ ...input.requestSource && {
44345
+ "x-linkque-source": input.requestSource
44346
+ },
44329
44347
  "x-agent-id": input.agentId,
44330
44348
  "x-run-id": input.runId,
44331
44349
  "x-chat-id": input.threadId,
@@ -3,11 +3,11 @@ import {
3
3
  runClientCapability,
4
4
  runClientCapabilityCleanup,
5
5
  runClientCapabilityResult
6
- } from "../../chunk-JTSY7FS5.js";
6
+ } from "../../chunk-FB6H4CGZ.js";
7
7
  import "../../chunk-IWOFD643.js";
8
8
  import "../../chunk-PXCGFBV5.js";
9
9
  import "../../chunk-ETG6PNHQ.js";
10
- import "../../chunk-6G25V7QM.js";
10
+ import "../../chunk-55VHSCSE.js";
11
11
  import "../../chunk-XUFLSZM4.js";
12
12
  import "../../chunk-GAYNLDWK.js";
13
13
  import "../../chunk-SICWMO5Y.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getBakedProtocol,
3
3
  setBakedProtocol
4
- } from "../chunk-7PXOEKVE.js";
5
- import "../chunk-6G25V7QM.js";
4
+ } from "../chunk-NOCU2PBJ.js";
5
+ import "../chunk-55VHSCSE.js";
6
6
  import "../chunk-XUFLSZM4.js";
7
7
  import "../chunk-GAYNLDWK.js";
8
8
  import "../chunk-SICWMO5Y.js";
package/worker.js CHANGED
@@ -34,6 +34,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
+ // ../linkque-agent-runtime/dist/esm/core/executionScene.js
38
+ var EExecutionScene, EXECUTION_SCENE_HEADER;
39
+ var init_executionScene = __esm({
40
+ "../linkque-agent-runtime/dist/esm/core/executionScene.js"() {
41
+ "use strict";
42
+ (function(EExecutionScene2) {
43
+ EExecutionScene2["DEVICE_PREVIEW"] = "DEVICE_PREVIEW";
44
+ EExecutionScene2["SANDBOX_PREVIEW"] = "SANDBOX_PREVIEW";
45
+ EExecutionScene2["LIVE"] = "LIVE";
46
+ EExecutionScene2["UNKNOWN"] = "UNKNOWN";
47
+ })(EExecutionScene || (EExecutionScene = {}));
48
+ EXECUTION_SCENE_HEADER = "x-linkque-execution-scene";
49
+ }
50
+ });
51
+
37
52
  // ../linkque-agent-runtime/dist/esm/core/mcpExecutionResult.js
38
53
  function unwrapMcpExecutionResult(result) {
39
54
  if (result.success)
@@ -12276,7 +12291,7 @@ function projectPresentationReceiptForModel(receipt) {
12276
12291
  };
12277
12292
  }
12278
12293
  function parseCardConfig(resource) {
12279
- if ("definitionRef" in resource.config)
12294
+ if ("definitionRef" in resource.config && resource.config.schemaVersion === "4")
12280
12295
  return resource.config;
12281
12296
  const parsed = parseA2UICardResourceConfig(resource.config);
12282
12297
  if (!parsed.success) {
@@ -226868,6 +226883,7 @@ var AgentService, StreamBridge;
226868
226883
  var init_agentService = __esm({
226869
226884
  "../linkque-agent-runtime/dist/esm/impl/agent/pi/agentService.js"() {
226870
226885
  "use strict";
226886
+ init_executionScene();
226871
226887
  init_piTelemetry();
226872
226888
  init_compat2();
226873
226889
  init_esm();
@@ -227029,11 +227045,14 @@ var init_agentService = __esm({
227029
227045
  const allModels = models.getModels(providerId);
227030
227046
  model = allModels[0];
227031
227047
  }
227032
- if (this.auth.provider === EModelProvider.LINKQUE && model && (this.options.agentId || this.options.runId || this.options.chatId || this.options.userId || this.options.requestSource)) {
227048
+ if (this.auth.provider === EModelProvider.LINKQUE && model && (this.options.agentId || this.options.runId || this.options.chatId || this.options.userId || this.options.requestSource || this.options.executionScene)) {
227033
227049
  model = {
227034
227050
  ...model,
227035
227051
  headers: {
227036
227052
  ...model.headers,
227053
+ ...this.options.executionScene && {
227054
+ [EXECUTION_SCENE_HEADER]: this.options.executionScene
227055
+ },
227037
227056
  ...this.options.requestSource && {
227038
227057
  [LINKQUE_REQUEST_SOURCE_HEADER]: this.options.requestSource
227039
227058
  },
@@ -227219,6 +227238,7 @@ var import_node_crypto11, FOLLOW_UP_QUESTION_MODEL_ID, FOLLOW_UP_QUESTION_TOOL_N
227219
227238
  var init_followUpQuestionGenerator = __esm({
227220
227239
  "../linkque-agent-runtime/dist/esm/impl/agent/pi/followUpQuestionGenerator.js"() {
227221
227240
  "use strict";
227241
+ init_executionScene();
227222
227242
  init_observe();
227223
227243
  init_compat2();
227224
227244
  init_telemetry();
@@ -227257,6 +227277,7 @@ var init_followUpQuestionGenerator = __esm({
227257
227277
  ...model,
227258
227278
  headers: {
227259
227279
  ...model.headers,
227280
+ ...input.executionScene ? { [EXECUTION_SCENE_HEADER]: input.executionScene } : {},
227260
227281
  ...input.requestSource ? { [LINKQUE_REQUEST_SOURCE_HEADER]: input.requestSource } : {},
227261
227282
  ...input.runtimeContext?.agentId ? { [LINKQUE_AGENT_ID_HEADER]: input.runtimeContext.agentId } : {},
227262
227283
  [LINKQUE_RUN_ID_HEADER]: input.runId,
@@ -227554,6 +227575,7 @@ var init_piAgentLoop = __esm({
227554
227575
  // chatId/userId 透传:注入 x-chat-id / x-user-id 请求头,供网关会话/用户归因。
227555
227576
  ...req.chatId !== void 0 && { chatId: req.chatId },
227556
227577
  ...req.userId !== void 0 && { userId: req.userId },
227578
+ executionScene: req.executionScene,
227557
227579
  ...req.requestSource !== void 0 && {
227558
227580
  requestSource: req.requestSource
227559
227581
  },
@@ -229806,6 +229828,7 @@ var init_agentRuntime = __esm({
229806
229828
  observation,
229807
229829
  runtimeContext: input.runtimeContext,
229808
229830
  requestSource: input.requestSource,
229831
+ executionScene: input.executionScene,
229809
229832
  debugLog: this.portsDebugLog
229810
229833
  }));
229811
229834
  }
@@ -230152,6 +230175,8 @@ var init_agentRuntime = __esm({
230152
230175
  historyTurns: structuredClone(history),
230153
230176
  currentTurns: structuredClone(newTurns),
230154
230177
  effectiveModel: model,
230178
+ executionScene: options.executionScene,
230179
+ requestSource: options.requestSource,
230155
230180
  agentConfig: structuredClone(this.effectiveAgentConfig),
230156
230181
  agentId: options.runtimeContext?.agentId ?? this.agentId,
230157
230182
  userId: options.runtimeContext?.userId,
@@ -230254,6 +230279,9 @@ var init_agentRuntime = __esm({
230254
230279
  agentReq.runId = request2.runId;
230255
230280
  if (options.requestSource)
230256
230281
  agentReq.requestSource = options.requestSource;
230282
+ if (options.executionScene) {
230283
+ agentReq.executionScene = options.executionScene;
230284
+ }
230257
230285
  if (options.runtimeContext?.threadId)
230258
230286
  agentReq.chatId = options.runtimeContext.threadId;
230259
230287
  if (options.runtimeContext?.userId)
@@ -230448,6 +230476,9 @@ async function* runConversation(request2, auth2, options = {}) {
230448
230476
  const ports = options.agentLoop ? { agentLoop: options.agentLoop } : void 0;
230449
230477
  const runtime = options.runtime ?? (options.protocol ? AgentRuntime.create(options.protocol, ports) : new AgentRuntime(ports));
230450
230478
  const runOptions = {};
230479
+ if (options.executionScene !== void 0) {
230480
+ runOptions.executionScene = options.executionScene;
230481
+ }
230451
230482
  if (options.runAuthorization)
230452
230483
  runOptions.runAuthorization = options.runAuthorization;
230453
230484
  if (options.sessionId !== void 0)
@@ -230814,6 +230845,12 @@ function createImageTool(image, input, options, rules) {
230814
230845
  headers: {
230815
230846
  "content-type": "application/json",
230816
230847
  "x-api-key": key2,
230848
+ ...input.executionScene && {
230849
+ [EXECUTION_SCENE_HEADER]: input.executionScene
230850
+ },
230851
+ ...input.requestSource && {
230852
+ "x-linkque-source": input.requestSource
230853
+ },
230817
230854
  "x-agent-id": input.agentId,
230818
230855
  "x-run-id": input.runId,
230819
230856
  "x-chat-id": input.threadId,
@@ -230885,6 +230922,7 @@ function createImageTool(image, input, options, rules) {
230885
230922
  var init_tool2 = __esm({
230886
230923
  "../linkque-agent-runtime/dist/esm/impl/plugin/imageUnderstanding/tool.js"() {
230887
230924
  "use strict";
230925
+ init_executionScene();
230888
230926
  init_esm();
230889
230927
  init_abort();
230890
230928
  init_cancellationScope();
@@ -231416,6 +231454,7 @@ var init_plugin = __esm({
231416
231454
  });
231417
231455
 
231418
231456
  // ../linkque-agent-runtime/dist/esm/core/index.js
231457
+ init_executionScene();
231419
231458
  init_mcpExecutionResult();
231420
231459
 
231421
231460
  // ../linkque-agent-runtime/dist/esm/core/modelRequestSource.js
@@ -240559,7 +240598,7 @@ async function readAgentCardBindings(configPath, input) {
240559
240598
  resource.config = {
240560
240599
  ...binding,
240561
240600
  definitionRef: {
240562
- format: "linkque-a2ui",
240601
+ format: binding.format ?? "linkque-a2ui",
240563
240602
  checksum: import_path4.default.basename(import_path4.default.dirname(binding.definitionRef)),
240564
240603
  objectName: binding.definitionRef
240565
240604
  }
@@ -240772,6 +240811,7 @@ var handleSandboxChat = async (req, res, deps, activeRuns2, cancelActiveRun2) =>
240772
240811
  ...runtime ? { runtime } : { protocol },
240773
240812
  // 保持 CJS worker 对 runtime 的 type-only 依赖,不能为枚举静态加载 ESM runtime。
240774
240813
  requestSource: "LINKQUE_EDITOR",
240814
+ executionScene: "SANDBOX_PREVIEW",
240775
240815
  sessionId: request2.threadId,
240776
240816
  cwd: deps.cwd,
240777
240817
  signal: abort.signal,