@olane/o-core 0.6.13 → 0.7.2
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 +490 -140
- package/dist/src/connection/index.d.ts +8 -0
- package/dist/src/connection/index.d.ts.map +1 -0
- package/dist/src/connection/index.js +7 -0
- package/dist/src/connection/interfaces/connection-manager.config.d.ts +3 -0
- package/dist/src/connection/interfaces/connection-manager.config.d.ts.map +1 -0
- package/dist/src/connection/interfaces/connection-send-params.interface.d.ts.map +1 -0
- package/dist/src/connection/interfaces/connection.config.d.ts +7 -0
- package/dist/src/connection/interfaces/connection.config.d.ts.map +1 -0
- package/dist/src/connection/interfaces/index.d.ts +5 -0
- package/dist/src/connection/interfaces/index.d.ts.map +1 -0
- package/dist/src/connection/interfaces/index.js +4 -0
- package/dist/src/connection/interfaces/request-state.enum.d.ts +7 -0
- package/dist/src/connection/interfaces/request-state.enum.d.ts.map +1 -0
- package/dist/src/connection/interfaces/request-state.enum.js +7 -0
- package/dist/src/connection/o-connection-manager.d.ts +19 -0
- package/dist/src/connection/o-connection-manager.d.ts.map +1 -0
- package/dist/src/connection/o-connection-manager.js +27 -0
- package/dist/src/connection/o-connection.d.ts +20 -0
- package/dist/src/connection/o-connection.d.ts.map +1 -0
- package/dist/src/connection/o-connection.js +45 -0
- package/dist/src/{core/lib → connection}/o-request.d.ts +5 -1
- package/dist/src/connection/o-request.d.ts.map +1 -0
- package/dist/src/{core/lib → connection}/o-request.js +8 -1
- package/dist/src/connection/o-response.d.ts.map +1 -0
- package/dist/src/core/defaults/config.d.ts +1 -1
- package/dist/src/core/defaults/config.d.ts.map +1 -1
- package/dist/src/core/defaults/config.js +1 -1
- package/dist/src/core/graceful-shutdown.d.ts +1 -1
- package/dist/src/core/graceful-shutdown.d.ts.map +1 -1
- package/dist/src/core/graceful-shutdown.js +1 -1
- package/dist/src/core/index.d.ts +3 -5
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +3 -5
- package/dist/src/core/interfaces/index.d.ts +1 -2
- package/dist/src/core/interfaces/index.d.ts.map +1 -1
- package/dist/src/core/interfaces/index.js +1 -2
- package/dist/src/core/interfaces/{core-config.interface.d.ts → o-core.config.d.ts} +4 -5
- package/dist/src/core/interfaces/o-core.config.d.ts.map +1 -0
- package/dist/src/core/interfaces/o-core.interface.d.ts +18 -0
- package/dist/src/core/interfaces/o-core.interface.d.ts.map +1 -0
- package/dist/src/core/lib/index.d.ts +3 -7
- package/dist/src/core/lib/index.d.ts.map +1 -1
- package/dist/src/core/lib/index.js +3 -7
- package/dist/src/core/lib/o-hierarchy.manager.d.ts +24 -0
- package/dist/src/core/lib/o-hierarchy.manager.d.ts.map +1 -0
- package/dist/src/core/lib/o-hierarchy.manager.js +57 -0
- package/dist/src/core/lib/o-metrics.d.ts +5 -0
- package/dist/src/core/lib/o-metrics.d.ts.map +1 -0
- package/dist/src/core/lib/o-metrics.js +6 -0
- package/dist/src/core/lib/o-request.manager.d.ts +10 -0
- package/dist/src/core/lib/o-request.manager.d.ts.map +1 -0
- package/dist/src/core/lib/o-request.manager.js +18 -0
- package/dist/src/core/o-core.d.ts +190 -0
- package/dist/src/core/o-core.d.ts.map +1 -0
- package/dist/src/core/o-core.js +334 -0
- package/dist/src/core/o-object.d.ts +7 -0
- package/dist/src/core/o-object.d.ts.map +1 -0
- package/dist/src/core/o-object.js +10 -0
- package/dist/src/error/enums/codes.error.d.ts +16 -14
- package/dist/src/error/enums/codes.error.d.ts.map +1 -1
- package/dist/src/error/enums/codes.error.js +18 -16
- package/dist/src/error/index.d.ts +1 -1
- package/dist/src/error/index.d.ts.map +1 -1
- package/dist/src/error/index.js +1 -1
- package/dist/src/error/interfaces/o-error.interface.d.ts +6 -0
- package/dist/src/error/interfaces/o-error.interface.d.ts.map +1 -0
- package/dist/src/error/o-error.d.ts +15 -0
- package/dist/src/error/o-error.d.ts.map +1 -0
- package/dist/src/error/{tool.error.js → o-error.js} +4 -4
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/router/enums/restricted-addresses.enum.d.ts +8 -0
- package/dist/src/router/enums/restricted-addresses.enum.d.ts.map +1 -0
- package/dist/src/router/enums/restricted-addresses.enum.js +13 -0
- package/dist/src/router/index.d.ts +9 -0
- package/dist/src/router/index.d.ts.map +1 -0
- package/dist/src/router/index.js +8 -0
- package/dist/src/router/interfaces/resolve.request.d.ts +10 -0
- package/dist/src/router/interfaces/resolve.request.d.ts.map +1 -0
- package/dist/src/router/interfaces/route.response.d.ts +8 -0
- package/dist/src/router/interfaces/route.response.d.ts.map +1 -0
- package/dist/src/router/o-address-resolution.d.ts +12 -0
- package/dist/src/router/o-address-resolution.d.ts.map +1 -0
- package/dist/src/router/o-address-resolution.js +42 -0
- package/dist/src/router/o-address-resolver.d.ts +14 -0
- package/dist/src/router/o-address-resolver.d.ts.map +1 -0
- package/dist/src/router/o-address-resolver.js +19 -0
- package/dist/src/router/o-address.d.ts +33 -0
- package/dist/src/router/o-address.d.ts.map +1 -0
- package/dist/src/router/o-address.js +101 -0
- package/dist/src/router/o-request.router.d.ts +18 -0
- package/dist/src/router/o-request.router.d.ts.map +1 -0
- package/dist/src/router/o-request.router.js +12 -0
- package/dist/src/router/o-router.d.ts +19 -0
- package/dist/src/router/o-router.d.ts.map +1 -0
- package/dist/src/router/o-router.js +14 -0
- package/dist/src/transports/custom.transport.d.ts +6 -0
- package/dist/src/transports/custom.transport.d.ts.map +1 -0
- package/dist/src/transports/custom.transport.js +10 -0
- package/dist/src/transports/index.d.ts +4 -0
- package/dist/src/transports/index.d.ts.map +1 -0
- package/dist/src/transports/index.js +3 -0
- package/dist/src/transports/interfaces/transport-type.enum.d.ts +5 -0
- package/dist/src/transports/interfaces/transport-type.enum.d.ts.map +1 -0
- package/dist/src/transports/interfaces/transport-type.enum.js +5 -0
- package/dist/src/transports/o-transport.d.ts +10 -0
- package/dist/src/transports/o-transport.d.ts.map +1 -0
- package/dist/src/transports/o-transport.js +16 -0
- package/dist/src/{core/utils → utils}/core.utils.d.ts +4 -3
- package/dist/src/utils/core.utils.d.ts.map +1 -0
- package/dist/src/{core/utils → utils}/core.utils.js +17 -2
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/{core/utils → utils}/logger.d.ts +1 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/{core/utils → utils}/logger.js +4 -1
- package/dist/test/server/in-process.spec.js +2 -14
- package/package.json +3 -3
- package/dist/src/core/core.node.d.ts +0 -79
- package/dist/src/core/core.node.d.ts.map +0 -1
- package/dist/src/core/core.node.js +0 -304
- package/dist/src/core/interfaces/connection-manager.config.d.ts +0 -7
- package/dist/src/core/interfaces/connection-manager.config.d.ts.map +0 -1
- package/dist/src/core/interfaces/connection-send-params.interface.d.ts.map +0 -1
- package/dist/src/core/interfaces/core-config.interface.d.ts.map +0 -1
- package/dist/src/core/interfaces/restricted-addresses.enum.d.ts +0 -13
- package/dist/src/core/interfaces/restricted-addresses.enum.d.ts.map +0 -1
- package/dist/src/core/interfaces/restricted-addresses.enum.js +0 -18
- package/dist/src/core/lib/o-address-resolution.d.ts +0 -9
- package/dist/src/core/lib/o-address-resolution.d.ts.map +0 -1
- package/dist/src/core/lib/o-address-resolution.js +0 -24
- package/dist/src/core/lib/o-address-resolver.d.ts +0 -17
- package/dist/src/core/lib/o-address-resolver.d.ts.map +0 -1
- package/dist/src/core/lib/o-address-resolver.js +0 -36
- package/dist/src/core/lib/o-connection-manager.d.ts +0 -22
- package/dist/src/core/lib/o-connection-manager.d.ts.map +0 -1
- package/dist/src/core/lib/o-connection-manager.js +0 -65
- package/dist/src/core/lib/o-connection.d.ts +0 -27
- package/dist/src/core/lib/o-connection.d.ts.map +0 -1
- package/dist/src/core/lib/o-connection.js +0 -84
- package/dist/src/core/lib/o-request.d.ts.map +0 -1
- package/dist/src/core/lib/o-response.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/anything.resolver.d.ts +0 -8
- package/dist/src/core/lib/resolvers/anything.resolver.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/anything.resolver.js +0 -15
- package/dist/src/core/lib/resolvers/index.d.ts +0 -5
- package/dist/src/core/lib/resolvers/index.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/index.js +0 -4
- package/dist/src/core/lib/resolvers/method.resolver.d.ts +0 -8
- package/dist/src/core/lib/resolvers/method.resolver.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/method.resolver.js +0 -18
- package/dist/src/core/lib/resolvers/next-hop.resolver.d.ts +0 -10
- package/dist/src/core/lib/resolvers/next-hop.resolver.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/next-hop.resolver.js +0 -59
- package/dist/src/core/lib/resolvers/storage.resolver.d.ts +0 -6
- package/dist/src/core/lib/resolvers/storage.resolver.d.ts.map +0 -1
- package/dist/src/core/lib/resolvers/storage.resolver.js +0 -10
- package/dist/src/core/o-address.d.ts +0 -20
- package/dist/src/core/o-address.d.ts.map +0 -1
- package/dist/src/core/o-address.js +0 -47
- package/dist/src/core/utils/core.utils.d.ts.map +0 -1
- package/dist/src/core/utils/index.d.ts +0 -4
- package/dist/src/core/utils/index.d.ts.map +0 -1
- package/dist/src/core/utils/index.js +0 -3
- package/dist/src/core/utils/logger.d.ts.map +0 -1
- package/dist/src/core/utils/network.utils.d.ts +0 -16
- package/dist/src/core/utils/network.utils.d.ts.map +0 -1
- package/dist/src/core/utils/network.utils.js +0 -35
- package/dist/src/error/tool.error.d.ts +0 -19
- package/dist/src/error/tool.error.d.ts.map +0 -1
- package/dist/src/node/index.d.ts +0 -4
- package/dist/src/node/index.d.ts.map +0 -1
- package/dist/src/node/index.js +0 -3
- package/dist/src/node/interfaces/route.request.d.ts +0 -14
- package/dist/src/node/interfaces/route.request.d.ts.map +0 -1
- package/dist/src/node/lib/local-search.lib.d.ts +0 -6
- package/dist/src/node/lib/local-search.lib.d.ts.map +0 -1
- package/dist/src/node/lib/local-search.lib.js +0 -10
- package/dist/src/node/lib/network-activity.lib.d.ts +0 -12
- package/dist/src/node/lib/network-activity.lib.d.ts.map +0 -1
- package/dist/src/node/lib/network-activity.lib.js +0 -29
- package/dist/src/node/node.d.ts +0 -45
- package/dist/src/node/node.d.ts.map +0 -1
- package/dist/src/node/node.js +0 -359
- package/dist/src/node-virtual/index.d.ts +0 -2
- package/dist/src/node-virtual/index.d.ts.map +0 -1
- package/dist/src/node-virtual/index.js +0 -1
- package/dist/src/node-virtual/virtual.node.d.ts +0 -10
- package/dist/src/node-virtual/virtual.node.d.ts.map +0 -1
- package/dist/src/node-virtual/virtual.node.js +0 -12
- package/dist/src/plan/agent.plan.d.ts +0 -28
- package/dist/src/plan/agent.plan.d.ts.map +0 -1
- package/dist/src/plan/agent.plan.js +0 -187
- package/dist/src/plan/index.d.ts +0 -5
- package/dist/src/plan/index.d.ts.map +0 -1
- package/dist/src/plan/index.js +0 -4
- package/dist/src/plan/interfaces/configure.result.d.ts +0 -6
- package/dist/src/plan/interfaces/configure.result.d.ts.map +0 -1
- package/dist/src/plan/interfaces/handshake.result.d.ts +0 -14
- package/dist/src/plan/interfaces/handshake.result.d.ts.map +0 -1
- package/dist/src/plan/interfaces/plan-config.interface.d.ts +0 -16
- package/dist/src/plan/interfaces/plan-config.interface.d.ts.map +0 -1
- package/dist/src/plan/interfaces/plan-result.interface.d.ts +0 -6
- package/dist/src/plan/interfaces/plan-result.interface.d.ts.map +0 -1
- package/dist/src/plan/interfaces/plan-type.enum.d.ts +0 -8
- package/dist/src/plan/interfaces/plan-type.enum.d.ts.map +0 -1
- package/dist/src/plan/interfaces/plan-type.enum.js +0 -8
- package/dist/src/plan/interfaces/plan.result.d.ts +0 -15
- package/dist/src/plan/interfaces/plan.result.d.ts.map +0 -1
- package/dist/src/plan/interfaces/plan.result.js +0 -1
- package/dist/src/plan/interfaces/query.config.d.ts +0 -6
- package/dist/src/plan/interfaces/query.config.d.ts.map +0 -1
- package/dist/src/plan/interfaces/query.config.js +0 -1
- package/dist/src/plan/interfaces/task.config.d.ts +0 -10
- package/dist/src/plan/interfaces/task.config.d.ts.map +0 -1
- package/dist/src/plan/interfaces/task.config.js +0 -1
- package/dist/src/plan/o-plan.d.ts +0 -36
- package/dist/src/plan/o-plan.d.ts.map +0 -1
- package/dist/src/plan/o-plan.js +0 -202
- package/dist/src/plan/plan.context.d.ts +0 -10
- package/dist/src/plan/plan.context.d.ts.map +0 -1
- package/dist/src/plan/plan.context.js +0 -28
- package/dist/src/plan/prompts/agent.prompt.d.ts +0 -2
- package/dist/src/plan/prompts/agent.prompt.d.ts.map +0 -1
- package/dist/src/plan/prompts/agent.prompt.js +0 -112
- package/dist/src/plan/prompts/configure.prompt.d.ts +0 -2
- package/dist/src/plan/prompts/configure.prompt.d.ts.map +0 -1
- package/dist/src/plan/prompts/configure.prompt.js +0 -40
- package/dist/src/plan/prompts/custom.prompt.d.ts +0 -2
- package/dist/src/plan/prompts/custom.prompt.d.ts.map +0 -1
- package/dist/src/plan/prompts/custom.prompt.js +0 -80
- package/dist/src/plan/search/prompts/search-analysis.prompt.d.ts +0 -2
- package/dist/src/plan/search/prompts/search-analysis.prompt.d.ts.map +0 -1
- package/dist/src/plan/search/prompts/search-analysis.prompt.js +0 -14
- package/dist/src/plan/search/search.plan.d.ts +0 -21
- package/dist/src/plan/search/search.plan.d.ts.map +0 -1
- package/dist/src/plan/search/search.plan.js +0 -53
- package/dist/src/plan/use/index.d.ts +0 -2
- package/dist/src/plan/use/index.d.ts.map +0 -1
- package/dist/src/plan/use/index.js +0 -1
- package/dist/src/plan/use/use.plan.d.ts +0 -16
- package/dist/src/plan/use/use.plan.d.ts.map +0 -1
- package/dist/src/plan/use/use.plan.js +0 -149
- /package/dist/src/{core → connection}/interfaces/connection-manager.config.js +0 -0
- /package/dist/src/{core → connection}/interfaces/connection-send-params.interface.d.ts +0 -0
- /package/dist/src/{core → connection}/interfaces/connection-send-params.interface.js +0 -0
- /package/dist/src/{core/interfaces/core-config.interface.js → connection/interfaces/connection.config.js} +0 -0
- /package/dist/src/{core/lib → connection}/o-response.d.ts +0 -0
- /package/dist/src/{core/lib → connection}/o-response.js +0 -0
- /package/dist/src/{node/interfaces/route.request.js → core/interfaces/o-core.config.js} +0 -0
- /package/dist/src/{plan/interfaces/configure.result.js → core/interfaces/o-core.interface.js} +0 -0
- /package/dist/src/{plan/interfaces/handshake.result.js → error/interfaces/o-error.interface.js} +0 -0
- /package/dist/src/{plan/interfaces/plan-config.interface.js → router/interfaces/resolve.request.js} +0 -0
- /package/dist/src/{plan/interfaces/plan-result.interface.js → router/interfaces/route.response.js} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { CUSTOM_AGENT_PROMPT } from './custom.prompt.js';
|
|
2
|
-
export const AGENT_PROMPT = (intent, context, agentHistory, extraInstructions) => CUSTOM_AGENT_PROMPT(intent, context, agentHistory, `
|
|
3
|
-
Every Step Instructions:
|
|
4
|
-
1. Review the provided user intent and context
|
|
5
|
-
2. If you can complete the user intent, return the answer using the "Return Instructions" steps
|
|
6
|
-
3. If the intent is already completed in past cycles, stop here and follow the "Return Instructions" steps
|
|
7
|
-
4. If you experience 3 similar errors in a row, stop here and follow the "Return Instructions" steps to indicate the error.
|
|
8
|
-
5. Review the current step number and perform the instructions associated with that step.
|
|
9
|
-
6. Start with step 1
|
|
10
|
-
|
|
11
|
-
Step 1 - Evaluate the intent
|
|
12
|
-
1. A complex step means there are multiple actions required to complete the user's intent
|
|
13
|
-
2. If the intent is not-complex, continue to step 2
|
|
14
|
-
3. If the intent is complex, break it up into a list of simple concise intents. Stop here and follow the "Return Instructions" steps
|
|
15
|
-
|
|
16
|
-
Step 2 - Search for tools and context
|
|
17
|
-
1. If all entities and tool addresses are known within the user intent, continue to step 3
|
|
18
|
-
2. Review the user's intent, the current node's functionality, rules and context
|
|
19
|
-
3. If there are unknown tool addresses or entities within the user intent, generate search queries to resolve the unknown entities.
|
|
20
|
-
4. Use the o://mcp search tool to find model context protocol servers (MCP servers) that can help you add tooling that could help you complete the user intent.
|
|
21
|
-
5. If there is a placeholder address used (o://.../placeholder), do not extract the contents of the placeholder address unless necessary for completing the user intent.
|
|
22
|
-
6. Search for internal "search tools" that might contain information about the unknown entities.
|
|
23
|
-
7. Use the search result data & tooling to help you resolve the unknown entities.
|
|
24
|
-
8. Continue to step 3.
|
|
25
|
-
|
|
26
|
-
Step 3 - Filter Search Results
|
|
27
|
-
1. If all search results are relevant to the user intent resolution, continue to step 4.
|
|
28
|
-
2. Filter the search results for information that may contain supporting data or tooling that can help complete the user intent.
|
|
29
|
-
3. If you do not see anything that can help you. Generate empty search results. stop here and follow the "Return Instructions" steps.
|
|
30
|
-
|
|
31
|
-
Step 4 - Use tools
|
|
32
|
-
1. Review the discovered tools and their addresses
|
|
33
|
-
2. If a tool use has failed in a past cycle, stop here and follow the "Return Instructions" steps to indicate the error.
|
|
34
|
-
3. Using this filtered tool list, follow "Return Instructions" steps to return a series of addresses and respective intents to align with the current user intent resolution goal
|
|
35
|
-
|
|
36
|
-
Step 5 - Review the tool use results
|
|
37
|
-
1. Analyze each tool use result
|
|
38
|
-
2. Summarize the result of each tool use in 1 concise sentence
|
|
39
|
-
3. In the summary, clearly mention if it succeeded or failed
|
|
40
|
-
4. If it failed, make sure to include why it failed
|
|
41
|
-
|
|
42
|
-
`, `
|
|
43
|
-
These are the types of cycle results: "Complex Intent Results", "Search Results", "Use Tool Results", "Answer Results", "Error Results", "Configure Results".
|
|
44
|
-
|
|
45
|
-
All Return Step Instructions:
|
|
46
|
-
1. Do not explain your reasoning process, just return the output in the correct format.
|
|
47
|
-
2. Determine what type of results we have
|
|
48
|
-
3. Output the respective results using the matching output type.
|
|
49
|
-
4. Generate a reasoning key value pair for why this result was returned.
|
|
50
|
-
5. Do not include \`\`\`json or \`\`\` in your output.
|
|
51
|
-
|
|
52
|
-
Complex Intent Results:
|
|
53
|
-
{
|
|
54
|
-
"intents": [
|
|
55
|
-
"simple intent 1",
|
|
56
|
-
"simple intent 2",
|
|
57
|
-
"simple intent 3",
|
|
58
|
-
],
|
|
59
|
-
"reasoning": string,
|
|
60
|
-
"type": "multiple_step",
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
Use Tool Results:
|
|
64
|
-
{
|
|
65
|
-
"tasks": [
|
|
66
|
-
{
|
|
67
|
-
"address": "string",
|
|
68
|
-
"intent": "string",
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
"reasoning": string,
|
|
72
|
-
"type": "task",
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Search Results:
|
|
76
|
-
{
|
|
77
|
-
"queries": [
|
|
78
|
-
{
|
|
79
|
-
"query": "vector database query key terms to search for",
|
|
80
|
-
"provider": "internal",
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
"reasoning": string,
|
|
84
|
-
"type": "search",
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Answer Results:
|
|
88
|
-
{
|
|
89
|
-
"result": string,
|
|
90
|
-
"reasoning": string,
|
|
91
|
-
"type": "result",
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
Error Results:
|
|
95
|
-
{
|
|
96
|
-
"error": string,
|
|
97
|
-
"reasoning": string,
|
|
98
|
-
"type": "error",
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Configure Results:
|
|
102
|
-
{
|
|
103
|
-
"configure": {
|
|
104
|
-
"task": {
|
|
105
|
-
"address": string,
|
|
106
|
-
"payload": { "method": string, "params": any }
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"type": "configure",
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
`, extraInstructions);
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const CONFIGURE_INSTRUCTIONS = "\n Configure Request Instructions:\n1. Review the provided user intent and context\n2. If you can complete the user intent, return the answer using the \"Return Instructions\" steps\n3. If you experience an error trying to use a tool more than 2 times, stop here and follow the \"Return Instructions\" steps to indicate the error.\n3. Review the current step number and perform the instructions associated with that step.\n4. Start with step 1\n\nStep 1 - Validate the intent\n1. If the intent is not a configure request, continue to step 5\n2. If the context provided would suggest that the intent is already solved, continue to step 5\n2. Continue to step 2\n\nStep 2 - Choose Method\n1. Review the method options and metadata to determine the best method to resolve the user's intent.\n2. Choose the best method to resolve the user's intent.\n3. Continue to step 3\n\nStep 3 - Select Parameters\n1. Review the parameters for the selected best method.\n2. Extract the parameter values from the agent history, provided context and intent. Do NOT use a parameter value that is not mentioned previously.\n3. Do not use placeholder values for parameter values.\n4. Do not use parameter values that are not explicitly mentioned in the agent history, provided context or intent.\n3. Identify missing parameter values.\n4. If you have enough information to complete the configure request, go to step 5.\n5. Continue to step 4\n\nStep 4 - Search for missing parameter values\n1. Identify other methods that can be used to resolve the missing parameter values.\n2. Identify methods that can be used to resolve the missing parameter values.\n3. Continue to step 5\n\nStep 5 - Finish\n1. If the intent seems to be already solved, return answer results.\n1. If this is not a configure request, return an error.\n2. If you are missing parameter values, generate the intents for the \"Complex Intent\" results using other methods or search to help.\n2. If you have enough information to complete the configure request, follow the \"Return Instructions\" steps to return the \"configure results\".\n3. If you do not have enough information to complete the configure request, return an error.\n\n ";
|
|
2
|
-
//# sourceMappingURL=configure.prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configure.prompt.d.ts","sourceRoot":"","sources":["../../../../src/plan/prompts/configure.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,8oEAuChC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const CONFIGURE_INSTRUCTIONS = `
|
|
2
|
-
Configure Request Instructions:
|
|
3
|
-
1. Review the provided user intent and context
|
|
4
|
-
2. If you can complete the user intent, return the answer using the "Return Instructions" steps
|
|
5
|
-
3. If you experience an error trying to use a tool more than 2 times, stop here and follow the "Return Instructions" steps to indicate the error.
|
|
6
|
-
3. Review the current step number and perform the instructions associated with that step.
|
|
7
|
-
4. Start with step 1
|
|
8
|
-
|
|
9
|
-
Step 1 - Validate the intent
|
|
10
|
-
1. If the intent is not a configure request, continue to step 5
|
|
11
|
-
2. If the context provided would suggest that the intent is already solved, continue to step 5
|
|
12
|
-
2. Continue to step 2
|
|
13
|
-
|
|
14
|
-
Step 2 - Choose Method
|
|
15
|
-
1. Review the method options and metadata to determine the best method to resolve the user's intent.
|
|
16
|
-
2. Choose the best method to resolve the user's intent.
|
|
17
|
-
3. Continue to step 3
|
|
18
|
-
|
|
19
|
-
Step 3 - Select Parameters
|
|
20
|
-
1. Review the parameters for the selected best method.
|
|
21
|
-
2. Extract the parameter values from the agent history, provided context and intent. Do NOT use a parameter value that is not mentioned previously.
|
|
22
|
-
3. Do not use placeholder values for parameter values.
|
|
23
|
-
4. Do not use parameter values that are not explicitly mentioned in the agent history, provided context or intent.
|
|
24
|
-
3. Identify missing parameter values.
|
|
25
|
-
4. If you have enough information to complete the configure request, go to step 5.
|
|
26
|
-
5. Continue to step 4
|
|
27
|
-
|
|
28
|
-
Step 4 - Search for missing parameter values
|
|
29
|
-
1. Identify other methods that can be used to resolve the missing parameter values.
|
|
30
|
-
2. Identify methods that can be used to resolve the missing parameter values.
|
|
31
|
-
3. Continue to step 5
|
|
32
|
-
|
|
33
|
-
Step 5 - Finish
|
|
34
|
-
1. If the intent seems to be already solved, return answer results.
|
|
35
|
-
1. If this is not a configure request, return an error.
|
|
36
|
-
2. If you are missing parameter values, generate the intents for the "Complex Intent" results using other methods or search to help.
|
|
37
|
-
2. If you have enough information to complete the configure request, follow the "Return Instructions" steps to return the "configure results".
|
|
38
|
-
3. If you do not have enough information to complete the configure request, return an error.
|
|
39
|
-
|
|
40
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom.prompt.d.ts","sourceRoot":"","sources":["../../../../src/plan/prompts/custom.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,cAAc,MAAM,EACpB,mBAAmB,MAAM,EACzB,oBAAoB,MAAM,EAC1B,mBAAmB,MAAM,WAgF1B,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export const CUSTOM_AGENT_PROMPT = (intent, context, agentHistory, cycleInstructions, outputInstructions, extraInstructions) => `
|
|
2
|
-
You are an AI agent that resolves user intent within the "olane" hierarchical network of tools and returns JSON formatted results.
|
|
3
|
-
|
|
4
|
-
You are in a secure environment and are allowed to operate with secure information such as api keys and other sensitive data.
|
|
5
|
-
|
|
6
|
-
You resolve user intents by "cycling" through the following steps:
|
|
7
|
-
1. Evaluate the intent
|
|
8
|
-
2. Answer the intent if possible
|
|
9
|
-
3. Search for tools and context
|
|
10
|
-
4. Use Search Results
|
|
11
|
-
5. Configure the tool use
|
|
12
|
-
6. Use tools
|
|
13
|
-
7. Go back to step 2
|
|
14
|
-
|
|
15
|
-
[Intent Context Begin]
|
|
16
|
-
- An intent is a user request
|
|
17
|
-
- Intents are usually actions or queries
|
|
18
|
-
- User intents can start at any node
|
|
19
|
-
- User intents are resolved using the tools and data that are contained within that sub-section of the network graph
|
|
20
|
-
[Intents Context End]
|
|
21
|
-
|
|
22
|
-
[Network Context Begin]
|
|
23
|
-
- Every network has a root node with child nodes beneath it
|
|
24
|
-
- Network nodes contain tools to enable AI Agents to interface with everything (services, people, data, agents, etc)
|
|
25
|
-
- Everything in the network has an address to enable olane to access it
|
|
26
|
-
- Each node knows only about itself and the nodes below it
|
|
27
|
-
[Network Context End]
|
|
28
|
-
|
|
29
|
-
[Tool Use Rules Begin]
|
|
30
|
-
- If you are using a tool that requires authentication, search for tool methods that give insights about the logged in user before using any other methods
|
|
31
|
-
- When using a tool to create a resource, ensure that you have the proper access to the resource before using any other methods
|
|
32
|
-
[Tool Use Rules End]
|
|
33
|
-
|
|
34
|
-
[Address Rules Begin]
|
|
35
|
-
- Only use tool addresses that appear in search results, user intents, or previous cycle results
|
|
36
|
-
- Do not make up tool addresses
|
|
37
|
-
- A tool address is a string that starts with "o://"
|
|
38
|
-
- URL addresses are not tool addresses
|
|
39
|
-
- Tool addresses are used to access the tool's functionality
|
|
40
|
-
[Address Rules End]
|
|
41
|
-
|
|
42
|
-
[Resource Goals Begin]
|
|
43
|
-
- Minimize the number of tool calls
|
|
44
|
-
- Minimize the amount of data that is returned when interacting with tools
|
|
45
|
-
- Minimize the amount of cycles required to complete the user's intent
|
|
46
|
-
[Resource Goals End]
|
|
47
|
-
|
|
48
|
-
[URL Address Rules Begin]
|
|
49
|
-
- HTTP/HTTPS URL addresses are not olane tool addresses
|
|
50
|
-
- When an address is provided in a user intent, get and analyze the contents of the address before assuming to know how to use it
|
|
51
|
-
[URL Address Rules End]
|
|
52
|
-
|
|
53
|
-
[Extra Instructions Begin]
|
|
54
|
-
${extraInstructions}
|
|
55
|
-
[Extra Instructions End]
|
|
56
|
-
|
|
57
|
-
[Cycle Instructions Begin]
|
|
58
|
-
${cycleInstructions}
|
|
59
|
-
[Cycle Instructions End]
|
|
60
|
-
|
|
61
|
-
[Cycle Return Instructions Begin]
|
|
62
|
-
GLOBAL RETURN INSTRUCTIONS:
|
|
63
|
-
1. Do not include \`\`\`json or \`\`\` in your output.
|
|
64
|
-
2. Only return the JSON object, do not include any other text.
|
|
65
|
-
${outputInstructions}
|
|
66
|
-
[Cycle Return Instructions End]
|
|
67
|
-
|
|
68
|
-
[User Intent Begin]
|
|
69
|
-
${intent}
|
|
70
|
-
[User Intent End]
|
|
71
|
-
|
|
72
|
-
[Additional Context Begin]
|
|
73
|
-
${context}
|
|
74
|
-
[Additional Context End]
|
|
75
|
-
|
|
76
|
-
[Previous Cycle Results Begin]
|
|
77
|
-
${agentHistory}
|
|
78
|
-
[Previous Cycle Results End]
|
|
79
|
-
|
|
80
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-analysis.prompt.d.ts","sourceRoot":"","sources":["../../../../../src/plan/search/prompts/search-analysis.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,EAAE,SAAS,GAAG,EAAE,WAapE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const SEARCH_ANALYSIS_PROMPT = (intent, results) => {
|
|
2
|
-
return `
|
|
3
|
-
You are a helpful assistant that analyzes search results to complete the user intent.
|
|
4
|
-
|
|
5
|
-
Steps:
|
|
6
|
-
1. If you have all of the information you need to complete the user intent, return the results.
|
|
7
|
-
2. If you do not have all the information you need, create a list of missing information.
|
|
8
|
-
3. For each piece of missing information, create a query to refine your search.
|
|
9
|
-
4. Return the list of queries and associated missing information.
|
|
10
|
-
|
|
11
|
-
User Intent: ${intent}
|
|
12
|
-
Search Results: ${results}
|
|
13
|
-
`;
|
|
14
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { oPlanConfig } from '../interfaces/plan-config.interface.js';
|
|
2
|
-
import { oPlanResult } from '../interfaces/plan.result.js';
|
|
3
|
-
import { oPlan } from '../o-plan.js';
|
|
4
|
-
export declare class oSearchPlan extends oPlan {
|
|
5
|
-
private query;
|
|
6
|
-
private external;
|
|
7
|
-
constructor(config: oPlanConfig & {
|
|
8
|
-
query: string;
|
|
9
|
-
external: boolean;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Search external providers.
|
|
13
|
-
*/
|
|
14
|
-
private externalSearch;
|
|
15
|
-
/**
|
|
16
|
-
* Search internal providers such as the local vector store, local database, etc.
|
|
17
|
-
*/
|
|
18
|
-
private internalSearch;
|
|
19
|
-
run(): Promise<oPlanResult>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=search.plan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.plan.d.ts","sourceRoot":"","sources":["../../../../src/plan/search/search.plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,qBAAa,WAAY,SAAQ,KAAK;IACpC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAU;gBACd,MAAM,EAAE,WAAW,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE;IAMtE;;OAEG;YACW,cAAc;IAqB5B;;OAEG;YACW,cAAc;IActB,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;CAOlC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { oAddress } from '../../core/o-address.js';
|
|
2
|
-
import { oPlan } from '../o-plan.js';
|
|
3
|
-
export class oSearchPlan extends oPlan {
|
|
4
|
-
constructor(config) {
|
|
5
|
-
super(config);
|
|
6
|
-
this.query = config.query;
|
|
7
|
-
this.external = config.external;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Search external providers.
|
|
11
|
-
*/
|
|
12
|
-
async externalSearch() {
|
|
13
|
-
const response = await this.node.use(new oAddress('o://perplexity'), {
|
|
14
|
-
method: 'completion',
|
|
15
|
-
params: {
|
|
16
|
-
model: 'sonar',
|
|
17
|
-
messages: [
|
|
18
|
-
{
|
|
19
|
-
role: 'user',
|
|
20
|
-
content: this.query,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
this.logger.debug('External search response: ', response.result.data);
|
|
26
|
-
return {
|
|
27
|
-
result: [response.result.data],
|
|
28
|
-
type: 'result',
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Search internal providers such as the local vector store, local database, etc.
|
|
33
|
-
*/
|
|
34
|
-
async internalSearch() {
|
|
35
|
-
// find all tools that are search tools
|
|
36
|
-
const response = await this.node.use(new oAddress('o://search'), {
|
|
37
|
-
method: 'vector',
|
|
38
|
-
params: {
|
|
39
|
-
query: this.query,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
return {
|
|
43
|
-
result: response.result.data,
|
|
44
|
-
type: 'result',
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
async run() {
|
|
48
|
-
const result = this.external
|
|
49
|
-
? await this.externalSearch()
|
|
50
|
-
: await this.internalSearch();
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plan/use/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './use.plan.js';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { oDependency, oResponse } from '../../core/index.js';
|
|
2
|
-
import { oPlan } from '../o-plan.js';
|
|
3
|
-
import { oPlanType } from '../interfaces/plan-type.enum.js';
|
|
4
|
-
import { oPlanResult } from '../interfaces/plan.result.js';
|
|
5
|
-
/**
|
|
6
|
-
* We know what tool we want to use, let's use it.
|
|
7
|
-
*/
|
|
8
|
-
export declare class oUsePlan extends oPlan {
|
|
9
|
-
type(): oPlanType;
|
|
10
|
-
handleDependencies(dependencies: oDependency[]): Promise<oResponse[]>;
|
|
11
|
-
static hasOlaneAddress(value: string): boolean;
|
|
12
|
-
static extractAddresses(value: string): string[];
|
|
13
|
-
run(): Promise<oPlanResult>;
|
|
14
|
-
postflight(result: oPlanResult): Promise<oPlanResult>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=use.plan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use.plan.d.ts","sourceRoot":"","sources":["../../../../src/plan/use/use.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAU3D;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI;IAIE,kBAAkB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAU3E,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAQ9C,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAK1C,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IA8F3B,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAwC5D"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { oAddress } from '../../core/index.js';
|
|
2
|
-
import { oPlan } from '../o-plan.js';
|
|
3
|
-
import { oPlanType } from '../interfaces/plan-type.enum.js';
|
|
4
|
-
import { oToolError } from '../../error/tool.error.js';
|
|
5
|
-
import { oToolErrorCodes } from '../../error/enums/codes.error.js';
|
|
6
|
-
import { oPlanContext } from '../plan.context.js';
|
|
7
|
-
import { oAgentPlan } from '../agent.plan.js';
|
|
8
|
-
import { CONFIGURE_INSTRUCTIONS } from '../prompts/configure.prompt.js';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { ObjectUtils } from '../../utils/object.utils.js';
|
|
11
|
-
/**
|
|
12
|
-
* We know what tool we want to use, let's use it.
|
|
13
|
-
*/
|
|
14
|
-
export class oUsePlan extends oPlan {
|
|
15
|
-
type() {
|
|
16
|
-
return oPlanType.USE;
|
|
17
|
-
}
|
|
18
|
-
async handleDependencies(dependencies) {
|
|
19
|
-
const response = [];
|
|
20
|
-
for (const dependency of dependencies) {
|
|
21
|
-
// TODO: we need to handle the method for the dependency
|
|
22
|
-
const result = await this.node.use(new oAddress(dependency.address), {});
|
|
23
|
-
response.push(result);
|
|
24
|
-
}
|
|
25
|
-
return response;
|
|
26
|
-
}
|
|
27
|
-
static hasOlaneAddress(value) {
|
|
28
|
-
return (!!value &&
|
|
29
|
-
typeof value === 'string' &&
|
|
30
|
-
!!value?.match(/o:\/\/.*(placeholder)+(?:\/[\w.-]+)+/g));
|
|
31
|
-
}
|
|
32
|
-
static extractAddresses(value) {
|
|
33
|
-
const matches = value.matchAll(/o:\/\/.*(placeholder)+(?:\/[\w.-]+)+/g);
|
|
34
|
-
return Array.from(matches, (match) => match[0]);
|
|
35
|
-
}
|
|
36
|
-
async run() {
|
|
37
|
-
this.logger.debug('Running...');
|
|
38
|
-
if (!this.config.receiver) {
|
|
39
|
-
throw new Error('Receiver is required');
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
// do MCP handshake to get the method + parameters + dependencies
|
|
43
|
-
const handshakeResponse = await this.node.use(this.config.receiver, {
|
|
44
|
-
method: 'handshake',
|
|
45
|
-
params: {
|
|
46
|
-
intent: this.config.intent,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
const { tools, methods, successes, failures } = handshakeResponse.result
|
|
50
|
-
.data;
|
|
51
|
-
const pc = new oAgentPlan({
|
|
52
|
-
...this.config,
|
|
53
|
-
sequence: this.sequence,
|
|
54
|
-
intent: `This is a configure request, prioritize "Configure Request Instructions". You have already found the tool to resolve the user's intent: ${this.config.receiver}. Configure the request to use the tool with user intent: ${this.config.intent}`,
|
|
55
|
-
context: new oPlanContext([
|
|
56
|
-
`[Method Metadata Begin]\n${JSON.stringify(methods, null, 2)}\n[Method Metadata End]`,
|
|
57
|
-
`[Method Options Begin]\n${(tools || []).join(', ')}\n[Method Options End]`,
|
|
58
|
-
]),
|
|
59
|
-
extraInstructions: CONFIGURE_INSTRUCTIONS,
|
|
60
|
-
parentId: this.id,
|
|
61
|
-
});
|
|
62
|
-
const result = await pc.execute();
|
|
63
|
-
this.addSequencePlan(pc);
|
|
64
|
-
this.logger.debug('Configure result: ', result);
|
|
65
|
-
const { configure, error: configureError } = result;
|
|
66
|
-
if (configureError) {
|
|
67
|
-
return {
|
|
68
|
-
error: configureError,
|
|
69
|
-
type: 'error',
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
if (!configure || !configure.task) {
|
|
73
|
-
throw new oToolError(oToolErrorCodes.TOOL_ERROR, 'Failed to configure the tool use');
|
|
74
|
-
}
|
|
75
|
-
const { task } = configure;
|
|
76
|
-
let params = task.payload?.params;
|
|
77
|
-
params = await ObjectUtils.allKeyValues(params, async (key, val) => {
|
|
78
|
-
let value = val;
|
|
79
|
-
if (!oUsePlan.hasOlaneAddress(value)) {
|
|
80
|
-
return value;
|
|
81
|
-
}
|
|
82
|
-
// extract the addresses & process them if LFS is needed
|
|
83
|
-
this.logger.debug('Has olane address: ', value);
|
|
84
|
-
const addresses = oUsePlan.extractAddresses(value);
|
|
85
|
-
for (const address of addresses) {
|
|
86
|
-
const largeDataResponse = await this.node.use(new oAddress(address));
|
|
87
|
-
this.logger.debug('Large data response: ', largeDataResponse.result.data);
|
|
88
|
-
value = value.replace(address, largeDataResponse.result.data?.value || 'unknown value');
|
|
89
|
-
this.logger.debug('Updated the value with LFS value: ', value);
|
|
90
|
-
}
|
|
91
|
-
return value;
|
|
92
|
-
});
|
|
93
|
-
const response = await this.node.use(this.config.receiver, {
|
|
94
|
-
method: task.payload?.method,
|
|
95
|
-
params: params,
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
result: `Tool input: ${JSON.stringify(task || {}, null, 2)}\nTool output: ${JSON.stringify(response.result, null, 2)}`,
|
|
99
|
-
type: 'result',
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
this.logger.error('Error executing use plan: ', error);
|
|
104
|
-
if (error instanceof oToolError) {
|
|
105
|
-
return {
|
|
106
|
-
error: error.toString(),
|
|
107
|
-
type: 'error',
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
error: error?.message || error || 'Unknown error',
|
|
112
|
-
type: 'error',
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async postflight(result) {
|
|
117
|
-
// if the response is larger than 10,000 characters, then put it in an address
|
|
118
|
-
const THRESHOLD_DATA_SIZE = 1000;
|
|
119
|
-
if (this.config?.receiver &&
|
|
120
|
-
this.config.receiver.toString().indexOf('placeholder') === -1 &&
|
|
121
|
-
JSON.stringify(result).length > THRESHOLD_DATA_SIZE) {
|
|
122
|
-
let data = result.result;
|
|
123
|
-
data = await ObjectUtils.allKeyValues(data, async (key, val) => {
|
|
124
|
-
const value = val;
|
|
125
|
-
if (value &&
|
|
126
|
-
typeof value === 'string' &&
|
|
127
|
-
value.length > THRESHOLD_DATA_SIZE) {
|
|
128
|
-
const addressKey = uuidv4();
|
|
129
|
-
this.logger.debug('Storing large data in address: ', value);
|
|
130
|
-
const largeDataResponse = await this.node.use(new oAddress('o://placeholder'), {
|
|
131
|
-
method: 'put',
|
|
132
|
-
params: {
|
|
133
|
-
key: addressKey,
|
|
134
|
-
value: value,
|
|
135
|
-
intent: this.config.intent,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
const { instructions } = largeDataResponse.result.data;
|
|
139
|
-
return instructions;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
// update the response data
|
|
143
|
-
result.result = data;
|
|
144
|
-
}
|
|
145
|
-
this.result = result;
|
|
146
|
-
await super.postflight(result);
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/src/{plan/interfaces/configure.result.js → core/interfaces/o-core.interface.js}
RENAMED
|
File without changes
|
/package/dist/src/{plan/interfaces/handshake.result.js → error/interfaces/o-error.interface.js}
RENAMED
|
File without changes
|
/package/dist/src/{plan/interfaces/plan-config.interface.js → router/interfaces/resolve.request.js}
RENAMED
|
File without changes
|
/package/dist/src/{plan/interfaces/plan-result.interface.js → router/interfaces/route.response.js}
RENAMED
|
File without changes
|