linkque-cli-v2 1.6.2 → 1.6.4

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.
Files changed (25) hide show
  1. package/dev/worker.js +16 -3
  2. package/linkquejs.js +1030 -644
  3. package/package.json +1 -1
  4. package/vendor/linkque-agent-appwrite-integrate/dist/esm/anthropic-messages-GSYNBLMR.js +17 -0
  5. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-HVAVRLTK.js → azure-openai-responses-NPKMM3LF.js} +7 -9
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-2HV35GH7.js → chunk-CO4I3RJE.js} +15 -2
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Q2Y6LMNC.js → chunk-J4JCPZDI.js} +5 -7
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-4XAZNSEQ.js → chunk-JMBJJF7P.js} +18 -5
  9. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{anthropic-messages-5DOLTIGP.js → chunk-KDHBKVSL.js} +14 -15
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-SDEXPSW4.js → chunk-UZS5YLV2.js} +1 -1
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-2CFN5G5A.js → chunk-VBERH5QM.js} +419 -73
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Y3G4J3TB.js → chunk-XOLFZ4XS.js} +316 -1
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-ZPLSQEAM.js → dist-TGBYXSBU.js} +27 -42
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-OLT56CSV.js → google-generative-ai-KD7MXONK.js} +8 -10
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-4DBBJ7SR.js → google-vertex-TREYA472.js} +9 -11
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-OEBGEDLQ.js → mistral-conversations-OEOTQWE5.js} +7 -9
  17. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-3KOC6KHN.js → openai-codex-responses-GEFKSNVN.js} +10 -12
  18. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-HG6OJRL5.js → openai-completions-TAACO6T5.js} +13 -15
  19. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-F6V2PG3Y.js → openai-responses-4DDTXIGI.js} +12 -14
  20. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +197 -61
  21. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
  22. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
  23. package/worker.js +387 -106
  24. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-RYONFGPP.js +0 -317
  25. package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-DC4DVRAJ.js → pi-messages-7JN3W3BC.js} +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkque-cli-v2",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Public Linkque CLI bundle for sandbox debugging",
5
5
  "bin": {
6
6
  "linkquejs": "linkquejs.js"
@@ -0,0 +1,17 @@
1
+ import {
2
+ stream,
3
+ streamSimple
4
+ } from "./chunk-KDHBKVSL.js";
5
+ import "./chunk-HTG7JBF2.js";
6
+ import "./chunk-XMVFOHGJ.js";
7
+ import "./chunk-B5XRGKYX.js";
8
+ import "./chunk-WJHOHUET.js";
9
+ import "./chunk-XOLFZ4XS.js";
10
+ import "./chunk-46SEH6ER.js";
11
+ import "./chunk-CT4G24PS.js";
12
+ import "./chunk-Y6UTJIT4.js";
13
+ import "./chunk-2ESYSVXG.js";
14
+ export {
15
+ stream,
16
+ streamSimple
17
+ };
@@ -2,7 +2,7 @@ import {
2
2
  convertResponsesMessages,
3
3
  convertResponsesTools,
4
4
  processResponsesStream
5
- } from "./chunk-Q2Y6LMNC.js";
5
+ } from "./chunk-J4JCPZDI.js";
6
6
  import "./chunk-UFVAKOTZ.js";
7
7
  import {
8
8
  clampOpenAIPromptCacheKey
@@ -14,23 +14,21 @@ import {
14
14
  formatProviderError,
15
15
  normalizeProviderError
16
16
  } from "./chunk-NKEOCGYU.js";
17
- import {
18
- buildBaseOptions
19
- } from "./chunk-RYONFGPP.js";
20
- import "./chunk-CT4G24PS.js";
21
- import {
22
- headersToRecord
23
- } from "./chunk-Y6UTJIT4.js";
24
17
  import {
25
18
  getProviderEnvValue
26
19
  } from "./chunk-B5XRGKYX.js";
27
20
  import "./chunk-WJHOHUET.js";
28
21
  import {
22
+ buildBaseOptions,
29
23
  clampThinkingLevel
30
- } from "./chunk-Y3G4J3TB.js";
24
+ } from "./chunk-XOLFZ4XS.js";
31
25
  import {
32
26
  AssistantMessageEventStream
33
27
  } from "./chunk-46SEH6ER.js";
28
+ import "./chunk-CT4G24PS.js";
29
+ import {
30
+ headersToRecord
31
+ } from "./chunk-Y6UTJIT4.js";
34
32
  import "./chunk-2ESYSVXG.js";
