linkque-cli-v2 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/linkquejs.js +147 -48
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-Y36JLYIE.js → chunk-CLYLJ5MD.js} +1257 -1217
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-OMFQ2KRJ.js → chunk-NFVKWQGM.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-SAQYWJAA.js → chunk-S75HFRLD.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +59 -9
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +2 -2
- package/vendor/linkque-agent-appwrite-integrate/package.json +1 -1
- package/worker.js +468 -383
|
@@ -40,16 +40,17 @@ import {
|
|
|
40
40
|
resolveRunStorage,
|
|
41
41
|
toAgentRunMessages,
|
|
42
42
|
withIsoTimestamp
|
|
43
|
-
} from "../../chunk-
|
|
43
|
+
} from "../../chunk-S75HFRLD.js";
|
|
44
44
|
import "../../chunk-IWOFD643.js";
|
|
45
45
|
import "../../chunk-PXCGFBV5.js";
|
|
46
46
|
import "../../chunk-ETG6PNHQ.js";
|
|
47
47
|
import {
|
|
48
48
|
getBakedProtocol
|
|
49
|
-
} from "../../chunk-
|
|
49
|
+
} from "../../chunk-NFVKWQGM.js";
|
|
50
50
|
import {
|
|
51
51
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
52
52
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
53
|
+
CONTENT_VALUE_MAX_LENGTH,
|
|
53
54
|
CONVERSATION_HISTORY_VERSION,
|
|
54
55
|
CardActionDiagnostics,
|
|
55
56
|
CardMappingError,
|
|
@@ -162,7 +163,7 @@ import {
|
|
|
162
163
|
summarizeBody,
|
|
163
164
|
warnLogFailure,
|
|
164
165
|
wrapToolWithHooks
|
|
165
|
-
} from "../../chunk-
|
|
166
|
+
} from "../../chunk-CLYLJ5MD.js";
|
|
166
167
|
import "../../chunk-EAODRPW4.js";
|
|
167
168
|
import "../../chunk-XUFLSZM4.js";
|
|
168
169
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -7956,9 +7957,9 @@ function toolResultOutcome(result) {
|
|
|
7956
7957
|
return ETelemetryOutcome.UNKNOWN;
|
|
7957
7958
|
}
|
|
7958
7959
|
const record2 = result;
|
|
7959
|
-
if (record2.isError === true
|
|
7960
|
+
if (record2.isError === true)
|
|
7960
7961
|
return ETelemetryOutcome.ERROR;
|
|
7961
|
-
if (record2.isError === false || record2.
|
|
7962
|
+
if (record2.isError === false || record2.type === "linkque.presentation-tool-result")
|
|
7962
7963
|
return ETelemetryOutcome.SUCCESS;
|
|
7963
7964
|
} catch {
|
|
7964
7965
|
}
|
|
@@ -8019,6 +8020,44 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
8019
8020
|
var PiTelemetry = class {
|
|
8020
8021
|
root;
|
|
8021
8022
|
iterationIndex = 0;
|
|
8023
|
+
replyText = "";
|
|
8024
|
+
replyBytes = 0;
|
|
8025
|
+
replyIndex = 0;
|
|
8026
|
+
replyTruncated = false;
|
|
8027
|
+
maxReplyBytes = 512 * 1024;
|
|
8028
|
+
/** 正文分块独立落盘;每条最坏 JSON 编码也低于日志单行 1 MiB 上限。 */
|
|
8029
|
+
recordReplyChunk(final, complete) {
|
|
8030
|
+
this.root.find(ETelemetryAssociation.MODEL)?.record(ETelemetryEventName.CONTENT_RECORDED, {}, {
|
|
8031
|
+
section: ETelemetryContentSection.MODEL_OUTPUT,
|
|
8032
|
+
value: this.replyText,
|
|
8033
|
+
chunkIndex: this.replyIndex++,
|
|
8034
|
+
final,
|
|
8035
|
+
availability: final && complete && !this.replyTruncated ? "available" : "partial"
|
|
8036
|
+
});
|
|
8037
|
+
this.replyText = "";
|
|
8038
|
+
}
|
|
8039
|
+
flushReply(complete) {
|
|
8040
|
+
if (this.replyBytes)
|
|
8041
|
+
this.recordReplyChunk(true, complete);
|
|
8042
|
+
this.replyBytes = 0;
|
|
8043
|
+
this.replyIndex = 0;
|
|
8044
|
+
this.replyTruncated = false;
|
|
8045
|
+
}
|
|
8046
|
+
appendReply(text2) {
|
|
8047
|
+
if (this.replyTruncated)
|
|
8048
|
+
return;
|
|
8049
|
+
for (const character of text2) {
|
|
8050
|
+
const bytes = Buffer.byteLength(character, "utf8");
|
|
8051
|
+
if (this.replyBytes + bytes > this.maxReplyBytes) {
|
|
8052
|
+
this.replyTruncated = true;
|
|
8053
|
+
break;
|
|
8054
|
+
}
|
|
8055
|
+
this.replyText += character;
|
|
8056
|
+
this.replyBytes += bytes;
|
|
8057
|
+
if (this.replyText.length >= 16 * 1024)
|
|
8058
|
+
this.recordReplyChunk(false, false);
|
|
8059
|
+
}
|
|
8060
|
+
}
|
|
8022
8061
|
proposed = /* @__PURE__ */ new Map();
|
|
8023
8062
|
loop;
|
|
8024
8063
|
lastProvider = null;
|
|
@@ -8120,6 +8159,7 @@ var PiTelemetry = class {
|
|
|
8120
8159
|
}
|
|
8121
8160
|
case "message_end":
|
|
8122
8161
|
if (event.message.role === "assistant") {
|
|
8162
|
+
this.flushReply(event.message.stopReason !== "error" && event.message.stopReason !== "aborted");
|
|
8123
8163
|
const failed = event.message.stopReason === "error" || event.message.stopReason === "aborted";
|
|
8124
8164
|
this.root.find(ETelemetryAssociation.MODEL)?.finish(event.message.stopReason === "aborted" ? ETelemetryOutcome.CANCELLED : failed ? ETelemetryOutcome.ERROR : ETelemetryOutcome.SUCCESS, {
|
|
8125
8165
|
[ETelemetryAttribute.GEN_AI_RESPONSE_FINISH_REASONS]: [
|
|
@@ -8134,6 +8174,8 @@ var PiTelemetry = class {
|
|
|
8134
8174
|
break;
|
|
8135
8175
|
case "message_update": {
|
|
8136
8176
|
const update = event.assistantMessageEvent;
|
|
8177
|
+
if (update.type === "text_delta")
|
|
8178
|
+
this.appendReply(update.delta);
|
|
8137
8179
|
if (update.type === "text_delta" && update.delta && !this.publicTextSeen) {
|
|
8138
8180
|
this.publicTextSeen = true;
|
|
8139
8181
|
this.loop.record(ETelemetryEventName.LOOP_FIRST_PUBLIC_TEXT, {
|
|
@@ -8164,6 +8206,7 @@ var PiTelemetry = class {
|
|
|
8164
8206
|
this.terminal = ETelemetryStreamTermination.ERROR;
|
|
8165
8207
|
}
|
|
8166
8208
|
close(cancelled) {
|
|
8209
|
+
this.flushReply(false);
|
|
8167
8210
|
this.proposed.clear();
|
|
8168
8211
|
this.loop.finish(this.terminal === ETelemetryStreamTermination.ERROR ? ETelemetryOutcome.ERROR : cancelled || this.terminal === ETelemetryStreamTermination.CANCEL ? ETelemetryOutcome.CANCELLED : this.terminal === ETelemetryStreamTermination.COMPLETE ? ETelemetryOutcome.SUCCESS : ETelemetryOutcome.UNKNOWN, {
|
|
8169
8212
|
[ETelemetryAttribute.LINKQUE_STREAM_TERMINATION]: this.terminal === ETelemetryStreamTermination.ERROR ? ETelemetryStreamTermination.ERROR : cancelled ? ETelemetryStreamTermination.CANCEL : this.terminal
|
|
@@ -41959,7 +42002,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
41959
42002
|
}
|
|
41960
42003
|
/**
|
|
41961
42004
|
* 记录本次用户输入(RFC §4.1):取进入 Runtime 的本次新消息中最后一条 user message
|
|
41962
|
-
* 的 content,作为 `linkque.
|
|
42005
|
+
* 的 content,作为 `linkque.content.recorded` 的 body 走 record 链路落入
|
|
41963
42006
|
* OTLP logs(body 含 section/value/availability)。不以模型 messages 上下文为输入;
|
|
41964
42007
|
* 无 user 文本(卡片交互等)时按可用性如实标记,不伪造自然语言 Query。
|
|
41965
42008
|
*/
|
|
@@ -41971,15 +42014,17 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
41971
42014
|
}
|
|
41972
42015
|
const content = lastUser?.content;
|
|
41973
42016
|
const text2 = typeof content === "string" && content ? content : void 0;
|
|
42017
|
+
const value = text2?.slice(0, CONTENT_VALUE_MAX_LENGTH);
|
|
42018
|
+
const truncated = text2 !== void 0 && text2.length > CONTENT_VALUE_MAX_LENGTH;
|
|
41974
42019
|
const card = content && typeof content === "object" && "type" in content && content.type === "a2ui.event" ? content : void 0;
|
|
41975
42020
|
const displayText = card && "displayText" in card && typeof card.displayText === "string" && card.displayText ? card.displayText : void 0;
|
|
41976
42021
|
const body = {
|
|
41977
42022
|
section: ETelemetryContentSection.QUERY_INPUT,
|
|
41978
|
-
...
|
|
42023
|
+
...value !== void 0 ? { value } : {},
|
|
41979
42024
|
...card ? { inputType: "card", ...displayText ? { displayText } : {} } : {},
|
|
41980
42025
|
availability: text2 !== void 0 || card ? "available" : "not_recorded"
|
|
41981
42026
|
};
|
|
41982
|
-
observation.record(ETelemetryEventName.
|
|
42027
|
+
observation.record(ETelemetryEventName.CONTENT_RECORDED, { [ETelemetryAttribute.LINKQUE_CONTENT_VALUE_TRUNCATED]: truncated }, body);
|
|
41983
42028
|
}
|
|
41984
42029
|
async *runObservedAdvance(request, auth, options, observation) {
|
|
41985
42030
|
observation.record(ETelemetryEventName.TELEMETRY_COVERAGE, {
|
|
@@ -45403,9 +45448,14 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
45403
45448
|
remoteBaseUrl: openMcpBaseUrl,
|
|
45404
45449
|
...mcpSignEndpoint ? { signEndpoint: mcpSignEndpoint } : {}
|
|
45405
45450
|
});
|
|
45451
|
+
const mcpDebugLog = isDebugLogLevel(env) && logCtx?.log ? (line, scope) => {
|
|
45452
|
+
const prefix = scope ? `[${scope}] ` : "";
|
|
45453
|
+
logCtx.log?.(prefix + line);
|
|
45454
|
+
} : void 0;
|
|
45406
45455
|
const rawMcpServerProvider = deps?.mcpServerProvider ?? createAppbaseMcpProvider({
|
|
45407
45456
|
resolveConfig: mcpConfigResolver,
|
|
45408
|
-
getAuthorizationHeader: mcpAuthorizationHeaderProvider
|
|
45457
|
+
getAuthorizationHeader: mcpAuthorizationHeaderProvider,
|
|
45458
|
+
...mcpDebugLog ? { debugLog: mcpDebugLog } : {}
|
|
45409
45459
|
});
|
|
45410
45460
|
const mcpServerProvider = rawMcpServerProvider;
|
|
45411
45461
|
const securityAnswerPlugin = deps?.securityAnswerPlugin ?? createSecurityAnswerPlugin(historyStore, logCtx?.log);
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-S75HFRLD.js";
|
|
7
7
|
import "../../chunk-IWOFD643.js";
|
|
8
8
|
import "../../chunk-PXCGFBV5.js";
|
|
9
9
|
import "../../chunk-ETG6PNHQ.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-CLYLJ5MD.js";
|
|
11
11
|
import "../../chunk-EAODRPW4.js";
|
|
12
12
|
import "../../chunk-XUFLSZM4.js";
|
|
13
13
|
import "../../chunk-GAYNLDWK.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-NFVKWQGM.js";
|
|
5
|
+
import "../chunk-CLYLJ5MD.js";
|
|
6
6
|
import "../chunk-EAODRPW4.js";
|
|
7
7
|
import "../chunk-XUFLSZM4.js";
|
|
8
8
|
import "../chunk-GAYNLDWK.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alipay/linkque-agent-appwrite-integrate","version":"1.4.
|
|
1
|
+
{"name":"@alipay/linkque-agent-appwrite-integrate","version":"1.4.5","type":"module"}
|