agency-lang 0.0.8 → 0.0.10

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.
Files changed (36) hide show
  1. package/dist/lib/backends/agencyGenerator.d.ts +2 -0
  2. package/dist/lib/backends/agencyGenerator.js +14 -5
  3. package/dist/lib/backends/baseGenerator.d.ts +4 -1
  4. package/dist/lib/backends/baseGenerator.js +6 -1
  5. package/dist/lib/backends/graphGenerator.d.ts +1 -1
  6. package/dist/lib/backends/graphGenerator.js +14 -8
  7. package/dist/lib/backends/typescriptGenerator/builtins.js +6 -0
  8. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.d.ts +1 -0
  9. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.js +3 -2
  10. package/dist/lib/backends/typescriptGenerator.d.ts +2 -0
  11. package/dist/lib/backends/typescriptGenerator.js +15 -1
  12. package/dist/lib/parser.js +2 -1
  13. package/dist/lib/parsers/function.js +2 -1
  14. package/dist/lib/parsers/specialVar.d.ts +4 -0
  15. package/dist/lib/parsers/specialVar.js +8 -0
  16. package/dist/lib/templates/backends/graphGenerator/imports.d.ts +1 -1
  17. package/dist/lib/templates/backends/graphGenerator/imports.js +26 -11
  18. package/dist/lib/templates/backends/graphGenerator/runNodeFunction.d.ts +6 -0
  19. package/dist/lib/templates/backends/graphGenerator/runNodeFunction.js +13 -0
  20. package/dist/lib/templates/backends/graphGenerator/specialVar.d.ts +7 -0
  21. package/dist/lib/templates/backends/graphGenerator/specialVar.js +9 -0
  22. package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/readImage.d.ts +4 -0
  23. package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/readImage.js +17 -0
  24. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  25. package/dist/lib/templates/backends/typescriptGenerator/imports.js +7 -1
  26. package/dist/lib/templates/backends/typescriptGenerator/promptFunction.d.ts +2 -1
  27. package/dist/lib/templates/backends/typescriptGenerator/promptFunction.js +18 -4
  28. package/dist/lib/types/specialVar.d.ts +9 -0
  29. package/dist/lib/types/specialVar.js +1 -0
  30. package/dist/lib/types.d.ts +2 -1
  31. package/dist/scripts/agency.js +35 -8
  32. package/dist/scripts/regenerate-fixtures.d.ts +2 -0
  33. package/dist/scripts/regenerate-fixtures.js +36 -0
  34. package/dist/scripts/regenerate-graph-fixtures.d.ts +2 -0
  35. package/dist/scripts/regenerate-graph-fixtures.js +36 -0
  36. package/package.json +8 -7
@@ -1,3 +1,4 @@
1
+ import { SpecialVar } from "../types/specialVar.js";
1
2
  import { AgencyComment, AgencyProgram, Assignment, Literal, PromptLiteral, TypeAlias, TypeHint, VariableType } from "../types.js";
2
3
  import { AccessExpression, DotFunctionCall, DotProperty, IndexAccess } from "../types/access.js";
3
4
  import { AgencyArray, AgencyObject } from "../types/dataStructures.js";
@@ -44,6 +45,7 @@ export declare class AgencyGenerator extends BaseGenerator {
44
45
  protected processGraphNode(node: GraphNodeDefinition): string;
45
46
  protected processTool(node: FunctionDefinition): string;
46
47
  protected processUsesTool(node: UsesTool): string;
48
+ protected processSpecialVar(node: SpecialVar): string;
47
49
  private indentStr;
48
50
  }
49
51
  export declare function generateAgency(program: AgencyProgram): string;
@@ -58,7 +58,7 @@ export class AgencyGenerator extends BaseGenerator {
58
58
  // Assignment and literals
59
59
  processAssignment(node) {
60
60
  const valueCode = this.processNode(node.value).trim();
61
- return this.indentStr(`${node.variableName} = ${valueCode}\n\n`);
61
+ return this.indentStr(`${node.variableName} = ${valueCode}\n`);
62
62
  }
63
63
  generateLiteral(literal) {
64
64
  switch (literal.type) {
@@ -106,9 +106,12 @@ export class AgencyGenerator extends BaseGenerator {
106
106
  // Process body with increased indentation
107
107
  this.increaseIndent();
108
108
  this.functionScopedVariables = [...parameters];
109
+ const lines = [];
109
110
  for (const stmt of body) {
110
- result += this.processNode(stmt);
111
+ lines.push(this.processNode(stmt));
111
112
  }
113
+ const bodyCode = lines.join("").trimEnd() + "\n";
114
+ result += bodyCode;
112
115
  this.functionScopedVariables = [];
113
116
  this.decreaseIndent();
114
117
  // Close function
@@ -204,10 +207,10 @@ export class AgencyGenerator extends BaseGenerator {
204
207
  }
205
208
  // Utility methods
206
209
  processComment(node) {
207
- return this.indentStr(`// ${node.content}\n`);
210
+ return this.indentStr(`//${node.content}\n`);
208
211
  }
209
212
  processImportStatement(node) {
210
- return this.indentStr(`import {${node.importedNames}} from "${node.modulePath}"\n`);
213
+ return this.indentStr(`import ${node.importedNames}from ${node.modulePath}`);
211
214
  }
212
215
  processGraphNode(node) {
213
216
  // Graph nodes use similar syntax to functions
@@ -216,9 +219,12 @@ export class AgencyGenerator extends BaseGenerator {
216
219
  let result = this.indentStr(`node ${nodeName}(${params}) {\n`);
217
220
  this.increaseIndent();
218
221
  this.functionScopedVariables = [...parameters];
222
+ const lines = [];
219
223
  for (const stmt of body) {
220
- result += this.processNode(stmt);
224
+ lines.push(this.processNode(stmt));
221
225
  }
226
+ const bodyCode = lines.join("").trimEnd() + "\n";
227
+ result += bodyCode;
222
228
  this.functionScopedVariables = [];
223
229
  this.decreaseIndent();
224
230
  result += this.indentStr(`}\n`);
@@ -234,6 +240,9 @@ export class AgencyGenerator extends BaseGenerator {
234
240
  this.toolsUsed.push(node.toolName);
235
241
  return this.indentStr(`+${node.toolName}\n`);
236
242
  }
243
+ processSpecialVar(node) {
244
+ return this.indentStr(`@${node.name} = ${this.processNode(node.value).trim()}\n`);
245
+ }
237
246
  indentStr(str) {
238
247
  return `${this.indent()}${str}`;
239
248
  }
@@ -1,3 +1,4 @@
1
+ import { SpecialVar } from "../types/specialVar.js";
1
2
  import { AgencyComment, AgencyNode, AgencyProgram, Assignment, Literal, PromptLiteral, TypeAlias, TypeHint, TypeHintMap, VariableType } from "../types.js";
2
3
  import { AccessExpression, DotFunctionCall, DotProperty, IndexAccess } from "../types/access.js";
3
4
  import { AgencyArray, AgencyObject } from "../types/dataStructures.js";
@@ -5,6 +6,7 @@ import { FunctionCall, FunctionDefinition } from "../types/function.js";
5
6
  import { GraphNodeDefinition } from "../types/graphNode.js";
6
7
  import { ImportStatement } from "../types/importStatement.js";
7
8
  import { MatchBlock } from "../types/matchBlock.js";
9
+ import { ReturnStatement } from "../types/returnStatement.js";
8
10
  import { UsesTool } from "../types/tools.js";
9
11
  import { WhileLoop } from "../types/whileLoop.js";
10
12
  export declare class BaseGenerator {
@@ -28,6 +30,7 @@ export declare class BaseGenerator {
28
30
  protected collectFunctionSignature(node: FunctionDefinition): void;
29
31
  protected processGraphNodeName(node: GraphNodeDefinition): void;
30
32
  protected processNode(node: AgencyNode): string;
33
+ protected processSpecialVar(node: SpecialVar): string;
31
34
  protected processWhileLoop(node: WhileLoop): string;
32
35
  protected processImportStatement(node: ImportStatement): string;
33
36
  protected processTool(node: FunctionDefinition): string;
@@ -36,7 +39,7 @@ export declare class BaseGenerator {
36
39
  protected processAgencyObject(node: AgencyObject): string;
37
40
  protected processAgencyArray(node: AgencyArray): string;
38
41
  protected processComment(node: AgencyComment): string;
39
- protected processReturnStatement(node: AgencyNode): string;
42
+ protected processReturnStatement(node: ReturnStatement): string;
40
43
  protected processAccessExpression(node: AccessExpression): string;
41
44
  protected processMatchBlock(node: MatchBlock): string;
42
45
  protected processDotProperty(node: DotProperty): string;
@@ -54,7 +54,7 @@ export class BaseGenerator {
54
54
  output.push(this.generatedStatements.join(""));
55
55
  output.push(this.postprocess() + "\n");
56
56
  return {
57
- output: output.filter(Boolean).join("\n"),
57
+ output: output.filter((line) => line.trim() !== "").join("\n"),
58
58
  };
59
59
  }
60
60
  generateBuiltins() {
@@ -111,10 +111,15 @@ export class BaseGenerator {
111
111
  return "";
112
112
  case "whileLoop":
113
113
  return this.processWhileLoop(node);
114
+ case "specialVar":
115
+ return this.processSpecialVar(node);
114
116
  default:
115
117
  throw new Error(`Unhandled Agency node type: ${node.type}`);
116
118
  }
117
119
  }
120
+ processSpecialVar(node) {
121
+ return "processSpecialVar not implemented";
122
+ }
118
123
  processWhileLoop(node) {
119
124
  return "processWhileLoop not implemented";
120
125
  }
@@ -1,7 +1,7 @@
1
1
  import { AgencyProgram, FunctionCall, TypeHintMap, VariableType } from "../types.js";
2
- import { TypeScriptGenerator } from "./typescriptGenerator.js";
3
2
  import { GraphNodeDefinition } from "../types/graphNode.js";
4
3
  import { ReturnStatement } from "../types/returnStatement.js";
4
+ import { TypeScriptGenerator } from "./typescriptGenerator.js";
5
5
  export declare class GraphGenerator extends TypeScriptGenerator {
6
6
  protected typeHints: TypeHintMap;
7
7
  protected generatedStatements: string[];
@@ -1,9 +1,10 @@
1
+ import * as builtinTools from "../templates/backends/graphGenerator/builtinTools.js";
1
2
  import * as renderConditionalEdge from "../templates/backends/graphGenerator/conditionalEdge.js";
3
+ import * as goToNode from "../templates/backends/graphGenerator/goToNode.js";
4
+ import * as graphNode from "../templates/backends/graphGenerator/graphNode.js";
2
5
  import * as renderImports from "../templates/backends/graphGenerator/imports.js";
3
6
  import * as renderStartNode from "../templates/backends/graphGenerator/startNode.js";
4
- import * as graphNode from "../templates/backends/graphGenerator/graphNode.js";
5
- import * as builtinTools from "../templates/backends/graphGenerator/builtinTools.js";
6
- import * as goToNode from "../templates/backends/graphGenerator/goToNode.js";
7
+ import * as renderRunNodeFunction from "../templates/backends/graphGenerator/runNodeFunction.js";
7
8
  import { TypeScriptGenerator } from "./typescriptGenerator.js";
8
9
  import { mapFunctionName } from "./typescriptGenerator/builtins.js";
9
10
  export class GraphGenerator extends TypeScriptGenerator {
@@ -293,12 +294,17 @@ export class GraphGenerator extends TypeScriptGenerator {
293
294
  toNodes: JSON.stringify(adjacent),
294
295
  }));
295
296
  });
296
- if (!this.graphNodes.includes("main")) {
297
- throw new Error("No entrypoint found for agent: missing 'main' node. Please create a node named 'main'.");
297
+ if (this.graphNodes.includes("main")) {
298
+ lines.push(renderStartNode.default({
299
+ startNode: "main",
300
+ }));
301
+ }
302
+ for (const node of this.graphNodes) {
303
+ lines.push(renderRunNodeFunction.default({
304
+ nodeName: node,
305
+ }));
298
306
  }
299
- lines.push(renderStartNode.default({
300
- startNode: "main",
301
- }));
307
+ lines.push("export default graph;");
302
308
  return lines.join("\n");
303
309
  }
304
310
  }
@@ -1,5 +1,6 @@
1
1
  import * as builtinFunctionsInput from "../../templates/backends/typescriptGenerator/builtinFunctions/input.js";
2
2
  import * as builtinFunctionsRead from "../../templates/backends/typescriptGenerator/builtinFunctions/read.js";
3
+ import * as builtinFunctionsReadImage from "../../templates/backends/typescriptGenerator/builtinFunctions/readImage.js";
3
4
  import * as builtinFunctionsFetchJSON from "../../templates/backends/typescriptGenerator/builtinFunctions/fetchJSON.js";
4
5
  import * as builtinFunctionsFetch from "../../templates/backends/typescriptGenerator/builtinFunctions/fetch.js";
5
6
  /**
@@ -9,6 +10,7 @@ export const BUILTIN_FUNCTIONS = {
9
10
  print: "console.log",
10
11
  input: "_builtinInput",
11
12
  read: "_builtinRead",
13
+ readImage: "_builtinReadImage",
12
14
  write: "fs.writeFileSync",
13
15
  fetch: "_builtinFetch",
14
16
  fetchJSON: "_builtinFetchJSON",
@@ -42,5 +44,9 @@ export function generateBuiltinHelpers(functionsUsed) {
42
44
  const fetchFunc = builtinFunctionsFetch.default({});
43
45
  helpers.push(fetchFunc);
44
46
  }
47
+ if (functionsUsed.has("readImage")) {
48
+ const readImageFunc = builtinFunctionsReadImage.default({});
49
+ helpers.push(readImageFunc);
50
+ }
45
51
  return helpers.join("\n\n");
46
52
  }
@@ -1,4 +1,5 @@
1
1
  import { VariableType } from "../../types.js";
2
+ export declare const DEFAULT_SCHEMA = "z.string()";
2
3
  /**
3
4
  * Maps Agency types to Zod schema strings
4
5
  */
@@ -1,4 +1,5 @@
1
1
  import { escape } from "../../utils.js";
2
+ export const DEFAULT_SCHEMA = "z.string()";
2
3
  /**
3
4
  * Maps Agency types to Zod schema strings
4
5
  */
@@ -8,12 +9,12 @@ export function mapTypeToZodSchema(variableType, typeAliases) {
8
9
  case "number":
9
10
  return "z.number()";
10
11
  case "string":
11
- return "z.string()";
12
+ return DEFAULT_SCHEMA;
12
13
  case "boolean":
13
14
  return "z.boolean()";
14
15
  default:
15
16
  // Default to string for unknown types
16
- return "z.string()";
17
+ return DEFAULT_SCHEMA;
17
18
  }
18
19
  }
19
20
  else if (variableType.type === "arrayType") {
@@ -8,6 +8,7 @@ import { ReturnStatement } from "../types/returnStatement.js";
8
8
  import { UsesTool } from "../types/tools.js";
9
9
  import { ImportStatement } from "../types/importStatement.js";
10
10
  import { WhileLoop } from "../types/whileLoop.js";
11
+ import { SpecialVar } from "../types/specialVar.js";
11
12
  export declare class TypeScriptGenerator extends BaseGenerator {
12
13
  constructor();
13
14
  protected generateBuiltins(): string;
@@ -52,5 +53,6 @@ export declare class TypeScriptGenerator extends BaseGenerator {
52
53
  }): string;
53
54
  protected processImportStatement(node: ImportStatement): string;
54
55
  protected processWhileLoop(node: WhileLoop): string;
56
+ protected processSpecialVar(node: SpecialVar): string;
55
57
  }
56
58
  export declare function generateTypeScript(program: AgencyProgram): string;
@@ -3,11 +3,12 @@ import * as promptFunction from "../templates/backends/typescriptGenerator/promp
3
3
  import * as renderTool from "../templates/backends/typescriptGenerator/tool.js";
4
4
  import * as renderToolCall from "../templates/backends/typescriptGenerator/toolCall.js";
5
5
  import * as renderFunctionDefinition from "../templates/backends/typescriptGenerator/functionDefinition.js";
6
+ import * as renderSpecialVar from "../templates/backends/graphGenerator/specialVar.js";
6
7
  import { escape, zip } from "../utils.js";
7
8
  import { BaseGenerator } from "./baseGenerator.js";
8
9
  import { generateBuiltinHelpers, mapFunctionName, } from "./typescriptGenerator/builtins.js";
9
10
  import { variableTypeToString } from "./typescriptGenerator/typeToString.js";
10
- import { mapTypeToZodSchema } from "./typescriptGenerator/typeToZodSchema.js";
11
+ import { DEFAULT_SCHEMA, mapTypeToZodSchema, } from "./typescriptGenerator/typeToZodSchema.js";
11
12
  import * as builtinTools from "../templates/backends/typescriptGenerator/builtinTools.js";
12
13
  export class TypeScriptGenerator extends BaseGenerator {
13
14
  constructor() {
@@ -318,6 +319,7 @@ export class TypeScriptGenerator extends BaseGenerator {
318
319
  argsStr,
319
320
  typeString,
320
321
  promptCode,
322
+ hasResponseFormat: zodSchema !== DEFAULT_SCHEMA,
321
323
  zodSchema,
322
324
  tools,
323
325
  functionCalls,
@@ -335,6 +337,18 @@ export class TypeScriptGenerator extends BaseGenerator {
335
337
  const bodyCodeStr = bodyCodes.join("\n");
336
338
  return `while (${conditionCode}) {\n${bodyCodeStr}\n}\n`;
337
339
  }
340
+ processSpecialVar(node) {
341
+ const value = this.processNode(node.value);
342
+ switch (node.name) {
343
+ case "model":
344
+ return renderSpecialVar.default({
345
+ name: "model",
346
+ value,
347
+ });
348
+ default:
349
+ throw new Error(`Unhandled SpecialVar name: ${node.name}`);
350
+ }
351
+ }
338
352
  }
339
353
  export function generateTypeScript(program) {
340
354
  const generator = new TypeScriptGenerator();
@@ -10,8 +10,9 @@ import { matchBlockParser } from "./parsers/matchBlock.js";
10
10
  import { returnStatementParser } from "./parsers/returnStatement.js";
11
11
  import { usesToolParser } from "./parsers/tools.js";
12
12
  import { EgonLog } from "egonlog";
13
+ import { specialVarParser } from "./parsers/specialVar.js";
13
14
  export const agencyNode = (input) => {
14
- const parser = sepBy(spaces, trace("agencyParser", or(usesToolParser, importStatmentParser, graphNodeParser, typeAliasParser, whileLoopParser, typeHintParser, matchBlockParser, functionParser, returnStatementParser, accessExpressionParser, assignmentParser, functionCallParser, commentParser)));
15
+ const parser = sepBy(spaces, trace("agencyParser", or(usesToolParser, importStatmentParser, graphNodeParser, typeAliasParser, whileLoopParser, typeHintParser, matchBlockParser, functionParser, returnStatementParser, specialVarParser, accessExpressionParser, assignmentParser, functionCallParser, commentParser)));
15
16
  return parser(input);
16
17
  };
17
18
  export const agencyParser = seqC(set("type", "agencyProgram"), capture(agencyNode, "nodes"), eof);
@@ -10,10 +10,11 @@ import { typeAliasParser, typeHintParser } from "./typeHints.js";
10
10
  import { comma, optionalSpaces, varNameChar } from "./utils.js";
11
11
  import { returnStatementParser } from "./returnStatement.js";
12
12
  import { usesToolParser } from "./tools.js";
13
+ import { specialVarParser } from "./specialVar.js";
13
14
  const trim = (s) => s.trim();
14
15
  export const docStringParser = trace("docStringParser", seqC(set("type", "docString"), str('"""'), capture(map(many1Till(str('"""')), trim), "value"), str('"""')));
15
16
  export const bodyParser = trace("functionBodyParser", (input) => {
16
- const parser = sepBy(spaces, or(usesToolParser, debug(typeAliasParser, "error in typeAliasParser"), debug(typeHintParser, "error in typeHintParser"), returnStatementParser, whileLoopParser, matchBlockParser, functionParser, accessExpressionParser, assignmentParser, functionCallParser, literalParser, commentParser));
17
+ const parser = sepBy(spaces, or(usesToolParser, debug(typeAliasParser, "error in typeAliasParser"), debug(typeHintParser, "error in typeHintParser"), specialVarParser, returnStatementParser, whileLoopParser, matchBlockParser, functionParser, accessExpressionParser, assignmentParser, functionCallParser, literalParser, commentParser));
17
18
  const result = parser(input);
18
19
  return result;
19
20
  });
@@ -0,0 +1,4 @@
1
+ import { SpecialVar, SpecialVarName } from "../types/specialVar.js";
2
+ import { Parser } from "tarsec";
3
+ export declare const specialVarNameParser: Parser<SpecialVarName>;
4
+ export declare const specialVarParser: Parser<SpecialVar>;
@@ -0,0 +1,8 @@
1
+ import { specialVarNames, } from "../types/specialVar.js";
2
+ import { capture, char, or, seqC, set, str } from "tarsec";
3
+ import { optionalSpaces } from "./utils.js";
4
+ import { literalParser } from "./literals.js";
5
+ import { agencyArrayParser, agencyObjectParser } from "./dataStructures.js";
6
+ import { optionalSemicolon } from "./parserUtils.js";
7
+ export const specialVarNameParser = or(...specialVarNames.map((name) => str(name)));
8
+ export const specialVarParser = seqC(set("type", "specialVar"), char("@"), capture(specialVarNameParser, "name"), optionalSpaces, char("="), optionalSpaces, capture(or(agencyObjectParser, agencyArrayParser, literalParser), "value"), optionalSemicolon);
@@ -1,4 +1,4 @@
1
- export declare const template = "import OpenAI from \"openai\";\nimport { zodResponseFormat } from \"openai/helpers/zod\";\nimport { z } from \"zod\";\nimport * as readline from \"readline\";\nimport fs from \"fs\";\nimport { Graph, goToNode } from \"simplemachine\";\nimport { StatelogClient } from \"statelog-client\";\nimport { nanoid } from \"nanoid\";\nimport { assistantMessage, getClient, Message, userMessage } from \"smoltalk\";\n\nconst statelogHost = \"http://localhost:1065\";\nconst traceId = nanoid();\nconst statelogClient = new StatelogClient({host: statelogHost, tid: traceId});\nconst model = \"gpt-4o-mini\";\n\nconst client = getClient({\n apiKey: process.env.OPENAI_API_KEY || \"\",\n model,\n});\n\ntype State = {\n messages: string[];\n data: any;\n}\n\n// enable debug logging\nconst graphConfig = {\n debug: {\n log: true,\n logData: true,\n },\n statelogHost,\n traceId\n};\n\n// Define the names of the nodes in the graph\n// Useful for type safety\nconst nodes = {{{nodes:string}}} as const;\ntype Node = (typeof nodes)[number];\n\nconst graph = new Graph<State, Node>(nodes, graphConfig);";
1
+ export declare const template = "import OpenAI from \"openai\";\nimport { zodResponseFormat } from \"openai/helpers/zod\";\nimport { z } from \"zod\";\nimport * as readline from \"readline\";\nimport fs from \"fs\";\nimport { PieMachine, goToNode } from \"piemachine\";\nimport { StatelogClient } from \"statelog-client\";\nimport { nanoid } from \"nanoid\";\nimport { assistantMessage, getClient, userMessage } from \"smoltalk\";\n\nconst statelogHost = \"https://statelog.adit.io\";\nconst traceId = nanoid();\nconst statelogConfig = {\n host: statelogHost,\n traceId: traceId,\n apiKey: process.env.STATELOG_API_KEY || \"\",\n projectId: \"agency-lang\",\n debugMode: false,\n };\nconst statelogClient = new StatelogClient(statelogConfig);\nconst model = \"gpt-4o-mini\";\n\n\nconst getClientWithConfig = (config = {}) => {\n const defaultConfig = {\n openAiApiKey: process.env.OPENAI_API_KEY || \"\",\n googleApiKey: process.env.GEMINI_API_KEY || \"\",\n model,\n logLevel: \"warn\",\n };\n\n return getClient({ ...defaultConfig, ...config });\n};\n\nlet client = getClientWithConfig();\n\ntype State = {\n messages: string[];\n data: any;\n}\n\n// enable debug logging\nconst graphConfig = {\n debug: {\n log: true,\n logData: true,\n },\n statelog: statelogConfig,\n};\n\n// Define the names of the nodes in the graph\n// Useful for type safety\nconst nodes = {{{nodes:string}}} as const;\ntype Node = (typeof nodes)[number];\n\nconst graph = new PieMachine<State, Node>(nodes, graphConfig);";
2
2
  export type TemplateType = {
3
3
  nodes: string;
4
4
  };
@@ -7,20 +7,36 @@ import { zodResponseFormat } from "openai/helpers/zod";
7
7
  import { z } from "zod";
8
8
  import * as readline from "readline";
9
9
  import fs from "fs";
10
- import { Graph, goToNode } from "simplemachine";
10
+ import { PieMachine, goToNode } from "piemachine";
11
11
  import { StatelogClient } from "statelog-client";
12
12
  import { nanoid } from "nanoid";
13
- import { assistantMessage, getClient, Message, userMessage } from "smoltalk";
13
+ import { assistantMessage, getClient, userMessage } from "smoltalk";
14
14
 
15
- const statelogHost = "http://localhost:1065";
15
+ const statelogHost = "https://statelog.adit.io";
16
16
  const traceId = nanoid();
17
- const statelogClient = new StatelogClient({host: statelogHost, tid: traceId});
17
+ const statelogConfig = {
18
+ host: statelogHost,
19
+ traceId: traceId,
20
+ apiKey: process.env.STATELOG_API_KEY || "",
21
+ projectId: "agency-lang",
22
+ debugMode: false,
23
+ };
24
+ const statelogClient = new StatelogClient(statelogConfig);
18
25
  const model = "gpt-4o-mini";
19
26
 
20
- const client = getClient({
21
- apiKey: process.env.OPENAI_API_KEY || "",
22
- model,
23
- });
27
+
28
+ const getClientWithConfig = (config = {}) => {
29
+ const defaultConfig = {
30
+ openAiApiKey: process.env.OPENAI_API_KEY || "",
31
+ googleApiKey: process.env.GEMINI_API_KEY || "",
32
+ model,
33
+ logLevel: "warn",
34
+ };
35
+
36
+ return getClient({ ...defaultConfig, ...config });
37
+ };
38
+
39
+ let client = getClientWithConfig();
24
40
 
25
41
  type State = {
26
42
  messages: string[];
@@ -33,8 +49,7 @@ const graphConfig = {
33
49
  log: true,
34
50
  logData: true,
35
51
  },
36
- statelogHost,
37
- traceId
52
+ statelog: statelogConfig,
38
53
  };
39
54
 
40
55
  // Define the names of the nodes in the graph
@@ -42,7 +57,7 @@ const graphConfig = {
42
57
  const nodes = {{{nodes:string}}} as const;
43
58
  type Node = (typeof nodes)[number];
44
59
 
45
- const graph = new Graph<State, Node>(nodes, graphConfig);`;
60
+ const graph = new PieMachine<State, Node>(nodes, graphConfig);`;
46
61
  const render = (args) => {
47
62
  return apply(template, args);
48
63
  };
@@ -0,0 +1,6 @@
1
+ export declare const template = "export async function {{{nodeName:string}}}(data) {\n const result = await graph.run(\"{{{nodeName:string}}}\", { messages: [], data });\n return result.data;\n}\n";
2
+ export type TemplateType = {
3
+ nodeName: string;
4
+ };
5
+ declare const render: (args: TemplateType) => string;
6
+ export default render;
@@ -0,0 +1,13 @@
1
+ // THIS FILE WAS AUTO-GENERATED
2
+ // Source: lib/templates/backends/graphGenerator/runNodeFunction.mustache
3
+ // Any manual changes will be lost.
4
+ import { apply } from "typestache";
5
+ export const template = `export async function {{{nodeName:string}}}(data) {
6
+ const result = await graph.run("{{{nodeName:string}}}", { messages: [], data });
7
+ return result.data;
8
+ }
9
+ `;
10
+ const render = (args) => {
11
+ return apply(template, args);
12
+ };
13
+ export default render;
@@ -0,0 +1,7 @@
1
+ export declare const template = "client = getClientWithConfig({ {{{name}}}: {{{value}}} });";
2
+ export type TemplateType = {
3
+ name: string | boolean | number;
4
+ value: string | boolean | number;
5
+ };
6
+ declare const render: (args: TemplateType) => string;
7
+ export default render;
@@ -0,0 +1,9 @@
1
+ // THIS FILE WAS AUTO-GENERATED
2
+ // Source: lib/templates/backends/graphGenerator/specialVar.mustache
3
+ // Any manual changes will be lost.
4
+ import { apply } from "typestache";
5
+ export const template = `client = getClientWithConfig({ {{{name}}}: {{{value}}} });`;
6
+ const render = (args) => {
7
+ return apply(template, args);
8
+ };
9
+ export default render;
@@ -0,0 +1,4 @@
1
+ export declare const template = "/*\n * @param filePath The absolute or relative path to the image file.\n * @returns The Base64 string, or null if an error occurs.\n */\nfunction _builtinReadImage(filePath: string): string {\n const data = fs.readFileSync(filePath); // Synchronous file reading\n const base64String = data.toString('base64');\n return base64String;\n}";
2
+ export type TemplateType = {};
3
+ declare const render: (args: TemplateType) => string;
4
+ export default render;
@@ -0,0 +1,17 @@
1
+ // THIS FILE WAS AUTO-GENERATED
2
+ // Source: lib/templates/backends/typescriptGenerator/builtinFunctions/readImage.mustache
3
+ // Any manual changes will be lost.
4
+ import { apply } from "typestache";
5
+ export const template = `/*
6
+ * @param filePath The absolute or relative path to the image file.
7
+ * @returns The Base64 string, or null if an error occurs.
8
+ */
9
+ function _builtinReadImage(filePath: string): string {
10
+ const data = fs.readFileSync(filePath); // Synchronous file reading
11
+ const base64String = data.toString('base64');
12
+ return base64String;
13
+ }`;
14
+ const render = (args) => {
15
+ return apply(template, args);
16
+ };
17
+ export default render;
@@ -1,4 +1,4 @@
1
- export declare const template = "import OpenAI from \"openai\";\nimport { zodResponseFormat } from \"openai/helpers/zod\";\nimport { z } from \"zod\";\nimport * as readline from \"readline\";\nimport fs from \"fs\";\nimport { StatelogClient } from \"statelog-client\";\nimport { nanoid } from \"nanoid\";\n\nconst statelogHost = \"http://localhost:1065\";\nconst traceId = nanoid();\nconst statelogClient = new StatelogClient({host: statelogHost, tid: traceId});\n\nconst model = \"gpt-5-nano-2025-08-07\";\n\nconst openai = new OpenAI({\n apiKey: process.env.OPENAI_API_KEY,\n});";
1
+ export declare const template = "import OpenAI from \"openai\";\nimport { zodResponseFormat } from \"openai/helpers/zod\";\nimport { z } from \"zod\";\nimport * as readline from \"readline\";\nimport fs from \"fs\";\nimport { StatelogClient } from \"statelog-client\";\nimport { nanoid } from \"nanoid\";\n\nconst statelogHost = \"http://localhost:1065\";\nconst traceId = nanoid();\nconst statelogClient = new StatelogClient({\n host: statelogHost,\n traceId: traceId,\n apiKey: process.env.STATELOG_API_KEY || \"\",\n projectId: \"agency-lang\",\n debugMode: true,\n });\n\nconst model = \"gpt-5-nano-2025-08-07\";\n\nconst openai = new OpenAI({\n apiKey: process.env.OPENAI_API_KEY,\n});";
2
2
  export type TemplateType = {};
3
3
  declare const render: (args: TemplateType) => string;
4
4
  export default render;
@@ -12,7 +12,13 @@ import { nanoid } from "nanoid";
12
12
 
13
13
  const statelogHost = "http://localhost:1065";
14
14
  const traceId = nanoid();
15
- const statelogClient = new StatelogClient({host: statelogHost, tid: traceId});
15
+ const statelogClient = new StatelogClient({
16
+ host: statelogHost,
17
+ traceId: traceId,
18
+ apiKey: process.env.STATELOG_API_KEY || "",
19
+ projectId: "agency-lang",
20
+ debugMode: true,
21
+ });
16
22
 
17
23
  const model = "gpt-5-nano-2025-08-07";
18
24
 
@@ -1,10 +1,11 @@
1
- export declare const template = "\nasync function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{typeString:string}}}> {\n const prompt = {{{promptCode:string}}};\n const startTime = performance.now();\n const messages: Message[] = [userMessage(prompt)];\n const tools = {{{tools}}};\n\n const responseFormat = {{{zodSchema:string}}};\n\n let completion = await client.text({\n messages,\n tools,\n responseFormat,\n });\n\n const endTime = performance.now();\n statelogClient.promptCompletion({\n messages,\n completion,\n model,\n timeTaken: endTime - startTime,\n });\n\n if (!completion.success) {\n throw new Error(\n `Error getting response from ${model}: ${completion.error}`\n );\n }\n\n let responseMessage = completion.value;\n\n // Handle function calls\n while (responseMessage.toolCalls.length > 0) {\n // Add assistant's response with tool calls to message history\n messages.push(assistantMessage(responseMessage.output));\n let toolCallStartTime, toolCallEndTime;\n\n // Process each tool call\n for (const toolCall of responseMessage.toolCalls) {\n {{{functionCalls:string}}}\n }\n\n const nextStartTime = performance.now();\n let completion = await client.text({\n messages,\n tools,\n responseFormat,\n });\n\n const nextEndTime = performance.now();\n\n statelogClient.promptCompletion({\n messages,\n completion,\n model,\n timeTaken: nextEndTime - nextStartTime,\n });\n\n if (!completion.success) {\n throw new Error(\n `Error getting response from ${model}: ${completion.error}`\n );\n }\n responseMessage = completion.value;\n }\n\n // Add final assistant response to history\n messages.push(assistantMessage(responseMessage.output));\n\n try {\n const result = JSON.parse(responseMessage.output || \"\");\n return result.value;\n } catch (e) {\n return responseMessage.output;\n // console.error(\"Error parsing response for variable '{{{variableName:string}}}':\", e);\n // console.error(\"Full completion response:\", JSON.stringify(completion, null, 2));\n // throw e;\n }\n}\n";
1
+ export declare const template = "\nasync function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{typeString:string}}}> {\n const prompt = {{{promptCode:string}}};\n const startTime = performance.now();\n const messages: Message[] = [userMessage(prompt)];\n const tools = {{{tools}}};\n\n {{#hasResponseFormat}}\n // Need to make sure this is always an object\n const responseFormat = z.object({\n response: {{{zodSchema:string}}}\n });\n {{/hasResponseFormat}}\n {{^hasResponseFormat}}\n const responseFormat = undefined;\n {{/hasResponseFormat}}\n\n let completion = await client.text({\n messages,\n tools,\n responseFormat,\n });\n\n const endTime = performance.now();\n statelogClient.promptCompletion({\n messages,\n completion,\n model: client.getModel(),\n timeTaken: endTime - startTime,\n });\n\n if (!completion.success) {\n throw new Error(\n `Error getting response from ${model}: ${completion.error}`\n );\n }\n\n let responseMessage = completion.value;\n\n // Handle function calls\n while (responseMessage.toolCalls.length > 0) {\n // Add assistant's response with tool calls to message history\n messages.push(assistantMessage(responseMessage.output));\n let toolCallStartTime, toolCallEndTime;\n\n // Process each tool call\n for (const toolCall of responseMessage.toolCalls) {\n {{{functionCalls:string}}}\n }\n\n const nextStartTime = performance.now();\n let completion = await client.text({\n messages,\n tools,\n responseFormat,\n });\n\n const nextEndTime = performance.now();\n\n statelogClient.promptCompletion({\n messages,\n completion,\n model: client.getModel(),\n timeTaken: nextEndTime - nextStartTime,\n });\n\n if (!completion.success) {\n throw new Error(\n `Error getting response from ${model}: ${completion.error}`\n );\n }\n responseMessage = completion.value;\n }\n\n // Add final assistant response to history\n messages.push(assistantMessage(responseMessage.output));\n\n {{#hasResponseFormat}}\n try {\n const result = JSON.parse(responseMessage.output || \"\");\n return result.response;\n } catch (e) {\n return responseMessage.output;\n // console.error(\"Error parsing response for variable '{{{variableName:string}}}':\", e);\n // console.error(\"Full completion response:\", JSON.stringify(completion, null, 2));\n // throw e;\n }\n {{/hasResponseFormat}}\n\n {{^hasResponseFormat}}\n return responseMessage.output;\n {{/hasResponseFormat}}\n}\n";
2
2
  export type TemplateType = {
3
3
  variableName: string;
4
4
  argsStr: string;
5
5
  typeString: string;
6
6
  promptCode: string;
7
7
  tools: string | boolean | number;
8
+ hasResponseFormat: boolean;
8
9
  zodSchema: string;
9
10
  functionCalls: string;
10
11
  };
@@ -9,7 +9,15 @@ async function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{type
9
9
  const messages: Message[] = [userMessage(prompt)];
10
10
  const tools = {{{tools}}};
11
11
 
12
- const responseFormat = {{{zodSchema:string}}};
12
+ {{#hasResponseFormat}}
13
+ // Need to make sure this is always an object
14
+ const responseFormat = z.object({
15
+ response: {{{zodSchema:string}}}
16
+ });
17
+ {{/hasResponseFormat}}
18
+ {{^hasResponseFormat}}
19
+ const responseFormat = undefined;
20
+ {{/hasResponseFormat}}
13
21
 
14
22
  let completion = await client.text({
15
23
  messages,
@@ -21,7 +29,7 @@ async function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{type
21
29
  statelogClient.promptCompletion({
22
30
  messages,
23
31
  completion,
24
- model,
32
+ model: client.getModel(),
25
33
  timeTaken: endTime - startTime,
26
34
  });
27
35
 
@@ -56,7 +64,7 @@ async function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{type
56
64
  statelogClient.promptCompletion({
57
65
  messages,
58
66
  completion,
59
- model,
67
+ model: client.getModel(),
60
68
  timeTaken: nextEndTime - nextStartTime,
61
69
  });
62
70
 
@@ -71,15 +79,21 @@ async function _{{{variableName:string}}}({{{argsStr:string}}}): Promise<{{{type
71
79
  // Add final assistant response to history
72
80
  messages.push(assistantMessage(responseMessage.output));
73
81
 
82
+ {{#hasResponseFormat}}
74
83
  try {
75
84
  const result = JSON.parse(responseMessage.output || "");
76
- return result.value;
85
+ return result.response;
77
86
  } catch (e) {
78
87
  return responseMessage.output;
79
88
  // console.error("Error parsing response for variable '{{{variableName:string}}}':", e);
80
89
  // console.error("Full completion response:", JSON.stringify(completion, null, 2));
81
90
  // throw e;
82
91
  }
92
+ {{/hasResponseFormat}}
93
+
94
+ {{^hasResponseFormat}}
95
+ return responseMessage.output;
96
+ {{/hasResponseFormat}}
83
97
  }
84
98
  `;
85
99
  const render = (args) => {
@@ -0,0 +1,9 @@
1
+ import { AgencyArray, AgencyObject } from "./dataStructures.js";
2
+ import { Literal } from "./literals.js";
3
+ export declare const specialVarNames: readonly ["model"];
4
+ export type SpecialVarName = (typeof specialVarNames)[number];
5
+ export type SpecialVar = {
6
+ type: "specialVar";
7
+ name: SpecialVarName;
8
+ value: Literal | AgencyObject | AgencyArray;
9
+ };
@@ -0,0 +1 @@
1
+ export const specialVarNames = ["model"];
@@ -9,6 +9,7 @@ import { ReturnStatement } from "./types/returnStatement.js";
9
9
  import { UsesTool } from "./types/tools.js";
10
10
  import { ImportStatement } from "./types/importStatement.js";
11
11
  import { WhileLoop } from "./types/whileLoop.js";
12
+ import { SpecialVar } from "./types/specialVar.js";
12
13
  export * from "./types/access.js";
13
14
  export * from "./types/dataStructures.js";
14
15
  export * from "./types/function.js";
@@ -29,7 +30,7 @@ export type AgencyComment = {
29
30
  type: "comment";
30
31
  content: string;
31
32
  };
32
- export type AgencyNode = TypeHint | TypeAlias | UsesTool | GraphNodeDefinition | FunctionDefinition | Assignment | Literal | FunctionCall | MatchBlock | ReturnStatement | AccessExpression | AgencyComment | AgencyObject | AgencyArray | ImportStatement | WhileLoop;
33
+ export type AgencyNode = TypeHint | TypeAlias | UsesTool | GraphNodeDefinition | FunctionDefinition | Assignment | Literal | FunctionCall | MatchBlock | ReturnStatement | AccessExpression | AgencyComment | AgencyObject | AgencyArray | ImportStatement | WhileLoop | SpecialVar;
33
34
  export type AgencyProgram = {
34
35
  type: "agencyProgram";
35
36
  nodes: AgencyNode[];
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "child_process";
3
3
  import * as fs from "fs";
4
+ import * as path from "path";
4
5
  import { parseAgency } from "../lib/parser.js";
5
6
  import { generateGraph } from "../lib/index.js";
6
7
  import { generateAgency } from "../lib/backends/agencyGenerator.js";
@@ -70,17 +71,43 @@ function readFile(inputFile) {
70
71
  const contents = fs.readFileSync(inputFile, "utf-8");
71
72
  return contents;
72
73
  }
73
- function compile(inputFile, outputFile, verbose = false) {
74
- // Determine output file name
75
- const output = outputFile || inputFile.replace(".agency", ".ts");
74
+ function getImports(program) {
75
+ return program.nodes
76
+ .filter((node) => node.type === "importStatement")
77
+ .filter((importNode) => {
78
+ const modulePath = importNode.modulePath.trim().replace(/['"]/g, "");
79
+ return modulePath.includes(".agency");
80
+ })
81
+ .map((node) => node.modulePath.trim().replace(/['"]/g, ""));
82
+ }
83
+ const compiledFiles = new Set();
84
+ function compile(inputFile, _outputFile, verbose = false) {
85
+ // Resolve the absolute path of the input file to avoid duplicates
86
+ const absoluteInputFile = path.resolve(inputFile);
87
+ const outputFile = _outputFile || inputFile.replace(".agency", ".ts");
88
+ // Skip if already compiled
89
+ if (compiledFiles.has(absoluteInputFile)) {
90
+ return outputFile;
91
+ }
92
+ compiledFiles.add(absoluteInputFile);
76
93
  const contents = readFile(inputFile);
77
94
  const parsedProgram = parse(contents, verbose);
78
- // Generate TypeScript code
95
+ const imports = getImports(parsedProgram);
96
+ const inputDir = path.dirname(absoluteInputFile);
97
+ for (const importPath of imports) {
98
+ const absPath = path.resolve(inputDir, importPath);
99
+ compile(absPath, undefined, verbose);
100
+ }
101
+ // Update the import path in the AST to reference the new .ts file
102
+ parsedProgram.nodes.forEach((node) => {
103
+ if (node.type === "importStatement") {
104
+ node.modulePath = node.modulePath.replace(".agency", ".ts");
105
+ }
106
+ });
79
107
  const generatedCode = generateGraph(parsedProgram);
80
- // Write to output file
81
- fs.writeFileSync(output, generatedCode, "utf-8");
82
- console.log(`Generated ${output} from ${inputFile}`);
83
- return output;
108
+ fs.writeFileSync(outputFile, generatedCode, "utf-8");
109
+ console.log(`Generated ${outputFile} from ${inputFile}`);
110
+ return outputFile;
84
111
  }
85
112
  function run(inputFile, outputFile, verbose = false) {
86
113
  // Compile the file
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import path, { dirname } from "path";
3
+ import fs from "fs";
4
+ import { generateTypeScript } from "../lib/backends/typescriptGenerator.js";
5
+ import { parseAgency } from "../lib/parser.js";
6
+ import { fileURLToPath } from "url";
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ const fixturesDir = path.join(__dirname, "../../tests/typescriptGenerator");
10
+ function regenerateFixtures(dir, relativePath = "") {
11
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
12
+ for (const entry of entries) {
13
+ const fullPath = path.join(dir, entry.name);
14
+ if (entry.isDirectory()) {
15
+ regenerateFixtures(fullPath, path.join(relativePath, entry.name));
16
+ }
17
+ else if (entry.isFile() && entry.name.endsWith(".agency")) {
18
+ const baseName = entry.name.replace(".agency", "");
19
+ const mtsPath = path.join(dir, `${baseName}.mts`);
20
+ const agencyContent = fs.readFileSync(fullPath, "utf-8");
21
+ const parseResult = parseAgency(agencyContent);
22
+ if (parseResult.success) {
23
+ const tsCode = generateTypeScript(parseResult.result);
24
+ fs.writeFileSync(mtsPath, tsCode, "utf-8");
25
+ const fixtureRelPath = path.join(relativePath, baseName) || baseName;
26
+ console.log(`✓ Updated ${fixtureRelPath}.mts`);
27
+ }
28
+ else {
29
+ console.error(`✗ Failed to parse ${fullPath}: ${parseResult.message}`);
30
+ }
31
+ }
32
+ }
33
+ }
34
+ console.log("Regenerating fixture files...\n");
35
+ regenerateFixtures(fixturesDir);
36
+ console.log("\nDone!");
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import path, { dirname } from "path";
3
+ import fs from "fs";
4
+ import { generateGraph } from "../lib/backends/graphGenerator.js";
5
+ import { parseAgency } from "../lib/parser.js";
6
+ import { fileURLToPath } from "url";
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ const fixturesDir = path.join(__dirname, "../../tests/graphGenerator");
10
+ function regenerateFixtures(dir, relativePath = "") {
11
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
12
+ for (const entry of entries) {
13
+ const fullPath = path.join(dir, entry.name);
14
+ if (entry.isDirectory()) {
15
+ regenerateFixtures(fullPath, path.join(relativePath, entry.name));
16
+ }
17
+ else if (entry.isFile() && entry.name.endsWith(".agency")) {
18
+ const baseName = entry.name.replace(".agency", "");
19
+ const mtsPath = path.join(dir, `${baseName}.mts`);
20
+ const agencyContent = fs.readFileSync(fullPath, "utf-8");
21
+ const parseResult = parseAgency(agencyContent);
22
+ if (parseResult.success) {
23
+ const graphCode = generateGraph(parseResult.result);
24
+ fs.writeFileSync(mtsPath, graphCode, "utf-8");
25
+ const fixtureRelPath = path.join(relativePath, baseName) || baseName;
26
+ console.log(`✓ Updated ${fixtureRelPath}.mts`);
27
+ }
28
+ else {
29
+ console.error(`✗ Failed to parse ${fullPath}: ${parseResult.message}`);
30
+ }
31
+ }
32
+ }
33
+ }
34
+ console.log("Regenerating graph generator fixture files...\n");
35
+ regenerateFixtures(fixturesDir);
36
+ console.log("\nDone!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agency-lang",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "The Agency language",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -10,7 +10,8 @@
10
10
  "start": "node dist/lib/index.js",
11
11
  "templates": "typestache ./lib/templates",
12
12
  "typecheck": "tsc --noEmit",
13
- "agency": "node ./dist/scripts/agency.js"
13
+ "agency": "node ./dist/scripts/agency.js",
14
+ "compile": "node ./dist/scripts/agency.js compile"
14
15
  },
15
16
  "bin": {
16
17
  "agency": "./dist/scripts/agency.js"
@@ -24,9 +25,9 @@
24
25
  ],
25
26
  "exports": {
26
27
  ".": {
28
+ "types": "./dist/lib/index.d.ts",
27
29
  "import": "./dist/lib/index.js",
28
- "require": "./dist/lib/index.js",
29
- "types": "./dist/lib/index.d.ts"
30
+ "require": "./dist/lib/index.js"
30
31
  }
31
32
  },
32
33
  "type": "module",
@@ -42,9 +43,9 @@
42
43
  "egonlog": "^0.0.2",
43
44
  "nanoid": "^5.1.6",
44
45
  "openai": "^6.15.0",
45
- "simplemachine": "github:egonSchiele/simplemachine",
46
- "smoltalk": "^0.0.4",
47
- "statelog-client": "^0.0.28",
46
+ "piemachine": "^0.0.2",
47
+ "smoltalk": "^0.0.11",
48
+ "statelog-client": "^0.0.31",
48
49
  "tarsec": "^0.1.1",
49
50
  "typestache": "^0.4.4",
50
51
  "zod": "^4.2.1"