@agi-cli/sdk 0.1.117 → 0.1.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/sdk",
3
- "version": "0.1.117",
3
+ "version": "0.1.119",
4
4
  "description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
5
5
  "author": "ntishxyz",
6
6
  "license": "MIT",
@@ -1,23 +1,28 @@
1
1
  import { tool, type Tool } from 'ai';
2
2
  import { z } from 'zod';
3
- import DESCRIPTION from './plan.txt' with { type: 'text' };
3
+ import DESCRIPTION from './todos.txt' with { type: 'text' };
4
4
 
5
- const STATUS_ENUM = z.enum(['pending', 'in_progress', 'completed']);
5
+ const STATUS_ENUM = z.enum([
6
+ 'pending',
7
+ 'in_progress',
8
+ 'completed',
9
+ 'cancelled',
10
+ ]);
6
11
 
7
- const ITEM_SCHEMA = z
12
+ const TODO_SCHEMA = z
8
13
  .union([
9
- z.string().min(1, 'Plan steps must be non-empty'),
14
+ z.string().min(1, 'Todo steps must be non-empty'),
10
15
  z.object({
11
- step: z.string().min(1, 'Plan steps must be non-empty'),
16
+ step: z.string().min(1, 'Todo steps must be non-empty'),
12
17
  status: STATUS_ENUM.optional(),
13
18
  }),
14
19
  ])
15
- .describe('Plan item');
20
+ .describe('Todo item');
16
21
 
17
- type PlanItemInput = z.infer<typeof ITEM_SCHEMA>;
22
+ type TodoItemInput = z.infer<typeof TODO_SCHEMA>;
18
23
 
