spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / hooks / past-users / past-users.ts
23 lines · 897 BRaw
1import type Provided from './provided'
2import { USER_REACHABLE_TIERS } from './user-reachable-tiers'
3
4/**
5 * What the `tool.describe`, `command.describe`, `agent.offer` and
6 * `agent.spawn` hooks do: an organization's subject continues past users.
7 *
8 * The subject is the organization's unless its pinned `e.provider.tier` is
9 * `user`, `builtin` or `core`: a policy-installed plugin (`prepend`,
10 * `append`), the managed folder, a policy MCP server, or no provider at all.
11 *
12 * @param e the event's input with its pinned `provider`
13 * @param next the hook's own continuation, handed whole
14 * @returns the result from append inward, or from every tier
15 */
16export function pastUsers<E extends Provided.Provided, R>(
17 e: E,
18 next: Provided.ProvidedNext<E, R>,
19): Promise<R> {
20 const isUsers = USER_REACHABLE_TIERS.includes(e.provider?.tier)
21
22 return isUsers ? next(e) : next.to(e, 'append')
23}