linkque-cli-v2 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-XGIMLCNP.js → chunk-MR5QT2A5.js} +37 -13
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +1 -1
- package/worker.js +37 -13
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-XGIMLCNP.js → chunk-MR5QT2A5.js}
RENAMED
|
@@ -16583,6 +16583,7 @@ var require_dist2 = __commonJS({
|
|
|
16583
16583
|
// ../linkque-agent-runtime/dist/esm/core/types.js
|
|
16584
16584
|
var EDebugLogScope;
|
|
16585
16585
|
(function(EDebugLogScope2) {
|
|
16586
|
+
EDebugLogScope2["CONFIG"] = "CONFIG";
|
|
16586
16587
|
EDebugLogScope2["LLM"] = "LLM";
|
|
16587
16588
|
EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
|
|
16588
16589
|
EDebugLogScope2["MCP"] = "MCP";
|
|
@@ -52805,6 +52806,8 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
52805
52806
|
hookMetricsSink;
|
|
52806
52807
|
/** 装配期固化的统一诊断 sink(逐 run options.debugLog 可覆盖)。 */
|
|
52807
52808
|
portsDebugLog;
|
|
52809
|
+
/** 插件处理后、runtime 实际使用的完整 Agent Config JSON 快照。 */
|
|
52810
|
+
effectiveAgentConfigJson;
|
|
52808
52811
|
// —— 从 IAgentProtocol 提取并固化的运行期默认(经 create 注入)——
|
|
52809
52812
|
/** systemPrompt 默认(来自 protocol.agent.systemPrompt.content)。 */
|
|
52810
52813
|
defaultSystemPrompt = "";
|
|
@@ -52888,6 +52891,11 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
52888
52891
|
rt.agentId = agentConfig.agentId;
|
|
52889
52892
|
rt.followUpQuestionGenerationEnabled = followUpQuestionGenerationEnabled;
|
|
52890
52893
|
rt.hookResources = normalizeHookResources(agentConfig.agent.resources.filter((r) => r.resourceType === EResourceType.HOOK));
|
|
52894
|
+
try {
|
|
52895
|
+
rt.effectiveAgentConfigJson = JSON.stringify(agentConfig);
|
|
52896
|
+
} catch {
|
|
52897
|
+
rt.effectiveAgentConfigJson = void 0;
|
|
52898
|
+
}
|
|
52891
52899
|
return rt;
|
|
52892
52900
|
}
|
|
52893
52901
|
async prepareFollowUpQuestionContext(sessionId, history = []) {
|
|
@@ -52908,6 +52916,12 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
52908
52916
|
async *runAgentLoop(request, auth2, options = {}) {
|
|
52909
52917
|
const sessionId = options.sessionId;
|
|
52910
52918
|
const debugLog = options.debugLog ?? this.portsDebugLog;
|
|
52919
|
+
if (debugLog) {
|
|
52920
|
+
try {
|
|
52921
|
+
debugLog(this.effectiveAgentConfigJson === void 0 ? "[agent-config] final=<Agent Config \u5E8F\u5217\u5316\u5931\u8D25\uFF0C\u65E0\u6CD5\u6253\u5370\u5B8C\u6574\u5185\u5BB9>" : `[agent-config] final=${this.effectiveAgentConfigJson}`, EDebugLogScope.CONFIG);
|
|
52922
|
+
} catch {
|
|
52923
|
+
}
|
|
52924
|
+
}
|
|
52911
52925
|
const newTurns = request.messages.map((m) => ({
|
|
52912
52926
|
role: m.role,
|
|
52913
52927
|
content: m.content,
|
|
@@ -53015,6 +53029,19 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
53015
53029
|
let assistantText = "";
|
|
53016
53030
|
let failed = false;
|
|
53017
53031
|
let runError;
|
|
53032
|
+
let terminalHookDispatched = false;
|
|
53033
|
+
const dispatchTerminalHook = async () => {
|
|
53034
|
+
if (terminalHookDispatched || hookDispatcher.isEmpty)
|
|
53035
|
+
return;
|
|
53036
|
+
terminalHookDispatched = true;
|
|
53037
|
+
if (failed) {
|
|
53038
|
+
await hookDispatcher.dispatch(EHookStage.RUN_FAILED, hookCommonParams, {
|
|
53039
|
+
error: runError ?? { message: "unknown error" }
|
|
53040
|
+
});
|
|
53041
|
+
return;
|
|
53042
|
+
}
|
|
53043
|
+
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, { runDurationMs: Date.now() - runStartedAt });
|
|
53044
|
+
};
|
|
53018
53045
|
try {
|
|
53019
53046
|
for await (const ev of this.agentLoop.run(agentReq)) {
|
|
53020
53047
|
if (ev.type === "delta")
|
|
@@ -53022,6 +53049,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
53022
53049
|
if (ev.type === "error") {
|
|
53023
53050
|
failed = true;
|
|
53024
53051
|
runError = { message: ev.error.message, code: ev.error.code };
|
|
53052
|
+
await dispatchTerminalHook();
|
|
53025
53053
|
}
|
|
53026
53054
|
if (ev.type === "done" && !failed && sessionId !== void 0) {
|
|
53027
53055
|
const completedTurns = [
|
|
@@ -53036,22 +53064,18 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
53036
53064
|
}
|
|
53037
53065
|
}
|
|
53038
53066
|
}
|
|
53067
|
+
if (ev.type === "done")
|
|
53068
|
+
await dispatchTerminalHook();
|
|
53039
53069
|
yield ev;
|
|
53040
53070
|
}
|
|
53041
|
-
|
|
53042
|
-
if (failed) {
|
|
53043
|
-
await hookDispatcher.dispatch(EHookStage.RUN_FAILED, hookCommonParams, { error: runError ?? { message: "unknown error" } });
|
|
53044
|
-
} else {
|
|
53045
|
-
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, { runDurationMs: Date.now() - runStartedAt });
|
|
53046
|
-
}
|
|
53047
|
-
}
|
|
53071
|
+
await dispatchTerminalHook();
|
|
53048
53072
|
} catch (error) {
|
|
53049
|
-
if (!
|
|
53050
|
-
|
|
53051
|
-
|
|
53052
|
-
|
|
53053
|
-
|
|
53054
|
-
|
|
53073
|
+
if (!terminalHookDispatched) {
|
|
53074
|
+
failed = true;
|
|
53075
|
+
runError = {
|
|
53076
|
+
message: error instanceof Error ? error.message : String(error)
|
|
53077
|
+
};
|
|
53078
|
+
await dispatchTerminalHook();
|
|
53055
53079
|
}
|
|
53056
53080
|
throw error;
|
|
53057
53081
|
} finally {
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
parseConversationRunRequest,
|
|
52
52
|
parseSkillFile,
|
|
53
53
|
streamToConversationEvents
|
|
54
|
-
} from "../../chunk-
|
|
54
|
+
} from "../../chunk-MR5QT2A5.js";
|
|
55
55
|
import "../../chunk-XUFLSZM4.js";
|
|
56
56
|
import "../../chunk-I64V3ICJ.js";
|
|
57
57
|
import "../../chunk-6MHDOBWO.js";
|
package/worker.js
CHANGED
|
@@ -4981,6 +4981,7 @@ var init_types2 = __esm({
|
|
|
4981
4981
|
"../linkque-agent-runtime/dist/esm/core/types.js"() {
|
|
4982
4982
|
"use strict";
|
|
4983
4983
|
(function(EDebugLogScope2) {
|
|
4984
|
+
EDebugLogScope2["CONFIG"] = "CONFIG";
|
|
4984
4985
|
EDebugLogScope2["LLM"] = "LLM";
|
|
4985
4986
|
EDebugLogScope2["PI_EVENT"] = "PI_EVENT";
|
|
4986
4987
|
EDebugLogScope2["MCP"] = "MCP";
|
|
@@ -188764,6 +188765,8 @@ var init_agentRuntime = __esm({
|
|
|
188764
188765
|
hookMetricsSink;
|
|
188765
188766
|
/** 装配期固化的统一诊断 sink(逐 run options.debugLog 可覆盖)。 */
|
|
188766
188767
|
portsDebugLog;
|
|
188768
|
+
/** 插件处理后、runtime 实际使用的完整 Agent Config JSON 快照。 */
|
|
188769
|
+
effectiveAgentConfigJson;
|
|
188767
188770
|
// —— 从 IAgentProtocol 提取并固化的运行期默认(经 create 注入)——
|
|
188768
188771
|
/** systemPrompt 默认(来自 protocol.agent.systemPrompt.content)。 */
|
|
188769
188772
|
defaultSystemPrompt = "";
|
|
@@ -188847,6 +188850,11 @@ var init_agentRuntime = __esm({
|
|
|
188847
188850
|
rt.agentId = agentConfig.agentId;
|
|
188848
188851
|
rt.followUpQuestionGenerationEnabled = followUpQuestionGenerationEnabled;
|
|
188849
188852
|
rt.hookResources = normalizeHookResources(agentConfig.agent.resources.filter((r2) => r2.resourceType === EResourceType.HOOK));
|
|
188853
|
+
try {
|
|
188854
|
+
rt.effectiveAgentConfigJson = JSON.stringify(agentConfig);
|
|
188855
|
+
} catch {
|
|
188856
|
+
rt.effectiveAgentConfigJson = void 0;
|
|
188857
|
+
}
|
|
188850
188858
|
return rt;
|
|
188851
188859
|
}
|
|
188852
188860
|
async prepareFollowUpQuestionContext(sessionId, history = []) {
|
|
@@ -188867,6 +188875,12 @@ var init_agentRuntime = __esm({
|
|
|
188867
188875
|
async *runAgentLoop(request, auth2, options = {}) {
|
|
188868
188876
|
const sessionId = options.sessionId;
|
|
188869
188877
|
const debugLog = options.debugLog ?? this.portsDebugLog;
|
|
188878
|
+
if (debugLog) {
|
|
188879
|
+
try {
|
|
188880
|
+
debugLog(this.effectiveAgentConfigJson === void 0 ? "[agent-config] final=<Agent Config \u5E8F\u5217\u5316\u5931\u8D25\uFF0C\u65E0\u6CD5\u6253\u5370\u5B8C\u6574\u5185\u5BB9>" : `[agent-config] final=${this.effectiveAgentConfigJson}`, EDebugLogScope.CONFIG);
|
|
188881
|
+
} catch {
|
|
188882
|
+
}
|
|
188883
|
+
}
|
|
188870
188884
|
const newTurns = request.messages.map((m2) => ({
|
|
188871
188885
|
role: m2.role,
|
|
188872
188886
|
content: m2.content,
|
|
@@ -188974,6 +188988,19 @@ var init_agentRuntime = __esm({
|
|
|
188974
188988
|
let assistantText = "";
|
|
188975
188989
|
let failed = false;
|
|
188976
188990
|
let runError;
|
|
188991
|
+
let terminalHookDispatched = false;
|
|
188992
|
+
const dispatchTerminalHook = async () => {
|
|
188993
|
+
if (terminalHookDispatched || hookDispatcher.isEmpty)
|
|
188994
|
+
return;
|
|
188995
|
+
terminalHookDispatched = true;
|
|
188996
|
+
if (failed) {
|
|
188997
|
+
await hookDispatcher.dispatch(EHookStage.RUN_FAILED, hookCommonParams, {
|
|
188998
|
+
error: runError ?? { message: "unknown error" }
|
|
188999
|
+
});
|
|
189000
|
+
return;
|
|
189001
|
+
}
|
|
189002
|
+
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, { runDurationMs: Date.now() - runStartedAt });
|
|
189003
|
+
};
|
|
188977
189004
|
try {
|
|
188978
189005
|
for await (const ev of this.agentLoop.run(agentReq)) {
|
|
188979
189006
|
if (ev.type === "delta")
|
|
@@ -188981,6 +189008,7 @@ var init_agentRuntime = __esm({
|
|
|
188981
189008
|
if (ev.type === "error") {
|
|
188982
189009
|
failed = true;
|
|
188983
189010
|
runError = { message: ev.error.message, code: ev.error.code };
|
|
189011
|
+
await dispatchTerminalHook();
|
|
188984
189012
|
}
|
|
188985
189013
|
if (ev.type === "done" && !failed && sessionId !== void 0) {
|
|
188986
189014
|
const completedTurns = [
|
|
@@ -188995,22 +189023,18 @@ var init_agentRuntime = __esm({
|
|
|
188995
189023
|
}
|
|
188996
189024
|
}
|
|
188997
189025
|
}
|
|
189026
|
+
if (ev.type === "done")
|
|
189027
|
+
await dispatchTerminalHook();
|
|
188998
189028
|
yield ev;
|
|
188999
189029
|
}
|
|
189000
|
-
|
|
189001
|
-
if (failed) {
|
|
189002
|
-
await hookDispatcher.dispatch(EHookStage.RUN_FAILED, hookCommonParams, { error: runError ?? { message: "unknown error" } });
|
|
189003
|
-
} else {
|
|
189004
|
-
await hookDispatcher.dispatch(EHookStage.RUN_COMPLETED, hookCommonParams, { runDurationMs: Date.now() - runStartedAt });
|
|
189005
|
-
}
|
|
189006
|
-
}
|
|
189030
|
+
await dispatchTerminalHook();
|
|
189007
189031
|
} catch (error40) {
|
|
189008
|
-
if (!
|
|
189009
|
-
|
|
189010
|
-
|
|
189011
|
-
|
|
189012
|
-
|
|
189013
|
-
|
|
189032
|
+
if (!terminalHookDispatched) {
|
|
189033
|
+
failed = true;
|
|
189034
|
+
runError = {
|
|
189035
|
+
message: error40 instanceof Error ? error40.message : String(error40)
|
|
189036
|
+
};
|
|
189037
|
+
await dispatchTerminalHook();
|
|
189014
189038
|
}
|
|
189015
189039
|
throw error40;
|
|
189016
189040
|
} finally {
|