cowork-dash 0.1.9__py3-none-any.whl → 0.2.1__py3-none-any.whl
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.
- cowork_dash/agent.py +33 -17
- cowork_dash/app.py +1056 -160
- cowork_dash/assets/app.js +34 -0
- cowork_dash/assets/styles.css +804 -693
- cowork_dash/cli.py +9 -0
- cowork_dash/components.py +573 -59
- cowork_dash/config.py +12 -1
- cowork_dash/file_utils.py +43 -4
- cowork_dash/layout.py +43 -2
- cowork_dash/sandbox.py +361 -0
- cowork_dash/tools.py +656 -69
- {cowork_dash-0.1.9.dist-info → cowork_dash-0.2.1.dist-info}/METADATA +1 -1
- cowork_dash-0.2.1.dist-info/RECORD +23 -0
- cowork_dash-0.1.9.dist-info/RECORD +0 -22
- {cowork_dash-0.1.9.dist-info → cowork_dash-0.2.1.dist-info}/WHEEL +0 -0
- {cowork_dash-0.1.9.dist-info → cowork_dash-0.2.1.dist-info}/entry_points.txt +0 -0
- {cowork_dash-0.1.9.dist-info → cowork_dash-0.2.1.dist-info}/licenses/LICENSE +0 -0
cowork_dash/agent.py
CHANGED
|
@@ -7,22 +7,29 @@ from langgraph.checkpoint.memory import InMemorySaver
|
|
|
7
7
|
from cowork_dash.tools import (
|
|
8
8
|
add_to_canvas,
|
|
9
9
|
bash,
|
|
10
|
-
clear_notebook_canvas_items,
|
|
11
10
|
create_cell,
|
|
12
11
|
delete_cell,
|
|
13
12
|
execute_all_cells,
|
|
14
13
|
execute_cell,
|
|
15
|
-
get_notebook_canvas_items,
|
|
16
14
|
get_script,
|
|
17
15
|
get_variables,
|
|
18
16
|
insert_cell,
|
|
19
17
|
modify_cell,
|
|
20
18
|
reset_notebook,
|
|
19
|
+
display_inline,
|
|
20
|
+
think_tool
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
SYSTEM_PROMPT = """You are a helpful AI assistant with access to a filesystem workspace and a Python code execution environment.
|
|
24
24
|
You have access to a canvas, which is a markdown file located at `.canvas/canvas.md` in the workspace. This allows you to sketch out ideas, document your work, and present results to the user.
|
|
25
25
|
|
|
26
|
+
CRITICAL!:
|
|
27
|
+
- You must keep talking to the user as frequently as possible to communicate your thoughts, findings and next steps.
|
|
28
|
+
- Always explain what you are doing and why.
|
|
29
|
+
- Acknowledge user instructions and questions before taking actions.
|
|
30
|
+
- Explain what you are doing before executing any tool or code.
|
|
31
|
+
- After executing code or tools, always summarize the results and next steps to the user.
|
|
32
|
+
|
|
26
33
|
## Capabilities
|
|
27
34
|
|
|
28
35
|
### Filesystem
|
|
@@ -57,16 +64,19 @@ You have tools to write and execute Python code interactively, similar to a Jupy
|
|
|
57
64
|
- Captures stdout, stderr, and return values
|
|
58
65
|
- Shows detailed error tracebacks when code fails
|
|
59
66
|
|
|
67
|
+
### Displaying Results Inline
|
|
68
|
+
- `display_inline(content, title=None, display_type=None)` - Tool to display content inline in the chat
|
|
69
|
+
- Use for: **file paths** to images, CSV files, HTML, JSON, PDF
|
|
70
|
+
- Example: `display_inline("results.csv", title="Sales Data")` as a tool call
|
|
71
|
+
|
|
60
72
|
### Canvas Visualization
|
|
61
|
-
- `add_to_canvas(content)` -
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
- `clear_notebook_canvas_items()` - Clear collected canvas items
|
|
73
|
+
- `add_to_canvas(content)` - Add content to the canvas panel (persistent note-taking area). To add images or charts, save them to files and reference them in markdown.
|
|
74
|
+
- Use for: longer-term notes, sketches, charts
|
|
75
|
+
- Canvas items are saved to `.canvas/` directory
|
|
65
76
|
|
|
66
|
-
**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
3. Charts are automatically saved to the `.canvas/` directory
|
|
77
|
+
**When to use `display_inline` vs `add_to_canvas`:**
|
|
78
|
+
- `display_inline`: For showing **saved files** (images, CSV, JSON) inline in chat
|
|
79
|
+
- `add_to_canvas`: For longer-term notes, sketches, charts
|
|
70
80
|
|
|
71
81
|
## Workflow Guidelines
|
|
72
82
|
|
|
@@ -82,14 +92,20 @@ Work iteratively like a human using Jupyter:
|
|
|
82
92
|
### For Analysis Tasks
|
|
83
93
|
1. Start by exploring the data (load, inspect shape/columns/types)
|
|
84
94
|
2. Build up your analysis step by step in separate cells
|
|
85
|
-
3.
|
|
86
|
-
4. Keep cells focused on single tasks for easier debugging
|
|
95
|
+
3. Keep cells focused on single tasks for easier debugging
|
|
87
96
|
|
|
88
97
|
### General
|
|
89
98
|
1. ALWAYS use write_todos to track your progress and next steps
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
92
|
-
|
|
99
|
+
2. Be proactive in exploring the filesystem when relevant
|
|
100
|
+
3. Provide clear, helpful responses
|
|
101
|
+
|
|
102
|
+
CRITICAL WORKFLOW REQUIREMENT:
|
|
103
|
+
1. FIRST ACTION: Always respond with initial thoughts before beginning any work and before any other tool or response
|
|
104
|
+
2. Reason through the user's request
|
|
105
|
+
3. Then proceed with other tools/actions
|
|
106
|
+
4. Summazrize progress and next steps after each action
|
|
107
|
+
|
|
108
|
+
This applies to EVERY user message, regardless of complexity.
|
|
93
109
|
|
|
94
110
|
The workspace is your sandbox - feel free to create files, organize content, and help users manage their projects."""
|
|
95
111
|
|
|
@@ -110,8 +126,8 @@ AGENT_TOOLS = [
|
|
|
110
126
|
get_script,
|
|
111
127
|
get_variables,
|
|
112
128
|
reset_notebook,
|
|
113
|
-
|
|
114
|
-
|
|
129
|
+
display_inline,
|
|
130
|
+
think_tool
|
|
115
131
|
]
|
|
116
132
|
|
|
117
133
|
# Global agent for physical filesystem mode
|