gigaclaw 1.4.0
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/LICENSE +26 -0
- package/README.md +237 -0
- package/api/CLAUDE.md +19 -0
- package/api/index.js +265 -0
- package/bin/cli.js +823 -0
- package/bin/local.sh +85 -0
- package/bin/postinstall.js +63 -0
- package/config/index.js +26 -0
- package/config/instrumentation.js +62 -0
- package/drizzle/0000_initial.sql +52 -0
- package/drizzle/0001_nostalgic_sersi.sql +11 -0
- package/drizzle/0002_black_daimon_hellstrom.sql +19 -0
- package/drizzle/0003_rename_code_workspaces.sql +5 -0
- package/drizzle/meta/0000_snapshot.json +321 -0
- package/drizzle/meta/0001_snapshot.json +390 -0
- package/drizzle/meta/0002_snapshot.json +411 -0
- package/drizzle/meta/0003_snapshot.json +419 -0
- package/drizzle/meta/_journal.json +34 -0
- package/lib/actions.js +44 -0
- package/lib/ai/agent.js +86 -0
- package/lib/ai/index.js +342 -0
- package/lib/ai/model.js +180 -0
- package/lib/ai/tools.js +269 -0
- package/lib/ai/web-search.js +42 -0
- package/lib/auth/actions.js +28 -0
- package/lib/auth/config.js +27 -0
- package/lib/auth/edge-config.js +27 -0
- package/lib/auth/index.js +27 -0
- package/lib/auth/middleware.js +62 -0
- package/lib/channels/base.js +56 -0
- package/lib/channels/index.js +15 -0
- package/lib/channels/telegram.js +148 -0
- package/lib/chat/actions.js +579 -0
- package/lib/chat/api.js +140 -0
- package/lib/chat/components/app-sidebar.js +213 -0
- package/lib/chat/components/app-sidebar.jsx +279 -0
- package/lib/chat/components/chat-header.js +192 -0
- package/lib/chat/components/chat-header.jsx +223 -0
- package/lib/chat/components/chat-input.js +236 -0
- package/lib/chat/components/chat-input.jsx +249 -0
- package/lib/chat/components/chat-nav-context.js +11 -0
- package/lib/chat/components/chat-nav-context.jsx +11 -0
- package/lib/chat/components/chat-page.js +99 -0
- package/lib/chat/components/chat-page.jsx +121 -0
- package/lib/chat/components/chat.js +153 -0
- package/lib/chat/components/chat.jsx +199 -0
- package/lib/chat/components/chats-page.js +367 -0
- package/lib/chat/components/chats-page.jsx +394 -0
- package/lib/chat/components/code-mode-toggle.js +132 -0
- package/lib/chat/components/code-mode-toggle.jsx +163 -0
- package/lib/chat/components/crons-page.js +172 -0
- package/lib/chat/components/crons-page.jsx +244 -0
- package/lib/chat/components/greeting.js +11 -0
- package/lib/chat/components/greeting.jsx +16 -0
- package/lib/chat/components/icons.js +805 -0
- package/lib/chat/components/icons.jsx +751 -0
- package/lib/chat/components/index.js +20 -0
- package/lib/chat/components/message.js +363 -0
- package/lib/chat/components/message.jsx +422 -0
- package/lib/chat/components/messages.js +65 -0
- package/lib/chat/components/messages.jsx +74 -0
- package/lib/chat/components/notifications-page.js +56 -0
- package/lib/chat/components/notifications-page.jsx +87 -0
- package/lib/chat/components/page-layout.js +21 -0
- package/lib/chat/components/page-layout.jsx +28 -0
- package/lib/chat/components/pull-requests-page.js +103 -0
- package/lib/chat/components/pull-requests-page.jsx +113 -0
- package/lib/chat/components/settings-layout.js +39 -0
- package/lib/chat/components/settings-layout.jsx +53 -0
- package/lib/chat/components/settings-secrets-page.js +216 -0
- package/lib/chat/components/settings-secrets-page.jsx +264 -0
- package/lib/chat/components/sidebar-history-item.js +138 -0
- package/lib/chat/components/sidebar-history-item.jsx +119 -0
- package/lib/chat/components/sidebar-history.js +167 -0
- package/lib/chat/components/sidebar-history.jsx +220 -0
- package/lib/chat/components/sidebar-user-nav.js +61 -0
- package/lib/chat/components/sidebar-user-nav.jsx +77 -0
- package/lib/chat/components/swarm-page.js +157 -0
- package/lib/chat/components/swarm-page.jsx +210 -0
- package/lib/chat/components/tool-call.js +89 -0
- package/lib/chat/components/tool-call.jsx +107 -0
- package/lib/chat/components/triggers-page.js +153 -0
- package/lib/chat/components/triggers-page.jsx +221 -0
- package/lib/chat/components/ui/combobox.js +98 -0
- package/lib/chat/components/ui/combobox.jsx +114 -0
- package/lib/chat/components/ui/confirm-dialog.js +53 -0
- package/lib/chat/components/ui/confirm-dialog.jsx +57 -0
- package/lib/chat/components/ui/dropdown-menu.js +194 -0
- package/lib/chat/components/ui/dropdown-menu.jsx +215 -0
- package/lib/chat/components/ui/rename-dialog.js +78 -0
- package/lib/chat/components/ui/rename-dialog.jsx +74 -0
- package/lib/chat/components/ui/scroll-area.js +13 -0
- package/lib/chat/components/ui/scroll-area.jsx +17 -0
- package/lib/chat/components/ui/separator.js +21 -0
- package/lib/chat/components/ui/separator.jsx +18 -0
- package/lib/chat/components/ui/sheet.js +75 -0
- package/lib/chat/components/ui/sheet.jsx +95 -0
- package/lib/chat/components/ui/sidebar.js +228 -0
- package/lib/chat/components/ui/sidebar.jsx +246 -0
- package/lib/chat/components/ui/tooltip.js +56 -0
- package/lib/chat/components/ui/tooltip.jsx +66 -0
- package/lib/chat/components/upgrade-dialog.js +151 -0
- package/lib/chat/components/upgrade-dialog.jsx +170 -0
- package/lib/chat/utils.js +11 -0
- package/lib/code/actions.js +153 -0
- package/lib/code/code-page.js +22 -0
- package/lib/code/code-page.jsx +25 -0
- package/lib/code/index.js +1 -0
- package/lib/code/terminal-view.js +201 -0
- package/lib/code/terminal-view.jsx +224 -0
- package/lib/code/ws-proxy.js +80 -0
- package/lib/cron.js +246 -0
- package/lib/db/api-keys.js +163 -0
- package/lib/db/chats.js +168 -0
- package/lib/db/code-workspaces.js +110 -0
- package/lib/db/index.js +52 -0
- package/lib/db/notifications.js +99 -0
- package/lib/db/schema.js +66 -0
- package/lib/db/update-check.js +96 -0
- package/lib/db/users.js +89 -0
- package/lib/paths.js +42 -0
- package/lib/tools/create-job.js +97 -0
- package/lib/tools/docker.js +146 -0
- package/lib/tools/github.js +271 -0
- package/lib/tools/openai.js +35 -0
- package/lib/tools/telegram.js +292 -0
- package/lib/triggers.js +104 -0
- package/lib/utils/render-md.js +111 -0
- package/package.json +118 -0
- package/setup/lib/auth.mjs +81 -0
- package/setup/lib/env.mjs +21 -0
- package/setup/lib/fs-utils.mjs +20 -0
- package/setup/lib/github.mjs +149 -0
- package/setup/lib/prerequisites.mjs +155 -0
- package/setup/lib/prompts.mjs +267 -0
- package/setup/lib/providers.mjs +105 -0
- package/setup/lib/sync.mjs +125 -0
- package/setup/lib/targets.mjs +45 -0
- package/setup/lib/telegram-verify.mjs +63 -0
- package/setup/lib/telegram.mjs +76 -0
- package/setup/setup-cloud.mjs +833 -0
- package/setup/setup-local.mjs +377 -0
- package/setup/setup-telegram.mjs +265 -0
- package/setup/setup.mjs +87 -0
- package/templates/.dockerignore +5 -0
- package/templates/.env.example +104 -0
- package/templates/.github/workflows/auto-merge.yml +117 -0
- package/templates/.github/workflows/notify-job-failed.yml +64 -0
- package/templates/.github/workflows/notify-pr-complete.yml +119 -0
- package/templates/.github/workflows/rebuild-event-handler.yml +121 -0
- package/templates/.github/workflows/run-job.yml +89 -0
- package/templates/.github/workflows/upgrade-event-handler.yml +62 -0
- package/templates/.gitignore.template +45 -0
- package/templates/.pi/extensions/env-sanitizer/index.ts +48 -0
- package/templates/.pi/extensions/env-sanitizer/package.json +5 -0
- package/templates/CLAUDE.md +29 -0
- package/templates/CLAUDE.md.template +308 -0
- package/templates/app/api/[...gigaclaw]/route.js +1 -0
- package/templates/app/api/auth/[...nextauth]/route.js +1 -0
- package/templates/app/chat/[chatId]/page.js +9 -0
- package/templates/app/chats/page.js +7 -0
- package/templates/app/code/[codeWorkspaceId]/page.js +9 -0
- package/templates/app/components/ascii-logo.jsx +12 -0
- package/templates/app/components/login-form.jsx +92 -0
- package/templates/app/components/setup-form.jsx +82 -0
- package/templates/app/components/theme-provider.jsx +11 -0
- package/templates/app/components/theme-toggle.jsx +38 -0
- package/templates/app/components/ui/button.jsx +21 -0
- package/templates/app/components/ui/card.jsx +23 -0
- package/templates/app/components/ui/input.jsx +10 -0
- package/templates/app/components/ui/label.jsx +10 -0
- package/templates/app/crons/page.js +5 -0
- package/templates/app/globals.css +90 -0
- package/templates/app/layout.js +33 -0
- package/templates/app/login/page.js +15 -0
- package/templates/app/notifications/page.js +7 -0
- package/templates/app/page.js +7 -0
- package/templates/app/pull-requests/page.js +7 -0
- package/templates/app/settings/crons/page.js +5 -0
- package/templates/app/settings/layout.js +7 -0
- package/templates/app/settings/page.js +5 -0
- package/templates/app/settings/secrets/page.js +5 -0
- package/templates/app/settings/triggers/page.js +5 -0
- package/templates/app/stream/chat/route.js +1 -0
- package/templates/app/swarm/page.js +7 -0
- package/templates/app/triggers/page.js +5 -0
- package/templates/config/CODE_PLANNING.md +14 -0
- package/templates/config/CRONS.json +56 -0
- package/templates/config/HEARTBEAT.md +3 -0
- package/templates/config/JOB_AGENT.md +30 -0
- package/templates/config/JOB_PLANNING.md +240 -0
- package/templates/config/JOB_SUMMARY.md +130 -0
- package/templates/config/SKILL_BUILDING_GUIDE.md +96 -0
- package/templates/config/SOUL.md +48 -0
- package/templates/config/TRIGGERS.json +58 -0
- package/templates/config/WEB_SEARCH_AVAILABLE.md +5 -0
- package/templates/config/WEB_SEARCH_UNAVAILABLE.md +3 -0
- package/templates/docker/claude-code-job/Dockerfile +34 -0
- package/templates/docker/claude-code-job/entrypoint.sh +149 -0
- package/templates/docker/claude-code-workspace/.tmux.conf +5 -0
- package/templates/docker/claude-code-workspace/Dockerfile +61 -0
- package/templates/docker/claude-code-workspace/entrypoint.sh +51 -0
- package/templates/docker/event-handler/Dockerfile +20 -0
- package/templates/docker/event-handler/ecosystem.config.cjs +7 -0
- package/templates/docker/pi-coding-agent-job/Dockerfile +51 -0
- package/templates/docker/pi-coding-agent-job/entrypoint.sh +164 -0
- package/templates/docker-compose.local.yml +78 -0
- package/templates/docker-compose.yml +64 -0
- package/templates/instrumentation.js +6 -0
- package/templates/middleware.js +23 -0
- package/templates/next.config.mjs +3 -0
- package/templates/postcss.config.mjs +5 -0
- package/templates/public/favicon.ico +0 -0
- package/templates/server.js +25 -0
- package/templates/skills/LICENSE +21 -0
- package/templates/skills/README.md +119 -0
- package/templates/skills/brave-search/SKILL.md +79 -0
- package/templates/skills/brave-search/content.js +86 -0
- package/templates/skills/brave-search/package-lock.json +621 -0
- package/templates/skills/brave-search/package.json +14 -0
- package/templates/skills/brave-search/search.js +199 -0
- package/templates/skills/browser-tools/SKILL.md +196 -0
- package/templates/skills/browser-tools/browser-content.js +103 -0
- package/templates/skills/browser-tools/browser-cookies.js +35 -0
- package/templates/skills/browser-tools/browser-eval.js +53 -0
- package/templates/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/templates/skills/browser-tools/browser-nav.js +44 -0
- package/templates/skills/browser-tools/browser-pick.js +162 -0
- package/templates/skills/browser-tools/browser-screenshot.js +34 -0
- package/templates/skills/browser-tools/browser-start.js +87 -0
- package/templates/skills/browser-tools/package-lock.json +2556 -0
- package/templates/skills/browser-tools/package.json +19 -0
- package/templates/skills/google-docs/SKILL.md +23 -0
- package/templates/skills/google-docs/create.sh +69 -0
- package/templates/skills/google-drive/SKILL.md +47 -0
- package/templates/skills/google-drive/delete.sh +47 -0
- package/templates/skills/google-drive/download.sh +50 -0
- package/templates/skills/google-drive/list.sh +41 -0
- package/templates/skills/google-drive/upload.sh +76 -0
- package/templates/skills/kie-ai/SKILL.md +38 -0
- package/templates/skills/kie-ai/generate-image.sh +77 -0
- package/templates/skills/kie-ai/generate-video.sh +69 -0
- package/templates/skills/llm-secrets/SKILL.md +34 -0
- package/templates/skills/llm-secrets/llm-secrets.js +33 -0
- package/templates/skills/modify-self/SKILL.md +12 -0
- package/templates/skills/youtube-transcript/SKILL.md +41 -0
- package/templates/skills/youtube-transcript/package-lock.json +24 -0
- package/templates/skills/youtube-transcript/package.json +8 -0
- package/templates/skills/youtube-transcript/transcript.js +84 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
5
|
+
"prevId": "393d6739-2717-4020-bedb-8a9e1ed756da",
|
|
6
|
+
"tables": {
|
|
7
|
+
"chats": {
|
|
8
|
+
"name": "chats",
|
|
9
|
+
"columns": {
|
|
10
|
+
"id": {
|
|
11
|
+
"name": "id",
|
|
12
|
+
"type": "text",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": false
|
|
16
|
+
},
|
|
17
|
+
"user_id": {
|
|
18
|
+
"name": "user_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"title": {
|
|
25
|
+
"name": "title",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true,
|
|
29
|
+
"autoincrement": false,
|
|
30
|
+
"default": "'New Chat'"
|
|
31
|
+
},
|
|
32
|
+
"starred": {
|
|
33
|
+
"name": "starred",
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"primaryKey": false,
|
|
36
|
+
"notNull": true,
|
|
37
|
+
"autoincrement": false,
|
|
38
|
+
"default": 0
|
|
39
|
+
},
|
|
40
|
+
"code_workspace_id": {
|
|
41
|
+
"name": "code_workspace_id",
|
|
42
|
+
"type": "text",
|
|
43
|
+
"primaryKey": false,
|
|
44
|
+
"notNull": false,
|
|
45
|
+
"autoincrement": false
|
|
46
|
+
},
|
|
47
|
+
"created_at": {
|
|
48
|
+
"name": "created_at",
|
|
49
|
+
"type": "integer",
|
|
50
|
+
"primaryKey": false,
|
|
51
|
+
"notNull": true,
|
|
52
|
+
"autoincrement": false
|
|
53
|
+
},
|
|
54
|
+
"updated_at": {
|
|
55
|
+
"name": "updated_at",
|
|
56
|
+
"type": "integer",
|
|
57
|
+
"primaryKey": false,
|
|
58
|
+
"notNull": true,
|
|
59
|
+
"autoincrement": false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"indexes": {},
|
|
63
|
+
"foreignKeys": {},
|
|
64
|
+
"compositePrimaryKeys": {},
|
|
65
|
+
"uniqueConstraints": {},
|
|
66
|
+
"checkConstraints": {}
|
|
67
|
+
},
|
|
68
|
+
"code_workspaces": {
|
|
69
|
+
"name": "code_workspaces",
|
|
70
|
+
"columns": {
|
|
71
|
+
"id": {
|
|
72
|
+
"name": "id",
|
|
73
|
+
"type": "text",
|
|
74
|
+
"primaryKey": true,
|
|
75
|
+
"notNull": true,
|
|
76
|
+
"autoincrement": false
|
|
77
|
+
},
|
|
78
|
+
"user_id": {
|
|
79
|
+
"name": "user_id",
|
|
80
|
+
"type": "text",
|
|
81
|
+
"primaryKey": false,
|
|
82
|
+
"notNull": true,
|
|
83
|
+
"autoincrement": false
|
|
84
|
+
},
|
|
85
|
+
"container_name": {
|
|
86
|
+
"name": "container_name",
|
|
87
|
+
"type": "text",
|
|
88
|
+
"primaryKey": false,
|
|
89
|
+
"notNull": false,
|
|
90
|
+
"autoincrement": false
|
|
91
|
+
},
|
|
92
|
+
"repo": {
|
|
93
|
+
"name": "repo",
|
|
94
|
+
"type": "text",
|
|
95
|
+
"primaryKey": false,
|
|
96
|
+
"notNull": false,
|
|
97
|
+
"autoincrement": false
|
|
98
|
+
},
|
|
99
|
+
"branch": {
|
|
100
|
+
"name": "branch",
|
|
101
|
+
"type": "text",
|
|
102
|
+
"primaryKey": false,
|
|
103
|
+
"notNull": false,
|
|
104
|
+
"autoincrement": false
|
|
105
|
+
},
|
|
106
|
+
"title": {
|
|
107
|
+
"name": "title",
|
|
108
|
+
"type": "text",
|
|
109
|
+
"primaryKey": false,
|
|
110
|
+
"notNull": true,
|
|
111
|
+
"autoincrement": false,
|
|
112
|
+
"default": "'Code Workspace'"
|
|
113
|
+
},
|
|
114
|
+
"coding_agent": {
|
|
115
|
+
"name": "coding_agent",
|
|
116
|
+
"type": "text",
|
|
117
|
+
"primaryKey": false,
|
|
118
|
+
"notNull": true,
|
|
119
|
+
"autoincrement": false,
|
|
120
|
+
"default": "'claude-code'"
|
|
121
|
+
},
|
|
122
|
+
"starred": {
|
|
123
|
+
"name": "starred",
|
|
124
|
+
"type": "integer",
|
|
125
|
+
"primaryKey": false,
|
|
126
|
+
"notNull": true,
|
|
127
|
+
"autoincrement": false,
|
|
128
|
+
"default": 0
|
|
129
|
+
},
|
|
130
|
+
"created_at": {
|
|
131
|
+
"name": "created_at",
|
|
132
|
+
"type": "integer",
|
|
133
|
+
"primaryKey": false,
|
|
134
|
+
"notNull": true,
|
|
135
|
+
"autoincrement": false
|
|
136
|
+
},
|
|
137
|
+
"updated_at": {
|
|
138
|
+
"name": "updated_at",
|
|
139
|
+
"type": "integer",
|
|
140
|
+
"primaryKey": false,
|
|
141
|
+
"notNull": true,
|
|
142
|
+
"autoincrement": false
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"indexes": {
|
|
146
|
+
"code_workspaces_container_name_unique": {
|
|
147
|
+
"name": "code_workspaces_container_name_unique",
|
|
148
|
+
"columns": [
|
|
149
|
+
"container_name"
|
|
150
|
+
],
|
|
151
|
+
"isUnique": true
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"foreignKeys": {},
|
|
155
|
+
"compositePrimaryKeys": {},
|
|
156
|
+
"uniqueConstraints": {},
|
|
157
|
+
"checkConstraints": {}
|
|
158
|
+
},
|
|
159
|
+
"messages": {
|
|
160
|
+
"name": "messages",
|
|
161
|
+
"columns": {
|
|
162
|
+
"id": {
|
|
163
|
+
"name": "id",
|
|
164
|
+
"type": "text",
|
|
165
|
+
"primaryKey": true,
|
|
166
|
+
"notNull": true,
|
|
167
|
+
"autoincrement": false
|
|
168
|
+
},
|
|
169
|
+
"chat_id": {
|
|
170
|
+
"name": "chat_id",
|
|
171
|
+
"type": "text",
|
|
172
|
+
"primaryKey": false,
|
|
173
|
+
"notNull": true,
|
|
174
|
+
"autoincrement": false
|
|
175
|
+
},
|
|
176
|
+
"role": {
|
|
177
|
+
"name": "role",
|
|
178
|
+
"type": "text",
|
|
179
|
+
"primaryKey": false,
|
|
180
|
+
"notNull": true,
|
|
181
|
+
"autoincrement": false
|
|
182
|
+
},
|
|
183
|
+
"content": {
|
|
184
|
+
"name": "content",
|
|
185
|
+
"type": "text",
|
|
186
|
+
"primaryKey": false,
|
|
187
|
+
"notNull": true,
|
|
188
|
+
"autoincrement": false
|
|
189
|
+
},
|
|
190
|
+
"created_at": {
|
|
191
|
+
"name": "created_at",
|
|
192
|
+
"type": "integer",
|
|
193
|
+
"primaryKey": false,
|
|
194
|
+
"notNull": true,
|
|
195
|
+
"autoincrement": false
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"indexes": {},
|
|
199
|
+
"foreignKeys": {},
|
|
200
|
+
"compositePrimaryKeys": {},
|
|
201
|
+
"uniqueConstraints": {},
|
|
202
|
+
"checkConstraints": {}
|
|
203
|
+
},
|
|
204
|
+
"notifications": {
|
|
205
|
+
"name": "notifications",
|
|
206
|
+
"columns": {
|
|
207
|
+
"id": {
|
|
208
|
+
"name": "id",
|
|
209
|
+
"type": "text",
|
|
210
|
+
"primaryKey": true,
|
|
211
|
+
"notNull": true,
|
|
212
|
+
"autoincrement": false
|
|
213
|
+
},
|
|
214
|
+
"notification": {
|
|
215
|
+
"name": "notification",
|
|
216
|
+
"type": "text",
|
|
217
|
+
"primaryKey": false,
|
|
218
|
+
"notNull": true,
|
|
219
|
+
"autoincrement": false
|
|
220
|
+
},
|
|
221
|
+
"payload": {
|
|
222
|
+
"name": "payload",
|
|
223
|
+
"type": "text",
|
|
224
|
+
"primaryKey": false,
|
|
225
|
+
"notNull": true,
|
|
226
|
+
"autoincrement": false
|
|
227
|
+
},
|
|
228
|
+
"read": {
|
|
229
|
+
"name": "read",
|
|
230
|
+
"type": "integer",
|
|
231
|
+
"primaryKey": false,
|
|
232
|
+
"notNull": true,
|
|
233
|
+
"autoincrement": false,
|
|
234
|
+
"default": 0
|
|
235
|
+
},
|
|
236
|
+
"created_at": {
|
|
237
|
+
"name": "created_at",
|
|
238
|
+
"type": "integer",
|
|
239
|
+
"primaryKey": false,
|
|
240
|
+
"notNull": true,
|
|
241
|
+
"autoincrement": false
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"indexes": {},
|
|
245
|
+
"foreignKeys": {},
|
|
246
|
+
"compositePrimaryKeys": {},
|
|
247
|
+
"uniqueConstraints": {},
|
|
248
|
+
"checkConstraints": {}
|
|
249
|
+
},
|
|
250
|
+
"settings": {
|
|
251
|
+
"name": "settings",
|
|
252
|
+
"columns": {
|
|
253
|
+
"id": {
|
|
254
|
+
"name": "id",
|
|
255
|
+
"type": "text",
|
|
256
|
+
"primaryKey": true,
|
|
257
|
+
"notNull": true,
|
|
258
|
+
"autoincrement": false
|
|
259
|
+
},
|
|
260
|
+
"type": {
|
|
261
|
+
"name": "type",
|
|
262
|
+
"type": "text",
|
|
263
|
+
"primaryKey": false,
|
|
264
|
+
"notNull": true,
|
|
265
|
+
"autoincrement": false
|
|
266
|
+
},
|
|
267
|
+
"key": {
|
|
268
|
+
"name": "key",
|
|
269
|
+
"type": "text",
|
|
270
|
+
"primaryKey": false,
|
|
271
|
+
"notNull": true,
|
|
272
|
+
"autoincrement": false
|
|
273
|
+
},
|
|
274
|
+
"value": {
|
|
275
|
+
"name": "value",
|
|
276
|
+
"type": "text",
|
|
277
|
+
"primaryKey": false,
|
|
278
|
+
"notNull": true,
|
|
279
|
+
"autoincrement": false
|
|
280
|
+
},
|
|
281
|
+
"created_by": {
|
|
282
|
+
"name": "created_by",
|
|
283
|
+
"type": "text",
|
|
284
|
+
"primaryKey": false,
|
|
285
|
+
"notNull": false,
|
|
286
|
+
"autoincrement": false
|
|
287
|
+
},
|
|
288
|
+
"created_at": {
|
|
289
|
+
"name": "created_at",
|
|
290
|
+
"type": "integer",
|
|
291
|
+
"primaryKey": false,
|
|
292
|
+
"notNull": true,
|
|
293
|
+
"autoincrement": false
|
|
294
|
+
},
|
|
295
|
+
"updated_at": {
|
|
296
|
+
"name": "updated_at",
|
|
297
|
+
"type": "integer",
|
|
298
|
+
"primaryKey": false,
|
|
299
|
+
"notNull": true,
|
|
300
|
+
"autoincrement": false
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"indexes": {},
|
|
304
|
+
"foreignKeys": {},
|
|
305
|
+
"compositePrimaryKeys": {},
|
|
306
|
+
"uniqueConstraints": {},
|
|
307
|
+
"checkConstraints": {}
|
|
308
|
+
},
|
|
309
|
+
"subscriptions": {
|
|
310
|
+
"name": "subscriptions",
|
|
311
|
+
"columns": {
|
|
312
|
+
"id": {
|
|
313
|
+
"name": "id",
|
|
314
|
+
"type": "text",
|
|
315
|
+
"primaryKey": true,
|
|
316
|
+
"notNull": true,
|
|
317
|
+
"autoincrement": false
|
|
318
|
+
},
|
|
319
|
+
"platform": {
|
|
320
|
+
"name": "platform",
|
|
321
|
+
"type": "text",
|
|
322
|
+
"primaryKey": false,
|
|
323
|
+
"notNull": true,
|
|
324
|
+
"autoincrement": false
|
|
325
|
+
},
|
|
326
|
+
"channel_id": {
|
|
327
|
+
"name": "channel_id",
|
|
328
|
+
"type": "text",
|
|
329
|
+
"primaryKey": false,
|
|
330
|
+
"notNull": true,
|
|
331
|
+
"autoincrement": false
|
|
332
|
+
},
|
|
333
|
+
"created_at": {
|
|
334
|
+
"name": "created_at",
|
|
335
|
+
"type": "integer",
|
|
336
|
+
"primaryKey": false,
|
|
337
|
+
"notNull": true,
|
|
338
|
+
"autoincrement": false
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"indexes": {},
|
|
342
|
+
"foreignKeys": {},
|
|
343
|
+
"compositePrimaryKeys": {},
|
|
344
|
+
"uniqueConstraints": {},
|
|
345
|
+
"checkConstraints": {}
|
|
346
|
+
},
|
|
347
|
+
"users": {
|
|
348
|
+
"name": "users",
|
|
349
|
+
"columns": {
|
|
350
|
+
"id": {
|
|
351
|
+
"name": "id",
|
|
352
|
+
"type": "text",
|
|
353
|
+
"primaryKey": true,
|
|
354
|
+
"notNull": true,
|
|
355
|
+
"autoincrement": false
|
|
356
|
+
},
|
|
357
|
+
"email": {
|
|
358
|
+
"name": "email",
|
|
359
|
+
"type": "text",
|
|
360
|
+
"primaryKey": false,
|
|
361
|
+
"notNull": true,
|
|
362
|
+
"autoincrement": false
|
|
363
|
+
},
|
|
364
|
+
"password_hash": {
|
|
365
|
+
"name": "password_hash",
|
|
366
|
+
"type": "text",
|
|
367
|
+
"primaryKey": false,
|
|
368
|
+
"notNull": true,
|
|
369
|
+
"autoincrement": false
|
|
370
|
+
},
|
|
371
|
+
"role": {
|
|
372
|
+
"name": "role",
|
|
373
|
+
"type": "text",
|
|
374
|
+
"primaryKey": false,
|
|
375
|
+
"notNull": true,
|
|
376
|
+
"autoincrement": false,
|
|
377
|
+
"default": "'admin'"
|
|
378
|
+
},
|
|
379
|
+
"created_at": {
|
|
380
|
+
"name": "created_at",
|
|
381
|
+
"type": "integer",
|
|
382
|
+
"primaryKey": false,
|
|
383
|
+
"notNull": true,
|
|
384
|
+
"autoincrement": false
|
|
385
|
+
},
|
|
386
|
+
"updated_at": {
|
|
387
|
+
"name": "updated_at",
|
|
388
|
+
"type": "integer",
|
|
389
|
+
"primaryKey": false,
|
|
390
|
+
"notNull": true,
|
|
391
|
+
"autoincrement": false
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"indexes": {
|
|
395
|
+
"users_email_unique": {
|
|
396
|
+
"name": "users_email_unique",
|
|
397
|
+
"columns": [
|
|
398
|
+
"email"
|
|
399
|
+
],
|
|
400
|
+
"isUnique": true
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"foreignKeys": {},
|
|
404
|
+
"compositePrimaryKeys": {},
|
|
405
|
+
"uniqueConstraints": {},
|
|
406
|
+
"checkConstraints": {}
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"views": {},
|
|
410
|
+
"enums": {},
|
|
411
|
+
"_meta": {
|
|
412
|
+
"schemas": {},
|
|
413
|
+
"tables": {},
|
|
414
|
+
"columns": {}
|
|
415
|
+
},
|
|
416
|
+
"internal": {
|
|
417
|
+
"indexes": {}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "6",
|
|
8
|
+
"when": 1771448716757,
|
|
9
|
+
"tag": "0000_initial",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "6",
|
|
15
|
+
"when": 1772314996567,
|
|
16
|
+
"tag": "0001_nostalgic_sersi",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "6",
|
|
22
|
+
"when": 1772340907917,
|
|
23
|
+
"tag": "0002_black_daimon_hellstrom",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1772486536207,
|
|
30
|
+
"tag": "0003_rename_code_workspaces",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
package/lib/actions.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { createJob } from './tools/create-job.js';
|
|
4
|
+
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Execute a single action
|
|
9
|
+
* @param {Object} action - { type, job, command, url, method, headers, vars } (type: agent|command|webhook)
|
|
10
|
+
* @param {Object} opts - { cwd, data }
|
|
11
|
+
* @returns {Promise<string>} Result description for logging
|
|
12
|
+
*/
|
|
13
|
+
async function executeAction(action, opts = {}) {
|
|
14
|
+
const type = action.type || 'agent';
|
|
15
|
+
|
|
16
|
+
if (type === 'command') {
|
|
17
|
+
const { stdout, stderr } = await execAsync(action.command, { cwd: opts.cwd });
|
|
18
|
+
return (stdout || stderr || '').trim();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (type === 'webhook') {
|
|
22
|
+
const method = (action.method || 'POST').toUpperCase();
|
|
23
|
+
const headers = { 'Content-Type': 'application/json', ...action.headers };
|
|
24
|
+
const fetchOpts = { method, headers };
|
|
25
|
+
|
|
26
|
+
if (method !== 'GET') {
|
|
27
|
+
const body = { ...action.vars };
|
|
28
|
+
if (opts.data) body.data = opts.data;
|
|
29
|
+
fetchOpts.body = JSON.stringify(body);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const res = await fetch(action.url, fetchOpts);
|
|
33
|
+
return `${method} ${action.url} → ${res.status}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Default: agent
|
|
37
|
+
const options = {};
|
|
38
|
+
if (action.llm_provider) options.llmProvider = action.llm_provider;
|
|
39
|
+
if (action.llm_model) options.llmModel = action.llm_model;
|
|
40
|
+
const result = await createJob(action.job, options);
|
|
41
|
+
return `job ${result.job_id} — ${result.title}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { executeAction };
|
package/lib/ai/agent.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createReactAgent } from '@langchain/langgraph/prebuilt';
|
|
2
|
+
import { SystemMessage } from '@langchain/core/messages';
|
|
3
|
+
import { createModel } from './model.js';
|
|
4
|
+
import { createJobTool, getJobStatusTool, getSystemTechnicalSpecsTool, getSkillBuildingGuideTool, getSkillDetailsTool, createStartCodingTool, createGetRepositoryDetailsTool } from './tools.js';
|
|
5
|
+
import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
|
|
6
|
+
import { jobPlanningMd, codePlanningMd, gigaclawDb } from '../paths.js';
|
|
7
|
+
import { render_md } from '../utils/render-md.js';
|
|
8
|
+
import { createWebSearchTool, getProvider } from './web-search.js';
|
|
9
|
+
|
|
10
|
+
let _agent = null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get or create the LangGraph job agent singleton.
|
|
14
|
+
* Uses createReactAgent which handles the tool loop automatically.
|
|
15
|
+
* Prompt is a function so {{datetime}} resolves fresh each invocation.
|
|
16
|
+
*/
|
|
17
|
+
export async function getJobAgent() {
|
|
18
|
+
if (!_agent) {
|
|
19
|
+
const model = await createModel();
|
|
20
|
+
const tools = [createJobTool, getJobStatusTool, getSystemTechnicalSpecsTool, getSkillBuildingGuideTool, getSkillDetailsTool];
|
|
21
|
+
|
|
22
|
+
const webSearchTool = await createWebSearchTool();
|
|
23
|
+
if (webSearchTool) {
|
|
24
|
+
tools.push(webSearchTool);
|
|
25
|
+
console.log(`[agent] Web search enabled (provider: ${getProvider()})`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const checkpointer = SqliteSaver.fromConnString(gigaclawDb);
|
|
29
|
+
|
|
30
|
+
_agent = createReactAgent({
|
|
31
|
+
llm: model,
|
|
32
|
+
tools,
|
|
33
|
+
checkpointSaver: checkpointer,
|
|
34
|
+
prompt: (state) => [new SystemMessage(render_md(jobPlanningMd)), ...state.messages],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return _agent;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Reset the agent singleton (e.g., when config changes).
|
|
42
|
+
*/
|
|
43
|
+
export function resetAgent() {
|
|
44
|
+
_agent = null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const _codeAgents = new Map();
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get or create a code agent for a specific chat/workspace.
|
|
51
|
+
* Each code chat gets its own agent with unique start_coding tool bindings.
|
|
52
|
+
* @param {object} context
|
|
53
|
+
* @param {string} context.repo - GitHub repo
|
|
54
|
+
* @param {string} context.branch - Git branch
|
|
55
|
+
* @param {string} context.workspaceId - Pre-created workspace row ID
|
|
56
|
+
* @param {string} context.chatId - Chat thread ID
|
|
57
|
+
* @returns {Promise<object>} LangGraph agent
|
|
58
|
+
*/
|
|
59
|
+
export async function getCodeAgent({ repo, branch, workspaceId, chatId }) {
|
|
60
|
+
if (_codeAgents.has(chatId)) {
|
|
61
|
+
return _codeAgents.get(chatId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const model = await createModel();
|
|
65
|
+
const startCodingTool = createStartCodingTool({ repo, branch, workspaceId });
|
|
66
|
+
const getRepoDetailsTool = createGetRepositoryDetailsTool({ repo, branch });
|
|
67
|
+
const tools = [startCodingTool, getRepoDetailsTool];
|
|
68
|
+
|
|
69
|
+
const webSearchTool = await createWebSearchTool();
|
|
70
|
+
if (webSearchTool) {
|
|
71
|
+
tools.push(webSearchTool);
|
|
72
|
+
console.log(`[agent] Web search enabled for code agent (provider: ${getProvider()})`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const checkpointer = SqliteSaver.fromConnString(gigaclawDb);
|
|
76
|
+
|
|
77
|
+
const agent = createReactAgent({
|
|
78
|
+
llm: model,
|
|
79
|
+
tools,
|
|
80
|
+
checkpointSaver: checkpointer,
|
|
81
|
+
prompt: (state) => [new SystemMessage(render_md(codePlanningMd)), ...state.messages],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
_codeAgents.set(chatId, agent);
|
|
85
|
+
return agent;
|
|
86
|
+
}
|