@ai.ntellect/core 1.0.0 → 1.1.1
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/.mocharc.json +6 -0
- package/AGENTS.md +50 -0
- package/ARCHITECTURE.md +58 -0
- package/BENCHMARK.md +38 -0
- package/CHANGELOG.md +224 -0
- package/README.md +363 -142
- package/agent/agent-workflow.ts +569 -0
- package/agent/agent.ts +183 -0
- package/agent/base/executor.ts +103 -0
- package/agent/base/index.ts +87 -0
- package/agent/entity-resolver/confidence.ts +54 -0
- package/agent/entity-resolver/entity-index.ts +241 -0
- package/agent/entity-resolver/explore-strategy.ts +82 -0
- package/agent/entity-resolver/index.ts +22 -0
- package/agent/entity-resolver/resolver.ts +193 -0
- package/agent/entity-resolver/scorer.ts +211 -0
- package/agent/entity-resolver/types.ts +98 -0
- package/agent/generic-executor.ts +713 -0
- package/agent/handlers/cognitive-handler.ts +197 -0
- package/agent/handlers/index.ts +1 -0
- package/agent/handoff.ts +58 -0
- package/agent/llm-factory.ts +343 -0
- package/agent/orchestrator.ts +45 -0
- package/agent/prompt-builder.ts +78 -0
- package/agent/registry.ts +64 -0
- package/agent/tools/file-system.ts +471 -0
- package/agent/tools/index.ts +23 -0
- package/agent/tools/logger.ts +105 -0
- package/agent/tools/tool-resolver.ts +104 -0
- package/benchmark/cortexflow-workflow.ts +182 -0
- package/benchmark/langgraph-workflow.ts +201 -0
- package/benchmark/llm-client.ts +76 -0
- package/benchmark/run-benchmark.ts +222 -0
- package/cli-dev.ts +419 -0
- package/dist/agent/agent-workflow.d.ts +41 -0
- package/dist/agent/agent-workflow.d.ts.map +1 -0
- package/dist/agent/agent-workflow.js +560 -0
- package/dist/agent/agent-workflow.js.map +1 -0
- package/dist/agent/agent.d.ts +38 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +149 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/base/executor.d.ts +51 -0
- package/dist/agent/base/executor.d.ts.map +1 -0
- package/dist/agent/base/executor.js +69 -0
- package/dist/agent/base/executor.js.map +1 -0
- package/dist/agent/base/index.d.ts +30 -0
- package/dist/agent/base/index.d.ts.map +1 -0
- package/dist/agent/base/index.js +88 -0
- package/dist/agent/base/index.js.map +1 -0
- package/dist/agent/entity-resolver/confidence.d.ts +4 -0
- package/dist/agent/entity-resolver/confidence.d.ts.map +1 -0
- package/dist/agent/entity-resolver/confidence.js +47 -0
- package/dist/agent/entity-resolver/confidence.js.map +1 -0
- package/dist/agent/entity-resolver/entity-index.d.ts +40 -0
- package/dist/agent/entity-resolver/entity-index.d.ts.map +1 -0
- package/dist/agent/entity-resolver/entity-index.js +244 -0
- package/dist/agent/entity-resolver/entity-index.js.map +1 -0
- package/dist/agent/entity-resolver/explore-strategy.d.ts +13 -0
- package/dist/agent/entity-resolver/explore-strategy.d.ts.map +1 -0
- package/dist/agent/entity-resolver/explore-strategy.js +109 -0
- package/dist/agent/entity-resolver/explore-strategy.js.map +1 -0
- package/dist/agent/entity-resolver/index.d.ts +8 -0
- package/dist/agent/entity-resolver/index.d.ts.map +1 -0
- package/dist/agent/entity-resolver/index.js +16 -0
- package/dist/agent/entity-resolver/index.js.map +1 -0
- package/dist/agent/entity-resolver/resolver.d.ts +18 -0
- package/dist/agent/entity-resolver/resolver.d.ts.map +1 -0
- package/dist/agent/entity-resolver/resolver.js +158 -0
- package/dist/agent/entity-resolver/resolver.js.map +1 -0
- package/dist/agent/entity-resolver/scorer.d.ts +3 -0
- package/dist/agent/entity-resolver/scorer.d.ts.map +1 -0
- package/dist/agent/entity-resolver/scorer.js +182 -0
- package/dist/agent/entity-resolver/scorer.js.map +1 -0
- package/dist/agent/entity-resolver/types.d.ts +89 -0
- package/dist/agent/entity-resolver/types.d.ts.map +1 -0
- package/dist/agent/entity-resolver/types.js +3 -0
- package/dist/agent/entity-resolver/types.js.map +1 -0
- package/dist/agent/generic-executor.d.ts +68 -0
- package/dist/agent/generic-executor.d.ts.map +1 -0
- package/dist/agent/generic-executor.js +620 -0
- package/dist/agent/generic-executor.js.map +1 -0
- package/dist/agent/handlers/cognitive-handler.d.ts +44 -0
- package/dist/agent/handlers/cognitive-handler.d.ts.map +1 -0
- package/dist/agent/handlers/cognitive-handler.js +172 -0
- package/dist/agent/handlers/cognitive-handler.js.map +1 -0
- package/dist/agent/handlers/index.d.ts +2 -0
- package/dist/agent/handlers/index.d.ts.map +1 -0
- package/dist/agent/handlers/index.js +7 -0
- package/dist/agent/handlers/index.js.map +1 -0
- package/dist/agent/handoff.d.ts +12 -0
- package/dist/agent/handoff.d.ts.map +1 -0
- package/dist/agent/handoff.js +62 -0
- package/dist/agent/handoff.js.map +1 -0
- package/dist/agent/llm-factory.d.ts +19 -0
- package/dist/agent/llm-factory.d.ts.map +1 -0
- package/dist/agent/llm-factory.js +297 -0
- package/dist/agent/llm-factory.js.map +1 -0
- package/dist/agent/orchestrator.d.ts +18 -0
- package/dist/agent/orchestrator.d.ts.map +1 -0
- package/dist/agent/orchestrator.js +44 -0
- package/dist/agent/orchestrator.js.map +1 -0
- package/dist/agent/prompt-builder.d.ts +35 -0
- package/dist/agent/prompt-builder.d.ts.map +1 -0
- package/dist/agent/prompt-builder.js +76 -0
- package/dist/agent/prompt-builder.js.map +1 -0
- package/dist/agent/registry.d.ts +19 -0
- package/dist/agent/registry.d.ts.map +1 -0
- package/dist/agent/registry.js +48 -0
- package/dist/agent/registry.js.map +1 -0
- package/dist/agent/tools/file-system.d.ts +11 -0
- package/dist/agent/tools/file-system.d.ts.map +1 -0
- package/dist/agent/tools/file-system.js +528 -0
- package/dist/agent/tools/file-system.js.map +1 -0
- package/dist/agent/tools/index.d.ts +4 -0
- package/dist/agent/tools/index.d.ts.map +1 -0
- package/dist/agent/tools/index.js +20 -0
- package/dist/agent/tools/index.js.map +1 -0
- package/dist/agent/tools/logger.d.ts +33 -0
- package/dist/agent/tools/logger.d.ts.map +1 -0
- package/dist/agent/tools/logger.js +86 -0
- package/dist/agent/tools/logger.js.map +1 -0
- package/dist/agent/tools/tool-resolver.d.ts +7 -0
- package/dist/agent/tools/tool-resolver.d.ts.map +1 -0
- package/dist/agent/tools/tool-resolver.js +122 -0
- package/dist/agent/tools/tool-resolver.js.map +1 -0
- package/dist/execution/adapters/in-memory-checkpoint.d.ts +11 -0
- package/dist/execution/adapters/in-memory-checkpoint.d.ts.map +1 -0
- package/dist/execution/adapters/in-memory-checkpoint.js +54 -0
- package/dist/execution/adapters/in-memory-checkpoint.js.map +1 -0
- package/dist/execution/compiler.d.ts +8 -0
- package/dist/execution/compiler.d.ts.map +1 -0
- package/dist/execution/compiler.js +50 -0
- package/dist/execution/compiler.js.map +1 -0
- package/dist/execution/controller.d.ts +30 -0
- package/dist/execution/controller.d.ts.map +1 -0
- package/dist/execution/controller.js +80 -0
- package/dist/execution/controller.js.map +1 -0
- package/dist/execution/event-manager.d.ts +29 -0
- package/dist/execution/event-manager.d.ts.map +1 -0
- package/dist/execution/event-manager.js +264 -0
- package/dist/execution/event-manager.js.map +1 -0
- package/dist/execution/index.d.ts +221 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +638 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/logger.d.ts +46 -0
- package/dist/execution/logger.d.ts.map +1 -0
- package/dist/execution/logger.js +69 -0
- package/dist/execution/logger.js.map +1 -0
- package/dist/execution/node.d.ts +65 -0
- package/dist/execution/node.d.ts.map +1 -0
- package/dist/execution/node.js +250 -0
- package/dist/execution/node.js.map +1 -0
- package/dist/execution/observer.d.ts +38 -0
- package/dist/execution/observer.d.ts.map +1 -0
- package/dist/execution/observer.js +111 -0
- package/dist/execution/observer.js.map +1 -0
- package/dist/execution/planner.d.ts +14 -0
- package/dist/execution/planner.d.ts.map +1 -0
- package/dist/execution/planner.js +43 -0
- package/dist/execution/planner.js.map +1 -0
- package/dist/execution/reducer.d.ts +19 -0
- package/dist/execution/reducer.d.ts.map +1 -0
- package/dist/execution/reducer.js +61 -0
- package/dist/execution/reducer.js.map +1 -0
- package/dist/execution/registry.d.ts +38 -0
- package/dist/execution/registry.d.ts.map +1 -0
- package/dist/execution/registry.js +63 -0
- package/dist/execution/registry.js.map +1 -0
- package/dist/execution/send-api.d.ts +24 -0
- package/dist/execution/send-api.d.ts.map +1 -0
- package/dist/execution/send-api.js +52 -0
- package/dist/execution/send-api.js.map +1 -0
- package/dist/execution/types.parallel.d.ts +61 -0
- package/dist/execution/types.parallel.d.ts.map +1 -0
- package/dist/execution/types.parallel.js +3 -0
- package/dist/execution/types.parallel.js.map +1 -0
- package/dist/execution/visualizer.d.ts +35 -0
- package/dist/execution/visualizer.d.ts.map +1 -0
- package/dist/execution/visualizer.js +131 -0
- package/dist/execution/visualizer.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +487 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +75 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/modules/agenda/adapters/node-cron/index.d.ts +17 -0
- package/dist/modules/agenda/adapters/node-cron/index.d.ts.map +1 -0
- package/dist/modules/agenda/adapters/node-cron/index.js +30 -0
- package/dist/modules/agenda/adapters/node-cron/index.js.map +1 -0
- package/dist/modules/agenda/index.d.ts +63 -0
- package/dist/modules/agenda/index.d.ts.map +1 -0
- package/dist/modules/agenda/index.js +141 -0
- package/dist/modules/agenda/index.js.map +1 -0
- package/dist/modules/cli/index.d.ts +13 -0
- package/dist/modules/cli/index.d.ts.map +1 -0
- package/dist/modules/cli/index.js +672 -0
- package/dist/modules/cli/index.js.map +1 -0
- package/dist/modules/embedding/adapters/ai/index.d.ts +29 -0
- package/dist/modules/embedding/adapters/ai/index.d.ts.map +1 -0
- package/dist/modules/embedding/adapters/ai/index.js +58 -0
- package/dist/modules/embedding/adapters/ai/index.js.map +1 -0
- package/dist/modules/embedding/index.d.ts +36 -0
- package/dist/modules/embedding/index.d.ts.map +1 -0
- package/dist/modules/embedding/index.js +60 -0
- package/dist/modules/embedding/index.js.map +1 -0
- package/dist/modules/nlp/engine.d.ts +126 -0
- package/dist/modules/nlp/engine.d.ts.map +1 -0
- package/dist/modules/nlp/engine.js +299 -0
- package/dist/modules/nlp/engine.js.map +1 -0
- package/dist/modules/nlp/index.d.ts +27 -0
- package/dist/modules/nlp/index.d.ts.map +1 -0
- package/dist/modules/nlp/index.js +56 -0
- package/dist/modules/nlp/index.js.map +1 -0
- package/dist/persistence/index.d.ts +12 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +24 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/neo4j/driver.d.ts +26 -0
- package/dist/persistence/neo4j/driver.d.ts.map +1 -0
- package/dist/persistence/neo4j/driver.js +64 -0
- package/dist/persistence/neo4j/driver.js.map +1 -0
- package/dist/persistence/neo4j/entity-store.d.ts +15 -0
- package/dist/persistence/neo4j/entity-store.d.ts.map +1 -0
- package/dist/persistence/neo4j/entity-store.js +136 -0
- package/dist/persistence/neo4j/entity-store.js.map +1 -0
- package/dist/persistence/neo4j/execution-tracer.d.ts +19 -0
- package/dist/persistence/neo4j/execution-tracer.d.ts.map +1 -0
- package/dist/persistence/neo4j/execution-tracer.js +166 -0
- package/dist/persistence/neo4j/execution-tracer.js.map +1 -0
- package/dist/persistence/neo4j/memory-adapter.d.ts +35 -0
- package/dist/persistence/neo4j/memory-adapter.d.ts.map +1 -0
- package/dist/persistence/neo4j/memory-adapter.js +252 -0
- package/dist/persistence/neo4j/memory-adapter.js.map +1 -0
- package/dist/persistence/neo4j/petri-checkpoint-adapter.d.ts +22 -0
- package/dist/persistence/neo4j/petri-checkpoint-adapter.d.ts.map +1 -0
- package/dist/persistence/neo4j/petri-checkpoint-adapter.js +141 -0
- package/dist/persistence/neo4j/petri-checkpoint-adapter.js.map +1 -0
- package/dist/pipeline/agent-pipeline.d.ts +99 -0
- package/dist/pipeline/agent-pipeline.d.ts.map +1 -0
- package/dist/pipeline/agent-pipeline.js +356 -0
- package/dist/pipeline/agent-pipeline.js.map +1 -0
- package/dist/routing/checkpoint-adapter.d.ts +30 -0
- package/dist/routing/checkpoint-adapter.d.ts.map +1 -0
- package/dist/routing/checkpoint-adapter.js +83 -0
- package/dist/routing/checkpoint-adapter.js.map +1 -0
- package/dist/routing/documentation-generator.d.ts +47 -0
- package/dist/routing/documentation-generator.d.ts.map +1 -0
- package/dist/routing/documentation-generator.js +320 -0
- package/dist/routing/documentation-generator.js.map +1 -0
- package/dist/routing/index.d.ts +38 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +375 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/intent-classifier.d.ts +206 -0
- package/dist/routing/intent-classifier.d.ts.map +1 -0
- package/dist/routing/intent-classifier.js +267 -0
- package/dist/routing/intent-classifier.js.map +1 -0
- package/dist/routing/matrix.d.ts +6 -0
- package/dist/routing/matrix.d.ts.map +1 -0
- package/dist/routing/matrix.js +131 -0
- package/dist/routing/matrix.js.map +1 -0
- package/dist/routing/orchestrator.d.ts +87 -0
- package/dist/routing/orchestrator.d.ts.map +1 -0
- package/dist/routing/orchestrator.js +425 -0
- package/dist/routing/orchestrator.js.map +1 -0
- package/dist/routing/postgres-checkpoint-adapter.d.ts +32 -0
- package/dist/routing/postgres-checkpoint-adapter.d.ts.map +1 -0
- package/dist/routing/postgres-checkpoint-adapter.js +167 -0
- package/dist/routing/postgres-checkpoint-adapter.js.map +1 -0
- package/dist/routing/redis-checkpoint-adapter.d.ts +34 -0
- package/dist/routing/redis-checkpoint-adapter.d.ts.map +1 -0
- package/dist/routing/redis-checkpoint-adapter.js +170 -0
- package/dist/routing/redis-checkpoint-adapter.js.map +1 -0
- package/dist/routing/types.d.ts +49 -0
- package/dist/routing/types.d.ts.map +1 -0
- package/dist/routing/types.js +3 -0
- package/dist/routing/types.js.map +1 -0
- package/dist/types/agent.d.ts +289 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +78 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/index.d.ts +343 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/generate-action-schema.d.ts +4 -0
- package/dist/utils/generate-action-schema.d.ts.map +1 -0
- package/dist/utils/generate-action-schema.js +46 -0
- package/dist/utils/generate-action-schema.js.map +1 -0
- package/dist/utils/header-builder.d.ts +12 -0
- package/dist/utils/header-builder.d.ts.map +1 -0
- package/dist/utils/header-builder.js +35 -0
- package/dist/utils/header-builder.js.map +1 -0
- package/dist/utils/logger.d.ts +27 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +45 -0
- package/dist/utils/logger.js.map +1 -0
- package/docs/.gitbook/assets/image (1).png +0 -0
- package/docs/.gitbook/assets/image (2).png +0 -0
- package/docs/.gitbook/assets/image (3).png +0 -0
- package/docs/.gitbook/assets/image (4).png +0 -0
- package/docs/.gitbook/assets/image (5).png +0 -0
- package/docs/.gitbook/assets/image (6).png +0 -0
- package/docs/.gitbook/assets/image.png +0 -0
- package/docs/README.md +57 -0
- package/docs/SUMMARY.md +34 -0
- package/docs/cas-dusages.md +69 -0
- package/docs/cli/README.md +65 -0
- package/docs/concepts-cles.md +50 -0
- package/docs/core/architecture.md +87 -0
- package/docs/core/benchmark.md +59 -0
- package/docs/core/checkpoint.md +72 -0
- package/docs/core/documentation.md +55 -0
- package/docs/core/graphcontroller.md +63 -0
- package/docs/core/graphflow.md +137 -0
- package/docs/core/introduction.md +41 -0
- package/docs/core/les-evenements.md +95 -0
- package/docs/modules/agenda/README.md +63 -0
- package/docs/modules/agenda/interface-iagenda.md +170 -0
- package/docs/modules/agenda/les-adaptateurs/README.md +237 -0
- package/docs/modules/agenda/les-adaptateurs/nodecronadapter.md +91 -0
- package/docs/modules/introduction.md +55 -0
- package/docs/modules/les-adaptateurs.md +52 -0
- package/docs/modules/memoire/README.md +68 -0
- package/docs/modules/memoire/interface-imemory.md +183 -0
- package/docs/modules/memoire/les-adaptateurs/README.md +209 -0
- package/docs/modules/memoire/les-adaptateurs/inmemoryadapter.md +110 -0
- package/docs/modules/memoire/les-adaptateurs/meilisearchadapter.md +147 -0
- package/docs/modules/memoire/les-adaptateurs/redisadapter.md +212 -0
- package/docs/modules/nlp/README.md +44 -0
- package/docs/philosophie.md +51 -0
- package/docs/tutoriels/ajouter-des-conditions.md +150 -0
- package/docs/tutoriels/branching.md +194 -0
- package/docs/tutoriels/checkpoint-usage.md +99 -0
- package/docs/tutoriels/creer-agent-onchain.md +1041 -0
- package/docs/tutoriels/creer-un-agent.md +108 -0
- package/docs/tutoriels/creer-un-graphe-simple.md +92 -0
- package/docs/tutoriels/gerer-les-erreurs.md +124 -0
- package/docs/tutoriels/pour-commencer.md +73 -0
- package/docs/tutoriels/retry.md +166 -0
- package/execution/adapters/in-memory-checkpoint.ts +35 -0
- package/execution/compiler.ts +47 -0
- package/execution/controller.ts +84 -0
- package/execution/event-manager.ts +331 -0
- package/execution/index.ts +800 -0
- package/execution/logger.ts +70 -0
- package/execution/node.ts +315 -0
- package/execution/observer.ts +192 -0
- package/execution/planner.ts +40 -0
- package/execution/reducer.ts +73 -0
- package/execution/registry.ts +86 -0
- package/execution/send-api.ts +58 -0
- package/execution/types.parallel.ts +81 -0
- package/execution/visualizer.ts +158 -0
- package/index.ts +55 -465
- package/interfaces/index.ts +597 -0
- package/modules/agenda/adapters/node-cron/index.ts +25 -0
- package/modules/agenda/index.ts +146 -0
- package/modules/cli/index.ts +580 -0
- package/modules/embedding/adapters/ai/index.ts +42 -0
- package/modules/embedding/index.ts +45 -0
- package/modules/nlp/engine.ts +324 -0
- package/modules/nlp/index.ts +45 -0
- package/package.json +81 -9
- package/persistence/index.ts +27 -0
- package/persistence/neo4j/driver.ts +34 -0
- package/persistence/neo4j/entity-store.ts +141 -0
- package/persistence/neo4j/execution-tracer.ts +194 -0
- package/persistence/neo4j/memory-adapter.ts +281 -0
- package/persistence/neo4j/petri-checkpoint-adapter.ts +153 -0
- package/pipeline/agent-pipeline.ts +426 -0
- package/routing/checkpoint-adapter.ts +79 -0
- package/routing/documentation-generator.ts +358 -0
- package/routing/index.ts +459 -0
- package/routing/intent-classifier.ts +360 -0
- package/routing/matrix.ts +138 -0
- package/routing/orchestrator.ts +498 -0
- package/routing/patterns/data-extraction.json +79 -0
- package/routing/patterns/human-approval.json +64 -0
- package/routing/patterns/rag-search.json +68 -0
- package/routing/postgres-checkpoint-adapter.ts +172 -0
- package/routing/redis-checkpoint-adapter.ts +187 -0
- package/routing/types.ts +59 -0
- package/routing/web-server.ts +260 -0
- package/scripts/generate-petri-docs.ts +70 -0
- package/scripts/get-gmail-token.js +65 -0
- package/scripts/get-gmail-token.ts +65 -0
- package/test/agent/agent.test.ts +92 -0
- package/test/agent/clone.test.ts +143 -0
- package/test/agent/cognitive-handler.test.ts +78 -0
- package/test/agent/entity-store.test.ts +80 -0
- package/test/agent/generic-executor.test.ts +230 -0
- package/test/agent/handoff.test.ts +163 -0
- package/test/agent/llm-factory.test.ts +40 -0
- package/test/agent/orchestrator.test.ts +156 -0
- package/test/agent/registry.test.ts +97 -0
- package/test/agent/tools.test.ts +267 -0
- package/test/execution/checkpoint.test.ts +811 -0
- package/test/execution/controller.test.ts +236 -0
- package/test/execution/event-manager.test.ts +118 -0
- package/test/execution/index.test.ts +690 -0
- package/test/execution/node.test.ts +464 -0
- package/test/execution/observer.test.ts +393 -0
- package/test/execution/parallel.test.ts +135 -0
- package/test/execution/plan-llm-integration.test.ts +290 -0
- package/test/execution/plan-real-onchain.test.ts +226 -0
- package/test/execution/send-api.test.ts +121 -0
- package/test/modules/agenda/node-cron.test.ts +307 -0
- package/test/modules/cli/index.test.ts +125 -0
- package/test/persistence/neo4j-execution-tracer.test.ts +96 -0
- package/test/persistence/neo4j-memory-adapter.test.ts +107 -0
- package/test/persistence/neo4j-petri-checkpoint.test.ts +89 -0
- package/test/pipeline/agent-pipeline.test.ts +118 -0
- package/test/routing/checkpoint-persistence.test.ts +58 -0
- package/test/routing/documentation-generator.test.ts +76 -0
- package/test/routing/integration.test.ts +261 -0
- package/test/routing/intent-classifier.test.ts +102 -0
- package/test/routing/petri.test.ts +156 -0
- package/test/routing/real-llm.test.ts +260 -0
- package/test-petri-features.ts +218 -0
- package/test-pipeline-api.ts +163 -0
- package/tsconfig.json +30 -108
- package/types/agent.ts +296 -0
- package/types/index.ts +387 -0
- package/utils/generate-action-schema.ts +47 -0
- package/utils/header-builder.ts +40 -0
- package/utils/logger.ts +40 -0
- package/package copy.json +0 -21
- package/types.ts +0 -62
- package/utils/executor.ts +0 -42
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rag_search_workflow",
|
|
3
|
+
"description": "Retrieval-Augmented Generation workflow. Searches a knowledge base, retrieves relevant documents, and generates a response using LLM.",
|
|
4
|
+
"places": [
|
|
5
|
+
{ "id": "idle", "type": "initial", "tokens": [{ "id": "start", "data": {} }] },
|
|
6
|
+
{ "id": "query_parsed", "type": "normal", "tokens": [] },
|
|
7
|
+
{ "id": "searching", "type": "normal", "tokens": [] },
|
|
8
|
+
{ "id": "documents_retrieved", "type": "normal", "tokens": [] },
|
|
9
|
+
{ "id": "generating_response", "type": "normal", "tokens": [] },
|
|
10
|
+
{ "id": "completed", "type": "final", "tokens": [] },
|
|
11
|
+
{ "id": "no_results", "type": "final", "tokens": [] }
|
|
12
|
+
],
|
|
13
|
+
"transitions": [
|
|
14
|
+
{
|
|
15
|
+
"id": "parse_query",
|
|
16
|
+
"from": ["idle"],
|
|
17
|
+
"to": "query_parsed",
|
|
18
|
+
"action": {
|
|
19
|
+
"type": "dynamic",
|
|
20
|
+
"prompt": "Parse the user query to extract search terms and intent. Return structured data.",
|
|
21
|
+
"maxSteps": 2
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "search_knowledge_base",
|
|
26
|
+
"from": ["query_parsed"],
|
|
27
|
+
"to": "searching",
|
|
28
|
+
"action": {
|
|
29
|
+
"type": "graphflow",
|
|
30
|
+
"name": "vector_search",
|
|
31
|
+
"contextMapper": "ctx => ({ query: ctx.parsedQuery?.query || ctx.originalMessage })"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "retrieve_docs",
|
|
36
|
+
"from": ["searching"],
|
|
37
|
+
"to": "documents_retrieved",
|
|
38
|
+
"guard": {
|
|
39
|
+
"type": "deterministic",
|
|
40
|
+
"condition": "context.searchResults && context.searchResults.length > 0"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "no_results_found",
|
|
45
|
+
"from": ["searching"],
|
|
46
|
+
"to": "no_results",
|
|
47
|
+
"guard": {
|
|
48
|
+
"type": "deterministic",
|
|
49
|
+
"condition": "!context.searchResults || context.searchResults.length === 0"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "generate_answer",
|
|
54
|
+
"from": ["documents_retrieved"],
|
|
55
|
+
"to": "generating_response",
|
|
56
|
+
"action": {
|
|
57
|
+
"type": "graphflow",
|
|
58
|
+
"name": "llm_generator",
|
|
59
|
+
"contextMapper": "ctx => ({ query: ctx.originalMessage, documents: ctx.searchResults })"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "complete",
|
|
64
|
+
"from": ["generating_response"],
|
|
65
|
+
"to": "completed"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { PetriNet } from './index';
|
|
2
|
+
import { Session } from './orchestrator';
|
|
3
|
+
import { IPetriCheckpointAdapter } from './checkpoint-adapter';
|
|
4
|
+
|
|
5
|
+
export interface PostgresCheckpointAdapterOptions {
|
|
6
|
+
connectionString: string;
|
|
7
|
+
tableName?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class PostgresPetriCheckpointAdapter implements IPetriCheckpointAdapter {
|
|
11
|
+
private connectionString: string;
|
|
12
|
+
private tableName: string;
|
|
13
|
+
private pool: any = null;
|
|
14
|
+
private initialized: boolean = false;
|
|
15
|
+
|
|
16
|
+
constructor(options: PostgresCheckpointAdapterOptions) {
|
|
17
|
+
this.connectionString = options.connectionString;
|
|
18
|
+
this.tableName = options.tableName || 'petri_checkpoints';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private async initPool(): Promise<void> {
|
|
22
|
+
if (this.initialized) return;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const pg = await (Function('moduleName', 'return import(moduleName)') as any)('pg');
|
|
26
|
+
const { Pool } = pg;
|
|
27
|
+
this.pool = new Pool({ connectionString: this.connectionString });
|
|
28
|
+
|
|
29
|
+
const client = await this.pool.connect();
|
|
30
|
+
try {
|
|
31
|
+
await client.query(`
|
|
32
|
+
CREATE TABLE IF NOT EXISTS ${this.tableName} (
|
|
33
|
+
id VARCHAR(255) PRIMARY KEY,
|
|
34
|
+
timestamp BIGINT NOT NULL,
|
|
35
|
+
session_id VARCHAR(255),
|
|
36
|
+
data JSONB NOT NULL,
|
|
37
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
38
|
+
);
|
|
39
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tableName}_session ON ${this.tableName}(session_id);
|
|
40
|
+
CREATE INDEX IF NOT EXISTS idx_${this.tableName}_timestamp ON ${this.tableName}(timestamp DESC);
|
|
41
|
+
`);
|
|
42
|
+
} finally {
|
|
43
|
+
client.release();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.initialized = true;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
'PostgreSQL adapter requires "pg" package. Install it with: pnpm add pg @types/pg'
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async save(net: PetriNet, session?: Session): Promise<string> {
|
|
55
|
+
await this.initPool();
|
|
56
|
+
|
|
57
|
+
const checkpointId = `petri-cp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
58
|
+
|
|
59
|
+
const marking = (net as any).state.marking as Map<string, any[]>;
|
|
60
|
+
const serializedMarking: any[] = [];
|
|
61
|
+
for (const [pid, tokens] of marking) {
|
|
62
|
+
serializedMarking.push({
|
|
63
|
+
placeId: pid,
|
|
64
|
+
tokens: tokens.map((t: any) => ({ id: t.id, data: t.data, createdAt: t.createdAt })),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const checkpoint = {
|
|
69
|
+
id: checkpointId,
|
|
70
|
+
timestamp: Date.now(),
|
|
71
|
+
sessionId: session?.id,
|
|
72
|
+
marking: serializedMarking,
|
|
73
|
+
history: (net as any).state.history || [],
|
|
74
|
+
sessionContext: (session as any)?.context,
|
|
75
|
+
sessionTraceId: session?.traceId,
|
|
76
|
+
sessionCreatedAt: session?.createdAt,
|
|
77
|
+
sessionHistory: session?.history || [],
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const sql = `
|
|
81
|
+
INSERT INTO ${this.tableName} (id, timestamp, session_id, data)
|
|
82
|
+
VALUES ($1, $2, $3, $4)
|
|
83
|
+
`;
|
|
84
|
+
await this.pool.query(sql, [
|
|
85
|
+
checkpointId,
|
|
86
|
+
checkpoint.timestamp,
|
|
87
|
+
checkpoint.sessionId || null,
|
|
88
|
+
JSON.stringify(checkpoint),
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
return checkpointId;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async load(checkpointId: string): Promise<{ net: PetriNet; session?: Session } | null> {
|
|
95
|
+
await this.initPool();
|
|
96
|
+
|
|
97
|
+
const sql = `SELECT data FROM ${this.tableName} WHERE id = $1`;
|
|
98
|
+
const result = await this.pool.query(sql, [checkpointId]);
|
|
99
|
+
|
|
100
|
+
if (result.rows.length === 0) return null;
|
|
101
|
+
|
|
102
|
+
const cp = result.rows[0].data;
|
|
103
|
+
const net = new PetriNet(cp.id);
|
|
104
|
+
const marking = (net as any).state.marking as Map<string, any[]>;
|
|
105
|
+
|
|
106
|
+
for (const item of cp.marking) {
|
|
107
|
+
marking.set(item.placeId, item.tokens.map((t: any) => ({ ...t })));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
(net as any).state.history = [...cp.history];
|
|
111
|
+
|
|
112
|
+
let session: Session | undefined;
|
|
113
|
+
if (cp.sessionId) {
|
|
114
|
+
session = {
|
|
115
|
+
id: cp.sessionId,
|
|
116
|
+
petriNet: net,
|
|
117
|
+
context: cp.sessionContext || {},
|
|
118
|
+
history: cp.sessionHistory || [],
|
|
119
|
+
createdAt: cp.sessionCreatedAt || cp.timestamp,
|
|
120
|
+
traceId: cp.sessionTraceId || `trace-restored-${Date.now()}`,
|
|
121
|
+
} as Session;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return { net, session };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async list(): Promise<Array<{ id: string; timestamp: number; sessionId?: string }>> {
|
|
128
|
+
await this.initPool();
|
|
129
|
+
|
|
130
|
+
const sql = `
|
|
131
|
+
SELECT id, timestamp, session_id as "sessionId"
|
|
132
|
+
FROM ${this.tableName}
|
|
133
|
+
ORDER BY timestamp DESC
|
|
134
|
+
`;
|
|
135
|
+
const result = await this.pool.query(sql);
|
|
136
|
+
return result.rows.map((row: any) => ({
|
|
137
|
+
id: row.id,
|
|
138
|
+
timestamp: parseInt(row.timestamp),
|
|
139
|
+
sessionId: row.sessionId,
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async delete(checkpointId: string): Promise<void> {
|
|
144
|
+
await this.initPool();
|
|
145
|
+
const sql = `DELETE FROM ${this.tableName} WHERE id = $1`;
|
|
146
|
+
await this.pool.query(sql, [checkpointId]);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async listBySession(sessionId: string): Promise<Array<{ id: string; timestamp: number }>> {
|
|
150
|
+
await this.initPool();
|
|
151
|
+
|
|
152
|
+
const sql = `
|
|
153
|
+
SELECT id, timestamp
|
|
154
|
+
FROM ${this.tableName}
|
|
155
|
+
WHERE session_id = $1
|
|
156
|
+
ORDER BY timestamp DESC
|
|
157
|
+
`;
|
|
158
|
+
const result = await this.pool.query(sql, [sessionId]);
|
|
159
|
+
return result.rows.map((row: any) => ({
|
|
160
|
+
id: row.id,
|
|
161
|
+
timestamp: parseInt(row.timestamp),
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async close(): Promise<void> {
|
|
166
|
+
if (this.pool) {
|
|
167
|
+
await this.pool.end();
|
|
168
|
+
this.pool = null;
|
|
169
|
+
this.initialized = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { PetriNet } from './index';
|
|
2
|
+
import { Session } from './orchestrator';
|
|
3
|
+
import { IPetriCheckpointAdapter } from './checkpoint-adapter';
|
|
4
|
+
import { createClient, RedisClientType } from 'redis';
|
|
5
|
+
|
|
6
|
+
export interface RedisCheckpointAdapterOptions {
|
|
7
|
+
url?: string;
|
|
8
|
+
host?: string;
|
|
9
|
+
port?: number;
|
|
10
|
+
password?: string;
|
|
11
|
+
keyPrefix?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class RedisPetriCheckpointAdapter implements IPetriCheckpointAdapter {
|
|
15
|
+
private client: RedisClientType;
|
|
16
|
+
private keyPrefix: string;
|
|
17
|
+
private connected: boolean = false;
|
|
18
|
+
|
|
19
|
+
constructor(options?: RedisCheckpointAdapterOptions) {
|
|
20
|
+
this.keyPrefix = options?.keyPrefix || 'petri:cp:';
|
|
21
|
+
|
|
22
|
+
if (options?.url) {
|
|
23
|
+
this.client = createClient({ url: options.url }) as RedisClientType;
|
|
24
|
+
} else {
|
|
25
|
+
this.client = createClient({
|
|
26
|
+
socket: {
|
|
27
|
+
host: options?.host || 'localhost',
|
|
28
|
+
port: options?.port || 6379,
|
|
29
|
+
},
|
|
30
|
+
password: options?.password,
|
|
31
|
+
}) as RedisClientType;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.client.on('error', (err) => {
|
|
35
|
+
console.error('Redis Client Error', err);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private async ensureConnected(): Promise<void> {
|
|
40
|
+
if (!this.connected) {
|
|
41
|
+
await this.client.connect();
|
|
42
|
+
this.connected = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async save(net: PetriNet, session?: Session): Promise<string> {
|
|
47
|
+
await this.ensureConnected();
|
|
48
|
+
|
|
49
|
+
const checkpointId = `petri-cp-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
50
|
+
|
|
51
|
+
const marking = (net as any).state.marking as Map<string, any[]>;
|
|
52
|
+
const serializedMarking: any[] = [];
|
|
53
|
+
for (const [pid, tokens] of marking) {
|
|
54
|
+
serializedMarking.push({
|
|
55
|
+
placeId: pid,
|
|
56
|
+
tokens: tokens.map(t => ({ id: t.id, data: t.data, createdAt: t.createdAt })),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const checkpoint = {
|
|
61
|
+
id: checkpointId,
|
|
62
|
+
timestamp: Date.now(),
|
|
63
|
+
sessionId: session?.id,
|
|
64
|
+
marking: serializedMarking,
|
|
65
|
+
history: (net as any).state.history || [],
|
|
66
|
+
sessionContext: (session as any)?.context,
|
|
67
|
+
sessionTraceId: session?.traceId,
|
|
68
|
+
sessionCreatedAt: session?.createdAt,
|
|
69
|
+
sessionHistory: session?.history || [],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const key = `${this.keyPrefix}${checkpointId}`;
|
|
73
|
+
await this.client.set(key, JSON.stringify(checkpoint));
|
|
74
|
+
|
|
75
|
+
const indexKey = `${this.keyPrefix}index`;
|
|
76
|
+
await this.client.zAdd(indexKey, { score: checkpoint.timestamp, value: checkpointId });
|
|
77
|
+
|
|
78
|
+
if (session?.id) {
|
|
79
|
+
const sessionKey = `${this.keyPrefix}session:${session.id}`;
|
|
80
|
+
await this.client.sAdd(sessionKey, checkpointId);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return checkpointId;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async load(checkpointId: string): Promise<{ net: PetriNet; session?: Session } | null> {
|
|
87
|
+
await this.ensureConnected();
|
|
88
|
+
|
|
89
|
+
const key = `${this.keyPrefix}${checkpointId}`;
|
|
90
|
+
const data = await this.client.get(key);
|
|
91
|
+
|
|
92
|
+
if (!data) return null;
|
|
93
|
+
|
|
94
|
+
const cp = JSON.parse(data);
|
|
95
|
+
const net = new PetriNet(cp.id);
|
|
96
|
+
const marking = (net as any).state.marking as Map<string, any[]>;
|
|
97
|
+
|
|
98
|
+
for (const item of cp.marking) {
|
|
99
|
+
marking.set(item.placeId, item.tokens.map((t: any) => ({ ...t })));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
(net as any).state.history = [...cp.history];
|
|
103
|
+
|
|
104
|
+
let session: Session | undefined;
|
|
105
|
+
if (cp.sessionId) {
|
|
106
|
+
session = {
|
|
107
|
+
id: cp.sessionId,
|
|
108
|
+
petriNet: net,
|
|
109
|
+
context: cp.sessionContext || {},
|
|
110
|
+
history: cp.sessionHistory || [],
|
|
111
|
+
createdAt: cp.sessionCreatedAt || cp.timestamp,
|
|
112
|
+
traceId: cp.sessionTraceId || `trace-restored-${Date.now()}`,
|
|
113
|
+
} as Session;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { net, session };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async list(): Promise<Array<{ id: string; timestamp: number; sessionId?: string }>> {
|
|
120
|
+
await this.ensureConnected();
|
|
121
|
+
|
|
122
|
+
const indexKey = `${this.keyPrefix}index`;
|
|
123
|
+
const ids = await this.client.zRange(indexKey, 0, -1, { REV: true });
|
|
124
|
+
|
|
125
|
+
const results = [];
|
|
126
|
+
for (const id of ids) {
|
|
127
|
+
const key = `${this.keyPrefix}${id}`;
|
|
128
|
+
const data = await this.client.get(key);
|
|
129
|
+
if (data) {
|
|
130
|
+
const cp = JSON.parse(data);
|
|
131
|
+
results.push({
|
|
132
|
+
id: cp.id,
|
|
133
|
+
timestamp: cp.timestamp,
|
|
134
|
+
sessionId: cp.sessionId,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return results;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async delete(checkpointId: string): Promise<void> {
|
|
143
|
+
await this.ensureConnected();
|
|
144
|
+
|
|
145
|
+
const key = `${this.keyPrefix}${checkpointId}`;
|
|
146
|
+
const data = await this.client.get(key);
|
|
147
|
+
|
|
148
|
+
if (data) {
|
|
149
|
+
const cp = JSON.parse(data);
|
|
150
|
+
if (cp.sessionId) {
|
|
151
|
+
const sessionKey = `${this.keyPrefix}session:${cp.sessionId}`;
|
|
152
|
+
await this.client.sRem(sessionKey, checkpointId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
await this.client.del(key);
|
|
157
|
+
|
|
158
|
+
const indexKey = `${this.keyPrefix}index`;
|
|
159
|
+
await this.client.zRem(indexKey, checkpointId);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async listBySession(sessionId: string): Promise<Array<{ id: string; timestamp: number }>> {
|
|
163
|
+
await this.ensureConnected();
|
|
164
|
+
|
|
165
|
+
const sessionKey = `${this.keyPrefix}session:${sessionId}`;
|
|
166
|
+
const ids = await this.client.sMembers(sessionKey);
|
|
167
|
+
|
|
168
|
+
const results = [];
|
|
169
|
+
for (const id of ids) {
|
|
170
|
+
const key = `${this.keyPrefix}${id}`;
|
|
171
|
+
const data = await this.client.get(key);
|
|
172
|
+
if (data) {
|
|
173
|
+
const cp = JSON.parse(data);
|
|
174
|
+
results.push({ id: cp.id, timestamp: cp.timestamp });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return results.sort((a, b) => b.timestamp - a.timestamp);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async close(): Promise<void> {
|
|
182
|
+
if (this.connected) {
|
|
183
|
+
await this.client.quit();
|
|
184
|
+
this.connected = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
package/routing/types.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface Token {
|
|
2
|
+
id: string;
|
|
3
|
+
data: Record<string, any>;
|
|
4
|
+
createdAt: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Place {
|
|
8
|
+
id: string;
|
|
9
|
+
type: 'normal' | 'initial' | 'final';
|
|
10
|
+
tokens: Token[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Guard {
|
|
14
|
+
type: 'deterministic' | 'llm_evaluated';
|
|
15
|
+
condition?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface TransitionAction {
|
|
20
|
+
type: 'graphflow' | 'dynamic';
|
|
21
|
+
name?: string;
|
|
22
|
+
prompt?: string;
|
|
23
|
+
maxSteps?: number;
|
|
24
|
+
contextMapper?: (ctx: any) => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Transition {
|
|
28
|
+
id: string;
|
|
29
|
+
from: string[];
|
|
30
|
+
to: string | string[];
|
|
31
|
+
guard?: Guard;
|
|
32
|
+
action?: TransitionAction;
|
|
33
|
+
description?: string;
|
|
34
|
+
when?: {
|
|
35
|
+
events: string[];
|
|
36
|
+
timeout?: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PetriNetState {
|
|
41
|
+
marking: Map<string, Token[]>;
|
|
42
|
+
history: string[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface TransitionResult {
|
|
46
|
+
success: boolean;
|
|
47
|
+
transitionId: string;
|
|
48
|
+
newMarking: Map<string, Token[]>;
|
|
49
|
+
consumedTokens: Token[];
|
|
50
|
+
producedTokens: Token[];
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type GuardLLMExecutor = (prompt: string, context: any) => Promise<boolean>;
|
|
55
|
+
|
|
56
|
+
export type ActionExecutor = (
|
|
57
|
+
action: TransitionAction,
|
|
58
|
+
context: any
|
|
59
|
+
) => Promise<any>;
|