linkque-cli-v2 1.6.20 → 1.6.22
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/dev/worker.js +61 -17
- package/linkquejs.js +294 -161
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-WHXLLQZR.js → chunk-27TIUPEZ.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-JMBJJF7P.js → chunk-2QJITP7G.js} +62 -18
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-5MR5ICJ4.js → chunk-5YW4CWBG.js} +2988 -2022
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-22EQ6RXO.js → chunk-Q6N5427R.js} +3019 -168
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{dist-TGBYXSBU.js → dist-6U5W3RLM.js} +74 -95
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-generative-ai-KD7MXONK.js → google-generative-ai-RT2OOQDJ.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{google-vertex-TREYA472.js → google-vertex-HVFMVQVY.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-5EI6JQBZ.js → mistral-conversations-KIOTOF73.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{otel-RUUFBBFE.js → otel-LQR5KPZ3.js} +578 -266
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +1357 -658
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -3
- package/worker.js +6028 -4038
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-EAODRPW4.js +0 -518
package/linkquejs.js
CHANGED
|
@@ -3836,11 +3836,11 @@ var require_codegen = __commonJS({
|
|
|
3836
3836
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3837
3837
|
return `${varKind} ${this.name}${rhs};` + _n2;
|
|
3838
3838
|
}
|
|
3839
|
-
optimizeNames(names,
|
|
3839
|
+
optimizeNames(names, constants2) {
|
|
3840
3840
|
if (!names[this.name.str])
|
|
3841
3841
|
return;
|
|
3842
3842
|
if (this.rhs)
|
|
3843
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
3843
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
3844
3844
|
return this;
|
|
3845
3845
|
}
|
|
3846
3846
|
get names() {
|
|
@@ -3857,10 +3857,10 @@ var require_codegen = __commonJS({
|
|
|
3857
3857
|
render({ _n: _n2 }) {
|
|
3858
3858
|
return `${this.lhs} = ${this.rhs};` + _n2;
|
|
3859
3859
|
}
|
|
3860
|
-
optimizeNames(names,
|
|
3860
|
+
optimizeNames(names, constants2) {
|
|
3861
3861
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
3862
3862
|
return;
|
|
3863
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
3863
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
3864
3864
|
return this;
|
|
3865
3865
|
}
|
|
3866
3866
|
get names() {
|
|
@@ -3921,8 +3921,8 @@ var require_codegen = __commonJS({
|
|
|
3921
3921
|
optimizeNodes() {
|
|
3922
3922
|
return `${this.code}` ? this : void 0;
|
|
3923
3923
|
}
|
|
3924
|
-
optimizeNames(names,
|
|
3925
|
-
this.code = optimizeExpr(this.code, names,
|
|
3924
|
+
optimizeNames(names, constants2) {
|
|
3925
|
+
this.code = optimizeExpr(this.code, names, constants2);
|
|
3926
3926
|
return this;
|
|
3927
3927
|
}
|
|
3928
3928
|
get names() {
|
|
@@ -3951,12 +3951,12 @@ var require_codegen = __commonJS({
|
|
|
3951
3951
|
}
|
|
3952
3952
|
return nodes.length > 0 ? this : void 0;
|
|
3953
3953
|
}
|
|
3954
|
-
optimizeNames(names,
|
|
3954
|
+
optimizeNames(names, constants2) {
|
|
3955
3955
|
const { nodes } = this;
|
|
3956
3956
|
let i = nodes.length;
|
|
3957
3957
|
while (i--) {
|
|
3958
3958
|
const n3 = nodes[i];
|
|
3959
|
-
if (n3.optimizeNames(names,
|
|
3959
|
+
if (n3.optimizeNames(names, constants2))
|
|
3960
3960
|
continue;
|
|
3961
3961
|
subtractNames(names, n3.names);
|
|
3962
3962
|
nodes.splice(i, 1);
|
|
@@ -4009,12 +4009,12 @@ var require_codegen = __commonJS({
|
|
|
4009
4009
|
return void 0;
|
|
4010
4010
|
return this;
|
|
4011
4011
|
}
|
|
4012
|
-
optimizeNames(names,
|
|
4012
|
+
optimizeNames(names, constants2) {
|
|
4013
4013
|
var _a;
|
|
4014
|
-
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
4015
|
-
if (!(super.optimizeNames(names,
|
|
4014
|
+
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
|
|
4015
|
+
if (!(super.optimizeNames(names, constants2) || this.else))
|
|
4016
4016
|
return;
|
|
4017
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
4017
|
+
this.condition = optimizeExpr(this.condition, names, constants2);
|
|
4018
4018
|
return this;
|
|
4019
4019
|
}
|
|
4020
4020
|
get names() {
|
|
@@ -4037,10 +4037,10 @@ var require_codegen = __commonJS({
|
|
|
4037
4037
|
render(opts) {
|
|
4038
4038
|
return `for(${this.iteration})` + super.render(opts);
|
|
4039
4039
|
}
|
|
4040
|
-
optimizeNames(names,
|
|
4041
|
-
if (!super.optimizeNames(names,
|
|
4040
|
+
optimizeNames(names, constants2) {
|
|
4041
|
+
if (!super.optimizeNames(names, constants2))
|
|
4042
4042
|
return;
|
|
4043
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
4043
|
+
this.iteration = optimizeExpr(this.iteration, names, constants2);
|
|
4044
4044
|
return this;
|
|
4045
4045
|
}
|
|
4046
4046
|
get names() {
|
|
@@ -4076,10 +4076,10 @@ var require_codegen = __commonJS({
|
|
|
4076
4076
|
render(opts) {
|
|
4077
4077
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
4078
4078
|
}
|
|
4079
|
-
optimizeNames(names,
|
|
4080
|
-
if (!super.optimizeNames(names,
|
|
4079
|
+
optimizeNames(names, constants2) {
|
|
4080
|
+
if (!super.optimizeNames(names, constants2))
|
|
4081
4081
|
return;
|
|
4082
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
4082
|
+
this.iterable = optimizeExpr(this.iterable, names, constants2);
|
|
4083
4083
|
return this;
|
|
4084
4084
|
}
|
|
4085
4085
|
get names() {
|
|
@@ -4121,11 +4121,11 @@ var require_codegen = __commonJS({
|
|
|
4121
4121
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
4122
4122
|
return this;
|
|
4123
4123
|
}
|
|
4124
|
-
optimizeNames(names,
|
|
4124
|
+
optimizeNames(names, constants2) {
|
|
4125
4125
|
var _a, _b;
|
|
4126
|
-
super.optimizeNames(names,
|
|
4127
|
-
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
4128
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
4126
|
+
super.optimizeNames(names, constants2);
|
|
4127
|
+
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
|
|
4128
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
|
|
4129
4129
|
return this;
|
|
4130
4130
|
}
|
|
4131
4131
|
get names() {
|
|
@@ -4426,7 +4426,7 @@ var require_codegen = __commonJS({
|
|
|
4426
4426
|
function addExprNames(names, from) {
|
|
4427
4427
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
4428
4428
|
}
|
|
4429
|
-
function optimizeExpr(expr, names,
|
|
4429
|
+
function optimizeExpr(expr, names, constants2) {
|
|
4430
4430
|
if (expr instanceof code_1.Name)
|
|
4431
4431
|
return replaceName(expr);
|
|
4432
4432
|
if (!canOptimize(expr))
|
|
@@ -4441,14 +4441,14 @@ var require_codegen = __commonJS({
|
|
|
4441
4441
|
return items;
|
|
4442
4442
|
}, []));
|
|
4443
4443
|
function replaceName(n3) {
|
|
4444
|
-
const c =
|
|
4444
|
+
const c = constants2[n3.str];
|
|
4445
4445
|
if (c === void 0 || names[n3.str] !== 1)
|
|
4446
4446
|
return n3;
|
|
4447
4447
|
delete names[n3.str];
|
|
4448
4448
|
return c;
|
|
4449
4449
|
}
|
|
4450
4450
|
function canOptimize(e3) {
|
|
4451
|
-
return e3 instanceof code_1._Code && e3._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
4451
|
+
return e3 instanceof code_1._Code && e3._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
|
|
4452
4452
|
}
|
|
4453
4453
|
}
|
|
4454
4454
|
function subtractNames(names, from) {
|
|
@@ -17205,7 +17205,7 @@ var require_client_h1 = __commonJS({
|
|
|
17205
17205
|
kResume,
|
|
17206
17206
|
kHTTPContext
|
|
17207
17207
|
} = require_symbols();
|
|
17208
|
-
var
|
|
17208
|
+
var constants2 = require_constants2();
|
|
17209
17209
|
var EMPTY_BUF = Buffer.alloc(0);
|
|
17210
17210
|
var FastBuffer = Buffer[Symbol.species];
|
|
17211
17211
|
var addListener = util2.addListener;
|
|
@@ -17275,7 +17275,7 @@ var require_client_h1 = __commonJS({
|
|
|
17275
17275
|
constructor(client, socket, { exports: exports3 }) {
|
|
17276
17276
|
assert2(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
|
|
17277
17277
|
this.llhttp = exports3;
|
|
17278
|
-
this.ptr = this.llhttp.llhttp_alloc(
|
|
17278
|
+
this.ptr = this.llhttp.llhttp_alloc(constants2.TYPE.RESPONSE);
|
|
17279
17279
|
this.client = client;
|
|
17280
17280
|
this.socket = socket;
|
|
17281
17281
|
this.timeout = null;
|
|
@@ -17367,19 +17367,19 @@ var require_client_h1 = __commonJS({
|
|
|
17367
17367
|
currentBufferRef = null;
|
|
17368
17368
|
}
|
|
17369
17369
|
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
|
|
17370
|
-
if (ret ===
|
|
17370
|
+
if (ret === constants2.ERROR.PAUSED_UPGRADE) {
|
|
17371
17371
|
this.onUpgrade(data.slice(offset));
|
|
17372
|
-
} else if (ret ===
|
|
17372
|
+
} else if (ret === constants2.ERROR.PAUSED) {
|
|
17373
17373
|
this.paused = true;
|
|
17374
17374
|
socket.unshift(data.slice(offset));
|
|
17375
|
-
} else if (ret !==
|
|
17375
|
+
} else if (ret !== constants2.ERROR.OK) {
|
|
17376
17376
|
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
|
17377
17377
|
let message = "";
|
|
17378
17378
|
if (ptr) {
|
|
17379
17379
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
17380
17380
|
message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
17381
17381
|
}
|
|
17382
|
-
throw new HTTPParserError(message,
|
|
17382
|
+
throw new HTTPParserError(message, constants2.ERROR[ret], data.slice(offset));
|
|
17383
17383
|
}
|
|
17384
17384
|
} catch (err) {
|
|
17385
17385
|
util2.destroy(socket, err);
|
|
@@ -17554,7 +17554,7 @@ var require_client_h1 = __commonJS({
|
|
|
17554
17554
|
socket[kBlocking] = false;
|
|
17555
17555
|
client[kResume]();
|
|
17556
17556
|
}
|
|
17557
|
-
return pause ?
|
|
17557
|
+
return pause ? constants2.ERROR.PAUSED : 0;
|
|
17558
17558
|
}
|
|
17559
17559
|
onBody(buf) {
|
|
17560
17560
|
const { client, socket, statusCode, maxResponseSize } = this;
|
|
@@ -17576,7 +17576,7 @@ var require_client_h1 = __commonJS({
|
|
|
17576
17576
|
}
|
|
17577
17577
|
this.bytesRead += buf.length;
|
|
17578
17578
|
if (request2.onData(buf) === false) {
|
|
17579
|
-
return
|
|
17579
|
+
return constants2.ERROR.PAUSED;
|
|
17580
17580
|
}
|
|
17581
17581
|
}
|
|
17582
17582
|
onMessageComplete() {
|
|
@@ -17611,13 +17611,13 @@ var require_client_h1 = __commonJS({
|
|
|
17611
17611
|
if (socket[kWriting]) {
|
|
17612
17612
|
assert2.strictEqual(client[kRunning], 0);
|
|
17613
17613
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17614
|
-
return
|
|
17614
|
+
return constants2.ERROR.PAUSED;
|
|
17615
17615
|
} else if (!shouldKeepAlive) {
|
|
17616
17616
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17617
|
-
return
|
|
17617
|
+
return constants2.ERROR.PAUSED;
|
|
17618
17618
|
} else if (socket[kReset] && client[kRunning] === 0) {
|
|
17619
17619
|
util2.destroy(socket, new InformationalError("reset"));
|
|
17620
|
-
return
|
|
17620
|
+
return constants2.ERROR.PAUSED;
|
|
17621
17621
|
} else if (client[kPipelining] == null || client[kPipelining] === 1) {
|
|
17622
17622
|
setImmediate(() => client[kResume]());
|
|
17623
17623
|
} else {
|
|
@@ -38011,6 +38011,15 @@ var loadAgentProtocol = async (rawConfigPath, cwd) => {
|
|
|
38011
38011
|
return root;
|
|
38012
38012
|
};
|
|
38013
38013
|
|
|
38014
|
+
// ../linkque-agent-runtime/dist/esm/core/executionScene.js
|
|
38015
|
+
var EExecutionScene;
|
|
38016
|
+
(function(EExecutionScene2) {
|
|
38017
|
+
EExecutionScene2["DEVICE_PREVIEW"] = "DEVICE_PREVIEW";
|
|
38018
|
+
EExecutionScene2["SANDBOX_PREVIEW"] = "SANDBOX_PREVIEW";
|
|
38019
|
+
EExecutionScene2["LIVE"] = "LIVE";
|
|
38020
|
+
EExecutionScene2["UNKNOWN"] = "UNKNOWN";
|
|
38021
|
+
})(EExecutionScene || (EExecutionScene = {}));
|
|
38022
|
+
|
|
38014
38023
|
// ../linkque-agent-runtime/dist/esm/core/mcpExecutionResult.js
|
|
38015
38024
|
var EMcpErrorCode;
|
|
38016
38025
|
(function(EMcpErrorCode2) {
|
|
@@ -38401,6 +38410,7 @@ var EResourceType;
|
|
|
38401
38410
|
EResourceType2["CARD"] = "CARD";
|
|
38402
38411
|
EResourceType2["TOOL"] = "TOOL";
|
|
38403
38412
|
EResourceType2["WEB_SEARCH"] = "WEB_SEARCH";
|
|
38413
|
+
EResourceType2["MEMORY"] = "MEMORY";
|
|
38404
38414
|
EResourceType2["FOLLOW_UP_QUESTIONS"] = "FOLLOW_UP_QUESTIONS";
|
|
38405
38415
|
EResourceType2["CLIENT_CAPABILITY"] = "CLIENT_CAPABILITY";
|
|
38406
38416
|
EResourceType2["HOOK"] = "HOOK";
|
|
@@ -38436,7 +38446,9 @@ var EHookExecutorName;
|
|
|
38436
38446
|
EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
|
|
38437
38447
|
EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
|
|
38438
38448
|
EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
|
|
38449
|
+
EHookExecutorName2["BusinessDataPromptHookExecutor"] = "BusinessDataPromptHookExecutor";
|
|
38439
38450
|
EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
|
|
38451
|
+
EHookExecutorName2["MemoryHookExecutor"] = "MemoryHookExecutor";
|
|
38440
38452
|
})(EHookExecutorName || (EHookExecutorName = {}));
|
|
38441
38453
|
|
|
38442
38454
|
// ../agent-a2ui-card-contract/dist/esm/protocol.js
|
|
@@ -38462,7 +38474,10 @@ function isPlainRecord(value) {
|
|
|
38462
38474
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
38463
38475
|
return false;
|
|
38464
38476
|
const prototype = Object.getPrototypeOf(value);
|
|
38465
|
-
|
|
38477
|
+
if (prototype === Object.prototype || prototype === null)
|
|
38478
|
+
return true;
|
|
38479
|
+
const constructor = Object.getOwnPropertyDescriptor(prototype, "constructor")?.value;
|
|
38480
|
+
return Object.getPrototypeOf(prototype) === null && typeof constructor === "function" && Function.prototype.toString.call(constructor) === Function.prototype.toString.call(Object);
|
|
38466
38481
|
}
|
|
38467
38482
|
function isJsonValue(value) {
|
|
38468
38483
|
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
@@ -41903,7 +41918,7 @@ function sha256Hex(value) {
|
|
|
41903
41918
|
const bitLength = bytes.length * 8;
|
|
41904
41919
|
words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
|
|
41905
41920
|
words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
|
|
41906
|
-
const
|
|
41921
|
+
const constants2 = SHA256_CONSTANTS;
|
|
41907
41922
|
let state = [
|
|
41908
41923
|
1779033703,
|
|
41909
41924
|
3144134277,
|
|
@@ -41930,7 +41945,7 @@ function sha256Hex(value) {
|
|
|
41930
41945
|
for (let index = 0; index < 64; index += 1) {
|
|
41931
41946
|
const sum1 = rotateRight(e3, 6) ^ rotateRight(e3, 11) ^ rotateRight(e3, 25);
|
|
41932
41947
|
const choice = e3 & f3 ^ ~e3 & g2;
|
|
41933
|
-
const temporary1 = add(h, sum1, choice,
|
|
41948
|
+
const temporary1 = add(h, sum1, choice, constants2[index], schedule[index]);
|
|
41934
41949
|
const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
|
|
41935
41950
|
const majority = a & b3 ^ a & c ^ b3 & c;
|
|
41936
41951
|
const temporary2 = add(sum0, majority);
|
|
@@ -47447,6 +47462,10 @@ var MCP_PROXY_DESCRIPTION = [
|
|
|
47447
47462
|
"\u4EC5 mcp({}) \u5217\u51FA\u7684\u5DE5\u5177\u53EF\u8C03\u7528(\u672A\u58F0\u660E\u7684\u5DE5\u5177\u4E0D\u4F1A\u51FA\u73B0)\u3002"
|
|
47448
47463
|
].join("\n");
|
|
47449
47464
|
|
|
47465
|
+
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
47466
|
+
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
47467
|
+
var APP_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u5C0F\u7A0B\u5E8F\u6807\u8BC6");
|
|
47468
|
+
|
|
47450
47469
|
// ../linkque-agent-runtime/dist/esm/core/telemetry/telemetryEnums.js
|
|
47451
47470
|
var ETelemetryDiagnosticCode;
|
|
47452
47471
|
(function(ETelemetryDiagnosticCode2) {
|
|
@@ -47524,6 +47543,24 @@ var LINKQUEGW_EVENT_TYPE_BY_STAGE = {
|
|
|
47524
47543
|
[EHookStage.RUN_READ]: "RUN_READ"
|
|
47525
47544
|
};
|
|
47526
47545
|
|
|
47546
|
+
// ../linkque-agent-runtime/dist/esm/core/memoryAdapter.js
|
|
47547
|
+
var EMemoryType;
|
|
47548
|
+
(function(EMemoryType2) {
|
|
47549
|
+
EMemoryType2["CONVERSATION"] = "conversation";
|
|
47550
|
+
EMemoryType2["LONG_TERM"] = "long_term";
|
|
47551
|
+
EMemoryType2["SHORT_TERM"] = "short_term";
|
|
47552
|
+
EMemoryType2["WORKING"] = "working";
|
|
47553
|
+
EMemoryType2["PREFERENCE"] = "preference";
|
|
47554
|
+
EMemoryType2["FACT"] = "fact";
|
|
47555
|
+
EMemoryType2["ACTION"] = "action";
|
|
47556
|
+
})(EMemoryType || (EMemoryType = {}));
|
|
47557
|
+
var EMemorySummaryStatus;
|
|
47558
|
+
(function(EMemorySummaryStatus2) {
|
|
47559
|
+
EMemorySummaryStatus2["COMPLETED"] = "completed";
|
|
47560
|
+
EMemorySummaryStatus2["FAILED"] = "failed";
|
|
47561
|
+
EMemorySummaryStatus2["CANCELLED"] = "cancelled";
|
|
47562
|
+
})(EMemorySummaryStatus || (EMemorySummaryStatus = {}));
|
|
47563
|
+
|
|
47527
47564
|
// ../../node_modules/zod/v4/core/core.js
|
|
47528
47565
|
var NEVER2 = Object.freeze({
|
|
47529
47566
|
status: "aborted"
|
|
@@ -53188,10 +53225,6 @@ var OAUTH_ERRORS = {
|
|
|
53188
53225
|
var TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
53189
53226
|
var RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
53190
53227
|
|
|
53191
|
-
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
53192
|
-
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
53193
|
-
var APP_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u5C0F\u7A0B\u5E8F\u6807\u8BC6");
|
|
53194
|
-
|
|
53195
53228
|
// ../linkque-agent-runtime/dist/esm/impl/knowledge/linkqueKnowledgeSearchPort.js
|
|
53196
53229
|
var DEFAULT_LINKQUEGW_KNOWLEDGE_BASE_URL = RUNTIME_CONFIG_DEFAULTS.LINKQUEGW_KNOWLEDGE_BASE_URL;
|
|
53197
53230
|
|
|
@@ -53438,6 +53471,8 @@ var APPBASE_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
|
|
|
53438
53471
|
LINKQUE_EMBEDDED_QUERY_ENABLED: "false",
|
|
53439
53472
|
RUN_DATABASE_ID: "linkque",
|
|
53440
53473
|
RUN_TABLE_ID: "linkque_conversation_runs",
|
|
53474
|
+
SESSION_MEMORY_DATABASE_ID: "linkque",
|
|
53475
|
+
SESSION_MEMORY_TABLE_ID: "linkque_session_memories",
|
|
53441
53476
|
SESSION_DATABASE_ID: "linkque",
|
|
53442
53477
|
SESSION_TABLE_ID: "linkque_sessions",
|
|
53443
53478
|
SESSION_LEASE_DATABASE_ID: "linkque",
|
|
@@ -55351,7 +55386,7 @@ var stopAgentServer = async (cwd) => {
|
|
|
55351
55386
|
|
|
55352
55387
|
// src/commands/build/dist.ts
|
|
55353
55388
|
var import_crypto7 = require("crypto");
|
|
55354
|
-
var
|
|
55389
|
+
var import_promises15 = require("fs/promises");
|
|
55355
55390
|
var import_path21 = __toESM(require("path"));
|
|
55356
55391
|
|
|
55357
55392
|
// src/utils/spawn.ts
|
|
@@ -55424,8 +55459,101 @@ var spawnManaged = async (options) => {
|
|
|
55424
55459
|
// src/commands/install.ts
|
|
55425
55460
|
var import_child_process3 = require("child_process");
|
|
55426
55461
|
var import_crypto4 = require("crypto");
|
|
55427
|
-
var
|
|
55462
|
+
var import_promises12 = require("fs/promises");
|
|
55428
55463
|
var import_path18 = __toESM(require("path"));
|
|
55464
|
+
|
|
55465
|
+
// src/utils/installObservation.ts
|
|
55466
|
+
var import_fs8 = require("fs");
|
|
55467
|
+
var import_promises11 = require("fs/promises");
|
|
55468
|
+
var import_util5 = require("util");
|
|
55469
|
+
var MAX_LOG_TAIL_BYTES = 64 * 1024;
|
|
55470
|
+
var COUNTS_LINE = /^\+ (\d+) added · (\d+) reused · (\d+) downloaded(?: \(\d+(?:\.\d+)? (?:B|kB|MB|GB)(?: @ \d+(?:\.\d+)? (?:B|kB|MB|GB)\/s)?\))?$/u;
|
|
55471
|
+
var DURATION_LINE = /^All packages installed \[(?:(?:(\d+)h)?(\d+)m(\d+)s|(\d+(?:\.\d+)?)s)\]$/u;
|
|
55472
|
+
var readInstallLogStart = async (logPath) => {
|
|
55473
|
+
try {
|
|
55474
|
+
const start = await (0, import_promises11.stat)(logPath);
|
|
55475
|
+
return start.isFile() ? start : void 0;
|
|
55476
|
+
} catch (error2) {
|
|
55477
|
+
return isNodeError(error2, "ENOENT") ? null : void 0;
|
|
55478
|
+
}
|
|
55479
|
+
};
|
|
55480
|
+
var readInstallLogSummary = async (logPath, start) => {
|
|
55481
|
+
if (start === void 0) return {};
|
|
55482
|
+
try {
|
|
55483
|
+
const log = await (0, import_promises11.open)(logPath, import_fs8.constants.O_RDONLY | import_fs8.constants.O_NONBLOCK);
|
|
55484
|
+
try {
|
|
55485
|
+
const end = await log.stat();
|
|
55486
|
+
if (!end.isFile() || start && (end.dev !== start.dev || end.ino !== start.ino)) {
|
|
55487
|
+
return {};
|
|
55488
|
+
}
|
|
55489
|
+
const offset = Math.max(start?.size ?? 0, end.size - MAX_LOG_TAIL_BYTES);
|
|
55490
|
+
if (offset >= end.size) return {};
|
|
55491
|
+
const buffer2 = Buffer.alloc(end.size - offset);
|
|
55492
|
+
const { bytesRead } = await log.read(buffer2, 0, buffer2.length, offset);
|
|
55493
|
+
if (bytesRead !== buffer2.length) return {};
|
|
55494
|
+
let tail = buffer2.toString("utf8");
|
|
55495
|
+
if (offset > (start?.size ?? 0)) {
|
|
55496
|
+
const firstLineEnd = tail.search(/[\r\n]/u);
|
|
55497
|
+
if (firstLineEnd === -1) return {};
|
|
55498
|
+
tail = tail.slice(firstLineEnd + 1);
|
|
55499
|
+
}
|
|
55500
|
+
const lines = (0, import_util5.stripVTControlCharacters)(tail).split(/[\r\n]+/u).filter((line) => line.trim());
|
|
55501
|
+
const lastLine = lines.at(-1) ?? "";
|
|
55502
|
+
const hasCompletionLine = lastLine === "All packages installed" || lastLine.startsWith("All packages installed [");
|
|
55503
|
+
const countsLine = hasCompletionLine ? lines.at(-2) ?? "" : lastLine;
|
|
55504
|
+
const counts = COUNTS_LINE.exec(countsLine);
|
|
55505
|
+
const duration3 = DURATION_LINE.exec(lastLine);
|
|
55506
|
+
const summary = {};
|
|
55507
|
+
if (counts && (hasCompletionLine || !lines.slice(0, -1).some((line) => COUNTS_LINE.test(line)))) {
|
|
55508
|
+
const [, rawAdded, rawReused, rawDownloaded] = counts;
|
|
55509
|
+
const added = Number(rawAdded);
|
|
55510
|
+
const reused = Number(rawReused);
|
|
55511
|
+
const downloaded = Number(rawDownloaded);
|
|
55512
|
+
if ([added, reused, downloaded, reused + downloaded].every(
|
|
55513
|
+
Number.isSafeInteger
|
|
55514
|
+
)) {
|
|
55515
|
+
summary.counts = { added, reused, downloaded };
|
|
55516
|
+
}
|
|
55517
|
+
}
|
|
55518
|
+
if (duration3) {
|
|
55519
|
+
const [, hours, minutes, seconds, secondsOnly] = duration3;
|
|
55520
|
+
const durationMs = Math.round(
|
|
55521
|
+
(Number(hours ?? 0) * 3600 + Number(minutes ?? 0) * 60 + Number(seconds ?? secondsOnly)) * 1e3
|
|
55522
|
+
);
|
|
55523
|
+
if (Number.isSafeInteger(durationMs)) {
|
|
55524
|
+
summary.utReportedDurationMs = durationMs;
|
|
55525
|
+
}
|
|
55526
|
+
}
|
|
55527
|
+
return summary;
|
|
55528
|
+
} finally {
|
|
55529
|
+
await log.close();
|
|
55530
|
+
}
|
|
55531
|
+
} catch {
|
|
55532
|
+
return {};
|
|
55533
|
+
}
|
|
55534
|
+
};
|
|
55535
|
+
var runWorkspaceInstall = async (command, cwd, logPath) => {
|
|
55536
|
+
const logStart = await readInstallLogStart(logPath);
|
|
55537
|
+
const startedAt = performance.now();
|
|
55538
|
+
const { exitCode } = await spawnManaged({
|
|
55539
|
+
command,
|
|
55540
|
+
args: ["install"],
|
|
55541
|
+
cwd,
|
|
55542
|
+
logPath,
|
|
55543
|
+
logHeader: `${command} install`
|
|
55544
|
+
});
|
|
55545
|
+
const durationMs = Math.round(performance.now() - startedAt);
|
|
55546
|
+
if (exitCode !== 0) return { exitCode };
|
|
55547
|
+
return {
|
|
55548
|
+
exitCode,
|
|
55549
|
+
installMetrics: {
|
|
55550
|
+
durationMs,
|
|
55551
|
+
...await readInstallLogSummary(logPath, logStart)
|
|
55552
|
+
}
|
|
55553
|
+
};
|
|
55554
|
+
};
|
|
55555
|
+
|
|
55556
|
+
// src/commands/install.ts
|
|
55429
55557
|
var RUNTIME_DIR2 = ".linkque/runtime";
|
|
55430
55558
|
var LOG_DIR = ".linkque/logs";
|
|
55431
55559
|
var INSTALL_LOCK = "install.lock";
|
|
@@ -55499,7 +55627,7 @@ var readDependencyInputs = async (cwd) => {
|
|
|
55499
55627
|
let lockfiles;
|
|
55500
55628
|
try {
|
|
55501
55629
|
[packageJson, lockfiles] = await Promise.all([
|
|
55502
|
-
(0,
|
|
55630
|
+
(0, import_promises12.readFile)(import_path18.default.join(cwd, "package.json"), "utf8"),
|
|
55503
55631
|
readLockfiles(cwd)
|
|
55504
55632
|
]);
|
|
55505
55633
|
} catch (error2) {
|
|
@@ -55611,7 +55739,7 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55611
55739
|
}
|
|
55612
55740
|
if (previousState?.fingerprint === fingerprint) {
|
|
55613
55741
|
try {
|
|
55614
|
-
await (0,
|
|
55742
|
+
await (0, import_promises12.rm)(statePath, { force: true });
|
|
55615
55743
|
} catch (error2) {
|
|
55616
55744
|
throw new LinkqueCliError(
|
|
55617
55745
|
"INSTALL_STATE_WRITE_FAILED",
|
|
@@ -55620,17 +55748,15 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55620
55748
|
);
|
|
55621
55749
|
}
|
|
55622
55750
|
}
|
|
55623
|
-
const
|
|
55624
|
-
|
|
55625
|
-
args: ["install"],
|
|
55751
|
+
const { exitCode, installMetrics } = await runWorkspaceInstall(
|
|
55752
|
+
toolchain.name,
|
|
55626
55753
|
cwd,
|
|
55627
|
-
|
|
55628
|
-
|
|
55629
|
-
|
|
55630
|
-
if (result.exitCode !== 0) {
|
|
55754
|
+
installLogPath(cwd)
|
|
55755
|
+
);
|
|
55756
|
+
if (exitCode !== 0) {
|
|
55631
55757
|
throw new LinkqueCliError(
|
|
55632
55758
|
"INSTALL_DEPENDENCY_RESOLVE_FAILED",
|
|
55633
|
-
`dependency installation failed with exit code ${
|
|
55759
|
+
`dependency installation failed with exit code ${exitCode}; see ${LOG_DIR}/${INSTALL_LOG}`
|
|
55634
55760
|
);
|
|
55635
55761
|
}
|
|
55636
55762
|
const installedFingerprint = await computeFingerprint(
|
|
@@ -55642,6 +55768,7 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55642
55768
|
fingerprint: installedFingerprint,
|
|
55643
55769
|
forced: force,
|
|
55644
55770
|
installed: true,
|
|
55771
|
+
installMetrics,
|
|
55645
55772
|
packageManager: toolchain.name,
|
|
55646
55773
|
skipped: false
|
|
55647
55774
|
};
|
|
@@ -55756,10 +55883,10 @@ var inspectWorkspaceStatus = async (cwd) => {
|
|
|
55756
55883
|
|
|
55757
55884
|
// src/commands/build/archive.ts
|
|
55758
55885
|
var import_crypto6 = require("crypto");
|
|
55759
|
-
var
|
|
55886
|
+
var import_promises13 = require("fs/promises");
|
|
55760
55887
|
var import_path20 = __toESM(require("path"));
|
|
55761
55888
|
var import_stream = require("stream");
|
|
55762
|
-
var
|
|
55889
|
+
var import_promises14 = require("stream/promises");
|
|
55763
55890
|
|
|
55764
55891
|
// ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
|
|
55765
55892
|
init_configuration();
|
|
@@ -56357,46 +56484,52 @@ var ZipWriter = class {
|
|
|
56357
56484
|
}
|
|
56358
56485
|
return false;
|
|
56359
56486
|
}
|
|
56360
|
-
|
|
56487
|
+
close(comment = EMPTY_UINT8_ARRAY, options = {}) {
|
|
56361
56488
|
const zipWriter = this;
|
|
56362
|
-
const { pendingAddFileCalls, writer } = this;
|
|
56363
|
-
const { writable } = writer;
|
|
56364
56489
|
if (zipWriter.archiveClosed) {
|
|
56365
|
-
return getWriterData(writer);
|
|
56366
|
-
}
|
|
56367
|
-
if (!(comment instanceof Uint8Array)) {
|
|
56368
|
-
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
56369
|
-
}
|
|
56370
|
-
if (getLength(comment) > MAX_16_BITS) {
|
|
56371
|
-
throw new Error(ERR_INVALID_COMMENT);
|
|
56372
|
-
}
|
|
56373
|
-
while (pendingAddFileCalls.size) {
|
|
56374
|
-
await Promise.allSettled(Array.from(pendingAddFileCalls));
|
|
56375
|
-
}
|
|
56376
|
-
await Promise.allSettled(zipWriter.pendingErrors.map((watcher) => watcher.recorded));
|
|
56377
|
-
const unobservedWatchers = zipWriter.pendingErrors.filter((watcher) => watcher.failed && !watcher.observed);
|
|
56378
|
-
if (unobservedWatchers.length) {
|
|
56379
|
-
const unobservedErrors = unobservedWatchers.map((watcher) => watcher.error);
|
|
56380
|
-
unobservedWatchers.forEach((watcher) => watcher.observed = true);
|
|
56381
|
-
const [error2] = unobservedErrors;
|
|
56382
|
-
try {
|
|
56383
|
-
error2.entryErrors = unobservedErrors;
|
|
56384
|
-
} catch {
|
|
56385
|
-
}
|
|
56386
|
-
throw error2;
|
|
56490
|
+
return Promise.resolve(getWriterData(zipWriter.writer));
|
|
56387
56491
|
}
|
|
56388
|
-
|
|
56389
|
-
|
|
56390
|
-
const preventClose = !ownsWritable(writer) && getOptionValue2(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
56391
|
-
if (!preventClose) {
|
|
56392
|
-
await writable.getWriter().close();
|
|
56492
|
+
if (!zipWriter.pendingClose) {
|
|
56493
|
+
zipWriter.pendingClose = closeArchive(zipWriter, comment, options).finally(() => zipWriter.pendingClose = UNDEFINED_VALUE);
|
|
56393
56494
|
}
|
|
56394
|
-
return
|
|
56495
|
+
return zipWriter.pendingClose;
|
|
56395
56496
|
}
|
|
56396
56497
|
[SYMBOL_ASYNC_DISPOSE]() {
|
|
56397
56498
|
return this.close();
|
|
56398
56499
|
}
|
|
56399
56500
|
};
|
|
56501
|
+
async function closeArchive(zipWriter, comment, options) {
|
|
56502
|
+
const { pendingAddFileCalls, writer } = zipWriter;
|
|
56503
|
+
const { writable } = writer;
|
|
56504
|
+
if (!(comment instanceof Uint8Array)) {
|
|
56505
|
+
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
56506
|
+
}
|
|
56507
|
+
if (getLength(comment) > MAX_16_BITS) {
|
|
56508
|
+
throw new Error(ERR_INVALID_COMMENT);
|
|
56509
|
+
}
|
|
56510
|
+
while (pendingAddFileCalls.size) {
|
|
56511
|
+
await Promise.allSettled(Array.from(pendingAddFileCalls));
|
|
56512
|
+
}
|
|
56513
|
+
await Promise.allSettled(zipWriter.pendingErrors.map((watcher) => watcher.recorded));
|
|
56514
|
+
const unobservedWatchers = zipWriter.pendingErrors.filter((watcher) => watcher.failed && !watcher.observed);
|
|
56515
|
+
if (unobservedWatchers.length) {
|
|
56516
|
+
const unobservedErrors = unobservedWatchers.map((watcher) => watcher.error);
|
|
56517
|
+
unobservedWatchers.forEach((watcher) => watcher.observed = true);
|
|
56518
|
+
const [error2] = unobservedErrors;
|
|
56519
|
+
try {
|
|
56520
|
+
error2.entryErrors = unobservedErrors;
|
|
56521
|
+
} catch {
|
|
56522
|
+
}
|
|
56523
|
+
throw error2;
|
|
56524
|
+
}
|
|
56525
|
+
await closeFile(zipWriter, comment, options);
|
|
56526
|
+
zipWriter.archiveClosed = true;
|
|
56527
|
+
const preventClose = !ownsWritable(writer) && getOptionValue2(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
56528
|
+
if (!preventClose) {
|
|
56529
|
+
await writable.getWriter().close();
|
|
56530
|
+
}
|
|
56531
|
+
return getWriterData(writer);
|
|
56532
|
+
}
|
|
56400
56533
|
var WatchedPromise = class extends Promise {
|
|
56401
56534
|
then(onFulfilled, onRejected) {
|
|
56402
56535
|
const { watcher } = this;
|
|
@@ -59095,7 +59228,7 @@ var walkFiles = async (root, exclude = /* @__PURE__ */ new Set()) => {
|
|
|
59095
59228
|
const visit = async (current) => {
|
|
59096
59229
|
let entries;
|
|
59097
59230
|
try {
|
|
59098
|
-
entries = await (0,
|
|
59231
|
+
entries = await (0, import_promises13.readdir)(current, { withFileTypes: true });
|
|
59099
59232
|
} catch (error2) {
|
|
59100
59233
|
if (isNodeError(error2, "ENOENT")) return [];
|
|
59101
59234
|
throw error2;
|
|
@@ -59128,7 +59261,7 @@ var HashingArchiveWriter = class extends import_stream.Writable {
|
|
|
59128
59261
|
handle;
|
|
59129
59262
|
size = 0;
|
|
59130
59263
|
async initialize() {
|
|
59131
|
-
this.handle = await (0,
|
|
59264
|
+
this.handle = await (0, import_promises13.open)(this.archivePath, "wx");
|
|
59132
59265
|
}
|
|
59133
59266
|
identity() {
|
|
59134
59267
|
return { sha256: this.hash.digest("hex"), size: this.size };
|
|
@@ -59190,7 +59323,7 @@ var writeArchive = async (files, tempPath, options = {}, frozenContents = /* @__
|
|
|
59190
59323
|
try {
|
|
59191
59324
|
for (const file of files) {
|
|
59192
59325
|
const frozen = frozenContents.get(file.archivePath);
|
|
59193
|
-
const content = frozen ?? await (0,
|
|
59326
|
+
const content = frozen ?? await (0, import_promises13.readFile)(file.absolutePath);
|
|
59194
59327
|
await appendFile(file.archivePath, content);
|
|
59195
59328
|
}
|
|
59196
59329
|
await zip.close();
|
|
@@ -59204,7 +59337,7 @@ var writeArchive = async (files, tempPath, options = {}, frozenContents = /* @__
|
|
|
59204
59337
|
};
|
|
59205
59338
|
} catch (error2) {
|
|
59206
59339
|
output.destroy();
|
|
59207
|
-
await (0,
|
|
59340
|
+
await (0, import_promises14.finished)(output).catch(() => void 0);
|
|
59208
59341
|
if (error2 instanceof LinkqueCliError) throw error2;
|
|
59209
59342
|
throw new LinkqueCliError(
|
|
59210
59343
|
"BUILD_ARCHIVE_FAILED",
|
|
@@ -59234,7 +59367,7 @@ var runBuild = async (cwd) => {
|
|
|
59234
59367
|
};
|
|
59235
59368
|
var assertBuildCommand = async (cwd) => {
|
|
59236
59369
|
const packageJson = parseJsonObject(
|
|
59237
|
-
await (0,
|
|
59370
|
+
await (0, import_promises15.readFile)(import_path21.default.join(cwd, "package.json"), "utf8").catch((error2) => {
|
|
59238
59371
|
throw new LinkqueCliError(
|
|
59239
59372
|
"BUILD_COMMAND_NOT_FOUND",
|
|
59240
59373
|
"workspace package.json must contain a build script",
|
|
@@ -59267,7 +59400,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59267
59400
|
const outputPath = import_path21.default.join(cwd, OUTPUT_DIR);
|
|
59268
59401
|
const finalPath = import_path21.default.join(cwd, ARCHIVE_PATH);
|
|
59269
59402
|
const tempPath = `${finalPath}.${process.pid}.${(0, import_crypto7.randomUUID)()}.tmp`;
|
|
59270
|
-
await (0,
|
|
59403
|
+
await (0, import_promises15.rm)(finalPath, { force: true }).catch((error2) => {
|
|
59271
59404
|
throw new LinkqueCliError(
|
|
59272
59405
|
"BUILD_ARCHIVE_FAILED",
|
|
59273
59406
|
"stale build archive could not be removed",
|
|
@@ -59292,7 +59425,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59292
59425
|
);
|
|
59293
59426
|
}
|
|
59294
59427
|
await assertBuildCommand(cwd);
|
|
59295
|
-
await (0,
|
|
59428
|
+
await (0, import_promises15.rm)(outputPath, { force: true, recursive: true }).catch(
|
|
59296
59429
|
(error2) => {
|
|
59297
59430
|
throw new LinkqueCliError(
|
|
59298
59431
|
"BUILD_FAILED",
|
|
@@ -59327,7 +59460,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59327
59460
|
);
|
|
59328
59461
|
}
|
|
59329
59462
|
);
|
|
59330
|
-
await (0,
|
|
59463
|
+
await (0, import_promises15.rename)(tempPath, finalPath).catch((error2) => {
|
|
59331
59464
|
throw new LinkqueCliError(
|
|
59332
59465
|
"BUILD_ARCHIVE_FAILED",
|
|
59333
59466
|
"build archive could not be finalized",
|
|
@@ -59344,8 +59477,8 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59344
59477
|
} catch (error2) {
|
|
59345
59478
|
try {
|
|
59346
59479
|
await Promise.all([
|
|
59347
|
-
(0,
|
|
59348
|
-
(0,
|
|
59480
|
+
(0, import_promises15.rm)(finalPath, { force: true }),
|
|
59481
|
+
(0, import_promises15.rm)(tempPath, { force: true })
|
|
59349
59482
|
]);
|
|
59350
59483
|
} catch (cleanupError) {
|
|
59351
59484
|
throw preservePrimaryFailure(error2, cleanupError);
|
|
@@ -59361,16 +59494,16 @@ var buildDist = async (cwd) => withWorkspaceLock(
|
|
|
59361
59494
|
releaseErrorCode: "BUILD_ARCHIVE_FAILED",
|
|
59362
59495
|
retryMs: LOCK_RETRY_MS3,
|
|
59363
59496
|
timeoutMs: LOCK_TIMEOUT_MS4,
|
|
59364
|
-
onReleaseFailure: () => (0,
|
|
59497
|
+
onReleaseFailure: () => (0, import_promises15.rm)(import_path21.default.join(cwd, ARCHIVE_PATH), { force: true })
|
|
59365
59498
|
},
|
|
59366
59499
|
() => buildDistWhileLocked(cwd)
|
|
59367
59500
|
);
|
|
59368
59501
|
|
|
59369
59502
|
// src/commands/build/snapshot.ts
|
|
59370
59503
|
var import_crypto8 = require("crypto");
|
|
59371
|
-
var import_promises15 = require("fs/promises");
|
|
59372
|
-
var import_path22 = __toESM(require("path"));
|
|
59373
59504
|
var import_promises16 = require("fs/promises");
|
|
59505
|
+
var import_path22 = __toESM(require("path"));
|
|
59506
|
+
var import_promises17 = require("fs/promises");
|
|
59374
59507
|
var ARTIFACTS_DIR = ".linkque/artifacts";
|
|
59375
59508
|
var AGENT_CONFIG_SOURCE_PATH = "agent_config.json";
|
|
59376
59509
|
var TEMPLATE_ARTIFACT_SOURCE_PATH = "template-artifact.json";
|
|
@@ -59390,7 +59523,7 @@ var snapshotFailure = (message, cause) => cause instanceof LinkqueCliError ? cau
|
|
|
59390
59523
|
var readTemplateVersion = async (cwd) => {
|
|
59391
59524
|
let content;
|
|
59392
59525
|
try {
|
|
59393
|
-
content = await (0,
|
|
59526
|
+
content = await (0, import_promises16.readFile)(
|
|
59394
59527
|
import_path22.default.join(cwd, TEMPLATE_ARTIFACT_SOURCE_PATH),
|
|
59395
59528
|
"utf8"
|
|
59396
59529
|
);
|
|
@@ -59419,7 +59552,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59419
59552
|
try {
|
|
59420
59553
|
let rootStat;
|
|
59421
59554
|
try {
|
|
59422
|
-
rootStat = await (0,
|
|
59555
|
+
rootStat = await (0, import_promises16.lstat)(cwd, { bigint: true });
|
|
59423
59556
|
} catch (error2) {
|
|
59424
59557
|
throw snapshotFailure("workspace source could not be inspected", error2);
|
|
59425
59558
|
}
|
|
@@ -59434,7 +59567,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59434
59567
|
);
|
|
59435
59568
|
const cardFilesPath = import_path22.default.join(relDir, "card-files.json");
|
|
59436
59569
|
await ensureParentDir(import_path22.default.join(cwd, cardFilesPath));
|
|
59437
|
-
await (0,
|
|
59570
|
+
await (0, import_promises17.writeFile)(import_path22.default.join(cwd, cardFilesPath), canonicalJson(cardSource));
|
|
59438
59571
|
const excludedComponents = new Set(BASE_EXCLUDED_COMPONENTS);
|
|
59439
59572
|
if (options.excludePlatformSdk) excludedComponents.add(".platform-sdk");
|
|
59440
59573
|
const walkedFiles = await walkFiles(cwd, excludedComponents).catch(
|
|
@@ -59483,7 +59616,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59483
59616
|
error2
|
|
59484
59617
|
);
|
|
59485
59618
|
});
|
|
59486
|
-
await (0,
|
|
59619
|
+
await (0, import_promises16.rename)(tempPath, finalPath).catch((error2) => {
|
|
59487
59620
|
throw new LinkqueCliError(
|
|
59488
59621
|
"SNAPSHOT_FAILED",
|
|
59489
59622
|
"source archive could not be finalized",
|
|
@@ -59503,7 +59636,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59503
59636
|
};
|
|
59504
59637
|
} catch (error2) {
|
|
59505
59638
|
try {
|
|
59506
|
-
await (0,
|
|
59639
|
+
await (0, import_promises16.rm)(dirPath, { force: true, recursive: true });
|
|
59507
59640
|
} catch (cleanupError) {
|
|
59508
59641
|
throw preservePrimaryFailure(error2, cleanupError);
|
|
59509
59642
|
}
|
|
@@ -59525,11 +59658,11 @@ var buildSnapshot = async (cwd, options = {}) => withWorkspaceLock(
|
|
|
59525
59658
|
|
|
59526
59659
|
// src/commands/card/index.ts
|
|
59527
59660
|
var import_crypto9 = require("crypto");
|
|
59528
|
-
var
|
|
59661
|
+
var import_promises19 = require("fs/promises");
|
|
59529
59662
|
var import_path24 = __toESM(require("path"));
|
|
59530
59663
|
|
|
59531
59664
|
// src/commands/mcpDescribe.ts
|
|
59532
|
-
var
|
|
59665
|
+
var import_promises18 = require("fs/promises");
|
|
59533
59666
|
var import_path23 = __toESM(require("path"));
|
|
59534
59667
|
var MCP_DETAIL_ENDPOINT_ENV = "LINKQUE_MCP_DETAIL_ENDPOINT";
|
|
59535
59668
|
var MCP_DETAIL_ENABLED_ENV = "LINKQUE_MCP_DETAIL_ENABLED";
|
|
@@ -59599,7 +59732,7 @@ function requireEnabled(env) {
|
|
|
59599
59732
|
async function readMountedMcp(cwd, resourceId) {
|
|
59600
59733
|
let content;
|
|
59601
59734
|
try {
|
|
59602
|
-
content = await (0,
|
|
59735
|
+
content = await (0, import_promises18.readFile)(import_path23.default.join(cwd, "agent_config.json"));
|
|
59603
59736
|
} catch {
|
|
59604
59737
|
throw new LinkqueCliError(
|
|
59605
59738
|
"MCP_CONFIG_READ_FAILED",
|
|
@@ -60043,14 +60176,14 @@ async function prepareCardBindingContext(cwd, draftId, resourceIds, env = proces
|
|
|
60043
60176
|
}
|
|
60044
60177
|
async function assertBindingContextDirectory(cwd, directory) {
|
|
60045
60178
|
try {
|
|
60046
|
-
const canonicalWorkspace = await (0,
|
|
60047
|
-
if (await (0,
|
|
60179
|
+
const canonicalWorkspace = await (0, import_promises19.realpath)(cwd);
|
|
60180
|
+
if (await (0, import_promises19.realpath)(directory) !== import_path24.default.join(canonicalWorkspace, import_path24.default.relative(cwd, directory))) {
|
|
60048
60181
|
throw new LinkqueCliError(
|
|
60049
60182
|
"CARD_DRAFT_INVALID",
|
|
60050
60183
|
"\u7ED1\u5B9A\u4E0A\u4E0B\u6587\u4E0D\u80FD\u4F4D\u4E8E\u7B26\u53F7\u94FE\u63A5\u76EE\u5F55"
|
|
60051
60184
|
);
|
|
60052
60185
|
}
|
|
60053
|
-
const entry = await (0,
|
|
60186
|
+
const entry = await (0, import_promises19.lstat)(
|
|
60054
60187
|
import_path24.default.join(directory, "binding-context.json")
|
|
60055
60188
|
).catch((cause) => {
|
|
60056
60189
|
if (isNodeError(cause, "ENOENT")) return void 0;
|
|
@@ -60169,7 +60302,7 @@ async function rollbackCardFinalize(cwd, rollbackToken) {
|
|
|
60169
60302
|
},
|
|
60170
60303
|
async () => {
|
|
60171
60304
|
const configPath = import_path24.default.join(cwd, AGENT_CONFIG_PATH);
|
|
60172
|
-
const current = await (0,
|
|
60305
|
+
const current = await (0, import_promises19.readFile)(configPath);
|
|
60173
60306
|
if (checksumBytes(current) !== payload.expectedConfigChecksum) {
|
|
60174
60307
|
throw new LinkqueCliError(
|
|
60175
60308
|
"CARD_FINALIZE_CONFLICT",
|
|
@@ -60308,7 +60441,7 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
|
|
|
60308
60441
|
await readOptionalJson(import_path24.default.join(directory, "binding-context.json"))
|
|
60309
60442
|
);
|
|
60310
60443
|
const configPath = import_path24.default.join(cwd, AGENT_CONFIG_PATH);
|
|
60311
|
-
const oldConfigBytes = await (0,
|
|
60444
|
+
const oldConfigBytes = await (0, import_promises19.readFile)(configPath);
|
|
60312
60445
|
const config3 = parseAgentConfig(await readAgentCards(configPath));
|
|
60313
60446
|
const resources = config3.agent.resources;
|
|
60314
60447
|
const existingIndex = resources.findIndex(
|
|
@@ -60499,7 +60632,7 @@ async function listDraftDirectories(cwd) {
|
|
|
60499
60632
|
const root = import_path24.default.join(cwd, DRAFT_ROOT);
|
|
60500
60633
|
let entries;
|
|
60501
60634
|
try {
|
|
60502
|
-
entries = await (0,
|
|
60635
|
+
entries = await (0, import_promises19.readdir)(root, { withFileTypes: true });
|
|
60503
60636
|
} catch (cause) {
|
|
60504
60637
|
if (isNodeError(cause, "ENOENT")) return [];
|
|
60505
60638
|
throw new LinkqueCliError(
|
|
@@ -60538,7 +60671,7 @@ function draftIssue(code, message, recoverable, severity) {
|
|
|
60538
60671
|
}
|
|
60539
60672
|
async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
|
|
60540
60673
|
try {
|
|
60541
|
-
const content = await (0,
|
|
60674
|
+
const content = await (0, import_promises19.readFile)(file, "utf8");
|
|
60542
60675
|
if (Buffer.byteLength(content, "utf8") > DRAFT_FILE_MAX_BYTES) {
|
|
60543
60676
|
throw new LinkqueCliError(
|
|
60544
60677
|
"CARD_DRAFT_INVALID",
|
|
@@ -60571,7 +60704,7 @@ async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
|
|
|
60571
60704
|
}
|
|
60572
60705
|
async function readRequiredJsonWithLimit(file, maxBytes) {
|
|
60573
60706
|
try {
|
|
60574
|
-
const content = await (0,
|
|
60707
|
+
const content = await (0, import_promises19.readFile)(file, "utf8");
|
|
60575
60708
|
if (Buffer.byteLength(content, "utf8") > maxBytes) {
|
|
60576
60709
|
throw new LinkqueCliError(
|
|
60577
60710
|
"CARD_DRAFT_INVALID",
|
|
@@ -60670,7 +60803,7 @@ async function readOptionalJsonObject(file) {
|
|
|
60670
60803
|
}
|
|
60671
60804
|
async function readModifiedAt(file) {
|
|
60672
60805
|
try {
|
|
60673
|
-
return (await (0,
|
|
60806
|
+
return (await (0, import_promises19.stat)(file)).mtime.toISOString();
|
|
60674
60807
|
} catch {
|
|
60675
60808
|
return "";
|
|
60676
60809
|
}
|
|
@@ -60791,13 +60924,13 @@ async function atomicWrite(file, content) {
|
|
|
60791
60924
|
const temporary = `${file}.${process.pid}.${(0, import_crypto9.randomUUID)()}.tmp`;
|
|
60792
60925
|
let handle;
|
|
60793
60926
|
try {
|
|
60794
|
-
handle = await (0,
|
|
60927
|
+
handle = await (0, import_promises19.open)(temporary, "wx", 384);
|
|
60795
60928
|
await handle.writeFile(content);
|
|
60796
60929
|
await handle.sync();
|
|
60797
60930
|
await handle.close();
|
|
60798
60931
|
handle = void 0;
|
|
60799
|
-
await (0,
|
|
60800
|
-
const directoryHandle = await (0,
|
|
60932
|
+
await (0, import_promises19.rename)(temporary, file);
|
|
60933
|
+
const directoryHandle = await (0, import_promises19.open)(import_path24.default.dirname(file), "r");
|
|
60801
60934
|
try {
|
|
60802
60935
|
await directoryHandle.sync();
|
|
60803
60936
|
} finally {
|
|
@@ -60805,7 +60938,7 @@ async function atomicWrite(file, content) {
|
|
|
60805
60938
|
}
|
|
60806
60939
|
} catch (cause) {
|
|
60807
60940
|
await handle?.close().catch(() => void 0);
|
|
60808
|
-
await (0,
|
|
60941
|
+
await (0, import_promises19.unlink)(temporary).catch(() => void 0);
|
|
60809
60942
|
throw new LinkqueCliError(
|
|
60810
60943
|
"CARD_FINALIZE_WRITE_FAILED",
|
|
60811
60944
|
`\u539F\u5B50\u5199\u5165\u5931\u8D25: ${import_path24.default.basename(file)}`,
|
|
@@ -60834,13 +60967,13 @@ function parseRollbackToken(token) {
|
|
|
60834
60967
|
|
|
60835
60968
|
// src/commands/dev.ts
|
|
60836
60969
|
var import_child_process4 = require("child_process");
|
|
60837
|
-
var
|
|
60970
|
+
var import_promises21 = require("fs/promises");
|
|
60838
60971
|
var import_net2 = require("net");
|
|
60839
60972
|
var import_path26 = __toESM(require("path"));
|
|
60840
60973
|
|
|
60841
60974
|
// src/commands/inspector.ts
|
|
60842
60975
|
var import_module = require("module");
|
|
60843
|
-
var
|
|
60976
|
+
var import_promises20 = require("fs/promises");
|
|
60844
60977
|
var import_os3 = require("os");
|
|
60845
60978
|
var import_path25 = __toESM(require("path"));
|
|
60846
60979
|
var import_url = require("url");
|
|
@@ -60891,7 +61024,7 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60891
61024
|
);
|
|
60892
61025
|
}
|
|
60893
61026
|
try {
|
|
60894
|
-
const fileStat = await (0,
|
|
61027
|
+
const fileStat = await (0, import_promises20.lstat)(requestFile);
|
|
60895
61028
|
if (fileStat.isSymbolicLink() || !fileStat.isFile()) {
|
|
60896
61029
|
throw new LinkqueCliError(
|
|
60897
61030
|
"INSPECTOR_PATH_FORBIDDEN",
|
|
@@ -60905,8 +61038,8 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60905
61038
|
);
|
|
60906
61039
|
}
|
|
60907
61040
|
const [directoryRealPath, fileRealPath] = await Promise.all([
|
|
60908
|
-
(0,
|
|
60909
|
-
(0,
|
|
61041
|
+
(0, import_promises20.realpath)(managedRequestDirectory()),
|
|
61042
|
+
(0, import_promises20.realpath)(requestFile)
|
|
60910
61043
|
]);
|
|
60911
61044
|
const relative = import_path25.default.relative(directoryRealPath, fileRealPath);
|
|
60912
61045
|
if (relative === "" || relative.startsWith(`..${import_path25.default.sep}`) || import_path25.default.isAbsolute(relative)) {
|
|
@@ -60934,7 +61067,7 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60934
61067
|
var readInspectorRequest = async (requestFile) => {
|
|
60935
61068
|
await assertManagedRequestFile(requestFile);
|
|
60936
61069
|
try {
|
|
60937
|
-
const content = await (0,
|
|
61070
|
+
const content = await (0, import_promises20.readFile)(requestFile, "utf8");
|
|
60938
61071
|
if (Buffer.byteLength(content, "utf8") > REQUEST_MAX_BYTES) {
|
|
60939
61072
|
throw new LinkqueCliError(
|
|
60940
61073
|
"INSPECTOR_REQUEST_INVALID",
|
|
@@ -61137,7 +61270,7 @@ var isPortListening2 = (port) => new Promise((resolve2) => {
|
|
|
61137
61270
|
});
|
|
61138
61271
|
async function removeMatchingState2(statePath, pid) {
|
|
61139
61272
|
const owned = await readOwnedDevState(statePath);
|
|
61140
|
-
if (owned?.pid === pid) await (0,
|
|
61273
|
+
if (owned?.pid === pid) await (0, import_promises21.rm)(statePath, { force: true });
|
|
61141
61274
|
}
|
|
61142
61275
|
async function terminateOwner2(statePath, pid) {
|
|
61143
61276
|
if (!isProcessAlive(pid)) {
|
|
@@ -61177,7 +61310,7 @@ var inspectRecordedDevServer = async (cwd) => {
|
|
|
61177
61310
|
}
|
|
61178
61311
|
const owned = parseOwnedDevState(content);
|
|
61179
61312
|
if (owned === null) {
|
|
61180
|
-
await (0,
|
|
61313
|
+
await (0, import_promises21.rm)(statePath, { force: true });
|
|
61181
61314
|
return { state: null, status: stopped2("STALE") };
|
|
61182
61315
|
}
|
|
61183
61316
|
const state = owned;
|
|
@@ -61406,7 +61539,7 @@ var stopDevServer = async (cwd) => {
|
|
|
61406
61539
|
async () => {
|
|
61407
61540
|
const owned = await readOwnedDevState(statePath);
|
|
61408
61541
|
if (owned !== null) await terminateOwner2(statePath, owned.pid);
|
|
61409
|
-
await (0,
|
|
61542
|
+
await (0, import_promises21.rm)(statePath, { force: true });
|
|
61410
61543
|
return { stopped: true };
|
|
61411
61544
|
}
|
|
61412
61545
|
);
|
|
@@ -61414,7 +61547,7 @@ var stopDevServer = async (cwd) => {
|
|
|
61414
61547
|
|
|
61415
61548
|
// src/commands/platformSdk/apply.ts
|
|
61416
61549
|
var import_crypto10 = require("crypto");
|
|
61417
|
-
var
|
|
61550
|
+
var import_promises22 = require("fs/promises");
|
|
61418
61551
|
var import_path27 = __toESM(require("path"));
|
|
61419
61552
|
var PLATFORM_SDK_DIR = ".platform-sdk";
|
|
61420
61553
|
var PLATFORM_SDK_VERSION_FILE = `${PLATFORM_SDK_DIR}/version.json`;
|
|
@@ -61475,12 +61608,12 @@ var extractArchive = async (cwd, archive, manifest) => {
|
|
|
61475
61608
|
}
|
|
61476
61609
|
const destination = import_path27.default.join(cwd, ...entryPath.split("/"));
|
|
61477
61610
|
if (entry.directory) {
|
|
61478
|
-
await (0,
|
|
61611
|
+
await (0, import_promises22.mkdir)(destination, { recursive: true });
|
|
61479
61612
|
continue;
|
|
61480
61613
|
}
|
|
61481
61614
|
const bytes = await entry.getData(new Uint8ArrayWriter());
|
|
61482
|
-
await (0,
|
|
61483
|
-
await (0,
|
|
61615
|
+
await (0, import_promises22.mkdir)(import_path27.default.dirname(destination), { recursive: true });
|
|
61616
|
+
await (0, import_promises22.writeFile)(destination, bytes, { flag: "wx" });
|
|
61484
61617
|
extractedFiles.set(entryPath, sha256(bytes));
|
|
61485
61618
|
}
|
|
61486
61619
|
} finally {
|
|
@@ -61499,7 +61632,7 @@ var validateVersionMarker = async (cwd, manifest) => {
|
|
|
61499
61632
|
let value;
|
|
61500
61633
|
try {
|
|
61501
61634
|
value = JSON.parse(
|
|
61502
|
-
await (0,
|
|
61635
|
+
await (0, import_promises22.readFile)(import_path27.default.join(cwd, PLATFORM_SDK_VERSION_FILE), "utf8")
|
|
61503
61636
|
);
|
|
61504
61637
|
} catch (error2) {
|
|
61505
61638
|
throw new LinkqueCliError(
|
|
@@ -61519,7 +61652,7 @@ var rewritePackageJson = async (cwd, manifest) => {
|
|
|
61519
61652
|
const packageJsonPath = import_path27.default.join(cwd, "package.json");
|
|
61520
61653
|
let packageJson;
|
|
61521
61654
|
try {
|
|
61522
|
-
packageJson = JSON.parse(await (0,
|
|
61655
|
+
packageJson = JSON.parse(await (0, import_promises22.readFile)(packageJsonPath, "utf8"));
|
|
61523
61656
|
} catch (error2) {
|
|
61524
61657
|
throw new LinkqueCliError(
|
|
61525
61658
|
"PLATFORM_SDK_APPLY_FAILED",
|
|
@@ -61559,8 +61692,8 @@ var rewritePackageJson = async (cwd, manifest) => {
|
|
|
61559
61692
|
};
|
|
61560
61693
|
var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
61561
61694
|
const [manifestContent, archive] = await Promise.all([
|
|
61562
|
-
(0,
|
|
61563
|
-
(0,
|
|
61695
|
+
(0, import_promises22.readFile)(import_path27.default.resolve(cwd, manifestPath), "utf8"),
|
|
61696
|
+
(0, import_promises22.readFile)(import_path27.default.resolve(cwd, archivePath))
|
|
61564
61697
|
]).catch((error2) => {
|
|
61565
61698
|
throw new LinkqueCliError(
|
|
61566
61699
|
"PLATFORM_SDK_APPLY_FAILED",
|
|
@@ -61575,7 +61708,7 @@ var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
|
61575
61708
|
"platform SDK archive identity does not match the manifest"
|
|
61576
61709
|
);
|
|
61577
61710
|
}
|
|
61578
|
-
await (0,
|
|
61711
|
+
await (0, import_promises22.rm)(import_path27.default.join(cwd, PLATFORM_SDK_DIR), { force: true, recursive: true });
|
|
61579
61712
|
try {
|
|
61580
61713
|
await extractArchive(cwd, archive, manifest);
|
|
61581
61714
|
await validateVersionMarker(cwd, manifest);
|
|
@@ -61587,7 +61720,7 @@ var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
|
61587
61720
|
let templateVersion;
|
|
61588
61721
|
try {
|
|
61589
61722
|
const artifact = JSON.parse(
|
|
61590
|
-
await (0,
|
|
61723
|
+
await (0, import_promises22.readFile)(import_path27.default.join(cwd, "template-artifact.json"), "utf8")
|
|
61591
61724
|
);
|
|
61592
61725
|
templateVersion = typeof artifact.templateVersion === "string" ? artifact.templateVersion : void 0;
|
|
61593
61726
|
} catch {
|
|
@@ -61627,7 +61760,7 @@ var applyPlatformSdk = async (cwd, manifestPath, archivePath, options = {}) => w
|
|
|
61627
61760
|
);
|
|
61628
61761
|
|
|
61629
61762
|
// src/commands/unzip.ts
|
|
61630
|
-
var
|
|
61763
|
+
var import_promises23 = require("fs/promises");
|
|
61631
61764
|
var import_path28 = __toESM(require("path"));
|
|
61632
61765
|
var MAX_ZIP_BYTES = 70 * 1024 * 1024;
|
|
61633
61766
|
var MAX_FILE_COUNT = 5e3;
|
|
@@ -61659,7 +61792,7 @@ var SourceArchiveExtractor = class {
|
|
|
61659
61792
|
}
|
|
61660
61793
|
async extract() {
|
|
61661
61794
|
await this.assertInputs();
|
|
61662
|
-
const handle = await (0,
|
|
61795
|
+
const handle = await (0, import_promises23.open)(this.inputPath, "r").catch((error2) => {
|
|
61663
61796
|
throw new LinkqueCliError(
|
|
61664
61797
|
"UNZIP_INPUT_INVALID",
|
|
61665
61798
|
"unzip input archive could not be opened",
|
|
@@ -61695,7 +61828,7 @@ var SourceArchiveExtractor = class {
|
|
|
61695
61828
|
}
|
|
61696
61829
|
let inputStat;
|
|
61697
61830
|
try {
|
|
61698
|
-
inputStat = await (0,
|
|
61831
|
+
inputStat = await (0, import_promises23.stat)(this.inputPath);
|
|
61699
61832
|
} catch (error2) {
|
|
61700
61833
|
throw new LinkqueCliError(
|
|
61701
61834
|
"UNZIP_INPUT_INVALID",
|
|
@@ -61709,7 +61842,7 @@ var SourceArchiveExtractor = class {
|
|
|
61709
61842
|
}
|
|
61710
61843
|
let outputStat;
|
|
61711
61844
|
try {
|
|
61712
|
-
outputStat = await (0,
|
|
61845
|
+
outputStat = await (0, import_promises23.lstat)(this.outputPath);
|
|
61713
61846
|
} catch (error2) {
|
|
61714
61847
|
throw new LinkqueCliError(
|
|
61715
61848
|
"UNZIP_INPUT_INVALID",
|
|
@@ -61720,7 +61853,7 @@ var SourceArchiveExtractor = class {
|
|
|
61720
61853
|
if (outputStat.isSymbolicLink() || !outputStat.isDirectory()) {
|
|
61721
61854
|
this.invalid("unzip output must be an existing directory");
|
|
61722
61855
|
}
|
|
61723
|
-
if ((await (0,
|
|
61856
|
+
if ((await (0, import_promises23.readdir)(this.outputPath)).length > 0) {
|
|
61724
61857
|
this.invalid("unzip output directory must be empty");
|
|
61725
61858
|
}
|
|
61726
61859
|
}
|
|
@@ -61758,9 +61891,9 @@ var SourceArchiveExtractor = class {
|
|
|
61758
61891
|
}
|
|
61759
61892
|
async extractFile(file) {
|
|
61760
61893
|
const destination = this.resolveDestination(file.filename);
|
|
61761
|
-
await (0,
|
|
61894
|
+
await (0, import_promises23.mkdir)(import_path28.default.dirname(destination), { recursive: true });
|
|
61762
61895
|
this.sourceChecksum.appendFileHeader(file.filename, file.size);
|
|
61763
|
-
const handle = await (0,
|
|
61896
|
+
const handle = await (0, import_promises23.open)(destination, "wx");
|
|
61764
61897
|
let written = 0;
|
|
61765
61898
|
try {
|
|
61766
61899
|
await file.entry.getData(
|
|
@@ -62537,7 +62670,7 @@ function readTraceContent(input) {
|
|
|
62537
62670
|
// src/utils/otlpScanner.ts
|
|
62538
62671
|
var import_node_path13 = __toESM(require("node:path"));
|
|
62539
62672
|
var import_node_crypto5 = require("node:crypto");
|
|
62540
|
-
var
|
|
62673
|
+
var import_promises24 = require("node:fs/promises");
|
|
62541
62674
|
|
|
62542
62675
|
// src/commands/runs/types.ts
|
|
62543
62676
|
var OTLP_LOG_FILES = {
|
|
@@ -62593,7 +62726,7 @@ async function scanRetainedLogs(cwd, pinned, options) {
|
|
|
62593
62726
|
const dir = import_node_path13.default.join(cwd, LOGS_ROOT);
|
|
62594
62727
|
let files;
|
|
62595
62728
|
try {
|
|
62596
|
-
files = await (0,
|
|
62729
|
+
files = await (0, import_promises24.readdir)(dir);
|
|
62597
62730
|
} catch (error2) {
|
|
62598
62731
|
if (isNodeError(error2, "ENOENT"))
|
|
62599
62732
|
return { facts: [], warnings: ["source_unavailable"], readWindow: [] };
|
|
@@ -62616,14 +62749,14 @@ async function scanRetainedLogs(cwd, pinned, options) {
|
|
|
62616
62749
|
try {
|
|
62617
62750
|
const source = retainedFiles.get(file);
|
|
62618
62751
|
const filePath = import_node_path13.default.join(dir, file);
|
|
62619
|
-
const before = await (0,
|
|
62752
|
+
const before = await (0, import_promises24.stat)(filePath);
|
|
62620
62753
|
if (options && scannedBytes + before.size > options.maxBytes)
|
|
62621
62754
|
throw new RangeError("\u539F\u59CB\u65E5\u5FD7\u8D85\u8FC7\u5F52\u6863\u8BFB\u53D6\u4E0A\u9650");
|
|
62622
|
-
const content = await (0,
|
|
62755
|
+
const content = await (0, import_promises24.readFile)(filePath);
|
|
62623
62756
|
scannedBytes += content.length;
|
|
62624
62757
|
if (options && scannedBytes > options.maxBytes)
|
|
62625
62758
|
throw new RangeError("\u539F\u59CB\u65E5\u5FD7\u8D85\u8FC7\u5F52\u6863\u8BFB\u53D6\u4E0A\u9650");
|
|
62626
|
-
const after = await (0,
|
|
62759
|
+
const after = await (0, import_promises24.stat)(filePath);
|
|
62627
62760
|
if (before.ino !== after.ino || after.size < before.size) {
|
|
62628
62761
|
warnings.push("log_rotated_during_read");
|
|
62629
62762
|
continue;
|
|
@@ -62849,9 +62982,9 @@ var scanContent = async (input) => {
|
|
|
62849
62982
|
var import_node_path14 = __toESM(require("node:path"));
|
|
62850
62983
|
var import_node_fs9 = require("node:fs");
|
|
62851
62984
|
var import_node_stream2 = require("node:stream");
|
|
62852
|
-
var
|
|
62985
|
+
var import_promises25 = require("node:stream/promises");
|
|
62853
62986
|
var import_node_zlib2 = require("node:zlib");
|
|
62854
|
-
var
|
|
62987
|
+
var import_promises26 = require("node:fs/promises");
|
|
62855
62988
|
var TURN_ARCHIVE_MAX_BYTES = 16 * 1024 * 1024;
|
|
62856
62989
|
var TURN_SOURCE_MAX_BYTES = 64 * 1024 * 1024;
|
|
62857
62990
|
var TURN_UNCOMPRESSED_ARCHIVE_MAX_BYTES = 64 * 1024 * 1024;
|
|
@@ -62878,8 +63011,8 @@ async function exportTurn(cwd, identity) {
|
|
|
62878
63011
|
"\u76EE\u6807\u8F6E\u6B21\u65E5\u5FD7\u4E0D\u53EF\u7528"
|
|
62879
63012
|
);
|
|
62880
63013
|
const root = import_node_path14.default.join(cwd, ".linkque", "tmp");
|
|
62881
|
-
await (0,
|
|
62882
|
-
const directory = await (0,
|
|
63014
|
+
await (0, import_promises26.mkdir)(root, { recursive: true });
|
|
63015
|
+
const directory = await (0, import_promises26.mkdtemp)(import_node_path14.default.join(root, "turn-share-"));
|
|
62883
63016
|
const archivePath = import_node_path14.default.join(directory, "logs.tar.gz");
|
|
62884
63017
|
let result;
|
|
62885
63018
|
try {
|
|
@@ -62900,7 +63033,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62900
63033
|
if (payloadBytes > TURN_UNCOMPRESSED_ARCHIVE_MAX_BYTES)
|
|
62901
63034
|
throw new RangeError("\u672A\u538B\u7F29\u5F52\u6863\u5185\u5BB9\u8D85\u8FC7\u4E0A\u9650");
|
|
62902
63035
|
for (const [name, value] of Object.entries(files))
|
|
62903
|
-
await (0,
|
|
63036
|
+
await (0, import_promises26.writeFile)(import_node_path14.default.join(directory, name), value, { flag: "wx" });
|
|
62904
63037
|
let uncompressedBytes = 0;
|
|
62905
63038
|
let compressedBytes = 0;
|
|
62906
63039
|
const rawBudget = new import_node_stream2.Transform({
|
|
@@ -62921,7 +63054,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62921
63054
|
);
|
|
62922
63055
|
}
|
|
62923
63056
|
});
|
|
62924
|
-
await (0,
|
|
63057
|
+
await (0, import_promises25.pipeline)(
|
|
62925
63058
|
Qn(
|
|
62926
63059
|
{ cwd: directory, portable: true },
|
|
62927
63060
|
Object.keys(files)
|
|
@@ -62933,7 +63066,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62933
63066
|
);
|
|
62934
63067
|
result = { archivePath, compressedBytes, uncompressedBytes };
|
|
62935
63068
|
} catch (cause) {
|
|
62936
|
-
await (0,
|
|
63069
|
+
await (0, import_promises26.rm)(directory, { recursive: true, force: true }).catch(
|
|
62937
63070
|
() => void 0
|
|
62938
63071
|
);
|
|
62939
63072
|
throw new LinkqueCliError(
|
|
@@ -62943,7 +63076,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62943
63076
|
);
|
|
62944
63077
|
}
|
|
62945
63078
|
for (const name of ["manifest.json", "logs.jsonl", "traces.jsonl"]) {
|
|
62946
|
-
await (0,
|
|
63079
|
+
await (0, import_promises26.rm)(import_node_path14.default.join(directory, name), { force: true }).catch(
|
|
62947
63080
|
() => void 0
|
|
62948
63081
|
);
|
|
62949
63082
|
}
|