19
24
  function normalizeItems(
20
- raw: PlanItemInput[],
25
+ raw: TodoItemInput[],
21
26
  ): Array<{ step: string; status: z.infer<typeof STATUS_ENUM> }> {
22
27
  const normalized = raw.map((item) => {
23
28
  if (typeof item === 'string') {
@@ -30,29 +35,32 @@ function normalizeItems(
30
35
 
31
36
  const filtered = normalized.filter((item) => item.step.length > 0);
32
37
  if (!filtered.length) {
33
- throw new Error('At least one plan step is required');
38
+ throw new Error('At least one todo item is required');
34
39
  }
35
40
 
36
41
  const inProgressCount = filtered.filter(
37
42
  (item) => item.status === 'in_progress',
38
43
  ).length;
39
44
  if (inProgressCount > 1) {
40
- throw new Error('Only one plan step may be marked as in_progress');
45
+ throw new Error('Only one todo item may be marked as in_progress');
41
46
  }
42
47
 
43
48
  return filtered;
44
49
  }
45
50
 
46
- export const updatePlanTool: Tool = tool({
51
+ export const updateTodosTool: Tool = tool({
47
52
  description: DESCRIPTION,
48
53
  inputSchema: z.object({
49
- items: z.array(ITEM_SCHEMA).min(1).describe('Ordered list of plan steps'),
54
+ todos: z
55
+ .array(TODO_SCHEMA)
56
+ .min(1)
57
+ .describe('The complete list of todo items'),
50
58
  note: z
51
59
  .string()
52
60
  .optional()
53
- .describe('Optional note or context for the plan update'),
61
+ .describe('Optional note or context for the update'),
54
62
  }),
55
- async execute({ items, note }: { items: PlanItemInput[]; note?: string }) {
56
- return { items: normalizeItems(items), note };
63
+ async execute({ todos, note }: { todos: TodoItemInput[]; note?: string }) {
64
+ return { items: normalizeItems(todos), note };
57
65
  },
58
66
  });
@@ -0,0 +1,7 @@
1
+ - Create and manage a list of subtasks for complex requests
2
+ - Displays ordered todo items with status and optional note to the user
3
+
4
+ Usage tips:
5
+ - Keep descriptions concise (imperative verbs)
6
+ - Update the todos whenever scope changes or new tasks emerge
7
+ - Mark items as in_progress when starting, completed when done
@@ -9,7 +9,7 @@ import { buildRipgrepTool } from './builtin/ripgrep.ts';
9
9
  import { buildGrepTool } from './builtin/grep.ts';
10
10
  import { buildGlobTool } from './builtin/glob.ts';
11
11
  import { buildApplyPatchTool } from './builtin/patch.ts';
12
- import { updatePlanTool } from './builtin/plan.ts';
12
+ import { updateTodosTool } from './builtin/todos.ts';
13
13
  import { editTool } from './builtin/edit.ts';
14
14
  import { buildWebSearchTool } from './builtin/websearch.ts';
15
15
  import { buildTerminalTool } from './builtin/terminal.ts';
@@ -125,8 +125,8 @@ export async function discoverProjectTools(
125
125
  // Patch/apply
126
126
  const ap = buildApplyPatchTool(projectRoot);
127
127
  tools.set(ap.name, ap.tool);
128
- // Plan update
129
- tools.set('update_plan', updatePlanTool);
128
+ // Todo tracking
129
+ tools.set('update_todos', updateTodosTool);
130
130
  // Edit
131
131
  tools.set('edit', editTool);
132
132
  // Web search
@@ -139,7 +139,7 @@ Use `progress_update` tool at these key phases:
139
139
  - Don't spam - 4-6 updates per task is ideal
140
140
 
141
141
  # Task Management
142
- You have access to the `update_plan` tool to help you manage and plan tasks.
142
+ You have access to the `update_todos` tool to help you manage and plan tasks.
143
143
  Use this tool FREQUENTLY to:
144
144
  1. Create a plan with ordered steps at the start of complex tasks
145
145
  2. Mark steps as `in_progress` when starting them
@@ -154,13 +154,13 @@ Examples:
154
154
 
155
155
  <example>
156
156
  user: Run the build and fix any type errors
157
- assistant: I'm going to use the update_plan tool to write the following items to the todo list:
157
+ assistant: I'm going to use the update_todos tool to write the following items to the todo list:
158
158
  - Run the build
159
159
  - Fix any type errors
160
160
 
161
161
  I'm now going to run the build using Bash.
162
162
 
163
- Looks like I found 10 type errors. I'm going to use the update_plan tool to write 10 items to the todo list.
163
+ Looks like I found 10 type errors. I'm going to use the update_todos tool to write 10 items to the todo list.
164
164
 
165
165
  marking the first todo as in_progress
166
166
 
@@ -175,7 +175,7 @@ In the above example, the assistant completes all the tasks, including the 10 er
175
175
  <example>
176
176
  user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
177
177
 
178
- assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the update_plan tool to plan this task.
178
+ assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the update_todos tool to plan this task.
179
179
  Adding the following todos to the todo list:
180
180
  1. Research existing metrics tracking in the codebase
181
181
  2. Design the metrics collection system
@@ -193,7 +193,7 @@ I've found some existing telemetry code. Let me mark the first todo as in_progre
193
193
 
194
194
  # Doing tasks
195
195
  The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
196
- - Use the update_plan tool to plan the task if required
196
+ - Use the update_todos tool to plan the task if required
197
197
  - Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
198
198
  - Implement the solution using all tools available to you
199
199
  - Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.
@@ -213,7 +213,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
213
213
  - When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.
214
214
  - You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
215
215
 
216
- IMPORTANT: Always use the update_plan tool to plan and track tasks throughout the conversation.
216
+ IMPORTANT: Always use the update_todos tool to plan and track tasks throughout the conversation.
217
217
 
218
218
  # Apply Patch Tool - Critical Guidelines for Claude
219
219
 
@@ -30,7 +30,7 @@ You have access to a rich set of specialized tools optimized for coding tasks:
30
30
 
31
31
  **Execution & Planning**:
32
32
  - `bash`: Execute shell commands
33
- - `update_plan`: Create and track task plans
33
+ - `update_todos`: Create and track task plans
34
34
  - `progress_update`: Update user on current phase
35
35
  - `finish`: Signal task completion (REQUIRED at end)
36
36
 
@@ -41,7 +41,7 @@ You have access to a rich set of specialized tools optimized for coding tasks:
41
41
  3. **Combine Edits**: When editing the same file multiple times, use ONE `edit` call with multiple ops
42
42
  4. **Search First**: Use `glob` to find files before reading them
43
43
  5. **Progress Updates**: Call `progress_update` at major milestones (planning, discovering, writing, verifying)
44
- 6. **Plan Tracking**: Use `update_plan` to show task breakdown and progress
44
+ 6. **Plan Tracking**: Use `update_todos` to show task breakdown and progress
45
45
  7. **Finish Required**: Always call `finish` tool when complete
46
46
 
47
47
  ### Tool Failure Handling
@@ -185,13 +185,13 @@ Before making tool calls, send a brief preamble to the user explaining what you'
185
185
 
186
186
  ## Planning
187
187
 
188
- You have access to an `update_plan` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.
188
+ You have access to an `update_todos` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.
189
189
 
190
190
  Note that plans are not for padding out simple work with filler steps or stating the obvious. The content of your plan should not involve doing anything that you aren't capable of doing (i.e. don't try to test things that you can't test). Do not use plans for simple or single-step queries that you can just do or answer immediately.
191
191
 
192
- Do not repeat the full contents of the plan after an `update_plan` call — the harness already displays it. Instead, summarize the change made and highlight any important context or next step.
192
+ Do not repeat the full contents of the plan after an `update_todos` call — the harness already displays it. Instead, summarize the change made and highlight any important context or next step.
193
193
 
194
- Before running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_plan` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.
194
+ Before running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_todos` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.
195
195
 
196
196
  Use a plan when:
197
197
 
@@ -465,12 +465,12 @@ Before calling `apply_patch`, verify ALL of these:
465
465
  - Solution: Read file AGAIN, verify context character-by-character
466
466
  - After 2+ failures: use `edit` tool instead (more forgiving)
467
467
 
468
- ## `update_plan`
468
+ ## `update_todos`
469
469
 
470
- A tool named `update_plan` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.
470
+ A tool named `update_todos` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.
471
471
 
472
- To create a new plan, call `update_plan` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).
472
+ To create a new plan, call `update_todos` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).
473
473
 
474
- When steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.
474
+ When steps have been completed, use `update_todos` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_todos` call.
475
475
 
476
- If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
476
+ If all steps are complete, ensure you call `update_todos` to mark all steps as `completed`.
@@ -19,7 +19,7 @@ Your primary tools for coding tasks are:
19
19
  - **Discovery**: `glob` (find files), `ripgrep` (search content), `tree` (directory structure)
20
20
  - **Reading**: `read` (individual files), `ls` (directory listing)
21
21
  - **Execution**: `bash` (run commands), `git_*` tools (version control)
22
- - **Planning**: `update_plan` (create and track task plans)
22
+ - **Planning**: `update_todos` (create and track task plans)
23
23
  - **Progress**: `progress_update` (inform user of current phase)
24
24
 
25
25
  ## Search & Discovery Workflow
@@ -116,15 +116,15 @@ Examples of operations to batch:
116
116
 
117
117
  ## Planning
118
118
 
119
- You have access to an `update_plan` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.
119
+ You have access to an `update_todos` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.
120
120
 
121
121
  Note that plans are not for padding out simple work with filler steps or stating the obvious. The content of your plan should not involve doing anything that you aren't capable of doing (i.e. don't try to test things that you can't test). Do not use plans for simple or single-step queries that you can just do or answer immediately.
122
122
 
123
- Do not repeat the full contents of the plan after an `update_plan` call — the harness already displays it. Instead, summarize the change made and highlight any important context or next step.
123
+ Do not repeat the full contents of the plan after an `update_todos` call — the harness already displays it. Instead, summarize the change made and highlight any important context or next step.
124
124
 
125
- Before running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_plan` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.
125
+ Before running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_todos` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.
126
126
 
127
- When creating plans, always use the `update_plan` tool, not inline markdown lists.
127
+ When creating plans, always use the `update_todos` tool, not inline markdown lists.
128
128
  Mark steps with status: `pending`, `in_progress`, or `completed`.
129
129
  Keep steps concise (5-7 words max per step) but meaningful.
130
130
 
@@ -403,12 +403,12 @@ GPT-4 models (especially GPT-4o) often fail patches by:
403
403
  - Solution: Read file AGAIN, copy exact lines
404
404
  - After 2 failures: switch to `edit` tool instead
405
405
 
406
- ## `update_plan`
406
+ ## `update_todos`
407
407
 
408
- A tool named `update_plan` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.
408
+ A tool named `update_todos` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.
409
409
 
410
- To create a new plan, call `update_plan` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).
410
+ To create a new plan, call `update_todos` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).
411
411
 
412
- When steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.
412
+ When steps have been completed, use `update_todos` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_todos` call.
413
413
 
414
- If all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.
414
+ If all steps are complete, ensure you call `update_todos` to mark all steps as `completed`.
@@ -1,6 +0,0 @@
1
- - Publish or update the current execution plan
2
- - Displays ordered steps and optional note/context to the user
3
-
4
- Usage tips:
5
- - Keep steps concise (imperative verbs) and reflect progress updates
6
- - Update the plan whenever scope changes or new steps emerge