Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计异常

nexus-sdk-hooks-eventsnexus SDK hooks events 命令行

Agent Skill

nexus-sdk-hooks-events 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

404

周安装

17

GitHub Stars

6

下载量

141
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nexus-sdk-hooks-events(nexus SDK hooks events 命令行)
来源仓库:https://github.com/availproject/nexus-sdk
仓库路径:skills/nexus-sdk-hooks-events
安装命令:
npx skills add https://github.com/availproject/nexus-sdk --skill nexus-sdk-hooks-events
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/availproject/nexus-sdk --skill nexus-sdk-hooks-events

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 适合在代码变更或协作事项整理场景中使用。
  • 可通过安装命令集成到主流 Agent 工具中。
  • 使用前应确认权限范围及是否触发文件读写操作。
  • nexus-sdk-hooks-events 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Hooks and Events

Set up hooks once after SDK init

  • Call sdk.setOnIntentHook(callback).
  • Call sdk.setOnAllowanceHook(callback).
  • Call sdk.setOnSwapIntentHook(callback).
  • If a hook is not set, the SDK auto-approves and continues.
  • If a hook is set, always call allow(...) or deny() or the flow will stall.
  • Optionally auto-deny after a timeout to avoid hanging UX.

Handle intent hook (bridge / bridgeAndTransfer / bridgeAndExecute)

Signature

sdk.setOnIntentHook((data) => {
  // data: OnIntentHookData
});

OnIntentHookData

  • allow(): void — continue the flow
  • deny(): void — reject the flow
  • intent: ReadableIntent — readable intent info for UI
  • refresh(selectedSources?: number[]): Promise<ReadableIntent> — refresh the intent

How to use

  • Store data in a ref so UI can call allow()/deny() later.
  • Call refresh() on an interval (e.g., every 15s) if you show intent details.
  • If the user closes the modal or cancels, call deny() and clear the ref.

Handle allowance hook (approval control)

Signature

sdk.setOnAllowanceHook((data) => {
  // data: OnAllowanceHookData
});

OnAllowanceHookData

  • allow(decisions): void

- decisions must match the number of sources - each entry can be 'min', 'max', bigint, or numeric string

  • deny(): void
  • sources: AllowanceHookSources

- includes chain/token info and current vs required allowance

How to use

  • Present each source to the user (chain + token + required allowance).
  • Build the decisions array in the same order as sources.
  • Call allow(decisions) to continue, or deny() to cancel.
  • Ensure decisions.length === sources.length or the SDK will reject with INVALID_VALUES_ALLOWANCE_HOOK.

Handle swap intent hook (swap flows)

Signature

sdk.setOnSwapIntentHook((data) => {
  // data: OnSwapIntentHookData
});

OnSwapIntentHookData

  • allow(): void
  • deny(): void
  • intent: SwapIntent
  • refresh(): Promise<SwapIntent>

How to use

  • Store data and show a UI summary.
  • Call allow() to proceed or deny() to cancel.

Stream events for progress UI

Attach listeners

  • All main operations accept {onEvent} in options.

Event names and payloads

  • NEXUS_EVENTS.STEPS_LISTBridgeStepType[]
  • NEXUS_EVENTS.STEP_COMPLETEBridgeStepType
  • NEXUS_EVENTS.SWAP_STEP_COMPLETESwapStepType

Typical usage

  • Use STEPS_LIST to seed step trackers.
  • Use STEP_COMPLETE and SWAP_STEP_COMPLETE to update progress and explorer links.

Handle errors and cancellation

  • If an operation throws, clear intent/allowance refs to avoid stale state.
  • On user cancel, call deny() for the active hook and reset UI state.
  • If a hook is set but no allow()/deny() is called, the intent remains pending.

Expand error-handling patterns

Normalize errors

  • The SDK throws NexusError for known failures.
  • Import from SDK:

- import {NexusError, ERROR_CODES} from '@avail-project/nexus-core'

Map common error codes to UX responses

  • USER_DENIED_INTENT / USER_DENIED_ALLOWANCE / USER_DENIED_INTENT_SIGNATURE:

- Treat as user cancel; show a neutral message and reset UI.

  • INVALID_VALUES_ALLOWANCE_HOOK:

- Fix decisions length/type and resubmit.

  • SDK_NOT_INITIALIZED / WALLET_NOT_CONNECTED / CONNECT_ACCOUNT_FAILED:

- Prompt user to reconnect; re-run sdk.initialize(...).

  • INVALID_INPUT / INVALID_ADDRESS_LENGTH:

- Validate inputs; block submission until fixed.

  • INSUFFICIENT_BALANCE / NO_BALANCE_FOR_ADDRESS:

- Prompt user to reduce amount or fund source chain.

  • TOKEN_NOT_SUPPORTED / CHAIN_NOT_FOUND:

- Block submission and update selectors.

  • QUOTE_FAILED / SWAP_FAILED / RATES_CHANGED_BEYOND_TOLERANCE / SLIPPAGE_EXCEEDED_ALLOWANCE:

- Re-run quote or suggest a smaller amount.

  • RFF_FEE_EXPIRED:

- Re-simulate and re-submit the transaction.

  • TRANSACTION_TIMEOUT / LIQUIDITY_TIMEOUT:

- Show “pending” state and allow retry or check intent history.

  • TRANSACTION_REVERTED:

- Display failure with explorer link if available.

  • COSMOS_ERROR / INTERNAL_ERROR:

- Show a generic error and log err.data?.details for support.

Use a helper pattern

import { NexusError, ERROR_CODES } from '@avail-project/nexus-core';

export function getReadableNexusError(err: unknown): string {
  if (err instanceof NexusError) {
    switch (err.code) {
      case ERROR_CODES.USER_DENIED_INTENT:
      case ERROR_CODES.USER_DENIED_ALLOWANCE:
      case ERROR_CODES.USER_DENIED_INTENT_SIGNATURE:
        return 'Transaction cancelled by user';
      case ERROR_CODES.INSUFFICIENT_BALANCE:
        return 'Insufficient balance';
      case ERROR_CODES.SLIPPAGE_EXCEEDED_ALLOWANCE:
      case ERROR_CODES.RATES_CHANGED_BEYOND_TOLERANCE:
        return 'Price changed too much. Please try again.';
      case ERROR_CODES.TRANSACTION_TIMEOUT:
        return 'Transaction timed out. Please retry.';
      default:
        return err.message;
    }
  }
  if (err instanceof Error) return err.message;
  return 'Unknown error';
}

Clean up on error

  • Clear intent/allowance refs and reset progress state:

- intentRef.current = null; allowanceRef.current = null; swapIntentRef.current = null; - reset step UI and pending flags

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.18%
按下载量换算52

Claude

32%
按下载量换算45

Cursor

18.26%
按下载量换算26

Gemini CLI

8.5%
按下载量换算12

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills