@hasna/prompts 0.2.2 → 0.3.1
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 +907 -93
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/prompts.d.ts +12 -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 +190 -2
- package/dist/lib/audit.d.ts +16 -0
- package/dist/lib/audit.d.ts.map +1 -0
- package/dist/lib/completion.d.ts +3 -0
- package/dist/lib/completion.d.ts.map +1 -0
- package/dist/lib/diff.d.ts +8 -0
- package/dist/lib/diff.d.ts.map +1 -0
- package/dist/lib/importer.d.ts +8 -0
- package/dist/lib/importer.d.ts.map +1 -1
- package/dist/lib/search.d.ts +3 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/mcp/index.js +562 -24
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +192 -10
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
@@ -130,6 +130,26 @@ function runMigrations(db) {
|
|
|
130
130
|
CREATE INDEX IF NOT EXISTS idx_prompts_project_id ON prompts(project_id);
|
|
131
131
|
`
|
|
132
132
|
},
|
|
133
|
+
{
|
|
134
|
+
name: "005_chaining",
|
|
135
|
+
sql: `ALTER TABLE prompts ADD COLUMN next_prompt TEXT;`
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "006_expiry",
|
|
139
|
+
sql: `ALTER TABLE prompts ADD COLUMN expires_at TEXT;`
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "007_usage_log",
|
|
143
|
+
sql: `
|
|
144
|
+
CREATE TABLE IF NOT EXISTS usage_log (
|
|
145
|
+
id TEXT PRIMARY KEY,
|
|
146
|
+
prompt_id TEXT NOT NULL REFERENCES prompts(id) ON DELETE CASCADE,
|
|
147
|
+
used_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
148
|
+
);
|
|
149
|
+
CREATE INDEX IF NOT EXISTS idx_usage_log_prompt_id ON usage_log(prompt_id);
|
|
150
|
+
CREATE INDEX IF NOT EXISTS idx_usage_log_used_at ON usage_log(used_at);
|
|
151
|
+
`
|
|
152
|
+
},
|
|
133
153
|
{
|
|
134
154
|
name: "002_fts5",
|
|
135
155
|
sql: `
|
|
@@ -404,6 +424,40 @@ class ProjectNotFoundError extends Error {
|
|
|
404
424
|
}
|
|
405
425
|
|
|
406
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
|
+
}
|
|
407
461
|
function rowToPrompt(row) {
|
|
408
462
|
return {
|
|
409
463
|
id: row["id"],
|
|
@@ -416,6 +470,8 @@ function rowToPrompt(row) {
|
|
|
416
470
|
tags: JSON.parse(row["tags"] || "[]"),
|
|
417
471
|
variables: JSON.parse(row["variables"] || "[]"),
|
|
418
472
|
pinned: Boolean(row["pinned"]),
|
|
473
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
474
|
+
expires_at: row["expires_at"] ?? null,
|
|
419
475
|
project_id: row["project_id"] ?? null,
|
|
420
476
|
is_template: Boolean(row["is_template"]),
|
|
421
477
|
source: row["source"],
|
|
@@ -496,11 +552,45 @@ function listPrompts(filter = {}) {
|
|
|
496
552
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
497
553
|
}
|
|
498
554
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
499
|
-
const limit = filter.limit ??
|
|
555
|
+
const limit = filter.limit ?? 20;
|
|
500
556
|
const offset = filter.offset ?? 0;
|
|
501
557
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
502
558
|
return rows.map(rowToPrompt);
|
|
503
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
|
+
}
|
|
504
594
|
function updatePrompt(idOrSlug, input) {
|
|
505
595
|
const db = getDatabase();
|
|
506
596
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -514,6 +604,7 @@ function updatePrompt(idOrSlug, input) {
|
|
|
514
604
|
description = COALESCE(?, description),
|
|
515
605
|
collection = COALESCE(?, collection),
|
|
516
606
|
tags = COALESCE(?, tags),
|
|
607
|
+
next_prompt = CASE WHEN ? IS NOT NULL THEN ? ELSE next_prompt END,
|
|
517
608
|
variables = ?,
|
|
518
609
|
is_template = ?,
|
|
519
610
|
version = version + 1,
|
|
@@ -524,6 +615,8 @@ function updatePrompt(idOrSlug, input) {
|
|
|
524
615
|
input.description ?? null,
|
|
525
616
|
input.collection ?? null,
|
|
526
617
|
input.tags ? JSON.stringify(input.tags) : null,
|
|
618
|
+
"next_prompt" in input ? input.next_prompt ?? "" : null,
|
|
619
|
+
"next_prompt" in input ? input.next_prompt ?? null : null,
|
|
527
620
|
variables,
|
|
528
621
|
is_template,
|
|
529
622
|
prompt.id,
|
|
@@ -546,6 +639,7 @@ function usePrompt(idOrSlug) {
|
|
|
546
639
|
const db = getDatabase();
|
|
547
640
|
const prompt = requirePrompt(idOrSlug);
|
|
548
641
|
db.run("UPDATE prompts SET use_count = use_count + 1, last_used_at = datetime('now') WHERE id = ?", [prompt.id]);
|
|
642
|
+
db.run("INSERT INTO usage_log (id, prompt_id) VALUES (?, ?)", [generateId("UL"), prompt.id]);
|
|
549
643
|
return requirePrompt(prompt.id);
|
|
550
644
|
}
|
|
551
645
|
function upsertPrompt(input, force = false) {
|
|
@@ -672,6 +766,22 @@ function deleteProject(idOrSlug) {
|
|
|
672
766
|
}
|
|
673
767
|
|
|
674
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
|
+
}
|
|
675
785
|
function rowToSearchResult(row, snippet) {
|
|
676
786
|
return {
|
|
677
787
|
prompt: {
|
|
@@ -685,6 +795,8 @@ function rowToSearchResult(row, snippet) {
|
|
|
685
795
|
tags: JSON.parse(row["tags"] || "[]"),
|
|
686
796
|
variables: JSON.parse(row["variables"] || "[]"),
|
|
687
797
|
pinned: Boolean(row["pinned"]),
|
|
798
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
799
|
+
expires_at: row["expires_at"] ?? null,
|
|
688
800
|
project_id: row["project_id"] ?? null,
|
|
689
801
|
is_template: Boolean(row["is_template"]),
|
|
690
802
|
source: row["source"],
|
|
@@ -752,9 +864,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
752
864
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
753
865
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
754
866
|
ORDER BY use_count DESC, updated_at DESC
|
|
755
|
-
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);
|
|
756
868
|
return rows.map((r) => rowToSearchResult(r));
|
|
757
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
|
+
}
|
|
758
936
|
function findSimilar(promptId, limit = 5) {
|
|
759
937
|
const db = getDatabase();
|
|
760
938
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -851,8 +1029,9 @@ var server_default = {
|
|
|
851
1029
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
852
1030
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
853
1031
|
const source = url.searchParams.get("source") ?? undefined;
|
|
854
|
-
const limit = parseInt(url.searchParams.get("limit") ?? "
|
|
1032
|
+
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
855
1033
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1034
|
+
const full = url.searchParams.has("full");
|
|
856
1035
|
const projectParam = url.searchParams.get("project") ?? undefined;
|
|
857
1036
|
let project_id;
|
|
858
1037
|
if (projectParam) {
|
|
@@ -861,12 +1040,13 @@ var server_default = {
|
|
|
861
1040
|
return notFound(`Project not found: ${projectParam}`);
|
|
862
1041
|
project_id = pid;
|
|
863
1042
|
}
|
|
864
|
-
|
|
1043
|
+
const filter = { collection, tags, is_template, source, limit, offset, project_id };
|
|
1044
|
+
return json(full ? listPrompts(filter) : listPromptsSlim(filter));
|
|
865
1045
|
}
|
|
866
1046
|
if (path === "/api/prompts" && method === "POST") {
|
|
867
1047
|
const body = await parseBody(req);
|
|
868
|
-
const
|
|
869
|
-
return json(
|
|
1048
|
+
const { prompt, created, duplicate_warning } = upsertPrompt(body);
|
|
1049
|
+
return json(promptToSaveResult(prompt, created, duplicate_warning), created ? 201 : 200);
|
|
870
1050
|
}
|
|
871
1051
|
const promptMatch = path.match(/^\/api\/prompts\/([^/]+)$/);
|
|
872
1052
|
if (promptMatch) {
|
|
@@ -880,7 +1060,7 @@ var server_default = {
|
|
|
880
1060
|
if (method === "PUT") {
|
|
881
1061
|
const body = await parseBody(req);
|
|
882
1062
|
const prompt = updatePrompt(id, body);
|
|
883
|
-
return json(prompt);
|
|
1063
|
+
return json(promptToSaveResult(prompt, false));
|
|
884
1064
|
}
|
|
885
1065
|
if (method === "DELETE") {
|
|
886
1066
|
deletePrompt(id);
|
|
@@ -945,10 +1125,11 @@ var server_default = {
|
|
|
945
1125
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
946
1126
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
947
1127
|
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
948
|
-
|
|
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 }));
|
|
949
1130
|
}
|
|
950
1131
|
if (path === "/api/templates" && method === "GET") {
|
|
951
|
-
return json(
|
|
1132
|
+
return json(listPromptsSlim({ is_template: true, limit: 50 }));
|
|
952
1133
|
}
|
|
953
1134
|
if (path === "/api/collections" && method === "GET") {
|
|
954
1135
|
return json(listCollections());
|
|
@@ -1005,7 +1186,8 @@ var server_default = {
|
|
|
1005
1186
|
return notFound(`Project not found: ${projId}`);
|
|
1006
1187
|
const limit = parseInt(url.searchParams.get("limit") ?? "100");
|
|
1007
1188
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1008
|
-
|
|
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 }));
|
|
1009
1191
|
}
|
|
1010
1192
|
if (path === "/health") {
|
|
1011
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;
|
|
@@ -11,6 +35,8 @@ export interface Prompt {
|
|
|
11
35
|
is_template: boolean;
|
|
12
36
|
source: PromptSource;
|
|
13
37
|
pinned: boolean;
|
|
38
|
+
next_prompt: string | null;
|
|
39
|
+
expires_at: string | null;
|
|
14
40
|
project_id: string | null;
|
|
15
41
|
version: number;
|
|
16
42
|
use_count: number;
|
|
@@ -74,6 +100,7 @@ export interface UpdatePromptInput {
|
|
|
74
100
|
description?: string;
|
|
75
101
|
collection?: string;
|
|
76
102
|
tags?: string[];
|
|
103
|
+
next_prompt?: string | null;
|
|
77
104
|
changed_by?: string;
|
|
78
105
|
}
|
|
79
106
|
export interface ListPromptsFilter {
|
|
@@ -91,6 +118,31 @@ export interface SearchResult {
|
|
|
91
118
|
score: number;
|
|
92
119
|
snippet?: string;
|
|
93
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
|
+
}
|
|
94
146
|
export interface RenderResult {
|
|
95
147
|
rendered: string;
|
|
96
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,gBAAg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