@olane/o-core 0.1.1 → 0.1.3
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/dist/core/core.node.js +33 -49
- package/dist/core/defaults/config.js +5 -11
- package/dist/core/defaults/index.d.ts +1 -1
- package/dist/core/defaults/index.d.ts.map +1 -1
- package/dist/core/defaults/index.js +1 -17
- package/dist/core/graceful-shutdown.d.ts +25 -0
- package/dist/core/graceful-shutdown.d.ts.map +1 -0
- package/dist/core/graceful-shutdown.js +84 -0
- package/dist/core/index.d.ts +10 -9
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +10 -25
- package/dist/core/interfaces/connection-manager.config.js +1 -2
- package/dist/core/interfaces/connection-send-params.interface.js +1 -2
- package/dist/core/interfaces/core-config.interface.js +1 -2
- package/dist/core/interfaces/index.d.ts +5 -5
- package/dist/core/interfaces/index.d.ts.map +1 -1
- package/dist/core/interfaces/index.js +5 -21
- package/dist/core/interfaces/node-type.enum.js +2 -5
- package/dist/core/interfaces/restricted-addresses.enum.js +11 -14
- package/dist/core/interfaces/state.enum.js +2 -5
- package/dist/core/interfaces/use-options.interface.js +1 -2
- package/dist/core/lib/index.d.ts +7 -7
- package/dist/core/lib/index.d.ts.map +1 -1
- package/dist/core/lib/index.js +7 -23
- package/dist/core/lib/o-address-resolution.js +6 -8
- package/dist/core/lib/o-address-resolver.js +5 -12
- package/dist/core/lib/o-connection-manager.js +4 -10
- package/dist/core/lib/o-connection.js +16 -26
- package/dist/core/lib/o-request.js +3 -11
- package/dist/core/lib/o-response.js +3 -10
- package/dist/core/lib/resolvers/anything.resolver.js +4 -8
- package/dist/core/lib/resolvers/index.d.ts +4 -4
- package/dist/core/lib/resolvers/index.d.ts.map +1 -1
- package/dist/core/lib/resolvers/index.js +4 -20
- package/dist/core/lib/resolvers/method.resolver.js +4 -8
- package/dist/core/lib/resolvers/next-hop.resolver.js +9 -13
- package/dist/core/lib/resolvers/storage.resolver.js +2 -6
- package/dist/core/o-address.d.ts +1 -1
- package/dist/core/o-address.d.ts.map +1 -1
- package/dist/core/o-address.js +5 -11
- package/dist/core/o-dependency.js +1 -7
- package/dist/core/o-parameter.js +1 -10
- package/dist/core/utils/core.utils.d.ts +1 -1
- package/dist/core/utils/core.utils.d.ts.map +1 -1
- package/dist/core/utils/core.utils.js +17 -54
- package/dist/core/utils/index.d.ts +3 -3
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +3 -19
- package/dist/core/utils/logger.js +9 -18
- package/dist/core/utils/network.utils.js +2 -6
- package/dist/error/enums/codes.error.js +2 -5
- package/dist/error/index.d.ts +2 -2
- package/dist/error/index.d.ts.map +1 -1
- package/dist/error/index.js +2 -18
- package/dist/error/tool.error.js +3 -8
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -22
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +3 -19
- package/dist/node/lib/local-search.lib.js +1 -5
- package/dist/node/lib/network-activity.lib.js +3 -9
- package/dist/node/node.js +42 -44
- package/dist/node-host/host.node.js +5 -9
- package/dist/node-host/index.d.ts +1 -1
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +1 -17
- package/dist/node-virtual/index.d.ts +1 -1
- package/dist/node-virtual/index.d.ts.map +1 -1
- package/dist/node-virtual/index.js +1 -17
- package/dist/node-virtual/virtual.node.js +4 -8
- package/dist/plan/agent.plan.js +13 -17
- package/dist/plan/configure/configure.plan.js +6 -10
- package/dist/plan/error/error.plan.js +6 -11
- package/dist/plan/index.d.ts +4 -4
- package/dist/plan/index.d.ts.map +1 -1
- package/dist/plan/index.js +4 -20
- package/dist/plan/interfaces/plan-config.interface.js +1 -2
- package/dist/plan/interfaces/plan-result.interface.js +1 -2
- package/dist/plan/interfaces/plan-type.enum.js +2 -5
- package/dist/plan/interfaces/plan.result.js +1 -2
- package/dist/plan/interfaces/query.config.js +1 -2
- package/dist/plan/interfaces/task.config.js +1 -2
- package/dist/plan/o-plan.d.ts +1 -1
- package/dist/plan/o-plan.d.ts.map +1 -1
- package/dist/plan/o-plan.js +19 -60
- package/dist/plan/plan.context.js +2 -6
- package/dist/plan/prompts/agent.prompt.js +2 -6
- package/dist/plan/prompts/configure.prompt.js +2 -6
- package/dist/plan/prompts/custom.prompt.js +1 -5
- package/dist/plan/prompts/error.prompt.js +1 -5
- package/dist/plan/prompts/search.prompt.js +1 -5
- package/dist/plan/search/prompts/search-analysis.prompt.js +1 -5
- package/dist/plan/search/search.plan.js +4 -10
- package/dist/plan/use/index.js +1 -17
- package/dist/plan/use/use.plan.js +9 -13
- package/package.json +6 -5
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const o_plan_1 = require("../o-plan");
|
|
5
|
-
const plan_type_enum_1 = require("../interfaces/plan-type.enum");
|
|
6
|
-
const configure_prompt_1 = require("../prompts/configure.prompt");
|
|
1
|
+
import { oPlan } from '../o-plan';
|
|
2
|
+
import { oPlanType } from '../interfaces/plan-type.enum';
|
|
3
|
+
import { CONFIGURE_PROMPT } from '../prompts/configure.prompt';
|
|
7
4
|
/**
|
|
8
5
|
* We know what tool we want to use, let's configure it.
|
|
9
6
|
*/
|
|
10
|
-
class oConfigurePlan extends
|
|
7
|
+
export class oConfigurePlan extends oPlan {
|
|
11
8
|
constructor(config) {
|
|
12
9
|
super(config);
|
|
13
|
-
this.config.promptFunction =
|
|
10
|
+
this.config.promptFunction = CONFIGURE_PROMPT;
|
|
14
11
|
}
|
|
15
12
|
type() {
|
|
16
|
-
return
|
|
13
|
+
return oPlanType.CONFIGURE;
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.oConfigurePlan = oConfigurePlan;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const o_plan_1 = require("../o-plan");
|
|
6
|
-
const error_prompt_1 = require("../prompts/error.prompt");
|
|
7
|
-
class oErrorPlan extends o_plan_1.oPlan {
|
|
8
|
-
error;
|
|
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 {
|
|
9
5
|
constructor(config) {
|
|
10
6
|
super(config);
|
|
11
7
|
this.error = config.error;
|
|
12
8
|
}
|
|
13
9
|
async run() {
|
|
14
|
-
const prompt =
|
|
10
|
+
const prompt = ERROR_PROMPT(this.error, this.agentHistory);
|
|
15
11
|
this.logger.debug('Error prompt: ', prompt);
|
|
16
|
-
const response = await this.node.use(new
|
|
12
|
+
const response = await this.node.use(new oAddress('o://intelligence'), {
|
|
17
13
|
method: 'prompt',
|
|
18
14
|
params: {
|
|
19
15
|
prompt: prompt,
|
|
@@ -22,4 +18,3 @@ class oErrorPlan extends o_plan_1.oPlan {
|
|
|
22
18
|
return response.result.data;
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
exports.oErrorPlan = oErrorPlan;
|
package/dist/plan/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './o-plan';
|
|
2
|
-
export * from './interfaces/plan-config.interface';
|
|
3
|
-
export * from './interfaces/plan-result.interface';
|
|
4
|
-
export * from './use';
|
|
1
|
+
export * from './o-plan.js';
|
|
2
|
+
export * from './interfaces/plan-config.interface.js';
|
|
3
|
+
export * from './interfaces/plan-result.interface.js';
|
|
4
|
+
export * from './use/index.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/plan/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plan/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plan/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,gBAAgB,CAAC"}
|
package/dist/plan/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./o-plan"), exports);
|
|
18
|
-
__exportStar(require("./interfaces/plan-config.interface"), exports);
|
|
19
|
-
__exportStar(require("./interfaces/plan-result.interface"), exports);
|
|
20
|
-
__exportStar(require("./use"), exports);
|
|
1
|
+
export * from './o-plan.js';
|
|
2
|
+
export * from './interfaces/plan-config.interface.js';
|
|
3
|
+
export * from './interfaces/plan-result.interface.js';
|
|
4
|
+
export * from './use/index.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oPlanType = void 0;
|
|
4
|
-
var oPlanType;
|
|
1
|
+
export var oPlanType;
|
|
5
2
|
(function (oPlanType) {
|
|
6
3
|
oPlanType["ANALYSIS"] = "analysis";
|
|
7
4
|
oPlanType["SEARCH"] = "search";
|
|
8
5
|
oPlanType["CONFIGURE"] = "configure";
|
|
9
6
|
oPlanType["USE"] = "use";
|
|
10
|
-
})(oPlanType || (
|
|
7
|
+
})(oPlanType || (oPlanType = {}));
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/plan/o-plan.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger, oAddress } from '../';
|
|
2
2
|
import { oPlanConfig } from './interfaces/plan-config.interface';
|
|
3
|
-
import { CID } from 'multiformats
|
|
3
|
+
import { CID } from 'multiformats';
|
|
4
4
|
import { oPlanResult } from './interfaces/plan.result';
|
|
5
5
|
export declare class oPlan {
|
|
6
6
|
protected readonly config: oPlanConfig;
|
|
@@ -1 +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,
|
|
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,cAAc,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,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"}
|
package/dist/plan/o-plan.js
CHANGED
|
@@ -1,54 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.oPlan = void 0;
|
|
37
|
-
const __1 = require("../");
|
|
38
|
-
const cid_1 = require("multiformats/cid");
|
|
39
|
-
const json = __importStar(require("multiformats/codecs/json"));
|
|
40
|
-
const sha2_1 = require("multiformats/hashes/sha2");
|
|
41
|
-
const agent_prompt_1 = require("./prompts/agent.prompt");
|
|
42
|
-
const uuid_1 = require("uuid");
|
|
43
|
-
class oPlan {
|
|
44
|
-
config;
|
|
45
|
-
logger;
|
|
46
|
-
sequence = [];
|
|
47
|
-
cid;
|
|
48
|
-
result;
|
|
1
|
+
import { Logger, oAddress, oToolError } from '../';
|
|
2
|
+
import { CID } from 'multiformats';
|
|
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 {
|
|
49
8
|
constructor(config) {
|
|
50
9
|
this.config = config;
|
|
51
|
-
this.
|
|
10
|
+
this.sequence = [];
|
|
11
|
+
this.logger = new Logger('oPlan:' + `[${this.config.intent}]`);
|
|
52
12
|
this.sequence = this.config.sequence || [];
|
|
53
13
|
}
|
|
54
14
|
get caller() {
|
|
@@ -82,8 +42,8 @@ class oPlan {
|
|
|
82
42
|
return this.cid;
|
|
83
43
|
}
|
|
84
44
|
const bytes = json.encode(this.toCIDInput());
|
|
85
|
-
const hash = await
|
|
86
|
-
const cid =
|
|
45
|
+
const hash = await sha256.digest(bytes);
|
|
46
|
+
const cid = CID.create(1, json.code, hash);
|
|
87
47
|
return cid;
|
|
88
48
|
}
|
|
89
49
|
async storePlan() {
|
|
@@ -94,7 +54,7 @@ class oPlan {
|
|
|
94
54
|
value: JSON.stringify(this.toJSON()),
|
|
95
55
|
};
|
|
96
56
|
this.logger.debug('Storing plan params: ', params);
|
|
97
|
-
await this.node.use(new
|
|
57
|
+
await this.node.use(new oAddress('o://plan'), {
|
|
98
58
|
method: 'put',
|
|
99
59
|
params: params,
|
|
100
60
|
});
|
|
@@ -109,7 +69,7 @@ class oPlan {
|
|
|
109
69
|
async searchPlans() {
|
|
110
70
|
this.logger.debug('Searching for plans...');
|
|
111
71
|
const cid = await this.toCID();
|
|
112
|
-
const response = await this.node.use(new
|
|
72
|
+
const response = await this.node.use(new oAddress('o://plan'), {
|
|
113
73
|
method: 'get',
|
|
114
74
|
params: {
|
|
115
75
|
key: cid.toString(),
|
|
@@ -152,10 +112,10 @@ class oPlan {
|
|
|
152
112
|
prompt = this.config.promptFunction(this.config.intent, ctxt, this.agentHistory);
|
|
153
113
|
}
|
|
154
114
|
else {
|
|
155
|
-
prompt =
|
|
115
|
+
prompt = AGENT_PROMPT(this.config.intent, ctxt, this.agentHistory);
|
|
156
116
|
}
|
|
157
117
|
this.logger.debug('Prompt: ', prompt);
|
|
158
|
-
const response = await this.node.use(new
|
|
118
|
+
const response = await this.node.use(new oAddress('o://intelligence'), {
|
|
159
119
|
method: 'prompt',
|
|
160
120
|
params: {
|
|
161
121
|
prompt: prompt,
|
|
@@ -164,7 +124,7 @@ class oPlan {
|
|
|
164
124
|
if (response.result.error) {
|
|
165
125
|
this.logger.error('Error in plan: ', response.result.error);
|
|
166
126
|
const error = response.result.error;
|
|
167
|
-
throw new
|
|
127
|
+
throw new oToolError(error.code, error.message);
|
|
168
128
|
}
|
|
169
129
|
const data = response.result.data;
|
|
170
130
|
const message = data.message;
|
|
@@ -179,7 +139,7 @@ class oPlan {
|
|
|
179
139
|
}
|
|
180
140
|
async handleNetworkChanges() {
|
|
181
141
|
const cid = await this.toCID();
|
|
182
|
-
await this.node.use(new
|
|
142
|
+
await this.node.use(new oAddress('o://leader'), {
|
|
183
143
|
method: 'save_plan',
|
|
184
144
|
params: {
|
|
185
145
|
plan: `o://plan/${cid}`,
|
|
@@ -189,7 +149,7 @@ class oPlan {
|
|
|
189
149
|
async addReasoning() {
|
|
190
150
|
if (this.result?.reasoning) {
|
|
191
151
|
this.logger.debug('Adding knowledge: ', this.result?.reasoning);
|
|
192
|
-
await this.node.use(new
|
|
152
|
+
await this.node.use(new oAddress('o://vector-store'), {
|
|
193
153
|
method: 'add_documents',
|
|
194
154
|
params: {
|
|
195
155
|
documents: [
|
|
@@ -197,7 +157,7 @@ class oPlan {
|
|
|
197
157
|
pageContent: this.result?.reasoning,
|
|
198
158
|
metadata: {
|
|
199
159
|
address: this.caller?.toString(),
|
|
200
|
-
id: (
|
|
160
|
+
id: uuidv4(),
|
|
201
161
|
},
|
|
202
162
|
},
|
|
203
163
|
],
|
|
@@ -219,4 +179,3 @@ class oPlan {
|
|
|
219
179
|
return response;
|
|
220
180
|
}
|
|
221
181
|
}
|
|
222
|
-
exports.oPlan = oPlan;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oPlanContext = void 0;
|
|
4
|
-
class oPlanContext {
|
|
5
|
-
context = [];
|
|
1
|
+
export class oPlanContext {
|
|
6
2
|
constructor(context) {
|
|
3
|
+
this.context = [];
|
|
7
4
|
this.context = context;
|
|
8
5
|
}
|
|
9
6
|
add(value) {
|
|
@@ -29,4 +26,3 @@ class oPlanContext {
|
|
|
29
26
|
return '\n\n' + this.context.join('\n') + '\n\n';
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.oPlanContext = oPlanContext;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AGENT_PROMPT = void 0;
|
|
4
|
-
const custom_prompt_1 = require("./custom.prompt");
|
|
5
|
-
const AGENT_PROMPT = (intent, context, agentHistory) => (0, custom_prompt_1.CUSTOM_AGENT_PROMPT)(intent, context, agentHistory, `
|
|
1
|
+
import { CUSTOM_AGENT_PROMPT } from './custom.prompt';
|
|
2
|
+
export const AGENT_PROMPT = (intent, context, agentHistory) => CUSTOM_AGENT_PROMPT(intent, context, agentHistory, `
|
|
6
3
|
Every Step Instructions:
|
|
7
4
|
1. Review the provided user intent and context
|
|
8
5
|
2. If you can complete the user intent, return the answer using the "Return Instructions" steps
|
|
@@ -95,4 +92,3 @@ Error Results:
|
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
`);
|
|
98
|
-
exports.AGENT_PROMPT = AGENT_PROMPT;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CONFIGURE_PROMPT = void 0;
|
|
4
|
-
const custom_prompt_1 = require("./custom.prompt");
|
|
5
|
-
const CONFIGURE_PROMPT = (intent, context, agentHistory) => (0, custom_prompt_1.CUSTOM_AGENT_PROMPT)(intent, context, agentHistory, `
|
|
1
|
+
import { CUSTOM_AGENT_PROMPT } from './custom.prompt';
|
|
2
|
+
export const CONFIGURE_PROMPT = (intent, context, agentHistory) => CUSTOM_AGENT_PROMPT(intent, context, agentHistory, `
|
|
6
3
|
Every Step Instructions:
|
|
7
4
|
1. Review the provided user intent and context
|
|
8
5
|
2. If you can complete the user intent, return the answer using the "Return Instructions" steps
|
|
@@ -56,4 +53,3 @@ Error Results:
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
`);
|
|
59
|
-
exports.CONFIGURE_PROMPT = CONFIGURE_PROMPT;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CUSTOM_AGENT_PROMPT = void 0;
|
|
4
|
-
const CUSTOM_AGENT_PROMPT = (intent, context, agentHistory, cycleInstructions, outputInstructions) => `
|
|
1
|
+
export const CUSTOM_AGENT_PROMPT = (intent, context, agentHistory, cycleInstructions, outputInstructions) => `
|
|
5
2
|
You are an AI agent that resolves user intent within the "olane" hierarchical network of tools and returns JSON formatted results.
|
|
6
3
|
|
|
7
4
|
You are in a secure environment and are allowed to operate with secure information such as api keys and other sensitive data.
|
|
@@ -56,4 +53,3 @@ ${agentHistory}
|
|
|
56
53
|
[Previous Cycle Results End]
|
|
57
54
|
|
|
58
55
|
`;
|
|
59
|
-
exports.CUSTOM_AGENT_PROMPT = CUSTOM_AGENT_PROMPT;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERROR_PROMPT = void 0;
|
|
4
|
-
const ERROR_PROMPT = (error, agentHistory) => `
|
|
1
|
+
export const ERROR_PROMPT = (error, agentHistory) => `
|
|
5
2
|
You are an AI agent that helps the user fix an error.
|
|
6
3
|
|
|
7
4
|
General Information:
|
|
@@ -40,4 +37,3 @@ Error Output Format:
|
|
|
40
37
|
[Agentic State]
|
|
41
38
|
${agentHistory}
|
|
42
39
|
`;
|
|
43
|
-
exports.ERROR_PROMPT = ERROR_PROMPT;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEARCH_PROMPT = void 0;
|
|
4
|
-
const SEARCH_PROMPT = (intent, context) => `
|
|
1
|
+
export const SEARCH_PROMPT = (intent, context) => `
|
|
5
2
|
You are a helpful assistant that searches for unknown entities in the user's input or returns a tool address that helps complete the user's task.
|
|
6
3
|
|
|
7
4
|
All entities are hosted within a network of p2p nodes and are tools, data, or other items.
|
|
@@ -44,4 +41,3 @@ Search Output Format:
|
|
|
44
41
|
Additional Context: ${context}
|
|
45
42
|
|
|
46
43
|
`;
|
|
47
|
-
exports.SEARCH_PROMPT = SEARCH_PROMPT;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEARCH_ANALYSIS_PROMPT = void 0;
|
|
4
|
-
const SEARCH_ANALYSIS_PROMPT = (intent, results) => {
|
|
1
|
+
export const SEARCH_ANALYSIS_PROMPT = (intent, results) => {
|
|
5
2
|
return `
|
|
6
3
|
You are a helpful assistant that analyzes search results to complete the user intent.
|
|
7
4
|
|
|
@@ -15,4 +12,3 @@ const SEARCH_ANALYSIS_PROMPT = (intent, results) => {
|
|
|
15
12
|
Search Results: ${results}
|
|
16
13
|
`;
|
|
17
14
|
};
|
|
18
|
-
exports.SEARCH_ANALYSIS_PROMPT = SEARCH_ANALYSIS_PROMPT;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const core_1 = require("../../core");
|
|
5
|
-
const o_plan_1 = require("../o-plan");
|
|
6
|
-
class oSearchPlan extends o_plan_1.oPlan {
|
|
7
|
-
query;
|
|
8
|
-
external;
|
|
1
|
+
import { oAddress } from '../../core';
|
|
2
|
+
import { oPlan } from '../o-plan';
|
|
3
|
+
export class oSearchPlan extends oPlan {
|
|
9
4
|
constructor(config) {
|
|
10
5
|
super(config);
|
|
11
6
|
this.query = config.query;
|
|
@@ -31,7 +26,7 @@ class oSearchPlan extends o_plan_1.oPlan {
|
|
|
31
26
|
* Search internal providers such as the local vector store, local database, etc.
|
|
32
27
|
*/
|
|
33
28
|
async internalSearch() {
|
|
34
|
-
const response = await this.node.use(new
|
|
29
|
+
const response = await this.node.use(new oAddress('o://search'), {
|
|
35
30
|
method: 'vector',
|
|
36
31
|
params: {
|
|
37
32
|
query: this.query,
|
|
@@ -49,4 +44,3 @@ class oSearchPlan extends o_plan_1.oPlan {
|
|
|
49
44
|
return result;
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
|
-
exports.oSearchPlan = oSearchPlan;
|
package/dist/plan/use/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./use.plan"), exports);
|
|
1
|
+
export * from './use.plan';
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const plan_type_enum_1 = require("../interfaces/plan-type.enum");
|
|
7
|
-
const error_1 = require("../../error");
|
|
8
|
-
const codes_error_1 = require("../../error/enums/codes.error");
|
|
1
|
+
import { oAddress } from '../../core';
|
|
2
|
+
import { oPlan } from '../o-plan';
|
|
3
|
+
import { oPlanType } from '../interfaces/plan-type.enum';
|
|
4
|
+
import { oToolError } from '../../error';
|
|
5
|
+
import { oToolErrorCodes } from '../../error/enums/codes.error';
|
|
9
6
|
/**
|
|
10
7
|
* We know what tool we want to use, let's use it.
|
|
11
8
|
*/
|
|
12
|
-
class oUsePlan extends
|
|
9
|
+
export class oUsePlan extends oPlan {
|
|
13
10
|
type() {
|
|
14
|
-
return
|
|
11
|
+
return oPlanType.USE;
|
|
15
12
|
}
|
|
16
13
|
async handleDependencies(dependencies) {
|
|
17
14
|
const response = [];
|
|
18
15
|
for (const dependency of dependencies) {
|
|
19
16
|
// TODO: we need to handle the method for the dependency
|
|
20
|
-
const result = await this.node.use(new
|
|
17
|
+
const result = await this.node.use(new oAddress(dependency.address), {});
|
|
21
18
|
response.push(result);
|
|
22
19
|
}
|
|
23
20
|
return response;
|
|
@@ -48,7 +45,7 @@ class oUsePlan extends o_plan_1.oPlan {
|
|
|
48
45
|
return error;
|
|
49
46
|
}
|
|
50
47
|
if (!handshake) {
|
|
51
|
-
throw new
|
|
48
|
+
throw new oToolError(oToolErrorCodes.TOOL_ERROR, 'Failed to configure the tool use');
|
|
52
49
|
}
|
|
53
50
|
const response = await this.node.use(this.config.receiver, {
|
|
54
51
|
method: handshake.payload?.method,
|
|
@@ -72,4 +69,3 @@ class oUsePlan extends o_plan_1.oPlan {
|
|
|
72
69
|
};
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
|
-
exports.oUsePlan = oUsePlan;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"webpack-dev-server": "^5.2.2"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"@olane/o-config": "^0.1.
|
|
69
|
-
"@olane/o-protocol": "^0.1.
|
|
69
|
+
"@olane/o-config": "^0.1.3",
|
|
70
|
+
"@olane/o-protocol": "^0.1.3"
|
|
70
71
|
},
|
|
71
72
|
"dependencies": {
|
|
72
73
|
"chalk": "^5.4.1",
|