create-metamynd-agent 0.8.0 → 0.9.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.
Files changed (2) hide show
  1. package/index.mjs +20 -6
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -29,13 +29,18 @@ const GUARD_PKG = '@metamynd/agentsafe-guard';
29
29
  // 0.7.0 adds the opt-in `signContext` envelope signature (Tier 1 context-claim binding) —
30
30
  // no scaffolded behavior changes (off by default), but the floor must still cover the real
31
31
  // current version regardless, per this repo's standing internal-pin invariant.
32
- const GUARD_VERSION = '^0.7.0';
32
+ // 0.8.0 adds an optional `currency` scope to the amount-over/cumulative-over atoms
33
+ // (harnessDefaultSop, below, now sets it) — a guard below this version can't evaluate that
34
+ // field, so a scaffolded currency-scoped cap would silently never fire on a currency mismatch.
35
+ const GUARD_VERSION = '^0.8.0';
33
36
  // The default hosted scaffold's SECOND process — the tool gateway (see scaffoldProject).
34
37
  const MCP_GUARD_PKG = '@metamynd/agentsafe-mcp-guard';
35
38
  // 0.2.0 adds requireAuthorization (closes replay + cumulative spend) — this scaffold sets that
36
39
  // option, so a range that could resolve below 0.2.0 would silently scaffold a no-op.
37
40
  // 0.3.0 adds the same amount-unknown atom as the guard, above — same reasoning, same miss.
38
- const MCP_GUARD_VERSION = '^0.3.0';
41
+ // 0.4.0 adds the same amount-over/cumulative-over `currency` scope as the guard, above —
42
+ // same reasoning, same miss.
43
+ const MCP_GUARD_VERSION = '^0.4.0';
39
44
  const GATEWAY_PKG = '@metamynd/agentsafe-http-gateway';
40
45
  // 0.2.0 fixes a confused-deputy gap (payload not bound to the signed request) — the CLI must
41
46
  // never scaffold a range that could resolve below it.
@@ -1128,12 +1133,21 @@ async function runSandbox(args) {
1128
1133
  * entirely client-side with no schema boundary in front of it, so nothing stops a caller from
1129
1134
  * passing amount: "5000" (a string) or omitting amount entirely — `amount-over` silently does
1130
1135
  * not fire on either (`typeof c.amount === 'number'` is false), so the cap passes untested,
1131
- * not safe. Ordering amount-unknown first blocks that instead of letting it through. */
1132
- function harnessDefaultSop(perTxnMax) {
1136
+ * not safe. Ordering amount-unknown first blocks that instead of letting it through.
1137
+ *
1138
+ * The per-transaction cap is scoped to `currency` (atom-catalog.ts's `amount-over` currency
1139
+ * config), mirroring the hosted default exactly — see mandate-eval.ts for why an
1140
+ * unscoped numeric cap can be cleared just by naming a different currency. The atom's
1141
+ * `currency` config is declared `type: 'string[]'` (always an array, e.g. `['USD']`, never
1142
+ * a bare string — see atom-catalog.ts's own field doc); `harnessMandate` below correctly
1143
+ * passes the bare string straight through to the ODRL `unit` field, which is a DIFFERENT,
1144
+ * genuinely string-or-array field — the two must not be confused (see the backend's own
1145
+ * currencyScopeFor/currencyUnitFor split in currency-unit.ts for the same distinction). */
1146
+ function harnessDefaultSop(perTxnMax, currency) {
1133
1147
  return {
1134
1148
  molecules: [
1135
1149
  { id: 'amount-known', name: 'Amount must be determinable', combinator: 'any', atoms: [{ id: 'a0', predicate: 'amount-unknown' }], decision: 'block', reasonCode: 'AMOUNT_NOT_DETERMINABLE' },
1136
- { id: 'cap', name: 'Per-transaction cap', combinator: 'any', atoms: [{ id: 'a1', predicate: 'amount-over', config: { limit: perTxnMax } }], decision: 'block', reasonCode: 'SOP_SPEND_CAP' },
1150
+ { id: 'cap', name: 'Per-transaction cap', combinator: 'any', atoms: [{ id: 'a1', predicate: 'amount-over', config: { limit: perTxnMax, currency: [currency] } }], decision: 'block', reasonCode: 'SOP_SPEND_CAP' },
1137
1151
  { id: 'review', name: 'High-risk review', combinator: 'any', atoms: [{ id: 'a2', predicate: 'risk-at-or-above', config: { level: 'high' } }], decision: 'escalate', reasonCode: 'RISK_REVIEW' },
1138
1152
  ],
1139
1153
  };
@@ -1988,7 +2002,7 @@ async function runHarness(args) {
1988
2002
  console.log(` ${c.green('✓')} local agent ${c.b(agentDid)}`);
1989
2003
 
1990
2004
  const sopFields = configFileSopFields(fileConfig);
1991
- const sopDocument = sopFields.sop ? sopFields.sop.documentJson : harnessDefaultSop(perTxnMax);
2005
+ const sopDocument = sopFields.sop ? sopFields.sop.documentJson : harnessDefaultSop(perTxnMax, currency);
1992
2006
  if (sopFields.sop) console.log(` ${c.green('✓')} compiled ${sopDocument.molecules.length} rule(s) from the config file`);
1993
2007
  const mandate = harnessMandate({ scope, currency, maxAmount, perTxnMax, merchants });
1994
2008
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-metamynd-agent",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "Scaffold a MetaMynd/AgentSafe-governed AI agent in one command — logs in, provisions the agent (identity + mandate + SOP + Standards) in a single call, writes agent.metamynd.json plus a runnable agent + separate tool-gateway process that closes direct-call, confused-deputy, replay, and cumulative-spend bypasses. --harness scaffolds a free, local, zero-network governance harness instead.",
5
5
  "type": "module",
6
6
  "bin": {