linkque-cli-v2 1.1.0 → 1.1.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 +15 -39
- package/package.json +1 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-MN4S5EF5.js → chunk-TM6MTGSL.js} +32 -10
- 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 +32 -10
package/linkquejs.js
CHANGED
|
@@ -25322,6 +25322,7 @@ function analyzeA2UIBindings(protocol) {
|
|
|
25322
25322
|
}
|
|
25323
25323
|
}
|
|
25324
25324
|
return {
|
|
25325
|
+
surfaceIds: [...surfaces],
|
|
25325
25326
|
surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
|
|
25326
25327
|
occurrences,
|
|
25327
25328
|
issues
|
|
@@ -27399,9 +27400,6 @@ function createA2UICardDraftStructureChecksum(draft) {
|
|
|
27399
27400
|
function createA2UICardMcpConfigChecksum(resources) {
|
|
27400
27401
|
return sha256Hex(stableJsonStringify(resources));
|
|
27401
27402
|
}
|
|
27402
|
-
function createA2UICardBindingContextChecksum(context) {
|
|
27403
|
-
return sha256Hex(stableJsonStringify(context));
|
|
27404
|
-
}
|
|
27405
27403
|
function createA2UICardRevision(draftChecksum2, bindings) {
|
|
27406
27404
|
const digest = sha256Hex(`${draftChecksum2}
|
|
27407
27405
|
${stableJsonStringify(bindings)}`);
|
|
@@ -27530,16 +27528,14 @@ async function readCardDraft(cwd, draftId) {
|
|
|
27530
27528
|
...theme ? { theme } : {}
|
|
27531
27529
|
};
|
|
27532
27530
|
}
|
|
27533
|
-
async function validateCardBindings(cwd, draftId,
|
|
27531
|
+
async function validateCardBindings(cwd, draftId, _contextChecksum, fieldId) {
|
|
27534
27532
|
assertDraftId(draftId);
|
|
27535
|
-
assertChecksum(contextChecksum, "\u7ED1\u5B9A\u4E0A\u4E0B\u6587 checksum");
|
|
27536
27533
|
if (fieldId !== void 0) assertDraftId(fieldId);
|
|
27537
|
-
return validateCardBindingsFromDisk(cwd, draftId,
|
|
27534
|
+
return validateCardBindingsFromDisk(cwd, draftId, fieldId);
|
|
27538
27535
|
}
|
|
27539
|
-
async function finalizeCard(cwd, draftId, expectedDraftChecksum,
|
|
27536
|
+
async function finalizeCard(cwd, draftId, expectedDraftChecksum, _contextChecksum) {
|
|
27540
27537
|
assertDraftId(draftId);
|
|
27541
27538
|
assertChecksum(expectedDraftChecksum, "\u8349\u7A3F checksum");
|
|
27542
|
-
assertChecksum(contextChecksum, "\u7ED1\u5B9A\u4E0A\u4E0B\u6587 checksum");
|
|
27543
27539
|
return withWorkspaceLock(
|
|
27544
27540
|
{
|
|
27545
27541
|
path: import_path22.default.join(cwd, FINALIZE_LOCK_PATH),
|
|
@@ -27549,17 +27545,12 @@ async function finalizeCard(cwd, draftId, expectedDraftChecksum, contextChecksum
|
|
|
27549
27545
|
retryMs: FINALIZE_LOCK_RETRY_MS,
|
|
27550
27546
|
timeoutMs: FINALIZE_LOCK_TIMEOUT_MS
|
|
27551
27547
|
},
|
|
27552
|
-
async () => finalizeCardWhileLocked(
|
|
27553
|
-
cwd,
|
|
27554
|
-
draftId,
|
|
27555
|
-
expectedDraftChecksum,
|
|
27556
|
-
contextChecksum
|
|
27557
|
-
)
|
|
27548
|
+
async () => finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum)
|
|
27558
27549
|
);
|
|
27559
27550
|
}
|
|
27560
27551
|
async function finalizeCardFromRequest(cwd, requestFile) {
|
|
27561
27552
|
const value = await readRequiredJson(import_path22.default.resolve(cwd, requestFile));
|
|
27562
|
-
if (!isJsonObject(value) || value.version !== 1 || typeof value.draftId !== "string" || typeof value.expectedDraftChecksum !== "string" || typeof value.contextChecksum !== "string" || Object.keys(value).some(
|
|
27553
|
+
if (!isJsonObject(value) || value.version !== 1 || typeof value.draftId !== "string" || typeof value.expectedDraftChecksum !== "string" || value.contextChecksum !== void 0 && typeof value.contextChecksum !== "string" || Object.keys(value).some(
|
|
27563
27554
|
(key) => ![
|
|
27564
27555
|
"version",
|
|
27565
27556
|
"draftId",
|
|
@@ -27612,7 +27603,7 @@ async function rollbackCardFinalize(cwd, rollbackToken) {
|
|
|
27612
27603
|
}
|
|
27613
27604
|
);
|
|
27614
27605
|
}
|
|
27615
|
-
async function validateCardBindingsFromDisk(cwd, draftId,
|
|
27606
|
+
async function validateCardBindingsFromDisk(cwd, draftId, fieldId) {
|
|
27616
27607
|
const directory = draftDirectory(cwd, draftId);
|
|
27617
27608
|
const [bundle, contextValue, configValue] = await Promise.all([
|
|
27618
27609
|
readBundle(directory, draftId),
|
|
@@ -27627,16 +27618,6 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
|
|
|
27627
27618
|
);
|
|
27628
27619
|
}
|
|
27629
27620
|
const context = contextResult.data;
|
|
27630
|
-
const actualContextChecksum = createA2UICardBindingContextChecksum(context);
|
|
27631
|
-
const legacyContextChecksum = createA2UICardBindingContextChecksum(
|
|
27632
|
-
contextValue
|
|
27633
|
-
);
|
|
27634
|
-
if (actualContextChecksum !== expectedContextChecksum && legacyContextChecksum !== expectedContextChecksum) {
|
|
27635
|
-
throw new LinkqueCliError(
|
|
27636
|
-
"CARD_BINDING_CONTEXT_STALE",
|
|
27637
|
-
"\u7ED1\u5B9A\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77 AI \u8F85\u52A9\u7ED1\u5B9A"
|
|
27638
|
-
);
|
|
27639
|
-
}
|
|
27640
27621
|
const draftStructureChecksum = createA2UICardDraftStructureChecksum(bundle);
|
|
27641
27622
|
const config2 = parseAgentConfig(configValue);
|
|
27642
27623
|
const mcpResources = normalizedMcpResources(config2);
|
|
@@ -27669,7 +27650,6 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
|
|
|
27669
27650
|
return {
|
|
27670
27651
|
bindingCount: bundle.manifest.bindings?.length ?? 0,
|
|
27671
27652
|
complete: businessFieldIds.every((id) => boundFieldIds.has(id)),
|
|
27672
|
-
contextChecksum: actualContextChecksum,
|
|
27673
27653
|
draftChecksum: draftChecksum(bundle),
|
|
27674
27654
|
draftId,
|
|
27675
27655
|
draftStructureChecksum,
|
|
@@ -27677,12 +27657,8 @@ async function validateCardBindingsFromDisk(cwd, draftId, expectedContextChecksu
|
|
|
27677
27657
|
valid: true
|
|
27678
27658
|
};
|
|
27679
27659
|
}
|
|
27680
|
-
async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum
|
|
27681
|
-
const validation = await validateCardBindingsFromDisk(
|
|
27682
|
-
cwd,
|
|
27683
|
-
draftId,
|
|
27684
|
-
contextChecksum
|
|
27685
|
-
);
|
|
27660
|
+
async function finalizeCardWhileLocked(cwd, draftId, expectedDraftChecksum) {
|
|
27661
|
+
const validation = await validateCardBindingsFromDisk(cwd, draftId);
|
|
27686
27662
|
if (validation.draftChecksum !== expectedDraftChecksum) {
|
|
27687
27663
|
throw new LinkqueCliError(
|
|
27688
27664
|
"CARD_FINALIZE_CONFLICT",
|
|
@@ -29107,7 +29083,7 @@ var cardValidateBindings = {
|
|
|
29107
29083
|
},
|
|
29108
29084
|
{
|
|
29109
29085
|
flags: "--context-checksum <checksum>",
|
|
29110
|
-
description: "
|
|
29086
|
+
description: "deprecated compatibility option; accepted and ignored",
|
|
29111
29087
|
key: "contextChecksum"
|
|
29112
29088
|
},
|
|
29113
29089
|
{
|
|
@@ -29119,9 +29095,9 @@ var cardValidateBindings = {
|
|
|
29119
29095
|
summarize: ({ draftId }) => `Card draft ${draftId} bindings validated.
|
|
29120
29096
|
`,
|
|
29121
29097
|
run: (cwd, options) => {
|
|
29122
|
-
if (options.draftId === void 0
|
|
29098
|
+
if (options.draftId === void 0) {
|
|
29123
29099
|
throw new InvalidArgumentError(
|
|
29124
|
-
"required
|
|
29100
|
+
"required option '--draft-id' not specified"
|
|
29125
29101
|
);
|
|
29126
29102
|
}
|
|
29127
29103
|
return validateCardBindings(
|
|
@@ -29153,7 +29129,7 @@ var cardFinalize = {
|
|
|
29153
29129
|
},
|
|
29154
29130
|
{
|
|
29155
29131
|
flags: "--context-checksum <checksum>",
|
|
29156
|
-
description: "
|
|
29132
|
+
description: "deprecated compatibility option; accepted and ignored",
|
|
29157
29133
|
key: "contextChecksum"
|
|
29158
29134
|
}
|
|
29159
29135
|
],
|
|
@@ -29168,9 +29144,9 @@ var cardFinalize = {
|
|
|
29168
29144
|
}
|
|
29169
29145
|
return finalizeCardFromRequest(cwd, options.requestFile);
|
|
29170
29146
|
}
|
|
29171
|
-
if (options.draftId === void 0 || options.expectedDraftChecksum === void 0
|
|
29147
|
+
if (options.draftId === void 0 || options.expectedDraftChecksum === void 0) {
|
|
29172
29148
|
throw new InvalidArgumentError(
|
|
29173
|
-
"required options '--draft-id'
|
|
29149
|
+
"required options '--draft-id' and '--expected-draft-checksum' not specified"
|
|
29174
29150
|
);
|
|
29175
29151
|
}
|
|
29176
29152
|
return finalizeCard(
|
package/package.json
CHANGED
package/vendor/linkque-agent-appwrite-integrate/dist/esm/{chunk-MN4S5EF5.js → chunk-TM6MTGSL.js}
RENAMED
|
@@ -17030,6 +17030,7 @@ function analyzeA2UIBindings(protocol) {
|
|
|
17030
17030
|
}
|
|
17031
17031
|
}
|
|
17032
17032
|
return {
|
|
17033
|
+
surfaceIds: [...surfaces],
|
|
17033
17034
|
surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
|
|
17034
17035
|
occurrences,
|
|
17035
17036
|
issues
|
|
@@ -18331,25 +18332,46 @@ function isAgentPresentationToolResult(value) {
|
|
|
18331
18332
|
}
|
|
18332
18333
|
function injectResolvedViewModel(protocol, viewModel) {
|
|
18333
18334
|
const analysis = analyzeA2UIBindings(protocol);
|
|
18334
|
-
|
|
18335
|
-
|
|
18335
|
+
const declaredSurfaceIds = analysis.surfaceIds;
|
|
18336
|
+
const surfaceIds = Array.isArray(declaredSurfaceIds) && declaredSurfaceIds.every((surfaceId) => typeof surfaceId === "string") ? declaredSurfaceIds : collectA2UISurfaceIdsForLegacyContract(protocol);
|
|
18337
|
+
if (analysis.issues.length || surfaceIds.length === 0) {
|
|
18338
|
+
throw new Error("CARD template does not contain a valid A2UI surface");
|
|
18336
18339
|
}
|
|
18337
18340
|
return [
|
|
18338
18341
|
...protocol,
|
|
18339
18342
|
{
|
|
18340
18343
|
version: "0.9",
|
|
18341
|
-
datas:
|
|
18342
|
-
{
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
value: viewModel
|
|
18347
|
-
}
|
|
18344
|
+
datas: surfaceIds.map((surfaceId) => ({
|
|
18345
|
+
updateDataModel: {
|
|
18346
|
+
surfaceId,
|
|
18347
|
+
path: "/",
|
|
18348
|
+
value: viewModel
|
|
18348
18349
|
}
|
|
18349
|
-
|
|
18350
|
+
}))
|
|
18350
18351
|
}
|
|
18351
18352
|
];
|
|
18352
18353
|
}
|
|
18354
|
+
function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
18355
|
+
const surfaceIds = /* @__PURE__ */ new Set();
|
|
18356
|
+
for (const message of protocol) {
|
|
18357
|
+
if (!isJsonObject(message) || !Array.isArray(message.datas))
|
|
18358
|
+
continue;
|
|
18359
|
+
for (const instruction of message.datas) {
|
|
18360
|
+
if (!isJsonObject(instruction))
|
|
18361
|
+
continue;
|
|
18362
|
+
const operations = [
|
|
18363
|
+
"createSurface" in instruction ? instruction.createSurface : void 0,
|
|
18364
|
+
"updateComponents" in instruction ? instruction.updateComponents : void 0
|
|
18365
|
+
];
|
|
18366
|
+
for (const operation of operations) {
|
|
18367
|
+
if (isJsonObject(operation) && typeof operation.surfaceId === "string") {
|
|
18368
|
+
surfaceIds.add(operation.surfaceId);
|
|
18369
|
+
}
|
|
18370
|
+
}
|
|
18371
|
+
}
|
|
18372
|
+
}
|
|
18373
|
+
return [...surfaceIds];
|
|
18374
|
+
}
|
|
18353
18375
|
function createPresentationDescription(config) {
|
|
18354
18376
|
return [
|
|
18355
18377
|
config.description,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
parseConversationRunRequest,
|
|
52
52
|
parseSkillFile,
|
|
53
53
|
streamToConversationEvents
|
|
54
|
-
} from "../../chunk-
|
|
54
|
+
} from "../../chunk-TM6MTGSL.js";
|
|
55
55
|
import "../../chunk-XUFLSZM4.js";
|
|
56
56
|
import "../../chunk-I64V3ICJ.js";
|
|
57
57
|
import "../../chunk-6MHDOBWO.js";
|
package/worker.js
CHANGED
|
@@ -13846,6 +13846,7 @@ function analyzeA2UIBindings(protocol) {
|
|
|
13846
13846
|
}
|
|
13847
13847
|
}
|
|
13848
13848
|
return {
|
|
13849
|
+
surfaceIds: [...surfaces],
|
|
13849
13850
|
surfaceId: surfaces.size === 1 ? [...surfaces][0] : void 0,
|
|
13850
13851
|
occurrences,
|
|
13851
13852
|
issues
|
|
@@ -15259,25 +15260,46 @@ function isAgentPresentationToolResult(value) {
|
|
|
15259
15260
|
}
|
|
15260
15261
|
function injectResolvedViewModel(protocol, viewModel) {
|
|
15261
15262
|
const analysis = analyzeA2UIBindings(protocol);
|
|
15262
|
-
|
|
15263
|
-
|
|
15263
|
+
const declaredSurfaceIds = analysis.surfaceIds;
|
|
15264
|
+
const surfaceIds = Array.isArray(declaredSurfaceIds) && declaredSurfaceIds.every((surfaceId) => typeof surfaceId === "string") ? declaredSurfaceIds : collectA2UISurfaceIdsForLegacyContract(protocol);
|
|
15265
|
+
if (analysis.issues.length || surfaceIds.length === 0) {
|
|
15266
|
+
throw new Error("CARD template does not contain a valid A2UI surface");
|
|
15264
15267
|
}
|
|
15265
15268
|
return [
|
|
15266
15269
|
...protocol,
|
|
15267
15270
|
{
|
|
15268
15271
|
version: "0.9",
|
|
15269
|
-
datas:
|
|
15270
|
-
{
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
value: viewModel
|
|
15275
|
-
}
|
|
15272
|
+
datas: surfaceIds.map((surfaceId) => ({
|
|
15273
|
+
updateDataModel: {
|
|
15274
|
+
surfaceId,
|
|
15275
|
+
path: "/",
|
|
15276
|
+
value: viewModel
|
|
15276
15277
|
}
|
|
15277
|
-
|
|
15278
|
+
}))
|
|
15278
15279
|
}
|
|
15279
15280
|
];
|
|
15280
15281
|
}
|
|
15282
|
+
function collectA2UISurfaceIdsForLegacyContract(protocol) {
|
|
15283
|
+
const surfaceIds = /* @__PURE__ */ new Set();
|
|
15284
|
+
for (const message of protocol) {
|
|
15285
|
+
if (!isJsonObject(message) || !Array.isArray(message.datas))
|
|
15286
|
+
continue;
|
|
15287
|
+
for (const instruction of message.datas) {
|
|
15288
|
+
if (!isJsonObject(instruction))
|
|
15289
|
+
continue;
|
|
15290
|
+
const operations = [
|
|
15291
|
+
"createSurface" in instruction ? instruction.createSurface : void 0,
|
|
15292
|
+
"updateComponents" in instruction ? instruction.updateComponents : void 0
|
|
15293
|
+
];
|
|
15294
|
+
for (const operation of operations) {
|
|
15295
|
+
if (isJsonObject(operation) && typeof operation.surfaceId === "string") {
|
|
15296
|
+
surfaceIds.add(operation.surfaceId);
|
|
15297
|
+
}
|
|
15298
|
+
}
|
|
15299
|
+
}
|
|
15300
|
+
}
|
|
15301
|
+
return [...surfaceIds];
|
|
15302
|
+
}
|
|
15281
15303
|
function createPresentationDescription(config2) {
|
|
15282
15304
|
return [
|
|
15283
15305
|
config2.description,
|