@unoverse-platform/spatial 1.0.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/dist/SpatialSearch/node/executor.d.ts +15 -0
- package/dist/SpatialSearch/node/executor.d.ts.map +1 -0
- package/dist/SpatialSearch/node/executor.js +66 -0
- package/dist/SpatialSearch/node/executor.js.map +1 -0
- package/dist/SpatialSearch/node/index.d.ts +10 -0
- package/dist/SpatialSearch/node/index.d.ts.map +1 -0
- package/dist/SpatialSearch/node/index.js +79 -0
- package/dist/SpatialSearch/node/index.js.map +1 -0
- package/dist/SpatialSearch/service/searchClient.d.ts +81 -0
- package/dist/SpatialSearch/service/searchClient.d.ts.map +1 -0
- package/dist/SpatialSearch/service/searchClient.js +95 -0
- package/dist/SpatialSearch/service/searchClient.js.map +1 -0
- package/dist/SpatialSearch/service/skillClient.d.ts +47 -0
- package/dist/SpatialSearch/service/skillClient.d.ts.map +1 -0
- package/dist/SpatialSearch/service/skillClient.js +88 -0
- package/dist/SpatialSearch/service/skillClient.js.map +1 -0
- package/dist/SpatialSearch/util/types.d.ts +39 -0
- package/dist/SpatialSearch/util/types.d.ts.map +1 -0
- package/dist/SpatialSearch/util/types.js +6 -0
- package/dist/SpatialSearch/util/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/platform.d.ts +5 -0
- package/dist/shared/platform.d.ts.map +1 -0
- package/dist/shared/platform.js +22 -0
- package/dist/shared/platform.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spatial Search executor. A service node: it has no data-flow execution — it answers the
|
|
3
|
+
* MCP/tool channel (handleServiceCall) so a wired agent can discover (getSchema) and run
|
|
4
|
+
* (findIntent / discoverRelated) spatial searches. All real work is an HTTP call behind the
|
|
5
|
+
* platform's authenticated API.
|
|
6
|
+
*/
|
|
7
|
+
import { type NodeExecutionContext } from "@unoverse-platform/plugin-base";
|
|
8
|
+
import { PromiseNode } from "../../shared/platform";
|
|
9
|
+
import type { SpatialSearchConfig } from "../util/types";
|
|
10
|
+
export default class SpatialSearchExecutor extends PromiseNode<SpatialSearchConfig> {
|
|
11
|
+
constructor();
|
|
12
|
+
protected executeNode(): Promise<any>;
|
|
13
|
+
handleServiceCall(method: string, params: any, config: SpatialSearchConfig, context: NodeExecutionContext): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/SpatialSearch/node/executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAkB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAMzE,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,WAAW,CAAC,mBAAmB,CAAC;;cAKjE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAMrC,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,GAAG,CAAC;CA2DhB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const agent_mcp_1 = require("@unoverse-platform/plugin-base/agent-mcp");
|
|
4
|
+
const platform_1 = require("../../shared/platform");
|
|
5
|
+
const searchClient_1 = require("../service/searchClient");
|
|
6
|
+
const skillClient_1 = require("../service/skillClient");
|
|
7
|
+
const NODE_TYPE = "SpatialSearch";
|
|
8
|
+
class SpatialSearchExecutor extends platform_1.PromiseNode {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(NODE_TYPE);
|
|
11
|
+
}
|
|
12
|
+
async executeNode() {
|
|
13
|
+
throw new Error("SpatialSearch is a service node — attach it to an agent via a service edge; it is not run inline.");
|
|
14
|
+
}
|
|
15
|
+
async handleServiceCall(method, params, config, context) {
|
|
16
|
+
const logger = (0, platform_1.createLogger)("SpatialSearch");
|
|
17
|
+
// Tool discovery.
|
|
18
|
+
if (method === "getSchema")
|
|
19
|
+
return searchClient_1.SPATIAL_SCHEMA;
|
|
20
|
+
// Skill tools — read a discovered skill's instructions / a referenced resource file.
|
|
21
|
+
if (method === "readSkill")
|
|
22
|
+
return (0, skillClient_1.readSkill)(params, context);
|
|
23
|
+
if (method === "readSkillFile")
|
|
24
|
+
return (0, skillClient_1.readSkillFile)(params, context);
|
|
25
|
+
const mode = (0, searchClient_1.modeForMethod)(method);
|
|
26
|
+
if (!mode)
|
|
27
|
+
throw new Error(`SpatialSearch: unknown method "${method}"`);
|
|
28
|
+
// Author-set result filters (from node config) shape what the agent's search returns.
|
|
29
|
+
const filters = {
|
|
30
|
+
includeImages: config?.includeImages,
|
|
31
|
+
includeNeeds: config?.includeNeeds,
|
|
32
|
+
includeServices: config?.includeServices,
|
|
33
|
+
includeActions: config?.includeActions,
|
|
34
|
+
includeSkills: config?.includeSkills,
|
|
35
|
+
includeMcps: config?.includeMcps,
|
|
36
|
+
};
|
|
37
|
+
// maxResults + threshold + filters come from the NODE CONFIG (authoritative) — never from the agent's args.
|
|
38
|
+
const result = await (0, searchClient_1.runSearch)(mode, {
|
|
39
|
+
query: params?.query,
|
|
40
|
+
maxResults: config?.maxResults,
|
|
41
|
+
similarityThreshold: config?.similarityThreshold,
|
|
42
|
+
filters,
|
|
43
|
+
}, context);
|
|
44
|
+
logger.info("spatial search complete", { method, count: result.results?.length ?? 0 });
|
|
45
|
+
// CONTENT CARDS render DATA-DRIVEN, from the search that surfaced them
|
|
46
|
+
// (UNOVERSE_MCP_TEMPLATE_PROTOCOL §4b): a result row with a component app
|
|
47
|
+
// attached (`metadata.app`) renders its card on the caller's live session the
|
|
48
|
+
// moment it surfaces — never as a model tool, no prompt anywhere. The lane
|
|
49
|
+
// lives HERE so EVERY agent family gets it by wiring this node. The session
|
|
50
|
+
// identity is the execution's `publishingContext` (trigger-supplied); with no
|
|
51
|
+
// live session (builder/test/headless callers) rendering no-ops and the
|
|
52
|
+
// search stays pure. Author opt-out: node config `renderCards: false`.
|
|
53
|
+
if (config?.renderCards !== false) {
|
|
54
|
+
const pub = context?.publishingContext;
|
|
55
|
+
(0, agent_mcp_1.renderContentCards)((0, agent_mcp_1.contentCardsFromResults)(result.results), {
|
|
56
|
+
userId: pub?.userId,
|
|
57
|
+
conversationId: pub?.conversationId,
|
|
58
|
+
chatId: pub?.chatId,
|
|
59
|
+
accessToken: context?.auth?.accessToken,
|
|
60
|
+
}, (m) => logger.info(m));
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = SpatialSearchExecutor;
|
|
66
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../src/SpatialSearch/node/executor.ts"],"names":[],"mappings":";;AAOA,wEAAuG;AACvG,oDAAkE;AAElE,0DAAmF;AACnF,wDAAkE;AAElE,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,MAAqB,qBAAsB,SAAQ,sBAAgC;IACjF;QACE,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAES,KAAK,CAAC,WAAW;QACzB,MAAM,IAAI,KAAK,CACb,mGAAmG,CACpG,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,MAAc,EACd,MAAW,EACX,MAA2B,EAC3B,OAA6B;QAE7B,MAAM,MAAM,GAAG,IAAA,uBAAY,EAAC,eAAe,CAAC,CAAC;QAE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AAM,GAAG,GAAG,OAAO,EAAE,iBAAiB,CAAC;YACvC,IAAA,8BAAkB,EAChB,IAAA,mCAAuB,EAAC,MAAM,CAAC,OAAO,CAAC,EACvC;gBACE,MAAM,EAAE,GAAG,EAAE,MAAM;gBACnB,cAAc,EAAE,GAAG,EAAE,cAAc;gBACnC,MAAM,EAAE,GAAG,EAAE,MAAM;gBACnB,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW;aACxC,EACD,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAC9B,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3ED,wCA2EC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type EnhancedNodeDefinition } from "@unoverse-platform/plugin-base";
|
|
2
|
+
import SpatialSearchExecutor from "./executor";
|
|
3
|
+
export declare const NODE_TYPE = "SpatialSearch";
|
|
4
|
+
declare function createNodeDefinition(): EnhancedNodeDefinition;
|
|
5
|
+
export declare const SpatialSearchNode: {
|
|
6
|
+
definition: any;
|
|
7
|
+
executor: typeof SpatialSearchExecutor;
|
|
8
|
+
};
|
|
9
|
+
export { createNodeDefinition };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/SpatialSearch/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,SAAS,kBAAkB,CAAC;AAEzC,iBAAS,oBAAoB,IAAI,sBAAsB,CAkEtD;AAID,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SpatialSearchNode = exports.NODE_TYPE = void 0;
|
|
7
|
+
exports.createNodeDefinition = createNodeDefinition;
|
|
8
|
+
const executor_1 = __importDefault(require("./executor"));
|
|
9
|
+
exports.NODE_TYPE = "SpatialSearch";
|
|
10
|
+
function createNodeDefinition() {
|
|
11
|
+
return {
|
|
12
|
+
packageVersion: "1.0.0",
|
|
13
|
+
type: exports.NODE_TYPE,
|
|
14
|
+
name: "Spatial Search",
|
|
15
|
+
description: "Search the platform knowledge base for the needs, skills, services and content most relevant to a query.",
|
|
16
|
+
whenToUse: "Pick to give an agent semantic search over the platform's own knowledge base — find the needs, skills, services and content most relevant to a query, and discover what else lives near a topic. Two tools in one: precise intent lookup and spatial discovery. Reach elsewhere when the knowledge lives in an external vector store. Attach via a service edge to the agent node; it is not a data-flow step.",
|
|
17
|
+
category: "Knowledge & Vectors",
|
|
18
|
+
color: "#8b5cf6",
|
|
19
|
+
logoUrl: "https://res.cloudinary.com/sonik/image/upload/v1751366180/gravity/icons/gravityIcon.png",
|
|
20
|
+
template: "service",
|
|
21
|
+
inputs: [],
|
|
22
|
+
outputs: [],
|
|
23
|
+
serviceConnectors: [
|
|
24
|
+
{
|
|
25
|
+
name: "knowledgeSearch",
|
|
26
|
+
description: "Semantic + spatial search tools for an agent",
|
|
27
|
+
serviceType: "mcp",
|
|
28
|
+
methods: ["getSchema", "findIntent", "discoverRelated", "readSkill", "readSkillFile"],
|
|
29
|
+
isService: true, // PROVIDES search tools to a consuming agent
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
// Ported from the legacy core SpatialSearch: the author shapes what an agent's searches
|
|
33
|
+
// return (result types, thresholds, caps). No credential — the node calls the platform's
|
|
34
|
+
// own search API internally and forwards the request's auth token.
|
|
35
|
+
configSchema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
maxResults: {
|
|
39
|
+
type: "integer",
|
|
40
|
+
title: "Max Results",
|
|
41
|
+
description: "Maximum total results to return (safety cap)",
|
|
42
|
+
default: 10,
|
|
43
|
+
minimum: 5,
|
|
44
|
+
maximum: 30,
|
|
45
|
+
},
|
|
46
|
+
similarityThreshold: {
|
|
47
|
+
type: "number",
|
|
48
|
+
title: "Min Similarity (Intent)",
|
|
49
|
+
description: "Precision floor for findIntent (0–0.9). Results scoring below this cosine similarity are dropped. Discovery is unaffected (it ranks by spatial distance).",
|
|
50
|
+
default: 0.35,
|
|
51
|
+
minimum: 0,
|
|
52
|
+
maximum: 0.9,
|
|
53
|
+
},
|
|
54
|
+
includeImages: { type: "boolean", title: "Include Images", description: "Fetch images from results", default: false },
|
|
55
|
+
includeNeeds: { type: "boolean", title: "Include Needs", description: "Fetch needs from results", default: false },
|
|
56
|
+
includeServices: { type: "boolean", title: "Include Services", description: "Fetch services from results", default: false },
|
|
57
|
+
includeActions: { type: "boolean", title: "Include Actions", description: "Fetch actions from results", default: false },
|
|
58
|
+
includeSkills: { type: "boolean", title: "Include Skills", description: "Fetch skills (behavioral instructions)", default: true },
|
|
59
|
+
includeMcps: { type: "boolean", title: "Include MCP", description: "Fetch MCP workflows from results", default: false },
|
|
60
|
+
renderCards: {
|
|
61
|
+
type: "boolean",
|
|
62
|
+
title: "Render Content Cards",
|
|
63
|
+
description: "Auto-render cards for result rows that carry a component app (metadata.app) — data-driven, in the caller's conversation. No-ops for callers without a live session.",
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
required: [],
|
|
68
|
+
},
|
|
69
|
+
capabilities: {
|
|
70
|
+
isTrigger: false,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const definition = createNodeDefinition();
|
|
75
|
+
exports.SpatialSearchNode = {
|
|
76
|
+
definition,
|
|
77
|
+
executor: executor_1.default,
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/SpatialSearch/node/index.ts"],"names":[],"mappings":";;;;;;AAgFS,oDAAoB;AA/E7B,0DAA+C;AAElC,QAAA,SAAS,GAAG,eAAe,CAAC;AAEzC,SAAS,oBAAoB;IAC3B,OAAO;QACL,cAAc,EAAE,OAAO;QACvB,IAAI,EAAE,iBAAS;QACf,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,0GAA0G;QACvH,SAAS,EACP,gZAAgZ;QAClZ,QAAQ,EAAE,qBAAqB;QAC/B,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,yFAAyF;QAClG,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;QACX,iBAAiB,EAAE;YACjB;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,8CAA8C;gBAC3D,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,CAAC;gBACrF,SAAS,EAAE,IAAI,EAAE,6CAA6C;aAC/D;SACF;QACD,wFAAwF;QACxF,yFAAyF;QACzF,mEAAmE;QACnE,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,aAAa;oBACpB,WAAW,EAAE,8CAA8C;oBAC3D,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,EAAE;iBACZ;gBACD,mBAAmB,EAAE;oBACnB,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,yBAAyB;oBAChC,WAAW,EACT,2JAA2J;oBAC7J,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,CAAC;o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
3
|
+
* spatial search API over HTTP. No DB, no engine internals (that all stays behind the API).
|
|
4
|
+
*
|
|
5
|
+
* Auth: forward the end-user's session token (context.auth.accessToken) as Bearer by default
|
|
6
|
+
* (Case A, shared IdP); if the connection credential carries a machine `apiKey`, use that
|
|
7
|
+
* instead (Case B, cross-domain).
|
|
8
|
+
*/
|
|
9
|
+
import type { SpatialFilters, SpatialMode, SpatialSearchResponse } from "../util/types";
|
|
10
|
+
/** The two search tools this node exposes to an agent (mirrors the platform's spatial MCP). */
|
|
11
|
+
export declare const SPATIAL_SCHEMA: {
|
|
12
|
+
readonly instructions: "You have access to the platform knowledge base with two search tools that answer DIFFERENT questions. Choose one based on the shape of the user's request — do not call both by default.\n\nKNOWLEDGE PROTOCOL (MANDATORY — do not skip):\n\nPhase 0 — Choose ONE search tool (think before calling):\n- findIntent = PRECISION. Answers \"what is the user asking for?\" — pinpoints the specific matches for a concrete request, pulled from wherever they live in the knowledge space. This is the DEFAULT; use it whenever the user KNOWS what they want (\"how do I...\", \"help me with...\", \"I want X\"). SEARCH before answering.\n- discoverRelated = OPTIONS. Answers \"what can the user choose from?\" — content is grouped by need, so this surfaces the cluster of related choices in a topic's neighborhood. Use it ONLY to PRESENT options/decisions to a user who is exploring, undecided, or asking open-endedly (\"what's available?\", \"tell me about...\", \"recommend...\").\n- Do NOT call both in parallel.\n\nPhase 0b — Escalate only on weak results: if findIntent's top results are weak, THEN follow up with discoverRelated before answering. Strong results → answer from them directly.\n\nPhase 1 — MANDATORY skill follow-up: if ANY result has object_type=\"skill\", you MUST call readSkill(skillName) BEFORE responding. Skills contain behavioral instructions that OVERRIDE your general behavior — treat them as authoritative and follow them exactly. Check ALL results for skills, not just the top one. Use readSkillFile when a skill references additional files. Results may also include MCP apps — callable tools you can invoke to run that app.\n\nGolden Rules:\n- Search FIRST, build understanding SECOND, answer THIRD.\n- NEVER skip reading a skill when one appears in results.\n- NEVER make up information — use only what the tools return.";
|
|
13
|
+
readonly methods: {
|
|
14
|
+
readonly readSkill: {
|
|
15
|
+
readonly description: "Read the complete SKILL.md for a discovered skill. MANDATORY when any search result has object_type=\"skill\". Skills contain authoritative step-by-step instructions, triggers, and references that you MUST follow — they override your general behavior. Returns the full instructions + a list of available reference files.";
|
|
16
|
+
readonly input: {
|
|
17
|
+
readonly type: "object";
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly skillName: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "The skill's slug from the result — its lowercase-hyphenated name, not the display title";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly required: readonly ["skillName"];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly readSkillFile: {
|
|
28
|
+
readonly description: "Read a reference document, script, or asset belonging to a skill. Use only after calling readSkill and seeing the file listed in its references.";
|
|
29
|
+
readonly input: {
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly properties: {
|
|
32
|
+
readonly skillName: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly description: "The skill's slug (same as passed to readSkill)";
|
|
35
|
+
};
|
|
36
|
+
readonly filePath: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly description: "Path relative to the skill folder (no leading / or ..)";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
readonly required: readonly ["skillName", "filePath"];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly findIntent: {
|
|
45
|
+
readonly description: "Precision search — the DEFAULT. Answers \"what is the user asking for?\" by pinpointing the specific matches for a concrete request, pulled from wherever they live in the knowledge space. Use it whenever the user KNOWS what they want (a question, a task, a specific thing to find). Pass the user's EXACT words — do not paraphrase. If ANY result has object_type=\"skill\", you MUST call readSkill before responding; check ALL results, not just the top one. Do not pair with discoverRelated by default.";
|
|
46
|
+
readonly input: {
|
|
47
|
+
readonly type: "object";
|
|
48
|
+
readonly properties: {
|
|
49
|
+
readonly query: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "The user's exact question or intent — pass their original words verbatim";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly required: readonly ["query"];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly discoverRelated: {
|
|
58
|
+
readonly description: "Discovery search — NOT the default. Answers \"what are the options here?\" by surfacing the cluster of related choices in a topic's neighborhood (content is grouped by need, so nearby items are the alternatives a user could pick from). Use it to PRESENT options/decisions to a user who is exploring, undecided, or asking open-endedly (\"what's available?\", \"tell me about...\", \"recommend...\"), or as a fallback when findIntent's results were too weak. Low similarity is normal — these are neighbors, not exact matches.";
|
|
59
|
+
readonly input: {
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly properties: {
|
|
62
|
+
readonly query: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly description: "The topic or concept to explore";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly required: readonly ["query"];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** Map an exposed tool method to the platform search mode. */
|
|
73
|
+
export declare function modeForMethod(method: string): SpatialMode | undefined;
|
|
74
|
+
/** Call POST {base}/spatial/search. Returns the platform's results, top-level. */
|
|
75
|
+
export declare function runSearch(mode: SpatialMode, params: {
|
|
76
|
+
query: string;
|
|
77
|
+
maxResults?: number;
|
|
78
|
+
similarityThreshold?: number;
|
|
79
|
+
filters?: SpatialFilters;
|
|
80
|
+
}, context: any): Promise<SpatialSearchResponse>;
|
|
81
|
+
//# sourceMappingURL=searchClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchClient.d.ts","sourceRoot":"","sources":["../../../src/SpatialSearch/service/searchClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAcxF,+FAA+F;AAC/F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCjB,CAAC;AAEX,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAIrE;AAED,kFAAkF;AAClF,wBAAsB,SAAS,CAC7B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,EACtG,OAAO,EAAE,GAAG,GACX,OAAO,CAAC,qBAAqB,CAAC,CA8BhC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SPATIAL_SCHEMA = void 0;
|
|
4
|
+
exports.modeForMethod = modeForMethod;
|
|
5
|
+
exports.runSearch = runSearch;
|
|
6
|
+
const skillClient_1 = require("./skillClient");
|
|
7
|
+
// The platform's own search API. In-process the node reaches the engine on the standard
|
|
8
|
+
// internal service URL (WORKFLOW_SERVICE_URL — the same one the node host already uses); no
|
|
9
|
+
// per-node credential. Auth is the forwarded request token.
|
|
10
|
+
function spatialApiBase() {
|
|
11
|
+
return (process.env.WORKFLOW_SERVICE_URL || "http://localhost:4101").replace(/\/$/, "");
|
|
12
|
+
}
|
|
13
|
+
// Pure module — no platform init dependency, so it's unit-testable standalone. The executor
|
|
14
|
+
// (which runs inside the platform) uses the real platform logger; here console is enough.
|
|
15
|
+
const logger = { info: (...a) => console.log("[SpatialSearch]", ...a) };
|
|
16
|
+
/** The two search tools this node exposes to an agent (mirrors the platform's spatial MCP). */
|
|
17
|
+
exports.SPATIAL_SCHEMA = {
|
|
18
|
+
instructions: `You have access to the platform knowledge base with two search tools that answer DIFFERENT questions. Choose one based on the shape of the user's request — do not call both by default.
|
|
19
|
+
|
|
20
|
+
KNOWLEDGE PROTOCOL (MANDATORY — do not skip):
|
|
21
|
+
|
|
22
|
+
Phase 0 — Choose ONE search tool (think before calling):
|
|
23
|
+
- findIntent = PRECISION. Answers "what is the user asking for?" — pinpoints the specific matches for a concrete request, pulled from wherever they live in the knowledge space. This is the DEFAULT; use it whenever the user KNOWS what they want ("how do I...", "help me with...", "I want X"). SEARCH before answering.
|
|
24
|
+
- discoverRelated = OPTIONS. Answers "what can the user choose from?" — content is grouped by need, so this surfaces the cluster of related choices in a topic's neighborhood. Use it ONLY to PRESENT options/decisions to a user who is exploring, undecided, or asking open-endedly ("what's available?", "tell me about...", "recommend...").
|
|
25
|
+
- Do NOT call both in parallel.
|
|
26
|
+
|
|
27
|
+
Phase 0b — Escalate only on weak results: if findIntent's top results are weak, THEN follow up with discoverRelated before answering. Strong results → answer from them directly.
|
|
28
|
+
|
|
29
|
+
Phase 1 — MANDATORY skill follow-up: if ANY result has object_type="skill", you MUST call readSkill(skillName) BEFORE responding. Skills contain behavioral instructions that OVERRIDE your general behavior — treat them as authoritative and follow them exactly. Check ALL results for skills, not just the top one. Use readSkillFile when a skill references additional files. Results may also include MCP apps — callable tools you can invoke to run that app.
|
|
30
|
+
|
|
31
|
+
Golden Rules:
|
|
32
|
+
- Search FIRST, build understanding SECOND, answer THIRD.
|
|
33
|
+
- NEVER skip reading a skill when one appears in results.
|
|
34
|
+
- NEVER make up information — use only what the tools return.`,
|
|
35
|
+
methods: {
|
|
36
|
+
findIntent: {
|
|
37
|
+
description: `Precision search — the DEFAULT. Answers "what is the user asking for?" by pinpointing the specific matches for a concrete request, pulled from wherever they live in the knowledge space. Use it whenever the user KNOWS what they want (a question, a task, a specific thing to find). Pass the user's EXACT words — do not paraphrase. If ANY result has object_type="skill", you MUST call readSkill before responding; check ALL results, not just the top one. Do not pair with discoverRelated by default.`,
|
|
38
|
+
input: {
|
|
39
|
+
type: "object",
|
|
40
|
+
// query only — result count + which types come back are set by the node config, not the agent.
|
|
41
|
+
properties: { query: { type: "string", description: "The user's exact question or intent — pass their original words verbatim" } },
|
|
42
|
+
required: ["query"],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
discoverRelated: {
|
|
46
|
+
description: `Discovery search — NOT the default. Answers "what are the options here?" by surfacing the cluster of related choices in a topic's neighborhood (content is grouped by need, so nearby items are the alternatives a user could pick from). Use it to PRESENT options/decisions to a user who is exploring, undecided, or asking open-endedly ("what's available?", "tell me about...", "recommend..."), or as a fallback when findIntent's results were too weak. Low similarity is normal — these are neighbors, not exact matches.`,
|
|
47
|
+
input: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: { query: { type: "string", description: "The topic or concept to explore" } },
|
|
50
|
+
required: ["query"],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
// Read + work with skills the searches surface.
|
|
54
|
+
...skillClient_1.SKILL_METHODS,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
/** Map an exposed tool method to the platform search mode. */
|
|
58
|
+
function modeForMethod(method) {
|
|
59
|
+
if (method === "findIntent")
|
|
60
|
+
return "intent";
|
|
61
|
+
if (method === "discoverRelated")
|
|
62
|
+
return "related";
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
/** Call POST {base}/spatial/search. Returns the platform's results, top-level. */
|
|
66
|
+
async function runSearch(mode, params, context) {
|
|
67
|
+
if (!params?.query)
|
|
68
|
+
throw new Error("SpatialSearch: query is required");
|
|
69
|
+
const token = context?.auth?.accessToken; // forward the request's user token (auth-gated /api path)
|
|
70
|
+
const url = `${spatialApiBase()}/spatial/search`;
|
|
71
|
+
const body = {
|
|
72
|
+
query: params.query,
|
|
73
|
+
mode,
|
|
74
|
+
maxResults: params.maxResults ?? 10,
|
|
75
|
+
// Omit when unset so the server's default floor applies.
|
|
76
|
+
...(params.similarityThreshold != null ? { similarityThreshold: params.similarityThreshold } : {}),
|
|
77
|
+
workflowId: context?.workflowId,
|
|
78
|
+
...(params.filters ?? {}),
|
|
79
|
+
};
|
|
80
|
+
logger.info("spatial search", { mode, url, hasToken: !!token });
|
|
81
|
+
const res = await fetch(url, {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: {
|
|
84
|
+
"content-type": "application/json",
|
|
85
|
+
...(token ? { authorization: `Bearer ${token}` } : {}),
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify(body),
|
|
88
|
+
});
|
|
89
|
+
if (!res.ok) {
|
|
90
|
+
const detail = await res.text().catch(() => "");
|
|
91
|
+
throw new Error(`spatial/search failed: ${res.status} ${detail.slice(0, 300)}`);
|
|
92
|
+
}
|
|
93
|
+
return (await res.json());
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=searchClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchClient.js","sourceRoot":"","sources":["../../../src/SpatialSearch/service/searchClient.ts"],"names":[],"mappings":";;;AAiEA,sCAIC;AAGD,8BAkCC;AAjGD,+CAA8C;AAE9C,wFAAwF;AACxF,4FAA4F;AAC5F,4DAA4D;AAC5D,SAAS,cAAc;IACrB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,4FAA4F;AAC5F,0FAA0F;AAC1F,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAE/E,+FAA+F;AAClF,QAAA,cAAc,GAAG;IAC5B,YAAY,EAAE;;;;;;;;;;;;;;;;8DAgB8C;IAC5D,OAAO,EAAE;QACP,UAAU,EAAE;YACV,WAAW,EAAE,kfAAkf;YAC/f,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,+FAA+F;gBAC/F,UAAU,EAAE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C/B,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;KAC1B,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAChE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA0B,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** getSchema entries for the two skill tools — merged into the node's SPATIAL_SCHEMA. */
|
|
2
|
+
export declare const SKILL_METHODS: {
|
|
3
|
+
readonly readSkill: {
|
|
4
|
+
readonly description: "Read the complete SKILL.md for a discovered skill. MANDATORY when any search result has object_type=\"skill\". Skills contain authoritative step-by-step instructions, triggers, and references that you MUST follow — they override your general behavior. Returns the full instructions + a list of available reference files.";
|
|
5
|
+
readonly input: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly skillName: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "The skill's slug from the result — its lowercase-hyphenated name, not the display title";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
readonly required: readonly ["skillName"];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly readSkillFile: {
|
|
17
|
+
readonly description: "Read a reference document, script, or asset belonging to a skill. Use only after calling readSkill and seeing the file listed in its references.";
|
|
18
|
+
readonly input: {
|
|
19
|
+
readonly type: "object";
|
|
20
|
+
readonly properties: {
|
|
21
|
+
readonly skillName: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly description: "The skill's slug (same as passed to readSkill)";
|
|
24
|
+
};
|
|
25
|
+
readonly filePath: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "Path relative to the skill folder (no leading / or ..)";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly required: readonly ["skillName", "filePath"];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** readSkill — GET {base}/skills/{name} → the skill's instructions.
|
|
35
|
+
* GUARD: readSkill reads ONLY real skills. If the name isn't a skill (404 — it's an app,
|
|
36
|
+
* a component, a need, etc.), return a CORRECTIVE result instead of throwing, so a confused
|
|
37
|
+
* model self-corrects (invoke the app as a tool) rather than crashing the turn. Only a real
|
|
38
|
+
* server failure (non-404) throws. */
|
|
39
|
+
export declare function readSkill(params: {
|
|
40
|
+
skillName: string;
|
|
41
|
+
}, context: any): Promise<any>;
|
|
42
|
+
/** readSkillFile — GET {base}/skills/{name}/file?path=... → a resource file's content. */
|
|
43
|
+
export declare function readSkillFile(params: {
|
|
44
|
+
skillName: string;
|
|
45
|
+
filePath: string;
|
|
46
|
+
}, context: any): Promise<any>;
|
|
47
|
+
//# sourceMappingURL=skillClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillClient.d.ts","sourceRoot":"","sources":["../../../src/SpatialSearch/service/skillClient.ts"],"names":[],"mappings":"AAkBA,yFAAyF;AACzF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhB,CAAC;AAEX;;;;uCAIuC;AACvC,wBAAsB,SAAS,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAezF;AAED,0FAA0F;AAC1F,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAY/G"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SKILL_METHODS = void 0;
|
|
4
|
+
exports.readSkill = readSkill;
|
|
5
|
+
exports.readSkillFile = readSkillFile;
|
|
6
|
+
/**
|
|
7
|
+
* Skill tools — read a discovered skill's instructions + its resource files. Both are plain
|
|
8
|
+
* HTTP calls to the platform's skill server (the same endpoints the legacy node used); no DB,
|
|
9
|
+
* no engine internals. Skills are served on the internal lane (UNOVERSE_SERVICE_URL); the
|
|
10
|
+
* request's token is forwarded so the gated lane works too.
|
|
11
|
+
*/
|
|
12
|
+
const logger = { info: (...a) => console.log("[SpatialSearch:skills]", ...a) };
|
|
13
|
+
/** The platform's skill server (internal lane by default — same env the legacy reader used). */
|
|
14
|
+
function skillApiBase() {
|
|
15
|
+
return (process.env.UNOVERSE_SERVICE_URL || "http://localhost:4106").replace(/\/$/, "");
|
|
16
|
+
}
|
|
17
|
+
function authHeaders(context) {
|
|
18
|
+
const token = context?.auth?.accessToken;
|
|
19
|
+
return token ? { authorization: `Bearer ${token}` } : {};
|
|
20
|
+
}
|
|
21
|
+
/** getSchema entries for the two skill tools — merged into the node's SPATIAL_SCHEMA. */
|
|
22
|
+
exports.SKILL_METHODS = {
|
|
23
|
+
readSkill: {
|
|
24
|
+
description: `Read the complete SKILL.md for a discovered skill. MANDATORY when any search result has object_type="skill". Skills contain authoritative step-by-step instructions, triggers, and references that you MUST follow — they override your general behavior. Returns the full instructions + a list of available reference files.`,
|
|
25
|
+
input: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
skillName: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "The skill's slug from the result — its lowercase-hyphenated name, not the display title",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["skillName"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
readSkillFile: {
|
|
37
|
+
description: `Read a reference document, script, or asset belonging to a skill. Use only after calling readSkill and seeing the file listed in its references.`,
|
|
38
|
+
input: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
skillName: { type: "string", description: "The skill's slug (same as passed to readSkill)" },
|
|
42
|
+
filePath: { type: "string", description: "Path relative to the skill folder (no leading / or ..)" },
|
|
43
|
+
},
|
|
44
|
+
required: ["skillName", "filePath"],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
/** readSkill — GET {base}/skills/{name} → the skill's instructions.
|
|
49
|
+
* GUARD: readSkill reads ONLY real skills. If the name isn't a skill (404 — it's an app,
|
|
50
|
+
* a component, a need, etc.), return a CORRECTIVE result instead of throwing, so a confused
|
|
51
|
+
* model self-corrects (invoke the app as a tool) rather than crashing the turn. Only a real
|
|
52
|
+
* server failure (non-404) throws. */
|
|
53
|
+
async function readSkill(params, context) {
|
|
54
|
+
const skillName = params?.skillName;
|
|
55
|
+
if (!skillName)
|
|
56
|
+
throw new Error("SpatialSearch: skillName is required");
|
|
57
|
+
const url = `${skillApiBase()}/skills/${encodeURIComponent(skillName)}`;
|
|
58
|
+
logger.info("readSkill", { skillName });
|
|
59
|
+
const res = await fetch(url, { headers: authHeaders(context) });
|
|
60
|
+
if (res.status === 404) {
|
|
61
|
+
logger.info("readSkill guard: not a skill", { skillName });
|
|
62
|
+
return {
|
|
63
|
+
notASkill: true,
|
|
64
|
+
error: `"${skillName}" is not a skill. readSkill reads ONLY skills (object_type="skill"). If it appeared as an app or component (object_type="mcp"), invoke it as a tool — do not readSkill it.`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (!res.ok)
|
|
68
|
+
throw new Error(`readSkill failed: ${res.status} ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
69
|
+
return res.json();
|
|
70
|
+
}
|
|
71
|
+
/** readSkillFile — GET {base}/skills/{name}/file?path=... → a resource file's content. */
|
|
72
|
+
async function readSkillFile(params, context) {
|
|
73
|
+
const { skillName, filePath } = params ?? {};
|
|
74
|
+
if (!skillName || !filePath)
|
|
75
|
+
throw new Error("SpatialSearch: skillName and filePath are required");
|
|
76
|
+
if (filePath.includes("..") || filePath.startsWith("/"))
|
|
77
|
+
throw new Error("SpatialSearch: invalid file path");
|
|
78
|
+
const url = `${skillApiBase()}/skills/${encodeURIComponent(skillName)}/file?path=${encodeURIComponent(filePath)}`;
|
|
79
|
+
logger.info("readSkillFile", { skillName, filePath });
|
|
80
|
+
const res = await fetch(url, { headers: authHeaders(context) });
|
|
81
|
+
if (res.status === 404) {
|
|
82
|
+
return { notFound: true, error: `No skill file "${filePath}" for skill "${skillName}" (the skill or file does not exist).` };
|
|
83
|
+
}
|
|
84
|
+
if (!res.ok)
|
|
85
|
+
throw new Error(`readSkillFile failed: ${res.status} ${(await res.text().catch(() => "")).slice(0, 200)}`);
|
|
86
|
+
return res.json();
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=skillClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillClient.js","sourceRoot":"","sources":["../../../src/SpatialSearch/service/skillClient.ts"],"names":[],"mappings":";;;AAmDA,8BAeC;AAGD,sCAYC;AAjFD;;;;;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,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC7G,MAAM,GAAG,GAAG,GAAG,YAAY,EAAE,WAAW,kBAAkB,CAAC,SAAS,CAAC,cAAc,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClH,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,kBAAkB,QAAQ,gBAAgB,SAAS,uCAAuC,EAAE,CAAC;IAC/H,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACxH,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Spatial Search node.
|
|
3
|
+
*/
|
|
4
|
+
/** Author-set result filters (which result types come back). */
|
|
5
|
+
export interface SpatialFilters {
|
|
6
|
+
includeImages?: boolean;
|
|
7
|
+
includeNeeds?: boolean;
|
|
8
|
+
includeServices?: boolean;
|
|
9
|
+
includeActions?: boolean;
|
|
10
|
+
includeSkills?: boolean;
|
|
11
|
+
includeMcps?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface SpatialSearchConfig extends SpatialFilters {
|
|
14
|
+
maxResults?: number;
|
|
15
|
+
/** Render content-attached cards (result rows with `metadata.app`) on the caller's live session. Default true; no-ops without a session. */
|
|
16
|
+
renderCards?: boolean;
|
|
17
|
+
/** Intent-mode precision floor (cosine similarity); server defaults to 0.35 when unset. */
|
|
18
|
+
similarityThreshold?: number;
|
|
19
|
+
}
|
|
20
|
+
/** One search result row returned by the platform spatial API. */
|
|
21
|
+
export interface SpatialResult {
|
|
22
|
+
universalId?: string;
|
|
23
|
+
objectType?: string;
|
|
24
|
+
score?: number;
|
|
25
|
+
content?: string;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
/** Shape returned by POST {base}/spatial/search. */
|
|
29
|
+
export interface SpatialSearchResponse {
|
|
30
|
+
results: SpatialResult[];
|
|
31
|
+
queryPoint?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
z: number;
|
|
35
|
+
} | null;
|
|
36
|
+
count?: number;
|
|
37
|
+
}
|
|
38
|
+
export type SpatialMode = "intent" | "related";
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/SpatialSearch/util/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4IAA4I;IAC5I,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,oDAAoD;AACpD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/SpatialSearch/util/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,wDAaV,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
/**
|
|
40
|
+
* Spatial package plugin — a sandboxed knowledge-search node that calls the platform's
|
|
41
|
+
* authenticated spatial search API. Search only (no upload/ingestion — that stays platform-side).
|
|
42
|
+
*/
|
|
43
|
+
const plugin_base_1 = require("@unoverse-platform/plugin-base");
|
|
44
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
45
|
+
const plugin = (0, plugin_base_1.createPlugin)({
|
|
46
|
+
name: package_json_1.default.name,
|
|
47
|
+
version: package_json_1.default.version,
|
|
48
|
+
description: package_json_1.default.description,
|
|
49
|
+
async setup(api) {
|
|
50
|
+
const { initializePlatformFromAPI } = await Promise.resolve().then(() => __importStar(require("@unoverse-platform/plugin-base")));
|
|
51
|
+
initializePlatformFromAPI(api);
|
|
52
|
+
const { SpatialSearchNode } = await Promise.resolve().then(() => __importStar(require("./SpatialSearch/node")));
|
|
53
|
+
api.registerNode(SpatialSearchNode);
|
|
54
|
+
// No credential — the node calls the platform's own search API internally.
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
exports.default = plugin;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,gEAAqF;AACrF,mEAA0C;AAE1C,MAAM,MAAM,GAAG,IAAA,0BAAY,EAAC;IAC1B,IAAI,EAAE,sBAAW,CAAC,IAAI;IACtB,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,WAAW,EAAE,sBAAW,CAAC,WAAW;IAEpC,KAAK,CAAC,KAAK,CAAC,GAAqB;QAC/B,MAAM,EAAE,yBAAyB,EAAE,GAAG,wDAAa,gCAAgC,GAAC,CAAC;QACrF,yBAAyB,CAAC,GAAG,CAAC,CAAC;QAE/B,MAAM,EAAE,iBAAiB,EAAE,GAAG,wDAAa,sBAAsB,GAAC,CAAC;QACnE,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACpC,2EAA2E;IAC7E,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PromiseNode: any;
|
|
2
|
+
export declare const NodeInputType: any;
|
|
3
|
+
export declare const createLogger: (name: string) => any;
|
|
4
|
+
export declare const getNodeCredentials: (context: any, credentialName: string) => any;
|
|
5
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/shared/platform.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,KAAoE,CAAC;AAC7F,eAAO,MAAM,aAAa,KAAwE,CAAC;AAEnG,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,GACgB,CAAC;AAE7D,eAAO,MAAM,kBAAkB,GAAI,SAAS,GAAG,EAAE,gBAAgB,MAAM,QAGR,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNodeCredentials = exports.createLogger = exports.NodeInputType = exports.PromiseNode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Shared platform dependencies for the Spatial node.
|
|
6
|
+
*
|
|
7
|
+
* In the platform, initializePlatformFromAPI(api) runs before node modules
|
|
8
|
+
* load (src/index.ts dynamic-imports them inside setup), so these resolve to
|
|
9
|
+
* the real engine implementations. Outside it (unit tests), classes and
|
|
10
|
+
* loggers fall back to the plugin-base stand-ins / console; credential access
|
|
11
|
+
* has no safe fallback and stays strict.
|
|
12
|
+
*/
|
|
13
|
+
const plugin_base_1 = require("@unoverse-platform/plugin-base");
|
|
14
|
+
exports.PromiseNode = (0, plugin_base_1.hasPlatform)() ? (0, plugin_base_1.getPlatform)().PromiseNode : plugin_base_1.PromiseNode;
|
|
15
|
+
exports.NodeInputType = (0, plugin_base_1.hasPlatform)() ? (0, plugin_base_1.getPlatform)().NodeInputType : plugin_base_1.NodeInputType;
|
|
16
|
+
const createLogger = (name) => (0, plugin_base_1.hasPlatform)() ? (0, plugin_base_1.getPlatform)().createLogger(name) : console;
|
|
17
|
+
exports.createLogger = createLogger;
|
|
18
|
+
const getNodeCredentials = (context, credentialName) => context?.api?.getNodeCredentials
|
|
19
|
+
? context.api.getNodeCredentials(context, credentialName)
|
|
20
|
+
: (0, plugin_base_1.getPlatform)().getNodeCredentials(context, credentialName);
|
|
21
|
+
exports.getNodeCredentials = getNodeCredentials;
|
|
22
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/shared/platform.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,gEAKwC;AAE3B,QAAA,WAAW,GAAG,IAAA,yBAAW,GAAE,CAAC,CAAC,CAAC,IAAA,yBAAW,GAAE,CAAC,WAAW,CAAC,CAAC,CAAC,yBAAqB,CAAC;AAChF,QAAA,aAAa,GAAG,IAAA,yBAAW,GAAE,CAAC,CAAC,CAAC,IAAA,yBAAW,GAAE,CAAC,aAAa,CAAC,CAAC,CAAC,2BAAuB,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,IAAY,EAAO,EAAE,CAChD,IAAA,yBAAW,GAAE,CAAC,CAAC,CAAC,IAAA,yBAAW,GAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AADhD,QAAA,YAAY,gBACoC;AAEtD,MAAM,kBAAkB,GAAG,CAAC,OAAY,EAAE,cAAsB,EAAE,EAAE,CACzE,OAAO,EAAE,GAAG,EAAE,kBAAkB;IAC9B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC;IACzD,CAAC,CAAC,IAAA,yBAAW,GAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAHnD,QAAA,kBAAkB,sBAGiC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unoverse-platform/spatial",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Spatial knowledge search for Unoverse — a sandboxed node that calls the platform's authenticated spatial search API (no direct DB access)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"clean": "rm -rf dist",
|
|
10
|
+
"dev": "tsc --watch",
|
|
11
|
+
"test": "node --import tsx --test --test-force-exit test/*.test.ts",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"unoverse",
|
|
16
|
+
"workflow",
|
|
17
|
+
"spatial",
|
|
18
|
+
"search",
|
|
19
|
+
"knowledge",
|
|
20
|
+
"umap",
|
|
21
|
+
"vector",
|
|
22
|
+
"mcp"
|
|
23
|
+
],
|
|
24
|
+
"author": "Unoverse",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsx": "^4.0.0",
|
|
28
|
+
"typescript": "^5.0.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@unoverse-platform/plugin-base": ">=1.1.6"
|
|
32
|
+
},
|
|
33
|
+
"gravity": {
|
|
34
|
+
"displayName": "Spatial",
|
|
35
|
+
"category": "search",
|
|
36
|
+
"logoUrl": "https://res.cloudinary.com/sonik/image/upload/v1751366180/gravity/icons/gravityIcon.png",
|
|
37
|
+
"nodes": [
|
|
38
|
+
{
|
|
39
|
+
"name": "Spatial Search",
|
|
40
|
+
"type": "PromiseNode",
|
|
41
|
+
"description": "Semantic + spatial (UMAP) search over the platform knowledge base, exposed to agents as MCP tools",
|
|
42
|
+
"category": "Knowledge & Vectors",
|
|
43
|
+
"mcp": true
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"features": [
|
|
47
|
+
"High-precision vector (intent) search",
|
|
48
|
+
"3D spatial (UMAP) discovery search",
|
|
49
|
+
"Exposed to agents as MCP tools via a service edge",
|
|
50
|
+
"Sandboxed — calls the platform's authenticated search API, no direct DB access"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"README.md",
|
|
56
|
+
"LICENSE",
|
|
57
|
+
"CHANGELOG.md"
|
|
58
|
+
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|