@graphmemory/server 1.3.0 → 1.3.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/api/index.js +4 -4
- package/dist/api/rest/code.js +2 -1
- package/dist/api/rest/docs.js +2 -1
- package/dist/api/rest/embed.js +8 -1
- package/dist/api/rest/index.js +25 -7
- package/dist/api/rest/knowledge.js +4 -2
- package/dist/api/rest/skills.js +2 -1
- package/dist/api/rest/tasks.js +2 -1
- package/dist/api/rest/validation.js +41 -40
- package/dist/api/rest/websocket.js +24 -7
- package/dist/api/tools/knowledge/add-attachment.js +2 -1
- package/dist/api/tools/skills/add-attachment.js +2 -1
- package/dist/api/tools/tasks/add-attachment.js +2 -1
- package/dist/cli/index.js +7 -4
- package/dist/cli/indexer.js +38 -25
- package/dist/graphs/attachment-types.js +5 -0
- package/dist/graphs/code.js +34 -8
- package/dist/graphs/docs.js +5 -3
- package/dist/graphs/file-index.js +5 -3
- package/dist/graphs/knowledge.js +11 -4
- package/dist/graphs/skill.js +12 -5
- package/dist/graphs/task.js +12 -5
- package/dist/lib/defaults.js +78 -0
- package/dist/lib/embedder.js +11 -12
- package/dist/lib/embedding-codec.js +3 -5
- package/dist/lib/graph-persistence.js +68 -0
- package/dist/lib/jwt.js +2 -2
- package/dist/lib/mirror-watcher.js +4 -3
- package/dist/lib/multi-config.js +3 -1
- package/dist/lib/parsers/docs.js +2 -1
- package/dist/lib/parsers/languages/typescript.js +39 -17
- package/dist/lib/project-manager.js +7 -1
- package/dist/lib/search/bm25.js +5 -4
- package/dist/lib/search/code.js +2 -1
- package/dist/lib/search/docs.js +2 -1
- package/dist/lib/search/file-index.js +2 -1
- package/dist/lib/search/files.js +3 -2
- package/dist/lib/search/knowledge.js +2 -1
- package/dist/lib/search/skills.js +2 -1
- package/dist/lib/search/tasks.js +2 -1
- package/dist/ui/assets/{NoteForm-aZX9f6-3.js → NoteForm-SQ0b93i0.js} +1 -1
- package/dist/ui/assets/{SkillForm-KYa3o92l.js → SkillForm-BVsGrNPb.js} +1 -1
- package/dist/ui/assets/{TaskForm-Bl5nkybO.js → TaskForm-DgPVeiI9.js} +1 -1
- package/dist/ui/assets/{_articleId_-DjbCByxM.js → _articleId_-FqdaSeYS.js} +1 -1
- package/dist/ui/assets/{_docId_-hdCDjclV.js → _docId_-Q0Wmjtp6.js} +1 -1
- package/dist/ui/assets/{_filePath_-CpG836v4.js → _filePath_-BR0gOT_z.js} +1 -1
- package/dist/ui/assets/{_noteId_-C1enaQd1.js → _noteId_-BMWd415J.js} +1 -1
- package/dist/ui/assets/{_skillId_-hPoCet7J.js → _skillId_-CsHgildJ.js} +1 -1
- package/dist/ui/assets/{_taskId_-DSB3dLVz.js → _taskId_-xDHTfbQw.js} +1 -1
- package/dist/ui/assets/{_toolName_-3SmCfxZy.js → _toolName_-BSa2uNSu.js} +1 -1
- package/dist/ui/assets/{attachments-CEQ-2nMo.js → attachments-NSvN5_0A.js} +1 -1
- package/dist/ui/assets/{docs-CrXsRcOG.js → docs-iUK8E40J.js} +1 -1
- package/dist/ui/assets/{edit-TUIIpUMF.js → edit-BzIJy_Oo.js} +1 -1
- package/dist/ui/assets/{edit-BYiy1FZy.js → edit-Dnc067B2.js} +1 -1
- package/dist/ui/assets/{edit-hc-ZWz3y.js → edit-U_UEI361.js} +1 -1
- package/dist/ui/assets/{files-0bPg6NH9.js → files-B4svJUZh.js} +1 -1
- package/dist/ui/assets/{graph-DXGud_wF.js → graph-CcNP1ckP.js} +1 -1
- package/dist/ui/assets/{help-DJ52_fxN.js → help-BJZZtKAR.js} +1 -1
- package/dist/ui/assets/{help-CEMQqZUR.js → help-D6XKMuzk.js} +16 -4
- package/dist/ui/assets/index-CEweXD9O.js +2 -0
- package/dist/ui/assets/{knowledge-DeygeGGH.js → knowledge-CV99ToEV.js} +1 -1
- package/dist/ui/assets/{new-CpD7hOBA.js → new-BypesKiP.js} +1 -1
- package/dist/ui/assets/{new-s8c0M75X.js → new-Dcx8wlp4.js} +1 -1
- package/dist/ui/assets/{new-DHTg3Dqq.js → new-Sq3NY2oa.js} +1 -1
- package/dist/ui/assets/{prompts-BgOmdxgM.js → prompts-DbsIe3Pm.js} +1 -1
- package/dist/ui/assets/{search-EpJhdP2a.js → search-D87r7lIL.js} +1 -1
- package/dist/ui/assets/{skill-y9pizyqE.js → skill-BltAsz7M.js} +1 -1
- package/dist/ui/assets/{skills-Cga9iUZN.js → skills-Dtmg2kDA.js} +1 -1
- package/dist/ui/assets/{tasks-CobouTKV.js → tasks-BRqIwKCG.js} +1 -1
- package/dist/ui/assets/{tools-JxKH5BDF.js → tools-CM3gQ4TK.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +5 -2
- package/dist/ui/assets/index-BCZDAYZi.js +0 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.readJsonWithTmpFallback = readJsonWithTmpFallback;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
/**
|
|
39
|
+
* Try to read and parse a JSON file, falling back to .tmp if main file
|
|
40
|
+
* is missing or corrupted (recovery from interrupted save).
|
|
41
|
+
*/
|
|
42
|
+
function readJsonWithTmpFallback(file) {
|
|
43
|
+
const tmp = file + '.tmp';
|
|
44
|
+
// If main file missing but .tmp exists, recover it
|
|
45
|
+
if (!fs.existsSync(file) && fs.existsSync(tmp)) {
|
|
46
|
+
try {
|
|
47
|
+
fs.renameSync(tmp, file);
|
|
48
|
+
}
|
|
49
|
+
catch { /* ignore */ }
|
|
50
|
+
}
|
|
51
|
+
if (fs.existsSync(file)) {
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Main file corrupted — try .tmp as fallback
|
|
57
|
+
if (fs.existsSync(tmp)) {
|
|
58
|
+
try {
|
|
59
|
+
const data = JSON.parse(fs.readFileSync(tmp, 'utf-8'));
|
|
60
|
+
process.stderr.write(`[graph] Recovered from .tmp file: ${file}\n`);
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
catch { /* .tmp also bad */ }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
package/dist/lib/jwt.js
CHANGED
|
@@ -107,8 +107,8 @@ function verifyToken(token, secret) {
|
|
|
107
107
|
// ---------------------------------------------------------------------------
|
|
108
108
|
const ACCESS_COOKIE = 'mgm_access';
|
|
109
109
|
const REFRESH_COOKIE = 'mgm_refresh';
|
|
110
|
-
function setAuthCookies(res, accessToken, refreshToken, accessTtl, refreshTtl) {
|
|
111
|
-
const secure = process.env.NODE_ENV !== 'development';
|
|
110
|
+
function setAuthCookies(res, accessToken, refreshToken, accessTtl, refreshTtl, secureCookie) {
|
|
111
|
+
const secure = secureCookie ?? process.env.NODE_ENV !== 'development';
|
|
112
112
|
res.cookie(ACCESS_COOKIE, accessToken, {
|
|
113
113
|
httpOnly: true,
|
|
114
114
|
secure,
|
|
@@ -45,6 +45,7 @@ const chokidar_1 = __importDefault(require("chokidar"));
|
|
|
45
45
|
const file_import_1 = require("./file-import");
|
|
46
46
|
const events_log_1 = require("./events-log");
|
|
47
47
|
const frontmatter_1 = require("./frontmatter");
|
|
48
|
+
const defaults_1 = require("../lib/defaults");
|
|
48
49
|
/**
|
|
49
50
|
* Tracks recent mirror writes to suppress re-import (feedback loop prevention).
|
|
50
51
|
* When mirrorNote/mirrorTask writes a file, the watcher will fire —
|
|
@@ -53,8 +54,8 @@ const frontmatter_1 = require("./frontmatter");
|
|
|
53
54
|
class MirrorWriteTracker {
|
|
54
55
|
/** Map from filePath → { mtimeMs (for comparison), recordedAt (for eviction) } */
|
|
55
56
|
recentWrites = new Map();
|
|
56
|
-
static STALE_MS =
|
|
57
|
-
static MAX_ENTRIES =
|
|
57
|
+
static STALE_MS = defaults_1.MIRROR_STALE_MS;
|
|
58
|
+
static MAX_ENTRIES = defaults_1.MIRROR_MAX_ENTRIES;
|
|
58
59
|
/** Called by mirrorNote/mirrorTask after writing a file. */
|
|
59
60
|
recordWrite(filePath) {
|
|
60
61
|
try {
|
|
@@ -76,7 +77,7 @@ class MirrorWriteTracker {
|
|
|
76
77
|
const stat = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
77
78
|
if (!stat)
|
|
78
79
|
return false;
|
|
79
|
-
if (Math.abs(stat.mtimeMs - recorded.mtimeMs) <
|
|
80
|
+
if (Math.abs(stat.mtimeMs - recorded.mtimeMs) < defaults_1.MIRROR_MTIME_TOLERANCE_MS) {
|
|
80
81
|
this.recentWrites.delete(filePath);
|
|
81
82
|
return true;
|
|
82
83
|
}
|
package/dist/lib/multi-config.js
CHANGED
|
@@ -100,6 +100,7 @@ const serverSchema = zod_1.z.object({
|
|
|
100
100
|
defaultAccess: accessLevelSchema.optional(),
|
|
101
101
|
access: accessMapSchema,
|
|
102
102
|
jwtSecret: zod_1.z.string().min(16).optional(),
|
|
103
|
+
cookieSecure: zod_1.z.boolean().optional(),
|
|
103
104
|
accessTokenTtl: zod_1.z.string().optional(),
|
|
104
105
|
refreshTokenTtl: zod_1.z.string().optional(),
|
|
105
106
|
rateLimit: rateLimitSchema.optional(),
|
|
@@ -196,7 +197,7 @@ const SERVER_DEFAULTS = {
|
|
|
196
197
|
};
|
|
197
198
|
const PROJECT_DEFAULTS = {
|
|
198
199
|
docsInclude: '**/*.md',
|
|
199
|
-
codeInclude: '**/*.{js,ts,jsx,tsx}',
|
|
200
|
+
codeInclude: '**/*.{js,ts,jsx,tsx,mjs,mts,cjs,cts}',
|
|
200
201
|
chunkDepth: 4,
|
|
201
202
|
};
|
|
202
203
|
/** Parse comma-separated exclude string into array of patterns. */
|
|
@@ -268,6 +269,7 @@ function loadMultiConfig(yamlPath) {
|
|
|
268
269
|
defaultAccess: srv.defaultAccess ?? SERVER_DEFAULTS.defaultAccess,
|
|
269
270
|
access: srv.access ?? undefined,
|
|
270
271
|
jwtSecret: srv.jwtSecret,
|
|
272
|
+
cookieSecure: srv.cookieSecure,
|
|
271
273
|
accessTokenTtl: srv.accessTokenTtl ?? SERVER_DEFAULTS.accessTokenTtl,
|
|
272
274
|
refreshTokenTtl: srv.refreshTokenTtl ?? SERVER_DEFAULTS.refreshTokenTtl,
|
|
273
275
|
rateLimit: {
|
package/dist/lib/parsers/docs.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.clearWikiIndexCache = clearWikiIndexCache;
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const codeblock_1 = require("../../lib/parsers/codeblock");
|
|
11
|
+
const defaults_1 = require("../../lib/defaults");
|
|
11
12
|
// Parse a markdown file into chunks split by headings
|
|
12
13
|
async function parseFile(content, absolutePath, projectDir, chunkDepth) {
|
|
13
14
|
const fileId = path_1.default.relative(projectDir, absolutePath);
|
|
@@ -179,7 +180,7 @@ function getWikiIndex(projectDir) {
|
|
|
179
180
|
if (_wikiIndex.has(projectDir))
|
|
180
181
|
return _wikiIndex.get(projectDir);
|
|
181
182
|
const index = new Map();
|
|
182
|
-
const MAX_DEPTH =
|
|
183
|
+
const MAX_DEPTH = defaults_1.WIKI_MAX_DEPTH;
|
|
183
184
|
function walk(dir, depth) {
|
|
184
185
|
if (depth >= MAX_DEPTH)
|
|
185
186
|
return;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerTypescript = registerTypescript;
|
|
4
4
|
const registry_1 = require("./registry");
|
|
5
|
+
const defaults_1 = require("../../../lib/defaults");
|
|
5
6
|
/** Get the previous named sibling that is a JSDoc comment. */
|
|
6
7
|
function getDocComment(node) {
|
|
7
|
-
let prev = node.
|
|
8
|
+
let prev = node.previousNamedSibling;
|
|
8
9
|
while (prev && prev.type === 'comment' && !prev.text.startsWith('/**')) {
|
|
9
|
-
prev = prev.
|
|
10
|
+
prev = prev.previousNamedSibling;
|
|
10
11
|
}
|
|
11
12
|
if (prev && prev.type === 'comment' && prev.text.startsWith('/**')) {
|
|
12
13
|
return prev.text.trim();
|
|
@@ -14,28 +15,50 @@ function getDocComment(node) {
|
|
|
14
15
|
return '';
|
|
15
16
|
}
|
|
16
17
|
/** Collapse whitespace and truncate. */
|
|
17
|
-
function truncate(text, maxLen =
|
|
18
|
+
function truncate(text, maxLen = defaults_1.SIGNATURE_MAX_LEN) {
|
|
18
19
|
const collapsed = text.replace(/\s+/g, ' ').trim();
|
|
19
20
|
return collapsed.length > maxLen ? collapsed.slice(0, maxLen) + '…' : collapsed;
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Slice outerNode.text up to where bodyNode begins, using line-based
|
|
24
|
+
* slicing to avoid tree-sitter byte-offset vs JS char-offset mismatch
|
|
25
|
+
* (startIndex is UTF-8 bytes, String.slice uses UTF-16 code units).
|
|
26
|
+
*/
|
|
27
|
+
function sliceBeforeBody(outerNode, bodyNode) {
|
|
28
|
+
const text = outerNode.text ?? '';
|
|
29
|
+
const outerStartRow = outerNode.startPosition.row;
|
|
30
|
+
const bodyStartRow = bodyNode.startPosition.row;
|
|
31
|
+
if (bodyStartRow > outerStartRow) {
|
|
32
|
+
const lines = text.split('\n');
|
|
33
|
+
const relativeRow = bodyStartRow - outerStartRow;
|
|
34
|
+
const beforeBody = lines.slice(0, relativeRow);
|
|
35
|
+
const bodyLine = lines[relativeRow] ?? '';
|
|
36
|
+
// Use bodyNode.startPosition.column to find the exact body brace position,
|
|
37
|
+
// avoiding false matches on '{' in parameter destructuring or type annotations.
|
|
38
|
+
const col = bodyNode.startPosition.column;
|
|
39
|
+
if (col > 0)
|
|
40
|
+
beforeBody.push(bodyLine.slice(0, col));
|
|
41
|
+
return beforeBody.join('\n');
|
|
42
|
+
}
|
|
43
|
+
// Single-line case: body starts on the same line as the declaration.
|
|
44
|
+
// Use column offset to slice precisely instead of indexOf('{') which
|
|
45
|
+
// would match '{' in destructured params like `({ data }) => {`.
|
|
46
|
+
const col = bodyNode.startPosition.column - outerNode.startPosition.column;
|
|
47
|
+
if (col > 0)
|
|
48
|
+
return text.slice(0, col);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
21
51
|
/**
|
|
22
52
|
* Build signature by taking everything before the body node.
|
|
23
|
-
* For code (ASCII-dominated), byte offset ≈ char offset.
|
|
24
53
|
* Falls back to first line if no body found.
|
|
25
54
|
*/
|
|
26
55
|
function buildSignature(outerNode, innerNode) {
|
|
27
56
|
const bodyNode = innerNode.childForFieldName('body');
|
|
28
57
|
const text = outerNode.text ?? '';
|
|
29
|
-
if (!bodyNode)
|
|
30
|
-
// No body (type alias, ambient declaration, etc.) — use full text
|
|
58
|
+
if (!bodyNode)
|
|
31
59
|
return truncate(text);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const headerBytes = bodyNode.startIndex - outerNode.startIndex;
|
|
35
|
-
if (headerBytes > 0) {
|
|
36
|
-
return truncate(text.slice(0, headerBytes));
|
|
37
|
-
}
|
|
38
|
-
return truncate(text.split('\n')[0]);
|
|
60
|
+
const header = sliceBeforeBody(outerNode, bodyNode);
|
|
61
|
+
return truncate(header ?? text.split('\n')[0]);
|
|
39
62
|
}
|
|
40
63
|
/**
|
|
41
64
|
* Build signature for variable declarations.
|
|
@@ -46,10 +69,9 @@ function buildVariableSignature(outerNode, declarator) {
|
|
|
46
69
|
if (value) {
|
|
47
70
|
const valueBody = value.childForFieldName('body');
|
|
48
71
|
if (valueBody) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return truncate(fullText.slice(0, bodyOffset));
|
|
72
|
+
const header = sliceBeforeBody(outerNode, valueBody);
|
|
73
|
+
if (header)
|
|
74
|
+
return truncate(header);
|
|
53
75
|
}
|
|
54
76
|
}
|
|
55
77
|
return truncate(outerNode.text ?? '');
|
|
@@ -13,11 +13,14 @@ const file_index_1 = require("../graphs/file-index");
|
|
|
13
13
|
const task_1 = require("../graphs/task");
|
|
14
14
|
const skill_1 = require("../graphs/skill");
|
|
15
15
|
const indexer_1 = require("../cli/indexer");
|
|
16
|
+
const code_2 = require("../lib/parsers/code");
|
|
17
|
+
const docs_2 = require("../lib/parsers/docs");
|
|
16
18
|
const promise_queue_1 = require("../lib/promise-queue");
|
|
17
19
|
const multi_config_1 = require("../lib/multi-config");
|
|
18
20
|
const mirror_watcher_1 = require("../lib/mirror-watcher");
|
|
19
21
|
const team_1 = require("../lib/team");
|
|
20
22
|
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const defaults_1 = require("../lib/defaults");
|
|
21
24
|
// ---------------------------------------------------------------------------
|
|
22
25
|
// ProjectManager
|
|
23
26
|
// ---------------------------------------------------------------------------
|
|
@@ -264,6 +267,9 @@ class ProjectManager extends events_1.EventEmitter {
|
|
|
264
267
|
const instance = this.projects.get(id);
|
|
265
268
|
if (!instance)
|
|
266
269
|
throw new Error(`Project "${id}" not found`);
|
|
270
|
+
// Clear parser caches to prevent cross-project leaks in multi-project mode
|
|
271
|
+
(0, code_2.clearPathMappingsCache)();
|
|
272
|
+
(0, docs_2.clearWikiIndexCache)();
|
|
267
273
|
const gc = instance.config.graphConfigs;
|
|
268
274
|
const indexer = (0, indexer_1.createProjectIndexer)(instance.docGraph, instance.codeGraph, {
|
|
269
275
|
projectId: id,
|
|
@@ -358,7 +364,7 @@ class ProjectManager extends events_1.EventEmitter {
|
|
|
358
364
|
/**
|
|
359
365
|
* Start auto-save interval (every intervalMs, save dirty projects).
|
|
360
366
|
*/
|
|
361
|
-
startAutoSave(intervalMs =
|
|
367
|
+
startAutoSave(intervalMs = defaults_1.AUTO_SAVE_INTERVAL_MS) {
|
|
362
368
|
this.autoSaveInterval = setInterval(() => {
|
|
363
369
|
for (const instance of this.projects.values()) {
|
|
364
370
|
if (instance.dirty) {
|
package/dist/lib/search/bm25.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.BM25Index = void 0;
|
|
8
8
|
exports.tokenize = tokenize;
|
|
9
9
|
exports.rrfFuse = rrfFuse;
|
|
10
|
+
const defaults_1 = require("../../lib/defaults");
|
|
10
11
|
// ---------------------------------------------------------------------------
|
|
11
12
|
// Tokenizer
|
|
12
13
|
// ---------------------------------------------------------------------------
|
|
@@ -56,8 +57,8 @@ class BM25Index {
|
|
|
56
57
|
textExtractor;
|
|
57
58
|
constructor(textExtractor, opts) {
|
|
58
59
|
this.textExtractor = textExtractor;
|
|
59
|
-
this.k1 = opts?.k1 ??
|
|
60
|
-
this.b = opts?.b ??
|
|
60
|
+
this.k1 = opts?.k1 ?? defaults_1.BM25_K1;
|
|
61
|
+
this.b = opts?.b ?? defaults_1.BM25_B;
|
|
61
62
|
}
|
|
62
63
|
get size() {
|
|
63
64
|
return this.docs.size;
|
|
@@ -129,7 +130,7 @@ class BM25Index {
|
|
|
129
130
|
continue;
|
|
130
131
|
const docFreq = this.df.get(term) ?? 0;
|
|
131
132
|
// IDF: log((N - df + 0.5) / (df + 0.5) + 1)
|
|
132
|
-
const idf = Math.log((N - docFreq +
|
|
133
|
+
const idf = Math.log((N - docFreq + defaults_1.BM25_IDF_OFFSET) / (docFreq + defaults_1.BM25_IDF_OFFSET) + 1);
|
|
133
134
|
// TF saturation: (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * dl/avgdl))
|
|
134
135
|
const tfNorm = (tf * (this.k1 + 1)) / (tf + this.k1 * (1 - this.b + this.b * doc.length / avgDl));
|
|
135
136
|
docScore += idf * tfNorm;
|
|
@@ -151,7 +152,7 @@ exports.BM25Index = BM25Index;
|
|
|
151
152
|
*
|
|
152
153
|
* Nodes appearing in only one list get rank = Infinity for the other → only 1/(k+rank) from one source.
|
|
153
154
|
*/
|
|
154
|
-
function rrfFuse(vectorScores, bm25Scores, k =
|
|
155
|
+
function rrfFuse(vectorScores, bm25Scores, k = defaults_1.RRF_K) {
|
|
155
156
|
// Build ranked lists (sorted desc by score, rank starts at 1)
|
|
156
157
|
const vectorRank = buildRankMap(vectorScores);
|
|
157
158
|
const bm25Rank = buildRankMap(bm25Scores);
|
package/dist/lib/search/code.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchCode = searchCode;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
5
|
const bm25_1 = require("../../lib/search/bm25");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
/**
|
|
7
8
|
* Semantic search over the code graph.
|
|
8
9
|
*
|
|
@@ -12,7 +13,7 @@ const bm25_1 = require("../../lib/search/bm25");
|
|
|
12
13
|
* 4. De-duplicate, re-filter, sort, cap at `maxResults`.
|
|
13
14
|
*/
|
|
14
15
|
function searchCode(graph, queryEmbedding, options = {}) {
|
|
15
|
-
const { topK =
|
|
16
|
+
const { topK = defaults_1.SEARCH_TOP_K, bfsDepth = defaults_1.SEARCH_BFS_DEPTH, maxResults = defaults_1.SEARCH_MAX_RESULTS, minScore = defaults_1.SEARCH_MIN_SCORE_CODE, bfsDecay = defaults_1.SEARCH_BFS_DECAY, includeBody = false, queryText, bm25Index, searchMode = 'hybrid', rrfK = defaults_1.RRF_K } = options;
|
|
16
17
|
const useVector = searchMode !== 'keyword';
|
|
17
18
|
const useBm25 = searchMode !== 'vector' && !!queryText && !!bm25Index;
|
|
18
19
|
// --- 1. Score all nodes ---
|
package/dist/lib/search/docs.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.search = search;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
5
|
const bm25_1 = require("../../lib/search/bm25");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
/**
|
|
7
8
|
* Semantic search over the graph.
|
|
8
9
|
*
|
|
@@ -15,7 +16,7 @@ const bm25_1 = require("../../lib/search/bm25");
|
|
|
15
16
|
* 5. De-duplicate and return results sorted by score, capped at `maxResults`.
|
|
16
17
|
*/
|
|
17
18
|
function search(graph, queryEmbedding, options = {}) {
|
|
18
|
-
const { topK =
|
|
19
|
+
const { topK = defaults_1.SEARCH_TOP_K, bfsDepth = defaults_1.SEARCH_BFS_DEPTH, maxResults = defaults_1.SEARCH_MAX_RESULTS, minScore = defaults_1.SEARCH_MIN_SCORE, bfsDecay = defaults_1.SEARCH_BFS_DECAY, queryText, bm25Index, searchMode = 'hybrid', rrfK = defaults_1.RRF_K } = options;
|
|
19
20
|
const useVector = searchMode !== 'keyword';
|
|
20
21
|
const useBm25 = searchMode !== 'vector' && !!queryText && !!bm25Index;
|
|
21
22
|
// --- 1. Score all nodes ---
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.searchFileIndex = searchFileIndex;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
|
+
const defaults_1 = require("../../lib/defaults");
|
|
5
6
|
/**
|
|
6
7
|
* Semantic search over file nodes by path embedding.
|
|
7
8
|
* Only searches file nodes (directories have empty embeddings).
|
|
8
9
|
* Pure cosine similarity, no BFS expansion.
|
|
9
10
|
*/
|
|
10
11
|
function searchFileIndex(graph, queryEmbedding, options = {}) {
|
|
11
|
-
const { topK =
|
|
12
|
+
const { topK = defaults_1.FILE_SEARCH_TOP_K, minScore = defaults_1.SEARCH_MIN_SCORE_FILES } = options;
|
|
12
13
|
const scored = [];
|
|
13
14
|
graph.forEachNode((_, attrs) => {
|
|
14
15
|
if (attrs.kind !== 'file' || attrs.embedding.length === 0)
|
package/dist/lib/search/files.js
CHANGED
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchDocFiles = searchDocFiles;
|
|
4
4
|
exports.searchCodeFiles = searchCodeFiles;
|
|
5
5
|
const embedder_1 = require("../../lib/embedder");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
function searchDocFiles(graph, queryEmbedding, options = {}) {
|
|
7
|
-
const { topK =
|
|
8
|
+
const { topK = defaults_1.FILE_SEARCH_TOP_K, minScore = defaults_1.SEARCH_MIN_SCORE_FILES } = options;
|
|
8
9
|
// Collect root chunks (level=1) that have a fileEmbedding
|
|
9
10
|
const scored = [];
|
|
10
11
|
graph.forEachNode((_, attrs) => {
|
|
@@ -33,7 +34,7 @@ function searchDocFiles(graph, queryEmbedding, options = {}) {
|
|
|
33
34
|
}));
|
|
34
35
|
}
|
|
35
36
|
function searchCodeFiles(graph, queryEmbedding, options = {}) {
|
|
36
|
-
const { topK =
|
|
37
|
+
const { topK = defaults_1.FILE_SEARCH_TOP_K, minScore = defaults_1.SEARCH_MIN_SCORE_FILES } = options;
|
|
37
38
|
// Collect file nodes that have a fileEmbedding
|
|
38
39
|
const scored = [];
|
|
39
40
|
graph.forEachNode((_, attrs) => {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchKnowledge = searchKnowledge;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
5
|
const bm25_1 = require("../../lib/search/bm25");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
/**
|
|
7
8
|
* Semantic search over the knowledge graph.
|
|
8
9
|
*
|
|
@@ -12,7 +13,7 @@ const bm25_1 = require("../../lib/search/bm25");
|
|
|
12
13
|
* 4. De-duplicate, re-filter, sort, cap at `maxResults`.
|
|
13
14
|
*/
|
|
14
15
|
function searchKnowledge(graph, queryEmbedding, options = {}) {
|
|
15
|
-
const { topK =
|
|
16
|
+
const { topK = defaults_1.SEARCH_TOP_K, bfsDepth = defaults_1.SEARCH_BFS_DEPTH, maxResults = defaults_1.SEARCH_MAX_RESULTS, minScore = defaults_1.SEARCH_MIN_SCORE, bfsDecay = defaults_1.SEARCH_BFS_DECAY, queryText, bm25Index, searchMode = 'hybrid', rrfK = defaults_1.RRF_K } = options;
|
|
16
17
|
const useVector = searchMode !== 'keyword';
|
|
17
18
|
const useBm25 = searchMode !== 'vector' && !!queryText && !!bm25Index;
|
|
18
19
|
// --- 1. Score all nodes (skip proxy nodes) ---
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchSkills = searchSkills;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
5
|
const bm25_1 = require("../../lib/search/bm25");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
/**
|
|
7
8
|
* Semantic search over the skill graph.
|
|
8
9
|
*
|
|
@@ -12,7 +13,7 @@ const bm25_1 = require("../../lib/search/bm25");
|
|
|
12
13
|
* 4. De-duplicate, re-filter, sort, cap at `maxResults`.
|
|
13
14
|
*/
|
|
14
15
|
function searchSkills(graph, queryEmbedding, options = {}) {
|
|
15
|
-
const { topK =
|
|
16
|
+
const { topK = defaults_1.SEARCH_TOP_K, bfsDepth = defaults_1.SEARCH_BFS_DEPTH, maxResults = defaults_1.SEARCH_MAX_RESULTS, minScore = defaults_1.SEARCH_MIN_SCORE, bfsDecay = defaults_1.SEARCH_BFS_DECAY, queryText, bm25Index, searchMode = 'hybrid', rrfK = defaults_1.RRF_K } = options;
|
|
16
17
|
const useVector = searchMode !== 'keyword';
|
|
17
18
|
const useBm25 = searchMode !== 'vector' && !!queryText && !!bm25Index;
|
|
18
19
|
// --- 1. Score all nodes (skip proxy nodes) ---
|
package/dist/lib/search/tasks.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchTasks = searchTasks;
|
|
4
4
|
const embedder_1 = require("../../lib/embedder");
|
|
5
5
|
const bm25_1 = require("../../lib/search/bm25");
|
|
6
|
+
const defaults_1 = require("../../lib/defaults");
|
|
6
7
|
/**
|
|
7
8
|
* Semantic search over the task graph.
|
|
8
9
|
*
|
|
@@ -12,7 +13,7 @@ const bm25_1 = require("../../lib/search/bm25");
|
|
|
12
13
|
* 4. De-duplicate, re-filter, sort, cap at `maxResults`.
|
|
13
14
|
*/
|
|
14
15
|
function searchTasks(graph, queryEmbedding, options = {}) {
|
|
15
|
-
const { topK =
|
|
16
|
+
const { topK = defaults_1.SEARCH_TOP_K, bfsDepth = defaults_1.SEARCH_BFS_DEPTH, maxResults = defaults_1.SEARCH_MAX_RESULTS, minScore = defaults_1.SEARCH_MIN_SCORE, bfsDecay = defaults_1.SEARCH_BFS_DECAY, queryText, bm25Index, searchMode = 'hybrid', rrfK = defaults_1.RRF_K } = options;
|
|
16
17
|
const useVector = searchMode !== 'keyword';
|
|
17
18
|
const useBm25 = searchMode !== 'vector' && !!queryText && !!bm25Index;
|
|
18
19
|
// --- 1. Score all nodes (skip proxy nodes) ---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{Y as r,nt as i,q as a,r as o}from"./vendor-mui-BPj7d3Sw.js";import{D as s,E as c,I as l,O as u,P as d,S as f}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{Y as r,nt as i,q as a,r as o}from"./vendor-mui-BPj7d3Sw.js";import{D as s,E as c,I as l,O as u,P as d,S as f}from"./index-CEweXD9O.js";var p=e(n(),1),m=t();function h({note:e,onSubmit:t,onCancel:n,submitLabel:h=`Save`}){let[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)([]),[S,C]=(0,p.useState)(!1),[w,T]=(0,p.useState)(!1);(0,p.useEffect)(()=>{e&&(_(e.title),y(e.content),x(e.tags??[]))},[e]);let E=async()=>{if(!g.trim()){T(!0);return}C(!0);try{await t({title:g.trim(),content:v.trim(),tags:b})}finally{C(!1)}};return(0,m.jsxs)(r,{component:`form`,id:`note-form`,onSubmit:e=>{e.preventDefault(),E()},sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,m.jsx)(l,{title:`Details`,children:(0,m.jsxs)(u,{children:[(0,m.jsxs)(s,{fullWidth:!0,children:[(0,m.jsx)(c,{required:!0,children:`Title`}),(0,m.jsx)(o,{autoFocus:!0,fullWidth:!0,value:g,onChange:e=>{_(e.target.value),T(!1)},error:w,helperText:w?`Title is required`:void 0})]}),(0,m.jsxs)(s,{fullWidth:!0,children:[(0,m.jsx)(c,{children:`Content`}),(0,m.jsx)(f,{value:v,onChange:y,height:300})]}),(0,m.jsx)(s,{fullWidth:!0,children:(0,m.jsx)(d,{tags:b,editable:!0,onAdd:e=>x(t=>t.includes(e)?t:[...t,e]),onRemove:e=>x(t=>t.filter(t=>t!==e))})})]})}),(0,m.jsxs)(r,{sx:{display:`flex`,gap:1,justifyContent:`flex-end`},children:[(0,m.jsx)(a,{onClick:n,children:`Cancel`}),(0,m.jsx)(a,{variant:`contained`,onClick:E,disabled:S||!g.trim(),children:S?(0,m.jsx)(i,{size:20}):h})]})]})}export{h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{$ as r,Y as i,_ as a,nt as o,q as s,r as c,tt as l,v as u,y as d}from"./vendor-mui-BPj7d3Sw.js";import{K as f,i as p}from"./vendor-mui-icons-B196sG3f.js";import{D as m,E as h,I as g,O as _,P as v,S as y}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{$ as r,Y as i,_ as a,nt as o,q as s,r as c,tt as l,v as u,y as d}from"./vendor-mui-BPj7d3Sw.js";import{K as f,i as p}from"./vendor-mui-icons-B196sG3f.js";import{D as m,E as h,I as g,O as _,P as v,S as y}from"./index-CEweXD9O.js";var b=e(n(),1),x=t();function S({skill:e,onSubmit:t,onCancel:n,submitLabel:S=`Save`}){let[C,w]=(0,b.useState)(``),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)([``]),[k,A]=(0,b.useState)([]),[j,M]=(0,b.useState)([]),[N,P]=(0,b.useState)([]),[F,I]=(0,b.useState)([]),[L,R]=(0,b.useState)(`user`),[z,B]=(0,b.useState)(1),[V,H]=(0,b.useState)(!1),[U,W]=(0,b.useState)(!1);(0,b.useEffect)(()=>{e&&(w(e.title),E(e.description),O(e.steps.length>0?e.steps:[``]),A(e.triggers??[]),M(e.inputHints??[]),P(e.filePatterns??[]),I(e.tags??[]),R(e.source),B(e.confidence))},[e]);let G=async()=>{if(!C.trim()){W(!0);return}H(!0);try{await t({title:C.trim(),description:T.trim(),steps:D.map(e=>e.trim()).filter(Boolean),triggers:k,inputHints:j,filePatterns:N,tags:F,source:L,confidence:z})}finally{H(!1)}},K=(e,t)=>{O(n=>n.map((n,r)=>r===e?t:n))},q=()=>{O(e=>[...e,``])},J=e=>{O(t=>t.filter((t,n)=>n!==e))};return(0,x.jsxs)(i,{component:`form`,id:`skill-form`,onSubmit:e=>{e.preventDefault(),G()},sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,x.jsx)(g,{title:`Details`,children:(0,x.jsxs)(_,{children:[(0,x.jsxs)(m,{fullWidth:!0,children:[(0,x.jsx)(h,{required:!0,children:`Title`}),(0,x.jsx)(c,{autoFocus:!0,fullWidth:!0,value:C,onChange:e=>{w(e.target.value),W(!1)},error:U,helperText:U?`Title is required`:void 0})]}),(0,x.jsxs)(m,{fullWidth:!0,children:[(0,x.jsx)(h,{children:`Description`}),(0,x.jsx)(y,{value:T,onChange:E,height:200})]})]})}),(0,x.jsx)(g,{title:`Steps`,children:(0,x.jsxs)(i,{sx:{display:`flex`,flexDirection:`column`,gap:1},children:[D.map((e,t)=>(0,x.jsxs)(i,{sx:{display:`flex`,gap:1,alignItems:`center`},children:[(0,x.jsxs)(r,{variant:`body2`,sx:{minWidth:24,color:`text.secondary`},children:[t+1,`.`]}),(0,x.jsx)(c,{fullWidth:!0,size:`small`,value:e,onChange:e=>K(t,e.target.value),placeholder:`Step ${t+1}`}),D.length>1&&(0,x.jsx)(l,{size:`small`,onClick:()=>J(t),color:`error`,children:(0,x.jsx)(p,{fontSize:`small`})})]},t)),(0,x.jsx)(s,{size:`small`,startIcon:(0,x.jsx)(f,{}),onClick:q,sx:{alignSelf:`flex-start`},children:`Add Step`})]})}),(0,x.jsx)(g,{title:`Matching`,children:(0,x.jsxs)(_,{children:[(0,x.jsxs)(m,{fullWidth:!0,children:[(0,x.jsx)(h,{children:`Triggers`}),(0,x.jsx)(v,{tags:k,editable:!0,onAdd:e=>A(t=>t.includes(e)?t:[...t,e]),onRemove:e=>A(t=>t.filter(t=>t!==e))})]}),(0,x.jsxs)(m,{fullWidth:!0,children:[(0,x.jsx)(h,{children:`Input Hints`}),(0,x.jsx)(v,{tags:j,editable:!0,onAdd:e=>M(t=>t.includes(e)?t:[...t,e]),onRemove:e=>M(t=>t.filter(t=>t!==e))})]}),(0,x.jsxs)(m,{fullWidth:!0,children:[(0,x.jsx)(h,{children:`File Patterns`}),(0,x.jsx)(v,{tags:N,editable:!0,onAdd:e=>P(t=>t.includes(e)?t:[...t,e]),onRemove:e=>P(t=>t.filter(t=>t!==e))})]})]})}),(0,x.jsx)(g,{title:`Properties`,children:(0,x.jsxs)(_,{children:[(0,x.jsxs)(m,{children:[(0,x.jsx)(h,{children:`Source`}),(0,x.jsxs)(u,{fullWidth:!0,value:L,onChange:e=>R(e.target.value),children:[(0,x.jsx)(d,{value:`user`,children:`User`}),(0,x.jsx)(d,{value:`learned`,children:`Learned`})]})]}),(0,x.jsx)(m,{children:(0,x.jsxs)(i,{sx:{px:1},children:[(0,x.jsxs)(h,{children:[`Confidence: `,Math.round(z*100),`%`]}),(0,x.jsx)(a,{value:z,onChange:(e,t)=>B(t),min:0,max:1,step:.01,valueLabelDisplay:`auto`,valueLabelFormat:e=>`${Math.round(e*100)}%`})]})}),(0,x.jsx)(m,{fullWidth:!0,children:(0,x.jsx)(v,{tags:F,editable:!0,onAdd:e=>I(t=>t.includes(e)?t:[...t,e]),onRemove:e=>I(t=>t.filter(t=>t!==e))})})]})}),(0,x.jsxs)(i,{sx:{display:`flex`,gap:1,justifyContent:`flex-end`},children:[(0,x.jsx)(s,{onClick:n,children:`Cancel`}),(0,x.jsx)(s,{variant:`contained`,onClick:G,disabled:V||!C.trim(),children:V?(0,x.jsx)(o,{size:20}):S})]})]})}export{S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{l as r}from"./vendor-react-CHUjhoxh.js";import{Y as i,nt as a,q as o,r as s,v as c,y as l}from"./vendor-mui-BPj7d3Sw.js";import{D as u,E as d,I as f,O as p,P as m,S as h,et as g,t as _}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{l as r}from"./vendor-react-CHUjhoxh.js";import{Y as i,nt as a,q as o,r as s,v as c,y as l}from"./vendor-mui-BPj7d3Sw.js";import{D as u,E as d,I as f,O as p,P as m,S as h,et as g,t as _}from"./index-CEweXD9O.js";var v=e(n(),1),y=t();function b({task:e,onSubmit:t,onCancel:n,submitLabel:b=`Save`}){let{projectId:x}=r(),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(`todo`),[O,k]=(0,v.useState)(`medium`),[A,j]=(0,v.useState)([]),[M,N]=(0,v.useState)(``),[P,F]=(0,v.useState)(``),[I,L]=(0,v.useState)(``),[R,z]=(0,v.useState)([]),[B,V]=(0,v.useState)(!1),[H,U]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e&&(C(e.title),T(e.description),D(e.status),k(e.priority),j(e.tags??[]),N(e.dueDate?new Date(e.dueDate).toISOString().split(`T`)[0]:``),F(e.estimate==null?``:String(e.estimate)),L(e.assignee??``))},[e]),(0,v.useEffect)(()=>{x&&g(x).then(z).catch(()=>{})},[x]);let W=async()=>{if(!S.trim()){U(!0);return}V(!0);try{await t({title:S.trim(),description:w.trim(),status:E,priority:O,tags:A,dueDate:M?new Date(M).getTime():null,estimate:P?Number(P):null,assignee:I||null})}finally{V(!1)}};return(0,y.jsxs)(i,{component:`form`,id:`task-form`,onSubmit:e=>{e.preventDefault(),W()},sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,y.jsx)(f,{title:`Details`,children:(0,y.jsxs)(p,{children:[(0,y.jsxs)(u,{fullWidth:!0,children:[(0,y.jsx)(d,{required:!0,children:`Title`}),(0,y.jsx)(s,{autoFocus:!0,fullWidth:!0,value:S,onChange:e=>{C(e.target.value),U(!1)},error:H,helperText:H?`Title is required`:void 0})]}),(0,y.jsxs)(u,{fullWidth:!0,children:[(0,y.jsx)(d,{children:`Description`}),(0,y.jsx)(h,{value:w,onChange:T,height:250})]})]})}),(0,y.jsx)(f,{title:`Properties`,children:(0,y.jsxs)(p,{children:[(0,y.jsxs)(u,{children:[(0,y.jsx)(d,{children:`Status`}),(0,y.jsx)(c,{fullWidth:!0,value:E,onChange:e=>D(e.target.value),children:_.map(e=>(0,y.jsx)(l,{value:e.status,children:e.label},e.status))})]}),(0,y.jsxs)(u,{children:[(0,y.jsx)(d,{children:`Priority`}),(0,y.jsxs)(c,{fullWidth:!0,value:O,onChange:e=>k(e.target.value),children:[(0,y.jsx)(l,{value:`critical`,children:`Critical`}),(0,y.jsx)(l,{value:`high`,children:`High`}),(0,y.jsx)(l,{value:`medium`,children:`Medium`}),(0,y.jsx)(l,{value:`low`,children:`Low`})]})]}),(0,y.jsxs)(u,{children:[(0,y.jsx)(d,{children:`Due Date`}),(0,y.jsx)(s,{fullWidth:!0,type:`date`,value:M,onChange:e=>N(e.target.value)})]}),(0,y.jsxs)(u,{children:[(0,y.jsx)(d,{children:`Estimate (hours)`}),(0,y.jsx)(s,{fullWidth:!0,type:`number`,value:P,onChange:e=>F(e.target.value),slotProps:{input:{inputProps:{min:0,step:.5}}}})]}),(0,y.jsxs)(u,{children:[(0,y.jsx)(d,{children:`Assignee`}),(0,y.jsxs)(c,{fullWidth:!0,value:I,onChange:e=>L(e.target.value),displayEmpty:!0,renderValue:e=>e?R.find(t=>t.id===e)?.name||e:`Unassigned`,children:[(0,y.jsx)(l,{value:``,children:`Unassigned`}),R.map(e=>(0,y.jsx)(l,{value:e.id,children:e.name||e.id},e.id))]})]}),(0,y.jsx)(u,{fullWidth:!0,children:(0,y.jsx)(m,{tags:A,editable:!0,onAdd:e=>j(t=>t.includes(e)?t:[...t,e]),onRemove:e=>j(t=>t.filter(t=>t!==e))})})]})}),(0,y.jsxs)(i,{sx:{display:`flex`,gap:1,justifyContent:`flex-end`},children:[(0,y.jsx)(o,{onClick:n,children:`Cancel`}),(0,y.jsx)(o,{variant:`contained`,onClick:W,disabled:B||!S.trim(),children:B?(0,y.jsx)(a,{size:20}):b})]})]})}export{b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e}from"./vendor-markdown-CT8ZVEPu.js";import{c as t,l as n}from"./vendor-react-CHUjhoxh.js";import{$ as r,X as i,Y as a,ut as o}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{nt as s,tt as c}from"./vendor-mui-icons-B196sG3f.js";import{C as l,F as u,I as d,T as f,j as p}from"./index-
|
|
1
|
+
import{D as e}from"./vendor-markdown-CT8ZVEPu.js";import{c as t,l as n}from"./vendor-react-CHUjhoxh.js";import{$ as r,X as i,Y as a,ut as o}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{nt as s,tt as c}from"./vendor-mui-icons-B196sG3f.js";import{C as l,F as u,I as d,T as f,j as p}from"./index-CEweXD9O.js";import{t as m}from"./help-D6XKMuzk.js";var h=e(),g={overview:`primary`,concept:`warning`,guide:`success`};function _(){let{projectId:e,articleId:_}=n(),v=t(),{palette:y}=o(),b=_?m(_):void 0;return b?(0,h.jsxs)(a,{children:[(0,h.jsx)(p,{breadcrumbs:[{label:`Help`,to:`/${e}/help`},{label:b.title}]}),(0,h.jsxs)(a,{sx:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,h.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1.5,mb:1},children:[(0,h.jsx)(u,{label:b.category===`overview`?`Overview`:b.category===`concept`?`Concept`:`Guide`,color:g[b.category]||`primary`}),(0,h.jsx)(r,{variant:`body2`,sx:{color:y.custom.textMuted},children:b.summary})]}),(0,h.jsx)(d,{title:`Article`,children:(0,h.jsx)(l,{children:b.content})}),b.relatedTools.length>0&&(0,h.jsx)(d,{title:`Related Tools`,children:(0,h.jsx)(a,{sx:{display:`flex`,flexWrap:`wrap`,gap:1},children:b.relatedTools.map(t=>(0,h.jsx)(i,{icon:(0,h.jsx)(s,{}),label:t,size:`small`,variant:`outlined`,clickable:!0,onClick:()=>v(`/${e}/tools/${t}`),sx:{fontFamily:`monospace`}},t))})})]})]}):(0,h.jsxs)(a,{children:[(0,h.jsx)(p,{breadcrumbs:[{label:`Help`,to:`/${e}/help`},{label:`Not Found`}]}),(0,h.jsx)(f,{icon:(0,h.jsx)(c,{}),title:`Article not found`})]})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,D as o,E as s,O as c,S as l,Y as u,et as d,nt as f,ut as p}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{I as m,N as h,P as g,j as _,k as v}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,D as o,E as s,O as c,S as l,Y as u,et as d,nt as f,ut as p}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{I as m,N as h,P as g,j as _,k as v}from"./index-CEweXD9O.js";import{n as y,t as b}from"./api-BlFF6gX-.js";var x=e(n(),1),S=t();function C(){let{projectId:e,docId:t}=i(),n=r(),{palette:C}=p(),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)([]),[O,k]=(0,x.useState)(!0),[A,j]=(0,x.useState)(null);if((0,x.useEffect)(()=>{if(!e||!t)return;k(!0);let n=decodeURIComponent(t);Promise.all([b(e,n),b(e,n).then(t=>y(e,t.fileId).catch(()=>[]))]).then(([e,t])=>{T(e),D(t),j(null)}).catch(e=>j(e instanceof Error?e.message:String(e))).finally(()=>k(!1))},[e,t]),O)return(0,S.jsx)(u,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,S.jsx)(f,{})});if(A||!w)return(0,S.jsx)(d,{severity:`error`,children:A||`Doc node not found`});let M=decodeURIComponent(t);return(0,S.jsxs)(u,{children:[(0,S.jsx)(_,{breadcrumbs:[{label:`Docs`,to:`/${e}/docs`},{label:w.title||w.id}]}),(0,S.jsxs)(m,{title:`Details`,sx:{mb:3},children:[(0,S.jsx)(v,{label:`ID`,children:(0,S.jsxs)(u,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,S.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:w.id}),(0,S.jsx)(h,{value:w.id})]})}),(0,S.jsx)(v,{label:`File`,children:(0,S.jsx)(c,{component:`button`,variant:`body2`,onClick:()=>n(`/${e}/docs`),children:w.fileId})}),(0,S.jsx)(v,{label:`Level`,children:(0,S.jsx)(a,{variant:`body2`,children:w.level})}),w.language&&(0,S.jsx)(v,{label:`Language`,children:(0,S.jsx)(a,{variant:`body2`,children:w.language})}),w.symbols&&w.symbols.length>0&&(0,S.jsx)(v,{label:`Symbols`,divider:!1,children:(0,S.jsx)(g,{tags:w.symbols})})]}),w.content&&(0,S.jsx)(m,{title:`Content`,sx:{mb:3},children:(0,S.jsx)(a,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,fontFamily:w.language?`monospace`:`inherit`,fontSize:w.language?`0.85rem`:void 0},children:w.content})}),E.length>1&&(0,S.jsx)(m,{title:`In this file`,children:(0,S.jsx)(o,{dense:!0,disablePadding:!0,children:E.map(t=>(0,S.jsx)(s,{selected:t.id===M,onClick:()=>n(`/${e}/docs/${encodeURIComponent(t.id)}`),sx:{borderRadius:1,py:.25,...t.id===M&&{bgcolor:`${C.primary.main}14`}},children:(0,S.jsx)(l,{primary:(0,S.jsx)(a,{variant:`body2`,sx:{pl:(t.level-1)*2},fontWeight:t.id===M?700:400,children:t.title||t.id})})},t.id))})})]})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,O as o,Y as s,et as c,m as l,nt as u,ut as d}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{F as f,H as p,I as m,N as h,a as g,d as _,j as v,k as y,r as b}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,O as o,Y as s,et as c,m as l,nt as u,ut as d}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{F as f,H as p,I as m,N as h,a as g,d as _,j as v,k as y,r as b}from"./index-CEweXD9O.js";import{t as x}from"./api-BMnBjMMf.js";var S=e(n(),1),C=t();function w(e){return e==null?`—`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function T(){let{projectId:e,"*":t}=i(),n=r(),{palette:T}=d(),[E,D]=(0,S.useState)(null),[O,k]=(0,S.useState)([]),[A,j]=(0,S.useState)([]),[M,N]=(0,S.useState)(!0),[P,F]=(0,S.useState)(null);if((0,S.useEffect)(()=>{!e||!t||(N(!0),Promise.all([x(e,t),p(e,`files`,t).catch(()=>[]),_(e,`files`,t).catch(()=>[])]).then(([e,t,n])=>{D(e),k(t),j(n),F(null)}).catch(e=>F(e instanceof Error?e.message:String(e))).finally(()=>N(!1)))},[e,t]),M)return(0,C.jsx)(s,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,C.jsx)(u,{})});if(P||!E)return(0,C.jsx)(c,{severity:`error`,children:P||`File not found`});let I=t.split(`/`).slice(0,-1).join(`/`)||`.`;return(0,C.jsxs)(s,{children:[(0,C.jsx)(v,{breadcrumbs:[{label:`Files`,to:`/${e}/files`},{label:E.fileName}]}),(0,C.jsxs)(m,{title:`Metadata`,sx:{mb:3},children:[(0,C.jsx)(y,{label:`Path`,children:(0,C.jsxs)(s,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,C.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:E.filePath}),(0,C.jsx)(h,{value:E.filePath})]})}),(0,C.jsx)(y,{label:`Size`,children:(0,C.jsx)(a,{variant:`body2`,children:w(E.size)})}),E.language&&(0,C.jsx)(y,{label:`Language`,children:(0,C.jsx)(a,{variant:`body2`,children:E.language})}),E.mimeType&&(0,C.jsx)(y,{label:`MIME Type`,children:(0,C.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:E.mimeType})}),E.extension&&(0,C.jsx)(y,{label:`Extension`,children:(0,C.jsx)(a,{variant:`body2`,children:E.extension})}),(0,C.jsx)(y,{label:`Directory`,divider:!1,children:(0,C.jsx)(o,{component:`button`,variant:`body2`,onClick:()=>n(`/${e}/files?dir=${I}`),children:I})})]}),(0,C.jsx)(m,{title:`Linked Notes`,sx:{mb:3},children:O.length===0?(0,C.jsx)(a,{variant:`body2`,sx:{color:T.custom.textMuted},children:`No linked notes`}):(0,C.jsx)(l,{spacing:.5,children:O.map(t=>(0,C.jsxs)(s,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,C.jsx)(f,{label:t.kind,color:`neutral`,size:`small`}),(0,C.jsx)(o,{component:`button`,variant:`body2`,onClick:()=>n(`/${e}/knowledge/${t.noteId}`),children:t.title})]},t.noteId))})}),(0,C.jsx)(m,{title:`Linked Tasks`,children:A.length===0?(0,C.jsx)(a,{variant:`body2`,sx:{color:T.custom.textMuted},children:`No linked tasks`}):(0,C.jsx)(l,{spacing:.5,children:A.map(t=>(0,C.jsxs)(s,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,C.jsx)(f,{label:g(t.status),color:b[t.status]??`neutral`,size:`small`}),(0,C.jsx)(o,{component:`button`,variant:`body2`,onClick:()=>n(`/${e}/tasks/${t.taskId}`),children:t.title})]},t.taskId))})})]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,Y as o,et as s,nt as c,q as l}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as u,W as d}from"./vendor-mui-icons-B196sG3f.js";import{B as f,C as p,I as m,K as h,M as g,N as _,P as v,Q as y,U as b,W as x,X as S,Z as C,j as w,k as T,q as E,w as D,z as O}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,Y as o,et as s,nt as c,q as l}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as u,W as d}from"./vendor-mui-icons-B196sG3f.js";import{B as f,C as p,I as m,K as h,M as g,N as _,P as v,Q as y,U as b,W as x,X as S,Z as C,j as w,k as T,q as E,w as D,z as O}from"./index-CEweXD9O.js";import"./skill-BltAsz7M.js";import{n as k,t as A}from"./attachments-NSvN5_0A.js";var j=e(n(),1),M=t();function N(){let{projectId:e,noteId:t}=i(),n=r(),N=C(`knowledge`),[P,F]=(0,j.useState)(null),[I,L]=(0,j.useState)([]),[R,z]=(0,j.useState)([]),[B,V]=(0,j.useState)(!0),[H,U]=(0,j.useState)(null),[W,G]=(0,j.useState)(!1),K=(0,j.useCallback)(async()=>{if(!(!e||!t))try{let[n,r,i]=await Promise.all([b(e,t),h(e,t),x(e,t)]);F(n),L(r),z(i),U(null)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}},[e,t]);return(0,j.useEffect)(()=>{K()},[K]),y(e??null,(0,j.useCallback)(e=>{e.type.startsWith(`note:`)&&K()},[K])),B?(0,M.jsx)(o,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,M.jsx)(c,{})}):H||!P?(0,M.jsx)(s,{severity:`error`,children:H||`Note not found`}):(0,M.jsxs)(o,{children:[(0,M.jsx)(w,{breadcrumbs:[{label:`Knowledge`,to:`/${e}/knowledge`},{label:P.title}],actions:N?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(l,{variant:`contained`,color:`success`,startIcon:(0,M.jsx)(d,{}),onClick:()=>n(`/${e}/knowledge/${t}/edit`),children:`Edit`}),(0,M.jsx)(l,{color:`error`,startIcon:(0,M.jsx)(u,{}),onClick:()=>G(!0),children:`Delete`})]}):void 0}),(0,M.jsxs)(m,{title:`Details`,sx:{mb:3},children:[(0,M.jsx)(T,{label:`ID`,children:(0,M.jsxs)(o,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,M.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:P.id}),(0,M.jsx)(_,{value:P.id})]})}),(0,M.jsx)(T,{label:`Version`,children:(0,M.jsxs)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:[`v`,P.version]})}),(0,M.jsx)(T,{label:`Tags`,children:P.tags.length>0?(0,M.jsx)(v,{tags:P.tags}):(0,M.jsx)(a,{variant:`body2`,color:`text.secondary`,children:`—`})}),P.createdBy&&(0,M.jsx)(T,{label:`Created by`,children:(0,M.jsx)(a,{variant:`body2`,children:P.createdBy})}),P.updatedBy&&P.updatedBy!==P.createdBy&&(0,M.jsx)(T,{label:`Updated by`,children:(0,M.jsx)(a,{variant:`body2`,children:P.updatedBy})}),(0,M.jsx)(T,{label:`Created`,children:(0,M.jsx)(g,{value:P.createdAt,showTime:!0,showRelative:!0})}),(0,M.jsx)(T,{label:`Updated`,divider:!P.content,children:(0,M.jsx)(g,{value:P.updatedAt,showTime:!0,showRelative:!0})}),P.content&&(0,M.jsx)(T,{label:`Content`,divider:!1,children:(0,M.jsx)(p,{children:P.content})})]}),(0,M.jsx)(m,{title:`Attachments`,sx:{mb:3},children:(0,M.jsx)(A,{attachments:R,getUrl:n=>E(e,t,n),onUpload:async n=>{await S(e,t,n),z(await x(e,t))},onDelete:async n=>{await f(e,t,n),z(await x(e,t))},readOnly:!N})}),(0,M.jsx)(m,{title:`Relations`,children:(0,M.jsx)(k,{projectId:e,entityId:t,entityType:`knowledge`,relations:I,onRefresh:K})}),(0,M.jsx)(D,{open:W,title:`Delete Note`,message:`Are you sure you want to delete "${P.title}"? This cannot be undone.`,confirmLabel:`Delete`,confirmColor:`error`,onConfirm:async()=>{!e||!t||(await O(e,t),n(`/${e}/knowledge`))},onCancel:()=>G(!1)})]})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,X as o,Y as s,et as c,nt as l,q as u}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as d,W as f}from"./vendor-mui-icons-B196sG3f.js";import{C as p,F as m,I as h,N as g,P as _,Q as v,Z as y,j as b,k as x,w as S}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,X as o,Y as s,et as c,nt as l,q as u}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as d,W as f}from"./vendor-mui-icons-B196sG3f.js";import{C as p,F as m,I as h,N as g,P as _,Q as v,Z as y,j as b,k as x,w as S}from"./index-CEweXD9O.js";import{_ as C,c as w,d as T,f as E,h as D,i as O,n as k,r as A,s as j,u as M}from"./skill-BltAsz7M.js";import{n as N,t as P}from"./attachments-NSvN5_0A.js";var F=e(n(),1),I=t();function L(){let{projectId:e,skillId:t}=i(),n=r(),L=y(`skills`),[R,z]=(0,F.useState)(null),[B,V]=(0,F.useState)([]),[H,U]=(0,F.useState)([]),[W,G]=(0,F.useState)(!0),[K,q]=(0,F.useState)(null),[J,Y]=(0,F.useState)(!1),X=(0,F.useCallback)(async()=>{if(!(!e||!t))try{let[n,r,i]=await Promise.all([M(e,t),E(e,t),T(e,t)]);z(n),V(r),U(i),q(null)}catch(e){q(e instanceof Error?e.message:String(e))}finally{G(!1)}},[e,t]);return(0,F.useEffect)(()=>{X()},[X]),v(e??null,(0,F.useCallback)(e=>{e.type.startsWith(`skill:`)&&X()},[X])),W?(0,I.jsx)(s,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,I.jsx)(l,{})}):K||!R?(0,I.jsx)(c,{severity:`error`,children:K||`Skill not found`}):(0,I.jsxs)(s,{children:[(0,I.jsx)(b,{breadcrumbs:[{label:`Skills`,to:`/${e}/skills`},{label:R.title}],actions:L?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u,{variant:`contained`,color:`success`,startIcon:(0,I.jsx)(f,{}),onClick:()=>n(`/${e}/skills/${t}/edit`),children:`Edit`}),(0,I.jsx)(u,{color:`error`,startIcon:(0,I.jsx)(d,{}),onClick:()=>Y(!0),children:`Delete`})]}):void 0}),(0,I.jsxs)(h,{title:`Details`,sx:{mb:3},children:[(0,I.jsx)(x,{label:`ID`,children:(0,I.jsxs)(s,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,I.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:R.id}),(0,I.jsx)(g,{value:R.id})]})}),(0,I.jsx)(x,{label:`Version`,children:(0,I.jsxs)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:[`v`,R.version]})}),(0,I.jsx)(x,{label:`Source`,children:(0,I.jsx)(m,{label:O(R.source),color:k[R.source]??`primary`})}),(0,I.jsx)(x,{label:`Confidence`,children:(0,I.jsx)(a,{variant:`body2`,children:A(R.confidence)})}),(0,I.jsx)(x,{label:`Usage Count`,children:(0,I.jsx)(a,{variant:`body2`,children:R.usageCount})}),R.lastUsedAt&&(0,I.jsx)(x,{label:`Last Used`,children:(0,I.jsx)(a,{variant:`body2`,children:new Date(R.lastUsedAt).toLocaleString()})}),R.createdBy&&(0,I.jsx)(x,{label:`Created by`,children:(0,I.jsx)(a,{variant:`body2`,children:R.createdBy})}),R.updatedBy&&R.updatedBy!==R.createdBy&&(0,I.jsx)(x,{label:`Updated by`,children:(0,I.jsx)(a,{variant:`body2`,children:R.updatedBy})}),(0,I.jsx)(x,{label:`Created`,children:(0,I.jsx)(a,{variant:`body2`,children:new Date(R.createdAt).toLocaleString()})}),(0,I.jsx)(x,{label:`Updated`,children:(0,I.jsx)(a,{variant:`body2`,children:new Date(R.updatedAt).toLocaleString()})}),(0,I.jsx)(x,{label:`Tags`,children:R.tags.length>0?(0,I.jsx)(_,{tags:R.tags}):(0,I.jsx)(a,{variant:`body2`,color:`text.secondary`,children:`—`})}),R.description&&(0,I.jsx)(x,{label:`Description`,divider:!1,children:(0,I.jsx)(p,{children:R.description})})]}),R.steps.length>0&&(0,I.jsx)(h,{title:`Steps`,sx:{mb:3},children:(0,I.jsx)(s,{component:`ol`,sx:{m:0,pl:2.5},children:R.steps.map((e,t)=>(0,I.jsx)(a,{component:`li`,variant:`body2`,sx:{mb:.5},children:e},t))})}),R.triggers.length>0&&(0,I.jsx)(h,{title:`Triggers`,sx:{mb:3},children:(0,I.jsx)(s,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:R.triggers.map((e,t)=>(0,I.jsx)(o,{label:e,size:`small`,variant:`outlined`},t))})}),R.inputHints.length>0&&(0,I.jsx)(h,{title:`Input Hints`,sx:{mb:3},children:(0,I.jsx)(s,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:R.inputHints.map((e,t)=>(0,I.jsx)(o,{label:e,size:`small`,variant:`outlined`},t))})}),R.filePatterns.length>0&&(0,I.jsx)(h,{title:`File Patterns`,sx:{mb:3},children:(0,I.jsx)(s,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:R.filePatterns.map((e,t)=>(0,I.jsx)(o,{label:e,size:`small`,variant:`outlined`,sx:{fontFamily:`monospace`}},t))})}),(0,I.jsx)(h,{title:`Attachments`,sx:{mb:3},children:(0,I.jsx)(P,{attachments:H,getUrl:n=>D(e,t,n),onUpload:async n=>{await C(e,t,n),U(await T(e,t))},onDelete:async n=>{await w(e,t,n),U(await T(e,t))},readOnly:!L})}),(0,I.jsx)(h,{title:`Relations`,children:(0,I.jsx)(N,{projectId:e,entityId:t,entityType:`skills`,relations:B,onRefresh:X})}),(0,I.jsx)(S,{open:J,title:`Delete Skill`,message:`Are you sure you want to delete "${R.title}"? This cannot be undone.`,confirmLabel:`Delete`,confirmColor:`error`,onConfirm:async()=>{!e||!t||(await j(e,t),n(`/${e}/skills`))},onCancel:()=>Y(!1)})]})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,O as o,P as s,Y as c,et as ee,k as te,m as l,nt as u,q as d,v as f,y as p}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as ne,W as m}from"./vendor-mui-icons-B196sG3f.js";import{C as h,F as g,I as _,M as v,N as re,P as ie,Q as ae,Z as oe,a as y,b,c as x,et as S,f as C,g as w,i as T,j as E,k as D,l as O,m as k,n as A,p as j,r as M,t as N,v as P,w as F}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{D as t,O as n}from"./vendor-markdown-CT8ZVEPu.js";import{c as r,l as i}from"./vendor-react-CHUjhoxh.js";import{$ as a,O as o,P as s,Y as c,et as ee,k as te,m as l,nt as u,q as d,v as f,y as p}from"./vendor-mui-BPj7d3Sw.js";import"./vendor-md-editor-DmWafJvr.js";import{M as ne,W as m}from"./vendor-mui-icons-B196sG3f.js";import{C as h,F as g,I as _,M as v,N as re,P as ie,Q as ae,Z as oe,a as y,b,c as x,et as S,f as C,g as w,i as T,j as E,k as D,l as O,m as k,n as A,p as j,r as M,t as N,v as P,w as F}from"./index-CEweXD9O.js";import"./skill-BltAsz7M.js";import{n as I,t as L}from"./attachments-NSvN5_0A.js";var R=e(n(),1),z=t();function B(){let{projectId:e,taskId:t}=i(),n=r(),B=oe(`tasks`),[V,H]=(0,R.useState)(null),[U,W]=(0,R.useState)([]),[G,K]=(0,R.useState)([]),[q,se]=(0,R.useState)([]),[ce,le]=(0,R.useState)(!0),[J,Y]=(0,R.useState)(null),[X,Z]=(0,R.useState)(!1),Q=(0,R.useCallback)(async()=>{if(!(!e||!t))try{let[n,r,i,a]=await Promise.all([C(e,t),k(e,t),j(e,t),S(e).catch(()=>[])]);H(n),W(r),K(i),se(a),Y(null)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{le(!1)}},[e,t]);(0,R.useEffect)(()=>{Q()},[Q]),ae(e??null,(0,R.useCallback)(e=>{e.type.startsWith(`task:`)&&Q()},[Q]));let ue=async()=>{!e||!t||(await x(e,t),n(`/${e}/tasks`))},de=async n=>{!e||!t||(await w(e,t,n),Q())};if(ce)return(0,z.jsx)(c,{sx:{display:`flex`,justifyContent:`center`,py:4},children:(0,z.jsx)(u,{})});if(J||!V)return(0,z.jsx)(ee,{severity:`error`,children:J||`Task not found`});let $=(t,r)=>!r||r.length===0?null:(0,z.jsx)(D,{label:t,children:(0,z.jsx)(l,{spacing:.5,children:r.map(t=>(0,z.jsxs)(c,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,z.jsx)(g,{label:y(t.status),color:M[t.status],size:`small`}),(0,z.jsx)(o,{component:`button`,variant:`body2`,onClick:()=>n(`/${e}/tasks/${t.id}`),children:t.title})]},t.id))})}),fe=!!(V.subtasks?.length||V.blockedBy?.length||V.blocks?.length||V.related?.length);return(0,z.jsxs)(c,{children:[(0,z.jsx)(E,{breadcrumbs:[{label:`Tasks`,to:`/${e}/tasks`},{label:V.title}],actions:B?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(d,{variant:`contained`,color:`success`,startIcon:(0,z.jsx)(m,{}),onClick:()=>n(`/${e}/tasks/${t}/edit`),children:`Edit`}),(0,z.jsx)(d,{color:`error`,startIcon:(0,z.jsx)(ne,{}),onClick:()=>Z(!0),children:`Delete`})]}):void 0}),(0,z.jsxs)(_,{title:`Properties`,sx:{mb:3},children:[(0,z.jsx)(D,{label:`ID`,children:(0,z.jsxs)(c,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,z.jsx)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:V.id}),(0,z.jsx)(re,{value:V.id})]})}),(0,z.jsx)(D,{label:`Version`,children:(0,z.jsxs)(a,{variant:`body2`,sx:{fontFamily:`monospace`},children:[`v`,V.version]})}),(0,z.jsx)(D,{label:`Status`,children:(0,z.jsxs)(c,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,z.jsx)(g,{label:y(V.status),color:M[V.status]}),B&&(0,z.jsxs)(s,{size:`small`,sx:{minWidth:140},children:[(0,z.jsx)(te,{children:`Move to`}),(0,z.jsx)(f,{value:``,label:`Move to`,onChange:e=>de(e.target.value),children:N.filter(e=>e.status!==V.status).map(e=>(0,z.jsx)(p,{value:e.status,children:e.label},e.status))})]})]})}),(0,z.jsx)(D,{label:`Priority`,children:(0,z.jsx)(g,{label:T(V.priority),color:A[V.priority]})}),(0,z.jsx)(D,{label:`Tags`,children:V.tags.length>0?(0,z.jsx)(ie,{tags:V.tags}):(0,z.jsx)(a,{variant:`body2`,color:`text.secondary`,children:`—`})}),V.dueDate!=null&&(0,z.jsx)(D,{label:`Due Date`,children:(0,z.jsx)(v,{value:V.dueDate,showRelative:!0})}),V.estimate!=null&&(0,z.jsx)(D,{label:`Estimate`,children:(0,z.jsxs)(a,{variant:`body2`,children:[V.estimate,`h`]})}),V.assignee&&(0,z.jsx)(D,{label:`Assignee`,children:(0,z.jsx)(a,{variant:`body2`,children:q.find(e=>e.id===V.assignee)?.name??V.assignee})}),V.completedAt!=null&&(0,z.jsx)(D,{label:`Completed`,children:(0,z.jsx)(v,{value:V.completedAt,showTime:!0,showRelative:!0})}),V.createdBy&&(0,z.jsx)(D,{label:`Created by`,children:(0,z.jsx)(a,{variant:`body2`,children:V.createdBy})}),V.updatedBy&&V.updatedBy!==V.createdBy&&(0,z.jsx)(D,{label:`Updated by`,children:(0,z.jsx)(a,{variant:`body2`,children:V.updatedBy})}),(0,z.jsx)(D,{label:`Created`,children:(0,z.jsx)(v,{value:V.createdAt,showTime:!0,showRelative:!0})}),(0,z.jsx)(D,{label:`Updated`,divider:!1,children:(0,z.jsx)(v,{value:V.updatedAt,showTime:!0,showRelative:!0})})]}),V.description&&(0,z.jsx)(_,{title:`Description`,sx:{mb:3},children:(0,z.jsx)(h,{children:V.description})}),fe&&(0,z.jsxs)(_,{title:`Dependencies`,sx:{mb:3},children:[$(`Subtasks`,V.subtasks),$(`Blocked by`,V.blockedBy),$(`Blocks`,V.blocks),$(`Related`,V.related)]}),(0,z.jsx)(_,{title:`Attachments`,sx:{mb:3},children:(0,z.jsx)(L,{attachments:G,getUrl:n=>P(e,t,n),onUpload:async n=>{await b(e,t,n),K(await j(e,t))},onDelete:async n=>{await O(e,t,n),K(await j(e,t))},readOnly:!B})}),(0,z.jsx)(_,{title:`Cross-graph Links`,children:(0,z.jsx)(I,{projectId:e,entityId:t,entityType:`tasks`,relations:U,onRefresh:Q})}),(0,z.jsx)(F,{open:X,title:`Delete Task`,message:`Are you sure you want to delete "${V.title}"? This cannot be undone.`,confirmLabel:`Delete`,confirmColor:`error`,onConfirm:ue,onCancel:()=>Z(!1)})]})}export{B as default};
|