@ctxprotocol/sdk 0.13.0 → 0.14.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 +10 -10
- 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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -42
- package/dist/index.js.map +1 -1
- package/dist/{types-DPxI353c.d.cts → types-jbYPIQxq.d.cts} +158 -111
- package/dist/{types-DPxI353c.d.ts → types-jbYPIQxq.d.ts} +158 -111
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ContextClient, Developer, Discovery, Query, Tools } from './client/index.cjs';
|
|
2
|
-
export { D as ContextClientOptions, B as ContextError,
|
|
2
|
+
export { D as ContextClientOptions, B as ContextError, am as ContextErrorCode, W as ExecuteApiErrorResponse, X as ExecuteApiResponse, V as ExecuteApiSuccessResponse, K as ExecuteOptions, Z as ExecuteSessionApiResponse, Y as ExecuteSessionApiSuccessResponse, P as ExecuteSessionResult, O as ExecuteSessionSpend, L as ExecuteSessionStartOptions, N as ExecuteSessionStatus, U as ExecutionResult, M as McpTool, G as McpToolMeta, H as McpToolRateLimitHints, ad as QueryApiResponse, ac as QueryApiSuccessResponse, _ as QueryAttemptForkReason, $ as QueryAttemptReference, a6 as QueryCompletenessRepairEvent, a5 as QueryCost, Q as QueryDeveloperTrace, a7 as QueryDeveloperTraceDiagnostics, ab as QueryDeveloperTraceLoopInfo, a9 as QueryDeveloperTraceStep, a8 as QueryDeveloperTraceSummary, aa as QueryDeveloperTraceToolRef, a0 as QueryForkReference, a1 as QueryOptions, a2 as QueryResult, a3 as QuerySessionState, ah as QueryStreamDeveloperTraceEvent, ai as QueryStreamDoneEvent, aj as QueryStreamErrorEvent, ae as QueryStreamEvent, ag as QueryStreamTextDeltaEvent, af as QueryStreamToolStatusEvent, a4 as QueryToolUsage, J as SearchOptions, I as SearchResponse, E as SuggestedPrompt, F as SuggestedPromptSource, T as Tool, ak as UpdateToolOptions, al as UpdateToolResult } from './types-jbYPIQxq.cjs';
|
|
3
3
|
import { JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ContextClient, Developer, Discovery, Query, Tools } from './client/index.js';
|
|
2
|
-
export { D as ContextClientOptions, B as ContextError,
|
|
2
|
+
export { D as ContextClientOptions, B as ContextError, am as ContextErrorCode, W as ExecuteApiErrorResponse, X as ExecuteApiResponse, V as ExecuteApiSuccessResponse, K as ExecuteOptions, Z as ExecuteSessionApiResponse, Y as ExecuteSessionApiSuccessResponse, P as ExecuteSessionResult, O as ExecuteSessionSpend, L as ExecuteSessionStartOptions, N as ExecuteSessionStatus, U as ExecutionResult, M as McpTool, G as McpToolMeta, H as McpToolRateLimitHints, ad as QueryApiResponse, ac as QueryApiSuccessResponse, _ as QueryAttemptForkReason, $ as QueryAttemptReference, a6 as QueryCompletenessRepairEvent, a5 as QueryCost, Q as QueryDeveloperTrace, a7 as QueryDeveloperTraceDiagnostics, ab as QueryDeveloperTraceLoopInfo, a9 as QueryDeveloperTraceStep, a8 as QueryDeveloperTraceSummary, aa as QueryDeveloperTraceToolRef, a0 as QueryForkReference, a1 as QueryOptions, a2 as QueryResult, a3 as QuerySessionState, ah as QueryStreamDeveloperTraceEvent, ai as QueryStreamDoneEvent, aj as QueryStreamErrorEvent, ae as QueryStreamEvent, ag as QueryStreamTextDeltaEvent, af as QueryStreamToolStatusEvent, a4 as QueryToolUsage, J as SearchOptions, I as SearchResponse, E as SuggestedPrompt, F as SuggestedPromptSource, T as Tool, ak as UpdateToolOptions, al as UpdateToolResult } from './types-jbYPIQxq.js';
|
|
3
3
|
import { JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -53,9 +53,9 @@ var Developer = class {
|
|
|
53
53
|
if (!toolId) {
|
|
54
54
|
throw new ContextError("toolId is required");
|
|
55
55
|
}
|
|
56
|
-
if (updates.name === void 0 && updates.description === void 0 && updates.category === void 0) {
|
|
56
|
+
if (updates.name === void 0 && updates.description === void 0 && updates.suggestedPrompts === void 0 && updates.category === void 0) {
|
|
57
57
|
throw new ContextError(
|
|
58
|
-
"At least one field required: name, description, or category"
|
|
58
|
+
"At least one field required: name, description, suggestedPrompts, or category"
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
if (updates.category !== void 0 && updates.category !== null && !ALLOWED_TOOL_CATEGORIES.includes(updates.category)) {
|
|
@@ -304,9 +304,6 @@ var Query = class {
|
|
|
304
304
|
}
|
|
305
305
|
normalizeResult(result) {
|
|
306
306
|
const candidate = result;
|
|
307
|
-
if (candidate.outcomeType === "clarification_required" && "clarification" in candidate && candidate.clarification) {
|
|
308
|
-
return candidate;
|
|
309
|
-
}
|
|
310
307
|
if (candidate.outcomeType === "capability_miss" && "capabilityMiss" in candidate && candidate.capabilityMiss) {
|
|
311
308
|
return candidate;
|
|
312
309
|
}
|
|
@@ -315,34 +312,6 @@ var Query = class {
|
|
|
315
312
|
outcomeType: "answer"
|
|
316
313
|
};
|
|
317
314
|
}
|
|
318
|
-
buildPolicyErrorEvent(params) {
|
|
319
|
-
if (params.clarificationPolicy !== "error") {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
if (params.result.outcomeType === "clarification_required") {
|
|
323
|
-
return {
|
|
324
|
-
type: "error",
|
|
325
|
-
error: params.result.response,
|
|
326
|
-
code: "clarification_required",
|
|
327
|
-
reasonCode: "clarification_required",
|
|
328
|
-
outcomeType: "clarification_required",
|
|
329
|
-
clarification: params.result.clarification,
|
|
330
|
-
querySession: params.result.querySession
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
if (params.result.outcomeType === "capability_miss") {
|
|
334
|
-
return {
|
|
335
|
-
type: "error",
|
|
336
|
-
error: params.result.response,
|
|
337
|
-
code: "capability_miss",
|
|
338
|
-
reasonCode: "capability_miss",
|
|
339
|
-
outcomeType: "capability_miss",
|
|
340
|
-
capabilityMiss: params.result.capabilityMiss,
|
|
341
|
-
querySession: params.result.querySession
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
return void 0;
|
|
345
|
-
}
|
|
346
315
|
buildSyntheticTraceFromRunResult(params) {
|
|
347
316
|
const timeline = params.toolsUsed.map((tool, index) => ({
|
|
348
317
|
stepType: "tool-call",
|
|
@@ -556,7 +525,6 @@ var Query = class {
|
|
|
556
525
|
tools: opts.tools,
|
|
557
526
|
resumeFrom: opts.resumeFrom,
|
|
558
527
|
forkFrom: opts.forkFrom,
|
|
559
|
-
clarificationPolicy: opts.clarificationPolicy,
|
|
560
528
|
answerModelId: opts.answerModelId,
|
|
561
529
|
responseShape: opts.responseShape,
|
|
562
530
|
favoritesOnly: opts.favoritesOnly,
|
|
@@ -614,13 +582,6 @@ var Query = class {
|
|
|
614
582
|
normalizedResult.developerTrace = mergedTrace;
|
|
615
583
|
}
|
|
616
584
|
event.result = normalizedResult;
|
|
617
|
-
const policyErrorEvent = this.buildPolicyErrorEvent({
|
|
618
|
-
result: normalizedResult,
|
|
619
|
-
clarificationPolicy: opts.clarificationPolicy
|
|
620
|
-
});
|
|
621
|
-
if (policyErrorEvent) {
|
|
622
|
-
return policyErrorEvent;
|
|
623
|
-
}
|
|
624
585
|
}
|
|
625
586
|
return event;
|
|
626
587
|
};
|
|
@@ -691,7 +652,7 @@ var ContextClient = class {
|
|
|
691
652
|
*
|
|
692
653
|
* Unlike `tools.execute()` which calls a single tool once, `query` sends
|
|
693
654
|
* a natural-language question and lets the server handle discovery,
|
|
694
|
-
* metadata scout,
|
|
655
|
+
* metadata scout, iterative execution, and AI synthesis —
|
|
695
656
|
* one flat fee.
|
|
696
657
|
*/
|
|
697
658
|
query;
|