跳到正文
cccskills
免费在 GitHub 公开

review-ipc

Audit IPC message contracts between extensions and the Asyar host. Use when adding a new SDK service, adding a new proxy method, changing a postMessage type string, or reviewing permission gate coverage.

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar星标 946(GitHub 946 + cccskills 0)

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md8.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

review-ipc

Audit the IPC layer across the SDK, permission gate, and host listener for correctness and completeness.

Context: the worker/view bridge

Every Tier 2 extension operates across two execution contexts following the Separation of Headless Compute and Visual Canvas:

  • Worker (role: 'worker'): Always-on headless compute running off-main-thread (Web Worker / worker host context, or fallback iframe).
  • View (role: 'view'): On-demand visual canvas running in a sandboxed <iframe> (view.html).

Each context imports from its dedicated SDK entry (asyar-sdk/worker vs asyar-sdk/view) and owns its own MessageBroker and ExtensionContext. The IPC bridge audited here therefore covers both contexts' calls into the host. ExtensionIpcRouter maps the caller back to its identity and role — services that branch on role read it off the dispatch context.

For the runtime details (state machine, mailbox, RPC), see docs/explanation/extension-runtime.md; for the per-message protocol, see docs/explanation/ipc-bridge.md.

What to check

1. Type string format consistency

All SDK proxy methods must call broker.invoke('{service}:{action}', ...). The MessageBroker prepends asyar:api: automatically, producing asyar:api:{service}:{action}. Verify:

  • Every this.broker.invoke(...) call in asyar-sdk/src/services/*Proxy.ts uses the {service}:{action} format (no asyar:api: prefix — that's added by MessageBroker)
  • The resulting full type (asyar:api:{service}:{action}) is classified in the Rust gate — asyar-launcher/src-tauri/src/permissions.rs: either get_required_permission (needs a manifest permission) or is_public_call (deliberately permission-free). That is the ONLY enforcement point — there is no JS-side gate to update
  • The gate fails closed (since 2026-07-24): a call type in neither list is DENIED, so a new proxy method nobody classified breaks loudly instead of becoming default-allowed
  • New proxies are added to the right entry's bag: the worker entry (asyar-sdk/src/worker.ts) only exposes proxies that don't depend on the DOM or user interaction; the view entry (asyar-sdk/src/view.ts) exposes the full bag — it re-exports contracts.ts, which is where the shared proxies and ExtensionContext live. A misclassified proxy is a Phase-6 regression.

2. Permission gate coverage

Coverage is auto-enforced by asyar-launcher/scripts/permission-coverage.test.mjs (runs in CI via vitest): it extracts every .invoke('service:action') call type in the SDK and fails if any is not classified in the Rust gate (get_required_permission ∪ is_public_call). A forgotten mapping turns CI red — you no longer hand-audit this.

When adding/auditing a gated API, edit asyar-launcher/src-tauri/src/permissions.rs:

  • Add gated calls to get_required_permission — the permission string must be a valid manifest permission (e.g. clipboard:read, network, fs:read, runs:track, tools:register). The generated gatedPermissions.ts (launcher + SDK CLI copies) is derived from it by scripts/generate-permission-catalog.mjs — run pnpm gen:permission-catalog
  • Add deliberately permission-free calls to is_public_call (with a one-line rationale) — do NOT rely on fall-through, which now denies
  • Verify with pnpm exec vitest run scripts/permission-coverage.test.mjs and cargo test permissions::tests

3. Tier 1 action registration

Tier 1 (built-in) extensions must not use ActionServiceProxy for registering actions. Callbacks are stripped by JSON.stringify in postMessage serialization.

Check every file in asyar-launcher/src/built-in-features/*/index.ts:

  • Actions must be registered via actionService.registerAction(...) (the host singleton imported from ../../services/action/actionService.svelte)
  • Any use of context.getService<IActionService>('actions') for registering callbacks should be flagged

4. IPC response path

Verify that for any new service method added to a proxy:

  • The host-side handler exists in asyar-launcher/src/services/extension/ExtensionIpcRouter.ts or a dedicated service file
  • Replies use event.source so they land in the requesting execution context. Post { type: 'asyar:response', messageId, result } with a target origin for iframe windows; Web Worker sources take only the message (no window target-origin argument)
  • Error path sends { type: 'asyar:response', messageId, error: string }
  • Host → extension messages go through postToExtension(extensionId, role, message) in asyar-launcher/src/services/extension/extensionDelivery.ts, which routes to Web Workers or compatibility iframes. Use { fallback: false } for strictly role-scoped subscriptions. Reserve pickExtensionIframe for iframe-specific operations such as view focus and readiness scans; never assume a worker is an iframe

5. Role-aware dispatch checks (Phase 6+)

