pragma-so 0.1.1 → 0.1.2
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/cli/index.js +81 -0
- package/package.json +6 -1
- package/cli/index.ts +0 -882
- package/index.ts +0 -3
- package/server/connectorBinaries.ts +0 -103
- package/server/connectorRegistry.ts +0 -158
- package/server/conversation/adapterRegistry.ts +0 -53
- package/server/conversation/adapters/claudeAdapter.ts +0 -138
- package/server/conversation/adapters/codexAdapter.ts +0 -142
- package/server/conversation/adapters.ts +0 -224
- package/server/conversation/executeRunner.ts +0 -1191
- package/server/conversation/gitWorkflow.ts +0 -1037
- package/server/conversation/models.ts +0 -23
- package/server/conversation/pragmaCli.ts +0 -34
- package/server/conversation/prompts.ts +0 -335
- package/server/conversation/store.ts +0 -805
- package/server/conversation/titleGenerator.ts +0 -106
- package/server/conversation/turnRunner.ts +0 -365
- package/server/conversation/types.ts +0 -134
- package/server/db.ts +0 -837
- package/server/http/middleware.ts +0 -31
- package/server/http/schemas.ts +0 -430
- package/server/http/validators.ts +0 -38
- package/server/index.ts +0 -6560
- package/server/process/runCommand.ts +0 -142
- package/server/stores/agentStore.ts +0 -167
- package/server/stores/connectorStore.ts +0 -299
- package/server/stores/humanStore.ts +0 -28
- package/server/stores/skillStore.ts +0 -127
- package/server/stores/taskStore.ts +0 -371
- package/shared/net.ts +0 -24
- package/tsconfig.json +0 -14
- package/ui/index.html +0 -14
- package/ui/public/favicon-32.png +0 -0
- package/ui/public/favicon.png +0 -0
- package/ui/src/App.jsx +0 -1338
- package/ui/src/api.js +0 -954
- package/ui/src/components/CodeView.jsx +0 -319
- package/ui/src/components/ConnectionsView.jsx +0 -1004
- package/ui/src/components/ContextView.jsx +0 -315
- package/ui/src/components/ConversationDrawer.jsx +0 -963
- package/ui/src/components/EmptyPane.jsx +0 -20
- package/ui/src/components/FeedView.jsx +0 -773
- package/ui/src/components/FilesView.jsx +0 -257
- package/ui/src/components/InlineChatView.jsx +0 -158
- package/ui/src/components/InputBar.jsx +0 -476
- package/ui/src/components/OnboardingModal.jsx +0 -112
- package/ui/src/components/OutputPanel.jsx +0 -658
- package/ui/src/components/PlanProposalPanel.jsx +0 -177
- package/ui/src/components/RightPanel.jsx +0 -951
- package/ui/src/components/SettingsView.jsx +0 -186
- package/ui/src/components/Sidebar.jsx +0 -247
- package/ui/src/components/TestingPane.jsx +0 -198
- package/ui/src/components/testing/ApiTesterPanel.jsx +0 -187
- package/ui/src/components/testing/LogViewerPanel.jsx +0 -64
- package/ui/src/components/testing/TerminalPanel.jsx +0 -104
- package/ui/src/components/testing/WebPreviewPanel.jsx +0 -78
- package/ui/src/hooks/useAgents.js +0 -81
- package/ui/src/hooks/useConversation.js +0 -252
- package/ui/src/hooks/useTasks.js +0 -161
- package/ui/src/hooks/useWorkspace.js +0 -259
- package/ui/src/lib/agentIcon.js +0 -10
- package/ui/src/lib/conversationUtils.js +0 -575
- package/ui/src/main.jsx +0 -10
- package/ui/src/styles.css +0 -6899
- package/ui/vite.config.mjs +0 -6
package/dist/cli/index.js
CHANGED
|
@@ -37,9 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const node_http_1 = require("node:http");
|
|
40
41
|
const promises_1 = require("node:fs/promises");
|
|
41
42
|
const node_path_1 = require("node:path");
|
|
42
43
|
const commander_1 = require("commander");
|
|
44
|
+
const mime_types_1 = require("mime-types");
|
|
43
45
|
const open_1 = __importDefault(require("open"));
|
|
44
46
|
const runCommand_1 = require("../server/process/runCommand");
|
|
45
47
|
const program = new commander_1.Command();
|
|
@@ -473,6 +475,11 @@ async function runAll() {
|
|
|
473
475
|
await Promise.allSettled([serverExit, uiExit]);
|
|
474
476
|
}
|
|
475
477
|
async function startUi(options) {
|
|
478
|
+
const builtUiDir = await resolveBuiltUiDir();
|
|
479
|
+
if (builtUiDir) {
|
|
480
|
+
await serveBuiltUi({ port: options.port, rootDir: builtUiDir });
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
476
483
|
const uiDir = await resolveUiDir();
|
|
477
484
|
const projectRoot = (0, node_path_1.dirname)(uiDir);
|
|
478
485
|
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
@@ -488,6 +495,68 @@ async function startUi(options) {
|
|
|
488
495
|
});
|
|
489
496
|
await waitForExit(child, "ui");
|
|
490
497
|
}
|
|
498
|
+
async function resolveBuiltUiDir() {
|
|
499
|
+
const candidates = [
|
|
500
|
+
(0, node_path_1.join)(__dirname, "..", "..", "ui", "dist"),
|
|
501
|
+
(0, node_path_1.join)(process.cwd(), "ui", "dist"),
|
|
502
|
+
(0, node_path_1.join)(process.cwd(), "dist", "ui"),
|
|
503
|
+
(0, node_path_1.join)(__dirname, ".."),
|
|
504
|
+
(0, node_path_1.join)(process.cwd(), "dist"),
|
|
505
|
+
];
|
|
506
|
+
for (const candidate of candidates) {
|
|
507
|
+
if (await pathExists((0, node_path_1.join)(candidate, "index.html"))) {
|
|
508
|
+
return candidate;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
async function serveBuiltUi(options) {
|
|
514
|
+
const rootDir = (0, node_path_1.resolve)(options.rootDir);
|
|
515
|
+
const server = (0, node_http_1.createServer)((req, res) => {
|
|
516
|
+
void handleBuiltUiRequest(req, res, rootDir);
|
|
517
|
+
});
|
|
518
|
+
await new Promise((resolvePromise, reject) => {
|
|
519
|
+
server.once("error", reject);
|
|
520
|
+
server.listen(options.port, "127.0.0.1", () => {
|
|
521
|
+
server.off("error", reject);
|
|
522
|
+
resolvePromise();
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
console.log(`Pragma UI listening on http://127.0.0.1:${options.port}`);
|
|
526
|
+
await new Promise((resolvePromise, reject) => {
|
|
527
|
+
server.once("close", () => resolvePromise());
|
|
528
|
+
server.once("error", reject);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
async function handleBuiltUiRequest(req, res, rootDir) {
|
|
532
|
+
try {
|
|
533
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
534
|
+
const pathname = safeDecodePathname(url.pathname);
|
|
535
|
+
const requestedPath = pathname === "/" ? "/index.html" : pathname;
|
|
536
|
+
const candidatePath = (0, node_path_1.resolve)(rootDir, `.${requestedPath}`);
|
|
537
|
+
if (!isPathInsideRoot(candidatePath, rootDir)) {
|
|
538
|
+
res.statusCode = 403;
|
|
539
|
+
res.end("Forbidden");
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
let filePath = candidatePath;
|
|
543
|
+
const fileInfo = await (0, promises_1.stat)(filePath).catch(() => null);
|
|
544
|
+
const isFile = Boolean(fileInfo?.isFile());
|
|
545
|
+
if (!isFile) {
|
|
546
|
+
filePath = (0, node_path_1.join)(rootDir, "index.html");
|
|
547
|
+
}
|
|
548
|
+
const content = await (0, promises_1.readFile)(filePath);
|
|
549
|
+
const mime = (0, mime_types_1.lookup)(filePath) || "application/octet-stream";
|
|
550
|
+
res.statusCode = 200;
|
|
551
|
+
res.setHeader("content-type", mime);
|
|
552
|
+
res.setHeader("cache-control", filePath.endsWith("index.html") ? "no-store" : "public, max-age=31536000, immutable");
|
|
553
|
+
res.end(content);
|
|
554
|
+
}
|
|
555
|
+
catch (error) {
|
|
556
|
+
res.statusCode = 500;
|
|
557
|
+
res.end(errorMessage(error));
|
|
558
|
+
}
|
|
559
|
+
}
|
|
491
560
|
async function resolveUiDir() {
|
|
492
561
|
const candidates = [
|
|
493
562
|
(0, node_path_1.join)(__dirname, "..", "..", "ui"),
|
|
@@ -600,6 +669,18 @@ function normalizeOptionalString(value) {
|
|
|
600
669
|
const trimmed = value.trim();
|
|
601
670
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
602
671
|
}
|
|
672
|
+
function safeDecodePathname(pathname) {
|
|
673
|
+
try {
|
|
674
|
+
const decoded = decodeURIComponent(pathname);
|
|
675
|
+
return (0, node_path_1.normalize)(decoded.startsWith("/") ? decoded : `/${decoded}`);
|
|
676
|
+
}
|
|
677
|
+
catch {
|
|
678
|
+
return "/";
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function isPathInsideRoot(candidatePath, rootDir) {
|
|
682
|
+
return candidatePath === rootDir || candidatePath.startsWith(`${rootDir}${node_path_1.sep}`);
|
|
683
|
+
}
|
|
603
684
|
function quoteShellArg(value) {
|
|
604
685
|
return `"${value.replace(/["\\$`]/g, "\\$&")}"`;
|
|
605
686
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pragma-so",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Very minimal pragma-so CLI",
|
|
5
5
|
"main": "dist/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,11 +8,16 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc && npm run ui:build",
|
|
11
|
+
"prepack": "npm run build",
|
|
11
12
|
"start": "node dist/cli/index.js",
|
|
12
13
|
"ui:dev": "vite --config ui/vite.config.mjs ui",
|
|
13
14
|
"ui:build": "vite build --config ui/vite.config.mjs ui",
|
|
14
15
|
"ui:preview": "vite preview --config ui/vite.config.mjs ui"
|
|
15
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"ui/dist"
|
|
20
|
+
],
|
|
16
21
|
"keywords": [
|
|
17
22
|
"cli",
|
|
18
23
|
"commander",
|