agent-lyra 0.1.4 → 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/LICENSE +21 -21
- package/README.md +118 -82
- package/bin/agent-lyra.js +15 -7
- package/package.json +56 -38
- package/src/catalog.js +147 -147
- package/src/gated/hostedAgents.js +56 -56
- package/src/gated/index.d.ts +25 -0
- package/src/gated/index.js +5 -5
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/init.js +937 -583
- package/src/onboardingAgents.js +532 -532
- package/src/promptTemplates.js +178 -178
- package/src/runtime/contracts.d.ts +47 -0
- package/src/runtime/local-cli.js +159 -0
- package/src/runtime/mcp-stdio.js +111 -0
- package/src/runtime/orchestration.js +59 -0
- package/src/runtime/run-agent.js +43 -0
- package/src/standalone/index.d.ts +45 -0
- package/src/standalone/index.js +13 -13
- package/src/standalone/orchestration.js +6 -59
- package/src/standalone/rag.js +113 -113
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
export const LYRA_VERTICALS = [
|
|
2
|
-
"hr",
|
|
3
|
-
"sales",
|
|
4
|
-
"support",
|
|
5
|
-
"finance",
|
|
6
|
-
"coding",
|
|
7
|
-
"legal",
|
|
8
|
-
"news",
|
|
9
|
-
"markets",
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
const DEFAULT_BASE_URL = "https://api.lyra.ai/v1";
|
|
13
|
-
|
|
14
|
-
export class HostedAgentClient {
|
|
15
|
-
constructor({ apiKey, baseUrl = DEFAULT_BASE_URL, fetchImpl = fetch } = {}) {
|
|
16
|
-
if (!apiKey || typeof apiKey !== "string") {
|
|
17
|
-
throw new Error("A Lyra API key is required for gated features.");
|
|
18
|
-
}
|
|
19
|
-
if (typeof fetchImpl !== "function") {
|
|
20
|
-
throw new Error("fetchImpl must be a function.");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
this.apiKey = apiKey;
|
|
24
|
-
this.baseUrl = baseUrl;
|
|
25
|
-
this.fetchImpl = fetchImpl;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
listVerticals() {
|
|
29
|
-
return [...LYRA_VERTICALS];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async invoke(vertical, payload = {}) {
|
|
33
|
-
if (!LYRA_VERTICALS.includes(vertical)) {
|
|
34
|
-
throw new Error(`Unsupported vertical: ${vertical}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const response = await this.fetchImpl(`${this.baseUrl}/agents/${vertical}/invoke`, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
headers: {
|
|
40
|
-
"Content-Type": "application/json",
|
|
41
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify(payload),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (!response.ok) {
|
|
47
|
-
throw new Error(`Lyra API request failed with status ${response.status}.`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return response.json();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function createHostedAgentClient(options) {
|
|
55
|
-
return new HostedAgentClient(options);
|
|
56
|
-
}
|
|
1
|
+
export const LYRA_VERTICALS = [
|
|
2
|
+
"hr",
|
|
3
|
+
"sales",
|
|
4
|
+
"support",
|
|
5
|
+
"finance",
|
|
6
|
+
"coding",
|
|
7
|
+
"legal",
|
|
8
|
+
"news",
|
|
9
|
+
"markets",
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const DEFAULT_BASE_URL = "https://api.lyra.ai/v1";
|
|
13
|
+
|
|
14
|
+
export class HostedAgentClient {
|
|
15
|
+
constructor({ apiKey, baseUrl = DEFAULT_BASE_URL, fetchImpl = fetch } = {}) {
|
|
16
|
+
if (!apiKey || typeof apiKey !== "string") {
|
|
17
|
+
throw new Error("A Lyra API key is required for gated features.");
|
|
18
|
+
}
|
|
19
|
+
if (typeof fetchImpl !== "function") {
|
|
20
|
+
throw new Error("fetchImpl must be a function.");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
this.apiKey = apiKey;
|
|
24
|
+
this.baseUrl = baseUrl;
|
|
25
|
+
this.fetchImpl = fetchImpl;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
listVerticals() {
|
|
29
|
+
return [...LYRA_VERTICALS];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async invoke(vertical, payload = {}) {
|
|
33
|
+
if (!LYRA_VERTICALS.includes(vertical)) {
|
|
34
|
+
throw new Error(`Unsupported vertical: ${vertical}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const response = await this.fetchImpl(`${this.baseUrl}/agents/${vertical}/invoke`, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
42
|
+
},
|
|
43
|
+
body: JSON.stringify(payload),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
throw new Error(`Lyra API request failed with status ${response.status}.`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return response.json();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function createHostedAgentClient(options) {
|
|
55
|
+
return new HostedAgentClient(options);
|
|
56
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type LyraVertical = "hr" | "sales" | "support" | "finance" | "coding" | "legal" | "news" | "markets";
|
|
2
|
+
export const LYRA_VERTICALS: LyraVertical[];
|
|
3
|
+
|
|
4
|
+
export type HostedFetch = (url: string, options: {
|
|
5
|
+
method: string;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
body: string;
|
|
8
|
+
}) => Promise<{ ok: boolean; status: number; json(): Promise<unknown> }>;
|
|
9
|
+
|
|
10
|
+
export interface HostedAgentOptions {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
fetchImpl?: HostedFetch;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class HostedAgentClient {
|
|
17
|
+
constructor(options: HostedAgentOptions);
|
|
18
|
+
apiKey: string;
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
fetchImpl: HostedFetch;
|
|
21
|
+
listVerticals(): LyraVertical[];
|
|
22
|
+
invoke(vertical: LyraVertical, payload?: Record<string, unknown>): Promise<unknown>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createHostedAgentClient(options: HostedAgentOptions): HostedAgentClient;
|
package/src/gated/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
LYRA_VERTICALS,
|
|
3
|
-
createHostedAgentClient,
|
|
4
|
-
HostedAgentClient,
|
|
5
|
-
} from "./hostedAgents.js";
|
|
1
|
+
export {
|
|
2
|
+
LYRA_VERTICALS,
|
|
3
|
+
createHostedAgentClient,
|
|
4
|
+
HostedAgentClient,
|
|
5
|
+
} from "./hostedAgents.js";
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as standalone from "./standalone/index.js";
|
|
2
|
-
export * as gated from "./gated/index.js";
|
|
1
|
+
export * as standalone from "./standalone/index.js";
|
|
2
|
+
export * as gated from "./gated/index.js";
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as standalone from "./standalone/index.js";
|
|
2
|
-
export * as gated from "./gated/index.js";
|
|
1
|
+
export * as standalone from "./standalone/index.js";
|
|
2
|
+
export * as gated from "./gated/index.js";
|