AGENT SKILL

wamp-pubsub-patterns

暂无简介

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 13
Forks
2

03 SKILL.md 正文

/wamp-pubsub-patterns

When to Use

  • Replace raw Swarm Bus (agent-message-bus.sh) with a proper protocol for inter-agent messaging
  • Event-driven agent orchestration: agent A publishes "task.complete", agent B subscribes
  • RPC over WAMP: agent A calls a procedure on agent B's router
  • Cryptographically authenticated topic subscriptions

Do NOT use for

  • Simple local inter-process messaging (use [[async-event-emitter]] instead)
  • High-frequency metrics streaming (use [[statsd-metrics-streaming]])

Connect and subscribe

import autobahn from 'autobahn'

const connection = new autobahn.Connection({
  url:   'ws://localhost:8080/ws',
  realm: 'yamtam-swarm',
  authmethods: ['ticket'],
  authid: process.env.YAMTAM_AGENT_ID,
  onchallenge: (_session, method) => {
    if (method === 'ticket') return process.env.YAMTAM_AGENT_TOKEN!
    throw new Error(`[wamp] unsupported auth: ${method}`)
  },
})

connection.onopen = async (session) => {
  console.log('[wamp] connected as', session.id)

  // Subscribe to task events
  await session.subscribe('yamtam.task.complete', (args, kwargs) => {
    console.log('[wamp] task complete:', kwargs)
  })

  // Subscribe with options (wildcard)
  await session.subscribe('yamtam.agent..status', (args, kwargs, details) => {
    console.log('[wamp] agent status update from:', details.topic)
  }, { match: 'wildcard' })
}

connection.open()

Publish with signed payload

import { signCommand } from './ecc-key-management.js'

connection.onopen = async (session) => {
  const payload = {
    agentId:   process.env.YAMTAM_AGENT_ID,
    action:    'task.start',
    command:   'sandbox-exec agent-script.sh',
    ts:        Date.now(),
    nonce:     Math.random().toString(36),
  }

  const signature = signCommand(
    process.env.YAMTAM_AGENT_PRIV!,
    JSON.stringify(payload)
  )

  await session.publish('yamtam.task.dispatch', [], {
    ...payload,
    signature,
  }, { acknowledge: true })

  console.log('[wamp] published signed task')
}

RPC registration (agent exposes procedures)

connection.onopen = async (session) => {
  // Register a callable procedure
  await session.register('yamtam.agent.run-tool', async (args, kwargs) => {
    const { tool, params } = kwargs
    // Verify caller signature before executing
    if (!verifyCommand(kwargs.pubKey, JSON.stringify({ tool, params }), kwargs.sig)) {
      throw new autobahn.Error('yamtam.error.unauthorized', ['invalid signature'])
    }
    return { result: await runTool(tool, params) }
  })

  // Call a procedure on another agent
  const result = await session.call('yamtam.agent.run-tool', [], {
    tool:   'fetch',
    params: { url: 'https://api.github.com/zen' },
    pubKey: myPubKey,
    sig:    signCommand(myPrivKey, JSON.stringify({ tool: 'fetch', params: {} })),
  })
}

Anti-Fake-Pass Checklist

❌ No authmethods → anonymous WAMP connection, any process can publish/subscribe
❌ Wildcard subscriptions without ACL → agent subscribes to all topics
❌ RPC without caller signature verification → any authenticated agent can invoke any procedure
❌ connection.onclose not handled → reconnection logic missing on network drop
❌ Realm not isolated per environment → dev/prod agents share topic space
❌ session.publish without acknowledge:true → no delivery confirmation for critical commands

04 同仓库更多 Skills

Horonomos-laps
Horonomos-laps/Yana-AI

openai--sentry--sentry

Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.

★ 13
Horonomos-laps
Horonomos-laps/Yana-AI

ito-basket-compare

Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.

★ 13
Horonomos-laps
Horonomos-laps/Yana-AI

implementing-network-traffic-baselining

Build network traffic baselines from NetFlow/IPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly/daily traffic pattern profiling

★ 13
Horonomos-laps
Horonomos-laps/Yana-AI

detecting-evasion-techniques-in-endpoint-logs

Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.

★ 13
Horonomos-laps
Horonomos-laps/Yana-AI

implementing-microsegmentation-with-guardicore

Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.

★ 13
Horonomos-laps
Horonomos-laps/Yana-AI

ramdisk-tmpfs-patterns

暂无简介

★ 13