@bluexlab/maos-ts
Advanced tools
Comparing version 0.0.4 to 0.1.1
@@ -10,2 +10,3 @@ import { Level, Logger } from 'pino'; | ||
concurrentInvocationNum?: number; | ||
version?: string; | ||
} | ||
@@ -15,2 +16,3 @@ interface MaosClientConfig { | ||
coreUrl: string; | ||
version?: string; | ||
} | ||
@@ -20,2 +22,5 @@ interface MaosResponse { | ||
} | ||
interface MaosGetConfigResponse extends MaosResponse { | ||
data: Record<string, string>; | ||
} | ||
interface InvocationMetaType extends Record<string, string> { | ||
@@ -47,2 +52,3 @@ kind: string; | ||
private logLevel; | ||
private version; | ||
private handlers; | ||
@@ -53,3 +59,2 @@ private shouldRun; | ||
constructor(config?: MaosConfig); | ||
getConfig(): ResultAsync<MaosResponse, Error>; | ||
getLogger(): Logger; | ||
@@ -72,4 +77,4 @@ on(methodName: string, handler: HandlerType): Maos; | ||
constructor(config: MaosClientConfig); | ||
execute(agent: string, kind: string, input: Record<string, unknown>, wait?: number): ResultAsync<MaosResponse, Error>; | ||
executeAsync(agent: string, kind: string, input: Record<string, unknown>): ResultAsync<MaosAsyncResponder, Error>; | ||
execute(actor: string, kind: string, input: Record<string, unknown>, wait?: number): ResultAsync<MaosResponse, Error>; | ||
executeAsync(actor: string, kind: string, input: Record<string, unknown>): ResultAsync<MaosAsyncResponder, Error>; | ||
private fetchWithAuth; | ||
@@ -85,2 +90,2 @@ private getInvocationResult; | ||
export { type HandlerContext, type HandlerInputType, type HandlerResultType, type HandlerType, type Invocation, type InvocationMetaType, Maos, MaosClient, type MaosClientConfig, type MaosConfig, type MaosResponse }; | ||
export { type HandlerContext, type HandlerInputType, type HandlerResultType, type HandlerType, type Invocation, type InvocationMetaType, Maos, MaosClient, type MaosClientConfig, type MaosConfig, type MaosGetConfigResponse, type MaosResponse }; |
@@ -70,2 +70,3 @@ // src/maos.ts | ||
logLevel; | ||
version; | ||
// internal state | ||
@@ -82,2 +83,3 @@ handlers; | ||
this.concurrentInvocationNum = config.concurrentInvocationNum || Number.parseInt(process.env.CONCURRENT_INVOCATION_NUM || "1") || 1; | ||
this.version = config.version; | ||
if (!this.apiKey) { | ||
@@ -92,5 +94,2 @@ throw new Error("API key is required. Please provide it in the constructor or set the APIKEY environment variable."); | ||
} | ||
getConfig() { | ||
return this.fetchWithAuth("/v1/config").mapErr((err3) => err3 instanceof Error ? err3 : new Error(String(err3))); | ||
} | ||
getLogger() { | ||
@@ -121,2 +120,3 @@ return this.logger; | ||
"Content-Type": "application/json", | ||
...this.version ? { "X-Actor-Version": this.version } : {}, | ||
...options.headers | ||
@@ -257,13 +257,13 @@ }); | ||
} | ||
execute(agent, kind, input, wait) { | ||
execute(actor, kind, input, wait) { | ||
const path = `/v1/invocations/sync${wait ? `?wait=${wait}` : ""}`; | ||
return this.fetchWithAuth( | ||
path, | ||
{ method: "POST", body: JSON.stringify({ agent, meta: { kind }, payload: input }) } | ||
{ method: "POST", body: JSON.stringify({ actor, meta: { kind }, payload: input }) } | ||
).mapErr((err3) => err3 instanceof Error ? err3 : new Error(String(err3))); | ||
} | ||
executeAsync(agent, kind, input) { | ||
executeAsync(actor, kind, input) { | ||
return this.fetchWithAuth("/v1/invocations/async", { | ||
method: "POST", | ||
body: JSON.stringify({ agent, meta: { kind }, payload: input }) | ||
body: JSON.stringify({ actor, meta: { kind }, payload: input }) | ||
}).andThen((res) => { | ||
@@ -270,0 +270,0 @@ if (!res || !res.id || typeof res.id !== "string") { |
{ | ||
"name": "@bluexlab/maos-ts", | ||
"type": "module", | ||
"version": "0.0.4", | ||
"version": "0.1.1", | ||
"packageManager": "pnpm@9.5.0", | ||
@@ -36,3 +36,3 @@ "description": "TypeScript binding of MAOS", | ||
"format": "prettier --cache --write .", | ||
"release": "bumpp && pnpm publish", | ||
"release": "pnpm publish", | ||
"prepublishOnly": "pnpm run build" | ||
@@ -39,0 +39,0 @@ }, |
@@ -5,3 +5,3 @@ # MAOS TypeScript Library | ||
MAOS (Multi-Agent Operating System) is designed to provide infrastructure for AI agents to manage shared resources efficiently. This TypeScript library is a binding of MAOS, offering a robust interface for system administrators to handle all management tasks through an intuitive admin UI. | ||
MAOS (Multi-Actor Operating System) is designed to provide infrastructure for AI agents to manage shared resources efficiently. This TypeScript library is a binding of MAOS, offering a robust interface for system administrators to handle all management tasks through an intuitive admin UI. | ||
@@ -8,0 +8,0 @@ ## Table of Contents |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31742
687