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 / tests / fixtures / caught / started.ts
26 lines · 739 BRaw
1import type { TargetTier, ToolInfo, ValueOrDeny } from 'claude-code'
2
3import { TOOLS } from '../tools.js'
4
5/**
6 * A `tool.list` hook's `next` that keeps the order its two runs were
7 * started in, each answering the session's tools.
8 *
9 * @param order filled as the runs start: `chain`, then `past <tier>`
10 * @returns the stand-in
11 */
12export const started = (order: (text: string) => void) =>
13 Object.assign(
14 (_e: unknown): Promise<ValueOrDeny<ToolInfo[]>> => {
15 order('chain')
16
17 return Promise.resolve({ value: [...TOOLS] })
18 },
19 {
20 to: (_e: unknown, tier: TargetTier): Promise<ValueOrDeny<ToolInfo[]>> => {
21 order(`past ${tier}`)
22
23 return Promise.resolve({ value: [...TOOLS] })
24 },
25 },
26 )