opengate 0.2.1 → 0.2.3

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/dist/index.js CHANGED
@@ -23,42 +23,94 @@ function buildBootstrapPrompt(task, openGateUrl, apiKey) {
23
23
  ${JSON.stringify(task.context, null, 2)}
24
24
  \`\`\`
25
25
  ` : "";
26
+ const projectId = task.project_id ?? "unknown";
26
27
  return `You are an autonomous coding agent assigned a task via OpenGate.
27
28
 
28
- ## Your Task
29
+ ## Your Task (Summary)
29
30
  **ID:** ${task.id}
30
31
  **Title:** ${task.title}
31
32
  **Priority:** ${task.priority ?? "medium"}
32
33
  **Tags:** ${tags}
33
- **Project ID:** ${task.project_id ?? "unknown"}
34
+ **Project ID:** ${projectId}
34
35
 
35
36
  **Description:**
36
37
  ${task.description ?? "(no description provided)"}
37
38
  ${contextBlock}
38
39
  ## OpenGate API
39
40
  - **Base URL:** ${openGateUrl}
40
- - **Auth:** Bearer ${apiKey}
41
+ - **Auth header:** Authorization: Bearer ${apiKey}
42
+
43
+ All API calls below use this base URL and auth header.
41
44
 
42
45
  ## Protocol \u2014 Follow This Exactly
43
- You MUST follow these steps in order. Skipping any step is not acceptable.
44
46
 
45
- 1. **Claim** \u2014 \`POST /api/tasks/${task.id}/claim\`
46
- 2. **Post starting comment** \u2014 \`POST /api/tasks/${task.id}/activity\` with body: \`{"content": "Starting: <your plan in 1-2 sentences>"}\`
47
- 3. **Do the work** \u2014 read relevant files, write code, run tests, commit to a branch
48
- 4. **Post results comment** \u2014 \`POST /api/tasks/${task.id}/activity\` with a summary of what changed (files modified, commit hash, test results)
49
- 5. **Complete** \u2014 \`POST /api/tasks/${task.id}/complete\` with body: \`{"summary": "<what was done>", "output": {"branch": "...", "commits": [...]}}\`
47
+ ### Phase 1: Claim
48
+ 1. **Claim the task** \u2014 \`POST /api/tasks/${task.id}/claim\`
49
+
50
+ ### Phase 2: Gather Context
51
+ Before writing any code, gather all available context:
52
+
53
+ 2. **Fetch full task details** \u2014 \`GET /api/tasks/${task.id}\`
54
+ - Read the \`activities\` array for comments, instructions, and prior discussion
55
+ - Read the \`artifacts\` array for any attached files or links
56
+ - Read the \`dependencies\` array \u2014 if any dependency has status != "done", note it as a potential blocker
57
+ - Pay close attention to reviewer comments or change requests in activities
58
+
59
+ 3. **Search project knowledge base** \u2014 \`GET /api/projects/${projectId}/knowledge/search?q=${task.title}\`
60
+ - Also search by tags if present: \`GET /api/projects/${projectId}/knowledge/search?tags=${tags}\`
61
+ - Read any returned entries \u2014 they contain architecture decisions, patterns, gotchas, and conventions for this project
62
+ - Follow these conventions in your implementation
63
+
64
+ 4. **Check project info** \u2014 \`GET /api/projects/${projectId}\`
65
+ - Note the \`repo_url\` and \`default_branch\` \u2014 use these for your workspace setup
66
+
67
+ ### Phase 3: Plan & Announce
68
+ 5. **Post starting comment** \u2014 \`POST /api/tasks/${task.id}/activity\`
69
+ Body: \`{"content": "Starting work. Plan: <your plan informed by the context you gathered, 2-4 sentences>"}\`
70
+ - Your plan should reflect what you learned from the knowledge base, existing comments, and dependencies
50
71
 
72
+ ### Phase 4: Workspace Setup
73
+ 6. **Set up your workspace:**
74
+ - Navigate to the project workspace (based on \`repo_url\` from the project info)
75
+ - Create a feature branch from the default branch: \`git checkout -b <branch-name>\`
76
+ - Branch naming: use the task title slugified, e.g. \`feat/add-user-auth\` or \`fix/null-pointer-in-parser\`
77
+
78
+ ### Phase 5: Do the Work
79
+ 7. **Implement the solution:**
80
+ - Follow patterns and conventions from the knowledge base
81
+ - Write clean, tested code
82
+ - Run the project's test suite and fix any failures
83
+ - Commit your changes with a descriptive message referencing the task
84
+
85
+ ### Phase 6: Report & Complete
86
+ 8. **Post results comment** \u2014 \`POST /api/tasks/${task.id}/activity\`
87
+ Body: \`{"content": "<summary of what changed: files modified, approach taken, test results, commit hash>"}\`
88
+
89
+ 9. **Write knowledge** (if you discovered something worth sharing) \u2014 \`PUT /api/projects/${projectId}/knowledge/<key>\`
90
+ Body: \`{"title": "...", "content": "...", "tags": [...], "category": "<architecture|pattern|gotcha|decision|reference>"}\`
91
+ - Write entries for: architectural decisions you made, gotchas you encountered, patterns you established
92
+
93
+ 10. **Complete** \u2014 \`POST /api/tasks/${task.id}/complete\`
94
+ Body: \`{"summary": "<what was done>", "output": {"branch": "...", "commits": [...]}}\`
95
+
96
+ ## Handling Blockers
51
97
  If you encounter a blocker that requires human input:
52
- - Post a question: \`POST /api/tasks/${task.id}/activity\` with \`{"content": "BLOCKED: <question>"}\`
98
+ - Post a question: \`POST /api/tasks/${task.id}/activity\` with \`{"content": "BLOCKED: <describe the issue and what you need>"}\`
53
99
  - Block the task: \`POST /api/tasks/${task.id}/block\` with \`{"reason": "<reason>"}\`
54
100
  - Then stop \u2014 do NOT mark it complete.
55
101
 
56
- ## Notes
102
+ If a dependency is not yet done:
103
+ - Post a comment noting which dependency is blocking you
104
+ - Block the task with the dependency info
105
+ - Stop and let the orchestrator handle sequencing
106
+
107
+ ## Rules
57
108
  - Always work on a feature branch, never commit directly to main
58
- - Run tests before completing
59
- - If you discover something worth remembering (pattern, gotcha, decision), write it to a file in your workspace
109
+ - Run tests before completing \u2014 do not complete with failing tests
110
+ - Respect existing patterns found in the knowledge base
111
+ - Keep commits atomic and descriptive
60
112
 
61
- Now begin. Start by claiming the task.`;
113
+ Now begin. Start with Phase 1: claim the task.`;
62
114
  }
63
115
 
64
116
  // src/spawner.ts
@@ -174,7 +226,7 @@ async function fetchInbox(url, apiKey) {
174
226
  throw new Error(`OpenGate inbox returned HTTP ${resp.status}`);
175
227
  }
176
228
  const body = await resp.json();
177
- return body.todo ?? [];
229
+ return body.todo_tasks ?? [];
178
230
  }
179
231
  var OpenGatePoller = class {
180
232
  constructor(pluginCfg, openclawCfg, logger, stateDir) {
@@ -2,7 +2,7 @@
2
2
  "id": "opengate",
3
3
  "name": "OpenGate",
4
4
  "description": "Polls OpenGate for assigned tasks and spawns isolated OpenClaw sessions to execute them. Turns OpenGate into the orchestrator.",
5
- "version": "0.2.1",
5
+ "version": "0.2.3",
6
6
  "skills": ["./skills/opengate"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opengate",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "OpenGate task executor plugin for OpenClaw — polls assigned tasks and spawns isolated agent sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",