@ctxprotocol/sdk 0.10.0 → 0.11.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 +3 -1
- package/dist/client/index.cjs +70 -0
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +39 -3
- package/dist/client/index.d.ts +39 -3
- package/dist/client/index.js +69 -1
- 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 +69 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-Bgjq3OBR.d.cts → types-DRbq-FA6.d.cts} +110 -1
- package/dist/{types-Bgjq3OBR.d.ts → types-DRbq-FA6.d.ts} +110 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ContextClient, Discovery, Query, Tools } from './client/index.cjs';
|
|
2
|
-
export { D as ContextClientOptions, B as ContextError,
|
|
1
|
+
export { ContextClient, Developer, Discovery, Query, Tools } from './client/index.cjs';
|
|
2
|
+
export { D as ContextClientOptions, B as ContextError, al as ContextErrorCode, U as ExecuteApiErrorResponse, V as ExecuteApiResponse, P as ExecuteApiSuccessResponse, I as ExecuteOptions, X as ExecuteSessionApiResponse, W as ExecuteSessionApiSuccessResponse, N as ExecuteSessionResult, L as ExecuteSessionSpend, J as ExecuteSessionStartOptions, K as ExecuteSessionStatus, O as ExecutionResult, M as McpTool, E as McpToolMeta, F as McpToolRateLimitHints, ac as QueryApiResponse, ab as QueryApiSuccessResponse, Z as QueryAttemptForkReason, _ as QueryAttemptReference, a5 as QueryCompletenessRepairEvent, a4 as QueryCost, Y as QueryDeepMode, Q as QueryDeveloperTrace, a6 as QueryDeveloperTraceDiagnostics, aa as QueryDeveloperTraceLoopInfo, a8 as QueryDeveloperTraceStep, a7 as QueryDeveloperTraceSummary, a9 as QueryDeveloperTraceToolRef, $ as QueryForkReference, a0 as QueryOptions, a1 as QueryResult, a2 as QuerySessionState, ag as QueryStreamDeveloperTraceEvent, ah as QueryStreamDoneEvent, ai as QueryStreamErrorEvent, ad as QueryStreamEvent, af as QueryStreamTextDeltaEvent, ae as QueryStreamToolStatusEvent, a3 as QueryToolUsage, H as SearchOptions, G as SearchResponse, T as Tool, aj as UpdateToolOptions, ak as UpdateToolResult } from './types-DRbq-FA6.cjs';
|
|
3
3
|
import { JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ContextClient, Discovery, Query, Tools } from './client/index.js';
|
|
2
|
-
export { D as ContextClientOptions, B as ContextError,
|
|
1
|
+
export { ContextClient, Developer, Discovery, Query, Tools } from './client/index.js';
|
|
2
|
+
export { D as ContextClientOptions, B as ContextError, al as ContextErrorCode, U as ExecuteApiErrorResponse, V as ExecuteApiResponse, P as ExecuteApiSuccessResponse, I as ExecuteOptions, X as ExecuteSessionApiResponse, W as ExecuteSessionApiSuccessResponse, N as ExecuteSessionResult, L as ExecuteSessionSpend, J as ExecuteSessionStartOptions, K as ExecuteSessionStatus, O as ExecutionResult, M as McpTool, E as McpToolMeta, F as McpToolRateLimitHints, ac as QueryApiResponse, ab as QueryApiSuccessResponse, Z as QueryAttemptForkReason, _ as QueryAttemptReference, a5 as QueryCompletenessRepairEvent, a4 as QueryCost, Y as QueryDeepMode, Q as QueryDeveloperTrace, a6 as QueryDeveloperTraceDiagnostics, aa as QueryDeveloperTraceLoopInfo, a8 as QueryDeveloperTraceStep, a7 as QueryDeveloperTraceSummary, a9 as QueryDeveloperTraceToolRef, $ as QueryForkReference, a0 as QueryOptions, a1 as QueryResult, a2 as QuerySessionState, ag as QueryStreamDeveloperTraceEvent, ah as QueryStreamDoneEvent, ai as QueryStreamErrorEvent, ad as QueryStreamEvent, af as QueryStreamTextDeltaEvent, ae as QueryStreamToolStatusEvent, a3 as QueryToolUsage, H as SearchOptions, G as SearchResponse, T as Tool, aj as UpdateToolOptions, ak as UpdateToolResult } from './types-DRbq-FA6.js';
|
|
3
3
|
import { JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { jwtVerify, importSPKI } from 'jose';
|
|
2
2
|
|
|
3
3
|
// src/client/types.ts
|
|
4
|
+
var ALLOWED_TOOL_CATEGORIES = [
|
|
5
|
+
"Crypto & DeFi",
|
|
6
|
+
"Financial Markets",
|
|
7
|
+
"Business & Sales",
|
|
8
|
+
"Marketing & SEO",
|
|
9
|
+
"Legal & Regulatory",
|
|
10
|
+
"Real World",
|
|
11
|
+
"Developer Tools",
|
|
12
|
+
"Research & Academia",
|
|
13
|
+
"Utility",
|
|
14
|
+
"Other"
|
|
15
|
+
];
|
|
4
16
|
var ContextError = class _ContextError extends Error {
|
|
5
17
|
constructor(message, code, statusCode, helpUrl) {
|
|
6
18
|
super(message);
|
|
@@ -12,6 +24,57 @@ var ContextError = class _ContextError extends Error {
|
|
|
12
24
|
}
|
|
13
25
|
};
|
|
14
26
|
|
|
27
|
+
// src/client/resources/developer.ts
|
|
28
|
+
var Developer = class {
|
|
29
|
+
constructor(client) {
|
|
30
|
+
this.client = client;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Update a tool listing's metadata (name, description, category).
|
|
34
|
+
*
|
|
35
|
+
* Requires an API key belonging to the tool's owner.
|
|
36
|
+
*
|
|
37
|
+
* @param toolId - The UUID of the tool to update
|
|
38
|
+
* @param updates - Fields to update (at least one required)
|
|
39
|
+
* @returns The updated tool metadata
|
|
40
|
+
*
|
|
41
|
+
* @throws {ContextError} If authentication fails or the caller does not own the tool
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const updated = await client.developer.updateTool("tool-uuid", {
|
|
46
|
+
* description: "Updated description with better showcase prompts",
|
|
47
|
+
* category: "crypto",
|
|
48
|
+
* });
|
|
49
|
+
* console.log(updated.updatedAt);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
async updateTool(toolId, updates) {
|
|
53
|
+
if (!toolId) {
|
|
54
|
+
throw new ContextError("toolId is required");
|
|
55
|
+
}
|
|
56
|
+
if (updates.name === void 0 && updates.description === void 0 && updates.category === void 0) {
|
|
57
|
+
throw new ContextError(
|
|
58
|
+
"At least one field required: name, description, or category"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
if (updates.category !== void 0 && updates.category !== null && !ALLOWED_TOOL_CATEGORIES.includes(updates.category)) {
|
|
62
|
+
throw new ContextError(
|
|
63
|
+
`category must be one of: ${ALLOWED_TOOL_CATEGORIES.join(", ")}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const encodedToolId = encodeURIComponent(toolId);
|
|
67
|
+
return this.client._fetch(
|
|
68
|
+
`/api/v1/tools/${encodedToolId}`,
|
|
69
|
+
{
|
|
70
|
+
method: "PATCH",
|
|
71
|
+
body: JSON.stringify(updates)
|
|
72
|
+
},
|
|
73
|
+
{ retry: false }
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
15
78
|
// src/client/resources/discovery.ts
|
|
16
79
|
var Discovery = class {
|
|
17
80
|
constructor(client) {
|
|
@@ -609,6 +672,10 @@ var ContextClient = class {
|
|
|
609
672
|
requestTimeoutMs;
|
|
610
673
|
streamTimeoutMs;
|
|
611
674
|
_closed = false;
|
|
675
|
+
/**
|
|
676
|
+
* Developer resource for managing tool listings (contributor/developer concerns).
|
|
677
|
+
*/
|
|
678
|
+
developer;
|
|
612
679
|
/**
|
|
613
680
|
* Discovery resource for searching tools
|
|
614
681
|
*/
|
|
@@ -650,6 +717,7 @@ var ContextClient = class {
|
|
|
650
717
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
651
718
|
this.requestTimeoutMs = requestTimeoutMs;
|
|
652
719
|
this.streamTimeoutMs = streamTimeoutMs;
|
|
720
|
+
this.developer = new Developer(this);
|
|
653
721
|
this.discovery = new Discovery(this);
|
|
654
722
|
this.tools = new Tools(this);
|
|
655
723
|
this.query = new Query(this);
|
|
@@ -970,6 +1038,6 @@ function wrapHandshakeResponse(action) {
|
|
|
970
1038
|
};
|
|
971
1039
|
}
|
|
972
1040
|
|
|
973
|
-
export { CONTEXT_REQUIREMENTS_KEY, ContextClient, ContextError, Discovery, META_CONTEXT_REQUIREMENTS_KEY, Query, Tools, createAuthRequired, createContextMiddleware, createSignatureRequest, createTransactionProposal, isAuthRequired, isHandshakeAction, isOpenMcpMethod, isProtectedMcpMethod, isSignatureRequest, isTransactionProposal, verifyContextRequest, wrapHandshakeResponse };
|
|
1041
|
+
export { CONTEXT_REQUIREMENTS_KEY, ContextClient, ContextError, Developer, Discovery, META_CONTEXT_REQUIREMENTS_KEY, Query, Tools, createAuthRequired, createContextMiddleware, createSignatureRequest, createTransactionProposal, isAuthRequired, isHandshakeAction, isOpenMcpMethod, isProtectedMcpMethod, isSignatureRequest, isTransactionProposal, verifyContextRequest, wrapHandshakeResponse };
|
|
974
1042
|
//# sourceMappingURL=index.js.map
|
|
975
1043
|
//# sourceMappingURL=index.js.map
|