Skip to content

Commit

Permalink
Minor fixes in body
Browse files Browse the repository at this point in the history
  • Loading branch information
synw committed Mar 6, 2024
1 parent d95c886 commit fbeb4cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/body/src/bodyinterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MapStore } from "nanostores";
import { AgentBrain } from "@agent-smith/brain"
import { AgentJob } from "../../jobs/src/jobsinterfaces.js";

/**
* Interface for the specification of an agent.
Expand All @@ -14,6 +15,7 @@ interface AgentSpec {
props?: Record<string, any>;
modules?: Array<Record<string, any>>;
brain?: AgentBrain;
jobs?: Array<AgentJob>;
}

/**
Expand All @@ -37,7 +39,7 @@ interface AgentInteractions {
}

interface AgentState {
text: StructuredSerializeOptions,
text: string,
component: string,
isVisible: boolean,
isInteracting: boolean,
Expand All @@ -52,6 +54,7 @@ interface AgentSmith {
interactions: MapStore<AgentInteractions>;
// modules
brain: AgentBrain;
jobs: Array<AgentJob>;
// methods
show: () => void;
hide: () => void;
Expand Down
9 changes: 6 additions & 3 deletions packages/body/src/core.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { map } from 'nanostores'
import { AgentSmith, type AgentSpec, type ConfirmFunction, type ConfirmOptions } from "./bodyinterfaces.js";
import { AgentSmith, AgentState, type AgentSpec, type ConfirmFunction, type ConfirmOptions } from "./bodyinterfaces.js";
import { AgentBrain } from '@agent-smith/brain';
import { AgentJob } from "../../jobs/src/jobsinterfaces.js";

const useAgentSmith = (initParams: AgentSpec): AgentSmith => {
const name = initParams.name;
const props = initParams.props ?? {};
const modules = initParams.modules;
const brain: AgentBrain = initParams.brain ?? {} as AgentBrain;
const brain: AgentBrain = initParams?.brain ?? {} as AgentBrain;
const jobs: Array<AgentJob> = initParams?.jobs ?? new Array<AgentJob>();
//public state
const state = map({
const state = map<AgentState>({
text: "",
component: "AgentBaseText",
isVisible: false,
Expand Down Expand Up @@ -146,6 +148,7 @@ const useAgentSmith = (initParams: AgentSpec): AgentSmith => {
interactions,
props,
brain,
jobs,
show,
hide,
talk,
Expand Down

0 comments on commit fbeb4cd

Please sign in to comment.