跳到正文
cccskills
免费在 GitHub 公开

association-entity-select

AssociationEntitySelect, the name dropdown for the note, session, chat, or document a panel is bound to. Use when a surface must show that name and let the user rename, switch, unlink, or add new ('add a note switcher', 'show the session name'). NOT for count cards or row lists (use canonical-associations).

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

查看安装方法

包含的文件(1)

  • SKILL.md6.5 KB

SKILL.md(原文)

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

AssociationEntitySelect — the canonical name dropdown

W5 SWAP NOTICE (2026-08-29): the association/category UI + hooks + service implementations now ship in @ai-matrx/associations (/react for faces + hooks, /core for the headless services/store). Paths in this document that point at features/scopes/components/associations/**, features/scopes/components/Category*, or features/scopes/redux/** association/category fragments refer to DELETED files — import from @ai-matrx/associations/react (hooks also re-exported under features/scopes/hooks/), and see features/scopes/host/ for the host binding. The rules and contracts described remain in force.

One control, five jobs, per (token, container): display the active entity's real name (registry icon) · inline rename (click the name) · switch via an always-visible dropdown (searchable past 5 items) · per-row unlink (non-active rows, edge only — never deletes the entity) · trailing "+ New <Entity>" that creates + associates + activates (typed search text doubles as the new name).

Component: features/scopes/components/associations/AssociationEntitySelect.tsx. Redux-free; everything flows through an adapter. Docs: features/scopes/FEATURE.md §"Association cards + list".

The CREATE-then-ASSOCIATE contract (applies to EVERY association surface)

Two component classes, one law each:

  1. Associate-existing (pickers, "Add" panels): the ONLY job is the edge — it must be written and verified (AssociationWriteResult.ok), and failure must toast. An "attach" that silently no-ops is the bug class.
  2. Create-then-associate (upload file → attach, "+ New Note", new doc → attach): the item is created FIRST (durable row — it exists in the user's library regardless of what happens next), the edge is written SECOND (idempotent, retry-once is safe). Every terminal outcome is loud, and a created-but-unlinked item is reported WITH its location ("Uploaded to your Files (War Room folder) but couldn't attach — use Add file to retry"). The user gesture must never end in silence: cancellation, zero-result, create-failure, and attach-failure each get their own message. A created item that vanishes without a trace is the exact bug this contract kills.

References: ThreadResourcesTab.handleFilesSelected (upload → attach, all outcomes loud) and useAssociationEntitySelectAdapter.createAndAttach (create → attach with retry + created-but-unlinked toast).

Rules

  • Never rebuild any face of this — no bespoke note/session switchers, no standalone rename spans next to a separate dropdown, no "+ New X" menu items wired by hand. If a toolbar shows an entity's name, this component owns that name.
  • The dropdown never hides. items.length === 1 (or 0) still renders the chevron — "add another" must always be reachable. That gap is the bug this component exists to kill.
  • Unlink ≠ delete: detach removes the association edge only. The active row never shows the X (switch first).
  • Registry-driven: icon/labels come from getEntityInfo(token). The token needs a titleColumn in ENTITY_OVERLAY (features/scopes/registry/entityRegistry.ts) for generic create/rename.
  • Not this control: count cards (AssociationCard), row lists (AssociationList), and cross-type attach (UniversalAssociationPicker) — those faces are the canonical-associations skill.

Plain container → default adapter

import { AssociationEntitySelect } from "@/features/scopes/components/associations/AssociationEntitySelect";
import { useAssociationEntitySelectAdapter } from "@/features/scopes/hooks/useAssociationEntitySelect";

const adapter = useAssociationEntitySelectAdapter({
  token: "note",
  container: { type: "project", id: projectId, orgId },
  activeId,            // optional (controlled); omit → first attached row
  onActiveChange,      // optional
  createColumns: {},   // NOT NULL columns the registry conventions can't know
});
<AssociationEntitySelect token="note" adapter={adapter} />

Reads via useContainerLinks + useEntityTitles; creates via createEntityRow + attach; renames via renameEntityRow. Both row writes live in features/scopes/service/entityRows.ts (registry titleColumn + owner/org conventions, loud errors, primes primeEntityTitle so no surface renders stale).

Bespoke lifecycle → implement AssociationEntitySelectAdapter

When the surface has its own active semantics or create pipeline, implement the interface (exported from the component file): { loading, items, activeId, setActive, createAndAttach, rename, detach? }.

Reference implementation: features/war-room/hooks/useThreadEntitySelect.ts — useThreadNoteSelectAdapter (is_active edge metadata, notes autosave rename via notesApi.update + upsertNoteFromServer) and useThreadAudioSessionSelectAdapter (studio_sessions titles + updateSessionThunk rename). Consumers: ThreadNotesTab / ThreadAudioTab / ThreadAgentTab.

Adapter contract details:

  • createAndAttach(title) must create the row, write the association, AND make it active; return the new id or null. Optional — omit it when creation isn't name-driven and pass the component's createSlot instead: a custom footer (ReactNode or (close) => ReactNode) replacing the name-input creator. Reference: the war-room Chat tab passes the canonical AgentListDropdown — "+ New Chat" = pick an AGENT, which mints a conversation (startThreadConversation); the label shows the agent's name until the server auto-labels the conversation after its first turn (useThreadConversationSelectAdapter's label chain).
  • rename(id, title) returns false on failure (the component toasts + keeps the editor open). Call primeEntityTitle(token, id, title) on success.
  • Items carry real titles — positional fallbacks (Note 2, Recording 3) only for unhydrated rows.

Props worth knowing

renameActivation ("click" | "doubleClick", default click) · align · emptyLabel · showIcon / iconClassName · className / labelClassName. Toolbar-dense by default (h-6, type-secondary).

评价

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

评论

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

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

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

0 / 1000 字

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

同一仓库的技能

Admin debug system wiring for the floating AdminIndicator's live debug data and Copy Full Context. Use when adding debug visibility to a route or feature, wiring useDebugContext or the debug panel, capturing console errors, or enabling the copy-context workflow for a page.

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

armanisadeghi/ai-matrx32026年10月20日 更新

Compact two-icon Copy / Copy-for-AI controls (components/agent-copy). Use when adding copy buttons to a row, card, list, or record; merging duplicate Copy/JSON/AI controls; continuing the copy rollout; or writing a Copy-for-AI payload. NOT for markdown content actions (use rich-document-actions).

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

armanisadeghi/ai-matrx32026年10月20日 更新

Disclosing a surface's existing fixed AI jobs in the shell's top Agents menu. Use when a page, panel, overlay, or window already runs a mandate behind a button, assist, automatic action, or mode; when the agent-disclosure guard names a file; or during a surface check.

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

armanisadeghi/ai-matrx32026年10月20日 更新

The watch-fix-rerun method for making an existing platform agent or automated process efficient and correct: baseline its ledger, run one unit yourself, fix the class behind every wasted call, rerun, record. Use when asked to improve, optimize, watch, or 'make efficient' an agent, a sandbox session, a sync job, or any recurring automated process.

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

armanisadeghi/ai-matrx32026年10月20日 更新

Redux state for agent execution and firing agent shortcuts. Use when editing features/agents/redux/, building agent UI, creating a conversation, touching assembleRequest or NDJSON stream state, wiring agent-state selectors, adding a per-conversation capability, or triggering a shortcut from a button, menu, or code (useShortcutTrigger, launchAgentExecution).

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

armanisadeghi/ai-matrx32026年10月20日 更新

The provision for a call site: the exhaustive menu of values that place in the code can realistically produce. Use before creating or fixing a mandate or agent that reasons about more than its own input, when deciding whether an agent can answer at all with what it is sent, or when its output 'looks right' but nobody checked it could be. NOT for building the agent (use create-agent).

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

armanisadeghi/ai-matrx32026年10月20日 更新

查看 armanisadeghi 的全部技能

报告此技能的问题