crewly 1.5.11 → 1.5.13
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/config/constants.ts +3 -3
- package/config/orchestrator_tasks/prompts/orchestrator-prompt.md +73 -0
- package/config/roles/architect/prompt.md +9 -0
- package/config/roles/backend-developer/prompt.md +9 -0
- package/config/roles/content-strategist/prompt.md +10 -0
- package/config/roles/designer/prompt.md +9 -0
- package/config/roles/developer/prompt.md +9 -0
- package/config/roles/frontend-developer/prompt.md +9 -0
- package/config/roles/fullstack-dev/prompt.md +9 -0
- package/config/roles/generalist/prompt.md +9 -0
- package/config/roles/ops/prompt.md +9 -0
- package/config/roles/product-manager/prompt.md +9 -0
- package/config/roles/qa/prompt.md +9 -0
- package/config/roles/qa-engineer/prompt.md +9 -0
- package/config/roles/researcher/prompt.md +9 -0
- package/config/roles/sales/prompt.md +9 -0
- package/config/roles/support/prompt.md +9 -0
- package/config/roles/team-leader/prompt.md +11 -0
- package/config/roles/tpm/prompt.md +9 -0
- package/config/roles/ux-designer/prompt.md +9 -0
- package/config/skills/_common/lib.sh +31 -0
- package/config/skills/_common/lib.test.sh +164 -0
- package/config/skills/agent/core/block-task/execute.sh +3 -1
- package/config/skills/agent/core/pipe-to-sink/execute.sh +41 -0
- package/config/skills/agent/core/read-task/execute.sh +3 -1
- package/config/skills/agent/core/report-progress/execute.sh +3 -1
- package/config/skills/agent/screenshot-compare/SKILL.md +75 -0
- package/config/skills/agent/screenshot-compare/execute.sh +182 -0
- package/config/skills/agent/screenshot-compare/skill.json +10 -0
- package/config/skills/agent/xiaoyuzhoufm-transcript/SKILL.md +85 -0
- package/config/skills/agent/xiaoyuzhoufm-transcript/execute.sh +306 -0
- package/config/skills/agent/xiaoyuzhoufm-transcript/skill.json +10 -0
- package/config/skills/orchestrator/cancel-cron/SKILL.md +44 -0
- package/config/skills/orchestrator/create-cron/SKILL.md +58 -0
- package/config/skills/orchestrator/list-cron/SKILL.md +51 -0
- package/config/skills/orchestrator/update-cron/SKILL.md +52 -0
- package/dist/backend/backend/src/constants.d.ts +7 -4
- package/dist/backend/backend/src/constants.d.ts.map +1 -1
- package/dist/backend/backend/src/constants.js +6 -3
- package/dist/backend/backend/src/constants.js.map +1 -1
- package/dist/backend/backend/src/controllers/browser/browser.controller.d.ts +21 -2
- package/dist/backend/backend/src/controllers/browser/browser.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/browser/browser.controller.js +167 -29
- package/dist/backend/backend/src/controllers/browser/browser.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/browser/browser.routes.d.ts +1 -1
- package/dist/backend/backend/src/controllers/browser/browser.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/browser/browser.routes.js +7 -3
- package/dist/backend/backend/src/controllers/browser/browser.routes.js.map +1 -1
- package/dist/backend/backend/src/controllers/data/data.controller.d.ts +47 -0
- package/dist/backend/backend/src/controllers/data/data.controller.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/data/data.controller.js +201 -0
- package/dist/backend/backend/src/controllers/data/data.controller.js.map +1 -0
- package/dist/backend/backend/src/controllers/data/data.routes.d.ts +18 -0
- package/dist/backend/backend/src/controllers/data/data.routes.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/data/data.routes.js +44 -0
- package/dist/backend/backend/src/controllers/data/data.routes.js.map +1 -0
- package/dist/backend/backend/src/controllers/monitoring/token-usage.controller.d.ts +3 -2
- package/dist/backend/backend/src/controllers/monitoring/token-usage.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/monitoring/token-usage.controller.js +5 -3
- package/dist/backend/backend/src/controllers/monitoring/token-usage.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/system/cron-task.controller.d.ts +4 -0
- package/dist/backend/backend/src/controllers/system/cron-task.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/system/cron-task.controller.js +20 -0
- package/dist/backend/backend/src/controllers/system/cron-task.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/task-management/task-management.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/task-management/task-management.controller.js +18 -0
- package/dist/backend/backend/src/controllers/task-management/task-management.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/team/team-export.controller.d.ts +32 -0
- package/dist/backend/backend/src/controllers/team/team-export.controller.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/team/team-export.controller.js +61 -0
- package/dist/backend/backend/src/controllers/team/team-export.controller.js.map +1 -0
- package/dist/backend/backend/src/controllers/team/team.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/team/team.routes.js +7 -0
- package/dist/backend/backend/src/controllers/team/team.routes.js.map +1 -1
- package/dist/backend/backend/src/index.d.ts.map +1 -1
- package/dist/backend/backend/src/index.js +37 -7
- package/dist/backend/backend/src/index.js.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.js +4 -1
- package/dist/backend/backend/src/routes/api.routes.js.map +1 -1
- package/dist/backend/backend/src/services/agent/agent-registration.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/agent/agent-registration.service.js +6 -2
- package/dist/backend/backend/src/services/agent/agent-registration.service.js.map +1 -1
- package/dist/backend/backend/src/services/agent/idle-detection.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/agent/idle-detection.service.js +17 -2
- package/dist/backend/backend/src/services/agent/idle-detection.service.js.map +1 -1
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.d.ts +1 -1
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js +2 -2
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js.map +1 -1
- package/dist/backend/backend/src/services/agent/task-planning.service.d.ts +134 -0
- package/dist/backend/backend/src/services/agent/task-planning.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/agent/task-planning.service.js +291 -0
- package/dist/backend/backend/src/services/agent/task-planning.service.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts +11 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js +47 -18
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts +14 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +47 -4
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
- package/dist/backend/backend/src/services/browser/browser-bridge.service.d.ts +13 -9
- package/dist/backend/backend/src/services/browser/browser-bridge.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/browser/browser-bridge.service.js +44 -12
- package/dist/backend/backend/src/services/browser/browser-bridge.service.js.map +1 -1
- package/dist/backend/backend/src/services/browser/browser-proxy.service.d.ts +176 -0
- package/dist/backend/backend/src/services/browser/browser-proxy.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/browser/browser-proxy.service.js +441 -0
- package/dist/backend/backend/src/services/browser/browser-proxy.service.js.map +1 -0
- package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.d.ts +162 -0
- package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.js +350 -0
- package/dist/backend/backend/src/services/browser/browser-relay-adapter.service.js.map +1 -0
- package/dist/backend/backend/src/services/cloud/cloud-initializer.d.ts +8 -0
- package/dist/backend/backend/src/services/cloud/cloud-initializer.d.ts.map +1 -1
- package/dist/backend/backend/src/services/cloud/cloud-initializer.js +27 -0
- package/dist/backend/backend/src/services/cloud/cloud-initializer.js.map +1 -1
- package/dist/backend/backend/src/services/cloud/cloud-sync.types.d.ts +1 -1
- package/dist/backend/backend/src/services/cloud/cloud-sync.types.d.ts.map +1 -1
- package/dist/backend/backend/src/services/cloud/cloud-sync.types.js +2 -0
- package/dist/backend/backend/src/services/cloud/cloud-sync.types.js.map +1 -1
- package/dist/backend/backend/src/services/core/team-export.service.d.ts +103 -0
- package/dist/backend/backend/src/services/core/team-export.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/core/team-export.service.js +182 -0
- package/dist/backend/backend/src/services/core/team-export.service.js.map +1 -0
- package/dist/backend/backend/src/services/data/data-object-store.service.d.ts +160 -0
- package/dist/backend/backend/src/services/data/data-object-store.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/data/data-object-store.service.js +434 -0
- package/dist/backend/backend/src/services/data/data-object-store.service.js.map +1 -0
- package/dist/backend/backend/src/services/data/data-object.types.d.ts +190 -0
- package/dist/backend/backend/src/services/data/data-object.types.d.ts.map +1 -0
- package/dist/backend/backend/src/services/data/data-object.types.js +143 -0
- package/dist/backend/backend/src/services/data/data-object.types.js.map +1 -0
- package/dist/backend/backend/src/services/data/schema-registry.service.d.ts +108 -0
- package/dist/backend/backend/src/services/data/schema-registry.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/data/schema-registry.service.js +290 -0
- package/dist/backend/backend/src/services/data/schema-registry.service.js.map +1 -0
- package/dist/backend/backend/src/services/data/sink-registry.service.d.ts +87 -0
- package/dist/backend/backend/src/services/data/sink-registry.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/data/sink-registry.service.js +188 -0
- package/dist/backend/backend/src/services/data/sink-registry.service.js.map +1 -0
- package/dist/backend/backend/src/services/messaging/message-router.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/messaging/message-router.service.js +7 -0
- package/dist/backend/backend/src/services/messaging/message-router.service.js.map +1 -1
- package/dist/backend/backend/src/services/monitoring/token-usage.service.d.ts +55 -2
- package/dist/backend/backend/src/services/monitoring/token-usage.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/monitoring/token-usage.service.js +89 -5
- package/dist/backend/backend/src/services/monitoring/token-usage.service.js.map +1 -1
- package/dist/backend/backend/src/services/session/pty/pty-session-backend.js +1 -1
- package/dist/backend/backend/src/services/session/pty/pty-session-backend.js.map +1 -1
- package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts +105 -14
- package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/workflow/cron-task.service.js +400 -123
- package/dist/backend/backend/src/services/workflow/cron-task.service.js.map +1 -1
- package/dist/backend/backend/src/types/cron-task.types.d.ts +1 -1
- package/dist/backend/backend/src/types/data-object.types.d.ts +117 -0
- package/dist/backend/backend/src/types/data-object.types.d.ts.map +1 -0
- package/dist/backend/backend/src/types/data-object.types.js +23 -0
- package/dist/backend/backend/src/types/data-object.types.js.map +1 -0
- package/dist/backend/backend/src/types/settings.types.js +1 -1
- package/dist/backend/config/constants.d.ts +3 -3
- package/dist/backend/config/constants.js +3 -3
- package/dist/backend/config/constants.js.map +1 -1
- package/dist/cli/backend/src/constants.d.ts +7 -4
- package/dist/cli/backend/src/constants.d.ts.map +1 -1
- package/dist/cli/backend/src/constants.js +6 -3
- package/dist/cli/backend/src/constants.js.map +1 -1
- package/dist/cli/backend/src/types/settings.types.js +1 -1
- package/dist/cli/config/constants.d.ts +3 -3
- package/dist/cli/config/constants.js +3 -3
- package/dist/cli/config/constants.js.map +1 -1
- package/frontend/dist/assets/index-371b68d4.css +33 -0
- package/frontend/dist/assets/{index-9af2ea40.js → index-506f70da.js} +321 -321
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-b19b2478.css +0 -33
package/config/constants.ts
CHANGED
|
@@ -856,7 +856,7 @@ export const AGENT_HEARTBEAT_MONITOR_CONSTANTS = {
|
|
|
856
856
|
*/
|
|
857
857
|
export const AGENT_SUSPEND_CONSTANTS = {
|
|
858
858
|
/** Default idle timeout in minutes before an agent is suspended (0 = disabled) */
|
|
859
|
-
DEFAULT_IDLE_TIMEOUT_MINUTES:
|
|
859
|
+
DEFAULT_IDLE_TIMEOUT_MINUTES: 30,
|
|
860
860
|
/** Interval between idle checks in milliseconds (2 minutes) */
|
|
861
861
|
IDLE_CHECK_INTERVAL_MS: 120_000,
|
|
862
862
|
/** Maximum age of debug log files eligible for cleanup on suspend (hours) */
|
|
@@ -869,8 +869,8 @@ export const AGENT_SUSPEND_CONSTANTS = {
|
|
|
869
869
|
STARTED_AGENT_IDLE_TIMEOUT_MINUTES: 15,
|
|
870
870
|
/** Roles that should never be auto-stopped (always-on) */
|
|
871
871
|
ALWAYS_ON_ROLES: ['orchestrator', 'auditor'] as const,
|
|
872
|
-
/** Idle timeout in ms before a worker agent is stopped (default
|
|
873
|
-
AGENT_IDLE_STOP_TIMEOUT_MS:
|
|
872
|
+
/** Idle timeout in ms before a worker agent is stopped (default 30 min) */
|
|
873
|
+
AGENT_IDLE_STOP_TIMEOUT_MS: 1_800_000,
|
|
874
874
|
} as const;
|
|
875
875
|
|
|
876
876
|
// ========================= SERVER PROCESS CONSTANTS =========================
|
|
@@ -74,6 +74,21 @@ bash {{ORCHESTRATOR_SKILLS_PATH}}/reply-chat/execute.sh '{"conversationId":"spac
|
|
|
74
74
|
|
|
75
75
|
Keep responses concise for Slack and Google Chat (use emojis sparingly: ✅ ❌ ⏳).
|
|
76
76
|
|
|
77
|
+
### Acknowledge-First Rule (MANDATORY)
|
|
78
|
+
|
|
79
|
+
When you receive a message from the user (via Slack, Chat UI, or Google Chat):
|
|
80
|
+
1. **Immediately acknowledge** — Reply on the **same channel** confirming you received the message (e.g., "Got it, working on this now" or "Received, let me check")
|
|
81
|
+
2. **Then execute** — Start working on the task after the acknowledgment is sent
|
|
82
|
+
3. **Never work silently** — The user should always see an immediate response before you start any long-running work (delegation, research, code changes)
|
|
83
|
+
|
|
84
|
+
This prevents the user from wondering if their message was received. The acknowledgment should be sent within seconds, not after task completion.
|
|
85
|
+
|
|
86
|
+
### Non-Blocking Skill Execution
|
|
87
|
+
|
|
88
|
+
When running skills that delegate work to other agents (e.g., `delegate-task`, `send-message`, `start-agent`), these are **fire-and-forget** operations — you do NOT need to wait for the agent to complete the work before continuing. The skill script itself returns quickly (within seconds). Only `get-agent-logs` and `get-team-status` may take slightly longer as they query live state.
|
|
89
|
+
|
|
90
|
+
**Best practice:** After delegating a task, immediately proceed to the next action (e.g., reply to the user, delegate the next task) rather than waiting to see if the agent started working.
|
|
91
|
+
|
|
77
92
|
### Checking Crewly Status
|
|
78
93
|
|
|
79
94
|
Use the **bash skill scripts**:
|
|
@@ -123,6 +138,64 @@ Your agents have MCP tools and skills that give them access to external services
|
|
|
123
138
|
|
|
124
139
|
**You are a manager, not a security gate.** The user owns the system and has configured their agents' access. Trust their setup. Your job is to route the request to the right agent, not to second-guess whether the agent should have access.
|
|
125
140
|
|
|
141
|
+
### Crewly Cron System — Built-in Recurring Tasks
|
|
142
|
+
|
|
143
|
+
Crewly has a **built-in cron task system** for scheduling recurring work. **Always use this instead of session-scoped tools like CronCreate** — session tools are lost when the session ends, but Crewly cron tasks persist across restarts.
|
|
144
|
+
|
|
145
|
+
#### How It Works
|
|
146
|
+
- The cron evaluator runs every **60 seconds** on the Crewly backend (localhost:8787)
|
|
147
|
+
- When a cron expression matches, the system **sends `taskDescription` as a message** to the `targetAgent`
|
|
148
|
+
- If the target agent is **offline**, the system **auto-starts** it before delivering the task
|
|
149
|
+
- Tasks are stored per-team in `~/.crewly/teams/{teamId}/cron-tasks.json`
|
|
150
|
+
- Supports **IANA timezones** (e.g., `Asia/Shanghai`, `America/New_York`, `UTC`)
|
|
151
|
+
|
|
152
|
+
#### Cron Skills (use these!)
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Create a recurring task
|
|
156
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/create-cron/execute.sh '{"cronExpression":"0 9 * * 1-5","timezone":"Asia/Shanghai","targetAgent":"agent-session","targetTeamId":"team-uuid","taskDescription":"Generate daily standup report"}'
|
|
157
|
+
|
|
158
|
+
# List all cron tasks (optionally filter by agent or enabled)
|
|
159
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/list-cron/execute.sh
|
|
160
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/list-cron/execute.sh '{"targetAgent":"agent-session"}'
|
|
161
|
+
|
|
162
|
+
# Update a cron task (change schedule, description, or enable/disable)
|
|
163
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/update-cron/execute.sh '{"id":"cron-xxx","cronExpression":"0 10 * * *"}'
|
|
164
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/update-cron/execute.sh '{"id":"cron-xxx","enabled":false}'
|
|
165
|
+
|
|
166
|
+
# Delete a cron task permanently
|
|
167
|
+
bash {{ORCHESTRATOR_SKILLS_PATH}}/cancel-cron/execute.sh '{"id":"cron-xxx"}'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### API Endpoints (for reference)
|
|
171
|
+
| Method | Endpoint | Description |
|
|
172
|
+
|--------|----------|-------------|
|
|
173
|
+
| POST | `/api/cron-tasks` | Create a cron task |
|
|
174
|
+
| GET | `/api/cron-tasks` | List all cron tasks (supports `?targetAgent=` and `?enabled=` filters) |
|
|
175
|
+
| PATCH | `/api/cron-tasks/:id` | Update a cron task |
|
|
176
|
+
| DELETE | `/api/cron-tasks/:id` | Delete a cron task |
|
|
177
|
+
|
|
178
|
+
#### Required Fields for Creation
|
|
179
|
+
| Field | Description |
|
|
180
|
+
|-------|-------------|
|
|
181
|
+
| `cronExpression` | 5-field cron (minute hour day month weekday) |
|
|
182
|
+
| `timezone` | IANA timezone string (default: UTC) |
|
|
183
|
+
| `targetAgent` | Session name of the target agent |
|
|
184
|
+
| `targetTeamId` | Team ID the agent belongs to |
|
|
185
|
+
| `taskDescription` | Message/task sent to the agent on each trigger |
|
|
186
|
+
| `createdBy` | Who created it (use `"orchestrator"`) |
|
|
187
|
+
|
|
188
|
+
#### Common Cron Expressions
|
|
189
|
+
| Expression | Meaning |
|
|
190
|
+
|------------|---------|
|
|
191
|
+
| `0 9 * * 1-5` | 9:00 AM weekdays |
|
|
192
|
+
| `*/30 * * * *` | Every 30 minutes |
|
|
193
|
+
| `0 0 * * 0` | Midnight every Sunday |
|
|
194
|
+
| `0 8,17 * * *` | 8 AM and 5 PM daily |
|
|
195
|
+
| `0 9 * * 1` | 9 AM every Monday |
|
|
196
|
+
|
|
197
|
+
⚠️ **IMPORTANT:** Never use Claude's built-in `CronCreate` tool for recurring tasks — those are session-scoped and lost on restart. Always use the Crewly cron skills above.
|
|
198
|
+
|
|
126
199
|
### Self-Improvement
|
|
127
200
|
You have access to the `self_improve` tool to safely modify the Crewly codebase:
|
|
128
201
|
- Always create a plan before making changes
|
|
@@ -96,6 +96,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
96
96
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
97
97
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
98
98
|
|
|
99
|
+
## Recurring Tasks (Cron System)
|
|
100
|
+
|
|
101
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
102
|
+
|
|
103
|
+
- You will receive the task description as a normal message in your terminal
|
|
104
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
105
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
106
|
+
|
|
107
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
99
108
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
100
109
|
|
|
101
110
|
## Error Learning Protocol
|
|
@@ -113,6 +113,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
113
113
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Recurring Tasks (Cron System)
|
|
117
|
+
|
|
118
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
119
|
+
|
|
120
|
+
- You will receive the task description as a normal message in your terminal
|
|
121
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
122
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
123
|
+
|
|
124
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
116
125
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
117
126
|
|
|
118
127
|
## Error Learning Protocol
|
|
@@ -71,3 +71,13 @@ When you encounter an error and successfully resolve it:
|
|
|
71
71
|
1. Immediately run `record-learning` with the exact error, fix, and environment context.
|
|
72
72
|
2. If the fix is broadly reusable, store it with `remember` at project scope so other agents inherit it.
|
|
73
73
|
3. Do not finish the task without recording at least one actionable learning when debugging occurred.
|
|
74
|
+
|
|
75
|
+
## Recurring Tasks (Cron System)
|
|
76
|
+
|
|
77
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
78
|
+
|
|
79
|
+
- You will receive the task description as a normal message in your terminal
|
|
80
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
81
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
82
|
+
|
|
83
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
@@ -95,6 +95,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
95
95
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
96
96
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
97
97
|
|
|
98
|
+
## Recurring Tasks (Cron System)
|
|
99
|
+
|
|
100
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
101
|
+
|
|
102
|
+
- You will receive the task description as a normal message in your terminal
|
|
103
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
104
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
105
|
+
|
|
106
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
98
107
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
99
108
|
|
|
100
109
|
## Error Learning Protocol
|
|
@@ -124,6 +124,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
124
124
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
## Recurring Tasks (Cron System)
|
|
128
|
+
|
|
129
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
130
|
+
|
|
131
|
+
- You will receive the task description as a normal message in your terminal
|
|
132
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
133
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
134
|
+
|
|
135
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
127
136
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
128
137
|
|
|
129
138
|
## Error Learning Protocol
|
|
@@ -113,6 +113,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
113
113
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Recurring Tasks (Cron System)
|
|
117
|
+
|
|
118
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
119
|
+
|
|
120
|
+
- You will receive the task description as a normal message in your terminal
|
|
121
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
122
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
123
|
+
|
|
124
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
116
125
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
117
126
|
|
|
118
127
|
## Error Learning Protocol
|
|
@@ -113,6 +113,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
113
113
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Recurring Tasks (Cron System)
|
|
117
|
+
|
|
118
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
119
|
+
|
|
120
|
+
- You will receive the task description as a normal message in your terminal
|
|
121
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
122
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
123
|
+
|
|
124
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
116
125
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
117
126
|
|
|
118
127
|
## Error Learning Protocol
|
|
@@ -103,4 +103,13 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
103
103
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
104
104
|
6. **Store cross-agent user preferences with `scope: project` + `category: user_preference`**
|
|
105
105
|
|
|
106
|
+
## Recurring Tasks (Cron System)
|
|
107
|
+
|
|
108
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
109
|
+
|
|
110
|
+
- You will receive the task description as a normal message in your terminal
|
|
111
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
112
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
113
|
+
|
|
114
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
106
115
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
@@ -127,6 +127,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
127
127
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
## Recurring Tasks (Cron System)
|
|
131
|
+
|
|
132
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
133
|
+
|
|
134
|
+
- You will receive the task description as a normal message in your terminal
|
|
135
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
136
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
137
|
+
|
|
138
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
130
139
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
131
140
|
|
|
132
141
|
## Error Learning Protocol
|
|
@@ -100,6 +100,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
100
100
|
|
|
101
101
|
## Startup Protocol (#143)
|
|
102
102
|
|
|
103
|
+
## Recurring Tasks (Cron System)
|
|
104
|
+
|
|
105
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
106
|
+
|
|
107
|
+
- You will receive the task description as a normal message in your terminal
|
|
108
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
109
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
110
|
+
|
|
111
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
103
112
|
After checking in, **before** saying "Ready for tasks", perform these startup steps:
|
|
104
113
|
|
|
105
114
|
1. **Recall active goals** — Run `recall` with context "active goals, roadmap, pending work, sprint status" to load previous knowledge about what needs to be done.
|
|
@@ -113,6 +113,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
113
113
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Recurring Tasks (Cron System)
|
|
117
|
+
|
|
118
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
119
|
+
|
|
120
|
+
- You will receive the task description as a normal message in your terminal
|
|
121
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
122
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
123
|
+
|
|
124
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
116
125
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
117
126
|
|
|
118
127
|
## Error Learning Protocol
|
|
@@ -113,6 +113,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
113
113
|
bash {{AGENT_SKILLS_PATH}}/core/record-learning/execute.sh '{"agentId":"{{SESSION_NAME}}","agentRole":"{{ROLE}}","projectPath":"{{PROJECT_PATH}}","learning":"Current progress: [what was done]. Remaining: [what is left]. Key findings: [important notes]"}'
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Recurring Tasks (Cron System)
|
|
117
|
+
|
|
118
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
119
|
+
|
|
120
|
+
- You will receive the task description as a normal message in your terminal
|
|
121
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
122
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
123
|
+
|
|
124
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
116
125
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
117
126
|
|
|
118
127
|
## Error Learning Protocol
|
|
@@ -96,6 +96,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
96
96
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
97
97
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
98
98
|
|
|
99
|
+
## Recurring Tasks (Cron System)
|
|
100
|
+
|
|
101
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
102
|
+
|
|
103
|
+
- You will receive the task description as a normal message in your terminal
|
|
104
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
105
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
106
|
+
|
|
107
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
99
108
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
100
109
|
|
|
101
110
|
## Error Learning Protocol
|
|
@@ -95,6 +95,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
95
95
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
96
96
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
97
97
|
|
|
98
|
+
## Recurring Tasks (Cron System)
|
|
99
|
+
|
|
100
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
101
|
+
|
|
102
|
+
- You will receive the task description as a normal message in your terminal
|
|
103
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
104
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
105
|
+
|
|
106
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
98
107
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
99
108
|
|
|
100
109
|
## Error Learning Protocol
|
|
@@ -95,6 +95,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
95
95
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
96
96
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
97
97
|
|
|
98
|
+
## Recurring Tasks (Cron System)
|
|
99
|
+
|
|
100
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
101
|
+
|
|
102
|
+
- You will receive the task description as a normal message in your terminal
|
|
103
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
104
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
105
|
+
|
|
106
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
98
107
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
99
108
|
|
|
100
109
|
## Error Learning Protocol
|
|
@@ -18,6 +18,8 @@ You are a **Team Leader** (hierarchyLevel=1) responsible for managing a sub-team
|
|
|
18
18
|
|
|
19
19
|
**Core identity**: You are a manager, not an individual contributor. Your first reaction should be "Who is best suited for this?" — not "How do I write this code/content myself?" Delegate 90% of execution tasks to your workers. Only handle complex coordination yourself.
|
|
20
20
|
|
|
21
|
+
**Worker activation**: Before delegating a task, check worker status via `get-team-status`. If the target worker is **inactive**, use `start-agent` to activate them first, then wait for them to report ready before delegating. Never skip delegation just because workers are offline — wake them up.
|
|
22
|
+
|
|
21
23
|
**Hierarchy position**: You report directly to the Orchestrator and manage all workers whose `parentMemberId` points to you.
|
|
22
24
|
|
|
23
25
|
## Your Workers
|
|
@@ -185,4 +187,13 @@ Please run the register-self skill to let the team dashboard know you're availab
|
|
|
185
187
|
bash {{AGENT_SKILLS_PATH}}/core/register-self/execute.sh '{"role":"{{ROLE}}","sessionName":"{{SESSION_NAME}}"}'
|
|
186
188
|
```
|
|
187
189
|
|
|
190
|
+
## Recurring Tasks (Cron System)
|
|
191
|
+
|
|
192
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
193
|
+
|
|
194
|
+
- You will receive the task description as a normal message in your terminal
|
|
195
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
196
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
197
|
+
|
|
198
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
188
199
|
After checking in, say "Ready for tasks" and wait for the Orchestrator to send you work.
|
|
@@ -96,6 +96,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
96
96
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
97
97
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
98
98
|
|
|
99
|
+
## Recurring Tasks (Cron System)
|
|
100
|
+
|
|
101
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
102
|
+
|
|
103
|
+
- You will receive the task description as a normal message in your terminal
|
|
104
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
105
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
106
|
+
|
|
107
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
99
108
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
100
109
|
|
|
101
110
|
## Error Learning Protocol
|
|
@@ -97,6 +97,15 @@ You have bash skills that let you store and retrieve knowledge that persists acr
|
|
|
97
97
|
4. **Store project knowledge with `scope: project`** so other agents can benefit
|
|
98
98
|
5. **Store personal knowledge with `scope: agent`** for role-specific learnings
|
|
99
99
|
|
|
100
|
+
## Recurring Tasks (Cron System)
|
|
101
|
+
|
|
102
|
+
Your team has a built-in cron system. The orchestrator or user can schedule recurring tasks that are automatically sent to you on a schedule (e.g., daily reports, weekly checks). When a cron task fires:
|
|
103
|
+
|
|
104
|
+
- You will receive the task description as a normal message in your terminal
|
|
105
|
+
- Treat it like any other task from the orchestrator — execute it and report results
|
|
106
|
+
- If you were offline, Crewly auto-started you to deliver the task
|
|
107
|
+
|
|
108
|
+
You do not need to manage cron tasks yourself — the orchestrator handles creation and scheduling. If you need a recurring task set up, ask the orchestrator.
|
|
100
109
|
After checking in, just say "Ready for tasks" and wait for me to send you work.
|
|
101
110
|
|
|
102
111
|
## Error Learning Protocol
|
|
@@ -7,6 +7,37 @@
|
|
|
7
7
|
# Base URL for the Crewly backend API
|
|
8
8
|
CREWLY_API_URL="${CREWLY_API_URL:-http://localhost:8787}"
|
|
9
9
|
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
|
+
# Universal --file flag preprocessor (#EOF-fix)
|
|
12
|
+
#
|
|
13
|
+
# Fixes Gemini CLI's "unexpected EOF while looking for matching `'" errors.
|
|
14
|
+
#
|
|
15
|
+
# Root cause: When an LLM CLI passes JSON as a shell argument, special chars
|
|
16
|
+
# inside the JSON (single quotes, backticks, parentheses, $variables) get
|
|
17
|
+
# interpreted by the shell BEFORE the script runs, causing parse errors.
|
|
18
|
+
#
|
|
19
|
+
# Solution: The LLM writes JSON to a temp file, then passes --file <path>.
|
|
20
|
+
# This preprocessor detects --file as the first argument, reads the file,
|
|
21
|
+
# and replaces the script's positional parameters with the file contents.
|
|
22
|
+
# All downstream parsing (read_json_input, custom arg loops) works unchanged.
|
|
23
|
+
#
|
|
24
|
+
# Usage (by LLM CLI):
|
|
25
|
+
# printf '%s' '{"summary":"text with 'quotes'"}' > /tmp/crewly_input.json
|
|
26
|
+
# bash execute.sh --file /tmp/crewly_input.json
|
|
27
|
+
#
|
|
28
|
+
# This runs at source-time, so every script that sources lib.sh gets it for free.
|
|
29
|
+
# -----------------------------------------------------------------------------
|
|
30
|
+
if [ "${1:-}" = "--file" ] && [ -n "${2:-}" ]; then
|
|
31
|
+
if [ -f "$2" ]; then
|
|
32
|
+
_CREWLY_FILE_CONTENT="$(cat "$2")"
|
|
33
|
+
set -- "$_CREWLY_FILE_CONTENT"
|
|
34
|
+
unset _CREWLY_FILE_CONTENT
|
|
35
|
+
else
|
|
36
|
+
echo '{"error":"File not found: '"$2"'"}' >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
fi
|
|
40
|
+
|
|
10
41
|
# -----------------------------------------------------------------------------
|
|
11
42
|
# read_json_input [arg]
|
|
12
43
|
#
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# Tests for lib.sh — shared skills library
|
|
4
|
+
# Covers: --file preprocessor, read_json_input, require_param, error_exit
|
|
5
|
+
# =============================================================================
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
PASS=0
|
|
10
|
+
FAIL=0
|
|
11
|
+
TOTAL=0
|
|
12
|
+
|
|
13
|
+
# Color output
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
NC='\033[0m' # No Color
|
|
17
|
+
|
|
18
|
+
assert_eq() {
|
|
19
|
+
local test_name="$1" expected="$2" actual="$3"
|
|
20
|
+
TOTAL=$((TOTAL + 1))
|
|
21
|
+
if [ "$expected" = "$actual" ]; then
|
|
22
|
+
echo -e "${GREEN}PASS${NC}: $test_name"
|
|
23
|
+
PASS=$((PASS + 1))
|
|
24
|
+
else
|
|
25
|
+
echo -e "${RED}FAIL${NC}: $test_name"
|
|
26
|
+
echo " Expected: $expected"
|
|
27
|
+
echo " Actual: $actual"
|
|
28
|
+
FAIL=$((FAIL + 1))
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
assert_contains() {
|
|
33
|
+
local test_name="$1" expected_substr="$2" actual="$3"
|
|
34
|
+
TOTAL=$((TOTAL + 1))
|
|
35
|
+
if echo "$actual" | grep -q "$expected_substr"; then
|
|
36
|
+
echo -e "${GREEN}PASS${NC}: $test_name"
|
|
37
|
+
PASS=$((PASS + 1))
|
|
38
|
+
else
|
|
39
|
+
echo -e "${RED}FAIL${NC}: $test_name"
|
|
40
|
+
echo " Expected to contain: $expected_substr"
|
|
41
|
+
echo " Actual: $actual"
|
|
42
|
+
FAIL=$((FAIL + 1))
|
|
43
|
+
fi
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
assert_exit_code() {
|
|
47
|
+
local test_name="$1" expected_code="$2"
|
|
48
|
+
shift 2
|
|
49
|
+
local actual_code=0
|
|
50
|
+
"$@" >/dev/null 2>&1 || actual_code=$?
|
|
51
|
+
TOTAL=$((TOTAL + 1))
|
|
52
|
+
if [ "$expected_code" = "$actual_code" ]; then
|
|
53
|
+
echo -e "${GREEN}PASS${NC}: $test_name"
|
|
54
|
+
PASS=$((PASS + 1))
|
|
55
|
+
else
|
|
56
|
+
echo -e "${RED}FAIL${NC}: $test_name"
|
|
57
|
+
echo " Expected exit code: $expected_code"
|
|
58
|
+
echo " Actual exit code: $actual_code"
|
|
59
|
+
FAIL=$((FAIL + 1))
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Create a minimal test skill script that sources lib.sh and echoes $1
|
|
64
|
+
TEMP_DIR=$(mktemp -d)
|
|
65
|
+
trap "rm -rf $TEMP_DIR" EXIT
|
|
66
|
+
|
|
67
|
+
cat > "$TEMP_DIR/test_skill.sh" << 'SKILL_EOF'
|
|
68
|
+
#!/bin/bash
|
|
69
|
+
set -euo pipefail
|
|
70
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
71
|
+
# Source lib.sh via the real path
|
|
72
|
+
source "$LIB_PATH"
|
|
73
|
+
# Output the first positional parameter (after preprocessor runs)
|
|
74
|
+
echo "$1"
|
|
75
|
+
SKILL_EOF
|
|
76
|
+
chmod +x "$TEMP_DIR/test_skill.sh"
|
|
77
|
+
|
|
78
|
+
# Also create a test skill that uses read_json_input
|
|
79
|
+
cat > "$TEMP_DIR/test_read_json.sh" << 'SKILL_EOF'
|
|
80
|
+
#!/bin/bash
|
|
81
|
+
set -euo pipefail
|
|
82
|
+
source "$LIB_PATH"
|
|
83
|
+
INPUT=$(read_json_input "${1:-}")
|
|
84
|
+
echo "$INPUT"
|
|
85
|
+
SKILL_EOF
|
|
86
|
+
chmod +x "$TEMP_DIR/test_read_json.sh"
|
|
87
|
+
|
|
88
|
+
export LIB_PATH="$SCRIPT_DIR/lib.sh"
|
|
89
|
+
|
|
90
|
+
echo "=== lib.sh Test Suite ==="
|
|
91
|
+
echo ""
|
|
92
|
+
|
|
93
|
+
# ---- Test 1: --file flag reads JSON from file ----
|
|
94
|
+
echo '{"key":"value","text":"hello world"}' > "$TEMP_DIR/input.json"
|
|
95
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/input.json")
|
|
96
|
+
assert_eq "--file reads JSON from file" '{"key":"value","text":"hello world"}' "$RESULT"
|
|
97
|
+
|
|
98
|
+
# ---- Test 2: --file with special characters (the whole point!) ----
|
|
99
|
+
printf '%s' '{"summary":"text with '\''quotes'\'' and (parens) and `backticks`"}' > "$TEMP_DIR/special.json"
|
|
100
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/special.json")
|
|
101
|
+
assert_contains "--file handles single quotes" "quotes" "$RESULT"
|
|
102
|
+
assert_contains "--file handles parentheses" "(parens)" "$RESULT"
|
|
103
|
+
assert_contains "--file handles backticks" "backticks" "$RESULT"
|
|
104
|
+
|
|
105
|
+
# ---- Test 3: --file with multiline JSON ----
|
|
106
|
+
cat > "$TEMP_DIR/multiline.json" << 'MULTI_EOF'
|
|
107
|
+
{"summary":"line 1\nline 2\nline 3","status":"done"}
|
|
108
|
+
MULTI_EOF
|
|
109
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/multiline.json")
|
|
110
|
+
assert_contains "--file handles multiline content" "line 1" "$RESULT"
|
|
111
|
+
|
|
112
|
+
# ---- Test 4: --file with nonexistent file fails ----
|
|
113
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "/tmp/nonexistent_crewly_test_file.json" 2>&1 || true)
|
|
114
|
+
assert_contains "--file with missing file reports error" "File not found" "$RESULT"
|
|
115
|
+
|
|
116
|
+
# ---- Test 5: Direct JSON argument still works (backward compat) ----
|
|
117
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" '{"key":"direct"}')
|
|
118
|
+
assert_eq "Direct JSON argument works" '{"key":"direct"}' "$RESULT"
|
|
119
|
+
|
|
120
|
+
# ---- Test 6: read_json_input with --file ----
|
|
121
|
+
echo '{"agentId":"dev-1","content":"test memory"}' > "$TEMP_DIR/read_input.json"
|
|
122
|
+
RESULT=$(bash "$TEMP_DIR/test_read_json.sh" --file "$TEMP_DIR/read_input.json")
|
|
123
|
+
assert_contains "read_json_input with --file" "dev-1" "$RESULT"
|
|
124
|
+
|
|
125
|
+
# ---- Test 7: read_json_input with @filepath ----
|
|
126
|
+
echo '{"agentId":"dev-2","content":"at-file test"}' > "$TEMP_DIR/at_input.json"
|
|
127
|
+
RESULT=$(bash "$TEMP_DIR/test_read_json.sh" "@$TEMP_DIR/at_input.json")
|
|
128
|
+
assert_contains "read_json_input with @filepath" "dev-2" "$RESULT"
|
|
129
|
+
|
|
130
|
+
# ---- Test 8: read_json_input with stdin pipe ----
|
|
131
|
+
RESULT=$(echo '{"agentId":"dev-3","content":"stdin test"}' | bash "$TEMP_DIR/test_read_json.sh")
|
|
132
|
+
assert_contains "read_json_input with stdin pipe" "dev-3" "$RESULT"
|
|
133
|
+
|
|
134
|
+
# ---- Test 9: read_json_input with direct JSON arg ----
|
|
135
|
+
RESULT=$(bash "$TEMP_DIR/test_read_json.sh" '{"agentId":"dev-4"}')
|
|
136
|
+
assert_contains "read_json_input with direct arg" "dev-4" "$RESULT"
|
|
137
|
+
|
|
138
|
+
# ---- Test 10: --file with Unicode content ----
|
|
139
|
+
printf '%s' '{"text":"Chinese: 你好世界, Japanese: こんにちは"}' > "$TEMP_DIR/unicode.json"
|
|
140
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/unicode.json")
|
|
141
|
+
assert_contains "--file handles Unicode" "你好世界" "$RESULT"
|
|
142
|
+
|
|
143
|
+
# ---- Test 11: --file with dollar signs and variables ----
|
|
144
|
+
printf '%s' '{"text":"Price is $100, env is ${HOME}"}' > "$TEMP_DIR/dollar.json"
|
|
145
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/dollar.json")
|
|
146
|
+
assert_contains "--file preserves dollar signs" '$100' "$RESULT"
|
|
147
|
+
assert_contains "--file preserves \\\${} syntax" '${HOME}' "$RESULT"
|
|
148
|
+
|
|
149
|
+
# ---- Test 12: --file with newlines in JSON values ----
|
|
150
|
+
printf '%s' '{"text":"line1\nline2\nline3"}' > "$TEMP_DIR/newlines.json"
|
|
151
|
+
RESULT=$(bash "$TEMP_DIR/test_skill.sh" --file "$TEMP_DIR/newlines.json")
|
|
152
|
+
assert_contains "--file preserves escaped newlines" 'line1\\nline2' "$RESULT"
|
|
153
|
+
|
|
154
|
+
# ---- Test 13: --file with empty JSON ----
|
|
155
|
+
echo '{}' > "$TEMP_DIR/empty.json"
|
|
156
|
+
RESULT=$(bash "$TEMP_DIR/test_read_json.sh" --file "$TEMP_DIR/empty.json")
|
|
157
|
+
assert_eq "--file with empty JSON" '{}' "$RESULT"
|
|
158
|
+
|
|
159
|
+
echo ""
|
|
160
|
+
echo "=== Results: $PASS/$TOTAL passed, $FAIL failed ==="
|
|
161
|
+
|
|
162
|
+
if [ "$FAIL" -gt 0 ]; then
|
|
163
|
+
exit 1
|
|
164
|
+
fi
|
|
@@ -16,10 +16,12 @@ require_param "reason" "$REASON"
|
|
|
16
16
|
|
|
17
17
|
BODY=$(jq -n \
|
|
18
18
|
--arg absoluteTaskPath "$ABSOLUTE_TASK_PATH" \
|
|
19
|
+
--arg taskPath "$ABSOLUTE_TASK_PATH" \
|
|
19
20
|
--arg reason "$REASON" \
|
|
21
|
+
--arg blockReason "$REASON" \
|
|
20
22
|
--arg questions "$QUESTIONS" \
|
|
21
23
|
--arg urgency "$URGENCY" \
|
|
22
|
-
'{absoluteTaskPath: $absoluteTaskPath, reason: $reason} +
|
|
24
|
+
'{absoluteTaskPath: $absoluteTaskPath, taskPath: $taskPath, reason: $reason, blockReason: $blockReason} +
|
|
23
25
|
(if $questions != "" then {questions: $questions} else {} end) +
|
|
24
26
|
(if $urgency != "" then {urgency: $urgency} else {} end)')
|
|
25
27
|
|