Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 4.03 KB

README.md

File metadata and controls

54 lines (43 loc) · 4.03 KB

@dshfiles/input-trigger

Codex-style @ token targeting

Owned MIT fork of DSH's shared /, @ and # autocomplete engine. It preserves the upstream source/controller/menu pipeline and resolves typed @ tokens the way Codex's composer does (src/caret-token.ts, ported from codex-rs/tui/src/bottom_pane/chat_composer/completion_target.rs):

  • the token is the whitespace-delimited run the caret touches, on either side of same-line separator whitespace; a line break never gives affinity, and a chip is an atomic boundary;
  • the hit spans the whole token, so a pick with the caret mid-token replaces all of it;
  • whitespace closes the menu: @ some sentence or @dsh trying to select it searches nothing. A title with spaces is found by one of its words (@deploy) or a quoted phrase (@"fix the deploy);
  • # is a third trigger with the same caret-token rules (an atomic chip, no affinity across a line break), so a source can offer pull requests and issues without a second gesture. # inside a URL stays prose: https://example.com/path#anchor opens nothing.

The backlog's plain text boxes import the same resolver through the @dshfiles/input-trigger/caret-token module, so every composer in the app opens and closes @ (and #) completion on the same rules.

The native Loader row is disabled by this bundle's Cordis patch. Source registrations keep using the inputTriggers service and its existing contract. This is tokenization only, not the separate Host session-query cost, so lookup latency is unchanged. See UPSTREAM.md for provenance and the update policy.

One mention and reference-preview registry

One shared reference card: hovering a backlog reference opens its item card

@dshfiles/input-trigger/entity-registry is the one place a plugin makes something mentionable (plan ade-ux §5 entityProvider). A provider adds one EntityKinds item:

plugin.add(EntityKinds, {
  kind: 'backlog',
  label: 'Backlog item',
  mentionPrefixes: ['b', 'backlog'], // `@b:` / `@backlog:` list only this kind
  mentionSource: mentions, // registered with `inputTriggers` here, in registry order
  Preview: decorate(BacklogCard), // the body of the one shared reference card
})
  • @ groups: input-trigger registers every mentionSource with its own inputTriggers service, so @ sources go through the registry. EntityRegistryModel.foreignScope(kinds, kind, query) tells a source that another kind owns the typed scope (mentions' file/thread source uses it instead of a hard-coded list).
  • References: @dshfiles/input-trigger/entity-reference exports ReferencePreviewAnchor, the one hover/focus behavior every kind wraps its chip in: a 160 ms dwell or focus calls EntityPreview.request({ kind, id, range? }, element), leaving or blurring calls EntityPreview.dismiss(), and the shared card waits out its grace before closing so the pointer can move into it. One shell.overlay card ([data-dshfiles-entity-preview="<kind>"]) positions itself under the reference, follows it while the page scrolls, closes when it scrolls away, and draws the kind's Preview. Decorations is an optional headless component the overlay keeps mounted (agents uses it to decorate @handle mentions from its live agent list).
  • Draft restore: a trigger source may declare restore(session, text): the serialized references its own text still names, as spans whose clipboardText equals the matched text. The composer's restoreReferences() asks the per-session controller for every source's spans, drops overlaps, and re-imports the draft with those chips — so a queued message comes back as the chips it was sent with.
  • Providers today: mentions (files and threads), thread-sidebar (skills), mcp-servers (@mcp:), backlog (b:), agents (@handle), memory (memory: n:… / t:…). A provider that is not loaded simply contributes nothing.
pnpm test
pnpm typecheck
pnpm build