@olane/o-storage 0.6.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.
Files changed (68) hide show
  1. package/README.md +86 -0
  2. package/dist/src/index.d.ts +5 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +4 -0
  5. package/dist/src/interfaces/get-data.response.d.ts +4 -0
  6. package/dist/src/interfaces/get-data.response.d.ts.map +1 -0
  7. package/dist/src/interfaces/get-data.response.js +1 -0
  8. package/dist/src/interfaces/index.d.ts +6 -0
  9. package/dist/src/interfaces/index.d.ts.map +1 -0
  10. package/dist/src/interfaces/index.js +5 -0
  11. package/dist/src/interfaces/placeholder-put.request.d.ts +17 -0
  12. package/dist/src/interfaces/placeholder-put.request.d.ts.map +1 -0
  13. package/dist/src/interfaces/placeholder-put.request.js +7 -0
  14. package/dist/src/interfaces/placeholder-put.response.d.ts +8 -0
  15. package/dist/src/interfaces/placeholder-put.response.d.ts.map +1 -0
  16. package/dist/src/interfaces/placeholder-put.response.js +1 -0
  17. package/dist/src/interfaces/placeholder-value.interface.d.ts +6 -0
  18. package/dist/src/interfaces/placeholder-value.interface.d.ts.map +1 -0
  19. package/dist/src/interfaces/placeholder-value.interface.js +1 -0
  20. package/dist/src/interfaces/put.request.d.ts +16 -0
  21. package/dist/src/interfaces/put.request.d.ts.map +1 -0
  22. package/dist/src/interfaces/put.request.js +7 -0
  23. package/dist/src/methods/placeholder-storage.methods.d.ts +5 -0
  24. package/dist/src/methods/placeholder-storage.methods.d.ts.map +1 -0
  25. package/dist/src/methods/placeholder-storage.methods.js +32 -0
  26. package/dist/src/methods/storage.methods.d.ts +5 -0
  27. package/dist/src/methods/storage.methods.d.ts.map +1 -0
  28. package/dist/src/methods/storage.methods.js +65 -0
  29. package/dist/src/placeholder.tool.d.ts +10 -0
  30. package/dist/src/placeholder.tool.d.ts.map +1 -0
  31. package/dist/src/placeholder.tool.js +76 -0
  32. package/dist/src/providers/dht-storage-provider.tool.d.ts +12 -0
  33. package/dist/src/providers/dht-storage-provider.tool.d.ts.map +1 -0
  34. package/dist/src/providers/dht-storage-provider.tool.js +25 -0
  35. package/dist/src/providers/disk-storage-provider.tool.d.ts +45 -0
  36. package/dist/src/providers/disk-storage-provider.tool.d.ts.map +1 -0
  37. package/dist/src/providers/disk-storage-provider.tool.js +134 -0
  38. package/dist/src/providers/encrypted-storage-provider.tool.d.ts +1 -0
  39. package/dist/src/providers/encrypted-storage-provider.tool.d.ts.map +1 -0
  40. package/dist/src/providers/encrypted-storage-provider.tool.js +63 -0
  41. package/dist/src/providers/index.d.ts +6 -0
  42. package/dist/src/providers/index.d.ts.map +1 -0
  43. package/dist/src/providers/index.js +5 -0
  44. package/dist/src/providers/memory-storage-provider.tool.d.ts +32 -0
  45. package/dist/src/providers/memory-storage-provider.tool.d.ts.map +1 -0
  46. package/dist/src/providers/memory-storage-provider.tool.js +65 -0
  47. package/dist/src/providers/secure-storage-provider.tool.d.ts +25 -0
  48. package/dist/src/providers/secure-storage-provider.tool.d.ts.map +1 -0
  49. package/dist/src/providers/secure-storage-provider.tool.js +72 -0
  50. package/dist/src/providers/storage-provider.tool.d.ts +12 -0
  51. package/dist/src/providers/storage-provider.tool.d.ts.map +1 -0
  52. package/dist/src/providers/storage-provider.tool.js +41 -0
  53. package/dist/src/resolvers/placeholder.resolver.d.ts +6 -0
  54. package/dist/src/resolvers/placeholder.resolver.d.ts.map +1 -0
  55. package/dist/src/resolvers/placeholder.resolver.js +10 -0
  56. package/dist/src/storage.tool.d.ts +12 -0
  57. package/dist/src/storage.tool.d.ts.map +1 -0
  58. package/dist/src/storage.tool.js +46 -0
  59. package/dist/test/basic.spec.d.ts +1 -0
  60. package/dist/test/basic.spec.d.ts.map +1 -0
  61. package/dist/test/basic.spec.js +1 -0
  62. package/dist/test/data/bigfile.d.ts +2 -0
  63. package/dist/test/data/bigfile.d.ts.map +1 -0
  64. package/dist/test/data/bigfile.js +174 -0
  65. package/dist/test/placeholder.spec.d.ts +2 -0
  66. package/dist/test/placeholder.spec.d.ts.map +1 -0
  67. package/dist/test/placeholder.spec.js +61 -0
  68. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ TLDR; we created a forked MCP version that is faster, better, and cheaper. [Link to get started]
