@cmdoss/agent-pass-plugin 0.1.1-dev.17.1 → 0.1.1-dev.18.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/dist/mcp.js CHANGED
@@ -65,7 +65,7 @@ async function api(path, body) {
65
65
  }
66
66
  catch (error) {
67
67
  const value = {
68
- error: `Local runtime unavailable. Start npm run dev in Agent Pass Plugin first. ${error.message}`,
68
+ error: `Local runtime unavailable at ${base.origin}. Start it with \`agent-pass-plugin start\` (npm install) or \`npm run dev\` (source checkout), then retry this exact call; reuse the same requestId. Plans, passes and submitted digests stay in local storage. A restart pauses running plans and never authorizes, Starts or Resumes them. ${error.message}`,
69
69
  };
70
70
  return {
71
71
  isError: true,
@@ -44,7 +44,11 @@ export class TestnetReadModel {
44
44
  }
45
45
  : null;
46
46
  const spentIn = display(plan.spent, policy.coinIn.decimals), holdingsOut = display(plan.output, policy.coinOut.decimals);
47
- const pnl = valuation && input.direction === "usdc_to_sui"
47
+ const pendingSubmissions = this.repository
48
+ .intents()
49
+ .filter((i) => i.planId === plan.id && i.state === "submitted").length;
50
+ // An unreconciled submission makes holdings/spend unknown; never show it as zero profit.
51
+ const pnl = pendingSubmissions === 0 && valuation && input.direction === "usdc_to_sui"
48
52
  ? Number(holdingsOut) * Number(valuation.price) - Number(spentIn)
49
53
  : null;
50
54
  return {
@@ -64,6 +68,8 @@ export class TestnetReadModel {
64
68
  expiresAt: plan.expiresAt,
65
69
  lastReason: plan.lastReason,
66
70
  nextRunAt: plan.nextRunAt,
71
+ // Count only: digests, bytes and signatures of unresolved work stay in local state.
72
+ pendingSubmissions,
67
73
  coinIn: policy.coinIn,
68
74
  coinOut: policy.coinOut,
69
75
  spentIn,
@@ -72,13 +78,15 @@ export class TestnetReadModel {
72
78
  gasSui: input.gasSui,
73
79
  gasSpentSui: plan.gas,
74
80
  pnlUsdc: pnl,
75
- pnlReason: input.direction === "sui_to_usdc"
76
- ? "Acquisition cost basis for input SUI is unavailable; sale proceeds are not profit"
77
- : !valuation
78
- ? "No confirmed venue valuation"
79
- : fresh
80
- ? null
81
- : `Profit uses the last confirmed venue mark from ${valuation.asOf}; it is not a live quote`,
81
+ pnlReason: pendingSubmissions > 0
82
+ ? "A submitted transaction is not reconciled yet; profit is unavailable until it settles"
83
+ : input.direction === "sui_to_usdc"
84
+ ? "Acquisition cost basis for input SUI is unavailable; sale proceeds are not profit"
85
+ : !valuation
86
+ ? "No confirmed venue valuation"
87
+ : fresh
88
+ ? null
89
+ : `Profit uses the last confirmed venue mark from ${valuation.asOf}; it is not a live quote`,
82
90
  valuation,
83
91
  authorization: this.publicAuthorization(plan),
84
92
  revocationUrl: plan.status === "revoking" ? plan.revocationUrl : undefined,
@@ -164,10 +164,11 @@ export class TestnetRunner {
164
164
  guardPlan(plan, this.now(), epoch);
165
165
  if (!inspection.active || inspection.revoked || inspection.expired)
166
166
  throw new Error(inspection.reason || "Onchain permission is no longer active");
167
- if (BigInt(inspection.ownerInputBalance) <
168
- BigInt(plan.policy.amountIn) ||
169
- BigInt(inspection.agentGasBalance) < 10000000n)
170
- throw new Error("Insufficient testnet input address balance or agent gas");
167
+ // Same guard as before; separate messages give the owner a specific next step.
168
+ if (BigInt(inspection.ownerInputBalance) < BigInt(plan.policy.amountIn))
169
+ throw new Error("Insufficient testnet input address balance for one order");
170
+ if (BigInt(inspection.agentGasBalance) < 10000000n)
171
+ throw new Error("Insufficient agent gas (below 0.01 test SUI)");
171
172
  const today = day(inspection.chainTimeMs), todaySpent = sum(plan.history
172
173
  .filter((h) => h.type === "filled" && h.at.slice(0, 10) === today)
173
174
  .map((h) => units(h.amountIn, plan.policy.coinIn.decimals)));
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cmdoss/agent-pass-plugin",
3
- "version": "0.1.1-dev.17.1",
3
+ "version": "0.1.1-dev.18.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@cmdoss/agent-pass-plugin",
9
- "version": "0.1.1-dev.17.1",
9
+ "version": "0.1.1-dev.18.1",
10
10
  "dependencies": {
11
11
  "@fastify/static": "10.1.10",
12
12
  "@modelcontextprotocol/sdk": "1.32.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmdoss/agent-pass-plugin",
3
- "version": "0.1.1-dev.17.1",
3
+ "version": "0.1.1-dev.18.1",
4
4
  "type": "module",
5
5
  "description": "Agent Pass Plugin — local trading strategies, explicit permissions and an independent execution loop",
6
6
  "engines": {