ethos-cli 0.1.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 +121 -0
- package/dist/bin/ethos.d.ts +4 -0
- package/dist/bin/ethos.js +45 -0
- package/dist/bin/ethos.js.map +1 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +162 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +180 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/skills.d.ts +2 -0
- package/dist/commands/skills.js +90 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/tables.d.ts +17 -0
- package/dist/commands/tables.js +534 -0
- package/dist/commands/tables.js.map +1 -0
- package/dist/lib/auth-store.d.ts +13 -0
- package/dist/lib/auth-store.js +47 -0
- package/dist/lib/auth-store.js.map +1 -0
- package/dist/lib/client.d.ts +19 -0
- package/dist/lib/client.js +69 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/command-helpers.d.ts +8 -0
- package/dist/lib/command-helpers.js +24 -0
- package/dist/lib/command-helpers.js.map +1 -0
- package/dist/lib/config.d.ts +12 -0
- package/dist/lib/config.js +38 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/output.d.ts +7 -0
- package/dist/lib/output.js +23 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/table-types.d.ts +138 -0
- package/dist/lib/table-types.js +2 -0
- package/dist/lib/table-types.js.map +1 -0
- package/dist/scripts/install-skills.d.ts +1 -0
- package/dist/scripts/install-skills.js +44 -0
- package/dist/scripts/install-skills.js.map +1 -0
- package/dist/skills-installer/agents.d.ts +9 -0
- package/dist/skills-installer/agents.js +31 -0
- package/dist/skills-installer/agents.js.map +1 -0
- package/dist/skills-installer/index.d.ts +4 -0
- package/dist/skills-installer/index.js +5 -0
- package/dist/skills-installer/index.js.map +1 -0
- package/dist/skills-installer/install.d.ts +15 -0
- package/dist/skills-installer/install.js +82 -0
- package/dist/skills-installer/install.js.map +1 -0
- package/dist/skills-installer/lockfile.d.ts +17 -0
- package/dist/skills-installer/lockfile.js +23 -0
- package/dist/skills-installer/lockfile.js.map +1 -0
- package/dist/skills-installer/skill.d.ts +9 -0
- package/dist/skills-installer/skill.js +70 -0
- package/dist/skills-installer/skill.js.map +1 -0
- package/package.json +48 -0
- package/postinstall.cjs +23 -0
- package/skills/find-people-at-companies.md +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-store.js","sourceRoot":"","sources":["../../src/lib/auth-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAY1C,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACjH,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAwB,CAAC;QAC7E,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACxF,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,E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E,CAAC;IAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EthosConfig } from "./config.js";
|
|
2
|
+
export type Envelope<T> = {
|
|
3
|
+
success: boolean;
|
|
4
|
+
status: number;
|
|
5
|
+
error: unknown;
|
|
6
|
+
response: T;
|
|
7
|
+
detail?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export declare class EthosApiError extends Error {
|
|
10
|
+
readonly status: number;
|
|
11
|
+
readonly body: unknown;
|
|
12
|
+
constructor(message: string, status: number, body: unknown);
|
|
13
|
+
}
|
|
14
|
+
export declare class EthosClient {
|
|
15
|
+
private readonly config;
|
|
16
|
+
constructor(config: EthosConfig);
|
|
17
|
+
request<T>(path: string, init?: RequestInit): Promise<T>;
|
|
18
|
+
uploadCsv<T>(path: string, fields?: Record<string, string | undefined>): Promise<T>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
export class EthosApiError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
body;
|
|
6
|
+
constructor(message, status, body) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "EthosApiError";
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.body = body;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class EthosClient {
|
|
14
|
+
config;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
}
|
|
18
|
+
async request(path, init = {}) {
|
|
19
|
+
const headers = new Headers(init.headers);
|
|
20
|
+
headers.set("Authorization", `Bearer ${this.config.apiKey}`);
|
|
21
|
+
if (this.config.orgId)
|
|
22
|
+
headers.set("X-Org-Id", this.config.orgId);
|
|
23
|
+
const response = await fetch(`${this.config.apiUrl}${path}`, {
|
|
24
|
+
...init,
|
|
25
|
+
headers,
|
|
26
|
+
});
|
|
27
|
+
const body = await readResponseBody(response);
|
|
28
|
+
const envelope = body;
|
|
29
|
+
if (!response.ok || envelope.success === false) {
|
|
30
|
+
throw new EthosApiError(getErrorMessage(envelope.error ?? envelope.detail ?? body, response.status), response.status, body);
|
|
31
|
+
}
|
|
32
|
+
return envelope.response;
|
|
33
|
+
}
|
|
34
|
+
async uploadCsv(path, fields = {}) {
|
|
35
|
+
const bytes = await readFile(path);
|
|
36
|
+
const form = new FormData();
|
|
37
|
+
form.append("file", new Blob([bytes], { type: "text/csv" }), basename(path));
|
|
38
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
39
|
+
if (value !== undefined)
|
|
40
|
+
form.append(name, value);
|
|
41
|
+
}
|
|
42
|
+
return this.request("/v1/tables/import-csv", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: form,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function readResponseBody(response) {
|
|
49
|
+
const text = await response.text();
|
|
50
|
+
if (!text)
|
|
51
|
+
return null;
|
|
52
|
+
try {
|
|
53
|
+
return JSON.parse(text);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return text;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function getErrorMessage(error, status) {
|
|
60
|
+
if (typeof error === "string")
|
|
61
|
+
return error;
|
|
62
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
63
|
+
const message = error.message;
|
|
64
|
+
if (typeof message === "string")
|
|
65
|
+
return message;
|
|
66
|
+
}
|
|
67
|
+
return `API request failed: ${status}`;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings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AAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QAC7D,MAAM,OAAO,GAAI,KAA+B,CAAC,OAAO,CAAC;QACzD,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC;IAClD,CAAC;IACD,OAAO,uBAAuB,MAAM,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { EthosClient } from "./client.js";
|
|
3
|
+
import { type EthosConfig } from "./config.js";
|
|
4
|
+
export declare function withClient(command: Command, fn: (client: EthosClient, config: EthosConfig) => Promise<void>): Promise<void>;
|
|
5
|
+
export declare function jsonRequest(method: "POST" | "PATCH", body: unknown): RequestInit;
|
|
6
|
+
export declare function compactObject<T extends Record<string, unknown>>(value: T): Partial<T>;
|
|
7
|
+
export declare function collect(value: string, previous: string[]): string[];
|
|
8
|
+
export declare function pathId(value: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EthosClient } from "./client.js";
|
|
2
|
+
import { resolveConfig } from "./config.js";
|
|
3
|
+
export async function withClient(command, fn) {
|
|
4
|
+
const config = resolveConfig(command);
|
|
5
|
+
await fn(new EthosClient(config), config);
|
|
6
|
+
}
|
|
7
|
+
export function jsonRequest(method, body) {
|
|
8
|
+
return {
|
|
9
|
+
method,
|
|
10
|
+
headers: { "Content-Type": "application/json" },
|
|
11
|
+
body: JSON.stringify(body),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function compactObject(value) {
|
|
15
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
|
|
16
|
+
}
|
|
17
|
+
export function collect(value, previous) {
|
|
18
|
+
previous.push(value);
|
|
19
|
+
return previous;
|
|
20
|
+
}
|
|
21
|
+
export function pathId(value) {
|
|
22
|
+
return encodeURIComponent(value);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=command-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-helpers.js","sourceRoot":"","sources":["../../src/lib/command-helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAgB,EAAE,EAA+D;IAChH,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAwB,EAAE,IAAa;IACjE,OAAO;QACL,MAAM;QACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAoC,KAAQ;IACvE,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAe,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,QAAkB;IACvD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export type EthosConfig = {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
orgId?: string;
|
|
6
|
+
json: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function defaultApiUrl(): string;
|
|
9
|
+
export declare function addGlobalOptions(program: Command): Command;
|
|
10
|
+
export declare function resolveApiUrl(command: Command): string;
|
|
11
|
+
export declare function isJsonMode(command: Command): boolean;
|
|
12
|
+
export declare function resolveConfig(command: Command): EthosConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { readStoredAuth } from "./auth-store.js";
|
|
2
|
+
export function defaultApiUrl() {
|
|
3
|
+
return "https://api.ethos.hello-cluster.com";
|
|
4
|
+
}
|
|
5
|
+
export function addGlobalOptions(program) {
|
|
6
|
+
return program
|
|
7
|
+
.option("--api-url <url>", "Ethos API URL", process.env.ETHOS_API_URL)
|
|
8
|
+
.option("--api-key <token>", "Ethos API key or bearer token", process.env.ETHOS_API_KEY)
|
|
9
|
+
.option("--access-token <token>", "Ethos bearer token", process.env.ETHOS_ACCESS_TOKEN)
|
|
10
|
+
.option("--org-id <id>", "Ethos organization id", process.env.ETHOS_ORG_ID)
|
|
11
|
+
.option("--json", "force JSON output");
|
|
12
|
+
}
|
|
13
|
+
export function resolveApiUrl(command) {
|
|
14
|
+
const options = command.optsWithGlobals();
|
|
15
|
+
const stored = readStoredAuth();
|
|
16
|
+
return (options.apiUrl || stored?.apiUrl || defaultApiUrl()).replace(/\/+$/, "");
|
|
17
|
+
}
|
|
18
|
+
export function isJsonMode(command) {
|
|
19
|
+
const options = command.optsWithGlobals();
|
|
20
|
+
return Boolean(options.json || !process.stdout.isTTY);
|
|
21
|
+
}
|
|
22
|
+
export function resolveConfig(command) {
|
|
23
|
+
const options = command.optsWithGlobals();
|
|
24
|
+
const apiUrl = resolveApiUrl(command);
|
|
25
|
+
const stored = readStoredAuth();
|
|
26
|
+
const storedMatchesApiUrl = stored?.apiUrl.replace(/\/+$/, "") === apiUrl;
|
|
27
|
+
const apiKey = options.apiKey || options.accessToken || (storedMatchesApiUrl ? stored?.apiKey : undefined);
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
throw new Error("Missing API token. Run `ethos auth login`, set ETHOS_API_KEY, or pass --api-key.");
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
apiUrl,
|
|
33
|
+
apiKey,
|
|
34
|
+
orgId: options.orgId || (storedMatchesApiUrl ? stored?.orgId : undefined),
|
|
35
|
+
json: isJsonMode(command),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAiBjD,MAAM,UAAU,aAAa;IAC3B,OAAO,qCAAqC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,OAAO;SACX,MAAM,CAAC,iBAAiB,EAAE,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;SACrE,MAAM,CAAC,mBAAmB,EAAE,+BAA+B,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;SACvF,MAAM,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;SACtF,MAAM,CAAC,eAAe,EAAE,uBAAuB,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;SAC1E,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,EAAiB,CAAC;IACzD,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE,MAAM,IAAI,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,EAAiB,CAAC;IACzD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,EAAiB,CAAC;IACzD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,MAAM,mBAAmB,GAAG,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC;IAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,WAAW,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3G,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IACtG,CAAC;IAED,OAAO;QACL,MAAM;QACN,MAAM;QACN,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EthosConfig } from "./config.js";
|
|
2
|
+
export type CommandResult = {
|
|
3
|
+
label?: string;
|
|
4
|
+
data: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare function printResult(config: EthosConfig, result: CommandResult | unknown): void;
|
|
7
|
+
export declare function printError(error: unknown, json?: boolean): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function printResult(config, result) {
|
|
2
|
+
const data = isCommandResult(result) ? result.data : result;
|
|
3
|
+
if (config.json) {
|
|
4
|
+
process.stdout.write(`${JSON.stringify({ success: true, response: data }, null, 2)}\n`);
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (isCommandResult(result) && result.label) {
|
|
8
|
+
process.stdout.write(`${result.label}\n`);
|
|
9
|
+
}
|
|
10
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
11
|
+
}
|
|
12
|
+
export function printError(error, json = !process.stderr.isTTY) {
|
|
13
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
14
|
+
if (json) {
|
|
15
|
+
process.stderr.write(`${JSON.stringify({ success: false, error: message }, null, 2)}\n`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
process.stderr.write(`Error: ${message}\n`);
|
|
19
|
+
}
|
|
20
|
+
function isCommandResult(value) {
|
|
21
|
+
return Boolean(value && typeof value === "object" && "data" in value);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,WAAW,CAAC,MAAmB,EAAE,MAA+B;IAC9E,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5D,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACxF,OAAO;IACT,CAAC;IAED,IAAI,eAAe,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;IACrE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACzF,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,OAAO,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export type TableOutputType = "text";
|
|
2
|
+
export type TableEntityType = "company" | "people";
|
|
3
|
+
export type AgentWorkflowType = "company_enrichment" | "person_enrichment" | "people_sourcing";
|
|
4
|
+
export type AgentAbility = "web-search" | "web-fetch" | "browser-use" | "ethos-hub" | "linkedin-profile-lookup" | "linkedin-company-lookup";
|
|
5
|
+
export type ToolPreset = "filesystem" | "shell" | "browser";
|
|
6
|
+
export type TableOutputField = {
|
|
7
|
+
name: string;
|
|
8
|
+
type: TableOutputType;
|
|
9
|
+
};
|
|
10
|
+
export type TableRunScope = "first_5" | "all" | "empty" | "count";
|
|
11
|
+
export type TableViewFilterOperator = "is_empty" | "is_not_empty" | "equals" | "not_equals" | "contains" | "not_contains";
|
|
12
|
+
export type Agent = {
|
|
13
|
+
id: string;
|
|
14
|
+
org_id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
instructions: string;
|
|
18
|
+
model: string;
|
|
19
|
+
abilities: AgentAbility[];
|
|
20
|
+
skills: string[];
|
|
21
|
+
tool_presets: ToolPreset[];
|
|
22
|
+
workflow_type: AgentWorkflowType | null;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
};
|
|
26
|
+
export type Table = {
|
|
27
|
+
id: string;
|
|
28
|
+
org_id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
source_filename: string | null;
|
|
31
|
+
entity_type: TableEntityType | null;
|
|
32
|
+
source_table_id: string | null;
|
|
33
|
+
source_view_id: string | null;
|
|
34
|
+
row_count: number;
|
|
35
|
+
column_count: number;
|
|
36
|
+
created_at: string;
|
|
37
|
+
updated_at: string;
|
|
38
|
+
};
|
|
39
|
+
export type TableColumn = {
|
|
40
|
+
id: string;
|
|
41
|
+
org_id: string;
|
|
42
|
+
table_id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
type: TableOutputType;
|
|
45
|
+
source: "imported" | "agent";
|
|
46
|
+
position: number;
|
|
47
|
+
agent_id: string | null;
|
|
48
|
+
prompt: string | null;
|
|
49
|
+
output_type: TableOutputType | null;
|
|
50
|
+
output_schema: Record<string, unknown> | null;
|
|
51
|
+
config: Record<string, unknown> | null;
|
|
52
|
+
semantic_attributes: TableColumnSemanticAttributes;
|
|
53
|
+
created_at: string;
|
|
54
|
+
updated_at: string;
|
|
55
|
+
};
|
|
56
|
+
export type TableColumnSemanticAttributes = {
|
|
57
|
+
is_agent_response: boolean;
|
|
58
|
+
is_company_domain: boolean;
|
|
59
|
+
is_email: boolean;
|
|
60
|
+
is_url: boolean;
|
|
61
|
+
is_linkedin_url: boolean;
|
|
62
|
+
is_linkedin_person_profile: boolean;
|
|
63
|
+
is_linkedin_company_profile: boolean;
|
|
64
|
+
is_linkedin_job_post: boolean;
|
|
65
|
+
is_linkedin_post: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type TableRow = {
|
|
68
|
+
id: string;
|
|
69
|
+
org_id: string;
|
|
70
|
+
table_id: string;
|
|
71
|
+
row_index: number;
|
|
72
|
+
created_at: string;
|
|
73
|
+
};
|
|
74
|
+
export type TableCell = {
|
|
75
|
+
id: string;
|
|
76
|
+
org_id: string;
|
|
77
|
+
table_id: string;
|
|
78
|
+
row_id: string;
|
|
79
|
+
column_id: string;
|
|
80
|
+
value: unknown;
|
|
81
|
+
status: "queued" | "running" | "succeeded" | "failed" | "canceled" | null;
|
|
82
|
+
error: string | null;
|
|
83
|
+
metadata: Record<string, unknown> | null;
|
|
84
|
+
created_at: string;
|
|
85
|
+
updated_at: string;
|
|
86
|
+
};
|
|
87
|
+
export type TableViewFilter = {
|
|
88
|
+
id: string;
|
|
89
|
+
column_id: string;
|
|
90
|
+
operator: TableViewFilterOperator;
|
|
91
|
+
value: string | null;
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
};
|
|
94
|
+
export type TableViewFilterInput = {
|
|
95
|
+
id?: string;
|
|
96
|
+
column_id: string;
|
|
97
|
+
operator: TableViewFilterOperator;
|
|
98
|
+
value?: string | null;
|
|
99
|
+
enabled?: boolean;
|
|
100
|
+
};
|
|
101
|
+
export type TableView = {
|
|
102
|
+
id: string;
|
|
103
|
+
org_id: string;
|
|
104
|
+
table_id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
filters: TableViewFilter[];
|
|
107
|
+
created_at: string;
|
|
108
|
+
updated_at: string;
|
|
109
|
+
};
|
|
110
|
+
export type TableDetail = {
|
|
111
|
+
table: Table;
|
|
112
|
+
columns: TableColumn[];
|
|
113
|
+
rows: TableRow[];
|
|
114
|
+
cells: TableCell[];
|
|
115
|
+
views: TableView[];
|
|
116
|
+
column_runs: TableColumnRun[];
|
|
117
|
+
};
|
|
118
|
+
export type TableColumnRun = {
|
|
119
|
+
id: string;
|
|
120
|
+
org_id: string;
|
|
121
|
+
table_id: string;
|
|
122
|
+
column_id: string;
|
|
123
|
+
status: "queued" | "running" | "succeeded" | "failed" | "partial_failed" | "canceled";
|
|
124
|
+
total_count: number;
|
|
125
|
+
completed_count: number;
|
|
126
|
+
failed_count: number;
|
|
127
|
+
error: string | null;
|
|
128
|
+
scope: TableRunScope;
|
|
129
|
+
created_at: string;
|
|
130
|
+
updated_at: string;
|
|
131
|
+
started_at: string | null;
|
|
132
|
+
finished_at: string | null;
|
|
133
|
+
};
|
|
134
|
+
export type SourcePeopleRun = {
|
|
135
|
+
table: TableDetail;
|
|
136
|
+
column: TableColumn;
|
|
137
|
+
run: TableColumnRun;
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-types.js","sourceRoot":"","sources":["../../src/lib/table-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { AGENTS, syncSkills, } from "../skills-installer/index.js";
|
|
5
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const SKILLS_DIR = join(here, "..", "..", "skills");
|
|
7
|
+
const pkg = createRequire(import.meta.url)("../../package.json");
|
|
8
|
+
async function main() {
|
|
9
|
+
if (process.env.ETHOS_SKIP_SKILLS) {
|
|
10
|
+
process.stderr.write("ethos: ETHOS_SKIP_SKILLS set - skipping skills install.\n");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
14
|
+
if (uid === 0 && process.env.SUDO_USER) {
|
|
15
|
+
process.stderr.write("ethos: detected sudo install - skipping skills install. " +
|
|
16
|
+
"Run `ethos skills install` as your user.\n");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const result = await syncSkills({
|
|
20
|
+
bundledSkillsDir: SKILLS_DIR,
|
|
21
|
+
ethosVersion: pkg.version,
|
|
22
|
+
});
|
|
23
|
+
const targets = result.targetAgents
|
|
24
|
+
.map((agent) => AGENTS[agent].displayName)
|
|
25
|
+
.join(", ");
|
|
26
|
+
if (result.installed.length || result.updated.length || result.removed.length) {
|
|
27
|
+
let line = `ethos: skills synced for ${targets}`;
|
|
28
|
+
if (result.installed.length)
|
|
29
|
+
line += `, installed: ${result.installed.join(", ")}`;
|
|
30
|
+
if (result.updated.length)
|
|
31
|
+
line += `, updated: ${result.updated.join(", ")}`;
|
|
32
|
+
if (result.removed.length)
|
|
33
|
+
line += `, removed: ${result.removed.join(", ")}`;
|
|
34
|
+
process.stderr.write(line + "\n");
|
|
35
|
+
}
|
|
36
|
+
else if (!result.targetAgents.length) {
|
|
37
|
+
process.stderr.write("ethos: no supported agents detected (claude-code, codex, cursor) - " +
|
|
38
|
+
"skills not installed. Run `ethos skills install` after installing an agent.\n");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
main().catch((err) => {
|
|
42
|
+
process.stderr.write(`ethos: skills install failed (continuing) - ${err instanceof Error ? err.message : String(err)}\nRun \`ethos skills install\` manually after install completes.\n`);
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=install-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-skills.js","sourceRoot":"","sources":["../../src/scripts/install-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI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AM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9E,IAAI,IAAI,GAAG,4BAA4B,OAAO,EAAE,CAAC;QACjD,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM;YAAE,IAAI,IAAI,gBAAgB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnF,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM;YAAE,IAAI,IAAI,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7E,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM;YAAE,IAAI,IAAI,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qEAAqE;YACnE,+EAA+E,CAClF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,+CACE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,oEAAoE,CACrE,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AgentName = "claude-code" | "codex" | "cursor";
|
|
2
|
+
export interface Agent {
|
|
3
|
+
name: AgentName;
|
|
4
|
+
displayName: string;
|
|
5
|
+
globalDir(): string;
|
|
6
|
+
detect(): boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const AGENTS: Record<AgentName, Agent>;
|
|
9
|
+
export declare function detectInstalledAgents(): AgentName[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export const AGENTS = {
|
|
5
|
+
"claude-code": {
|
|
6
|
+
name: "claude-code",
|
|
7
|
+
displayName: "Claude Code",
|
|
8
|
+
globalDir: () => process.env.CLAUDE_CONFIG_DIR
|
|
9
|
+
? join(process.env.CLAUDE_CONFIG_DIR, "skills")
|
|
10
|
+
: join(homedir(), ".claude", "skills"),
|
|
11
|
+
detect: () => existsSync(join(homedir(), ".claude")),
|
|
12
|
+
},
|
|
13
|
+
codex: {
|
|
14
|
+
name: "codex",
|
|
15
|
+
displayName: "Codex",
|
|
16
|
+
globalDir: () => join(process.env.CODEX_HOME ?? join(homedir(), ".codex"), "skills"),
|
|
17
|
+
detect: () => existsSync(join(homedir(), ".codex")) || existsSync("/etc/codex"),
|
|
18
|
+
},
|
|
19
|
+
cursor: {
|
|
20
|
+
name: "cursor",
|
|
21
|
+
displayName: "Cursor",
|
|
22
|
+
globalDir: () => join(homedir(), ".cursor", "skills"),
|
|
23
|
+
detect: () => existsSync(join(homedir(), ".cursor")),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export function detectInstalledAgents() {
|
|
27
|
+
return Object.values(AGENTS)
|
|
28
|
+
.filter((agent) => agent.detect())
|
|
29
|
+
.map((agent) => agent.name);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/skills-installer/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAA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AE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/skills-installer/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AgentName } from "./agents.js";
|
|
2
|
+
export interface SyncOptions {
|
|
3
|
+
bundledSkillsDir: string;
|
|
4
|
+
ethosVersion: string;
|
|
5
|
+
agents?: AgentName[];
|
|
6
|
+
}
|
|
7
|
+
export interface SyncResult {
|
|
8
|
+
installed: string[];
|
|
9
|
+
updated: string[];
|
|
10
|
+
removed: string[];
|
|
11
|
+
targetAgents: AgentName[];
|
|
12
|
+
skippedAgents: AgentName[];
|
|
13
|
+
}
|
|
14
|
+
export declare function syncSkills(opts: SyncOptions): Promise<SyncResult>;
|
|
15
|
+
export declare function removeAllSkills(): Promise<string[]>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { copyFile, mkdir, rm } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { AGENTS, detectInstalledAgents, } from "./agents.js";
|
|
5
|
+
import { readLockfile, writeLockfile, } from "./lockfile.js";
|
|
6
|
+
import { discoverBundledSkills, isPathSafe } from "./skill.js";
|
|
7
|
+
export async function syncSkills(opts) {
|
|
8
|
+
const targetAgents = opts.agents ?? detectInstalledAgents();
|
|
9
|
+
const skippedAgents = Object.keys(AGENTS).filter((agent) => !targetAgents.includes(agent));
|
|
10
|
+
const result = {
|
|
11
|
+
installed: [],
|
|
12
|
+
updated: [],
|
|
13
|
+
removed: [],
|
|
14
|
+
targetAgents,
|
|
15
|
+
skippedAgents,
|
|
16
|
+
};
|
|
17
|
+
const bundled = await discoverBundledSkills(opts.bundledSkillsDir);
|
|
18
|
+
const lock = await readLockfile();
|
|
19
|
+
if (targetAgents.length === 0) {
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
const bundledNames = new Set(bundled.map((skill) => skill.name));
|
|
23
|
+
for (const skill of bundled) {
|
|
24
|
+
const previous = lock.skills[skill.name];
|
|
25
|
+
const missingOnDisk = targetAgents.some((agentName) => !previous?.agents[agentName] ||
|
|
26
|
+
!existsSync(previous.agents[agentName].path));
|
|
27
|
+
if (previous && previous.hash === skill.hash && !missingOnDisk)
|
|
28
|
+
continue;
|
|
29
|
+
const entry = {
|
|
30
|
+
sourceType: "bundled",
|
|
31
|
+
hash: skill.hash,
|
|
32
|
+
installedAt: new Date().toISOString(),
|
|
33
|
+
agents: {},
|
|
34
|
+
};
|
|
35
|
+
for (const agentName of targetAgents) {
|
|
36
|
+
const base = AGENTS[agentName].globalDir();
|
|
37
|
+
const target = join(base, skill.name);
|
|
38
|
+
if (!isPathSafe(base, target))
|
|
39
|
+
continue;
|
|
40
|
+
await rm(target, { recursive: true, force: true });
|
|
41
|
+
await mkdir(target, { recursive: true });
|
|
42
|
+
await copyFile(skill.sourcePath, join(target, "SKILL.md"));
|
|
43
|
+
entry.agents[agentName] = { path: target };
|
|
44
|
+
}
|
|
45
|
+
(previous ? result.updated : result.installed).push(skill.name);
|
|
46
|
+
lock.skills[skill.name] = entry;
|
|
47
|
+
}
|
|
48
|
+
for (const name of Object.keys(lock.skills)) {
|
|
49
|
+
if (bundledNames.has(name))
|
|
50
|
+
continue;
|
|
51
|
+
await removeSkillEntry(lock.skills[name]);
|
|
52
|
+
delete lock.skills[name];
|
|
53
|
+
result.removed.push(name);
|
|
54
|
+
}
|
|
55
|
+
lock.ethosVersion = opts.ethosVersion;
|
|
56
|
+
await writeLockfile(lock);
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
export async function removeAllSkills() {
|
|
60
|
+
const lock = await readLockfile();
|
|
61
|
+
const removed = Object.keys(lock.skills);
|
|
62
|
+
for (const entry of Object.values(lock.skills)) {
|
|
63
|
+
await removeSkillEntry(entry);
|
|
64
|
+
}
|
|
65
|
+
lock.skills = {};
|
|
66
|
+
await writeLockfile(lock);
|
|
67
|
+
return removed;
|
|
68
|
+
}
|
|
69
|
+
async function removeSkillEntry(entry) {
|
|
70
|
+
for (const [agentName, info] of Object.entries(entry.agents)) {
|
|
71
|
+
if (!info)
|
|
72
|
+
continue;
|
|
73
|
+
const agent = AGENTS[agentName];
|
|
74
|
+
if (!agent)
|
|
75
|
+
continue;
|
|
76
|
+
const base = agent.globalDir();
|
|
77
|
+
if (!isPathSafe(base, info.path))
|
|
78
|
+
continue;
|
|
79
|
+
await rm(info.path, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/skills-installer/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,MAAM,EACN,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,aAAa,GAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAgB/D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAiB;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,IAAI,qBAAqB,EAAE,CAAC;IAC5D,MAAM,aAAa,GAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAiB,CAAC,MAAM,CAC/D,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,YAAY,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AAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,IAAI,GAAG,MAAM,YAAY,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/C,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACjB,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,KAAoB;IAClD,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,SAAsB,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;YAAE,SAAS;QAC3C,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentName } from "./agents.js";
|
|
2
|
+
export interface LockfileEntry {
|
|
3
|
+
sourceType: "bundled";
|
|
4
|
+
hash: string;
|
|
5
|
+
installedAt: string;
|
|
6
|
+
agents: Partial<Record<AgentName, {
|
|
7
|
+
path: string;
|
|
8
|
+
}>>;
|
|
9
|
+
}
|
|
10
|
+
export interface Lockfile {
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
ethosVersion: string;
|
|
13
|
+
skills: Record<string, LockfileEntry>;
|
|
14
|
+
}
|
|
15
|
+
export declare function lockPath(): string;
|
|
16
|
+
export declare function readLockfile(): Promise<Lockfile>;
|
|
17
|
+
export declare function writeLockfile(lock: Lockfile): Promise<void>;
|