2
+
3
+ ## What is MCP Missing?
4
+
5
+ ### **Today / Problem Description**
6
+
7
+ MCP servers are built to enable LLM / AI systems to synthesize workflows from complex tasks. This means MCPs will work great if…
8
+
9
+ 1. You have built your MCP well (example: *as an intention-based tool, not as an API wrapper)*
10
+ 1. *You actively maintain* documentation to support *how* to use your services
11
+ 2. LLM / AI understands how to synthesize plans around small workflows using the tools provided
12
+ 2. You pay for intelligent models that can reason / do chain of thought processing.
13
+
14
+ Every LLM / AI system will need to rerun this, every time. Today it has no working memory on the workflows/plans it runs.
15
+
16
+ We asked ourselves…”why are these plans and workflows being thrown out?”
17
+
18
+ ### **Olane + MCP = oMCP**
19
+
20
+ We have forked the MCP client & server to capture and re-use these workflows, reducing intelligence requirements and improving MCP completion by X%. [Link to the repo]
21
+
22
+ ## How did we do this?
23
+
24
+ We centered our focus on these problems:
25
+
26
+ 1. How can we enable smaller models to succeed just like bigger ones?
27
+ 2. How can we reduce waste / reduce token usage?
28
+ 3. How can we make AI - MCP usage more deterministic?
29
+ 4. How can we improve the speed of MCP usage?
30
+
31
+ Like teaching a small child, we learned that by simply following the KISS model (KISS → “keep it simple stupid”), we achieved all of this and more.
32
+
33
+ > Smaller AI models need less noise and more clear instruction to succeed. In other words, “spell it out for them”
34
+ >
35
+
36
+ <aside>
37
+ 💡
38
+
39
+ *Engaging / thoughtful hook? Brendon scratchpad*
40
+
41
+ How do you get the *right* context from an MCP server to complete your task?
42
+
43
+ - Do you just throw everything at it? → No, this is wasteful
44
+ - Do you try to condense the knowledge to cost optimize? → Maybe…but how without data loss
45
+ - Do you try to organize MCP usage and learn from similar use-cases? Let’s try it and see what happens…
46
+ </aside>
47
+
48
+ ![normal-mcp.png](./docs/assets/normal-mcp.png)
49
+
50
+ ![o-mcp-flow.png](./docs/assets/o-mcp-flow.png)
51
+
52
+ ### Breaking it down further…
53
+
54
+ We combine large model successes + failures + a little search to help give small models a helping hand in achieving their dreams.
55
+
56
+ <aside>
57
+ 💡
58
+
59
+ We learn from past successes & failures to create few shot RL guidelines on how to best utilize the MCP server.
60
+
61
+ </aside>
62
+
63
+ **Example**:
64
+
65
+ ```
66
+ “Get my latest pull requests”
67
+ Results in the following steps:
68
+
69
+ 1. Client connects to MCP server with an “intent” + “model”
70
+ 2. The MCP server searches for past success, failure and relevant tool methods
71
+ 3. Client receives the package and creates new "workflow" tool uses
72
+ 4. Execute!
73
+ ```
74
+
75
+ ### So how does this meet our goals?
76
+
77
+ 1. Smaller model support → more relevant / clear context is now achieved
78
+ 2. Reduce token usage → avoid sending irrelevant context when possible / refine tool offerings & also reduce model size requirements
79
+ 3. More deterministic → by learning from past failures & successes, we know how to stay within the bounds of success with clear guardrails
80
+ 4. Speed improvement → less tokens to process = more speed
81
+
82
+ ### Examples
83
+
84
+ 1. Github example → what models can we test / prove to how it works?
85
+ 2. Figma example → same as above ^^
86
+ 3. Slack / more complex examples → same as above ^
@@ -0,0 +1,5 @@
1
+ export * from './storage.tool.js';
2
+ export * from './providers/index.js';
3
+ export * from './interfaces/index.js';
4
+ export * from './placeholder.tool.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './storage.tool.js';
2
+ export * from './providers/index.js';
3
+ export * from './interfaces/index.js';
4
+ export * from './placeholder.tool.js';
@@ -0,0 +1,4 @@
1
+ export interface GetDataResponse {
2
+ value: string | null;
3
+ }
4
+ //# sourceMappingURL=get-data.response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-data.response.d.ts","sourceRoot":"","sources":["../../../src/interfaces/get-data.response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './get-data.response.js';
2
+ export * from './placeholder-put.request.js';
3
+ export * from './placeholder-put.response.js';
4
+ export * from './placeholder-value.interface.js';
5
+ export * from './put.request.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './get-data.response.js';
2
+ export * from './placeholder-put.request.js';
3
+ export * from './placeholder-put.response.js';
4
+ export * from './placeholder-value.interface.js';
5
+ export * from './put.request.js';
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ import { oRequest } from '@olane/o-core';
3
+ import { RequestId, RequestParams } from '@olane/o-protocol';
4
+ export interface PlaceholderPutRequestParams extends RequestParams {
5
+ key: string;
6
+ value: string;
7
+ intent: string;
8
+ }
9
+ export declare class PlaceholderPutRequest extends oRequest {
10
+ params: PlaceholderPutRequestParams;
11
+ constructor(config: Request & {
12
+ params: PlaceholderPutRequestParams;
13
+ } & {
14
+ id: RequestId;
15
+ });
16
+ }
17
+ //# sourceMappingURL=placeholder-put.request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-put.request.d.ts","sourceRoot":"","sources":["../../../src/interfaces/placeholder-put.request.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;IACjD,MAAM,EAAE,2BAA2B,CAAC;gBAGlC,MAAM,EAAE,OAAO,GAAG;QAAE,MAAM,EAAE,2BAA2B,CAAA;KAAE,GAAG;QAC1D,EAAE,EAAE,SAAS,CAAC;KACf;CAKJ"}
@@ -0,0 +1,7 @@
1
+ import { oRequest } from '@olane/o-core';
2
+ export class PlaceholderPutRequest extends oRequest {
3
+ constructor(config) {
4
+ super(config);
5
+ this.params = config.params;
6
+ }
7
+ }
@@ -0,0 +1,8 @@
1
+ export interface PlaceholderPutResponse {
2
+ value: string;
3
+ intent: string;
4
+ summary: string;
5
+ instructions: string;
6
+ address: string;
7
+ }
8
+ //# sourceMappingURL=placeholder-put.response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-put.response.d.ts","sourceRoot":"","sources":["../../../src/interfaces/placeholder-put.response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface PlaceholderValue {
2
+ value: string;
3
+ intent: string;
4
+ summary: string;
5
+ }
6
+ //# sourceMappingURL=placeholder-value.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-value.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/placeholder-value.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { oRequest } from '@olane/o-core';
3
+ import { RequestId, RequestParams } from '@olane/o-protocol';
4
+ export interface PutRequestParams extends RequestParams {
5
+ key: string;
6
+ value: string;
7
+ }
8
+ export declare class PutRequest extends oRequest {
9
+ params: PutRequestParams;
10
+ constructor(config: Request & {
11
+ params: PutRequestParams;
12
+ } & {
13
+ id: RequestId;
14
+ });
15
+ }
16
+ //# sourceMappingURL=put.request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put.request.d.ts","sourceRoot":"","sources":["../../../src/interfaces/put.request.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,UAAW,SAAQ,QAAQ;IACtC,MAAM,EAAE,gBAAgB,CAAC;gBAGvB,MAAM,EAAE,OAAO,GAAG;QAAE,MAAM,EAAE,gBAAgB,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE;CAKrE"}
@@ -0,0 +1,7 @@
1
+ import { oRequest } from '@olane/o-core';
2
+ export class PutRequest extends oRequest {
3
+ constructor(config) {
4
+ super(config);
5
+ this.params = config.params;
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ import { oMethod } from '@olane/o-protocol';
2
+ export declare const PLACEHOLDER_STORAGE_PARAMS: {
3
+ [key: string]: oMethod;
4
+ };
5
+ //# sourceMappingURL=placeholder-storage.methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-storage.methods.d.ts","sourceRoot":"","sources":["../../../src/methods/placeholder-storage.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,eAAO,MAAM,0BAA0B,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CA8BhE,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { STORAGE_PARAMS } from './storage.methods.js';
2
+ export const PLACEHOLDER_STORAGE_PARAMS = {
3
+ ...STORAGE_PARAMS,
4
+ put: {
5
+ name: 'put',
6
+ description: 'Store data on disk',
7
+ dependencies: [],
8
+ parameters: [
9
+ {
10
+ name: 'key',
11
+ type: 'string',
12
+ value: 'string',
13
+ description: 'Store data on disk',
14
+ required: true,
15
+ },
16
+ {
17
+ name: 'value',
18
+ type: 'string',
19
+ value: 'string',
20
+ description: 'The data to store',
21
+ required: true,
22
+ },
23
+ {
24
+ name: 'intent',
25
+ type: 'string',
26
+ value: 'string',
27
+ description: 'The intent of the data',
28
+ required: false,
29
+ },
30
+ ],
31
+ },
32
+ };
@@ -0,0 +1,5 @@
1
+ import { oMethod } from '@olane/o-protocol';
2
+ export declare const STORAGE_PARAMS: {
3
+ [key: string]: oMethod;
4
+ };
5
+ //# sourceMappingURL=storage.methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.methods.d.ts","sourceRoot":"","sources":["../../../src/methods/storage.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,cAAc,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAgEpD,CAAC"}
@@ -0,0 +1,65 @@
1
+ export const STORAGE_PARAMS = {
2
+ put: {
3
+ name: 'put',
4
+ description: 'Store data on disk',
5
+ dependencies: [],
6
+ parameters: [
7
+ {
8
+ name: 'key',
9
+ type: 'string',
10
+ value: 'string',
11
+ description: 'Store data on disk',
12
+ required: true,
13
+ },
14
+ {
15
+ name: 'value',
16
+ type: 'string',
17
+ value: 'string',
18
+ description: 'The data to store',
19
+ required: true,
20
+ },
21
+ ],
22
+ },
23
+ get: {
24
+ name: 'get',
25
+ description: 'Retrieve data from disk',
26
+ dependencies: [],
27
+ parameters: [
28
+ {
29
+ name: 'key',
30
+ type: 'string',
31
+ value: 'string',
32
+ description: 'The key to retrieve',
33
+ required: true,
34
+ },
35
+ ],
36
+ },
37
+ delete: {
38
+ name: 'delete',
39
+ description: 'Delete data from disk',
40
+ dependencies: [],
41
+ parameters: [
42
+ {
43
+ name: 'key',
44
+ type: 'string',
45
+ value: 'string',
46
+ description: 'The key to delete',
47
+ required: true,
48
+ },
49
+ ],
50
+ },
51
+ has: {
52
+ name: 'has',
53
+ description: 'Check if data exists on disk',
54
+ dependencies: [],
55
+ parameters: [
56
+ {
57
+ name: 'key',
58
+ type: 'string',
59
+ value: 'string',
60
+ description: 'The key to check',
61
+ required: true,
62
+ },
63
+ ],
64
+ },
65
+ };
@@ -0,0 +1,10 @@
1
+ import { oToolConfig } from '@olane/o-tool';
2
+ import { MemoryStorageProvider } from './providers/memory-storage-provider.tool.js';
3
+ import { PlaceholderPutRequest } from './interfaces/placeholder-put.request.js';
4
+ import { PlaceholderPutResponse } from './interfaces/placeholder-put.response.js';
5
+ export declare class PlaceholderTool extends MemoryStorageProvider {
6
+ constructor(config: oToolConfig);
7
+ myTools(): Promise<string[]>;
8
+ _tool_put(request: PlaceholderPutRequest): Promise<PlaceholderPutResponse>;
9
+ }
10
+ //# sourceMappingURL=placeholder.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.tool.d.ts","sourceRoot":"","sources":["../../src/placeholder.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAGlF,qBAAa,eAAgB,SAAQ,qBAAqB;gBAC5C,MAAM,EAAE,WAAW;IAQzB,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAK5B,SAAS,CACb,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CA8DnC"}
@@ -0,0 +1,76 @@
1
+ import { oAddress, oRequest, RegexUtils } from '@olane/o-core';
2
+ import { MemoryStorageProvider } from './providers/memory-storage-provider.tool.js';
3
+ import { PLACEHOLDER_STORAGE_PARAMS } from './methods/placeholder-storage.methods.js';
4
+ export class PlaceholderTool extends MemoryStorageProvider {
5
+ constructor(config) {
6
+ super({
7
+ ...config,
8
+ address: new oAddress('o://placeholder'),
9
+ methods: PLACEHOLDER_STORAGE_PARAMS,
10
+ });
11
+ }
12
+ async myTools() {
13
+ const tools = await super.myTools(MemoryStorageProvider.prototype);
14
+ return tools;
15
+ }
16
+ async _tool_put(request) {
17
+ const { key, value, intent } = request.params;
18
+ if (!intent) {
19
+ this.logger.warn('Intent not provided, going to summarize without alignment for intent.');
20
+ }
21
+ this.logger.debug('Summarizing document for intent: ', intent);
22
+ // set a max length for value consideration
23
+ const response = await this.use(new oAddress('o://intelligence'), {
24
+ method: 'prompt',
25
+ params: {
26
+ prompt: `
27
+ You are a helpful assistant that summarizes documents as they relate to the user's intent.
28
+ Format the output in JSON using this template:
29
+ {
30
+ "summary": "string",
31
+ }
32
+ Rules:
33
+ 1. Do NOT include any other text other than the JSON response.
34
+ 2. If the intent is empty, simply summarize the document.
35
+ 3. The output should be concise and to the point.
36
+ 4. The summary value should use the Document Summarization Rules to summarize the document.
37
+
38
+ Document Summarization Rules:
39
+ 1. Extract the key points about the document.
40
+ 2. Filter the key points to only include information that is relevant to the user's intent.
41
+ 3. Include mentions of any file names or paths that are relevant to the user's intent in the summary.
42
+ 4. The first sentence should mention the type of document that you are summarizing.
43
+ 5. If the user's intent does not need to know anything about the document, return a very short summary.
44
+
45
+ The intent is ${intent || 'empty'}.
46
+ The document is ${value.substring(0, 50000)}.
47
+ `,
48
+ },
49
+ });
50
+ const data = response.result.data;
51
+ this.logger.debug('Placeholder AI put response: ', data);
52
+ const { summary } = RegexUtils.extractResultFromAI(data.message);
53
+ const req = new oRequest({
54
+ method: 'put',
55
+ id: request.id,
56
+ params: {
57
+ _connectionId: request.params._connectionId,
58
+ _requestMethod: request.params._requestMethod,
59
+ key,
60
+ value: JSON.stringify({
61
+ value,
62
+ intent,
63
+ summary,
64
+ }),
65
+ },
66
+ });
67
+ await super._tool_put(req);
68
+ return {
69
+ value,
70
+ intent,
71
+ summary,
72
+ instructions: `To save on context window size, I have summarized the document and the contents are available at this address: "${this.address.toString()}/${key}". This address represents the original value and it will be automatically translated before it gets to the tool. DO NOT "get" the contents of this address unless absolutely necessary. \n\nThe summary for this document is: ${summary}.`,
73
+ address: `${this.address.toString()}/${key}`,
74
+ };
75
+ }
76
+ }
@@ -0,0 +1,12 @@
1
+ import { oToolConfig, ToolResult } from '@olane/o-tool';
2
+ import { StorageProviderTool } from './storage-provider.tool.js';
3
+ import { oRequest } from '@olane/o-core';
4
+ import { GetDataResponse } from '../interfaces/get-data.response.js';
5
+ export declare class DhtStorageProvider extends StorageProviderTool {
6
+ constructor(config: oToolConfig);
7
+ _tool_put(request: oRequest): Promise<ToolResult>;
8
+ _tool_get(request: oRequest): Promise<GetDataResponse>;
9
+ _tool_delete(request: oRequest): Promise<ToolResult>;
10
+ _tool_has(request: oRequest): Promise<ToolResult>;
11
+ }
12
+ //# sourceMappingURL=dht-storage-provider.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dht-storage-provider.tool.d.ts","sourceRoot":"","sources":["../../../src/providers/dht-storage-provider.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,qBAAa,kBAAmB,SAAQ,mBAAmB;gBAC7C,MAAM,EAAE,WAAW;IASzB,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjD,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAItD,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAIpD,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAGxD"}
@@ -0,0 +1,25 @@
1
+ import { StorageProviderTool } from './storage-provider.tool.js';
2
+ import { oAddress } from '@olane/o-core';
3
+ import { STORAGE_PARAMS } from '../methods/storage.methods.js';
4
+ export class DhtStorageProvider extends StorageProviderTool {
5
+ constructor(config) {
6
+ super({
7
+ ...config,
8
+ address: new oAddress('o://dht'),
9
+ methods: STORAGE_PARAMS,
10
+ description: 'Distributed hash table storage provider',
11
+ });
12
+ }
13
+ async _tool_put(request) {
14
+ throw new Error('Not implemented');
15
+ }
16
+ async _tool_get(request) {
17
+ throw new Error('Not implemented');
18
+ }
19
+ async _tool_delete(request) {
20
+ throw new Error('Not implemented');
21
+ }
22
+ async _tool_has(request) {
23
+ throw new Error('Not implemented');
24
+ }
25
+ }
@@ -0,0 +1,45 @@
1
+ import { oToolConfig, ToolResult } from '@olane/o-tool';
2
+ import { StorageProviderTool } from './storage-provider.tool.js';
3
+ import { oAddress, oRequest } from '@olane/o-core';
4
+ import { GetDataResponse } from '../interfaces/get-data.response.js';
5
+ interface DiskStorageConfig extends oToolConfig {
6
+ storageDir?: string;
7
+ address?: oAddress;
8
+ }
9
+ export declare class DiskStorageProvider extends StorageProviderTool {
10
+ private storageDir;
11
+ constructor(config: DiskStorageConfig);
12
+ /**
13
+ * Ensure the storage directory exists
14
+ */
15
+ protected ensureStorageDir(): Promise<void>;
16
+ /**
17
+ * Get the file path for a given key
18
+ */
19
+ protected getFilePath(key: string): string;
20
+ /**
21
+ * Store data on disk
22
+ * @param key The key to store the data under
23
+ * @param value The data to store
24
+ */
25
+ _tool_put(request: oRequest): Promise<ToolResult>;
26
+ /**
27
+ * Retrieve data from disk
28
+ * @param key The key to retrieve
29
+ * @returns The stored data or null if not found
30
+ */
31
+ _tool_get(request: oRequest): Promise<GetDataResponse>;
32
+ /**
33
+ * Delete data from disk
34
+ * @param key The key to delete
35
+ */
36
+ _tool_delete(request: oRequest): Promise<ToolResult>;
37
+ /**
38
+ * Check if a key exists on disk
39
+ * @param key The key to check
40
+ * @returns Whether the key exists
41
+ */
42
+ _tool_has(request: oRequest): Promise<ToolResult>;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=disk-storage-provider.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disk-storage-provider.tool.d.ts","sourceRoot":"","sources":["../../../src/providers/disk-storage-provider.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAuB,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIxE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAOD,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC1D,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,iBAAiB;IAarC;;OAEG;cACa,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjD;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAM1C;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BvD;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAW5D;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAyB1D;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAyBxD"}