@ctxprotocol/sdk 0.13.1 → 0.15.0
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/README.md +12 -12
- package/dist/client/index.cjs +3 -42
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +4 -5
- package/dist/client/index.d.ts +4 -5
- package/dist/client/index.js +3 -42
- package/dist/client/index.js.map +1 -1
- package/dist/contrib/search/index.d.cts +2 -2
- package/dist/contrib/search/index.d.ts +2 -2
- package/dist/index.cjs +3 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +3 -42
- package/dist/index.js.map +1 -1
- package/dist/{types-BStHo4tI.d.cts → types-jbYPIQxq.d.cts} +155 -107
- package/dist/{types-BStHo4tI.d.ts → types-jbYPIQxq.d.ts} +155 -107
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -55,9 +55,9 @@ var Developer = class {
|
|
|
55
55
|
if (!toolId) {
|
|
56
56
|
throw new ContextError("toolId is required");
|
|
57
57
|
}
|
|
58
|
-
if (updates.name === void 0 && updates.description === void 0 && updates.category === void 0) {
|
|
58
|
+
if (updates.name === void 0 && updates.description === void 0 && updates.suggestedPrompts === void 0 && updates.category === void 0) {
|
|
59
59
|
throw new ContextError(
|
|
60
|
-
"At least one field required: name, description, or category"
|
|
60
|
+
"At least one field required: name, description, suggestedPrompts, or category"
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
if (updates.category !== void 0 && updates.category !== null && !ALLOWED_TOOL_CATEGORIES.includes(updates.category)) {
|
|
@@ -306,9 +306,6 @@ var Query = class {
|
|
|
306
306
|
}
|
|
307
307
|
normalizeResult(result) {
|
|
308
308
|
const candidate = result;
|
|
309
|
-
if (candidate.outcomeType === "clarification_required" && "clarification" in candidate && candidate.clarification) {
|
|
310
|
-
return candidate;
|
|
311
|
-
}
|
|
312
309
|
if (candidate.outcomeType === "capability_miss" && "capabilityMiss" in candidate && candidate.capabilityMiss) {
|
|
313
310
|
return candidate;
|
|
314
311
|
}
|
|
@@ -317,34 +314,6 @@ var Query = class {
|
|
|
317
314
|
outcomeType: "answer"
|
|
318
315
|
};
|
|
319
316
|
}
|
|
320
|
-
buildPolicyErrorEvent(params) {
|
|
321
|
-
if (params.clarificationPolicy !== "error") {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
if (params.result.outcomeType === "clarification_required") {
|
|
325
|
-
return {
|
|
326
|
-
type: "error",
|
|
327
|
-
error: params.result.response,
|
|
328
|
-
code: "clarification_required",
|
|
329
|
-
reasonCode: "clarification_required",
|
|
330
|
-
outcomeType: "clarification_required",
|
|
331
|
-
clarification: params.result.clarification,
|
|
332
|
-
querySession: params.result.querySession
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
if (params.result.outcomeType === "capability_miss") {
|
|
336
|
-
return {
|
|
337
|
-
type: "error",
|
|
338
|
-
error: params.result.response,
|
|
339
|
-
code: "capability_miss",
|
|
340
|
-
reasonCode: "capability_miss",
|
|
341
|
-
outcomeType: "capability_miss",
|
|
342
|
-
capabilityMiss: params.result.capabilityMiss,
|
|
343
|
-
querySession: params.result.querySession
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
return void 0;
|
|
347
|
-
}
|
|
348
317
|
buildSyntheticTraceFromRunResult(params) {
|
|
349
318
|
const timeline = params.toolsUsed.map((tool, index) => ({
|
|
350
319
|
stepType: "tool-call",
|
|
@@ -558,7 +527,6 @@ var Query = class {
|
|
|
558
527
|
tools: opts.tools,
|
|
559
528
|
resumeFrom: opts.resumeFrom,
|
|
560
529
|
forkFrom: opts.forkFrom,
|
|
561
|
-
clarificationPolicy: opts.clarificationPolicy,
|
|
562
530
|
answerModelId: opts.answerModelId,
|
|
563
531
|
responseShape: opts.responseShape,
|
|
564
532
|
favoritesOnly: opts.favoritesOnly,
|
|
@@ -616,13 +584,6 @@ var Query = class {
|
|
|
616
584
|
normalizedResult.developerTrace = mergedTrace;
|
|
617
585
|
}
|
|
618
586
|
event.result = normalizedResult;
|
|
619
|
-
const policyErrorEvent = this.buildPolicyErrorEvent({
|
|
620
|
-
result: normalizedResult,
|
|
621
|
-
clarificationPolicy: opts.clarificationPolicy
|
|
622
|
-
});
|
|
623
|
-
if (policyErrorEvent) {
|
|
624
|
-
return policyErrorEvent;
|
|
625
|
-
}
|
|
626
587
|
}
|
|
627
588
|
return event;
|
|
628
589
|
};
|
|
@@ -693,7 +654,7 @@ var ContextClient = class {
|
|
|
693
654
|
*
|
|
694
655
|
* Unlike `tools.execute()` which calls a single tool once, `query` sends
|
|
695
656
|
* a natural-language question and lets the server handle discovery,
|
|
696
|
-
* metadata scout,
|
|
657
|
+
* metadata scout, iterative execution, and AI synthesis —
|
|
697
658
|
* one flat fee.
|
|
698
659
|
*/
|
|
699
660
|
query;
|