ui-context

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese


Primary Query

核心查询

Use this function to capture active UI state:
sql
SELECT get_ui_context_json();
Capture once per user question, then reuse that snapshot while answering. Capture again only when the user asks to refresh/re-check, or when a new UI-referential question starts.

使用此函数捕获活跃UI状态:
sql
SELECT get_ui_context_json();
每个用户问题捕获一次,在回答过程中复用该快照。仅当用户要求刷新/重新检查,或新的UI相关问题开始时,才重新捕获。

Trigger Patterns

触发场景

Use this skill for prompts like:
  • "what am I looking at?"
  • "what is on the screen?"
  • "what's selected?"
  • "look at what I'm doing"
  • references such as "this", "here", "current", "selected", "that", "previous"

当遇到以下类型的提示时使用此技能:
  • "我现在看的是什么?"
  • "屏幕上显示的是什么?"
  • "选中的内容是什么?"
  • "看看我正在操作的内容"
  • 指代性词汇如"这个"、"这里"、"当前"、"选中的"、"那个"、"之前的"

Capture Policy

捕获规则

  1. Call
    get_ui_context_json()
    before answering UI-referential prompts.
  2. Extract view info: widget type/title and custom-view state.
  3. Extract selection info when present: begin/end and preview text lines.
  4. Extract code anchor info when present: address, function, segment.
  5. If
    has_address: false
    , explain limits and do not invent code context.

  1. 在回答UI相关提示前调用
    get_ui_context_json()
  2. 提取视图信息:组件类型/标题和自定义视图状态。
  3. 若存在选中内容,提取选中范围和预览文本行。
  4. 若存在代码锚点信息,提取地址、函数、段。
  5. has_address: false
    ,说明限制条件,不得编造代码上下文。

Temporal Reference Rules

时间参考规则

  • this
    /
    here
    /
    current
    /
    selected
    : capture a fresh snapshot for this question.
  • that
    /
    previous
    /
    earlier
    : reuse the most recent snapshot in the same working flow.
  • If the user says "refresh", capture a new snapshot immediately.

  • this
    /
    here
    /
    current
    /
    selected
    :为此问题捕获新的快照。
  • that
    /
    previous
    /
    earlier
    :复用同一工作流中最近的快照。
  • 若用户说"refresh",立即捕获新快照。

Runtime Availability and Fallback

运行时可用性与降级方案

  • get_ui_context_json()
    is plugin GUI runtime only.
  • It is unavailable in idalib/CLI mode.
  • When unavailable, state this clearly and continue with non-UI queries (explicit addresses/symbols, or DB-orientation queries).
welcome
is database metadata only; it is not a UI context replacement.

  • get_ui_context_json()
    仅在插件GUI运行时可用。
  • 在idalib/CLI模式下不可用。
  • 当不可用时,明确告知用户,并继续处理非UI查询(如明确地址/符号查询,或数据库导向查询)。
welcome
仅包含数据库元数据,不能替代UI上下文。

Response Template

响应模板

Use this fixed shape after reading UI context:
  • What You Are Viewing
    : widget/view summary.
  • What Is Selected
    : selection range and preview (or "no active selection").
  • Code Context
    : address/function/segment if available; otherwise mention non-address view.
  • Limits
    : runtime constraints or missing fields affecting certainty.
  • Suggested Next Query
    : one concrete follow-up command/query.

读取UI上下文后,使用以下固定格式:
  • 当前视图
    :组件/视图摘要。
  • 选中内容
    :选中范围和预览(或"无活跃选中内容")。
  • 代码上下文
    :若可用则显示地址/函数/段;否则说明当前视图无地址信息。
  • 限制条件
    :影响判断的运行时约束或缺失字段。
  • 建议后续查询
    :一个具体的后续命令/查询。

Examples

示例

1) "What am I looking at?"

1) "我现在看的是什么?"

sql
SELECT get_ui_context_json();
Answer with the template fields above. Include focused widget title/type and current anchor address if present.
sql
SELECT get_ui_context_json();
使用上述模板字段回答。包含聚焦组件的标题/类型,以及当前锚点地址(若存在)。

2) "Look at what I'm doing"

2) "看看我正在操作的内容"

sql
SELECT get_ui_context_json();
Summarize active view and selection first, then propose the next action tied to that context (for example, decompile current function).
sql
SELECT get_ui_context_json();
先总结活跃视图和选中内容,然后结合该上下文提出下一步操作建议(例如反编译当前函数)。

3) "What's selected right now?"

3) "现在选中的内容是什么?"

sql
SELECT get_ui_context_json();
Prioritize selection begin/end and preview text. Explicitly state when there is no active selection.
sql
SELECT get_ui_context_json();
优先展示选中范围和预览文本。明确说明是否存在活跃选中内容。

4) "Explain this function"

4) "解释这个函数"

  1. Capture UI context.
  2. If function/address context exists, pivot to decompiler.
sql
SELECT get_ui_context_json();
SELECT decompile(0x401000);
Replace
0x401000
with the captured function/address anchor.
  1. 捕获UI上下文。
  2. 若存在函数/地址上下文,切换至反编译工具。
sql
SELECT get_ui_context_json();
SELECT decompile(0x401000);
0x401000
替换为捕获到的函数/地址锚点。

5) Follow-up: "What about that function?"

5) 后续问题:"那个函数怎么样?"

Reuse the most recent snapshot from the same flow (do not auto-refresh unless asked), then continue analysis from that stored anchor.
复用同一工作流中最近的快照(除非用户要求,否则不自动刷新),然后基于存储的锚点继续分析。

6) Non-address view (for example Local Types chooser)

6) 非地址视图(例如本地类型选择器)

sql
SELECT get_ui_context_json();
If
has_address: false
, report chooser selection details and state there is no code address anchor in this view.
sql
SELECT get_ui_context_json();
has_address: false
,报告选择器的选中详情,并说明此视图中无代码地址锚点。

7) Plugin API unavailable (CLI/idalib)

7) 插件API不可用(CLI/idalib)

If
get_ui_context_json()
cannot run:
  • state that UI context is unavailable in this runtime
  • ask for explicit symbol/address or continue with non-UI alternatives (for example
    SELECT * FROM welcome
    for DB orientation)

get_ui_context_json()
无法运行:
  • 说明此运行时环境下无法获取UI上下文
  • 请求用户提供明确的符号/地址,或继续处理非UI替代查询(例如使用
    SELECT * FROM welcome
    获取数据库导向信息)

Guardrails

约束规则

  • Do not treat
    welcome
    output as UI context.
  • Do not fabricate selection/address fields when absent.
  • Do not recapture repeatedly in one answer unless user asks for refresh.
  • 不得将
    welcome
    的输出视为UI上下文。
  • 当不存在选中内容/地址字段时,不得编造相关信息。
  • 除非用户要求刷新,否则在一次回答中不得重复捕获。