aamp-openclaw-plugin 0.1.45 → 0.1.47

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.
@@ -374,15 +374,28 @@ function ensurePluginInstallRecord(config, installRecord) {
374
374
  export function ensureAampToolAllowlist(toolsConfig, options = {}) {
375
375
  const next = toolsConfig && typeof toolsConfig === 'object' ? structuredClone(toolsConfig) : {}
376
376
  const existingAllow = Array.isArray(next.allow) ? next.allow.filter((value) => typeof value === 'string' && value.trim()) : []
377
+ const existingAlsoAllow = Array.isArray(next.alsoAllow)
378
+ ? next.alsoAllow.filter((value) => typeof value === 'string' && value.trim())
379
+ : []
377
380
  const includeCodingBaseline = options.includeCodingBaseline === true
378
381
 
379
- const mergedAllow = [
380
- ...existingAllow,
381
- ...(includeCodingBaseline ? CODING_TOOL_ALLOWLIST : []),
382
+ const nonAampAllow = existingAllow.filter((tool) => !AAMP_PLUGIN_TOOL_ALLOWLIST.includes(tool))
383
+ const shouldPreserveAllow = nonAampAllow.length > 0 || includeCodingBaseline
384
+
385
+ next.alsoAllow = Array.from(new Set([
386
+ ...existingAlsoAllow,
382
387
  ...AAMP_PLUGIN_TOOL_ALLOWLIST,
383
- ]
388
+ ]))
384
389
 
385
- next.allow = Array.from(new Set(mergedAllow))
390
+ if (shouldPreserveAllow) {
391
+ next.allow = Array.from(new Set([
392
+ ...nonAampAllow,
393
+ ...(includeCodingBaseline ? CODING_TOOL_ALLOWLIST : []),
394
+ ...AAMP_PLUGIN_TOOL_ALLOWLIST,
395
+ ]))
396
+ } else if (Array.isArray(next.allow)) {
397
+ delete next.allow
398
+ }
386
399
 
387
400
  return next
388
401
  }
@@ -390,19 +403,24 @@ export function ensureAampToolAllowlist(toolsConfig, options = {}) {
390
403
  export function planToolPolicyUpdate(toolsConfig, options = {}) {
391
404
  const current = toolsConfig && typeof toolsConfig === 'object' ? structuredClone(toolsConfig) : {}
392
405
  const existingAllow = Array.isArray(current.allow) ? current.allow.filter((value) => typeof value === 'string' && value.trim()) : []
406
+ const existingAlsoAllow = Array.isArray(current.alsoAllow)
407
+ ? current.alsoAllow.filter((value) => typeof value === 'string' && value.trim())
408
+ : []
393
409
  const includeCodingBaseline = options.includeCodingBaseline === true
394
- const missingAampTools = AAMP_PLUGIN_TOOL_ALLOWLIST.filter((tool) => !existingAllow.includes(tool))
410
+ const missingAampTools = AAMP_PLUGIN_TOOL_ALLOWLIST.filter((tool) => !existingAlsoAllow.includes(tool))
395
411
  const currentProfile = typeof current.profile === 'string' ? current.profile : undefined
396
412
  const missingCodingTools = includeCodingBaseline
397
413
  ? CODING_TOOL_ALLOWLIST.filter((tool) => !existingAllow.includes(tool))
398
414
  : []
415
+ const allowOnlyAampTools = existingAllow.length > 0 && existingAllow.every((tool) => AAMP_PLUGIN_TOOL_ALLOWLIST.includes(tool))
399
416
 
400
417
  return {
401
418
  current,
402
419
  missingAampTools,
403
420
  missingCodingTools,
404
- needsAnyChange: missingAampTools.length > 0 || missingCodingTools.length > 0,
405
- needsNonPluginChange: missingCodingTools.length > 0,
421
+ needsAllowMigration: allowOnlyAampTools,
422
+ needsAnyChange: missingAampTools.length > 0 || missingCodingTools.length > 0 || allowOnlyAampTools,
423
+ needsNonPluginChange: missingCodingTools.length > 0 || allowOnlyAampTools,
406
424
  currentProfile,
407
425
  next: ensureAampToolAllowlist(current, { includeCodingBaseline }),
408
426
  }
@@ -416,10 +434,14 @@ function currentToolPolicySummary(plan) {
416
434
  lines.push(` current tools.profile: (none)`)
417
435
  }
418
436
  lines.push(` current tools.allow count: ${Array.isArray(plan.current.allow) ? plan.current.allow.length : 0}`)
437
+ lines.push(` current tools.alsoAllow count: ${Array.isArray(plan.current.alsoAllow) ? plan.current.alsoAllow.length : 0}`)
419
438
  if (plan.missingAampTools.length > 0) {
420
- lines.push(` missing AAMP tools: ${plan.missingAampTools.join(', ')}`)
439
+ lines.push(` missing AAMP tools in tools.alsoAllow: ${plan.missingAampTools.join(', ')}`)
440
+ }
441
+ if (plan.needsAllowMigration) {
442
+ lines.push(' existing tools.allow contains only AAMP tools and will be migrated to tools.alsoAllow')
421
443
  }
422
- if (plan.needsNonPluginChange) {
444
+ if (plan.missingCodingTools.length > 0) {
423
445
  lines.push(` additional core tools to add: ${plan.missingCodingTools.join(', ')}`)
424
446
  }
425
447
  return lines.join('\n')
@@ -783,6 +805,7 @@ export async function runInit() {
783
805
  ` senderPoliciesFile: ${DEFAULT_SENDER_POLICIES_FILE}`,
784
806
  ` senderPolicies: ${senderPolicies ? JSON.stringify(senderPolicies) : '(default deny until paired or configured)'}`,
785
807
  ` tools.allow: ${JSON.stringify(next.tools?.allow ?? [])}`,
808
+ ` tools.alsoAllow: ${JSON.stringify(next.tools?.alsoAllow ?? [])}`,
786
809
  ` codingBaselineAdded: ${toolPolicyPlan.missingCodingTools.length > 0 && includeCodingBaseline ? 'yes' : 'no'}`,
787
810
  identityResult.created
788
811
  ? ` mailbox: ${identityResult.email} (registered and saved to ${identityResult.credentialsPath})`
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "skills"
8
8
  ],
9
9
  "license": "MIT",
10
- "version": "0.1.45",
10
+ "version": "0.1.47",
11
11
  "description": "AAMP Agent Mail Protocol — OpenClaw plugin. Gives OpenClaw an AAMP mailbox identity and lets it receive, process and reply to AAMP tasks.",
12
12
  "type": "module",
13
13
  "main": "dist/index.js",
@@ -296,7 +296,7 @@
296
296
  "test": "vitest run"
297
297
  },
298
298
  "dependencies": {
299
- "aamp-sdk": "^0.1.25",
299
+ "aamp-sdk": "^0.1.26",
300
300
  "nodemailer": "^6.9.10",
301
301
  "qrcode-terminal": "^0.12.0",
302
302
  "ws": "^8.16.0"