tenzro-sdk 0.1.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/LICENSE +201 -0
- package/README.md +107 -0
- package/dist/agent-payments.d.ts +47 -0
- package/dist/agent-payments.d.ts.map +1 -0
- package/dist/agent-payments.js +76 -0
- package/dist/agent-payments.js.map +1 -0
- package/dist/agent.d.ts +177 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +300 -0
- package/dist/agent.js.map +1 -0
- package/dist/ap2.d.ts +54 -0
- package/dist/ap2.d.ts.map +1 -0
- package/dist/ap2.js +88 -0
- package/dist/ap2.js.map +1 -0
- package/dist/app.d.ts +186 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +317 -0
- package/dist/app.js.map +1 -0
- package/dist/bridge.d.ts +64 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +93 -0
- package/dist/bridge.js.map +1 -0
- package/dist/canton.d.ts +36 -0
- package/dist/canton.d.ts.map +1 -0
- package/dist/canton.js +46 -0
- package/dist/canton.js.map +1 -0
- package/dist/circuit-breaker.d.ts +35 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +53 -0
- package/dist/circuit-breaker.js.map +1 -0
- package/dist/client.d.ts +134 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +265 -0
- package/dist/client.js.map +1 -0
- package/dist/compliance.d.ts +83 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +74 -0
- package/dist/compliance.js.map +1 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +24 -0
- package/dist/config.js.map +1 -0
- package/dist/contract.d.ts +68 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +59 -0
- package/dist/contract.js.map +1 -0
- package/dist/crypto.d.ts +112 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +97 -0
- package/dist/crypto.js.map +1 -0
- package/dist/custody.d.ts +114 -0
- package/dist/custody.d.ts.map +1 -0
- package/dist/custody.js +96 -0
- package/dist/custody.js.map +1 -0
- package/dist/debridge.d.ts +129 -0
- package/dist/debridge.d.ts.map +1 -0
- package/dist/debridge.js +93 -0
- package/dist/debridge.js.map +1 -0
- package/dist/erc7802.d.ts +36 -0
- package/dist/erc7802.d.ts.map +1 -0
- package/dist/erc7802.js +52 -0
- package/dist/erc7802.js.map +1 -0
- package/dist/events.d.ts +112 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +70 -0
- package/dist/events.js.map +1 -0
- package/dist/governance.d.ts +55 -0
- package/dist/governance.d.ts.map +1 -0
- package/dist/governance.js +77 -0
- package/dist/governance.js.map +1 -0
- package/dist/identity.d.ts +102 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +147 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +27 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +43 -0
- package/dist/inference.js.map +1 -0
- package/dist/marketplace.d.ts +44 -0
- package/dist/marketplace.d.ts.map +1 -0
- package/dist/marketplace.js +74 -0
- package/dist/marketplace.js.map +1 -0
- package/dist/nanopayment.d.ts +53 -0
- package/dist/nanopayment.d.ts.map +1 -0
- package/dist/nanopayment.js +81 -0
- package/dist/nanopayment.js.map +1 -0
- package/dist/nft.d.ts +127 -0
- package/dist/nft.d.ts.map +1 -0
- package/dist/nft.js +99 -0
- package/dist/nft.js.map +1 -0
- package/dist/payment.d.ts +71 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +105 -0
- package/dist/payment.js.map +1 -0
- package/dist/provider.d.ts +351 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +368 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc.d.ts +35 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +127 -0
- package/dist/rpc.js.map +1 -0
- package/dist/settlement.d.ts +52 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +86 -0
- package/dist/settlement.js.map +1 -0
- package/dist/skill.d.ts +55 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +79 -0
- package/dist/skill.js.map +1 -0
- package/dist/staking.d.ts +42 -0
- package/dist/staking.d.ts.map +1 -0
- package/dist/staking.js +62 -0
- package/dist/staking.js.map +1 -0
- package/dist/streaming.d.ts +83 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +193 -0
- package/dist/streaming.js.map +1 -0
- package/dist/task.d.ts +46 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +76 -0
- package/dist/task.js.map +1 -0
- package/dist/tee.d.ts +88 -0
- package/dist/tee.d.ts.map +1 -0
- package/dist/tee.js +62 -0
- package/dist/tee.js.map +1 -0
- package/dist/token.d.ts +165 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +80 -0
- package/dist/token.js.map +1 -0
- package/dist/tool.d.ts +55 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +79 -0
- package/dist/tool.js.map +1 -0
- package/dist/types.d.ts +1318 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +117 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet.d.ts +44 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +75 -0
- package/dist/wallet.js.map +1 -0
- package/dist/zk.d.ts +66 -0
- package/dist/zk.d.ts.map +1 -0
- package/dist/zk.js +58 -0
- package/dist/zk.js.map +1 -0
- package/package.json +41 -0
package/dist/task.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
import type { TaskInfo, TaskQuote, TaskFilter, PostTaskParams, AssignTaskResult, CompleteTaskResult } from './types';
|
|
3
|
+
export declare class TaskClient {
|
|
4
|
+
private readonly rpc;
|
|
5
|
+
constructor(rpc: RpcClient);
|
|
6
|
+
postTask(params: PostTaskParams): Promise<TaskInfo>;
|
|
7
|
+
listTasks(filter?: TaskFilter): Promise<TaskInfo[]>;
|
|
8
|
+
getTask(taskId: string): Promise<TaskInfo>;
|
|
9
|
+
cancelTask(taskId: string): Promise<boolean>;
|
|
10
|
+
submitQuote(taskId: string, price: string, modelId: string, estimatedDurationSecs: number): Promise<TaskQuote>;
|
|
11
|
+
/**
|
|
12
|
+
* Submit a quote for a task with price and estimated completion time.
|
|
13
|
+
* @param taskId - The task to quote
|
|
14
|
+
* @param price - Quoted price (in TNZO wei)
|
|
15
|
+
* @param estimatedTime - Estimated completion time (e.g., "120s", "5m", "1h")
|
|
16
|
+
* @returns Quote result
|
|
17
|
+
*/
|
|
18
|
+
quoteTask(taskId: string, price: number, estimatedTime: string): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Assign a task to a specific agent.
|
|
21
|
+
* @param taskId - The task to assign
|
|
22
|
+
* @param agentId - The agent to assign it to
|
|
23
|
+
* @returns Assignment result with status
|
|
24
|
+
*/
|
|
25
|
+
assignTask(taskId: string, agentId: string): Promise<AssignTaskResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Mark a task as completed with the final result.
|
|
28
|
+
* @param taskId - The task to complete
|
|
29
|
+
* @param result - The output / result of the task
|
|
30
|
+
* @returns Completion result with status and optional settlement tx hash
|
|
31
|
+
*/
|
|
32
|
+
completeTask(taskId: string, result: string): Promise<CompleteTaskResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Update an existing task.
|
|
35
|
+
* @param taskId - The task to update
|
|
36
|
+
* @param options - Fields to update (partial)
|
|
37
|
+
* @returns Updated task information
|
|
38
|
+
*/
|
|
39
|
+
updateTask(taskId: string, options?: {
|
|
40
|
+
title?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
status?: string;
|
|
43
|
+
output?: string;
|
|
44
|
+
}): Promise<any>;
|
|
45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AAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GACA,OAAO,CAAC,GAAG,CAAC;CAKhB"}
|
package/dist/task.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskClient = void 0;
|
|
4
|
+
class TaskClient {
|
|
5
|
+
rpc;
|
|
6
|
+
constructor(rpc) {
|
|
7
|
+
this.rpc = rpc;
|
|
8
|
+
}
|
|
9
|
+
async postTask(params) {
|
|
10
|
+
return this.rpc.call('tenzro_postTask', [params]);
|
|
11
|
+
}
|
|
12
|
+
async listTasks(filter) {
|
|
13
|
+
return this.rpc.call('tenzro_listTasks', [filter ?? {}]);
|
|
14
|
+
}
|
|
15
|
+
async getTask(taskId) {
|
|
16
|
+
return this.rpc.call('tenzro_getTask', [{ task_id: taskId }]);
|
|
17
|
+
}
|
|
18
|
+
async cancelTask(taskId) {
|
|
19
|
+
return this.rpc.call('tenzro_cancelTask', [{ task_id: taskId }]);
|
|
20
|
+
}
|
|
21
|
+
async submitQuote(taskId, price, modelId, estimatedDurationSecs) {
|
|
22
|
+
return this.rpc.call('tenzro_submitQuote', [{
|
|
23
|
+
task_id: taskId,
|
|
24
|
+
price,
|
|
25
|
+
model_id: modelId,
|
|
26
|
+
estimated_duration_secs: estimatedDurationSecs,
|
|
27
|
+
}]);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Submit a quote for a task with price and estimated completion time.
|
|
31
|
+
* @param taskId - The task to quote
|
|
32
|
+
* @param price - Quoted price (in TNZO wei)
|
|
33
|
+
* @param estimatedTime - Estimated completion time (e.g., "120s", "5m", "1h")
|
|
34
|
+
* @returns Quote result
|
|
35
|
+
*/
|
|
36
|
+
async quoteTask(taskId, price, estimatedTime) {
|
|
37
|
+
return this.rpc.call('tenzro_quoteTask', [
|
|
38
|
+
{ task_id: taskId, price, estimated_time: estimatedTime },
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Assign a task to a specific agent.
|
|
43
|
+
* @param taskId - The task to assign
|
|
44
|
+
* @param agentId - The agent to assign it to
|
|
45
|
+
* @returns Assignment result with status
|
|
46
|
+
*/
|
|
47
|
+
async assignTask(taskId, agentId) {
|
|
48
|
+
return this.rpc.call('tenzro_assignTask', [
|
|
49
|
+
{ task_id: taskId, agent_id: agentId },
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mark a task as completed with the final result.
|
|
54
|
+
* @param taskId - The task to complete
|
|
55
|
+
* @param result - The output / result of the task
|
|
56
|
+
* @returns Completion result with status and optional settlement tx hash
|
|
57
|
+
*/
|
|
58
|
+
async completeTask(taskId, result) {
|
|
59
|
+
return this.rpc.call('tenzro_completeTask', [
|
|
60
|
+
{ task_id: taskId, result },
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Update an existing task.
|
|
65
|
+
* @param taskId - The task to update
|
|
66
|
+
* @param options - Fields to update (partial)
|
|
67
|
+
* @returns Updated task information
|
|
68
|
+
*/
|
|
69
|
+
async updateTask(taskId, options) {
|
|
70
|
+
return this.rpc.call('tenzro_updateTask', [
|
|
71
|
+
{ task_id: taskId, ...options },
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.TaskClient = TaskClient;
|
|
76
|
+
//# sourceMappingURL=task.js.map
|
package/dist/task.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IACQ;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C,KA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CAAmB,mBAAmB,EAAE;YAC1D,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc,EAAE,MAAc;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,qBAAqB,EAAE;YAC9D,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CACd,MAAc,EACd,OAKC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE;YACxC,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;CACF;AA7FD,gCA6FC"}
|
package/dist/tee.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/** TEE hardware information. */
|
|
3
|
+
export interface TeeInfo {
|
|
4
|
+
/** Whether TEE hardware is available */
|
|
5
|
+
available: boolean;
|
|
6
|
+
/** TEE vendor name (e.g., "intel-tdx", "amd-sev-snp", "aws-nitro", "nvidia-gpu") */
|
|
7
|
+
vendor: string;
|
|
8
|
+
/** List of TEE capabilities */
|
|
9
|
+
capabilities: string[];
|
|
10
|
+
}
|
|
11
|
+
/** TEE attestation report. */
|
|
12
|
+
export interface AttestationResult {
|
|
13
|
+
/** Hex-encoded attestation report */
|
|
14
|
+
report: string;
|
|
15
|
+
/** Hex-encoded signature over the report */
|
|
16
|
+
signature: string;
|
|
17
|
+
/** X.509 certificate chain */
|
|
18
|
+
certificate_chain: string[];
|
|
19
|
+
}
|
|
20
|
+
/** TEE attestation verification result. */
|
|
21
|
+
export interface TeeVerifyResult {
|
|
22
|
+
/** Whether the attestation is valid */
|
|
23
|
+
valid: boolean;
|
|
24
|
+
/** Verification details */
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Data sealed within a TEE enclave. */
|
|
28
|
+
export interface SealedData {
|
|
29
|
+
/** Hex-encoded sealed ciphertext */
|
|
30
|
+
ciphertext: string;
|
|
31
|
+
/** Key identifier used for sealing */
|
|
32
|
+
key_id: string;
|
|
33
|
+
}
|
|
34
|
+
/** Unsealed plaintext data. */
|
|
35
|
+
export interface UnsealedData {
|
|
36
|
+
/** Hex-encoded plaintext data */
|
|
37
|
+
data: string;
|
|
38
|
+
}
|
|
39
|
+
/** TEE provider on the network. */
|
|
40
|
+
export interface TeeProvider {
|
|
41
|
+
/** Provider address (hex) */
|
|
42
|
+
address: string;
|
|
43
|
+
/** TEE vendor type */
|
|
44
|
+
vendor: string;
|
|
45
|
+
/** Whether the provider is currently available */
|
|
46
|
+
available: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Client for Trusted Execution Environment operations.
|
|
50
|
+
*
|
|
51
|
+
* Supports Intel TDX, AMD SEV-SNP, AWS Nitro, and NVIDIA GPU TEE providers.
|
|
52
|
+
*/
|
|
53
|
+
export declare class TeeClient {
|
|
54
|
+
private readonly rpc;
|
|
55
|
+
constructor(rpc: RpcClient);
|
|
56
|
+
/**
|
|
57
|
+
* Detect available TEE hardware on the node.
|
|
58
|
+
*/
|
|
59
|
+
detectTee(): Promise<TeeInfo>;
|
|
60
|
+
/**
|
|
61
|
+
* Generate a TEE attestation report.
|
|
62
|
+
* @param teeType - TEE type: "intel-tdx", "amd-sev-snp", "aws-nitro", "nvidia-gpu"
|
|
63
|
+
*/
|
|
64
|
+
getAttestation(teeType: string): Promise<AttestationResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Verify a TEE attestation report with full certificate chain verification.
|
|
67
|
+
* @param attestation - Hex-encoded attestation report
|
|
68
|
+
* @param teeType - TEE type used to generate the attestation
|
|
69
|
+
*/
|
|
70
|
+
verifyAttestation(attestation: string, teeType: string): Promise<TeeVerifyResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Seal data within a TEE enclave (encrypted with hardware-derived key).
|
|
73
|
+
* @param data - Hex-encoded data to seal
|
|
74
|
+
* @param keyId - Key identifier for the sealing key
|
|
75
|
+
*/
|
|
76
|
+
sealData(data: string, keyId: string): Promise<SealedData>;
|
|
77
|
+
/**
|
|
78
|
+
* Unseal TEE-protected data.
|
|
79
|
+
* @param sealed - Hex-encoded sealed ciphertext
|
|
80
|
+
* @param keyId - Key identifier used during sealing
|
|
81
|
+
*/
|
|
82
|
+
unsealData(sealed: string, keyId: string): Promise<UnsealedData>;
|
|
83
|
+
/**
|
|
84
|
+
* List available TEE providers on the network.
|
|
85
|
+
*/
|
|
86
|
+
listTeeProviders(): Promise<TeeProvider[]>;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=tee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tee.d.ts","sourceRoot":"","sources":["../src/tee.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,gCAAgC;AAChC,MAAM,WAAW,OAAO;IACtB,wCAAwC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,8BAA8B;AAC9B,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+BAA+B;AAC/B,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB;AAID;;;;GAIG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;;OAGG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIjE;;;;OAIG;IACG,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAMvF;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhE;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAItE;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAGjD"}
|
package/dist/tee.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeeClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Client for Trusted Execution Environment operations.
|
|
7
|
+
*
|
|
8
|
+
* Supports Intel TDX, AMD SEV-SNP, AWS Nitro, and NVIDIA GPU TEE providers.
|
|
9
|
+
*/
|
|
10
|
+
class TeeClient {
|
|
11
|
+
rpc;
|
|
12
|
+
constructor(rpc) {
|
|
13
|
+
this.rpc = rpc;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Detect available TEE hardware on the node.
|
|
17
|
+
*/
|
|
18
|
+
async detectTee() {
|
|
19
|
+
return this.rpc.call('tenzro_detectTee');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate a TEE attestation report.
|
|
23
|
+
* @param teeType - TEE type: "intel-tdx", "amd-sev-snp", "aws-nitro", "nvidia-gpu"
|
|
24
|
+
*/
|
|
25
|
+
async getAttestation(teeType) {
|
|
26
|
+
return this.rpc.call('tenzro_getAttestation', [{ tee_type: teeType }]);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Verify a TEE attestation report with full certificate chain verification.
|
|
30
|
+
* @param attestation - Hex-encoded attestation report
|
|
31
|
+
* @param teeType - TEE type used to generate the attestation
|
|
32
|
+
*/
|
|
33
|
+
async verifyAttestation(attestation, teeType) {
|
|
34
|
+
return this.rpc.call('tenzro_verifyTeeAttestation', [
|
|
35
|
+
{ attestation, tee_type: teeType },
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Seal data within a TEE enclave (encrypted with hardware-derived key).
|
|
40
|
+
* @param data - Hex-encoded data to seal
|
|
41
|
+
* @param keyId - Key identifier for the sealing key
|
|
42
|
+
*/
|
|
43
|
+
async sealData(data, keyId) {
|
|
44
|
+
return this.rpc.call('tenzro_sealData', [{ data, key_id: keyId }]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Unseal TEE-protected data.
|
|
48
|
+
* @param sealed - Hex-encoded sealed ciphertext
|
|
49
|
+
* @param keyId - Key identifier used during sealing
|
|
50
|
+
*/
|
|
51
|
+
async unsealData(sealed, keyId) {
|
|
52
|
+
return this.rpc.call('tenzro_unsealData', [{ sealed, key_id: keyId }]);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* List available TEE providers on the network.
|
|
56
|
+
*/
|
|
57
|
+
async listTeeProviders() {
|
|
58
|
+
return this.rpc.call('tenzro_listTeeProviders');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TeeClient = TeeClient;
|
|
62
|
+
//# sourceMappingURL=tee.js.map
|
package/dist/tee.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tee.js","sourceRoot":"","sources":["../src/tee.ts"],"names":[],"mappings":";;;AAwDA,eAAe;AAEf;;;;GAIG;AACH,MAAa,SAAS;IACS;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAU,kBAAkB,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,OAAe;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,uBAAuB,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,WAAmB,EAAE,OAAe;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAkB,6BAA6B,EAAE;YACnE,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,KAAa;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAa,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,KAAa;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,mBAAmB,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACvF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,yBAAyB,CAAC,CAAC;IACjE,CAAC;CACF;AArDD,8BAqDC"}
|
package/dist/token.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/**
|
|
3
|
+
* The deterministic CREATE2 address of the wTNZO ERC-20 pointer contract on EVM.
|
|
4
|
+
* All VMs (EVM, SVM, DAML) share the same underlying native TNZO balance via
|
|
5
|
+
* the Sei V2 pointer model -- this address is the EVM representation.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WTNZO_EVM_ADDRESS = "0x7a4bcb13a6b2b384c284b5caa6e5ef3126527f93";
|
|
8
|
+
/** Parameters for creating a new token via the factory. */
|
|
9
|
+
export interface CreateTokenParams {
|
|
10
|
+
/** Token name (e.g. "Tenzro Rewards") */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Token ticker symbol (e.g. "TRW") */
|
|
13
|
+
symbol: string;
|
|
14
|
+
/** Number of decimals (default: 18) */
|
|
15
|
+
decimals?: number;
|
|
16
|
+
/** Initial supply as a decimal string (e.g. "1000000") */
|
|
17
|
+
initial_supply: string;
|
|
18
|
+
/** Creator address */
|
|
19
|
+
creator: string;
|
|
20
|
+
/** Target VM: "evm", "svm", or "daml" */
|
|
21
|
+
vm_type?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Parameters for looking up a token. */
|
|
24
|
+
export interface GetTokenInfoParams {
|
|
25
|
+
/** Token symbol (e.g. "TNZO") */
|
|
26
|
+
symbol?: string;
|
|
27
|
+
/** EVM contract address */
|
|
28
|
+
address?: string;
|
|
29
|
+
/** Unified token ID */
|
|
30
|
+
token_id?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Parameters for listing tokens. */
|
|
33
|
+
export interface ListTokensParams {
|
|
34
|
+
/** Filter by VM type: "evm", "svm", "daml" */
|
|
35
|
+
vm_type?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Parameters for a cross-VM token transfer. */
|
|
38
|
+
export interface CrossVmTransferParams {
|
|
39
|
+
/** Sender address */
|
|
40
|
+
from: string;
|
|
41
|
+
/** Recipient address */
|
|
42
|
+
to: string;
|
|
43
|
+
/** Amount as a decimal string */
|
|
44
|
+
amount: string;
|
|
45
|
+
/** Source VM: "evm", "svm", or "daml" */
|
|
46
|
+
from_vm: string;
|
|
47
|
+
/** Destination VM: "evm", "svm", or "daml" */
|
|
48
|
+
to_vm: string;
|
|
49
|
+
/** Token symbol (default: "TNZO") */
|
|
50
|
+
token?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Information about a registered token. */
|
|
53
|
+
export interface TokenInfo {
|
|
54
|
+
/** Unique token identifier */
|
|
55
|
+
token_id: string;
|
|
56
|
+
/** Token name */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Token symbol */
|
|
59
|
+
symbol: string;
|
|
60
|
+
/** Number of decimals */
|
|
61
|
+
decimals: number;
|
|
62
|
+
/** Total supply as a decimal string */
|
|
63
|
+
total_supply: string;
|
|
64
|
+
/** Creator address */
|
|
65
|
+
creator: string;
|
|
66
|
+
/** VM type the token was deployed on */
|
|
67
|
+
vm_type: string;
|
|
68
|
+
/** EVM contract address (if applicable) */
|
|
69
|
+
evm_address?: string;
|
|
70
|
+
/** Transaction hash of the creation */
|
|
71
|
+
tx_hash?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Result of listing tokens. */
|
|
74
|
+
export interface TokenListResult {
|
|
75
|
+
/** Array of registered tokens */
|
|
76
|
+
tokens: TokenInfo[];
|
|
77
|
+
/** Total number of tokens matching the filter */
|
|
78
|
+
total: number;
|
|
79
|
+
}
|
|
80
|
+
/** Token balance across VMs. */
|
|
81
|
+
export interface TokenBalance {
|
|
82
|
+
/** Address queried */
|
|
83
|
+
address: string;
|
|
84
|
+
/** Token symbol */
|
|
85
|
+
token: string;
|
|
86
|
+
/** Total balance as a decimal string */
|
|
87
|
+
balance: string;
|
|
88
|
+
/** Per-VM breakdown */
|
|
89
|
+
balances?: Record<string, string>;
|
|
90
|
+
}
|
|
91
|
+
/** Result of wrapping native TNZO into a VM representation. */
|
|
92
|
+
export interface WrapResult {
|
|
93
|
+
/** Transaction hash */
|
|
94
|
+
tx_hash: string;
|
|
95
|
+
/** Wrapped amount as a decimal string */
|
|
96
|
+
amount: string;
|
|
97
|
+
/** Target VM */
|
|
98
|
+
vm_type: string;
|
|
99
|
+
/** Status */
|
|
100
|
+
status: string;
|
|
101
|
+
}
|
|
102
|
+
/** Result of a cross-VM transfer. */
|
|
103
|
+
export interface TransferResult {
|
|
104
|
+
/** Transaction hash */
|
|
105
|
+
tx_hash: string;
|
|
106
|
+
/** Transferred amount as a decimal string */
|
|
107
|
+
amount: string;
|
|
108
|
+
/** Source VM */
|
|
109
|
+
from_vm: string;
|
|
110
|
+
/** Destination VM */
|
|
111
|
+
to_vm: string;
|
|
112
|
+
/** Status */
|
|
113
|
+
status: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Client for token registry and cross-VM token operations.
|
|
117
|
+
* Supports creating ERC-20 tokens, querying the unified registry,
|
|
118
|
+
* wrapping native TNZO, and atomic cross-VM transfers.
|
|
119
|
+
*/
|
|
120
|
+
export declare class TokenClient {
|
|
121
|
+
private readonly rpc;
|
|
122
|
+
constructor(rpc: RpcClient);
|
|
123
|
+
/**
|
|
124
|
+
* Create a new ERC-20 token via the factory and register it
|
|
125
|
+
* in the unified token registry.
|
|
126
|
+
* @param params - Token creation parameters
|
|
127
|
+
* @returns Information about the newly created token
|
|
128
|
+
*/
|
|
129
|
+
createToken(params: CreateTokenParams): Promise<TokenInfo>;
|
|
130
|
+
/**
|
|
131
|
+
* Look up a token by symbol, EVM address, or token ID.
|
|
132
|
+
* @param params - At least one of symbol, address, or token_id
|
|
133
|
+
* @returns Token information
|
|
134
|
+
*/
|
|
135
|
+
getTokenInfo(params: GetTokenInfoParams): Promise<TokenInfo>;
|
|
136
|
+
/**
|
|
137
|
+
* List registered tokens with an optional VM type filter.
|
|
138
|
+
* @param params - Optional filter parameters
|
|
139
|
+
* @returns List of tokens
|
|
140
|
+
*/
|
|
141
|
+
listTokens(params?: ListTokensParams): Promise<TokenListResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Get TNZO balance across all VMs with decimal conversion.
|
|
144
|
+
* @param address - Address to query
|
|
145
|
+
* @param token - Token symbol (default: "TNZO")
|
|
146
|
+
* @returns Token balance with optional per-VM breakdown
|
|
147
|
+
*/
|
|
148
|
+
getTokenBalance(address: string, token?: string): Promise<TokenBalance>;
|
|
149
|
+
/**
|
|
150
|
+
* Wrap native TNZO to a VM-specific representation.
|
|
151
|
+
* In the pointer model this is a no-op that returns the same balance.
|
|
152
|
+
* @param address - Address performing the wrap
|
|
153
|
+
* @param amount - Amount to wrap as a decimal string
|
|
154
|
+
* @param toVm - Target VM: "evm", "svm", or "daml"
|
|
155
|
+
* @returns Wrap result
|
|
156
|
+
*/
|
|
157
|
+
wrapTnzo(address: string, amount: string, toVm: string): Promise<WrapResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Perform an atomic cross-VM token transfer using the pointer model.
|
|
160
|
+
* @param params - Transfer parameters
|
|
161
|
+
* @returns Transfer result
|
|
162
|
+
*/
|
|
163
|
+
crossVmTransfer(params: CrossVmTransferParams): Promise<TransferResult>;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEv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,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;IAIhE;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;IAIlE;;;;OAIG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIrE;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAM7E;;;;;;;OAOG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAMlF;;;;OAIG;IACG,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;CAG9E"}
|
package/dist/token.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenClient = exports.WTNZO_EVM_ADDRESS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The deterministic CREATE2 address of the wTNZO ERC-20 pointer contract on EVM.
|
|
6
|
+
* All VMs (EVM, SVM, DAML) share the same underlying native TNZO balance via
|
|
7
|
+
* the Sei V2 pointer model -- this address is the EVM representation.
|
|
8
|
+
*/
|
|
9
|
+
exports.WTNZO_EVM_ADDRESS = '0x7a4bcb13a6b2b384c284b5caa6e5ef3126527f93';
|
|
10
|
+
// ── Client ──
|
|
11
|
+
/**
|
|
12
|
+
* Client for token registry and cross-VM token operations.
|
|
13
|
+
* Supports creating ERC-20 tokens, querying the unified registry,
|
|
14
|
+
* wrapping native TNZO, and atomic cross-VM transfers.
|
|
15
|
+
*/
|
|
16
|
+
class TokenClient {
|
|
17
|
+
rpc;
|
|
18
|
+
constructor(rpc) {
|
|
19
|
+
this.rpc = rpc;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a new ERC-20 token via the factory and register it
|
|
23
|
+
* in the unified token registry.
|
|
24
|
+
* @param params - Token creation parameters
|
|
25
|
+
* @returns Information about the newly created token
|
|
26
|
+
*/
|
|
27
|
+
async createToken(params) {
|
|
28
|
+
return this.rpc.call('tenzro_createToken', [params]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Look up a token by symbol, EVM address, or token ID.
|
|
32
|
+
* @param params - At least one of symbol, address, or token_id
|
|
33
|
+
* @returns Token information
|
|
34
|
+
*/
|
|
35
|
+
async getTokenInfo(params) {
|
|
36
|
+
return this.rpc.call('tenzro_getToken', [params]);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List registered tokens with an optional VM type filter.
|
|
40
|
+
* @param params - Optional filter parameters
|
|
41
|
+
* @returns List of tokens
|
|
42
|
+
*/
|
|
43
|
+
async listTokens(params) {
|
|
44
|
+
return this.rpc.call('tenzro_listTokens', [params ?? {}]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get TNZO balance across all VMs with decimal conversion.
|
|
48
|
+
* @param address - Address to query
|
|
49
|
+
* @param token - Token symbol (default: "TNZO")
|
|
50
|
+
* @returns Token balance with optional per-VM breakdown
|
|
51
|
+
*/
|
|
52
|
+
async getTokenBalance(address, token) {
|
|
53
|
+
return this.rpc.call('tenzro_getTokenBalance', [
|
|
54
|
+
{ address, token: token ?? 'TNZO' },
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Wrap native TNZO to a VM-specific representation.
|
|
59
|
+
* In the pointer model this is a no-op that returns the same balance.
|
|
60
|
+
* @param address - Address performing the wrap
|
|
61
|
+
* @param amount - Amount to wrap as a decimal string
|
|
62
|
+
* @param toVm - Target VM: "evm", "svm", or "daml"
|
|
63
|
+
* @returns Wrap result
|
|
64
|
+
*/
|
|
65
|
+
async wrapTnzo(address, amount, toVm) {
|
|
66
|
+
return this.rpc.call('tenzro_wrapTnzo', [
|
|
67
|
+
{ address, amount, vm_type: toVm },
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Perform an atomic cross-VM token transfer using the pointer model.
|
|
72
|
+
* @param params - Transfer parameters
|
|
73
|
+
* @returns Transfer result
|
|
74
|
+
*/
|
|
75
|
+
async crossVmTransfer(params) {
|
|
76
|
+
return this.rpc.call('tenzro_crossVmTransfer', [params]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.TokenClient = TokenClient;
|
|
80
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,4CAA4C,CAAC;AA0H9E,eAAe;AAEf;;;;GAIG;AACH,MAAa,WAAW;IACO;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,iBAAiB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,MAAyB;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAkB,mBAAmB,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,KAAc;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,wBAAwB,EAAE;YAC3D,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAe,EAAE,MAAc,EAAE,IAAY;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAa,iBAAiB,EAAE;YAClD,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,wBAAwB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF;AAjED,kCAiEC"}
|
package/dist/tool.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
import type { ToolInfo, ToolFilter, RegisterToolParams, UpdateToolParams, ToolExecutionResult, ToolUsage } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Client for the Tenzro Tool Registry.
|
|
5
|
+
* Register, discover, and invoke MCP-compatible tools on the network.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ToolClient {
|
|
8
|
+
private readonly rpc;
|
|
9
|
+
constructor(rpc: RpcClient);
|
|
10
|
+
/**
|
|
11
|
+
* Register a new tool in the registry.
|
|
12
|
+
* @param params - Tool definition including name, description, version, and type
|
|
13
|
+
* @returns The registered tool
|
|
14
|
+
*/
|
|
15
|
+
registerTool(params: RegisterToolParams): Promise<ToolInfo>;
|
|
16
|
+
/**
|
|
17
|
+
* List tools with optional filtering.
|
|
18
|
+
* @param filter - Optional filter criteria (tool_type, category, tag, etc.)
|
|
19
|
+
* @returns Array of matching tools
|
|
20
|
+
*/
|
|
21
|
+
listTools(filter?: ToolFilter): Promise<ToolInfo[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Search tools by free-text query.
|
|
24
|
+
* @param query - Search query string
|
|
25
|
+
* @returns Array of matching tools ranked by relevance
|
|
26
|
+
*/
|
|
27
|
+
searchTools(query: string): Promise<ToolInfo[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Execute a tool with the given input.
|
|
30
|
+
* @param toolId - The tool to invoke
|
|
31
|
+
* @param input - Input payload (JSON-serializable string or object)
|
|
32
|
+
* @returns Execution result with output and duration
|
|
33
|
+
*/
|
|
34
|
+
useTool(toolId: string, input: string): Promise<ToolExecutionResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Get a tool by ID.
|
|
37
|
+
* @param toolId - The tool identifier
|
|
38
|
+
* @returns Tool information
|
|
39
|
+
*/
|
|
40
|
+
getTool(toolId: string): Promise<ToolInfo>;
|
|
41
|
+
/**
|
|
42
|
+
* Update an existing tool (must be the creator).
|
|
43
|
+
* @param toolId - The tool to update
|
|
44
|
+
* @param params - Fields to update (partial)
|
|
45
|
+
* @returns Updated tool
|
|
46
|
+
*/
|
|
47
|
+
updateTool(toolId: string, params: UpdateToolParams): Promise<ToolInfo>;
|
|
48
|
+
/**
|
|
49
|
+
* Get usage statistics for a tool.
|
|
50
|
+
* @param toolId - The tool identifier
|
|
51
|
+
* @returns Usage statistics including total invocations and last used timestamp
|
|
52
|
+
*/
|
|
53
|
+
getToolUsage(toolId: string): Promise<ToolUsage>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIjE;;;;OAIG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIzD;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIrD;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAM1E;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIhD;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAM7E;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAKvD"}
|