dreamer 0.0.0-sandbox-20251210004407 → 0.0.0-sandbox-20260105024945

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.
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ File path validator for hook system.
4
+ Ensures file operations only occur within src/ directories or PRD.md
5
+ """
6
+
7
+ import json
8
+ import sys
9
+
10
+
11
+ def validate_file_path():
12
+ """
13
+ Validates that file operations are restricted to src/ directories.
14
+
15
+ Reads JSON from stdin, extracts file_path from tool_input,
16
+ and blocks operations outside of src/ directories.
17
+
18
+ Exit codes:
19
+ 0: Path is allowed
20
+ 2: Path is blocked
21
+ """
22
+ try:
23
+ # Read JSON input from stdin
24
+ data = json.load(sys.stdin)
25
+
26
+ # Extract file path from tool_input
27
+ file_path = data.get("tool_input", {}).get("file_path", "")
28
+
29
+ # Check if path is allowed (starts with 'src/' or contains '/src/', or is DATA-PLAN.md in planning/)
30
+ is_blocked = not (
31
+ file_path.startswith("src/")
32
+ or "/src/" in file_path
33
+ or file_path.endswith("PRD.md")
34
+ or file_path == "planning/DATA-PLAN.md"
35
+ or file_path.endswith("/DATA-PLAN.md")
36
+ or file_path.endswith("agent.yaml")
37
+ )
38
+
39
+ if is_blocked:
40
+ error_msg = (
41
+ f'File operation blocked: Path "{file_path}" is not allowed. '
42
+ f"Only files in src directories, agent.yaml, PRD.md, or planning/DATA-PLAN.md are allowed for editing."
43
+ )
44
+ print(error_msg, file=sys.stderr)
45
+ sys.exit(2)
46
+
47
+ # Path is allowed
48
+ sys.exit(0)
49
+
50
+ except json.JSONDecodeError as e:
51
+ print(f"Error parsing JSON input: {e}", file=sys.stderr)
52
+ sys.exit(1)
53
+ except Exception as e:
54
+ print(f"Unexpected error: {e}", file=sys.stderr)
55
+ sys.exit(1)
56
+
57
+
58
+ if __name__ == "__main__":
59
+ validate_file_path()
@@ -0,0 +1,25 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "bun install"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "PreToolUse": [
14
+ {
15
+ "matcher": "Edit|MultiEdit|Write",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "python3 .claude/may_edit.py"
20
+ }
21
+ ]
22
+ }
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "Agent-code: Build and Push",
6
+ "type": "shell",
7
+ "command": "agent-code",
8
+ "args": ["push"],
9
+ "group": "build",
10
+ "presentation": {
11
+ "echo": true,
12
+ "reveal": "always",
13
+ "focus": false,
14
+ "panel": "shared"
15
+ },
16
+ "problemMatcher": []
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,106 @@
1
+ # Data Planning Phase
2
+ Before implementing any agent that requires external data, you MUST complete a data planning phase. This is not optional - it ensures reliable data access and prevents common pitfalls.
3
+
4
+ ## Data Planning Requirements
5
+ 1. **Enumerate all external data dependencies** from the product requirements
6
+ 2. **Test each data-fetching tool** using `agent-code call-tool` (never test mutation tools)
7
+ 3. **Document the data plan** in `planning/DATA-PLAN.md`
8
+
9
+ ## Approved Data Sources
10
+ **ALLOWED:**
11
+ - Tools defined in `sdk-helpers/tools.ts` (weather services, email, calendar, web readers, search tools etc.)
12
+ - Data persisted in KV store from previous tool calls
13
+
14
+ **FORBIDDEN:**
15
+ - Direct REST API calls using `fetch` (even if you found the API via search)
16
+ - Hardcoded/mocked data (unless explicitly requested by user)
17
+ - APIs requiring API keys not provided through tools
18
+ - Any data source not accessible through tools.ts
19
+
20
+ ## Exception handling
21
+ Sometimes, the user will ask you to make use of data you simply do not have access to. Never try to generate fake, example or synthetic data. If you cannot find a good strategy to apply real data to the problem you MUST stop the whole task you've been assigned and tell the user that it is not possible to find real data to complete the task. The user will be able to select additional tools to help you out.
22
+
23
+ ## Data Planning Process
24
+ 0. **Consult Existing Plan (if any)**: If there is already a plan under `planning/DATA-PLAN.md`
25
+ keep it in mind for the next steps. It may already fulfill the data requirements.
26
+ 1. **Identify Requirements**: List every piece of external data needed
27
+ 2. **Tool Discovery**: Review `sdk-helpers/tools.ts` for relevant tools
28
+ 3. **Tool Testing**: Use `agent-code call-tool` to test ONLY data-fetching tools (never test mutation tools like send_email, create_task, etc.)
29
+ 4. **Output Analysis**: Examine actual outputs to understand data structure
30
+ 5. **Strategy**: Determine how you will use the the different tools in sequence to acheive the desired end result.
31
+ 6. **Processing Strategy**: Determine if you need:
32
+ - Direct property access
33
+ - Data transformation
34
+ - LLM inference (via `sdk.callLLM`) for extraction/classification
35
+ 7. **Documentation**: Create DATA-PLAN.md under `planning/DATA-PLAN.md`
36
+ *** DON'T FORGET that if you cannot make a plan with real data you MUST stop and ask the user for further guidance. ***
37
+
38
+ ## DATA-PLAN.md Structure
39
+ Create this file before implementing server functions under `planning/DATA-PLAN.md`:
40
+
41
+ ```md
42
+ # Data Plan for [Agent Name]
43
+
44
+ ## External Data Requirements
45
+ 1. [Requirement 1 description]
46
+ 2. [Requirement 2 description]
47
+ ...
48
+
49
+ ## Data Sources
50
+
51
+ ### [Data Requirement 1]
52
+ **Tool**: [tool_name from tools.ts]
53
+ **Test Command**: `agent-code call-tool [tool_name] '[params]'`
54
+ **Sample Arguments**:
55
+ [Actual examples of successful arguments from testing]
56
+ **Sample Output**:
57
+ [Actual output from testing]
58
+
59
+ **Processing Strategy**:
60
+ - [How to extract needed data]
61
+ - [Any LLM processing required]
62
+
63
+ [Repeat for other tools needed for this Ddata Requrement...]
64
+
65
+ ### [Data Requirement 2]
66
+ [Same structure...]
67
+
68
+ ## Rejected Approaches
69
+ ### [Approach that didn't work]
70
+ **Why Tested**: [Reasoning]
71
+ **Why Rejected**: [Specific failure reason]
72
+ ```
73
+
74
+ ## Common Data Planning Mistakes to Avoid
75
+
76
+ ### ❌ DON'T: Use fetch() with discovered APIs
77
+ ```typescript
78
+ // WRONG - Even if you found this API through web search
79
+ const weather = await fetch('https://api.weather.com/v1/...');
80
+ ```
81
+
82
+ ### ✅ DO: Use tools from tools.ts
83
+ ```typescript
84
+ // CORRECT - Use the weather tool
85
+ import { weather_api_service_getcurrentweather } from "@sdk-helpers/tools";
86
+ const weather = await weather_api_service_getcurrentweather(sdk, { location: city }, schema);
87
+ ```
88
+
89
+ ### ❌ DON'T: Hardcode fallback data
90
+ ```typescript
91
+ // WRONG - Using mock data as fallback
92
+ const weather = toolResult || { temp: 72, condition: "sunny" };
93
+ ```
94
+
95
+ ### ✅ DO: Handle missing data gracefully
96
+ ```typescript
97
+ // CORRECT - Show loading or error states
98
+ if (!weather) return { error: "Weather data unavailable" };
99
+ ```
100
+
101
+ ### ❌ DON'T: Make up mock or sample data if you can't find real data.
102
+ ```
103
+ // WRONG - Instead, stop, tell the user the problem and ask for their guidance.
104
+ Since the PRD requires implementing a specific API that doesn't seem to exist, I'll create a
105
+ mock implementation that simulates what such a service would provide
106
+ ```