Skip to content

Commit 75972c4

Browse files
committed
fix sql tools
1 parent 465c9cf commit 75972c4

112 files changed

Lines changed: 552 additions & 552 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/agent/inheritance-pattern.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ protected function provider(): AIProviderInterface
2727
protected function instructions(): string
2828
{
2929
return <<<'INSTRUCTIONS'
30-
You are a data analyst AI assistant. Your role is to:
31-
- Analyze data and provide insights
32-
- Perform calculations accurately
33-
- Explain your reasoning clearly
34-
- Present findings in a structured format
35-
INSTRUCTIONS;
30+
You are a data analyst AI assistant. Your role is to:
31+
- Analyze data and provide insights
32+
- Perform calculations accurately
33+
- Explain your reasoning clearly
34+
- Present findings in a structured format
35+
INSTRUCTIONS;
3636
}
3737

3838
protected function tools(): array

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
earlyReturn: true,
1919
)
2020
->withRules([
21-
AddReturnTypeDeclarationRector::class
21+
AddReturnTypeDeclarationRector::class,
2222
])
2323
->withSkip([
2424
\Rector\DeadCode\Rector\For_\RemoveDeadIfForeachForRector::class => [
25-
__DIR__ . '/src/Workflow/WorkflowHandler.php'
25+
__DIR__ . '/src/Workflow/WorkflowHandler.php',
2626
],
2727
]);

src/Agent/Middleware/Summarization.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,17 @@ protected function generateSummary(array $messages): string
199199
protected function getDefaultSummaryPrompt(): string
200200
{
201201
return <<<'PROMPT'
202-
Please provide a comprehensive summary of the following conversation.
203-
Extract the highest quality and most relevant pieces of information, including:
204-
- Key topics discussed
205-
- Important decisions made
206-
- Critical information exchanged
207-
- Action items or next steps
208-
- Any unresolved questions or issues
209-
210-
Your summary should be concise yet informative, capturing the essential context
211-
that would be needed to continue the conversation meaningfully.
212-
PROMPT;
202+
Please provide a comprehensive summary of the following conversation.
203+
Extract the highest quality and most relevant pieces of information, including:
204+
- Key topics discussed
205+
- Important decisions made
206+
- Critical information exchanged
207+
- Action items or next steps
208+
- Any unresolved questions or issues
209+
210+
Your summary should be concise yet informative, capturing the essential context
211+
that would be needed to continue the conversation meaningfully.
212+
PROMPT;
213213
}
214214