35
33
 
36
34
  // ../../node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js
@@ -22,7 +22,7 @@ import {
22
22
  RUNTIME_CONFIG_DEFAULTS,
23
23
  RuntimeConfigProvider,
24
24
  isDebugLoggingEnabled
25
- } from "./chunk-2CFN5G5A.js";
25
+ } from "./chunk-VBERH5QM.js";
26
26
  import {
27
27
  __commonJS,
28
28
  __require,
@@ -15323,6 +15323,19 @@ var LinkqueGatewayAuthUnconfiguredError = class extends Error {
15323
15323
  this.name = "LinkqueGatewayAuthUnconfiguredError";
15324
15324
  }
15325
15325
  };
15326
+ function resolveLinkqueGatewayRequestAuth(headers, env = process.env, logCtx) {
15327
+ const users = Object.entries(headers ?? {}).filter(([key]) => key.toLowerCase() === "x-appwrite-user-id");
15328
+ if (users.length > 1 || users.length === 1 && typeof users[0]?.[1] !== "string") {
15329
+ throw new LinkqueGatewayAuthError("Appwrite\u7528\u6237\u8EAB\u4EFD\u65E0\u6548");
15330
+ }
15331
+ const userId = users[0]?.[1]?.trim();
15332
+ const hasToken = Object.keys(headers ?? {}).some((key) => key.toLowerCase() === LINKQUE_AUTHORIZATION_HEADER);
15333
+ if (userId?.startsWith("lqs_") && !hasToken) {
15334
+ logCtx?.error?.("[auth-resolve] stage=failed, reason=scenario-user-token-required");
15335
+ throw new LinkqueGatewayAuthError("\u573A\u666F\u7528\u6237\u51ED\u8BC1\u7F3A\u5931\uFF0C\u8BF7\u4ECE\u90E8\u7F72\u5165\u53E3\u91CD\u65B0\u767B\u5F55");
15336
+ }
15337
+ return resolveLinkqueGatewayAuth(headers, env, logCtx);
15338
+ }
15326
15339
  function resolveLinkqueGatewayAuth(headers, env = process.env, logCtx) {
15327
15340
  const config = new AppbaseRuntimeConfigProvider({ ...env });
15328
15341
  const log = (...a2) => logCtx?.log?.("[auth-resolve]", ...a2);
@@ -15882,7 +15895,7 @@ export {
15882
15895
  describeRuntimeEnv,
15883
15896
  LinkqueGatewayAuthError,
15884
15897
  LinkqueGatewayAuthUnconfiguredError,
15885
- resolveLinkqueGatewayAuth,
15898
+ resolveLinkqueGatewayRequestAuth,
15886
15899
  resolveGatewayAuthContext,
15887
15900
  resolveBodyJSON,
15888
15901
  toAgentRunMessages,
@@ -2,17 +2,15 @@ import {
2
2
  shortHash
3
3
  } from "./chunk-UFVAKOTZ.js";
4
4
  import {
5
+ parseStreamingJson
6
+ } from "./chunk-WJHOHUET.js";
7
+ import {
8
+ calculateCost,
5
9
  transformMessages
6
- } from "./chunk-RYONFGPP.js";
10
+ } from "./chunk-XOLFZ4XS.js";
7
11
  import {
8
12
  sanitizeSurrogates
9
13
  } from "./chunk-CT4G24PS.js";
10
- import {
11
- parseStreamingJson
12
- } from "./chunk-WJHOHUET.js";
13
- import {
14
- calculateCost
15
- } from "./chunk-Y3G4J3TB.js";
16
14
 
17
15
  // ../../node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
18
16
  function encodeTextSignatureV1(id, phase) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  transformMessages
3
- } from "./chunk-RYONFGPP.js";
3
+ } from "./chunk-XOLFZ4XS.js";
4
4
  import {
5
5
  sanitizeSurrogates
6
6
  } from "./chunk-CT4G24PS.js";
@@ -1324,7 +1324,7 @@ Content-Type: ${partContentType}\r
1324
1324
  * @returns A proxy agent
1325
1325
  */
1326
1326
  static async #getProxyAgent() {
1327
- this.#proxyAgent ||= (await import("./dist-ZPLSQEAM.js")).HttpsProxyAgent;
1327
+ this.#proxyAgent ||= (await import("./dist-TGBYXSBU.js")).HttpsProxyAgent;
1328
1328
  return this.#proxyAgent;
1329
1329
  }
