@olane/o-core 0.1.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/README.md +199 -0
- package/dist/core/core.node.d.ts +61 -0
- package/dist/core/core.node.d.ts.map +1 -0
- package/dist/core/core.node.js +262 -0
- package/dist/core/core.node.js.map +1 -0
- package/dist/core/defaults/config.d.ts +4 -0
- package/dist/core/defaults/config.d.ts.map +1 -0
- package/dist/core/defaults/config.js +6 -0
- package/dist/core/defaults/config.js.map +1 -0
- package/dist/core/defaults/index.d.ts +2 -0
- package/dist/core/defaults/index.d.ts.map +1 -0
- package/dist/core/defaults/index.js +2 -0
- package/dist/core/defaults/index.js.map +1 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +10 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/interfaces/connection-manager.config.d.ts +7 -0
- package/dist/core/interfaces/connection-manager.config.d.ts.map +1 -0
- package/dist/core/interfaces/connection-manager.config.js +2 -0
- package/dist/core/interfaces/connection-manager.config.js.map +1 -0
- package/dist/core/interfaces/connection-send-params.interface.d.ts +7 -0
- package/dist/core/interfaces/connection-send-params.interface.d.ts.map +1 -0
- package/dist/core/interfaces/connection-send-params.interface.js +2 -0
- package/dist/core/interfaces/connection-send-params.interface.js.map +1 -0
- package/dist/core/interfaces/core-config.interface.d.ts +23 -0
- package/dist/core/interfaces/core-config.interface.d.ts.map +1 -0
- package/dist/core/interfaces/core-config.interface.js +2 -0
- package/dist/core/interfaces/core-config.interface.js.map +1 -0
- package/dist/core/interfaces/index.d.ts +6 -0
- package/dist/core/interfaces/index.d.ts.map +1 -0
- package/dist/core/interfaces/index.js +6 -0
- package/dist/core/interfaces/index.js.map +1 -0
- package/dist/core/interfaces/node-type.enum.d.ts +10 -0
- package/dist/core/interfaces/node-type.enum.d.ts.map +1 -0
- package/dist/core/interfaces/node-type.enum.js +11 -0
- package/dist/core/interfaces/node-type.enum.js.map +1 -0
- package/dist/core/interfaces/restricted-addresses.enum.d.ts +13 -0
- package/dist/core/interfaces/restricted-addresses.enum.d.ts.map +1 -0
- package/dist/core/interfaces/restricted-addresses.enum.js +19 -0
- package/dist/core/interfaces/restricted-addresses.enum.js.map +1 -0
- package/dist/core/interfaces/state.enum.d.ts +8 -0
- package/dist/core/interfaces/state.enum.d.ts.map +1 -0
- package/dist/core/interfaces/state.enum.js +9 -0
- package/dist/core/interfaces/state.enum.js.map +1 -0
- package/dist/core/interfaces/use-options.interface.d.ts +6 -0
- package/dist/core/interfaces/use-options.interface.d.ts.map +1 -0
- package/dist/core/interfaces/use-options.interface.js +2 -0
- package/dist/core/interfaces/use-options.interface.js.map +1 -0
- package/dist/core/lib/index.d.ts +8 -0
- package/dist/core/lib/index.d.ts.map +1 -0
- package/dist/core/lib/index.js +8 -0
- package/dist/core/lib/index.js.map +1 -0
- package/dist/core/lib/o-address-resolution.d.ts +9 -0
- package/dist/core/lib/o-address-resolution.d.ts.map +1 -0
- package/dist/core/lib/o-address-resolution.js +20 -0
- package/dist/core/lib/o-address-resolution.js.map +1 -0
- package/dist/core/lib/o-address-resolver.d.ts +17 -0
- package/dist/core/lib/o-address-resolver.d.ts.map +1 -0
- package/dist/core/lib/o-address-resolver.js +38 -0
- package/dist/core/lib/o-address-resolver.js.map +1 -0
- package/dist/core/lib/o-connection-manager.d.ts +17 -0
- package/dist/core/lib/o-connection-manager.d.ts.map +1 -0
- package/dist/core/lib/o-connection-manager.js +47 -0
- package/dist/core/lib/o-connection-manager.js.map +1 -0
- package/dist/core/lib/o-connection.d.ts +27 -0
- package/dist/core/lib/o-connection.d.ts.map +1 -0
- package/dist/core/lib/o-connection.js +74 -0
- package/dist/core/lib/o-connection.js.map +1 -0
- package/dist/core/lib/o-request.d.ts +17 -0
- package/dist/core/lib/o-request.d.ts.map +1 -0
- package/dist/core/lib/o-request.js +31 -0
- package/dist/core/lib/o-request.js.map +1 -0
- package/dist/core/lib/o-response.d.ts +12 -0
- package/dist/core/lib/o-response.d.ts.map +1 -0
- package/dist/core/lib/o-response.js +22 -0
- package/dist/core/lib/o-response.js.map +1 -0
- package/dist/core/lib/resolvers/anything.resolver.d.ts +8 -0
- package/dist/core/lib/resolvers/anything.resolver.d.ts.map +1 -0
- package/dist/core/lib/resolvers/anything.resolver.js +13 -0
- package/dist/core/lib/resolvers/anything.resolver.js.map +1 -0
- package/dist/core/lib/resolvers/index.d.ts +5 -0
- package/dist/core/lib/resolvers/index.d.ts.map +1 -0
- package/dist/core/lib/resolvers/index.js +5 -0
- package/dist/core/lib/resolvers/index.js.map +1 -0
- package/dist/core/lib/resolvers/method.resolver.d.ts +8 -0
- package/dist/core/lib/resolvers/method.resolver.d.ts.map +1 -0
- package/dist/core/lib/resolvers/method.resolver.js +19 -0
- package/dist/core/lib/resolvers/method.resolver.js.map +1 -0
- package/dist/core/lib/resolvers/next-hop.resolver.d.ts +10 -0
- package/dist/core/lib/resolvers/next-hop.resolver.d.ts.map +1 -0
- package/dist/core/lib/resolvers/next-hop.resolver.js +50 -0
- package/dist/core/lib/resolvers/next-hop.resolver.js.map +1 -0
- package/dist/core/lib/resolvers/storage.resolver.d.ts +6 -0
- package/dist/core/lib/resolvers/storage.resolver.d.ts.map +1 -0
- package/dist/core/lib/resolvers/storage.resolver.js +11 -0
- package/dist/core/lib/resolvers/storage.resolver.js.map +1 -0
- package/dist/core/o-address.d.ts +20 -0
- package/dist/core/o-address.d.ts.map +1 -0
- package/dist/core/o-address.js +50 -0
- package/dist/core/o-address.js.map +1 -0
- package/dist/core/o-dependency.d.ts +9 -0
- package/dist/core/o-dependency.d.ts.map +1 -0
- package/dist/core/o-dependency.js +18 -0
- package/dist/core/o-dependency.js.map +1 -0
- package/dist/core/o-parameter.d.ts +13 -0
- package/dist/core/o-parameter.d.ts.map +1 -0
- package/dist/core/o-parameter.js +28 -0
- package/dist/core/o-parameter.js.map +1 -0
- package/dist/core/utils/core.utils.d.ts +15 -0
- package/dist/core/utils/core.utils.d.ts.map +1 -0
- package/dist/core/utils/core.utils.js +52 -0
- package/dist/core/utils/core.utils.js.map +1 -0
- package/dist/core/utils/index.d.ts +4 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +4 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/logger.d.ts +11 -0
- package/dist/core/utils/logger.d.ts.map +1 -0
- package/dist/core/utils/logger.js +26 -0
- package/dist/core/utils/logger.js.map +1 -0
- package/dist/core/utils/network.utils.d.ts +10 -0
- package/dist/core/utils/network.utils.d.ts.map +1 -0
- package/dist/core/utils/network.utils.js +31 -0
- package/dist/core/utils/network.utils.js.map +1 -0
- package/dist/error/enums/codes.error.d.ts +16 -0
- package/dist/error/enums/codes.error.d.ts.map +1 -0
- package/dist/error/enums/codes.error.js +17 -0
- package/dist/error/enums/codes.error.js.map +1 -0
- package/dist/error/index.d.ts +3 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/error/index.js +3 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/tool.error.d.ts +17 -0
- package/dist/error/tool.error.d.ts.map +1 -0
- package/dist/error/tool.error.js +19 -0
- package/dist/error/tool.error.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +4 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/lib/local-search.lib.d.ts +6 -0
- package/dist/node/lib/local-search.lib.d.ts.map +1 -0
- package/dist/node/lib/local-search.lib.js +7 -0
- package/dist/node/lib/local-search.lib.js.map +1 -0
- package/dist/node/lib/network-activity.lib.d.ts +12 -0
- package/dist/node/lib/network-activity.lib.d.ts.map +1 -0
- package/dist/node/lib/network-activity.lib.js +32 -0
- package/dist/node/lib/network-activity.lib.js.map +1 -0
- package/dist/node/node.d.ts +31 -0
- package/dist/node/node.d.ts.map +1 -0
- package/dist/node/node.js +233 -0
- package/dist/node/node.js.map +1 -0
- package/dist/node-host/host.node.d.ts +6 -0
- package/dist/node-host/host.node.d.ts.map +1 -0
- package/dist/node-host/host.node.js +16 -0
- package/dist/node-host/host.node.js.map +1 -0
- package/dist/node-host/index.d.ts +2 -0
- package/dist/node-host/index.d.ts.map +1 -0
- package/dist/node-host/index.js +2 -0
- package/dist/node-host/index.js.map +1 -0
- package/dist/node-virtual/index.d.ts +2 -0
- package/dist/node-virtual/index.d.ts.map +1 -0
- package/dist/node-virtual/index.js +2 -0
- package/dist/node-virtual/index.js.map +1 -0
- package/dist/node-virtual/virtual.node.d.ts +5 -0
- package/dist/node-virtual/virtual.node.d.ts.map +1 -0
- package/dist/node-virtual/virtual.node.js +8 -0
- package/dist/node-virtual/virtual.node.js.map +1 -0
- package/dist/plan/agent.plan.d.ts +16 -0
- package/dist/plan/agent.plan.d.ts.map +1 -0
- package/dist/plan/agent.plan.js +140 -0
- package/dist/plan/agent.plan.js.map +1 -0
- package/dist/plan/configure/configure.plan.d.ts +8 -0
- package/dist/plan/configure/configure.plan.d.ts.map +1 -0
- package/dist/plan/configure/configure.plan.js +13 -0
- package/dist/plan/configure/configure.plan.js.map +1 -0
- package/dist/plan/error/error.plan.d.ts +11 -0
- package/dist/plan/error/error.plan.d.ts.map +1 -0
- package/dist/plan/error/error.plan.js +22 -0
- package/dist/plan/error/error.plan.js.map +1 -0
- package/dist/plan/index.d.ts +5 -0
- package/dist/plan/index.d.ts.map +1 -0
- package/dist/plan/index.js +5 -0
- package/dist/plan/index.js.map +1 -0
- package/dist/plan/interfaces/plan-config.interface.d.ts +14 -0
- package/dist/plan/interfaces/plan-config.interface.d.ts.map +1 -0
- package/dist/plan/interfaces/plan-config.interface.js +2 -0
- package/dist/plan/interfaces/plan-config.interface.js.map +1 -0
- package/dist/plan/interfaces/plan-result.interface.d.ts +6 -0
- package/dist/plan/interfaces/plan-result.interface.d.ts.map +1 -0
- package/dist/plan/interfaces/plan-result.interface.js +2 -0
- package/dist/plan/interfaces/plan-result.interface.js.map +1 -0
- package/dist/plan/interfaces/plan-type.enum.d.ts +7 -0
- package/dist/plan/interfaces/plan-type.enum.d.ts.map +1 -0
- package/dist/plan/interfaces/plan-type.enum.js +8 -0
- package/dist/plan/interfaces/plan-type.enum.js.map +1 -0
- package/dist/plan/interfaces/plan.result.d.ts +15 -0
- package/dist/plan/interfaces/plan.result.d.ts.map +1 -0
- package/dist/plan/interfaces/plan.result.js +2 -0
- package/dist/plan/interfaces/plan.result.js.map +1 -0
- package/dist/plan/interfaces/query.config.d.ts +6 -0
- package/dist/plan/interfaces/query.config.d.ts.map +1 -0
- package/dist/plan/interfaces/query.config.js +2 -0
- package/dist/plan/interfaces/query.config.js.map +1 -0
- package/dist/plan/interfaces/task.config.d.ts +10 -0
- package/dist/plan/interfaces/task.config.d.ts.map +1 -0
- package/dist/plan/interfaces/task.config.js +2 -0
- package/dist/plan/interfaces/task.config.js.map +1 -0
- package/dist/plan/o-plan.d.ts +34 -0
- package/dist/plan/o-plan.d.ts.map +1 -0
- package/dist/plan/o-plan.js +182 -0
- package/dist/plan/o-plan.js.map +1 -0
- package/dist/plan/plan.context.d.ts +10 -0
- package/dist/plan/plan.context.d.ts.map +1 -0
- package/dist/plan/plan.context.js +29 -0
- package/dist/plan/plan.context.js.map +1 -0
- package/dist/plan/prompts/agent.prompt.d.ts +2 -0
- package/dist/plan/prompts/agent.prompt.d.ts.map +1 -0
- package/dist/plan/prompts/agent.prompt.js +95 -0
- package/dist/plan/prompts/agent.prompt.js.map +1 -0
- package/dist/plan/prompts/configure.prompt.d.ts +2 -0
- package/dist/plan/prompts/configure.prompt.d.ts.map +1 -0
- package/dist/plan/prompts/configure.prompt.js +56 -0
- package/dist/plan/prompts/configure.prompt.js.map +1 -0
- package/dist/plan/prompts/custom.prompt.d.ts +2 -0
- package/dist/plan/prompts/custom.prompt.d.ts.map +1 -0
- package/dist/plan/prompts/custom.prompt.js +56 -0
- package/dist/plan/prompts/custom.prompt.js.map +1 -0
- package/dist/plan/prompts/error.prompt.d.ts +2 -0
- package/dist/plan/prompts/error.prompt.d.ts.map +1 -0
- package/dist/plan/prompts/error.prompt.js +40 -0
- package/dist/plan/prompts/error.prompt.js.map +1 -0
- package/dist/plan/prompts/search.prompt.d.ts +2 -0
- package/dist/plan/prompts/search.prompt.d.ts.map +1 -0
- package/dist/plan/prompts/search.prompt.js +44 -0
- package/dist/plan/prompts/search.prompt.js.map +1 -0
- package/dist/plan/search/prompts/search-analysis.prompt.d.ts +2 -0
- package/dist/plan/search/prompts/search-analysis.prompt.d.ts.map +1 -0
- package/dist/plan/search/prompts/search-analysis.prompt.js +15 -0
- package/dist/plan/search/prompts/search-analysis.prompt.js.map +1 -0
- package/dist/plan/search/search.plan.d.ts +15 -0
- package/dist/plan/search/search.plan.d.ts.map +1 -0
- package/dist/plan/search/search.plan.js +36 -0
- package/dist/plan/search/search.plan.js.map +1 -0
- package/dist/plan/use/index.d.ts +2 -0
- package/dist/plan/use/index.d.ts.map +1 -0
- package/dist/plan/use/index.js +2 -0
- package/dist/plan/use/index.js.map +1 -0
- package/dist/plan/use/use.plan.d.ts +10 -0
- package/dist/plan/use/use.plan.d.ts.map +1 -0
- package/dist/plan/use/use.plan.js +58 -0
- package/dist/plan/use/use.plan.js.map +1 -0
- package/dist/src/core/core.node.d.ts +62 -0
- package/dist/src/core/core.node.d.ts.map +1 -0
- package/dist/src/core/core.node.js +262 -0
- package/dist/src/core/core.node.js.map +1 -0
- package/dist/src/core/index.d.ts +10 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/interfaces/core-config.interface.d.ts +23 -0
- package/dist/src/core/interfaces/core-config.interface.d.ts.map +1 -0
- package/dist/src/core/interfaces/core-config.interface.js +2 -0
- package/dist/src/core/interfaces/core-config.interface.js.map +1 -0
- package/dist/src/core/interfaces/index.d.ts +6 -0
- package/dist/src/core/interfaces/index.d.ts.map +1 -0
- package/dist/src/core/lib/index.d.ts +8 -0
- package/dist/src/core/lib/index.d.ts.map +1 -0
- package/dist/src/core/lib/o-address-resolution.d.ts +9 -0
- package/dist/src/core/lib/o-address-resolution.d.ts.map +1 -0
- package/dist/src/core/lib/o-address-resolver.d.ts +17 -0
- package/dist/src/core/lib/o-address-resolver.d.ts.map +1 -0
- package/dist/src/core/lib/o-connection-manager.d.ts +17 -0
- package/dist/src/core/lib/o-connection-manager.d.ts.map +1 -0
- package/dist/src/core/lib/o-connection.d.ts +28 -0
- package/dist/src/core/lib/o-connection.d.ts.map +1 -0
- package/dist/src/core/lib/o-connection.js +86 -0
- package/dist/src/core/lib/o-connection.js.map +1 -0
- package/dist/src/core/lib/o-request.d.ts +17 -0
- package/dist/src/core/lib/o-request.d.ts.map +1 -0
- package/dist/src/core/lib/o-request.js +31 -0
- package/dist/src/core/lib/o-request.js.map +1 -0
- package/dist/src/core/lib/o-response.d.ts +12 -0
- package/dist/src/core/lib/o-response.d.ts.map +1 -0
- package/dist/src/core/lib/o-response.js +22 -0
- package/dist/src/core/lib/o-response.js.map +1 -0
- package/dist/src/core/lib/resolvers/anything.resolver.d.ts +8 -0
- package/dist/src/core/lib/resolvers/anything.resolver.d.ts.map +1 -0
- package/dist/src/core/lib/resolvers/index.d.ts +5 -0
- package/dist/src/core/lib/resolvers/index.d.ts.map +1 -0
- package/dist/src/core/lib/resolvers/method.resolver.d.ts +8 -0
- package/dist/src/core/lib/resolvers/method.resolver.d.ts.map +1 -0
- package/dist/src/core/lib/resolvers/next-hop.resolver.d.ts +10 -0
- package/dist/src/core/lib/resolvers/next-hop.resolver.d.ts.map +1 -0
- package/dist/src/core/lib/resolvers/storage.resolver.d.ts +6 -0
- package/dist/src/core/lib/resolvers/storage.resolver.d.ts.map +1 -0
- package/dist/src/core/o-address.d.ts +20 -0
- package/dist/src/core/o-address.d.ts.map +1 -0
- package/dist/src/core/o-dependency.d.ts +9 -0
- package/dist/src/core/o-dependency.d.ts.map +1 -0
- package/dist/src/core/o-dependency.js +18 -0
- package/dist/src/core/o-dependency.js.map +1 -0
- package/dist/src/core/o-parameter.d.ts +13 -0
- package/dist/src/core/o-parameter.d.ts.map +1 -0
- package/dist/src/core/o-parameter.js +28 -0
- package/dist/src/core/o-parameter.js.map +1 -0
- package/dist/src/core/utils/core.utils.d.ts +15 -0
- package/dist/src/core/utils/core.utils.d.ts.map +1 -0
- package/dist/src/core/utils/index.d.ts +4 -0
- package/dist/src/core/utils/index.d.ts.map +1 -0
- package/dist/src/core/utils/network.utils.d.ts +10 -0
- package/dist/src/core/utils/network.utils.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/node/index.d.ts +4 -0
- package/dist/src/node/index.d.ts.map +1 -0
- package/dist/src/node/lib/local-search.lib.d.ts +6 -0
- package/dist/src/node/lib/local-search.lib.d.ts.map +1 -0
- package/dist/src/node/lib/network-activity.lib.d.ts +12 -0
- package/dist/src/node/lib/network-activity.lib.d.ts.map +1 -0
- package/dist/src/node/node.d.ts +28 -0
- package/dist/src/node/node.d.ts.map +1 -0
- package/dist/src/node-host/host.node.d.ts +6 -0
- package/dist/src/node-host/host.node.d.ts.map +1 -0
- package/dist/src/node-host/index.d.ts +2 -0
- package/dist/src/node-host/index.d.ts.map +1 -0
- package/dist/src/node-virtual/index.d.ts +2 -0
- package/dist/src/node-virtual/index.d.ts.map +1 -0
- package/dist/src/node-virtual/virtual.node.d.ts +5 -0
- package/dist/src/node-virtual/virtual.node.d.ts.map +1 -0
- package/dist/src/plan/agent.plan.d.ts +15 -0
- package/dist/src/plan/agent.plan.d.ts.map +1 -0
- package/dist/src/plan/error/error.plan.d.ts +11 -0
- package/dist/src/plan/error/error.plan.d.ts.map +1 -0
- package/dist/src/plan/index.d.ts +5 -0
- package/dist/src/plan/index.d.ts.map +1 -0
- package/dist/src/plan/interfaces/plan-config.interface.d.ts +14 -0
- package/dist/src/plan/interfaces/plan-config.interface.d.ts.map +1 -0
- package/dist/src/plan/interfaces/plan-result.interface.d.ts +6 -0
- package/dist/src/plan/interfaces/plan-result.interface.d.ts.map +1 -0
- package/dist/src/plan/o-plan.d.ts +33 -0
- package/dist/src/plan/o-plan.d.ts.map +1 -0
- package/dist/src/plan/search/search.plan.d.ts +11 -0
- package/dist/src/plan/search/search.plan.d.ts.map +1 -0
- package/dist/src/plan/use/index.d.ts +2 -0
- package/dist/src/plan/use/index.d.ts.map +1 -0
- package/dist/src/plan/use/use.plan.d.ts +10 -0
- package/dist/src/plan/use/use.plan.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { oAddress } from '../core';
|
|
2
|
+
import { oPlan } from './o-plan';
|
|
3
|
+
import { oUsePlan } from './use/use.plan';
|
|
4
|
+
import { oSearchPlan } from './search/search.plan';
|
|
5
|
+
import { oErrorPlan } from './error/error.plan';
|
|
6
|
+
export class oAgentPlan extends oPlan {
|
|
7
|
+
MAX_ITERATIONS = 20;
|
|
8
|
+
contextIdHash = {};
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
}
|
|
12
|
+
async handleTasks(results, config) {
|
|
13
|
+
this.logger.debug('Handling task...', results);
|
|
14
|
+
const tasks = results.tasks;
|
|
15
|
+
if (!tasks) {
|
|
16
|
+
throw new Error('Invalid task passed to handleTask');
|
|
17
|
+
}
|
|
18
|
+
const taskResults = [];
|
|
19
|
+
for (const task of tasks) {
|
|
20
|
+
if (!task.address) {
|
|
21
|
+
throw new Error('Invalid address passed to handleTask');
|
|
22
|
+
}
|
|
23
|
+
const taskPlan = new oUsePlan({
|
|
24
|
+
...config,
|
|
25
|
+
intent: this.config.intent,
|
|
26
|
+
context: this.config.context,
|
|
27
|
+
receiver: new oAddress(task.address),
|
|
28
|
+
});
|
|
29
|
+
const taskResult = await taskPlan.execute();
|
|
30
|
+
this.sequence.push(taskPlan);
|
|
31
|
+
this.logger.debug('Pushed task plan to sequence: ', taskPlan.result);
|
|
32
|
+
taskResults.push(taskResult);
|
|
33
|
+
await this.handleError(taskResult.error, config);
|
|
34
|
+
}
|
|
35
|
+
return taskResults;
|
|
36
|
+
}
|
|
37
|
+
async handleSearch(queries, config) {
|
|
38
|
+
this.logger.debug('Handling searches...', queries);
|
|
39
|
+
if (queries.length === 0) {
|
|
40
|
+
throw new Error('No queries provided to handleSearch');
|
|
41
|
+
}
|
|
42
|
+
const results = [];
|
|
43
|
+
for (const query of queries) {
|
|
44
|
+
const searchPlan = new oSearchPlan({
|
|
45
|
+
...config,
|
|
46
|
+
intent: `Searching for context to help with the user intent`,
|
|
47
|
+
query: query?.query,
|
|
48
|
+
external: query?.provider === 'external',
|
|
49
|
+
});
|
|
50
|
+
const result = await searchPlan.execute();
|
|
51
|
+
this.sequence.push(searchPlan);
|
|
52
|
+
this.logger.debug('Search result: ', result.result);
|
|
53
|
+
results.push(result.result);
|
|
54
|
+
}
|
|
55
|
+
return results.flat();
|
|
56
|
+
}
|
|
57
|
+
async handleError(error, config) {
|
|
58
|
+
this.logger.debug('Handling error...', error);
|
|
59
|
+
const errorPlan = new oErrorPlan({
|
|
60
|
+
...config,
|
|
61
|
+
error: error,
|
|
62
|
+
});
|
|
63
|
+
this.sequence.push(errorPlan);
|
|
64
|
+
const result = await errorPlan.execute();
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
async handleMultipleStep(output) {
|
|
68
|
+
this.logger.debug('Handling analysis...', output);
|
|
69
|
+
const results = [];
|
|
70
|
+
for (const intent of output?.intents || []) {
|
|
71
|
+
const subPlan = new oAgentPlan({
|
|
72
|
+
...this.config,
|
|
73
|
+
intent: intent.intent,
|
|
74
|
+
});
|
|
75
|
+
const response = await subPlan.execute();
|
|
76
|
+
this.logger.debug('Handled multiple step intent: ', intent.intent, response);
|
|
77
|
+
results.push(JSON.stringify(response));
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
result: results,
|
|
81
|
+
type: 'multiple_step',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async loop() {
|
|
85
|
+
if (!this.node) {
|
|
86
|
+
throw new Error('Node not set');
|
|
87
|
+
}
|
|
88
|
+
let iterations = 0;
|
|
89
|
+
while (iterations++ < this.MAX_ITERATIONS) {
|
|
90
|
+
this.logger.debug('Plan context size: ', this.config.context?.toString()?.length);
|
|
91
|
+
const planConfig = {
|
|
92
|
+
intent: this.config.intent,
|
|
93
|
+
currentNode: this.node,
|
|
94
|
+
caller: this.node?.address,
|
|
95
|
+
context: this.config.context,
|
|
96
|
+
sequence: this.sequence,
|
|
97
|
+
};
|
|
98
|
+
const plan = new oPlan(planConfig);
|
|
99
|
+
const response = await plan.execute();
|
|
100
|
+
const planResult = response;
|
|
101
|
+
const { error, result, type } = planResult;
|
|
102
|
+
this.sequence.push(plan);
|
|
103
|
+
const resultType = type;
|
|
104
|
+
if (resultType === 'result' ||
|
|
105
|
+
resultType === 'error' ||
|
|
106
|
+
resultType === 'handshake') {
|
|
107
|
+
return planResult;
|
|
108
|
+
}
|
|
109
|
+
if (resultType === 'multiple_step') {
|
|
110
|
+
this.logger.debug('Handling multiple step...', planResult);
|
|
111
|
+
const multipleStepResult = await this.handleMultipleStep(planResult);
|
|
112
|
+
this.config.context?.add(JSON.stringify(multipleStepResult));
|
|
113
|
+
}
|
|
114
|
+
if (resultType === 'search' && planResult.queries) {
|
|
115
|
+
const searchResults = await this.handleSearch(planResult.queries, planConfig);
|
|
116
|
+
const filteredSearchResults = searchResults.filter((result) => !this.contextIdHash[result?.metadata?.id]);
|
|
117
|
+
let searchResultContext = `[Search Results Begin]`;
|
|
118
|
+
if (filteredSearchResults.length === 0) {
|
|
119
|
+
searchResultContext += `No more search results found!\n\n`;
|
|
120
|
+
}
|
|
121
|
+
for (const searchResult of filteredSearchResults) {
|
|
122
|
+
this.contextIdHash[searchResult.metadata.id] = true;
|
|
123
|
+
searchResultContext += `Tool Address: ${searchResult.metadata.address}\nTool Data: ${searchResult.pageContent}\n\n`;
|
|
124
|
+
}
|
|
125
|
+
searchResultContext += `[Search Results End]`;
|
|
126
|
+
if (filteredSearchResults.length > 0) {
|
|
127
|
+
this.config.context?.add(searchResultContext);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (resultType === 'task') {
|
|
131
|
+
await this.handleTasks(planResult, planConfig);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
throw new Error('Plan failed, reached max iterations');
|
|
135
|
+
}
|
|
136
|
+
async run() {
|
|
137
|
+
return await this.loop();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=agent.plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.plan.js","sourceRoot":"","sources":["../../src/plan/agent.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAwB,MAAM,SAAS,CAAC;AAGjE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,cAAc,GAAG,EAAE,CAAC;IACpB,aAAa,GAAG,EAAE,CAAC;IAE3B,YAAY,MAAmB;QAC7B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CACf,OAAoB,EACpB,MAAmB;QAEnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,WAAW,GAAkB,E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M,GAAG,CAAC,EAAE,CAAC;oBACrC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;YAGD,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;gBAC1B,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { oPlan } from '../o-plan';
|
|
2
|
+
import { oPlanType } from '../interfaces/plan-type.enum';
|
|
3
|
+
import { oPlanConfig } from '../interfaces/plan-config.interface';
|
|
4
|
+
export declare class oConfigurePlan extends oPlan {
|
|
5
|
+
constructor(config: oPlanConfig);
|
|
6
|
+
type(): oPlanType;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=configure.plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.plan.d.ts","sourceRoot":"","sources":["../../../src/plan/configure/configure.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAMlE,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,MAAM,EAAE,WAAW;IAK/B,IAAI;CAGL"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { oPlan } from '../o-plan';
|
|
2
|
+
import { oPlanType } from '../interfaces/plan-type.enum';
|
|
3
|
+
import { CONFIGURE_PROMPT } from '../prompts/configure.prompt';
|
|
4
|
+
export class oConfigurePlan extends oPlan {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super(config);
|
|
7
|
+
this.config.promptFunction = CONFIGURE_PROMPT;
|
|
8
|
+
}
|
|
9
|
+
type() {
|
|
10
|
+
return oPlanType.CONFIGURE;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=configure.plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.plan.js","sourceRoot":"","sources":["../../../src/plan/configure/configure.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAK/D,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,MAAmB;QAC7B,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,gBAAgB,CAAC;IAChD,CAAC;IAED,IAAI;QACF,OAAO,SAAS,CAAC,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { oPlanConfig } from '../interfaces/plan-config.interface';
|
|
2
|
+
import { oPlanResult } from '../interfaces/plan.result';
|
|
3
|
+
import { oPlan } from '../o-plan';
|
|
4
|
+
export declare class oErrorPlan extends oPlan {
|
|
5
|
+
private error;
|
|
6
|
+
constructor(config: oPlanConfig & {
|
|
7
|
+
error: any;
|
|
8
|
+
});
|
|
9
|
+
run(): Promise<oPlanResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=error.plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.plan.d.ts","sourceRoot":"","sources":["../../../src/plan/error/error.plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,qBAAa,UAAW,SAAQ,KAAK;IACnC,OAAO,CAAC,KAAK,CAAM;gBACP,MAAM,EAAE,WAAW,GAAG;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE;IAK1C,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;CAalC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { oAddress } from '../../core';
|
|
2
|
+
import { oPlan } from '../o-plan';
|
|
3
|
+
import { ERROR_PROMPT } from '../prompts/error.prompt';
|
|
4
|
+
export class oErrorPlan extends oPlan {
|
|
5
|
+
error;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super(config);
|
|
8
|
+
this.error = config.error;
|
|
9
|
+
}
|
|
10
|
+
async run() {
|
|
11
|
+
const prompt = ERROR_PROMPT(this.error, this.agentHistory);
|
|
12
|
+
this.logger.debug('Error prompt: ', prompt);
|
|
13
|
+
const response = await this.node.use(new oAddress('o://intelligence'), {
|
|
14
|
+
method: 'prompt',
|
|
15
|
+
params: {
|
|
16
|
+
prompt: prompt,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return response.result.data;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=error.plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.plan.js","sourceRoot":"","sources":["../../../src/plan/error/error.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,KAAK,CAAM;IACnB,YAAY,MAAoC;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,EAAE;YACrE,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN,MAAM,EAAE,MAAM;aACf;SACF,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAmB,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plan/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plan/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { oAddress, oCoreNode } from '../../core';
|
|
2
|
+
import { oPlanContext } from '../plan.context';
|
|
3
|
+
export interface oPlanConfig {
|
|
4
|
+
intent: string;
|
|
5
|
+
noIndex?: boolean;
|
|
6
|
+
useCache?: boolean;
|
|
7
|
+
context?: oPlanContext;
|
|
8
|
+
sequence?: any[];
|
|
9
|
+
currentNode: oCoreNode;
|
|
10
|
+
caller: oAddress;
|
|
11
|
+
receiver?: oAddress;
|
|
12
|
+
promptFunction?: (intent: string, context: string, agentHistory: string) => string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=plan-config.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-config.interface.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,WAAW;IAE1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAGjB,WAAW,EAAE,SAAS,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,CACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,KACjB,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-config.interface.js","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-result.interface.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-result.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-result.interface.js","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-result.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-type.enum.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-type.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,GAAG,QAAQ;CACZ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var oPlanType;
|
|
2
|
+
(function (oPlanType) {
|
|
3
|
+
oPlanType["ANALYSIS"] = "analysis";
|
|
4
|
+
oPlanType["SEARCH"] = "search";
|
|
5
|
+
oPlanType["CONFIGURE"] = "configure";
|
|
6
|
+
oPlanType["USE"] = "use";
|
|
7
|
+
})(oPlanType || (oPlanType = {}));
|
|
8
|
+
//# sourceMappingURL=plan-type.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-type.enum.js","sourceRoot":"","sources":["../../../src/plan/interfaces/plan-type.enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,oCAAuB,CAAA;IACvB,wBAAW,CAAA;AACb,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { oQueryConfig } from './query.config';
|
|
2
|
+
import { oTaskConfig } from './task.config';
|
|
3
|
+
export interface oPlanResult {
|
|
4
|
+
intents?: {
|
|
5
|
+
intent: string;
|
|
6
|
+
}[];
|
|
7
|
+
queries?: oQueryConfig[];
|
|
8
|
+
tasks?: oTaskConfig[];
|
|
9
|
+
handshake?: oTaskConfig;
|
|
10
|
+
result?: any;
|
|
11
|
+
reasoning?: string;
|
|
12
|
+
error?: any;
|
|
13
|
+
type: 'result' | 'task' | 'search' | 'multiple_step' | 'error' | 'handshake';
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=plan.result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.result.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/plan.result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,OAAO,GAAG,WAAW,CAAC;CAC9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.result.js","sourceRoot":"","sources":["../../../src/plan/interfaces/plan.result.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.config.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/query.config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.config.js","sourceRoot":"","sources":["../../../src/plan/interfaces/query.config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.config.d.ts","sourceRoot":"","sources":["../../../src/plan/interfaces/task.config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;SAAE,CAAC;KAChC,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.config.js","sourceRoot":"","sources":["../../../src/plan/interfaces/task.config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Logger, oAddress } from '../';
|
|
2
|
+
import { oPlanConfig } from './interfaces/plan-config.interface';
|
|
3
|
+
import { CID } from 'multiformats/cid';
|
|
4
|
+
import { oPlanResult } from './interfaces/plan.result';
|
|
5
|
+
export declare class oPlan {
|
|
6
|
+
protected readonly config: oPlanConfig;
|
|
7
|
+
protected logger: Logger;
|
|
8
|
+
sequence: oPlan[];
|
|
9
|
+
cid: CID | undefined;
|
|
10
|
+
result: oPlanResult | undefined;
|
|
11
|
+
constructor(config: oPlanConfig);
|
|
12
|
+
get caller(): oAddress;
|
|
13
|
+
get receiver(): oAddress | undefined;
|
|
14
|
+
get node(): import("../").oCoreNode;
|
|
15
|
+
toCIDInput(): any;
|
|
16
|
+
type(): string;
|
|
17
|
+
toJSON(): {
|
|
18
|
+
config: any;
|
|
19
|
+
sequence: string[];
|
|
20
|
+
result: oPlanResult | undefined;
|
|
21
|
+
};
|
|
22
|
+
toCID(): Promise<CID>;
|
|
23
|
+
storePlan(): Promise<void>;
|
|
24
|
+
get agentHistory(): string;
|
|
25
|
+
searchPlans(): Promise<any>;
|
|
26
|
+
preflight(): Promise<void>;
|
|
27
|
+
extractResultFromAI(message: string): oPlanResult;
|
|
28
|
+
run(): Promise<oPlanResult>;
|
|
29
|
+
execute(): Promise<oPlanResult>;
|
|
30
|
+
handleNetworkChanges(): Promise<void>;
|
|
31
|
+
addReasoning(): Promise<void>;
|
|
32
|
+
postflight(response: oPlanResult): Promise<oPlanResult>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=o-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"o-plan.d.ts","sourceRoot":"","sources":["../../src/plan/o-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAqC,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,qBAAa,KAAK;IAOJ,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW;IANlD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,EAAE,CAAM;IACvB,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC;IAErB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;gBAER,MAAM,EAAE,WAAW;IAKlD,IAAI,MAAM,aAET;IAED,IAAI,QAAQ,yBAEX;IAED,IAAI,IAAI,4BAEP;IAED,UAAU,IAAI,GAAG;IAQjB,IAAI;IAIJ,MAAM;;;;;IAQA,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAUrB,SAAS;IAef,IAAI,YAAY,WAef;IAEK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAyB3B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAKhC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAoB3C,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IAoC3B,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAQ/B,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB7B,UAAU,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAc9D"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Logger, oAddress, oToolError } from '../';
|
|
2
|
+
import { CID } from 'multiformats/cid';
|
|
3
|
+
import * as json from 'multiformats/codecs/json';
|
|
4
|
+
import { sha256 } from 'multiformats/hashes/sha2';
|
|
5
|
+
import { AGENT_PROMPT } from './prompts/agent.prompt';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
export class oPlan {
|
|
8
|
+
config;
|
|
9
|
+
logger;
|
|
10
|
+
sequence = [];
|
|
11
|
+
cid;
|
|
12
|
+
result;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.logger = new Logger('oPlan:' + `[${this.config.intent}]`);
|
|
16
|
+
this.sequence = this.config.sequence || [];
|
|
17
|
+
}
|
|
18
|
+
get caller() {
|
|
19
|
+
return this.config.caller;
|
|
20
|
+
}
|
|
21
|
+
get receiver() {
|
|
22
|
+
return this.config.receiver;
|
|
23
|
+
}
|
|
24
|
+
get node() {
|
|
25
|
+
return this.config.currentNode;
|
|
26
|
+
}
|
|
27
|
+
toCIDInput() {
|
|
28
|
+
return {
|
|
29
|
+
intent: this.config.intent,
|
|
30
|
+
address: this.config.caller?.toString(),
|
|
31
|
+
context: this.config.context?.toString() || '',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
type() {
|
|
35
|
+
return 'unknown';
|
|
36
|
+
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
config: this.toCIDInput(),
|
|
40
|
+
sequence: this.sequence.map((s) => `o://plan/${s.cid?.toString()}`),
|
|
41
|
+
result: this.result,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async toCID() {
|
|
45
|
+
if (this.cid) {
|
|
46
|
+
return this.cid;
|
|
47
|
+
}
|
|
48
|
+
const bytes = json.encode(this.toCIDInput());
|
|
49
|
+
const hash = await sha256.digest(bytes);
|
|
50
|
+
const cid = CID.create(1, json.code, hash);
|
|
51
|
+
return cid;
|
|
52
|
+
}
|
|
53
|
+
async storePlan() {
|
|
54
|
+
this.logger.debug('Storing plan...');
|
|
55
|
+
const cid = await this.toCID();
|
|
56
|
+
const params = {
|
|
57
|
+
key: cid.toString(),
|
|
58
|
+
value: JSON.stringify(this.toJSON()),
|
|
59
|
+
};
|
|
60
|
+
this.logger.debug('Storing plan params: ', params);
|
|
61
|
+
await this.node.use(new oAddress('o://plan'), {
|
|
62
|
+
method: 'put',
|
|
63
|
+
params: params,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
get agentHistory() {
|
|
67
|
+
return (this.sequence
|
|
68
|
+
?.map((s, index) => `[Cycle ${index + 1} Begin]\n${JSON.stringify({
|
|
69
|
+
...s.result,
|
|
70
|
+
}, null, 2)} \n[Cycle ${index + 1} End]`)
|
|
71
|
+
.join('\n') || '');
|
|
72
|
+
}
|
|
73
|
+
async searchPlans() {
|
|
74
|
+
this.logger.debug('Searching for plans...');
|
|
75
|
+
const cid = await this.toCID();
|
|
76
|
+
const response = await this.node.use(new oAddress('o://plan'), {
|
|
77
|
+
method: 'get',
|
|
78
|
+
params: {
|
|
79
|
+
key: cid.toString(),
|
|
80
|
+
},
|
|
81
|
+
}, {
|
|
82
|
+
noIndex: true,
|
|
83
|
+
});
|
|
84
|
+
this.logger.debug('Search plans response: ', response);
|
|
85
|
+
const result = response.result;
|
|
86
|
+
const json = typeof result.data === 'string'
|
|
87
|
+
? JSON.parse(result.data)
|
|
88
|
+
: result.data;
|
|
89
|
+
return json;
|
|
90
|
+
}
|
|
91
|
+
async preflight() {
|
|
92
|
+
this.logger.debug('Preflight...');
|
|
93
|
+
this.cid = await this.toCID();
|
|
94
|
+
}
|
|
95
|
+
extractResultFromAI(message) {
|
|
96
|
+
this.logger.debug('Extracting result from AI: ', message);
|
|
97
|
+
const matches = message.match(/\{(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{[^{}]*\})*\})*\})*\})*\}/);
|
|
98
|
+
if (!matches || matches.length === 0) {
|
|
99
|
+
throw new Error('AI failed to return a valid JSON object');
|
|
100
|
+
}
|
|
101
|
+
const json = matches[0];
|
|
102
|
+
this.logger.debug('[AGENT PLAN] Analysis result: ', json);
|
|
103
|
+
const planResult = JSON.parse(json);
|
|
104
|
+
return planResult;
|
|
105
|
+
}
|
|
106
|
+
async run() {
|
|
107
|
+
this.logger.debug('Running plan...');
|
|
108
|
+
const ctxt = this.config.context?.toString() || '';
|
|
109
|
+
this.logger.debug('Agent history: ', this.agentHistory);
|
|
110
|
+
let prompt = null;
|
|
111
|
+
if (this.config.promptFunction) {
|
|
112
|
+
this.logger.debug('Using prompt function: ', this.config.promptFunction);
|
|
113
|
+
prompt = this.config.promptFunction(this.config.intent, ctxt, this.agentHistory);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
prompt = AGENT_PROMPT(this.config.intent, ctxt, this.agentHistory);
|
|
117
|
+
}
|
|
118
|
+
this.logger.debug('Prompt: ', prompt);
|
|
119
|
+
const response = await this.node.use(new oAddress('o://intelligence'), {
|
|
120
|
+
method: 'prompt',
|
|
121
|
+
params: {
|
|
122
|
+
prompt: prompt,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (response.result.error) {
|
|
126
|
+
this.logger.error('Error in plan: ', response.result.error);
|
|
127
|
+
const error = response.result.error;
|
|
128
|
+
throw new oToolError(error.code, error.message);
|
|
129
|
+
}
|
|
130
|
+
const data = response.result.data;
|
|
131
|
+
const message = data.message;
|
|
132
|
+
const planResult = this.extractResultFromAI(message);
|
|
133
|
+
return planResult;
|
|
134
|
+
}
|
|
135
|
+
async execute() {
|
|
136
|
+
this.logger.debug('Executing...');
|
|
137
|
+
await this.preflight();
|
|
138
|
+
this.result = await this.run();
|
|
139
|
+
return this.postflight(this.result);
|
|
140
|
+
}
|
|
141
|
+
async handleNetworkChanges() {
|
|
142
|
+
const cid = await this.toCID();
|
|
143
|
+
await this.node.use(new oAddress('o://leader'), {
|
|
144
|
+
method: 'save_plan',
|
|
145
|
+
params: {
|
|
146
|
+
plan: `o://plan/${cid}`,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async addReasoning() {
|
|
151
|
+
if (this.result?.reasoning) {
|
|
152
|
+
this.logger.debug('Adding knowledge: ', this.result?.reasoning);
|
|
153
|
+
await this.node.use(new oAddress('o://vector-store'), {
|
|
154
|
+
method: 'add_documents',
|
|
155
|
+
params: {
|
|
156
|
+
documents: [
|
|
157
|
+
{
|
|
158
|
+
pageContent: this.result?.reasoning,
|
|
159
|
+
metadata: {
|
|
160
|
+
address: this.caller?.toString(),
|
|
161
|
+
id: uuidv4(),
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async postflight(response) {
|
|
170
|
+
this.logger.debug('Postflight...');
|
|
171
|
+
try {
|
|
172
|
+
await this.storePlan();
|
|
173
|
+
this.logger.debug('Saving plan...', response);
|
|
174
|
+
await this.addReasoning();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
this.logger.error('Error in postflight: ', error);
|
|
178
|
+
}
|
|
179
|
+
return response;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=o-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"o-plan.js","sourceRoot":"","sources":["../../src/plan/o-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAa,UAAU,EAAc,MAAM,KAAK,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,E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