@oneie/mcp 0.2.1 → 0.3.0
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/LICENSE +18 -0
- package/README.md +64 -65
- package/dist/index.d.ts +4 -7
- package/dist/index.js +6 -10
- package/dist/index.js.map +1 -1
- package/dist/serve.d.ts +4 -0
- package/dist/serve.js +53 -0
- package/dist/serve.js.map +1 -1
- package/dist/tools/lifecycle.js +196 -12
- package/dist/tools/lifecycle.js.map +1 -1
- package/dist/tools/observability.js +12 -41
- package/dist/tools/observability.js.map +1 -1
- package/dist/tools/social.d.ts +2 -0
- package/dist/tools/social.js +83 -0
- package/dist/tools/social.js.map +1 -0
- package/dist/tools/substrate.js +294 -38
- package/dist/tools/substrate.js.map +1 -1
- package/package.json +6 -4
- package/dist/tools/commerce.d.ts +0 -2
- package/dist/tools/commerce.js +0 -303
- package/dist/tools/commerce.js.map +0 -1
- package/dist/tools/groups.d.ts +0 -2
- package/dist/tools/groups.js +0 -95
- package/dist/tools/groups.js.map +0 -1
|
@@ -19,7 +19,10 @@ export function observabilityTools() {
|
|
|
19
19
|
name: "stats",
|
|
20
20
|
description: "Return aggregate substrate stats: unit counts, highways, and revenue totals.",
|
|
21
21
|
inputSchema: { type: "object", properties: {} },
|
|
22
|
-
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey,
|
|
22
|
+
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey, `/api/ask/${encodeURIComponent("stats:current")}`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: JSON.stringify({ data: {} }),
|
|
25
|
+
}),
|
|
23
26
|
},
|
|
24
27
|
{
|
|
25
28
|
name: "health",
|
|
@@ -39,26 +42,14 @@ export function observabilityTools() {
|
|
|
39
42
|
inputSchema: { type: "object", properties: {} },
|
|
40
43
|
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey, "/api/frontiers"),
|
|
41
44
|
},
|
|
42
|
-
{
|
|
43
|
-
name: "hypotheses_global",
|
|
44
|
-
description: "Query all hypotheses; optionally filter by status (pending|testing|confirmed|rejected).",
|
|
45
|
-
inputSchema: {
|
|
46
|
-
type: "object",
|
|
47
|
-
properties: { status: { type: "string", enum: ["pending", "testing", "confirmed", "rejected"] } },
|
|
48
|
-
},
|
|
49
|
-
handler: async (args, env) => {
|
|
50
|
-
const p = new URLSearchParams();
|
|
51
|
-
if (args.status)
|
|
52
|
-
p.set("status", String(args.status));
|
|
53
|
-
const qs = p.toString() ? `?${p}` : "";
|
|
54
|
-
return apiCall(env.baseUrl, env.apiKey, `/api/hypotheses${qs}`);
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
45
|
{
|
|
58
46
|
name: "export_units",
|
|
59
47
|
description: "Export all units as a JSON snapshot (uid, name, kind, successRate, generation).",
|
|
60
48
|
inputSchema: { type: "object", properties: {} },
|
|
61
|
-
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey,
|
|
49
|
+
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey, `/api/ask/${encodeURIComponent("export:units")}`, {
|
|
50
|
+
method: "POST",
|
|
51
|
+
body: JSON.stringify({ data: {} }),
|
|
52
|
+
}),
|
|
62
53
|
},
|
|
63
54
|
{
|
|
64
55
|
name: "export_highways",
|
|
@@ -80,26 +71,6 @@ export function observabilityTools() {
|
|
|
80
71
|
return apiCall(env.baseUrl, env.apiKey, `/api/export/highways${qs}`);
|
|
81
72
|
},
|
|
82
73
|
},
|
|
83
|
-
{
|
|
84
|
-
name: "intent_learn",
|
|
85
|
-
description: "Return unrecognized queries ranked by frequency to discover new intent patterns.",
|
|
86
|
-
inputSchema: {
|
|
87
|
-
type: "object",
|
|
88
|
-
properties: {
|
|
89
|
-
limit: { type: "number" },
|
|
90
|
-
minFrequency: { type: "number" },
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
handler: async (args, env) => {
|
|
94
|
-
const p = new URLSearchParams();
|
|
95
|
-
if (args.limit)
|
|
96
|
-
p.set("limit", String(args.limit));
|
|
97
|
-
if (args.minFrequency)
|
|
98
|
-
p.set("minFrequency", String(args.minFrequency));
|
|
99
|
-
const qs = p.toString() ? `?${p}` : "";
|
|
100
|
-
return apiCall(env.baseUrl, env.apiKey, `/api/intents/learn${qs}`);
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
74
|
{
|
|
104
75
|
name: "ingest_event",
|
|
105
76
|
description: "Ingest a pheromone event (kind: email|stripe|rating|analytics) into the substrate.",
|
|
@@ -111,9 +82,9 @@ export function observabilityTools() {
|
|
|
111
82
|
},
|
|
112
83
|
required: ["kind", "event"],
|
|
113
84
|
},
|
|
114
|
-
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/
|
|
85
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/signal/${encodeURIComponent(`ingest:${args.kind}`)}`, {
|
|
115
86
|
method: "POST",
|
|
116
|
-
body: JSON.stringify({ event: args.event }),
|
|
87
|
+
body: JSON.stringify({ data: { event: args.event } }),
|
|
117
88
|
}),
|
|
118
89
|
},
|
|
119
90
|
{
|
|
@@ -141,7 +112,7 @@ export function observabilityTools() {
|
|
|
141
112
|
headers.set("Content-Type", "application/json");
|
|
142
113
|
if (env.apiKey)
|
|
143
114
|
headers.set("Authorization", `Bearer ${env.apiKey}`);
|
|
144
|
-
const res = await fetch(`${env.baseUrl.replace(/\/$/, "")}/api/chat
|
|
115
|
+
const res = await fetch(`${env.baseUrl.replace(/\/$/, "")}/api/chat`, {
|
|
145
116
|
method: "POST",
|
|
146
117
|
headers,
|
|
147
118
|
body: JSON.stringify({
|
|
@@ -152,7 +123,7 @@ export function observabilityTools() {
|
|
|
152
123
|
}),
|
|
153
124
|
});
|
|
154
125
|
if (!res.ok)
|
|
155
|
-
throw new Error(`POST /api/chat
|
|
126
|
+
throw new Error(`POST /api/chat → ${res.status}`);
|
|
156
127
|
const raw = await res.text();
|
|
157
128
|
const nextTags = res.headers.get("X-Turn-Tags") ?? "";
|
|
158
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AAM,OAAO,GAAG,GAAG;qBAChB,KAAK,CAAC,IAAI,CAAC;qBACX,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;qBACzC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,GAAG,IAAI,CAAC;oBAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAAC,CAAC;gBAAC,MAAM,CAAC;oBAAC,OAAO,EAAE,CAAC;gBAAC,CAAC,CAAC,CAAC,CAAC;qBACnF,IAAI,CAAC,EAAE,CAAC,CAAC;gBACZ,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YACpF,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
async function apiCall(baseUrl, apiKey, path, init = {}) {
|
|
2
|
+
const headers = new Headers(init.headers);
|
|
3
|
+
headers.set("Accept", "application/json");
|
|
4
|
+
if (init.body && !headers.has("Content-Type"))
|
|
5
|
+
headers.set("Content-Type", "application/json");
|
|
6
|
+
if (apiKey)
|
|
7
|
+
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
8
|
+
const res = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, { ...init, headers });
|
|
9
|
+
if (!res.ok)
|
|
10
|
+
throw new Error(`${init.method ?? "GET"} ${path} → ${res.status}`);
|
|
11
|
+
if (res.status === 204)
|
|
12
|
+
return null;
|
|
13
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
14
|
+
return ct.includes("json") ? res.json() : res.text();
|
|
15
|
+
}
|
|
16
|
+
export function socialTools() {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
name: "social_list_posts",
|
|
20
|
+
description: "List social posts for a group. Filter by status; paginate with before cursor.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
groupId: { type: "string" },
|
|
25
|
+
status: {
|
|
26
|
+
type: "string",
|
|
27
|
+
enum: ["draft", "scheduled", "publishing", "published", "failed"],
|
|
28
|
+
},
|
|
29
|
+
limit: { type: "number" },
|
|
30
|
+
before: { type: "string", description: "scheduled_at epoch for pagination" },
|
|
31
|
+
},
|
|
32
|
+
required: ["groupId"],
|
|
33
|
+
},
|
|
34
|
+
handler: async (args, env) => {
|
|
35
|
+
const params = new URLSearchParams({ groupId: args.groupId });
|
|
36
|
+
if (args.status)
|
|
37
|
+
params.set("status", args.status);
|
|
38
|
+
if (args.limit)
|
|
39
|
+
params.set("limit", String(args.limit));
|
|
40
|
+
if (args.before)
|
|
41
|
+
params.set("before", args.before);
|
|
42
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/social/posts?${params}`);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "social_create_post",
|
|
47
|
+
description: "Create a draft social post for one or more platforms. Content is validated against platform character limits.",
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
groupId: { type: "string" },
|
|
52
|
+
content: { type: "string" },
|
|
53
|
+
platforms: {
|
|
54
|
+
type: "array",
|
|
55
|
+
items: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["twitter", "linkedin", "instagram", "tiktok", "facebook"],
|
|
58
|
+
},
|
|
59
|
+
minItems: 1,
|
|
60
|
+
},
|
|
61
|
+
scheduledAt: { type: "number", description: "Unix epoch seconds" },
|
|
62
|
+
mediaUrl: { type: "string" },
|
|
63
|
+
mediaType: { type: "string", enum: ["image", "video"] },
|
|
64
|
+
},
|
|
65
|
+
required: ["groupId", "content", "platforms"],
|
|
66
|
+
},
|
|
67
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, "/api/social/posts", {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: JSON.stringify(args),
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "social_accounts",
|
|
74
|
+
description: "List connected social media accounts for the authenticated user.",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {},
|
|
78
|
+
},
|
|
79
|
+
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey, "/api/social/accounts"),
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=social.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social.js","sourceRoot":"","sources":["../../src/tools/social.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,OAAO,CACpB,OAAe,EACf,MAA0B,EAC1B,IAAY,EACZ,OAAoB,EAAE;IAEtB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IAC1C,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IAC/F,IAAI,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACtF,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,IAA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L;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,kEAAkE;YAC/E,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE;aACf;YACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC;SAC3D;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/substrate.js
CHANGED
|
@@ -17,98 +17,354 @@ export function substrateTools() {
|
|
|
17
17
|
return [
|
|
18
18
|
{
|
|
19
19
|
name: "signal",
|
|
20
|
-
description: "
|
|
21
|
-
inputSchema: {
|
|
22
|
-
|
|
20
|
+
description: "Fire-and-forget signal to any receiver. Receiver namespacing reaches any capability: 'market:hire', 'inbox:workspace', 'agents:commend', 'groups:join', etc. Use this instead of dedicated tools for any action not listed explicitly.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: { receiver: { type: "string" }, data: {} },
|
|
24
|
+
required: ["receiver"],
|
|
25
|
+
},
|
|
26
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/signal/${encodeURIComponent(String(args.receiver))}`, {
|
|
23
27
|
method: "POST",
|
|
24
|
-
body: JSON.stringify({
|
|
28
|
+
body: JSON.stringify({ data: args.data }),
|
|
25
29
|
}),
|
|
26
30
|
},
|
|
27
31
|
{
|
|
28
32
|
name: "ask",
|
|
29
|
-
description: "Signal + wait for outcome (result | timeout | dissolved | failure).",
|
|
30
|
-
inputSchema: {
|
|
31
|
-
|
|
33
|
+
description: "Signal + wait for outcome (result | timeout | dissolved | failure). Receiver namespacing reaches any capability: 'stats:current', 'auth:sign-in', 'market:hire', 'agents:capabilities', etc. Use this instead of dedicated tools when you need a response.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: { receiver: { type: "string" }, data: {}, timeoutMs: { type: "number" } },
|
|
37
|
+
required: ["receiver"],
|
|
38
|
+
},
|
|
39
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/ask/${encodeURIComponent(String(args.receiver))}`, {
|
|
32
40
|
method: "POST",
|
|
33
|
-
body: JSON.stringify({
|
|
41
|
+
body: JSON.stringify({ data: args.data, timeoutMs: args.timeoutMs }),
|
|
34
42
|
}),
|
|
35
43
|
},
|
|
36
44
|
{
|
|
37
45
|
name: "mark",
|
|
38
|
-
description: "Strengthen a path.",
|
|
39
|
-
inputSchema: {
|
|
40
|
-
|
|
46
|
+
description: "Strengthen a path (pheromone deposit). Edge format: 'source>target'.",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: { edge: { type: "string" }, strength: { type: "number" } },
|
|
50
|
+
required: ["edge"],
|
|
51
|
+
},
|
|
52
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/mark/${encodeURIComponent(String(args.edge))}`, {
|
|
41
53
|
method: "POST",
|
|
42
|
-
body: JSON.stringify({
|
|
54
|
+
body: JSON.stringify({ strength: args.strength ?? 1 }),
|
|
43
55
|
}),
|
|
44
56
|
},
|
|
45
57
|
{
|
|
46
58
|
name: "warn",
|
|
47
|
-
description: "Raise resistance on a path.",
|
|
48
|
-
inputSchema: {
|
|
49
|
-
|
|
59
|
+
description: "Raise resistance on a path. Edge format: 'source>target'.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: { edge: { type: "string" }, strength: { type: "number" } },
|
|
63
|
+
required: ["edge"],
|
|
64
|
+
},
|
|
65
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/warn/${encodeURIComponent(String(args.edge))}`, {
|
|
50
66
|
method: "POST",
|
|
51
|
-
body: JSON.stringify({
|
|
67
|
+
body: JSON.stringify({ strength: args.strength ?? 1 }),
|
|
52
68
|
}),
|
|
53
69
|
},
|
|
54
70
|
{
|
|
55
71
|
name: "fade",
|
|
56
|
-
description: "Asymmetric decay of all paths.",
|
|
72
|
+
description: "Asymmetric decay of all paths (resistance forgives 2x faster than strength).",
|
|
57
73
|
inputSchema: { type: "object", properties: { rate: { type: "number" } } },
|
|
58
|
-
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey,
|
|
74
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, "/api/fade", {
|
|
75
|
+
method: "POST",
|
|
76
|
+
body: JSON.stringify({ rate: args.rate }),
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "follow",
|
|
81
|
+
description: "Deterministic path selection — returns the strongest path for a tag type.",
|
|
82
|
+
inputSchema: { type: "object", properties: { tag: { type: "string" } } },
|
|
83
|
+
handler: async (args, env) => {
|
|
84
|
+
const q = new URLSearchParams();
|
|
85
|
+
if (args.tag)
|
|
86
|
+
q.set("tag", String(args.tag));
|
|
87
|
+
const qs = q.toString();
|
|
88
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/follow${qs ? `?${qs}` : ""}`);
|
|
89
|
+
},
|
|
59
90
|
},
|
|
60
91
|
{
|
|
61
92
|
name: "select",
|
|
62
|
-
description: "Probabilistic path selection
|
|
63
|
-
inputSchema: {
|
|
93
|
+
description: "Probabilistic path selection — pheromone-weighted with exploration bias. Returns next target or null.",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
type: { type: "string", description: "Tag/type to route toward" },
|
|
98
|
+
exploration: { type: "number", description: "Exploration factor 0–1 (default 0.3)" },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
64
101
|
handler: async (args, env) => {
|
|
65
102
|
const q = new URLSearchParams();
|
|
66
103
|
if (args.type)
|
|
67
104
|
q.set("type", String(args.type));
|
|
68
|
-
|
|
69
|
-
|
|
105
|
+
if (args.exploration != null)
|
|
106
|
+
q.set("exploration", String(args.exploration));
|
|
107
|
+
const qs = q.toString();
|
|
108
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/select${qs ? `?${qs}` : ""}`);
|
|
70
109
|
},
|
|
71
110
|
},
|
|
72
111
|
{
|
|
73
112
|
name: "recall",
|
|
74
113
|
description: "Query hypotheses from the brain.",
|
|
75
|
-
inputSchema: {
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
status: { type: "string", enum: ["pending", "testing", "confirmed", "rejected"] },
|
|
118
|
+
search: { type: "string" },
|
|
119
|
+
limit: { type: "number" },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
76
122
|
handler: async (args, env) => {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
123
|
+
const q = new URLSearchParams();
|
|
124
|
+
if (args.status)
|
|
125
|
+
q.set("status", String(args.status));
|
|
126
|
+
if (args.search)
|
|
127
|
+
q.set("search", String(args.search));
|
|
128
|
+
if (args.limit)
|
|
129
|
+
q.set("limit", String(args.limit));
|
|
130
|
+
const qs = q.toString();
|
|
131
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/learning${qs ? `?${qs}` : ""}`);
|
|
81
132
|
},
|
|
82
133
|
},
|
|
83
134
|
{
|
|
84
135
|
name: "reveal",
|
|
85
136
|
description: "Full memory card for a uid.",
|
|
86
|
-
inputSchema: {
|
|
87
|
-
|
|
137
|
+
inputSchema: {
|
|
138
|
+
type: "object",
|
|
139
|
+
properties: { uid: { type: "string" } },
|
|
140
|
+
required: ["uid"],
|
|
141
|
+
},
|
|
142
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, `/api/pii/reveal/${encodeURIComponent(String(args.uid))}`),
|
|
88
143
|
},
|
|
89
144
|
{
|
|
90
145
|
name: "forget",
|
|
91
146
|
description: "GDPR erasure of a uid.",
|
|
92
|
-
inputSchema: {
|
|
93
|
-
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: { uid: { type: "string" } },
|
|
150
|
+
required: ["uid"],
|
|
151
|
+
},
|
|
152
|
+
handler: async (args, env) => apiCall(env.baseUrl, env.apiKey, "/api/forget", {
|
|
153
|
+
method: "POST",
|
|
154
|
+
body: JSON.stringify({ actorId: args.uid }),
|
|
155
|
+
}),
|
|
94
156
|
},
|
|
95
157
|
{
|
|
96
158
|
name: "frontier",
|
|
97
|
-
description: "Unexplored tag clusters
|
|
98
|
-
inputSchema: { type: "object", properties: {
|
|
99
|
-
handler: async (args, env) =>
|
|
159
|
+
description: "Unexplored tag clusters.",
|
|
160
|
+
inputSchema: { type: "object", properties: { limit: { type: "number" } } },
|
|
161
|
+
handler: async (args, env) => {
|
|
162
|
+
const q = new URLSearchParams();
|
|
163
|
+
if (args.limit)
|
|
164
|
+
q.set("limit", String(args.limit));
|
|
165
|
+
const qs = q.toString();
|
|
166
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/frontiers${qs ? `?${qs}` : ""}`);
|
|
167
|
+
},
|
|
100
168
|
},
|
|
101
169
|
{
|
|
102
170
|
name: "know",
|
|
103
171
|
description: "Promote highways to hypotheses (L6 learning).",
|
|
104
172
|
inputSchema: { type: "object", properties: {} },
|
|
105
|
-
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey,
|
|
173
|
+
handler: async (_args, env) => apiCall(env.baseUrl, env.apiKey, `/api/signal/${encodeURIComponent("learning:know")}`, {
|
|
174
|
+
method: "POST",
|
|
175
|
+
body: JSON.stringify({ data: {} }),
|
|
176
|
+
}),
|
|
106
177
|
},
|
|
107
178
|
{
|
|
108
179
|
name: "highways",
|
|
109
|
-
description: "Top weighted paths (proven routes).",
|
|
110
|
-
inputSchema: {
|
|
111
|
-
|
|
180
|
+
description: "Top weighted paths (proven routes). Optionally filter by source unit with 'from'.",
|
|
181
|
+
inputSchema: {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: { limit: { type: "number" }, from: { type: "string" } },
|
|
184
|
+
},
|
|
185
|
+
handler: async (args, env) => {
|
|
186
|
+
const q = new URLSearchParams({ limit: String(args.limit ?? 20) });
|
|
187
|
+
if (args.from)
|
|
188
|
+
q.set("from", String(args.from));
|
|
189
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/highways?${q}`);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "groups",
|
|
194
|
+
description: "List or get a group (dimension 1 — containers: worlds, teams, orgs). Pass gid for a single record.",
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
gid: { type: "string", description: "Group ID — returns single record" },
|
|
199
|
+
type: { type: "string" },
|
|
200
|
+
limit: { type: "number" },
|
|
201
|
+
after: { type: "string", description: "Cursor for pagination" },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
handler: async (args, env) => {
|
|
205
|
+
if (args.gid)
|
|
206
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/groups/${encodeURIComponent(String(args.gid))}`);
|
|
207
|
+
const q = new URLSearchParams();
|
|
208
|
+
if (args.type)
|
|
209
|
+
q.set("type", String(args.type));
|
|
210
|
+
if (args.limit)
|
|
211
|
+
q.set("limit", String(args.limit));
|
|
212
|
+
if (args.after)
|
|
213
|
+
q.set("after", String(args.after));
|
|
214
|
+
const qs = q.toString();
|
|
215
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/groups${qs ? `?${qs}` : ""}`);
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "actors",
|
|
220
|
+
description: "List or get an actor (dimension 2 — humans, agents, bots). Pass aid for a single record.",
|
|
221
|
+
inputSchema: {
|
|
222
|
+
type: "object",
|
|
223
|
+
properties: {
|
|
224
|
+
aid: { type: "string", description: "Actor ID — returns single record" },
|
|
225
|
+
type: { type: "string" },
|
|
226
|
+
tag: { type: "string" },
|
|
227
|
+
limit: { type: "number" },
|
|
228
|
+
after: { type: "string" },
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
handler: async (args, env) => {
|
|
232
|
+
if (args.aid)
|
|
233
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/actors/${encodeURIComponent(String(args.aid))}`);
|
|
234
|
+
const q = new URLSearchParams();
|
|
235
|
+
if (args.type)
|
|
236
|
+
q.set("type", String(args.type));
|
|
237
|
+
if (args.tag)
|
|
238
|
+
q.set("tag", String(args.tag));
|
|
239
|
+
if (args.limit)
|
|
240
|
+
q.set("limit", String(args.limit));
|
|
241
|
+
if (args.after)
|
|
242
|
+
q.set("after", String(args.after));
|
|
243
|
+
const qs = q.toString();
|
|
244
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/actors${qs ? `?${qs}` : ""}`);
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "things",
|
|
249
|
+
description: "List or get a thing (dimension 3 — skills, tasks, tokens, items). Pass tid for a single record.",
|
|
250
|
+
inputSchema: {
|
|
251
|
+
type: "object",
|
|
252
|
+
properties: {
|
|
253
|
+
tid: { type: "string", description: "Thing ID — returns single record" },
|
|
254
|
+
type: { type: "string" },
|
|
255
|
+
tag: { type: "string" },
|
|
256
|
+
limit: { type: "number" },
|
|
257
|
+
after: { type: "string" },
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
handler: async (args, env) => {
|
|
261
|
+
if (args.tid)
|
|
262
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/things/${encodeURIComponent(String(args.tid))}`);
|
|
263
|
+
const q = new URLSearchParams();
|
|
264
|
+
if (args.type)
|
|
265
|
+
q.set("type", String(args.type));
|
|
266
|
+
if (args.tag)
|
|
267
|
+
q.set("tag", String(args.tag));
|
|
268
|
+
if (args.limit)
|
|
269
|
+
q.set("limit", String(args.limit));
|
|
270
|
+
if (args.after)
|
|
271
|
+
q.set("after", String(args.after));
|
|
272
|
+
const qs = q.toString();
|
|
273
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/things${qs ? `?${qs}` : ""}`);
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "paths",
|
|
278
|
+
description: "List or get a path (dimension 4 — weighted connections with strength/resistance). Pass edge for a single record.",
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: "object",
|
|
281
|
+
properties: {
|
|
282
|
+
edge: { type: "string", description: "Edge identifier e.g. 'alice>bob' — returns single record" },
|
|
283
|
+
source: { type: "string" },
|
|
284
|
+
target: { type: "string" },
|
|
285
|
+
minStrength: { type: "number" },
|
|
286
|
+
limit: { type: "number" },
|
|
287
|
+
after: { type: "string" },
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
handler: async (args, env) => {
|
|
291
|
+
if (args.edge)
|
|
292
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/paths/${encodeURIComponent(String(args.edge))}`);
|
|
293
|
+
const q = new URLSearchParams();
|
|
294
|
+
if (args.source)
|
|
295
|
+
q.set("source", String(args.source));
|
|
296
|
+
if (args.target)
|
|
297
|
+
q.set("target", String(args.target));
|
|
298
|
+
if (args.minStrength)
|
|
299
|
+
q.set("minStrength", String(args.minStrength));
|
|
300
|
+
if (args.limit)
|
|
301
|
+
q.set("limit", String(args.limit));
|
|
302
|
+
if (args.after)
|
|
303
|
+
q.set("after", String(args.after));
|
|
304
|
+
const qs = q.toString();
|
|
305
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/export/paths${qs ? `?${qs}` : ""}`);
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: "events",
|
|
310
|
+
description: "List or get an event (dimension 5 — signals, payments, what happened). Pass id for a single record.",
|
|
311
|
+
inputSchema: {
|
|
312
|
+
type: "object",
|
|
313
|
+
properties: {
|
|
314
|
+
id: { type: "string", description: "Event ID — returns single record" },
|
|
315
|
+
actor: { type: "string" },
|
|
316
|
+
tag: { type: "string" },
|
|
317
|
+
from: { type: "string", description: "ISO timestamp — filter from" },
|
|
318
|
+
to: { type: "string", description: "ISO timestamp — filter to" },
|
|
319
|
+
limit: { type: "number" },
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
handler: async (args, env) => {
|
|
323
|
+
if (args.id)
|
|
324
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/events/${encodeURIComponent(String(args.id))}`);
|
|
325
|
+
const q = new URLSearchParams();
|
|
326
|
+
if (args.actor)
|
|
327
|
+
q.set("actor", String(args.actor));
|
|
328
|
+
if (args.tag)
|
|
329
|
+
q.set("tag", String(args.tag));
|
|
330
|
+
if (args.from)
|
|
331
|
+
q.set("from", String(args.from));
|
|
332
|
+
if (args.to)
|
|
333
|
+
q.set("to", String(args.to));
|
|
334
|
+
if (args.limit)
|
|
335
|
+
q.set("limit", String(args.limit));
|
|
336
|
+
const qs = q.toString();
|
|
337
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/events${qs ? `?${qs}` : ""}`);
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "learning",
|
|
342
|
+
description: "List or get a hypothesis (dimension 6 — what was discovered, confirmed patterns). Pass hid for a single record. Alias for recall with canonical name.",
|
|
343
|
+
inputSchema: {
|
|
344
|
+
type: "object",
|
|
345
|
+
properties: {
|
|
346
|
+
hid: { type: "string", description: "Hypothesis ID — returns single record" },
|
|
347
|
+
status: { type: "string", enum: ["pending", "testing", "confirmed", "rejected"] },
|
|
348
|
+
actor: { type: "string" },
|
|
349
|
+
tag: { type: "string" },
|
|
350
|
+
limit: { type: "number" },
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
handler: async (args, env) => {
|
|
354
|
+
if (args.hid)
|
|
355
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/learning/${encodeURIComponent(String(args.hid))}`);
|
|
356
|
+
const q = new URLSearchParams();
|
|
357
|
+
if (args.status)
|
|
358
|
+
q.set("status", String(args.status));
|
|
359
|
+
if (args.actor)
|
|
360
|
+
q.set("actor", String(args.actor));
|
|
361
|
+
if (args.tag)
|
|
362
|
+
q.set("tag", String(args.tag));
|
|
363
|
+
if (args.limit)
|
|
364
|
+
q.set("limit", String(args.limit));
|
|
365
|
+
const qs = q.toString();
|
|
366
|
+
return apiCall(env.baseUrl, env.apiKey, `/api/learning${qs ? `?${qs}` : ""}`);
|
|
367
|
+
},
|
|
112
368
|
},
|
|
113
369
|
];
|
|
114
370
|
}
|