@holoscript/holoscript-agent 2.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/LICENSE +21 -0
- package/dist/ablation.d.ts +56 -0
- package/dist/ablation.js +183 -0
- package/dist/ablation.js.map +1 -0
- package/dist/audit-log.d.ts +99 -0
- package/dist/audit-log.js +123 -0
- package/dist/audit-log.js.map +1 -0
- package/dist/brain.d.ts +6 -0
- package/dist/brain.js +66 -0
- package/dist/brain.js.map +1 -0
- package/dist/commit-hook.d.ts +22 -0
- package/dist/commit-hook.js +103 -0
- package/dist/commit-hook.js.map +1 -0
- package/dist/cost-guard.d.ts +54 -0
- package/dist/cost-guard.js +92 -0
- package/dist/cost-guard.js.map +1 -0
- package/dist/holomesh-client.d.ts +63 -0
- package/dist/holomesh-client.js +117 -0
- package/dist/holomesh-client.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.js +64 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2101 -0
- package/dist/index.js.map +1 -0
- package/dist/provision.d.ts +43 -0
- package/dist/provision.js +195 -0
- package/dist/provision.js.map +1 -0
- package/dist/runner.d.ts +62 -0
- package/dist/runner.js +543 -0
- package/dist/runner.js.map +1 -0
- package/dist/supervisor-config.d.ts +26 -0
- package/dist/supervisor-config.js +109 -0
- package/dist/supervisor-config.js.map +1 -0
- package/dist/supervisor.d.ts +53 -0
- package/dist/supervisor.js +1167 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LLMProviderName } from '@holoscript/llm-provider';
|
|
2
|
+
|
|
3
|
+
interface AgentSpec {
|
|
4
|
+
handle: string;
|
|
5
|
+
brainPath: string;
|
|
6
|
+
provider: LLMProviderName;
|
|
7
|
+
model: string;
|
|
8
|
+
walletEnvKey: string;
|
|
9
|
+
bearerEnvKey: string;
|
|
10
|
+
budgetUsdPerDay?: number;
|
|
11
|
+
scopeTier?: 'cold' | 'warm' | 'hot';
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
tickIntervalMs?: number;
|
|
14
|
+
enableCommitHook?: boolean;
|
|
15
|
+
outputDir?: string;
|
|
16
|
+
workingDir?: string;
|
|
17
|
+
}
|
|
18
|
+
interface SupervisorConfig {
|
|
19
|
+
agents: AgentSpec[];
|
|
20
|
+
globalBudgetUsdPerDay?: number;
|
|
21
|
+
defaultTickIntervalMs?: number;
|
|
22
|
+
}
|
|
23
|
+
declare function loadSupervisorConfig(path: string): SupervisorConfig;
|
|
24
|
+
declare function parseSupervisorConfig(raw: string): SupervisorConfig;
|
|
25
|
+
|
|
26
|
+
export { type AgentSpec, type SupervisorConfig, loadSupervisorConfig, parseSupervisorConfig };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/supervisor-config.ts
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
var VALID_PROVIDERS = /* @__PURE__ */ new Set([
|
|
4
|
+
"anthropic",
|
|
5
|
+
"openai",
|
|
6
|
+
"gemini",
|
|
7
|
+
"mock",
|
|
8
|
+
"bitnet",
|
|
9
|
+
"local-llm"
|
|
10
|
+
]);
|
|
11
|
+
var VALID_TIERS = /* @__PURE__ */ new Set(["cold", "warm", "hot"]);
|
|
12
|
+
var HANDLE_PATTERN = /^[a-z0-9_-]{1,64}$/i;
|
|
13
|
+
function loadSupervisorConfig(path) {
|
|
14
|
+
return parseSupervisorConfig(readFileSync(path, "utf8"));
|
|
15
|
+
}
|
|
16
|
+
function parseSupervisorConfig(raw) {
|
|
17
|
+
const data = JSON.parse(raw);
|
|
18
|
+
if (!isObject(data)) throw new Error("Supervisor config must be a JSON object");
|
|
19
|
+
if (!Array.isArray(data.agents)) throw new Error("Supervisor config.agents must be an array");
|
|
20
|
+
if (data.agents.length === 0) throw new Error("Supervisor config.agents must have at least one entry");
|
|
21
|
+
const seenHandles = /* @__PURE__ */ new Set();
|
|
22
|
+
const agents = data.agents.map((entry, idx) => validateAgent(entry, idx, seenHandles));
|
|
23
|
+
const globalBudgetUsdPerDay = optionalNumber(data, "globalBudgetUsdPerDay");
|
|
24
|
+
const defaultTickIntervalMs = optionalNumber(data, "defaultTickIntervalMs");
|
|
25
|
+
if (globalBudgetUsdPerDay != null && globalBudgetUsdPerDay <= 0) {
|
|
26
|
+
throw new Error(`globalBudgetUsdPerDay must be positive, got ${globalBudgetUsdPerDay}`);
|
|
27
|
+
}
|
|
28
|
+
if (defaultTickIntervalMs != null && defaultTickIntervalMs < 5e3) {
|
|
29
|
+
throw new Error(`defaultTickIntervalMs must be >= 5000ms (mesh-friendly), got ${defaultTickIntervalMs}`);
|
|
30
|
+
}
|
|
31
|
+
return { agents, globalBudgetUsdPerDay, defaultTickIntervalMs };
|
|
32
|
+
}
|
|
33
|
+
function validateAgent(entry, idx, seen) {
|
|
34
|
+
if (!isObject(entry)) throw new Error(`agents[${idx}] must be an object`);
|
|
35
|
+
const handle = requiredString(entry, "handle", `agents[${idx}].handle`);
|
|
36
|
+
if (!HANDLE_PATTERN.test(handle)) {
|
|
37
|
+
throw new Error(`agents[${idx}].handle "${handle}" must match ${HANDLE_PATTERN}`);
|
|
38
|
+
}
|
|
39
|
+
if (seen.has(handle)) throw new Error(`Duplicate agent handle: "${handle}"`);
|
|
40
|
+
seen.add(handle);
|
|
41
|
+
const provider = requiredString(entry, "provider", `agents[${idx}].provider`);
|
|
42
|
+
if (!VALID_PROVIDERS.has(provider)) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`agents[${idx}].provider "${provider}" not in [${[...VALID_PROVIDERS].join(", ")}]`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const scopeTier = optionalString(entry, "scopeTier");
|
|
48
|
+
if (scopeTier && !VALID_TIERS.has(scopeTier)) {
|
|
49
|
+
throw new Error(`agents[${idx}].scopeTier "${scopeTier}" must be cold | warm | hot`);
|
|
50
|
+
}
|
|
51
|
+
const budgetUsdPerDay = optionalNumber(entry, "budgetUsdPerDay");
|
|
52
|
+
if (budgetUsdPerDay != null && budgetUsdPerDay <= 0) {
|
|
53
|
+
throw new Error(`agents[${idx}].budgetUsdPerDay must be positive, got ${budgetUsdPerDay}`);
|
|
54
|
+
}
|
|
55
|
+
const tickIntervalMs = optionalNumber(entry, "tickIntervalMs");
|
|
56
|
+
if (tickIntervalMs != null && tickIntervalMs < 5e3) {
|
|
57
|
+
throw new Error(`agents[${idx}].tickIntervalMs must be >= 5000ms, got ${tickIntervalMs}`);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
handle,
|
|
61
|
+
brainPath: requiredString(entry, "brainPath", `agents[${idx}].brainPath`),
|
|
62
|
+
provider,
|
|
63
|
+
model: requiredString(entry, "model", `agents[${idx}].model`),
|
|
64
|
+
walletEnvKey: requiredString(entry, "walletEnvKey", `agents[${idx}].walletEnvKey`),
|
|
65
|
+
bearerEnvKey: requiredString(entry, "bearerEnvKey", `agents[${idx}].bearerEnvKey`),
|
|
66
|
+
budgetUsdPerDay,
|
|
67
|
+
scopeTier,
|
|
68
|
+
enabled: optionalBoolean(entry, "enabled"),
|
|
69
|
+
tickIntervalMs,
|
|
70
|
+
enableCommitHook: optionalBoolean(entry, "enableCommitHook"),
|
|
71
|
+
outputDir: optionalString(entry, "outputDir"),
|
|
72
|
+
workingDir: optionalString(entry, "workingDir")
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function isObject(v) {
|
|
76
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
77
|
+
}
|
|
78
|
+
function requiredString(obj, key, label) {
|
|
79
|
+
const v = obj[key];
|
|
80
|
+
if (typeof v !== "string" || v.trim().length === 0) {
|
|
81
|
+
throw new Error(`${label} is required and must be a non-empty string`);
|
|
82
|
+
}
|
|
83
|
+
return v.trim();
|
|
84
|
+
}
|
|
85
|
+
function optionalString(obj, key) {
|
|
86
|
+
const v = obj[key];
|
|
87
|
+
if (v === void 0 || v === null) return void 0;
|
|
88
|
+
if (typeof v !== "string") throw new Error(`${key} must be a string when present`);
|
|
89
|
+
return v.trim();
|
|
90
|
+
}
|
|
91
|
+
function optionalNumber(obj, key) {
|
|
92
|
+
const v = obj[key];
|
|
93
|
+
if (v === void 0 || v === null) return void 0;
|
|
94
|
+
if (typeof v !== "number" || !Number.isFinite(v)) {
|
|
95
|
+
throw new Error(`${key} must be a finite number when present`);
|
|
96
|
+
}
|
|
97
|
+
return v;
|
|
98
|
+
}
|
|
99
|
+
function optionalBoolean(obj, key) {
|
|
100
|
+
const v = obj[key];
|
|
101
|
+
if (v === void 0 || v === null) return void 0;
|
|
102
|
+
if (typeof v !== "boolean") throw new Error(`${key} must be a boolean when present`);
|
|
103
|
+
return v;
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
loadSupervisorConfig,
|
|
107
|
+
parseSupervisorConfig
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=supervisor-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/supervisor-config.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport type { LLMProviderName } from '@holoscript/llm-provider';\n\nexport interface AgentSpec {\n handle: string;\n brainPath: string;\n provider: LLMProviderName;\n model: string;\n walletEnvKey: string;\n bearerEnvKey: string;\n budgetUsdPerDay?: number;\n scopeTier?: 'cold' | 'warm' | 'hot';\n enabled?: boolean;\n tickIntervalMs?: number;\n enableCommitHook?: boolean;\n outputDir?: string;\n workingDir?: string;\n}\n\nexport interface SupervisorConfig {\n agents: AgentSpec[];\n globalBudgetUsdPerDay?: number;\n defaultTickIntervalMs?: number;\n}\n\nconst VALID_PROVIDERS: ReadonlySet<LLMProviderName> = new Set([\n 'anthropic',\n 'openai',\n 'gemini',\n 'mock',\n 'bitnet',\n 'local-llm',\n]);\n\nconst VALID_TIERS: ReadonlySet<string> = new Set(['cold', 'warm', 'hot']);\nconst HANDLE_PATTERN = /^[a-z0-9_-]{1,64}$/i;\n\nexport function loadSupervisorConfig(path: string): SupervisorConfig {\n return parseSupervisorConfig(readFileSync(path, 'utf8'));\n}\n\nexport function parseSupervisorConfig(raw: string): SupervisorConfig {\n const data = JSON.parse(raw) as unknown;\n if (!isObject(data)) throw new Error('Supervisor config must be a JSON object');\n if (!Array.isArray(data.agents)) throw new Error('Supervisor config.agents must be an array');\n if (data.agents.length === 0) throw new Error('Supervisor config.agents must have at least one entry');\n\n const seenHandles = new Set<string>();\n const agents: AgentSpec[] = data.agents.map((entry, idx) => validateAgent(entry, idx, seenHandles));\n\n const globalBudgetUsdPerDay = optionalNumber(data, 'globalBudgetUsdPerDay');\n const defaultTickIntervalMs = optionalNumber(data, 'defaultTickIntervalMs');\n if (globalBudgetUsdPerDay != null && globalBudgetUsdPerDay <= 0) {\n throw new Error(`globalBudgetUsdPerDay must be positive, got ${globalBudgetUsdPerDay}`);\n }\n if (defaultTickIntervalMs != null && defaultTickIntervalMs < 5000) {\n throw new Error(`defaultTickIntervalMs must be >= 5000ms (mesh-friendly), got ${defaultTickIntervalMs}`);\n }\n\n return { agents, globalBudgetUsdPerDay, defaultTickIntervalMs };\n}\n\nfunction validateAgent(entry: unknown, idx: number, seen: Set<string>): AgentSpec {\n if (!isObject(entry)) throw new Error(`agents[${idx}] must be an object`);\n const handle = requiredString(entry, 'handle', `agents[${idx}].handle`);\n if (!HANDLE_PATTERN.test(handle)) {\n throw new Error(`agents[${idx}].handle \"${handle}\" must match ${HANDLE_PATTERN}`);\n }\n if (seen.has(handle)) throw new Error(`Duplicate agent handle: \"${handle}\"`);\n seen.add(handle);\n\n const provider = requiredString(entry, 'provider', `agents[${idx}].provider`);\n if (!VALID_PROVIDERS.has(provider as LLMProviderName)) {\n throw new Error(\n `agents[${idx}].provider \"${provider}\" not in [${[...VALID_PROVIDERS].join(', ')}]`\n );\n }\n\n const scopeTier = optionalString(entry, 'scopeTier');\n if (scopeTier && !VALID_TIERS.has(scopeTier)) {\n throw new Error(`agents[${idx}].scopeTier \"${scopeTier}\" must be cold | warm | hot`);\n }\n\n const budgetUsdPerDay = optionalNumber(entry, 'budgetUsdPerDay');\n if (budgetUsdPerDay != null && budgetUsdPerDay <= 0) {\n throw new Error(`agents[${idx}].budgetUsdPerDay must be positive, got ${budgetUsdPerDay}`);\n }\n const tickIntervalMs = optionalNumber(entry, 'tickIntervalMs');\n if (tickIntervalMs != null && tickIntervalMs < 5000) {\n throw new Error(`agents[${idx}].tickIntervalMs must be >= 5000ms, got ${tickIntervalMs}`);\n }\n\n return {\n handle,\n brainPath: requiredString(entry, 'brainPath', `agents[${idx}].brainPath`),\n provider: provider as LLMProviderName,\n model: requiredString(entry, 'model', `agents[${idx}].model`),\n walletEnvKey: requiredString(entry, 'walletEnvKey', `agents[${idx}].walletEnvKey`),\n bearerEnvKey: requiredString(entry, 'bearerEnvKey', `agents[${idx}].bearerEnvKey`),\n budgetUsdPerDay,\n scopeTier: scopeTier as 'cold' | 'warm' | 'hot' | undefined,\n enabled: optionalBoolean(entry, 'enabled'),\n tickIntervalMs,\n enableCommitHook: optionalBoolean(entry, 'enableCommitHook'),\n outputDir: optionalString(entry, 'outputDir'),\n workingDir: optionalString(entry, 'workingDir'),\n };\n}\n\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\n\nfunction requiredString(obj: Record<string, unknown>, key: string, label: string): string {\n const v = obj[key];\n if (typeof v !== 'string' || v.trim().length === 0) {\n throw new Error(`${label} is required and must be a non-empty string`);\n }\n return v.trim();\n}\n\nfunction optionalString(obj: Record<string, unknown>, key: string): string | undefined {\n const v = obj[key];\n if (v === undefined || v === null) return undefined;\n if (typeof v !== 'string') throw new Error(`${key} must be a string when present`);\n return v.trim();\n}\n\nfunction optionalNumber(obj: Record<string, unknown>, key: string): number | undefined {\n const v = obj[key];\n if (v === undefined || v === null) return undefined;\n if (typeof v !== 'number' || !Number.isFinite(v)) {\n throw new Error(`${key} must be a finite number when present`);\n }\n return v;\n}\n\nfunction optionalBoolean(obj: Record<string, unknown>, key: string): boolean | undefined {\n const v = obj[key];\n if (v === undefined || v === null) return undefined;\n if (typeof v !== 'boolean') throw new Error(`${key} must be a boolean when present`);\n return v;\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAyB7B,IAAM,kBAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,cAAmC,oBAAI,IAAI,CAAC,QAAQ,QAAQ,KAAK,CAAC;AACxE,IAAM,iBAAiB;AAEhB,SAAS,qBAAqB,MAAgC;AACnE,SAAO,sBAAsB,aAAa,MAAM,MAAM,CAAC;AACzD;AAEO,SAAS,sBAAsB,KAA+B;AACnE,QAAM,OAAO,KAAK,MAAM,GAAG;AAC3B,MAAI,CAAC,SAAS,IAAI,EAAG,OAAM,IAAI,MAAM,yCAAyC;AAC9E,MAAI,CAAC,MAAM,QAAQ,KAAK,MAAM,EAAG,OAAM,IAAI,MAAM,2CAA2C;AAC5F,MAAI,KAAK,OAAO,WAAW,EAAG,OAAM,IAAI,MAAM,uDAAuD;AAErG,QAAM,cAAc,oBAAI,IAAY;AACpC,QAAM,SAAsB,KAAK,OAAO,IAAI,CAAC,OAAO,QAAQ,cAAc,OAAO,KAAK,WAAW,CAAC;AAElG,QAAM,wBAAwB,eAAe,MAAM,uBAAuB;AAC1E,QAAM,wBAAwB,eAAe,MAAM,uBAAuB;AAC1E,MAAI,yBAAyB,QAAQ,yBAAyB,GAAG;AAC/D,UAAM,IAAI,MAAM,+CAA+C,qBAAqB,EAAE;AAAA,EACxF;AACA,MAAI,yBAAyB,QAAQ,wBAAwB,KAAM;AACjE,UAAM,IAAI,MAAM,gEAAgE,qBAAqB,EAAE;AAAA,EACzG;AAEA,SAAO,EAAE,QAAQ,uBAAuB,sBAAsB;AAChE;AAEA,SAAS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AiC;AACnF,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ILLMProvider } from '@holoscript/llm-provider';
|
|
2
|
+
import { AgentSpec, SupervisorConfig } from './supervisor-config.js';
|
|
3
|
+
import { AgentIdentity } from './types.js';
|
|
4
|
+
|
|
5
|
+
interface ProviderFactory {
|
|
6
|
+
(spec: AgentSpec, identity: AgentIdentity): Promise<ILLMProvider> | ILLMProvider;
|
|
7
|
+
}
|
|
8
|
+
interface SupervisorAgentStatus {
|
|
9
|
+
handle: string;
|
|
10
|
+
state: 'starting' | 'running' | 'crashed' | 'over-budget' | 'stopped';
|
|
11
|
+
spentUsd: number;
|
|
12
|
+
remainingUsd: number;
|
|
13
|
+
lastTickAt?: string;
|
|
14
|
+
lastError?: string;
|
|
15
|
+
restarts: number;
|
|
16
|
+
}
|
|
17
|
+
interface SupervisorStatus {
|
|
18
|
+
globalSpentUsd: number;
|
|
19
|
+
globalRemainingUsd: number;
|
|
20
|
+
globalBudgetExhausted: boolean;
|
|
21
|
+
agents: SupervisorAgentStatus[];
|
|
22
|
+
}
|
|
23
|
+
interface SupervisorOptions {
|
|
24
|
+
config: SupervisorConfig;
|
|
25
|
+
providerFactory: ProviderFactory;
|
|
26
|
+
meshApiBase?: string;
|
|
27
|
+
teamId: string;
|
|
28
|
+
stateDir?: string;
|
|
29
|
+
auditLogPath?: string;
|
|
30
|
+
logger?: (event: Record<string, unknown>) => void;
|
|
31
|
+
fetchImpl?: typeof fetch;
|
|
32
|
+
now?: () => Date;
|
|
33
|
+
}
|
|
34
|
+
declare class Supervisor {
|
|
35
|
+
private readonly opts;
|
|
36
|
+
private readonly agents;
|
|
37
|
+
private stopped;
|
|
38
|
+
private globalBudgetUsdPerDay?;
|
|
39
|
+
private readonly auditLog?;
|
|
40
|
+
constructor(opts: SupervisorOptions);
|
|
41
|
+
start(): Promise<void>;
|
|
42
|
+
stop(): Promise<void>;
|
|
43
|
+
status(): SupervisorStatus;
|
|
44
|
+
tickOnce(handle: string): Promise<SupervisorAgentStatus>;
|
|
45
|
+
private bootAgent;
|
|
46
|
+
private buildCommitHook;
|
|
47
|
+
private identityFromSpec;
|
|
48
|
+
private spawnLoop;
|
|
49
|
+
private runOneTick;
|
|
50
|
+
private log;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { type ProviderFactory, Supervisor, type SupervisorAgentStatus, type SupervisorOptions, type SupervisorStatus };
|