@thisispandora/agent-sdk 0.1.0-alpha.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/README.md +229 -0
- package/backends.d.ts +15 -0
- package/backends.js +20 -0
- package/backends.mjs +14 -0
- package/catalog.d.ts +26 -0
- package/catalog.js +24 -0
- package/catalog.mjs +18 -0
- package/errors.d.ts +7 -0
- package/errors.js +13 -0
- package/errors.mjs +7 -0
- package/examples/local-stdio.cjs +22 -0
- package/examples/remote-http.cjs +23 -0
- package/generated/command-descriptors.d.ts +5 -0
- package/generated/command-descriptors.json +18526 -0
- package/generated/command-descriptors.mjs +3 -0
- package/generated/contract-registry.d.ts +5 -0
- package/generated/contract-registry.json +120117 -0
- package/generated/contract-registry.mjs +3 -0
- package/generated/index.d.ts +21 -0
- package/generated/index.js +42 -0
- package/generated/index.mjs +14 -0
- package/generated/manifest.d.ts +5 -0
- package/generated/manifest.json +374 -0
- package/generated/manifest.mjs +3 -0
- package/generated/mcp-tool-definitions.d.ts +5 -0
- package/generated/mcp-tool-definitions.json +37871 -0
- package/generated/mcp-tool-definitions.mjs +3 -0
- package/index.d.ts +401 -0
- package/index.js +757 -0
- package/index.mjs +34 -0
- package/package.json +148 -0
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# @thisispandora/agent-sdk
|
|
2
|
+
|
|
3
|
+
Standalone alpha TypeScript/Node SDK for Pandora's MCP tool interface and generated contract catalog.
|
|
4
|
+
|
|
5
|
+
## Status and delivery
|
|
6
|
+
- primary package identity: `@thisispandora/agent-sdk`
|
|
7
|
+
- generated artifacts ship package-locally under `@thisispandora/agent-sdk/generated`
|
|
8
|
+
- current external distribution path: signed GitHub release asset tarball for the tagged Pandora release
|
|
9
|
+
- repository checkout path: `sdk/typescript` is for maintainers and in-tree development only
|
|
10
|
+
- the Pandora CLI package also vendors a matching copy under `sdk/typescript` and `pandora-cli-skills/sdk/typescript` for parity and in-tree consumers
|
|
11
|
+
- public npm publication is not claimed by this README until a release explicitly says so
|
|
12
|
+
|
|
13
|
+
## What it exposes
|
|
14
|
+
- local stdio MCP execution via `pandora mcp`
|
|
15
|
+
- remote streamable HTTP MCP execution via `pandora mcp http`
|
|
16
|
+
- one generic client surface for tool discovery and tool calls
|
|
17
|
+
- first-class bootstrap helpers so cold agents can start from Pandora's canonical bootstrap contract
|
|
18
|
+
- generated catalog helpers for policy/profile and contract inspection
|
|
19
|
+
- both CommonJS and native Node ESM entrypoints
|
|
20
|
+
|
|
21
|
+
## Install and access
|
|
22
|
+
|
|
23
|
+
Current validated install paths:
|
|
24
|
+
|
|
25
|
+
Preferred for external consumers:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install /path/to/downloaded/thisispandora-agent-sdk-<version>.tgz
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Maintainer and repository-checkout flows:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install ./sdk/typescript
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or build a local tarball from source:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm pack ./sdk/typescript
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Use the signed GitHub release tarball when working outside the repository. Use the repo path only when you intentionally want an in-tree checkout.
|
|
44
|
+
|
|
45
|
+
Node `>=18` is required.
|
|
46
|
+
|
|
47
|
+
Useful package subpaths:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
@thisispandora/agent-sdk
|
|
51
|
+
@thisispandora/agent-sdk/generated
|
|
52
|
+
@thisispandora/agent-sdk/generated/manifest
|
|
53
|
+
@thisispandora/agent-sdk/generated/command-descriptors
|
|
54
|
+
@thisispandora/agent-sdk/generated/mcp-tool-definitions
|
|
55
|
+
@thisispandora/agent-sdk/generated/contract-registry
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Native ESM is supported for the root package and the generated subpaths above.
|
|
59
|
+
|
|
60
|
+
Vendored equivalent inside the Pandora CLI package:
|
|
61
|
+
- `pandora-cli-skills/sdk/typescript`
|
|
62
|
+
- `pandora-cli-skills/sdk/generated`
|
|
63
|
+
|
|
64
|
+
## Quick start
|
|
65
|
+
|
|
66
|
+
Cold agents should start with `bootstrap`, not with low-level `capabilities` or `schema` calls.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const {
|
|
70
|
+
connectPandoraAgentClient,
|
|
71
|
+
loadGeneratedManifest,
|
|
72
|
+
} = require('@thisispandora/agent-sdk');
|
|
73
|
+
|
|
74
|
+
async function main() {
|
|
75
|
+
const client = await connectPandoraAgentClient({
|
|
76
|
+
command: 'pandora',
|
|
77
|
+
args: ['mcp'],
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
const bootstrap = await client.getBootstrap();
|
|
82
|
+
const manifest = loadGeneratedManifest();
|
|
83
|
+
console.log(bootstrap.recommendedBootstrapFlow[0], manifest.commandDescriptorVersion);
|
|
84
|
+
} finally {
|
|
85
|
+
await client.close();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
main().catch((error) => {
|
|
90
|
+
console.error(error);
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Native ESM quick start
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import { connectPandoraAgentClient, loadGeneratedManifest } from '@thisispandora/agent-sdk';
|
|
99
|
+
|
|
100
|
+
const client = await connectPandoraAgentClient({
|
|
101
|
+
command: 'pandora',
|
|
102
|
+
args: ['mcp'],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const bootstrap = await client.getBootstrap();
|
|
107
|
+
const manifest = loadGeneratedManifest();
|
|
108
|
+
console.log(bootstrap.recommendedBootstrapFlow[0], manifest.commandDescriptorVersion);
|
|
109
|
+
} finally {
|
|
110
|
+
await client.close();
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Local vs remote backends
|
|
115
|
+
|
|
116
|
+
Use the generic client factory when you want one entrypoint:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
const {
|
|
120
|
+
createPandoraAgentClient,
|
|
121
|
+
} = require('@thisispandora/agent-sdk');
|
|
122
|
+
|
|
123
|
+
const localClient = createPandoraAgentClient({
|
|
124
|
+
command: 'pandora',
|
|
125
|
+
args: ['mcp'],
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const remoteClient = createPandoraAgentClient({
|
|
129
|
+
mode: 'remote',
|
|
130
|
+
url: 'http://127.0.0.1:8787/mcp',
|
|
131
|
+
authToken: process.env.PANDORA_MCP_TOKEN,
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Backend mapping:
|
|
136
|
+
- local backend:
|
|
137
|
+
- start `pandora mcp`
|
|
138
|
+
- connect over stdio on the same machine
|
|
139
|
+
- no bearer token is involved
|
|
140
|
+
- remote backend:
|
|
141
|
+
- intentionally host `pandora mcp http ...`
|
|
142
|
+
- connect to the `/mcp` endpoint with a bearer token
|
|
143
|
+
- signer material, if any, stays on the gateway runtime
|
|
144
|
+
|
|
145
|
+
## Generated catalog access
|
|
146
|
+
|
|
147
|
+
The root entrypoint already exports the generated helpers:
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
const {
|
|
151
|
+
loadGeneratedContractRegistry,
|
|
152
|
+
loadGeneratedCapabilities,
|
|
153
|
+
inspectToolPolicySurface,
|
|
154
|
+
} = require('@thisispandora/agent-sdk');
|
|
155
|
+
|
|
156
|
+
const registry = loadGeneratedContractRegistry();
|
|
157
|
+
const capabilities = loadGeneratedCapabilities();
|
|
158
|
+
const trade = inspectToolPolicySurface('trade', registry);
|
|
159
|
+
|
|
160
|
+
console.log(capabilities.commandDescriptorVersion);
|
|
161
|
+
console.log(trade.policyScopes);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
If you want the canonical bootstrap payload directly:
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
const { connectPandoraAgentClient } = require('@thisispandora/agent-sdk');
|
|
168
|
+
|
|
169
|
+
async function main() {
|
|
170
|
+
const client = await connectPandoraAgentClient({
|
|
171
|
+
mode: 'remote',
|
|
172
|
+
url: 'http://127.0.0.1:8787/mcp',
|
|
173
|
+
authToken: process.env.PANDORA_MCP_TOKEN,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
const bootstrap = await client.getBootstrap();
|
|
178
|
+
console.log(bootstrap.canonicalTools.length);
|
|
179
|
+
} finally {
|
|
180
|
+
await client.close();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
If you want the raw generated bundle:
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
const generated = require('@thisispandora/agent-sdk/generated');
|
|
189
|
+
|
|
190
|
+
console.log(generated.manifest.packageVersion);
|
|
191
|
+
console.log(Object.keys(generated.contractRegistry.tools).length);
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Native ESM can also import those generated subpaths directly:
|
|
195
|
+
|
|
196
|
+
```js
|
|
197
|
+
import manifest from '@thisispandora/agent-sdk/generated/manifest';
|
|
198
|
+
import contractRegistry from '@thisispandora/agent-sdk/generated/contract-registry';
|
|
199
|
+
|
|
200
|
+
console.log(manifest.packageVersion);
|
|
201
|
+
console.log(Object.keys(contractRegistry.tools).length);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Error handling
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
const {
|
|
208
|
+
PandoraSdkError,
|
|
209
|
+
PandoraToolCallError,
|
|
210
|
+
} = require('@thisispandora/agent-sdk');
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
// tool call
|
|
214
|
+
} catch (error) {
|
|
215
|
+
if (error instanceof PandoraToolCallError) {
|
|
216
|
+
console.error(error.code, error.toolName, error.toolError);
|
|
217
|
+
} else if (error instanceof PandoraSdkError) {
|
|
218
|
+
console.error(error.code, error.details);
|
|
219
|
+
} else {
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Current boundaries
|
|
226
|
+
- this SDK does not bundle the Pandora CLI itself; local stdio usage still needs a `pandora` executable or an explicit `command`/`args` pair
|
|
227
|
+
- remote HTTP usage still requires an operator-hosted `pandora mcp http` gateway and any required bearer token
|
|
228
|
+
- repository checkouts can regenerate the vendored bundle with `npm run generate:sdk-contracts`
|
|
229
|
+
- the Pandora CLI package vendors a matching copy under `sdk/typescript`, but the standalone package is the primary SDK product surface
|
package/backends.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export {
|
|
2
|
+
PandoraAgentClient,
|
|
3
|
+
PandoraMcpBackend,
|
|
4
|
+
PandoraStdioBackend,
|
|
5
|
+
PandoraRemoteBackend,
|
|
6
|
+
createPandoraStdioBackend,
|
|
7
|
+
createPandoraRemoteBackend,
|
|
8
|
+
createLocalPandoraAgentClient,
|
|
9
|
+
createRemotePandoraAgentClient,
|
|
10
|
+
createPandoraAgentClient,
|
|
11
|
+
connectPandoraAgentClient,
|
|
12
|
+
type PandoraAgentClientFactoryOptions,
|
|
13
|
+
type PandoraRemoteBackendOptions,
|
|
14
|
+
type PandoraStdioBackendOptions,
|
|
15
|
+
} from './index';
|
package/backends.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sdk = require('./index.js');
|
|
4
|
+
|
|
5
|
+
const api = {
|
|
6
|
+
PandoraAgentClient: sdk.PandoraAgentClient,
|
|
7
|
+
PandoraMcpBackend: sdk.PandoraMcpBackend,
|
|
8
|
+
PandoraStdioBackend: sdk.PandoraStdioBackend,
|
|
9
|
+
PandoraRemoteBackend: sdk.PandoraRemoteBackend,
|
|
10
|
+
createPandoraStdioBackend: sdk.createPandoraStdioBackend,
|
|
11
|
+
createPandoraRemoteBackend: sdk.createPandoraRemoteBackend,
|
|
12
|
+
createLocalPandoraAgentClient: sdk.createLocalPandoraAgentClient,
|
|
13
|
+
createRemotePandoraAgentClient: sdk.createRemotePandoraAgentClient,
|
|
14
|
+
createPandoraAgentClient: sdk.createPandoraAgentClient,
|
|
15
|
+
connectPandoraAgentClient: sdk.connectPandoraAgentClient,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
api.default = api;
|
|
19
|
+
|
|
20
|
+
module.exports = Object.freeze(api);
|
package/backends.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import api from './backends.js';
|
|
2
|
+
export const {
|
|
3
|
+
PandoraAgentClient,
|
|
4
|
+
PandoraMcpBackend,
|
|
5
|
+
PandoraStdioBackend,
|
|
6
|
+
PandoraRemoteBackend,
|
|
7
|
+
createPandoraStdioBackend,
|
|
8
|
+
createPandoraRemoteBackend,
|
|
9
|
+
createLocalPandoraAgentClient,
|
|
10
|
+
createRemotePandoraAgentClient,
|
|
11
|
+
createPandoraAgentClient,
|
|
12
|
+
connectPandoraAgentClient,
|
|
13
|
+
} = api;
|
|
14
|
+
export default api;
|
package/catalog.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export {
|
|
2
|
+
loadGeneratedContractRegistry,
|
|
3
|
+
loadGeneratedManifest,
|
|
4
|
+
loadGeneratedCommandDescriptors,
|
|
5
|
+
loadGeneratedMcpToolDefinitions,
|
|
6
|
+
loadGeneratedCapabilities,
|
|
7
|
+
loadGeneratedToolCatalog,
|
|
8
|
+
getPolicyProfileCapabilities,
|
|
9
|
+
getPolicyPackCapability,
|
|
10
|
+
getSignerProfileCapability,
|
|
11
|
+
listPolicyScopes,
|
|
12
|
+
listPolicyScopedCommands,
|
|
13
|
+
listSignerProfileCommands,
|
|
14
|
+
inspectPolicyScope,
|
|
15
|
+
inspectToolPolicySurface,
|
|
16
|
+
type PandoraCommandDescriptor,
|
|
17
|
+
type PandoraContractRegistry,
|
|
18
|
+
type PandoraGeneratedManifest,
|
|
19
|
+
type PandoraGeneratedMcpToolDefinition,
|
|
20
|
+
type PandoraPolicyPackCapability,
|
|
21
|
+
type PandoraPolicyProfileCapabilities,
|
|
22
|
+
type PandoraPolicyScopeInspection,
|
|
23
|
+
type PandoraSignerProfileCapability,
|
|
24
|
+
type PandoraToolContract,
|
|
25
|
+
type PandoraToolPolicySurface,
|
|
26
|
+
} from './index';
|
package/catalog.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sdk = require('./index.js');
|
|
4
|
+
|
|
5
|
+
const api = {
|
|
6
|
+
loadGeneratedContractRegistry: sdk.loadGeneratedContractRegistry,
|
|
7
|
+
loadGeneratedManifest: sdk.loadGeneratedManifest,
|
|
8
|
+
loadGeneratedCommandDescriptors: sdk.loadGeneratedCommandDescriptors,
|
|
9
|
+
loadGeneratedMcpToolDefinitions: sdk.loadGeneratedMcpToolDefinitions,
|
|
10
|
+
loadGeneratedCapabilities: sdk.loadGeneratedCapabilities,
|
|
11
|
+
loadGeneratedToolCatalog: sdk.loadGeneratedToolCatalog,
|
|
12
|
+
getPolicyProfileCapabilities: sdk.getPolicyProfileCapabilities,
|
|
13
|
+
getPolicyPackCapability: sdk.getPolicyPackCapability,
|
|
14
|
+
getSignerProfileCapability: sdk.getSignerProfileCapability,
|
|
15
|
+
listPolicyScopes: sdk.listPolicyScopes,
|
|
16
|
+
listPolicyScopedCommands: sdk.listPolicyScopedCommands,
|
|
17
|
+
listSignerProfileCommands: sdk.listSignerProfileCommands,
|
|
18
|
+
inspectPolicyScope: sdk.inspectPolicyScope,
|
|
19
|
+
inspectToolPolicySurface: sdk.inspectToolPolicySurface,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
api.default = api;
|
|
23
|
+
|
|
24
|
+
module.exports = Object.freeze(api);
|
package/catalog.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import api from './catalog.js';
|
|
2
|
+
export const {
|
|
3
|
+
loadGeneratedContractRegistry,
|
|
4
|
+
loadGeneratedManifest,
|
|
5
|
+
loadGeneratedCommandDescriptors,
|
|
6
|
+
loadGeneratedMcpToolDefinitions,
|
|
7
|
+
loadGeneratedCapabilities,
|
|
8
|
+
loadGeneratedToolCatalog,
|
|
9
|
+
getPolicyProfileCapabilities,
|
|
10
|
+
getPolicyPackCapability,
|
|
11
|
+
getSignerProfileCapability,
|
|
12
|
+
listPolicyScopes,
|
|
13
|
+
listPolicyScopedCommands,
|
|
14
|
+
listSignerProfileCommands,
|
|
15
|
+
inspectPolicyScope,
|
|
16
|
+
inspectToolPolicySurface,
|
|
17
|
+
} = api;
|
|
18
|
+
export default api;
|
package/errors.d.ts
ADDED
package/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const sdk = require('./index.js');
|
|
4
|
+
|
|
5
|
+
const api = {
|
|
6
|
+
PandoraSdkError: sdk.PandoraSdkError,
|
|
7
|
+
PandoraToolCallError: sdk.PandoraToolCallError,
|
|
8
|
+
normalizeStructuredEnvelope: sdk.normalizeStructuredEnvelope,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
api.default = api;
|
|
12
|
+
|
|
13
|
+
module.exports = Object.freeze(api);
|
package/errors.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { connectPandoraAgentClient } = require('..');
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
const client = await connectPandoraAgentClient({
|
|
7
|
+
command: 'pandora',
|
|
8
|
+
args: ['mcp'],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const capabilities = await client.callTool('capabilities');
|
|
13
|
+
console.log(capabilities.command, capabilities.data.summary.totalCommands);
|
|
14
|
+
} finally {
|
|
15
|
+
await client.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main().catch((error) => {
|
|
20
|
+
console.error(error);
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { connectPandoraAgentClient } = require('..');
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
const client = await connectPandoraAgentClient({
|
|
7
|
+
mode: 'remote',
|
|
8
|
+
url: process.env.PANDORA_MCP_URL || 'http://127.0.0.1:8787/mcp',
|
|
9
|
+
authToken: process.env.PANDORA_MCP_TOKEN || undefined,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const tools = await client.listTools();
|
|
14
|
+
console.log(`connected to ${tools.length} tools`);
|
|
15
|
+
} finally {
|
|
16
|
+
await client.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
main().catch((error) => {
|
|
21
|
+
console.error(error);
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
});
|