@cmdoss/agent-pass-plugin 0.1.2-dev.21.1 → 0.1.2
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 +1 -2
- package/dist/mcp.js +2 -2
- package/dist/shared/constants.js +0 -7
- package/dist/testnet/authorization.js +0 -78
- package/dist/testnet/engine.js +3 -14
- package/dist/testnet/read-model.js +0 -3
- package/docs/agent-pass-integration.md +2 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/public/assets/agent-pass-plugin-client.js +4 -4
- package/public/assets/agent-pass-plugin-sdk.js +1 -1
- package/skills/agent-pass-plugin-trading/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -60,8 +60,7 @@ See the [trading skill](skills/agent-pass-plugin-trading/SKILL.md) for tool sequ
|
|
|
60
60
|
|
|
61
61
|
- Keep the machine and local service running. Closing chat/browser or logging out
|
|
62
62
|
does not stop an active plan. Restarted plans pause and require explicit Resume.
|
|
63
|
-
- Pause/Stop prevent new trades. Revoke requires
|
|
64
|
-
(or **Close the pass**) on the official Agent Pass page, approve in the wallet, and chain confirmation.
|
|
63
|
+
- Pause/Stop prevent new trades. Revoke requires owner review and chain confirmation.
|
|
65
64
|
Holdings are not automatically sold; submitted transactions still reconcile.
|
|
66
65
|
- Delegated keys stay in the official local SDK's `agent-pass/` data directory.
|
|
67
66
|
Never commit runtime data or signer sessions. No owner seed is requested.
|
package/dist/mcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_APP_PORT,
|
|
1
|
+
import { DEFAULT_APP_PORT, SERVICE_ID } from "./shared/constants.js";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -245,7 +245,7 @@ server.registerTool("list_transactions", {
|
|
|
245
245
|
}, ({ planId }) => api(`/api/transactions${planId ? `?planId=${encodeURIComponent(planId)}` : ""}`));
|
|
246
246
|
for (const action of ["start", "pause", "resume", "stop", "revoke"]) {
|
|
247
247
|
server.registerTool(`${action}_plan`, {
|
|
248
|
-
description: `${action} a plan in the runtime mode. Testnet Start/resume requires matching verified onchain authorization and explicit user intent. Pause/Stop block new submissions; submitted digests still reconcile. Testnet Revoke stops local submissions and returns the official
|
|
248
|
+
description: `${action} a plan in the runtime mode. Testnet Start/resume requires matching verified onchain authorization and explicit user intent. Pause/Stop block new submissions; submitted digests still reconcile. Testnet Revoke stops local submissions and returns the official owner wallet review URL; only report onchain revoked after fresh confirmation. Paper revoke is simulation. Holdings are not sold.`,
|
|
249
249
|
inputSchema: { planId: z.string().uuid() },
|
|
250
250
|
outputSchema: QuoteDataSchema,
|
|
251
251
|
annotations: {
|
package/dist/shared/constants.js
CHANGED
|
@@ -7,10 +7,3 @@ export const SDK_UI_ORIGIN = `http://127.0.0.1:${SDK_UI_PORT}`;
|
|
|
7
7
|
export const STRATEGY_VERSION = "1.1.0";
|
|
8
8
|
export const LOOP_INTERVAL_MS = 1_000;
|
|
9
9
|
export const VALUATION_MAX_AGE_MS = 60_000;
|
|
10
|
-
/**
|
|
11
|
-
* Owner-only Testnet revocation steps. SDK 0.1.35's pass page has no "Revoke" button;
|
|
12
|
-
* it offers exactly these two endings. The agent opens the page but never presses either.
|
|
13
|
-
*/
|
|
14
|
-
export const REVOCATION_STOP_BUTTON = "Stop the agent now";
|
|
15
|
-
export const REVOCATION_CLOSE_BUTTON = "Close the pass";
|
|
16
|
-
export const REVOCATION_OWNER_STEPS = `Open the Agent Pass page, choose "${REVOCATION_STOP_BUTTON}" (revokes the agent key and deletes its allowances; the pass stays) or "${REVOCATION_CLOSE_BUTTON}" (does the same and also returns everything the pass holds to the owner wallet), then approve in the owner wallet. Only the owner presses these buttons; the agent never does.`;
|
|
@@ -237,46 +237,6 @@ export function assertBindingPolicy(binding, input) {
|
|
|
237
237
|
equal(binding.expected, expected(input, setup.name, Number(setup.expiresMs)), "bound plan rules");
|
|
238
238
|
equal(binding.policyHash, digest(binding.expected), "bound policy hash");
|
|
239
239
|
}
|
|
240
|
-
/**
|
|
241
|
-
* The owner's revocation digest, only when the transaction read back from chain proves it:
|
|
242
|
-
* it succeeded, the plan owner sent it, it called the bundled package's pass::revoke_agent and
|
|
243
|
-
* it wrote this pass. Anything else (a later owner edit, a closed pass) yields undefined.
|
|
244
|
-
*/
|
|
245
|
-
export function verifiedRevocationDigest(deployment, binding, digest, value) {
|
|
246
|
-
try {
|
|
247
|
-
if (typeof digest !== "string" ||
|
|
248
|
-
!/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(digest))
|
|
249
|
-
return undefined;
|
|
250
|
-
const result = obj(value, "revocation transaction");
|
|
251
|
-
if (result.$kind !== "Transaction")
|
|
252
|
-
return undefined;
|
|
253
|
-
const tx = obj(result.Transaction, "revocation transaction");
|
|
254
|
-
if (tx.digest !== undefined && tx.digest !== digest)
|
|
255
|
-
return undefined;
|
|
256
|
-
if (obj(obj(tx.effects, "effects").status, "status").success !== true)
|
|
257
|
-
return undefined;
|
|
258
|
-
const data = obj(tx.transaction, "transaction data");
|
|
259
|
-
if (address(data.sender) !== address(binding.owner))
|
|
260
|
-
return undefined;
|
|
261
|
-
const packages = [
|
|
262
|
-
deployment.packageId,
|
|
263
|
-
deployment.publishedAt,
|
|
264
|
-
]
|
|
265
|
-
.filter((id) => typeof id === "string")
|
|
266
|
-
.map(address);
|
|
267
|
-
const revokes = (Array.isArray(data.commands) ? data.commands : []).some((command) => command?.$kind === "MoveCall" &&
|
|
268
|
-
command.MoveCall?.module === "pass" &&
|
|
269
|
-
command.MoveCall?.function === "revoke_agent" &&
|
|
270
|
-
packages.includes(address(command.MoveCall?.package)));
|
|
271
|
-
const changed = obj(tx.effects, "effects").changedObjects;
|
|
272
|
-
const wrotePass = (Array.isArray(changed) ? changed : []).some((o) => typeof o?.objectId === "string" &&
|
|
273
|
-
address(o.objectId) === address(binding.passId));
|
|
274
|
-
return revokes && wrotePass ? digest : undefined;
|
|
275
|
-
}
|
|
276
|
-
catch {
|
|
277
|
-
return undefined;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
240
|
export class OfficialAuthorization {
|
|
281
241
|
options;
|
|
282
242
|
root;
|
|
@@ -643,44 +603,6 @@ export class OfficialAuthorization {
|
|
|
643
603
|
alreadyRevoked: result.alreadyRevoked === true,
|
|
644
604
|
};
|
|
645
605
|
}
|
|
646
|
-
async revocationDigest(binding) {
|
|
647
|
-
const d = await this.deployment();
|
|
648
|
-
if (binding.network !== "testnet" ||
|
|
649
|
-
binding.chainIdentifier !== d.chainIdentifier ||
|
|
650
|
-
address(binding.packageId) !== address(d.packageId))
|
|
651
|
-
return undefined;
|
|
652
|
-
try {
|
|
653
|
-
const read = this.options.readPassTransaction
|
|
654
|
-
? await this.options.readPassTransaction(d, address(binding.passId))
|
|
655
|
-
: await this.readPassTransaction(d, address(binding.passId));
|
|
656
|
-
return verifiedRevocationDigest(d, binding, read.digest, read.transaction);
|
|
657
|
-
}
|
|
658
|
-
catch {
|
|
659
|
-
return undefined;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
async readPassTransaction(deployment, passId) {
|
|
663
|
-
const moduleName = "@mysten-incubation/sui-agent-pass/chain";
|
|
664
|
-
const chain = (await import(moduleName));
|
|
665
|
-
const client = chain.clientFor(deployment);
|
|
666
|
-
await chain.assertChain(client, deployment);
|
|
667
|
-
const found = await client.getObject({
|
|
668
|
-
objectId: passId,
|
|
669
|
-
include: { previousTransaction: true },
|
|
670
|
-
signal: AbortSignal.timeout(12_000),
|
|
671
|
-
});
|
|
672
|
-
const digest = found.object?.previousTransaction;
|
|
673
|
-
if (typeof digest !== "string")
|
|
674
|
-
return { digest, transaction: null };
|
|
675
|
-
return {
|
|
676
|
-
digest,
|
|
677
|
-
transaction: await client.getTransaction({
|
|
678
|
-
digest,
|
|
679
|
-
include: { transaction: true, effects: true },
|
|
680
|
-
signal: AbortSignal.timeout(12_000),
|
|
681
|
-
}),
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
606
|
themedUrl(url) {
|
|
685
607
|
if (this.options.reviewOrigin) {
|
|
686
608
|
const origin = new URL(this.options.reviewOrigin);
|
package/dist/testnet/engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { STRATEGY_VERSION } from "../shared/constants.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { fingerprint, testnetInput, units, } from "./model.js";
|
|
4
4
|
import { validatePlan } from "./policy.js";
|
|
@@ -223,15 +223,6 @@ export class TestnetEngine {
|
|
|
223
223
|
if (request.payloadHash !== plan.reviewHash)
|
|
224
224
|
throw new Error("The reviewed plan changed");
|
|
225
225
|
const authorization = await this.authorization.inspect(plan.policy, request.authorization);
|
|
226
|
-
// Best effort, read-only and before the fresh re-read: a digest is recorded only when the
|
|
227
|
-
// chain shows the owner's revoke_agent transaction. Otherwise it stays absent, never guessed.
|
|
228
|
-
const revocationDigest = ["revoked", "closed"].includes(authorization.status) &&
|
|
229
|
-
plan.status !== "revoked" &&
|
|
230
|
-
plan.binding
|
|
231
|
-
? await this.authorization
|
|
232
|
-
.revocationDigest?.(plan.binding)
|
|
233
|
-
.catch(() => undefined)
|
|
234
|
-
: undefined;
|
|
235
226
|
const fresh = this.repository.get(plan.id);
|
|
236
227
|
validatePlan(fresh);
|
|
237
228
|
if (fresh.reviewHash !== request.payloadHash)
|
|
@@ -265,11 +256,9 @@ export class TestnetEngine {
|
|
|
265
256
|
else if (["revoked", "closed"].includes(authorization.status)) {
|
|
266
257
|
request.status = request.kind === "revocation" ? "confirmed" : "revoked";
|
|
267
258
|
if (fresh.status !== "revoked") {
|
|
268
|
-
if (revocationDigest)
|
|
269
|
-
authorization.revocationDigest = revocationDigest;
|
|
270
259
|
fresh.status = "revoked";
|
|
271
260
|
fresh.epoch++;
|
|
272
|
-
this.repository.event(fresh, "revoked", "Onchain revocation confirmed; no new transactions will be submitted"
|
|
261
|
+
this.repository.event(fresh, "revoked", "Onchain revocation confirmed; no new transactions will be submitted");
|
|
273
262
|
}
|
|
274
263
|
}
|
|
275
264
|
else if (["mismatch", "expired"].includes(authorization.status)) {
|
|
@@ -302,7 +291,7 @@ export class TestnetEngine {
|
|
|
302
291
|
: "revoking";
|
|
303
292
|
plan.epoch++;
|
|
304
293
|
this.repository.event(plan, action === "revoke" ? "revocation_requested" : action, action === "revoke"
|
|
305
|
-
?
|
|
294
|
+
? "New submissions stopped locally. Owner must sign onchain revocation"
|
|
306
295
|
: "New submissions stopped; holdings remain with the owner");
|
|
307
296
|
this.repository.save(plan);
|
|
308
297
|
if (action === "revoke") {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { REVOCATION_OWNER_STEPS } from "../shared/constants.js";
|
|
2
1
|
import { STRATEGY_VERSION, VALUATION_MAX_AGE_MS } from "../shared/constants.js";
|
|
3
2
|
import { testnetCatalog, testnetStrategy } from "../public/catalog.js";
|
|
4
3
|
import { display, fingerprint } from "./model.js";
|
|
@@ -27,7 +26,6 @@ export class TestnetReadModel {
|
|
|
27
26
|
sessionAddress: a.sessionAddress,
|
|
28
27
|
passId: plan.binding?.passId,
|
|
29
28
|
owner: plan.binding?.owner,
|
|
30
|
-
revocationDigest: a.revocationDigest,
|
|
31
29
|
}
|
|
32
30
|
: null;
|
|
33
31
|
}
|
|
@@ -92,7 +90,6 @@ export class TestnetReadModel {
|
|
|
92
90
|
valuation,
|
|
93
91
|
authorization: this.publicAuthorization(plan),
|
|
94
92
|
revocationUrl: plan.status === "revoking" ? plan.revocationUrl : undefined,
|
|
95
|
-
revocationSteps: plan.status === "revoking" ? REVOCATION_OWNER_STEPS : undefined,
|
|
96
93
|
history: plan.history
|
|
97
94
|
.slice(-200)
|
|
98
95
|
.reverse()
|
|
@@ -14,14 +14,8 @@ liquidity. Test SUI and demo USDC have no real-dollar value. Mainnet is disabled
|
|
|
14
14
|
Review the returned rules and official SDK URL; authorize with the owner wallet.
|
|
15
15
|
4. Poll `get_review_request`. Only a verified matching pass enables **Start**.
|
|
16
16
|
5. Explicitly Start; inspect receipts, digests and remaining budget in My plans.
|
|
17
|
-
6. Pause/Resume/Stop locally as needed. Revoke
|
|
18
|
-
|
|
19
|
-
chooses **Stop the agent now** (revokes the agent key and deletes its allowances;
|
|
20
|
-
the pass stays) or **Close the pass** (same, and also returns everything the pass
|
|
21
|
-
holds to the owner wallet), then approves in the wallet. The agent never presses
|
|
22
|
-
either button. Wait for chain confirmation; the plan's `revoked` history entry
|
|
23
|
-
records the owner's `revoke_agent` digest when it can be read back from chain.
|
|
24
|
-
Already submitted transactions still reconcile.
|
|
17
|
+
6. Pause/Resume/Stop locally as needed. Revoke opens the official owner review;
|
|
18
|
+
wait for chain confirmation. Already submitted transactions still reconcile.
|
|
25
19
|
|
|
26
20
|
No MCP tool grants owner approval. Paper confirmation routes cannot authorize
|
|
27
21
|
Testnet. The browser, persisted JSON and a closed review tab prove no permission.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmdoss/agent-pass-plugin",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@cmdoss/agent-pass-plugin",
|
|
9
|
-
"version": "0.1.2
|
|
9
|
+
"version": "0.1.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@fastify/static": "10.1.10",
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.2",
|
package/package.json
CHANGED