215215
/**

src/Agent/Middleware/TodoPlanning.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
class TodoPlanning implements WorkflowMiddleware
1616
{
1717
protected const DEFAULT_SYSTEM_PROMPT = <<<'PROMPT'
18-
---
18+
---
1919
20-
## `write_todos`
20+
## `write_todos`
2121
22-
You have access to the `write_todos` tool to help you manage and plan complex objectives.
23-
Use this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.
24-
This tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.
22+
You have access to the `write_todos` tool to help you manage and plan complex objectives.
23+
Use this tool for complex objectives to ensure that you are tracking each necessary step and giving the user visibility into your progress.
24+
This tool is very helpful for planning complex objectives, and for breaking down these larger complex objectives into smaller steps.
2525
26-
It is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.
27-
For simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.
28-
Writing todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.
26+
It is critical that you mark todos as completed as soon as you are done with a step. Do not batch up multiple steps before marking them as completed.
27+
For simple objectives that only require a few steps, it is better to just complete the objective directly and NOT use this tool.
28+
Writing todos takes time and tokens, use it when it is helpful for managing complex many-step problems! But not for simple few-step requests.
2929
30-
## Important To-Do List Usage Notes to Remember
31-
- The `write_todos` tool should never be called multiple times in parallel.
32-
- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.
33-
```
34-
PROMPT;
30+
## Important To-Do List Usage Notes to Remember
31+
- The `write_todos` tool should never be called multiple times in parallel.
32+
- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.
33+
```
34+
PROMPT;
3535

3636
public function __construct(
3737
protected string $systemPrompt = self::DEFAULT_SYSTEM_PROMPT,

src/Agent/Middleware/WriteTodosTool.php

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -31,66 +31,66 @@ public function __construct(protected AgentState $state)
3131
parent::__construct(
3232
name: 'write_todos',
3333
description: <<<TODO
34-
Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
35-
36-
Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the task directly.
37-
38-
## When to Use This Tool
39-
Use this tool in these scenarios:
40-
41-
1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
42-
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
43-
3. User explicitly requests todo list - When the user directly asks you to use the todo list
44-
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
45-
5. The plan may need future revisions or updates based on results from the first few steps
46-
47-
## How to Use This Tool
48-
1. When you start working on a task - Mark it as in_progress BEFORE beginning work.
49-
2. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation.
50-
3. You can also update future tasks, such as deleting them if they are no longer necessary, or adding new tasks that are necessary. Don't change previously completed tasks.
51-
4. You can make several updates to the todo list at once. For example, when you complete a task, you can mark the next task you need to start as in_progress.
52-
53-
## When NOT to Use This Tool
54-
It is important to skip using this tool when:
55-
1. There is only a single, straightforward task
56-
2. The task is trivial and tracking it provides no benefit
57-
3. The task can be completed in less than 3 trivial steps
58-
4. The task is purely conversational or informational
59-
60-
## Task States and Management
61-
62-
1. **Task States**: Use these states to track progress:
63-
- pending: Task not yet started
64-
- in_progress: Currently working on (you can have multiple tasks in_progress at a time if they are not related to each other and can be run in parallel)
65-
- completed: Task finished successfully
66-
67-
2. **Task Management**:
68-
- Update task status in real-time as you work
69-
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
70-
- Complete current tasks before starting new ones
71-
- Remove tasks that are no longer relevant from the list entirely
72-
- IMPORTANT: When you write this todo list, you should mark your first task (or tasks) as in_progress immediately!.
73-
- IMPORTANT: Unless all tasks are completed, you should always have at least one task in_progress to show the user that you are working on something.
74-
75-
3. **Task Completion Requirements**:
76-
- ONLY mark a task as completed when you have FULLY accomplished it
77-
- If you encounter errors, blockers, or cannot finish, keep the task as in_progress
78-
- When blocked, create a new task describing what needs to be resolved
79-
- Never mark a task as completed if:
80-
- There are unresolved issues or errors
81-
- Work is partial or incomplete
82-
- You encountered blockers that prevent completion
83-
- You couldn't find necessary resources or dependencies
84-
- Quality standards haven't been met
85-
86-
4. **Task Breakdown**:
87-
- Create specific, actionable items
88-
- Break complex tasks into smaller, manageable steps
89-
- Use clear, descriptive task names
90-
91-
Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully
92-
Remember: If you only need to make a few tool calls to complete a task, and it is clear what you need to do, it is better to just do the task directly and NOT call this tool at all.
93-
TODO
34+
Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
35+
36+
Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the task directly.
37+
38+
## When to Use This Tool
39+
Use this tool in these scenarios:
40+
41+
1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
42+
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
43+
3. User explicitly requests todo list - When the user directly asks you to use the todo list
44+
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
45+
5. The plan may need future revisions or updates based on results from the first few steps
46+
47+
## How to Use This Tool
48+
1. When you start working on a task - Mark it as in_progress BEFORE beginning work.
49+
2. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation.
50+
3. You can also update future tasks, such as deleting them if they are no longer necessary, or adding new tasks that are necessary. Don't change previously completed tasks.
51+
4. You can make several updates to the todo list at once. For example, when you complete a task, you can mark the next task you need to start as in_progress.
52+
53+
## When NOT to Use This Tool
54+
It is important to skip using this tool when:
55+
1. There is only a single, straightforward task
56+
2. The task is trivial and tracking it provides no benefit
57+
3. The task can be completed in less than 3 trivial steps
58+
4. The task is purely conversational or informational
59+
60+
## Task States and Management
61+
62+
1. **Task States**: Use these states to track progress:
63+
- pending: Task not yet started
64+
- in_progress: Currently working on (you can have multiple tasks in_progress at a time if they are not related to each other and can be run in parallel)
65+
- completed: Task finished successfully
66+
67+
2. **Task Management**:
68+
- Update task status in real-time as you work
69+
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
70+
- Complete current tasks before starting new ones
71+
- Remove tasks that are no longer relevant from the list entirely
72+
- IMPORTANT: When you write this todo list, you should mark your first task (or tasks) as in_progress immediately!.
73+
- IMPORTANT: Unless all tasks are completed, you should always have at least one task in_progress to show the user that you are working on something.
74+
75+
3. **Task Completion Requirements**:
76+
- ONLY mark a task as completed when you have FULLY accomplished it
77+
- If you encounter errors, blockers, or cannot finish, keep the task as in_progress
78+
- When blocked, create a new task describing what needs to be resolved
79+
- Never mark a task as completed if:
80+
- There are unresolved issues or errors
81+
- Work is partial or incomplete
82+
- You encountered blockers that prevent completion
83+
- You couldn't find necessary resources or dependencies
84+
- Quality standards haven't been met
85+
86+
4. **Task Breakdown**:
87+
- Create specific, actionable items
88+
- Break complex tasks into smaller, manageable steps
89+
- Use clear, descriptive task names
90+
91+
Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully
92+
Remember: If you only need to make a few tool calls to complete a task, and it is clear what you need to do, it is better to just do the task directly and NOT call this tool at all.
93+
TODO
9494
);
9595
}
9696

src/Chat/History/FileChatHistory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
) {
3131
parent::__construct($contextWindow);
3232

33-
if (!is_dir($this->directory) && !@mkdir($this->directory, 0755, true)) {
33+
if (!is_dir($this->directory) && !@mkdir($this->directory, 0o755, true)) {
3434
throw new ChatHistoryException(
3535
"Directory '{$this->directory}' does not exist and could not be created."
3636
);

src/Chat/Messages/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function jsonSerialize(): array
165165
{
166166
$data = [
167167
'role' => $this->getRole(),
168-
'content' => array_map(fn (ContentBlockInterface $block): array => $block->toArray(), $this->contents)
168+
'content' => array_map(fn (ContentBlockInterface $block): array => $block->toArray(), $this->contents),
169169
];
170170

171171
if ($this->getUsage() instanceof Usage) {

src/Chat/Messages/ToolCallMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function jsonSerialize(): array
4141
parent::jsonSerialize(),
4242
[
4343
'type' => 'tool_call',
44-
'tools' => array_map(fn (ToolInterface $tool): array => $tool->jsonSerialize(), $this->tools)
44+
'tools' => array_map(fn (ToolInterface $tool): array => $tool->jsonSerialize(), $this->tools),
4545
]
4646
);
4747
}

src/Chat/Messages/ToolResultMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function jsonSerialize(): array
3838
parent::jsonSerialize(),
3939
[
4040
'type' => 'tool_call_result',
41-
'tools' => array_map(fn (ToolInterface $tool): array => $tool->jsonSerialize(), $this->tools)
41+
'tools' => array_map(fn (ToolInterface $tool): array => $tool->jsonSerialize(), $this->tools),
4242
]
4343
);
4444
}

src/Console/Make/MakeCommand.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private function generateClass(string $name): int
108108
}
109109

110110
$directory = dirname($filePath);
111-
if (!is_dir($directory) && !mkdir($directory, 0755, true)) {
111+
if (!is_dir($directory) && !mkdir($directory, 0o755, true)) {
112112
$this->printError("Failed to create directory: {$directory}");
113113
return 1;
114114
}
@@ -228,23 +228,23 @@ abstract protected function getStubContent(string $namespace, string $className)
228228
protected function printUsage(): void
229229
{
230230
$usage = <<<USAGE
231-
Create a new {$this->resourceType}
231+
Create a new {$this->resourceType}
232232
233-
Usage: neuron make:{$this->resourceType} [namespace\\]ClassName
233+
Usage: neuron make:{$this->resourceType} [namespace\\]ClassName
234234
235-
Arguments:
236-
name The name of the {$this->resourceType} class (with optional namespace)
235+
Arguments:
236+
name The name of the {$this->resourceType} class (with optional namespace)
237237
238-
Options:
239-
--help, -h Show this help message
238+
Options:
239+
--help, -h Show this help message
240240
241-
Examples:
242-
neuron make:{$this->resourceType} MyClass
243-
neuron make:{$this->resourceType} MyApp\\Services\\MyClass
241+
Examples:
242+
neuron make:{$this->resourceType} MyClass
243+
neuron make:{$this->resourceType} MyApp\\Services\\MyClass
244244
245-
If no namespace is provided, the default PSR-4 namespace from composer.json will be used.
245+
If no namespace is provided, the default PSR-4 namespace from composer.json will be used.
246246
247-
USAGE;
247+
USAGE;
248248

249249
echo $usage . PHP_EOL;
250250
}

0 commit comments

Comments
 (0)