@jxtools/promptline 1.3.3 → 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
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
|
|
|
@@ -52,7 +52,6 @@ export function withComputedStatus(session: SessionQueue): SessionQueue & { stat
|
|
|
52
52
|
export function isSessionVisible(session: SessionQueue, now: number = Date.now()): boolean {
|
|
53
53
|
if (hasPendingWork(session)) return true;
|
|
54
54
|
if (session.closedAt != null) return false;
|
|
55
|
-
if (!session.sessionName) return false;
|
|
56
55
|
const msSinceStart = now - new Date(session.startedAt).getTime();
|
|
57
56
|
return msSinceStart <= SESSION_ABANDONED_TIMEOUT_MS;
|
|
58
57
|
}
|
|
@@ -151,8 +150,7 @@ export function deletePrompt(session: SessionQueue, promptId: string): Prompt |
|
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
export function clearPrompts(session: SessionQueue): Prompt[] {
|
|
154
|
-
|
|
155
|
-
return removed;
|
|
153
|
+
return session.prompts.splice(0);
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
export function reorderPrompts(session: SessionQueue, order: string[]): string | null {
|