crewpay-rest 0.2.0 → 0.2.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 +2 -2
- package/dist/client.d.ts +7 -7
- package/dist/client.js +9 -13
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Shared CrewPay REST client for framework plugins.
|
|
4
4
|
|
|
5
|
-
- Dry-run returns `dryRunId` + `approvalUrl`
|
|
5
|
+
- Approval is optional. Operators can require human approval per key. Dry-run returns `dryRunId` + `approvalUrl` when used
|
|
6
6
|
- Operator opens `approvalUrl` and wallet-signs
|
|
7
|
-
- `launch` / `wireFees
|
|
7
|
+
- `launch` / `wireFees`: dryRunId optional unless requireApproval
|
|
8
8
|
|
|
9
9
|
Prefer MCP: `npx -y crewpay-mcp@1.2.3`
|
package/dist/client.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Minimal CrewPay REST client for framework plugins.
|
|
3
3
|
* Keys from env only — never accept private keys as function arguments.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Approval is optional. Operators can require human approval per key.
|
|
6
|
+
* When requireApproval is off (default), launch/wire work with the API key alone.
|
|
7
|
+
* dryRunId is optional; when sent it is validated. Image content is bound by sha256 when dry-running.
|
|
8
8
|
*/
|
|
9
9
|
export declare const DEFAULT_API_URL = "https://api.crewpay.dev";
|
|
10
10
|
export type CrewPayEnv = {
|
|
@@ -30,8 +30,8 @@ export declare class CrewPayClient {
|
|
|
30
30
|
autohire(body: Record<string, unknown>): Promise<unknown>;
|
|
31
31
|
/** Server dry-run — returns plan + dryRunId + approvalUrl (no approve secret). */
|
|
32
32
|
dryRun(body: Record<string, unknown>): Promise<unknown>;
|
|
33
|
-
launch(body: Record<string, unknown>, opts
|
|
34
|
-
dryRunId
|
|
33
|
+
launch(body: Record<string, unknown>, opts?: {
|
|
34
|
+
dryRunId?: string;
|
|
35
35
|
}): Promise<unknown>;
|
|
36
36
|
wireFees(body: {
|
|
37
37
|
mint: string;
|
|
@@ -39,8 +39,8 @@ export declare class CrewPayClient {
|
|
|
39
39
|
crew?: unknown[];
|
|
40
40
|
name?: string;
|
|
41
41
|
ticker?: string;
|
|
42
|
-
}, opts
|
|
43
|
-
dryRunId
|
|
42
|
+
}, opts?: {
|
|
43
|
+
dryRunId?: string;
|
|
44
44
|
}): Promise<unknown>;
|
|
45
45
|
crank(body: {
|
|
46
46
|
mint: string;
|
package/dist/client.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Minimal CrewPay REST client for framework plugins.
|
|
3
3
|
* Keys from env only — never accept private keys as function arguments.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Approval is optional. Operators can require human approval per key.
|
|
6
|
+
* When requireApproval is off (default), launch/wire work with the API key alone.
|
|
7
|
+
* dryRunId is optional; when sent it is validated. Image content is bound by sha256 when dry-running.
|
|
8
8
|
*/
|
|
9
9
|
export const DEFAULT_API_URL = 'https://api.crewpay.dev';
|
|
10
10
|
export function loadCrewPayEnv(overrides = {}) {
|
|
@@ -83,27 +83,23 @@ export class CrewPayClient {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
launch(body, opts) {
|
|
86
|
-
const dryRunId = String(opts
|
|
87
|
-
|
|
88
|
-
throw new Error('Launch blocked: dryRunId required — dry-run, operator wallet-approves on approvalUrl, then launch');
|
|
89
|
-
}
|
|
86
|
+
const dryRunId = String(opts?.dryRunId || '').trim();
|
|
87
|
+
const payload = dryRunId ? { ...body, dryRunId } : { ...body };
|
|
90
88
|
return this.fetch('/api/agent/launch', {
|
|
91
89
|
method: 'POST',
|
|
92
90
|
auth: true,
|
|
93
91
|
launcher: true,
|
|
94
|
-
body: JSON.stringify(
|
|
92
|
+
body: JSON.stringify(payload),
|
|
95
93
|
});
|
|
96
94
|
}
|
|
97
95
|
wireFees(body, opts) {
|
|
98
|
-
const dryRunId = String(opts
|
|
99
|
-
|
|
100
|
-
throw new Error('Wire-fees blocked: dryRunId required — dry-run with intent=wire-fees, wallet-approve, then wire');
|
|
101
|
-
}
|
|
96
|
+
const dryRunId = String(opts?.dryRunId || '').trim();
|
|
97
|
+
const payload = dryRunId ? { ...body, dryRunId } : { ...body };
|
|
102
98
|
return this.fetch('/api/agent/wire-fees', {
|
|
103
99
|
method: 'POST',
|
|
104
100
|
auth: true,
|
|
105
101
|
launcher: true,
|
|
106
|
-
body: JSON.stringify(
|
|
102
|
+
body: JSON.stringify(payload),
|
|
107
103
|
});
|
|
108
104
|
}
|
|
109
105
|
crank(body) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crewpay-rest",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Shared CrewPay REST client
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Shared CrewPay REST client \u2014 dry-run + wallet-approved dryRunId for launch/wire. Env keys only.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/client.js",
|
|
7
7
|
"types": "./dist/client.d.ts",
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
"import": "./dist/client.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
15
18
|
"scripts": {
|
|
16
19
|
"build": "tsc -p tsconfig.json",
|
|
17
20
|
"test": "vitest run",
|
|
@@ -24,8 +27,12 @@
|
|
|
24
27
|
"directory": "packages/crewpay-rest"
|
|
25
28
|
},
|
|
26
29
|
"homepage": "https://crewpay.dev/agents",
|
|
27
|
-
"publishConfig": {
|
|
28
|
-
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
29
36
|
"devDependencies": {
|
|
30
37
|
"@types/node": "^22.10.0",
|
|
31
38
|
"typescript": "^5.7.0",
|