linkque-cli-v2 1.6.20 → 1.6.21
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 +285 -161
- package/package.json +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-6G25V7QM.js} +2977 -2022
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-WHXLLQZR.js → chunk-7PXOEKVE.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-22EQ6RXO.js → chunk-JTSY7FS5.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 +1338 -657
- 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 +5987 -4037
- 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 {
|
|
@@ -38401,6 +38401,7 @@ var EResourceType;
|
|
|
38401
38401
|
EResourceType2["CARD"] = "CARD";
|
|
38402
38402
|
EResourceType2["TOOL"] = "TOOL";
|
|
38403
38403
|
EResourceType2["WEB_SEARCH"] = "WEB_SEARCH";
|
|
38404
|
+
EResourceType2["MEMORY"] = "MEMORY";
|
|
38404
38405
|
EResourceType2["FOLLOW_UP_QUESTIONS"] = "FOLLOW_UP_QUESTIONS";
|
|
38405
38406
|
EResourceType2["CLIENT_CAPABILITY"] = "CLIENT_CAPABILITY";
|
|
38406
38407
|
EResourceType2["HOOK"] = "HOOK";
|
|
@@ -38436,7 +38437,9 @@ var EHookExecutorName;
|
|
|
38436
38437
|
EHookExecutorName2["SecurityAnswerHookExecutor"] = "SecurityAnswerHookExecutor";
|
|
38437
38438
|
EHookExecutorName2["ImageUnderstandingHookExecutor"] = "ImageUnderstandingHookExecutor";
|
|
38438
38439
|
EHookExecutorName2["McpDiscoveryHookExecutor"] = "McpDiscoveryHookExecutor";
|
|
38440
|
+
EHookExecutorName2["BusinessDataPromptHookExecutor"] = "BusinessDataPromptHookExecutor";
|
|
38439
38441
|
EHookExecutorName2["CurrentTimeHookExecutor"] = "CurrentTimeHookExecutor";
|
|
38442
|
+
EHookExecutorName2["MemoryHookExecutor"] = "MemoryHookExecutor";
|
|
38440
38443
|
})(EHookExecutorName || (EHookExecutorName = {}));
|
|
38441
38444
|
|
|
38442
38445
|
// ../agent-a2ui-card-contract/dist/esm/protocol.js
|
|
@@ -38462,7 +38465,10 @@ function isPlainRecord(value) {
|
|
|
38462
38465
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
38463
38466
|
return false;
|
|
38464
38467
|
const prototype = Object.getPrototypeOf(value);
|
|
38465
|
-
|
|
38468
|
+
if (prototype === Object.prototype || prototype === null)
|
|
38469
|
+
return true;
|
|
38470
|
+
const constructor = Object.getOwnPropertyDescriptor(prototype, "constructor")?.value;
|
|
38471
|
+
return Object.getPrototypeOf(prototype) === null && typeof constructor === "function" && Function.prototype.toString.call(constructor) === Function.prototype.toString.call(Object);
|
|
38466
38472
|
}
|
|
38467
38473
|
function isJsonValue(value) {
|
|
38468
38474
|
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
@@ -41903,7 +41909,7 @@ function sha256Hex(value) {
|
|
|
41903
41909
|
const bitLength = bytes.length * 8;
|
|
41904
41910
|
words[bitLength >> 5] = (words[bitLength >> 5] ?? 0) | 128 << 24 - bitLength % 32;
|
|
41905
41911
|
words[(bitLength + 64 >> 9 << 4) + 15] = bitLength;
|
|
41906
|
-
const
|
|
41912
|
+
const constants2 = SHA256_CONSTANTS;
|
|
41907
41913
|
let state = [
|
|
41908
41914
|
1779033703,
|
|
41909
41915
|
3144134277,
|
|
@@ -41930,7 +41936,7 @@ function sha256Hex(value) {
|
|
|
41930
41936
|
for (let index = 0; index < 64; index += 1) {
|
|
41931
41937
|
const sum1 = rotateRight(e3, 6) ^ rotateRight(e3, 11) ^ rotateRight(e3, 25);
|
|
41932
41938
|
const choice = e3 & f3 ^ ~e3 & g2;
|
|
41933
|
-
const temporary1 = add(h, sum1, choice,
|
|
41939
|
+
const temporary1 = add(h, sum1, choice, constants2[index], schedule[index]);
|
|
41934
41940
|
const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
|
|
41935
41941
|
const majority = a & b3 ^ a & c ^ b3 & c;
|
|
41936
41942
|
const temporary2 = add(sum0, majority);
|
|
@@ -47447,6 +47453,10 @@ var MCP_PROXY_DESCRIPTION = [
|
|
|
47447
47453
|
"\u4EC5 mcp({}) \u5217\u51FA\u7684\u5DE5\u5177\u53EF\u8C03\u7528(\u672A\u58F0\u660E\u7684\u5DE5\u5177\u4E0D\u4F1A\u51FA\u73B0)\u3002"
|
|
47448
47454
|
].join("\n");
|
|
47449
47455
|
|
|
47456
|
+
// ../linkque-agent-runtime/dist/esm/impl/mcp/alipay/argsMapper.js
|
|
47457
|
+
var USER_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u7528\u6237\u6807\u8BC6");
|
|
47458
|
+
var APP_ID = Symbol("\u7CFB\u7EDF\u53D8\u91CF\u5C0F\u7A0B\u5E8F\u6807\u8BC6");
|
|
47459
|
+
|
|
47450
47460
|
// ../linkque-agent-runtime/dist/esm/core/telemetry/telemetryEnums.js
|
|
47451
47461
|
var ETelemetryDiagnosticCode;
|
|
47452
47462
|
(function(ETelemetryDiagnosticCode2) {
|
|
@@ -47524,6 +47534,24 @@ var LINKQUEGW_EVENT_TYPE_BY_STAGE = {
|
|
|
47524
47534
|
[EHookStage.RUN_READ]: "RUN_READ"
|
|
47525
47535
|
};
|
|
47526
47536
|
|
|
47537
|
+
// ../linkque-agent-runtime/dist/esm/core/memoryAdapter.js
|
|
47538
|
+
var EMemoryType;
|
|
47539
|
+
(function(EMemoryType2) {
|
|
47540
|
+
EMemoryType2["CONVERSATION"] = "conversation";
|
|
47541
|
+
EMemoryType2["LONG_TERM"] = "long_term";
|
|
47542
|
+
EMemoryType2["SHORT_TERM"] = "short_term";
|
|
47543
|
+
EMemoryType2["WORKING"] = "working";
|
|
47544
|
+
EMemoryType2["PREFERENCE"] = "preference";
|
|
47545
|
+
EMemoryType2["FACT"] = "fact";
|
|
47546
|
+
EMemoryType2["ACTION"] = "action";
|
|
47547
|
+
})(EMemoryType || (EMemoryType = {}));
|
|
47548
|
+
var EMemorySummaryStatus;
|
|
47549
|
+
(function(EMemorySummaryStatus2) {
|
|
47550
|
+
EMemorySummaryStatus2["COMPLETED"] = "completed";
|
|
47551
|
+
EMemorySummaryStatus2["FAILED"] = "failed";
|
|
47552
|
+
EMemorySummaryStatus2["CANCELLED"] = "cancelled";
|
|
47553
|
+
})(EMemorySummaryStatus || (EMemorySummaryStatus = {}));
|
|
47554
|
+
|
|
47527
47555
|
// ../../node_modules/zod/v4/core/core.js
|
|
47528
47556
|
var NEVER2 = Object.freeze({
|
|
47529
47557
|
status: "aborted"
|
|
@@ -53188,10 +53216,6 @@ var OAUTH_ERRORS = {
|
|
|
53188
53216
|
var TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
53189
53217
|
var RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
53190
53218
|
|
|
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
53219
|
// ../linkque-agent-runtime/dist/esm/impl/knowledge/linkqueKnowledgeSearchPort.js
|
|
53196
53220
|
var DEFAULT_LINKQUEGW_KNOWLEDGE_BASE_URL = RUNTIME_CONFIG_DEFAULTS.LINKQUEGW_KNOWLEDGE_BASE_URL;
|
|
53197
53221
|
|
|
@@ -53438,6 +53462,8 @@ var APPBASE_RUNTIME_CONFIG_DEFAULTS = Object.freeze({
|
|
|
53438
53462
|
LINKQUE_EMBEDDED_QUERY_ENABLED: "false",
|
|
53439
53463
|
RUN_DATABASE_ID: "linkque",
|
|
53440
53464
|
RUN_TABLE_ID: "linkque_conversation_runs",
|
|
53465
|
+
SESSION_MEMORY_DATABASE_ID: "linkque",
|
|
53466
|
+
SESSION_MEMORY_TABLE_ID: "linkque_session_memories",
|
|
53441
53467
|
SESSION_DATABASE_ID: "linkque",
|
|
53442
53468
|
SESSION_TABLE_ID: "linkque_sessions",
|
|
53443
53469
|
SESSION_LEASE_DATABASE_ID: "linkque",
|
|
@@ -55351,7 +55377,7 @@ var stopAgentServer = async (cwd) => {
|
|
|
55351
55377
|
|
|
55352
55378
|
// src/commands/build/dist.ts
|
|
55353
55379
|
var import_crypto7 = require("crypto");
|
|
55354
|
-
var
|
|
55380
|
+
var import_promises15 = require("fs/promises");
|
|
55355
55381
|
var import_path21 = __toESM(require("path"));
|
|
55356
55382
|
|
|
55357
55383
|
// src/utils/spawn.ts
|
|
@@ -55424,8 +55450,101 @@ var spawnManaged = async (options) => {
|
|
|
55424
55450
|
// src/commands/install.ts
|
|
55425
55451
|
var import_child_process3 = require("child_process");
|
|
55426
55452
|
var import_crypto4 = require("crypto");
|
|
55427
|
-
var
|
|
55453
|
+
var import_promises12 = require("fs/promises");
|
|
55428
55454
|
var import_path18 = __toESM(require("path"));
|
|
55455
|
+
|
|
55456
|
+
// src/utils/installObservation.ts
|
|
55457
|
+
var import_fs8 = require("fs");
|
|
55458
|
+
var import_promises11 = require("fs/promises");
|
|
55459
|
+
var import_util5 = require("util");
|
|
55460
|
+
var MAX_LOG_TAIL_BYTES = 64 * 1024;
|
|
55461
|
+
var COUNTS_LINE = /^\+ (\d+) added · (\d+) reused · (\d+) downloaded(?: \(\d+(?:\.\d+)? (?:B|kB|MB|GB)(?: @ \d+(?:\.\d+)? (?:B|kB|MB|GB)\/s)?\))?$/u;
|
|
55462
|
+
var DURATION_LINE = /^All packages installed \[(?:(?:(\d+)h)?(\d+)m(\d+)s|(\d+(?:\.\d+)?)s)\]$/u;
|
|
55463
|
+
var readInstallLogStart = async (logPath) => {
|
|
55464
|
+
try {
|
|
55465
|
+
const start = await (0, import_promises11.stat)(logPath);
|
|
55466
|
+
return start.isFile() ? start : void 0;
|
|
55467
|
+
} catch (error2) {
|
|
55468
|
+
return isNodeError(error2, "ENOENT") ? null : void 0;
|
|
55469
|
+
}
|
|
55470
|
+
};
|
|
55471
|
+
var readInstallLogSummary = async (logPath, start) => {
|
|
55472
|
+
if (start === void 0) return {};
|
|
55473
|
+
try {
|
|
55474
|
+
const log = await (0, import_promises11.open)(logPath, import_fs8.constants.O_RDONLY | import_fs8.constants.O_NONBLOCK);
|
|
55475
|
+
try {
|
|
55476
|
+
const end = await log.stat();
|
|
55477
|
+
if (!end.isFile() || start && (end.dev !== start.dev || end.ino !== start.ino)) {
|
|
55478
|
+
return {};
|
|
55479
|
+
}
|
|
55480
|
+
const offset = Math.max(start?.size ?? 0, end.size - MAX_LOG_TAIL_BYTES);
|
|
55481
|
+
if (offset >= end.size) return {};
|
|
55482
|
+
const buffer2 = Buffer.alloc(end.size - offset);
|
|
55483
|
+
const { bytesRead } = await log.read(buffer2, 0, buffer2.length, offset);
|
|
55484
|
+
if (bytesRead !== buffer2.length) return {};
|
|
55485
|
+
let tail = buffer2.toString("utf8");
|
|
55486
|
+
if (offset > (start?.size ?? 0)) {
|
|
55487
|
+
const firstLineEnd = tail.search(/[\r\n]/u);
|
|
55488
|
+
if (firstLineEnd === -1) return {};
|
|
55489
|
+
tail = tail.slice(firstLineEnd + 1);
|
|
55490
|
+
}
|
|
55491
|
+
const lines = (0, import_util5.stripVTControlCharacters)(tail).split(/[\r\n]+/u).filter((line) => line.trim());
|
|
55492
|
+
const lastLine = lines.at(-1) ?? "";
|
|
55493
|
+
const hasCompletionLine = lastLine === "All packages installed" || lastLine.startsWith("All packages installed [");
|
|
55494
|
+
const countsLine = hasCompletionLine ? lines.at(-2) ?? "" : lastLine;
|
|
55495
|
+
const counts = COUNTS_LINE.exec(countsLine);
|
|
55496
|
+
const duration3 = DURATION_LINE.exec(lastLine);
|
|
55497
|
+
const summary = {};
|
|
55498
|
+
if (counts && (hasCompletionLine || !lines.slice(0, -1).some((line) => COUNTS_LINE.test(line)))) {
|
|
55499
|
+
const [, rawAdded, rawReused, rawDownloaded] = counts;
|
|
55500
|
+
const added = Number(rawAdded);
|
|
55501
|
+
const reused = Number(rawReused);
|
|
55502
|
+
const downloaded = Number(rawDownloaded);
|
|
55503
|
+
if ([added, reused, downloaded, reused + downloaded].every(
|
|
55504
|
+
Number.isSafeInteger
|
|
55505
|
+
)) {
|
|
55506
|
+
summary.counts = { added, reused, downloaded };
|
|
55507
|
+
}
|
|
55508
|
+
}
|
|
55509
|
+
if (duration3) {
|
|
55510
|
+
const [, hours, minutes, seconds, secondsOnly] = duration3;
|
|
55511
|
+
const durationMs = Math.round(
|
|
55512
|
+
(Number(hours ?? 0) * 3600 + Number(minutes ?? 0) * 60 + Number(seconds ?? secondsOnly)) * 1e3
|
|
55513
|
+
);
|
|
55514
|
+
if (Number.isSafeInteger(durationMs)) {
|
|
55515
|
+
summary.utReportedDurationMs = durationMs;
|
|
55516
|
+
}
|
|
55517
|
+
}
|
|
55518
|
+
return summary;
|
|
55519
|
+
} finally {
|
|
55520
|
+
await log.close();
|
|
55521
|
+
}
|
|
55522
|
+
} catch {
|
|
55523
|
+
return {};
|
|
55524
|
+
}
|
|
55525
|
+
};
|
|
55526
|
+
var runWorkspaceInstall = async (command, cwd, logPath) => {
|
|
55527
|
+
const logStart = await readInstallLogStart(logPath);
|
|
55528
|
+
const startedAt = performance.now();
|
|
55529
|
+
const { exitCode } = await spawnManaged({
|
|
55530
|
+
command,
|
|
55531
|
+
args: ["install"],
|
|
55532
|
+
cwd,
|
|
55533
|
+
logPath,
|
|
55534
|
+
logHeader: `${command} install`
|
|
55535
|
+
});
|
|
55536
|
+
const durationMs = Math.round(performance.now() - startedAt);
|
|
55537
|
+
if (exitCode !== 0) return { exitCode };
|
|
55538
|
+
return {
|
|
55539
|
+
exitCode,
|
|
55540
|
+
installMetrics: {
|
|
55541
|
+
durationMs,
|
|
55542
|
+
...await readInstallLogSummary(logPath, logStart)
|
|
55543
|
+
}
|
|
55544
|
+
};
|
|
55545
|
+
};
|
|
55546
|
+
|
|
55547
|
+
// src/commands/install.ts
|
|
55429
55548
|
var RUNTIME_DIR2 = ".linkque/runtime";
|
|
55430
55549
|
var LOG_DIR = ".linkque/logs";
|
|
55431
55550
|
var INSTALL_LOCK = "install.lock";
|
|
@@ -55499,7 +55618,7 @@ var readDependencyInputs = async (cwd) => {
|
|
|
55499
55618
|
let lockfiles;
|
|
55500
55619
|
try {
|
|
55501
55620
|
[packageJson, lockfiles] = await Promise.all([
|
|
55502
|
-
(0,
|
|
55621
|
+
(0, import_promises12.readFile)(import_path18.default.join(cwd, "package.json"), "utf8"),
|
|
55503
55622
|
readLockfiles(cwd)
|
|
55504
55623
|
]);
|
|
55505
55624
|
} catch (error2) {
|
|
@@ -55611,7 +55730,7 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55611
55730
|
}
|
|
55612
55731
|
if (previousState?.fingerprint === fingerprint) {
|
|
55613
55732
|
try {
|
|
55614
|
-
await (0,
|
|
55733
|
+
await (0, import_promises12.rm)(statePath, { force: true });
|
|
55615
55734
|
} catch (error2) {
|
|
55616
55735
|
throw new LinkqueCliError(
|
|
55617
55736
|
"INSTALL_STATE_WRITE_FAILED",
|
|
@@ -55620,17 +55739,15 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55620
55739
|
);
|
|
55621
55740
|
}
|
|
55622
55741
|
}
|
|
55623
|
-
const
|
|
55624
|
-
|
|
55625
|
-
args: ["install"],
|
|
55742
|
+
const { exitCode, installMetrics } = await runWorkspaceInstall(
|
|
55743
|
+
toolchain.name,
|
|
55626
55744
|
cwd,
|
|
55627
|
-
|
|
55628
|
-
|
|
55629
|
-
|
|
55630
|
-
if (result.exitCode !== 0) {
|
|
55745
|
+
installLogPath(cwd)
|
|
55746
|
+
);
|
|
55747
|
+
if (exitCode !== 0) {
|
|
55631
55748
|
throw new LinkqueCliError(
|
|
55632
55749
|
"INSTALL_DEPENDENCY_RESOLVE_FAILED",
|
|
55633
|
-
`dependency installation failed with exit code ${
|
|
55750
|
+
`dependency installation failed with exit code ${exitCode}; see ${LOG_DIR}/${INSTALL_LOG}`
|
|
55634
55751
|
);
|
|
55635
55752
|
}
|
|
55636
55753
|
const installedFingerprint = await computeFingerprint(
|
|
@@ -55642,6 +55759,7 @@ var installDependenciesWhileLocked = async (cwd, { force }) => {
|
|
|
55642
55759
|
fingerprint: installedFingerprint,
|
|
55643
55760
|
forced: force,
|
|
55644
55761
|
installed: true,
|
|
55762
|
+
installMetrics,
|
|
55645
55763
|
packageManager: toolchain.name,
|
|
55646
55764
|
skipped: false
|
|
55647
55765
|
};
|
|
@@ -55756,10 +55874,10 @@ var inspectWorkspaceStatus = async (cwd) => {
|
|
|
55756
55874
|
|
|
55757
55875
|
// src/commands/build/archive.ts
|
|
55758
55876
|
var import_crypto6 = require("crypto");
|
|
55759
|
-
var
|
|
55877
|
+
var import_promises13 = require("fs/promises");
|
|
55760
55878
|
var import_path20 = __toESM(require("path"));
|
|
55761
55879
|
var import_stream = require("stream");
|
|
55762
|
-
var
|
|
55880
|
+
var import_promises14 = require("stream/promises");
|
|
55763
55881
|
|
|
55764
55882
|
// ../../node_modules/@zip.js/zip.js/lib/zip-fs-wasm.js
|
|
55765
55883
|
init_configuration();
|
|
@@ -56357,46 +56475,52 @@ var ZipWriter = class {
|
|
|
56357
56475
|
}
|
|
56358
56476
|
return false;
|
|
56359
56477
|
}
|
|
56360
|
-
|
|
56478
|
+
close(comment = EMPTY_UINT8_ARRAY, options = {}) {
|
|
56361
56479
|
const zipWriter = this;
|
|
56362
|
-
const { pendingAddFileCalls, writer } = this;
|
|
56363
|
-
const { writable } = writer;
|
|
56364
56480
|
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;
|
|
56481
|
+
return Promise.resolve(getWriterData(zipWriter.writer));
|
|
56387
56482
|
}
|
|
56388
|
-
|
|
56389
|
-
|
|
56390
|
-
const preventClose = !ownsWritable(writer) && getOptionValue2(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
56391
|
-
if (!preventClose) {
|
|
56392
|
-
await writable.getWriter().close();
|
|
56483
|
+
if (!zipWriter.pendingClose) {
|
|
56484
|
+
zipWriter.pendingClose = closeArchive(zipWriter, comment, options).finally(() => zipWriter.pendingClose = UNDEFINED_VALUE);
|
|
56393
56485
|
}
|
|
56394
|
-
return
|
|
56486
|
+
return zipWriter.pendingClose;
|
|
56395
56487
|
}
|
|
56396
56488
|
[SYMBOL_ASYNC_DISPOSE]() {
|
|
56397
56489
|
return this.close();
|
|
56398
56490
|
}
|
|
56399
56491
|
};
|
|
56492
|
+
async function closeArchive(zipWriter, comment, options) {
|
|
56493
|
+
const { pendingAddFileCalls, writer } = zipWriter;
|
|
56494
|
+
const { writable } = writer;
|
|
56495
|
+
if (!(comment instanceof Uint8Array)) {
|
|
56496
|
+
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
56497
|
+
}
|
|
56498
|
+
if (getLength(comment) > MAX_16_BITS) {
|
|
56499
|
+
throw new Error(ERR_INVALID_COMMENT);
|
|
56500
|
+
}
|
|
56501
|
+
while (pendingAddFileCalls.size) {
|
|
56502
|
+
await Promise.allSettled(Array.from(pendingAddFileCalls));
|
|
56503
|
+
}
|
|
56504
|
+
await Promise.allSettled(zipWriter.pendingErrors.map((watcher) => watcher.recorded));
|
|
56505
|
+
const unobservedWatchers = zipWriter.pendingErrors.filter((watcher) => watcher.failed && !watcher.observed);
|
|
56506
|
+
if (unobservedWatchers.length) {
|
|
56507
|
+
const unobservedErrors = unobservedWatchers.map((watcher) => watcher.error);
|
|
56508
|
+
unobservedWatchers.forEach((watcher) => watcher.observed = true);
|
|
56509
|
+
const [error2] = unobservedErrors;
|
|
56510
|
+
try {
|
|
56511
|
+
error2.entryErrors = unobservedErrors;
|
|
56512
|
+
} catch {
|
|
56513
|
+
}
|
|
56514
|
+
throw error2;
|
|
56515
|
+
}
|
|
56516
|
+
await closeFile(zipWriter, comment, options);
|
|
56517
|
+
zipWriter.archiveClosed = true;
|
|
56518
|
+
const preventClose = !ownsWritable(writer) && getOptionValue2(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
56519
|
+
if (!preventClose) {
|
|
56520
|
+
await writable.getWriter().close();
|
|
56521
|
+
}
|
|
56522
|
+
return getWriterData(writer);
|
|
56523
|
+
}
|
|
56400
56524
|
var WatchedPromise = class extends Promise {
|
|
56401
56525
|
then(onFulfilled, onRejected) {
|
|
56402
56526
|
const { watcher } = this;
|
|
@@ -59095,7 +59219,7 @@ var walkFiles = async (root, exclude = /* @__PURE__ */ new Set()) => {
|
|
|
59095
59219
|
const visit = async (current) => {
|
|
59096
59220
|
let entries;
|
|
59097
59221
|
try {
|
|
59098
|
-
entries = await (0,
|
|
59222
|
+
entries = await (0, import_promises13.readdir)(current, { withFileTypes: true });
|
|
59099
59223
|
} catch (error2) {
|
|
59100
59224
|
if (isNodeError(error2, "ENOENT")) return [];
|
|
59101
59225
|
throw error2;
|
|
@@ -59128,7 +59252,7 @@ var HashingArchiveWriter = class extends import_stream.Writable {
|
|
|
59128
59252
|
handle;
|
|
59129
59253
|
size = 0;
|
|
59130
59254
|
async initialize() {
|
|
59131
|
-
this.handle = await (0,
|
|
59255
|
+
this.handle = await (0, import_promises13.open)(this.archivePath, "wx");
|
|
59132
59256
|
}
|
|
59133
59257
|
identity() {
|
|
59134
59258
|
return { sha256: this.hash.digest("hex"), size: this.size };
|
|
@@ -59190,7 +59314,7 @@ var writeArchive = async (files, tempPath, options = {}, frozenContents = /* @__
|
|
|
59190
59314
|
try {
|
|
59191
59315
|
for (const file of files) {
|
|
59192
59316
|
const frozen = frozenContents.get(file.archivePath);
|
|
59193
|
-
const content = frozen ?? await (0,
|
|
59317
|
+
const content = frozen ?? await (0, import_promises13.readFile)(file.absolutePath);
|
|
59194
59318
|
await appendFile(file.archivePath, content);
|
|
59195
59319
|
}
|
|
59196
59320
|
await zip.close();
|
|
@@ -59204,7 +59328,7 @@ var writeArchive = async (files, tempPath, options = {}, frozenContents = /* @__
|
|
|
59204
59328
|
};
|
|
59205
59329
|
} catch (error2) {
|
|
59206
59330
|
output.destroy();
|
|
59207
|
-
await (0,
|
|
59331
|
+
await (0, import_promises14.finished)(output).catch(() => void 0);
|
|
59208
59332
|
if (error2 instanceof LinkqueCliError) throw error2;
|
|
59209
59333
|
throw new LinkqueCliError(
|
|
59210
59334
|
"BUILD_ARCHIVE_FAILED",
|
|
@@ -59234,7 +59358,7 @@ var runBuild = async (cwd) => {
|
|
|
59234
59358
|
};
|
|
59235
59359
|
var assertBuildCommand = async (cwd) => {
|
|
59236
59360
|
const packageJson = parseJsonObject(
|
|
59237
|
-
await (0,
|
|
59361
|
+
await (0, import_promises15.readFile)(import_path21.default.join(cwd, "package.json"), "utf8").catch((error2) => {
|
|
59238
59362
|
throw new LinkqueCliError(
|
|
59239
59363
|
"BUILD_COMMAND_NOT_FOUND",
|
|
59240
59364
|
"workspace package.json must contain a build script",
|
|
@@ -59267,7 +59391,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59267
59391
|
const outputPath = import_path21.default.join(cwd, OUTPUT_DIR);
|
|
59268
59392
|
const finalPath = import_path21.default.join(cwd, ARCHIVE_PATH);
|
|
59269
59393
|
const tempPath = `${finalPath}.${process.pid}.${(0, import_crypto7.randomUUID)()}.tmp`;
|
|
59270
|
-
await (0,
|
|
59394
|
+
await (0, import_promises15.rm)(finalPath, { force: true }).catch((error2) => {
|
|
59271
59395
|
throw new LinkqueCliError(
|
|
59272
59396
|
"BUILD_ARCHIVE_FAILED",
|
|
59273
59397
|
"stale build archive could not be removed",
|
|
@@ -59292,7 +59416,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59292
59416
|
);
|
|
59293
59417
|
}
|
|
59294
59418
|
await assertBuildCommand(cwd);
|
|
59295
|
-
await (0,
|
|
59419
|
+
await (0, import_promises15.rm)(outputPath, { force: true, recursive: true }).catch(
|
|
59296
59420
|
(error2) => {
|
|
59297
59421
|
throw new LinkqueCliError(
|
|
59298
59422
|
"BUILD_FAILED",
|
|
@@ -59327,7 +59451,7 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59327
59451
|
);
|
|
59328
59452
|
}
|
|
59329
59453
|
);
|
|
59330
|
-
await (0,
|
|
59454
|
+
await (0, import_promises15.rename)(tempPath, finalPath).catch((error2) => {
|
|
59331
59455
|
throw new LinkqueCliError(
|
|
59332
59456
|
"BUILD_ARCHIVE_FAILED",
|
|
59333
59457
|
"build archive could not be finalized",
|
|
@@ -59344,8 +59468,8 @@ var buildDistWhileLocked = async (cwd) => {
|
|
|
59344
59468
|
} catch (error2) {
|
|
59345
59469
|
try {
|
|
59346
59470
|
await Promise.all([
|
|
59347
|
-
(0,
|
|
59348
|
-
(0,
|
|
59471
|
+
(0, import_promises15.rm)(finalPath, { force: true }),
|
|
59472
|
+
(0, import_promises15.rm)(tempPath, { force: true })
|
|
59349
59473
|
]);
|
|
59350
59474
|
} catch (cleanupError) {
|
|
59351
59475
|
throw preservePrimaryFailure(error2, cleanupError);
|
|
@@ -59361,16 +59485,16 @@ var buildDist = async (cwd) => withWorkspaceLock(
|
|
|
59361
59485
|
releaseErrorCode: "BUILD_ARCHIVE_FAILED",
|
|
59362
59486
|
retryMs: LOCK_RETRY_MS3,
|
|
59363
59487
|
timeoutMs: LOCK_TIMEOUT_MS4,
|
|
59364
|
-
onReleaseFailure: () => (0,
|
|
59488
|
+
onReleaseFailure: () => (0, import_promises15.rm)(import_path21.default.join(cwd, ARCHIVE_PATH), { force: true })
|
|
59365
59489
|
},
|
|
59366
59490
|
() => buildDistWhileLocked(cwd)
|
|
59367
59491
|
);
|
|
59368
59492
|
|
|
59369
59493
|
// src/commands/build/snapshot.ts
|
|
59370
59494
|
var import_crypto8 = require("crypto");
|
|
59371
|
-
var import_promises15 = require("fs/promises");
|
|
59372
|
-
var import_path22 = __toESM(require("path"));
|
|
59373
59495
|
var import_promises16 = require("fs/promises");
|
|
59496
|
+
var import_path22 = __toESM(require("path"));
|
|
59497
|
+
var import_promises17 = require("fs/promises");
|
|
59374
59498
|
var ARTIFACTS_DIR = ".linkque/artifacts";
|
|
59375
59499
|
var AGENT_CONFIG_SOURCE_PATH = "agent_config.json";
|
|
59376
59500
|
var TEMPLATE_ARTIFACT_SOURCE_PATH = "template-artifact.json";
|
|
@@ -59390,7 +59514,7 @@ var snapshotFailure = (message, cause) => cause instanceof LinkqueCliError ? cau
|
|
|
59390
59514
|
var readTemplateVersion = async (cwd) => {
|
|
59391
59515
|
let content;
|
|
59392
59516
|
try {
|
|
59393
|
-
content = await (0,
|
|
59517
|
+
content = await (0, import_promises16.readFile)(
|
|
59394
59518
|
import_path22.default.join(cwd, TEMPLATE_ARTIFACT_SOURCE_PATH),
|
|
59395
59519
|
"utf8"
|
|
59396
59520
|
);
|
|
@@ -59419,7 +59543,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59419
59543
|
try {
|
|
59420
59544
|
let rootStat;
|
|
59421
59545
|
try {
|
|
59422
|
-
rootStat = await (0,
|
|
59546
|
+
rootStat = await (0, import_promises16.lstat)(cwd, { bigint: true });
|
|
59423
59547
|
} catch (error2) {
|
|
59424
59548
|
throw snapshotFailure("workspace source could not be inspected", error2);
|
|
59425
59549
|
}
|
|
@@ -59434,7 +59558,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59434
59558
|
);
|
|
59435
59559
|
const cardFilesPath = import_path22.default.join(relDir, "card-files.json");
|
|
59436
59560
|
await ensureParentDir(import_path22.default.join(cwd, cardFilesPath));
|
|
59437
|
-
await (0,
|
|
59561
|
+
await (0, import_promises17.writeFile)(import_path22.default.join(cwd, cardFilesPath), canonicalJson(cardSource));
|
|
59438
59562
|
const excludedComponents = new Set(BASE_EXCLUDED_COMPONENTS);
|
|
59439
59563
|
if (options.excludePlatformSdk) excludedComponents.add(".platform-sdk");
|
|
59440
59564
|
const walkedFiles = await walkFiles(cwd, excludedComponents).catch(
|
|
@@ -59483,7 +59607,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59483
59607
|
error2
|
|
59484
59608
|
);
|
|
59485
59609
|
});
|
|
59486
|
-
await (0,
|
|
59610
|
+
await (0, import_promises16.rename)(tempPath, finalPath).catch((error2) => {
|
|
59487
59611
|
throw new LinkqueCliError(
|
|
59488
59612
|
"SNAPSHOT_FAILED",
|
|
59489
59613
|
"source archive could not be finalized",
|
|
@@ -59503,7 +59627,7 @@ var buildSnapshotWhileLocked = async (cwd, options) => {
|
|
|
59503
59627
|
};
|
|
59504
59628
|
} catch (error2) {
|
|
59505
59629
|
try {
|
|
59506
|
-
await (0,
|
|
59630
|
+
await (0, import_promises16.rm)(dirPath, { force: true, recursive: true });
|
|
59507
59631
|
} catch (cleanupError) {
|
|
59508
59632
|
throw preservePrimaryFailure(error2, cleanupError);
|
|
59509
59633
|
}
|
|
@@ -59525,11 +59649,11 @@ var buildSnapshot = async (cwd, options = {}) => withWorkspaceLock(
|
|
|
59525
59649
|
|
|
59526
59650
|
// src/commands/card/index.ts
|
|
59527
59651
|
var import_crypto9 = require("crypto");
|
|
59528
|
-
var
|
|
59652
|
+
var import_promises19 = require("fs/promises");
|
|
59529
59653
|
var import_path24 = __toESM(require("path"));
|
|
59530
59654
|
|
|
59531
59655
|
// src/commands/mcpDescribe.ts
|
|
59532
|
-
var
|
|
59656
|
+
var import_promises18 = require("fs/promises");
|
|
59533
59657
|
var import_path23 = __toESM(require("path"));
|
|
59534
59658
|
var MCP_DETAIL_ENDPOINT_ENV = "LINKQUE_MCP_DETAIL_ENDPOINT";
|
|
59535
59659
|
var MCP_DETAIL_ENABLED_ENV = "LINKQUE_MCP_DETAIL_ENABLED";
|
|
@@ -59599,7 +59723,7 @@ function requireEnabled(env) {
|
|
|
59599
59723
|
async function readMountedMcp(cwd, resourceId) {
|
|
59600
59724
|
let content;
|
|
59601
59725
|
try {
|
|
59602
|
-
content = await (0,
|
|
59726
|
+
content = await (0, import_promises18.readFile)(import_path23.default.join(cwd, "agent_config.json"));
|
|
59603
59727
|
} catch {
|
|
59604
59728
|
throw new LinkqueCliError(
|
|
59605
59729
|
"MCP_CONFIG_READ_FAILED",
|
|
@@ -60043,14 +60167,14 @@ async function prepareCardBindingContext(cwd, draftId, resourceIds, env = proces
|
|
|
60043
60167
|
}
|
|
60044
60168
|
async function assertBindingContextDirectory(cwd, directory) {
|
|
60045
60169
|
try {
|
|
60046
|
-
const canonicalWorkspace = await (0,
|
|
60047
|
-
if (await (0,
|
|
60170
|
+
const canonicalWorkspace = await (0, import_promises19.realpath)(cwd);
|
|
60171
|
+
if (await (0, import_promises19.realpath)(directory) !== import_path24.default.join(canonicalWorkspace, import_path24.default.relative(cwd, directory))) {
|
|
60048
60172
|
throw new LinkqueCliError(
|
|
60049
60173
|
"CARD_DRAFT_INVALID",
|
|
60050
60174
|
"\u7ED1\u5B9A\u4E0A\u4E0B\u6587\u4E0D\u80FD\u4F4D\u4E8E\u7B26\u53F7\u94FE\u63A5\u76EE\u5F55"
|
|
60051
60175
|
);
|
|
60052
60176
|
}
|
|
60053
|
-
const entry = await (0,
|
|
60177
|
+
const entry = await (0, import_promises19.lstat)(
|
|
60054
60178
|
import_path24.default.join(directory, "binding-context.json")
|
|
60055
60179
|
).catch((cause) => {
|
|
60056
60180
|
if (isNodeError(cause, "ENOENT")) return void 0;
|
|
@@ -60169,7 +60293,7 @@ async function rollbackCardFinalize(cwd, rollbackToken) {
|
|
|
60169
60293
|
},
|
|
60170
60294
|
async () => {
|
|
60171
60295
|
const configPath = import_path24.default.join(cwd, AGENT_CONFIG_PATH);
|
|
60172
|
-
const current = await (0,
|
|
60296
|
+
const current = await (0, import_promises19.readFile)(configPath);
|
|
60173
60297
|
if (checksumBytes(current) !== payload.expectedConfigChecksum) {
|
|
60174
60298
|
throw new LinkqueCliError(
|
|
60175
60299
|
"CARD_FINALIZE_CONFLICT",
|
|
@@ -60308,7 +60432,7 @@ async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
|
|
|
60308
60432
|
await readOptionalJson(import_path24.default.join(directory, "binding-context.json"))
|
|
60309
60433
|
);
|
|
60310
60434
|
const configPath = import_path24.default.join(cwd, AGENT_CONFIG_PATH);
|
|
60311
|
-
const oldConfigBytes = await (0,
|
|
60435
|
+
const oldConfigBytes = await (0, import_promises19.readFile)(configPath);
|
|
60312
60436
|
const config3 = parseAgentConfig(await readAgentCards(configPath));
|
|
60313
60437
|
const resources = config3.agent.resources;
|
|
60314
60438
|
const existingIndex = resources.findIndex(
|
|
@@ -60499,7 +60623,7 @@ async function listDraftDirectories(cwd) {
|
|
|
60499
60623
|
const root = import_path24.default.join(cwd, DRAFT_ROOT);
|
|
60500
60624
|
let entries;
|
|
60501
60625
|
try {
|
|
60502
|
-
entries = await (0,
|
|
60626
|
+
entries = await (0, import_promises19.readdir)(root, { withFileTypes: true });
|
|
60503
60627
|
} catch (cause) {
|
|
60504
60628
|
if (isNodeError(cause, "ENOENT")) return [];
|
|
60505
60629
|
throw new LinkqueCliError(
|
|
@@ -60538,7 +60662,7 @@ function draftIssue(code, message, recoverable, severity) {
|
|
|
60538
60662
|
}
|
|
60539
60663
|
async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
|
|
60540
60664
|
try {
|
|
60541
|
-
const content = await (0,
|
|
60665
|
+
const content = await (0, import_promises19.readFile)(file, "utf8");
|
|
60542
60666
|
if (Buffer.byteLength(content, "utf8") > DRAFT_FILE_MAX_BYTES) {
|
|
60543
60667
|
throw new LinkqueCliError(
|
|
60544
60668
|
"CARD_DRAFT_INVALID",
|
|
@@ -60571,7 +60695,7 @@ async function readRequiredJson(file, missingCode = "CARD_DRAFT_INVALID") {
|
|
|
60571
60695
|
}
|
|
60572
60696
|
async function readRequiredJsonWithLimit(file, maxBytes) {
|
|
60573
60697
|
try {
|
|
60574
|
-
const content = await (0,
|
|
60698
|
+
const content = await (0, import_promises19.readFile)(file, "utf8");
|
|
60575
60699
|
if (Buffer.byteLength(content, "utf8") > maxBytes) {
|
|
60576
60700
|
throw new LinkqueCliError(
|
|
60577
60701
|
"CARD_DRAFT_INVALID",
|
|
@@ -60670,7 +60794,7 @@ async function readOptionalJsonObject(file) {
|
|
|
60670
60794
|
}
|
|
60671
60795
|
async function readModifiedAt(file) {
|
|
60672
60796
|
try {
|
|
60673
|
-
return (await (0,
|
|
60797
|
+
return (await (0, import_promises19.stat)(file)).mtime.toISOString();
|
|
60674
60798
|
} catch {
|
|
60675
60799
|
return "";
|
|
60676
60800
|
}
|
|
@@ -60791,13 +60915,13 @@ async function atomicWrite(file, content) {
|
|
|
60791
60915
|
const temporary = `${file}.${process.pid}.${(0, import_crypto9.randomUUID)()}.tmp`;
|
|
60792
60916
|
let handle;
|
|
60793
60917
|
try {
|
|
60794
|
-
handle = await (0,
|
|
60918
|
+
handle = await (0, import_promises19.open)(temporary, "wx", 384);
|
|
60795
60919
|
await handle.writeFile(content);
|
|
60796
60920
|
await handle.sync();
|
|
60797
60921
|
await handle.close();
|
|
60798
60922
|
handle = void 0;
|
|
60799
|
-
await (0,
|
|
60800
|
-
const directoryHandle = await (0,
|
|
60923
|
+
await (0, import_promises19.rename)(temporary, file);
|
|
60924
|
+
const directoryHandle = await (0, import_promises19.open)(import_path24.default.dirname(file), "r");
|
|
60801
60925
|
try {
|
|
60802
60926
|
await directoryHandle.sync();
|
|
60803
60927
|
} finally {
|
|
@@ -60805,7 +60929,7 @@ async function atomicWrite(file, content) {
|
|
|
60805
60929
|
}
|
|
60806
60930
|
} catch (cause) {
|
|
60807
60931
|
await handle?.close().catch(() => void 0);
|
|
60808
|
-
await (0,
|
|
60932
|
+
await (0, import_promises19.unlink)(temporary).catch(() => void 0);
|
|
60809
60933
|
throw new LinkqueCliError(
|
|
60810
60934
|
"CARD_FINALIZE_WRITE_FAILED",
|
|
60811
60935
|
`\u539F\u5B50\u5199\u5165\u5931\u8D25: ${import_path24.default.basename(file)}`,
|
|
@@ -60834,13 +60958,13 @@ function parseRollbackToken(token) {
|
|
|
60834
60958
|
|
|
60835
60959
|
// src/commands/dev.ts
|
|
60836
60960
|
var import_child_process4 = require("child_process");
|
|
60837
|
-
var
|
|
60961
|
+
var import_promises21 = require("fs/promises");
|
|
60838
60962
|
var import_net2 = require("net");
|
|
60839
60963
|
var import_path26 = __toESM(require("path"));
|
|
60840
60964
|
|
|
60841
60965
|
// src/commands/inspector.ts
|
|
60842
60966
|
var import_module = require("module");
|
|
60843
|
-
var
|
|
60967
|
+
var import_promises20 = require("fs/promises");
|
|
60844
60968
|
var import_os3 = require("os");
|
|
60845
60969
|
var import_path25 = __toESM(require("path"));
|
|
60846
60970
|
var import_url = require("url");
|
|
@@ -60891,7 +61015,7 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60891
61015
|
);
|
|
60892
61016
|
}
|
|
60893
61017
|
try {
|
|
60894
|
-
const fileStat = await (0,
|
|
61018
|
+
const fileStat = await (0, import_promises20.lstat)(requestFile);
|
|
60895
61019
|
if (fileStat.isSymbolicLink() || !fileStat.isFile()) {
|
|
60896
61020
|
throw new LinkqueCliError(
|
|
60897
61021
|
"INSPECTOR_PATH_FORBIDDEN",
|
|
@@ -60905,8 +61029,8 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60905
61029
|
);
|
|
60906
61030
|
}
|
|
60907
61031
|
const [directoryRealPath, fileRealPath] = await Promise.all([
|
|
60908
|
-
(0,
|
|
60909
|
-
(0,
|
|
61032
|
+
(0, import_promises20.realpath)(managedRequestDirectory()),
|
|
61033
|
+
(0, import_promises20.realpath)(requestFile)
|
|
60910
61034
|
]);
|
|
60911
61035
|
const relative = import_path25.default.relative(directoryRealPath, fileRealPath);
|
|
60912
61036
|
if (relative === "" || relative.startsWith(`..${import_path25.default.sep}`) || import_path25.default.isAbsolute(relative)) {
|
|
@@ -60934,7 +61058,7 @@ var assertManagedRequestFile = async (requestFile) => {
|
|
|
60934
61058
|
var readInspectorRequest = async (requestFile) => {
|
|
60935
61059
|
await assertManagedRequestFile(requestFile);
|
|
60936
61060
|
try {
|
|
60937
|
-
const content = await (0,
|
|
61061
|
+
const content = await (0, import_promises20.readFile)(requestFile, "utf8");
|
|
60938
61062
|
if (Buffer.byteLength(content, "utf8") > REQUEST_MAX_BYTES) {
|
|
60939
61063
|
throw new LinkqueCliError(
|
|
60940
61064
|
"INSPECTOR_REQUEST_INVALID",
|
|
@@ -61137,7 +61261,7 @@ var isPortListening2 = (port) => new Promise((resolve2) => {
|
|
|
61137
61261
|
});
|
|
61138
61262
|
async function removeMatchingState2(statePath, pid) {
|
|
61139
61263
|
const owned = await readOwnedDevState(statePath);
|
|
61140
|
-
if (owned?.pid === pid) await (0,
|
|
61264
|
+
if (owned?.pid === pid) await (0, import_promises21.rm)(statePath, { force: true });
|
|
61141
61265
|
}
|
|
61142
61266
|
async function terminateOwner2(statePath, pid) {
|
|
61143
61267
|
if (!isProcessAlive(pid)) {
|
|
@@ -61177,7 +61301,7 @@ var inspectRecordedDevServer = async (cwd) => {
|
|
|
61177
61301
|
}
|
|
61178
61302
|
const owned = parseOwnedDevState(content);
|
|
61179
61303
|
if (owned === null) {
|
|
61180
|
-
await (0,
|
|
61304
|
+
await (0, import_promises21.rm)(statePath, { force: true });
|
|
61181
61305
|
return { state: null, status: stopped2("STALE") };
|
|
61182
61306
|
}
|
|
61183
61307
|
const state = owned;
|
|
@@ -61406,7 +61530,7 @@ var stopDevServer = async (cwd) => {
|
|
|
61406
61530
|
async () => {
|
|
61407
61531
|
const owned = await readOwnedDevState(statePath);
|
|
61408
61532
|
if (owned !== null) await terminateOwner2(statePath, owned.pid);
|
|
61409
|
-
await (0,
|
|
61533
|
+
await (0, import_promises21.rm)(statePath, { force: true });
|
|
61410
61534
|
return { stopped: true };
|
|
61411
61535
|
}
|
|
61412
61536
|
);
|
|
@@ -61414,7 +61538,7 @@ var stopDevServer = async (cwd) => {
|
|
|
61414
61538
|
|
|
61415
61539
|
// src/commands/platformSdk/apply.ts
|
|
61416
61540
|
var import_crypto10 = require("crypto");
|
|
61417
|
-
var
|
|
61541
|
+
var import_promises22 = require("fs/promises");
|
|
61418
61542
|
var import_path27 = __toESM(require("path"));
|
|
61419
61543
|
var PLATFORM_SDK_DIR = ".platform-sdk";
|
|
61420
61544
|
var PLATFORM_SDK_VERSION_FILE = `${PLATFORM_SDK_DIR}/version.json`;
|
|
@@ -61475,12 +61599,12 @@ var extractArchive = async (cwd, archive, manifest) => {
|
|
|
61475
61599
|
}
|
|
61476
61600
|
const destination = import_path27.default.join(cwd, ...entryPath.split("/"));
|
|
61477
61601
|
if (entry.directory) {
|
|
61478
|
-
await (0,
|
|
61602
|
+
await (0, import_promises22.mkdir)(destination, { recursive: true });
|
|
61479
61603
|
continue;
|
|
61480
61604
|
}
|
|
61481
61605
|
const bytes = await entry.getData(new Uint8ArrayWriter());
|
|
61482
|
-
await (0,
|
|
61483
|
-
await (0,
|
|
61606
|
+
await (0, import_promises22.mkdir)(import_path27.default.dirname(destination), { recursive: true });
|
|
61607
|
+
await (0, import_promises22.writeFile)(destination, bytes, { flag: "wx" });
|
|
61484
61608
|
extractedFiles.set(entryPath, sha256(bytes));
|
|
61485
61609
|
}
|
|
61486
61610
|
} finally {
|
|
@@ -61499,7 +61623,7 @@ var validateVersionMarker = async (cwd, manifest) => {
|
|
|
61499
61623
|
let value;
|
|
61500
61624
|
try {
|
|
61501
61625
|
value = JSON.parse(
|
|
61502
|
-
await (0,
|
|
61626
|
+
await (0, import_promises22.readFile)(import_path27.default.join(cwd, PLATFORM_SDK_VERSION_FILE), "utf8")
|
|
61503
61627
|
);
|
|
61504
61628
|
} catch (error2) {
|
|
61505
61629
|
throw new LinkqueCliError(
|
|
@@ -61519,7 +61643,7 @@ var rewritePackageJson = async (cwd, manifest) => {
|
|
|
61519
61643
|
const packageJsonPath = import_path27.default.join(cwd, "package.json");
|
|
61520
61644
|
let packageJson;
|
|
61521
61645
|
try {
|
|
61522
|
-
packageJson = JSON.parse(await (0,
|
|
61646
|
+
packageJson = JSON.parse(await (0, import_promises22.readFile)(packageJsonPath, "utf8"));
|
|
61523
61647
|
} catch (error2) {
|
|
61524
61648
|
throw new LinkqueCliError(
|
|
61525
61649
|
"PLATFORM_SDK_APPLY_FAILED",
|
|
@@ -61559,8 +61683,8 @@ var rewritePackageJson = async (cwd, manifest) => {
|
|
|
61559
61683
|
};
|
|
61560
61684
|
var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
61561
61685
|
const [manifestContent, archive] = await Promise.all([
|
|
61562
|
-
(0,
|
|
61563
|
-
(0,
|
|
61686
|
+
(0, import_promises22.readFile)(import_path27.default.resolve(cwd, manifestPath), "utf8"),
|
|
61687
|
+
(0, import_promises22.readFile)(import_path27.default.resolve(cwd, archivePath))
|
|
61564
61688
|
]).catch((error2) => {
|
|
61565
61689
|
throw new LinkqueCliError(
|
|
61566
61690
|
"PLATFORM_SDK_APPLY_FAILED",
|
|
@@ -61575,7 +61699,7 @@ var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
|
61575
61699
|
"platform SDK archive identity does not match the manifest"
|
|
61576
61700
|
);
|
|
61577
61701
|
}
|
|
61578
|
-
await (0,
|
|
61702
|
+
await (0, import_promises22.rm)(import_path27.default.join(cwd, PLATFORM_SDK_DIR), { force: true, recursive: true });
|
|
61579
61703
|
try {
|
|
61580
61704
|
await extractArchive(cwd, archive, manifest);
|
|
61581
61705
|
await validateVersionMarker(cwd, manifest);
|
|
@@ -61587,7 +61711,7 @@ var applyWhileLocked = async (cwd, manifestPath, archivePath, options) => {
|
|
|
61587
61711
|
let templateVersion;
|
|
61588
61712
|
try {
|
|
61589
61713
|
const artifact = JSON.parse(
|
|
61590
|
-
await (0,
|
|
61714
|
+
await (0, import_promises22.readFile)(import_path27.default.join(cwd, "template-artifact.json"), "utf8")
|
|
61591
61715
|
);
|
|
61592
61716
|
templateVersion = typeof artifact.templateVersion === "string" ? artifact.templateVersion : void 0;
|
|
61593
61717
|
} catch {
|
|
@@ -61627,7 +61751,7 @@ var applyPlatformSdk = async (cwd, manifestPath, archivePath, options = {}) => w
|
|
|
61627
61751
|
);
|
|
61628
61752
|
|
|
61629
61753
|
// src/commands/unzip.ts
|
|
61630
|
-
var
|
|
61754
|
+
var import_promises23 = require("fs/promises");
|
|
61631
61755
|
var import_path28 = __toESM(require("path"));
|
|
61632
61756
|
var MAX_ZIP_BYTES = 70 * 1024 * 1024;
|
|
61633
61757
|
var MAX_FILE_COUNT = 5e3;
|
|
@@ -61659,7 +61783,7 @@ var SourceArchiveExtractor = class {
|
|
|
61659
61783
|
}
|
|
61660
61784
|
async extract() {
|
|
61661
61785
|
await this.assertInputs();
|
|
61662
|
-
const handle = await (0,
|
|
61786
|
+
const handle = await (0, import_promises23.open)(this.inputPath, "r").catch((error2) => {
|
|
61663
61787
|
throw new LinkqueCliError(
|
|
61664
61788
|
"UNZIP_INPUT_INVALID",
|
|
61665
61789
|
"unzip input archive could not be opened",
|
|
@@ -61695,7 +61819,7 @@ var SourceArchiveExtractor = class {
|
|
|
61695
61819
|
}
|
|
61696
61820
|
let inputStat;
|
|
61697
61821
|
try {
|
|
61698
|
-
inputStat = await (0,
|
|
61822
|
+
inputStat = await (0, import_promises23.stat)(this.inputPath);
|
|
61699
61823
|
} catch (error2) {
|
|
61700
61824
|
throw new LinkqueCliError(
|
|
61701
61825
|
"UNZIP_INPUT_INVALID",
|
|
@@ -61709,7 +61833,7 @@ var SourceArchiveExtractor = class {
|
|
|
61709
61833
|
}
|
|
61710
61834
|
let outputStat;
|
|
61711
61835
|
try {
|
|
61712
|
-
outputStat = await (0,
|
|
61836
|
+
outputStat = await (0, import_promises23.lstat)(this.outputPath);
|
|
61713
61837
|
} catch (error2) {
|
|
61714
61838
|
throw new LinkqueCliError(
|
|
61715
61839
|
"UNZIP_INPUT_INVALID",
|
|
@@ -61720,7 +61844,7 @@ var SourceArchiveExtractor = class {
|
|
|
61720
61844
|
if (outputStat.isSymbolicLink() || !outputStat.isDirectory()) {
|
|
61721
61845
|
this.invalid("unzip output must be an existing directory");
|
|
61722
61846
|
}
|
|
61723
|
-
if ((await (0,
|
|
61847
|
+
if ((await (0, import_promises23.readdir)(this.outputPath)).length > 0) {
|
|
61724
61848
|
this.invalid("unzip output directory must be empty");
|
|
61725
61849
|
}
|
|
61726
61850
|
}
|
|
@@ -61758,9 +61882,9 @@ var SourceArchiveExtractor = class {
|
|
|
61758
61882
|
}
|
|
61759
61883
|
async extractFile(file) {
|
|
61760
61884
|
const destination = this.resolveDestination(file.filename);
|
|
61761
|
-
await (0,
|
|
61885
|
+
await (0, import_promises23.mkdir)(import_path28.default.dirname(destination), { recursive: true });
|
|
61762
61886
|
this.sourceChecksum.appendFileHeader(file.filename, file.size);
|
|
61763
|
-
const handle = await (0,
|
|
61887
|
+
const handle = await (0, import_promises23.open)(destination, "wx");
|
|
61764
61888
|
let written = 0;
|
|
61765
61889
|
try {
|
|
61766
61890
|
await file.entry.getData(
|
|
@@ -62537,7 +62661,7 @@ function readTraceContent(input) {
|
|
|
62537
62661
|
// src/utils/otlpScanner.ts
|
|
62538
62662
|
var import_node_path13 = __toESM(require("node:path"));
|
|
62539
62663
|
var import_node_crypto5 = require("node:crypto");
|
|
62540
|
-
var
|
|
62664
|
+
var import_promises24 = require("node:fs/promises");
|
|
62541
62665
|
|
|
62542
62666
|
// src/commands/runs/types.ts
|
|
62543
62667
|
var OTLP_LOG_FILES = {
|
|
@@ -62593,7 +62717,7 @@ async function scanRetainedLogs(cwd, pinned, options) {
|
|
|
62593
62717
|
const dir = import_node_path13.default.join(cwd, LOGS_ROOT);
|
|
62594
62718
|
let files;
|
|
62595
62719
|
try {
|
|
62596
|
-
files = await (0,
|
|
62720
|
+
files = await (0, import_promises24.readdir)(dir);
|
|
62597
62721
|
} catch (error2) {
|
|
62598
62722
|
if (isNodeError(error2, "ENOENT"))
|
|
62599
62723
|
return { facts: [], warnings: ["source_unavailable"], readWindow: [] };
|
|
@@ -62616,14 +62740,14 @@ async function scanRetainedLogs(cwd, pinned, options) {
|
|
|
62616
62740
|
try {
|
|
62617
62741
|
const source = retainedFiles.get(file);
|
|
62618
62742
|
const filePath = import_node_path13.default.join(dir, file);
|
|
62619
|
-
const before = await (0,
|
|
62743
|
+
const before = await (0, import_promises24.stat)(filePath);
|
|
62620
62744
|
if (options && scannedBytes + before.size > options.maxBytes)
|
|
62621
62745
|
throw new RangeError("\u539F\u59CB\u65E5\u5FD7\u8D85\u8FC7\u5F52\u6863\u8BFB\u53D6\u4E0A\u9650");
|
|
62622
|
-
const content = await (0,
|
|
62746
|
+
const content = await (0, import_promises24.readFile)(filePath);
|
|
62623
62747
|
scannedBytes += content.length;
|
|
62624
62748
|
if (options && scannedBytes > options.maxBytes)
|
|
62625
62749
|
throw new RangeError("\u539F\u59CB\u65E5\u5FD7\u8D85\u8FC7\u5F52\u6863\u8BFB\u53D6\u4E0A\u9650");
|
|
62626
|
-
const after = await (0,
|
|
62750
|
+
const after = await (0, import_promises24.stat)(filePath);
|
|
62627
62751
|
if (before.ino !== after.ino || after.size < before.size) {
|
|
62628
62752
|
warnings.push("log_rotated_during_read");
|
|
62629
62753
|
continue;
|
|
@@ -62849,9 +62973,9 @@ var scanContent = async (input) => {
|
|
|
62849
62973
|
var import_node_path14 = __toESM(require("node:path"));
|
|
62850
62974
|
var import_node_fs9 = require("node:fs");
|
|
62851
62975
|
var import_node_stream2 = require("node:stream");
|
|
62852
|
-
var
|
|
62976
|
+
var import_promises25 = require("node:stream/promises");
|
|
62853
62977
|
var import_node_zlib2 = require("node:zlib");
|
|
62854
|
-
var
|
|
62978
|
+
var import_promises26 = require("node:fs/promises");
|
|
62855
62979
|
var TURN_ARCHIVE_MAX_BYTES = 16 * 1024 * 1024;
|
|
62856
62980
|
var TURN_SOURCE_MAX_BYTES = 64 * 1024 * 1024;
|
|
62857
62981
|
var TURN_UNCOMPRESSED_ARCHIVE_MAX_BYTES = 64 * 1024 * 1024;
|
|
@@ -62878,8 +63002,8 @@ async function exportTurn(cwd, identity) {
|
|
|
62878
63002
|
"\u76EE\u6807\u8F6E\u6B21\u65E5\u5FD7\u4E0D\u53EF\u7528"
|
|
62879
63003
|
);
|
|
62880
63004
|
const root = import_node_path14.default.join(cwd, ".linkque", "tmp");
|
|
62881
|
-
await (0,
|
|
62882
|
-
const directory = await (0,
|
|
63005
|
+
await (0, import_promises26.mkdir)(root, { recursive: true });
|
|
63006
|
+
const directory = await (0, import_promises26.mkdtemp)(import_node_path14.default.join(root, "turn-share-"));
|
|
62883
63007
|
const archivePath = import_node_path14.default.join(directory, "logs.tar.gz");
|
|
62884
63008
|
let result;
|
|
62885
63009
|
try {
|
|
@@ -62900,7 +63024,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62900
63024
|
if (payloadBytes > TURN_UNCOMPRESSED_ARCHIVE_MAX_BYTES)
|
|
62901
63025
|
throw new RangeError("\u672A\u538B\u7F29\u5F52\u6863\u5185\u5BB9\u8D85\u8FC7\u4E0A\u9650");
|
|
62902
63026
|
for (const [name, value] of Object.entries(files))
|
|
62903
|
-
await (0,
|
|
63027
|
+
await (0, import_promises26.writeFile)(import_node_path14.default.join(directory, name), value, { flag: "wx" });
|
|
62904
63028
|
let uncompressedBytes = 0;
|
|
62905
63029
|
let compressedBytes = 0;
|
|
62906
63030
|
const rawBudget = new import_node_stream2.Transform({
|
|
@@ -62921,7 +63045,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62921
63045
|
);
|
|
62922
63046
|
}
|
|
62923
63047
|
});
|
|
62924
|
-
await (0,
|
|
63048
|
+
await (0, import_promises25.pipeline)(
|
|
62925
63049
|
Qn(
|
|
62926
63050
|
{ cwd: directory, portable: true },
|
|
62927
63051
|
Object.keys(files)
|
|
@@ -62933,7 +63057,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62933
63057
|
);
|
|
62934
63058
|
result = { archivePath, compressedBytes, uncompressedBytes };
|
|
62935
63059
|
} catch (cause) {
|
|
62936
|
-
await (0,
|
|
63060
|
+
await (0, import_promises26.rm)(directory, { recursive: true, force: true }).catch(
|
|
62937
63061
|
() => void 0
|
|
62938
63062
|
);
|
|
62939
63063
|
throw new LinkqueCliError(
|
|
@@ -62943,7 +63067,7 @@ async function exportTurn(cwd, identity) {
|
|
|
62943
63067
|
);
|
|
62944
63068
|
}
|
|
62945
63069
|
for (const name of ["manifest.json", "logs.jsonl", "traces.jsonl"]) {
|
|
62946
|
-
await (0,
|
|
63070
|
+
await (0, import_promises26.rm)(import_node_path14.default.join(directory, name), { force: true }).catch(
|
|
62947
63071
|
() => void 0
|
|
62948
63072
|
);
|
|
62949
63073
|
}
|