@hasna/prompts 0.3.0 → 0.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/cli/index.js +22 -4
- package/dist/db/prompts.d.ts +4 -1
- package/dist/db/prompts.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -2
- package/dist/lib/search.d.ts +3 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/mcp/index.js +230 -26
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +164 -10
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cli/index.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -2595,7 +2613,7 @@ function listPrompts(filter = {}) {
|
|
|
2595
2613
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
2596
2614
|
}
|
|
2597
2615
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2598
|
-
const limit = filter.limit ??
|
|
2616
|
+
const limit = filter.limit ?? 20;
|
|
2599
2617
|
const offset = filter.offset ?? 0;
|
|
2600
2618
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
2601
2619
|
return rows.map(rowToPrompt);
|
|
@@ -3087,7 +3105,7 @@ function searchPrompts(query, filter = {}) {
|
|
|
3087
3105
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
3088
3106
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
3089
3107
|
ORDER BY use_count DESC, updated_at DESC
|
|
3090
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
3108
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
3091
3109
|
return rows.map((r) => rowToSearchResult(r));
|
|
3092
3110
|
}
|
|
3093
3111
|
function findSimilar(promptId, limit = 5) {
|
package/dist/db/prompts.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { Prompt, CreatePromptInput, UpdatePromptInput, ListPromptsFilter } from "../types/index.js";
|
|
1
|
+
import type { Prompt, SlimPrompt, SaveResult, CreatePromptInput, UpdatePromptInput, ListPromptsFilter } from "../types/index.js";
|
|
2
|
+
export declare function promptToSaveResult(prompt: Prompt, created: boolean, duplicate_warning?: string | null): SaveResult;
|
|
2
3
|
export declare function createPrompt(input: CreatePromptInput): Prompt;
|
|
3
4
|
export declare function getPrompt(idOrSlug: string): Prompt | null;
|
|
4
5
|
export declare function requirePrompt(idOrSlug: string): Prompt;
|
|
5
6
|
export declare function listPrompts(filter?: ListPromptsFilter): Prompt[];
|
|
7
|
+
/** Slim version of listPrompts — no body, no full variables. Default for MCP listing. */
|
|
8
|
+
export declare function listPromptsSlim(filter?: ListPromptsFilter): SlimPrompt[];
|
|
6
9
|
export declare function updatePrompt(idOrSlug: string, input: UpdatePromptInput): Prompt;
|
|
7
10
|
export declare function deletePrompt(idOrSlug: string): void;
|
|
8
11
|
export declare function usePrompt(idOrSlug: string): Prompt;
|
package/dist/db/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/db/prompts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src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AQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAK/E;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAKnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,UAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CA6BtI;AAED,wBAAgB,cAAc;;;;;YAOJ,MAAM;cAAQ,MAAM;cAAQ,MAAM;eAAS,MAAM;mBAAa,MAAM;;;YAGpE,MAAM;cAAQ,MAAM;cAAQ,MAAM;eAAS,MAAM;sBAAgB,MAAM;;;oBAG/D,MAAM;eAAS,MAAM;;;gBAGzB,MAAM;eAAS,MAAM;;EAGlD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { createPrompt, getPrompt, requirePrompt, listPrompts, updatePrompt, deletePrompt, usePrompt, upsertPrompt, getPromptStats, pinPrompt, setNextPrompt } from "./db/prompts.js";
|
|
1
|
+
export { createPrompt, getPrompt, listPromptsSlim, promptToSaveResult, requirePrompt, listPrompts, updatePrompt, deletePrompt, usePrompt, upsertPrompt, getPromptStats, pinPrompt, setNextPrompt } from "./db/prompts.js";
|
|
2
2
|
export { listVersions, getVersion, restoreVersion } from "./db/versions.js";
|
|
3
3
|
export { listCollections, getCollection, ensureCollection, movePrompt } from "./db/collections.js";
|
|
4
4
|
export { registerAgent, listAgents } from "./db/agents.js";
|
|
5
5
|
export { getDatabase, getDbPath } from "./db/database.js";
|
|
6
6
|
export { createProject, getProject, listProjects, deleteProject } from "./db/projects.js";
|
|
7
|
-
export { searchPrompts, findSimilar } from "./lib/search.js";
|
|
7
|
+
export { searchPrompts, searchPromptsSlim, findSimilar } from "./lib/search.js";
|
|
8
8
|
export { extractVariables, extractVariableInfo, renderTemplate, validateVars } from "./lib/template.js";
|
|
9
9
|
export type { VariableInfo } from "./lib/template.js";
|
|
10
10
|
export { importFromJson, exportToJson } from "./lib/importer.js";
|
|
11
11
|
export { findDuplicates } from "./lib/duplicates.js";
|
|
12
12
|
export type { DuplicateMatch } from "./lib/duplicates.js";
|
|
13
13
|
export { generateSlug, uniqueSlug, generatePromptId } from "./lib/ids.js";
|
|
14
|
-
export type { Prompt, PromptVersion, Collection, Agent, Project, TemplateVariable, PromptSource, CreatePromptInput, UpdatePromptInput, ListPromptsFilter, SearchResult, RenderResult, PromptStats, } from "./types/index.js";
|
|
14
|
+
export type { Prompt, SlimPrompt, SaveResult, SlimSearchResult, PromptVersion, Collection, Agent, Project, TemplateVariable, PromptSource, CreatePromptInput, UpdatePromptInput, ListPromptsFilter, SearchResult, RenderResult, PromptStats, } from "./types/index.js";
|
|
15
15
|
export { PromptNotFoundError, VersionConflictError, DuplicateSlugError, TemplateRenderError, ProjectNotFoundError, } from "./types/index.js";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACzN,OAAO,EAAE,YAAY,EAAE,U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
}
|
|
440
440
|
|
|
441
441
|
// src/db/prompts.ts
|
|
442
|
+
function rowToSlimPrompt(row) {
|
|
443
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
444
|
+
return {
|
|
445
|
+
id: row["id"],
|
|
446
|
+
slug: row["slug"],
|
|
447
|
+
title: row["title"],
|
|
448
|
+
description: row["description"] ?? null,
|
|
449
|
+
collection: row["collection"],
|
|
450
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
451
|
+
variable_names: variables.map((v) => v.name),
|
|
452
|
+
is_template: Boolean(row["is_template"]),
|
|
453
|
+
source: row["source"],
|
|
454
|
+
pinned: Boolean(row["pinned"]),
|
|
455
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
456
|
+
expires_at: row["expires_at"] ?? null,
|
|
457
|
+
project_id: row["project_id"] ?? null,
|
|
458
|
+
use_count: row["use_count"],
|
|
459
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
460
|
+
created_at: row["created_at"],
|
|
461
|
+
updated_at: row["updated_at"]
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
465
|
+
return {
|
|
466
|
+
id: prompt.id,
|
|
467
|
+
slug: prompt.slug,
|
|
468
|
+
title: prompt.title,
|
|
469
|
+
collection: prompt.collection,
|
|
470
|
+
is_template: prompt.is_template,
|
|
471
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
472
|
+
created,
|
|
473
|
+
duplicate_warning: duplicate_warning ?? null
|
|
474
|
+
};
|
|
475
|
+
}
|
|
442
476
|
function rowToPrompt(row) {
|
|
443
477
|
return {
|
|
444
478
|
id: row["id"],
|
|
@@ -533,11 +567,45 @@ function listPrompts(filter = {}) {
|
|
|
533
567
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
534
568
|
}
|
|
535
569
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
536
|
-
const limit = filter.limit ??
|
|
570
|
+
const limit = filter.limit ?? 20;
|
|
537
571
|
const offset = filter.offset ?? 0;
|
|
538
572
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
539
573
|
return rows.map(rowToPrompt);
|
|
540
574
|
}
|
|
575
|
+
function listPromptsSlim(filter = {}) {
|
|
576
|
+
const db = getDatabase();
|
|
577
|
+
const conditions = [];
|
|
578
|
+
const params = [];
|
|
579
|
+
if (filter.collection) {
|
|
580
|
+
conditions.push("collection = ?");
|
|
581
|
+
params.push(filter.collection);
|
|
582
|
+
}
|
|
583
|
+
if (filter.is_template !== undefined) {
|
|
584
|
+
conditions.push("is_template = ?");
|
|
585
|
+
params.push(filter.is_template ? 1 : 0);
|
|
586
|
+
}
|
|
587
|
+
if (filter.source) {
|
|
588
|
+
conditions.push("source = ?");
|
|
589
|
+
params.push(filter.source);
|
|
590
|
+
}
|
|
591
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
592
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
593
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
594
|
+
for (const tag of filter.tags)
|
|
595
|
+
params.push(`%"${tag}"%`);
|
|
596
|
+
}
|
|
597
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
598
|
+
if (filter.project_id) {
|
|
599
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
600
|
+
params.push(filter.project_id);
|
|
601
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
602
|
+
}
|
|
603
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
604
|
+
const limit = filter.limit ?? 20;
|
|
605
|
+
const offset = filter.offset ?? 0;
|
|
606
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
607
|
+
return rows.map(rowToSlimPrompt);
|
|
608
|
+
}
|
|
541
609
|
function updatePrompt(idOrSlug, input) {
|
|
542
610
|
const db = getDatabase();
|
|
543
611
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -751,6 +819,22 @@ function deleteProject(idOrSlug) {
|
|
|
751
819
|
db.run("DELETE FROM projects WHERE id = ?", [id]);
|
|
752
820
|
}
|
|
753
821
|
// src/lib/search.ts
|
|
822
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
823
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
824
|
+
return {
|
|
825
|
+
id: row["id"],
|
|
826
|
+
slug: row["slug"],
|
|
827
|
+
title: row["title"],
|
|
828
|
+
description: row["description"] ?? null,
|
|
829
|
+
collection: row["collection"],
|
|
830
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
831
|
+
variable_names: variables.map((v) => v.name),
|
|
832
|
+
is_template: Boolean(row["is_template"]),
|
|
833
|
+
use_count: row["use_count"],
|
|
834
|
+
score: row["score"] ?? 1,
|
|
835
|
+
snippet
|
|
836
|
+
};
|
|
837
|
+
}
|
|
754
838
|
function rowToSearchResult(row, snippet) {
|
|
755
839
|
return {
|
|
756
840
|
prompt: {
|
|
@@ -833,9 +917,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
833
917
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
834
918
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
835
919
|
ORDER BY use_count DESC, updated_at DESC
|
|
836
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
920
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
837
921
|
return rows.map((r) => rowToSearchResult(r));
|
|
838
922
|
}
|
|
923
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
924
|
+
const db = getDatabase();
|
|
925
|
+
if (!query.trim()) {
|
|
926
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
927
|
+
id: p.id,
|
|
928
|
+
slug: p.slug,
|
|
929
|
+
title: p.title,
|
|
930
|
+
description: p.description,
|
|
931
|
+
collection: p.collection,
|
|
932
|
+
tags: p.tags,
|
|
933
|
+
variable_names: p.variable_names,
|
|
934
|
+
is_template: p.is_template,
|
|
935
|
+
use_count: p.use_count,
|
|
936
|
+
score: 1
|
|
937
|
+
}));
|
|
938
|
+
}
|
|
939
|
+
if (hasFts(db)) {
|
|
940
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
941
|
+
const conditions = [];
|
|
942
|
+
const params = [];
|
|
943
|
+
if (filter.collection) {
|
|
944
|
+
conditions.push("p.collection = ?");
|
|
945
|
+
params.push(filter.collection);
|
|
946
|
+
}
|
|
947
|
+
if (filter.is_template !== undefined) {
|
|
948
|
+
conditions.push("p.is_template = ?");
|
|
949
|
+
params.push(filter.is_template ? 1 : 0);
|
|
950
|
+
}
|
|
951
|
+
if (filter.source) {
|
|
952
|
+
conditions.push("p.source = ?");
|
|
953
|
+
params.push(filter.source);
|
|
954
|
+
}
|
|
955
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
956
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
957
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
958
|
+
for (const tag of filter.tags)
|
|
959
|
+
params.push(`%"${tag}"%`);
|
|
960
|
+
}
|
|
961
|
+
if (filter.project_id) {
|
|
962
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
963
|
+
params.push(filter.project_id);
|
|
964
|
+
}
|
|
965
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
966
|
+
const limit = filter.limit ?? 10;
|
|
967
|
+
const offset = filter.offset ?? 0;
|
|
968
|
+
try {
|
|
969
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
970
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
971
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
972
|
+
FROM prompts p
|
|
973
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
974
|
+
WHERE prompts_fts MATCH ?
|
|
975
|
+
${where}
|
|
976
|
+
ORDER BY bm25(prompts_fts)
|
|
977
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
978
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
979
|
+
} catch {}
|
|
980
|
+
}
|
|
981
|
+
const like = `%${query}%`;
|
|
982
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
983
|
+
FROM prompts
|
|
984
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
985
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
986
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
987
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
988
|
+
}
|
|
839
989
|
function findSimilar(promptId, limit = 5) {
|
|
840
990
|
const db = getDatabase();
|
|
841
991
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -895,14 +1045,17 @@ export {
|
|
|
895
1045
|
updatePrompt,
|
|
896
1046
|
uniqueSlug,
|
|
897
1047
|
setNextPrompt,
|
|
1048
|
+
searchPromptsSlim,
|
|
898
1049
|
searchPrompts,
|
|
899
1050
|
restoreVersion,
|
|
900
1051
|
requirePrompt,
|
|
901
1052
|
renderTemplate,
|
|
902
1053
|
registerAgent,
|
|
1054
|
+
promptToSaveResult,
|
|
903
1055
|
pinPrompt,
|
|
904
1056
|
movePrompt,
|
|
905
1057
|
listVersions,
|
|
1058
|
+
listPromptsSlim,
|
|
906
1059
|
listPrompts,
|
|
907
1060
|
listProjects,
|
|
908
1061
|
listCollections,
|
package/dist/lib/search.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { SearchResult, ListPromptsFilter } from "../types/index.js";
|
|
1
|
+
import type { SlimSearchResult, SearchResult, ListPromptsFilter } from "../types/index.js";
|
|
2
2
|
export declare function searchPrompts(query: string, filter?: Omit<ListPromptsFilter, "q">): SearchResult[];
|
|
3
|
+
/** Slim search — returns only metadata + snippet, no body. Default for MCP. */
|
|
4
|
+
export declare function searchPromptsSlim(query: string, filter?: Omit<ListPromptsFilter, "q">): SlimSearchResult[];
|
|
3
5
|
export declare function findSimilar(promptId: string, limit?: number): SearchResult[];
|
|
4
6
|
//# sourceMappingURL=search.d.ts.map
|
package/dist/lib/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AA4D1F,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAM,GACxC,YAAY,EAAE,CAwEhB;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAM,GACxC,gBAAgB,EAAE,CA2DpB;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,YAAY,EAAE,CAmCvE"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __returnValue = (v) => v;
|
|
5
|
+
function __exportSetter(name, newValue) {
|
|
6
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
+
}
|
|
4
8
|
var __export = (target, all) => {
|
|
5
9
|
for (var name in all)
|
|
6
10
|
__defProp(target, name, {
|
|
7
11
|
get: all[name],
|
|
8
12
|
enumerable: true,
|
|
9
13
|
configurable: true,
|
|
10
|
-
set: (
|
|
14
|
+
set: __exportSetter.bind(all, name)
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
var __require = import.meta.require;
|
|
@@ -4421,6 +4425,40 @@ class ProjectNotFoundError extends Error {
|
|
|
4421
4425
|
}
|
|
4422
4426
|
|
|
4423
4427
|
// src/db/prompts.ts
|
|
4428
|
+
function rowToSlimPrompt(row) {
|
|
4429
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
4430
|
+
return {
|
|
4431
|
+
id: row["id"],
|
|
4432
|
+
slug: row["slug"],
|
|
4433
|
+
title: row["title"],
|
|
4434
|
+
description: row["description"] ?? null,
|
|
4435
|
+
collection: row["collection"],
|
|
4436
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
4437
|
+
variable_names: variables.map((v) => v.name),
|
|
4438
|
+
is_template: Boolean(row["is_template"]),
|
|
4439
|
+
source: row["source"],
|
|
4440
|
+
pinned: Boolean(row["pinned"]),
|
|
4441
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
4442
|
+
expires_at: row["expires_at"] ?? null,
|
|
4443
|
+
project_id: row["project_id"] ?? null,
|
|
4444
|
+
use_count: row["use_count"],
|
|
4445
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
4446
|
+
created_at: row["created_at"],
|
|
4447
|
+
updated_at: row["updated_at"]
|
|
4448
|
+
};
|
|
4449
|
+
}
|
|
4450
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
4451
|
+
return {
|
|
4452
|
+
id: prompt.id,
|
|
4453
|
+
slug: prompt.slug,
|
|
4454
|
+
title: prompt.title,
|
|
4455
|
+
collection: prompt.collection,
|
|
4456
|
+
is_template: prompt.is_template,
|
|
4457
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
4458
|
+
created,
|
|
4459
|
+
duplicate_warning: duplicate_warning ?? null
|
|
4460
|
+
};
|
|
4461
|
+
}
|
|
4424
4462
|
function rowToPrompt(row) {
|
|
4425
4463
|
return {
|
|
4426
4464
|
id: row["id"],
|
|
@@ -4515,11 +4553,45 @@ function listPrompts(filter = {}) {
|
|
|
4515
4553
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
4516
4554
|
}
|
|
4517
4555
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
4518
|
-
const limit = filter.limit ??
|
|
4556
|
+
const limit = filter.limit ?? 20;
|
|
4519
4557
|
const offset = filter.offset ?? 0;
|
|
4520
4558
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
4521
4559
|
return rows.map(rowToPrompt);
|
|
4522
4560
|
}
|
|
4561
|
+
function listPromptsSlim(filter = {}) {
|
|
4562
|
+
const db = getDatabase();
|
|
4563
|
+
const conditions = [];
|
|
4564
|
+
const params = [];
|
|
4565
|
+
if (filter.collection) {
|
|
4566
|
+
conditions.push("collection = ?");
|
|
4567
|
+
params.push(filter.collection);
|
|
4568
|
+
}
|
|
4569
|
+
if (filter.is_template !== undefined) {
|
|
4570
|
+
conditions.push("is_template = ?");
|
|
4571
|
+
params.push(filter.is_template ? 1 : 0);
|
|
4572
|
+
}
|
|
4573
|
+
if (filter.source) {
|
|
4574
|
+
conditions.push("source = ?");
|
|
4575
|
+
params.push(filter.source);
|
|
4576
|
+
}
|
|
4577
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
4578
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
4579
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
4580
|
+
for (const tag of filter.tags)
|
|
4581
|
+
params.push(`%"${tag}"%`);
|
|
4582
|
+
}
|
|
4583
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
4584
|
+
if (filter.project_id) {
|
|
4585
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
4586
|
+
params.push(filter.project_id);
|
|
4587
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
4588
|
+
}
|
|
4589
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
4590
|
+
const limit = filter.limit ?? 20;
|
|
4591
|
+
const offset = filter.offset ?? 0;
|
|
4592
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
4593
|
+
return rows.map(rowToSlimPrompt);
|
|
4594
|
+
}
|
|
4523
4595
|
function updatePrompt(idOrSlug, input) {
|
|
4524
4596
|
const db = getDatabase();
|
|
4525
4597
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -4749,6 +4821,22 @@ function deleteProject(idOrSlug) {
|
|
|
4749
4821
|
}
|
|
4750
4822
|
|
|
4751
4823
|
// src/lib/search.ts
|
|
4824
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
4825
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
4826
|
+
return {
|
|
4827
|
+
id: row["id"],
|
|
4828
|
+
slug: row["slug"],
|
|
4829
|
+
title: row["title"],
|
|
4830
|
+
description: row["description"] ?? null,
|
|
4831
|
+
collection: row["collection"],
|
|
4832
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
4833
|
+
variable_names: variables.map((v) => v.name),
|
|
4834
|
+
is_template: Boolean(row["is_template"]),
|
|
4835
|
+
use_count: row["use_count"],
|
|
4836
|
+
score: row["score"] ?? 1,
|
|
4837
|
+
snippet
|
|
4838
|
+
};
|
|
4839
|
+
}
|
|
4752
4840
|
function rowToSearchResult(row, snippet) {
|
|
4753
4841
|
return {
|
|
4754
4842
|
prompt: {
|
|
@@ -4831,9 +4919,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
4831
4919
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
4832
4920
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
4833
4921
|
ORDER BY use_count DESC, updated_at DESC
|
|
4834
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
4922
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
4835
4923
|
return rows.map((r) => rowToSearchResult(r));
|
|
4836
4924
|
}
|
|
4925
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
4926
|
+
const db = getDatabase();
|
|
4927
|
+
if (!query.trim()) {
|
|
4928
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
4929
|
+
id: p.id,
|
|
4930
|
+
slug: p.slug,
|
|
4931
|
+
title: p.title,
|
|
4932
|
+
description: p.description,
|
|
4933
|
+
collection: p.collection,
|
|
4934
|
+
tags: p.tags,
|
|
4935
|
+
variable_names: p.variable_names,
|
|
4936
|
+
is_template: p.is_template,
|
|
4937
|
+
use_count: p.use_count,
|
|
4938
|
+
score: 1
|
|
4939
|
+
}));
|
|
4940
|
+
}
|
|
4941
|
+
if (hasFts(db)) {
|
|
4942
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
4943
|
+
const conditions = [];
|
|
4944
|
+
const params = [];
|
|
4945
|
+
if (filter.collection) {
|
|
4946
|
+
conditions.push("p.collection = ?");
|
|
4947
|
+
params.push(filter.collection);
|
|
4948
|
+
}
|
|
4949
|
+
if (filter.is_template !== undefined) {
|
|
4950
|
+
conditions.push("p.is_template = ?");
|
|
4951
|
+
params.push(filter.is_template ? 1 : 0);
|
|
4952
|
+
}
|
|
4953
|
+
if (filter.source) {
|
|
4954
|
+
conditions.push("p.source = ?");
|
|
4955
|
+
params.push(filter.source);
|
|
4956
|
+
}
|
|
4957
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
4958
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
4959
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
4960
|
+
for (const tag of filter.tags)
|
|
4961
|
+
params.push(`%"${tag}"%`);
|
|
4962
|
+
}
|
|
4963
|
+
if (filter.project_id) {
|
|
4964
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
4965
|
+
params.push(filter.project_id);
|
|
4966
|
+
}
|
|
4967
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
4968
|
+
const limit = filter.limit ?? 10;
|
|
4969
|
+
const offset = filter.offset ?? 0;
|
|
4970
|
+
try {
|
|
4971
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
4972
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
4973
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
4974
|
+
FROM prompts p
|
|
4975
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
4976
|
+
WHERE prompts_fts MATCH ?
|
|
4977
|
+
${where}
|
|
4978
|
+
ORDER BY bm25(prompts_fts)
|
|
4979
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
4980
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
4981
|
+
} catch {}
|
|
4982
|
+
}
|
|
4983
|
+
const like = `%${query}%`;
|
|
4984
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
4985
|
+
FROM prompts
|
|
4986
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
4987
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
4988
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
4989
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
4990
|
+
}
|
|
4837
4991
|
function findSimilar(promptId, limit = 5) {
|
|
4838
4992
|
const db = getDatabase();
|
|
4839
4993
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -5169,7 +5323,7 @@ server.registerTool("prompts_save", {
|
|
|
5169
5323
|
input.project_id = pid;
|
|
5170
5324
|
}
|
|
5171
5325
|
const { prompt, created, duplicate_warning } = upsertPrompt(input, force ?? false);
|
|
5172
|
-
return ok(
|
|
5326
|
+
return ok(promptToSaveResult(prompt, created, duplicate_warning));
|
|
5173
5327
|
} catch (e) {
|
|
5174
5328
|
return err(e instanceof Error ? e.message : String(e));
|
|
5175
5329
|
}
|
|
@@ -5184,25 +5338,44 @@ server.registerTool("prompts_get", {
|
|
|
5184
5338
|
return ok(prompt);
|
|
5185
5339
|
});
|
|
5186
5340
|
server.registerTool("prompts_list", {
|
|
5187
|
-
description: "List prompts
|
|
5341
|
+
description: "List prompts (slim by default \u2014 no body). Use prompts_use or prompts_body to get the actual body. Pass include_body:true only if you need body text for all results. summary_only:true returns just id+slug+title for maximum token savings.",
|
|
5188
5342
|
inputSchema: {
|
|
5189
5343
|
collection: exports_external.string().optional(),
|
|
5190
5344
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5191
5345
|
is_template: exports_external.boolean().optional(),
|
|
5192
5346
|
source: exports_external.enum(["manual", "ai-session", "imported"]).optional(),
|
|
5193
|
-
limit: exports_external.number().optional().default(
|
|
5347
|
+
limit: exports_external.number().optional().default(20),
|
|
5194
5348
|
offset: exports_external.number().optional().default(0),
|
|
5195
|
-
project: exports_external.string().optional().describe("Project name, slug, or ID
|
|
5349
|
+
project: exports_external.string().optional().describe("Project name, slug, or ID"),
|
|
5350
|
+
include_body: exports_external.boolean().optional().describe("Include full body text (expensive \u2014 avoid unless needed)"),
|
|
5351
|
+
summary_only: exports_external.boolean().optional().describe("Return only id+slug+title \u2014 maximum token savings")
|
|
5196
5352
|
}
|
|
5197
|
-
}, async ({ project, ...args }) => {
|
|
5353
|
+
}, async ({ project, include_body, summary_only, ...args }) => {
|
|
5354
|
+
let project_id;
|
|
5198
5355
|
if (project) {
|
|
5199
5356
|
const db = getDatabase();
|
|
5200
5357
|
const pid = resolveProject(db, project);
|
|
5201
5358
|
if (!pid)
|
|
5202
5359
|
return err(`Project not found: ${project}`);
|
|
5203
|
-
|
|
5360
|
+
project_id = pid;
|
|
5204
5361
|
}
|
|
5205
|
-
|
|
5362
|
+
const filter = { ...args, ...project_id ? { project_id } : {} };
|
|
5363
|
+
if (summary_only) {
|
|
5364
|
+
const items = listPromptsSlim(filter);
|
|
5365
|
+
return ok(items.map((p) => ({ id: p.id, slug: p.slug, title: p.title })));
|
|
5366
|
+
}
|
|
5367
|
+
if (include_body)
|
|
5368
|
+
return ok(listPrompts(filter));
|
|
5369
|
+
return ok(listPromptsSlim(filter));
|
|
5370
|
+
});
|
|
5371
|
+
server.registerTool("prompts_body", {
|
|
5372
|
+
description: "Get just the body text of a prompt without incrementing the use counter. Use prompts_use when you want to actually use a prompt (increments counter). Use this just to read/inspect the body.",
|
|
5373
|
+
inputSchema: { id: exports_external.string().describe("Prompt ID or slug") }
|
|
5374
|
+
}, async ({ id }) => {
|
|
5375
|
+
const prompt = getPrompt(id);
|
|
5376
|
+
if (!prompt)
|
|
5377
|
+
return err(`Prompt not found: ${id}`);
|
|
5378
|
+
return ok({ id: prompt.id, slug: prompt.slug, body: prompt.body, is_template: prompt.is_template, variable_names: prompt.variables.map((v) => v.name) });
|
|
5206
5379
|
});
|
|
5207
5380
|
server.registerTool("prompts_delete", {
|
|
5208
5381
|
description: "Delete a prompt by ID or slug.",
|
|
@@ -5254,7 +5427,7 @@ server.registerTool("prompts_list_templates", {
|
|
|
5254
5427
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5255
5428
|
limit: exports_external.number().optional().default(50)
|
|
5256
5429
|
}
|
|
5257
|
-
}, async (args) => ok(
|
|
5430
|
+
}, async (args) => ok(listPromptsSlim({ ...args, is_template: true })));
|
|
5258
5431
|
server.registerTool("prompts_variables", {
|
|
5259
5432
|
description: "Inspect what variables a template needs, including defaults and required status.",
|
|
5260
5433
|
inputSchema: { id: exports_external.string() }
|
|
@@ -5266,25 +5439,30 @@ server.registerTool("prompts_variables", {
|
|
|
5266
5439
|
return ok({ prompt_id: prompt.id, slug: prompt.slug, variables: vars });
|
|
5267
5440
|
});
|
|
5268
5441
|
server.registerTool("prompts_search", {
|
|
5269
|
-
description: "
|
|
5442
|
+
description: "Search prompts by text (FTS5 BM25). Returns slim results with snippet \u2014 no body. Use prompts_use/prompts_body to get the body of a result.",
|
|
5270
5443
|
inputSchema: {
|
|
5271
5444
|
q: exports_external.string().describe("Search query"),
|
|
5272
5445
|
collection: exports_external.string().optional(),
|
|
5273
5446
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5274
5447
|
is_template: exports_external.boolean().optional(),
|
|
5275
5448
|
source: exports_external.enum(["manual", "ai-session", "imported"]).optional(),
|
|
5276
|
-
limit: exports_external.number().optional().default(
|
|
5277
|
-
project: exports_external.string().optional()
|
|
5449
|
+
limit: exports_external.number().optional().default(10),
|
|
5450
|
+
project: exports_external.string().optional(),
|
|
5451
|
+
include_body: exports_external.boolean().optional().describe("Include full body in results (expensive)")
|
|
5278
5452
|
}
|
|
5279
|
-
}, async ({ q, project, ...filter }) => {
|
|
5453
|
+
}, async ({ q, project, include_body, ...filter }) => {
|
|
5454
|
+
let project_id;
|
|
5280
5455
|
if (project) {
|
|
5281
5456
|
const db = getDatabase();
|
|
5282
5457
|
const pid = resolveProject(db, project);
|
|
5283
5458
|
if (!pid)
|
|
5284
5459
|
return err(`Project not found: ${project}`);
|
|
5285
|
-
|
|
5460
|
+
project_id = pid;
|
|
5286
5461
|
}
|
|
5287
|
-
|
|
5462
|
+
const f = { ...filter, ...project_id ? { project_id } : {} };
|
|
5463
|
+
if (include_body)
|
|
5464
|
+
return ok(searchPrompts(q, f));
|
|
5465
|
+
return ok(searchPromptsSlim(q, f));
|
|
5288
5466
|
});
|
|
5289
5467
|
server.registerTool("prompts_similar", {
|
|
5290
5468
|
description: "Find prompts similar to a given prompt (by tag overlap and collection).",
|
|
@@ -5394,7 +5572,7 @@ server.registerTool("prompts_update", {
|
|
|
5394
5572
|
}, async ({ id, ...updates }) => {
|
|
5395
5573
|
try {
|
|
5396
5574
|
const prompt = updatePrompt(id, updates);
|
|
5397
|
-
return ok(prompt);
|
|
5575
|
+
return ok(promptToSaveResult(prompt, false));
|
|
5398
5576
|
} catch (e) {
|
|
5399
5577
|
return err(e instanceof Error ? e.message : String(e));
|
|
5400
5578
|
}
|
|
@@ -5461,8 +5639,8 @@ server.registerTool("prompts_save_from_session", {
|
|
|
5461
5639
|
});
|
|
5462
5640
|
if (pin)
|
|
5463
5641
|
pinPrompt(prompt.id, true);
|
|
5464
|
-
const
|
|
5465
|
-
return ok({ ...
|
|
5642
|
+
const result = promptToSaveResult(prompt, created);
|
|
5643
|
+
return ok({ ...result, pinned: pin ?? false, _tip: created ? `Saved as "${prompt.slug}". Use prompts_use("${prompt.slug}") to retrieve it.` : `Updated "${prompt.slug}".` });
|
|
5466
5644
|
} catch (e) {
|
|
5467
5645
|
return err(e instanceof Error ? e.message : String(e));
|
|
5468
5646
|
}
|
|
@@ -5475,8 +5653,8 @@ server.registerTool("prompts_unused", {
|
|
|
5475
5653
|
description: "List prompts with use_count = 0 \u2014 never used. Good for library cleanup.",
|
|
5476
5654
|
inputSchema: { collection: exports_external.string().optional(), limit: exports_external.number().optional().default(50) }
|
|
5477
5655
|
}, async ({ collection, limit }) => {
|
|
5478
|
-
const all =
|
|
5479
|
-
const unused = all.filter((p) => p.use_count === 0).slice(0, limit);
|
|
5656
|
+
const all = listPromptsSlim({ collection, limit: 1e4 });
|
|
5657
|
+
const unused = all.filter((p) => p.use_count === 0).slice(0, limit).map((p) => ({ id: p.id, slug: p.slug, title: p.title, collection: p.collection, created_at: p.created_at }));
|
|
5480
5658
|
return ok({ unused, count: unused.length });
|
|
5481
5659
|
});
|
|
5482
5660
|
server.registerTool("prompts_trending", {
|
|
@@ -5596,10 +5774,10 @@ server.registerTool("prompts_unpin", {
|
|
|
5596
5774
|
}
|
|
5597
5775
|
});
|
|
5598
5776
|
server.registerTool("prompts_recent", {
|
|
5599
|
-
description: "Get recently used prompts,
|
|
5777
|
+
description: "Get recently used prompts (slim \u2014 no body). Returns id, slug, title, tags, use_count, last_used_at.",
|
|
5600
5778
|
inputSchema: { limit: exports_external.number().optional().default(10) }
|
|
5601
5779
|
}, async ({ limit }) => {
|
|
5602
|
-
const prompts =
|
|
5780
|
+
const prompts = listPromptsSlim({ limit: 500 }).filter((p) => p.last_used_at !== null).sort((a, b) => (b.last_used_at ?? "").localeCompare(a.last_used_at ?? "")).slice(0, limit);
|
|
5603
5781
|
return ok(prompts);
|
|
5604
5782
|
});
|
|
5605
5783
|
server.registerTool("prompts_lint", {
|
|
@@ -5623,8 +5801,8 @@ server.registerTool("prompts_stale", {
|
|
|
5623
5801
|
inputSchema: { days: exports_external.number().optional().default(30).describe("Inactivity threshold in days") }
|
|
5624
5802
|
}, async ({ days }) => {
|
|
5625
5803
|
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
|
|
5626
|
-
const all =
|
|
5627
|
-
const stale = all.filter((p) => p.last_used_at === null || p.last_used_at < cutoff).sort((a, b) => (a.last_used_at ?? "").localeCompare(b.last_used_at ?? ""));
|
|
5804
|
+
const all = listPromptsSlim({ limit: 1e4 });
|
|
5805
|
+
const stale = all.filter((p) => p.last_used_at === null || p.last_used_at < cutoff).sort((a, b) => (a.last_used_at ?? "").localeCompare(b.last_used_at ?? "")).map((p) => ({ id: p.id, slug: p.slug, title: p.title, last_used_at: p.last_used_at, use_count: p.use_count }));
|
|
5628
5806
|
return ok({ stale, count: stale.length, threshold_days: days });
|
|
5629
5807
|
});
|
|
5630
5808
|
server.registerTool("prompts_stats", {
|
|
@@ -5669,5 +5847,31 @@ server.registerTool("prompts_project_delete", {
|
|
|
5669
5847
|
return err(e instanceof Error ? e.message : String(e));
|
|
5670
5848
|
}
|
|
5671
5849
|
});
|
|
5850
|
+
var _agentReg = new Map;
|
|
5851
|
+
server.tool("register_agent", "Register this agent session. Returns agent_id for use in heartbeat/set_focus.", { name: exports_external.string(), session_id: exports_external.string().optional() }, async (a) => {
|
|
5852
|
+
const existing = [..._agentReg.values()].find((x) => x.name === a.name);
|
|
5853
|
+
if (existing) {
|
|
5854
|
+
existing.last_seen_at = new Date().toISOString();
|
|
5855
|
+
return { content: [{ type: "text", text: JSON.stringify(existing) }] };
|
|
5856
|
+
}
|
|
5857
|
+
const id = Math.random().toString(36).slice(2, 10);
|
|
5858
|
+
const ag = { id, name: a.name, last_seen_at: new Date().toISOString() };
|
|
5859
|
+
_agentReg.set(id, ag);
|
|
5860
|
+
return { content: [{ type: "text", text: JSON.stringify(ag) }] };
|
|
5861
|
+
});
|
|
5862
|
+
server.tool("heartbeat", "Update last_seen_at to signal agent is active.", { agent_id: exports_external.string() }, async (a) => {
|
|
5863
|
+
const ag = _agentReg.get(a.agent_id);
|
|
5864
|
+
if (!ag)
|
|
5865
|
+
return { content: [{ type: "text", text: `Agent not found: ${a.agent_id}` }], isError: true };
|
|
5866
|
+
ag.last_seen_at = new Date().toISOString();
|
|
5867
|
+
return { content: [{ type: "text", text: `\u2665 ${ag.name} \u2014 active` }] };
|
|
5868
|
+
});
|
|
5869
|
+
server.tool("set_focus", "Set active project context for this agent session.", { agent_id: exports_external.string(), project_id: exports_external.string().optional() }, async (a) => {
|
|
5870
|
+
const ag = _agentReg.get(a.agent_id);
|
|
5871
|
+
if (!ag)
|
|
5872
|
+
return { content: [{ type: "text", text: `Agent not found: ${a.agent_id}` }], isError: true };
|
|
5873
|
+
ag.project_id = a.project_id;
|
|
5874
|
+
return { content: [{ type: "text", text: a.project_id ? `Focus: ${a.project_id}` : "Focus cleared" }] };
|
|
5875
|
+
});
|
|
5672
5876
|
var transport = new StdioServerTransport;
|
|
5673
5877
|
await server.connect(transport);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;eAsCmB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAF9C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;eAsCmB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAF9C,wBAyOC"}
|
package/dist/server/index.js
CHANGED
|
@@ -424,6 +424,40 @@ class ProjectNotFoundError extends Error {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
// src/db/prompts.ts
|
|
427
|
+
function rowToSlimPrompt(row) {
|
|
428
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
429
|
+
return {
|
|
430
|
+
id: row["id"],
|
|
431
|
+
slug: row["slug"],
|
|
432
|
+
title: row["title"],
|
|
433
|
+
description: row["description"] ?? null,
|
|
434
|
+
collection: row["collection"],
|
|
435
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
436
|
+
variable_names: variables.map((v) => v.name),
|
|
437
|
+
is_template: Boolean(row["is_template"]),
|
|
438
|
+
source: row["source"],
|
|
439
|
+
pinned: Boolean(row["pinned"]),
|
|
440
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
441
|
+
expires_at: row["expires_at"] ?? null,
|
|
442
|
+
project_id: row["project_id"] ?? null,
|
|
443
|
+
use_count: row["use_count"],
|
|
444
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
445
|
+
created_at: row["created_at"],
|
|
446
|
+
updated_at: row["updated_at"]
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
450
|
+
return {
|
|
451
|
+
id: prompt.id,
|
|
452
|
+
slug: prompt.slug,
|
|
453
|
+
title: prompt.title,
|
|
454
|
+
collection: prompt.collection,
|
|
455
|
+
is_template: prompt.is_template,
|
|
456
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
457
|
+
created,
|
|
458
|
+
duplicate_warning: duplicate_warning ?? null
|
|
459
|
+
};
|
|
460
|
+
}
|
|
427
461
|
function rowToPrompt(row) {
|
|
428
462
|
return {
|
|
429
463
|
id: row["id"],
|
|
@@ -518,11 +552,45 @@ function listPrompts(filter = {}) {
|
|
|
518
552
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
519
553
|
}
|
|
520
554
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
521
|
-
const limit = filter.limit ??
|
|
555
|
+
const limit = filter.limit ?? 20;
|
|
522
556
|
const offset = filter.offset ?? 0;
|
|
523
557
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
524
558
|
return rows.map(rowToPrompt);
|
|
525
559
|
}
|
|
560
|
+
function listPromptsSlim(filter = {}) {
|
|
561
|
+
const db = getDatabase();
|
|
562
|
+
const conditions = [];
|
|
563
|
+
const params = [];
|
|
564
|
+
if (filter.collection) {
|
|
565
|
+
conditions.push("collection = ?");
|
|
566
|
+
params.push(filter.collection);
|
|
567
|
+
}
|
|
568
|
+
if (filter.is_template !== undefined) {
|
|
569
|
+
conditions.push("is_template = ?");
|
|
570
|
+
params.push(filter.is_template ? 1 : 0);
|
|
571
|
+
}
|
|
572
|
+
if (filter.source) {
|
|
573
|
+
conditions.push("source = ?");
|
|
574
|
+
params.push(filter.source);
|
|
575
|
+
}
|
|
576
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
577
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
578
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
579
|
+
for (const tag of filter.tags)
|
|
580
|
+
params.push(`%"${tag}"%`);
|
|
581
|
+
}
|
|
582
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
583
|
+
if (filter.project_id) {
|
|
584
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
585
|
+
params.push(filter.project_id);
|
|
586
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
587
|
+
}
|
|
588
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
589
|
+
const limit = filter.limit ?? 20;
|
|
590
|
+
const offset = filter.offset ?? 0;
|
|
591
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
592
|
+
return rows.map(rowToSlimPrompt);
|
|
593
|
+
}
|
|
526
594
|
function updatePrompt(idOrSlug, input) {
|
|
527
595
|
const db = getDatabase();
|
|
528
596
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -698,6 +766,22 @@ function deleteProject(idOrSlug) {
|
|
|
698
766
|
}
|
|
699
767
|
|
|
700
768
|
// src/lib/search.ts
|
|
769
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
770
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
771
|
+
return {
|
|
772
|
+
id: row["id"],
|
|
773
|
+
slug: row["slug"],
|
|
774
|
+
title: row["title"],
|
|
775
|
+
description: row["description"] ?? null,
|
|
776
|
+
collection: row["collection"],
|
|
777
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
778
|
+
variable_names: variables.map((v) => v.name),
|
|
779
|
+
is_template: Boolean(row["is_template"]),
|
|
780
|
+
use_count: row["use_count"],
|
|
781
|
+
score: row["score"] ?? 1,
|
|
782
|
+
snippet
|
|
783
|
+
};
|
|
784
|
+
}
|
|
701
785
|
function rowToSearchResult(row, snippet) {
|
|
702
786
|
return {
|
|
703
787
|
prompt: {
|
|
@@ -780,9 +864,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
780
864
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
781
865
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
782
866
|
ORDER BY use_count DESC, updated_at DESC
|
|
783
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
867
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
784
868
|
return rows.map((r) => rowToSearchResult(r));
|
|
785
869
|
}
|
|
870
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
871
|
+
const db = getDatabase();
|
|
872
|
+
if (!query.trim()) {
|
|
873
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
874
|
+
id: p.id,
|
|
875
|
+
slug: p.slug,
|
|
876
|
+
title: p.title,
|
|
877
|
+
description: p.description,
|
|
878
|
+
collection: p.collection,
|
|
879
|
+
tags: p.tags,
|
|
880
|
+
variable_names: p.variable_names,
|
|
881
|
+
is_template: p.is_template,
|
|
882
|
+
use_count: p.use_count,
|
|
883
|
+
score: 1
|
|
884
|
+
}));
|
|
885
|
+
}
|
|
886
|
+
if (hasFts(db)) {
|
|
887
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
888
|
+
const conditions = [];
|
|
889
|
+
const params = [];
|
|
890
|
+
if (filter.collection) {
|
|
891
|
+
conditions.push("p.collection = ?");
|
|
892
|
+
params.push(filter.collection);
|
|
893
|
+
}
|
|
894
|
+
if (filter.is_template !== undefined) {
|
|
895
|
+
conditions.push("p.is_template = ?");
|
|
896
|
+
params.push(filter.is_template ? 1 : 0);
|
|
897
|
+
}
|
|
898
|
+
if (filter.source) {
|
|
899
|
+
conditions.push("p.source = ?");
|
|
900
|
+
params.push(filter.source);
|
|
901
|
+
}
|
|
902
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
903
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
904
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
905
|
+
for (const tag of filter.tags)
|
|
906
|
+
params.push(`%"${tag}"%`);
|
|
907
|
+
}
|
|
908
|
+
if (filter.project_id) {
|
|
909
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
910
|
+
params.push(filter.project_id);
|
|
911
|
+
}
|
|
912
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
913
|
+
const limit = filter.limit ?? 10;
|
|
914
|
+
const offset = filter.offset ?? 0;
|
|
915
|
+
try {
|
|
916
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
917
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
918
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
919
|
+
FROM prompts p
|
|
920
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
921
|
+
WHERE prompts_fts MATCH ?
|
|
922
|
+
${where}
|
|
923
|
+
ORDER BY bm25(prompts_fts)
|
|
924
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
925
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
926
|
+
} catch {}
|
|
927
|
+
}
|
|
928
|
+
const like = `%${query}%`;
|
|
929
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
930
|
+
FROM prompts
|
|
931
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
932
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
933
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
934
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
935
|
+
}
|
|
786
936
|
function findSimilar(promptId, limit = 5) {
|
|
787
937
|
const db = getDatabase();
|
|
788
938
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -879,8 +1029,9 @@ var server_default = {
|
|
|
879
1029
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
880
1030
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
881
1031
|
const source = url.searchParams.get("source") ?? undefined;
|
|
882
|
-
const limit = parseInt(url.searchParams.get("limit") ?? "
|
|
1032
|
+
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
883
1033
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1034
|
+
const full = url.searchParams.has("full");
|
|
884
1035
|
const projectParam = url.searchParams.get("project") ?? undefined;
|
|
885
1036
|
let project_id;
|
|
886
1037
|
if (projectParam) {
|
|
@@ -889,12 +1040,13 @@ var server_default = {
|
|
|
889
1040
|
return notFound(`Project not found: ${projectParam}`);
|
|
890
1041
|
project_id = pid;
|
|
891
1042
|
}
|
|
892
|
-
|
|
1043
|
+
const filter = { collection, tags, is_template, source, limit, offset, project_id };
|
|
1044
|
+
return json(full ? listPrompts(filter) : listPromptsSlim(filter));
|
|
893
1045
|
}
|
|
894
1046
|
if (path === "/api/prompts" && method === "POST") {
|
|
895
1047
|
const body = await parseBody(req);
|
|
896
|
-
const
|
|
897
|
-
return json(
|
|
1048
|
+
const { prompt, created, duplicate_warning } = upsertPrompt(body);
|
|
1049
|
+
return json(promptToSaveResult(prompt, created, duplicate_warning), created ? 201 : 200);
|
|
898
1050
|
}
|
|
899
1051
|
const promptMatch = path.match(/^\/api\/prompts\/([^/]+)$/);
|
|
900
1052
|
if (promptMatch) {
|
|
@@ -908,7 +1060,7 @@ var server_default = {
|
|
|
908
1060
|
if (method === "PUT") {
|
|
909
1061
|
const body = await parseBody(req);
|
|
910
1062
|
const prompt = updatePrompt(id, body);
|
|
911
|
-
return json(prompt);
|
|
1063
|
+
return json(promptToSaveResult(prompt, false));
|
|
912
1064
|
}
|
|
913
1065
|
if (method === "DELETE") {
|
|
914
1066
|
deletePrompt(id);
|
|
@@ -973,10 +1125,11 @@ var server_default = {
|
|
|
973
1125
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
974
1126
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
975
1127
|
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
976
|
-
|
|
1128
|
+
const full = url.searchParams.has("full");
|
|
1129
|
+
return json(full ? searchPrompts(q, { collection, tags, is_template, limit }) : searchPromptsSlim(q, { collection, tags, is_template, limit }));
|
|
977
1130
|
}
|
|
978
1131
|
if (path === "/api/templates" && method === "GET") {
|
|
979
|
-
return json(
|
|
1132
|
+
return json(listPromptsSlim({ is_template: true, limit: 50 }));
|
|
980
1133
|
}
|
|
981
1134
|
if (path === "/api/collections" && method === "GET") {
|
|
982
1135
|
return json(listCollections());
|
|
@@ -1033,7 +1186,8 @@ var server_default = {
|
|
|
1033
1186
|
return notFound(`Project not found: ${projId}`);
|
|
1034
1187
|
const limit = parseInt(url.searchParams.get("limit") ?? "100");
|
|
1035
1188
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1036
|
-
|
|
1189
|
+
const full = url.searchParams.has("full");
|
|
1190
|
+
return json(full ? listPrompts({ project_id: project.id, limit, offset }) : listPromptsSlim({ project_id: project.id, limit, offset }));
|
|
1037
1191
|
}
|
|
1038
1192
|
if (path === "/health") {
|
|
1039
1193
|
return json({ status: "ok", port: PORT });
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slim prompt — no body, no full variable details.
|
|
3
|
+
* Returned by list/search/stats/recent/stale/trending by default.
|
|
4
|
+
* Saves tokens — use prompts_use / prompts_get / prompts_body to get the actual body.
|
|
5
|
+
*/
|
|
6
|
+
export interface SlimPrompt {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string | null;
|
|
11
|
+
collection: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
variable_names: string[];
|
|
14
|
+
is_template: boolean;
|
|
15
|
+
source: PromptSource;
|
|
16
|
+
pinned: boolean;
|
|
17
|
+
next_prompt: string | null;
|
|
18
|
+
expires_at: string | null;
|
|
19
|
+
project_id: string | null;
|
|
20
|
+
use_count: number;
|
|
21
|
+
last_used_at: string | null;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at: string;
|
|
24
|
+
}
|
|
1
25
|
export interface Prompt {
|
|
2
26
|
id: string;
|
|
3
27
|
name: string;
|
|
@@ -94,6 +118,31 @@ export interface SearchResult {
|
|
|
94
118
|
score: number;
|
|
95
119
|
snippet?: string;
|
|
96
120
|
}
|
|
121
|
+
/** Slim search result — body replaced by snippet, no full prompt */
|
|
122
|
+
export interface SlimSearchResult {
|
|
123
|
+
id: string;
|
|
124
|
+
slug: string;
|
|
125
|
+
title: string;
|
|
126
|
+
description: string | null;
|
|
127
|
+
collection: string;
|
|
128
|
+
tags: string[];
|
|
129
|
+
is_template: boolean;
|
|
130
|
+
variable_names: string[];
|
|
131
|
+
use_count: number;
|
|
132
|
+
score: number;
|
|
133
|
+
snippet?: string;
|
|
134
|
+
}
|
|
135
|
+
/** Returned by save/update to avoid echoing back the full body */
|
|
136
|
+
export interface SaveResult {
|
|
137
|
+
id: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
title: string;
|
|
140
|
+
collection: string;
|
|
141
|
+
is_template: boolean;
|
|
142
|
+
variable_names: string[];
|
|
143
|
+
created: boolean;
|
|
144
|
+
duplicate_warning?: string | null;
|
|
145
|
+
}
|
|
97
146
|
export interface RenderResult {
|
|
98
147
|
rendered: string;
|
|
99
148
|
missing_vars: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,OAAO;IACtB,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AC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACpD;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,IAAI,EAAE,MAAM;CAIzB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,EAAE,EAAE,MAAM;CAIvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/prompts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Reusable prompt library for AI agents — CLI + MCP server + REST API + web dashboard",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"repository": {
|
|
55
55
|
"type": "git",
|
|
56
|
-
"url": "https://github.com/hasna/
|
|
56
|
+
"url": "https://github.com/hasna/prompts.git"
|
|
57
57
|
},
|
|
58
|
-
"homepage": "https://github.com/hasna/
|
|
58
|
+
"homepage": "https://github.com/hasna/prompts",
|
|
59
59
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/hasna/
|
|
60
|
+
"url": "https://github.com/hasna/prompts/issues"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"bun": ">=1.0.0"
|