cognitune 0.3.2 → 0.3.4
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/CHANGELOG.md +16 -0
- package/dist/cli.js +118 -90
- package/dist/web/assets/{Map-DS1CSocK.js → Map-BrvreBEy.js} +1 -1
- package/dist/web/assets/{Practice-I2bYp2SG.js → Practice-DISXSHVX.js} +3 -3
- package/dist/web/assets/{_baseUniq-CgG_mifj.js → _baseUniq-COwRl6vV.js} +1 -1
- package/dist/web/assets/{architectureDiagram-UYN6MBPD-QZTspen1.js → architectureDiagram-UYN6MBPD-_9Wfq1su.js} +1 -1
- package/dist/web/assets/{blockDiagram-ZHA2E4KO-CbhjZ2S8.js → blockDiagram-ZHA2E4KO-CufQ8L2_.js} +1 -1
- package/dist/web/assets/{c4Diagram-6F5ED5ID-A3b4lbII.js → c4Diagram-6F5ED5ID-B40qb_UG.js} +1 -1
- package/dist/web/assets/channel-DVVniLQS.js +1 -0
- package/dist/web/assets/{chunk-5HRBRIJM-ChWRBpuq.js → chunk-5HRBRIJM-D6bxTFIE.js} +1 -1
- package/dist/web/assets/{chunk-7U56Z5CX-Cjcjfrgo.js → chunk-7U56Z5CX-BoRg8r5Q.js} +1 -1
- package/dist/web/assets/{chunk-ASOPGD6M-Bhu3AOZc.js → chunk-ASOPGD6M-BtP71aab.js} +1 -1
- package/dist/web/assets/{chunk-KFBOBJHC-BekFNaeo.js → chunk-KFBOBJHC-T-v0Fw19.js} +1 -1
- package/dist/web/assets/{chunk-T2TOU4HS-B9G0vLnI.js → chunk-T2TOU4HS-CV9j5mPR.js} +1 -1
- package/dist/web/assets/{chunk-TMUBEWPD-DSAk9aXZ.js → chunk-TMUBEWPD-C5MuNi5X.js} +1 -1
- package/dist/web/assets/classDiagram-LNE6IOMH-BtGGSWnn.js +1 -0
- package/dist/web/assets/classDiagram-v2-MQ7JQ4JX-BtGGSWnn.js +1 -0
- package/dist/web/assets/clone-CHU5hDkS.js +1 -0
- package/dist/web/assets/{dagre-4EVJKHTY-CJiQ7M56.js → dagre-4EVJKHTY-C88qC3Rn.js} +1 -1
- package/dist/web/assets/{diagram-QW4FP2JN-BtE9T_jx.js → diagram-QW4FP2JN-OyHbrzI4.js} +1 -1
- package/dist/web/assets/{erDiagram-6RL3IURR-BURUFe_9.js → erDiagram-6RL3IURR-CeZWTGfc.js} +1 -1
- package/dist/web/assets/{flowDiagram-7ASYPVHJ-CfE3lrqz.js → flowDiagram-7ASYPVHJ-uZ6FeujK.js} +1 -1
- package/dist/web/assets/{ganttDiagram-NTVNEXSI-D9d9jWBm.js → ganttDiagram-NTVNEXSI-y87xBPPC.js} +1 -1
- package/dist/web/assets/{gitGraph-YCYPL57B-CJ1V9XJf.js → gitGraph-YCYPL57B-JbpUhCOb.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-NRZ2UAAF-CqaSLfzI.js → gitGraphDiagram-NRZ2UAAF-CBflcq4l.js} +1 -1
- package/dist/web/assets/{graph-B64LQEXc.js → graph-BENdOhGY.js} +1 -1
- package/dist/web/assets/{index-Z72XDUwe.js → index-2yyy2zDR.js} +1 -1
- package/dist/web/assets/{index-6_jiQxLN.js → index-4w6BhxJp.js} +1 -1
- package/dist/web/assets/{index-B52f3nVk.js → index-B3zAKIsi.js} +1 -1
- package/dist/web/assets/{index-CtDCXRra.js → index-BW-P1b2P.js} +1 -1
- package/dist/web/assets/{index-CVnYyVgS.js → index-BvN75pDj.js} +1 -1
- package/dist/web/assets/{index-fUwh3MJR.js → index-BwUlLYg9.js} +1 -1
- package/dist/web/assets/{index-BH0BWKEP.js → index-CD0Svk5N.js} +5 -5
- package/dist/web/assets/{index-DGSEVmt_.js → index-CQkpDjjo.js} +1 -1
- package/dist/web/assets/{index-B-ZU5R2V.js → index-CS0KLfR9.js} +1 -1
- package/dist/web/assets/{index-DYV_a5pR.js → index-Ci0OeEKD.js} +1 -1
- package/dist/web/assets/{index-DQIDx0VL.js → index-Cp_uy0cX.js} +1 -1
- package/dist/web/assets/{index-9QHEA9wu.js → index-DA4eOekM.js} +1 -1
- package/dist/web/assets/{index-B2zJKCq3.js → index-DXd86_iZ.js} +1 -1
- package/dist/web/assets/{index-Dhqj7fLA.js → index-DsyF1mt_.js} +1 -1
- package/dist/web/assets/{index-GNn9Y8IP.js → index-NmiWGsYf.js} +1 -1
- package/dist/web/assets/{index-LjQbNYY4.js → index-Phd-KO8I.js} +1 -1
- package/dist/web/assets/{index-CujTkxIF.js → index-VfqaEwv8.js} +1 -1
- package/dist/web/assets/{index-DZX_ApSV.js → index-cw4XuS89.js} +1 -1
- package/dist/web/assets/{index-nRMB7HRL.js → index-ixUgJMrH.js} +1 -1
- package/dist/web/assets/{index-fcWIc_lJ.js → index-l0x6IlG7.js} +1 -1
- package/dist/web/assets/{index-CUD1JdXZ.js → index-oIdJi7Q2.js} +1 -1
- package/dist/web/assets/{index-DeUkCZCv.css → index-oaBcbKx0.css} +1 -1
- package/dist/web/assets/{index-ISt4JlWL.js → index-ts3LSFgg.js} +1 -1
- package/dist/web/assets/{index-BluWHHG-.js → index-yvz8KzFj.js} +1 -1
- package/dist/web/assets/{infoDiagram-A4XQUW5V-DMcs4U8y.js → infoDiagram-A4XQUW5V-CsRrWifr.js} +1 -1
- package/dist/web/assets/{journeyDiagram-G5WM74LC-CEds3uag.js → journeyDiagram-G5WM74LC-DC7Hbsp0.js} +1 -1
- package/dist/web/assets/{kanban-definition-QRCXZQQD-yZwdqxsV.js → kanban-definition-QRCXZQQD-Bo5HNBfS.js} +1 -1
- package/dist/web/assets/{layout-DYrE6rew.js → layout-d7TQ04W7.js} +1 -1
- package/dist/web/assets/{mermaid.core-C4isYGdZ.js → mermaid.core-xu0G1s5D.js} +4 -4
- package/dist/web/assets/{min-D7IE57rG.js → min-DPqoX6mH.js} +1 -1
- package/dist/web/assets/{mindmap-definition-GWI6TPTV-BrA9fZLl.js → mindmap-definition-GWI6TPTV-BkHsjDT1.js} +1 -1
- package/dist/web/assets/{pieDiagram-YF2LJOPJ-DBLJF-B8.js → pieDiagram-YF2LJOPJ-7r8Dzz2j.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-OS5C2QUG-W3e7OODv.js → quadrantDiagram-OS5C2QUG-p6-v0-FD.js} +1 -1
- package/dist/web/assets/{requirementDiagram-MIRIMTAZ-DmouihuU.js → requirementDiagram-MIRIMTAZ-69i-6ive.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-Y46BX6SQ-k_4HmTUK.js → sankeyDiagram-Y46BX6SQ-CT2tON08.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-G6AWOVSC-C4Kq2ABe.js → sequenceDiagram-G6AWOVSC-B6t5TVF5.js} +1 -1
- package/dist/web/assets/{stateDiagram-MAYHULR4-C5a59rCP.js → stateDiagram-MAYHULR4-DdNGwnVQ.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-4JROLMXI-kJAkVKtc.js +1 -0
- package/dist/web/assets/{timeline-definition-U7ZMHBDA-CtkRQwlM.js → timeline-definition-U7ZMHBDA-CgCCWNTr.js} +1 -1
- package/dist/web/assets/{xychartDiagram-6QU3TZC5-KKa8nieo.js → xychartDiagram-6QU3TZC5-_rQykDFm.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/channel-BKUyG-l5.js +0 -1
- package/dist/web/assets/classDiagram-LNE6IOMH-zE4bnqcI.js +0 -1
- package/dist/web/assets/classDiagram-v2-MQ7JQ4JX-zE4bnqcI.js +0 -1
- package/dist/web/assets/clone-BjRjnhL1.js +0 -1
- package/dist/web/assets/stateDiagram-v2-4JROLMXI-CeQk6jDo.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4 (2026-11-18)
|
|
4
|
+
|
|
5
|
+
Fixes:
|
|
6
|
+
|
|
7
|
+
- Model calls no longer fill your own session lists. Claude Code, Codex and Copilot used to start
|
|
8
|
+
in the project folder, so every lens, quiz and tutor turn showed up in that folder's
|
|
9
|
+
`claude --resume` list. They now run from `~/.cognitune/agent` with the project as a readable
|
|
10
|
+
folder, and Claude Code runs with session saving off.
|
|
11
|
+
|
|
12
|
+
## 0.3.3 (2026-11-18)
|
|
13
|
+
|
|
14
|
+
Fixes:
|
|
15
|
+
|
|
16
|
+
- Split diff: the column divider ran through hunk headers ("@@ -40,10 +42,11 @@ export class
|
|
17
|
+
Queue<T> {"); headers now span both columns above the divider.
|
|
18
|
+
|
|
3
19
|
## 0.3.2 (2026-11-18)
|
|
4
20
|
|
|
5
21
|
Map:
|
package/dist/cli.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import { spawn as spawn2 } from "node:child_process";
|
|
5
5
|
import { existsSync as existsSync6, readFileSync as readFileSync5, statSync as statSync5 } from "node:fs";
|
|
6
6
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
7
|
-
import { dirname as dirname3, extname as extname3, join as
|
|
7
|
+
import { dirname as dirname3, extname as extname3, join as join9, resolve as resolve4 } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { serve } from "@hono/node-server";
|
|
10
10
|
import { Hono as Hono2 } from "hono";
|
|
11
11
|
|
|
12
12
|
// src/server/app.ts
|
|
13
13
|
import { existsSync as existsSync5, statSync as statSync4 } from "node:fs";
|
|
14
|
-
import { homedir as
|
|
14
|
+
import { homedir as homedir3 } from "node:os";
|
|
15
15
|
import { Hono } from "hono";
|
|
16
16
|
|
|
17
17
|
// src/core/agent/index.ts
|
|
@@ -19,6 +19,14 @@ import { execFileSync } from "node:child_process";
|
|
|
19
19
|
|
|
20
20
|
// src/core/agent/cli.ts
|
|
21
21
|
import { spawn } from "node:child_process";
|
|
22
|
+
import { mkdirSync } from "node:fs";
|
|
23
|
+
import { homedir } from "node:os";
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
function agentHome() {
|
|
26
|
+
const dir = join(process.env.COGNITUNE_HOME || join(homedir(), ".cognitune"), "agent");
|
|
27
|
+
mkdirSync(dir, { recursive: true });
|
|
28
|
+
return dir;
|
|
29
|
+
}
|
|
22
30
|
function runCli(command, args, opts2) {
|
|
23
31
|
return new Promise((resolve5, reject) => {
|
|
24
32
|
const child = spawn(command, args, { cwd: opts2.cwd, env: { ...process.env, ...opts2.env }, stdio: ["pipe", "pipe", "pipe"] });
|
|
@@ -53,17 +61,33 @@ var ClaudeCliAgent = class {
|
|
|
53
61
|
}
|
|
54
62
|
name = "Claude Code CLI";
|
|
55
63
|
complete(req) {
|
|
56
|
-
const
|
|
64
|
+
const system = `${req.system}
|
|
65
|
+
|
|
66
|
+
The project folder is ${req.cwd}. File paths in this task are relative to it.`;
|
|
67
|
+
const args = [
|
|
68
|
+
"-p",
|
|
69
|
+
"--output-format",
|
|
70
|
+
"text",
|
|
71
|
+
"--no-session-persistence",
|
|
72
|
+
"--tools",
|
|
73
|
+
"Read",
|
|
74
|
+
"Grep",
|
|
75
|
+
"Glob",
|
|
76
|
+
"--add-dir",
|
|
77
|
+
req.cwd,
|
|
78
|
+
"--append-system-prompt",
|
|
79
|
+
system
|
|
80
|
+
];
|
|
57
81
|
const model = req.role === "plan" && this.planModel ? this.planModel : this.model;
|
|
58
82
|
if (model) args.push("--model", model);
|
|
59
|
-
return runCli(this.command, args, { cwd:
|
|
83
|
+
return runCli(this.command, args, { cwd: agentHome(), stdin: req.prompt, timeoutMs: this.timeoutMs });
|
|
60
84
|
}
|
|
61
85
|
};
|
|
62
86
|
|
|
63
87
|
// src/core/agent/codex.ts
|
|
64
88
|
import { mkdtempSync, readFileSync } from "node:fs";
|
|
65
89
|
import { tmpdir } from "node:os";
|
|
66
|
-
import { join } from "node:path";
|
|
90
|
+
import { join as join2 } from "node:path";
|
|
67
91
|
var CodexCliAgent = class {
|
|
68
92
|
constructor(command, model, timeoutMs) {
|
|
69
93
|
this.command = command;
|
|
@@ -72,11 +96,13 @@ var CodexCliAgent = class {
|
|
|
72
96
|
}
|
|
73
97
|
name = "Codex CLI";
|
|
74
98
|
async complete(req) {
|
|
75
|
-
const out =
|
|
76
|
-
const args = ["exec", "--sandbox", "read-only", "--skip-git-repo-check", "--cd",
|
|
99
|
+
const out = join2(mkdtempSync(join2(tmpdir(), "cognitune-codex-")), "last.md");
|
|
100
|
+
const args = ["exec", "--sandbox", "read-only", "--skip-git-repo-check", "--cd", agentHome(), "--output-last-message", out];
|
|
77
101
|
if (this.model) args.push("--model", this.model);
|
|
78
102
|
args.push("-");
|
|
79
|
-
const stdout = await runCli(this.command, args, { cwd:
|
|
103
|
+
const stdout = await runCli(this.command, args, { cwd: agentHome(), stdin: `${req.system}
|
|
104
|
+
|
|
105
|
+
The project folder is ${req.cwd}. File paths in this task are relative to it.
|
|
80
106
|
|
|
81
107
|
---
|
|
82
108
|
|
|
@@ -92,7 +118,7 @@ ${req.prompt}`, timeoutMs: this.timeoutMs });
|
|
|
92
118
|
// src/core/agent/copilot.ts
|
|
93
119
|
import { mkdtempSync as mkdtempSync2, writeFileSync } from "node:fs";
|
|
94
120
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
95
|
-
import { join as
|
|
121
|
+
import { join as join3 } from "node:path";
|
|
96
122
|
var CopilotCliAgent = class {
|
|
97
123
|
constructor(command, model, timeoutMs) {
|
|
98
124
|
this.command = command;
|
|
@@ -101,17 +127,19 @@ var CopilotCliAgent = class {
|
|
|
101
127
|
}
|
|
102
128
|
name = "GitHub Copilot CLI";
|
|
103
129
|
async complete(req) {
|
|
104
|
-
const dir = mkdtempSync2(
|
|
105
|
-
const file =
|
|
130
|
+
const dir = mkdtempSync2(join3(tmpdir2(), "cognitune-copilot-"));
|
|
131
|
+
const file = join3(dir, "task.md");
|
|
106
132
|
writeFileSync(file, `${req.system}
|
|
107
133
|
|
|
134
|
+
The project folder is ${req.cwd}. File paths in this task are relative to it.
|
|
135
|
+
|
|
108
136
|
---
|
|
109
137
|
|
|
110
138
|
${req.prompt}`);
|
|
111
139
|
const prompt = `Read the file ${file} and do exactly what it says. Reply with the answer only.`;
|
|
112
|
-
const args = ["-p", prompt, "-s", "--no-ask-user", "--allow-tool=read", "--deny-tool=shell", "--deny-tool=write", `--add-dir=${dir}`];
|
|
140
|
+
const args = ["-p", prompt, "-s", "--no-ask-user", "--allow-tool=read", "--deny-tool=shell", "--deny-tool=write", `--add-dir=${dir}`, `--add-dir=${req.cwd}`];
|
|
113
141
|
if (this.model) args.push(`--model=${this.model}`);
|
|
114
|
-
return runCli(this.command, args, { cwd:
|
|
142
|
+
return runCli(this.command, args, { cwd: agentHome(), timeoutMs: this.timeoutMs });
|
|
115
143
|
}
|
|
116
144
|
};
|
|
117
145
|
|
|
@@ -416,9 +444,9 @@ import { createEmptyCard, fsrs, Rating as R } from "ts-fsrs";
|
|
|
416
444
|
|
|
417
445
|
// src/core/store.ts
|
|
418
446
|
import { createHash, randomBytes } from "node:crypto";
|
|
419
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, readdirSync, renameSync, utimesSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
420
|
-
import { homedir } from "node:os";
|
|
421
|
-
import { join as
|
|
447
|
+
import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync, renameSync, utimesSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
448
|
+
import { homedir as homedir2 } from "node:os";
|
|
449
|
+
import { join as join4, basename, resolve } from "node:path";
|
|
422
450
|
var DEFAULT_SETTINGS = {
|
|
423
451
|
"agent.mode": "auto",
|
|
424
452
|
"agent.model": "claude-sonnet-5-5",
|
|
@@ -462,9 +490,9 @@ function projectIdFor(root) {
|
|
|
462
490
|
}
|
|
463
491
|
var Store = class {
|
|
464
492
|
home;
|
|
465
|
-
constructor(home = process.env.COGNITUNE_HOME ||
|
|
493
|
+
constructor(home = process.env.COGNITUNE_HOME || join4(homedir2(), ".cognitune")) {
|
|
466
494
|
this.home = resolve(home);
|
|
467
|
-
|
|
495
|
+
mkdirSync2(join4(this.home, "projects"), { recursive: true });
|
|
468
496
|
}
|
|
469
497
|
// ---- low level -------------------------------------------------------
|
|
470
498
|
read(path2, fallback) {
|
|
@@ -483,19 +511,19 @@ var Store = class {
|
|
|
483
511
|
}
|
|
484
512
|
// ---- settings --------------------------------------------------------
|
|
485
513
|
settings() {
|
|
486
|
-
return { ...DEFAULT_SETTINGS, ...this.read(
|
|
514
|
+
return { ...DEFAULT_SETTINGS, ...this.read(join4(this.home, "settings.json"), {}) };
|
|
487
515
|
}
|
|
488
516
|
saveSettings(patch) {
|
|
489
517
|
const next = { ...this.settings() };
|
|
490
518
|
for (const [k, v] of Object.entries(patch)) {
|
|
491
519
|
if (k in DEFAULT_SETTINGS && v !== void 0 && v !== null) next[k] = v;
|
|
492
520
|
}
|
|
493
|
-
this.write(
|
|
521
|
+
this.write(join4(this.home, "settings.json"), next);
|
|
494
522
|
return next;
|
|
495
523
|
}
|
|
496
524
|
// ---- projects --------------------------------------------------------
|
|
497
525
|
projects() {
|
|
498
|
-
return this.read(
|
|
526
|
+
return this.read(join4(this.home, "projects.json"), []).sort(
|
|
499
527
|
(a, b) => b.openedAt.localeCompare(a.openedAt)
|
|
500
528
|
);
|
|
501
529
|
}
|
|
@@ -503,7 +531,7 @@ var Store = class {
|
|
|
503
531
|
return this.projects().find((p) => p.id === id);
|
|
504
532
|
}
|
|
505
533
|
saveProjects(list) {
|
|
506
|
-
this.write(
|
|
534
|
+
this.write(join4(this.home, "projects.json"), list);
|
|
507
535
|
}
|
|
508
536
|
/** Add a folder, or touch it if it is already known. */
|
|
509
537
|
openProject(root, name) {
|
|
@@ -517,8 +545,8 @@ var Store = class {
|
|
|
517
545
|
} else {
|
|
518
546
|
p = { id: projectIdFor(abs), name: name || basename(abs), root: abs, contexts: [], addedAt: now2, openedAt: now2 };
|
|
519
547
|
list.push(p);
|
|
520
|
-
const old =
|
|
521
|
-
const live =
|
|
548
|
+
const old = join4(this.home, "archive", "projects", p.id);
|
|
549
|
+
const live = join4(this.home, "projects", p.id);
|
|
522
550
|
if (existsSync(old) && !existsSync(live)) renameSync(old, live);
|
|
523
551
|
}
|
|
524
552
|
this.saveProjects(list);
|
|
@@ -541,11 +569,11 @@ var Store = class {
|
|
|
541
569
|
forgetProject(id) {
|
|
542
570
|
this.saveProjects(this.projects().filter((p) => p.id !== id));
|
|
543
571
|
if (!/^[a-z0-9-]+$/.test(id)) return;
|
|
544
|
-
const src =
|
|
572
|
+
const src = join4(this.home, "projects", id);
|
|
545
573
|
if (!existsSync(src)) return;
|
|
546
|
-
const dst =
|
|
547
|
-
|
|
548
|
-
const target =
|
|
574
|
+
const dst = join4(this.home, "archive", "projects");
|
|
575
|
+
mkdirSync2(dst, { recursive: true });
|
|
576
|
+
const target = join4(dst, id);
|
|
549
577
|
if (existsSync(target)) renameSync(target, `${target}-${Date.now()}`);
|
|
550
578
|
renameSync(src, target);
|
|
551
579
|
const now2 = /* @__PURE__ */ new Date();
|
|
@@ -554,30 +582,30 @@ var Store = class {
|
|
|
554
582
|
// ---- collections -----------------------------------------------------
|
|
555
583
|
dir(projectId, c) {
|
|
556
584
|
if (!/^[a-z0-9-]+$/.test(projectId)) throw new Error("bad project id");
|
|
557
|
-
const d =
|
|
558
|
-
|
|
585
|
+
const d = join4(this.home, "projects", projectId, c);
|
|
586
|
+
mkdirSync2(d, { recursive: true });
|
|
559
587
|
return d;
|
|
560
588
|
}
|
|
561
589
|
list(projectId, c) {
|
|
562
590
|
const d = this.dir(projectId, c);
|
|
563
|
-
return readdirSync(d).filter((f) => f.endsWith(".json")).map((f) => this.read(
|
|
591
|
+
return readdirSync(d).filter((f) => f.endsWith(".json")).map((f) => this.read(join4(d, f), null)).filter((x) => x !== null).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
564
592
|
}
|
|
565
593
|
get(projectId, c, id) {
|
|
566
594
|
if (!/^[a-z0-9]+$/.test(id)) return void 0;
|
|
567
|
-
return this.read(
|
|
595
|
+
return this.read(join4(this.dir(projectId, c), `${id}.json`), void 0);
|
|
568
596
|
}
|
|
569
597
|
put(projectId, c, item) {
|
|
570
|
-
this.write(
|
|
598
|
+
this.write(join4(this.dir(projectId, c), `${item.id}.json`), item);
|
|
571
599
|
return item;
|
|
572
600
|
}
|
|
573
601
|
/** Move to an archive folder instead of erasing. */
|
|
574
602
|
archive(projectId, c, id) {
|
|
575
603
|
if (!/^[a-z0-9]+$/.test(id)) return false;
|
|
576
|
-
const src =
|
|
604
|
+
const src = join4(this.dir(projectId, c), `${id}.json`);
|
|
577
605
|
if (!existsSync(src)) return false;
|
|
578
|
-
const dst =
|
|
579
|
-
|
|
580
|
-
const to =
|
|
606
|
+
const dst = join4(this.home, "projects", projectId, "archive", c);
|
|
607
|
+
mkdirSync2(dst, { recursive: true });
|
|
608
|
+
const to = join4(dst, `${id}.json`);
|
|
581
609
|
renameSync(src, to);
|
|
582
610
|
const now2 = /* @__PURE__ */ new Date();
|
|
583
611
|
utimesSync(to, now2, now2);
|
|
@@ -587,8 +615,8 @@ var Store = class {
|
|
|
587
615
|
|
|
588
616
|
// src/core/storage.ts
|
|
589
617
|
import { createHash as createHash2 } from "node:crypto";
|
|
590
|
-
import { existsSync as existsSync2, mkdirSync as
|
|
591
|
-
import { join as
|
|
618
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync2, rmSync, statSync, utimesSync as utimesSync2 } from "node:fs";
|
|
619
|
+
import { join as join5, sep } from "node:path";
|
|
592
620
|
var DAY = 864e5;
|
|
593
621
|
var CARD_REVIEW_CAP = 50;
|
|
594
622
|
var THREAD_MESSAGE_CAP = 200;
|
|
@@ -596,7 +624,7 @@ function walk(dir, each) {
|
|
|
596
624
|
const out = { bytes: 0, files: 0 };
|
|
597
625
|
if (!existsSync2(dir)) return out;
|
|
598
626
|
for (const e of readdirSync2(dir, { withFileTypes: true })) {
|
|
599
|
-
const p =
|
|
627
|
+
const p = join5(dir, e.name);
|
|
600
628
|
if (e.isDirectory()) {
|
|
601
629
|
const sub = walk(p, each);
|
|
602
630
|
out.bytes += sub.bytes;
|
|
@@ -618,18 +646,18 @@ function usage(store2) {
|
|
|
618
646
|
const cur = byName.get(name) ?? { bytes: 0, files: 0 };
|
|
619
647
|
byName.set(name, { bytes: cur.bytes + w.bytes, files: cur.files + w.files });
|
|
620
648
|
};
|
|
621
|
-
const projects =
|
|
649
|
+
const projects = join5(home, "projects");
|
|
622
650
|
if (existsSync2(projects)) {
|
|
623
651
|
for (const pid of readdirSync2(projects)) {
|
|
624
|
-
for (const c of [...COLLECTIONS, "archive"]) add(c, walk(
|
|
652
|
+
for (const c of [...COLLECTIONS, "archive"]) add(c, walk(join5(projects, pid, c)));
|
|
625
653
|
}
|
|
626
654
|
}
|
|
627
|
-
add("cache", walk(
|
|
628
|
-
add("forgotten projects", walk(
|
|
655
|
+
add("cache", walk(join5(home, "cache")));
|
|
656
|
+
add("forgotten projects", walk(join5(home, "archive")));
|
|
629
657
|
for (const [name, w] of byName) if (w.files) parts.push({ name, ...w });
|
|
630
658
|
parts.sort((a, b) => b.bytes - a.bytes);
|
|
631
659
|
const total = walk(home);
|
|
632
|
-
return { home, totalBytes: total.bytes, parts, lastPrune: store2.read(
|
|
660
|
+
return { home, totalBytes: total.bytes, parts, lastPrune: store2.read(join5(home, "prune.json"), null) };
|
|
633
661
|
}
|
|
634
662
|
function prune(store2, now2 = Date.now()) {
|
|
635
663
|
const s = store2.settings();
|
|
@@ -647,23 +675,23 @@ function prune(store2, now2 = Date.now()) {
|
|
|
647
675
|
const days = s["storage.archiveDays"];
|
|
648
676
|
if (days > 0) {
|
|
649
677
|
const cutoff = now2 - days * DAY;
|
|
650
|
-
const projects =
|
|
678
|
+
const projects = join5(home, "projects");
|
|
651
679
|
if (existsSync2(projects)) {
|
|
652
680
|
for (const pid of readdirSync2(projects)) {
|
|
653
|
-
walk(
|
|
681
|
+
walk(join5(projects, pid, "archive"), (p, size, mtime) => mtime < cutoff && drop(p, size));
|
|
654
682
|
}
|
|
655
683
|
}
|
|
656
|
-
const forgotten =
|
|
684
|
+
const forgotten = join5(home, "archive", "projects");
|
|
657
685
|
if (existsSync2(forgotten)) {
|
|
658
686
|
for (const name of readdirSync2(forgotten)) {
|
|
659
|
-
const p =
|
|
687
|
+
const p = join5(forgotten, name);
|
|
660
688
|
if (statSync(p).mtimeMs < cutoff) drop(p, walk(p).bytes, true);
|
|
661
689
|
}
|
|
662
690
|
}
|
|
663
691
|
}
|
|
664
692
|
const cap = Math.max(0, s["storage.cacheMB"]) * 1024 * 1024;
|
|
665
693
|
const cached = [];
|
|
666
|
-
const total = walk(
|
|
694
|
+
const total = walk(join5(home, "cache"), (p, size, mtime) => cached.push({ p, size, mtime })).bytes;
|
|
667
695
|
let over = total - cap;
|
|
668
696
|
for (const c of cached.sort((a, b) => a.mtime - b.mtime)) {
|
|
669
697
|
if (over <= 0) break;
|
|
@@ -682,13 +710,13 @@ function prune(store2, now2 = Date.now()) {
|
|
|
682
710
|
store2.put(p.id, "quizzes", q);
|
|
683
711
|
}
|
|
684
712
|
}
|
|
685
|
-
store2.write(
|
|
713
|
+
store2.write(join5(home, "prune.json"), { at: new Date(now2).toISOString(), removed, freedBytes });
|
|
686
714
|
return { removed, freedBytes };
|
|
687
715
|
}
|
|
688
716
|
var ReplyCache = class {
|
|
689
717
|
constructor(store2) {
|
|
690
718
|
this.store = store2;
|
|
691
|
-
this.dir =
|
|
719
|
+
this.dir = join5(store2.home, "cache");
|
|
692
720
|
}
|
|
693
721
|
dir;
|
|
694
722
|
key(...parts) {
|
|
@@ -697,7 +725,7 @@ var ReplyCache = class {
|
|
|
697
725
|
return h.digest("hex").slice(0, 32);
|
|
698
726
|
}
|
|
699
727
|
get(key) {
|
|
700
|
-
const p =
|
|
728
|
+
const p = join5(this.dir, `${key}.json`);
|
|
701
729
|
const hit = this.store.read(p, null);
|
|
702
730
|
if (!hit) return void 0;
|
|
703
731
|
const t = /* @__PURE__ */ new Date();
|
|
@@ -705,8 +733,8 @@ var ReplyCache = class {
|
|
|
705
733
|
return hit.text;
|
|
706
734
|
}
|
|
707
735
|
set(key, text2) {
|
|
708
|
-
|
|
709
|
-
this.store.write(
|
|
736
|
+
mkdirSync3(this.dir, { recursive: true });
|
|
737
|
+
this.store.write(join5(this.dir, `${key}.json`), { text: text2, at: (/* @__PURE__ */ new Date()).toISOString() });
|
|
710
738
|
}
|
|
711
739
|
};
|
|
712
740
|
var SHAPES = [
|
|
@@ -729,27 +757,27 @@ function items(store2) {
|
|
|
729
757
|
if (!existsSync2(dir)) return;
|
|
730
758
|
for (const f of readdirSync2(dir)) {
|
|
731
759
|
if (!f.endsWith(".json")) continue;
|
|
732
|
-
const p =
|
|
760
|
+
const p = join5(dir, f);
|
|
733
761
|
const st = statSync(p);
|
|
734
762
|
const rel = p.slice(home.length + 1).split(sep).join("/");
|
|
735
763
|
out.push({ id: rel, group, project, label: labelOf(store2.read(p, null), f), bytes: st.size, at: st.mtime.toISOString() });
|
|
736
764
|
}
|
|
737
765
|
};
|
|
738
|
-
const root =
|
|
766
|
+
const root = join5(home, "projects");
|
|
739
767
|
if (existsSync2(root)) {
|
|
740
768
|
for (const pid of readdirSync2(root)) {
|
|
741
769
|
const name = projects.get(pid) ?? pid;
|
|
742
770
|
for (const c of COLLECTIONS) {
|
|
743
|
-
addDir(
|
|
744
|
-
addDir(
|
|
771
|
+
addDir(join5(root, pid, c), c, name);
|
|
772
|
+
addDir(join5(root, pid, "archive", c), `archived ${c}`, name);
|
|
745
773
|
}
|
|
746
774
|
}
|
|
747
775
|
}
|
|
748
|
-
addDir(
|
|
749
|
-
const forgotten =
|
|
776
|
+
addDir(join5(home, "cache"), "reply cache");
|
|
777
|
+
const forgotten = join5(home, "archive", "projects");
|
|
750
778
|
if (existsSync2(forgotten)) {
|
|
751
779
|
for (const f of readdirSync2(forgotten)) {
|
|
752
|
-
const p =
|
|
780
|
+
const p = join5(forgotten, f);
|
|
753
781
|
const st = statSync(p);
|
|
754
782
|
out.push({ id: `archive/projects/${f}`, group: "forgotten projects", label: f, bytes: walk(p).bytes, at: st.mtime.toISOString() });
|
|
755
783
|
}
|
|
@@ -761,7 +789,7 @@ function remove(store2, ids) {
|
|
|
761
789
|
let freedBytes = 0;
|
|
762
790
|
for (const id of ids) {
|
|
763
791
|
if (id.includes("..") || !SHAPES.some((r) => r.test(id))) continue;
|
|
764
|
-
const p =
|
|
792
|
+
const p = join5(store2.home, ...id.split("/"));
|
|
765
793
|
if (!existsSync2(p)) continue;
|
|
766
794
|
const st = statSync(p);
|
|
767
795
|
freedBytes += st.isDirectory() ? walk(p).bytes : st.size;
|
|
@@ -775,11 +803,11 @@ function remove(store2, ids) {
|
|
|
775
803
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
776
804
|
import { createHash as createHash3 } from "node:crypto";
|
|
777
805
|
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
|
|
778
|
-
import { dirname as dirname2, extname as extname2, join as
|
|
806
|
+
import { dirname as dirname2, extname as extname2, join as join7, relative as relative2, resolve as resolve3, sep as sep2, basename as basename2 } from "node:path";
|
|
779
807
|
|
|
780
808
|
// src/core/graph.ts
|
|
781
809
|
import { existsSync as existsSync3, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
782
|
-
import { dirname, extname, join as
|
|
810
|
+
import { dirname, extname, join as join6, relative, resolve as resolve2 } from "node:path";
|
|
783
811
|
var JS_EXT = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
784
812
|
var JS_RE = /(?:^|\n)\s*(?:import|export)\s[^'"`;]*?from\s*['"]([^'"]+)['"]|(?:^|[^\w.])(?:require|import)\(\s*['"]([^'"]+)['"]\s*\)|(?:^|\n)\s*import\s*['"]([^'"]+)['"]/g;
|
|
785
813
|
var PY_FROM = /^\s*from\s+(\.*)([\w.]*)\s+import\s+([\w*, ()]+)/gm;
|
|
@@ -817,7 +845,7 @@ function resolveJs(from, spec, known, aliases = []) {
|
|
|
817
845
|
const matching = aliases.filter((x) => x.prefix && spec.startsWith(x.prefix)).sort((a, b) => Number(from.startsWith(b.dir + "/")) * b.dir.length - Number(from.startsWith(a.dir + "/")) * a.dir.length);
|
|
818
846
|
for (const a of matching) {
|
|
819
847
|
for (const t of a.targets) {
|
|
820
|
-
const hit = resolveJs(from, `./${relativeTo(from,
|
|
848
|
+
const hit = resolveJs(from, `./${relativeTo(from, join6(t, spec.slice(a.prefix.length)))}`, known);
|
|
821
849
|
if (hit) return hit;
|
|
822
850
|
}
|
|
823
851
|
}
|
|
@@ -828,7 +856,7 @@ function resolveJs(from, spec, known, aliases = []) {
|
|
|
828
856
|
const ext = extname(base);
|
|
829
857
|
if (ext === ".js" || ext === ".mjs" || ext === ".jsx") for (const e of [".ts", ".tsx", ".mts"]) tries.push(base.slice(0, -ext.length) + e);
|
|
830
858
|
for (const e of JS_EXT) tries.push(base + e);
|
|
831
|
-
for (const e of JS_EXT) tries.push(
|
|
859
|
+
for (const e of JS_EXT) tries.push(join6(base, `index${e}`));
|
|
832
860
|
return tries.find((t) => known.has(t)) ?? null;
|
|
833
861
|
}
|
|
834
862
|
function relativeTo(from, to) {
|
|
@@ -845,7 +873,7 @@ function pyRoots(root, files) {
|
|
|
845
873
|
function resolvePyModule(mod, roots, known) {
|
|
846
874
|
const rel = mod.split(".").join("/");
|
|
847
875
|
for (const r of roots) {
|
|
848
|
-
for (const t of [
|
|
876
|
+
for (const t of [join6(r, `${rel}.py`), join6(r, rel, "__init__.py")]) if (known.has(t)) return t;
|
|
849
877
|
}
|
|
850
878
|
return null;
|
|
851
879
|
}
|
|
@@ -856,11 +884,11 @@ function pyImports(from, src, roots, known) {
|
|
|
856
884
|
if (dots) {
|
|
857
885
|
let dir = dirname(from);
|
|
858
886
|
for (let i = 1; i < dots.length; i++) dir = dirname(dir);
|
|
859
|
-
const base = mod ?
|
|
860
|
-
const hit = [`${base}.py`,
|
|
887
|
+
const base = mod ? join6(dir, ...mod.split(".")) : dir;
|
|
888
|
+
const hit = [`${base}.py`, join6(base, "__init__.py")].find((t) => known.has(t));
|
|
861
889
|
if (hit) out.push(hit);
|
|
862
890
|
for (const n of names.replace(/[()]/g, "").split(",").map((x) => x.trim().split(/\s+/)[0]).filter(Boolean)) {
|
|
863
|
-
const sib =
|
|
891
|
+
const sib = join6(base, `${n}.py`);
|
|
864
892
|
if (known.has(sib)) out.push(sib);
|
|
865
893
|
}
|
|
866
894
|
} else {
|
|
@@ -1041,10 +1069,10 @@ var Workspace = class {
|
|
|
1041
1069
|
absFromRel(rel) {
|
|
1042
1070
|
if (!rel) return void 0;
|
|
1043
1071
|
const clean = rel.replace(/^\.\//, "");
|
|
1044
|
-
const candidates = [
|
|
1072
|
+
const candidates = [join7(this.project.root, clean)];
|
|
1045
1073
|
for (const c of this.project.contexts) {
|
|
1046
1074
|
const name = basename2(c);
|
|
1047
|
-
if (clean.startsWith(name + "/")) candidates.push(
|
|
1075
|
+
if (clean.startsWith(name + "/")) candidates.push(join7(c, clean.slice(name.length + 1)));
|
|
1048
1076
|
}
|
|
1049
1077
|
if (clean.startsWith("/")) candidates.unshift(clean);
|
|
1050
1078
|
for (const c of candidates) {
|
|
@@ -1067,7 +1095,7 @@ var Workspace = class {
|
|
|
1067
1095
|
/** Every file in the main folder, absolute paths. */
|
|
1068
1096
|
files() {
|
|
1069
1097
|
const r = this.project.root;
|
|
1070
|
-
return existsSync4(r) ? listFiles(r).map((f) =>
|
|
1098
|
+
return existsSync4(r) ? listFiles(r).map((f) => join7(r, f)) : [];
|
|
1071
1099
|
}
|
|
1072
1100
|
graph() {
|
|
1073
1101
|
return importGraph(this.project.root, this.files());
|
|
@@ -1149,8 +1177,8 @@ ${numbered}
|
|
|
1149
1177
|
}
|
|
1150
1178
|
for (const e of entries) {
|
|
1151
1179
|
if (!e.isDirectory() || e.name.startsWith(".") || SKIP_DIRS.has(e.name)) continue;
|
|
1152
|
-
const p =
|
|
1153
|
-
if (existsSync4(
|
|
1180
|
+
const p = join7(dir, e.name);
|
|
1181
|
+
if (existsSync4(join7(p, ".git"))) found.push(p);
|
|
1154
1182
|
else if (depth < REPO_SCAN_DEPTH) scan(p, depth + 1);
|
|
1155
1183
|
}
|
|
1156
1184
|
};
|
|
@@ -1230,7 +1258,7 @@ ${numbered}
|
|
|
1230
1258
|
const s = status.get(path2) ?? "M";
|
|
1231
1259
|
const patch = git(root, ["diff", "--relative", "-M", ...range, "--", path2]);
|
|
1232
1260
|
files.push({
|
|
1233
|
-
path:
|
|
1261
|
+
path: join7(root, path2),
|
|
1234
1262
|
status: s === "A" ? "added" : s === "D" ? "deleted" : s === "R" ? "renamed" : "modified",
|
|
1235
1263
|
additions: Number(add) || 0,
|
|
1236
1264
|
deletions: Number(del) || 0,
|
|
@@ -1240,7 +1268,7 @@ ${numbered}
|
|
|
1240
1268
|
if (!spec.head) {
|
|
1241
1269
|
const untracked = git(root, ["ls-files", "--others", "--exclude-standard"]).split("\n").filter(Boolean);
|
|
1242
1270
|
for (const rel of untracked.slice(0, 200)) {
|
|
1243
|
-
const abs =
|
|
1271
|
+
const abs = join7(root, rel);
|
|
1244
1272
|
let text2 = "";
|
|
1245
1273
|
try {
|
|
1246
1274
|
text2 = this.read(abs).text;
|
|
@@ -1262,7 +1290,7 @@ function listFiles(root) {
|
|
|
1262
1290
|
if (isGitRepo(root)) {
|
|
1263
1291
|
try {
|
|
1264
1292
|
const out2 = git(root, ["ls-files", "--cached", "--others", "--exclude-standard"]);
|
|
1265
|
-
return out2.split("\n").filter(Boolean).filter((p) => existsSync4(
|
|
1293
|
+
return out2.split("\n").filter(Boolean).filter((p) => existsSync4(join7(root, p))).slice(0, MAX_TREE_FILES);
|
|
1266
1294
|
} catch {
|
|
1267
1295
|
}
|
|
1268
1296
|
}
|
|
@@ -1277,7 +1305,7 @@ function listFiles(root) {
|
|
|
1277
1305
|
}
|
|
1278
1306
|
for (const e of entries) {
|
|
1279
1307
|
if (e.name.startsWith(".") && e.name !== ".github" && e.name !== ".claude") continue;
|
|
1280
|
-
const p =
|
|
1308
|
+
const p = join7(dir, e.name);
|
|
1281
1309
|
if (e.isDirectory()) {
|
|
1282
1310
|
if (!SKIP_DIRS.has(e.name)) walk2(p);
|
|
1283
1311
|
} else if (e.isFile()) out.push(relative2(root, p));
|
|
@@ -1296,7 +1324,7 @@ function buildTree(root, files) {
|
|
|
1296
1324
|
node.children ??= [];
|
|
1297
1325
|
let child = node.children.find((c) => c.name === part && c.kind === (isFile2 ? "file" : "dir"));
|
|
1298
1326
|
if (!child) {
|
|
1299
|
-
child = { name: part, path:
|
|
1327
|
+
child = { name: part, path: join7(node.path, part), kind: isFile2 ? "file" : "dir" };
|
|
1300
1328
|
if (!isFile2) child.children = [];
|
|
1301
1329
|
node.children.push(child);
|
|
1302
1330
|
}
|
|
@@ -1314,7 +1342,7 @@ function browse(dir) {
|
|
|
1314
1342
|
const abs = resolve3(dir);
|
|
1315
1343
|
const dirs = readdirSync3(abs, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".") && !SKIP_DIRS.has(e.name)).map((e) => e.name).sort((a, b) => a.localeCompare(b));
|
|
1316
1344
|
const parent = resolve3(abs, "..");
|
|
1317
|
-
return { path: abs, parent: parent === abs ? null : parent, dirs, isGit: existsSync4(
|
|
1345
|
+
return { path: abs, parent: parent === abs ? null : parent, dirs, isGit: existsSync4(join7(abs, ".git")) };
|
|
1318
1346
|
}
|
|
1319
1347
|
|
|
1320
1348
|
// src/core/insights.ts
|
|
@@ -1582,13 +1610,13 @@ function today(store2, project, hubs, now2 = /* @__PURE__ */ new Date()) {
|
|
|
1582
1610
|
}
|
|
1583
1611
|
|
|
1584
1612
|
// src/core/jobs.ts
|
|
1585
|
-
import { join as
|
|
1613
|
+
import { join as join8 } from "node:path";
|
|
1586
1614
|
var JOB_CAP = 100;
|
|
1587
1615
|
var Jobs = class {
|
|
1588
1616
|
constructor(store2) {
|
|
1589
1617
|
this.store = store2;
|
|
1590
1618
|
if (!store2) return;
|
|
1591
|
-
this.file =
|
|
1619
|
+
this.file = join8(store2.home, "jobs.json");
|
|
1592
1620
|
for (const j of store2.read(this.file, [])) {
|
|
1593
1621
|
if (j.status === "running") Object.assign(j, { status: "failed", error: "cognitune stopped while this ran", endedAt: j.startedAt });
|
|
1594
1622
|
this.jobs.set(j.id, j);
|
|
@@ -3268,7 +3296,7 @@ function createApi(store2, opts2 = {}) {
|
|
|
3268
3296
|
return c.json({ settings: s, agent: agent().info, home: store2.home });
|
|
3269
3297
|
});
|
|
3270
3298
|
api.get("/browse", (c) => {
|
|
3271
|
-
const path2 = c.req.query("path") ||
|
|
3299
|
+
const path2 = c.req.query("path") || homedir3();
|
|
3272
3300
|
if (!existsSync5(path2) || !statSync4(path2).isDirectory()) return fail(c, 404, "folder not found");
|
|
3273
3301
|
return c.json(browse(path2));
|
|
3274
3302
|
});
|
|
@@ -3629,7 +3657,7 @@ var MIME = {
|
|
|
3629
3657
|
};
|
|
3630
3658
|
function webDir() {
|
|
3631
3659
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
3632
|
-
for (const d of [
|
|
3660
|
+
for (const d of [join9(here, "web"), join9(here, "..", "dist", "web")]) if (existsSync6(join9(d, "index.html"))) return d;
|
|
3633
3661
|
return null;
|
|
3634
3662
|
}
|
|
3635
3663
|
function openBrowser(url) {
|
|
@@ -3643,7 +3671,7 @@ function openBrowser(url) {
|
|
|
3643
3671
|
}
|
|
3644
3672
|
function demoDir() {
|
|
3645
3673
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
3646
|
-
for (const d of [
|
|
3674
|
+
for (const d of [join9(here, "..", "demo", "sample"), join9(here, "demo", "sample")]) if (existsSync6(d)) return d;
|
|
3647
3675
|
return null;
|
|
3648
3676
|
}
|
|
3649
3677
|
var opts = parseArgs(process.argv.slice(2));
|
|
@@ -3654,7 +3682,7 @@ if (opts.demo) {
|
|
|
3654
3682
|
process.exit(2);
|
|
3655
3683
|
}
|
|
3656
3684
|
process.env.COGNITUNE_AGENT = "fake";
|
|
3657
|
-
process.env.COGNITUNE_HOME =
|
|
3685
|
+
process.env.COGNITUNE_HOME = join9(tmpdir3(), "cognitune-demo");
|
|
3658
3686
|
process.env.COGNITUNE_FAKE_DELAY_MS ??= "1500";
|
|
3659
3687
|
opts.folder = sample;
|
|
3660
3688
|
}
|
|
@@ -3666,9 +3694,9 @@ app.get("*", (c) => {
|
|
|
3666
3694
|
if (!web) return c.text("Web app not built. Run `npm run build`, or `npm run dev` and open http://localhost:5173.", 503);
|
|
3667
3695
|
const rel = decodeURIComponent(new URL(c.req.url).pathname).replace(/^\/+/, "");
|
|
3668
3696
|
const file = resolve4(web, rel);
|
|
3669
|
-
const target = file.startsWith(web) && existsSync6(file) && statSync5(file).isFile() ? file :
|
|
3697
|
+
const target = file.startsWith(web) && existsSync6(file) && statSync5(file).isFile() ? file : join9(web, "index.html");
|
|
3670
3698
|
const type = MIME[extname3(target)] ?? "application/octet-stream";
|
|
3671
|
-
const cache = target.includes(`${
|
|
3699
|
+
const cache = target.includes(`${join9(web, "assets")}`) ? "public, max-age=31536000, immutable" : "no-cache";
|
|
3672
3700
|
return c.body(readFileSync5(target), 200, { "content-type": type, "cache-control": cache });
|
|
3673
3701
|
});
|
|
3674
3702
|
var path = "/";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as je,u as J,a as qe,b as Be,d as Xe,e as Ye,f as ae,r as l,g as Ae,j as e,S as Te,h as De,B as Ke,R as Ue,E as ke,M as He,P as Qe,i as Ge,C as Je,G as Ve,F as Ze,k as _e,l as et,m as G}from"./index-
|
|
1
|
+
import{c as je,u as J,a as qe,b as Be,d as Xe,e as Ye,f as ae,r as l,g as Ae,j as e,S as Te,h as De,B as Ke,R as Ue,E as ke,M as He,P as Qe,i as Ge,C as Je,G as Ve,F as Ze,k as _e,l as et,m as G}from"./index-CD0Svk5N.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|