When auditing services that branch on iframe role:

  • actions.registerActionHandler is role-neutral — registering from either role is supported and the launcher routes the matching asyar:action:execute envelope back to whichever role registered
  • commands.onCommand for a mode: "background" manifest command must register from the worker; the launcher dispatches background-mode commands to the worker execution context
  • state:rpcRequest / state:rpcReply envelopes carry the worker↔view RPC protocol; the worker-side interceptor in asyar-sdk/src/worker.ts is the only place that calls extensionRpc.deliverActionPayload(...). View-side calls go through context.request(...) only.

Files to read

  • asyar-sdk/src/ipc/MessageBroker.ts — confirms broker.invoke() prepends asyar:api:
  • asyar-sdk/src/services/*Proxy.ts — all proxy service files
  • asyar-sdk/src/worker.ts, asyar-sdk/src/view.ts, asyar-sdk/src/contracts.ts — entry-point split
  • asyar-launcher/src-tauri/src/permissions.rs — the real gate (get_required_permission + is_public_call + gate_decision, fail-closed)
  • asyar-launcher/scripts/permission-coverage.test.mjs — the CI coverage gate (SDK call types ⊆ classified)
  • asyar-launcher/src/services/extension/ExtensionIpcRouter.ts — host IPC handler + role-source mapping
  • asyar-launcher/src/services/extension/extensionIframeSelector.ts — pickExtensionIframe role-prefer/fallback selector
  • asyar-launcher/src/built-in-features/*/index.ts — Tier 1 action registration

Host → Extension Push Messages (out of scope for this audit)

The host sends two push message types directly into extension iframes. These are not extension API calls — they originate from the host and require no permission gate:

Message typeDirectionPurpose
asyar:theme:variableshost → iframeInjects all CSS custom properties on load and on theme change
asyar:theme:fontshost → iframeSends Satoshi + JetBrains Mono as base64 @font-face CSS on load

Sender: ExtensionIframe.svelte (handleIframeLoad, MutationObserver) Receiver: ExtensionContext.ts setupThemeInjection() in the SDK

These are host→iframe pushes, not extension calls, so they never reach the gate — do not flag them as missing.

Output format

Report findings grouped by category:

  1. Missing permission gate entries — type string + which proxy method
  2. Tier 1 proxy misuse — file + line where ActionServiceProxy is misused
  3. Orphaned gate entries — call types in get_required_permission/is_public_call with no matching SDK .invoke() (dead classification)
  4. IPC response path gaps — proxy methods with no corresponding host handler
  5. Clean — explicitly state if a category has no issues

If the request names a single service (e.g. "review-ipc for notifications"), scope the review to that service only.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use before planning or implementing ANY feature, bug fix, refactor, or API change that touches Asyar's architecture — extension system, service layer, IPC contracts, Tauri commands, manifest contributions, or cross-layer data flow. Triggers on new features, new extension APIs, new services, bug fixes involving multiple layers, refactors of infrastructure code, adding new contribution points, and any work that could affect how built-in features or third-party extensions interact with the platform. Also triggers on any task where you need to decide which architectural layer owns the logic, whether Tier 2 extensions can use a capability, or whether a change requires a manifest/permission update. Does NOT trigger for pure CSS/styling fixes (use design-language), isolated unit tests, documentation updates, version bumps, mechanical renames, or answering informational questions about the codebase.

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar9462026年10月27日 更新

Use when building, modifying, or fixing any frontend UI in the Asyar launcher — new components, new views, layout changes, styling decisions, new built-in features, visual bug fixes, and anything in settings or onboarding. Answers "what do I use here?" for fonts, colour, typography, spacing, motion, components, and layout.

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar9462026年10月27日 更新

Reference for the Asyar monorepo structure, SDK workspace linking, lockfile discipline, CI workflows, and release flow. Use this skill whenever working on anything related to pnpm workspace setup, the asyar-sdk dependency, lockfile errors, SDK or launcher version bumps, CI configuration, release workflow, or questions about how local dev differs from CI. Also triggers for "how does the workspace work", "how do I update the SDK version", "where do I run pnpm install", or any confusion about the monorepo layout.

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar9462026年10月27日 更新

Never hand-edit or hand-copy generated content. Use when touching permissions.rs, error.rs, AppError/SearchError variants, runtimes/catalog.fallback.json, any `#[derive(specta::Type)]` struct, any file with an AUTO-GENERATED banner (kinds.ts, gatedPermissions.ts, knownRuntimes.ts, bindings.ts, emoji data), or whenever you are about to write a TypeScript list/type that mirrors a Rust source.

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar9462026年10月27日 更新

tdd

免费

Use when implementing any new feature or fixing any bug in this project — both Rust (src-tauri) and TypeScript/Svelte 5 (src). Triggers on phrases like "add X", "fix Y", "implement Z", "change how W works".

中文简介正在准备中。当前显示原文说明。

Xoshbin/asyar9462026年10月27日 更新

查看 Xoshbin 的全部技能

报告此技能的问题