@jxtools/promptline 1.3.4 → 1.3.5
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/package.json +1 -1
- package/promptline-prompt-queue.sh +25 -3
package/package.json
CHANGED
|
@@ -39,8 +39,10 @@ if [ -n "$EXISTING" ]; then
|
|
|
39
39
|
PROJECT=$(basename "$(dirname "$EXISTING")")
|
|
40
40
|
QUEUE_DIR="$(dirname "$EXISTING")"
|
|
41
41
|
else
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
PROJECT=$(basename "$CWD")
|
|
43
|
+
QUEUE_DIR="$QUEUES_BASE/$PROJECT"
|
|
44
|
+
QUEUE_FILE="$QUEUE_DIR/$SESSION_ID.json"
|
|
45
|
+
mkdir -p "$QUEUE_DIR"
|
|
44
46
|
fi
|
|
45
47
|
|
|
46
48
|
export QUEUE_FILE SESSION_ID CWD PROJECT TRANSCRIPT_PATH STOP_HOOK_ACTIVE
|
|
@@ -99,7 +101,27 @@ queue_file = os.environ.get("QUEUE_FILE", "")
|
|
|
99
101
|
session_id = os.environ.get("SESSION_ID", "")
|
|
100
102
|
transcript_path = os.environ.get("TRANSCRIPT_PATH", "")
|
|
101
103
|
|
|
102
|
-
if not queue_file
|
|
104
|
+
if not queue_file:
|
|
105
|
+
print("STOP")
|
|
106
|
+
sys.exit(0)
|
|
107
|
+
|
|
108
|
+
if not os.path.isfile(queue_file):
|
|
109
|
+
cwd = os.environ.get("CWD", "")
|
|
110
|
+
project = os.environ.get("PROJECT", "")
|
|
111
|
+
now = datetime.now(timezone.utc).isoformat()
|
|
112
|
+
data = {
|
|
113
|
+
"sessionId": session_id,
|
|
114
|
+
"project": project,
|
|
115
|
+
"directory": cwd,
|
|
116
|
+
"sessionName": extract_session_name(transcript_path),
|
|
117
|
+
"prompts": [],
|
|
118
|
+
"startedAt": now,
|
|
119
|
+
"lastActivity": now,
|
|
120
|
+
"currentPromptId": None,
|
|
121
|
+
"completedAt": None,
|
|
122
|
+
"closedAt": None,
|
|
123
|
+
}
|
|
124
|
+
atomic_write(queue_file, data)
|
|
103
125
|
print("STOP")
|
|
104
126
|
sys.exit(0)
|
|
105
127
|
|