pragma-so 0.1.12 → 0.1.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/dist/server/db.js
CHANGED
|
@@ -27,7 +27,10 @@ const pglite_1 = require("@electric-sql/pglite");
|
|
|
27
27
|
const gitWorkflow_1 = require("./conversation/gitWorkflow");
|
|
28
28
|
const store_1 = require("./conversation/store");
|
|
29
29
|
const bundledSkills_1 = require("./bundledSkills");
|
|
30
|
-
|
|
30
|
+
const CONFIGURED_PRAGMA_DIR = process.env.PRAGMA_DIR?.trim();
|
|
31
|
+
exports.PRAGMA_DIR = CONFIGURED_PRAGMA_DIR
|
|
32
|
+
? (0, node_path_1.resolve)(CONFIGURED_PRAGMA_DIR)
|
|
33
|
+
: (0, node_path_1.join)((0, node_os_1.homedir)(), ".pragma");
|
|
31
34
|
const ACTIVE_WORKSPACE_FILE = (0, node_path_1.join)(exports.PRAGMA_DIR, "active_workspace");
|
|
32
35
|
const RESERVED_ROOT_NAMES = new Set(["db", "workspace", "worktrees"]);
|
|
33
36
|
exports.DEFAULT_AGENT_ID = "pragma-orchestrator";
|
package/dist/server/index.js
CHANGED
|
@@ -984,7 +984,34 @@ async function startServer(options) {
|
|
|
984
984
|
const workspaceName = c.get("workspace");
|
|
985
985
|
const db = c.get("db");
|
|
986
986
|
const result = await db.query(`SELECT * FROM processes WHERE workspace = $1 ORDER BY created_at DESC`, [workspaceName]);
|
|
987
|
-
|
|
987
|
+
// Merge live runtime status into each process row
|
|
988
|
+
const runtimeServices = listRuntimeServices(workspaceName);
|
|
989
|
+
const runtimeByDbId = new Map();
|
|
990
|
+
for (const svc of runtimeServices) {
|
|
991
|
+
if (svc.process_db_id) {
|
|
992
|
+
runtimeByDbId.set(svc.process_db_id, svc);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
const enriched = result.rows.map((proc) => {
|
|
996
|
+
const svc = runtimeByDbId.get(proc.id);
|
|
997
|
+
if (svc) {
|
|
998
|
+
return {
|
|
999
|
+
...proc,
|
|
1000
|
+
status: svc.status === "ready" ? "running" : svc.status,
|
|
1001
|
+
runtime_service_id: svc.id,
|
|
1002
|
+
pid: svc.pid,
|
|
1003
|
+
port: svc.port,
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
// No runtime service — ensure status reflects stopped
|
|
1007
|
+
const dbStatus = proc.status;
|
|
1008
|
+
return {
|
|
1009
|
+
...proc,
|
|
1010
|
+
status: dbStatus === "running" ? "stopped" : dbStatus,
|
|
1011
|
+
runtime_service_id: null,
|
|
1012
|
+
};
|
|
1013
|
+
});
|
|
1014
|
+
return c.json({ processes: enriched });
|
|
988
1015
|
});
|
|
989
1016
|
app.get("/code/folders/:folderName/processes", async (c) => {
|
|
990
1017
|
const workspaceName = c.get("workspace");
|
|
@@ -1085,9 +1112,22 @@ async function startServer(options) {
|
|
|
1085
1112
|
throw new db_1.PragmaError("PROCESS_NOT_FOUND", 404, `Process not found: ${processId}`);
|
|
1086
1113
|
}
|
|
1087
1114
|
const proc = result.rows[0];
|
|
1088
|
-
|
|
1115
|
+
const store = getWorkspaceServiceStore(workspaceName);
|
|
1116
|
+
let liveService = null;
|
|
1117
|
+
for (const service of store.values()) {
|
|
1118
|
+
if (service.process_db_id === processId) {
|
|
1119
|
+
liveService = service;
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
const liveRunning = liveService &&
|
|
1124
|
+
(liveService.status === "running" || liveService.status === "ready");
|
|
1125
|
+
if (liveRunning) {
|
|
1089
1126
|
throw new db_1.PragmaError("PROCESS_ALREADY_RUNNING", 400, "Process is already running.");
|
|
1090
1127
|
}
|
|
1128
|
+
if (proc.status === "running") {
|
|
1129
|
+
await db.query(`UPDATE processes SET status = 'stopped', stopped_at = CURRENT_TIMESTAMP WHERE id = $1`, [processId]);
|
|
1130
|
+
}
|
|
1091
1131
|
const absoluteCwd = (0, node_path_1.join)(workspacePaths.codeDir, proc.folder_name, proc.cwd === "." ? "" : proc.cwd);
|
|
1092
1132
|
const cwdInfo = await (0, promises_1.stat)(absoluteCwd).catch(() => null);
|
|
1093
1133
|
if (!cwdInfo?.isDirectory()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pragma-so",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Very minimal pragma-so CLI",
|
|
5
5
|
"main": "dist/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc && npm run ui:build",
|
|
11
|
+
"dev": "node scripts/dev-start.mjs",
|
|
11
12
|
"prepack": "npm run build",
|
|
12
13
|
"start": "node dist/cli/index.js",
|
|
13
14
|
"ui:dev": "vite --config ui/vite.config.mjs ui",
|