1330
1330
  static async #getFetch() {
@@ -11618,11 +11618,23 @@ var require_websocket = __commonJS({
11618
11618
  this._isServer = false;
11619
11619
  this._redirects = 0;
11620
11620
  if (protocols === void 0) {
11621
- protocols = [];
11621
+ if (!options || options.protocols === void 0) {
11622
+ protocols = [];
11623
+ } else if (Array.isArray(options.protocols)) {
11624
+ protocols = options.protocols;
11625
+ } else {
11626
+ protocols = [options.protocols];
11627
+ }
11622
11628
  } else if (!Array.isArray(protocols)) {
11623
11629
  if (typeof protocols === "object" && protocols !== null) {
11624
11630
  options = protocols;
11625
- protocols = [];
11631
+ if (options.protocols === void 0) {
11632
+ protocols = [];
11633
+ } else if (Array.isArray(options.protocols)) {
11634
+ protocols = options.protocols;
11635
+ } else {
11636
+ protocols = [options.protocols];
11637
+ }
11626
11638
  } else {
11627
11639
  protocols = [protocols];
11628
11640
  }
@@ -11819,7 +11831,6 @@ var require_websocket = __commonJS({
11819
11831
  }
11820
11832
  return;
11821
11833
  }
11822
- this._readyState = _WebSocket.CLOSING;
11823
11834
  this._sender.close(code, data, !this._isServer, (err) => {
11824
11835
  if (err) return;
11825
11836
  this._closeFrameSent = true;
@@ -11827,6 +11838,7 @@ var require_websocket = __commonJS({
11827
11838
  this._socket.end();
11828
11839
  }
11829
11840
  });
11841
+ this._readyState = _WebSocket.CLOSING;
11830
11842
  setCloseTimer(this);
11831
11843
  }
11832
11844
  /**
@@ -12051,6 +12063,7 @@ var require_websocket = __commonJS({
12051
12063
  socketPath: void 0,
12052
12064
  hostname: void 0,
12053
12065
  protocol: void 0,
12066
+ protocols: void 0,
12054
12067
  timeout: void 0,
12055
12068
  method: "GET",
12056
12069
  host: void 0,
@@ -5,18 +5,6 @@ import {
5
5
  buildCopilotDynamicHeaders,
6
6
  hasCopilotVisionInput
7
7
  } from "./chunk-XMVFOHGJ.js";
8
- import {
9
- adjustMaxTokensForThinking,
10
- buildBaseOptions,
11
- clampMaxTokensToContext,
12
- transformMessages
13
- } from "./chunk-RYONFGPP.js";
14
- import {
15
- sanitizeSurrogates
16
- } from "./chunk-CT4G24PS.js";
17
- import {
18
- headersToRecord
19
- } from "./chunk-Y6UTJIT4.js";
20
8
  import {
21
9
  getProviderEnvValue
22
10
  } from "./chunk-B5XRGKYX.js";
@@ -25,12 +13,21 @@ import {
25
13
  parseStreamingJson
26
14
  } from "./chunk-WJHOHUET.js";
27
15
  import {
28
- calculateCost
29
- } from "./chunk-Y3G4J3TB.js";
16
+ adjustMaxTokensForThinking,
17
+ buildBaseOptions,
18
+ calculateCost,
19
+ clampMaxTokensToContext,
20
+ transformMessages
21
+ } from "./chunk-XOLFZ4XS.js";
30
22
  import {
31
23
  AssistantMessageEventStream
32
24
  } from "./chunk-46SEH6ER.js";
33
- import "./chunk-2ESYSVXG.js";
25
+ import {
26
+ sanitizeSurrogates
27
+ } from "./chunk-CT4G24PS.js";
28
+ import {
29
+ headersToRecord
30
+ } from "./chunk-Y6UTJIT4.js";
34
31
 
35
32
  // ../../node_modules/@anthropic-ai/sdk/internal/tslib.mjs
36
33
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
@@ -7166,7 +7163,9 @@ function mapStopReason(reason, stopDetails) {
7166
7163
  throw new Error(`Unhandled stop reason: ${reason}`);
7167
7164
  }
7168
7165
  }
7166
+
7169
7167
  export {
7168
+ Anthropic,
7170
7169
  stream,
7171
7170
  streamSimple
7172
7171
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EModelProvider
3
- } from "./chunk-2CFN5G5A.js";
3
+ } from "./chunk-VBERH5QM.js";
4
4
 
5
5
  // ../linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js
6
6
  var baked;