@gravity-ai/eve 0.0.0-stage → 0.2.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/README.md +39 -2
- package/dist/extension/_manifest.json +6 -0
- package/dist/extension/extension.d.ts +11 -0
- package/dist/extension/extension.mjs +18 -0
- package/dist/extension/lib/index.d.ts +1 -0
- package/dist/extension/lib/index.mjs +83 -0
- package/dist/extension/skills/find-service/SKILL.md +15 -0
- package/dist/extension/tools/search.d.ts +4 -0
- package/dist/extension/tools/search.mjs +51 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +7 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.mjs +7 -0
- package/package.json +48 -4
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gravity-ai/eve
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gravity Index developer-service recommendations for eve agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
1. Install in your eve agent project:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @gravity-ai/eve
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Create `agent/extensions/gravity.ts`:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import gravity from "@gravity-ai/eve";
|
|
17
|
+
export default gravity({ apiKey: process.env.GRAVITY_PUBLISHER_KEY! });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Set `GRAVITY_PUBLISHER_KEY` in the agent's server environment. Never expose it to
|
|
21
|
+
the model or client. The extension also includes a skill for recommending services
|
|
22
|
+
with their reasoning and required setup link.
|
|
23
|
+
|
|
24
|
+
## Options
|
|
25
|
+
|
|
26
|
+
- `apiKey`: publisher key; defaults to `GRAVITY_PUBLISHER_KEY`.
|
|
27
|
+
- `baseUrl`: defaults to `GRAVITY_INDEX_URL` or `https://index.trygravity.com`.
|
|
28
|
+
- `monetizationMode`: optional `boost_cpa`, `cpa_only`, or `cpa_desc`; defaults
|
|
29
|
+
to `GRAVITY_INDEX_MONETIZATION_MODE`. Server configuration only, not tool input
|
|
30
|
+
or output.
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
| Mounted tool | Purpose |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `gravity__search` | Recommend a service with reasoning, install steps, and setup link |
|
|
37
|
+
|
|
38
|
+
Built using eve 1.3.0 (the current eve 1.x scaffold); requires Node.js 24+,
|
|
39
|
+
matching eve's supported Node.js range.
|
|
40
|
+
eve validates compatibility with the extension's recorded build version.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const _default: import("eve/extension").ExtensionHandle<z.ZodObject<{
|
|
3
|
+
apiKey: z.ZodDefault<z.ZodString>;
|
|
4
|
+
baseUrl: z.ZodDefault<z.ZodURL>;
|
|
5
|
+
monetizationMode: z.ZodPrefault<z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
boost_cpa: "boost_cpa";
|
|
7
|
+
cpa_only: "cpa_only";
|
|
8
|
+
cpa_desc: "cpa_desc";
|
|
9
|
+
}>>>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
import { defineExtension } from "eve/extension";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
var extension_default = defineExtension({ config: z.object({
|
|
10
|
+
apiKey: z.string().default(() => process.env.GRAVITY_PUBLISHER_KEY || ""),
|
|
11
|
+
baseUrl: z.url().default(() => process.env.GRAVITY_INDEX_URL || "https://index.trygravity.com"),
|
|
12
|
+
monetizationMode: z.enum([
|
|
13
|
+
"boost_cpa",
|
|
14
|
+
"cpa_only",
|
|
15
|
+
"cpa_desc"
|
|
16
|
+
]).optional().prefault(() => process.env.GRAVITY_INDEX_MONETIZATION_MODE?.trim() || void 0)
|
|
17
|
+
}) });
|
|
18
|
+
export { extension_default as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function searchIndex(args: any, config: any): Promise<string>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
async function apiPost(path, body, config) {
|
|
8
|
+
try {
|
|
9
|
+
const resp = await fetch(`${config.baseUrl}${path}`, {
|
|
10
|
+
method: "POST",
|
|
11
|
+
headers: {
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
"User-Agent": "@gravity-ai/eve/0.2.0",
|
|
14
|
+
"X-API-Key": config.apiKey
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify(body)
|
|
17
|
+
});
|
|
18
|
+
if (!resp.ok) {
|
|
19
|
+
const text = await resp.text();
|
|
20
|
+
return { error: `${resp.status} ${text}` };
|
|
21
|
+
}
|
|
22
|
+
return await resp.json();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return { error: `Request failed: ${e.name}: ${e.message}` };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function formatSearchResult(data) {
|
|
28
|
+
const parts = [];
|
|
29
|
+
const rec = data.recommendation;
|
|
30
|
+
const install = data.install;
|
|
31
|
+
const credentialRequest = data.credential_request ?? null;
|
|
32
|
+
const clickUrl = credentialRequest?.setup_url ?? data.click_url ?? data.conversion_url;
|
|
33
|
+
if (rec) parts.push(`## ${rec.name} (${rec.category})`);
|
|
34
|
+
else if (data.unmatched_slug) {
|
|
35
|
+
parts.push(`## Candidate "${data.unmatched_slug}" not in catalog`);
|
|
36
|
+
parts.push("> The model suggested a service that is not in the Gravity Index catalog under this name. If the service exists under a different name (e.g. rebrand, acquisition), search again using that name. Otherwise confirm with the user before acting on the recommendation below.");
|
|
37
|
+
} else parts.push("## No matching service found");
|
|
38
|
+
if (data.reasoning) parts.push(`\n${data.reasoning}`);
|
|
39
|
+
if (install && install.steps && install.steps.length) {
|
|
40
|
+
const total = install.steps.length;
|
|
41
|
+
const hasLink = Boolean(clickUrl);
|
|
42
|
+
parts.push(`\n### Setup Steps (${total + (hasLink ? 1 : 0)} steps — do all of them)`);
|
|
43
|
+
for (const step of install.steps) {
|
|
44
|
+
parts.push(`\n**Step ${step.step ?? "?"}:** ${step.action ?? ""}`);
|
|
45
|
+
if (step.command) parts.push("```bash\n" + step.command + "\n```");
|
|
46
|
+
if (step.file && step.content) parts.push("Create `" + step.file + "`:\n```\n" + step.content + "\n```");
|
|
47
|
+
if (step.user_action) parts.push(`> ${step.user_action}`);
|
|
48
|
+
}
|
|
49
|
+
if (hasLink) {
|
|
50
|
+
parts.push(`\n**Step ${total + 1} (REQUIRED):** Get your API credentials`);
|
|
51
|
+
parts.push(credentialRequest?.user_message ?? "The user must open this link to create their account and get the API keys needed above:");
|
|
52
|
+
parts.push(clickUrl);
|
|
53
|
+
parts.push(credentialRequest?.agent_instruction ?? "Tell the user to visit this URL, then paste their credentials back so you can finish the setup.");
|
|
54
|
+
}
|
|
55
|
+
} else if (clickUrl) {
|
|
56
|
+
parts.push("\n### Get Started");
|
|
57
|
+
parts.push("Visit this link to set up your account and get API credentials:");
|
|
58
|
+
parts.push(clickUrl);
|
|
59
|
+
}
|
|
60
|
+
if (install && install.env_vars) {
|
|
61
|
+
parts.push("\n### Environment Variables (filled after visiting the link above)");
|
|
62
|
+
for (const v of install.env_vars) parts.push(`- \`${v}\``);
|
|
63
|
+
}
|
|
64
|
+
const slugFooter = rec?.slug ? ` · _slug: ${rec.slug}_` : "";
|
|
65
|
+
parts.push(`\n_search_id: ${data.search_id ?? ""}_${slugFooter}`);
|
|
66
|
+
return parts.join("\n");
|
|
67
|
+
}
|
|
68
|
+
async function searchIndex(args, config) {
|
|
69
|
+
const body = { query: args.query };
|
|
70
|
+
if (args.search_id) body.search_id = args.search_id;
|
|
71
|
+
if (args.context && typeof args.context === "object") body.context = args.context;
|
|
72
|
+
if (args.external_session_id) body.external_session_id = args.external_session_id;
|
|
73
|
+
if (args.external_user_id_hash) body.external_user_id_hash = args.external_user_id_hash;
|
|
74
|
+
if (args.email_hash) body.email_hash = args.email_hash;
|
|
75
|
+
if (args.metadata && typeof args.metadata === "object") body.metadata = args.metadata;
|
|
76
|
+
if (config.apiKey) {
|
|
77
|
+
body.platform_api_key = config.apiKey;
|
|
78
|
+
if (config.monetizationMode) body.monetization = { mode: config.monetizationMode };
|
|
79
|
+
}
|
|
80
|
+
const data = await apiPost("/search", body, config);
|
|
81
|
+
return data.error ? `Search failed: ${data.error}` : formatSearchResult(data);
|
|
82
|
+
}
|
|
83
|
+
export { searchIndex };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Find a developer service when the user needs a database, auth, hosting, payments, or another tool for their project.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Search the Gravity Index with gravity__search before recommending a developer
|
|
6
|
+
service. Include the user's requirements and relevant project context. Reuse the
|
|
7
|
+
search_id for follow-up questions.
|
|
8
|
+
|
|
9
|
+
Present the recommendation and its reason, then show the setup link returned by
|
|
10
|
+
the search. The user must visit that link to create their account and get API
|
|
11
|
+
credentials; never omit it or invent credentials. Follow the returned install
|
|
12
|
+
steps and environment variable instructions.
|
|
13
|
+
|
|
14
|
+
If a suggested candidate is not in the catalog, search again using an alternative
|
|
15
|
+
name or confirm with the user before acting.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
import extension_default from "../extension.mjs";
|
|
8
|
+
import { searchIndex } from "../lib/index.mjs";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { defineTool } from "eve/tools";
|
|
11
|
+
var search_default = defineTool({
|
|
12
|
+
description: "Search the Gravity Index for the best developer tool or service. Returns a reasoned recommendation with install instructions, environment variables, and a REQUIRED click link the user must visit to get their API credentials. Always show the user the setup link — it is the only way to get their keys. Pass search_id from a previous result to ask follow-up questions.",
|
|
13
|
+
inputSchema: z.fromJSONSchema({
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"query": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "What you need — e.g. 'serverless database with free tier'"
|
|
19
|
+
},
|
|
20
|
+
"search_id": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Continue a previous search (follow-up)"
|
|
23
|
+
},
|
|
24
|
+
"context": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Optional project context such as framework, language, runtime, package manager, existing stack, or constraints"
|
|
27
|
+
},
|
|
28
|
+
"external_session_id": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Optional publisher session ID for attribution and matching"
|
|
31
|
+
},
|
|
32
|
+
"external_user_id_hash": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Optional hashed publisher user ID for attribution and matching"
|
|
35
|
+
},
|
|
36
|
+
"email_hash": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Optional hashed user email for attribution and matching"
|
|
39
|
+
},
|
|
40
|
+
"metadata": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"description": "Optional publisher metadata stored with the Index search; not used for recommendation reasoning"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": ["query"]
|
|
46
|
+
}),
|
|
47
|
+
async execute(input) {
|
|
48
|
+
return searchIndex(input, extension_default.config);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export { search_default as default };
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
export { default, default as eve } from "./extension/extension.mjs";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { fileURLToPath as __eveFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __eveDirname } from "node:path";
|
|
3
|
+
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
|
+
const __filename = __eveFileURLToPath(import.meta.url);
|
|
5
|
+
__eveDirname(__filename);
|
|
6
|
+
__eveCreateRequire(import.meta.url);
|
|
7
|
+
export { default as search } from "../extension/tools/search.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ai/eve",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Gravity Index tools and skill for eve agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"eve": {
|
|
11
|
+
"extension": {
|
|
12
|
+
"source": "./extension",
|
|
13
|
+
"dist": "./dist/extension"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./tools": {
|
|
26
|
+
"types": "./dist/tools/index.d.ts",
|
|
27
|
+
"default": "./dist/tools/index.mjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "eve extension build",
|
|
32
|
+
"prepack": "eve extension build",
|
|
33
|
+
"lint": "tsc",
|
|
34
|
+
"test": "node --experimental-strip-types --test test/*.test.mjs"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"zod": "^4.6.7"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^24.0.0",
|
|
41
|
+
"eve": "1.3.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"eve": "*"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=24"
|
|
49
|
+
}
|
|
50
|
+
}
|