crewly 1.5.15 → 1.5.16
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/skills/agent/browse-stealth/stealth-browse.py +7 -2
- package/config/skills/agent/core/recall/execute.sh +94 -17
- package/config/skills/agent/core/record-learning/execute.sh +91 -22
- package/config/skills/agent/core/remember/execute.sh +129 -22
- package/config/skills/agent/core/report-status/execute.sh +139 -25
- package/config/skills/agent/core/send-message/execute.sh +90 -8
- package/config/skills/team-leader/delegate-task/execute.sh +69 -13
- package/dist/backend/backend/src/constants.d.ts +20 -3
- package/dist/backend/backend/src/constants.d.ts.map +1 -1
- package/dist/backend/backend/src/constants.js +21 -4
- package/dist/backend/backend/src/constants.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts +7 -9
- 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 +28 -17
- 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.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +38 -19
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
- package/dist/backend/backend/src/services/session/session-command-helper.d.ts.map +1 -1
- package/dist/backend/backend/src/services/session/session-command-helper.js +13 -0
- package/dist/backend/backend/src/services/session/session-command-helper.js.map +1 -1
- package/dist/cli/backend/src/constants.d.ts +20 -3
- package/dist/cli/backend/src/constants.d.ts.map +1 -1
- package/dist/cli/backend/src/constants.js +21 -4
- package/dist/cli/backend/src/constants.js.map +1 -1
- package/frontend/dist/assets/{index-371b68d4.css → index-a2db8a73.css} +1 -1
- package/frontend/dist/assets/{index-506f70da.js → index-d516a3cd.js} +147 -147
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -285,9 +285,14 @@ def main():
|
|
|
285
285
|
}))
|
|
286
286
|
sys.exit(1)
|
|
287
287
|
|
|
288
|
-
#
|
|
288
|
+
# Connect to Chrome via CDP on the specified port.
|
|
289
|
+
# For custom ports, connect directly. For default port (9222), fall back to
|
|
290
|
+
# ensure_chrome_running() which can auto-launch Chrome if needed.
|
|
289
291
|
try:
|
|
290
|
-
|
|
292
|
+
if args.cdp_port != CDP_PORT:
|
|
293
|
+
ws_url = get_ws_url(args.cdp_port)
|
|
294
|
+
else:
|
|
295
|
+
ws_url = ensure_chrome_running()
|
|
291
296
|
except Exception as e:
|
|
292
297
|
print(json.dumps({"success": False, "error": f"chrome_launch_failed: {e}"}))
|
|
293
298
|
sys.exit(1)
|
|
@@ -1,24 +1,101 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Retrieve stored memories relevant to a given context
|
|
2
|
+
# Retrieve stored memories relevant to a given context.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
INPUT_JSON=""
|
|
9
|
+
AGENT_ID=""
|
|
10
|
+
CONTEXT=""
|
|
11
|
+
SCOPE=""
|
|
12
|
+
LIMIT=""
|
|
13
|
+
PROJECT_PATH=""
|
|
14
|
+
|
|
15
|
+
# Detect legacy JSON argument
|
|
16
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
17
|
+
INPUT_JSON="$1"
|
|
18
|
+
shift || true
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
while [[ $# -gt 0 ]]; do
|
|
22
|
+
case "$1" in
|
|
23
|
+
--agent|-a)
|
|
24
|
+
AGENT_ID="$2"
|
|
25
|
+
shift 2
|
|
26
|
+
;;
|
|
27
|
+
--context|-c)
|
|
28
|
+
CONTEXT="$2"
|
|
29
|
+
shift 2
|
|
30
|
+
;;
|
|
31
|
+
--scope|-s)
|
|
32
|
+
SCOPE="$2"
|
|
33
|
+
shift 2
|
|
34
|
+
;;
|
|
35
|
+
--limit|-l)
|
|
36
|
+
LIMIT="$2"
|
|
37
|
+
shift 2
|
|
38
|
+
;;
|
|
39
|
+
--project|-p)
|
|
40
|
+
PROJECT_PATH="$2"
|
|
41
|
+
shift 2
|
|
42
|
+
;;
|
|
43
|
+
--json|-j)
|
|
44
|
+
INPUT_JSON="$2"
|
|
45
|
+
shift 2
|
|
46
|
+
;;
|
|
47
|
+
--help|-h)
|
|
48
|
+
echo "Usage: execute.sh --agent dev-1 --context 'topic to recall' --project /path [--scope project|agent] [--limit 10]"
|
|
49
|
+
exit 0
|
|
50
|
+
;;
|
|
51
|
+
--)
|
|
52
|
+
shift
|
|
53
|
+
break
|
|
54
|
+
;;
|
|
55
|
+
*)
|
|
56
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
57
|
+
INPUT_JSON="$1"
|
|
58
|
+
shift
|
|
59
|
+
else
|
|
60
|
+
error_exit "Unknown argument: $1"
|
|
61
|
+
fi
|
|
62
|
+
;;
|
|
63
|
+
esac
|
|
64
|
+
done
|
|
65
|
+
|
|
66
|
+
# Read from stdin if no context yet
|
|
67
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$CONTEXT" ] && [ ! -t 0 ]; then
|
|
68
|
+
STDIN_DATA="$(cat)"
|
|
69
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
70
|
+
INPUT_JSON="$STDIN_DATA"
|
|
71
|
+
else
|
|
72
|
+
CONTEXT="$STDIN_DATA"
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# Parse JSON if provided
|
|
77
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
78
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
79
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
80
|
+
[ -z "$CONTEXT" ] && CONTEXT=$(printf '%s' "$INPUT" | jq -r '.context // empty')
|
|
81
|
+
[ -z "$SCOPE" ] && SCOPE=$(printf '%s' "$INPUT" | jq -r '.scope // empty')
|
|
82
|
+
[ -z "$LIMIT" ] && LIMIT=$(printf '%s' "$INPUT" | jq -r '.limit // empty')
|
|
83
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
87
|
+
require_param "context (--context)" "$CONTEXT"
|
|
88
|
+
|
|
89
|
+
# Build body using env vars for safe escaping
|
|
90
|
+
export _RCL_AGENT="$AGENT_ID"
|
|
91
|
+
export _RCL_CTX="$CONTEXT"
|
|
92
|
+
|
|
93
|
+
BODY=$(jq -n '{agentId: env._RCL_AGENT, context: env._RCL_CTX}')
|
|
94
|
+
|
|
95
|
+
[ -n "$SCOPE" ] && BODY=$(echo "$BODY" | jq --arg s "$SCOPE" '. + {scope: $s}')
|
|
96
|
+
[ -n "$LIMIT" ] && BODY=$(echo "$BODY" | jq --arg l "$LIMIT" '. + {limit: ($l | tonumber)}')
|
|
97
|
+
[ -n "$PROJECT_PATH" ] && BODY=$(echo "$BODY" | jq --arg p "$PROJECT_PATH" '. + {projectPath: $p}')
|
|
98
|
+
|
|
99
|
+
unset _RCL_AGENT _RCL_CTX
|
|
23
100
|
|
|
24
101
|
api_call POST "/memory/recall" "$BODY"
|
|
@@ -1,29 +1,98 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Record a learning or insight for team knowledge sharing
|
|
2
|
+
# Record a learning or insight for team knowledge sharing.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
INPUT_JSON=""
|
|
9
|
+
AGENT_ID=""
|
|
10
|
+
AGENT_ROLE=""
|
|
11
|
+
PROJECT_PATH=""
|
|
12
|
+
LEARNING=""
|
|
13
|
+
|
|
14
|
+
# Detect legacy JSON argument
|
|
15
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
16
|
+
INPUT_JSON="$1"
|
|
17
|
+
shift || true
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
while [[ $# -gt 0 ]]; do
|
|
21
|
+
case "$1" in
|
|
22
|
+
--agent|-a)
|
|
23
|
+
AGENT_ID="$2"
|
|
24
|
+
shift 2
|
|
25
|
+
;;
|
|
26
|
+
--role|-r)
|
|
27
|
+
AGENT_ROLE="$2"
|
|
28
|
+
shift 2
|
|
29
|
+
;;
|
|
30
|
+
--project|-p)
|
|
31
|
+
PROJECT_PATH="$2"
|
|
32
|
+
shift 2
|
|
33
|
+
;;
|
|
34
|
+
--learning|-l)
|
|
35
|
+
LEARNING="$2"
|
|
36
|
+
shift 2
|
|
37
|
+
;;
|
|
38
|
+
--learning-file)
|
|
39
|
+
LEARNING="$(cat "$2")"
|
|
40
|
+
shift 2
|
|
41
|
+
;;
|
|
42
|
+
--json|-j)
|
|
43
|
+
INPUT_JSON="$2"
|
|
44
|
+
shift 2
|
|
45
|
+
;;
|
|
46
|
+
--help|-h)
|
|
47
|
+
echo "Usage: execute.sh --agent dev-1 --role developer --project /path --learning 'What I learned'"
|
|
48
|
+
exit 0
|
|
49
|
+
;;
|
|
50
|
+
--)
|
|
51
|
+
shift
|
|
52
|
+
break
|
|
53
|
+
;;
|
|
54
|
+
*)
|
|
55
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
56
|
+
INPUT_JSON="$1"
|
|
57
|
+
shift
|
|
58
|
+
else
|
|
59
|
+
error_exit "Unknown argument: $1"
|
|
60
|
+
fi
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
done
|
|
64
|
+
|
|
65
|
+
# Read from stdin if no learning yet
|
|
66
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$LEARNING" ] && [ ! -t 0 ]; then
|
|
67
|
+
STDIN_DATA="$(cat)"
|
|
68
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
69
|
+
INPUT_JSON="$STDIN_DATA"
|
|
70
|
+
else
|
|
71
|
+
LEARNING="$STDIN_DATA"
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Parse JSON if provided
|
|
76
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
77
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
78
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
79
|
+
[ -z "$AGENT_ROLE" ] && AGENT_ROLE=$(printf '%s' "$INPUT" | jq -r '.agentRole // empty')
|
|
80
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
81
|
+
[ -z "$LEARNING" ] && LEARNING=$(printf '%s' "$INPUT" | jq -r '.learning // empty')
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
85
|
+
require_param "agentRole (--role)" "$AGENT_ROLE"
|
|
86
|
+
require_param "projectPath (--project)" "$PROJECT_PATH"
|
|
87
|
+
require_param "learning (--learning)" "$LEARNING"
|
|
88
|
+
|
|
89
|
+
# Build body using env vars for safe escaping
|
|
90
|
+
export _LRN_AGENT="$AGENT_ID"
|
|
91
|
+
export _LRN_ROLE="$AGENT_ROLE"
|
|
92
|
+
export _LRN_PROJECT="$PROJECT_PATH"
|
|
93
|
+
export _LRN_CONTENT="$LEARNING"
|
|
94
|
+
|
|
95
|
+
BODY=$(jq -n '{agentId: env._LRN_AGENT, agentRole: env._LRN_ROLE, projectPath: env._LRN_PROJECT, learning: env._LRN_CONTENT}')
|
|
96
|
+
unset _LRN_AGENT _LRN_ROLE _LRN_PROJECT _LRN_CONTENT
|
|
28
97
|
|
|
29
98
|
api_call POST "/memory/record-learning" "$BODY"
|
|
@@ -1,35 +1,142 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Store a memory entry for future recall
|
|
2
|
+
# Store a memory entry for future recall.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
print_usage() {
|
|
9
|
+
cat <<'EOF_USAGE'
|
|
10
|
+
Usage:
|
|
11
|
+
# CLI flags (preferred)
|
|
12
|
+
bash execute.sh --agent dev-1 --content "Important finding" --category pattern --scope project --project /path
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
# Content from stdin
|
|
15
|
+
echo "Multi-line finding" | bash execute.sh --agent dev-1 --category pattern --scope project --project /path
|
|
16
|
+
|
|
17
|
+
# Content from file
|
|
18
|
+
bash execute.sh --agent dev-1 --content-file /tmp/finding.txt --category pattern --scope project
|
|
19
|
+
|
|
20
|
+
# Legacy JSON (backward compatible)
|
|
21
|
+
bash execute.sh '{"agentId":"dev-1","content":"...","category":"pattern","scope":"project"}'
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--agent | -a Agent ID / session name (required)
|
|
25
|
+
--content | -c Memory content text (required unless piped via stdin)
|
|
26
|
+
--content-file Read content from file path
|
|
27
|
+
--category | -C Category: pattern, decision, gotcha, fact, preference (required)
|
|
28
|
+
--scope | -s Scope: project or agent (required)
|
|
29
|
+
--project | -p Project path (required for project scope)
|
|
30
|
+
--json | -j Raw JSON payload
|
|
31
|
+
--help | -h Show this help
|
|
32
|
+
EOF_USAGE
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
INPUT_JSON=""
|
|
36
|
+
AGENT_ID=""
|
|
37
|
+
CONTENT=""
|
|
38
|
+
CATEGORY=""
|
|
39
|
+
SCOPE=""
|
|
40
|
+
PROJECT_PATH=""
|
|
41
|
+
|
|
42
|
+
# Detect legacy JSON argument
|
|
43
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
44
|
+
INPUT_JSON="$1"
|
|
45
|
+
shift || true
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
while [[ $# -gt 0 ]]; do
|
|
49
|
+
case "$1" in
|
|
50
|
+
--agent|-a)
|
|
51
|
+
AGENT_ID="$2"
|
|
52
|
+
shift 2
|
|
53
|
+
;;
|
|
54
|
+
--content|-c)
|
|
55
|
+
CONTENT="$2"
|
|
56
|
+
shift 2
|
|
57
|
+
;;
|
|
58
|
+
--content-file)
|
|
59
|
+
CONTENT="$(cat "$2")"
|
|
60
|
+
shift 2
|
|
61
|
+
;;
|
|
62
|
+
--category|-C)
|
|
63
|
+
CATEGORY="$2"
|
|
64
|
+
shift 2
|
|
65
|
+
;;
|
|
66
|
+
--scope|-s)
|
|
67
|
+
SCOPE="$2"
|
|
68
|
+
shift 2
|
|
69
|
+
;;
|
|
70
|
+
--project|-p)
|
|
71
|
+
PROJECT_PATH="$2"
|
|
72
|
+
shift 2
|
|
73
|
+
;;
|
|
74
|
+
--json|-j)
|
|
75
|
+
INPUT_JSON="$2"
|
|
76
|
+
shift 2
|
|
77
|
+
;;
|
|
78
|
+
--help|-h)
|
|
79
|
+
print_usage
|
|
80
|
+
exit 0
|
|
81
|
+
;;
|
|
82
|
+
--)
|
|
83
|
+
shift
|
|
84
|
+
break
|
|
85
|
+
;;
|
|
86
|
+
*)
|
|
87
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
88
|
+
INPUT_JSON="$1"
|
|
89
|
+
shift
|
|
90
|
+
else
|
|
91
|
+
error_exit "Unknown argument: $1. Use --help for usage."
|
|
92
|
+
fi
|
|
93
|
+
;;
|
|
94
|
+
esac
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# Read from stdin if no content yet
|
|
98
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$CONTENT" ] && [ ! -t 0 ]; then
|
|
99
|
+
STDIN_DATA="$(cat)"
|
|
100
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
101
|
+
INPUT_JSON="$STDIN_DATA"
|
|
102
|
+
else
|
|
103
|
+
CONTENT="$STDIN_DATA"
|
|
104
|
+
fi
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Parse JSON if provided
|
|
108
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
109
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
110
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
111
|
+
[ -z "$CONTENT" ] && CONTENT=$(printf '%s' "$INPUT" | jq -r '.content // empty')
|
|
112
|
+
[ -z "$CATEGORY" ] && CATEGORY=$(printf '%s' "$INPUT" | jq -r '.category // empty')
|
|
113
|
+
[ -z "$SCOPE" ] && SCOPE=$(printf '%s' "$INPUT" | jq -r '.scope // empty')
|
|
114
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
118
|
+
require_param "content (--content)" "$CONTENT"
|
|
119
|
+
require_param "category (--category)" "$CATEGORY"
|
|
120
|
+
require_param "scope (--scope)" "$SCOPE"
|
|
18
121
|
|
|
19
122
|
# #187: Auto-inject projectPath from CREWLY_PROJECT_PATH env var when not provided
|
|
20
|
-
PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
21
123
|
if [ -z "$PROJECT_PATH" ] && [ -n "${CREWLY_PROJECT_PATH:-}" ]; then
|
|
22
|
-
|
|
124
|
+
PROJECT_PATH="$CREWLY_PROJECT_PATH"
|
|
23
125
|
fi
|
|
24
126
|
|
|
25
|
-
# Build body
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
127
|
+
# Build body using env vars to safely handle special characters
|
|
128
|
+
export _MEM_AGENT="$AGENT_ID"
|
|
129
|
+
export _MEM_CONTENT="$CONTENT"
|
|
130
|
+
export _MEM_CATEGORY="$CATEGORY"
|
|
131
|
+
export _MEM_SCOPE="$SCOPE"
|
|
132
|
+
|
|
133
|
+
if [ -n "$PROJECT_PATH" ]; then
|
|
134
|
+
export _MEM_PROJECT="$PROJECT_PATH"
|
|
135
|
+
BODY=$(jq -n '{agentId: env._MEM_AGENT, content: env._MEM_CONTENT, category: env._MEM_CATEGORY, scope: env._MEM_SCOPE, projectPath: env._MEM_PROJECT}')
|
|
136
|
+
unset _MEM_PROJECT
|
|
137
|
+
else
|
|
138
|
+
BODY=$(jq -n '{agentId: env._MEM_AGENT, content: env._MEM_CONTENT, category: env._MEM_CATEGORY, scope: env._MEM_SCOPE}')
|
|
139
|
+
fi
|
|
140
|
+
unset _MEM_AGENT _MEM_CONTENT _MEM_CATEGORY _MEM_SCOPE
|
|
34
141
|
|
|
35
142
|
api_call POST "/memory/remember" "$BODY"
|
|
@@ -1,26 +1,149 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Report task status to the orchestrator
|
|
3
|
+
# Supports both CLI flags (preferred) and legacy JSON argument.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
print_usage() {
|
|
9
|
+
cat <<'EOF_USAGE'
|
|
10
|
+
Usage:
|
|
11
|
+
# CLI flags (preferred — avoids shell escaping issues)
|
|
12
|
+
bash execute.sh --session dev-1 --status done --summary "Fixed the bug" --project /path/to/project
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
SUMMARY=$(printf '%s' "$INPUT" | jq -r '.summary // empty')
|
|
13
|
-
TASK_PATH=$(printf '%s' "$INPUT" | jq -r '.taskPath // empty')
|
|
14
|
-
require_param "sessionName" "$SESSION_NAME"
|
|
15
|
-
require_param "status" "$STATUS"
|
|
16
|
-
require_param "summary" "$SUMMARY"
|
|
14
|
+
# Summary from stdin (for multi-line or special characters)
|
|
15
|
+
echo "Fixed the bug — it's working" | bash execute.sh --session dev-1 --status done --project /path
|
|
17
16
|
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
# Summary from file
|
|
18
|
+
bash execute.sh --session dev-1 --status done --summary-file /tmp/summary.txt --project /path
|
|
19
|
+
|
|
20
|
+
# Legacy JSON argument (backward compatible)
|
|
21
|
+
bash execute.sh '{"sessionName":"dev-1","status":"done","summary":"Fixed the bug"}'
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--session | -s Agent session name (required)
|
|
25
|
+
--status | -S Status: done, blocked, failed, in_progress, active (required)
|
|
26
|
+
--summary | -m Status summary text (required unless piped via stdin)
|
|
27
|
+
--summary-file Read summary from file path
|
|
28
|
+
--project | -p Project path for auto-remember on completion
|
|
29
|
+
--task-path Task file path to auto-complete
|
|
30
|
+
--task-id Task ID (for structured StatusReport format)
|
|
31
|
+
--progress Progress percentage (0-100, for structured format)
|
|
32
|
+
--structured Use structured StatusReport format (true/false)
|
|
33
|
+
--json | -j Raw JSON payload (same as legacy)
|
|
34
|
+
--help | -h Show this help
|
|
35
|
+
EOF_USAGE
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
INPUT_JSON=""
|
|
39
|
+
SESSION_NAME=""
|
|
40
|
+
STATUS=""
|
|
41
|
+
SUMMARY=""
|
|
42
|
+
PROJECT_PATH=""
|
|
43
|
+
TASK_PATH=""
|
|
44
|
+
TASK_ID=""
|
|
45
|
+
PROGRESS=""
|
|
46
|
+
STRUCTURED="false"
|
|
47
|
+
|
|
48
|
+
# Detect legacy JSON argument as the first parameter
|
|
49
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
50
|
+
INPUT_JSON="$1"
|
|
51
|
+
shift || true
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
while [[ $# -gt 0 ]]; do
|
|
55
|
+
case "$1" in
|
|
56
|
+
--session|-s)
|
|
57
|
+
SESSION_NAME="$2"
|
|
58
|
+
shift 2
|
|
59
|
+
;;
|
|
60
|
+
--status|-S)
|
|
61
|
+
STATUS="$2"
|
|
62
|
+
shift 2
|
|
63
|
+
;;
|
|
64
|
+
--summary|-m)
|
|
65
|
+
SUMMARY="$2"
|
|
66
|
+
shift 2
|
|
67
|
+
;;
|
|
68
|
+
--summary-file)
|
|
69
|
+
SUMMARY="$(cat "$2")"
|
|
70
|
+
shift 2
|
|
71
|
+
;;
|
|
72
|
+
--project|-p)
|
|
73
|
+
PROJECT_PATH="$2"
|
|
74
|
+
shift 2
|
|
75
|
+
;;
|
|
76
|
+
--task-path)
|
|
77
|
+
TASK_PATH="$2"
|
|
78
|
+
shift 2
|
|
79
|
+
;;
|
|
80
|
+
--task-id)
|
|
81
|
+
TASK_ID="$2"
|
|
82
|
+
shift 2
|
|
83
|
+
;;
|
|
84
|
+
--progress)
|
|
85
|
+
PROGRESS="$2"
|
|
86
|
+
shift 2
|
|
87
|
+
;;
|
|
88
|
+
--structured)
|
|
89
|
+
STRUCTURED="true"
|
|
90
|
+
shift
|
|
91
|
+
;;
|
|
92
|
+
--json|-j)
|
|
93
|
+
INPUT_JSON="$2"
|
|
94
|
+
shift 2
|
|
95
|
+
;;
|
|
96
|
+
--help|-h)
|
|
97
|
+
print_usage
|
|
98
|
+
exit 0
|
|
99
|
+
;;
|
|
100
|
+
--)
|
|
101
|
+
shift
|
|
102
|
+
break
|
|
103
|
+
;;
|
|
104
|
+
*)
|
|
105
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
106
|
+
INPUT_JSON="$1"
|
|
107
|
+
shift
|
|
108
|
+
else
|
|
109
|
+
error_exit "Unknown argument: $1. Use --help for usage."
|
|
110
|
+
fi
|
|
111
|
+
;;
|
|
112
|
+
esac
|
|
113
|
+
done
|
|
114
|
+
|
|
115
|
+
# If nothing provided yet but stdin has data, read it as summary
|
|
116
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$SUMMARY" ] && [ ! -t 0 ]; then
|
|
117
|
+
STDIN_DATA="$(cat)"
|
|
118
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
119
|
+
INPUT_JSON="$STDIN_DATA"
|
|
120
|
+
else
|
|
121
|
+
SUMMARY="$STDIN_DATA"
|
|
122
|
+
fi
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# Parse JSON input if provided (backward compatible)
|
|
126
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
127
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
128
|
+
[ -z "$SESSION_NAME" ] && SESSION_NAME=$(printf '%s' "$INPUT" | jq -r '.sessionName // empty')
|
|
129
|
+
[ -z "$STATUS" ] && STATUS=$(printf '%s' "$INPUT" | jq -r '.status // empty')
|
|
130
|
+
[ -z "$SUMMARY" ] && SUMMARY=$(printf '%s' "$INPUT" | jq -r '.summary // empty')
|
|
131
|
+
[ -z "$TASK_PATH" ] && TASK_PATH=$(printf '%s' "$INPUT" | jq -r '.taskPath // empty')
|
|
132
|
+
[ -z "$TASK_ID" ] && TASK_ID=$(printf '%s' "$INPUT" | jq -r '.taskId // empty')
|
|
133
|
+
[ -z "$PROGRESS" ] && PROGRESS=$(printf '%s' "$INPUT" | jq -r '.progress // empty')
|
|
134
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
135
|
+
ARTIFACTS=$(printf '%s' "$INPUT" | jq -c '.artifacts // empty')
|
|
136
|
+
BLOCKERS=$(printf '%s' "$INPUT" | jq -c '.blockers // empty')
|
|
137
|
+
USE_STRUCTURED=$(printf '%s' "$INPUT" | jq -r '.structured // "false"')
|
|
138
|
+
[ "$USE_STRUCTURED" = "true" ] && STRUCTURED="true"
|
|
139
|
+
else
|
|
140
|
+
ARTIFACTS=""
|
|
141
|
+
BLOCKERS=""
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
require_param "sessionName (--session)" "$SESSION_NAME"
|
|
145
|
+
require_param "status (--status)" "$STATUS"
|
|
146
|
+
require_param "summary (--summary)" "$SUMMARY"
|
|
24
147
|
|
|
25
148
|
# Map simple status strings to InProgressTaskStatus values
|
|
26
149
|
map_status_to_state() {
|
|
@@ -34,7 +157,7 @@ map_status_to_state() {
|
|
|
34
157
|
}
|
|
35
158
|
|
|
36
159
|
# Build the message the orchestrator will receive
|
|
37
|
-
if [ "$
|
|
160
|
+
if [ "$STRUCTURED" = "true" ] && [ -n "$TASK_ID" ]; then
|
|
38
161
|
# Structured StatusReport format for hierarchical teams
|
|
39
162
|
STATE=$(map_status_to_state "$STATUS")
|
|
40
163
|
MESSAGE="---\n[STATUS REPORT]\nTask ID: ${TASK_ID}\nState: ${STATE}"
|
|
@@ -68,12 +191,6 @@ BODY=$(jq -n --arg content "$MESSAGE" --arg senderName "$SESSION_NAME" \
|
|
|
68
191
|
|
|
69
192
|
api_call POST "/chat/agent-response" "$BODY"
|
|
70
193
|
|
|
71
|
-
# Auto-register as active when reporting "active" or first status.
|
|
72
|
-
# This ensures the agent's agentStatus transitions from "started" to "active"
|
|
73
|
-
# in storage, which the queue processor requires before delivering messages.
|
|
74
|
-
# Without this, agents that call report-status instead of register-self
|
|
75
|
-
# remain stuck in "started" state indefinitely.
|
|
76
|
-
|
|
77
194
|
# If task is done and taskPath provided, move task file to done folder
|
|
78
195
|
if [ "$STATUS" = "done" ] && [ -n "$TASK_PATH" ]; then
|
|
79
196
|
COMPLETE_BODY=$(jq -n \
|
|
@@ -90,9 +207,6 @@ if [ "$STATUS" = "done" ]; then
|
|
|
90
207
|
fi
|
|
91
208
|
|
|
92
209
|
# Auto-persist key findings as project knowledge when task is done (#127, #219).
|
|
93
|
-
# Use [COMPLETED] prefix so recall can distinguish completed tasks from other patterns.
|
|
94
|
-
# This prevents PM from re-delegating tasks that were already done.
|
|
95
210
|
if [ "$STATUS" = "done" ] && [ -n "$SUMMARY" ]; then
|
|
96
|
-
PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
97
211
|
auto_remember "$SESSION_NAME" "[COMPLETED] Task completed by ${SESSION_NAME}: ${SUMMARY}" "decision" "project" "$PROJECT_PATH"
|
|
98
212
|
fi
|