File size: 2,298 Bytes
814c07e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Tools lifted verbatim from the official Cactus `needle playground`.
// These three are the playground's defaults — keeping them identical lets visitors
// recognize the demo as a browser version of the same tool.

const setTimerTool = {
  name: 'set_timer',
  description: 'Set a timer for the specified duration or end time.',
  parameters: {
    time_human: {
      type: 'string',
      description:
        "The duration or target end time in human readable format e.g. '1 hour and 30 minutes', '45 minutes', 'for 1:50pm', 'at 13:30'.",
      required: true,
    },
  },
};

const sendEmailTool = {
  name: 'send_email',
  description: 'Send an email to a recipient.',
  parameters: {
    to:      { type: 'string', description: "The recipient's email address.", required: true },
    subject: { type: 'string', description: 'The email subject line.',        required: true },
    body:    { type: 'string', description: 'The email body text.',           required: true },
  },
};

const createNoteTool = {
  name: 'create_note',
  description: 'Create a new note with the given text.',
  parameters: {
    text: { type: 'string', description: 'The text content of the note.', required: true },
  },
};

export const DEFAULT_TOOLS = [setTimerTool, sendEmailTool, createNoteTool];

export interface Example {
  label: string;      // shown on the chip
  query: string;      // populates the Query input
  tools?: unknown[];  // defaults to DEFAULT_TOOLS
}

// USER CONTRIBUTION POINT #3 — preset queries (Task 13)
// Each preset should be a query whose ideal output is a clear function call
// on one of the three default tools. Visitors click a chip and immediately
// see Needle produce convincing JSON.
//
// Current selection (each targets a different tool):
//   1. "set a 5 min timer"              → set_timer       (the official playground's example)
//   2. "email alice@example.com that the meeting moved to 3pm"  → send_email
//   3. "remind me to buy milk on the way home"                  → create_note
export const EXAMPLES: Example[] = [
  { label: 'Set a timer',  query: 'set a 5 min timer' },
  { label: 'Send email',   query: 'email alice@example.com that the meeting moved to 3pm' },
  { label: 'Create note',  query: 'remind me to buy milk on the way home' },
];