@hasna/prompts 0.3.1 → 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 +20 -2
- package/dist/mcp/index.js +31 -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);
|
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;
|
|
@@ -5843,5 +5847,31 @@ server.registerTool("prompts_project_delete", {
|
|
|
5843
5847
|
return err(e instanceof Error ? e.message : String(e));
|
|
5844
5848
|
}
|
|
5845
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
|
+
});
|
|
5846
5876
|
var transport = new StdioServerTransport;
|
|
5847
5877
|
await server.connect(transport);
|
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"
|