linkque-cli-v2 1.3.8 → 1.4.1
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 +13 -10
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-RHMVQTA7.js → chunk-CUMXO6KK.js} +4015 -320
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ZNU4GVF3.js → chunk-OHRCYI66.js} +146 -119
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-AACYYAZ6.js → chunk-XL6BPKTI.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +111 -35
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +3 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +3 -3
- package/worker.js +135 -32
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{anthropic-messages-EL2IU4YU.js → anthropic-messages-5DOLTIGP.js} +3 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{azure-openai-responses-A4XURCOX.js → azure-openai-responses-HVAVRLTK.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{mistral-conversations-5RZTVEO2.js → mistral-conversations-OEBGEDLQ.js} +10 -10
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-codex-responses-WLREQPZK.js → openai-codex-responses-3KOC6KHN.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-completions-U6LUBY4P.js → openai-completions-HG6OJRL5.js} +3 -3
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{openai-responses-SFZAU5JA.js → openai-responses-F6V2PG3Y.js} +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{pi-messages-QQA6ZGV2.js → pi-messages-DC4DVRAJ.js} +3 -3
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-ZNU4GVF3.js → chunk-OHRCYI66.js}
RENAMED
|
@@ -1,108 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BRAND,
|
|
3
|
-
DIRTY,
|
|
4
|
-
EMPTY_PATH,
|
|
5
|
-
INVALID,
|
|
6
|
-
NEVER,
|
|
7
|
-
OK,
|
|
8
|
-
ParseStatus,
|
|
9
|
-
ZodAny,
|
|
10
|
-
ZodArray,
|
|
11
|
-
ZodBigInt,
|
|
12
|
-
ZodBoolean,
|
|
13
|
-
ZodBranded,
|
|
14
|
-
ZodCatch,
|
|
15
|
-
ZodDate,
|
|
16
|
-
ZodDefault,
|
|
17
|
-
ZodDiscriminatedUnion,
|
|
18
|
-
ZodEffects,
|
|
19
|
-
ZodEnum,
|
|
20
|
-
ZodError,
|
|
21
|
-
ZodFirstPartyTypeKind,
|
|
22
|
-
ZodFunction,
|
|
23
|
-
ZodIntersection,
|
|
24
|
-
ZodIssueCode,
|
|
25
|
-
ZodLazy,
|
|
26
|
-
ZodLiteral,
|
|
27
|
-
ZodMap,
|
|
28
|
-
ZodNaN,
|
|
29
|
-
ZodNativeEnum,
|
|
30
|
-
ZodNever,
|
|
31
|
-
ZodNull,
|
|
32
|
-
ZodNullable,
|
|
33
|
-
ZodNumber,
|
|
34
|
-
ZodObject,
|
|
35
|
-
ZodOptional,
|
|
36
|
-
ZodParsedType,
|
|
37
|
-
ZodPipeline,
|
|
38
|
-
ZodPromise,
|
|
39
|
-
ZodReadonly,
|
|
40
|
-
ZodRecord,
|
|
41
|
-
ZodSet,
|
|
42
|
-
ZodString,
|
|
43
|
-
ZodSymbol,
|
|
44
|
-
ZodTuple,
|
|
45
|
-
ZodType,
|
|
46
|
-
ZodUndefined,
|
|
47
|
-
ZodUnion,
|
|
48
|
-
ZodUnknown,
|
|
49
|
-
ZodVoid,
|
|
50
|
-
addIssueToContext,
|
|
51
|
-
anyType,
|
|
52
|
-
arrayType,
|
|
53
|
-
bigIntType,
|
|
54
|
-
booleanType,
|
|
55
|
-
coerce,
|
|
56
|
-
custom,
|
|
57
|
-
dateType,
|
|
58
|
-
datetimeRegex,
|
|
59
|
-
discriminatedUnionType,
|
|
60
|
-
effectsType,
|
|
61
|
-
en_default,
|
|
62
|
-
enumType,
|
|
63
|
-
functionType,
|
|
64
|
-
getErrorMap,
|
|
65
|
-
getParsedType,
|
|
66
|
-
instanceOfType,
|
|
67
|
-
intersectionType,
|
|
68
|
-
isAborted,
|
|
69
|
-
isAsync,
|
|
70
|
-
isDirty,
|
|
71
|
-
isValid,
|
|
72
|
-
late,
|
|
73
|
-
lazyType,
|
|
74
|
-
literalType,
|
|
75
|
-
makeIssue,
|
|
76
|
-
mapType,
|
|
77
|
-
nanType,
|
|
78
|
-
nativeEnumType,
|
|
79
|
-
neverType,
|
|
80
|
-
nullType,
|
|
81
|
-
nullableType,
|
|
82
|
-
numberType,
|
|
83
|
-
objectType,
|
|
84
|
-
objectUtil,
|
|
85
|
-
oboolean,
|
|
86
|
-
onumber,
|
|
87
|
-
optionalType,
|
|
88
|
-
ostring,
|
|
89
|
-
pipelineType,
|
|
90
|
-
preprocessType,
|
|
91
|
-
promiseType,
|
|
92
|
-
quotelessJson,
|
|
93
|
-
recordType,
|
|
94
|
-
setErrorMap,
|
|
95
|
-
setType,
|
|
96
|
-
strictObjectType,
|
|
97
|
-
stringType,
|
|
98
|
-
symbolType,
|
|
99
|
-
tupleType,
|
|
100
|
-
undefinedType,
|
|
101
|
-
unionType,
|
|
102
|
-
unknownType,
|
|
103
|
-
util,
|
|
104
|
-
voidType
|
|
105
|
-
} from "./chunk-XUFLSZM4.js";
|
|
106
1
|
import {
|
|
107
2
|
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED,
|
|
108
3
|
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED,
|
|
@@ -352,6 +247,111 @@ import {
|
|
|
352
247
|
init_stable_events,
|
|
353
248
|
init_stable_metrics
|
|
354
249
|
} from "./chunk-EAODRPW4.js";
|
|
250
|
+
import {
|
|
251
|
+
BRAND,
|
|
252
|
+
DIRTY,
|
|
253
|
+
EMPTY_PATH,
|
|
254
|
+
INVALID,
|
|
255
|
+
NEVER,
|
|
256
|
+
OK,
|
|
257
|
+
ParseStatus,
|
|
258
|
+
ZodAny,
|
|
259
|
+
ZodArray,
|
|
260
|
+
ZodBigInt,
|
|
261
|
+
ZodBoolean,
|
|
262
|
+
ZodBranded,
|
|
263
|
+
ZodCatch,
|
|
264
|
+
ZodDate,
|
|
265
|
+
ZodDefault,
|
|
266
|
+
ZodDiscriminatedUnion,
|
|
267
|
+
ZodEffects,
|
|
268
|
+
ZodEnum,
|
|
269
|
+
ZodError,
|
|
270
|
+
ZodFirstPartyTypeKind,
|
|
271
|
+
ZodFunction,
|
|
272
|
+
ZodIntersection,
|
|
273
|
+
ZodIssueCode,
|
|
274
|
+
ZodLazy,
|
|
275
|
+
ZodLiteral,
|
|
276
|
+
ZodMap,
|
|
277
|
+
ZodNaN,
|
|
278
|
+
ZodNativeEnum,
|
|
279
|
+
ZodNever,
|
|
280
|
+
ZodNull,
|
|
281
|
+
ZodNullable,
|
|
282
|
+
ZodNumber,
|
|
283
|
+
ZodObject,
|
|
284
|
+
ZodOptional,
|
|
285
|
+
ZodParsedType,
|
|
286
|
+
ZodPipeline,
|
|
287
|
+
ZodPromise,
|
|
288
|
+
ZodReadonly,
|
|
289
|
+
ZodRecord,
|
|
290
|
+
ZodSet,
|
|
291
|
+
ZodString,
|
|
292
|
+
ZodSymbol,
|
|
293
|
+
ZodTuple,
|
|
294
|
+
ZodType,
|
|
295
|
+
ZodUndefined,
|
|
296
|
+
ZodUnion,
|
|
297
|
+
ZodUnknown,
|
|
298
|
+
ZodVoid,
|
|
299
|
+
addIssueToContext,
|
|
300
|
+
anyType,
|
|
301
|
+
arrayType,
|
|
302
|
+
bigIntType,
|
|
303
|
+
booleanType,
|
|
304
|
+
coerce,
|
|
305
|
+
custom,
|
|
306
|
+
dateType,
|
|
307
|
+
datetimeRegex,
|
|
308
|
+
discriminatedUnionType,
|
|
309
|
+
effectsType,
|
|
310
|
+
en_default,
|
|
311
|
+
enumType,
|
|
312
|
+
functionType,
|
|
313
|
+
getErrorMap,
|
|
314
|
+
getParsedType,
|
|
315
|
+
instanceOfType,
|
|
316
|
+
intersectionType,
|
|
317
|
+
isAborted,
|
|
318
|
+
isAsync,
|
|
319
|
+
isDirty,
|
|
320
|
+
isValid,
|
|
321
|
+
late,
|
|
322
|
+
lazyType,
|
|
323
|
+
literalType,
|
|
324
|
+
makeIssue,
|
|
325
|
+
mapType,
|
|
326
|
+
nanType,
|
|
327
|
+
nativeEnumType,
|
|
328
|
+
neverType,
|
|
329
|
+
nullType,
|
|
330
|
+
nullableType,
|
|
331
|
+
numberType,
|
|
332
|
+
objectType,
|
|
333
|
+
objectUtil,
|
|
334
|
+
oboolean,
|
|
335
|
+
onumber,
|
|
336
|
+
optionalType,
|
|
337
|
+
ostring,
|
|
338
|
+
pipelineType,
|
|
339
|
+
preprocessType,
|
|
340
|
+
promiseType,
|
|
341
|
+
quotelessJson,
|
|
342
|
+
recordType,
|
|
343
|
+
setErrorMap,
|
|
344
|
+
setType,
|
|
345
|
+
strictObjectType,
|
|
346
|
+
stringType,
|
|
347
|
+
symbolType,
|
|
348
|
+
tupleType,
|
|
349
|
+
undefinedType,
|
|
350
|
+
unionType,
|
|
351
|
+
unknownType,
|
|
352
|
+
util,
|
|
353
|
+
voidType
|
|
354
|
+
} from "./chunk-XUFLSZM4.js";
|
|
355
355
|
import {
|
|
356
356
|
NEVER as NEVER2,
|
|
357
357
|
ZodIssueCode as ZodIssueCode2,
|
|
@@ -4514,14 +4514,13 @@ var require_fast_uri = __commonJS({
|
|
|
4514
4514
|
if (!malformedIPLiteral) {
|
|
4515
4515
|
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
4516
4516
|
}
|
|
4517
|
-
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
4518
|
-
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
4519
|
-
if (!isIP) {
|
|
4520
|
-
host = normalizePercentEncoding(host.toLowerCase());
|
|
4521
|
-
}
|
|
4522
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
4523
|
-
}
|
|
4524
4517
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
4518
|
+
if (uri.indexOf("%") !== -1) {
|
|
4519
|
+
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
4520
|
+
const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
4521
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4525
4524
|
if (parsed.path) {
|
|
4526
4525
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
4527
4526
|
}
|
|
@@ -30331,6 +30330,26 @@ function isRecord5(value) {
|
|
|
30331
30330
|
}
|
|
30332
30331
|
|
|
30333
30332
|
// ../agent-conversation-contract/dist/esm/sse.js
|
|
30333
|
+
var MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH = 20;
|
|
30334
|
+
function parseConversationToolCallDisplayName(value) {
|
|
30335
|
+
if (typeof value !== "string" || /[\r\n\u2028\u2029]/u.test(value)) {
|
|
30336
|
+
return void 0;
|
|
30337
|
+
}
|
|
30338
|
+
const normalized = value.trim();
|
|
30339
|
+
if (!normalized || normalized.length > MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH) {
|
|
30340
|
+
return void 0;
|
|
30341
|
+
}
|
|
30342
|
+
return normalized;
|
|
30343
|
+
}
|
|
30344
|
+
function createConversationToolCallStartEvent(toolCallId, toolCallName, displayName) {
|
|
30345
|
+
const normalized = parseConversationToolCallDisplayName(displayName);
|
|
30346
|
+
return {
|
|
30347
|
+
type: EventType.TOOL_CALL_START,
|
|
30348
|
+
toolCallId,
|
|
30349
|
+
toolCallName,
|
|
30350
|
+
...normalized ? { displayName: normalized } : {}
|
|
30351
|
+
};
|
|
30352
|
+
}
|
|
30334
30353
|
function createConversationRunAck(runId, threadId, options = {}) {
|
|
30335
30354
|
return {
|
|
30336
30355
|
event: "ack",
|
|
@@ -30348,8 +30367,18 @@ function createConversationAGUIEvent(data, id) {
|
|
|
30348
30367
|
}
|
|
30349
30368
|
function parseConversationAGUIEvent(value) {
|
|
30350
30369
|
const parsed = EventSchemas.safeParse(value);
|
|
30351
|
-
if (parsed.success)
|
|
30352
|
-
|
|
30370
|
+
if (parsed.success) {
|
|
30371
|
+
if (parsed.data.type !== EventType.TOOL_CALL_START)
|
|
30372
|
+
return parsed.data;
|
|
30373
|
+
const event = parsed.data;
|
|
30374
|
+
const displayName = parseConversationToolCallDisplayName(event.displayName);
|
|
30375
|
+
const baseEvent = { ...event };
|
|
30376
|
+
delete baseEvent.displayName;
|
|
30377
|
+
return {
|
|
30378
|
+
...baseEvent,
|
|
30379
|
+
...displayName ? { displayName } : {}
|
|
30380
|
+
};
|
|
30381
|
+
}
|
|
30353
30382
|
throw new ConversationProtocolValidationError(parsed.error.issues.map((issue3) => `${issue3.path.length ? issue3.path.join(".") : "event"}: ${issue3.message}`));
|
|
30354
30383
|
}
|
|
30355
30384
|
function createConversationTransportError(data, id) {
|
|
@@ -36988,11 +37017,7 @@ function mapAgentEventToBaseEvents(event, messageId, thinkingId) {
|
|
|
36988
37017
|
}
|
|
36989
37018
|
case "tool_start": {
|
|
36990
37019
|
const events = [
|
|
36991
|
-
|
|
36992
|
-
type: EventType.TOOL_CALL_START,
|
|
36993
|
-
toolCallId: event.toolCallId,
|
|
36994
|
-
toolCallName: event.toolName
|
|
36995
|
-
}
|
|
37020
|
+
createConversationToolCallStartEvent(event.toolCallId, event.toolName, event.displayName)
|
|
36996
37021
|
];
|
|
36997
37022
|
const argsDelta = safeStringifyArgs(event.args);
|
|
36998
37023
|
if (argsDelta !== "") {
|
|
@@ -38104,6 +38129,8 @@ export {
|
|
|
38104
38129
|
DEFAULT_CONVERSATION_SEARCH_LIMIT,
|
|
38105
38130
|
ConversationHistoryValidationError,
|
|
38106
38131
|
parseConversationHistoryRequest,
|
|
38132
|
+
MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH,
|
|
38133
|
+
parseConversationToolCallDisplayName,
|
|
38107
38134
|
encodeConversationSseEvent,
|
|
38108
38135
|
streamToConversationEvents,
|
|
38109
38136
|
OtelRuntimeTelemetry
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../../chunk-6MHDOBWO.js";
|
|
2
2
|
import "../../chunk-E2P6TIFG.js";
|
|
3
|
-
import "../../chunk-WJHOHUET.js";
|
|
4
3
|
import {
|
|
5
4
|
getProviderEnvValue
|
|
6
5
|
} from "../../chunk-B5XRGKYX.js";
|
|
6
|
+
import "../../chunk-WJHOHUET.js";
|
|
7
7
|
import {
|
|
8
8
|
createModels,
|
|
9
9
|
createProvider,
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
LinkqueGatewayAuthError,
|
|
20
20
|
LinkqueGatewayAuthUnconfiguredError,
|
|
21
21
|
Query,
|
|
22
|
+
TablesDB,
|
|
22
23
|
createA2UIInfoLog,
|
|
23
24
|
createAppBaseClient,
|
|
24
25
|
createClientCapabilityStore,
|
|
@@ -37,14 +38,15 @@ import {
|
|
|
37
38
|
resolveGatewayAuthContext,
|
|
38
39
|
resolveLinkqueGatewayAuth,
|
|
39
40
|
resolveRunStorage,
|
|
40
|
-
toAgentRunMessages
|
|
41
|
-
|
|
41
|
+
toAgentRunMessages,
|
|
42
|
+
withIsoTimestamp
|
|
43
|
+
} from "../../chunk-CUMXO6KK.js";
|
|
42
44
|
import "../../chunk-IWOFD643.js";
|
|
43
45
|
import "../../chunk-PXCGFBV5.js";
|
|
44
46
|
import "../../chunk-ETG6PNHQ.js";
|
|
45
47
|
import {
|
|
46
48
|
getBakedProtocol
|
|
47
|
-
} from "../../chunk-
|
|
49
|
+
} from "../../chunk-XL6BPKTI.js";
|
|
48
50
|
import {
|
|
49
51
|
CANCEL_CONVERSATION_RUN_OPERATION,
|
|
50
52
|
CONVERSATION_HISTORY_VERSION,
|
|
@@ -98,6 +100,7 @@ import {
|
|
|
98
100
|
LinkqueWebSearchPort,
|
|
99
101
|
LinkquegwEventHookExecutor,
|
|
100
102
|
MARK_CONVERSATION_RUNS_READ_OPERATION,
|
|
103
|
+
MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH,
|
|
101
104
|
McpProxyTool,
|
|
102
105
|
NoopHookExecutor,
|
|
103
106
|
NoopMcpServerProvider,
|
|
@@ -139,6 +142,7 @@ import {
|
|
|
139
142
|
parseConversationFollowUpQuestions,
|
|
140
143
|
parseConversationHistoryRequest,
|
|
141
144
|
parseConversationRunRequest,
|
|
145
|
+
parseConversationToolCallDisplayName,
|
|
142
146
|
parseMarkConversationRunsReadRequest,
|
|
143
147
|
parseSkillFile,
|
|
144
148
|
prepareFollowUpQuestionContext,
|
|
@@ -154,9 +158,9 @@ import {
|
|
|
154
158
|
summarizeBody,
|
|
155
159
|
warnLogFailure,
|
|
156
160
|
wrapToolWithHooks
|
|
157
|
-
} from "../../chunk-
|
|
158
|
-
import "../../chunk-XUFLSZM4.js";
|
|
161
|
+
} from "../../chunk-OHRCYI66.js";
|
|
159
162
|
import "../../chunk-EAODRPW4.js";
|
|
163
|
+
import "../../chunk-XUFLSZM4.js";
|
|
160
164
|
import "../../chunk-GAYNLDWK.js";
|
|
161
165
|
import "../../chunk-DNTEEBEH.js";
|
|
162
166
|
import {
|
|
@@ -8241,10 +8245,10 @@ function projectProviderUsage(usage) {
|
|
|
8241
8245
|
}
|
|
8242
8246
|
|
|
8243
8247
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.js
|
|
8244
|
-
var anthropicMessagesApi = () => lazyApi(() => import("../../anthropic-messages-
|
|
8248
|
+
var anthropicMessagesApi = () => lazyApi(() => import("../../anthropic-messages-5DOLTIGP.js"));
|
|
8245
8249
|
|
|
8246
8250
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.js
|
|
8247
|
-
var azureOpenAIResponsesApi = () => lazyApi(() => import("../../azure-openai-responses-
|
|
8251
|
+
var azureOpenAIResponsesApi = () => lazyApi(() => import("../../azure-openai-responses-HVAVRLTK.js"));
|
|
8248
8252
|
|
|
8249
8253
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js
|
|
8250
8254
|
var __rewriteRelativeImportExtension = function(path, preserveJsx) {
|
|
@@ -8269,19 +8273,19 @@ var googleGenerativeAIApi = () => lazyApi(() => import("../../google-generative-
|
|
|
8269
8273
|
var googleVertexApi = () => lazyApi(() => import("../../google-vertex-RIGAEYLC.js"));
|
|
8270
8274
|
|
|
8271
8275
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.js
|
|
8272
|
-
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-
|
|
8276
|
+
var mistralConversationsApi = () => lazyApi(() => import("../../mistral-conversations-OEBGEDLQ.js"));
|
|
8273
8277
|
|
|
8274
8278
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.js
|
|
8275
|
-
var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-
|
|
8279
|
+
var openAICodexResponsesApi = () => lazyApi(() => import("../../openai-codex-responses-3KOC6KHN.js"));
|
|
8276
8280
|
|
|
8277
8281
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.js
|
|
8278
|
-
var openAICompletionsApi = () => lazyApi(() => import("../../openai-completions-
|
|
8282
|
+
var openAICompletionsApi = () => lazyApi(() => import("../../openai-completions-HG6OJRL5.js"));
|
|
8279
8283
|
|
|
8280
8284
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.js
|
|
8281
|
-
var openAIResponsesApi = () => lazyApi(() => import("../../openai-responses-
|
|
8285
|
+
var openAIResponsesApi = () => lazyApi(() => import("../../openai-responses-F6V2PG3Y.js"));
|
|
8282
8286
|
|
|
8283
8287
|
// ../../node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.js
|
|
8284
|
-
var piMessagesApi = () => lazyApi(() => import("../../pi-messages-
|
|
8288
|
+
var piMessagesApi = () => lazyApi(() => import("../../pi-messages-DC4DVRAJ.js"));
|
|
8285
8289
|
|
|
8286
8290
|
// ../../node_modules/@earendil-works/pi-ai/dist/env-api-keys.js
|
|
8287
8291
|
var __rewriteRelativeImportExtension2 = function(path, preserveJsx) {
|
|
@@ -39899,13 +39903,16 @@ function toPiAgentTools(descriptors, emitToolEvent = () => void 0) {
|
|
|
39899
39903
|
if (names.has(name))
|
|
39900
39904
|
throw new Error(`Duplicate AgentTool name ${name}`);
|
|
39901
39905
|
names.add(name);
|
|
39906
|
+
const uiStatusParameters = decorateToolParametersWithUiStatus(descriptor.inputSchema);
|
|
39902
39907
|
return {
|
|
39903
39908
|
name,
|
|
39904
39909
|
label: descriptor.label ?? descriptor.name,
|
|
39905
39910
|
description: descriptor.description ?? descriptor.name,
|
|
39906
|
-
parameters:
|
|
39911
|
+
parameters: uiStatusParameters.parameters,
|
|
39912
|
+
...uiStatusParameters.enabled ? { prepareArguments: stripToolUiStatusArgument } : {},
|
|
39907
39913
|
execute: async (toolCallId, params, signal) => {
|
|
39908
|
-
const
|
|
39914
|
+
const args = uiStatusParameters.enabled ? stripToolUiStatusArgument(params) : params;
|
|
39915
|
+
const result = await descriptor.execute(args, signal, {
|
|
39909
39916
|
toolCallId,
|
|
39910
39917
|
emit: emitToolEvent
|
|
39911
39918
|
});
|
|
@@ -39923,6 +39930,68 @@ function toPiAgentTools(descriptors, emitToolEvent = () => void 0) {
|
|
|
39923
39930
|
};
|
|
39924
39931
|
});
|
|
39925
39932
|
}
|
|
39933
|
+
var TOOL_UI_STATUS_ARGUMENT = "__ui_status";
|
|
39934
|
+
var TOOL_UI_STATUS_SCHEMA = Object.freeze({
|
|
39935
|
+
type: "string",
|
|
39936
|
+
minLength: 1,
|
|
39937
|
+
maxLength: MAX_CONVERSATION_TOOL_CALL_DISPLAY_NAME_LENGTH,
|
|
39938
|
+
description: "\u754C\u9762\u8FDB\u884C\u4E2D\u72B6\u6001\u3002\u8BF7\u7528\u4E0D\u8D85\u8FC720\u4E2A\u5B57\u7684\u4E2D\u6587\u77ED\u53E5\u6982\u62EC\u672C\u6B21\u8C03\u7528\u76EE\u7684\uFF0C\u4F8B\u5982\u201C\u6B63\u5728\u641C\u7D22\u9644\u8FD1\u9152\u5E97\u201D\uFF1B\u63CF\u8FF0\u52A8\u4F5C\u4E0E\u5BF9\u8C61\uFF0C\u4E0D\u590D\u8FF0\u624B\u673A\u53F7\u3001\u8BA2\u5355\u53F7\u7B49\u5177\u4F53\u53C2\u6570\u503C\u3002"
|
|
39939
|
+
});
|
|
39940
|
+
var UNSAFE_TOOL_SCHEMA_KEYS = /* @__PURE__ */ new Set([
|
|
39941
|
+
"$dynamicRef",
|
|
39942
|
+
"$ref",
|
|
39943
|
+
"$recursiveRef",
|
|
39944
|
+
"allOf",
|
|
39945
|
+
"anyOf",
|
|
39946
|
+
"dependentSchemas",
|
|
39947
|
+
"else",
|
|
39948
|
+
"if",
|
|
39949
|
+
"not",
|
|
39950
|
+
"oneOf",
|
|
39951
|
+
"patternProperties",
|
|
39952
|
+
"propertyNames",
|
|
39953
|
+
"then",
|
|
39954
|
+
"unevaluatedProperties"
|
|
39955
|
+
]);
|
|
39956
|
+
function getToolUiStatusEnabledNames(descriptors) {
|
|
39957
|
+
return new Set(descriptors.flatMap((descriptor) => decorateToolParametersWithUiStatus(descriptor.inputSchema).enabled ? [descriptor.modelName ?? descriptor.name] : []));
|
|
39958
|
+
}
|
|
39959
|
+
function decorateToolParametersWithUiStatus(value) {
|
|
39960
|
+
const parameters = normalizeParameters(value);
|
|
39961
|
+
if (!isRecord2(parameters) || parameters.type !== "object") {
|
|
39962
|
+
return { parameters, enabled: false };
|
|
39963
|
+
}
|
|
39964
|
+
if ([...UNSAFE_TOOL_SCHEMA_KEYS].some((key) => key in parameters)) {
|
|
39965
|
+
return { parameters, enabled: false };
|
|
39966
|
+
}
|
|
39967
|
+
const properties = parameters.properties;
|
|
39968
|
+
if (properties !== void 0 && !isRecord2(properties)) {
|
|
39969
|
+
return { parameters, enabled: false };
|
|
39970
|
+
}
|
|
39971
|
+
const required = parameters.required;
|
|
39972
|
+
if (properties && TOOL_UI_STATUS_ARGUMENT in properties || Array.isArray(required) && required.includes(TOOL_UI_STATUS_ARGUMENT)) {
|
|
39973
|
+
return { parameters, enabled: false };
|
|
39974
|
+
}
|
|
39975
|
+
return {
|
|
39976
|
+
parameters: {
|
|
39977
|
+
...parameters,
|
|
39978
|
+
properties: {
|
|
39979
|
+
...properties,
|
|
39980
|
+
[TOOL_UI_STATUS_ARGUMENT]: TOOL_UI_STATUS_SCHEMA
|
|
39981
|
+
}
|
|
39982
|
+
},
|
|
39983
|
+
enabled: true
|
|
39984
|
+
};
|
|
39985
|
+
}
|
|
39986
|
+
function stripToolUiStatusArgument(value) {
|
|
39987
|
+
if (!isRecord2(value) || !(TOOL_UI_STATUS_ARGUMENT in value))
|
|
39988
|
+
return value;
|
|
39989
|
+
const { [TOOL_UI_STATUS_ARGUMENT]: _status, ...args } = value;
|
|
39990
|
+
return args;
|
|
39991
|
+
}
|
|
39992
|
+
function isRecord2(value) {
|
|
39993
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39994
|
+
}
|
|
39926
39995
|
function normalizeParameters(value) {
|
|
39927
39996
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
39928
39997
|
return value;
|
|
@@ -40182,7 +40251,7 @@ var AgentService = class {
|
|
|
40182
40251
|
};
|
|
40183
40252
|
}
|
|
40184
40253
|
};
|
|
40185
|
-
function translateEvent(event) {
|
|
40254
|
+
function translateEvent(event, uiStatusToolNames = /* @__PURE__ */ new Set()) {
|
|
40186
40255
|
switch (event.type) {
|
|
40187
40256
|
case "message_update": {
|
|
40188
40257
|
const inner = event.assistantMessageEvent;
|
|
@@ -40216,13 +40285,17 @@ function translateEvent(event) {
|
|
|
40216
40285
|
}
|
|
40217
40286
|
return void 0;
|
|
40218
40287
|
}
|
|
40219
|
-
case "tool_execution_start":
|
|
40288
|
+
case "tool_execution_start": {
|
|
40289
|
+
const uiStatusEnabled = uiStatusToolNames.has(event.toolName);
|
|
40290
|
+
const displayName = uiStatusEnabled ? parseConversationToolCallDisplayName(readToolUiStatus(event.args)) : void 0;
|
|
40220
40291
|
return {
|
|
40221
40292
|
type: "tool_start",
|
|
40222
40293
|
toolCallId: event.toolCallId,
|
|
40223
40294
|
toolName: event.toolName,
|
|
40224
|
-
|
|
40295
|
+
...displayName ? { displayName } : {},
|
|
40296
|
+
args: uiStatusEnabled ? stripToolUiStatusArgument(event.args) : event.args
|
|
40225
40297
|
};
|
|
40298
|
+
}
|
|
40226
40299
|
case "tool_execution_end":
|
|
40227
40300
|
return {
|
|
40228
40301
|
type: "tool_end",
|
|
@@ -40237,14 +40310,17 @@ function translateEvent(event) {
|
|
|
40237
40310
|
return void 0;
|
|
40238
40311
|
}
|
|
40239
40312
|
}
|
|
40240
|
-
function translateEvents(event) {
|
|
40241
|
-
const translated = translateEvent(event);
|
|
40313
|
+
function translateEvents(event, uiStatusToolNames = /* @__PURE__ */ new Set()) {
|
|
40314
|
+
const translated = translateEvent(event, uiStatusToolNames);
|
|
40242
40315
|
const events = translated ? [translated] : [];
|
|
40243
40316
|
if (event.type === "tool_execution_end" && !event.isError && event.result && typeof event.result === "object" && isAgentPresentationToolResult(event.result.details)) {
|
|
40244
40317
|
events.push(event.result.details.card);
|
|
40245
40318
|
}
|
|
40246
40319
|
return events;
|
|
40247
40320
|
}
|
|
40321
|
+
function readToolUiStatus(args) {
|
|
40322
|
+
return args && typeof args === "object" && !Array.isArray(args) ? args[TOOL_UI_STATUS_ARGUMENT] : void 0;
|
|
40323
|
+
}
|
|
40248
40324
|
function toErrorEvent(err2) {
|
|
40249
40325
|
const message = err2 instanceof Error ? err2.message : typeof err2 === "string" ? err2 : "unknown agent error";
|
|
40250
40326
|
const code = err2 !== null && typeof err2 === "object" && "code" in err2 && typeof err2.code === "string" ? err2.code : void 0;
|
|
@@ -40267,6 +40343,7 @@ var StreamBridge = class {
|
|
|
40267
40343
|
sessionDisposed = false;
|
|
40268
40344
|
session;
|
|
40269
40345
|
unsubscribe;
|
|
40346
|
+
uiStatusToolNames;
|
|
40270
40347
|
constructor(prompt, auth, options, images, createSession, linkqueBaseUrl) {
|
|
40271
40348
|
this.prompt = prompt;
|
|
40272
40349
|
this.auth = auth;
|
|
@@ -40274,6 +40351,7 @@ var StreamBridge = class {
|
|
|
40274
40351
|
this.images = images;
|
|
40275
40352
|
this.createSession = createSession;
|
|
40276
40353
|
this.linkqueBaseUrl = linkqueBaseUrl;
|
|
40354
|
+
this.uiStatusToolNames = getToolUiStatusEnabledNames(options.tools ?? []);
|
|
40277
40355
|
}
|
|
40278
40356
|
/** 产出事件直到 done/error;迭代异常(return()/throw())时走 finally 清理。 */
|
|
40279
40357
|
async *iterate() {
|
|
@@ -40407,7 +40485,7 @@ var StreamBridge = class {
|
|
|
40407
40485
|
return;
|
|
40408
40486
|
this.telemetry?.onEvent(event);
|
|
40409
40487
|
this.logDebug(`[pi-event] ${this.safeStringify(event)}`);
|
|
40410
|
-
for (const translated of translateEvents(event)) {
|
|
40488
|
+
for (const translated of translateEvents(event, this.uiStatusToolNames)) {
|
|
40411
40489
|
if (translated.type === "error" || translated.type === "done") {
|
|
40412
40490
|
if (this.settled)
|
|
40413
40491
|
return;
|
|
@@ -44713,27 +44791,27 @@ function wrapMcpServer(server, debugLog) {
|
|
|
44713
44791
|
};
|
|
44714
44792
|
}
|
|
44715
44793
|
function summarizeMcpResult(result) {
|
|
44716
|
-
const object =
|
|
44794
|
+
const object = isRecord3(result) ? result : void 0;
|
|
44717
44795
|
const content = Array.isArray(object?.content) ? object.content : void 0;
|
|
44718
44796
|
const summary = {
|
|
44719
44797
|
resultType: valueType(result),
|
|
44720
44798
|
resultKeys: objectKeys(object),
|
|
44721
44799
|
structuredContentType: valueType(object?.structuredContent),
|
|
44722
|
-
structuredContentKeys: objectKeys(
|
|
44800
|
+
structuredContentKeys: objectKeys(isRecord3(object?.structuredContent) ? object.structuredContent : void 0),
|
|
44723
44801
|
contentCount: content?.length ?? 0,
|
|
44724
|
-
contentTypes: content?.map((item) =>
|
|
44802
|
+
contentTypes: content?.map((item) => isRecord3(item) && typeof item.type === "string" ? item.type : valueType(item))
|
|
44725
44803
|
};
|
|
44726
44804
|
if (typeof object?.isError === "boolean")
|
|
44727
44805
|
summary.isError = object.isError;
|
|
44728
44806
|
if (object?.isError === true) {
|
|
44729
|
-
const errorText = content?.find((item) =>
|
|
44730
|
-
if (
|
|
44807
|
+
const errorText = content?.find((item) => isRecord3(item) && item.type === "text" && typeof item.text === "string");
|
|
44808
|
+
if (isRecord3(errorText) && typeof errorText.text === "string") {
|
|
44731
44809
|
summary.errorMessage = sanitizeDiagnosticText(errorText.text);
|
|
44732
44810
|
}
|
|
44733
44811
|
}
|
|
44734
44812
|
return summary;
|
|
44735
44813
|
}
|
|
44736
|
-
function
|
|
44814
|
+
function isRecord3(value) {
|
|
44737
44815
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
44738
44816
|
}
|
|
44739
44817
|
function objectKeys(value) {
|
|
@@ -45053,7 +45131,7 @@ function resolveChatDeps(env, deps, logCtx, historyOwnerId, appwriteApiKey, envS
|
|
|
45053
45131
|
}
|
|
45054
45132
|
store = createAppBaseStore(handle.databases, storage.databaseId, storage.tableId, historyOwnerId);
|
|
45055
45133
|
const config = new AppbaseRuntimeConfigProvider(env);
|
|
45056
|
-
clientCapabilityStore ??= createClientCapabilityStore(handle.databases, config.get("CLIENT_CAPABILITY_DATABASE_ID"), config.get("CLIENT_CAPABILITY_TABLE_ID"));
|
|
45134
|
+
clientCapabilityStore ??= createClientCapabilityStore(handle.databases, config.get("CLIENT_CAPABILITY_DATABASE_ID"), config.get("CLIENT_CAPABILITY_TABLE_ID"), new TablesDB(handle.client));
|
|
45057
45135
|
try {
|
|
45058
45136
|
historyStore ??= createConversationHistoryStore(handle.databases, resolveConversationHistoryStorage(env), historyOwnerId);
|
|
45059
45137
|
} catch (err2) {
|
|
@@ -45971,24 +46049,22 @@ async function runGateway(method, bodyJSON, env, deps, logCtx, historyOwnerId, a
|
|
|
45971
46049
|
}
|
|
45972
46050
|
async function chat(ctx) {
|
|
45973
46051
|
let result;
|
|
46052
|
+
const logCtx = withIsoTimestamp({ log: ctx.log, error: ctx.error });
|
|
45974
46053
|
try {
|
|
45975
46054
|
const bodyJSON = resolveBodyJSON(ctx.req);
|
|
45976
46055
|
const historyOwnerId = readAuthenticatedUserId(ctx.req.headers);
|
|
45977
46056
|
const appwriteApiKey = readAppwriteApiKey(ctx.req.headers);
|
|
45978
46057
|
if (readOperation(bodyJSON) === REPLACE_ANSWER_OPERATION) {
|
|
45979
|
-
const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0,
|
|
46058
|
+
const control = await runReplaceAnswer(ctx.req.method, bodyJSON, process.env, void 0, logCtx, appwriteApiKey);
|
|
45980
46059
|
return ctx.res.json?.(control.body, control.status);
|
|
45981
46060
|
}
|
|
45982
46061
|
const envSelector = readEnvSelector(ctx.req.headers);
|
|
45983
46062
|
const traceId = readTraceId(ctx.req.headers);
|
|
45984
46063
|
const temporaryFrontendAppId = readTemporaryFrontendAppId(ctx.req.headers);
|
|
45985
|
-
const gatewayAuth = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env,
|
|
45986
|
-
|
|
45987
|
-
error: ctx.error
|
|
45988
|
-
}) : void 0;
|
|
45989
|
-
result = historyOwnerId ? await runGateway(ctx.req.method, bodyJSON, process.env, void 0, { log: ctx.log, error: ctx.error }, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, readMcpPhoneAuthorization(ctx.req.headers)) : jsonError(401, "authentication_required", "\u7F3A\u5C11 Appwrite \u8BA4\u8BC1\u7528\u6237");
|
|
46064
|
+
const gatewayAuth = historyOwnerId ? resolveLinkqueGatewayAuth(ctx.req.headers, process.env, logCtx) : void 0;
|
|
46065
|
+
result = historyOwnerId ? await runGateway(ctx.req.method, bodyJSON, process.env, void 0, logCtx, historyOwnerId, appwriteApiKey, envSelector, traceId, gatewayAuth, temporaryFrontendAppId, readMcpPhoneAuthorization(ctx.req.headers)) : jsonError(401, "authentication_required", "\u7F3A\u5C11 Appwrite \u8BA4\u8BC1\u7528\u6237");
|
|
45990
46066
|
} catch (err2) {
|
|
45991
|
-
|
|
46067
|
+
logCtx?.error?.(err2);
|
|
45992
46068
|
result = err2 instanceof LinkqueGatewayAuthError || err2 instanceof LinkqueGatewayAuthUnconfiguredError ? jsonError(err2.status, err2.code, err2.message) : {
|
|
45993
46069
|
status: 500,
|
|
45994
46070
|
body: {
|
package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
runClientCapability,
|
|
4
4
|
runClientCapabilityCleanup,
|
|
5
5
|
runClientCapabilityResult
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-CUMXO6KK.js";
|
|
7
7
|
import "../../chunk-IWOFD643.js";
|
|
8
8
|
import "../../chunk-PXCGFBV5.js";
|
|
9
9
|
import "../../chunk-ETG6PNHQ.js";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-XUFLSZM4.js";
|
|
10
|
+
import "../../chunk-OHRCYI66.js";
|
|
12
11
|
import "../../chunk-EAODRPW4.js";
|
|
12
|
+
import "../../chunk-XUFLSZM4.js";
|
|
13
13
|
import "../../chunk-GAYNLDWK.js";
|
|
14
14
|
import "../../chunk-DNTEEBEH.js";
|
|
15
15
|
import "../../chunk-2ESYSVXG.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBakedProtocol,
|
|
3
3
|
setBakedProtocol
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-XUFLSZM4.js";
|
|
4
|
+
} from "../chunk-XL6BPKTI.js";
|
|
5
|
+
import "../chunk-OHRCYI66.js";
|
|
7
6
|
import "../chunk-EAODRPW4.js";
|
|
7
|
+
import "../chunk-XUFLSZM4.js";
|
|
8
8
|
import "../chunk-GAYNLDWK.js";
|
|
9
9
|
import "../chunk-DNTEEBEH.js";
|
|
10
10
|
import "../chunk-2ESYSVXG.js";
|